From ec04cf59653bf4b1b6c2e38f8400b1ae27ca30e8 Mon Sep 17 00:00:00 2001 From: Teamcity Date: Fri, 21 Jun 2024 17:48:08 +0000 Subject: [PATCH] Release: 0.2.1 --- .github/workflows/fake-pr-tests.yml | 18 - .gitignore | 2 - .npmrc | 1 + adapter/0.1.10.json | 25 +- adapter/0.1.117.json | 17 +- adapter/0.1.14.json | 10 +- adapter/0.1.18.json | 10 +- adapter/0.1.33.json | 6 +- adapter/0.1.36.json | 5 +- adapter/0.1.68.json | 24 +- adapter/0.1.73.json | 102 +- adapter/0.1.83.json | 10 +- adapter/0.1.87.json | 24 +- adapter/0.1.93.json | 22 +- central_pane/dtdAbbreviation.json | 2 +- forward_engineering/api.js | 419 +- forward_engineering/config.json | 2 +- .../ddlProvider/ddlProvider.js | 278 +- .../ddlProvider/ddlTemplates.js | 54 - .../helpers/alterScriptBuilder.js | 114 - .../helpers/alterScriptFromDeltaHelper.js | 529 - .../helpers/appDependencies.js | 11 - forward_engineering/helpers/columnHelper.js | 39 - forward_engineering/helpers/commentsHelper.js | 47 - forward_engineering/helpers/createHelper.js | 60 - .../dbConnectionService/applyToInstance.js | 89 - .../helpers/dbConnectionService/index.js | 8 - .../dbConnectionService/testConnection.js | 11 - .../helpers/enums/reservedWords.js | 75 - forward_engineering/helpers/generalHelper.js | 239 - .../helpers/getScriptOptions.js | 12 - forward_engineering/helpers/indexHelper.js | 354 - forward_engineering/helpers/keyspaceHelper.js | 54 - forward_engineering/helpers/schemaHelper.js | 87 - forward_engineering/helpers/tableHelper.js | 192 - .../helpers/tableOptionService/getDiff.js | 98 - .../tableOptionService/parseToString.js | 220 - forward_engineering/helpers/typeHelper.js | 244 - .../helpers/types/AlterScriptDto.js | 88 - .../helpers/types/PersistenceSchemaChild.js | 50 - forward_engineering/helpers/udtHelper.js | 137 - .../helpers/updateHelpers/generalHelper.js | 54 - .../helpers/updateHelpers/indexHelper.js | 502 - .../helpers/updateHelpers/indexService.js | 145 - .../helpers/updateHelpers/keySpaceHelper.js | 184 - .../helpers/updateHelpers/tableHelper.js | 265 - .../helpers/updateHelpers/udtHelper.js | 296 - .../helpers/updateHelpers/viewHelper.js | 125 - forward_engineering/helpers/viewHelper.js | 275 - forward_engineering/package-lock.json | 8 - forward_engineering/package.json | 9 - jsonSchemaProperties.json | 7 +- package.json | 125 +- polyglot/adapter.json | 8 +- .../container_level/containerLevelConfig.json | 201 +- properties_pane/defaultData.json | 2 +- .../entity_level/entityLevelConfig.json | 54 +- .../field_level/fieldLevelConfig.json | 543 +- .../model_level/modelLevelConfig.json | 16 +- .../view_level/viewLevelConfig.json | 4 +- reverse_engineering/antlrErrorListener.js | 9 - reverse_engineering/api.js | 862 +- reverse_engineering/cassandraHelper.js | 1186 - reverse_engineering/cassandraRetryPolicy.js | 76 - reverse_engineering/commandsHelper.js | 303 - reverse_engineering/commandsService.js | 404 - reverse_engineering/compileGrammars.sh | 0 reverse_engineering/config.json | 16 +- .../connectionSettingsModalConfig.json | 94 +- .../cqlToCollectionsVisitor.js | 1105 - reverse_engineering/grammars/CqlLexer.g4 | 1277 - reverse_engineering/grammars/CqlParser.g4 | 1749 - reverse_engineering/helpers/commandsHelper.js | 63 - .../helpers/createTableOptionsFromMeta.js | 53 - .../helpers/filterComplexUdt.js | 75 - reverse_engineering/logHelper.js | 56 - reverse_engineering/node_modules/.bin/xml2js | 1 - .../node_modules/.package-lock.json | 165 - .../node_modules/@types/long/LICENSE | 21 - .../node_modules/@types/long/README.md | 3 - .../node_modules/@types/long/package.json | 12 - .../node_modules/@types/node/LICENSE | 21 - .../node_modules/@types/node/README.md | 15 - .../node_modules/@types/node/assert.d.ts | 996 - .../@types/node/assert/strict.d.ts | 8 - .../node_modules/@types/node/async_hooks.d.ts | 539 - .../node_modules/@types/node/buffer.d.ts | 2362 -- .../@types/node/child_process.d.ts | 1540 - .../node_modules/@types/node/cluster.d.ts | 432 - .../node_modules/@types/node/console.d.ts | 415 - .../node_modules/@types/node/constants.d.ts | 19 - .../node_modules/@types/node/crypto.d.ts | 4456 --- .../node_modules/@types/node/dgram.d.ts | 586 - .../@types/node/diagnostics_channel.d.ts | 191 - .../node_modules/@types/node/dns.d.ts | 809 - .../@types/node/dns/promises.d.ts | 425 - .../node_modules/@types/node/dom-events.d.ts | 122 - .../node_modules/@types/node/domain.d.ts | 170 - .../node_modules/@types/node/events.d.ts | 879 - .../node_modules/@types/node/fs.d.ts | 4291 --- .../node_modules/@types/node/fs/promises.d.ts | 1239 - .../node_modules/@types/node/globals.d.ts | 411 - .../@types/node/globals.global.d.ts | 1 - .../node_modules/@types/node/http.d.ts | 1888 - .../node_modules/@types/node/http2.d.ts | 2382 -- .../node_modules/@types/node/https.d.ts | 550 - .../node_modules/@types/node/index.d.ts | 88 - .../node_modules/@types/node/inspector.d.ts | 2747 -- .../node_modules/@types/node/module.d.ts | 301 - .../node_modules/@types/node/net.d.ts | 949 - .../node_modules/@types/node/os.d.ts | 478 - .../node_modules/@types/node/package.json | 230 - .../node_modules/@types/node/path.d.ts | 191 - .../node_modules/@types/node/perf_hooks.d.ts | 639 - .../node_modules/@types/node/process.d.ts | 1539 - .../node_modules/@types/node/punycode.d.ts | 117 - .../node_modules/@types/node/querystring.d.ts | 141 - .../node_modules/@types/node/readline.d.ts | 539 - .../@types/node/readline/promises.d.ts | 150 - .../node_modules/@types/node/repl.d.ts | 430 - .../node_modules/@types/node/stream.d.ts | 1701 - .../@types/node/stream/consumers.d.ts | 12 - .../@types/node/stream/promises.d.ts | 83 - .../node_modules/@types/node/stream/web.d.ts | 350 - .../@types/node/string_decoder.d.ts | 67 - .../node_modules/@types/node/test.d.ts | 1382 - .../node_modules/@types/node/timers.d.ts | 240 - .../@types/node/timers/promises.d.ts | 93 - .../node_modules/@types/node/tls.d.ts | 1210 - .../@types/node/trace_events.d.ts | 182 - .../@types/node/ts4.8/assert.d.ts | 996 - .../@types/node/ts4.8/assert/strict.d.ts | 8 - .../@types/node/ts4.8/async_hooks.d.ts | 539 - .../@types/node/ts4.8/buffer.d.ts | 2362 -- .../@types/node/ts4.8/child_process.d.ts | 1540 - .../@types/node/ts4.8/cluster.d.ts | 432 - .../@types/node/ts4.8/console.d.ts | 415 - .../@types/node/ts4.8/constants.d.ts | 19 - .../@types/node/ts4.8/crypto.d.ts | 4455 --- .../node_modules/@types/node/ts4.8/dgram.d.ts | 586 - .../node/ts4.8/diagnostics_channel.d.ts | 191 - .../node_modules/@types/node/ts4.8/dns.d.ts | 809 - .../@types/node/ts4.8/dns/promises.d.ts | 425 - .../@types/node/ts4.8/dom-events.d.ts | 122 - .../@types/node/ts4.8/domain.d.ts | 170 - .../@types/node/ts4.8/events.d.ts | 879 - .../node_modules/@types/node/ts4.8/fs.d.ts | 4291 --- .../@types/node/ts4.8/fs/promises.d.ts | 1239 - .../@types/node/ts4.8/globals.d.ts | 411 - .../@types/node/ts4.8/globals.global.d.ts | 1 - .../node_modules/@types/node/ts4.8/http.d.ts | 1888 - .../node_modules/@types/node/ts4.8/http2.d.ts | 2382 -- .../node_modules/@types/node/ts4.8/https.d.ts | 550 - .../node_modules/@types/node/ts4.8/index.d.ts | 88 - .../@types/node/ts4.8/inspector.d.ts | 2747 -- .../@types/node/ts4.8/module.d.ts | 301 - .../node_modules/@types/node/ts4.8/net.d.ts | 949 - .../node_modules/@types/node/ts4.8/os.d.ts | 478 - .../node_modules/@types/node/ts4.8/path.d.ts | 191 - .../@types/node/ts4.8/perf_hooks.d.ts | 639 - .../@types/node/ts4.8/process.d.ts | 1539 - .../@types/node/ts4.8/punycode.d.ts | 117 - .../@types/node/ts4.8/querystring.d.ts | 141 - .../@types/node/ts4.8/readline.d.ts | 539 - .../@types/node/ts4.8/readline/promises.d.ts | 150 - .../node_modules/@types/node/ts4.8/repl.d.ts | 430 - .../@types/node/ts4.8/stream.d.ts | 1701 - .../@types/node/ts4.8/stream/consumers.d.ts | 12 - .../@types/node/ts4.8/stream/promises.d.ts | 83 - .../@types/node/ts4.8/stream/web.d.ts | 350 - .../@types/node/ts4.8/string_decoder.d.ts | 67 - .../node_modules/@types/node/ts4.8/test.d.ts | 1382 - .../@types/node/ts4.8/timers.d.ts | 240 - .../@types/node/ts4.8/timers/promises.d.ts | 93 - .../node_modules/@types/node/ts4.8/tls.d.ts | 1210 - .../@types/node/ts4.8/trace_events.d.ts | 182 - .../node_modules/@types/node/ts4.8/tty.d.ts | 208 - .../node_modules/@types/node/ts4.8/url.d.ts | 927 - .../node_modules/@types/node/ts4.8/util.d.ts | 2183 -- .../node_modules/@types/node/ts4.8/v8.d.ts | 635 - .../node_modules/@types/node/ts4.8/vm.d.ts | 903 - .../node_modules/@types/node/ts4.8/wasi.d.ts | 158 - .../@types/node/ts4.8/worker_threads.d.ts | 691 - .../node_modules/@types/node/ts4.8/zlib.d.ts | 517 - .../node_modules/@types/node/tty.d.ts | 208 - .../node_modules/@types/node/url.d.ts | 927 - .../node_modules/@types/node/util.d.ts | 2183 -- .../node_modules/@types/node/v8.d.ts | 635 - .../node_modules/@types/node/vm.d.ts | 903 - .../node_modules/@types/node/wasi.d.ts | 158 - .../@types/node/worker_threads.d.ts | 691 - .../node_modules/@types/node/zlib.d.ts | 517 - .../node_modules/adm-zip/LICENSE | 21 - .../node_modules/adm-zip/README.md | 65 - .../node_modules/adm-zip/adm-zip.js | 786 - .../adm-zip/headers/entryHeader.js | 338 - .../node_modules/adm-zip/headers/index.js | 2 - .../adm-zip/headers/mainHeader.js | 130 - .../node_modules/adm-zip/methods/deflater.js | 33 - .../node_modules/adm-zip/methods/index.js | 3 - .../node_modules/adm-zip/methods/inflater.js | 31 - .../node_modules/adm-zip/methods/zipcrypto.js | 170 - .../node_modules/adm-zip/package.json | 48 - .../node_modules/adm-zip/util/constants.js | 142 - .../node_modules/adm-zip/util/errors.js | 35 - .../node_modules/adm-zip/util/fattr.js | 79 - .../node_modules/adm-zip/util/fileSystem.js | 11 - .../node_modules/adm-zip/util/index.js | 4 - .../node_modules/adm-zip/util/utils.js | 247 - .../node_modules/adm-zip/zipEntry.js | 333 - .../node_modules/adm-zip/zipFile.js | 384 - .../antlr4/BufferedTokenStream.js | 375 - .../node_modules/antlr4/CharStreams.js | 71 - .../node_modules/antlr4/CommonTokenFactory.js | 69 - .../node_modules/antlr4/CommonTokenStream.js | 104 - .../node_modules/antlr4/FileStream.js | 26 - .../node_modules/antlr4/InputStream.js | 135 - .../node_modules/antlr4/IntervalSet.js | 298 - .../node_modules/antlr4/LL1Analyzer.js | 199 - .../node_modules/antlr4/Lexer.js | 371 - .../node_modules/antlr4/Parser.js | 674 - .../node_modules/antlr4/ParserRuleContext.js | 225 - .../node_modules/antlr4/PredictionContext.js | 734 - .../node_modules/antlr4/README.md | 13 - .../node_modules/antlr4/Recognizer.js | 147 - .../node_modules/antlr4/RuleContext.js | 157 - .../node_modules/antlr4/Token.js | 151 - .../node_modules/antlr4/Utils.js | 451 - .../node_modules/antlr4/atn/ATN.js | 142 - .../node_modules/antlr4/atn/ATNConfig.js | 176 - .../node_modules/antlr4/atn/ATNConfigSet.js | 253 - .../antlr4/atn/ATNDeserializationOptions.js | 25 - .../antlr4/atn/ATNDeserializer.js | 678 - .../node_modules/antlr4/atn/ATNSimulator.js | 52 - .../node_modules/antlr4/atn/ATNState.js | 326 - .../node_modules/antlr4/atn/ATNType.js | 17 - .../antlr4/atn/LexerATNSimulator.js | 636 - .../node_modules/antlr4/atn/LexerAction.js | 366 - .../antlr4/atn/LexerActionExecutor.js | 166 - .../antlr4/atn/ParserATNSimulator.js | 1728 - .../node_modules/antlr4/atn/PredictionMode.js | 559 - .../antlr4/atn/SemanticContext.js | 404 - .../node_modules/antlr4/atn/Transition.js | 316 - .../node_modules/antlr4/atn/index.js | 10 - .../node_modules/antlr4/dfa/DFA.js | 153 - .../node_modules/antlr4/dfa/DFASerializer.js | 79 - .../node_modules/antlr4/dfa/DFAState.js | 146 - .../node_modules/antlr4/dfa/index.js | 9 - .../antlr4/error/DiagnosticErrorListener.js | 111 - .../antlr4/error/ErrorListener.js | 87 - .../antlr4/error/ErrorStrategy.js | 756 - .../node_modules/antlr4/error/Errors.js | 169 - .../node_modules/antlr4/error/index.js | 13 - .../node_modules/antlr4/index.js | 23 - .../node_modules/antlr4/package.json | 48 - .../antlr4/polyfills/codepointat.js | 54 - .../antlr4/polyfills/fromcodepoint.js | 62 - .../node_modules/antlr4/tree/Tree.js | 230 - .../node_modules/antlr4/tree/Trees.js | 140 - .../node_modules/antlr4/tree/index.js | 11 - reverse_engineering/node_modules/asn1/LICENSE | 19 - .../node_modules/asn1/README.md | 50 - .../node_modules/asn1/lib/ber/errors.js | 13 - .../node_modules/asn1/lib/ber/index.js | 27 - .../node_modules/asn1/lib/ber/reader.js | 262 - .../node_modules/asn1/lib/ber/types.js | 36 - .../node_modules/asn1/lib/ber/writer.js | 317 - .../node_modules/asn1/lib/index.js | 20 - .../node_modules/asn1/package.json | 75 - .../node_modules/bcrypt-pbkdf/CONTRIBUTING.md | 13 - .../node_modules/bcrypt-pbkdf/LICENSE | 66 - .../node_modules/bcrypt-pbkdf/README.md | 45 - .../node_modules/bcrypt-pbkdf/index.js | 556 - .../node_modules/bcrypt-pbkdf/package.json | 15 - .../cassandra-driver/.eslintignore | 8 - .../node_modules/cassandra-driver/.travis.yml | 45 - .../cassandra-driver/CHANGELOG.md | 643 - .../node_modules/cassandra-driver/Jenkinsfile | 573 - .../node_modules/cassandra-driver/LICENSE.txt | 177 - .../node_modules/cassandra-driver/NOTICE.txt | 4 - .../node_modules/cassandra-driver/README.md | 299 - .../node_modules/cassandra-driver/build.yaml | 70 - .../node_modules/cassandra-driver/index.d.ts | 414 - .../node_modules/cassandra-driver/index.js | 48 - .../lib/auth/base-dse-authenticator.js | 76 - .../lib/auth/dse-gssapi-auth-provider.js | 231 - .../lib/auth/dse-plain-text-auth-provider.js | 110 - .../lib/auth/gssapi-client.js | 155 - .../cassandra-driver/lib/auth/index.d.ts | 47 - .../cassandra-driver/lib/auth/index.js | 39 - .../lib/auth/no-auth-provider.js | 70 - .../lib/auth/plain-text-auth-provider.js | 81 - .../cassandra-driver/lib/auth/provider.js | 79 - .../cassandra-driver/lib/client-options.js | 361 - .../cassandra-driver/lib/client.js | 1180 - .../lib/concurrent/index.d.ts | 45 - .../cassandra-driver/lib/concurrent/index.js | 335 - .../cassandra-driver/lib/connection.js | 790 - .../lib/control-connection.js | 1073 - .../lib/datastax/cloud/index.js | 338 - .../lib/datastax/graph/complex-type-helper.js | 99 - .../datastax/graph/custom-type-serializers.js | 362 - .../lib/datastax/graph/graph-executor.js | 280 - .../lib/datastax/graph/graph-serializer.js | 260 - .../lib/datastax/graph/index.d.ts | 92 - .../lib/datastax/graph/index.js | 82 - .../lib/datastax/graph/options.js | 334 - .../lib/datastax/graph/result-set.js | 156 - .../lib/datastax/graph/structure.js | 167 - .../lib/datastax/graph/type-serializers.js | 501 - .../lib/datastax/graph/wrappers.js | 84 - .../cassandra-driver/lib/datastax/index.d.ts | 24 - .../cassandra-driver/lib/datastax/index.js | 28 - .../lib/datastax/search/date-range.js | 537 - .../lib/datastax/search/index.d.ts | 58 - .../lib/datastax/search/index.js | 30 - .../cassandra-driver/lib/encoder.js | 2015 - .../cassandra-driver/lib/errors.js | 175 - .../cassandra-driver/lib/execution-options.js | 619 - .../cassandra-driver/lib/execution-profile.js | 266 - .../cassandra-driver/lib/geometry/geometry.js | 133 - .../cassandra-driver/lib/geometry/index.d.ts | 67 - .../cassandra-driver/lib/geometry/index.js | 30 - .../lib/geometry/line-string.js | 197 - .../cassandra-driver/lib/geometry/point.js | 134 - .../cassandra-driver/lib/geometry/polygon.js | 239 - .../lib/host-connection-pool.js | 522 - .../node_modules/cassandra-driver/lib/host.js | 658 - .../cassandra-driver/lib/insights-client.js | 492 - .../cassandra-driver/lib/mapping/cache.js | 207 - .../lib/mapping/doc-info-adapter.js | 162 - .../cassandra-driver/lib/mapping/index.d.ts | 189 - .../cassandra-driver/lib/mapping/index.js | 33 - .../cassandra-driver/lib/mapping/mapper.js | 193 - .../lib/mapping/mapping-handler.js | 412 - .../lib/mapping/model-batch-item.js | 191 - .../lib/mapping/model-batch-mapper.js | 125 - .../lib/mapping/model-mapper.js | 306 - .../lib/mapping/model-mapping-info.js | 194 - .../lib/mapping/object-selector.js | 321 - .../cassandra-driver/lib/mapping/q.js | 154 - .../lib/mapping/query-generator.js | 446 - .../lib/mapping/result-mapper.js | 112 - .../cassandra-driver/lib/mapping/result.js | 136 - .../lib/mapping/table-mappings.js | 122 - .../cassandra-driver/lib/mapping/tree.js | 151 - .../lib/metadata/aggregate.js | 78 - .../lib/metadata/client-state.js | 114 - .../lib/metadata/data-collection.js | 173 - .../lib/metadata/event-debouncer.js | 164 - .../cassandra-driver/lib/metadata/index.d.ts | 211 - .../cassandra-driver/lib/metadata/index.js | 1024 - .../lib/metadata/materialized-view.js | 48 - .../lib/metadata/schema-function.js | 97 - .../lib/metadata/schema-index.js | 149 - .../lib/metadata/schema-parser.js | 1177 - .../lib/metadata/table-metadata.js | 77 - .../lib/metrics/client-metrics.js | 129 - .../lib/metrics/default-metrics.js | 198 - .../cassandra-driver/lib/metrics/index.d.ts | 89 - .../cassandra-driver/lib/metrics/index.js | 28 - .../cassandra-driver/lib/operation-state.js | 164 - .../lib/policies/address-resolution.js | 139 - .../cassandra-driver/lib/policies/index.d.ts | 210 - .../cassandra-driver/lib/policies/index.js | 84 - .../lib/policies/load-balancing.js | 883 - .../lib/policies/reconnection.js | 157 - .../cassandra-driver/lib/policies/retry.js | 276 - .../lib/policies/speculative-execution.js | 143 - .../lib/policies/timestamp-generation.js | 170 - .../cassandra-driver/lib/prepare-handler.js | 297 - .../cassandra-driver/lib/promise-utils.js | 177 - .../cassandra-driver/lib/readers.js | 542 - .../cassandra-driver/lib/request-execution.js | 497 - .../cassandra-driver/lib/request-handler.js | 311 - .../cassandra-driver/lib/requests.js | 542 - .../cassandra-driver/lib/stream-id-stack.js | 200 - .../cassandra-driver/lib/streams.js | 582 - .../cassandra-driver/lib/token.js | 286 - .../cassandra-driver/lib/tokenizer.js | 584 - .../cassandra-driver/lib/tracker/index.d.ts | 58 - .../cassandra-driver/lib/tracker/index.js | 25 - .../lib/tracker/request-logger.js | 294 - .../lib/tracker/request-tracker.js | 74 - .../cassandra-driver/lib/types/big-decimal.js | 271 - .../cassandra-driver/lib/types/duration.js | 714 - .../cassandra-driver/lib/types/index.d.ts | 427 - .../cassandra-driver/lib/types/index.js | 629 - .../lib/types/inet-address.js | 248 - .../cassandra-driver/lib/types/integer.js | 855 - .../cassandra-driver/lib/types/local-date.js | 252 - .../cassandra-driver/lib/types/local-time.js | 295 - .../lib/types/mutable-long.js | 329 - .../lib/types/protocol-version.js | 349 - .../cassandra-driver/lib/types/result-set.js | 275 - .../lib/types/result-stream.js | 148 - .../cassandra-driver/lib/types/row.js | 80 - .../cassandra-driver/lib/types/time-uuid.js | 410 - .../cassandra-driver/lib/types/tuple.js | 102 - .../cassandra-driver/lib/types/uuid.js | 153 - .../lib/types/version-number.js | 144 - .../cassandra-driver/lib/utils.js | 1087 - .../cassandra-driver/lib/writers.js | 310 - .../cassandra-driver/package.json | 58 - .../node_modules/debug/.coveralls.yml | 1 - .../node_modules/debug/.eslintrc | 11 - .../node_modules/debug/.npmignore | 9 - .../node_modules/debug/.travis.yml | 14 - .../node_modules/debug/CHANGELOG.md | 362 - .../node_modules/debug/LICENSE | 19 - .../node_modules/debug/Makefile | 50 - .../node_modules/debug/README.md | 312 - .../node_modules/debug/component.json | 19 - .../node_modules/debug/karma.conf.js | 70 - .../node_modules/debug/node.js | 1 - .../node_modules/debug/package.json | 88 - .../node_modules/debug/src/browser.js | 185 - .../node_modules/debug/src/debug.js | 202 - .../node_modules/debug/src/index.js | 10 - .../node_modules/debug/src/inspector-log.js | 15 - .../node_modules/debug/src/node.js | 248 - .../node_modules/fast-xml-parser/LICENSE | 21 - .../node_modules/fast-xml-parser/README.md | 352 - .../node_modules/fast-xml-parser/cli.js | 101 - .../node_modules/fast-xml-parser/package.json | 126 - .../fast-xml-parser/src/json2xml.js | 268 - .../fast-xml-parser/src/nimndata.js | 144 - .../fast-xml-parser/src/node2json.js | 42 - .../fast-xml-parser/src/node2json_str.js | 63 - .../fast-xml-parser/src/parser.d.ts | 72 - .../fast-xml-parser/src/parser.js | 67 - .../node_modules/fast-xml-parser/src/read.js | 92 - .../node_modules/fast-xml-parser/src/util.js | 107 - .../fast-xml-parser/src/validator.js | 400 - .../fast-xml-parser/src/xmlNode.js | 17 - .../fast-xml-parser/src/xmlstr2xmlnode.js | 343 - .../node_modules/jks-js/CHANGELOG.md | 27 - .../node_modules/jks-js/LICENSE | 21 - .../node_modules/jks-js/README.md | 101 - .../jks-js/examples/assets/keystore.jks | Bin 2232 -> 0 bytes .../jks-js/examples/assets/truststore.jks | Bin 942 -> 0 bytes .../node_modules/jks-js/examples/index.js | 7 - .../jks-js/lib/certs/Certificate.js | 8 - .../jks-js/lib/certs/CertificateRegistry.js | 20 - .../node_modules/jks-js/lib/certs/X509Cert.js | 10 - .../jks-js/lib/encryption/DerValue.js | 149 - .../lib/encryption/EncryptedPrivateKeyInfo.js | 35 - .../jks-js/lib/encryption/KeyProtector.js | 121 - .../jks-js/lib/encryption/ObjectIdentifier.js | 51 - .../jks-js/lib/encryption/PKCS8Key.js | 89 - .../jks-js/lib/encryption/PasswordDigest.js | 31 - .../node_modules/jks-js/lib/index.js | 75 - .../jks-js/lib/keystore/JavaKeyStoreParser.js | 171 - .../jks-js/lib/keystore/KeyEntry.js | 16 - .../jks-js/lib/keystore/PKCS12Parser.js | 139 - .../jks-js/lib/keystore/TrustedKeyEntry.js | 11 - .../jks-js/lib/stream/DigestInputStream.js | 45 - .../jks-js/lib/stream/InputStream.js | 59 - .../jks-js/lib/stream/OutputStream.js | 18 - .../node_modules/jks-js/package.json | 70 - .../node_modules/lodash.defaults/LICENSE | 47 - .../node_modules/lodash.defaults/README.md | 18 - .../node_modules/lodash.defaults/index.js | 668 - .../node_modules/lodash.defaults/package.json | 69 - reverse_engineering/node_modules/long/LICENSE | 202 - .../node_modules/long/README.md | 280 - .../node_modules/long/index.d.ts | 457 - .../node_modules/long/index.js | 1467 - .../node_modules/long/package.json | 50 - .../node_modules/long/umd/index.d.ts | 2 - .../node_modules/long/umd/index.js | 1432 - .../node_modules/long/umd/package.json | 3 - reverse_engineering/node_modules/ms/index.js | 152 - .../node_modules/ms/license.md | 21 - .../node_modules/ms/package.json | 69 - reverse_engineering/node_modules/ms/readme.md | 51 - .../node_modules/node-forge/CHANGELOG.md | 265 - .../node_modules/node-forge/LICENSE | 331 - .../node_modules/node-forge/README.md | 2099 - .../node-forge/dist/forge.all.min.js | 2 - .../node-forge/dist/forge.all.min.js.map | 1 - .../node_modules/node-forge/dist/forge.min.js | 2 - .../node-forge/dist/forge.min.js.map | 1 - .../node-forge/dist/prime.worker.min.js | 2 - .../node-forge/dist/prime.worker.min.js.map | 1 - .../node_modules/node-forge/flash/README.md | 48 - .../node-forge/flash/package.json | 28 - .../node-forge/flash/swf/SocketPool.swf | Bin 21162 -> 0 bytes .../node_modules/node-forge/lib/aes.js | 1091 - .../node-forge/lib/aesCipherSuites.js | 282 - .../node-forge/lib/asn1-validator.js | 91 - .../node_modules/node-forge/lib/asn1.js | 1408 - .../node_modules/node-forge/lib/baseN.js | 186 - .../node_modules/node-forge/lib/cipher.js | 230 - .../node-forge/lib/cipherModes.js | 999 - .../node_modules/node-forge/lib/debug.js | 78 - .../node_modules/node-forge/lib/des.js | 496 - .../node_modules/node-forge/lib/ed25519.js | 1072 - .../node_modules/node-forge/lib/forge.js | 13 - .../node_modules/node-forge/lib/form.js | 149 - .../node_modules/node-forge/lib/hmac.js | 146 - .../node_modules/node-forge/lib/http.js | 1364 - .../node_modules/node-forge/lib/index.all.js | 16 - .../node_modules/node-forge/lib/index.js | 35 - .../node_modules/node-forge/lib/jsbn.js | 1264 - .../node_modules/node-forge/lib/kem.js | 168 - .../node_modules/node-forge/lib/log.js | 317 - .../node_modules/node-forge/lib/md.all.js | 13 - .../node_modules/node-forge/lib/md.js | 11 - .../node_modules/node-forge/lib/md5.js | 289 - .../node_modules/node-forge/lib/mgf.js | 12 - .../node_modules/node-forge/lib/mgf1.js | 57 - .../node_modules/node-forge/lib/oids.js | 170 - .../node_modules/node-forge/lib/pbe.js | 1023 - .../node_modules/node-forge/lib/pbkdf2.js | 211 - .../node_modules/node-forge/lib/pem.js | 230 - .../node_modules/node-forge/lib/pkcs1.js | 276 - .../node_modules/node-forge/lib/pkcs12.js | 1074 - .../node_modules/node-forge/lib/pkcs7.js | 1257 - .../node_modules/node-forge/lib/pkcs7asn1.js | 409 - .../node_modules/node-forge/lib/pki.js | 102 - .../node_modules/node-forge/lib/prime.js | 297 - .../node-forge/lib/prime.worker.js | 168 - .../node_modules/node-forge/lib/prng.js | 419 - .../node_modules/node-forge/lib/pss.js | 241 - .../node_modules/node-forge/lib/random.js | 191 - .../node_modules/node-forge/lib/rc2.js | 410 - .../node_modules/node-forge/lib/rsa.js | 1858 - .../node_modules/node-forge/lib/sha1.js | 319 - .../node_modules/node-forge/lib/sha256.js | 327 - .../node_modules/node-forge/lib/sha512.js | 561 - .../node_modules/node-forge/lib/socket.js | 287 - .../node_modules/node-forge/lib/ssh.js | 236 - .../node_modules/node-forge/lib/task.js | 725 - .../node_modules/node-forge/lib/tls.js | 4282 --- .../node_modules/node-forge/lib/tlssocket.js | 249 - .../node_modules/node-forge/lib/util.js | 2907 -- .../node_modules/node-forge/lib/x509.js | 3333 -- .../node_modules/node-forge/lib/xhr.js | 736 - .../node_modules/node-forge/package.json | 158 - .../node_modules/node-int64/.npmignore | 3 - .../node_modules/node-int64/Int64.js | 268 - .../node_modules/node-int64/LICENSE | 19 - .../node_modules/node-int64/README.md | 78 - .../node_modules/node-int64/package.json | 59 - .../node_modules/node-int64/test.js | 120 - .../node_modules/node-rsa/README.md | 377 - .../node_modules/node-rsa/gruntfile.js | 33 - .../node_modules/node-rsa/package.json | 71 - .../node_modules/node-rsa/src/NodeRSA.js | 398 - .../src/encryptEngines/encryptEngines.js | 17 - .../node-rsa/src/encryptEngines/io.js | 72 - .../node-rsa/src/encryptEngines/js.js | 34 - .../node-rsa/src/encryptEngines/node12.js | 56 - .../node-rsa/src/formats/components.js | 71 - .../node-rsa/src/formats/formats.js | 97 - .../node-rsa/src/formats/openssh.js | 292 - .../node-rsa/src/formats/pkcs1.js | 148 - .../node-rsa/src/formats/pkcs8.js | 187 - .../node_modules/node-rsa/src/libs/jsbn.js | 1540 - .../node_modules/node-rsa/src/libs/rsa.js | 316 - .../node_modules/node-rsa/src/schemes/oaep.js | 179 - .../node-rsa/src/schemes/pkcs1.js | 238 - .../node_modules/node-rsa/src/schemes/pss.js | 183 - .../node-rsa/src/schemes/schemes.js | 23 - .../node_modules/node-rsa/src/utils.js | 108 - .../node_modules/safer-buffer/LICENSE | 21 - .../safer-buffer/Porting-Buffer.md | 268 - .../node_modules/safer-buffer/Readme.md | 156 - .../node_modules/safer-buffer/dangerous.js | 58 - .../node_modules/safer-buffer/package.json | 60 - .../node_modules/safer-buffer/safer.js | 77 - .../node_modules/safer-buffer/tests.js | 406 - .../node_modules/ssh2/.eslintignore | 4 - .../node_modules/ssh2/.eslintrc.js | 5 - .../ssh2/.github/workflows/ci.yml | 40 - .../ssh2/.github/workflows/lint.yml | 23 - reverse_engineering/node_modules/ssh2/LICENSE | 19 - .../node_modules/ssh2/README.md | 1473 - reverse_engineering/node_modules/ssh2/SFTP.md | 403 - .../node_modules/ssh2/examples/server-chat.js | 238 - .../examples/sftp-server-download-only.js | 134 - .../node_modules/ssh2/install.js | 20 - .../node_modules/ssh2/lib/Channel.js | 294 - .../node_modules/ssh2/lib/agent.js | 1123 - .../node_modules/ssh2/lib/client.js | 2013 - .../node_modules/ssh2/lib/http-agents.js | 84 - .../node_modules/ssh2/lib/index.js | 43 - .../ssh2/lib/protocol/Protocol.js | 2076 - .../node_modules/ssh2/lib/protocol/SFTP.js | 3778 -- .../ssh2/lib/protocol/constants.js | 344 - .../node_modules/ssh2/lib/protocol/crypto.js | 1607 - .../ssh2/lib/protocol/crypto/binding.gyp | 14 - .../ssh2/lib/protocol/crypto/build/Makefile | 324 - .../.deps/Release/obj.target/sshcrypto.node.d | 1 - .../obj.target/sshcrypto/src/binding.o.d | 117 - .../Release/.deps/Release/sshcrypto.node.d | 1 - .../build/Release/obj.target/sshcrypto.node | Bin 93472 -> 0 bytes .../obj.target/sshcrypto/src/binding.o | Bin 145496 -> 0 bytes .../crypto/build/Release/sshcrypto.node | Bin 93472 -> 0 bytes .../protocol/crypto/build/binding.Makefile | 6 - .../lib/protocol/crypto/build/config.gypi | 92 - .../protocol/crypto/build/sshcrypto.target.mk | 161 - .../ssh2/lib/protocol/crypto/poly1305.js | 43 - .../ssh2/lib/protocol/crypto/src/binding.cc | 2003 - .../ssh2/lib/protocol/handlers.js | 16 - .../ssh2/lib/protocol/handlers.misc.js | 1214 - .../node_modules/ssh2/lib/protocol/kex.js | 1831 - .../ssh2/lib/protocol/keyParser.js | 1481 - .../ssh2/lib/protocol/node-fs-compat.js | 115 - .../node_modules/ssh2/lib/protocol/utils.js | 356 - .../node_modules/ssh2/lib/protocol/zlib.js | 255 - .../node_modules/ssh2/lib/server.js | 1363 - .../node_modules/ssh2/lib/utils.js | 332 - .../node_modules/ssh2/package.json | 49 - .../node_modules/ssh2/test/common.js | 316 - .../ssh2/test/fixtures/bad_rsa_private_key | 26 - .../ssh2/test/fixtures/https_cert.pem | 33 - .../ssh2/test/fixtures/https_key.pem | 52 - .../node_modules/ssh2/test/fixtures/id_dsa | 12 - .../node_modules/ssh2/test/fixtures/id_ecdsa | 5 - .../node_modules/ssh2/test/fixtures/id_rsa | 15 - .../ssh2/test/fixtures/id_rsa.ppk | 26 - .../ssh2/test/fixtures/id_rsa_enc | 30 - .../test/fixtures/keyParser/openssh_new_dsa | 21 - .../fixtures/keyParser/openssh_new_dsa.pub | 1 - .../keyParser/openssh_new_dsa.pub.result | 7 - .../fixtures/keyParser/openssh_new_dsa.result | 7 - .../fixtures/keyParser/openssh_new_dsa_enc | 22 - .../keyParser/openssh_new_dsa_enc.pub | 1 - .../keyParser/openssh_new_dsa_enc.pub.result | 7 - .../keyParser/openssh_new_dsa_enc.result | 7 - .../keyParser/openssh_new_dsa_enc_gcm | 23 - .../keyParser/openssh_new_dsa_enc_gcm.pub | 1 - .../openssh_new_dsa_enc_gcm.pub.result | 7 - .../keyParser/openssh_new_dsa_enc_gcm.result | 7 - .../test/fixtures/keyParser/openssh_new_ecdsa | 9 - .../fixtures/keyParser/openssh_new_ecdsa.pub | 1 - .../keyParser/openssh_new_ecdsa.pub.result | 7 - .../keyParser/openssh_new_ecdsa.result | 7 - .../fixtures/keyParser/openssh_new_ecdsa_enc | 10 - .../keyParser/openssh_new_ecdsa_enc.pub | 1 - .../openssh_new_ecdsa_enc.pub.result | 8 - .../keyParser/openssh_new_ecdsa_enc.result | 7 - .../keyParser/openssh_new_ecdsa_enc_gcm | 10 - .../keyParser/openssh_new_ecdsa_enc_gcm.pub | 1 - .../openssh_new_ecdsa_enc_gcm.pub.result | 8 - .../openssh_new_ecdsa_enc_gcm.result | 7 - .../fixtures/keyParser/openssh_new_ed25519 | 7 - .../keyParser/openssh_new_ed25519.pub | 1 - .../keyParser/openssh_new_ed25519.pub.result | 7 - .../keyParser/openssh_new_ed25519.result | 7 - .../test/fixtures/keyParser/openssh_new_rsa | 27 - .../fixtures/keyParser/openssh_new_rsa.pub | 1 - .../keyParser/openssh_new_rsa.pub.result | 7 - .../fixtures/keyParser/openssh_new_rsa.result | 7 - .../fixtures/keyParser/openssh_new_rsa_enc | 28 - .../keyParser/openssh_new_rsa_enc.pub | 1 - .../keyParser/openssh_new_rsa_enc.pub.result | 8 - .../keyParser/openssh_new_rsa_enc.result | 7 - .../keyParser/openssh_new_rsa_enc_gcm | 29 - .../keyParser/openssh_new_rsa_enc_gcm.pub | 1 - .../openssh_new_rsa_enc_gcm.pub.result | 8 - .../keyParser/openssh_new_rsa_enc_gcm.result | 7 - .../test/fixtures/keyParser/openssh_old_dsa | 12 - .../fixtures/keyParser/openssh_old_dsa.pub | 1 - .../keyParser/openssh_old_dsa.pub.result | 7 - .../fixtures/keyParser/openssh_old_dsa.result | 7 - .../fixtures/keyParser/openssh_old_dsa_enc | 15 - .../keyParser/openssh_old_dsa_enc.pub | 1 - .../keyParser/openssh_old_dsa_enc.pub.result | 8 - .../keyParser/openssh_old_dsa_enc.result | 7 - .../test/fixtures/keyParser/openssh_old_ecdsa | 5 - .../fixtures/keyParser/openssh_old_ecdsa.pub | 1 - .../keyParser/openssh_old_ecdsa.pub.result | 7 - .../keyParser/openssh_old_ecdsa.result | 7 - .../fixtures/keyParser/openssh_old_ecdsa_enc | 8 - .../keyParser/openssh_old_ecdsa_enc.pub | 1 - .../openssh_old_ecdsa_enc.pub.result | 8 - .../keyParser/openssh_old_ecdsa_enc.result | 7 - .../test/fixtures/keyParser/openssh_old_rsa | 27 - .../fixtures/keyParser/openssh_old_rsa.pub | 1 - .../keyParser/openssh_old_rsa.pub.result | 7 - .../fixtures/keyParser/openssh_old_rsa.result | 7 - .../fixtures/keyParser/openssh_old_rsa_enc | 30 - .../keyParser/openssh_old_rsa_enc.pub | 1 - .../keyParser/openssh_old_rsa_enc.pub.result | 8 - .../keyParser/openssh_old_rsa_enc.result | 7 - .../keyParser/openssh_old_rsa_enc_aes256 | 54 - .../keyParser/openssh_old_rsa_enc_aes256.pub | 1 - .../openssh_old_rsa_enc_aes256.pub.result | 6 - .../openssh_old_rsa_enc_aes256.result | 6 - .../ssh2/test/fixtures/keyParser/ppk_dsa_enc | 17 - .../fixtures/keyParser/ppk_dsa_enc.result | 7 - .../ssh2/test/fixtures/keyParser/ppk_rsa | 26 - .../test/fixtures/keyParser/ppk_rsa.result | 7 - .../ssh2/test/fixtures/keyParser/ppk_rsa_enc | 18 - .../fixtures/keyParser/ppk_rsa_enc.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa.pub | 9 - .../fixtures/keyParser/rfc4716_rsa.pub.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa2.pub | 10 - .../keyParser/rfc4716_rsa2.pub.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa3.pub | 11 - .../keyParser/rfc4716_rsa3.pub.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa4.pub | 11 - .../keyParser/rfc4716_rsa4.pub.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa5.pub | 8 - .../keyParser/rfc4716_rsa5.pub.result | 7 - .../test/fixtures/keyParser/rfc4716_rsa6.pub | 13 - .../keyParser/rfc4716_rsa6.pub.result | 7 - .../ssh2/test/fixtures/openssh_new_rsa | 27 - .../ssh2/test/fixtures/ssh_host_dsa_key | 12 - .../ssh2/test/fixtures/ssh_host_ecdsa_key | 5 - .../ssh2/test/fixtures/ssh_host_rsa_key | 15 - .../node_modules/ssh2/test/test-exec.js | 578 - .../ssh2/test/test-integration-openssh.js | 481 - .../ssh2/test/test-misc-client-server.js | 1428 - .../node_modules/ssh2/test/test-openssh.js | 261 - .../ssh2/test/test-protocol-crypto.js | 609 - .../ssh2/test/test-protocol-keyparser.js | 145 - .../ssh2/test/test-server-hostkeys.js | 136 - .../node_modules/ssh2/test/test-sftp.js | 782 - .../node_modules/ssh2/test/test-shell.js | 109 - .../ssh2/test/test-userauth-agent-openssh.js | 109 - .../ssh2/test/test-userauth-agent.js | 170 - .../node_modules/ssh2/test/test-userauth.js | 608 - .../node_modules/ssh2/test/test.js | 20 - .../node_modules/ssh2/util/build_pagent.bat | 2 - .../node_modules/ssh2/util/pagent.c | 88 - .../node_modules/ssh2/util/pagent.exe | Bin 50688 -> 0 bytes .../node_modules/tunnel-ssh/.eslintignore | 4 - .../node_modules/tunnel-ssh/.travis.yml | 4 - .../node_modules/tunnel-ssh/LICENSE | 21 - .../node_modules/tunnel-ssh/README.md | 139 - .../tunnel-ssh/examples/default.js | 26 - .../tunnel-ssh/examples/keepAlive.js | 35 - .../tunnel-ssh/examples/keepAlive_error.js | 35 - .../tunnel-ssh/examples/server/index.js | 36 - .../node_modules/tunnel-ssh/index.js | 112 - .../node_modules/tunnel-ssh/lib/config.js | 53 - .../node_modules/tunnel-ssh/package.json | 48 - .../tunnel-ssh/test/config-spec.js | 56 - .../node_modules/tunnel-ssh/test/main-spec.js | 37 - .../tunnel-ssh/test/server/index.js | 36 - .../node_modules/tweetnacl/.npmignore | 4 - .../node_modules/tweetnacl/AUTHORS.md | 28 - .../node_modules/tweetnacl/CHANGELOG.md | 221 - .../node_modules/tweetnacl/LICENSE | 24 - .../tweetnacl/PULL_REQUEST_TEMPLATE.md | 20 - .../node_modules/tweetnacl/README.md | 459 - .../node_modules/tweetnacl/nacl-fast.js | 2388 -- .../node_modules/tweetnacl/nacl-fast.min.js | 2 - .../node_modules/tweetnacl/nacl.d.ts | 98 - .../node_modules/tweetnacl/nacl.js | 1175 - .../node_modules/tweetnacl/nacl.min.js | 1 - .../node_modules/tweetnacl/package.json | 58 - .../node_modules/undici-types/README.md | 6 - .../node_modules/undici-types/agent.d.ts | 31 - .../node_modules/undici-types/api.d.ts | 43 - .../undici-types/balanced-pool.d.ts | 18 - .../node_modules/undici-types/cache.d.ts | 36 - .../node_modules/undici-types/client.d.ts | 97 - .../node_modules/undici-types/connector.d.ts | 34 - .../undici-types/content-type.d.ts | 21 - .../node_modules/undici-types/cookies.d.ts | 28 - .../undici-types/diagnostics-channel.d.ts | 67 - .../node_modules/undici-types/dispatcher.d.ts | 241 - .../node_modules/undici-types/errors.d.ts | 128 - .../node_modules/undici-types/fetch.d.ts | 209 - .../node_modules/undici-types/file.d.ts | 39 - .../node_modules/undici-types/filereader.d.ts | 54 - .../node_modules/undici-types/formdata.d.ts | 108 - .../undici-types/global-dispatcher.d.ts | 9 - .../undici-types/global-origin.d.ts | 7 - .../node_modules/undici-types/handlers.d.ts | 9 - .../node_modules/undici-types/header.d.ts | 4 - .../node_modules/undici-types/index.d.ts | 63 - .../undici-types/interceptors.d.ts | 5 - .../node_modules/undici-types/mock-agent.d.ts | 50 - .../undici-types/mock-client.d.ts | 25 - .../undici-types/mock-errors.d.ts | 12 - .../undici-types/mock-interceptor.d.ts | 93 - .../node_modules/undici-types/mock-pool.d.ts | 25 - .../node_modules/undici-types/package.json | 55 - .../node_modules/undici-types/patch.d.ts | 71 - .../node_modules/undici-types/pool-stats.d.ts | 19 - .../node_modules/undici-types/pool.d.ts | 28 - .../undici-types/proxy-agent.d.ts | 30 - .../node_modules/undici-types/readable.d.ts | 61 - .../node_modules/undici-types/webidl.d.ts | 220 - .../node_modules/undici-types/websocket.d.ts | 131 - reverse_engineering/package-lock.json | 311 - reverse_engineering/package.json | 11 +- reverse_engineering/parser/CqlLexer.interp | 734 - reverse_engineering/parser/CqlLexer.js | 3261 -- reverse_engineering/parser/CqlLexer.tokens | 244 - reverse_engineering/parser/CqlParser.interp | 807 - reverse_engineering/parser/CqlParser.js | 31520 ---------------- reverse_engineering/parser/CqlParser.tokens | 244 - .../parser/CqlParserListener.js | 2072 - .../parser/CqlParserVisitor.js | 1734 - reverse_engineering/typesHelper.js | 281 - snippets/geo-line.json | 23 +- snippets/geo-point.json | 13 +- snippets/geo-polygon.json | 35 +- tsconfig.json | 31 + types/DateRangeType.json | 4 +- types/DseExecutorStateType.json | 2 +- types/bool.json | 2 +- types/char.json | 26 +- types/date.json | 8 +- types/definitions.json | 2 +- types/duration.json | 4 +- types/geospatial.json | 3 +- types/list.json | 2 +- types/map.json | 2 +- types/object.json | 2 +- types/set.json | 2 +- types/time.json | 19 +- types/timestamp.json | 26 +- types/timeuuid.json | 6 +- types/tuple.json | 2 +- types/udt.json | 2 +- types/uuid.json | 6 +- validation/validationRegularExpressions.json | 2 +- 825 files changed, 1677 insertions(+), 285515 deletions(-) delete mode 100644 .github/workflows/fake-pr-tests.yml delete mode 100644 .gitignore create mode 100644 .npmrc delete mode 100644 forward_engineering/ddlProvider/ddlTemplates.js delete mode 100644 forward_engineering/helpers/alterScriptBuilder.js delete mode 100644 forward_engineering/helpers/alterScriptFromDeltaHelper.js delete mode 100644 forward_engineering/helpers/appDependencies.js delete mode 100644 forward_engineering/helpers/columnHelper.js delete mode 100644 forward_engineering/helpers/commentsHelper.js delete mode 100644 forward_engineering/helpers/createHelper.js delete mode 100644 forward_engineering/helpers/dbConnectionService/applyToInstance.js delete mode 100644 forward_engineering/helpers/dbConnectionService/index.js delete mode 100644 forward_engineering/helpers/dbConnectionService/testConnection.js delete mode 100644 forward_engineering/helpers/enums/reservedWords.js delete mode 100644 forward_engineering/helpers/generalHelper.js delete mode 100644 forward_engineering/helpers/getScriptOptions.js delete mode 100644 forward_engineering/helpers/indexHelper.js delete mode 100644 forward_engineering/helpers/keyspaceHelper.js delete mode 100644 forward_engineering/helpers/schemaHelper.js delete mode 100644 forward_engineering/helpers/tableHelper.js delete mode 100644 forward_engineering/helpers/tableOptionService/getDiff.js delete mode 100644 forward_engineering/helpers/tableOptionService/parseToString.js delete mode 100644 forward_engineering/helpers/typeHelper.js delete mode 100644 forward_engineering/helpers/types/AlterScriptDto.js delete mode 100644 forward_engineering/helpers/types/PersistenceSchemaChild.js delete mode 100644 forward_engineering/helpers/udtHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/generalHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/indexHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/indexService.js delete mode 100644 forward_engineering/helpers/updateHelpers/keySpaceHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/tableHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/udtHelper.js delete mode 100644 forward_engineering/helpers/updateHelpers/viewHelper.js delete mode 100644 forward_engineering/helpers/viewHelper.js delete mode 100644 forward_engineering/package-lock.json delete mode 100644 forward_engineering/package.json delete mode 100644 reverse_engineering/antlrErrorListener.js delete mode 100644 reverse_engineering/cassandraHelper.js delete mode 100644 reverse_engineering/cassandraRetryPolicy.js delete mode 100644 reverse_engineering/commandsHelper.js delete mode 100644 reverse_engineering/commandsService.js mode change 100755 => 100644 reverse_engineering/compileGrammars.sh delete mode 100644 reverse_engineering/cqlToCollectionsVisitor.js delete mode 100644 reverse_engineering/grammars/CqlLexer.g4 delete mode 100644 reverse_engineering/grammars/CqlParser.g4 delete mode 100644 reverse_engineering/helpers/commandsHelper.js delete mode 100644 reverse_engineering/helpers/createTableOptionsFromMeta.js delete mode 100644 reverse_engineering/helpers/filterComplexUdt.js delete mode 100644 reverse_engineering/logHelper.js delete mode 120000 reverse_engineering/node_modules/.bin/xml2js delete mode 100644 reverse_engineering/node_modules/.package-lock.json delete mode 100755 reverse_engineering/node_modules/@types/long/LICENSE delete mode 100755 reverse_engineering/node_modules/@types/long/README.md delete mode 100755 reverse_engineering/node_modules/@types/long/package.json delete mode 100644 reverse_engineering/node_modules/@types/node/LICENSE delete mode 100644 reverse_engineering/node_modules/@types/node/README.md delete mode 100644 reverse_engineering/node_modules/@types/node/assert.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/assert/strict.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/async_hooks.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/buffer.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/child_process.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/cluster.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/console.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/constants.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/crypto.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/dgram.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/diagnostics_channel.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/dns.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/dns/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/dom-events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/domain.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/fs.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/fs/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/globals.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/globals.global.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/http.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/http2.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/https.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/index.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/inspector.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/module.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/net.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/os.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/package.json delete mode 100644 reverse_engineering/node_modules/@types/node/path.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/perf_hooks.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/process.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/punycode.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/querystring.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/readline.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/readline/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/repl.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/stream.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/stream/consumers.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/stream/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/stream/web.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/string_decoder.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/test.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/timers.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/timers/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/tls.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/trace_events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/assert.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/assert/strict.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/async_hooks.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/buffer.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/child_process.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/cluster.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/console.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/constants.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/crypto.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/dgram.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/dns.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/dns/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/dom-events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/domain.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/fs.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/fs/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/globals.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/globals.global.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/http.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/http2.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/https.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/index.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/inspector.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/module.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/net.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/os.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/path.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/perf_hooks.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/process.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/punycode.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/querystring.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/readline.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/readline/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/repl.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/stream.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/stream/consumers.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/stream/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/stream/web.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/string_decoder.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/test.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/timers.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/timers/promises.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/tls.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/trace_events.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/tty.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/url.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/util.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/v8.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/vm.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/wasi.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/worker_threads.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/ts4.8/zlib.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/tty.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/url.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/util.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/v8.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/vm.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/wasi.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/worker_threads.d.ts delete mode 100644 reverse_engineering/node_modules/@types/node/zlib.d.ts delete mode 100644 reverse_engineering/node_modules/adm-zip/LICENSE delete mode 100644 reverse_engineering/node_modules/adm-zip/README.md delete mode 100644 reverse_engineering/node_modules/adm-zip/adm-zip.js delete mode 100644 reverse_engineering/node_modules/adm-zip/headers/entryHeader.js delete mode 100644 reverse_engineering/node_modules/adm-zip/headers/index.js delete mode 100644 reverse_engineering/node_modules/adm-zip/headers/mainHeader.js delete mode 100644 reverse_engineering/node_modules/adm-zip/methods/deflater.js delete mode 100644 reverse_engineering/node_modules/adm-zip/methods/index.js delete mode 100644 reverse_engineering/node_modules/adm-zip/methods/inflater.js delete mode 100644 reverse_engineering/node_modules/adm-zip/methods/zipcrypto.js delete mode 100644 reverse_engineering/node_modules/adm-zip/package.json delete mode 100644 reverse_engineering/node_modules/adm-zip/util/constants.js delete mode 100644 reverse_engineering/node_modules/adm-zip/util/errors.js delete mode 100644 reverse_engineering/node_modules/adm-zip/util/fattr.js delete mode 100644 reverse_engineering/node_modules/adm-zip/util/fileSystem.js delete mode 100644 reverse_engineering/node_modules/adm-zip/util/index.js delete mode 100644 reverse_engineering/node_modules/adm-zip/util/utils.js delete mode 100644 reverse_engineering/node_modules/adm-zip/zipEntry.js delete mode 100644 reverse_engineering/node_modules/adm-zip/zipFile.js delete mode 100644 reverse_engineering/node_modules/antlr4/BufferedTokenStream.js delete mode 100644 reverse_engineering/node_modules/antlr4/CharStreams.js delete mode 100644 reverse_engineering/node_modules/antlr4/CommonTokenFactory.js delete mode 100644 reverse_engineering/node_modules/antlr4/CommonTokenStream.js delete mode 100644 reverse_engineering/node_modules/antlr4/FileStream.js delete mode 100644 reverse_engineering/node_modules/antlr4/InputStream.js delete mode 100644 reverse_engineering/node_modules/antlr4/IntervalSet.js delete mode 100644 reverse_engineering/node_modules/antlr4/LL1Analyzer.js delete mode 100644 reverse_engineering/node_modules/antlr4/Lexer.js delete mode 100644 reverse_engineering/node_modules/antlr4/Parser.js delete mode 100644 reverse_engineering/node_modules/antlr4/ParserRuleContext.js delete mode 100644 reverse_engineering/node_modules/antlr4/PredictionContext.js delete mode 100644 reverse_engineering/node_modules/antlr4/README.md delete mode 100644 reverse_engineering/node_modules/antlr4/Recognizer.js delete mode 100644 reverse_engineering/node_modules/antlr4/RuleContext.js delete mode 100644 reverse_engineering/node_modules/antlr4/Token.js delete mode 100644 reverse_engineering/node_modules/antlr4/Utils.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATN.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNConfig.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNConfigSet.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNDeserializationOptions.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNDeserializer.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNSimulator.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNState.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ATNType.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/LexerATNSimulator.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/LexerAction.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/LexerActionExecutor.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/ParserATNSimulator.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/PredictionMode.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/SemanticContext.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/Transition.js delete mode 100644 reverse_engineering/node_modules/antlr4/atn/index.js delete mode 100644 reverse_engineering/node_modules/antlr4/dfa/DFA.js delete mode 100644 reverse_engineering/node_modules/antlr4/dfa/DFASerializer.js delete mode 100644 reverse_engineering/node_modules/antlr4/dfa/DFAState.js delete mode 100644 reverse_engineering/node_modules/antlr4/dfa/index.js delete mode 100644 reverse_engineering/node_modules/antlr4/error/DiagnosticErrorListener.js delete mode 100644 reverse_engineering/node_modules/antlr4/error/ErrorListener.js delete mode 100644 reverse_engineering/node_modules/antlr4/error/ErrorStrategy.js delete mode 100644 reverse_engineering/node_modules/antlr4/error/Errors.js delete mode 100644 reverse_engineering/node_modules/antlr4/error/index.js delete mode 100644 reverse_engineering/node_modules/antlr4/index.js delete mode 100644 reverse_engineering/node_modules/antlr4/package.json delete mode 100644 reverse_engineering/node_modules/antlr4/polyfills/codepointat.js delete mode 100644 reverse_engineering/node_modules/antlr4/polyfills/fromcodepoint.js delete mode 100644 reverse_engineering/node_modules/antlr4/tree/Tree.js delete mode 100644 reverse_engineering/node_modules/antlr4/tree/Trees.js delete mode 100644 reverse_engineering/node_modules/antlr4/tree/index.js delete mode 100644 reverse_engineering/node_modules/asn1/LICENSE delete mode 100644 reverse_engineering/node_modules/asn1/README.md delete mode 100644 reverse_engineering/node_modules/asn1/lib/ber/errors.js delete mode 100644 reverse_engineering/node_modules/asn1/lib/ber/index.js delete mode 100644 reverse_engineering/node_modules/asn1/lib/ber/reader.js delete mode 100644 reverse_engineering/node_modules/asn1/lib/ber/types.js delete mode 100644 reverse_engineering/node_modules/asn1/lib/ber/writer.js delete mode 100644 reverse_engineering/node_modules/asn1/lib/index.js delete mode 100644 reverse_engineering/node_modules/asn1/package.json delete mode 100644 reverse_engineering/node_modules/bcrypt-pbkdf/CONTRIBUTING.md delete mode 100644 reverse_engineering/node_modules/bcrypt-pbkdf/LICENSE delete mode 100644 reverse_engineering/node_modules/bcrypt-pbkdf/README.md delete mode 100644 reverse_engineering/node_modules/bcrypt-pbkdf/index.js delete mode 100644 reverse_engineering/node_modules/bcrypt-pbkdf/package.json delete mode 100644 reverse_engineering/node_modules/cassandra-driver/.eslintignore delete mode 100644 reverse_engineering/node_modules/cassandra-driver/.travis.yml delete mode 100644 reverse_engineering/node_modules/cassandra-driver/CHANGELOG.md delete mode 100644 reverse_engineering/node_modules/cassandra-driver/Jenkinsfile delete mode 100644 reverse_engineering/node_modules/cassandra-driver/LICENSE.txt delete mode 100644 reverse_engineering/node_modules/cassandra-driver/NOTICE.txt delete mode 100644 reverse_engineering/node_modules/cassandra-driver/README.md delete mode 100644 reverse_engineering/node_modules/cassandra-driver/build.yaml delete mode 100644 reverse_engineering/node_modules/cassandra-driver/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/base-dse-authenticator.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/dse-gssapi-auth-provider.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/dse-plain-text-auth-provider.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/gssapi-client.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/no-auth-provider.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/plain-text-auth-provider.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/auth/provider.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/client-options.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/client.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/concurrent/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/concurrent/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/connection.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/control-connection.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/cloud/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/complex-type-helper.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/custom-type-serializers.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/graph-executor.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/graph-serializer.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/options.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/result-set.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/structure.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/type-serializers.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/graph/wrappers.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/search/date-range.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/search/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/datastax/search/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/encoder.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/errors.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/execution-options.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/execution-profile.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/geometry.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/line-string.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/point.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/geometry/polygon.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/host-connection-pool.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/host.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/insights-client.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/cache.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/doc-info-adapter.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/mapper.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/mapping-handler.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/model-batch-item.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/model-batch-mapper.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/model-mapper.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/model-mapping-info.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/object-selector.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/q.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/query-generator.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/result-mapper.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/result.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/table-mappings.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/mapping/tree.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/aggregate.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/client-state.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/data-collection.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/event-debouncer.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/materialized-view.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/schema-function.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/schema-index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/schema-parser.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metadata/table-metadata.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metrics/client-metrics.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metrics/default-metrics.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metrics/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/metrics/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/operation-state.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/address-resolution.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/load-balancing.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/reconnection.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/retry.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/speculative-execution.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/policies/timestamp-generation.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/prepare-handler.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/promise-utils.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/readers.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/request-execution.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/request-handler.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/requests.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/stream-id-stack.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/streams.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/token.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/tokenizer.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/tracker/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/tracker/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/tracker/request-logger.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/tracker/request-tracker.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/big-decimal.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/duration.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/index.d.ts delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/index.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/inet-address.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/integer.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/local-date.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/local-time.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/mutable-long.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/protocol-version.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/result-set.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/result-stream.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/row.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/time-uuid.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/tuple.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/uuid.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/types/version-number.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/utils.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/lib/writers.js delete mode 100644 reverse_engineering/node_modules/cassandra-driver/package.json delete mode 100644 reverse_engineering/node_modules/debug/.coveralls.yml delete mode 100644 reverse_engineering/node_modules/debug/.eslintrc delete mode 100644 reverse_engineering/node_modules/debug/.npmignore delete mode 100644 reverse_engineering/node_modules/debug/.travis.yml delete mode 100644 reverse_engineering/node_modules/debug/CHANGELOG.md delete mode 100644 reverse_engineering/node_modules/debug/LICENSE delete mode 100644 reverse_engineering/node_modules/debug/Makefile delete mode 100644 reverse_engineering/node_modules/debug/README.md delete mode 100644 reverse_engineering/node_modules/debug/component.json delete mode 100644 reverse_engineering/node_modules/debug/karma.conf.js delete mode 100644 reverse_engineering/node_modules/debug/node.js delete mode 100644 reverse_engineering/node_modules/debug/package.json delete mode 100644 reverse_engineering/node_modules/debug/src/browser.js delete mode 100644 reverse_engineering/node_modules/debug/src/debug.js delete mode 100644 reverse_engineering/node_modules/debug/src/index.js delete mode 100644 reverse_engineering/node_modules/debug/src/inspector-log.js delete mode 100644 reverse_engineering/node_modules/debug/src/node.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/LICENSE delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/README.md delete mode 100755 reverse_engineering/node_modules/fast-xml-parser/cli.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/package.json delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/json2xml.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/nimndata.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/node2json.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/node2json_str.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/parser.d.ts delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/parser.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/read.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/util.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/validator.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/xmlNode.js delete mode 100644 reverse_engineering/node_modules/fast-xml-parser/src/xmlstr2xmlnode.js delete mode 100644 reverse_engineering/node_modules/jks-js/CHANGELOG.md delete mode 100644 reverse_engineering/node_modules/jks-js/LICENSE delete mode 100644 reverse_engineering/node_modules/jks-js/README.md delete mode 100644 reverse_engineering/node_modules/jks-js/examples/assets/keystore.jks delete mode 100644 reverse_engineering/node_modules/jks-js/examples/assets/truststore.jks delete mode 100644 reverse_engineering/node_modules/jks-js/examples/index.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/certs/Certificate.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/certs/CertificateRegistry.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/certs/X509Cert.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/DerValue.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/EncryptedPrivateKeyInfo.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/KeyProtector.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/ObjectIdentifier.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/PKCS8Key.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/encryption/PasswordDigest.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/index.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/keystore/JavaKeyStoreParser.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/keystore/KeyEntry.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/keystore/PKCS12Parser.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/keystore/TrustedKeyEntry.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/stream/DigestInputStream.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/stream/InputStream.js delete mode 100644 reverse_engineering/node_modules/jks-js/lib/stream/OutputStream.js delete mode 100644 reverse_engineering/node_modules/jks-js/package.json delete mode 100644 reverse_engineering/node_modules/lodash.defaults/LICENSE delete mode 100644 reverse_engineering/node_modules/lodash.defaults/README.md delete mode 100644 reverse_engineering/node_modules/lodash.defaults/index.js delete mode 100644 reverse_engineering/node_modules/lodash.defaults/package.json delete mode 100644 reverse_engineering/node_modules/long/LICENSE delete mode 100644 reverse_engineering/node_modules/long/README.md delete mode 100644 reverse_engineering/node_modules/long/index.d.ts delete mode 100644 reverse_engineering/node_modules/long/index.js delete mode 100644 reverse_engineering/node_modules/long/package.json delete mode 100644 reverse_engineering/node_modules/long/umd/index.d.ts delete mode 100644 reverse_engineering/node_modules/long/umd/index.js delete mode 100644 reverse_engineering/node_modules/long/umd/package.json delete mode 100644 reverse_engineering/node_modules/ms/index.js delete mode 100644 reverse_engineering/node_modules/ms/license.md delete mode 100644 reverse_engineering/node_modules/ms/package.json delete mode 100644 reverse_engineering/node_modules/ms/readme.md delete mode 100644 reverse_engineering/node_modules/node-forge/CHANGELOG.md delete mode 100644 reverse_engineering/node_modules/node-forge/LICENSE delete mode 100644 reverse_engineering/node_modules/node-forge/README.md delete mode 100644 reverse_engineering/node_modules/node-forge/dist/forge.all.min.js delete mode 100644 reverse_engineering/node_modules/node-forge/dist/forge.all.min.js.map delete mode 100644 reverse_engineering/node_modules/node-forge/dist/forge.min.js delete mode 100644 reverse_engineering/node_modules/node-forge/dist/forge.min.js.map delete mode 100644 reverse_engineering/node_modules/node-forge/dist/prime.worker.min.js delete mode 100644 reverse_engineering/node_modules/node-forge/dist/prime.worker.min.js.map delete mode 100644 reverse_engineering/node_modules/node-forge/flash/README.md delete mode 100644 reverse_engineering/node_modules/node-forge/flash/package.json delete mode 100644 reverse_engineering/node_modules/node-forge/flash/swf/SocketPool.swf delete mode 100644 reverse_engineering/node_modules/node-forge/lib/aes.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/aesCipherSuites.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/asn1-validator.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/asn1.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/baseN.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/cipher.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/cipherModes.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/debug.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/des.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/ed25519.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/forge.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/form.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/hmac.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/http.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/index.all.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/index.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/jsbn.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/kem.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/log.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/md.all.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/md.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/md5.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/mgf.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/mgf1.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/oids.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pbe.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pbkdf2.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pem.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pkcs1.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pkcs12.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pkcs7.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pkcs7asn1.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pki.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/prime.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/prime.worker.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/prng.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/pss.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/random.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/rc2.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/rsa.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/sha1.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/sha256.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/sha512.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/socket.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/ssh.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/task.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/tls.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/tlssocket.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/util.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/x509.js delete mode 100644 reverse_engineering/node_modules/node-forge/lib/xhr.js delete mode 100644 reverse_engineering/node_modules/node-forge/package.json delete mode 100644 reverse_engineering/node_modules/node-int64/.npmignore delete mode 100644 reverse_engineering/node_modules/node-int64/Int64.js delete mode 100644 reverse_engineering/node_modules/node-int64/LICENSE delete mode 100644 reverse_engineering/node_modules/node-int64/README.md delete mode 100644 reverse_engineering/node_modules/node-int64/package.json delete mode 100644 reverse_engineering/node_modules/node-int64/test.js delete mode 100644 reverse_engineering/node_modules/node-rsa/README.md delete mode 100644 reverse_engineering/node_modules/node-rsa/gruntfile.js delete mode 100644 reverse_engineering/node_modules/node-rsa/package.json delete mode 100644 reverse_engineering/node_modules/node-rsa/src/NodeRSA.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/encryptEngines/encryptEngines.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/encryptEngines/io.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/encryptEngines/js.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/encryptEngines/node12.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/formats/components.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/formats/formats.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/formats/openssh.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/formats/pkcs1.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/formats/pkcs8.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/libs/jsbn.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/libs/rsa.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/schemes/oaep.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/schemes/pkcs1.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/schemes/pss.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/schemes/schemes.js delete mode 100644 reverse_engineering/node_modules/node-rsa/src/utils.js delete mode 100644 reverse_engineering/node_modules/safer-buffer/LICENSE delete mode 100644 reverse_engineering/node_modules/safer-buffer/Porting-Buffer.md delete mode 100644 reverse_engineering/node_modules/safer-buffer/Readme.md delete mode 100644 reverse_engineering/node_modules/safer-buffer/dangerous.js delete mode 100644 reverse_engineering/node_modules/safer-buffer/package.json delete mode 100644 reverse_engineering/node_modules/safer-buffer/safer.js delete mode 100644 reverse_engineering/node_modules/safer-buffer/tests.js delete mode 100644 reverse_engineering/node_modules/ssh2/.eslintignore delete mode 100644 reverse_engineering/node_modules/ssh2/.eslintrc.js delete mode 100644 reverse_engineering/node_modules/ssh2/.github/workflows/ci.yml delete mode 100644 reverse_engineering/node_modules/ssh2/.github/workflows/lint.yml delete mode 100644 reverse_engineering/node_modules/ssh2/LICENSE delete mode 100644 reverse_engineering/node_modules/ssh2/README.md delete mode 100644 reverse_engineering/node_modules/ssh2/SFTP.md delete mode 100644 reverse_engineering/node_modules/ssh2/examples/server-chat.js delete mode 100644 reverse_engineering/node_modules/ssh2/examples/sftp-server-download-only.js delete mode 100644 reverse_engineering/node_modules/ssh2/install.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/Channel.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/agent.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/client.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/http-agents.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/index.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/Protocol.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/SFTP.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/constants.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/binding.gyp delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Makefile delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d delete mode 100755 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o delete mode 100755 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/binding.Makefile delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/config.gypi delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/poly1305.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/crypto/src/binding.cc delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/handlers.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/handlers.misc.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/kex.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/keyParser.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/node-fs-compat.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/utils.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/protocol/zlib.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/server.js delete mode 100644 reverse_engineering/node_modules/ssh2/lib/utils.js delete mode 100644 reverse_engineering/node_modules/ssh2/package.json delete mode 100644 reverse_engineering/node_modules/ssh2/test/common.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/bad_rsa_private_key delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/https_cert.pem delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/https_key.pem delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/id_dsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/id_ecdsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa.ppk delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/openssh_new_rsa delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_dsa_key delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key delete mode 100644 reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_rsa_key delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-exec.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-integration-openssh.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-misc-client-server.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-openssh.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-protocol-crypto.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-protocol-keyparser.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-server-hostkeys.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-sftp.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-shell.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-userauth-agent-openssh.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-userauth-agent.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test-userauth.js delete mode 100644 reverse_engineering/node_modules/ssh2/test/test.js delete mode 100644 reverse_engineering/node_modules/ssh2/util/build_pagent.bat delete mode 100644 reverse_engineering/node_modules/ssh2/util/pagent.c delete mode 100644 reverse_engineering/node_modules/ssh2/util/pagent.exe delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/.eslintignore delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/.travis.yml delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/LICENSE delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/README.md delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/examples/default.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive_error.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/examples/server/index.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/index.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/lib/config.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/package.json delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/test/config-spec.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/test/main-spec.js delete mode 100644 reverse_engineering/node_modules/tunnel-ssh/test/server/index.js delete mode 100644 reverse_engineering/node_modules/tweetnacl/.npmignore delete mode 100644 reverse_engineering/node_modules/tweetnacl/AUTHORS.md delete mode 100644 reverse_engineering/node_modules/tweetnacl/CHANGELOG.md delete mode 100644 reverse_engineering/node_modules/tweetnacl/LICENSE delete mode 100644 reverse_engineering/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md delete mode 100644 reverse_engineering/node_modules/tweetnacl/README.md delete mode 100644 reverse_engineering/node_modules/tweetnacl/nacl-fast.js delete mode 100644 reverse_engineering/node_modules/tweetnacl/nacl-fast.min.js delete mode 100644 reverse_engineering/node_modules/tweetnacl/nacl.d.ts delete mode 100644 reverse_engineering/node_modules/tweetnacl/nacl.js delete mode 100644 reverse_engineering/node_modules/tweetnacl/nacl.min.js delete mode 100644 reverse_engineering/node_modules/tweetnacl/package.json delete mode 100644 reverse_engineering/node_modules/undici-types/README.md delete mode 100644 reverse_engineering/node_modules/undici-types/agent.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/api.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/balanced-pool.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/cache.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/client.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/connector.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/content-type.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/cookies.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/diagnostics-channel.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/dispatcher.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/errors.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/fetch.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/file.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/filereader.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/formdata.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/global-dispatcher.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/global-origin.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/handlers.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/header.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/index.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/interceptors.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/mock-agent.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/mock-client.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/mock-errors.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/mock-interceptor.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/mock-pool.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/package.json delete mode 100644 reverse_engineering/node_modules/undici-types/patch.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/pool-stats.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/pool.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/proxy-agent.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/readable.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/webidl.d.ts delete mode 100644 reverse_engineering/node_modules/undici-types/websocket.d.ts delete mode 100644 reverse_engineering/package-lock.json delete mode 100644 reverse_engineering/parser/CqlLexer.interp delete mode 100644 reverse_engineering/parser/CqlLexer.js delete mode 100644 reverse_engineering/parser/CqlLexer.tokens delete mode 100644 reverse_engineering/parser/CqlParser.interp delete mode 100644 reverse_engineering/parser/CqlParser.js delete mode 100644 reverse_engineering/parser/CqlParser.tokens delete mode 100644 reverse_engineering/parser/CqlParserListener.js delete mode 100644 reverse_engineering/parser/CqlParserVisitor.js delete mode 100644 reverse_engineering/typesHelper.js create mode 100644 tsconfig.json diff --git a/.github/workflows/fake-pr-tests.yml b/.github/workflows/fake-pr-tests.yml deleted file mode 100644 index 22741666..00000000 --- a/.github/workflows/fake-pr-tests.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: PR tests -on: - pull_request: - types: [auto_merge_enabled] - workflow_dispatch: - -jobs: - skip: - name: Report fake success for PR tests - runs-on: ubuntu-latest - permissions: - checks: write - steps: - - uses: LouisBrunner/checks-action@v2.0.0 - with: - name: Run PR tests (Plugins) (Plugins) - conclusion: success - token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 43bbd455..00000000 --- a/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -.antlr -.DS_Store \ No newline at end of file diff --git a/.npmrc b/.npmrc new file mode 100644 index 00000000..449691b7 --- /dev/null +++ b/.npmrc @@ -0,0 +1 @@ +save-exact=true \ No newline at end of file diff --git a/adapter/0.1.10.json b/adapter/0.1.10.json index 2a792d12..49bdb5d6 100644 --- a/adapter/0.1.10.json +++ b/adapter/0.1.10.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -41,20 +41,11 @@ */ { "add": { - "entity": [ - "tableOptions" - ], + "entity": ["tableOptions"], "field": { - "map": [ - "keyType", - "subtype" - ], - "set": [ - "subtype" - ], - "list": [ - "subtype" - ] + "map": ["keyType", "subtype"], + "set": ["subtype"], + "list": ["subtype"] } }, "delete": { diff --git a/adapter/0.1.117.json b/adapter/0.1.117.json index 8cf3c47f..e9abff10 100644 --- a/adapter/0.1.117.json +++ b/adapter/0.1.117.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -42,12 +42,7 @@ { "modify": { "field": [ - [ - "removeArrayItemNameFromComplexUdt", - ["udt", "reference"], - ["set", "list", "tuple"], - ["code", "name"] - ] + ["removeArrayItemNameFromComplexUdt", ["udt", "reference"], ["set", "list", "tuple"], ["code", "name"]] ] } -} \ No newline at end of file +} diff --git a/adapter/0.1.14.json b/adapter/0.1.14.json index fc5f8a07..70380f46 100644 --- a/adapter/0.1.14.json +++ b/adapter/0.1.14.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -39,7 +39,7 @@ * }, * } */ - { +{ "modify": { "field": [ { diff --git a/adapter/0.1.18.json b/adapter/0.1.18.json index dbee1502..7d25cf0c 100644 --- a/adapter/0.1.18.json +++ b/adapter/0.1.18.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -39,7 +39,7 @@ * }, * } */ - { +{ "modify": { "field": [ { diff --git a/adapter/0.1.33.json b/adapter/0.1.33.json index 248003be..566cabdf 100644 --- a/adapter/0.1.33.json +++ b/adapter/0.1.33.json @@ -41,7 +41,7 @@ */ { - "modify": { - "entity": ["transformTableOptionsFromStringToObject"] - } + "modify": { + "entity": ["transformTableOptionsFromStringToObject"] + } } diff --git a/adapter/0.1.36.json b/adapter/0.1.36.json index 34a26132..e27b462f 100644 --- a/adapter/0.1.36.json +++ b/adapter/0.1.36.json @@ -40,9 +40,8 @@ * } */ - { +{ "add": { "container": ["addToCqlScript"] } - } - \ No newline at end of file +} diff --git a/adapter/0.1.68.json b/adapter/0.1.68.json index 15e21f1b..e6d23008 100644 --- a/adapter/0.1.68.json +++ b/adapter/0.1.68.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -42,11 +42,15 @@ { "modify": { "container": [ - ["renamePropertiesInArrayElements", "UDFs",{ - "storedProcFunction":"functionBody", - "storedProcComments":"functionComments", - "storedProcDescription":"functionDescription" - }] + [ + "renamePropertiesInArrayElements", + "UDFs", + { + "storedProcFunction": "functionBody", + "storedProcComments": "functionComments", + "storedProcDescription": "functionDescription" + } + ] ] } -} \ No newline at end of file +} diff --git a/adapter/0.1.73.json b/adapter/0.1.73.json index 101ad536..416d5aa4 100644 --- a/adapter/0.1.73.json +++ b/adapter/0.1.73.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -42,50 +42,62 @@ { "modify": { "field": [ - ["convertRootJsonType", { - "from": { - "physicalType": "char", - "type": "jsonObject" - }, - "to": { - "childType": "char", - "mode": "text", - "subtype": "object" + [ + "convertRootJsonType", + { + "from": { + "physicalType": "char", + "type": "jsonObject" + }, + "to": { + "childType": "char", + "mode": "text", + "subtype": "object" + } } - }], - ["convertRootJsonType", { - "from": { - "physicalType": "char", - "type": "jsonArray" - }, - "to": { - "childType": "char", - "mode": "text", - "subtype": "array" + ], + [ + "convertRootJsonType", + { + "from": { + "physicalType": "char", + "type": "jsonArray" + }, + "to": { + "childType": "char", + "mode": "text", + "subtype": "array" + } } - }], - ["convertRootJsonType", { - "from": { - "physicalType": "blob", - "type": "jsonObject" - }, - "to": { - "childType": "blob", - "mode": "blb", - "subtype": "object" + ], + [ + "convertRootJsonType", + { + "from": { + "physicalType": "blob", + "type": "jsonObject" + }, + "to": { + "childType": "blob", + "mode": "blb", + "subtype": "object" + } } - }], - ["convertRootJsonType", { - "from": { - "physicalType": "blob", - "type": "jsonArray" - }, - "to": { - "childType": "blob", - "mode": "blb", - "subtype": "array" + ], + [ + "convertRootJsonType", + { + "from": { + "physicalType": "blob", + "type": "jsonArray" + }, + "to": { + "childType": "blob", + "mode": "blb", + "subtype": "array" + } } - }] + ] ] } -} \ No newline at end of file +} diff --git a/adapter/0.1.83.json b/adapter/0.1.83.json index 72419034..ff7cea82 100644 --- a/adapter/0.1.83.json +++ b/adapter/0.1.83.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -48,4 +48,4 @@ } ] } -} \ No newline at end of file +} diff --git a/adapter/0.1.87.json b/adapter/0.1.87.json index bbb8e2de..4dc37c8a 100644 --- a/adapter/0.1.87.json +++ b/adapter/0.1.87.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -39,7 +39,7 @@ * }, * } */ - { +{ "modify": { "entity": [ { @@ -59,9 +59,7 @@ "searchIndexProfiles": "spaceSavingNoJoin" }, "to": { - "searchIndexProfiles": [ - "spaceSavingNoJoin" - ] + "searchIndexProfiles": ["spaceSavingNoJoin"] } }, { @@ -69,9 +67,7 @@ "searchIndexProfiles": "spaceSavingNoTextfield" }, "to": { - "searchIndexProfiles": [ - "spaceSavingNoTextfield" - ] + "searchIndexProfiles": ["spaceSavingNoTextfield"] } }, { @@ -79,9 +75,7 @@ "searchIndexProfiles": "spaceSavingSlowTriePrecision" }, "to": { - "searchIndexProfiles": [ - "spaceSavingSlowTriePrecision" - ] + "searchIndexProfiles": ["spaceSavingSlowTriePrecision"] } }, { @@ -94,4 +88,4 @@ } ] } -} \ No newline at end of file +} diff --git a/adapter/0.1.93.json b/adapter/0.1.93.json index b1733953..5a442702 100644 --- a/adapter/0.1.93.json +++ b/adapter/0.1.93.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], @@ -41,15 +41,9 @@ */ { "add": { - "entity": [ - "tableIfNotExist" - ], - "container": [ - "keyspaceIfNotExist" - ], - "view": [ - "viewIfNotExist" - ] + "entity": ["tableIfNotExist"], + "container": ["keyspaceIfNotExist"], + "view": ["viewIfNotExist"] }, "modify": { "entity": [ @@ -83,4 +77,4 @@ } ] } -} \ No newline at end of file +} diff --git a/central_pane/dtdAbbreviation.json b/central_pane/dtdAbbreviation.json index bfbd503d..685b3b85 100644 --- a/central_pane/dtdAbbreviation.json +++ b/central_pane/dtdAbbreviation.json @@ -6,4 +6,4 @@ "bool": "{0/1}", "bytes": "{BYTES}", "null": "{null}" -} \ No newline at end of file +} diff --git a/forward_engineering/api.js b/forward_engineering/api.js index 019c837a..d3fdf635 100644 --- a/forward_engineering/api.js +++ b/forward_engineering/api.js @@ -1,235 +1,184 @@ -'use strict' - -const { - retrieveContainerName, - retrieveEntityName, - retrieveUDA, - retrieveUDF, - retrieveIndexes, - retrieveIsItemActivated, - commentDeactivatedStatement, - getUserDefinedAggregations, - getUserDefinedFunctions, -} = require('./helpers/generalHelper'); -const { getTableStatement } = require('./helpers/tableHelper'); -const { sortUdt, getUdtMap, getUdtScripts, prepareDefinitions } = require('./helpers/udtHelper'); -const { getIndexes } = require('./helpers/indexHelper'); -const { getKeyspaceStatement } = require('./helpers/keyspaceHelper'); -const { getViewScript } = require('./helpers/viewHelper'); -const { getCreateTableScript } = require('./helpers/createHelper'); -const { setDependencies } = require('./helpers/appDependencies'); -const { applyToInstance, testConnection } = require('./helpers/dbConnectionService/index'); -const { getScriptOptions } = require('./helpers/getScriptOptions'); -const { buildContainerLevelAlterScript, isDropInStatements } = require("./helpers/alterScriptBuilder"); - -module.exports = { - generateScript(data, logger, callback, app) { - try { - setDependencies(app); - const { udtTypeMap, modelDefinitions, externalDefinitions } = prepareDefinitions(data); - const jsonSchema = JSON.parse(data.jsonSchema); - const internalDefinitions = sortUdt(JSON.parse(data.internalDefinitions)); - data = { ...data, jsonSchema, udtTypeMap, modelDefinitions, externalDefinitions, internalDefinitions }; - - if (data.isUpdateScript) { - data.scriptOptions = getScriptOptions(data); - - callback(null, buildContainerLevelAlterScript(data.jsonSchema, udtTypeMap, data)); - } else { - let script = `${getKeyspaceStatement(data.containerData)}\n\n${getCreateTableScript(data, true)}`; - callback(null, script); - } - } catch (e) { - logger.log('error', { message: e.message, stack: e.stack }, 'Cassandra Forward-Engineering Error'); - - setTimeout(() => { - callback({ message: e.message, stack: e.stack }); - }, 150); - } - }, - - generateViewScript(data, logger, callback, app) { - setDependencies(app); - const viewSchema = JSON.parse(data.jsonSchema || '{}'); - const entitySchema = JSON.parse(data.jsonSchema[viewSchema.viewOn] || '{}'); - - const script = getViewScript({ - schema: viewSchema, - entitySchema, - viewData: data.viewData, - entityData: data.entityData, - containerData: data.containerData, - collectionRefsDefinitionsMap: data.collectionRefsDefinitionsMap, - ifNotExist: viewSchema.viewIfNotExist - }); - - callback(null, script) - }, - - generateContainerScript(data, logger, callback, app) { - try { - setDependencies(app); - if (data.isUpdateScript) { - const { udtTypeMap, modelDefinitions, externalDefinitions } = prepareDefinitions(data); - data = { ...data, udtTypeMap, modelDefinitions, externalDefinitions }; - data.scriptOptions = getScriptOptions(data); - - const scripts = data.entities.map(entityId => { - const jsonSchema = JSON.parse(data.jsonSchema[entityId]); - data.internalDefinitions = sortUdt(JSON.parse(data.internalDefinitions[entityId])); - return buildContainerLevelAlterScript(jsonSchema, data.udtTypeMap, data); - }) - callback(null, scripts.filter(Boolean).join('\n\n')); - } else { - const modelDefinitions = sortUdt(JSON.parse(data.modelDefinitions)); - const externalDefinitions = JSON.parse(data.externalDefinitions); - const containerData = data.containerData; - let cqlScriptData = []; - - const containerName = retrieveContainerName(containerData); - const keyspace = getKeyspaceStatement(containerData); - const isKeyspaceActivated = retrieveIsItemActivated(containerData); - - const generalUdtTypeMap = getUdtMap([modelDefinitions, externalDefinitions]); - let generalUDT = getUdtScripts(containerName, [ - externalDefinitions, - modelDefinitions - ], generalUdtTypeMap, isKeyspaceActivated); - - const UDF = getUserDefinedFunctions(retrieveUDF(containerData)); - const UDA = getUserDefinedAggregations(retrieveUDA(containerData)); - - const dbVersion = data.modelData[0].dbVersion; - - cqlScriptData.push( - keyspace, - ...generalUDT - ); - - data.entities.forEach((entityId) => { - const internalDefinitions = sortUdt( - JSON.parse(data.internalDefinitions[entityId]) - ); - const jsonSchema = JSON.parse(data.jsonSchema[entityId]); - const entityData = data.entityData[entityId]; - const udtTypeMap = Object.assign( - {}, - generalUdtTypeMap, - getUdtMap([internalDefinitions, jsonSchema]) - ); - - const entityName = retrieveEntityName(entityData); - const isEntityActivated = retrieveIsItemActivated(entityData); - const dataSources = [ - jsonSchema, - modelDefinitions, - internalDefinitions, - externalDefinitions, - ]; - const internalUdt = getUdtScripts( - containerName, - [internalDefinitions, jsonSchema], - udtTypeMap, - isKeyspaceActivated && isEntityActivated - ).map(udtStatement => commentDeactivatedStatement(udtStatement, isEntityActivated, isKeyspaceActivated)); - - const table = getTableStatement({ - tableData: jsonSchema, - tableMetaData: entityData, - keyspaceMetaData: containerData, - dataSources, - udtTypeMap, - isKeyspaceActivated, - }); - const indexes = getIndexes( - retrieveIndexes(entityData, dbVersion), - dataSources, - entityName, - containerName, - isEntityActivated, - isKeyspaceActivated, - dbVersion - ); - - cqlScriptData.push(...internalUdt, table, indexes); - }); - - cqlScriptData = cqlScriptData.concat(data.views.map(viewId => { - const viewSchema = JSON.parse(data.jsonSchema[viewId] || '{}'); - - return getViewScript({ - schema: viewSchema, - viewData: data.viewData[viewId], - entityData: data.entityData[viewSchema.viewOn], - containerData: data.containerData, - collectionRefsDefinitionsMap: data.collectionRefsDefinitionsMap, - isKeyspaceActivated, - ifNotExist: viewSchema.viewIfNotExist - }) - })); - - cqlScriptData.push(UDF, UDA); - - callback(null, commentDeactivatedStatement(getScript(cqlScriptData), isKeyspaceActivated)); - } - } catch (e) { - logger.log('error', { message: e.message, stack: e.stack }, 'Cassandra Forward-Engineering Error'); - - setTimeout(() => { - callback({ message: e.message, stack: e.stack }); - }, 150); - } - }, - - applyToInstance(connectionInfo, logger, callback, app) { - logger.clear(); - logger.log('info', connectionInfo, 'connectionInfo', connectionInfo.hiddenKeys); - - applyToInstance(connectionInfo, logger, app) - .then(result => { - callback(null, result); - }) - .catch(error => { - callback(error); - }); - }, - - testConnection(connectionInfo, logger, callback, app) { - testConnection(connectionInfo, app) - .then( - callback, - callback - ); - }, - - isDropInStatements(data, logger, callback, app) { - try { - setDependencies(app); - let result; - const { udtTypeMap, modelDefinitions, externalDefinitions } = prepareDefinitions(data); - - if (data.level === 'container') { - data = { ...data, udtTypeMap, modelDefinitions, externalDefinitions }; - result = data.entities.map(entityId => { - const jsonSchema = JSON.parse(data.jsonSchema[entityId]); - data.internalDefinitions = sortUdt(JSON.parse(data.internalDefinitions[entityId])); - return isDropInStatements(jsonSchema, data.udtTypeMap, data); - }) - .some(Boolean); - } else if (data.level === 'entity') { - const jsonSchema = JSON.parse(data.jsonSchema); - const internalDefinitions = sortUdt(JSON.parse(data.internalDefinitions)); - data = { ...data, udtTypeMap, modelDefinitions, externalDefinitions, jsonSchema, internalDefinitions }; - result = isDropInStatements(data.jsonSchema, data.udtTypeMap, data) - } - - callback(null, result); - } catch (e) { - callback({ message: e.message, stack: e.stack }); - } - }, -}; - -const getScript = (structure) => { - return structure.filter(item => item).join('\n\n'); -}; \ No newline at end of file +"use strict";var CO=Object.defineProperty;var c=(t,e)=>CO(t,"name",{value:e,configurable:!0});var _=(t,e)=>()=>(e||t((e={exports:{}}).exports,e),e.exports);var Uc=_((Pj,o1)=>{"use strict";var s1=require("fs"),ra=require("path"),Qf=c(t=>{try{let e=s1.readFileSync(ra.join(__dirname,"..",t));return JSON.parse(e.toString().replace(/\/\*[\s\S]*?\*\//g,""))}catch{return{}}},"getConfig"),Yf=c(t=>{let e;return(...r)=>(e||(e=t(...r)),e)},"cacheResult"),wO=Yf(()=>Qf(ra.join("properties_pane","field_level","fieldLevelConfig.json"))),xO=Yf(()=>Qf(ra.join("properties_pane","entity_level","entityLevelConfig.json"))),TO=Yf(()=>{let t=c(n=>n.replace(/\.json/,""),"getName"),e=ra.join(__dirname,"..","types");return s1.readdirSync(e).reduce((n,i)=>(n[t(i)]=Qf(ra.join("types",i)),n),{})});o1.exports={getEntityLevelConfig:xO,getFieldLevelConfig:wO,getTypesConfig:TO}});var ar=_((Fj,f1)=>{"use strict";var{getEntityLevelConfig:kj,getFieldLevelConfig:_O,getTypesConfig:bO}=Uc(),IO=2,AO=c((t="")=>t.startsWith("DSE")&&(t.split(" ")[1]||"").split(".")[0]||"","getDataStaxVersion"),NO=c((t,e=1)=>{let r=" ".repeat(e*IO);return t.split(` +`).map(n=>r+n).join(` +`)},"tab"),gi=c((t,e,r,n="")=>((t||[])[e]||{})[r]||n,"retrivePropertyFromConfig"),BO=c(t=>gi(t,0,"code",gi(t,0,"name","")),"retrieveContainerName"),RO=c(t=>gi(t,0,"code",gi(t,0,"collectionName","")),"retrieveEntityName"),OO=c(t=>gi(t,1,"UDFs",[]),"retrieveUDF"),DO=c(t=>gi(t,2,"UDAs",[]),"retrieveUDA"),PO=c((t,e)=>{let r=t[1],n={indexes:gi(t,1,"SecIndxs",[])};return r.searchIndex&&(n.searchIndex={indexType:"search",columns:r.searchIndexColumns,config:r.searchIndexConfig,profiles:c1(r.searchIndexProfiles,e),options:r.searchIndexOptions,ifNotExist:r.searchIndexIfNotExist}),n},"retrieveIndexes"),a1=c((t,e)=>t.filter(r=>!e.includes(r)),"filterSpaceSaving"),c1=c((t,e)=>{let r=AO(e),i=[(r.length?Number(r)>=6:!1)?"spaceSavingNoTextfield":""];return t=Array.isArray(t)?t:[t].filter(Boolean),t=a1(t,i),a1(["spaceSavingNoJoin","spaceSavingNoTextfield","spaceSavingSlowTriePrecision"],i).every(a=>t.includes(a))?["spaceSavingAll"]:t},"getIndexProfiles"),LO=c((t,e)=>u1(t,`"${e}"`),"getTableNameStatement"),u1=c((t,e)=>`${t?`"${t}".`:""}${e}`,"getNameWithKeyspace"),kO=c(t=>bO()[t],"getTypeConfig"),l1=c((t,e)=>{let r=_O().structure;return r[t]?r[t].find(i=>i.propertyKeyword===e):void 0},"getFieldConfig"),Zf=c((t,e)=>{let r=Object.assign({},t),n=c((s,o)=>Object.keys(s).reduce((a,u)=>{let l=s[u];return a[u]=o(Zf(l,o),u),a},{}),"eachProperty"),i=c((s,o)=>s.map((a,u)=>o(Zf(a,o),u)),"eachItem");if(r.hasOwnProperty("properties")&&(r.properties=n(r.properties,e)),r.hasOwnProperty("items")){let s=Array.isArray(r.items)?r.items:[r.items];r.items=i(s,e)}return r},"eachField"),FO=c((t,e)=>{let r=l1(t,"mode")||{};return Array.isArray(r.options)?r.options.includes(e):!1},"canTypeHaveSubtype"),qO=c((t,e=!0,r=!0,n=!0)=>{if(e||!r||!t)return t;let i=c((o,a="-- ")=>o.split(` +`).map(u=>`${a}${u}`).join(` +`),"insertBeforeEachLine");return n?c(o=>`/* +${i(o," ")} +*/`,"multiLineComment")(t):i(t)},"commentDeactivatedStatement"),UO=c(t=>{var r;let e=(r=t==null?void 0:t[0])==null?void 0:r.isActivated;return e===void 0?!0:e},"retrieveIsItemActivated"),VO=c(t=>t.map(e=>e.functionBody).filter(e=>e).join(` +`),"getUserDefinedFunctions"),MO=c(t=>t.map(e=>e.storedProcFunction).filter(e=>e).join(` +`),"getUserDefinedAggregations"),KO=c(t=>{let{applyDropStatements:e,additionalOptions:r=[]}=t.options||{},n=(r.find(i=>i.id==="applyDropStatements")||{}).value;return e||n},"getApplyDropStatement");f1.exports={tab:NO,retrieveContainerName:BO,retrieveEntityName:RO,retrieveUDF:OO,retrieveUDA:DO,retrieveIndexes:PO,retrivePropertyFromConfig:gi,getTableNameStatement:LO,getFieldConfig:l1,getTypeConfig:kO,getNameWithKeyspace:u1,eachField:Zf,canTypeHaveSubtype:FO,commentDeactivatedStatement:qO,retrieveIsItemActivated:UO,getUserDefinedAggregations:MO,getUserDefinedFunctions:VO,getIndexProfiles:c1,getApplyDropStatement:KO}});var na=_((Uj,v1)=>{"use strict";var{getFieldConfig:d1,getTypeConfig:h1,canTypeHaveSubtype:HO}=ar(),p1=c(t=>{let e,r=c((n,i)=>{if(n===t)e=i;else if(n===void 0)return e;return r},"handler");return r},"ifType"),Xf=c((t,e,r)=>{if(t){let n=d1(t,"mode"),i=n&&n.options?n.options[0]:t;return th(t,r)({type:t,mode:i,frozen:!0,keyType:"char",keySubtype:"text",items:{type:"char",mode:"varchar"},properties:{field:{type:"char",mode:"varchar"}}})}return e},"getModeType"),g1=c((t,e)=>{let r=c(s=>s.type,"simpleType"),n=c(s=>`'${s.subType||"PointType"}'`,"geoSpatialType"),i=c(s=>{if(s.physicalType)return th(s.physicalType)(Object.assign(s,{type:s.physicalType}))},"getJsonType");return p1(t)("char",s=>s.mode||"text")("numeric",s=>{let o=s.mode||"integer";return o==="integer"?"int":o})("binary",()=>"blob")("bool",()=>"boolean")("blob",r)("timestamp",r)("date",r)("time",r)("duration",r)("uuid",r)("timeuuid",r)("DseExecutorStateType",s=>`'${r(s)}'`)("DateRangeType",s=>`'${r(s)}'`)("geospatial",n)("udt",(s,o)=>Jf(o,e)())("jsonObject",i)("jsonArray",i)()},"getScalarType"),y1=c((t,e,r)=>{let n=c(g=>!!g.frozen,"isFrozen"),i=c(g=>d=>{let y=g(d);return n(d)?eh(y):y},"setFrozen"),s=c((g,d,y,v)=>{var m,w,x,A,O,L;if(g.items)if(Array.isArray(g.items)){let j=((m=g.items[0])==null?void 0:m.code)||((w=g.items[0])==null?void 0:w.name)||((x=g.items[0])==null?void 0:x.displayName);return a(g.items[0],n(g),j||0)}else{let j=((A=g.items)==null?void 0:A.code)||((O=g.items)==null?void 0:O.name)||((L=g.items)==null?void 0:L.displayName);return a(g.items,n(g),j||0)}else{let j=h1(g.type);if(j.subtypes&&g.subtype){let Y=j.subtypes[g.subtype];if(Y&&Y.childValueType)return Xf(Y.childValueType,d,y)}}return d},"getValueTypeFromArray"),o=c((g,d,y)=>{if(g.properties){let v=Object.keys(g.properties)[0];if(v){let m=g.properties[v];return a(m,n(g),v)}}else{let v=h1(g.type);if(v.subtypes&&g.subtype){let m=v.subtypes[g.subtype];if(m&&m.childValueType)return Xf(m.childValueType,d,y)}}return d},"getValueTypeFromObject"),a=((g,d)=>(y,v,m)=>{if(y){let w=$O(y,!v&&g,d,m);if(w!==void 0)return w}else return"text"})(e,r),u=c((g,d)=>`set<${s(g,"varchar",r,d)}>`,"typeSet"),l=c((g,d)=>`list<${s(g,"text",r,d)}>`,"list"),f=c((g,d)=>`tuple<${(Array.isArray(g.items)?g.items:[g.items]).map((v,m)=>a(v,!0,m)).join(", ")}>`,"tuple"),h=c((g,d)=>{let y=HO(g.keyType,g.keySubtype)?g.keySubtype:Xf(g.keyType,"text",r),v=o(g,"text",r,d);return`map<${y}, ${v}>`},"map"),p=c((g,d)=>{let y=s(g,"float",r,d),v=jO(g);return`vector<${y}, ${v}>`},"vector");return p1(t)("map",i(h))("list",i(l))("set",i(u))("vector",i(p))("tuple",f)()},"getStructuralTypeHandler"),Jf=c((t,e,r)=>()=>{let n=e[t]||{};return n.frozen&&!r?eh(n.name):n.name},"getUDTHandler"),eh=c(t=>t===void 0?void 0:`frozen<${t}>`,"getFrozen"),th=c((t,e)=>g1(t,e)||y1(t,!0,e)||Jf(t,e),"getHandlerByType"),$O=c((t,e,r,n)=>{let i=m1(t),s=g1(i,r);if(s)return s(t,n);let o=(y1(i,!1,r)||Jf(i,r,e))(t,n);return e?eh(o):o},"getNestedTypeByData"),m1=c(t=>t.$ref?t.$ref.split("/definitions/").pop():t.type?t.type:"char","getTypeByPropertyData"),GO=c((t,e,r)=>{let n=m1(t);return th(n,e)(t,r)},"getTypeByData"),jO=c(t=>{if(!isNaN(+t.dimension))return t.dimension;let e=d1(t.type,"dimension");return e==null?void 0:e.defaultValue},"getVectorDimension");v1.exports={getTypeByData:GO}});var Vc=_((Mj,E1)=>{"use strict";var{getTypeByData:zO}=na(),{commentDeactivatedStatement:WO}=ar();E1.exports={getColumnDefinition(t,e={},r=!1){return Object.keys(t).map(n=>{let i=t[n],s=ZO(i,e,n);if(s===void 0)return"";{let o=YO(i.code||n,s,QO(i));return WO(o,i.isActivated,r,!1)}}).filter(n=>n).join(`, +`)}};var QO=c(t=>!!(t||{}).static,"isStatic"),YO=c((t,e,r)=>`"${t}" ${e}${r?" STATIC":""}`,"getColumn"),ZO=c((t,e,r)=>zO(t,e,r),"getTypeDefinition")});var sa=_((Hj,C1)=>{"use strict";var XO=["isActivated","type","compositePartitionKey"],S1=c((t={},e=!1)=>e?t:XO.reduce((r,n)=>!t.hasOwnProperty(n)||t[n]===void 0?r:{...r,[n]:t[n]},{}),"getAttributes"),ia=c((t,e,r)=>{if(t.GUID===e||t.id===e)return r;if(t.properties)return Object.keys(t.properties).reduce((n,i)=>{if(n)return n;{let s=t.properties[i];return ia(s,e,[...r,s.GUID||s.id])}},void 0);if(t.items)return Array.isArray(t.items)?t.items.reduce((n,i)=>n||ia(i,e,[...r,i.GUID||i.id]),void 0):ia(t.items,e,[...r,t.items.GUID])},"getPathById"),JO=c((t,e,r)=>{let n=Object.keys(e).find(s=>e[s].GUID===t||e[s].id===t),i=e[n];return i&&(i.code||i.name)?{name:i.code||i.name,...S1(e[n],r)}:{name:n,...S1(e[n],r)}},"getRootItemMetadataById"),eD=c((t,e,r)=>{let n=ia(e,t,[]);return n?JO(n[0],e.properties,r):{name:""}},"findFieldMetadataById"),tD=c((t,e,r)=>t.reduce((n,i)=>{for(let s=0;s{"use strict";var w1="LINE",x1="INLINE",rh="MULTILINE",T1=c((t,e="-- ")=>t.split(` +`).map(r=>r&&`${e}${r}`).join(` +`),"insertBeforeEachLine"),rD=c(t=>`/* +${T1(t," ")} +*/`,"multiLineComment"),_1=c(t=>`/* ${t} */`,"inlineComment"),nD=c((t,e=!0,r=!0,n=rh)=>{if(e||!r||!t)return t;switch(n){case rh:return rD(t);case x1:return _1(t);case w1:return T1(t);default:return t}},"commentDeactivatedStatement");b1.exports={commentDeactivatedStatement:nD,inlineComment:_1,LINE:w1,INLINE:x1,MULTILINE:rh}});var A1=_((zj,I1)=>{"use strict";I1.exports={dropTable:"DROP TABLE IF EXISTS ${name};",createTable:"CREATE TABLE ${ifNotExistStatement}${name}${items}${options};",dropDatabase:"DROP DATABASE IF EXISTS ${name};",createCustomIndex:"CREATE CUSTOM INDEX ${ifNotExistStatement}${name}\n ON ${tableName} (${column})\n USING '${usingStatement}'${optionsStatement};",createIndex:"CREATE INDEX ${ifNotExistStatement}${nameStatement}\n ON ${tableName} (${column});",createSearchIndex:"CREATE SEARCH INDEX ${ifNotExistStatement}ON ${tableName}\n WITH COLUMNS\n${columnsStatement}${profiles}${config}${options};",dropType:"DROP TYPE IF EXISTS ${keyspaceName}.${typeName};",renameColumn:"${alterTablePrefixStatement} RENAME ${oldName} TO ${newName};",addEntity:"${alterTablePrefixStatement} ADD ${name} ${type};",deleteEntity:"${alterTablePrefixStatement} DROP ${name};",addPropertyToUdt:"${alterTypePrefixStatement}.${udtName} ADD ${name} ${type};",createUdt:"CREATE TYPE IF NOT EXISTS ${keySpaceName}.${udtName} (\n${columnScript} \n);",updateUdtType:"${alterTypePrefixStatement}.${udtName}\nALTER ${name} TYPE ${type};",renameType:"${alterTypePrefixStatement}.${udtName} \n RENAME ${oldFieldName} TO ${newFieldName};",updateType:"${alterTablePrefixStatement} \n ALTER ${name} TYPE ${type};",updateTableOptions:"${alterTablePrefixStatement}${optionsStatement};",dropSearchIndexConfig:"ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n DROP ${indexName};",modifySearchIndex:"ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n SET ${key} = ${value};",dropSearchIndex:"DROP SEARCH INDEX ON ${tableNameStatement};",dropIndex:"DROP INDEX IF EXISTS ${tableNameStatement};",dropKeySpace:"DROP KEYSPACE IF EXISTS ${keySpaceName};",createKeySpace:"CREATE KEYSPACE IF NOT EXISTS ${keySpaceName} \n${replication}\n${durableWrites}${udfScript}${udaScript};",alterKeySpaceReplication:"ALTER KEYSPACE ${keySpaceName} \n${replication}\n${durableWrites};",dropView:"DROP MATERIALIZED VIEW IF EXISTS ${viewName};",alterView:"ALTER MATERIALIZED VIEW ${keySpaceViewName}\n${optionScript};"}});var ca=_((Wj,O1)=>{"use strict";var{commentDeactivatedStatement:iD,inlineComment:sD}=oa(),{tab:aa,getTableNameStatement:oD}=ar(),{getNamesByIds:N1}=sa(),{dependencies:nh}=cr(),aD=c((t,e,r,n,i,s,o)=>{let a=oD(n,r),u=i&&s,l=cD(a,e,t.indexes),f=o==="Astra DB"?[]:uD(a,e,u,t.searchIndex);return[...l,...f].map(p=>iD(p.statement,p.isActivated,u)).join(` + +`)},"getIndexes"),cD=c((t,e,r=[])=>hD(r).map(n=>{let i,s=n.isActivated&&R1(n.SecIndxKey,e),o=B1(n.SecIndxKey,e);return n.indexType==="custom"?i=nh.provider.createCustomIndex({name:n.name,tableName:t,column:o,using:n.isSASI?"org.apache.cassandra.index.sasi.SASIIndex":"StorageAttachedIndex",options:pD(n.customOptions,n.isSASI),ifNotExist:n.indexIfNotExist}):i=nh.provider.createIndex({name:n.name,tableName:t,column:o,ifNotExist:n.indexIfNotExist}),{isActivated:s,statement:i}}),"getGeneralIndexes"),uD=c((t,e,r,n)=>{if(!n)return[];let i=[];n.columns&&(i=lD(n.columns.filter(u=>Array.isArray(u.key)&&u.key.length).map(u=>({...u,name:B1(u.key[0],e),isActivated:R1(u.key[0],e)}))));let o=i.filter(u=>u.isActivated).length>0,a=gD({tableName:t,isActivated:o&&r,index:n,columns:i,ifNotExist:n.ifNotExist});return[{isActivated:o,statement:a}]},"getSearchIndexStatement"),lD=c(t=>t.reduce((e,r)=>e.find(i=>i.name===r.name)?e:e.concat(r),[]),"uniqueByName"),B1=c((t,e)=>{let{name:r}=N1([t.keyId],e)[t.keyId]||{};return r?fD(`"${r}"`,t.type):""},"getIndexColumnStatement"),fD=c((t,e)=>e==="keys"?`KEYS(${t})`:e==="values"?`VALUES(${t})`:e==="entries"?`ENTRIES(${t})`:e==="full"?`FULL(${t})`:t,"wrapKey"),R1=c((t,e)=>{let{isActivated:r}=N1([t.keyId],e)[t.keyId]||{};return r!==!1},"isIndexColumnKeyActivated"),hD=c(t=>t.reduce((e,r)=>[...e,...(r.SecIndxKey||[]).map((n,i)=>Object.assign({},r,{name:i>0?r.name+"_"+i:r.name,SecIndxKey:n}))],[]),"unwindIndexes"),dD=c(t=>Object.keys(t).map(e=>`'${e}': '${t[e]}'`),"serializeOptions"),pD=c((t,e)=>{let r={};return!t||(t.case_sensitive&&(r.case_sensitive="true"),t.normalize&&(r.normalize="true"),t.ascii&&!e&&(r.ascii="true"),t.similarity_function&&!e&&(r.similarity_function=`${t.similarity_function}`),!e)||(t.analyzed&&(r.analyzed="true"),t.isLiteral&&(r.is_literal="true"),t.tokenizationEnableStemming&&(r.tokenization_enable_stemming="true"),t.tokenizationNormalizeLowercase&&(r.tokenization_normalize_lowercase="true"),t.tokenizationNormalizeUppercase&&(r.tokenization_normalize_uppercase="true"),t.normalizeLowercase&&(r.normalize_lowercase="true"),t.normalizeUppercase&&(r.normalize_uppercase="true"),t.tokenizationLocale&&(r.tokenization_locale=`${t.tokenizationLocale}`),t.tokenizationSkipStopWords&&(r.tokenization_skip_stop_words=`${t.tokenizationSkipStopWords}`),t.mode&&(r.mode=`${t.mode}`),t.analyzerClass&&(r.analyzer_class=`${t.analyzerClass}`),t.maxCompactionFlushMemoryInMb&&(r.max_compaction_flush_memory_in_mb=`${t.maxCompactionFlushMemoryInMb}`)),r},"getCustomOptions"),gD=c(({tableName:t,columns:e,index:r,isActivated:n,ifNotExist:i})=>{let s=mD(yD(e),n),o=r.profiles.length?` +${aa(`AND PROFILES ${r.profiles.join(", ")}`)}`:"",a=vD(r.config),u=a?` +${aa(`AND CONFIG ${a}`)}`:"",l=ED(r.options),f=l?` +${aa(`AND OPTIONS ${l}`)}`:"";return nh.provider.createSearchIndex({ifNotExist:i,tableName:t,columnsStatement:aa(s,2),profiles:o,config:u,options:f})},"getSearchIndex"),yD=c(t=>t.map(e=>{let r=[];return e.copyField&&r.push("copyField: true"),e.docValues&&r.push("docValues: true"),e.excluded&&r.push("excluded: true"),e.indexed||r.push("indexed: false"),e.lowerCase&&r.push("lowerCase: true"),{statement:`${e.name}${r.length?` {${r.join(", ")}}`:""}`,isActivated:e.isActivated}}),"getSearchIndexColumns"),mD=c((t,e)=>{let r=e?t.filter(o=>!o.isActivated):[],n=e?t.filter(o=>o.isActivated):t,i=r.length?r.map(({statement:o})=>o).join(`, +`).split(` +`).map(sD).join(` +`):"",s=n.map(({statement:o})=>o).join(`, +`);return i&&s?i+`, +`+s:i||s},"getSearchIndexColumnStatements"),vD=c((t={})=>{let e=[];return t.autoCommitTime&&t.autoCommitTime!==1e4&&e.push(`autoCommitTime: ${t.autoCommitTime}`),t.defaultQueryField&&e.push(`defaultQueryField: '${t.defaultQueryField}'`),t.directoryFactory&&e.push(`directoryFactory: '${t.directoryFactory}'`),t.filterCacheLowWaterMark&&t.filterCacheLowWaterMark!==1024&&e.push(`filterCacheLowWaterMark: ${t.filterCacheLowWaterMark}`),t.filterCacheHighWaterMark&&t.filterCacheHighWaterMark!==2048&&e.push(`filterCacheHighWaterMark: ${t.filterCacheHighWaterMark}`),t.directoryFactoryClass&&e.push(`directoryFactoryClass: '${t.directoryFactoryClass}'`),t.mergeMaxThreadCount&&t.mergeMaxMergeCount&&(e.push(`mergeMaxThreadCount: ${t.mergeMaxThreadCount}`),e.push(`mergeMaxMergeCount: ${t.mergeMaxMergeCount}`)),t.ramBufferSize&&t.ramBufferSize!==512&&e.push(`ramBufferSize: ${t.ramBufferSize}`),t.realtime&&e.push("realtime: true"),e.length?`{ +${aa(e.join(`, +`))} +}`:""},"getSearchIndexConfig"),ED=c((t={})=>{let e=[];return t.recovery&&e.push("recovery: true"),t.reindex||e.push("reindex: false"),t.lenient&&e.push("lenient: true"),e.length?`{${e.join(", ")}}`:""},"getSearchIndexOptions");O1.exports={getIndexes:aD,serializeOptions:dD}});var P1=_((Yj,D1)=>{"use strict";var SD=Object.freeze({ADD:"ADD",AGGREGATE:"AGGREGATE",ALLOW:"ALLOW",ALTER:"ALTER",AND:"AND",ANY:"ANY",APPLY:"APPLY",ASC:"ASC",AUTHORIZE:"AUTHORIZE",BATCH:"BATCH",BEGIN:"BEGIN",BY:"BY",COLUMNFAMILY:"COLUMNFAMILY",CREATE:"CREATE",DELETE:"DELETE",DESC:"DESC",DROP:"DROP",EACH_QUORUM:"EACH_QUORUM",ENTRIES:"ENTRIES",FROM:"FROM",FULL:"FULL",GRANT:"GRANT",IF:"IF",IN:"IN",INDEX:"INDEX",INET:"INET",INFINITY:"INFINITY",INSERT:"INSERT",INTO:"INTO",KEYSPACE:"KEYSPACE",KEYSPACES:"KEYSPACES",LIMIT:"LIMIT",LOCAL_ONE:"LOCAL_ONE",LOCAL_QUORUM:"LOCAL_QUORUM",MATERIALIZED:"MATERIALIZED",MODIFY:"MODIFY",NAN:"NAN",NORECURSIVE:"NORECURSIVE",NOT:"NOT",OF:"OF",ON:"ON",ONE:"ONE",ORDER:"ORDER",PARTITION:"PARTITION",PASSWORD:"PASSWORD",PER:"PER",PRIMARY:"PRIMARY",QUORUM:"QUORUM",RENAME:"RENAME",REVOKE:"REVOKE",SCHEMA:"SCHEMA",SELECT:"SELECT",SET:"SET",TABLE:"TABLE",TIME:"TIME",THREE:"THREE",TO:"TO",TOKEN:"TOKEN",TRUNCATE:"TRUNCATE",TWO:"TWO",UNLOGGED:"UNLOGGED",UPDATE:"UPDATE",USE:"USE",USING:"USING",VIEW:"VIEW",WHERE:"WHERE",WITH:"WITH"}),CD=Object.values(SD);D1.exports={ReservedWordsAsArray:CD}});var Mc=_((Zj,k1)=>{"use strict";var{dependencies:L1}=cr(),{ReservedWordsAsArray:wD}=P1(),xD=c((t,e)=>[...t,...e],"mergeArrays"),TD={blob:["ascii","bigint","boolean","decimal","double","float","inet","int","timestamp","timeuuid","uuid","varchar","varint"],varint:["int"],varchar:["text"],uuid:["timeuuid"],text:["varchar"]},_D=c(t=>{let e=t.filter(n=>n.dbVersion)[0].dbVersion,r=e.search(/\d/);if(r!==-1)return e[r]<3},"checkIsOldModel"),bD=c((t,e)=>{let r=TD[e];return!(!r||!r.filter(i=>i===t).length)},"fieldTypeCompatible"),ID=c(t=>/\s|\W/.test(t)||L1.lodash.includes(wD,L1.lodash.toUpper(t))?`"${t}"`:t,"wrapInQuotes");k1.exports={mergeArrays:xD,checkIsOldModel:_D,fieldTypeCompatible:bD,wrapInQuotes:ID}});var Ji=_((Jj,F1)=>{"use strict";var oh=class oh{script;isDropScript;isModifyScript;isAddScript};c(oh,"ModificationScript");var ih=oh,ah=class ah{isActivated;scripts;static getInstances(e,r,n,i){return(e||[]).filter(Boolean).map(s=>this.getInstance([s],r,n,i))}static getInstance(e,r,n,i){var o;if(!((o=e==null?void 0:e.filter(Boolean))!=null&&o.length))return;let s={deletion:!1,add:!1,modify:!1};if(s[n]===void 0)throw new Error(`Unsupported scriptPurpose provided: ${n}`);return s[n]=!0,{isActivated:r,scripts:e.filter(Boolean).map(a=>({isDropScript:s.deletion,script:a,isModifyScript:s.modify,isAddScript:s.add,modelLevel:i}))}}};c(ah,"AlterScriptDto");var sh=ah;F1.exports={ModificationScript:ih,AlterScriptDto:sh}});var fh=_((tz,$1)=>{"use strict";var{getTypeByData:q1}=na(),{getNamesByIds:ch}=sa(),{dependencies:br}=cr(),{eachField:AD,getTableNameStatement:K1}=ar(),{getTableStatement:ND}=Ws(),{AlterScriptDto:Kc}=Ji(),yi={modifiedColumn:[],addTable:[],deleteTable:[]},BD=c(t=>Hc(t)?[]:[Kc.getInstance([br.provider.addEntity(t)],!0,"add","field")],"getAdd"),RD=c(t=>Hc(t)?[]:[Kc.getInstance([br.provider.deleteEntity(t)],!0,"deletion","field")],"getDelete"),H1=c(t=>{let{tableName:e,keyspaceName:r,columnData:n}=t,i=K1(r,e);return n!=null&&n.name?`${i}.${n==null?void 0:n.name}`:i},"generateFullName"),lh=c((t={},e="modifiedColumn")=>{let r=H1(t);yi={...yi,[e]:[...(yi==null?void 0:yi[e])||[],r]}},"addScriptToExistScripts"),Hc=c((t={},e="modifiedColumn")=>{let r=H1(t);return((yi==null?void 0:yi[e])||[]).some(n=>n===r)},"isScriptExists"),OD=c((t,e)=>{let r=c(i=>!i.hasOwnProperty("properties")||!Array.isArray(i.properties)?i:{...i,properties:i.properties.reduce((s,o)=>({...s,[o.name]:r(o)}),{})},"propertiesFromArrayToObj"),n=r(t);return AD(n,i=>{if((i==null?void 0:i.type)!=="reference"||br.lodash.isEmpty(i.refIdPath))return i;let s=ch([br.lodash.last(i.refIdPath)],e)[br.lodash.last(i.refIdPath)]||{};return{...i,...s}})},"prepareField"),DD=c(({tableName:t,keyspaceName:e,isOldModel:r,property:n,udtMap:i,dataSources:s})=>{let{oldField:o={},newField:a={}}=(n==null?void 0:n.compMod)||{},u=OD(o,s),l=q1(n,i,a.name),f=q1(u,i,o.name);return{property:n,isOldModel:r,oldName:o.name,newName:a.name,newType:l,oldType:f,isNameChange:o.name!==a.name,isTypeChange:l!==f,dataForScript:{tableName:t,keyspaceName:e,columnData:{name:a.name,type:l}}}},"hydrateColumn"),uh=c((t,e)=>{var n,i,s;let r=(i=(n=t==null?void 0:t.role)==null?void 0:n.compMod)==null?void 0:i[e];return(r==null?void 0:r.new)||((s=t==null?void 0:t.role)==null?void 0:s[e])},"getTableParameter"),U1=c((t,e)=>Object.entries(t).reduce((r,[n,i])=>{let s=(e.find(o=>o.keyId===n)||{}).type;return{...r,[n]:{...br.lodash.omit(i,"type"),...s?{type:s}:{}}}},{}),"addToKeysHashType"),V1=c((t,e)=>br.lodash.omitBy(t,(r,n)=>r===!1&&!e[n]),"deleteFalseValuesIfNotPresentInOtherColumn"),PD=c((t,e)=>{let r=V1(t,e),n=V1(e,t);return br.lodash.isEqual(r,n)},"areTableKeyColumnsEqual"),M1=c(({newKeys:t=[],oldKeys:e=[],dataSources:r})=>{if(t.length!==e.length)return!1;let n=U1(ch(t.map(o=>o.keyId),r),t),i=U1(ch(e.map(o=>o.keyId),r),e),s=br.lodash.differenceWith(br.lodash.values(n),br.lodash.values(i),PD);return br.lodash.isEmpty(s)},"tableKeysIsEqual"),LD=c(({item:t,dataSources:e})=>{var u;let r=((u=t==null?void 0:t.role)==null?void 0:u.compMod)||{},n=["name","isActivated"],{compositeClusteringKey:i={},compositePartitionKey:s={}}=r||{},o=M1({newKeys:i.new,oldKeys:i.old,dataSources:e}),a=M1({newKeys:s.new,oldKeys:s.old,dataSources:e});return!o||!a||n.some(l=>{var f,h;return!br.lodash.isEqual((f=r[l])==null?void 0:f.new,(h=r[l])==null?void 0:h.old)})},"isTableChange"),kD=c(t=>{if(Hc(t,"deleteTable"))return[];let e=K1(t.keyspaceName,t.tableName);return lh(t,"deleteTable"),[Kc.getInstance([br.provider.dropTable(e)],!0,"deletion","table")]},"getDeleteTableDto"),FD=c(t=>{if(Hc(t,"addTable"))return[];let e=t.item,r=t.data,n=uh(e,"compositePartitionKey")||[],i=uh(e,"compositeClusteringKey")||[],s=[{compositePartitionKey:n,compositeClusteringKey:i,collectionName:t.tableName,tableOptions:e.role.tableOptions||"",comments:e.role.comments||"",isActivated:e.role.isActivated}],o=ND({tableData:e,tableMetaData:s,keyspaceMetaData:[{name:t.keyspaceName}],dataSources:t.dataSources,udtTypeMap:r.udtTypeMap||{},isKeyspaceActivated:t.isKeyspaceActivated});return lh(t,"addTable"),[Kc.getInstance([o],!0,"add","table")]},"getAddTable");$1.exports={getDelete:RD,getAdd:BD,hydrateColumn:DD,isTableChange:LD,getTableParameter:uh,addScriptToExistScripts:lh,getDeleteTableDto:kD,getAddTable:FD}});var ph=_((nz,j1)=>{"use strict";var{dependencies:pn}=cr(),{getColumnDefinition:qD}=Vc(),{eachField:UD}=ar(),{getTypeByData:hh}=na(),{checkIsOldModel:VD,fieldTypeCompatible:MD}=Mc(),{getDelete:KD}=fh(),{AlterScriptDto:ua}=Ji(),HD={Default_Keyspace:[]},$D={added:!1,deleted:!1,modified:!1,udt:"udt"},GD=c(t=>`ALTER TYPE "${t}"`,"getAlterTypePrefix"),jD=c(t=>[ua.getInstance([pn.provider.dropType({keyspaceName:t.keyspaceName,typeName:t.typeName})],!0,"deletion","udt")],"getDropUDT"),zD=c(t=>{let{keySpaces:e,udtName:r,name:n,type:i}=t;return Object.keys(e).map(s=>ua.getInstance([pn.provider.addPropertyToUdt({keySpaceName:s,udtName:r,name:n,type:i})],!0,"add","udt"))},"getAddToUDT"),dh=c(t=>{var r;let e=(r=t.compMod)==null?void 0:r.bucketsWithCurrentDefinition;return pn.lodash.isEmpty(e)?HD:e},"getKeySpaces"),WD=c((t,e)=>{let{role:r={},compMod:n={},properties:i={}}=t,s=dh(r);if(n.created){let o=qD(i,e);return Object.keys(s).map(a=>{let u=r.code||r.name||"";return ua.getInstance([pn.provider.createUdt({keySpaceName:a,udtName:u,columnScript:o})],!0,"add","udt")})}return Object.entries(i).reduce((o,[a,u])=>[...o,...zD({type:hh(u,e),name:a,keySpaces:s,udtName:r.code||r.name||""})],[])},"getAddScript"),G1=c((t,e)=>t.type!=="reference"||t.$ref||!e.$ref?t:{...t,$ref:e.$ref},"prepareField"),QD=c((t,e,r)=>{let{role:n={},properties:i}=t;if(!i)return[];let s=dh(n),o=n.code||n.name;return Object.entries(i).reduce((a,[u,l])=>{let f=pn.lodash.get(l,"compMod.oldField.name"),h=pn.lodash.get(l,"compMod.newField.name"),{compMod:p={}}=l,g=hh(G1(p.oldField,l),r,"newField"),d=hh(G1(p.newField,l),r,"oldField"),y=VD(pn.lodash.get(e,"modelData")),v=Object.keys(s).reduce((m,w)=>{if(d&&g&&d!==g&&MD(g,d)&&y){let A=pn.provider.updateUdtType({keySpaceName:w,udtName:o,columnData:{name:u,type:d}});m=[...m,ua.getInstance([A],!0,"modify","udt")]}if(h&&f&&f!==h){let A=pn.provider.renameType({keySpaceName:w,oldFieldName:f,newFieldName:h,udtName:o});m=[...m,ua.getInstance([A],!0,"modify","udt")]}return m},[]);return[...a,...v]},[])},"getUpdateScript"),YD=c(t=>{let{properties:e,compMod:r={},role:n={}}=t;if(!(r!=null&&r.deleted)||!e)return[$D];let i=dh(n),s=n.code||n.name||"";return Object.entries(i).reduce((o,[a,u])=>{let l=u.reduce((f,h)=>{let p=KD({tableName:h.collectionName||h.code,keyspaceName:a,columnData:{name:s}}),g=jD({keyspaceName:a,typeName:s});return[...f,...p,...g]},[]);return[...o,...l]},[])},"getDeleteScript"),ZD=c(({child:t,mode:e,data:r,udtMap:n})=>e==="add"?WD(t,n):e==="update"?QD(t,r,n):YD(t),"getUdtScript"),XD=c(t=>{var a;let e=(a=t.properties.added)==null?void 0:a.items;if(!e||!Array.isArray(e))return t;let r=e.filter(u=>{var f;return(f=u.properties[Object.keys(u.properties)[0]].compMod)==null?void 0:f.created}),n=pn.lodash.xorWith(e,r,pn.lodash.isEqual);r=r.map(u=>[Object.keys(u.properties)[0],u]);let i=r.map(([u,l])=>u),s=[];r.forEach(([u,l])=>{let f=new Set,h=l.properties[u];UD(h||{},g=>{if(g.$ref){let d=g.$ref.split("/").pop();f.add(d)}});let p=Array.from(f).filter(g=>i.includes(g)&&!s.includes(g));if(s.push(...p),!p.length){let g=s.indexOf(u);g===-1?s.unshift(u):s.unshift(...s.splice(g,1))}});let o=i.filter(u=>!s.includes(u));return r=Object.fromEntries(r),r=[...s,...o].map(u=>r[u]).filter(Boolean),t.properties.added.items=[...r,...n],t},"sortAddedUdt");j1.exports={getUdtScript:ZD,sortAddedUdt:XD,getAlterTypePrefix:GD}});var Q1=_((sz,W1)=>{"use strict";var{dependencies:es}=cr(),JD="caching",eP="compaction",tP="compression",rP="id",nP=[rP],la={localReadRepairChance:0,caching:{keys:"ALL",rows_per_partition:"NONE"},compaction:"{'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}",compression:"{'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}",readRepairChance:0,gcGraceSeconds:864e3,bloomFilterFalsePositiveChance:.01,defaultTtl:0,speculativeRetry:"99PERCENTILE",minIndexInterval:128,maxIndexInterval:2048,crcCheckChance:1,memtableFlushPeriod:0},z1=c((t,e,r)=>{switch(r){case tP:case eP:return iP(t,e);case JD:return sP(t,e);default:return t!==e}},"isDiff"),iP=c((t,e)=>{if(t===""||e==="")return t!==e;let r=JSON.parse(t.replace(/[\'']/g,'"')),n=JSON.parse(e.replace(/[\'']/g,'"'));return!es.lodash.isEqual(r,n)},"isDiffParsedJsonString"),sP=c((t,e)=>{let r=c(s=>{let o=es.lodash.get(s,"rowsPerPartition");return o?{...es.lodash.omit(s,"rowsPerPartition"),rows_per_partition:o}:s},"updateKeys"),n=Object.assign({},r(t),{id:null}),i=Object.assign({},r(e),{id:null});return!es.lodash.isEqual(n,i)},"isDiffCaching"),oP=c((t,e)=>(e=es.lodash.isEmpty(e)?la:e,Object.entries(t).reduce((r,[n,i])=>nP.includes(n)?r:!e.hasOwnProperty(n)||z1(e[n],i,n)?Object.assign({},r,{[n]:i}):r,{})),"getModifiedAndNewOptions"),aP=c((t,e)=>(t=es.lodash.isEmpty(t)?la:t,Object.keys(e).filter(r=>!t.hasOwnProperty(r))),"getDeletedOptions"),cP=c((t,e)=>t.reduce((r,n)=>la.hasOwnProperty(n)&&z1(es.lodash.get(e,n),la[n],n)?Object.assign({},r,{[n]:la[n]}):r,{}),"getDefaultOptionsByName");W1.exports={getDiff(t,e){let r=oP(t,e),n=aP(t,e);return Object.assign({},r,cP(n,e))}}});var $c=_((az,rS)=>{"use strict";var{dependencies:bt}=cr(),{commentDeactivatedStatement:mh}=oa(),{retrieveContainerName:uP,retrieveEntityName:lP,retrivePropertyFromConfig:fa,retrieveIsItemActivated:Y1}=ar(),{getOptions:fP,getPrimaryKeyList:hP}=Ws(),Z1=c(t=>t.name,"columnsToName"),dP=c((t=[],e)=>{let[r,n]=bt.lodash.partition(t,s=>bt.lodash.get(s,"isActivated",!0));n=n.map(Z1).join(", "),r=r.map(Z1).join(", ");let i=c(s=>mh(s,!1,e,"INLINE"),"getDeactivatedStatement");if(n.length){if(!r.length)return i(n)}else return r;return r+" "+i(", "+n)},"joinColumns"),pP=c((t,e,r={})=>{let n=t[e];return Object.values(r).find(i=>i.GUID===(n==null?void 0:n.definitionId))||{}},"getColumn"),gP=c((t,e)=>bt.lodash.uniqBy(Object.keys(e).map(r=>{let n=bt.lodash.get(e,[r,"GUID"]),i=Object.keys(t).find(u=>t[u].definitionId===n),s=t[i],o=`"${bt.lodash.get(s,"name",r)}"`,a=bt.lodash.get(e[r],"isActivated");return{name:o,isActivated:a}}),"name").filter(bt.lodash.identity),"getColumnNames"),yP=c((t,e)=>Object.keys(e).reduce((r,n)=>{let i=bt.lodash.get(e,[n,"GUID"]),s=Object.keys(t).find(a=>t[a].definitionId===i),o=t[s];return{...r,[bt.lodash.get(o,"name",n)]:e[n]}},{}),"getViewColumns"),X1=c((t=[],e)=>{let[r,n]=bt.lodash.partition(t,u=>bt.lodash.get(u,"isActivated",!0));if(bt.lodash.isEmpty(t)||n.length===t.length)return"";let i=c(u=>`AND ${u} IS NOT NULL`,"generateNewStatement"),s=n.map(u=>i(u.name)).join(" "),o=mh(s,!1,e,"INLINE");return`WHERE ${[...r].reduce((u,l)=>u?`${u} ${i(l.name)}`:`${l.name} IS NOT NULL`,"")}${s?" "+o:""}`},"getWhereStatement"),vh=c((t,e,r={})=>e.reduce((n,i)=>{let s=bt.lodash.get(t,[i,"name"]),a=pP(t,i,r).isActivated;return s?Object.assign({},n,{[i]:{name:s,isActivated:a}}):n},{}),"getNamesByIds"),J1=c((t,e,r)=>{let n=fa(e,0,"compositeClusteringKey",[]),i=vh(t,n.map(s=>s.keyId),r);return{clusteringKeys:n,clusteringKeysHash:i}},"getClusteringKeyData"),eS=c((t,e,r)=>[...gh({collectionRefsDefinitionsMap:t,viewData:e,key:"compositePartitionKey",columns:r}),...gh({collectionRefsDefinitionsMap:t,viewData:e,key:"compositeClusteringKey",columns:r})],"getPrimaryKeys"),gh=c(({collectionRefsDefinitionsMap:t,viewData:e,key:r,columns:n})=>{let i=fa(e,0,r,[]),s=vh(t,i.map(o=>o.keyId),n);return bt.lodash.values(s).filter(bt.lodash.identity).map(o=>({...o,name:`"${o.name}"`}))},"getCompositeKeys"),tS=c(({collectionRefsDefinitionsMap:t,viewData:e,isParentActivated:r,columns:n})=>{let i=fa(e,0,"compositePartitionKey",[]),s=vh(t,i.map(u=>u.keyId),n),o=J1(t,e,n),a=hP(s,o.clusteringKeysHash,r);return a?`PRIMARY KEY (${a})`:""},"getPrimaryKeyScript"),mP=c(t=>bt.lodash.trim(t||"").replace(/ /g," "),"addTab"),yh=c(({collectionRefsDefinitionsMap:t,viewData:e,columns:r,isParentActivated:n})=>{let i=J1(t,e,r),s=fa(e,0,"comments",""),o=fa(e,0,"tableOptions","");return mP(fP(i.clusteringKeys,i.clusteringKeysHash,"",o,s,n))},"getOptionsScript"),vP=c(({viewData:t,entitySchema:e,entityData:r,entityName:n,isParentActivated:i,collectionRefsDefinitionsMap:s,columns:o})=>{let a=[],u=(e==null?void 0:e.properties)||{},l=Object.keys(u).reduce((p,g)=>{let d=e.properties[g];return{...p,[d.GUID]:d}},{}),f=tS({entityFieldsMap:l,entityData:r,isParentActivated:i,columns:o}),h=yh({collectionRefsDefinitionsMap:{},viewData:t,columns:o,isParentActivated:i});return a.push(`AS SELECT * FROM ${n}`),a.push(X1(eS(s,r,o),i)),f&&a.push(f),h&&a.push(h),a},"getEmptyViewScript");rS.exports={getOptionsScript:yh,getViewScript({schema:t,entitySchema:e,viewData:r,entityData:n,containerData:i,collectionRefsDefinitionsMap:s,isKeyspaceActivated:o=!0,ifNotExist:a=!1}){let u=[],l=yP(s,t.properties||{}),f=bt.lodash.first(r)||{},h=lP(n),p=uP(i),g=p?`"${p}"."${h}"`:`"${h}"`,d=f.code||f.name,y=p?`"${p}"."${d}"`:`"${d}"`,v=Y1(n)&&Y1(r),m=o&&v,w=tS({collectionRefsDefinitionsMap:s,viewData:r,isParentActivated:m,columns:l}),x=yh({collectionRefsDefinitionsMap:s,viewData:r,columns:l,isParentActivated:m});if(u.push(`CREATE MATERIALIZED VIEW ${a?"IF NOT EXISTS ":""}${y}`),bt.lodash.isEmpty(l))u=u.concat(vP({viewData:r,entitySchema:e,entityData:n,entityName:g,isParentActivated:m,collectionRefsDefinitionsMap:s,columns:l}));else{let A=gP(s,l),O=dP(A,m);u.push(`AS SELECT ${O}`),u.push(`FROM ${g}`),u.push(X1(bt.lodash.uniq([...eS(s,r,l),...gh({collectionRefsDefinitionsMap:s,viewData:r,key:"whereClause",columns:l})]),m)),w&&u.push(w),x&&u.push(x)}return mh(u.join(` + `)+";",v,o)}}});var Eh=_((uz,sS)=>{"use strict";var{getViewScript:EP}=$c(),{dependencies:da}=cr(),{AlterScriptDto:ha}=Ji(),SP=c((t,e)=>`${t?`"${t}".`:""}"${e}"`,"getViewName"),CP=["code","name"],wP=c(t=>{let e=CP.some(s=>{let{new:o,old:a}=t[s]||{};return!da.lodash.isEqual(o,a)}),{tableOptions:r={},comments:n={}}=t;if(n.old&&!n.new)return!1;let i=Object.entries(r.old||{}).some(([s])=>{var o;return!((o=r.new)!=null&&o[s])});return!e&&!i},"getIsOnlyOptionsModify"),nS=c((t,e)=>{if(!e||!da.lodash.isEqual(t,e))return t;if(!t)return e},"getProperty"),xP=c((t={},e={})=>{let r=nS(e.new,e.old),{new:n={},old:i={}}=t,s=Object.entries(n).map(([o,a])=>[o,nS(a,i[o])]).filter(([o,a])=>a);return{comments:r,tableOptions:Object.fromEntries(s)}},"getDifferentOptions"),iS=c(t=>{var s,o;let{compMod:e,properties:r={}}=t.role,n=Object.entries(r).map(([a,u])=>[u.code||u.name||u.displayName||a,u]),i={containerData:[{name:e.keyspaceName}],schema:{properties:Object.fromEntries(n)},viewData:[t.role],ifNotExist:!0,collectionRefsDefinitionsMap:((s=e.collectionData)==null?void 0:s.collectionRefsDefinitionsMap)||{},entityData:((o=e.collectionData)==null?void 0:o.entityData)||[{}]};return EP(i)},"getAddView"),TP=c(t=>{var o,a,u;let e=((o=t.role)==null?void 0:o.compMod)||{};if(!wP(e)){let l=((a=e.code)==null?void 0:a.old)||((u=e.name)==null?void 0:u.old),f=da.provider.dropView({...t,role:{...t.role,code:l}}),h=iS(t);return[ha.getInstance([f],!0,"deletion","view"),ha.getInstance([h],!0,"add","view")]}let{comments:n,tableOptions:i}=xP(e.tableOptions,e.comments),s={...t.role,comments:n,tableOptions:i};return[ha.getInstance([da.provider.alterView(s)],!0,"modify","view")]},"getModifyView"),_P=c(({child:t,mode:e})=>e==="add"?[ha.getInstance([iS(t)],!0,"add","view")]:e==="delete"?[ha.getInstance([da.provider.dropView(t)],!0,"deletion","view")]:TP(t),"getViewScript");sS.exports={getViewScript:_P,getViewName:SP}});var uS=_((fz,cS)=>{"use strict";var rt=A1(),{tab:Nn,getTableNameStatement:Gc,getUserDefinedFunctions:bP,getUserDefinedAggregations:IP}=ar(),{serializeOptions:AP}=ca(),{getAlterTypePrefix:Sh}=ph(),{getDiff:NP}=Q1(),{mergeValuesWithConfigOptions:BP}=Ws(),{parseToString:oS}=Ch(),{getViewName:aS}=Eh(),{getOptionsScript:RP}=$c(),{wrapInQuotes:yt}=Mc(),pa=c((t,e)=>e?`ALTER TABLE ${yt(e)}.${yt(t)}`:`ALTER TABLE ${yt(t)}`,"alterTablePrefix");cS.exports=t=>{let{assignTemplates:e}=t.require("@hackolade/ddl-fe-utils");return{dropTable(r){return e(rt.dropTable,{name:r})},createTable(r){if(!r.databaseName)return"";let{ifNotExist:n,databaseName:i,items:s,options:o}=r,a=n?"IF NOT EXISTS ":"";return e(rt.createTable,{ifNotExistStatement:a,name:i,items:` ( +`+s.map(u=>Nn(u)).join(`, +`)+` +)`,options:`${o}`})},dropDatabase(r){return r?e(rt.dropDatabase,{name:r}):""},createCustomIndex(r){if(!r.tableName)return"";let{name:n,tableName:i,column:s,using:o,options:a,ifNotExist:u}=r,l=u?"IF NOT EXISTS ":"",f=o||"StorageAttachedIndex",h=Object.keys(a).length?` +`+Nn(`WITH OPTIONS = { +${Nn(AP(a).join(`, +`))} +}`):"";return e(rt.createCustomIndex,{ifNotExistStatement:l,name:`"${n}"`,tableName:i,column:s,usingStatement:f,optionsStatement:h})},createIndex(r){let{name:n,tableName:i,column:s,ifNotExist:o}=r,a=n?`"${n}"`:"",u=o?"IF NOT EXISTS ":"";return e(rt.createIndex,{ifNotExistStatement:u,nameStatement:a,tableName:i,column:s})},createSearchIndex(r){let{ifNotExist:n,tableName:i,columnsStatement:s,profiles:o,config:a,options:u}=r,l=n?"IF NOT EXISTS ":"";return e(rt.createSearchIndex,{ifNotExistStatement:l,tableName:i,columnsStatement:s,profiles:o,config:a,options:u})},dropType(r){let{keyspaceName:n,typeName:i}=r;return e(rt.dropType,{keyspaceName:yt(n),typeName:yt(i)})},renameColumn(r){let{tableName:n,keyspaceName:i,columnData:s}=r,o=pa(n,i);return e(rt.renameColumn,{alterTablePrefixStatement:o,oldName:yt(s.oldName),newName:yt(s.newName)})},addEntity(r){let{tableName:n,keyspaceName:i,columnData:s}=r,o=pa(n,i);return e(rt.addEntity,{alterTablePrefixStatement:o,name:yt(s.name),type:s.type})},deleteEntity(r){let{tableName:n,keyspaceName:i,columnData:s}=r,o=pa(n,i);return e(rt.deleteEntity,{alterTablePrefixStatement:o,name:yt(s.name)})},addPropertyToUdt(r){let{keySpaceName:n,udtName:i,type:s}=r,o=Sh(n);return e(rt.addPropertyToUdt,{alterTypePrefixStatement:o,udtName:yt(i),name:yt(i),type:s})},createUdt(r){let{keySpaceName:n,udtName:i,columnScript:s}=r;return e(rt.createUdt,{keySpaceName:yt(n),udtName:yt(i),columnScript:Nn(s)})},updateUdtType(r){let{keySpaceName:n,udtName:i,columnData:s}=r,o=Sh(n);return e(rt.updateUdtType,{alterTypePrefixStatement:o,udtName:yt(i),name:yt(s.name),type:s.type})},renameType(r){let{keySpaceName:n,udtName:i,oldFieldName:s,newFieldName:o}=r,a=Sh(n);return e(rt.renameType,{alterTypePrefixStatement:a,udtName:yt(i),oldFieldName:yt(s),newFieldName:yt(o)})},updateType(r){let{tableName:n,keyspaceName:i,columnData:s}=r,o=pa(n,i);return e(rt.updateType,{alterTablePrefixStatement:o,name:yt(s.name),type:s.type})},updateTableOptions(r,n,i){if(!i||!r)return"";let{keyspaceName:s,tableOptions:o={},comments:a}=r,u=c(g=>(g==null?void 0:g.new)&&g.new!==g.old,"isCommentNew"),l=pa(n,s),f=NP(o.new||{},o.old||{}),h=BP(f),p=u(a)?oS(h,a.new):oS(h);return p?e(rt.updateTableOptions,{alterTablePrefixStatement:l,optionsStatement:Nn(p)}):""},dropSearchIndexConfig(r,n,i){let s=Gc(r,n);return e(rt.dropSearchIndexConfig,{tableNameStatement:s,indexName:i})},modifySearchIndex(r,n,i,s){let o=Gc(r,n);return e(rt.modifySearchIndex,{tableNameStatement:o,key:i,value:s})},dropSearchIndex(r,n){let i=Gc(r,n);return e(rt.dropSearchIndex,{tableNameStatement:i})},dropIndex(r,n){let i=Gc(r,n);return e(rt.dropIndex,{tableNameStatement:i})},dropKeySpace(r){return e(rt.dropKeySpace,{keySpaceName:yt(r)})},createKeySpace(r,n,i,s,o){let a=bP(s),u=IP(o);return e(rt.createKeySpace,{keySpaceName:yt(r),replication:Nn(n),durableWrites:Nn(i),udfScript:a,udaScript:u})},alterKeySpaceReplication(r,n,i){return e(rt.alterKeySpaceReplication,{keySpaceName:yt(r),replication:Nn(n),durableWrites:Nn(i,2)})},dropView(r){let{compMod:n,name:i,code:s}=r.role,o=aS(n.keyspaceName,s||i);return e(rt.dropView,{viewName:o})},alterView(r){var a;let n=[r],i=RP({collectionRefsDefinitionsMap:((a=r.compMod.collectionData)==null?void 0:a.collectionRefsDefinitionsMap)||{},viewData:n}),s=r.name||r.code,o=r.compMod.keyspaceName;if(i){let u=aS(o,s);return e(rt.alterView,{keySpaceViewName:u,optionScript:Nn(i)})}return""}}}});var cr=_((dz,lS)=>{"use strict";var wh={},OP=c(t=>{wh.lodash=t.require("lodash"),wh.provider=uS()(t)},"setDependencies");lS.exports={setDependencies:OP,dependencies:wh}});var Ch=_((gz,mS)=>{"use strict";var{inlineComment:fS}=oa(),{dependencies:hS}=cr(),DP="numeric",PP="text",LP="details",kP="checkbox",pS="otherProperties",gS="caching",FP=[gS,pS],jc=c(t=>t===""?` +WITH`:" AND","getStringStart"),yS=c(t=>String(t||"").replace(/[\"\`]/g,"'"),"changeQuotes"),dS={localReadRepairChance:"dclocal_read_repair_chance",readRepairChance:"read_repair_chance",gcGraceSeconds:"gc_grace_seconds",bloomFilterFalsePositiveChance:"bloom_filter_fp_chance",defaultTtl:"default_time_to_live",speculativeRetry:"speculative_retry",minIndexInterval:"min_index_interval",maxIndexInterval:"max_index_interval",crcCheckChance:"crc_check_chance",memtableFlushPeriod:"memtable_flush_period_in_ms"},xh=c(t=>dS.hasOwnProperty(t)?dS[t]:t,"convertKeywordToTableOptionName"),qP=c(t=>FP.includes(t.propertyKeyword)?UP(t):VP(t),"transformOption"),UP=c(t=>{switch(t.propertyKeyword){case gS:return jP(t);case pS:return $P(t);default:return null}},"transformSpecialOption"),VP=c(t=>{switch(t.propertyType){case PP:return MP(t);case kP:return GP(t);case DP:return KP(t);case LP:return HP(t);default:return null}},"transformOptionByPropertyType"),MP=c(t=>`${xh(t.propertyKeyword)} = '${t.value}'`,"transformTextOption"),KP=c(t=>`${xh(t.propertyKeyword)} = ${t.value}`,"transformNumericOption"),HP=c(t=>{let n=c(i=>typeof i=="object"?JSON.stringify(t.value):i,"getStringValue")(t.value).replace(/\n/g,"");return`${xh(t.propertyKeyword)} = ${yS(n)}`},"transformDetailsOptions"),$P=c(t=>t.value.reduce((r,n)=>{let{name:i,value:s}=n;if(!i||!s)return r;let o=r===""?"":" AND";return r.concat(`${o} ${i} = '${s}' +`)},"").replace(/\n$/,""),"transformOtherOptions"),GP=c(t=>{let e=t.propertyKeyword;return t.value?e==="cdc"?"cdc = TRUE":e==="compactStorage"?"COMPACT STORAGE":null:null},"transformBooleanOption"),jP=c(t=>{let e=c(u=>i.includes(u)?u:null,"validateKeys"),r=c(u=>i.includes(u)?u:isNaN(u)?null:Number(u),"validateRows"),n=c((u,l)=>Object.assign({},u&&{keys:u},l&&{rows_per_partition:l}),"createValueObject"),i=["ALL","NONE"],s=e(t.value.keys),o=r(t.value.rowsPerPartition);if(!s&&!o)return null;let a=JSON.stringify(n(s,o));return`caching = ${yS(a)}`},"transformCachingOption"),zP=c((t,e)=>{if(!e.value&&typeof e.value!="number")return t;let r=qP(e);if(!r)return t;let n=jc(t);return t.concat(`${n} ${r} +`)},"generateOptionsStringReducer"),WP=c((t,e)=>{if(e){let r=jc(t);return t.concat(`${r} comment = '${e}' +`)}return t},"addCommentToOptionString"),QP=c((t,e)=>{if(!t)return e;let r=jc(e);return e.concat(`${r} ID = '${t}' +`)},"addId"),YP=c((t,e,r,n)=>{let i=t.filter(f=>e[f&&f.keyId]);if(!i.length)return r;let s=c(f=>f.map(h=>{let{keyId:p,type:g}=h,{name:d}=e[p];return`"${d}" ${g==="descending"?"DESC":"ASC"}`}),"mapKeys"),[o,a]=hS.lodash.partition(i,({keyId:f})=>hS.lodash.get(e,`${f}.isActivated`)!==!1);o=s(o),a=s(a);let u;n?a.length===0?u=o.join(", "):o.length===0?u=fS(a.join(", ")):u=`${o.join(", ")} ${fS(`, ${a.join(", ")}`)}`:u=s(i).join(", ");let l=jc(r);return r.concat(`${l} CLUSTERING ORDER BY (${u}) +`)},"addClustering");mS.exports={parseToString(t,e){let r=t.reduce(zP,"");return WP(r,e)},addId:QP,addClustering:YP}});var Ws=_((mz,_S)=>{"use strict";var{retrieveContainerName:ZP,retrieveEntityName:XP,retrivePropertyFromConfig:ts,getTableNameStatement:JP,commentDeactivatedStatement:eL}=ar(),{getColumnDefinition:tL}=Vc(),{getNamesByIds:vS}=sa(),{getEntityLevelConfig:rL}=Uc(),{parseToString:nL,addId:iL,addClustering:sL}=Ch(),{inlineComment:ES}=oa(),{dependencies:wS}=cr(),oL=c((t,e,r,n,i,s)=>{let o=[];return r&&o.push(r),n&&o.push(`PRIMARY KEY (${n})`),wS.provider.createTable({ifNotExist:s,databaseName:JP(t,e),items:o,options:i})},"getCreateTableStatement"),SS=c((t,e,r)=>{let n=aL(t,r),i=cL(e,r),s=[];return n&&s.push(n),i&&s.push(i),s.join(i.startsWith("/*")||n.endsWith("*/")?" ":", ")},"getPrimaryKeyList"),aL=c((t,e)=>{let r=Object.keys(t);if(r.length){let n=TS(r,t,e);return r.length>1?`(${n})`:n}else return""},"getPartitionKeys"),cL=c((t,e)=>{let r=Object.keys(t);return r.length?TS(r,t,e):""},"getClusteringKeys"),uL=c((t,e)=>t.map(r=>{let n=e[r.propertyKeyword];return n===void 0?r:Object.assign({},r,{value:n})}),"seedOptionsWithValues"),lL=c(t=>t.structure.find(r=>r.propertyName==="Options").structure,"getOptionsFromTab"),xS=c(t=>{let[e]=rL(),r=lL(e);return uL(r,t)},"mergeValuesWithConfigOptions"),CS=c((t,e,r,n,i,s)=>{let o=xS(n),a=iL(r,sL(t,e,nL(o,i),s));return a?a.replace(/\n$/,""):""},"getOptions"),TS=c((t,e,r)=>{let n=c(o=>o.map(a=>e[a].name).join('", "'),"joinKeys");if(!r)return`"${n(t)}"`;let[i,s]=wS.lodash.partition(t,o=>e[o].isActivated!==!1);return s.length===0?`"${n(i)}"`:i.length===0?`${ES(`"${n(s)}"`)}`:`"${n(i)}" ${ES(`, "${n(s)}"`)}`},"commentDeactivatedKeys");_S.exports={getOptions:CS,getPrimaryKeyList:SS,getTableStatement({tableData:t,tableMetaData:e,dataSources:r,keyspaceMetaData:n,udtTypeMap:i,isKeyspaceActivated:s}){let o=ZP(n),a=XP(e),u=ts(e,0,"compositePartitionKey",[]),l=ts(e,0,"compositeClusteringKey",[]),f=ts(e,0,"schemaId",""),h=ts(e,0,"comments",""),p=ts(e,0,"tableOptions",""),g=ts(e,0,"isActivated",!1),d=s&&g,y=vS(u.map(w=>w.keyId),r),v=vS(l.map(w=>w.keyId),r),m=oL(o,a,tL(t.properties||{},i,d),SS(y,v,d),CS(l,v,f,p,h,d),ts(e,0,"tableIfNotExist",void 0));return eL(m,g,s)},mergeValuesWithConfigOptions:xS}});var zc=_((Ez,NS)=>{"use strict";var{tab:fL,getNameWithKeyspace:hL,eachField:Th}=ar(),{getColumnDefinition:dL}=Vc(),pL=c((t,e,r,n)=>{let i=gL(r);return e.reduce((s,o)=>{let a=mL(o,i,n).map(({name:u,definition:l})=>yL(t,u,l));return s.concat(a)},[])},"getUdtScripts"),gL=c(t=>Object.keys(t).reduce((e,r)=>Object.assign(e,{[r]:Object.assign({},t[r],{frozen:!0})}),{}),"setFrozenForAllUdt"),bS=c((t,e)=>typeof t=="number"&&e.displayName?e.displayName:e.code||t,"getName"),yL=c((t,e,r)=>`CREATE TYPE IF NOT EXISTS ${hL(t,e)} ( +${fL(r)} +);`,"getCreateTypeStatement"),IS=c(t=>t.reduce((e,r)=>(Th(r,(n,i)=>{if(n.type==="udt"){let s=bS(i,n);e[s]={name:s,frozen:n.frozen}}return n}),e),{}),"getUdtMap"),mL=c((t,e,r)=>{let n=[];return Th(t,(i,s)=>(i.type==="udt"&&i.properties&&n.push({name:bS(s,i),definition:dL(i.properties,e,r)}),i)),n},"getAllUdt"),AS=c(t=>{if(!t.properties)return t;let e=Object.keys(t.properties),r=[];e.forEach(i=>{let s=[];if(Th(t.properties[i],o=>{if(o.$ref){let a=o.$ref.split("/").pop();s.indexOf(a)===-1&&s.push(a)}}),s.length)r.push(...s.filter(o=>r.indexOf(o)===-1));else{let o=r.indexOf(i);o===-1?r.unshift(i):r.unshift(...r.splice(o,1))}}),e.forEach(i=>{r.indexOf(i)===-1&&r.push(i)});let n={};return r.forEach(i=>{t.properties[i]&&(n[i]=Object.assign({},t.properties[i]))}),t.properties=n,t},"sortUdt"),vL=c(t=>{let e=AS(JSON.parse(t.modelDefinitions)),r=JSON.parse(t.externalDefinitions);return{udtTypeMap:IS([e,r]),modelDefinitions:e,externalDefinitions:r}},"prepareDefinitions");NS.exports={getUdtScripts:pL,getUdtMap:IS,sortUdt:AS,prepareDefinitions:vL}});var _h=_((Cz,PS)=>{"use strict";var{tab:BS,retrieveContainerName:EL,retrivePropertyFromConfig:ga}=ar(),SL=c(({name:t,replication:e,durableWrites:r,ifNotExist:n})=>`CREATE KEYSPACE ${n?"IF NOT EXISTS ":""}"${t}" +${BS(e)} +${r}; + +USE "${t}";`,"getCreateStatement"),CL=c(t=>`'class' : 'SimpleStrategy', +'replication_factor' : ${t}`,"getSimpleStrategy"),wL=c(t=>["'class' : 'NetworkTopologyStrategy'"].concat(t.reduce((e,r)=>[...e,`'${r.dataCenterName}' : ${DS(r.replFactorValue)}`],[])).join(`, +`),"getNetworkTopologyStrategy"),xL=c((t,e,r)=>t==="NetworkTopologyStrategy"?wL(r):CL(DS(e)),"getTopology"),RS=c((t,e,r)=>`WITH REPLICATION = { +${BS(xL(t,e,r))} +}`,"getReplication"),OS=c(t=>`AND DURABLE_WRITES = ${!!t+""}`,"getDurableWrites"),DS=c(t=>+t||1,"getFactor"),TL=c(t=>{let e=EL(t),r=ga(t,0,"replStrategy",""),n=ga(t,0,"replFactor",void 0),i=ga(t,0,"dataCenters",[]),s=ga(t,0,"durableWrites",!1);return t[0]&&!t[0].addToCqlScript||e===""?"":SL({name:e,replication:RS(r,n,i),durableWrites:OS(s),ifNotExist:ga(t,0,"keyspaceIfNotExist",void 0)})},"getKeyspaceStatement");PS.exports={getKeyspaceStatement:TL,getReplication:RS,getDurableWrites:OS}});var kS=_((xz,LS)=>{"use strict";var{retrieveContainerName:_L,retrieveEntityName:bL,retrieveUDA:IL,retrieveUDF:AL,retrieveIndexes:NL,commentDeactivatedStatement:BL,retrieveIsItemActivated:RL}=ar(),{getTableStatement:OL}=Ws(),{getUdtMap:DL,getUdtScripts:PL}=zc(),{getIndexes:LL}=ca(),kL=c((t,e)=>{var y,v;let r=_L(t.containerData),n=bL(t.entityData),i=RL(t.entityData),s=e&&i,o=[t.externalDefinitions,t.modelDefinitions,t.internalDefinitions,t.jsonSchema],a=DL(o),u=PL(r,o,a,s),l=OL({tableData:t.jsonSchema,tableMetaData:t.entityData,keyspaceMetaData:t.containerData,dataSources:o,udtTypeMap:a,isKeyspaceActivated:s}),f=(v=(y=t.modelData)==null?void 0:y[0])==null?void 0:v.dbVersion,h=LL(NL(t.entityData,f),o,n,r,i,e,f),p=qL(AL(t.containerData)),g=UL(IL(t.containerData)),d=FL([p,g,...u,l,h]);return BL(d,i&&e)},"getCreateTableScript"),FL=c(t=>t.filter(e=>e).join(` + +`),"getScript"),qL=c(t=>t.map(e=>e.functionBody).filter(e=>e).join(` +`),"getUserDefinedFunctions"),UL=c(t=>t.map(e=>e.storedProcFunction).filter(e=>e).join(` +`),"getUserDefinedAggregations");LS.exports={getCreateTableScript:kL}});var ze=_(Bn=>{"use strict";var gn=require("util");function Vt(t){Error.call(this,t),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.info="Cassandra Driver Error",this.message=t}c(Vt,"DriverError");gn.inherits(Vt,Error);function FS(t,e){if(Vt.call(this,e),this.innerErrors=t,this.info="Represents an error when a query cannot be performed because no host is available or could be reached by the driver.",!e&&(this.message="All host(s) tried for query failed.",t)){let r=Object.keys(t);if(r.length>0){let n=r[0];this.message+=gn.format(" First host tried, %s: %s. See innerErrors.",n,t[n])}}}c(FS,"NoHostAvailableError");gn.inherits(FS,Vt);function qS(t,e){Vt.call(this,e),this.code=t,this.info="Represents an error message from the server"}c(qS,"ResponseError");gn.inherits(qS,Vt);function US(t){Vt.call(this,t),this.info="Represents a bug inside the driver or in a Cassandra host."}c(US,"DriverInternalError");gn.inherits(US,Vt);function VS(t){Vt.call(this,t),this.info="Represents an authentication error from the driver or from a Cassandra node."}c(VS,"AuthenticationError");gn.inherits(VS,Vt);function MS(t){Vt.call(this,t),this.info="Represents an error that is raised when one of the arguments provided to a method is not valid."}c(MS,"ArgumentError");gn.inherits(MS,Vt);function KS(t,e){Vt.call(this,t,this.constructor),this.info="Represents a client-side error that is raised when the client did not hear back from the server within socketOptions.readTimeout",this.host=e}c(KS,"OperationTimedOutError");gn.inherits(KS,Vt);function HS(t){Vt.call(this,t,this.constructor),this.info="Represents a feature that is not supported in the driver or in the Cassandra version."}c(HS,"NotSupportedError");gn.inherits(HS,Vt);function $S(t,e,r){let n=gn.format("All connections to host %s are busy, %d requests are in-flight on %s",t,e,r===1?"a single connection":"each connection");Vt.call(this,n,this.constructor),this.info="Represents a client-side error indicating that all connections to a certain host have reached the maximum amount of in-flight requests supported (pooling.maxRequestsPerConnection)"}c($S,"BusyConnectionError");gn.inherits($S,Vt);Bn.ArgumentError=MS;Bn.AuthenticationError=VS;Bn.BusyConnectionError=$S;Bn.DriverError=Vt;Bn.OperationTimedOutError=KS;Bn.DriverInternalError=US;Bn.NoHostAvailableError=FS;Bn.NotSupportedError=HS;Bn.ResponseError=qS});var fr=_((Iz,jS)=>{"use strict";function VL(t){return new Promise(e=>setTimeout(e,t||0))}c(VL,"delay");function ML(t,e){return new Promise((r,n)=>t.once(e,(i,s)=>{i?n(i):r(s)}))}c(ML,"fromEvent");function KL(t){return new Promise((e,r)=>t((n,i)=>{n?r(n):e(i)}))}c(KL,"fromCallback");function HL(t,e){return function(r,n){r?e(r):t(n)}}c(HL,"getCallback");async function $L(t,e,r){let n;for(;(n=t.counter++){t.newQueryPlan(e,r,(s,o)=>{s?i(s):n(o)})})}c(GL,"newQueryPlan");function jL(t,e){if(!e)return t;GS(t,e)}c(jL,"optionalCallback");function zL(t,e,r){e>t&&(e=t);let n=new Array(e),i={counter:0};for(let s=0;s{})}c(WL,"toBackground");function GS(t,e){t.then(r=>process.nextTick(()=>e(null,r)),r=>process.nextTick(()=>e(r)))}c(GS,"toCallback");jS.exports={delay:VL,fromCallback:KL,fromEvent:ML,getCallback:HL,newQueryPlan:GL,optionalCallback:jL,times:zL,toBackground:WL,toCallback:GS}});var oe=_(de=>{"use strict";var Qs=require("util"),QL=require("net"),{EventEmitter:YL}=require("events"),zS=ze(),ZL=fr(),XL=9007199254740992,JL=2147483647,WS=Object.freeze({}),ek=Object.freeze([]);function hr(){}c(hr,"noop");var tk=Buffer.alloc||ik,QS=Buffer.allocUnsafe||YS,rk=Int8Array.from!==Buffer.from&&Buffer.from||sk,nk=Int8Array.from!==Buffer.from&&Buffer.from||ok;function YS(t){return new Buffer(t)}c(YS,"allocBufferDeprecated");function ik(t){let e=YS(t);return e.fill(0),e}c(ik,"allocBufferFillDeprecated");function sk(t,e){if(typeof t!="string")throw new TypeError("Expected string, obtained "+Qs.inspect(t));return new Buffer(t,e)}c(sk,"allocBufferFromStringDeprecated");function ok(t){if(!Array.isArray(t))throw new TypeError("Expected Array, obtained "+Qs.inspect(t));return new Buffer(t)}c(ok,"allocBufferFromArrayDeprecated");function ak(t){let e=t;return c(function(n,i){e(n,i),e=hr},"wrapperCallback")}c(ak,"callbackOnce");function ck(t){let e=QS(t.length);return t.copy(e),e}c(ck,"copyBuffer");function uk(t,e){return t&&(e.stack+=` + (event loop) +`+t.substr(t.indexOf(` +`)+1)),e}c(uk,"fixStack");function lk(t,e,r,n){if(!this.logEmitter){let i=n||this.options;if(!i||!i.logEmitter)throw new Error("Log emitter not defined");this.logEmitter=i.logEmitter}this.logEmitter("log",t,this.constructor.name,e,r||"")}c(lk,"log");function fk(t){if(t.length===1)return t[0].length;let e=0;return t.forEach(function(r){let n=r.length;n=n||0,e+=n}),e}c(fk,"totalLength");function hk(t){return Array.prototype.slice.call(arguments,1).forEach(function(r){if(!r)return;let n=Object.keys(r);for(let i=0;ir[t]?1:e[t]"u")return 0;let i=r[t].apply(r,e),s=n[t].apply(n,e);return i>s?1:i>>1,o=t[s],a=r(o,e);if(a<0)n=s+1;else if(a>0)i=s-1;else return s}return~n}c(XS,"binarySearch");function vk(t,e,r){if(t.length===0)return t.push(e);let n=XS(t,e,r);n<0&&(n=~n),t.splice(n,0,e)}c(vk,"insertSorted");function Ek(t,e){if(typeof t!="function")throw new zS.ArgumentError(Qs.format("%s is not a function",e||"callback"));return t}c(Ek,"validateFn");function Sk(t,e){if(!t||Array.isArray(t)||!e||e.length===0)return t;let r=new Array(e.length);t=dk(t);let n={};for(let i=0;i0;e--){let r=Math.floor(Math.random()*(e+1)),n=t[e];t[e]=t[r],t[r]=n}return t}c(Ak,"shuffleArray");function ya(){this.length=0,this.items={}}c(ya,"HashSet");ya.prototype.add=function(t){return this.contains(t)?!1:(this.items[t]=!0,this.length++,!0)};ya.prototype.contains=function(t){return this.length>0&&this.items[t]===!0};ya.prototype.remove=function(t){if(!this.contains(t))return!1;delete this.items[t],this.length--};ya.prototype.toArray=function(){return Object.keys(this.items)};var Ih=class Ih{constructor(e){if(!e||!e.nameOrIp||!e.dns)throw new Error("nameOrIp and dns lib must be provided as part of the options");this._resolve4=Qs.promisify(e.dns.resolve4),this._nameOrIp=e.nameOrIp,this._isIp=QL.isIP(e.nameOrIp),this._index=0,this._addresses=null,this._refreshing=null}async init(){this._isIp||await this._resolve()}async refresh(){if(!this._isIp){if(this._refreshing)return await ZL.fromEvent(this._refreshing,"finished");this._refreshing=new YL().setMaxListeners(0);try{await this._resolve()}catch{}this._refreshing.emit("finished"),this._refreshing=null}}async _resolve(){let e=await this._resolve4(this._nameOrIp);if(!e||e.length===0)throw new Error(`${this._nameOrIp} could not be resolved`);this._addresses=e}getIp(){if(this._isIp)return this._nameOrIp;let e=this._addresses[this._index%this._addresses.length];return this._index=this._index!==JL?this._index+1:0,e}};c(Ih,"AddressResolver");var bh=Ih;function Nk(t,e,r){if(!Array.isArray(t))throw new TypeError("First parameter is not an Array");r=r||hr;let n=t.length;if(n===0)return r();let i=0;for(let o=0;o=n)return r();if(i===void 0&&(i=!0),i)return process.nextTick(function(){e(t[s++],o)});e(t[s++],o)}c(o,"next")}c(Bk,"eachSeries");function Rk(t,e,r){return JS(t,e,!0,r)}c(Rk,"forEachOf");function Ok(t,e,r){return JS(t,e,!1,r)}c(Ok,"map");function JS(t,e,r,n){if(!Array.isArray(t))throw new TypeError("First parameter must be an Array");n=n||hr;let i=t.length;if(i===0)return n(null,[]);let s=new Array(i),o=0,a=r?l:u;for(let h=0;h=t)){if(i===void 0&&(i=o>=0),i){let f=s;return process.nextTick(function(){r(f,u)})}r(s,u)}}c(u,"next")}c(Fk,"timesLimit");function qk(t,e,r){if(t=+t,isNaN(t)||t<1)return r();let n=1,i;e(0,s),i===void 0&&(i=!1);function s(o){if(o)return r(o);if(n===t)return r();i===void 0&&(i=!0);let a=n++;if(i)return process.nextTick(function(){e(a,s)});e(a,s)}c(s,"next")}c(qk,"timesSeries");function Uk(t,e,r){let n=0;i();function i(s){if(s)return r(s);if(!t())return r();if(n===0){n=1,e(function(o){n===1&&(n=4),i(o)}),n===1&&(n=2);return}if(n===4)return process.nextTick(function(){e(i)});e(i)}c(i,"next")}c(Uk,"whilst");de.adaptNamedParamsPrepared=Sk;de.adaptNamedParamsWithHints=Ck;de.AddressResolver=bh;de.allocBuffer=tk;de.allocBufferUnsafe=QS;de.allocBufferFromArray=nk;de.allocBufferFromString=rk;de.arrayIterator=yk;de.binarySearch=XS;de.callbackOnce=ak;de.copyBuffer=ck;de.deepExtend=ZS;de.each=Nk;de.eachSeries=Bk;de.emptyArray=Object.freeze([]);de.emptyObject=WS;de.extend=hk;de.fixStack=uk;de.forEachOf=Rk;de.funcCompare=gk;de.ifUndefined=bk;de.ifUndefined3=Ik;de.insertSorted=vk;de.iteratorToArray=mk;de.log=lk;de.map=Ok;de.mapSeries=Dk;de.maxInt=XL;de.noop=hr;de.objectValues=xk;de.parallel=Pk;de.promiseWrapper=Tk;de.propCompare=pk;de.series=Lk;de.shuffleArray=Ak;de.stringRepeat=wk;de.times=kk;de.timesLimit=Fk;de.timesSeries=qk;de.totalLength=fk;de.validateFn=Ek;de.whilst=Uk;de.HashSet=ya});var tC=_(Nh=>{"use strict";var eC=require("dns"),Vk=require("util"),Mk=oe();function Ah(){}c(Ah,"AddressTranslator");Ah.prototype.translate=function(t,e,r){r(t+":"+e)};function Wc(){}c(Wc,"EC2MultiRegionTranslator");Vk.inherits(Wc,Ah);Wc.prototype.translate=function(t,e,r){let n=t,i=this,s;Mk.series([c(function(a){eC.reverse(t,function(u,l){if(u)return a(u);if(!l)return a();s=l[0],a()})},"resolve"),c(function(a){if(!s)return a();eC.lookup(s,function(u,l){if(u)return a(u);n=l,a()})},"lookup")],function(o){o&&i.logError(t,o),r(n+":"+e)})};Wc.prototype.logError=function(t,e){};Nh.AddressTranslator=Ah;Nh.EC2MultiRegionTranslator=Wc});var rs=_((nC,Bh)=>{var rC=function(t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function r(q,T,G){this.low=q|0,this.high=T|0,this.unsigned=!!G}c(r,"Long"),r.prototype.__isLong__,Object.defineProperty(r.prototype,"__isLong__",{value:!0});function n(q){return(q&&q.__isLong__)===!0}c(n,"isLong");function i(q){var T=Math.clz32(q&-q);return q?31-T:T}c(i,"ctz32"),r.isLong=n;var s={},o={};function a(q,T){var G,ae,X;return T?(q>>>=0,(X=0<=q&&q<256)&&(ae=o[q],ae)?ae:(G=l(q,0,!0),X&&(o[q]=G),G)):(q|=0,(X=-128<=q&&q<128)&&(ae=s[q],ae)?ae:(G=l(q,q<0?-1:0,!1),X&&(s[q]=G),G))}c(a,"fromInt"),r.fromInt=a;function u(q,T){if(isNaN(q))return T?A:x;if(T){if(q<0)return A;if(q>=v)return se}else{if(q<=-m)return re;if(q+1>=m)return Y}return q<0?u(-q,T).neg():l(q%y|0,q/y|0,T)}c(u,"fromNumber"),r.fromNumber=u;function l(q,T,G){return new r(q,T,G)}c(l,"fromBits"),r.fromBits=l;var f=Math.pow;function h(q,T,G){if(q.length===0)throw Error("empty string");if(typeof T=="number"?(G=T,T=!1):T=!!T,q==="NaN"||q==="Infinity"||q==="+Infinity"||q==="-Infinity")return T?A:x;if(G=G||10,G<2||360)throw Error("interior hyphen");if(ae===0)return h(q.substring(1),T,G).neg();for(var X=u(f(G,8)),Re=x,je=0;je>>0:this.low},"toInt"),k.toNumber=c(function(){return this.unsigned?(this.high>>>0)*y+(this.low>>>0):this.high*y+(this.low>>>0)},"toNumber"),k.toString=c(function(T){if(T=T||10,T<2||36>>0,Ee=Ce.toString(T);if(je=Oe,je.isZero())return Ee+Se;for(;Ee.length<6;)Ee="0"+Ee;Se=""+Ee+Se}},"toString"),k.getHighBits=c(function(){return this.high},"getHighBits"),k.getHighBitsUnsigned=c(function(){return this.high>>>0},"getHighBitsUnsigned"),k.getLowBits=c(function(){return this.low},"getLowBits"),k.getLowBitsUnsigned=c(function(){return this.low>>>0},"getLowBitsUnsigned"),k.getNumBitsAbs=c(function(){if(this.isNegative())return this.eq(re)?64:this.neg().getNumBitsAbs();for(var T=this.high!=0?this.high:this.low,G=31;G>0&&!(T&1<=0},"isPositive"),k.isOdd=c(function(){return(this.low&1)===1},"isOdd"),k.isEven=c(function(){return(this.low&1)===0},"isEven"),k.equals=c(function(T){return n(T)||(T=p(T)),this.unsigned!==T.unsigned&&this.high>>>31===1&&T.high>>>31===1?!1:this.high===T.high&&this.low===T.low},"equals"),k.eq=k.equals,k.notEquals=c(function(T){return!this.eq(T)},"notEquals"),k.neq=k.notEquals,k.ne=k.notEquals,k.lessThan=c(function(T){return this.comp(T)<0},"lessThan"),k.lt=k.lessThan,k.lessThanOrEqual=c(function(T){return this.comp(T)<=0},"lessThanOrEqual"),k.lte=k.lessThanOrEqual,k.le=k.lessThanOrEqual,k.greaterThan=c(function(T){return this.comp(T)>0},"greaterThan"),k.gt=k.greaterThan,k.greaterThanOrEqual=c(function(T){return this.comp(T)>=0},"greaterThanOrEqual"),k.gte=k.greaterThanOrEqual,k.ge=k.greaterThanOrEqual,k.compare=c(function(T){if(n(T)||(T=p(T)),this.eq(T))return 0;var G=this.isNegative(),ae=T.isNegative();return G&&!ae?-1:!G&&ae?1:this.unsigned?T.high>>>0>this.high>>>0||T.high===this.high&&T.low>>>0>this.low>>>0?-1:1:this.sub(T).isNegative()?-1:1},"compare"),k.comp=k.compare,k.negate=c(function(){return!this.unsigned&&this.eq(re)?re:this.not().add(O)},"negate"),k.neg=k.negate,k.add=c(function(T){n(T)||(T=p(T));var G=this.high>>>16,ae=this.high&65535,X=this.low>>>16,Re=this.low&65535,je=T.high>>>16,Se=T.high&65535,Oe=T.low>>>16,Ce=T.low&65535,Ee=0,ke=0,we=0,Ve=0;return Ve+=Re+Ce,we+=Ve>>>16,Ve&=65535,we+=X+Oe,ke+=we>>>16,we&=65535,ke+=ae+Se,Ee+=ke>>>16,ke&=65535,Ee+=G+je,Ee&=65535,l(we<<16|Ve,Ee<<16|ke,this.unsigned)},"add"),k.subtract=c(function(T){return n(T)||(T=p(T)),this.add(T.neg())},"subtract"),k.sub=k.subtract,k.multiply=c(function(T){if(this.isZero())return this;if(n(T)||(T=p(T)),e){var G=e.mul(this.low,this.high,T.low,T.high);return l(G,e.get_high(),this.unsigned)}if(T.isZero())return this.unsigned?A:x;if(this.eq(re))return T.isOdd()?re:x;if(T.eq(re))return this.isOdd()?re:x;if(this.isNegative())return T.isNegative()?this.neg().mul(T.neg()):this.neg().mul(T).neg();if(T.isNegative())return this.mul(T.neg()).neg();if(this.lt(w)&&T.lt(w))return u(this.toNumber()*T.toNumber(),this.unsigned);var ae=this.high>>>16,X=this.high&65535,Re=this.low>>>16,je=this.low&65535,Se=T.high>>>16,Oe=T.high&65535,Ce=T.low>>>16,Ee=T.low&65535,ke=0,we=0,Ve=0,lt=0;return lt+=je*Ee,Ve+=lt>>>16,lt&=65535,Ve+=Re*Ee,we+=Ve>>>16,Ve&=65535,Ve+=je*Ce,we+=Ve>>>16,Ve&=65535,we+=X*Ee,ke+=we>>>16,we&=65535,we+=Re*Ce,ke+=we>>>16,we&=65535,we+=je*Oe,ke+=we>>>16,we&=65535,ke+=ae*Ee+X*Ce+Re*Oe+je*Se,ke&=65535,l(Ve<<16|lt,ke<<16|we,this.unsigned)},"multiply"),k.mul=k.multiply,k.divide=c(function(T){if(n(T)||(T=p(T)),T.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&T.low===-1&&T.high===-1)return this;var G=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,T.low,T.high);return l(G,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?A:x;var ae,X,Re;if(this.unsigned){if(T.unsigned||(T=T.toUnsigned()),T.gt(this))return A;if(T.gt(this.shru(1)))return L;Re=A}else{if(this.eq(re)){if(T.eq(O)||T.eq(j))return re;if(T.eq(re))return O;var je=this.shr(1);return ae=je.div(T).shl(1),ae.eq(x)?T.isNegative()?O:j:(X=this.sub(T.mul(ae)),Re=ae.add(X.div(T)),Re)}else if(T.eq(re))return this.unsigned?A:x;if(this.isNegative())return T.isNegative()?this.neg().div(T.neg()):this.neg().div(T).neg();if(T.isNegative())return this.div(T.neg()).neg();Re=x}for(X=this;X.gte(T);){ae=Math.max(1,Math.floor(X.toNumber()/T.toNumber()));for(var Se=Math.ceil(Math.log(ae)/Math.LN2),Oe=Se<=48?1:f(2,Se-48),Ce=u(ae),Ee=Ce.mul(T);Ee.isNegative()||Ee.gt(X);)ae-=Oe,Ce=u(ae,this.unsigned),Ee=Ce.mul(T);Ce.isZero()&&(Ce=O),Re=Re.add(Ce),X=X.sub(Ee)}return Re},"divide"),k.div=k.divide,k.modulo=c(function(T){if(n(T)||(T=p(T)),e){var G=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,T.low,T.high);return l(G,e.get_high(),this.unsigned)}return this.sub(this.div(T).mul(T))},"modulo"),k.mod=k.modulo,k.rem=k.modulo,k.not=c(function(){return l(~this.low,~this.high,this.unsigned)},"not"),k.countLeadingZeros=c(function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},"countLeadingZeros"),k.clz=k.countLeadingZeros,k.countTrailingZeros=c(function(){return this.low?i(this.low):i(this.high)+32},"countTrailingZeros"),k.ctz=k.countTrailingZeros,k.and=c(function(T){return n(T)||(T=p(T)),l(this.low&T.low,this.high&T.high,this.unsigned)},"and"),k.or=c(function(T){return n(T)||(T=p(T)),l(this.low|T.low,this.high|T.high,this.unsigned)},"or"),k.xor=c(function(T){return n(T)||(T=p(T)),l(this.low^T.low,this.high^T.high,this.unsigned)},"xor"),k.shiftLeft=c(function(T){return n(T)&&(T=T.toInt()),(T&=63)===0?this:T<32?l(this.low<>>32-T,this.unsigned):l(0,this.low<>>T|this.high<<32-T,this.high>>T,this.unsigned):l(this.high>>T-32,this.high>=0?0:-1,this.unsigned)},"shiftRight"),k.shr=k.shiftRight,k.shiftRightUnsigned=c(function(T){return n(T)&&(T=T.toInt()),(T&=63)===0?this:T<32?l(this.low>>>T|this.high<<32-T,this.high>>>T,this.unsigned):T===32?l(this.high,0,this.unsigned):l(this.high>>>T-32,0,this.unsigned)},"shiftRightUnsigned"),k.shru=k.shiftRightUnsigned,k.shr_u=k.shiftRightUnsigned,k.rotateLeft=c(function(T){var G;return n(T)&&(T=T.toInt()),(T&=63)===0?this:T===32?l(this.high,this.low,this.unsigned):T<32?(G=32-T,l(this.low<>>G,this.high<>>G,this.unsigned)):(T-=32,G=32-T,l(this.high<>>G,this.low<>>G,this.unsigned))},"rotateLeft"),k.rotl=k.rotateLeft,k.rotateRight=c(function(T){var G;return n(T)&&(T=T.toInt()),(T&=63)===0?this:T===32?l(this.high,this.low,this.unsigned):T<32?(G=32-T,l(this.high<>>T,this.low<>>T,this.unsigned)):(T-=32,G=32-T,l(this.low<>>T,this.high<>>T,this.unsigned))},"rotateRight"),k.rotr=k.rotateRight,k.toSigned=c(function(){return this.unsigned?l(this.low,this.high,!1):this},"toSigned"),k.toUnsigned=c(function(){return this.unsigned?this:l(this.low,this.high,!0)},"toUnsigned"),k.toBytes=c(function(T){return T?this.toBytesLE():this.toBytesBE()},"toBytes"),k.toBytesLE=c(function(){var T=this.high,G=this.low;return[G&255,G>>>8&255,G>>>16&255,G>>>24,T&255,T>>>8&255,T>>>16&255,T>>>24]},"toBytesLE"),k.toBytesBE=c(function(){var T=this.high,G=this.low;return[T>>>24,T>>>16&255,T>>>8&255,T&255,G>>>24,G>>>16&255,G>>>8&255,G&255]},"toBytesBE"),r.fromBytes=c(function(T,G,ae){return ae?r.fromBytesLE(T,G):r.fromBytesBE(T,G)},"fromBytes"),r.fromBytesLE=c(function(T,G){return new r(T[0]|T[1]<<8|T[2]<<16|T[3]<<24,T[4]|T[5]<<8|T[6]<<16|T[7]<<24,G)},"fromBytesLE"),r.fromBytesBE=c(function(T,G){return new r(T[4]<<24|T[5]<<16|T[6]<<8|T[7],T[0]<<24|T[1]<<16|T[2]<<8|T[3],G)},"fromBytesBE");var Ae=r;return t.default=Ae,"default"in t?t.default:t}({});typeof define=="function"&&define.amd?define([],function(){return rC}):typeof Bh=="object"&&typeof nC=="object"&&(Bh.exports=rC)});var Rh=_((Pz,oC)=>{"use strict";var Kk=require("crypto"),Hk=oe();function yn(t){if(!t||t.length!==16)throw new Error("You must provide a buffer containing 16 bytes");this.buffer=t}c(yn,"Uuid");yn.fromString=function(t){if(typeof t!="string"||t.length!==36)throw new Error("Invalid string representation of Uuid, it should be in the 00000000-0000-0000-0000-000000000000");return new yn(Hk.allocBufferFromString(t.replace(/-/g,""),"hex"))};yn.random=function(t){if(t)sC(function(e,r){return e?t(e):t(null,iC(r))});else{let e=sC();return iC(e)}};yn.prototype.getBuffer=function(){return this.buffer};yn.prototype.equals=function(t){return t instanceof yn&&this.buffer.equals(t.buffer)};yn.prototype.toString=function(){let t=$k(this);return t.substr(0,8)+"-"+t.substr(8,4)+"-"+t.substr(12,4)+"-"+t.substr(16,4)+"-"+t.substr(20,12)};yn.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};yn.prototype.toJSON=function(){return this.toString()};function iC(t){return t[6]&=15,t[6]|=64,t[8]&=63,t[8]|=128,new yn(t)}c(iC,"createUuidFromBuffer");function $k(t){return t.buffer.toString("hex")}c($k,"getHex");function sC(t){return Kk.randomBytes(16,t)}c(sC,"getRandomBytes");oC.exports=yn});var dC=_((kz,hC)=>{"use strict";var Gk=require("util"),uC=require("crypto"),Ys=rs(),Oh=Rh(),mi=oe(),lC=122192928e5,Zc=1e4,jk=mi.allocBufferFromString("808080808080","hex"),zk=mi.allocBufferFromString("8080","hex"),Wk=mi.allocBufferFromString("7f7f7f7f7f7f","hex"),Qk=mi.allocBufferFromString("7f7f","hex"),Qc=0,Yc=0,aC=0;function Mt(t,e,r,n){let i;if(t instanceof Buffer){if(t.length!==16)throw new Error("Buffer for v1 uuid not valid");i=t}else i=tF(t,e,r,n);Oh.call(this,i)}c(Mt,"TimeUuid");Gk.inherits(Mt,Oh);Mt.fromDate=function(t,e,r,n,i){if(typeof e=="function"?(i=e,e=r=n=null):typeof r=="function"?(i=r,r=n=null):typeof n=="function"&&(i=n,n=null),!i)return new Mt(t,e,r,n);mi.parallel([s=>cC(r,6,(o,a)=>s(o,r=a)),s=>cC(n,2,(o,a)=>s(o,n=a))],s=>{if(s)return i(s);let o;try{o=new Mt(t,e,r,n)}catch(a){return i(a)}i(null,o)})};Mt.fromString=function(t){return new Mt(Oh.fromString(t).getBuffer())};Mt.min=function(t,e){return new Mt(t,e,jk,zk)};Mt.max=function(t,e){return new Mt(t,e,Wk,Qk)};Mt.now=function(t,e,r){return Mt.fromDate(null,null,t,e,r)};Mt.prototype.getDatePrecision=function(){let t=this.buffer.readUInt32BE(0),e=0;e|=(this.buffer[4]&255)<<8,e|=this.buffer[5]&255,e|=(this.buffer[6]&15)<<24,e|=(this.buffer[7]&255)<<16;let r=Ys.fromBits(t,e),n=Ys.fromNumber(Zc),i=r.modulo(n),s=r.div(n).subtract(Ys.fromNumber(lC));return{date:new Date(s.toNumber()),ticks:i.toNumber()}};Mt.prototype.getDate=function(){return this.getDatePrecision().date};Mt.prototype.getNodeId=function(){return this.buffer.slice(10)};Mt.prototype.getClockId=function(){return this.buffer.slice(8,10)};Mt.prototype.getNodeIdString=function(){return this.buffer.slice(10).toString("ascii")};function Yk(t,e,r){let n=Ys.fromNumber(e+lC).multiply(Ys.fromNumber(1e4)).add(Ys.fromNumber(r)),i=n.getHighBitsUnsigned();t.writeUInt32BE(n.getLowBitsUnsigned(),0),t.writeUInt16BE(i&65535,4),t.writeUInt16BE(i>>>16&65535,6)}c(Yk,"writeTime");function Zk(t){let e=t;if(typeof t=="string"&&(e=mi.allocBufferFromString(t,"ascii")),!(e instanceof Buffer))e=fC(2);else if(e.length!==2)throw new Error("Clock identifier must have 2 bytes");return e}c(Zk,"getClockId");function Xk(t){let e=t;if(typeof t=="string"&&(e=mi.allocBufferFromString(t,"ascii")),!(e instanceof Buffer))e=fC(6);else if(e.length!==6)throw new Error("Node identifier must have 6 bytes");return e}c(Xk,"getNodeId");function Jk(t){return(typeof t!="number"||t>=Zc)&&(Qc++,Qc>=Zc&&(Qc=0),t=Qc),t}c(Jk,"getTicks");function eF(t,e){if(!(t instanceof Date)||isNaN(t.getTime())){t=new Date;let r=t.getTime();Yc++,(Yc>Zc||r>aC)&&(Yc=0,aC=r),e=Yc}return{time:t.getTime(),ticks:Jk(e)}}c(eF,"getTimeWithTicks");function fC(t){return uC.randomBytes(t)}c(fC,"getRandomBytes");function cC(t,e,r){if(t)return r(null,t);uC.randomBytes(e,r)}c(cC,"getOrGenerateRandom");function tF(t,e,r,n){let i=eF(t,e);r=Xk(r),n=Zk(n);let s=mi.allocBufferUnsafe(16);return Yk(s,i.time,i.ticks),n.copy(s,8,0),r.copy(s,10,0),s[6]=s[6]&15,s[6]=s[6]|16,s[8]=s[8]&63,s[8]=s[8]|128,s}c(tF,"generateBuffer");hC.exports=Mt});var Ph=_((qz,pC)=>{"use strict";var rF=/(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+)?)?(?:[-~]([\w+]*(?:-\w[.\w]*)*))?(?:\+([.\w]+))?/,Xc=class Xc{constructor(e,r,n,i,s,o){this.major=e,this.minor=r,this.patch=n,this.dsePatch=i,this.preReleases=s,this.build=o}toString(){let e=this.major+"."+this.minor;return this.patch!==void 0&&(e+="."+this.patch),this.dsePatch!==void 0&&(e+="."+this.dsePatch),this.preReleases!==void 0&&this.preReleases.forEach(r=>{e+="-"+r}),this.build&&(e+="+"+this.build),e}compare(e){if(this.majore.major)return 1;if(this.minore.minor)return 1;let r=this.patch||0,n=e.patch||0;if(rn)return 1;if(this.dsePatch===void 0){if(e.dsePatch!==void 0)return-1}else{if(e.dsePatch===void 0)return 1;if(this.dsePatche.dsePatch)return 1}if(this.preReleases===void 0){if(e.preReleases!==void 0)return 1}else if(e.preReleases===void 0)return-1;return 0}static parse(e){if(!e)return null;let r=e.match(rF);if(r){let n=parseInt(r[1],10),i=parseInt(r[2],10),s=r[3]?parseInt(r[3],10):void 0,o=r[4]?parseInt(r[4],10):void 0,a=r[5]?r[5].split("-"):void 0,u=r[6];return new Xc(n,i,s,o,a,u)}throw new TypeError("Could not extract version from '"+e+"'")}};c(Xc,"VersionNumber");var Dh=Xc;pC.exports=Dh});var yC=_((Vz,gC)=>{"use strict";var nF=oe(),vi=Ph(),iF=vi.parse("2.0.0"),sF=vi.parse("2.1.0"),oF=vi.parse("2.2.0"),aF=vi.parse("3.0.0"),cF=vi.parse("5.1.0"),uF=vi.parse("6.0.0"),lF={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,dseV1:65,dseV2:66,maxSupported:66,minSupported:1,isDse:function(t){return t>=this.dseV1&&t<=this.dseV2},isSupportedCassandra:function(t){return t<=4&&t>=1},isSupported:function(t){return this.isDse(t)||this.isSupportedCassandra(t)},supportsPrepareFlags:function(t){return t===this.dseV2},supportsKeyspaceInRequest:function(t){return t===this.dseV2},supportsResultMetadataId:function(t){return t===this.dseV2},supportsPreparedPartitionKey:function(t){return t>=this.v4},supportsSchemaChangeFullMetadata:function(t){return t>=this.v3},supportsContinuousPaging:function(t){return this.isDse(t)},supportsPaging:function(t){return t>=this.v2},supportsTimestamp:function(t){return t>=this.v3},supportsNamedParameters:function(t){return t>=this.v3},supportsUnset:function(t){return t>=this.v4},supportsFailureReasonMap:function(t){return t>=this.v5},uses2BytesStreamIds:function(t){return t>=this.v3},uses4BytesCollectionLength:function(t){return t>=this.v3},uses4BytesQueryFlags:function(t){return this.isDse(t)},canStartupResponseErrorBeWrapped:function(t){return t>=this.v4},getLowerSupported:function(t){return t>=this.v5?this.v4:t<=this.v1?0:t-1},getHighestCommon:function(t,e){let r=t.log?t.log.bind(t):nF.noop,n=t.protocolVersion,i=!1,s=n;if(e.forEach(o=>{let a=null;if(o.dseVersion&&(a=vi.parse(o.dseVersion),r("verbose",`Encountered host ${o.address} with dse version ${a}`),a.compare(cF)>=0)){i=!0,a.compare(uF)>=0?n=Math.min(this.dseV2,n):n=Math.min(this.dseV1,n),s=n;return}if(!o.cassandraVersion||o.cassandraVersion.length===0){r("warning","Encountered host "+o.address+" with no cassandra version, skipping as part of protocol version evaluation");return}try{let u=vi.parse(o.cassandraVersion);a||r("verbose","Encountered host "+o.address+" with cassandra version "+u),u.compare(aF)>=0?(i=!0,n=Math.min(this.v4,n),s=n):u.compare(oF)>=0?(n=Math.min(this.v4,n),s=n):u.compare(sF)>=0?(n=Math.min(this.v3,n),s=n):u.compare(iF)>=0?n=Math.min(this.v2,n):n=this.v1}catch{r("warning","Encountered host "+o.address+" with unparseable cassandra version "+o.cassandraVersion+" skipping as part of protocol version evaluation")}}),i&&n{var mC=oe();function W(t,e){this.bits_=[],this.sign_=e;for(var r=!0,n=t.length-1;n>=0;n--){var i=t[n]|0;(!r||i!=e)&&(this.bits_[n]=i,r=!1)}}c(W,"Integer");W.IntCache_={};W.fromInt=function(t){if(-128<=t&&t<128){var e=W.IntCache_[t];if(e)return e}var r=new W([t|0],t<0?-1:0);return-128<=t&&t<128&&(W.IntCache_[t]=r),r};W.fromNumber=function(t){if(isNaN(t)||!isFinite(t))return W.ZERO;if(t<0)return W.fromNumber(-t).negate();for(var e=[],r=1,n=0;t>=r;n++)e[n]=t/r|0,r*=W.TWO_PWR_32_DBL_;return new W(e,0)};W.fromBits=function(t){var e=t[t.length-1];return new W(t,e&1<<31?-1:0)};W.fromString=function(t,e){if(t.length==0)throw TypeError("number format error: empty string");var r=e||10;if(r<2||36=0)throw TypeError('number format error: interior "-" character');for(var n=W.fromNumber(Math.pow(r,8)),i=W.ZERO,s=0;s>>24>0&&i.push(n>>24&255),n>>>16>0&&i.push(n>>16&255),n>>>8>0&&i.push(n>>8&255),i.push(n&255),i[0]>>7&&i.unshift(0);for(var s=mC.allocBufferUnsafe(i.length+(r.length-1)*4),o=0;o0?this.bits_[0]:this.sign_};W.prototype.toNumber=function(){if(this.isNegative())return-this.negate().toNumber();for(var t=0,e=1,r=0;r=0?e:W.TWO_PWR_32_DBL_+e};W.prototype.getSign=function(){return this.sign_};W.prototype.isZero=function(){if(this.sign_!=0)return!1;for(var t=0;t0&&(this.bits_[0]&1)!=0};W.prototype.equals=function(t){if(this.sign_!=t.sign_)return!1;for(var e=Math.max(this.bits_.length,t.bits_.length),r=0;r0};W.prototype.greaterThanOrEqual=function(t){return this.compare(t)>=0};W.prototype.lessThan=function(t){return this.compare(t)<0};W.prototype.lessThanOrEqual=function(t){return this.compare(t)<=0};W.prototype.compare=function(t){var e=this.subtract(t);return e.isNegative()?-1:e.isZero()?0:1};W.prototype.shorten=function(t){for(var e=t-1>>5,r=(t-1)%32,n=[],i=0;i>>16,o=this.getBits(i)&65535,a=t.getBits(i)>>>16,u=t.getBits(i)&65535,l=n+o+u,f=(l>>>16)+s+a;n=f>>>16,l&=65535,f&=65535,r[i]=f<<16|l}return W.fromBits(r)};W.prototype.subtract=function(t){return this.add(t.negate())};W.prototype.multiply=function(t){if(this.isZero())return W.ZERO;if(t.isZero())return W.ZERO;if(this.isNegative())return t.isNegative()?this.negate().multiply(t.negate()):this.negate().multiply(t).negate();if(t.isNegative())return this.multiply(t.negate()).negate();if(this.lessThan(W.TWO_PWR_24_)&&t.lessThan(W.TWO_PWR_24_))return W.fromNumber(this.toNumber()*t.toNumber());for(var e=this.bits_.length+t.bits_.length,r=[],n=0;n<2*e;n++)r[n]=0;for(var n=0;n>>16,o=this.getBits(n)&65535,a=t.getBits(i)>>>16,u=t.getBits(i)&65535;r[2*n+2*i]+=o*u,W.carry16_(r,2*n+2*i),r[2*n+2*i+1]+=s*u,W.carry16_(r,2*n+2*i+1),r[2*n+2*i+1]+=o*a,W.carry16_(r,2*n+2*i+1),r[2*n+2*i+2]+=s*a,W.carry16_(r,2*n+2*i+2)}for(var n=0;n>>16,t[e]&=65535};W.prototype.divide=function(t){if(t.isZero())throw Error("division by zero");if(this.isZero())return W.ZERO;if(this.isNegative())return t.isNegative()?this.negate().divide(t.negate()):this.negate().divide(t).negate();if(t.isNegative())return this.divide(t.negate()).negate();for(var e=W.ZERO,r=this;r.greaterThanOrEqual(t);){for(var n=Math.max(1,Math.floor(r.toNumber()/t.toNumber())),i=Math.ceil(Math.log(n)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),o=W.fromNumber(n),a=o.multiply(t);a.isNegative()||a.greaterThan(r);)n-=s,o=W.fromNumber(n),a=o.multiply(t);o.isZero()&&(o=W.ONE),e=e.add(o),r=r.subtract(a)}return e};W.prototype.modulo=function(t){return this.subtract(this.divide(t).multiply(t))};W.prototype.not=function(){for(var t=this.bits_.length,e=[],r=0;r>5,r=t%32,n=this.bits_.length+e+(r>0?1:0),i=[],s=0;s0?i[s]=this.getBits(s-e)<>>32-r:i[s]=this.getBits(s-e);return new W(i,this.sign_)};W.prototype.shiftRight=function(t){for(var e=t>>5,r=t%32,n=this.bits_.length-e,i=[],s=0;s0?i[s]=this.getBits(s+e)>>>r|this.getBits(s+e+1)<<32-r:i[s]=this.getBits(s+e);return new W(i,this.sign_)};W.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};W.prototype.abs=function(){return this.sign_===0?this:this.negate()};W.prototype.toJSON=function(){return this.toString()};vC.exports=W});var CC=_((Hz,SC)=>{"use strict";var Jn=Lh(),EC=oe();function We(t,e){typeof t=="number"&&(t=Jn.fromNumber(t)),this._intVal=t,this._scale=e}c(We,"BigDecimal");We.fromBuffer=function(t){let e=t.readInt32BE(0),r=Jn.fromBuffer(t.slice(4));return new We(r,e)};We.toBuffer=function(t){let e=Jn.toBuffer(t._intVal),r=EC.allocBufferUnsafe(4);return r.writeInt32BE(t._scale,0),Buffer.concat([r,e],r.length+e.length)};We.fromString=function(t){if(!t)throw new TypeError("Invalid null or undefined value");t=t.trim();let e=t.indexOf("."),r=0;return e>=0&&(r=t.length-1-e,t=t.substr(0,e)+t.substr(e+1)),new We(Jn.fromString(t),r)};We.fromNumber=function(t){if(isNaN(t))return new We(Jn.ZERO,0);let e=t.toString();return e.indexOf("e")>=0&&(e=t.toFixed(20)),We.fromString(e)};We.prototype.equals=function(t){return t instanceof We&&this.compare(t)===0};We.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};We.prototype.notEquals=function(t){return!this.equals(t)};We.prototype.compare=function(t){let e=this.subtract(t);return e.isNegative()?-1:e.isZero()?0:1};We.prototype.subtract=function(t){let e=this;if(e._scale===t._scale)return new We(e._intVal.subtract(t._intVal),e._scale);let r,n;return e._scale{"use strict";var nt=rs(),Ei=require("util"),Jc=oe(),Zs={months:Jc.allocBuffer(9),days:Jc.allocBuffer(9),nanoseconds:Jc.allocBuffer(9)},qh=2147483647,Uh=nt.fromInt(1e3),eu=Uh,tu=Uh.multiply(eu),ru=Uh.multiply(tu),nu=nt.fromInt(60).multiply(ru),kh=nt.fromInt(60).multiply(nu),wC=7,Fh=12,xC=/(\d+)(y|mo|w|d|h|s|ms|us|µs|ns|m)/gi,fF=/P((\d+)Y)?((\d+)M)?((\d+)D)?(T((\d+)H)?((\d+)M)?((\d+)S)?)?/,hF=/P(\d+)W/,dF=/P(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/;function Rn(t,e,r){this.months=t,this.days=e,this.nanoseconds=typeof r=="number"?nt.fromNumber(r):r}c(Rn,"Duration");Rn.prototype.equals=function(t){return t instanceof Rn?this.months===t.months&&this.days===t.days&&this.nanoseconds.equals(t.nanoseconds):!1};Rn.prototype.toBuffer=function(){let t=Xs.writeVInt(nt.fromNumber(this.months),Zs.months),e=Xs.writeVInt(nt.fromNumber(this.days),Zs.days),r=Xs.writeVInt(this.nanoseconds,Zs.nanoseconds),n=Jc.allocBufferUnsafe(t+e+r);Zs.months.copy(n,0,0,t);let i=t;return Zs.days.copy(n,i,0,e),i+=e,Zs.nanoseconds.copy(n,i,0,r),n};Rn.prototype.toString=function(){let t="";function e(i,s,o){return i===0||i0?mF(e,r):gF(e,r):pF(e,r)};function pF(t,e){let r=new ft(t);xC.lastIndex=0;let n;for(;(n=xC.exec(e))&&n.length<=3;)r.add(n[1],n[2]);return r.build()}c(pF,"parseStandardFormat");function gF(t,e){let r=fF.exec(e);if(!r||r[0]!==e)throw new TypeError(Ei.format("Unable to convert '%s' to a duration",e));let n=new ft(t);return r[1]&&n.addYears(r[2]),r[3]&&n.addMonths(r[4]),r[5]&&n.addDays(r[6]),r[7]&&(r[8]&&n.addHours(r[9]),r[10]&&n.addMinutes(r[11]),r[12]&&n.addSeconds(r[13])),n.build()}c(gF,"parseIso8601Format");function yF(t,e){let r=hF.exec(e);if(!r||r[0]!==e)throw new TypeError(Ei.format("Unable to convert '%s' to a duration",e));return new ft(t).addWeeks(r[1]).build()}c(yF,"parseIso8601WeekFormat");function mF(t,e){let r=dF.exec(e);if(!r||r[0]!==e)throw new TypeError(Ei.format("Unable to convert '%s' to a duration",e));return new ft(t).addYears(r[1]).addMonths(r[2]).addDays(r[3]).addHours(r[4]).addMinutes(r[5]).addSeconds(r[6]).build()}c(mF,"parseIso8601AlternativeFormat");function ft(t){this._isNegative=t,this._unitIndex=0,this._months=0,this._days=0,this._nanoseconds=nt.ZERO,this._addMethods={y:this.addYears,mo:this.addMonths,w:this.addWeeks,d:this.addDays,h:this.addHours,m:this.addMinutes,s:this.addSeconds,ms:this.addMillis,\u00B5s:this.addMicros,us:this.addMicros,ns:this.addNanos},this._unitByIndex=[null,"years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"]}c(ft,"Builder");ft.prototype._validateOrder=function(t){if(t===this._unitIndex)throw new TypeError(Ei.format("Invalid duration. The %s are specified multiple times",this._getUnitName(t)));if(t<=this._unitIndex)throw new TypeError(Ei.format("Invalid duration. The %s should be after %s",this._getUnitName(this._unitIndex),this._getUnitName(t)));this._unitIndex=t};ft.prototype._validateMonths=function(t,e){this._validate32(t,(qh-this._months)/e,"months")};ft.prototype._validateDays=function(t,e){this._validate32(t,(qh-this._days)/e,"days")};ft.prototype._validateNanos=function(t,e){this._validate64(t,nt.MAX_VALUE.subtract(this._nanoseconds).divide(e),"nanoseconds")};ft.prototype._validate32=function(t,e,r){if(t>e)throw new TypeError(Ei.format("Invalid duration. The total number of %s must be less or equal to %s",r,qh))};ft.prototype._validate64=function(t,e,r){if(t.greaterThan(e))throw new TypeError(Ei.format("Invalid duration. The total number of %s must be less or equal to %s",r,nt.MAX_VALUE.toString()))};ft.prototype._getUnitName=function(t){let e=this._unitByIndex[+t];if(!e)throw new Error("unknown unit index: "+t);return e};ft.prototype.add=function(t,e){let r=this._addMethods[e.toLowerCase()];if(!r)throw new TypeError(Ei.format("Unknown duration symbol '%s'",e));return r.call(this,t)};ft.prototype.addYears=function(t){let e=+t;return this._validateOrder(1),this._validateMonths(e,Fh),this._months+=e*Fh,this};ft.prototype.addMonths=function(t){let e=+t;return this._validateOrder(2),this._validateMonths(e,1),this._months+=e,this};ft.prototype.addWeeks=function(t){let e=+t;return this._validateOrder(3),this._validateDays(e,wC),this._days+=e*wC,this};ft.prototype.addDays=function(t){let e=+t;return this._validateOrder(4),this._validateDays(e,1),this._days+=e,this};ft.prototype.addHours=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(5),this._validateNanos(e,kh),this._nanoseconds=this._nanoseconds.add(e.multiply(kh)),this};ft.prototype.addMinutes=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(6),this._validateNanos(e,nu),this._nanoseconds=this._nanoseconds.add(e.multiply(nu)),this};ft.prototype.addSeconds=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(7),this._validateNanos(e,ru),this._nanoseconds=this._nanoseconds.add(e.multiply(ru)),this};ft.prototype.addMillis=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(8),this._validateNanos(e,tu),this._nanoseconds=this._nanoseconds.add(e.multiply(tu)),this};ft.prototype.addMicros=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(9),this._validateNanos(e,eu),this._nanoseconds=this._nanoseconds.add(e.multiply(eu)),this};ft.prototype.addNanos=function(t){let e=typeof t=="string"?nt.fromString(t):t;return this._validateOrder(10),this._validateNanos(e,nt.ONE),this._nanoseconds=this._nanoseconds.add(e),this};ft.prototype.build=function(){return this._isNegative?new Rn(-this._months,-this._days,this._nanoseconds.negate()):new Rn(this._months,this._days,this._nanoseconds)};var Xs=function(){function t(d){return d.toUnsigned().shiftLeft(1).xor(d.shiftRight(63))}c(t,"encodeZigZag64");function e(d){return d.shiftRightUnsigned(1).xor(d.and(nt.ONE).negate())}c(e,"decodeZigZag64");function r(d,y){return n(t(d),y)}c(r,"writeVInt");function n(d,y){let v=i(d);return v===1?(y[0]=d.getLowBits(),1):(s(d,v,y),v)}c(n,"writeUnsignedVInt");function i(d){return 639-o(d.or(nt.ONE))*9>>6}c(i,"computeUnsignedVIntSize");function s(d,y,v){let m=y-1,w=d.getLowBits(),x,A=4;for(x=m;x>=0&&A-- >0;x--)v[x]=255&w,w>>=8;for(w=d.getHighBits();x>=0;x--)v[x]=255&w,w>>=8;v[0]|=a(m)}c(s,"encodeVInt");function o(d){if(d.equals(nt.ZERO))return 64;let y=1,v=d.getHighBits();return v===0&&(y+=32,v=d.getLowBits()),v>>>16||(y+=16,v<<=16),v>>>24||(y+=8,v<<=8),v>>>28||(y+=4,v<<=4),v>>>30||(y+=2,v<<=2),y-=v>>>31,y}c(o,"numberOfLeadingZeros");function a(d){return~(255>>d)}c(a,"encodeExtraBytesToRead");function u(d,y){return e(l(d,y))}c(u,"readVInt");function l(d,y){let v=d[y.value++];if(!(v&128))return nt.fromInt(v);let m=f(v),w=p(m),x=nt.fromInt(m&g(w));for(let A=0;A127?d-256:d}c(f,"fromSignedByteToInt");function h(d){if(d===0)return 32;let y=1;return d>>>16||(y+=16,d<<=16),d>>>24||(y+=8,d<<=8),d>>>28||(y+=4,d<<=4),d>>>30||(y+=2,d<<=2),y-=d>>>31,y}c(h,"numberOfLeadingZerosInt32");function p(d){return h(~d)-24}c(p,"numberOfExtraBytesToRead");function g(d){return 255>>d}return c(g,"firstByteValueMask"),{readVInt:u,writeVInt:r}}();TC.exports=Rn});var IC=_((zz,bC)=>{"use strict";var Vh=oe();function mn(t){if(!(t instanceof Buffer)||t.length!==4&&t.length!==16)throw new TypeError("The ip address must contain 4 or 16 bytes");this.buffer=t,this.length=t.length,this.version=t.length===4?4:6}c(mn,"InetAddress");mn.fromString=function(t){if(!t)return new mn(Vh.allocBufferFromArray([0,0,0,0]));let e=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,r=/^[\da-f:.]+$/i,n;if(e.test(t))return n=t.split("."),new mn(Vh.allocBufferFromArray(n));if(!r.test(t))throw new TypeError("Value could not be parsed as InetAddress: "+t);if(n=t.split(":"),n.length<3)throw new TypeError("Value could not be parsed as InetAddress: "+t);let i=Vh.allocBufferUnsafe(16),s=8-n.length+1,o=!1,a=0,u=e.test(n[n.length-1]);u&&(s-=1);function l(f){i.writeUInt8(+f,a++)}c(l,"writeItem");for(let f=0;f=0){let o=s-e;o>r.length&&(r.length=o,r.start=e,e=-1)}}c(n,"checkLongest");for(let s=0;sr.start||(i.length>0&&(i+=":"),i+=(this.buffer[s]<<8|this.buffer[s+1]).toString(16))}return i.charAt(i.length-1)===":"&&(i+=":"),i};mn.prototype.toJSON=function(){return this.toString()};function vF(t){for(let e=0;e{"use strict";var EF=require("util"),AC=oe(),su=864e5,NC=Math.pow(2,31);function It(t,e,r){if(typeof t=="number"&&typeof e=="number"&&typeof r=="number"){if(this.date=new Date,this.date.setUTCHours(0,0,0,0),this.date.setUTCFullYear(t,e-1,r),isNaN(this.date.getTime()))throw new Error(EF.format("%d-%d-%d does not form a valid ES5 date!",t,e,r))}else if(typeof e>"u"&&typeof r>"u"&&typeof t=="number"){if(t<-2147483648||t>2147483647)throw new Error("You must provide a valid value for days since epoch (-2147483648 <= value <= 2147483647).");this.date=new Date(t*su)}if(typeof this.date>"u")throw new Error("You must provide a valid year, month and day");this._value=isNaN(this.date.getTime())?t:null,this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate()}c(It,"LocalDate");It.now=function(){return It.fromDate(new Date)};It.utcNow=function(){return new It(Date.now())};It.fromDate=function(t){if(isNaN(t.getTime()))throw new TypeError("Invalid date: "+t);return new It(t.getFullYear(),t.getMonth()+1,t.getDate())};It.fromString=function(t){if((t.match(/-/g)||[]).length>=2){let r=1;t[0]==="-"&&(t=t.substring(1),r=-1);let n=t.split("-");return new It(r*parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10))}if(t.match(/^-?\d+$/))return new It(parseInt(t,10));throw new Error("Invalid input '"+t+"'.")};It.fromBuffer=function(t){return new It(t.readUInt32BE(0)-NC)};It.prototype.compare=function(t){let e=isNaN(this.date.getTime())?this._value*su:this.date.getTime(),r=isNaN(t.date.getTime())?t._value*su:t.date.getTime(),n=e-r;return n<0?-1:n>0?1:0};It.prototype.equals=function(t){return t instanceof It&&this.compare(t)===0};It.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};It.prototype.toBuffer=function(){let e=(isNaN(this.date.getTime())?this._value:Math.floor(this.date.getTime()/su))+NC,r=AC.allocBufferUnsafe(4);return r.writeUInt32BE(e,0),r};It.prototype.toString=function(){let t;return isNaN(this.date.getTime())?this._value.toString():(this.year<0?t="-"+iu((this.year*-1).toString(),4):t=iu(this.year.toString(),4),t+="-"+iu(this.month.toString(),2)+"-"+iu(this.day.toString(),2),t)};It.prototype.toJSON=function(){return this.toString()};function iu(t,e){return t.length>=e?t:AC.stringRepeat("0",e-t.length)+t}c(iu,"fillZeros");BC.exports=It});var PC=_((Zz,DC)=>{"use strict";var Si=rs(),Mh=require("util"),Kh=oe(),SF=Si.fromString("86399999999999"),OC=Si.fromNumber(1e9),CF=Si.fromNumber(1e6),wF=864e5;function xt(t){if(!(t instanceof Si))throw new Error("You must specify a Long value as totalNanoseconds");if(t.lessThan(Si.ZERO)||t.greaterThan(SF))throw new Error("Total nanoseconds out of range");this.value=t,this.hour=this._getParts()[0],this.minute=this._getParts()[1],this.second=this._getParts()[2],this.nanosecond=this._getParts()[3]}c(xt,"LocalTime");xt.fromString=function(t){if(typeof t!="string")throw new Error("Argument type invalid: "+Mh.inspect(t));let e=t.split(":"),r=parseInt(e[0],10)*36e5+parseInt(e[1],10)*6e4,n;if(e.length===3){let i=e[2].split(".");r+=parseInt(i[0],10)*1e3,i.length===2&&(n=i[1],n=n+Kh.stringRepeat("0",9-n.length))}return xt.fromMilliseconds(r,parseInt(n,10)||0)};xt.now=function(t){return xt.fromDate(new Date,t)};xt.fromDate=function(t,e){if(!Mh.isDate(t))throw new Error("Not a valid date");let r=(t.getTime()+t.getTimezoneOffset()*-6e4)%wF;return xt.fromMilliseconds(r,e)};xt.fromMilliseconds=function(t,e){return typeof e!="number"&&(e=0),new xt(Si.fromNumber(t).multiply(CF).add(Si.fromNumber(e)))};xt.fromBuffer=function(t){if(!(t instanceof Buffer))throw new TypeError("Expected Buffer, obtained "+Mh.inspect(t));return new xt(new Si(t.readInt32BE(4),t.readInt32BE(0)))};xt.prototype.compare=function(t){return this.value.compare(t.value)};xt.prototype.equals=function(t){return t instanceof xt&&this.compare(t)===0};xt.prototype.getTotalNanoseconds=function(){return this.value};xt.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};xt.prototype.toBuffer=function(){let t=Kh.allocBufferUnsafe(8);return t.writeUInt32BE(this.value.getHighBitsUnsigned(),0),t.writeUInt32BE(this.value.getLowBitsUnsigned(),4),t};xt.prototype.toString=function(){return xF(this._getParts())};xt.prototype.toJSON=function(){return this.toString()};xt.prototype._getParts=function(){if(!this._partsCache){let t=[0,0,0,0],e=this.value.div(OC);t[3]=this.value.subtract(e.multiply(OC)).toNumber(),t[2]=e.toNumber(),t[2]>=60&&(t[1]=Math.floor(t[2]/60),t[2]=t[2]%60),t[1]>=60&&(t[0]=Math.floor(t[1]/60),t[1]=t[1]%60),this._partsCache=t}return this._partsCache};function xF(t){let e;if(t[0]<10?e="0"+t[0]+":":e=t[0]+":",t[1]<10?e+="0"+t[1]+":":e+=t[1]+":",t[2]<10?e+="0"+t[2]:e+=t[2],t[3]>0){let r=t[3].toString();r.length<9&&(r=Kh.stringRepeat("0",9-r.length)+r);let n;for(let i=r.length-1;i>0&&r[i]==="0";i--)n=i;n&&(r=r.substring(0,n)),e+="."+r}return e}c(xF,"formatTime");DC.exports=xt});var kC=_((Jz,LC)=>{"use strict";var TF=oe(),_F=ze(),bF=Symbol.asyncIterator||"@@asyncIterator";function Ci(t,e,r,n,i,s){n===-1&&(n=0),this.info={queriedHost:e,triedHosts:r,speculativeExecutions:n,achievedConsistency:i,traceId:null,warnings:null,customPayload:null,isSchemaInAgreement:s},t.flags&&(this.info.traceId=t.flags.traceId,this.info.warnings=t.flags.warnings,this.info.customPayload=t.flags.customPayload),this.rows=t.rows,this.rowLength=this.rows?this.rows.length:t.rowLength,this.columns=null,this.pageState=null,this.nextPage=void 0,this.nextPageAsync=void 0;let o=t.meta;o&&(this.columns=o.columns,o.pageState&&(this.pageState=o.pageState.toString("hex"),Object.defineProperty(this,"rawPageState",{value:o.pageState,enumerable:!1})))}c(Ci,"ResultSet");Ci.prototype.first=function(){return this.rows&&this.rows.length?this.rows[0]:null};Ci.prototype.getPageState=function(){return this.pageState};Ci.prototype.getColumns=function(){return this.columns};Ci.prototype.wasApplied=function(){if(!this.rows||this.rows.length===0)return!0;let e=this.rows[0]["[applied]"];return typeof e=="boolean"?e:!0};Ci.prototype[Symbol.iterator]=c(function(){return this.rows?this.rows[Symbol.iterator]():TF.emptyArray[Symbol.iterator]()},"getIterator");Ci.prototype[bF]=c(function(){let e=0,r=this.rawPageState,n=this.rows;if(!n||n.length===0)return{next:()=>Promise.resolve({done:!0})};let i=this;return{async next(){if(e>=n.length&&r){if(!i.nextPageAsync)throw new _F.DriverInternalError("Property nextPageAsync should be set when pageState is defined");let s=await i.nextPageAsync(r);n=s.rows,e=0,r=s.rawPageState}return e{"use strict";var{Readable:IF}=require("stream"),AF=oe(),NF=ze(),BF=ma(),$h=class $h extends IF{constructor(e){super(e),this.buffer=[],this.paused=!0,this._cancelAllowed=!1,this._handlersObject=null,this._highWaterMarkRows=0}_read(){for(this.paused=!1,this.buffer.length===0&&(this._readableState.reading=!1);!this.paused&&this.buffer.length>0;)this.paused=!this.push(this.buffer.shift());this._checkBelowHighWaterMark(),!this.paused&&!this.buffer.length&&this._readNext&&(this._readNext(),this._readNext=null)}_valve(e){this._readNext=null,e&&(this.paused||this.buffer.length?this._readNext=e:e())}add(e){let r=this.buffer.push(e);return this.read(0),this._checkAboveHighWaterMark(),r}_checkAboveHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length!==this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!1)}_checkBelowHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length>=this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!0)}cancel(e){if(!this._cancelAllowed){let r=new Error("You can only cancel streaming executions when continuous paging is enabled");if(!e)throw r;return e(r)}if(!this._handlersObject)throw new NF.DriverInternalError("ResultStream cancel is allowed but the cancel options were not set");if(e=e||AF.noop,!this._handlersObject.cancelHandler){this._handlersObject.cancelHandler=e;return}this._handlersObject.cancelHandler(e)}setHandlers(e){e.continuousPaging&&(this._cancelAllowed=!0,this._handlersObject=e,this._highWaterMarkRows=e.continuousPaging.highWaterMarkRows||BF.continuousPageDefaultHighWaterMark)}};c($h,"ResultStream");var Hh=$h;FC.exports=Hh});var VC=_((nW,UC)=>{"use strict";function va(t){if(!t)throw new Error("Columns not defined");Object.defineProperty(this,"__columns",{value:t,enumerable:!1,writable:!1})}c(va,"Row");va.prototype.get=function(t){return typeof t=="number"?this[this.__columns[t].name]:this[t]};va.prototype.values=function(){let t=[];return this.forEach(function(e){t.push(e)}),t};va.prototype.keys=function(){let t=[];return this.forEach(function(e,r){t.push(r)}),t};va.prototype.forEach=function(t){for(let e in this)this.hasOwnProperty(e)&&t(this[e],e)};UC.exports=va});var KC=_((sW,MC)=>{"use strict";function ns(...t){if(this.elements=t,this.elements.length===0)throw new TypeError("Tuple must contain at least one value");this.length=this.elements.length}c(ns,"Tuple");ns.fromArray=function(t){return new ns(...t)};ns.prototype.get=function(t){return this.elements[t||0]};ns.prototype.toString=function(){return"("+this.elements.reduce(function(t,e,r){return t+(r>0?",":"")+e.toString()},"")+")"};ns.prototype.toJSON=function(){return this.elements};ns.prototype.values=function(){return this.elements.slice(0)};MC.exports=ns});var Ke=_(Me=>{"use strict";var Ca=require("util"),Ea=ze(),HC=dC(),Gh=Rh(),cu=yC(),Sa=oe(),Gr=rs(),jr={any:0,one:1,two:2,three:3,quorum:4,all:5,localQuorum:6,eachQuorum:7,serial:8,localSerial:9,localOne:10},zr={};zr[jr.any]="ANY";zr[jr.one]="ONE";zr[jr.two]="TWO";zr[jr.three]="THREE";zr[jr.quorum]="QUORUM";zr[jr.all]="ALL";zr[jr.localQuorum]="LOCAL_QUORUM";zr[jr.eachQuorum]="EACH_QUORUM";zr[jr.serial]="SERIAL";zr[jr.localSerial]="LOCAL_SERIAL";zr[jr.localOne]="LOCAL_ONE";var au={custom:0,ascii:1,bigint:2,blob:3,boolean:4,counter:5,decimal:6,double:7,float:8,int:9,text:10,timestamp:11,uuid:12,varchar:13,varint:14,timeuuid:15,inet:16,date:17,time:18,smallint:19,tinyint:20,duration:21,list:32,map:33,set:34,udt:48,tuple:49,getByName:function(t){if(t=t.toLowerCase(),t.indexOf("<")>0){let r=/^(list|set)<(.+)>$/.exec(t);if(r)return{code:this[r[1]],info:this.getByName(r[2])};let n=/^(map)< *(.+) *, *(.+)>$/.exec(t);if(n)return{code:this[n[1]],info:[this.getByName(n[2]),this.getByName(n[3])]};let i=/^(udt)<(.+)>$/.exec(t);if(i)return{code:this[i[1]],info:i[2]};let s=/^(tuple)<(.+)>$/.exec(t);if(s)return{code:this[s[1]],info:s[2].split(",").map(function(o){return this.getByName(o.trim())},this)}}let e={code:this[t],info:null};if(typeof e.code!="number")throw new TypeError("Data type with name "+t+" not valid");return e}},RF=function(){let t={};for(let e in au){if(!au.hasOwnProperty(e))continue;let r=au[e];typeof r=="number"&&(t[r]=e)}return t}(),OF={local:0,remote:1,ignored:2},DF={error:0,startup:1,ready:2,authenticate:3,credentials:4,options:5,supported:6,query:7,result:8,prepare:9,execute:10,register:11,event:12,batch:13,authChallenge:14,authResponse:15,authSuccess:16,cancel:255,isInRange:function(t){return t>this.error&&t>this.event}},PF={topologyChange:"TOPOLOGY_CHANGE",statusChange:"STATUS_CHANGE",schemaChange:"SCHEMA_CHANGE"},LF={serverError:0,protocolError:10,badCredentials:256,unavailableException:4096,overloaded:4097,isBootstrapping:4098,truncateError:4099,writeTimeout:4352,readTimeout:4608,readFailure:4864,functionFailure:5120,writeFailure:5376,syntaxError:8192,unauthorized:8448,invalid:8704,configError:8960,alreadyExists:9216,unprepared:9472,clientWriteFailure:32768},kF={voidResult:1,rows:2,setKeyspace:3,prepared:4,schemaChange:5},FF={compression:1,tracing:2,customPayload:4,warning:8},qF=Object.freeze({unset:!0}),UF=Gr.fromInt(1e3),ou=0;function VF(t,e,r){let n,i,s,o;t&&(typeof t.msecs=="number"&&(n=new Date(t.msecs)),t.msecs instanceof Date&&(n=t.msecs),Array.isArray(t.node)&&(s=Sa.allocBufferFromArray(t.node)),typeof t.clockseq=="number"&&(o=Sa.allocBufferUnsafe(2),o.writeUInt16BE(t.clockseq,0)),typeof t.nsecs=="number"&&(i=t.nsecs));let a=new HC(n,i,s,o);return e instanceof Buffer?(a.getBuffer().copy(e,r||0),e):a.toString()}c(VF,"timeuuid");function MF(t,e,r){let n;return t&&Array.isArray(t.random)&&(n=new Gh(Sa.allocBufferFromArray(t.random))),n||(n=Gh.random()),e instanceof Buffer?(n.getBuffer().copy(e,r||0),e):n.toString()}c(MF,"uuid");function jh(t){if(!t||typeof t.code!="number")throw new Ea.ArgumentError("Invalid signature type definition");let e=RF[t.code];if(!e)throw new Ea.ArgumentError(Ca.format("Type with code %d not found",t.code));return t.info?Array.isArray(t.info)?e+"<"+t.info.map(function(r){return jh(r)}).join(", ")+">":typeof t.info.code=="number"?e+"<"+jh(t.info)+">":e:e}c(jh,"getDataTypeNameByCode");function is(t,e,r,n,i){this.version=t,this.flags=e,this.streamId=r,this.opcode=n,this.bodyLength=i}c(is,"FrameHeader");is.size=function(t){return cu.uses2BytesStreamIds(t)?9:8};is.getProtocolVersion=function(t){return t[0]&127};is.fromBuffer=function(t,e){let r=0;e||(e=0);let n=t[e++]&127,i=t.readUInt8(e++);return cu.uses2BytesStreamIds(n)?(r=t.readInt16BE(e),e+=2):r=t.readInt8(e++),new is(n,i,r,t.readUInt8(e++),t.readUInt32BE(e))};is.prototype.toBuffer=function(){let t=Sa.allocBufferUnsafe(is.size(this.version));t.writeUInt8(this.version,0),t.writeUInt8(this.flags,1);let e=3;return cu.uses2BytesStreamIds(this.version)?(t.writeInt16BE(this.streamId,2),e=4):t.writeInt8(this.streamId,2),t.writeUInt8(this.opcode,e++),t.writeUInt32BE(this.bodyLength,e),t};Gr.fromBuffer=function(t){if(!(t instanceof Buffer))throw new TypeError("Expected Buffer, obtained "+Ca.inspect(t));return new Gr(t.readInt32BE(4),t.readInt32BE(0))};Gr.toBuffer=function(t){if(!(t instanceof Gr))throw new TypeError("Expected Long, obtained "+Ca.inspect(t));let e=Sa.allocBufferUnsafe(8);return e.writeUInt32BE(t.getHighBitsUnsigned(),0),e.writeUInt32BE(t.getLowBitsUnsigned(),4),e};Gr.prototype.inspect=function(){return"Long: "+this.toString()};Gr.prototype.toJSON=function(){return this.toString()};function KF(t,e){t||(t=new Date);let r=Gr.ZERO;return typeof e=="number"&&e>=0&&e<1e3?r=Gr.fromInt(e):(ou>999&&(ou=0),r=Gr.fromInt(ou),ou++),Gr.fromNumber(t.getTime()).multiply(UF).add(r)}c(KF,"generateTimestamp");function $C(t){$C.super_.call(this,t.message,this.constructor),this.internalError=t}c($C,"QueryParserError");Ca.inherits($C,Ea.DriverError);function zh(t){zh.super_.call(this,t,this.constructor),this.info="Represents an error that happens when the maximum amount of time for an operation passed."}c(zh,"TimeoutError");Ca.inherits(zh,Ea.DriverError);Me.opcodes=DF;Me.consistencies=jr;Me.consistencyToString=zr;Me.dataTypes=au;Me.getDataTypeNameByCode=jh;Me.distance=OF;Me.frameFlags=FF;Me.protocolEvents=PF;Me.protocolVersion=cu;Me.responseErrorCodes=LF;Me.resultKind=kF;Me.timeuuid=VF;Me.uuid=MF;Me.BigDecimal=CC();Me.Duration=_C();Me.FrameHeader=is;Me.InetAddress=IC();Me.Integer=Lh();Me.LocalDate=RC();Me.LocalTime=PC();Me.Long=Gr;Me.ResultSet=kC();Me.ResultStream=qC();Me.Row=VC();Me.DriverError=Ea.DriverError;Me.TimeoutError=zh;Me.TimeUuid=HC;Me.Tuple=KC();Me.Uuid=Gh;Me.unset=qF;Me.generateTimestamp=KF});var WC=_((uW,zC)=>{"use strict";var wa=require("util"),ei=Ke(),uu=oe(),Wh=ze(),Yh=Object.freeze({done:!0}),HF=6e4;function vn(){}c(vn,"LoadBalancingPolicy");vn.prototype.init=function(t,e,r){this.client=t,this.hosts=e,r()};vn.prototype.getDistance=function(t){return ei.distance.local};vn.prototype.newQueryPlan=function(t,e,r){r(new Error("You must implement a query plan for the LoadBalancingPolicy class"))};vn.prototype.getOptions=function(){return new Map};function Zh(){this.index=0}c(Zh,"RoundRobinPolicy");wa.inherits(Zh,vn);Zh.prototype.newQueryPlan=function(t,e,r){if(!this.hosts)return r(new Error("Load balancing policy not initialized"));let n=this.hosts.values(),i=this,s=0,o=i.index%n.length;i.index+=1,i.index>=uu.maxInt&&(i.index=0),r(null,{next:function(){return++s>n.length?Yh:{value:n[o++%n.length],done:!1}}})};function ti(t){this.localDc=t,this.index=0,this.localHostsArray=null}c(ti,"DCAwareRoundRobinPolicy");wa.inherits(ti,vn);ti.prototype.init=function(t,e,r){this.client=t,this.hosts=e,e.on("add",this._cleanHostCache.bind(this)),e.on("remove",this._cleanHostCache.bind(this));try{jC(this,t,this.hosts)}catch(n){return r(n)}r()};ti.prototype.getDistance=function(t){return t.datacenter===this.localDc?ei.distance.local:ei.distance.ignored};ti.prototype._cleanHostCache=function(){this.localHostsArray=null};ti.prototype._resolveLocalHosts=function(){let t=this.hosts.values();this.localHostsArray||(this.localHostsArray=[],t.forEach(function(e){e.datacenter&&e.datacenter===this.localDc&&this.localHostsArray.push(e)},this))};ti.prototype.newQueryPlan=function(t,e,r){if(!this.hosts)return r(new Error("Load balancing policy not initialized"));this.index+=1,this.index>=uu.maxInt&&(this.index=0),this._resolveLocalHosts();let n=this.localHostsArray,i=this.index,s=0;r(null,{next:function(){let o;return s++[r,!0]))}c(On,"AllowListPolicy");wa.inherits(On,vn);On.prototype.init=function(t,e,r){this.childPolicy.init(t,e,r)};On.prototype.getDistance=function(t){return this._contains(t)?this.childPolicy.getDistance(t):ei.distance.ignored};On.prototype._contains=function(t){return!!this.allowList.get(t.address)};On.prototype.newQueryPlan=function(t,e,r){let n=this;this.childPolicy.newQueryPlan(t,e,function(i,s){if(i)return r(i);r(null,n._filter(s))})};On.prototype._filter=function(t){let e=this;return{next:function(){let r=t.next();return!r.done&&!e._contains(r.value)?this.next():r}}};On.prototype.getOptions=function(){return new Map([["childPolicy",this.childPolicy.constructor!==void 0?this.childPolicy.constructor.name:null],["allowList",Array.from(this.allowList.keys())]])};function GC(t,e){On.call(this,t,e)}c(GC,"WhiteListPolicy");wa.inherits(GC,On);var lu=class lu extends vn{constructor(e){super(),typeof e=="string"?e={localDc:e}:e||(e=uu.emptyObject),this._client=null,this._hosts=null,this._filteredHosts=null,this._preferredHost=null,this._index=0,this.localDc=e.localDc,this._filter=e.filter||this._defaultFilter,e.isHostNewlyUp&&(this._isHostNewlyUp=e.isHostNewlyUp),e.healthCheck&&(this._healthCheck=e.healthCheck),e.compare&&(this._compare=e.compare),e.getReplicas&&(this._getReplicas=e.getReplicas)}init(e,r,n){this._client=e,this._hosts=r,this._hosts.on("add",()=>this._filteredHosts=null),this._hosts.on("remove",()=>this._filteredHosts=null);try{jC(this,e,this._hosts)}catch(i){return n(i)}n()}getDistance(e){return this._preferredHost!==null&&e===this._preferredHost||this._filter(e)&&e.datacenter===this.localDc?ei.distance.local:ei.distance.ignored}newQueryPlan(e,r,n){let i,s;r&&(i=r.getRoutingKey(),r.getKeyspace()&&(e=r.getKeyspace()),s=r.getPreferredHost());let o;return!e||!i?o=this._getLocalHosts():o=this._getReplicasAndLocalHosts(e,i),s&&(this._preferredHost=s,o=lu._getPreferredHostFirst(s,o)),n(null,o)}static*_getPreferredHostFirst(e,r){yield e;for(let n of r)n!==e&&(yield n)}*_getLocalHosts(e){let r=this._getFilteredLocalHosts(),n=this._getIndex(),i=e?s=>e.indexOf(s)===-1:s=>!0;for(let s=0;so&&(s=f,o=h),s===null&&!this._healthCheck(f)&&a++,i.push(f)}if(n=i,uu.shuffleArray(n),n.length<3)return this.yieldReplicasFirst(n);let u;if(s===null)a>0&&a=1){let l=s===n[0]?0:1;u=n[n.length-1],n[n.length-1]=n[l],n[l]=u}return this._compare(n[1],n[0])>0&&(u=n[0],n[0]=n[1],n[1]=u),this.yieldReplicasFirst(n)}*yieldReplicasFirst(e){for(let r=0;r=10&&e.getResponseCount()<=1)}_compare(e,r){return e.getInFlight()this._filter(e)&&e.datacenter===this.localDc)),this._filteredHosts}_getIndex(){let e=this._index++;return this._index===2147483647&&(this._index=0),e}_sendUnhealthyToTheBack(e,r){let n=0;for(let i=e.length-1;i>=0&&ne.datacenter))}c($F,"getDataCenters");zC.exports={AllowListPolicy:On,DCAwareRoundRobinPolicy:ti,DefaultLoadBalancingPolicy:Qh,LoadBalancingPolicy:vn,RoundRobinPolicy:Zh,TokenAwarePolicy:Js,WhiteListPolicy:GC}});var YC=_(hu=>{"use strict";var QC=require("util");function xa(){}c(xa,"ReconnectionPolicy");xa.prototype.newSchedule=function(){throw new Error("You must implement a new schedule for the Reconnection class")};xa.prototype.getOptions=function(){return new Map};function fu(t){this.delay=t}c(fu,"ConstantReconnectionPolicy");QC.inherits(fu,xa);fu.prototype.newSchedule=function(){let t=this;return{next:function(){return{value:t.delay,done:!1}}}};fu.prototype.getOptions=function(){return new Map([["delay",this.delay]])};function Ta(t,e,r){this.baseDelay=t,this.maxDelay=e,this.startWithNoDelay=r}c(Ta,"ExponentialReconnectionPolicy");QC.inherits(Ta,xa);Ta.prototype.newSchedule=function*(){let t=this.startWithNoDelay?-1:0;for(;;){let e=0;t>=64?e=this.maxDelay:t!==-1&&(e=Math.min(Math.pow(2,t)*this.baseDelay,this.maxDelay)),t++,yield this._addJitter(e)}};Ta.prototype._addJitter=function(t){if(t===0)return t;let e=.85,r=.3;return!this.startWithNoDelay&&t===this.baseDelay?(e=1,r=.15):t===this.maxDelay&&(r=.15),Math.floor(t*(Math.random()*r+e))};Ta.prototype.getOptions=function(){return new Map([["baseDelay",this.baseDelay],["maxDelay",this.maxDelay],["startWithNoDelay",this.startWithNoDelay]])};hu.ReconnectionPolicy=xa;hu.ConstantReconnectionPolicy=fu;hu.ExponentialReconnectionPolicy=Ta});var Jh=_(du=>{"use strict";var ZC=require("util");function kr(){}c(kr,"RetryPolicy");kr.prototype.onUnavailable=function(t,e,r,n){return t.nbRetry>0?this.rethrowResult():this.retryResult(void 0,!1)};kr.prototype.onReadTimeout=function(t,e,r,n,i){return t.nbRetry>0?this.rethrowResult():r>=n&&!i?this.retryResult():this.rethrowResult()};kr.prototype.onWriteTimeout=function(t,e,r,n,i){return t.nbRetry>0?this.rethrowResult():i==="BATCH_LOG"?this.retryResult():this.rethrowResult()};kr.prototype.onRequestError=function(t,e,r){return this.retryResult(void 0,!1)};kr.prototype.retryResult=function(t,e){return{decision:kr.retryDecision.retry,consistency:t,useCurrentHost:e!==!1}};kr.prototype.rethrowResult=function(){return{decision:kr.retryDecision.rethrow}};kr.retryDecision={rethrow:0,retry:1,ignore:2};function eo(t){this._childPolicy=t||new kr}c(eo,"IdempotenceAwareRetryPolicy");ZC.inherits(eo,kr);eo.prototype.onReadTimeout=function(t,e,r,n,i){return this._childPolicy.onReadTimeout(t,e,r,n,i)};eo.prototype.onRequestError=function(t,e,r){return t.executionOptions.isIdempotent()?this._childPolicy.onRequestError(t,e,r):this.rethrowResult()};eo.prototype.onUnavailable=function(t,e,r,n){return this._childPolicy.onUnavailable(t,e,r,n)};eo.prototype.onWriteTimeout=function(t,e,r,n,i){return t.executionOptions.isIdempotent()?this._childPolicy.onWriteTimeout(t,e,r,n,i):this.rethrowResult()};function to(){}c(to,"FallthroughRetryPolicy");ZC.inherits(to,kr);to.prototype.onReadTimeout=function(){return this.rethrowResult()};to.prototype.onRequestError=function(){return this.rethrowResult()};to.prototype.onUnavailable=function(){return this.rethrowResult()};to.prototype.onWriteTimeout=function(){return this.rethrowResult()};du.IdempotenceAwareRetryPolicy=eo;du.FallthroughRetryPolicy=to;du.RetryPolicy=kr});var ew=_(gu=>{"use strict";var JC=require("util"),XC=ze();function ss(){}c(ss,"SpeculativeExecutionPolicy");ss.prototype.init=function(t){};ss.prototype.shutdown=function(){};ss.prototype.newPlan=function(t,e){throw new Error("You must implement newPlan() method in the SpeculativeExecutionPolicy")};ss.prototype.getOptions=function(){return new Map};function ed(){this._plan={nextExecution:function(){return-1}}}c(ed,"NoSpeculativeExecutionPolicy");JC.inherits(ed,ss);ed.prototype.newPlan=function(){return this._plan};function pu(t,e){if(!(t>=0))throw new XC.ArgumentError("delay must be a positive number or zero");if(!(e>0))throw new XC.ArgumentError("maxSpeculativeExecutions must be a positive number");this._delay=t,this._maxSpeculativeExecutions=e}c(pu,"ConstantSpeculativeExecutionPolicy");JC.inherits(pu,ss);pu.prototype.newPlan=function(){let t=0,e=this;return{nextExecution:function(){return t++{"use strict";var tw=require("util"),{Long:td}=Ke(),GF=ze(),jF=9007199254740,zF=td.fromInt(1e3);function rd(){}c(rd,"TimestampGenerator");rd.prototype.next=function(t){throw new Error("next() must be implemented")};function _a(t,e){if(t<0)throw new GF.ArgumentError("warningThreshold can not be lower than 0");this._warningThreshold=t||1e3,this._minLogInterval=1e3,typeof e=="number"&&(this._minLogInterval=e),this._micros=-1,this._lastDate=0,this._lastLogDate=0}c(_a,"MonotonicTimestampGenerator");tw.inherits(_a,rd);_a.prototype.getDate=function(){return Date.now()};_a.prototype.next=function(t){let e=this.getDate(),r=0;if(e>this._lastDate)return this._micros=0,this._lastDate=e,this._generateMicroseconds();e=this._warningThreshold){let s=Date.now();if(this._minLogInterval>0&&this._lastLogDate+this._minLogInterval<=s){let o=tw.format("Timestamp generated using current date was %d milliseconds behind the last generated timestamp (which millisecond portion was %d), the returned value (%s) is being artificially incremented to guarantee monotonicity.",r,n,i);this._lastLogDate=s,t.log("warning",o)}}return i};_a.prototype._generateMicroseconds=function(){return this._lastDate{"use strict";var WF=Fr.addressResolution=tC(),QF=Fr.loadBalancing=WC(),YF=Fr.reconnection=YC(),ZF=Fr.retry=Jh(),XF=Fr.speculativeExecution=ew(),JF=Fr.timestampGeneration=rw();Fr.defaultAddressTranslator=function(){return new WF.AddressTranslator};Fr.defaultLoadBalancingPolicy=function(t){return new QF.DefaultLoadBalancingPolicy(t)};Fr.defaultRetryPolicy=function(){return new ZF.RetryPolicy};Fr.defaultReconnectionPolicy=function(){return new YF.ExponentialReconnectionPolicy(1e3,10*60*1e3,!1)};Fr.defaultSpeculativeExecutionPolicy=function(){return new XF.NoSpeculativeExecutionPolicy};Fr.defaultTimestampGenerator=function(){return new JF.MonotonicTimestampGenerator}});var od=_((SW,nw)=>{"use strict";var sd=class sd{onSuccess(e,r,n,i,s,o,a){}onError(e,r,n,i,s,o,a){}shutdown(){}};c(sd,"RequestTracker");var id=sd;nw.exports=id});var uw=_((wW,cw)=>{"use strict";var e3=require("events"),t3=od(),r3=ze(),{format:ba}=require("util"),n3=1e6,i3=500,s3=50,iw=200,cd=class cd extends t3{constructor(e){if(super(),!e)throw new r3.ArgumentError("RequestLogger options parameter is required");this._options=e,this.logNormalRequests=this._options.logNormalRequests,this.logErroredRequests=this._options.logErroredRequests,this.emitter=new e3.EventEmitter}onSuccess(e,r,n,i,s,o,a){this._options.slowThreshold>0&&ro(a)>this._options.slowThreshold?this._logSlow(e,r,n,i,s,o,a):this._options.requestSizeThreshold>0&&s>this._options.requestSizeThreshold?this._logLargeRequest(e,r,n,i,s,o,a):this.logNormalRequests&&this._logNormalRequest(e,r,n,i,s,o,a)}onError(e,r,n,i,s,o,a){this._options.requestSizeThreshold>0&&s>this._options.requestSizeThreshold?this._logLargeErrorRequest(e,r,n,i,s,o,a):this.logErroredRequests&&this._logErrorRequest(e,r,n,i,s,o,a)}_logSlow(e,r,n,i,s,o,a){let u=ba("[%s] Slow request, took %d ms (%s): %s",e.address,Math.floor(ro(a)),Aa(s,o),Ia(r,n,i,this._options));this.emitter.emit("slow",u)}_logLargeRequest(e,r,n,i,s,o,a){let u=ba("[%s] Request exceeded length, %s (took %d ms): %s",e.address,Aa(s,o),~~ro(a),Ia(r,n,i,this._options));this.emitter.emit("large",u)}_logNormalRequest(e,r,n,i,s,o,a){let u=ba("[%s] Request completed normally, took %d ms (%s): %s",e.address,~~ro(a),Aa(s,o),Ia(r,n,i,this._options));this.emitter.emit("normal",u)}_logLargeErrorRequest(e,r,n,i,s,o,a){let u=this._options.messageMaxErrorStackTraceLength||iw,l=ba("[%s] Request exceeded length and execution failed, %s (took %d ms): %s; error: %s",e.address,Aa(s),~~ro(a),Ia(r,n,i,this._options),o.stack.substr(0,u));this.emitter.emit("large",l)}_logErrorRequest(e,r,n,i,s,o,a){let u=this._options.messageMaxErrorStackTraceLength||iw,l=ba("[%s] Request execution failed, took %d ms (%s): %s; error: %s",e.address,~~ro(a),Aa(s),Ia(r,n,i,this._options),o.stack.substr(0,u));this.emitter.emit("failure",l)}};c(cd,"RequestLogger");var ad=cd;function ro(t){return t[0]*1e3+t[1]/n3}c(ro,"toMillis");function Ia(t,e,r,n){let i=n.messageMaxQueryLength||i3,s=n.messageMaxParameterValueLength||s3;if(Array.isArray(t))return o3(t,r,i,s);let o=t.substr(0,i),a=i-o.length-1;return o+=aw(e,a,s),r.isPrepared()||(o+=" (not prepared)"),o}c(Ia,"getStatementInfo");function o3(t,e,r,n){let i=(e.isBatchLogged()?"LOGGED ":"")+"BATCH w/ "+t.length+(e.isPrepared()?"":" not prepared")+" queries (",s=r,o;for(o=0;o0;o++){let a=t[o],u=a.params;typeof a!="string"&&(a=a.query),o>0&&(i+=",",s--);let l=Math.min(s,a.length);if(i+=a.substr(0,l),s-=l,s<=0)break;let f=aw(u,s,n);s-=f.length,i+=f}return i+=osw(t[o],a),"paramStringifier");if(!Array.isArray(t)){let o=t;t=Object.keys(t),n=c((a,u)=>{let l=t[a],f=l.substr(0,u),h=u-f.length-1;return h<=0||(f+=":"+sw(o[l],h)),f},"paramStringifier")}let i=" [",s;for(s=0;e>0&&s0&&(i+=",",e--);let o=n(s,Math.min(r,e));e-=o.length,i+=o}return s1e3?Math.round(t/1024)+" KB":t+" bytes"}c(ow,"formatSize");cw.exports=ad});var ld=_(ud=>{"use strict";ud.RequestLogger=uw();ud.RequestTracker=od()});var dd=_((_W,lw)=>{"use strict";var hd=class hd{onAuthenticationError(e){}onClientTimeoutError(e){}onConnectionError(e){}onOtherError(e){}onReadTimeoutError(e){}onWriteTimeoutError(e){}onUnavailableError(e){}onClientTimeoutRetry(e){}onOtherErrorRetry(e){}onReadTimeoutRetry(e){}onUnavailableRetry(e){}onWriteTimeoutRetry(e){}onIgnoreError(e){}onSpeculativeExecution(){}onSuccessfulResponse(e){}onResponse(e){}};c(hd,"ClientMetrics");var fd=hd;lw.exports=fd});var hw=_((IW,fw)=>{"use strict";var a3=dd(),Kt=require("events"),gd=class gd extends a3{constructor(){super(),this.errors=new Kt,this.errors.authentication=new Kt,this.errors.clientTimeout=new Kt,this.errors.connection=new Kt,this.errors.other=new Kt,this.errors.readTimeout=new Kt,this.errors.unavailable=new Kt,this.errors.writeTimeout=new Kt,this.retries=new Kt,this.retries.clientTimeout=new Kt,this.retries.other=new Kt,this.retries.readTimeout=new Kt,this.retries.unavailable=new Kt,this.retries.writeTimeout=new Kt,this.speculativeExecutions=new Kt,this.ignoredErrors=new Kt,this.responses=new Kt,this.responses.success=new Kt}onAuthenticationError(e){this.errors.authentication.emit("increment",e),this.errors.emit("increment",e)}onConnectionError(e){this.errors.connection.emit("increment",e),this.errors.emit("increment",e)}onReadTimeoutError(e){this.errors.readTimeout.emit("increment",e),this.errors.emit("increment",e)}onWriteTimeoutError(e){this.errors.writeTimeout.emit("increment",e),this.errors.emit("increment",e)}onUnavailableError(e){this.errors.unavailable.emit("increment",e),this.errors.emit("increment",e)}onClientTimeoutError(e){this.errors.clientTimeout.emit("increment",e),this.errors.emit("increment",e)}onOtherError(e){this.errors.other.emit("increment",e),this.errors.emit("increment",e)}onClientTimeoutRetry(e){this.retries.clientTimeout.emit("increment",e),this.retries.emit("increment",e)}onOtherErrorRetry(e){this.retries.other.emit("increment",e),this.retries.emit("increment",e)}onReadTimeoutRetry(e){this.retries.readTimeout.emit("increment",e),this.retries.emit("increment",e)}onUnavailableRetry(e){this.retries.unavailable.emit("increment",e),this.retries.emit("increment",e)}onWriteTimeoutRetry(e){this.retries.writeTimeout.emit("increment",e),this.retries.emit("increment",e)}onIgnoreError(e){this.ignoredErrors.emit("increment",e)}onSpeculativeExecution(){this.speculativeExecutions.emit("increment")}onSuccessfulResponse(e){this.responses.success.emit("increment",e)}onResponse(e){this.responses.emit("increment",e)}};c(gd,"DefaultMetrics");var pd=gd;fw.exports=pd});var yd=_((NW,dw)=>{"use strict";var c3=dd(),u3=hw();dw.exports={ClientMetrics:c3,DefaultMetrics:u3}});var os=_(md=>{"use strict";function pw(){}c(pw,"AuthProvider");pw.prototype.newAuthenticator=function(t,e){throw new Error("This is an abstract class, you must implement newAuthenticator method or use another auth provider that inherits from this class")};function mu(){}c(mu,"Authenticator");mu.prototype.initialResponse=function(t){t(new Error("Not implemented"))};mu.prototype.evaluateChallenge=function(t,e){e(new Error("Not implemented"))};mu.prototype.onAuthenticationSuccess=function(t){};md.AuthProvider=pw;md.Authenticator=mu});var Ed=_((OW,mw)=>{"use strict";var gw=require("util"),yw=os(),vu=oe(),l3=yw.AuthProvider,f3=yw.Authenticator;function vd(t,e){this.username=t,this.password=e}c(vd,"PlainTextAuthProvider");gw.inherits(vd,l3);vd.prototype.newAuthenticator=function(){return new Na(this.username,this.password)};function Na(t,e){this.username=t,this.password=e}c(Na,"PlainTextAuthenticator");gw.inherits(Na,f3);Na.prototype.initialResponse=function(t){let e=Buffer.concat([vu.allocBufferFromArray([0]),vu.allocBufferFromString(this.username,"utf8"),vu.allocBufferFromArray([0]),vu.allocBufferFromString(this.password,"utf8")]);t(null,e)};Na.prototype.evaluateChallenge=function(t,e){e()};mw.exports={PlainTextAuthenticator:Na,PlainTextAuthProvider:vd}});var Sd=_((PW,vw)=>{"use strict";var h3=require("util"),{Authenticator:d3}=os(),p3="com.datastax.bdp.cassandra.auth.DseAuthenticator";function no(t){this.authenticatorName=t}c(no,"BaseDseAuthenticator");h3.inherits(no,d3);no.prototype.getMechanism=function(){throw new Error("Not implemented")};no.prototype.getInitialServerChallenge=function(){throw new Error("Not implemented")};no.prototype.initialResponse=function(t){if(!this._isDseAuthenticator())return this.evaluateChallenge(this.getInitialServerChallenge(),t);t(null,this.getMechanism())};no.prototype._isDseAuthenticator=function(){return this.authenticatorName===p3};vw.exports=no});var Cw=_((kW,Sw)=>{"use strict";var g3=require("util"),Ew=oe(),wd=class wd{constructor(e,r){this.authorizationId=e,this.service=r!==void 0?r:"dse"}init(e,r){throw new Error("Not implemented")}evaluateChallenge(e,r){throw new Error("Not implemented")}shutdown(e){throw new Error("Not implemented")}static createNew(e,r,n){return new Cd(e,r,n)}};c(wd,"GssapiClient");var Eu=wd,xd=class xd extends Eu{constructor(e,r,n){if(typeof e.initializeClient!="function")throw new Error("The driver expects version 1.x of the kerberos library");super(r,n),this.kerberos=e,this.transitionIndex=0}init(e,r){this.host=e;let n=this.service;this.host&&(n=g3.format("%s@%s",this.service,this.host));let i={gssFlags:this.kerberos.GSS_C_MUTUAL_FLAG};this.kerberos.initializeClient(n,i,(s,o)=>{if(s)return r(s);this.kerberosClient=o,r()})}evaluateChallenge(e,r){this["transition"+this.transitionIndex](e,(n,i)=>{if(n)return r(n);this.transitionIndex++,r(null,i?Ew.allocBufferFromString(i,"base64"):Ew.allocBuffer(0))})}transition0(e,r){this.kerberosClient.step("",r)}transition1(e,r){let n=e.toString("base64");this.kerberosClient.step(n,r)}transition2(e,r){this.kerberosClient.unwrap(e.toString("base64"),(n,i)=>{if(n)return r(n,!1);let s=c(function(o,a){if(o)return r(o);r(null,a)},"cb");this.authorizationId!==void 0?this.kerberosClient.wrap(i,{user:this.authorizationId},s):this.kerberosClient.wrap(i,null,s)})}shutdown(e){this.kerberosClient=null,e()}};c(xd,"StandardGssClient");var Cd=xd;Sw.exports=Eu});var bw=_((qW,_w)=>{"use strict";var ww=require("util"),{AuthProvider:y3}=os(),xw=Sd(),m3=Cw(),Td=require("dns"),Ba=oe(),v3=Ba.allocBufferFromString("GSSAPI"),Tw="GSSAPI-START",E3=Ba.allocBuffer(0);function wi(t){try{this._kerberos=require("kerberos")}catch(e){if(e.code==="MODULE_NOT_FOUND"){let r=new Error('You must install module "kerberos" to use GSSAPI auth provider: https://www.npmjs.com/package/kerberos');throw r.code=e.code,r}throw e}t=t||Ba.emptyObject,this.authorizationId=t.authorizationId||t.user,this.service=t.service,this.hostNameResolver=t.hostNameResolver||wi.lookupServiceResolver}c(wi,"DseGssapiAuthProvider");ww.inherits(wi,y3);wi.prototype.newAuthenticator=function(t,e){let r=t;return t.indexOf(":")>0&&(r=t.split(":")[0]),new as(this._kerberos,r,e,this.authorizationId,this.service,this.hostNameResolver)};wi.lookupServiceResolver=function(t,e){if(!Td.lookupService)return wi.reverseDnsResolver(t,e);Td.lookupService(t,0,function(r,n){if(r)return e(r);if(!n)return e(null,t);e(null,n)})};wi.reverseDnsResolver=function(t,e){Td.reverse(t,function(r,n){if(r)return e(r);if(!n||!n.length)return e(null,t);e(null,n[0])})};wi.useIpResolver=function(t,e){e(null,t)};function as(t,e,r,n,i,s){xw.call(this,r),this.authorizationId=n,this.address=e,this.client=m3.createNew(t,n,i),this.hostNameResolver=s}c(as,"GssapiAuthenticator");ww.inherits(as,xw);as.prototype.getMechanism=function(){return v3};as.prototype.getInitialServerChallenge=function(){return Ba.allocBufferFromString(Tw)};as.prototype.initialResponse=function(t){let e=this,r=this.address;Ba.series([c(function(i){e.hostNameResolver(e.address,function(s,o){!s&&o&&(r=o),i()})},"getHostName"),c(function(i){e.client.init(r,function(s){if(s)return i(s);if(!e._isDseAuthenticator())return e.evaluateChallenge(e.getInitialServerChallenge(),i);i(null,e.getMechanism())})},"initClient")],t)};as.prototype.evaluateChallenge=function(t,e){(!t||t.toString()===Tw)&&(t=E3),this.client.evaluateChallenge(t,e)};as.prototype.onAuthenticationSuccess=function(t){this.client.shutdown(c(function(){},"noop"))};_w.exports=wi});var Ow=_((VW,Rw)=>{"use strict";var Aw=require("util"),{AuthProvider:S3}=os(),Nw=Sd(),io=oe(),C3=io.allocBufferFromString("PLAIN"),Iw=io.allocBufferFromArray([0]),Bw="PLAIN-START";function _d(t,e,r){if(typeof t!="string"||typeof e!="string")throw new TypeError("Username and password must be a string");this.username=t,this.password=e,this.authorizationId=r}c(_d,"DsePlainTextAuthProvider");Aw.inherits(_d,S3);_d.prototype.newAuthenticator=function(t,e){return new Ra(e,this.username,this.password,this.authorizationId)};function Ra(t,e,r,n){Nw.call(this,t),this.authenticatorId=io.allocBufferFromString(e),this.password=io.allocBufferFromString(r),this.authorizationId=io.allocBufferFromString(n||"")}c(Ra,"PlainTextAuthenticator");Aw.inherits(Ra,Nw);Ra.prototype.getMechanism=function(){return C3};Ra.prototype.getInitialServerChallenge=function(){return io.allocBufferFromString(Bw)};Ra.prototype.evaluateChallenge=function(t,e){if(!t||t.toString()!==Bw)return e(new Error("Incorrect SASL challenge from server"));e(null,Buffer.concat([this.authorizationId,Iw,this.authenticatorId,Iw,this.password]))};Rw.exports=_d});var Pw=_((KW,Dw)=>{"use strict";var{AuthProvider:w3,Authenticator:x3}=os(),{PlainTextAuthenticator:T3}=Ed(),_3=ze(),b3="com.datastax.bdp.cassandra.auth.DseAuthenticator",Nd=class Nd extends w3{newAuthenticator(e,r){return r===b3?new Ad:new Id(e)}};c(Nd,"NoAuthProvider");var bd=Nd,Bd=class Bd extends x3{constructor(e){super(),this.endpoint=e}initialResponse(e){e(new _3.AuthenticationError(`Host ${this.endpoint} requires authentication, but no authenticator found in the options`))}};c(Bd,"NoAuthAuthenticator");var Id=Bd,Rd=class Rd extends T3{constructor(){super("","")}};c(Rd,"TransitionalModePlainTextAuthenticator");var Ad=Rd;Dw.exports=bd});var Oa=_(($W,Lw)=>{"use strict";var{Authenticator:I3,AuthProvider:A3}=os(),{PlainTextAuthProvider:N3}=Ed(),B3=bw(),R3=Ow(),O3=Pw();Lw.exports={Authenticator:I3,AuthProvider:A3,DseGssapiAuthProvider:B3,DsePlainTextAuthProvider:R3,NoAuthProvider:O3,PlainTextAuthProvider:N3}});var ma=_(Cn=>{"use strict";var kw=require("util"),En=yu(),Sn=Ke(),Fw=oe(),D3=ld(),qw=yd(),Od=Oa(),Uw={[Sn.distance.local]:2,[Sn.distance.remote]:1,[Sn.distance.ignored]:0},Vw={[Sn.distance.local]:1,[Sn.distance.remote]:1,[Sn.distance.ignored]:0},Mw=128,Kw=2048,P3="bytes",L3=5e3,k3=1e4;function Hw(){return{policies:{addressResolution:En.defaultAddressTranslator(),loadBalancing:En.defaultLoadBalancingPolicy(),reconnection:En.defaultReconnectionPolicy(),retry:En.defaultRetryPolicy(),speculativeExecution:En.defaultSpeculativeExecutionPolicy(),timestampGeneration:En.defaultTimestampGenerator()},queryOptions:{fetchSize:5e3,prepare:!1,captureStackTrace:!1},protocolOptions:{port:9042,maxSchemaAgreementWaitSeconds:10,maxVersion:0,noCompact:!1},pooling:{heartBeatInterval:3e4,warmup:!0},socketOptions:{connectTimeout:5e3,defunctReadTimeoutThreshold:64,keepAlive:!0,keepAliveDelay:0,readTimeout:12e3,tcpNoDelay:!0,coalescingThreshold:65536},authProvider:null,requestTracker:null,metrics:new qw.DefaultMetrics,maxPrepared:500,refreshSchemaDelay:1e3,isMetadataSyncEnabled:!0,prepareOnAllHosts:!0,rePrepareOnUp:!0,encoding:{copyBuffer:!0,useUndefinedAsUnset:!0},monitorReporting:{enabled:!0}}}c(Hw,"defaultOptions");function F3(t,e){arguments.length===1&&(e=arguments[0],t={});let r=Fw.deepExtend(t,Hw(),e);if(r.cloud)q3(r);else{if(!Array.isArray(r.contactPoints)||r.contactPoints.length===0)throw new TypeError("Contacts points are not defined.");for(let n=0;n"u")throw new TypeError("BigInt is not supported by the JavaScript engine")}c(H3,"validateEncodingOptions");function $3(t){function e(r){let n=t[r];if(n!=null&&typeof n!="string")throw new TypeError(`${r} should be a String`)}if(c(e,"validateString"),e("applicationName"),e("applicationVersion"),t.id!==null&&t.id!==void 0&&!(t.id instanceof Sn.Uuid))throw new TypeError("Client id must be a Uuid")}c($3,"validateApplicationInfo");function G3(t){let e=t.monitorReporting;if(e===null||typeof e!="object")throw new TypeError(`Monitor reporting must be an object, obtained: ${e}`)}c(G3,"validateMonitorReporting");function j3(t){let e=t.controlConnection.protocolVersion,r=Vw,n=Kw;Sn.protocolVersion.uses2BytesStreamIds(e)||(r=Uw,n=Mw),t.options.queryOptions.consistency===void 0&&(t.options.queryOptions.consistency=t.metadata.isDbaas()?Sn.consistencies.localQuorum:Sn.consistencies.localOne),t.options.pooling=Fw.deepExtend({},{coreConnectionsPerHost:r,maxRequestsPerConnection:n},t.options.pooling)}c(j3,"setMetadataDependent");Cn.extend=F3;Cn.defaultOptions=Hw;Cn.coreConnectionsPerHostV2=Uw;Cn.coreConnectionsPerHostV3=Vw;Cn.maxRequestsPerConnectionV2=Mw;Cn.maxRequestsPerConnectionV3=Kw;Cn.setMetadataDependent=j3;Cn.continuousPageUnitBytes=P3;Cn.continuousPageDefaultSize=L3;Cn.continuousPageDefaultHighWaterMark=k3});var kd=_((zW,jw)=>{"use strict";var $w=oe(),Gw=Ke(),z3=fr();function Dd(t,e){if(typeof t!="string")throw new TypeError("Execution profile name must be a string");e=e||$w.emptyObject;let r=e.graphOptions||$w.emptyObject;this.name=t,this.consistency=e.consistency,this.loadBalancing=e.loadBalancing,this.readTimeout=e.readTimeout,this.retry=e.retry,this.serialConsistency=e.serialConsistency,this.graphOptions={language:r.language,results:r.results,name:r.name,readConsistency:r.readConsistency,source:r.source,writeConsistency:r.writeConsistency}}c(Dd,"ExecutionProfile");var Ld=class Ld{constructor(e){this._profiles=e.profiles||[],this._defaultConfiguredRetryPolicy=void 0,this._setDefault(e),this._loadBalancingPolicies=[],this._profilesMap={},this._customPayloadCache={},this._graphOptionsCache={},this._profiles.forEach(function(r){return this._profilesMap[r.name]=r,r.loadBalancing=r.loadBalancing||this._defaultProfile.loadBalancing,this._loadBalancingPolicies.indexOf(r.loadBalancing)===-1&&this._loadBalancingPolicies.push(r.loadBalancing),r},this)}async init(e,r){for(let n of this._loadBalancingPolicies)await z3.fromCallback(i=>n.init(e,r,i))}getDistance(e){let r=Gw.distance.ignored;for(let n=0;n{"use strict";var W3=require("events"),Su=Ke(),so=oe(),Q3=Su.FrameHeader,Ud=class Ud{constructor(e){if(!e)throw new Error("Opcode not provided");this.buffers=[],this.opcode=e,this.bodyLength=0}add(e){this.buffers.push(e),this.bodyLength+=e.length}writeShort(e){let r=so.allocBufferUnsafe(2);r.writeUInt16BE(e,0),this.add(r)}writeInt(e){let r=so.allocBufferUnsafe(4);r.writeInt32BE(e,0),this.add(r)}writeLong(e){this.add(Su.Long.toBuffer(e))}writeBytes(e){if(e===null){this.writeInt(-1);return}if(e===Su.unset){this.writeInt(-2);return}this.writeInt(e.length),this.add(e)}writeShortBytes(e){if(e===null){this.writeShort(-1);return}this.writeShort(e.length),this.add(e)}writeByte(e){this.add(so.allocBufferFromArray([e]))}writeString(e){if(typeof e>"u")throw new Error("can not write undefined");let r=Buffer.byteLength(e,"utf8"),n=so.allocBufferUnsafe(2+r);n.writeUInt16BE(r,0),n.write(e,2,n.length-2,"utf8"),this.add(n)}writeLString(e){let r=Buffer.byteLength(e,"utf8"),n=so.allocBufferUnsafe(4+r);n.writeInt32BE(r,0),n.write(e,4,n.length-4,"utf8"),this.add(n)}writeStringList(e){this.writeShort(e.length),e.forEach(this.writeString,this)}writeCustomPayload(e){let r=Object.keys(e);this.writeShort(r.length),r.forEach(n=>{this.writeString(n),this.writeBytes(e[n])})}writeStringMap(e){let r=[];for(let n in e)e.hasOwnProperty(n)&&r.push(n);this.writeShort(r.length);for(let n=0;n{this.canWrite=!0,this.run()})}push(e,r){let n=this;if(this.error)return process.nextTick(c(function(){r(n.error)},"writePushError"));this.queue.push({operation:e,callback:r}),this.run()}run(){!this.isRunning&&this.canWrite&&(this.isRunning=!0,process.nextTick(()=>this.process()))}process(){if(this.error)return;let e=[],r=[],n=0;for(;this.queue.length>0&&n{if(i){this.setWriteError(i);return}if(this.queue.length===0||!this.canWrite){this.isRunning=!1;return}setImmediate(()=>this.process())})}setWriteError(e){e.isSocketError=!0,this.error=new Su.DriverError("Socket was closed"),this.error.isSocketError=!0,this.error.requestNotWritten=!0,this.error.innerError=e;let r=this.queue;this.queue=so.emptyArray;for(let n=0;n{"use strict";var Da=oe(),Ww=Ke(),Y3=ze(),Cu="ProxyExecute",xu=class xu{constructor(){}static empty(){return new xu}getCaptureStackTrace(){}getConsistency(){}getCustomPayload(){}getFetchSize(){}getFixedHost(){}getHints(){}isAutoPage(){}isBatchCounter(){}isBatchLogged(){}isIdempotent(){}isPrepared(){}isQueryTracing(){}getKeyspace(){}getLoadBalancingPolicy(){}getPageState(){}getPreferredHost(){}getRawQueryOptions(){}getReadTimeout(){}getRetryPolicy(){}getRowCallback(){}getOrGenerateTimestamp(){}getRoutingIndexes(){}getRoutingKey(){}getRoutingNames(){}getSerialConsistency(){}getTimestamp(){}setHints(e){}setKeyspace(e){}setPageState(){}setPreferredHost(){}setRoutingIndexes(e){}setRoutingKey(e){}};c(xu,"ExecutionOptions");var wu=xu,La=class La extends wu{constructor(e,r,n){if(super(),this._queryOptions=e,this._rowCallback=n,this._routingKey=this._queryOptions.routingKey,this._hints=this._queryOptions.hints,this._keyspace=this._queryOptions.keyspace,this._routingIndexes=this._queryOptions.routingIndexes,this._pageState=typeof this._queryOptions.pageState=="string"?Da.allocBufferFromString(this._queryOptions.pageState,"hex"):this._queryOptions.pageState,this._preferredHost=null,this._client=r,this._defaultQueryOptions=r.options.queryOptions,this._profile=r.profileManager.getProfile(this._queryOptions.executionProfile),this._customPayload=La.createCustomPayload(this._queryOptions,this._defaultQueryOptions),!this._profile)throw new Y3.ArgumentError(`Execution profile "${this._queryOptions.executionProfile}" not found`)}static createCustomPayload(e,r){let n=e.customPayload||r.customPayload,i=e.executeAs||r.executeAs;return i&&(n?n[Cu]||(n=Da.extend({},n),n[Cu]=Da.allocBufferFromString(i)):(n={},n[Cu]=Da.allocBufferFromString(i))),n}static create(e,r,n){return(!e||typeof e=="function")&&(e=Da.emptyObject),new La(e,r,n)}getCaptureStackTrace(){return cs(this._queryOptions.captureStackTrace,this._defaultQueryOptions.captureStackTrace)}getConsistency(){return Pa(this._queryOptions.consistency,this._profile.consistency,this._defaultQueryOptions.consistency)}getCustomPayload(){return this._customPayload}getFetchSize(){return cs(this._queryOptions.fetchSize,this._defaultQueryOptions.fetchSize)}getFixedHost(){return this._queryOptions.host}getHints(){return this._hints}isAutoPage(){return cs(this._queryOptions.autoPage,this._defaultQueryOptions.autoPage)}isBatchCounter(){return cs(this._queryOptions.counter,!1)}isBatchLogged(){return Pa(this._queryOptions.logged,this._defaultQueryOptions.logged,!0)}isIdempotent(){return cs(this._queryOptions.isIdempotent,this._defaultQueryOptions.isIdempotent)}isPrepared(){return cs(this._queryOptions.prepare,this._defaultQueryOptions.prepare)}isQueryTracing(){return cs(this._queryOptions.traceQuery,this._defaultQueryOptions.traceQuery)}getKeyspace(){return this._keyspace}getLoadBalancingPolicy(){return this._profile.loadBalancing}getOrGenerateTimestamp(){let e=this.getTimestamp();if(e===void 0){let r=this._client.options.policies.timestampGeneration;Ww.protocolVersion.supportsTimestamp(this._client.controlConnection.protocolVersion)&&r?e=r.next(this._client):e=null}return typeof e=="number"?Ww.Long.fromNumber(e):e}getPageState(){return this._pageState}getProfile(){return this._profile}getRawQueryOptions(){return this._queryOptions}getReadTimeout(){return Pa(this._queryOptions.readTimeout,this._profile.readTimeout,this._client.options.socketOptions.readTimeout)}getRetryPolicy(){return Pa(this._queryOptions.retry,this._profile.retry,this._client.options.policies.retry)}getRoutingIndexes(){return this._routingIndexes}getRoutingKey(){return this._routingKey}getRoutingNames(){return this._queryOptions.routingNames}getRowCallback(){return this._rowCallback}getSerialConsistency(){return Pa(this._queryOptions.serialConsistency,this._profile.serialConsistency,this._defaultQueryOptions.serialConsistency)}getTimestamp(){return this._queryOptions.timestamp}setCustomPayload(e){this._customPayload=e}setHints(e){this._hints=e}setKeyspace(e){this._keyspace=e}setPageState(e){this._pageState=e}setRoutingIndexes(e){this._routingIndexes=e}setRoutingKey(e){this._routingKey=e}};c(La,"DefaultExecutionOptions");var Kd=La;function cs(t,e){return t!==void 0?t:e}c(cs,"ifUndefined");function Pa(t,e,r){return t!==void 0?t:e!==void 0?e:r}c(Pa,"ifUndefined3");Qw.exports={ExecutionOptions:wu,DefaultExecutionOptions:Kd,proxyExecuteKey:Cu}});var oo=_((JW,Z3)=>{Z3.exports={name:"cassandra-driver",version:"4.7.2",description:"DataStax Node.js Driver for Apache Cassandra",author:"DataStax",keywords:["cassandra","cql","cql3","connection","gremlin","datastax","nosql","driver","database","dse","graph","graphdb"],license:"Apache-2.0",types:"./index.d.ts",dependencies:{"@types/long":"~5.0.0","@types/node":">=8","adm-zip":"~0.5.10",long:"~5.2.3"},devDependencies:{chai:"~4.3.8",kerberos:"~2.0.3",mocha:"~10.2.0","mocha-jenkins-reporter":"~0.4.8",proxyquire:"~2.1.3",sinon:"~15.2.0",temp:">= 0.8.3"},repository:{type:"git",url:"https://github.com/datastax/nodejs-driver.git"},bugs:{url:"https://groups.google.com/a/lists.datastax.com/forum/#!forum/nodejs-driver-user"},scripts:{test:"./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive",unit:"./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive",integration_short:"./node_modules/.bin/mocha test/integration/short -R spec -t 5000 --recursive",integration_long:"./node_modules/.bin/mocha test/integration/long -R spec -t 5000 --recursive",ci_jenkins:"./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-jenkins-reporter --exit",ci_appveyor:"./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-appveyor-reporter --exit",ci_unit_appveyor:"./node_modules/.bin/mocha test/unit --recursive -R mocha-appveyor-reporter --exit",server_api:"./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit",eslint:"eslint lib test"},engines:{node:">=16"}}});var Ti=_(Qr=>{"use strict";var Xw=require("util"),{FrameWriter:Dn}=Md(),Qe=Ke(),$d=oe(),{ExecutionOptions:X3}=xi(),Yw=oo(),qr={values:1,skipMetadata:2,pageSize:4,withPagingState:8,withSerialConsistency:16,withDefaultTimestamp:32,withNameForValues:64,withKeyspace:128,withPageSizeBytes:1073741824,withContinuousPaging:2147483648},ao={withSerialConsistency:16,withDefaultTimestamp:32,withNameForValues:64,withKeyspace:128},Zw={withKeyspace:1},Hd={logged:0,unlogged:1,counter:2},ep=class ep{constructor(){this.length=0}write(e,r){throw new Error("Method must be implemented")}clone(){let e=new this.constructor,r=Object.keys(this);for(let n=0;n0?qr.pageSize:0,i|=this.options.getPageState()?qr.withPagingState:0,i|=this.options.getSerialConsistency()?qr.withSerialConsistency:0,i|=s!=null?qr.withDefaultTimestamp:0,i|=this.namedParameters?qr.withNameForValues:0;let o=n&&Qe.protocolVersion.supportsKeyspaceInRequest(r.protocolVersion);i|=o&&this.options.getKeyspace()?qr.withKeyspace:0,e.writeShort(this.consistency),Qe.protocolVersion.uses4BytesQueryFlags(r.protocolVersion)?e.writeInt(i):e.writeByte(i)}if(this.params&&this.params.length){e.writeShort(this.params.length);for(let o=0;o0))throw new TypeError(Xw.format("Invalid queries provided %s",this.queries));let n=new Dn(Qe.opcodes.batch),i=this.options.isQueryTracing()?Qe.frameFlags.tracing:0;this.options.getCustomPayload()&&(i|=Qe.frameFlags.customPayload,n.writeCustomPayload(this.options.getCustomPayload())),n.writeByte(this.type),n.writeShort(this.queries.length);let s=this;if(this.queries.forEach(c(function(a,u){let l=s.hints[u],f=a.params||$d.emptyArray,h;a.queryId?(n.writeByte(1),n.writeShortBytes(a.queryId),h=c(p=>a.meta.columns[p].type,"getParamType")):(n.writeByte(0),n.writeLString(a.query),h=l?p=>l[p]:()=>null),n.writeShort(f.length),f.forEach((p,g)=>n.writeBytes(e.encode(p,h(g))))},"eachQuery"),this),n.writeShort(this.options.getConsistency()),Qe.protocolVersion.supportsTimestamp(e.protocolVersion)){let o=this.options.getSerialConsistency()?ao.withSerialConsistency:0,a=this.options.getOrGenerateTimestamp();o|=a!=null?ao.withDefaultTimestamp:0,o|=this.options.getKeyspace()&&Qe.protocolVersion.supportsKeyspaceInRequest(e.protocolVersion)?ao.withKeyspace:0,Qe.protocolVersion.uses4BytesQueryFlags(e.protocolVersion)?n.writeInt(o):n.writeByte(o),o&ao.withSerialConsistency&&n.writeShort(this.options.getSerialConsistency()),o&ao.withDefaultTimestamp&&n.writeLong(a),o&ao.withKeyspace&&n.writeString(this.options.getKeyspace())}return this.length=n.bodyLength,n.write(e.protocolVersion,r,i)}clone(){return new _u(this.queries,this.options)}};c(_u,"BatchRequest");var Zd=_u;function Jd(t){this.streamId=null,this.operationId=t}c(Jd,"CancelRequest");Xw.inherits(Jd,Wr);Jd.prototype.write=function(t,e){let r=new Dn(Qe.opcodes.cancel);return r.writeInt(1),r.writeInt(this.operationId),r.write(t.protocolVersion,e)};var cp=class cp extends Wr{write(e,r){return new Dn(Qe.opcodes.options).write(e.protocolVersion,r,0)}clone(){return this}};c(cp,"OptionsRequest");var Xd=cp,J3=new Xd;Qr.AuthResponseRequest=Qd;Qr.BatchRequest=Zd;Qr.CancelRequest=Jd;Qr.CredentialsRequest=Yd;Qr.ExecuteRequest=Tu;Qr.PrepareRequest=jd;Qr.QueryRequest=Gd;Qr.Request=Wr;Qr.RegisterRequest=Wd;Qr.StartupRequest=zd;Qr.options=J3});var tx=_((rQ,ex)=>{"use strict";var e4=require("util"),Jw=ze(),bu=class bu{constructor(e,r,n){this._hosts=e,this._openConnections=r,this._inFlightQueries=n}getConnectedHosts(){return this._hosts}getOpenConnections(e){if(!e)throw new Jw.ArgumentError("Host is not defined");return this._openConnections[e.address]||0}getInFlightQueries(e){if(!e)throw new Jw.ArgumentError("Host is not defined");return this._inFlightQueries[e.address]||0}toString(){return e4.format('{"hosts": %j, "openConnections": %j, "inFlightQueries": %j}',this._hosts.map(function(e){return e.address}),this._openConnections,this._inFlightQueries)}static from(e){let r={},n={},i=[];return e.hosts.forEach(s=>{s.pool.connections.length!==0&&(i.push(s),r[s.address]=s.pool.connections.length,n[s.address]=s.getInFlight())}),new bu(i,r,n)}};c(bu,"ClientState");var up=bu;ex.exports=up});var fp=_((iQ,nx)=>{"use strict";var t4=rs(),rx=65536,lp=rx*rx,Yt=class Yt{constructor(e,r,n,i){this._arr=[e&65535,r&65535,n&65535,i&65535]}toString(){return this.toImmutable().toString()}compare(e){let r=this.isNegative(),n=e.isNegative();return r&&!n?-1:!r&&n?1:this._compareBits(e)}_compareBits(e){for(let r=3;r>=0;r--){if(this._arr[r]>e._arr[r])return 1;if(this._arr[r]>>0}getHighBitsUnsigned(){return(this._arr[2]|this._arr[3]<<16)>>>0}toNumber(){return(this._arr[3]<<16|this._arr[2])*lp+((this._arr[1]<<16|this._arr[0])>>>0)}not(){return this._arr[0]=~this._arr[0]&65535,this._arr[1]=~this._arr[1]&65535,this._arr[2]=~this._arr[2]&65535,this._arr[3]=~this._arr[3]&65535,this}add(e){let r=0,n=0,i=0,s=0;return s+=this._arr[0]+e._arr[0],this._arr[0]=s&65535,i+=s>>>16,i+=this._arr[1]+e._arr[1],this._arr[1]=i&65535,n+=i>>>16,n+=this._arr[2]+e._arr[2],this._arr[2]=n&65535,r+=n>>>16,r+=this._arr[3]+e._arr[3],this._arr[3]=r&65535,this}shiftLeft(e){if(e===0)return this;if(e>=64)return this.toZero();let r=e%16,n=Math.floor(e/16);return n>0&&(this._arr[3]=this._arr[3-n],this._arr[2]=n>2?0:this._arr[2-n],this._arr[1]=n>1?0:this._arr[0],this._arr[0]=0),r>0&&(this._arr[3]=(this._arr[3]<>>16-r)&65535,this._arr[2]=(this._arr[2]<>>16-r)&65535,this._arr[1]=(this._arr[1]<>>16-r)&65535,this._arr[0]=this._arr[0]<=64)return this.toZero();let r=e%16,n=Math.floor(e/16);return n>0&&(this._arr[0]=this._arr[n],this._arr[1]=n>2?0:this._arr[1+n],this._arr[2]=n>1?0:this._arr[3],this._arr[3]=0),r>0&&(this._arr[0]=this._arr[0]>>>r|this._arr[1]<<16-r&65535,this._arr[1]=this._arr[1]>>>r|this._arr[2]<<16-r&65535,this._arr[2]=this._arr[2]>>>r|this._arr[3]<<16-r&65535,this._arr[3]=this._arr[3]>>>r),this}or(e){return this._arr[0]|=e._arr[0],this._arr[1]|=e._arr[1],this._arr[2]|=e._arr[2],this._arr[3]|=e._arr[3],this}xor(e){return this._arr[0]^=e._arr[0],this._arr[1]^=e._arr[1],this._arr[2]^=e._arr[2],this._arr[3]^=e._arr[3],this}clone(){return new Yt(this._arr[0],this._arr[1],this._arr[2],this._arr[3])}multiply(e){let r=!1;if(this.isZero()||e.isZero())return this.toZero();this.isNegative()&&(this.negate(),r=!r),e.isNegative()&&(e=e.clone().negate(),r=!r);let n=0,i=0,s=0,o=0;return o+=this._arr[0]*e._arr[0],s+=o>>>16,s+=this._arr[1]*e._arr[0],i+=s>>>16,s&=65535,s+=this._arr[0]*e._arr[1],i+=s>>>16,i+=this._arr[2]*e._arr[0],n+=i>>>16,i&=65535,i+=this._arr[1]*e._arr[1],n+=i>>>16,i&=65535,i+=this._arr[0]*e._arr[2],n+=i>>>16,n+=this._arr[3]*e._arr[0]+this._arr[2]*e._arr[1]+this._arr[1]*e._arr[2]+this._arr[0]*e._arr[3],this._arr[0]=o&65535,this._arr[1]=s&65535,this._arr[2]=i&65535,this._arr[3]=n&65535,r&&this.negate(),this}toZero(){return this._arr[3]=this._arr[2]=this._arr[1]=this._arr[0]=0,this}isZero(){return this._arr[3]===0&&this._arr[2]===0&&this._arr[1]===0&&this._arr[0]===0}isNegative(){return(this._arr[3]&32768)>0}negate(){return this.not().add(Yt.one)}equals(e){return e instanceof Yt?this._arr[0]===e._arr[0]&&this._arr[1]===e._arr[1]&&this._arr[2]===e._arr[2]&&this._arr[3]===e._arr[3]:!1}toImmutable(){return t4.fromBits(this.getLowBitsUnsigned(),this.getHighBitsUnsigned(),!1)}static fromNumber(e){if(isNaN(e)||!isFinite(e))return new Yt;if(e<0)return Yt.fromNumber(-e).negate();let r=e%lp,n=e/lp;return Yt.fromBits(r,n)}static fromBits(e,r){return new Yt(e,e>>>16,r,r>>>16)}static fromString(e,r){if(typeof e!="string")throw new Error("String format is not valid: "+e);if(e.length===0)throw Error("number format error: empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return new Yt;if(r=r||10,r<2||r>36)throw Error("radix out of range: "+r);let n;if((n=e.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+e);if(n===0)return Yt.fromString(e.substring(1),r).negate();let i=Yt.fromNumber(Math.pow(r,8)),s=new Yt;for(let o=0;o{"use strict";var yp=Ke(),ix=require("util"),r4=yp.dataTypes.getByName("bigint"),n4=yp.dataTypes.getByName("varint"),i4=yp.dataTypes.getByName("blob"),mp=class mp{constructor(e){this._value=e}getType(){throw new Error("You must implement a getType function for this Token instance")}getValue(){return this._value}toString(){return this._value.toString()}compare(e){return this._value.compare(e._value)}equals(e){return this.compare(e)===0}inspect(){return this.constructor.name+" { "+this.toString()+" }"}};c(mp,"Token");var co=mp,vp=class vp extends co{constructor(e){super(e)}getType(){return r4}};c(vp,"Murmur3Token");var hp=vp,Ep=class Ep extends co{constructor(e){super(e)}getType(){return n4}};c(Ep,"RandomToken");var dp=Ep,Sp=class Sp extends co{constructor(e){super(e)}getType(){return i4}toString(){return this._value.toString("hex").toUpperCase()}};c(Sp,"ByteOrderedToken");var pp=Sp,_i=class _i{constructor(e,r,n){this.start=e,this.end=r,Object.defineProperty(this,"_tokenizer",{value:n,enumerable:!1})}splitEvenly(e){if(e<1)throw new Error(ix.format("numberOfSplits (%d) must be greater than 0.",e));if(this.isEmpty())throw new Error("Can't split empty range "+this.toString());let r=[],n=this._tokenizer.split(this.start,this.end,e),i=this.start,s;for(let o=0;o0&&!this.end.equals(this._tokenizer.minToken())}unwrap(){return this.isWrappedAround()?[new _i(this.start,this._tokenizer.minToken(),this._tokenizer),new _i(this._tokenizer.minToken(),this.end,this._tokenizer)]:[this]}contains(e){if(this.isEmpty())return!1;let r=this._tokenizer.minToken();if(this.end.equals(r))return this.start.equals(r)||e.equals(r)?!0:e.compare(this.start)>0;let n=e.compare(this.start)>0,i=e.compare(this.end)<=0;return this.isWrappedAround()?n||i:n&&i}equals(e){return e===this?!0:e instanceof _i?this.compare(e)===0:!1}compare(e){let r=this.start.compare(e.start);return r!==0?r:this.end.compare(e.end)}toString(){return ix.format("]%s, %s]",this.start.toString(),this.end.toString())}};c(_i,"TokenRange");var gp=_i;uo.Token=co;uo.TokenRange=gp;uo.ByteOrderedToken=pp;uo.Murmur3Token=hp;uo.RandomToken=dp});var ox=_(qa=>{"use strict";var Cp=oe(),sx=rs(),s4=/^[-+]?(\d{1,6})(?:-(\d{1,2}))?(?:-(\d{1,2}))?(?:T(\d{1,2}?)?(?::(\d{1,2}))?(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?Z?$/,o4=/^\[(.+?) TO (.+)]$/,Ir=Object.freeze(new mt(null,-1)),dr={singleValue:0,closedRange:1,openRangeHigh:2,openRangeLow:3,openBoth:4,openSingle:5},ct={year:0,month:1,day:2,hour:3,minute:4,second:5,millisecond:6};function Ur(t,e){if(!t)throw new TypeError("The lower boundaries must be defined");this.lowerBound=t,this.upperBound=e||null,this.upperBound===null?this.lowerBound!==Ir?this._type=dr.singleValue:this._type=dr.openSingle:this.lowerBound!==Ir?this._type=this.upperBound!==Ir?dr.closedRange:dr.openRangeHigh:this._type=this.upperBound!==Ir?dr.openRangeLow:dr.openBoth}c(Ur,"DateRange");Ur.prototype.equals=function(t){return t instanceof Ur?t.lowerBound.equals(this.lowerBound)&&(t.upperBound?t.upperBound.equals(this.upperBound):!this.upperBound):!1};Ur.prototype.toString=function(){return this.upperBound===null?this.lowerBound.toString():"["+this.lowerBound.toString()+" TO "+this.upperBound.toString()+"]"};Ur.prototype.toBuffer=function(){if(this._type===dr.openBoth||this._type===dr.openSingle)return Cp.allocBufferFromArray([this._type]);let t,e=0;if(this._type!==dr.closedRange){let r=this._type!==dr.openRangeLow?this.lowerBound:this.upperBound;return t=Cp.allocBufferUnsafe(10),t.writeUInt8(this._type,e++),e=wp(r.date,t,e),t.writeUInt8(r.precision,e),t}return t=Cp.allocBufferUnsafe(19),t.writeUInt8(this._type,e++),e=wp(this.lowerBound.date,t,e),t.writeUInt8(this.lowerBound.precision,e++),e=wp(this.upperBound.date,t,e),t.writeUInt8(this.upperBound.precision,e),t};Ur.fromString=function(t){let e=o4.exec(t);return e?new Ur(mt.toLowerBound(mt.fromString(e[1])),mt.toUpperBound(mt.fromString(e[2]))):new Ur(mt.toLowerBound(mt.fromString(t)))};Ur.fromBuffer=function(t){if(t.length===0)throw new TypeError("DateRange serialized value must have at least 1 byte");let e=t.readUInt8(0);if(e===dr.openBoth)return new Ur(Ir,Ir);if(e===dr.openSingle)return new Ur(Ir);let r=1,n,i,s=null;if(e!==dr.closedRange)return n=xp(t,r),r+=8,i=new mt(n,t.readUInt8(r)),e===dr.openRangeLow?(s=i,i=Ir):s=e===dr.openRangeHigh?Ir:null,new Ur(i,s);n=xp(t,r),r+=8,i=new mt(n,t.readUInt8(r++));let o=xp(t,r);return r+=8,s=new mt(o,t.readUInt8(r)),new Ur(i,s)};function wp(t,e,r){let n=sx.fromNumber(t.getTime());return e.writeUInt32BE(n.getHighBitsUnsigned(),r),e.writeUInt32BE(n.getLowBitsUnsigned(),r+4),r+8}c(wp,"writeDate");function xp(t,e){let r=new sx(t.readInt32BE(e+4),t.readInt32BE(e));return new Date(r.toNumber())}c(xp,"readDate");function mt(t,e){this.date=t,this.precision=e}c(mt,"DateRangeBound");mt.prototype.toString=function(){if(this.precision===-1)return"*";let t=0,e=this.date.toISOString(),r,n;for(r=4;r=ct.hour&&n===":"||n==="."){t++;continue}t6)throw new TypeError("Index out of bounds: "+t);t>this._index&&(this._index=t);let n=+e;switch(t){case ct.month:if(n<1||n>12)throw new TypeError("Month portion is not valid for date: "+r);break;case ct.day:if(n<1||n>31)throw new TypeError("Day portion is not valid for date: "+r);break;case ct.hour:if(n>23)throw new TypeError("Hour portion is not valid for date: "+r);break;case ct.minute:case ct.second:if(n>59)throw new TypeError("Minute/second portion is not valid for date: "+r);break;case ct.millisecond:if(n>999)throw new TypeError("Millisecond portion is not valid for date: "+r);break}this._values[t]=n};Tp.prototype.build=function(){let t=new Date(0),e=this._values[1];return e&&e--,t.setUTCFullYear(this._sign*this._values[0],e,this._values[2]||1),t.setUTCHours(this._values[3],this._values[4],this._values[5],this._values[6]),new mt(t,this._index)};qa.unbounded=Ir;qa.dateRangePrecision=ct;qa.DateRange=Ur;qa.DateRangeBound=mt});var bp=_(Iu=>{"use strict";var _p=ox();Iu.DateRange=_p.DateRange;Iu.DateRangeBound=_p.DateRangeBound;Iu.dateRangePrecision=_p.dateRangePrecision});var Ua=_((fQ,ax)=>{"use strict";var c4={0:"BE",1:"LE"};function ri(){}c(ri,"Geometry");ri.types={Point2D:1,LineString:2,Polygon:3};ri.getEndianness=function(t){let e=c4[t.toString()];if(typeof e>"u")throw new TypeError("Invalid endianness with code "+t);return e};ri.readInt32=function(t,e,r){return e==="BE"?t.readInt32BE(r,!0):t.readInt32LE(r,!0)};ri.readDouble=function(t,e,r){return e==="BE"?t.readDoubleBE(r,!0):t.readDoubleLE(r,!0)};ri.prototype.writeInt32=function(t,e,r){return this.useBESerialization()?e.writeInt32BE(t,r,!0):e.writeInt32LE(t,r,!0)};ri.prototype.writeDouble=function(t,e,r){return this.useBESerialization()?e.writeDoubleBE(t,r,!0):e.writeDoubleLE(t,r,!0)};ri.prototype.writeEndianness=function(t,e){return this.useBESerialization()?t.writeInt8(0,e,!0):t.writeInt8(1,e,!0)};ri.prototype.useBESerialization=function(){throw new Error("Not Implemented")};ax.exports=ri});var Au=_((dQ,ux)=>{"use strict";var cx=require("util"),u4=oe(),us=Ua();function Yr(t,e){if(typeof t!="number"||typeof e!="number")throw new TypeError("X and Y must be numbers");if(isNaN(t)||isNaN(e))throw new TypeError("X and Y must be numbers");this.x=t,this.y=e}c(Yr,"Point");cx.inherits(Yr,us);Yr.fromBuffer=function(t){if(!t||t.length!==21)throw new TypeError("2D Point buffer should contain 21 bytes");let e=us.getEndianness(t.readInt8(0,!0));if(us.readInt32(t,e,1)!==us.types.Point2D)throw new TypeError("Binary representation was not a point");return new Yr(us.readDouble(t,e,5),us.readDouble(t,e,13))};Yr.fromString=function(t){let r=/^POINT\s?\(([-0-9.]+) ([-0-9.]+)\)$/g.exec(t);if(!r||r.length!==3)throw new TypeError("2D Point WTK should contain 2 coordinates");return new Yr(parseFloat(r[1]),parseFloat(r[2]))};Yr.prototype.toBuffer=function(){let t=u4.allocBufferUnsafe(21);return this.writeEndianness(t,0),this.writeInt32(us.types.Point2D,t,1),this.writeDouble(this.x,t,5),this.writeDouble(this.y,t,13),t};Yr.prototype.equals=function(t){return t instanceof Yr?this.x===t.x&&this.y===t.y:!1};Yr.prototype.toString=function(){return cx.format("POINT (%d %d)",this.x,this.y)};Yr.prototype.useBESerialization=function(){return!1};Yr.prototype.toJSON=function(){return{type:"Point",coordinates:[this.x,this.y]}};ux.exports=Yr});var Ip=_((gQ,hx)=>{"use strict";var lx=require("util"),l4=oe(),bi=Ua(),fx=Au();function Ar(t){let e=Array.prototype.slice.call(arguments);if(e.length===1&&Array.isArray(e)&&Array.isArray(e[0])&&(e=e[0]),e.length===1)throw new TypeError("LineString can be either empty or contain 2 or more points");this.points=Object.freeze(e)}c(Ar,"LineString");lx.inherits(Ar,bi);Ar.fromBuffer=function(t){if(!t||t.length<9)throw new TypeError("A linestring buffer should contain at least 9 bytes");let e=bi.getEndianness(t.readInt8(0,!0)),r=1;if(bi.readInt32(t,e,r)!==bi.types.LineString)throw new TypeError("Binary representation was not a LineString");r+=4;let n=bi.readInt32(t,e,r);if(r+=4,t.length!==r+n*16)throw new TypeError(lx.format("Length of the buffer does not match %d !== %d",t.length,r+n*8));let i=new Array(n);for(let s=0;s0});if(s.length!==2)throw new TypeError("Invalid WKT segment: "+t);e.push(new fx(parseFloat(s[0]),parseFloat(s[1])))}return e};Ar.prototype.toBuffer=function(){let t=l4.allocBufferUnsafe(9+this.points.length*16);this.writeEndianness(t,0);let e=1;return this.writeInt32(bi.types.LineString,t,e),e+=4,this.writeInt32(this.points.length,t,e),e+=4,this.points.forEach(function(r){this.writeDouble(r.x,t,e),this.writeDouble(r.y,t,e+8),e+=16},this),t};Ar.prototype.equals=function(t){if(!(t instanceof Ar)||this.points.length!==t.points.length)return!1;for(let e=0;e{"use strict";var dx=require("util"),f4=oe(),ni=Ua(),h4=Au(),d4=Ip();function Zr(t){let e=Array.prototype.slice.call(arguments);this.rings=Object.freeze(e)}c(Zr,"Polygon");dx.inherits(Zr,ni);Zr.fromBuffer=function(t){if(!t||t.length<9)throw new TypeError("A Polygon buffer should contain at least 9 bytes");let e=ni.getEndianness(t.readInt8(0,!0)),r=1;if(ni.readInt32(t,e,r)!==ni.types.Polygon)throw new TypeError("Binary representation was not a Polygon");r+=4;let n=ni.readInt32(t,e,r);r+=4;let i=new Array(n);for(let s=0;s0&&(t+=", "),t+="("+e.map(function(n){return n.x+" "+n.y}).join(", ")+")"}),"POLYGON ("+t+")"};Zr.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.rings.map(function(t){return t.map(function(e){return[e.x,e.y]})})}};gx.exports=Zr});var Nu=_(Va=>{"use strict";Va.Geometry=Ua();Va.LineString=Ip();Va.Point=Au();Va.Polygon=yx()});var Ou=_((SQ,Nx)=>{"use strict";var ht=require("util"),xe=Ke(),U=xe.dataTypes,ls=xe.Long,lo=xe.Integer,fo=xe.BigDecimal,p4=fp(),it=oe(),mx=Fa(),{DateRange:xx}=bp(),Ru=Nu(),g4=Ru.Geometry,Tx=Ru.LineString,_x=Ru.Point,bx=Ru.Polygon,y4=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,ho={int16Zero:it.allocBufferFromArray([0,0]),int32Zero:it.allocBufferFromArray([0,0,0,0]),int8Zero:it.allocBufferFromArray([0]),int8One:it.allocBufferFromArray([1]),int8MaxValue:it.allocBufferFromArray([255])},po=typeof BigInt<"u",vx=po?BigInt(32):null,Ex=po?BigInt(8):null,Bu=po?BigInt(0):null,Sx=po?BigInt(-1):null,m4=po?BigInt(4294967295):null,Ap=po?BigInt(255):null,Ze=Object.freeze({list:"org.apache.cassandra.db.marshal.ListType",set:"org.apache.cassandra.db.marshal.SetType",map:"org.apache.cassandra.db.marshal.MapType",udt:"org.apache.cassandra.db.marshal.UserType",tuple:"org.apache.cassandra.db.marshal.TupleType",frozen:"org.apache.cassandra.db.marshal.FrozenType",reversed:"org.apache.cassandra.db.marshal.ReversedType",composite:"org.apache.cassandra.db.marshal.CompositeType",empty:"org.apache.cassandra.db.marshal.EmptyType",collection:"org.apache.cassandra.db.marshal.ColumnToCollectionType"}),At=Object.freeze({frozen:"frozen",list:"list",set:"set",map:"map",tuple:"tuple",empty:"empty",duration:"duration",vector:"vector"}),Bp=Object.freeze({"org.apache.cassandra.db.marshal.UTF8Type":U.varchar,"org.apache.cassandra.db.marshal.AsciiType":U.ascii,"org.apache.cassandra.db.marshal.UUIDType":U.uuid,"org.apache.cassandra.db.marshal.TimeUUIDType":U.timeuuid,"org.apache.cassandra.db.marshal.Int32Type":U.int,"org.apache.cassandra.db.marshal.BytesType":U.blob,"org.apache.cassandra.db.marshal.FloatType":U.float,"org.apache.cassandra.db.marshal.DoubleType":U.double,"org.apache.cassandra.db.marshal.BooleanType":U.boolean,"org.apache.cassandra.db.marshal.InetAddressType":U.inet,"org.apache.cassandra.db.marshal.SimpleDateType":U.date,"org.apache.cassandra.db.marshal.TimeType":U.time,"org.apache.cassandra.db.marshal.ShortType":U.smallint,"org.apache.cassandra.db.marshal.ByteType":U.tinyint,"org.apache.cassandra.db.marshal.DateType":U.timestamp,"org.apache.cassandra.db.marshal.TimestampType":U.timestamp,"org.apache.cassandra.db.marshal.LongType":U.bigint,"org.apache.cassandra.db.marshal.DecimalType":U.decimal,"org.apache.cassandra.db.marshal.IntegerType":U.varint,"org.apache.cassandra.db.marshal.CounterColumnType":U.counter}),v4=q4(Bp),E4=Object.keys(Bp).reduce(function(t,e){return e.length>t?e.length:t},0),dt=Object.freeze({duration:"org.apache.cassandra.db.marshal.DurationType",lineString:"org.apache.cassandra.db.marshal.LineStringType",point:"org.apache.cassandra.db.marshal.PointType",polygon:"org.apache.cassandra.db.marshal.PolygonType",dateRange:"org.apache.cassandra.db.marshal.DateRangeType",vector:"org.apache.cassandra.db.marshal.VectorType"}),Cx=it.allocBufferFromArray([255,255,255,255]),wx=it.allocBufferFromArray([255,255,255,254]),S4=new Set([U.text,U.ascii,U.varchar,U.custom,U.blob]);function Ii(t,e){this.encodingOptions=e.encoding||it.emptyObject,C4.call(this),this.setProtocolVersion(t),w4.call(this),this.encodingOptions.copyBuffer?this.handleBuffer=_4:this.handleBuffer=b4}c(Ii,"Encoder");function C4(){this.setProtocolVersion=function(r){this.protocolVersion=r,this.decodeCollectionLength=I4,this.getLengthBuffer=T4,this.collectionLengthSize=4,xe.protocolVersion.uses4BytesCollectionLength(this.protocolVersion)||(this.decodeCollectionLength=A4,this.getLengthBuffer=x4,this.collectionLengthSize=2)};let t={[dt.duration]:Ix,[dt.lineString]:N4,[dt.point]:R4,[dt.polygon]:D4,[dt.dateRange]:L4},e={[dt.duration]:Ax,[dt.lineString]:B4,[dt.point]:O4,[dt.polygon]:P4,[dt.dateRange]:k4};this.decodeBlob=function(r){return this.handleBuffer(r)},this.decodeCustom=function(r,n){if(!n||n.length===0)return this.handleBuffer(r);if(n.startsWith(dt.vector))return this.decodeVector(r,this.parseVectorTypeArgs(n,dt.vector,this.parseFqTypeName));let i=t[n];return i?i.call(this,r):this.handleBuffer(r)},this.decodeUtf8String=function(r){return r.toString("utf8")},this.decodeAsciiString=function(r){return r.toString("ascii")},this.decodeBoolean=function(r){return!!r.readUInt8(0)},this.decodeDouble=function(r){return r.readDoubleBE(0)},this.decodeFloat=function(r){return r.readFloatBE(0)},this.decodeInt=function(r){return r.readInt32BE(0)},this.decodeSmallint=function(r){return r.readInt16BE(0)},this.decodeTinyint=function(r){return r.readInt8(0)},this._decodeCqlLongAsLong=function(r){return ls.fromBuffer(r)},this._decodeCqlLongAsBigInt=function(r){return BigInt.asIntN(64,BigInt(r.readUInt32BE(0))<>vx)>>>0,0),n.writeUInt32BE(Number(r&m4),4),n},this.encodeLong=this.encodingOptions.useBigIntAsLong?this._encodeBigIntFromBigInt:this._encodeBigIntFromLong,this._encodeVarintFromInteger=function(r){typeof r=="number"&&(r=lo.fromNumber(r)),typeof r=="string"&&(r=lo.fromString(r));let n=null;if(r instanceof Buffer&&(n=r),r instanceof lo&&(n=lo.toBuffer(r)),n===null)throw new TypeError("Not a valid varint, expected Integer/Number/String/Buffer, obtained "+ht.inspect(r));return n},this._encodeVarintFromBigInt=function(r){if(typeof r=="string"&&(r=BigInt(r)),typeof r!="bigint")throw new TypeError("Not a valid varint, expected BigInt, obtained "+ht.inspect(r));if(r===Bu)return ho.int8Zero;if(r===Sx)return ho.int8MaxValue;let n=[];if(r>Bu){for(;r!==Bu;)n.unshift(Number(r&Ap)),r=r>>Ex;n[0]>127&&n.unshift(0)}else{for(;r!==Sx;)n.unshift(Number(r&Ap)),r=r>>Ex;n[0]<=127&&n.unshift(255)}return it.allocBufferFromArray(n)},this.encodeVarint=this.encodingOptions.useBigIntAsVarint?this._encodeVarintFromBigInt:this._encodeVarintFromInteger,this.encodeDecimal=function(r){typeof r=="number"?r=fo.fromNumber(r):typeof r=="string"&&(r=fo.fromString(r));let n=null;if(r instanceof fo)n=fo.toBuffer(r);else throw new TypeError("Not a valid varint, expected BigDecimal/Number/String/Buffer, obtained "+ht.inspect(r));return n},this.encodeString=function(r,n){if(typeof r!="string")throw new TypeError("Not a valid text value, expected String obtained "+ht.inspect(r));return it.allocBufferFromString(r,n)},this.encodeUtf8String=function(r){return this.encodeString(r,"utf8")},this.encodeAsciiString=function(r){return this.encodeString(r,"ascii")},this.encodeBlob=function(r){if(!(r instanceof Buffer))throw new TypeError("Not a valid blob, expected Buffer obtained "+ht.inspect(r));return r},this.encodeCustom=function(r,n){if(n.startsWith(dt.vector))return this.encodeVector(r,this.parseVectorTypeArgs(n,dt.vector,this.parseFqTypeName));let i=e[n];if(i)return i.call(this,r);throw new TypeError("No encoding handler found for type "+n)},this.encodeBoolean=function(r){return r?ho.int8One:ho.int8Zero},this.encodeInt=function(r){if(isNaN(r))throw new TypeError("Expected Number, obtained "+ht.inspect(r));let n=it.allocBufferUnsafe(4);return n.writeInt32BE(r,0),n},this.encodeSmallint=function(r){if(isNaN(r))throw new TypeError("Expected Number, obtained "+ht.inspect(r));let n=it.allocBufferUnsafe(2);return n.writeInt16BE(r,0),n},this.encodeTinyint=function(r){if(isNaN(r))throw new TypeError("Expected Number, obtained "+ht.inspect(r));let n=it.allocBufferUnsafe(1);return n.writeInt8(r,0),n},this.encodeList=function(r,n){if(!Array.isArray(r))throw new TypeError("Not a valid list value, expected Array obtained "+ht.inspect(r));if(r.length===0)return null;let i=[];i.push(this.getLengthBuffer(r));for(let s=0;s"u"||o===xe.unset)throw new TypeError("A collection can't contain null or unset values");let a=this.encode(o,n);i.push(this.getLengthBuffer(a)),i.push(a)}return Buffer.concat(i)},this.encodeSet=function(r,n){if(this.encodingOptions.set&&r instanceof this.encodingOptions.set){let i=[];return r.forEach(function(s){i.push(s)}),this.encodeList(i,n)}return this.encodeList(r,n)},this.encodeMap=function(r,n){let i=[],s=0,o=null,a=null,u=this;n&&(o=n[0],a=n[1]);function l(f,h){if(h===null||typeof h>"u"||h===xe.unset)throw new TypeError("A map can't contain null or unset keys");if(f===null||typeof f>"u"||f===xe.unset)throw new TypeError("A map can't contain null or unset values");let p=u.encode(h,o);i.push(u.getLengthBuffer(p)),i.push(p);let g=u.encode(f,a);i.push(u.getLengthBuffer(g)),g!==null&&i.push(g),s++}if(c(l,"addItem"),this.encodingOptions.map&&r instanceof this.encodingOptions.map)r.forEach(l);else for(let f in r){if(!r.hasOwnProperty(f))continue;let h=r[f];l(h,f)}return i.unshift(this.getLengthBuffer(s)),Buffer.concat(i)},this.encodeUdt=function(r,n){let i=[],s=0;for(let o=0;o, Token, or TokenRange.`)}if(!r||r.length===0)return;let a=n.getRoutingIndexes();if(n.getRoutingNames()&&(a=n.getRoutingNames().map(h=>i[h])),!a)return;let u=[],l=n.getHints()||it.emptyArray,f=i?h=>this.encode(r[h].value,l[h]):h=>this.encode(r[h],l[h]);try{s=this._encodeRoutingKeyParts(u,a,f)}catch{}s!==0&&n.setRoutingKey(Np(u,s))},this.setRoutingKeyFromMeta=function(r,n,i){let s=i.getRoutingIndexes();if(!s)return;let o=new Array(s.length),a=c(l=>{let f=r.columns[l];return this.encode(n[l],f?f.type:null)},"encodeParam"),u=0;try{u=this._encodeRoutingKeyParts(o,s,a)}catch{}u!==0&&i.setRoutingKey(Np(o,u))},this._encodeRoutingKeyParts=function(r,n,i){let s=0;for(let o=0;o"),u.length!==1)throw new TypeError("Not a valid type "+n);return a.code=U.list,a.info=await this.parseTypeName(r,u[0],0,null,o),a}if(n.indexOf(At.set,i)===i){if(i+=At.set.length+1,s-=At.set.length+2,u=Pn(n,i,s,"<",">"),u.length!==1)throw new TypeError("Not a valid type "+n);return a.code=U.set,a.info=await this.parseTypeName(r,u[0],0,null,o),a}if(n.indexOf(At.map,i)===i){if(i+=At.map.length+1,s-=At.map.length+2,u=Pn(n,i,s,"<",">"),u.length!==2)throw new TypeError("Not a valid type "+n);return a.code=U.map,a.info=await this._parseChildTypes(r,u,o),a}if(n.indexOf(At.tuple,i)===i){if(i+=At.tuple.length+1,s-=At.tuple.length+2,u=Pn(n,i,s,"<",">"),u.length<1)throw new TypeError("Not a valid type "+n);return a.code=U.tuple,a.info=await this._parseChildTypes(r,u,o),a}if(n.indexOf(At.vector,i)===i){a.code=U.custom;let p=this.parseVectorTypeArgs(n,At.vector,g=>g);return p.subtype=await this.parseTypeName(r,p.subtype),a.info=p,a}let l=n.indexOf('"',i)===i;l&&(i++,s-=2),i>0&&(n=n.substr(i,s)),l&&(n=n.replace('""','"'));let f=U[n];if(typeof f=="number")return a.code=f,a;if(n===At.duration)return a.info=dt.duration,a;if(n===At.empty)return a.info="empty",a;let h=await o(r,n);if(h)return a.code=U.udt,a.info=h,a;throw new TypeError('Not a valid type "'+n+'"')},this._parseChildTypes=function(r,n,i){return Promise.all(n.map(s=>this.parseTypeName(r,s.trim(),0,null,i)))},this.parseFqTypeName=function(r,n,i){let s={code:0,info:null,options:{reversed:!1,frozen:!1}};n=n||0;let o;if(i||(i=r.length),i>Ze.reversed.length&&r.indexOf(Ze.reversed)===n&&(n+=Ze.reversed.length+1,i-=Ze.reversed.length+2,s.options.reversed=!0),i>Ze.frozen.length&&r.indexOf(Ze.frozen,n)===n&&(n+=Ze.frozen.length+1,i-=Ze.frozen.length+2,s.options.frozen=!0),r===Ze.empty)return s.info="empty",s;if(i<=E4){n>0&&(r=r.substr(n,i));let a=Bp[r];if(typeof a=="number")return s.code=a,s;throw new TypeError('Not a valid type "'+r+'"')}if(r.indexOf(Ze.list,n)===n){if(n+=Ze.list.length+1,i-=Ze.list.length+2,o=Pn(r,n,i),o.length!==1)throw new TypeError("Not a valid type "+r);return s.code=U.list,s.info=this.parseFqTypeName(o[0]),s}if(r.indexOf(Ze.set,n)===n){if(n+=Ze.set.length+1,i-=Ze.set.length+2,o=Pn(r,n,i),o.length!==1)throw new TypeError("Not a valid type "+r);return s.code=U.set,s.info=this.parseFqTypeName(o[0]),s}if(r.indexOf(Ze.map,n)===n){if(n+=Ze.map.length+1,i-=Ze.map.length+2,o=Pn(r,n,i),o.length!==2)throw new TypeError("Not a valid type "+r);return s.code=U.map,s.info=[this.parseFqTypeName(o[0]),this.parseFqTypeName(o[1])],s}if(r.indexOf(Ze.udt,n)===n)return n+=Ze.udt.length+1,i-=Ze.udt.length+2,this._parseUdtName(r,n,i);if(r.indexOf(Ze.tuple,n)===n){if(n+=Ze.tuple.length+1,i-=Ze.tuple.length+2,o=Pn(r,n,i),o.length<1)throw new TypeError("Not a valid type "+r);return s.code=U.tuple,s.info=o.map(a=>this.parseFqTypeName(a)),s}return r.indexOf(dt.vector,n)===n?(s.code=U.custom,s.info=this.parseVectorTypeArgs(r,dt.vector,this.parseFqTypeName),s):(s.info=r.substr(n,i),s)},this.parseKeyTypes=function(r){let n=0,i=r.length,s=r.indexOf(Ze.composite)===0;s&&(n=Ze.composite.length+1,i--);let o=[],a=n,u=0,l=!1,f=!1;for(;++n0)break;l&&(a=r.indexOf(":",a)+1),o.push(r.substring(a,n)),a=n+1;break;case"(":if(u===0&&r.indexOf(Ze.collection,a)===a){l=!0,f=!0,n++,a=n;break}u++;break;case")":if(l&&u===0){o.push(r.substring(r.indexOf(":",a)+1,n)),a=n+1;break}u--;break}return athis.parseFqTypeName(h)),hasCollections:f,isComposite:s}},this._parseUdtName=function(r,n,i){let s=Pn(r,n,i);if(s.length<2)throw new TypeError("Not a valid type "+r);let o={code:U.udt,info:null},a={keyspace:s[0],name:it.allocBufferFromString(s[1],"hex").toString(),fields:[]};for(let u=2;u=4?xe.unset:null),t===xe.unset){if(!xe.protocolVersion.supportsUnset(this.protocolVersion))throw new TypeError("Unset value can not be used for this version of Cassandra, protocol version: "+this.protocolVersion);return t}if(t===null||t instanceof Buffer)return t;let r={code:null,info:null};if(e){if(typeof e=="number"?r.code=e:typeof e=="string"&&(r=U.getByName(e)),typeof e.code=="number"&&(r.code=e.code,r.info=e.info),typeof r.code!="number")throw new TypeError("Type information not valid, only String and Number values are valid hints")}else if(r=Ii.guessDataType(t),!r)throw new TypeError("Target data type could not be guessed, you should use prepared statements for accurate type mapping. Value: "+ht.inspect(t));let n=this.encoders[r.code];if(!n)throw new Error("Type not supported "+r.code);return n.call(this,t,r.info)};Ii.guessDataType=function(t){let e=null,r=null,n=typeof t;return n==="number"?e=U.double:n==="string"?(e=U.text,t.length===36&&y4.test(t)&&(e=U.uuid)):n==="boolean"?e=U.boolean:t instanceof Buffer?e=U.blob:t instanceof Date?e=U.timestamp:t instanceof ls?e=U.bigint:t instanceof lo?e=U.varint:t instanceof fo?e=U.decimal:t instanceof xe.Uuid?e=U.uuid:t instanceof xe.InetAddress?e=U.inet:t instanceof xe.Tuple?e=U.tuple:t instanceof xe.LocalDate?e=U.date:t instanceof xe.LocalTime?e=U.time:t instanceof xe.Duration?(e=U.custom,r=dt.duration):Ii.isTypedArray(t)?(e=U.custom,r=F4(dt.vector,[v4[U.float],t.length])):Array.isArray(t)?e=U.list:t instanceof g4?(e=U.custom,t instanceof Tx?r=dt.lineString:t instanceof _x?r=dt.point:t instanceof bx&&(r=dt.polygon)):t instanceof xx&&(e=U.custom,r=dt.dateRange),e===null?null:{code:e,info:r}};function x4(t){if(!t)return ho.int16Zero;let e=it.allocBufferUnsafe(2);return typeof t=="number"?e.writeUInt16BE(t,0):e.writeUInt16BE(t.length,0),e}c(x4,"getLengthBufferV2");function T4(t){if(!t)return ho.int32Zero;let e=it.allocBufferUnsafe(4);return typeof t=="number"?e.writeInt32BE(t,0):e.writeInt32BE(t.length,0),e}c(T4,"getLengthBufferV3");function _4(t){return t===null?null:it.copyBuffer(t)}c(_4,"handleBufferCopy");function b4(t){return t}c(b4,"handleBufferRef");function I4(t,e){return t.readInt32BE(e)}c(I4,"decodeCollectionLengthV3");function A4(t,e){return t.readUInt16BE(e)}c(A4,"decodeCollectionLengthV2");function Ix(t){return xe.Duration.fromBuffer(t)}c(Ix,"decodeDuration");function Ax(t){if(!(t instanceof xe.Duration))throw new TypeError("Not a valid duration, expected Duration/Buffer obtained "+ht.inspect(t));return t.toBuffer()}c(Ax,"encodeDuration");function N4(t){return Tx.fromBuffer(t)}c(N4,"decodeLineString");function B4(t){return t.toBuffer()}c(B4,"encodeLineString");function R4(t){return _x.fromBuffer(t)}c(R4,"decodePoint");function O4(t){return t.toBuffer()}c(O4,"encodePoint");function D4(t){return bx.fromBuffer(t)}c(D4,"decodePolygon");function P4(t){return t.toBuffer()}c(P4,"encodePolygon");function L4(t){return xx.fromBuffer(t)}c(L4,"decodeDateRange");function k4(t){return t.toBuffer()}c(k4,"encodeDateRange");function Pn(t,e,r,n,i){n=n||"(",i=i||")";let s=[],o=e,a=0;for(let u=e;u{"use strict";var go=require("util"),fs=oe(),me=Ke(),U4=ze(),Ma={globalTablesSpec:1,hasMorePages:2,noMetadata:4,metadataChanged:8,continuousPaging:1073741824,lastContinuousPage:2147483648},V4="Server timeout during write query at consistency %s (%d peer(s) acknowledged the write over %d required)",M4="Server timeout during batchlog write at consistency %s (%d peer(s) acknowledged the write over %d required)",K4="Server failure during write query at consistency %s (%d responses were required but only %d replicas responded, %d failed)",H4="Not enough replicas available for query at consistency %s (%d required but only %d alive)",$4="Server timeout during read query at consistency %s (%s)",G4="Server failure during read query at consistency %s (%d responses were required but only %d replicas responded, %d failed)",Op=class Op{constructor(e,r,n){this.header=e,this.opcode=e.opcode,this.offset=n||0,this.buf=r}remainingLength(){return this.buf.length-this.offset}getBuffer(){return this.buf}slice(e,r){return typeof r>"u"&&(r=this.buf.length),this.buf.slice(e,r)}unshift(e){if(this.offset>0)throw new Error("Can not modify the underlying buffer if already read");this.buf=Buffer.concat([e,this.buf],e.length+this.buf.length)}read(e){let r=this.buf.length;typeof e<"u"&&this.offset+ethis.buf.length){let r=new RangeError("Trying to access beyond buffer length");throw r.expectedLength=e,r}}readStringList(){let e=this.readShort(),r=new Array(e);for(let n=0;n0&&(n.table=i);break}}return n}readEvent(){let e=this.readString();switch(e){case me.protocolEvents.topologyChange:return{added:this.readString()==="NEW_NODE",inet:this.readInet(),eventType:e};case me.protocolEvents.statusChange:return{up:this.readString()==="UP",inet:this.readInet(),eventType:e};case me.protocolEvents.schemaChange:return this.parseSchemaChange()}return{eventType:e}}parseSchemaChange(){let e;if(!me.protocolVersion.supportsSchemaChangeFullMetadata(this.header.version))return e={eventType:me.protocolEvents.schemaChange,schemaChangeType:this.readString(),keyspace:this.readString(),table:this.readString()},e.isKeyspace=!e.table,e;switch(e={eventType:me.protocolEvents.schemaChange,schemaChangeType:this.readString(),target:this.readString(),keyspace:this.readString(),table:null,udt:null,signature:null},e.isKeyspace=e.target==="KEYSPACE",e.target){case"TABLE":e.table=this.readString();break;case"TYPE":e.udt=this.readString();break;case"FUNCTION":e.functionName=this.readString(),e.signature=this.readStringList();break;case"AGGREGATE":e.aggregate=this.readString(),e.signature=this.readStringList()}return e}};c(Op,"FrameReader");var Rp=Op;Bx.exports={FrameReader:Rp}});var Px=_(Lu=>{"use strict";var Dp=require("util"),{Transform:Pu,Writable:Ox}=require("stream"),Zt=Ke(),Dx=oe(),Ka=ze(),{FrameHeader:Du}=Zt,{FrameReader:j4}=Rx();function Ha(t){Pu.call(this,t),this.header=null,this.bodyLength=0,this.clearHeaderChunks(),this.version=0,this.headerSize=0}c(Ha,"Protocol");Dp.inherits(Ha,Pu);Ha.prototype._transform=function(t,e,r){let n=null;try{this.readItems(t)}catch(i){n=i}r(n)};Ha.prototype.readItems=function(t){if(!t||t.length===0)return;this.version===0&&(this.version=Du.getProtocolVersion(t),this.headerSize=Du.size(this.version));let e=0,r=this.header;if(this.header=null,this.headerChunks.byteLength!==0){if(this.headerChunks.parts.push(t),this.headerChunks.byteLength+t.lengtht.length-e){if(t.length-e<=0)break;let s=t.slice(e,t.length);this.headerChunks.parts.push(s),this.headerChunks.byteLength=s.length;break}r=Du.fromBuffer(t,e),e+=this.headerSize}let i=t.length-e;if(r.bodyLength<=i+this.bodyLength)n.push({header:r,chunk:t,offset:e,frameEnded:!0}),e+=r.bodyLength-this.bodyLength,this.bodyLength=0;else if(i>=0){this.header=r,this.bodyLength+=i,i>0&&n.push({header:r,chunk:t,offset:e,frameEnded:!1});break}r=null}for(let i=0;it.cellBuffer.byteLength+e.chunk.length)return t.cellBuffer.byteLength+=e.chunk.length,!1;e.chunk=Buffer.concat(t.cellBuffer.parts,t.cellBuffer.byteLength+e.chunk.length),t.cellBuffer=null}return!0};Nr.prototype.addFrameBuffer=function(t,e){if(!t.buffers){t.buffers=[e.chunk.slice(e.offset)],t.bufferLength=e.chunk.length-e.offset;return}if(e.offset>0)throw new Ka.DriverInternalError("Following chunks can not have an offset greater than zero");t.buffers.push(e.chunk),t.bufferLength+=e.chunk.length};Nr.prototype.getFrameBuffer=function(t,e){t.buffers.push(e.chunk);let r=Buffer.concat(t.buffers,t.bodyLength);return t.buffers=null,r};Nr.prototype.parseResult=function(t,e){let r,n=e.offset;try{if(!t.meta)switch(t.kind=e.readInt(),t.kind){case Zt.resultKind.voidResult:r={header:t.header,flags:t.flagsInfo};break;case Zt.resultKind.rows:t.meta=e.readMetadata(t.kind);break;case Zt.resultKind.setKeyspace:r={header:t.header,keyspaceSet:e.readString(),flags:t.flagsInfo};break;case Zt.resultKind.prepared:{let i=Dx.copyBuffer(e.readShortBytes());t.meta=e.readMetadata(t.kind),r={header:t.header,id:i,meta:t.meta,flags:t.flagsInfo};break}case Zt.resultKind.schemaChange:r={header:t.header,schemaChange:e.parseSchemaChange(),flags:t.flagsInfo};break;default:throw Ka.DriverInternalError("Unexpected result kind: "+t.kind)}}catch(i){return this.handleParsingError(i,t,e,n)}if(r)return t.emitted?void 0:(t.emitted=!0,this.push(r));e.remainingLength()>0&&this.parseRows(t,e)};Nr.prototype.parseRows=function(t,e){if(t.parsingError)return;if(t.rowLength===void 0)try{t.rowLength=e.readInt()}catch(n){return this.handleParsingError(n,t,e)}if(t.rowLength===0)return this.push({header:t.header,result:{rows:Dx.emptyArray,meta:t.meta,flags:t.flagsInfo}});let r=t.meta;t.rowIndex=t.rowIndex||0;for(let n=t.rowIndex;n{"use strict";var z4=Ke(),ku=128,Lx=7,Pp=4,W4=256,Q4=5e3,kp=class kp{constructor(e){this.currentGroup=kx(0),this.groupIndex=0,this.groups=[this.currentGroup],this.releaseTimeout=null,this.setVersion(e),this.inUse=0,this.releaseDelay=Q4}setVersion(e){this.maxGroups=z4.protocolVersion.uses2BytesStreamIds(e)?W4:1}pop(){let e=this.currentGroup.pop();if(typeof e<"u")return this.inUse++,e;for(;this.groupIndex>Lx,n=this.groups[r];n.push(e),rthis._releaseGroups(),this.releaseDelay))}_releaseGroups(){let e=0,r=this.groups.length-1;for(;e++Pp&&r>this.groupIndex&&this.groups[r].length===ku;)this.groups.pop(),r--;this.releaseTimeout=null,this._tryIssueRelease()}};c(kp,"StreamIdStack");var Lp=kp;function kx(t){let e=new Array(ku),r=t+ku-1;for(let n=0;n{"use strict";var Y4=require("util"),Ux=oe(),Vx=ze(),Mx=Ti(),Z4=Mx.ExecuteRequest,X4=Mx.QueryRequest,ii={init:0,completed:1,timedOut:2,cancelled:3},qp=class qp{constructor(e,r,n){this.request=e,this._rowCallback=r,this._callback=n,this._timeout=null,this._state=ii.init,this._rowIndex=0,this.streamId=-1}cancel(){this._state===ii.init&&(this._timeout!==null&&clearTimeout(this._timeout),this._state=ii.cancelled,this._callback=Ux.noop)}canBeWritten(){return this._state===ii.init}isByRow(){return this._rowCallback&&(this.request instanceof Z4||this.request instanceof X4)}setRequestTimeout(e,r,n,i,s){if(this._state!==ii.init)return;let o=e.getReadTimeout()!==void 0?e.getReadTimeout():r;if(!(o>0))return;let a=this;this._timeout=setTimeout(c(function(){i();let l=Y4.format("The host %s did not reply before timeout %d ms",n,o);a._markAsTimedOut(new Vx.OperationTimedOutError(l,n),s)},"requestTimedOut"),o)}setResultRow(e,r,n,i,s){if(this._markAsCompleted(),!this._rowCallback)return this.setResult(new Vx.DriverInternalError("RowCallback not found for streaming frame handler"));this._rowCallback(this._rowIndex++,e,n),this._rowIndex===n&&this._swapCallbackAndInvoke(null,{rowLength:n,meta:r,flags:i},s.bodyLength)}_markAsTimedOut(e,r){this._state===ii.init&&(this._state=ii.timedOut,this._swapCallbackAndInvoke(e,null,null,r))}_markAsCompleted(){this._state===ii.init&&(this._timeout!==null&&clearTimeout(this._timeout),this._state=ii.completed)}setResult(e,r,n){this._markAsCompleted(),this._swapCallbackAndInvoke(e,r,n)}_swapCallbackAndInvoke(e,r,n,i){let s=this._callback;this._callback=i||Ux.noop,s(e,r,n)}};c(qp,"OperationState");var Fp=qp;Kx.exports=Fp});var Kp=_((BQ,Gx)=>{"use strict";var $x=require("events"),Ga=require("util"),J4=require("tls"),eq=require("net"),tq=Ou(),{WriteQueue:rq}=Md(),yo=Ti(),Up=Px(),ja=oe(),Vr=Ke(),hs=ze(),nq=qx(),iq=Hx(),sq=fr(),{ExecutionOptions:oq}=xi(),Mp=class Mp extends $x.EventEmitter{constructor(e,r,n){if(super(),this.setMaxListeners(0),!n)throw new Error("options is not defined");if(this.endpoint=e,this.endpointFriendlyName=this.endpoint,n.sni&&(this._serverName=e,this.endpoint=`${n.sni.addressResolver.getIp()}:${n.sni.port}`,this.endpointFriendlyName=`${this.endpoint} (${this._serverName})`),!this.endpoint||this.endpoint.indexOf(":")<0)throw new Error("EndPoint must contain the ip address and port separated by : symbol");let i=this.endpoint.lastIndexOf(":");this.address=this.endpoint.substr(0,i),this.port=this.endpoint.substr(i+1),Object.defineProperty(this,"options",{value:n,enumerable:!1,writable:!1}),r===null&&(r=Vr.protocolVersion.maxSupported,n.protocolOptions.maxVersion&&(r=n.protocolOptions.maxVersion),this._checkingVersion=!0),this.log=ja.log,this.protocolVersion=r,this._operations=new Map,this._pendingWrites=[],this._preparing=new Map,this._idleTimeout=null,this.timedOutOperations=0,this._streamIds=new nq(this.protocolVersion),this._metrics=n.metrics,this.encoder=new tq(r,n),this.keyspace=null,this.emitDrain=!1,this.connected=!1,this.isSocketOpen=!1,this.send=Ga.promisify(this.sendStream),this.closeAsync=Ga.promisify(this.close),this.openAsync=Ga.promisify(this.open),this.prepareOnceAsync=Ga.promisify(this.prepareOnce)}bindSocketListeners(){this.netClient.removeAllListeners("connect"),this.netClient.removeAllListeners("timeout"),this.isSocketOpen=!0,this.netClient.on("close",()=>{this.log("info",`Connection to ${this.endpointFriendlyName} closed`),this.isSocketOpen=!1;let r=this.connected;this.close(),r&&this.emit("socketClose")}),this.protocol=new Up.Protocol({objectMode:!0}),this.parser=new Up.Parser({objectMode:!0},this.encoder);let e=new Up.ResultEmitter({objectMode:!0});e.on("result",this.handleResult.bind(this)),e.on("row",this.handleRow.bind(this)),e.on("frameEnded",this.freeStreamId.bind(this)),e.on("nodeEvent",this.handleNodeEvent.bind(this)),this.netClient.pipe(this.protocol).pipe(this.parser).pipe(e),this.writeQueue=new rq(this.netClient,this.encoder,this.options)}open(e){let r=this;if(this.log("info",`Connecting to ${this.endpointFriendlyName}`),!this.options.sslOptions)this.netClient=new eq.Socket({highWaterMark:this.options.socketOptions.coalescingThreshold}),this.netClient.connect(this.port,this.address,c(function(){r.log("verbose",`Socket connected to ${r.endpointFriendlyName}`),r.bindSocketListeners(),r.startup(e)},"connectCallback"));else{let n=ja.extend({rejectUnauthorized:!1},this.options.sslOptions);this.options.sni&&(n.servername=this._serverName),this.netClient=J4.connect(this.port,this.address,n,c(function(){r.log("verbose",`Secure socket connected to ${r.endpointFriendlyName} with protocol ${r.netClient.getProtocol()}`),r.bindSocketListeners(),r.startup(e)},"tlsConnectCallback")),this.netClient.setMaxSendFragment(this.options.socketOptions.coalescingThreshold)}this.netClient.once("error",c(function(i){r.errorConnecting(i,!1,e)},"socketError")),this.netClient.once("timeout",c(function(){let i=new Vr.DriverError("Connection timeout");r.errorConnecting(i,!0,e)},"connectTimedOut")),this.netClient.setTimeout(this.options.socketOptions.connectTimeout),this.options.socketOptions.keepAlive&&this.netClient.setKeepAlive(!0,this.options.socketOptions.keepAliveDelay),this.netClient.setNoDelay(!!this.options.socketOptions.tcpNoDelay)}startup(e){this._checkingVersion&&this.log("info","Trying to use protocol version 0x"+this.protocolVersion.toString(16));let r=this,n=new yo.StartupRequest({noCompact:this.options.protocolOptions.noCompact,clientId:this.options.id,applicationName:this.options.applicationName,applicationVersion:this.options.applicationVersion});this.sendStream(n,null,c(function(o,a){if(o&&r._checkingVersion){let u=o instanceof hs.ResponseError&&o.code===Vr.responseErrorCodes.protocolError&&o.message.indexOf("Invalid or unsupported protocol version")>=0;if(!u&&Vr.protocolVersion.canStartupResponseErrorBeWrapped(r.protocolVersion)&&(u=o instanceof hs.ResponseError&&o.code===Vr.responseErrorCodes.serverError&&o.message.indexOf("ProtocolException: Invalid or unsupported protocol version")>0),u){let l=r.protocol.version;if(l===r.protocolVersion?l=Vr.protocolVersion.getLowerSupported(r.protocolVersion):Vr.protocolVersion.isSupported(r.protocol.version)||(r.log("info",`Protocol version ${r.protocol.version} not supported by this driver, downgrading`),l=Vr.protocolVersion.getLowerSupported(r.protocol.version)),!l)return i(new Error("Connection was unable to STARTUP using protocol version "+r.protocolVersion));r.log("info","Protocol 0x"+r.protocolVersion.toString(16)+" not supported, using 0x"+l.toString(16)),r.decreaseVersion(l),setImmediate(c(function(){r.close(c(function(){r.open(e)},"decreasingVersionOpening"))},"decreasingVersionClosing"));return}}if(a&&a.mustAuthenticate)return r.startAuthenticating(a.authenticatorName,i);i(o)},"responseCallback"));function i(s){return s?r.errorConnecting(s,!1,e):r.connectionReady(e)}c(i,"startupCallback")}errorConnecting(e,r,n){this.log("warning",`There was an error when trying to connect to the host ${this.endpointFriendlyName}`,e),r&&this.netClient.destroy(),this._metrics.onConnectionError(e),n(e)}connectionReady(e){this.emit("connected"),this.connected=!0,this.netClient.removeAllListeners("error"),this.netClient.on("error",this.handleSocketError.bind(this)),e()}decreaseVersion(e){this.protocolVersion=e,this.encoder.setProtocolVersion(e),this._streamIds.setVersion(e)}handleSocketError(e){this._metrics.onConnectionError(e),this.clearAndInvokePending(e)}clearAndInvokePending(e){this._idleTimeout&&(clearTimeout(this._idleTimeout),this._idleTimeout=null),this._streamIds.clear(),this.emitDrain&&this.emit("drain");let r=new Vr.DriverError("Socket was closed");r.isSocketError=!0,e&&(r.innerError=e);let n=Array.from(this._operations.values());this._operations=new Map,n.length>0&&this.log("info","Invoking "+n.length+" pending callbacks"),ja.each(n,function(s,o){s.setResult(r),o()});let i=this._pendingWrites;this._pendingWrites=[],ja.each(i,function(s,o){s.setResult(r),o()})}startAuthenticating(e,r){if(!this.options.authProvider)return r(new hs.AuthenticationError("Authentication provider not set"));let n=this.options.authProvider.newAuthenticator(this.endpoint,e),i=this;n.initialResponse(c(function(o,a){if(o)return i.onAuthenticationError(r,o);i.authenticate(n,a,r)},"initialResponseCallback"))}authenticate(e,r,n){let i=this,s=new yo.AuthResponseRequest(r);if(this.protocolVersion===1){if(!e.username)return i.onAuthenticationError(n,new hs.AuthenticationError("Only plain text authenticator providers allowed under protocol v1"));s=new yo.CredentialsRequest(e.username,e.password)}this.sendStream(s,null,c(function(a,u){if(a){if(a instanceof hs.ResponseError&&a.code===Vr.responseErrorCodes.badCredentials){let l=new hs.AuthenticationError(a.message);l.additionalInfo=a,a=l}return i.onAuthenticationError(n,a)}if(u.ready)return e.onAuthenticationSuccess(),n();if(u.authChallenge)return e.evaluateChallenge(u.token,c(function(f,h){if(f)return i.onAuthenticationError(n,f);i.authenticate(e,h,n)},"evaluateCallback"));n(new hs.DriverInternalError("Unexpected response from Cassandra: "+Ga.inspect(u)))},"authResponseCallback"))}onAuthenticationError(e,r){this._metrics.onAuthenticationError(r),e(r)}async changeKeyspace(e){if(!e||this.keyspace===e)return;if(this.toBeKeyspace===e)return sq.fromEvent(this,"keyspaceChanged");this.toBeKeyspace=e;let r=`USE "${e}"`;try{await this.send(new yo.QueryRequest(r,null,null),null),this.keyspace=e,this.emit("keyspaceChanged",null,e)}catch(n){throw this.log("error",`Connection to ${this.endpointFriendlyName} could not switch active keyspace: ${n}`,n),this.emit("keyspaceChanged",n),n}finally{this.toBeKeyspace=null}}prepareOnce(e,r,n){let i=(r||"")+e,s=this._preparing.get(i);if(s)return s.once("prepared",n);s=new $x.EventEmitter,s.setMaxListeners(0),s.once("prepared",n),this._preparing.set(i,s),this.sendStream(new yo.PrepareRequest(e,r),null,(o,a)=>{s.emit("prepared",o,a),this._preparing.delete(i)})}sendStream(e,r,n){r=r||oq.empty();let i=new iq(e,r.getRowCallback(),(o,a,u)=>{(!o||!o.isSocketError)&&this.emit("responseDequeued"),n(o,a,u)}),s=this._getStreamId();return i.setRequestTimeout(r,this.options.socketOptions.readTimeout,this.endpoint,()=>this.timedOutOperations++,()=>this.timedOutOperations--),s===null?(this.log("info","Enqueuing "+this._pendingWrites.length+", if this message is recurrent consider configuring more connections per host or lowering the pressure"),this._pendingWrites.push(i),i):(this._write(i,s),i)}_write(e,r){e.streamId=r;let n=this;this.writeQueue.push(e,c(function(s){if(s)return n._streamIds.push(r),e.setResult(s);n.log("verbose","Sent stream #"+r+" to "+n.endpointFriendlyName),e.isByRow()&&n.parser.setOptions(r,{byRow:!0}),n._setIdleTimeout(),n._operations.set(r,e)},"writeCallback"))}_setIdleTimeout(){if(!this.options.pooling.heartBeatInterval)return;let e=this,r=this._idleTimeout;e._idleTimeout=setTimeout(()=>e._idleTimeoutHandler(),e.options.pooling.heartBeatInterval),r&&clearTimeout(r)}_idleTimeoutHandler(){if(this.sendingIdleQuery){this._idleTimeout=setTimeout(()=>this._idleTimeoutHandler(),this.options.pooling.heartBeatInterval);return}this.log("verbose",`Connection to ${this.endpointFriendlyName} idling, issuing a request to prevent disconnects`),this.sendingIdleQuery=!0,this.sendStream(yo.options,null,e=>{this.sendingIdleQuery=!1,e&&(this.log("warning","Received heartbeat request error",e),this.emit("idleRequestError",e,this))})}_getStreamId(){return this._streamIds.pop()}freeStreamId(e){let r=e.streamId;r<0||(this._operations.delete(r),this._streamIds.push(r),this.emitDrain&&this._streamIds.inUse===0&&this._pendingWrites.length===0&&this.emit("drain"),this._writeNext())}_writeNext(){if(this._pendingWrites.length===0)return;let e=this._getStreamId();if(e===null)return;let r=this,n;for(;(n=this._pendingWrites.shift())&&!n.canBeWritten(););if(!n){this._streamIds.push(e);return}setImmediate(c(function(){r._write(n,e)},"writeNextPending"))}getInFlight(){return this._streamIds.inUse}handleResult(e,r,n){let i=e.streamId;if(i<0)return this.log("verbose","event received",e);let s=this._operations.get(i);if(!s)return this.log("error","The server replied with a wrong streamId #"+i);this.log("verbose","Received frame #"+i+" from "+this.endpointFriendlyName),s.setResult(r,n,e.bodyLength)}handleNodeEvent(e,r){switch(r.eventType){case Vr.protocolEvents.schemaChange:this.emit("nodeSchemaChange",r);break;case Vr.protocolEvents.topologyChange:this.emit("nodeTopologyChange",r);break;case Vr.protocolEvents.statusChange:this.emit("nodeStatusChange",r);break}}handleRow(e,r,n,i,s){let o=e.streamId;if(o<0)return this.log("verbose","Event received",e);let a=this._operations.get(o);if(!a)return this.log("error","The server replied with a wrong streamId #"+o);a.setResultRow(r,n,i,s,e)}close(e){if(e=e||ja.noop,!this.connected&&!this.isSocketOpen||(this.connected=!1,this.removeAllListeners("drain"),this.clearAndInvokePending(),!this.isSocketOpen))return e();this.isSocketOpen=!1,this.log("verbose",`Closing connection to ${this.endpointFriendlyName}`);let r=this,n=setTimeout(()=>{this.log("info",`${this.endpointFriendlyName} did not respond to connection close within ${this.options.socketOptions.connectTimeout}ms, destroying connection`),this.netClient.destroy()},this.options.socketOptions.connectTimeout);this.netClient.once("close",function(i){clearTimeout(n),i&&r.log("info","The socket closed with a transmission error"),setImmediate(e)}),this.netClient.removeAllListeners("error"),this.netClient.on("error",i=>this.clearAndInvokePending(i)),this.netClient.end()}getLocalAddress(){if(this.netClient)return this.netClient.localAddress}};c(Mp,"Connection");var Vp=Mp;Gx.exports=Vp});var Wx=_((OQ,zx)=>{"use strict";var jx=require("util"),aq=require("events"),cq=Kp(),Fu=oe(),za=fr(),uq=ze(),lq=ma(),Wa=0,fq=Math.pow(2,15),Hp,Br={initial:0,closing:1,shuttingDown:2,shutDown:4},qu=class qu extends aq.EventEmitter{constructor(e,r){super(),this._address=e.address,this._newConnectionTimeout=null,this._state=Br.initial,this._opening=!1,this._host=e,this.responseCounter=0,this.options=e.options,this.protocolVersion=r,this.coreConnectionsLength=1,this.connections=Fu.emptyArray,this.setMaxListeners(0),this.log=Fu.log}getInFlight(){let e=this.connections.length;if(e===1)return this.connections[0].getInFlight();let r=0;for(let n=0;n=r)throw new uq.BusyConnectionError(this._address,r,this.connections.length);return n}static minInFlight(e,r,n){let i=e.length;if(i===1)return e[0];Wa++,Wa>=fq&&(Wa=0);let s;for(let o=Wa;othis.responseCounter++);let r=this;function n(){r.remove(e)}c(n,"connectionErrorCallback"),e.on("idleRequestError",n),e.on("socketClose",n)}addExistingConnection(e){this._addListeners(e),this.connections=this.connections.slice(0),this.connections.push(e)}clearNewConnectionAttempt(){this._newConnectionTimeout&&(clearTimeout(this._newConnectionTimeout),this._newConnectionTimeout=null)}async _attemptNewConnection(){if(this._opening)return await za.fromEvent(this,"open");this._opening=!0;let e=this._createConnection(),r;try{await e.openAsync()}catch(n){r=n,this.log("warning",`Connection to ${this._address} could not be created: ${r}`,r)}if(this.isClosing()&&(this.log("info",`Connection to ${this._address} opened successfully but pool was being closed`),r=new Error("Connection closed")),r)za.toBackground(e.closeAsync());else{let n=this.connections.slice(0);n.push(e),this.connections=n,this.log("info",`Connection to ${this._address} opened successfully`)}if(this._opening=!1,this.emit("open",r,e),r)throw r}attemptNewConnectionImmediate(){let e=this;function r(){e.clearNewConnectionAttempt(),e.scheduleNewConnectionAttempt(0)}if(c(r,"openConnection"),this._state===Br.initial)return r();if(this._state===Br.closing)return this.once("close",r)}remove(e){let r=this.connections.indexOf(e);if(r<0)return;let n=this.connections.slice(0);n.splice(r,1),this.connections=n,setImmediate(c(function(){e.close()},"removeClose")),this.emit("remove")}scheduleNewConnectionAttempt(e){if(this.isClosing())return;let r=this;this._newConnectionTimeout=setTimeout(c(function(){if(r._newConnectionTimeout=null,!(r.connections.length>=r.coreConnectionsLength)){if(e>0&&r.options.sni){za.toBackground(r.options.sni.addressResolver.refresh().then(()=>r._attemptNewConnection()));return}za.toBackground(r._attemptNewConnection())}},"newConnectionTimeoutExpired"),e)}hasScheduledNewConnection(){return!!this._newConnectionTimeout||this._opening}increaseSize(){this.connections.lengthr.closeAsync())))}};c(qu,"HostConnectionPool");var $p=qu;function hq(){return Hp===void 0&&(Hp=lq.defaultOptions()),Hp}c(hq,"getDefaultOptions");zx.exports=$p});var zp=_((PQ,Zx)=>{"use strict";var Gp=ze(),Qx=oe(),dq=Ke(),Yx=fr(),Xr=class Xr{constructor(e,r){this._client=e,this._loadBalancing=r,this.logEmitter=e.options.logEmitter,this.log=Qx.log}static async getPrepared(e,r,n,i){let s=e.metadata.getPreparedInfo(i,n);return s.queryId?s:s.preparing?await Yx.fromEvent(s,"prepared"):await new Xr(e,r)._prepare(s,n,i)}static async getPreparedMultiple(e,r,n,i){let s=[];for(let o of n){let a;if(o&&(a=typeof o=="string"?o:o.query),typeof a!="string")throw new Gp.ArgumentError("Query item should be a string");let{queryId:u,meta:l}=await Xr.getPrepared(e,r,a,i);s.push({query:a,params:Qx.adaptNamedParamsPrepared(o.params,l.columns),queryId:u,meta:l})}return s}async _prepare(e,r,n){e.preparing=!0;let i;try{return i=await Yx.newQueryPlan(this._loadBalancing,n,null),await this._prepareWithQueryPlan(e,i,r,n)}catch(s){throw e.preparing=!1,s.query=r,e.emit("prepared",s),s}}async _prepareWithQueryPlan(e,r,n,i){let s={};for(;;){let o=Xr.getNextHost(r,this._client.profileManager,s);if(o===null)throw new Gp.NoHostAvailableError(s);try{let u=await(await Xr._borrowWithKeyspace(o,i)).prepareOnceAsync(n,i);return this._client.options.prepareOnAllHosts&&await this._prepareOnAllHosts(r,n,i),e.preparing=!1,e.queryId=u.id,e.meta=u.meta,this._client.metadata.setPreparedById(e),e.emit("prepared",null,e),e}catch(a){if(s[o.address]=a,!a.isSocketError&&!(a instanceof Gp.OperationTimedOutError))throw a}}}static getNextHost(e,r,n){let i;for(;;){let s=e.next();if(s.done)return null;if(i=s.value,r.getDistance(i)!==dq.distance.ignored){if(i.isUp())break;n&&(n[i.address]="Host considered as DOWN")}}return i}static async prepareAllQueries(e,r){let n=[],i=new Map;r.forEach(s=>{let o;s.keyspace?(o=i.get(s.keyspace),o||(o=[],i.set(s.keyspace,o))):o=n,o.push(s.query)});for(let[s,o]of i)await Xr._borrowAndPrepare(e,s,o);await Xr._borrowAndPrepare(e,null,n)}static async _borrowAndPrepare(e,r,n){if(n.length===0)return;let i=await Xr._borrowWithKeyspace(e,r);for(let s of n)await i.prepareOnceAsync(s,r)}static async _borrowWithKeyspace(e,r){let n=e.borrowConnection();return r&&n.keyspace!==r&&await n.changeKeyspace(r),n}_prepareOnAllHosts(e,r,n){let i=[r],s,o=[];for(;(s=Xr.getNextHost(e,this._client.profileManager))!==null;)o.push(s);return Promise.all(o.map(a=>Xr._borrowAndPrepare(a,n,i).catch(u=>this.log("verbose",`Unexpected error while preparing query (${r}) on ${a.address}`,u))))}};c(Xr,"PrepareHandler");var jp=Xr;Zx.exports=jp});var eT=_((kQ,Jx)=>{"use strict";var Xx=require("events"),Uu=oe(),Vu=Ke(),pq=Wx(),gq=zp(),yq=fr(),mq=200,Yp=class Yp extends Xx.EventEmitter{constructor(e,r,n,i){super(),this.address=e,this.setDownAt=0,this.log=Uu.log,this.isUpSince=null,Object.defineProperty(this,"options",{value:n,enumerable:!1,writable:!1}),Object.defineProperty(this,"pool",{value:new pq(this,r),enumerable:!1}),this.pool.on("open",s=>yq.toBackground(this._onNewConnectionOpen(s))),this.pool.on("remove",()=>this._checkPoolState()),this.cassandraVersion=null,this.datacenter=null,this.rack=null,this.tokens=null,this.hostId=null,this.dseVersion=null,this.workloads=Uu.emptyArray,this._distance=Vu.distance.ignored,this._healthResponseCounter=0,Object.defineProperty(this,"_metadata",{value:i,enumerable:!1}),Object.defineProperty(this,"_healthResponseCountTimer",{value:null,enumerable:!1,writable:!0}),this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),this.reconnectionDelay=0}setDown(){this.setDownAt===0&&(this.pool.isClosing()||(this.setDownAt=Date.now(),this.pool.coreConnectionsLength>0?this.log("warning",`Host ${this.address} considered as DOWN. Reconnection delay ${this.reconnectionDelay}ms.`):this.log("info",`Host ${this.address} considered as DOWN.`),this.emit("down"),this._checkPoolState()))}setUp(e){this.setDownAt&&(this.log("info",`Setting host ${this.address} as UP`),this.setDownAt=0,this.isUpSince=Date.now(),this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),e&&this.pool.clearNewConnectionAttempt(),this.emit("up"))}checkIsUp(){this.isUp()||(this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),this.reconnectionDelay=0,this.pool.attemptNewConnectionImmediate())}shutdown(e){return this._healthResponseCountTimer&&clearInterval(this._healthResponseCountTimer),e?(this.pool.drainAndShutdown(),Promise.resolve()):this.pool.shutdown()}isUp(){return!this.setDownAt}canBeConsideredAsUp(){let e=this;function r(){return new Date().getTime()-e.setDownAt>=e.reconnectionDelay}return c(r,"hasTimePassed"),!this.setDownAt||r()}setDistance(e){let r=this._distance;return this._distance=e||Vu.distance.local,this.options.pooling.coreConnectionsPerHost?this.pool.coreConnectionsLength=this.options.pooling.coreConnectionsPerHost[this._distance]||0:this.pool.coreConnectionsLength=1,this._distance===r?this._distance:(this._healthResponseCountTimer&&clearInterval(this._healthResponseCountTimer),this._distance===Vu.distance.ignored?(this.emit("ignore"),this.pool.drainAndShutdown()):(this.isUp()||this.checkIsUp(),this._healthResponseCountTimer=setInterval(()=>{this._healthResponseCounter=this.pool.getAndResetResponseCounter()},mq)),this._distance)}setProtocolVersion(e){this.pool.protocolVersion=e}borrowConnection(e){return this.pool.borrowConnection(e)}warmupPool(e){return this.pool.warmup(e)}initializePool(){this.pool.increaseSize()}getActiveConnection(){return!this.isUp()||!this.pool.connections.length?null:this.pool.connections[0]}getResponseCount(){return this._healthResponseCounter+this.pool.responseCounter}checkHealth(e){e.timedOutOperations<=this.options.socketOptions.defunctReadTimeoutThreshold||this.removeFromPool(e)}removeFromPool(e){this.pool.remove(e),this._checkPoolState()}getInFlight(){return this.pool.getInFlight()}_checkPoolState(){if(this.pool.isClosing())return;this.pool.connections.length0&&this.pool.connections.length===0&&this.setDown()}async _onNewConnectionOpen(e){if(e){this._checkPoolState();return}if(!this.isUp()&&this.options.rePrepareOnUp){this.log("info",`Re-preparing all queries on host ${this.address} before setting it as UP`);let r=this._metadata.getAllPrepared();try{await gq.prepareAllQueries(this,r)}catch(n){this.log("warning",`Failed re-preparing on host ${this.address}: ${n}`,n)}}this.setUp(),this.pool.increaseSize()}getCassandraVersion(){return this.cassandraVersion?this.cassandraVersion.split("-")[0].split(".").map(e=>parseInt(e,10)):Uu.emptyArray}getDseVersion(){return this.dseVersion?this.dseVersion.split("-")[0].split(".").map(e=>parseInt(e,10)):Uu.emptyArray}};c(Yp,"Host");var Wp=Yp,Zp=class Zp extends Xx.EventEmitter{constructor(){super(),this._items=new Map,this._values=null,Object.defineProperty(this,"length",{get:()=>this.values().length,enumerable:!0})}forEach(e){let r=this._items;for(let[n,i]of r)e(i,n)}get(e){return this._items.get(e)}keys(){return Array.from(this._items.keys())}remove(e){let r=this._items.get(e);if(r===void 0)return;this._values=null;let n=new Map(this._items);n.delete(e),this._items=n,this.emit("remove",r)}removeMultiple(e){this._values=null;let r=new Map(this._items),n=[];for(let i of e){let s=r.get(i);s&&(n.push(s),r.delete(i))}this._items=r,n.forEach(i=>this.emit("remove",i))}set(e,r){this._values=null;let n=this._items.get(e);if(n){this._items.set(e,r),this.emit("remove",n),this.emit("add",r);return}let i=new Map(this._items);return i.set(e,r),this._items=i,this.emit("add",r),r}slice(e,r){return!e&&!r?this.values():this.values().slice(e||0,r)}push(e,r){this.set(e,r)}values(){return this._values||(this._values=Object.freeze(Array.from(this._items.values()))),this._values}clear(){let e=this.values();return this._values=null,this._items=new Map,e.forEach(r=>this.emit("remove",r)),e}inspect(){return this._items}toJSON(){if(Object.fromEntries)return Object.fromEntries(this._items);let e={};for(let[r,n]of this._items)e[r]=n;return e}};c(Zp,"HostMap");var Qp=Zp;Jx.exports={Host:Wp,HostMap:Qp}});var rT=_(Hu=>{"use strict";var vq=Ke(),Ai=Fa(),Xp=oe(),vt=fp(),{Integer:Ht}=vq,Mu=new vt(21461,4418,31633,34755),Ku=new vt(37759,10053,44355,19701),tT=vt.fromNumber(5),Eq=new vt(36045,60757,45015,65361),Sq=new vt(60499,6789,47614,50382),Cq=vt.fromNumber(1390208809),wq=vt.fromNumber(944331445),r0=class r0{constructor(){}hash(e){throw new Error("You must implement a hash function for the tokenizer")}parse(e){throw new Error("You must implement a parse function for the tokenizer")}minToken(){throw new Error("You must implement a minToken function for the tokenizer")}split(e,r,n){throw new Error("You must implement a split function for the tokenizer")}splitBase(e,r,n,i,s){let o=Ht.fromInt(s),a=r.divide(o),u=r.modulo(o),l=[],f=e,h=a.add(Ht.ONE);for(let p=1;p>4,o=new vt,a=new vt,u=new vt,l=new vt;for(let f=0;f>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0)),e.multiply(Eq);let r=new vt(e.getUint16(2)>>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0);e.xor(r),e.multiply(Sq),e.xor(new vt(e.getUint16(2)>>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0))}parse(e){return new Ai.Murmur3Token(vt.fromString(e))}minToken(){return this._minToken||(this._minToken=this.parse("-9223372036854775808")),this._minToken}maxToken(){return this._maxToken||(this._maxToken=this.parse("9223372036854775807")),this._maxToken}maxValue(){return this._maxValue||(this._maxValue=Ht.fromString("9223372036854775807")),this._maxValue}minValue(){return this._minValue||(this._minValue=Ht.fromString("-9223372036854775808")),this._minValue}ringLength(){return this._ringLength||(this._ringLength=this.maxValue().subtract(this.minValue())),this._ringLength}split(e,r,n){e.equals(r)&&e.equals(this.minToken())&&(r=this.maxToken());let i=Ht.fromString(e.getValue().toString()),o=Ht.fromString(r.getValue().toString()).subtract(i);return o.isNegative()&&(o=o.add(this.ringLength())),this.splitBase(i,o,this.maxValue(),this.ringLength(),n).map(u=>this.parse(u.toString()))}stringify(e){let r=e.getValue();return r.getUint16(0)+","+r.getUint16(1)+","+r.getUint16(2)+","+r.getUint16(3)}};c(n0,"Murmur3Tokenizer");var Jp=n0,i0=class i0 extends Qa{constructor(){super(),this._crypto=require("crypto")}hash(e){Array.isArray(e)&&(e=Xp.allocBufferFromArray(e));let r=this._crypto.createHash("md5").update(e).digest();return new Ai.RandomToken(Ht.fromBuffer(r).abs())}parse(e){return new Ai.RandomToken(Ht.fromString(e))}minToken(){return this._minToken||(this._minToken=this.parse("-1")),this._minToken}maxValue(){return this._maxValue||(this._maxValue=Ht.fromNumber(Math.pow(2,127))),this._maxValue}maxToken(){return this._maxToken||(this._maxToken=new Ai.RandomToken(this.maxValue())),this._maxToken}ringLength(){return this._ringLength||(this._ringLength=this.maxValue().add(Ht.ONE)),this._ringLength}split(e,r,n){e.equals(r)&&e.equals(this.minToken())&&(r=this.maxToken());let i=e.getValue(),o=r.getValue().subtract(i);return o.lessThan(Ht.ZERO)&&(o=o.add(this.ringLength())),this.splitBase(i,o,this.maxValue(),this.ringLength(),n).map(u=>new Ai.RandomToken(u))}};c(i0,"RandomTokenizer");var e0=i0,s0=class s0 extends Qa{constructor(){super()}hash(e){Array.isArray(e)&&(e=Xp.allocBufferFromArray(e));let r=e.length;for(let n=e.length-1;n>0&&e[n]===0;n--)r=n;return new Ai.ByteOrderedToken(e.slice(0,r))}stringify(e){return e.getValue().toString("hex")}parse(e){return this.hash(Xp.allocBufferFromString(e,"hex"))}minToken(){return this._minToken||(this._minToken=this.hash([])),this._minToken}_toNumber(e,r){let n=e;e.length!==r&&(n=Buffer.alloc(r),e.copy(n));let i=new Array(Math.ceil(n.length/4));for(let s=0;s=0);)h+=1,g+=1}else{let g=0;for(;s=this._toNumber(e.getValue(),h),o=this._toNumber(r.getValue(),h),u=Ht.fromNumber(Math.pow(2,h*8)),l=u.subtract(Ht.ONE),a=o.subtract(s).add(u),!(g===4||a.compare(f)>=0);)h+=1,g+=1}return this.splitBase(s,a,l,u,n).map(g=>new Ai.ByteOrderedToken(this._toBuffer(g,h)))}};c(s0,"ByteOrderedTokenizer");var t0=s0;function pr(t){return t<128?new vt(t,0,0,0):new vt(t-256&65535,65535,65535,65535)}c(pr,"fromSignedByte");Hu.Murmur3Tokenizer=Jp;Hu.RandomTokenizer=e0;Hu.ByteOrderedTokenizer=t0});var o0=_((VQ,sT)=>{"use strict";var xq=require("util"),nT=require("events");function iT(t){nT.EventEmitter.call(this),this.setMaxListeners(0),Object.defineProperty(this,"loading",{value:!1,enumerable:!1,writable:!0}),Object.defineProperty(this,"loaded",{value:!1,enumerable:!1,writable:!0}),this.name=t,this.bloomFilterFalsePositiveChance=0,this.caching=null,this.comment=null,this.gcGraceSeconds=0,this.compactionClass=null,this.compactionOptions=null,this.compression=null,this.localReadRepairChance=0,this.readRepairChance=0,this.extensions=null,this.crcCheckChance=null,this.populateCacheOnFlush=!1,this.defaultTtl=0,this.speculativeRetry="NONE",this.minIndexInterval=128,this.maxIndexInterval=2048,this.columns=null,this.columnsByName=null,this.partitionKeys=[],this.clusteringKeys=[],this.clusteringOrder=[],this.nodesync=null}c(iT,"DataCollection");xq.inherits(iT,nT.EventEmitter);sT.exports=iT});var uT=_((KQ,cT)=>{"use strict";var Tq=require("util"),oT=o0();function aT(t){oT.call(this,t),this.replicateOnWrite=!0,this.memtableFlushPeriod=0,this.indexInterval=null,this.isCompact=!1,this.indexes=null,this.cdc=null,this.virtual=!1}c(aT,"TableMetadata");Tq.inherits(aT,oT);cT.exports=aT});var fT=_(($Q,lT)=>{"use strict";function _q(){this.name=null,this.keyspaceName=null,this.signature=null,this.argumentTypes=null,this.stateFunction=null,this.stateType=null,this.finalFunction=null,this.initConditionRaw=null,this.initCondition=null,this.returnType=null,this.deterministic=null}c(_q,"Aggregate");lT.exports=_q});var dT=_((jQ,hT)=>{"use strict";function bq(){this.name=null,this.keyspaceName=null,this.signature=null,this.argumentNames=null,this.argumentTypes=null,this.body=null,this.calledOnNullInput=null,this.language=null,this.returnType=null,this.deterministic=null,this.monotonic=null,this.monotonicOn=null}c(bq,"SchemaFunction");hT.exports=bq});var gT=_((WQ,pT)=>{"use strict";var a0=require("util"),Iq=oe(),c0=Ke(),Ya={custom:0,keys:1,composites:2};function Ni(t,e,r,n){this.name=t,this.target=e,this.kind=typeof r=="string"?u0(r):r,this.options=n}c(Ni,"Index");Ni.prototype.isCompositesKind=function(){return this.kind===Ya.composites};Ni.prototype.isKeysKind=function(){return this.kind===Ya.keys};Ni.prototype.isCustomKind=function(){return this.kind===Ya.custom};Ni.fromRows=function(t){return!t||t.length===0?Iq.emptyArray:t.map(function(e){let r=e.options;return new Ni(e.index_name,r.target,u0(e.kind),r)})};Ni.fromColumnRows=function(t,e){let r=[];for(let n=0;n{"use strict";var Aq=require("util"),yT=o0();function mT(t){yT.call(this,t),this.tableName=null,this.whereClause=null,this.includeAllColumns=!1}c(mT,"MaterializedView");Aq.inherits(mT,yT);vT.exports=mT});var NT=_(h0=>{"use strict";var Za=require("util"),ST=require("events"),Nq=Ke(),Xt=oe(),Bq=ze(),$u=fr(),Rq=uT(),xT=fT(),TT=dT(),_T=gT(),CT=ET(),{format:ds}=Za,Oq="SELECT * FROM system.schema_keyspaces",Dq="SELECT * FROM system.schema_keyspaces where keyspace_name = '%s'",bT="SELECT * FROM system_schema.keyspaces",IT="SELECT * FROM system_schema.keyspaces where keyspace_name = '%s'",Pq="SELECT * FROM system.schema_columnfamilies WHERE keyspace_name='%s' AND columnfamily_name='%s'",Lq="SELECT * FROM system_schema.tables WHERE keyspace_name='%s' AND table_name='%s'",kq="SELECT * FROM system.schema_columns WHERE keyspace_name='%s' AND columnfamily_name='%s'",Fq="SELECT * FROM system_schema.columns WHERE keyspace_name='%s' AND table_name='%s'",qq="SELECT * FROM system_schema.indexes WHERE keyspace_name='%s' AND table_name='%s'",Uq="SELECT * FROM system.schema_usertypes WHERE keyspace_name='%s' AND type_name='%s'",Vq="SELECT * FROM system_schema.types WHERE keyspace_name='%s' AND type_name='%s'",Mq="SELECT * FROM system.schema_functions WHERE keyspace_name = '%s' AND function_name = '%s'",Kq="SELECT * FROM system_schema.functions WHERE keyspace_name = '%s' AND function_name = '%s'",Hq="SELECT * FROM system.schema_aggregates WHERE keyspace_name = '%s' AND aggregate_name = '%s'",$q="SELECT * FROM system_schema.aggregates WHERE keyspace_name = '%s' AND aggregate_name = '%s'",Gq="SELECT * FROM system_schema.views WHERE keyspace_name = '%s' AND view_name = '%s'",jq="SELECT * FROM system_virtual_schema.keyspaces",zq="SELECT * FROM system_virtual_schema.keyspaces where keyspace_name = '%s'",wT="SELECT * FROM system_virtual_schema.tables where keyspace_name = '%s' and table_name='%s'",Wq="SELECT * FROM system_virtual_schema.columns where keyspace_name = '%s' and table_name='%s'",d0=class d0{constructor(e,r){this.cc=r,this.encodingOptions=e.encoding,this.selectTable=null,this.selectColumns=null,this.selectIndexes=null,this.selectUdt=null,this.selectAggregates=null,this.selectFunctions=null,this.supportsVirtual=!1}_createKeyspace(e,r,n,i,s){return{name:e,durableWrites:r,strategy:n,strategyOptions:i,virtual:s===!0,udts:{},tables:{},functions:{},aggregates:{},views:{},tokenToReplica:Zq(n,i),graphEngine:void 0}}getKeyspace(e){}getKeyspaces(e){}async getTable(e,r,n,i){let s=n&&n[r];if(s||(s=new Rq(r),n&&(n[r]=s)),s.loaded)return s;if(s.loading)return $u.fromEvent(s,"load");try{s.loading=!0;let o,a=i,u=a?wT:this.selectTable,l=Za.format(u,e,r),f=await this._getFirstRow(l);if(!f&&this.supportsVirtual&&a===void 0){let g=Za.format(wT,e,r);try{f=await this._getFirstRow(g)}catch{}f&&(a=!0)}if(!f)return s.loading=!1,s.emit("load",null,null),null;let h=a?Wq:this.selectColumns,p=await this._getRows(Za.format(h,e,r));return this.selectIndexes&&!a&&(o=await this._getRows(Za.format(this.selectIndexes,e,r))),await this._parseTableOrView(s,f,p,o,a),s.loaded=!0,s.emit("load",null,s),s}catch(o){throw s.emit("load",o,null),o}finally{s.loading=!1}}async _getFirstRow(e){return(await this._getRows(e))[0]}async _getRows(e){return(await this.cc.query(e)).rows}async getUdt(e,r,n){let i=n&&n[r];if(i||(i=new ST.EventEmitter,n&&(n[r]=i),i.setMaxListeners(0),i.loading=!1,i.name=r,i.keyspace=e,i.fields=null),i.fields)return i;if(i.loading)return $u.fromEvent(i,"load");i.loading=!0;let s=ds(this.selectUdt,e,r);try{let o=await this._getFirstRow(s);return o?(await this._parseUdt(i,o),i.emit("load",null,i),i):(i.loading=!1,i.emit("load",null,null),null)}catch(o){throw i.emit("load",o),o}finally{i.loading=!1}}_parseUdt(e,r){}async _parseTableOrView(e,r,n,i,s){}getMaterializedView(e,r,n){}async getFunctions(e,r,n,i){let s=this.selectFunctions,o=c(u=>this._parseFunction(u),"parser");n&&(s=this.selectAggregates,o=c(u=>this._parseAggregate(u),"parser"));let a=i&&i[r];if(a||(a=new ST.EventEmitter,i&&(i[r]=a),a.setMaxListeners(0)),a.values)return a.values;if(a.loading)return $u.fromEvent(a,"load");a.loading=!0;try{let u=await this._getRows(ds(s,e,r)),l=await Promise.all(u.map(o)),f=new Map;return u.length>0&&(a.values=f),l.forEach(h=>a.values.set(h.signature.join(","),h)),a.emit("load",null,f),f}catch(u){throw a.emit("load",u),u}finally{a.loading=!1}}_parseAggregate(e){}_parseFunction(e){}_asMap(e){return e?this.encodingOptions.map&&e instanceof this.encodingOptions.map?e:new Map(Object.keys(e).map(r=>[r,e[r]])):new Map}_mapAsObject(e){if(!e)return e;if(this.encodingOptions.map&&e instanceof this.encodingOptions.map){let r={};return e.forEach((n,i)=>r[i]=n),r}return e}};c(d0,"SchemaParser");var Gu=d0,p0=class p0 extends Gu{constructor(e,r){super(e,r),this.selectTable=Pq,this.selectColumns=kq,this.selectUdt=Uq,this.selectAggregates=Hq,this.selectFunctions=Mq}async getKeyspaces(e){let r={},n=await this.cc.query(Oq,e);for(let i=0;i0&&(e.partitionKeys=h.sort(Xt.propCompare("index")).map(y=>y.c),p.sort(Xt.propCompare("index")),e.clusteringKeys=p.map(y=>y.c),e.clusteringOrder=p.map(y=>y.order));let g=e.partitionKeys.length===0;if(g&&r.key_aliases){h=JSON.parse(r.key_aliases),u=l.parseKeyTypes(r.key_validator).types;for(let y=0;yr.parseFqTypeName(s)),n.stateType=r.parseFqTypeName(e.state_type);let i=r.decode(n.initConditionRaw,n.stateType);return i!==null&&typeof i<"u"&&(n.initCondition=i.toString()),n.returnType=r.parseFqTypeName(e.return_type),n}async _parseFunction(e){let r=this.cc.getEncoder(),n=new TT;return n.name=e.function_name,n.keyspaceName=e.keyspace_name,n.signature=e.signature||Xt.emptyArray,n.argumentNames=e.argument_names||Xt.emptyArray,n.body=e.body,n.calledOnNullInput=e.called_on_null_input,n.language=e.language,n.argumentTypes=(e.argument_types||Xt.emptyArray).map(i=>r.parseFqTypeName(i)),n.returnType=r.parseFqTypeName(e.return_type),n}async _parseUdt(e,r){let n=this.cc.getEncoder(),i=r.field_names,s=r.field_types,o=new Array(i.length);for(let a=0;a{let w=await o.parseTypeName(r.keyspace_name,m.type,0,null,this.udtResolver),x={name:m.column_name,type:w,isStatic:!1};switch(a[x.name]=x,m.kind){case"partition_key":u.push({c:x,index:m.position||0});break;case"clustering":l.push({c:x,index:m.position||0,order:m.clustering_order==="desc"?"DESC":"ASC"});break;case"static":x.isStatic=!0;break}return x})),e.columnsByName=a,e.partitionKeys=u.sort(Xt.propCompare("index")).map(m=>m.c),l.sort(Xt.propCompare("index")),e.clusteringKeys=l.map(m=>m.c),e.clusteringOrder=l.map(m=>m.order),s){e.virtual=!0;return}let f=e instanceof CT;e.bloomFilterFalsePositiveChance=r.bloom_filter_fp_chance,e.caching=JSON.stringify(r.caching),e.comment=r.comment;let h=this._asMap(r.compaction);if(h&&(e.compactionOptions={},e.compactionClass=h.get("class"),h.forEach((m,w)=>{w!=="class"&&(e.compactionOptions[w]=h.get(w))})),e.compression=this._mapAsObject(r.compression),e.gcGraceSeconds=r.gc_grace_seconds,e.localReadRepairChance=r.dclocal_read_repair_chance,e.readRepairChance=r.read_repair_chance,e.extensions=this._mapAsObject(r.extensions),e.crcCheckChance=r.crc_check_chance,e.memtableFlushPeriod=r.memtable_flush_period_in_ms||e.memtableFlushPeriod,e.defaultTtl=r.default_time_to_live||e.defaultTtl,e.speculativeRetry=r.speculative_retry||e.speculativeRetry,e.minIndexInterval=r.min_index_interval||e.minIndexInterval,e.maxIndexInterval=r.max_index_interval||e.maxIndexInterval,e.nodesync=r.nodesync||e.nodesync,!f){let m=r.cdc;m!==void 0&&(e.cdc=m)}if(f){e.tableName=r.base_table_name,e.whereClause=r.where_clause,e.includeAllColumns=r.include_all_columns;return}e.indexes=this._getIndexes(i);let p=r.flags;Array.isArray(p)&&(p=new Set(p));let g=p.has("dense"),d=p.has("super"),y=p.has("compound");e.isCompact=d||g||!y,!d&&!g&&!y?Qq(e):g&&Yq(e)}_getIndexes(e){return!e||e.length===0?Xt.emptyArray:e.map(r=>{let n=this._mapAsObject(r.options);return new _T(r.index_name,n.target,r.kind,n)})}async _parseAggregate(e){let r=this.cc.getEncoder(),n=new xT;return n.name=e.aggregate_name,n.keyspaceName=e.keyspace_name,n.signature=e.argument_types||Xt.emptyArray,n.stateFunction=e.state_func,n.finalFunction=e.final_func,n.initConditionRaw=e.initcond,n.initCondition=n.initConditionRaw,n.deterministic=e.deterministic||!1,n.argumentTypes=await Promise.all(n.signature.map(i=>r.parseTypeName(e.keyspace_name,i,0,null,this.udtResolver))),n.stateType=await r.parseTypeName(e.keyspace_name,e.state_type,0,null,this.udtResolver),n.returnType=await r.parseTypeName(e.keyspace_name,e.return_type,0,null,this.udtResolver),n}async _parseFunction(e){let r=this.cc.getEncoder(),n=new TT;return n.name=e.function_name,n.keyspaceName=e.keyspace_name,n.signature=e.argument_types||Xt.emptyArray,n.argumentNames=e.argument_names||Xt.emptyArray,n.body=e.body,n.calledOnNullInput=e.called_on_null_input,n.language=e.language,n.deterministic=e.deterministic||!1,n.monotonic=e.monotonic||!1,n.monotonicOn=e.monotonic_on||Xt.emptyArray,n.argumentTypes=await Promise.all(n.signature.map(i=>r.parseTypeName(e.keyspace_name,i,0,null,this.udtResolver))),n.returnType=await r.parseTypeName(e.keyspace_name,e.return_type,0,null,this.udtResolver),n}async _parseUdt(e,r){let n=this.cc.getEncoder(),i=r.field_types,s=r.keyspace_name;return e.fields=await Promise.all(r.field_names.map(async(o,a)=>{let u=await n.parseTypeName(s,i[a],0,null,this.udtResolver);return{name:o,type:u}})),e}};c(g0,"SchemaParserV2");var ju=g0,y0=class y0 extends ju{constructor(e,r,n){super(e,r,n),this.supportsVirtual=!0}async getKeyspaces(e){let r={},n=[{query:bT,virtual:!1},{query:jq,virtual:!0}];return await Promise.all(n.map(async i=>{let s=null;try{s=await this.cc.query(i.query,e)}catch(o){if(i.virtual)return;throw o}for(let o=0;o1)return Xq(r)}return/NetworkTopologyStrategy$/.test(t)?Jq(e):c(function(n,i,s){let o={};for(let a in s)s.hasOwnProperty(a)&&(o[a]=[s[a]]);return o},"noStrategy")}c(Zq,"getTokenToReplicaMapper");function Xq(t){return c(function(r,n,i){let s=n.length,o=Math.min(t,s),a={};for(let u=0;u=s&&(p=p%s);let g=i[n[p]];f.indexOf(g)===-1&&f.push(g)}a[l]=f}return a},"tokenSimpleStrategy")}c(Xq,"getTokenToReplicaSimpleMapper");function Jq(t){return c(function(r,n,i,s){let o={},a=n.length;for(let u=0;u=a&&(y=y%a);let v=i[n[y]];if(f.indexOf(v)!==-1)continue;let m=v.datacenter,w=parseInt(t[m],10);if(!w)continue;w=Math.min(w,s[m].hostLength);let x=h[m]||0;if(x>=w)continue;let A=p[m];if(A||(A=p[m]=new Xt.HashSet),v.rack&&A.contains(v.rack)&&A.length0&&(!r[s]||r[s]=4&&(s=f0),!i||!(i instanceof s)?new s(t,e,r):i}c(t6,"getByVersion");h0.getByVersion=t6;h0.isDoneForToken=AT});var w0=_((eY,OT)=>{"use strict";var r6=require("events"),zu=require("util"),m0=rT(),Wu=oe(),Xa=ze(),mo=Ke(),Qu=Ti(),BT=NT(),Jr=fr(),{TokenRange:Yu}=Fa(),{ExecutionOptions:n6}=xi(),i6="SELECT * FROM system_traces.sessions WHERE session_id=%s",s6="SELECT * FROM system_traces.events WHERE session_id=%s",o6="SELECT schema_version FROM system.peers",a6="SELECT schema_version FROM system.local",RT=5,c6=400,S0=class S0{constructor(e,r){if(!e)throw new Xa.ArgumentError("Options are not defined");Object.defineProperty(this,"options",{value:e,enumerable:!1,writable:!1}),Object.defineProperty(this,"controlConnection",{value:r,enumerable:!1,writable:!1}),this.keyspaces={},this.initialized=!1,this._isDbaas=!1,this._schemaParser=BT.getByVersion(e,r,this.getUdt.bind(this)),this.log=Wu.log,this._preparedQueries=new E0(e.maxPrepared,(...n)=>this.log(...n))}setCassandraVersion(e){this._schemaParser=BT.getByVersion(this.options,this.controlConnection,this.getUdt.bind(this),e,this._schemaParser)}isDbaas(){return this._isDbaas}setProductTypeAsDbaas(){this._isDbaas=!0}setPartitioner(e){return/RandomPartitioner$/.test(e)?this.tokenizer=new m0.RandomTokenizer:/ByteOrderedPartitioner$/.test(e)?this.tokenizer=new m0.ByteOrderedTokenizer:this.tokenizer=new m0.Murmur3Tokenizer}buildTokens(e){if(!this.tokenizer)return this.log("error","Tokenizer could not be determined");let r=[],n={},i=e.values(),s=this.tokenizer.stringify,o={};i.forEach(u=>{if(!u.tokens)return;u.tokens.forEach(f=>{let h=this.tokenizer.parse(f);Wu.insertSorted(r,h,(p,g)=>p.compare(g)),n[s(h)]=u});let l=o[u.datacenter];l||(l=o[u.datacenter]={hostLength:0,racks:new Wu.HashSet}),l.hostLength++,l.racks.add(u.rack)}),this.primaryReplicas=n,this.ring=r;let a=new Set;if(this.ring.length===1){let u=this.tokenizer.minToken();a.add(new Yu(u,u,this.tokenizer))}else for(let u=0;u"u")&&(r=e,e=!0),!this.initialized){let n=this._uninitializedError();return r?r(n):Promise.reject(n)}return Jr.optionalCallback(this.refreshKeyspacesInternal(e),r)}async refreshKeyspacesInternal(e){this.log("info","Retrieving keyspaces metadata");try{return this.keyspaces=await this._schemaParser.getKeyspaces(e),this.keyspaces}catch(r){throw this.log("error","There was an error while trying to retrieve keyspaces information",r),r}}_getKeyspaceReplicas(e){return e.replicas||(e.replicas=e.tokenToReplica(this.tokenizer,this.ringTokensAsStrings,this.primaryReplicas,this.datacenters)),e.replicas}getReplicas(e,r){if(!this.ring)return null;Buffer.isBuffer(r)&&(r=this.tokenizer.hash(r)),r instanceof Yu&&(r=r.end);let n;if(e&&(n=this.keyspaces[e],!n))return null;let i=Wu.binarySearch(this.ring,r,(a,u)=>a.compare(u));i<0&&(i=~i),i>=this.ring.length&&(i=i%this.ring.length);let s=this.ringTokensAsStrings[i];return e?this._getKeyspaceReplicas(n)[s]:[this.primaryReplicas[s]]}getTokenRanges(){return this.tokenRanges}getTokenRangesForHost(e,r){if(!this.ring)return null;let n;if(e&&(n=this.keyspaces[e],!n))return null;if(this.ring.length===1)return this.getTokenRanges();let i=this._getKeyspaceReplicas(n),s=new Set;return this.tokenRanges.forEach(o=>{i[this.tokenizer.stringify(o.end)].indexOf(r)!==-1&&s.add(o)}),s}newToken(e){if(!this.tokenizer)throw new Error("Partitioner not established. This should only happen if metadata was disabled or you have not connected yet.");return Array.isArray(e)?this.tokenizer.hash(Buffer.concat(e)):zu.isString(e)?this.tokenizer.parse(e):this.tokenizer.hash(e)}newTokenRange(e,r){if(!this.tokenizer)throw new Error("Partitioner not established. This should only happen if metadata was disabled or you have not connected yet.");return new Yu(e,r,this.tokenizer)}getPreparedInfo(e,r){return this._preparedQueries.getOrAdd(e,r)}clearPrepared(){this._preparedQueries.clear()}getPreparedById(e){return this._preparedQueries.getById(e)}setPreparedById(e){return this._preparedQueries.setById(e)}getAllPrepared(){return this._preparedQueries.getAll()}_uninitializedError(){return new Error("Metadata has not been initialized. This could only happen if you have not connected yet.")}getUdt(e,r,n){return Jr.optionalCallback(this._getUdt(e,r),n)}async _getUdt(e,r){if(!this.initialized)throw this._uninitializedError();let n;if(this.options.isMetadataSyncEnabled){let i=this.keyspaces[e];if(!i)return null;n=i.udts}return await this._schemaParser.getUdt(e,r,n)}getTable(e,r,n){return Jr.optionalCallback(this._getTable(e,r),n)}async _getTable(e,r){if(!this.initialized)throw this._uninitializedError();let n,i;if(this.options.isMetadataSyncEnabled){let s=this.keyspaces[e];if(!s)return null;n=s.tables,i=s.virtual}return await this._schemaParser.getTable(e,r,n,i)}getFunctions(e,r,n){return Jr.optionalCallback(this._getFunctionsWrapper(e,r),n)}async _getFunctionsWrapper(e,r){if(!e||!r)throw new Xa.ArgumentError("You must provide the keyspace name and cql function name to retrieve the metadata");let n=await this._getFunctions(e,r,!1);return Array.from(n.values())}getFunction(e,r,n,i){return Jr.optionalCallback(this._getSingleFunction(e,r,n,!1),i)}getAggregates(e,r,n){return Jr.optionalCallback(this._getAggregates(e,r),n)}async _getAggregates(e,r){if(!e||!r)throw new Xa.ArgumentError("You must provide the keyspace name and cql aggregate name to retrieve the metadata");let n=await this._getFunctions(e,r,!0);return Array.from(n.values())}getAggregate(e,r,n,i){return Jr.optionalCallback(this._getSingleFunction(e,r,n,!0),i)}getMaterializedView(e,r,n){return Jr.optionalCallback(this._getMaterializedView(e,r),n)}async _getMaterializedView(e,r){if(!this.initialized)throw this._uninitializedError();let n;if(this.options.isMetadataSyncEnabled){let i=this.keyspaces[e];if(!i)return null;n=i.views}return await this._schemaParser.getMaterializedView(e,r,n)}async _getFunctions(e,r,n){if(!this.initialized)throw this._uninitializedError();let i;if(this.options.isMetadataSyncEnabled){let s=this.keyspaces[e];if(!s)return new Map;i=n?s.aggregates:s.functions}return await this._schemaParser.getFunctions(e,r,n,i)}async _getSingleFunction(e,r,n,i){if(!e||!r)throw new Xa.ArgumentError("You must provide the keyspace name and cql function name to retrieve the metadata");if(!Array.isArray(n))throw new Xa.ArgumentError("Signature must be an array of types");return n=n.map(o=>typeof o=="string"?o:mo.getDataTypeNameByCode(o)),(await this._getFunctions(e,r,i)).get(n.join(","))||null}getTrace(e,r,n){return!n&&typeof r=="function"&&(n=r,r=null),Jr.optionalCallback(this._getTrace(e,r),n)}async _getTrace(e,r){if(!this.initialized)throw this._uninitializedError();let n,i=0,s=n6.empty();s.getConsistency=()=>r;let o=new Qu.QueryRequest(zu.format(i6,e),null,s),a=new Qu.QueryRequest(zu.format(s6,e),null,s);for(;!n&&i++({id:h.event_id,activity:h.activity,source:h.source,elapsed:h.source_elapsed,thread:h.thread}))}if(!n)throw new Error(`Trace ${e.toString()} could not fully retrieved after ${RT} attempts`);return n}checkSchemaAgreement(e){return Jr.optionalCallback(this._checkSchemaAgreement(),e)}async _checkSchemaAgreement(){let e=this.controlConnection.connection;if(!e)return!1;try{return await this.compareSchemaVersions(e)}catch{return!1}}async adaptUserHints(e,r){if(!Array.isArray(r))return;let n=[];for(let i=0;i=r)break}for(let[n,i]of e)this._mapByKey.delete(n),this._mapById.delete(i.queryId.toString("hex")),this.length--}setById(e){this._mapById.set(e.queryId.toString("hex"),e)}getById(e){return this._mapById.get(e.toString("hex"))}clear(){this._mapByKey=new Map,this._mapById=new Map,this.length=0}getAll(){return Array.from(this._mapByKey.values()).filter(e=>!!e.queryId)}};c(C0,"PreparedQueries");var E0=C0;OT.exports=v0});var LT=_((rY,PT)=>{"use strict";var u6=require("util"),l6=oe(),x0=fr(),DT=1e3,_0=class _0{constructor(e,r){this._delay=e,this._logger=r,this._queue=null,this._timeout=null}eventReceived(e,r){return new Promise((n,i)=>{e.callback=x0.getCallback(n,i),this._queue=this._queue||{callbacks:[],keyspaces:{}};let s=r?0:this._delay;if(e.all&&(this._queue.mainEvent=e),this._queue.callbacks.length===DT&&this._logger("warn",u6.format("Event debouncer queue exceeded %d events",DT)),this._queue.callbacks.push(e.callback),this._queue.mainEvent)return this._slideDelay(s);let o=this._queue.keyspaces[e.keyspace];o||(o=this._queue.keyspaces[e.keyspace]={events:[]}),e.cqlObject===void 0&&(o.mainEvent=e),o.events.push(e),this._slideDelay(s)})}_slideDelay(e){let r=this;function n(){let s=r._queue;r._queue=null,r._timeout=null,f6(s)}if(c(n,"process"),e===0)return this._timeout&&clearTimeout(this._timeout),n();let i=this._timeout;this._timeout=setTimeout(n,e),i&&clearTimeout(i)}shutdown(){this._queue&&(this._queue.callbacks.forEach(function(e){e()}),this._queue=null,clearTimeout(this._timeout),this._timeout=null)}};c(_0,"EventDebouncer");var T0=_0;function f6(t){if(t.mainEvent)return x0.toCallback(t.mainEvent.handler(),e=>{for(let r=0;r{s.handler(),s.callback()}),n()},"eachKeyspace"))}c(f6,"processQueue");PT.exports=T0});var KT=_((iY,MT)=>{"use strict";var h6=require("events"),Ju=require("util"),kT=require("net"),Zu=require("dns"),en=ze(),{Host:FT,HostMap:d6}=eT(),p6=w0(),g6=LT(),y6=Kp(),Ja=Ti(),Bi=oe(),Xu=Ke(),ps=fr(),qT=Ju.format,m6="SELECT * FROM system.peers",v6="SELECT * FROM system.local WHERE key='local'",UT=1e3,E6=2e3,S6={created:"CREATED",updated:"UPDATED",dropped:"DROPPED"},C6="PRODUCT_TYPE",w6="DATASTAX_APOLLO",I0=class I0 extends h6.EventEmitter{constructor(e,r,n){super(),this.protocolVersion=null,this.hosts=new d6,this.setMaxListeners(0),this.log=Bi.log,Object.defineProperty(this,"options",{value:e,enumerable:!1,writable:!1}),this.metadata=new p6(this.options,this),this.initialized=!1,this.host=null,this.connection=null,this._addressTranslator=this.options.policies.addressResolution,this._reconnectionPolicy=this.options.policies.reconnection,this._reconnectionSchedule=this._reconnectionPolicy.newSchedule(),this._isShuttingDown=!1,this._encoder=null,this._debouncer=new g6(e.refreshSchemaDelay,this.log.bind(this)),this._profileManager=r,this._triedHosts=null,this._resolvedContactPoints=new Map,this._contactPoints=new Set,this._topologyChangeTimeout=null,this._nodeStatusChangeTimeout=null,n&&n.borrowHostConnection&&(this._borrowHostConnection=n.borrowHostConnection),n&&n.createConnection&&(this._createConnection=n.createConnection)}_addContactPoint(e,r,n,i){if(e===null){this._resolvedContactPoints.set(n,Bi.emptyArray);return}let s=parseInt(r,10)||this.options.protocolOptions.port,o=`${e}:${s}`;this._contactPoints.add(o);let a=i?`[${e}]:${s}`:o,u=this._resolvedContactPoints.get(n);(u===void 0||u===Bi.emptyArray)&&(u=[],this._resolvedContactPoints.set(n,u)),u.push(a)}async _parseContactPoint(e){let r=e,n=null;if(e.indexOf("[")===0&&e.indexOf("]:")>1){let s=e.lastIndexOf("]:");r=e.substr(1,s-1),n=e.substr(s+2)}else if(e.indexOf(":")>0){let s=e.split(":");s.length===2&&(r=s[0],n=s[1])}if(kT.isIP(r)){this._addContactPoint(r,n,e,kT.isIPv6(r));return}let i=await this._resolveAll(r);i.length>0?i.forEach(s=>this._addContactPoint(s.address,n,e,s.isIPv6)):this._addContactPoint(null,null,e,!1)}async init(){if(!this.initialized){if(!this.options.sni)await Promise.all(this.options.contactPoints.map(e=>this._parseContactPoint(e)));else{this.options.contactPoints.forEach(i=>this._contactPoints.add(i));let e=this.options.sni.address,r=e.lastIndexOf(":");if(r===-1)throw new new en.DriverInternalError("The SNI endpoint address should contain ip/name and port");let n=e.substr(0,r);this.options.sni.port=e.substr(r+1),this.options.sni.addressResolver=new Bi.AddressResolver({nameOrIp:n,dns:Zu}),await this.options.sni.addressResolver.init()}if(this._contactPoints.size===0)throw new en.NoHostAvailableError({},"No host could be resolved");await this._initializeConnection()}}_setHealthListeners(e,r){let n=this,i=0;function s(){e.removeListener("down",a),e.removeListener("ignore",a),r.removeListener("socketClose",u)}c(s,"removeListeners");function o(l){i++===0&&(s(),!n._isShuttingDown&&(l?n.log("warning",`Host ${e.address} used by the ControlConnection DOWN, connection to ${r.endpointFriendlyName} will not longer be used`):n.log("warning",`Connection to ${r.endpointFriendlyName} used by the ControlConnection was closed`),ps.toBackground(n._refresh())))}c(o,"startReconnecting");function a(){o(!0)}c(a,"downOrIgnoredHandler");function u(){o(!1)}c(u,"socketClosedHandler"),e.once("down",a),e.once("ignore",a),r.once("socketClose",u)}_borrowAConnection(e){let r=null;for(;!r;){let n=e.next(),i=n.value;if(n.done)throw new en.NoHostAvailableError(this._triedHosts);let s=this._profileManager.getDistance(i);if(!(!i.isUp()||s===Xu.distance.ignored))try{r=this._borrowHostConnection(i)}catch(o){this._triedHosts[i.address]=o}}return r}async _borrowFirstConnection(e){let r=null;for(;!r;){let n=e.next(),i=n.value;if(n.done)throw new en.NoHostAvailableError(this._triedHosts);try{r=await this._createConnection(i)}catch(s){this._triedHosts[i]=s}}if(!r){let n=new en.NoHostAvailableError(this._triedHosts);throw this.log("error","ControlConnection failed to acquire a connection"),n}this.protocolVersion=r.protocolVersion,this._encoder=r.encoder,this.connection=r}_borrowHostConnection(e){return e.borrowConnection()}async _createConnection(e){let r=new y6(e,null,this.options);try{await r.openAsync()}catch(n){throw ps.toBackground(r.closeAsync()),n}return r}async _refreshHosts(e,r){let n=this.connection;if(!n){if(r)throw new en.DriverInternalError("Connection reference has been lost when reconnecting");return}this.log("info","Refreshing local and peers info");let i=await n.send(new Ja.QueryRequest(v6),null);if(this._setLocalInfo(e,r,n,i),!this.host)throw new en.DriverInternalError("Information from system.local could not be retrieved");let s=await n.send(new Ja.QueryRequest(m6),null);if(await this.setPeersInfo(e,s),!this.initialized){let o=Xu.protocolVersion.getHighestCommon(n,this.hosts),a=o!==this.protocolVersion;if(this.protocolVersion=o,this.hosts.forEach(u=>u.setProtocolVersion(this.protocolVersion)),a){this.log("info",`Reconnecting since the protocol version changed to 0x${o.toString(16)}`),n.decreaseVersion(this.protocolVersion),await n.closeAsync();try{await n.openAsync()}catch(u){throw ps.toBackground(n.closeAsync()),u}}if(this.metadata.setCassandraVersion(this.host.getCassandraVersion()),this.metadata.buildTokens(this.hosts),!this.options.isMetadataSyncEnabled){this.metadata.initialized=!0;return}await this.metadata.refreshKeyspacesInternal(!1),this.metadata.initialized=!0}}async _refreshControlConnection(e){if(this.options.sni)this.connection=this._borrowAConnection(e);else try{this.connection=this._borrowAConnection(e)}catch{this.log("info","ControlConnection could not reconnect using existing connections. Refreshing contact points and retrying"),this._contactPoints.clear(),this._resolvedContactPoints.clear(),await Promise.all(this.options.contactPoints.map(i=>this._parseContactPoint(i)));let n=Array.from(this._contactPoints).join(",");this.log("info",`Refreshed contact points: ${n}`),await this._initializeConnection()}}async _refresh(e){if(this._isShuttingDown){this.log("info","The ControlConnection will not be refreshed as the Client is being shutdown");return}this.host=null,this.connection=null;try{e||(this.log("info","Trying to acquire a connection to a new host"),this._triedHosts={},e=await ps.newQueryPlan(this._profileManager.getDefaultLoadBalancing(),null,null)),await this._refreshControlConnection(e)}catch(r){if(this.log("error","ControlConnection failed to acquire a connection",r),!this._isShuttingDown){let n=this._reconnectionSchedule.next().value;this.log("warning",`ControlConnection could not reconnect, scheduling reconnection in ${n}ms`),setTimeout(()=>this._refresh(),n),this.emit("newConnection",r)}return}this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName}`);try{await this._refreshHosts(!1,!0),await this._registerToConnectionEvents()}catch(r){return this.log("error","ControlConnection failed to retrieve topology and keyspaces information",r),this._triedHosts[this.connection.endpoint]=r,r.isSocketError&&this.host&&this.host.removeFromPool(this.connection),await this._refresh(e)}this._reconnectionSchedule=this._reconnectionPolicy.newSchedule(),this._setHealthListeners(this.host,this.connection),this.emit("newConnection",null,this.connection,this.host),this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName} and up to date`)}async _initializeConnection(){this.log("info","Getting first connection"),this.host=null,this.connection=null,this._triedHosts={};let e=Bi.shuffleArray(Array.from(this._contactPoints))[Symbol.iterator]();for(;;){await this._borrowFirstConnection(e),this.log("info",`ControlConnection using protocol version 0x${this.protocolVersion.toString(16)}, connected to ${this.connection.endpointFriendlyName}`);try{await this._getSupportedOptions(),await this._refreshHosts(!0,!0),await this._registerToConnectionEvents();break}catch(r){this.log("error","ControlConnection failed to retrieve topology and keyspaces information",r),this._triedHosts[this.connection.endpoint]=r}}this.host.pool.addExistingConnection(this.connection),this.initialized=!0,this._setHealthListeners(this.host,this.connection),this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName}`)}async _getSupportedOptions(){let e=await this.connection.send(Ja.options,null),r=e.supported&&e.supported[C6];Array.isArray(r)&&r[0]===w6&&this.metadata.setProductTypeAsDbaas()}async _registerToConnectionEvents(){this.connection.on("nodeTopologyChange",this._nodeTopologyChangeHandler.bind(this)),this.connection.on("nodeStatusChange",this._nodeStatusChangeHandler.bind(this)),this.connection.on("nodeSchemaChange",this._nodeSchemaChangeHandler.bind(this));let e=new Ja.RegisterRequest(["TOPOLOGY_CHANGE","STATUS_CHANGE","SCHEMA_CHANGE"]);await this.connection.send(e,null)}_nodeTopologyChangeHandler(e){this.log("info","Received topology change",e),clearTimeout(this._topologyChangeTimeout),this._topologyChangeTimeout=setTimeout(()=>ps.toBackground(this._scheduleRefreshHosts()),UT)}_nodeStatusChangeHandler(e){let r=this,n=e.inet.address.toString(),i=this.options.protocolOptions.port;this._addressTranslator.translate(n,i,c(function(o){let a=r.hosts.get(o);if(!a){r.log("warning","Received status change event but host was not found: "+n);return}let u=r._profileManager.getDistance(a);if(e.up){if(u===Xu.distance.ignored)return a.setUp(!0);clearTimeout(r._nodeStatusChangeTimeout),r._nodeStatusChangeTimeout=setTimeout(()=>a.checkIsUp(),UT);return}if(u===Xu.distance.ignored)return a.setDown();r.log("warning","Received status change to DOWN for host "+a.address)},"translateCallback"))}_nodeSchemaChangeHandler(e){this.log("info","Schema change",e),this.options.isMetadataSyncEnabled&&ps.toBackground(this.handleSchemaChange(e,!1))}handleSchemaChange(e,r){let n=this,i,s;if(e.isKeyspace)return e.schemaChangeType===S6.dropped?(i=c(function(){delete n.metadata.keyspaces[e.keyspace]},"removeKeyspace"),this._scheduleObjectRefresh(i,e.keyspace,null,r)):this._scheduleKeyspaceRefresh(e.keyspace,r);let o=this.metadata.keyspaces[e.keyspace];return!o||(e.table?(s=e.table,i=c(function(){delete o.tables[e.table],delete o.views[e.table]},"clearTableState")):e.udt?(s=e.udt,i=c(function(){delete o.udts[e.udt]},"clearUdtState")):e.functionName?(s=e.functionName,i=c(function(){delete o.functions[e.functionName]},"clearFunctionState")):e.aggregate&&(s=e.aggregate,i=c(function(){delete o.aggregates[e.aggregate]},"clearKeyspaceState")),!i)?Promise.resolve():this._scheduleObjectRefresh(i,e.keyspace,s,r)}_scheduleObjectRefresh(e,r,n,i){return this._debouncer.eventReceived({handler:e,keyspace:r,cqlObject:n},i)}_scheduleKeyspaceRefresh(e,r){return this._debouncer.eventReceived({handler:()=>this.metadata.refreshKeyspace(e),keyspace:e},r)}_scheduleRefreshHosts(){return this._debouncer.eventReceived({handler:()=>this._refreshHosts(!1,!1),all:!0},!1)}_setLocalInfo(e,r,n,i){if(!i||!i.rows||!i.rows.length){this.log("warning","No local info could be obtained");return}let s=i.rows[0],o,a=this.options.sni?`${s.rpc_address}:${this.options.protocolOptions.port}`:n.endpoint;if(e)o=new FT(a,this.protocolVersion,this.options,this.metadata),this.hosts.set(a,o),this.log("info",`Adding host ${a}`);else if(o=this.hosts.get(a),!o){this.log("error","Localhost could not be found");return}o.datacenter=s.data_center,o.rack=s.rack,o.tokens=s.tokens,o.hostId=s.host_id,o.cassandraVersion=s.release_version,VT(o,s),this.metadata.setPartitioner(s.partitioner),this.log("info","Local info retrieved"),r&&(this.host=o)}async setPeersInfo(e,r){if(!r||!r.rows)return;let n={},i=this.options.protocolOptions.port,s=new Set;this.host&&this.host.datacenter&&s.add(this.host.datacenter);for(let o of r.rows){let a=await this.getAddressForPeerHost(o,i);if(!a)continue;n[a]=!0;let u=this.hosts.get(a),l=!u;l&&(u=new FT(a,this.protocolVersion,this.options,this.metadata),this.log("info",`Adding host ${a}`),l=!0),u.datacenter=o.data_center,u.rack=o.rack,u.tokens=o.tokens,u.hostId=o.host_id,u.cassandraVersion=o.release_version,VT(u,o),u.datacenter&&s.add(u.datacenter),l&&(this.hosts.set(a,u),e||(this._profileManager.getDistance(u),u.setDown()))}if(this.hosts.length>r.rows.length+1){this.log("info","Removing nodes from the pool");let o=[];this.hosts.forEach(a=>{!n[a.address]&&a!==this.host&&(this.log("info","Removing host "+a.address),o.push(a.address),a.shutdown(!0))}),this.hosts.removeMultiple(o)}if(e&&this.options.localDataCenter){let o=this.options.localDataCenter;if(!s.has(o))throw new en.ArgumentError(`localDataCenter was configured as '${o}', but only found hosts in data centers: [${Array.from(s).join(", ")}]`)}this.log("info","Peers info retrieved")}getAddressForPeerHost(e,r){return new Promise(n=>{let i=e.rpc_address,s=e.peer,o="0.0.0.0";if(!i)return this.log("error",qT("No rpc_address found for host %s in %s's peers system table. %s will be ignored.",s,this.host.address,s)),n(null);i.toString()===o&&(this.log("warning",qT("Found host with 0.0.0.0 as rpc_address, using listen_address (%s) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.",s)),i=s),this._addressTranslator.translate(i.toString(),r,n)})}async _resolveAll(e){let r=[],n=Ju.promisify(Zu.resolve4),i=Ju.promisify(Zu.resolve6),s=Ju.promisify(Zu.lookup),o=n(e).catch(()=>{}).then(l=>l||Bi.emptyArray),a=i(e).catch(()=>{}).then(l=>l||Bi.emptyArray),u;if(u=await o,u.forEach(l=>r.push({address:l,isIPv6:!1})),u=await a,u.forEach(l=>r.push({address:l,isIPv6:!0})),r.length===0)try{u=await s(e,{all:!0}),u.forEach(({address:l,family:f})=>r.push({address:l,isIPv6:f===6}))}catch(l){this.log("error",`Host with name ${e} could not be resolved`,l)}return r}_waitForReconnection(){return new Promise((e,r)=>{let n=ps.getCallback(e,r),i;function s(o){clearTimeout(i),n(o)}c(s,"newConnectionListener"),this.once("newConnection",s),i=setTimeout(()=>{this.removeListener("newConnection",s),n(new en.OperationTimedOutError("A connection could not be acquired before timeout."))},E6)})}async query(e,r=!0){let n=c(async()=>{if(!this.connection||this._isShuttingDown)throw new en.NoHostAvailableError({},"ControlConnection is not connected at the time");let i=typeof e=="string"?new Ja.QueryRequest(e,null,null):e;return await this.connection.send(i,null)},"queryOnConnection");return!this.connection&&r&&await this._waitForReconnection(),await n()}getEncoder(){if(!this._encoder)throw new en.DriverInternalError("Encoder is not defined");return this._encoder}shutdown(){this._isShuttingDown=!0,this._debouncer.shutdown(),this.emit("newConnection",new en.DriverError("ControlConnection is being shutdown")),clearTimeout(this._topologyChangeTimeout),clearTimeout(this._nodeStatusChangeTimeout)}async reset(){let e=this.hosts.clear();this._isShuttingDown=!0,await Promise.all(e.map(r=>r.shutdown())),this.initialized=!1,this._isShuttingDown=!1}getResolvedContactPoints(){return this._resolvedContactPoints}getLocalAddress(){if(this.connection)return this.connection.getLocalAddress()}getEndpoint(){if(this.connection)return this.connection.endpoint}};c(I0,"ControlConnection");var b0=I0;function VT(t,e){e.workloads!==void 0?t.workloads=e.workloads:e.workload?t.workloads=[e.workload]:t.workloads=Bi.emptyArray,e.dse_version!==void 0&&(t.dseVersion=e.dse_version)}c(VT,"setDseParameters");MT.exports=b0});var GT=_((oY,$T)=>{"use strict";var ec=ze(),HT=Ti(),el=Jh(),si=Ke(),x6=oe(),A0=fr(),T6=Object.freeze({decision:el.RetryPolicy.retryDecision.retry,useCurrentHost:!0,consistency:void 0}),N0=Object.freeze({decision:el.RetryPolicy.retryDecision.rethrow}),Te={none:0,socketError:1,socketErrorBeforeRequestWritten:2,clientTimeout:3,serverErrorUnprepared:4,serverErrorOverloaded:5,serverErrorReadTimeout:6,serverErrorUnavailable:7,serverErrorWriteTimeout:8,serverErrorOther:9},_6=new Map([[Te.none,(t,e,r)=>t.onSuccessfulResponse(r)],[Te.socketError,(t,e)=>t.onConnectionError(e)],[Te.clientTimeout,(t,e)=>t.onClientTimeoutError(e)],[Te.serverErrorOverloaded,(t,e)=>t.onOtherError(e)],[Te.serverErrorReadTimeout,(t,e)=>t.onReadTimeoutError(e)],[Te.serverErrorUnavailable,(t,e)=>t.onUnavailableError(e)],[Te.serverErrorWriteTimeout,(t,e)=>t.onWriteTimeoutError(e)],[Te.serverErrorOther,(t,e)=>t.onOtherError(e)]]),b6=new Map([[Te.socketError,(t,e)=>t.onOtherErrorRetry(e)],[Te.clientTimeout,(t,e)=>t.onClientTimeoutRetry(e)],[Te.serverErrorOverloaded,(t,e)=>t.onOtherErrorRetry(e)],[Te.serverErrorReadTimeout,(t,e)=>t.onReadTimeoutRetry(e)],[Te.serverErrorUnavailable,(t,e)=>t.onUnavailableRetry(e)],[Te.serverErrorWriteTimeout,(t,e)=>t.onWriteTimeoutRetry(e)],[Te.serverErrorOther,(t,e)=>t.onOtherErrorRetry(e)]]),gs=class gs{constructor(e,r,n){this._parent=e,this._operation=null,this._host=r,this._connection=n,this._cancelled=!1,this._startTime=null,this._retryCount=0,this._request=this._parent.request,e.speculativeExecutions++}start(){this._sendOnConnection()}async restart(){try{let{host:r,connection:n}=this._parent.getNextConnection();this._connection=n,this._host=r}catch(r){return this._parent.handleNoHostAvailable(r,this)}let e=this._parent.client.keyspace;if(e&&e!==this._connection.keyspace)try{await this._connection.changeKeyspace(e)}catch(r){return this._handleError(r,gs._getErrorCode(r))}this._cancelled||this._sendOnConnection()}_sendOnConnection(){this._startTime=process.hrtime(),this._operation=this._connection.sendStream(this._request,this._parent.executionOptions,(e,r,n)=>{let i=gs._getErrorCode(e);if(this._trackResponse(process.hrtime(this._startTime),i,e,n),!this._cancelled){if(i!==Te.none)return this._handleError(i,e);if(r.schemaChange)return A0.toBackground(this._parent.client.handleSchemaAgreementAndRefresh(this._connection,r.schemaChange).then(s=>{this._cancelled||this._parent.setCompleted(null,this._getResultSet(r,s))}));if(r.keyspaceSet&&(this._parent.client.keyspace=r.keyspaceSet),r.meta&&r.meta.newResultId&&this._request.queryId){let s=this._parent.client.metadata.getPreparedById(this._request.queryId);s.meta.resultId=r.meta.newResultId}this._parent.setCompleted(null,this._getResultSet(r))}})}_trackResponse(e,r,n,i){gs._invokeMetricsHandler(r,this._parent.client.metrics,n,e);let s=this._parent.client.options.requestTracker;if(s===null)return;let o=this._request.query||this._request.queries,a=this._request.params,u=this._request.length;n?s.onError(this._host,o,a,this._parent.executionOptions,u,n,e):s.onSuccess(this._host,o,a,this._parent.executionOptions,u,i,e)}_getResultSet(e,r){let n=new si.ResultSet(e,this._host.address,this._parent.triedHosts,this._parent.speculativeExecutions,this._request.consistency,r===void 0||r);return n.rawPageState&&(n.nextPageAsync=this._parent.getNextPageHandler()),n}static _invokeMetricsHandler(e,r,n,i){let s=_6.get(e);s!==void 0&&s(r,n,i),(!n||n instanceof ec.ResponseError)&&r.onResponse(i)}static _invokeMetricsHandlerForRetry(e,r,n){let i=b6.get(e);i!==void 0&&i(r,n)}cancel(){this._cancelled=!0,this._operation!==null&&this._operation.cancel()}wasCancelled(){return this._cancelled}_handleError(e,r){if(this._parent.triedHosts[this._host.address]=r,r.coordinator=this._host.address,e===Te.serverErrorUnprepared)return this._prepareAndRetry(r.queryId);e===Te.socketError||e===Te.socketErrorBeforeRequestWritten?this._host.removeFromPool(this._connection):e===Te.clientTimeout&&(this._parent.log("warning",r.message),this._host.checkHealth(this._connection));let n=this._getDecision(e,r);if(!n||n.decision===el.RetryPolicy.retryDecision.rethrow)return(this._request instanceof HT.QueryRequest||this._request instanceof HT.ExecuteRequest)&&(r.query=this._request.query),this._parent.setCompleted(r);let i=this._parent.client.metrics;return n.decision===el.RetryPolicy.retryDecision.ignore?(i.onIgnoreError(r),this._parent.setCompleted(null,this._getResultSet(x6.emptyObject))):(gs._invokeMetricsHandlerForRetry(e,i,r),this._retry(n.consistency,n.useCurrentHost))}_getDecision(e,r){let n={query:this._request&&this._request.query,executionOptions:this._parent.executionOptions,nbRetry:this._retryCount},i=n.executionOptions.getRetryPolicy();switch(e){case Te.socketErrorBeforeRequestWritten:return T6;case Te.socketError:case Te.clientTimeout:case Te.serverErrorOverloaded:return n.executionOptions.isIdempotent()?i.onRequestError(n,this._request.consistency,r):N0;case Te.serverErrorUnavailable:return i.onUnavailable(n,r.consistencies,r.required,r.alive);case Te.serverErrorReadTimeout:return i.onReadTimeout(n,r.consistencies,r.received,r.blockFor,r.isDataPresent);case Te.serverErrorWriteTimeout:return n.executionOptions.isIdempotent()?i.onWriteTimeout(n,r.consistencies,r.received,r.blockFor,r.writeType):N0;default:return N0}}static _getErrorCode(e){if(!e)return Te.none;if(e.isSocketError)return e.requestNotWritten?Te.socketErrorBeforeRequestWritten:Te.socketError;if(e instanceof ec.OperationTimedOutError)return Te.clientTimeout;if(e instanceof ec.ResponseError)switch(e.code){case si.responseErrorCodes.overloaded:case si.responseErrorCodes.isBootstrapping:case si.responseErrorCodes.truncateError:return Te.serverErrorOverloaded;case si.responseErrorCodes.unavailableException:return Te.serverErrorUnavailable;case si.responseErrorCodes.readTimeout:return Te.serverErrorReadTimeout;case si.responseErrorCodes.writeTimeout:return Te.serverErrorWriteTimeout;case si.responseErrorCodes.unprepared:return Te.serverErrorUnprepared}return Te.serverErrorOther}_retry(e,r,n){if(!this._cancelled){if(this._parent.log("info","Retrying request"),this._retryCount++,(n||typeof e=="number"&&this._request.consistency!==e)&&(this._request=this._request.clone(),typeof e=="number"&&(this._request.consistency=e),n&&(this._request.meta=n)),r!==!1){try{this._connection=this._host.borrowConnection(this._connection)}catch{return A0.toBackground(this.restart())}return this._sendOnConnection()}A0.toBackground(this.restart())}}_prepareAndRetry(e){let r=this._connection;this._parent.log("info",`Query 0x${e.toString("hex")} not prepared on host ${r.endpointFriendlyName}, preparing and retrying`);let n=this._parent.client.metadata.getPreparedById(e);if(!n)return this._parent.setCompleted(new ec.DriverInternalError(`Unprepared response invalid, id: 0x${e.toString("hex")}`));let i=this._connection.protocolVersion;if(!si.protocolVersion.supportsKeyspaceInRequest(i)&&n.keyspace&&n.keyspace!==r.keyspace)return this._parent.setCompleted(new Error(`Query was prepared on keyspace ${n.keyspace}, can't execute it on ${r.keyspace} (${n.query})`));let s=this;this._connection.prepareOnce(n.query,n.keyspace,function(o,a){if(o)return!o.isSocketError&&o instanceof ec.OperationTimedOutError&&s._parent.log("warning",`Unexpected timeout error when re-preparing query on host ${r.endpointFriendlyName}`),s._retry(void 0,!1);n.meta=a.meta,s._retry(void 0,!0,a.meta)})}};c(gs,"RequestExecution");var B0=gs;$T.exports=B0});var WT=_((cY,zT)=>{"use strict";var I6=require("util"),jT=ze(),A6=Ke(),R0=oe(),N6=GT(),tl=fr(),tc=class tc{constructor(e,r,n){this.client=n,this._speculativeExecutionPlan=n.options.policies.speculativeExecution.newPlan(n.keyspace,e.query||e.queries),this.logEmitter=n.options.logEmitter,this.log=R0.log,this.request=e,this.executionOptions=r,this.stackContainer=null,this.triedHosts={},this.speculativeExecutions=-1,this._hostIterator=null,this._resolveCallback=null,this._rejectCallback=null,this._newExecutionTimeout=null,this._executions=[]}static send(e,r,n){return new tc(e,r,n).send()}getNextConnection(){let e,r,n=this._hostIterator;for(;;){let i=n.next();if(i.done)throw new jT.NoHostAvailableError(this.triedHosts);if(e=i.value,this.client.profileManager.getDistance(e)!==A6.distance.ignored){if(!e.isUp()){this.triedHosts[e.address]="Host considered as DOWN";continue}try{r=e.borrowConnection(),this.triedHosts[e.address]=null;break}catch(o){this.triedHosts[e.address]=o}}}return{connection:r,host:e}}send(){return this.executionOptions.getCaptureStackTrace()&&Error.captureStackTrace(this.stackContainer={}),new Promise((e,r)=>{this._resolveCallback=e,this._rejectCallback=r;let n=this.executionOptions.getLoadBalancingPolicy(),i=this.executionOptions.getFixedHost();i?(this._hostIterator=R0.arrayIterator([i]),tl.toBackground(this._startNewExecution())):n.newQueryPlan(this.client.keyspace,this.executionOptions,(s,o)=>{if(s)return r(s);this._hostIterator=o,tl.toBackground(this._startNewExecution())})})}async _startNewExecution(e){e&&this.client.metrics.onSpeculativeExecution();let r,n;try{({host:r,connection:n}=this.getNextConnection())}catch(s){return this.handleNoHostAvailable(s,null)}if(e&&this._executions.length>=0&&this._executions[0].wasCancelled())return;if(this.client.keyspace&&this.client.keyspace!==n.keyspace)try{await n.changeKeyspace(this.client.keyspace)}catch(s){return this.triedHosts[r.address]=s,this._startNewExecution(e)}let i=new N6(this,r,n);this._executions.push(i),i.start(),this.executionOptions.isIdempotent()&&this._scheduleSpeculativeExecution(r)}_scheduleSpeculativeExecution(e){let r=this._speculativeExecutionPlan.nextExecution(e);if(!(typeof r!="number"||r<0)){if(r===0)return process.nextTick(()=>{tl.toBackground(this._startNewExecution(!0))});this._newExecutionTimeout=setTimeout(()=>tl.toBackground(this._startNewExecution(!0)),r)}}static setKeyspace(e){let r;for(let n of e.hosts.values())if(r=n.getActiveConnection(),r)break;if(!r)throw new jT.DriverInternalError("No active connection found");return r.changeKeyspace(e.keyspace)}setCompleted(e,r){this._newExecutionTimeout!==null&&clearTimeout(this._newExecutionTimeout);for(let n of this._executions)n.cancel();if(e)return this.executionOptions.getCaptureStackTrace()&&R0.fixStack(this.stackContainer.stack,e),this._rejectCallback(e);r.info.warnings&&r.info.warnings.forEach(function(n,i,s){this.log("warning",I6.format('Received warning (%d of %d) "%s" for "%s"',i+1,s.length,n,this.request.query||"batch"))},this),this._resolveCallback(r)}handleNoHostAvailable(e,r){if(r!==null){let n=this._executions.indexOf(r);this._executions.splice(n,1)}this._executions.length===0&&this.setCompleted(e)}getNextPageHandler(){let e=this.request,r=this.executionOptions,n=this.client;return c(function(s){return r.setPageState(s),new tc(e,r,n).send()},"nextPageHandler")}};c(tc,"RequestHandler");var O0=tc;zT.exports=O0});var n_=_((lY,r_)=>{"use strict";var vo=require("os"),QT=require("path"),B6=require("fs"),L0=oe(),R6=fr(),ys=Ke(),YT=Ti(),{ExecutionOptions:ZT}=xi(),XT=oo(),il=Ph(),{NoAuthProvider:O6}=Oa(),D0;try{D0=require("kerberos")}catch{}var D6=new il(6,0,5),P6=new il(5,1,13),L6=new il(6,0,0),JT="CALL InsightsRpc.reportInsight(?)",k6=5,k0=class k0{constructor(e,r){this._client=e,this._sessionId=ys.Uuid.random().toString(),this._enabled=!1,this._closed=!1,this._firstTimeout=null,this._recurrentTimeout=null,this._statusErrorLogs=0,r=r||{},this._statusEventDelay=r.statusEventDelay||3e5,this._errorCallback=r.errorCallback||L0.noop}init(){this._enabled=this._client.options.monitorReporting.enabled&&this._dseSupportsInsights(),this._enabled&&R6.toBackground(this._init())}async _init(){try{if(await this._sendStartupEvent(),this._closed)return;let e=Math.floor(this._statusEventDelay-.1*this._statusEventDelay*Math.random());this._firstTimeout=setTimeout(()=>{this._sendStatusEvent(),this._recurrentTimeout=setInterval(()=>this._sendStatusEvent(),this._statusEventDelay)},e)}catch(e){if(this._closed)return;this._client.log("verbose",`Insights startup message could not be sent (${e})`,e),this._errorCallback(e)}}async _sendStartupEvent(){let e=await this._getStartupMessage(),r=new YT.QueryRequest(JT,[e],ZT.empty());await this._client.controlConnection.query(r,!1)}async _sendStatusEvent(){let e=new YT.QueryRequest(JT,[this._getStatusEvent()],ZT.empty());try{await this._client.controlConnection.query(e,!1)}catch(r){if(this._closed)return;this._statusErrorLogs{if(!e)return e;let n=r.getDseVersion();if(n.length===0)return!1;let i=new il(...n);return i.compare(D6)>=0||i.compare(L6)<0&&i.compare(P6)>=0},!0)}async _getStartupMessage(){let e=this._client.controlConnection,r=this._client.options,n=await this._getAppInfo(r),i={metadata:{name:"driver.startup",insightMappingId:"v1",insightType:"EVENT",timestamp:Date.now(),tags:{language:"nodejs"}},data:{driverName:XT.description,driverVersion:XT.version,clientId:r.id,sessionId:this._sessionId,applicationName:n.applicationName,applicationVersion:n.applicationVersion,applicationNameWasGenerated:n.applicationNameWasGenerated,contactPoints:t_(e.getResolvedContactPoints()),dataCenters:this._getDataCenters(),initialControlConnection:e.host?e.host.address:void 0,protocolVersion:e.protocolVersion,localAddress:e.getLocalAddress(),hostName:vo.hostname(),executionProfiles:q6(this._client),poolSizeByHostDistance:{local:r.pooling.coreConnectionsPerHost[ys.distance.local],remote:r.pooling.coreConnectionsPerHost[ys.distance.remote]},heartbeatInterval:r.pooling.heartBeatInterval,compression:"NONE",reconnectionPolicy:nl(r.policies.reconnection),ssl:{enabled:!!r.sslOptions,certValidation:r.sslOptions?!!r.sslOptions.rejectUnauthorized:void 0},authProvider:{type:r.authProvider instanceof O6?void 0:F6(r.authProvider)},otherOptions:{coalescingThreshold:r.socketOptions.coalescingThreshold},platformInfo:{os:{name:vo.platform(),version:vo.release(),arch:vo.arch()},cpus:{length:vo.cpus().length,model:vo.cpus()[0].model},runtime:{node:process.versions.node,v8:process.versions.v8,uv:process.versions.uv,openssl:process.versions.openssl,kerberos:D0?D0.version:void 0}},configAntiPatterns:this._getConfigAntiPatterns(),periodicStatusInterval:Math.floor(this._statusEventDelay/1e3)}};return JSON.stringify(i)}_getConfigAntiPatterns(){let e=this._client.options,r={};return e.sslOptions&&!e.sslOptions.rejectUnauthorized&&(r.sslWithoutCertValidation="Client-to-node encryption is enabled but server certificate validation is disabled"),r}_getDataCenters(){let e=this._client.options.pooling.coreConnectionsPerHost[ys.distance.remote],r=new Set;return this._client.hosts.values().forEach(n=>{let i=this._client.profileManager.getDistance(n);(i===ys.distance.local||i===ys.distance.remote&&e>0)&&r.add(n.datacenter)}),Array.from(r)}async _getAppInfo(e){if(typeof e.applicationName=="string")return Promise.resolve({applicationName:e.applicationName,applicationVersion:e.applicationVersion,applicationNameWasGenerated:!1});let r=Promise.resolve();if(require.main&&require.main.filename){let o=QT.dirname(require.main.filename);r=this._readPackageInfoFile(o)}let n=await r,i="Default Node.js Application",s;if(n)try{let o=JSON.parse(n);o.name&&(i=o.name,s=o.version)}catch{}return{applicationName:i,applicationVersion:s,applicationNameWasGenerated:!0}}_readPackageInfoFile(e){return new Promise(r=>{B6.readFile(QT.join(e,"package.json"),"utf8",(n,i)=>{r(i)})})}_getStatusEvent(){let e=this._client.controlConnection,r=this._client.options,n=this._client.getState(),i={};n.getConnectedHosts().forEach(o=>{i[o.address]={connections:n.getOpenConnections(o),inFlightQueries:n.getInFlightQueries(o)}});let s={metadata:{name:"driver.status",insightMappingId:"v1",insightType:"EVENT",timestamp:Date.now(),tags:{language:"nodejs"}},data:{clientId:r.id,sessionId:this._sessionId,controlConnection:e.host?e.host.address:void 0,connectedNodes:i}};return JSON.stringify(s)}shutdown(){this._enabled&&(this._closed=!0,this._firstTimeout!==null&&clearTimeout(this._firstTimeout),this._recurrentTimeout!==null&&clearInterval(this._recurrentTimeout))}};c(k0,"InsightsClient");var P0=k0;r_.exports=P0;function t_(t){let e={};return t.forEach((r,n)=>e[n]=r),e}c(t_,"mapToObject");function nl(t){if(!t)return;let e=t.getOptions&&t.getOptions();return{type:t.constructor.name,options:e instanceof Map?t_(e):L0.emptyObject}}c(nl,"getPolicyInfo");function rl(t){if(typeof t=="number")return ys.consistencyToString[t]}c(rl,"getConsistencyString");function F6(t){return t?t.constructor.name:void 0}c(F6,"getConstructor");function q6(t){let e={},r=t.profileManager.getDefault();return e_(t,e,r,r),t.profileManager.getAll().filter(n=>n!==r).forEach(n=>e_(t,e,n,r)),e}c(q6,"getExecutionProfiles");function e_(t,e,r,n){let i=e[r.name]={};if(Ln(i,r,n,"readTimeout"),Ln(i,r,n,"loadBalancing",nl),Ln(i,r,n,"retry",nl),Ln(i,r,n,"consistency",rl),Ln(i,r,n,"serialConsistency",rl),r===n&&(i.speculativeExecution=nl(t.options.policies.speculativeExecution)),r.graphOptions){i.graphOptions={};let s=n.graphOptions||L0.emptyObject;Ln(i.graphOptions,r.graphOptions,s,"language"),Ln(i.graphOptions,r.graphOptions,s,"name"),Ln(i.graphOptions,r.graphOptions,s,"readConsistency",rl),Ln(i.graphOptions,r.graphOptions,s,"source"),Ln(i.graphOptions,r.graphOptions,s,"writeConsistency",rl),Object.keys(i.graphOptions).length===0&&(i.graphOptions=void 0)}}c(e_,"setExecutionProfileProperties");function Ln(t,e,r,n,i){let s=e[n];i=i||(o=>o),(e===r&&s!==void 0||s!==r[n])&&(t[n]=i(s))}c(Ln,"setExecutionProfileItem")});var F0=_(i_=>{i_.require=function(){if(typeof process=="object"&&process.versions&&process.versions.electron)try{let t=require("original-fs");if(Object.keys(t).length>0)return t}catch{}return require("fs")}});var q0=_((dY,s_)=>{s_.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var U0=_((pY,o_)=>{o_.exports={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed",FILE_IN_THE_WAY:"There is a file in the way: %s",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:"File not found: %s",NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found"}});var l_=_((gY,u_)=>{var U6=F0().require(),gr=require("path"),a_=q0(),V6=U0(),M6=typeof process=="object"&&process.platform==="win32",c_=c(t=>t&&typeof t=="object","is_Obj"),V0=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)e&1?e=3988292384^e>>>1:e>>>=1;return e>>>0});function Jt(t){this.sep=gr.sep,this.fs=U6,c_(t)&&c_(t.fs)&&typeof t.fs.statSync=="function"&&(this.fs=t.fs)}c(Jt,"Utils");u_.exports=Jt;Jt.prototype.makeDir=function(t){let e=this;function r(n){let i=n.split(e.sep)[0];n.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var o;try{o=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(o&&o.isFile())throw V6.FILE_IN_THE_WAY.replace("%s",i)}})}c(r,"mkdirSync"),r(t)};Jt.prototype.writeFileTo=function(t,e,r,n){let i=this;if(i.fs.existsSync(t)){if(!r)return!1;var s=i.fs.statSync(t);if(s.isDirectory())return!1}var o=gr.dirname(t);i.fs.existsSync(o)||i.makeDir(o);var a;try{a=i.fs.openSync(t,"w",438)}catch{i.fs.chmodSync(t,438),a=i.fs.openSync(t,"w",438)}if(a)try{i.fs.writeSync(a,e,0,e.length,0)}finally{i.fs.closeSync(a)}return i.fs.chmodSync(t,n||438),!0};Jt.prototype.writeFileToAsync=function(t,e,r,n,i){typeof n=="function"&&(i=n,n=void 0);let s=this;s.fs.exists(t,function(o){if(o&&!r)return i(!1);s.fs.stat(t,function(a,u){if(o&&u.isDirectory())return i(!1);var l=gr.dirname(t);s.fs.exists(l,function(f){f||s.makeDir(l),s.fs.open(t,"w",438,function(h,p){h?s.fs.chmod(t,438,function(){s.fs.open(t,"w",438,function(g,d){s.fs.write(d,e,0,e.length,0,function(){s.fs.close(d,function(){s.fs.chmod(t,n||438,function(){i(!0)})})})})}):p?s.fs.write(p,e,0,e.length,0,function(){s.fs.close(p,function(){s.fs.chmod(t,n||438,function(){i(!0)})})}):s.fs.chmod(t,n||438,function(){i(!0)})})})})})};Jt.prototype.findFiles=function(t){let e=this;function r(n,i,s){typeof i=="boolean"&&(s=i,i=void 0);let o=[];return e.fs.readdirSync(n).forEach(function(a){var u=gr.join(n,a);e.fs.statSync(u).isDirectory()&&s&&(o=o.concat(r(u,i,s))),(!i||i.test(u))&&o.push(gr.normalize(u)+(e.fs.statSync(u).isDirectory()?e.sep:""))}),o}return c(r,"findSync"),r(t,void 0,!0)};Jt.prototype.getAttributes=function(){};Jt.prototype.setAttributes=function(){};Jt.crc32update=function(t,e){return V0[(t^e)&255]^t>>>8};Jt.crc32=function(t){typeof t=="string"&&(t=Buffer.from(t,"utf8")),V0.length||genCRCTable();let e=t.length,r=-1;for(let n=0;n>>0};Jt.methodToString=function(t){switch(t){case a_.STORED:return"STORED ("+t+")";case a_.DEFLATED:return"DEFLATED ("+t+")";default:return"UNSUPPORTED ("+t+")"}};Jt.canonical=function(t){if(!t)return"";var e=gr.posix.normalize("/"+t.split("\\").join("/"));return gr.join(".",e)};Jt.sanitize=function(t,e){t=gr.resolve(gr.normalize(t));for(var r=e.split("/"),n=0,i=r.length;n{var sl=F0().require(),f_=require("path");sl.existsSync=sl.existsSync||f_.existsSync;h_.exports=function(t){var e=t||"",r=i(),n=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return c(i,"newAttr"),e&&sl.existsSync(e)?(n=sl.statSync(e),r.directory=n.isDirectory(),r.mtime=n.mtime,r.atime=n.atime,r.executable=(73&n.mode)!==0,r.readonly=(128&n.mode)===0,r.hidden=f_.basename(e)[0]==="."):console.warn("Invalid path: "+e),{get directory(){return r.directory},get readOnly(){return r.readonly},get hidden(){return r.hidden},get mtime(){return r.mtime},get atime(){return r.atime},get executable(){return r.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:e,isDirectory:r.directory,isReadOnly:r.readonly,isHidden:r.hidden,isExecutable:r.executable,mTime:r.mtime,aTime:r.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Eo=_((EY,rc)=>{rc.exports=l_();rc.exports.Constants=q0();rc.exports.Errors=U0();rc.exports.FileAttr=d_()});var g_=_((SY,p_)=>{var nc=Eo(),ie=nc.Constants;p_.exports=function(){var t=20,e=10,r=0,n=0,i=0,s=0,o=0,a=0,u=0,l=0,f=0,h=0,p=0,g=0,d=0;t|=nc.isWin?2560:768,r|=ie.FLG_EFS;var y={};function v(m){m=new Date(m),i=(m.getFullYear()-1980&127)<<25|m.getMonth()+1<<21|m.getDate()<<16|m.getHours()<<11|m.getMinutes()<<5|m.getSeconds()>>1}return c(v,"setTime"),v(+new Date),{get made(){return t},set made(m){t=m},get version(){return e},set version(m){e=m},get flags(){return r},set flags(m){r=m},get method(){return n},set method(m){switch(m){case ie.STORED:this.version=10;case ie.DEFLATED:default:this.version=20}n=m},get time(){return new Date((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1)},set time(m){v(m)},get timeHighByte(){return i>>>8&255},get crc(){return s},set crc(m){s=Math.max(0,m)>>>0},get compressedSize(){return o},set compressedSize(m){o=Math.max(0,m)>>>0},get size(){return a},set size(m){a=Math.max(0,m)>>>0},get fileNameLength(){return u},set fileNameLength(m){u=m},get extraLength(){return l},set extraLength(m){l=m},get commentLength(){return f},set commentLength(m){f=m},get diskNumStart(){return h},set diskNumStart(m){h=Math.max(0,m)>>>0},get inAttr(){return p},set inAttr(m){p=Math.max(0,m)>>>0},get attr(){return g},set attr(m){g=Math.max(0,m)>>>0},get fileAttr(){return g?(g>>>0|0)>>16&4095:0},get offset(){return d},set offset(m){d=Math.max(0,m)>>>0},get encrypted(){return(r&1)===1},get centralHeaderSize(){return ie.CENHDR+u+l+f},get realDataOffset(){return d+ie.LOCHDR+y.fnameLen+y.extraLen},get localHeader(){return y},loadLocalHeaderFromBinary:function(m){var w=m.slice(d,d+ie.LOCHDR);if(w.readUInt32LE(0)!==ie.LOCSIG)throw new Error(nc.Errors.INVALID_LOC);y={version:w.readUInt16LE(ie.LOCVER),flags:w.readUInt16LE(ie.LOCFLG),method:w.readUInt16LE(ie.LOCHOW),time:w.readUInt32LE(ie.LOCTIM),crc:w.readUInt32LE(ie.LOCCRC),compressedSize:w.readUInt32LE(ie.LOCSIZ),size:w.readUInt32LE(ie.LOCLEN),fnameLen:w.readUInt16LE(ie.LOCNAM),extraLen:w.readUInt16LE(ie.LOCEXT)}},loadFromBinary:function(m){if(m.length!==ie.CENHDR||m.readUInt32LE(0)!==ie.CENSIG)throw new Error(nc.Errors.INVALID_CEN);t=m.readUInt16LE(ie.CENVEM),e=m.readUInt16LE(ie.CENVER),r=m.readUInt16LE(ie.CENFLG),n=m.readUInt16LE(ie.CENHOW),i=m.readUInt32LE(ie.CENTIM),s=m.readUInt32LE(ie.CENCRC),o=m.readUInt32LE(ie.CENSIZ),a=m.readUInt32LE(ie.CENLEN),u=m.readUInt16LE(ie.CENNAM),l=m.readUInt16LE(ie.CENEXT),f=m.readUInt16LE(ie.CENCOM),h=m.readUInt16LE(ie.CENDSK),p=m.readUInt16LE(ie.CENATT),g=m.readUInt32LE(ie.CENATX),d=m.readUInt32LE(ie.CENOFF)},localHeaderToBinary:function(){var m=Buffer.alloc(ie.LOCHDR);return m.writeUInt32LE(ie.LOCSIG,0),m.writeUInt16LE(e,ie.LOCVER),m.writeUInt16LE(r,ie.LOCFLG),m.writeUInt16LE(n,ie.LOCHOW),m.writeUInt32LE(i,ie.LOCTIM),m.writeUInt32LE(s,ie.LOCCRC),m.writeUInt32LE(o,ie.LOCSIZ),m.writeUInt32LE(a,ie.LOCLEN),m.writeUInt16LE(u,ie.LOCNAM),m.writeUInt16LE(l,ie.LOCEXT),m},centralHeaderToBinary:function(){var m=Buffer.alloc(ie.CENHDR+u+l+f);return m.writeUInt32LE(ie.CENSIG,0),m.writeUInt16LE(t,ie.CENVEM),m.writeUInt16LE(e,ie.CENVER),m.writeUInt16LE(r,ie.CENFLG),m.writeUInt16LE(n,ie.CENHOW),m.writeUInt32LE(i,ie.CENTIM),m.writeUInt32LE(s,ie.CENCRC),m.writeUInt32LE(o,ie.CENSIZ),m.writeUInt32LE(a,ie.CENLEN),m.writeUInt16LE(u,ie.CENNAM),m.writeUInt16LE(l,ie.CENEXT),m.writeUInt16LE(f,ie.CENCOM),m.writeUInt16LE(h,ie.CENDSK),m.writeUInt16LE(p,ie.CENATT),m.writeUInt32LE(g,ie.CENATX),m.writeUInt32LE(d,ie.CENOFF),m.fill(0,ie.CENHDR),m},toJSON:function(){let m=c(function(w){return w+" bytes"},"bytes");return{made:t,version:e,flags:r,method:nc.methodToString(n),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:m(o),size:m(a),fileNameLength:m(u),extraLength:m(l),commentLength:m(f),diskNumStart:h,inAttr:p,attr:g,offset:d,centralHeaderSize:m(ie.CENHDR+u+l+f)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var m_=_((wY,y_)=>{var So=Eo(),pt=So.Constants;y_.exports=function(){var t=0,e=0,r=0,n=0,i=0;return{get diskEntries(){return t},set diskEntries(s){t=e=s},get totalEntries(){return e},set totalEntries(s){e=t=s},get size(){return r},set size(s){r=s},get offset(){return n},set offset(s){n=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return pt.ENDHDR+i},loadFromBinary:function(s){if((s.length!==pt.ENDHDR||s.readUInt32LE(0)!==pt.ENDSIG)&&(s.length{M0.EntryHeader=g_();M0.MainHeader=m_()});var E_=_((_Y,v_)=>{v_.exports=function(t){var e=require("zlib"),r={chunkSize:(parseInt(t.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(t,r)},deflateAsync:function(n){var i=e.createDeflateRaw(r),s=[],o=0;i.on("data",function(a){s.push(a),o+=a.length}),i.on("end",function(){var a=Buffer.alloc(o),u=0;a.fill(0);for(var l=0;l{var K6=+(process.versions?process.versions.node:"").split(".")[0]||0;S_.exports=function(t,e){var r=require("zlib");let n=K6>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return r.inflateRawSync(t,n)},inflateAsync:function(i){var s=r.createInflateRaw(n),o=[],a=0;s.on("data",function(u){o.push(u),a+=u.length}),s.on("end",function(){var u=Buffer.alloc(a),l=0;u.fill(0);for(var f=0;f{"use strict";var{randomFillSync:w_}=require("crypto"),H6=new Uint32Array(256).map((t,e)=>{for(let r=0;r<8;r++)e&1?e=e>>>1^3988292384:e>>>=1;return e>>>0}),T_=c((t,e)=>Math.imul(t,e)>>>0,"uMul"),x_=c((t,e)=>H6[(t^e)&255]^t>>>8,"crc32update"),ic=c(()=>typeof w_=="function"?w_(Buffer.alloc(12)):ic.node(),"genSalt");ic.node=()=>{let t=Buffer.alloc(12),e=t.length;for(let r=0;r>>24),t};al.prototype.next=function(){let t=(this.keys[2]|2)>>>0;return T_(t,t^1)>>8&255};function $6(t){let e=new al(t);return function(r){let n=Buffer.alloc(r.length),i=0;for(let s of r)n[i++]=e.updateKeys(s^e.next());return n}}c($6,"make_decrypter");function G6(t){let e=new al(t);return function(r,n,i=0){n||(n=Buffer.alloc(r.length));for(let s of r){let o=e.next();n[i++]=s^o,e.updateKeys(s)}return n}}c(G6,"make_encrypter");function j6(t,e,r){if(!t||!Buffer.isBuffer(t)||t.length<12)return Buffer.alloc(0);let n=$6(r),i=n(t.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw"ADM-ZIP: Wrong Password";return n(t.slice(12))}c(j6,"decrypt");function z6(t){Buffer.isBuffer(t)&&t.length>=12?ol.genSalt=function(){return t.slice(0,12)}:t==="node"?ol.genSalt=ic.node:ol.genSalt=ic}c(z6,"_salter");function W6(t,e,r,n=!1){t==null&&(t=Buffer.alloc(0)),Buffer.isBuffer(t)||(t=Buffer.from(t.toString()));let i=G6(r),s=ol.genSalt();s[11]=e.crc>>>24&255,n&&(s[10]=e.crc>>>16&255);let o=Buffer.alloc(t.length+12);return i(s,o),i(t,o,12)}c(W6,"encrypt");__.exports={decrypt:j6,encrypt:W6,_salter:z6}});var I_=_(cl=>{cl.Deflater=E_();cl.Inflater=C_();cl.ZipCrypto=b_()});var $0=_((BY,A_)=>{var Tt=Eo(),Q6=K0(),Mr=Tt.Constants,H0=I_();A_.exports=function(t){var e=new Q6.EntryHeader,r=Buffer.alloc(0),n=Buffer.alloc(0),i=!1,s=null,o=Buffer.alloc(0);function a(){return!t||!(t instanceof Uint8Array)?Buffer.alloc(0):(e.loadLocalHeaderFromBinary(t),t.slice(e.realDataOffset,e.realDataOffset+e.compressedSize))}c(a,"getCompressedDataFromZip");function u(d){return!((e.flags&8)!==8&&Tt.crc32(d)!==e.localHeader.crc)}c(u,"crc32OK");function l(d,y,v){if(typeof y>"u"&&typeof d=="string"&&(v=d,d=void 0),i)return d&&y&&y(Buffer.alloc(0),Tt.Errors.DIRECTORY_CONTENT_ERROR),Buffer.alloc(0);var m=a();if(m.length===0)return d&&y&&y(m),m;if(e.encrypted){if(typeof v!="string"&&!Buffer.isBuffer(v))throw new Error("ADM-ZIP: Incompatible password parameter");m=H0.ZipCrypto.decrypt(m,e,v)}var w=Buffer.alloc(e.size);switch(e.method){case Tt.Constants.STORED:if(m.copy(w),u(w))return d&&y&&y(w),w;throw d&&y&&y(w,Tt.Errors.BAD_CRC),new Error(Tt.Errors.BAD_CRC);case Tt.Constants.DEFLATED:var x=new H0.Inflater(m,e.size);if(d)x.inflateAsync(function(A){A.copy(A,0),y&&(u(A)?y(A):y(A,Tt.Errors.BAD_CRC))});else{if(x.inflate(w).copy(w,0),!u(w))throw new Error(Tt.Errors.BAD_CRC+" "+r.toString());return w}break;default:throw d&&y&&y(Buffer.alloc(0),Tt.Errors.UNKNOWN_METHOD),new Error(Tt.Errors.UNKNOWN_METHOD)}}c(l,"decompress");function f(d,y){if((!s||!s.length)&&Buffer.isBuffer(t))return d&&y&&y(a()),a();if(s.length&&!i){var v;switch(e.method){case Tt.Constants.STORED:return e.compressedSize=e.size,v=Buffer.alloc(s.length),s.copy(v),d&&y&&y(v),v;default:case Tt.Constants.DEFLATED:var m=new H0.Deflater(s);if(d)m.deflateAsync(function(x){v=Buffer.alloc(x.length),e.compressedSize=x.length,x.copy(v),y&&y(v)});else{var w=m.deflate();return e.compressedSize=w.length,w}m=null;break}}else if(d&&y)y(Buffer.alloc(0));else return Buffer.alloc(0)}c(f,"compress");function h(d,y){return(d.readUInt32LE(y+4)<<4)+d.readUInt32LE(y)}c(h,"readUInt64LE");function p(d){for(var y=0,v,m,w;y=Mr.EF_ZIP64_SCOMP&&(y=h(d,Mr.EF_ZIP64_SUNCOMP),e.size===Mr.EF_ZIP64_OR_32&&(e.size=y)),d.length>=Mr.EF_ZIP64_RHO&&(v=h(d,Mr.EF_ZIP64_SCOMP),e.compressedSize===Mr.EF_ZIP64_OR_32&&(e.compressedSize=v)),d.length>=Mr.EF_ZIP64_DSN&&(m=h(d,Mr.EF_ZIP64_RHO),e.offset===Mr.EF_ZIP64_OR_32&&(e.offset=m)),d.length>=Mr.EF_ZIP64_DSN+4&&(w=d.readUInt32LE(Mr.EF_ZIP64_DSN),e.diskNumStart===Mr.EF_ZIP64_OR_16&&(e.diskNumStart=w))}return c(g,"parseZip64ExtendedInformation"),{get entryName(){return r.toString()},get rawEntryName(){return r},set entryName(d){r=Tt.toBuffer(d);var y=r[r.length-1];i=y===47||y===92,e.fileNameLength=r.length},get extra(){return o},set extra(d){o=d,e.extraLength=d.length,p(d)},get comment(){return n.toString()},set comment(d){n=Tt.toBuffer(d),e.commentLength=n.length},get name(){var d=r.toString();return i?d.substr(d.length-1).split("/").pop():d.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return f(!1,null)},getCompressedDataAsync:function(d){f(!0,d)},setData:function(d){s=Tt.toBuffer(d),!i&&s.length?(e.size=s.length,e.method=Tt.Constants.DEFLATED,e.crc=Tt.crc32(d),e.changed=!0):e.method=Tt.Constants.STORED},getData:function(d){return e.changed?s:l(!1,null,d)},getDataAsync:function(d,y){e.changed?d(s):l(!0,d,y)},set attr(d){e.attr=d},get attr(){return e.attr},set header(d){e.loadFromBinary(d)},get header(){return e},packCentralHeader:function(){var d=e.centralHeaderToBinary(),y=Tt.Constants.CENHDR;return r.copy(d,y),y+=r.length,e.extraLength&&(o.copy(d,y),y+=e.extraLength),e.commentLength&&n.copy(d,y),d},packLocalHeader:function(){let d=0,y=e.localHeaderToBinary(),v=Buffer.alloc(y.length+r.length+o.length);return y.copy(v,d),d+=y.length,r.copy(v,d),d+=r.length,o.copy(v,d),d+=o.length,v},toJSON:function(){let d=c(function(y){return"<"+(y&&y.length+" bytes buffer"||"null")+">"},"bytes");return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:e.toJSON(),compressedData:d(t),data:d(s)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var R_=_((OY,B_)=>{var N_=$0(),Y6=K0(),$t=Eo();B_.exports=function(t,e){var r=[],n={},i=Buffer.alloc(0),s=new Y6.MainHeader,o=!1,a=null;let u=Object.assign(Object.create(null),e),{noSort:l}=u;t?p(u.readEntries):o=!0;function f(d){let y=s.diskEntries,v=s.offset;for(let m=0;m(t.length-s.offset)/$t.Constants.CENHDR)throw new Error($t.Errors.DISK_ENTRY_TOO_LARGE);r=new Array(s.diskEntries);for(var d=s.offset,y=0;y=m;y--)if(t[y]===80){if(t.readUInt32LE(y)===$t.Constants.ENDSIG){x=y,A=y,w=y+$t.Constants.ENDHDR,m=y-$t.Constants.END64HDR;continue}if(t.readUInt32LE(y)===$t.Constants.END64SIG){m=v;continue}if(t.readUInt32LE(y)===$t.Constants.ZIP64SIG){x=y,w=y+$t.readBigUInt64LE(t,y+$t.Constants.ZIP64SIZE)+$t.Constants.ZIP64LEAD;break}}if(!~x)throw new Error($t.Errors.INVALID_FORMAT);s.loadFromBinary(t.slice(x,w)),s.commentLength&&(i=t.slice(A+$t.Constants.ENDHDR)),d&&h()}c(p,"readMainHeader");function g(){r.length>1&&!l&&r.sort((d,y)=>d.entryName.toLowerCase().localeCompare(y.entryName.toLowerCase()))}return c(g,"sortEntries"),{get entries(){return o||h(),r},get comment(){return i.toString()},set comment(d){i=$t.toBuffer(d),s.commentLength=i.length},getEntryCount:function(){return o?r.length:s.diskEntries},forEach:function(d){if(!o){f(d);return}r.forEach(d)},getEntry:function(d){return o||h(),n[d]||null},setEntry:function(d){o||h(),r.push(d),n[d.entryName]=d,s.totalEntries=r.length},deleteEntry:function(d){o||h();var y=n[d];if(y&&y.isDirectory){var v=this;this.getEntryChildren(y).forEach(function(m){m.entryName!==d&&v.deleteEntry(m.entryName)})}r.splice(r.indexOf(y),1),delete n[d],s.totalEntries=r.length},getEntryChildren:function(d){if(o||h(),d&&d.isDirectory){let y=[],v=d.entryName,m=v.length;return r.forEach(function(w){w.entryName.substr(0,m)===v&&y.push(w)}),y}return[]},compressToBuffer:function(){o||h(),g();let d=[],y=[],v=0,m=0;s.size=0,s.offset=0;for(let A of r){let O=A.getCompressedData();A.header.offset=m;let L=A.packLocalHeader(),j=L.length+O.length;m+=j,d.push(L),d.push(O);let Y=A.packCentralHeader();y.push(Y),s.size+=Y.length,v+=j+Y.length}v+=s.mainHeaderSize,s.offset=m,m=0;let w=Buffer.alloc(v);for(let A of d)A.copy(w,m),m+=A.length;for(let A of y)A.copy(w,m),m+=A.length;let x=s.toBinary();return i&&i.copy(x,$t.Constants.ENDHDR),x.copy(w,m),w},toAsyncBuffer:function(d,y,v,m){try{o||h(),g();let w=[],x=[],A=0,O=0;s.size=0,s.offset=0;let L=c(function(j){if(j.length>0){let Y=j.shift(),se=Y.entryName+Y.extra.toString();v&&v(se),Y.getCompressedDataAsync(function(re){m&&m(se),Y.header.offset=O;let k=Y.packLocalHeader(),Ae=k.length+re.length;O+=Ae,w.push(k),w.push(re);let q=Y.packCentralHeader();x.push(q),s.size+=q.length,A+=Ae+q.length,L(j)})}else{A+=s.mainHeaderSize,s.offset=O,O=0;let Y=Buffer.alloc(A);w.forEach(function(re){re.copy(Y,O),O+=re.length}),x.forEach(function(re){re.copy(Y,O),O+=re.length});let se=s.toBinary();i&&i.copy(se,$t.Constants.ENDHDR),se.copy(Y,O),d(Y)}},"compress2Buffer");L(Array.from(r))}catch(w){y(w)}}}}});var D_=_((PY,O_)=>{var Nt=Eo(),kn=require("path"),Z6=$0(),X6=R_(),ms=c((t,e)=>typeof t=="boolean"?t:e,"get_Bool"),G0=c((t,e)=>typeof t=="string"?t:e,"get_Str"),J6={noSort:!1,readEntries:!1,method:Nt.Constants.NONE,fs:null};O_.exports=function(t,e){let r=null,n=Object.assign(Object.create(null),J6);t&&typeof t=="object"&&(t instanceof Uint8Array||(Object.assign(n,t),t=n.input?n.input:void 0,n.input&&delete n.input),Buffer.isBuffer(t)&&(r=t,n.method=Nt.Constants.BUFFER,t=void 0)),Object.assign(n,e);let i=new Nt(n);if(t&&typeof t=="string")if(i.fs.existsSync(t))n.method=Nt.Constants.FILE,n.filename=t,r=i.fs.readFileSync(t);else throw new Error(Nt.Errors.INVALID_FILENAME);let s=new X6(r,n),{canonical:o,sanitize:a}=Nt;function u(f){if(f&&s){var h;if(typeof f=="string"&&(h=s.getEntry(f)),typeof f=="object"&&typeof f.entryName<"u"&&typeof f.header<"u"&&(h=s.getEntry(f.entryName)),h)return h}return null}c(u,"getEntry");function l(f){let{join:h,normalize:p,sep:g}=kn.posix;return h(".",p(g+f.split("\\").join(g)+g))}return c(l,"fixPath"),{readFile:function(f,h){var p=u(f);return p&&p.getData(h)||null},readFileAsync:function(f,h){var p=u(f);p?p.getDataAsync(h):h(null,"getEntry failed for:"+f)},readAsText:function(f,h){var p=u(f);if(p){var g=p.getData();if(g&&g.length)return g.toString(h||"utf8")}return""},readAsTextAsync:function(f,h,p){var g=u(f);g?g.getDataAsync(function(d,y){if(y){h(d,y);return}d&&d.length?h(d.toString(p||"utf8")):h("")}):h("")},deleteFile:function(f){var h=u(f);h&&s.deleteEntry(h.entryName)},addZipComment:function(f){s.comment=f},getZipComment:function(){return s.comment||""},addZipEntryComment:function(f,h){var p=u(f);p&&(p.comment=h)},getZipEntryComment:function(f){var h=u(f);return h&&h.comment||""},updateFile:function(f,h){var p=u(f);p&&p.setData(h)},addLocalFile:function(f,h,p,g){if(i.fs.existsSync(f)){h=h?l(h):"";var d=f.split("\\").join("/").split("/").pop();h+=p||d;let y=i.fs.statSync(f);this.addFile(h,i.fs.readFileSync(f),g,y)}else throw new Error(Nt.Errors.FILE_NOT_FOUND.replace("%s",f))},addLocalFolder:function(f,h,p,g){if(p instanceof RegExp?p=function(d){return function(y){return d.test(y)}}(p):typeof p!="function"&&(p=c(function(){return!0},"filter")),h=h?l(h):"",f=kn.normalize(f),i.fs.existsSync(f)){let d=i.findFiles(f),y=this;d.length&&d.forEach(function(v){var m=kn.relative(f,v).split("\\").join("/");if(p(m)){var w=i.fs.statSync(v);w.isFile()?y.addFile(h+m,i.fs.readFileSync(v),"",g||w):y.addFile(h+m+"/",Buffer.alloc(0),"",g||w)}})}else throw new Error(Nt.Errors.FILE_NOT_FOUND.replace("%s",f))},addLocalFolderAsync:function(f,h,p,g){g instanceof RegExp?g=function(y){return function(v){return y.test(v)}}(g):typeof g!="function"&&(g=c(function(){return!0},"filter")),p=p?l(p):"",f=kn.normalize(f);var d=this;i.fs.open(f,"r",function(y){if(y&&y.code==="ENOENT")h(void 0,Nt.Errors.FILE_NOT_FOUND.replace("%s",f));else if(y)h(void 0,y);else{var v=i.findFiles(f),m=-1,w=c(function(){if(m+=1,m{w()})}else h(!0,void 0)},"next");w()}})},addLocalFolderPromise:function(f,h){return new Promise((p,g)=>{let{filter:d,zipPath:y}=Object.assign({},h);this.addLocalFolderAsync(f,(v,m)=>{m&&g(m),v&&p(this)},y,d)})},addFile:function(f,h,p,g){let d=u(f),y=d!=null;y||(d=new Z6,d.entryName=Nt.canonical(f)),d.comment=p||"";let v=typeof g=="object"&&g instanceof i.fs.Stats;v&&(d.header.time=g.mtime);var m=d.isDirectory?16:0;let w=d.isDirectory?16384:32768;return v?w|=4095&g.mode:typeof g=="number"?w|=4095&g:w|=d.isDirectory?493:420,m=(m|w<<16)>>>0,d.attr=m,d.setData(h),y||s.setEntry(d),d},getEntries:function(f){return s.password=f,s?s.entries:[]},getEntry:function(f){return u(f)},getEntryCount:function(){return s.getEntryCount()},forEach:function(f){return s.forEach(f)},extractEntryTo:function(f,h,p,g,d,y){g=ms(g,!1),d=ms(d,!1),p=ms(p,!0),y=G0(y,G0(d,void 0));var v=u(f);if(!v)throw new Error(Nt.Errors.NO_ENTRY);var m=o(v.entryName),w=a(h,y&&!v.isDirectory?y:p?m:kn.basename(m));if(v.isDirectory){var x=s.getEntryChildren(v);return x.forEach(function(L){if(L.isDirectory)return;var j=L.getData();if(!j)throw new Error(Nt.Errors.CANT_EXTRACT_FILE);var Y=o(L.entryName),se=a(h,p?Y:kn.basename(Y));let re=d?L.header.fileAttr:void 0;i.writeFileTo(se,j,g,re)}),!0}var A=v.getData(s.password);if(!A)throw new Error(Nt.Errors.CANT_EXTRACT_FILE);if(i.fs.existsSync(w)&&!g)throw new Error(Nt.Errors.CANT_OVERRIDE);let O=d?f.header.fileAttr:void 0;return i.writeFileTo(w,A,g,O),!0},test:function(f){if(!s)return!1;for(var h in s.entries)try{if(h.isDirectory)continue;var p=s.entries[h].getData(f);if(!p)return!1}catch{return!1}return!0},extractAllTo:function(f,h,p,g){if(h=ms(h,!1),g=G0(p,g),p=ms(p,!1),!s)throw new Error(Nt.Errors.NO_ZIP);s.entries.forEach(function(d){var y=a(f,o(d.entryName.toString()));if(d.isDirectory){i.makeDir(y);return}var v=d.getData(g);if(!v)throw new Error(Nt.Errors.CANT_EXTRACT_FILE);let m=p?d.header.fileAttr:void 0;i.writeFileTo(y,v,h,m);try{i.fs.utimesSync(y,d.header.time,d.header.time)}catch{throw new Error(Nt.Errors.CANT_EXTRACT_FILE)}})},extractAllToAsync:function(f,h,p,g){if(typeof h=="function"&&!g&&(g=h),h=ms(h,!1),typeof p=="function"&&!g&&(g=p),p=ms(p,!1),!g)return new Promise((w,x)=>{this.extractAllToAsync(f,h,p,function(A){A?x(A):w(this)})});if(!s){g(new Error(Nt.Errors.NO_ZIP));return}f=kn.resolve(f);let d=c(w=>a(f,kn.normalize(o(w.entryName.toString()))),"getPath"),y=c((w,x)=>new Error(w+': "'+x+'"'),"getError"),v=[],m=[];s.entries.forEach(w=>{w.isDirectory?v.push(w):m.push(w)});for(let w of v){let x=d(w),A=p?w.header.fileAttr:void 0;try{i.makeDir(x),A&&i.fs.chmodSync(x,A),i.fs.utimesSync(x,w.header.time,w.header.time)}catch{g(y("Unable to create folder",x))}}m.reverse().reduce(function(w,x){return function(A){if(A)w(A);else{let O=kn.normalize(o(x.entryName.toString())),L=a(f,O);x.getDataAsync(function(j,Y){if(Y)w(new Error(Y));else if(!j)w(new Error(Nt.Errors.CANT_EXTRACT_FILE));else{let se=p?x.header.fileAttr:void 0;i.writeFileToAsync(L,j,h,se,function(re){re||w(y("Unable to write file",L)),i.fs.utimes(L,x.header.time,x.header.time,function(k){k?w(y("Unable to set times",L)):w()})})}})}}},g)()},writeZip:function(f,h){if(arguments.length===1&&typeof f=="function"&&(h=f,f=""),!f&&n.filename&&(f=n.filename),!!f){var p=s.compressToBuffer();if(p){var g=i.writeFileTo(f,p,!0);typeof h=="function"&&h(g?null:new Error("failed"),"")}}},writeZipPromise:function(f,h){let{overwrite:p,perm:g}=Object.assign({overwrite:!0},h);return new Promise((d,y)=>{!f&&n.filename&&(f=n.filename),f||y("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(v=>{let m=c(w=>w?d(w):y("ADM-ZIP: Wasn't able to write zip file"),"ret");i.writeFileToAsync(f,v,p,g,m)},y)})},toBufferPromise:function(){return new Promise((f,h)=>{s.toAsyncBuffer(f,h)})},toBuffer:function(f,h,p,g){return this.valueOf=2,typeof f=="function"?(s.toAsyncBuffer(f,h,p,g),null):s.compressToBuffer()}}}});var q_=_((kY,F_)=>{"use strict";var eU=require("https"),tU=require("fs"),L_=require("util"),rU=D_(),{URL:nU}=require("url"),iU=ze(),P_=oe(),{DsePlainTextAuthProvider:sU,NoAuthProvider:oU}=Oa(),aU=L_.promisify(tU.readFile);async function cU(t){if(!t.cloud)return;let e=new z0(t);await uU(e),await fU(e),e.clientOptions.sslOptions.checkServerIdentity||(e.clientOptions.sslOptions.checkServerIdentity=(r,n)=>k_(n,e.clientOptions.sni.address))}c(cU,"init");var W0=class W0{constructor(e){this.clientOptions=e,e.cloud.secureConnectBundle?(this.secureConnectBundle=e.cloud.secureConnectBundle,this.serviceUrl=null):this.serviceUrl=e.cloud.endpoint,this.logEmitter=e.logEmitter,this.contactPoints=null,this.localDataCenter=null}setSslOptions(e){this.clientOptions.sslOptions=Object.assign({ca:[e.get("ca.crt")],cert:e.get("cert"),key:e.get("key"),rejectUnauthorized:!0},this.clientOptions.sslOptions)}setAuthProvider(e,r){!e||!r||this.clientOptions.authProvider&&!(this.clientOptions.authProvider instanceof oU)||(this.clientOptions.authProvider=new sU(e,r))}};c(W0,"CloudOptions");var z0=W0;async function uU(t){if(t.serviceUrl)return;if(!t.secureConnectBundle)throw new TypeError("secureConnectBundle must be provided");let e=await aU(t.secureConnectBundle),r=new rU(e),n=new Map(r.getEntries().map(s=>[s.entryName,s.getData()]));if(!n.get("config.json"))throw new TypeError("Config file must be contained in secure bundle");let i=JSON.parse(n.get("config.json").toString("utf8"));if(!i.host||!i.port)throw new TypeError("Config file must include host and port information");t.serviceUrl=`${i.host}:${i.port}/metadata`,t.setSslOptions(n),t.setAuthProvider(i.username,i.password)}c(uU,"parseZipFile");function lU(t,e){let n=/^(.+?):(\d+)(.*)$/.exec(t.serviceUrl);if(e=P_.callbackOnce(e),!n||n.length!==4)throw new TypeError("url should be composed of host, port number and path, without scheme");let i=Object.assign({hostname:n[1],port:n[2],path:n[3]||void 0,timeout:t.clientOptions.socketOptions.connectTimeout},t.clientOptions.sslOptions),s=eU.get(i,o=>{let a="";P_.log("verbose",`Connected to metadata service with SSL/TLS protocol ${o.socket.getProtocol()}`,{},t),o.on("data",u=>a+=u.toString()).on("end",()=>{if(o.statusCode!==200)return e(j0(new Error(`Obtained http status ${o.statusCode}`),i));let u;try{if(u=JSON.parse(a),!u||!u.contact_info)throw new TypeError("contact_info should be defined in response")}catch(f){return e(j0(f,i,!0))}let l=u.contact_info;t.clientOptions.contactPoints=l.contact_points,t.clientOptions.localDataCenter=l.local_dc,t.clientOptions.sni={address:l.sni_proxy_address},e()})});s.on("error",o=>e(j0(o,i))),s.setTimeout(t.clientOptions.socketOptions.connectTimeout,()=>s.abort())}c(lU,"getMetadataServiceInfo");var fU=L_.promisify(lU);function j0(t,e,r){let n=r?"There was an error while parsing the metadata service information":"There was an error fetching the metadata information",i=`${e.hostname}:${e.port}${e.path?e.path:"/"}`;return new iU.NoHostAvailableError({[i]:t},n)}c(j0,"getServiceRequestError");function k_(t,e){let r=e.split(":")[0],n=t.subjectaltname,i=t.subject.CN;if(r===i)return;let s=[];if(n)for(let l of n.split(", "))l.startsWith("DNS:")?s.push(l.slice(4)):l.startsWith("URI:")&&s.push(new nU(l.slice(4)).hostname);let o=r.split("."),a=c(l=>hU(o,l),"wildcard"),u;if(s.length>0?u=s.some(a):u=a(i),!u){let l=new Error(`Host: ${r} is not cert's CN/altnames: ${i} / ${n}`);return l.reason=l.message,l.host=r,l.cert=t,l}}c(k_,"checkServerIdentity");function hU(t,e){if(!e)return!1;let r=e.split(".");if(t.length!==r.length)return!1;for(let u=t.length-1;u>0;u-=1)if(t[u]!==r[u])return!1;let n=t[0],i=r[0],s=i.split("*");if(s.length===1||i.includes("xn--"))return n===i;if(s.length>2||r.length<=2)return!1;let[o,a]=s;return!(o.length+a.length>n.length||!n.startsWith(o)||!n.endsWith(a))}c(hU,"checkParts");F_.exports={checkServerIdentity:k_,init:cU}});var Q0=_((qY,M_)=>{"use strict";var U_=oe();function V_(t,e){this.info=t.info;let r=t.rows;e=e||dU,this.length=t.rowLength,this.pageState=t.pageState,this.first=c(function(){let s=this.values().next();return s.done?null:s.value},"first"),this.forEach=c(function(i,s){if(!r.length)return;let o=this.values(),a=o.next(),u=0;for(;!a.done;)i.call(s||this,a.value,u++),a=o.next()},"forEach"),this.toArray=c(function(){return r.length?U_.iteratorToArray(this.values()):U_.emptyArray},"toArray"),this.values=c(function*(){for(let i of this.getTraversers()){let s=i.bulk||1;for(let o=0;o{"use strict";var pU=Ke(),{dataTypes:ll}=pU,Y0=class Y0{constructor(e,r){this.value=e,this.typeInfo=typeof r=="number"?{code:r}:r}};c(Y0,"GraphTypeWrapper");var vs=Y0,Z0=class Z0{constructor(e,r){if(this.value=e,!r||!r.name||!r.keyspace||!r.fields)throw new TypeError("udtInfo must be an object with name, keyspace and field properties defined");this.udtInfo=r}};c(Z0,"UdtGraphWrapper");var ul=Z0;function gU(t){return new vs(t,ll.int)}c(gU,"asInt");function yU(t){return new vs(t,ll.double)}c(yU,"asDouble");function mU(t){return new vs(t,ll.float)}c(mU,"asFloat");function vU(t){return new vs(t,ll.timestamp)}c(vU,"asTimestamp");function EU(t,e){return new ul(t,e)}c(EU,"asUdt");K_.exports={asInt:gU,asDouble:yU,asFloat:mU,asTimestamp:vU,asUdt:EU,UdtGraphWrapper:ul,GraphTypeWrapper:vs}});var j_=_((KY,G_)=>{"use strict";var{GraphTypeWrapper:SU,UdtGraphWrapper:CU}=fl(),hl=Ke(),wU=Ou(),{dataTypes:Co}=hl;function X0(t){if(t instanceof hl.Tuple)return{cqlType:"tuple",definition:t.elements.map(X0)};if(t instanceof Map){let r={cqlType:"map"};if(t.size>0){let n=t.entries().next().value;r.definition=n.map(X0)}return r}if(t instanceof CU)return $_(t);let e;return t instanceof SU?e=t.typeInfo:e=wU.guessDataType(t),e?dl(e):null}c(X0,"getTypeDefinitionByValue");function dl(t){return t.code===Co.udt?H_(t.info):t.code===Co.tuple||t.code===Co.map?{cqlType:hl.getDataTypeNameByCode(t),definition:t.info.map(dl)}:t.code===Co.list||t.code===Co.set?{cqlType:t.code===Co.list?"list":"set",definition:[dl(t.info)]}:{cqlType:hl.getDataTypeNameByCode(t)}}c(dl,"getDefinitionByType");function H_(t){return{cqlType:"udt",keyspace:t.keyspace,name:t.name,definition:t.fields.map(e=>Object.assign({fieldName:e.name},dl(e.type)))}}c(H_,"getUdtTypeDefinition");function $_(t){return H_(t.udtInfo)}c($_,"getUdtTypeDefinitionByValue");G_.exports={getTypeDefinitionByValue:X0,getUdtTypeDefinitionByValue:$_}});var eg=_(($Y,Y_)=>{"use strict";var J0=require("util");function Es(t,e){this.id=t,this.label=e}c(Es,"Element");function z_(t,e,r){Es.call(this,t,e),this.properties=r}c(z_,"Vertex");J0.inherits(z_,Es);function W_(t,e,r,n,i,s,o){Es.call(this,t,n),this.outV=e,this.outVLabel=r,this.inV=i,this.inVLabel=s,this.properties={},c(function(u){if(o){let l=Object.keys(o);for(let f=0;f{"use strict";var Fn=Ke(),_U=oe(),{getTypeDefinitionByValue:bU,getUdtTypeDefinitionByValue:IU}=j_(),{Point:AU,Polygon:NU,LineString:BU}=Nu(),{Edge:RU}=eg(),{GraphTypeWrapper:OU,UdtGraphWrapper:DU}=fl(),{Tuple:Z_,dataTypes:sc}=Fn,Cs="@type",Rr="@value",vg=class vg{constructor(){this.key="g:Edge"}deserialize(e){let r=e[Rr];return new RU(this.reader.read(r.id),this.reader.read(r.outV),r.outVLabel,r.label,this.reader.read(r.inV),r.inVLabel,this.reader.read(r.properties))}};c(vg,"EdgeDeserializer");var tg=vg,Eg=class Eg{constructor(e,r){if(!e)throw new Error("Deserializer must provide a type key");if(!r)throw new Error("Deserializer must provide a target type");this.key=e,this.targetType=r}deserialize(e){let r=e[Rr];return typeof r!="string"&&(r=r.toString()),this.targetType.fromString(r)}serialize(e){return{[Cs]:this.key,[Rr]:e.toString()}}canBeUsedFor(e){return e instanceof this.targetType}};c(Eg,"StringBasedTypeSerializer");var Or=Eg,Sg=class Sg extends Or{constructor(){super("g:UUID",Fn.Uuid)}};c(Sg,"UuidSerializer");var rg=Sg,Cg=class Cg extends Or{constructor(){super("g:Int64",Fn.Long)}};c(Cg,"LongSerializer");var ng=Cg,wg=class wg extends Or{constructor(){super("gx:BigDecimal",Fn.BigDecimal)}};c(wg,"BigDecimalSerializer");var ig=wg,xg=class xg extends Or{constructor(){super("gx:BigInteger",Fn.Integer)}};c(xg,"BigIntegerSerializer");var sg=xg,Tg=class Tg extends Or{constructor(){super("gx:InetAddress",Fn.InetAddress)}};c(Tg,"InetAddressSerializer");var og=Tg,_g=class _g extends Or{constructor(){super("gx:LocalDate",Fn.LocalDate)}};c(_g,"LocalDateSerializer");var ag=_g,bg=class bg extends Or{constructor(){super("gx:LocalTime",Fn.LocalTime)}};c(bg,"LocalTimeSerializer");var cg=bg,Ig=class Ig extends Or{constructor(){super("gx:Instant",Date)}serialize(e){return{[Cs]:this.key,[Rr]:e.toISOString()}}deserialize(e){return new Date(e[Rr])}};c(Ig,"InstantSerializer");var ug=Ig,Ag=class Ag extends Or{constructor(){super("dse:Blob",Buffer)}deserialize(e){return _U.allocBufferFromString(e[Rr],"base64")}serialize(e){return{[Cs]:this.key,[Rr]:e.toString("base64")}}};c(Ag,"BlobSerializer");var lg=Ag,Ng=class Ng extends Or{constructor(){super("dse:Point",AU)}};c(Ng,"PointSerializer");var fg=Ng,Bg=class Bg extends Or{constructor(){super("dse:LineString",BU)}};c(Bg,"LineStringSerializer");var hg=Bg,Rg=class Rg extends Or{constructor(){super("dse:Polygon",NU)}};c(Rg,"PolygonSerializer");var dg=Rg,Og=class Og{constructor(){this.key="dse:Tuple"}deserialize(e){let r=e[Rr].value;if(!Array.isArray(r))throw new Error("Expected Array, obtained: "+r);let n=[];for(let i of r)n.push(this.reader.read(i));return Z_.fromArray(n)}serialize(e){let r={cqlType:"tuple",definition:e.elements.map(bU),value:e.elements.map(n=>this.writer.adaptObject(n))};return{[Cs]:this.key,[Rr]:r}}canBeUsedFor(e){return e instanceof Z_}};c(Og,"TupleSerializer");var pg=Og,Dg=class Dg{constructor(){this.key="dse:Duration"}deserialize(e){let r=e[Rr];return new Fn.Duration(this.reader.read(r.months),this.reader.read(r.days),this.reader.read(r.nanos))}serialize(e){return{[Cs]:this.key,[Rr]:{months:e.months,days:e.days,nanos:e.nanoseconds}}}canBeUsedFor(e){return e instanceof Fn.Duration}};c(Dg,"DurationSerializer");var gg=Dg,Pg=class Pg{constructor(){this.key="dse:UDT"}deserialize(e){let r=e[Rr],n={},i=r.value;return r.definition.forEach((s,o)=>{n[s.fieldName]=this.reader.read(i[o])}),n}serialize(e){let r=IU(e);return r.value=Object.entries(e.value).map(([n,i])=>this.writer.adaptObject(i)),{[Cs]:this.key,[Rr]:r}}canBeUsedFor(e){return e instanceof DU}};c(Pg,"UdtSerializer");var yg=Pg,Lg=class Lg{constructor(e,r){this._name=e,this._transformFn=r||(n=>n)}serialize(e){return{[Cs]:this._name,[Rr]:this._transformFn(e)}}};c(Lg,"InternalSerializer");var Ss=Lg,PU={[sc.int]:new Ss("g:Int32"),[sc.bigint]:new Ss("g:Int64"),[sc.double]:new Ss("g:Double"),[sc.float]:new Ss("g:Float"),[sc.timestamp]:new Ss("g:Timestamp",t=>t.getTime())},kg=class kg{constructor(){this.key="client:wrapper"}serialize(e){let r=PU[e.typeInfo.code];if(!r)throw new Error(`No serializer found for wrapped value ${e}`);return r.serialize(e.value)}canBeUsedFor(e){return e instanceof OU}};c(kg,"GraphTypeWrapperSerializer");var mg=kg,LU=[tg,rg,ng,ig,sg,og,ag,cg,ug,lg,fg,hg,dg,pg,yg,mg,gg];function kU(){let t={};return LU.forEach(e=>{let r=new e;if(!r.key)throw new TypeError(`Key for ${e} instance not set`);t[r.key]=r}),t}c(kU,"getCustomSerializers");X_.exports=kU});var Vg=_((WY,J_)=>{"use strict";var FU=Q0(),qU=Fg(),{asInt:UU,asDouble:VU,asFloat:MU,asTimestamp:KU,asUdt:HU,UdtGraphWrapper:$U,GraphTypeWrapper:GU}=fl(),{Edge:jU,Element:zU,Path:WU,Property:QU,Vertex:YU,VertexProperty:ZU}=eg(),Ug=class Ug{constructor(e,r){this.typeName=e,this.elementName=r}toString(){return this.elementName}};c(Ug,"EnumValue");var oi=Ug,XU={id:new oi("T","id"),key:new oi("T","key"),label:new oi("T","label"),value:new oi("T","value")},qg={both:new oi("Direction","BOTH"),in:new oi("Direction","IN"),out:new oi("Direction","OUT")};qg.in_=qg.in;J_.exports={Edge:jU,Element:zU,Path:WU,Property:QU,Vertex:YU,VertexProperty:ZU,asInt:UU,asDouble:VU,asFloat:MU,asTimestamp:KU,asUdt:HU,direction:qg,getCustomTypeSerializers:qU,GraphResultSet:FU,GraphTypeWrapper:GU,t:XU,UdtGraphWrapper:$U}});var tb=_((YY,eb)=>{"use strict";var wn={P:Ri,TextP:Ri,Traversal:Ri,Traverser:Ri,EnumValue:Ri},JU={TraversalStrategy:Ri},e8=Ri,tn=Vg(),t8={Long:Ri};wn.t=tn.t;wn.direction=tn.direction;function Ri(){}c(Ri,"UnsupportedType");var He="@value",er="@type",uy=class uy{serialize(){throw new Error("serialize() method not implemented for "+this.constructor.name)}deserialize(){throw new Error("deserialize() method not implemented for "+this.constructor.name)}canBeUsedFor(){throw new Error("canBeUsedFor() method not implemented for "+this.constructor.name)}};c(uy,"TypeSerializer");var gt=uy,ly=class ly extends gt{serialize(e){return isNaN(e)?{[er]:"g:Double",[He]:"NaN"}:e===Number.POSITIVE_INFINITY?{[er]:"g:Double",[He]:"Infinity"}:e===Number.NEGATIVE_INFINITY?{[er]:"g:Double",[He]:"-Infinity"}:e}deserialize(e){var r=e[He];return r==="NaN"?NaN:r==="Infinity"?Number.POSITIVE_INFINITY:r==="-Infinity"?Number.NEGATIVE_INFINITY:parseFloat(r)}canBeUsedFor(e){return typeof e=="number"}};c(ly,"NumberSerializer");var Mg=ly,fy=class fy extends gt{serialize(e){return{[er]:"g:Date",[He]:e.getTime()}}deserialize(e){return new Date(e[He])}canBeUsedFor(e){return e instanceof Date}};c(fy,"DateSerializer");var Kg=fy,hy=class hy extends gt{serialize(e){return{[er]:"g:Int64",[He]:e.value}}canBeUsedFor(e){return e instanceof t8.Long}};c(hy,"LongSerializer");var Hg=hy,dy=class dy extends gt{serialize(e){let r=e;e instanceof wn.Traversal&&(r=e.getBytecode());let n={};n[er]="g:Bytecode";let i=n[He]={},s=this._serializeInstructions(r.sourceInstructions);s&&(i.source=s);let o=this._serializeInstructions(r.stepInstructions);return o&&(i.step=o),n}_serializeInstructions(e){if(e.length===0)return null;let r=new Array(e.length);r[0]=e[0];for(let n=0;nthis.writer.adaptObject(i));return r}canBeUsedFor(e){return e instanceof e8||e instanceof wn.Traversal}};c(dy,"BytecodeSerializer");var $g=dy,py=class py extends gt{serialize(e){let r={};r[er]="g:P";let n=r[He]={predicate:e.operator};return e.other===void 0||e.other===null?n.value=this.writer.adaptObject(e.value):n.value=[this.writer.adaptObject(e.value),this.writer.adaptObject(e.other)],r}canBeUsedFor(e){return e instanceof wn.P}};c(py,"PSerializer");var Gg=py,gy=class gy extends gt{serialize(e){let r={};r[er]="g:TextP";let n=r[He]={predicate:e.operator};return e.other===void 0||e.other===null?n.value=this.writer.adaptObject(e.value):n.value=[this.writer.adaptObject(e.value),this.writer.adaptObject(e.other)],r}canBeUsedFor(e){return e instanceof wn.TextP}};c(gy,"TextPSerializer");var jg=gy,yy=class yy extends gt{serialize(e){return{[er]:"g:Lambda",[He]:{arguments:e.length,language:"gremlin-javascript",script:e.toString()}}}canBeUsedFor(e){return typeof e=="function"}};c(yy,"LambdaSerializer");var zg=yy,my=class my extends gt{serialize(e){return{[er]:"g:"+e.typeName,[He]:e.elementName}}canBeUsedFor(e){return e&&e.typeName&&e instanceof wn.EnumValue}};c(my,"EnumSerializer");var Wg=my,vy=class vy extends gt{serialize(e){return{[er]:"g:Traverser",[He]:{value:this.writer.adaptObject(e.object),bulk:this.writer.adaptObject(e.bulk)}}}deserialize(e){let r=e[He];return new wn.Traverser(this.reader.read(r.value),this.reader.read(r.bulk))}canBeUsedFor(e){return e instanceof wn.Traverser}};c(vy,"TraverserSerializer");var Qg=vy,Ey=class Ey extends gt{serialize(e){return{[er]:"g:"+e.constructor.name,[He]:e.configuration}}canBeUsedFor(e){return e instanceof JU.TraversalStrategy}};c(Ey,"TraversalStrategySerializer");var Yg=Ey,Sy=class Sy extends gt{deserialize(e){let r=e[He];return new tn.Vertex(this.reader.read(r.id),r.label,this.reader.read(r.properties))}serialize(e){return{[er]:"g:Vertex",[He]:{id:this.writer.adaptObject(e.id),label:e.label}}}canBeUsedFor(e){return e instanceof tn.Vertex}};c(Sy,"VertexSerializer");var Zg=Sy,Cy=class Cy extends gt{deserialize(e){let r=e[He];return new tn.VertexProperty(this.reader.read(r.id),r.label,this.reader.read(r.value),this.reader.read(r.properties))}};c(Cy,"VertexPropertySerializer");var Xg=Cy,wy=class wy extends gt{deserialize(e){let r=e[He];return new tn.Property(r.key,this.reader.read(r.value))}};c(wy,"PropertySerializer");var Jg=wy,xy=class xy extends gt{deserialize(e){let r=e[He];return new tn.Edge(this.reader.read(r.id),new tn.Vertex(this.reader.read(r.outV),this.reader.read(r.outVLabel)),r.label,new tn.Vertex(this.reader.read(r.inV),this.reader.read(r.inVLabel)),this.reader.read(r.properties))}serialize(e){return{[er]:"g:Edge",[He]:{id:this.writer.adaptObject(e.id),label:e.label,outV:this.writer.adaptObject(e.outV.id),outVLabel:e.outV.label,inV:this.writer.adaptObject(e.inV.id),inVLabel:e.inV.label}}}canBeUsedFor(e){return e instanceof tn.Edge}};c(xy,"EdgeSerializer");var ey=xy,Ty=class Ty extends gt{deserialize(e){let r=e[He],n=r.objects.map(i=>this.reader.read(i));return new tn.Path(this.reader.read(r.labels),n)}};c(Ty,"PathSerializer");var ty=Ty,_y=class _y extends gt{deserialize(e){let r=e[He];return new tn.Path(this.reader.read(r.labels),this.reader.read(r.objects))}};c(_y,"Path3Serializer");var ry=_y,by=class by extends gt{deserialize(e){return wn.t[e[He]]}};c(by,"TSerializer");var ny=by,Iy=class Iy extends gt{deserialize(e){return wn.direction[e[He].toLowerCase()]}};c(Iy,"DirectionSerializer");var iy=Iy,Ay=class Ay extends gt{constructor(e){super(),this.typeKey=e}deserialize(e){let r=e[He];if(!Array.isArray(r))throw new Error("Expected Array, obtained: "+r);return r.map(n=>this.reader.read(n))}serialize(e){return{[er]:this.typeKey,[He]:e.map(r=>this.writer.adaptObject(r))}}canBeUsedFor(e){return Array.isArray(e)}};c(Ay,"ArraySerializer");var pl=Ay,Ny=class Ny extends gt{deserialize(e){let r=e[He];if(!Array.isArray(r))throw new Error("Expected Array, obtained: "+r);let n=[];for(let i=0,s=r.length;i{r.push(this.writer.adaptObject(i)),r.push(this.writer.adaptObject(n))}),{[er]:"g:Map",[He]:r}}canBeUsedFor(e){return e instanceof Map}};c(By,"MapSerializer");var oy=By,Ry=class Ry extends pl{constructor(){super("g:List")}};c(Ry,"ListSerializer");var ay=Ry,Oy=class Oy extends pl{constructor(){super("g:Set")}};c(Oy,"SetSerializer");var cy=Oy;eb.exports={BulkSetSerializer:sy,BytecodeSerializer:$g,DateSerializer:Kg,DirectionSerializer:iy,EdgeSerializer:ey,EnumSerializer:Wg,LambdaSerializer:zg,ListSerializer:ay,LongSerializer:Hg,MapSerializer:oy,NumberSerializer:Mg,Path3Serializer:ry,PathSerializer:ty,PropertySerializer:Jg,PSerializer:Gg,TextPSerializer:jg,SetSerializer:cy,TSerializer:ny,TraverserSerializer:Qg,TraversalStrategySerializer:Yg,typeKey:er,valueKey:He,VertexPropertySerializer:Xg,VertexSerializer:Zg}});var sb=_((XY,ib)=>{"use strict";var Ne=tb(),Dy=class Dy{constructor(e){this._options=e||{},this._serializers=this.getDefaultSerializers().map(n=>{let i=new n;return i.writer=this,i});let r=this._options.serializers||{};Object.keys(r).forEach(n=>{let i=r[n];i.serialize&&(i.writer=this,this._serializers.unshift(i))})}getDefaultSerializers(){return nb}adaptObject(e){let r;for(let n=0;nthis.adaptObject(n)):e}write(e){return JSON.stringify(this.adaptObject(e))}};c(Dy,"GraphSON2Writer");var gl=Dy,Py=class Py extends gl{getDefaultSerializers(){return n8}};c(Py,"GraphSON3Writer");var yl=Py,Ly=class Ly{constructor(e){this._options=e||{},this._deserializers={};let r=this.getDefaultDeserializers();if(Object.keys(r).forEach(n=>{let i=r[n],s=new i;s.reader=this,this._deserializers[n]=s}),this._options.serializers){let n=this._options.serializers||{};Object.keys(n).forEach(i=>{let s=n[i];s.deserialize&&(s.reader=this,this._deserializers[i]=s)})}}getDefaultDeserializers(){return rb}read(e){if(e===void 0)return;if(e===null)return null;if(Array.isArray(e))return e.map(n=>this.read(n));let r=e[Ne.typeKey];if(r){let n=this._deserializers[r];return n?n.deserialize(e):e[Ne.valueKey]}return e&&typeof e=="object"&&e.constructor===Object?this._deserializeObject(e):e}_deserializeObject(e){let r=Object.keys(e),n={};for(let i=0;i{"use strict";var i8=require("util"),ws=Ke(),tr=oe(),{DefaultExecutionOptions:s8,proxyExecuteKey:o8}=xi(),ob=ws.Long,Oi,a8=Object.freeze({graphson1:"graphson-1.0",graphson2:"graphson-2.0",graphson3:"graphson-3.0"}),ur=Object.freeze({language:"graph-language",source:"graph-source",name:"graph-name",results:"graph-results",writeConsistency:"graph-write-consistency",readConsistency:"graph-read-consistency",timeout:"request-timeout"});function c8(t,e,r,n){return t.getOrCreateGraphOptions(n,c(function(){let s=n.graphOptions||tr.emptyObject,o=t.getDefault(),a={customPayload:{[ur.language]:tr.allocBufferFromString(s.language||e.language),[ur.source]:tr.allocBufferFromString(s.source||e.source)},graphLanguage:s.language||e.language,graphResults:s.results||e.results,graphSource:s.source||e.source,graphName:tr.ifUndefined(s.name,e.name)};n!==o?a.retry=n.retry||e.retry:a.retry=r||e.retry,e.executeAs&&(a.customPayload[o8]=tr.allocBufferFromString(e.executeAs)),a.graphName&&(a.customPayload[ur.name]=tr.allocBufferFromString(a.graphName));let u=tr.ifUndefined(s.results,e.graphResults);u!==void 0&&(a.customPayload[ur.results]=tr.allocBufferFromString(u));let l=tr.ifUndefined(s.readConsistency,e.readConsistency);l!==void 0&&(a.customPayload[ur.readConsistency]=tr.allocBufferFromString(El(l)));let f=tr.ifUndefined(s.writeConsistency,e.writeConsistency);return f!==void 0&&(a.customPayload[ur.writeConsistency]=tr.allocBufferFromString(El(f))),a.readTimeout=tr.ifUndefined3(n.readTimeout,o.readTimeout,e.readTimeout),a.readTimeout>0&&(a.customPayload[ur.timeout]=ab(a.readTimeout)),a},"createDefaultOptions"))}c(c8,"getDefaultGraphOptions");function wo(t,e,r,n,i){if(i=i||tr.allocBufferFromString,n!==null){if(n!==void 0){t[r]=i(n);return}e.customPayload[r]&&(t[r]=e.customPayload[r])}}c(wo,"setPayloadKey");function ab(t){return t=ob.fromNumber(t),ob.toBuffer(t)}c(ab,"longBuffer");function El(t){if(t==null)return;u8();let e=Oi[t];if(!e)throw new Error(i8.format("Consistency %s not found, use values defined as properties in types.consistencies object",t));return e}c(El,"getConsistencyName");function u8(){if(Oi)return;Oi={};let t=Object.keys(ws.consistencies);for(let e=0;e0?this.getReadTimeout():null,ab),n[ur.results]=r.graphResults===this.getGraphSubProtocol()?r.customPayload[ur.results]:tr.allocBufferFromString(this.getGraphSubProtocol()),this.setCustomPayload(n)}};c(qy,"GraphExecutionOptions");var Fy=qy;cb.exports={GraphExecutionOptions:Fy,graphProtocol:a8,payloadKeys:ur}});var gb=_((rZ,pb)=>{"use strict";var lb=oe(),l8=yu(),f8=Q0(),{GraphSON2Reader:h8,GraphSON2Writer:d8,GraphSON3Reader:p8,GraphSON3Writer:g8}=sb(),Sl=Fg(),{GraphExecutionOptions:y8,graphProtocol:qn}=ub(),fb="gremlin-groovy",m8="Core",v8=new h8({serializers:Sl()}),E8=new d8({serializers:Sl()}),S8=new p8({serializers:Sl()}),C8=new g8({serializers:Sl()}),w8=new Map([[qn.graphson2,hb(v8)],[qn.graphson3,hb(S8)]]),x8=new Map([[qn.graphson1,t=>JSON.stringify(t)],[qn.graphson2,db(E8)],[qn.graphson3,db(C8)]]),xs=class xs{constructor(e,r,n){this._client=e,this._handler=n,this._defaultProfileRetryPolicy=e.profileManager.getDefaultConfiguredRetryPolicy(),this._graphBaseOptions=lb.extend({executeAs:e.options.queryOptions.executeAs,language:fb,source:"g",readTimeout:0,retry:new l8.retry.FallthroughRetryPolicy},r.graphOptions,e.profileManager.getDefault().graphOptions),this._graphBaseOptions.readTimeout===null&&(this._graphBaseOptions.readTimeout=e.options.socketOptions.readTimeout)}async send(e,r,n){if(Array.isArray(r))throw new TypeError("Parameters must be a Object instance as an associative array");if(!e)throw new TypeError("Query must be defined");let i=new y8(n,this._client,this._graphBaseOptions,this._defaultProfileRetryPolicy);if(i.getGraphSource()==="a"){let o=await this._getAnalyticsMaster();i.setPreferredHost(o)}let s=typeof e=="object"&&e.graphLanguage&&e.value&&e.queryWriterFactory;if(s&&i.setGraphLanguage(e.graphLanguage),this._setGraphProtocol(i),i.setGraphPayload(),r=xs._buildGraphParameters(r,i.getGraphSubProtocol()),typeof e!="string"){let o=i.getQueryWriter();s?o=e.queryWriterFactory(i.getGraphSubProtocol()):o||(o=xs._writerFactory(i.getGraphSubProtocol())),e=o(s?e.value:e)}return await this._executeGraphQuery(e,r,i)}async _executeGraphQuery(e,r,n){let i=await this._handler.call(this._client,e,r,n),s=n.getRowParser()||xs._rowParserFactory(n.getGraphSubProtocol());return new f8(i,s)}async _getAnalyticsMaster(){try{let e=await this._client.execute("CALL DseClientTool.getAnalyticsGraphServer()",lb.emptyArray);if(e.rows.length===0)return this._client.log("verbose","Empty response querying graph analytics server, query will not be routed optimally"),null;let r=e.rows[0].result;if(!r||!r.location)return this._client.log("verbose","Unexpected response querying graph analytics server, query will not be routed optimally",e.rows[0]),null;let n=r.location.substr(0,r.location.lastIndexOf(":")),i=this._client.options.policies.addressResolution;return await new Promise(s=>{i.translate(n,this._client.options.protocolOptions.port,o=>s(this._client.hosts.get(o)))})}catch(e){return this._client.log("verbose","Error querying graph analytics server, query will not be routed optimally",e),null}}_setGraphProtocol(e){let r=e.getGraphSubProtocol();if(!r){if(e.getGraphName()){let n=this._client.metadata.keyspaces[e.getGraphName()];n&&n.graphEngine===m8&&(r=qn.graphson3)}r||(e.getGraphLanguage()===fb?r=qn.graphson1:r=qn.graphson2),e.setGraphSubProtocol(r)}}static _buildGraphParameters(e,r){if(!e||typeof e!="object")return null;let n=xs._writerFactory(r);return[r!==qn.graphson1&&r!==qn.graphson2?n(new Map(Object.entries(e))):n(e)]}static _rowParserFactory(e){let r=w8.get(e);return r||null}static _writerFactory(e){let r=x8.get(e);if(!r)throw new Error(`No writer defined for protocol ${e}`);return r}};c(xs,"GraphExecutor");var Uy=xs;function hb(t){return e=>{let r=t.read(JSON.parse(e.gremlin));return{object:r.result,bulk:r.bulk||1}}}c(hb,"getRowParser");function db(t){return e=>t.write(e)}c(db,"getDefaultWriter");pb.exports=Uy});var Sb=_((iZ,Eb)=>{"use strict";var yb=require("events"),Vy=require("util"),_s=oe(),Ts=ze(),bs=Ke(),{ProfileManager:T8}=kd(),Cl=Ti(),mb=ma(),_8=tx(),b8=oo().description,{version:I8}=oo(),{DefaultExecutionOptions:My}=xi(),A8=KT(),Ky=WT(),vb=zp(),N8=n_(),B8=q_(),R8=gb(),xn=fr(),O8=32;function st(t){yb.EventEmitter.call(this),this.options=mb.extend({logEmitter:this.emit.bind(this),id:bs.Uuid.random()},t),Object.defineProperty(this,"profileManager",{value:new T8(this.options)}),Object.defineProperty(this,"controlConnection",{value:new A8(this.options,this.profileManager),writable:!0}),Object.defineProperty(this,"insightsClient",{value:new N8(this)}),this.setMaxListeners(0),this.connected=!1,this.isShuttingDown=!1,this.keyspace=t.keyspace,this.metadata=this.controlConnection.metadata,this.hosts=this.controlConnection.hosts,this.metrics=this.options.metrics,this._graphExecutor=new R8(this,t,this._execute)}c(st,"Client");Vy.inherits(st,yb.EventEmitter);st.prototype.connect=function(t){return this.connected&&t?t():xn.optionalCallback(this._connect(),t)};st.prototype._connect=async function(){if(!this.connected){if(this.isShuttingDown)throw new Ts.NoHostAvailableError(null,"Connecting after shutdown is not supported");if(this.connecting)return xn.fromEvent(this,"connected");this.connecting=!0,this.log("info",Vy.format("Connecting to cluster using '%s' version %s",b8,I8));try{await B8.init(this.options),await this.controlConnection.init(),this.hosts=this.controlConnection.hosts,await this.profileManager.init(this,this.hosts),this.keyspace&&await Ky.setKeyspace(this),mb.setMetadataDependent(this),await this._warmup()}catch(t){throw await this.controlConnection.reset(),this.connected=!1,this.connecting=!1,this.emit("connected",t),t}this._setHostListeners(),this.profileManager.getDistance(this.controlConnection.host),this.insightsClient.init(),this.connected=!0,this.connecting=!1,this.emit("connected")}};st.prototype.execute=function(t,e,r,n){n||(typeof r=="function"?(n=r,r=null):typeof e=="function"&&(n=e,e=null));try{let i=My.create(r,this);return xn.optionalCallback(this._execute(t,e,i),n)}catch(i){return n?n(i):Promise.reject(i)}};st.prototype.executeGraph=function(t,e,r,n){return n=n||r||e,typeof n=="function"?(e=typeof e!="function"?e:null,xn.toCallback(this._graphExecutor.send(t,e,r),n)):this._graphExecutor.send(t,e,r)};st.prototype.eachRow=function(t,e,r,n,i){!i&&n&&typeof r=="function"?(i=_s.validateFn(n,"rowCallback"),n=r):(i=i||_s.noop,n=_s.validateFn(n||r||e,"rowCallback")),e=typeof e!="function"?e:null;let s;try{s=My.create(r,this,n)}catch(l){return i(l)}let o=0,a=c(()=>xn.toCallback(this._execute(t,e,s),u),"nextPage");function u(l,f){if(l)return i(l);if(o+=f.rowLength,f.rawPageState!==void 0){if(s.setPageState(f.rawPageState),s.isAutoPage())return a();f.nextPage=a}f.rowLength=o,i(null,f)}c(u,"pageCallback"),xn.toCallback(this._execute(t,e,s),u)};st.prototype.stream=function(t,e,r,n){n=n||_s.noop;let i=new bs.ResultStream({objectMode:1});function s(a,u){if(a&&i.emit("error",a),u&&u.nextPage){i._valve(c(function(){try{u.nextPage()}catch(f){i.emit("error",f)}},"pageValve"));return}i._valve(null),i.add(null),n(a)}c(s,"onFinish");let o=!0;return this.eachRow(t,e,r,c(function(u,l){i.add(l)},"rowCallback"),c(function(u,l){if(o)return setImmediate(c(function(){s(u,l)},"eachRowFinishedImmediate"));s(u,l)},"eachRowFinished")),o=!1,i};st.prototype.batch=function(t,e,r){return!r&&typeof e=="function"&&(r=e,e=null),xn.optionalCallback(this._batch(t,e),r)};st.prototype._batch=async function(t,e){if(!Array.isArray(t))throw new Ts.ArgumentError("Queries should be an Array");if(t.length===0)throw new Ts.ArgumentError("Queries array should not be empty");await this._connect();let r=My.create(e,this),n;if(r.isPrepared()){let s=this.controlConnection.protocolVersion,o=bs.protocolVersion.supportsKeyspaceInRequest(s)&&e.keyspace||this.keyspace;n=await vb.getPreparedMultiple(this,r.getLoadBalancingPolicy(),t,o)}else{n=new Array(t.length);for(let s=0;se.shutdown(!1)))};st.prototype._waitForSchemaAgreement=async function(t){if(this.hosts.length===1)return!0;let e=process.hrtime(),r=this.options.protocolOptions.maxSchemaAgreementWaitSeconds;this.log("info","Waiting for schema agreement");let n;for(;!n&&process.hrtime(e)[0]n.emit("hostUp",i)}c(t,"getHostUpListener");function e(n,i){return()=>n.emit("hostDown",i)}c(e,"getHostDownListener");let r=this;this.hosts.on("add",c(function(i){i.on("up",t(r,i)),i.on("down",e(r,i)),r.emit("hostAdd",i)},"hostAddedListener")),this.hosts.on("remove",c(function(i){i.removeAllListeners(),r.emit("hostRemove",i)},"hostRemovedListener")),this.hosts.forEach(function(n){n.on("up",t(r,n)),n.on("down",e(r,n))})};st.prototype._warmup=function(){let t=this.hosts.values();return xn.times(t.length,O8,async e=>{let r=t[e],n=this.profileManager.getDistance(r);if(n!==bs.distance.ignored)if(this.options.pooling.warmup&&n===bs.distance.local)try{await r.warmupPool(this.keyspace)}catch(i){this.log("warning",`Connection pool to host ${r.address} could not be created: ${i}`,i)}else r.initializePool()})};st.prototype._getEncoder=function(){let t=this.controlConnection.getEncoder();if(!t)throw new Ts.DriverInternalError("Encoder is not defined");return t};st.prototype._createBatchRequest=async function(t,e){let r=t[0];return r.meta?(await this._setRoutingInfo(e,r.params,r.meta),new Cl.BatchRequest(t,e)):new Cl.BatchRequest(t,e)};st.prototype._createExecuteRequest=async function(t,e,r,n,i){return n=_s.adaptNamedParamsPrepared(n,i.columns),await this._setRoutingInfo(r,n,i),new Cl.ExecuteRequest(t,e,n,r,i)};st.prototype._createQueryRequest=async function(t,e,r){await this.metadata.adaptUserHints(this.keyspace,e.getHints());let n=_s.adaptNamedParamsWithHints(r,e);return this._getEncoder().setRoutingKeyFromUser(n.params,e,n.keyIndexes),new Cl.QueryRequest(t,n.params,e,n.namedParameters)};st.prototype._setRoutingInfo=async function(t,e,r){let n=this._getEncoder();if(!t.getKeyspace()&&r.keyspace&&t.setKeyspace(r.keyspace),t.getRoutingKey())return n.setRoutingKeyFromUser(e,t);if(Array.isArray(r.partitionKeys))return t.setRoutingIndexes(r.partitionKeys),n.setRoutingKeyFromMeta(r,e,t);try{let i=await this.metadata.getTable(r.keyspace,r.table);if(!i)return;t.setRoutingIndexes(i.partitionKeys.map(s=>r.columnsByName[s.name])),r.partitionKeys=t.getRoutingIndexes(),n.setRoutingKeyFromMeta(r,e,t)}catch{this.log("warning",Vy.format("Table %s.%s metadata could not be retrieved",r.keyspace,r.table))}};Eb.exports=st});var jy=_((oZ,Cb)=>{"use strict";var D8=require("events"),$y=class $y extends D8{constructor(e,r,n){super(),this.key=e,this.value=r,this.edges=n||[]}};c($y,"Node");var oc=$y,Gy=class Gy extends oc{constructor(){super([],null),this.length=0}getOrCreate(e,r){typeof e.next!="function"&&(e=e[Symbol.iterator]());let n=this,i=!1,s=e.next();for(;;){let o;for(let l=1;l0&&(n.value=r()),n.value}_createBranch(e,r,n,i){let s=new oc(e.key.slice(r),e.value,e.edges);return e.key=e.key.slice(0,r),e.edges=[s],n?(e.value=i(),this._onItemAdded()):e.value=null,s}_onItemAdded(){this.length++,this.emit("add",this.length)}};c(Gy,"Tree");var Hy=Gy;function P8(t,e){let r=[t],n=e.next();for(;!n.done;)r.push(n.value),n=e.next();return r}c(P8,"iteratorToArray");Cb.exports=Hy});var xl=_(wl=>{"use strict";var L8=ze(),zy=class zy{constructor(e,r,n,i){this.key=e,this.value=r,this.hasChildValues=n,this.isInOperator=i}};c(zy,"QueryOperator");var Un=zy,Wy=class Wy{constructor(e,r,n){this.sign=e,this.value=r,this.inverted=!!n}};c(Wy,"QueryAssignment");var Di=Wy,k8={in_:c(function(e){if(!Array.isArray(e))throw new L8.ArgumentError("IN operator supports only Array values");return new Un("IN",e,!1,!0)},"in_"),gt:c(function(e){return new Un(">",e)},"gt"),gte:c(function(e){return new Un(">=",e)},"gte"),lt:c(function(e){return new Un("<",e)},"lt"),lte:c(function(e){return new Un("<=",e)},"lte"),notEq:c(function(e){return new Un("!=",e)},"notEq"),and:function(t,e){return new Un("AND",[t,e],!0)},incr:c(function(e){return new Di("+",e)},"incr"),decr:c(function(e){return new Di("-",e)},"decr"),append:c(function(e){return new Di("+",e)},"append"),prepend:c(function(e){return new Di("+",e,!0)},"prepend"),remove:c(function(e){return new Di("-",e)},"remove")};wl.q=k8;wl.QueryAssignment=Di;wl.QueryOperator=Un});var Yy=_((lZ,Tb)=>{"use strict";var xb=xl(),wb=xb.QueryOperator,F8=xb.QueryAssignment,Dr=class Dr{static*getSelectKey(e,r,n){yield*Dr._yieldKeyAndOperators(e,r),yield*Dr._getSelectDocInfo(n)}static*getSelectAllKey(e){yield"root",yield*Dr._getSelectDocInfo(e)}static*_getSelectDocInfo(e){if(e&&(e.fields&&e.fields.length>0&&(yield"|f|",yield*e.fields),typeof e.limit=="number"&&(yield"|l|"),e.orderBy)){yield"|o|";let r=Object.keys(e.orderBy);for(let n=0;n0&&(yield"|f|",yield*r.fields),typeof r.ttl=="number"&&(yield"|t|"),r.ifNotExists&&(yield"|e|"))}static*getUpdateKey(e,r,n){yield*Dr._yieldKeyAndAllQs(e,r),n&&(n.fields&&n.fields.length>0&&(yield"|f|",yield*n.fields),typeof n.ttl=="number"&&(yield"|t|"),n.ifExists&&(yield"|e|"),n.when&&(yield*Dr._yieldKeyAndOperators(Object.keys(n.when),n.when)))}static*getRemoveKey(e,r,n){yield*Dr._yieldKeyAndOperators(e,r),n&&(n.fields&&n.fields.length>0&&(yield"|f|",yield*n.fields),n.ifExists&&(yield"|e|"),n.deleteOnlyColumns&&(yield"|dc|"),n.when&&(yield*Dr._yieldKeyAndOperators(Object.keys(n.when),n.when)))}static*_yieldKeyAndOperators(e,r){for(let n=0;n{"use strict";var em=Yy(),tm=class tm{constructor(e,r,n,i){this.doc=e,this.docInfo=r,this.handler=n,this.cache=i}getQueries(){let e=Object.keys(this.doc),r=this.cache.getOrCreate(this.getCacheKey(e),()=>({queries:null}));return r.queries===null&&(r.queries=this.createQueries(e)),r.queries}getCacheKey(e){throw new Error("getCacheKey must be implemented")}createQueries(e){throw new Error("getCacheKey must be implemented")}pushQueries(e){let r=!0,n;return this.getQueries().then(i=>(i.forEach(s=>{r=r&&s.isIdempotent,n=s.isCounter,e.push({query:s.query,params:s.paramsGetter(this.doc,this.docInfo,this.getMappingInfo())})}),{isIdempotent:r,isCounter:n}))}getMappingInfo(){return this.handler.info}};c(tm,"ModelBatchItem");var xo=tm,rm=class rm extends xo{constructor(e,r,n,i){super(e,r,n,i)}getCacheKey(e){return em.getInsertKey(e,this.docInfo)}createQueries(e){return this.handler.createInsertQueries(e,this.doc,this.docInfo)}};c(rm,"InsertModelBatchItem");var Zy=rm,nm=class nm extends xo{constructor(e,r,n,i){super(e,r,n,i)}getCacheKey(e){return em.getUpdateKey(e,this.doc,this.docInfo)}createQueries(e){return this.handler.createUpdateQueries(e,this.doc,this.docInfo)}};c(nm,"UpdateModelBatchItem");var Xy=nm,im=class im extends xo{constructor(e,r,n,i){super(e,r,n,i)}getCacheKey(e){return em.getRemoveKey(e,this.doc,this.docInfo)}createQueries(e){return this.handler.createDeleteQueries(e,this.doc,this.docInfo)}};c(im,"RemoveModelBatchItem");var Jy=im;_b.exports={ModelBatchItem:xo,InsertModelBatchItem:Zy,UpdateModelBatchItem:Xy,RemoveModelBatchItem:Jy}});var um=_((pZ,bb)=>{"use strict";var sm=jy(),am=Tl(),q8=am.InsertModelBatchItem,U8=am.UpdateModelBatchItem,V8=am.RemoveModelBatchItem,cm=class cm{constructor(e){this._handler=e,this._cache={insert:new sm,update:new sm,remove:new sm}}insert(e,r){return new q8(e,r,this._handler,this._cache.insert)}update(e,r){return new U8(e,r,this._handler,this._cache.update)}remove(e,r){return new V8(e,r,this._handler,this._cache.update)}};c(cm,"ModelBatchMapper");var om=cm;bb.exports=om});var hm=_((yZ,Ib)=>{"use strict";var M8=um(),fm=class fm{constructor(e,r){this.name=e,this._handler=r,this.batching=new M8(this._handler)}get(e,r,n){return n===void 0&&typeof r=="string"&&(n=r,r=null),this._handler.getSelectExecutor(e,r,!0).then(i=>i(e,r,n)).then(i=>i.first())}find(e,r,n){return n===void 0&&typeof r=="string"&&(n=r,r=null),this._handler.getSelectExecutor(e,r,!1).then(i=>i(e,r,n))}findAll(e,r){return r===void 0&&typeof e=="string"&&(r=e,e=null),this._handler.getSelectAllExecutor(e)(e,r)}insert(e,r,n){return n===void 0&&typeof r=="string"&&(n=r,r=null),this._handler.getInsertExecutor(e,r).then(i=>i(e,r,n))}update(e,r,n){return n===void 0&&typeof r=="string"&&(n=r,r=null),this._handler.getUpdateExecutor(e,r).then(i=>i(e,r,n))}remove(e,r,n){return n===void 0&&typeof r=="string"&&(n=r,r=null),this._handler.getDeleteExecutor(e,r).then(i=>i(e,r,n))}mapWithQuery(e,r,n){return this._handler.getExecutorFromQuery(e,r,n)}};c(fm,"ModelMapper");var lm=fm;Ib.exports=lm});var Ob=_((vZ,Rb)=>{"use strict";var _l=require("vm"),Bb=xl(),Ab=Bb.QueryOperator,dm=Bb.QueryAssignment,K8=Ke(),Nb=K8.dataTypes,bl="gen-param-getter.js",Ye=class Ye{static getSelect(e,r,n,i,s,o){let a="SELECT ";return a+=i.length>0?i.map(u=>`"${u.columnName}"`).join(", "):"*",a+=` FROM ${r}.${e}`,n.length>0&&(a+=" WHERE ",a+=Ye._getConditionWithOperators(n)),s.length>0&&(a+=" ORDER BY ",a+=s.map(u=>`"${u[0]}" ${u[1]}`).join(", ")),typeof o=="number"&&(a+=" LIMIT ?"),a}static selectParamsGetter(e,r){let n=`(function getParametersSelect(doc, docInfo, mappingInfo) { +`;return n+=" return [",n+=Ye._valueGetterExpression(e),typeof r=="number"&&(e.length>0&&(n+=", "),n+="docInfo['limit']"),n+=`]; +})`,new _l.Script(n,{filename:bl}).runInThisContext()}static getInsert(e,r,n,i,s){let o=i&&i.ttl,a=n.filter(u=>e.columnsByName[u.columnName]!==void 0);return{query:Ye._getInsertQuery(e.name,r,a,s,o),paramsGetter:Ye._insertParamsGetter(a,i),isIdempotent:!s}}static _getInsertQuery(e,r,n,i,s){let o=`INSERT INTO ${r}.${e} (`;return o+=n.map(a=>`"${a.columnName}"`).join(", "),o+=") VALUES (",o+=n.map(()=>"?").join(", "),o+=")",i===!0&&(o+=" IF NOT EXISTS"),typeof s=="number"&&(o+=" USING TTL ?"),o}static _insertParamsGetter(e,r){let n=`(function getParametersInsert(doc, docInfo, mappingInfo) { +`;return n+=" return [",n+=Ye._valueGetterExpression(e),r&&typeof r.ttl=="number"&&(n+=", docInfo['ttl']"),n+=`]; +})`,new _l.Script(n,{filename:bl}).runInThisContext()}static getUpdate(e,r,n,i,s,o){let a=i&&i.ttl,u=new Set(e.partitionKeys.concat(e.clusteringKeys).map(p=>p.name)),l=!0,f=!1,h=n.filter(p=>{let g=e.columnsByName[p.columnName];return g===void 0?!1:(g.type.code===Nb.list&&p.value instanceof dm?l=!1:g.type.code===Nb.counter&&(l=!1,f=!0),!0)});return{query:Ye._getUpdateQuery(e.name,r,u,h,s,o,a),isIdempotent:l&&s.length===0&&!o,paramsGetter:Ye._updateParamsGetter(u,h,s,a),isCounter:f}}static _getUpdateQuery(e,r,n,i,s,o,a){let u=`UPDATE ${r}.${e} `;return typeof a=="number"&&(u+="USING TTL ? "),u+="SET ",u+=i.filter(l=>!n.has(l.columnName)).map(l=>l.value instanceof dm?l.value.inverted?`"${l.columnName}" = ? ${l.value.sign} "${l.columnName}"`:`"${l.columnName}" = "${l.columnName}" ${l.value.sign} ?`:`"${l.columnName}" = ?`).join(", "),u+=" WHERE ",u+=i.filter(l=>n.has(l.columnName)).map(l=>`"${l.columnName}" = ?`).join(" AND "),o===!0?u+=" IF EXISTS":s.length>0&&(u+=" IF "+Ye._getConditionWithOperators(s)),u}static _updateParamsGetter(e,r,n,i){let s=`(function getParametersUpdate(doc, docInfo, mappingInfo) { +`;return s+=" return [",typeof i=="number"&&(s+="docInfo['ttl'], "),s+=Ye._assignmentGetterExpression(r.filter(a=>!e.has(a.columnName))),s+=", ",s+=Ye._valueGetterExpression(r.filter(a=>e.has(a.columnName))),n.length>0&&(s+=", "+Ye._valueGetterExpression(n,"docInfo.when")),s+=`]; +})`,new _l.Script(s,{filename:bl}).runInThisContext()}static getDelete(e,r,n,i,s,o){let a=i&&i.deleteOnlyColumns,u=new Set(e.partitionKeys.concat(e.clusteringKeys).map(f=>f.name)),l=n.filter(f=>e.columnsByName[f.columnName]!==void 0);return{query:Ye._getDeleteQuery(e.name,r,u,l,s,o,a),paramsGetter:Ye._deleteParamsGetter(u,l,s),isIdempotent:s.length===0&&!o}}static _getDeleteQuery(e,r,n,i,s,o,a){let u="DELETE";if(a){let l=i.filter(f=>!n.has(f.columnName)).map(f=>`"${f.columnName}"`).join(", ");l!==""&&(u+=" "+l)}return u+=` FROM ${r}.${e} WHERE `,u+=i.filter(l=>n.has(l.columnName)).map(l=>`"${l.columnName}" = ?`).join(" AND "),o===!0?u+=" IF EXISTS":s.length>0&&(u+=" IF "+Ye._getConditionWithOperators(s)),u}static _deleteParamsGetter(e,r,n){let i=`(function getParametersDelete(doc, docInfo, mappingInfo) { +`;return i+=" return [",i+=Ye._valueGetterExpression(r.filter(o=>e.has(o.columnName))),n.length>0&&(i+=", "+Ye._valueGetterExpression(n,"docInfo.when")),i+=`]; +})`,new _l.Script(i,{filename:bl}).runInThisContext()}static _valueGetterExpression(e,r){return r=r||"doc",e.map(n=>Ye._valueGetterSingle(`${r}['${n.propertyName}']`,n.propertyName,n.value,n.fromModel)).join(", ")}static _valueGetterSingle(e,r,n,i){let s=e;if(n instanceof Ab){if(n.hasChildValues)return`${Ye._valueGetterSingle(`${e}.value[0]`,r,n.value[0],i)}, ${Ye._valueGetterSingle(`${e}.value[1]`,r,n.value[1],i)}`;if(s=`${e}.value`,n.isInOperator&&i)return`${s}.map(v => ${Ye._getMappingFunctionCall(r,"v")})`}return i?Ye._getMappingFunctionCall(r,s):s}static _assignmentGetterExpression(e,r){return r=r||"doc",e.map(n=>{let i=`${r}['${n.propertyName}']${n.value instanceof dm?".value":""}`;return n.fromModel?Ye._getMappingFunctionCall(n.propertyName,i):i}).join(", ")}static _getConditionWithOperators(e){return e.map(r=>Ye._getSingleCondition(r.columnName,r.value)).join(" AND ")}static _getMappingFunctionCall(e,r){return`mappingInfo.getFromModelFn('${e}')(${r})`}static _getSingleCondition(e,r){return r instanceof Ab?r.hasChildValues?`${Ye._getSingleCondition(e,r.value[0])} ${r.key} ${Ye._getSingleCondition(e,r.value[1])}`:`"${e}" ${r.key} ?`:`"${e}" = ?`}};c(Ye,"QueryGenerator");var pm=Ye;Rb.exports=pm});var mm=_((SZ,Pb)=>{"use strict";var H8=require("vm"),gm=oe(),Db=Ke(),To=class To{static getSelectAdapter(e,r){let n=r.columns;if(!n)throw new Error("Expected ROWS result obtained VOID");let i=`(function rowAdapter(row, info) { + const item = info.newInstance(); +`;for(let o of n)i+=` item['${e.getPropertyName(o.name)}'] = `,e.getToModelFn(o.name)?i+=`info.getToModelFn('${o.name}')(row['${o.name}']); +`:i+=`row['${o.name}']; +`;return i+=` return item; +})`,new H8.Script(i,{filename:"gen-result-mapper.js"}).runInThisContext()}static getMutationAdapter(e){return e.columns===null||e.columns.length===1&&e.columns[0].name==="[applied]"&&e.columns[0].type.code===Db.dataTypes.boolean?gm.noop:To._getConditionalRowAdapter(e)}static _getConditionalRowAdapter(e){return c(function(n,i){let s=i.newInstance();for(let o=1;o{"use strict";var $8=require("util"),G8=oe(),j8=$8.inspect.custom||"inspect",Em=class Em{constructor(e,r,n){this._rs=e,this._info=r,this._rowAdapter=n,this._isEmptyLwt=e.columns!==null&&e.columns.length===1&&this._rs.rowLength===1&&e.columns[0].name==="[applied]",this.length=this._isEmptyLwt?0:e.rowLength||0,this.pageState=e.pageState}wasApplied(){return this._rs.wasApplied()}first(){return!this._rs.rowLength||this._isEmptyLwt?null:this._rowAdapter(this._rs.rows[0],this._info)}*[Symbol.iterator](){if(!this._isEmptyLwt)for(let e=0;ethis._rowAdapter(e,this._info))}forEach(e,r){let n=0;r=r||this;for(let i of this)e.call(r,i,n++)}[j8](){return this.toArray()}};c(Em,"Result");var vm=Em;Lb.exports=vm});var Ub=_((TZ,qb)=>{"use strict";var rn={all:1,none:0,some:-1},wm=class wm{static getForSelect(e,r,n,i,s,o){return Promise.all(r.tables.map(a=>a.isView?e.metadata.getMaterializedView(r.keyspace,a.name):e.metadata.getTable(r.keyspace,a.name))).then(a=>{for(let l=0;lf.partitionKeys.length&&!i.reduce((d,y)=>d&&(Cm(f.partitionKeys,v=>v.name===y.columnName)||Cm(f.clusteringKeys,v=>v.name===y.columnName)),!0)||!s.reduce((g,d)=>g&&f.columnsByName[d.columnName]!==void 0,!0)||!o.reduce((g,d,y)=>{if(!g)return!1;let v=f.clusteringKeys[y];return v&&v.name===d[0]},!0)))return f.name}let u=`No table matches the filter (${n?"all PKs have to be specified":"PKs"}): [${i.map(l=>l.columnName)}]`;throw s.length>0&&(u+=`; fields: [${s.map(l=>l.columnName)}]`),o.length>0&&(u+=`; orderBy: [${o.map(l=>l[0])}]`),new Error(u)})}static getForSelectAll(e){return e.tables[0].name}static getForInsert(e,r,n){return Promise.all(r.tables.filter(i=>!i.isView).map(i=>e.metadata.getTable(r.keyspace,i.name))).then(i=>{let s=i.filter((o,a)=>{if(o===null)throw new Error(`Table "${r.tables[a].name}" could not be retrieved`);if(_o(o.partitionKeys,n)!==rn.all)return!1;let u=_o(o.clusteringKeys,n);if(u===rn.all)return!0;if(u===rn.some)return!1;let l=Fb(o);return n.length===o.partitionKeys.length+l&&l>0});if(s.length===0)throw new Error(`No table matches (all PKs have to be specified) fields: [${n.map(o=>o.columnName)}]`);return s})}static getForUpdate(e,r,n,i){return Promise.all(r.tables.filter(s=>!s.isView).map(s=>e.metadata.getTable(r.keyspace,s.name))).then(s=>{let o=s.filter((a,u)=>{if(a===null)throw new Error(`Table "${r.tables[u].name}" could not be retrieved`);if(_o(a.partitionKeys,n)!==rn.all)return!1;let l=_o(a.clusteringKeys,n);if(l===rn.some||l===rn.none&&!kb(a))return!1;let f=n.reduce((h,p)=>h+(a.columnsByName[p.columnName]!==void 0?1:0),0);return f<=a.partitionKeys.length+a.clusteringKeys.length&&(!kb(a)||f<=a.partitionKeys.length)?!1:i.reduce((h,p)=>h&&a.columnsByName[p.columnName]!==void 0,!0)});if(o.length===0){let a=`No table matches (all PKs and columns to set have to be specified) fields: [${n.map(u=>u.columnName)}]`;throw i.length>0&&(a+=`; condition: [${i.map(u=>u.columnName)}]`),new Error(a)}return o})}static getForDelete(e,r,n,i){return Promise.all(r.tables.filter(s=>!s.isView).map(s=>e.metadata.getTable(r.keyspace,s.name))).then(s=>{let o=s.filter((a,u)=>{if(a===null)throw new Error(`Table "${r.tables[u].name}" could not be retrieved`);let l=a.partitionKeys.concat(a.clusteringKeys).map(h=>h.name),f=n.map(h=>h.columnName);for(let h=0;hh&&a.columnsByName[p.columnName]!==void 0,!0)});if(o.length===0){let a=`No table matches (all PKs have to be specified) fields: [${n.map(u=>u.columnName)}]`;throw i.length>0&&(a+=`; condition: [${i.map(u=>u.columnName)}]`),new Error(a)}return o})}};c(wm,"ObjectSelector");var Sm=wm;function Cm(t,e){return t.filter(e).length>0}c(Cm,"contains");function _o(t,e){if(t.length===0)return rn.all;let r=e.reduce((n,i)=>n+(Cm(t,s=>i.columnName===s.name)?1:0),0);return r===0?rn.none:r===t.length?rn.all:rn.some}c(_o,"keysAreIncluded");function kb(t){return Fb(t)>0}c(kb,"hasStaticColumn");function Fb(t){return t.columns.reduce((e,r)=>e+(r.isStatic?1:0),0)}c(Fb,"staticColumnCount");qb.exports=Sm});var _m=_((bZ,Vb)=>{"use strict";var z8=ze(),W8=oe(),Tm=class Tm{static getPropertiesInfo(e,r,n,i){let s=e;return r&&r.fields&&r.fields.length>0&&(s=r.fields),s.map(o=>({propertyName:o,columnName:i.getColumnName(o),value:n[o],fromModel:i.getFromModelFn(o)}))}static adaptOrderBy(e,r){return!e||!e.orderBy?W8.emptyArray:Object.keys(e.orderBy).map(n=>{let i=e.orderBy[n],s=typeof i=="string"?i.toUpperCase():i;if(s!=="ASC"&&s!=="DESC")throw new z8.ArgumentError('Order must be either "ASC" or "DESC", obtained: '+i);return[r.getColumnName(n),s]})}static adaptOptions(e,r){let n={prepare:!0,executionProfile:void 0,timestamp:void 0,isIdempotent:r};return typeof e=="string"?n.executionProfile=e:e!=null&&(n.executionProfile=e.executionProfile,n.timestamp=e.timestamp,e.isIdempotent!==void 0&&(n.isIdempotent=e.isIdempotent)),n}static adaptAllOptions(e,r){let n={prepare:!0,executionProfile:void 0,fetchSize:void 0,pageState:void 0,timestamp:void 0,isIdempotent:void 0};return typeof e=="string"?n.executionProfile=e:e!=null&&(n.executionProfile=e.executionProfile,n.fetchSize=e.fetchSize,n.pageState=e.pageState,n.timestamp=e.timestamp,n.isIdempotent=e.isIdempotent),r&&(n.isIdempotent=!0),n}static adaptBatchOptions(e,r,n){let i={prepare:!0,executionProfile:void 0,timestamp:void 0,logged:void 0,isIdempotent:r,counter:n};return typeof e=="string"?i.executionProfile=e:e!=null&&(i.executionProfile=e.executionProfile,i.timestamp=e.timestamp,i.logged=e.logged!==!1,e.isIdempotent!==void 0&&(i.isIdempotent=e.isIdempotent)),i}};c(Tm,"DocInfoAdapter");var xm=Tm;Vb.exports=xm});var Kb=_((AZ,Mb)=>{"use strict";var Is=oe(),As=Ob(),Al=mm(),Nl=Il(),ac=Yy(),cc=jy(),uc=Ub(),yr=_m(),Bl=100,Im=class Im{constructor(e,r){this._client=e,this._cache={select:new cc().on("add",n=>this._validateCacheLength(n)),selectAll:new cc().on("add",n=>this._validateCacheLength(n)),insert:new cc().on("add",n=>this._validateCacheLength(n)),update:new cc().on("add",n=>this._validateCacheLength(n)),remove:new cc().on("add",n=>this._validateCacheLength(n)),customQueries:new Map},this.info=r}getSelectExecutor(e,r,n){let i=Object.keys(e);if(i.length===0)return Promise.reject(new Error("Expected object with keys"));let s=ac.getSelectKey(i,e,r),o=this._cache.select.getOrCreate(s,()=>({executor:null,resultAdapter:null}));if(o.executor!==null)return Promise.resolve(o.executor);let a=yr.getPropertiesInfo(i,null,e,this.info),u=yr.getPropertiesInfo(Is.emptyArray,r,e,this.info),l=yr.adaptOrderBy(r,this.info),f=r&&r.limit;return this._client.connect().then(()=>uc.getForSelect(this._client,this.info,n,a,u,l)).then(h=>{let p=As.getSelect(h,this.info.keyspace,a,u,l,f),g=As.selectParamsGetter(a,f),d=this;return o.executor=c(function(v,m,w){return d._executeSelect(p,g,v,m,w,o)},"selectExecutor"),o.executor})}getSelectAllExecutor(e){let r=ac.getSelectAllKey(e),n=this._cache.selectAll.getOrCreate(r,()=>({executor:null,resultAdapter:null}));if(n.executor!==null)return n.executor;let i=yr.getPropertiesInfo(Is.emptyArray,e,Is.emptyObject,this.info),s=yr.adaptOrderBy(e,this.info),o=e&&e.limit,a=uc.getForSelectAll(this.info),u=As.getSelect(a,this.info.keyspace,Is.emptyArray,i,s,o),l=As.selectParamsGetter(Is.emptyArray,o),f=this;return n.executor=c(function(p,g){return f._executeSelect(u,l,null,p,g,n)},"selectAllExecutor"),n.executor}_executeSelect(e,r,n,i,s,o){let a=yr.adaptAllOptions(s,!0);return this._client.execute(e,r(n,i,this.info),a).then(u=>(o.resultAdapter===null&&(o.resultAdapter=Al.getSelectAdapter(this.info,u)),new Nl(u,this.info,o.resultAdapter)))}getInsertExecutor(e,r){let n=Object.keys(e);if(n.length===0)return Promise.reject(new Error("Expected object with keys"));let i=ac.getInsertKey(n,r),s=this._cache.insert.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createInsertQueries(n,e,r).then(o=>o.length===1?this._setSingleExecutor(s,o[0]):this._setBatchExecutor(s,o))}createInsertQueries(e,r,n){let i=yr.getPropertiesInfo(e,n,r,this.info),s=n&&n.ifNotExists;return this._client.connect().then(()=>uc.getForInsert(this._client,this.info,i)).then(o=>{if(o.length>1&&s)throw new Error("Batch with ifNotExists conditions cannot span multiple tables");return o.map(a=>As.getInsert(a,this.info.keyspace,i,n,s))})}getUpdateExecutor(e,r){let n=Object.keys(e);if(n.length===0)return Promise.reject(new Error("Expected object with keys"));let i=ac.getUpdateKey(n,e,r),s=this._cache.update.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createUpdateQueries(n,e,r).then(o=>o.length===1?this._setSingleExecutor(s,o[0]):this._setBatchExecutor(s,o))}createUpdateQueries(e,r,n){let i=yr.getPropertiesInfo(e,n,r,this.info),s=n&&n.ifExists,o=n&&n.when?yr.getPropertiesInfo(Object.keys(n.when),null,n.when,this.info):Is.emptyArray;if(o.length>0&&s)throw new Error("Both when and ifExists conditions can not be applied to the same statement");return this._client.connect().then(()=>uc.getForUpdate(this._client,this.info,i,o)).then(a=>{if(a.length>1&&(o.length>0||s))throw new Error("Batch with when or ifExists conditions cannot span multiple tables");return a.map(u=>As.getUpdate(u,this.info.keyspace,i,n,o,s))})}getDeleteExecutor(e,r){let n=Object.keys(e);if(n.length===0)return Promise.reject(new Error("Expected object with keys"));let i=ac.getRemoveKey(n,e,r),s=this._cache.remove.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createDeleteQueries(n,e,r).then(o=>o.length===1?this._setSingleExecutor(s,o[0]):this._setBatchExecutor(s,o))}createDeleteQueries(e,r,n){let i=yr.getPropertiesInfo(e,n,r,this.info),s=n&&n.ifExists,o=n&&n.when?yr.getPropertiesInfo(Object.keys(n.when),null,n.when,this.info):Is.emptyArray;if(o.length>0&&s)throw new Error("Both when and ifExists conditions can not be applied to the same statement");return this._client.connect().then(()=>uc.getForDelete(this._client,this.info,i,o)).then(a=>{if(a.length>1&&(o.length>0||s))throw new Error("Batch with when or ifExists conditions cannot span multiple tables");return a.map(u=>As.getDelete(u,this.info.keyspace,i,n,o,s))})}getExecutorFromQuery(e,r,n){let i=this,s=n?yr.adaptAllOptions(n):null;return c(function(a,u){let l=s||yr.adaptAllOptions(u);return i._client.execute(e,r(a),l).then(f=>{let h=i._cache.customQueries.get(e);if(h===void 0){let p=Al.getCustomQueryAdapter(i.info,f);h=p.fn,p.canCache&&(i._cache.customQueries.set(e,h),i._cache.customQueries.size===Bl&&i._client.log("warning",`Custom queries cache reached ${Bl} items, this could be caused by hard-coding parameter values inside the query, which should be avoided`))}return new Nl(f,i.info,h)})},"queryMappedExecutor")}_setSingleExecutor(e,r){let n=this;return e.executor=c(function(s,o,a){let u=yr.adaptOptions(a,r.isIdempotent);return n._client.execute(r.query,r.paramsGetter(s,o,n.info),u).then(l=>new Nl(l,n.info,Al.getMutationAdapter(l)))},"singleExecutor"),e.executor}_setBatchExecutor(e,r){let n=this,i=r.reduce((s,o)=>s&&o.isIdempotent,!0);return e.executor=c(function(o,a,u){let l=r.map(h=>({query:h.query,params:h.paramsGetter(o,a,n.info)})),f=yr.adaptOptions(u,i);return n._client.batch(l,f).then(h=>new Nl(h,n.info,Al.getMutationAdapter(h)))},"batchExecutor"),e.executor}_validateCacheLength(e){e===Bl&&this._client.log("warning",`ModelMapper cache reached ${Bl} items, this could be caused by building the object to map in different ways (with different shapes) each time. Use the same or few object structures for a model and represent unset values with undefined or types.unset`)}};c(Im,"MappingHandler");var bm=Im;Mb.exports=bm});var Dm=_(Rl=>{"use strict";var Bm=class Bm{newObjectInstance(){return{}}getColumnName(e){return e}getPropertyName(e){return e}};c(Bm,"TableMappings");var lc=Bm,Rm=class Rm extends lc{constructor(){super()}getColumnName(e){return e.replace(/[a-z][A-Z]/g,(r,n)=>r.charAt(0)+"_"+r.charAt(1)).toLowerCase()}getPropertyName(e){return e.replace(/_[a-z]/g,(r,n)=>n===0?r:r.substr(1).toUpperCase())}};c(Rm,"UnderscoreCqlToCamelCaseMappings");var Am=Rm,Om=class Om extends lc{constructor(){super()}getColumnName(e){return super.getColumnName(e)}getPropertyName(e){return super.getPropertyName(e)}newObjectInstance(){return super.newObjectInstance()}};c(Om,"DefaultTableMappings");var Nm=Om;Rl.TableMappings=lc;Rl.UnderscoreCqlToCamelCaseMappings=Am;Rl.DefaultTableMappings=Nm});var jb=_((OZ,Gb)=>{"use strict";var $b=Dm(),Q8=$b.TableMappings,Hb=$b.DefaultTableMappings,Ns=class Ns{constructor(e,r,n,i){this.keyspace=e,this.tables=r,this._mappings=n,this._columns=i,this._documentProperties=new Map;for(let s of i.values())this._documentProperties.set(s.propertyName,s)}getColumnName(e){let r=this._documentProperties.get(e);return r!==void 0?r.columnName:this._mappings.getColumnName(e)}getPropertyName(e){let r=this._columns.get(e);return r!==void 0?r.propertyName:this._mappings.getPropertyName(e)}getFromModelFn(e){let r=this._documentProperties.get(e);return r!==void 0?r.fromModel:null}getToModelFn(e){let r=this._columns.get(e);return r!==void 0?r.toModel:null}newInstance(){return this._mappings.newObjectInstance()}static parse(e,r){let n=new Map;return!e||!e.models||Object.keys(e.models).forEach(i=>{let s=e.models[i];n.set(i,Ns._create(i,r,s))}),n}static _create(e,r,n){if(!r&&(!n||!n.keyspace))throw new Error("You should specify the keyspace of the model in the MappingOptions when the Client is not using a keyspace");if(!n)return Ns.createDefault(e,r);let i;if(n.tables&&n.tables.length>0?i=n.tables.map(o=>{let a={name:null,isView:!1};if(typeof o=="string"?a.name=o:o&&(a.name=o.name,a.isView=!!o.isView),!a.name)throw new Error(`Table name not specified for model '${e}'`);return a}):i=[{name:e,isView:!1}],n.mappings&&!(n.mappings instanceof Q8))throw new Error("mappings should be an instance of TableMappings");let s=new Map;return n.columns!==null&&typeof n.columns=="object"&&Object.keys(n.columns).forEach(o=>{s.set(o,Lm.parse(o,n.columns[o]))}),new Ns(n.keyspace||r,i,n.mappings||new Hb,s)}static createDefault(e,r){return new Ns(r,[{name:e,isView:!1}],new Hb,new Map)}};c(Ns,"ModelMappingInfo");var Pm=Ns,bo=class bo{constructor(e,r,n,i){if(this.columnName=e,this.propertyName=r,n&&typeof n!="function")throw new TypeError(`toModel type for property '${r}' should be a function (obtained ${typeof n})`);if(i&&typeof i!="function")throw new TypeError(`fromModel type for property '${r}' should be a function (obtained ${typeof i})`);this.toModel=n,this.fromModel=i}static parse(e,r){return r?typeof r=="string"?new bo(e,r):new bo(e,r.name||e,r.toModel,r.fromModel):new bo(e,e)}};c(bo,"ModelColumnInfo");var Lm=bo;Gb.exports=Pm});var Qb=_((PZ,Wb)=>{"use strict";var Y8=hm(),Z8=Kb(),X8=_m(),J8=ze(),e5=Il(),t5=mm(),zb=jb(),{ModelBatchItem:r5}=Tl(),Fm=class Fm{constructor(e,r){if(!e)throw new Error("client must be defined");this.client=e,this._modelMappingInfos=zb.parse(r,e.keyspace),this._modelMappers=new Map}forModel(e){let r=this._modelMappers.get(e);if(r===void 0){let n=this._modelMappingInfos.get(e);if(n===void 0){if(!this.client.keyspace)throw new Error(`No mapping information found for model '${e}'. Mapper is unable to create default mappings without setting the keyspace`);n=zb.createDefault(e,this.client.keyspace),this.client.log("info",`Mapping information for model '${e}' not found, creating default mapping. Keyspace: ${n.keyspace}; Table: ${n.tables[0].name}.`)}else this.client.log("info",`Creating model mapper for '${e}' using mapping information. Keyspace: ${n.keyspace}; Table${n.tables.length>1?"s":""}: ${n.tables.map(i=>i.name)}.`);r=new Y8(e,new Z8(this.client,n)),this._modelMappers.set(e,r)}return r}batch(e,r){if(!Array.isArray(e)||!(e.length>0))return Promise.reject(new J8.ArgumentError("First parameter items should be an Array with 1 or more ModelBatchItem instances"));let n=[],i=!0,s;return Promise.all(e.map(o=>o instanceof r5?o.pushQueries(n).then(a=>{i=i&&a.isIdempotent,s=a.isCounter}):Promise.reject(new Error("Batch items must be instances of ModelBatchItem, use modelMapper.batching object to create each item")))).then(()=>this.client.batch(n,X8.adaptBatchOptions(r,i,s))).then(o=>{let a=e[0].getMappingInfo();return new e5(o,a,t5.getMutationAdapter(o))})}};c(Fm,"Mapper");var km=Fm;Wb.exports=km});var Yb=_(Vn=>{"use strict";Vn.Mapper=Qb();Vn.ModelMapper=hm();Vn.ModelBatchMapper=um();Vn.ModelBatchItem=Tl().ModelBatchItem;Vn.Result=Il();var qm=Dm();Vn.TableMappings=qm.TableMappings;Vn.DefaultTableMappings=qm.DefaultTableMappings;Vn.UnderscoreCqlToCamelCaseMappings=qm.UnderscoreCqlToCamelCaseMappings;Vn.q=xl().q});var Xb=_(Vm=>{"use strict";var{Stream:n5}=require("stream"),Zb=oe();function i5(t,e,r,n){if(!t)throw new TypeError("Client instance is not defined");if(typeof e=="string"){if(Array.isArray(r))return new Ol(t,e,r,n).execute();if(r instanceof n5)return new Um(t,e,r,n).execute();throw new TypeError("parameters should be an Array or a Stream instance")}if(Array.isArray(e))return n=r,new Ol(t,null,e,n).execute();throw new TypeError("A string query or query and parameters array should be provided")}c(i5,"executeConcurrent");var Mm=class Mm{constructor(e,r,n,i){this._client=e,this._query=r,this._parameters=n,i=i||Zb.emptyObject,this._raiseOnFirstError=i.raiseOnFirstError!==!1,this._concurrencyLevel=Math.min(i.concurrencyLevel||100,this._parameters.length),this._queryOptions={prepare:!0,executionProfile:i.executionProfile},this._result=new fc(i),this._stop=!1}execute(){let e=new Array(this._concurrencyLevel);for(let r=0;rthis._result)}_executeOneAtATime(e,r){let n=e+this._concurrencyLevel*r;if(n>=this._parameters.length||this._stop)return Promise.resolve();let i=this._parameters[n],s,o;return this._query===null?(s=i.query,o=i.params):(s=this._query,o=i),this._client.execute(s,o,this._queryOptions).then(a=>this._result.setResultItem(n,a)).catch(a=>this._setError(n,a)).then(()=>this._executeOneAtATime(e,r+1))}_setError(e,r){if(this._result.setError(e,r),this._raiseOnFirstError)throw this._stop=!0,r}};c(Mm,"ArrayBasedExecutor");var Ol=Mm,Km=class Km{constructor(e,r,n,i){this._client=e,this._query=r,this._stream=n,i=i||Zb.emptyObject,this._raiseOnFirstError=i.raiseOnFirstError!==!1,this._concurrencyLevel=i.concurrencyLevel||100,this._queryOptions={prepare:!0,executionProfile:i.executionProfile},this._inFlight=0,this._index=0,this._result=new fc(i),this._resolveCallback=null,this._rejectCallback=null,this._readEnded=!1}execute(){return new Promise((e,r)=>{this._resolveCallback=e,this._rejectCallback=r,this._stream.on("data",n=>this._executeOne(n)).on("error",n=>this._setReadEnded(n)).on("end",()=>this._setReadEnded())})}_executeOne(e){if(!Array.isArray(e))return this._setReadEnded(new TypeError("Stream should be in objectMode and should emit Array instances"));if(this._readEnded)return;let r=this._index++;this._inFlight++,this._client.execute(this._query,e,this._queryOptions).then(n=>{this._result.setResultItem(r,n),this._inFlight--}).catch(n=>{this._inFlight--,this._setError(r,n)}).then(()=>{this._stream.isPaused()&&this._stream.resume(),this._readEnded&&this._inFlight===0&&this._resolveCallback(this._result)}),this._inFlight>=this._concurrencyLevel&&this._stream.pause()}_setReadEnded(e){this._readEnded||(this._readEnded=!0,e?this._rejectCallback(e):this._inFlight===0&&this._resolveCallback(this._result))}_setError(e,r){this._result.setError(e,r),this._raiseOnFirstError&&(this._readEnded=!0,this._rejectCallback(r))}};c(Km,"StreamBasedExecutor");var Um=Km,Hm=class Hm{constructor(e){this._collectResults=e.collectResults,this._maxErrors=e.maxErrors||100,this.totalExecuted=0,this.errors=[],this._collectResults?this.resultItems=[]:Object.defineProperty(this,"resultItems",{enumerable:!1,get:()=>{throw new Error("Property resultItems can not be accessed when collectResults is set to false")}})}setResultItem(e,r){this.totalExecuted++,this._collectResults&&(this.resultItems[e]=r)}setError(e,r){this.totalExecuted++,this.errors.length{"use strict";$m.graph=Vg();$m.search=bp()});var Dl=_(Bt=>{"use strict";var s5=ma();Bt.Client=Sb();Bt.ExecutionProfile=kd().ExecutionProfile;Bt.ExecutionOptions=xi().ExecutionOptions;Bt.types=Ke();Bt.errors=ze();Bt.policies=yu();Bt.auth=Oa();Bt.mapping=Yb();Bt.tracker=ld();Bt.metrics=yd();Bt.concurrent=Xb();var eI=Fa();Bt.token={Token:eI.Token,TokenRange:eI.TokenRange};var o5=w0();Bt.metadata={Metadata:o5};Bt.Encoder=Ou();Bt.geometry=Nu();Bt.datastax=Jb();Bt.defaultOptions=function(){return s5.defaultOptions()};Bt.version=oo().version});var tI=_((MZ,a5)=>{a5.exports={model:{modelName:"New model",dbVersion:"3.x",dbVendor:"Cassandra"},container:{name:"New keyspace",indexes:[],replStrategy:"SimpleStrategy",addToCqlScript:!0},collection:{collectionName:"New table",collectionUsers:[],collation:{},tableOptions:{}},field:{name:"New column",subtype:{valueDependencies:[{value:"object",dependency:{key:"type",value:"jsonObject"}},{value:"array",dependency:{key:"type",value:"jsonArray"}}]}},patternField:{name:"^[a-zA-Z0-9_.-]+$"},multipleField:{primaryKey:!1},subschema:{},arrayItem:{},choice:{},relationship:{},user:{},view:{viewOn:""},UDFs:{name:"New UDF",udfID:"",udfDescription:"",udfFunction:"",udfComments:""},UDAs:{name:"New UDA",udfID:"",udfDescription:"",udfFunction:"",udfComments:""},SecIndxs:{name:"New Index",indexType:"Secondary",SecIndxKey:"",SecIndxID:"",SecIndxDescription:"",SecIndxFunction:"",SecIndxComments:""}}});var iI=_((KZ,nI)=>{"use strict";var rI=Dl().types,c5=tI(),u5={numeric:"num",char:"str",timestamp:"ts",reference:"udt"},l5=c5.field.name;nI.exports=t=>{let e=c((x,A,O)=>{let j=rI.getDataTypeNameByCode(x.type||x).split("<")[0];return A&&j==="udt"?(A.push({udt:x,sample:O}),r(x)):n(j,x,O,A)},"getColumnType"),r=c(x=>{let A=t.get(x,"type.info.name",t.get(x,"info.name",x.name));return{type:"reference",$ref:`#/definitions/${A}`,refName:A}},"getRef"),n=c((x,A,O,L)=>{let j=u(x);return x==="map"?i(j,A,O,L):x==="tuple"?s(j,A,O,L):x==="set"||x==="list"?o(j,A,O,L):x==="custom"&&w(A)?a(j,A,O,L):j},"getType"),i=c((x,A,O,L)=>{let j=(A.info||A.type.info)[0],Y=(A.info||A.type.info)[1],se=e(j),re=p({valueData:Y,sample:O,udtHash:L}),k=se.mode?{keySubtype:se.mode}:{},Ae=se.type,q=m(re),T=l(x.type,q);return Object.assign({},x,k,{keyType:Ae,subtype:T,properties:re})},"handleMap"),s=c((x,A,O,L)=>{O=Array.isArray(O)?O:[];let j=(A.info||A.type.info).map(Y=>{let se=O.find(k=>d(k,Y));return e(Y,L,se)});return Object.assign({},x,{items:j})},"handleTuple"),o=c((x,A,O,L)=>{let j=A.info||A.type.info,Y=y(j,O,L),se=(Y[0]||{type:"text"}).type,re=l(x.type,se);return Object.assign({},x,{items:t.uniqWith(Y,t.isEqual),subtype:re})},"handleList"),a=c((x,A,O,L)=>{let j=A.info||A.type.info,Y=j.dimensions,se=y(j.subtype,O,L),re=t.uniqWith(se,t.isEqual),k=(re[0]||{mode:"float"}).mode;return{...x,dimension:Y,subtype:k,items:re}},"handleVector"),u=c(x=>{switch(x){case"int":return{type:"numeric",mode:"integer"};case"smallint":case"tinyint":case"bigint":case"counter":case"decimal":case"double":case"float":case"varint":return{type:"numeric",mode:x};case"text":case"varchar":case"ascii":case"inet":return{type:"char",mode:x};case"boolean":return{type:"bool"};case"timestamp":case"timeuuid":case"blob":case"date":case"time":case"uuid":return{type:x};case"tuple":case"list":case"set":case"map":return{type:x};default:return{type:"char"}}},"getAppType"),l=c((x,A)=>`${x}<${u5[A]||A}>`,"getSubType"),f=c((x,A,O)=>!A||typeof A!="object"?h(x,O):Object.keys(A).reduce((L,j)=>Object.assign({},L,{[j]:e(x,O,A[j])}),{}),"getProperties"),h=c((x,A)=>{let O=e(x,A);return{[O.refName||l5]:t.omit(O,"refName")}},"getDefaultProperties"),p=c(({valueData:x,sample:A,udtHash:O})=>{let L=f(x,A,O),j=Object.entries(L),Y=t.uniqWith(j,([,se],[,re])=>se.type===re.type&&se.$ref===re.$ref&&se.mode===re.mode);return Object.fromEntries(Y)},"getMapProperties"),g=c(x=>{switch(x){case"smallint":case"tinyint":case"int":case"bigint":case"counter":case"decimal":case"double":case"float":case"varint":return"number";case"text":case"varchar":case"ascii":case"inet":case"timestamp":case"timeuuid":case"blob":case"date":case"time":case"uuid":return"string";case"boolean":return"boolean";case"tuple":case"list":case"set":return"array";case"map":return"object";default:return"string"}},"getJsonType"),d=c((x,A)=>{let L=rI.getDataTypeNameByCode(A.type||A).split("<")[0],j=g(L);return j==="array"?Array.isArray(x):j==="array"?Object(x)===x:typeof x===j},"isTypeEqual"),y=c((x,A,O)=>!Array.isArray(A)||A.length===0?v(x,O):A.map(L=>e(x,O,L)),"getItems"),v=c((x,A)=>[e(x,A)],"getDefaultItems"),m=c(x=>{let A=Object.keys(x).pop(),O=(x[A]||{}).type;return O||"text"},"getChildTypeByProperties"),w=c(x=>{let A=x.info||x.type.info,O=A==null?void 0:A.dimensions;return!isNaN(+O)},"isVector");return{getColumnType:e}}});var lI=_(($Z,uI)=>{"use strict";var sI="compaction",oI="compression",aI="caching",f5=[aI,sI,oI],cI=c(t=>String(t||"").replace(/[\"\`]/g,"'"),"changeQuotes"),h5=c((t,e)=>{switch(t){case sI:return p5(e);case aI:return g5(e);case oI:return d5(e);default:return null}},"handleSpecialOption"),d5=c(t=>{let{compression:e}=t;return cI(JSON.stringify(e))},"handleCompressionOption"),p5=c(t=>{let{compactionClass:e,compactionOptions:r}=t,n=Object.assign({},{class:e},r);return cI(JSON.stringify(n))},"handleCompactionOption"),g5=c(t=>{let e=JSON.parse(t.caching);return{keys:e.keys,rowsPerPartition:e.rows_per_partition}},"handleCashingOption"),y5=c(t=>(e,r)=>{let n=r.propertyKeyword;if(f5.includes(n)){let i=h5(n,t);return Object.assign({},e,{[n]:i})}return t.hasOwnProperty(n)?Object.assign({},e,{[n]:t[n]}):e},"generateTableOptionsReducer");uI.exports={createTableOptionsFromMeta(t,e){return e.reduce(y5(t),{})}}});var dI=_((jZ,hI)=>{"use strict";var fI=Dl(),jm=class jm extends fI.policies.retry.RetryPolicy{constructor(e){super(),this.hackoladeLogger=e}onReadTimeout(e,r,n,i,s){let a=e.nbRetry;return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Read timeout",respondedNodes:n,needNodesForSuccess:i,query:e.query,nbRetry:e.nbRetry,isLastTry:a>2},"Retry policy info"),a>2?this.rethrowResult():this.retryResult(fI.types.consistencies.one)}onUnavailable(e,r,n,i,s){return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Unavailable",query:e.query,nbRetry:e.nbRetry,isLastTry:e.nbRetry>0},"Retry policy info"),e.nbRetry>0?this.rethrowResult():this.retryResult(void 0,!1)}onRequestError=function(e,r,n){return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Request error",query:e.query,nbRetry:e.nbRetry,error:{...n}},"Retry policy info"),this.retryResult(void 0,!1)}};c(jm,"CassandraRetryPolicy");var Gm=jm;hI.exports=Gm});var Pl=_(ai=>{"use strict";var pI=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",m5=pI+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",gI="["+pI+"]["+m5+"]*",v5=new RegExp("^"+gI+"$"),E5=c(function(t,e){let r=[],n=e.exec(t);for(;n;){let i=[];i.startIndex=e.lastIndex-n[0].length;let s=n.length;for(let o=0;o"u")},"isName");ai.isExist=function(t){return typeof t<"u"};ai.isEmptyObject=function(t){return Object.keys(t).length===0};ai.merge=function(t,e,r){if(e){let n=Object.keys(e),i=n.length;for(let s=0;s{"use strict";var zm=Pl(),C5={allowBooleanAttributes:!1,unpairedTags:[]};SI.validate=function(t,e){e=Object.assign({},C5,e);let r=[],n=!1,i=!1;t[0]==="\uFEFF"&&(t=t.substr(1));for(let s=0;s"&&t[s]!==" "&&t[s]!==" "&&t[s]!==` +`&&t[s]!=="\r";s++)u+=t[s];if(u=u.trim(),u[u.length-1]==="/"&&(u=u.substring(0,u.length-1),s--),!N5(u)){let h;return u.trim().length===0?h="Invalid space after '<'.":h="Tag '"+u+"' is an invalid name.",Ct("InvalidTag",h,mr(t,s))}let l=T5(t,s);if(l===!1)return Ct("InvalidAttr","Attributes for '"+u+"' have open quote.",mr(t,s));let f=l.value;if(s=l.index,f[f.length-1]==="/"){let h=s-f.length;f=f.substring(0,f.length-1);let p=EI(f,e);if(p===!0)n=!0;else return Ct(p.err.code,p.err.msg,mr(t,h+p.err.line))}else if(a)if(l.tagClosed){if(f.trim().length>0)return Ct("InvalidTag","Closing tag '"+u+"' can't have attributes or invalid starting.",mr(t,o));if(r.length===0)return Ct("InvalidTag","Closing tag '"+u+"' has not been opened.",mr(t,o));{let h=r.pop();if(u!==h.tagName){let p=mr(t,h.tagStartPos);return Ct("InvalidTag","Expected closing tag '"+h.tagName+"' (opened in line "+p.line+", col "+p.col+") instead of closing tag '"+u+"'.",mr(t,o))}r.length==0&&(i=!0)}}else return Ct("InvalidTag","Closing tag '"+u+"' doesn't have proper closing.",mr(t,s));else{let h=EI(f,e);if(h!==!0)return Ct(h.err.code,h.err.msg,mr(t,s-f.length+h.err.line));if(i===!0)return Ct("InvalidXml","Multiple possible root nodes found.",mr(t,s));e.unpairedTags.indexOf(u)!==-1||r.push({tagName:u,tagStartPos:o}),n=!0}for(s++;s0)return Ct("InvalidXml","Invalid '"+JSON.stringify(r.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ct("InvalidXml","Start tag expected.",1);return!0};function yI(t){return t===" "||t===" "||t===` +`||t==="\r"}c(yI,"isWhiteSpace");function mI(t,e){let r=e;for(;e5&&n==="xml")return Ct("InvalidXml","XML declaration allowed only at the start of the document.",mr(t,e));if(t[e]=="?"&&t[e+1]==">"){e++;break}else continue}return e}c(mI,"readPI");function vI(t,e){if(t.length>e+5&&t[e+1]==="-"&&t[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(t.length>e+8&&t[e+1]==="D"&&t[e+2]==="O"&&t[e+3]==="C"&&t[e+4]==="T"&&t[e+5]==="Y"&&t[e+6]==="P"&&t[e+7]==="E"){let r=1;for(e+=8;e"&&(r--,r===0))break}else if(t.length>e+9&&t[e+1]==="["&&t[e+2]==="C"&&t[e+3]==="D"&&t[e+4]==="A"&&t[e+5]==="T"&&t[e+6]==="A"&&t[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}c(vI,"readCommentAndCDATA");var w5='"',x5="'";function T5(t,e){let r="",n="",i=!1;for(;e"&&n===""){i=!0;break}r+=t[e]}return n!==""?!1:{value:r,index:e,tagClosed:i}}c(T5,"readAttributeStr");var _5=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function EI(t,e){let r=zm.getAllMatches(t,_5),n={};for(let i=0;i{var CI={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(t,e,r){return t}},B5=c(function(t){return Object.assign({},CI,t)},"buildOptions");Qm.buildOptions=B5;Qm.defaultOptions=CI});var TI=_((eX,xI)=>{"use strict";var Zm=class Zm{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,r){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:r})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};c(Zm,"XmlNode");var Ym=Zm;xI.exports=Ym});var bI=_((rX,_I)=>{var R5=Pl();function O5(t,e){let r={};if(t[e+3]==="O"&&t[e+4]==="C"&&t[e+5]==="T"&&t[e+6]==="Y"&&t[e+7]==="P"&&t[e+8]==="E"){e=e+9;let n=1,i=!1,s=!1,o="";for(;e"){if(s?t[e-1]==="-"&&t[e-2]==="-"&&(s=!1,n--):n--,n===0)break}else t[e]==="["?i=!0:o+=t[e];if(n!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:r,i:e}}c(O5,"readDocType");function D5(t,e){let r="";for(;e{var V5=/^[-+]?0x[a-fA-F0-9]+$/,M5=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var K5={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function H5(t,e={}){if(e=Object.assign({},K5,e),!t||typeof t!="string")return t;let r=t.trim();if(e.skipLike!==void 0&&e.skipLike.test(r))return t;if(e.hex&&V5.test(r))return Number.parseInt(r,16);{let n=M5.exec(r);if(n){let i=n[1],s=n[2],o=$5(n[3]),a=n[4]||n[6];if(!e.leadingZeros&&s.length>0&&i&&r[2]!==".")return t;if(!e.leadingZeros&&s.length>0&&!i&&r[1]!==".")return t;{let u=Number(r),l=""+u;return l.search(/[eE]/)!==-1||a?e.eNotation?u:t:r.indexOf(".")!==-1?l==="0"&&o===""||l===o||i&&l==="-"+o?u:t:s?o===l||i+o===l?u:t:r===l||r===i+l?u:t}}else return t}}c(H5,"toNumber");function $5(t){return t&&t.indexOf(".")!==-1&&(t=t.replace(/0+$/,""),t==="."?t="0":t[0]==="."?t="0"+t:t[t.length-1]==="."&&(t=t.substr(0,t.length-1))),t}c($5,"trimZeros");II.exports=H5});var RI=_((oX,BI)=>{"use strict";var NI=Pl(),dc=TI(),G5=bI(),j5=AI(),tv=class tv{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(r,n)=>String.fromCharCode(Number.parseInt(n,16))}},this.addExternalEntities=z5,this.parseXml=X5,this.parseTextData=W5,this.resolveNameSpace=Q5,this.buildAttributesMap=Z5,this.isItStopNode=rV,this.replaceEntitiesValue=eV,this.readStopNodeData=iV,this.saveTextToParentTag=tV,this.addChild=J5}};c(tv,"OrderedObjParser");var Xm=tv;function z5(t){let e=Object.keys(t);for(let r=0;r0)){o||(t=this.replaceEntitiesValue(t));let a=this.options.tagValueProcessor(e,t,r,i,s);return a==null?t:typeof a!=typeof t||a!==t?a:this.options.trimValues?ev(t,this.options.parseTagValue,this.options.numberParseOptions):t.trim()===t?ev(t,this.options.parseTagValue,this.options.numberParseOptions):t}}c(W5,"parseTextData");function Q5(t){if(this.options.removeNSPrefix){let e=t.split(":"),r=t.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(t=r+e[1])}return t}c(Q5,"resolveNameSpace");var Y5=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function Z5(t,e,r){if(!this.options.ignoreAttributes&&typeof t=="string"){let n=NI.getAllMatches(t,Y5),i=n.length,s={};for(let o=0;o",s,"Closing Tag is not closed."),u=t.substring(s+2,a).trim();if(this.options.removeNSPrefix){let h=u.indexOf(":");h!==-1&&(u=u.substr(h+1))}this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&(n=this.saveTextToParentTag(n,r,i));let l=i.substring(i.lastIndexOf(".")+1);if(u&&this.options.unpairedTags.indexOf(u)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let f=0;l&&this.options.unpairedTags.indexOf(l)!==-1?(f=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):f=i.lastIndexOf("."),i=i.substring(0,f),r=this.tagsNodeStack.pop(),n="",s=a}else if(t[s+1]==="?"){let a=Jm(t,s,!1,"?>");if(!a)throw new Error("Pi Tag is not closed.");if(n=this.saveTextToParentTag(n,r,i),!(this.options.ignoreDeclaration&&a.tagName==="?xml"||this.options.ignorePiTags)){let u=new dc(a.tagName);u.add(this.options.textNodeName,""),a.tagName!==a.tagExp&&a.attrExpPresent&&(u[":@"]=this.buildAttributesMap(a.tagExp,i,a.tagName)),this.addChild(r,u,i)}s=a.closeIndex+1}else if(t.substr(s+1,3)==="!--"){let a=Bs(t,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){let u=t.substring(s+4,a-2);n=this.saveTextToParentTag(n,r,i),r.add(this.options.commentPropName,[{[this.options.textNodeName]:u}])}s=a}else if(t.substr(s+1,2)==="!D"){let a=G5(t,s);this.docTypeEntities=a.entities,s=a.i}else if(t.substr(s+1,2)==="!["){let a=Bs(t,"]]>",s,"CDATA is not closed.")-2,u=t.substring(s+9,a);n=this.saveTextToParentTag(n,r,i);let l=this.parseTextData(u,r.tagname,i,!0,!1,!0,!0);l==null&&(l=""),this.options.cdataPropName?r.add(this.options.cdataPropName,[{[this.options.textNodeName]:u}]):r.add(this.options.textNodeName,l),s=a+2}else{let a=Jm(t,s,this.options.removeNSPrefix),u=a.tagName,l=a.rawTagName,f=a.tagExp,h=a.attrExpPresent,p=a.closeIndex;this.options.transformTagName&&(u=this.options.transformTagName(u)),r&&n&&r.tagname!=="!xml"&&(n=this.saveTextToParentTag(n,r,i,!1));let g=r;if(g&&this.options.unpairedTags.indexOf(g.tagname)!==-1&&(r=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),u!==e.tagname&&(i+=i?"."+u:u),this.isItStopNode(this.options.stopNodes,i,u)){let d="";if(f.length>0&&f.lastIndexOf("/")===f.length-1)u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),s=a.closeIndex;else if(this.options.unpairedTags.indexOf(u)!==-1)s=a.closeIndex;else{let v=this.readStopNodeData(t,l,p+1);if(!v)throw new Error(`Unexpected end of ${l}`);s=v.i,d=v.tagContent}let y=new dc(u);u!==f&&h&&(y[":@"]=this.buildAttributesMap(f,i,u)),d&&(d=this.parseTextData(d,u,i,!0,h,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),y.add(this.options.textNodeName,d),this.addChild(r,y,i)}else{if(f.length>0&&f.lastIndexOf("/")===f.length-1){u[u.length-1]==="/"?(u=u.substr(0,u.length-1),i=i.substr(0,i.length-1),f=u):f=f.substr(0,f.length-1),this.options.transformTagName&&(u=this.options.transformTagName(u));let d=new dc(u);u!==f&&h&&(d[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(r,d,i),i=i.substr(0,i.lastIndexOf("."))}else{let d=new dc(u);this.tagsNodeStack.push(r),u!==f&&h&&(d[":@"]=this.buildAttributesMap(f,i,u)),this.addChild(r,d,i),r=d}n="",s=p}}else n+=t[s];return e.child},"parseXml");function J5(t,e,r){let n=this.options.updateTag(e.tagname,r,e[":@"]);n===!1||(typeof n=="string"&&(e.tagname=n),t.addChild(e))}c(J5,"addChild");var eV=c(function(t){if(this.options.processEntities){for(let e in this.docTypeEntities){let r=this.docTypeEntities[e];t=t.replace(r.regx,r.val)}for(let e in this.lastEntities){let r=this.lastEntities[e];t=t.replace(r.regex,r.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let r=this.htmlEntities[e];t=t.replace(r.regex,r.val)}t=t.replace(this.ampEntity.regex,this.ampEntity.val)}return t},"replaceEntitiesValue");function tV(t,e,r,n){return t&&(n===void 0&&(n=Object.keys(e.child).length===0),t=this.parseTextData(t,e.tagname,r,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,n),t!==void 0&&t!==""&&e.add(this.options.textNodeName,t),t=""),t}c(tV,"saveTextToParentTag");function rV(t,e,r){let n="*."+r;for(let i in t){let s=t[i];if(n===s||e===s)return!0}return!1}c(rV,"isItStopNode");function nV(t,e,r=">"){let n,i="";for(let s=e;s",r,`${e} is not closed`);if(t.substring(r+2,s).trim()===e&&(i--,i===0))return{tagContent:t.substring(n,r),i:s};r=s}else if(t[r+1]==="?")r=Bs(t,"?>",r+1,"StopNode is not closed.");else if(t.substr(r+1,3)==="!--")r=Bs(t,"-->",r+3,"StopNode is not closed.");else if(t.substr(r+1,2)==="![")r=Bs(t,"]]>",r,"StopNode is not closed.")-2;else{let s=Jm(t,r,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,r=s.closeIndex)}}c(iV,"readStopNodeData");function ev(t,e,r){if(e&&typeof t=="string"){let n=t.trim();return n==="true"?!0:n==="false"?!1:j5(t,r)}else return NI.isExist(t)?t:""}c(ev,"parseValue");BI.exports=Xm});var PI=_(DI=>{"use strict";function sV(t,e){return OI(t,e)}c(sV,"prettify");function OI(t,e,r){let n,i={};for(let s=0;s0&&(i[e.textNodeName]=n):n!==void 0&&(i[e.textNodeName]=n),i}c(OI,"compress");function oV(t){let e=Object.keys(t);for(let r=0;r{var{buildOptions:uV}=wI(),lV=RI(),{prettify:fV}=PI(),hV=Wm(),nv=class nv{constructor(e){this.externalEntities={},this.options=uV(e)}parse(e,r){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(r){r===!0&&(r={});let s=hV.validate(e,r);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let n=new lV(this.options);n.addExternalEntities(this.externalEntities);let i=n.parseXml(e);return this.options.preserveOrder||i===void 0?i:fV(i,this.options)}addEntity(e,r){if(r.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if(r==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=r}};c(nv,"XMLParser");var rv=nv;LI.exports=rv});var MI=_((hX,VI)=>{var dV=` +`;function pV(t,e){let r="";return e.format&&e.indentBy.length>0&&(r=dV),qI(t,e,"",r)}c(pV,"toXml");function qI(t,e,r,n){let i="",s=!1;for(let o=0;o`,s=!1;continue}else if(u===e.commentPropName){i+=n+``,s=!0;continue}else if(u[0]==="?"){let d=FI(a[":@"],e),y=u==="?xml"?"":n,v=a[u][0][e.textNodeName];v=v.length!==0?" "+v:"",i+=y+`<${u}${v}${d}?>`,s=!0;continue}let f=n;f!==""&&(f+=e.indentBy);let h=FI(a[":@"],e),p=n+`<${u}${h}`,g=qI(a[u],e,l,f);e.unpairedTags.indexOf(u)!==-1?e.suppressUnpairedNode?i+=p+">":i+=p+"/>":(!g||g.length===0)&&e.suppressEmptyNode?i+=p+"/>":g&&g.endsWith(">")?i+=p+`>${g}${n}`:(i+=p+">",g&&n!==""&&(g.includes("/>")||g.includes("`),s=!0}return i}c(qI,"arrToStr");function gV(t){let e=Object.keys(t);for(let r=0;r0&&e.processEntities)for(let r=0;r{"use strict";var mV=MI(),vV={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(t,e){return e},attributeValueProcessor:function(t,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function Pi(t){this.options=Object.assign({},vV,t),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=CV),this.processTextOrObjNode=EV,this.options.format?(this.indentate=SV,this.tagEndChar=`> +`,this.newLine=` +`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}c(Pi,"Builder");Pi.prototype.build=function(t){return this.options.preserveOrder?mV(t,this.options):(Array.isArray(t)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(t={[this.options.arrayNodeName]:t}),this.j2x(t,0).val)};Pi.prototype.j2x=function(t,e){let r="",n="";for(let i in t)if(Object.prototype.hasOwnProperty.call(t,i))if(typeof t[i]>"u")this.isAttribute(i)&&(n+="");else if(t[i]===null)this.isAttribute(i)?n+="":i[0]==="?"?n+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(t[i]instanceof Date)n+=this.buildTextValNode(t[i],i,"",e);else if(typeof t[i]!="object"){let s=this.isAttribute(i);if(s)r+=this.buildAttrPairStr(s,""+t[i]);else if(i===this.options.textNodeName){let o=this.options.tagValueProcessor(i,""+t[i]);n+=this.replaceEntitiesValue(o)}else n+=this.buildTextValNode(t[i],i,"",e)}else if(Array.isArray(t[i])){let s=t[i].length,o="";for(let a=0;a"u"||(u===null?i[0]==="?"?n+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:n+=this.indentate(e)+"<"+i+"/"+this.tagEndChar:typeof u=="object"?this.options.oneListGroup?o+=this.j2x(u,e+1).val:o+=this.processTextOrObjNode(u,i,e):o+=this.buildTextValNode(u,i,"",e))}this.options.oneListGroup&&(o=this.buildObjectNode(o,i,"",e)),n+=o}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){let s=Object.keys(t[i]),o=s.length;for(let a=0;a"+t+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(n)+``+this.newLine:this.indentate(n)+"<"+e+r+s+this.tagEndChar+t+this.indentate(n)+i}};Pi.prototype.closeTag=function(t){let e="";return this.options.unpairedTags.indexOf(t)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(n)+``+this.newLine;if(e[0]==="?")return this.indentate(n)+"<"+e+r+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,t);return i=this.replaceEntitiesValue(i),i===""?this.indentate(n)+"<"+e+r+this.closeTag(e)+this.tagEndChar:this.indentate(n)+"<"+e+r+">"+i+"0&&this.options.processEntities)for(let e=0;e{"use strict";var wV=Wm(),xV=kI(),TV=HI();$I.exports={XMLParser:xV,XMLValidator:wV,XMLBuilder:TV}});var zI=_((mX,jI)=>{"use strict";jI.exports=t=>{let e=c((a,u,l)=>{if(t.isUndefined(l))return u;if((l==null?void 0:l.type)!=="reference")return Array.isArray(u)&&l.items?((l==null?void 0:l.type)==="tuple"?n:r)(l.items,u):t.isPlainObject(u)?s(l.properties||{},u):u},"handleItem"),r=c((a,u)=>u.map(l=>e(a,l,a==null?void 0:a[0])).filter(l=>!t.isBoolean(l)&&!t.isEmpty(l)),"handleItems"),n=c((a,u)=>{let l=u.map((f,h)=>e(a,f,a==null?void 0:a[h]));return l.some(f=>f===void 0)?[]:l},"handleTuple"),i=c(({properties:a,records:u})=>Object.entries(a).reduce((l,[f,h])=>({...l,[f]:s(h==null?void 0:h.properties,u==null?void 0:u[f])}),{}),"handleMap"),s=c((a,u)=>t.isPlainObject(u)?Object.entries(u).reduce((l,[f,h])=>{let p=a==null?void 0:a[f],g=p==null?void 0:p.type;return(g==="list"||g==="set")&&p.items?{...l,[f]:r(p.items,h)}:g==="tuple"&&p.items?{...l,[f]:n(p.items,h)}:g==="map"&&p.properties?{...l,[f]:i({properties:p.properties,records:h})}:{...l,[f]:h}},{}):u,"filterUdt");return{filterUdts:c((a,u)=>u.map(l=>s(a,l)),"filterUdts")}}});var QI=_((EX,WI)=>{var _V=require("crypto"),sv=class sv{constructor(e){this.hash=this.getPreKeyedHash(e),this.password=e}update(e){this.hash.update(e)}digest(){return this.hash.digest()}getPreKeyedHash(e){let r=_V.createHash("sha1"),n=Buffer.alloc(e.length*2);for(let i=0,s=0;i>8,n[s++]=e[i].charCodeAt();return r.update(n),r.update(Buffer.from("Mighty Aphrodite")),r}};c(sv,"PasswordDigest");var iv=sv;WI.exports=iv});var Io=_((CX,YI)=>{var bV=c((t,e,r)=>Uint8Array.prototype.slice?Uint8Array.prototype.slice.call(t,e,r):t.slice(e,r),"sliceBuffer");YI.exports=bV});var JI=_((xX,XI)=>{var ov=4294967296,ZI=[];for(Ao=0;Ao<256;Ao++)ZI[Ao]=(Ao>15?"":"0")+Ao.toString(16);var Ao,pc=XI.exports=function(t,e){t instanceof Buffer?(this.buffer=t,this.offset=e||0):Object.prototype.toString.call(t)=="[object Uint8Array]"?(this.buffer=new Buffer(t),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};pc.MAX_INT=Math.pow(2,53);pc.MIN_INT=-Math.pow(2,53);pc.prototype={constructor:pc,_2scomp:function(){for(var t=this.buffer,e=this.offset,r=1,n=e+7;n>=e;n--){var i=(t[n]^255)+r;t[n]=i&255,r=i>>8}},setValue:function(t,e){var r=!1;if(arguments.length==1)if(typeof t=="number"){if(r=t<0,t=Math.abs(t),e=t%ov,t=t/ov,t>ov)throw new RangeError(t+" is outside Int64 range");t=t|0}else if(typeof t=="string")t=(t+"").replace(/^0x/,""),e=t.substr(-8),t=t.length>8?t.substr(0,t.length-8):"",t=parseInt(t,16),e=parseInt(e,16);else throw new Error(t+" must be a Number or String");for(var n=this.buffer,i=this.offset,s=7;s>=0;s--)n[i+s]=e&255,e=s==4?t:e>>>8;r&&this._2scomp()},toNumber:function(t){for(var e=this.buffer,r=this.offset,n=e[r]&128,i=0,s=1,o=7,a=1;o>=0;o--,a*=256){var u=e[r+o];n&&(u=(u^255)+s,s=u>>8,u=u&255),i+=u*a}return!t&&i>=pc.MAX_INT?n?-1/0:1/0:n?-i:i},valueOf:function(){return this.toNumber(!1)},toString:function(t){return this.valueOf().toString(t||10)},toOctetString:function(t){for(var e=new Array(8),r=this.buffer,n=this.offset,i=0;i<8;i++)e[i]=ZI[r[n+i]];return e.join(t||"")},toBuffer:function(t){if(t&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(t,e){this.buffer.copy(t,e||0,this.offset,this.offset+8)},compare:function(t){if((this.buffer[this.offset]&128)!=(t.buffer[t.offset]&128))return t.buffer[t.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==t.buffer[t.offset+e])return this.buffer[this.offset+e]-t.buffer[t.offset+e];return 0},equals:function(t){return this.compare(t)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var Rs=_((TX,eA)=>{var IV=JI(),AV=Io(),cv=class cv{constructor(e){this.buffer=Buffer.from(e),this.offset=0}readInt(){return this.buffer.readUInt32BE(this.shift(4))}readUTF(){let e=this.buffer.readUInt16BE(this.shift(2));return this.read(e).toString()}read(e){return AV(this.buffer,this.offset,this.shift(e)+e)}readLong(){let e=this.read(8);return typeof e.readBigUInt64BE=="function"?e.readBigUInt64BE():+new IV(e).toString()}readByte(){return this.buffer.readUInt8(this.shift(1))}readShort(){return this.read(2).readUInt16BE()}shift(e){let r=this.offset;return this.offset+=e,r}available(){return this.buffer.length-this.offset}};c(cv,"InputStream");var av=cv;eA.exports=av});var rA=_((bX,tA)=>{var NV=Io(),BV=Rs(),lv=class lv extends BV{constructor(e,r){super(e),this.digest=r}readInt(){return this.updateDigest(4),super.readInt()}readUTF(){return this.updateDigest(2),super.readUTF()}read(e){return this.updateDigest(e),super.read(e)}readLong(){return super.readLong()}readByte(){return this.updateDigest(1),super.readByte()}updateDigest(e){this.digest.update(NV(this.buffer,this.offset,this.offset+e))}};c(lv,"DigestInputStream");var uv=lv;tA.exports=uv});var iA=_((AX,nA)=>{var hv=class hv{constructor({certType:e,value:r}){this.certType=e,this.value=r}};c(hv,"Certificate");var fv=hv;nA.exports=fv});var gv=_((BX,sA)=>{var pv=class pv{constructor({alias:e,date:r,chain:n,protectedPrivateKey:i}){this.certType="X.509",this.alias=e,this.date=r,this.chain=n,this.protectedPrivateKey=i}};c(pv,"KeyEntry");var dv=pv;sA.exports=dv});var vv=_((OX,oA)=>{var mv=class mv{constructor({alias:e,date:r,cert:n}){this.certType="X.509",this.alias=e,this.date=r,this.cert=n}};c(mv,"TrustedKeyEntry");var yv=mv;oA.exports=yv});var cA=_((PX,aA)=>{var RV=QI(),OV=rA(),PV=Rs(),LV=iA(),kV=gv(),FV=vv(),qV=Io(),ci=class ci{constructor(e,r){this.keystore=e,this.password=r,r?(this.messageDigest=new RV(r),this.dataInputStream=new OV(e,this.messageDigest)):this.dataInputStream=new PV(e)}assertMagic(e){if(e!==ci.MAGIC)throw new Error("Invalid keystore format")}assertVersion(e){if(e!==ci.VERSION_1&&e!==ci.VERSION_2)throw new Error("Invalid keystore format")}parse(){let e=this.dataInputStream.readInt(),r=this.dataInputStream.readInt();this.assertMagic(e),this.assertVersion(r);let n=this.dataInputStream.readInt(),i=[];for(let s=0;sr[s]===i))throw new Error("Password verification failed")}getPrivateKeyEntry(){return this.dataInputStream.read(this.dataInputStream.readInt())}readCert(e){let r="X.509";e===ci.VERSION_2&&(r=this.dataInputStream.readUTF());let n=this.dataInputStream.read(this.dataInputStream.readInt());return new LV({certType:r,value:n})}readCertificateChain(e){let r=this.dataInputStream.readInt(),n=[];for(let i=0;i{uA.exports={options:{usePureJavaScript:!1}}});var hA=_((FX,fA)=>{var Ev={};fA.exports=Ev;var lA={};Ev.encode=function(t,e,r){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(r!==void 0&&typeof r!="number")throw new TypeError('"maxline" must be a number.');var n="";if(!(t instanceof Uint8Array))n=UV(t,e);else{var i=0,s=e.length,o=e.charAt(0),a=[0];for(i=0;i0;)a.push(l%s),l=l/s|0}for(i=0;t[i]===0&&i=0;--i)n+=e[a[i]]}if(r){var f=new RegExp(".{1,"+r+"}","g");n=n.match(f).join(`\r +`)}return n};Ev.decode=function(t,e){if(typeof t!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var r=lA[e];if(!r){r=lA[e]=[];for(var n=0;n>=8;for(;l>0;)o.push(l&255),l>>=8}for(var f=0;t[f]===s&&f0;)s.push(a%n),a=a/n|0}var u="";for(r=0;t.at(r)===0&&r=0;--r)u+=e[s[r]];return u}c(UV,"_encodeWithByteBuffer")});var qe=_((UX,yA)=>{var dA=ve(),pA=hA(),B=yA.exports=dA.util=dA.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){B.nextTick=process.nextTick,typeof setImmediate=="function"?B.setImmediate=setImmediate:B.setImmediate=B.nextTick;return}if(typeof setImmediate=="function"){B.setImmediate=function(){return setImmediate.apply(void 0,arguments)},B.nextTick=function(a){return setImmediate(a)};return}if(B.setImmediate=function(a){setTimeout(a,0)},typeof window<"u"&&typeof window.postMessage=="function"){let a=function(u){if(u.source===window&&u.data===t){u.stopPropagation();var l=e.slice();e.length=0,l.forEach(function(f){f()})}};var o=a;c(a,"handler");var t="forge.setImmediate",e=[];B.setImmediate=function(u){e.push(u),e.length===1&&window.postMessage(t,"*")},window.addEventListener("message",a,!0)}if(typeof MutationObserver<"u"){var r=Date.now(),n=!0,i=document.createElement("div"),e=[];new MutationObserver(function(){var u=e.slice();e.length=0,u.forEach(function(l){l()})}).observe(i,{attributes:!0});var s=B.setImmediate;B.setImmediate=function(u){Date.now()-r>15?(r=Date.now(),s(u)):(e.push(u),e.length===1&&i.setAttribute("a",n=!n))}}B.nextTick=B.setImmediate})();B.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;B.globalScope=function(){return B.isNodejs?global:typeof self>"u"?window:self}();B.isArray=Array.isArray||function(t){return Object.prototype.toString.call(t)==="[object Array]"};B.isArrayBuffer=function(t){return typeof ArrayBuffer<"u"&&t instanceof ArrayBuffer};B.isArrayBufferView=function(t){return t&&B.isArrayBuffer(t.buffer)&&t.byteLength!==void 0};function gc(t){if(!(t===8||t===16||t===24||t===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}c(gc,"_checkBitsParam");B.ByteBuffer=Sv;function Sv(t){if(this.data="",this.read=0,typeof t=="string")this.data=t;else if(B.isArrayBuffer(t)||B.isArrayBufferView(t))if(typeof Buffer<"u"&&t instanceof Buffer)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var r=0;rVV&&(this.data.substr(0,1),this._constructedStringLength=0)};B.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};B.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};B.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))};B.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this};B.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this};B.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(B.encodeUtf8(t))};B.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};B.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};B.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255))};B.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255))};B.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))};B.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(t&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))};B.ByteStringBuffer.prototype.putInt=function(t,e){gc(e);var r="";do e-=8,r+=String.fromCharCode(t>>e&255);while(e>0);return this.putBytes(r)};B.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<0);return e};B.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e};B.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};B.ByteStringBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};B.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)};B.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this};B.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};B.ByteStringBuffer.prototype.copy=function(){var t=B.createBuffer(this.data);return t.read=this.read,t};B.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};B.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};B.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this};B.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this};B.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this};B.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this};B.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this};B.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this};B.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this};B.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this};B.DataBuffer.prototype.putInt=function(t,e){gc(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,t>>e&255);while(e>0);return this};B.DataBuffer.prototype.putSignedInt=function(t,e){return gc(e),this.accommodate(e/8),t<0&&(t+=2<0);return e};B.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<=r&&(e-=r<<1),e};B.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):t===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};B.DataBuffer.prototype.bytes=function(t){return typeof t>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+t)};B.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)};B.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this};B.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};B.DataBuffer.prototype.copy=function(){return new B.DataBuffer(this)};B.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};B.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};B.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this};B.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e0;)e&1&&(r+=t),e>>>=1,e>0&&(t+=t);return r};B.xorBytes=function(t,e,r){for(var n="",i="",s="",o=0,a=0;r>0;--r,++o)i=t.charCodeAt(o)^e.charCodeAt(o),a>=10&&(n+=s,s="",a=0),s+=String.fromCharCode(i),++a;return n+=s,n};B.hexToBytes=function(t){var e="",r=0;for(t.length&!0&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(t&255)};var ki="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Fi=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],gA="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";B.encode64=function(t,e){for(var r="",n="",i,s,o,a=0;a>2),r+=ki.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=ki.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":ki.charAt(o&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r +`,r=r.substr(e));return n+=r,n};B.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",r,n,i,s,o=0;o>4),i!==64&&(e+=String.fromCharCode((n&15)<<4|i>>2),s!==64&&(e+=String.fromCharCode((i&3)<<6|s)));return e};B.encodeUtf8=function(t){return unescape(encodeURIComponent(t))};B.decodeUtf8=function(t){return decodeURIComponent(escape(t))};B.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:pA.encode,decode:pA.decode}};B.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)};B.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,s=0;s>2),r+=ki.charAt((i&3)<<4|s>>4),isNaN(s)?r+="==":(r+=ki.charAt((s&15)<<2|o>>6),r+=isNaN(o)?"=":ki.charAt(o&63)),e&&r.length>e&&(n+=r.substr(0,e)+`\r +`,r=r.substr(e));return n+=r,n};B.binary.base64.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/4)*3)),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,""),r=r||0;for(var i,s,o,a,u=0,l=r;u>4,o!==64&&(n[l++]=(s&15)<<4|o>>2,a!==64&&(n[l++]=(o&3)<<6|a));return e?l-r:n.subarray(0,l)};B.binary.base58.encode=function(t,e){return B.binary.baseN.encode(t,gA,e)};B.binary.base58.decode=function(t,e){return B.binary.baseN.decode(t,gA,e)};B.text={utf8:{},utf16:{}};B.text.utf8.encode=function(t,e,r){t=B.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length)),r=r||0;for(var i=r,s=0;s"u"&&(r=["web","flash"]);var i,s=!1,o=null;for(var a in r){i=r[a];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");n=t.apply(this,e),s=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,n=t.apply(this,e),s=!0)}catch(u){o=u}if(s)break}if(!s)throw o;return n},"_callStorageFunction");B.setItem=function(t,e,r,n,i){Ll(KV,arguments,i)};B.getItem=function(t,e,r,n){return Ll(HV,arguments,n)};B.removeItem=function(t,e,r,n){Ll($V,arguments,n)};B.clearItems=function(t,e,r){Ll(GV,arguments,r)};B.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0};B.format=function(t){for(var e=/%./g,r,n,i=0,s=[],o=0;r=e.exec(t);){n=t.substring(o,e.lastIndex-2),n.length>0&&s.push(n),o=e.lastIndex;var a=r[0][1];switch(a){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+a+"?>")}}return s.push(t.substring(o)),s.join("")};B.formatNumber=function(t,e,r,n){var i=t,s=isNaN(e=Math.abs(e))?2:e,o=r===void 0?",":r,a=n===void 0?".":n,u=i<0?"-":"",l=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",f=l.length>3?l.length%3:0;return u+(f?l.substr(0,f)+a:"")+l.substr(f).replace(/(\d{3})(?=\d)/g,"$1"+a)+(s?o+Math.abs(i-l).toFixed(s).slice(2):"")};B.formatSize=function(t){return t>=1073741824?t=B.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?t=B.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?t=B.formatNumber(t/1024,0)+" KiB":t=B.formatNumber(t,0)+" bytes",t};B.bytesFromIP=function(t){return t.indexOf(".")!==-1?B.bytesFromIPv4(t):t.indexOf(":")!==-1?B.bytesFromIPv6(t):null};B.bytesFromIPv4=function(t){if(t=t.split("."),t.length!==4)return null;for(var e=B.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1))}e.push(s)}if(r.length>0){var u=r[n];u.end-u.start>0&&(e.splice(u.start,u.end-u.start+1,""),u.start===0&&e.unshift(""),u.end===7&&e.push(""))}return e.join(":")};B.estimateCores=function(t,e){if(typeof t=="function"&&(e=t,t={}),t=t||{},"cores"in B&&!t.update)return e(null,B.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return B.cores=navigator.hardwareConcurrency,e(null,B.cores);if(typeof Worker>"u")return B.cores=1,e(null,B.cores);if(typeof Blob>"u")return B.cores=2,e(null,B.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(o){for(var a=Date.now(),u=a+4;Date.now()g.st&&f.stf.st&&g.st{var Gt=ve();qe();mA.exports=Gt.cipher=Gt.cipher||{};Gt.cipher.algorithms=Gt.cipher.algorithms||{};Gt.cipher.createCipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Gt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Gt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})};Gt.cipher.createDecipher=function(t,e){var r=t;if(typeof r=="string"&&(r=Gt.cipher.getAlgorithm(r),r&&(r=r())),!r)throw new Error("Unsupported algorithm: "+t);return new Gt.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})};Gt.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),Gt.cipher.algorithms[t]=e};Gt.cipher.getAlgorithm=function(t){return t=t.toUpperCase(),t in Gt.cipher.algorithms?Gt.cipher.algorithms[t]:null};var xv=Gt.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};xv.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=Gt.util.createBuffer(),this.output=t.output||Gt.util.createBuffer(),this.mode.start(e)};xv.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};xv.prototype.finish=function(t){t&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(r){return t(this.blockSize,r,!1)},this.mode.unpad=function(r){return t(this.blockSize,r,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var _v=_((KX,vA)=>{var jt=ve();qe();jt.cipher=jt.cipher||{};var _e=vA.exports=jt.cipher.modes=jt.cipher.modes||{};_e.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_e.ecb.prototype.start=function(t){};_e.ecb.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};_e.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};_e.cbc.prototype.start=function(t){if(t.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in t)this._iv=Fl(t.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};_e.cbc.prototype.encrypt=function(t,e,r){if(t.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=t.length(),n=t.at(r-1);return n>this.blockSize<<2?!1:(t.truncate(n),!0)};_e.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=jt.util.createBuffer(),this._partialBytes=0};_e.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fl(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_e.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)t.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_e.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)t.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_e.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=jt.util.createBuffer(),this._partialBytes=0};_e.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fl(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_e.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(t.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)t.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0};_e.ofb.prototype.decrypt=_e.ofb.prototype.encrypt;_e.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=jt.util.createBuffer(),this._partialBytes=0};_e.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=Fl(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};_e.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}ql(this._inBlock)};_e.ctr.prototype.decrypt=_e.ctr.prototype.encrypt;_e.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=jt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};_e.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e=jt.util.createBuffer(t.iv);this._cipherLength=0;var r;if("additionalData"in t?r=jt.util.createBuffer(t.additionalData):r=jt.util.createBuffer(),"tagLength"in t?this._tagLength=t.tagLength:this._tagLength=128,this._tag=null,t.decrypt&&(this._tag=jt.util.createBuffer(t.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=e.length();if(n===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(Tv(n*8)))}this._inBlock=this._j0.slice(0),ql(this._inBlock),this._partialBytes=0,r=jt.util.createBuffer(r),this._aDataLength=Tv(r.length()*8);var i=r.length()%this.blockSize;for(i&&r.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];r.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()])};_e.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(n===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&n>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),ql(this._inBlock)};_e.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),ql(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--n)e[n]=t[n]>>>1|(t[n-1]&1)<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)};_e.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=r/8|0,i=t[n]>>>(7-r%8)*4&15,s=this._m[r][i];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};_e.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)};_e.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,s=new Array(i),o=0;o>>1,i=new Array(r);i[n]=t.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s4){var r=t;t=jt.util.createBuffer();for(var n=0;n{var et=ve();kl();_v();qe();wA.exports=et.aes=et.aes||{};et.aes.startEncrypting=function(t,e,r,n){var i=Ul({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i};et.aes.createEncryptionCipher=function(t,e){return Ul({key:t,output:null,decrypt:!1,mode:e})};et.aes.startDecrypting=function(t,e,r,n){var i=Ul({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i};et.aes.createDecryptionCipher=function(t,e){return Ul({key:t,output:null,decrypt:!0,mode:e})};et.aes.Algorithm=function(t,e){Av||SA();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(n,i){return Iv(r._w,n,i,!1)},decrypt:function(n,i){return Iv(r._w,n,i,!0)}}}),r._init=!1};et.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e=t.key,r;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=et.util.createBuffer(e);else if(et.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){r=e,e=et.util.createBuffer();for(var n=0;n>>2;for(var n=0;n>8^a&255^99,vr[r]=a,bv[a]=r,u=t[a],i=t[r],s=t[i],o=t[s],l=u<<24^a<<16^a<<8^(a^u),f=(i^s^o)<<24^(r^o)<<16^(r^s^o)<<8^(r^i^o);for(var h=0;h<4;++h)Os[h][r]=l,Tn[h][a]=f,l=l<<24|l>>>8,f=f<<24|f>>>8;r===0?r=n=1:(r=i^t[t[t[i^o]]],n^=t[t[n]])}}c(SA,"initialize");function CA(t,e){for(var r=t.slice(0),n,i=1,s=r.length,o=s+6+1,a=No*o,u=s;u>>16&255]<<24^vr[n>>>8&255]<<16^vr[n&255]<<8^vr[n>>>24]^EA[i]<<24,i++):s>6&&u%s===4&&(n=vr[n>>>24]<<24^vr[n>>>16&255]<<16^vr[n>>>8&255]<<8^vr[n&255]),r[u]=r[u-s]^n;if(e){var l,f=Tn[0],h=Tn[1],p=Tn[2],g=Tn[3],d=r.slice(0);a=r.length;for(var u=0,y=a-No;u>>24]]^h[vr[l>>>16&255]]^p[vr[l>>>8&255]]^g[vr[l&255]];r=d}return r}c(CA,"_expandKey");function Iv(t,e,r,n){var i=t.length/4-1,s,o,a,u,l;n?(s=Tn[0],o=Tn[1],a=Tn[2],u=Tn[3],l=bv):(s=Os[0],o=Os[1],a=Os[2],u=Os[3],l=vr);var f,h,p,g,d,y,v;f=e[0]^t[0],h=e[n?3:1]^t[1],p=e[2]^t[2],g=e[n?1:3]^t[3];for(var m=3,w=1;w>>24]^o[h>>>16&255]^a[p>>>8&255]^u[g&255]^t[++m],y=s[h>>>24]^o[p>>>16&255]^a[g>>>8&255]^u[f&255]^t[++m],v=s[p>>>24]^o[g>>>16&255]^a[f>>>8&255]^u[h&255]^t[++m],g=s[g>>>24]^o[f>>>16&255]^a[h>>>8&255]^u[p&255]^t[++m],f=d,h=y,p=v;r[0]=l[f>>>24]<<24^l[h>>>16&255]<<16^l[p>>>8&255]<<8^l[g&255]^t[++m],r[n?3:1]=l[h>>>24]<<24^l[p>>>16&255]<<16^l[g>>>8&255]<<8^l[f&255]^t[++m],r[2]=l[p>>>24]<<24^l[g>>>16&255]<<16^l[f>>>8&255]<<8^l[h&255]^t[++m],r[n?1:3]=l[g>>>24]<<24^l[f>>>16&255]<<16^l[h>>>8&255]<<8^l[p&255]^t[++m]}c(Iv,"_updateBlock");function Ul(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="AES-"+e,n;t.decrypt?n=et.cipher.createDecipher(r,t.key):n=et.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(s,o){var a=null;o instanceof et.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,i.call(n,o)},n}c(Ul,"_createCipher")});var Ui=_((jX,xA)=>{var yc=ve();yc.pki=yc.pki||{};var Nv=xA.exports=yc.pki.oids=yc.oids=yc.oids||{};function z(t,e){Nv[t]=e,Nv[e]=t}c(z,"_IN");function Ge(t,e){Nv[t]=e}c(Ge,"_I_");z("1.2.840.113549.1.1.1","rsaEncryption");z("1.2.840.113549.1.1.4","md5WithRSAEncryption");z("1.2.840.113549.1.1.5","sha1WithRSAEncryption");z("1.2.840.113549.1.1.7","RSAES-OAEP");z("1.2.840.113549.1.1.8","mgf1");z("1.2.840.113549.1.1.9","pSpecified");z("1.2.840.113549.1.1.10","RSASSA-PSS");z("1.2.840.113549.1.1.11","sha256WithRSAEncryption");z("1.2.840.113549.1.1.12","sha384WithRSAEncryption");z("1.2.840.113549.1.1.13","sha512WithRSAEncryption");z("1.3.101.112","EdDSA25519");z("1.2.840.10040.4.3","dsa-with-sha1");z("1.3.14.3.2.7","desCBC");z("1.3.14.3.2.26","sha1");z("1.3.14.3.2.29","sha1WithRSASignature");z("2.16.840.1.101.3.4.2.1","sha256");z("2.16.840.1.101.3.4.2.2","sha384");z("2.16.840.1.101.3.4.2.3","sha512");z("2.16.840.1.101.3.4.2.4","sha224");z("2.16.840.1.101.3.4.2.5","sha512-224");z("2.16.840.1.101.3.4.2.6","sha512-256");z("1.2.840.113549.2.2","md2");z("1.2.840.113549.2.5","md5");z("1.2.840.113549.1.7.1","data");z("1.2.840.113549.1.7.2","signedData");z("1.2.840.113549.1.7.3","envelopedData");z("1.2.840.113549.1.7.4","signedAndEnvelopedData");z("1.2.840.113549.1.7.5","digestedData");z("1.2.840.113549.1.7.6","encryptedData");z("1.2.840.113549.1.9.1","emailAddress");z("1.2.840.113549.1.9.2","unstructuredName");z("1.2.840.113549.1.9.3","contentType");z("1.2.840.113549.1.9.4","messageDigest");z("1.2.840.113549.1.9.5","signingTime");z("1.2.840.113549.1.9.6","counterSignature");z("1.2.840.113549.1.9.7","challengePassword");z("1.2.840.113549.1.9.8","unstructuredAddress");z("1.2.840.113549.1.9.14","extensionRequest");z("1.2.840.113549.1.9.20","friendlyName");z("1.2.840.113549.1.9.21","localKeyId");z("1.2.840.113549.1.9.22.1","x509Certificate");z("1.2.840.113549.1.12.10.1.1","keyBag");z("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");z("1.2.840.113549.1.12.10.1.3","certBag");z("1.2.840.113549.1.12.10.1.4","crlBag");z("1.2.840.113549.1.12.10.1.5","secretBag");z("1.2.840.113549.1.12.10.1.6","safeContentsBag");z("1.2.840.113549.1.5.13","pkcs5PBES2");z("1.2.840.113549.1.5.12","pkcs5PBKDF2");z("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");z("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");z("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");z("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");z("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");z("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");z("1.2.840.113549.2.7","hmacWithSHA1");z("1.2.840.113549.2.8","hmacWithSHA224");z("1.2.840.113549.2.9","hmacWithSHA256");z("1.2.840.113549.2.10","hmacWithSHA384");z("1.2.840.113549.2.11","hmacWithSHA512");z("1.2.840.113549.3.7","des-EDE3-CBC");z("2.16.840.1.101.3.4.1.2","aes128-CBC");z("2.16.840.1.101.3.4.1.22","aes192-CBC");z("2.16.840.1.101.3.4.1.42","aes256-CBC");z("2.5.4.3","commonName");z("2.5.4.4","surname");z("2.5.4.5","serialNumber");z("2.5.4.6","countryName");z("2.5.4.7","localityName");z("2.5.4.8","stateOrProvinceName");z("2.5.4.9","streetAddress");z("2.5.4.10","organizationName");z("2.5.4.11","organizationalUnitName");z("2.5.4.12","title");z("2.5.4.13","description");z("2.5.4.15","businessCategory");z("2.5.4.17","postalCode");z("2.5.4.42","givenName");z("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");z("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");z("2.16.840.1.113730.1.1","nsCertType");z("2.16.840.1.113730.1.13","nsComment");Ge("2.5.29.1","authorityKeyIdentifier");Ge("2.5.29.2","keyAttributes");Ge("2.5.29.3","certificatePolicies");Ge("2.5.29.4","keyUsageRestriction");Ge("2.5.29.5","policyMapping");Ge("2.5.29.6","subtreesConstraint");Ge("2.5.29.7","subjectAltName");Ge("2.5.29.8","issuerAltName");Ge("2.5.29.9","subjectDirectoryAttributes");Ge("2.5.29.10","basicConstraints");Ge("2.5.29.11","nameConstraints");Ge("2.5.29.12","policyConstraints");Ge("2.5.29.13","basicConstraints");z("2.5.29.14","subjectKeyIdentifier");z("2.5.29.15","keyUsage");Ge("2.5.29.16","privateKeyUsagePeriod");z("2.5.29.17","subjectAltName");z("2.5.29.18","issuerAltName");z("2.5.29.19","basicConstraints");Ge("2.5.29.20","cRLNumber");Ge("2.5.29.21","cRLReason");Ge("2.5.29.22","expirationDate");Ge("2.5.29.23","instructionCode");Ge("2.5.29.24","invalidityDate");Ge("2.5.29.25","cRLDistributionPoints");Ge("2.5.29.26","issuingDistributionPoint");Ge("2.5.29.27","deltaCRLIndicator");Ge("2.5.29.28","issuingDistributionPoint");Ge("2.5.29.29","certificateIssuer");Ge("2.5.29.30","nameConstraints");z("2.5.29.31","cRLDistributionPoints");z("2.5.29.32","certificatePolicies");Ge("2.5.29.33","policyMappings");Ge("2.5.29.34","policyConstraints");z("2.5.29.35","authorityKeyIdentifier");Ge("2.5.29.36","policyConstraints");z("2.5.29.37","extKeyUsage");Ge("2.5.29.46","freshestCRL");Ge("2.5.29.54","inhibitAnyPolicy");z("1.3.6.1.4.1.11129.2.4.2","timestampList");z("1.3.6.1.5.5.7.1.1","authorityInfoAccess");z("1.3.6.1.5.5.7.3.1","serverAuth");z("1.3.6.1.5.5.7.3.2","clientAuth");z("1.3.6.1.5.5.7.3.3","codeSigning");z("1.3.6.1.5.5.7.3.4","emailProtection");z("1.3.6.1.5.5.7.3.8","timeStamping")});var _n=_((WX,_A)=>{var ot=ve();qe();Ui();var ee=_A.exports=ot.asn1=ot.asn1||{};ee.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};ee.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};ee.create=function(t,e,r,n,i){if(ot.util.isArray(n)){for(var s=[],o=0;oe){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}c(mc,"_checkBufferLength");var jV=c(function(t,e){var r=t.getByte();if(e--,r!==128){var n,i=r&128;if(!i)n=r;else{var s=r&127;mc(t,e,s),n=t.getInt(s<<3)}if(n<0)throw new Error("Negative length: "+n);return n}},"_getValueLength");ee.fromDer=function(t,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof t=="string"&&(t=ot.util.createBuffer(t));var r=t.length(),n=Vl(t,t.length(),0,e);if(e.parseAllBytes&&t.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=r,i.remaining=t.length(),i}return n};function Vl(t,e,r,n){var i;mc(t,e,2);var s=t.getByte();e--;var o=s&192,a=s&31;i=t.length();var u=jV(t,e);if(e-=i-t.length(),u!==void 0&&u>e){if(n.strict){var l=new Error("Too few bytes to read ASN.1 value.");throw l.available=t.length(),l.remaining=e,l.requested=u,l}u=e}var f,h,p=(s&32)===32;if(p)if(f=[],u===void 0)for(;;){if(mc(t,e,2),t.bytes(2)==="\0\0"){t.getBytes(2),e-=2;break}i=t.length(),f.push(Vl(t,e,r+1,n)),e-=i-t.length()}else for(;u>0;)i=t.length(),f.push(Vl(t,u,r+1,n)),e-=i-t.length(),u-=i-t.length();if(f===void 0&&o===ee.Class.UNIVERSAL&&a===ee.Type.BITSTRING&&(h=t.bytes(u)),f===void 0&&n.decodeBitStrings&&o===ee.Class.UNIVERSAL&&a===ee.Type.BITSTRING&&u>1){var g=t.read,d=e,y=0;if(a===ee.Type.BITSTRING&&(mc(t,e,1),y=t.getByte(),e--),y===0)try{i=t.length();var v={strict:!0,decodeBitStrings:!0},m=Vl(t,e,r+1,v),w=i-t.length();e-=w,a==ee.Type.BITSTRING&&w++;var x=m.tagClass;w===u&&(x===ee.Class.UNIVERSAL||x===ee.Class.CONTEXT_SPECIFIC)&&(f=[m])}catch{}f===void 0&&(t.read=g,e=d)}if(f===void 0){if(u===void 0){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");u=e}if(a===ee.Type.BMPSTRING)for(f="";u>0;u-=2)mc(t,e,2),f+=String.fromCharCode(t.getInt16()),e-=2;else f=t.getBytes(u),e-=u}var A=h===void 0?null:{bitStringContents:h};return ee.create(o,a,p,f,A)}c(Vl,"_fromDer");ee.toDer=function(t){var e=ot.util.createBuffer(),r=t.tagClass|t.type,n=ot.util.createBuffer(),i=!1;if("bitStringContents"in t&&(i=!0,t.original&&(i=ee.equals(t,t.original))),i)n.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:n.putByte(0);for(var s=0;s1&&(t.value.charCodeAt(0)===0&&!(t.value.charCodeAt(1)&128)||t.value.charCodeAt(0)===255&&(t.value.charCodeAt(1)&128)===128)?n.putBytes(t.value.substr(1)):n.putBytes(t.value);if(e.putByte(r),n.length()<=127)e.putByte(n.length()&127);else{var o=n.length(),a="";do a+=String.fromCharCode(o&255),o=o>>>8;while(o>0);e.putByte(a.length|128);for(var s=a.length-1;s>=0;--s)e.putByte(a.charCodeAt(s))}return e.putBuffer(n),e};ee.oidToDer=function(t){var e=t.split("."),r=ot.util.createBuffer();r.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var n,i,s,o,a=2;a>>7,n||(o|=128),i.push(o),n=!1;while(s>0);for(var u=i.length-1;u>=0;--u)r.putByte(i[u])}return r};ee.derToOid=function(t){var e;typeof t=="string"&&(t=ot.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var n=0;t.length()>0;)r=t.getByte(),n=n<<7,r&128?n+=r&127:(e+="."+(n+r),n=0);return e};ee.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,i=parseInt(t.substr(4,2),10),s=parseInt(t.substr(6,2),10),o=parseInt(t.substr(8,2),10),a=0;if(t.length>11){var u=t.charAt(10),l=10;u!=="+"&&u!=="-"&&(a=parseInt(t.substr(10,2),10),l+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(s,o,a,0),l&&(u=t.charAt(l),u==="+"||u==="-")){var f=parseInt(t.substr(l+1,2),10),h=parseInt(t.substr(l+4,2),10),p=f*60+h;p*=6e4,u==="+"?e.setTime(+e-p):e.setTime(+e+p)}return e};ee.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,i=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),o=parseInt(t.substr(10,2),10),a=parseInt(t.substr(12,2),10),u=0,l=0,f=!1;t.charAt(t.length-1)==="Z"&&(f=!0);var h=t.length-5,p=t.charAt(h);if(p==="+"||p==="-"){var g=parseInt(t.substr(h+1,2),10),d=parseInt(t.substr(h+4,2),10);l=g*60+d,l*=6e4,p==="+"&&(l*=-1),f=!0}return t.charAt(14)==="."&&(u=parseFloat(t.substr(14),10)*1e3),f?(e.setUTCFullYear(r,n,i),e.setUTCHours(s,o,a,u),e.setTime(+e+l)):(e.setFullYear(r,n,i),e.setHours(s,o,a,u)),e};ee.dateToUtcTime=function(t){if(typeof t=="string")return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r};ee.derToInteger=function(t){typeof t=="string"&&(t=ot.util.createBuffer(t));var e=t.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)};ee.validate=function(t,e,r,n){var i=!1;if((t.tagClass===e.tagClass||typeof e.tagClass>"u")&&(t.type===e.type||typeof e.type>"u"))if(t.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&ot.util.isArray(e.value))for(var s=0,o=0;i&&o0&&(n+=` +`);for(var i="",s=0;s1?n+="0x"+ot.util.bytesToHex(t.value.slice(1)):n+="(none)",t.value.length>0){var l=t.value.charCodeAt(0);l==1?n+=" (1 unused bit shown)":l>1&&(n+=" ("+l+" unused bits shown)")}}else if(t.type===ee.Type.OCTETSTRING)TA.test(t.value)||(n+="("+t.value+") "),n+="0x"+ot.util.bytesToHex(t.value);else if(t.type===ee.Type.UTF8)try{n+=ot.util.decodeUtf8(t.value)}catch(f){if(f.message==="URI malformed")n+="0x"+ot.util.bytesToHex(t.value)+" (malformed UTF8)";else throw f}else t.type===ee.Type.PRINTABLESTRING||t.type===ee.Type.IA5String?n+=t.value:TA.test(t.value)?n+="0x"+ot.util.bytesToHex(t.value):t.value.length===0?n+="[null]":n+=t.value}return n}});var Mn=_((YX,bA)=>{var Ml=ve();bA.exports=Ml.md=Ml.md||{};Ml.md.algorithms=Ml.md.algorithms||{}});var Ro=_((ZX,IA)=>{var ui=ve();Mn();qe();var zV=IA.exports=ui.hmac=ui.hmac||{};zV.create=function(){var t=null,e=null,r=null,n=null,i={};return i.start=function(s,o){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in ui.md.algorithms)e=ui.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(o===null)o=t;else{if(typeof o=="string")o=ui.util.createBuffer(o);else if(ui.util.isArray(o)){var a=o;o=ui.util.createBuffer();for(var u=0;ue.blockLength&&(e.start(),e.update(o.bytes()),o=e.digest()),r=ui.util.createBuffer(),n=ui.util.createBuffer(),l=o.length();for(var u=0;u{var Kn=ve();Mn();qe();var NA=RA.exports=Kn.md5=Kn.md5||{};Kn.md.md5=Kn.md.algorithms.md5=NA;NA.create=function(){BA||WV();var t=null,e=Kn.util.createBuffer(),r=new Array(16),n={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(i),AA(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=Kn.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Bv.substr(0,n.blockLength-o));for(var a,u=0,l=n.fullMessageLength.length-1;l>=0;--l)a=n.fullMessageLength[l]*8+u,u=a/4294967296>>>0,i.putInt32Le(a>>>0);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};AA(f,r,i);var h=Kn.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},n};var Bv=null,Kl=null,vc=null,Oo=null,BA=!1;function WV(){Bv="\x80",Bv+=Kn.util.fillString("\0",64),Kl=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],vc=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Oo=new Array(64);for(var t=0;t<64;++t)Oo[t]=Math.floor(Math.abs(Math.sin(t+1))*4294967296);BA=!0}c(WV,"_init");function AA(t,e,r){for(var n,i,s,o,a,u,l,f,h=r.length();h>=64;){for(i=t.h0,s=t.h1,o=t.h2,a=t.h3,f=0;f<16;++f)e[f]=r.getInt32Le(),u=a^s&(o^a),n=i+u+Oo[f]+e[f],l=vc[f],i=a,a=o,o=s,s+=n<>>32-l;for(;f<32;++f)u=o^a&(s^o),n=i+u+Oo[f]+e[Kl[f]],l=vc[f],i=a,a=o,o=s,s+=n<>>32-l;for(;f<48;++f)u=s^o^a,n=i+u+Oo[f]+e[Kl[f]],l=vc[f],i=a,a=o,o=s,s+=n<>>32-l;for(;f<64;++f)u=o^(s|~a),n=i+u+Oo[f]+e[Kl[f]],l=vc[f],i=a,a=o,o=s,s+=n<>>32-l;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+o|0,t.h3=t.h3+a|0,h-=64}}c(AA,"_update")});var Ds=_((eJ,DA)=>{var Gl=ve();qe();var OA=DA.exports=Gl.pem=Gl.pem||{};OA.encode=function(t,e){e=e||{};var r="-----BEGIN "+t.type+`-----\r +`,n;if(t.procType&&(n={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]},r+=$l(n)),t.contentDomain&&(n={name:"Content-Domain",values:[t.contentDomain]},r+=$l(n)),t.dekInfo&&(n={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&n.values.push(t.dekInfo.parameters),r+=$l(n)),t.headers)for(var i=0;i65&&o!==-1){var a=e[o];a===","?(++o,e=e.substr(0,o)+`\r + `+e.substr(o)):e=e.substr(0,o)+`\r +`+a+e.substr(o+1),s=i-o-1,o=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(o=i);return e}c($l,"foldHeader");function QV(t){return t.replace(/^\s+/,"")}c(QV,"ltrim")});var Ec=_((rJ,LA)=>{var ut=ve();kl();_v();qe();LA.exports=ut.des=ut.des||{};ut.des.startEncrypting=function(t,e,r,n){var i=jl({key:t,output:r,decrypt:!1,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};ut.des.createEncryptionCipher=function(t,e){return jl({key:t,output:null,decrypt:!1,mode:e})};ut.des.startDecrypting=function(t,e,r,n){var i=jl({key:t,output:r,decrypt:!0,mode:n||(e===null?"ECB":"CBC")});return i.start(e),i};ut.des.createDecryptionCipher=function(t,e){return jl({key:t,output:null,decrypt:!0,mode:e})};ut.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(n,i){return PA(r._keys,n,i,!1)},decrypt:function(n,i){return PA(r._keys,n,i,!0)}}}),r._init=!1};ut.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=ut.util.createBuffer(t.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=iM(e),this._init=!0}};Hn("DES-ECB",ut.cipher.modes.ecb);Hn("DES-CBC",ut.cipher.modes.cbc);Hn("DES-CFB",ut.cipher.modes.cfb);Hn("DES-OFB",ut.cipher.modes.ofb);Hn("DES-CTR",ut.cipher.modes.ctr);Hn("3DES-ECB",ut.cipher.modes.ecb);Hn("3DES-CBC",ut.cipher.modes.cbc);Hn("3DES-CFB",ut.cipher.modes.cfb);Hn("3DES-OFB",ut.cipher.modes.ofb);Hn("3DES-CTR",ut.cipher.modes.ctr);function Hn(t,e){var r=c(function(){return new ut.des.Algorithm(t,e)},"factory");ut.cipher.registerAlgorithm(t,r)}c(Hn,"registerAlgorithm");var YV=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],ZV=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],XV=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],JV=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],eM=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],tM=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],rM=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],nM=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function iM(t){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],r=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],a=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],f=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],h=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],g=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],d=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=t.length()>8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],w=0,x,A=0;A>>4^L)&252645135,L^=x,O^=x<<4,x=(L>>>-16^O)&65535,O^=x,L^=x<<-16,x=(O>>>2^L)&858993459,L^=x,O^=x<<2,x=(L>>>-16^O)&65535,O^=x,L^=x<<-16,x=(O>>>1^L)&1431655765,L^=x,O^=x<<1,x=(L>>>8^O)&16711935,O^=x,L^=x<<8,x=(O>>>1^L)&1431655765,L^=x,O^=x<<1,x=O<<8|L>>>20&240,O=L<<24|L<<8&16711680|L>>>8&65280|L>>>24&240,L=x;for(var j=0;j>>26,L=L<<2|L>>>26):(O=O<<1|O>>>27,L=L<<1|L>>>27),O&=-15,L&=-15;var Y=e[O>>>28]|r[O>>>24&15]|n[O>>>20&15]|i[O>>>16&15]|s[O>>>12&15]|o[O>>>8&15]|a[O>>>4&15],se=u[L>>>28]|l[L>>>24&15]|f[L>>>20&15]|h[L>>>16&15]|p[L>>>12&15]|g[L>>>8&15]|d[L>>>4&15];x=(se>>>16^Y)&65535,v[w++]=Y^x,v[w++]=se^x<<16}}return v}c(iM,"_createKeys");function PA(t,e,r,n){var i=t.length===32?3:9,s;i===3?s=n?[30,-2,-2]:[0,32,2]:s=n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var o,a=e[0],u=e[1];o=(a>>>4^u)&252645135,u^=o,a^=o<<4,o=(a>>>16^u)&65535,u^=o,a^=o<<16,o=(u>>>2^a)&858993459,a^=o,u^=o<<2,o=(u>>>8^a)&16711935,a^=o,u^=o<<8,o=(a>>>1^u)&1431655765,u^=o,a^=o<<1,a=a<<1|a>>>31,u=u<<1|u>>>31;for(var l=0;l>>4|u<<28)^t[p+1];o=a,a=u,u=o^(ZV[g>>>24&63]|JV[g>>>16&63]|tM[g>>>8&63]|nM[g&63]|YV[d>>>24&63]|XV[d>>>16&63]|eM[d>>>8&63]|rM[d&63])}o=a,a=u,u=o}a=a>>>1|a<<31,u=u>>>1|u<<31,o=(a>>>1^u)&1431655765,u^=o,a^=o<<1,o=(u>>>8^a)&16711935,a^=o,u^=o<<8,o=(u>>>2^a)&858993459,a^=o,u^=o<<2,o=(a>>>16^u)&65535,u^=o,a^=o<<16,o=(a>>>4^u)&252645135,u^=o,a^=o<<4,r[0]=a,r[1]=u}c(PA,"_updateBlock");function jl(t){t=t||{};var e=(t.mode||"CBC").toUpperCase(),r="DES-"+e,n;t.decrypt?n=ut.cipher.createDecipher(r,t.key):n=ut.cipher.createCipher(r,t.key);var i=n.start;return n.start=function(s,o){var a=null;o instanceof ut.util.ByteBuffer&&(a=o,o={}),o=o||{},o.output=a,o.iv=s,i.call(n,o)},n}c(jl,"_createCipher")});var zl=_((iJ,kA)=>{var Er=ve();Ro();Mn();qe();var sM=Er.pkcs5=Er.pkcs5||{},li;Er.util.isNodejs&&!Er.options.usePureJavaScript&&(li=require("crypto"));kA.exports=Er.pbkdf2=sM.pbkdf2=function(t,e,r,n,i,s){if(typeof i=="function"&&(s=i,i=null),Er.util.isNodejs&&!Er.options.usePureJavaScript&&li.pbkdf2&&(i===null||typeof i!="object")&&(li.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),t=Buffer.from(t,"binary"),e=Buffer.from(e,"binary"),s?li.pbkdf2Sync.length===4?li.pbkdf2(t,e,r,n,function(x,A){if(x)return s(x);s(null,A.toString("binary"))}):li.pbkdf2(t,e,r,n,i,function(x,A){if(x)return s(x);s(null,A.toString("binary"))}):li.pbkdf2Sync.length===4?li.pbkdf2Sync(t,e,r,n).toString("binary"):li.pbkdf2Sync(t,e,r,n,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in Er.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=Er.md[i].create()}var o=i.digestLength;if(n>4294967295*o){var a=new Error("Derived key is too long.");if(s)return s(a);throw a}var u=Math.ceil(n/o),l=n-(u-1)*o,f=Er.hmac.create();f.start(i,t);var h="",p,g,d;if(!s){for(var y=1;y<=u;++y){f.start(null,null),f.update(e),f.update(Er.util.int32ToBytes(y)),p=d=f.digest().getBytes();for(var v=2;v<=r;++v)f.start(null,null),f.update(d),g=f.digest().getBytes(),p=Er.util.xorBytes(p,g,o),d=g;h+=yu)return s(null,h);f.start(null,null),f.update(e),f.update(Er.util.int32ToBytes(y)),p=d=f.digest().getBytes(),v=2,w()}c(m,"outer");function w(){if(v<=r)return f.start(null,null),f.update(d),g=f.digest().getBytes(),p=Er.util.xorBytes(p,g,o),d=g,++v,Er.util.setImmediate(w);h+=y{var $n=ve();Mn();qe();var qA=MA.exports=$n.sha256=$n.sha256||{};$n.md.sha256=$n.md.algorithms.sha256=qA;qA.create=function(){UA||oM();var t=null,e=$n.util.createBuffer(),r=new Array(64),n={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(i),FA(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=$n.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Rv.substr(0,n.blockLength-o));for(var a,u,l=n.fullMessageLength[0]*8,f=0;f>>0,l+=u,i.putInt32(l>>>0),l=a>>>0;i.putInt32(l);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};FA(h,r,i);var p=$n.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},n};var Rv=null,UA=!1,VA=null;function oM(){Rv="\x80",Rv+=$n.util.fillString("\0",64),VA=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],UA=!0}c(oM,"_init");function FA(t,e,r){for(var n,i,s,o,a,u,l,f,h,p,g,d,y,v,m,w=r.length();w>=64;){for(l=0;l<16;++l)e[l]=r.getInt32();for(;l<64;++l)n=e[l-2],n=(n>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=e[l-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[l]=n+e[l-7]+i+e[l-16]|0;for(f=t.h0,h=t.h1,p=t.h2,g=t.h3,d=t.h4,y=t.h5,v=t.h6,m=t.h7,l=0;l<64;++l)o=(d>>>6|d<<26)^(d>>>11|d<<21)^(d>>>25|d<<7),a=v^d&(y^v),s=(f>>>2|f<<30)^(f>>>13|f<<19)^(f>>>22|f<<10),u=f&h|p&(f^h),n=m+o+a+VA[l]+e[l],i=s+u,m=v,v=y,y=d,d=g+n>>>0,g=p,p=h,h=f,f=n+i>>>0;t.h0=t.h0+f|0,t.h1=t.h1+h|0,t.h2=t.h2+p|0,t.h3=t.h3+g|0,t.h4=t.h4+d|0,t.h5=t.h5+y|0,t.h6=t.h6+v|0,t.h7=t.h7+m|0,w-=64}}c(FA,"_update")});var Dv=_((cJ,KA)=>{var Gn=ve();qe();var Wl=null;Gn.util.isNodejs&&!Gn.options.usePureJavaScript&&!process.versions["node-webkit"]&&(Wl=require("crypto"));var aM=KA.exports=Gn.prng=Gn.prng||{};aM.create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,n=new Array(32),i=0;i<32;++i)n[i]=r.create();e.pools=n,e.pool=0,e.generate=function(l,f){if(!f)return e.generateSync(l);var h=e.plugin.cipher,p=e.plugin.increment,g=e.plugin.formatKey,d=e.plugin.formatSeed,y=Gn.util.createBuffer();e.key=null,v();function v(m){if(m)return f(m);if(y.length()>=l)return f(null,y.getBytes(l));if(e.generated>1048575&&(e.key=null),e.key===null)return Gn.util.nextTick(function(){s(v)});var w=h(e.key,e.seed);e.generated+=w.length,y.putBytes(w),e.key=g(h(e.key,p(e.seed))),e.seed=d(h(e.key,e.seed)),Gn.util.setImmediate(v)}c(v,"generate")},e.generateSync=function(l){var f=e.plugin.cipher,h=e.plugin.increment,p=e.plugin.formatKey,g=e.plugin.formatSeed;e.key=null;for(var d=Gn.util.createBuffer();d.length()1048575&&(e.key=null),e.key===null&&o();var y=f(e.key,e.seed);e.generated+=y.length,d.putBytes(y),e.key=p(f(e.key,h(e.seed))),e.seed=g(f(e.key,e.seed))}return d.getBytes(l)};function s(l){if(e.pools[0].messageLength>=32)return a(),l();var f=32-e.pools[0].messageLength<<5;e.seedFile(f,function(h,p){if(h)return l(h);e.collect(p),a(),l()})}c(s,"_reseed");function o(){if(e.pools[0].messageLength>=32)return a();var l=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(l)),a()}c(o,"_reseedSync");function a(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var l=e.plugin.md.create();l.update(e.keyBytes);for(var f=1,h=0;h<32;++h)e.reseeds%f===0&&(l.update(e.pools[h].digest().getBytes()),e.pools[h].start()),f=f<<1;e.keyBytes=l.digest().getBytes(),l.start(),l.update(e.keyBytes);var p=l.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(p),e.generated=0}c(a,"_seed");function u(l){var f=null,h=Gn.util.globalScope,p=h.crypto||h.msCrypto;p&&p.getRandomValues&&(f=c(function(O){return p.getRandomValues(O)},"getRandomValues"));var g=Gn.util.createBuffer();if(f)for(;g.length()>16),w+=(m&32767)<<16,w+=m>>15,w=(w&2147483647)+(w>>31),A=w&4294967295;for(var v=0;v<3;++v)x=A>>>(v<<3),x^=Math.floor(Math.random()*256),g.putByte(x&255)}return g.getBytes(l)}return c(u,"defaultSeedFile"),Wl?(e.seedFile=function(l,f){Wl.randomBytes(l,function(h,p){if(h)return f(h);f(null,p.toString())})},e.seedFileSync=function(l){return Wl.randomBytes(l).toString()}):(e.seedFile=function(l,f){try{f(null,u(l))}catch(h){f(h)}},e.seedFileSync=u),e.collect=function(l){for(var f=l.length,h=0;h>p&255);e.collect(h)},e.registerWorker=function(l){if(l===self)e.seedFile=function(h,p){function g(d){var y=d.data;y.forge&&y.forge.prng&&(self.removeEventListener("message",g),p(y.forge.prng.err,y.forge.prng.bytes))}c(g,"listener"),self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:h}}})};else{var f=c(function(h){var p=h.data;p.forge&&p.forge.prng&&e.seedFile(p.forge.prng.needed,function(g,d){l.postMessage({forge:{prng:{err:g,bytes:d}}})})},"listener");l.addEventListener("message",f)}},e}});var nn=_((lJ,Pv)=>{var zt=ve();qi();Ov();Dv();qe();(function(){if(zt.random&&zt.random.getBytes){Pv.exports=zt.random;return}(function(t){var e={},r=new Array(4),n=zt.util.createBuffer();e.formatKey=function(h){var p=zt.util.createBuffer(h);return h=new Array(4),h[0]=p.getInt32(),h[1]=p.getInt32(),h[2]=p.getInt32(),h[3]=p.getInt32(),zt.aes._expandKey(h,!1)},e.formatSeed=function(h){var p=zt.util.createBuffer(h);return h=new Array(4),h[0]=p.getInt32(),h[1]=p.getInt32(),h[2]=p.getInt32(),h[3]=p.getInt32(),h},e.cipher=function(h,p){return zt.aes._updateBlock(h,p,r,!1),n.putInt32(r[0]),n.putInt32(r[1]),n.putInt32(r[2]),n.putInt32(r[3]),n.getBytes()},e.increment=function(h){return++h[3],h},e.md=zt.md.sha256;function i(){var h=zt.prng.create(e);return h.getBytes=function(p,g){return h.generate(p,g)},h.getBytesSync=function(p){return h.generate(p)},h}c(i,"spawnPrng");var s=i(),o=null,a=zt.util.globalScope,u=a.crypto||a.msCrypto;if(u&&u.getRandomValues&&(o=c(function(h){return u.getRandomValues(h)},"getRandomValues")),zt.options.usePureJavaScript||!zt.util.isNodejs&&!o){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var l="";for(var f in navigator)try{typeof navigator[f]=="string"&&(l+=navigator[f])}catch{}s.collect(l),l=null}t&&(t().mousemove(function(h){s.collectInt(h.clientX,16),s.collectInt(h.clientY,16)}),t().keypress(function(h){s.collectInt(h.charCode,8)}))}if(!zt.random)zt.random=s;else for(var f in s)zt.random[f]=s[f];zt.random.createInstance=i,Pv.exports=zt.random})(typeof jQuery<"u"?jQuery:null)})()});var kv=_((hJ,GA)=>{var Pr=ve();qe();var Lv=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],HA=[1,2,3,5],cM=c(function(t,e){return t<>16-e},"rol"),uM=c(function(t,e){return(t&65535)>>e|t<<16-e&65535},"ror");GA.exports=Pr.rc2=Pr.rc2||{};Pr.rc2.expandKey=function(t,e){typeof t=="string"&&(t=Pr.util.createBuffer(t)),e=e||128;var r=t,n=t.length(),i=e,s=Math.ceil(i/8),o=255>>(i&7),a;for(a=n;a<128;a++)r.putByte(Lv[r.at(a-1)+r.at(a-n)&255]);for(r.setAt(128-s,Lv[r.at(128-s)&o]),a=127-s;a>=0;a--)r.setAt(a,Lv[r.at(a+1)^r.at(a+s)]);return r};var $A=c(function(t,e,r){var n=!1,i=null,s=null,o=null,a,u,l,f,h=[];for(t=Pr.rc2.expandKey(t,e),l=0;l<64;l++)h.push(t.getInt16Le());r?(a=c(function(d){for(l=0;l<4;l++)d[l]+=h[f]+(d[(l+3)%4]&d[(l+2)%4])+(~d[(l+3)%4]&d[(l+1)%4]),d[l]=cM(d[l],HA[l]),f++},"mixRound"),u=c(function(d){for(l=0;l<4;l++)d[l]+=h[d[(l+3)%4]&63]},"mashRound")):(a=c(function(d){for(l=3;l>=0;l--)d[l]=uM(d[l],HA[l]),d[l]-=h[f]+(d[(l+3)%4]&d[(l+2)%4])+(~d[(l+3)%4]&d[(l+1)%4]),f--},"mixRound"),u=c(function(d){for(l=3;l>=0;l--)d[l]-=h[d[(l+3)%4]&63]},"mashRound"));var p=c(function(d){var y=[];for(l=0;l<4;l++){var v=i.getInt16Le();o!==null&&(r?v^=o.getInt16Le():o.putInt16Le(v)),y.push(v&65535)}f=r?0:63;for(var m=0;m=8;)p([[5,a],[1,u],[6,a],[1,u],[5,a]])},finish:function(d){var y=!0;if(r)if(d)y=d(8,i,!r);else{var v=i.length()===8?8:8-i.length();i.fillWithByte(v,v)}if(y&&(n=!0,g.update()),!r&&(y=i.length()===0,y))if(d)y=d(8,s,!r);else{var m=s.length(),w=s.at(m-1);w>m?y=!1:s.truncate(w)}return y}},g},"createCipher");Pr.rc2.startEncrypting=function(t,e,r){var n=Pr.rc2.createEncryptionCipher(t,128);return n.start(e,r),n};Pr.rc2.createEncryptionCipher=function(t,e){return $A(t,e,!0)};Pr.rc2.startDecrypting=function(t,e,r){var n=Pr.rc2.createDecryptionCipher(t,128);return n.start(e,r),n};Pr.rc2.createDecryptionCipher=function(t,e){return $A(t,e,!1)}});var Cc=_((pJ,JA)=>{var Fv=ve();JA.exports=Fv.jsbn=Fv.jsbn||{};var fi,lM=0xdeadbeefcafe,jA=(lM&16777215)==15715070;function K(t,e,r){this.data=[],t!=null&&(typeof t=="number"?this.fromNumber(t,e,r):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}c(K,"BigInteger");Fv.jsbn.BigInteger=K;function Ue(){return new K(null)}c(Ue,"nbi");function fM(t,e,r,n,i,s){for(;--s>=0;){var o=e*this.data[t++]+r.data[n]+i;i=Math.floor(o/67108864),r.data[n++]=o&67108863}return i}c(fM,"am1");function hM(t,e,r,n,i,s){for(var o=e&32767,a=e>>15;--s>=0;){var u=this.data[t]&32767,l=this.data[t++]>>15,f=a*u+l*o;u=o*u+((f&32767)<<15)+r.data[n]+(i&1073741823),i=(u>>>30)+(f>>>15)+a*l+(i>>>30),r.data[n++]=u&1073741823}return i}c(hM,"am2");function zA(t,e,r,n,i,s){for(var o=e&16383,a=e>>14;--s>=0;){var u=this.data[t]&16383,l=this.data[t++]>>14,f=a*u+l*o;u=o*u+((f&16383)<<14)+r.data[n]+i,i=(u>>28)+(f>>14)+a*l,r.data[n++]=u&268435455}return i}c(zA,"am3");typeof navigator>"u"?(K.prototype.am=zA,fi=28):jA&&navigator.appName=="Microsoft Internet Explorer"?(K.prototype.am=hM,fi=30):jA&&navigator.appName!="Netscape"?(K.prototype.am=fM,fi=26):(K.prototype.am=zA,fi=28);K.prototype.DB=fi;K.prototype.DM=(1<=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s}c(pM,"bnpCopyTo");function gM(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0}c(gM,"bnpFromInt");function Vi(t){var e=Ue();return e.fromInt(t),e}c(Vi,"nbv");function yM(t,e){var r;if(e==16)r=4;else if(e==8)r=3;else if(e==256)r=8;else if(e==2)r=1;else if(e==32)r=5;else if(e==4)r=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var o=r==8?t[n]&255:QA(t,n);if(o<0){t.charAt(n)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB)}r==8&&t[0]&128&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t}c(mM,"bnpClamp");function vM(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<0)for(a>a)>0&&(i=!0,s=WA(n));o>=0;)a>(a+=this.DB-e)):(n=this.data[o]>>(a-=e)&r,a<=0&&(a+=this.DB,--o)),n>0&&(i=!0),i&&(s+=WA(n));return i?s:"0"}c(vM,"bnToString");function EM(){var t=Ue();return K.ZERO.subTo(this,t),t}c(EM,"bnNegate");function SM(){return this.s<0?this.negate():this}c(SM,"bnAbs");function CM(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this.data[r]-t.data[r])!=0)return e;return 0}c(CM,"bnCompareTo");function Yl(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}c(Yl,"nbits");function wM(){return this.t<=0?0:this.DB*(this.t-1)+Yl(this.data[this.t-1]^this.s&this.DM)}c(wM,"bnBitLength");function xM(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s}c(xM,"bnpDLShiftTo");function TM(t,e){for(var r=t;r=0;--a)e.data[a+s+1]=this.data[a]>>n|o,o=(this.data[a]&i)<=0;--a)e.data[a]=0;e.data[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}c(_M,"bnpLShiftTo");function bM(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(e.data[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()}c(IM,"bnpSubTo");function AM(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e.data[i]=0;for(i=0;i=0;)t.data[r]=0;for(r=0;r=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()}c(NM,"bnpSquareTo");function BM(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var l=s.t,f=s.data[l-1];if(f!=0){var h=f*(1<1?s.data[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(m,r)),K.ONE.dlShiftTo(l,m),m.subTo(s,s);s.t=0;){var w=r.data[--y]==f?this.DM:Math.floor(r.data[y]*p+(r.data[y-1]+d)*g);if((r.data[y]+=s.am(0,w,r,v,0,l))0&&r.rShiftTo(u,r),o<0&&K.ZERO.subTo(r,r)}}}c(BM,"bnpDivRemTo");function RM(t){var e=Ue();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(K.ZERO)>0&&t.subTo(e,e),e}c(RM,"bnMod");function Ps(t){this.m=t}c(Ps,"Classic");function OM(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}c(OM,"cConvert");function DM(t){return t}c(DM,"cRevert");function PM(t){t.divRemTo(this.m,null,t)}c(PM,"cReduce");function LM(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(LM,"cMulTo");function kM(t,e){t.squareTo(e),this.reduce(e)}c(kM,"cSqrTo");Ps.prototype.convert=OM;Ps.prototype.revert=DM;Ps.prototype.reduce=PM;Ps.prototype.mulTo=LM;Ps.prototype.sqrTo=kM;function FM(){if(this.t<1)return 0;var t=this.data[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}c(FM,"bnpInvDigit");function Ls(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}c(qM,"montConvert");function UM(t){var e=Ue();return t.copyTo(e),this.reduce(e),e}c(UM,"montRevert");function VM(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}c(VM,"montReduce");function MM(t,e){t.squareTo(e),this.reduce(e)}c(MM,"montSqrTo");function KM(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(KM,"montMulTo");Ls.prototype.convert=qM;Ls.prototype.revert=UM;Ls.prototype.reduce=VM;Ls.prototype.mulTo=KM;Ls.prototype.sqrTo=MM;function HM(){return(this.t>0?this.data[0]&1:this.s)==0}c(HM,"bnpIsEven");function $M(t,e){if(t>4294967295||t<1)return K.ONE;var r=Ue(),n=Ue(),i=e.convert(this),s=Yl(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var o=r;r=n,n=o}return e.revert(r)}c($M,"bnpExp");function GM(t,e){var r;return t<256||e.isEven()?r=new Ps(e):r=new Ls(e),this.exp(t,r)}c(GM,"bnModPowInt");K.prototype.copyTo=pM;K.prototype.fromInt=gM;K.prototype.fromString=yM;K.prototype.clamp=mM;K.prototype.dlShiftTo=xM;K.prototype.drShiftTo=TM;K.prototype.lShiftTo=_M;K.prototype.rShiftTo=bM;K.prototype.subTo=IM;K.prototype.multiplyTo=AM;K.prototype.squareTo=NM;K.prototype.divRemTo=BM;K.prototype.invDigit=FM;K.prototype.isEven=HM;K.prototype.exp=$M;K.prototype.toString=vM;K.prototype.negate=EM;K.prototype.abs=SM;K.prototype.compareTo=CM;K.prototype.bitLength=wM;K.prototype.mod=RM;K.prototype.modPowInt=GM;K.ZERO=Vi(0);K.ONE=Vi(1);function jM(){var t=Ue();return this.copyTo(t),t}c(jM,"bnClone");function zM(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}c(WM,"bnByteValue");function QM(){return this.t==0?this.s:this.data[0]<<16>>16}c(QM,"bnShortValue");function YM(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}c(YM,"bnpChunkSize");function ZM(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}c(ZM,"bnSigNum");function XM(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=Vi(r),i=Ue(),s=Ue(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o}c(XM,"bnpToRadix");function JM(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,o=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),i&&K.ZERO.subTo(this,this)}c(JM,"bnpFromRadix");function eK(t,e,r){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(K.ONE.shiftLeft(t-1),Uv,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(K.ONE.shiftLeft(t-1),this);else{var n=new Array,i=t&7;n.length=(t>>3)+1,e.nextBytes(n),i>0?n[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<=0;)r<8?(n=(this.data[t]&(1<>(r+=this.DB-8)):(n=this.data[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i==0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}c(tK,"bnToByteArray");function rK(t){return this.compareTo(t)==0}c(rK,"bnEquals");function nK(t){return this.compareTo(t)<0?this:t}c(nK,"bnMin");function iK(t){return this.compareTo(t)>0?this:t}c(iK,"bnMax");function sK(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}c(pK,"lbit");function gK(){for(var t=0;t=this.t?this.s!=0:(this.data[e]&1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()}c(xK,"bnpAddTo");function TK(t){var e=Ue();return this.addTo(t,e),e}c(TK,"bnAdd");function _K(t){var e=Ue();return this.subTo(t,e),e}c(_K,"bnSubtract");function bK(t){var e=Ue();return this.multiplyTo(t,e),e}c(bK,"bnMultiply");function IK(t){var e=Ue();return this.divRemTo(t,e,null),e}c(IK,"bnDivide");function AK(t){var e=Ue();return this.divRemTo(t,null,e),e}c(AK,"bnRemainder");function NK(t){var e=Ue(),r=Ue();return this.divRemTo(t,e,r),new Array(e,r)}c(NK,"bnDivideAndRemainder");function BK(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}c(BK,"bnpDMultiply");function RK(t,e){if(t!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}c(RK,"bnpDAddOffset");function Sc(){}c(Sc,"NullExp");function XA(t){return t}c(XA,"nNop");function OK(t,e,r){t.multiplyTo(e,r)}c(OK,"nMulTo");function DK(t,e){t.squareTo(e)}c(DK,"nSqrTo");Sc.prototype.convert=XA;Sc.prototype.revert=XA;Sc.prototype.mulTo=OK;Sc.prototype.sqrTo=DK;function PK(t){return this.exp(t,new Sc)}c(PK,"bnPow");function LK(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;var i;for(i=r.t-this.t;n=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=Ue();return t.copyTo(e),this.reduce(e),e}c(FK,"barrettConvert");function qK(t){return t}c(qK,"barrettRevert");function UK(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}c(UK,"barrettReduce");function VK(t,e){t.squareTo(e),this.reduce(e)}c(VK,"barrettSqrTo");function MK(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(MK,"barrettMulTo");Po.prototype.convert=FK;Po.prototype.revert=qK;Po.prototype.reduce=UK;Po.prototype.mulTo=MK;Po.prototype.sqrTo=VK;function KK(t,e){var r=t.bitLength(),n,i=Vi(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new Ps(e):e.isEven()?s=new Po(e):s=new Ls(e);var o=new Array,a=3,u=n-1,l=(1<1){var f=Ue();for(s.sqrTo(o[1],f);a<=l;)o[a]=Ue(),s.mulTo(f,o[a-2],o[a]),a+=2}var h=t.t-1,p,g=!0,d=Ue(),y;for(r=Yl(t.data[h])-1;h>=0;){for(r>=u?p=t.data[h]>>r-u&l:(p=(t.data[h]&(1<0&&(p|=t.data[h-1]>>this.DB+r-u)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),g)o[p].copyTo(i),g=!1;else{for(;a>1;)s.sqrTo(i,d),s.sqrTo(d,i),a-=2;a>0?s.sqrTo(i,d):(y=i,i=d,d=y),s.mulTo(d,o[p],i)}for(;h>=0&&!(t.data[h]&1<0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}c(HK,"bnGCD");function $K(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e==0)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r}c($K,"bnpModInt");function GK(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return K.ZERO;for(var r=t.clone(),n=this.clone(),i=Vi(1),s=Vi(0),o=Vi(0),a=Vi(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(o,i),s.subTo(a,s)):(n.subTo(r,n),e&&o.subTo(i,o),a.subTo(s,a))}if(n.compareTo(K.ONE)!=0)return K.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}c(GK,"bnModInverse");var bn=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],jK=(1<<26)/bn[bn.length-1];function zK(t){var e,r=this.abs();if(r.t==1&&r.data[0]<=bn[bn.length-1]){for(e=0;e=0);var a=s.modPow(n,this);if(a.compareTo(K.ONE)!=0&&a.compareTo(e)!=0){for(var u=1;u++{var jn=ve();Mn();qe();var t2=n2.exports=jn.sha1=jn.sha1||{};jn.md.sha1=jn.md.algorithms.sha1=t2;t2.create=function(){r2||YK();var t=null,e=jn.util.createBuffer(),r=new Array(80),n={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return n.start=function(){n.messageLength=0,n.fullMessageLength=n.messageLength64=[];for(var i=n.messageLengthSize/4,s=0;s>>0,o>>>0];for(var a=n.fullMessageLength.length-1;a>=0;--a)n.fullMessageLength[a]+=o[1],o[1]=o[0]+(n.fullMessageLength[a]/4294967296>>>0),n.fullMessageLength[a]=n.fullMessageLength[a]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(i),e2(t,r,e),(e.read>2048||e.length()===0)&&e.compact(),n},n.digest=function(){var i=jn.util.createBuffer();i.putBytes(e.bytes());var s=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize,o=s&n.blockLength-1;i.putBytes(Vv.substr(0,n.blockLength-o));for(var a,u,l=n.fullMessageLength[0]*8,f=0;f>>0,l+=u,i.putInt32(l>>>0),l=a>>>0;i.putInt32(l);var h={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};e2(h,r,i);var p=jn.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p},n};var Vv=null,r2=!1;function YK(){Vv="\x80",Vv+=jn.util.fillString("\0",64),r2=!0}c(YK,"_init");function e2(t,e,r){for(var n,i,s,o,a,u,l,f,h=r.length();h>=64;){for(i=t.h0,s=t.h1,o=t.h2,a=t.h3,u=t.h4,f=0;f<16;++f)n=r.getInt32(),e[f]=n,l=a^s&(o^a),n=(i<<5|i>>>27)+l+u+1518500249+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;f<20;++f)n=e[f-3]^e[f-8]^e[f-14]^e[f-16],n=n<<1|n>>>31,e[f]=n,l=a^s&(o^a),n=(i<<5|i>>>27)+l+u+1518500249+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;f<32;++f)n=e[f-3]^e[f-8]^e[f-14]^e[f-16],n=n<<1|n>>>31,e[f]=n,l=s^o^a,n=(i<<5|i>>>27)+l+u+1859775393+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;f<40;++f)n=e[f-6]^e[f-16]^e[f-28]^e[f-32],n=n<<2|n>>>30,e[f]=n,l=s^o^a,n=(i<<5|i>>>27)+l+u+1859775393+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;f<60;++f)n=e[f-6]^e[f-16]^e[f-28]^e[f-32],n=n<<2|n>>>30,e[f]=n,l=s&o|a&(s^o),n=(i<<5|i>>>27)+l+u+2400959708+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;for(;f<80;++f)n=e[f-6]^e[f-16]^e[f-28]^e[f-32],n=n<<2|n>>>30,e[f]=n,l=s^o^a,n=(i<<5|i>>>27)+l+u+3395469782+n,u=a,a=o,o=(s<<30|s>>>2)>>>0,s=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+o|0,t.h3=t.h3+a|0,t.h4=t.h4+u|0,h-=64}}c(e2,"_update")});var Mv=_((vJ,s2)=>{var zn=ve();qe();nn();Lo();var i2=s2.exports=zn.pkcs1=zn.pkcs1||{};i2.encode_rsa_oaep=function(t,e,r){var n,i,s,o;typeof r=="string"?(n=r,i=arguments[3]||void 0,s=arguments[4]||void 0):r&&(n=r.label||void 0,i=r.seed||void 0,s=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md)),s?s.start():s=zn.md.sha1.create(),o||(o=s);var a=Math.ceil(t.n.bitLength()/8),u=a-2*s.digestLength-2;if(e.length>u){var l=new Error("RSAES-OAEP input message length is too long.");throw l.length=e.length,l.maxLength=u,l}n||(n=""),s.update(n,"raw");for(var f=s.digest(),h="",p=u-e.length,g=0;g>24&255,s>>16&255,s>>8&255,s&255);r.start(),r.update(t+o),n+=r.digest().getBytes()}return n.substring(0,e)}c(Zl,"rsa_mgf1")});var Hv=_((SJ,Kv)=>{var Mi=ve();qe();Cc();nn();(function(){if(Mi.prime){Kv.exports=Mi.prime;return}var t=Kv.exports=Mi.prime=Mi.prime||{},e=Mi.jsbn.BigInteger,r=[6,4,2,4,2,4,6,2],n=new e(null);n.fromInt(30);var i=c(function(h,p){return h|p},"op_or");t.generateProbablePrime=function(h,p,g){typeof p=="function"&&(g=p,p={}),p=p||{};var d=p.algorithm||"PRIMEINC";typeof d=="string"&&(d={name:d}),d.options=d.options||{};var y=p.prng||Mi.random,v={nextBytes:function(m){for(var w=y.getBytesSync(m.length),x=0;xp&&(h=l(p,g)),h.isProbablePrime(y))return m(null,h);h.dAddOffset(r[d++%8],0)}while(v<0||+new Date-w"u")return o(h,p,g,d);var y=l(h,p),v=g.workers,m=g.workLoad||100,w=m*30/8,x=g.workerScript||"forge/prime.worker.js";if(v===-1)return Mi.util.estimateCores(function(O,L){O&&(L=2),v=L-1,A()});A();function A(){v=Math.max(1,v);for(var O=[],L=0;Lh&&(y=l(h,p));var q=y.toString(16);re.target.postMessage({hex:q,workLoad:m}),y.dAddOffset(w,0)}}c(se,"workerMessage")}c(A,"generate")}c(u,"primeincFindPrimeWithWorkers");function l(h,p){var g=new e(h,p),d=h-1;return g.testBit(d)||g.bitwiseTo(e.ONE.shiftLeft(d),i,g),g.dAddOffset(31-g.mod(n).byteValue(),0),g}c(l,"generateRandom");function f(h){return h<=100?27:h<=150?18:h<=200?15:h<=250?12:h<=300?9:h<=350?8:h<=400?7:h<=500?6:h<=600?5:h<=800?4:h<=1250?3:2}c(f,"getMillerRabinTests")})()});var wc=_((wJ,h2)=>{var ue=ve();_n();Cc();Ui();Mv();Hv();nn();qe();typeof Pe>"u"&&(Pe=ue.jsbn.BigInteger);var Pe,$v=ue.util.isNodejs?require("crypto"):null,P=ue.asn1,on=ue.util;ue.pki=ue.pki||{};h2.exports=ue.pki.rsa=ue.rsa=ue.rsa||{};var pe=ue.pki,ZK=[6,4,2,4,2,4,6,2],XK={name:"PrivateKeyInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},JK={name:"RSAPrivateKey",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},e7={name:"RSAPublicKey",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:P.Class.UNIVERSAL,type:P.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},t7=ue.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:P.Class.UNIVERSAL,type:P.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},r7={name:"DigestInfo",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:P.Class.UNIVERSAL,type:P.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:P.Class.UNIVERSAL,type:P.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:P.Class.UNIVERSAL,type:P.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:P.Class.UNIVERSAL,type:P.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},n7=c(function(t){var e;if(t.algorithm in pe.oids)e=pe.oids[t.algorithm];else{var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}var n=P.oidToDer(e).getBytes(),i=P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[]),s=P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[]);s.value.push(P.create(P.Class.UNIVERSAL,P.Type.OID,!1,n)),s.value.push(P.create(P.Class.UNIVERSAL,P.Type.NULL,!1,""));var o=P.create(P.Class.UNIVERSAL,P.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(s),i.value.push(o),P.toDer(i).getBytes()},"emsaPkcs1v15encode"),l2=c(function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(Pe.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(Pe.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var n;do n=new Pe(ue.util.bytesToHex(ue.random.getBytes(e.n.bitLength()/8)),16);while(n.compareTo(e.n)>=0||!n.gcd(e.n).equals(Pe.ONE));t=t.multiply(n.modPow(e.e,e.n)).mod(e.n);for(var i=t.mod(e.p).modPow(e.dP,e.p),s=t.mod(e.q).modPow(e.dQ,e.q);i.compareTo(s)<0;)i=i.add(e.p);var o=i.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return o=o.multiply(n.modInverse(e.n)).mod(e.n),o},"_modPow");pe.rsa.encrypt=function(t,e,r){var n=r,i,s=Math.ceil(e.n.bitLength()/8);r!==!1&&r!==!0?(n=r===2,i=f2(t,e,r)):(i=ue.util.createBuffer(),i.putBytes(t));for(var o=new Pe(i.toHex(),16),a=l2(o,e,n),u=a.toString(16),l=ue.util.createBuffer(),f=s-Math.ceil(u.length/2);f>0;)l.putByte(0),--f;return l.putBytes(ue.util.hexToBytes(u)),l.getBytes()};pe.rsa.decrypt=function(t,e,r,n){var i=Math.ceil(e.n.bitLength()/8);if(t.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=t.length,s.expected=i,s}var o=new Pe(ue.util.createBuffer(t).toHex(),16);if(o.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var a=l2(o,e,r),u=a.toString(16),l=ue.util.createBuffer(),f=i-Math.ceil(u.length/2);f>0;)l.putByte(0),--f;return l.putBytes(ue.util.hexToBytes(u)),n!==!1?Xl(l.getBytes(),e,r):l.getBytes()};pe.rsa.createKeyPairGenerationState=function(t,e,r){typeof t=="string"&&(t=parseInt(t,10)),t=t||2048,r=r||{};var n=r.prng||ue.random,i={nextBytes:function(a){for(var u=n.getBytesSync(a.length),l=0;l>1,pBits:t-(t>>1),pqState:0,num:null,keys:null},o.e.fromInt(o.eInt);else throw new Error("Invalid key generation algorithm: "+s);return o};pe.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new Pe(null);r.fromInt(30);for(var n=0,i=c(function(h,p){return h|p},"op_or"),s=+new Date,o,a=0;t.keys===null&&(e<=0||au?t.pqState=0:t.num.isProbablePrime(s7(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(ZK[n++%8],0):t.pqState===2?t.pqState=t.num.subtract(Pe.ONE).gcd(t.e).compareTo(Pe.ONE)===0?3:0:t.pqState===3&&(t.pqState=0,t.p===null?t.p=t.num:t.q=t.num,t.p!==null&&t.q!==null&&++t.state,t.num=null)}else if(t.state===1)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(t.state===2)t.p1=t.p.subtract(Pe.ONE),t.q1=t.q.subtract(Pe.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(t.state===3)t.phi.gcd(t.e).compareTo(Pe.ONE)===0?++t.state:(t.p=null,t.q=null,t.state=0);else if(t.state===4)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(t.state===5){var f=t.e.modInverse(t.phi);t.keys={privateKey:pe.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:pe.rsa.setPublicKey(t.n,t.e)}}o=+new Date,a+=o-s,s=o}return t.keys!==null};pe.rsa.generateKeyPair=function(t,e,r,n){if(arguments.length===1?typeof t=="object"?(r=t,t=void 0):typeof t=="function"&&(n=t,t=void 0):arguments.length===2?typeof t=="number"?typeof e=="function"?(n=e,e=void 0):typeof e!="number"&&(r=e,e=void 0):(r=t,n=e,t=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof r=="function"&&(n=r,r=void 0):(n=r,r=e,e=void 0)),r=r||{},t===void 0&&(t=r.bits||2048),e===void 0&&(e=r.e||65537),!ue.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(e===65537||e===3)){if(n){if(o2("generateKeyPair"))return $v.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,u,l){if(a)return n(a);n(null,{privateKey:pe.privateKeyFromPem(l),publicKey:pe.publicKeyFromPem(u)})});if(a2("generateKey")&&a2("exportKey"))return on.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:u2(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return on.globalScope.crypto.subtle.exportKey("pkcs8",a.privateKey)}).then(void 0,function(a){n(a)}).then(function(a){if(a){var u=pe.privateKeyFromAsn1(P.fromDer(ue.util.createBuffer(a)));n(null,{privateKey:u,publicKey:pe.setRsaPublicKey(u.n,u.e)})}});if(c2("generateKey")&&c2("exportKey")){var i=on.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:u2(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(a){var u=a.target.result,l=on.globalScope.msCrypto.subtle.exportKey("pkcs8",u.privateKey);l.oncomplete=function(f){var h=f.target.result,p=pe.privateKeyFromAsn1(P.fromDer(ue.util.createBuffer(h)));n(null,{privateKey:p,publicKey:pe.setRsaPublicKey(p.n,p.e)})},l.onerror=function(f){n(f)}},i.onerror=function(a){n(a)};return}}else if(o2("generateKeyPairSync")){var s=$v.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:pe.privateKeyFromPem(s.privateKey),publicKey:pe.publicKeyFromPem(s.publicKey)}}}var o=pe.rsa.createKeyPairGenerationState(t,e,r);if(!n)return pe.rsa.stepKeyPairGenerationState(o,0),o.keys;i7(o,r,n)};pe.setRsaPublicKey=pe.rsa.setPublicKey=function(t,e){var r={n:t,e};return r.encrypt=function(n,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(a,u,l){return f2(a,u,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(a,u){return ue.pkcs1.encode_rsa_oaep(u,a,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(a){return a}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var o=i.encode(n,r,!0);return pe.rsa.encrypt(o,r,!0)},r.verify=function(n,i,s,o){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),o===void 0&&(o={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in o||(o._parseAllDigestBytes=!0),s==="RSASSA-PKCS1-V1_5"?s={verify:function(u,l){l=Xl(l,r,!0);var f=P.fromDer(l,{parseAllBytes:o._parseAllDigestBytes}),h={},p=[];if(!P.validate(f,r7,h,p)){var g=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw g.errors=p,g}var d=P.derToOid(h.algorithmIdentifier);if(!(d===ue.oids.md2||d===ue.oids.md5||d===ue.oids.sha1||d===ue.oids.sha224||d===ue.oids.sha256||d===ue.oids.sha384||d===ue.oids.sha512||d===ue.oids["sha512-224"]||d===ue.oids["sha512-256"])){var g=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw g.oid=d,g}if((d===ue.oids.md2||d===ue.oids.md5)&&!("parameters"in h))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return u===h.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(u,l){return l=Xl(l,r,!0),u===l}});var a=pe.rsa.decrypt(i,r,!0,!1);return s.verify(n,a,r.n.bitLength())},r};pe.setRsaPrivateKey=pe.rsa.setPrivateKey=function(t,e,r,n,i,s,o,a){var u={n:t,e,d:r,p:n,q:i,dP:s,dQ:o,qInv:a};return u.decrypt=function(l,f,h){typeof f=="string"?f=f.toUpperCase():f===void 0&&(f="RSAES-PKCS1-V1_5");var p=pe.rsa.decrypt(l,u,!1,!1);if(f==="RSAES-PKCS1-V1_5")f={decode:Xl};else if(f==="RSA-OAEP"||f==="RSAES-OAEP")f={decode:function(g,d){return ue.pkcs1.decode_rsa_oaep(d,g,h)}};else if(["RAW","NONE","NULL",null].indexOf(f)!==-1)f={decode:function(g){return g}};else throw new Error('Unsupported encryption scheme: "'+f+'".');return f.decode(p,u,!1)},u.sign=function(l,f){var h=!1;typeof f=="string"&&(f=f.toUpperCase()),f===void 0||f==="RSASSA-PKCS1-V1_5"?(f={encode:n7},h=1):(f==="NONE"||f==="NULL"||f===null)&&(f={encode:function(){return l}},h=1);var p=f.encode(l,u.n.bitLength());return pe.rsa.encrypt(p,u,h)},u};pe.wrapRsaPrivateKey=function(t){return P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,P.integerToDer(0).getBytes()),P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.OID,!1,P.oidToDer(pe.oids.rsaEncryption).getBytes()),P.create(P.Class.UNIVERSAL,P.Type.NULL,!1,"")]),P.create(P.Class.UNIVERSAL,P.Type.OCTETSTRING,!1,P.toDer(t).getBytes())])};pe.privateKeyFromAsn1=function(t){var e={},r=[];if(P.validate(t,XK,e,r)&&(t=P.fromDer(ue.util.createBuffer(e.privateKey))),e={},r=[],!P.validate(t,JK,e,r)){var n=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw n.errors=r,n}var i,s,o,a,u,l,f,h;return i=ue.util.createBuffer(e.privateKeyModulus).toHex(),s=ue.util.createBuffer(e.privateKeyPublicExponent).toHex(),o=ue.util.createBuffer(e.privateKeyPrivateExponent).toHex(),a=ue.util.createBuffer(e.privateKeyPrime1).toHex(),u=ue.util.createBuffer(e.privateKeyPrime2).toHex(),l=ue.util.createBuffer(e.privateKeyExponent1).toHex(),f=ue.util.createBuffer(e.privateKeyExponent2).toHex(),h=ue.util.createBuffer(e.privateKeyCoefficient).toHex(),pe.setRsaPrivateKey(new Pe(i,16),new Pe(s,16),new Pe(o,16),new Pe(a,16),new Pe(u,16),new Pe(l,16),new Pe(f,16),new Pe(h,16))};pe.privateKeyToAsn1=pe.privateKeyToRSAPrivateKey=function(t){return P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,P.integerToDer(0).getBytes()),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.n)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.e)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.d)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.p)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.q)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.dP)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.dQ)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.qInv))])};pe.publicKeyFromAsn1=function(t){var e={},r=[];if(P.validate(t,t7,e,r)){var n=P.derToOid(e.publicKeyOid);if(n!==pe.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=n,i}t=e.rsaPublicKey}if(r=[],!P.validate(t,e7,e,r)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=r,i}var s=ue.util.createBuffer(e.publicKeyModulus).toHex(),o=ue.util.createBuffer(e.publicKeyExponent).toHex();return pe.setRsaPublicKey(new Pe(s,16),new Pe(o,16))};pe.publicKeyToAsn1=pe.publicKeyToSubjectPublicKeyInfo=function(t){return P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.OID,!1,P.oidToDer(pe.oids.rsaEncryption).getBytes()),P.create(P.Class.UNIVERSAL,P.Type.NULL,!1,"")]),P.create(P.Class.UNIVERSAL,P.Type.BITSTRING,!1,[pe.publicKeyToRSAPublicKey(t)])])};pe.publicKeyToRSAPublicKey=function(t){return P.create(P.Class.UNIVERSAL,P.Type.SEQUENCE,!0,[P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.n)),P.create(P.Class.UNIVERSAL,P.Type.INTEGER,!1,Wn(t.e))])};function f2(t,e,r){var n=ue.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(t.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=t.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o=i-3-t.length,a;if(r===0||r===1){a=r===0?0:255;for(var u=0;u0;){for(var l=0,f=ue.random.getBytes(o),u=0;u"u")throw new Error("Encryption block is invalid.");var u=0;if(a===0){u=i-3-n;for(var l=0;l1;){if(s.getByte()!==255){--s.read;break}++u}else if(a===2)for(u=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++u}var f=s.getByte();if(f!==0||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}c(Xl,"_decodePkcs1_v1_5");function i7(t,e,r){typeof e=="function"&&(r=e,e={}),e=e||{};var n={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(n.prng=e.prng),i();function i(){s(t.pBits,function(a,u){if(a)return r(a);if(t.p=u,t.q!==null)return o(a,t.q);s(t.qBits,o)})}c(i,"generate");function s(a,u){ue.prime.generateProbablePrime(a,n,u)}c(s,"getPrime");function o(a,u){if(a)return r(a);if(t.q=u,t.p.compareTo(t.q)<0){var l=t.p;t.p=t.q,t.q=l}if(t.p.subtract(Pe.ONE).gcd(t.e).compareTo(Pe.ONE)!==0){t.p=null,i();return}if(t.q.subtract(Pe.ONE).gcd(t.e).compareTo(Pe.ONE)!==0){t.q=null,s(t.qBits,o);return}if(t.p1=t.p.subtract(Pe.ONE),t.q1=t.q.subtract(Pe.ONE),t.phi=t.p1.multiply(t.q1),t.phi.gcd(t.e).compareTo(Pe.ONE)!==0){t.p=t.q=null,i();return}if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits){t.q=null,s(t.qBits,o);return}var f=t.e.modInverse(t.phi);t.keys={privateKey:pe.rsa.setPrivateKey(t.n,t.e,f,t.p,t.q,f.mod(t.p1),f.mod(t.q1),t.q.modInverse(t.p)),publicKey:pe.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}c(o,"finish")}c(i7,"_generateKeyPair");function Wn(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=ue.util.hexToBytes(e);return r.length>1&&(r.charCodeAt(0)===0&&!(r.charCodeAt(1)&128)||r.charCodeAt(0)===255&&(r.charCodeAt(1)&128)===128)?r.substr(1):r}c(Wn,"_bnToBytes");function s7(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}c(s7,"_getMillerRabinTests");function o2(t){return ue.util.isNodejs&&typeof $v[t]=="function"}c(o2,"_detectNodeCrypto");function a2(t){return typeof on.globalScope<"u"&&typeof on.globalScope.crypto=="object"&&typeof on.globalScope.crypto.subtle=="object"&&typeof on.globalScope.crypto.subtle[t]=="function"}c(a2,"_detectSubtleCrypto");function c2(t){return typeof on.globalScope<"u"&&typeof on.globalScope.msCrypto=="object"&&typeof on.globalScope.msCrypto.subtle=="object"&&typeof on.globalScope.msCrypto.subtle[t]=="function"}c(c2,"_detectSubtleMsCrypto");function u2(t){for(var e=ue.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),n=0;n{var ne=ve();qi();_n();Ec();Mn();Ui();zl();Ds();nn();kv();wc();qe();typeof d2>"u"&&(d2=ne.jsbn.BigInteger);var d2,F=ne.asn1,ye=ne.pki=ne.pki||{};m2.exports=ye.pbe=ne.pbe=ne.pbe||{};var ks=ye.oids,o7={name:"EncryptedPrivateKeyInfo",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},a7={name:"PBES2Algorithms",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},c7={name:"pkcs-12PbeParams",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"iterations"}]};ye.encryptPrivateKeyInfo=function(t,e,r){r=r||{},r.saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var n=ne.random.getBytesSync(r.saltSize),i=r.count,s=F.integerToDer(i),o,a,u;if(r.algorithm.indexOf("aes")===0||r.algorithm==="des"){var l,f,h;switch(r.algorithm){case"aes128":o=16,l=16,f=ks["aes128-CBC"],h=ne.aes.createEncryptionCipher;break;case"aes192":o=24,l=16,f=ks["aes192-CBC"],h=ne.aes.createEncryptionCipher;break;case"aes256":o=32,l=16,f=ks["aes256-CBC"],h=ne.aes.createEncryptionCipher;break;case"des":o=8,l=8,f=ks.desCBC,h=ne.des.createEncryptionCipher;break;default:var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var g="hmacWith"+r.prfAlgorithm.toUpperCase(),d=y2(g),y=ne.pkcs5.pbkdf2(e,n,i,o,d),v=ne.random.getBytesSync(l),m=h(y);m.start(v),m.update(F.toDer(t)),m.finish(),u=m.output.getBytes();var w=u7(n,s,o,g);a=F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(ks.pkcs5PBES2).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(ks.pkcs5PBKDF2).getBytes()),w]),F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(f).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.OCTETSTRING,!1,v)])])])}else if(r.algorithm==="3des"){o=24;var x=new ne.util.ByteBuffer(n),y=ye.pbe.generatePkcs12Key(e,x,1,i,o),v=ye.pbe.generatePkcs12Key(e,x,2,i,o),m=ne.des.createEncryptionCipher(y);m.start(v),m.update(F.toDer(t)),m.finish(),u=m.output.getBytes(),a=F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(ks["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OCTETSTRING,!1,n),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,s.getBytes())])])}else{var p=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw p.algorithm=r.algorithm,p}var A=F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[a,F.create(F.Class.UNIVERSAL,F.Type.OCTETSTRING,!1,u)]);return A};ye.decryptPrivateKeyInfo=function(t,e){var r=null,n={},i=[];if(!F.validate(t,o7,n,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=F.derToOid(n.encryptionOid),a=ye.pbe.getCipher(o,n.encryptionParams,e),u=ne.util.createBuffer(n.encryptedData);return a.update(u),a.finish()&&(r=F.fromDer(a.output)),r};ye.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:F.toDer(t).getBytes()};return ne.pem.encode(r,{maxline:e})};ye.encryptedPrivateKeyFromPem=function(t){var e=ne.pem.decode(t)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return F.fromDer(e.body)};ye.encryptRsaPrivateKey=function(t,e,r){if(r=r||{},!r.legacy){var n=ye.wrapRsaPrivateKey(ye.privateKeyToAsn1(t));return n=ye.encryptPrivateKeyInfo(n,e,r),ye.encryptedPrivateKeyToPem(n)}var i,s,o,a;switch(r.algorithm){case"aes128":i="AES-128-CBC",o=16,s=ne.random.getBytesSync(16),a=ne.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",o=24,s=ne.random.getBytesSync(16),a=ne.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",o=32,s=ne.random.getBytesSync(16),a=ne.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",o=24,s=ne.random.getBytesSync(8),a=ne.des.createEncryptionCipher;break;case"des":i="DES-CBC",o=8,s=ne.random.getBytesSync(8),a=ne.des.createEncryptionCipher;break;default:var u=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw u.algorithm=r.algorithm,u}var l=ne.pbe.opensslDeriveBytes(e,s.substr(0,8),o),f=a(l);f.start(s),f.update(F.toDer(ye.privateKeyToAsn1(t))),f.finish();var h={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:ne.util.bytesToHex(s).toUpperCase()},body:f.output.getBytes()};return ne.pem.encode(h)};ye.decryptRsaPrivateKey=function(t,e){var r=null,n=ne.pem.decode(t)[0];if(n.type!=="ENCRYPTED PRIVATE KEY"&&n.type!=="PRIVATE KEY"&&n.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(n.procType&&n.procType.type==="ENCRYPTED"){var s,o;switch(n.dekInfo.algorithm){case"DES-CBC":s=8,o=ne.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,o=ne.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,o=ne.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,o=ne.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,o=ne.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,o=c(function(h){return ne.rc2.createDecryptionCipher(h,40)},"cipherFn");break;case"RC2-64-CBC":s=8,o=c(function(h){return ne.rc2.createDecryptionCipher(h,64)},"cipherFn");break;case"RC2-128-CBC":s=16,o=c(function(h){return ne.rc2.createDecryptionCipher(h,128)},"cipherFn");break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+n.dekInfo.algorithm+'".');throw i.algorithm=n.dekInfo.algorithm,i}var a=ne.util.hexToBytes(n.dekInfo.parameters),u=ne.pbe.opensslDeriveBytes(e,a.substr(0,8),s),l=o(u);if(l.start(a),l.update(ne.util.createBuffer(n.body)),l.finish())r=l.output.getBytes();else return r}else r=n.body;return n.type==="ENCRYPTED PRIVATE KEY"?r=ye.decryptPrivateKeyInfo(F.fromDer(r),e):r=F.fromDer(r),r!==null&&(r=ye.privateKeyFromAsn1(r)),r};ye.pbe.generatePkcs12Key=function(t,e,r,n,i,s){var o,a;if(typeof s>"u"||s===null){if(!("sha1"in ne.md))throw new Error('"sha1" hash algorithm unavailable.');s=ne.md.sha1.create()}var u=s.digestLength,l=s.blockLength,f=new ne.util.ByteBuffer,h=new ne.util.ByteBuffer;if(t!=null){for(a=0;a=0;a--)Ae=Ae>>8,Ae+=Y.at(a)+k.at(a),k.setAt(a,Ae&255);re.putBuffer(k)}x=re,f.putBuffer(L)}return f.truncate(f.length()-i),f};ye.pbe.getCipher=function(t,e,r){switch(t){case ye.oids.pkcs5PBES2:return ye.pbe.getCipherForPBES2(t,e,r);case ye.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case ye.oids["pbewithSHAAnd40BitRC2-CBC"]:return ye.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}};ye.pbe.getCipherForPBES2=function(t,e,r){var n={},i=[];if(!F.validate(e,a7,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(t=F.derToOid(n.kdfOid),t!==ye.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=t,s.supportedOids=["pkcs5PBKDF2"],s}if(t=F.derToOid(n.encOid),t!==ye.oids["aes128-CBC"]&&t!==ye.oids["aes192-CBC"]&&t!==ye.oids["aes256-CBC"]&&t!==ye.oids["des-EDE3-CBC"]&&t!==ye.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=t,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var o=n.kdfSalt,a=ne.util.createBuffer(n.kdfIterationCount);a=a.getInt(a.length()<<3);var u,l;switch(ye.oids[t]){case"aes128-CBC":u=16,l=ne.aes.createDecryptionCipher;break;case"aes192-CBC":u=24,l=ne.aes.createDecryptionCipher;break;case"aes256-CBC":u=32,l=ne.aes.createDecryptionCipher;break;case"des-EDE3-CBC":u=24,l=ne.des.createDecryptionCipher;break;case"desCBC":u=8,l=ne.des.createDecryptionCipher;break}var f=g2(n.prfOid),h=ne.pkcs5.pbkdf2(r,o,a,u,f),p=n.encIv,g=l(h);return g.start(p),g};ye.pbe.getCipherForPKCS12PBE=function(t,e,r){var n={},i=[];if(!F.validate(e,c7,n,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var o=ne.util.createBuffer(n.salt),a=ne.util.createBuffer(n.iterations);a=a.getInt(a.length()<<3);var u,l,f;switch(t){case ye.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,l=8,f=ne.des.startDecrypting;break;case ye.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,l=8,f=c(function(y,v){var m=ne.rc2.createDecryptionCipher(y,40);return m.start(v,null),m},"cipherFn");break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=t,s}var h=g2(n.prfOid),p=ye.pbe.generatePkcs12Key(r,o,1,a,u,h);h.start();var g=ye.pbe.generatePkcs12Key(r,o,2,a,l,h);return f(p,g)};ye.pbe.opensslDeriveBytes=function(t,e,r,n){if(typeof n>"u"||n===null){if(!("md5"in ne.md))throw new Error('"md5" hash algorithm unavailable.');n=ne.md.md5.create()}e===null&&(e="");for(var i=[p2(n,t+e)],s=16,o=1;s{var ko=ve();_n();qe();var te=ko.asn1,Fo=S2.exports=ko.pkcs7asn1=ko.pkcs7asn1||{};ko.pkcs7=ko.pkcs7||{};ko.pkcs7.asn1=Fo;var v2={name:"ContentInfo",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:te.Class.UNIVERSAL,type:te.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:te.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};Fo.contentInfoValidator=v2;var E2={name:"EncryptedContentInfo",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:te.Class.UNIVERSAL,type:te.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:te.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:te.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};Fo.envelopedDataValidator={name:"EnvelopedData",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:te.Class.UNIVERSAL,type:te.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(E2)};Fo.encryptedDataValidator={name:"EncryptedData",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"version"}].concat(E2)};var l7={name:"SignerInfo",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:te.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:te.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:te.Class.UNIVERSAL,type:te.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:te.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};Fo.signedDataValidator={name:"SignedData",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:te.Class.UNIVERSAL,type:te.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},v2,{name:"SignedData.Certificates",tagClass:te.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:te.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:te.Class.UNIVERSAL,type:te.Type.SET,capture:"signerInfos",optional:!0,value:[l7]}]};Fo.recipientInfoValidator={name:"RecipientInfo",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:te.Class.UNIVERSAL,type:te.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:te.Class.UNIVERSAL,type:te.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:te.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:te.Class.UNIVERSAL,type:te.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var zv=_((IJ,C2)=>{var Fs=ve();qe();Fs.mgf=Fs.mgf||{};var f7=C2.exports=Fs.mgf.mgf1=Fs.mgf1=Fs.mgf1||{};f7.create=function(t){var e={generate:function(r,n){for(var i=new Fs.util.ByteBuffer,s=Math.ceil(n/t.digestLength),o=0;o{var Jl=ve();zv();w2.exports=Jl.mgf=Jl.mgf||{};Jl.mgf.mgf1=Jl.mgf1});var ef=_((NJ,T2)=>{var qs=ve();nn();qe();var h7=T2.exports=qs.pss=qs.pss||{};h7.create=function(t){arguments.length===3&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=t.md,r=t.mgf,n=e.digestLength,i=t.salt||null;typeof i=="string"&&(i=qs.util.createBuffer(i));var s;if("saltLength"in t)s=t.saltLength;else if(i!==null)s=i.length();else throw new Error("Salt length not specified or specific salt not given.");if(i!==null&&i.length()!==s)throw new Error("Given salt length does not match length of given salt.");var o=t.prng||qs.random,a={};return a.encode=function(u,l){var f,h=l-1,p=Math.ceil(h/8),g=u.digest().getBytes();if(p>8*p-h&255;return O=String.fromCharCode(O.charCodeAt(0)&~L)+O.substr(1),O+v+"\xBC"},a.verify=function(u,l,f){var h,p=f-1,g=Math.ceil(p/8);if(l=l.substr(-g),g>8*g-p&255;if(y.charCodeAt(0)&m)throw new Error("Bits beyond keysize not zero as expected.");var w=r.generate(v,d),x="";for(h=0;h{var le=ve();qi();_n();Ec();Mn();x2();Ui();Ds();ef();wc();qe();var E=le.asn1,Z=N2.exports=le.pki=le.pki||{},Le=Z.oids,Et={};Et.CN=Le.commonName;Et.commonName="CN";Et.C=Le.countryName;Et.countryName="C";Et.L=Le.localityName;Et.localityName="L";Et.ST=Le.stateOrProvinceName;Et.stateOrProvinceName="ST";Et.O=Le.organizationName;Et.organizationName="O";Et.OU=Le.organizationalUnitName;Et.organizationalUnitName="OU";Et.E=Le.emailAddress;Et.emailAddress="E";var b2=le.pki.rsa.publicKeyValidator,d7={name:"Certificate",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:E.Class.UNIVERSAL,type:E.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:E.Class.UNIVERSAL,type:E.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:E.Class.UNIVERSAL,type:E.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:E.Class.UNIVERSAL,type:E.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},b2,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:E.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:E.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:E.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},p7={name:"rsapss",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:E.Class.UNIVERSAL,type:E.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:E.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:E.Class.UNIVERSAL,type:E.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:E.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:E.Class.UNIVERSAL,type:E.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:E.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:E.Class.UNIVERSAL,type:E.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},g7={name:"CertificationRequestInfo",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:E.Class.UNIVERSAL,type:E.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},b2,{name:"CertificationRequestInfo.attributes",tagClass:E.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:E.Class.UNIVERSAL,type:E.Type.SET,constructed:!0}]}]}]},y7={name:"CertificationRequest",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[g7,{name:"CertificationRequest.signatureAlgorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:E.Class.UNIVERSAL,type:E.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:E.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:E.Class.UNIVERSAL,type:E.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};Z.RDNAttributesAsArray=function(t,e){for(var r=[],n,i,s,o=0;o2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(u.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(o.validity.notBefore=u[0],o.validity.notAfter=u[1],o.tbsCertificate=r.tbsCertificate,e){o.md=rf({signatureOid:o.signatureOid,type:"certificate"});var l=E.toDer(o.tbsCertificate);o.md.update(l.getBytes())}var f=le.md.sha1.create(),h=E.toDer(r.certIssuer);f.update(h.getBytes()),o.issuer.getField=function(d){return Ki(o.issuer,d)},o.issuer.addField=function(d){an([d]),o.issuer.attributes.push(d)},o.issuer.attributes=Z.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(o.issuer.uniqueId=r.certIssuerUniqueId),o.issuer.hash=f.digest().toHex();var p=le.md.sha1.create(),g=E.toDer(r.certSubject);return p.update(g.getBytes()),o.subject.getField=function(d){return Ki(o.subject,d)},o.subject.addField=function(d){an([d]),o.subject.attributes.push(d)},o.subject.attributes=Z.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(o.subject.uniqueId=r.certSubjectUniqueId),o.subject.hash=p.digest().toHex(),r.certExtensions?o.extensions=Z.certificateExtensionsFromAsn1(r.certExtensions):o.extensions=[],o.publicKey=Z.publicKeyFromAsn1(r.subjectPublicKeyInfo),o};Z.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r1&&(n=r.value.charCodeAt(1),i=r.value.length>2?r.value.charCodeAt(2):0),e.digitalSignature=(n&128)===128,e.nonRepudiation=(n&64)===64,e.keyEncipherment=(n&32)===32,e.dataEncipherment=(n&16)===16,e.keyAgreement=(n&8)===8,e.keyCertSign=(n&4)===4,e.cRLSign=(n&2)===2,e.encipherOnly=(n&1)===1,e.decipherOnly=(i&128)===128}else if(e.name==="basicConstraints"){var r=E.fromDer(e.value);r.value.length>0&&r.value[0].type===E.Type.BOOLEAN?e.cA=r.value[0].value.charCodeAt(0)!==0:e.cA=!1;var s=null;r.value.length>0&&r.value[0].type===E.Type.INTEGER?s=r.value[0].value:r.value.length>1&&(s=r.value[1].value),s!==null&&(e.pathLenConstraint=E.derToInteger(s))}else if(e.name==="extKeyUsage")for(var r=E.fromDer(e.value),o=0;o1&&(n=r.value.charCodeAt(1)),e.client=(n&128)===128,e.server=(n&64)===64,e.email=(n&32)===32,e.objsign=(n&16)===16,e.reserved=(n&8)===8,e.sslCA=(n&4)===4,e.emailCA=(n&2)===2,e.objCA=(n&1)===1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var u,r=E.fromDer(e.value),l=0;l"u"&&(e.type&&e.type in Z.oids?e.name=Z.oids[e.type]:e.shortName&&e.shortName in Et&&(e.name=Z.oids[Et[e.shortName]])),typeof e.type>"u")if(e.name&&e.name in Z.oids)e.type=Z.oids[e.name];else{var n=new Error("Attribute type not specified.");throw n.attribute=e,n}if(typeof e.shortName>"u"&&e.name&&e.name in Et&&(e.shortName=Et[e.name]),e.type===Le.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=E.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var i=0;i"u"){var n=new Error("Attribute value not specified.");throw n.attribute=e,n}}}c(an,"_fillMissingFields");function A2(t,e){if(e=e||{},typeof t.name>"u"&&t.id&&t.id in Z.oids&&(t.name=Z.oids[t.id]),typeof t.id>"u")if(t.name&&t.name in Z.oids)t.id=Z.oids[t.name];else{var r=new Error("Extension ID not specified.");throw r.extension=t,r}if(typeof t.value<"u")return t;if(t.name==="keyUsage"){var n=0,i=0,s=0;t.digitalSignature&&(i|=128,n=7),t.nonRepudiation&&(i|=64,n=6),t.keyEncipherment&&(i|=32,n=5),t.dataEncipherment&&(i|=16,n=4),t.keyAgreement&&(i|=8,n=3),t.keyCertSign&&(i|=4,n=2),t.cRLSign&&(i|=2,n=1),t.encipherOnly&&(i|=1,n=0),t.decipherOnly&&(s|=128,n=7);var o=String.fromCharCode(n);s!==0?o+=String.fromCharCode(i)+String.fromCharCode(s):i!==0&&(o+=String.fromCharCode(i)),t.value=E.create(E.Class.UNIVERSAL,E.Type.BITSTRING,!1,o)}else if(t.name==="basicConstraints")t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]),t.cA&&t.value.value.push(E.create(E.Class.UNIVERSAL,E.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in t&&t.value.value.push(E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(t.pathLenConstraint).getBytes()));else if(t.name==="extKeyUsage"){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);var a=t.value.value;for(var u in t)t[u]===!0&&(u in Le?a.push(E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(Le[u]).getBytes())):u.indexOf(".")!==-1&&a.push(E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(u).getBytes())))}else if(t.name==="nsCertType"){var n=0,i=0;t.client&&(i|=128,n=7),t.server&&(i|=64,n=6),t.email&&(i|=32,n=5),t.objsign&&(i|=16,n=4),t.reserved&&(i|=8,n=3),t.sslCA&&(i|=4,n=2),t.emailCA&&(i|=2,n=1),t.objCA&&(i|=1,n=0);var o=String.fromCharCode(n);i!==0&&(o+=String.fromCharCode(i)),t.value=E.create(E.Class.UNIVERSAL,E.Type.BITSTRING,!1,o)}else if(t.name==="subjectAltName"||t.name==="issuerAltName"){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);for(var l,f=0;f128)throw new Error('Invalid "nsComment" content.');t.value=E.create(E.Class.UNIVERSAL,E.Type.IA5STRING,!1,t.comment)}else if(t.name==="subjectKeyIdentifier"&&e.cert){var h=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=h.toHex(),t.value=E.create(E.Class.UNIVERSAL,E.Type.OCTETSTRING,!1,h.getBytes())}else if(t.name==="authorityKeyIdentifier"&&e.cert){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);var a=t.value.value;if(t.keyIdentifier){var p=t.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;a.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!1,p))}if(t.authorityCertIssuer){var g=[E.create(E.Class.CONTEXT_SPECIFIC,4,!0,[qo(t.authorityCertIssuer===!0?e.cert.issuer:t.authorityCertIssuer)])];a.push(E.create(E.Class.CONTEXT_SPECIFIC,1,!0,g))}if(t.serialNumber){var d=le.util.hexToBytes(t.serialNumber===!0?e.cert.serialNumber:t.serialNumber);a.push(E.create(E.Class.CONTEXT_SPECIFIC,2,!1,d))}}else if(t.name==="cRLDistributionPoints"){t.value=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);for(var a=t.value.value,y=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]),v=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[]),l,f=0;f"u"){var r=new Error("Extension value not specified.");throw r.extension=t,r}return t}c(A2,"_fillMissingExtensionFields");function Wv(t,e){switch(t){case Le["RSASSA-PSS"]:var r=[];return e.hash.algorithmOid!==void 0&&r.push(E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.hash.algorithmOid).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])])),e.mgf.algorithmOid!==void 0&&r.push(E.create(E.Class.CONTEXT_SPECIFIC,1,!0,[E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.mgf.algorithmOid).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(e.mgf.hash.algorithmOid).getBytes()),E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")])])])),e.saltLength!==void 0&&r.push(E.create(E.Class.CONTEXT_SPECIFIC,2,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(e.saltLength).getBytes())])),E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,r);default:return E.create(E.Class.UNIVERSAL,E.Type.NULL,!1,"")}}c(Wv,"_signatureParametersToAsn1");function m7(t){var e=E.create(E.Class.CONTEXT_SPECIFIC,0,!0,[]);if(t.attributes.length===0)return e;for(var r=t.attributes,n=0;n=v7&&t0&&n.value.push(Z.certificateExtensionsToAsn1(t.extensions)),n};Z.getCertificationRequestInfo=function(t){var e=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.INTEGER,!1,E.integerToDer(t.version).getBytes()),qo(t.subject),Z.publicKeyToAsn1(t.publicKey),m7(t)]);return e};Z.distinguishedNameToAsn1=function(t){return qo(t)};Z.certificateToAsn1=function(t){var e=t.tbsCertificate||Z.getTBSCertificate(t);return E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[e,E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[E.create(E.Class.UNIVERSAL,E.Type.OID,!1,E.oidToDer(t.signatureOid).getBytes()),Wv(t.signatureOid,t.signatureParameters)]),E.create(E.Class.UNIVERSAL,E.Type.BITSTRING,!1,"\0"+t.signature)])};Z.certificateExtensionsToAsn1=function(t){var e=E.create(E.Class.CONTEXT_SPECIFIC,3,!0,[]),r=E.create(E.Class.UNIVERSAL,E.Type.SEQUENCE,!0,[]);e.value.push(r);for(var n=0;n"u"&&(i=new Date);var s=!0,o=null,a=0;do{var u=e.shift(),l=null,f=!1;if(i&&(iu.validity.notAfter)&&(o={message:"Certificate is not valid yet or has expired.",error:Z.certificateError.certificate_expired,notBefore:u.validity.notBefore,notAfter:u.validity.notAfter,now:i}),o===null){if(l=e[0]||t.getIssuer(u),l===null&&u.isIssuer(u)&&(f=!0,l=u),l){var h=l;le.util.isArray(h)||(h=[h]);for(var p=!1;!p&&h.length>0;){l=h.shift();try{p=l.verify(u)}catch{}}p||(o={message:"Certificate signature is invalid.",error:Z.certificateError.bad_certificate})}o===null&&(!l||f)&&!t.hasCertificate(u)&&(o={message:"Certificate is not trusted.",error:Z.certificateError.unknown_ca})}if(o===null&&l&&!u.isIssuer(l)&&(o={message:"Certificate issuer is invalid.",error:Z.certificateError.bad_certificate}),o===null)for(var g={keyUsage:!0,basicConstraints:!0},d=0;o===null&&dv.pathLenConstraint&&(o={message:"Certificate basicConstraints pathLenConstraint violated.",error:Z.certificateError.bad_certificate})}}var x=o===null?!0:o.error,A=r.verify?r.verify(x,a,n):x;if(A===!0)o=null;else throw x===!0&&(o={message:"The application rejected the certificate.",error:Z.certificateError.bad_certificate}),(A||A===0)&&(typeof A=="object"&&!le.util.isArray(A)?(A.message&&(o.message=A.message),A.error&&(o.error=A.error)):typeof A=="string"&&(o.error=A)),o;s=!1,++a}while(e.length>0);return!0}});var Yv=_((OJ,R2)=>{var tt=ve();_n();Ro();Ui();jv();Gv();nn();wc();Lo();qe();nf();var I=tt.asn1,be=tt.pki,Tc=R2.exports=tt.pkcs12=tt.pkcs12||{},B2={name:"ContentInfo",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:I.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},S7={name:"PFX",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,capture:"version"},B2,{name:"PFX.macData",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:I.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:I.Class.UNIVERSAL,type:I.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:I.Class.UNIVERSAL,type:I.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},C7={name:"SafeBag",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:I.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:I.Class.UNIVERSAL,type:I.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},w7={name:"Attribute",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:I.Class.UNIVERSAL,type:I.Type.SET,constructed:!0,capture:"values"}]},x7={name:"CertBag",tagClass:I.Class.UNIVERSAL,type:I.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:I.Class.UNIVERSAL,type:I.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:I.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:I.Class.UNIVERSAL,type:I.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function xc(t,e,r,n){for(var i=[],s=0;s=0&&i.push(a)}}return i}c(xc,"_getBagsByAttribute");Tc.pkcs12FromAsn1=function(t,e,r){typeof e=="string"?(r=e,e=!0):e===void 0&&(e=!0);var n={},i=[];if(!I.validate(t,S7,n,i)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var o={version:n.version.charCodeAt(0),safeContents:[],getBags:function(v){var m={},w;return"localKeyId"in v?w=v.localKeyId:"localKeyIdHex"in v&&(w=tt.util.hexToBytes(v.localKeyIdHex)),w===void 0&&!("friendlyName"in v)&&"bagType"in v&&(m[v.bagType]=xc(o.safeContents,null,null,v.bagType)),w!==void 0&&(m.localKeyId=xc(o.safeContents,"localKeyId",w,v.bagType)),"friendlyName"in v&&(m.friendlyName=xc(o.safeContents,"friendlyName",v.friendlyName,v.bagType)),m},getBagsByFriendlyName:function(v,m){return xc(o.safeContents,"friendlyName",v,m)},getBagsByLocalKeyId:function(v,m){return xc(o.safeContents,"localKeyId",v,m)}};if(n.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=n.version.charCodeAt(0),s}if(I.derToOid(n.contentType)!==be.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=I.derToOid(n.contentType),s}var a=n.content.value[0];if(a.tagClass!==I.Class.UNIVERSAL||a.type!==I.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(a=Qv(a),n.mac){var u=null,l=0,f=I.derToOid(n.macAlgorithm);switch(f){case be.oids.sha1:u=tt.md.sha1.create(),l=20;break;case be.oids.sha256:u=tt.md.sha256.create(),l=32;break;case be.oids.sha384:u=tt.md.sha384.create(),l=48;break;case be.oids.sha512:u=tt.md.sha512.create(),l=64;break;case be.oids.md5:u=tt.md.md5.create(),l=16;break}if(u===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+f);var h=new tt.util.ByteBuffer(n.macSalt),p="macIterations"in n?parseInt(tt.util.bytesToHex(n.macIterations),16):1,g=Tc.generateKey(r,h,3,p,l,u),d=tt.hmac.create();d.start(u,g),d.update(a.value);var y=d.getMac();if(y.getBytes()!==n.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return T7(o,a.value,e,r),o};function Qv(t){if(t.composed||t.constructed){for(var e=tt.util.createBuffer(),r=0;r0&&(s=I.create(I.Class.UNIVERSAL,I.Type.SET,!0,u));var l=[],f=[];e!==null&&(tt.util.isArray(e)?f=e:f=[e]);for(var h=[],p=0;p0){var v=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,h),m=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.data).getBytes()),I.create(I.Class.CONTEXT_SPECIFIC,0,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,I.toDer(v).getBytes())])]);l.push(m)}var w=null;if(t!==null){var x=be.wrapRsaPrivateKey(be.privateKeyToAsn1(t));r===null?w=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.keyBag).getBytes()),I.create(I.Class.CONTEXT_SPECIFIC,0,!0,[x]),s]):w=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.pkcs8ShroudedKeyBag).getBytes()),I.create(I.Class.CONTEXT_SPECIFIC,0,!0,[be.encryptPrivateKeyInfo(x,r,n)]),s]);var A=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[w]),O=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.data).getBytes()),I.create(I.Class.CONTEXT_SPECIFIC,0,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,I.toDer(A).getBytes())])]);l.push(O)}var L=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,l),j;if(n.useMac){var a=tt.md.sha1.create(),Y=new tt.util.ByteBuffer(tt.random.getBytes(n.saltSize)),se=n.count,t=Tc.generateKey(r,Y,3,se,20),re=tt.hmac.create();re.start(a,t),re.update(I.toDer(L).getBytes());var k=re.getMac();j=I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.sha1).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.NULL,!1,"")]),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,k.getBytes())]),I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,Y.getBytes()),I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,I.integerToDer(se).getBytes())])}return I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.INTEGER,!1,I.integerToDer(3).getBytes()),I.create(I.Class.UNIVERSAL,I.Type.SEQUENCE,!0,[I.create(I.Class.UNIVERSAL,I.Type.OID,!1,I.oidToDer(be.oids.data).getBytes()),I.create(I.Class.CONTEXT_SPECIFIC,0,!0,[I.create(I.Class.UNIVERSAL,I.Type.OCTETSTRING,!1,I.toDer(L).getBytes())])]),j])};Tc.generateKey=tt.pbe.generatePkcs12Key});var Xv=_((PJ,O2)=>{var Hi=ve();_n();Ui();Gv();Ds();zl();Yv();ef();wc();qe();nf();var Zv=Hi.asn1,Uo=O2.exports=Hi.pki=Hi.pki||{};Uo.pemToDer=function(t){var e=Hi.pem.decode(t)[0];if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return Hi.util.createBuffer(e.body)};Uo.privateKeyFromPem=function(t){var e=Hi.pem.decode(t)[0];if(e.type!=="PRIVATE KEY"&&e.type!=="RSA PRIVATE KEY"){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var n=Zv.fromDer(e.body);return Uo.privateKeyFromAsn1(n)};Uo.privateKeyToPem=function(t,e){var r={type:"RSA PRIVATE KEY",body:Zv.toDer(Uo.privateKeyToAsn1(t)).getBytes()};return Hi.pem.encode(r,{maxline:e})};Uo.privateKeyInfoToPem=function(t,e){var r={type:"PRIVATE KEY",body:Zv.toDer(t).getBytes()};return Hi.pem.encode(r,{maxline:e})}});var iE=_((LJ,V2)=>{var H=ve();_n();Ro();Hl();Ds();Xv();nn();Lo();qe();var cf=c(function(t,e,r,n){var i=H.util.createBuffer(),s=t.length>>1,o=s+(t.length&1),a=t.substr(0,o),u=t.substr(s,o),l=H.util.createBuffer(),f=H.hmac.create();r=e+r;var h=Math.ceil(n/16),p=Math.ceil(n/20);f.start("MD5",a);var g=H.util.createBuffer();l.putBytes(r);for(var d=0;d0&&(C.queue(t,C.createAlert(t,{level:C.Alert.Level.warning,description:C.Alert.Description.no_renegotiation})),C.flush(t)),t.process()};C.parseHelloMessage=function(t,e,r){var n=null,i=t.entity===C.ConnectionEnd.client;if(r<38)t.error(t,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});else{var s=e.fragment,o=s.length();if(n={version:{major:s.getByte(),minor:s.getByte()},random:H.util.createBuffer(s.getBytes(32)),session_id:Kr(s,1),extensions:[]},i?(n.cipher_suite=s.getBytes(2),n.compression_method=s.getByte()):(n.cipher_suites=Kr(s,2),n.compression_methods=Kr(s,1)),o=r-(o-s.length()),o>0){for(var a=Kr(s,2);a.length()>0;)n.extensions.push({type:[a.getByte(),a.getByte()],data:Kr(a,2)});if(!i)for(var u=0;u0;){var h=f.getByte();if(h!==0)break;t.session.extensions.server_name.serverNameList.push(Kr(f,2).getBytes())}}}if(t.session.version&&(n.version.major!==t.session.version.major||n.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}});if(i)t.session.cipherSuite=C.getCipherSuite(n.cipher_suite);else for(var p=H.util.createBuffer(n.cipher_suites.bytes());p.length()>0&&(t.session.cipherSuite=C.getCipherSuite(p.getBytes(2)),t.session.cipherSuite===null););if(t.session.cipherSuite===null)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.handshake_failure},cipherSuite:H.util.bytesToHex(n.cipher_suite)});i?t.session.compressionMethod=n.compression_method:t.session.compressionMethod=C.CompressionMethod.none}return n};C.createSecurityParameters=function(t,e){var r=t.entity===C.ConnectionEnd.client,n=e.random.bytes(),i=r?t.session.sp.client_random:n,s=r?n:C.createRandom().getBytes();t.session.sp={entity:t.entity,prf_algorithm:C.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:t.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:s}};C.handleServerHello=function(t,e,r){var n=C.parseHelloMessage(t,e,r);if(!t.fail){if(n.version.minor<=t.version.minor)t.version.minor=n.version.minor;else return t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}});t.session.version=t.version;var i=n.session_id.bytes();i.length>0&&i===t.session.id?(t.expect=L2,t.session.resuming=!0,t.session.sp.server_random=n.random.bytes()):(t.expect=O7,t.session.resuming=!1,C.createSecurityParameters(t,n)),t.session.id=i,t.process()}};C.handleClientHello=function(t,e,r){var n=C.parseHelloMessage(t,e,r);if(!t.fail){var i=n.session_id.bytes(),s=null;if(t.sessionCache&&(s=t.sessionCache.getSession(i),s===null?i="":(s.version.major!==n.version.major||s.version.minor>n.version.minor)&&(s=null,i="")),i.length===0&&(i=H.random.getBytes(32)),t.session.id=i,t.session.clientHelloVersion=n.version,t.session.sp={},s)t.version=t.session.version=s.version,t.session.sp=s.sp;else{for(var o,a=1;a0;)s=Kr(i.certificate_list,3),o=H.asn1.fromDer(s),s=H.pki.certificateFromAsn1(o,!0),a.push(s)}catch(l){return t.error(t,{message:"Could not parse certificate list.",cause:l,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.bad_certificate}})}var u=t.entity===C.ConnectionEnd.client;(u||t.verifyClient===!0)&&a.length===0?t.error(t,{message:u?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}}):a.length===0?t.expect=u?D2:tE:(u?t.session.serverCertificate=a[0]:t.session.clientCertificate=a[0],C.verifyCertificateChain(t,a)&&(t.expect=u?D2:tE)),t.process()};C.handleServerKeyExchange=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.unsupported_certificate}});t.expect=D7,t.process()};C.handleClientKeyExchange=function(t,e,r){if(r<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.unsupported_certificate}});var n=e.fragment,i={enc_pre_master_secret:Kr(n,2).getBytes()},s=null;if(t.getPrivateKey)try{s=t.getPrivateKey(t,t.session.serverCertificate),s=H.pki.privateKeyFromPem(s)}catch(u){t.error(t,{message:"Could not get private key.",cause:u,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}})}if(s===null)return t.error(t,{message:"No private key set.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}});try{var o=t.session.sp;o.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var a=t.session.clientHelloVersion;if(a.major!==o.pre_master_secret.charCodeAt(0)||a.minor!==o.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{o.pre_master_secret=H.random.getBytes(48)}t.expect=rE,t.session.clientCertificate!==null&&(t.expect=V7),t.process()};C.handleCertificateRequest=function(t,e,r){if(r<3)return t.error(t,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var n=e.fragment,i={certificate_types:Kr(n,1),certificate_authorities:Kr(n,2)};t.session.certificateRequest=i,t.expect=P7,t.process()};C.handleCertificateVerify=function(t,e,r){if(r<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var n=e.fragment;n.read-=4;var i=n.bytes();n.read+=4;var s={signature:Kr(n,2).getBytes()},o=H.util.createBuffer();o.putBuffer(t.session.md5.digest()),o.putBuffer(t.session.sha1.digest()),o=o.getBytes();try{var a=t.session.clientCertificate;if(!a.publicKey.verify(o,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(i),t.session.sha1.update(i)}catch{return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.handshake_failure}})}t.expect=rE,t.process()};C.handleServerHelloDone=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.record_overflow}});if(t.serverCertificate===null){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.insufficient_security}},i=0,s=t.verify(t,n.alert.description,i,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!H.util.isArray(s)?(s.message&&(n.message=s.message),s.alert&&(n.alert.description=s.alert)):typeof s=="number"&&(n.alert.description=s)),t.error(t,n)}t.session.certificateRequest!==null&&(e=C.createRecord(t,{type:C.ContentType.handshake,data:C.createCertificate(t)}),C.queue(t,e)),e=C.createRecord(t,{type:C.ContentType.handshake,data:C.createClientKeyExchange(t)}),C.queue(t,e),t.expect=F7;var o=c(function(a,u){a.session.certificateRequest!==null&&a.session.clientCertificate!==null&&C.queue(a,C.createRecord(a,{type:C.ContentType.handshake,data:C.createCertificateVerify(a,u)})),C.queue(a,C.createRecord(a,{type:C.ContentType.change_cipher_spec,data:C.createChangeCipherSpec()})),a.state.pending=C.createConnectionState(a),a.state.current.write=a.state.pending.write,C.queue(a,C.createRecord(a,{type:C.ContentType.handshake,data:C.createFinished(a)})),a.expect=L2,C.flush(a),a.process()},"callback");if(t.session.certificateRequest===null||t.session.clientCertificate===null)return o(t,null);C.getClientSignature(t,o)};C.handleChangeCipherSpec=function(t,e){if(e.fragment.getByte()!==1)return t.error(t,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var r=t.entity===C.ConnectionEnd.client;(t.session.resuming&&r||!t.session.resuming&&!r)&&(t.state.pending=C.createConnectionState(t)),t.state.current.read=t.state.pending.read,(!t.session.resuming&&r||t.session.resuming&&!r)&&(t.state.pending=null),t.expect=r?L7:M7,t.process()};C.handleFinished=function(t,e,r){var n=e.fragment;n.read-=4;var i=n.bytes();n.read+=4;var s=e.fragment.getBytes();n=H.util.createBuffer(),n.putBuffer(t.session.md5.digest()),n.putBuffer(t.session.sha1.digest());var o=t.entity===C.ConnectionEnd.client,a=o?"server finished":"client finished",u=t.session.sp,l=12,f=cf;if(n=f(u.master_secret,a,n.getBytes(),l),n.getBytes()!==s)return t.error(t,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.decrypt_error}});t.session.md5.update(i),t.session.sha1.update(i),(t.session.resuming&&o||!t.session.resuming&&!o)&&(C.queue(t,C.createRecord(t,{type:C.ContentType.change_cipher_spec,data:C.createChangeCipherSpec()})),t.state.current.write=t.state.pending.write,t.state.pending=null,C.queue(t,C.createRecord(t,{type:C.ContentType.handshake,data:C.createFinished(t)}))),t.expect=o?k7:K7,t.handshaking=!1,++t.handshakes,t.peerCertificate=o?t.session.serverCertificate:t.session.clientCertificate,C.flush(t),t.isConnected=!0,t.connected(t),t.process()};C.handleAlert=function(t,e){var r=e.fragment,n={level:r.getByte(),description:r.getByte()},i;switch(n.description){case C.Alert.Description.close_notify:i="Connection closed.";break;case C.Alert.Description.unexpected_message:i="Unexpected message.";break;case C.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case C.Alert.Description.decryption_failed:i="Decryption failed.";break;case C.Alert.Description.record_overflow:i="Record overflow.";break;case C.Alert.Description.decompression_failure:i="Decompression failed.";break;case C.Alert.Description.handshake_failure:i="Handshake failure.";break;case C.Alert.Description.bad_certificate:i="Bad certificate.";break;case C.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case C.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case C.Alert.Description.certificate_expired:i="Certificate expired.";break;case C.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case C.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case C.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case C.Alert.Description.access_denied:i="Access denied.";break;case C.Alert.Description.decode_error:i="Decode error.";break;case C.Alert.Description.decrypt_error:i="Decrypt error.";break;case C.Alert.Description.export_restriction:i="Export restriction.";break;case C.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case C.Alert.Description.insufficient_security:i="Insufficient security.";break;case C.Alert.Description.internal_error:i="Internal error.";break;case C.Alert.Description.user_canceled:i="User canceled.";break;case C.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error.";break}if(n.description===C.Alert.Description.close_notify)return t.close();t.error(t,{message:i,send:!1,origin:t.entity===C.ConnectionEnd.client?"server":"client",alert:n}),t.process()};C.handleHandshake=function(t,e){var r=e.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return t.fragmented=e,e.fragment=H.util.createBuffer(),r.read-=4,t.process();t.fragmented=null,r.read-=4;var s=r.bytes(i+4);r.read+=4,n in af[t.entity][t.expect]?(t.entity===C.ConnectionEnd.server&&!t.open&&!t.fail&&(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:H.md.md5.create(),sha1:H.md.sha1.create()}),n!==C.HandshakeType.hello_request&&n!==C.HandshakeType.certificate_verify&&n!==C.HandshakeType.finished&&(t.session.md5.update(s),t.session.sha1.update(s)),af[t.entity][t.expect][n](t,e,i)):C.handleUnexpected(t,e)};C.handleApplicationData=function(t,e){t.data.putBuffer(e.fragment),t.dataReady(t),t.process()};C.handleHeartbeat=function(t,e){var r=e.fragment,n=r.getByte(),i=r.getInt16(),s=r.getBytes(i);if(n===C.HeartbeatMessageType.heartbeat_request){if(t.handshaking||i>s.length)return t.process();C.queue(t,C.createRecord(t,{type:C.ContentType.heartbeat,data:C.createHeartbeat(C.HeartbeatMessageType.heartbeat_response,s)})),C.flush(t)}else if(n===C.HeartbeatMessageType.heartbeat_response){if(s!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,H.util.createBuffer(s))}t.process()};var R7=0,O7=1,D2=2,D7=3,P7=4,L2=5,L7=6,k7=7,F7=8,q7=0,U7=1,tE=2,V7=3,rE=4,M7=5,K7=6,S=C.handleUnexpected,k2=C.handleChangeCipherSpec,rr=C.handleAlert,Sr=C.handleHandshake,F2=C.handleApplicationData,nr=C.handleHeartbeat,nE=[];nE[C.ConnectionEnd.client]=[[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[k2,rr,S,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,F2,nr],[S,rr,Sr,S,nr]];nE[C.ConnectionEnd.server]=[[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,S,nr],[k2,rr,S,S,nr],[S,rr,Sr,S,nr],[S,rr,Sr,F2,nr],[S,rr,Sr,S,nr]];var $i=C.handleHelloRequest,H7=C.handleServerHello,q2=C.handleCertificate,P2=C.handleServerKeyExchange,Jv=C.handleCertificateRequest,sf=C.handleServerHelloDone,U2=C.handleFinished,af=[];af[C.ConnectionEnd.client]=[[S,S,H7,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,q2,P2,Jv,sf,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,P2,Jv,sf,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,S,Jv,sf,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,S,S,sf,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,U2],[$i,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[$i,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]];var $7=C.handleClientHello,G7=C.handleClientKeyExchange,j7=C.handleCertificateVerify;af[C.ConnectionEnd.server]=[[S,$7,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,q2,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,G7,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,j7,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,U2],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S],[S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S,S]];C.generateKeys=function(t,e){var r=cf,n=e.client_random+e.server_random;t.session.resuming||(e.master_secret=r(e.pre_master_secret,"master secret",n,48).bytes(),e.pre_master_secret=null),n=e.server_random+e.client_random;var i=2*e.mac_key_length+2*e.enc_key_length,s=t.version.major===C.Versions.TLS_1_0.major&&t.version.minor===C.Versions.TLS_1_0.minor;s&&(i+=2*e.fixed_iv_length);var o=r(e.master_secret,"key expansion",n,i),a={client_write_MAC_key:o.getBytes(e.mac_key_length),server_write_MAC_key:o.getBytes(e.mac_key_length),client_write_key:o.getBytes(e.enc_key_length),server_write_key:o.getBytes(e.enc_key_length)};return s&&(a.client_write_IV=o.getBytes(e.fixed_iv_length),a.server_write_IV=o.getBytes(e.fixed_iv_length)),a};C.createConnectionState=function(t){var e=t.entity===C.ConnectionEnd.client,r=c(function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(o){return!0},compressionState:null,compressFunction:function(o){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},"createMode"),n={read:r(),write:r()};if(n.read.update=function(s,o){return n.read.cipherFunction(o,n.read)?n.read.compressFunction(s,o,n.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.bad_record_mac}}),!s.fail},n.write.update=function(s,o){return n.write.compressFunction(s,o,n.write)?n.write.cipherFunction(o,n.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}),!s.fail},t.session){var i=t.session.sp;switch(t.session.cipherSuite.initSecurityParameters(i),i.keys=C.generateKeys(t,i),n.read.macKey=e?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=e?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,t.session.cipherSuite.initConnectionState(n,t,i),i.compression_algorithm){case C.CompressionMethod.none:break;case C.CompressionMethod.deflate:n.read.compressFunction=B7,n.write.compressFunction=N7;break;default:throw new Error("Unsupported compression algorithm.")}}return n};C.createRandom=function(){var t=new Date,e=+t+t.getTimezoneOffset()*6e4,r=H.util.createBuffer();return r.putInt32(e),r.putBytes(H.random.getBytes(28)),r};C.createRecord=function(t,e){if(!e.data)return null;var r={type:e.type,version:{major:t.version.major,minor:t.version.minor},length:e.data.length(),fragment:e.data};return r};C.createAlert=function(t,e){var r=H.util.createBuffer();return r.putByte(e.level),r.putByte(e.description),C.createRecord(t,{type:C.ContentType.alert,data:r})};C.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var e=H.util.createBuffer(),r=0;r0&&(h+=2);var p=t.session.id,g=p.length+1+2+4+28+2+i+1+o+h,d=H.util.createBuffer();return d.putByte(C.HandshakeType.client_hello),d.putInt24(g),d.putByte(t.version.major),d.putByte(t.version.minor),d.putBytes(t.session.sp.client_random),cn(d,1,H.util.createBuffer(p)),cn(d,2,e),cn(d,1,s),h>0&&cn(d,2,a),d};C.createServerHello=function(t){var e=t.session.id,r=e.length+1+2+4+28+2+1,n=H.util.createBuffer();return n.putByte(C.HandshakeType.server_hello),n.putInt24(r),n.putByte(t.version.major),n.putByte(t.version.minor),n.putBytes(t.session.sp.server_random),cn(n,1,H.util.createBuffer(e)),n.putByte(t.session.cipherSuite.id[0]),n.putByte(t.session.cipherSuite.id[1]),n.putByte(t.session.compressionMethod),n};C.createCertificate=function(t){var e=t.entity===C.ConnectionEnd.client,r=null;if(t.getCertificate){var n;e?n=t.session.certificateRequest:n=t.session.extensions.server_name.serverNameList,r=t.getCertificate(t,n)}var i=H.util.createBuffer();if(r!==null)try{H.util.isArray(r)||(r=[r]);for(var s=null,o=0;o0&&(r.putByte(C.HandshakeType.server_key_exchange),r.putInt24(e)),r};C.getClientSignature=function(t,e){var r=H.util.createBuffer();r.putBuffer(t.session.md5.digest()),r.putBuffer(t.session.sha1.digest()),r=r.getBytes(),t.getSignature=t.getSignature||function(n,i,s){var o=null;if(n.getPrivateKey)try{o=n.getPrivateKey(n,n.session.clientCertificate),o=H.pki.privateKeyFromPem(o)}catch(a){n.error(n,{message:"Could not get private key.",cause:a,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}})}o===null?n.error(n,{message:"No private key set.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}):i=o.sign(i,null),s(n,i)},t.getSignature(t,r,e)};C.createCertificateVerify=function(t,e){var r=e.length+2,n=H.util.createBuffer();return n.putByte(C.HandshakeType.certificate_verify),n.putInt24(r),n.putInt16(e.length),n.putBytes(e),n};C.createCertificateRequest=function(t){var e=H.util.createBuffer();e.putByte(1);var r=H.util.createBuffer();for(var n in t.caStore.certs){var i=t.caStore.certs[n],s=H.pki.distinguishedNameToAsn1(i.subject),o=H.asn1.toDer(s);r.putInt16(o.length()),r.putBuffer(o)}var a=1+e.length()+2+r.length(),u=H.util.createBuffer();return u.putByte(C.HandshakeType.certificate_request),u.putInt24(a),cn(u,1,e),cn(u,2,r),u};C.createServerHelloDone=function(t){var e=H.util.createBuffer();return e.putByte(C.HandshakeType.server_hello_done),e.putInt24(0),e};C.createChangeCipherSpec=function(){var t=H.util.createBuffer();return t.putByte(1),t};C.createFinished=function(t){var e=H.util.createBuffer();e.putBuffer(t.session.md5.digest()),e.putBuffer(t.session.sha1.digest());var r=t.entity===C.ConnectionEnd.client,n=t.session.sp,i=12,s=cf,o=r?"client finished":"server finished";e=s(n.master_secret,o,e.getBytes(),i);var a=H.util.createBuffer();return a.putByte(C.HandshakeType.finished),a.putInt24(e.length()),a.putBuffer(e),a};C.createHeartbeat=function(t,e,r){typeof r>"u"&&(r=e.length);var n=H.util.createBuffer();n.putByte(t),n.putInt16(r),n.putBytes(e);var i=n.length(),s=Math.max(16,i-r-3);return n.putBytes(H.random.getBytes(s)),n};C.queue=function(t,e){if(e&&!(e.fragment.length()===0&&(e.type===C.ContentType.handshake||e.type===C.ContentType.alert||e.type===C.ContentType.change_cipher_spec))){if(e.type===C.ContentType.handshake){var r=e.fragment.bytes();t.session.md5.update(r),t.session.sha1.update(r),r=null}var n;if(e.fragment.length()<=C.MaxFragment)n=[e];else{n=[];for(var i=e.fragment.bytes();i.length>C.MaxFragment;)n.push(C.createRecord(t,{type:e.type,data:H.util.createBuffer(i.slice(0,C.MaxFragment))})),i=i.slice(C.MaxFragment);i.length>0&&n.push(C.createRecord(t,{type:e.type,data:H.util.createBuffer(i)}))}for(var s=0;s0&&(o=r.order[0]),o!==null&&o in r.cache){s=r.cache[o],delete r.cache[o];for(var a in r.order)if(r.order[a]===o){r.order.splice(a,1);break}}return s},r.setSession=function(i,s){if(r.order.length===r.capacity){var o=r.order.shift();delete r.cache[o]}var o=H.util.bytesToHex(i);r.order.push(o),r.cache[o]=s}}return r};C.createConnection=function(t){var e=null;t.caStore?H.util.isArray(t.caStore)?e=H.pki.createCaStore(t.caStore):e=t.caStore:e=H.pki.createCaStore();var r=t.cipherSuites||null;if(r===null){r=[];for(var n in C.CipherSuites)r.push(C.CipherSuites[n])}var i=t.server?C.ConnectionEnd.server:C.ConnectionEnd.client,s=t.sessionCache?C.createSessionCache(t.sessionCache):null,o={version:{major:C.Version.major,minor:C.Version.minor},entity:i,sessionId:t.sessionId,caStore:e,sessionCache:s,cipherSuites:r,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(f,h,p,g){return h},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:H.util.createBuffer(),tlsData:H.util.createBuffer(),data:H.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(f,h){h.origin=h.origin||(f.entity===C.ConnectionEnd.client?"client":"server"),h.send&&(C.queue(f,C.createAlert(f,h.alert)),C.flush(f));var p=h.fatal!==!1;p&&(f.fail=!0),t.error(f,h),p&&f.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null};o.reset=function(f){o.version={major:C.Version.major,minor:C.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=o.entity===C.ConnectionEnd.client?R7:q7,o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(f||typeof f>"u"),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=C.createConnectionState(o)},o.reset();var a=c(function(f,h){var p=h.type-C.ContentType.change_cipher_spec,g=nE[f.entity][f.expect];p in g?g[p](f,h):C.handleUnexpected(f,h)},"_update"),u=c(function(f){var h=0,p=f.input,g=p.length();if(g<5)h=5-g;else{f.record={type:p.getByte(),version:{major:p.getByte(),minor:p.getByte()},length:p.getInt16(),fragment:H.util.createBuffer(),ready:!1};var d=f.record.version.major===f.version.major;d&&f.session&&f.session.version&&(d=f.record.version.minor===f.version.minor),d||f.error(f,{message:"Incompatible TLS version.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}})}return h},"_readRecordHeader"),l=c(function(f){var h=0,p=f.input,g=p.length();if(g0&&(o.sessionCache&&(h=o.sessionCache.getSession(f)),h===null&&(f="")),f.length===0&&o.sessionCache&&(h=o.sessionCache.getSession(),h!==null&&(f=h.id)),o.session={id:f,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:H.md.md5.create(),sha1:H.md.sha1.create()},h&&(o.version=h.version,o.session.sp=h.sp),o.session.sp.client_random=C.createRandom().getBytes(),o.open=!0,C.queue(o,C.createRecord(o,{type:C.ContentType.handshake,data:C.createClientHello(o)})),C.flush(o)}},o.process=function(f){var h=0;return f&&o.input.putBytes(f),o.fail||(o.record!==null&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),o.record===null&&(h=u(o)),!o.fail&&o.record!==null&&!o.record.ready&&(h=l(o)),!o.fail&&o.record!==null&&o.record.ready&&a(o,o.record)),h},o.prepare=function(f){return C.queue(o,C.createRecord(o,{type:C.ContentType.application_data,data:H.util.createBuffer(f)})),C.flush(o)},o.prepareHeartbeatRequest=function(f,h){return f instanceof H.util.ByteBuffer&&(f=f.bytes()),typeof h>"u"&&(h=f.length),o.expectedHeartbeatPayload=f,C.queue(o,C.createRecord(o,{type:C.ContentType.heartbeat,data:C.createHeartbeat(C.HeartbeatMessageType.heartbeat_request,f,h)})),C.flush(o)},o.close=function(f){if(!o.fail&&o.sessionCache&&o.session){var h={id:o.session.id,version:o.session.version,sp:o.session.sp};h.sp.keys=null,o.sessionCache.setSession(h.id,h)}o.open&&(o.open=!1,o.input.clear(),(o.isConnected||o.handshaking)&&(o.isConnected=o.handshaking=!1,C.queue(o,C.createAlert(o,{level:C.Alert.Level.warning,description:C.Alert.Description.close_notify})),C.flush(o)),o.closed(o)),o.reset(f)},o};V2.exports=H.tls=H.tls||{};for(of in C)typeof C[of]!="function"&&(H.tls[of]=C[of]);var of;H.tls.prf_tls1=cf;H.tls.hmac_sha1=A7;H.tls.createSessionCache=C.createSessionCache;H.tls.createConnection=C.createConnection});var H2=_((FJ,K2)=>{var Gi=ve();qi();iE();var un=K2.exports=Gi.tls;un.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=un.BulkCipherAlgorithm.aes,t.cipher_type=un.CipherType.block,t.enc_key_length=16,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=un.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:M2};un.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=un.BulkCipherAlgorithm.aes,t.cipher_type=un.CipherType.block,t.enc_key_length=32,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=un.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:M2};function M2(t,e,r){var n=e.entity===Gi.tls.ConnectionEnd.client;t.read.cipherState={init:!1,cipher:Gi.cipher.createDecipher("AES-CBC",n?r.keys.server_write_key:r.keys.client_write_key),iv:n?r.keys.server_write_IV:r.keys.client_write_IV},t.write.cipherState={init:!1,cipher:Gi.cipher.createCipher("AES-CBC",n?r.keys.client_write_key:r.keys.server_write_key),iv:n?r.keys.client_write_IV:r.keys.server_write_IV},t.read.cipherFunction=Z7,t.write.cipherFunction=W7,t.read.macLength=t.write.macLength=r.mac_length,t.read.macFunction=t.write.macFunction=un.hmac_sha1}c(M2,"initConnectionState");function W7(t,e){var r=!1,n=e.macFunction(e.macKey,e.sequenceNumber,t);t.fragment.putBytes(n),e.updateSequenceNumber();var i;t.version.minor===un.Versions.TLS_1_0.minor?i=e.cipherState.init?null:e.cipherState.iv:i=Gi.random.getBytesSync(16),e.cipherState.init=!0;var s=e.cipherState.cipher;return s.start({iv:i}),t.version.minor>=un.Versions.TLS_1_1.minor&&s.output.putBytes(i),s.update(t.fragment),s.finish(Q7)&&(t.fragment=s.output,t.length=t.fragment.length(),r=!0),r}c(W7,"encrypt_aes_cbc_sha1");function Q7(t,e,r){if(!r){var n=t-e.length()%t;e.fillWithByte(n-1,n)}return!0}c(Q7,"encrypt_aes_cbc_sha1_padding");function Y7(t,e,r){var n=!0;if(r){for(var i=e.length(),s=e.last(),o=i-1-s;o=s?(t.fragment=i.output.getBytes(a-s),o=i.output.getBytes(s)):t.fragment=i.output.getBytes(),t.fragment=Gi.util.createBuffer(t.fragment),t.length=t.fragment.length();var u=e.macFunction(e.macKey,e.sequenceNumber,t);return e.updateSequenceNumber(),r=X7(e.macKey,o,u)&&r,r}c(Z7,"decrypt_aes_cbc_sha1");function X7(t,e,r){var n=Gi.hmac.create();return n.start("SHA1",t),n.update(e),e=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),e===r}c(X7,"compareMacs")});var aE=_((UJ,z2)=>{var at=ve();Mn();qe();var _c=z2.exports=at.sha512=at.sha512||{};at.md.sha512=at.md.algorithms.sha512=_c;var G2=at.sha384=at.sha512.sha384=at.sha512.sha384||{};G2.create=function(){return _c.create("SHA-384")};at.md.sha384=at.md.algorithms.sha384=G2;at.sha512.sha256=at.sha512.sha256||{create:function(){return _c.create("SHA-512/256")}};at.md["sha512/256"]=at.md.algorithms["sha512/256"]=at.sha512.sha256;at.sha512.sha224=at.sha512.sha224||{create:function(){return _c.create("SHA-512/224")}};at.md["sha512/224"]=at.md.algorithms["sha512/224"]=at.sha512.sha224;_c.create=function(t){if(j2||J7(),typeof t>"u"&&(t="SHA-512"),!(t in Us))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=Us[t],r=null,n=at.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var o=64;switch(t){case"SHA-384":o=48;break;case"SHA-512/256":o=32;break;case"SHA-512/224":o=28;break}var a={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:o,messageLength:0,fullMessageLength:null,messageLengthSize:16};return a.start=function(){a.messageLength=0,a.fullMessageLength=a.messageLength128=[];for(var u=a.messageLengthSize/4,l=0;l>>0,f>>>0];for(var h=a.fullMessageLength.length-1;h>=0;--h)a.fullMessageLength[h]+=f[1],f[1]=f[0]+(a.fullMessageLength[h]/4294967296>>>0),a.fullMessageLength[h]=a.fullMessageLength[h]>>>0,f[0]=f[1]/4294967296>>>0;return n.putBytes(u),$2(r,i,n),(n.read>2048||n.length()===0)&&n.compact(),a},a.digest=function(){var u=at.util.createBuffer();u.putBytes(n.bytes());var l=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize,f=l&a.blockLength-1;u.putBytes(sE.substr(0,a.blockLength-f));for(var h,p,g=a.fullMessageLength[0]*8,d=0;d>>0,g+=p,u.putInt32(g>>>0),g=h>>>0;u.putInt32(g);for(var y=new Array(r.length),d=0;d=128;){for(G=0;G<16;++G)e[G][0]=r.getInt32()>>>0,e[G][1]=r.getInt32()>>>0;for(;G<80;++G)Re=e[G-2],ae=Re[0],X=Re[1],n=((ae>>>19|X<<13)^(X>>>29|ae<<3)^ae>>>6)>>>0,i=((ae<<13|X>>>19)^(X<<3|ae>>>29)^(ae<<26|X>>>6))>>>0,Se=e[G-15],ae=Se[0],X=Se[1],s=((ae>>>1|X<<31)^(ae>>>8|X<<24)^ae>>>7)>>>0,o=((ae<<31|X>>>1)^(ae<<24|X>>>8)^(ae<<25|X>>>7))>>>0,je=e[G-7],Oe=e[G-16],X=i+je[1]+o+Oe[1],e[G][0]=n+je[0]+s+Oe[0]+(X/4294967296>>>0)>>>0,e[G][1]=X>>>0;for(y=t[0][0],v=t[0][1],m=t[1][0],w=t[1][1],x=t[2][0],A=t[2][1],O=t[3][0],L=t[3][1],j=t[4][0],Y=t[4][1],se=t[5][0],re=t[5][1],k=t[6][0],Ae=t[6][1],q=t[7][0],T=t[7][1],G=0;G<80;++G)l=((j>>>14|Y<<18)^(j>>>18|Y<<14)^(Y>>>9|j<<23))>>>0,f=((j<<18|Y>>>14)^(j<<14|Y>>>18)^(Y<<23|j>>>9))>>>0,h=(k^j&(se^k))>>>0,p=(Ae^Y&(re^Ae))>>>0,a=((y>>>28|v<<4)^(v>>>2|y<<30)^(v>>>7|y<<25))>>>0,u=((y<<4|v>>>28)^(v<<30|y>>>2)^(v<<25|y>>>7))>>>0,g=(y&m|x&(y^m))>>>0,d=(v&w|A&(v^w))>>>0,X=T+f+p+oE[G][1]+e[G][1],n=q+l+h+oE[G][0]+e[G][0]+(X/4294967296>>>0)>>>0,i=X>>>0,X=u+d,s=a+g+(X/4294967296>>>0)>>>0,o=X>>>0,q=k,T=Ae,k=se,Ae=re,se=j,re=Y,X=L+i,j=O+n+(X/4294967296>>>0)>>>0,Y=X>>>0,O=x,L=A,x=m,A=w,m=y,w=v,X=i+o,y=n+s+(X/4294967296>>>0)>>>0,v=X>>>0;X=t[0][1]+v,t[0][0]=t[0][0]+y+(X/4294967296>>>0)>>>0,t[0][1]=X>>>0,X=t[1][1]+w,t[1][0]=t[1][0]+m+(X/4294967296>>>0)>>>0,t[1][1]=X>>>0,X=t[2][1]+A,t[2][0]=t[2][0]+x+(X/4294967296>>>0)>>>0,t[2][1]=X>>>0,X=t[3][1]+L,t[3][0]=t[3][0]+O+(X/4294967296>>>0)>>>0,t[3][1]=X>>>0,X=t[4][1]+Y,t[4][0]=t[4][0]+j+(X/4294967296>>>0)>>>0,t[4][1]=X>>>0,X=t[5][1]+re,t[5][0]=t[5][0]+se+(X/4294967296>>>0)>>>0,t[5][1]=X>>>0,X=t[6][1]+Ae,t[6][0]=t[6][0]+k+(X/4294967296>>>0)>>>0,t[6][1]=X>>>0,X=t[7][1]+T,t[7][0]=t[7][0]+q+(X/4294967296>>>0)>>>0,t[7][1]=X>>>0,Ce-=128}}c($2,"_update")});var W2=_(cE=>{var eH=ve();_n();var Wt=eH.asn1;cE.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};cE.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Wt.Class.UNIVERSAL,type:Wt.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var aN=_((KJ,oN)=>{var ir=ve();Cc();nn();aE();qe();var eN=W2(),tH=eN.publicKeyValidator,rH=eN.privateKeyValidator;typeof Q2>"u"&&(Q2=ir.jsbn.BigInteger);var Q2,fE=ir.util.ByteBuffer,Lr=typeof Buffer>"u"?Uint8Array:Buffer;ir.pki=ir.pki||{};oN.exports=ir.pki.ed25519=ir.ed25519=ir.ed25519||{};var Ie=ir.ed25519;Ie.constants={};Ie.constants.PUBLIC_KEY_BYTE_LENGTH=32;Ie.constants.PRIVATE_KEY_BYTE_LENGTH=64;Ie.constants.SEED_BYTE_LENGTH=32;Ie.constants.SIGN_BYTE_LENGTH=64;Ie.constants.HASH_BYTE_LENGTH=64;Ie.generateKeyPair=function(t){t=t||{};var e=t.seed;if(e===void 0)e=ir.random.getBytesSync(Ie.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==Ie.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+Ie.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=hi({message:e,encoding:"binary"});for(var r=new Lr(Ie.constants.PUBLIC_KEY_BYTE_LENGTH),n=new Lr(Ie.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)n[i]=e[i];return oH(r,n),{publicKey:r,privateKey:n}};Ie.privateKeyFromAsn1=function(t){var e={},r=[],n=ir.asn1.validate(t,rH,e,r);if(!n){var i=new Error("Invalid Key.");throw i.errors=r,i}var s=ir.asn1.derToOid(e.privateKeyOid),o=ir.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var a=e.privateKey,u=hi({message:ir.asn1.fromDer(a).value,encoding:"binary"});return{privateKeyBytes:u}};Ie.publicKeyFromAsn1=function(t){var e={},r=[],n=ir.asn1.validate(t,tH,e,r);if(!n){var i=new Error("Invalid Key.");throw i.errors=r,i}var s=ir.asn1.derToOid(e.publicKeyOid),o=ir.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var a=e.ed25519PublicKey;if(a.length!==Ie.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return hi({message:a,encoding:"binary"})};Ie.publicKeyFromPrivateKey=function(t){t=t||{};var e=hi({message:t.privateKey,encoding:"binary"});if(e.length!==Ie.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+Ie.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new Lr(Ie.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n=0};function hi(t){var e=t.message;if(e instanceof Uint8Array||e instanceof Lr)return e;var r=t.encoding;if(e===void 0)if(t.md)e=t.md.digest().getBytes(),r="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.from(e,r);e=new fE(e,r)}else if(!(e instanceof fE))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new Lr(e.length()),i=0;i=32;--n){for(r=0,i=n-32,s=n-12;i>8,e[i]-=r*256;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;++i)e[i]+=r-(e[31]>>4)*uE[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;++i)e[i]-=r*uE[i];for(n=0;n<32;++n)e[n+1]+=e[n]>>8,t[n]=e[n]&255}c(tN,"modL");function dE(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;tN(t,e)}c(dE,"reduce");function pE(t,e){var r=fe(),n=fe(),i=fe(),s=fe(),o=fe(),a=fe(),u=fe(),l=fe(),f=fe();Mo(r,t[1],t[0]),Mo(f,e[1],e[0]),Xe(r,r,f),Vo(n,t[0],t[1]),Vo(f,e[0],e[1]),Xe(n,n,f),Xe(i,t[3],e[3]),Xe(i,i,iH),Xe(s,t[2],e[2]),Vo(s,s,s),Mo(o,n,r),Mo(a,s,i),Vo(u,s,i),Vo(l,n,r),Xe(t[0],o,a),Xe(t[1],l,u),Xe(t[2],u,a),Xe(t[3],o,l)}c(pE,"add");function X2(t,e,r){for(var n=0;n<4;++n)sN(t[n],e[n],r)}c(X2,"cswap");function gE(t,e){var r=fe(),n=fe(),i=fe();dH(i,e[2]),Xe(r,e[0],i),Xe(n,e[1],i),lf(t,n),t[31]^=nN(r)<<7}c(gE,"pack");function lf(t,e){var r,n,i,s=fe(),o=fe();for(r=0;r<16;++r)o[r]=e[r];for(lE(o),lE(o),lE(o),n=0;n<2;++n){for(s[0]=o[0]-65517,r=1;r<15;++r)s[r]=o[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=o[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,sN(o,s,1-i)}for(r=0;r<16;r++)t[2*r]=o[r]&255,t[2*r+1]=o[r]>>8}c(lf,"pack25519");function uH(t,e){var r=fe(),n=fe(),i=fe(),s=fe(),o=fe(),a=fe(),u=fe();return ji(t[2],uf),lH(t[1],e),Vs(i,t[1]),Xe(s,i,nH),Mo(i,i,t[2]),Vo(s,t[2],s),Vs(o,s),Vs(a,o),Xe(u,a,o),Xe(r,u,i),Xe(r,r,s),fH(r,r),Xe(r,r,i),Xe(r,r,s),Xe(r,r,s),Xe(t[0],r,s),Vs(n,t[0]),Xe(n,n,s),J2(n,i)&&Xe(t[0],t[0],sH),Vs(n,t[0]),Xe(n,n,s),J2(n,i)?-1:(nN(t[0])===e[31]>>7&&Mo(t[0],hE,t[0]),Xe(t[3],t[0],t[1]),0)}c(uH,"unpackneg");function lH(t,e){var r;for(r=0;r<16;++r)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}c(lH,"unpack25519");function fH(t,e){var r=fe(),n;for(n=0;n<16;++n)r[n]=e[n];for(n=250;n>=0;--n)Vs(r,r),n!==1&&Xe(r,r,e);for(n=0;n<16;++n)t[n]=r[n]}c(fH,"pow2523");function J2(t,e){var r=new Lr(32),n=new Lr(32);return lf(r,t),lf(n,e),rN(r,0,n,0)}c(J2,"neq25519");function rN(t,e,r,n){return hH(t,e,r,n,32)}c(rN,"crypto_verify_32");function hH(t,e,r,n,i){var s,o=0;for(s=0;s>>8)-1}c(hH,"vn");function nN(t){var e=new Lr(32);return lf(e,t),e[0]&1}c(nN,"par25519");function iN(t,e,r){var n,i;for(ji(t[0],hE),ji(t[1],uf),ji(t[2],uf),ji(t[3],hE),i=255;i>=0;--i)n=r[i/8|0]>>(i&7)&1,X2(t,e,n),pE(e,t),pE(t,t),X2(t,e,n)}c(iN,"scalarmult");function yE(t,e){var r=[fe(),fe(),fe(),fe()];ji(r[0],Y2),ji(r[1],Z2),ji(r[2],uf),Xe(r[3],Y2,Z2),iN(t,r,e)}c(yE,"scalarbase");function ji(t,e){var r;for(r=0;r<16;r++)t[r]=e[r]|0}c(ji,"set25519");function dH(t,e){var r=fe(),n;for(n=0;n<16;++n)r[n]=e[n];for(n=253;n>=0;--n)Vs(r,r),n!==2&&n!==4&&Xe(r,r,e);for(n=0;n<16;++n)t[n]=r[n]}c(dH,"inv25519");function lE(t){var e,r,n=1;for(e=0;e<16;++e)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-n*65536;t[0]+=n-1+37*(n-1)}c(lE,"car25519");function sN(t,e,r){for(var n,i=~(r-1),s=0;s<16;++s)n=i&(t[s]^e[s]),t[s]^=n,e[s]^=n}c(sN,"sel25519");function fe(t){var e,r=new Float64Array(16);if(t)for(e=0;e{var Hr=ve();qe();nn();Cc();lN.exports=Hr.kem=Hr.kem||{};var cN=Hr.jsbn.BigInteger;Hr.kem.rsa={};Hr.kem.rsa.create=function(t,e){e=e||{};var r=e.prng||Hr.random,n={};return n.encrypt=function(i,s){var o=Math.ceil(i.n.bitLength()/8),a;do a=new cN(Hr.util.bytesToHex(r.getBytesSync(o)),16).mod(i.n);while(a.compareTo(cN.ONE)<=0);a=Hr.util.hexToBytes(a.toString(16));var u=o-a.length;u>0&&(a=Hr.util.fillString("\0",u)+a);var l=i.encrypt(a,"NONE"),f=t.generate(a,s);return{encapsulation:l,key:f}},n.decrypt=function(i,s,o){var a=i.decrypt(s,"NONE");return t.generate(a,o)},n};Hr.kem.kdf1=function(t,e){uN(this,t,0,e||t.digestLength)};Hr.kem.kdf2=function(t,e){uN(this,t,1,e||t.digestLength)};function uN(t,e,r,n){t.generate=function(i,s){for(var o=new Hr.util.ByteBuffer,a=Math.ceil(s/n)+r,u=new Hr.util.ByteBuffer,l=r;l{var Be=ve();qe();pN.exports=Be.log=Be.log||{};Be.log.levels=["none","error","warning","info","debug","verbose","max"];var ff={},EE=[],Ac=null;Be.log.LEVEL_LOCKED=2;Be.log.NO_LEVEL_CHECK=4;Be.log.INTERPOLATE=8;for(Qn=0;Qn"u"||e?t.flags|=Be.log.LEVEL_LOCKED:t.flags&=~Be.log.LEVEL_LOCKED};Be.log.addLogger=function(t){EE.push(t)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(hN={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Nc=c(function(t,e){Be.log.prepareStandard(e);var r=hN[e.level],n=[e.standard];n=n.concat(e.arguments.slice()),r.apply(console,n)},"f"),Ko=Be.log.makeLogger(Nc)):(Nc=c(function(e,r){Be.log.prepareStandardFull(r),console.log(r.standardFull)},"f"),Ko=Be.log.makeLogger(Nc)),Be.log.setLevel(Ko,"debug"),Be.log.addLogger(Ko),Ac=Ko):console={log:function(){}};var Ko,hN,Nc;Ac!==null&&typeof window<"u"&&window.location&&(Ic=new URL(window.location.href).searchParams,Ic.has("console.level")&&Be.log.setLevel(Ac,Ic.get("console.level").slice(-1)[0]),Ic.has("console.lock")&&(dN=Ic.get("console.lock").slice(-1)[0],dN=="true"&&Be.log.lock(Ac)));var Ic,dN;Be.log.consoleLogger=Ac});var mN=_((WJ,yN)=>{yN.exports=Mn();Hl();Lo();Ov();aE()});var SN=_((QJ,EN)=>{var J=ve();qi();_n();Ec();Ui();Ds();jv();nn();qe();nf();var N=J.asn1,Cr=EN.exports=J.pkcs7=J.pkcs7||{};Cr.messageFromPem=function(t){var e=J.pem.decode(t)[0];if(e.type!=="PKCS7"){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=e.type,r}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var n=N.fromDer(e.body);return Cr.messageFromAsn1(n)};Cr.messageToPem=function(t,e){var r={type:"PKCS7",body:N.toDer(t.toAsn1()).getBytes()};return J.pem.encode(r,{maxline:e})};Cr.messageFromAsn1=function(t){var e={},r=[];if(!N.validate(t,Cr.asn1.contentInfoValidator,e,r)){var n=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw n.errors=r,n}var i=N.derToOid(e.contentType),s;switch(i){case J.pki.oids.envelopedData:s=Cr.createEnvelopedData();break;case J.pki.oids.encryptedData:s=Cr.createEncryptedData();break;case J.pki.oids.signedData:s=Cr.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return s.fromAsn1(e.content.value[0]),s};Cr.createSignedData=function(){var t=null;return t={type:J.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(n){if(CE(t,n,Cr.asn1.signedDataValidator),t.certificates=[],t.crls=[],t.digestAlgorithmIdentifiers=[],t.contentInfo=null,t.signerInfos=[],t.rawCapture.certificates)for(var i=t.rawCapture.certificates.value,s=0;s0&&o.value[0].value.push(N.create(N.Class.CONTEXT_SPECIFIC,0,!0,n)),s.length>0&&o.value[0].value.push(N.create(N.Class.CONTEXT_SPECIFIC,1,!0,s)),o.value[0].value.push(N.create(N.Class.UNIVERSAL,N.Type.SET,!0,t.signerInfos)),N.create(N.Class.UNIVERSAL,N.Type.SEQUENCE,!0,[N.create(N.Class.UNIVERSAL,N.Type.OID,!1,N.oidToDer(t.type).getBytes()),o])},addSigner:function(n){var i=n.issuer,s=n.serialNumber;if(n.certificate){var o=n.certificate;typeof o=="string"&&(o=J.pki.certificateFromPem(o)),i=o.issuer.attributes,s=o.serialNumber}var a=n.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof a=="string"&&(a=J.pki.privateKeyFromPem(a));var u=n.digestAlgorithm||J.pki.oids.sha1;switch(u){case J.pki.oids.sha1:case J.pki.oids.sha256:case J.pki.oids.sha384:case J.pki.oids.sha512:case J.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+u)}var l=n.authenticatedAttributes||[];if(l.length>0){for(var f=!1,h=!1,p=0;p0){for(var r=N.create(N.Class.CONTEXT_SPECIFIC,1,!0,[]),n=0;n=r&&i{var _t=ve();qi();Ro();Hl();Lo();qe();var df=CN.exports=_t.ssh=_t.ssh||{};df.privateKeyToPutty=function(t,e,r){r=r||"",e=e||"";var n="ssh-rsa",i=e===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+n+`\r +`;s+="Encryption: "+i+`\r +`,s+="Comment: "+r+`\r +`;var o=_t.util.createBuffer();Ho(o,n),Yn(o,t.e),Yn(o,t.n);var a=_t.util.encode64(o.bytes(),64),u=Math.floor(a.length/66)+1;s+="Public-Lines: "+u+`\r +`,s+=a;var l=_t.util.createBuffer();Yn(l,t.d),Yn(l,t.p),Yn(l,t.q),Yn(l,t.qInv);var f;if(!e)f=_t.util.encode64(l.bytes(),64);else{var h=l.length()+16-1;h-=h%16;var p=hf(l.bytes());p.truncate(p.length()-h+l.length()),l.putBuffer(p);var g=_t.util.createBuffer();g.putBuffer(hf("\0\0\0\0",e)),g.putBuffer(hf("\0\0\0",e));var d=_t.aes.createEncryptionCipher(g.truncate(8),"CBC");d.start(_t.util.createBuffer().fillWithByte(0,16)),d.update(l.copy()),d.finish();var y=d.output;y.truncate(16),f=_t.util.encode64(y.bytes(),64)}u=Math.floor(f.length/66)+1,s+=`\r +Private-Lines: `+u+`\r +`,s+=f;var v=hf("putty-private-key-file-mac-key",e),m=_t.util.createBuffer();Ho(m,n),Ho(m,i),Ho(m,r),m.putInt32(o.length()),m.putBuffer(o),m.putInt32(l.length()),m.putBuffer(l);var w=_t.hmac.create();return w.start("sha1",v),w.update(m.bytes()),s+=`\r +Private-MAC: `+w.digest().toHex()+`\r +`,s};df.publicKeyToOpenSSH=function(t,e){var r="ssh-rsa";e=e||"";var n=_t.util.createBuffer();return Ho(n,r),Yn(n,t.e),Yn(n,t.n),r+" "+_t.util.encode64(n.bytes())+" "+e};df.privateKeyToOpenSSH=function(t,e){return e?_t.pki.encryptRsaPrivateKey(t,e,{legacy:!0,algorithm:"aes128"}):_t.pki.privateKeyToPem(t)};df.getPublicKeyFingerprint=function(t,e){e=e||{};var r=e.md||_t.md.md5.create(),n="ssh-rsa",i=_t.util.createBuffer();Ho(i,n),Yn(i,t.e),Yn(i,t.n),r.start(),r.update(i.getBytes());var s=r.digest();if(e.encoding==="hex"){var o=s.toHex();return e.delimiter?o.match(/.{2}/g).join(e.delimiter):o}else{if(e.encoding==="binary")return s.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return s};function Yn(t,e){var r=e.toString(16);r[0]>="8"&&(r="00"+r);var n=_t.util.hexToBytes(r);t.putInt32(n.length),t.putBytes(n)}c(Yn,"_addBigIntegerToBuffer");function Ho(t,e){t.putInt32(e.length),t.putString(e)}c(Ho,"_addStringToBuffer");function hf(){for(var t=_t.md.sha1.create(),e=arguments.length,r=0;r{xN.exports=ve();qi();H2();_n();kl();Ec();aN();Ro();fN();gN();mN();zv();zl();Ds();Mv();Yv();SN();Xv();Hv();Dv();ef();nn();kv();wN();iE();qe()});var NN=_((eee,AN)=>{var _N=Rs(),Zn=TN(),bN=[[813826048,33620784,2181038086,153781832,2264337665,117547136],[805306881,53477382,153781832,2264337665,117547008,67108864],[813760514,16986241,395562,2252900087,218171137,2692808708],[813826048,33620784,2164262409,713443462,4144824583,27296e3],[813891584,131331,813826048,101264006,1216804621,17236384],[813891584,131331,813891584,395562,2252900087,218171137],[813957120,513,53510912,1545,713443462,4144824583],[813957120,513,53511168,6,153781832,2264337665]],CH=[[4294901760,4294967295,4278190335,4294967295,4294967295,4294967280],[4278255615,4294902015,4294967295,4294967295,4294967040,4278190080],[4294902015,4294967295,16777215,4294967295,4294967295,4294902015],[4294901760,4294967295,4278255615,4294967295,4294967295,4294967040],[4294901760,16777215,4294901760,4294967295,4294967295,4294967295],[4294901760,16777215,4294901760,16777215,4294967295,4294967295],[4294901760,65535,4294967040,65535,4294967295,4294967295],[4294901760,65535,4294967040,255,4294967295,4294967295]],xE=class xE{constructor(e,r){this.keystore=e,this.password=r}static probe(e){let n=new _N(e).read(24);for(let i=0;i(s.readInt()&l)>>>0).every((l,f)=>l===o[f]))return!0}return!1}parse(){let e=this.keystore.toString("base64"),r=Zn.util.decode64(e),n=Zn.asn1.fromDer(r);return Zn.pkcs12.pkcs12FromAsn1(n,this.password||"").safeContents.reduce((s,o)=>Array.isArray(o.safeBags)?s.concat(o.safeBags):s,[])}toPem(e){return e.reduce((r,n)=>{let i=n.attributes.friendlyName[0],s=!!n.attributes.localKeyId,o=r[i]||{};if(n.type===Zn.pki.oids.certBag){let a=s?"cert":"ca";n.cert?o={...o,[a]:Zn.pki.certificateToPem(n.cert).replace(/\r\n/g,` +`)}:n.asn1&&(o={...o,[a]:IN(n.asn1,"CERTIFICATE").replace(/\r\n/g,` +`)})}return n.key?o={...o,key:wH(n.key).replace(/\r\n/g,` +`)}:n.asn1&&n.hasOwnProperty("key")&&(o={...o,key:IN(n.asn1,"PRIVATE KEY").replace(/\r\n/g,` +`)}),{...r,[i]:o}},{})}};c(xE,"PKCS12Parser");var wE=xE,wH=c((t,e)=>Zn.pki.privateKeyInfoToPem(Zn.pki.wrapRsaPrivateKey(Zn.pki.privateKeyToAsn1(t))),"privateKeyToPem"),IN=c((t,e)=>{let r={type:e,body:Zn.asn1.toDer(t).getBytes()};return Zn.pem.encode(r)},"derToPem");AN.exports=wE});var Bc=_((ree,RN)=>{var BN=Rs(),xH=Io(),In=class In{constructor(e){this.tag=null,this.length=0,this.data=null,this.buffer=null,this.buffer=xH(e.buffer,e.offset),this.init(e)}init(e){this.tag=e.readByte();let r=e.buffer.readUInt8(e.offset);if(this.length=In.getLength(e),this.length===-1){let n=e.available(),i=2,s=new OutputStream(Buffer.alloc(n+i));throw s.write(this.tag),s.write(r),s.write(e.read(n)),new Error("Length is not defined. The DerIndefLenConverter.convert() has not been implemented yet")}this.data=new BN(e.read(this.length))}isConstructed(e){return(this.tag&32)==32?e?(tag&31)==e:!0:!1}static getLength(e){let r=e.readByte();if(!(r&128))return r;let n=r&127;if(n===0)return-1;if(n<0)throw new Error("Incorrect DER encodding");if(n>4)throw new Error("DER length too big");let i;for(i=0;n>0;n--)i<<=8,i+=255&e.readByte();if(i<0)throw new Error("Invalid length byte");return i}getBigInteger(){let e=this.data;if(e.readByte()!=In.tag_Integer)throw new Error("DER input, Integer tag error");let r=In.getLength(e);return r<=1?e.readByte():r===2?e.readShort():r<=4?e.readInt():e.readLong()}getOctetString(){if(this.tag!==In.tag_OctetString&&!this.isConstructed(In.tag_OctetString))throw new Error("DerValue.getOctetString, not an Octet String: "+derValue.tag);let e=new BN(this.buffer),r=Buffer.from([]);for(;e.available();){let n=e.readByte();if(n!==In.tag_OctetString)throw new Error("DER input not an octet string: "+n);let i=In.getLength(e),s=e.read(i);r=Buffer.concat([r,s])}return r}getDerValue(){return new In(this.data)}};c(In,"DerValue");var Ms=In;Ms.tag_ObjectId=6;Ms.tag_Sequence=48;Ms.tag_OctetString=4;Ms.tag_Integer=2;RN.exports=Ms});var bE=_((iee,DN)=>{var ON=Bc(),_E=class _E{constructor(e){let r=e.readByte();if(r!==ON.tag_ObjectId)throw new Error("data isn't an object ID ( tag = "+r+")");let n=ON.getLength(e);this.encoding=e.read(n)}toString(){let e=this.encoding.length,r="",n=0;for(let i=0;i{var TH=Rs(),_H=bE(),IE=Bc(),NE=class NE{constructor(e){let r=new IE(new TH(e)),n=new IE(r.data),i=new IE(r.data);this.alghorithmId=this.createAlghorithmId(n),this.octetString=i.getOctetString()}createAlghorithmId(e){return new _H(e.data).toString()}getAlgorithm(){return this.alghorithmId}getEncryptedData(){return this.octetString}};c(NE,"EncryptedPrivateKeyInfo");var AE=NE;PN.exports=AE});var wr=_((uee,$o)=>{var cee=require("crypto");$o.exports.linebrk=function(t,e){for(var r="",n=0;n+e0){if(r>=4)return t.readUIntBE(e,r);for(var n=0,i=e+r,s=0;i>e;i--,s+=2)n+=t[i-1]*Math.pow(16,s);return n}else return NaN};$o.exports._={isObject:function(t){var e=typeof t;return!!t&&(e=="object"||e=="function")},isString:function(t){return typeof t=="string"||t instanceof String},isNumber:function(t){return typeof t=="number"||!isNaN(parseFloat(t))&&isFinite(t)},omit:function(t,e){var r={};for(var n in t)!t.hasOwnProperty(n)||n===e||(r[n]=t[n]);return r}};$o.exports.trimSurroundingText=function(t,e,r){var n=0,i=t.length,s=t.indexOf(e);s>=0&&(n=s+e.length);var o=t.indexOf(r,s);return o>=0&&(i=o),t.substring(n,i)}});var $s=_((fee,VN)=>{var bH=require("crypto"),IH=wr()._,Go,AH=0xdeadbeefcafe,lee=(AH&16777215)==15715070;function $(t,e){t!=null&&(typeof t=="number"?this.fromNumber(t,e):Buffer.isBuffer(t)?this.fromBuffer(t):e==null&&typeof t!="string"?this.fromByteArray(t):this.fromString(t,e))}c($,"BigInteger");function De(){return new $(null)}c(De,"nbi");function NH(t,e,r,n,i,s){for(var o=e&16383,a=e>>14;--s>=0;){var u=this[t]&16383,l=this[t++]>>14,f=a*u+l*o;u=o*u+((f&16383)<<14)+r[n]+i,i=(u>>28)+(f>>14)+a*l,r[n++]=u&268435455}return i}c(NH,"am3");$.prototype.am=NH;Go=28;$.prototype.DB=Go;$.prototype.DM=(1<=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}c(RH,"bnpCopyTo");function OH(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+DV:this.t=0}c(OH,"bnpFromInt");function zi(t){var e=De();return e.fromInt(t),e}c(zi,"nbv");function DH(t,e,r){var n;switch(e){case 2:n=1;break;case 4:n=2;break;case 8:n=3;break;case 16:n=4;break;case 32:n=5;break;case 256:n=8;break;default:this.fromRadix(t,e);return}this.t=0,this.s=0;for(var i=t.length,s=!1,o=0;--i>=0;){var a=n==8?t[i]&255:kN(t,i);if(a<0){t.charAt(i)=="-"&&(s=!0);continue}s=!1,o===0?this[this.t++]=a:o+n>this.DB?(this[this.t-1]|=(a&(1<>this.DB-o):this[this.t-1]|=a<=this.DB&&(o-=this.DB)}!r&&n==8&&t[0]&128&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t}c(kH,"bnpClamp");function FH(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var r=(1<0)for(a>a)>0&&(i=!0,s=BE(n));o>=0;)a>(a+=this.DB-e)):(n=this[o]>>(a-=e)&r,a<=0&&(a+=this.DB,--o)),n>0&&(i=!0),i&&(s+=BE(n));return i?s:"0"}c(FH,"bnToString");function qH(){var t=De();return $.ZERO.subTo(this,t),t}c(qH,"bnNegate");function UH(){return this.s<0?this.negate():this}c(UH,"bnAbs");function VH(t){var e=this.s-t.s;if(e!=0)return e;var r=this.t;if(e=r-t.t,e!=0)return this.s<0?-e:e;for(;--r>=0;)if((e=this[r]-t[r])!=0)return e;return 0}c(VH,"bnCompareTo");function gf(t){var e=1,r;return(r=t>>>16)!=0&&(t=r,e+=16),(r=t>>8)!=0&&(t=r,e+=8),(r=t>>4)!=0&&(t=r,e+=4),(r=t>>2)!=0&&(t=r,e+=2),(r=t>>1)!=0&&(t=r,e+=1),e}c(gf,"nbits");function MH(){return this.t<=0?0:this.DB*(this.t-1)+gf(this[this.t-1]^this.s&this.DM)}c(MH,"bnBitLength");function KH(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s}c(KH,"bnpDLShiftTo");function HH(t,e){for(var r=t;r=0;--a)e[a+s+1]=this[a]>>n|o,o=(this[a]&i)<=0;--a)e[a]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()}c($H,"bnpLShiftTo");function GH(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t){e.t=0;return}var n=t%this.DB,i=this.DB-n,s=(1<>n;for(var o=r+1;o>n;n>0&&(e[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()}c(jH,"bnpSubTo");function zH(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()}c(WH,"bnpSquareTo");function QH(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var l=s.t,f=s[l-1];if(f!==0){var h=f*(1<1?s[l-2]>>this.F2:0),p=this.FV/h,g=(1<=0&&(r[r.t++]=1,r.subTo(m,r)),$.ONE.dlShiftTo(l,m),m.subTo(s,s);s.t=0;){var w=r[--y]==f?this.DM:Math.floor(r[y]*p+(r[y-1]+d)*g);if((r[y]+=s.am(0,w,r,v,0,l))0&&r.rShiftTo(u,r),o<0&&$.ZERO.subTo(r,r)}}}c(QH,"bnpDivRemTo");function YH(t){var e=De();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo($.ZERO)>0&&t.subTo(e,e),e}c(YH,"bnMod");function Ks(t){this.m=t}c(Ks,"Classic");function ZH(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}c(ZH,"cConvert");function XH(t){return t}c(XH,"cRevert");function JH(t){t.divRemTo(this.m,null,t)}c(JH,"cReduce");function e9(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(e9,"cMulTo");function t9(t,e){t.squareTo(e),this.reduce(e)}c(t9,"cSqrTo");Ks.prototype.convert=ZH;Ks.prototype.revert=XH;Ks.prototype.reduce=JH;Ks.prototype.mulTo=e9;Ks.prototype.sqrTo=t9;function r9(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}c(r9,"bnpInvDigit");function Hs(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}c(n9,"montConvert");function i9(t){var e=De();return t.copyTo(e),this.reduce(e),e}c(i9,"montRevert");function s9(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t[r]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}c(s9,"montReduce");function o9(t,e){t.squareTo(e),this.reduce(e)}c(o9,"montSqrTo");function a9(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(a9,"montMulTo");Hs.prototype.convert=n9;Hs.prototype.revert=i9;Hs.prototype.reduce=s9;Hs.prototype.mulTo=a9;Hs.prototype.sqrTo=o9;function c9(){return(this.t>0?this[0]&1:this.s)===0}c(c9,"bnpIsEven");function u9(t,e){if(t>4294967295||t<1)return $.ONE;var r=De(),n=De(),i=e.convert(this),s=gf(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var o=r;r=n,n=o}return e.revert(r)}c(u9,"bnpExp");function l9(t,e){var r;return t<256||e.isEven()?r=new Ks(e):r=new Hs(e),this.exp(t,r)}c(l9,"bnModPowInt");function f9(){var t=De();return this.copyTo(t),t}c(f9,"bnClone");function h9(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t===0)return-1}else{if(this.t==1)return this[0];if(this.t===0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}c(d9,"bnByteValue");function p9(){return this.t==0?this.s:this[0]<<16>>16}c(p9,"bnShortValue");function g9(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}c(g9,"bnpChunkSize");function y9(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}c(y9,"bnSigNum");function m9(t){if(t==null&&(t=10),this.signum()===0||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=zi(r),i=De(),s=De(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o}c(m9,"bnpToRadix");function v9(t,e){this.fromInt(0),e==null&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,o=0,a=0;a=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(o,0)),i&&$.ZERO.subTo(this,this)}c(v9,"bnpFromRadix");function E9(t,e){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t),this.testBit(t-1)||this.bitwiseTo($.ONE.shiftLeft(t-1),OE,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo($.ONE.shiftLeft(t-1),this);else{var r=bH.randomBytes((t>>3)+1),n=t&7;n>0?r[0]&=(1<0)for(r>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<=0;)r<8?(n=(this[t]&(1<>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),n&128&&(n|=-256),i===0&&(this.s&128)!=(n&128)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e}c(S9,"bnToByteArray");function C9(t){var e=Buffer.from(this.toByteArray());if(t===!0&&e[0]===0)e=e.slice(1);else if(IH.isNumber(t)){if(e.length>t){for(var r=0;r0?this:t}c(T9,"bnMax");function _9(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}c(P9,"lbit");function L9(){for(var t=0;t=this.t?this.s!=0:(this[e]&1<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()}c(H9,"bnpAddTo");function $9(t){var e=De();return this.addTo(t,e),e}c($9,"bnAdd");function G9(t){var e=De();return this.subTo(t,e),e}c(G9,"bnSubtract");function j9(t){var e=De();return this.multiplyTo(t,e),e}c(j9,"bnMultiply");function z9(){var t=De();return this.squareTo(t),t}c(z9,"bnSquare");function W9(t){var e=De();return this.divRemTo(t,e,null),e}c(W9,"bnDivide");function Q9(t){var e=De();return this.divRemTo(t,null,e),e}c(Q9,"bnRemainder");function Y9(t){var e=De(),r=De();return this.divRemTo(t,e,r),new Array(e,r)}c(Y9,"bnDivideAndRemainder");function Z9(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}c(Z9,"bnpDMultiply");function X9(t,e){if(t!==0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}c(X9,"bnpDAddOffset");function Rc(){}c(Rc,"NullExp");function UN(t){return t}c(UN,"nNop");function J9(t,e,r){t.multiplyTo(e,r)}c(J9,"nMulTo");function e$(t,e){t.squareTo(e)}c(e$,"nSqrTo");Rc.prototype.convert=UN;Rc.prototype.revert=UN;Rc.prototype.mulTo=J9;Rc.prototype.sqrTo=e$;function t$(t){return this.exp(t,new Rc)}c(t$,"bnPow");function r$(t,e,r){var n=Math.min(this.t+t.t,e);for(r.s=0,r.t=n;n>0;)r[--n]=0;var i;for(i=r.t-this.t;n=0;)r[n]=0;for(n=Math.max(e-this.t,0);n2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=De();return t.copyTo(e),this.reduce(e),e}c(i$,"barrettConvert");function s$(t){return t}c(s$,"barrettRevert");function o$(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}c(o$,"barrettReduce");function a$(t,e){t.squareTo(e),this.reduce(e)}c(a$,"barrettSqrTo");function c$(t,e,r){t.multiplyTo(e,r),this.reduce(r)}c(c$,"barrettMulTo");zo.prototype.convert=i$;zo.prototype.revert=s$;zo.prototype.reduce=o$;zo.prototype.mulTo=c$;zo.prototype.sqrTo=a$;function u$(t,e){var r=t.bitLength(),n,i=zi(1),s;if(r<=0)return i;r<18?n=1:r<48?n=3:r<144?n=4:r<768?n=5:n=6,r<8?s=new Ks(e):e.isEven()?s=new zo(e):s=new Hs(e);var o=new Array,a=3,u=n-1,l=(1<1){var f=De();for(s.sqrTo(o[1],f);a<=l;)o[a]=De(),s.mulTo(f,o[a-2],o[a]),a+=2}var h=t.t-1,p,g=!0,d=De(),y;for(r=gf(t[h])-1;h>=0;){for(r>=u?p=t[h]>>r-u&l:(p=(t[h]&(1<0&&(p|=t[h-1]>>this.DB+r-u)),a=n;!(p&1);)p>>=1,--a;if((r-=a)<0&&(r+=this.DB,--h),g)o[p].copyTo(i),g=!1;else{for(;a>1;)s.sqrTo(i,d),s.sqrTo(d,i),a-=2;a>0?s.sqrTo(i,d):(y=i,i=d,d=y),s.mulTo(d,o[p],i)}for(;h>=0&&!(t[h]&1<0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r}c(l$,"bnGCD");function f$(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(e===0)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r}c(f$,"bnpModInt");function h$(t){var e=t.isEven();if(this.isEven()&&e||t.signum()===0)return $.ZERO;for(var r=t.clone(),n=this.clone(),i=zi(1),s=zi(0),o=zi(0),a=zi(1);r.signum()!=0;){for(;r.isEven();)r.rShiftTo(1,r),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?((!o.isEven()||!a.isEven())&&(o.addTo(this,o),a.subTo(t,a)),o.rShiftTo(1,o)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(o,i),s.subTo(a,s)):(n.subTo(r,n),e&&o.subTo(i,o),a.subTo(s,a))}if(n.compareTo($.ONE)!=0)return $.ZERO;if(a.compareTo(t)>=0)return a.subtract(t);if(a.signum()<0)a.addTo(t,a);else return a;return a.signum()<0?a.add(t):a}c(h$,"bnModInverse");var xr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],d$=(1<<26)/xr[xr.length-1];function p$(t){var e,r=this.abs();if(r.t==1&&r[0]<=xr[xr.length-1]){for(e=0;e>1,t>xr.length&&(t=xr.length);for(var i=De(),s=0;s{var MN=$s(),Wo=require("crypto"),yf=require("constants"),y$={md2:Buffer.from("3020300c06082a864886f70d020205000410","hex"),md5:Buffer.from("3020300c06082a864886f70d020505000410","hex"),sha1:Buffer.from("3021300906052b0e03021a05000414","hex"),sha224:Buffer.from("302d300d06096086480165030402040500041c","hex"),sha256:Buffer.from("3031300d060960864801650304020105000420","hex"),sha384:Buffer.from("3041300d060960864801650304020205000430","hex"),sha512:Buffer.from("3051300d060960864801650304020305000440","hex"),ripemd160:Buffer.from("3021300906052b2403020105000414","hex"),rmd160:Buffer.from("3021300906052b2403020105000414","hex")},KN={ripemd160:"rmd160"},HN="sha256";DE.exports={isEncryption:!0,isSignature:!0};DE.exports.makeScheme=function(t,e){function r(n,i){this.key=n,this.options=i}return c(r,"Scheme"),r.prototype.maxMessageLength=function(){return this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==yf.RSA_NO_PADDING?this.key.encryptedDataLength:this.key.encryptedDataLength-11},r.prototype.encPad=function(n,i){i=i||{};var s;if(n.length>this.key.maxMessageLength)throw new Error("Message too long for RSA (n="+this.key.encryptedDataLength+", l="+n.length+")");if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==yf.RSA_NO_PADDING)return s=Buffer.alloc(this.key.maxMessageLength-n.length),s.fill(0),Buffer.concat([s,n]);if(i.type===1)return s=Buffer.alloc(this.key.encryptedDataLength-n.length-1),s.fill(255,0,s.length-1),s[0]=1,s[s.length-1]=0,Buffer.concat([s,n]);s=Buffer.alloc(this.key.encryptedDataLength-n.length),s[0]=0,s[1]=2;for(var o=Wo.randomBytes(s.length-3),a=0;a=n.length)return null}else{if(n[0]!==0||n[1]!==2)return null;for(s=3;n[s]!==0;)if(++s>=n.length)return null}return n.slice(s+1,n.length)},r.prototype.sign=function(n){var i=this.options.signingSchemeOptions.hash||HN;if(this.options.environment==="browser"){i=KN[i]||i;var s=Wo.createHash(i);s.update(n);var o=this.pkcs1pad(s.digest(),i),a=this.key.$doPrivate(new MN(o)).toBuffer(this.key.encryptedDataLength);return a}else{var u=Wo.createSign("RSA-"+i.toUpperCase());return u.update(n),u.sign(this.options.rsaUtils.exportKey("private"))}},r.prototype.verify=function(n,i,s){if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==yf.RSA_NO_PADDING)return!1;var o=this.options.signingSchemeOptions.hash||HN;if(this.options.environment==="browser"){o=KN[o]||o,s&&(i=Buffer.from(i,s));var a=Wo.createHash(o);a.update(n);var u=this.pkcs1pad(a.digest(),o),l=this.key.$doPublic(new MN(i));return l.toBuffer().toString("hex")==u.toString("hex")}else{var f=Wo.createVerify("RSA-"+o.toUpperCase());return f.update(n),f.verify(this.options.rsaUtils.exportKey("public"),i,s)}},r.prototype.pkcs0pad=function(n){var i=Buffer.alloc(this.key.maxMessageLength-n.length);return i.fill(0),Buffer.concat([i,n])},r.prototype.pkcs0unpad=function(n){var i;return typeof n.lastIndexOf=="function"?i=n.slice(n.lastIndexOf("\0")+1,n.length):i=n.slice(String.prototype.lastIndexOf.call(n,"\0")+1,n.length),i},r.prototype.pkcs1pad=function(n,i){var s=y$[i];if(!s)throw Error("Unsupported hash algorithm");var o=Buffer.concat([s,n]);if(o.length+10>this.key.encryptedDataLength)throw Error("Key is too short for signing algorithm ("+i+")");var a=Buffer.alloc(this.key.encryptedDataLength-o.length-1);a.fill(255,0,a.length-1),a[0]=1,a[a.length-1]=0;var u=Buffer.concat([a,o]);return u},new r(t,e)}});var GN=_((yee,An)=>{var gee=$s(),mf=require("crypto");An.exports={isEncryption:!0,isSignature:!1};An.exports.digestLength={md4:16,md5:16,ripemd160:20,rmd160:20,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64};var vf="sha1";An.exports.eme_oaep_mgf1=function(t,e,r){r=r||vf;for(var n=An.exports.digestLength[r],i=Math.ceil(e/n),s=Buffer.alloc(n*i),o=Buffer.alloc(4),a=0;aa-2*u-2)throw new Error("Message is too long to encode into an encoded message with a length of "+a+" bytes, increaseemLen to fix this error (minimum value for given parameters and options: "+(a-2*u-2)+")");var l=mf.createHash(i);l.update(o),l=l.digest();var f=Buffer.alloc(a-n.length-2*u-1);f.fill(0),f[f.length-1]=1;for(var h=Buffer.concat([l,f,n]),p=mf.randomBytes(u),g=s(p,h.length,i),d=0;d{var jN=$s(),Oc=require("crypto");PE.exports={isEncryption:!1,isSignature:!0};var Ef="sha1",zN=20;PE.exports.makeScheme=function(t,e){var r=Gs().pkcs1_oaep;function n(i,s){this.key=i,this.options=s}return c(n,"Scheme"),n.prototype.sign=function(i){var s=Oc.createHash(this.options.signingSchemeOptions.hash||Ef);s.update(i);var o=this.emsa_pss_encode(s.digest(),this.key.keySize-1);return this.key.$doPrivate(new jN(o)).toBuffer(this.key.encryptedDataLength)},n.prototype.verify=function(i,s,o){o&&(s=Buffer.from(s,o)),s=new jN(s);var a=Math.ceil((this.key.keySize-1)/8),u=this.key.$doPublic(s).toBuffer(a),l=Oc.createHash(this.options.signingSchemeOptions.hash||Ef);return l.update(i),this.emsa_pss_verify(l.digest(),u,this.key.keySize-1)},n.prototype.emsa_pss_encode=function(i,s){var o=this.options.signingSchemeOptions.hash||Ef,a=this.options.signingSchemeOptions.mgf||r.eme_oaep_mgf1,u=this.options.signingSchemeOptions.saltLength||zN,l=r.digestLength[o],f=Math.ceil(s/8);if(f>8-x<<8-x;m[0]=m[0]&A;var O=Buffer.alloc(m.length+g.length+1);return m.copy(O,0),g.copy(O,m.length),O[O.length-1]=188,O},n.prototype.emsa_pss_verify=function(i,s,o){var a=this.options.signingSchemeOptions.hash||Ef,u=this.options.signingSchemeOptions.mgf||r.eme_oaep_mgf1,l=this.options.signingSchemeOptions.saltLength||zN,f=r.digestLength[a],h=Math.ceil(o/8);if(h>8-y<<8-y,p[0]=p[0]&g,d=0;p[d]===0&&d{Qo.exports={pkcs1:$N(),pkcs1_oaep:GN(),pss:WN(),isEncryption:function(t){return Qo.exports[t]&&Qo.exports[t].isEncryption},isSignature:function(t){return Qo.exports[t]&&Qo.exports[t].isSignature}}});var kE=_((Cee,QN)=>{var LE=$s(),m$=Gs();QN.exports=function(t,e){var r=m$.pkcs1.makeScheme(t,e);return{encrypt:function(n,i){var s,o;return i?(s=new LE(r.encPad(n,{type:1})),o=t.$doPrivate(s)):(s=new LE(t.encryptionScheme.encPad(n)),o=t.$doPublic(s)),o.toBuffer(t.encryptedDataLength)},decrypt:function(n,i){var s,o=new LE(n);return i?(s=t.$doPublic(o),r.encUnPad(s.toBuffer(t.encryptedDataLength),{type:1})):(s=t.$doPrivate(o),t.encryptionScheme.encUnPad(s.toBuffer(t.encryptedDataLength)))}}}});var ZN=_((wee,YN)=>{var Sf=require("crypto"),Wi=require("constants"),v$=Gs();YN.exports=function(t,e){var r=v$.pkcs1.makeScheme(t,e);return{encrypt:function(n,i){var s;if(i)return s=Wi.RSA_PKCS1_PADDING,e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding),Sf.privateEncrypt({key:e.rsaUtils.exportKey("private"),padding:s},n);s=Wi.RSA_PKCS1_OAEP_PADDING,e.encryptionScheme==="pkcs1"&&(s=Wi.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding);var o=n;return s===Wi.RSA_NO_PADDING&&(o=r.pkcs0pad(n)),Sf.publicEncrypt({key:e.rsaUtils.exportKey("public"),padding:s},o)},decrypt:function(n,i){var s;if(i)return s=Wi.RSA_PKCS1_PADDING,e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding),Sf.publicDecrypt({key:e.rsaUtils.exportKey("public"),padding:s},n);s=Wi.RSA_PKCS1_OAEP_PADDING,e.encryptionScheme==="pkcs1"&&(s=Wi.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding);var o=Sf.privateDecrypt({key:e.rsaUtils.exportKey("private"),padding:s},n);return s===Wi.RSA_NO_PADDING?r.pkcs0unpad(o):o}}}});var eB=_((xee,JN)=>{var XN=require("crypto"),Yo=require("constants"),E$=Gs();JN.exports=function(t,e){var r=kE()(t,e),n=E$.pkcs1.makeScheme(t,e);return{encrypt:function(i,s){if(s)return r.encrypt(i,s);var o=Yo.RSA_PKCS1_OAEP_PADDING;e.encryptionScheme==="pkcs1"&&(o=Yo.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(o=e.encryptionSchemeOptions.padding);var a=i;return o===Yo.RSA_NO_PADDING&&(a=n.pkcs0pad(i)),XN.publicEncrypt({key:e.rsaUtils.exportKey("public"),padding:o},a)},decrypt:function(i,s){if(s)return r.decrypt(i,s);var o=Yo.RSA_PKCS1_OAEP_PADDING;e.encryptionScheme==="pkcs1"&&(o=Yo.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(o=e.encryptionSchemeOptions.padding);var a=XN.privateDecrypt({key:e.rsaUtils.exportKey("private"),padding:o},i);return o===Yo.RSA_NO_PADDING?n.pkcs0unpad(a):a}}}});var rB=_((Tee,tB)=>{var Cf=require("crypto");tB.exports={getEngine:function(t,e){var r=kE();return e.environment==="node"&&typeof Cf.publicEncrypt=="function"&&typeof Cf.privateDecrypt=="function"&&(typeof Cf.privateEncrypt=="function"&&typeof Cf.publicDecrypt=="function"?r=ZN():r=eB()),r(t,e)}}});var aB=_((sB,oB)=>{var wf=wr()._,_ee=require("crypto"),Rt=$s(),nB=wr(),iB=Gs(),S$=rB();sB.BigInteger=Rt;oB.exports.Key=function(){function t(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return c(t,"RSAKey"),t.prototype.setOptions=function(e){var r=iB[e.signingScheme],n=iB[e.encryptionScheme];r===n?this.signingScheme=this.encryptionScheme=n.makeScheme(this,e):(this.encryptionScheme=n.makeScheme(this,e),this.signingScheme=r.makeScheme(this,e)),this.encryptEngine=S$.getEngine(this,e)},t.prototype.generate=function(e,r){var n=e>>1;this.e=parseInt(r,16);for(var i=new Rt(r,16);;){for(;this.p=new Rt(e-n,1),!(this.p.subtract(Rt.ONE).gcd(i).compareTo(Rt.ONE)===0&&this.p.isProbablePrime(10)););for(;this.q=new Rt(n,1),!(this.q.subtract(Rt.ONE).gcd(i).compareTo(Rt.ONE)===0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(Rt.ONE),a=this.q.subtract(Rt.ONE),u=o.multiply(a);if(u.gcd(i).compareTo(Rt.ONE)===0){if(this.n=this.p.multiply(this.q),this.n.bitLength()0&&(wf.isNumber(r)||r.length>0)&&n.length>0)this.n=new Rt(e),this.e=wf.isNumber(r)?r:nB.get32IntFromBuffer(r,0),this.d=new Rt(n),i&&s&&o&&a&&u&&(this.p=new Rt(i),this.q=new Rt(s),this.dmp1=new Rt(o),this.dmq1=new Rt(a),this.coeff=new Rt(u)),this.$$recalculateCache();else throw Error("Invalid RSA private key")},t.prototype.setPublic=function(e,r){if(e&&r&&e.length>0&&(wf.isNumber(r)||r.length>0))this.n=new Rt(e),this.e=wf.isNumber(r)?r:nB.get32IntFromBuffer(r,0),this.$$recalculateCache();else throw Error("Invalid RSA public key")},t.prototype.$doPrivate=function(e){if(this.p||this.q)return e.modPow(this.d,this.n);for(var r=e.mod(this.p).modPow(this.dmp1,this.p),n=e.mod(this.q).modPow(this.dmq1,this.q);r.compareTo(n)<0;)r=r.add(this.p);return r.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},t.prototype.$doPublic=function(e){return e.modPowInt(this.e,this.n)},t.prototype.encrypt=function(e,r){var n=[],i=[],s=e.length,o=Math.ceil(s/this.maxMessageLength)||1,a=Math.ceil(s/o||1);if(o==1)n.push(e);else for(var u=0;u0)throw Error("Incorrect data or key");for(var n=[],i=0,s=0,o=e.length/this.encryptedDataLength,a=0;a>3},t}()});var xf=_((Iee,cB)=>{cB.exports={newInvalidAsn1Error:function(t){var e=new Error;return e.name="InvalidAsn1Error",e.message=t||"",e}}});var Tf=_((Aee,uB)=>{uB.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}});var FE=_((Nee,lB)=>{"use strict";var _f=require("buffer"),Zo=_f.Buffer,fn={},hn;for(hn in _f)_f.hasOwnProperty(hn)&&(hn==="SlowBuffer"||hn==="Buffer"||(fn[hn]=_f[hn]));var Xo=fn.Buffer={};for(hn in Zo)Zo.hasOwnProperty(hn)&&(hn==="allocUnsafe"||hn==="allocUnsafeSlow"||(Xo[hn]=Zo[hn]));fn.Buffer.prototype=Zo.prototype;(!Xo.from||Xo.from===Uint8Array.from)&&(Xo.from=function(t,e,r){if(typeof t=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof t);if(t&&typeof t.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);return Zo(t,e,r)});Xo.alloc||(Xo.alloc=function(t,e,r){if(typeof t!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof t);if(t<0||t>=2*(1<<30))throw new RangeError('The value "'+t+'" is invalid for option "size"');var n=Zo(t);return!e||e.length===0?n.fill(0):typeof r=="string"?n.fill(e,r):n.fill(e),n});if(!fn.kStringMaxLength)try{fn.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch{}fn.constants||(fn.constants={MAX_LENGTH:fn.kMaxLength},fn.kStringMaxLength&&(fn.constants.MAX_STRING_LENGTH=fn.kStringMaxLength));lB.exports=fn});var dB=_((Bee,hB)=>{var C$=require("assert"),fB=FE().Buffer,Dc=Tf(),w$=xf(),Jo=w$.newInvalidAsn1Error;function Tr(t){if(!t||!fB.isBuffer(t))throw new TypeError("data must be a node Buffer");this._buf=t,this._size=t.length,this._len=0,this._offset=0}c(Tr,"Reader");Object.defineProperty(Tr.prototype,"length",{enumerable:!0,get:function(){return this._len}});Object.defineProperty(Tr.prototype,"offset",{enumerable:!0,get:function(){return this._offset}});Object.defineProperty(Tr.prototype,"remain",{get:function(){return this._size-this._offset}});Object.defineProperty(Tr.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}});Tr.prototype.readByte=function(t){if(this._size-this._offset<1)return null;var e=this._buf[this._offset]&255;return t||(this._offset+=1),e};Tr.prototype.peek=function(){return this.readByte(!0)};Tr.prototype.readLength=function(t){if(t===void 0&&(t=this._offset),t>=this._size)return null;var e=this._buf[t++]&255;if(e===null)return null;if((e&128)===128){if(e&=127,e===0)throw Jo("Indefinite length not supported");if(e>4)throw Jo("encoding too long");if(this._size-tthis._size-n)return null;if(this._offset=n,this.length===0)return e?fB.alloc(0):"";var i=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,e?i:i.toString("utf8")};Tr.prototype.readOID=function(t){t||(t=Dc.OID);var e=this.readString(t,!0);if(e===null)return null;for(var r=[],n=0,i=0;i>0),r.join(".")};Tr.prototype._readTag=function(t){C$.ok(t!==void 0);var e=this.peek();if(e===null)return null;if(e!==t)throw Jo("Expected 0x"+t.toString(16)+": got 0x"+e.toString(16));var r=this.readLength(this._offset+1);if(r===null)return null;if(this.length>4)throw Jo("Integer too long: "+this.length);if(this.length>this._size-r)return null;this._offset=r;for(var n=this._buf[this._offset],i=0,s=0;s>0};hB.exports=Tr});var gB=_((Oee,pB)=>{var Qi=require("assert"),bf=FE().Buffer,Yi=Tf(),x$=xf(),If=x$.newInvalidAsn1Error,T$={size:1024,growthFactor:8};function _$(t,e){Qi.ok(t),Qi.equal(typeof t,"object"),Qi.ok(e),Qi.equal(typeof e,"object");var r=Object.getOwnPropertyNames(t);return r.forEach(function(n){if(!e[n]){var i=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,i)}}),e}c(_$,"merge");function lr(t){t=_$(T$,t||{}),this._buf=bf.alloc(t.size||1024),this._size=this._buf.length,this._offset=0,this._options=t,this._seq=[]}c(lr,"Writer");Object.defineProperty(lr.prototype,"buffer",{get:function(){if(this._seq.length)throw If(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}});lr.prototype.writeByte=function(t){if(typeof t!="number")throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=t};lr.prototype.writeInt=function(t,e){if(typeof t!="number")throw new TypeError("argument must be a Number");typeof e!="number"&&(e=Yi.Integer);for(var r=4;(!(t&4286578688)||(t&4286578688)===-8388608)&&r>1;)r--,t<<=8;if(r>4)throw If("BER ints cannot be > 0xffffffff");for(this._ensure(2+r),this._buf[this._offset++]=e,this._buf[this._offset++]=r;r-- >0;)this._buf[this._offset++]=(t&4278190080)>>>24,t<<=8};lr.prototype.writeNull=function(){this.writeByte(Yi.Null),this.writeByte(0)};lr.prototype.writeEnumeration=function(t,e){if(typeof t!="number")throw new TypeError("argument must be a Number");return typeof e!="number"&&(e=Yi.Enumeration),this.writeInt(t,e)};lr.prototype.writeBoolean=function(t,e){if(typeof t!="boolean")throw new TypeError("argument must be a Boolean");typeof e!="number"&&(e=Yi.Boolean),this._ensure(3),this._buf[this._offset++]=e,this._buf[this._offset++]=1,this._buf[this._offset++]=t?255:0};lr.prototype.writeString=function(t,e){if(typeof t!="string")throw new TypeError("argument must be a string (was: "+typeof t+")");typeof e!="number"&&(e=Yi.OctetString);var r=bf.byteLength(t);this.writeByte(e),this.writeLength(r),r&&(this._ensure(r),this._buf.write(t,this._offset),this._offset+=r)};lr.prototype.writeBuffer=function(t,e){if(typeof e!="number")throw new TypeError("tag must be a number");if(!bf.isBuffer(t))throw new TypeError("argument must be a buffer");this.writeByte(e),this.writeLength(t.length),this._ensure(t.length),t.copy(this._buf,this._offset,0,t.length),this._offset+=t.length};lr.prototype.writeStringArray=function(t){if(!t instanceof Array)throw new TypeError("argument must be an Array[String]");var e=this;t.forEach(function(r){e.writeString(r)})};lr.prototype.writeOID=function(t,e){if(typeof t!="string")throw new TypeError("argument must be a string");if(typeof e!="number"&&(e=Yi.OID),!/^([0-9]+\.){3,}[0-9]+$/.test(t))throw new Error("argument is not a valid OID string");function r(o,a){a<128?o.push(a):a<16384?(o.push(a>>>7|128),o.push(a&127)):a<2097152?(o.push(a>>>14|128),o.push((a>>>7|128)&255),o.push(a&127)):a<268435456?(o.push(a>>>21|128),o.push((a>>>14|128)&255),o.push((a>>>7|128)&255),o.push(a&127)):(o.push((a>>>28|128)&255),o.push((a>>>21|128)&255),o.push((a>>>14|128)&255),o.push((a>>>7|128)&255),o.push(a&127))}c(r,"encodeOctet");var n=t.split("."),i=[];i.push(parseInt(n[0],10)*40+parseInt(n[1],10)),n.slice(2).forEach(function(o){r(i,parseInt(o,10))});var s=this;this._ensure(2+i.length),this.writeByte(e),this.writeLength(i.length),i.forEach(function(o){s.writeByte(o)})};lr.prototype.writeLength=function(t){if(typeof t!="number")throw new TypeError("argument must be a Number");if(this._ensure(4),t<=127)this._buf[this._offset++]=t;else if(t<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=t;else if(t<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=t>>8,this._buf[this._offset++]=t;else if(t<=16777215)this._buf[this._offset++]=131,this._buf[this._offset++]=t>>16,this._buf[this._offset++]=t>>8,this._buf[this._offset++]=t;else throw If("Length too long (> 4 bytes)")};lr.prototype.startSequence=function(t){typeof t!="number"&&(t=Yi.Sequence|Yi.Constructor),this.writeByte(t),this._seq.push(this._offset),this._ensure(3),this._offset+=3};lr.prototype.endSequence=function(){var t=this._seq.pop(),e=t+3,r=this._offset-e;if(r<=127)this._shift(e,r,-2),this._buf[t]=r;else if(r<=255)this._shift(e,r,-1),this._buf[t]=129,this._buf[t+1]=r;else if(r<=65535)this._buf[t]=130,this._buf[t+1]=r>>8,this._buf[t+2]=r;else if(r<=16777215)this._shift(e,r,1),this._buf[t]=131,this._buf[t+1]=r>>16,this._buf[t+2]=r>>8,this._buf[t+3]=r;else throw If("Sequence too long")};lr.prototype._shift=function(t,e,r){Qi.ok(t!==void 0),Qi.ok(e!==void 0),Qi.ok(r),this._buf.copy(this._buf,t+r,t,t+e),this._offset+=r};lr.prototype._ensure=function(t){if(Qi.ok(t),this._size-this._offset{var qE=xf(),UE=Tf(),b$=dB(),I$=gB();Bf.exports={Reader:b$,Writer:I$};for(Af in UE)UE.hasOwnProperty(Af)&&(Bf.exports[Af]=UE[Af]);var Af;for(Nf in qE)qE.hasOwnProperty(Nf)&&(Bf.exports[Nf]=qE[Nf]);var Nf});var Rf=_((Lee,mB)=>{var VE=yB();mB.exports={Ber:VE,BerReader:VE.Reader,BerWriter:VE.Writer}});var xB=_((kee,Pf)=>{var Of=Rf().Ber,vB=wr()._,Df=wr(),EB="-----BEGIN RSA PRIVATE KEY-----",SB="-----END RSA PRIVATE KEY-----",CB="-----BEGIN RSA PUBLIC KEY-----",wB="-----END RSA PUBLIC KEY-----";Pf.exports={privateExport:function(t,e){e=e||{};var r=t.n.toBuffer(),n=t.d.toBuffer(),i=t.p.toBuffer(),s=t.q.toBuffer(),o=t.dmp1.toBuffer(),a=t.dmq1.toBuffer(),u=t.coeff.toBuffer(),l=r.length+n.length+i.length+s.length+o.length+a.length+u.length+512,f=new Of.Writer({size:l});return f.startSequence(),f.writeInt(0),f.writeBuffer(r,2),f.writeInt(t.e),f.writeBuffer(n,2),f.writeBuffer(i,2),f.writeBuffer(s,2),f.writeBuffer(o,2),f.writeBuffer(a,2),f.writeBuffer(u,2),f.endSequence(),e.type==="der"?f.buffer:EB+` +`+Df.linebrk(f.buffer.toString("base64"),64)+` +`+SB},privateImport:function(t,e,r){r=r||{};var n;if(r.type!=="der")if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),vB.isString(e)){var i=Df.trimSurroundingText(e,EB,SB).replace(/\s+|\n\r|\n|\r$/gm,"");n=Buffer.from(i,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(e))n=e;else throw Error("Unsupported key format");var s=new Of.Reader(n);s.readSequence(),s.readString(2,!0),t.setPrivate(s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0))},publicExport:function(t,e){e=e||{};var r=t.n.toBuffer(),n=r.length+512,i=new Of.Writer({size:n});return i.startSequence(),i.writeBuffer(r,2),i.writeInt(t.e),i.endSequence(),e.type==="der"?i.buffer:CB+` +`+Df.linebrk(i.buffer.toString("base64"),64)+` +`+wB},publicImport:function(t,e,r){r=r||{};var n;if(r.type!=="der"){if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),vB.isString(e)){var i=Df.trimSurroundingText(e,CB,wB).replace(/\s+|\n\r|\n|\r$/gm,"");n=Buffer.from(i,"base64")}}else if(Buffer.isBuffer(e))n=e;else throw Error("Unsupported key format");var s=new Of.Reader(n);s.readSequence(),t.setPublic(s.readString(2,!0),s.readString(2,!0))},autoImport:function(t,e){return/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(e)?(Pf.exports.privateImport(t,e),!0):/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(e)?(Pf.exports.publicImport(t,e),!0):!1}}});var NB=_((Fee,Ff)=>{var Xn=Rf().Ber,TB=wr()._,Lf="1.2.840.113549.1.1.1",kf=wr(),_B="-----BEGIN PRIVATE KEY-----",bB="-----END PRIVATE KEY-----",IB="-----BEGIN PUBLIC KEY-----",AB="-----END PUBLIC KEY-----";Ff.exports={privateExport:function(t,e){e=e||{};var r=t.n.toBuffer(),n=t.d.toBuffer(),i=t.p.toBuffer(),s=t.q.toBuffer(),o=t.dmp1.toBuffer(),a=t.dmq1.toBuffer(),u=t.coeff.toBuffer(),l=r.length+n.length+i.length+s.length+o.length+a.length+u.length+512,f=new Xn.Writer({size:l});f.startSequence(),f.writeInt(0),f.writeBuffer(r,2),f.writeInt(t.e),f.writeBuffer(n,2),f.writeBuffer(i,2),f.writeBuffer(s,2),f.writeBuffer(o,2),f.writeBuffer(a,2),f.writeBuffer(u,2),f.endSequence();var h=new Xn.Writer({size:l});return h.startSequence(),h.writeInt(0),h.startSequence(),h.writeOID(Lf),h.writeNull(),h.endSequence(),h.writeBuffer(f.buffer,4),h.endSequence(),e.type==="der"?h.buffer:_B+` +`+kf.linebrk(h.buffer.toString("base64"),64)+` +`+bB},privateImport:function(t,e,r){r=r||{};var n;if(r.type!=="der")if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),TB.isString(e)){var i=kf.trimSurroundingText(e,_B,bB).replace("-----END PRIVATE KEY-----","").replace(/\s+|\n\r|\n|\r$/gm,"");n=Buffer.from(i,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(e))n=e;else throw Error("Unsupported key format");var s=new Xn.Reader(n);s.readSequence(),s.readInt(0);var o=new Xn.Reader(s.readString(48,!0));if(o.readOID(6,!0)!==Lf)throw Error("Invalid Public key format");var a=new Xn.Reader(s.readString(4,!0));a.readSequence(),a.readString(2,!0),t.setPrivate(a.readString(2,!0),a.readString(2,!0),a.readString(2,!0),a.readString(2,!0),a.readString(2,!0),a.readString(2,!0),a.readString(2,!0),a.readString(2,!0))},publicExport:function(t,e){e=e||{};var r=t.n.toBuffer(),n=r.length+512,i=new Xn.Writer({size:n});i.writeByte(0),i.startSequence(),i.writeBuffer(r,2),i.writeInt(t.e),i.endSequence();var s=new Xn.Writer({size:n});return s.startSequence(),s.startSequence(),s.writeOID(Lf),s.writeNull(),s.endSequence(),s.writeBuffer(i.buffer,3),s.endSequence(),e.type==="der"?s.buffer:IB+` +`+kf.linebrk(s.buffer.toString("base64"),64)+` +`+AB},publicImport:function(t,e,r){r=r||{};var n;if(r.type!=="der"){if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),TB.isString(e)){var i=kf.trimSurroundingText(e,IB,AB).replace(/\s+|\n\r|\n|\r$/gm,"");n=Buffer.from(i,"base64")}}else if(Buffer.isBuffer(e))n=e;else throw Error("Unsupported key format");var s=new Xn.Reader(n);s.readSequence();var o=new Xn.Reader(s.readString(48,!0));if(o.readOID(6,!0)!==Lf)throw Error("Invalid Public key format");var a=new Xn.Reader(s.readString(3,!0));a.readByte(),a.readSequence(),t.setPublic(a.readString(2,!0),a.readString(2,!0))},autoImport:function(t,e){return/^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(e)?(Ff.exports.privateImport(t,e),!0):/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(e)?(Ff.exports.publicImport(t,e),!0):!1}}});var BB=_((Vee,qf)=>{var qee=wr()._,Uee=wr();qf.exports={privateExport:function(t,e){return{n:t.n.toBuffer(),e:t.e,d:t.d.toBuffer(),p:t.p.toBuffer(),q:t.q.toBuffer(),dmp1:t.dmp1.toBuffer(),dmq1:t.dmq1.toBuffer(),coeff:t.coeff.toBuffer()}},privateImport:function(t,e,r){if(e.n&&e.e&&e.d&&e.p&&e.q&&e.dmp1&&e.dmq1&&e.coeff)t.setPrivate(e.n,e.e,e.d,e.p,e.q,e.dmp1,e.dmq1,e.coeff);else throw Error("Invalid key data")},publicExport:function(t,e){return{n:t.n.toBuffer(),e:t.e}},publicImport:function(t,e,r){if(e.n&&e.e)t.setPublic(e.n,e.e);else throw Error("Invalid key data")},autoImport:function(t,e){return e.n&&e.e?e.d&&e.p&&e.q&&e.dmp1&&e.dmq1&&e.coeff?(qf.exports.privateImport(t,e),!0):(qf.exports.publicImport(t,e),!0):!1}}});var LB=_((Mee,Uf)=>{var RB=wr()._,OB=wr(),Pc=$s(),DB="-----BEGIN OPENSSH PRIVATE KEY-----",PB="-----END OPENSSH PRIVATE KEY-----";Uf.exports={privateExport:function(t,e){let r=t.n.toBuffer(),n=Buffer.alloc(4);for(n.writeUInt32BE(t.e,0);n[0]===0;)n=n.slice(1);let i=t.d.toBuffer(),s=t.coeff.toBuffer(),o=t.p.toBuffer(),a=t.q.toBuffer(),u;typeof t.sshcomment<"u"?u=Buffer.from(t.sshcomment):u=Buffer.from([]);let l=15+n.byteLength+4+r.byteLength,f=23+r.byteLength+4+n.byteLength+4+i.byteLength+4+s.byteLength+4+o.byteLength+4+a.byteLength+4+u.byteLength,h=43+l+4+f,p=Math.ceil(f/8)*8-f;h+=p;let g=Buffer.alloc(h),d={buf:g,off:0};g.write("openssh-key-v1","utf8"),g.writeUInt8(0,14),d.off+=15,or(d,Buffer.from("none")),or(d,Buffer.from("none")),or(d,Buffer.from("")),d.off=d.buf.writeUInt32BE(1,d.off),d.off=d.buf.writeUInt32BE(l,d.off),or(d,Buffer.from("ssh-rsa")),or(d,n),or(d,r),d.off=d.buf.writeUInt32BE(h-47-l,d.off),d.off+=8,or(d,Buffer.from("ssh-rsa")),or(d,r),or(d,n),or(d,i),or(d,s),or(d,o),or(d,a),or(d,u);let y=1;for(;d.off{var Hee=wr()._;function kB(t){t=t.split("-");for(var e="private",r={type:"default"},n=1;n{var qB=require("constants"),A$=aB(),jee=require("crypto"),zee=Rf().Ber,$r=wr()._,N$=wr(),UB=Gs(),VB=FB();typeof qB.RSA_NO_PADDING>"u"&&(qB.RSA_NO_PADDING=3);MB.exports=function(){var t={node10:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],node:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],iojs:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],browser:["md5","ripemd160","sha1","sha256","sha512"]},e="pkcs1_oaep",r="pkcs1",n="private",i={private:"pkcs1-private-pem","private-der":"pkcs1-private-der",public:"pkcs8-public-pem","public-der":"pkcs8-public-der"};function s(o,a,u){if(!(this instanceof s))return new s(o,a,u);$r.isObject(a)&&(u=a,a=void 0),this.$options={signingScheme:r,signingSchemeOptions:{hash:"sha256",saltLength:null},encryptionScheme:e,encryptionSchemeOptions:{hash:"sha1",label:null},environment:N$.detectEnvironment(),rsaUtils:this},this.keyPair=new A$.Key,this.$cache={},Buffer.isBuffer(o)||$r.isString(o)?this.importKey(o,a):$r.isObject(o)&&this.generateKeyPair(o.b,o.e),this.setOptions(u)}return c(s,"NodeRSA"),s.prototype.setOptions=function(o){if(o=o||{},o.environment&&(this.$options.environment=o.environment),o.signingScheme){if($r.isString(o.signingScheme)){var a=o.signingScheme.toLowerCase().split("-");a.length==1?t.node.indexOf(a[0])>-1?(this.$options.signingSchemeOptions={hash:a[0]},this.$options.signingScheme=r):(this.$options.signingScheme=a[0],this.$options.signingSchemeOptions={hash:null}):(this.$options.signingSchemeOptions={hash:a[1]},this.$options.signingScheme=a[0])}else $r.isObject(o.signingScheme)&&(this.$options.signingScheme=o.signingScheme.scheme||r,this.$options.signingSchemeOptions=$r.omit(o.signingScheme,"scheme"));if(!UB.isSignature(this.$options.signingScheme))throw Error("Unsupported signing scheme");if(this.$options.signingSchemeOptions.hash&&t[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}if(o.encryptionScheme){if($r.isString(o.encryptionScheme)?(this.$options.encryptionScheme=o.encryptionScheme.toLowerCase(),this.$options.encryptionSchemeOptions={}):$r.isObject(o.encryptionScheme)&&(this.$options.encryptionScheme=o.encryptionScheme.scheme||e,this.$options.encryptionSchemeOptions=$r.omit(o.encryptionScheme,"scheme")),!UB.isEncryption(this.$options.encryptionScheme))throw Error("Unsupported encryption scheme");if(this.$options.encryptionSchemeOptions.hash&&t[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}this.keyPair.setOptions(this.$options)},s.prototype.generateKeyPair=function(o,a){if(o=o||2048,a=a||65537,o%8!==0)throw Error("Key size must be a multiple of 8.");return this.keyPair.generate(o,a.toString(16)),this.$cache={},this},s.prototype.importKey=function(o,a){if(!o)throw Error("Empty key given");if(a&&(a=i[a]||a),!VB.detectAndImport(this.keyPair,o,a)&&a===void 0)throw Error("Key format must be specified");return this.$cache={},this},s.prototype.exportKey=function(o){return o=o||n,o=i[o]||o,this.$cache[o]||(this.$cache[o]=VB.detectAndExport(this.keyPair,o)),this.$cache[o]},s.prototype.isPrivate=function(){return this.keyPair.isPrivate()},s.prototype.isPublic=function(o){return this.keyPair.isPublic(o)},s.prototype.isEmpty=function(o){return!(this.keyPair.n||this.keyPair.e||this.keyPair.d)},s.prototype.encrypt=function(o,a,u){return this.$$encryptKey(!1,o,a,u)},s.prototype.decrypt=function(o,a){return this.$$decryptKey(!1,o,a)},s.prototype.encryptPrivate=function(o,a,u){return this.$$encryptKey(!0,o,a,u)},s.prototype.decryptPublic=function(o,a){return this.$$decryptKey(!0,o,a)},s.prototype.$$encryptKey=function(o,a,u,l){try{var f=this.keyPair.encrypt(this.$getDataForEncrypt(a,l),o);return u=="buffer"||!u?f:f.toString(u)}catch(h){throw Error("Error during encryption. Original error: "+h)}},s.prototype.$$decryptKey=function(o,a,u){try{a=$r.isString(a)?Buffer.from(a,"base64"):a;var l=this.keyPair.decrypt(a,o);if(l===null)throw Error("Key decrypt method returns null.");return this.$getDecryptedData(l,u)}catch(f){throw Error("Error during decryption (probably incorrect key). Original error: "+f)}},s.prototype.sign=function(o,a,u){if(!this.isPrivate())throw Error("This is not private key");var l=this.keyPair.sign(this.$getDataForEncrypt(o,u));return a&&a!="buffer"&&(l=l.toString(a)),l},s.prototype.verify=function(o,a,u,l){if(!this.isPublic())throw Error("This is not public key");return l=!l||l=="buffer"?null:l,this.keyPair.verify(this.$getDataForEncrypt(o,u),a,l)},s.prototype.getKeySize=function(){return this.keyPair.keySize},s.prototype.getMaxMessageSize=function(){return this.keyPair.maxMessageLength},s.prototype.$getDataForEncrypt=function(o,a){if($r.isString(o)||$r.isNumber(o))return Buffer.from(""+o,a||"utf8");if(Buffer.isBuffer(o))return o;if($r.isObject(o))return Buffer.from(JSON.stringify(o));throw Error("Unexpected data type")},s.prototype.$getDecryptedData=function(o,a){return a=a||"buffer",a=="buffer"?o:a=="json"?JSON.parse(o.toString()):o.toString(a)},s}()});var GB=_((Yee,$B)=>{var HB=require("crypto"),B$=bE(),R$=Bc(),Zi=class Zi{static parseKey(e){if(e.tag!==R$.tag_Sequence)throw new Error("corrupt private key");let r=e.getBigInteger();if(r!==Zi.version)throw new Error("version mismatch: (supported "+this.version+", parsed: "+r);let n=e.getDerValue(),i=e.getDerValue(),s=new B$(n.data);if(Zi.supportedTypes.dsa===s.toString()||Zi.supportedTypes.ec===s.toString())return Zi.format(e.buffer);try{let o=i.getOctetString();return Zi.export(o)}catch(o){let a=new Error("Something went wrong with algorithm "+s.toString()+". For more details see 'error.context'");throw a.context=o,a}}static export(e){if(typeof HB.createPrivateKey=="function")return HB.createPrivateKey({key:e,format:"der",type:"pkcs1"}).export({format:"pem",type:"pkcs8"});{let r=KB();return new r(e,"pkcs1-der").exportKey("pkcs8-pem")+` +`}}static format(e){return`-----BEGIN PRIVATE KEY----- +`+e.toString("base64").match(/.{1,64}/g).join(` +`)+` +-----END PRIVATE KEY----- +`}};c(Zi,"PKCS8Key");var Lc=Zi;Lc.supportedTypes={rsa:"1.2.840.113549.1.1.1","rsa-pss":"1.2.840.113549.1.1.10",dsa:"1.2.840.10040.4.1",ec:"1.2.840.10045.2.1",x25519:"1.3.101.110",x448:"1.3.101.111",ed25519:"1.3.101.112",ed448:"1.3.101.113",dh:"1.2.840.113549.1.3.1"};Lc.version=0;$B.exports=Lc});var WB=_((Xee,zB)=>{var jB=require("crypto"),O$=GB(),D$=Bc(),P$=Rs(),kc=Io(),_r=class _r{constructor(e){this.messageDigest=jB.createHash(_r.DIGEST_ALG),this.passwdBytes=Buffer.alloc(e.length*2);for(let r=0,n=0;r>8,this.passwdBytes[n++]=e[r].charCodeAt()}resetDigest(){this.messageDigest=jB.createHash(_r.DIGEST_ALG)}recover(e){let r,n,i;if(e.getAlgorithm()!==_r.KEY_PROTECTOR_OID)throw new Error("Unsupported key protection alghorithm");let o=e.getEncryptedData(),a=kc(o,0,_r.SALT_LEN);i=o.length-_r.SALT_LEN-_r.DIGEST_LEN,n=Math.floor(i/_r.DIGEST_LEN),i%_r.DIGEST_LEN!==0&&n++;let u=kc(o,_r.SALT_LEN,i+_r.SALT_LEN),l=Buffer.alloc(u.length);for(let h=0,p=0,g=a;h{var KE=class KE{generate(e){return`-----BEGIN CERTIFICATE----- +`+e.toString("base64").match(/.{1,64}/g).join(` +`)+` +-----END CERTIFICATE----- +`}};c(KE,"X509Cert");var ME=KE;QB.exports=ME});var JB=_((rte,XB)=>{var ZB=YB(),$E=class $E{constructor(){this.algorithms={X509:ZB,"X.509":ZB}}get(e){if(!this.algorithms[e])throw new Error("The certificate type "+e+" is not supported");return new this.algorithms[e]}};c($E,"CertificateRegistry");var HE=$E;XB.exports=HE});var iR=_((ite,nR)=>{var L$=cA(),GE=NN(),k$=gv(),F$=vv(),q$=LN(),U$=WB(),V$=JB(),eR=c(t=>new V$().get(t.certType).generate(t.value),"serializeCert"),tR=c((t,e="")=>{let r=new q$(t);return new U$(e).recover(r)},"decrypt"),rR=c((t,e)=>new L$(t,e).parse(),"parseJks"),M$=c((t,e)=>new GE(t,e).parse(),"parsePkcs12"),K$=c((t,e)=>{let r=new GE(t,e),n=r.parse();return r.toPem(n)},"pkcs12ToPem"),H$=c((t,e,r)=>(r===void 0&&(r=e),rR(t,e).reduce((i,s)=>{if(s instanceof F$)return Object.assign({},i,{[s.alias]:{ca:eR(s.cert)}});if(s instanceof k$)return Object.assign({},i,{[s.alias]:{cert:s.chain.map(eR).join(` +`),key:tR(s.protectedPrivateKey,r)}})},{})),"jksToPem"),$$=c(function(t,e,r){return GE.probe(t)?K$(t,e,r):H$(t,e,r)},"toPem");nR.exports={toPem:$$,parseJks:rR,decrypt:tR,parsePkcs12:M$}});var aR=_((ote,oR)=>{"use strict";var Vf=Dl(),G$=iI(),Fc=require("fs"),{createTableOptionsFromMeta:j$}=lI(),{getEntityLevelConfig:z$}=Uc(),jE=dI(),sR=GI(),W$=zI(),Dt={client:null,isSshTunnel:null},Q$=["solr_query"];oR.exports=t=>{let e=c(b=>new Promise((R,D)=>b.require("java-ssl",(V,M)=>{V?D(V):R(M)})),"requireKeyStore"),r=c(b=>{let R=c(D=>D?Fc.readFileSync(D):"","readFile");try{let D=R(b.sslCaFile),V=R(b.sslCertFile),M=R(b.sslKeyFile);return Promise.resolve({ca:D,cert:V,key:M})}catch(D){return Promise.reject(D)}},"getCertificatesFromFiles"),n=c((b,R,D)=>e(R).then(V=>{try{let M=V(b.keystore,b.keystorepass),Q=(M.getCert(b.alias)||"").replace(/\s*-----END CERTIFICATE-----$/,` +-----END CERTIFICATE-----`),he=M.getPrivateKey(b.alias),ce=Q;return D.log("info",{message:"[info] certificates successfully retrieved from keystore",certLength:Q.length,keyLength:he.length,pemCertValidity:Q.startsWith(`-----BEGIN CERTIFICATE----- +MII`),pemKeyValidity:he.startsWith(`-----BEGIN PRIVATE KEY----- +MII`),countOfCerts:(Q.match(/-----BEGIN CERTIFICATE-----/gi)||[]).length},"Keystore Info"),b.truststore&&(ce=(V(b.truststore,b.truststorePass||"").getCert(b.truststoreAlias||b.alias)||"").replace(/\s*-----END CERTIFICATE-----$/,` +-----END CERTIFICATE-----`),D.log("info",{message:"[info] certificates successfully retrieved from truststore",certLength:ce.length,pemCertValidity:ce.startsWith(`-----BEGIN CERTIFICATE----- +MII`),countOfCerts:(ce.match(/-----BEGIN CERTIFICATE-----/gi)||[]).length},"Keystore Info")),{cert:Q,key:he,ca:ce,...i(b,D)}}catch(M){return M.message.includes("java.lang.NullPointerException")?Promise.reject({message:"Please, check the alias name of the provided JKS certificates. Error message: "+M.message,error:M.message,stack:M.stack}):Promise.reject(M)}}).catch(V=>{D.log("error",{message:V.message,stack:V.stack},"Initialization java-ssl failed");let M=i(b,D);return Object.keys(M).length===0?Promise.reject(V):M}),"getCertificatesFromKeystore"),i=c((b,R)=>{try{let D=iR(),V;Fc.existsSync(b.keystore)?(V=D.toPem(Fc.readFileSync(b.keystore),b.keystorepass),Object.keys(V).forEach(Q=>{R.log("info",{type:"keystore",certLength:t.get(V,`[${Q}].cert.length`),keyLength:t.get(V,`[${Q}].key.length`),countOfCerts:(t.get(V,`[${Q}].cert`,"").match(/-----BEGIN CERTIFICATE-----/gi)||[]).length,alias:Q},"jks analyze")})):R.log("info",`[info] keystore file not found ${b.keystore}`,"jks analyze");let M;return Fc.existsSync(b.truststore)?(M=D.toPem(Fc.readFileSync(b.truststore),b.truststorePass),Object.keys(M).forEach(Q=>{R.log("info",{type:"truststore",certLength:t.get(M,`[${Q}].ca.length`),countOfCerts:(t.get(M,`[${Q}].ca`,"").match(/-----BEGIN CERTIFICATE-----/gi)||[]).length,alias:Q},"jks analyze")})):R.log("info",`[info] truststore file not found ${b.truststore}`,"jks analyze"),{cert:t.get(V,`[${b.alias}].cert`),key:t.get(V,`[${b.alias}].key`),ca:t.get(M,`[${b.truststoreAlias||b.alias}].ca`)||t.get(V,`[${b.alias}].cert`)}}catch(D){return R.log("info",`[info] issue with jks-js. Message: ${D.message}`,"jks analyze"),{}}},"analyzeJks"),s=c(b=>b&&b!=="false","isSsl"),o=c((b,R,D)=>{let V=c((he,ce,ge)=>ce?Object.assign({},ge,{[he]:ce}):ge,"add");if(!s(b.ssl))return Promise.resolve({});let M=t.get(b,"hosts[0].host",""),Q;return b.ssl==="jks"?Q=n(b,R,D):Q=r(b),Q.then(he=>({sslOptions:t.flow([V.bind(null,"ca",he.ca),V.bind(null,"cert",he.cert),V.bind(null,"key",he.key),V.bind(null,"host",M)])({rejectUnauthorized:!b.disableStrictSsl,host:M})}))},"getSslOptions"),a=c((b,R)=>b.localDataCenter?{localDataCenter:b.localDataCenter,policies:{retry:new jE(R)}}:{policies:{loadBalancing:new Vf.policies.loadBalancing.RoundRobinPolicy,retry:new jE(R)}},"getPolicy"),u=c((b,R)=>{let V=Number(b),M=Number(R),Q=isNaN(V)?M:V;return isNaN(Q)||Q<=0?6e4:Q},"validateRequestTimeout"),l=c((b,R,D)=>{if(!Array.isArray(R.hosts))throw new Error("Hosts were not defined");let V=R.authType==="tokenBased"?{username:"token",password:R.astraToken}:{username:R.user,password:R.password},M=new Vf.auth.PlainTextAuthProvider(V.username,V.password),Q=R.hosts.map(ce=>`${ce.host}:${ce.port}`),he=u(R.requestTimeout,R.queryRequestTimeout);return o(R,b,D).then(ce=>new Vf.Client(Object.assign({contactPoints:Q,authProvider:M,socketOptions:{readTimeout:he}},a(R,D),ce)))},"getDistributedClient"),f=c(b=>{let R=u(b.requestTimeout,b.queryRequestTimeout),D=b.authType==="tokenBased"?{username:"token",password:b.astraToken}:{username:b.user,password:b.password},V=new Vf.Client(Object.assign({cloud:{secureConnectBundle:b.secureConnectBundle},credentials:D,socketOptions:{readTimeout:R}}));return Promise.resolve(V)},"getCloudClient"),h=c((b,R,D)=>R.clusterType==="apolloCloud"?f(R):l(b,R,D),"getClient"),p=c((b,R)=>async D=>{if(Dt.client)return Dt.client.connect();if(D.ssh){let V=b.require("@hackolade/ssh-service"),M=D.hosts[0],{options:Q}=await V.openTunnel({sshAuthMethod:D.ssh_method==="privateKey"?"IDENTITY_FILE":"USER_PASSWORD",sshTunnelHostname:D.ssh_host,sshTunnelPort:D.ssh_port,sshTunnelUsername:D.ssh_user,sshTunnelPassword:D.ssh_password,sshTunnelIdentityFile:D.ssh_key_file,sshTunnelPassphrase:D.ssh_key_passphrase,host:M.host,port:M.port});Dt.isSshTunnel=!0,D={...D,hosts:[Q]}}return Dt.client=await h(b,D,R),Dt.client.on("log",(V,M,Q,he)=>{if(R){let ce="["+V+"] "+M+": "+Q+". "+he;R.log("info",{message:ce},"Cassandra Info")}}),Dt.client.connect()},"connect"),g=c(async b=>{Dt.client&&(Dt.client.shutdown(),Dt.client=null),Dt.isSshTunnel&&(await b.require("@hackolade/ssh-service").closeConsumer(),Dt.isSshTunnel=!1)},"close"),d=c(b=>Dt.client.metadata.keyspaces[b],"getKeyspaceMetaData"),y=c(b=>{let R=d(b),D=t.get(R,"strategy","").split(".").slice(-1).pop(),V={code:b,durableWrites:!!R.durableWrites,replStrategy:D};return D==="SimpleStrategy"?V.replFactor=Number(R.strategyOptions.replication_factor):D==="NetworkTopologyStrategy"&&(V.dataCenters=Object.keys(R.strategyOptions).map(M=>({dataCenterName:M,replFactorValue:Number(R.strategyOptions[M])}))),V},"getKeyspaceInfo"),v=c(()=>Object.keys(Dt.client.metadata.keyspaces),"getKeyspacesNames"),m=c(()=>{let b=t.get(Dt,"client.hosts._items");if(!b)return!1;let R=b[Object.keys(b)[0]];if(!R)return!1;let D=R.getCassandraVersion();return D.length?t.get(D,"[0]")<3:!1},"isOldVersion"),w=c(b=>{let V=m()?`SELECT columnfamily_name FROM system.schema_columnfamilies WHERE keyspace_name ='${b}'`:`SELECT table_name FROM system_schema.tables WHERE keyspace_name ='${b}'`;return A(V)},"getTablesNames"),x=c(b=>{let R=`SELECT view_name FROM system_schema.views WHERE keyspace_name ='${b}'`;return A(R).then(D=>D.rows.map(V=>V.view_name),()=>[])},"getViewsNames"),A=c(b=>Dt.client.execute(b),"execute"),O=c((b,R)=>Dt.client.metadata.getTable(b,R),"getTableMetadata"),L=c((b,R,D,V)=>Promise.all(D.map(M=>Dt.client.metadata.getMaterializedView(R,M).then(Q=>j(b,R,M,V).then(he=>({documentTemplate:he,view:Q})),()=>({documentTemplate:{},view:{}})))),"getViews"),j=c((b,R,D,V)=>q(R,D,b,V).then(t1,()=>({})),"getViewDocumentTemplate"),Y=c(async(b,R)=>{try{let D=await A(`select resource_name, resource_value from solr_admin.solr_resources where resource_name IN ('schema.xml', 'solrconfig.xml') AND core_name = '${b}.${R}';`);if(!D.rows.length)return{};let V={"schema.xml":"schema","solrconfig.xml":"config"};return D.rows.reduce((M,Q)=>({...M,[V[Q.resource_name]]:Q.resource_value.toString()}),{})}catch{return{}}},"describeSearchIndexes"),se=c(b=>{let R=t.partition(b,mO);return{views:R[0].map(D=>D.slice(0,-4)),tables:R[1]}},"splitEntityNames"),re=c((b,R)=>{let D=`SELECT * FROM system_schema.columns WHERE keyspace_name='${b}' AND table_name='${R}';`;return A(D)},"getColumnInfo"),k=c((b,R,D)=>({dbName:b,dbCollections:R,views:D}),"prepareConnectionDataItem"),Ae=c((b,R,D={})=>{let V={};return b.filter(M=>!t.includes(Q$,M.name)).forEach(M=>{let Q=G$(t).getColumnType(M,R,D?D[M.name]:void 0);V[M.name]=Q,V[M.name].code=M.name,V[M.name].static=M.isStatic,V[M.name].frozen=M.type.options.frozen}),{properties:V}},"getTableSchema"),q=c((b,R,D,V)=>T(b,R,D).then(M=>new Promise((Q,he)=>{let ce=[];if(V.log("info",{table:`${b}.${R}`,limit:M},"Scan records"),!M)return Q(ce);let ge={prepare:!0,autoPage:!0,retry:new jE(V)},Je=`SELECT * FROM "${b}"."${R}" LIMIT ${M}`;Dt.client.eachRow(Je,[],ge,function(Fe,Ut){ce.push(Ut)},(Fe,Ut)=>Fe?he(Fe):Q(ce))})),"scanRecords"),T=c((b,R,D)=>{if(D.active==="absolute")return Promise.resolve(Number(D.absolute.value));let V=vO(D),M=`SELECT COUNT(*) FROM "${b}"."${R}" LIMIT ${V}`;return A(M).then(Q=>{let he=t.get(Q,"rows[0].count.low",D.maxValue);return dO(he,D)})},"getSizeOfRows"),G=c((b,R,D)=>{let V=je(b.partitionKeys),M=Se(b);return{...Oe(b.indexes,D),code:R,compositePartitionKey:V,compositeClusteringKey:M,comments:b.comment,tableOptions:X(b)}},"getEntityLevelData"),ae=c(b=>b.structure.find(D=>D.propertyName==="Options").structure,"getOptionsFromTab"),X=c(b=>{let[R]=z$(),D=ae(R);return j$(b,D)},"getTableOptions"),Re=c(b=>{switch(b){case"DESC":return"descending";case"ASC":default:return"ascending"}},"getKeyOrder"),je=c(b=>(b||[]).map(R=>R.name),"handlePartitionKeys"),Se=c(b=>(b.clusteringKeys||[]).map((R,D)=>{let V=b.clusteringOrder?b.clusteringOrder[D]:"";return{name:R.name,type:Re(V)}}),"handleClusteringKeys"),Oe=c((b,R)=>({SecIndxs:Ce(b),...Ve(R)}),"handleIndexes"),Ce=c(b=>b.filter(R=>!(R.options&&R.options.class_name==="com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex")).map(R=>{let D=R.isCustomKind()?"custom":"secondary",V={};return R.options&&D==="custom"&&(V.case_sensitive=R.options.case_sensitive==="true",V.normalize=R.options.normalize==="true",V.ascii=R.options.ascii==="true",V.similarity_function=R.options.similarity_function||""),{name:R.name,SecIndxKey:[lt(R.target)],customOptions:V,indexType:D}}),"getGeneralIndexes"),Ee=c(b=>{let R={},D=t.get(b,"updateHandler.autoSoftCommit.maxTime"),V=t.get(b,"requestHandler",[]).find(he=>he.lst&&he.lst["@_name"]==="defaults"),M=t.get(b,"query.filterCache"),Q=t.get(b,"indexConfig.mergeScheduler.int",[]).reduce((he,ce)=>({...he,[ce["@_name"]]:ce["#text"]}),{});return R.realtime=t.get(b,"indexConfig.rt",!1),R.directoryFactoryClass=t.get(b,"directoryFactory.@_class"),R.directoryFactory="",R.directoryFactoryClass==="solr.EncryptedFSDirectoryFactory"&&(R.directoryFactory="encrypted",R.directoryFactoryClass=""),R.directoryFactoryClass==="solr.StandardDirectoryFactory"&&(R.directoryFactory="standard",R.directoryFactoryClass=""),D&&(R.autoCommitTime=D),V&&(R.defaultQueryField=V.lst.str["#text"]),M&&(R.filterCacheLowWaterMark=M["@_lowWaterMarkMB"],R.filterCacheHighWaterMark=M["@_highWaterMarkMB"]),t.isEmpty(Q)||(Q.maxThreadCount&&(R.mergeMaxThreadCount=Q.maxThreadCount),Q.maxMergeCount&&(R.mergeMaxMergeCount=Q.maxMergeCount)),R},"getSearchIndexConfig"),ke=c(b=>Array.isArray(b)?b:[b],"transformObjectToArray"),we=c(b=>{let R=ke(b.fields.field),D=ke(b.types.fieldType),V=(b.uniqueKey||"").replace(/^\(|\)$/g,"").split(","),M=R.filter(Fe=>Fe["@_name"]!=="_partitionKey"),Q=M.some(Fe=>!V.includes(Fe["@_name"])&&Fe["@_type"]==="StrField"),he=D.some(Fe=>Fe["@_precisionStep"]===0),ce=M.some(Fe=>V.includes(Fe["@_name"])&&Fe["@_type"]==="StrField"),ge=D.some(Fe=>Fe["@_name"]==="StrField"),Je={spaceSavingSlowTriePrecision:he,spaceSavingNoJoin:R.length!==M.length,spaceSavingNoTextfield:Q||!ce&&ge};return Object.entries(Je).filter(([Fe,Ut])=>Ut).map(([Fe])=>Fe)},"getSearchIndexProfile"),Ve=c(b=>{if(t.isEmpty(b))return{};let R=sR.parse(b.schema,{parseAttributeValue:!0,ignoreAttributes:!1}).schema,D=sR.parse(b.config,{parseAttributeValue:!0,ignoreAttributes:!1}).config,M=ke(R.fields.field).filter(ce=>ce["@_name"]!==R.uniqueKey&&ce["@_name"]!=="_partitionKey").map(ce=>{var ge;return{key:[ce["@_name"]],indexed:!!ce["@_indexed"],docValues:!!ce["@_docValues"],lowerCase:(ge=ce["@_type"])==null?void 0:ge.startsWith("LowerCase")}}),Q=Ee(D),he=we(R);return{searchIndex:!0,searchIndexColumns:M,searchIndexConfig:Q,searchIndexProfiles:he}},"getSearchIndex"),lt=c(b=>{let R=/^values\(([\s\S]+)\)$/i,D=/^entries\(([\s\S]+)\)$/i,V=/^keys\(([\s\S]+)\)$/i,M="",Q=b;return R.test(b)&&(M="values",Q=b.match(R)[1]),D.test(b)&&(M="entries",Q=b.match(D)[1]),V.test(b)&&(M="keys",Q=b.match(V)[1]),{type:M,name:Q}},"getIndexKey"),wt=c(b=>{if(b&&b.length){let R={},D=[];return b.forEach(({udt:V,sample:M})=>{let Q=t.get(V,"type.info",t.get(V,"info"),{}),he=Q.name||V.name,ce=Q.fields||[];R[he]={type:"udt",static:V.isStatic,properties:Ae(ce,D,M).properties}}),{...R,...wt(D)||{}}}else return null},"handleUdts"),Qt=c(b=>{let R=`SELECT * FROM system_schema.types WHERE keyspace_name='${b}'`;return A(R)},"getUDT"),Pt=c(b=>{let R=`SELECT * FROM system_schema.functions WHERE keyspace_name='${b}'`;return A(R)},"getUDF"),Lt=c(b=>{let R=`SELECT * FROM system_schema.aggregates WHERE keyspace_name='${b}'`;return A(R)},"getUDA"),St=c(b=>b.replace(/frozen\<(.*)\>/i,"$1"),"removeFrozen"),kt=c(b=>b.rows.map(D=>{let V=D.argument_names.map((ce,ge)=>`${ce} ${St(D.argument_types[ge]||"")}`).join(", "),M=D.deterministic?"DETERMINISTIC":"",Q=D.monotonic?"MONOTONIC ON"+D.monotonic_on.join(", "):"",he=`CREATE OR REPLACE FUNCTION ${D.function_name} ( ${V} ) + ${D.called_on_null_input?"CALLED":"RETURNS NULL"} ON NULL INPUT + RETURNS ${St(D.return_type)} ${M} ${Q} + LANGUAGE ${D.language} AS + $$ ${D.body} $$ ;`;return{name:D.function_name,functionBody:he}}),"handleUDF"),Ft=c(b=>b.rows.map(D=>{let V=D.argument_types.map(St).join(", "),M=`CREATE OR REPLACE AGGREGATE ${D.aggregate_name} (${V}) + SFUNC ${D.state_func} + STYPE ${St(D.state_type)}`+(D.final_func!==null?` + FINALFUNC ${D.final_func}`:"")+` + INITCOND ${D.initcond}${D.deterministic?` + DETERMINISTIC`:""};`;return{name:D.aggregate_name,storedProcFunction:M}}),"handleUDA"),qt=c((b,R,D)=>b.filter(V=>t.get(V,"view.tableName")===R).map(V=>{let M=t.get(V,"view",{}),Q=Object.keys(t.get(V,"documentTemplate",{}));return{name:M.name,jsonSchema:cO(M,D),documentTemplate:Q,data:{compositePartitionKey:je(M.partitionKeys),compositeClusteringKey:Se(M),comments:M.comment,tableOptions:X(M)}}}),"getViewsData"),cO=c((b,R)=>{if(t.isEmpty(t.get(b,"columns")))return{};let D=Object.keys(b.columnsByName);return{properties:uO(R,b.tableName,D)}},"getViewData"),uO=c((b,R,D)=>D.reduce((V,M)=>t.get(b,["properties",M])?Object.assign({},V,{[M]:{$ref:`#collection/definitions/${R}/${M}`}}):V,{}),"getViewSchema"),lO=c((b,R)=>{var V,M;let D={dbName:b.keyspaceName,collectionName:b.tableName,documents:b.records};if((M=(V=b==null?void 0:b.table)==null?void 0:V.columns)!=null&&M.length){D.bucketInfo=y(b.keyspaceName),D.bucketInfo.UDFs=b.UDFs,D.bucketInfo.UDAs=b.UDAs,D.entityLevel=G(b.table,b.tableName,b.searchIndex);let Q=[],he=t1(b.records),ce=Ae(b.table.columns,Q,he);D.validation={jsonSchema:ce},D.documentTemplate=he,D.modelDefinitions={definitions:wt(Q)},t.isEmpty(b.views)||(D.views=qt(b.views,b.tableName,ce)),D={...D,documents:W$(t).filterUdts(ce.properties,b.records)}}else R||(D=null);return D},"getPackageData"),t1=c(b=>{let R=c((ge,Je)=>ge.reduce((Fe,Ut)=>Je(Ut)?[Fe[0].concat([Ut]),Fe[1]]:[Fe[0],Fe[1].concat([Ut])],[[],[]]),"split"),D=c(ge=>{let Je={};return ge.reduce((Fe,Ut)=>Je[typeof Ut]?Fe:(Je[typeof Ut]=!0,Fe.concat([Ut])),[])},"uniqByType"),V=c(ge=>{let[Je,Fe]=R(ge,Array.isArray),[Ut,EO]=R(Fe,M),SO=D(EO),n1=Ut.reduce(ce,{}),i1=SO.concat(Je.reduce(ce,[]));return Object.keys(n1).length?i1.concat([n1]):i1},"mergeByType"),M=c(ge=>ge&&typeof ge=="object"&&!Array.isArray(ge),"isObject"),Q=c((ge,Je)=>{let Fe=ge.concat(Je);return Fe.length?V(Fe):[]},"mergeArray"),he=c((ge,Je)=>Object.keys(ge).concat(Object.keys(Je)).reduce((Fe,Ut)=>Object.assign({},Fe,{[Ut]:ce(ge[Ut],Je[Ut])}),{}),"mergeObjects"),ce=c((ge,Je)=>{if(Array.isArray(ge)&&Array.isArray(Je))return Q(ge,Je);if(M(ge)&&M(Je))return he(ge,Je);if(Array.isArray(ge))return ce(ge,[]);if(Array.isArray(Je))return ce([],Je);if(M(ge))return ce(ge,{});if(M(Je))return ce({},Je);if(ge!==void 0)return ge;if(Je!==void 0)return Je},"merge");if(!Array.isArray(b)||!b.length)return{};try{return JSON.parse(JSON.stringify(b)).reduce(ce,{})}catch{return{}}},"mergeDocuments"),fO=c(b=>b instanceof Error?{message:b.message,stack:b.stack}:b,"prepareError"),hO=c((b,R)=>t.difference(b,R||[]),"filterKeyspaces"),dO=c((b,R)=>{let D=Math.ceil(b*R.relative.value/100);return Math.min(D,R.maxValue)},"getSampleDocSize"),pO=c(b=>b.replace(/\/\*([\s\S]+?)\*\//,""),"cleanOutComments"),gO=c(b=>{let R=c(Q=>(Q.match(/\$\$([\s\S]+?)\$\$/g)||[]).map(he=>he.trim().replace(/(^\$\$|\$\$$)/g,"")),"findFunctionStatements"),D=c(Q=>`$__HACKOLADE__PLACEHOLDER_${Q}__$`,"getPlaceholder");b=pO(b);let V=R(b),M=V.reduce((Q,he,ce)=>Q.replace(he,D(ce)),b).split(";").map(Q=>Q.trim()).filter(Boolean);return V.reduce((Q,he,ce)=>Q.map(ge=>ge.replace(D(ce),he)),M)},"splitScriptByQueries"),yO=c((b,R)=>{let D=gO(b),V=D.length,M=0;return r1(D.map(Q=>()=>Dt.client.execute(Q)),Q=>{let he=D[M];R(he,Q,M,V),M++}).then(Q=>Q,Q=>Promise.reject({error:Q,query:D[M]}))},"batch"),r1=c((b,R)=>b.length?b[0]().then(D=>(R(D),r1(b.slice(1),R))):Promise.resolve(),"promiseSeriesAll"),mO=c(b=>b.slice(-4)===" (v)","isView"),Wf=c(b=>{if(b!==null)return Array.isArray(b)?b.map(Wf).filter(R=>R!==void 0):typeof b=="object"?Object.keys(b).reduce((R,D)=>{let V=Wf(b[D]);return V===void 0?R:{...R,[D]:V}},{}):b},"filterNullItems"),vO=c(b=>{let R=b.relative.value,D=b.maxValue;return Math.round(D/R*100)},"getCountLimit");return{connect:p,close:g,getKeyspacesNames:v,getTablesNames:w,prepareConnectionDataItem:k,getColumnInfo:re,getTableMetadata:O,getTableSchema:Ae,scanRecords:q,getEntityLevelData:G,getKeyspaceMetaData:d,getKeyspaceInfo:y,handleUdts:wt,getUDF:Pt,getUDA:Lt,handleUDF:kt,handleUDA:Ft,getPackageData:lO,prepareError:fO,filterKeyspaces:hO,batch:yO,isOldVersion:m,getViews:L,getViewsNames:x,splitEntityNames:se,filterNullItems:Wf,describeSearchIndexes:Y}}});var uR=_((cte,cR)=>{"use strict";var Y$=c(t=>(e,r,n)=>{let i=e.script;if(e.clusterType==="apolloCloud"){let o=i.indexOf("USE");i=i.substring(o)}let s=t(n.require("lodash"));return s.connect(n)(e).then(()=>(r.log("info",{message:"Applying cassandra script has been started"},"Cassandra script"),s.batch(i,(o,a,u,l)=>{r.progress({message:`Completed queries: ${u+1} / ${l}`})})),o=>{let a=s.prepareError(o);return r.log("error",a,"Cassandra script"),Promise.reject(a)}).then(o=>{r.log("info",{message:"Cassandra script has been applied successfully!"},"Cassandra script"),s.close(n)},o=>{if(!o.query)return Promise.reject(o);let{error:a,query:u}=o,l=Z$(a,i,u),f=s.prepareError(l);return r.progress({message:`Query has executed with error: + ${u} + ${l.message}`}),r.log("error",{query:u,error:f,detail:l},"Cassandra script: query has been executed with error"),Promise.reject(f)}).catch(o=>(s.close(n),Promise.reject(s.prepareError(o))))},"applyToInstance"),Z$=c((t,e,r)=>{let n=/^line\ (\d+)\:(\-?\d+)/i,i=e.indexOf(r);if(i===-1)return t;let s=e.slice(0,i).split(` +`).length;if(!n.test(t.message))return Object.assign({},t,{message:`query line ${s}:0 ${t.message}`});let o=t.message.match(n),a=+o[1],u=o[2],l=t.message.replace(n,`line ${s+a-1}:${u}`);return Object.assign({},t,{message:l})},"modifyLineError");cR.exports=Y$});var fR=_((lte,lR)=>{"use strict";lR.exports=t=>(e,r)=>{let n=t(r.require("lodash"));return n.connect(r)(e).then(()=>{n.close(r)},i=>(n.close(r),Promise.reject(n.prepareError(i))))}});var pR=_((fte,dR)=>{"use strict";var hR=aR(),X$=uR()(hR),J$=fR()(hR);dR.exports={applyToInstance:X$,testConnection:J$}});var yR=_((hte,gR)=>{"use strict";var eG=c(t=>{var e,r,n;return{containers:{skipModified:(n=(r=(e=t.options)==null?void 0:e.additionalOptions)==null?void 0:r.find(i=>i.id==="excludeContainerAlterStatements"))==null?void 0:n.value}}},"getScriptOptions");gR.exports={getScriptOptions:eG}});var SR=_((pte,ER)=>{"use strict";var{dependencies:Xi}=cr(),{getReplication:tG,getDurableWrites:rG}=_h(),{retrivePropertyFromConfig:zs}=ar(),{AlterScriptDto:qc}=Ji(),nG=c(t=>t.name?`DROP FUNCTION IF EXISTS ${t.name};`:"","getDropUDFScript"),iG=c(t=>t.name?`DROP AGGREGATE IF EXISTS ${t.name};`:"","getDropUDAScript"),sG=["functionBody"],oG=["storedProcFunction"],aG={getDropScript:nG,requiredProps:sG,parser:"getUDFName",functionName:"functionBody"},cG={getDropScript:iG,requiredProps:oG,parser:"getUDAName",functionName:"storedProcFunction"},mR={regExpUDFForName:/^.+function(.+?)\(/is,regExpUDAForName:/^.+aggregate(.+?)\(/is,getResult(t,e){var n;let r=t.match(e);return(n=r==null?void 0:r[1])==null?void 0:n.trim()},getName(t,e){let r=this.getResult(t,e);return r&&r.replace(/if not exists/i,"").trim()},getUDFName(t){return this.getName(t,this.regExpUDFForName)},getUDAName(t){return this.getName(t,this.regExpUDAForName)}},uG=c((t,e,r)=>{let n=[],i=[];if(!t.length&&!e.length)return{dataForAddScript:n,dataForDropScript:i};if(!e.length)n=t;else if(!t.length)i=e;else{let s=c((a,u)=>r.every(l=>Xi.lodash.isEqual(a[l],u[l])),"difference"),o=Xi.lodash.intersectionWith(t,e,s);n=Xi.lodash.xorWith(t,o,s),i=Xi.lodash.xorWith(e,o,s)}return{dataForAddScript:n,dataForDropScript:i}},"getDataForScript"),vR=c(({new:t=[],old:e=[],udData:r})=>{t=t.map(a=>({...a,name:mR[r.parser](a[r.functionName])})),e=e.map(a=>({...a,name:mR[r.parser](a[r.functionName])}));let{dataForAddScript:n,dataForDropScript:i}=uG(t,e,r.requiredProps),s=n.filter(a=>Object.entries(a).every(([u,l])=>r.requiredProps.includes(u)?!!l:!0)).map(a=>qc.getInstance([a[r.functionName]],!0,"add","udf"));return[...i.filter(a=>!!a.name).map(a=>qc.getInstance([r.getDropScript(a)],!0,"deletion","udf")),...s]},"getModifyUDFA"),lG=["replStrategy","replFactory","dataCenters"],fG=c((t,e)=>e.some(r=>{let{new:n,old:i}=t[r]||{};return n&&i&&!Xi.lodash.isEqual(n,i)}),"getIsModifyKeysSpace"),hG=c(({child:t,mode:e})=>{let r=[t.role],n=t.role.code||t.role.name,i=zs(r,0,"replStrategy",""),s=zs(r,0,"replFactor",void 0),o=zs(r,0,"dataCenters",[]),a=zs(r,0,"durableWrites",!1),u=zs(r,0,"compMod",{}),l=tG(i,s,o),f=rG(a);if(e==="add"){let m=zs(r,0,"UDFs",[]),w=zs(r,0,"UDAs",[]);return[qc.getInstance([Xi.provider.createKeySpace(n,l,f,m,w)],!0,"add","keySpaces")]}else if(e==="delete")return[qc.getInstance([Xi.provider.dropKeySpace(n)],!0,"deletion","keySpaces")];let h=(u==null?void 0:u.UDFs)||{},p=(u==null?void 0:u.UDAs)||{},g=vR({...h,udData:aG}),d=vR({...p,udData:cG}),v=fG(u,lG)?Xi.provider.alterKeySpaceReplication(n,l,f):"";return[qc.getInstance([v],!0,"modify","keySpaces"),...d,...g]},"getKeySpaceScript");ER.exports={getKeySpaceScript:hG}});var bR=_((yte,_R)=>{"use strict";var{dependencies:ea}=cr(),Mf=["id"],dG=["SecIndxComments","SecIndxDescription"],pG={recovery:!1,reindex:!0,lenient:!1},gG={autoCommitTime:1e4,filterCacheLowWaterMark:1024,filterCacheHighWaterMark:2048,mergeFactor:10,ramBufferSize:512,realtime:!1},yG={indexIfNotExist:!1},mG={spaceSavingNoTextfield:{mode:["text","varchar"]},spaceSavingSlowTriePrecision:{childType:["timestamp","date","time","numeric","timeuuid"],type:["timestamp","date","time","numeric","timeuuid"]}},xR=c((t,e)=>!ea.lodash.isEqual(t,e),"isDiff"),TR=c((t,e)=>Object.entries(e).reduce((r,[n,i])=>Mf.includes(n)?r:!t.hasOwnProperty(n)||xR(t[n],i)?Object.assign({},r,{[n]:i}):r,{}),"getModifiedProperties"),CR=c(t=>typeof t!="boolean"&&!t,"isEmptyValue"),vG=c((t,e)=>Object.keys(t).filter(r=>!e.hasOwnProperty(r)),"getDeletedProperties"),EG=c((t,e,r)=>t.reduce((n,i)=>r.hasOwnProperty(i)&&xR(ea.lodash.get(e,i),r[i])?Object.assign({},n,{[i]:r[i]}):n,{}),"getDefaultPropertiesByName"),SG=c((t=[],e=[])=>t.reduce((r,n)=>e.includes(n)?r:[...r,n],[]),"getNotDefaultProperties"),CG=c((t,e,r={})=>SG(Object.keys(e),Object.keys(r)).reduce((i,s)=>Mf.includes(s)?i:t.hasOwnProperty(s)&&CR(e[s])&&!CR(t[s])?{...i,[s]:e[s]}:i,{}),"getDropProperties"),wG=c(t=>(e={},r={})=>{let n=TR(Object.assign({},t,e),Object.assign({},t,r)),i=vG(e,Object.assign({},t,r));return{modifyData:n,dropData:EG(i,e,t)}},"getDiffOptions"),wR=c(t=>(e={},r={})=>({modifyData:TR(Object.assign({},t,e),Object.assign({},t,r)),dropData:CG(e,r,t)}),"getDiff"),xG=c((t,e)=>(r={},n={})=>(n=Object.assign({},t,n),r=Object.assign({},t,r),ea.lodash.uniq([...ea.lodash.keys(n),...ea.lodash.keys(r)]).filter(s=>!e.includes(s)).reduce((s,o)=>s&&ea.lodash.isEqual(n[o],r[o])?s:!1,!0)),"isEqualIndex"),TG=c((t=[],e=[],r=[])=>Object.entries(mG).reduce((n,[i,s])=>!e.includes(i)||n.includes(i)||Object.entries(s).reduce((a,[u,l])=>{if(a)return a;let f=r.map(h=>h[u]).filter(Boolean);return l.some(h=>f.includes(h))},!1)?n:[...n,i],t),"prepareSearchIndexProfile");_R.exports={getDiffOptions:wG(pG),getDiffConfig:wR(gG),getDiffIndexProfiles:wR({}),isEqualIndex:xG(yG,[...Mf,...dG]),prepareSearchIndexProfile:TG,REDUNDANT_OPTIONS:Mf}});var qR=_((vte,FR)=>{"use strict";var{dependencies:$e}=cr(),{getIndexProfiles:_G,getTableNameStatement:$f,tab:zE}=ar(),{getIndexes:WE}=ca(),{getNamesByIds:bG}=sa(),{getDiffOptions:IG,getDiffConfig:AG,getDiffIndexProfiles:NG,isEqualIndex:BG,prepareSearchIndexProfile:RG}=bR(),{AlterScriptDto:di}=Ji(),Kf={dropIndexes:[],dropSearchIndexes:[],createIndexes:[],createSearchIndexes:[]},Gf=c((t,e,r)=>{let n=$f(t,e);return!!Kf[r].filter(s=>s===n).length},"checkExistsScript"),jf=c((t,e,r)=>{let n=$f(t,e);Kf={...Kf,[r]:[...Kf[r],n]}},"setNameCollectionsScript"),OG=["searchIndexProfiles","searchIndexOptions"],QE=c((t,e)=>({indexType:"search",columns:t.searchIndexColumns,config:t.searchIndexConfig,profiles:_G(t.searchIndexProfiles,e),options:t.searchIndexOptions,ifNotExist:t.searchIndexIfNotExist}),"getDataSearchIndex"),IR=c((t,e,r)=>{let n=[...OG,"searchIndexIfNotExist","searchIndexColumns","searchIndexConfig"].map(i=>{var s;return[i,(s=((t==null?void 0:t.compMod)||{})[i])==null?void 0:s[e]]}).filter(([i,s])=>!!s);return t={...t,...Object.fromEntries(n)},QE(t,r)},"getModifyDataSearchIndex"),OR=c((t,e,r=$e.lodash.isEqual)=>{let n,i;if(!t.length&&!e.length)return{};if(!t.length)i=e;else if(!e.length)n=t;else if(!$e.lodash.isEqual(t,e)){let s=$e.lodash.intersectionWith(t,e,r);i=$e.lodash.xorWith(e,s,r),n=$e.lodash.xorWith(t,s,r)}return{addData:n,dropData:i}},"getDataForScript"),DG=c((t,e,r)=>{var y,v,m,w;let{compMod:n}=t,i=$e.lodash.get(t,"compMod.oldIdToNameHashTable",{}),s=$e.lodash.get(t,"compMod.searchIndexColumns",{}),o=c(x=>(x==null?void 0:x.name)&&!(x!=null&&x.compositePartitionKey),"filterColumn"),a=(s.old||[]).map(x=>Hf({dataSources:e,column:x,allAttributes:!0,idToNameHashTable:i})).filter(o),u=QE(t,r),l=$e.lodash.get(t,"compMod.searchIndex",{}),f=(y=n==null?void 0:n.searchIndexProfiles)==null?void 0:y.new,h=RG((v=n==null?void 0:n.searchIndexProfiles)==null?void 0:v.old,f,a),p=$e.lodash.merge(IG((m=n==null?void 0:n.searchIndexOptions)==null?void 0:m.old,(w=n==null?void 0:n.searchIndexOptions)==null?void 0:w.new),NG(h,f)),g,d;return!l.old&&!l.new?{}:(l.old?l.new?(!$e.lodash.isEmpty(p.modifyData)||!$e.lodash.isEmpty(p.dropData))&&(d=IR(t,"new",r),g=u):g=u:d=IR(t,"new",r),{addData:d,dropData:g})},"getDataForSearchIndexScript"),DR=c(({dataSources:t,idToNameHashTable:e,keyId:r,allAttributes:n=!1})=>{let i=bG([r],t,n)[r]||{};return i.name?i:{name:e[r]||""}},"getFieldDataByKeyId"),Hf=c(({dataSources:t,idToNameHashTable:e,column:r={},key:n="key",allAttributes:i=!1})=>{let s=$e.lodash.get(r,`${n}[0].keyId`,""),o=DR({dataSources:t,idToNameHashTable:e,keyId:s,allAttributes:i})||{};return{...$e.lodash.omit(r,n),...o}},"getDataColumnIndex"),PG=c((t,e)=>{let r=$e.lodash.get(t,"role.compMod.oldIdToNameHashTable",{}),n=$e.lodash.get(t,"role.compMod.newIdToNameHashTable",{}),i=$e.lodash.get(t,"role.compMod.searchIndexColumns",{}),s=c(l=>l.name&&!l.compositePartitionKey,"filterColumn"),o=(i.new||[]).map(l=>Hf({dataSources:e,idToNameHashTable:n,column:l})).filter(s),a=(i.old||[]).map(l=>Hf({dataSources:e,idToNameHashTable:r,column:l})).filter(s);return OR(o,a,c((l,f)=>(l==null?void 0:l.name)===(f==null?void 0:f.name),"isEqual"))},"getDataForSearchIndexColumns"),LG=c((t,e,r)=>{let n=Object.entries(r.dropData).map(([s])=>di.getInstance([$e.provider.dropSearchIndexConfig(t,e,s)],!0,"deletion","index"));return[...Object.entries(r.modifyData).filter(([s,o])=>typeof o!="string"||!!o).map(([s,o])=>{let a=$e.lodash.isString(o)?`'${o}'`:o;return di.getInstance([$e.provider.modifySearchIndex(t,e,s,a)],!0,"modify","index")}),...n]},"getSearchConfigScript"),kG=c((t,e,r)=>{let n=$f(t,e),i=`ALTER SEARCH INDEX SCHEMA +`+zE(`ON ${n} +`),s=c((u,l,f,h)=>{let p=u+zE(`${l} "${h.name}";`);return di.getInstance([p],!0,f,"index")},"getScript"),o=(r.dropData||[]).map(s.bind(null,i,"DROP field","deletion")),a=(r.addData||[]).map(s.bind(null,i,"ADD field","modify"));return o.length&&o.push(PR(t,e,"RELOAD","deletion")),{dropSearchScripts:o,addSearchScripts:a}},"getSearchColumnsScript"),PR=c((t,e,r,n)=>{let i=$f(t,e),s=`${r} SEARCH INDEX +`+zE(`ON ${i};`);return di.getInstance([s],!0,n,"renewal")},"getRenewalScript"),LR=c((t,e,r)=>{let n=Gf(t,e,"dropSearchIndexes"),i="";return r&&!n&&(i=$e.provider.dropSearchIndex(t,e),jf(t,e,"dropSearchIndexes")),[di.getInstance([i],!0,"deletion","index")]},"getDropSearchIndexScript"),kR=c((t,e,r=[])=>r.map(n=>{let i=`${e}.${n.name}`,s=Gf(t,i,"dropIndexes"),o="";return n.name&&!s&&(o=$e.provider.dropIndex(t,n.name),jf(t,i,"dropIndexes")),di.getInstance([o],!0,"deletion","index")}),"getDropIndexScript"),FG=c(t=>{let{keyspaceName:e,tableName:r,searchIndex:n,dataSources:i,isActivated:s,dbVersion:o}=t;if(Gf(e,r,"createSearchIndexes"))return[];jf(e,r,"createSearchIndexes");let u=WE({searchIndex:n},i,r,e,s,!0,o);return[di.getInstance([u],!0,"add","index")]},"getAddSearchIndexScript"),qG=c(t=>{let{keyspaceName:e,indexes:r=[],dataSources:n,tableName:i,isActivated:s,dbVersion:o}=t,a=r.filter(l=>{let f=`${i}.${l.name}`;return Gf(e,f,"createIndexes")?!1:(jf(e,f,"createIndexes"),!0)}),u=WE({indexes:a},n,i,e,s,!0,o);return[di.getInstance([u],!0,"add","index")]},"getAddIndexScript"),AR=c(t=>{var f,h;let{item:e,dataSources:r,tableName:n,keyspaceName:i,isActivated:s,dbVersion:o}=t,a=!!((f=e.role)!=null&&f.searchIndex),u=QE(e.role||{},o),l=WE({searchIndex:a&&u,indexes:((h=e.role)==null?void 0:h.SecIndxs)||[]},r,n,i,s,!0,o);return[di.getInstance([l],!0,"add","index")]},"getCreatedIndex"),NR=c(t=>{var o,a;let{item:e,keyspaceName:r,tableName:n}=t,i=kR(r,n,(o=e.role)==null?void 0:o.SecIndxs),s=LR(r,n,(a=e.role)==null?void 0:a.searchIndex);return[...i,...s]},"getDeletedIndex"),UG=c(t=>{let{item:e,keyspaceName:r,tableName:n,dbVersion:i,isActivated:s,dataSources:o}=t,a=DG(e.role,o,i);if(a.dropData||a.addData){let v=LR(r,n,!!a.dropData),m=FG({searchIndex:a.addData,dataSources:o,tableName:n,keyspaceName:r,isActivated:s,dbVersion:i});return[...v,...m]}let u=$e.lodash.get(e,"role.compMod.searchIndexConfig",{}),l=PG(e,o),f=AG(u.old,u.new),h=LG(r,n,f),{dropSearchScripts:p,addSearchScripts:g}=kG(r,n,l),d={RELOAD:h.length||g.length,REBUILD:p.length||g.length},y=Object.entries(d).reduce((v,[m,w])=>w?[...v,PR(r,n,m,"add")]:v,[]);return[...h,...p,...g,...y]},"getUpdateSearchIndexScript"),BR=c((t,e,r=[])=>r.map(n=>{let i=$e.lodash.get(n,"SecIndxKey",[]).map(s=>{var o;return{...s,name:((o=DR({dataSources:e,idToNameHashTable:t,keyId:$e.lodash.get(s,"keyId")}))==null?void 0:o.name)||""}});return{...$e.lodash.omit(n,["SecIndxKey"]),SecIndxKey:i}}),"prepareIndexes"),RR=c((t=[])=>t.map(e=>$e.lodash.omit(e,"keyId")),"removeKeyIdFromKeys"),VG=c(t=>{let{item:e,keyspaceName:r,tableName:n,dbVersion:i,isActivated:s,dataSources:o}=t,{new:a=[],old:u=[]}=$e.lodash.get(e,"role.compMod.SecIndxs",{}),{oldIdToNameHashTable:l={},newIdToNameHashTable:f={}}=$e.lodash.get(e,"role.compMod",{}),h=BR(f,o,a),p=BR(l,o,u),d=OR(h,p,c((m={},w={})=>BG({...w,SecIndxKey:RR(w.SecIndxKey)},{...m,SecIndxKey:RR(m.SecIndxKey)}),"isEqual")),y=kR(r,n,d.dropData),v=qG({indexes:d.addData,dataSources:o,tableName:n,keyspaceName:r,isActivated:s,dbVersion:i});return[...y,...v]},"getUpdateIndexScript"),MG=c(t=>{let e=UG(t);return[...VG(t),...e]},"getUpdateIndex"),KG=c((t,e)=>[{properties:{...t.properties||{},...t.role.properties||{}},...$e.lodash.omit(t.role||{},["properties"])},e.modelDefinitions,e.externalDefinitions,e.internalDefinitions,{properties:(t==null?void 0:t.properties)||{}},{properties:$e.lodash.get(t,"role.compMod.newProperties",[])},{properties:$e.lodash.get(t,"role.compMod.oldProperties",[])}],"createDataSources"),HG=c(t=>{var e,r,n,i,s,o;return((n=(r=(e=t.role)==null?void 0:e.compMod)==null?void 0:r.collectionName)==null?void 0:n.new)??((o=(s=(i=t.role)==null?void 0:i.compMod)==null?void 0:s.collectionName)==null?void 0:o.old)},"getTableNameFromCompMod"),$G=c((t,e,r)=>{var l,f,h,p;let n=KG(t,e),i=((l=t.role)==null?void 0:l.code)||((f=t.role)==null?void 0:f.name)||HG(t),s=(h=t.role.compMod)==null?void 0:h.keyspaceName,o=e.modelData[0].dbVersion,a=(p=t.role)==null?void 0:p.isActivated,{compMod:u={}}=t.role||{};if(r){let g=AR({item:t,dataSources:n,tableName:i,keyspaceName:s,isActivated:a,dbVersion:o}),d=NR({item:t,keyspaceName:s,tableName:i});return[...g,...d]}return u.created?AR({item:t,dataSources:n,tableName:i,keyspaceName:s,isActivated:a,dbVersion:o}):u.deleted?NR({item:t,keyspaceName:s,tableName:i}):MG({item:t,keyspaceName:s,tableName:i,dataSources:n,isActivated:a,dbVersion:o})},"getIndexTable");FR.exports={getIndexTable:$G,getDataColumnIndex:Hf}});var WR=_((Ste,zR)=>{"use strict";var{getTypeByData:GG}=na(),{dependencies:dn}=cr(),{getKeySpaceScript:jG}=SR(),{checkIsOldModel:zG,fieldTypeCompatible:WG}=Mc(),{getViewScript:QG}=Eh(),{getIndexTable:ZE,getDataColumnIndex:UR}=qR(),{getUdtScript:YG,sortAddedUdt:ZG}=ph(),{getDelete:HR,hydrateColumn:XG,isTableChange:JG,addScriptToExistScripts:ej,getAdd:$R,getDeleteTableDto:GR,getAddTable:jR}=fh(),{getUdtMap:tj}=zc(),{AlterScriptDto:JE}=Ji(),rj=c(t=>[JE.getInstance([dn.provider.renameColumn(t)],!0,"modify","field")],"getRenameColumnDto"),XE=c((t,e)=>!!t[e],"objectContainsProp"),nj=c(t=>{let{collectionName:e={},code:r={}}=t;return{oldName:r.old||e.old,newName:r.new||e.new}},"getCollectionName"),VR={alterDropCreate({dataForScript:t,oldName:e,newName:r}){let n=c(o=>({...t,columnData:{...t.columnData,...o}}),"getData"),i=HR(n({name:e})),s=$R(n({name:r}));return[...i,...s]},alterNameDto(t){let{newName:e,oldName:r,dataForScript:n,property:i,isTypeChange:s}=t;return i.primaryKey&&s?[]:i.primaryKey?rj({...n,columnData:{oldName:r,newName:e}}):this.alterDropCreate(t)},alterType(t){let{isOldModel:e,oldType:r,newType:n,dataForScript:i,property:s}=t;if(!r||!n||s.primaryKey)return[];let o=WG(r,n);return e?o?[JE.getInstance([dn.provider.updateType(i)],!0,"modify","field")]:this.alterDropCreate(t):this.alterDropCreate(t)}},ij=c(t=>{let e=XG(t),{newName:r,oldName:n}=e;return!n||!r?[]:e.isNameChange?VR.alterNameDto(e):e.isTypeChange?VR.alterType(e):(ej(e.dataForScript),[])},"getUpdate"),sj=c((t,e,r)=>{let i=[{properties:t.properties||{},...dn.lodash.omit(t.role||{},["properties"])},r.modelDefinitions],s=dn.lodash.get(t,"role.SecIndxs",[]).map(a=>UR({dataSources:i,idToNameHashTable:{},column:a,key:"SecIndxKey"})).map(a=>a.name).filter(Boolean);return[...dn.lodash.get(t,"role.searchIndexColumns",[]).map(a=>UR({dataSources:i,idToNameHashTable:{},column:a})).map(a=>a.name).filter(Boolean),...s].includes(e)},"getIsColumnInIndex"),oj=c((t=[])=>{let e=Object.entries(t).map(([r,n])=>{var o,a;if(!n.compMod)return[r,n];let i=((o=n.compMod)==null?void 0:o.newField)||{},s=((a=n.compMod)==null?void 0:a.oldField)||{};return Object.entries(i).map(([u,l])=>{s[u]!==l&&(n[u]=l),u==="name"&&s[u]!==l&&(r=l)}),[r,n]});return Object.fromEntries(e)},"getPropertiesForUpdateTable"),MR=c(t=>{var h,p,g,d,y,v;let{item:e,propertiesScript:r=[]}=t,{oldName:n,newName:i}=nj((h=e.role)==null?void 0:h.compMod),s={...((p=e.role)==null?void 0:p.compMod)||{},name:{new:i,old:n}},o=JG({item:{...e,role:{...e.role,compMod:s}},data:t.data,dataSources:t.dataSources}),a=ZE(e,t.data,o);if(!o){let m=t.tableName||n||i;return[JE.getInstance([dn.provider.updateTableOptions(((g=e.role)==null?void 0:g.compMod)||{},m,t.isOptionScript)],!0,"modify","table"),...a,...r]}if(!n||!i)return[];let u={keyspaceName:t.keyspaceName,data:t.data,item:{...e,properties:oj(((d=e.role)==null?void 0:d.properties)||e.properties),role:{...(e==null?void 0:e.role)||{},tableOptions:((v=(y=e==null?void 0:e.role)==null?void 0:y.compMod)==null?void 0:v.tableOptions)||{}}},isKeyspaceActivated:!0,dataSources:t.dataSources},l=GR({...u,tableName:n}),f=jR({...u,tableName:i});return[...l,...f,...a]},"getUpdateTableDto"),YE=c((t,e,r,n)=>{let i=[];if(XE(t,"items")&&t.items.length){let s=t.items.reduce((o,a)=>o.concat(KR(a,e,r,n)),[]);i=i.concat(s)}else XE(t,"items")&&(i=i.concat(KR(t.items,e,r,n)));return i},"handleChange"),KR=c((t,e,r,n)=>{let i=[];if(!XE(t,"properties"))return i;let s=zG(dn.lodash.get(n,"modelData")),o=t.properties;return i=Object.keys(o).reduce((a,u)=>{let l=o[u].role.compMod;if(!l)return a;let f=dn.lodash.get(o,`${u}.role.code`,""),h=f.length?f:u,p=o[u].properties||{},g=l.keyspaceName;if(l.deleted){let m=ZE(o[u],n);return[...a,...GR({keyspaceName:g,tableName:h}),...m]}let d=[n.modelDefinitions,n.internalDefinitions,n.externalDefinitions,{properties:p},{properties:dn.lodash.get(o[u],"role.properties",[])},{properties:dn.lodash.get(o[u],"role.compMod.newProperties",[])},{properties:dn.lodash.get(o[u],"role.compMod.oldProperties",[])}];if(l.created){let m=ZE(o[u],n);return[...a,...jR({item:o[u],keyspaceName:g,data:n,tableName:h,dataSources:d}),...m]}if(l.modified){let m=MR({keyspaceName:g,data:n,item:o[u],isOptionScript:!0,tableName:h,dataSources:d});return[...a,...m]}let y=aj({item:o[u],generator:r,tableProperties:p,udtMap:e,itemCompModData:l,tableName:h,isOldModel:s,data:n,dataSources:d}),v=MR({item:o[u],isOptionScript:r.name==="getUpdate"||r.name==="getAdd",propertiesScript:y,keyspaceName:g,tableName:h,data:n,dataSources:d});return[...a,...v]},[]),i},"handleItem"),aj=c(({generator:t,tableProperties:e,udtMap:r,itemCompModData:n,tableName:i,isOldModel:s,data:o,item:a,dataSources:u})=>Object.keys(e).reduce((l,f)=>{let h=e[f]||{};if(t.name!=="getUpdate"&&(h.compositePartitionKey||h.compositeClusteringKey)||t.name==="getAdd"&&h.hasOwnProperty("compMod"))return l;let p=GG(h,r,f);if(h.$ref&&!p&&(p=dn.lodash.last(h.$ref.split("/"))),!p)return l;let g=n==null?void 0:n.keyspaceName,d=sj(a,f,o);return t.name==="getUpdate"&&(!h.compMod||d)?l:[...l,...t({keyspaceName:g,tableName:i,columnData:{name:f,type:p},property:h,isOldModel:s,udtMap:r,dataSources:u})]},[]),"handleProperties"),cj={views:QG,containers:jG,udt:YG},pi=c((t,e,r,n,i)=>{if(!t)return[];let s=cj[n];if(Array.isArray(t)&&t.length)return t.reduce((l,f)=>[...l,...s({child:f.properties[Object.keys(f.properties)[0]],udtMap:e,data:r,mode:i})],[]);let o=t.properties,a=Object.keys(o)[0],u=o[a];return s({child:u,udtMap:e,data:r,mode:i})},"generateScript"),uj=c((t,e,r)=>{var l,f,h,p,g,d,y,v,m;let n=(h=(f=(l=t==null?void 0:t.properties)==null?void 0:l.entities)==null?void 0:f.properties)==null?void 0:h.added,i=(d=(g=(p=t==null?void 0:t.properties)==null?void 0:p.entities)==null?void 0:g.properties)==null?void 0:d.modified,s=(m=(v=(y=t==null?void 0:t.properties)==null?void 0:y.entities)==null?void 0:v.properties)==null?void 0:m.deleted,o=YE(n,e,$R,r),a=YE(i,e,ij,r),u=YE(s,e,HR,r);return[...a,...o,...u]},"getEntitiesDto"),lj=c((t,e,r)=>{var l,f,h,p,g,d,y,v,m,w,x;let n=(h=(f=(l=t==null?void 0:t.properties)==null?void 0:l.containers)==null?void 0:f.properties)==null?void 0:h.added,i=(d=(g=(p=t==null?void 0:t.properties)==null?void 0:p.containers)==null?void 0:g.properties)==null?void 0:d.modified,s=(m=(v=(y=t==null?void 0:t.properties)==null?void 0:y.containers)==null?void 0:v.properties)==null?void 0:m.deleted,o=[],a=[],u=[];return(x=(w=r==null?void 0:r.scriptOptions)==null?void 0:w.containers)!=null&&x.skipModified||(o=pi(n==null?void 0:n.items,e,r,"containers","add"),a=pi(i==null?void 0:i.items,e,r,"containers","update"),u=pi(s==null?void 0:s.items,e,r,"containers","delete")),[...o,...a,...u]},"getContainersDto"),fj=c((t,e,r)=>{var l,f,h,p,g,d,y,v,m;let n=(h=(f=(l=t==null?void 0:t.properties)==null?void 0:l.views)==null?void 0:f.properties)==null?void 0:h.added,i=(d=(g=(p=t==null?void 0:t.properties)==null?void 0:p.views)==null?void 0:g.properties)==null?void 0:d.modified,s=(m=(v=(y=t==null?void 0:t.properties)==null?void 0:y.views)==null?void 0:v.properties)==null?void 0:m.deleted,o=pi(n==null?void 0:n.items,e,r,"views","add"),a=pi(i==null?void 0:i.items,e,r,"views","update"),u=pi(s==null?void 0:s.items,e,r,"views","delete");return[...a,...o,...u]},"getViewsDto"),hj=c((t,e,r)=>{var h,p,g,d;let n=(h=t==null?void 0:t.properties)==null?void 0:h.modelDefinitions,i=ZG(n),s=(p=i==null?void 0:i.properties)==null?void 0:p.added,o=(g=i==null?void 0:i.properties)==null?void 0:g.modified,a=(d=i==null?void 0:i.properties)==null?void 0:d.deleted,u=pi(s.items,e,r,"udt","add"),l=pi(o.items,e,r,"udt","update"),f=pi(a.items,e,r,"udt","delete");return[...u,...l,...f]},"getModelDefinitionsDto"),dj=c((t,e,r)=>{let n=Object.assign({},e,tj([t]));return[...uj(t,n,r),...lj(t,n,r),...fj(t,n,r),...hj(t,n,r)].filter(Boolean)},"getAlterScriptDtos");zR.exports={getAlterScriptDtos:dj}});var XR=_((wte,ZR)=>{"use strict";var{dependencies:QR}=cr(),{getAlterScriptDtos:YR}=WR(),{commentDeactivatedStatement:pj,getApplyDropStatement:gj}=ar(),yj=c((t,e)=>gj(e)?t:t.map((n={})=>{var i,s,o,a;return!((s=(i=n==null?void 0:n.scripts)==null?void 0:i[0])!=null&&s.isDropScript)||!((a=(o=n==null?void 0:n.scripts)==null?void 0:o[0])!=null&&a.script)?n:{...n,scripts:n.scripts.map(u=>({...u,script:pj(u.script,!1)}))}}),"getCommentedDropScript"),mj=c(t=>{let e=t.flatMap(o=>o.scripts),r=c((o,a,u={})=>u[o]&&u.modelLevel===a,"filterProp"),n=c((o,a,u)=>a.reduce((l,f)=>r(o,u,f)?(l.scripts.push(f),l):(l.filteredScripts.push(f),l),{scripts:[],filteredScripts:[]}),"filter"),s=[["keySpaces","isAddScript"],["keySpaces","isModifyScript"],["view","isDropScript"],["index","isDropScript"],["renewal","isDropScript"],["table","isDropScript"],["udt","isDropScript"],["udt","isAddScript"],["udt","isModifyScript"],["table","isAddScript"],["table","isModifyScript"],["field","isDropScript"],["field","isAddScript"],["field","isModifyScript"],["index","isAddScript"],["index","isModifyScript"],["renewal","isAddScript"],["view","isAddScript"],["view","isModifyScript"],["udf","isDropScript"],["udf","isAddScript"],["keySpaces","isDropScript"]].reduce((o,[a,u])=>{let{scripts:l,filteredScripts:f}=n(u,o.filteredScripts,a);return{sorted:[...o.sorted,...l],filteredScripts:f}},{sorted:[],filteredScripts:e});return[...s.sorted,...s.filteredScripts].map(o=>o.script)},"sortScript"),vj=c((t,e,r)=>{let n=YR(t,e,r);return n=QR.lodash.uniqWith(n,QR.lodash.isEqual),n=yj(n,r),mj(n).filter(Boolean).join(` + +`)},"buildContainerLevelAlterScript"),Ej=c((t,e,r)=>YR(t,e,r).some(n=>n.isActivated&&n.scripts.some(i=>i.isDropScript)),"isDropInStatements");ZR.exports={buildContainerLevelAlterScript:vj,isDropInStatements:Ej}});var{retrieveContainerName:Sj,retrieveEntityName:Cj,retrieveUDA:wj,retrieveUDF:xj,retrieveIndexes:Tj,retrieveIsItemActivated:JR,commentDeactivatedStatement:eO,getUserDefinedAggregations:_j,getUserDefinedFunctions:bj}=ar(),{getTableStatement:Ij}=Ws(),{sortUdt:ta,getUdtMap:tO,getUdtScripts:rO,prepareDefinitions:e1}=zc(),{getIndexes:Aj}=ca(),{getKeyspaceStatement:nO}=_h(),{getViewScript:iO}=$c(),{getCreateTableScript:Nj}=kS(),{setDependencies:zf}=cr(),{applyToInstance:Bj,testConnection:Rj}=pR(),{getScriptOptions:sO}=yR(),{buildContainerLevelAlterScript:oO,isDropInStatements:aO}=XR();module.exports={generateScript(t,e,r,n){try{zf(n);let{udtTypeMap:i,modelDefinitions:s,externalDefinitions:o}=e1(t),a=JSON.parse(t.jsonSchema),u=ta(JSON.parse(t.internalDefinitions));if(t={...t,jsonSchema:a,udtTypeMap:i,modelDefinitions:s,externalDefinitions:o,internalDefinitions:u},t.isUpdateScript)t.scriptOptions=sO(t),r(null,oO(t.jsonSchema,i,t));else{let l=`${nO(t.containerData)} + +${Nj(t,!0)}`;r(null,l)}}catch(i){e.log("error",{message:i.message,stack:i.stack},"Cassandra Forward-Engineering Error"),setTimeout(()=>{r({message:i.message,stack:i.stack})},150)}},generateViewScript(t,e,r,n){zf(n);let i=JSON.parse(t.jsonSchema||"{}"),s=JSON.parse(t.jsonSchema[i.viewOn]||"{}"),o=iO({schema:i,entitySchema:s,viewData:t.viewData,entityData:t.entityData,containerData:t.containerData,collectionRefsDefinitionsMap:t.collectionRefsDefinitionsMap,ifNotExist:i.viewIfNotExist});r(null,o)},generateContainerScript(t,e,r,n){try{if(zf(n),t.isUpdateScript){let{udtTypeMap:i,modelDefinitions:s,externalDefinitions:o}=e1(t);t={...t,udtTypeMap:i,modelDefinitions:s,externalDefinitions:o},t.scriptOptions=sO(t);let a=t.entities.map(u=>{let l=JSON.parse(t.jsonSchema[u]);return t.internalDefinitions=ta(JSON.parse(t.internalDefinitions[u])),oO(l,t.udtTypeMap,t)});r(null,a.filter(Boolean).join(` + +`))}else{let i=ta(JSON.parse(t.modelDefinitions)),s=JSON.parse(t.externalDefinitions),o=t.containerData,a=[],u=Sj(o),l=nO(o),f=JR(o),h=tO([i,s]),p=rO(u,[s,i],h,f),g=bj(xj(o)),d=_j(wj(o)),y=t.modelData[0].dbVersion;a.push(l,...p),t.entities.forEach(v=>{let m=ta(JSON.parse(t.internalDefinitions[v])),w=JSON.parse(t.jsonSchema[v]),x=t.entityData[v],A=Object.assign({},h,tO([m,w])),O=Cj(x),L=JR(x),j=[w,i,m,s],Y=rO(u,[m,w],A,f&&L).map(k=>eO(k,L,f)),se=Ij({tableData:w,tableMetaData:x,keyspaceMetaData:o,dataSources:j,udtTypeMap:A,isKeyspaceActivated:f}),re=Aj(Tj(x,y),j,O,u,L,f,y);a.push(...Y,se,re)}),a=a.concat(t.views.map(v=>{let m=JSON.parse(t.jsonSchema[v]||"{}");return iO({schema:m,viewData:t.viewData[v],entityData:t.entityData[m.viewOn],containerData:t.containerData,collectionRefsDefinitionsMap:t.collectionRefsDefinitionsMap,isKeyspaceActivated:f,ifNotExist:m.viewIfNotExist})})),a.push(g,d),r(null,eO(Oj(a),f))}}catch(i){e.log("error",{message:i.message,stack:i.stack},"Cassandra Forward-Engineering Error"),setTimeout(()=>{r({message:i.message,stack:i.stack})},150)}},applyToInstance(t,e,r,n){e.clear(),e.log("info",t,"connectionInfo",t.hiddenKeys),Bj(t,e,n).then(i=>{r(null,i)}).catch(i=>{r(i)})},testConnection(t,e,r,n){Rj(t,n).then(r,r)},isDropInStatements(t,e,r,n){try{zf(n);let i,{udtTypeMap:s,modelDefinitions:o,externalDefinitions:a}=e1(t);if(t.level==="container")t={...t,udtTypeMap:s,modelDefinitions:o,externalDefinitions:a},i=t.entities.map(u=>{let l=JSON.parse(t.jsonSchema[u]);return t.internalDefinitions=ta(JSON.parse(t.internalDefinitions[u])),aO(l,t.udtTypeMap,t)}).some(Boolean);else if(t.level==="entity"){let u=JSON.parse(t.jsonSchema),l=ta(JSON.parse(t.internalDefinitions));t={...t,udtTypeMap:s,modelDefinitions:o,externalDefinitions:a,jsonSchema:u,internalDefinitions:l},i=aO(t.jsonSchema,t.udtTypeMap,t)}r(null,i)}catch(i){r({message:i.message,stack:i.stack})}}};var Oj=c(t=>t.filter(e=>e).join(` + +`),"getScript"); +/*! Bundled license information: + +long/umd/index.js: + (** + * @license + * Copyright 2009 The Closure Library Authors + * Copyright 2020 Daniel Wirtz / The long.js Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *) + +node-rsa/src/NodeRSA.js: + (*! + * RSA library for Node.js + * + * Author: rzcoder + * License MIT + *) +*/ diff --git a/forward_engineering/config.json b/forward_engineering/config.json index 39d9c980..36b2e721 100644 --- a/forward_engineering/config.json +++ b/forward_engineering/config.json @@ -33,4 +33,4 @@ } } ] -} \ No newline at end of file +} diff --git a/forward_engineering/ddlProvider/ddlProvider.js b/forward_engineering/ddlProvider/ddlProvider.js index 6038301d..dd5e33f4 100644 --- a/forward_engineering/ddlProvider/ddlProvider.js +++ b/forward_engineering/ddlProvider/ddlProvider.js @@ -1,237 +1,41 @@ -const templates = require('./ddlTemplates'); -const { tab, getTableNameStatement, getUserDefinedFunctions, getUserDefinedAggregations} = require("../helpers/generalHelper"); -const { serializeOptions } = require("../helpers/indexHelper"); -const { getAlterTypePrefix } = require("../helpers/updateHelpers/udtHelper"); -const { getDiff } = require("../helpers/tableOptionService/getDiff"); -const { mergeValuesWithConfigOptions } = require("../helpers/tableHelper"); -const { parseToString } = require("../helpers/tableOptionService/parseToString"); -const { getViewName } = require("../helpers/updateHelpers/viewHelper"); -const { getOptionsScript } = require("../helpers/viewHelper"); -const { wrapInQuotes } = require("../helpers/updateHelpers/generalHelper"); - -const alterTablePrefix = (tableName, keySpace) => - keySpace ? `ALTER TABLE ${wrapInQuotes(keySpace)}.${wrapInQuotes(tableName)}` : `ALTER TABLE ${wrapInQuotes(tableName)}`; - -module.exports = app => { - - const { assignTemplates } = app.require('@hackolade/ddl-fe-utils'); - - return { - - dropTable(name) { - return assignTemplates(templates.dropTable, {name}); - }, - - createTable(modelData) { - if (!modelData.databaseName) { - return ''; - } - const { - ifNotExist, - databaseName, - items, - options - } = modelData; - - const ifNotExistStatement = ifNotExist ? `IF NOT EXISTS `:``; - - return assignTemplates(templates.createTable, { - ifNotExistStatement, - name: databaseName, - items: ` (\n` + - items.map(item => tab(item)).join(',\n') + '\n' + - `)`, - options: `${options}` - }); - }, - - dropDatabase(name) { - return !name ? '' : assignTemplates(templates.dropDatabase, {name}); - }, - - createCustomIndex(modelData) { - if (!modelData.tableName) { - return ''; - } - const { name, tableName, column, using, options, ifNotExist } = modelData; - - const ifNotExistStatement = ifNotExist? `IF NOT EXISTS `:``; - const usingStatement = using || 'StorageAttachedIndex'; - const optionsStatement = Object.keys(options).length ? '\n' + tab(`WITH OPTIONS = {\n${tab(serializeOptions(options).join(',\n'))}\n}`) : ''; - - return assignTemplates(templates.createCustomIndex, {ifNotExistStatement, name: `"${name}"`, tableName, column, usingStatement, optionsStatement}); - }, - - createIndex(modelData) { - const { name, tableName, column, ifNotExist } = modelData; - const nameStatement = name ? `"${name}"` : ''; - const ifNotExistStatement = ifNotExist? `IF NOT EXISTS `:``; - - return assignTemplates(templates.createIndex, {ifNotExistStatement, nameStatement, tableName, column}); - }, - - createSearchIndex(modelData) { - const { ifNotExist, tableName, columnsStatement, profiles, config, options } = modelData; - const ifNotExistStatement = ifNotExist? `IF NOT EXISTS `:``; - - return assignTemplates(templates.createSearchIndex, {ifNotExistStatement, tableName, columnsStatement, profiles, config, options}); - }, - - dropType(modelData) { - const { keyspaceName, typeName } = modelData; - - return assignTemplates(templates.dropType, {keyspaceName: wrapInQuotes(keyspaceName), typeName: wrapInQuotes(typeName)}); - }, - - renameColumn(modelData) { - const { tableName, keyspaceName, columnData } = modelData; - const alterTablePrefixStatement = alterTablePrefix(tableName, keyspaceName); - - return assignTemplates(templates.renameColumn, {alterTablePrefixStatement, oldName: wrapInQuotes(columnData.oldName), newName: wrapInQuotes(columnData.newName)}); - }, - - addEntity(modelData) { - const { tableName, keyspaceName, columnData } = modelData; - const alterTablePrefixStatement = alterTablePrefix(tableName, keyspaceName); - - - return assignTemplates(templates.addEntity, {alterTablePrefixStatement, name: wrapInQuotes(columnData.name), type: columnData.type}); - }, - - deleteEntity(modelData) { - const { tableName, keyspaceName, columnData } = modelData; - const alterTablePrefixStatement = alterTablePrefix(tableName, keyspaceName); - - return assignTemplates(templates.deleteEntity, {alterTablePrefixStatement, name: wrapInQuotes(columnData.name)}); - }, - - addPropertyToUdt(modelData) { - const { keySpaceName, udtName, type } = modelData; - const alterTypePrefixStatement = getAlterTypePrefix(keySpaceName); - - return assignTemplates(templates.addPropertyToUdt, {alterTypePrefixStatement, udtName: wrapInQuotes(udtName), name: wrapInQuotes(udtName), type}); - }, - - createUdt(modelData) { - const { keySpaceName, udtName, columnScript } = modelData; - - return assignTemplates(templates.createUdt, {keySpaceName: wrapInQuotes(keySpaceName), udtName: wrapInQuotes(udtName), columnScript: tab(columnScript)}); - }, - - updateUdtType(modelData) { - const { keySpaceName, udtName, columnData } = modelData; - const alterTypePrefixStatement = getAlterTypePrefix(keySpaceName); - - return assignTemplates(templates.updateUdtType, {alterTypePrefixStatement, udtName: wrapInQuotes(udtName), name: wrapInQuotes(columnData.name), type: columnData.type}); - }, - - renameType(modelData) { - const { keySpaceName, udtName, oldFieldName, newFieldName } = modelData; - const alterTypePrefixStatement = getAlterTypePrefix(keySpaceName); - - return assignTemplates(templates.renameType, { - alterTypePrefixStatement, - udtName: wrapInQuotes(udtName), - oldFieldName: wrapInQuotes(oldFieldName), - newFieldName: wrapInQuotes(newFieldName) - }); - }, - - updateType(modelData) { - const { tableName, keyspaceName, columnData } = modelData; - const alterTablePrefixStatement = alterTablePrefix(tableName, keyspaceName); - - return assignTemplates(templates.updateType, {alterTablePrefixStatement, name: wrapInQuotes(columnData.name), type: columnData.type}); - }, - - updateTableOptions(compMod, tableName, isGetOptionScript) { - if (!isGetOptionScript || !compMod) { - return ''; - } - const { keyspaceName, tableOptions = {}, comments } = compMod; - const isCommentNew = comment => comment?.new && comment.new !== comment.old; - const alterTablePrefixStatement = alterTablePrefix(tableName, keyspaceName); - - const optionsDiff = getDiff(tableOptions.new || {}, tableOptions.old || {}); - const configOptionsWithValues = mergeValuesWithConfigOptions(optionsDiff); - const optionsStatement = isCommentNew(comments) - ? parseToString(configOptionsWithValues, comments.new) - : parseToString(configOptionsWithValues); - - return optionsStatement - ? assignTemplates(templates.updateTableOptions, {alterTablePrefixStatement, optionsStatement: tab(optionsStatement)}) - : ''; - }, - - dropSearchIndexConfig(keyspaceName, tableName, indexName) { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - - return assignTemplates(templates.dropSearchIndexConfig, {tableNameStatement, indexName}); - }, - - modifySearchIndex(keyspaceName, tableName, key, value) { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - - return assignTemplates(templates.modifySearchIndex, {tableNameStatement, key, value}); - }, - - dropSearchIndex(keyspaceName, tableName) { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - - return assignTemplates(templates.dropSearchIndex, {tableNameStatement}); - }, - - dropIndex(keyspaceName, tableName) { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - - return assignTemplates(templates.dropIndex, {tableNameStatement}); - }, - - dropKeySpace(keySpaceName) { - - return assignTemplates(templates.dropKeySpace, {keySpaceName: wrapInQuotes(keySpaceName)}); - }, - - createKeySpace(keySpaceName, replication, durableWrites, udfData, udaData) { - const udfScript = getUserDefinedFunctions(udfData); - const udaScript = getUserDefinedAggregations(udaData); - - return assignTemplates(templates.createKeySpace, { - keySpaceName: wrapInQuotes(keySpaceName), - replication: tab(replication), - durableWrites: tab(durableWrites), - udfScript, - udaScript - }); - }, - - alterKeySpaceReplication(keySpaceName, replication, durableWrites) { - - return assignTemplates(templates.alterKeySpaceReplication, {keySpaceName: wrapInQuotes(keySpaceName), replication: tab(replication), durableWrites: tab(durableWrites, 2)}); - }, - - dropView(modelData) { - const { compMod, name, code } = modelData.role; - const viewName = getViewName(compMod.keyspaceName, code || name); - - return assignTemplates(templates.dropView, {viewName}); - }, - - alterView(role) { - const viewData = [role]; - const optionScript = getOptionsScript({ - collectionRefsDefinitionsMap: role.compMod.collectionData?.collectionRefsDefinitionsMap || {}, - viewData - }); - const viewName = role.name || role.code; - const keyspaceName = role.compMod.keyspaceName; - if (optionScript) { - const keySpaceViewName = getViewName(keyspaceName, viewName); - - return assignTemplates(templates.alterView, {keySpaceViewName, optionScript: tab(optionScript)}); - } - - return ''; - }, - } -}; \ No newline at end of file +"use strict";var sn=Object.defineProperty;var i=(e,t)=>sn(e,"name",{value:t,configurable:!0});var I=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var Fe=I((Xs,De)=>{"use strict";De.exports={dropTable:"DROP TABLE IF EXISTS ${name};",createTable:"CREATE TABLE ${ifNotExistStatement}${name}${items}${options};",dropDatabase:"DROP DATABASE IF EXISTS ${name};",createCustomIndex:"CREATE CUSTOM INDEX ${ifNotExistStatement}${name}\n ON ${tableName} (${column})\n USING '${usingStatement}'${optionsStatement};",createIndex:"CREATE INDEX ${ifNotExistStatement}${nameStatement}\n ON ${tableName} (${column});",createSearchIndex:"CREATE SEARCH INDEX ${ifNotExistStatement}ON ${tableName}\n WITH COLUMNS\n${columnsStatement}${profiles}${config}${options};",dropType:"DROP TYPE IF EXISTS ${keyspaceName}.${typeName};",renameColumn:"${alterTablePrefixStatement} RENAME ${oldName} TO ${newName};",addEntity:"${alterTablePrefixStatement} ADD ${name} ${type};",deleteEntity:"${alterTablePrefixStatement} DROP ${name};",addPropertyToUdt:"${alterTypePrefixStatement}.${udtName} ADD ${name} ${type};",createUdt:"CREATE TYPE IF NOT EXISTS ${keySpaceName}.${udtName} (\n${columnScript} \n);",updateUdtType:"${alterTypePrefixStatement}.${udtName}\nALTER ${name} TYPE ${type};",renameType:"${alterTypePrefixStatement}.${udtName} \n RENAME ${oldFieldName} TO ${newFieldName};",updateType:"${alterTablePrefixStatement} \n ALTER ${name} TYPE ${type};",updateTableOptions:"${alterTablePrefixStatement}${optionsStatement};",dropSearchIndexConfig:"ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n DROP ${indexName};",modifySearchIndex:"ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n SET ${key} = ${value};",dropSearchIndex:"DROP SEARCH INDEX ON ${tableNameStatement};",dropIndex:"DROP INDEX IF EXISTS ${tableNameStatement};",dropKeySpace:"DROP KEYSPACE IF EXISTS ${keySpaceName};",createKeySpace:"CREATE KEYSPACE IF NOT EXISTS ${keySpaceName} \n${replication}\n${durableWrites}${udfScript}${udaScript};",alterKeySpaceReplication:"ALTER KEYSPACE ${keySpaceName} \n${replication}\n${durableWrites};",dropView:"DROP MATERIALIZED VIEW IF EXISTS ${viewName};",alterView:"ALTER MATERIALIZED VIEW ${keySpaceViewName}\n${optionScript};"}});var se=I((Qs,we)=>{"use strict";var Le=require("fs"),w=require("path"),ne=i(e=>{try{let t=Le.readFileSync(w.join(__dirname,"..",e));return JSON.parse(t.toString().replace(/\/\*[\s\S]*?\*\//g,""))}catch{return{}}},"getConfig"),re=i(e=>{let t;return(...n)=>(t||(t=e(...n)),t)},"cacheResult"),on=re(()=>ne(w.join("properties_pane","field_level","fieldLevelConfig.json"))),an=re(()=>ne(w.join("properties_pane","entity_level","entityLevelConfig.json"))),cn=re(()=>{let e=i(r=>r.replace(/\.json/,""),"getName"),t=w.join(__dirname,"..","types");return Le.readdirSync(t).reduce((r,s)=>(r[e(s)]=ne(w.join("types",s)),r),{})});we.exports={getEntityLevelConfig:an,getFieldLevelConfig:on,getTypesConfig:cn}});var v=I((eo,qe)=>{"use strict";var{getEntityLevelConfig:Js,getFieldLevelConfig:un,getTypesConfig:dn}=se(),ln=2,mn=i((e="")=>e.startsWith("DSE")&&(e.split(" ")[1]||"").split(".")[0]||"","getDataStaxVersion"),pn=i((e,t=1)=>{let n=" ".repeat(t*ln);return e.split(` +`).map(r=>n+r).join(` +`)},"tab"),R=i((e,t,n,r="")=>((e||[])[t]||{})[n]||r,"retrivePropertyFromConfig"),yn=i(e=>R(e,0,"code",R(e,0,"name","")),"retrieveContainerName"),fn=i(e=>R(e,0,"code",R(e,0,"collectionName","")),"retrieveEntityName"),gn=i(e=>R(e,1,"UDFs",[]),"retrieveUDF"),Nn=i(e=>R(e,2,"UDAs",[]),"retrieveUDA"),Sn=i((e,t)=>{let n=e[1],r={indexes:R(e,1,"SecIndxs",[])};return n.searchIndex&&(r.searchIndex={indexType:"search",columns:n.searchIndexColumns,config:n.searchIndexConfig,profiles:je(n.searchIndexProfiles,t),options:n.searchIndexOptions,ifNotExist:n.searchIndexIfNotExist}),r},"retrieveIndexes"),Ke=i((e,t)=>e.filter(n=>!t.includes(n)),"filterSpaceSaving"),je=i((e,t)=>{let n=mn(t),s=[(n.length?Number(n)>=6:!1)?"spaceSavingNoTextfield":""];return e=Array.isArray(e)?e:[e].filter(Boolean),e=Ke(e,s),Ke(["spaceSavingNoJoin","spaceSavingNoTextfield","spaceSavingSlowTriePrecision"],s).every(u=>e.includes(u))?["spaceSavingAll"]:e},"getIndexProfiles"),Tn=i((e,t)=>Ue(e,`"${t}"`),"getTableNameStatement"),Ue=i((e,t)=>`${e?`"${e}".`:""}${t}`,"getNameWithKeyspace"),En=i(e=>dn()[e],"getTypeConfig"),_e=i((e,t)=>{let n=un().structure;return n[e]?n[e].find(s=>s.propertyKeyword===t):void 0},"getFieldConfig"),oe=i((e,t)=>{let n=Object.assign({},e),r=i((o,a)=>Object.keys(o).reduce((u,c)=>{let l=o[c];return u[c]=a(oe(l,a),c),u},{}),"eachProperty"),s=i((o,a)=>o.map((u,c)=>a(oe(u,a),c)),"eachItem");if(n.hasOwnProperty("properties")&&(n.properties=r(n.properties,t)),n.hasOwnProperty("items")){let o=Array.isArray(n.items)?n.items:[n.items];n.items=s(o,t)}return n},"eachField"),In=i((e,t)=>{let n=_e(e,"mode")||{};return Array.isArray(n.options)?n.options.includes(t):!1},"canTypeHaveSubtype"),On=i((e,t=!0,n=!0,r=!0)=>{if(t||!n||!e)return e;let s=i((a,u="-- ")=>a.split(` +`).map(c=>`${u}${c}`).join(` +`),"insertBeforeEachLine");return r?i(a=>`/* +${s(a," ")} +*/`,"multiLineComment")(e):s(e)},"commentDeactivatedStatement"),hn=i(e=>{var n;let t=(n=e==null?void 0:e[0])==null?void 0:n.isActivated;return t===void 0?!0:t},"retrieveIsItemActivated"),Cn=i(e=>e.map(t=>t.functionBody).filter(t=>t).join(` +`),"getUserDefinedFunctions"),An=i(e=>e.map(t=>t.storedProcFunction).filter(t=>t).join(` +`),"getUserDefinedAggregations"),$n=i(e=>{let{applyDropStatements:t,additionalOptions:n=[]}=e.options||{},r=(n.find(s=>s.id==="applyDropStatements")||{}).value;return t||r},"getApplyDropStatement");qe.exports={tab:pn,retrieveContainerName:yn,retrieveEntityName:fn,retrieveUDF:gn,retrieveUDA:Nn,retrieveIndexes:Sn,retrivePropertyFromConfig:R,getTableNameStatement:Tn,getFieldConfig:_e,getTypeConfig:En,getNameWithKeyspace:Ue,eachField:oe,canTypeHaveSubtype:In,commentDeactivatedStatement:On,retrieveIsItemActivated:hn,getUserDefinedAggregations:An,getUserDefinedFunctions:Cn,getIndexProfiles:je,getApplyDropStatement:$n}});var K=I((no,ze)=>{"use strict";var Me="LINE",Ve="INLINE",ie="MULTILINE",Be=i((e,t="-- ")=>e.split(` +`).map(n=>n&&`${t}${n}`).join(` +`),"insertBeforeEachLine"),bn=i(e=>`/* +${Be(e," ")} +*/`,"multiLineComment"),We=i(e=>`/* ${e} */`,"inlineComment"),vn=i((e,t=!0,n=!0,r=ie)=>{if(t||!n||!e)return e;switch(r){case ie:return bn(e);case Ve:return We(e);case Me:return Be(e);default:return e}},"commentDeactivatedStatement");ze.exports={commentDeactivatedStatement:vn,inlineComment:We,LINE:Me,INLINE:Ve,MULTILINE:ie}});var H=I((so,Ge)=>{"use strict";var xn=["isActivated","type","compositePartitionKey"],He=i((e={},t=!1)=>t?e:xn.reduce((n,r)=>!e.hasOwnProperty(r)||e[r]===void 0?n:{...n,[r]:e[r]},{}),"getAttributes"),j=i((e,t,n)=>{if(e.GUID===t||e.id===t)return n;if(e.properties)return Object.keys(e.properties).reduce((r,s)=>{if(r)return r;{let o=e.properties[s];return j(o,t,[...n,o.GUID||o.id])}},void 0);if(e.items)return Array.isArray(e.items)?e.items.reduce((r,s)=>r||j(s,t,[...n,s.GUID||s.id]),void 0):j(e.items,t,[...n,e.items.GUID])},"getPathById"),Rn=i((e,t,n)=>{let r=Object.keys(t).find(o=>t[o].GUID===e||t[o].id===e),s=t[r];return s&&(s.code||s.name)?{name:s.code||s.name,...He(t[r],n)}:{name:r,...He(t[r],n)}},"getRootItemMetadataById"),kn=i((e,t,n)=>{let r=j(t,e,[]);return r?Rn(r[0],t.properties,n):{name:""}},"findFieldMetadataById"),Pn=i((e,t,n)=>e.reduce((r,s)=>{for(let o=0;o{"use strict";var ae={},Dn=i(e=>{ae.lodash=e.require("lodash"),ae.provider=Xe()(e)},"setDependencies");Ye.exports={setDependencies:Dn,dependencies:ae}});var tt=I((co,et)=>{"use strict";var{commentDeactivatedStatement:Fn,inlineComment:Ln}=K(),{tab:U,getTableNameStatement:wn}=v(),{getNamesByIds:Qe}=H(),{dependencies:ce}=$(),Kn=i((e,t,n,r,s,o,a)=>{let u=wn(r,n),c=s&&o,l=jn(u,t,e.indexes),m=a==="Astra DB"?[]:Un(u,t,c,e.searchIndex);return[...l,...m].map(f=>Fn(f.statement,f.isActivated,c)).join(` + +`)},"getIndexes"),jn=i((e,t,n=[])=>Mn(n).map(r=>{let s,o=r.isActivated&&Je(r.SecIndxKey,t),a=Ze(r.SecIndxKey,t);return r.indexType==="custom"?s=ce.provider.createCustomIndex({name:r.name,tableName:e,column:a,using:r.isSASI?"org.apache.cassandra.index.sasi.SASIIndex":"StorageAttachedIndex",options:Bn(r.customOptions,r.isSASI),ifNotExist:r.indexIfNotExist}):s=ce.provider.createIndex({name:r.name,tableName:e,column:a,ifNotExist:r.indexIfNotExist}),{isActivated:o,statement:s}}),"getGeneralIndexes"),Un=i((e,t,n,r)=>{if(!r)return[];let s=[];r.columns&&(s=_n(r.columns.filter(c=>Array.isArray(c.key)&&c.key.length).map(c=>({...c,name:Ze(c.key[0],t),isActivated:Je(c.key[0],t)}))));let a=s.filter(c=>c.isActivated).length>0,u=Wn({tableName:e,isActivated:a&&n,index:r,columns:s,ifNotExist:r.ifNotExist});return[{isActivated:a,statement:u}]},"getSearchIndexStatement"),_n=i(e=>e.reduce((t,n)=>t.find(s=>s.name===n.name)?t:t.concat(n),[]),"uniqueByName"),Ze=i((e,t)=>{let{name:n}=Qe([e.keyId],t)[e.keyId]||{};return n?qn(`"${n}"`,e.type):""},"getIndexColumnStatement"),qn=i((e,t)=>t==="keys"?`KEYS(${e})`:t==="values"?`VALUES(${e})`:t==="entries"?`ENTRIES(${e})`:t==="full"?`FULL(${e})`:e,"wrapKey"),Je=i((e,t)=>{let{isActivated:n}=Qe([e.keyId],t)[e.keyId]||{};return n!==!1},"isIndexColumnKeyActivated"),Mn=i(e=>e.reduce((t,n)=>[...t,...(n.SecIndxKey||[]).map((r,s)=>Object.assign({},n,{name:s>0?n.name+"_"+s:n.name,SecIndxKey:r}))],[]),"unwindIndexes"),Vn=i(e=>Object.keys(e).map(t=>`'${t}': '${e[t]}'`),"serializeOptions"),Bn=i((e,t)=>{let n={};return!e||(e.case_sensitive&&(n.case_sensitive="true"),e.normalize&&(n.normalize="true"),e.ascii&&!t&&(n.ascii="true"),e.similarity_function&&!t&&(n.similarity_function=`${e.similarity_function}`),!t)||(e.analyzed&&(n.analyzed="true"),e.isLiteral&&(n.is_literal="true"),e.tokenizationEnableStemming&&(n.tokenization_enable_stemming="true"),e.tokenizationNormalizeLowercase&&(n.tokenization_normalize_lowercase="true"),e.tokenizationNormalizeUppercase&&(n.tokenization_normalize_uppercase="true"),e.normalizeLowercase&&(n.normalize_lowercase="true"),e.normalizeUppercase&&(n.normalize_uppercase="true"),e.tokenizationLocale&&(n.tokenization_locale=`${e.tokenizationLocale}`),e.tokenizationSkipStopWords&&(n.tokenization_skip_stop_words=`${e.tokenizationSkipStopWords}`),e.mode&&(n.mode=`${e.mode}`),e.analyzerClass&&(n.analyzer_class=`${e.analyzerClass}`),e.maxCompactionFlushMemoryInMb&&(n.max_compaction_flush_memory_in_mb=`${e.maxCompactionFlushMemoryInMb}`)),n},"getCustomOptions"),Wn=i(({tableName:e,columns:t,index:n,isActivated:r,ifNotExist:s})=>{let o=Hn(zn(t),r),a=n.profiles.length?` +${U(`AND PROFILES ${n.profiles.join(", ")}`)}`:"",u=Gn(n.config),c=u?` +${U(`AND CONFIG ${u}`)}`:"",l=Yn(n.options),m=l?` +${U(`AND OPTIONS ${l}`)}`:"";return ce.provider.createSearchIndex({ifNotExist:s,tableName:e,columnsStatement:U(o,2),profiles:a,config:c,options:m})},"getSearchIndex"),zn=i(e=>e.map(t=>{let n=[];return t.copyField&&n.push("copyField: true"),t.docValues&&n.push("docValues: true"),t.excluded&&n.push("excluded: true"),t.indexed||n.push("indexed: false"),t.lowerCase&&n.push("lowerCase: true"),{statement:`${t.name}${n.length?` {${n.join(", ")}}`:""}`,isActivated:t.isActivated}}),"getSearchIndexColumns"),Hn=i((e,t)=>{let n=t?e.filter(a=>!a.isActivated):[],r=t?e.filter(a=>a.isActivated):e,s=n.length?n.map(({statement:a})=>a).join(`, +`).split(` +`).map(Ln).join(` +`):"",o=r.map(({statement:a})=>a).join(`, +`);return s&&o?s+`, +`+o:s||o},"getSearchIndexColumnStatements"),Gn=i((e={})=>{let t=[];return e.autoCommitTime&&e.autoCommitTime!==1e4&&t.push(`autoCommitTime: ${e.autoCommitTime}`),e.defaultQueryField&&t.push(`defaultQueryField: '${e.defaultQueryField}'`),e.directoryFactory&&t.push(`directoryFactory: '${e.directoryFactory}'`),e.filterCacheLowWaterMark&&e.filterCacheLowWaterMark!==1024&&t.push(`filterCacheLowWaterMark: ${e.filterCacheLowWaterMark}`),e.filterCacheHighWaterMark&&e.filterCacheHighWaterMark!==2048&&t.push(`filterCacheHighWaterMark: ${e.filterCacheHighWaterMark}`),e.directoryFactoryClass&&t.push(`directoryFactoryClass: '${e.directoryFactoryClass}'`),e.mergeMaxThreadCount&&e.mergeMaxMergeCount&&(t.push(`mergeMaxThreadCount: ${e.mergeMaxThreadCount}`),t.push(`mergeMaxMergeCount: ${e.mergeMaxMergeCount}`)),e.ramBufferSize&&e.ramBufferSize!==512&&t.push(`ramBufferSize: ${e.ramBufferSize}`),e.realtime&&t.push("realtime: true"),t.length?`{ +${U(t.join(`, +`))} +}`:""},"getSearchIndexConfig"),Yn=i((e={})=>{let t=[];return e.recovery&&t.push("recovery: true"),e.reindex||t.push("reindex: false"),e.lenient&&t.push("lenient: true"),t.length?`{${t.join(", ")}}`:""},"getSearchIndexOptions");et.exports={getIndexes:Kn,serializeOptions:Vn}});var G=I((lo,ct)=>{"use strict";var{getFieldConfig:rt,getTypeConfig:nt,canTypeHaveSubtype:Xn}=v(),st=i(e=>{let t,n=i((r,s)=>{if(r===e)t=s;else if(r===void 0)return t;return n},"handler");return n},"ifType"),ue=i((e,t,n)=>{if(e){let r=rt(e,"mode"),s=r&&r.options?r.options[0]:e;return me(e,n)({type:e,mode:s,frozen:!0,keyType:"char",keySubtype:"text",items:{type:"char",mode:"varchar"},properties:{field:{type:"char",mode:"varchar"}}})}return t},"getModeType"),ot=i((e,t)=>{let n=i(o=>o.type,"simpleType"),r=i(o=>`'${o.subType||"PointType"}'`,"geoSpatialType"),s=i(o=>{if(o.physicalType)return me(o.physicalType)(Object.assign(o,{type:o.physicalType}))},"getJsonType");return st(e)("char",o=>o.mode||"text")("numeric",o=>{let a=o.mode||"integer";return a==="integer"?"int":a})("binary",()=>"blob")("bool",()=>"boolean")("blob",n)("timestamp",n)("date",n)("time",n)("duration",n)("uuid",n)("timeuuid",n)("DseExecutorStateType",o=>`'${n(o)}'`)("DateRangeType",o=>`'${n(o)}'`)("geospatial",r)("udt",(o,a)=>de(a,t)())("jsonObject",s)("jsonArray",s)()},"getScalarType"),it=i((e,t,n)=>{let r=i(d=>!!d.frozen,"isFrozen"),s=i(d=>p=>{let E=d(p);return r(p)?le(E):E},"setFrozen"),o=i((d,p,E,S)=>{var g,h,F,x,z,Pe;if(d.items)if(Array.isArray(d.items)){let L=((g=d.items[0])==null?void 0:g.code)||((h=d.items[0])==null?void 0:h.name)||((F=d.items[0])==null?void 0:F.displayName);return u(d.items[0],r(d),L||0)}else{let L=((x=d.items)==null?void 0:x.code)||((z=d.items)==null?void 0:z.name)||((Pe=d.items)==null?void 0:Pe.displayName);return u(d.items,r(d),L||0)}else{let L=nt(d.type);if(L.subtypes&&d.subtype){let te=L.subtypes[d.subtype];if(te&&te.childValueType)return ue(te.childValueType,p,E)}}return p},"getValueTypeFromArray"),a=i((d,p,E)=>{if(d.properties){let S=Object.keys(d.properties)[0];if(S){let g=d.properties[S];return u(g,r(d),S)}}else{let S=nt(d.type);if(S.subtypes&&d.subtype){let g=S.subtypes[d.subtype];if(g&&g.childValueType)return ue(g.childValueType,p,E)}}return p},"getValueTypeFromObject"),u=((d,p)=>(E,S,g)=>{if(E){let h=Qn(E,!S&&d,p,g);if(h!==void 0)return h}else return"text"})(t,n),c=i((d,p)=>`set<${o(d,"varchar",n,p)}>`,"typeSet"),l=i((d,p)=>`list<${o(d,"text",n,p)}>`,"list"),m=i((d,p)=>`tuple<${(Array.isArray(d.items)?d.items:[d.items]).map((S,g)=>u(S,!0,g)).join(", ")}>`,"tuple"),y=i((d,p)=>{let E=Xn(d.keyType,d.keySubtype)?d.keySubtype:ue(d.keyType,"text",n),S=a(d,"text",n,p);return`map<${E}, ${S}>`},"map"),f=i((d,p)=>{let E=o(d,"float",n,p),S=Jn(d);return`vector<${E}, ${S}>`},"vector");return st(e)("map",s(y))("list",s(l))("set",s(c))("vector",s(f))("tuple",m)()},"getStructuralTypeHandler"),de=i((e,t,n)=>()=>{let r=t[e]||{};return r.frozen&&!n?le(r.name):r.name},"getUDTHandler"),le=i(e=>e===void 0?void 0:`frozen<${e}>`,"getFrozen"),me=i((e,t)=>ot(e,t)||it(e,!0,t)||de(e,t),"getHandlerByType"),Qn=i((e,t,n,r)=>{let s=at(e),o=ot(s,n);if(o)return o(e,r);let a=(it(s,!1,n)||de(s,n,t))(e,r);return t?le(a):a},"getNestedTypeByData"),at=i(e=>e.$ref?e.$ref.split("/definitions/").pop():e.type?e.type:"char","getTypeByPropertyData"),Zn=i((e,t,n)=>{let r=at(e);return me(r,t)(e,n)},"getTypeByData"),Jn=i(e=>{if(!isNaN(+e.dimension))return e.dimension;let t=rt(e.type,"dimension");return t==null?void 0:t.defaultValue},"getVectorDimension");ct.exports={getTypeByData:Zn}});var pe=I((po,ut)=>{"use strict";var{getTypeByData:er}=G(),{commentDeactivatedStatement:tr}=v();ut.exports={getColumnDefinition(e,t={},n=!1){return Object.keys(e).map(r=>{let s=e[r],o=sr(s,t,r);if(o===void 0)return"";{let a=rr(s.code||r,o,nr(s));return tr(a,s.isActivated,n,!1)}}).filter(r=>r).join(`, +`)}};var nr=i(e=>!!(e||{}).static,"isStatic"),rr=i((e,t,n)=>`"${e}" ${t}${n?" STATIC":""}`,"getColumn"),sr=i((e,t,n)=>er(e,t,n),"getTypeDefinition")});var lt=I((fo,dt)=>{"use strict";var or=Object.freeze({ADD:"ADD",AGGREGATE:"AGGREGATE",ALLOW:"ALLOW",ALTER:"ALTER",AND:"AND",ANY:"ANY",APPLY:"APPLY",ASC:"ASC",AUTHORIZE:"AUTHORIZE",BATCH:"BATCH",BEGIN:"BEGIN",BY:"BY",COLUMNFAMILY:"COLUMNFAMILY",CREATE:"CREATE",DELETE:"DELETE",DESC:"DESC",DROP:"DROP",EACH_QUORUM:"EACH_QUORUM",ENTRIES:"ENTRIES",FROM:"FROM",FULL:"FULL",GRANT:"GRANT",IF:"IF",IN:"IN",INDEX:"INDEX",INET:"INET",INFINITY:"INFINITY",INSERT:"INSERT",INTO:"INTO",KEYSPACE:"KEYSPACE",KEYSPACES:"KEYSPACES",LIMIT:"LIMIT",LOCAL_ONE:"LOCAL_ONE",LOCAL_QUORUM:"LOCAL_QUORUM",MATERIALIZED:"MATERIALIZED",MODIFY:"MODIFY",NAN:"NAN",NORECURSIVE:"NORECURSIVE",NOT:"NOT",OF:"OF",ON:"ON",ONE:"ONE",ORDER:"ORDER",PARTITION:"PARTITION",PASSWORD:"PASSWORD",PER:"PER",PRIMARY:"PRIMARY",QUORUM:"QUORUM",RENAME:"RENAME",REVOKE:"REVOKE",SCHEMA:"SCHEMA",SELECT:"SELECT",SET:"SET",TABLE:"TABLE",TIME:"TIME",THREE:"THREE",TO:"TO",TOKEN:"TOKEN",TRUNCATE:"TRUNCATE",TWO:"TWO",UNLOGGED:"UNLOGGED",UPDATE:"UPDATE",USE:"USE",USING:"USING",VIEW:"VIEW",WHERE:"WHERE",WITH:"WITH"}),ir=Object.values(or);dt.exports={ReservedWordsAsArray:ir}});var ye=I((go,pt)=>{"use strict";var{dependencies:mt}=$(),{ReservedWordsAsArray:ar}=lt(),cr=i((e,t)=>[...e,...t],"mergeArrays"),ur={blob:["ascii","bigint","boolean","decimal","double","float","inet","int","timestamp","timeuuid","uuid","varchar","varint"],varint:["int"],varchar:["text"],uuid:["timeuuid"],text:["varchar"]},dr=i(e=>{let t=e.filter(r=>r.dbVersion)[0].dbVersion,n=t.search(/\d/);if(n!==-1)return t[n]<3},"checkIsOldModel"),lr=i((e,t)=>{let n=ur[t];return!(!n||!n.filter(s=>s===e).length)},"fieldTypeCompatible"),mr=i(e=>/\s|\W/.test(e)||mt.lodash.includes(ar,mt.lodash.toUpper(e))?`"${e}"`:e,"wrapInQuotes");pt.exports={mergeArrays:cr,checkIsOldModel:dr,fieldTypeCompatible:lr,wrapInQuotes:mr}});var ge=I((So,Et)=>{"use strict";var{inlineComment:yt}=K(),{dependencies:ft}=$(),pr="numeric",yr="text",fr="details",gr="checkbox",Nt="otherProperties",St="caching",Nr=[St,Nt],Y=i(e=>e===""?` +WITH`:" AND","getStringStart"),Tt=i(e=>String(e||"").replace(/[\"\`]/g,"'"),"changeQuotes"),gt={localReadRepairChance:"dclocal_read_repair_chance",readRepairChance:"read_repair_chance",gcGraceSeconds:"gc_grace_seconds",bloomFilterFalsePositiveChance:"bloom_filter_fp_chance",defaultTtl:"default_time_to_live",speculativeRetry:"speculative_retry",minIndexInterval:"min_index_interval",maxIndexInterval:"max_index_interval",crcCheckChance:"crc_check_chance",memtableFlushPeriod:"memtable_flush_period_in_ms"},fe=i(e=>gt.hasOwnProperty(e)?gt[e]:e,"convertKeywordToTableOptionName"),Sr=i(e=>Nr.includes(e.propertyKeyword)?Tr(e):Er(e),"transformOption"),Tr=i(e=>{switch(e.propertyKeyword){case St:return $r(e);case Nt:return Cr(e);default:return null}},"transformSpecialOption"),Er=i(e=>{switch(e.propertyType){case yr:return Ir(e);case gr:return Ar(e);case pr:return Or(e);case fr:return hr(e);default:return null}},"transformOptionByPropertyType"),Ir=i(e=>`${fe(e.propertyKeyword)} = '${e.value}'`,"transformTextOption"),Or=i(e=>`${fe(e.propertyKeyword)} = ${e.value}`,"transformNumericOption"),hr=i(e=>{let r=i(s=>typeof s=="object"?JSON.stringify(e.value):s,"getStringValue")(e.value).replace(/\n/g,"");return`${fe(e.propertyKeyword)} = ${Tt(r)}`},"transformDetailsOptions"),Cr=i(e=>e.value.reduce((n,r)=>{let{name:s,value:o}=r;if(!s||!o)return n;let a=n===""?"":" AND";return n.concat(`${a} ${s} = '${o}' +`)},"").replace(/\n$/,""),"transformOtherOptions"),Ar=i(e=>{let t=e.propertyKeyword;return e.value?t==="cdc"?"cdc = TRUE":t==="compactStorage"?"COMPACT STORAGE":null:null},"transformBooleanOption"),$r=i(e=>{let t=i(c=>s.includes(c)?c:null,"validateKeys"),n=i(c=>s.includes(c)?c:isNaN(c)?null:Number(c),"validateRows"),r=i((c,l)=>Object.assign({},c&&{keys:c},l&&{rows_per_partition:l}),"createValueObject"),s=["ALL","NONE"],o=t(e.value.keys),a=n(e.value.rowsPerPartition);if(!o&&!a)return null;let u=JSON.stringify(r(o,a));return`caching = ${Tt(u)}`},"transformCachingOption"),br=i((e,t)=>{if(!t.value&&typeof t.value!="number")return e;let n=Sr(t);if(!n)return e;let r=Y(e);return e.concat(`${r} ${n} +`)},"generateOptionsStringReducer"),vr=i((e,t)=>{if(t){let n=Y(e);return e.concat(`${n} comment = '${t}' +`)}return e},"addCommentToOptionString"),xr=i((e,t)=>{if(!e)return t;let n=Y(t);return t.concat(`${n} ID = '${e}' +`)},"addId"),Rr=i((e,t,n,r)=>{let s=e.filter(m=>t[m&&m.keyId]);if(!s.length)return n;let o=i(m=>m.map(y=>{let{keyId:f,type:d}=y,{name:p}=t[f];return`"${p}" ${d==="descending"?"DESC":"ASC"}`}),"mapKeys"),[a,u]=ft.lodash.partition(s,({keyId:m})=>ft.lodash.get(t,`${m}.isActivated`)!==!1);a=o(a),u=o(u);let c;r?u.length===0?c=a.join(", "):a.length===0?c=yt(u.join(", ")):c=`${a.join(", ")} ${yt(`, ${u.join(", ")}`)}`:c=o(s).join(", ");let l=Y(n);return n.concat(`${l} CLUSTERING ORDER BY (${c}) +`)},"addClustering");Et.exports={parseToString(e,t){let n=e.reduce(br,"");return vr(n,t)},addId:xr,addClustering:Rr}});var X=I((Eo,vt)=>{"use strict";var{retrieveContainerName:kr,retrieveEntityName:Pr,retrivePropertyFromConfig:P,getTableNameStatement:Dr,commentDeactivatedStatement:Fr}=v(),{getColumnDefinition:Lr}=pe(),{getNamesByIds:It}=H(),{getEntityLevelConfig:wr}=se(),{parseToString:Kr,addId:jr,addClustering:Ur}=ge(),{inlineComment:Ot}=K(),{dependencies:At}=$(),_r=i((e,t,n,r,s,o)=>{let a=[];return n&&a.push(n),r&&a.push(`PRIMARY KEY (${r})`),At.provider.createTable({ifNotExist:o,databaseName:Dr(e,t),items:a,options:s})},"getCreateTableStatement"),ht=i((e,t,n)=>{let r=qr(e,n),s=Mr(t,n),o=[];return r&&o.push(r),s&&o.push(s),o.join(s.startsWith("/*")||r.endsWith("*/")?" ":", ")},"getPrimaryKeyList"),qr=i((e,t)=>{let n=Object.keys(e);if(n.length){let r=bt(n,e,t);return n.length>1?`(${r})`:r}else return""},"getPartitionKeys"),Mr=i((e,t)=>{let n=Object.keys(e);return n.length?bt(n,e,t):""},"getClusteringKeys"),Vr=i((e,t)=>e.map(n=>{let r=t[n.propertyKeyword];return r===void 0?n:Object.assign({},n,{value:r})}),"seedOptionsWithValues"),Br=i(e=>e.structure.find(n=>n.propertyName==="Options").structure,"getOptionsFromTab"),$t=i(e=>{let[t]=wr(),n=Br(t);return Vr(n,e)},"mergeValuesWithConfigOptions"),Ct=i((e,t,n,r,s,o)=>{let a=$t(r),u=jr(n,Ur(e,t,Kr(a,s),o));return u?u.replace(/\n$/,""):""},"getOptions"),bt=i((e,t,n)=>{let r=i(a=>a.map(u=>t[u].name).join('", "'),"joinKeys");if(!n)return`"${r(e)}"`;let[s,o]=At.lodash.partition(e,a=>t[a].isActivated!==!1);return o.length===0?`"${r(s)}"`:s.length===0?`${Ot(`"${r(o)}"`)}`:`"${r(s)}" ${Ot(`, "${r(o)}"`)}`},"commentDeactivatedKeys");vt.exports={getOptions:Ct,getPrimaryKeyList:ht,getTableStatement({tableData:e,tableMetaData:t,dataSources:n,keyspaceMetaData:r,udtTypeMap:s,isKeyspaceActivated:o}){let a=kr(r),u=Pr(t),c=P(t,0,"compositePartitionKey",[]),l=P(t,0,"compositeClusteringKey",[]),m=P(t,0,"schemaId",""),y=P(t,0,"comments",""),f=P(t,0,"tableOptions",""),d=P(t,0,"isActivated",!1),p=o&&d,E=It(c.map(h=>h.keyId),n),S=It(l.map(h=>h.keyId),n),g=_r(a,u,Lr(e.properties||{},s,p),ht(E,S,p),Ct(l,S,m,f,y,p),P(t,0,"tableIfNotExist",void 0));return Fr(g,d,o)},mergeValuesWithConfigOptions:$t}});var Q=I((Oo,xt)=>{"use strict";var Te=class Te{script;isDropScript;isModifyScript;isAddScript};i(Te,"ModificationScript");var Ne=Te,Ee=class Ee{isActivated;scripts;static getInstances(t,n,r,s){return(t||[]).filter(Boolean).map(o=>this.getInstance([o],n,r,s))}static getInstance(t,n,r,s){var a;if(!((a=t==null?void 0:t.filter(Boolean))!=null&&a.length))return;let o={deletion:!1,add:!1,modify:!1};if(o[r]===void 0)throw new Error(`Unsupported scriptPurpose provided: ${r}`);return o[r]=!0,{isActivated:n,scripts:t.filter(Boolean).map(u=>({isDropScript:o.deletion,script:u,isModifyScript:o.modify,isAddScript:o.add,modelLevel:s}))}}};i(Ee,"AlterScriptDto");var Se=Ee;xt.exports={ModificationScript:Ne,AlterScriptDto:Se}});var Kt=I((Co,wt)=>{"use strict";var{getTypeByData:Rt}=G(),{getNamesByIds:Ie}=H(),{dependencies:C}=$(),{eachField:Wr,getTableNameStatement:Ft}=v(),{getTableStatement:zr}=X(),{AlterScriptDto:Z}=Q(),k={modifiedColumn:[],addTable:[],deleteTable:[]},Hr=i(e=>J(e)?[]:[Z.getInstance([C.provider.addEntity(e)],!0,"add","field")],"getAdd"),Gr=i(e=>J(e)?[]:[Z.getInstance([C.provider.deleteEntity(e)],!0,"deletion","field")],"getDelete"),Lt=i(e=>{let{tableName:t,keyspaceName:n,columnData:r}=e,s=Ft(n,t);return r!=null&&r.name?`${s}.${r==null?void 0:r.name}`:s},"generateFullName"),he=i((e={},t="modifiedColumn")=>{let n=Lt(e);k={...k,[t]:[...(k==null?void 0:k[t])||[],n]}},"addScriptToExistScripts"),J=i((e={},t="modifiedColumn")=>{let n=Lt(e);return((k==null?void 0:k[t])||[]).some(r=>r===n)},"isScriptExists"),Yr=i((e,t)=>{let n=i(s=>!s.hasOwnProperty("properties")||!Array.isArray(s.properties)?s:{...s,properties:s.properties.reduce((o,a)=>({...o,[a.name]:n(a)}),{})},"propertiesFromArrayToObj"),r=n(e);return Wr(r,s=>{if((s==null?void 0:s.type)!=="reference"||C.lodash.isEmpty(s.refIdPath))return s;let o=Ie([C.lodash.last(s.refIdPath)],t)[C.lodash.last(s.refIdPath)]||{};return{...s,...o}})},"prepareField"),Xr=i(({tableName:e,keyspaceName:t,isOldModel:n,property:r,udtMap:s,dataSources:o})=>{let{oldField:a={},newField:u={}}=(r==null?void 0:r.compMod)||{},c=Yr(a,o),l=Rt(r,s,u.name),m=Rt(c,s,a.name);return{property:r,isOldModel:n,oldName:a.name,newName:u.name,newType:l,oldType:m,isNameChange:a.name!==u.name,isTypeChange:l!==m,dataForScript:{tableName:e,keyspaceName:t,columnData:{name:u.name,type:l}}}},"hydrateColumn"),Oe=i((e,t)=>{var r,s,o;let n=(s=(r=e==null?void 0:e.role)==null?void 0:r.compMod)==null?void 0:s[t];return(n==null?void 0:n.new)||((o=e==null?void 0:e.role)==null?void 0:o[t])},"getTableParameter"),kt=i((e,t)=>Object.entries(e).reduce((n,[r,s])=>{let o=(t.find(a=>a.keyId===r)||{}).type;return{...n,[r]:{...C.lodash.omit(s,"type"),...o?{type:o}:{}}}},{}),"addToKeysHashType"),Pt=i((e,t)=>C.lodash.omitBy(e,(n,r)=>n===!1&&!t[r]),"deleteFalseValuesIfNotPresentInOtherColumn"),Qr=i((e,t)=>{let n=Pt(e,t),r=Pt(t,e);return C.lodash.isEqual(n,r)},"areTableKeyColumnsEqual"),Dt=i(({newKeys:e=[],oldKeys:t=[],dataSources:n})=>{if(e.length!==t.length)return!1;let r=kt(Ie(e.map(a=>a.keyId),n),e),s=kt(Ie(t.map(a=>a.keyId),n),t),o=C.lodash.differenceWith(C.lodash.values(r),C.lodash.values(s),Qr);return C.lodash.isEmpty(o)},"tableKeysIsEqual"),Zr=i(({item:e,dataSources:t})=>{var c;let n=((c=e==null?void 0:e.role)==null?void 0:c.compMod)||{},r=["name","isActivated"],{compositeClusteringKey:s={},compositePartitionKey:o={}}=n||{},a=Dt({newKeys:s.new,oldKeys:s.old,dataSources:t}),u=Dt({newKeys:o.new,oldKeys:o.old,dataSources:t});return!a||!u||r.some(l=>{var m,y;return!C.lodash.isEqual((m=n[l])==null?void 0:m.new,(y=n[l])==null?void 0:y.old)})},"isTableChange"),Jr=i(e=>{if(J(e,"deleteTable"))return[];let t=Ft(e.keyspaceName,e.tableName);return he(e,"deleteTable"),[Z.getInstance([C.provider.dropTable(t)],!0,"deletion","table")]},"getDeleteTableDto"),es=i(e=>{if(J(e,"addTable"))return[];let t=e.item,n=e.data,r=Oe(t,"compositePartitionKey")||[],s=Oe(t,"compositeClusteringKey")||[],o=[{compositePartitionKey:r,compositeClusteringKey:s,collectionName:e.tableName,tableOptions:t.role.tableOptions||"",comments:t.role.comments||"",isActivated:t.role.isActivated}],a=zr({tableData:t,tableMetaData:o,keyspaceMetaData:[{name:e.keyspaceName}],dataSources:e.dataSources,udtTypeMap:n.udtTypeMap||{},isKeyspaceActivated:e.isKeyspaceActivated});return he(e,"addTable"),[Z.getInstance([a],!0,"add","table")]},"getAddTable");wt.exports={getDelete:Gr,getAdd:Hr,hydrateColumn:Xr,isTableChange:Zr,getTableParameter:Oe,addScriptToExistScripts:he,getDeleteTableDto:Jr,getAddTable:es}});var _t=I(($o,Ut)=>{"use strict";var{dependencies:A}=$(),{getColumnDefinition:ts}=pe(),{eachField:ns}=v(),{getTypeByData:Ce}=G(),{checkIsOldModel:rs,fieldTypeCompatible:ss}=ye(),{getDelete:os}=Kt(),{AlterScriptDto:_}=Q(),is={Default_Keyspace:[]},as={added:!1,deleted:!1,modified:!1,udt:"udt"},cs=i(e=>`ALTER TYPE "${e}"`,"getAlterTypePrefix"),us=i(e=>[_.getInstance([A.provider.dropType({keyspaceName:e.keyspaceName,typeName:e.typeName})],!0,"deletion","udt")],"getDropUDT"),ds=i(e=>{let{keySpaces:t,udtName:n,name:r,type:s}=e;return Object.keys(t).map(o=>_.getInstance([A.provider.addPropertyToUdt({keySpaceName:o,udtName:n,name:r,type:s})],!0,"add","udt"))},"getAddToUDT"),Ae=i(e=>{var n;let t=(n=e.compMod)==null?void 0:n.bucketsWithCurrentDefinition;return A.lodash.isEmpty(t)?is:t},"getKeySpaces"),ls=i((e,t)=>{let{role:n={},compMod:r={},properties:s={}}=e,o=Ae(n);if(r.created){let a=ts(s,t);return Object.keys(o).map(u=>{let c=n.code||n.name||"";return _.getInstance([A.provider.createUdt({keySpaceName:u,udtName:c,columnScript:a})],!0,"add","udt")})}return Object.entries(s).reduce((a,[u,c])=>[...a,...ds({type:Ce(c,t),name:u,keySpaces:o,udtName:n.code||n.name||""})],[])},"getAddScript"),jt=i((e,t)=>e.type!=="reference"||e.$ref||!t.$ref?e:{...e,$ref:t.$ref},"prepareField"),ms=i((e,t,n)=>{let{role:r={},properties:s}=e;if(!s)return[];let o=Ae(r),a=r.code||r.name;return Object.entries(s).reduce((u,[c,l])=>{let m=A.lodash.get(l,"compMod.oldField.name"),y=A.lodash.get(l,"compMod.newField.name"),{compMod:f={}}=l,d=Ce(jt(f.oldField,l),n,"newField"),p=Ce(jt(f.newField,l),n,"oldField"),E=rs(A.lodash.get(t,"modelData")),S=Object.keys(o).reduce((g,h)=>{if(p&&d&&p!==d&&ss(d,p)&&E){let x=A.provider.updateUdtType({keySpaceName:h,udtName:a,columnData:{name:c,type:p}});g=[...g,_.getInstance([x],!0,"modify","udt")]}if(y&&m&&m!==y){let x=A.provider.renameType({keySpaceName:h,oldFieldName:m,newFieldName:y,udtName:a});g=[...g,_.getInstance([x],!0,"modify","udt")]}return g},[]);return[...u,...S]},[])},"getUpdateScript"),ps=i(e=>{let{properties:t,compMod:n={},role:r={}}=e;if(!(n!=null&&n.deleted)||!t)return[as];let s=Ae(r),o=r.code||r.name||"";return Object.entries(s).reduce((a,[u,c])=>{let l=c.reduce((m,y)=>{let f=os({tableName:y.collectionName||y.code,keyspaceName:u,columnData:{name:o}}),d=us({keyspaceName:u,typeName:o});return[...m,...f,...d]},[]);return[...a,...l]},[])},"getDeleteScript"),ys=i(({child:e,mode:t,data:n,udtMap:r})=>t==="add"?ls(e,r):t==="update"?ms(e,n,r):ps(e),"getUdtScript"),fs=i(e=>{var u;let t=(u=e.properties.added)==null?void 0:u.items;if(!t||!Array.isArray(t))return e;let n=t.filter(c=>{var m;return(m=c.properties[Object.keys(c.properties)[0]].compMod)==null?void 0:m.created}),r=A.lodash.xorWith(t,n,A.lodash.isEqual);n=n.map(c=>[Object.keys(c.properties)[0],c]);let s=n.map(([c,l])=>c),o=[];n.forEach(([c,l])=>{let m=new Set,y=l.properties[c];ns(y||{},d=>{if(d.$ref){let p=d.$ref.split("/").pop();m.add(p)}});let f=Array.from(m).filter(d=>s.includes(d)&&!o.includes(d));if(o.push(...f),!f.length){let d=o.indexOf(c);d===-1?o.unshift(c):o.unshift(...o.splice(d,1))}});let a=s.filter(c=>!o.includes(c));return n=Object.fromEntries(n),n=[...o,...a].map(c=>n[c]).filter(Boolean),e.properties.added.items=[...n,...r],e},"sortAddedUdt");Ut.exports={getUdtScript:ys,sortAddedUdt:fs,getAlterTypePrefix:cs}});var Vt=I((vo,Mt)=>{"use strict";var{dependencies:D}=$(),gs="caching",Ns="compaction",Ss="compression",Ts="id",Es=[Ts],q={localReadRepairChance:0,caching:{keys:"ALL",rows_per_partition:"NONE"},compaction:"{'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}",compression:"{'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}",readRepairChance:0,gcGraceSeconds:864e3,bloomFilterFalsePositiveChance:.01,defaultTtl:0,speculativeRetry:"99PERCENTILE",minIndexInterval:128,maxIndexInterval:2048,crcCheckChance:1,memtableFlushPeriod:0},qt=i((e,t,n)=>{switch(n){case Ss:case Ns:return Is(e,t);case gs:return Os(e,t);default:return e!==t}},"isDiff"),Is=i((e,t)=>{if(e===""||t==="")return e!==t;let n=JSON.parse(e.replace(/[\'']/g,'"')),r=JSON.parse(t.replace(/[\'']/g,'"'));return!D.lodash.isEqual(n,r)},"isDiffParsedJsonString"),Os=i((e,t)=>{let n=i(o=>{let a=D.lodash.get(o,"rowsPerPartition");return a?{...D.lodash.omit(o,"rowsPerPartition"),rows_per_partition:a}:o},"updateKeys"),r=Object.assign({},n(e),{id:null}),s=Object.assign({},n(t),{id:null});return!D.lodash.isEqual(r,s)},"isDiffCaching"),hs=i((e,t)=>(t=D.lodash.isEmpty(t)?q:t,Object.entries(e).reduce((n,[r,s])=>Es.includes(r)?n:!t.hasOwnProperty(r)||qt(t[r],s,r)?Object.assign({},n,{[r]:s}):n,{})),"getModifiedAndNewOptions"),Cs=i((e,t)=>(e=D.lodash.isEmpty(e)?q:e,Object.keys(t).filter(n=>!e.hasOwnProperty(n))),"getDeletedOptions"),As=i((e,t)=>e.reduce((n,r)=>q.hasOwnProperty(r)&&qt(D.lodash.get(t,r),q[r],r)?Object.assign({},n,{[r]:q[r]}):n,{}),"getDefaultOptionsByName");Mt.exports={getDiff(e,t){let n=hs(e,t),r=Cs(e,t);return Object.assign({},n,As(r,t))}}});var Re=I((Ro,Xt)=>{"use strict";var{dependencies:O}=$(),{commentDeactivatedStatement:ve}=K(),{retrieveContainerName:$s,retrieveEntityName:bs,retrivePropertyFromConfig:M,retrieveIsItemActivated:Bt}=v(),{getOptions:vs,getPrimaryKeyList:xs}=X(),Wt=i(e=>e.name,"columnsToName"),Rs=i((e=[],t)=>{let[n,r]=O.lodash.partition(e,o=>O.lodash.get(o,"isActivated",!0));r=r.map(Wt).join(", "),n=n.map(Wt).join(", ");let s=i(o=>ve(o,!1,t,"INLINE"),"getDeactivatedStatement");if(r.length){if(!n.length)return s(r)}else return n;return n+" "+s(", "+r)},"joinColumns"),ks=i((e,t,n={})=>{let r=e[t];return Object.values(n).find(s=>s.GUID===(r==null?void 0:r.definitionId))||{}},"getColumn"),Ps=i((e,t)=>O.lodash.uniqBy(Object.keys(t).map(n=>{let r=O.lodash.get(t,[n,"GUID"]),s=Object.keys(e).find(c=>e[c].definitionId===r),o=e[s],a=`"${O.lodash.get(o,"name",n)}"`,u=O.lodash.get(t[n],"isActivated");return{name:a,isActivated:u}}),"name").filter(O.lodash.identity),"getColumnNames"),Ds=i((e,t)=>Object.keys(t).reduce((n,r)=>{let s=O.lodash.get(t,[r,"GUID"]),o=Object.keys(e).find(u=>e[u].definitionId===s),a=e[o];return{...n,[O.lodash.get(a,"name",r)]:t[r]}},{}),"getViewColumns"),zt=i((e=[],t)=>{let[n,r]=O.lodash.partition(e,c=>O.lodash.get(c,"isActivated",!0));if(O.lodash.isEmpty(e)||r.length===e.length)return"";let s=i(c=>`AND ${c} IS NOT NULL`,"generateNewStatement"),o=r.map(c=>s(c.name)).join(" "),a=ve(o,!1,t,"INLINE");return`WHERE ${[...n].reduce((c,l)=>c?`${c} ${s(l.name)}`:`${l.name} IS NOT NULL`,"")}${o?" "+a:""}`},"getWhereStatement"),xe=i((e,t,n={})=>t.reduce((r,s)=>{let o=O.lodash.get(e,[s,"name"]),u=ks(e,s,n).isActivated;return o?Object.assign({},r,{[s]:{name:o,isActivated:u}}):r},{}),"getNamesByIds"),Ht=i((e,t,n)=>{let r=M(t,0,"compositeClusteringKey",[]),s=xe(e,r.map(o=>o.keyId),n);return{clusteringKeys:r,clusteringKeysHash:s}},"getClusteringKeyData"),Gt=i((e,t,n)=>[...$e({collectionRefsDefinitionsMap:e,viewData:t,key:"compositePartitionKey",columns:n}),...$e({collectionRefsDefinitionsMap:e,viewData:t,key:"compositeClusteringKey",columns:n})],"getPrimaryKeys"),$e=i(({collectionRefsDefinitionsMap:e,viewData:t,key:n,columns:r})=>{let s=M(t,0,n,[]),o=xe(e,s.map(a=>a.keyId),r);return O.lodash.values(o).filter(O.lodash.identity).map(a=>({...a,name:`"${a.name}"`}))},"getCompositeKeys"),Yt=i(({collectionRefsDefinitionsMap:e,viewData:t,isParentActivated:n,columns:r})=>{let s=M(t,0,"compositePartitionKey",[]),o=xe(e,s.map(c=>c.keyId),r),a=Ht(e,t,r),u=xs(o,a.clusteringKeysHash,n);return u?`PRIMARY KEY (${u})`:""},"getPrimaryKeyScript"),Fs=i(e=>O.lodash.trim(e||"").replace(/ /g," "),"addTab"),be=i(({collectionRefsDefinitionsMap:e,viewData:t,columns:n,isParentActivated:r})=>{let s=Ht(e,t,n),o=M(t,0,"comments",""),a=M(t,0,"tableOptions","");return Fs(vs(s.clusteringKeys,s.clusteringKeysHash,"",a,o,r))},"getOptionsScript"),Ls=i(({viewData:e,entitySchema:t,entityData:n,entityName:r,isParentActivated:s,collectionRefsDefinitionsMap:o,columns:a})=>{let u=[],c=(t==null?void 0:t.properties)||{},l=Object.keys(c).reduce((f,d)=>{let p=t.properties[d];return{...f,[p.GUID]:p}},{}),m=Yt({entityFieldsMap:l,entityData:n,isParentActivated:s,columns:a}),y=be({collectionRefsDefinitionsMap:{},viewData:e,columns:a,isParentActivated:s});return u.push(`AS SELECT * FROM ${r}`),u.push(zt(Gt(o,n,a),s)),m&&u.push(m),y&&u.push(y),u},"getEmptyViewScript");Xt.exports={getOptionsScript:be,getViewScript({schema:e,entitySchema:t,viewData:n,entityData:r,containerData:s,collectionRefsDefinitionsMap:o,isKeyspaceActivated:a=!0,ifNotExist:u=!1}){let c=[],l=Ds(o,e.properties||{}),m=O.lodash.first(n)||{},y=bs(r),f=$s(s),d=f?`"${f}"."${y}"`:`"${y}"`,p=m.code||m.name,E=f?`"${f}"."${p}"`:`"${p}"`,S=Bt(r)&&Bt(n),g=a&&S,h=Yt({collectionRefsDefinitionsMap:o,viewData:n,isParentActivated:g,columns:l}),F=be({collectionRefsDefinitionsMap:o,viewData:n,columns:l,isParentActivated:g});if(c.push(`CREATE MATERIALIZED VIEW ${u?"IF NOT EXISTS ":""}${E}`),O.lodash.isEmpty(l))c=c.concat(Ls({viewData:n,entitySchema:t,entityData:r,entityName:d,isParentActivated:g,collectionRefsDefinitionsMap:o,columns:l}));else{let x=Ps(o,l),z=Rs(x,g);c.push(`AS SELECT ${z}`),c.push(`FROM ${d}`),c.push(zt(O.lodash.uniq([...Gt(o,n,l),...$e({collectionRefsDefinitionsMap:o,viewData:n,key:"whereClause",columns:l})]),g)),h&&c.push(h),F&&c.push(F)}return ve(c.join(` + `)+";",S,a)}}});var en=I((Po,Jt)=>{"use strict";var{getViewScript:ws}=Re(),{dependencies:B}=$(),{AlterScriptDto:V}=Q(),Ks=i((e,t)=>`${e?`"${e}".`:""}"${t}"`,"getViewName"),js=["code","name"],Us=i(e=>{let t=js.some(o=>{let{new:a,old:u}=e[o]||{};return!B.lodash.isEqual(a,u)}),{tableOptions:n={},comments:r={}}=e;if(r.old&&!r.new)return!1;let s=Object.entries(n.old||{}).some(([o])=>{var a;return!((a=n.new)!=null&&a[o])});return!t&&!s},"getIsOnlyOptionsModify"),Qt=i((e,t)=>{if(!t||!B.lodash.isEqual(e,t))return e;if(!e)return t},"getProperty"),_s=i((e={},t={})=>{let n=Qt(t.new,t.old),{new:r={},old:s={}}=e,o=Object.entries(r).map(([a,u])=>[a,Qt(u,s[a])]).filter(([a,u])=>u);return{comments:n,tableOptions:Object.fromEntries(o)}},"getDifferentOptions"),Zt=i(e=>{var o,a;let{compMod:t,properties:n={}}=e.role,r=Object.entries(n).map(([u,c])=>[c.code||c.name||c.displayName||u,c]),s={containerData:[{name:t.keyspaceName}],schema:{properties:Object.fromEntries(r)},viewData:[e.role],ifNotExist:!0,collectionRefsDefinitionsMap:((o=t.collectionData)==null?void 0:o.collectionRefsDefinitionsMap)||{},entityData:((a=t.collectionData)==null?void 0:a.entityData)||[{}]};return ws(s)},"getAddView"),qs=i(e=>{var a,u,c;let t=((a=e.role)==null?void 0:a.compMod)||{};if(!Us(t)){let l=((u=t.code)==null?void 0:u.old)||((c=t.name)==null?void 0:c.old),m=B.provider.dropView({...e,role:{...e.role,code:l}}),y=Zt(e);return[V.getInstance([m],!0,"deletion","view"),V.getInstance([y],!0,"add","view")]}let{comments:r,tableOptions:s}=_s(t.tableOptions,t.comments),o={...e.role,comments:r,tableOptions:s};return[V.getInstance([B.provider.alterView(o)],!0,"modify","view")]},"getModifyView"),Ms=i(({child:e,mode:t})=>t==="add"?[V.getInstance([Zt(e)],!0,"add","view")]:t==="delete"?[V.getInstance([B.provider.dropView(e)],!0,"deletion","view")]:qs(e),"getViewScript");Jt.exports={getViewScript:Ms,getViewName:Ks}});var Xe=I((Fo,rn)=>{var N=Fe(),{tab:b,getTableNameStatement:ee,getUserDefinedFunctions:Vs,getUserDefinedAggregations:Bs}=v(),{serializeOptions:Ws}=tt(),{getAlterTypePrefix:ke}=_t(),{getDiff:zs}=Vt(),{mergeValuesWithConfigOptions:Hs}=X(),{parseToString:tn}=ge(),{getViewName:nn}=en(),{getOptionsScript:Gs}=Re(),{wrapInQuotes:T}=ye(),W=i((e,t)=>t?`ALTER TABLE ${T(t)}.${T(e)}`:`ALTER TABLE ${T(e)}`,"alterTablePrefix");rn.exports=e=>{let{assignTemplates:t}=e.require("@hackolade/ddl-fe-utils");return{dropTable(n){return t(N.dropTable,{name:n})},createTable(n){if(!n.databaseName)return"";let{ifNotExist:r,databaseName:s,items:o,options:a}=n,u=r?"IF NOT EXISTS ":"";return t(N.createTable,{ifNotExistStatement:u,name:s,items:` ( +`+o.map(c=>b(c)).join(`, +`)+` +)`,options:`${a}`})},dropDatabase(n){return n?t(N.dropDatabase,{name:n}):""},createCustomIndex(n){if(!n.tableName)return"";let{name:r,tableName:s,column:o,using:a,options:u,ifNotExist:c}=n,l=c?"IF NOT EXISTS ":"",m=a||"StorageAttachedIndex",y=Object.keys(u).length?` +`+b(`WITH OPTIONS = { +${b(Ws(u).join(`, +`))} +}`):"";return t(N.createCustomIndex,{ifNotExistStatement:l,name:`"${r}"`,tableName:s,column:o,usingStatement:m,optionsStatement:y})},createIndex(n){let{name:r,tableName:s,column:o,ifNotExist:a}=n,u=r?`"${r}"`:"",c=a?"IF NOT EXISTS ":"";return t(N.createIndex,{ifNotExistStatement:c,nameStatement:u,tableName:s,column:o})},createSearchIndex(n){let{ifNotExist:r,tableName:s,columnsStatement:o,profiles:a,config:u,options:c}=n,l=r?"IF NOT EXISTS ":"";return t(N.createSearchIndex,{ifNotExistStatement:l,tableName:s,columnsStatement:o,profiles:a,config:u,options:c})},dropType(n){let{keyspaceName:r,typeName:s}=n;return t(N.dropType,{keyspaceName:T(r),typeName:T(s)})},renameColumn(n){let{tableName:r,keyspaceName:s,columnData:o}=n,a=W(r,s);return t(N.renameColumn,{alterTablePrefixStatement:a,oldName:T(o.oldName),newName:T(o.newName)})},addEntity(n){let{tableName:r,keyspaceName:s,columnData:o}=n,a=W(r,s);return t(N.addEntity,{alterTablePrefixStatement:a,name:T(o.name),type:o.type})},deleteEntity(n){let{tableName:r,keyspaceName:s,columnData:o}=n,a=W(r,s);return t(N.deleteEntity,{alterTablePrefixStatement:a,name:T(o.name)})},addPropertyToUdt(n){let{keySpaceName:r,udtName:s,type:o}=n,a=ke(r);return t(N.addPropertyToUdt,{alterTypePrefixStatement:a,udtName:T(s),name:T(s),type:o})},createUdt(n){let{keySpaceName:r,udtName:s,columnScript:o}=n;return t(N.createUdt,{keySpaceName:T(r),udtName:T(s),columnScript:b(o)})},updateUdtType(n){let{keySpaceName:r,udtName:s,columnData:o}=n,a=ke(r);return t(N.updateUdtType,{alterTypePrefixStatement:a,udtName:T(s),name:T(o.name),type:o.type})},renameType(n){let{keySpaceName:r,udtName:s,oldFieldName:o,newFieldName:a}=n,u=ke(r);return t(N.renameType,{alterTypePrefixStatement:u,udtName:T(s),oldFieldName:T(o),newFieldName:T(a)})},updateType(n){let{tableName:r,keyspaceName:s,columnData:o}=n,a=W(r,s);return t(N.updateType,{alterTablePrefixStatement:a,name:T(o.name),type:o.type})},updateTableOptions(n,r,s){if(!s||!n)return"";let{keyspaceName:o,tableOptions:a={},comments:u}=n,c=i(d=>(d==null?void 0:d.new)&&d.new!==d.old,"isCommentNew"),l=W(r,o),m=zs(a.new||{},a.old||{}),y=Hs(m),f=c(u)?tn(y,u.new):tn(y);return f?t(N.updateTableOptions,{alterTablePrefixStatement:l,optionsStatement:b(f)}):""},dropSearchIndexConfig(n,r,s){let o=ee(n,r);return t(N.dropSearchIndexConfig,{tableNameStatement:o,indexName:s})},modifySearchIndex(n,r,s,o){let a=ee(n,r);return t(N.modifySearchIndex,{tableNameStatement:a,key:s,value:o})},dropSearchIndex(n,r){let s=ee(n,r);return t(N.dropSearchIndex,{tableNameStatement:s})},dropIndex(n,r){let s=ee(n,r);return t(N.dropIndex,{tableNameStatement:s})},dropKeySpace(n){return t(N.dropKeySpace,{keySpaceName:T(n)})},createKeySpace(n,r,s,o,a){let u=Vs(o),c=Bs(a);return t(N.createKeySpace,{keySpaceName:T(n),replication:b(r),durableWrites:b(s),udfScript:u,udaScript:c})},alterKeySpaceReplication(n,r,s){return t(N.alterKeySpaceReplication,{keySpaceName:T(n),replication:b(r),durableWrites:b(s,2)})},dropView(n){let{compMod:r,name:s,code:o}=n.role,a=nn(r.keyspaceName,o||s);return t(N.dropView,{viewName:a})},alterView(n){var u;let r=[n],s=Gs({collectionRefsDefinitionsMap:((u=n.compMod.collectionData)==null?void 0:u.collectionRefsDefinitionsMap)||{},viewData:r}),o=n.name||n.code,a=n.compMod.keyspaceName;if(s){let c=nn(a,o);return t(N.alterView,{keySpaceViewName:c,optionScript:b(s)})}return""}}}});module.exports=Xe(); diff --git a/forward_engineering/ddlProvider/ddlTemplates.js b/forward_engineering/ddlProvider/ddlTemplates.js deleted file mode 100644 index 0883e8a0..00000000 --- a/forward_engineering/ddlProvider/ddlTemplates.js +++ /dev/null @@ -1,54 +0,0 @@ -module.exports = { - - dropTable: 'DROP TABLE IF EXISTS ${name};', - - createTable: - 'CREATE TABLE ${ifNotExistStatement}${name}${items}${options};', - - dropDatabase: 'DROP DATABASE IF EXISTS ${name};', - - createCustomIndex: 'CREATE CUSTOM INDEX ${ifNotExistStatement}${name}\n ON ${tableName} (${column})\n USING \'${usingStatement}\'${optionsStatement};', - - createIndex: 'CREATE INDEX ${ifNotExistStatement}${nameStatement}\n ON ${tableName} (${column});', - - createSearchIndex: 'CREATE SEARCH INDEX ${ifNotExistStatement}ON ${tableName}\n WITH COLUMNS\n${columnsStatement}${profiles}${config}${options};', - - dropType: 'DROP TYPE IF EXISTS ${keyspaceName}.${typeName};', - - renameColumn: '${alterTablePrefixStatement} RENAME ${oldName} TO ${newName};', - - addEntity: '${alterTablePrefixStatement} ADD ${name} ${type};', - - deleteEntity: '${alterTablePrefixStatement} DROP ${name};', - - addPropertyToUdt: '${alterTypePrefixStatement}.${udtName} ADD ${name} ${type};', - - createUdt: 'CREATE TYPE IF NOT EXISTS ${keySpaceName}.${udtName} (\n${columnScript} \n);', - - updateUdtType: '${alterTypePrefixStatement}.${udtName}\nALTER ${name} TYPE ${type};', - - renameType: '${alterTypePrefixStatement}.${udtName} \n RENAME ${oldFieldName} TO ${newFieldName};', - - updateType: '${alterTablePrefixStatement} \n ALTER ${name} TYPE ${type};', - - updateTableOptions: '${alterTablePrefixStatement}${optionsStatement};', - - dropSearchIndexConfig: 'ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n DROP ${indexName};', - - modifySearchIndex: 'ALTER SEARCH INDEX CONFIG\n ON ${tableNameStatement}\n SET ${key} = ${value};', - - dropSearchIndex: 'DROP SEARCH INDEX ON ${tableNameStatement};', - - dropIndex: 'DROP INDEX IF EXISTS ${tableNameStatement};', - - dropKeySpace: 'DROP KEYSPACE IF EXISTS ${keySpaceName};', - - createKeySpace: 'CREATE KEYSPACE IF NOT EXISTS ${keySpaceName} \n${replication}\n${durableWrites}${udfScript}${udaScript};', - - alterKeySpaceReplication: 'ALTER KEYSPACE ${keySpaceName} \n${replication}\n${durableWrites};', - - dropView: 'DROP MATERIALIZED VIEW IF EXISTS ${viewName};', - - alterView: 'ALTER MATERIALIZED VIEW ${keySpaceViewName}\n${optionScript};', - -}; \ No newline at end of file diff --git a/forward_engineering/helpers/alterScriptBuilder.js b/forward_engineering/helpers/alterScriptBuilder.js deleted file mode 100644 index c12fc39e..00000000 --- a/forward_engineering/helpers/alterScriptBuilder.js +++ /dev/null @@ -1,114 +0,0 @@ -const {dependencies} = require("./appDependencies"); -const {getAlterScriptDtos} = require("./alterScriptFromDeltaHelper"); -const {commentDeactivatedStatement, getApplyDropStatement} = require("./generalHelper"); - -/** - * - * @param scriptDtos {Array} - * @param data - * @returns {[(AlterScriptDto|undefined)]} - */ -const getCommentedDropScript = (scriptDtos, data) => { - const applyDropStatements = getApplyDropStatement(data); - if (applyDropStatements) { - return scriptDtos; - } - return scriptDtos.map((dto = {}) => { - if (!dto?.scripts?.[0]?.isDropScript || !dto?.scripts?.[0]?.script) { - return dto; - } - return { - ...dto, - scripts: dto.scripts.map(scriptObject => { - return { - ...scriptObject, - script: commentDeactivatedStatement(scriptObject.script, false) - } - - }) - }; - }) -}; - -/** - * - * @param scriptDtos {[(AlterScriptDto|undefined)]} - * @returns {(string | undefined)[]} - */ -const sortScript = (scriptDtos) => { - const scriptData = scriptDtos.flatMap(dto => dto.scripts); - const filterProp = (key, prop, script = {}) => script[key] && script.modelLevel === prop; - const filter = (scriptType, scriptData, modelLevel) => { - return scriptData.reduce((scripts, currentScript) => { - if (filterProp(scriptType, modelLevel, currentScript)) { - scripts.scripts.push(currentScript); - return scripts; - } - scripts.filteredScripts.push(currentScript); - - return scripts; - }, { scripts: [], filteredScripts: [] }); - }; - - const orderForScripts = [ - ['keySpaces', 'isAddScript'], - ['keySpaces', 'isModifyScript'], - ['view', 'isDropScript'], - ['index', 'isDropScript'], - ['renewal', 'isDropScript'], - ['table', 'isDropScript'], - ['udt', 'isDropScript'], - ['udt', 'isAddScript'], - ['udt', 'isModifyScript'], - ['table', 'isAddScript'], - ['table', 'isModifyScript'], - ['field', 'isDropScript'], - ['field', 'isAddScript'], - ['field', 'isModifyScript'], - ['index', 'isAddScript'], - ['index', 'isModifyScript'], - ['renewal', 'isAddScript'], - ['view', 'isAddScript'], - ['view', 'isModifyScript'], - ['udf', 'isDropScript'], - ['udf', 'isAddScript'], - ['keySpaces', 'isDropScript'], - ]; - const sortedScripts = orderForScripts.reduce((script, [modelLevel, scriptType]) => { - const { scripts, filteredScripts } = filter(scriptType, script.filteredScripts, modelLevel); - return { - sorted: [...script.sorted, ...scripts], - filteredScripts - } - }, { - sorted: [], - filteredScripts: scriptData - }); - - return [...sortedScripts.sorted, ...sortedScripts.filteredScripts].map(data => data.script); -}; -const buildContainerLevelAlterScript = (jsonSchema, udtMap, data) => { - let alterScriptDtos = getAlterScriptDtos(jsonSchema, udtMap, data); - alterScriptDtos = dependencies.lodash.uniqWith(alterScriptDtos, dependencies.lodash.isEqual); - alterScriptDtos = getCommentedDropScript(alterScriptDtos, data); - const scriptData = sortScript(alterScriptDtos); - - return scriptData.filter(Boolean).join('\n\n'); -} - -/** - * - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {boolean} - */ -const isDropInStatements = (child, udtMap, data) => { - return getAlterScriptDtos(child, udtMap, data) - .some(dto => dto.isActivated && dto.scripts.some(script => script.isDropScript)); -} - -module.exports = { - buildContainerLevelAlterScript, - isDropInStatements -} \ No newline at end of file diff --git a/forward_engineering/helpers/alterScriptFromDeltaHelper.js b/forward_engineering/helpers/alterScriptFromDeltaHelper.js deleted file mode 100644 index ba040924..00000000 --- a/forward_engineering/helpers/alterScriptFromDeltaHelper.js +++ /dev/null @@ -1,529 +0,0 @@ -const { getTypeByData } = require('./typeHelper'); -const { dependencies } = require('./appDependencies'); -const { getKeySpaceScript } = require('./updateHelpers/keySpaceHelper'); -const { checkIsOldModel, fieldTypeCompatible } = require('./updateHelpers/generalHelper'); -const { getViewScript } = require('./updateHelpers/viewHelper'); -const { getIndexTable, getDataColumnIndex } = require('./updateHelpers/indexHelper'); -const { getUdtScript, sortAddedUdt } = require('./updateHelpers/udtHelper'); -const { - getDelete, - hydrateColumn, - isTableChange, - addScriptToExistScripts, - getAdd, - getDeleteTableDto, - getAddTable, -} = require('./updateHelpers/tableHelper'); -const { getUdtMap } = require('./udtHelper'); -const { AlterScriptDto } = require("./types/AlterScriptDto"); - -/** - * - * @param renameData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getRenameColumnDto = renameData => { - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.renameColumn(renameData)], - true, - 'modify', - 'field' - ) - ]; -}; -const objectContainsProp = (object, key) => !!object[key]; - -const getCollectionName = compMod => { - const { collectionName = {}, code = {} } = compMod; - return { - oldName: code.old || collectionName.old, - newName: code.new || collectionName.new, - } -} - -const getUpdateColumnProvider = { - /** - * - * @param paramsObject: {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ - alterDropCreate({ dataForScript, oldName, newName }) { - const getData = columnData => ({ ...dataForScript, columnData: { ...dataForScript.columnData, ...columnData }}); - const deletePropertyScript = getDelete(getData({ name: oldName })); - const addPropertyScript = getAdd(getData({ name: newName })); - return [...deletePropertyScript, ...addPropertyScript]; - }, - - /** - * - * @param hydratedColumn: {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ - alterNameDto(hydratedColumn) { - const { newName, oldName, dataForScript, property, isTypeChange } = hydratedColumn; - if (property.primaryKey && isTypeChange) { - return []; - } - if (!property.primaryKey) { - return this.alterDropCreate(hydratedColumn); - } - - return getRenameColumnDto({ ...dataForScript, columnData: { oldName, newName } }); - }, - - /** - * - * @param hydratedColumn: {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ - alterType(hydratedColumn) { - const { isOldModel, oldType, newType, dataForScript, property } = hydratedColumn; - if (!oldType || !newType || property.primaryKey) { - return []; - } - const isFieldTypeCompatible = fieldTypeCompatible(oldType, newType); - - if (isOldModel) { - if (!isFieldTypeCompatible) { - return this.alterDropCreate(hydratedColumn); - } - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.updateType(dataForScript)], - true, - 'modify', - 'field' - ) - ]; - } - - return this.alterDropCreate(hydratedColumn); - } -}; - -/** - * - * @param updateData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getUpdate = updateData => { - const hydratedColumn = hydrateColumn(updateData); - const { newName, oldName } = hydratedColumn; - if (!oldName || !newName) { - return []; - } - if (hydratedColumn.isNameChange) { - return getUpdateColumnProvider.alterNameDto(hydratedColumn); - } else if (hydratedColumn.isTypeChange) { - return getUpdateColumnProvider.alterType(hydratedColumn); - } - addScriptToExistScripts(hydratedColumn.dataForScript); - - return []; -}; - -const getIsColumnInIndex = (item, columnName, data) => { - const itemData = { properties: item.properties || {}, ...dependencies.lodash.omit(item.role || {}, ['properties']) }; - - const dataSources = [itemData, data.modelDefinitions]; - const secIndexes = dependencies.lodash.get(item, 'role.SecIndxs', []) - .map(index => getDataColumnIndex({ dataSources, idToNameHashTable: {}, column: index, key: 'SecIndxKey' })) - .map(index => index.name) - .filter(Boolean); - const searchIndexes = dependencies.lodash.get(item, 'role.searchIndexColumns', []) - .map(index => getDataColumnIndex({ dataSources, idToNameHashTable: {}, column: index })) - .map(index => index.name) - .filter(Boolean); - return [...searchIndexes, ...secIndexes].includes(columnName); -}; - -const getPropertiesForUpdateTable = (properties = [])=> { - const newProperties = Object.entries(properties).map(([name, value]) => { - if (!value.compMod) { - return [name, value]; - } - const newField = value.compMod?.newField || {}; - const oldField = value.compMod?.oldField || {}; - Object.entries(newField).map(([keyNewField, valueNewField]) => { - if (oldField[keyNewField] !== valueNewField) { - value[keyNewField] = valueNewField; - } - if (keyNewField === 'name' && oldField[keyNewField] !== valueNewField) { - name = valueNewField; - } - }) - return [name, value]; - }) - return Object.fromEntries(newProperties); -} - -/** - * - * @param updateData: {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getUpdateTableDto = updateData => { - const { item, propertiesScript = [] } = updateData; - const { oldName, newName } = getCollectionName(item.role?.compMod); - - const compModeWithName = { ...item.role?.compMod || {}, name: { new: newName, old: oldName } } - - const tableIsChange = isTableChange({ - item: { - ...item, - role: { ...item.role, compMod: compModeWithName }, - }, - data: updateData.data, - dataSources: updateData.dataSources, - }); - const indexTableScript = getIndexTable(item, updateData.data, tableIsChange); - - if (!tableIsChange) { - const tableName = updateData.tableName || oldName || newName; - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.updateTableOptions(item.role?.compMod || {}, tableName, updateData.isOptionScript)], - true, - 'modify', - 'table' - ), - ...indexTableScript, - ...propertiesScript - ]; - } - - if (!oldName || !newName) { - return []; - } - - const data = { - keyspaceName: updateData.keyspaceName, - data: updateData.data, - item: { - ...item, - properties: getPropertiesForUpdateTable(item.role?.properties || item.properties), - role: { - ...(item?.role || {}), - tableOptions: item?.role?.compMod?.['tableOptions'] || {}, - } - }, - isKeyspaceActivated: true, - dataSources: updateData.dataSources, - }; - const deleteScript = getDeleteTableDto({ ...data, tableName: oldName }); - const addScript = getAddTable({ ...data, tableName: newName}); - return [...deleteScript, ...addScript, ...indexTableScript]; -} - -/** - * - * @param child {Object} - * @param udtMap {Object} - * @param generator {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const handleChange = (child, udtMap, generator, data) => { - let alterTableScriptDto = []; - - if (objectContainsProp(child, 'items') && child.items.length) { - const alterScript = child.items.reduce((result, current) => { - return result.concat(handleItem(current, udtMap, generator, data)); - }, []); - alterTableScriptDto = alterTableScriptDto.concat(alterScript); - } else if (objectContainsProp(child, 'items')) { - alterTableScriptDto = alterTableScriptDto.concat(handleItem(child.items, udtMap, generator, data)); - } - - return alterTableScriptDto; -} - -const handleItem = (item, udtMap, generator, data) => { - let alterTableScript = []; - - if (!objectContainsProp(item, 'properties')) { - return alterTableScript; - } - - const isOldModel = checkIsOldModel(dependencies.lodash.get(data, 'modelData')); - const itemProperties = item.properties; - - alterTableScript = Object.keys(itemProperties) - .reduce((alterTableScript, tableKey) => { - const itemCompModData = itemProperties[tableKey].role.compMod; - - if (!itemCompModData) { - return alterTableScript; - } - - const codeName = dependencies.lodash.get(itemProperties, `${tableKey}.role.code`, ''); - const tableName = codeName.length ? codeName : tableKey; - const tableProperties = itemProperties[tableKey].properties || {}; - - const keyspaceName = itemCompModData.keyspaceName; - - if (itemCompModData.deleted) { - const deletedIndexScript = getIndexTable(itemProperties[tableKey], data); - return [ - ...alterTableScript, - ...getDeleteTableDto({ - keyspaceName, - tableName - }), - ...deletedIndexScript, - ]; - } - - const dataSources = [ - data.modelDefinitions, - data.internalDefinitions, - data.externalDefinitions, - { properties: tableProperties }, - { properties: dependencies.lodash.get(itemProperties[tableKey], 'role.properties', [])}, - { properties: dependencies.lodash.get(itemProperties[tableKey], 'role.compMod.newProperties', []) }, - { properties: dependencies.lodash.get(itemProperties[tableKey], 'role.compMod.oldProperties', []) } - ]; - - if (itemCompModData.created) { - const addedIndexScript = getIndexTable(itemProperties[tableKey], data); - return [ - ...alterTableScript, - ...getAddTable({ - item: itemProperties[tableKey], - keyspaceName, - data, - tableName, - dataSources, - }), - ...addedIndexScript, - ]; - } - - if (itemCompModData.modified) { - const updateTableScript = getUpdateTableDto({ keyspaceName, data, item: itemProperties[tableKey], isOptionScript: true, tableName, dataSources }); - - return [...alterTableScript, ...updateTableScript]; - } - - const propertiesScript = handleProperties({ - item: itemProperties[tableKey], - generator, - tableProperties, - udtMap, - itemCompModData, - tableName, - isOldModel, - data, - dataSources, - }); - - const updateTableScript = getUpdateTableDto({ - item: itemProperties[tableKey], - isOptionScript: generator.name === 'getUpdate' || generator.name === 'getAdd', - propertiesScript, - keyspaceName, - tableName, - data, - dataSources, - }) - - return [...alterTableScript, ...updateTableScript]; - }, []); - - return alterTableScript; -} - -const handleProperties = ({ generator, tableProperties, udtMap, itemCompModData, tableName, isOldModel, data, item, dataSources }) => { - return Object.keys(tableProperties) - .reduce((alterTableScript, columnName) => { - const property = tableProperties[columnName] || {}; - if (generator.name !== 'getUpdate' && (property.compositePartitionKey || property.compositeClusteringKey)) { - return alterTableScript; - } - if (generator.name === 'getAdd' && property.hasOwnProperty('compMod')) { - return alterTableScript; - } - let columnType = getTypeByData(property, udtMap, columnName); - - if (property.$ref && !columnType) { - columnType = dependencies.lodash.last(property.$ref.split('/')); - } - - if (!columnType) { - return alterTableScript; - } - - const keyspaceName = itemCompModData?.keyspaceName; - - const isColumnInIndex = getIsColumnInIndex(item, columnName, data); - - if (generator.name === 'getUpdate' && (!property.compMod || isColumnInIndex)) { - return alterTableScript; - } - - return [ - ...alterTableScript, - ...generator({ - keyspaceName, - tableName, - columnData: { - name: columnName, - type: columnType - }, - property, - isOldModel, - udtMap, - dataSources, - }) - ]; - }, []); -} - -const columns = { - views: getViewScript, - containers: getKeySpaceScript, - udt: getUdtScript, -} - -const generateScript = (child, udtMap, data, column, mode) => { - if (!child) { - return []; - } - const getScript = columns[column]; - - if (Array.isArray(child) && child.length) { - return child.reduce((scriptsData, item) => - ([...scriptsData, - ...getScript({ child: item.properties[Object.keys(item.properties)[0]], udtMap, data, mode })]), - []); - } - const properties = child.properties; - const itemKey = Object.keys(properties)[0]; - const item = properties[itemKey]; - - return getScript({ child: item, udtMap, data, mode }); -} -/** - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getEntitiesDto = (child, udtMap, data) => { - const addedEntities = child?.properties?.entities?.properties?.added; - const modifiedEntities = child?.properties?.entities?.properties?.modified; - const deletedEntities = child?.properties?.entities?.properties?.deleted; - - const addedEntitiesDto = handleChange(addedEntities, udtMap, getAdd, data) - const modifiedEntitiesDto = handleChange(modifiedEntities, udtMap, getUpdate, data); - const deletedEntitiesDto = handleChange(deletedEntities, udtMap, getDelete, data); - - return [ - ...modifiedEntitiesDto, - ...addedEntitiesDto, - ...deletedEntitiesDto - ]; -} - -/** - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getContainersDto = (child, udtMap, data) => { - const addedContainers = child?.properties?.containers?.properties?.added; - const modifiedContainers = child?.properties?.containers?.properties?.modified; - const deletedContainers = child?.properties?.containers?.properties?.deleted; - - let addedContainersDto = []; - let modifiedContainersDto = []; - let deletedContainersDto = []; - - if (!data?.scriptOptions?.containers?.skipModified) { - addedContainersDto = generateScript(addedContainers?.items, udtMap, data, 'containers', 'add'); - modifiedContainersDto = generateScript(modifiedContainers?.items, udtMap, data, 'containers', 'update'); - deletedContainersDto = generateScript(deletedContainers?.items, udtMap, data, 'containers', 'delete'); - } - - return [ - ...addedContainersDto, - ...modifiedContainersDto, - ...deletedContainersDto - ]; -} - -/** - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getViewsDto = (child, udtMap, data) => { - const addedViews = child?.properties?.views?.properties?.added; - const modifiedViews = child?.properties?.views?.properties?.modified; - const deletedViews = child?.properties?.views?.properties?.deleted; - - const addedViewsDto = generateScript(addedViews?.items, udtMap, data, 'views', 'add'); - const modifiedViewsDto = generateScript(modifiedViews?.items, udtMap, data, 'views', 'update'); - const deletedViewsDto = generateScript(deletedViews?.items, udtMap, data, 'views', 'delete'); - - return [ - ...modifiedViewsDto, - ...addedViewsDto, - ...deletedViewsDto - ]; -} - -/** - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getModelDefinitionsDto = (child, udtMap, data) => { - const modelDefinitions = child?.properties?.modelDefinitions; - const sortAddedUdtResult = sortAddedUdt(modelDefinitions); - const addedModelDefinitions = sortAddedUdtResult?.properties?.added; - const modifiedModelDefinitions = sortAddedUdtResult?.properties?.modified; - const deletedModelDefinitions = sortAddedUdtResult?.properties?.deleted; - - const addedModelDefinitionsDto = generateScript(addedModelDefinitions.items, udtMap, data, 'udt', 'add'); - const modifiedModelDefinitionsDto = generateScript(modifiedModelDefinitions.items, udtMap, data, 'udt', 'update'); - const deletedModelDefinitionsDto = generateScript(deletedModelDefinitions.items, udtMap, data, 'udt', 'delete'); - - return [ - ...addedModelDefinitionsDto, - ...modifiedModelDefinitionsDto, - ...deletedModelDefinitionsDto - ]; -} - -/** - * @param child {PersistenceSchemaChild} - * @param udtMap {Object} - * @param data {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getAlterScriptDtos = (child, udtMap, data) => { - const generalUdtTypeMap = Object.assign( - {}, - udtMap, - getUdtMap([child]) - ); - - return [ - ...getEntitiesDto(child, generalUdtTypeMap, data), - ...getContainersDto(child, generalUdtTypeMap, data), - ...getViewsDto(child, generalUdtTypeMap, data), - ...getModelDefinitionsDto(child, generalUdtTypeMap, data) - ].filter(Boolean); -} - -module.exports = { - getAlterScriptDtos, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/appDependencies.js b/forward_engineering/helpers/appDependencies.js deleted file mode 100644 index 5fed2ae4..00000000 --- a/forward_engineering/helpers/appDependencies.js +++ /dev/null @@ -1,11 +0,0 @@ -let dependencies = {}; - -const setDependencies = app => { - dependencies.lodash = app.require('lodash'); - dependencies.provider = require('../ddlProvider/ddlProvider')(app); -}; - -module.exports = { - setDependencies, - dependencies -}; \ No newline at end of file diff --git a/forward_engineering/helpers/columnHelper.js b/forward_engineering/helpers/columnHelper.js deleted file mode 100644 index 954a4db5..00000000 --- a/forward_engineering/helpers/columnHelper.js +++ /dev/null @@ -1,39 +0,0 @@ -'use strict' - -const { getTypeByData } = require('./typeHelper'); -const { commentDeactivatedStatement } = require('./generalHelper'); - -module.exports = { - getColumnDefinition(properties, udtTypeMap = {}, isParentActivated = false) { - return Object.keys(properties).map(name => { - const data = properties[name]; - const typeDefinition = getTypeDefinition(data, udtTypeMap, name); - - if (typeDefinition === undefined) { - return ''; - } else { - const columnStatement = getColumn( - data.code || name, - typeDefinition, - isStatic(data) - ); - return commentDeactivatedStatement( - columnStatement, - data.isActivated, - isParentActivated, - false - ); - } - }).filter(column => column).join(',\n'); - } -}; - -const isStatic = (data) => Boolean((data || {}).static); - -const getColumn = (name, typeDefinition, isStatic) => { - return `"${name}" ${typeDefinition}${isStatic ? ' STATIC' : ''}`; -}; - -const getTypeDefinition = (data, udtTypeMap, name) => { - return getTypeByData(data, udtTypeMap, name); -}; diff --git a/forward_engineering/helpers/commentsHelper.js b/forward_engineering/helpers/commentsHelper.js deleted file mode 100644 index 752afebe..00000000 --- a/forward_engineering/helpers/commentsHelper.js +++ /dev/null @@ -1,47 +0,0 @@ -const LINE = 'LINE'; -const INLINE = 'INLINE'; -const MULTILINE = 'MULTILINE'; - -const insertBeforeEachLine = (statement, insertValue = '-- ') => - statement - .split('\n') - .map((line) => line && `${insertValue}${line}`) - .join('\n'); - -const multiLineComment = (statement) => { - return `/*\n${insertBeforeEachLine(statement, ' ')}\n*/`; -}; - -const inlineComment = (statement) => { - return `/* ${statement} */`; -}; - -const commentDeactivatedStatement = ( - statement, - isActivated = true, - isParentActivated = true, - commentType = MULTILINE -) => { - if (isActivated || !isParentActivated || !statement) { - return statement; - } - - switch (commentType) { - case MULTILINE: - return multiLineComment(statement); - case INLINE: - return inlineComment(statement); - case LINE: - return insertBeforeEachLine(statement); - default: - return statement; - } -}; - -module.exports = { - commentDeactivatedStatement, - inlineComment, - LINE, - INLINE, - MULTILINE, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/createHelper.js b/forward_engineering/helpers/createHelper.js deleted file mode 100644 index 82b34283..00000000 --- a/forward_engineering/helpers/createHelper.js +++ /dev/null @@ -1,60 +0,0 @@ -const { retrieveContainerName, retrieveEntityName, retrieveUDA, retrieveUDF, retrieveIndexes, commentDeactivatedStatement, retrieveIsItemActivated } = require('./generalHelper'); -const { getTableStatement } = require('./tableHelper'); -const { getUdtMap, getUdtScripts } = require('./udtHelper'); -const { getIndexes } = require('./indexHelper'); - -const getCreateTableScript = (data, isKeyspaceActivated) => { - const containerName = retrieveContainerName(data.containerData); - const entityName = retrieveEntityName(data.entityData); - const isEntityActivated = retrieveIsItemActivated(data.entityData); - const isEntityChildrenActivated = isKeyspaceActivated && isEntityActivated; - const dataSources = [ - data.externalDefinitions, - data.modelDefinitions, - data.internalDefinitions, - data.jsonSchema - ]; - - let udtTypeMap = getUdtMap(dataSources); - - let UDT = getUdtScripts(containerName, dataSources, udtTypeMap, isEntityChildrenActivated); - - const table = getTableStatement({ - tableData: data.jsonSchema, - tableMetaData: data.entityData, - keyspaceMetaData: data.containerData, - dataSources, - udtTypeMap, - isKeyspaceActivated: isEntityChildrenActivated - }); - const dbVersion = data.modelData?.[0]?.dbVersion; - const indexes = getIndexes(retrieveIndexes(data.entityData, dbVersion), dataSources, entityName, containerName, isEntityActivated, isKeyspaceActivated, dbVersion); - const UDF = getUserDefinedFunctions(retrieveUDF(data.containerData)); - const UDA = getUserDefinedAggregations(retrieveUDA(data.containerData)); - - const cqlScript = getScript([ - UDF, - UDA, - ...UDT, - table, - indexes - ]); - - return commentDeactivatedStatement(cqlScript, isEntityActivated && isKeyspaceActivated); -} - -const getScript = (structure) => { - return structure.filter(item => item).join('\n\n'); -}; - -const getUserDefinedFunctions = (udfItems) => { - return udfItems.map(item => item.functionBody).filter(item => item).join('\n'); -}; - -const getUserDefinedAggregations = (udaItems) => { - return udaItems.map(item => item.storedProcFunction).filter(item => item).join('\n'); -}; - -module.exports = { - getCreateTableScript -}; diff --git a/forward_engineering/helpers/dbConnectionService/applyToInstance.js b/forward_engineering/helpers/dbConnectionService/applyToInstance.js deleted file mode 100644 index 92c1d3cb..00000000 --- a/forward_engineering/helpers/dbConnectionService/applyToInstance.js +++ /dev/null @@ -1,89 +0,0 @@ -const applyToInstance = (cassandraHelper) => (connectionInfo, logger, app) => { - let script = connectionInfo.script; - if(connectionInfo.clusterType === 'apolloCloud'){ - const usePosition = script.indexOf('USE'); - script = script.substring(usePosition) - } - const cassandra = cassandraHelper(app.require('lodash')); - - return cassandra.connect(app)(connectionInfo) - .then(() => { - logger.log('info', { - message: 'Applying cassandra script has been started' - }, 'Cassandra script'); - - return cassandra.batch(script, (query, result, i, total) => { - logger.progress({ - message: `Completed queries: ${i + 1} / ${total}` - }); - }); - }, error => { - const err = cassandra.prepareError(error); - - logger.log('error', err, "Cassandra script"); - - return Promise.reject(err); - }) - .then(result => { - logger.log('info', { - message: 'Cassandra script has been applied successfully!' - }, 'Cassandra script'); - - cassandra.close(); - - return; - }, (commonError) => { - if (!commonError.query) { - return Promise.reject(commonError); - } - - const { error, query } = commonError; - const err = modifyLineError(error, script, query); - const preparedError = cassandra.prepareError(err); - - logger.progress({ - message: `Query has executed with error: \n ${query} \n ${err.message}` - }); - - logger.log('error', { - query: query, - error: preparedError, - detail: err - }, "Cassandra script: query has been executed with error"); - - return Promise.reject(preparedError); - }) - .catch(err => { - cassandra.close(); - - return Promise.reject(cassandra.prepareError(err)); - }); -}; - -const modifyLineError = (error, wholeScript, query) => { - const lineRegExp = /^line\ (\d+)\:(\-?\d+)/i; - - const i = wholeScript.indexOf(query); - - if (i === -1) { - return error; - } - - const lineOffset = wholeScript.slice(0, i).split('\n').length; - - if (!lineRegExp.test(error.message)) { - return Object.assign({}, error, { - message: `query line ${lineOffset}:0 ${error.message}` - }); - } - - const lineData = error.message.match(lineRegExp); - const line = +(lineData[1]); - const offset = lineData[2]; - - const message = error.message.replace(lineRegExp, `line ${lineOffset + line - 1}:${offset}`); - - return Object.assign({}, error, { message }); -}; - -module.exports = applyToInstance; diff --git a/forward_engineering/helpers/dbConnectionService/index.js b/forward_engineering/helpers/dbConnectionService/index.js deleted file mode 100644 index ba0ff2fb..00000000 --- a/forward_engineering/helpers/dbConnectionService/index.js +++ /dev/null @@ -1,8 +0,0 @@ -const cassandra = require('../../../reverse_engineering/cassandraHelper'); -const applyToInstance = require('./applyToInstance.js')(cassandra); -const testConnection = require('./testConnection.js')(cassandra); - -module.exports = { - applyToInstance, - testConnection -}; diff --git a/forward_engineering/helpers/dbConnectionService/testConnection.js b/forward_engineering/helpers/dbConnectionService/testConnection.js deleted file mode 100644 index e576e804..00000000 --- a/forward_engineering/helpers/dbConnectionService/testConnection.js +++ /dev/null @@ -1,11 +0,0 @@ -module.exports = (cassandraHelper) => (connectionInfo, app) => { - const cassandra = cassandraHelper(app.require('lodash')); - - return cassandra.connect(app)(connectionInfo) - .then(() => { - cassandra.close(); - }, (err) => { - cassandra.close(); - return Promise.reject(cassandra.prepareError(err)); - }); -}; \ No newline at end of file diff --git a/forward_engineering/helpers/enums/reservedWords.js b/forward_engineering/helpers/enums/reservedWords.js deleted file mode 100644 index 10ad1f14..00000000 --- a/forward_engineering/helpers/enums/reservedWords.js +++ /dev/null @@ -1,75 +0,0 @@ -const ReservedWords = Object.freeze({ - ADD: 'ADD', - AGGREGATE: 'AGGREGATE', - ALLOW: 'ALLOW', - ALTER: 'ALTER', - AND: 'AND', - ANY: 'ANY', - APPLY: 'APPLY', - ASC: 'ASC', - AUTHORIZE: 'AUTHORIZE', - BATCH: 'BATCH', - BEGIN: 'BEGIN', - BY: 'BY', - COLUMNFAMILY: 'COLUMNFAMILY', - CREATE: 'CREATE', - DELETE: 'DELETE', - DESC: 'DESC', - DROP: 'DROP', - EACH_QUORUM: 'EACH_QUORUM', - ENTRIES: 'ENTRIES', - FROM: 'FROM', - FULL: 'FULL', - GRANT: 'GRANT', - IF: 'IF', - IN: 'IN', - INDEX: 'INDEX', - INET: 'INET', - INFINITY: 'INFINITY', - INSERT: 'INSERT', - INTO: 'INTO', - KEYSPACE: 'KEYSPACE', - KEYSPACES: 'KEYSPACES', - LIMIT: 'LIMIT', - LOCAL_ONE: 'LOCAL_ONE', - LOCAL_QUORUM: 'LOCAL_QUORUM', - MATERIALIZED: 'MATERIALIZED', - MODIFY: 'MODIFY', - NAN: 'NAN', - NORECURSIVE: 'NORECURSIVE', - NOT: 'NOT', - OF: 'OF', - ON: 'ON', - ONE: 'ONE', - ORDER: 'ORDER', - PARTITION: 'PARTITION', - PASSWORD: 'PASSWORD', - PER: 'PER', - PRIMARY: 'PRIMARY', - QUORUM: 'QUORUM', - RENAME: 'RENAME', - REVOKE: 'REVOKE', - SCHEMA: 'SCHEMA', - SELECT: 'SELECT', - SET: 'SET', - TABLE: 'TABLE', - TIME: 'TIME', - THREE: 'THREE', - TO: 'TO', - TOKEN: 'TOKEN', - TRUNCATE: 'TRUNCATE', - TWO: 'TWO', - UNLOGGED: 'UNLOGGED', - UPDATE: 'UPDATE', - USE: 'USE', - USING: 'USING', - VIEW: 'VIEW', - WHERE: 'WHERE', - WITH: 'WITH' -}); - -const ReservedWordsAsArray = Object.values(ReservedWords); - -module.exports = { - ReservedWordsAsArray -} \ No newline at end of file diff --git a/forward_engineering/helpers/generalHelper.js b/forward_engineering/helpers/generalHelper.js deleted file mode 100644 index e87ee19b..00000000 --- a/forward_engineering/helpers/generalHelper.js +++ /dev/null @@ -1,239 +0,0 @@ -'use strict' -const fs = require('fs'); -const path = require('path'); -const TAB_SIZE = 2; - -const getDataStaxVersion = (dbVersion = '') => { - if (!dbVersion.startsWith('DSE')) { - return ''; - } - - const version = dbVersion.split(' ')[1] || ''; - - return version.split('.')[0] || ''; -}; - -const tab = (text, count = 1) => { - const space = ' '.repeat(count * TAB_SIZE); - - return text.split('\n').map(string => space + string).join('\n'); -}; - -const retrivePropertyFromConfig = (config, tab, propertyName, defaultValue = "") => ((config || [])[tab] || {})[propertyName] || defaultValue; - -const retrieveContainerName = (containerConfig) => retrivePropertyFromConfig( - containerConfig, 0, "code", - retrivePropertyFromConfig(containerConfig, 0, "name", "") - ); -const retrieveEntityName = (entityConfig) => retrivePropertyFromConfig( - entityConfig, 0, "code", - retrivePropertyFromConfig(entityConfig, 0, "collectionName", "") -); -const retrieveUDF = (containerConfig) => retrivePropertyFromConfig(containerConfig, 1, "UDFs", []); -const retrieveUDA = (containerConfig) => retrivePropertyFromConfig(containerConfig, 2, "UDAs", []); -const retrieveIndexes = (entityConfig, dbVersion) => { - const indexTab = entityConfig[1]; - const result = { - indexes: retrivePropertyFromConfig(entityConfig, 1, "SecIndxs", []), - }; - - if (indexTab.searchIndex) { - result.searchIndex = { - indexType: 'search', - columns: indexTab.searchIndexColumns, - config: indexTab.searchIndexConfig, - profiles: getIndexProfiles(indexTab.searchIndexProfiles, dbVersion), - options: indexTab.searchIndexOptions, - ifNotExist: indexTab.searchIndexIfNotExist - }; - } - - return result; -}; - -const filterSpaceSaving = (searchIndexProfiles, profileForFilter) => searchIndexProfiles.filter(profile => !profileForFilter.includes(profile)); - -const getIndexProfiles = (searchIndexProfiles, dbVersion) => { - const dataStaxVersion = getDataStaxVersion(dbVersion); - const spaceSavingNoTextfieldNotExist = dataStaxVersion.length ? Number(dataStaxVersion) >=6 : false; - const profileForFilter = [spaceSavingNoTextfieldNotExist ? "spaceSavingNoTextfield" : '']; - - searchIndexProfiles = !Array.isArray(searchIndexProfiles) ? [searchIndexProfiles].filter(Boolean) : searchIndexProfiles; - - searchIndexProfiles = filterSpaceSaving(searchIndexProfiles, profileForFilter); - - const spaceSavingAll = filterSpaceSaving([ - "spaceSavingNoJoin", - "spaceSavingNoTextfield", - "spaceSavingSlowTriePrecision" - ], profileForFilter); - - const isSpaceSavingAll = spaceSavingAll.every(item => searchIndexProfiles.includes(item)); - - if (isSpaceSavingAll) { - return ['spaceSavingAll']; - } - - return searchIndexProfiles; -}; - -const getTableNameStatement = (keyspaceName, tableName) => getNameWithKeyspace(keyspaceName, `"${tableName}"`); -const getNameWithKeyspace = (keyspaceName, name) => `${(keyspaceName) ? `"${keyspaceName}".` : ""}${name}`; - -const getConfig = (pathToConfig) => { - try { - const config = fs.readFileSync(path.join(__dirname, "..", "..", pathToConfig)); - - return JSON.parse(config.toString().replace(/\/\*[\s\S]*?\*\//g, "")); - } catch (e) { - return {}; - } -}; - -const cacheResult = (method) => { - let result; - - return (...args) => { - if (!result) { - result = method(...args); - } - - return result; - } -}; - -const getFieldLevelConfig = cacheResult(() => getConfig(path.join("properties_pane", "field_level", "fieldLevelConfig.json"))); -const entityLevelConfig = cacheResult(() => getConfig(path.join("properties_pane", "entity_level", "entityLevelConfig.json"))); - -const getTypesConfig = cacheResult(() => { - const getName = typeFile => typeFile.replace(/\.json/, ""); - const typeDir = path.join(__dirname, "..", "..", "types"); - const types = fs.readdirSync(typeDir); - - return types.reduce((typesMap, fileName) => { - typesMap[getName(fileName)] = getConfig(path.join("types", fileName)); - - return typesMap; - }, {}); -}); - -const getTypeConfig = (type) => getTypesConfig()[type]; -const getEntityLevelConfig = () => entityLevelConfig(); - -const getFieldConfig = (type, property) => { - const fieldLevelConfig = getFieldLevelConfig().structure; - - if (!fieldLevelConfig[type]) { - return; - } - const propertyData = fieldLevelConfig[type].find(config => config.propertyKeyword === property); - - return propertyData; -}; - -const eachField = (jsonSchema, callback) => { - const resultSchema = Object.assign({}, jsonSchema); - - const eachProperty = (properties, callback) => { - return Object.keys(properties).reduce((resultSchema, propertyName) => { - const property = properties[propertyName]; - - resultSchema[propertyName] = callback(eachField(property, callback), propertyName); - - return resultSchema; - }, {}); - }; - const eachItem = (items, callback) => { - return items.map((item, i) => { - return callback(eachField(item, callback), i); - }); - }; - - if (resultSchema.hasOwnProperty('properties')) { - resultSchema.properties = eachProperty(resultSchema.properties, callback); - } - - if (resultSchema.hasOwnProperty('items')) { - const items = Array.isArray(resultSchema.items) ? resultSchema.items : [resultSchema.items]; - - resultSchema.items = eachItem(items, callback); - } - - return resultSchema; -}; - -const canTypeHaveSubtype = (type, subtype) => { - const subtypeConfig = getFieldConfig(type, "mode") || {}; - - if (!Array.isArray(subtypeConfig.options)) { - return false; - } - - const hasSubtype = subtypeConfig.options.includes(subtype); - - return hasSubtype; -}; - -const commentDeactivatedStatement = (statement, isActivated = true, isParentActivated = true, useMultiLineComment = true) => { - if (isActivated || !isParentActivated || !statement) { - return statement; - } - const insertBeforeEachLine = (statement, insertValue = '-- ') => - statement - .split('\n') - .map((line) => `${insertValue}${line}`) - .join('\n'); - - const multiLineComment = (statement) => { - return `/*\n${insertBeforeEachLine(statement, ' ')}\n*/`; - } - - return useMultiLineComment ? multiLineComment(statement) : insertBeforeEachLine(statement); -} - -const retrieveIsItemActivated = (itemConfig) => { - const value = itemConfig?.[0]?.["isActivated"]; - - if (value === undefined) { - return true; - } - - return value; -}; - -const getUserDefinedFunctions = (udfItems) => { - return udfItems.map(item => item.functionBody).filter(item => item).join('\n'); -}; - -const getUserDefinedAggregations = (udaItems) => { - return udaItems.map(item => item.storedProcFunction).filter(item => item).join('\n'); -}; - -const getApplyDropStatement = data => { - const { applyDropStatements, additionalOptions = [] } = data.options || {}; - const applyDropStatementsFromUi = (additionalOptions.find(option => option.id === 'applyDropStatements') || {}).value; - return applyDropStatements || applyDropStatementsFromUi; -} - -module.exports = { - tab, - retrieveContainerName, - retrieveEntityName, - retrieveUDF, - retrieveUDA, - retrieveIndexes, - retrivePropertyFromConfig, - getTableNameStatement, - getFieldConfig, - getTypeConfig, - getNameWithKeyspace, - eachField, - canTypeHaveSubtype, - getEntityLevelConfig, - commentDeactivatedStatement, - retrieveIsItemActivated, - getUserDefinedAggregations, - getUserDefinedFunctions, - getIndexProfiles, - getApplyDropStatement -}; diff --git a/forward_engineering/helpers/getScriptOptions.js b/forward_engineering/helpers/getScriptOptions.js deleted file mode 100644 index 27a8e655..00000000 --- a/forward_engineering/helpers/getScriptOptions.js +++ /dev/null @@ -1,12 +0,0 @@ -const getScriptOptions = data => { - return { - containers: { - skipModified: data.options?.additionalOptions?.find(item => item.id === 'excludeContainerAlterStatements') - ?.value, - }, - }; -}; - -module.exports = { - getScriptOptions, -}; diff --git a/forward_engineering/helpers/indexHelper.js b/forward_engineering/helpers/indexHelper.js deleted file mode 100644 index 1209835f..00000000 --- a/forward_engineering/helpers/indexHelper.js +++ /dev/null @@ -1,354 +0,0 @@ -'use strict' - -const { commentDeactivatedStatement, inlineComment } = require('./commentsHelper'); -const { tab, getTableNameStatement } = require('./generalHelper'); -const { getNamesByIds } = require('./schemaHelper'); -const {dependencies} = require("./appDependencies"); - -const getIndexes = (indexData, dataSources, tableName, keyspaceName, isTableActivated, isKeyspaceActivated, dbVersion) => { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - const isParentActivated = isTableActivated && isKeyspaceActivated; - const generalIndexes = getGeneralIndexes(tableNameStatement, dataSources, indexData.indexes); - const searchIndex = dbVersion === 'Astra DB' ? [] : getSearchIndexStatement(tableNameStatement, dataSources, isParentActivated, indexData.searchIndex); - - const indexStatements = [...generalIndexes, ...searchIndex].map(index => { - return commentDeactivatedStatement( - index.statement, - index.isActivated, - isParentActivated - ); - }).join('\n\n'); - - return indexStatements; -}; - -const getGeneralIndexes = (tableNameStatement, dataSources, indexes = []) => { - return unwindIndexes(indexes).map(index => { - let indexStatement; - - const isIndexKeyActivated = index.isActivated && isIndexColumnKeyActivated(index.SecIndxKey, dataSources); - const columnStatement = getIndexColumnStatement(index.SecIndxKey, dataSources); - if (index.indexType === 'custom') { - indexStatement = dependencies.provider.createCustomIndex({ - name: index.name, - tableName: tableNameStatement, - column: columnStatement, - using: index.isSASI ? 'org.apache.cassandra.index.sasi.SASIIndex' : 'StorageAttachedIndex', - options: getCustomOptions(index.customOptions, index.isSASI), - ifNotExist: index.indexIfNotExist - }); - } else { - indexStatement = dependencies.provider.createIndex({ - name: index.name, - tableName: tableNameStatement, - column: columnStatement, - ifNotExist: index.indexIfNotExist - }); - } - - return { - isActivated: isIndexKeyActivated, - statement: indexStatement, - }; - }); -}; - -const getSearchIndexStatement = (tableNameStatement, dataSources, isParentActivated, searchIndex) => { - if (!searchIndex) { - return []; - } - let columns = []; - if(searchIndex.columns){ - columns = uniqueByName(searchIndex.columns.filter(column => Array.isArray(column.key) && column.key.length).map(column => ({ - ...column, - name: getIndexColumnStatement(column.key[0], dataSources), - isActivated: isIndexColumnKeyActivated(column.key[0], dataSources), - }))); - } - - const activatedColumns = columns.filter(column => column.isActivated); - const isActivated = activatedColumns.length > 0; - const statement = getSearchIndex({ - tableName: tableNameStatement, - isActivated: isActivated && isParentActivated, - index: searchIndex, - columns, - ifNotExist: searchIndex.ifNotExist - }); - - return [{ - isActivated, - statement, - }]; -}; - -const uniqueByName = (columns) => { - return columns.reduce((result, column) => { - const exists = result.find(c => c.name === column.name); - - if (exists) { - return result; - } - - return result.concat(column); - }, []); -}; - -const getIndexColumnStatement = (key, dataSources) => { - const { name } = getNamesByIds([key.keyId], dataSources)[key.keyId] || {}; - - return name ? wrapKey(`"${name}"`, key.type) : ''; -}; - -const wrapKey = (column, type) => { - if (type === 'keys') { - return `KEYS(${column})`; - } - - if (type === 'values') { - return `VALUES(${column})`; - } - - if (type === 'entries') { - return `ENTRIES(${column})`; - } - - if (type === 'full') { - return `FULL(${column})`; - } - - return column; -}; - -const isIndexColumnKeyActivated = (key, dataSources) => { - const { isActivated } = getNamesByIds([key.keyId], dataSources)[key.keyId] || {}; - - return isActivated !== false; -}; - -const unwindIndexes = (indexes) => { - return indexes.reduce((result, index) => { - return [...result, ...(index.SecIndxKey || []).map((key, i) => { - return Object.assign({}, index, { - name: i > 0 ? index.name + '_' + i : index.name, - SecIndxKey: key - }); - })]; - }, []); -}; - -const serializeOptions = (options) => { - return Object.keys(options).map(option => `'${option}': '${options[option]}'`); -}; - -const getCustomOptions = (options, isSASI) => { - let result = {}; - - if (!options) { - return result; - } - - if (options.case_sensitive) { - result.case_sensitive = 'true'; - } - - if (options.normalize) { - result.normalize = 'true'; - } - - if (options.ascii && !isSASI) { - result.ascii = 'true'; - } - - if (options.similarity_function && !isSASI) { - result.similarity_function = `${options.similarity_function}`; - } - - if(!isSASI){ - return result; - } - - - if (options.analyzed) { - result.analyzed = 'true'; - } - - if (options.isLiteral) { - result.is_literal = 'true'; - } - - if (options.tokenizationEnableStemming) { - result.tokenization_enable_stemming = 'true'; - } - - if (options.tokenizationNormalizeLowercase) { - result.tokenization_normalize_lowercase = 'true'; - } - - if (options.tokenizationNormalizeUppercase) { - result.tokenization_normalize_uppercase = 'true'; - } - - if (options.normalizeLowercase) { - result.normalize_lowercase = 'true'; - } - - if (options.normalizeUppercase) { - result.normalize_uppercase = 'true'; - } - - if (options.tokenizationLocale) { - result.tokenization_locale = `${options.tokenizationLocale}`; - } - - if (options.tokenizationSkipStopWords) { - result.tokenization_skip_stop_words = `${options.tokenizationSkipStopWords}`; - } - - if (options.mode) { - result.mode = `${options.mode}`; - } - - if (options.analyzerClass) { - result.analyzer_class = `${options.analyzerClass}`; - } - - if (options.maxCompactionFlushMemoryInMb) { - result.max_compaction_flush_memory_in_mb = `${options.maxCompactionFlushMemoryInMb}`; - } - - return result; -}; - -const getSearchIndex = ({ tableName, columns, index, isActivated, ifNotExist }) => { - const columnsStatement = getSearchIndexColumnStatements(getSearchIndexColumns(columns), isActivated); - const profiles = index.profiles.length ? `\n${tab(`AND PROFILES ${index.profiles.join(', ')}`)}` : ''; - const indexConfig = getSearchIndexConfig(index.config); - const config = indexConfig ? `\n${tab(`AND CONFIG ${indexConfig}`)}` : ''; - const indexOptions = getSearchIndexOptions(index.options); - const options = indexOptions ? `\n${tab(`AND OPTIONS ${indexOptions}`)}` : ''; - - return dependencies.provider.createSearchIndex({ifNotExist, tableName, columnsStatement: tab(columnsStatement, 2), profiles, config, options}); -}; - -const getSearchIndexColumns = columns => { - return columns.map(column => { - const options = []; - - if (column.copyField) { - options.push(`copyField: true`); - } - - if (column.docValues) { - options.push(`docValues: true`); - } - - if (column.excluded) { - options.push(`excluded: true`); - } - - if (!column.indexed) { - options.push(`indexed: false`); - } - - if (column.lowerCase) { - options.push(`lowerCase: true`); - } - - return { - statement: `${column.name}${options.length ? ` {${options.join(', ')}}` : ''}`, - isActivated: column.isActivated, - }; - }); -}; - -const getSearchIndexColumnStatements = (columns, isParentActivated) => { - const commentedColumns = !isParentActivated ? [] : columns.filter(column => !column.isActivated); - const othersColumns = !isParentActivated ? columns : columns.filter(column => column.isActivated); - const commented = commentedColumns.length ? commentedColumns.map(({ statement }) => statement).join(',\n').split('\n').map(inlineComment).join('\n') : ''; - const others = othersColumns.map(({ statement }) => statement).join(',\n'); - - if (commented && others) { - return commented + ',\n' + others; - } - - if (commented) { - return commented; - } - - return others; -}; - -const getSearchIndexConfig = (config = {}) => { - const result = []; - - if (config.autoCommitTime && config.autoCommitTime !== 10000) { - result.push(`autoCommitTime: ${config.autoCommitTime}`); - } - - if (config.defaultQueryField) { - result.push(`defaultQueryField: '${config.defaultQueryField}'`); - } - - if (config.directoryFactory) { - result.push(`directoryFactory: '${config.directoryFactory}'`); - } - - if (config.filterCacheLowWaterMark && config.filterCacheLowWaterMark !== 1024) { - result.push(`filterCacheLowWaterMark: ${config.filterCacheLowWaterMark}`); - } - - if (config.filterCacheHighWaterMark && config.filterCacheHighWaterMark !== 2048) { - result.push(`filterCacheHighWaterMark: ${config.filterCacheHighWaterMark}`); - } - - if (config.directoryFactoryClass) { - result.push(`directoryFactoryClass: '${config.directoryFactoryClass}'`); - } - - if (config.mergeMaxThreadCount && config.mergeMaxMergeCount) { - result.push(`mergeMaxThreadCount: ${config.mergeMaxThreadCount}`); - result.push(`mergeMaxMergeCount: ${config.mergeMaxMergeCount}`); - } - - if (config.ramBufferSize && config.ramBufferSize !== 512) { - result.push(`ramBufferSize: ${config.ramBufferSize}`); - } - - if (config.realtime) { - result.push(`realtime: true`); - } - - if (!result.length) { - return ''; - } - - return `{\n${tab(result.join(',\n'))}\n}`; -}; - -const getSearchIndexOptions = (options = {}) => { - const result = []; - - if (options.recovery) { - result.push(`recovery: true`); - } - - if (!options.reindex) { - result.push(`reindex: false`); - } - - if (options.lenient) { - result.push(`lenient: true`); - } - - if (!result.length) { - return ''; - } - - return `{${result.join(', ')}}`; -}; - -module.exports = { - getIndexes, - serializeOptions, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/keyspaceHelper.js b/forward_engineering/helpers/keyspaceHelper.js deleted file mode 100644 index 2ad44c18..00000000 --- a/forward_engineering/helpers/keyspaceHelper.js +++ /dev/null @@ -1,54 +0,0 @@ -const { tab, retrieveContainerName, retrivePropertyFromConfig } = require('./generalHelper'); - -const getCreateStatement = ({name, replication, durableWrites, ifNotExist}) => `CREATE KEYSPACE ${ifNotExist? `IF NOT EXISTS ` : ``}"${name}" \n${tab(replication)}\n${durableWrites}; \n\nUSE "${name}";`; - -const getSimpleStrategy = (factor) => `'class' : 'SimpleStrategy',\n'replication_factor' : ${factor}`; - -const getNetworkTopologyStrategy = (dataCenters) => - ["'class' : 'NetworkTopologyStrategy'"].concat( - dataCenters.reduce((replicaCenters, data) => [ - ...replicaCenters, - `'${data.dataCenterName}' : ${getFactor(data.replFactorValue)}` - ], []) - ).join(',\n') - -const getTopology = (strategy, factor, dataCenters) => { - if (strategy === "NetworkTopologyStrategy") { - return getNetworkTopologyStrategy(dataCenters); - } else { - return getSimpleStrategy(getFactor(factor)); - } -}; - -const getReplication = (strategy, factor, dataCenters) => `WITH REPLICATION = {\n${ tab(getTopology(strategy, factor, dataCenters)) }\n}`; - -const getDurableWrites = (durableWrites) => `AND DURABLE_WRITES = ${Boolean(durableWrites) + ''}`; - -const getFactor = (factor) => +factor || 1; - -const getKeyspaceStatement = (keyspaceData) => { - const keyspaceName = retrieveContainerName(keyspaceData); - const replicationStrategy = retrivePropertyFromConfig(keyspaceData, 0, "replStrategy", ""); - const replicationFactor = retrivePropertyFromConfig(keyspaceData, 0, "replFactor", undefined); - const dataCenters = retrivePropertyFromConfig(keyspaceData, 0, "dataCenters", []); - const durableWrites = retrivePropertyFromConfig(keyspaceData, 0, "durableWrites", false); - - if (keyspaceData[0] && !keyspaceData[0].addToCqlScript) { - return ""; - } else if (keyspaceName === "") { - return ""; - } else { - return getCreateStatement({ - name: keyspaceName, - replication: getReplication(replicationStrategy, replicationFactor, dataCenters), - durableWrites: getDurableWrites(durableWrites), - ifNotExist: retrivePropertyFromConfig(keyspaceData, 0, "keyspaceIfNotExist", undefined) - }); - } -}; - -module.exports = { - getKeyspaceStatement, - getReplication, - getDurableWrites -}; diff --git a/forward_engineering/helpers/schemaHelper.js b/forward_engineering/helpers/schemaHelper.js deleted file mode 100644 index b16d50de..00000000 --- a/forward_engineering/helpers/schemaHelper.js +++ /dev/null @@ -1,87 +0,0 @@ -'use strict' - -const attributesForReturn = ['isActivated', 'type', 'compositePartitionKey']; - -const getAttributes = (field = {}, allAttributes = false) => { - if (allAttributes) { - return field; - } - return attributesForReturn.reduce((fieldAttributes, attribute) => { - if (!field.hasOwnProperty(attribute) || field[attribute] === undefined) { - return fieldAttributes - } - - return { - ...fieldAttributes, - [attribute]: field[attribute], - } - }, {}); -}; - -const getPathById = (schema, id, path) => { - if (schema.GUID === id || schema.id === id) { - return path; - } - - if (schema.properties) { - return Object.keys(schema.properties).reduce((newPath, propertyName) => { - if (newPath) { - return newPath; - } else { - const property = schema.properties[propertyName] - return getPathById(property, id, [...path, property.GUID || property.id]); - } - }, undefined); - } else if (schema.items) { - if (Array.isArray(schema.items)) { - return schema.items.reduce((newPath, item) => { - if (newPath) { - return newPath; - } else { - return getPathById(item, id, [...path, item.GUID || item.id]); - } - }, undefined); - } else { - return getPathById(schema.items, id, [...path, schema.items.GUID]); - } - } -}; - -const getRootItemMetadataById = (id, properties, allAttributes) => { - const propertyName = Object.keys(properties).find(propertyName => (properties[propertyName].GUID === id || properties[propertyName].id === id)); - const propertyValue = properties[propertyName]; - if (propertyValue && (propertyValue.code || propertyValue.name)) { - return { name: propertyValue.code || propertyValue.name, ...getAttributes(properties[propertyName], allAttributes) }; - } - - return { name: propertyName, ...getAttributes(properties[propertyName], allAttributes) }; -}; - -const findFieldMetadataById = (id, source, allAttributes) => { - let path = getPathById(source, id, []); - - if (path) { - return getRootItemMetadataById(path[0], source.properties, allAttributes); - } else { - return { name: "" }; - } -}; - -const getAttributesDataByIds = (ids, sources, allAttributes) => { - return ids.reduce((hash, id) => { - for (let i = 0; i < sources.length; i++) { - const fieldData = findFieldMetadataById(id, sources[i], allAttributes); - - if (fieldData?.name) { - return Object.assign({}, hash, { [id]: fieldData}); - } - } - - return hash; - }, {}); -}; - -module.exports = { - getPathById, - getNamesByIds: getAttributesDataByIds, -}; diff --git a/forward_engineering/helpers/tableHelper.js b/forward_engineering/helpers/tableHelper.js deleted file mode 100644 index 542edf47..00000000 --- a/forward_engineering/helpers/tableHelper.js +++ /dev/null @@ -1,192 +0,0 @@ -'use strict' - -const { - retrieveContainerName, - retrieveEntityName, - retrivePropertyFromConfig, - getTableNameStatement, - commentDeactivatedStatement -} = require('./generalHelper'); -const { getColumnDefinition } = require('./columnHelper'); -const { getNamesByIds } = require('./schemaHelper'); -const { getEntityLevelConfig } = require('./generalHelper'); -const { parseToString, addId, addClustering } = require('./tableOptionService/parseToString'); -const { inlineComment } = require('./commentsHelper'); -const { dependencies } = require('./appDependencies'); - -/** - * - * @param keyspaceName - * @param tableName - * @param columnDefinition - * @param primaryKeys - * @param options - * @param ifNotExist - * @returns {string} - */ -const getCreateTableStatement = (keyspaceName, tableName, columnDefinition, primaryKeys, options, ifNotExist) => { - const items = []; - - if (columnDefinition) { - items.push(columnDefinition); - } - - if (primaryKeys) { - items.push(`PRIMARY KEY (${primaryKeys})`); - } - - - return dependencies.provider.createTable({ - ifNotExist, - databaseName: getTableNameStatement(keyspaceName, tableName), - items, - options - }); -}; - -const getPrimaryKeyList = (partitionKeysHash, clusteringKeysHash, isParentActivated) => { - const partitionKeys = getPartitionKeys(partitionKeysHash, isParentActivated); - const clusteringKeys = getClusteringKeys(clusteringKeysHash, isParentActivated); - const keys = []; - - if (partitionKeys) { - keys.push(partitionKeys); - } - - if (clusteringKeys) { - keys.push(clusteringKeys); - } - - return keys.join(clusteringKeys.startsWith('/*') || partitionKeys.endsWith('*/') ? ' ' : ', '); -}; - -const getPartitionKeys = (partitionKeysHash, isParentActivated) => { - const keysIds = Object.keys(partitionKeysHash); - - if (keysIds.length) { - const keysString = commentDeactivatedKeys(keysIds, partitionKeysHash, isParentActivated); - - return (keysIds.length > 1) ? `(${keysString})` : keysString; - } else { - return ""; - } -}; - -const getClusteringKeys = (clusteringKeysHash, isParentActivated) => { - const keysIds = Object.keys(clusteringKeysHash); - - if (keysIds.length) { - return commentDeactivatedKeys(keysIds, clusteringKeysHash, isParentActivated); - } else { - return ""; - } -}; - -const seedOptionsWithValues = (options, valueObject) => options.map(option => { - const value = valueObject[option['propertyKeyword']]; - if (value === undefined) { - return option; - } - - return Object.assign({}, option, { value }); -}); - -const getOptionsFromTab = config => { - const optionsBlock = config.structure.find(prop => prop.propertyName === 'Options'); - return optionsBlock.structure; -} - -const mergeValuesWithConfigOptions = values => { - const [detailsTab] = getEntityLevelConfig(); - const configOptions = getOptionsFromTab(detailsTab); - return seedOptionsWithValues(configOptions, values); -} - -const getOptions = (clusteringKeys, clusteringKeysHash, tableId, tableOptions, comment, isParentActivated) => { - const optionsWithValues = mergeValuesWithConfigOptions(tableOptions); - const optionsString = addId( - tableId, - addClustering(clusteringKeys, clusteringKeysHash, parseToString(optionsWithValues, comment), isParentActivated) - ); - - return optionsString ? optionsString.replace(/\n$/, '') : ''; -}; - -const commentDeactivatedKeys = (keysIds, keysHash, isParentActivated) => { - const joinKeys = keys => keys.map(id => keysHash[id].name).join('", "'); - - if (!isParentActivated) { - return `"${joinKeys(keysIds)}"`; - } - - const [activatedKeys, deactivatedKeys] = dependencies.lodash.partition(keysIds, id => keysHash[id].isActivated !== false); - if (deactivatedKeys.length === 0) { - return `"${joinKeys(activatedKeys)}"`; - } else if (activatedKeys.length === 0) { - return `${inlineComment(`"${joinKeys(deactivatedKeys)}"`)}`; - } - return `"${joinKeys(activatedKeys)}" ${inlineComment(`, "${joinKeys(deactivatedKeys)}"`)}`; -} - -module.exports = { - getOptions, - getPrimaryKeyList, - getTableStatement({ - tableData, - tableMetaData, - dataSources, - keyspaceMetaData, - udtTypeMap, - isKeyspaceActivated - }) { - const keyspaceName = retrieveContainerName(keyspaceMetaData); - const tableName = retrieveEntityName(tableMetaData); - const partitionKeys = retrivePropertyFromConfig(tableMetaData, 0, "compositePartitionKey", []); - const clusteringKeys = retrivePropertyFromConfig(tableMetaData, 0, "compositeClusteringKey", []); - const tableId = retrivePropertyFromConfig(tableMetaData, 0, "schemaId", ""); - const tableComment = retrivePropertyFromConfig(tableMetaData, 0, "comments", ""); - const tableOptions = retrivePropertyFromConfig(tableMetaData, 0, "tableOptions", ""); - const isTableActivated = retrivePropertyFromConfig(tableMetaData, 0, "isActivated", false); - const isTableChildrenActivated = isKeyspaceActivated && isTableActivated; - - const partitionKeysHash = getNamesByIds( - partitionKeys.map(key => key.keyId), - dataSources - ); - const clusteringKeysHash = getNamesByIds( - clusteringKeys.map(key => key.keyId), - dataSources - ); - - const createTableStatement = getCreateTableStatement( - keyspaceName, - tableName, - getColumnDefinition( - tableData.properties || {}, - udtTypeMap, - isTableChildrenActivated - ), - getPrimaryKeyList( - partitionKeysHash, - clusteringKeysHash, - isTableChildrenActivated - ), - getOptions( - clusteringKeys, - clusteringKeysHash, - tableId, - tableOptions, - tableComment, - isTableChildrenActivated - ), - retrivePropertyFromConfig(tableMetaData, 0, "tableIfNotExist", undefined) - ); - - return commentDeactivatedStatement( - createTableStatement, - isTableActivated, - isKeyspaceActivated - ); - }, - mergeValuesWithConfigOptions, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/tableOptionService/getDiff.js b/forward_engineering/helpers/tableOptionService/getDiff.js deleted file mode 100644 index 4d448315..00000000 --- a/forward_engineering/helpers/tableOptionService/getDiff.js +++ /dev/null @@ -1,98 +0,0 @@ -const { dependencies } = require('../appDependencies'); -const CACHING = 'caching'; -const COMPACTION = 'compaction'; -const COMPRESSION = 'compression'; -const ID = 'id'; -const REDUNDANT_OPTIONS = [ID]; - -const optionDefaultValues = { - localReadRepairChance: 0, - caching: {'keys': 'ALL', 'rows_per_partition': 'NONE'}, - compaction: "{'class': 'org.apache.cassandra.db.compaction.SizeTieredCompactionStrategy', 'max_threshold': '32', 'min_threshold': '4'}", - compression: "{'chunk_length_in_kb': '64', 'class': 'org.apache.cassandra.io.compress.LZ4Compressor'}", - readRepairChance: 0, - gcGraceSeconds: 864000, - bloomFilterFalsePositiveChance: 0.01, - defaultTtl: 0, - speculativeRetry: '99PERCENTILE', - minIndexInterval: 128, - maxIndexInterval: 2048, - crcCheckChance: 1, - memtableFlushPeriod: 0, -} - -const isDiff = (oldValue, value, optionName) => { - switch(optionName) { - case COMPRESSION: - case COMPACTION: return isDiffParsedJsonString(oldValue, value); - case CACHING: return isDiffCaching(oldValue, value); - default: return oldValue !== value; - } -}; - -const isDiffParsedJsonString = (oldValue, value) => { - if (oldValue === '' || value === '') { - return oldValue !== value; - } - - const jsonOld = JSON.parse(oldValue.replace(/[\'']/g, '\"')); - const jsonNew = JSON.parse(value.replace(/[\'']/g, '\"')); - - return !dependencies.lodash.isEqual(jsonOld, jsonNew); -}; - -const isDiffCaching = (oldValue, value) => { - const updateKeys = caches => { - const perPartitionValue = dependencies.lodash.get(caches, 'rowsPerPartition'); - if (perPartitionValue) { - return { ...dependencies.lodash.omit(caches, 'rowsPerPartition'), 'rows_per_partition': perPartitionValue }; - } - - return caches; - }; - - const jsonOld = Object.assign({}, updateKeys(oldValue), { id: null }); - const jsonNew = Object.assign({}, updateKeys(value), { id: null }); - - return !dependencies.lodash.isEqual(jsonOld, jsonNew); -}; - -const getModifiedAndNewOptions = (newOptions, oldOptions) => { - oldOptions = dependencies.lodash.isEmpty(oldOptions) ? optionDefaultValues : oldOptions; - - return Object.entries(newOptions).reduce((acc, [name, value]) => { - if (REDUNDANT_OPTIONS.includes(name)) { - return acc; - } - - if (!oldOptions.hasOwnProperty(name) || isDiff(oldOptions[name], value, name)) { - return Object.assign({}, acc, { [name]: value }) - } - - return acc; - }, {}); -}; - -const getDeletedOptions = (newOptions, oldOptions) => { - newOptions = dependencies.lodash.isEmpty(newOptions) ? optionDefaultValues : newOptions; - - return Object.keys(oldOptions).filter(oldOptionKey => !newOptions.hasOwnProperty(oldOptionKey)); -}; - -const getDefaultOptionsByName = (optionNames, oldOptions) => { - return optionNames.reduce((acc, optionName) => { - if (optionDefaultValues.hasOwnProperty(optionName) && isDiff(dependencies.lodash.get(oldOptions, optionName), optionDefaultValues[optionName], optionName)) { - return Object.assign({}, acc, { [optionName]: optionDefaultValues[optionName] }); - } - - return acc; - }, {}); -}; - -module.exports = { - getDiff(newOptions, oldOptions) { - const modifiedAndNewOptions = getModifiedAndNewOptions(newOptions, oldOptions); - const deletedOptionNames = getDeletedOptions(newOptions, oldOptions); - return Object.assign({}, modifiedAndNewOptions, getDefaultOptionsByName(deletedOptionNames, oldOptions)); - }, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/tableOptionService/parseToString.js b/forward_engineering/helpers/tableOptionService/parseToString.js deleted file mode 100644 index dad078cb..00000000 --- a/forward_engineering/helpers/tableOptionService/parseToString.js +++ /dev/null @@ -1,220 +0,0 @@ -const { inlineComment } = require("../commentsHelper"); -const { dependencies } = require('../appDependencies'); - -const NUMERIC = 'numeric'; -const TEXT = 'text'; -const DETAILS = 'details'; -const CHECKBOX = 'checkbox'; - -const OTHER = 'otherProperties'; -const CACHING = 'caching'; -const specialOptions = [CACHING, OTHER]; - -const getStringStart = str => str === '' ? '\nWITH' : ' AND'; -const changeQuotes = str => String(str || '').replace(/[\"\`]/g, '\''); - -const tableOptionsHashMap = { - localReadRepairChance: 'dclocal_read_repair_chance', - readRepairChance: 'read_repair_chance', - gcGraceSeconds: 'gc_grace_seconds', - bloomFilterFalsePositiveChance: 'bloom_filter_fp_chance', - defaultTtl: 'default_time_to_live', - speculativeRetry: 'speculative_retry', - minIndexInterval: 'min_index_interval', - maxIndexInterval: 'max_index_interval', - crcCheckChance: 'crc_check_chance', - memtableFlushPeriod: 'memtable_flush_period_in_ms', -} - -const convertKeywordToTableOptionName = keyword => { - if (tableOptionsHashMap.hasOwnProperty(keyword)) { - return tableOptionsHashMap[keyword]; - } - - return keyword; -} - -const transformOption = (option) => { - if (specialOptions.includes(option.propertyKeyword)) { - return transformSpecialOption(option); - } - - return transformOptionByPropertyType(option); - -}; - -const transformSpecialOption = option => { - switch (option.propertyKeyword) { - case CACHING: return transformCachingOption(option); - case OTHER: return transformOtherOptions(option); - default: return null; - } -} - -const transformOptionByPropertyType = option => { - switch (option.propertyType) { - case TEXT: return transformTextOption(option); - case CHECKBOX: return transformBooleanOption(option); - case NUMERIC: return transformNumericOption(option); - case DETAILS: return transformDetailsOptions(option); - default: return null; - } -} - -const transformTextOption = option => - `${convertKeywordToTableOptionName(option['propertyKeyword'])} = '${option.value}'`; - -const transformNumericOption = option => - `${convertKeywordToTableOptionName(option['propertyKeyword'])} = ${option.value}`; - -const transformDetailsOptions = option => { - const getStringValue = value => { - if (typeof value === 'object') { - return JSON.stringify(option.value); - } - - return value; - } - const stringValue = getStringValue(option.value); - const trimmedValue = stringValue.replace(/\n/g, ''); - return `${convertKeywordToTableOptionName(option['propertyKeyword'])} = ${changeQuotes(trimmedValue)}`; -} - -const transformOtherOptions = option => { - const subOptionArray = option.value; - return subOptionArray - .reduce((optionString, option) => { - const { name, value } = option; - if (!name || !value) { - return optionString; - } - - const start = optionString === '' ? '' : ' AND'; - return optionString.concat(`${start} ${name} = '${value}'\n`); - }, '') - .replace(/\n$/, ''); -} - -const transformBooleanOption = option => { - const keyword = option['propertyKeyword']; - if (!Boolean(option.value)) { - return null; - } - - if (keyword === 'cdc') { - return 'cdc = TRUE'; - } - - if (keyword === 'compactStorage') { - return 'COMPACT STORAGE'; - } - - return null; -} - -const transformCachingOption = option => { - const validateKeys = value => allowedValues.includes(value) ? value : null; - const validateRows = value => { - if (allowedValues.includes(value)) { - return value; - } - - if (!isNaN(value)) { - return Number(value); - } - - return null; - }; - const createValueObject = (keys, rows) => Object.assign( - {}, - keys && { keys }, - rows && { rows_per_partition: rows } - ); - const allowedValues = ['ALL', 'NONE']; - const keys = validateKeys(option.value['keys']); - const rows = validateRows(option.value['rowsPerPartition']); - if (!keys && !rows) { - return null; - } - - const stringValue = JSON.stringify(createValueObject(keys, rows)); - return `caching = ${changeQuotes(stringValue)}`; -} - -const generateOptionsStringReducer = (str, option) => { - if (!option.value && typeof option.value !== 'number') { - return str; - } - - const optionString = transformOption(option); - if (!optionString) { - return str; - } - - const start = getStringStart(str); - return str.concat(`${start} ${optionString}\n`); -} - -const addCommentToOptionString = (optionString, comment) => { - if (comment) { - const start = getStringStart(optionString); - return optionString.concat(`${start} comment = '${comment}'\n`); - } - - return optionString; -} - -const addId = (tableId, options) => { - if (!tableId) { - return options; - } - - const start = getStringStart(options); - return options.concat(`${start} ID = '${tableId}'\n`); -} - -const addClustering = (clusteringKeys, clusteringKeysHash, options, isParentActivated) => { - const validClusteredKeys = clusteringKeys.filter(key => clusteringKeysHash[key && key.keyId]); - if (!validClusteredKeys.length) { - return options; - } - const mapKeys = keys => { - return keys - .map((key) => { - const { keyId, type } = key; - const { name } = clusteringKeysHash[keyId]; - const order = type === 'descending' ? 'DESC' : 'ASC'; - return `"${name}" ${order}`; - }); - }; - - let [activatedKeys, deactivatedKeys] = dependencies.lodash.partition( - validClusteredKeys, - ({ keyId }) => dependencies.lodash.get(clusteringKeysHash, `${keyId}.isActivated`) !== false - ); - activatedKeys = mapKeys(activatedKeys); - deactivatedKeys = mapKeys(deactivatedKeys); - let fields; - if (!isParentActivated) { - fields = mapKeys(validClusteredKeys).join(', '); - } else if (deactivatedKeys.length === 0) { - fields = activatedKeys.join(', '); - } else if (activatedKeys.length === 0) { - fields = inlineComment(deactivatedKeys.join(', ')); - } else { - fields = `${activatedKeys.join(', ')} ${inlineComment(`, ${deactivatedKeys.join(', ')}`)}`; - } - - const start = getStringStart(options); - return options.concat(`${start} CLUSTERING ORDER BY (${fields})\n`); -} - -module.exports = { - parseToString(options, comment) { - const optionString = options.reduce(generateOptionsStringReducer, ''); - const optionsWithComment = addCommentToOptionString(optionString, comment); - return optionsWithComment; - }, - addId, - addClustering, -}; \ No newline at end of file diff --git a/forward_engineering/helpers/typeHelper.js b/forward_engineering/helpers/typeHelper.js deleted file mode 100644 index ba6122c2..00000000 --- a/forward_engineering/helpers/typeHelper.js +++ /dev/null @@ -1,244 +0,0 @@ -'use strict' - -const { getFieldConfig, getTypeConfig, canTypeHaveSubtype } = require('./generalHelper'); - -const ifType = type => { - let result; - - const handler = (wanted, returnValue) => { - if (wanted === type) { - result = returnValue; - } else if (wanted === undefined) { - return result; - } - - return handler; - }; - - return handler; -}; - -const getModeType = (type, defaultType, udtTypeMap) => { - if (type) { - const mode = getFieldConfig(type, "mode"); - const definedType = (mode && mode.options) ? mode.options[0] : type; - - return getHandlerByType(type, udtTypeMap)({ - type: type, - mode: definedType, - frozen: true, - keyType: "char", - keySubtype: "text", - items: { type: "char", mode: "varchar" }, - properties: { field: { type: "char", mode: "varchar" } } - }); - } - - return defaultType; -}; - -const getScalarType = (type, udtTypeMap) => { - const simpleType = (propertyData) => propertyData.type; - const geoSpatialType = (propertyData) => `'${propertyData.subType || "PointType"}'`; - const getJsonType = (propertyData) => { - if (propertyData.physicalType) { - return getHandlerByType(propertyData.physicalType)(Object.assign(propertyData, { type: propertyData.physicalType })); - } - }; - - return ifType(type) - ("char", (propertyData) => (propertyData.mode || "text")) - ("numeric", (propertyData) => { - const type = (propertyData.mode || "integer"); - - return (type === "integer") ? "int" : type; - }) - ("binary", () => "blob") - ("bool", () => "boolean") - ("blob", simpleType) - ("timestamp", simpleType) - ("date", simpleType) - ("time", simpleType) - ("duration", simpleType) - ("uuid", simpleType) - ("timeuuid", simpleType) - ("DseExecutorStateType", (propertyData) => `'${simpleType(propertyData)}'`) - ("DateRangeType", (propertyData) => `'${simpleType(propertyData)}'`) - ("geospatial", geoSpatialType) - ("udt", (propertyData, propertyName) => { - return getUDTHandler(propertyName, udtTypeMap)(); - }) - ("jsonObject", getJsonType) - ("jsonArray", getJsonType) - (); -}; - -const getStructuralTypeHandler = (type, isNeedToBeFrozen, udtTypeMap) => { - const isFrozen = property => Boolean(property.frozen); - const setFrozen = typeHandler => propertyData => { - const type = typeHandler(propertyData); - - return isFrozen(propertyData) ? getFrozen(type) : type; - }; - - const getValueTypeFromArray = (arraySchema, defaultType, udtTypeMap, propertyName) => { - if (arraySchema.items) { - if (Array.isArray(arraySchema.items)) { - const name = arraySchema.items[0]?.code || arraySchema.items[0]?.name || arraySchema.items[0]?.displayName; - return complexType(arraySchema.items[0], isFrozen(arraySchema), name || 0); - } else { - const name = arraySchema.items?.code || arraySchema.items?.name || arraySchema.items?.displayName; - return complexType(arraySchema.items, isFrozen(arraySchema), name || 0); - } - } else { - const typeConfig = getTypeConfig(arraySchema.type); - if (typeConfig.subtypes && arraySchema.subtype) { - const subTypeConfig = typeConfig.subtypes[arraySchema.subtype]; - if (subTypeConfig && subTypeConfig.childValueType) { - return getModeType(subTypeConfig.childValueType, defaultType, udtTypeMap); - } - } - } - - return defaultType; - }; - - const getValueTypeFromObject = (objectSchema, defaultType, udtTypeMap) => { - if (objectSchema.properties) { - const propertyName = Object.keys(objectSchema.properties)[0]; - - if (propertyName) { - const nestedPropertyData = objectSchema.properties[propertyName]; - - return complexType(nestedPropertyData, isFrozen(objectSchema), propertyName); - } - } else { - const typeConfig = getTypeConfig(objectSchema.type); - if (typeConfig.subtypes && objectSchema.subtype) { - const subTypeConfig = typeConfig.subtypes[objectSchema.subtype]; - if (subTypeConfig && subTypeConfig.childValueType) { - return getModeType(subTypeConfig.childValueType, defaultType, udtTypeMap); - } - } - } - - return defaultType; - }; - - const complexType = ((isNeedToBeFrozen, udtTypeMap) => (nestedPropertyData, isParentFrozen, propertyName) => { - if (nestedPropertyData) { - const nestedType = getNestedTypeByData(nestedPropertyData, !isParentFrozen && isNeedToBeFrozen, udtTypeMap, propertyName); - - if (nestedType !== undefined) { - return nestedType; - } else { - ''; - } - } else { - return "text"; - } - })(isNeedToBeFrozen, udtTypeMap); - - const typeSet = (propertyData, propertyName) => `set<${getValueTypeFromArray(propertyData, "varchar", udtTypeMap, propertyName)}>`; - - const list = (propertyData, propertyName) => `list<${getValueTypeFromArray(propertyData, "text", udtTypeMap, propertyName)}>`; - - const tuple = (propertyData, propertyName) => { - let items = Array.isArray(propertyData.items) ? propertyData.items : [propertyData.items]; - - return `tuple<${items.map((item, i) => complexType(item, true, i)).join(', ')}>`; - }; - - const map = (propertyData, propertyName) => { - const keyType = canTypeHaveSubtype(propertyData.keyType, propertyData.keySubtype) - ? propertyData.keySubtype - : getModeType(propertyData.keyType, "text", udtTypeMap); - const valueType = getValueTypeFromObject(propertyData, "text", udtTypeMap, propertyName); - - return `map<${keyType}, ${valueType}>`; - }; - - const vector = (propertyData, propertyName) => { - const valueType = getValueTypeFromArray(propertyData, "float", udtTypeMap, propertyName) - const dimension = getVectorDimension(propertyData); - - return `vector<${valueType}, ${dimension}>` - }; - - return ifType(type) - ("map", setFrozen(map)) - ("list", setFrozen(list)) - ("set", setFrozen(typeSet)) - ("vector", setFrozen(vector)) - ("tuple", tuple) - (); -}; - -const getUDTHandler = (type, udtTypeMap, parentIsFrozen) => { - return () => { - const data = (udtTypeMap[type] || {}); - - if (data.frozen && !parentIsFrozen) { - return getFrozen(data.name); - } else { - return data.name; - } - }; -}; - -const getFrozen = (typeDefinition) => typeDefinition === undefined ? undefined : `frozen<${typeDefinition}>`; - -const getHandlerByType = (type, udtTypeMap) => ( - getScalarType(type, udtTypeMap) - || - getStructuralTypeHandler(type, true, udtTypeMap) - || - getUDTHandler(type, udtTypeMap) -); - -const getNestedTypeByData = (propertyData, isNeedToBeFrozen, udtTypeMap, propertyName) => { - const type = getTypeByPropertyData(propertyData); - const scalarTypeHandler = getScalarType(type, udtTypeMap); - - if (scalarTypeHandler) { - return scalarTypeHandler(propertyData, propertyName); - } - - const freezingType = ( - getStructuralTypeHandler(type, false, udtTypeMap) - || - getUDTHandler(type, udtTypeMap, isNeedToBeFrozen) - )(propertyData, propertyName); - - return (isNeedToBeFrozen) ? getFrozen(freezingType) : freezingType; -}; - -const getTypeByPropertyData = (propertyData) => { - if (propertyData.$ref) { - return propertyData.$ref.split('/definitions/').pop(); - } else if (propertyData.type) { - return propertyData.type; - } else { - return "char"; - } -}; - -const getTypeByData = (propertyData, udtTypeMap, propertyName) => { - const type = getTypeByPropertyData(propertyData); - - return getHandlerByType(type, udtTypeMap)(propertyData, propertyName); -}; - -const getVectorDimension = (propertyData) => { - if (!isNaN(+propertyData.dimension)) { - return propertyData.dimension - } - - const config = getFieldConfig(propertyData.type, "dimension"); - - return config?.defaultValue; -}; - -module.exports = { - getTypeByData -}; diff --git a/forward_engineering/helpers/types/AlterScriptDto.js b/forward_engineering/helpers/types/AlterScriptDto.js deleted file mode 100644 index f67089ca..00000000 --- a/forward_engineering/helpers/types/AlterScriptDto.js +++ /dev/null @@ -1,88 +0,0 @@ -class ModificationScript { - /** - * @type string - * */ - script - - /** - * @type boolean - * */ - isDropScript - - /** - * @type boolean - * */ - isModifyScript - - /** - * @type boolean - * */ - isAddScript -} - -class AlterScriptDto { - /** - * @type {boolean | undefined} - * */ - isActivated - - /** - * @type {Array} - * */ - scripts - - /** - * @param scripts {Array} - * @param isActivated {!boolean} - * @param scriptPurpose {string} 'deletion' | 'add' | 'modify' - * @param modelLevel {?string} 'index' | 'field' | 'udt' | 'renewal' | 'udf' | 'keySpaces' | 'table' | 'view' - * @return {Array} - * */ - static getInstances(scripts, isActivated, scriptPurpose, modelLevel) { - return (scripts || []) - .filter(Boolean) - .map(script => this.getInstance([script], isActivated, scriptPurpose, modelLevel)); - } - - /** - * @param scripts {Array} - * @param isActivated {!boolean} - * @param scriptPurpose {string} 'deletion' | 'add' | 'modify' - * @param modelLevel {?string} 'index' | 'field' | 'udt' | 'renewal' | 'udf' | 'keySpaces' | 'table' | 'view' - * @return {AlterScriptDto | undefined} - * */ - static getInstance(scripts, isActivated, scriptPurpose, modelLevel ) { - if (!scripts?.filter(Boolean)?.length) { - return undefined; - } - const scriptPurposes = { - deletion: false, - add: false, - modify: false - }; - - if (scriptPurposes[scriptPurpose] === undefined) { - throw new Error(`Unsupported scriptPurpose provided: ${scriptPurpose}`); - } - - scriptPurposes[scriptPurpose] = true; - - return { - isActivated, - scripts: scripts - .filter(Boolean) - .map(script => ({ - isDropScript: scriptPurposes.deletion, - script, - isModifyScript: scriptPurposes.modify, - isAddScript: scriptPurposes.add, - modelLevel - })) - } - } -} - -module.exports = { - ModificationScript, - AlterScriptDto, -} \ No newline at end of file diff --git a/forward_engineering/helpers/types/PersistenceSchemaChild.js b/forward_engineering/helpers/types/PersistenceSchemaChild.js deleted file mode 100644 index ea5cca0f..00000000 --- a/forward_engineering/helpers/types/PersistenceSchemaChild.js +++ /dev/null @@ -1,50 +0,0 @@ -class PersistenceSchemaChild { - /** - * JSON Schema version - * @type string - * */ - $schema - - /** - * Type of PersistenceSchemaChild - * @type string - * */ - type - - /** - * - * @type string - * */ - title - - /** - * - * @type object - * */ - properties - - /** - * @type boolean - * */ - isActivated - - /** - * @type boolean - * */ - additionalProperties - - /** - * @type boolean - * */ - tableIfNotExist - - /** - * @type boolean - * */ - searchIndexIfNotExist - - /** - * @type string - * */ - GUID -} \ No newline at end of file diff --git a/forward_engineering/helpers/udtHelper.js b/forward_engineering/helpers/udtHelper.js deleted file mode 100644 index 00126451..00000000 --- a/forward_engineering/helpers/udtHelper.js +++ /dev/null @@ -1,137 +0,0 @@ -'use strict' - -const { tab, getNameWithKeyspace, eachField } = require('./generalHelper'); -const { getColumnDefinition } = require('./columnHelper'); - -const getUdtScripts = (keyspaceName, sources, udtMap, isParentActivated) => { - const copyUdtTypeMap = setFrozenForAllUdt(udtMap); - - return sources.reduce((definitions, source) => { - const udts = getAllUdt(source, copyUdtTypeMap, isParentActivated).map(({ name, definition }) => { - return getCreateTypeStatement(keyspaceName, name, definition); - }); - - return definitions.concat(udts); - }, []); -}; - -const setFrozenForAllUdt = (udtTypeMap) => { - return Object.keys(udtTypeMap).reduce((typeMap, typeName) => { - return Object.assign(typeMap, { [typeName]: Object.assign({}, udtTypeMap[typeName], { frozen: true }) }) - }, {}); -}; - -const getName = (name, property) => { - if (typeof name === 'number' && property.displayName) { - return property.displayName; - } - - return property.code || name; -}; - -const getCreateTypeStatement = (keyspaceName, typeName, fieldsDefinitions) => { - return `CREATE TYPE IF NOT EXISTS ${getNameWithKeyspace(keyspaceName, typeName)} (\n${tab(fieldsDefinitions)}\n);` -}; - -const getUdtMap = (udtSources) => { - return udtSources.reduce((map, source) => { - eachField(source, (field, fieldName) => { - if (field.type === 'udt') { - const name = getName(fieldName, field); - map[name] = { - name, - frozen: field.frozen - }; - } - - return field; - }); - - return map; - }, {}); -}; - -const getAllUdt = (jsonSchema, udtTypeMap, isParentActivated) => { - const udts = []; - - eachField(jsonSchema, (field, fieldName) => { - if (field.type === 'udt' && field.properties) { - udts.push({ - name: getName(fieldName, field), - definition: getColumnDefinition(field.properties, udtTypeMap, isParentActivated) - }); - } - - return field; - }); - - return udts; -}; - -const sortUdt = (definitionJsonSchema) => { - if (!definitionJsonSchema.properties) { - return definitionJsonSchema; - } - - const udtNames = Object.keys(definitionJsonSchema.properties); - let orderedUdtNames = []; - - udtNames.forEach(udtName => { - let references = []; - - eachField(definitionJsonSchema.properties[udtName], (field) => { - if (field.$ref) { - const udtName = field.$ref.split('/').pop(); - - if (references.indexOf(udtName) === -1) { - references.push(udtName); - } - } - }); - - if (references.length) { - orderedUdtNames.push(...references.filter(name => orderedUdtNames.indexOf(name) === -1)); - } else { - const i = orderedUdtNames.indexOf(udtName); - - if (i === -1) { - orderedUdtNames.unshift(udtName); - } else { - orderedUdtNames.unshift(...orderedUdtNames.splice(i, 1)); - } - } - }); - - - udtNames.forEach(udtName => { - if (orderedUdtNames.indexOf(udtName) === -1) { - orderedUdtNames.push(udtName); - } - }); - - let properties = {}; - - orderedUdtNames.forEach(udtName => { - if (definitionJsonSchema.properties[udtName]) { - properties[udtName] = Object.assign({}, definitionJsonSchema.properties[udtName]); - } - }); - - definitionJsonSchema.properties = properties; - - return definitionJsonSchema; -}; - -const prepareDefinitions = data => { - const modelDefinitions = sortUdt(JSON.parse(data.modelDefinitions)); - const externalDefinitions = JSON.parse(data.externalDefinitions); - const udtTypeMap = getUdtMap([modelDefinitions, externalDefinitions]); - return { udtTypeMap, modelDefinitions, externalDefinitions }; -} - -module.exports = { - getUdtScripts, - getUdtMap, - sortUdt, - prepareDefinitions, -}; diff --git a/forward_engineering/helpers/updateHelpers/generalHelper.js b/forward_engineering/helpers/updateHelpers/generalHelper.js deleted file mode 100644 index ba8c7d50..00000000 --- a/forward_engineering/helpers/updateHelpers/generalHelper.js +++ /dev/null @@ -1,54 +0,0 @@ -const {dependencies} = require("../appDependencies"); -const {ReservedWordsAsArray} = require("../enums/reservedWords"); -const mergeArrays = (first, sec) => { - return [...first, ...sec]; -}; - -const typesCompatibility = { - blob: ['ascii', 'bigint', 'boolean', 'decimal', 'double', 'float', 'inet', 'int', 'timestamp', 'timeuuid', 'uuid', 'varchar', 'varint'], - varint: ['int'], - varchar: ['text'], - uuid: ['timeuuid'], - text: ['varchar'] -}; - -const checkIsOldModel = modelData => { - const modelVersion = modelData.filter(element => { - return element.dbVersion; - })[0].dbVersion; - const majorDigitIndex = modelVersion.search(/\d/); - - if (majorDigitIndex !== -1) { - const majorDigit = modelVersion[majorDigitIndex]; - return majorDigit < 3; - } -}; - -const fieldTypeCompatible = (oldType, newType) => { - const compatibility = typesCompatibility[newType]; - - if (!compatibility) { - return false; - } - - const foundCapabilityType = compatibility.filter(type => { - return type === oldType; - }); - - if (!Boolean(foundCapabilityType.length)) { - return false; - } - - return true -}; - -const wrapInQuotes = name => - /\s|\W/.test(name) || dependencies.lodash.includes(ReservedWordsAsArray, dependencies.lodash.toUpper(name)) ? `"${name}"` : name; - - -module.exports = { - mergeArrays, - checkIsOldModel, - fieldTypeCompatible, - wrapInQuotes -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/indexHelper.js b/forward_engineering/helpers/updateHelpers/indexHelper.js deleted file mode 100644 index 64a7930c..00000000 --- a/forward_engineering/helpers/updateHelpers/indexHelper.js +++ /dev/null @@ -1,502 +0,0 @@ -const { dependencies } = require('../appDependencies'); -const { getIndexProfiles, getTableNameStatement, tab } = require('../generalHelper'); -const { getIndexes } = require('../indexHelper'); -const { getNamesByIds } = require('../schemaHelper'); -const { - getDiffOptions, - getDiffConfig, - getDiffIndexProfiles, - isEqualIndex, - prepareSearchIndexProfile, -} = require('./indexService'); -const { AlterScriptDto } = require("../types/AlterScriptDto"); - -let nameCollectionsExistsScript = { - dropIndexes: [], - dropSearchIndexes: [], - createIndexes: [], - createSearchIndexes: [], -}; - -const scriptData = { - index: 'index', -}; - -const checkExistsScript = (keyspaceName, name, type) => { - const statement = getTableNameStatement(keyspaceName, name); - const filteredScriptName = nameCollectionsExistsScript[type].filter(name => name === statement); - return !!filteredScriptName.length; -} - -const setNameCollectionsScript = (keyspaceName, name, type) => { - const statement = getTableNameStatement(keyspaceName, name); - nameCollectionsExistsScript = { ...nameCollectionsExistsScript, [type]: [...nameCollectionsExistsScript[type], statement] }; -}; - -const indexSearchProperties = ['searchIndexProfiles', 'searchIndexOptions']; - -const getDataSearchIndex = (indexTab, dbVersion) => { - return { - indexType: 'search', - columns: indexTab.searchIndexColumns, - config: indexTab.searchIndexConfig, - profiles: getIndexProfiles(indexTab.searchIndexProfiles, dbVersion), - options: indexTab.searchIndexOptions, - ifNotExist: indexTab.searchIndexIfNotExist - }; -} - -const getModifyDataSearchIndex = (item, type, dbVersion) => { - const itemData = [...indexSearchProperties, 'searchIndexIfNotExist', 'searchIndexColumns', 'searchIndexConfig'] - .map(property => ([property, (item?.compMod || {})[property]?.[type]])) - .filter(([__, value]) => !!value); - item = { ...item, ...Object.fromEntries(itemData) }; - return getDataSearchIndex(item, dbVersion); -} - -const getDataForScript = (newData, oldData, isEqual = dependencies.lodash.isEqual) => { - let addData; - let dropData; - - if (!newData.length && !oldData.length) { - return {}; - } - - if (!newData.length) { - dropData = oldData; - } else if (!oldData.length) { - addData = newData; - } else if (!dependencies.lodash.isEqual(newData, oldData)) { - const equalElements = dependencies.lodash.intersectionWith(newData, oldData, isEqual); - dropData = dependencies.lodash.xorWith(oldData, equalElements, isEqual); - addData = dependencies.lodash.xorWith(newData, equalElements, isEqual); - } - return { - addData, - dropData, - } -} - -const getDataForSearchIndexScript = (role, dataSources, dbVersion) => { - const { compMod } = role; - const oldIdToNameHashTable = dependencies.lodash.get(role, 'compMod.oldIdToNameHashTable', {}); - const columns = dependencies.lodash.get(role, 'compMod.searchIndexColumns', {}); - const filterColumn = column => column?.name && !column?.compositePartitionKey; - const oldColumns = (columns.old || []) - .map(column => getDataColumnIndex({ - dataSources, - column, - allAttributes: true, - idToNameHashTable: oldIdToNameHashTable, - })) - .filter(filterColumn); - const dataSearchIndex = getDataSearchIndex(role, dbVersion); - const searchIndex = dependencies.lodash.get(role, 'compMod.searchIndex', {}); - const newProfiles = compMod?.searchIndexProfiles?.new; - const oldProfiles = prepareSearchIndexProfile(compMod?.searchIndexProfiles?.old, newProfiles, oldColumns) - const searchPropertiesCompare = dependencies.lodash.merge( - getDiffOptions(compMod?.searchIndexOptions?.old, compMod?.searchIndexOptions?.new), - getDiffIndexProfiles(oldProfiles, newProfiles), - ); - - let dropData; - let addData; - - if (!searchIndex.old && !searchIndex.new) { - return {}; - } - - if (!searchIndex.old) { - addData = getModifyDataSearchIndex(role, 'new', dbVersion); - } else if (!searchIndex.new) { - dropData = dataSearchIndex; - } else if (!dependencies.lodash.isEmpty(searchPropertiesCompare.modifyData) || !dependencies.lodash.isEmpty(searchPropertiesCompare.dropData)) { - addData = getModifyDataSearchIndex(role, 'new', dbVersion); - dropData = dataSearchIndex; - } - return { - addData, - dropData - }; -} - -const getFieldDataByKeyId = ({ dataSources, idToNameHashTable, keyId, allAttributes = false }) => { - const fieldData = getNamesByIds([keyId], dataSources, allAttributes)[keyId] || {}; - if (fieldData.name) { - return fieldData - } - - const name = idToNameHashTable[keyId] || ''; - - return { name }; -} - -const getDataColumnIndex = ({ - dataSources, - idToNameHashTable, - column = {}, - key = 'key', - allAttributes = false, -}) => { - const keyId = dependencies.lodash.get(column, `${key}[0].keyId`, ''); - const fieldData = getFieldDataByKeyId({ dataSources, idToNameHashTable, keyId, allAttributes }) || {}; - - return { - ...dependencies.lodash.omit(column, key), - ...fieldData, - }; -} - -const getDataForSearchIndexColumns = (item, dataSources) => { - const oldIdToNameHashTable = dependencies.lodash.get(item, 'role.compMod.oldIdToNameHashTable', {}); - const newIdToNameHashTable = dependencies.lodash.get(item, 'role.compMod.newIdToNameHashTable', {}); - const columns = dependencies.lodash.get(item, 'role.compMod.searchIndexColumns', {}); - const filterColumn = column => column.name && !column.compositePartitionKey; - const newColumns = (columns.new || []) - .map(column => getDataColumnIndex({ dataSources, idToNameHashTable: newIdToNameHashTable, column })) - .filter(filterColumn); - const oldColumns = (columns.old || []) - .map(column => getDataColumnIndex({ dataSources, idToNameHashTable: oldIdToNameHashTable, column })) - .filter(filterColumn); - const isEqual = (oldValue, newValue) => oldValue?.name === newValue?.name; - return getDataForScript(newColumns, oldColumns, isEqual); -} - -const getSearchConfigScript = (keyspaceName, tableName, config) => { - const dropScript = Object.entries(config.dropData).map(([key]) => - AlterScriptDto.getInstance( - [dependencies.provider.dropSearchIndexConfig(keyspaceName, tableName, key)], - true, - 'deletion', - 'index' - ) - ); - const modifyScript = Object.entries(config.modifyData) - .filter(([__, value]) => typeof value !== 'string' || Boolean(value)) - .map(([key, value]) => { - const preparedValue = dependencies.lodash.isString(value) ? `'${value}'` : value; - - return AlterScriptDto.getInstance( - [dependencies.provider.modifySearchIndex(keyspaceName, tableName, key, preparedValue)], - true, - 'modify', - 'index' - ); - }); - - return [...modifyScript, ...dropScript]; -} - -const getSearchColumnsScript = (keyspaceName, tableName, columns) => { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - const alterScript = `ALTER SEARCH INDEX SCHEMA\n` + - tab(`ON ${tableNameStatement}\n`); - - const getScript = (alterScript, statement, scriptPurpose, column) => { - const script = alterScript + - tab(`${statement} "${column.name}";`); - - return AlterScriptDto.getInstance( - [script], - true, - scriptPurpose, - 'index' - ); - }; - - const dropSearchScripts = (columns.dropData || []).map(getScript.bind(null, alterScript, `DROP field`, 'deletion')); - const addSearchScripts = (columns.addData || []).map(getScript.bind(null, alterScript, `ADD field`, 'modify')); - if (dropSearchScripts.length) { - dropSearchScripts.push(getRenewalScript(keyspaceName, tableName, 'RELOAD', 'deletion')); - } - - return { dropSearchScripts, addSearchScripts }; -} - -const getRenewalScript = (keyspaceName, tableName, startStatement, scriptPurpose) => { - const tableNameStatement = getTableNameStatement(keyspaceName, tableName); - const script = `${startStatement} SEARCH INDEX\n` + - tab(`ON ${tableNameStatement};`); - - return AlterScriptDto.getInstance( - [script], - true, - scriptPurpose, - 'renewal' - ); -} - -const getDropSearchIndexScript = (keyspaceName, tableName, isDrop) => { - const isExistScript = checkExistsScript(keyspaceName, tableName, 'dropSearchIndexes'); - let script = ''; - if (!!isDrop && !isExistScript) { - script = dependencies.provider.dropSearchIndex(keyspaceName, tableName,) - setNameCollectionsScript(keyspaceName, tableName, 'dropSearchIndexes'); - } - return [AlterScriptDto.getInstance( - [script], - true, - 'deletion', - 'index' - ) - ]; -} - -const getDropIndexScript = (keyspaceName, tableName, secIndxs = []) => secIndxs.map(index => { - const tableIndexName = `${tableName}.${index.name}`; - const isExistScript = checkExistsScript(keyspaceName, tableIndexName, 'dropIndexes'); - let script = ''; - if (index.name && !isExistScript) { - script = dependencies.provider.dropIndex(keyspaceName, index.name); - setNameCollectionsScript(keyspaceName, tableIndexName, 'dropIndexes'); - } - return AlterScriptDto.getInstance( - [script], - true, - 'deletion', - 'index' - ) -}) - -const getAddSearchIndexScript = data => { - const { keyspaceName, tableName, searchIndex, dataSources, isActivated, dbVersion } = data; - const isExistScript = checkExistsScript(keyspaceName, tableName, 'createSearchIndexes'); - if (isExistScript) { - return []; - } - setNameCollectionsScript(keyspaceName, tableName, 'createSearchIndexes'); - const script = getIndexes( - { searchIndex }, - dataSources, - tableName, - keyspaceName, - isActivated, - true, - dbVersion - ); - return [ - AlterScriptDto.getInstance( - [script], - true, - 'add', - 'index' - ) - ]; -} - -const getAddIndexScript = data => { - const { keyspaceName, indexes = [], dataSources, tableName, isActivated, dbVersion } = data; - const filteredIndexes = indexes.filter(index => { - const tableIndexName = `${tableName}.${index.name}`; - const isExistScrip = checkExistsScript(keyspaceName, tableIndexName, 'createIndexes'); - if (isExistScrip) { - return false; - } - setNameCollectionsScript(keyspaceName, tableIndexName, 'createIndexes'); - return true; - }) - const script = getIndexes( - { indexes: filteredIndexes }, - dataSources, - tableName, - keyspaceName, - isActivated, - true, - dbVersion - ); - return [AlterScriptDto.getInstance( - [script], - true, - 'add', - 'index' - ) - ]; -} - -const getCreatedIndex = data => { - const { item, dataSources, tableName, keyspaceName, isActivated, dbVersion } = data; - const isSearchIndex = !!item.role?.searchIndex; - const dataForSearchIndexScript = getDataSearchIndex(item.role || {}, dbVersion); - - const script = getIndexes({ - searchIndex: isSearchIndex && dataForSearchIndexScript, - indexes: item.role?.SecIndxs || [], - }, - dataSources, - tableName, - keyspaceName, - isActivated, - true, - dbVersion - ); - return [AlterScriptDto.getInstance( - [script], - true, - 'add', - 'index' - ) - ] -} - -const getDeletedIndex = data => { - const { item, keyspaceName, tableName } = data; - const dropIndexScript = getDropIndexScript(keyspaceName, tableName, item.role?.SecIndxs); - const dropSearchIndexScript = getDropSearchIndexScript( - keyspaceName, - tableName, - item.role?.searchIndex, - ); - return [...dropIndexScript, ...dropSearchIndexScript]; -} - -const getUpdateSearchIndexScript = data => { - const { item, keyspaceName, tableName, dbVersion, isActivated, dataSources } = data; - - const dataForScript = getDataForSearchIndexScript(item.role, dataSources, dbVersion); - - if (dataForScript.dropData || dataForScript.addData) { - const dropIndexSearchScript = getDropSearchIndexScript( - keyspaceName, - tableName, - !!dataForScript.dropData, - ); - - const addSearchIndexScript = getAddSearchIndexScript({ - searchIndex: dataForScript.addData, - dataSources, - tableName, - keyspaceName, - isActivated, - dbVersion - }); - - return [...dropIndexSearchScript, ...addSearchIndexScript]; - } - - const config = dependencies.lodash.get(item, 'role.compMod.searchIndexConfig', {}) - - const dataForColumnsScript = getDataForSearchIndexColumns(item, dataSources); - const dataForConfigScript = getDiffConfig(config.old, config.new) - - const configScript = getSearchConfigScript(keyspaceName, tableName, dataForConfigScript); - const { dropSearchScripts, addSearchScripts } = getSearchColumnsScript(keyspaceName, tableName, dataForColumnsScript); - - const renewalData = { - RELOAD: configScript.length || addSearchScripts.length, - REBUILD: dropSearchScripts.length || addSearchScripts.length, - }; - const renewalScripts = Object.entries(renewalData).reduce((scripts, [key, value]) => { - if (!value) { - return scripts; - } - return [...scripts, getRenewalScript(keyspaceName, tableName, key, 'add')]; - }, []); - - return [...configScript, ...dropSearchScripts, ...addSearchScripts, ...renewalScripts]; -} - -const prepareIndexes = (idToNameHashTable, dataSources, indexes = []) => { - return indexes.map(index => { - const secIndexesKey = dependencies.lodash.get(index, 'SecIndxKey', []).map(key => ({ - ...key, - name: getFieldDataByKeyId({ dataSources, idToNameHashTable, keyId: dependencies.lodash.get(key, 'keyId') })?.name || '', - }) - ); - return { - ...dependencies.lodash.omit(index, ['SecIndxKey']), - SecIndxKey: secIndexesKey, - } - }) -} - -const removeKeyIdFromKeys = (keys = []) => keys.map(key => dependencies.lodash.omit(key, 'keyId')); - -const getUpdateIndexScript = data => { - const { item, keyspaceName, tableName, dbVersion, isActivated, dataSources } = data; - const { new: newIndexes = [], old: oldIndexes = [] } = dependencies.lodash.get(item, 'role.compMod.SecIndxs', {}); - const { oldIdToNameHashTable = {}, newIdToNameHashTable = {} } = dependencies.lodash.get(item, 'role.compMod', {}); - const preparedNewIndexes = prepareIndexes(newIdToNameHashTable, dataSources, newIndexes); - const preparedOldIndexes = prepareIndexes(oldIdToNameHashTable, dataSources, oldIndexes); - - const isEqual = (newIndex = {}, oldIndex = {}) => { - return isEqualIndex( - { ...oldIndex, SecIndxKey: removeKeyIdFromKeys(oldIndex.SecIndxKey) }, - { ...newIndex, SecIndxKey: removeKeyIdFromKeys(newIndex.SecIndxKey) }, - ); - }; - - const dataForIndexScript = getDataForScript(preparedNewIndexes, preparedOldIndexes, isEqual); - - const dropIndexScript = getDropIndexScript( - keyspaceName, - tableName, - dataForIndexScript.dropData, - ); - - const addIndexScript = getAddIndexScript({ - indexes: dataForIndexScript.addData, - dataSources, - tableName, - keyspaceName, - isActivated, - dbVersion - }); - - return [...dropIndexScript, ...addIndexScript]; -} - -const getUpdateIndex = data => { - const updateSearchIndexScript = getUpdateSearchIndexScript(data); - const updateIndexScript = getUpdateIndexScript(data); - - return [...updateIndexScript, ...updateSearchIndexScript]; -} - -const createDataSources = (item, data) => { - const properties = { ...item.properties || {}, ...item.role.properties || {} }; - const itemData = { properties, ...dependencies.lodash.omit(item.role || {}, ['properties']) }; - - return [ - itemData, - data.modelDefinitions, - data.externalDefinitions, - data.internalDefinitions, - { properties: item?.properties || {} }, - { properties: dependencies.lodash.get(item, 'role.compMod.newProperties', []) }, - { properties: dependencies.lodash.get(item, 'role.compMod.oldProperties', []) } - ]; -}; - -const getTableNameFromCompMod = table => table.role?.compMod?.collectionName?.new ?? table.role?.compMod?.collectionName?.old - -const getIndexTable = (item, data, tableIsChange) => { - const dataSources = createDataSources(item, data); - const tableName = item.role?.code || item.role?.name || getTableNameFromCompMod(item); - const keyspaceName = item.role.compMod?.keyspaceName; - const dbVersion = data.modelData[0].dbVersion; - const isActivated = item.role?.isActivated; - - const { compMod = {} } = item.role || {}; - - if (tableIsChange) { - const createdIndexes = getCreatedIndex({ item, dataSources, tableName, keyspaceName, isActivated, dbVersion }); - const deletedIndex = getDeletedIndex({ item, keyspaceName, tableName }); - - return [...createdIndexes, ...deletedIndex]; - } - - if (compMod.created) { - return getCreatedIndex({ item, dataSources, tableName, keyspaceName, isActivated, dbVersion }); - } - - if (compMod.deleted) { - return getDeletedIndex({ item, keyspaceName, tableName }); - } - - return getUpdateIndex({ item, keyspaceName, tableName, dataSources, isActivated, dbVersion }); -} - -module.exports = { - getIndexTable, - getDataColumnIndex -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/indexService.js b/forward_engineering/helpers/updateHelpers/indexService.js deleted file mode 100644 index 93ca1047..00000000 --- a/forward_engineering/helpers/updateHelpers/indexService.js +++ /dev/null @@ -1,145 +0,0 @@ -const { dependencies } = require('../appDependencies'); - -const REDUNDANT_OPTIONS = ['id']; - -const REDUNDANT_PROPERTIES_FOR_INDEX = ['SecIndxComments', 'SecIndxDescription']; - -const SEARCH_INDEX_OPTIONS_DEFAULT = { - recovery: false, - reindex: true, - lenient: false, -}; - -const SEARCH_INDEX_CONFIG_DEFAULT = { - autoCommitTime: 10000, - filterCacheLowWaterMark: 1024, - filterCacheHighWaterMark: 2048, - mergeFactor: 10, - ramBufferSize: 512, - realtime: false -}; - -const INDEX_CONFIG_DEFAULT = { - indexIfNotExist: false, -}; - -const SEARCH_INDEX_PROFILES_DATA_FOR_PREPARE = { - spaceSavingNoTextfield: { - mode: ['text', 'varchar'], - }, - spaceSavingSlowTriePrecision: { - childType: ['timestamp', 'date', 'time', 'numeric', 'timeuuid'], - type: ['timestamp', 'date', 'time', 'numeric', 'timeuuid'], - }, -}; - -const isDiff = (oldValue, newValue) => !dependencies.lodash.isEqual(oldValue, newValue); - -const getModifiedProperties = (oldProperties, newProperties) => { - - return Object.entries(newProperties).reduce((acc, [name, value]) => { - if (REDUNDANT_OPTIONS.includes(name)) { - return acc; - } - - if (!oldProperties.hasOwnProperty(name) || isDiff(oldProperties[name], value)) { - return Object.assign({}, acc, { [name]: value }) - } - - return acc; - }, {}); -}; - -const isEmptyValue = value => typeof value !== 'boolean' && !Boolean(value); - -const getDeletedProperties = (oldProperties, newProperties) => - Object.keys(oldProperties) - .filter(oldPropertyKey => !newProperties.hasOwnProperty(oldPropertyKey)); - -const getDefaultPropertiesByName = (propertiesNames, oldProperties, defaultProperties) => { - return propertiesNames.reduce((acc, propertyName) => { - if (defaultProperties.hasOwnProperty(propertyName) && isDiff(dependencies.lodash.get(oldProperties, propertyName), defaultProperties[propertyName])) { - return Object.assign({}, acc, { [propertyName]: defaultProperties[propertyName] }); - } - - return acc; - }, {}); -}; - -const getNotDefaultProperties = (properties = [], defaultProperties = []) => { - return properties.reduce((acc, property) => defaultProperties.includes(property) ? acc : [...acc, property], []); -}; - -const getDropProperties = (oldData, newData, defaultData = {}) => { - const notDefaultProperties = getNotDefaultProperties(Object.keys(newData), Object.keys(defaultData)); - - return notDefaultProperties.reduce((acc, property) => { - if (REDUNDANT_OPTIONS.includes(property)) { - return acc; - } - - if (oldData.hasOwnProperty(property) && isEmptyValue(newData[property]) && !isEmptyValue(oldData[property])) { - return { - ...acc, - [property]: newData[property] - } - } - - return acc; - }, {}) -}; - -const getDiffOptions = defaultData => (oldData = {}, newData = {}) => { - const modifyData = getModifiedProperties(Object.assign({}, defaultData, oldData), Object.assign({}, defaultData, newData)); - const deleteDataProperties = getDeletedProperties(oldData, Object.assign({}, defaultData, newData)); - - return { - modifyData, - dropData: getDefaultPropertiesByName(deleteDataProperties, oldData, defaultData), - }; -}; - -const getDiff = defaultData => (oldData = {}, newData = {}) => { - const modifyData = getModifiedProperties(Object.assign({}, defaultData, oldData), Object.assign({}, defaultData, newData)); - - return { - modifyData, - dropData: getDropProperties(oldData, newData, defaultData) - } -}; - -const isEqualIndex = (defaultData, redundantProperty) => (oldData = {}, newData = {}) => { - newData = Object.assign({}, defaultData, newData); - oldData = Object.assign({}, defaultData, oldData); - const keys = dependencies.lodash.uniq([...dependencies.lodash.keys(newData), ...dependencies.lodash.keys(oldData)]).filter(key => !redundantProperty.includes(key)); - return keys.reduce( - (isEqual, key) => - isEqual && dependencies.lodash.isEqual(newData[key], oldData[key]) ? isEqual : false, true); -}; - -const prepareSearchIndexProfile = (oldProfiles = [], newProfiles = [], oldColumns = []) => { - return Object.entries(SEARCH_INDEX_PROFILES_DATA_FOR_PREPARE).reduce((oldProfiles, [profile, profileData]) => { - if (!newProfiles.includes(profile) || oldProfiles.includes(profile)) { - return oldProfiles; - } - - const profileIsNotExist = Object.entries(profileData).reduce((profileValue, [key, keyValues]) => { - if (profileValue) { - return profileValue; - } - const keysOldColumns = oldColumns.map(column => column[key]).filter(Boolean); - return keyValues.some(value => keysOldColumns.includes(value)); - }, false); - - return profileIsNotExist ? oldProfiles: [...oldProfiles, profile]; - }, oldProfiles); -}; - -module.exports = { - getDiffOptions: getDiffOptions(SEARCH_INDEX_OPTIONS_DEFAULT), - getDiffConfig: getDiff(SEARCH_INDEX_CONFIG_DEFAULT), - getDiffIndexProfiles: getDiff({}), - isEqualIndex: isEqualIndex(INDEX_CONFIG_DEFAULT, [...REDUNDANT_OPTIONS, ...REDUNDANT_PROPERTIES_FOR_INDEX]), - prepareSearchIndexProfile, - REDUNDANT_OPTIONS, -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/keySpaceHelper.js b/forward_engineering/helpers/updateHelpers/keySpaceHelper.js deleted file mode 100644 index 2b149b3d..00000000 --- a/forward_engineering/helpers/updateHelpers/keySpaceHelper.js +++ /dev/null @@ -1,184 +0,0 @@ -const { dependencies } = require('../appDependencies'); -const { getReplication, getDurableWrites } = require('../keyspaceHelper'); -const { retrivePropertyFromConfig } = require('../generalHelper'); -const { AlterScriptDto } = require("../types/AlterScriptDto"); - -const getDropUDFScript = udfData => udfData.name ? `DROP FUNCTION IF EXISTS ${udfData.name};` : ''; -const getDropUDAScript = udfData => udfData.name ? `DROP AGGREGATE IF EXISTS ${udfData.name};` : ''; - -const requiredPropsForUDF = ['functionBody']; -const requiredPropsForUDA = ['storedProcFunction']; - -const udfData = { - getDropScript: getDropUDFScript, - requiredProps: requiredPropsForUDF, - parser: 'getUDFName', - functionName: 'functionBody', -}; - -const udaData = { - getDropScript: getDropUDAScript, - requiredProps: requiredPropsForUDA, - parser: 'getUDAName', - functionName: 'storedProcFunction', -}; - -const parser = { - regExpUDFForName: /^.+function(.+?)\(/is, - regExpUDAForName: /^.+aggregate(.+?)\(/is, - getResult(body, reg) { - const result = body.match(reg); - - return result?.[1]?.trim(); - }, - getName(body, regex) { - const result = this.getResult(body, regex); - if (!result) { - return result; - } - return result.replace(/if not exists/i, '').trim(); - }, - getUDFName(body) { - return this.getName(body, this.regExpUDFForName); - }, - getUDAName(body) { - return this.getName(body, this.regExpUDAForName); - }, -} - -const getDataForScript = (newElements, oldElements, requiredProps) => { - let dataForAddScript = []; - let dataForDropScript = []; - - if (!newElements.length && !oldElements.length) { - return { - dataForAddScript, - dataForDropScript - }; - } - - if (!oldElements.length) { - dataForAddScript = newElements; - } else if (!newElements.length) { - dataForDropScript = oldElements; - } else { - const difference = (newElement, oldElement) => requiredProps.every(prop => dependencies.lodash.isEqual(newElement[prop], oldElement[prop])); - - const equalElements = dependencies.lodash.intersectionWith(newElements, oldElements, difference); - dataForAddScript = dependencies.lodash.xorWith(newElements, equalElements, difference); - dataForDropScript = dependencies.lodash.xorWith(oldElements, equalElements, difference); - } - return { - dataForAddScript, - dataForDropScript - }; -} - -const getModifyUDFA = ({ new: newElements = [], old: oldElements = [], udData }) => { - newElements = newElements.map(element => ({ - ...element, - name: parser[udData.parser](element[udData.functionName]) - })); - oldElements = oldElements.map(element => ({ - ...element, - name: parser[udData.parser](element[udData.functionName]) - })); - - const { dataForAddScript, dataForDropScript } = getDataForScript(newElements, oldElements, udData.requiredProps); - - - const addScript = dataForAddScript.filter(ud => Object.entries(ud).every(([key, value]) => - udData['requiredProps'].includes(key) ? !!value : true - )) - .map(ud => AlterScriptDto.getInstance( - [ud[udData.functionName]], - true, - 'add', - 'udf' - ) - ); - - const dropScript = dataForDropScript - .filter(ud => !!ud.name) - .map(ud => AlterScriptDto.getInstance( - [udData.getDropScript(ud)], - true, - 'deletion', - 'udf' - ) - ); - - return [...dropScript, ...addScript]; -} - -const replicationProps = ['replStrategy', 'replFactory', 'dataCenters']; - -const getIsModifyKeysSpace = (keySpaceData, props) => { - return props.some(prop => { - const {new: newElements, old: oldElements} = keySpaceData[prop] || {}; - return newElements && oldElements && !dependencies.lodash.isEqual(newElements, oldElements); - }); -} - -const getKeySpaceScript = ({ child, mode }) => { - const keyspaceData = [child.role]; - const keySpaceName = child.role.code || child.role.name; - const replicationStrategyProp = retrivePropertyFromConfig(keyspaceData, 0, "replStrategy", ""); - const replicationFactorProp = retrivePropertyFromConfig(keyspaceData, 0, "replFactor", undefined); - const dataCentersProp = retrivePropertyFromConfig(keyspaceData, 0, "dataCenters", []); - const durableWritesProp = retrivePropertyFromConfig(keyspaceData, 0, "durableWrites", false); - const compMod = retrivePropertyFromConfig(keyspaceData, 0, 'compMod', {}); - - const replication = getReplication(replicationStrategyProp, replicationFactorProp, dataCentersProp); - const durableWrites = getDurableWrites(durableWritesProp); - - if (mode === 'add') { - const udfData = retrivePropertyFromConfig(keyspaceData, 0, 'UDFs', []); - const udaData = retrivePropertyFromConfig(keyspaceData, 0, 'UDAs', []); - - return [AlterScriptDto.getInstance( - [dependencies.provider.createKeySpace(keySpaceName, replication, durableWrites, udfData, udaData)], - true, - 'add', - 'keySpaces' - ) - ]; - } else if (mode === 'delete') { - - return [AlterScriptDto.getInstance( - [dependencies.provider.dropKeySpace(keySpaceName)], - true, - 'deletion', - 'keySpaces' - ) - ]; - } - const dataForUDFScript = compMod?.UDFs || {}; - const dataForUDAScript = compMod?.UDAs || {}; - const modifyUDFScript = getModifyUDFA({ - ...dataForUDFScript, - udData: udfData, - }); - const modifyUDAScript = getModifyUDFA({ - ...dataForUDAScript, - udData: udaData, - }); - const isModifyReplication = getIsModifyKeysSpace(compMod, replicationProps); - const script = isModifyReplication - ? dependencies.provider.alterKeySpaceReplication(keySpaceName, replication, durableWrites) - : ''; - - return [AlterScriptDto.getInstance( - [script], - true, - 'modify', - 'keySpaces' - ), - ...modifyUDAScript, - ...modifyUDFScript - ]; -} - -module.exports = { - getKeySpaceScript -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/tableHelper.js b/forward_engineering/helpers/updateHelpers/tableHelper.js deleted file mode 100644 index 8d470ea3..00000000 --- a/forward_engineering/helpers/updateHelpers/tableHelper.js +++ /dev/null @@ -1,265 +0,0 @@ -const { getTypeByData } = require("../typeHelper"); -const { getNamesByIds } = require("../schemaHelper"); -const { dependencies } = require('../appDependencies'); -const { eachField, getTableNameStatement } = require('../generalHelper'); -const { getTableStatement } = require('../tableHelper'); -const { AlterScriptDto } = require("../types/AlterScriptDto"); - -let existScripts = { - modifiedColumn: [], - addTable: [], - deleteTable: [], -}; - -/** - * - * @param addData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getAdd = addData => { - if (isScriptExists(addData)) { - return []; - } - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.addEntity(addData)], - true, - 'add', - 'field' - ) - ]; -}; - -/** - * - * @param deleteData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getDelete = deleteData => { - if (isScriptExists(deleteData)) { - return []; - } - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.deleteEntity(deleteData)], - true, - 'deletion', - 'field' - ) - ]; -}; - -/** - * - * @param data {Object} - * @returns {string} - */ -const generateFullName = data => { - const { tableName, keyspaceName, columnData } = data; - const fulTableName = getTableNameStatement(keyspaceName, tableName); - return columnData?.name ? `${fulTableName}.${columnData?.name}` : fulTableName; -}; - -const addScriptToExistScripts = (data = {}, type = 'modifiedColumn') => { - const fullName = generateFullName(data); - existScripts = { - ...existScripts, - [type]: [...(existScripts?.[type] || []), fullName], - } -}; - -const isScriptExists = (data = {}, type = 'modifiedColumn') => { - const fullName = generateFullName(data); - - return (existScripts?.[type] || []).some(scriptName => scriptName === fullName); -}; - -const prepareField = (field, dataSources) => { - const propertiesFromArrayToObj = field => { - if (!field.hasOwnProperty('properties') || !Array.isArray(field.properties)) { - return field; - } - - return { - ...field, - properties: field.properties.reduce((properties, property) => { - return { - ...properties, - [property.name]: propertiesFromArrayToObj(property), - } - }, {}) - }; - - }; - - const fieldAfterTransform = propertiesFromArrayToObj(field); - - return eachField(fieldAfterTransform, (field) => { - if (field?.type !== 'reference' || dependencies.lodash.isEmpty(field.refIdPath)) { - return field; - } - - const preparedField = getNamesByIds([dependencies.lodash.last(field.refIdPath)], dataSources)[dependencies.lodash.last(field.refIdPath)] || {}; - return { - ...field, - ...preparedField, - } - }); -}; - -const hydrateColumn = ({ tableName, keyspaceName, isOldModel, property, udtMap, dataSources }) => { - const { oldField = {}, newField = {} } = property?.compMod || {}; - const preparedOldField = prepareField(oldField, dataSources); - const newType = getTypeByData(property, udtMap, newField.name); - const oldType = getTypeByData(preparedOldField, udtMap, oldField.name); - - return { - property, - isOldModel, - oldName: oldField.name, - newName: newField.name, - newType, - oldType, - isNameChange: oldField.name !== newField.name, - isTypeChange: newType !== oldType, - dataForScript: { - tableName, - keyspaceName, - columnData: { - name: newField.name, - type: newType, - } - } - } -}; - -const getTableParameter = (item, key) => { - const parameter = item?.role?.compMod?.[key]; - - return parameter?.new || item?.role?.[key]; -}; - -const addToKeysHashType = (keysHash, keys) => { - return Object.entries(keysHash).reduce((keysHash, [id, key]) => { - const type = (keys.find(key => key.keyId === id) || {}).type; - - return { - ...keysHash, - [id]: { - ...dependencies.lodash.omit(key, 'type'), - ...(type ? { type } : {}) - } - }; - }, {}); -}; - -const deleteFalseValuesIfNotPresentInOtherColumn = (left, right) => dependencies.lodash.omitBy(left, (value, key) => value === false && !right[key]); - -const areTableKeyColumnsEqual = (column1, column2) => { - const comparedColumn1 = deleteFalseValuesIfNotPresentInOtherColumn(column1, column2); - const comparedColumn2 = deleteFalseValuesIfNotPresentInOtherColumn(column2, column1); - - return dependencies.lodash.isEqual(comparedColumn1, comparedColumn2); -} - -const tableKeysIsEqual = ({ newKeys = [], oldKeys =[], dataSources }) => { - if (newKeys.length !== oldKeys.length) { - return false; - } - const newKeysHash = addToKeysHashType(getNamesByIds(newKeys.map(key => key.keyId), dataSources), newKeys); - const oldKeysHash = addToKeysHashType(getNamesByIds(oldKeys.map(key => key.keyId), dataSources), oldKeys); - const difference = dependencies.lodash.differenceWith(dependencies.lodash.values(newKeysHash), dependencies.lodash.values(oldKeysHash), areTableKeyColumnsEqual); - - return dependencies.lodash.isEmpty(difference); -}; - -const isTableChange = ({ item, dataSources }) => { - const compMod = item?.role?.compMod || {}; - const tableProperties = ['name', 'isActivated']; - const { compositeClusteringKey = {}, compositePartitionKey = {} } = compMod || {}; - const compositeClusteringKeyIsEqual = tableKeysIsEqual({ - newKeys: compositeClusteringKey.new, - oldKeys: compositeClusteringKey.old, - dataSources, - }); - - const compositePartitionKeyIsEqual = tableKeysIsEqual({ - newKeys: compositePartitionKey.new, - oldKeys: compositePartitionKey.old, - dataSources, - }); - - return !compositeClusteringKeyIsEqual || !compositePartitionKeyIsEqual || - tableProperties.some(property => !dependencies.lodash.isEqual(compMod[property]?.new, compMod[property]?.old)); -}; - -/** - * - * @param deleteData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getDeleteTableDto = deleteData => { - if (isScriptExists(deleteData, 'deleteTable')) { - return []; - } - const tableStatement = getTableNameStatement(deleteData.keyspaceName, deleteData.tableName); - addScriptToExistScripts(deleteData, 'deleteTable') - return [ - AlterScriptDto.getInstance( - [dependencies.provider.dropTable(tableStatement)], - true, - 'deletion', - 'table' - ) - ]; -}; - -const getAddTable = (addTableData) => { - if (isScriptExists(addTableData, 'addTable')) { - return []; - } - let table = addTableData.item; - const data = addTableData.data; - const compositePartitionKey = getTableParameter(table, 'compositePartitionKey') || []; - const compositeClusteringKey = getTableParameter(table, 'compositeClusteringKey') || []; - - const entityData = [{ - compositePartitionKey, - compositeClusteringKey, - collectionName: addTableData.tableName, - tableOptions: table.role.tableOptions || '', - comments: table.role.comments || '', - isActivated: table.role.isActivated, - }]; - - const script = getTableStatement({ - tableData: table, - tableMetaData: entityData, - keyspaceMetaData: [{ name: addTableData.keyspaceName }], - dataSources: addTableData.dataSources, - udtTypeMap: data.udtTypeMap || {}, - isKeyspaceActivated: addTableData.isKeyspaceActivated, - }); - addScriptToExistScripts(addTableData, 'addTable'); - return [ - AlterScriptDto.getInstance( - [script], - true, - 'add', - 'table' - ) - ]; -} - -module.exports = { - getDelete, - getAdd, - hydrateColumn, - isTableChange, - getTableParameter, - addScriptToExistScripts, - getDeleteTableDto, - getAddTable, -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/udtHelper.js b/forward_engineering/helpers/updateHelpers/udtHelper.js deleted file mode 100644 index 086e008d..00000000 --- a/forward_engineering/helpers/updateHelpers/udtHelper.js +++ /dev/null @@ -1,296 +0,0 @@ -const { dependencies } = require('../appDependencies'); -const { getColumnDefinition } = require('../columnHelper'); -const { eachField } = require('../generalHelper'); -const { getTypeByData } = require('../typeHelper'); -const { checkIsOldModel, fieldTypeCompatible } = require('./generalHelper'); -const { getDelete } = require('./tableHelper'); -const { AlterScriptDto } = require("../types/AlterScriptDto"); - -const DEFAULT_KEY_SPACE = { 'Default_Keyspace': [] }; - -const scriptData = { - added: false, - deleted: false, - modified: false, - udt: 'udt', -}; - -/** - * - * @param keySpaceName {String} - * @returns {`ALTER TYPE "${string}"`} - */ -const getAlterTypePrefix = keySpaceName => `ALTER TYPE "${keySpaceName}"`; - -/** - * - * @param dropUDTData {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getDropUDT = (dropUDTData) => ([ - AlterScriptDto.getInstance( - [dependencies.provider.dropType({keyspaceName: dropUDTData.keyspaceName, typeName: dropUDTData.typeName})], - true, - 'deletion', - 'udt' - ) -]); - -/** - * - * @param addToUDTData {Object} - * @returns [{(AlterScriptDto|undefined)}] - */ -const getAddToUDT = addToUDTData => { - const { keySpaces, udtName, name, type } = addToUDTData; - - return Object.keys(keySpaces).map(keySpaceName => AlterScriptDto.getInstance( - [dependencies.provider.addPropertyToUdt({keySpaceName, udtName, name, type})], - true, - 'add', - 'udt' - ) - ); -}; - -const getKeySpaces = role => { - const keySpaces = role.compMod?.bucketsWithCurrentDefinition; - return !dependencies.lodash.isEmpty(keySpaces) ? keySpaces : DEFAULT_KEY_SPACE; -}; - -/** - * - * @param item {Object} - * @param udtMap {Object} - * @returns {(AlterScriptDto|undefined)} - */ -const getAddScript = (item, udtMap) => { - const { role = {}, compMod = {}, properties = {} } = item; - const keySpaces = getKeySpaces(role); - - if (compMod.created) { - const columnScript = getColumnDefinition(properties, udtMap); - - return Object.keys(keySpaces).map(currentKeyspace => { - const udtName = role.code || role.name || ''; - - return AlterScriptDto.getInstance( - [dependencies.provider.createUdt({ keySpaceName: currentKeyspace, udtName, columnScript })], - true, - 'add', - 'udt' - ); - }); - } - - return Object.entries(properties) - .reduce((scripts, [name, property]) => ([ - ...scripts, - ...getAddToUDT({ - type: getTypeByData(property, udtMap), - name, - keySpaces, - udtName: role.code || role.name || '', - }) - ]), []) -}; - -const prepareField = (field, property) => { - if (field.type !== 'reference' || field.$ref || !property.$ref) { - return field; - } - - return { - ...field, - $ref: property.$ref, - } -}; - -/** - * - * @param item {Object} - * @param data {Object} - * @param udtMap {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getUpdateScript = (item, data, udtMap) => { - const { role = {}, properties } = item; - if (!properties) { - return []; - } - const keySpaces = getKeySpaces(role); - const udtName = role.code || role.name; - return Object.entries(properties).reduce((script, [propertyName, property]) => { - const itemOldName = dependencies.lodash.get(property, 'compMod.oldField.name'); - const itemNewName = dependencies.lodash.get(property, 'compMod.newField.name'); - const {compMod = {}} = property - - const oldFieldType = getTypeByData(prepareField(compMod.oldField, property), udtMap, 'newField'); - const newFieldType = getTypeByData(prepareField(compMod.newField, property), udtMap, 'oldField'); - - const isOldModel = checkIsOldModel(dependencies.lodash.get(data, 'modelData')); - const newScript = Object.keys(keySpaces).reduce((script, keySpaceName) => { - const changeType = newFieldType && - oldFieldType && - newFieldType !== oldFieldType && - fieldTypeCompatible(oldFieldType, newFieldType) && - isOldModel; - if (changeType) { - const updateTypeScript = dependencies.provider.updateUdtType({ - keySpaceName, - udtName, - columnData: { - name: propertyName, - type: newFieldType - } - }); - script = [ - ...script, - AlterScriptDto.getInstance( - [updateTypeScript], - true, - 'modify', - 'udt' - ) - ]; - } - - if (itemNewName && itemOldName && itemOldName !== itemNewName) { - const renameScript = dependencies.provider.renameType({ - keySpaceName, - oldFieldName: itemOldName, - newFieldName: itemNewName, - udtName, - }); - - script = [ - ...script, - AlterScriptDto.getInstance( - [renameScript], - true, - 'modify', - 'udt' - ) - ]; - } - - return script; - }, []); - return [...script, ...newScript]; - }, []); -}; - -/** - * - * @param item {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getDeleteScript = item => { - const { properties, compMod = {}, role = {} } = item; - - if (!compMod?.deleted || !properties) { - return [scriptData]; - } - const keySpaces = getKeySpaces(role); - const udtName = role.code || role.name || ''; - - return Object.entries(keySpaces) - .reduce((script, [keyspaceName, keySpace]) => { - const newScript = keySpace.reduce((script, table) => { - const dropColumnScript = getDelete({ - tableName: table.collectionName || table.code, - keyspaceName, - columnData: { - name: udtName - } - }); - const dropUdtScript = getDropUDT({ - keyspaceName, - typeName: udtName - }); - return [...script, ...dropColumnScript, ...dropUdtScript]; - }, []); - return [...script, ...newScript]; - }, []); -}; - -/** - * - * @param child {Object} - * @param mode {Object} - * @param data {Object} - * @param udtMap {Object} - * @returns {[(AlterScriptDto|undefined)]} - */ -const getUdtScript = ({ child, mode, data, udtMap }) => { - if (mode === 'add') { - return getAddScript(child, udtMap); - } else if (mode === 'update') { - return getUpdateScript(child, data, udtMap); - } - return getDeleteScript(child); - -}; - -const sortAddedUdt = udt => { - const items = udt.properties.added?.items; - if (!items || !Array.isArray(items)) { - return udt; - } - - let createdUdt = items.filter(item => { - const child = item.properties[Object.keys(item.properties)[0]]; - return child.compMod?.created; - }); - - const otherUdt = dependencies.lodash.xorWith(items, createdUdt, dependencies.lodash.isEqual); - createdUdt = createdUdt.map(item => { - const itemName = Object.keys(item.properties)[0]; - return [ itemName, item ]; - }); - - const createdUdtNames = createdUdt.map(([itemName, __]) => itemName); - const sortedCreatedUdtNames = []; - - createdUdt.forEach(([itemName, item]) => { - const referencesName = new Set(); - const child = item.properties[itemName]; - - eachField(child || {}, (field) => { - if (field.$ref) { - const udtName = field.$ref.split('/').pop(); - referencesName.add(udtName) - } - }); - - const referencesNameInUdt = Array.from(referencesName) - .filter(name => createdUdtNames.includes(name) && !sortedCreatedUdtNames.includes(name)); - - sortedCreatedUdtNames.push(...referencesNameInUdt); - - if (!referencesNameInUdt.length) { - const index = sortedCreatedUdtNames.indexOf(itemName) - - if (index === -1) { - sortedCreatedUdtNames.unshift(itemName); - } else { - sortedCreatedUdtNames.unshift(...sortedCreatedUdtNames.splice(index, 1)); - } - } - }) - - const notSortedUdtNames = createdUdtNames.filter(name => !sortedCreatedUdtNames.includes(name)); - - createdUdt = Object.fromEntries(createdUdt); - createdUdt = [...sortedCreatedUdtNames, ...notSortedUdtNames].map(name => createdUdt[name]).filter(Boolean); - - udt.properties.added.items = [...createdUdt, ...otherUdt]; - - return udt; -}; - -module.exports = { - getUdtScript, - sortAddedUdt, - getAlterTypePrefix, -} \ No newline at end of file diff --git a/forward_engineering/helpers/updateHelpers/viewHelper.js b/forward_engineering/helpers/updateHelpers/viewHelper.js deleted file mode 100644 index eea2d906..00000000 --- a/forward_engineering/helpers/updateHelpers/viewHelper.js +++ /dev/null @@ -1,125 +0,0 @@ -const { getViewScript: generateViewScript } = require('../viewHelper'); -const { dependencies } = require('../appDependencies'); -const { AlterScriptDto } = require("../types/AlterScriptDto"); - -const getViewName = (keyspaceName, nameView) => `${keyspaceName ? `"${keyspaceName}".` : ''}"${nameView}"`; - -const modifyProperties = ['code', 'name']; -const getIsOnlyOptionsModify = compMod => { - const isModifyProperties = modifyProperties.some(property => { - const { new: newProperty, old: oldProperty } = compMod[property] || {}; - return !dependencies.lodash.isEqual(newProperty, oldProperty); - }); - - const { tableOptions = {}, comments = {} } = compMod; - if (comments.old && !comments.new) { - return false; - } - - const deletedTabOptions = Object.entries(tableOptions.old || {}).some(([oldProperty]) => !tableOptions.new?.[oldProperty]); - - return !isModifyProperties && !deletedTabOptions; -} - -const getProperty = (newProperty, oldProperty) => { - if (!oldProperty || !dependencies.lodash.isEqual(newProperty, oldProperty)) { - return newProperty; - } else if (!newProperty) { - return oldProperty; - } -} - -const getDifferentOptions = (tableOptions = {}, comments = {}) => { - const newComments = getProperty(comments.new, comments.old); - const { new: newProperties = {}, old: oldProperties = {} } = tableOptions; - const newTableOptions = Object.entries(newProperties) - .map(([property, value]) => [property, getProperty(value, oldProperties[property])]) - .filter(([__, value]) => value); - return { - comments: newComments, - tableOptions: Object.fromEntries(newTableOptions), - } -} - -const getAddView = child => { - const { compMod, properties = {} } = child.role; - - const convertedProperties = Object.entries(properties).map(([name, property]) => ([property.code || property.name || property.displayName || name, property])); - - const dataForScript = { - containerData: [{ name: compMod.keyspaceName }], - schema: { properties: Object.fromEntries(convertedProperties) }, - viewData: [child.role], - ifNotExist: true, - collectionRefsDefinitionsMap: compMod.collectionData?.collectionRefsDefinitionsMap || {}, - entityData: compMod.collectionData?.entityData || [{}], - } - - return generateViewScript(dataForScript); -} - -const getModifyView = child => { - const compMod = child.role?.compMod || {}; - const isOnlyOptionsModify = getIsOnlyOptionsModify(compMod); - if (!isOnlyOptionsModify) { - const dropViewName = compMod.code?.old || compMod.name?.old; - const dropScript = dependencies.provider.dropView({ ...child, role: { ...child.role, code: dropViewName }}); - const addScript = getAddView(child); - return [ - AlterScriptDto.getInstance( - [dropScript], - true, - 'deletion', - 'view' - ), - AlterScriptDto.getInstance( - [addScript], - true, - 'add', - 'view' - ) - ]; - } - const { comments, tableOptions } = getDifferentOptions(compMod.tableOptions, compMod.comments); - const role = { - ...child.role, - comments, - tableOptions - }; - - return [ - AlterScriptDto.getInstance( - [dependencies.provider.alterView(role)], - true, - 'modify', - 'view' - ) - ]; -} - -const getViewScript = ({ child, mode }) => { - if (mode === 'add') { - return [AlterScriptDto.getInstance( - [getAddView(child)], - true, - 'add', - 'view' - ) - ]; - } else if (mode === 'delete') { - return [ - AlterScriptDto.getInstance( - [dependencies.provider.dropView(child)], - true, - 'deletion', - 'view' - ) - ]; - } - return getModifyView(child); -} - -module.exports = { - getViewScript, - getViewName, -} \ No newline at end of file diff --git a/forward_engineering/helpers/viewHelper.js b/forward_engineering/helpers/viewHelper.js deleted file mode 100644 index 70b8357d..00000000 --- a/forward_engineering/helpers/viewHelper.js +++ /dev/null @@ -1,275 +0,0 @@ -'use strict' - -const { dependencies } = require('./appDependencies'); -const { commentDeactivatedStatement } = require('./commentsHelper'); -const { retrieveContainerName, retrieveEntityName, retrivePropertyFromConfig, retrieveIsItemActivated } = require('./generalHelper'); -const { getOptions, getPrimaryKeyList } = require('./tableHelper'); - -const columnsToName = column => column.name; - -const joinColumns = (columns = [], isParentActivated) => { - let [activatedColumns, deactivatedColumns] = dependencies.lodash.partition(columns, column => dependencies.lodash.get(column, 'isActivated', true)); - deactivatedColumns = deactivatedColumns.map(columnsToName).join(', '); - activatedColumns = activatedColumns.map(columnsToName).join(', '); - const getDeactivatedStatement = columns => commentDeactivatedStatement(columns, false, isParentActivated, 'INLINE'); - if (!deactivatedColumns.length) { - return activatedColumns; - } else if (!activatedColumns.length) { - return getDeactivatedStatement(deactivatedColumns); - } - return activatedColumns + ' ' + getDeactivatedStatement(', ' + deactivatedColumns); -}; - -const getColumn = (collectionRefsDefinitionsMap, id, columns = {}) => { - const itemData = collectionRefsDefinitionsMap[id]; - - return Object.values(columns).find(column => column.GUID === itemData?.definitionId) || {}; -}; - -const getColumnNames = (collectionRefsDefinitionsMap, columns) => { - return dependencies.lodash.uniqBy( - Object.keys(columns).map(name => { - const id = dependencies.lodash.get(columns, [name, 'GUID']); - - const itemDataId = Object.keys(collectionRefsDefinitionsMap).find(viewFieldId => { - const definitionData = collectionRefsDefinitionsMap[viewFieldId]; - - return definitionData.definitionId === id; - }); - const itemData = collectionRefsDefinitionsMap[itemDataId]; - const columnName = `"${dependencies.lodash.get(itemData, 'name', name)}"`; - const isActivated = dependencies.lodash.get(columns[name], 'isActivated'); - - return { name: columnName, isActivated }; - }), 'name' - ).filter(dependencies.lodash.identity); -}; - -const getViewColumns = (collectionRefsDefinitionsMap, properties) => { - return Object.keys(properties).reduce((columns, name) => { - const id = dependencies.lodash.get(properties, [name, 'GUID']); - - const itemDataId = Object.keys(collectionRefsDefinitionsMap).find(viewFieldId => { - const definitionData = collectionRefsDefinitionsMap[viewFieldId]; - - return definitionData.definitionId === id; - }); - const itemData = collectionRefsDefinitionsMap[itemDataId]; - - return { - ...columns, - [dependencies.lodash.get(itemData, 'name', name)]: properties[name], - }; - }, {}); -}; - -const getWhereStatement = (columns = [], isParentActivated) => { - const [activatedColumns, deactivatedColumns] = dependencies.lodash.partition(columns, column => dependencies.lodash.get(column, 'isActivated', true)) - if (dependencies.lodash.isEmpty(columns) || deactivatedColumns.length === columns.length) { - return ''; - } - - const generateNewStatement = name => `AND ${name} IS NOT NULL`; - const deactivatedColumnsScript = deactivatedColumns.map(column => generateNewStatement(column.name)).join(' '); - const commentDeactivatedColumnsScript = commentDeactivatedStatement(deactivatedColumnsScript, false, isParentActivated, 'INLINE'); - const activatedColumnsScript = [...activatedColumns] - .reduce((statement, column) => { - if (!statement) { - return `${column.name} IS NOT NULL`; - } - - return `${statement} ${generateNewStatement(column.name)}`; - }, ''); - - return `WHERE ${activatedColumnsScript}${deactivatedColumnsScript ? ' ' + commentDeactivatedColumnsScript : ''}`; -}; - -const getNamesByIds = (collectionRefsDefinitionsMap, ids, columns = {}) => { - return ids.reduce((hash, id) => { - const name = dependencies.lodash.get(collectionRefsDefinitionsMap, [id, 'name']); - const column = getColumn(collectionRefsDefinitionsMap, id, columns); - const isActivated = column.isActivated; - if (!name) { - return hash; - } - return Object.assign({}, hash, { - [id]: { name: name, isActivated } - }); - }, {}); -}; - -const getClusteringKeyData = (collectionRefsDefinitionsMap, viewData, columns) => { - const clusteringKeys = retrivePropertyFromConfig(viewData, 0, 'compositeClusteringKey', []); - - const clusteringKeysHash = getNamesByIds( - collectionRefsDefinitionsMap, - clusteringKeys.map(key => key.keyId), - columns - ); - - return { clusteringKeys, clusteringKeysHash }; -}; - -const getPrimaryKeys = (collectionRefsDefinitionsMap, viewData, columns) => { - return [ - ...getCompositeKeys({ collectionRefsDefinitionsMap, viewData, key: 'compositePartitionKey', columns }), - ...getCompositeKeys({ collectionRefsDefinitionsMap, viewData, key: 'compositeClusteringKey', columns }), - ]; -}; - -const getCompositeKeys = ({ collectionRefsDefinitionsMap, viewData, key, columns }) => { - const partitionKeys = retrivePropertyFromConfig(viewData, 0, key, []); - const partitionKeysHash = getNamesByIds( - collectionRefsDefinitionsMap, - partitionKeys.map(key => key.keyId), - columns - ); - - return dependencies.lodash.values(partitionKeysHash).filter(dependencies.lodash.identity).map(field => ({ ...field, name: `"${field.name}"` })); -}; - -const getPrimaryKeyScript = ({ collectionRefsDefinitionsMap, viewData, isParentActivated, columns }) => { - const partitionKeys = retrivePropertyFromConfig(viewData, 0, 'compositePartitionKey', []); - const partitionKeysHash = getNamesByIds( - collectionRefsDefinitionsMap, - partitionKeys.map(key => key.keyId), - columns - ); - const clusteringKeyData = getClusteringKeyData(collectionRefsDefinitionsMap, viewData, columns); - - const keysList = getPrimaryKeyList(partitionKeysHash, clusteringKeyData.clusteringKeysHash, isParentActivated); - if (!keysList) { - return ''; - } - - return `PRIMARY KEY (${keysList})`; -}; - -const addTab = script => dependencies.lodash.trim(script || '').replace(/ /g, ' '); - -const getOptionsScript = ({ collectionRefsDefinitionsMap, viewData, columns, isParentActivated }) => { - const clusteringKeyData = getClusteringKeyData(collectionRefsDefinitionsMap, viewData, columns); - const tableComment = retrivePropertyFromConfig(viewData, 0, 'comments', ''); - const tableOptions = retrivePropertyFromConfig(viewData, 0, 'tableOptions', ''); - - return addTab(getOptions( - clusteringKeyData.clusteringKeys, - clusteringKeyData.clusteringKeysHash, - '', - tableOptions, - tableComment, - isParentActivated - )); -}; - -const getEmptyViewScript = ({ - viewData, - entitySchema, - entityData, - entityName, - isParentActivated, - collectionRefsDefinitionsMap, - columns -}) => { - let script = []; - - const entityColumns = entitySchema?.properties || {}; - const entityFieldsMap = Object.keys(entityColumns).reduce(( fieldsMap, key ) => { - const field = entitySchema.properties[key]; - - return { - ...fieldsMap, - [field.GUID]: field, - }; - }, {}); - const primaryKeyScript = getPrimaryKeyScript({ entityFieldsMap, entityData, isParentActivated, columns }); - const optionsScript = getOptionsScript({ - collectionRefsDefinitionsMap: {}, - viewData, - columns, - isParentActivated - }); - - script.push(`AS SELECT * FROM ${entityName}`); - script.push(getWhereStatement(getPrimaryKeys(collectionRefsDefinitionsMap, entityData, columns), isParentActivated)); - - if (primaryKeyScript) { - script.push(primaryKeyScript); - } - - if (optionsScript) { - script.push(optionsScript); - } - - return script; -}; - -module.exports = { - getOptionsScript, - getViewScript({ - schema, - entitySchema, - viewData, - entityData, - containerData, - collectionRefsDefinitionsMap, - isKeyspaceActivated = true, - ifNotExist = false - }) { - let script = []; - const columns = getViewColumns(collectionRefsDefinitionsMap, schema.properties || {}); - const view = dependencies.lodash.first(viewData) || {}; - - const entityName = retrieveEntityName(entityData); - const bucketName = retrieveContainerName(containerData); - const tableName = bucketName ? `"${bucketName}"."${entityName}"` : `"${entityName}"`; - const viewName = view.code || view.name; - const name = bucketName ? `"${bucketName}"."${viewName}"` : `"${viewName}"`; - - const isViewActivated = retrieveIsItemActivated(entityData) && retrieveIsItemActivated(viewData); - const isParentActivated = isKeyspaceActivated && isViewActivated; - - const primaryKeyScript = getPrimaryKeyScript({ collectionRefsDefinitionsMap, viewData, isParentActivated, columns }); - const optionsScript = getOptionsScript({ collectionRefsDefinitionsMap, viewData, columns, isParentActivated }); - script.push(`CREATE MATERIALIZED VIEW ${ifNotExist? `IF NOT EXISTS `:``}${name}`); - - if (dependencies.lodash.isEmpty(columns)) { - script = script.concat(getEmptyViewScript({ - viewData, - entitySchema, - entityData, - entityName: tableName, - isParentActivated, - collectionRefsDefinitionsMap, - columns - })); - } else { - const columnsData = getColumnNames(collectionRefsDefinitionsMap, columns); - const joinedColumns = joinColumns(columnsData, isParentActivated); - script.push(`AS SELECT ${joinedColumns}`); - script.push(`FROM ${tableName}`); - script.push( - getWhereStatement( - dependencies.lodash.uniq([ - ...getPrimaryKeys(collectionRefsDefinitionsMap, viewData, columns), - ...getCompositeKeys({ collectionRefsDefinitionsMap, viewData, key: 'whereClause', columns }) - ]), - isParentActivated - ) - ); - if (primaryKeyScript) { - script.push(primaryKeyScript); - } - - if (optionsScript) { - script.push(optionsScript); - } - } - - return commentDeactivatedStatement( - script.join('\n ') + ';', - isViewActivated, - isKeyspaceActivated - ); - } -}; \ No newline at end of file diff --git a/forward_engineering/package-lock.json b/forward_engineering/package-lock.json deleted file mode 100644 index 252d542b..00000000 --- a/forward_engineering/package-lock.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "name": "Datastax", - "version": "1.0.0", - "lockfileVersion": 1, - "requires": true, - "dependencies": { - } -} diff --git a/forward_engineering/package.json b/forward_engineering/package.json deleted file mode 100644 index a156c14f..00000000 --- a/forward_engineering/package.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "name": "Datastax", - "version": "1.0.0", - "description": "", - "author": "Hackolade", - "dependencies": { - }, - "installed": true -} diff --git a/jsonSchemaProperties.json b/jsonSchemaProperties.json index 56f64f34..a960fb08 100644 --- a/jsonSchemaProperties.json +++ b/jsonSchemaProperties.json @@ -10,8 +10,5 @@ "compositePartitionKey", "compositeKey" ], - "removeIfPropsNegative": [ - "partitionKey", - "sortKey" - ] -} \ No newline at end of file + "removeIfPropsNegative": ["partitionKey", "sortKey"] +} diff --git a/package.json b/package.json index f2137e33..ff7cbb0b 100644 --- a/package.json +++ b/package.json @@ -1,43 +1,84 @@ { - "name": "Cassandra", - "version": "0.1.133", - "versionDate": "2024-05-03", - "author": "hackolade", - "engines": { - "hackolade": "5.4.7", - "hackoladePlugin": "1.2.0" - }, - "contributes": { - "target": { - "applicationTarget": "CASSANDRA", - "title": "Cassandra Datastax", - "versions": [ - "2.x", - "3.x", - "4.x", - "5.x", - "DSE 4.x", - "DSE 5.x", - "DSE 6.x", - "Astra DB" - ] - }, - "features": { - "views": true, - "nestedCollections": false, - "disablePatternField": true, - "enableForwardEngineering": true, - "disableMultipleTypes": true, - "enableReverseEngineering": true, - "disableChoices": true, - "enableJsonType": true, - "FEScriptCommentsSupported": true, - "relationships": { - "compositeRelationships": { - "allowRelationshipsForNonPrimaryKey": true - } - } - } - }, - "description": "Hackolade plugin for Cassandra Datastax" -} + "name": "Cassandra", + "version": "0.2.1", + "author": "hackolade", + "engines": { + "hackolade": "5.4.7", + "hackoladePlugin": "1.2.0" + }, + "contributes": { + "target": { + "applicationTarget": "CASSANDRA", + "title": "Cassandra Datastax", + "versions": [ + "2.x", + "3.x", + "4.x", + "5.x", + "DSE 4.x", + "DSE 5.x", + "DSE 6.x", + "Astra DB" + ] + }, + "features": { + "views": true, + "nestedCollections": false, + "disablePatternField": true, + "enableForwardEngineering": true, + "disableMultipleTypes": true, + "enableReverseEngineering": true, + "disableChoices": true, + "enableJsonType": true, + "FEScriptCommentsSupported": true, + "relationships": { + "compositeRelationships": { + "allowRelationshipsForNonPrimaryKey": true + } + } + } + }, + "description": "Hackolade plugin for Cassandra Datastax", + "dependencies": { + "antlr4": "4.8.0", + "cassandra-driver": "4.7.2", + "fast-xml-parser": "4.4.0", + "jks-js": "1.1.3", + "lodash": "4.17.21", + "tunnel-ssh": "github:hackolade/tunnel-ssh" + }, + "lint-staged": { + "*.{js,json}": "prettier --write" + }, + "simple-git-hooks": { + "pre-commit": "npx lint-staged", + "pre-push": "npx eslint ." + }, + "scripts": { + "lint": "eslint . --max-warnings=0", + "package": "node esbuild.package.js" + }, + "devDependencies": { + "@hackolade/hck-esbuild-plugins-pack": "0.0.1", + "@typescript-eslint/eslint-plugin": "7.11.0", + "@typescript-eslint/parser": "7.11.0", + "esbuild": "0.20.2", + "esbuild-plugin-clean": "1.0.1", + "eslint": "8.57.0", + "eslint-config-prettier": "9.1.0", + "eslint-formatter-teamcity": "^1.0.0", + "eslint-plugin-import": "^2.26.0", + "eslint-plugin-prettier": "5.1.3", + "eslint-plugin-unused-imports": "3.2.0", + "lint-staged": "14.0.1", + "prettier": "3.2.5", + "simple-git-hooks": "2.11.1" + }, + "overrides": { + "tunnel-ssh": { + "cpu-features": "npm:-@0.0.1", + "ssh2": "npm:-@0.0.1" + } + }, + "release": true +} \ No newline at end of file diff --git a/polyglot/adapter.json b/polyglot/adapter.json index 4f73b0e3..ed5c87a5 100644 --- a/polyglot/adapter.json +++ b/polyglot/adapter.json @@ -2,10 +2,10 @@ * Copyright © 2016-2018 by IntegrIT S.A. dba Hackolade. All rights reserved. * * The copyright to the computer software herein is the property of IntegrIT S.A. - * The software may be used and/or copied only with the written permission of - * IntegrIT S.A. or in accordance with the terms and conditions stipulated in - * the agreement/contract under which the software has been supplied. - * + * The software may be used and/or copied only with the written permission of + * IntegrIT S.A. or in accordance with the terms and conditions stipulated in + * the agreement/contract under which the software has been supplied. + * * { * "add": { * "entity": [], diff --git a/properties_pane/container_level/containerLevelConfig.json b/properties_pane/container_level/containerLevelConfig.json index db7fa933..d43b7088 100644 --- a/properties_pane/container_level/containerLevelConfig.json +++ b/properties_pane/container_level/containerLevelConfig.json @@ -146,10 +146,7 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyTooltip": "Select from list of options", "propertyType": "select", - "options": [ - "SimpleStrategy", - "NetworkTopologyStrategy" - ] + "options": ["SimpleStrategy", "NetworkTopologyStrategy"] }, { "propertyName": "Replication Factor", @@ -216,104 +213,108 @@ making sure that you maintain a proper JSON format. }, { "lowerTab": "UDFs", - "structure": [{ - "propertyName": "UDFs", - "propertyType": "group", - "propertyKeyword": "UDFs", - "shouldValidate": false, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "Name", - "propertyKeyword": "name", - "shouldValidate": false, - "propertyTooltip": "", - "propertyType": "text" - }, - { - "propertyName": "Id", - "propertyKeyword": "UDFID", - "shouldValidate": false, - "propertyTooltip": "UDF unique ID", - "propertyType": "text" - }, - { - "propertyName": "Description", - "propertyKeyword": "functionDescription", - "shouldValidate": false, - "propertyTooltip": "description", - "propertyType": "details", - "template": "textarea" - }, - { - "propertyName": "Function", - "propertyKeyword": "functionBody", - "shouldValidate": false, - "propertyTooltip": "description", - "propertyType": "details", - "template": "textarea", - "markdown": false - }, - { - "propertyName": "Comments", - "propertyKeyword": "functionComments", - "shouldValidate": false, - "propertyTooltip": "comments", - "propertyType": "details", - "template": "textarea" - } - ] - }] + "structure": [ + { + "propertyName": "UDFs", + "propertyType": "group", + "propertyKeyword": "UDFs", + "shouldValidate": false, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "shouldValidate": false, + "propertyTooltip": "", + "propertyType": "text" + }, + { + "propertyName": "Id", + "propertyKeyword": "UDFID", + "shouldValidate": false, + "propertyTooltip": "UDF unique ID", + "propertyType": "text" + }, + { + "propertyName": "Description", + "propertyKeyword": "functionDescription", + "shouldValidate": false, + "propertyTooltip": "description", + "propertyType": "details", + "template": "textarea" + }, + { + "propertyName": "Function", + "propertyKeyword": "functionBody", + "shouldValidate": false, + "propertyTooltip": "description", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "Comments", + "propertyKeyword": "functionComments", + "shouldValidate": false, + "propertyTooltip": "comments", + "propertyType": "details", + "template": "textarea" + } + ] + } + ] }, { "lowerTab": "UDAs", - "structure": [{ - "propertyName": "UDAs", - "propertyType": "group", - "propertyKeyword": "UDAs", - "shouldValidate": false, - "propertyTooltip": "", - "structure": [ - { - "propertyName": "Name", - "propertyKeyword": "name", - "shouldValidate": false, - "propertyTooltip": "", - "propertyType": "text" - }, - { - "propertyName": "Id", - "propertyKeyword": "UDAID", - "shouldValidate": false, - "propertyTooltip": "UDA unique ID", - "propertyType": "text" - }, - { - "propertyName": "Description", - "propertyKeyword": "storedProcDescription", - "shouldValidate": false, - "propertyTooltip": "description", - "propertyType": "details", - "template": "textarea" - }, - { - "propertyName": "Function", - "propertyKeyword": "storedProcFunction", - "shouldValidate": false, - "propertyTooltip": "description", - "propertyType": "details", - "template": "textarea", - "markdown": false - }, - { - "propertyName": "Comments", - "propertyKeyword": "storedProcComments", - "shouldValidate": false, - "propertyTooltip": "comments", - "propertyType": "details", - "template": "textarea" - } - ] - }] + "structure": [ + { + "propertyName": "UDAs", + "propertyType": "group", + "propertyKeyword": "UDAs", + "shouldValidate": false, + "propertyTooltip": "", + "structure": [ + { + "propertyName": "Name", + "propertyKeyword": "name", + "shouldValidate": false, + "propertyTooltip": "", + "propertyType": "text" + }, + { + "propertyName": "Id", + "propertyKeyword": "UDAID", + "shouldValidate": false, + "propertyTooltip": "UDA unique ID", + "propertyType": "text" + }, + { + "propertyName": "Description", + "propertyKeyword": "storedProcDescription", + "shouldValidate": false, + "propertyTooltip": "description", + "propertyType": "details", + "template": "textarea" + }, + { + "propertyName": "Function", + "propertyKeyword": "storedProcFunction", + "shouldValidate": false, + "propertyTooltip": "description", + "propertyType": "details", + "template": "textarea", + "markdown": false + }, + { + "propertyName": "Comments", + "propertyKeyword": "storedProcComments", + "shouldValidate": false, + "propertyTooltip": "comments", + "propertyType": "details", + "template": "textarea" + } + ] + } + ] } ] diff --git a/properties_pane/defaultData.json b/properties_pane/defaultData.json index b5f97959..c5df4435 100644 --- a/properties_pane/defaultData.json +++ b/properties_pane/defaultData.json @@ -74,4 +74,4 @@ "SecIndxFunction": "", "SecIndxComments": "" } -} \ No newline at end of file +} diff --git a/properties_pane/entity_level/entityLevelConfig.json b/properties_pane/entity_level/entityLevelConfig.json index c64a9097..e052fe8f 100644 --- a/properties_pane/entity_level/entityLevelConfig.json +++ b/properties_pane/entity_level/entityLevelConfig.json @@ -129,7 +129,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "compositePartitionKey", "propertyType": "primaryKeySetter", "abbr": "pk,PK" - }, + }, { "propertyName": "Clustering key", "propertyKeyword": "compositeClusteringKey", @@ -346,13 +346,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "SecIndxKey", "propertyType": "fieldList", "template": "orderedList", - "attributeList": [ - "", - "keys", - "values", - "entries", - "full" - ], + "attributeList": ["", "keys", "values", "entries", "full"], "templateOptions": { "maxFields": 1 } @@ -369,7 +363,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "isSASI", "defaultValue": false, "propertyType": "checkbox", - "dependency":{ + "dependency": { "key": "indexType", "value": "custom" } @@ -380,17 +374,18 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "customOptions", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "indexType", "value": "custom" }, - + { "type": "not", "values": { "key": "isSASI", - "value": true } + "value": true + } } ] }, @@ -419,12 +414,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "similarity_function", "propertyType": "select", "propertyTooltip": "Vector search relies on computing the similarity or distance between vectors to identify relevant matches. The similarity function is used to compute the similarity between two vectors.", - "options": [ - "", - "EUCLIDEAN", - "DOT_PRODUCT", - "COSINE" - ], + "options": ["", "EUCLIDEAN", "DOT_PRODUCT", "COSINE"], "dependency": { "type": "not", "values": [ @@ -459,7 +449,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "customOptions", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "indexType", "value": "custom" @@ -587,7 +577,7 @@ making sure that you maintain a proper JSON format. "propertyName": "Search Index", "propertyKeyword": "searchIndexDivider", "propertyType": "empty", - "dependency":{ + "dependency": { "type": "not", "values": { "level": "model", @@ -600,7 +590,7 @@ making sure that you maintain a proper JSON format. "propertyName": "Enable", "propertyType": "checkbox", "propertyKeyword": "searchIndex", - "dependency":{ + "dependency": { "type": "not", "values": { "level": "model", @@ -617,7 +607,7 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "searchIndex", "value": true @@ -682,7 +672,7 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "searchIndex", "value": true @@ -697,11 +687,7 @@ making sure that you maintain a proper JSON format. } ] }, - "options": [ - "spaceSavingNoJoin", - "spaceSavingNoTextfield", - "spaceSavingSlowTriePrecision" - ] + "options": ["spaceSavingNoJoin", "spaceSavingNoTextfield", "spaceSavingSlowTriePrecision"] }, { "propertyName": "If not exists", @@ -711,7 +697,7 @@ making sure that you maintain a proper JSON format. "propertyType": "checkbox", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "searchIndex", "value": true @@ -734,7 +720,7 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "searchIndex", "value": true @@ -769,11 +755,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "directoryFactory", "propertyType": "select", "propertyTooltip": "Can be used as an alternative to the directoryFactoryClass option", - "options": [ - "", - "standard", - "encrypted" - ] + "options": ["", "standard", "encrypted"] }, { "propertyName": "filterCacheLowWaterMark", @@ -835,7 +817,7 @@ making sure that you maintain a proper JSON format. "propertyTooltip": "", "dependency": { "type": "and", - "values":[ + "values": [ { "key": "searchIndex", "value": true diff --git a/properties_pane/field_level/fieldLevelConfig.json b/properties_pane/field_level/fieldLevelConfig.json index c0fe1850..05a80e35 100644 --- a/properties_pane/field_level/fieldLevelConfig.json +++ b/properties_pane/field_level/fieldLevelConfig.json @@ -128,12 +128,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "mode", "shouldValidate": false, "propertyType": "select", - "options": [ - "text", - "varchar", - "ascii", - "inet" - ], + "options": ["text", "varchar", "ascii", "inet"], "data": "options", "valueType": "string", "cleanDependency": true, @@ -166,10 +161,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -189,10 +186,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -204,10 +203,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -332,10 +333,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -355,10 +358,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -370,10 +375,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -411,10 +418,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -434,10 +443,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -449,10 +460,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -504,10 +517,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -527,10 +542,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -542,10 +559,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -571,10 +590,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -594,10 +615,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -609,10 +632,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -639,10 +664,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -662,10 +689,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -677,10 +706,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -710,10 +741,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -733,10 +766,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -748,10 +783,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -781,10 +818,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -804,10 +843,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -819,10 +860,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -852,10 +895,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -875,10 +920,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -890,10 +937,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -922,10 +971,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -945,10 +996,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -960,10 +1013,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -1020,10 +1075,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1043,10 +1100,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1058,10 +1117,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, "minItems", "maxItems", @@ -1110,10 +1171,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1133,10 +1196,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1148,10 +1213,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, "minItems", "maxItems", @@ -1193,12 +1260,7 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "select", "typeable": true, - "options": [ - "text", - "varchar", - "ascii", - "inet" - ], + "options": ["text", "varchar", "ascii", "inet"], "dependency": { "key": "keyType", "value": "char" @@ -1227,7 +1289,6 @@ making sure that you maintain a proper JSON format. } }, { - "propertyName": "Value type", "propertyKeyword": "subtype", "shouldValidate": false, @@ -1260,10 +1321,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1283,10 +1346,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1298,10 +1363,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, "minProperties", "maxProperties", @@ -1323,10 +1390,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1346,10 +1415,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1361,10 +1432,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, "minItems", "maxItems", @@ -1400,9 +1473,7 @@ making sure that you maintain a proper JSON format. } }, "typeable": true, - "options": [ - "float" - ] + "options": ["float"] }, { "propertyName": "Dimension", @@ -1496,10 +1567,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1519,10 +1592,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1534,10 +1609,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, "foreignCollection", "foreignField", @@ -1561,10 +1638,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1584,10 +1663,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1599,10 +1680,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -1626,7 +1709,7 @@ making sure that you maintain a proper JSON format. "regex": "^[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}$" }, "comments" - ], + ], "timeuuid": [ "name", "code", @@ -1642,10 +1725,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1665,10 +1750,12 @@ making sure that you maintain a proper JSON format. "key": "compositeClusteringKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositeClusteringKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositeClusteringKey", + "value": true + } + ] }, { "propertyName": "Partition key", @@ -1680,10 +1767,12 @@ making sure that you maintain a proper JSON format. "key": "compositePartitionKey", "value": true }, - "disabledOnCondition": [{ - "key": "compositePartitionKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "compositePartitionKey", + "value": true + } + ] }, { "propertyName": "Static", @@ -1716,10 +1805,12 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyType": "checkbox", "valueType": "boolean", - "disabledOnCondition": [{ - "key": "primaryKey", - "value": true - }] + "disabledOnCondition": [ + { + "key": "primaryKey", + "value": true + } + ] }, { "propertyName": "Primary key", @@ -1742,4 +1833,4 @@ making sure that you maintain a proper JSON format. "comments" ] } -} +} diff --git a/properties_pane/model_level/modelLevelConfig.json b/properties_pane/model_level/modelLevelConfig.json index ec6a4b11..3192ec87 100644 --- a/properties_pane/model_level/modelLevelConfig.json +++ b/properties_pane/model_level/modelLevelConfig.json @@ -124,10 +124,7 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyTooltip": "DB vendor", "propertyType": "select", - "options": [ - "Cassandra", - "Datastax" - ], + "options": ["Cassandra", "Datastax"], "disabledOption": false }, { @@ -136,16 +133,7 @@ making sure that you maintain a proper JSON format. "shouldValidate": false, "propertyTooltip": "DB version", "propertyType": "select", - "options": [ - "2.x", - "3.x", - "4.x", - "5.x", - "DSE 4.x", - "DSE 5.x", - "DSE 6.x", - "Astra DB" - ], + "options": ["2.x", "3.x", "4.x", "5.x", "DSE 4.x", "DSE 5.x", "DSE 6.x", "Astra DB"], "disabledOption": false }, { diff --git a/properties_pane/view_level/viewLevelConfig.json b/properties_pane/view_level/viewLevelConfig.json index 6a17b58a..5a7e611a 100644 --- a/properties_pane/view_level/viewLevelConfig.json +++ b/properties_pane/view_level/viewLevelConfig.json @@ -127,7 +127,7 @@ making sure that you maintain a proper JSON format. "propertyKeyword": "compositePartitionKey", "propertyType": "primaryKeySetter", "abbr": "pk,PK" - }, + }, { "propertyName": "Clustering key", "propertyKeyword": "compositeClusteringKey", @@ -294,4 +294,4 @@ making sure that you maintain a proper JSON format. } ] } -] \ No newline at end of file +] diff --git a/reverse_engineering/antlrErrorListener.js b/reverse_engineering/antlrErrorListener.js deleted file mode 100644 index 03114118..00000000 --- a/reverse_engineering/antlrErrorListener.js +++ /dev/null @@ -1,9 +0,0 @@ -const antlr4 = require('antlr4'); - -class ExprErrorListener extends antlr4.error.ErrorListener { - syntaxError(recognizer, offendingSymbol, line, column, msg, err) { - throw new Error(`line ${line}:${column} ${msg}`); - } -} - -module.exports = ExprErrorListener; diff --git a/reverse_engineering/api.js b/reverse_engineering/api.js index ba41c4de..b7bbd1a5 100644 --- a/reverse_engineering/api.js +++ b/reverse_engineering/api.js @@ -1,257 +1,609 @@ -'use strict'; - -const cassandraHelper = require('./cassandraHelper'); -const systemKeyspaces = require('./package').systemKeyspaces; -const logHelper = require('./logHelper'); -const commandsService = require('./commandsService'); -const fs = require('fs'); -const antlr4 = require('antlr4'); -const CqlLexer = require('./parser/CqlLexer.js'); -const CqlParser = require('./parser/CqlParser.js'); -const cqlToCollectionsVisitor = require('./cqlToCollectionsVisitor.js'); -const ExprErrorListener = require('./antlrErrorListener'); - - -const handleFileData = filePath => { - return new Promise((resolve, reject) => { - - fs.readFile(filePath, 'utf-8', (err, content) => { - if(err) { - reject(err); - } else { - resolve(content); - } - }); - }); -}; - -module.exports = { - connect: function(connectionInfo, logger, cb, app){ - cassandraHelper(app.require('lodash')).connect(app, logger)(connectionInfo) - .then(cb, (error) => { - logger.log('error', error, 'Connection error'); - cb(error); - }); - }, - - reFromFile: async (data, logger, callback) => { - try { - const input = await handleFileData(data.filePath); - const chars = new antlr4.InputStream(input); - const lexer = new CqlLexer.CqlLexer(chars); - - const tokens = new antlr4.CommonTokenStream(lexer); - const parser = new CqlParser.CqlParser(tokens); - parser.removeErrorListeners(); - parser.addErrorListener(new ExprErrorListener()); - - const tree = parser.root(); - const cqlsTree = tree.cqls(); - const cqlToCollectionsGenerator = new cqlToCollectionsVisitor(); - - const result = commandsService.convertCommandsToReDocs(cqlsTree.accept(cqlToCollectionsGenerator)); - callback(null, result, {}, [], 'multipleSchema'); - } catch(err) { - const { error, title, name } = err; - const handledError = handleErrorObject(error || err, title || name); - logger.log('error', handledError, title); - callback(handledError); - } - }, - - disconnect: function(connectionInfo, cb, app){ - cassandraHelper(app.require('lodash')).close(); - cb(); - }, - - testConnection: function(connectionInfo, logger, cb, app){ - logInfo('Test connection', connectionInfo, logger); - - this.connect(connectionInfo, logger, (error) => { - if (error) { - logger.log('info', 'Connection failed', 'Test connection'); - } else { - logger.log('info', 'Connection successful', 'Test connection'); - } - - this.disconnect(connectionInfo, () => {}, app); - - return cb(cassandraHelper(app.require('lodash')).prepareError(error)); - }, app); - }, - - getDbCollectionsNames: function(connectionInfo, logger, cb, app) { - const async = app.require('async'); - - logInfo('Retrieving keyspaces and tables information', connectionInfo, logger); - const { includeSystemCollection } = connectionInfo; - const cassandra = cassandraHelper(app.require('lodash')); - - cassandra.connect(app, logger)(connectionInfo).then(() => { - let keyspaces = cassandra.getKeyspacesNames(); - - if (!includeSystemCollection) { - keyspaces = cassandra.filterKeyspaces(keyspaces, systemKeyspaces); - } - - async.map(keyspaces, (keyspace, next) => { - cassandra.getTablesNames(keyspace) - .then(tablesData => { - const table_name_selector = cassandra.isOldVersion() ? 'columnfamily_name' : 'table_name'; - const tableNames = tablesData.rows.map(table => table[table_name_selector]); - - return tableNames; - }) - .then(tableNames => { - return cassandra.getViewsNames(keyspace).then( - views => next(null, cassandra.prepareConnectionDataItem(keyspace, tableNames, views)), - () => next(null, cassandra.prepareConnectionDataItem(keyspace, tableNames, [])) - ) - }) - .catch(next); - }, (err, result) => { - return cb(err, result); - }); - }).catch((error) => { - logger.log('error', error, 'Retrieving keyspaces and tables information'); - return cb(cassandra.prepareError(error) || 'error'); - }); - }, - - getDbCollectionsData: function(data, logger, cb, app){ - const async = app.require('async'); - const cassandra = cassandraHelper(app.require('lodash')); - logger.log('info', data, 'Retrieving schema', data.hiddenKeys); - - const tables = data.collectionData.collections; - const keyspacesNames = data.collectionData.dataBaseNames; - const includeEmptyCollection = data.includeEmptyCollection; - const recordSamplingSettings = data.recordSamplingSettings; +"use strict";var a9=Object.defineProperty;var wH=(u,e,t)=>e in u?a9(u,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):u[e]=t;var c=(u,e)=>a9(u,"name",{value:e,configurable:!0});var w=(u,e)=>()=>(e||u((e={exports:{}}).exports,e),e.exports);var Zu=(u,e,t)=>(wH(u,typeof e!="symbol"?e+"":e,t),t);var ce=w(Jr=>{"use strict";var Lr=require("util");function yt(u){Error.call(this,u),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.info="Cassandra Driver Error",this.message=u}c(yt,"DriverError");Lr.inherits(yt,Error);function o9(u,e){if(yt.call(this,e),this.innerErrors=u,this.info="Represents an error when a query cannot be performed because no host is available or could be reached by the driver.",!e&&(this.message="All host(s) tried for query failed.",u)){let t=Object.keys(u);if(t.length>0){let r=t[0];this.message+=Lr.format(" First host tried, %s: %s. See innerErrors.",r,u[r])}}}c(o9,"NoHostAvailableError");Lr.inherits(o9,yt);function c9(u,e){yt.call(this,e),this.code=u,this.info="Represents an error message from the server"}c(c9,"ResponseError");Lr.inherits(c9,yt);function l9(u){yt.call(this,u),this.info="Represents a bug inside the driver or in a Cassandra host."}c(l9,"DriverInternalError");Lr.inherits(l9,yt);function h9(u){yt.call(this,u),this.info="Represents an authentication error from the driver or from a Cassandra node."}c(h9,"AuthenticationError");Lr.inherits(h9,yt);function f9(u){yt.call(this,u),this.info="Represents an error that is raised when one of the arguments provided to a method is not valid."}c(f9,"ArgumentError");Lr.inherits(f9,yt);function d9(u,e){yt.call(this,u,this.constructor),this.info="Represents a client-side error that is raised when the client did not hear back from the server within socketOptions.readTimeout",this.host=e}c(d9,"OperationTimedOutError");Lr.inherits(d9,yt);function p9(u){yt.call(this,u,this.constructor),this.info="Represents a feature that is not supported in the driver or in the Cassandra version."}c(p9,"NotSupportedError");Lr.inherits(p9,yt);function y9(u,e,t){let r=Lr.format("All connections to host %s are busy, %d requests are in-flight on %s",u,e,t===1?"a single connection":"each connection");yt.call(this,r,this.constructor),this.info="Represents a client-side error indicating that all connections to a certain host have reached the maximum amount of in-flight requests supported (pooling.maxRequestsPerConnection)"}c(y9,"BusyConnectionError");Lr.inherits(y9,yt);Jr.ArgumentError=f9;Jr.AuthenticationError=h9;Jr.BusyConnectionError=y9;Jr.DriverError=yt;Jr.OperationTimedOutError=d9;Jr.DriverInternalError=l9;Jr.NoHostAvailableError=o9;Jr.NotSupportedError=p9;Jr.ResponseError=c9});var iu=w((_n0,E9)=>{"use strict";function vH(u){return new Promise(e=>setTimeout(e,u||0))}c(vH,"delay");function IH(u,e){return new Promise((t,r)=>u.once(e,(i,s)=>{i?r(i):t(s)}))}c(IH,"fromEvent");function LH(u){return new Promise((e,t)=>u((r,i)=>{r?t(r):e(i)}))}c(LH,"fromCallback");function SH(u,e){return function(t,r){t?e(t):u(r)}}c(SH,"getCallback");async function KH(u,e,t){let r;for(;(r=u.counter++){u.newQueryPlan(e,t,(s,a)=>{s?i(s):r(a)})})}c(OH,"newQueryPlan");function NH(u,e){if(!e)return u;g9(u,e)}c(NH,"optionalCallback");function UH(u,e,t){e>u&&(e=u);let r=new Array(e),i={counter:0};for(let s=0;s{})}c(PH,"toBackground");function g9(u,e){u.then(t=>process.nextTick(()=>e(null,t)),t=>process.nextTick(()=>e(t)))}c(g9,"toCallback");E9.exports={delay:vH,fromCallback:LH,fromEvent:IH,getCallback:SH,newQueryPlan:OH,optionalCallback:NH,times:UH,toBackground:PH,toCallback:g9}});var f0=w(R0=>{"use strict";var eo=require("util"),kH=require("net"),{EventEmitter:BH}=require("events"),m9=ce(),DH=iu(),FH=9007199254740992,MH=2147483647,x9=Object.freeze({}),HH=Object.freeze([]);function su(){}c(su,"noop");var qH=Buffer.alloc||WH,T9=Buffer.allocUnsafe||b9,VH=Int8Array.from!==Buffer.from&&Buffer.from||zH,GH=Int8Array.from!==Buffer.from&&Buffer.from||YH;function b9(u){return new Buffer(u)}c(b9,"allocBufferDeprecated");function WH(u){let e=b9(u);return e.fill(0),e}c(WH,"allocBufferFillDeprecated");function zH(u,e){if(typeof u!="string")throw new TypeError("Expected string, obtained "+eo.inspect(u));return new Buffer(u,e)}c(zH,"allocBufferFromStringDeprecated");function YH(u){if(!Array.isArray(u))throw new TypeError("Expected Array, obtained "+eo.inspect(u));return new Buffer(u)}c(YH,"allocBufferFromArrayDeprecated");function QH(u){let e=u;return c(function(r,i){e(r,i),e=su},"wrapperCallback")}c(QH,"callbackOnce");function jH(u){let e=T9(u.length);return u.copy(e),e}c(jH,"copyBuffer");function $H(u,e){return u&&(e.stack+=` + (event loop) +`+u.substr(u.indexOf(` +`)+1)),e}c($H,"fixStack");function ZH(u,e,t,r){if(!this.logEmitter){let i=r||this.options;if(!i||!i.logEmitter)throw new Error("Log emitter not defined");this.logEmitter=i.logEmitter}this.logEmitter("log",u,this.constructor.name,e,t||"")}c(ZH,"log");function XH(u){if(u.length===1)return u[0].length;let e=0;return u.forEach(function(t){let r=t.length;r=r||0,e+=r}),e}c(XH,"totalLength");function JH(u){return Array.prototype.slice.call(arguments,1).forEach(function(t){if(!t)return;let r=Object.keys(t);for(let i=0;it[u]?1:e[u]"u")return 0;let i=t[u].apply(t,e),s=r[u].apply(r,e);return i>s?1:i>>1,a=u[s],o=t(a,e);if(o<0)r=s+1;else if(o>0)i=s-1;else return s}return~r}c(C9,"binarySearch");function sq(u,e,t){if(u.length===0)return u.push(e);let r=C9(u,e,t);r<0&&(r=~r),u.splice(r,0,e)}c(sq,"insertSorted");function nq(u,e){if(typeof u!="function")throw new m9.ArgumentError(eo.format("%s is not a function",e||"callback"));return u}c(nq,"validateFn");function aq(u,e){if(!u||Array.isArray(u)||!e||e.length===0)return u;let t=new Array(e.length);u=eq(u);let r={};for(let i=0;i0;e--){let t=Math.floor(Math.random()*(e+1)),r=u[e];u[e]=u[t],u[t]=r}return u}c(yq,"shuffleArray");function Fl(){this.length=0,this.items={}}c(Fl,"HashSet");Fl.prototype.add=function(u){return this.contains(u)?!1:(this.items[u]=!0,this.length++,!0)};Fl.prototype.contains=function(u){return this.length>0&&this.items[u]===!0};Fl.prototype.remove=function(u){if(!this.contains(u))return!1;delete this.items[u],this.length--};Fl.prototype.toArray=function(){return Object.keys(this.items)};var aE=class aE{constructor(e){if(!e||!e.nameOrIp||!e.dns)throw new Error("nameOrIp and dns lib must be provided as part of the options");this._resolve4=eo.promisify(e.dns.resolve4),this._nameOrIp=e.nameOrIp,this._isIp=kH.isIP(e.nameOrIp),this._index=0,this._addresses=null,this._refreshing=null}async init(){this._isIp||await this._resolve()}async refresh(){if(!this._isIp){if(this._refreshing)return await DH.fromEvent(this._refreshing,"finished");this._refreshing=new BH().setMaxListeners(0);try{await this._resolve()}catch{}this._refreshing.emit("finished"),this._refreshing=null}}async _resolve(){let e=await this._resolve4(this._nameOrIp);if(!e||e.length===0)throw new Error(`${this._nameOrIp} could not be resolved`);this._addresses=e}getIp(){if(this._isIp)return this._nameOrIp;let e=this._addresses[this._index%this._addresses.length];return this._index=this._index!==MH?this._index+1:0,e}};c(aE,"AddressResolver");var nE=aE;function gq(u,e,t){if(!Array.isArray(u))throw new TypeError("First parameter is not an Array");t=t||su;let r=u.length;if(r===0)return t();let i=0;for(let a=0;a=r)return t();if(i===void 0&&(i=!0),i)return process.nextTick(function(){e(u[s++],a)});e(u[s++],a)}c(a,"next")}c(Eq,"eachSeries");function mq(u,e,t){return R9(u,e,!0,t)}c(mq,"forEachOf");function xq(u,e,t){return R9(u,e,!1,t)}c(xq,"map");function R9(u,e,t,r){if(!Array.isArray(u))throw new TypeError("First parameter must be an Array");r=r||su;let i=u.length;if(i===0)return r(null,[]);let s=new Array(i),a=0,o=t?f:h;for(let p=0;p=u)){if(i===void 0&&(i=a>=0),i){let d=s;return process.nextTick(function(){t(d,h)})}t(s,h)}}c(h,"next")}c(Rq,"timesLimit");function Aq(u,e,t){if(u=+u,isNaN(u)||u<1)return t();let r=1,i;e(0,s),i===void 0&&(i=!1);function s(a){if(a)return t(a);if(r===u)return t();i===void 0&&(i=!0);let o=r++;if(i)return process.nextTick(function(){e(o,s)});e(o,s)}c(s,"next")}c(Aq,"timesSeries");function wq(u,e,t){let r=0;i();function i(s){if(s)return t(s);if(!u())return t();if(r===0){r=1,e(function(a){r===1&&(r=4),i(a)}),r===1&&(r=2);return}if(r===4)return process.nextTick(function(){e(i)});e(i)}c(i,"next")}c(wq,"whilst");R0.adaptNamedParamsPrepared=aq;R0.adaptNamedParamsWithHints=oq;R0.AddressResolver=nE;R0.allocBuffer=qH;R0.allocBufferUnsafe=T9;R0.allocBufferFromArray=GH;R0.allocBufferFromString=VH;R0.arrayIterator=rq;R0.binarySearch=C9;R0.callbackOnce=QH;R0.copyBuffer=jH;R0.deepExtend=_9;R0.each=gq;R0.eachSeries=Eq;R0.emptyArray=Object.freeze([]);R0.emptyObject=x9;R0.extend=JH;R0.fixStack=$H;R0.forEachOf=mq;R0.funcCompare=uq;R0.ifUndefined=dq;R0.ifUndefined3=pq;R0.insertSorted=sq;R0.iteratorToArray=iq;R0.log=ZH;R0.map=xq;R0.mapSeries=Tq;R0.maxInt=FH;R0.noop=su;R0.objectValues=lq;R0.parallel=bq;R0.promiseWrapper=hq;R0.propCompare=tq;R0.series=_q;R0.shuffleArray=yq;R0.stringRepeat=cq;R0.times=Cq;R0.timesLimit=Rq;R0.timesSeries=Aq;R0.totalLength=XH;R0.validateFn=nq;R0.whilst=wq;R0.HashSet=Fl});var w9=w(cE=>{"use strict";var A9=require("dns"),vq=require("util"),Iq=f0();function oE(){}c(oE,"AddressTranslator");oE.prototype.translate=function(u,e,t){t(u+":"+e)};function v1(){}c(v1,"EC2MultiRegionTranslator");vq.inherits(v1,oE);v1.prototype.translate=function(u,e,t){let r=u,i=this,s;Iq.series([c(function(o){A9.reverse(u,function(h,f){if(h)return o(h);if(!f)return o();s=f[0],o()})},"resolve"),c(function(o){if(!s)return o();A9.lookup(s,function(h,f){if(h)return o(h);r=f,o()})},"lookup")],function(a){a&&i.logError(u,a),t(r+":"+e)})};v1.prototype.logError=function(u,e){};cE.AddressTranslator=oE;cE.EC2MultiRegionTranslator=v1});var En=w((I9,lE)=>{var v9=function(u){"use strict";Object.defineProperty(u,"__esModule",{value:!0}),u.default=void 0;var e=null;try{e=new WebAssembly.Instance(new WebAssembly.Module(new Uint8Array([0,97,115,109,1,0,0,0,1,13,2,96,0,1,127,96,4,127,127,127,127,1,127,3,7,6,0,1,1,1,1,1,6,6,1,127,1,65,0,11,7,50,6,3,109,117,108,0,1,5,100,105,118,95,115,0,2,5,100,105,118,95,117,0,3,5,114,101,109,95,115,0,4,5,114,101,109,95,117,0,5,8,103,101,116,95,104,105,103,104,0,0,10,191,1,6,4,0,35,0,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,126,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,127,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,128,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,129,34,4,66,32,135,167,36,0,32,4,167,11,36,1,1,126,32,0,173,32,1,173,66,32,134,132,32,2,173,32,3,173,66,32,134,132,130,34,4,66,32,135,167,36,0,32,4,167,11])),{}).exports}catch{}function t(V,v,$){this.low=V|0,this.high=v|0,this.unsigned=!!$}c(t,"Long"),t.prototype.__isLong__,Object.defineProperty(t.prototype,"__isLong__",{value:!0});function r(V){return(V&&V.__isLong__)===!0}c(r,"isLong");function i(V){var v=Math.clz32(V&-V);return V?31-v:v}c(i,"ctz32"),t.isLong=r;var s={},a={};function o(V,v){var $,d0,r0;return v?(V>>>=0,(r0=0<=V&&V<256)&&(d0=a[V],d0)?d0:($=f(V,0,!0),r0&&(a[V]=$),$)):(V|=0,(r0=-128<=V&&V<128)&&(d0=s[V],d0)?d0:($=f(V,V<0?-1:0,!1),r0&&(s[V]=$),$))}c(o,"fromInt"),t.fromInt=o;function h(V,v){if(isNaN(V))return v?N:L;if(v){if(V<0)return N;if(V>=A)return h0}else{if(V<=-T)return i0;if(V+1>=T)return u0}return V<0?h(-V,v).neg():f(V%m|0,V/m|0,v)}c(h,"fromNumber"),t.fromNumber=h;function f(V,v,$){return new t(V,v,$)}c(f,"fromBits"),t.fromBits=f;var d=Math.pow;function p(V,v,$){if(V.length===0)throw Error("empty string");if(typeof v=="number"?($=v,v=!1):v=!!v,V==="NaN"||V==="Infinity"||V==="+Infinity"||V==="-Infinity")return v?N:L;if($=$||10,$<2||36<$)throw RangeError("radix");var d0;if((d0=V.indexOf("-"))>0)throw Error("interior hyphen");if(d0===0)return p(V.substring(1),v,$).neg();for(var r0=h(d($,8)),W0=L,oe=0;oe>>0:this.low},"toInt"),H.toNumber=c(function(){return this.unsigned?(this.high>>>0)*m+(this.low>>>0):this.high*m+(this.low>>>0)},"toNumber"),H.toString=c(function(v){if(v=v||10,v<2||36>>0,O0=P0.toString(v);if(oe=z0,oe.isZero())return O0+U0;for(;O0.length<6;)O0="0"+O0;U0=""+O0+U0}},"toString"),H.getHighBits=c(function(){return this.high},"getHighBits"),H.getHighBitsUnsigned=c(function(){return this.high>>>0},"getHighBitsUnsigned"),H.getLowBits=c(function(){return this.low},"getLowBits"),H.getLowBitsUnsigned=c(function(){return this.low>>>0},"getLowBitsUnsigned"),H.getNumBitsAbs=c(function(){if(this.isNegative())return this.eq(i0)?64:this.neg().getNumBitsAbs();for(var v=this.high!=0?this.high:this.low,$=31;$>0&&!(v&1<<$);$--);return this.high!=0?$+33:$+1},"getNumBitsAbs"),H.isZero=c(function(){return this.high===0&&this.low===0},"isZero"),H.eqz=H.isZero,H.isNegative=c(function(){return!this.unsigned&&this.high<0},"isNegative"),H.isPositive=c(function(){return this.unsigned||this.high>=0},"isPositive"),H.isOdd=c(function(){return(this.low&1)===1},"isOdd"),H.isEven=c(function(){return(this.low&1)===0},"isEven"),H.equals=c(function(v){return r(v)||(v=E(v)),this.unsigned!==v.unsigned&&this.high>>>31===1&&v.high>>>31===1?!1:this.high===v.high&&this.low===v.low},"equals"),H.eq=H.equals,H.notEquals=c(function(v){return!this.eq(v)},"notEquals"),H.neq=H.notEquals,H.ne=H.notEquals,H.lessThan=c(function(v){return this.comp(v)<0},"lessThan"),H.lt=H.lessThan,H.lessThanOrEqual=c(function(v){return this.comp(v)<=0},"lessThanOrEqual"),H.lte=H.lessThanOrEqual,H.le=H.lessThanOrEqual,H.greaterThan=c(function(v){return this.comp(v)>0},"greaterThan"),H.gt=H.greaterThan,H.greaterThanOrEqual=c(function(v){return this.comp(v)>=0},"greaterThanOrEqual"),H.gte=H.greaterThanOrEqual,H.ge=H.greaterThanOrEqual,H.compare=c(function(v){if(r(v)||(v=E(v)),this.eq(v))return 0;var $=this.isNegative(),d0=v.isNegative();return $&&!d0?-1:!$&&d0?1:this.unsigned?v.high>>>0>this.high>>>0||v.high===this.high&&v.low>>>0>this.low>>>0?-1:1:this.sub(v).isNegative()?-1:1},"compare"),H.comp=H.compare,H.negate=c(function(){return!this.unsigned&&this.eq(i0)?i0:this.not().add(k)},"negate"),H.neg=H.negate,H.add=c(function(v){r(v)||(v=E(v));var $=this.high>>>16,d0=this.high&65535,r0=this.low>>>16,W0=this.low&65535,oe=v.high>>>16,U0=v.high&65535,z0=v.low>>>16,P0=v.low&65535,O0=0,$0=0,k0=0,te=0;return te+=W0+P0,k0+=te>>>16,te&=65535,k0+=r0+z0,$0+=k0>>>16,k0&=65535,$0+=d0+U0,O0+=$0>>>16,$0&=65535,O0+=$+oe,O0&=65535,f(k0<<16|te,O0<<16|$0,this.unsigned)},"add"),H.subtract=c(function(v){return r(v)||(v=E(v)),this.add(v.neg())},"subtract"),H.sub=H.subtract,H.multiply=c(function(v){if(this.isZero())return this;if(r(v)||(v=E(v)),e){var $=e.mul(this.low,this.high,v.low,v.high);return f($,e.get_high(),this.unsigned)}if(v.isZero())return this.unsigned?N:L;if(this.eq(i0))return v.isOdd()?i0:L;if(v.eq(i0))return this.isOdd()?i0:L;if(this.isNegative())return v.isNegative()?this.neg().mul(v.neg()):this.neg().mul(v).neg();if(v.isNegative())return this.mul(v.neg()).neg();if(this.lt(I)&&v.lt(I))return h(this.toNumber()*v.toNumber(),this.unsigned);var d0=this.high>>>16,r0=this.high&65535,W0=this.low>>>16,oe=this.low&65535,U0=v.high>>>16,z0=v.high&65535,P0=v.low>>>16,O0=v.low&65535,$0=0,k0=0,te=0,Ke=0;return Ke+=oe*O0,te+=Ke>>>16,Ke&=65535,te+=W0*O0,k0+=te>>>16,te&=65535,te+=oe*P0,k0+=te>>>16,te&=65535,k0+=r0*O0,$0+=k0>>>16,k0&=65535,k0+=W0*P0,$0+=k0>>>16,k0&=65535,k0+=oe*z0,$0+=k0>>>16,k0&=65535,$0+=d0*O0+r0*P0+W0*z0+oe*U0,$0&=65535,f(te<<16|Ke,$0<<16|k0,this.unsigned)},"multiply"),H.mul=H.multiply,H.divide=c(function(v){if(r(v)||(v=E(v)),v.isZero())throw Error("division by zero");if(e){if(!this.unsigned&&this.high===-2147483648&&v.low===-1&&v.high===-1)return this;var $=(this.unsigned?e.div_u:e.div_s)(this.low,this.high,v.low,v.high);return f($,e.get_high(),this.unsigned)}if(this.isZero())return this.unsigned?N:L;var d0,r0,W0;if(this.unsigned){if(v.unsigned||(v=v.toUnsigned()),v.gt(this))return N;if(v.gt(this.shru(1)))return M;W0=N}else{if(this.eq(i0)){if(v.eq(k)||v.eq(X))return i0;if(v.eq(i0))return k;var oe=this.shr(1);return d0=oe.div(v).shl(1),d0.eq(L)?v.isNegative()?k:X:(r0=this.sub(v.mul(d0)),W0=d0.add(r0.div(v)),W0)}else if(v.eq(i0))return this.unsigned?N:L;if(this.isNegative())return v.isNegative()?this.neg().div(v.neg()):this.neg().div(v).neg();if(v.isNegative())return this.div(v.neg()).neg();W0=L}for(r0=this;r0.gte(v);){d0=Math.max(1,Math.floor(r0.toNumber()/v.toNumber()));for(var U0=Math.ceil(Math.log(d0)/Math.LN2),z0=U0<=48?1:d(2,U0-48),P0=h(d0),O0=P0.mul(v);O0.isNegative()||O0.gt(r0);)d0-=z0,P0=h(d0,this.unsigned),O0=P0.mul(v);P0.isZero()&&(P0=k),W0=W0.add(P0),r0=r0.sub(O0)}return W0},"divide"),H.div=H.divide,H.modulo=c(function(v){if(r(v)||(v=E(v)),e){var $=(this.unsigned?e.rem_u:e.rem_s)(this.low,this.high,v.low,v.high);return f($,e.get_high(),this.unsigned)}return this.sub(this.div(v).mul(v))},"modulo"),H.mod=H.modulo,H.rem=H.modulo,H.not=c(function(){return f(~this.low,~this.high,this.unsigned)},"not"),H.countLeadingZeros=c(function(){return this.high?Math.clz32(this.high):Math.clz32(this.low)+32},"countLeadingZeros"),H.clz=H.countLeadingZeros,H.countTrailingZeros=c(function(){return this.low?i(this.low):i(this.high)+32},"countTrailingZeros"),H.ctz=H.countTrailingZeros,H.and=c(function(v){return r(v)||(v=E(v)),f(this.low&v.low,this.high&v.high,this.unsigned)},"and"),H.or=c(function(v){return r(v)||(v=E(v)),f(this.low|v.low,this.high|v.high,this.unsigned)},"or"),H.xor=c(function(v){return r(v)||(v=E(v)),f(this.low^v.low,this.high^v.high,this.unsigned)},"xor"),H.shiftLeft=c(function(v){return r(v)&&(v=v.toInt()),(v&=63)===0?this:v<32?f(this.low<>>32-v,this.unsigned):f(0,this.low<>>v|this.high<<32-v,this.high>>v,this.unsigned):f(this.high>>v-32,this.high>=0?0:-1,this.unsigned)},"shiftRight"),H.shr=H.shiftRight,H.shiftRightUnsigned=c(function(v){return r(v)&&(v=v.toInt()),(v&=63)===0?this:v<32?f(this.low>>>v|this.high<<32-v,this.high>>>v,this.unsigned):v===32?f(this.high,0,this.unsigned):f(this.high>>>v-32,0,this.unsigned)},"shiftRightUnsigned"),H.shru=H.shiftRightUnsigned,H.shr_u=H.shiftRightUnsigned,H.rotateLeft=c(function(v){var $;return r(v)&&(v=v.toInt()),(v&=63)===0?this:v===32?f(this.high,this.low,this.unsigned):v<32?($=32-v,f(this.low<>>$,this.high<>>$,this.unsigned)):(v-=32,$=32-v,f(this.high<>>$,this.low<>>$,this.unsigned))},"rotateLeft"),H.rotl=H.rotateLeft,H.rotateRight=c(function(v){var $;return r(v)&&(v=v.toInt()),(v&=63)===0?this:v===32?f(this.high,this.low,this.unsigned):v<32?($=32-v,f(this.high<<$|this.low>>>v,this.low<<$|this.high>>>v,this.unsigned)):(v-=32,$=32-v,f(this.low<<$|this.high>>>v,this.high<<$|this.low>>>v,this.unsigned))},"rotateRight"),H.rotr=H.rotateRight,H.toSigned=c(function(){return this.unsigned?f(this.low,this.high,!1):this},"toSigned"),H.toUnsigned=c(function(){return this.unsigned?this:f(this.low,this.high,!0)},"toUnsigned"),H.toBytes=c(function(v){return v?this.toBytesLE():this.toBytesBE()},"toBytes"),H.toBytesLE=c(function(){var v=this.high,$=this.low;return[$&255,$>>>8&255,$>>>16&255,$>>>24,v&255,v>>>8&255,v>>>16&255,v>>>24]},"toBytesLE"),H.toBytesBE=c(function(){var v=this.high,$=this.low;return[v>>>24,v>>>16&255,v>>>8&255,v&255,$>>>24,$>>>16&255,$>>>8&255,$&255]},"toBytesBE"),t.fromBytes=c(function(v,$,d0){return d0?t.fromBytesLE(v,$):t.fromBytesBE(v,$)},"fromBytes"),t.fromBytesLE=c(function(v,$){return new t(v[0]|v[1]<<8|v[2]<<16|v[3]<<24,v[4]|v[5]<<8|v[6]<<16|v[7]<<24,$)},"fromBytesLE"),t.fromBytesBE=c(function(v,$){return new t(v[4]<<24|v[5]<<16|v[6]<<8|v[7],v[0]<<24|v[1]<<16|v[2]<<8|v[3],$)},"fromBytesBE");var L0=t;return u.default=L0,"default"in u?u.default:u}({});typeof define=="function"&&define.amd?define([],function(){return v9}):typeof lE=="object"&&typeof I9=="object"&&(lE.exports=v9)});var hE=w((Ln0,K9)=>{"use strict";var Lq=require("crypto"),Sq=f0();function Sr(u){if(!u||u.length!==16)throw new Error("You must provide a buffer containing 16 bytes");this.buffer=u}c(Sr,"Uuid");Sr.fromString=function(u){if(typeof u!="string"||u.length!==36)throw new Error("Invalid string representation of Uuid, it should be in the 00000000-0000-0000-0000-000000000000");return new Sr(Sq.allocBufferFromString(u.replace(/-/g,""),"hex"))};Sr.random=function(u){if(u)S9(function(e,t){return e?u(e):u(null,L9(t))});else{let e=S9();return L9(e)}};Sr.prototype.getBuffer=function(){return this.buffer};Sr.prototype.equals=function(u){return u instanceof Sr&&this.buffer.equals(u.buffer)};Sr.prototype.toString=function(){let u=Kq(this);return u.substr(0,8)+"-"+u.substr(8,4)+"-"+u.substr(12,4)+"-"+u.substr(16,4)+"-"+u.substr(20,12)};Sr.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};Sr.prototype.toJSON=function(){return this.toString()};function L9(u){return u[6]&=15,u[6]|=64,u[8]&=63,u[8]|=128,new Sr(u)}c(L9,"createUuidFromBuffer");function Kq(u){return u.buffer.toString("hex")}c(Kq,"getHex");function S9(u){return Lq.randomBytes(16,u)}c(S9,"getRandomBytes");K9.exports=Sr});var D9=w((Kn0,B9)=>{"use strict";var Oq=require("util"),U9=require("crypto"),to=En(),fE=hE(),ls=f0(),P9=122192928e5,S1=1e4,Nq=ls.allocBufferFromString("808080808080","hex"),Uq=ls.allocBufferFromString("8080","hex"),Pq=ls.allocBufferFromString("7f7f7f7f7f7f","hex"),kq=ls.allocBufferFromString("7f7f","hex"),I1=0,L1=0,O9=0;function gt(u,e,t,r){let i;if(u instanceof Buffer){if(u.length!==16)throw new Error("Buffer for v1 uuid not valid");i=u}else i=qq(u,e,t,r);fE.call(this,i)}c(gt,"TimeUuid");Oq.inherits(gt,fE);gt.fromDate=function(u,e,t,r,i){if(typeof e=="function"?(i=e,e=t=r=null):typeof t=="function"?(i=t,t=r=null):typeof r=="function"&&(i=r,r=null),!i)return new gt(u,e,t,r);ls.parallel([s=>N9(t,6,(a,o)=>s(a,t=o)),s=>N9(r,2,(a,o)=>s(a,r=o))],s=>{if(s)return i(s);let a;try{a=new gt(u,e,t,r)}catch(o){return i(o)}i(null,a)})};gt.fromString=function(u){return new gt(fE.fromString(u).getBuffer())};gt.min=function(u,e){return new gt(u,e,Nq,Uq)};gt.max=function(u,e){return new gt(u,e,Pq,kq)};gt.now=function(u,e,t){return gt.fromDate(null,null,u,e,t)};gt.prototype.getDatePrecision=function(){let u=this.buffer.readUInt32BE(0),e=0;e|=(this.buffer[4]&255)<<8,e|=this.buffer[5]&255,e|=(this.buffer[6]&15)<<24,e|=(this.buffer[7]&255)<<16;let t=to.fromBits(u,e),r=to.fromNumber(S1),i=t.modulo(r),s=t.div(r).subtract(to.fromNumber(P9));return{date:new Date(s.toNumber()),ticks:i.toNumber()}};gt.prototype.getDate=function(){return this.getDatePrecision().date};gt.prototype.getNodeId=function(){return this.buffer.slice(10)};gt.prototype.getClockId=function(){return this.buffer.slice(8,10)};gt.prototype.getNodeIdString=function(){return this.buffer.slice(10).toString("ascii")};function Bq(u,e,t){let r=to.fromNumber(e+P9).multiply(to.fromNumber(1e4)).add(to.fromNumber(t)),i=r.getHighBitsUnsigned();u.writeUInt32BE(r.getLowBitsUnsigned(),0),u.writeUInt16BE(i&65535,4),u.writeUInt16BE(i>>>16&65535,6)}c(Bq,"writeTime");function Dq(u){let e=u;if(typeof u=="string"&&(e=ls.allocBufferFromString(u,"ascii")),!(e instanceof Buffer))e=k9(2);else if(e.length!==2)throw new Error("Clock identifier must have 2 bytes");return e}c(Dq,"getClockId");function Fq(u){let e=u;if(typeof u=="string"&&(e=ls.allocBufferFromString(u,"ascii")),!(e instanceof Buffer))e=k9(6);else if(e.length!==6)throw new Error("Node identifier must have 6 bytes");return e}c(Fq,"getNodeId");function Mq(u){return(typeof u!="number"||u>=S1)&&(I1++,I1>=S1&&(I1=0),u=I1),u}c(Mq,"getTicks");function Hq(u,e){if(!(u instanceof Date)||isNaN(u.getTime())){u=new Date;let t=u.getTime();L1++,(L1>S1||t>O9)&&(L1=0,O9=t),e=L1}return{time:u.getTime(),ticks:Mq(e)}}c(Hq,"getTimeWithTicks");function k9(u){return U9.randomBytes(u)}c(k9,"getRandomBytes");function N9(u,e,t){if(u)return t(null,u);U9.randomBytes(e,t)}c(N9,"getOrGenerateRandom");function qq(u,e,t,r){let i=Hq(u,e);t=Fq(t),r=Dq(r);let s=ls.allocBufferUnsafe(16);return Bq(s,i.time,i.ticks),r.copy(s,8,0),t.copy(s,10,0),s[6]=s[6]&15,s[6]=s[6]|16,s[8]=s[8]&63,s[8]=s[8]|128,s}c(qq,"generateBuffer");B9.exports=gt});var pE=w((Nn0,F9)=>{"use strict";var Vq=/(\d+)\.(\d+)(?:\.(\d+))?(?:\.(\d+)?)?(?:[-~]([\w+]*(?:-\w[.\w]*)*))?(?:\+([.\w]+))?/,K1=class K1{constructor(e,t,r,i,s,a){this.major=e,this.minor=t,this.patch=r,this.dsePatch=i,this.preReleases=s,this.build=a}toString(){let e=this.major+"."+this.minor;return this.patch!==void 0&&(e+="."+this.patch),this.dsePatch!==void 0&&(e+="."+this.dsePatch),this.preReleases!==void 0&&this.preReleases.forEach(t=>{e+="-"+t}),this.build&&(e+="+"+this.build),e}compare(e){if(this.majore.major)return 1;if(this.minore.minor)return 1;let t=this.patch||0,r=e.patch||0;if(tr)return 1;if(this.dsePatch===void 0){if(e.dsePatch!==void 0)return-1}else{if(e.dsePatch===void 0)return 1;if(this.dsePatche.dsePatch)return 1}if(this.preReleases===void 0){if(e.preReleases!==void 0)return 1}else if(e.preReleases===void 0)return-1;return 0}static parse(e){if(!e)return null;let t=e.match(Vq);if(t){let r=parseInt(t[1],10),i=parseInt(t[2],10),s=t[3]?parseInt(t[3],10):void 0,a=t[4]?parseInt(t[4],10):void 0,o=t[5]?t[5].split("-"):void 0,h=t[6];return new K1(r,i,s,a,o,h)}throw new TypeError("Could not extract version from '"+e+"'")}};c(K1,"VersionNumber");var dE=K1;F9.exports=dE});var H9=w((Pn0,M9)=>{"use strict";var Gq=f0(),hs=pE(),Wq=hs.parse("2.0.0"),zq=hs.parse("2.1.0"),Yq=hs.parse("2.2.0"),Qq=hs.parse("3.0.0"),jq=hs.parse("5.1.0"),$q=hs.parse("6.0.0"),Zq={v1:1,v2:2,v3:3,v4:4,v5:5,v6:6,dseV1:65,dseV2:66,maxSupported:66,minSupported:1,isDse:function(u){return u>=this.dseV1&&u<=this.dseV2},isSupportedCassandra:function(u){return u<=4&&u>=1},isSupported:function(u){return this.isDse(u)||this.isSupportedCassandra(u)},supportsPrepareFlags:function(u){return u===this.dseV2},supportsKeyspaceInRequest:function(u){return u===this.dseV2},supportsResultMetadataId:function(u){return u===this.dseV2},supportsPreparedPartitionKey:function(u){return u>=this.v4},supportsSchemaChangeFullMetadata:function(u){return u>=this.v3},supportsContinuousPaging:function(u){return this.isDse(u)},supportsPaging:function(u){return u>=this.v2},supportsTimestamp:function(u){return u>=this.v3},supportsNamedParameters:function(u){return u>=this.v3},supportsUnset:function(u){return u>=this.v4},supportsFailureReasonMap:function(u){return u>=this.v5},uses2BytesStreamIds:function(u){return u>=this.v3},uses4BytesCollectionLength:function(u){return u>=this.v3},uses4BytesQueryFlags:function(u){return this.isDse(u)},canStartupResponseErrorBeWrapped:function(u){return u>=this.v4},getLowerSupported:function(u){return u>=this.v5?this.v4:u<=this.v1?0:u-1},getHighestCommon:function(u,e){let t=u.log?u.log.bind(u):Gq.noop,r=u.protocolVersion,i=!1,s=r;if(e.forEach(a=>{let o=null;if(a.dseVersion&&(o=hs.parse(a.dseVersion),t("verbose",`Encountered host ${a.address} with dse version ${o}`),o.compare(jq)>=0)){i=!0,o.compare($q)>=0?r=Math.min(this.dseV2,r):r=Math.min(this.dseV1,r),s=r;return}if(!a.cassandraVersion||a.cassandraVersion.length===0){t("warning","Encountered host "+a.address+" with no cassandra version, skipping as part of protocol version evaluation");return}try{let h=hs.parse(a.cassandraVersion);o||t("verbose","Encountered host "+a.address+" with cassandra version "+h),h.compare(Qq)>=0?(i=!0,r=Math.min(this.v4,r),s=r):h.compare(Yq)>=0?(r=Math.min(this.v4,r),s=r):h.compare(zq)>=0?(r=Math.min(this.v3,r),s=r):h.compare(Wq)>=0?r=Math.min(this.v2,r):r=this.v1}catch{t("warning","Encountered host "+a.address+" with unparseable cassandra version "+a.cassandraVersion+" skipping as part of protocol version evaluation")}}),i&&r{var q9=f0();function J(u,e){this.bits_=[],this.sign_=e;for(var t=!0,r=u.length-1;r>=0;r--){var i=u[r]|0;(!t||i!=e)&&(this.bits_[r]=i,t=!1)}}c(J,"Integer");J.IntCache_={};J.fromInt=function(u){if(-128<=u&&u<128){var e=J.IntCache_[u];if(e)return e}var t=new J([u|0],u<0?-1:0);return-128<=u&&u<128&&(J.IntCache_[u]=t),t};J.fromNumber=function(u){if(isNaN(u)||!isFinite(u))return J.ZERO;if(u<0)return J.fromNumber(-u).negate();for(var e=[],t=1,r=0;u>=t;r++)e[r]=u/t|0,t*=J.TWO_PWR_32_DBL_;return new J(e,0)};J.fromBits=function(u){var e=u[u.length-1];return new J(u,e&1<<31?-1:0)};J.fromString=function(u,e){if(u.length==0)throw TypeError("number format error: empty string");var t=e||10;if(t<2||36=0)throw TypeError('number format error: interior "-" character');for(var r=J.fromNumber(Math.pow(t,8)),i=J.ZERO,s=0;s>>24>0&&i.push(r>>24&255),r>>>16>0&&i.push(r>>16&255),r>>>8>0&&i.push(r>>8&255),i.push(r&255),i[0]>>7&&i.unshift(0);for(var s=q9.allocBufferUnsafe(i.length+(t.length-1)*4),a=0;a0?this.bits_[0]:this.sign_};J.prototype.toNumber=function(){if(this.isNegative())return-this.negate().toNumber();for(var u=0,e=1,t=0;t=0?e:J.TWO_PWR_32_DBL_+e};J.prototype.getSign=function(){return this.sign_};J.prototype.isZero=function(){if(this.sign_!=0)return!1;for(var u=0;u0&&(this.bits_[0]&1)!=0};J.prototype.equals=function(u){if(this.sign_!=u.sign_)return!1;for(var e=Math.max(this.bits_.length,u.bits_.length),t=0;t0};J.prototype.greaterThanOrEqual=function(u){return this.compare(u)>=0};J.prototype.lessThan=function(u){return this.compare(u)<0};J.prototype.lessThanOrEqual=function(u){return this.compare(u)<=0};J.prototype.compare=function(u){var e=this.subtract(u);return e.isNegative()?-1:e.isZero()?0:1};J.prototype.shorten=function(u){for(var e=u-1>>5,t=(u-1)%32,r=[],i=0;i>>16,a=this.getBits(i)&65535,o=u.getBits(i)>>>16,h=u.getBits(i)&65535,f=r+a+h,d=(f>>>16)+s+o;r=d>>>16,f&=65535,d&=65535,t[i]=d<<16|f}return J.fromBits(t)};J.prototype.subtract=function(u){return this.add(u.negate())};J.prototype.multiply=function(u){if(this.isZero())return J.ZERO;if(u.isZero())return J.ZERO;if(this.isNegative())return u.isNegative()?this.negate().multiply(u.negate()):this.negate().multiply(u).negate();if(u.isNegative())return this.multiply(u.negate()).negate();if(this.lessThan(J.TWO_PWR_24_)&&u.lessThan(J.TWO_PWR_24_))return J.fromNumber(this.toNumber()*u.toNumber());for(var e=this.bits_.length+u.bits_.length,t=[],r=0;r<2*e;r++)t[r]=0;for(var r=0;r>>16,a=this.getBits(r)&65535,o=u.getBits(i)>>>16,h=u.getBits(i)&65535;t[2*r+2*i]+=a*h,J.carry16_(t,2*r+2*i),t[2*r+2*i+1]+=s*h,J.carry16_(t,2*r+2*i+1),t[2*r+2*i+1]+=a*o,J.carry16_(t,2*r+2*i+1),t[2*r+2*i+2]+=s*o,J.carry16_(t,2*r+2*i+2)}for(var r=0;r>>16,u[e]&=65535};J.prototype.divide=function(u){if(u.isZero())throw Error("division by zero");if(this.isZero())return J.ZERO;if(this.isNegative())return u.isNegative()?this.negate().divide(u.negate()):this.negate().divide(u).negate();if(u.isNegative())return this.divide(u.negate()).negate();for(var e=J.ZERO,t=this;t.greaterThanOrEqual(u);){for(var r=Math.max(1,Math.floor(t.toNumber()/u.toNumber())),i=Math.ceil(Math.log(r)/Math.LN2),s=i<=48?1:Math.pow(2,i-48),a=J.fromNumber(r),o=a.multiply(u);o.isNegative()||o.greaterThan(t);)r-=s,a=J.fromNumber(r),o=a.multiply(u);a.isZero()&&(a=J.ONE),e=e.add(a),t=t.subtract(o)}return e};J.prototype.modulo=function(u){return this.subtract(this.divide(u).multiply(u))};J.prototype.not=function(){for(var u=this.bits_.length,e=[],t=0;t>5,t=u%32,r=this.bits_.length+e+(t>0?1:0),i=[],s=0;s0?i[s]=this.getBits(s-e)<>>32-t:i[s]=this.getBits(s-e);return new J(i,this.sign_)};J.prototype.shiftRight=function(u){for(var e=u>>5,t=u%32,r=this.bits_.length-e,i=[],s=0;s0?i[s]=this.getBits(s+e)>>>t|this.getBits(s+e+1)<<32-t:i[s]=this.getBits(s+e);return new J(i,this.sign_)};J.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};J.prototype.abs=function(){return this.sign_===0?this:this.negate()};J.prototype.toJSON=function(){return this.toString()};V9.exports=J});var z9=w((Dn0,W9)=>{"use strict";var Oi=yE(),G9=f0();function le(u,e){typeof u=="number"&&(u=Oi.fromNumber(u)),this._intVal=u,this._scale=e}c(le,"BigDecimal");le.fromBuffer=function(u){let e=u.readInt32BE(0),t=Oi.fromBuffer(u.slice(4));return new le(t,e)};le.toBuffer=function(u){let e=Oi.toBuffer(u._intVal),t=G9.allocBufferUnsafe(4);return t.writeInt32BE(u._scale,0),Buffer.concat([t,e],t.length+e.length)};le.fromString=function(u){if(!u)throw new TypeError("Invalid null or undefined value");u=u.trim();let e=u.indexOf("."),t=0;return e>=0&&(t=u.length-1-e,u=u.substr(0,e)+u.substr(e+1)),new le(Oi.fromString(u),t)};le.fromNumber=function(u){if(isNaN(u))return new le(Oi.ZERO,0);let e=u.toString();return e.indexOf("e")>=0&&(e=u.toFixed(20)),le.fromString(e)};le.prototype.equals=function(u){return u instanceof le&&this.compare(u)===0};le.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};le.prototype.notEquals=function(u){return!this.equals(u)};le.prototype.compare=function(u){let e=this.subtract(u);return e.isNegative()?-1:e.isZero()?0:1};le.prototype.subtract=function(u){let e=this;if(e._scale===u._scale)return new le(e._intVal.subtract(u._intVal),e._scale);let t,r;return e._scale{"use strict";var Ce=En(),fs=require("util"),O1=f0(),uo={months:O1.allocBuffer(9),days:O1.allocBuffer(9),nanoseconds:O1.allocBuffer(9)},mE=2147483647,xE=Ce.fromInt(1e3),N1=xE,U1=xE.multiply(N1),P1=xE.multiply(U1),k1=Ce.fromInt(60).multiply(P1),gE=Ce.fromInt(60).multiply(k1),Y9=7,EE=12,Q9=/(\d+)(y|mo|w|d|h|s|ms|us|µs|ns|m)/gi,Xq=/P((\d+)Y)?((\d+)M)?((\d+)D)?(T((\d+)H)?((\d+)M)?((\d+)S)?)?/,Jq=/P(\d+)W/,eV=/P(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})/;function ei(u,e,t){this.months=u,this.days=e,this.nanoseconds=typeof t=="number"?Ce.fromNumber(t):t}c(ei,"Duration");ei.prototype.equals=function(u){return u instanceof ei?this.months===u.months&&this.days===u.days&&this.nanoseconds.equals(u.nanoseconds):!1};ei.prototype.toBuffer=function(){let u=ro.writeVInt(Ce.fromNumber(this.months),uo.months),e=ro.writeVInt(Ce.fromNumber(this.days),uo.days),t=ro.writeVInt(this.nanoseconds,uo.nanoseconds),r=O1.allocBufferUnsafe(u+e+t);uo.months.copy(r,0,0,u);let i=u;return uo.days.copy(r,i,0,e),i+=e,uo.nanoseconds.copy(r,i,0,t),r};ei.prototype.toString=function(){let u="";function e(i,s,a){return i===0||i0?iV(e,t):uV(e,t):tV(e,t)};function tV(u,e){let t=new Oe(u);Q9.lastIndex=0;let r;for(;(r=Q9.exec(e))&&r.length<=3;)t.add(r[1],r[2]);return t.build()}c(tV,"parseStandardFormat");function uV(u,e){let t=Xq.exec(e);if(!t||t[0]!==e)throw new TypeError(fs.format("Unable to convert '%s' to a duration",e));let r=new Oe(u);return t[1]&&r.addYears(t[2]),t[3]&&r.addMonths(t[4]),t[5]&&r.addDays(t[6]),t[7]&&(t[8]&&r.addHours(t[9]),t[10]&&r.addMinutes(t[11]),t[12]&&r.addSeconds(t[13])),r.build()}c(uV,"parseIso8601Format");function rV(u,e){let t=Jq.exec(e);if(!t||t[0]!==e)throw new TypeError(fs.format("Unable to convert '%s' to a duration",e));return new Oe(u).addWeeks(t[1]).build()}c(rV,"parseIso8601WeekFormat");function iV(u,e){let t=eV.exec(e);if(!t||t[0]!==e)throw new TypeError(fs.format("Unable to convert '%s' to a duration",e));return new Oe(u).addYears(t[1]).addMonths(t[2]).addDays(t[3]).addHours(t[4]).addMinutes(t[5]).addSeconds(t[6]).build()}c(iV,"parseIso8601AlternativeFormat");function Oe(u){this._isNegative=u,this._unitIndex=0,this._months=0,this._days=0,this._nanoseconds=Ce.ZERO,this._addMethods={y:this.addYears,mo:this.addMonths,w:this.addWeeks,d:this.addDays,h:this.addHours,m:this.addMinutes,s:this.addSeconds,ms:this.addMillis,\u00B5s:this.addMicros,us:this.addMicros,ns:this.addNanos},this._unitByIndex=[null,"years","months","weeks","days","hours","minutes","seconds","milliseconds","microseconds","nanoseconds"]}c(Oe,"Builder");Oe.prototype._validateOrder=function(u){if(u===this._unitIndex)throw new TypeError(fs.format("Invalid duration. The %s are specified multiple times",this._getUnitName(u)));if(u<=this._unitIndex)throw new TypeError(fs.format("Invalid duration. The %s should be after %s",this._getUnitName(this._unitIndex),this._getUnitName(u)));this._unitIndex=u};Oe.prototype._validateMonths=function(u,e){this._validate32(u,(mE-this._months)/e,"months")};Oe.prototype._validateDays=function(u,e){this._validate32(u,(mE-this._days)/e,"days")};Oe.prototype._validateNanos=function(u,e){this._validate64(u,Ce.MAX_VALUE.subtract(this._nanoseconds).divide(e),"nanoseconds")};Oe.prototype._validate32=function(u,e,t){if(u>e)throw new TypeError(fs.format("Invalid duration. The total number of %s must be less or equal to %s",t,mE))};Oe.prototype._validate64=function(u,e,t){if(u.greaterThan(e))throw new TypeError(fs.format("Invalid duration. The total number of %s must be less or equal to %s",t,Ce.MAX_VALUE.toString()))};Oe.prototype._getUnitName=function(u){let e=this._unitByIndex[+u];if(!e)throw new Error("unknown unit index: "+u);return e};Oe.prototype.add=function(u,e){let t=this._addMethods[e.toLowerCase()];if(!t)throw new TypeError(fs.format("Unknown duration symbol '%s'",e));return t.call(this,u)};Oe.prototype.addYears=function(u){let e=+u;return this._validateOrder(1),this._validateMonths(e,EE),this._months+=e*EE,this};Oe.prototype.addMonths=function(u){let e=+u;return this._validateOrder(2),this._validateMonths(e,1),this._months+=e,this};Oe.prototype.addWeeks=function(u){let e=+u;return this._validateOrder(3),this._validateDays(e,Y9),this._days+=e*Y9,this};Oe.prototype.addDays=function(u){let e=+u;return this._validateOrder(4),this._validateDays(e,1),this._days+=e,this};Oe.prototype.addHours=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(5),this._validateNanos(e,gE),this._nanoseconds=this._nanoseconds.add(e.multiply(gE)),this};Oe.prototype.addMinutes=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(6),this._validateNanos(e,k1),this._nanoseconds=this._nanoseconds.add(e.multiply(k1)),this};Oe.prototype.addSeconds=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(7),this._validateNanos(e,P1),this._nanoseconds=this._nanoseconds.add(e.multiply(P1)),this};Oe.prototype.addMillis=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(8),this._validateNanos(e,U1),this._nanoseconds=this._nanoseconds.add(e.multiply(U1)),this};Oe.prototype.addMicros=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(9),this._validateNanos(e,N1),this._nanoseconds=this._nanoseconds.add(e.multiply(N1)),this};Oe.prototype.addNanos=function(u){let e=typeof u=="string"?Ce.fromString(u):u;return this._validateOrder(10),this._validateNanos(e,Ce.ONE),this._nanoseconds=this._nanoseconds.add(e),this};Oe.prototype.build=function(){return this._isNegative?new ei(-this._months,-this._days,this._nanoseconds.negate()):new ei(this._months,this._days,this._nanoseconds)};var ro=function(){function u(g){return g.toUnsigned().shiftLeft(1).xor(g.shiftRight(63))}c(u,"encodeZigZag64");function e(g){return g.shiftRightUnsigned(1).xor(g.and(Ce.ONE).negate())}c(e,"decodeZigZag64");function t(g,m){return r(u(g),m)}c(t,"writeVInt");function r(g,m){let A=i(g);return A===1?(m[0]=g.getLowBits(),1):(s(g,A,m),A)}c(r,"writeUnsignedVInt");function i(g){return 639-a(g.or(Ce.ONE))*9>>6}c(i,"computeUnsignedVIntSize");function s(g,m,A){let T=m-1,I=g.getLowBits(),L,N=4;for(L=T;L>=0&&N-- >0;L--)A[L]=255&I,I>>=8;for(I=g.getHighBits();L>=0;L--)A[L]=255&I,I>>=8;A[0]|=o(T)}c(s,"encodeVInt");function a(g){if(g.equals(Ce.ZERO))return 64;let m=1,A=g.getHighBits();return A===0&&(m+=32,A=g.getLowBits()),A>>>16||(m+=16,A<<=16),A>>>24||(m+=8,A<<=8),A>>>28||(m+=4,A<<=4),A>>>30||(m+=2,A<<=2),m-=A>>>31,m}c(a,"numberOfLeadingZeros");function o(g){return~(255>>g)}c(o,"encodeExtraBytesToRead");function h(g,m){return e(f(g,m))}c(h,"readVInt");function f(g,m){let A=g[m.value++];if(!(A&128))return Ce.fromInt(A);let T=d(A),I=E(T),L=Ce.fromInt(T&x(I));for(let N=0;N127?g-256:g}c(d,"fromSignedByteToInt");function p(g){if(g===0)return 32;let m=1;return g>>>16||(m+=16,g<<=16),g>>>24||(m+=8,g<<=8),g>>>28||(m+=4,g<<=4),g>>>30||(m+=2,g<<=2),m-=g>>>31,m}c(p,"numberOfLeadingZerosInt32");function E(g){return p(~g)-24}c(E,"numberOfExtraBytesToRead");function x(g){return 255>>g}return c(x,"firstByteValueMask"),{readVInt:h,writeVInt:t}}();j9.exports=ei});var X9=w((qn0,Z9)=>{"use strict";var TE=f0();function Kr(u){if(!(u instanceof Buffer)||u.length!==4&&u.length!==16)throw new TypeError("The ip address must contain 4 or 16 bytes");this.buffer=u,this.length=u.length,this.version=u.length===4?4:6}c(Kr,"InetAddress");Kr.fromString=function(u){if(!u)return new Kr(TE.allocBufferFromArray([0,0,0,0]));let e=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,t=/^[\da-f:.]+$/i,r;if(e.test(u))return r=u.split("."),new Kr(TE.allocBufferFromArray(r));if(!t.test(u))throw new TypeError("Value could not be parsed as InetAddress: "+u);if(r=u.split(":"),r.length<3)throw new TypeError("Value could not be parsed as InetAddress: "+u);let i=TE.allocBufferUnsafe(16),s=8-r.length+1,a=!1,o=0,h=e.test(r[r.length-1]);h&&(s-=1);function f(d){i.writeUInt8(+d,o++)}c(f,"writeItem");for(let d=0;d=0){let a=s-e;a>t.length&&(t.length=a,t.start=e,e=-1)}}c(r,"checkLongest");for(let s=0;st.start||(i.length>0&&(i+=":"),i+=(this.buffer[s]<<8|this.buffer[s+1]).toString(16))}return i.charAt(i.length-1)===":"&&(i+=":"),i};Kr.prototype.toJSON=function(){return this.toString()};function sV(u){for(let e=0;e{"use strict";var nV=require("util"),J9=f0(),D1=864e5,eL=Math.pow(2,31);function tt(u,e,t){if(typeof u=="number"&&typeof e=="number"&&typeof t=="number"){if(this.date=new Date,this.date.setUTCHours(0,0,0,0),this.date.setUTCFullYear(u,e-1,t),isNaN(this.date.getTime()))throw new Error(nV.format("%d-%d-%d does not form a valid ES5 date!",u,e,t))}else if(typeof e>"u"&&typeof t>"u"&&typeof u=="number"){if(u<-2147483648||u>2147483647)throw new Error("You must provide a valid value for days since epoch (-2147483648 <= value <= 2147483647).");this.date=new Date(u*D1)}if(typeof this.date>"u")throw new Error("You must provide a valid year, month and day");this._value=isNaN(this.date.getTime())?u:null,this.year=this.date.getUTCFullYear(),this.month=this.date.getUTCMonth()+1,this.day=this.date.getUTCDate()}c(tt,"LocalDate");tt.now=function(){return tt.fromDate(new Date)};tt.utcNow=function(){return new tt(Date.now())};tt.fromDate=function(u){if(isNaN(u.getTime()))throw new TypeError("Invalid date: "+u);return new tt(u.getFullYear(),u.getMonth()+1,u.getDate())};tt.fromString=function(u){if((u.match(/-/g)||[]).length>=2){let t=1;u[0]==="-"&&(u=u.substring(1),t=-1);let r=u.split("-");return new tt(t*parseInt(r[0],10),parseInt(r[1],10),parseInt(r[2],10))}if(u.match(/^-?\d+$/))return new tt(parseInt(u,10));throw new Error("Invalid input '"+u+"'.")};tt.fromBuffer=function(u){return new tt(u.readUInt32BE(0)-eL)};tt.prototype.compare=function(u){let e=isNaN(this.date.getTime())?this._value*D1:this.date.getTime(),t=isNaN(u.date.getTime())?u._value*D1:u.date.getTime(),r=e-t;return r<0?-1:r>0?1:0};tt.prototype.equals=function(u){return u instanceof tt&&this.compare(u)===0};tt.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};tt.prototype.toBuffer=function(){let e=(isNaN(this.date.getTime())?this._value:Math.floor(this.date.getTime()/D1))+eL,t=J9.allocBufferUnsafe(4);return t.writeUInt32BE(e,0),t};tt.prototype.toString=function(){let u;return isNaN(this.date.getTime())?this._value.toString():(this.year<0?u="-"+B1((this.year*-1).toString(),4):u=B1(this.year.toString(),4),u+="-"+B1(this.month.toString(),2)+"-"+B1(this.day.toString(),2),u)};tt.prototype.toJSON=function(){return this.toString()};function B1(u,e){return u.length>=e?u:J9.stringRepeat("0",e-u.length)+u}c(B1,"fillZeros");tL.exports=tt});var sL=w((zn0,iL)=>{"use strict";var ds=En(),bE=require("util"),_E=f0(),aV=ds.fromString("86399999999999"),rL=ds.fromNumber(1e9),oV=ds.fromNumber(1e6),cV=864e5;function Qe(u){if(!(u instanceof ds))throw new Error("You must specify a Long value as totalNanoseconds");if(u.lessThan(ds.ZERO)||u.greaterThan(aV))throw new Error("Total nanoseconds out of range");this.value=u,this.hour=this._getParts()[0],this.minute=this._getParts()[1],this.second=this._getParts()[2],this.nanosecond=this._getParts()[3]}c(Qe,"LocalTime");Qe.fromString=function(u){if(typeof u!="string")throw new Error("Argument type invalid: "+bE.inspect(u));let e=u.split(":"),t=parseInt(e[0],10)*36e5+parseInt(e[1],10)*6e4,r;if(e.length===3){let i=e[2].split(".");t+=parseInt(i[0],10)*1e3,i.length===2&&(r=i[1],r=r+_E.stringRepeat("0",9-r.length))}return Qe.fromMilliseconds(t,parseInt(r,10)||0)};Qe.now=function(u){return Qe.fromDate(new Date,u)};Qe.fromDate=function(u,e){if(!bE.isDate(u))throw new Error("Not a valid date");let t=(u.getTime()+u.getTimezoneOffset()*-6e4)%cV;return Qe.fromMilliseconds(t,e)};Qe.fromMilliseconds=function(u,e){return typeof e!="number"&&(e=0),new Qe(ds.fromNumber(u).multiply(oV).add(ds.fromNumber(e)))};Qe.fromBuffer=function(u){if(!(u instanceof Buffer))throw new TypeError("Expected Buffer, obtained "+bE.inspect(u));return new Qe(new ds(u.readInt32BE(4),u.readInt32BE(0)))};Qe.prototype.compare=function(u){return this.value.compare(u.value)};Qe.prototype.equals=function(u){return u instanceof Qe&&this.compare(u)===0};Qe.prototype.getTotalNanoseconds=function(){return this.value};Qe.prototype.inspect=function(){return this.constructor.name+": "+this.toString()};Qe.prototype.toBuffer=function(){let u=_E.allocBufferUnsafe(8);return u.writeUInt32BE(this.value.getHighBitsUnsigned(),0),u.writeUInt32BE(this.value.getLowBitsUnsigned(),4),u};Qe.prototype.toString=function(){return lV(this._getParts())};Qe.prototype.toJSON=function(){return this.toString()};Qe.prototype._getParts=function(){if(!this._partsCache){let u=[0,0,0,0],e=this.value.div(rL);u[3]=this.value.subtract(e.multiply(rL)).toNumber(),u[2]=e.toNumber(),u[2]>=60&&(u[1]=Math.floor(u[2]/60),u[2]=u[2]%60),u[1]>=60&&(u[0]=Math.floor(u[1]/60),u[1]=u[1]%60),this._partsCache=u}return this._partsCache};function lV(u){let e;if(u[0]<10?e="0"+u[0]+":":e=u[0]+":",u[1]<10?e+="0"+u[1]+":":e+=u[1]+":",u[2]<10?e+="0"+u[2]:e+=u[2],u[3]>0){let t=u[3].toString();t.length<9&&(t=_E.stringRepeat("0",9-t.length)+t);let r;for(let i=t.length-1;i>0&&t[i]==="0";i--)r=i;r&&(t=t.substring(0,r)),e+="."+t}return e}c(lV,"formatTime");iL.exports=Qe});var aL=w((Qn0,nL)=>{"use strict";var hV=f0(),fV=ce(),dV=Symbol.asyncIterator||"@@asyncIterator";function ps(u,e,t,r,i,s){r===-1&&(r=0),this.info={queriedHost:e,triedHosts:t,speculativeExecutions:r,achievedConsistency:i,traceId:null,warnings:null,customPayload:null,isSchemaInAgreement:s},u.flags&&(this.info.traceId=u.flags.traceId,this.info.warnings=u.flags.warnings,this.info.customPayload=u.flags.customPayload),this.rows=u.rows,this.rowLength=this.rows?this.rows.length:u.rowLength,this.columns=null,this.pageState=null,this.nextPage=void 0,this.nextPageAsync=void 0;let a=u.meta;a&&(this.columns=a.columns,a.pageState&&(this.pageState=a.pageState.toString("hex"),Object.defineProperty(this,"rawPageState",{value:a.pageState,enumerable:!1})))}c(ps,"ResultSet");ps.prototype.first=function(){return this.rows&&this.rows.length?this.rows[0]:null};ps.prototype.getPageState=function(){return this.pageState};ps.prototype.getColumns=function(){return this.columns};ps.prototype.wasApplied=function(){if(!this.rows||this.rows.length===0)return!0;let e=this.rows[0]["[applied]"];return typeof e=="boolean"?e:!0};ps.prototype[Symbol.iterator]=c(function(){return this.rows?this.rows[Symbol.iterator]():hV.emptyArray[Symbol.iterator]()},"getIterator");ps.prototype[dV]=c(function(){let e=0,t=this.rawPageState,r=this.rows;if(!r||r.length===0)return{next:()=>Promise.resolve({done:!0})};let i=this;return{async next(){if(e>=r.length&&t){if(!i.nextPageAsync)throw new fV.DriverInternalError("Property nextPageAsync should be set when pageState is defined");let s=await i.nextPageAsync(t);r=s.rows,e=0,t=s.rawPageState}return e{"use strict";var{Readable:pV}=require("stream"),yV=f0(),gV=ce(),EV=Ml(),RE=class RE extends pV{constructor(e){super(e),this.buffer=[],this.paused=!0,this._cancelAllowed=!1,this._handlersObject=null,this._highWaterMarkRows=0}_read(){for(this.paused=!1,this.buffer.length===0&&(this._readableState.reading=!1);!this.paused&&this.buffer.length>0;)this.paused=!this.push(this.buffer.shift());this._checkBelowHighWaterMark(),!this.paused&&!this.buffer.length&&this._readNext&&(this._readNext(),this._readNext=null)}_valve(e){this._readNext=null,e&&(this.paused||this.buffer.length?this._readNext=e:e())}add(e){let t=this.buffer.push(e);return this.read(0),this._checkAboveHighWaterMark(),t}_checkAboveHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length!==this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!1)}_checkBelowHighWaterMark(){!this._handlersObject||!this._handlersObject.resumeReadingHandler||this._highWaterMarkRows===0||this.buffer.length>=this._highWaterMarkRows||this._handlersObject.resumeReadingHandler(!0)}cancel(e){if(!this._cancelAllowed){let t=new Error("You can only cancel streaming executions when continuous paging is enabled");if(!e)throw t;return e(t)}if(!this._handlersObject)throw new gV.DriverInternalError("ResultStream cancel is allowed but the cancel options were not set");if(e=e||yV.noop,!this._handlersObject.cancelHandler){this._handlersObject.cancelHandler=e;return}this._handlersObject.cancelHandler(e)}setHandlers(e){e.continuousPaging&&(this._cancelAllowed=!0,this._handlersObject=e,this._highWaterMarkRows=e.continuousPaging.highWaterMarkRows||EV.continuousPageDefaultHighWaterMark)}};c(RE,"ResultStream");var CE=RE;oL.exports=CE});var hL=w((Xn0,lL)=>{"use strict";function Hl(u){if(!u)throw new Error("Columns not defined");Object.defineProperty(this,"__columns",{value:u,enumerable:!1,writable:!1})}c(Hl,"Row");Hl.prototype.get=function(u){return typeof u=="number"?this[this.__columns[u].name]:this[u]};Hl.prototype.values=function(){let u=[];return this.forEach(function(e){u.push(e)}),u};Hl.prototype.keys=function(){let u=[];return this.forEach(function(e,t){u.push(t)}),u};Hl.prototype.forEach=function(u){for(let e in this)this.hasOwnProperty(e)&&u(this[e],e)};lL.exports=Hl});var dL=w((ea0,fL)=>{"use strict";function mn(...u){if(this.elements=u,this.elements.length===0)throw new TypeError("Tuple must contain at least one value");this.length=this.elements.length}c(mn,"Tuple");mn.fromArray=function(u){return new mn(...u)};mn.prototype.get=function(u){return this.elements[u||0]};mn.prototype.toString=function(){return"("+this.elements.reduce(function(u,e,t){return u+(t>0?",":"")+e.toString()},"")+")"};mn.prototype.toJSON=function(){return this.elements};mn.prototype.values=function(){return this.elements.slice(0)};fL.exports=mn});var re=w(ue=>{"use strict";var Gl=require("util"),ql=ce(),pL=D9(),AE=hE(),H1=H9(),Vl=f0(),Xu=En(),Ju={any:0,one:1,two:2,three:3,quorum:4,all:5,localQuorum:6,eachQuorum:7,serial:8,localSerial:9,localOne:10},er={};er[Ju.any]="ANY";er[Ju.one]="ONE";er[Ju.two]="TWO";er[Ju.three]="THREE";er[Ju.quorum]="QUORUM";er[Ju.all]="ALL";er[Ju.localQuorum]="LOCAL_QUORUM";er[Ju.eachQuorum]="EACH_QUORUM";er[Ju.serial]="SERIAL";er[Ju.localSerial]="LOCAL_SERIAL";er[Ju.localOne]="LOCAL_ONE";var M1={custom:0,ascii:1,bigint:2,blob:3,boolean:4,counter:5,decimal:6,double:7,float:8,int:9,text:10,timestamp:11,uuid:12,varchar:13,varint:14,timeuuid:15,inet:16,date:17,time:18,smallint:19,tinyint:20,duration:21,list:32,map:33,set:34,udt:48,tuple:49,getByName:function(u){if(u=u.toLowerCase(),u.indexOf("<")>0){let t=/^(list|set)<(.+)>$/.exec(u);if(t)return{code:this[t[1]],info:this.getByName(t[2])};let r=/^(map)< *(.+) *, *(.+)>$/.exec(u);if(r)return{code:this[r[1]],info:[this.getByName(r[2]),this.getByName(r[3])]};let i=/^(udt)<(.+)>$/.exec(u);if(i)return{code:this[i[1]],info:i[2]};let s=/^(tuple)<(.+)>$/.exec(u);if(s)return{code:this[s[1]],info:s[2].split(",").map(function(a){return this.getByName(a.trim())},this)}}let e={code:this[u],info:null};if(typeof e.code!="number")throw new TypeError("Data type with name "+u+" not valid");return e}},mV=function(){let u={};for(let e in M1){if(!M1.hasOwnProperty(e))continue;let t=M1[e];typeof t=="number"&&(u[t]=e)}return u}(),xV={local:0,remote:1,ignored:2},TV={error:0,startup:1,ready:2,authenticate:3,credentials:4,options:5,supported:6,query:7,result:8,prepare:9,execute:10,register:11,event:12,batch:13,authChallenge:14,authResponse:15,authSuccess:16,cancel:255,isInRange:function(u){return u>this.error&&u>this.event}},bV={topologyChange:"TOPOLOGY_CHANGE",statusChange:"STATUS_CHANGE",schemaChange:"SCHEMA_CHANGE"},_V={serverError:0,protocolError:10,badCredentials:256,unavailableException:4096,overloaded:4097,isBootstrapping:4098,truncateError:4099,writeTimeout:4352,readTimeout:4608,readFailure:4864,functionFailure:5120,writeFailure:5376,syntaxError:8192,unauthorized:8448,invalid:8704,configError:8960,alreadyExists:9216,unprepared:9472,clientWriteFailure:32768},CV={voidResult:1,rows:2,setKeyspace:3,prepared:4,schemaChange:5},RV={compression:1,tracing:2,customPayload:4,warning:8},AV=Object.freeze({unset:!0}),wV=Xu.fromInt(1e3),F1=0;function vV(u,e,t){let r,i,s,a;u&&(typeof u.msecs=="number"&&(r=new Date(u.msecs)),u.msecs instanceof Date&&(r=u.msecs),Array.isArray(u.node)&&(s=Vl.allocBufferFromArray(u.node)),typeof u.clockseq=="number"&&(a=Vl.allocBufferUnsafe(2),a.writeUInt16BE(u.clockseq,0)),typeof u.nsecs=="number"&&(i=u.nsecs));let o=new pL(r,i,s,a);return e instanceof Buffer?(o.getBuffer().copy(e,t||0),e):o.toString()}c(vV,"timeuuid");function IV(u,e,t){let r;return u&&Array.isArray(u.random)&&(r=new AE(Vl.allocBufferFromArray(u.random))),r||(r=AE.random()),e instanceof Buffer?(r.getBuffer().copy(e,t||0),e):r.toString()}c(IV,"uuid");function wE(u){if(!u||typeof u.code!="number")throw new ql.ArgumentError("Invalid signature type definition");let e=mV[u.code];if(!e)throw new ql.ArgumentError(Gl.format("Type with code %d not found",u.code));return u.info?Array.isArray(u.info)?e+"<"+u.info.map(function(t){return wE(t)}).join(", ")+">":typeof u.info.code=="number"?e+"<"+wE(u.info)+">":e:e}c(wE,"getDataTypeNameByCode");function xn(u,e,t,r,i){this.version=u,this.flags=e,this.streamId=t,this.opcode=r,this.bodyLength=i}c(xn,"FrameHeader");xn.size=function(u){return H1.uses2BytesStreamIds(u)?9:8};xn.getProtocolVersion=function(u){return u[0]&127};xn.fromBuffer=function(u,e){let t=0;e||(e=0);let r=u[e++]&127,i=u.readUInt8(e++);return H1.uses2BytesStreamIds(r)?(t=u.readInt16BE(e),e+=2):t=u.readInt8(e++),new xn(r,i,t,u.readUInt8(e++),u.readUInt32BE(e))};xn.prototype.toBuffer=function(){let u=Vl.allocBufferUnsafe(xn.size(this.version));u.writeUInt8(this.version,0),u.writeUInt8(this.flags,1);let e=3;return H1.uses2BytesStreamIds(this.version)?(u.writeInt16BE(this.streamId,2),e=4):u.writeInt8(this.streamId,2),u.writeUInt8(this.opcode,e++),u.writeUInt32BE(this.bodyLength,e),u};Xu.fromBuffer=function(u){if(!(u instanceof Buffer))throw new TypeError("Expected Buffer, obtained "+Gl.inspect(u));return new Xu(u.readInt32BE(4),u.readInt32BE(0))};Xu.toBuffer=function(u){if(!(u instanceof Xu))throw new TypeError("Expected Long, obtained "+Gl.inspect(u));let e=Vl.allocBufferUnsafe(8);return e.writeUInt32BE(u.getHighBitsUnsigned(),0),e.writeUInt32BE(u.getLowBitsUnsigned(),4),e};Xu.prototype.inspect=function(){return"Long: "+this.toString()};Xu.prototype.toJSON=function(){return this.toString()};function LV(u,e){u||(u=new Date);let t=Xu.ZERO;return typeof e=="number"&&e>=0&&e<1e3?t=Xu.fromInt(e):(F1>999&&(F1=0),t=Xu.fromInt(F1),F1++),Xu.fromNumber(u.getTime()).multiply(wV).add(t)}c(LV,"generateTimestamp");function yL(u){yL.super_.call(this,u.message,this.constructor),this.internalError=u}c(yL,"QueryParserError");Gl.inherits(yL,ql.DriverError);function vE(u){vE.super_.call(this,u,this.constructor),this.info="Represents an error that happens when the maximum amount of time for an operation passed."}c(vE,"TimeoutError");Gl.inherits(vE,ql.DriverError);ue.opcodes=TV;ue.consistencies=Ju;ue.consistencyToString=er;ue.dataTypes=M1;ue.getDataTypeNameByCode=wE;ue.distance=xV;ue.frameFlags=RV;ue.protocolEvents=bV;ue.protocolVersion=H1;ue.responseErrorCodes=_V;ue.resultKind=CV;ue.timeuuid=vV;ue.uuid=IV;ue.BigDecimal=z9();ue.Duration=$9();ue.FrameHeader=xn;ue.InetAddress=X9();ue.Integer=yE();ue.LocalDate=uL();ue.LocalTime=sL();ue.Long=Xu;ue.ResultSet=aL();ue.ResultStream=cL();ue.Row=hL();ue.DriverError=ql.DriverError;ue.TimeoutError=vE;ue.TimeUuid=pL;ue.Tuple=dL();ue.Uuid=AE;ue.unset=AV;ue.generateTimestamp=LV});var xL=w((ia0,mL)=>{"use strict";var Wl=require("util"),Ni=re(),q1=f0(),IE=ce(),SE=Object.freeze({done:!0}),SV=6e4;function Or(){}c(Or,"LoadBalancingPolicy");Or.prototype.init=function(u,e,t){this.client=u,this.hosts=e,t()};Or.prototype.getDistance=function(u){return Ni.distance.local};Or.prototype.newQueryPlan=function(u,e,t){t(new Error("You must implement a query plan for the LoadBalancingPolicy class"))};Or.prototype.getOptions=function(){return new Map};function KE(){this.index=0}c(KE,"RoundRobinPolicy");Wl.inherits(KE,Or);KE.prototype.newQueryPlan=function(u,e,t){if(!this.hosts)return t(new Error("Load balancing policy not initialized"));let r=this.hosts.values(),i=this,s=0,a=i.index%r.length;i.index+=1,i.index>=q1.maxInt&&(i.index=0),t(null,{next:function(){return++s>r.length?SE:{value:r[a++%r.length],done:!1}}})};function Ui(u){this.localDc=u,this.index=0,this.localHostsArray=null}c(Ui,"DCAwareRoundRobinPolicy");Wl.inherits(Ui,Or);Ui.prototype.init=function(u,e,t){this.client=u,this.hosts=e,e.on("add",this._cleanHostCache.bind(this)),e.on("remove",this._cleanHostCache.bind(this));try{EL(this,u,this.hosts)}catch(r){return t(r)}t()};Ui.prototype.getDistance=function(u){return u.datacenter===this.localDc?Ni.distance.local:Ni.distance.ignored};Ui.prototype._cleanHostCache=function(){this.localHostsArray=null};Ui.prototype._resolveLocalHosts=function(){let u=this.hosts.values();this.localHostsArray||(this.localHostsArray=[],u.forEach(function(e){e.datacenter&&e.datacenter===this.localDc&&this.localHostsArray.push(e)},this))};Ui.prototype.newQueryPlan=function(u,e,t){if(!this.hosts)return t(new Error("Load balancing policy not initialized"));this.index+=1,this.index>=q1.maxInt&&(this.index=0),this._resolveLocalHosts();let r=this.localHostsArray,i=this.index,s=0;t(null,{next:function(){let a;return s++[t,!0]))}c(ti,"AllowListPolicy");Wl.inherits(ti,Or);ti.prototype.init=function(u,e,t){this.childPolicy.init(u,e,t)};ti.prototype.getDistance=function(u){return this._contains(u)?this.childPolicy.getDistance(u):Ni.distance.ignored};ti.prototype._contains=function(u){return!!this.allowList.get(u.address)};ti.prototype.newQueryPlan=function(u,e,t){let r=this;this.childPolicy.newQueryPlan(u,e,function(i,s){if(i)return t(i);t(null,r._filter(s))})};ti.prototype._filter=function(u){let e=this;return{next:function(){let t=u.next();return!t.done&&!e._contains(t.value)?this.next():t}}};ti.prototype.getOptions=function(){return new Map([["childPolicy",this.childPolicy.constructor!==void 0?this.childPolicy.constructor.name:null],["allowList",Array.from(this.allowList.keys())]])};function gL(u,e){ti.call(this,u,e)}c(gL,"WhiteListPolicy");Wl.inherits(gL,ti);var V1=class V1 extends Or{constructor(e){super(),typeof e=="string"?e={localDc:e}:e||(e=q1.emptyObject),this._client=null,this._hosts=null,this._filteredHosts=null,this._preferredHost=null,this._index=0,this.localDc=e.localDc,this._filter=e.filter||this._defaultFilter,e.isHostNewlyUp&&(this._isHostNewlyUp=e.isHostNewlyUp),e.healthCheck&&(this._healthCheck=e.healthCheck),e.compare&&(this._compare=e.compare),e.getReplicas&&(this._getReplicas=e.getReplicas)}init(e,t,r){this._client=e,this._hosts=t,this._hosts.on("add",()=>this._filteredHosts=null),this._hosts.on("remove",()=>this._filteredHosts=null);try{EL(this,e,this._hosts)}catch(i){return r(i)}r()}getDistance(e){return this._preferredHost!==null&&e===this._preferredHost||this._filter(e)&&e.datacenter===this.localDc?Ni.distance.local:Ni.distance.ignored}newQueryPlan(e,t,r){let i,s;t&&(i=t.getRoutingKey(),t.getKeyspace()&&(e=t.getKeyspace()),s=t.getPreferredHost());let a;return!e||!i?a=this._getLocalHosts():a=this._getReplicasAndLocalHosts(e,i),s&&(this._preferredHost=s,a=V1._getPreferredHostFirst(s,a)),r(null,a)}static*_getPreferredHostFirst(e,t){yield e;for(let r of t)r!==e&&(yield r)}*_getLocalHosts(e){let t=this._getFilteredLocalHosts(),r=this._getIndex(),i=e?s=>e.indexOf(s)===-1:s=>!0;for(let s=0;sa&&(s=d,a=p),s===null&&!this._healthCheck(d)&&o++,i.push(d)}if(r=i,q1.shuffleArray(r),r.length<3)return this.yieldReplicasFirst(r);let h;if(s===null)o>0&&o=1){let f=s===r[0]?0:1;h=r[r.length-1],r[r.length-1]=r[f],r[f]=h}return this._compare(r[1],r[0])>0&&(h=r[0],r[0]=r[1],r[1]=h),this.yieldReplicasFirst(r)}*yieldReplicasFirst(e){for(let t=0;t=10&&e.getResponseCount()<=1)}_compare(e,t){return e.getInFlight()this._filter(e)&&e.datacenter===this.localDc)),this._filteredHosts}_getIndex(){let e=this._index++;return this._index===2147483647&&(this._index=0),e}_sendUnhealthyToTheBack(e,t){let r=0;for(let i=e.length-1;i>=0&&re.datacenter))}c(KV,"getDataCenters");mL.exports={AllowListPolicy:ti,DCAwareRoundRobinPolicy:Ui,DefaultLoadBalancingPolicy:LE,LoadBalancingPolicy:Or,RoundRobinPolicy:KE,TokenAwarePolicy:io,WhiteListPolicy:gL}});var bL=w(W1=>{"use strict";var TL=require("util");function zl(){}c(zl,"ReconnectionPolicy");zl.prototype.newSchedule=function(){throw new Error("You must implement a new schedule for the Reconnection class")};zl.prototype.getOptions=function(){return new Map};function G1(u){this.delay=u}c(G1,"ConstantReconnectionPolicy");TL.inherits(G1,zl);G1.prototype.newSchedule=function(){let u=this;return{next:function(){return{value:u.delay,done:!1}}}};G1.prototype.getOptions=function(){return new Map([["delay",this.delay]])};function Yl(u,e,t){this.baseDelay=u,this.maxDelay=e,this.startWithNoDelay=t}c(Yl,"ExponentialReconnectionPolicy");TL.inherits(Yl,zl);Yl.prototype.newSchedule=function*(){let u=this.startWithNoDelay?-1:0;for(;;){let e=0;u>=64?e=this.maxDelay:u!==-1&&(e=Math.min(Math.pow(2,u)*this.baseDelay,this.maxDelay)),u++,yield this._addJitter(e)}};Yl.prototype._addJitter=function(u){if(u===0)return u;let e=.85,t=.3;return!this.startWithNoDelay&&u===this.baseDelay?(e=1,t=.15):u===this.maxDelay&&(t=.15),Math.floor(u*(Math.random()*t+e))};Yl.prototype.getOptions=function(){return new Map([["baseDelay",this.baseDelay],["maxDelay",this.maxDelay],["startWithNoDelay",this.startWithNoDelay]])};W1.ReconnectionPolicy=zl;W1.ConstantReconnectionPolicy=G1;W1.ExponentialReconnectionPolicy=Yl});var NE=w(z1=>{"use strict";var _L=require("util");function Fu(){}c(Fu,"RetryPolicy");Fu.prototype.onUnavailable=function(u,e,t,r){return u.nbRetry>0?this.rethrowResult():this.retryResult(void 0,!1)};Fu.prototype.onReadTimeout=function(u,e,t,r,i){return u.nbRetry>0?this.rethrowResult():t>=r&&!i?this.retryResult():this.rethrowResult()};Fu.prototype.onWriteTimeout=function(u,e,t,r,i){return u.nbRetry>0?this.rethrowResult():i==="BATCH_LOG"?this.retryResult():this.rethrowResult()};Fu.prototype.onRequestError=function(u,e,t){return this.retryResult(void 0,!1)};Fu.prototype.retryResult=function(u,e){return{decision:Fu.retryDecision.retry,consistency:u,useCurrentHost:e!==!1}};Fu.prototype.rethrowResult=function(){return{decision:Fu.retryDecision.rethrow}};Fu.retryDecision={rethrow:0,retry:1,ignore:2};function so(u){this._childPolicy=u||new Fu}c(so,"IdempotenceAwareRetryPolicy");_L.inherits(so,Fu);so.prototype.onReadTimeout=function(u,e,t,r,i){return this._childPolicy.onReadTimeout(u,e,t,r,i)};so.prototype.onRequestError=function(u,e,t){return u.executionOptions.isIdempotent()?this._childPolicy.onRequestError(u,e,t):this.rethrowResult()};so.prototype.onUnavailable=function(u,e,t,r){return this._childPolicy.onUnavailable(u,e,t,r)};so.prototype.onWriteTimeout=function(u,e,t,r,i){return u.executionOptions.isIdempotent()?this._childPolicy.onWriteTimeout(u,e,t,r,i):this.rethrowResult()};function no(){}c(no,"FallthroughRetryPolicy");_L.inherits(no,Fu);no.prototype.onReadTimeout=function(){return this.rethrowResult()};no.prototype.onRequestError=function(){return this.rethrowResult()};no.prototype.onUnavailable=function(){return this.rethrowResult()};no.prototype.onWriteTimeout=function(){return this.rethrowResult()};z1.IdempotenceAwareRetryPolicy=so;z1.FallthroughRetryPolicy=no;z1.RetryPolicy=Fu});var AL=w(Q1=>{"use strict";var RL=require("util"),CL=ce();function Tn(){}c(Tn,"SpeculativeExecutionPolicy");Tn.prototype.init=function(u){};Tn.prototype.shutdown=function(){};Tn.prototype.newPlan=function(u,e){throw new Error("You must implement newPlan() method in the SpeculativeExecutionPolicy")};Tn.prototype.getOptions=function(){return new Map};function UE(){this._plan={nextExecution:function(){return-1}}}c(UE,"NoSpeculativeExecutionPolicy");RL.inherits(UE,Tn);UE.prototype.newPlan=function(){return this._plan};function Y1(u,e){if(!(u>=0))throw new CL.ArgumentError("delay must be a positive number or zero");if(!(e>0))throw new CL.ArgumentError("maxSpeculativeExecutions must be a positive number");this._delay=u,this._maxSpeculativeExecutions=e}c(Y1,"ConstantSpeculativeExecutionPolicy");RL.inherits(Y1,Tn);Y1.prototype.newPlan=function(){let u=0,e=this;return{nextExecution:function(){return u++{"use strict";var wL=require("util"),{Long:PE}=re(),OV=ce(),NV=9007199254740,UV=PE.fromInt(1e3);function kE(){}c(kE,"TimestampGenerator");kE.prototype.next=function(u){throw new Error("next() must be implemented")};function Ql(u,e){if(u<0)throw new OV.ArgumentError("warningThreshold can not be lower than 0");this._warningThreshold=u||1e3,this._minLogInterval=1e3,typeof e=="number"&&(this._minLogInterval=e),this._micros=-1,this._lastDate=0,this._lastLogDate=0}c(Ql,"MonotonicTimestampGenerator");wL.inherits(Ql,kE);Ql.prototype.getDate=function(){return Date.now()};Ql.prototype.next=function(u){let e=this.getDate(),t=0;if(e>this._lastDate)return this._micros=0,this._lastDate=e,this._generateMicroseconds();e=this._warningThreshold){let s=Date.now();if(this._minLogInterval>0&&this._lastLogDate+this._minLogInterval<=s){let a=wL.format("Timestamp generated using current date was %d milliseconds behind the last generated timestamp (which millisecond portion was %d), the returned value (%s) is being artificially incremented to guarantee monotonicity.",t,r,i);this._lastLogDate=s,u.log("warning",a)}}return i};Ql.prototype._generateMicroseconds=function(){return this._lastDate{"use strict";var PV=Mu.addressResolution=w9(),kV=Mu.loadBalancing=xL(),BV=Mu.reconnection=bL(),FV=Mu.retry=NE(),MV=Mu.speculativeExecution=AL(),HV=Mu.timestampGeneration=vL();Mu.defaultAddressTranslator=function(){return new PV.AddressTranslator};Mu.defaultLoadBalancingPolicy=function(u){return new kV.DefaultLoadBalancingPolicy(u)};Mu.defaultRetryPolicy=function(){return new FV.RetryPolicy};Mu.defaultReconnectionPolicy=function(){return new BV.ExponentialReconnectionPolicy(1e3,10*60*1e3,!1)};Mu.defaultSpeculativeExecutionPolicy=function(){return new MV.NoSpeculativeExecutionPolicy};Mu.defaultTimestampGenerator=function(){return new HV.MonotonicTimestampGenerator}});var ME=w((ya0,IL)=>{"use strict";var FE=class FE{onSuccess(e,t,r,i,s,a,o){}onError(e,t,r,i,s,a,o){}shutdown(){}};c(FE,"RequestTracker");var DE=FE;IL.exports=DE});var UL=w((Ea0,NL)=>{"use strict";var qV=require("events"),VV=ME(),GV=ce(),{format:jl}=require("util"),WV=1e6,zV=500,YV=50,LL=200,qE=class qE extends VV{constructor(e){if(super(),!e)throw new GV.ArgumentError("RequestLogger options parameter is required");this._options=e,this.logNormalRequests=this._options.logNormalRequests,this.logErroredRequests=this._options.logErroredRequests,this.emitter=new qV.EventEmitter}onSuccess(e,t,r,i,s,a,o){this._options.slowThreshold>0&&ao(o)>this._options.slowThreshold?this._logSlow(e,t,r,i,s,a,o):this._options.requestSizeThreshold>0&&s>this._options.requestSizeThreshold?this._logLargeRequest(e,t,r,i,s,a,o):this.logNormalRequests&&this._logNormalRequest(e,t,r,i,s,a,o)}onError(e,t,r,i,s,a,o){this._options.requestSizeThreshold>0&&s>this._options.requestSizeThreshold?this._logLargeErrorRequest(e,t,r,i,s,a,o):this.logErroredRequests&&this._logErrorRequest(e,t,r,i,s,a,o)}_logSlow(e,t,r,i,s,a,o){let h=jl("[%s] Slow request, took %d ms (%s): %s",e.address,Math.floor(ao(o)),Zl(s,a),$l(t,r,i,this._options));this.emitter.emit("slow",h)}_logLargeRequest(e,t,r,i,s,a,o){let h=jl("[%s] Request exceeded length, %s (took %d ms): %s",e.address,Zl(s,a),~~ao(o),$l(t,r,i,this._options));this.emitter.emit("large",h)}_logNormalRequest(e,t,r,i,s,a,o){let h=jl("[%s] Request completed normally, took %d ms (%s): %s",e.address,~~ao(o),Zl(s,a),$l(t,r,i,this._options));this.emitter.emit("normal",h)}_logLargeErrorRequest(e,t,r,i,s,a,o){let h=this._options.messageMaxErrorStackTraceLength||LL,f=jl("[%s] Request exceeded length and execution failed, %s (took %d ms): %s; error: %s",e.address,Zl(s),~~ao(o),$l(t,r,i,this._options),a.stack.substr(0,h));this.emitter.emit("large",f)}_logErrorRequest(e,t,r,i,s,a,o){let h=this._options.messageMaxErrorStackTraceLength||LL,f=jl("[%s] Request execution failed, took %d ms (%s): %s; error: %s",e.address,~~ao(o),Zl(s),$l(t,r,i,this._options),a.stack.substr(0,h));this.emitter.emit("failure",f)}};c(qE,"RequestLogger");var HE=qE;function ao(u){return u[0]*1e3+u[1]/WV}c(ao,"toMillis");function $l(u,e,t,r){let i=r.messageMaxQueryLength||zV,s=r.messageMaxParameterValueLength||YV;if(Array.isArray(u))return QV(u,t,i,s);let a=u.substr(0,i),o=i-a.length-1;return a+=OL(e,o,s),t.isPrepared()||(a+=" (not prepared)"),a}c($l,"getStatementInfo");function QV(u,e,t,r){let i=(e.isBatchLogged()?"LOGGED ":"")+"BATCH w/ "+u.length+(e.isPrepared()?"":" not prepared")+" queries (",s=t,a;for(a=0;a0;a++){let o=u[a],h=o.params;typeof o!="string"&&(o=o.query),a>0&&(i+=",",s--);let f=Math.min(s,o.length);if(i+=o.substr(0,f),s-=f,s<=0)break;let d=OL(h,s,r);s-=d.length,i+=d}return i+=aSL(u[a],o),"paramStringifier");if(!Array.isArray(u)){let a=u;u=Object.keys(u),r=c((o,h)=>{let f=u[o],d=f.substr(0,h),p=h-d.length-1;return p<=0||(d+=":"+SL(a[f],p)),d},"paramStringifier")}let i=" [",s;for(s=0;e>0&&s0&&(i+=",",e--);let a=r(s,Math.min(t,e));e-=a.length,i+=a}return s1e3?Math.round(u/1024)+" KB":u+" bytes"}c(KL,"formatSize");NL.exports=HE});var GE=w(VE=>{"use strict";VE.RequestLogger=UL();VE.RequestTracker=ME()});var YE=w((Ta0,PL)=>{"use strict";var zE=class zE{onAuthenticationError(e){}onClientTimeoutError(e){}onConnectionError(e){}onOtherError(e){}onReadTimeoutError(e){}onWriteTimeoutError(e){}onUnavailableError(e){}onClientTimeoutRetry(e){}onOtherErrorRetry(e){}onReadTimeoutRetry(e){}onUnavailableRetry(e){}onWriteTimeoutRetry(e){}onIgnoreError(e){}onSpeculativeExecution(){}onSuccessfulResponse(e){}onResponse(e){}};c(zE,"ClientMetrics");var WE=zE;PL.exports=WE});var BL=w((_a0,kL)=>{"use strict";var jV=YE(),Et=require("events"),jE=class jE extends jV{constructor(){super(),this.errors=new Et,this.errors.authentication=new Et,this.errors.clientTimeout=new Et,this.errors.connection=new Et,this.errors.other=new Et,this.errors.readTimeout=new Et,this.errors.unavailable=new Et,this.errors.writeTimeout=new Et,this.retries=new Et,this.retries.clientTimeout=new Et,this.retries.other=new Et,this.retries.readTimeout=new Et,this.retries.unavailable=new Et,this.retries.writeTimeout=new Et,this.speculativeExecutions=new Et,this.ignoredErrors=new Et,this.responses=new Et,this.responses.success=new Et}onAuthenticationError(e){this.errors.authentication.emit("increment",e),this.errors.emit("increment",e)}onConnectionError(e){this.errors.connection.emit("increment",e),this.errors.emit("increment",e)}onReadTimeoutError(e){this.errors.readTimeout.emit("increment",e),this.errors.emit("increment",e)}onWriteTimeoutError(e){this.errors.writeTimeout.emit("increment",e),this.errors.emit("increment",e)}onUnavailableError(e){this.errors.unavailable.emit("increment",e),this.errors.emit("increment",e)}onClientTimeoutError(e){this.errors.clientTimeout.emit("increment",e),this.errors.emit("increment",e)}onOtherError(e){this.errors.other.emit("increment",e),this.errors.emit("increment",e)}onClientTimeoutRetry(e){this.retries.clientTimeout.emit("increment",e),this.retries.emit("increment",e)}onOtherErrorRetry(e){this.retries.other.emit("increment",e),this.retries.emit("increment",e)}onReadTimeoutRetry(e){this.retries.readTimeout.emit("increment",e),this.retries.emit("increment",e)}onUnavailableRetry(e){this.retries.unavailable.emit("increment",e),this.retries.emit("increment",e)}onWriteTimeoutRetry(e){this.retries.writeTimeout.emit("increment",e),this.retries.emit("increment",e)}onIgnoreError(e){this.ignoredErrors.emit("increment",e)}onSpeculativeExecution(){this.speculativeExecutions.emit("increment")}onSuccessfulResponse(e){this.responses.success.emit("increment",e)}onResponse(e){this.responses.emit("increment",e)}};c(jE,"DefaultMetrics");var QE=jE;kL.exports=QE});var $E=w((Ra0,DL)=>{"use strict";var $V=YE(),ZV=BL();DL.exports={ClientMetrics:$V,DefaultMetrics:ZV}});var bn=w(ZE=>{"use strict";function FL(){}c(FL,"AuthProvider");FL.prototype.newAuthenticator=function(u,e){throw new Error("This is an abstract class, you must implement newAuthenticator method or use another auth provider that inherits from this class")};function $1(){}c($1,"Authenticator");$1.prototype.initialResponse=function(u){u(new Error("Not implemented"))};$1.prototype.evaluateChallenge=function(u,e){e(new Error("Not implemented"))};$1.prototype.onAuthenticationSuccess=function(u){};ZE.AuthProvider=FL;ZE.Authenticator=$1});var JE=w((va0,qL)=>{"use strict";var ML=require("util"),HL=bn(),Z1=f0(),XV=HL.AuthProvider,JV=HL.Authenticator;function XE(u,e){this.username=u,this.password=e}c(XE,"PlainTextAuthProvider");ML.inherits(XE,XV);XE.prototype.newAuthenticator=function(){return new Xl(this.username,this.password)};function Xl(u,e){this.username=u,this.password=e}c(Xl,"PlainTextAuthenticator");ML.inherits(Xl,JV);Xl.prototype.initialResponse=function(u){let e=Buffer.concat([Z1.allocBufferFromArray([0]),Z1.allocBufferFromString(this.username,"utf8"),Z1.allocBufferFromArray([0]),Z1.allocBufferFromString(this.password,"utf8")]);u(null,e)};Xl.prototype.evaluateChallenge=function(u,e){e()};qL.exports={PlainTextAuthenticator:Xl,PlainTextAuthProvider:XE}});var em=w((La0,VL)=>{"use strict";var eG=require("util"),{Authenticator:tG}=bn(),uG="com.datastax.bdp.cassandra.auth.DseAuthenticator";function oo(u){this.authenticatorName=u}c(oo,"BaseDseAuthenticator");eG.inherits(oo,tG);oo.prototype.getMechanism=function(){throw new Error("Not implemented")};oo.prototype.getInitialServerChallenge=function(){throw new Error("Not implemented")};oo.prototype.initialResponse=function(u){if(!this._isDseAuthenticator())return this.evaluateChallenge(this.getInitialServerChallenge(),u);u(null,this.getMechanism())};oo.prototype._isDseAuthenticator=function(){return this.authenticatorName===uG};VL.exports=oo});var zL=w((Ka0,WL)=>{"use strict";var rG=require("util"),GL=f0(),um=class um{constructor(e,t){this.authorizationId=e,this.service=t!==void 0?t:"dse"}init(e,t){throw new Error("Not implemented")}evaluateChallenge(e,t){throw new Error("Not implemented")}shutdown(e){throw new Error("Not implemented")}static createNew(e,t,r){return new tm(e,t,r)}};c(um,"GssapiClient");var X1=um,rm=class rm extends X1{constructor(e,t,r){if(typeof e.initializeClient!="function")throw new Error("The driver expects version 1.x of the kerberos library");super(t,r),this.kerberos=e,this.transitionIndex=0}init(e,t){this.host=e;let r=this.service;this.host&&(r=rG.format("%s@%s",this.service,this.host));let i={gssFlags:this.kerberos.GSS_C_MUTUAL_FLAG};this.kerberos.initializeClient(r,i,(s,a)=>{if(s)return t(s);this.kerberosClient=a,t()})}evaluateChallenge(e,t){this["transition"+this.transitionIndex](e,(r,i)=>{if(r)return t(r);this.transitionIndex++,t(null,i?GL.allocBufferFromString(i,"base64"):GL.allocBuffer(0))})}transition0(e,t){this.kerberosClient.step("",t)}transition1(e,t){let r=e.toString("base64");this.kerberosClient.step(r,t)}transition2(e,t){this.kerberosClient.unwrap(e.toString("base64"),(r,i)=>{if(r)return t(r,!1);let s=c(function(a,o){if(a)return t(a);t(null,o)},"cb");this.authorizationId!==void 0?this.kerberosClient.wrap(i,{user:this.authorizationId},s):this.kerberosClient.wrap(i,null,s)})}shutdown(e){this.kerberosClient=null,e()}};c(rm,"StandardGssClient");var tm=rm;WL.exports=X1});var ZL=w((Na0,$L)=>{"use strict";var YL=require("util"),{AuthProvider:iG}=bn(),QL=em(),sG=zL(),im=require("dns"),Jl=f0(),nG=Jl.allocBufferFromString("GSSAPI"),jL="GSSAPI-START",aG=Jl.allocBuffer(0);function ys(u){try{this._kerberos=require("kerberos")}catch(e){if(e.code==="MODULE_NOT_FOUND"){let t=new Error('You must install module "kerberos" to use GSSAPI auth provider: https://www.npmjs.com/package/kerberos');throw t.code=e.code,t}throw e}u=u||Jl.emptyObject,this.authorizationId=u.authorizationId||u.user,this.service=u.service,this.hostNameResolver=u.hostNameResolver||ys.lookupServiceResolver}c(ys,"DseGssapiAuthProvider");YL.inherits(ys,iG);ys.prototype.newAuthenticator=function(u,e){let t=u;return u.indexOf(":")>0&&(t=u.split(":")[0]),new _n(this._kerberos,t,e,this.authorizationId,this.service,this.hostNameResolver)};ys.lookupServiceResolver=function(u,e){if(!im.lookupService)return ys.reverseDnsResolver(u,e);im.lookupService(u,0,function(t,r){if(t)return e(t);if(!r)return e(null,u);e(null,r)})};ys.reverseDnsResolver=function(u,e){im.reverse(u,function(t,r){if(t)return e(t);if(!r||!r.length)return e(null,u);e(null,r[0])})};ys.useIpResolver=function(u,e){e(null,u)};function _n(u,e,t,r,i,s){QL.call(this,t),this.authorizationId=r,this.address=e,this.client=sG.createNew(u,r,i),this.hostNameResolver=s}c(_n,"GssapiAuthenticator");YL.inherits(_n,QL);_n.prototype.getMechanism=function(){return nG};_n.prototype.getInitialServerChallenge=function(){return Jl.allocBufferFromString(jL)};_n.prototype.initialResponse=function(u){let e=this,t=this.address;Jl.series([c(function(i){e.hostNameResolver(e.address,function(s,a){!s&&a&&(t=a),i()})},"getHostName"),c(function(i){e.client.init(t,function(s){if(s)return i(s);if(!e._isDseAuthenticator())return e.evaluateChallenge(e.getInitialServerChallenge(),i);i(null,e.getMechanism())})},"initClient")],u)};_n.prototype.evaluateChallenge=function(u,e){(!u||u.toString()===jL)&&(u=aG),this.client.evaluateChallenge(u,e)};_n.prototype.onAuthenticationSuccess=function(u){this.client.shutdown(c(function(){},"noop"))};$L.exports=ys});var rS=w((Pa0,uS)=>{"use strict";var JL=require("util"),{AuthProvider:oG}=bn(),eS=em(),co=f0(),cG=co.allocBufferFromString("PLAIN"),XL=co.allocBufferFromArray([0]),tS="PLAIN-START";function sm(u,e,t){if(typeof u!="string"||typeof e!="string")throw new TypeError("Username and password must be a string");this.username=u,this.password=e,this.authorizationId=t}c(sm,"DsePlainTextAuthProvider");JL.inherits(sm,oG);sm.prototype.newAuthenticator=function(u,e){return new eh(e,this.username,this.password,this.authorizationId)};function eh(u,e,t,r){eS.call(this,u),this.authenticatorId=co.allocBufferFromString(e),this.password=co.allocBufferFromString(t),this.authorizationId=co.allocBufferFromString(r||"")}c(eh,"PlainTextAuthenticator");JL.inherits(eh,eS);eh.prototype.getMechanism=function(){return cG};eh.prototype.getInitialServerChallenge=function(){return co.allocBufferFromString(tS)};eh.prototype.evaluateChallenge=function(u,e){if(!u||u.toString()!==tS)return e(new Error("Incorrect SASL challenge from server"));e(null,Buffer.concat([this.authorizationId,XL,this.authenticatorId,XL,this.password]))};uS.exports=sm});var sS=w((Ba0,iS)=>{"use strict";var{AuthProvider:lG,Authenticator:hG}=bn(),{PlainTextAuthenticator:fG}=JE(),dG=ce(),pG="com.datastax.bdp.cassandra.auth.DseAuthenticator",cm=class cm extends lG{newAuthenticator(e,t){return t===pG?new om:new am(e)}};c(cm,"NoAuthProvider");var nm=cm,lm=class lm extends hG{constructor(e){super(),this.endpoint=e}initialResponse(e){e(new dG.AuthenticationError(`Host ${this.endpoint} requires authentication, but no authenticator found in the options`))}};c(lm,"NoAuthAuthenticator");var am=lm,hm=class hm extends fG{constructor(){super("","")}};c(hm,"TransitionalModePlainTextAuthenticator");var om=hm;iS.exports=nm});var th=w((Fa0,nS)=>{"use strict";var{Authenticator:yG,AuthProvider:gG}=bn(),{PlainTextAuthProvider:EG}=JE(),mG=ZL(),xG=rS(),TG=sS();nS.exports={Authenticator:yG,AuthProvider:gG,DseGssapiAuthProvider:mG,DsePlainTextAuthProvider:xG,NoAuthProvider:TG,PlainTextAuthProvider:EG}});var Ml=w(Pr=>{"use strict";var aS=require("util"),Nr=j1(),Ur=re(),oS=f0(),bG=GE(),cS=$E(),fm=th(),lS={[Ur.distance.local]:2,[Ur.distance.remote]:1,[Ur.distance.ignored]:0},hS={[Ur.distance.local]:1,[Ur.distance.remote]:1,[Ur.distance.ignored]:0},fS=128,dS=2048,_G="bytes",CG=5e3,RG=1e4;function pS(){return{policies:{addressResolution:Nr.defaultAddressTranslator(),loadBalancing:Nr.defaultLoadBalancingPolicy(),reconnection:Nr.defaultReconnectionPolicy(),retry:Nr.defaultRetryPolicy(),speculativeExecution:Nr.defaultSpeculativeExecutionPolicy(),timestampGeneration:Nr.defaultTimestampGenerator()},queryOptions:{fetchSize:5e3,prepare:!1,captureStackTrace:!1},protocolOptions:{port:9042,maxSchemaAgreementWaitSeconds:10,maxVersion:0,noCompact:!1},pooling:{heartBeatInterval:3e4,warmup:!0},socketOptions:{connectTimeout:5e3,defunctReadTimeoutThreshold:64,keepAlive:!0,keepAliveDelay:0,readTimeout:12e3,tcpNoDelay:!0,coalescingThreshold:65536},authProvider:null,requestTracker:null,metrics:new cS.DefaultMetrics,maxPrepared:500,refreshSchemaDelay:1e3,isMetadataSyncEnabled:!0,prepareOnAllHosts:!0,rePrepareOnUp:!0,encoding:{copyBuffer:!0,useUndefinedAsUnset:!0},monitorReporting:{enabled:!0}}}c(pS,"defaultOptions");function AG(u,e){arguments.length===1&&(e=arguments[0],u={});let t=oS.deepExtend(u,pS(),e);if(t.cloud)wG(t);else{if(!Array.isArray(t.contactPoints)||t.contactPoints.length===0)throw new TypeError("Contacts points are not defined.");for(let r=0;r"u")throw new TypeError("BigInt is not supported by the JavaScript engine")}c(KG,"validateEncodingOptions");function OG(u){function e(t){let r=u[t];if(r!=null&&typeof r!="string")throw new TypeError(`${t} should be a String`)}if(c(e,"validateString"),e("applicationName"),e("applicationVersion"),u.id!==null&&u.id!==void 0&&!(u.id instanceof Ur.Uuid))throw new TypeError("Client id must be a Uuid")}c(OG,"validateApplicationInfo");function NG(u){let e=u.monitorReporting;if(e===null||typeof e!="object")throw new TypeError(`Monitor reporting must be an object, obtained: ${e}`)}c(NG,"validateMonitorReporting");function UG(u){let e=u.controlConnection.protocolVersion,t=hS,r=dS;Ur.protocolVersion.uses2BytesStreamIds(e)||(t=lS,r=fS),u.options.queryOptions.consistency===void 0&&(u.options.queryOptions.consistency=u.metadata.isDbaas()?Ur.consistencies.localQuorum:Ur.consistencies.localOne),u.options.pooling=oS.deepExtend({},{coreConnectionsPerHost:t,maxRequestsPerConnection:r},u.options.pooling)}c(UG,"setMetadataDependent");Pr.extend=AG;Pr.defaultOptions=pS;Pr.coreConnectionsPerHostV2=lS;Pr.coreConnectionsPerHostV3=hS;Pr.maxRequestsPerConnectionV2=fS;Pr.maxRequestsPerConnectionV3=dS;Pr.setMetadataDependent=UG;Pr.continuousPageUnitBytes=_G;Pr.continuousPageDefaultSize=CG;Pr.continuousPageDefaultHighWaterMark=RG});var gm=w((qa0,ES)=>{"use strict";var yS=f0(),gS=re(),PG=iu();function dm(u,e){if(typeof u!="string")throw new TypeError("Execution profile name must be a string");e=e||yS.emptyObject;let t=e.graphOptions||yS.emptyObject;this.name=u,this.consistency=e.consistency,this.loadBalancing=e.loadBalancing,this.readTimeout=e.readTimeout,this.retry=e.retry,this.serialConsistency=e.serialConsistency,this.graphOptions={language:t.language,results:t.results,name:t.name,readConsistency:t.readConsistency,source:t.source,writeConsistency:t.writeConsistency}}c(dm,"ExecutionProfile");var ym=class ym{constructor(e){this._profiles=e.profiles||[],this._defaultConfiguredRetryPolicy=void 0,this._setDefault(e),this._loadBalancingPolicies=[],this._profilesMap={},this._customPayloadCache={},this._graphOptionsCache={},this._profiles.forEach(function(t){return this._profilesMap[t.name]=t,t.loadBalancing=t.loadBalancing||this._defaultProfile.loadBalancing,this._loadBalancingPolicies.indexOf(t.loadBalancing)===-1&&this._loadBalancingPolicies.push(t.loadBalancing),t},this)}async init(e,t){for(let r of this._loadBalancingPolicies)await PG.fromCallback(i=>r.init(e,t,i))}getDistance(e){let t=gS.distance.ignored;for(let r=0;r{"use strict";var kG=require("events"),J1=re(),lo=f0(),BG=J1.FrameHeader,xm=class xm{constructor(e){if(!e)throw new Error("Opcode not provided");this.buffers=[],this.opcode=e,this.bodyLength=0}add(e){this.buffers.push(e),this.bodyLength+=e.length}writeShort(e){let t=lo.allocBufferUnsafe(2);t.writeUInt16BE(e,0),this.add(t)}writeInt(e){let t=lo.allocBufferUnsafe(4);t.writeInt32BE(e,0),this.add(t)}writeLong(e){this.add(J1.Long.toBuffer(e))}writeBytes(e){if(e===null){this.writeInt(-1);return}if(e===J1.unset){this.writeInt(-2);return}this.writeInt(e.length),this.add(e)}writeShortBytes(e){if(e===null){this.writeShort(-1);return}this.writeShort(e.length),this.add(e)}writeByte(e){this.add(lo.allocBufferFromArray([e]))}writeString(e){if(typeof e>"u")throw new Error("can not write undefined");let t=Buffer.byteLength(e,"utf8"),r=lo.allocBufferUnsafe(2+t);r.writeUInt16BE(t,0),r.write(e,2,r.length-2,"utf8"),this.add(r)}writeLString(e){let t=Buffer.byteLength(e,"utf8"),r=lo.allocBufferUnsafe(4+t);r.writeInt32BE(t,0),r.write(e,4,r.length-4,"utf8"),this.add(r)}writeStringList(e){this.writeShort(e.length),e.forEach(this.writeString,this)}writeCustomPayload(e){let t=Object.keys(e);this.writeShort(t.length),t.forEach(r=>{this.writeString(r),this.writeBytes(e[r])})}writeStringMap(e){let t=[];for(let r in e)e.hasOwnProperty(r)&&t.push(r);this.writeShort(t.length);for(let r=0;r{this.canWrite=!0,this.run()})}push(e,t){let r=this;if(this.error)return process.nextTick(c(function(){t(r.error)},"writePushError"));this.queue.push({operation:e,callback:t}),this.run()}run(){!this.isRunning&&this.canWrite&&(this.isRunning=!0,process.nextTick(()=>this.process()))}process(){if(this.error)return;let e=[],t=[],r=0;for(;this.queue.length>0&&r{if(i){this.setWriteError(i);return}if(this.queue.length===0||!this.canWrite){this.isRunning=!1;return}setImmediate(()=>this.process())})}setWriteError(e){e.isSocketError=!0,this.error=new J1.DriverError("Socket was closed"),this.error.isSocketError=!0,this.error.requestNotWritten=!0,this.error.innerError=e;let t=this.queue;this.queue=lo.emptyArray;for(let r=0;r{"use strict";var uh=f0(),xS=re(),DG=ce(),e3="ProxyExecute",u3=class u3{constructor(){}static empty(){return new u3}getCaptureStackTrace(){}getConsistency(){}getCustomPayload(){}getFetchSize(){}getFixedHost(){}getHints(){}isAutoPage(){}isBatchCounter(){}isBatchLogged(){}isIdempotent(){}isPrepared(){}isQueryTracing(){}getKeyspace(){}getLoadBalancingPolicy(){}getPageState(){}getPreferredHost(){}getRawQueryOptions(){}getReadTimeout(){}getRetryPolicy(){}getRowCallback(){}getOrGenerateTimestamp(){}getRoutingIndexes(){}getRoutingKey(){}getRoutingNames(){}getSerialConsistency(){}getTimestamp(){}setHints(e){}setKeyspace(e){}setPageState(){}setPreferredHost(){}setRoutingIndexes(e){}setRoutingKey(e){}};c(u3,"ExecutionOptions");var t3=u3,ih=class ih extends t3{constructor(e,t,r){if(super(),this._queryOptions=e,this._rowCallback=r,this._routingKey=this._queryOptions.routingKey,this._hints=this._queryOptions.hints,this._keyspace=this._queryOptions.keyspace,this._routingIndexes=this._queryOptions.routingIndexes,this._pageState=typeof this._queryOptions.pageState=="string"?uh.allocBufferFromString(this._queryOptions.pageState,"hex"):this._queryOptions.pageState,this._preferredHost=null,this._client=t,this._defaultQueryOptions=t.options.queryOptions,this._profile=t.profileManager.getProfile(this._queryOptions.executionProfile),this._customPayload=ih.createCustomPayload(this._queryOptions,this._defaultQueryOptions),!this._profile)throw new DG.ArgumentError(`Execution profile "${this._queryOptions.executionProfile}" not found`)}static createCustomPayload(e,t){let r=e.customPayload||t.customPayload,i=e.executeAs||t.executeAs;return i&&(r?r[e3]||(r=uh.extend({},r),r[e3]=uh.allocBufferFromString(i)):(r={},r[e3]=uh.allocBufferFromString(i))),r}static create(e,t,r){return(!e||typeof e=="function")&&(e=uh.emptyObject),new ih(e,t,r)}getCaptureStackTrace(){return Cn(this._queryOptions.captureStackTrace,this._defaultQueryOptions.captureStackTrace)}getConsistency(){return rh(this._queryOptions.consistency,this._profile.consistency,this._defaultQueryOptions.consistency)}getCustomPayload(){return this._customPayload}getFetchSize(){return Cn(this._queryOptions.fetchSize,this._defaultQueryOptions.fetchSize)}getFixedHost(){return this._queryOptions.host}getHints(){return this._hints}isAutoPage(){return Cn(this._queryOptions.autoPage,this._defaultQueryOptions.autoPage)}isBatchCounter(){return Cn(this._queryOptions.counter,!1)}isBatchLogged(){return rh(this._queryOptions.logged,this._defaultQueryOptions.logged,!0)}isIdempotent(){return Cn(this._queryOptions.isIdempotent,this._defaultQueryOptions.isIdempotent)}isPrepared(){return Cn(this._queryOptions.prepare,this._defaultQueryOptions.prepare)}isQueryTracing(){return Cn(this._queryOptions.traceQuery,this._defaultQueryOptions.traceQuery)}getKeyspace(){return this._keyspace}getLoadBalancingPolicy(){return this._profile.loadBalancing}getOrGenerateTimestamp(){let e=this.getTimestamp();if(e===void 0){let t=this._client.options.policies.timestampGeneration;xS.protocolVersion.supportsTimestamp(this._client.controlConnection.protocolVersion)&&t?e=t.next(this._client):e=null}return typeof e=="number"?xS.Long.fromNumber(e):e}getPageState(){return this._pageState}getProfile(){return this._profile}getRawQueryOptions(){return this._queryOptions}getReadTimeout(){return rh(this._queryOptions.readTimeout,this._profile.readTimeout,this._client.options.socketOptions.readTimeout)}getRetryPolicy(){return rh(this._queryOptions.retry,this._profile.retry,this._client.options.policies.retry)}getRoutingIndexes(){return this._routingIndexes}getRoutingKey(){return this._routingKey}getRoutingNames(){return this._queryOptions.routingNames}getRowCallback(){return this._rowCallback}getSerialConsistency(){return rh(this._queryOptions.serialConsistency,this._profile.serialConsistency,this._defaultQueryOptions.serialConsistency)}getTimestamp(){return this._queryOptions.timestamp}setCustomPayload(e){this._customPayload=e}setHints(e){this._hints=e}setKeyspace(e){this._keyspace=e}setPageState(e){this._pageState=e}setRoutingIndexes(e){this._routingIndexes=e}setRoutingKey(e){this._routingKey=e}};c(ih,"DefaultExecutionOptions");var _m=ih;function Cn(u,e){return u!==void 0?u:e}c(Cn,"ifUndefined");function rh(u,e,t){return u!==void 0?u:e!==void 0?e:t}c(rh,"ifUndefined3");TS.exports={ExecutionOptions:t3,DefaultExecutionOptions:_m,proxyExecuteKey:e3}});var ho=w((Qa0,FG)=>{FG.exports={name:"cassandra-driver",version:"4.7.2",description:"DataStax Node.js Driver for Apache Cassandra",author:"DataStax",keywords:["cassandra","cql","cql3","connection","gremlin","datastax","nosql","driver","database","dse","graph","graphdb"],license:"Apache-2.0",types:"./index.d.ts",dependencies:{"@types/long":"~5.0.0","@types/node":">=8","adm-zip":"~0.5.10",long:"~5.2.3"},devDependencies:{chai:"~4.3.8",kerberos:"~2.0.3",mocha:"~10.2.0","mocha-jenkins-reporter":"~0.4.8",proxyquire:"~2.1.3",sinon:"~15.2.0",temp:">= 0.8.3"},repository:{type:"git",url:"https://github.com/datastax/nodejs-driver.git"},bugs:{url:"https://groups.google.com/a/lists.datastax.com/forum/#!forum/nodejs-driver-user"},scripts:{test:"./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive",unit:"./node_modules/.bin/mocha test/unit -R spec -t 5000 --recursive",integration_short:"./node_modules/.bin/mocha test/integration/short -R spec -t 5000 --recursive",integration_long:"./node_modules/.bin/mocha test/integration/long -R spec -t 5000 --recursive",ci_jenkins:"./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-jenkins-reporter --exit",ci_appveyor:"./node_modules/.bin/mocha test/unit test/integration/short --recursive -R mocha-appveyor-reporter --exit",ci_unit_appveyor:"./node_modules/.bin/mocha test/unit --recursive -R mocha-appveyor-reporter --exit",server_api:"./node_modules/.bin/mocha test/integration/short -g '@SERVER_API' --recursive --exit",eslint:"eslint lib test"},engines:{node:">=16"}}});var Es=w(ur=>{"use strict";var CS=require("util"),{FrameWriter:ui}=bm(),he=re(),Rm=f0(),{ExecutionOptions:MG}=gs(),bS=ho(),Hu={values:1,skipMetadata:2,pageSize:4,withPagingState:8,withSerialConsistency:16,withDefaultTimestamp:32,withNameForValues:64,withKeyspace:128,withPageSizeBytes:1073741824,withContinuousPaging:2147483648},fo={withSerialConsistency:16,withDefaultTimestamp:32,withNameForValues:64,withKeyspace:128},_S={withKeyspace:1},Cm={logged:0,unlogged:1,counter:2},Um=class Um{constructor(){this.length=0}write(e,t){throw new Error("Method must be implemented")}clone(){let e=new this.constructor,t=Object.keys(this);for(let r=0;r0?Hu.pageSize:0,i|=this.options.getPageState()?Hu.withPagingState:0,i|=this.options.getSerialConsistency()?Hu.withSerialConsistency:0,i|=s!=null?Hu.withDefaultTimestamp:0,i|=this.namedParameters?Hu.withNameForValues:0;let a=r&&he.protocolVersion.supportsKeyspaceInRequest(t.protocolVersion);i|=a&&this.options.getKeyspace()?Hu.withKeyspace:0,e.writeShort(this.consistency),he.protocolVersion.uses4BytesQueryFlags(t.protocolVersion)?e.writeInt(i):e.writeByte(i)}if(this.params&&this.params.length){e.writeShort(this.params.length);for(let a=0;a0))throw new TypeError(CS.format("Invalid queries provided %s",this.queries));let r=new ui(he.opcodes.batch),i=this.options.isQueryTracing()?he.frameFlags.tracing:0;this.options.getCustomPayload()&&(i|=he.frameFlags.customPayload,r.writeCustomPayload(this.options.getCustomPayload())),r.writeByte(this.type),r.writeShort(this.queries.length);let s=this;if(this.queries.forEach(c(function(o,h){let f=s.hints[h],d=o.params||Rm.emptyArray,p;o.queryId?(r.writeByte(1),r.writeShortBytes(o.queryId),p=c(E=>o.meta.columns[E].type,"getParamType")):(r.writeByte(0),r.writeLString(o.query),p=f?E=>f[E]:()=>null),r.writeShort(d.length),d.forEach((E,x)=>r.writeBytes(e.encode(E,p(x))))},"eachQuery"),this),r.writeShort(this.options.getConsistency()),he.protocolVersion.supportsTimestamp(e.protocolVersion)){let a=this.options.getSerialConsistency()?fo.withSerialConsistency:0,o=this.options.getOrGenerateTimestamp();a|=o!=null?fo.withDefaultTimestamp:0,a|=this.options.getKeyspace()&&he.protocolVersion.supportsKeyspaceInRequest(e.protocolVersion)?fo.withKeyspace:0,he.protocolVersion.uses4BytesQueryFlags(e.protocolVersion)?r.writeInt(a):r.writeByte(a),a&fo.withSerialConsistency&&r.writeShort(this.options.getSerialConsistency()),a&fo.withDefaultTimestamp&&r.writeLong(o),a&fo.withKeyspace&&r.writeString(this.options.getKeyspace())}return this.length=r.bodyLength,r.write(e.protocolVersion,t,i)}clone(){return new i3(this.queries,this.options)}};c(i3,"BatchRequest");var Km=i3;function Nm(u){this.streamId=null,this.operationId=u}c(Nm,"CancelRequest");CS.inherits(Nm,tr);Nm.prototype.write=function(u,e){let t=new ui(he.opcodes.cancel);return t.writeInt(1),t.writeInt(this.operationId),t.write(u.protocolVersion,e)};var qm=class qm extends tr{write(e,t){return new ui(he.opcodes.options).write(e.protocolVersion,t,0)}clone(){return this}};c(qm,"OptionsRequest");var Om=qm,HG=new Om;ur.AuthResponseRequest=Lm;ur.BatchRequest=Km;ur.CancelRequest=Nm;ur.CredentialsRequest=Sm;ur.ExecuteRequest=r3;ur.PrepareRequest=wm;ur.QueryRequest=Am;ur.Request=tr;ur.RegisterRequest=Im;ur.StartupRequest=vm;ur.options=HG});var wS=w((Za0,AS)=>{"use strict";var qG=require("util"),RS=ce(),s3=class s3{constructor(e,t,r){this._hosts=e,this._openConnections=t,this._inFlightQueries=r}getConnectedHosts(){return this._hosts}getOpenConnections(e){if(!e)throw new RS.ArgumentError("Host is not defined");return this._openConnections[e.address]||0}getInFlightQueries(e){if(!e)throw new RS.ArgumentError("Host is not defined");return this._inFlightQueries[e.address]||0}toString(){return qG.format('{"hosts": %j, "openConnections": %j, "inFlightQueries": %j}',this._hosts.map(function(e){return e.address}),this._openConnections,this._inFlightQueries)}static from(e){let t={},r={},i=[];return e.hosts.forEach(s=>{s.pool.connections.length!==0&&(i.push(s),t[s.address]=s.pool.connections.length,r[s.address]=s.getInFlight())}),new s3(i,t,r)}};c(s3,"ClientState");var Vm=s3;AS.exports=Vm});var Wm=w((Ja0,IS)=>{"use strict";var VG=En(),vS=65536,Gm=vS*vS,Lt=class Lt{constructor(e,t,r,i){this._arr=[e&65535,t&65535,r&65535,i&65535]}toString(){return this.toImmutable().toString()}compare(e){let t=this.isNegative(),r=e.isNegative();return t&&!r?-1:!t&&r?1:this._compareBits(e)}_compareBits(e){for(let t=3;t>=0;t--){if(this._arr[t]>e._arr[t])return 1;if(this._arr[t]>>0}getHighBitsUnsigned(){return(this._arr[2]|this._arr[3]<<16)>>>0}toNumber(){return(this._arr[3]<<16|this._arr[2])*Gm+((this._arr[1]<<16|this._arr[0])>>>0)}not(){return this._arr[0]=~this._arr[0]&65535,this._arr[1]=~this._arr[1]&65535,this._arr[2]=~this._arr[2]&65535,this._arr[3]=~this._arr[3]&65535,this}add(e){let t=0,r=0,i=0,s=0;return s+=this._arr[0]+e._arr[0],this._arr[0]=s&65535,i+=s>>>16,i+=this._arr[1]+e._arr[1],this._arr[1]=i&65535,r+=i>>>16,r+=this._arr[2]+e._arr[2],this._arr[2]=r&65535,t+=r>>>16,t+=this._arr[3]+e._arr[3],this._arr[3]=t&65535,this}shiftLeft(e){if(e===0)return this;if(e>=64)return this.toZero();let t=e%16,r=Math.floor(e/16);return r>0&&(this._arr[3]=this._arr[3-r],this._arr[2]=r>2?0:this._arr[2-r],this._arr[1]=r>1?0:this._arr[0],this._arr[0]=0),t>0&&(this._arr[3]=(this._arr[3]<>>16-t)&65535,this._arr[2]=(this._arr[2]<>>16-t)&65535,this._arr[1]=(this._arr[1]<>>16-t)&65535,this._arr[0]=this._arr[0]<=64)return this.toZero();let t=e%16,r=Math.floor(e/16);return r>0&&(this._arr[0]=this._arr[r],this._arr[1]=r>2?0:this._arr[1+r],this._arr[2]=r>1?0:this._arr[3],this._arr[3]=0),t>0&&(this._arr[0]=this._arr[0]>>>t|this._arr[1]<<16-t&65535,this._arr[1]=this._arr[1]>>>t|this._arr[2]<<16-t&65535,this._arr[2]=this._arr[2]>>>t|this._arr[3]<<16-t&65535,this._arr[3]=this._arr[3]>>>t),this}or(e){return this._arr[0]|=e._arr[0],this._arr[1]|=e._arr[1],this._arr[2]|=e._arr[2],this._arr[3]|=e._arr[3],this}xor(e){return this._arr[0]^=e._arr[0],this._arr[1]^=e._arr[1],this._arr[2]^=e._arr[2],this._arr[3]^=e._arr[3],this}clone(){return new Lt(this._arr[0],this._arr[1],this._arr[2],this._arr[3])}multiply(e){let t=!1;if(this.isZero()||e.isZero())return this.toZero();this.isNegative()&&(this.negate(),t=!t),e.isNegative()&&(e=e.clone().negate(),t=!t);let r=0,i=0,s=0,a=0;return a+=this._arr[0]*e._arr[0],s+=a>>>16,s+=this._arr[1]*e._arr[0],i+=s>>>16,s&=65535,s+=this._arr[0]*e._arr[1],i+=s>>>16,i+=this._arr[2]*e._arr[0],r+=i>>>16,i&=65535,i+=this._arr[1]*e._arr[1],r+=i>>>16,i&=65535,i+=this._arr[0]*e._arr[2],r+=i>>>16,r+=this._arr[3]*e._arr[0]+this._arr[2]*e._arr[1]+this._arr[1]*e._arr[2]+this._arr[0]*e._arr[3],this._arr[0]=a&65535,this._arr[1]=s&65535,this._arr[2]=i&65535,this._arr[3]=r&65535,t&&this.negate(),this}toZero(){return this._arr[3]=this._arr[2]=this._arr[1]=this._arr[0]=0,this}isZero(){return this._arr[3]===0&&this._arr[2]===0&&this._arr[1]===0&&this._arr[0]===0}isNegative(){return(this._arr[3]&32768)>0}negate(){return this.not().add(Lt.one)}equals(e){return e instanceof Lt?this._arr[0]===e._arr[0]&&this._arr[1]===e._arr[1]&&this._arr[2]===e._arr[2]&&this._arr[3]===e._arr[3]:!1}toImmutable(){return VG.fromBits(this.getLowBitsUnsigned(),this.getHighBitsUnsigned(),!1)}static fromNumber(e){if(isNaN(e)||!isFinite(e))return new Lt;if(e<0)return Lt.fromNumber(-e).negate();let t=e%Gm,r=e/Gm;return Lt.fromBits(t,r)}static fromBits(e,t){return new Lt(e,e>>>16,t,t>>>16)}static fromString(e,t){if(typeof e!="string")throw new Error("String format is not valid: "+e);if(e.length===0)throw Error("number format error: empty string");if(e==="NaN"||e==="Infinity"||e==="+Infinity"||e==="-Infinity")return new Lt;if(t=t||10,t<2||t>36)throw Error("radix out of range: "+t);let r;if((r=e.indexOf("-"))>0)throw Error('number format error: interior "-" character: '+e);if(r===0)return Lt.fromString(e.substring(1),t).negate();let i=Lt.fromNumber(Math.pow(t,8)),s=new Lt;for(let a=0;a{"use strict";var $m=re(),LS=require("util"),GG=$m.dataTypes.getByName("bigint"),WG=$m.dataTypes.getByName("varint"),zG=$m.dataTypes.getByName("blob"),Zm=class Zm{constructor(e){this._value=e}getType(){throw new Error("You must implement a getType function for this Token instance")}getValue(){return this._value}toString(){return this._value.toString()}compare(e){return this._value.compare(e._value)}equals(e){return this.compare(e)===0}inspect(){return this.constructor.name+" { "+this.toString()+" }"}};c(Zm,"Token");var po=Zm,Xm=class Xm extends po{constructor(e){super(e)}getType(){return GG}};c(Xm,"Murmur3Token");var zm=Xm,Jm=class Jm extends po{constructor(e){super(e)}getType(){return WG}};c(Jm,"RandomToken");var Ym=Jm,ex=class ex extends po{constructor(e){super(e)}getType(){return zG}toString(){return this._value.toString("hex").toUpperCase()}};c(ex,"ByteOrderedToken");var Qm=ex,ms=class ms{constructor(e,t,r){this.start=e,this.end=t,Object.defineProperty(this,"_tokenizer",{value:r,enumerable:!1})}splitEvenly(e){if(e<1)throw new Error(LS.format("numberOfSplits (%d) must be greater than 0.",e));if(this.isEmpty())throw new Error("Can't split empty range "+this.toString());let t=[],r=this._tokenizer.split(this.start,this.end,e),i=this.start,s;for(let a=0;a0&&!this.end.equals(this._tokenizer.minToken())}unwrap(){return this.isWrappedAround()?[new ms(this.start,this._tokenizer.minToken(),this._tokenizer),new ms(this._tokenizer.minToken(),this.end,this._tokenizer)]:[this]}contains(e){if(this.isEmpty())return!1;let t=this._tokenizer.minToken();if(this.end.equals(t))return this.start.equals(t)||e.equals(t)?!0:e.compare(this.start)>0;let r=e.compare(this.start)>0,i=e.compare(this.end)<=0;return this.isWrappedAround()?r||i:r&&i}equals(e){return e===this?!0:e instanceof ms?this.compare(e)===0:!1}compare(e){let t=this.start.compare(e.start);return t!==0?t:this.end.compare(e.end)}toString(){return LS.format("]%s, %s]",this.start.toString(),this.end.toString())}};c(ms,"TokenRange");var jm=ms;yo.Token=po;yo.TokenRange=jm;yo.ByteOrderedToken=Qm;yo.Murmur3Token=zm;yo.RandomToken=Ym});var KS=w(ah=>{"use strict";var tx=f0(),SS=En(),YG=/^[-+]?(\d{1,6})(?:-(\d{1,2}))?(?:-(\d{1,2}))?(?:T(\d{1,2}?)?(?::(\d{1,2}))?(?::(\d{1,2})(?:\.(\d{1,3}))?)?)?Z?$/,QG=/^\[(.+?) TO (.+)]$/,vu=Object.freeze(new Be(null,-1)),nu={singleValue:0,closedRange:1,openRangeHigh:2,openRangeLow:3,openBoth:4,openSingle:5},Le={year:0,month:1,day:2,hour:3,minute:4,second:5,millisecond:6};function qu(u,e){if(!u)throw new TypeError("The lower boundaries must be defined");this.lowerBound=u,this.upperBound=e||null,this.upperBound===null?this.lowerBound!==vu?this._type=nu.singleValue:this._type=nu.openSingle:this.lowerBound!==vu?this._type=this.upperBound!==vu?nu.closedRange:nu.openRangeHigh:this._type=this.upperBound!==vu?nu.openRangeLow:nu.openBoth}c(qu,"DateRange");qu.prototype.equals=function(u){return u instanceof qu?u.lowerBound.equals(this.lowerBound)&&(u.upperBound?u.upperBound.equals(this.upperBound):!this.upperBound):!1};qu.prototype.toString=function(){return this.upperBound===null?this.lowerBound.toString():"["+this.lowerBound.toString()+" TO "+this.upperBound.toString()+"]"};qu.prototype.toBuffer=function(){if(this._type===nu.openBoth||this._type===nu.openSingle)return tx.allocBufferFromArray([this._type]);let u,e=0;if(this._type!==nu.closedRange){let t=this._type!==nu.openRangeLow?this.lowerBound:this.upperBound;return u=tx.allocBufferUnsafe(10),u.writeUInt8(this._type,e++),e=ux(t.date,u,e),u.writeUInt8(t.precision,e),u}return u=tx.allocBufferUnsafe(19),u.writeUInt8(this._type,e++),e=ux(this.lowerBound.date,u,e),u.writeUInt8(this.lowerBound.precision,e++),e=ux(this.upperBound.date,u,e),u.writeUInt8(this.upperBound.precision,e),u};qu.fromString=function(u){let e=QG.exec(u);return e?new qu(Be.toLowerBound(Be.fromString(e[1])),Be.toUpperBound(Be.fromString(e[2]))):new qu(Be.toLowerBound(Be.fromString(u)))};qu.fromBuffer=function(u){if(u.length===0)throw new TypeError("DateRange serialized value must have at least 1 byte");let e=u.readUInt8(0);if(e===nu.openBoth)return new qu(vu,vu);if(e===nu.openSingle)return new qu(vu);let t=1,r,i,s=null;if(e!==nu.closedRange)return r=rx(u,t),t+=8,i=new Be(r,u.readUInt8(t)),e===nu.openRangeLow?(s=i,i=vu):s=e===nu.openRangeHigh?vu:null,new qu(i,s);r=rx(u,t),t+=8,i=new Be(r,u.readUInt8(t++));let a=rx(u,t);return t+=8,s=new Be(a,u.readUInt8(t)),new qu(i,s)};function ux(u,e,t){let r=SS.fromNumber(u.getTime());return e.writeUInt32BE(r.getHighBitsUnsigned(),t),e.writeUInt32BE(r.getLowBitsUnsigned(),t+4),t+8}c(ux,"writeDate");function rx(u,e){let t=new SS(u.readInt32BE(e+4),u.readInt32BE(e));return new Date(t.toNumber())}c(rx,"readDate");function Be(u,e){this.date=u,this.precision=e}c(Be,"DateRangeBound");Be.prototype.toString=function(){if(this.precision===-1)return"*";let u=0,e=this.date.toISOString(),t,r;for(t=4;t=Le.hour&&r===":"||r==="."){u++;continue}u6)throw new TypeError("Index out of bounds: "+u);u>this._index&&(this._index=u);let r=+e;switch(u){case Le.month:if(r<1||r>12)throw new TypeError("Month portion is not valid for date: "+t);break;case Le.day:if(r<1||r>31)throw new TypeError("Day portion is not valid for date: "+t);break;case Le.hour:if(r>23)throw new TypeError("Hour portion is not valid for date: "+t);break;case Le.minute:case Le.second:if(r>59)throw new TypeError("Minute/second portion is not valid for date: "+t);break;case Le.millisecond:if(r>999)throw new TypeError("Millisecond portion is not valid for date: "+t);break}this._values[u]=r};ix.prototype.build=function(){let u=new Date(0),e=this._values[1];return e&&e--,u.setUTCFullYear(this._sign*this._values[0],e,this._values[2]||1),u.setUTCHours(this._values[3],this._values[4],this._values[5],this._values[6]),new Be(u,this._index)};ah.unbounded=vu;ah.dateRangePrecision=Le;ah.DateRange=qu;ah.DateRangeBound=Be});var nx=w(n3=>{"use strict";var sx=KS();n3.DateRange=sx.DateRange;n3.DateRangeBound=sx.DateRangeBound;n3.dateRangePrecision=sx.dateRangePrecision});var oh=w((no0,OS)=>{"use strict";var $G={0:"BE",1:"LE"};function Pi(){}c(Pi,"Geometry");Pi.types={Point2D:1,LineString:2,Polygon:3};Pi.getEndianness=function(u){let e=$G[u.toString()];if(typeof e>"u")throw new TypeError("Invalid endianness with code "+u);return e};Pi.readInt32=function(u,e,t){return e==="BE"?u.readInt32BE(t,!0):u.readInt32LE(t,!0)};Pi.readDouble=function(u,e,t){return e==="BE"?u.readDoubleBE(t,!0):u.readDoubleLE(t,!0)};Pi.prototype.writeInt32=function(u,e,t){return this.useBESerialization()?e.writeInt32BE(u,t,!0):e.writeInt32LE(u,t,!0)};Pi.prototype.writeDouble=function(u,e,t){return this.useBESerialization()?e.writeDoubleBE(u,t,!0):e.writeDoubleLE(u,t,!0)};Pi.prototype.writeEndianness=function(u,e){return this.useBESerialization()?u.writeInt8(0,e,!0):u.writeInt8(1,e,!0)};Pi.prototype.useBESerialization=function(){throw new Error("Not Implemented")};OS.exports=Pi});var a3=w((oo0,US)=>{"use strict";var NS=require("util"),ZG=f0(),Rn=oh();function rr(u,e){if(typeof u!="number"||typeof e!="number")throw new TypeError("X and Y must be numbers");if(isNaN(u)||isNaN(e))throw new TypeError("X and Y must be numbers");this.x=u,this.y=e}c(rr,"Point");NS.inherits(rr,Rn);rr.fromBuffer=function(u){if(!u||u.length!==21)throw new TypeError("2D Point buffer should contain 21 bytes");let e=Rn.getEndianness(u.readInt8(0,!0));if(Rn.readInt32(u,e,1)!==Rn.types.Point2D)throw new TypeError("Binary representation was not a point");return new rr(Rn.readDouble(u,e,5),Rn.readDouble(u,e,13))};rr.fromString=function(u){let t=/^POINT\s?\(([-0-9.]+) ([-0-9.]+)\)$/g.exec(u);if(!t||t.length!==3)throw new TypeError("2D Point WTK should contain 2 coordinates");return new rr(parseFloat(t[1]),parseFloat(t[2]))};rr.prototype.toBuffer=function(){let u=ZG.allocBufferUnsafe(21);return this.writeEndianness(u,0),this.writeInt32(Rn.types.Point2D,u,1),this.writeDouble(this.x,u,5),this.writeDouble(this.y,u,13),u};rr.prototype.equals=function(u){return u instanceof rr?this.x===u.x&&this.y===u.y:!1};rr.prototype.toString=function(){return NS.format("POINT (%d %d)",this.x,this.y)};rr.prototype.useBESerialization=function(){return!1};rr.prototype.toJSON=function(){return{type:"Point",coordinates:[this.x,this.y]}};US.exports=rr});var ax=w((lo0,BS)=>{"use strict";var PS=require("util"),XG=f0(),xs=oh(),kS=a3();function Iu(u){let e=Array.prototype.slice.call(arguments);if(e.length===1&&Array.isArray(e)&&Array.isArray(e[0])&&(e=e[0]),e.length===1)throw new TypeError("LineString can be either empty or contain 2 or more points");this.points=Object.freeze(e)}c(Iu,"LineString");PS.inherits(Iu,xs);Iu.fromBuffer=function(u){if(!u||u.length<9)throw new TypeError("A linestring buffer should contain at least 9 bytes");let e=xs.getEndianness(u.readInt8(0,!0)),t=1;if(xs.readInt32(u,e,t)!==xs.types.LineString)throw new TypeError("Binary representation was not a LineString");t+=4;let r=xs.readInt32(u,e,t);if(t+=4,u.length!==t+r*16)throw new TypeError(PS.format("Length of the buffer does not match %d !== %d",u.length,t+r*8));let i=new Array(r);for(let s=0;s0});if(s.length!==2)throw new TypeError("Invalid WKT segment: "+u);e.push(new kS(parseFloat(s[0]),parseFloat(s[1])))}return e};Iu.prototype.toBuffer=function(){let u=XG.allocBufferUnsafe(9+this.points.length*16);this.writeEndianness(u,0);let e=1;return this.writeInt32(xs.types.LineString,u,e),e+=4,this.writeInt32(this.points.length,u,e),e+=4,this.points.forEach(function(t){this.writeDouble(t.x,u,e),this.writeDouble(t.y,u,e+8),e+=16},this),u};Iu.prototype.equals=function(u){if(!(u instanceof Iu)||this.points.length!==u.points.length)return!1;for(let e=0;e{"use strict";var DS=require("util"),JG=f0(),ki=oh(),eW=a3(),tW=ax();function ir(u){let e=Array.prototype.slice.call(arguments);this.rings=Object.freeze(e)}c(ir,"Polygon");DS.inherits(ir,ki);ir.fromBuffer=function(u){if(!u||u.length<9)throw new TypeError("A Polygon buffer should contain at least 9 bytes");let e=ki.getEndianness(u.readInt8(0,!0)),t=1;if(ki.readInt32(u,e,t)!==ki.types.Polygon)throw new TypeError("Binary representation was not a Polygon");t+=4;let r=ki.readInt32(u,e,t);t+=4;let i=new Array(r);for(let s=0;s0&&(u+=", "),u+="("+e.map(function(r){return r.x+" "+r.y}).join(", ")+")"}),"POLYGON ("+u+")"};ir.prototype.toJSON=function(){return{type:"Polygon",coordinates:this.rings.map(function(u){return u.map(function(e){return[e.x,e.y]})})}};MS.exports=ir});var o3=w(ch=>{"use strict";ch.Geometry=oh();ch.LineString=ax();ch.Point=a3();ch.Polygon=HS()});var h3=w((yo0,e6)=>{"use strict";var Ne=require("util"),B0=re(),G=B0.dataTypes,An=B0.Long,go=B0.Integer,Eo=B0.BigDecimal,uW=Wm(),Re=f0(),qS=nh(),{DateRange:QS}=nx(),l3=o3(),rW=l3.Geometry,jS=l3.LineString,$S=l3.Point,ZS=l3.Polygon,iW=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,mo={int16Zero:Re.allocBufferFromArray([0,0]),int32Zero:Re.allocBufferFromArray([0,0,0,0]),int8Zero:Re.allocBufferFromArray([0]),int8One:Re.allocBufferFromArray([1]),int8MaxValue:Re.allocBufferFromArray([255])},xo=typeof BigInt<"u",VS=xo?BigInt(32):null,GS=xo?BigInt(8):null,c3=xo?BigInt(0):null,WS=xo?BigInt(-1):null,sW=xo?BigInt(4294967295):null,ox=xo?BigInt(255):null,ye=Object.freeze({list:"org.apache.cassandra.db.marshal.ListType",set:"org.apache.cassandra.db.marshal.SetType",map:"org.apache.cassandra.db.marshal.MapType",udt:"org.apache.cassandra.db.marshal.UserType",tuple:"org.apache.cassandra.db.marshal.TupleType",frozen:"org.apache.cassandra.db.marshal.FrozenType",reversed:"org.apache.cassandra.db.marshal.ReversedType",composite:"org.apache.cassandra.db.marshal.CompositeType",empty:"org.apache.cassandra.db.marshal.EmptyType",collection:"org.apache.cassandra.db.marshal.ColumnToCollectionType"}),ut=Object.freeze({frozen:"frozen",list:"list",set:"set",map:"map",tuple:"tuple",empty:"empty",duration:"duration",vector:"vector"}),lx=Object.freeze({"org.apache.cassandra.db.marshal.UTF8Type":G.varchar,"org.apache.cassandra.db.marshal.AsciiType":G.ascii,"org.apache.cassandra.db.marshal.UUIDType":G.uuid,"org.apache.cassandra.db.marshal.TimeUUIDType":G.timeuuid,"org.apache.cassandra.db.marshal.Int32Type":G.int,"org.apache.cassandra.db.marshal.BytesType":G.blob,"org.apache.cassandra.db.marshal.FloatType":G.float,"org.apache.cassandra.db.marshal.DoubleType":G.double,"org.apache.cassandra.db.marshal.BooleanType":G.boolean,"org.apache.cassandra.db.marshal.InetAddressType":G.inet,"org.apache.cassandra.db.marshal.SimpleDateType":G.date,"org.apache.cassandra.db.marshal.TimeType":G.time,"org.apache.cassandra.db.marshal.ShortType":G.smallint,"org.apache.cassandra.db.marshal.ByteType":G.tinyint,"org.apache.cassandra.db.marshal.DateType":G.timestamp,"org.apache.cassandra.db.marshal.TimestampType":G.timestamp,"org.apache.cassandra.db.marshal.LongType":G.bigint,"org.apache.cassandra.db.marshal.DecimalType":G.decimal,"org.apache.cassandra.db.marshal.IntegerType":G.varint,"org.apache.cassandra.db.marshal.CounterColumnType":G.counter}),nW=wW(lx),aW=Object.keys(lx).reduce(function(u,e){return e.length>u?e.length:u},0),Ue=Object.freeze({duration:"org.apache.cassandra.db.marshal.DurationType",lineString:"org.apache.cassandra.db.marshal.LineStringType",point:"org.apache.cassandra.db.marshal.PointType",polygon:"org.apache.cassandra.db.marshal.PolygonType",dateRange:"org.apache.cassandra.db.marshal.DateRangeType",vector:"org.apache.cassandra.db.marshal.VectorType"}),zS=Re.allocBufferFromArray([255,255,255,255]),YS=Re.allocBufferFromArray([255,255,255,254]),oW=new Set([G.text,G.ascii,G.varchar,G.custom,G.blob]);function Ts(u,e){this.encodingOptions=e.encoding||Re.emptyObject,cW.call(this),this.setProtocolVersion(u),lW.call(this),this.encodingOptions.copyBuffer?this.handleBuffer=dW:this.handleBuffer=pW}c(Ts,"Encoder");function cW(){this.setProtocolVersion=function(t){this.protocolVersion=t,this.decodeCollectionLength=yW,this.getLengthBuffer=fW,this.collectionLengthSize=4,B0.protocolVersion.uses4BytesCollectionLength(this.protocolVersion)||(this.decodeCollectionLength=gW,this.getLengthBuffer=hW,this.collectionLengthSize=2)};let u={[Ue.duration]:XS,[Ue.lineString]:EW,[Ue.point]:xW,[Ue.polygon]:bW,[Ue.dateRange]:CW},e={[Ue.duration]:JS,[Ue.lineString]:mW,[Ue.point]:TW,[Ue.polygon]:_W,[Ue.dateRange]:RW};this.decodeBlob=function(t){return this.handleBuffer(t)},this.decodeCustom=function(t,r){if(!r||r.length===0)return this.handleBuffer(t);if(r.startsWith(Ue.vector))return this.decodeVector(t,this.parseVectorTypeArgs(r,Ue.vector,this.parseFqTypeName));let i=u[r];return i?i.call(this,t):this.handleBuffer(t)},this.decodeUtf8String=function(t){return t.toString("utf8")},this.decodeAsciiString=function(t){return t.toString("ascii")},this.decodeBoolean=function(t){return!!t.readUInt8(0)},this.decodeDouble=function(t){return t.readDoubleBE(0)},this.decodeFloat=function(t){return t.readFloatBE(0)},this.decodeInt=function(t){return t.readInt32BE(0)},this.decodeSmallint=function(t){return t.readInt16BE(0)},this.decodeTinyint=function(t){return t.readInt8(0)},this._decodeCqlLongAsLong=function(t){return An.fromBuffer(t)},this._decodeCqlLongAsBigInt=function(t){return BigInt.asIntN(64,BigInt(t.readUInt32BE(0))<>VS)>>>0,0),r.writeUInt32BE(Number(t&sW),4),r},this.encodeLong=this.encodingOptions.useBigIntAsLong?this._encodeBigIntFromBigInt:this._encodeBigIntFromLong,this._encodeVarintFromInteger=function(t){typeof t=="number"&&(t=go.fromNumber(t)),typeof t=="string"&&(t=go.fromString(t));let r=null;if(t instanceof Buffer&&(r=t),t instanceof go&&(r=go.toBuffer(t)),r===null)throw new TypeError("Not a valid varint, expected Integer/Number/String/Buffer, obtained "+Ne.inspect(t));return r},this._encodeVarintFromBigInt=function(t){if(typeof t=="string"&&(t=BigInt(t)),typeof t!="bigint")throw new TypeError("Not a valid varint, expected BigInt, obtained "+Ne.inspect(t));if(t===c3)return mo.int8Zero;if(t===WS)return mo.int8MaxValue;let r=[];if(t>c3){for(;t!==c3;)r.unshift(Number(t&ox)),t=t>>GS;r[0]>127&&r.unshift(0)}else{for(;t!==WS;)r.unshift(Number(t&ox)),t=t>>GS;r[0]<=127&&r.unshift(255)}return Re.allocBufferFromArray(r)},this.encodeVarint=this.encodingOptions.useBigIntAsVarint?this._encodeVarintFromBigInt:this._encodeVarintFromInteger,this.encodeDecimal=function(t){typeof t=="number"?t=Eo.fromNumber(t):typeof t=="string"&&(t=Eo.fromString(t));let r=null;if(t instanceof Eo)r=Eo.toBuffer(t);else throw new TypeError("Not a valid varint, expected BigDecimal/Number/String/Buffer, obtained "+Ne.inspect(t));return r},this.encodeString=function(t,r){if(typeof t!="string")throw new TypeError("Not a valid text value, expected String obtained "+Ne.inspect(t));return Re.allocBufferFromString(t,r)},this.encodeUtf8String=function(t){return this.encodeString(t,"utf8")},this.encodeAsciiString=function(t){return this.encodeString(t,"ascii")},this.encodeBlob=function(t){if(!(t instanceof Buffer))throw new TypeError("Not a valid blob, expected Buffer obtained "+Ne.inspect(t));return t},this.encodeCustom=function(t,r){if(r.startsWith(Ue.vector))return this.encodeVector(t,this.parseVectorTypeArgs(r,Ue.vector,this.parseFqTypeName));let i=e[r];if(i)return i.call(this,t);throw new TypeError("No encoding handler found for type "+r)},this.encodeBoolean=function(t){return t?mo.int8One:mo.int8Zero},this.encodeInt=function(t){if(isNaN(t))throw new TypeError("Expected Number, obtained "+Ne.inspect(t));let r=Re.allocBufferUnsafe(4);return r.writeInt32BE(t,0),r},this.encodeSmallint=function(t){if(isNaN(t))throw new TypeError("Expected Number, obtained "+Ne.inspect(t));let r=Re.allocBufferUnsafe(2);return r.writeInt16BE(t,0),r},this.encodeTinyint=function(t){if(isNaN(t))throw new TypeError("Expected Number, obtained "+Ne.inspect(t));let r=Re.allocBufferUnsafe(1);return r.writeInt8(t,0),r},this.encodeList=function(t,r){if(!Array.isArray(t))throw new TypeError("Not a valid list value, expected Array obtained "+Ne.inspect(t));if(t.length===0)return null;let i=[];i.push(this.getLengthBuffer(t));for(let s=0;s"u"||a===B0.unset)throw new TypeError("A collection can't contain null or unset values");let o=this.encode(a,r);i.push(this.getLengthBuffer(o)),i.push(o)}return Buffer.concat(i)},this.encodeSet=function(t,r){if(this.encodingOptions.set&&t instanceof this.encodingOptions.set){let i=[];return t.forEach(function(s){i.push(s)}),this.encodeList(i,r)}return this.encodeList(t,r)},this.encodeMap=function(t,r){let i=[],s=0,a=null,o=null,h=this;r&&(a=r[0],o=r[1]);function f(d,p){if(p===null||typeof p>"u"||p===B0.unset)throw new TypeError("A map can't contain null or unset keys");if(d===null||typeof d>"u"||d===B0.unset)throw new TypeError("A map can't contain null or unset values");let E=h.encode(p,a);i.push(h.getLengthBuffer(E)),i.push(E);let x=h.encode(d,o);i.push(h.getLengthBuffer(x)),x!==null&&i.push(x),s++}if(c(f,"addItem"),this.encodingOptions.map&&t instanceof this.encodingOptions.map)t.forEach(f);else for(let d in t){if(!t.hasOwnProperty(d))continue;let p=t[d];f(p,d)}return i.unshift(this.getLengthBuffer(s)),Buffer.concat(i)},this.encodeUdt=function(t,r){let i=[],s=0;for(let a=0;a, Token, or TokenRange.`)}if(!t||t.length===0)return;let o=r.getRoutingIndexes();if(r.getRoutingNames()&&(o=r.getRoutingNames().map(p=>i[p])),!o)return;let h=[],f=r.getHints()||Re.emptyArray,d=i?p=>this.encode(t[p].value,f[p]):p=>this.encode(t[p],f[p]);try{s=this._encodeRoutingKeyParts(h,o,d)}catch{}s!==0&&r.setRoutingKey(cx(h,s))},this.setRoutingKeyFromMeta=function(t,r,i){let s=i.getRoutingIndexes();if(!s)return;let a=new Array(s.length),o=c(f=>{let d=t.columns[f];return this.encode(r[f],d?d.type:null)},"encodeParam"),h=0;try{h=this._encodeRoutingKeyParts(a,s,o)}catch{}h!==0&&i.setRoutingKey(cx(a,h))},this._encodeRoutingKeyParts=function(t,r,i){let s=0;for(let a=0;a"),h.length!==1)throw new TypeError("Not a valid type "+r);return o.code=G.list,o.info=await this.parseTypeName(t,h[0],0,null,a),o}if(r.indexOf(ut.set,i)===i){if(i+=ut.set.length+1,s-=ut.set.length+2,h=ri(r,i,s,"<",">"),h.length!==1)throw new TypeError("Not a valid type "+r);return o.code=G.set,o.info=await this.parseTypeName(t,h[0],0,null,a),o}if(r.indexOf(ut.map,i)===i){if(i+=ut.map.length+1,s-=ut.map.length+2,h=ri(r,i,s,"<",">"),h.length!==2)throw new TypeError("Not a valid type "+r);return o.code=G.map,o.info=await this._parseChildTypes(t,h,a),o}if(r.indexOf(ut.tuple,i)===i){if(i+=ut.tuple.length+1,s-=ut.tuple.length+2,h=ri(r,i,s,"<",">"),h.length<1)throw new TypeError("Not a valid type "+r);return o.code=G.tuple,o.info=await this._parseChildTypes(t,h,a),o}if(r.indexOf(ut.vector,i)===i){o.code=G.custom;let E=this.parseVectorTypeArgs(r,ut.vector,x=>x);return E.subtype=await this.parseTypeName(t,E.subtype),o.info=E,o}let f=r.indexOf('"',i)===i;f&&(i++,s-=2),i>0&&(r=r.substr(i,s)),f&&(r=r.replace('""','"'));let d=G[r];if(typeof d=="number")return o.code=d,o;if(r===ut.duration)return o.info=Ue.duration,o;if(r===ut.empty)return o.info="empty",o;let p=await a(t,r);if(p)return o.code=G.udt,o.info=p,o;throw new TypeError('Not a valid type "'+r+'"')},this._parseChildTypes=function(t,r,i){return Promise.all(r.map(s=>this.parseTypeName(t,s.trim(),0,null,i)))},this.parseFqTypeName=function(t,r,i){let s={code:0,info:null,options:{reversed:!1,frozen:!1}};r=r||0;let a;if(i||(i=t.length),i>ye.reversed.length&&t.indexOf(ye.reversed)===r&&(r+=ye.reversed.length+1,i-=ye.reversed.length+2,s.options.reversed=!0),i>ye.frozen.length&&t.indexOf(ye.frozen,r)===r&&(r+=ye.frozen.length+1,i-=ye.frozen.length+2,s.options.frozen=!0),t===ye.empty)return s.info="empty",s;if(i<=aW){r>0&&(t=t.substr(r,i));let o=lx[t];if(typeof o=="number")return s.code=o,s;throw new TypeError('Not a valid type "'+t+'"')}if(t.indexOf(ye.list,r)===r){if(r+=ye.list.length+1,i-=ye.list.length+2,a=ri(t,r,i),a.length!==1)throw new TypeError("Not a valid type "+t);return s.code=G.list,s.info=this.parseFqTypeName(a[0]),s}if(t.indexOf(ye.set,r)===r){if(r+=ye.set.length+1,i-=ye.set.length+2,a=ri(t,r,i),a.length!==1)throw new TypeError("Not a valid type "+t);return s.code=G.set,s.info=this.parseFqTypeName(a[0]),s}if(t.indexOf(ye.map,r)===r){if(r+=ye.map.length+1,i-=ye.map.length+2,a=ri(t,r,i),a.length!==2)throw new TypeError("Not a valid type "+t);return s.code=G.map,s.info=[this.parseFqTypeName(a[0]),this.parseFqTypeName(a[1])],s}if(t.indexOf(ye.udt,r)===r)return r+=ye.udt.length+1,i-=ye.udt.length+2,this._parseUdtName(t,r,i);if(t.indexOf(ye.tuple,r)===r){if(r+=ye.tuple.length+1,i-=ye.tuple.length+2,a=ri(t,r,i),a.length<1)throw new TypeError("Not a valid type "+t);return s.code=G.tuple,s.info=a.map(o=>this.parseFqTypeName(o)),s}return t.indexOf(Ue.vector,r)===r?(s.code=G.custom,s.info=this.parseVectorTypeArgs(t,Ue.vector,this.parseFqTypeName),s):(s.info=t.substr(r,i),s)},this.parseKeyTypes=function(t){let r=0,i=t.length,s=t.indexOf(ye.composite)===0;s&&(r=ye.composite.length+1,i--);let a=[],o=r,h=0,f=!1,d=!1;for(;++r0)break;f&&(o=t.indexOf(":",o)+1),a.push(t.substring(o,r)),o=r+1;break;case"(":if(h===0&&t.indexOf(ye.collection,o)===o){f=!0,d=!0,r++,o=r;break}h++;break;case")":if(f&&h===0){a.push(t.substring(t.indexOf(":",o)+1,r)),o=r+1;break}h--;break}return othis.parseFqTypeName(p)),hasCollections:d,isComposite:s}},this._parseUdtName=function(t,r,i){let s=ri(t,r,i);if(s.length<2)throw new TypeError("Not a valid type "+t);let a={code:G.udt,info:null},o={keyspace:s[0],name:Re.allocBufferFromString(s[1],"hex").toString(),fields:[]};for(let h=2;h=4?B0.unset:null),u===B0.unset){if(!B0.protocolVersion.supportsUnset(this.protocolVersion))throw new TypeError("Unset value can not be used for this version of Cassandra, protocol version: "+this.protocolVersion);return u}if(u===null||u instanceof Buffer)return u;let t={code:null,info:null};if(e){if(typeof e=="number"?t.code=e:typeof e=="string"&&(t=G.getByName(e)),typeof e.code=="number"&&(t.code=e.code,t.info=e.info),typeof t.code!="number")throw new TypeError("Type information not valid, only String and Number values are valid hints")}else if(t=Ts.guessDataType(u),!t)throw new TypeError("Target data type could not be guessed, you should use prepared statements for accurate type mapping. Value: "+Ne.inspect(u));let r=this.encoders[t.code];if(!r)throw new Error("Type not supported "+t.code);return r.call(this,u,t.info)};Ts.guessDataType=function(u){let e=null,t=null,r=typeof u;return r==="number"?e=G.double:r==="string"?(e=G.text,u.length===36&&iW.test(u)&&(e=G.uuid)):r==="boolean"?e=G.boolean:u instanceof Buffer?e=G.blob:u instanceof Date?e=G.timestamp:u instanceof An?e=G.bigint:u instanceof go?e=G.varint:u instanceof Eo?e=G.decimal:u instanceof B0.Uuid?e=G.uuid:u instanceof B0.InetAddress?e=G.inet:u instanceof B0.Tuple?e=G.tuple:u instanceof B0.LocalDate?e=G.date:u instanceof B0.LocalTime?e=G.time:u instanceof B0.Duration?(e=G.custom,t=Ue.duration):Ts.isTypedArray(u)?(e=G.custom,t=AW(Ue.vector,[nW[G.float],u.length])):Array.isArray(u)?e=G.list:u instanceof rW?(e=G.custom,u instanceof jS?t=Ue.lineString:u instanceof $S?t=Ue.point:u instanceof ZS&&(t=Ue.polygon)):u instanceof QS&&(e=G.custom,t=Ue.dateRange),e===null?null:{code:e,info:t}};function hW(u){if(!u)return mo.int16Zero;let e=Re.allocBufferUnsafe(2);return typeof u=="number"?e.writeUInt16BE(u,0):e.writeUInt16BE(u.length,0),e}c(hW,"getLengthBufferV2");function fW(u){if(!u)return mo.int32Zero;let e=Re.allocBufferUnsafe(4);return typeof u=="number"?e.writeInt32BE(u,0):e.writeInt32BE(u.length,0),e}c(fW,"getLengthBufferV3");function dW(u){return u===null?null:Re.copyBuffer(u)}c(dW,"handleBufferCopy");function pW(u){return u}c(pW,"handleBufferRef");function yW(u,e){return u.readInt32BE(e)}c(yW,"decodeCollectionLengthV3");function gW(u,e){return u.readUInt16BE(e)}c(gW,"decodeCollectionLengthV2");function XS(u){return B0.Duration.fromBuffer(u)}c(XS,"decodeDuration");function JS(u){if(!(u instanceof B0.Duration))throw new TypeError("Not a valid duration, expected Duration/Buffer obtained "+Ne.inspect(u));return u.toBuffer()}c(JS,"encodeDuration");function EW(u){return jS.fromBuffer(u)}c(EW,"decodeLineString");function mW(u){return u.toBuffer()}c(mW,"encodeLineString");function xW(u){return $S.fromBuffer(u)}c(xW,"decodePoint");function TW(u){return u.toBuffer()}c(TW,"encodePoint");function bW(u){return ZS.fromBuffer(u)}c(bW,"decodePolygon");function _W(u){return u.toBuffer()}c(_W,"encodePolygon");function CW(u){return QS.fromBuffer(u)}c(CW,"decodeDateRange");function RW(u){return u.toBuffer()}c(RW,"encodeDateRange");function ri(u,e,t,r,i){r=r||"(",i=i||")";let s=[],a=e,o=0;for(let h=e;h{"use strict";var To=require("util"),wn=f0(),S0=re(),vW=ce(),lh={globalTablesSpec:1,hasMorePages:2,noMetadata:4,metadataChanged:8,continuousPaging:1073741824,lastContinuousPage:2147483648},IW="Server timeout during write query at consistency %s (%d peer(s) acknowledged the write over %d required)",LW="Server timeout during batchlog write at consistency %s (%d peer(s) acknowledged the write over %d required)",SW="Server failure during write query at consistency %s (%d responses were required but only %d replicas responded, %d failed)",KW="Not enough replicas available for query at consistency %s (%d required but only %d alive)",OW="Server timeout during read query at consistency %s (%s)",NW="Server failure during read query at consistency %s (%d responses were required but only %d replicas responded, %d failed)",fx=class fx{constructor(e,t,r){this.header=e,this.opcode=e.opcode,this.offset=r||0,this.buf=t}remainingLength(){return this.buf.length-this.offset}getBuffer(){return this.buf}slice(e,t){return typeof t>"u"&&(t=this.buf.length),this.buf.slice(e,t)}unshift(e){if(this.offset>0)throw new Error("Can not modify the underlying buffer if already read");this.buf=Buffer.concat([e,this.buf],e.length+this.buf.length)}read(e){let t=this.buf.length;typeof e<"u"&&this.offset+ethis.buf.length){let t=new RangeError("Trying to access beyond buffer length");throw t.expectedLength=e,t}}readStringList(){let e=this.readShort(),t=new Array(e);for(let r=0;r0&&(r.table=i);break}}return r}readEvent(){let e=this.readString();switch(e){case S0.protocolEvents.topologyChange:return{added:this.readString()==="NEW_NODE",inet:this.readInet(),eventType:e};case S0.protocolEvents.statusChange:return{up:this.readString()==="UP",inet:this.readInet(),eventType:e};case S0.protocolEvents.schemaChange:return this.parseSchemaChange()}return{eventType:e}}parseSchemaChange(){let e;if(!S0.protocolVersion.supportsSchemaChangeFullMetadata(this.header.version))return e={eventType:S0.protocolEvents.schemaChange,schemaChangeType:this.readString(),keyspace:this.readString(),table:this.readString()},e.isKeyspace=!e.table,e;switch(e={eventType:S0.protocolEvents.schemaChange,schemaChangeType:this.readString(),target:this.readString(),keyspace:this.readString(),table:null,udt:null,signature:null},e.isKeyspace=e.target==="KEYSPACE",e.target){case"TABLE":e.table=this.readString();break;case"TYPE":e.udt=this.readString();break;case"FUNCTION":e.functionName=this.readString(),e.signature=this.readStringList();break;case"AGGREGATE":e.aggregate=this.readString(),e.signature=this.readStringList()}return e}};c(fx,"FrameReader");var hx=fx;t6.exports={FrameReader:hx}});var s6=w(p3=>{"use strict";var dx=require("util"),{Transform:d3,Writable:r6}=require("stream"),St=re(),i6=f0(),hh=ce(),{FrameHeader:f3}=St,{FrameReader:UW}=u6();function fh(u){d3.call(this,u),this.header=null,this.bodyLength=0,this.clearHeaderChunks(),this.version=0,this.headerSize=0}c(fh,"Protocol");dx.inherits(fh,d3);fh.prototype._transform=function(u,e,t){let r=null;try{this.readItems(u)}catch(i){r=i}t(r)};fh.prototype.readItems=function(u){if(!u||u.length===0)return;this.version===0&&(this.version=f3.getProtocolVersion(u),this.headerSize=f3.size(this.version));let e=0,t=this.header;if(this.header=null,this.headerChunks.byteLength!==0){if(this.headerChunks.parts.push(u),this.headerChunks.byteLength+u.lengthu.length-e){if(u.length-e<=0)break;let s=u.slice(e,u.length);this.headerChunks.parts.push(s),this.headerChunks.byteLength=s.length;break}t=f3.fromBuffer(u,e),e+=this.headerSize}let i=u.length-e;if(t.bodyLength<=i+this.bodyLength)r.push({header:t,chunk:u,offset:e,frameEnded:!0}),e+=t.bodyLength-this.bodyLength,this.bodyLength=0;else if(i>=0){this.header=t,this.bodyLength+=i,i>0&&r.push({header:t,chunk:u,offset:e,frameEnded:!1});break}t=null}for(let i=0;iu.cellBuffer.byteLength+e.chunk.length)return u.cellBuffer.byteLength+=e.chunk.length,!1;e.chunk=Buffer.concat(u.cellBuffer.parts,u.cellBuffer.byteLength+e.chunk.length),u.cellBuffer=null}return!0};Lu.prototype.addFrameBuffer=function(u,e){if(!u.buffers){u.buffers=[e.chunk.slice(e.offset)],u.bufferLength=e.chunk.length-e.offset;return}if(e.offset>0)throw new hh.DriverInternalError("Following chunks can not have an offset greater than zero");u.buffers.push(e.chunk),u.bufferLength+=e.chunk.length};Lu.prototype.getFrameBuffer=function(u,e){u.buffers.push(e.chunk);let t=Buffer.concat(u.buffers,u.bodyLength);return u.buffers=null,t};Lu.prototype.parseResult=function(u,e){let t,r=e.offset;try{if(!u.meta)switch(u.kind=e.readInt(),u.kind){case St.resultKind.voidResult:t={header:u.header,flags:u.flagsInfo};break;case St.resultKind.rows:u.meta=e.readMetadata(u.kind);break;case St.resultKind.setKeyspace:t={header:u.header,keyspaceSet:e.readString(),flags:u.flagsInfo};break;case St.resultKind.prepared:{let i=i6.copyBuffer(e.readShortBytes());u.meta=e.readMetadata(u.kind),t={header:u.header,id:i,meta:u.meta,flags:u.flagsInfo};break}case St.resultKind.schemaChange:t={header:u.header,schemaChange:e.parseSchemaChange(),flags:u.flagsInfo};break;default:throw hh.DriverInternalError("Unexpected result kind: "+u.kind)}}catch(i){return this.handleParsingError(i,u,e,r)}if(t)return u.emitted?void 0:(u.emitted=!0,this.push(t));e.remainingLength()>0&&this.parseRows(u,e)};Lu.prototype.parseRows=function(u,e){if(u.parsingError)return;if(u.rowLength===void 0)try{u.rowLength=e.readInt()}catch(r){return this.handleParsingError(r,u,e)}if(u.rowLength===0)return this.push({header:u.header,result:{rows:i6.emptyArray,meta:u.meta,flags:u.flagsInfo}});let t=u.meta;u.rowIndex=u.rowIndex||0;for(let r=u.rowIndex;r{"use strict";var PW=re(),y3=128,n6=7,px=4,kW=256,BW=5e3,gx=class gx{constructor(e){this.currentGroup=a6(0),this.groupIndex=0,this.groups=[this.currentGroup],this.releaseTimeout=null,this.setVersion(e),this.inUse=0,this.releaseDelay=BW}setVersion(e){this.maxGroups=PW.protocolVersion.uses2BytesStreamIds(e)?kW:1}pop(){let e=this.currentGroup.pop();if(typeof e<"u")return this.inUse++,e;for(;this.groupIndex>n6,r=this.groups[t];r.push(e),tthis._releaseGroups(),this.releaseDelay))}_releaseGroups(){let e=0,t=this.groups.length-1;for(;e++px&&t>this.groupIndex&&this.groups[t].length===y3;)this.groups.pop(),t--;this.releaseTimeout=null,this._tryIssueRelease()}};c(gx,"StreamIdStack");var yx=gx;function a6(u){let e=new Array(y3),t=u+y3-1;for(let r=0;r{"use strict";var DW=require("util"),l6=f0(),h6=ce(),f6=Es(),FW=f6.ExecuteRequest,MW=f6.QueryRequest,Bi={init:0,completed:1,timedOut:2,cancelled:3},mx=class mx{constructor(e,t,r){this.request=e,this._rowCallback=t,this._callback=r,this._timeout=null,this._state=Bi.init,this._rowIndex=0,this.streamId=-1}cancel(){this._state===Bi.init&&(this._timeout!==null&&clearTimeout(this._timeout),this._state=Bi.cancelled,this._callback=l6.noop)}canBeWritten(){return this._state===Bi.init}isByRow(){return this._rowCallback&&(this.request instanceof FW||this.request instanceof MW)}setRequestTimeout(e,t,r,i,s){if(this._state!==Bi.init)return;let a=e.getReadTimeout()!==void 0?e.getReadTimeout():t;if(!(a>0))return;let o=this;this._timeout=setTimeout(c(function(){i();let f=DW.format("The host %s did not reply before timeout %d ms",r,a);o._markAsTimedOut(new h6.OperationTimedOutError(f,r),s)},"requestTimedOut"),a)}setResultRow(e,t,r,i,s){if(this._markAsCompleted(),!this._rowCallback)return this.setResult(new h6.DriverInternalError("RowCallback not found for streaming frame handler"));this._rowCallback(this._rowIndex++,e,r),this._rowIndex===r&&this._swapCallbackAndInvoke(null,{rowLength:r,meta:t,flags:i},s.bodyLength)}_markAsTimedOut(e,t){this._state===Bi.init&&(this._state=Bi.timedOut,this._swapCallbackAndInvoke(e,null,null,t))}_markAsCompleted(){this._state===Bi.init&&(this._timeout!==null&&clearTimeout(this._timeout),this._state=Bi.completed)}setResult(e,t,r){this._markAsCompleted(),this._swapCallbackAndInvoke(e,t,r)}_swapCallbackAndInvoke(e,t,r,i){let s=this._callback;this._callback=i||l6.noop,s(e,t,r)}};c(mx,"OperationState");var Ex=mx;d6.exports=Ex});var _x=w((Ao0,g6)=>{"use strict";var y6=require("events"),ph=require("util"),HW=require("tls"),qW=require("net"),VW=h3(),{WriteQueue:GW}=bm(),bo=Es(),xx=s6(),yh=f0(),Vu=re(),vn=ce(),WW=c6(),zW=p6(),YW=iu(),{ExecutionOptions:QW}=gs(),bx=class bx extends y6.EventEmitter{constructor(e,t,r){if(super(),this.setMaxListeners(0),!r)throw new Error("options is not defined");if(this.endpoint=e,this.endpointFriendlyName=this.endpoint,r.sni&&(this._serverName=e,this.endpoint=`${r.sni.addressResolver.getIp()}:${r.sni.port}`,this.endpointFriendlyName=`${this.endpoint} (${this._serverName})`),!this.endpoint||this.endpoint.indexOf(":")<0)throw new Error("EndPoint must contain the ip address and port separated by : symbol");let i=this.endpoint.lastIndexOf(":");this.address=this.endpoint.substr(0,i),this.port=this.endpoint.substr(i+1),Object.defineProperty(this,"options",{value:r,enumerable:!1,writable:!1}),t===null&&(t=Vu.protocolVersion.maxSupported,r.protocolOptions.maxVersion&&(t=r.protocolOptions.maxVersion),this._checkingVersion=!0),this.log=yh.log,this.protocolVersion=t,this._operations=new Map,this._pendingWrites=[],this._preparing=new Map,this._idleTimeout=null,this.timedOutOperations=0,this._streamIds=new WW(this.protocolVersion),this._metrics=r.metrics,this.encoder=new VW(t,r),this.keyspace=null,this.emitDrain=!1,this.connected=!1,this.isSocketOpen=!1,this.send=ph.promisify(this.sendStream),this.closeAsync=ph.promisify(this.close),this.openAsync=ph.promisify(this.open),this.prepareOnceAsync=ph.promisify(this.prepareOnce)}bindSocketListeners(){this.netClient.removeAllListeners("connect"),this.netClient.removeAllListeners("timeout"),this.isSocketOpen=!0,this.netClient.on("close",()=>{this.log("info",`Connection to ${this.endpointFriendlyName} closed`),this.isSocketOpen=!1;let t=this.connected;this.close(),t&&this.emit("socketClose")}),this.protocol=new xx.Protocol({objectMode:!0}),this.parser=new xx.Parser({objectMode:!0},this.encoder);let e=new xx.ResultEmitter({objectMode:!0});e.on("result",this.handleResult.bind(this)),e.on("row",this.handleRow.bind(this)),e.on("frameEnded",this.freeStreamId.bind(this)),e.on("nodeEvent",this.handleNodeEvent.bind(this)),this.netClient.pipe(this.protocol).pipe(this.parser).pipe(e),this.writeQueue=new GW(this.netClient,this.encoder,this.options)}open(e){let t=this;if(this.log("info",`Connecting to ${this.endpointFriendlyName}`),!this.options.sslOptions)this.netClient=new qW.Socket({highWaterMark:this.options.socketOptions.coalescingThreshold}),this.netClient.connect(this.port,this.address,c(function(){t.log("verbose",`Socket connected to ${t.endpointFriendlyName}`),t.bindSocketListeners(),t.startup(e)},"connectCallback"));else{let r=yh.extend({rejectUnauthorized:!1},this.options.sslOptions);this.options.sni&&(r.servername=this._serverName),this.netClient=HW.connect(this.port,this.address,r,c(function(){t.log("verbose",`Secure socket connected to ${t.endpointFriendlyName} with protocol ${t.netClient.getProtocol()}`),t.bindSocketListeners(),t.startup(e)},"tlsConnectCallback")),this.netClient.setMaxSendFragment(this.options.socketOptions.coalescingThreshold)}this.netClient.once("error",c(function(i){t.errorConnecting(i,!1,e)},"socketError")),this.netClient.once("timeout",c(function(){let i=new Vu.DriverError("Connection timeout");t.errorConnecting(i,!0,e)},"connectTimedOut")),this.netClient.setTimeout(this.options.socketOptions.connectTimeout),this.options.socketOptions.keepAlive&&this.netClient.setKeepAlive(!0,this.options.socketOptions.keepAliveDelay),this.netClient.setNoDelay(!!this.options.socketOptions.tcpNoDelay)}startup(e){this._checkingVersion&&this.log("info","Trying to use protocol version 0x"+this.protocolVersion.toString(16));let t=this,r=new bo.StartupRequest({noCompact:this.options.protocolOptions.noCompact,clientId:this.options.id,applicationName:this.options.applicationName,applicationVersion:this.options.applicationVersion});this.sendStream(r,null,c(function(a,o){if(a&&t._checkingVersion){let h=a instanceof vn.ResponseError&&a.code===Vu.responseErrorCodes.protocolError&&a.message.indexOf("Invalid or unsupported protocol version")>=0;if(!h&&Vu.protocolVersion.canStartupResponseErrorBeWrapped(t.protocolVersion)&&(h=a instanceof vn.ResponseError&&a.code===Vu.responseErrorCodes.serverError&&a.message.indexOf("ProtocolException: Invalid or unsupported protocol version")>0),h){let f=t.protocol.version;if(f===t.protocolVersion?f=Vu.protocolVersion.getLowerSupported(t.protocolVersion):Vu.protocolVersion.isSupported(t.protocol.version)||(t.log("info",`Protocol version ${t.protocol.version} not supported by this driver, downgrading`),f=Vu.protocolVersion.getLowerSupported(t.protocol.version)),!f)return i(new Error("Connection was unable to STARTUP using protocol version "+t.protocolVersion));t.log("info","Protocol 0x"+t.protocolVersion.toString(16)+" not supported, using 0x"+f.toString(16)),t.decreaseVersion(f),setImmediate(c(function(){t.close(c(function(){t.open(e)},"decreasingVersionOpening"))},"decreasingVersionClosing"));return}}if(o&&o.mustAuthenticate)return t.startAuthenticating(o.authenticatorName,i);i(a)},"responseCallback"));function i(s){return s?t.errorConnecting(s,!1,e):t.connectionReady(e)}c(i,"startupCallback")}errorConnecting(e,t,r){this.log("warning",`There was an error when trying to connect to the host ${this.endpointFriendlyName}`,e),t&&this.netClient.destroy(),this._metrics.onConnectionError(e),r(e)}connectionReady(e){this.emit("connected"),this.connected=!0,this.netClient.removeAllListeners("error"),this.netClient.on("error",this.handleSocketError.bind(this)),e()}decreaseVersion(e){this.protocolVersion=e,this.encoder.setProtocolVersion(e),this._streamIds.setVersion(e)}handleSocketError(e){this._metrics.onConnectionError(e),this.clearAndInvokePending(e)}clearAndInvokePending(e){this._idleTimeout&&(clearTimeout(this._idleTimeout),this._idleTimeout=null),this._streamIds.clear(),this.emitDrain&&this.emit("drain");let t=new Vu.DriverError("Socket was closed");t.isSocketError=!0,e&&(t.innerError=e);let r=Array.from(this._operations.values());this._operations=new Map,r.length>0&&this.log("info","Invoking "+r.length+" pending callbacks"),yh.each(r,function(s,a){s.setResult(t),a()});let i=this._pendingWrites;this._pendingWrites=[],yh.each(i,function(s,a){s.setResult(t),a()})}startAuthenticating(e,t){if(!this.options.authProvider)return t(new vn.AuthenticationError("Authentication provider not set"));let r=this.options.authProvider.newAuthenticator(this.endpoint,e),i=this;r.initialResponse(c(function(a,o){if(a)return i.onAuthenticationError(t,a);i.authenticate(r,o,t)},"initialResponseCallback"))}authenticate(e,t,r){let i=this,s=new bo.AuthResponseRequest(t);if(this.protocolVersion===1){if(!e.username)return i.onAuthenticationError(r,new vn.AuthenticationError("Only plain text authenticator providers allowed under protocol v1"));s=new bo.CredentialsRequest(e.username,e.password)}this.sendStream(s,null,c(function(o,h){if(o){if(o instanceof vn.ResponseError&&o.code===Vu.responseErrorCodes.badCredentials){let f=new vn.AuthenticationError(o.message);f.additionalInfo=o,o=f}return i.onAuthenticationError(r,o)}if(h.ready)return e.onAuthenticationSuccess(),r();if(h.authChallenge)return e.evaluateChallenge(h.token,c(function(d,p){if(d)return i.onAuthenticationError(r,d);i.authenticate(e,p,r)},"evaluateCallback"));r(new vn.DriverInternalError("Unexpected response from Cassandra: "+ph.inspect(h)))},"authResponseCallback"))}onAuthenticationError(e,t){this._metrics.onAuthenticationError(t),e(t)}async changeKeyspace(e){if(!e||this.keyspace===e)return;if(this.toBeKeyspace===e)return YW.fromEvent(this,"keyspaceChanged");this.toBeKeyspace=e;let t=`USE "${e}"`;try{await this.send(new bo.QueryRequest(t,null,null),null),this.keyspace=e,this.emit("keyspaceChanged",null,e)}catch(r){throw this.log("error",`Connection to ${this.endpointFriendlyName} could not switch active keyspace: ${r}`,r),this.emit("keyspaceChanged",r),r}finally{this.toBeKeyspace=null}}prepareOnce(e,t,r){let i=(t||"")+e,s=this._preparing.get(i);if(s)return s.once("prepared",r);s=new y6.EventEmitter,s.setMaxListeners(0),s.once("prepared",r),this._preparing.set(i,s),this.sendStream(new bo.PrepareRequest(e,t),null,(a,o)=>{s.emit("prepared",a,o),this._preparing.delete(i)})}sendStream(e,t,r){t=t||QW.empty();let i=new zW(e,t.getRowCallback(),(a,o,h)=>{(!a||!a.isSocketError)&&this.emit("responseDequeued"),r(a,o,h)}),s=this._getStreamId();return i.setRequestTimeout(t,this.options.socketOptions.readTimeout,this.endpoint,()=>this.timedOutOperations++,()=>this.timedOutOperations--),s===null?(this.log("info","Enqueuing "+this._pendingWrites.length+", if this message is recurrent consider configuring more connections per host or lowering the pressure"),this._pendingWrites.push(i),i):(this._write(i,s),i)}_write(e,t){e.streamId=t;let r=this;this.writeQueue.push(e,c(function(s){if(s)return r._streamIds.push(t),e.setResult(s);r.log("verbose","Sent stream #"+t+" to "+r.endpointFriendlyName),e.isByRow()&&r.parser.setOptions(t,{byRow:!0}),r._setIdleTimeout(),r._operations.set(t,e)},"writeCallback"))}_setIdleTimeout(){if(!this.options.pooling.heartBeatInterval)return;let e=this,t=this._idleTimeout;e._idleTimeout=setTimeout(()=>e._idleTimeoutHandler(),e.options.pooling.heartBeatInterval),t&&clearTimeout(t)}_idleTimeoutHandler(){if(this.sendingIdleQuery){this._idleTimeout=setTimeout(()=>this._idleTimeoutHandler(),this.options.pooling.heartBeatInterval);return}this.log("verbose",`Connection to ${this.endpointFriendlyName} idling, issuing a request to prevent disconnects`),this.sendingIdleQuery=!0,this.sendStream(bo.options,null,e=>{this.sendingIdleQuery=!1,e&&(this.log("warning","Received heartbeat request error",e),this.emit("idleRequestError",e,this))})}_getStreamId(){return this._streamIds.pop()}freeStreamId(e){let t=e.streamId;t<0||(this._operations.delete(t),this._streamIds.push(t),this.emitDrain&&this._streamIds.inUse===0&&this._pendingWrites.length===0&&this.emit("drain"),this._writeNext())}_writeNext(){if(this._pendingWrites.length===0)return;let e=this._getStreamId();if(e===null)return;let t=this,r;for(;(r=this._pendingWrites.shift())&&!r.canBeWritten(););if(!r){this._streamIds.push(e);return}setImmediate(c(function(){t._write(r,e)},"writeNextPending"))}getInFlight(){return this._streamIds.inUse}handleResult(e,t,r){let i=e.streamId;if(i<0)return this.log("verbose","event received",e);let s=this._operations.get(i);if(!s)return this.log("error","The server replied with a wrong streamId #"+i);this.log("verbose","Received frame #"+i+" from "+this.endpointFriendlyName),s.setResult(t,r,e.bodyLength)}handleNodeEvent(e,t){switch(t.eventType){case Vu.protocolEvents.schemaChange:this.emit("nodeSchemaChange",t);break;case Vu.protocolEvents.topologyChange:this.emit("nodeTopologyChange",t);break;case Vu.protocolEvents.statusChange:this.emit("nodeStatusChange",t);break}}handleRow(e,t,r,i,s){let a=e.streamId;if(a<0)return this.log("verbose","Event received",e);let o=this._operations.get(a);if(!o)return this.log("error","The server replied with a wrong streamId #"+a);o.setResultRow(t,r,i,s,e)}close(e){if(e=e||yh.noop,!this.connected&&!this.isSocketOpen||(this.connected=!1,this.removeAllListeners("drain"),this.clearAndInvokePending(),!this.isSocketOpen))return e();this.isSocketOpen=!1,this.log("verbose",`Closing connection to ${this.endpointFriendlyName}`);let t=this,r=setTimeout(()=>{this.log("info",`${this.endpointFriendlyName} did not respond to connection close within ${this.options.socketOptions.connectTimeout}ms, destroying connection`),this.netClient.destroy()},this.options.socketOptions.connectTimeout);this.netClient.once("close",function(i){clearTimeout(r),i&&t.log("info","The socket closed with a transmission error"),setImmediate(e)}),this.netClient.removeAllListeners("error"),this.netClient.on("error",i=>this.clearAndInvokePending(i)),this.netClient.end()}getLocalAddress(){if(this.netClient)return this.netClient.localAddress}};c(bx,"Connection");var Tx=bx;g6.exports=Tx});var x6=w((vo0,m6)=>{"use strict";var E6=require("util"),jW=require("events"),$W=_x(),g3=f0(),gh=iu(),ZW=ce(),XW=Ml(),Eh=0,JW=Math.pow(2,15),Cx,Su={initial:0,closing:1,shuttingDown:2,shutDown:4},E3=class E3 extends jW.EventEmitter{constructor(e,t){super(),this._address=e.address,this._newConnectionTimeout=null,this._state=Su.initial,this._opening=!1,this._host=e,this.responseCounter=0,this.options=e.options,this.protocolVersion=t,this.coreConnectionsLength=1,this.connections=g3.emptyArray,this.setMaxListeners(0),this.log=g3.log}getInFlight(){let e=this.connections.length;if(e===1)return this.connections[0].getInFlight();let t=0;for(let r=0;r=t)throw new ZW.BusyConnectionError(this._address,t,this.connections.length);return r}static minInFlight(e,t,r){let i=e.length;if(i===1)return e[0];Eh++,Eh>=JW&&(Eh=0);let s;for(let a=Eh;athis.responseCounter++);let t=this;function r(){t.remove(e)}c(r,"connectionErrorCallback"),e.on("idleRequestError",r),e.on("socketClose",r)}addExistingConnection(e){this._addListeners(e),this.connections=this.connections.slice(0),this.connections.push(e)}clearNewConnectionAttempt(){this._newConnectionTimeout&&(clearTimeout(this._newConnectionTimeout),this._newConnectionTimeout=null)}async _attemptNewConnection(){if(this._opening)return await gh.fromEvent(this,"open");this._opening=!0;let e=this._createConnection(),t;try{await e.openAsync()}catch(r){t=r,this.log("warning",`Connection to ${this._address} could not be created: ${t}`,t)}if(this.isClosing()&&(this.log("info",`Connection to ${this._address} opened successfully but pool was being closed`),t=new Error("Connection closed")),t)gh.toBackground(e.closeAsync());else{let r=this.connections.slice(0);r.push(e),this.connections=r,this.log("info",`Connection to ${this._address} opened successfully`)}if(this._opening=!1,this.emit("open",t,e),t)throw t}attemptNewConnectionImmediate(){let e=this;function t(){e.clearNewConnectionAttempt(),e.scheduleNewConnectionAttempt(0)}if(c(t,"openConnection"),this._state===Su.initial)return t();if(this._state===Su.closing)return this.once("close",t)}remove(e){let t=this.connections.indexOf(e);if(t<0)return;let r=this.connections.slice(0);r.splice(t,1),this.connections=r,setImmediate(c(function(){e.close()},"removeClose")),this.emit("remove")}scheduleNewConnectionAttempt(e){if(this.isClosing())return;let t=this;this._newConnectionTimeout=setTimeout(c(function(){if(t._newConnectionTimeout=null,!(t.connections.length>=t.coreConnectionsLength)){if(e>0&&t.options.sni){gh.toBackground(t.options.sni.addressResolver.refresh().then(()=>t._attemptNewConnection()));return}gh.toBackground(t._attemptNewConnection())}},"newConnectionTimeoutExpired"),e)}hasScheduledNewConnection(){return!!this._newConnectionTimeout||this._opening}increaseSize(){this.connections.lengtht.closeAsync())))}};c(E3,"HostConnectionPool");var Rx=E3;function ez(){return Cx===void 0&&(Cx=XW.defaultOptions()),Cx}c(ez,"getDefaultOptions");m6.exports=Rx});var vx=w((Lo0,_6)=>{"use strict";var Ax=ce(),T6=f0(),tz=re(),b6=iu(),sr=class sr{constructor(e,t){this._client=e,this._loadBalancing=t,this.logEmitter=e.options.logEmitter,this.log=T6.log}static async getPrepared(e,t,r,i){let s=e.metadata.getPreparedInfo(i,r);return s.queryId?s:s.preparing?await b6.fromEvent(s,"prepared"):await new sr(e,t)._prepare(s,r,i)}static async getPreparedMultiple(e,t,r,i){let s=[];for(let a of r){let o;if(a&&(o=typeof a=="string"?a:a.query),typeof o!="string")throw new Ax.ArgumentError("Query item should be a string");let{queryId:h,meta:f}=await sr.getPrepared(e,t,o,i);s.push({query:o,params:T6.adaptNamedParamsPrepared(a.params,f.columns),queryId:h,meta:f})}return s}async _prepare(e,t,r){e.preparing=!0;let i;try{return i=await b6.newQueryPlan(this._loadBalancing,r,null),await this._prepareWithQueryPlan(e,i,t,r)}catch(s){throw e.preparing=!1,s.query=t,e.emit("prepared",s),s}}async _prepareWithQueryPlan(e,t,r,i){let s={};for(;;){let a=sr.getNextHost(t,this._client.profileManager,s);if(a===null)throw new Ax.NoHostAvailableError(s);try{let h=await(await sr._borrowWithKeyspace(a,i)).prepareOnceAsync(r,i);return this._client.options.prepareOnAllHosts&&await this._prepareOnAllHosts(t,r,i),e.preparing=!1,e.queryId=h.id,e.meta=h.meta,this._client.metadata.setPreparedById(e),e.emit("prepared",null,e),e}catch(o){if(s[a.address]=o,!o.isSocketError&&!(o instanceof Ax.OperationTimedOutError))throw o}}}static getNextHost(e,t,r){let i;for(;;){let s=e.next();if(s.done)return null;if(i=s.value,t.getDistance(i)!==tz.distance.ignored){if(i.isUp())break;r&&(r[i.address]="Host considered as DOWN")}}return i}static async prepareAllQueries(e,t){let r=[],i=new Map;t.forEach(s=>{let a;s.keyspace?(a=i.get(s.keyspace),a||(a=[],i.set(s.keyspace,a))):a=r,a.push(s.query)});for(let[s,a]of i)await sr._borrowAndPrepare(e,s,a);await sr._borrowAndPrepare(e,null,r)}static async _borrowAndPrepare(e,t,r){if(r.length===0)return;let i=await sr._borrowWithKeyspace(e,t);for(let s of r)await i.prepareOnceAsync(s,t)}static async _borrowWithKeyspace(e,t){let r=e.borrowConnection();return t&&r.keyspace!==t&&await r.changeKeyspace(t),r}_prepareOnAllHosts(e,t,r){let i=[t],s,a=[];for(;(s=sr.getNextHost(e,this._client.profileManager))!==null;)a.push(s);return Promise.all(a.map(o=>sr._borrowAndPrepare(o,r,i).catch(h=>this.log("verbose",`Unexpected error while preparing query (${t}) on ${o.address}`,h))))}};c(sr,"PrepareHandler");var wx=sr;_6.exports=wx});var A6=w((Ko0,R6)=>{"use strict";var C6=require("events"),m3=f0(),x3=re(),uz=x6(),rz=vx(),iz=iu(),sz=200,Sx=class Sx extends C6.EventEmitter{constructor(e,t,r,i){super(),this.address=e,this.setDownAt=0,this.log=m3.log,this.isUpSince=null,Object.defineProperty(this,"options",{value:r,enumerable:!1,writable:!1}),Object.defineProperty(this,"pool",{value:new uz(this,t),enumerable:!1}),this.pool.on("open",s=>iz.toBackground(this._onNewConnectionOpen(s))),this.pool.on("remove",()=>this._checkPoolState()),this.cassandraVersion=null,this.datacenter=null,this.rack=null,this.tokens=null,this.hostId=null,this.dseVersion=null,this.workloads=m3.emptyArray,this._distance=x3.distance.ignored,this._healthResponseCounter=0,Object.defineProperty(this,"_metadata",{value:i,enumerable:!1}),Object.defineProperty(this,"_healthResponseCountTimer",{value:null,enumerable:!1,writable:!0}),this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),this.reconnectionDelay=0}setDown(){this.setDownAt===0&&(this.pool.isClosing()||(this.setDownAt=Date.now(),this.pool.coreConnectionsLength>0?this.log("warning",`Host ${this.address} considered as DOWN. Reconnection delay ${this.reconnectionDelay}ms.`):this.log("info",`Host ${this.address} considered as DOWN.`),this.emit("down"),this._checkPoolState()))}setUp(e){this.setDownAt&&(this.log("info",`Setting host ${this.address} as UP`),this.setDownAt=0,this.isUpSince=Date.now(),this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),e&&this.pool.clearNewConnectionAttempt(),this.emit("up"))}checkIsUp(){this.isUp()||(this.reconnectionSchedule=this.options.policies.reconnection.newSchedule(),this.reconnectionDelay=0,this.pool.attemptNewConnectionImmediate())}shutdown(e){return this._healthResponseCountTimer&&clearInterval(this._healthResponseCountTimer),e?(this.pool.drainAndShutdown(),Promise.resolve()):this.pool.shutdown()}isUp(){return!this.setDownAt}canBeConsideredAsUp(){let e=this;function t(){return new Date().getTime()-e.setDownAt>=e.reconnectionDelay}return c(t,"hasTimePassed"),!this.setDownAt||t()}setDistance(e){let t=this._distance;return this._distance=e||x3.distance.local,this.options.pooling.coreConnectionsPerHost?this.pool.coreConnectionsLength=this.options.pooling.coreConnectionsPerHost[this._distance]||0:this.pool.coreConnectionsLength=1,this._distance===t?this._distance:(this._healthResponseCountTimer&&clearInterval(this._healthResponseCountTimer),this._distance===x3.distance.ignored?(this.emit("ignore"),this.pool.drainAndShutdown()):(this.isUp()||this.checkIsUp(),this._healthResponseCountTimer=setInterval(()=>{this._healthResponseCounter=this.pool.getAndResetResponseCounter()},sz)),this._distance)}setProtocolVersion(e){this.pool.protocolVersion=e}borrowConnection(e){return this.pool.borrowConnection(e)}warmupPool(e){return this.pool.warmup(e)}initializePool(){this.pool.increaseSize()}getActiveConnection(){return!this.isUp()||!this.pool.connections.length?null:this.pool.connections[0]}getResponseCount(){return this._healthResponseCounter+this.pool.responseCounter}checkHealth(e){e.timedOutOperations<=this.options.socketOptions.defunctReadTimeoutThreshold||this.removeFromPool(e)}removeFromPool(e){this.pool.remove(e),this._checkPoolState()}getInFlight(){return this.pool.getInFlight()}_checkPoolState(){if(this.pool.isClosing())return;this.pool.connections.length0&&this.pool.connections.length===0&&this.setDown()}async _onNewConnectionOpen(e){if(e){this._checkPoolState();return}if(!this.isUp()&&this.options.rePrepareOnUp){this.log("info",`Re-preparing all queries on host ${this.address} before setting it as UP`);let t=this._metadata.getAllPrepared();try{await rz.prepareAllQueries(this,t)}catch(r){this.log("warning",`Failed re-preparing on host ${this.address}: ${r}`,r)}}this.setUp(),this.pool.increaseSize()}getCassandraVersion(){return this.cassandraVersion?this.cassandraVersion.split("-")[0].split(".").map(e=>parseInt(e,10)):m3.emptyArray}getDseVersion(){return this.dseVersion?this.dseVersion.split("-")[0].split(".").map(e=>parseInt(e,10)):m3.emptyArray}};c(Sx,"Host");var Ix=Sx,Kx=class Kx extends C6.EventEmitter{constructor(){super(),this._items=new Map,this._values=null,Object.defineProperty(this,"length",{get:()=>this.values().length,enumerable:!0})}forEach(e){let t=this._items;for(let[r,i]of t)e(i,r)}get(e){return this._items.get(e)}keys(){return Array.from(this._items.keys())}remove(e){let t=this._items.get(e);if(t===void 0)return;this._values=null;let r=new Map(this._items);r.delete(e),this._items=r,this.emit("remove",t)}removeMultiple(e){this._values=null;let t=new Map(this._items),r=[];for(let i of e){let s=t.get(i);s&&(r.push(s),t.delete(i))}this._items=t,r.forEach(i=>this.emit("remove",i))}set(e,t){this._values=null;let r=this._items.get(e);if(r){this._items.set(e,t),this.emit("remove",r),this.emit("add",t);return}let i=new Map(this._items);return i.set(e,t),this._items=i,this.emit("add",t),t}slice(e,t){return!e&&!t?this.values():this.values().slice(e||0,t)}push(e,t){this.set(e,t)}values(){return this._values||(this._values=Object.freeze(Array.from(this._items.values()))),this._values}clear(){let e=this.values();return this._values=null,this._items=new Map,e.forEach(t=>this.emit("remove",t)),e}inspect(){return this._items}toJSON(){if(Object.fromEntries)return Object.fromEntries(this._items);let e={};for(let[t,r]of this._items)e[t]=r;return e}};c(Kx,"HostMap");var Lx=Kx;R6.exports={Host:Ix,HostMap:Lx}});var v6=w(_3=>{"use strict";var nz=re(),bs=nh(),Ox=f0(),De=Wm(),{Integer:mt}=nz,T3=new De(21461,4418,31633,34755),b3=new De(37759,10053,44355,19701),w6=De.fromNumber(5),az=new De(36045,60757,45015,65361),oz=new De(60499,6789,47614,50382),cz=De.fromNumber(1390208809),lz=De.fromNumber(944331445),kx=class kx{constructor(){}hash(e){throw new Error("You must implement a hash function for the tokenizer")}parse(e){throw new Error("You must implement a parse function for the tokenizer")}minToken(){throw new Error("You must implement a minToken function for the tokenizer")}split(e,t,r){throw new Error("You must implement a split function for the tokenizer")}splitBase(e,t,r,i,s){let a=mt.fromInt(s),o=t.divide(a),h=t.modulo(a),f=[],d=e,p=o.add(mt.ONE);for(let E=1;E>4,a=new De,o=new De,h=new De,f=new De;for(let d=0;d>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0)),e.multiply(az);let t=new De(e.getUint16(2)>>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0);e.xor(t),e.multiply(oz),e.xor(new De(e.getUint16(2)>>>1|e.getUint16(3)<<15&65535,e.getUint16(3)>>>1,0,0))}parse(e){return new bs.Murmur3Token(De.fromString(e))}minToken(){return this._minToken||(this._minToken=this.parse("-9223372036854775808")),this._minToken}maxToken(){return this._maxToken||(this._maxToken=this.parse("9223372036854775807")),this._maxToken}maxValue(){return this._maxValue||(this._maxValue=mt.fromString("9223372036854775807")),this._maxValue}minValue(){return this._minValue||(this._minValue=mt.fromString("-9223372036854775808")),this._minValue}ringLength(){return this._ringLength||(this._ringLength=this.maxValue().subtract(this.minValue())),this._ringLength}split(e,t,r){e.equals(t)&&e.equals(this.minToken())&&(t=this.maxToken());let i=mt.fromString(e.getValue().toString()),a=mt.fromString(t.getValue().toString()).subtract(i);return a.isNegative()&&(a=a.add(this.ringLength())),this.splitBase(i,a,this.maxValue(),this.ringLength(),r).map(h=>this.parse(h.toString()))}stringify(e){let t=e.getValue();return t.getUint16(0)+","+t.getUint16(1)+","+t.getUint16(2)+","+t.getUint16(3)}};c(Bx,"Murmur3Tokenizer");var Nx=Bx,Dx=class Dx extends mh{constructor(){super(),this._crypto=require("crypto")}hash(e){Array.isArray(e)&&(e=Ox.allocBufferFromArray(e));let t=this._crypto.createHash("md5").update(e).digest();return new bs.RandomToken(mt.fromBuffer(t).abs())}parse(e){return new bs.RandomToken(mt.fromString(e))}minToken(){return this._minToken||(this._minToken=this.parse("-1")),this._minToken}maxValue(){return this._maxValue||(this._maxValue=mt.fromNumber(Math.pow(2,127))),this._maxValue}maxToken(){return this._maxToken||(this._maxToken=new bs.RandomToken(this.maxValue())),this._maxToken}ringLength(){return this._ringLength||(this._ringLength=this.maxValue().add(mt.ONE)),this._ringLength}split(e,t,r){e.equals(t)&&e.equals(this.minToken())&&(t=this.maxToken());let i=e.getValue(),a=t.getValue().subtract(i);return a.lessThan(mt.ZERO)&&(a=a.add(this.ringLength())),this.splitBase(i,a,this.maxValue(),this.ringLength(),r).map(h=>new bs.RandomToken(h))}};c(Dx,"RandomTokenizer");var Ux=Dx,Fx=class Fx extends mh{constructor(){super()}hash(e){Array.isArray(e)&&(e=Ox.allocBufferFromArray(e));let t=e.length;for(let r=e.length-1;r>0&&e[r]===0;r--)t=r;return new bs.ByteOrderedToken(e.slice(0,t))}stringify(e){return e.getValue().toString("hex")}parse(e){return this.hash(Ox.allocBufferFromString(e,"hex"))}minToken(){return this._minToken||(this._minToken=this.hash([])),this._minToken}_toNumber(e,t){let r=e;e.length!==t&&(r=Buffer.alloc(t),e.copy(r));let i=new Array(Math.ceil(r.length/4));for(let s=0;s=0);)p+=1,x+=1}else{let x=0;for(;s=this._toNumber(e.getValue(),p),a=this._toNumber(t.getValue(),p),h=mt.fromNumber(Math.pow(2,p*8)),f=h.subtract(mt.ONE),o=a.subtract(s).add(h),!(x===4||o.compare(d)>=0);)p+=1,x+=1}return this.splitBase(s,o,f,h,r).map(x=>new bs.ByteOrderedToken(this._toBuffer(x,p)))}};c(Fx,"ByteOrderedTokenizer");var Px=Fx;function au(u){return u<128?new De(u,0,0,0):new De(u-256&65535,65535,65535,65535)}c(au,"fromSignedByte");_3.Murmur3Tokenizer=Nx;_3.RandomTokenizer=Ux;_3.ByteOrderedTokenizer=Px});var Mx=w((Po0,S6)=>{"use strict";var hz=require("util"),I6=require("events");function L6(u){I6.EventEmitter.call(this),this.setMaxListeners(0),Object.defineProperty(this,"loading",{value:!1,enumerable:!1,writable:!0}),Object.defineProperty(this,"loaded",{value:!1,enumerable:!1,writable:!0}),this.name=u,this.bloomFilterFalsePositiveChance=0,this.caching=null,this.comment=null,this.gcGraceSeconds=0,this.compactionClass=null,this.compactionOptions=null,this.compression=null,this.localReadRepairChance=0,this.readRepairChance=0,this.extensions=null,this.crcCheckChance=null,this.populateCacheOnFlush=!1,this.defaultTtl=0,this.speculativeRetry="NONE",this.minIndexInterval=128,this.maxIndexInterval=2048,this.columns=null,this.columnsByName=null,this.partitionKeys=[],this.clusteringKeys=[],this.clusteringOrder=[],this.nodesync=null}c(L6,"DataCollection");hz.inherits(L6,I6.EventEmitter);S6.exports=L6});var U6=w((Bo0,N6)=>{"use strict";var fz=require("util"),K6=Mx();function O6(u){K6.call(this,u),this.replicateOnWrite=!0,this.memtableFlushPeriod=0,this.indexInterval=null,this.isCompact=!1,this.indexes=null,this.cdc=null,this.virtual=!1}c(O6,"TableMetadata");fz.inherits(O6,K6);N6.exports=O6});var k6=w((Fo0,P6)=>{"use strict";function dz(){this.name=null,this.keyspaceName=null,this.signature=null,this.argumentTypes=null,this.stateFunction=null,this.stateType=null,this.finalFunction=null,this.initConditionRaw=null,this.initCondition=null,this.returnType=null,this.deterministic=null}c(dz,"Aggregate");P6.exports=dz});var D6=w((Ho0,B6)=>{"use strict";function pz(){this.name=null,this.keyspaceName=null,this.signature=null,this.argumentNames=null,this.argumentTypes=null,this.body=null,this.calledOnNullInput=null,this.language=null,this.returnType=null,this.deterministic=null,this.monotonic=null,this.monotonicOn=null}c(pz,"SchemaFunction");B6.exports=pz});var M6=w((Vo0,F6)=>{"use strict";var Hx=require("util"),yz=f0(),qx=re(),xh={custom:0,keys:1,composites:2};function _s(u,e,t,r){this.name=u,this.target=e,this.kind=typeof t=="string"?Vx(t):t,this.options=r}c(_s,"Index");_s.prototype.isCompositesKind=function(){return this.kind===xh.composites};_s.prototype.isKeysKind=function(){return this.kind===xh.keys};_s.prototype.isCustomKind=function(){return this.kind===xh.custom};_s.fromRows=function(u){return!u||u.length===0?yz.emptyArray:u.map(function(e){let t=e.options;return new _s(e.index_name,t.target,Vx(e.kind),t)})};_s.fromColumnRows=function(u,e){let t=[];for(let r=0;r{"use strict";var gz=require("util"),H6=Mx();function q6(u){H6.call(this,u),this.tableName=null,this.whereClause=null,this.includeAllColumns=!1}c(q6,"MaterializedView");gz.inherits(q6,H6);V6.exports=q6});var eK=w(zx=>{"use strict";var Th=require("util"),W6=require("events"),Ez=re(),Kt=f0(),mz=ce(),C3=iu(),xz=U6(),Q6=k6(),j6=D6(),$6=M6(),z6=G6(),{format:In}=Th,Tz="SELECT * FROM system.schema_keyspaces",bz="SELECT * FROM system.schema_keyspaces where keyspace_name = '%s'",Z6="SELECT * FROM system_schema.keyspaces",X6="SELECT * FROM system_schema.keyspaces where keyspace_name = '%s'",_z="SELECT * FROM system.schema_columnfamilies WHERE keyspace_name='%s' AND columnfamily_name='%s'",Cz="SELECT * FROM system_schema.tables WHERE keyspace_name='%s' AND table_name='%s'",Rz="SELECT * FROM system.schema_columns WHERE keyspace_name='%s' AND columnfamily_name='%s'",Az="SELECT * FROM system_schema.columns WHERE keyspace_name='%s' AND table_name='%s'",wz="SELECT * FROM system_schema.indexes WHERE keyspace_name='%s' AND table_name='%s'",vz="SELECT * FROM system.schema_usertypes WHERE keyspace_name='%s' AND type_name='%s'",Iz="SELECT * FROM system_schema.types WHERE keyspace_name='%s' AND type_name='%s'",Lz="SELECT * FROM system.schema_functions WHERE keyspace_name = '%s' AND function_name = '%s'",Sz="SELECT * FROM system_schema.functions WHERE keyspace_name = '%s' AND function_name = '%s'",Kz="SELECT * FROM system.schema_aggregates WHERE keyspace_name = '%s' AND aggregate_name = '%s'",Oz="SELECT * FROM system_schema.aggregates WHERE keyspace_name = '%s' AND aggregate_name = '%s'",Nz="SELECT * FROM system_schema.views WHERE keyspace_name = '%s' AND view_name = '%s'",Uz="SELECT * FROM system_virtual_schema.keyspaces",Pz="SELECT * FROM system_virtual_schema.keyspaces where keyspace_name = '%s'",Y6="SELECT * FROM system_virtual_schema.tables where keyspace_name = '%s' and table_name='%s'",kz="SELECT * FROM system_virtual_schema.columns where keyspace_name = '%s' and table_name='%s'",Yx=class Yx{constructor(e,t){this.cc=t,this.encodingOptions=e.encoding,this.selectTable=null,this.selectColumns=null,this.selectIndexes=null,this.selectUdt=null,this.selectAggregates=null,this.selectFunctions=null,this.supportsVirtual=!1}_createKeyspace(e,t,r,i,s){return{name:e,durableWrites:t,strategy:r,strategyOptions:i,virtual:s===!0,udts:{},tables:{},functions:{},aggregates:{},views:{},tokenToReplica:Fz(r,i),graphEngine:void 0}}getKeyspace(e){}getKeyspaces(e){}async getTable(e,t,r,i){let s=r&&r[t];if(s||(s=new xz(t),r&&(r[t]=s)),s.loaded)return s;if(s.loading)return C3.fromEvent(s,"load");try{s.loading=!0;let a,o=i,h=o?Y6:this.selectTable,f=Th.format(h,e,t),d=await this._getFirstRow(f);if(!d&&this.supportsVirtual&&o===void 0){let x=Th.format(Y6,e,t);try{d=await this._getFirstRow(x)}catch{}d&&(o=!0)}if(!d)return s.loading=!1,s.emit("load",null,null),null;let p=o?kz:this.selectColumns,E=await this._getRows(Th.format(p,e,t));return this.selectIndexes&&!o&&(a=await this._getRows(Th.format(this.selectIndexes,e,t))),await this._parseTableOrView(s,d,E,a,o),s.loaded=!0,s.emit("load",null,s),s}catch(a){throw s.emit("load",a,null),a}finally{s.loading=!1}}async _getFirstRow(e){return(await this._getRows(e))[0]}async _getRows(e){return(await this.cc.query(e)).rows}async getUdt(e,t,r){let i=r&&r[t];if(i||(i=new W6.EventEmitter,r&&(r[t]=i),i.setMaxListeners(0),i.loading=!1,i.name=t,i.keyspace=e,i.fields=null),i.fields)return i;if(i.loading)return C3.fromEvent(i,"load");i.loading=!0;let s=In(this.selectUdt,e,t);try{let a=await this._getFirstRow(s);return a?(await this._parseUdt(i,a),i.emit("load",null,i),i):(i.loading=!1,i.emit("load",null,null),null)}catch(a){throw i.emit("load",a),a}finally{i.loading=!1}}_parseUdt(e,t){}async _parseTableOrView(e,t,r,i,s){}getMaterializedView(e,t,r){}async getFunctions(e,t,r,i){let s=this.selectFunctions,a=c(h=>this._parseFunction(h),"parser");r&&(s=this.selectAggregates,a=c(h=>this._parseAggregate(h),"parser"));let o=i&&i[t];if(o||(o=new W6.EventEmitter,i&&(i[t]=o),o.setMaxListeners(0)),o.values)return o.values;if(o.loading)return C3.fromEvent(o,"load");o.loading=!0;try{let h=await this._getRows(In(s,e,t)),f=await Promise.all(h.map(a)),d=new Map;return h.length>0&&(o.values=d),f.forEach(p=>o.values.set(p.signature.join(","),p)),o.emit("load",null,d),d}catch(h){throw o.emit("load",h),h}finally{o.loading=!1}}_parseAggregate(e){}_parseFunction(e){}_asMap(e){return e?this.encodingOptions.map&&e instanceof this.encodingOptions.map?e:new Map(Object.keys(e).map(t=>[t,e[t]])):new Map}_mapAsObject(e){if(!e)return e;if(this.encodingOptions.map&&e instanceof this.encodingOptions.map){let t={};return e.forEach((r,i)=>t[i]=r),t}return e}};c(Yx,"SchemaParser");var R3=Yx,Qx=class Qx extends R3{constructor(e,t){super(e,t),this.selectTable=_z,this.selectColumns=Rz,this.selectUdt=vz,this.selectAggregates=Kz,this.selectFunctions=Lz}async getKeyspaces(e){let t={},r=await this.cc.query(Tz,e);for(let i=0;i0&&(e.partitionKeys=p.sort(Kt.propCompare("index")).map(m=>m.c),E.sort(Kt.propCompare("index")),e.clusteringKeys=E.map(m=>m.c),e.clusteringOrder=E.map(m=>m.order));let x=e.partitionKeys.length===0;if(x&&t.key_aliases){p=JSON.parse(t.key_aliases),h=f.parseKeyTypes(t.key_validator).types;for(let m=0;mt.parseFqTypeName(s)),r.stateType=t.parseFqTypeName(e.state_type);let i=t.decode(r.initConditionRaw,r.stateType);return i!==null&&typeof i<"u"&&(r.initCondition=i.toString()),r.returnType=t.parseFqTypeName(e.return_type),r}async _parseFunction(e){let t=this.cc.getEncoder(),r=new j6;return r.name=e.function_name,r.keyspaceName=e.keyspace_name,r.signature=e.signature||Kt.emptyArray,r.argumentNames=e.argument_names||Kt.emptyArray,r.body=e.body,r.calledOnNullInput=e.called_on_null_input,r.language=e.language,r.argumentTypes=(e.argument_types||Kt.emptyArray).map(i=>t.parseFqTypeName(i)),r.returnType=t.parseFqTypeName(e.return_type),r}async _parseUdt(e,t){let r=this.cc.getEncoder(),i=t.field_names,s=t.field_types,a=new Array(i.length);for(let o=0;o{let I=await a.parseTypeName(t.keyspace_name,T.type,0,null,this.udtResolver),L={name:T.column_name,type:I,isStatic:!1};switch(o[L.name]=L,T.kind){case"partition_key":h.push({c:L,index:T.position||0});break;case"clustering":f.push({c:L,index:T.position||0,order:T.clustering_order==="desc"?"DESC":"ASC"});break;case"static":L.isStatic=!0;break}return L})),e.columnsByName=o,e.partitionKeys=h.sort(Kt.propCompare("index")).map(T=>T.c),f.sort(Kt.propCompare("index")),e.clusteringKeys=f.map(T=>T.c),e.clusteringOrder=f.map(T=>T.order),s){e.virtual=!0;return}let d=e instanceof z6;e.bloomFilterFalsePositiveChance=t.bloom_filter_fp_chance,e.caching=JSON.stringify(t.caching),e.comment=t.comment;let p=this._asMap(t.compaction);if(p&&(e.compactionOptions={},e.compactionClass=p.get("class"),p.forEach((T,I)=>{I!=="class"&&(e.compactionOptions[I]=p.get(I))})),e.compression=this._mapAsObject(t.compression),e.gcGraceSeconds=t.gc_grace_seconds,e.localReadRepairChance=t.dclocal_read_repair_chance,e.readRepairChance=t.read_repair_chance,e.extensions=this._mapAsObject(t.extensions),e.crcCheckChance=t.crc_check_chance,e.memtableFlushPeriod=t.memtable_flush_period_in_ms||e.memtableFlushPeriod,e.defaultTtl=t.default_time_to_live||e.defaultTtl,e.speculativeRetry=t.speculative_retry||e.speculativeRetry,e.minIndexInterval=t.min_index_interval||e.minIndexInterval,e.maxIndexInterval=t.max_index_interval||e.maxIndexInterval,e.nodesync=t.nodesync||e.nodesync,!d){let T=t.cdc;T!==void 0&&(e.cdc=T)}if(d){e.tableName=t.base_table_name,e.whereClause=t.where_clause,e.includeAllColumns=t.include_all_columns;return}e.indexes=this._getIndexes(i);let E=t.flags;Array.isArray(E)&&(E=new Set(E));let x=E.has("dense"),g=E.has("super"),m=E.has("compound");e.isCompact=g||x||!m,!g&&!x&&!m?Bz(e):x&&Dz(e)}_getIndexes(e){return!e||e.length===0?Kt.emptyArray:e.map(t=>{let r=this._mapAsObject(t.options);return new $6(t.index_name,r.target,t.kind,r)})}async _parseAggregate(e){let t=this.cc.getEncoder(),r=new Q6;return r.name=e.aggregate_name,r.keyspaceName=e.keyspace_name,r.signature=e.argument_types||Kt.emptyArray,r.stateFunction=e.state_func,r.finalFunction=e.final_func,r.initConditionRaw=e.initcond,r.initCondition=r.initConditionRaw,r.deterministic=e.deterministic||!1,r.argumentTypes=await Promise.all(r.signature.map(i=>t.parseTypeName(e.keyspace_name,i,0,null,this.udtResolver))),r.stateType=await t.parseTypeName(e.keyspace_name,e.state_type,0,null,this.udtResolver),r.returnType=await t.parseTypeName(e.keyspace_name,e.return_type,0,null,this.udtResolver),r}async _parseFunction(e){let t=this.cc.getEncoder(),r=new j6;return r.name=e.function_name,r.keyspaceName=e.keyspace_name,r.signature=e.argument_types||Kt.emptyArray,r.argumentNames=e.argument_names||Kt.emptyArray,r.body=e.body,r.calledOnNullInput=e.called_on_null_input,r.language=e.language,r.deterministic=e.deterministic||!1,r.monotonic=e.monotonic||!1,r.monotonicOn=e.monotonic_on||Kt.emptyArray,r.argumentTypes=await Promise.all(r.signature.map(i=>t.parseTypeName(e.keyspace_name,i,0,null,this.udtResolver))),r.returnType=await t.parseTypeName(e.keyspace_name,e.return_type,0,null,this.udtResolver),r}async _parseUdt(e,t){let r=this.cc.getEncoder(),i=t.field_types,s=t.keyspace_name;return e.fields=await Promise.all(t.field_names.map(async(a,o)=>{let h=await r.parseTypeName(s,i[o],0,null,this.udtResolver);return{name:a,type:h}})),e}};c(jx,"SchemaParserV2");var A3=jx,$x=class $x extends A3{constructor(e,t,r){super(e,t,r),this.supportsVirtual=!0}async getKeyspaces(e){let t={},r=[{query:Z6,virtual:!1},{query:Uz,virtual:!0}];return await Promise.all(r.map(async i=>{let s=null;try{s=await this.cc.query(i.query,e)}catch(a){if(i.virtual)return;throw a}for(let a=0;a1)return Mz(t)}return/NetworkTopologyStrategy$/.test(u)?Hz(e):c(function(r,i,s){let a={};for(let o in s)s.hasOwnProperty(o)&&(a[o]=[s[o]]);return a},"noStrategy")}c(Fz,"getTokenToReplicaMapper");function Mz(u){return c(function(t,r,i){let s=r.length,a=Math.min(u,s),o={};for(let h=0;h=s&&(E=E%s);let x=i[r[E]];d.indexOf(x)===-1&&d.push(x)}o[f]=d}return o},"tokenSimpleStrategy")}c(Mz,"getTokenToReplicaSimpleMapper");function Hz(u){return c(function(t,r,i,s){let a={},o=r.length;for(let h=0;h=o&&(m=m%o);let A=i[r[m]];if(d.indexOf(A)!==-1)continue;let T=A.datacenter,I=parseInt(u[T],10);if(!I)continue;I=Math.min(I,s[T].hostLength);let L=p[T]||0;if(L>=I)continue;let N=E[T];if(N||(N=E[T]=new Kt.HashSet),A.rack&&N.contains(A.rack)&&N.length0&&(!t[s]||t[s]=4&&(s=Wx),!i||!(i instanceof s)?new s(u,e,t):i}c(Vz,"getByVersion");zx.getByVersion=Vz;zx.isDoneForToken=J6});var u5=w((jo0,rK)=>{"use strict";var Gz=require("events"),w3=require("util"),Zx=v6(),v3=f0(),bh=ce(),_o=re(),I3=Es(),tK=eK(),nr=iu(),{TokenRange:L3}=nh(),{ExecutionOptions:Wz}=gs(),zz="SELECT * FROM system_traces.sessions WHERE session_id=%s",Yz="SELECT * FROM system_traces.events WHERE session_id=%s",Qz="SELECT schema_version FROM system.peers",jz="SELECT schema_version FROM system.local",uK=5,$z=400,e5=class e5{constructor(e,t){if(!e)throw new bh.ArgumentError("Options are not defined");Object.defineProperty(this,"options",{value:e,enumerable:!1,writable:!1}),Object.defineProperty(this,"controlConnection",{value:t,enumerable:!1,writable:!1}),this.keyspaces={},this.initialized=!1,this._isDbaas=!1,this._schemaParser=tK.getByVersion(e,t,this.getUdt.bind(this)),this.log=v3.log,this._preparedQueries=new Jx(e.maxPrepared,(...r)=>this.log(...r))}setCassandraVersion(e){this._schemaParser=tK.getByVersion(this.options,this.controlConnection,this.getUdt.bind(this),e,this._schemaParser)}isDbaas(){return this._isDbaas}setProductTypeAsDbaas(){this._isDbaas=!0}setPartitioner(e){return/RandomPartitioner$/.test(e)?this.tokenizer=new Zx.RandomTokenizer:/ByteOrderedPartitioner$/.test(e)?this.tokenizer=new Zx.ByteOrderedTokenizer:this.tokenizer=new Zx.Murmur3Tokenizer}buildTokens(e){if(!this.tokenizer)return this.log("error","Tokenizer could not be determined");let t=[],r={},i=e.values(),s=this.tokenizer.stringify,a={};i.forEach(h=>{if(!h.tokens)return;h.tokens.forEach(d=>{let p=this.tokenizer.parse(d);v3.insertSorted(t,p,(E,x)=>E.compare(x)),r[s(p)]=h});let f=a[h.datacenter];f||(f=a[h.datacenter]={hostLength:0,racks:new v3.HashSet}),f.hostLength++,f.racks.add(h.rack)}),this.primaryReplicas=r,this.ring=t;let o=new Set;if(this.ring.length===1){let h=this.tokenizer.minToken();o.add(new L3(h,h,this.tokenizer))}else for(let h=0;h"u")&&(t=e,e=!0),!this.initialized){let r=this._uninitializedError();return t?t(r):Promise.reject(r)}return nr.optionalCallback(this.refreshKeyspacesInternal(e),t)}async refreshKeyspacesInternal(e){this.log("info","Retrieving keyspaces metadata");try{return this.keyspaces=await this._schemaParser.getKeyspaces(e),this.keyspaces}catch(t){throw this.log("error","There was an error while trying to retrieve keyspaces information",t),t}}_getKeyspaceReplicas(e){return e.replicas||(e.replicas=e.tokenToReplica(this.tokenizer,this.ringTokensAsStrings,this.primaryReplicas,this.datacenters)),e.replicas}getReplicas(e,t){if(!this.ring)return null;Buffer.isBuffer(t)&&(t=this.tokenizer.hash(t)),t instanceof L3&&(t=t.end);let r;if(e&&(r=this.keyspaces[e],!r))return null;let i=v3.binarySearch(this.ring,t,(o,h)=>o.compare(h));i<0&&(i=~i),i>=this.ring.length&&(i=i%this.ring.length);let s=this.ringTokensAsStrings[i];return e?this._getKeyspaceReplicas(r)[s]:[this.primaryReplicas[s]]}getTokenRanges(){return this.tokenRanges}getTokenRangesForHost(e,t){if(!this.ring)return null;let r;if(e&&(r=this.keyspaces[e],!r))return null;if(this.ring.length===1)return this.getTokenRanges();let i=this._getKeyspaceReplicas(r),s=new Set;return this.tokenRanges.forEach(a=>{i[this.tokenizer.stringify(a.end)].indexOf(t)!==-1&&s.add(a)}),s}newToken(e){if(!this.tokenizer)throw new Error("Partitioner not established. This should only happen if metadata was disabled or you have not connected yet.");return Array.isArray(e)?this.tokenizer.hash(Buffer.concat(e)):w3.isString(e)?this.tokenizer.parse(e):this.tokenizer.hash(e)}newTokenRange(e,t){if(!this.tokenizer)throw new Error("Partitioner not established. This should only happen if metadata was disabled or you have not connected yet.");return new L3(e,t,this.tokenizer)}getPreparedInfo(e,t){return this._preparedQueries.getOrAdd(e,t)}clearPrepared(){this._preparedQueries.clear()}getPreparedById(e){return this._preparedQueries.getById(e)}setPreparedById(e){return this._preparedQueries.setById(e)}getAllPrepared(){return this._preparedQueries.getAll()}_uninitializedError(){return new Error("Metadata has not been initialized. This could only happen if you have not connected yet.")}getUdt(e,t,r){return nr.optionalCallback(this._getUdt(e,t),r)}async _getUdt(e,t){if(!this.initialized)throw this._uninitializedError();let r;if(this.options.isMetadataSyncEnabled){let i=this.keyspaces[e];if(!i)return null;r=i.udts}return await this._schemaParser.getUdt(e,t,r)}getTable(e,t,r){return nr.optionalCallback(this._getTable(e,t),r)}async _getTable(e,t){if(!this.initialized)throw this._uninitializedError();let r,i;if(this.options.isMetadataSyncEnabled){let s=this.keyspaces[e];if(!s)return null;r=s.tables,i=s.virtual}return await this._schemaParser.getTable(e,t,r,i)}getFunctions(e,t,r){return nr.optionalCallback(this._getFunctionsWrapper(e,t),r)}async _getFunctionsWrapper(e,t){if(!e||!t)throw new bh.ArgumentError("You must provide the keyspace name and cql function name to retrieve the metadata");let r=await this._getFunctions(e,t,!1);return Array.from(r.values())}getFunction(e,t,r,i){return nr.optionalCallback(this._getSingleFunction(e,t,r,!1),i)}getAggregates(e,t,r){return nr.optionalCallback(this._getAggregates(e,t),r)}async _getAggregates(e,t){if(!e||!t)throw new bh.ArgumentError("You must provide the keyspace name and cql aggregate name to retrieve the metadata");let r=await this._getFunctions(e,t,!0);return Array.from(r.values())}getAggregate(e,t,r,i){return nr.optionalCallback(this._getSingleFunction(e,t,r,!0),i)}getMaterializedView(e,t,r){return nr.optionalCallback(this._getMaterializedView(e,t),r)}async _getMaterializedView(e,t){if(!this.initialized)throw this._uninitializedError();let r;if(this.options.isMetadataSyncEnabled){let i=this.keyspaces[e];if(!i)return null;r=i.views}return await this._schemaParser.getMaterializedView(e,t,r)}async _getFunctions(e,t,r){if(!this.initialized)throw this._uninitializedError();let i;if(this.options.isMetadataSyncEnabled){let s=this.keyspaces[e];if(!s)return new Map;i=r?s.aggregates:s.functions}return await this._schemaParser.getFunctions(e,t,r,i)}async _getSingleFunction(e,t,r,i){if(!e||!t)throw new bh.ArgumentError("You must provide the keyspace name and cql function name to retrieve the metadata");if(!Array.isArray(r))throw new bh.ArgumentError("Signature must be an array of types");return r=r.map(a=>typeof a=="string"?a:_o.getDataTypeNameByCode(a)),(await this._getFunctions(e,t,i)).get(r.join(","))||null}getTrace(e,t,r){return!r&&typeof t=="function"&&(r=t,t=null),nr.optionalCallback(this._getTrace(e,t),r)}async _getTrace(e,t){if(!this.initialized)throw this._uninitializedError();let r,i=0,s=Wz.empty();s.getConsistency=()=>t;let a=new I3.QueryRequest(w3.format(zz,e),null,s),o=new I3.QueryRequest(w3.format(Yz,e),null,s);for(;!r&&i++({id:p.event_id,activity:p.activity,source:p.source,elapsed:p.source_elapsed,thread:p.thread}))}if(!r)throw new Error(`Trace ${e.toString()} could not fully retrieved after ${uK} attempts`);return r}checkSchemaAgreement(e){return nr.optionalCallback(this._checkSchemaAgreement(),e)}async _checkSchemaAgreement(){let e=this.controlConnection.connection;if(!e)return!1;try{return await this.compareSchemaVersions(e)}catch{return!1}}async adaptUserHints(e,t){if(!Array.isArray(t))return;let r=[];for(let i=0;i=t)break}for(let[r,i]of e)this._mapByKey.delete(r),this._mapById.delete(i.queryId.toString("hex")),this.length--}setById(e){this._mapById.set(e.queryId.toString("hex"),e)}getById(e){return this._mapById.get(e.toString("hex"))}clear(){this._mapByKey=new Map,this._mapById=new Map,this.length=0}getAll(){return Array.from(this._mapByKey.values()).filter(e=>!!e.queryId)}};c(t5,"PreparedQueries");var Jx=t5;rK.exports=Xx});var nK=w((Zo0,sK)=>{"use strict";var Zz=require("util"),Xz=f0(),r5=iu(),iK=1e3,s5=class s5{constructor(e,t){this._delay=e,this._logger=t,this._queue=null,this._timeout=null}eventReceived(e,t){return new Promise((r,i)=>{e.callback=r5.getCallback(r,i),this._queue=this._queue||{callbacks:[],keyspaces:{}};let s=t?0:this._delay;if(e.all&&(this._queue.mainEvent=e),this._queue.callbacks.length===iK&&this._logger("warn",Zz.format("Event debouncer queue exceeded %d events",iK)),this._queue.callbacks.push(e.callback),this._queue.mainEvent)return this._slideDelay(s);let a=this._queue.keyspaces[e.keyspace];a||(a=this._queue.keyspaces[e.keyspace]={events:[]}),e.cqlObject===void 0&&(a.mainEvent=e),a.events.push(e),this._slideDelay(s)})}_slideDelay(e){let t=this;function r(){let s=t._queue;t._queue=null,t._timeout=null,Jz(s)}if(c(r,"process"),e===0)return this._timeout&&clearTimeout(this._timeout),r();let i=this._timeout;this._timeout=setTimeout(r,e),i&&clearTimeout(i)}shutdown(){this._queue&&(this._queue.callbacks.forEach(function(e){e()}),this._queue=null,clearTimeout(this._timeout),this._timeout=null)}};c(s5,"EventDebouncer");var i5=s5;function Jz(u){if(u.mainEvent)return r5.toCallback(u.mainEvent.handler(),e=>{for(let t=0;t{s.handler(),s.callback()}),r()},"eachKeyspace"))}c(Jz,"processQueue");sK.exports=i5});var dK=w((Jo0,fK)=>{"use strict";var eY=require("events"),O3=require("util"),aK=require("net"),S3=require("dns"),ar=ce(),{Host:oK,HostMap:tY}=A6(),uY=u5(),rY=nK(),iY=_x(),_h=Es(),Cs=f0(),K3=re(),Ln=iu(),cK=O3.format,sY="SELECT * FROM system.peers",nY="SELECT * FROM system.local WHERE key='local'",lK=1e3,aY=2e3,oY={created:"CREATED",updated:"UPDATED",dropped:"DROPPED"},cY="PRODUCT_TYPE",lY="DATASTAX_APOLLO",a5=class a5 extends eY.EventEmitter{constructor(e,t,r){super(),this.protocolVersion=null,this.hosts=new tY,this.setMaxListeners(0),this.log=Cs.log,Object.defineProperty(this,"options",{value:e,enumerable:!1,writable:!1}),this.metadata=new uY(this.options,this),this.initialized=!1,this.host=null,this.connection=null,this._addressTranslator=this.options.policies.addressResolution,this._reconnectionPolicy=this.options.policies.reconnection,this._reconnectionSchedule=this._reconnectionPolicy.newSchedule(),this._isShuttingDown=!1,this._encoder=null,this._debouncer=new rY(e.refreshSchemaDelay,this.log.bind(this)),this._profileManager=t,this._triedHosts=null,this._resolvedContactPoints=new Map,this._contactPoints=new Set,this._topologyChangeTimeout=null,this._nodeStatusChangeTimeout=null,r&&r.borrowHostConnection&&(this._borrowHostConnection=r.borrowHostConnection),r&&r.createConnection&&(this._createConnection=r.createConnection)}_addContactPoint(e,t,r,i){if(e===null){this._resolvedContactPoints.set(r,Cs.emptyArray);return}let s=parseInt(t,10)||this.options.protocolOptions.port,a=`${e}:${s}`;this._contactPoints.add(a);let o=i?`[${e}]:${s}`:a,h=this._resolvedContactPoints.get(r);(h===void 0||h===Cs.emptyArray)&&(h=[],this._resolvedContactPoints.set(r,h)),h.push(o)}async _parseContactPoint(e){let t=e,r=null;if(e.indexOf("[")===0&&e.indexOf("]:")>1){let s=e.lastIndexOf("]:");t=e.substr(1,s-1),r=e.substr(s+2)}else if(e.indexOf(":")>0){let s=e.split(":");s.length===2&&(t=s[0],r=s[1])}if(aK.isIP(t)){this._addContactPoint(t,r,e,aK.isIPv6(t));return}let i=await this._resolveAll(t);i.length>0?i.forEach(s=>this._addContactPoint(s.address,r,e,s.isIPv6)):this._addContactPoint(null,null,e,!1)}async init(){if(!this.initialized){if(!this.options.sni)await Promise.all(this.options.contactPoints.map(e=>this._parseContactPoint(e)));else{this.options.contactPoints.forEach(i=>this._contactPoints.add(i));let e=this.options.sni.address,t=e.lastIndexOf(":");if(t===-1)throw new new ar.DriverInternalError("The SNI endpoint address should contain ip/name and port");let r=e.substr(0,t);this.options.sni.port=e.substr(t+1),this.options.sni.addressResolver=new Cs.AddressResolver({nameOrIp:r,dns:S3}),await this.options.sni.addressResolver.init()}if(this._contactPoints.size===0)throw new ar.NoHostAvailableError({},"No host could be resolved");await this._initializeConnection()}}_setHealthListeners(e,t){let r=this,i=0;function s(){e.removeListener("down",o),e.removeListener("ignore",o),t.removeListener("socketClose",h)}c(s,"removeListeners");function a(f){i++===0&&(s(),!r._isShuttingDown&&(f?r.log("warning",`Host ${e.address} used by the ControlConnection DOWN, connection to ${t.endpointFriendlyName} will not longer be used`):r.log("warning",`Connection to ${t.endpointFriendlyName} used by the ControlConnection was closed`),Ln.toBackground(r._refresh())))}c(a,"startReconnecting");function o(){a(!0)}c(o,"downOrIgnoredHandler");function h(){a(!1)}c(h,"socketClosedHandler"),e.once("down",o),e.once("ignore",o),t.once("socketClose",h)}_borrowAConnection(e){let t=null;for(;!t;){let r=e.next(),i=r.value;if(r.done)throw new ar.NoHostAvailableError(this._triedHosts);let s=this._profileManager.getDistance(i);if(!(!i.isUp()||s===K3.distance.ignored))try{t=this._borrowHostConnection(i)}catch(a){this._triedHosts[i.address]=a}}return t}async _borrowFirstConnection(e){let t=null;for(;!t;){let r=e.next(),i=r.value;if(r.done)throw new ar.NoHostAvailableError(this._triedHosts);try{t=await this._createConnection(i)}catch(s){this._triedHosts[i]=s}}if(!t){let r=new ar.NoHostAvailableError(this._triedHosts);throw this.log("error","ControlConnection failed to acquire a connection"),r}this.protocolVersion=t.protocolVersion,this._encoder=t.encoder,this.connection=t}_borrowHostConnection(e){return e.borrowConnection()}async _createConnection(e){let t=new iY(e,null,this.options);try{await t.openAsync()}catch(r){throw Ln.toBackground(t.closeAsync()),r}return t}async _refreshHosts(e,t){let r=this.connection;if(!r){if(t)throw new ar.DriverInternalError("Connection reference has been lost when reconnecting");return}this.log("info","Refreshing local and peers info");let i=await r.send(new _h.QueryRequest(nY),null);if(this._setLocalInfo(e,t,r,i),!this.host)throw new ar.DriverInternalError("Information from system.local could not be retrieved");let s=await r.send(new _h.QueryRequest(sY),null);if(await this.setPeersInfo(e,s),!this.initialized){let a=K3.protocolVersion.getHighestCommon(r,this.hosts),o=a!==this.protocolVersion;if(this.protocolVersion=a,this.hosts.forEach(h=>h.setProtocolVersion(this.protocolVersion)),o){this.log("info",`Reconnecting since the protocol version changed to 0x${a.toString(16)}`),r.decreaseVersion(this.protocolVersion),await r.closeAsync();try{await r.openAsync()}catch(h){throw Ln.toBackground(r.closeAsync()),h}}if(this.metadata.setCassandraVersion(this.host.getCassandraVersion()),this.metadata.buildTokens(this.hosts),!this.options.isMetadataSyncEnabled){this.metadata.initialized=!0;return}await this.metadata.refreshKeyspacesInternal(!1),this.metadata.initialized=!0}}async _refreshControlConnection(e){if(this.options.sni)this.connection=this._borrowAConnection(e);else try{this.connection=this._borrowAConnection(e)}catch{this.log("info","ControlConnection could not reconnect using existing connections. Refreshing contact points and retrying"),this._contactPoints.clear(),this._resolvedContactPoints.clear(),await Promise.all(this.options.contactPoints.map(i=>this._parseContactPoint(i)));let r=Array.from(this._contactPoints).join(",");this.log("info",`Refreshed contact points: ${r}`),await this._initializeConnection()}}async _refresh(e){if(this._isShuttingDown){this.log("info","The ControlConnection will not be refreshed as the Client is being shutdown");return}this.host=null,this.connection=null;try{e||(this.log("info","Trying to acquire a connection to a new host"),this._triedHosts={},e=await Ln.newQueryPlan(this._profileManager.getDefaultLoadBalancing(),null,null)),await this._refreshControlConnection(e)}catch(t){if(this.log("error","ControlConnection failed to acquire a connection",t),!this._isShuttingDown){let r=this._reconnectionSchedule.next().value;this.log("warning",`ControlConnection could not reconnect, scheduling reconnection in ${r}ms`),setTimeout(()=>this._refresh(),r),this.emit("newConnection",t)}return}this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName}`);try{await this._refreshHosts(!1,!0),await this._registerToConnectionEvents()}catch(t){return this.log("error","ControlConnection failed to retrieve topology and keyspaces information",t),this._triedHosts[this.connection.endpoint]=t,t.isSocketError&&this.host&&this.host.removeFromPool(this.connection),await this._refresh(e)}this._reconnectionSchedule=this._reconnectionPolicy.newSchedule(),this._setHealthListeners(this.host,this.connection),this.emit("newConnection",null,this.connection,this.host),this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName} and up to date`)}async _initializeConnection(){this.log("info","Getting first connection"),this.host=null,this.connection=null,this._triedHosts={};let e=Cs.shuffleArray(Array.from(this._contactPoints))[Symbol.iterator]();for(;;){await this._borrowFirstConnection(e),this.log("info",`ControlConnection using protocol version 0x${this.protocolVersion.toString(16)}, connected to ${this.connection.endpointFriendlyName}`);try{await this._getSupportedOptions(),await this._refreshHosts(!0,!0),await this._registerToConnectionEvents();break}catch(t){this.log("error","ControlConnection failed to retrieve topology and keyspaces information",t),this._triedHosts[this.connection.endpoint]=t}}this.host.pool.addExistingConnection(this.connection),this.initialized=!0,this._setHealthListeners(this.host,this.connection),this.log("info",`ControlConnection connected to ${this.connection.endpointFriendlyName}`)}async _getSupportedOptions(){let e=await this.connection.send(_h.options,null),t=e.supported&&e.supported[cY];Array.isArray(t)&&t[0]===lY&&this.metadata.setProductTypeAsDbaas()}async _registerToConnectionEvents(){this.connection.on("nodeTopologyChange",this._nodeTopologyChangeHandler.bind(this)),this.connection.on("nodeStatusChange",this._nodeStatusChangeHandler.bind(this)),this.connection.on("nodeSchemaChange",this._nodeSchemaChangeHandler.bind(this));let e=new _h.RegisterRequest(["TOPOLOGY_CHANGE","STATUS_CHANGE","SCHEMA_CHANGE"]);await this.connection.send(e,null)}_nodeTopologyChangeHandler(e){this.log("info","Received topology change",e),clearTimeout(this._topologyChangeTimeout),this._topologyChangeTimeout=setTimeout(()=>Ln.toBackground(this._scheduleRefreshHosts()),lK)}_nodeStatusChangeHandler(e){let t=this,r=e.inet.address.toString(),i=this.options.protocolOptions.port;this._addressTranslator.translate(r,i,c(function(a){let o=t.hosts.get(a);if(!o){t.log("warning","Received status change event but host was not found: "+r);return}let h=t._profileManager.getDistance(o);if(e.up){if(h===K3.distance.ignored)return o.setUp(!0);clearTimeout(t._nodeStatusChangeTimeout),t._nodeStatusChangeTimeout=setTimeout(()=>o.checkIsUp(),lK);return}if(h===K3.distance.ignored)return o.setDown();t.log("warning","Received status change to DOWN for host "+o.address)},"translateCallback"))}_nodeSchemaChangeHandler(e){this.log("info","Schema change",e),this.options.isMetadataSyncEnabled&&Ln.toBackground(this.handleSchemaChange(e,!1))}handleSchemaChange(e,t){let r=this,i,s;if(e.isKeyspace)return e.schemaChangeType===oY.dropped?(i=c(function(){delete r.metadata.keyspaces[e.keyspace]},"removeKeyspace"),this._scheduleObjectRefresh(i,e.keyspace,null,t)):this._scheduleKeyspaceRefresh(e.keyspace,t);let a=this.metadata.keyspaces[e.keyspace];return!a||(e.table?(s=e.table,i=c(function(){delete a.tables[e.table],delete a.views[e.table]},"clearTableState")):e.udt?(s=e.udt,i=c(function(){delete a.udts[e.udt]},"clearUdtState")):e.functionName?(s=e.functionName,i=c(function(){delete a.functions[e.functionName]},"clearFunctionState")):e.aggregate&&(s=e.aggregate,i=c(function(){delete a.aggregates[e.aggregate]},"clearKeyspaceState")),!i)?Promise.resolve():this._scheduleObjectRefresh(i,e.keyspace,s,t)}_scheduleObjectRefresh(e,t,r,i){return this._debouncer.eventReceived({handler:e,keyspace:t,cqlObject:r},i)}_scheduleKeyspaceRefresh(e,t){return this._debouncer.eventReceived({handler:()=>this.metadata.refreshKeyspace(e),keyspace:e},t)}_scheduleRefreshHosts(){return this._debouncer.eventReceived({handler:()=>this._refreshHosts(!1,!1),all:!0},!1)}_setLocalInfo(e,t,r,i){if(!i||!i.rows||!i.rows.length){this.log("warning","No local info could be obtained");return}let s=i.rows[0],a,o=this.options.sni?`${s.rpc_address}:${this.options.protocolOptions.port}`:r.endpoint;if(e)a=new oK(o,this.protocolVersion,this.options,this.metadata),this.hosts.set(o,a),this.log("info",`Adding host ${o}`);else if(a=this.hosts.get(o),!a){this.log("error","Localhost could not be found");return}a.datacenter=s.data_center,a.rack=s.rack,a.tokens=s.tokens,a.hostId=s.host_id,a.cassandraVersion=s.release_version,hK(a,s),this.metadata.setPartitioner(s.partitioner),this.log("info","Local info retrieved"),t&&(this.host=a)}async setPeersInfo(e,t){if(!t||!t.rows)return;let r={},i=this.options.protocolOptions.port,s=new Set;this.host&&this.host.datacenter&&s.add(this.host.datacenter);for(let a of t.rows){let o=await this.getAddressForPeerHost(a,i);if(!o)continue;r[o]=!0;let h=this.hosts.get(o),f=!h;f&&(h=new oK(o,this.protocolVersion,this.options,this.metadata),this.log("info",`Adding host ${o}`),f=!0),h.datacenter=a.data_center,h.rack=a.rack,h.tokens=a.tokens,h.hostId=a.host_id,h.cassandraVersion=a.release_version,hK(h,a),h.datacenter&&s.add(h.datacenter),f&&(this.hosts.set(o,h),e||(this._profileManager.getDistance(h),h.setDown()))}if(this.hosts.length>t.rows.length+1){this.log("info","Removing nodes from the pool");let a=[];this.hosts.forEach(o=>{!r[o.address]&&o!==this.host&&(this.log("info","Removing host "+o.address),a.push(o.address),o.shutdown(!0))}),this.hosts.removeMultiple(a)}if(e&&this.options.localDataCenter){let a=this.options.localDataCenter;if(!s.has(a))throw new ar.ArgumentError(`localDataCenter was configured as '${a}', but only found hosts in data centers: [${Array.from(s).join(", ")}]`)}this.log("info","Peers info retrieved")}getAddressForPeerHost(e,t){return new Promise(r=>{let i=e.rpc_address,s=e.peer,a="0.0.0.0";if(!i)return this.log("error",cK("No rpc_address found for host %s in %s's peers system table. %s will be ignored.",s,this.host.address,s)),r(null);i.toString()===a&&(this.log("warning",cK("Found host with 0.0.0.0 as rpc_address, using listen_address (%s) to contact it instead. If this is incorrect you should avoid the use of 0.0.0.0 server side.",s)),i=s),this._addressTranslator.translate(i.toString(),t,r)})}async _resolveAll(e){let t=[],r=O3.promisify(S3.resolve4),i=O3.promisify(S3.resolve6),s=O3.promisify(S3.lookup),a=r(e).catch(()=>{}).then(f=>f||Cs.emptyArray),o=i(e).catch(()=>{}).then(f=>f||Cs.emptyArray),h;if(h=await a,h.forEach(f=>t.push({address:f,isIPv6:!1})),h=await o,h.forEach(f=>t.push({address:f,isIPv6:!0})),t.length===0)try{h=await s(e,{all:!0}),h.forEach(({address:f,family:d})=>t.push({address:f,isIPv6:d===6}))}catch(f){this.log("error",`Host with name ${e} could not be resolved`,f)}return t}_waitForReconnection(){return new Promise((e,t)=>{let r=Ln.getCallback(e,t),i;function s(a){clearTimeout(i),r(a)}c(s,"newConnectionListener"),this.once("newConnection",s),i=setTimeout(()=>{this.removeListener("newConnection",s),r(new ar.OperationTimedOutError("A connection could not be acquired before timeout."))},aY)})}async query(e,t=!0){let r=c(async()=>{if(!this.connection||this._isShuttingDown)throw new ar.NoHostAvailableError({},"ControlConnection is not connected at the time");let i=typeof e=="string"?new _h.QueryRequest(e,null,null):e;return await this.connection.send(i,null)},"queryOnConnection");return!this.connection&&t&&await this._waitForReconnection(),await r()}getEncoder(){if(!this._encoder)throw new ar.DriverInternalError("Encoder is not defined");return this._encoder}shutdown(){this._isShuttingDown=!0,this._debouncer.shutdown(),this.emit("newConnection",new ar.DriverError("ControlConnection is being shutdown")),clearTimeout(this._topologyChangeTimeout),clearTimeout(this._nodeStatusChangeTimeout)}async reset(){let e=this.hosts.clear();this._isShuttingDown=!0,await Promise.all(e.map(t=>t.shutdown())),this.initialized=!1,this._isShuttingDown=!1}getResolvedContactPoints(){return this._resolvedContactPoints}getLocalAddress(){if(this.connection)return this.connection.getLocalAddress()}getEndpoint(){if(this.connection)return this.connection.endpoint}};c(a5,"ControlConnection");var n5=a5;function hK(u,e){e.workloads!==void 0?u.workloads=e.workloads:e.workload?u.workloads=[e.workload]:u.workloads=Cs.emptyArray,e.dse_version!==void 0&&(u.dseVersion=e.dse_version)}c(hK,"setDseParameters");fK.exports=n5});var gK=w((tc0,yK)=>{"use strict";var Ch=ce(),pK=Es(),N3=NE(),Di=re(),hY=f0(),o5=iu(),fY=Object.freeze({decision:N3.RetryPolicy.retryDecision.retry,useCurrentHost:!0,consistency:void 0}),c5=Object.freeze({decision:N3.RetryPolicy.retryDecision.rethrow}),D0={none:0,socketError:1,socketErrorBeforeRequestWritten:2,clientTimeout:3,serverErrorUnprepared:4,serverErrorOverloaded:5,serverErrorReadTimeout:6,serverErrorUnavailable:7,serverErrorWriteTimeout:8,serverErrorOther:9},dY=new Map([[D0.none,(u,e,t)=>u.onSuccessfulResponse(t)],[D0.socketError,(u,e)=>u.onConnectionError(e)],[D0.clientTimeout,(u,e)=>u.onClientTimeoutError(e)],[D0.serverErrorOverloaded,(u,e)=>u.onOtherError(e)],[D0.serverErrorReadTimeout,(u,e)=>u.onReadTimeoutError(e)],[D0.serverErrorUnavailable,(u,e)=>u.onUnavailableError(e)],[D0.serverErrorWriteTimeout,(u,e)=>u.onWriteTimeoutError(e)],[D0.serverErrorOther,(u,e)=>u.onOtherError(e)]]),pY=new Map([[D0.socketError,(u,e)=>u.onOtherErrorRetry(e)],[D0.clientTimeout,(u,e)=>u.onClientTimeoutRetry(e)],[D0.serverErrorOverloaded,(u,e)=>u.onOtherErrorRetry(e)],[D0.serverErrorReadTimeout,(u,e)=>u.onReadTimeoutRetry(e)],[D0.serverErrorUnavailable,(u,e)=>u.onUnavailableRetry(e)],[D0.serverErrorWriteTimeout,(u,e)=>u.onWriteTimeoutRetry(e)],[D0.serverErrorOther,(u,e)=>u.onOtherErrorRetry(e)]]),Sn=class Sn{constructor(e,t,r){this._parent=e,this._operation=null,this._host=t,this._connection=r,this._cancelled=!1,this._startTime=null,this._retryCount=0,this._request=this._parent.request,e.speculativeExecutions++}start(){this._sendOnConnection()}async restart(){try{let{host:t,connection:r}=this._parent.getNextConnection();this._connection=r,this._host=t}catch(t){return this._parent.handleNoHostAvailable(t,this)}let e=this._parent.client.keyspace;if(e&&e!==this._connection.keyspace)try{await this._connection.changeKeyspace(e)}catch(t){return this._handleError(t,Sn._getErrorCode(t))}this._cancelled||this._sendOnConnection()}_sendOnConnection(){this._startTime=process.hrtime(),this._operation=this._connection.sendStream(this._request,this._parent.executionOptions,(e,t,r)=>{let i=Sn._getErrorCode(e);if(this._trackResponse(process.hrtime(this._startTime),i,e,r),!this._cancelled){if(i!==D0.none)return this._handleError(i,e);if(t.schemaChange)return o5.toBackground(this._parent.client.handleSchemaAgreementAndRefresh(this._connection,t.schemaChange).then(s=>{this._cancelled||this._parent.setCompleted(null,this._getResultSet(t,s))}));if(t.keyspaceSet&&(this._parent.client.keyspace=t.keyspaceSet),t.meta&&t.meta.newResultId&&this._request.queryId){let s=this._parent.client.metadata.getPreparedById(this._request.queryId);s.meta.resultId=t.meta.newResultId}this._parent.setCompleted(null,this._getResultSet(t))}})}_trackResponse(e,t,r,i){Sn._invokeMetricsHandler(t,this._parent.client.metrics,r,e);let s=this._parent.client.options.requestTracker;if(s===null)return;let a=this._request.query||this._request.queries,o=this._request.params,h=this._request.length;r?s.onError(this._host,a,o,this._parent.executionOptions,h,r,e):s.onSuccess(this._host,a,o,this._parent.executionOptions,h,i,e)}_getResultSet(e,t){let r=new Di.ResultSet(e,this._host.address,this._parent.triedHosts,this._parent.speculativeExecutions,this._request.consistency,t===void 0||t);return r.rawPageState&&(r.nextPageAsync=this._parent.getNextPageHandler()),r}static _invokeMetricsHandler(e,t,r,i){let s=dY.get(e);s!==void 0&&s(t,r,i),(!r||r instanceof Ch.ResponseError)&&t.onResponse(i)}static _invokeMetricsHandlerForRetry(e,t,r){let i=pY.get(e);i!==void 0&&i(t,r)}cancel(){this._cancelled=!0,this._operation!==null&&this._operation.cancel()}wasCancelled(){return this._cancelled}_handleError(e,t){if(this._parent.triedHosts[this._host.address]=t,t.coordinator=this._host.address,e===D0.serverErrorUnprepared)return this._prepareAndRetry(t.queryId);e===D0.socketError||e===D0.socketErrorBeforeRequestWritten?this._host.removeFromPool(this._connection):e===D0.clientTimeout&&(this._parent.log("warning",t.message),this._host.checkHealth(this._connection));let r=this._getDecision(e,t);if(!r||r.decision===N3.RetryPolicy.retryDecision.rethrow)return(this._request instanceof pK.QueryRequest||this._request instanceof pK.ExecuteRequest)&&(t.query=this._request.query),this._parent.setCompleted(t);let i=this._parent.client.metrics;return r.decision===N3.RetryPolicy.retryDecision.ignore?(i.onIgnoreError(t),this._parent.setCompleted(null,this._getResultSet(hY.emptyObject))):(Sn._invokeMetricsHandlerForRetry(e,i,t),this._retry(r.consistency,r.useCurrentHost))}_getDecision(e,t){let r={query:this._request&&this._request.query,executionOptions:this._parent.executionOptions,nbRetry:this._retryCount},i=r.executionOptions.getRetryPolicy();switch(e){case D0.socketErrorBeforeRequestWritten:return fY;case D0.socketError:case D0.clientTimeout:case D0.serverErrorOverloaded:return r.executionOptions.isIdempotent()?i.onRequestError(r,this._request.consistency,t):c5;case D0.serverErrorUnavailable:return i.onUnavailable(r,t.consistencies,t.required,t.alive);case D0.serverErrorReadTimeout:return i.onReadTimeout(r,t.consistencies,t.received,t.blockFor,t.isDataPresent);case D0.serverErrorWriteTimeout:return r.executionOptions.isIdempotent()?i.onWriteTimeout(r,t.consistencies,t.received,t.blockFor,t.writeType):c5;default:return c5}}static _getErrorCode(e){if(!e)return D0.none;if(e.isSocketError)return e.requestNotWritten?D0.socketErrorBeforeRequestWritten:D0.socketError;if(e instanceof Ch.OperationTimedOutError)return D0.clientTimeout;if(e instanceof Ch.ResponseError)switch(e.code){case Di.responseErrorCodes.overloaded:case Di.responseErrorCodes.isBootstrapping:case Di.responseErrorCodes.truncateError:return D0.serverErrorOverloaded;case Di.responseErrorCodes.unavailableException:return D0.serverErrorUnavailable;case Di.responseErrorCodes.readTimeout:return D0.serverErrorReadTimeout;case Di.responseErrorCodes.writeTimeout:return D0.serverErrorWriteTimeout;case Di.responseErrorCodes.unprepared:return D0.serverErrorUnprepared}return D0.serverErrorOther}_retry(e,t,r){if(!this._cancelled){if(this._parent.log("info","Retrying request"),this._retryCount++,(r||typeof e=="number"&&this._request.consistency!==e)&&(this._request=this._request.clone(),typeof e=="number"&&(this._request.consistency=e),r&&(this._request.meta=r)),t!==!1){try{this._connection=this._host.borrowConnection(this._connection)}catch{return o5.toBackground(this.restart())}return this._sendOnConnection()}o5.toBackground(this.restart())}}_prepareAndRetry(e){let t=this._connection;this._parent.log("info",`Query 0x${e.toString("hex")} not prepared on host ${t.endpointFriendlyName}, preparing and retrying`);let r=this._parent.client.metadata.getPreparedById(e);if(!r)return this._parent.setCompleted(new Ch.DriverInternalError(`Unprepared response invalid, id: 0x${e.toString("hex")}`));let i=this._connection.protocolVersion;if(!Di.protocolVersion.supportsKeyspaceInRequest(i)&&r.keyspace&&r.keyspace!==t.keyspace)return this._parent.setCompleted(new Error(`Query was prepared on keyspace ${r.keyspace}, can't execute it on ${t.keyspace} (${r.query})`));let s=this;this._connection.prepareOnce(r.query,r.keyspace,function(a,o){if(a)return!a.isSocketError&&a instanceof Ch.OperationTimedOutError&&s._parent.log("warning",`Unexpected timeout error when re-preparing query on host ${t.endpointFriendlyName}`),s._retry(void 0,!1);r.meta=o.meta,s._retry(void 0,!0,o.meta)})}};c(Sn,"RequestExecution");var l5=Sn;yK.exports=l5});var xK=w((rc0,mK)=>{"use strict";var yY=require("util"),EK=ce(),gY=re(),h5=f0(),EY=gK(),U3=iu(),Rh=class Rh{constructor(e,t,r){this.client=r,this._speculativeExecutionPlan=r.options.policies.speculativeExecution.newPlan(r.keyspace,e.query||e.queries),this.logEmitter=r.options.logEmitter,this.log=h5.log,this.request=e,this.executionOptions=t,this.stackContainer=null,this.triedHosts={},this.speculativeExecutions=-1,this._hostIterator=null,this._resolveCallback=null,this._rejectCallback=null,this._newExecutionTimeout=null,this._executions=[]}static send(e,t,r){return new Rh(e,t,r).send()}getNextConnection(){let e,t,r=this._hostIterator;for(;;){let i=r.next();if(i.done)throw new EK.NoHostAvailableError(this.triedHosts);if(e=i.value,this.client.profileManager.getDistance(e)!==gY.distance.ignored){if(!e.isUp()){this.triedHosts[e.address]="Host considered as DOWN";continue}try{t=e.borrowConnection(),this.triedHosts[e.address]=null;break}catch(a){this.triedHosts[e.address]=a}}}return{connection:t,host:e}}send(){return this.executionOptions.getCaptureStackTrace()&&Error.captureStackTrace(this.stackContainer={}),new Promise((e,t)=>{this._resolveCallback=e,this._rejectCallback=t;let r=this.executionOptions.getLoadBalancingPolicy(),i=this.executionOptions.getFixedHost();i?(this._hostIterator=h5.arrayIterator([i]),U3.toBackground(this._startNewExecution())):r.newQueryPlan(this.client.keyspace,this.executionOptions,(s,a)=>{if(s)return t(s);this._hostIterator=a,U3.toBackground(this._startNewExecution())})})}async _startNewExecution(e){e&&this.client.metrics.onSpeculativeExecution();let t,r;try{({host:t,connection:r}=this.getNextConnection())}catch(s){return this.handleNoHostAvailable(s,null)}if(e&&this._executions.length>=0&&this._executions[0].wasCancelled())return;if(this.client.keyspace&&this.client.keyspace!==r.keyspace)try{await r.changeKeyspace(this.client.keyspace)}catch(s){return this.triedHosts[t.address]=s,this._startNewExecution(e)}let i=new EY(this,t,r);this._executions.push(i),i.start(),this.executionOptions.isIdempotent()&&this._scheduleSpeculativeExecution(t)}_scheduleSpeculativeExecution(e){let t=this._speculativeExecutionPlan.nextExecution(e);if(!(typeof t!="number"||t<0)){if(t===0)return process.nextTick(()=>{U3.toBackground(this._startNewExecution(!0))});this._newExecutionTimeout=setTimeout(()=>U3.toBackground(this._startNewExecution(!0)),t)}}static setKeyspace(e){let t;for(let r of e.hosts.values())if(t=r.getActiveConnection(),t)break;if(!t)throw new EK.DriverInternalError("No active connection found");return t.changeKeyspace(e.keyspace)}setCompleted(e,t){this._newExecutionTimeout!==null&&clearTimeout(this._newExecutionTimeout);for(let r of this._executions)r.cancel();if(e)return this.executionOptions.getCaptureStackTrace()&&h5.fixStack(this.stackContainer.stack,e),this._rejectCallback(e);t.info.warnings&&t.info.warnings.forEach(function(r,i,s){this.log("warning",yY.format('Received warning (%d of %d) "%s" for "%s"',i+1,s.length,r,this.request.query||"batch"))},this),this._resolveCallback(t)}handleNoHostAvailable(e,t){if(t!==null){let r=this._executions.indexOf(t);this._executions.splice(r,1)}this._executions.length===0&&this.setCompleted(e)}getNextPageHandler(){let e=this.request,t=this.executionOptions,r=this.client;return c(function(s){return t.setPageState(s),new Rh(e,t,r).send()},"nextPageHandler")}};c(Rh,"RequestHandler");var f5=Rh;mK.exports=f5});var IK=w((sc0,vK)=>{"use strict";var Co=require("os"),TK=require("path"),mY=require("fs"),y5=f0(),xY=iu(),Kn=re(),bK=Es(),{ExecutionOptions:_K}=gs(),CK=ho(),B3=pE(),{NoAuthProvider:TY}=th(),d5;try{d5=require("kerberos")}catch{}var bY=new B3(6,0,5),_Y=new B3(5,1,13),CY=new B3(6,0,0),RK="CALL InsightsRpc.reportInsight(?)",RY=5,g5=class g5{constructor(e,t){this._client=e,this._sessionId=Kn.Uuid.random().toString(),this._enabled=!1,this._closed=!1,this._firstTimeout=null,this._recurrentTimeout=null,this._statusErrorLogs=0,t=t||{},this._statusEventDelay=t.statusEventDelay||3e5,this._errorCallback=t.errorCallback||y5.noop}init(){this._enabled=this._client.options.monitorReporting.enabled&&this._dseSupportsInsights(),this._enabled&&xY.toBackground(this._init())}async _init(){try{if(await this._sendStartupEvent(),this._closed)return;let e=Math.floor(this._statusEventDelay-.1*this._statusEventDelay*Math.random());this._firstTimeout=setTimeout(()=>{this._sendStatusEvent(),this._recurrentTimeout=setInterval(()=>this._sendStatusEvent(),this._statusEventDelay)},e)}catch(e){if(this._closed)return;this._client.log("verbose",`Insights startup message could not be sent (${e})`,e),this._errorCallback(e)}}async _sendStartupEvent(){let e=await this._getStartupMessage(),t=new bK.QueryRequest(RK,[e],_K.empty());await this._client.controlConnection.query(t,!1)}async _sendStatusEvent(){let e=new bK.QueryRequest(RK,[this._getStatusEvent()],_K.empty());try{await this._client.controlConnection.query(e,!1)}catch(t){if(this._closed)return;this._statusErrorLogs{if(!e)return e;let r=t.getDseVersion();if(r.length===0)return!1;let i=new B3(...r);return i.compare(bY)>=0||i.compare(CY)<0&&i.compare(_Y)>=0},!0)}async _getStartupMessage(){let e=this._client.controlConnection,t=this._client.options,r=await this._getAppInfo(t),i={metadata:{name:"driver.startup",insightMappingId:"v1",insightType:"EVENT",timestamp:Date.now(),tags:{language:"nodejs"}},data:{driverName:CK.description,driverVersion:CK.version,clientId:t.id,sessionId:this._sessionId,applicationName:r.applicationName,applicationVersion:r.applicationVersion,applicationNameWasGenerated:r.applicationNameWasGenerated,contactPoints:wK(e.getResolvedContactPoints()),dataCenters:this._getDataCenters(),initialControlConnection:e.host?e.host.address:void 0,protocolVersion:e.protocolVersion,localAddress:e.getLocalAddress(),hostName:Co.hostname(),executionProfiles:wY(this._client),poolSizeByHostDistance:{local:t.pooling.coreConnectionsPerHost[Kn.distance.local],remote:t.pooling.coreConnectionsPerHost[Kn.distance.remote]},heartbeatInterval:t.pooling.heartBeatInterval,compression:"NONE",reconnectionPolicy:k3(t.policies.reconnection),ssl:{enabled:!!t.sslOptions,certValidation:t.sslOptions?!!t.sslOptions.rejectUnauthorized:void 0},authProvider:{type:t.authProvider instanceof TY?void 0:AY(t.authProvider)},otherOptions:{coalescingThreshold:t.socketOptions.coalescingThreshold},platformInfo:{os:{name:Co.platform(),version:Co.release(),arch:Co.arch()},cpus:{length:Co.cpus().length,model:Co.cpus()[0].model},runtime:{node:process.versions.node,v8:process.versions.v8,uv:process.versions.uv,openssl:process.versions.openssl,kerberos:d5?d5.version:void 0}},configAntiPatterns:this._getConfigAntiPatterns(),periodicStatusInterval:Math.floor(this._statusEventDelay/1e3)}};return JSON.stringify(i)}_getConfigAntiPatterns(){let e=this._client.options,t={};return e.sslOptions&&!e.sslOptions.rejectUnauthorized&&(t.sslWithoutCertValidation="Client-to-node encryption is enabled but server certificate validation is disabled"),t}_getDataCenters(){let e=this._client.options.pooling.coreConnectionsPerHost[Kn.distance.remote],t=new Set;return this._client.hosts.values().forEach(r=>{let i=this._client.profileManager.getDistance(r);(i===Kn.distance.local||i===Kn.distance.remote&&e>0)&&t.add(r.datacenter)}),Array.from(t)}async _getAppInfo(e){if(typeof e.applicationName=="string")return Promise.resolve({applicationName:e.applicationName,applicationVersion:e.applicationVersion,applicationNameWasGenerated:!1});let t=Promise.resolve();if(require.main&&require.main.filename){let a=TK.dirname(require.main.filename);t=this._readPackageInfoFile(a)}let r=await t,i="Default Node.js Application",s;if(r)try{let a=JSON.parse(r);a.name&&(i=a.name,s=a.version)}catch{}return{applicationName:i,applicationVersion:s,applicationNameWasGenerated:!0}}_readPackageInfoFile(e){return new Promise(t=>{mY.readFile(TK.join(e,"package.json"),"utf8",(r,i)=>{t(i)})})}_getStatusEvent(){let e=this._client.controlConnection,t=this._client.options,r=this._client.getState(),i={};r.getConnectedHosts().forEach(a=>{i[a.address]={connections:r.getOpenConnections(a),inFlightQueries:r.getInFlightQueries(a)}});let s={metadata:{name:"driver.status",insightMappingId:"v1",insightType:"EVENT",timestamp:Date.now(),tags:{language:"nodejs"}},data:{clientId:t.id,sessionId:this._sessionId,controlConnection:e.host?e.host.address:void 0,connectedNodes:i}};return JSON.stringify(s)}shutdown(){this._enabled&&(this._closed=!0,this._firstTimeout!==null&&clearTimeout(this._firstTimeout),this._recurrentTimeout!==null&&clearInterval(this._recurrentTimeout))}};c(g5,"InsightsClient");var p5=g5;vK.exports=p5;function wK(u){let e={};return u.forEach((t,r)=>e[r]=t),e}c(wK,"mapToObject");function k3(u){if(!u)return;let e=u.getOptions&&u.getOptions();return{type:u.constructor.name,options:e instanceof Map?wK(e):y5.emptyObject}}c(k3,"getPolicyInfo");function P3(u){if(typeof u=="number")return Kn.consistencyToString[u]}c(P3,"getConsistencyString");function AY(u){return u?u.constructor.name:void 0}c(AY,"getConstructor");function wY(u){let e={},t=u.profileManager.getDefault();return AK(u,e,t,t),u.profileManager.getAll().filter(r=>r!==t).forEach(r=>AK(u,e,r,t)),e}c(wY,"getExecutionProfiles");function AK(u,e,t,r){let i=e[t.name]={};if(ii(i,t,r,"readTimeout"),ii(i,t,r,"loadBalancing",k3),ii(i,t,r,"retry",k3),ii(i,t,r,"consistency",P3),ii(i,t,r,"serialConsistency",P3),t===r&&(i.speculativeExecution=k3(u.options.policies.speculativeExecution)),t.graphOptions){i.graphOptions={};let s=r.graphOptions||y5.emptyObject;ii(i.graphOptions,t.graphOptions,s,"language"),ii(i.graphOptions,t.graphOptions,s,"name"),ii(i.graphOptions,t.graphOptions,s,"readConsistency",P3),ii(i.graphOptions,t.graphOptions,s,"source"),ii(i.graphOptions,t.graphOptions,s,"writeConsistency",P3),Object.keys(i.graphOptions).length===0&&(i.graphOptions=void 0)}}c(AK,"setExecutionProfileProperties");function ii(u,e,t,r,i){let s=e[r];i=i||(a=>a),(e===t&&s!==void 0||s!==t[r])&&(u[r]=i(s))}c(ii,"setExecutionProfileItem")});var E5=w(LK=>{LK.require=function(){if(typeof process=="object"&&process.versions&&process.versions.electron)try{let u=require("original-fs");if(Object.keys(u).length>0)return u}catch{}return require("fs")}});var m5=w((oc0,SK)=>{SK.exports={LOCHDR:30,LOCSIG:67324752,LOCVER:4,LOCFLG:6,LOCHOW:8,LOCTIM:10,LOCCRC:14,LOCSIZ:18,LOCLEN:22,LOCNAM:26,LOCEXT:28,EXTSIG:134695760,EXTHDR:16,EXTCRC:4,EXTSIZ:8,EXTLEN:12,CENHDR:46,CENSIG:33639248,CENVEM:4,CENVER:6,CENFLG:8,CENHOW:10,CENTIM:12,CENCRC:16,CENSIZ:20,CENLEN:24,CENNAM:28,CENEXT:30,CENCOM:32,CENDSK:34,CENATT:36,CENATX:38,CENOFF:42,ENDHDR:22,ENDSIG:101010256,ENDSUB:8,ENDTOT:10,ENDSIZ:12,ENDOFF:16,ENDCOM:20,END64HDR:20,END64SIG:117853008,END64START:4,END64OFF:8,END64NUMDISKS:16,ZIP64SIG:101075792,ZIP64HDR:56,ZIP64LEAD:12,ZIP64SIZE:4,ZIP64VEM:12,ZIP64VER:14,ZIP64DSK:16,ZIP64DSKDIR:20,ZIP64SUB:24,ZIP64TOT:32,ZIP64SIZB:40,ZIP64OFF:48,ZIP64EXTRA:56,STORED:0,SHRUNK:1,REDUCED1:2,REDUCED2:3,REDUCED3:4,REDUCED4:5,IMPLODED:6,DEFLATED:8,ENHANCED_DEFLATED:9,PKWARE:10,BZIP2:12,LZMA:14,IBM_TERSE:18,IBM_LZ77:19,AES_ENCRYPT:99,FLG_ENC:1,FLG_COMP1:2,FLG_COMP2:4,FLG_DESC:8,FLG_ENH:16,FLG_PATCH:32,FLG_STR:64,FLG_EFS:2048,FLG_MSK:4096,FILE:2,BUFFER:1,NONE:0,EF_ID:0,EF_SIZE:2,ID_ZIP64:1,ID_AVINFO:7,ID_PFS:8,ID_OS2:9,ID_NTFS:10,ID_OPENVMS:12,ID_UNIX:13,ID_FORK:14,ID_PATCH:15,ID_X509_PKCS7:20,ID_X509_CERTID_F:21,ID_X509_CERTID_C:22,ID_STRONGENC:23,ID_RECORD_MGT:24,ID_X509_PKCS7_RL:25,ID_IBM1:101,ID_IBM2:102,ID_POSZIP:18064,EF_ZIP64_OR_32:4294967295,EF_ZIP64_OR_16:65535,EF_ZIP64_SUNCOMP:0,EF_ZIP64_SCOMP:8,EF_ZIP64_RHO:16,EF_ZIP64_DSN:24}});var x5=w((cc0,KK)=>{KK.exports={INVALID_LOC:"Invalid LOC header (bad signature)",INVALID_CEN:"Invalid CEN header (bad signature)",INVALID_END:"Invalid END header (bad signature)",NO_DATA:"Nothing to decompress",BAD_CRC:"CRC32 checksum failed",FILE_IN_THE_WAY:"There is a file in the way: %s",UNKNOWN_METHOD:"Invalid/unsupported compression method",AVAIL_DATA:"inflate::Available inflate data did not terminate",INVALID_DISTANCE:"inflate::Invalid literal/length or distance code in fixed or dynamic block",TO_MANY_CODES:"inflate::Dynamic block code description: too many length or distance codes",INVALID_REPEAT_LEN:"inflate::Dynamic block code description: repeat more than specified lengths",INVALID_REPEAT_FIRST:"inflate::Dynamic block code description: repeat lengths with no first length",INCOMPLETE_CODES:"inflate::Dynamic block code description: code lengths codes incomplete",INVALID_DYN_DISTANCE:"inflate::Dynamic block code description: invalid distance code lengths",INVALID_CODES_LEN:"inflate::Dynamic block code description: invalid literal/length code lengths",INVALID_STORE_BLOCK:"inflate::Stored block length did not match one's complement",INVALID_BLOCK_TYPE:"inflate::Invalid block type (type == 3)",CANT_EXTRACT_FILE:"Could not extract the file",CANT_OVERRIDE:"Target file already exists",DISK_ENTRY_TOO_LARGE:"Number of disk entries is too large",NO_ZIP:"No zip file was loaded",NO_ENTRY:"Entry doesn't exist",DIRECTORY_CONTENT_ERROR:"A directory cannot have content",FILE_NOT_FOUND:"File not found: %s",NOT_IMPLEMENTED:"Not implemented",INVALID_FILENAME:"Invalid filename",INVALID_FORMAT:"Invalid or unsupported zip format. No END header found"}});var PK=w((lc0,UK)=>{var vY=E5().require(),ou=require("path"),OK=m5(),IY=x5(),LY=typeof process=="object"&&process.platform==="win32",NK=c(u=>u&&typeof u=="object","is_Obj"),T5=new Uint32Array(256).map((u,e)=>{for(let t=0;t<8;t++)e&1?e=3988292384^e>>>1:e>>>=1;return e>>>0});function Ot(u){this.sep=ou.sep,this.fs=vY,NK(u)&&NK(u.fs)&&typeof u.fs.statSync=="function"&&(this.fs=u.fs)}c(Ot,"Utils");UK.exports=Ot;Ot.prototype.makeDir=function(u){let e=this;function t(r){let i=r.split(e.sep)[0];r.split(e.sep).forEach(function(s){if(!(!s||s.substr(-1,1)===":")){i+=e.sep+s;var a;try{a=e.fs.statSync(i)}catch{e.fs.mkdirSync(i)}if(a&&a.isFile())throw IY.FILE_IN_THE_WAY.replace("%s",i)}})}c(t,"mkdirSync"),t(u)};Ot.prototype.writeFileTo=function(u,e,t,r){let i=this;if(i.fs.existsSync(u)){if(!t)return!1;var s=i.fs.statSync(u);if(s.isDirectory())return!1}var a=ou.dirname(u);i.fs.existsSync(a)||i.makeDir(a);var o;try{o=i.fs.openSync(u,"w",438)}catch{i.fs.chmodSync(u,438),o=i.fs.openSync(u,"w",438)}if(o)try{i.fs.writeSync(o,e,0,e.length,0)}finally{i.fs.closeSync(o)}return i.fs.chmodSync(u,r||438),!0};Ot.prototype.writeFileToAsync=function(u,e,t,r,i){typeof r=="function"&&(i=r,r=void 0);let s=this;s.fs.exists(u,function(a){if(a&&!t)return i(!1);s.fs.stat(u,function(o,h){if(a&&h.isDirectory())return i(!1);var f=ou.dirname(u);s.fs.exists(f,function(d){d||s.makeDir(f),s.fs.open(u,"w",438,function(p,E){p?s.fs.chmod(u,438,function(){s.fs.open(u,"w",438,function(x,g){s.fs.write(g,e,0,e.length,0,function(){s.fs.close(g,function(){s.fs.chmod(u,r||438,function(){i(!0)})})})})}):E?s.fs.write(E,e,0,e.length,0,function(){s.fs.close(E,function(){s.fs.chmod(u,r||438,function(){i(!0)})})}):s.fs.chmod(u,r||438,function(){i(!0)})})})})})};Ot.prototype.findFiles=function(u){let e=this;function t(r,i,s){typeof i=="boolean"&&(s=i,i=void 0);let a=[];return e.fs.readdirSync(r).forEach(function(o){var h=ou.join(r,o);e.fs.statSync(h).isDirectory()&&s&&(a=a.concat(t(h,i,s))),(!i||i.test(h))&&a.push(ou.normalize(h)+(e.fs.statSync(h).isDirectory()?e.sep:""))}),a}return c(t,"findSync"),t(u,void 0,!0)};Ot.prototype.getAttributes=function(){};Ot.prototype.setAttributes=function(){};Ot.crc32update=function(u,e){return T5[(u^e)&255]^u>>>8};Ot.crc32=function(u){typeof u=="string"&&(u=Buffer.from(u,"utf8")),T5.length||genCRCTable();let e=u.length,t=-1;for(let r=0;r>>0};Ot.methodToString=function(u){switch(u){case OK.STORED:return"STORED ("+u+")";case OK.DEFLATED:return"DEFLATED ("+u+")";default:return"UNSUPPORTED ("+u+")"}};Ot.canonical=function(u){if(!u)return"";var e=ou.posix.normalize("/"+u.split("\\").join("/"));return ou.join(".",e)};Ot.sanitize=function(u,e){u=ou.resolve(ou.normalize(u));for(var t=e.split("/"),r=0,i=t.length;r{var D3=E5().require(),kK=require("path");D3.existsSync=D3.existsSync||kK.existsSync;BK.exports=function(u){var e=u||"",t=i(),r=null;function i(){return{directory:!1,readonly:!1,hidden:!1,executable:!1,mtime:0,atime:0}}return c(i,"newAttr"),e&&D3.existsSync(e)?(r=D3.statSync(e),t.directory=r.isDirectory(),t.mtime=r.mtime,t.atime=r.atime,t.executable=(73&r.mode)!==0,t.readonly=(128&r.mode)===0,t.hidden=kK.basename(e)[0]==="."):console.warn("Invalid path: "+e),{get directory(){return t.directory},get readOnly(){return t.readonly},get hidden(){return t.hidden},get mtime(){return t.mtime},get atime(){return t.atime},get executable(){return t.executable},decodeAttributes:function(){},encodeAttributes:function(){},toJSON:function(){return{path:e,isDirectory:t.directory,isReadOnly:t.readonly,isHidden:t.hidden,isExecutable:t.executable,mTime:t.mtime,aTime:t.atime}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var Ro=w((pc0,Ah)=>{Ah.exports=PK();Ah.exports.Constants=m5();Ah.exports.Errors=x5();Ah.exports.FileAttr=DK()});var MK=w((yc0,FK)=>{var wh=Ro(),l0=wh.Constants;FK.exports=function(){var u=20,e=10,t=0,r=0,i=0,s=0,a=0,o=0,h=0,f=0,d=0,p=0,E=0,x=0,g=0;u|=wh.isWin?2560:768,t|=l0.FLG_EFS;var m={};function A(T){T=new Date(T),i=(T.getFullYear()-1980&127)<<25|T.getMonth()+1<<21|T.getDate()<<16|T.getHours()<<11|T.getMinutes()<<5|T.getSeconds()>>1}return c(A,"setTime"),A(+new Date),{get made(){return u},set made(T){u=T},get version(){return e},set version(T){e=T},get flags(){return t},set flags(T){t=T},get method(){return r},set method(T){switch(T){case l0.STORED:this.version=10;case l0.DEFLATED:default:this.version=20}r=T},get time(){return new Date((i>>25&127)+1980,(i>>21&15)-1,i>>16&31,i>>11&31,i>>5&63,(i&31)<<1)},set time(T){A(T)},get timeHighByte(){return i>>>8&255},get crc(){return s},set crc(T){s=Math.max(0,T)>>>0},get compressedSize(){return a},set compressedSize(T){a=Math.max(0,T)>>>0},get size(){return o},set size(T){o=Math.max(0,T)>>>0},get fileNameLength(){return h},set fileNameLength(T){h=T},get extraLength(){return f},set extraLength(T){f=T},get commentLength(){return d},set commentLength(T){d=T},get diskNumStart(){return p},set diskNumStart(T){p=Math.max(0,T)>>>0},get inAttr(){return E},set inAttr(T){E=Math.max(0,T)>>>0},get attr(){return x},set attr(T){x=Math.max(0,T)>>>0},get fileAttr(){return x?(x>>>0|0)>>16&4095:0},get offset(){return g},set offset(T){g=Math.max(0,T)>>>0},get encrypted(){return(t&1)===1},get centralHeaderSize(){return l0.CENHDR+h+f+d},get realDataOffset(){return g+l0.LOCHDR+m.fnameLen+m.extraLen},get localHeader(){return m},loadLocalHeaderFromBinary:function(T){var I=T.slice(g,g+l0.LOCHDR);if(I.readUInt32LE(0)!==l0.LOCSIG)throw new Error(wh.Errors.INVALID_LOC);m={version:I.readUInt16LE(l0.LOCVER),flags:I.readUInt16LE(l0.LOCFLG),method:I.readUInt16LE(l0.LOCHOW),time:I.readUInt32LE(l0.LOCTIM),crc:I.readUInt32LE(l0.LOCCRC),compressedSize:I.readUInt32LE(l0.LOCSIZ),size:I.readUInt32LE(l0.LOCLEN),fnameLen:I.readUInt16LE(l0.LOCNAM),extraLen:I.readUInt16LE(l0.LOCEXT)}},loadFromBinary:function(T){if(T.length!==l0.CENHDR||T.readUInt32LE(0)!==l0.CENSIG)throw new Error(wh.Errors.INVALID_CEN);u=T.readUInt16LE(l0.CENVEM),e=T.readUInt16LE(l0.CENVER),t=T.readUInt16LE(l0.CENFLG),r=T.readUInt16LE(l0.CENHOW),i=T.readUInt32LE(l0.CENTIM),s=T.readUInt32LE(l0.CENCRC),a=T.readUInt32LE(l0.CENSIZ),o=T.readUInt32LE(l0.CENLEN),h=T.readUInt16LE(l0.CENNAM),f=T.readUInt16LE(l0.CENEXT),d=T.readUInt16LE(l0.CENCOM),p=T.readUInt16LE(l0.CENDSK),E=T.readUInt16LE(l0.CENATT),x=T.readUInt32LE(l0.CENATX),g=T.readUInt32LE(l0.CENOFF)},localHeaderToBinary:function(){var T=Buffer.alloc(l0.LOCHDR);return T.writeUInt32LE(l0.LOCSIG,0),T.writeUInt16LE(e,l0.LOCVER),T.writeUInt16LE(t,l0.LOCFLG),T.writeUInt16LE(r,l0.LOCHOW),T.writeUInt32LE(i,l0.LOCTIM),T.writeUInt32LE(s,l0.LOCCRC),T.writeUInt32LE(a,l0.LOCSIZ),T.writeUInt32LE(o,l0.LOCLEN),T.writeUInt16LE(h,l0.LOCNAM),T.writeUInt16LE(f,l0.LOCEXT),T},centralHeaderToBinary:function(){var T=Buffer.alloc(l0.CENHDR+h+f+d);return T.writeUInt32LE(l0.CENSIG,0),T.writeUInt16LE(u,l0.CENVEM),T.writeUInt16LE(e,l0.CENVER),T.writeUInt16LE(t,l0.CENFLG),T.writeUInt16LE(r,l0.CENHOW),T.writeUInt32LE(i,l0.CENTIM),T.writeUInt32LE(s,l0.CENCRC),T.writeUInt32LE(a,l0.CENSIZ),T.writeUInt32LE(o,l0.CENLEN),T.writeUInt16LE(h,l0.CENNAM),T.writeUInt16LE(f,l0.CENEXT),T.writeUInt16LE(d,l0.CENCOM),T.writeUInt16LE(p,l0.CENDSK),T.writeUInt16LE(E,l0.CENATT),T.writeUInt32LE(x,l0.CENATX),T.writeUInt32LE(g,l0.CENOFF),T.fill(0,l0.CENHDR),T},toJSON:function(){let T=c(function(I){return I+" bytes"},"bytes");return{made:u,version:e,flags:t,method:wh.methodToString(r),time:this.time,crc:"0x"+s.toString(16).toUpperCase(),compressedSize:T(a),size:T(o),fileNameLength:T(h),extraLength:T(f),commentLength:T(d),diskNumStart:p,inAttr:E,attr:x,offset:g,centralHeaderSize:T(l0.CENHDR+h+f+d)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var qK=w((Ec0,HK)=>{var Ao=Ro(),Pe=Ao.Constants;HK.exports=function(){var u=0,e=0,t=0,r=0,i=0;return{get diskEntries(){return u},set diskEntries(s){u=e=s},get totalEntries(){return e},set totalEntries(s){e=u=s},get size(){return t},set size(s){t=s},get offset(){return r},set offset(s){r=s},get commentLength(){return i},set commentLength(s){i=s},get mainHeaderSize(){return Pe.ENDHDR+i},loadFromBinary:function(s){if((s.length!==Pe.ENDHDR||s.readUInt32LE(0)!==Pe.ENDSIG)&&(s.length{b5.EntryHeader=MK();b5.MainHeader=qK()});var GK=w((Tc0,VK)=>{VK.exports=function(u){var e=require("zlib"),t={chunkSize:(parseInt(u.length/1024)+1)*1024};return{deflate:function(){return e.deflateRawSync(u,t)},deflateAsync:function(r){var i=e.createDeflateRaw(t),s=[],a=0;i.on("data",function(o){s.push(o),a+=o.length}),i.on("end",function(){var o=Buffer.alloc(a),h=0;o.fill(0);for(var f=0;f{var SY=+(process.versions?process.versions.node:"").split(".")[0]||0;WK.exports=function(u,e){var t=require("zlib");let r=SY>=15&&e>0?{maxOutputLength:e}:{};return{inflate:function(){return t.inflateRawSync(u,r)},inflateAsync:function(i){var s=t.createInflateRaw(r),a=[],o=0;s.on("data",function(h){a.push(h),o+=h.length}),s.on("end",function(){var h=Buffer.alloc(o),f=0;h.fill(0);for(var d=0;d{"use strict";var{randomFillSync:YK}=require("crypto"),KY=new Uint32Array(256).map((u,e)=>{for(let t=0;t<8;t++)e&1?e=e>>>1^3988292384:e>>>=1;return e>>>0}),jK=c((u,e)=>Math.imul(u,e)>>>0,"uMul"),QK=c((u,e)=>KY[(u^e)&255]^u>>>8,"crc32update"),vh=c(()=>typeof YK=="function"?YK(Buffer.alloc(12)):vh.node(),"genSalt");vh.node=()=>{let u=Buffer.alloc(12),e=u.length;for(let t=0;t>>24),u};M3.prototype.next=function(){let u=(this.keys[2]|2)>>>0;return jK(u,u^1)>>8&255};function OY(u){let e=new M3(u);return function(t){let r=Buffer.alloc(t.length),i=0;for(let s of t)r[i++]=e.updateKeys(s^e.next());return r}}c(OY,"make_decrypter");function NY(u){let e=new M3(u);return function(t,r,i=0){r||(r=Buffer.alloc(t.length));for(let s of t){let a=e.next();r[i++]=s^a,e.updateKeys(s)}return r}}c(NY,"make_encrypter");function UY(u,e,t){if(!u||!Buffer.isBuffer(u)||u.length<12)return Buffer.alloc(0);let r=OY(t),i=r(u.slice(0,12)),s=(e.flags&8)===8?e.timeHighByte:e.crc>>>24;if(i[11]!==s)throw"ADM-ZIP: Wrong Password";return r(u.slice(12))}c(UY,"decrypt");function PY(u){Buffer.isBuffer(u)&&u.length>=12?F3.genSalt=function(){return u.slice(0,12)}:u==="node"?F3.genSalt=vh.node:F3.genSalt=vh}c(PY,"_salter");function kY(u,e,t,r=!1){u==null&&(u=Buffer.alloc(0)),Buffer.isBuffer(u)||(u=Buffer.from(u.toString()));let i=NY(t),s=F3.genSalt();s[11]=e.crc>>>24&255,r&&(s[10]=e.crc>>>16&255);let a=Buffer.alloc(u.length+12);return i(s,a),i(u,a,12)}c(kY,"encrypt");$K.exports={decrypt:UY,encrypt:kY,_salter:PY}});var XK=w(H3=>{H3.Deflater=GK();H3.Inflater=zK();H3.ZipCrypto=ZK()});var R5=w((Ac0,JK)=>{var je=Ro(),BY=_5(),Gu=je.Constants,C5=XK();JK.exports=function(u){var e=new BY.EntryHeader,t=Buffer.alloc(0),r=Buffer.alloc(0),i=!1,s=null,a=Buffer.alloc(0);function o(){return!u||!(u instanceof Uint8Array)?Buffer.alloc(0):(e.loadLocalHeaderFromBinary(u),u.slice(e.realDataOffset,e.realDataOffset+e.compressedSize))}c(o,"getCompressedDataFromZip");function h(g){return!((e.flags&8)!==8&&je.crc32(g)!==e.localHeader.crc)}c(h,"crc32OK");function f(g,m,A){if(typeof m>"u"&&typeof g=="string"&&(A=g,g=void 0),i)return g&&m&&m(Buffer.alloc(0),je.Errors.DIRECTORY_CONTENT_ERROR),Buffer.alloc(0);var T=o();if(T.length===0)return g&&m&&m(T),T;if(e.encrypted){if(typeof A!="string"&&!Buffer.isBuffer(A))throw new Error("ADM-ZIP: Incompatible password parameter");T=C5.ZipCrypto.decrypt(T,e,A)}var I=Buffer.alloc(e.size);switch(e.method){case je.Constants.STORED:if(T.copy(I),h(I))return g&&m&&m(I),I;throw g&&m&&m(I,je.Errors.BAD_CRC),new Error(je.Errors.BAD_CRC);case je.Constants.DEFLATED:var L=new C5.Inflater(T,e.size);if(g)L.inflateAsync(function(N){N.copy(N,0),m&&(h(N)?m(N):m(N,je.Errors.BAD_CRC))});else{if(L.inflate(I).copy(I,0),!h(I))throw new Error(je.Errors.BAD_CRC+" "+t.toString());return I}break;default:throw g&&m&&m(Buffer.alloc(0),je.Errors.UNKNOWN_METHOD),new Error(je.Errors.UNKNOWN_METHOD)}}c(f,"decompress");function d(g,m){if((!s||!s.length)&&Buffer.isBuffer(u))return g&&m&&m(o()),o();if(s.length&&!i){var A;switch(e.method){case je.Constants.STORED:return e.compressedSize=e.size,A=Buffer.alloc(s.length),s.copy(A),g&&m&&m(A),A;default:case je.Constants.DEFLATED:var T=new C5.Deflater(s);if(g)T.deflateAsync(function(L){A=Buffer.alloc(L.length),e.compressedSize=L.length,L.copy(A),m&&m(A)});else{var I=T.deflate();return e.compressedSize=I.length,I}T=null;break}}else if(g&&m)m(Buffer.alloc(0));else return Buffer.alloc(0)}c(d,"compress");function p(g,m){return(g.readUInt32LE(m+4)<<4)+g.readUInt32LE(m)}c(p,"readUInt64LE");function E(g){for(var m=0,A,T,I;m=Gu.EF_ZIP64_SCOMP&&(m=p(g,Gu.EF_ZIP64_SUNCOMP),e.size===Gu.EF_ZIP64_OR_32&&(e.size=m)),g.length>=Gu.EF_ZIP64_RHO&&(A=p(g,Gu.EF_ZIP64_SCOMP),e.compressedSize===Gu.EF_ZIP64_OR_32&&(e.compressedSize=A)),g.length>=Gu.EF_ZIP64_DSN&&(T=p(g,Gu.EF_ZIP64_RHO),e.offset===Gu.EF_ZIP64_OR_32&&(e.offset=T)),g.length>=Gu.EF_ZIP64_DSN+4&&(I=g.readUInt32LE(Gu.EF_ZIP64_DSN),e.diskNumStart===Gu.EF_ZIP64_OR_16&&(e.diskNumStart=I))}return c(x,"parseZip64ExtendedInformation"),{get entryName(){return t.toString()},get rawEntryName(){return t},set entryName(g){t=je.toBuffer(g);var m=t[t.length-1];i=m===47||m===92,e.fileNameLength=t.length},get extra(){return a},set extra(g){a=g,e.extraLength=g.length,E(g)},get comment(){return r.toString()},set comment(g){r=je.toBuffer(g),e.commentLength=r.length},get name(){var g=t.toString();return i?g.substr(g.length-1).split("/").pop():g.split("/").pop()},get isDirectory(){return i},getCompressedData:function(){return d(!1,null)},getCompressedDataAsync:function(g){d(!0,g)},setData:function(g){s=je.toBuffer(g),!i&&s.length?(e.size=s.length,e.method=je.Constants.DEFLATED,e.crc=je.crc32(g),e.changed=!0):e.method=je.Constants.STORED},getData:function(g){return e.changed?s:f(!1,null,g)},getDataAsync:function(g,m){e.changed?g(s):f(!0,g,m)},set attr(g){e.attr=g},get attr(){return e.attr},set header(g){e.loadFromBinary(g)},get header(){return e},packCentralHeader:function(){var g=e.centralHeaderToBinary(),m=je.Constants.CENHDR;return t.copy(g,m),m+=t.length,e.extraLength&&(a.copy(g,m),m+=e.extraLength),e.commentLength&&r.copy(g,m),g},packLocalHeader:function(){let g=0,m=e.localHeaderToBinary(),A=Buffer.alloc(m.length+t.length+a.length);return m.copy(A,g),g+=m.length,t.copy(A,g),g+=t.length,a.copy(A,g),g+=a.length,A},toJSON:function(){let g=c(function(m){return"<"+(m&&m.length+" bytes buffer"||"null")+">"},"bytes");return{entryName:this.entryName,name:this.name,comment:this.comment,isDirectory:this.isDirectory,header:e.toJSON(),compressedData:g(u),data:g(s)}},toString:function(){return JSON.stringify(this.toJSON(),null," ")}}}});var uO=w((vc0,tO)=>{var eO=R5(),DY=_5(),xt=Ro();tO.exports=function(u,e){var t=[],r={},i=Buffer.alloc(0),s=new DY.MainHeader,a=!1,o=null;let h=Object.assign(Object.create(null),e),{noSort:f}=h;u?E(h.readEntries):a=!0;function d(g){let m=s.diskEntries,A=s.offset;for(let T=0;T(u.length-s.offset)/xt.Constants.CENHDR)throw new Error(xt.Errors.DISK_ENTRY_TOO_LARGE);t=new Array(s.diskEntries);for(var g=s.offset,m=0;m=T;m--)if(u[m]===80){if(u.readUInt32LE(m)===xt.Constants.ENDSIG){L=m,N=m,I=m+xt.Constants.ENDHDR,T=m-xt.Constants.END64HDR;continue}if(u.readUInt32LE(m)===xt.Constants.END64SIG){T=A;continue}if(u.readUInt32LE(m)===xt.Constants.ZIP64SIG){L=m,I=m+xt.readBigUInt64LE(u,m+xt.Constants.ZIP64SIZE)+xt.Constants.ZIP64LEAD;break}}if(!~L)throw new Error(xt.Errors.INVALID_FORMAT);s.loadFromBinary(u.slice(L,I)),s.commentLength&&(i=u.slice(N+xt.Constants.ENDHDR)),g&&p()}c(E,"readMainHeader");function x(){t.length>1&&!f&&t.sort((g,m)=>g.entryName.toLowerCase().localeCompare(m.entryName.toLowerCase()))}return c(x,"sortEntries"),{get entries(){return a||p(),t},get comment(){return i.toString()},set comment(g){i=xt.toBuffer(g),s.commentLength=i.length},getEntryCount:function(){return a?t.length:s.diskEntries},forEach:function(g){if(!a){d(g);return}t.forEach(g)},getEntry:function(g){return a||p(),r[g]||null},setEntry:function(g){a||p(),t.push(g),r[g.entryName]=g,s.totalEntries=t.length},deleteEntry:function(g){a||p();var m=r[g];if(m&&m.isDirectory){var A=this;this.getEntryChildren(m).forEach(function(T){T.entryName!==g&&A.deleteEntry(T.entryName)})}t.splice(t.indexOf(m),1),delete r[g],s.totalEntries=t.length},getEntryChildren:function(g){if(a||p(),g&&g.isDirectory){let m=[],A=g.entryName,T=A.length;return t.forEach(function(I){I.entryName.substr(0,T)===A&&m.push(I)}),m}return[]},compressToBuffer:function(){a||p(),x();let g=[],m=[],A=0,T=0;s.size=0,s.offset=0;for(let N of t){let k=N.getCompressedData();N.header.offset=T;let M=N.packLocalHeader(),X=M.length+k.length;T+=X,g.push(M),g.push(k);let u0=N.packCentralHeader();m.push(u0),s.size+=u0.length,A+=X+u0.length}A+=s.mainHeaderSize,s.offset=T,T=0;let I=Buffer.alloc(A);for(let N of g)N.copy(I,T),T+=N.length;for(let N of m)N.copy(I,T),T+=N.length;let L=s.toBinary();return i&&i.copy(L,xt.Constants.ENDHDR),L.copy(I,T),I},toAsyncBuffer:function(g,m,A,T){try{a||p(),x();let I=[],L=[],N=0,k=0;s.size=0,s.offset=0;let M=c(function(X){if(X.length>0){let u0=X.shift(),h0=u0.entryName+u0.extra.toString();A&&A(h0),u0.getCompressedDataAsync(function(i0){T&&T(h0),u0.header.offset=k;let H=u0.packLocalHeader(),L0=H.length+i0.length;k+=L0,I.push(H),I.push(i0);let V=u0.packCentralHeader();L.push(V),s.size+=V.length,N+=L0+V.length,M(X)})}else{N+=s.mainHeaderSize,s.offset=k,k=0;let u0=Buffer.alloc(N);I.forEach(function(i0){i0.copy(u0,k),k+=i0.length}),L.forEach(function(i0){i0.copy(u0,k),k+=i0.length});let h0=s.toBinary();i&&i.copy(h0,xt.Constants.ENDHDR),h0.copy(u0,k),g(u0)}},"compress2Buffer");M(Array.from(t))}catch(I){m(I)}}}}});var iO=w((Lc0,rO)=>{var rt=Ro(),si=require("path"),FY=R5(),MY=uO(),On=c((u,e)=>typeof u=="boolean"?u:e,"get_Bool"),A5=c((u,e)=>typeof u=="string"?u:e,"get_Str"),HY={noSort:!1,readEntries:!1,method:rt.Constants.NONE,fs:null};rO.exports=function(u,e){let t=null,r=Object.assign(Object.create(null),HY);u&&typeof u=="object"&&(u instanceof Uint8Array||(Object.assign(r,u),u=r.input?r.input:void 0,r.input&&delete r.input),Buffer.isBuffer(u)&&(t=u,r.method=rt.Constants.BUFFER,u=void 0)),Object.assign(r,e);let i=new rt(r);if(u&&typeof u=="string")if(i.fs.existsSync(u))r.method=rt.Constants.FILE,r.filename=u,t=i.fs.readFileSync(u);else throw new Error(rt.Errors.INVALID_FILENAME);let s=new MY(t,r),{canonical:a,sanitize:o}=rt;function h(d){if(d&&s){var p;if(typeof d=="string"&&(p=s.getEntry(d)),typeof d=="object"&&typeof d.entryName<"u"&&typeof d.header<"u"&&(p=s.getEntry(d.entryName)),p)return p}return null}c(h,"getEntry");function f(d){let{join:p,normalize:E,sep:x}=si.posix;return p(".",E(x+d.split("\\").join(x)+x))}return c(f,"fixPath"),{readFile:function(d,p){var E=h(d);return E&&E.getData(p)||null},readFileAsync:function(d,p){var E=h(d);E?E.getDataAsync(p):p(null,"getEntry failed for:"+d)},readAsText:function(d,p){var E=h(d);if(E){var x=E.getData();if(x&&x.length)return x.toString(p||"utf8")}return""},readAsTextAsync:function(d,p,E){var x=h(d);x?x.getDataAsync(function(g,m){if(m){p(g,m);return}g&&g.length?p(g.toString(E||"utf8")):p("")}):p("")},deleteFile:function(d){var p=h(d);p&&s.deleteEntry(p.entryName)},addZipComment:function(d){s.comment=d},getZipComment:function(){return s.comment||""},addZipEntryComment:function(d,p){var E=h(d);E&&(E.comment=p)},getZipEntryComment:function(d){var p=h(d);return p&&p.comment||""},updateFile:function(d,p){var E=h(d);E&&E.setData(p)},addLocalFile:function(d,p,E,x){if(i.fs.existsSync(d)){p=p?f(p):"";var g=d.split("\\").join("/").split("/").pop();p+=E||g;let m=i.fs.statSync(d);this.addFile(p,i.fs.readFileSync(d),x,m)}else throw new Error(rt.Errors.FILE_NOT_FOUND.replace("%s",d))},addLocalFolder:function(d,p,E,x){if(E instanceof RegExp?E=function(g){return function(m){return g.test(m)}}(E):typeof E!="function"&&(E=c(function(){return!0},"filter")),p=p?f(p):"",d=si.normalize(d),i.fs.existsSync(d)){let g=i.findFiles(d),m=this;g.length&&g.forEach(function(A){var T=si.relative(d,A).split("\\").join("/");if(E(T)){var I=i.fs.statSync(A);I.isFile()?m.addFile(p+T,i.fs.readFileSync(A),"",x||I):m.addFile(p+T+"/",Buffer.alloc(0),"",x||I)}})}else throw new Error(rt.Errors.FILE_NOT_FOUND.replace("%s",d))},addLocalFolderAsync:function(d,p,E,x){x instanceof RegExp?x=function(m){return function(A){return m.test(A)}}(x):typeof x!="function"&&(x=c(function(){return!0},"filter")),E=E?f(E):"",d=si.normalize(d);var g=this;i.fs.open(d,"r",function(m){if(m&&m.code==="ENOENT")p(void 0,rt.Errors.FILE_NOT_FOUND.replace("%s",d));else if(m)p(void 0,m);else{var A=i.findFiles(d),T=-1,I=c(function(){if(T+=1,T{I()})}else p(!0,void 0)},"next");I()}})},addLocalFolderPromise:function(d,p){return new Promise((E,x)=>{let{filter:g,zipPath:m}=Object.assign({},p);this.addLocalFolderAsync(d,(A,T)=>{T&&x(T),A&&E(this)},m,g)})},addFile:function(d,p,E,x){let g=h(d),m=g!=null;m||(g=new FY,g.entryName=rt.canonical(d)),g.comment=E||"";let A=typeof x=="object"&&x instanceof i.fs.Stats;A&&(g.header.time=x.mtime);var T=g.isDirectory?16:0;let I=g.isDirectory?16384:32768;return A?I|=4095&x.mode:typeof x=="number"?I|=4095&x:I|=g.isDirectory?493:420,T=(T|I<<16)>>>0,g.attr=T,g.setData(p),m||s.setEntry(g),g},getEntries:function(d){return s.password=d,s?s.entries:[]},getEntry:function(d){return h(d)},getEntryCount:function(){return s.getEntryCount()},forEach:function(d){return s.forEach(d)},extractEntryTo:function(d,p,E,x,g,m){x=On(x,!1),g=On(g,!1),E=On(E,!0),m=A5(m,A5(g,void 0));var A=h(d);if(!A)throw new Error(rt.Errors.NO_ENTRY);var T=a(A.entryName),I=o(p,m&&!A.isDirectory?m:E?T:si.basename(T));if(A.isDirectory){var L=s.getEntryChildren(A);return L.forEach(function(M){if(M.isDirectory)return;var X=M.getData();if(!X)throw new Error(rt.Errors.CANT_EXTRACT_FILE);var u0=a(M.entryName),h0=o(p,E?u0:si.basename(u0));let i0=g?M.header.fileAttr:void 0;i.writeFileTo(h0,X,x,i0)}),!0}var N=A.getData(s.password);if(!N)throw new Error(rt.Errors.CANT_EXTRACT_FILE);if(i.fs.existsSync(I)&&!x)throw new Error(rt.Errors.CANT_OVERRIDE);let k=g?d.header.fileAttr:void 0;return i.writeFileTo(I,N,x,k),!0},test:function(d){if(!s)return!1;for(var p in s.entries)try{if(p.isDirectory)continue;var E=s.entries[p].getData(d);if(!E)return!1}catch{return!1}return!0},extractAllTo:function(d,p,E,x){if(p=On(p,!1),x=A5(E,x),E=On(E,!1),!s)throw new Error(rt.Errors.NO_ZIP);s.entries.forEach(function(g){var m=o(d,a(g.entryName.toString()));if(g.isDirectory){i.makeDir(m);return}var A=g.getData(x);if(!A)throw new Error(rt.Errors.CANT_EXTRACT_FILE);let T=E?g.header.fileAttr:void 0;i.writeFileTo(m,A,p,T);try{i.fs.utimesSync(m,g.header.time,g.header.time)}catch{throw new Error(rt.Errors.CANT_EXTRACT_FILE)}})},extractAllToAsync:function(d,p,E,x){if(typeof p=="function"&&!x&&(x=p),p=On(p,!1),typeof E=="function"&&!x&&(x=E),E=On(E,!1),!x)return new Promise((I,L)=>{this.extractAllToAsync(d,p,E,function(N){N?L(N):I(this)})});if(!s){x(new Error(rt.Errors.NO_ZIP));return}d=si.resolve(d);let g=c(I=>o(d,si.normalize(a(I.entryName.toString()))),"getPath"),m=c((I,L)=>new Error(I+': "'+L+'"'),"getError"),A=[],T=[];s.entries.forEach(I=>{I.isDirectory?A.push(I):T.push(I)});for(let I of A){let L=g(I),N=E?I.header.fileAttr:void 0;try{i.makeDir(L),N&&i.fs.chmodSync(L,N),i.fs.utimesSync(L,I.header.time,I.header.time)}catch{x(m("Unable to create folder",L))}}T.reverse().reduce(function(I,L){return function(N){if(N)I(N);else{let k=si.normalize(a(L.entryName.toString())),M=o(d,k);L.getDataAsync(function(X,u0){if(u0)I(new Error(u0));else if(!X)I(new Error(rt.Errors.CANT_EXTRACT_FILE));else{let h0=E?L.header.fileAttr:void 0;i.writeFileToAsync(M,X,p,h0,function(i0){i0||I(m("Unable to write file",M)),i.fs.utimes(M,L.header.time,L.header.time,function(H){H?I(m("Unable to set times",M)):I()})})}})}}},x)()},writeZip:function(d,p){if(arguments.length===1&&typeof d=="function"&&(p=d,d=""),!d&&r.filename&&(d=r.filename),!!d){var E=s.compressToBuffer();if(E){var x=i.writeFileTo(d,E,!0);typeof p=="function"&&p(x?null:new Error("failed"),"")}}},writeZipPromise:function(d,p){let{overwrite:E,perm:x}=Object.assign({overwrite:!0},p);return new Promise((g,m)=>{!d&&r.filename&&(d=r.filename),d||m("ADM-ZIP: ZIP File Name Missing"),this.toBufferPromise().then(A=>{let T=c(I=>I?g(I):m("ADM-ZIP: Wasn't able to write zip file"),"ret");i.writeFileToAsync(d,A,E,x,T)},m)})},toBufferPromise:function(){return new Promise((d,p)=>{s.toAsyncBuffer(d,p)})},toBuffer:function(d,p,E,x){return this.valueOf=2,typeof d=="function"?(s.toAsyncBuffer(d,p,E,x),null):s.compressToBuffer()}}}});var cO=w((Kc0,oO)=>{"use strict";var qY=require("https"),VY=require("fs"),nO=require("util"),GY=iO(),{URL:WY}=require("url"),zY=ce(),sO=f0(),{DsePlainTextAuthProvider:YY,NoAuthProvider:QY}=th(),jY=nO.promisify(VY.readFile);async function $Y(u){if(!u.cloud)return;let e=new v5(u);await ZY(e),await JY(e),e.clientOptions.sslOptions.checkServerIdentity||(e.clientOptions.sslOptions.checkServerIdentity=(t,r)=>aO(r,e.clientOptions.sni.address))}c($Y,"init");var I5=class I5{constructor(e){this.clientOptions=e,e.cloud.secureConnectBundle?(this.secureConnectBundle=e.cloud.secureConnectBundle,this.serviceUrl=null):this.serviceUrl=e.cloud.endpoint,this.logEmitter=e.logEmitter,this.contactPoints=null,this.localDataCenter=null}setSslOptions(e){this.clientOptions.sslOptions=Object.assign({ca:[e.get("ca.crt")],cert:e.get("cert"),key:e.get("key"),rejectUnauthorized:!0},this.clientOptions.sslOptions)}setAuthProvider(e,t){!e||!t||this.clientOptions.authProvider&&!(this.clientOptions.authProvider instanceof QY)||(this.clientOptions.authProvider=new YY(e,t))}};c(I5,"CloudOptions");var v5=I5;async function ZY(u){if(u.serviceUrl)return;if(!u.secureConnectBundle)throw new TypeError("secureConnectBundle must be provided");let e=await jY(u.secureConnectBundle),t=new GY(e),r=new Map(t.getEntries().map(s=>[s.entryName,s.getData()]));if(!r.get("config.json"))throw new TypeError("Config file must be contained in secure bundle");let i=JSON.parse(r.get("config.json").toString("utf8"));if(!i.host||!i.port)throw new TypeError("Config file must include host and port information");u.serviceUrl=`${i.host}:${i.port}/metadata`,u.setSslOptions(r),u.setAuthProvider(i.username,i.password)}c(ZY,"parseZipFile");function XY(u,e){let r=/^(.+?):(\d+)(.*)$/.exec(u.serviceUrl);if(e=sO.callbackOnce(e),!r||r.length!==4)throw new TypeError("url should be composed of host, port number and path, without scheme");let i=Object.assign({hostname:r[1],port:r[2],path:r[3]||void 0,timeout:u.clientOptions.socketOptions.connectTimeout},u.clientOptions.sslOptions),s=qY.get(i,a=>{let o="";sO.log("verbose",`Connected to metadata service with SSL/TLS protocol ${a.socket.getProtocol()}`,{},u),a.on("data",h=>o+=h.toString()).on("end",()=>{if(a.statusCode!==200)return e(w5(new Error(`Obtained http status ${a.statusCode}`),i));let h;try{if(h=JSON.parse(o),!h||!h.contact_info)throw new TypeError("contact_info should be defined in response")}catch(d){return e(w5(d,i,!0))}let f=h.contact_info;u.clientOptions.contactPoints=f.contact_points,u.clientOptions.localDataCenter=f.local_dc,u.clientOptions.sni={address:f.sni_proxy_address},e()})});s.on("error",a=>e(w5(a,i))),s.setTimeout(u.clientOptions.socketOptions.connectTimeout,()=>s.abort())}c(XY,"getMetadataServiceInfo");var JY=nO.promisify(XY);function w5(u,e,t){let r=t?"There was an error while parsing the metadata service information":"There was an error fetching the metadata information",i=`${e.hostname}:${e.port}${e.path?e.path:"/"}`;return new zY.NoHostAvailableError({[i]:u},r)}c(w5,"getServiceRequestError");function aO(u,e){let t=e.split(":")[0],r=u.subjectaltname,i=u.subject.CN;if(t===i)return;let s=[];if(r)for(let f of r.split(", "))f.startsWith("DNS:")?s.push(f.slice(4)):f.startsWith("URI:")&&s.push(new WY(f.slice(4)).hostname);let a=t.split("."),o=c(f=>eQ(a,f),"wildcard"),h;if(s.length>0?h=s.some(o):h=o(i),!h){let f=new Error(`Host: ${t} is not cert's CN/altnames: ${i} / ${r}`);return f.reason=f.message,f.host=t,f.cert=u,f}}c(aO,"checkServerIdentity");function eQ(u,e){if(!e)return!1;let t=e.split(".");if(u.length!==t.length)return!1;for(let h=u.length-1;h>0;h-=1)if(u[h]!==t[h])return!1;let r=u[0],i=t[0],s=i.split("*");if(s.length===1||i.includes("xn--"))return r===i;if(s.length>2||t.length<=2)return!1;let[a,o]=s;return!(a.length+o.length>r.length||!r.startsWith(a)||!r.endsWith(o))}c(eQ,"checkParts");oO.exports={checkServerIdentity:aO,init:$Y}});var L5=w((Nc0,fO)=>{"use strict";var lO=f0();function hO(u,e){this.info=u.info;let t=u.rows;e=e||tQ,this.length=u.rowLength,this.pageState=u.pageState,this.first=c(function(){let s=this.values().next();return s.done?null:s.value},"first"),this.forEach=c(function(i,s){if(!t.length)return;let a=this.values(),o=a.next(),h=0;for(;!o.done;)i.call(s||this,o.value,h++),o=a.next()},"forEach"),this.toArray=c(function(){return t.length?lO.iteratorToArray(this.values()):lO.emptyArray},"toArray"),this.values=c(function*(){for(let i of this.getTraversers()){let s=i.bulk||1;for(let a=0;a{"use strict";var uQ=re(),{dataTypes:V3}=uQ,S5=class S5{constructor(e,t){this.value=e,this.typeInfo=typeof t=="number"?{code:t}:t}};c(S5,"GraphTypeWrapper");var Nn=S5,K5=class K5{constructor(e,t){if(this.value=e,!t||!t.name||!t.keyspace||!t.fields)throw new TypeError("udtInfo must be an object with name, keyspace and field properties defined");this.udtInfo=t}};c(K5,"UdtGraphWrapper");var q3=K5;function rQ(u){return new Nn(u,V3.int)}c(rQ,"asInt");function iQ(u){return new Nn(u,V3.double)}c(iQ,"asDouble");function sQ(u){return new Nn(u,V3.float)}c(sQ,"asFloat");function nQ(u){return new Nn(u,V3.timestamp)}c(nQ,"asTimestamp");function aQ(u,e){return new q3(u,e)}c(aQ,"asUdt");dO.exports={asInt:rQ,asDouble:iQ,asFloat:sQ,asTimestamp:nQ,asUdt:aQ,UdtGraphWrapper:q3,GraphTypeWrapper:Nn}});var EO=w((Bc0,gO)=>{"use strict";var{GraphTypeWrapper:oQ,UdtGraphWrapper:cQ}=G3(),W3=re(),lQ=h3(),{dataTypes:wo}=W3;function O5(u){if(u instanceof W3.Tuple)return{cqlType:"tuple",definition:u.elements.map(O5)};if(u instanceof Map){let t={cqlType:"map"};if(u.size>0){let r=u.entries().next().value;t.definition=r.map(O5)}return t}if(u instanceof cQ)return yO(u);let e;return u instanceof oQ?e=u.typeInfo:e=lQ.guessDataType(u),e?z3(e):null}c(O5,"getTypeDefinitionByValue");function z3(u){return u.code===wo.udt?pO(u.info):u.code===wo.tuple||u.code===wo.map?{cqlType:W3.getDataTypeNameByCode(u),definition:u.info.map(z3)}:u.code===wo.list||u.code===wo.set?{cqlType:u.code===wo.list?"list":"set",definition:[z3(u.info)]}:{cqlType:W3.getDataTypeNameByCode(u)}}c(z3,"getDefinitionByType");function pO(u){return{cqlType:"udt",keyspace:u.keyspace,name:u.name,definition:u.fields.map(e=>Object.assign({fieldName:e.name},z3(e.type)))}}c(pO,"getUdtTypeDefinition");function yO(u){return pO(u.udtInfo)}c(yO,"getUdtTypeDefinitionByValue");gO.exports={getTypeDefinitionByValue:O5,getUdtTypeDefinitionByValue:yO}});var U5=w((Fc0,bO)=>{"use strict";var N5=require("util");function Un(u,e){this.id=u,this.label=e}c(Un,"Element");function mO(u,e,t){Un.call(this,u,e),this.properties=t}c(mO,"Vertex");N5.inherits(mO,Un);function xO(u,e,t,r,i,s,a){Un.call(this,u,r),this.outV=e,this.outVLabel=t,this.inV=i,this.inVLabel=s,this.properties={},c(function(h){if(a){let f=Object.keys(a);for(let d=0;d{"use strict";var ni=re(),dQ=f0(),{getTypeDefinitionByValue:pQ,getUdtTypeDefinitionByValue:yQ}=EO(),{Point:gQ,Polygon:EQ,LineString:mQ}=o3(),{Edge:xQ}=U5(),{GraphTypeWrapper:TQ,UdtGraphWrapper:bQ}=G3(),{Tuple:_O,dataTypes:Ih}=ni,kn="@type",Ku="@value",X5=class X5{constructor(){this.key="g:Edge"}deserialize(e){let t=e[Ku];return new xQ(this.reader.read(t.id),this.reader.read(t.outV),t.outVLabel,t.label,this.reader.read(t.inV),t.inVLabel,this.reader.read(t.properties))}};c(X5,"EdgeDeserializer");var P5=X5,J5=class J5{constructor(e,t){if(!e)throw new Error("Deserializer must provide a type key");if(!t)throw new Error("Deserializer must provide a target type");this.key=e,this.targetType=t}deserialize(e){let t=e[Ku];return typeof t!="string"&&(t=t.toString()),this.targetType.fromString(t)}serialize(e){return{[kn]:this.key,[Ku]:e.toString()}}canBeUsedFor(e){return e instanceof this.targetType}};c(J5,"StringBasedTypeSerializer");var Ou=J5,eT=class eT extends Ou{constructor(){super("g:UUID",ni.Uuid)}};c(eT,"UuidSerializer");var k5=eT,tT=class tT extends Ou{constructor(){super("g:Int64",ni.Long)}};c(tT,"LongSerializer");var B5=tT,uT=class uT extends Ou{constructor(){super("gx:BigDecimal",ni.BigDecimal)}};c(uT,"BigDecimalSerializer");var D5=uT,rT=class rT extends Ou{constructor(){super("gx:BigInteger",ni.Integer)}};c(rT,"BigIntegerSerializer");var F5=rT,iT=class iT extends Ou{constructor(){super("gx:InetAddress",ni.InetAddress)}};c(iT,"InetAddressSerializer");var M5=iT,sT=class sT extends Ou{constructor(){super("gx:LocalDate",ni.LocalDate)}};c(sT,"LocalDateSerializer");var H5=sT,nT=class nT extends Ou{constructor(){super("gx:LocalTime",ni.LocalTime)}};c(nT,"LocalTimeSerializer");var q5=nT,aT=class aT extends Ou{constructor(){super("gx:Instant",Date)}serialize(e){return{[kn]:this.key,[Ku]:e.toISOString()}}deserialize(e){return new Date(e[Ku])}};c(aT,"InstantSerializer");var V5=aT,oT=class oT extends Ou{constructor(){super("dse:Blob",Buffer)}deserialize(e){return dQ.allocBufferFromString(e[Ku],"base64")}serialize(e){return{[kn]:this.key,[Ku]:e.toString("base64")}}};c(oT,"BlobSerializer");var G5=oT,cT=class cT extends Ou{constructor(){super("dse:Point",gQ)}};c(cT,"PointSerializer");var W5=cT,lT=class lT extends Ou{constructor(){super("dse:LineString",mQ)}};c(lT,"LineStringSerializer");var z5=lT,hT=class hT extends Ou{constructor(){super("dse:Polygon",EQ)}};c(hT,"PolygonSerializer");var Y5=hT,fT=class fT{constructor(){this.key="dse:Tuple"}deserialize(e){let t=e[Ku].value;if(!Array.isArray(t))throw new Error("Expected Array, obtained: "+t);let r=[];for(let i of t)r.push(this.reader.read(i));return _O.fromArray(r)}serialize(e){let t={cqlType:"tuple",definition:e.elements.map(pQ),value:e.elements.map(r=>this.writer.adaptObject(r))};return{[kn]:this.key,[Ku]:t}}canBeUsedFor(e){return e instanceof _O}};c(fT,"TupleSerializer");var Q5=fT,dT=class dT{constructor(){this.key="dse:Duration"}deserialize(e){let t=e[Ku];return new ni.Duration(this.reader.read(t.months),this.reader.read(t.days),this.reader.read(t.nanos))}serialize(e){return{[kn]:this.key,[Ku]:{months:e.months,days:e.days,nanos:e.nanoseconds}}}canBeUsedFor(e){return e instanceof ni.Duration}};c(dT,"DurationSerializer");var j5=dT,pT=class pT{constructor(){this.key="dse:UDT"}deserialize(e){let t=e[Ku],r={},i=t.value;return t.definition.forEach((s,a)=>{r[s.fieldName]=this.reader.read(i[a])}),r}serialize(e){let t=yQ(e);return t.value=Object.entries(e.value).map(([r,i])=>this.writer.adaptObject(i)),{[kn]:this.key,[Ku]:t}}canBeUsedFor(e){return e instanceof bQ}};c(pT,"UdtSerializer");var $5=pT,yT=class yT{constructor(e,t){this._name=e,this._transformFn=t||(r=>r)}serialize(e){return{[kn]:this._name,[Ku]:this._transformFn(e)}}};c(yT,"InternalSerializer");var Pn=yT,_Q={[Ih.int]:new Pn("g:Int32"),[Ih.bigint]:new Pn("g:Int64"),[Ih.double]:new Pn("g:Double"),[Ih.float]:new Pn("g:Float"),[Ih.timestamp]:new Pn("g:Timestamp",u=>u.getTime())},gT=class gT{constructor(){this.key="client:wrapper"}serialize(e){let t=_Q[e.typeInfo.code];if(!t)throw new Error(`No serializer found for wrapped value ${e}`);return t.serialize(e.value)}canBeUsedFor(e){return e instanceof TQ}};c(gT,"GraphTypeWrapperSerializer");var Z5=gT,CQ=[P5,k5,B5,D5,F5,M5,H5,q5,V5,G5,W5,z5,Y5,Q5,$5,Z5,j5];function RQ(){let u={};return CQ.forEach(e=>{let t=new e;if(!t.key)throw new TypeError(`Key for ${e} instance not set`);u[t.key]=t}),u}c(RQ,"getCustomSerializers");CO.exports=RQ});var TT=w((Vc0,RO)=>{"use strict";var AQ=L5(),wQ=ET(),{asInt:vQ,asDouble:IQ,asFloat:LQ,asTimestamp:SQ,asUdt:KQ,UdtGraphWrapper:OQ,GraphTypeWrapper:NQ}=G3(),{Edge:UQ,Element:PQ,Path:kQ,Property:BQ,Vertex:DQ,VertexProperty:FQ}=U5(),xT=class xT{constructor(e,t){this.typeName=e,this.elementName=t}toString(){return this.elementName}};c(xT,"EnumValue");var Fi=xT,MQ={id:new Fi("T","id"),key:new Fi("T","key"),label:new Fi("T","label"),value:new Fi("T","value")},mT={both:new Fi("Direction","BOTH"),in:new Fi("Direction","IN"),out:new Fi("Direction","OUT")};mT.in_=mT.in;RO.exports={Edge:UQ,Element:PQ,Path:kQ,Property:BQ,Vertex:DQ,VertexProperty:FQ,asInt:vQ,asDouble:IQ,asFloat:LQ,asTimestamp:SQ,asUdt:KQ,direction:mT,getCustomTypeSerializers:wQ,GraphResultSet:AQ,GraphTypeWrapper:NQ,t:MQ,UdtGraphWrapper:OQ}});var wO=w((Wc0,AO)=>{"use strict";var kr={P:Rs,TextP:Rs,Traversal:Rs,Traverser:Rs,EnumValue:Rs},HQ={TraversalStrategy:Rs},qQ=Rs,or=TT(),VQ={Long:Rs};kr.t=or.t;kr.direction=or.direction;function Rs(){}c(Rs,"UnsupportedType");var se="@value",Nt="@type",VT=class VT{serialize(){throw new Error("serialize() method not implemented for "+this.constructor.name)}deserialize(){throw new Error("deserialize() method not implemented for "+this.constructor.name)}canBeUsedFor(){throw new Error("canBeUsedFor() method not implemented for "+this.constructor.name)}};c(VT,"TypeSerializer");var ke=VT,GT=class GT extends ke{serialize(e){return isNaN(e)?{[Nt]:"g:Double",[se]:"NaN"}:e===Number.POSITIVE_INFINITY?{[Nt]:"g:Double",[se]:"Infinity"}:e===Number.NEGATIVE_INFINITY?{[Nt]:"g:Double",[se]:"-Infinity"}:e}deserialize(e){var t=e[se];return t==="NaN"?NaN:t==="Infinity"?Number.POSITIVE_INFINITY:t==="-Infinity"?Number.NEGATIVE_INFINITY:parseFloat(t)}canBeUsedFor(e){return typeof e=="number"}};c(GT,"NumberSerializer");var bT=GT,WT=class WT extends ke{serialize(e){return{[Nt]:"g:Date",[se]:e.getTime()}}deserialize(e){return new Date(e[se])}canBeUsedFor(e){return e instanceof Date}};c(WT,"DateSerializer");var _T=WT,zT=class zT extends ke{serialize(e){return{[Nt]:"g:Int64",[se]:e.value}}canBeUsedFor(e){return e instanceof VQ.Long}};c(zT,"LongSerializer");var CT=zT,YT=class YT extends ke{serialize(e){let t=e;e instanceof kr.Traversal&&(t=e.getBytecode());let r={};r[Nt]="g:Bytecode";let i=r[se]={},s=this._serializeInstructions(t.sourceInstructions);s&&(i.source=s);let a=this._serializeInstructions(t.stepInstructions);return a&&(i.step=a),r}_serializeInstructions(e){if(e.length===0)return null;let t=new Array(e.length);t[0]=e[0];for(let r=0;rthis.writer.adaptObject(i));return t}canBeUsedFor(e){return e instanceof qQ||e instanceof kr.Traversal}};c(YT,"BytecodeSerializer");var RT=YT,QT=class QT extends ke{serialize(e){let t={};t[Nt]="g:P";let r=t[se]={predicate:e.operator};return e.other===void 0||e.other===null?r.value=this.writer.adaptObject(e.value):r.value=[this.writer.adaptObject(e.value),this.writer.adaptObject(e.other)],t}canBeUsedFor(e){return e instanceof kr.P}};c(QT,"PSerializer");var AT=QT,jT=class jT extends ke{serialize(e){let t={};t[Nt]="g:TextP";let r=t[se]={predicate:e.operator};return e.other===void 0||e.other===null?r.value=this.writer.adaptObject(e.value):r.value=[this.writer.adaptObject(e.value),this.writer.adaptObject(e.other)],t}canBeUsedFor(e){return e instanceof kr.TextP}};c(jT,"TextPSerializer");var wT=jT,$T=class $T extends ke{serialize(e){return{[Nt]:"g:Lambda",[se]:{arguments:e.length,language:"gremlin-javascript",script:e.toString()}}}canBeUsedFor(e){return typeof e=="function"}};c($T,"LambdaSerializer");var vT=$T,ZT=class ZT extends ke{serialize(e){return{[Nt]:"g:"+e.typeName,[se]:e.elementName}}canBeUsedFor(e){return e&&e.typeName&&e instanceof kr.EnumValue}};c(ZT,"EnumSerializer");var IT=ZT,XT=class XT extends ke{serialize(e){return{[Nt]:"g:Traverser",[se]:{value:this.writer.adaptObject(e.object),bulk:this.writer.adaptObject(e.bulk)}}}deserialize(e){let t=e[se];return new kr.Traverser(this.reader.read(t.value),this.reader.read(t.bulk))}canBeUsedFor(e){return e instanceof kr.Traverser}};c(XT,"TraverserSerializer");var LT=XT,JT=class JT extends ke{serialize(e){return{[Nt]:"g:"+e.constructor.name,[se]:e.configuration}}canBeUsedFor(e){return e instanceof HQ.TraversalStrategy}};c(JT,"TraversalStrategySerializer");var ST=JT,eb=class eb extends ke{deserialize(e){let t=e[se];return new or.Vertex(this.reader.read(t.id),t.label,this.reader.read(t.properties))}serialize(e){return{[Nt]:"g:Vertex",[se]:{id:this.writer.adaptObject(e.id),label:e.label}}}canBeUsedFor(e){return e instanceof or.Vertex}};c(eb,"VertexSerializer");var KT=eb,tb=class tb extends ke{deserialize(e){let t=e[se];return new or.VertexProperty(this.reader.read(t.id),t.label,this.reader.read(t.value),this.reader.read(t.properties))}};c(tb,"VertexPropertySerializer");var OT=tb,ub=class ub extends ke{deserialize(e){let t=e[se];return new or.Property(t.key,this.reader.read(t.value))}};c(ub,"PropertySerializer");var NT=ub,rb=class rb extends ke{deserialize(e){let t=e[se];return new or.Edge(this.reader.read(t.id),new or.Vertex(this.reader.read(t.outV),this.reader.read(t.outVLabel)),t.label,new or.Vertex(this.reader.read(t.inV),this.reader.read(t.inVLabel)),this.reader.read(t.properties))}serialize(e){return{[Nt]:"g:Edge",[se]:{id:this.writer.adaptObject(e.id),label:e.label,outV:this.writer.adaptObject(e.outV.id),outVLabel:e.outV.label,inV:this.writer.adaptObject(e.inV.id),inVLabel:e.inV.label}}}canBeUsedFor(e){return e instanceof or.Edge}};c(rb,"EdgeSerializer");var UT=rb,ib=class ib extends ke{deserialize(e){let t=e[se],r=t.objects.map(i=>this.reader.read(i));return new or.Path(this.reader.read(t.labels),r)}};c(ib,"PathSerializer");var PT=ib,sb=class sb extends ke{deserialize(e){let t=e[se];return new or.Path(this.reader.read(t.labels),this.reader.read(t.objects))}};c(sb,"Path3Serializer");var kT=sb,nb=class nb extends ke{deserialize(e){return kr.t[e[se]]}};c(nb,"TSerializer");var BT=nb,ab=class ab extends ke{deserialize(e){return kr.direction[e[se].toLowerCase()]}};c(ab,"DirectionSerializer");var DT=ab,ob=class ob extends ke{constructor(e){super(),this.typeKey=e}deserialize(e){let t=e[se];if(!Array.isArray(t))throw new Error("Expected Array, obtained: "+t);return t.map(r=>this.reader.read(r))}serialize(e){return{[Nt]:this.typeKey,[se]:e.map(t=>this.writer.adaptObject(t))}}canBeUsedFor(e){return Array.isArray(e)}};c(ob,"ArraySerializer");var Y3=ob,cb=class cb extends ke{deserialize(e){let t=e[se];if(!Array.isArray(t))throw new Error("Expected Array, obtained: "+t);let r=[];for(let i=0,s=t.length;i{t.push(this.writer.adaptObject(i)),t.push(this.writer.adaptObject(r))}),{[Nt]:"g:Map",[se]:t}}canBeUsedFor(e){return e instanceof Map}};c(lb,"MapSerializer");var MT=lb,hb=class hb extends Y3{constructor(){super("g:List")}};c(hb,"ListSerializer");var HT=hb,fb=class fb extends Y3{constructor(){super("g:Set")}};c(fb,"SetSerializer");var qT=fb;AO.exports={BulkSetSerializer:FT,BytecodeSerializer:RT,DateSerializer:_T,DirectionSerializer:DT,EdgeSerializer:UT,EnumSerializer:IT,LambdaSerializer:vT,ListSerializer:HT,LongSerializer:CT,MapSerializer:MT,NumberSerializer:bT,Path3Serializer:kT,PathSerializer:PT,PropertySerializer:NT,PSerializer:AT,TextPSerializer:wT,SetSerializer:qT,TSerializer:BT,TraverserSerializer:LT,TraversalStrategySerializer:ST,typeKey:Nt,valueKey:se,VertexPropertySerializer:OT,VertexSerializer:KT}});var SO=w((Yc0,LO)=>{"use strict";var V0=wO(),db=class db{constructor(e){this._options=e||{},this._serializers=this.getDefaultSerializers().map(r=>{let i=new r;return i.writer=this,i});let t=this._options.serializers||{};Object.keys(t).forEach(r=>{let i=t[r];i.serialize&&(i.writer=this,this._serializers.unshift(i))})}getDefaultSerializers(){return IO}adaptObject(e){let t;for(let r=0;rthis.adaptObject(r)):e}write(e){return JSON.stringify(this.adaptObject(e))}};c(db,"GraphSON2Writer");var Q3=db,pb=class pb extends Q3{getDefaultSerializers(){return WQ}};c(pb,"GraphSON3Writer");var j3=pb,yb=class yb{constructor(e){this._options=e||{},this._deserializers={};let t=this.getDefaultDeserializers();if(Object.keys(t).forEach(r=>{let i=t[r],s=new i;s.reader=this,this._deserializers[r]=s}),this._options.serializers){let r=this._options.serializers||{};Object.keys(r).forEach(i=>{let s=r[i];s.deserialize&&(s.reader=this,this._deserializers[i]=s)})}}getDefaultDeserializers(){return vO}read(e){if(e===void 0)return;if(e===null)return null;if(Array.isArray(e))return e.map(r=>this.read(r));let t=e[V0.typeKey];if(t){let r=this._deserializers[t];return r?r.deserialize(e):e[V0.valueKey]}return e&&typeof e=="object"&&e.constructor===Object?this._deserializeObject(e):e}_deserializeObject(e){let t=Object.keys(e),r={};for(let i=0;i{"use strict";var zQ=require("util"),Bn=re(),Ut=f0(),{DefaultExecutionOptions:YQ,proxyExecuteKey:QQ}=gs(),KO=Bn.Long,As,jQ=Object.freeze({graphson1:"graphson-1.0",graphson2:"graphson-2.0",graphson3:"graphson-3.0"}),Qt=Object.freeze({language:"graph-language",source:"graph-source",name:"graph-name",results:"graph-results",writeConsistency:"graph-write-consistency",readConsistency:"graph-read-consistency",timeout:"request-timeout"});function $Q(u,e,t,r){return u.getOrCreateGraphOptions(r,c(function(){let s=r.graphOptions||Ut.emptyObject,a=u.getDefault(),o={customPayload:{[Qt.language]:Ut.allocBufferFromString(s.language||e.language),[Qt.source]:Ut.allocBufferFromString(s.source||e.source)},graphLanguage:s.language||e.language,graphResults:s.results||e.results,graphSource:s.source||e.source,graphName:Ut.ifUndefined(s.name,e.name)};r!==a?o.retry=r.retry||e.retry:o.retry=t||e.retry,e.executeAs&&(o.customPayload[QQ]=Ut.allocBufferFromString(e.executeAs)),o.graphName&&(o.customPayload[Qt.name]=Ut.allocBufferFromString(o.graphName));let h=Ut.ifUndefined(s.results,e.graphResults);h!==void 0&&(o.customPayload[Qt.results]=Ut.allocBufferFromString(h));let f=Ut.ifUndefined(s.readConsistency,e.readConsistency);f!==void 0&&(o.customPayload[Qt.readConsistency]=Ut.allocBufferFromString(X3(f)));let d=Ut.ifUndefined(s.writeConsistency,e.writeConsistency);return d!==void 0&&(o.customPayload[Qt.writeConsistency]=Ut.allocBufferFromString(X3(d))),o.readTimeout=Ut.ifUndefined3(r.readTimeout,a.readTimeout,e.readTimeout),o.readTimeout>0&&(o.customPayload[Qt.timeout]=OO(o.readTimeout)),o},"createDefaultOptions"))}c($Q,"getDefaultGraphOptions");function vo(u,e,t,r,i){if(i=i||Ut.allocBufferFromString,r!==null){if(r!==void 0){u[t]=i(r);return}e.customPayload[t]&&(u[t]=e.customPayload[t])}}c(vo,"setPayloadKey");function OO(u){return u=KO.fromNumber(u),KO.toBuffer(u)}c(OO,"longBuffer");function X3(u){if(u==null)return;ZQ();let e=As[u];if(!e)throw new Error(zQ.format("Consistency %s not found, use values defined as properties in types.consistencies object",u));return e}c(X3,"getConsistencyName");function ZQ(){if(As)return;As={};let u=Object.keys(Bn.consistencies);for(let e=0;e0?this.getReadTimeout():null,OO),r[Qt.results]=t.graphResults===this.getGraphSubProtocol()?t.customPayload[Qt.results]:Ut.allocBufferFromString(this.getGraphSubProtocol()),this.setCustomPayload(r)}};c(mb,"GraphExecutionOptions");var Eb=mb;NO.exports={GraphExecutionOptions:Eb,graphProtocol:jQ,payloadKeys:Qt}});var MO=w((Zc0,FO)=>{"use strict";var PO=f0(),XQ=j1(),JQ=L5(),{GraphSON2Reader:ej,GraphSON2Writer:tj,GraphSON3Reader:uj,GraphSON3Writer:rj}=SO(),J3=ET(),{GraphExecutionOptions:ij,graphProtocol:ai}=UO(),kO="gremlin-groovy",sj="Core",nj=new ej({serializers:J3()}),aj=new tj({serializers:J3()}),oj=new uj({serializers:J3()}),cj=new rj({serializers:J3()}),lj=new Map([[ai.graphson2,BO(nj)],[ai.graphson3,BO(oj)]]),hj=new Map([[ai.graphson1,u=>JSON.stringify(u)],[ai.graphson2,DO(aj)],[ai.graphson3,DO(cj)]]),Dn=class Dn{constructor(e,t,r){this._client=e,this._handler=r,this._defaultProfileRetryPolicy=e.profileManager.getDefaultConfiguredRetryPolicy(),this._graphBaseOptions=PO.extend({executeAs:e.options.queryOptions.executeAs,language:kO,source:"g",readTimeout:0,retry:new XQ.retry.FallthroughRetryPolicy},t.graphOptions,e.profileManager.getDefault().graphOptions),this._graphBaseOptions.readTimeout===null&&(this._graphBaseOptions.readTimeout=e.options.socketOptions.readTimeout)}async send(e,t,r){if(Array.isArray(t))throw new TypeError("Parameters must be a Object instance as an associative array");if(!e)throw new TypeError("Query must be defined");let i=new ij(r,this._client,this._graphBaseOptions,this._defaultProfileRetryPolicy);if(i.getGraphSource()==="a"){let a=await this._getAnalyticsMaster();i.setPreferredHost(a)}let s=typeof e=="object"&&e.graphLanguage&&e.value&&e.queryWriterFactory;if(s&&i.setGraphLanguage(e.graphLanguage),this._setGraphProtocol(i),i.setGraphPayload(),t=Dn._buildGraphParameters(t,i.getGraphSubProtocol()),typeof e!="string"){let a=i.getQueryWriter();s?a=e.queryWriterFactory(i.getGraphSubProtocol()):a||(a=Dn._writerFactory(i.getGraphSubProtocol())),e=a(s?e.value:e)}return await this._executeGraphQuery(e,t,i)}async _executeGraphQuery(e,t,r){let i=await this._handler.call(this._client,e,t,r),s=r.getRowParser()||Dn._rowParserFactory(r.getGraphSubProtocol());return new JQ(i,s)}async _getAnalyticsMaster(){try{let e=await this._client.execute("CALL DseClientTool.getAnalyticsGraphServer()",PO.emptyArray);if(e.rows.length===0)return this._client.log("verbose","Empty response querying graph analytics server, query will not be routed optimally"),null;let t=e.rows[0].result;if(!t||!t.location)return this._client.log("verbose","Unexpected response querying graph analytics server, query will not be routed optimally",e.rows[0]),null;let r=t.location.substr(0,t.location.lastIndexOf(":")),i=this._client.options.policies.addressResolution;return await new Promise(s=>{i.translate(r,this._client.options.protocolOptions.port,a=>s(this._client.hosts.get(a)))})}catch(e){return this._client.log("verbose","Error querying graph analytics server, query will not be routed optimally",e),null}}_setGraphProtocol(e){let t=e.getGraphSubProtocol();if(!t){if(e.getGraphName()){let r=this._client.metadata.keyspaces[e.getGraphName()];r&&r.graphEngine===sj&&(t=ai.graphson3)}t||(e.getGraphLanguage()===kO?t=ai.graphson1:t=ai.graphson2),e.setGraphSubProtocol(t)}}static _buildGraphParameters(e,t){if(!e||typeof e!="object")return null;let r=Dn._writerFactory(t);return[t!==ai.graphson1&&t!==ai.graphson2?r(new Map(Object.entries(e))):r(e)]}static _rowParserFactory(e){let t=lj.get(e);return t||null}static _writerFactory(e){let t=hj.get(e);if(!t)throw new Error(`No writer defined for protocol ${e}`);return t}};c(Dn,"GraphExecutor");var xb=Dn;function BO(u){return e=>{let t=u.read(JSON.parse(e.gremlin));return{object:t.result,bulk:t.bulk||1}}}c(BO,"getRowParser");function DO(u){return e=>u.write(e)}c(DO,"getDefaultWriter");FO.exports=xb});var WO=w((Jc0,GO)=>{"use strict";var HO=require("events"),Tb=require("util"),Mn=f0(),Fn=ce(),Hn=re(),{ProfileManager:fj}=gm(),ey=Es(),qO=Ml(),dj=wS(),pj=ho().description,{version:yj}=ho(),{DefaultExecutionOptions:bb}=gs(),gj=dK(),_b=xK(),VO=vx(),Ej=IK(),mj=cO(),xj=MO(),Br=iu(),Tj=32;function Ae(u){HO.EventEmitter.call(this),this.options=qO.extend({logEmitter:this.emit.bind(this),id:Hn.Uuid.random()},u),Object.defineProperty(this,"profileManager",{value:new fj(this.options)}),Object.defineProperty(this,"controlConnection",{value:new gj(this.options,this.profileManager),writable:!0}),Object.defineProperty(this,"insightsClient",{value:new Ej(this)}),this.setMaxListeners(0),this.connected=!1,this.isShuttingDown=!1,this.keyspace=u.keyspace,this.metadata=this.controlConnection.metadata,this.hosts=this.controlConnection.hosts,this.metrics=this.options.metrics,this._graphExecutor=new xj(this,u,this._execute)}c(Ae,"Client");Tb.inherits(Ae,HO.EventEmitter);Ae.prototype.connect=function(u){return this.connected&&u?u():Br.optionalCallback(this._connect(),u)};Ae.prototype._connect=async function(){if(!this.connected){if(this.isShuttingDown)throw new Fn.NoHostAvailableError(null,"Connecting after shutdown is not supported");if(this.connecting)return Br.fromEvent(this,"connected");this.connecting=!0,this.log("info",Tb.format("Connecting to cluster using '%s' version %s",pj,yj));try{await mj.init(this.options),await this.controlConnection.init(),this.hosts=this.controlConnection.hosts,await this.profileManager.init(this,this.hosts),this.keyspace&&await _b.setKeyspace(this),qO.setMetadataDependent(this),await this._warmup()}catch(u){throw await this.controlConnection.reset(),this.connected=!1,this.connecting=!1,this.emit("connected",u),u}this._setHostListeners(),this.profileManager.getDistance(this.controlConnection.host),this.insightsClient.init(),this.connected=!0,this.connecting=!1,this.emit("connected")}};Ae.prototype.execute=function(u,e,t,r){r||(typeof t=="function"?(r=t,t=null):typeof e=="function"&&(r=e,e=null));try{let i=bb.create(t,this);return Br.optionalCallback(this._execute(u,e,i),r)}catch(i){return r?r(i):Promise.reject(i)}};Ae.prototype.executeGraph=function(u,e,t,r){return r=r||t||e,typeof r=="function"?(e=typeof e!="function"?e:null,Br.toCallback(this._graphExecutor.send(u,e,t),r)):this._graphExecutor.send(u,e,t)};Ae.prototype.eachRow=function(u,e,t,r,i){!i&&r&&typeof t=="function"?(i=Mn.validateFn(r,"rowCallback"),r=t):(i=i||Mn.noop,r=Mn.validateFn(r||t||e,"rowCallback")),e=typeof e!="function"?e:null;let s;try{s=bb.create(t,this,r)}catch(f){return i(f)}let a=0,o=c(()=>Br.toCallback(this._execute(u,e,s),h),"nextPage");function h(f,d){if(f)return i(f);if(a+=d.rowLength,d.rawPageState!==void 0){if(s.setPageState(d.rawPageState),s.isAutoPage())return o();d.nextPage=o}d.rowLength=a,i(null,d)}c(h,"pageCallback"),Br.toCallback(this._execute(u,e,s),h)};Ae.prototype.stream=function(u,e,t,r){r=r||Mn.noop;let i=new Hn.ResultStream({objectMode:1});function s(o,h){if(o&&i.emit("error",o),h&&h.nextPage){i._valve(c(function(){try{h.nextPage()}catch(d){i.emit("error",d)}},"pageValve"));return}i._valve(null),i.add(null),r(o)}c(s,"onFinish");let a=!0;return this.eachRow(u,e,t,c(function(h,f){i.add(f)},"rowCallback"),c(function(h,f){if(a)return setImmediate(c(function(){s(h,f)},"eachRowFinishedImmediate"));s(h,f)},"eachRowFinished")),a=!1,i};Ae.prototype.batch=function(u,e,t){return!t&&typeof e=="function"&&(t=e,e=null),Br.optionalCallback(this._batch(u,e),t)};Ae.prototype._batch=async function(u,e){if(!Array.isArray(u))throw new Fn.ArgumentError("Queries should be an Array");if(u.length===0)throw new Fn.ArgumentError("Queries array should not be empty");await this._connect();let t=bb.create(e,this),r;if(t.isPrepared()){let s=this.controlConnection.protocolVersion,a=Hn.protocolVersion.supportsKeyspaceInRequest(s)&&e.keyspace||this.keyspace;r=await VO.getPreparedMultiple(this,t.getLoadBalancingPolicy(),u,a)}else{r=new Array(u.length);for(let s=0;se.shutdown(!1)))};Ae.prototype._waitForSchemaAgreement=async function(u){if(this.hosts.length===1)return!0;let e=process.hrtime(),t=this.options.protocolOptions.maxSchemaAgreementWaitSeconds;this.log("info","Waiting for schema agreement");let r;for(;!r&&process.hrtime(e)[0]r.emit("hostUp",i)}c(u,"getHostUpListener");function e(r,i){return()=>r.emit("hostDown",i)}c(e,"getHostDownListener");let t=this;this.hosts.on("add",c(function(i){i.on("up",u(t,i)),i.on("down",e(t,i)),t.emit("hostAdd",i)},"hostAddedListener")),this.hosts.on("remove",c(function(i){i.removeAllListeners(),t.emit("hostRemove",i)},"hostRemovedListener")),this.hosts.forEach(function(r){r.on("up",u(t,r)),r.on("down",e(t,r))})};Ae.prototype._warmup=function(){let u=this.hosts.values();return Br.times(u.length,Tj,async e=>{let t=u[e],r=this.profileManager.getDistance(t);if(r!==Hn.distance.ignored)if(this.options.pooling.warmup&&r===Hn.distance.local)try{await t.warmupPool(this.keyspace)}catch(i){this.log("warning",`Connection pool to host ${t.address} could not be created: ${i}`,i)}else t.initializePool()})};Ae.prototype._getEncoder=function(){let u=this.controlConnection.getEncoder();if(!u)throw new Fn.DriverInternalError("Encoder is not defined");return u};Ae.prototype._createBatchRequest=async function(u,e){let t=u[0];return t.meta?(await this._setRoutingInfo(e,t.params,t.meta),new ey.BatchRequest(u,e)):new ey.BatchRequest(u,e)};Ae.prototype._createExecuteRequest=async function(u,e,t,r,i){return r=Mn.adaptNamedParamsPrepared(r,i.columns),await this._setRoutingInfo(t,r,i),new ey.ExecuteRequest(u,e,r,t,i)};Ae.prototype._createQueryRequest=async function(u,e,t){await this.metadata.adaptUserHints(this.keyspace,e.getHints());let r=Mn.adaptNamedParamsWithHints(t,e);return this._getEncoder().setRoutingKeyFromUser(r.params,e,r.keyIndexes),new ey.QueryRequest(u,r.params,e,r.namedParameters)};Ae.prototype._setRoutingInfo=async function(u,e,t){let r=this._getEncoder();if(!u.getKeyspace()&&t.keyspace&&u.setKeyspace(t.keyspace),u.getRoutingKey())return r.setRoutingKeyFromUser(e,u);if(Array.isArray(t.partitionKeys))return u.setRoutingIndexes(t.partitionKeys),r.setRoutingKeyFromMeta(t,e,u);try{let i=await this.metadata.getTable(t.keyspace,t.table);if(!i)return;u.setRoutingIndexes(i.partitionKeys.map(s=>t.columnsByName[s.name])),t.partitionKeys=u.getRoutingIndexes(),r.setRoutingKeyFromMeta(t,e,u)}catch{this.log("warning",Tb.format("Table %s.%s metadata could not be retrieved",t.keyspace,t.table))}};GO.exports=Ae});var wb=w((tl0,zO)=>{"use strict";var bj=require("events"),Rb=class Rb extends bj{constructor(e,t,r){super(),this.key=e,this.value=t,this.edges=r||[]}};c(Rb,"Node");var Lh=Rb,Ab=class Ab extends Lh{constructor(){super([],null),this.length=0}getOrCreate(e,t){typeof e.next!="function"&&(e=e[Symbol.iterator]());let r=this,i=!1,s=e.next();for(;;){let a;for(let f=1;f0&&(r.value=t()),r.value}_createBranch(e,t,r,i){let s=new Lh(e.key.slice(t),e.value,e.edges);return e.key=e.key.slice(0,t),e.edges=[s],r?(e.value=i(),this._onItemAdded()):e.value=null,s}_onItemAdded(){this.length++,this.emit("add",this.length)}};c(Ab,"Tree");var Cb=Ab;function _j(u,e){let t=[u],r=e.next();for(;!r.done;)t.push(r.value),r=e.next();return t}c(_j,"iteratorToArray");zO.exports=Cb});var uy=w(ty=>{"use strict";var Cj=ce(),vb=class vb{constructor(e,t,r,i){this.key=e,this.value=t,this.hasChildValues=r,this.isInOperator=i}};c(vb,"QueryOperator");var oi=vb,Ib=class Ib{constructor(e,t,r){this.sign=e,this.value=t,this.inverted=!!r}};c(Ib,"QueryAssignment");var ws=Ib,Rj={in_:c(function(e){if(!Array.isArray(e))throw new Cj.ArgumentError("IN operator supports only Array values");return new oi("IN",e,!1,!0)},"in_"),gt:c(function(e){return new oi(">",e)},"gt"),gte:c(function(e){return new oi(">=",e)},"gte"),lt:c(function(e){return new oi("<",e)},"lt"),lte:c(function(e){return new oi("<=",e)},"lte"),notEq:c(function(e){return new oi("!=",e)},"notEq"),and:function(u,e){return new oi("AND",[u,e],!0)},incr:c(function(e){return new ws("+",e)},"incr"),decr:c(function(e){return new ws("-",e)},"decr"),append:c(function(e){return new ws("+",e)},"append"),prepend:c(function(e){return new ws("+",e,!0)},"prepend"),remove:c(function(e){return new ws("-",e)},"remove")};ty.q=Rj;ty.QueryAssignment=ws;ty.QueryOperator=oi});var Sb=w((sl0,jO)=>{"use strict";var QO=uy(),YO=QO.QueryOperator,Aj=QO.QueryAssignment,Nu=class Nu{static*getSelectKey(e,t,r){yield*Nu._yieldKeyAndOperators(e,t),yield*Nu._getSelectDocInfo(r)}static*getSelectAllKey(e){yield"root",yield*Nu._getSelectDocInfo(e)}static*_getSelectDocInfo(e){if(e&&(e.fields&&e.fields.length>0&&(yield"|f|",yield*e.fields),typeof e.limit=="number"&&(yield"|l|"),e.orderBy)){yield"|o|";let t=Object.keys(e.orderBy);for(let r=0;r0&&(yield"|f|",yield*t.fields),typeof t.ttl=="number"&&(yield"|t|"),t.ifNotExists&&(yield"|e|"))}static*getUpdateKey(e,t,r){yield*Nu._yieldKeyAndAllQs(e,t),r&&(r.fields&&r.fields.length>0&&(yield"|f|",yield*r.fields),typeof r.ttl=="number"&&(yield"|t|"),r.ifExists&&(yield"|e|"),r.when&&(yield*Nu._yieldKeyAndOperators(Object.keys(r.when),r.when)))}static*getRemoveKey(e,t,r){yield*Nu._yieldKeyAndOperators(e,t),r&&(r.fields&&r.fields.length>0&&(yield"|f|",yield*r.fields),r.ifExists&&(yield"|e|"),r.deleteOnlyColumns&&(yield"|dc|"),r.when&&(yield*Nu._yieldKeyAndOperators(Object.keys(r.when),r.when)))}static*_yieldKeyAndOperators(e,t){for(let r=0;r{"use strict";var Ub=Sb(),Pb=class Pb{constructor(e,t,r,i){this.doc=e,this.docInfo=t,this.handler=r,this.cache=i}getQueries(){let e=Object.keys(this.doc),t=this.cache.getOrCreate(this.getCacheKey(e),()=>({queries:null}));return t.queries===null&&(t.queries=this.createQueries(e)),t.queries}getCacheKey(e){throw new Error("getCacheKey must be implemented")}createQueries(e){throw new Error("getCacheKey must be implemented")}pushQueries(e){let t=!0,r;return this.getQueries().then(i=>(i.forEach(s=>{t=t&&s.isIdempotent,r=s.isCounter,e.push({query:s.query,params:s.paramsGetter(this.doc,this.docInfo,this.getMappingInfo())})}),{isIdempotent:t,isCounter:r}))}getMappingInfo(){return this.handler.info}};c(Pb,"ModelBatchItem");var Io=Pb,kb=class kb extends Io{constructor(e,t,r,i){super(e,t,r,i)}getCacheKey(e){return Ub.getInsertKey(e,this.docInfo)}createQueries(e){return this.handler.createInsertQueries(e,this.doc,this.docInfo)}};c(kb,"InsertModelBatchItem");var Kb=kb,Bb=class Bb extends Io{constructor(e,t,r,i){super(e,t,r,i)}getCacheKey(e){return Ub.getUpdateKey(e,this.doc,this.docInfo)}createQueries(e){return this.handler.createUpdateQueries(e,this.doc,this.docInfo)}};c(Bb,"UpdateModelBatchItem");var Ob=Bb,Db=class Db extends Io{constructor(e,t,r,i){super(e,t,r,i)}getCacheKey(e){return Ub.getRemoveKey(e,this.doc,this.docInfo)}createQueries(e){return this.handler.createDeleteQueries(e,this.doc,this.docInfo)}};c(Db,"RemoveModelBatchItem");var Nb=Db;$O.exports={ModelBatchItem:Io,InsertModelBatchItem:Kb,UpdateModelBatchItem:Ob,RemoveModelBatchItem:Nb}});var Vb=w((cl0,ZO)=>{"use strict";var Fb=wb(),Hb=ry(),wj=Hb.InsertModelBatchItem,vj=Hb.UpdateModelBatchItem,Ij=Hb.RemoveModelBatchItem,qb=class qb{constructor(e){this._handler=e,this._cache={insert:new Fb,update:new Fb,remove:new Fb}}insert(e,t){return new wj(e,t,this._handler,this._cache.insert)}update(e,t){return new vj(e,t,this._handler,this._cache.update)}remove(e,t){return new Ij(e,t,this._handler,this._cache.update)}};c(qb,"ModelBatchMapper");var Mb=qb;ZO.exports=Mb});var zb=w((hl0,XO)=>{"use strict";var Lj=Vb(),Wb=class Wb{constructor(e,t){this.name=e,this._handler=t,this.batching=new Lj(this._handler)}get(e,t,r){return r===void 0&&typeof t=="string"&&(r=t,t=null),this._handler.getSelectExecutor(e,t,!0).then(i=>i(e,t,r)).then(i=>i.first())}find(e,t,r){return r===void 0&&typeof t=="string"&&(r=t,t=null),this._handler.getSelectExecutor(e,t,!1).then(i=>i(e,t,r))}findAll(e,t){return t===void 0&&typeof e=="string"&&(t=e,e=null),this._handler.getSelectAllExecutor(e)(e,t)}insert(e,t,r){return r===void 0&&typeof t=="string"&&(r=t,t=null),this._handler.getInsertExecutor(e,t).then(i=>i(e,t,r))}update(e,t,r){return r===void 0&&typeof t=="string"&&(r=t,t=null),this._handler.getUpdateExecutor(e,t).then(i=>i(e,t,r))}remove(e,t,r){return r===void 0&&typeof t=="string"&&(r=t,t=null),this._handler.getDeleteExecutor(e,t).then(i=>i(e,t,r))}mapWithQuery(e,t,r){return this._handler.getExecutorFromQuery(e,t,r)}};c(Wb,"ModelMapper");var Gb=Wb;XO.exports=Gb});var rN=w((dl0,uN)=>{"use strict";var iy=require("vm"),tN=uy(),JO=tN.QueryOperator,Yb=tN.QueryAssignment,Sj=re(),eN=Sj.dataTypes,sy="gen-param-getter.js",fe=class fe{static getSelect(e,t,r,i,s,a){let o="SELECT ";return o+=i.length>0?i.map(h=>`"${h.columnName}"`).join(", "):"*",o+=` FROM ${t}.${e}`,r.length>0&&(o+=" WHERE ",o+=fe._getConditionWithOperators(r)),s.length>0&&(o+=" ORDER BY ",o+=s.map(h=>`"${h[0]}" ${h[1]}`).join(", ")),typeof a=="number"&&(o+=" LIMIT ?"),o}static selectParamsGetter(e,t){let r=`(function getParametersSelect(doc, docInfo, mappingInfo) { +`;return r+=" return [",r+=fe._valueGetterExpression(e),typeof t=="number"&&(e.length>0&&(r+=", "),r+="docInfo['limit']"),r+=`]; +})`,new iy.Script(r,{filename:sy}).runInThisContext()}static getInsert(e,t,r,i,s){let a=i&&i.ttl,o=r.filter(h=>e.columnsByName[h.columnName]!==void 0);return{query:fe._getInsertQuery(e.name,t,o,s,a),paramsGetter:fe._insertParamsGetter(o,i),isIdempotent:!s}}static _getInsertQuery(e,t,r,i,s){let a=`INSERT INTO ${t}.${e} (`;return a+=r.map(o=>`"${o.columnName}"`).join(", "),a+=") VALUES (",a+=r.map(()=>"?").join(", "),a+=")",i===!0&&(a+=" IF NOT EXISTS"),typeof s=="number"&&(a+=" USING TTL ?"),a}static _insertParamsGetter(e,t){let r=`(function getParametersInsert(doc, docInfo, mappingInfo) { +`;return r+=" return [",r+=fe._valueGetterExpression(e),t&&typeof t.ttl=="number"&&(r+=", docInfo['ttl']"),r+=`]; +})`,new iy.Script(r,{filename:sy}).runInThisContext()}static getUpdate(e,t,r,i,s,a){let o=i&&i.ttl,h=new Set(e.partitionKeys.concat(e.clusteringKeys).map(E=>E.name)),f=!0,d=!1,p=r.filter(E=>{let x=e.columnsByName[E.columnName];return x===void 0?!1:(x.type.code===eN.list&&E.value instanceof Yb?f=!1:x.type.code===eN.counter&&(f=!1,d=!0),!0)});return{query:fe._getUpdateQuery(e.name,t,h,p,s,a,o),isIdempotent:f&&s.length===0&&!a,paramsGetter:fe._updateParamsGetter(h,p,s,o),isCounter:d}}static _getUpdateQuery(e,t,r,i,s,a,o){let h=`UPDATE ${t}.${e} `;return typeof o=="number"&&(h+="USING TTL ? "),h+="SET ",h+=i.filter(f=>!r.has(f.columnName)).map(f=>f.value instanceof Yb?f.value.inverted?`"${f.columnName}" = ? ${f.value.sign} "${f.columnName}"`:`"${f.columnName}" = "${f.columnName}" ${f.value.sign} ?`:`"${f.columnName}" = ?`).join(", "),h+=" WHERE ",h+=i.filter(f=>r.has(f.columnName)).map(f=>`"${f.columnName}" = ?`).join(" AND "),a===!0?h+=" IF EXISTS":s.length>0&&(h+=" IF "+fe._getConditionWithOperators(s)),h}static _updateParamsGetter(e,t,r,i){let s=`(function getParametersUpdate(doc, docInfo, mappingInfo) { +`;return s+=" return [",typeof i=="number"&&(s+="docInfo['ttl'], "),s+=fe._assignmentGetterExpression(t.filter(o=>!e.has(o.columnName))),s+=", ",s+=fe._valueGetterExpression(t.filter(o=>e.has(o.columnName))),r.length>0&&(s+=", "+fe._valueGetterExpression(r,"docInfo.when")),s+=`]; +})`,new iy.Script(s,{filename:sy}).runInThisContext()}static getDelete(e,t,r,i,s,a){let o=i&&i.deleteOnlyColumns,h=new Set(e.partitionKeys.concat(e.clusteringKeys).map(d=>d.name)),f=r.filter(d=>e.columnsByName[d.columnName]!==void 0);return{query:fe._getDeleteQuery(e.name,t,h,f,s,a,o),paramsGetter:fe._deleteParamsGetter(h,f,s),isIdempotent:s.length===0&&!a}}static _getDeleteQuery(e,t,r,i,s,a,o){let h="DELETE";if(o){let f=i.filter(d=>!r.has(d.columnName)).map(d=>`"${d.columnName}"`).join(", ");f!==""&&(h+=" "+f)}return h+=` FROM ${t}.${e} WHERE `,h+=i.filter(f=>r.has(f.columnName)).map(f=>`"${f.columnName}" = ?`).join(" AND "),a===!0?h+=" IF EXISTS":s.length>0&&(h+=" IF "+fe._getConditionWithOperators(s)),h}static _deleteParamsGetter(e,t,r){let i=`(function getParametersDelete(doc, docInfo, mappingInfo) { +`;return i+=" return [",i+=fe._valueGetterExpression(t.filter(a=>e.has(a.columnName))),r.length>0&&(i+=", "+fe._valueGetterExpression(r,"docInfo.when")),i+=`]; +})`,new iy.Script(i,{filename:sy}).runInThisContext()}static _valueGetterExpression(e,t){return t=t||"doc",e.map(r=>fe._valueGetterSingle(`${t}['${r.propertyName}']`,r.propertyName,r.value,r.fromModel)).join(", ")}static _valueGetterSingle(e,t,r,i){let s=e;if(r instanceof JO){if(r.hasChildValues)return`${fe._valueGetterSingle(`${e}.value[0]`,t,r.value[0],i)}, ${fe._valueGetterSingle(`${e}.value[1]`,t,r.value[1],i)}`;if(s=`${e}.value`,r.isInOperator&&i)return`${s}.map(v => ${fe._getMappingFunctionCall(t,"v")})`}return i?fe._getMappingFunctionCall(t,s):s}static _assignmentGetterExpression(e,t){return t=t||"doc",e.map(r=>{let i=`${t}['${r.propertyName}']${r.value instanceof Yb?".value":""}`;return r.fromModel?fe._getMappingFunctionCall(r.propertyName,i):i}).join(", ")}static _getConditionWithOperators(e){return e.map(t=>fe._getSingleCondition(t.columnName,t.value)).join(" AND ")}static _getMappingFunctionCall(e,t){return`mappingInfo.getFromModelFn('${e}')(${t})`}static _getSingleCondition(e,t){return t instanceof JO?t.hasChildValues?`${fe._getSingleCondition(e,t.value[0])} ${t.key} ${fe._getSingleCondition(e,t.value[1])}`:`"${e}" ${t.key} ?`:`"${e}" = ?`}};c(fe,"QueryGenerator");var Qb=fe;uN.exports=Qb});var Zb=w((yl0,sN)=>{"use strict";var Kj=require("vm"),jb=f0(),iN=re(),Lo=class Lo{static getSelectAdapter(e,t){let r=t.columns;if(!r)throw new Error("Expected ROWS result obtained VOID");let i=`(function rowAdapter(row, info) { + const item = info.newInstance(); +`;for(let a of r)i+=` item['${e.getPropertyName(a.name)}'] = `,e.getToModelFn(a.name)?i+=`info.getToModelFn('${a.name}')(row['${a.name}']); +`:i+=`row['${a.name}']; +`;return i+=` return item; +})`,new Kj.Script(i,{filename:"gen-result-mapper.js"}).runInThisContext()}static getMutationAdapter(e){return e.columns===null||e.columns.length===1&&e.columns[0].name==="[applied]"&&e.columns[0].type.code===iN.dataTypes.boolean?jb.noop:Lo._getConditionalRowAdapter(e)}static _getConditionalRowAdapter(e){return c(function(r,i){let s=i.newInstance();for(let a=1;a{"use strict";var Oj=require("util"),Nj=f0(),Uj=Oj.inspect.custom||"inspect",Jb=class Jb{constructor(e,t,r){this._rs=e,this._info=t,this._rowAdapter=r,this._isEmptyLwt=e.columns!==null&&e.columns.length===1&&this._rs.rowLength===1&&e.columns[0].name==="[applied]",this.length=this._isEmptyLwt?0:e.rowLength||0,this.pageState=e.pageState}wasApplied(){return this._rs.wasApplied()}first(){return!this._rs.rowLength||this._isEmptyLwt?null:this._rowAdapter(this._rs.rows[0],this._info)}*[Symbol.iterator](){if(!this._isEmptyLwt)for(let e=0;ethis._rowAdapter(e,this._info))}forEach(e,t){let r=0;t=t||this;for(let i of this)e.call(t,i,r++)}[Uj](){return this.toArray()}};c(Jb,"Result");var Xb=Jb;nN.exports=Xb});var lN=w((xl0,cN)=>{"use strict";var cr={all:1,none:0,some:-1},u_=class u_{static getForSelect(e,t,r,i,s,a){return Promise.all(t.tables.map(o=>o.isView?e.metadata.getMaterializedView(t.keyspace,o.name):e.metadata.getTable(t.keyspace,o.name))).then(o=>{for(let f=0;fd.partitionKeys.length&&!i.reduce((g,m)=>g&&(t_(d.partitionKeys,A=>A.name===m.columnName)||t_(d.clusteringKeys,A=>A.name===m.columnName)),!0)||!s.reduce((x,g)=>x&&d.columnsByName[g.columnName]!==void 0,!0)||!a.reduce((x,g,m)=>{if(!x)return!1;let A=d.clusteringKeys[m];return A&&A.name===g[0]},!0)))return d.name}let h=`No table matches the filter (${r?"all PKs have to be specified":"PKs"}): [${i.map(f=>f.columnName)}]`;throw s.length>0&&(h+=`; fields: [${s.map(f=>f.columnName)}]`),a.length>0&&(h+=`; orderBy: [${a.map(f=>f[0])}]`),new Error(h)})}static getForSelectAll(e){return e.tables[0].name}static getForInsert(e,t,r){return Promise.all(t.tables.filter(i=>!i.isView).map(i=>e.metadata.getTable(t.keyspace,i.name))).then(i=>{let s=i.filter((a,o)=>{if(a===null)throw new Error(`Table "${t.tables[o].name}" could not be retrieved`);if(So(a.partitionKeys,r)!==cr.all)return!1;let h=So(a.clusteringKeys,r);if(h===cr.all)return!0;if(h===cr.some)return!1;let f=oN(a);return r.length===a.partitionKeys.length+f&&f>0});if(s.length===0)throw new Error(`No table matches (all PKs have to be specified) fields: [${r.map(a=>a.columnName)}]`);return s})}static getForUpdate(e,t,r,i){return Promise.all(t.tables.filter(s=>!s.isView).map(s=>e.metadata.getTable(t.keyspace,s.name))).then(s=>{let a=s.filter((o,h)=>{if(o===null)throw new Error(`Table "${t.tables[h].name}" could not be retrieved`);if(So(o.partitionKeys,r)!==cr.all)return!1;let f=So(o.clusteringKeys,r);if(f===cr.some||f===cr.none&&!aN(o))return!1;let d=r.reduce((p,E)=>p+(o.columnsByName[E.columnName]!==void 0?1:0),0);return d<=o.partitionKeys.length+o.clusteringKeys.length&&(!aN(o)||d<=o.partitionKeys.length)?!1:i.reduce((p,E)=>p&&o.columnsByName[E.columnName]!==void 0,!0)});if(a.length===0){let o=`No table matches (all PKs and columns to set have to be specified) fields: [${r.map(h=>h.columnName)}]`;throw i.length>0&&(o+=`; condition: [${i.map(h=>h.columnName)}]`),new Error(o)}return a})}static getForDelete(e,t,r,i){return Promise.all(t.tables.filter(s=>!s.isView).map(s=>e.metadata.getTable(t.keyspace,s.name))).then(s=>{let a=s.filter((o,h)=>{if(o===null)throw new Error(`Table "${t.tables[h].name}" could not be retrieved`);let f=o.partitionKeys.concat(o.clusteringKeys).map(p=>p.name),d=r.map(p=>p.columnName);for(let p=0;pp&&o.columnsByName[E.columnName]!==void 0,!0)});if(a.length===0){let o=`No table matches (all PKs have to be specified) fields: [${r.map(h=>h.columnName)}]`;throw i.length>0&&(o+=`; condition: [${i.map(h=>h.columnName)}]`),new Error(o)}return a})}};c(u_,"ObjectSelector");var e_=u_;function t_(u,e){return u.filter(e).length>0}c(t_,"contains");function So(u,e){if(u.length===0)return cr.all;let t=e.reduce((r,i)=>r+(t_(u,s=>i.columnName===s.name)?1:0),0);return t===0?cr.none:t===u.length?cr.all:cr.some}c(So,"keysAreIncluded");function aN(u){return oN(u)>0}c(aN,"hasStaticColumn");function oN(u){return u.columns.reduce((e,t)=>e+(t.isStatic?1:0),0)}c(oN,"staticColumnCount");cN.exports=e_});var s_=w((bl0,hN)=>{"use strict";var Pj=ce(),kj=f0(),i_=class i_{static getPropertiesInfo(e,t,r,i){let s=e;return t&&t.fields&&t.fields.length>0&&(s=t.fields),s.map(a=>({propertyName:a,columnName:i.getColumnName(a),value:r[a],fromModel:i.getFromModelFn(a)}))}static adaptOrderBy(e,t){return!e||!e.orderBy?kj.emptyArray:Object.keys(e.orderBy).map(r=>{let i=e.orderBy[r],s=typeof i=="string"?i.toUpperCase():i;if(s!=="ASC"&&s!=="DESC")throw new Pj.ArgumentError('Order must be either "ASC" or "DESC", obtained: '+i);return[t.getColumnName(r),s]})}static adaptOptions(e,t){let r={prepare:!0,executionProfile:void 0,timestamp:void 0,isIdempotent:t};return typeof e=="string"?r.executionProfile=e:e!=null&&(r.executionProfile=e.executionProfile,r.timestamp=e.timestamp,e.isIdempotent!==void 0&&(r.isIdempotent=e.isIdempotent)),r}static adaptAllOptions(e,t){let r={prepare:!0,executionProfile:void 0,fetchSize:void 0,pageState:void 0,timestamp:void 0,isIdempotent:void 0};return typeof e=="string"?r.executionProfile=e:e!=null&&(r.executionProfile=e.executionProfile,r.fetchSize=e.fetchSize,r.pageState=e.pageState,r.timestamp=e.timestamp,r.isIdempotent=e.isIdempotent),t&&(r.isIdempotent=!0),r}static adaptBatchOptions(e,t,r){let i={prepare:!0,executionProfile:void 0,timestamp:void 0,logged:void 0,isIdempotent:t,counter:r};return typeof e=="string"?i.executionProfile=e:e!=null&&(i.executionProfile=e.executionProfile,i.timestamp=e.timestamp,i.logged=e.logged!==!1,e.isIdempotent!==void 0&&(i.isIdempotent=e.isIdempotent)),i}};c(i_,"DocInfoAdapter");var r_=i_;hN.exports=r_});var dN=w((Cl0,fN)=>{"use strict";var qn=f0(),Vn=rN(),ay=Zb(),oy=ny(),Sh=Sb(),Kh=wb(),Oh=lN(),cu=s_(),cy=100,a_=class a_{constructor(e,t){this._client=e,this._cache={select:new Kh().on("add",r=>this._validateCacheLength(r)),selectAll:new Kh().on("add",r=>this._validateCacheLength(r)),insert:new Kh().on("add",r=>this._validateCacheLength(r)),update:new Kh().on("add",r=>this._validateCacheLength(r)),remove:new Kh().on("add",r=>this._validateCacheLength(r)),customQueries:new Map},this.info=t}getSelectExecutor(e,t,r){let i=Object.keys(e);if(i.length===0)return Promise.reject(new Error("Expected object with keys"));let s=Sh.getSelectKey(i,e,t),a=this._cache.select.getOrCreate(s,()=>({executor:null,resultAdapter:null}));if(a.executor!==null)return Promise.resolve(a.executor);let o=cu.getPropertiesInfo(i,null,e,this.info),h=cu.getPropertiesInfo(qn.emptyArray,t,e,this.info),f=cu.adaptOrderBy(t,this.info),d=t&&t.limit;return this._client.connect().then(()=>Oh.getForSelect(this._client,this.info,r,o,h,f)).then(p=>{let E=Vn.getSelect(p,this.info.keyspace,o,h,f,d),x=Vn.selectParamsGetter(o,d),g=this;return a.executor=c(function(A,T,I){return g._executeSelect(E,x,A,T,I,a)},"selectExecutor"),a.executor})}getSelectAllExecutor(e){let t=Sh.getSelectAllKey(e),r=this._cache.selectAll.getOrCreate(t,()=>({executor:null,resultAdapter:null}));if(r.executor!==null)return r.executor;let i=cu.getPropertiesInfo(qn.emptyArray,e,qn.emptyObject,this.info),s=cu.adaptOrderBy(e,this.info),a=e&&e.limit,o=Oh.getForSelectAll(this.info),h=Vn.getSelect(o,this.info.keyspace,qn.emptyArray,i,s,a),f=Vn.selectParamsGetter(qn.emptyArray,a),d=this;return r.executor=c(function(E,x){return d._executeSelect(h,f,null,E,x,r)},"selectAllExecutor"),r.executor}_executeSelect(e,t,r,i,s,a){let o=cu.adaptAllOptions(s,!0);return this._client.execute(e,t(r,i,this.info),o).then(h=>(a.resultAdapter===null&&(a.resultAdapter=ay.getSelectAdapter(this.info,h)),new oy(h,this.info,a.resultAdapter)))}getInsertExecutor(e,t){let r=Object.keys(e);if(r.length===0)return Promise.reject(new Error("Expected object with keys"));let i=Sh.getInsertKey(r,t),s=this._cache.insert.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createInsertQueries(r,e,t).then(a=>a.length===1?this._setSingleExecutor(s,a[0]):this._setBatchExecutor(s,a))}createInsertQueries(e,t,r){let i=cu.getPropertiesInfo(e,r,t,this.info),s=r&&r.ifNotExists;return this._client.connect().then(()=>Oh.getForInsert(this._client,this.info,i)).then(a=>{if(a.length>1&&s)throw new Error("Batch with ifNotExists conditions cannot span multiple tables");return a.map(o=>Vn.getInsert(o,this.info.keyspace,i,r,s))})}getUpdateExecutor(e,t){let r=Object.keys(e);if(r.length===0)return Promise.reject(new Error("Expected object with keys"));let i=Sh.getUpdateKey(r,e,t),s=this._cache.update.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createUpdateQueries(r,e,t).then(a=>a.length===1?this._setSingleExecutor(s,a[0]):this._setBatchExecutor(s,a))}createUpdateQueries(e,t,r){let i=cu.getPropertiesInfo(e,r,t,this.info),s=r&&r.ifExists,a=r&&r.when?cu.getPropertiesInfo(Object.keys(r.when),null,r.when,this.info):qn.emptyArray;if(a.length>0&&s)throw new Error("Both when and ifExists conditions can not be applied to the same statement");return this._client.connect().then(()=>Oh.getForUpdate(this._client,this.info,i,a)).then(o=>{if(o.length>1&&(a.length>0||s))throw new Error("Batch with when or ifExists conditions cannot span multiple tables");return o.map(h=>Vn.getUpdate(h,this.info.keyspace,i,r,a,s))})}getDeleteExecutor(e,t){let r=Object.keys(e);if(r.length===0)return Promise.reject(new Error("Expected object with keys"));let i=Sh.getRemoveKey(r,e,t),s=this._cache.remove.getOrCreate(i,()=>({executor:null}));return s.executor!==null?Promise.resolve(s.executor):this.createDeleteQueries(r,e,t).then(a=>a.length===1?this._setSingleExecutor(s,a[0]):this._setBatchExecutor(s,a))}createDeleteQueries(e,t,r){let i=cu.getPropertiesInfo(e,r,t,this.info),s=r&&r.ifExists,a=r&&r.when?cu.getPropertiesInfo(Object.keys(r.when),null,r.when,this.info):qn.emptyArray;if(a.length>0&&s)throw new Error("Both when and ifExists conditions can not be applied to the same statement");return this._client.connect().then(()=>Oh.getForDelete(this._client,this.info,i,a)).then(o=>{if(o.length>1&&(a.length>0||s))throw new Error("Batch with when or ifExists conditions cannot span multiple tables");return o.map(h=>Vn.getDelete(h,this.info.keyspace,i,r,a,s))})}getExecutorFromQuery(e,t,r){let i=this,s=r?cu.adaptAllOptions(r):null;return c(function(o,h){let f=s||cu.adaptAllOptions(h);return i._client.execute(e,t(o),f).then(d=>{let p=i._cache.customQueries.get(e);if(p===void 0){let E=ay.getCustomQueryAdapter(i.info,d);p=E.fn,E.canCache&&(i._cache.customQueries.set(e,p),i._cache.customQueries.size===cy&&i._client.log("warning",`Custom queries cache reached ${cy} items, this could be caused by hard-coding parameter values inside the query, which should be avoided`))}return new oy(d,i.info,p)})},"queryMappedExecutor")}_setSingleExecutor(e,t){let r=this;return e.executor=c(function(s,a,o){let h=cu.adaptOptions(o,t.isIdempotent);return r._client.execute(t.query,t.paramsGetter(s,a,r.info),h).then(f=>new oy(f,r.info,ay.getMutationAdapter(f)))},"singleExecutor"),e.executor}_setBatchExecutor(e,t){let r=this,i=t.reduce((s,a)=>s&&a.isIdempotent,!0);return e.executor=c(function(a,o,h){let f=t.map(p=>({query:p.query,params:p.paramsGetter(a,o,r.info)})),d=cu.adaptOptions(h,i);return r._client.batch(f,d).then(p=>new oy(p,r.info,ay.getMutationAdapter(p)))},"batchExecutor"),e.executor}_validateCacheLength(e){e===cy&&this._client.log("warning",`ModelMapper cache reached ${cy} items, this could be caused by building the object to map in different ways (with different shapes) each time. Use the same or few object structures for a model and represent unset values with undefined or types.unset`)}};c(a_,"MappingHandler");var n_=a_;fN.exports=n_});var d_=w(ly=>{"use strict";var l_=class l_{newObjectInstance(){return{}}getColumnName(e){return e}getPropertyName(e){return e}};c(l_,"TableMappings");var Nh=l_,h_=class h_ extends Nh{constructor(){super()}getColumnName(e){return e.replace(/[a-z][A-Z]/g,(t,r)=>t.charAt(0)+"_"+t.charAt(1)).toLowerCase()}getPropertyName(e){return e.replace(/_[a-z]/g,(t,r)=>r===0?t:t.substr(1).toUpperCase())}};c(h_,"UnderscoreCqlToCamelCaseMappings");var o_=h_,f_=class f_ extends Nh{constructor(){super()}getColumnName(e){return super.getColumnName(e)}getPropertyName(e){return super.getPropertyName(e)}newObjectInstance(){return super.newObjectInstance()}};c(f_,"DefaultTableMappings");var c_=f_;ly.TableMappings=Nh;ly.UnderscoreCqlToCamelCaseMappings=o_;ly.DefaultTableMappings=c_});var EN=w((vl0,gN)=>{"use strict";var yN=d_(),Bj=yN.TableMappings,pN=yN.DefaultTableMappings,Gn=class Gn{constructor(e,t,r,i){this.keyspace=e,this.tables=t,this._mappings=r,this._columns=i,this._documentProperties=new Map;for(let s of i.values())this._documentProperties.set(s.propertyName,s)}getColumnName(e){let t=this._documentProperties.get(e);return t!==void 0?t.columnName:this._mappings.getColumnName(e)}getPropertyName(e){let t=this._columns.get(e);return t!==void 0?t.propertyName:this._mappings.getPropertyName(e)}getFromModelFn(e){let t=this._documentProperties.get(e);return t!==void 0?t.fromModel:null}getToModelFn(e){let t=this._columns.get(e);return t!==void 0?t.toModel:null}newInstance(){return this._mappings.newObjectInstance()}static parse(e,t){let r=new Map;return!e||!e.models||Object.keys(e.models).forEach(i=>{let s=e.models[i];r.set(i,Gn._create(i,t,s))}),r}static _create(e,t,r){if(!t&&(!r||!r.keyspace))throw new Error("You should specify the keyspace of the model in the MappingOptions when the Client is not using a keyspace");if(!r)return Gn.createDefault(e,t);let i;if(r.tables&&r.tables.length>0?i=r.tables.map(a=>{let o={name:null,isView:!1};if(typeof a=="string"?o.name=a:a&&(o.name=a.name,o.isView=!!a.isView),!o.name)throw new Error(`Table name not specified for model '${e}'`);return o}):i=[{name:e,isView:!1}],r.mappings&&!(r.mappings instanceof Bj))throw new Error("mappings should be an instance of TableMappings");let s=new Map;return r.columns!==null&&typeof r.columns=="object"&&Object.keys(r.columns).forEach(a=>{s.set(a,y_.parse(a,r.columns[a]))}),new Gn(r.keyspace||t,i,r.mappings||new pN,s)}static createDefault(e,t){return new Gn(t,[{name:e,isView:!1}],new pN,new Map)}};c(Gn,"ModelMappingInfo");var p_=Gn,Ko=class Ko{constructor(e,t,r,i){if(this.columnName=e,this.propertyName=t,r&&typeof r!="function")throw new TypeError(`toModel type for property '${t}' should be a function (obtained ${typeof r})`);if(i&&typeof i!="function")throw new TypeError(`fromModel type for property '${t}' should be a function (obtained ${typeof i})`);this.toModel=r,this.fromModel=i}static parse(e,t){return t?typeof t=="string"?new Ko(e,t):new Ko(e,t.name||e,t.toModel,t.fromModel):new Ko(e,e)}};c(Ko,"ModelColumnInfo");var y_=Ko;gN.exports=p_});var TN=w((Ll0,xN)=>{"use strict";var Dj=zb(),Fj=dN(),Mj=s_(),Hj=ce(),qj=ny(),Vj=Zb(),mN=EN(),{ModelBatchItem:Gj}=ry(),E_=class E_{constructor(e,t){if(!e)throw new Error("client must be defined");this.client=e,this._modelMappingInfos=mN.parse(t,e.keyspace),this._modelMappers=new Map}forModel(e){let t=this._modelMappers.get(e);if(t===void 0){let r=this._modelMappingInfos.get(e);if(r===void 0){if(!this.client.keyspace)throw new Error(`No mapping information found for model '${e}'. Mapper is unable to create default mappings without setting the keyspace`);r=mN.createDefault(e,this.client.keyspace),this.client.log("info",`Mapping information for model '${e}' not found, creating default mapping. Keyspace: ${r.keyspace}; Table: ${r.tables[0].name}.`)}else this.client.log("info",`Creating model mapper for '${e}' using mapping information. Keyspace: ${r.keyspace}; Table${r.tables.length>1?"s":""}: ${r.tables.map(i=>i.name)}.`);t=new Dj(e,new Fj(this.client,r)),this._modelMappers.set(e,t)}return t}batch(e,t){if(!Array.isArray(e)||!(e.length>0))return Promise.reject(new Hj.ArgumentError("First parameter items should be an Array with 1 or more ModelBatchItem instances"));let r=[],i=!0,s;return Promise.all(e.map(a=>a instanceof Gj?a.pushQueries(r).then(o=>{i=i&&o.isIdempotent,s=o.isCounter}):Promise.reject(new Error("Batch items must be instances of ModelBatchItem, use modelMapper.batching object to create each item")))).then(()=>this.client.batch(r,Mj.adaptBatchOptions(t,i,s))).then(a=>{let o=e[0].getMappingInfo();return new qj(a,o,Vj.getMutationAdapter(a))})}};c(E_,"Mapper");var g_=E_;xN.exports=g_});var bN=w(ci=>{"use strict";ci.Mapper=TN();ci.ModelMapper=zb();ci.ModelBatchMapper=Vb();ci.ModelBatchItem=ry().ModelBatchItem;ci.Result=ny();var m_=d_();ci.TableMappings=m_.TableMappings;ci.DefaultTableMappings=m_.DefaultTableMappings;ci.UnderscoreCqlToCamelCaseMappings=m_.UnderscoreCqlToCamelCaseMappings;ci.q=uy().q});var CN=w(T_=>{"use strict";var{Stream:Wj}=require("stream"),_N=f0();function zj(u,e,t,r){if(!u)throw new TypeError("Client instance is not defined");if(typeof e=="string"){if(Array.isArray(t))return new hy(u,e,t,r).execute();if(t instanceof Wj)return new x_(u,e,t,r).execute();throw new TypeError("parameters should be an Array or a Stream instance")}if(Array.isArray(e))return r=t,new hy(u,null,e,r).execute();throw new TypeError("A string query or query and parameters array should be provided")}c(zj,"executeConcurrent");var b_=class b_{constructor(e,t,r,i){this._client=e,this._query=t,this._parameters=r,i=i||_N.emptyObject,this._raiseOnFirstError=i.raiseOnFirstError!==!1,this._concurrencyLevel=Math.min(i.concurrencyLevel||100,this._parameters.length),this._queryOptions={prepare:!0,executionProfile:i.executionProfile},this._result=new Uh(i),this._stop=!1}execute(){let e=new Array(this._concurrencyLevel);for(let t=0;tthis._result)}_executeOneAtATime(e,t){let r=e+this._concurrencyLevel*t;if(r>=this._parameters.length||this._stop)return Promise.resolve();let i=this._parameters[r],s,a;return this._query===null?(s=i.query,a=i.params):(s=this._query,a=i),this._client.execute(s,a,this._queryOptions).then(o=>this._result.setResultItem(r,o)).catch(o=>this._setError(r,o)).then(()=>this._executeOneAtATime(e,t+1))}_setError(e,t){if(this._result.setError(e,t),this._raiseOnFirstError)throw this._stop=!0,t}};c(b_,"ArrayBasedExecutor");var hy=b_,__=class __{constructor(e,t,r,i){this._client=e,this._query=t,this._stream=r,i=i||_N.emptyObject,this._raiseOnFirstError=i.raiseOnFirstError!==!1,this._concurrencyLevel=i.concurrencyLevel||100,this._queryOptions={prepare:!0,executionProfile:i.executionProfile},this._inFlight=0,this._index=0,this._result=new Uh(i),this._resolveCallback=null,this._rejectCallback=null,this._readEnded=!1}execute(){return new Promise((e,t)=>{this._resolveCallback=e,this._rejectCallback=t,this._stream.on("data",r=>this._executeOne(r)).on("error",r=>this._setReadEnded(r)).on("end",()=>this._setReadEnded())})}_executeOne(e){if(!Array.isArray(e))return this._setReadEnded(new TypeError("Stream should be in objectMode and should emit Array instances"));if(this._readEnded)return;let t=this._index++;this._inFlight++,this._client.execute(this._query,e,this._queryOptions).then(r=>{this._result.setResultItem(t,r),this._inFlight--}).catch(r=>{this._inFlight--,this._setError(t,r)}).then(()=>{this._stream.isPaused()&&this._stream.resume(),this._readEnded&&this._inFlight===0&&this._resolveCallback(this._result)}),this._inFlight>=this._concurrencyLevel&&this._stream.pause()}_setReadEnded(e){this._readEnded||(this._readEnded=!0,e?this._rejectCallback(e):this._inFlight===0&&this._resolveCallback(this._result))}_setError(e,t){this._result.setError(e,t),this._raiseOnFirstError&&(this._readEnded=!0,this._rejectCallback(t))}};c(__,"StreamBasedExecutor");var x_=__,C_=class C_{constructor(e){this._collectResults=e.collectResults,this._maxErrors=e.maxErrors||100,this.totalExecuted=0,this.errors=[],this._collectResults?this.resultItems=[]:Object.defineProperty(this,"resultItems",{enumerable:!1,get:()=>{throw new Error("Property resultItems can not be accessed when collectResults is set to false")}})}setResultItem(e,t){this.totalExecuted++,this._collectResults&&(this.resultItems[e]=t)}setError(e,t){this.totalExecuted++,this.errors.length{"use strict";R_.graph=TT();R_.search=nx()});var fy=w(it=>{"use strict";var Yj=Ml();it.Client=WO();it.ExecutionProfile=gm().ExecutionProfile;it.ExecutionOptions=gs().ExecutionOptions;it.types=re();it.errors=ce();it.policies=j1();it.auth=th();it.mapping=bN();it.tracker=GE();it.metrics=$E();it.concurrent=CN();var AN=nh();it.token={Token:AN.Token,TokenRange:AN.TokenRange};var Qj=u5();it.metadata={Metadata:Qj};it.Encoder=h3();it.geometry=o3();it.datastax=RN();it.defaultOptions=function(){return Yj.defaultOptions()};it.version=ho().version});var wN=w((kl0,jj)=>{jj.exports={model:{modelName:"New model",dbVersion:"3.x",dbVendor:"Cassandra"},container:{name:"New keyspace",indexes:[],replStrategy:"SimpleStrategy",addToCqlScript:!0},collection:{collectionName:"New table",collectionUsers:[],collation:{},tableOptions:{}},field:{name:"New column",subtype:{valueDependencies:[{value:"object",dependency:{key:"type",value:"jsonObject"}},{value:"array",dependency:{key:"type",value:"jsonArray"}}]}},patternField:{name:"^[a-zA-Z0-9_.-]+$"},multipleField:{primaryKey:!1},subschema:{},arrayItem:{},choice:{},relationship:{},user:{},view:{viewOn:""},UDFs:{name:"New UDF",udfID:"",udfDescription:"",udfFunction:"",udfComments:""},UDAs:{name:"New UDA",udfID:"",udfDescription:"",udfFunction:"",udfComments:""},SecIndxs:{name:"New Index",indexType:"Secondary",SecIndxKey:"",SecIndxID:"",SecIndxDescription:"",SecIndxFunction:"",SecIndxComments:""}}});var LN=w((Bl0,IN)=>{"use strict";var vN=fy().types,$j=wN(),Zj={numeric:"num",char:"str",timestamp:"ts",reference:"udt"},Xj=$j.field.name;IN.exports=u=>{let e=c((L,N,k)=>{let X=vN.getDataTypeNameByCode(L.type||L).split("<")[0];return N&&X==="udt"?(N.push({udt:L,sample:k}),t(L)):r(X,L,k,N)},"getColumnType"),t=c(L=>{let N=u.get(L,"type.info.name",u.get(L,"info.name",L.name));return{type:"reference",$ref:`#/definitions/${N}`,refName:N}},"getRef"),r=c((L,N,k,M)=>{let X=h(L);return L==="map"?i(X,N,k,M):L==="tuple"?s(X,N,k,M):L==="set"||L==="list"?a(X,N,k,M):L==="custom"&&I(N)?o(X,N,k,M):X},"getType"),i=c((L,N,k,M)=>{let X=(N.info||N.type.info)[0],u0=(N.info||N.type.info)[1],h0=e(X),i0=E({valueData:u0,sample:k,udtHash:M}),H=h0.mode?{keySubtype:h0.mode}:{},L0=h0.type,V=T(i0),v=f(L.type,V);return Object.assign({},L,H,{keyType:L0,subtype:v,properties:i0})},"handleMap"),s=c((L,N,k,M)=>{k=Array.isArray(k)?k:[];let X=(N.info||N.type.info).map(u0=>{let h0=k.find(H=>g(H,u0));return e(u0,M,h0)});return Object.assign({},L,{items:X})},"handleTuple"),a=c((L,N,k,M)=>{let X=N.info||N.type.info,u0=m(X,k,M),h0=(u0[0]||{type:"text"}).type,i0=f(L.type,h0);return Object.assign({},L,{items:u.uniqWith(u0,u.isEqual),subtype:i0})},"handleList"),o=c((L,N,k,M)=>{let X=N.info||N.type.info,u0=X.dimensions,h0=m(X.subtype,k,M),i0=u.uniqWith(h0,u.isEqual),H=(i0[0]||{mode:"float"}).mode;return{...L,dimension:u0,subtype:H,items:i0}},"handleVector"),h=c(L=>{switch(L){case"int":return{type:"numeric",mode:"integer"};case"smallint":case"tinyint":case"bigint":case"counter":case"decimal":case"double":case"float":case"varint":return{type:"numeric",mode:L};case"text":case"varchar":case"ascii":case"inet":return{type:"char",mode:L};case"boolean":return{type:"bool"};case"timestamp":case"timeuuid":case"blob":case"date":case"time":case"uuid":return{type:L};case"tuple":case"list":case"set":case"map":return{type:L};default:return{type:"char"}}},"getAppType"),f=c((L,N)=>`${L}<${Zj[N]||N}>`,"getSubType"),d=c((L,N,k)=>!N||typeof N!="object"?p(L,k):Object.keys(N).reduce((M,X)=>Object.assign({},M,{[X]:e(L,k,N[X])}),{}),"getProperties"),p=c((L,N)=>{let k=e(L,N);return{[k.refName||Xj]:u.omit(k,"refName")}},"getDefaultProperties"),E=c(({valueData:L,sample:N,udtHash:k})=>{let M=d(L,N,k),X=Object.entries(M),u0=u.uniqWith(X,([,h0],[,i0])=>h0.type===i0.type&&h0.$ref===i0.$ref&&h0.mode===i0.mode);return Object.fromEntries(u0)},"getMapProperties"),x=c(L=>{switch(L){case"smallint":case"tinyint":case"int":case"bigint":case"counter":case"decimal":case"double":case"float":case"varint":return"number";case"text":case"varchar":case"ascii":case"inet":case"timestamp":case"timeuuid":case"blob":case"date":case"time":case"uuid":return"string";case"boolean":return"boolean";case"tuple":case"list":case"set":return"array";case"map":return"object";default:return"string"}},"getJsonType"),g=c((L,N)=>{let M=vN.getDataTypeNameByCode(N.type||N).split("<")[0],X=x(M);return X==="array"?Array.isArray(L):X==="array"?Object(L)===L:typeof L===X},"isTypeEqual"),m=c((L,N,k)=>!Array.isArray(N)||N.length===0?A(L,k):N.map(M=>e(L,k,M)),"getItems"),A=c((L,N)=>[e(L,N)],"getDefaultItems"),T=c(L=>{let N=Object.keys(L).pop(),k=(L[N]||{}).type;return k||"text"},"getChildTypeByProperties"),I=c(L=>{let N=L.info||L.type.info,k=N==null?void 0:N.dimensions;return!isNaN(+k)},"isVector");return{getColumnType:e}}});var PN=w((Fl0,UN)=>{"use strict";var SN="compaction",KN="compression",ON="caching",Jj=[ON,SN,KN],NN=c(u=>String(u||"").replace(/[\"\`]/g,"'"),"changeQuotes"),e$=c((u,e)=>{switch(u){case SN:return u$(e);case ON:return r$(e);case KN:return t$(e);default:return null}},"handleSpecialOption"),t$=c(u=>{let{compression:e}=u;return NN(JSON.stringify(e))},"handleCompressionOption"),u$=c(u=>{let{compactionClass:e,compactionOptions:t}=u,r=Object.assign({},{class:e},t);return NN(JSON.stringify(r))},"handleCompactionOption"),r$=c(u=>{let e=JSON.parse(u.caching);return{keys:e.keys,rowsPerPartition:e.rows_per_partition}},"handleCashingOption"),i$=c(u=>(e,t)=>{let r=t.propertyKeyword;if(Jj.includes(r)){let i=e$(r,u);return Object.assign({},e,{[r]:i})}return u.hasOwnProperty(r)?Object.assign({},e,{[r]:u[r]}):e},"generateTableOptionsReducer");UN.exports={createTableOptionsFromMeta(u,e){return e.reduce(i$(u),{})}}});var DN=w((Hl0,BN)=>{"use strict";var kN=require("fs"),Ph=require("path"),A_=c(u=>{try{let e=kN.readFileSync(Ph.join(__dirname,"..",u));return JSON.parse(e.toString().replace(/\/\*[\s\S]*?\*\//g,""))}catch{return{}}},"getConfig"),w_=c(u=>{let e;return(...t)=>(e||(e=u(...t)),e)},"cacheResult"),s$=w_(()=>A_(Ph.join("properties_pane","field_level","fieldLevelConfig.json"))),n$=w_(()=>A_(Ph.join("properties_pane","entity_level","entityLevelConfig.json"))),a$=w_(()=>{let u=c(r=>r.replace(/\.json/,""),"getName"),e=Ph.join(__dirname,"..","types");return kN.readdirSync(e).reduce((r,i)=>(r[u(i)]=A_(Ph.join("types",i)),r),{})});BN.exports={getEntityLevelConfig:n$,getFieldLevelConfig:s$,getTypesConfig:a$}});var HN=w((Vl0,MN)=>{"use strict";var FN=fy(),I_=class I_ extends FN.policies.retry.RetryPolicy{constructor(e){super(),this.hackoladeLogger=e}onReadTimeout(e,t,r,i,s){let o=e.nbRetry;return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Read timeout",respondedNodes:r,needNodesForSuccess:i,query:e.query,nbRetry:e.nbRetry,isLastTry:o>2},"Retry policy info"),o>2?this.rethrowResult():this.retryResult(FN.types.consistencies.one)}onUnavailable(e,t,r,i,s){return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Unavailable",query:e.query,nbRetry:e.nbRetry,isLastTry:e.nbRetry>0},"Retry policy info"),e.nbRetry>0?this.rethrowResult():this.retryResult(void 0,!1)}onRequestError=function(e,t,r){return this.hackoladeLogger&&this.hackoladeLogger.log("info",{exception:"Request error",query:e.query,nbRetry:e.nbRetry,error:{...r}},"Retry policy info"),this.retryResult(void 0,!1)}};c(I_,"CassandraRetryPolicy");var v_=I_;MN.exports=v_});var dy=w(Mi=>{"use strict";var qN=":A-Za-z_\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u02FF\\u0370-\\u037D\\u037F-\\u1FFF\\u200C-\\u200D\\u2070-\\u218F\\u2C00-\\u2FEF\\u3001-\\uD7FF\\uF900-\\uFDCF\\uFDF0-\\uFFFD",o$=qN+"\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040",VN="["+qN+"]["+o$+"]*",c$=new RegExp("^"+VN+"$"),l$=c(function(u,e){let t=[],r=e.exec(u);for(;r;){let i=[];i.startIndex=e.lastIndex-r[0].length;let s=r.length;for(let a=0;a"u")},"isName");Mi.isExist=function(u){return typeof u<"u"};Mi.isEmptyObject=function(u){return Object.keys(u).length===0};Mi.merge=function(u,e,t){if(e){let r=Object.keys(e),i=r.length;for(let s=0;s{"use strict";var L_=dy(),f$={allowBooleanAttributes:!1,unpairedTags:[]};QN.validate=function(u,e){e=Object.assign({},f$,e);let t=[],r=!1,i=!1;u[0]==="\uFEFF"&&(u=u.substr(1));for(let s=0;s"&&u[s]!==" "&&u[s]!==" "&&u[s]!==` +`&&u[s]!=="\r";s++)h+=u[s];if(h=h.trim(),h[h.length-1]==="/"&&(h=h.substring(0,h.length-1),s--),!T$(h)){let p;return h.trim().length===0?p="Invalid space after '<'.":p="Tag '"+h+"' is an invalid name.",Ge("InvalidTag",p,lu(u,s))}let f=y$(u,s);if(f===!1)return Ge("InvalidAttr","Attributes for '"+h+"' have open quote.",lu(u,s));let d=f.value;if(s=f.index,d[d.length-1]==="/"){let p=s-d.length;d=d.substring(0,d.length-1);let E=YN(d,e);if(E===!0)r=!0;else return Ge(E.err.code,E.err.msg,lu(u,p+E.err.line))}else if(o)if(f.tagClosed){if(d.trim().length>0)return Ge("InvalidTag","Closing tag '"+h+"' can't have attributes or invalid starting.",lu(u,a));if(t.length===0)return Ge("InvalidTag","Closing tag '"+h+"' has not been opened.",lu(u,a));{let p=t.pop();if(h!==p.tagName){let E=lu(u,p.tagStartPos);return Ge("InvalidTag","Expected closing tag '"+p.tagName+"' (opened in line "+E.line+", col "+E.col+") instead of closing tag '"+h+"'.",lu(u,a))}t.length==0&&(i=!0)}}else return Ge("InvalidTag","Closing tag '"+h+"' doesn't have proper closing.",lu(u,s));else{let p=YN(d,e);if(p!==!0)return Ge(p.err.code,p.err.msg,lu(u,s-d.length+p.err.line));if(i===!0)return Ge("InvalidXml","Multiple possible root nodes found.",lu(u,s));e.unpairedTags.indexOf(h)!==-1||t.push({tagName:h,tagStartPos:a}),r=!0}for(s++;s0)return Ge("InvalidXml","Invalid '"+JSON.stringify(t.map(s=>s.tagName),null,4).replace(/\r?\n/g,"")+"' found.",{line:1,col:1})}else return Ge("InvalidXml","Start tag expected.",1);return!0};function GN(u){return u===" "||u===" "||u===` +`||u==="\r"}c(GN,"isWhiteSpace");function WN(u,e){let t=e;for(;e5&&r==="xml")return Ge("InvalidXml","XML declaration allowed only at the start of the document.",lu(u,e));if(u[e]=="?"&&u[e+1]==">"){e++;break}else continue}return e}c(WN,"readPI");function zN(u,e){if(u.length>e+5&&u[e+1]==="-"&&u[e+2]==="-"){for(e+=3;e"){e+=2;break}}else if(u.length>e+8&&u[e+1]==="D"&&u[e+2]==="O"&&u[e+3]==="C"&&u[e+4]==="T"&&u[e+5]==="Y"&&u[e+6]==="P"&&u[e+7]==="E"){let t=1;for(e+=8;e"&&(t--,t===0))break}else if(u.length>e+9&&u[e+1]==="["&&u[e+2]==="C"&&u[e+3]==="D"&&u[e+4]==="A"&&u[e+5]==="T"&&u[e+6]==="A"&&u[e+7]==="["){for(e+=8;e"){e+=2;break}}return e}c(zN,"readCommentAndCDATA");var d$='"',p$="'";function y$(u,e){let t="",r="",i=!1;for(;e"&&r===""){i=!0;break}t+=u[e]}return r!==""?!1:{value:t,index:e,tagClosed:i}}c(y$,"readAttributeStr");var g$=new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`,"g");function YN(u,e){let t=L_.getAllMatches(u,g$),r={};for(let i=0;i{var jN={preserveOrder:!1,attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,removeNSPrefix:!1,allowBooleanAttributes:!1,parseTagValue:!0,parseAttributeValue:!1,trimValues:!0,cdataPropName:!1,numberParseOptions:{hex:!0,leadingZeros:!0,eNotation:!0},tagValueProcessor:function(u,e){return e},attributeValueProcessor:function(u,e){return e},stopNodes:[],alwaysCreateTextNode:!1,isArray:()=>!1,commentPropName:!1,unpairedTags:[],processEntities:!0,htmlEntities:!1,ignoreDeclaration:!1,ignorePiTags:!1,transformTagName:!1,transformAttributeName:!1,updateTag:function(u,e,t){return u}},b$=c(function(u){return Object.assign({},jN,u)},"buildOptions");K_.buildOptions=b$;K_.defaultOptions=jN});var XN=w((Zl0,ZN)=>{"use strict";var N_=class N_{constructor(e){this.tagname=e,this.child=[],this[":@"]={}}add(e,t){e==="__proto__"&&(e="#__proto__"),this.child.push({[e]:t})}addChild(e){e.tagname==="__proto__"&&(e.tagname="#__proto__"),e[":@"]&&Object.keys(e[":@"]).length>0?this.child.push({[e.tagname]:e.child,":@":e[":@"]}):this.child.push({[e.tagname]:e.child})}};c(N_,"XmlNode");var O_=N_;ZN.exports=O_});var eU=w((Jl0,JN)=>{var _$=dy();function C$(u,e){let t={};if(u[e+3]==="O"&&u[e+4]==="C"&&u[e+5]==="T"&&u[e+6]==="Y"&&u[e+7]==="P"&&u[e+8]==="E"){e=e+9;let r=1,i=!1,s=!1,a="";for(;e"){if(s?u[e-1]==="-"&&u[e-2]==="-"&&(s=!1,r--):r--,r===0)break}else u[e]==="["?i=!0:a+=u[e];if(r!==0)throw new Error("Unclosed DOCTYPE")}else throw new Error("Invalid Tag instead of DOCTYPE");return{entities:t,i:e}}c(C$,"readDocType");function R$(u,e){let t="";for(;e{var K$=/^[-+]?0x[a-fA-F0-9]+$/,O$=/^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;!Number.parseInt&&window.parseInt&&(Number.parseInt=window.parseInt);!Number.parseFloat&&window.parseFloat&&(Number.parseFloat=window.parseFloat);var N$={hex:!0,leadingZeros:!0,decimalPoint:".",eNotation:!0};function U$(u,e={}){if(e=Object.assign({},N$,e),!u||typeof u!="string")return u;let t=u.trim();if(e.skipLike!==void 0&&e.skipLike.test(t))return u;if(e.hex&&K$.test(t))return Number.parseInt(t,16);{let r=O$.exec(t);if(r){let i=r[1],s=r[2],a=P$(r[3]),o=r[4]||r[6];if(!e.leadingZeros&&s.length>0&&i&&t[2]!==".")return u;if(!e.leadingZeros&&s.length>0&&!i&&t[1]!==".")return u;{let h=Number(t),f=""+h;return f.search(/[eE]/)!==-1||o?e.eNotation?h:u:t.indexOf(".")!==-1?f==="0"&&a===""||f===a||i&&f==="-"+a?h:u:s?a===f||i+a===f?h:u:t===f||t===i+f?h:u}}else return u}}c(U$,"toNumber");function P$(u){return u&&u.indexOf(".")!==-1&&(u=u.replace(/0+$/,""),u==="."?u="0":u[0]==="."?u="0"+u:u[u.length-1]==="."&&(u=u.substr(0,u.length-1))),u}c(P$,"trimZeros");tU.exports=U$});var sU=w((rh0,iU)=>{"use strict";var rU=dy(),Bh=XN(),k$=eU(),B$=uU(),B_=class B_{constructor(e){this.options=e,this.currentNode=null,this.tagsNodeStack=[],this.docTypeEntities={},this.lastEntities={apos:{regex:/&(apos|#39|#x27);/g,val:"'"},gt:{regex:/&(gt|#62|#x3E);/g,val:">"},lt:{regex:/&(lt|#60|#x3C);/g,val:"<"},quot:{regex:/&(quot|#34|#x22);/g,val:'"'}},this.ampEntity={regex:/&(amp|#38|#x26);/g,val:"&"},this.htmlEntities={space:{regex:/&(nbsp|#160);/g,val:" "},cent:{regex:/&(cent|#162);/g,val:"\xA2"},pound:{regex:/&(pound|#163);/g,val:"\xA3"},yen:{regex:/&(yen|#165);/g,val:"\xA5"},euro:{regex:/&(euro|#8364);/g,val:"\u20AC"},copyright:{regex:/&(copy|#169);/g,val:"\xA9"},reg:{regex:/&(reg|#174);/g,val:"\xAE"},inr:{regex:/&(inr|#8377);/g,val:"\u20B9"},num_dec:{regex:/&#([0-9]{1,7});/g,val:(t,r)=>String.fromCharCode(Number.parseInt(r,10))},num_hex:{regex:/&#x([0-9a-fA-F]{1,6});/g,val:(t,r)=>String.fromCharCode(Number.parseInt(r,16))}},this.addExternalEntities=D$,this.parseXml=V$,this.parseTextData=F$,this.resolveNameSpace=M$,this.buildAttributesMap=q$,this.isItStopNode=Y$,this.replaceEntitiesValue=W$,this.readStopNodeData=j$,this.saveTextToParentTag=z$,this.addChild=G$}};c(B_,"OrderedObjParser");var U_=B_;function D$(u){let e=Object.keys(u);for(let t=0;t0)){a||(u=this.replaceEntitiesValue(u));let o=this.options.tagValueProcessor(e,u,t,i,s);return o==null?u:typeof o!=typeof u||o!==u?o:this.options.trimValues?k_(u,this.options.parseTagValue,this.options.numberParseOptions):u.trim()===u?k_(u,this.options.parseTagValue,this.options.numberParseOptions):u}}c(F$,"parseTextData");function M$(u){if(this.options.removeNSPrefix){let e=u.split(":"),t=u.charAt(0)==="/"?"/":"";if(e[0]==="xmlns")return"";e.length===2&&(u=t+e[1])}return u}c(M$,"resolveNameSpace");var H$=new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`,"gm");function q$(u,e,t){if(!this.options.ignoreAttributes&&typeof u=="string"){let r=rU.getAllMatches(u,H$),i=r.length,s={};for(let a=0;a",s,"Closing Tag is not closed."),h=u.substring(s+2,o).trim();if(this.options.removeNSPrefix){let p=h.indexOf(":");p!==-1&&(h=h.substr(p+1))}this.options.transformTagName&&(h=this.options.transformTagName(h)),t&&(r=this.saveTextToParentTag(r,t,i));let f=i.substring(i.lastIndexOf(".")+1);if(h&&this.options.unpairedTags.indexOf(h)!==-1)throw new Error(`Unpaired tag can not be used as closing tag: `);let d=0;f&&this.options.unpairedTags.indexOf(f)!==-1?(d=i.lastIndexOf(".",i.lastIndexOf(".")-1),this.tagsNodeStack.pop()):d=i.lastIndexOf("."),i=i.substring(0,d),t=this.tagsNodeStack.pop(),r="",s=o}else if(u[s+1]==="?"){let o=P_(u,s,!1,"?>");if(!o)throw new Error("Pi Tag is not closed.");if(r=this.saveTextToParentTag(r,t,i),!(this.options.ignoreDeclaration&&o.tagName==="?xml"||this.options.ignorePiTags)){let h=new Bh(o.tagName);h.add(this.options.textNodeName,""),o.tagName!==o.tagExp&&o.attrExpPresent&&(h[":@"]=this.buildAttributesMap(o.tagExp,i,o.tagName)),this.addChild(t,h,i)}s=o.closeIndex+1}else if(u.substr(s+1,3)==="!--"){let o=Wn(u,"-->",s+4,"Comment is not closed.");if(this.options.commentPropName){let h=u.substring(s+4,o-2);r=this.saveTextToParentTag(r,t,i),t.add(this.options.commentPropName,[{[this.options.textNodeName]:h}])}s=o}else if(u.substr(s+1,2)==="!D"){let o=k$(u,s);this.docTypeEntities=o.entities,s=o.i}else if(u.substr(s+1,2)==="!["){let o=Wn(u,"]]>",s,"CDATA is not closed.")-2,h=u.substring(s+9,o);r=this.saveTextToParentTag(r,t,i);let f=this.parseTextData(h,t.tagname,i,!0,!1,!0,!0);f==null&&(f=""),this.options.cdataPropName?t.add(this.options.cdataPropName,[{[this.options.textNodeName]:h}]):t.add(this.options.textNodeName,f),s=o+2}else{let o=P_(u,s,this.options.removeNSPrefix),h=o.tagName,f=o.rawTagName,d=o.tagExp,p=o.attrExpPresent,E=o.closeIndex;this.options.transformTagName&&(h=this.options.transformTagName(h)),t&&r&&t.tagname!=="!xml"&&(r=this.saveTextToParentTag(r,t,i,!1));let x=t;if(x&&this.options.unpairedTags.indexOf(x.tagname)!==-1&&(t=this.tagsNodeStack.pop(),i=i.substring(0,i.lastIndexOf("."))),h!==e.tagname&&(i+=i?"."+h:h),this.isItStopNode(this.options.stopNodes,i,h)){let g="";if(d.length>0&&d.lastIndexOf("/")===d.length-1)h[h.length-1]==="/"?(h=h.substr(0,h.length-1),i=i.substr(0,i.length-1),d=h):d=d.substr(0,d.length-1),s=o.closeIndex;else if(this.options.unpairedTags.indexOf(h)!==-1)s=o.closeIndex;else{let A=this.readStopNodeData(u,f,E+1);if(!A)throw new Error(`Unexpected end of ${f}`);s=A.i,g=A.tagContent}let m=new Bh(h);h!==d&&p&&(m[":@"]=this.buildAttributesMap(d,i,h)),g&&(g=this.parseTextData(g,h,i,!0,p,!0,!0)),i=i.substr(0,i.lastIndexOf(".")),m.add(this.options.textNodeName,g),this.addChild(t,m,i)}else{if(d.length>0&&d.lastIndexOf("/")===d.length-1){h[h.length-1]==="/"?(h=h.substr(0,h.length-1),i=i.substr(0,i.length-1),d=h):d=d.substr(0,d.length-1),this.options.transformTagName&&(h=this.options.transformTagName(h));let g=new Bh(h);h!==d&&p&&(g[":@"]=this.buildAttributesMap(d,i,h)),this.addChild(t,g,i),i=i.substr(0,i.lastIndexOf("."))}else{let g=new Bh(h);this.tagsNodeStack.push(t),h!==d&&p&&(g[":@"]=this.buildAttributesMap(d,i,h)),this.addChild(t,g,i),t=g}r="",s=E}}else r+=u[s];return e.child},"parseXml");function G$(u,e,t){let r=this.options.updateTag(e.tagname,t,e[":@"]);r===!1||(typeof r=="string"&&(e.tagname=r),u.addChild(e))}c(G$,"addChild");var W$=c(function(u){if(this.options.processEntities){for(let e in this.docTypeEntities){let t=this.docTypeEntities[e];u=u.replace(t.regx,t.val)}for(let e in this.lastEntities){let t=this.lastEntities[e];u=u.replace(t.regex,t.val)}if(this.options.htmlEntities)for(let e in this.htmlEntities){let t=this.htmlEntities[e];u=u.replace(t.regex,t.val)}u=u.replace(this.ampEntity.regex,this.ampEntity.val)}return u},"replaceEntitiesValue");function z$(u,e,t,r){return u&&(r===void 0&&(r=Object.keys(e.child).length===0),u=this.parseTextData(u,e.tagname,t,!1,e[":@"]?Object.keys(e[":@"]).length!==0:!1,r),u!==void 0&&u!==""&&e.add(this.options.textNodeName,u),u=""),u}c(z$,"saveTextToParentTag");function Y$(u,e,t){let r="*."+t;for(let i in u){let s=u[i];if(r===s||e===s)return!0}return!1}c(Y$,"isItStopNode");function Q$(u,e,t=">"){let r,i="";for(let s=e;s",t,`${e} is not closed`);if(u.substring(t+2,s).trim()===e&&(i--,i===0))return{tagContent:u.substring(r,t),i:s};t=s}else if(u[t+1]==="?")t=Wn(u,"?>",t+1,"StopNode is not closed.");else if(u.substr(t+1,3)==="!--")t=Wn(u,"-->",t+3,"StopNode is not closed.");else if(u.substr(t+1,2)==="![")t=Wn(u,"]]>",t,"StopNode is not closed.")-2;else{let s=P_(u,t,">");s&&((s&&s.tagName)===e&&s.tagExp[s.tagExp.length-1]!=="/"&&i++,t=s.closeIndex)}}c(j$,"readStopNodeData");function k_(u,e,t){if(e&&typeof u=="string"){let r=u.trim();return r==="true"?!0:r==="false"?!1:B$(u,t)}else return rU.isExist(u)?u:""}c(k_,"parseValue");iU.exports=U_});var oU=w(aU=>{"use strict";function $$(u,e){return nU(u,e)}c($$,"prettify");function nU(u,e,t){let r,i={};for(let s=0;s0&&(i[e.textNodeName]=r):r!==void 0&&(i[e.textNodeName]=r),i}c(nU,"compress");function Z$(u){let e=Object.keys(u);for(let t=0;t{var{buildOptions:eZ}=$N(),tZ=sU(),{prettify:uZ}=oU(),rZ=S_(),F_=class F_{constructor(e){this.externalEntities={},this.options=eZ(e)}parse(e,t){if(typeof e!="string")if(e.toString)e=e.toString();else throw new Error("XML data is accepted in String or Bytes[] form.");if(t){t===!0&&(t={});let s=rZ.validate(e,t);if(s!==!0)throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`)}let r=new tZ(this.options);r.addExternalEntities(this.externalEntities);let i=r.parseXml(e);return this.options.preserveOrder||i===void 0?i:uZ(i,this.options)}addEntity(e,t){if(t.indexOf("&")!==-1)throw new Error("Entity value can't have '&'");if(e.indexOf("&")!==-1||e.indexOf(";")!==-1)throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for ' '");if(t==="&")throw new Error("An entity with value '&' is not permitted");this.externalEntities[e]=t}};c(F_,"XMLParser");var D_=F_;cU.exports=D_});var yU=w((ch0,pU)=>{var iZ=` +`;function sZ(u,e){let t="";return e.format&&e.indentBy.length>0&&(t=iZ),fU(u,e,"",t)}c(sZ,"toXml");function fU(u,e,t,r){let i="",s=!1;for(let a=0;a`,s=!1;continue}else if(h===e.commentPropName){i+=r+``,s=!0;continue}else if(h[0]==="?"){let g=hU(o[":@"],e),m=h==="?xml"?"":r,A=o[h][0][e.textNodeName];A=A.length!==0?" "+A:"",i+=m+`<${h}${A}${g}?>`,s=!0;continue}let d=r;d!==""&&(d+=e.indentBy);let p=hU(o[":@"],e),E=r+`<${h}${p}`,x=fU(o[h],e,f,d);e.unpairedTags.indexOf(h)!==-1?e.suppressUnpairedNode?i+=E+">":i+=E+"/>":(!x||x.length===0)&&e.suppressEmptyNode?i+=E+"/>":x&&x.endsWith(">")?i+=E+`>${x}${r}`:(i+=E+">",x&&r!==""&&(x.includes("/>")||x.includes("`),s=!0}return i}c(fU,"arrToStr");function nZ(u){let e=Object.keys(u);for(let t=0;t0&&e.processEntities)for(let t=0;t{"use strict";var oZ=yU(),cZ={attributeNamePrefix:"@_",attributesGroupName:!1,textNodeName:"#text",ignoreAttributes:!0,cdataPropName:!1,format:!1,indentBy:" ",suppressEmptyNode:!1,suppressUnpairedNode:!0,suppressBooleanAttributes:!0,tagValueProcessor:function(u,e){return e},attributeValueProcessor:function(u,e){return e},preserveOrder:!1,commentPropName:!1,unpairedTags:[],entities:[{regex:new RegExp("&","g"),val:"&"},{regex:new RegExp(">","g"),val:">"},{regex:new RegExp("<","g"),val:"<"},{regex:new RegExp("'","g"),val:"'"},{regex:new RegExp('"',"g"),val:"""}],processEntities:!0,stopNodes:[],oneListGroup:!1};function vs(u){this.options=Object.assign({},cZ,u),this.options.ignoreAttributes||this.options.attributesGroupName?this.isAttribute=function(){return!1}:(this.attrPrefixLen=this.options.attributeNamePrefix.length,this.isAttribute=fZ),this.processTextOrObjNode=lZ,this.options.format?(this.indentate=hZ,this.tagEndChar=`> +`,this.newLine=` +`):(this.indentate=function(){return""},this.tagEndChar=">",this.newLine="")}c(vs,"Builder");vs.prototype.build=function(u){return this.options.preserveOrder?oZ(u,this.options):(Array.isArray(u)&&this.options.arrayNodeName&&this.options.arrayNodeName.length>1&&(u={[this.options.arrayNodeName]:u}),this.j2x(u,0).val)};vs.prototype.j2x=function(u,e){let t="",r="";for(let i in u)if(Object.prototype.hasOwnProperty.call(u,i))if(typeof u[i]>"u")this.isAttribute(i)&&(r+="");else if(u[i]===null)this.isAttribute(i)?r+="":i[0]==="?"?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar;else if(u[i]instanceof Date)r+=this.buildTextValNode(u[i],i,"",e);else if(typeof u[i]!="object"){let s=this.isAttribute(i);if(s)t+=this.buildAttrPairStr(s,""+u[i]);else if(i===this.options.textNodeName){let a=this.options.tagValueProcessor(i,""+u[i]);r+=this.replaceEntitiesValue(a)}else r+=this.buildTextValNode(u[i],i,"",e)}else if(Array.isArray(u[i])){let s=u[i].length,a="";for(let o=0;o"u"||(h===null?i[0]==="?"?r+=this.indentate(e)+"<"+i+"?"+this.tagEndChar:r+=this.indentate(e)+"<"+i+"/"+this.tagEndChar:typeof h=="object"?this.options.oneListGroup?a+=this.j2x(h,e+1).val:a+=this.processTextOrObjNode(h,i,e):a+=this.buildTextValNode(h,i,"",e))}this.options.oneListGroup&&(a=this.buildObjectNode(a,i,"",e)),r+=a}else if(this.options.attributesGroupName&&i===this.options.attributesGroupName){let s=Object.keys(u[i]),a=s.length;for(let o=0;o"+u+i:this.options.commentPropName!==!1&&e===this.options.commentPropName&&s.length===0?this.indentate(r)+``+this.newLine:this.indentate(r)+"<"+e+t+s+this.tagEndChar+u+this.indentate(r)+i}};vs.prototype.closeTag=function(u){let e="";return this.options.unpairedTags.indexOf(u)!==-1?this.options.suppressUnpairedNode||(e="/"):this.options.suppressEmptyNode?e="/":e=`>`+this.newLine;if(this.options.commentPropName!==!1&&e===this.options.commentPropName)return this.indentate(r)+``+this.newLine;if(e[0]==="?")return this.indentate(r)+"<"+e+t+"?"+this.tagEndChar;{let i=this.options.tagValueProcessor(e,u);return i=this.replaceEntitiesValue(i),i===""?this.indentate(r)+"<"+e+t+this.closeTag(e)+this.tagEndChar:this.indentate(r)+"<"+e+t+">"+i+"0&&this.options.processEntities)for(let e=0;e{"use strict";var dZ=S_(),pZ=lU(),yZ=EU();mU.exports={XMLParser:pZ,XMLValidator:dZ,XMLBuilder:yZ}});var bU=w((ph0,TU)=>{"use strict";TU.exports=u=>{let e=c((o,h,f)=>{if(u.isUndefined(f))return h;if((f==null?void 0:f.type)!=="reference")return Array.isArray(h)&&f.items?((f==null?void 0:f.type)==="tuple"?r:t)(f.items,h):u.isPlainObject(h)?s(f.properties||{},h):h},"handleItem"),t=c((o,h)=>h.map(f=>e(o,f,o==null?void 0:o[0])).filter(f=>!u.isBoolean(f)&&!u.isEmpty(f)),"handleItems"),r=c((o,h)=>{let f=h.map((d,p)=>e(o,d,o==null?void 0:o[p]));return f.some(d=>d===void 0)?[]:f},"handleTuple"),i=c(({properties:o,records:h})=>Object.entries(o).reduce((f,[d,p])=>({...f,[d]:s(p==null?void 0:p.properties,h==null?void 0:h[d])}),{}),"handleMap"),s=c((o,h)=>u.isPlainObject(h)?Object.entries(h).reduce((f,[d,p])=>{let E=o==null?void 0:o[d],x=E==null?void 0:E.type;return(x==="list"||x==="set")&&E.items?{...f,[d]:t(E.items,p)}:x==="tuple"&&E.items?{...f,[d]:r(E.items,p)}:x==="map"&&E.properties?{...f,[d]:i({properties:E.properties,records:p})}:{...f,[d]:p}},{}):h,"filterUdt");return{filterUdts:c((o,h)=>h.map(f=>s(o,f)),"filterUdts")}}});var CU=w((gh0,_U)=>{var gZ=require("crypto"),H_=class H_{constructor(e){this.hash=this.getPreKeyedHash(e),this.password=e}update(e){this.hash.update(e)}digest(){return this.hash.digest()}getPreKeyedHash(e){let t=gZ.createHash("sha1"),r=Buffer.alloc(e.length*2);for(let i=0,s=0;i>8,r[s++]=e[i].charCodeAt();return t.update(r),t.update(Buffer.from("Mighty Aphrodite")),t}};c(H_,"PasswordDigest");var M_=H_;_U.exports=M_});var Oo=w((mh0,RU)=>{var EZ=c((u,e,t)=>Uint8Array.prototype.slice?Uint8Array.prototype.slice.call(u,e,t):u.slice(e,t),"sliceBuffer");RU.exports=EZ});var vU=w((Th0,wU)=>{var q_=4294967296,AU=[];for(No=0;No<256;No++)AU[No]=(No>15?"":"0")+No.toString(16);var No,Dh=wU.exports=function(u,e){u instanceof Buffer?(this.buffer=u,this.offset=e||0):Object.prototype.toString.call(u)=="[object Uint8Array]"?(this.buffer=new Buffer(u),this.offset=e||0):(this.buffer=this.buffer||new Buffer(8),this.offset=0,this.setValue.apply(this,arguments))};Dh.MAX_INT=Math.pow(2,53);Dh.MIN_INT=-Math.pow(2,53);Dh.prototype={constructor:Dh,_2scomp:function(){for(var u=this.buffer,e=this.offset,t=1,r=e+7;r>=e;r--){var i=(u[r]^255)+t;u[r]=i&255,t=i>>8}},setValue:function(u,e){var t=!1;if(arguments.length==1)if(typeof u=="number"){if(t=u<0,u=Math.abs(u),e=u%q_,u=u/q_,u>q_)throw new RangeError(u+" is outside Int64 range");u=u|0}else if(typeof u=="string")u=(u+"").replace(/^0x/,""),e=u.substr(-8),u=u.length>8?u.substr(0,u.length-8):"",u=parseInt(u,16),e=parseInt(e,16);else throw new Error(u+" must be a Number or String");for(var r=this.buffer,i=this.offset,s=7;s>=0;s--)r[i+s]=e&255,e=s==4?u:e>>>8;t&&this._2scomp()},toNumber:function(u){for(var e=this.buffer,t=this.offset,r=e[t]&128,i=0,s=1,a=7,o=1;a>=0;a--,o*=256){var h=e[t+a];r&&(h=(h^255)+s,s=h>>8,h=h&255),i+=h*o}return!u&&i>=Dh.MAX_INT?r?-1/0:1/0:r?-i:i},valueOf:function(){return this.toNumber(!1)},toString:function(u){return this.valueOf().toString(u||10)},toOctetString:function(u){for(var e=new Array(8),t=this.buffer,r=this.offset,i=0;i<8;i++)e[i]=AU[t[r+i]];return e.join(u||"")},toBuffer:function(u){if(u&&this.offset===0)return this.buffer;var e=new Buffer(8);return this.buffer.copy(e,0,this.offset,this.offset+8),e},copy:function(u,e){this.buffer.copy(u,e||0,this.offset,this.offset+8)},compare:function(u){if((this.buffer[this.offset]&128)!=(u.buffer[u.offset]&128))return u.buffer[u.offset]-this.buffer[this.offset];for(var e=0;e<8;e++)if(this.buffer[this.offset+e]!==u.buffer[u.offset+e])return this.buffer[this.offset+e]-u.buffer[u.offset+e];return 0},equals:function(u){return this.compare(u)===0},inspect:function(){return"[Int64 value:"+this+" octets:"+this.toOctetString(" ")+"]"}}});var zn=w((bh0,IU)=>{var mZ=vU(),xZ=Oo(),G_=class G_{constructor(e){this.buffer=Buffer.from(e),this.offset=0}readInt(){return this.buffer.readUInt32BE(this.shift(4))}readUTF(){let e=this.buffer.readUInt16BE(this.shift(2));return this.read(e).toString()}read(e){return xZ(this.buffer,this.offset,this.shift(e)+e)}readLong(){let e=this.read(8);return typeof e.readBigUInt64BE=="function"?e.readBigUInt64BE():+new mZ(e).toString()}readByte(){return this.buffer.readUInt8(this.shift(1))}readShort(){return this.read(2).readUInt16BE()}shift(e){let t=this.offset;return this.offset+=e,t}available(){return this.buffer.length-this.offset}};c(G_,"InputStream");var V_=G_;IU.exports=V_});var SU=w((Ch0,LU)=>{var TZ=Oo(),bZ=zn(),z_=class z_ extends bZ{constructor(e,t){super(e),this.digest=t}readInt(){return this.updateDigest(4),super.readInt()}readUTF(){return this.updateDigest(2),super.readUTF()}read(e){return this.updateDigest(e),super.read(e)}readLong(){return super.readLong()}readByte(){return this.updateDigest(1),super.readByte()}updateDigest(e){this.digest.update(TZ(this.buffer,this.offset,this.offset+e))}};c(z_,"DigestInputStream");var W_=z_;LU.exports=W_});var OU=w((Ah0,KU)=>{var Q_=class Q_{constructor({certType:e,value:t}){this.certType=e,this.value=t}};c(Q_,"Certificate");var Y_=Q_;KU.exports=Y_});var Z_=w((vh0,NU)=>{var $_=class $_{constructor({alias:e,date:t,chain:r,protectedPrivateKey:i}){this.certType="X.509",this.alias=e,this.date=t,this.chain=r,this.protectedPrivateKey=i}};c($_,"KeyEntry");var j_=$_;NU.exports=j_});var eC=w((Lh0,UU)=>{var J_=class J_{constructor({alias:e,date:t,cert:r}){this.certType="X.509",this.alias=e,this.date=t,this.cert=r}};c(J_,"TrustedKeyEntry");var X_=J_;UU.exports=X_});var kU=w((Kh0,PU)=>{var _Z=CU(),CZ=SU(),RZ=zn(),AZ=OU(),wZ=Z_(),vZ=eC(),IZ=Oo(),Hi=class Hi{constructor(e,t){this.keystore=e,this.password=t,t?(this.messageDigest=new _Z(t),this.dataInputStream=new CZ(e,this.messageDigest)):this.dataInputStream=new RZ(e)}assertMagic(e){if(e!==Hi.MAGIC)throw new Error("Invalid keystore format")}assertVersion(e){if(e!==Hi.VERSION_1&&e!==Hi.VERSION_2)throw new Error("Invalid keystore format")}parse(){let e=this.dataInputStream.readInt(),t=this.dataInputStream.readInt();this.assertMagic(e),this.assertVersion(t);let r=this.dataInputStream.readInt(),i=[];for(let s=0;st[s]===i))throw new Error("Password verification failed")}getPrivateKeyEntry(){return this.dataInputStream.read(this.dataInputStream.readInt())}readCert(e){let t="X.509";e===Hi.VERSION_2&&(t=this.dataInputStream.readUTF());let r=this.dataInputStream.read(this.dataInputStream.readInt());return new AZ({certType:t,value:r})}readCertificateChain(e){let t=this.dataInputStream.readInt(),r=[];for(let i=0;i{BU.exports={options:{usePureJavaScript:!1}}});var MU=w((Uh0,FU)=>{var tC={};FU.exports=tC;var DU={};tC.encode=function(u,e,t){if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');if(t!==void 0&&typeof t!="number")throw new TypeError('"maxline" must be a number.');var r="";if(!(u instanceof Uint8Array))r=LZ(u,e);else{var i=0,s=e.length,a=e.charAt(0),o=[0];for(i=0;i0;)o.push(f%s),f=f/s|0}for(i=0;u[i]===0&&i=0;--i)r+=e[o[i]]}if(t){var d=new RegExp(".{1,"+t+"}","g");r=r.match(d).join(`\r +`)}return r};tC.decode=function(u,e){if(typeof u!="string")throw new TypeError('"input" must be a string.');if(typeof e!="string")throw new TypeError('"alphabet" must be a string.');var t=DU[e];if(!t){t=DU[e]=[];for(var r=0;r>=8;for(;f>0;)a.push(f&255),f>>=8}for(var d=0;u[d]===s&&d0;)s.push(o%r),o=o/r|0}var h="";for(t=0;u.at(t)===0&&t=0;--t)h+=e[s[t]];return h}c(LZ,"_encodeWithByteBuffer")});var X0=w((kh0,GU)=>{var HU=K0(),qU=MU(),P=GU.exports=HU.util=HU.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){P.nextTick=process.nextTick,typeof setImmediate=="function"?P.setImmediate=setImmediate:P.setImmediate=P.nextTick;return}if(typeof setImmediate=="function"){P.setImmediate=function(){return setImmediate.apply(void 0,arguments)},P.nextTick=function(o){return setImmediate(o)};return}if(P.setImmediate=function(o){setTimeout(o,0)},typeof window<"u"&&typeof window.postMessage=="function"){let o=function(h){if(h.source===window&&h.data===u){h.stopPropagation();var f=e.slice();e.length=0,f.forEach(function(d){d()})}};var a=o;c(o,"handler");var u="forge.setImmediate",e=[];P.setImmediate=function(h){e.push(h),e.length===1&&window.postMessage(u,"*")},window.addEventListener("message",o,!0)}if(typeof MutationObserver<"u"){var t=Date.now(),r=!0,i=document.createElement("div"),e=[];new MutationObserver(function(){var h=e.slice();e.length=0,h.forEach(function(f){f()})}).observe(i,{attributes:!0});var s=P.setImmediate;P.setImmediate=function(h){Date.now()-t>15?(t=Date.now(),s(h)):(e.push(h),e.length===1&&i.setAttribute("a",r=!r))}}P.nextTick=P.setImmediate})();P.isNodejs=typeof process<"u"&&process.versions&&process.versions.node;P.globalScope=function(){return P.isNodejs?global:typeof self>"u"?window:self}();P.isArray=Array.isArray||function(u){return Object.prototype.toString.call(u)==="[object Array]"};P.isArrayBuffer=function(u){return typeof ArrayBuffer<"u"&&u instanceof ArrayBuffer};P.isArrayBufferView=function(u){return u&&P.isArrayBuffer(u.buffer)&&u.byteLength!==void 0};function Fh(u){if(!(u===8||u===16||u===24||u===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+u)}c(Fh,"_checkBitsParam");P.ByteBuffer=uC;function uC(u){if(this.data="",this.read=0,typeof u=="string")this.data=u;else if(P.isArrayBuffer(u)||P.isArrayBufferView(u))if(typeof Buffer<"u"&&u instanceof Buffer)this.data=u.toString("binary");else{var e=new Uint8Array(u);try{this.data=String.fromCharCode.apply(null,e)}catch{for(var t=0;tSZ&&(this.data.substr(0,1),this._constructedStringLength=0)};P.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};P.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0};P.ByteStringBuffer.prototype.putByte=function(u){return this.putBytes(String.fromCharCode(u))};P.ByteStringBuffer.prototype.fillWithByte=function(u,e){u=String.fromCharCode(u);for(var t=this.data;e>0;)e&1&&(t+=u),e>>>=1,e>0&&(u+=u);return this.data=t,this._optimizeConstructedString(e),this};P.ByteStringBuffer.prototype.putBytes=function(u){return this.data+=u,this._optimizeConstructedString(u.length),this};P.ByteStringBuffer.prototype.putString=function(u){return this.putBytes(P.encodeUtf8(u))};P.ByteStringBuffer.prototype.putInt16=function(u){return this.putBytes(String.fromCharCode(u>>8&255)+String.fromCharCode(u&255))};P.ByteStringBuffer.prototype.putInt24=function(u){return this.putBytes(String.fromCharCode(u>>16&255)+String.fromCharCode(u>>8&255)+String.fromCharCode(u&255))};P.ByteStringBuffer.prototype.putInt32=function(u){return this.putBytes(String.fromCharCode(u>>24&255)+String.fromCharCode(u>>16&255)+String.fromCharCode(u>>8&255)+String.fromCharCode(u&255))};P.ByteStringBuffer.prototype.putInt16Le=function(u){return this.putBytes(String.fromCharCode(u&255)+String.fromCharCode(u>>8&255))};P.ByteStringBuffer.prototype.putInt24Le=function(u){return this.putBytes(String.fromCharCode(u&255)+String.fromCharCode(u>>8&255)+String.fromCharCode(u>>16&255))};P.ByteStringBuffer.prototype.putInt32Le=function(u){return this.putBytes(String.fromCharCode(u&255)+String.fromCharCode(u>>8&255)+String.fromCharCode(u>>16&255)+String.fromCharCode(u>>24&255))};P.ByteStringBuffer.prototype.putInt=function(u,e){Fh(e);var t="";do e-=8,t+=String.fromCharCode(u>>e&255);while(e>0);return this.putBytes(t)};P.ByteStringBuffer.prototype.putSignedInt=function(u,e){return u<0&&(u+=2<0);return e};P.ByteStringBuffer.prototype.getSignedInt=function(u){var e=this.getInt(u),t=2<=t&&(e-=t<<1),e};P.ByteStringBuffer.prototype.getBytes=function(u){var e;return u?(u=Math.min(this.length(),u),e=this.data.slice(this.read,this.read+u),this.read+=u):u===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};P.ByteStringBuffer.prototype.bytes=function(u){return typeof u>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+u)};P.ByteStringBuffer.prototype.at=function(u){return this.data.charCodeAt(this.read+u)};P.ByteStringBuffer.prototype.setAt=function(u,e){return this.data=this.data.substr(0,this.read+u)+String.fromCharCode(e)+this.data.substr(this.read+u+1),this};P.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)};P.ByteStringBuffer.prototype.copy=function(){var u=P.createBuffer(this.data);return u.read=this.read,u};P.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this};P.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this};P.ByteStringBuffer.prototype.truncate=function(u){var e=Math.max(0,this.length()-u);return this.data=this.data.substr(this.read,e),this.read=0,this};P.ByteStringBuffer.prototype.toHex=function(){for(var u="",e=this.read;e=u)return this;e=Math.max(e||this.growSize,u);var t=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),r=new Uint8Array(this.length()+e);return r.set(t),this.data=new DataView(r.buffer),this};P.DataBuffer.prototype.putByte=function(u){return this.accommodate(1),this.data.setUint8(this.write++,u),this};P.DataBuffer.prototype.fillWithByte=function(u,e){this.accommodate(e);for(var t=0;t>8&65535),this.data.setInt8(this.write,u>>16&255),this.write+=3,this};P.DataBuffer.prototype.putInt32=function(u){return this.accommodate(4),this.data.setInt32(this.write,u),this.write+=4,this};P.DataBuffer.prototype.putInt16Le=function(u){return this.accommodate(2),this.data.setInt16(this.write,u,!0),this.write+=2,this};P.DataBuffer.prototype.putInt24Le=function(u){return this.accommodate(3),this.data.setInt8(this.write,u>>16&255),this.data.setInt16(this.write,u>>8&65535,!0),this.write+=3,this};P.DataBuffer.prototype.putInt32Le=function(u){return this.accommodate(4),this.data.setInt32(this.write,u,!0),this.write+=4,this};P.DataBuffer.prototype.putInt=function(u,e){Fh(e),this.accommodate(e/8);do e-=8,this.data.setInt8(this.write++,u>>e&255);while(e>0);return this};P.DataBuffer.prototype.putSignedInt=function(u,e){return Fh(e),this.accommodate(e/8),u<0&&(u+=2<0);return e};P.DataBuffer.prototype.getSignedInt=function(u){var e=this.getInt(u),t=2<=t&&(e-=t<<1),e};P.DataBuffer.prototype.getBytes=function(u){var e;return u?(u=Math.min(this.length(),u),e=this.data.slice(this.read,this.read+u),this.read+=u):u===0?e="":(e=this.read===0?this.data:this.data.slice(this.read),this.clear()),e};P.DataBuffer.prototype.bytes=function(u){return typeof u>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+u)};P.DataBuffer.prototype.at=function(u){return this.data.getUint8(this.read+u)};P.DataBuffer.prototype.setAt=function(u,e){return this.data.setUint8(u,e),this};P.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};P.DataBuffer.prototype.copy=function(){return new P.DataBuffer(this)};P.DataBuffer.prototype.compact=function(){if(this.read>0){var u=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(u.byteLength);e.set(u),this.data=new DataView(e),this.write-=this.read,this.read=0}return this};P.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this};P.DataBuffer.prototype.truncate=function(u){return this.write=Math.max(0,this.length()-u),this.read=Math.min(this.read,this.write),this};P.DataBuffer.prototype.toHex=function(){for(var u="",e=this.read;e0;)e&1&&(t+=u),e>>>=1,e>0&&(u+=u);return t};P.xorBytes=function(u,e,t){for(var r="",i="",s="",a=0,o=0;t>0;--t,++a)i=u.charCodeAt(a)^e.charCodeAt(a),o>=10&&(r+=s,s="",o=0),s+=String.fromCharCode(i),++o;return r+=s,r};P.hexToBytes=function(u){var e="",t=0;for(u.length&!0&&(t=1,e+=String.fromCharCode(parseInt(u[0],16)));t>24&255)+String.fromCharCode(u>>16&255)+String.fromCharCode(u>>8&255)+String.fromCharCode(u&255)};var Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",Ss=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],VU="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";P.encode64=function(u,e){for(var t="",r="",i,s,a,o=0;o>2),t+=Ls.charAt((i&3)<<4|s>>4),isNaN(s)?t+="==":(t+=Ls.charAt((s&15)<<2|a>>6),t+=isNaN(a)?"=":Ls.charAt(a&63)),e&&t.length>e&&(r+=t.substr(0,e)+`\r +`,t=t.substr(e));return r+=t,r};P.decode64=function(u){u=u.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e="",t,r,i,s,a=0;a>4),i!==64&&(e+=String.fromCharCode((r&15)<<4|i>>2),s!==64&&(e+=String.fromCharCode((i&3)<<6|s)));return e};P.encodeUtf8=function(u){return unescape(encodeURIComponent(u))};P.decodeUtf8=function(u){return decodeURIComponent(escape(u))};P.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:qU.encode,decode:qU.decode}};P.binary.raw.encode=function(u){return String.fromCharCode.apply(null,u)};P.binary.raw.decode=function(u,e,t){var r=e;r||(r=new Uint8Array(u.length)),t=t||0;for(var i=t,s=0;s>2),t+=Ls.charAt((i&3)<<4|s>>4),isNaN(s)?t+="==":(t+=Ls.charAt((s&15)<<2|a>>6),t+=isNaN(a)?"=":Ls.charAt(a&63)),e&&t.length>e&&(r+=t.substr(0,e)+`\r +`,t=t.substr(e));return r+=t,r};P.binary.base64.decode=function(u,e,t){var r=e;r||(r=new Uint8Array(Math.ceil(u.length/4)*3)),u=u.replace(/[^A-Za-z0-9\+\/\=]/g,""),t=t||0;for(var i,s,a,o,h=0,f=t;h>4,a!==64&&(r[f++]=(s&15)<<4|a>>2,o!==64&&(r[f++]=(a&3)<<6|o));return e?f-t:r.subarray(0,f)};P.binary.base58.encode=function(u,e){return P.binary.baseN.encode(u,VU,e)};P.binary.base58.decode=function(u,e){return P.binary.baseN.decode(u,VU,e)};P.text={utf8:{},utf16:{}};P.text.utf8.encode=function(u,e,t){u=P.encodeUtf8(u);var r=e;r||(r=new Uint8Array(u.length)),t=t||0;for(var i=t,s=0;s"u"&&(t=["web","flash"]);var i,s=!1,a=null;for(var o in t){i=t[o];try{if(i==="flash"||i==="both"){if(e[0]===null)throw new Error("Flash local storage not available.");r=u.apply(this,e),s=i==="flash"}(i==="web"||i==="both")&&(e[0]=localStorage,r=u.apply(this,e),s=!0)}catch(h){a=h}if(s)break}if(!s)throw a;return r},"_callStorageFunction");P.setItem=function(u,e,t,r,i){py(OZ,arguments,i)};P.getItem=function(u,e,t,r){return py(NZ,arguments,r)};P.removeItem=function(u,e,t,r){py(UZ,arguments,r)};P.clearItems=function(u,e,t){py(PZ,arguments,t)};P.isEmpty=function(u){for(var e in u)if(u.hasOwnProperty(e))return!1;return!0};P.format=function(u){for(var e=/%./g,t,r,i=0,s=[],a=0;t=e.exec(u);){r=u.substring(a,e.lastIndex-2),r.length>0&&s.push(r),a=e.lastIndex;var o=t[0][1];switch(o){case"s":case"o":i");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(u.substring(a)),s.join("")};P.formatNumber=function(u,e,t,r){var i=u,s=isNaN(e=Math.abs(e))?2:e,a=t===void 0?",":t,o=r===void 0?".":r,h=i<0?"-":"",f=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",d=f.length>3?f.length%3:0;return h+(d?f.substr(0,d)+o:"")+f.substr(d).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?a+Math.abs(i-f).toFixed(s).slice(2):"")};P.formatSize=function(u){return u>=1073741824?u=P.formatNumber(u/1073741824,2,".","")+" GiB":u>=1048576?u=P.formatNumber(u/1048576,2,".","")+" MiB":u>=1024?u=P.formatNumber(u/1024,0)+" KiB":u=P.formatNumber(u,0)+" bytes",u};P.bytesFromIP=function(u){return u.indexOf(".")!==-1?P.bytesFromIPv4(u):u.indexOf(":")!==-1?P.bytesFromIPv6(u):null};P.bytesFromIPv4=function(u){if(u=u.split("."),u.length!==4)return null;for(var e=P.createBuffer(),t=0;tt[r].end-t[r].start&&(r=t.length-1))}e.push(s)}if(t.length>0){var h=t[r];h.end-h.start>0&&(e.splice(h.start,h.end-h.start+1,""),h.start===0&&e.unshift(""),h.end===7&&e.push(""))}return e.join(":")};P.estimateCores=function(u,e){if(typeof u=="function"&&(e=u,u={}),u=u||{},"cores"in P&&!u.update)return e(null,P.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return P.cores=navigator.hardwareConcurrency,e(null,P.cores);if(typeof Worker>"u")return P.cores=1,e(null,P.cores);if(typeof Blob>"u")return P.cores=2,e(null,P.cores);var t=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){for(var o=Date.now(),h=o+4;Date.now()x.st&&d.std.st&&x.st{var Tt=K0();X0();WU.exports=Tt.cipher=Tt.cipher||{};Tt.cipher.algorithms=Tt.cipher.algorithms||{};Tt.cipher.createCipher=function(u,e){var t=u;if(typeof t=="string"&&(t=Tt.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+u);return new Tt.cipher.BlockCipher({algorithm:t,key:e,decrypt:!1})};Tt.cipher.createDecipher=function(u,e){var t=u;if(typeof t=="string"&&(t=Tt.cipher.getAlgorithm(t),t&&(t=t())),!t)throw new Error("Unsupported algorithm: "+u);return new Tt.cipher.BlockCipher({algorithm:t,key:e,decrypt:!0})};Tt.cipher.registerAlgorithm=function(u,e){u=u.toUpperCase(),Tt.cipher.algorithms[u]=e};Tt.cipher.getAlgorithm=function(u){return u=u.toUpperCase(),u in Tt.cipher.algorithms?Tt.cipher.algorithms[u]:null};var sC=Tt.cipher.BlockCipher=function(u){this.algorithm=u.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=u.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=u.decrypt,this.algorithm.initialize(u)};sC.prototype.start=function(u){u=u||{};var e={};for(var t in u)e[t]=u[t];e.decrypt=this._decrypt,this._finish=!1,this._input=Tt.util.createBuffer(),this.output=u.output||Tt.util.createBuffer(),this.mode.start(e)};sC.prototype.update=function(u){for(u&&this._input.putBuffer(u);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};sC.prototype.finish=function(u){u&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(t){return u(this.blockSize,t,!1)},this.mode.unpad=function(t){return u(this.blockSize,t,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e))}});var aC=w((Fh0,zU)=>{var bt=K0();X0();bt.cipher=bt.cipher||{};var F0=zU.exports=bt.cipher.modes=bt.cipher.modes||{};F0.ecb=function(u){u=u||{},this.name="ECB",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};F0.ecb.prototype.start=function(u){};F0.ecb.prototype.encrypt=function(u,e,t){if(u.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var t=u.length(),r=u.at(t-1);return r>this.blockSize<<2?!1:(u.truncate(r),!0)};F0.cbc=function(u){u=u||{},this.name="CBC",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)};F0.cbc.prototype.start=function(u){if(u.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in u)this._iv=gy(u.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")};F0.cbc.prototype.encrypt=function(u,e,t){if(u.length()0))return!0;for(var r=0;r0))return!0;for(var r=0;r0)return!1;var t=u.length(),r=u.at(t-1);return r>this.blockSize<<2?!1:(u.truncate(r),!0)};F0.cfb=function(u){u=u||{},this.name="CFB",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=bt.util.createBuffer(),this._partialBytes=0};F0.cfb.prototype.start=function(u){if(!("iv"in u))throw new Error("Invalid IV parameter.");this._iv=gy(u.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F0.cfb.prototype.encrypt=function(u,e,t){var r=u.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)u.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!t)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};F0.cfb.prototype.decrypt=function(u,e,t){var r=u.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)u.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!t)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};F0.ofb=function(u){u=u||{},this.name="OFB",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=bt.util.createBuffer(),this._partialBytes=0};F0.ofb.prototype.start=function(u){if(!("iv"in u))throw new Error("Invalid IV parameter.");this._iv=gy(u.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F0.ofb.prototype.encrypt=function(u,e,t){var r=u.length();if(u.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0)u.read-=this.blockSize;else for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!t)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0};F0.ofb.prototype.decrypt=F0.ofb.prototype.encrypt;F0.ctr=function(u){u=u||{},this.name="CTR",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=bt.util.createBuffer(),this._partialBytes=0};F0.ctr.prototype.start=function(u){if(!("iv"in u))throw new Error("Invalid IV parameter.");this._iv=gy(u.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0};F0.ctr.prototype.encrypt=function(u,e,t){var r=u.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize)for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&(u.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!t)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}Ey(this._inBlock)};F0.ctr.prototype.decrypt=F0.ctr.prototype.encrypt;F0.gcm=function(u){u=u||{},this.name="GCM",this.cipher=u.cipher,this.blockSize=u.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=bt.util.createBuffer(),this._partialBytes=0,this._R=3774873600};F0.gcm.prototype.start=function(u){if(!("iv"in u))throw new Error("Invalid IV parameter.");var e=bt.util.createBuffer(u.iv);this._cipherLength=0;var t;if("additionalData"in u?t=bt.util.createBuffer(u.additionalData):t=bt.util.createBuffer(),"tagLength"in u?this._tagLength=u.tagLength:this._tagLength=128,this._tag=null,u.decrypt&&(this._tag=bt.util.createBuffer(u.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var r=e.length();if(r===12)this._j0=[e.getInt32(),e.getInt32(),e.getInt32(),1];else{for(this._j0=[0,0,0,0];e.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(nC(r*8)))}this._inBlock=this._j0.slice(0),Ey(this._inBlock),this._partialBytes=0,t=bt.util.createBuffer(t),this._aDataLength=nC(t.length()*8);var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])};F0.gcm.prototype.encrypt=function(u,e,t){var r=u.length();if(r===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&r>=this.blockSize){for(var i=0;i0&&(s=this.blockSize-s),this._partialOutput.clear();for(var i=0;i0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!t)return u.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(r-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),Ey(this._inBlock)};F0.gcm.prototype.decrypt=function(u,e,t){var r=u.length();if(r0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),Ey(this._inBlock),this._hashBlock[0]=u.getInt32(),this._hashBlock[1]=u.getInt32(),this._hashBlock[2]=u.getInt32(),this._hashBlock[3]=u.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i0;--r)e[r]=u[r]>>>1|(u[r-1]&1)<<31;e[0]=u[0]>>>1,t&&(e[0]^=this._R)};F0.gcm.prototype.tableMultiply=function(u){for(var e=[0,0,0,0],t=0;t<32;++t){var r=t/8|0,i=u[r]>>>(7-t%8)*4&15,s=this._m[t][i];e[0]^=s[0],e[1]^=s[1],e[2]^=s[2],e[3]^=s[3]}return e};F0.gcm.prototype.ghash=function(u,e,t){return e[0]^=t[0],e[1]^=t[1],e[2]^=t[2],e[3]^=t[3],this.tableMultiply(e)};F0.gcm.prototype.generateHashTable=function(u,e){for(var t=8/e,r=4*t,i=16*t,s=new Array(i),a=0;a>>1,i=new Array(t);i[r]=u.slice(0);for(var s=r>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s4){var t=u;u=bt.util.createBuffer();for(var r=0;r{var be=K0();yy();aC();X0();$U.exports=be.aes=be.aes||{};be.aes.startEncrypting=function(u,e,t,r){var i=my({key:u,output:t,decrypt:!1,mode:r});return i.start(e),i};be.aes.createEncryptionCipher=function(u,e){return my({key:u,output:null,decrypt:!1,mode:e})};be.aes.startDecrypting=function(u,e,t,r){var i=my({key:u,output:t,decrypt:!0,mode:r});return i.start(e),i};be.aes.createDecryptionCipher=function(u,e){return my({key:u,output:null,decrypt:!0,mode:e})};be.aes.Algorithm=function(u,e){lC||QU();var t=this;t.name=u,t.mode=new e({blockSize:16,cipher:{encrypt:function(r,i){return cC(t._w,r,i,!1)},decrypt:function(r,i){return cC(t._w,r,i,!0)}}}),t._init=!1};be.aes.Algorithm.prototype.initialize=function(u){if(!this._init){var e=u.key,t;if(typeof e=="string"&&(e.length===16||e.length===24||e.length===32))e=be.util.createBuffer(e);else if(be.util.isArray(e)&&(e.length===16||e.length===24||e.length===32)){t=e,e=be.util.createBuffer();for(var r=0;r>>2;for(var r=0;r>8^o&255^99,hu[t]=o,oC[o]=t,h=u[o],i=u[t],s=u[i],a=u[s],f=h<<24^o<<16^o<<8^(o^h),d=(i^s^a)<<24^(t^a)<<16^(t^s^a)<<8^(t^i^a);for(var p=0;p<4;++p)Yn[p][t]=f,Dr[p][o]=d,f=f<<24|f>>>8,d=d<<24|d>>>8;t===0?t=r=1:(t=i^u[u[u[i^a]]],r^=u[u[r]])}}c(QU,"initialize");function jU(u,e){for(var t=u.slice(0),r,i=1,s=t.length,a=s+6+1,o=Uo*a,h=s;h>>16&255]<<24^hu[r>>>8&255]<<16^hu[r&255]<<8^hu[r>>>24]^YU[i]<<24,i++):s>6&&h%s===4&&(r=hu[r>>>24]<<24^hu[r>>>16&255]<<16^hu[r>>>8&255]<<8^hu[r&255]),t[h]=t[h-s]^r;if(e){var f,d=Dr[0],p=Dr[1],E=Dr[2],x=Dr[3],g=t.slice(0);o=t.length;for(var h=0,m=o-Uo;h>>24]]^p[hu[f>>>16&255]]^E[hu[f>>>8&255]]^x[hu[f&255]];t=g}return t}c(jU,"_expandKey");function cC(u,e,t,r){var i=u.length/4-1,s,a,o,h,f;r?(s=Dr[0],a=Dr[1],o=Dr[2],h=Dr[3],f=oC):(s=Yn[0],a=Yn[1],o=Yn[2],h=Yn[3],f=hu);var d,p,E,x,g,m,A;d=e[0]^u[0],p=e[r?3:1]^u[1],E=e[2]^u[2],x=e[r?1:3]^u[3];for(var T=3,I=1;I>>24]^a[p>>>16&255]^o[E>>>8&255]^h[x&255]^u[++T],m=s[p>>>24]^a[E>>>16&255]^o[x>>>8&255]^h[d&255]^u[++T],A=s[E>>>24]^a[x>>>16&255]^o[d>>>8&255]^h[p&255]^u[++T],x=s[x>>>24]^a[d>>>16&255]^o[p>>>8&255]^h[E&255]^u[++T],d=g,p=m,E=A;t[0]=f[d>>>24]<<24^f[p>>>16&255]<<16^f[E>>>8&255]<<8^f[x&255]^u[++T],t[r?3:1]=f[p>>>24]<<24^f[E>>>16&255]<<16^f[x>>>8&255]<<8^f[d&255]^u[++T],t[2]=f[E>>>24]<<24^f[x>>>16&255]<<16^f[d>>>8&255]<<8^f[p&255]^u[++T],t[r?1:3]=f[x>>>24]<<24^f[d>>>16&255]<<16^f[p>>>8&255]<<8^f[E&255]^u[++T]}c(cC,"_updateBlock");function my(u){u=u||{};var e=(u.mode||"CBC").toUpperCase(),t="AES-"+e,r;u.decrypt?r=be.cipher.createDecipher(t,u.key):r=be.cipher.createCipher(t,u.key);var i=r.start;return r.start=function(s,a){var o=null;a instanceof be.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,i.call(r,a)},r}c(my,"_createCipher")});var Os=w((Vh0,ZU)=>{var Mh=K0();Mh.pki=Mh.pki||{};var hC=ZU.exports=Mh.pki.oids=Mh.oids=Mh.oids||{};function Z(u,e){hC[u]=e,hC[e]=u}c(Z,"_IN");function ne(u,e){hC[u]=e}c(ne,"_I_");Z("1.2.840.113549.1.1.1","rsaEncryption");Z("1.2.840.113549.1.1.4","md5WithRSAEncryption");Z("1.2.840.113549.1.1.5","sha1WithRSAEncryption");Z("1.2.840.113549.1.1.7","RSAES-OAEP");Z("1.2.840.113549.1.1.8","mgf1");Z("1.2.840.113549.1.1.9","pSpecified");Z("1.2.840.113549.1.1.10","RSASSA-PSS");Z("1.2.840.113549.1.1.11","sha256WithRSAEncryption");Z("1.2.840.113549.1.1.12","sha384WithRSAEncryption");Z("1.2.840.113549.1.1.13","sha512WithRSAEncryption");Z("1.3.101.112","EdDSA25519");Z("1.2.840.10040.4.3","dsa-with-sha1");Z("1.3.14.3.2.7","desCBC");Z("1.3.14.3.2.26","sha1");Z("1.3.14.3.2.29","sha1WithRSASignature");Z("2.16.840.1.101.3.4.2.1","sha256");Z("2.16.840.1.101.3.4.2.2","sha384");Z("2.16.840.1.101.3.4.2.3","sha512");Z("2.16.840.1.101.3.4.2.4","sha224");Z("2.16.840.1.101.3.4.2.5","sha512-224");Z("2.16.840.1.101.3.4.2.6","sha512-256");Z("1.2.840.113549.2.2","md2");Z("1.2.840.113549.2.5","md5");Z("1.2.840.113549.1.7.1","data");Z("1.2.840.113549.1.7.2","signedData");Z("1.2.840.113549.1.7.3","envelopedData");Z("1.2.840.113549.1.7.4","signedAndEnvelopedData");Z("1.2.840.113549.1.7.5","digestedData");Z("1.2.840.113549.1.7.6","encryptedData");Z("1.2.840.113549.1.9.1","emailAddress");Z("1.2.840.113549.1.9.2","unstructuredName");Z("1.2.840.113549.1.9.3","contentType");Z("1.2.840.113549.1.9.4","messageDigest");Z("1.2.840.113549.1.9.5","signingTime");Z("1.2.840.113549.1.9.6","counterSignature");Z("1.2.840.113549.1.9.7","challengePassword");Z("1.2.840.113549.1.9.8","unstructuredAddress");Z("1.2.840.113549.1.9.14","extensionRequest");Z("1.2.840.113549.1.9.20","friendlyName");Z("1.2.840.113549.1.9.21","localKeyId");Z("1.2.840.113549.1.9.22.1","x509Certificate");Z("1.2.840.113549.1.12.10.1.1","keyBag");Z("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");Z("1.2.840.113549.1.12.10.1.3","certBag");Z("1.2.840.113549.1.12.10.1.4","crlBag");Z("1.2.840.113549.1.12.10.1.5","secretBag");Z("1.2.840.113549.1.12.10.1.6","safeContentsBag");Z("1.2.840.113549.1.5.13","pkcs5PBES2");Z("1.2.840.113549.1.5.12","pkcs5PBKDF2");Z("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");Z("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");Z("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC");Z("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");Z("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");Z("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");Z("1.2.840.113549.2.7","hmacWithSHA1");Z("1.2.840.113549.2.8","hmacWithSHA224");Z("1.2.840.113549.2.9","hmacWithSHA256");Z("1.2.840.113549.2.10","hmacWithSHA384");Z("1.2.840.113549.2.11","hmacWithSHA512");Z("1.2.840.113549.3.7","des-EDE3-CBC");Z("2.16.840.1.101.3.4.1.2","aes128-CBC");Z("2.16.840.1.101.3.4.1.22","aes192-CBC");Z("2.16.840.1.101.3.4.1.42","aes256-CBC");Z("2.5.4.3","commonName");Z("2.5.4.4","surname");Z("2.5.4.5","serialNumber");Z("2.5.4.6","countryName");Z("2.5.4.7","localityName");Z("2.5.4.8","stateOrProvinceName");Z("2.5.4.9","streetAddress");Z("2.5.4.10","organizationName");Z("2.5.4.11","organizationalUnitName");Z("2.5.4.12","title");Z("2.5.4.13","description");Z("2.5.4.15","businessCategory");Z("2.5.4.17","postalCode");Z("2.5.4.42","givenName");Z("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");Z("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");Z("2.16.840.1.113730.1.1","nsCertType");Z("2.16.840.1.113730.1.13","nsComment");ne("2.5.29.1","authorityKeyIdentifier");ne("2.5.29.2","keyAttributes");ne("2.5.29.3","certificatePolicies");ne("2.5.29.4","keyUsageRestriction");ne("2.5.29.5","policyMapping");ne("2.5.29.6","subtreesConstraint");ne("2.5.29.7","subjectAltName");ne("2.5.29.8","issuerAltName");ne("2.5.29.9","subjectDirectoryAttributes");ne("2.5.29.10","basicConstraints");ne("2.5.29.11","nameConstraints");ne("2.5.29.12","policyConstraints");ne("2.5.29.13","basicConstraints");Z("2.5.29.14","subjectKeyIdentifier");Z("2.5.29.15","keyUsage");ne("2.5.29.16","privateKeyUsagePeriod");Z("2.5.29.17","subjectAltName");Z("2.5.29.18","issuerAltName");Z("2.5.29.19","basicConstraints");ne("2.5.29.20","cRLNumber");ne("2.5.29.21","cRLReason");ne("2.5.29.22","expirationDate");ne("2.5.29.23","instructionCode");ne("2.5.29.24","invalidityDate");ne("2.5.29.25","cRLDistributionPoints");ne("2.5.29.26","issuingDistributionPoint");ne("2.5.29.27","deltaCRLIndicator");ne("2.5.29.28","issuingDistributionPoint");ne("2.5.29.29","certificateIssuer");ne("2.5.29.30","nameConstraints");Z("2.5.29.31","cRLDistributionPoints");Z("2.5.29.32","certificatePolicies");ne("2.5.29.33","policyMappings");ne("2.5.29.34","policyConstraints");Z("2.5.29.35","authorityKeyIdentifier");ne("2.5.29.36","policyConstraints");Z("2.5.29.37","extKeyUsage");ne("2.5.29.46","freshestCRL");ne("2.5.29.54","inhibitAnyPolicy");Z("1.3.6.1.4.1.11129.2.4.2","timestampList");Z("1.3.6.1.5.5.7.1.1","authorityInfoAccess");Z("1.3.6.1.5.5.7.3.1","serverAuth");Z("1.3.6.1.5.5.7.3.2","clientAuth");Z("1.3.6.1.5.5.7.3.3","codeSigning");Z("1.3.6.1.5.5.7.3.4","emailProtection");Z("1.3.6.1.5.5.7.3.8","timeStamping")});var Fr=w((Wh0,JU)=>{var we=K0();X0();Os();var n0=JU.exports=we.asn1=we.asn1||{};n0.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};n0.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30};n0.create=function(u,e,t,r,i){if(we.util.isArray(r)){for(var s=[],a=0;ae){var r=new Error("Too few bytes to parse DER.");throw r.available=u.length(),r.remaining=e,r.requested=t,r}}c(Hh,"_checkBufferLength");var kZ=c(function(u,e){var t=u.getByte();if(e--,t!==128){var r,i=t&128;if(!i)r=t;else{var s=t&127;Hh(u,e,s),r=u.getInt(s<<3)}if(r<0)throw new Error("Negative length: "+r);return r}},"_getValueLength");n0.fromDer=function(u,e){e===void 0&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof e=="boolean"&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),typeof u=="string"&&(u=we.util.createBuffer(u));var t=u.length(),r=xy(u,u.length(),0,e);if(e.parseAllBytes&&u.length()!==0){var i=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw i.byteCount=t,i.remaining=u.length(),i}return r};function xy(u,e,t,r){var i;Hh(u,e,2);var s=u.getByte();e--;var a=s&192,o=s&31;i=u.length();var h=kZ(u,e);if(e-=i-u.length(),h!==void 0&&h>e){if(r.strict){var f=new Error("Too few bytes to read ASN.1 value.");throw f.available=u.length(),f.remaining=e,f.requested=h,f}h=e}var d,p,E=(s&32)===32;if(E)if(d=[],h===void 0)for(;;){if(Hh(u,e,2),u.bytes(2)==="\0\0"){u.getBytes(2),e-=2;break}i=u.length(),d.push(xy(u,e,t+1,r)),e-=i-u.length()}else for(;h>0;)i=u.length(),d.push(xy(u,h,t+1,r)),e-=i-u.length(),h-=i-u.length();if(d===void 0&&a===n0.Class.UNIVERSAL&&o===n0.Type.BITSTRING&&(p=u.bytes(h)),d===void 0&&r.decodeBitStrings&&a===n0.Class.UNIVERSAL&&o===n0.Type.BITSTRING&&h>1){var x=u.read,g=e,m=0;if(o===n0.Type.BITSTRING&&(Hh(u,e,1),m=u.getByte(),e--),m===0)try{i=u.length();var A={strict:!0,decodeBitStrings:!0},T=xy(u,e,t+1,A),I=i-u.length();e-=I,o==n0.Type.BITSTRING&&I++;var L=T.tagClass;I===h&&(L===n0.Class.UNIVERSAL||L===n0.Class.CONTEXT_SPECIFIC)&&(d=[T])}catch{}d===void 0&&(u.read=x,e=g)}if(d===void 0){if(h===void 0){if(r.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=e}if(o===n0.Type.BMPSTRING)for(d="";h>0;h-=2)Hh(u,e,2),d+=String.fromCharCode(u.getInt16()),e-=2;else d=u.getBytes(h),e-=h}var N=p===void 0?null:{bitStringContents:p};return n0.create(a,o,E,d,N)}c(xy,"_fromDer");n0.toDer=function(u){var e=we.util.createBuffer(),t=u.tagClass|u.type,r=we.util.createBuffer(),i=!1;if("bitStringContents"in u&&(i=!0,u.original&&(i=n0.equals(u,u.original))),i)r.putBytes(u.bitStringContents);else if(u.composed){u.constructed?t|=32:r.putByte(0);for(var s=0;s1&&(u.value.charCodeAt(0)===0&&!(u.value.charCodeAt(1)&128)||u.value.charCodeAt(0)===255&&(u.value.charCodeAt(1)&128)===128)?r.putBytes(u.value.substr(1)):r.putBytes(u.value);if(e.putByte(t),r.length()<=127)e.putByte(r.length()&127);else{var a=r.length(),o="";do o+=String.fromCharCode(a&255),a=a>>>8;while(a>0);e.putByte(o.length|128);for(var s=o.length-1;s>=0;--s)e.putByte(o.charCodeAt(s))}return e.putBuffer(r),e};n0.oidToDer=function(u){var e=u.split("."),t=we.util.createBuffer();t.putByte(40*parseInt(e[0],10)+parseInt(e[1],10));for(var r,i,s,a,o=2;o>>7,r||(a|=128),i.push(a),r=!1;while(s>0);for(var h=i.length-1;h>=0;--h)t.putByte(i[h])}return t};n0.derToOid=function(u){var e;typeof u=="string"&&(u=we.util.createBuffer(u));var t=u.getByte();e=Math.floor(t/40)+"."+t%40;for(var r=0;u.length()>0;)t=u.getByte(),r=r<<7,t&128?r+=t&127:(e+="."+(r+t),r=0);return e};n0.utcTimeToDate=function(u){var e=new Date,t=parseInt(u.substr(0,2),10);t=t>=50?1900+t:2e3+t;var r=parseInt(u.substr(2,2),10)-1,i=parseInt(u.substr(4,2),10),s=parseInt(u.substr(6,2),10),a=parseInt(u.substr(8,2),10),o=0;if(u.length>11){var h=u.charAt(10),f=10;h!=="+"&&h!=="-"&&(o=parseInt(u.substr(10,2),10),f+=2)}if(e.setUTCFullYear(t,r,i),e.setUTCHours(s,a,o,0),f&&(h=u.charAt(f),h==="+"||h==="-")){var d=parseInt(u.substr(f+1,2),10),p=parseInt(u.substr(f+4,2),10),E=d*60+p;E*=6e4,h==="+"?e.setTime(+e-E):e.setTime(+e+E)}return e};n0.generalizedTimeToDate=function(u){var e=new Date,t=parseInt(u.substr(0,4),10),r=parseInt(u.substr(4,2),10)-1,i=parseInt(u.substr(6,2),10),s=parseInt(u.substr(8,2),10),a=parseInt(u.substr(10,2),10),o=parseInt(u.substr(12,2),10),h=0,f=0,d=!1;u.charAt(u.length-1)==="Z"&&(d=!0);var p=u.length-5,E=u.charAt(p);if(E==="+"||E==="-"){var x=parseInt(u.substr(p+1,2),10),g=parseInt(u.substr(p+4,2),10);f=x*60+g,f*=6e4,E==="+"&&(f*=-1),d=!0}return u.charAt(14)==="."&&(h=parseFloat(u.substr(14),10)*1e3),d?(e.setUTCFullYear(t,r,i),e.setUTCHours(s,a,o,h),e.setTime(+e+f)):(e.setFullYear(t,r,i),e.setHours(s,a,o,h)),e};n0.dateToUtcTime=function(u){if(typeof u=="string")return u;var e="",t=[];t.push((""+u.getUTCFullYear()).substr(2)),t.push(""+(u.getUTCMonth()+1)),t.push(""+u.getUTCDate()),t.push(""+u.getUTCHours()),t.push(""+u.getUTCMinutes()),t.push(""+u.getUTCSeconds());for(var r=0;r=-128&&u<128)return e.putSignedInt(u,8);if(u>=-32768&&u<32768)return e.putSignedInt(u,16);if(u>=-8388608&&u<8388608)return e.putSignedInt(u,24);if(u>=-2147483648&&u<2147483648)return e.putSignedInt(u,32);var t=new Error("Integer too large; max is 32-bits.");throw t.integer=u,t};n0.derToInteger=function(u){typeof u=="string"&&(u=we.util.createBuffer(u));var e=u.length()*8;if(e>32)throw new Error("Integer too large; max is 32-bits.");return u.getSignedInt(e)};n0.validate=function(u,e,t,r){var i=!1;if((u.tagClass===e.tagClass||typeof e.tagClass>"u")&&(u.type===e.type||typeof e.type>"u"))if(u.constructed===e.constructed||typeof e.constructed>"u"){if(i=!0,e.value&&we.util.isArray(e.value))for(var s=0,a=0;i&&a0&&(r+=` +`);for(var i="",s=0;s1?r+="0x"+we.util.bytesToHex(u.value.slice(1)):r+="(none)",u.value.length>0){var f=u.value.charCodeAt(0);f==1?r+=" (1 unused bit shown)":f>1&&(r+=" ("+f+" unused bits shown)")}}else if(u.type===n0.Type.OCTETSTRING)XU.test(u.value)||(r+="("+u.value+") "),r+="0x"+we.util.bytesToHex(u.value);else if(u.type===n0.Type.UTF8)try{r+=we.util.decodeUtf8(u.value)}catch(d){if(d.message==="URI malformed")r+="0x"+we.util.bytesToHex(u.value)+" (malformed UTF8)";else throw d}else u.type===n0.Type.PRINTABLESTRING||u.type===n0.Type.IA5String?r+=u.value:XU.test(u.value)?r+="0x"+we.util.bytesToHex(u.value):u.value.length===0?r+="[null]":r+=u.value}return r}});var li=w((Yh0,eP)=>{var Ty=K0();eP.exports=Ty.md=Ty.md||{};Ty.md.algorithms=Ty.md.algorithms||{}});var ko=w((Qh0,tP)=>{var qi=K0();li();X0();var BZ=tP.exports=qi.hmac=qi.hmac||{};BZ.create=function(){var u=null,e=null,t=null,r=null,i={};return i.start=function(s,a){if(s!==null)if(typeof s=="string")if(s=s.toLowerCase(),s in qi.md.algorithms)e=qi.md.algorithms[s].create();else throw new Error('Unknown hash algorithm "'+s+'"');else e=s;if(a===null)a=u;else{if(typeof a=="string")a=qi.util.createBuffer(a);else if(qi.util.isArray(a)){var o=a;a=qi.util.createBuffer();for(var h=0;he.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),t=qi.util.createBuffer(),r=qi.util.createBuffer(),f=a.length();for(var h=0;h{var hi=K0();li();X0();var rP=sP.exports=hi.md5=hi.md5||{};hi.md.md5=hi.md.algorithms.md5=rP;rP.create=function(){iP||DZ();var u=null,e=hi.util.createBuffer(),t=new Array(16),r={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s>>0,a>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=a[1],a[1]=a[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(i),uP(u,t,e),(e.read>2048||e.length()===0)&&e.compact(),r},r.digest=function(){var i=hi.util.createBuffer();i.putBytes(e.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,a=s&r.blockLength-1;i.putBytes(fC.substr(0,r.blockLength-a));for(var o,h=0,f=r.fullMessageLength.length-1;f>=0;--f)o=r.fullMessageLength[f]*8+h,h=o/4294967296>>>0,i.putInt32Le(o>>>0);var d={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3};uP(d,t,i);var p=hi.util.createBuffer();return p.putInt32Le(d.h0),p.putInt32Le(d.h1),p.putInt32Le(d.h2),p.putInt32Le(d.h3),p},r};var fC=null,by=null,qh=null,Bo=null,iP=!1;function DZ(){fC="\x80",fC+=hi.util.fillString("\0",64),by=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],qh=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],Bo=new Array(64);for(var u=0;u<64;++u)Bo[u]=Math.floor(Math.abs(Math.sin(u+1))*4294967296);iP=!0}c(DZ,"_init");function uP(u,e,t){for(var r,i,s,a,o,h,f,d,p=t.length();p>=64;){for(i=u.h0,s=u.h1,a=u.h2,o=u.h3,d=0;d<16;++d)e[d]=t.getInt32Le(),h=o^s&(a^o),r=i+h+Bo[d]+e[d],f=qh[d],i=o,o=a,a=s,s+=r<>>32-f;for(;d<32;++d)h=a^o&(s^a),r=i+h+Bo[d]+e[by[d]],f=qh[d],i=o,o=a,a=s,s+=r<>>32-f;for(;d<48;++d)h=s^a^o,r=i+h+Bo[d]+e[by[d]],f=qh[d],i=o,o=a,a=s,s+=r<>>32-f;for(;d<64;++d)h=a^(s|~o),r=i+h+Bo[d]+e[by[d]],f=qh[d],i=o,o=a,a=s,s+=r<>>32-f;u.h0=u.h0+i|0,u.h1=u.h1+s|0,u.h2=u.h2+a|0,u.h3=u.h3+o|0,p-=64}}c(uP,"_update")});var Qn=w((Zh0,aP)=>{var Ry=K0();X0();var nP=aP.exports=Ry.pem=Ry.pem||{};nP.encode=function(u,e){e=e||{};var t="-----BEGIN "+u.type+`-----\r +`,r;if(u.procType&&(r={name:"Proc-Type",values:[String(u.procType.version),u.procType.type]},t+=Cy(r)),u.contentDomain&&(r={name:"Content-Domain",values:[u.contentDomain]},t+=Cy(r)),u.dekInfo&&(r={name:"DEK-Info",values:[u.dekInfo.algorithm]},u.dekInfo.parameters&&r.values.push(u.dekInfo.parameters),t+=Cy(r)),u.headers)for(var i=0;i65&&a!==-1){var o=e[a];o===","?(++a,e=e.substr(0,a)+`\r + `+e.substr(a)):e=e.substr(0,a)+`\r +`+o+e.substr(a+1),s=i-a-1,a=-1,++i}else(e[i]===" "||e[i]===" "||e[i]===",")&&(a=i);return e}c(Cy,"foldHeader");function FZ(u){return u.replace(/^\s+/,"")}c(FZ,"ltrim")});var Vh=w((Jh0,cP)=>{var Se=K0();yy();aC();X0();cP.exports=Se.des=Se.des||{};Se.des.startEncrypting=function(u,e,t,r){var i=Ay({key:u,output:t,decrypt:!1,mode:r||(e===null?"ECB":"CBC")});return i.start(e),i};Se.des.createEncryptionCipher=function(u,e){return Ay({key:u,output:null,decrypt:!1,mode:e})};Se.des.startDecrypting=function(u,e,t,r){var i=Ay({key:u,output:t,decrypt:!0,mode:r||(e===null?"ECB":"CBC")});return i.start(e),i};Se.des.createDecryptionCipher=function(u,e){return Ay({key:u,output:null,decrypt:!0,mode:e})};Se.des.Algorithm=function(u,e){var t=this;t.name=u,t.mode=new e({blockSize:8,cipher:{encrypt:function(r,i){return oP(t._keys,r,i,!1)},decrypt:function(r,i){return oP(t._keys,r,i,!0)}}}),t._init=!1};Se.des.Algorithm.prototype.initialize=function(u){if(!this._init){var e=Se.util.createBuffer(u.key);if(this.name.indexOf("3DES")===0&&e.length()!==24)throw new Error("Invalid Triple-DES key size: "+e.length()*8);this._keys=QZ(e),this._init=!0}};fi("DES-ECB",Se.cipher.modes.ecb);fi("DES-CBC",Se.cipher.modes.cbc);fi("DES-CFB",Se.cipher.modes.cfb);fi("DES-OFB",Se.cipher.modes.ofb);fi("DES-CTR",Se.cipher.modes.ctr);fi("3DES-ECB",Se.cipher.modes.ecb);fi("3DES-CBC",Se.cipher.modes.cbc);fi("3DES-CFB",Se.cipher.modes.cfb);fi("3DES-OFB",Se.cipher.modes.ofb);fi("3DES-CTR",Se.cipher.modes.ctr);function fi(u,e){var t=c(function(){return new Se.des.Algorithm(u,e)},"factory");Se.cipher.registerAlgorithm(u,t)}c(fi,"registerAlgorithm");var MZ=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],HZ=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],qZ=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],VZ=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],GZ=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],WZ=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],zZ=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],YZ=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function QZ(u){for(var e=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],t=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],r=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],a=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],o=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],h=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],f=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],d=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],p=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],E=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],x=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],m=u.length()>8?3:1,A=[],T=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],I=0,L,N=0;N>>4^M)&252645135,M^=L,k^=L<<4,L=(M>>>-16^k)&65535,k^=L,M^=L<<-16,L=(k>>>2^M)&858993459,M^=L,k^=L<<2,L=(M>>>-16^k)&65535,k^=L,M^=L<<-16,L=(k>>>1^M)&1431655765,M^=L,k^=L<<1,L=(M>>>8^k)&16711935,k^=L,M^=L<<8,L=(k>>>1^M)&1431655765,M^=L,k^=L<<1,L=k<<8|M>>>20&240,k=M<<24|M<<8&16711680|M>>>8&65280|M>>>24&240,M=L;for(var X=0;X>>26,M=M<<2|M>>>26):(k=k<<1|k>>>27,M=M<<1|M>>>27),k&=-15,M&=-15;var u0=e[k>>>28]|t[k>>>24&15]|r[k>>>20&15]|i[k>>>16&15]|s[k>>>12&15]|a[k>>>8&15]|o[k>>>4&15],h0=h[M>>>28]|f[M>>>24&15]|d[M>>>20&15]|p[M>>>16&15]|E[M>>>12&15]|x[M>>>8&15]|g[M>>>4&15];L=(h0>>>16^u0)&65535,A[I++]=u0^L,A[I++]=h0^L<<16}}return A}c(QZ,"_createKeys");function oP(u,e,t,r){var i=u.length===32?3:9,s;i===3?s=r?[30,-2,-2]:[0,32,2]:s=r?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var a,o=e[0],h=e[1];a=(o>>>4^h)&252645135,h^=a,o^=a<<4,a=(o>>>16^h)&65535,h^=a,o^=a<<16,a=(h>>>2^o)&858993459,o^=a,h^=a<<2,a=(h>>>8^o)&16711935,o^=a,h^=a<<8,a=(o>>>1^h)&1431655765,h^=a,o^=a<<1,o=o<<1|o>>>31,h=h<<1|h>>>31;for(var f=0;f>>4|h<<28)^u[E+1];a=o,o=h,h=a^(HZ[x>>>24&63]|VZ[x>>>16&63]|WZ[x>>>8&63]|YZ[x&63]|MZ[g>>>24&63]|qZ[g>>>16&63]|GZ[g>>>8&63]|zZ[g&63])}a=o,o=h,h=a}o=o>>>1|o<<31,h=h>>>1|h<<31,a=(o>>>1^h)&1431655765,h^=a,o^=a<<1,a=(h>>>8^o)&16711935,o^=a,h^=a<<8,a=(h>>>2^o)&858993459,o^=a,h^=a<<2,a=(o>>>16^h)&65535,h^=a,o^=a<<16,a=(o>>>4^h)&252645135,h^=a,o^=a<<4,t[0]=o,t[1]=h}c(oP,"_updateBlock");function Ay(u){u=u||{};var e=(u.mode||"CBC").toUpperCase(),t="DES-"+e,r;u.decrypt?r=Se.cipher.createDecipher(t,u.key):r=Se.cipher.createCipher(t,u.key);var i=r.start;return r.start=function(s,a){var o=null;a instanceof Se.util.ByteBuffer&&(o=a,a={}),a=a||{},a.output=o,a.iv=s,i.call(r,a)},r}c(Ay,"_createCipher")});var wy=w((tf0,lP)=>{var fu=K0();ko();li();X0();var jZ=fu.pkcs5=fu.pkcs5||{},Vi;fu.util.isNodejs&&!fu.options.usePureJavaScript&&(Vi=require("crypto"));lP.exports=fu.pbkdf2=jZ.pbkdf2=function(u,e,t,r,i,s){if(typeof i=="function"&&(s=i,i=null),fu.util.isNodejs&&!fu.options.usePureJavaScript&&Vi.pbkdf2&&(i===null||typeof i!="object")&&(Vi.pbkdf2Sync.length>4||!i||i==="sha1"))return typeof i!="string"&&(i="sha1"),u=Buffer.from(u,"binary"),e=Buffer.from(e,"binary"),s?Vi.pbkdf2Sync.length===4?Vi.pbkdf2(u,e,t,r,function(L,N){if(L)return s(L);s(null,N.toString("binary"))}):Vi.pbkdf2(u,e,t,r,i,function(L,N){if(L)return s(L);s(null,N.toString("binary"))}):Vi.pbkdf2Sync.length===4?Vi.pbkdf2Sync(u,e,t,r).toString("binary"):Vi.pbkdf2Sync(u,e,t,r,i).toString("binary");if((typeof i>"u"||i===null)&&(i="sha1"),typeof i=="string"){if(!(i in fu.md.algorithms))throw new Error("Unknown hash algorithm: "+i);i=fu.md[i].create()}var a=i.digestLength;if(r>4294967295*a){var o=new Error("Derived key is too long.");if(s)return s(o);throw o}var h=Math.ceil(r/a),f=r-(h-1)*a,d=fu.hmac.create();d.start(i,u);var p="",E,x,g;if(!s){for(var m=1;m<=h;++m){d.start(null,null),d.update(e),d.update(fu.util.int32ToBytes(m)),E=g=d.digest().getBytes();for(var A=2;A<=t;++A)d.start(null,null),d.update(g),x=d.digest().getBytes(),E=fu.util.xorBytes(E,x,a),g=x;p+=mh)return s(null,p);d.start(null,null),d.update(e),d.update(fu.util.int32ToBytes(m)),E=g=d.digest().getBytes(),A=2,I()}c(T,"outer");function I(){if(A<=t)return d.start(null,null),d.update(g),x=d.digest().getBytes(),E=fu.util.xorBytes(E,x,a),g=x,++A,fu.util.setImmediate(I);p+=m{var di=K0();li();X0();var fP=yP.exports=di.sha256=di.sha256||{};di.md.sha256=di.md.algorithms.sha256=fP;fP.create=function(){dP||$Z();var u=null,e=di.util.createBuffer(),t=new Array(64),r={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s>>0,a>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=a[1],a[1]=a[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(i),hP(u,t,e),(e.read>2048||e.length()===0)&&e.compact(),r},r.digest=function(){var i=di.util.createBuffer();i.putBytes(e.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,a=s&r.blockLength-1;i.putBytes(dC.substr(0,r.blockLength-a));for(var o,h,f=r.fullMessageLength[0]*8,d=0;d>>0,f+=h,i.putInt32(f>>>0),f=o>>>0;i.putInt32(f);var p={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3,h4:u.h4,h5:u.h5,h6:u.h6,h7:u.h7};hP(p,t,i);var E=di.util.createBuffer();return E.putInt32(p.h0),E.putInt32(p.h1),E.putInt32(p.h2),E.putInt32(p.h3),E.putInt32(p.h4),E.putInt32(p.h5),E.putInt32(p.h6),E.putInt32(p.h7),E},r};var dC=null,dP=!1,pP=null;function $Z(){dC="\x80",dC+=di.util.fillString("\0",64),pP=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],dP=!0}c($Z,"_init");function hP(u,e,t){for(var r,i,s,a,o,h,f,d,p,E,x,g,m,A,T,I=t.length();I>=64;){for(f=0;f<16;++f)e[f]=t.getInt32();for(;f<64;++f)r=e[f-2],r=(r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10,i=e[f-15],i=(i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[f]=r+e[f-7]+i+e[f-16]|0;for(d=u.h0,p=u.h1,E=u.h2,x=u.h3,g=u.h4,m=u.h5,A=u.h6,T=u.h7,f=0;f<64;++f)a=(g>>>6|g<<26)^(g>>>11|g<<21)^(g>>>25|g<<7),o=A^g&(m^A),s=(d>>>2|d<<30)^(d>>>13|d<<19)^(d>>>22|d<<10),h=d&p|E&(d^p),r=T+a+o+pP[f]+e[f],i=s+h,T=A,A=m,m=g,g=x+r>>>0,x=E,E=p,p=d,d=r+i>>>0;u.h0=u.h0+d|0,u.h1=u.h1+p|0,u.h2=u.h2+E|0,u.h3=u.h3+x|0,u.h4=u.h4+g|0,u.h5=u.h5+m|0,u.h6=u.h6+A|0,u.h7=u.h7+T|0,I-=64}}c(hP,"_update")});var yC=w((sf0,gP)=>{var pi=K0();X0();var vy=null;pi.util.isNodejs&&!pi.options.usePureJavaScript&&!process.versions["node-webkit"]&&(vy=require("crypto"));var ZZ=gP.exports=pi.prng=pi.prng||{};ZZ.create=function(u){for(var e={plugin:u,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},t=u.md,r=new Array(32),i=0;i<32;++i)r[i]=t.create();e.pools=r,e.pool=0,e.generate=function(f,d){if(!d)return e.generateSync(f);var p=e.plugin.cipher,E=e.plugin.increment,x=e.plugin.formatKey,g=e.plugin.formatSeed,m=pi.util.createBuffer();e.key=null,A();function A(T){if(T)return d(T);if(m.length()>=f)return d(null,m.getBytes(f));if(e.generated>1048575&&(e.key=null),e.key===null)return pi.util.nextTick(function(){s(A)});var I=p(e.key,e.seed);e.generated+=I.length,m.putBytes(I),e.key=x(p(e.key,E(e.seed))),e.seed=g(p(e.key,e.seed)),pi.util.setImmediate(A)}c(A,"generate")},e.generateSync=function(f){var d=e.plugin.cipher,p=e.plugin.increment,E=e.plugin.formatKey,x=e.plugin.formatSeed;e.key=null;for(var g=pi.util.createBuffer();g.length()1048575&&(e.key=null),e.key===null&&a();var m=d(e.key,e.seed);e.generated+=m.length,g.putBytes(m),e.key=E(d(e.key,p(e.seed))),e.seed=x(d(e.key,e.seed))}return g.getBytes(f)};function s(f){if(e.pools[0].messageLength>=32)return o(),f();var d=32-e.pools[0].messageLength<<5;e.seedFile(d,function(p,E){if(p)return f(p);e.collect(E),o(),f()})}c(s,"_reseed");function a(){if(e.pools[0].messageLength>=32)return o();var f=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(f)),o()}c(a,"_reseedSync");function o(){e.reseeds=e.reseeds===4294967295?0:e.reseeds+1;var f=e.plugin.md.create();f.update(e.keyBytes);for(var d=1,p=0;p<32;++p)e.reseeds%d===0&&(f.update(e.pools[p].digest().getBytes()),e.pools[p].start()),d=d<<1;e.keyBytes=f.digest().getBytes(),f.start(),f.update(e.keyBytes);var E=f.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(E),e.generated=0}c(o,"_seed");function h(f){var d=null,p=pi.util.globalScope,E=p.crypto||p.msCrypto;E&&E.getRandomValues&&(d=c(function(k){return E.getRandomValues(k)},"getRandomValues"));var x=pi.util.createBuffer();if(d)for(;x.length()>16),I+=(T&32767)<<16,I+=T>>15,I=(I&2147483647)+(I>>31),N=I&4294967295;for(var A=0;A<3;++A)L=N>>>(A<<3),L^=Math.floor(Math.random()*256),x.putByte(L&255)}return x.getBytes(f)}return c(h,"defaultSeedFile"),vy?(e.seedFile=function(f,d){vy.randomBytes(f,function(p,E){if(p)return d(p);d(null,E.toString())})},e.seedFileSync=function(f){return vy.randomBytes(f).toString()}):(e.seedFile=function(f,d){try{d(null,h(f))}catch(p){d(p)}},e.seedFileSync=h),e.collect=function(f){for(var d=f.length,p=0;p>E&255);e.collect(p)},e.registerWorker=function(f){if(f===self)e.seedFile=function(p,E){function x(g){var m=g.data;m.forge&&m.forge.prng&&(self.removeEventListener("message",x),E(m.forge.prng.err,m.forge.prng.bytes))}c(x,"listener"),self.addEventListener("message",x),self.postMessage({forge:{prng:{needed:p}}})};else{var d=c(function(p){var E=p.data;E.forge&&E.forge.prng&&e.seedFile(E.forge.prng.needed,function(x,g){f.postMessage({forge:{prng:{err:x,bytes:g}}})})},"listener");f.addEventListener("message",d)}},e}});var lr=w((af0,gC)=>{var _t=K0();Ks();pC();yC();X0();(function(){if(_t.random&&_t.random.getBytes){gC.exports=_t.random;return}(function(u){var e={},t=new Array(4),r=_t.util.createBuffer();e.formatKey=function(p){var E=_t.util.createBuffer(p);return p=new Array(4),p[0]=E.getInt32(),p[1]=E.getInt32(),p[2]=E.getInt32(),p[3]=E.getInt32(),_t.aes._expandKey(p,!1)},e.formatSeed=function(p){var E=_t.util.createBuffer(p);return p=new Array(4),p[0]=E.getInt32(),p[1]=E.getInt32(),p[2]=E.getInt32(),p[3]=E.getInt32(),p},e.cipher=function(p,E){return _t.aes._updateBlock(p,E,t,!1),r.putInt32(t[0]),r.putInt32(t[1]),r.putInt32(t[2]),r.putInt32(t[3]),r.getBytes()},e.increment=function(p){return++p[3],p},e.md=_t.md.sha256;function i(){var p=_t.prng.create(e);return p.getBytes=function(E,x){return p.generate(E,x)},p.getBytesSync=function(E){return p.generate(E)},p}c(i,"spawnPrng");var s=i(),a=null,o=_t.util.globalScope,h=o.crypto||o.msCrypto;if(h&&h.getRandomValues&&(a=c(function(p){return h.getRandomValues(p)},"getRandomValues")),_t.options.usePureJavaScript||!_t.util.isNodejs&&!a){if(typeof window>"u"||window.document,s.collectInt(+new Date,32),typeof navigator<"u"){var f="";for(var d in navigator)try{typeof navigator[d]=="string"&&(f+=navigator[d])}catch{}s.collect(f),f=null}u&&(u().mousemove(function(p){s.collectInt(p.clientX,16),s.collectInt(p.clientY,16)}),u().keypress(function(p){s.collectInt(p.charCode,8)}))}if(!_t.random)_t.random=s;else for(var d in s)_t.random[d]=s[d];_t.random.createInstance=i,gC.exports=_t.random})(typeof jQuery<"u"?jQuery:null)})()});var mC=w((cf0,xP)=>{var Uu=K0();X0();var EC=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],EP=[1,2,3,5],XZ=c(function(u,e){return u<>16-e},"rol"),JZ=c(function(u,e){return(u&65535)>>e|u<<16-e&65535},"ror");xP.exports=Uu.rc2=Uu.rc2||{};Uu.rc2.expandKey=function(u,e){typeof u=="string"&&(u=Uu.util.createBuffer(u)),e=e||128;var t=u,r=u.length(),i=e,s=Math.ceil(i/8),a=255>>(i&7),o;for(o=r;o<128;o++)t.putByte(EC[t.at(o-1)+t.at(o-r)&255]);for(t.setAt(128-s,EC[t.at(128-s)&a]),o=127-s;o>=0;o--)t.setAt(o,EC[t.at(o+1)^t.at(o+s)]);return t};var mP=c(function(u,e,t){var r=!1,i=null,s=null,a=null,o,h,f,d,p=[];for(u=Uu.rc2.expandKey(u,e),f=0;f<64;f++)p.push(u.getInt16Le());t?(o=c(function(g){for(f=0;f<4;f++)g[f]+=p[d]+(g[(f+3)%4]&g[(f+2)%4])+(~g[(f+3)%4]&g[(f+1)%4]),g[f]=XZ(g[f],EP[f]),d++},"mixRound"),h=c(function(g){for(f=0;f<4;f++)g[f]+=p[g[(f+3)%4]&63]},"mashRound")):(o=c(function(g){for(f=3;f>=0;f--)g[f]=JZ(g[f],EP[f]),g[f]-=p[d]+(g[(f+3)%4]&g[(f+2)%4])+(~g[(f+3)%4]&g[(f+1)%4]),d--},"mixRound"),h=c(function(g){for(f=3;f>=0;f--)g[f]-=p[g[(f+3)%4]&63]},"mashRound"));var E=c(function(g){var m=[];for(f=0;f<4;f++){var A=i.getInt16Le();a!==null&&(t?A^=a.getInt16Le():a.putInt16Le(A)),m.push(A&65535)}d=t?0:63;for(var T=0;T=8;)E([[5,o],[1,h],[6,o],[1,h],[5,o]])},finish:function(g){var m=!0;if(t)if(g)m=g(8,i,!t);else{var A=i.length()===8?8:8-i.length();i.fillWithByte(A,A)}if(m&&(r=!0,x.update()),!t&&(m=i.length()===0,m))if(g)m=g(8,s,!t);else{var T=s.length(),I=s.at(T-1);I>T?m=!1:s.truncate(I)}return m}},x},"createCipher");Uu.rc2.startEncrypting=function(u,e,t){var r=Uu.rc2.createEncryptionCipher(u,128);return r.start(e,t),r};Uu.rc2.createEncryptionCipher=function(u,e){return mP(u,e,!0)};Uu.rc2.startDecrypting=function(u,e,t){var r=Uu.rc2.createDecryptionCipher(u,128);return r.start(e,t),r};Uu.rc2.createDecryptionCipher=function(u,e){return mP(u,e,!1)}});var Wh=w((hf0,vP)=>{var xC=K0();vP.exports=xC.jsbn=xC.jsbn||{};var Gi,eX=0xdeadbeefcafe,TP=(eX&16777215)==15715070;function Y(u,e,t){this.data=[],u!=null&&(typeof u=="number"?this.fromNumber(u,e,t):e==null&&typeof u!="string"?this.fromString(u,256):this.fromString(u,e))}c(Y,"BigInteger");xC.jsbn.BigInteger=Y;function J0(){return new Y(null)}c(J0,"nbi");function tX(u,e,t,r,i,s){for(;--s>=0;){var a=e*this.data[u++]+t.data[r]+i;i=Math.floor(a/67108864),t.data[r++]=a&67108863}return i}c(tX,"am1");function uX(u,e,t,r,i,s){for(var a=e&32767,o=e>>15;--s>=0;){var h=this.data[u]&32767,f=this.data[u++]>>15,d=o*h+f*a;h=a*h+((d&32767)<<15)+t.data[r]+(i&1073741823),i=(h>>>30)+(d>>>15)+o*f+(i>>>30),t.data[r++]=h&1073741823}return i}c(uX,"am2");function bP(u,e,t,r,i,s){for(var a=e&16383,o=e>>14;--s>=0;){var h=this.data[u]&16383,f=this.data[u++]>>14,d=o*h+f*a;h=a*h+((d&16383)<<14)+t.data[r]+i,i=(h>>28)+(d>>14)+o*f,t.data[r++]=h&268435455}return i}c(bP,"am3");typeof navigator>"u"?(Y.prototype.am=bP,Gi=28):TP&&navigator.appName=="Microsoft Internet Explorer"?(Y.prototype.am=uX,Gi=30):TP&&navigator.appName!="Netscape"?(Y.prototype.am=tX,Gi=26):(Y.prototype.am=bP,Gi=28);Y.prototype.DB=Gi;Y.prototype.DM=(1<=0;--e)u.data[e]=this.data[e];u.t=this.t,u.s=this.s}c(iX,"bnpCopyTo");function sX(u){this.t=1,this.s=u<0?-1:0,u>0?this.data[0]=u:u<-1?this.data[0]=u+this.DV:this.t=0}c(sX,"bnpFromInt");function Ns(u){var e=J0();return e.fromInt(u),e}c(Ns,"nbv");function nX(u,e){var t;if(e==16)t=4;else if(e==8)t=3;else if(e==256)t=8;else if(e==2)t=1;else if(e==32)t=5;else if(e==4)t=2;else{this.fromRadix(u,e);return}this.t=0,this.s=0;for(var r=u.length,i=!1,s=0;--r>=0;){var a=t==8?u[r]&255:CP(u,r);if(a<0){u.charAt(r)=="-"&&(i=!0);continue}i=!1,s==0?this.data[this.t++]=a:s+t>this.DB?(this.data[this.t-1]|=(a&(1<>this.DB-s):this.data[this.t-1]|=a<=this.DB&&(s-=this.DB)}t==8&&u[0]&128&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==u;)--this.t}c(aX,"bnpClamp");function oX(u){if(this.s<0)return"-"+this.negate().toString(u);var e;if(u==16)e=4;else if(u==8)e=3;else if(u==2)e=1;else if(u==32)e=5;else if(u==4)e=2;else return this.toRadix(u);var t=(1<0)for(o>o)>0&&(i=!0,s=_P(r));a>=0;)o>(o+=this.DB-e)):(r=this.data[a]>>(o-=e)&t,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=_P(r));return i?s:"0"}c(oX,"bnToString");function cX(){var u=J0();return Y.ZERO.subTo(this,u),u}c(cX,"bnNegate");function lX(){return this.s<0?this.negate():this}c(lX,"bnAbs");function hX(u){var e=this.s-u.s;if(e!=0)return e;var t=this.t;if(e=t-u.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this.data[t]-u.data[t])!=0)return e;return 0}c(hX,"bnCompareTo");function Ly(u){var e=1,t;return(t=u>>>16)!=0&&(u=t,e+=16),(t=u>>8)!=0&&(u=t,e+=8),(t=u>>4)!=0&&(u=t,e+=4),(t=u>>2)!=0&&(u=t,e+=2),(t=u>>1)!=0&&(u=t,e+=1),e}c(Ly,"nbits");function fX(){return this.t<=0?0:this.DB*(this.t-1)+Ly(this.data[this.t-1]^this.s&this.DM)}c(fX,"bnBitLength");function dX(u,e){var t;for(t=this.t-1;t>=0;--t)e.data[t+u]=this.data[t];for(t=u-1;t>=0;--t)e.data[t]=0;e.t=this.t+u,e.s=this.s}c(dX,"bnpDLShiftTo");function pX(u,e){for(var t=u;t=0;--o)e.data[o+s+1]=this.data[o]>>r|a,a=(this.data[o]&i)<=0;--o)e.data[o]=0;e.data[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}c(yX,"bnpLShiftTo");function gX(u,e){e.s=this.s;var t=Math.floor(u/this.DB);if(t>=this.t){e.t=0;return}var r=u%this.DB,i=this.DB-r,s=(1<>r;for(var a=t+1;a>r;r>0&&(e.data[this.t-t-1]|=(this.s&s)<>=this.DB;if(u.t>=this.DB;r+=this.s}else{for(r+=this.s;t>=this.DB;r-=u.s}e.s=r<0?-1:0,r<-1?e.data[t++]=this.DV+r:r>0&&(e.data[t++]=r),e.t=t,e.clamp()}c(EX,"bnpSubTo");function mX(u,e){var t=this.abs(),r=u.abs(),i=t.t;for(e.t=i+r.t;--i>=0;)e.data[i]=0;for(i=0;i=0;)u.data[t]=0;for(t=0;t=e.DV&&(u.data[t+e.t]-=e.DV,u.data[t+e.t+1]=1)}u.t>0&&(u.data[u.t-1]+=e.am(t,e.data[t],u,2*t,0,1)),u.s=0,u.clamp()}c(xX,"bnpSquareTo");function TX(u,e,t){var r=u.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(h,s),i.lShiftTo(h,t)):(r.copyTo(s),i.copyTo(t));var f=s.t,d=s.data[f-1];if(d!=0){var p=d*(1<1?s.data[f-2]>>this.F2:0),E=this.FV/p,x=(1<=0&&(t.data[t.t++]=1,t.subTo(T,t)),Y.ONE.dlShiftTo(f,T),T.subTo(s,s);s.t=0;){var I=t.data[--m]==d?this.DM:Math.floor(t.data[m]*E+(t.data[m-1]+g)*x);if((t.data[m]+=s.am(0,I,t,A,0,f))0&&t.rShiftTo(h,t),a<0&&Y.ZERO.subTo(t,t)}}}c(TX,"bnpDivRemTo");function bX(u){var e=J0();return this.abs().divRemTo(u,null,e),this.s<0&&e.compareTo(Y.ZERO)>0&&u.subTo(e,e),e}c(bX,"bnMod");function jn(u){this.m=u}c(jn,"Classic");function _X(u){return u.s<0||u.compareTo(this.m)>=0?u.mod(this.m):u}c(_X,"cConvert");function CX(u){return u}c(CX,"cRevert");function RX(u){u.divRemTo(this.m,null,u)}c(RX,"cReduce");function AX(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(AX,"cMulTo");function wX(u,e){u.squareTo(e),this.reduce(e)}c(wX,"cSqrTo");jn.prototype.convert=_X;jn.prototype.revert=CX;jn.prototype.reduce=RX;jn.prototype.mulTo=AX;jn.prototype.sqrTo=wX;function vX(){if(this.t<1)return 0;var u=this.data[0];if(!(u&1))return 0;var e=u&3;return e=e*(2-(u&15)*e)&15,e=e*(2-(u&255)*e)&255,e=e*(2-((u&65535)*e&65535))&65535,e=e*(2-u*e%this.DV)%this.DV,e>0?this.DV-e:-e}c(vX,"bnpInvDigit");function $n(u){this.m=u,this.mp=u.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}c(IX,"montConvert");function LX(u){var e=J0();return u.copyTo(e),this.reduce(e),e}c(LX,"montRevert");function SX(u){for(;u.t<=this.mt2;)u.data[u.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&u.DM;for(t=e+this.m.t,u.data[t]+=this.m.am(0,r,u,e,0,this.m.t);u.data[t]>=u.DV;)u.data[t]-=u.DV,u.data[++t]++}u.clamp(),u.drShiftTo(this.m.t,u),u.compareTo(this.m)>=0&&u.subTo(this.m,u)}c(SX,"montReduce");function KX(u,e){u.squareTo(e),this.reduce(e)}c(KX,"montSqrTo");function OX(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(OX,"montMulTo");$n.prototype.convert=IX;$n.prototype.revert=LX;$n.prototype.reduce=SX;$n.prototype.mulTo=OX;$n.prototype.sqrTo=KX;function NX(){return(this.t>0?this.data[0]&1:this.s)==0}c(NX,"bnpIsEven");function UX(u,e){if(u>4294967295||u<1)return Y.ONE;var t=J0(),r=J0(),i=e.convert(this),s=Ly(u)-1;for(i.copyTo(t);--s>=0;)if(e.sqrTo(t,r),(u&1<0)e.mulTo(r,i,t);else{var a=t;t=r,r=a}return e.revert(t)}c(UX,"bnpExp");function PX(u,e){var t;return u<256||e.isEven()?t=new jn(e):t=new $n(e),this.exp(u,t)}c(PX,"bnModPowInt");Y.prototype.copyTo=iX;Y.prototype.fromInt=sX;Y.prototype.fromString=nX;Y.prototype.clamp=aX;Y.prototype.dlShiftTo=dX;Y.prototype.drShiftTo=pX;Y.prototype.lShiftTo=yX;Y.prototype.rShiftTo=gX;Y.prototype.subTo=EX;Y.prototype.multiplyTo=mX;Y.prototype.squareTo=xX;Y.prototype.divRemTo=TX;Y.prototype.invDigit=vX;Y.prototype.isEven=NX;Y.prototype.exp=UX;Y.prototype.toString=oX;Y.prototype.negate=cX;Y.prototype.abs=lX;Y.prototype.compareTo=hX;Y.prototype.bitLength=fX;Y.prototype.mod=bX;Y.prototype.modPowInt=PX;Y.ZERO=Ns(0);Y.ONE=Ns(1);function kX(){var u=J0();return this.copyTo(u),u}c(kX,"bnClone");function BX(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<>24}c(DX,"bnByteValue");function FX(){return this.t==0?this.s:this.data[0]<<16>>16}c(FX,"bnShortValue");function MX(u){return Math.floor(Math.LN2*this.DB/Math.log(u))}c(MX,"bnpChunkSize");function HX(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}c(HX,"bnSigNum");function qX(u){if(u==null&&(u=10),this.signum()==0||u<2||u>36)return"0";var e=this.chunkSize(u),t=Math.pow(u,e),r=Ns(t),i=J0(),s=J0(),a="";for(this.divRemTo(r,i,s);i.signum()>0;)a=(t+s.intValue()).toString(u).substr(1)+a,i.divRemTo(r,i,s);return s.intValue().toString(u)+a}c(qX,"bnpToRadix");function VX(u,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),r=Math.pow(e,t),i=!1,s=0,a=0,o=0;o=t&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&Y.ZERO.subTo(this,this)}c(VX,"bnpFromRadix");function GX(u,e,t){if(typeof e=="number")if(u<2)this.fromInt(1);else for(this.fromNumber(u,t),this.testBit(u-1)||this.bitwiseTo(Y.ONE.shiftLeft(u-1),bC,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>u&&this.subTo(Y.ONE.shiftLeft(u-1),this);else{var r=new Array,i=u&7;r.length=(u>>3)+1,e.nextBytes(r),i>0?r[0]&=(1<0)for(t>t)!=(this.s&this.DM)>>t&&(e[i++]=r|this.s<=0;)t<8?(r=(this.data[u]&(1<>(t+=this.DB-8)):(r=this.data[u]>>(t-=8)&255,t<=0&&(t+=this.DB,--u)),r&128&&(r|=-256),i==0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}c(WX,"bnToByteArray");function zX(u){return this.compareTo(u)==0}c(zX,"bnEquals");function YX(u){return this.compareTo(u)<0?this:u}c(YX,"bnMin");function QX(u){return this.compareTo(u)>0?this:u}c(QX,"bnMax");function jX(u,e,t){var r,i,s=Math.min(u.t,this.t);for(r=0;r>=16,e+=16),u&255||(u>>=8,e+=8),u&15||(u>>=4,e+=4),u&3||(u>>=2,e+=2),u&1||++e,e}c(iJ,"lbit");function sJ(){for(var u=0;u=this.t?this.s!=0:(this.data[e]&1<>=this.DB;if(u.t>=this.DB;r+=this.s}else{for(r+=this.s;t>=this.DB;r+=u.s}e.s=r<0?-1:0,r>0?e.data[t++]=r:r<-1&&(e.data[t++]=this.DV+r),e.t=t,e.clamp()}c(dJ,"bnpAddTo");function pJ(u){var e=J0();return this.addTo(u,e),e}c(pJ,"bnAdd");function yJ(u){var e=J0();return this.subTo(u,e),e}c(yJ,"bnSubtract");function gJ(u){var e=J0();return this.multiplyTo(u,e),e}c(gJ,"bnMultiply");function EJ(u){var e=J0();return this.divRemTo(u,e,null),e}c(EJ,"bnDivide");function mJ(u){var e=J0();return this.divRemTo(u,null,e),e}c(mJ,"bnRemainder");function xJ(u){var e=J0(),t=J0();return this.divRemTo(u,e,t),new Array(e,t)}c(xJ,"bnDivideAndRemainder");function TJ(u){this.data[this.t]=this.am(0,u-1,this,0,0,this.t),++this.t,this.clamp()}c(TJ,"bnpDMultiply");function bJ(u,e){if(u!=0){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=u;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}}c(bJ,"bnpDAddOffset");function Gh(){}c(Gh,"NullExp");function wP(u){return u}c(wP,"nNop");function _J(u,e,t){u.multiplyTo(e,t)}c(_J,"nMulTo");function CJ(u,e){u.squareTo(e)}c(CJ,"nSqrTo");Gh.prototype.convert=wP;Gh.prototype.revert=wP;Gh.prototype.mulTo=_J;Gh.prototype.sqrTo=CJ;function RJ(u){return this.exp(u,new Gh)}c(RJ,"bnPow");function AJ(u,e,t){var r=Math.min(this.t+u.t,e);for(t.s=0,t.t=r;r>0;)t.data[--r]=0;var i;for(i=t.t-this.t;r=0;)t.data[r]=0;for(r=Math.max(e-this.t,0);r2*this.m.t)return u.mod(this.m);if(u.compareTo(this.m)<0)return u;var e=J0();return u.copyTo(e),this.reduce(e),e}c(vJ,"barrettConvert");function IJ(u){return u}c(IJ,"barrettRevert");function LJ(u){for(u.drShiftTo(this.m.t-1,this.r2),u.t>this.m.t+1&&(u.t=this.m.t+1,u.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);u.compareTo(this.r2)<0;)u.dAddOffset(1,this.m.t+1);for(u.subTo(this.r2,u);u.compareTo(this.m)>=0;)u.subTo(this.m,u)}c(LJ,"barrettReduce");function SJ(u,e){u.squareTo(e),this.reduce(e)}c(SJ,"barrettSqrTo");function KJ(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(KJ,"barrettMulTo");Fo.prototype.convert=vJ;Fo.prototype.revert=IJ;Fo.prototype.reduce=LJ;Fo.prototype.mulTo=KJ;Fo.prototype.sqrTo=SJ;function OJ(u,e){var t=u.bitLength(),r,i=Ns(1),s;if(t<=0)return i;t<18?r=1:t<48?r=3:t<144?r=4:t<768?r=5:r=6,t<8?s=new jn(e):e.isEven()?s=new Fo(e):s=new $n(e);var a=new Array,o=3,h=r-1,f=(1<1){var d=J0();for(s.sqrTo(a[1],d);o<=f;)a[o]=J0(),s.mulTo(d,a[o-2],a[o]),o+=2}var p=u.t-1,E,x=!0,g=J0(),m;for(t=Ly(u.data[p])-1;p>=0;){for(t>=h?E=u.data[p]>>t-h&f:(E=(u.data[p]&(1<0&&(E|=u.data[p-1]>>this.DB+t-h)),o=r;!(E&1);)E>>=1,--o;if((t-=o)<0&&(t+=this.DB,--p),x)a[E].copyTo(i),x=!1;else{for(;o>1;)s.sqrTo(i,g),s.sqrTo(g,i),o-=2;o>0?s.sqrTo(i,g):(m=i,i=g,g=m),s.mulTo(g,a[E],i)}for(;p>=0&&!(u.data[p]&1<0&&(e.rShiftTo(s,e),t.rShiftTo(s,t));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return s>0&&t.lShiftTo(s,t),t}c(NJ,"bnGCD");function UJ(u){if(u<=0)return 0;var e=this.DV%u,t=this.s<0?u-1:0;if(this.t>0)if(e==0)t=this.data[0]%u;else for(var r=this.t-1;r>=0;--r)t=(e*t+this.data[r])%u;return t}c(UJ,"bnpModInt");function PJ(u){var e=u.isEven();if(this.isEven()&&e||u.signum()==0)return Y.ZERO;for(var t=u.clone(),r=this.clone(),i=Ns(1),s=Ns(0),a=Ns(0),o=Ns(1);t.signum()!=0;){for(;t.isEven();)t.rShiftTo(1,t),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(u,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(u,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(u,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(u,o),o.rShiftTo(1,o);t.compareTo(r)>=0?(t.subTo(r,t),e&&i.subTo(a,i),s.subTo(o,s)):(r.subTo(t,r),e&&a.subTo(i,a),o.subTo(s,o))}if(r.compareTo(Y.ONE)!=0)return Y.ZERO;if(o.compareTo(u)>=0)return o.subtract(u);if(o.signum()<0)o.addTo(u,o);else return o;return o.signum()<0?o.add(u):o}c(PJ,"bnModInverse");var Mr=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],kJ=(1<<26)/Mr[Mr.length-1];function BJ(u){var e,t=this.abs();if(t.t==1&&t.data[0]<=Mr[Mr.length-1]){for(e=0;e=0);var o=s.modPow(r,this);if(o.compareTo(Y.ONE)!=0&&o.compareTo(e)!=0){for(var h=1;h++{var yi=K0();li();X0();var LP=KP.exports=yi.sha1=yi.sha1||{};yi.md.sha1=yi.md.algorithms.sha1=LP;LP.create=function(){SP||MJ();var u=null,e=yi.util.createBuffer(),t=new Array(80),r={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return r.start=function(){r.messageLength=0,r.fullMessageLength=r.messageLength64=[];for(var i=r.messageLengthSize/4,s=0;s>>0,a>>>0];for(var o=r.fullMessageLength.length-1;o>=0;--o)r.fullMessageLength[o]+=a[1],a[1]=a[0]+(r.fullMessageLength[o]/4294967296>>>0),r.fullMessageLength[o]=r.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return e.putBytes(i),IP(u,t,e),(e.read>2048||e.length()===0)&&e.compact(),r},r.digest=function(){var i=yi.util.createBuffer();i.putBytes(e.bytes());var s=r.fullMessageLength[r.fullMessageLength.length-1]+r.messageLengthSize,a=s&r.blockLength-1;i.putBytes(_C.substr(0,r.blockLength-a));for(var o,h,f=r.fullMessageLength[0]*8,d=0;d>>0,f+=h,i.putInt32(f>>>0),f=o>>>0;i.putInt32(f);var p={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3,h4:u.h4};IP(p,t,i);var E=yi.util.createBuffer();return E.putInt32(p.h0),E.putInt32(p.h1),E.putInt32(p.h2),E.putInt32(p.h3),E.putInt32(p.h4),E},r};var _C=null,SP=!1;function MJ(){_C="\x80",_C+=yi.util.fillString("\0",64),SP=!0}c(MJ,"_init");function IP(u,e,t){for(var r,i,s,a,o,h,f,d,p=t.length();p>=64;){for(i=u.h0,s=u.h1,a=u.h2,o=u.h3,h=u.h4,d=0;d<16;++d)r=t.getInt32(),e[d]=r,f=o^s&(a^o),r=(i<<5|i>>>27)+f+h+1518500249+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;for(;d<20;++d)r=e[d-3]^e[d-8]^e[d-14]^e[d-16],r=r<<1|r>>>31,e[d]=r,f=o^s&(a^o),r=(i<<5|i>>>27)+f+h+1518500249+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;for(;d<32;++d)r=e[d-3]^e[d-8]^e[d-14]^e[d-16],r=r<<1|r>>>31,e[d]=r,f=s^a^o,r=(i<<5|i>>>27)+f+h+1859775393+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;for(;d<40;++d)r=e[d-6]^e[d-16]^e[d-28]^e[d-32],r=r<<2|r>>>30,e[d]=r,f=s^a^o,r=(i<<5|i>>>27)+f+h+1859775393+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;for(;d<60;++d)r=e[d-6]^e[d-16]^e[d-28]^e[d-32],r=r<<2|r>>>30,e[d]=r,f=s&a|o&(s^a),r=(i<<5|i>>>27)+f+h+2400959708+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;for(;d<80;++d)r=e[d-6]^e[d-16]^e[d-28]^e[d-32],r=r<<2|r>>>30,e[d]=r,f=s^a^o,r=(i<<5|i>>>27)+f+h+3395469782+r,h=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=r;u.h0=u.h0+i|0,u.h1=u.h1+s|0,u.h2=u.h2+a|0,u.h3=u.h3+o|0,u.h4=u.h4+h|0,p-=64}}c(IP,"_update")});var CC=w((yf0,NP)=>{var gi=K0();X0();lr();Mo();var OP=NP.exports=gi.pkcs1=gi.pkcs1||{};OP.encode_rsa_oaep=function(u,e,t){var r,i,s,a;typeof t=="string"?(r=t,i=arguments[3]||void 0,s=arguments[4]||void 0):t&&(r=t.label||void 0,i=t.seed||void 0,s=t.md||void 0,t.mgf1&&t.mgf1.md&&(a=t.mgf1.md)),s?s.start():s=gi.md.sha1.create(),a||(a=s);var o=Math.ceil(u.n.bitLength()/8),h=o-2*s.digestLength-2;if(e.length>h){var f=new Error("RSAES-OAEP input message length is too long.");throw f.length=e.length,f.maxLength=h,f}r||(r=""),s.update(r,"raw");for(var d=s.digest(),p="",E=h-e.length,x=0;x>24&255,s>>16&255,s>>8&255,s&255);t.start(),t.update(u+a),r+=t.digest().getBytes()}return r.substring(0,e)}c(Sy,"rsa_mgf1")});var AC=w((Ef0,RC)=>{var Us=K0();X0();Wh();lr();(function(){if(Us.prime){RC.exports=Us.prime;return}var u=RC.exports=Us.prime=Us.prime||{},e=Us.jsbn.BigInteger,t=[6,4,2,4,2,4,6,2],r=new e(null);r.fromInt(30);var i=c(function(p,E){return p|E},"op_or");u.generateProbablePrime=function(p,E,x){typeof E=="function"&&(x=E,E={}),E=E||{};var g=E.algorithm||"PRIMEINC";typeof g=="string"&&(g={name:g}),g.options=g.options||{};var m=E.prng||Us.random,A={nextBytes:function(T){for(var I=m.getBytesSync(T.length),L=0;LE&&(p=f(E,x)),p.isProbablePrime(m))return T(null,p);p.dAddOffset(t[g++%8],0)}while(A<0||+new Date-I"u")return a(p,E,x,g);var m=f(p,E),A=x.workers,T=x.workLoad||100,I=T*30/8,L=x.workerScript||"forge/prime.worker.js";if(A===-1)return Us.util.estimateCores(function(k,M){k&&(M=2),A=M-1,N()});N();function N(){A=Math.max(1,A);for(var k=[],M=0;Mp&&(m=f(p,E));var V=m.toString(16);i0.target.postMessage({hex:V,workLoad:T}),m.dAddOffset(I,0)}}c(h0,"workerMessage")}c(N,"generate")}c(h,"primeincFindPrimeWithWorkers");function f(p,E){var x=new e(p,E),g=p-1;return x.testBit(g)||x.bitwiseTo(e.ONE.shiftLeft(g),i,x),x.dAddOffset(31-x.mod(r).byteValue(),0),x}c(f,"generateRandom");function d(p){return p<=100?27:p<=150?18:p<=200?15:p<=250?12:p<=300?9:p<=350?8:p<=400?7:p<=500?6:p<=600?5:p<=800?4:p<=1250?3:2}c(d,"getMillerRabinTests")})()});var zh=w((xf0,MP)=>{var y0=K0();Fr();Wh();Os();CC();AC();lr();X0();typeof Q0>"u"&&(Q0=y0.jsbn.BigInteger);var Q0,wC=y0.util.isNodejs?require("crypto"):null,F=y0.asn1,fr=y0.util;y0.pki=y0.pki||{};MP.exports=y0.pki.rsa=y0.rsa=y0.rsa||{};var A0=y0.pki,HJ=[6,4,2,4,2,4,6,2],qJ={name:"PrivateKeyInfo",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},VJ={name:"RSAPrivateKey",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},GJ={name:"RSAPublicKey",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:F.Class.UNIVERSAL,type:F.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},WJ=y0.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:F.Class.UNIVERSAL,type:F.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},zJ={name:"DigestInfo",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:F.Class.UNIVERSAL,type:F.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:F.Class.UNIVERSAL,type:F.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:F.Class.UNIVERSAL,type:F.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:F.Class.UNIVERSAL,type:F.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},YJ=c(function(u){var e;if(u.algorithm in A0.oids)e=A0.oids[u.algorithm];else{var t=new Error("Unknown message digest algorithm.");throw t.algorithm=u.algorithm,t}var r=F.oidToDer(e).getBytes(),i=F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[]),s=F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[]);s.value.push(F.create(F.Class.UNIVERSAL,F.Type.OID,!1,r)),s.value.push(F.create(F.Class.UNIVERSAL,F.Type.NULL,!1,""));var a=F.create(F.Class.UNIVERSAL,F.Type.OCTETSTRING,!1,u.digest().getBytes());return i.value.push(s),i.value.push(a),F.toDer(i).getBytes()},"emsaPkcs1v15encode"),DP=c(function(u,e,t){if(t)return u.modPow(e.e,e.n);if(!e.p||!e.q)return u.modPow(e.d,e.n);e.dP||(e.dP=e.d.mod(e.p.subtract(Q0.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(Q0.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));var r;do r=new Q0(y0.util.bytesToHex(y0.random.getBytes(e.n.bitLength()/8)),16);while(r.compareTo(e.n)>=0||!r.gcd(e.n).equals(Q0.ONE));u=u.multiply(r.modPow(e.e,e.n)).mod(e.n);for(var i=u.mod(e.p).modPow(e.dP,e.p),s=u.mod(e.q).modPow(e.dQ,e.q);i.compareTo(s)<0;)i=i.add(e.p);var a=i.subtract(s).multiply(e.qInv).mod(e.p).multiply(e.q).add(s);return a=a.multiply(r.modInverse(e.n)).mod(e.n),a},"_modPow");A0.rsa.encrypt=function(u,e,t){var r=t,i,s=Math.ceil(e.n.bitLength()/8);t!==!1&&t!==!0?(r=t===2,i=FP(u,e,t)):(i=y0.util.createBuffer(),i.putBytes(u));for(var a=new Q0(i.toHex(),16),o=DP(a,e,r),h=o.toString(16),f=y0.util.createBuffer(),d=s-Math.ceil(h.length/2);d>0;)f.putByte(0),--d;return f.putBytes(y0.util.hexToBytes(h)),f.getBytes()};A0.rsa.decrypt=function(u,e,t,r){var i=Math.ceil(e.n.bitLength()/8);if(u.length!==i){var s=new Error("Encrypted message length is invalid.");throw s.length=u.length,s.expected=i,s}var a=new Q0(y0.util.createBuffer(u).toHex(),16);if(a.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var o=DP(a,e,t),h=o.toString(16),f=y0.util.createBuffer(),d=i-Math.ceil(h.length/2);d>0;)f.putByte(0),--d;return f.putBytes(y0.util.hexToBytes(h)),r!==!1?Ky(f.getBytes(),e,t):f.getBytes()};A0.rsa.createKeyPairGenerationState=function(u,e,t){typeof u=="string"&&(u=parseInt(u,10)),u=u||2048,t=t||{};var r=t.prng||y0.random,i={nextBytes:function(o){for(var h=r.getBytesSync(o.length),f=0;f>1,pBits:u-(u>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw new Error("Invalid key generation algorithm: "+s);return a};A0.rsa.stepKeyPairGenerationState=function(u,e){"algorithm"in u||(u.algorithm="PRIMEINC");var t=new Q0(null);t.fromInt(30);for(var r=0,i=c(function(p,E){return p|E},"op_or"),s=+new Date,a,o=0;u.keys===null&&(e<=0||oh?u.pqState=0:u.num.isProbablePrime(jJ(u.num.bitLength()))?++u.pqState:u.num.dAddOffset(HJ[r++%8],0):u.pqState===2?u.pqState=u.num.subtract(Q0.ONE).gcd(u.e).compareTo(Q0.ONE)===0?3:0:u.pqState===3&&(u.pqState=0,u.p===null?u.p=u.num:u.q=u.num,u.p!==null&&u.q!==null&&++u.state,u.num=null)}else if(u.state===1)u.p.compareTo(u.q)<0&&(u.num=u.p,u.p=u.q,u.q=u.num),++u.state;else if(u.state===2)u.p1=u.p.subtract(Q0.ONE),u.q1=u.q.subtract(Q0.ONE),u.phi=u.p1.multiply(u.q1),++u.state;else if(u.state===3)u.phi.gcd(u.e).compareTo(Q0.ONE)===0?++u.state:(u.p=null,u.q=null,u.state=0);else if(u.state===4)u.n=u.p.multiply(u.q),u.n.bitLength()===u.bits?++u.state:(u.q=null,u.state=0);else if(u.state===5){var d=u.e.modInverse(u.phi);u.keys={privateKey:A0.rsa.setPrivateKey(u.n,u.e,d,u.p,u.q,d.mod(u.p1),d.mod(u.q1),u.q.modInverse(u.p)),publicKey:A0.rsa.setPublicKey(u.n,u.e)}}a=+new Date,o+=a-s,s=a}return u.keys!==null};A0.rsa.generateKeyPair=function(u,e,t,r){if(arguments.length===1?typeof u=="object"?(t=u,u=void 0):typeof u=="function"&&(r=u,u=void 0):arguments.length===2?typeof u=="number"?typeof e=="function"?(r=e,e=void 0):typeof e!="number"&&(t=e,e=void 0):(t=u,r=e,u=void 0,e=void 0):arguments.length===3&&(typeof e=="number"?typeof t=="function"&&(r=t,t=void 0):(r=t,t=e,e=void 0)),t=t||{},u===void 0&&(u=t.bits||2048),e===void 0&&(e=t.e||65537),!y0.options.usePureJavaScript&&!t.prng&&u>=256&&u<=16384&&(e===65537||e===3)){if(r){if(UP("generateKeyPair"))return wC.generateKeyPair("rsa",{modulusLength:u,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(o,h,f){if(o)return r(o);r(null,{privateKey:A0.privateKeyFromPem(f),publicKey:A0.publicKeyFromPem(h)})});if(PP("generateKey")&&PP("exportKey"))return fr.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:u,publicExponent:BP(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(o){return fr.globalScope.crypto.subtle.exportKey("pkcs8",o.privateKey)}).then(void 0,function(o){r(o)}).then(function(o){if(o){var h=A0.privateKeyFromAsn1(F.fromDer(y0.util.createBuffer(o)));r(null,{privateKey:h,publicKey:A0.setRsaPublicKey(h.n,h.e)})}});if(kP("generateKey")&&kP("exportKey")){var i=fr.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:u,publicExponent:BP(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);i.oncomplete=function(o){var h=o.target.result,f=fr.globalScope.msCrypto.subtle.exportKey("pkcs8",h.privateKey);f.oncomplete=function(d){var p=d.target.result,E=A0.privateKeyFromAsn1(F.fromDer(y0.util.createBuffer(p)));r(null,{privateKey:E,publicKey:A0.setRsaPublicKey(E.n,E.e)})},f.onerror=function(d){r(d)}},i.onerror=function(o){r(o)};return}}else if(UP("generateKeyPairSync")){var s=wC.generateKeyPairSync("rsa",{modulusLength:u,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:A0.privateKeyFromPem(s.privateKey),publicKey:A0.publicKeyFromPem(s.publicKey)}}}var a=A0.rsa.createKeyPairGenerationState(u,e,t);if(!r)return A0.rsa.stepKeyPairGenerationState(a,0),a.keys;QJ(a,t,r)};A0.setRsaPublicKey=A0.rsa.setPublicKey=function(u,e){var t={n:u,e};return t.encrypt=function(r,i,s){if(typeof i=="string"?i=i.toUpperCase():i===void 0&&(i="RSAES-PKCS1-V1_5"),i==="RSAES-PKCS1-V1_5")i={encode:function(o,h,f){return FP(o,h,2).getBytes()}};else if(i==="RSA-OAEP"||i==="RSAES-OAEP")i={encode:function(o,h){return y0.pkcs1.encode_rsa_oaep(h,o,s)}};else if(["RAW","NONE","NULL",null].indexOf(i)!==-1)i={encode:function(o){return o}};else if(typeof i=="string")throw new Error('Unsupported encryption scheme: "'+i+'".');var a=i.encode(r,t,!0);return A0.rsa.encrypt(a,t,!0)},t.verify=function(r,i,s,a){typeof s=="string"?s=s.toUpperCase():s===void 0&&(s="RSASSA-PKCS1-V1_5"),a===void 0&&(a={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in a||(a._parseAllDigestBytes=!0),s==="RSASSA-PKCS1-V1_5"?s={verify:function(h,f){f=Ky(f,t,!0);var d=F.fromDer(f,{parseAllBytes:a._parseAllDigestBytes}),p={},E=[];if(!F.validate(d,zJ,p,E)){var x=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw x.errors=E,x}var g=F.derToOid(p.algorithmIdentifier);if(!(g===y0.oids.md2||g===y0.oids.md5||g===y0.oids.sha1||g===y0.oids.sha224||g===y0.oids.sha256||g===y0.oids.sha384||g===y0.oids.sha512||g===y0.oids["sha512-224"]||g===y0.oids["sha512-256"])){var x=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw x.oid=g,x}if((g===y0.oids.md2||g===y0.oids.md5)&&!("parameters"in p))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return h===p.digest}}:(s==="NONE"||s==="NULL"||s===null)&&(s={verify:function(h,f){return f=Ky(f,t,!0),h===f}});var o=A0.rsa.decrypt(i,t,!0,!1);return s.verify(r,o,t.n.bitLength())},t};A0.setRsaPrivateKey=A0.rsa.setPrivateKey=function(u,e,t,r,i,s,a,o){var h={n:u,e,d:t,p:r,q:i,dP:s,dQ:a,qInv:o};return h.decrypt=function(f,d,p){typeof d=="string"?d=d.toUpperCase():d===void 0&&(d="RSAES-PKCS1-V1_5");var E=A0.rsa.decrypt(f,h,!1,!1);if(d==="RSAES-PKCS1-V1_5")d={decode:Ky};else if(d==="RSA-OAEP"||d==="RSAES-OAEP")d={decode:function(x,g){return y0.pkcs1.decode_rsa_oaep(g,x,p)}};else if(["RAW","NONE","NULL",null].indexOf(d)!==-1)d={decode:function(x){return x}};else throw new Error('Unsupported encryption scheme: "'+d+'".');return d.decode(E,h,!1)},h.sign=function(f,d){var p=!1;typeof d=="string"&&(d=d.toUpperCase()),d===void 0||d==="RSASSA-PKCS1-V1_5"?(d={encode:YJ},p=1):(d==="NONE"||d==="NULL"||d===null)&&(d={encode:function(){return f}},p=1);var E=d.encode(f,h.n.bitLength());return A0.rsa.encrypt(E,h,p)},h};A0.wrapRsaPrivateKey=function(u){return F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,F.integerToDer(0).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(A0.oids.rsaEncryption).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.NULL,!1,"")]),F.create(F.Class.UNIVERSAL,F.Type.OCTETSTRING,!1,F.toDer(u).getBytes())])};A0.privateKeyFromAsn1=function(u){var e={},t=[];if(F.validate(u,qJ,e,t)&&(u=F.fromDer(y0.util.createBuffer(e.privateKey))),e={},t=[],!F.validate(u,VJ,e,t)){var r=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw r.errors=t,r}var i,s,a,o,h,f,d,p;return i=y0.util.createBuffer(e.privateKeyModulus).toHex(),s=y0.util.createBuffer(e.privateKeyPublicExponent).toHex(),a=y0.util.createBuffer(e.privateKeyPrivateExponent).toHex(),o=y0.util.createBuffer(e.privateKeyPrime1).toHex(),h=y0.util.createBuffer(e.privateKeyPrime2).toHex(),f=y0.util.createBuffer(e.privateKeyExponent1).toHex(),d=y0.util.createBuffer(e.privateKeyExponent2).toHex(),p=y0.util.createBuffer(e.privateKeyCoefficient).toHex(),A0.setRsaPrivateKey(new Q0(i,16),new Q0(s,16),new Q0(a,16),new Q0(o,16),new Q0(h,16),new Q0(f,16),new Q0(d,16),new Q0(p,16))};A0.privateKeyToAsn1=A0.privateKeyToRSAPrivateKey=function(u){return F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,F.integerToDer(0).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.n)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.e)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.d)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.p)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.q)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.dP)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.dQ)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.qInv))])};A0.publicKeyFromAsn1=function(u){var e={},t=[];if(F.validate(u,WJ,e,t)){var r=F.derToOid(e.publicKeyOid);if(r!==A0.oids.rsaEncryption){var i=new Error("Cannot read public key. Unknown OID.");throw i.oid=r,i}u=e.rsaPublicKey}if(t=[],!F.validate(u,GJ,e,t)){var i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw i.errors=t,i}var s=y0.util.createBuffer(e.publicKeyModulus).toHex(),a=y0.util.createBuffer(e.publicKeyExponent).toHex();return A0.setRsaPublicKey(new Q0(s,16),new Q0(a,16))};A0.publicKeyToAsn1=A0.publicKeyToSubjectPublicKeyInfo=function(u){return F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.OID,!1,F.oidToDer(A0.oids.rsaEncryption).getBytes()),F.create(F.Class.UNIVERSAL,F.Type.NULL,!1,"")]),F.create(F.Class.UNIVERSAL,F.Type.BITSTRING,!1,[A0.publicKeyToRSAPublicKey(u)])])};A0.publicKeyToRSAPublicKey=function(u){return F.create(F.Class.UNIVERSAL,F.Type.SEQUENCE,!0,[F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.n)),F.create(F.Class.UNIVERSAL,F.Type.INTEGER,!1,Ei(u.e))])};function FP(u,e,t){var r=y0.util.createBuffer(),i=Math.ceil(e.n.bitLength()/8);if(u.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=u.length,s.max=i-11,s}r.putByte(0),r.putByte(t);var a=i-3-u.length,o;if(t===0||t===1){o=t===0?0:255;for(var h=0;h0;){for(var f=0,d=y0.random.getBytes(a),h=0;h"u")throw new Error("Encryption block is invalid.");var h=0;if(o===0){h=i-3-r;for(var f=0;f1;){if(s.getByte()!==255){--s.read;break}++h}else if(o===2)for(h=0;s.length()>1;){if(s.getByte()===0){--s.read;break}++h}var d=s.getByte();if(d!==0||h!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}c(Ky,"_decodePkcs1_v1_5");function QJ(u,e,t){typeof e=="function"&&(t=e,e={}),e=e||{};var r={algorithm:{name:e.algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};"prng"in e&&(r.prng=e.prng),i();function i(){s(u.pBits,function(o,h){if(o)return t(o);if(u.p=h,u.q!==null)return a(o,u.q);s(u.qBits,a)})}c(i,"generate");function s(o,h){y0.prime.generateProbablePrime(o,r,h)}c(s,"getPrime");function a(o,h){if(o)return t(o);if(u.q=h,u.p.compareTo(u.q)<0){var f=u.p;u.p=u.q,u.q=f}if(u.p.subtract(Q0.ONE).gcd(u.e).compareTo(Q0.ONE)!==0){u.p=null,i();return}if(u.q.subtract(Q0.ONE).gcd(u.e).compareTo(Q0.ONE)!==0){u.q=null,s(u.qBits,a);return}if(u.p1=u.p.subtract(Q0.ONE),u.q1=u.q.subtract(Q0.ONE),u.phi=u.p1.multiply(u.q1),u.phi.gcd(u.e).compareTo(Q0.ONE)!==0){u.p=u.q=null,i();return}if(u.n=u.p.multiply(u.q),u.n.bitLength()!==u.bits){u.q=null,s(u.qBits,a);return}var d=u.e.modInverse(u.phi);u.keys={privateKey:A0.rsa.setPrivateKey(u.n,u.e,d,u.p,u.q,d.mod(u.p1),d.mod(u.q1),u.q.modInverse(u.p)),publicKey:A0.rsa.setPublicKey(u.n,u.e)},t(null,u.keys)}c(a,"finish")}c(QJ,"_generateKeyPair");function Ei(u){var e=u.toString(16);e[0]>="8"&&(e="00"+e);var t=y0.util.hexToBytes(e);return t.length>1&&(t.charCodeAt(0)===0&&!(t.charCodeAt(1)&128)||t.charCodeAt(0)===255&&(t.charCodeAt(1)&128)===128)?t.substr(1):t}c(Ei,"_bnToBytes");function jJ(u){return u<=100?27:u<=150?18:u<=200?15:u<=250?12:u<=300?9:u<=350?8:u<=400?7:u<=500?6:u<=600?5:u<=800?4:u<=1250?3:2}c(jJ,"_getMillerRabinTests");function UP(u){return y0.util.isNodejs&&typeof wC[u]=="function"}c(UP,"_detectNodeCrypto");function PP(u){return typeof fr.globalScope<"u"&&typeof fr.globalScope.crypto=="object"&&typeof fr.globalScope.crypto.subtle=="object"&&typeof fr.globalScope.crypto.subtle[u]=="function"}c(PP,"_detectSubtleCrypto");function kP(u){return typeof fr.globalScope<"u"&&typeof fr.globalScope.msCrypto=="object"&&typeof fr.globalScope.msCrypto.subtle=="object"&&typeof fr.globalScope.msCrypto.subtle[u]=="function"}c(kP,"_detectSubtleMsCrypto");function BP(u){for(var e=y0.util.hexToBytes(u.toString(16)),t=new Uint8Array(e.length),r=0;r{var o0=K0();Ks();Fr();Vh();li();Os();wy();Qn();lr();mC();zh();X0();typeof HP>"u"&&(HP=o0.jsbn.BigInteger);var HP,q=o0.asn1,v0=o0.pki=o0.pki||{};WP.exports=v0.pbe=o0.pbe=o0.pbe||{};var Zn=v0.oids,$J={name:"EncryptedPrivateKeyInfo",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:q.Class.UNIVERSAL,type:q.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:q.Class.UNIVERSAL,type:q.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},ZJ={name:"PBES2Algorithms",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:q.Class.UNIVERSAL,type:q.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:q.Class.UNIVERSAL,type:q.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:q.Class.UNIVERSAL,type:q.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:q.Class.UNIVERSAL,type:q.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:q.Class.UNIVERSAL,type:q.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:q.Class.UNIVERSAL,type:q.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:q.Class.UNIVERSAL,type:q.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},XJ={name:"pkcs-12PbeParams",tagClass:q.Class.UNIVERSAL,type:q.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:q.Class.UNIVERSAL,type:q.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:q.Class.UNIVERSAL,type:q.Type.INTEGER,constructed:!1,capture:"iterations"}]};v0.encryptPrivateKeyInfo=function(u,e,t){t=t||{},t.saltSize=t.saltSize||8,t.count=t.count||2048,t.algorithm=t.algorithm||"aes128",t.prfAlgorithm=t.prfAlgorithm||"sha1";var r=o0.random.getBytesSync(t.saltSize),i=t.count,s=q.integerToDer(i),a,o,h;if(t.algorithm.indexOf("aes")===0||t.algorithm==="des"){var f,d,p;switch(t.algorithm){case"aes128":a=16,f=16,d=Zn["aes128-CBC"],p=o0.aes.createEncryptionCipher;break;case"aes192":a=24,f=16,d=Zn["aes192-CBC"],p=o0.aes.createEncryptionCipher;break;case"aes256":a=32,f=16,d=Zn["aes256-CBC"],p=o0.aes.createEncryptionCipher;break;case"des":a=8,f=8,d=Zn.desCBC,p=o0.des.createEncryptionCipher;break;default:var E=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw E.algorithm=t.algorithm,E}var x="hmacWith"+t.prfAlgorithm.toUpperCase(),g=GP(x),m=o0.pkcs5.pbkdf2(e,r,i,a,g),A=o0.random.getBytesSync(f),T=p(m);T.start(A),T.update(q.toDer(u)),T.finish(),h=T.output.getBytes();var I=JJ(r,s,a,x);o=q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(Zn.pkcs5PBES2).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(Zn.pkcs5PBKDF2).getBytes()),I]),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(d).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,A)])])])}else if(t.algorithm==="3des"){a=24;var L=new o0.util.ByteBuffer(r),m=v0.pbe.generatePkcs12Key(e,L,1,i,a),A=v0.pbe.generatePkcs12Key(e,L,2,i,a),T=o0.des.createEncryptionCipher(m);T.start(A),T.update(q.toDer(u)),T.finish(),h=T.output.getBytes(),o=q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OID,!1,q.oidToDer(Zn["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,r),q.create(q.Class.UNIVERSAL,q.Type.INTEGER,!1,s.getBytes())])])}else{var E=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw E.algorithm=t.algorithm,E}var N=q.create(q.Class.UNIVERSAL,q.Type.SEQUENCE,!0,[o,q.create(q.Class.UNIVERSAL,q.Type.OCTETSTRING,!1,h)]);return N};v0.decryptPrivateKeyInfo=function(u,e){var t=null,r={},i=[];if(!q.validate(u,$J,r,i)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var a=q.derToOid(r.encryptionOid),o=v0.pbe.getCipher(a,r.encryptionParams,e),h=o0.util.createBuffer(r.encryptedData);return o.update(h),o.finish()&&(t=q.fromDer(o.output)),t};v0.encryptedPrivateKeyToPem=function(u,e){var t={type:"ENCRYPTED PRIVATE KEY",body:q.toDer(u).getBytes()};return o0.pem.encode(t,{maxline:e})};v0.encryptedPrivateKeyFromPem=function(u){var e=o0.pem.decode(u)[0];if(e.type!=="ENCRYPTED PRIVATE KEY"){var t=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return q.fromDer(e.body)};v0.encryptRsaPrivateKey=function(u,e,t){if(t=t||{},!t.legacy){var r=v0.wrapRsaPrivateKey(v0.privateKeyToAsn1(u));return r=v0.encryptPrivateKeyInfo(r,e,t),v0.encryptedPrivateKeyToPem(r)}var i,s,a,o;switch(t.algorithm){case"aes128":i="AES-128-CBC",a=16,s=o0.random.getBytesSync(16),o=o0.aes.createEncryptionCipher;break;case"aes192":i="AES-192-CBC",a=24,s=o0.random.getBytesSync(16),o=o0.aes.createEncryptionCipher;break;case"aes256":i="AES-256-CBC",a=32,s=o0.random.getBytesSync(16),o=o0.aes.createEncryptionCipher;break;case"3des":i="DES-EDE3-CBC",a=24,s=o0.random.getBytesSync(8),o=o0.des.createEncryptionCipher;break;case"des":i="DES-CBC",a=8,s=o0.random.getBytesSync(8),o=o0.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+t.algorithm+'".');throw h.algorithm=t.algorithm,h}var f=o0.pbe.opensslDeriveBytes(e,s.substr(0,8),a),d=o(f);d.start(s),d.update(q.toDer(v0.privateKeyToAsn1(u))),d.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:i,parameters:o0.util.bytesToHex(s).toUpperCase()},body:d.output.getBytes()};return o0.pem.encode(p)};v0.decryptRsaPrivateKey=function(u,e){var t=null,r=o0.pem.decode(u)[0];if(r.type!=="ENCRYPTED PRIVATE KEY"&&r.type!=="PRIVATE KEY"&&r.type!=="RSA PRIVATE KEY"){var i=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw i.headerType=i,i}if(r.procType&&r.procType.type==="ENCRYPTED"){var s,a;switch(r.dekInfo.algorithm){case"DES-CBC":s=8,a=o0.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,a=o0.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,a=o0.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,a=o0.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,a=o0.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,a=c(function(p){return o0.rc2.createDecryptionCipher(p,40)},"cipherFn");break;case"RC2-64-CBC":s=8,a=c(function(p){return o0.rc2.createDecryptionCipher(p,64)},"cipherFn");break;case"RC2-128-CBC":s=16,a=c(function(p){return o0.rc2.createDecryptionCipher(p,128)},"cipherFn");break;default:var i=new Error('Could not decrypt private key; unsupported encryption algorithm "'+r.dekInfo.algorithm+'".');throw i.algorithm=r.dekInfo.algorithm,i}var o=o0.util.hexToBytes(r.dekInfo.parameters),h=o0.pbe.opensslDeriveBytes(e,o.substr(0,8),s),f=a(h);if(f.start(o),f.update(o0.util.createBuffer(r.body)),f.finish())t=f.output.getBytes();else return t}else t=r.body;return r.type==="ENCRYPTED PRIVATE KEY"?t=v0.decryptPrivateKeyInfo(q.fromDer(t),e):t=q.fromDer(t),t!==null&&(t=v0.privateKeyFromAsn1(t)),t};v0.pbe.generatePkcs12Key=function(u,e,t,r,i,s){var a,o;if(typeof s>"u"||s===null){if(!("sha1"in o0.md))throw new Error('"sha1" hash algorithm unavailable.');s=o0.md.sha1.create()}var h=s.digestLength,f=s.blockLength,d=new o0.util.ByteBuffer,p=new o0.util.ByteBuffer;if(u!=null){for(o=0;o=0;o--)L0=L0>>8,L0+=u0.at(o)+H.at(o),H.setAt(o,L0&255);i0.putBuffer(H)}L=i0,d.putBuffer(M)}return d.truncate(d.length()-i),d};v0.pbe.getCipher=function(u,e,t){switch(u){case v0.oids.pkcs5PBES2:return v0.pbe.getCipherForPBES2(u,e,t);case v0.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case v0.oids["pbewithSHAAnd40BitRC2-CBC"]:return v0.pbe.getCipherForPKCS12PBE(u,e,t);default:var r=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw r.oid=u,r.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],r}};v0.pbe.getCipherForPBES2=function(u,e,t){var r={},i=[];if(!q.validate(e,ZJ,r,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}if(u=q.derToOid(r.kdfOid),u!==v0.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=u,s.supportedOids=["pkcs5PBKDF2"],s}if(u=q.derToOid(r.encOid),u!==v0.oids["aes128-CBC"]&&u!==v0.oids["aes192-CBC"]&&u!==v0.oids["aes256-CBC"]&&u!==v0.oids["des-EDE3-CBC"]&&u!==v0.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=u,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var a=r.kdfSalt,o=o0.util.createBuffer(r.kdfIterationCount);o=o.getInt(o.length()<<3);var h,f;switch(v0.oids[u]){case"aes128-CBC":h=16,f=o0.aes.createDecryptionCipher;break;case"aes192-CBC":h=24,f=o0.aes.createDecryptionCipher;break;case"aes256-CBC":h=32,f=o0.aes.createDecryptionCipher;break;case"des-EDE3-CBC":h=24,f=o0.des.createDecryptionCipher;break;case"desCBC":h=8,f=o0.des.createDecryptionCipher;break}var d=VP(r.prfOid),p=o0.pkcs5.pbkdf2(t,a,o,h,d),E=r.encIv,x=f(p);return x.start(E),x};v0.pbe.getCipherForPKCS12PBE=function(u,e,t){var r={},i=[];if(!q.validate(e,XJ,r,i)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=i,s}var a=o0.util.createBuffer(r.salt),o=o0.util.createBuffer(r.iterations);o=o.getInt(o.length()<<3);var h,f,d;switch(u){case v0.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:h=24,f=8,d=o0.des.startDecrypting;break;case v0.oids["pbewithSHAAnd40BitRC2-CBC"]:h=5,f=8,d=c(function(m,A){var T=o0.rc2.createDecryptionCipher(m,40);return T.start(A,null),T},"cipherFn");break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=u,s}var p=VP(r.prfOid),E=v0.pbe.generatePkcs12Key(t,a,1,o,h,p);p.start();var x=v0.pbe.generatePkcs12Key(t,a,2,o,f,p);return d(E,x)};v0.pbe.opensslDeriveBytes=function(u,e,t,r){if(typeof r>"u"||r===null){if(!("md5"in o0.md))throw new Error('"md5" hash algorithm unavailable.');r=o0.md.md5.create()}e===null&&(e="");for(var i=[qP(r,u+e)],s=16,a=1;s{var Ho=K0();Fr();X0();var a0=Ho.asn1,qo=QP.exports=Ho.pkcs7asn1=Ho.pkcs7asn1||{};Ho.pkcs7=Ho.pkcs7||{};Ho.pkcs7.asn1=qo;var zP={name:"ContentInfo",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a0.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};qo.contentInfoValidator=zP;var YP={name:"EncryptedContentInfo",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a0.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a0.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};qo.envelopedDataValidator={name:"EnvelopedData",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(YP)};qo.encryptedDataValidator={name:"EncryptedData",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"version"}].concat(YP)};var e00={name:"SignerInfo",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a0.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a0.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a0.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};qo.signedDataValidator={name:"SignedData",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},zP,{name:"SignedData.Certificates",tagClass:a0.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a0.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SET,capture:"signerInfos",optional:!0,value:[e00]}]};qo.recipientInfoValidator={name:"RecipientInfo",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a0.Class.UNIVERSAL,type:a0.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a0.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:a0.Class.UNIVERSAL,type:a0.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var LC=w((Rf0,jP)=>{var Xn=K0();X0();Xn.mgf=Xn.mgf||{};var t00=jP.exports=Xn.mgf.mgf1=Xn.mgf1=Xn.mgf1||{};t00.create=function(u){var e={generate:function(t,r){for(var i=new Xn.util.ByteBuffer,s=Math.ceil(r/u.digestLength),a=0;a{var Oy=K0();LC();$P.exports=Oy.mgf=Oy.mgf||{};Oy.mgf.mgf1=Oy.mgf1});var Ny=w((wf0,XP)=>{var Jn=K0();lr();X0();var u00=XP.exports=Jn.pss=Jn.pss||{};u00.create=function(u){arguments.length===3&&(u={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e=u.md,t=u.mgf,r=e.digestLength,i=u.salt||null;typeof i=="string"&&(i=Jn.util.createBuffer(i));var s;if("saltLength"in u)s=u.saltLength;else if(i!==null)s=i.length();else throw new Error("Salt length not specified or specific salt not given.");if(i!==null&&i.length()!==s)throw new Error("Given salt length does not match length of given salt.");var a=u.prng||Jn.random,o={};return o.encode=function(h,f){var d,p=f-1,E=Math.ceil(p/8),x=h.digest().getBytes();if(E>8*E-p&255;return k=String.fromCharCode(k.charCodeAt(0)&~M)+k.substr(1),k+A+"\xBC"},o.verify=function(h,f,d){var p,E=d-1,x=Math.ceil(E/8);if(f=f.substr(-x),x>8*x-E&255;if(m.charCodeAt(0)&T)throw new Error("Bits beyond keysize not zero as expected.");var I=t.generate(A,g),L="";for(p=0;p{var g0=K0();Ks();Fr();Vh();li();ZP();Os();Qn();Ny();zh();X0();var b=g0.asn1,t0=rk.exports=g0.pki=g0.pki||{},j0=t0.oids,Fe={};Fe.CN=j0.commonName;Fe.commonName="CN";Fe.C=j0.countryName;Fe.countryName="C";Fe.L=j0.localityName;Fe.localityName="L";Fe.ST=j0.stateOrProvinceName;Fe.stateOrProvinceName="ST";Fe.O=j0.organizationName;Fe.organizationName="O";Fe.OU=j0.organizationalUnitName;Fe.organizationalUnitName="OU";Fe.E=j0.emailAddress;Fe.emailAddress="E";var ek=g0.pki.rsa.publicKeyValidator,r00={name:"Certificate",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:b.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:b.Class.UNIVERSAL,type:b.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:b.Class.UNIVERSAL,type:b.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:b.Class.UNIVERSAL,type:b.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:b.Class.UNIVERSAL,type:b.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},ek,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:b.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:b.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:b.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:b.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},i00={name:"rsapss",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:b.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:b.Class.UNIVERSAL,type:b.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:b.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:b.Class.UNIVERSAL,type:b.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:b.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:b.Class.UNIVERSAL,type:b.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},s00={name:"CertificationRequestInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},ek,{name:"CertificationRequestInfo.attributes",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,constructed:!0}]}]}]},n00={name:"CertificationRequest",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[s00,{name:"CertificationRequest.signatureAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:b.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:b.Class.UNIVERSAL,type:b.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};t0.RDNAttributesAsArray=function(u,e){for(var t=[],r,i,s,a=0;a2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(a.validity.notBefore=h[0],a.validity.notAfter=h[1],a.tbsCertificate=t.tbsCertificate,e){a.md=Py({signatureOid:a.signatureOid,type:"certificate"});var f=b.toDer(a.tbsCertificate);a.md.update(f.getBytes())}var d=g0.md.sha1.create(),p=b.toDer(t.certIssuer);d.update(p.getBytes()),a.issuer.getField=function(g){return Ps(a.issuer,g)},a.issuer.addField=function(g){dr([g]),a.issuer.attributes.push(g)},a.issuer.attributes=t0.RDNAttributesAsArray(t.certIssuer),t.certIssuerUniqueId&&(a.issuer.uniqueId=t.certIssuerUniqueId),a.issuer.hash=d.digest().toHex();var E=g0.md.sha1.create(),x=b.toDer(t.certSubject);return E.update(x.getBytes()),a.subject.getField=function(g){return Ps(a.subject,g)},a.subject.addField=function(g){dr([g]),a.subject.attributes.push(g)},a.subject.attributes=t0.RDNAttributesAsArray(t.certSubject),t.certSubjectUniqueId&&(a.subject.uniqueId=t.certSubjectUniqueId),a.subject.hash=E.digest().toHex(),t.certExtensions?a.extensions=t0.certificateExtensionsFromAsn1(t.certExtensions):a.extensions=[],a.publicKey=t0.publicKeyFromAsn1(t.subjectPublicKeyInfo),a};t0.certificateExtensionsFromAsn1=function(u){for(var e=[],t=0;t1&&(r=t.value.charCodeAt(1),i=t.value.length>2?t.value.charCodeAt(2):0),e.digitalSignature=(r&128)===128,e.nonRepudiation=(r&64)===64,e.keyEncipherment=(r&32)===32,e.dataEncipherment=(r&16)===16,e.keyAgreement=(r&8)===8,e.keyCertSign=(r&4)===4,e.cRLSign=(r&2)===2,e.encipherOnly=(r&1)===1,e.decipherOnly=(i&128)===128}else if(e.name==="basicConstraints"){var t=b.fromDer(e.value);t.value.length>0&&t.value[0].type===b.Type.BOOLEAN?e.cA=t.value[0].value.charCodeAt(0)!==0:e.cA=!1;var s=null;t.value.length>0&&t.value[0].type===b.Type.INTEGER?s=t.value[0].value:t.value.length>1&&(s=t.value[1].value),s!==null&&(e.pathLenConstraint=b.derToInteger(s))}else if(e.name==="extKeyUsage")for(var t=b.fromDer(e.value),a=0;a1&&(r=t.value.charCodeAt(1)),e.client=(r&128)===128,e.server=(r&64)===64,e.email=(r&32)===32,e.objsign=(r&16)===16,e.reserved=(r&8)===8,e.sslCA=(r&4)===4,e.emailCA=(r&2)===2,e.objCA=(r&1)===1}else if(e.name==="subjectAltName"||e.name==="issuerAltName"){e.altNames=[];for(var h,t=b.fromDer(e.value),f=0;f"u"&&(e.type&&e.type in t0.oids?e.name=t0.oids[e.type]:e.shortName&&e.shortName in Fe&&(e.name=t0.oids[Fe[e.shortName]])),typeof e.type>"u")if(e.name&&e.name in t0.oids)e.type=t0.oids[e.name];else{var r=new Error("Attribute type not specified.");throw r.attribute=e,r}if(typeof e.shortName>"u"&&e.name&&e.name in Fe&&(e.shortName=Fe[e.name]),e.type===j0.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=b.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var i=0;i"u"){var r=new Error("Attribute value not specified.");throw r.attribute=e,r}}}c(dr,"_fillMissingFields");function uk(u,e){if(e=e||{},typeof u.name>"u"&&u.id&&u.id in t0.oids&&(u.name=t0.oids[u.id]),typeof u.id>"u")if(u.name&&u.name in t0.oids)u.id=t0.oids[u.name];else{var t=new Error("Extension ID not specified.");throw t.extension=u,t}if(typeof u.value<"u")return u;if(u.name==="keyUsage"){var r=0,i=0,s=0;u.digitalSignature&&(i|=128,r=7),u.nonRepudiation&&(i|=64,r=6),u.keyEncipherment&&(i|=32,r=5),u.dataEncipherment&&(i|=16,r=4),u.keyAgreement&&(i|=8,r=3),u.keyCertSign&&(i|=4,r=2),u.cRLSign&&(i|=2,r=1),u.encipherOnly&&(i|=1,r=0),u.decipherOnly&&(s|=128,r=7);var a=String.fromCharCode(r);s!==0?a+=String.fromCharCode(i)+String.fromCharCode(s):i!==0&&(a+=String.fromCharCode(i)),u.value=b.create(b.Class.UNIVERSAL,b.Type.BITSTRING,!1,a)}else if(u.name==="basicConstraints")u.value=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]),u.cA&&u.value.value.push(b.create(b.Class.UNIVERSAL,b.Type.BOOLEAN,!1,"\xFF")),"pathLenConstraint"in u&&u.value.value.push(b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(u.pathLenConstraint).getBytes()));else if(u.name==="extKeyUsage"){u.value=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);var o=u.value.value;for(var h in u)u[h]===!0&&(h in j0?o.push(b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(j0[h]).getBytes())):h.indexOf(".")!==-1&&o.push(b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(h).getBytes())))}else if(u.name==="nsCertType"){var r=0,i=0;u.client&&(i|=128,r=7),u.server&&(i|=64,r=6),u.email&&(i|=32,r=5),u.objsign&&(i|=16,r=4),u.reserved&&(i|=8,r=3),u.sslCA&&(i|=4,r=2),u.emailCA&&(i|=2,r=1),u.objCA&&(i|=1,r=0);var a=String.fromCharCode(r);i!==0&&(a+=String.fromCharCode(i)),u.value=b.create(b.Class.UNIVERSAL,b.Type.BITSTRING,!1,a)}else if(u.name==="subjectAltName"||u.name==="issuerAltName"){u.value=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);for(var f,d=0;d128)throw new Error('Invalid "nsComment" content.');u.value=b.create(b.Class.UNIVERSAL,b.Type.IA5STRING,!1,u.comment)}else if(u.name==="subjectKeyIdentifier"&&e.cert){var p=e.cert.generateSubjectKeyIdentifier();u.subjectKeyIdentifier=p.toHex(),u.value=b.create(b.Class.UNIVERSAL,b.Type.OCTETSTRING,!1,p.getBytes())}else if(u.name==="authorityKeyIdentifier"&&e.cert){u.value=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);var o=u.value.value;if(u.keyIdentifier){var E=u.keyIdentifier===!0?e.cert.generateSubjectKeyIdentifier().getBytes():u.keyIdentifier;o.push(b.create(b.Class.CONTEXT_SPECIFIC,0,!1,E))}if(u.authorityCertIssuer){var x=[b.create(b.Class.CONTEXT_SPECIFIC,4,!0,[Vo(u.authorityCertIssuer===!0?e.cert.issuer:u.authorityCertIssuer)])];o.push(b.create(b.Class.CONTEXT_SPECIFIC,1,!0,x))}if(u.serialNumber){var g=g0.util.hexToBytes(u.serialNumber===!0?e.cert.serialNumber:u.serialNumber);o.push(b.create(b.Class.CONTEXT_SPECIFIC,2,!1,g))}}else if(u.name==="cRLDistributionPoints"){u.value=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);for(var o=u.value.value,m=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]),A=b.create(b.Class.CONTEXT_SPECIFIC,0,!0,[]),f,d=0;d"u"){var t=new Error("Extension value not specified.");throw t.extension=u,t}return u}c(uk,"_fillMissingExtensionFields");function SC(u,e){switch(u){case j0["RSASSA-PSS"]:var t=[];return e.hash.algorithmOid!==void 0&&t.push(b.create(b.Class.CONTEXT_SPECIFIC,0,!0,[b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(e.hash.algorithmOid).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")])])),e.mgf.algorithmOid!==void 0&&t.push(b.create(b.Class.CONTEXT_SPECIFIC,1,!0,[b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(e.mgf.algorithmOid).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(e.mgf.hash.algorithmOid).getBytes()),b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")])])])),e.saltLength!==void 0&&t.push(b.create(b.Class.CONTEXT_SPECIFIC,2,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(e.saltLength).getBytes())])),b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,t);default:return b.create(b.Class.UNIVERSAL,b.Type.NULL,!1,"")}}c(SC,"_signatureParametersToAsn1");function a00(u){var e=b.create(b.Class.CONTEXT_SPECIFIC,0,!0,[]);if(u.attributes.length===0)return e;for(var t=u.attributes,r=0;r=o00&&u0&&r.value.push(t0.certificateExtensionsToAsn1(u.extensions)),r};t0.getCertificationRequestInfo=function(u){var e=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.INTEGER,!1,b.integerToDer(u.version).getBytes()),Vo(u.subject),t0.publicKeyToAsn1(u.publicKey),a00(u)]);return e};t0.distinguishedNameToAsn1=function(u){return Vo(u)};t0.certificateToAsn1=function(u){var e=u.tbsCertificate||t0.getTBSCertificate(u);return b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[e,b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[b.create(b.Class.UNIVERSAL,b.Type.OID,!1,b.oidToDer(u.signatureOid).getBytes()),SC(u.signatureOid,u.signatureParameters)]),b.create(b.Class.UNIVERSAL,b.Type.BITSTRING,!1,"\0"+u.signature)])};t0.certificateExtensionsToAsn1=function(u){var e=b.create(b.Class.CONTEXT_SPECIFIC,3,!0,[]),t=b.create(b.Class.UNIVERSAL,b.Type.SEQUENCE,!0,[]);e.value.push(t);for(var r=0;r"u"&&(i=new Date);var s=!0,a=null,o=0;do{var h=e.shift(),f=null,d=!1;if(i&&(ih.validity.notAfter)&&(a={message:"Certificate is not valid yet or has expired.",error:t0.certificateError.certificate_expired,notBefore:h.validity.notBefore,notAfter:h.validity.notAfter,now:i}),a===null){if(f=e[0]||u.getIssuer(h),f===null&&h.isIssuer(h)&&(d=!0,f=h),f){var p=f;g0.util.isArray(p)||(p=[p]);for(var E=!1;!E&&p.length>0;){f=p.shift();try{E=f.verify(h)}catch{}}E||(a={message:"Certificate signature is invalid.",error:t0.certificateError.bad_certificate})}a===null&&(!f||d)&&!u.hasCertificate(h)&&(a={message:"Certificate is not trusted.",error:t0.certificateError.unknown_ca})}if(a===null&&f&&!h.isIssuer(f)&&(a={message:"Certificate issuer is invalid.",error:t0.certificateError.bad_certificate}),a===null)for(var x={keyUsage:!0,basicConstraints:!0},g=0;a===null&&gA.pathLenConstraint&&(a={message:"Certificate basicConstraints pathLenConstraint violated.",error:t0.certificateError.bad_certificate})}}var L=a===null?!0:a.error,N=t.verify?t.verify(L,o,r):L;if(N===!0)a=null;else throw L===!0&&(a={message:"The application rejected the certificate.",error:t0.certificateError.bad_certificate}),(N||N===0)&&(typeof N=="object"&&!g0.util.isArray(N)?(N.message&&(a.message=N.message),N.error&&(a.error=N.error)):typeof N=="string"&&(a.error=N)),a;s=!1,++o}while(e.length>0);return!0}});var OC=w((Lf0,sk)=>{var _e=K0();Fr();ko();Os();IC();vC();lr();zh();Mo();X0();ky();var O=_e.asn1,M0=_e.pki,Qh=sk.exports=_e.pkcs12=_e.pkcs12||{},ik={name:"ContentInfo",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:O.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},l00={name:"PFX",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,capture:"version"},ik,{name:"PFX.macData",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:O.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:O.Class.UNIVERSAL,type:O.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:O.Class.UNIVERSAL,type:O.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},h00={name:"SafeBag",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:O.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},f00={name:"Attribute",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:O.Class.UNIVERSAL,type:O.Type.SET,constructed:!0,capture:"values"}]},d00={name:"CertBag",tagClass:O.Class.UNIVERSAL,type:O.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:O.Class.UNIVERSAL,type:O.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:O.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:O.Class.UNIVERSAL,type:O.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Yh(u,e,t,r){for(var i=[],s=0;s=0&&i.push(o)}}return i}c(Yh,"_getBagsByAttribute");Qh.pkcs12FromAsn1=function(u,e,t){typeof e=="string"?(t=e,e=!0):e===void 0&&(e=!0);var r={},i=[];if(!O.validate(u,l00,r,i)){var s=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw s.errors=s,s}var a={version:r.version.charCodeAt(0),safeContents:[],getBags:function(A){var T={},I;return"localKeyId"in A?I=A.localKeyId:"localKeyIdHex"in A&&(I=_e.util.hexToBytes(A.localKeyIdHex)),I===void 0&&!("friendlyName"in A)&&"bagType"in A&&(T[A.bagType]=Yh(a.safeContents,null,null,A.bagType)),I!==void 0&&(T.localKeyId=Yh(a.safeContents,"localKeyId",I,A.bagType)),"friendlyName"in A&&(T.friendlyName=Yh(a.safeContents,"friendlyName",A.friendlyName,A.bagType)),T},getBagsByFriendlyName:function(A,T){return Yh(a.safeContents,"friendlyName",A,T)},getBagsByLocalKeyId:function(A,T){return Yh(a.safeContents,"localKeyId",A,T)}};if(r.version.charCodeAt(0)!==3){var s=new Error("PKCS#12 PFX of version other than 3 not supported.");throw s.version=r.version.charCodeAt(0),s}if(O.derToOid(r.contentType)!==M0.oids.data){var s=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw s.oid=O.derToOid(r.contentType),s}var o=r.content.value[0];if(o.tagClass!==O.Class.UNIVERSAL||o.type!==O.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(o=KC(o),r.mac){var h=null,f=0,d=O.derToOid(r.macAlgorithm);switch(d){case M0.oids.sha1:h=_e.md.sha1.create(),f=20;break;case M0.oids.sha256:h=_e.md.sha256.create(),f=32;break;case M0.oids.sha384:h=_e.md.sha384.create(),f=48;break;case M0.oids.sha512:h=_e.md.sha512.create(),f=64;break;case M0.oids.md5:h=_e.md.md5.create(),f=16;break}if(h===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+d);var p=new _e.util.ByteBuffer(r.macSalt),E="macIterations"in r?parseInt(_e.util.bytesToHex(r.macIterations),16):1,x=Qh.generateKey(t,p,3,E,f,h),g=_e.hmac.create();g.start(h,x),g.update(o.value);var m=g.getMac();if(m.getBytes()!==r.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return p00(a,o.value,e,t),a};function KC(u){if(u.composed||u.constructed){for(var e=_e.util.createBuffer(),t=0;t0&&(s=O.create(O.Class.UNIVERSAL,O.Type.SET,!0,h));var f=[],d=[];e!==null&&(_e.util.isArray(e)?d=e:d=[e]);for(var p=[],E=0;E0){var A=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,p),T=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.data).getBytes()),O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,O.toDer(A).getBytes())])]);f.push(T)}var I=null;if(u!==null){var L=M0.wrapRsaPrivateKey(M0.privateKeyToAsn1(u));t===null?I=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.keyBag).getBytes()),O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[L]),s]):I=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.pkcs8ShroudedKeyBag).getBytes()),O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[M0.encryptPrivateKeyInfo(L,t,r)]),s]);var N=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[I]),k=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.data).getBytes()),O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,O.toDer(N).getBytes())])]);f.push(k)}var M=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,f),X;if(r.useMac){var o=_e.md.sha1.create(),u0=new _e.util.ByteBuffer(_e.random.getBytes(r.saltSize)),h0=r.count,u=Qh.generateKey(t,u0,3,h0,20),i0=_e.hmac.create();i0.start(o,u),i0.update(O.toDer(M).getBytes());var H=i0.getMac();X=O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.sha1).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.NULL,!1,"")]),O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,H.getBytes())]),O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,u0.getBytes()),O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(h0).getBytes())])}return O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.INTEGER,!1,O.integerToDer(3).getBytes()),O.create(O.Class.UNIVERSAL,O.Type.SEQUENCE,!0,[O.create(O.Class.UNIVERSAL,O.Type.OID,!1,O.oidToDer(M0.oids.data).getBytes()),O.create(O.Class.CONTEXT_SPECIFIC,0,!0,[O.create(O.Class.UNIVERSAL,O.Type.OCTETSTRING,!1,O.toDer(M).getBytes())])]),X])};Qh.generateKey=_e.pbe.generatePkcs12Key});var UC=w((Kf0,nk)=>{var ks=K0();Fr();Os();vC();Qn();wy();OC();Ny();zh();X0();ky();var NC=ks.asn1,Go=nk.exports=ks.pki=ks.pki||{};Go.pemToDer=function(u){var e=ks.pem.decode(u)[0];if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return ks.util.createBuffer(e.body)};Go.privateKeyFromPem=function(u){var e=ks.pem.decode(u)[0];if(e.type!=="PRIVATE KEY"&&e.type!=="RSA PRIVATE KEY"){var t=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var r=NC.fromDer(e.body);return Go.privateKeyFromAsn1(r)};Go.privateKeyToPem=function(u,e){var t={type:"RSA PRIVATE KEY",body:NC.toDer(Go.privateKeyToAsn1(u)).getBytes()};return ks.pem.encode(t,{maxline:e})};Go.privateKeyInfoToPem=function(u,e){var t={type:"PRIVATE KEY",body:NC.toDer(u).getBytes()};return ks.pem.encode(t,{maxline:e})}});var MC=w((Of0,pk)=>{var Q=K0();Fr();ko();_y();Qn();UC();lr();Mo();X0();var My=c(function(u,e,t,r){var i=Q.util.createBuffer(),s=u.length>>1,a=s+(u.length&1),o=u.substr(0,a),h=u.substr(s,a),f=Q.util.createBuffer(),d=Q.hmac.create();t=e+t;var p=Math.ceil(r/16),E=Math.ceil(r/20);d.start("MD5",o);var x=Q.util.createBuffer();f.putBytes(t);for(var g=0;g0&&(C.queue(u,C.createAlert(u,{level:C.Alert.Level.warning,description:C.Alert.Description.no_renegotiation})),C.flush(u)),u.process()};C.parseHelloMessage=function(u,e,t){var r=null,i=u.entity===C.ConnectionEnd.client;if(t<38)u.error(u,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});else{var s=e.fragment,a=s.length();if(r={version:{major:s.getByte(),minor:s.getByte()},random:Q.util.createBuffer(s.getBytes(32)),session_id:Wu(s,1),extensions:[]},i?(r.cipher_suite=s.getBytes(2),r.compression_method=s.getByte()):(r.cipher_suites=Wu(s,2),r.compression_methods=Wu(s,1)),a=t-(a-s.length()),a>0){for(var o=Wu(s,2);o.length()>0;)r.extensions.push({type:[o.getByte(),o.getByte()],data:Wu(o,2)});if(!i)for(var h=0;h0;){var p=d.getByte();if(p!==0)break;u.session.extensions.server_name.serverNameList.push(Wu(d,2).getBytes())}}}if(u.session.version&&(r.version.major!==u.session.version.major||r.version.minor!==u.session.version.minor))return u.error(u,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}});if(i)u.session.cipherSuite=C.getCipherSuite(r.cipher_suite);else for(var E=Q.util.createBuffer(r.cipher_suites.bytes());E.length()>0&&(u.session.cipherSuite=C.getCipherSuite(E.getBytes(2)),u.session.cipherSuite===null););if(u.session.cipherSuite===null)return u.error(u,{message:"No cipher suites in common.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.handshake_failure},cipherSuite:Q.util.bytesToHex(r.cipher_suite)});i?u.session.compressionMethod=r.compression_method:u.session.compressionMethod=C.CompressionMethod.none}return r};C.createSecurityParameters=function(u,e){var t=u.entity===C.ConnectionEnd.client,r=e.random.bytes(),i=t?u.session.sp.client_random:r,s=t?r:C.createRandom().getBytes();u.session.sp={entity:u.entity,prf_algorithm:C.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:u.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:s}};C.handleServerHello=function(u,e,t){var r=C.parseHelloMessage(u,e,t);if(!u.fail){if(r.version.minor<=u.version.minor)u.version.minor=r.version.minor;else return u.error(u,{message:"Incompatible TLS version.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}});u.session.version=u.version;var i=r.session_id.bytes();i.length>0&&i===u.session.id?(u.expect=ck,u.session.resuming=!0,u.session.sp.server_random=r.random.bytes()):(u.expect=_00,u.session.resuming=!1,C.createSecurityParameters(u,r)),u.session.id=i,u.process()}};C.handleClientHello=function(u,e,t){var r=C.parseHelloMessage(u,e,t);if(!u.fail){var i=r.session_id.bytes(),s=null;if(u.sessionCache&&(s=u.sessionCache.getSession(i),s===null?i="":(s.version.major!==r.version.major||s.version.minor>r.version.minor)&&(s=null,i="")),i.length===0&&(i=Q.random.getBytes(32)),u.session.id=i,u.session.clientHelloVersion=r.version,u.session.sp={},s)u.version=u.session.version=s.version,u.session.sp=s.sp;else{for(var a,o=1;o0;)s=Wu(i.certificate_list,3),a=Q.asn1.fromDer(s),s=Q.pki.certificateFromAsn1(a,!0),o.push(s)}catch(f){return u.error(u,{message:"Could not parse certificate list.",cause:f,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.bad_certificate}})}var h=u.entity===C.ConnectionEnd.client;(h||u.verifyClient===!0)&&o.length===0?u.error(u,{message:h?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}}):o.length===0?u.expect=h?ak:BC:(h?u.session.serverCertificate=o[0]:u.session.clientCertificate=o[0],C.verifyCertificateChain(u,o)&&(u.expect=h?ak:BC)),u.process()};C.handleServerKeyExchange=function(u,e,t){if(t>0)return u.error(u,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.unsupported_certificate}});u.expect=C00,u.process()};C.handleClientKeyExchange=function(u,e,t){if(t<48)return u.error(u,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.unsupported_certificate}});var r=e.fragment,i={enc_pre_master_secret:Wu(r,2).getBytes()},s=null;if(u.getPrivateKey)try{s=u.getPrivateKey(u,u.session.serverCertificate),s=Q.pki.privateKeyFromPem(s)}catch(h){u.error(u,{message:"Could not get private key.",cause:h,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}})}if(s===null)return u.error(u,{message:"No private key set.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}});try{var a=u.session.sp;a.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var o=u.session.clientHelloVersion;if(o.major!==a.pre_master_secret.charCodeAt(0)||o.minor!==a.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{a.pre_master_secret=Q.random.getBytes(48)}u.expect=DC,u.session.clientCertificate!==null&&(u.expect=S00),u.process()};C.handleCertificateRequest=function(u,e,t){if(t<3)return u.error(u,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var r=e.fragment,i={certificate_types:Wu(r,1),certificate_authorities:Wu(r,2)};u.session.certificateRequest=i,u.expect=R00,u.process()};C.handleCertificateVerify=function(u,e,t){if(t<2)return u.error(u,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var r=e.fragment;r.read-=4;var i=r.bytes();r.read+=4;var s={signature:Wu(r,2).getBytes()},a=Q.util.createBuffer();a.putBuffer(u.session.md5.digest()),a.putBuffer(u.session.sha1.digest()),a=a.getBytes();try{var o=u.session.clientCertificate;if(!o.publicKey.verify(a,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");u.session.md5.update(i),u.session.sha1.update(i)}catch{return u.error(u,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.handshake_failure}})}u.expect=DC,u.process()};C.handleServerHelloDone=function(u,e,t){if(t>0)return u.error(u,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.record_overflow}});if(u.serverCertificate===null){var r={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.insufficient_security}},i=0,s=u.verify(u,r.alert.description,i,[]);if(s!==!0)return(s||s===0)&&(typeof s=="object"&&!Q.util.isArray(s)?(s.message&&(r.message=s.message),s.alert&&(r.alert.description=s.alert)):typeof s=="number"&&(r.alert.description=s)),u.error(u,r)}u.session.certificateRequest!==null&&(e=C.createRecord(u,{type:C.ContentType.handshake,data:C.createCertificate(u)}),C.queue(u,e)),e=C.createRecord(u,{type:C.ContentType.handshake,data:C.createClientKeyExchange(u)}),C.queue(u,e),u.expect=v00;var a=c(function(o,h){o.session.certificateRequest!==null&&o.session.clientCertificate!==null&&C.queue(o,C.createRecord(o,{type:C.ContentType.handshake,data:C.createCertificateVerify(o,h)})),C.queue(o,C.createRecord(o,{type:C.ContentType.change_cipher_spec,data:C.createChangeCipherSpec()})),o.state.pending=C.createConnectionState(o),o.state.current.write=o.state.pending.write,C.queue(o,C.createRecord(o,{type:C.ContentType.handshake,data:C.createFinished(o)})),o.expect=ck,C.flush(o),o.process()},"callback");if(u.session.certificateRequest===null||u.session.clientCertificate===null)return a(u,null);C.getClientSignature(u,a)};C.handleChangeCipherSpec=function(u,e){if(e.fragment.getByte()!==1)return u.error(u,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.illegal_parameter}});var t=u.entity===C.ConnectionEnd.client;(u.session.resuming&&t||!u.session.resuming&&!t)&&(u.state.pending=C.createConnectionState(u)),u.state.current.read=u.state.pending.read,(!u.session.resuming&&t||u.session.resuming&&!t)&&(u.state.pending=null),u.expect=t?A00:K00,u.process()};C.handleFinished=function(u,e,t){var r=e.fragment;r.read-=4;var i=r.bytes();r.read+=4;var s=e.fragment.getBytes();r=Q.util.createBuffer(),r.putBuffer(u.session.md5.digest()),r.putBuffer(u.session.sha1.digest());var a=u.entity===C.ConnectionEnd.client,o=a?"server finished":"client finished",h=u.session.sp,f=12,d=My;if(r=d(h.master_secret,o,r.getBytes(),f),r.getBytes()!==s)return u.error(u,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.decrypt_error}});u.session.md5.update(i),u.session.sha1.update(i),(u.session.resuming&&a||!u.session.resuming&&!a)&&(C.queue(u,C.createRecord(u,{type:C.ContentType.change_cipher_spec,data:C.createChangeCipherSpec()})),u.state.current.write=u.state.pending.write,u.state.pending=null,C.queue(u,C.createRecord(u,{type:C.ContentType.handshake,data:C.createFinished(u)}))),u.expect=a?w00:O00,u.handshaking=!1,++u.handshakes,u.peerCertificate=a?u.session.serverCertificate:u.session.clientCertificate,C.flush(u),u.isConnected=!0,u.connected(u),u.process()};C.handleAlert=function(u,e){var t=e.fragment,r={level:t.getByte(),description:t.getByte()},i;switch(r.description){case C.Alert.Description.close_notify:i="Connection closed.";break;case C.Alert.Description.unexpected_message:i="Unexpected message.";break;case C.Alert.Description.bad_record_mac:i="Bad record MAC.";break;case C.Alert.Description.decryption_failed:i="Decryption failed.";break;case C.Alert.Description.record_overflow:i="Record overflow.";break;case C.Alert.Description.decompression_failure:i="Decompression failed.";break;case C.Alert.Description.handshake_failure:i="Handshake failure.";break;case C.Alert.Description.bad_certificate:i="Bad certificate.";break;case C.Alert.Description.unsupported_certificate:i="Unsupported certificate.";break;case C.Alert.Description.certificate_revoked:i="Certificate revoked.";break;case C.Alert.Description.certificate_expired:i="Certificate expired.";break;case C.Alert.Description.certificate_unknown:i="Certificate unknown.";break;case C.Alert.Description.illegal_parameter:i="Illegal parameter.";break;case C.Alert.Description.unknown_ca:i="Unknown certificate authority.";break;case C.Alert.Description.access_denied:i="Access denied.";break;case C.Alert.Description.decode_error:i="Decode error.";break;case C.Alert.Description.decrypt_error:i="Decrypt error.";break;case C.Alert.Description.export_restriction:i="Export restriction.";break;case C.Alert.Description.protocol_version:i="Unsupported protocol version.";break;case C.Alert.Description.insufficient_security:i="Insufficient security.";break;case C.Alert.Description.internal_error:i="Internal error.";break;case C.Alert.Description.user_canceled:i="User canceled.";break;case C.Alert.Description.no_renegotiation:i="Renegotiation not supported.";break;default:i="Unknown error.";break}if(r.description===C.Alert.Description.close_notify)return u.close();u.error(u,{message:i,send:!1,origin:u.entity===C.ConnectionEnd.client?"server":"client",alert:r}),u.process()};C.handleHandshake=function(u,e){var t=e.fragment,r=t.getByte(),i=t.getInt24();if(i>t.length())return u.fragmented=e,e.fragment=Q.util.createBuffer(),t.read-=4,u.process();u.fragmented=null,t.read-=4;var s=t.bytes(i+4);t.read+=4,r in Fy[u.entity][u.expect]?(u.entity===C.ConnectionEnd.server&&!u.open&&!u.fail&&(u.handshaking=!0,u.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:Q.md.md5.create(),sha1:Q.md.sha1.create()}),r!==C.HandshakeType.hello_request&&r!==C.HandshakeType.certificate_verify&&r!==C.HandshakeType.finished&&(u.session.md5.update(s),u.session.sha1.update(s)),Fy[u.entity][u.expect][r](u,e,i)):C.handleUnexpected(u,e)};C.handleApplicationData=function(u,e){u.data.putBuffer(e.fragment),u.dataReady(u),u.process()};C.handleHeartbeat=function(u,e){var t=e.fragment,r=t.getByte(),i=t.getInt16(),s=t.getBytes(i);if(r===C.HeartbeatMessageType.heartbeat_request){if(u.handshaking||i>s.length)return u.process();C.queue(u,C.createRecord(u,{type:C.ContentType.heartbeat,data:C.createHeartbeat(C.HeartbeatMessageType.heartbeat_response,s)})),C.flush(u)}else if(r===C.HeartbeatMessageType.heartbeat_response){if(s!==u.expectedHeartbeatPayload)return u.process();u.heartbeatReceived&&u.heartbeatReceived(u,Q.util.createBuffer(s))}u.process()};var b00=0,_00=1,ak=2,C00=3,R00=4,ck=5,A00=6,w00=7,v00=8,I00=0,L00=1,BC=2,S00=3,DC=4,K00=5,O00=6,_=C.handleUnexpected,lk=C.handleChangeCipherSpec,Pt=C.handleAlert,du=C.handleHandshake,hk=C.handleApplicationData,kt=C.handleHeartbeat,FC=[];FC[C.ConnectionEnd.client]=[[_,Pt,du,_,kt],[_,Pt,du,_,kt],[_,Pt,du,_,kt],[_,Pt,du,_,kt],[_,Pt,du,_,kt],[lk,Pt,_,_,kt],[_,Pt,du,_,kt],[_,Pt,du,hk,kt],[_,Pt,du,_,kt]];FC[C.ConnectionEnd.server]=[[_,Pt,du,_,kt],[_,Pt,du,_,kt],[_,Pt,du,_,kt],[_,Pt,du,_,kt],[lk,Pt,_,_,kt],[_,Pt,du,_,kt],[_,Pt,du,hk,kt],[_,Pt,du,_,kt]];var Bs=C.handleHelloRequest,N00=C.handleServerHello,fk=C.handleCertificate,ok=C.handleServerKeyExchange,PC=C.handleCertificateRequest,By=C.handleServerHelloDone,dk=C.handleFinished,Fy=[];Fy[C.ConnectionEnd.client]=[[_,_,N00,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,fk,ok,PC,By,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,ok,PC,By,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,PC,By,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,_,By,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,dk],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[Bs,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_]];var U00=C.handleClientHello,P00=C.handleClientKeyExchange,k00=C.handleCertificateVerify;Fy[C.ConnectionEnd.server]=[[_,U00,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,fk,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,P00,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,k00,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,dk],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_],[_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_,_]];C.generateKeys=function(u,e){var t=My,r=e.client_random+e.server_random;u.session.resuming||(e.master_secret=t(e.pre_master_secret,"master secret",r,48).bytes(),e.pre_master_secret=null),r=e.server_random+e.client_random;var i=2*e.mac_key_length+2*e.enc_key_length,s=u.version.major===C.Versions.TLS_1_0.major&&u.version.minor===C.Versions.TLS_1_0.minor;s&&(i+=2*e.fixed_iv_length);var a=t(e.master_secret,"key expansion",r,i),o={client_write_MAC_key:a.getBytes(e.mac_key_length),server_write_MAC_key:a.getBytes(e.mac_key_length),client_write_key:a.getBytes(e.enc_key_length),server_write_key:a.getBytes(e.enc_key_length)};return s&&(o.client_write_IV=a.getBytes(e.fixed_iv_length),o.server_write_IV=a.getBytes(e.fixed_iv_length)),o};C.createConnectionState=function(u){var e=u.entity===C.ConnectionEnd.client,t=c(function(){var s={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){s.sequenceNumber[1]===4294967295?(s.sequenceNumber[1]=0,++s.sequenceNumber[0]):++s.sequenceNumber[1]}};return s},"createMode"),r={read:t(),write:t()};if(r.read.update=function(s,a){return r.read.cipherFunction(a,r.read)?r.read.compressFunction(s,a,r.read)||s.error(s,{message:"Could not decompress record.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.decompression_failure}}):s.error(s,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.bad_record_mac}}),!s.fail},r.write.update=function(s,a){return r.write.compressFunction(s,a,r.write)?r.write.cipherFunction(a,r.write)||s.error(s,{message:"Could not encrypt record.",send:!1,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}):s.error(s,{message:"Could not compress record.",send:!1,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}),!s.fail},u.session){var i=u.session.sp;switch(u.session.cipherSuite.initSecurityParameters(i),i.keys=C.generateKeys(u,i),r.read.macKey=e?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,r.write.macKey=e?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,u.session.cipherSuite.initConnectionState(r,u,i),i.compression_algorithm){case C.CompressionMethod.none:break;case C.CompressionMethod.deflate:r.read.compressFunction=T00,r.write.compressFunction=x00;break;default:throw new Error("Unsupported compression algorithm.")}}return r};C.createRandom=function(){var u=new Date,e=+u+u.getTimezoneOffset()*6e4,t=Q.util.createBuffer();return t.putInt32(e),t.putBytes(Q.random.getBytes(28)),t};C.createRecord=function(u,e){if(!e.data)return null;var t={type:e.type,version:{major:u.version.major,minor:u.version.minor},length:e.data.length(),fragment:e.data};return t};C.createAlert=function(u,e){var t=Q.util.createBuffer();return t.putByte(e.level),t.putByte(e.description),C.createRecord(u,{type:C.ContentType.alert,data:t})};C.createClientHello=function(u){u.session.clientHelloVersion={major:u.version.major,minor:u.version.minor};for(var e=Q.util.createBuffer(),t=0;t0&&(p+=2);var E=u.session.id,x=E.length+1+2+4+28+2+i+1+a+p,g=Q.util.createBuffer();return g.putByte(C.HandshakeType.client_hello),g.putInt24(x),g.putByte(u.version.major),g.putByte(u.version.minor),g.putBytes(u.session.sp.client_random),pr(g,1,Q.util.createBuffer(E)),pr(g,2,e),pr(g,1,s),p>0&&pr(g,2,o),g};C.createServerHello=function(u){var e=u.session.id,t=e.length+1+2+4+28+2+1,r=Q.util.createBuffer();return r.putByte(C.HandshakeType.server_hello),r.putInt24(t),r.putByte(u.version.major),r.putByte(u.version.minor),r.putBytes(u.session.sp.server_random),pr(r,1,Q.util.createBuffer(e)),r.putByte(u.session.cipherSuite.id[0]),r.putByte(u.session.cipherSuite.id[1]),r.putByte(u.session.compressionMethod),r};C.createCertificate=function(u){var e=u.entity===C.ConnectionEnd.client,t=null;if(u.getCertificate){var r;e?r=u.session.certificateRequest:r=u.session.extensions.server_name.serverNameList,t=u.getCertificate(u,r)}var i=Q.util.createBuffer();if(t!==null)try{Q.util.isArray(t)||(t=[t]);for(var s=null,a=0;a0&&(t.putByte(C.HandshakeType.server_key_exchange),t.putInt24(e)),t};C.getClientSignature=function(u,e){var t=Q.util.createBuffer();t.putBuffer(u.session.md5.digest()),t.putBuffer(u.session.sha1.digest()),t=t.getBytes(),u.getSignature=u.getSignature||function(r,i,s){var a=null;if(r.getPrivateKey)try{a=r.getPrivateKey(r,r.session.clientCertificate),a=Q.pki.privateKeyFromPem(a)}catch(o){r.error(r,{message:"Could not get private key.",cause:o,send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}})}a===null?r.error(r,{message:"No private key set.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.internal_error}}):i=a.sign(i,null),s(r,i)},u.getSignature(u,t,e)};C.createCertificateVerify=function(u,e){var t=e.length+2,r=Q.util.createBuffer();return r.putByte(C.HandshakeType.certificate_verify),r.putInt24(t),r.putInt16(e.length),r.putBytes(e),r};C.createCertificateRequest=function(u){var e=Q.util.createBuffer();e.putByte(1);var t=Q.util.createBuffer();for(var r in u.caStore.certs){var i=u.caStore.certs[r],s=Q.pki.distinguishedNameToAsn1(i.subject),a=Q.asn1.toDer(s);t.putInt16(a.length()),t.putBuffer(a)}var o=1+e.length()+2+t.length(),h=Q.util.createBuffer();return h.putByte(C.HandshakeType.certificate_request),h.putInt24(o),pr(h,1,e),pr(h,2,t),h};C.createServerHelloDone=function(u){var e=Q.util.createBuffer();return e.putByte(C.HandshakeType.server_hello_done),e.putInt24(0),e};C.createChangeCipherSpec=function(){var u=Q.util.createBuffer();return u.putByte(1),u};C.createFinished=function(u){var e=Q.util.createBuffer();e.putBuffer(u.session.md5.digest()),e.putBuffer(u.session.sha1.digest());var t=u.entity===C.ConnectionEnd.client,r=u.session.sp,i=12,s=My,a=t?"client finished":"server finished";e=s(r.master_secret,a,e.getBytes(),i);var o=Q.util.createBuffer();return o.putByte(C.HandshakeType.finished),o.putInt24(e.length()),o.putBuffer(e),o};C.createHeartbeat=function(u,e,t){typeof t>"u"&&(t=e.length);var r=Q.util.createBuffer();r.putByte(u),r.putInt16(t),r.putBytes(e);var i=r.length(),s=Math.max(16,i-t-3);return r.putBytes(Q.random.getBytes(s)),r};C.queue=function(u,e){if(e&&!(e.fragment.length()===0&&(e.type===C.ContentType.handshake||e.type===C.ContentType.alert||e.type===C.ContentType.change_cipher_spec))){if(e.type===C.ContentType.handshake){var t=e.fragment.bytes();u.session.md5.update(t),u.session.sha1.update(t),t=null}var r;if(e.fragment.length()<=C.MaxFragment)r=[e];else{r=[];for(var i=e.fragment.bytes();i.length>C.MaxFragment;)r.push(C.createRecord(u,{type:e.type,data:Q.util.createBuffer(i.slice(0,C.MaxFragment))})),i=i.slice(C.MaxFragment);i.length>0&&r.push(C.createRecord(u,{type:e.type,data:Q.util.createBuffer(i)}))}for(var s=0;s0&&(a=t.order[0]),a!==null&&a in t.cache){s=t.cache[a],delete t.cache[a];for(var o in t.order)if(t.order[o]===a){t.order.splice(o,1);break}}return s},t.setSession=function(i,s){if(t.order.length===t.capacity){var a=t.order.shift();delete t.cache[a]}var a=Q.util.bytesToHex(i);t.order.push(a),t.cache[a]=s}}return t};C.createConnection=function(u){var e=null;u.caStore?Q.util.isArray(u.caStore)?e=Q.pki.createCaStore(u.caStore):e=u.caStore:e=Q.pki.createCaStore();var t=u.cipherSuites||null;if(t===null){t=[];for(var r in C.CipherSuites)t.push(C.CipherSuites[r])}var i=u.server?C.ConnectionEnd.server:C.ConnectionEnd.client,s=u.sessionCache?C.createSessionCache(u.sessionCache):null,a={version:{major:C.Version.major,minor:C.Version.minor},entity:i,sessionId:u.sessionId,caStore:e,sessionCache:s,cipherSuites:t,connected:u.connected,virtualHost:u.virtualHost||null,verifyClient:u.verifyClient||!1,verify:u.verify||function(d,p,E,x){return p},verifyOptions:u.verifyOptions||{},getCertificate:u.getCertificate||null,getPrivateKey:u.getPrivateKey||null,getSignature:u.getSignature||null,input:Q.util.createBuffer(),tlsData:Q.util.createBuffer(),data:Q.util.createBuffer(),tlsDataReady:u.tlsDataReady,dataReady:u.dataReady,heartbeatReceived:u.heartbeatReceived,closed:u.closed,error:function(d,p){p.origin=p.origin||(d.entity===C.ConnectionEnd.client?"client":"server"),p.send&&(C.queue(d,C.createAlert(d,p.alert)),C.flush(d));var E=p.fatal!==!1;E&&(d.fail=!0),u.error(d,p),E&&d.close(!1)},deflate:u.deflate||null,inflate:u.inflate||null};a.reset=function(d){a.version={major:C.Version.major,minor:C.Version.minor},a.record=null,a.session=null,a.peerCertificate=null,a.state={pending:null,current:null},a.expect=a.entity===C.ConnectionEnd.client?b00:I00,a.fragmented=null,a.records=[],a.open=!1,a.handshakes=0,a.handshaking=!1,a.isConnected=!1,a.fail=!(d||typeof d>"u"),a.input.clear(),a.tlsData.clear(),a.data.clear(),a.state.current=C.createConnectionState(a)},a.reset();var o=c(function(d,p){var E=p.type-C.ContentType.change_cipher_spec,x=FC[d.entity][d.expect];E in x?x[E](d,p):C.handleUnexpected(d,p)},"_update"),h=c(function(d){var p=0,E=d.input,x=E.length();if(x<5)p=5-x;else{d.record={type:E.getByte(),version:{major:E.getByte(),minor:E.getByte()},length:E.getInt16(),fragment:Q.util.createBuffer(),ready:!1};var g=d.record.version.major===d.version.major;g&&d.session&&d.session.version&&(g=d.record.version.minor===d.version.minor),g||d.error(d,{message:"Incompatible TLS version.",send:!0,alert:{level:C.Alert.Level.fatal,description:C.Alert.Description.protocol_version}})}return p},"_readRecordHeader"),f=c(function(d){var p=0,E=d.input,x=E.length();if(x0&&(a.sessionCache&&(p=a.sessionCache.getSession(d)),p===null&&(d="")),d.length===0&&a.sessionCache&&(p=a.sessionCache.getSession(),p!==null&&(d=p.id)),a.session={id:d,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:Q.md.md5.create(),sha1:Q.md.sha1.create()},p&&(a.version=p.version,a.session.sp=p.sp),a.session.sp.client_random=C.createRandom().getBytes(),a.open=!0,C.queue(a,C.createRecord(a,{type:C.ContentType.handshake,data:C.createClientHello(a)})),C.flush(a)}},a.process=function(d){var p=0;return d&&a.input.putBytes(d),a.fail||(a.record!==null&&a.record.ready&&a.record.fragment.isEmpty()&&(a.record=null),a.record===null&&(p=h(a)),!a.fail&&a.record!==null&&!a.record.ready&&(p=f(a)),!a.fail&&a.record!==null&&a.record.ready&&o(a,a.record)),p},a.prepare=function(d){return C.queue(a,C.createRecord(a,{type:C.ContentType.application_data,data:Q.util.createBuffer(d)})),C.flush(a)},a.prepareHeartbeatRequest=function(d,p){return d instanceof Q.util.ByteBuffer&&(d=d.bytes()),typeof p>"u"&&(p=d.length),a.expectedHeartbeatPayload=d,C.queue(a,C.createRecord(a,{type:C.ContentType.heartbeat,data:C.createHeartbeat(C.HeartbeatMessageType.heartbeat_request,d,p)})),C.flush(a)},a.close=function(d){if(!a.fail&&a.sessionCache&&a.session){var p={id:a.session.id,version:a.session.version,sp:a.session.sp};p.sp.keys=null,a.sessionCache.setSession(p.id,p)}a.open&&(a.open=!1,a.input.clear(),(a.isConnected||a.handshaking)&&(a.isConnected=a.handshaking=!1,C.queue(a,C.createAlert(a,{level:C.Alert.Level.warning,description:C.Alert.Description.close_notify})),C.flush(a)),a.closed(a)),a.reset(d)},a};pk.exports=Q.tls=Q.tls||{};for(Dy in C)typeof C[Dy]!="function"&&(Q.tls[Dy]=C[Dy]);var Dy;Q.tls.prf_tls1=My;Q.tls.hmac_sha1=m00;Q.tls.createSessionCache=C.createSessionCache;Q.tls.createConnection=C.createConnection});var Ek=w((Uf0,gk)=>{var Ds=K0();Ks();MC();var yr=gk.exports=Ds.tls;yr.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(u){u.bulk_cipher_algorithm=yr.BulkCipherAlgorithm.aes,u.cipher_type=yr.CipherType.block,u.enc_key_length=16,u.block_length=16,u.fixed_iv_length=16,u.record_iv_length=16,u.mac_algorithm=yr.MACAlgorithm.hmac_sha1,u.mac_length=20,u.mac_key_length=20},initConnectionState:yk};yr.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(u){u.bulk_cipher_algorithm=yr.BulkCipherAlgorithm.aes,u.cipher_type=yr.CipherType.block,u.enc_key_length=32,u.block_length=16,u.fixed_iv_length=16,u.record_iv_length=16,u.mac_algorithm=yr.MACAlgorithm.hmac_sha1,u.mac_length=20,u.mac_key_length=20},initConnectionState:yk};function yk(u,e,t){var r=e.entity===Ds.tls.ConnectionEnd.client;u.read.cipherState={init:!1,cipher:Ds.cipher.createDecipher("AES-CBC",r?t.keys.server_write_key:t.keys.client_write_key),iv:r?t.keys.server_write_IV:t.keys.client_write_IV},u.write.cipherState={init:!1,cipher:Ds.cipher.createCipher("AES-CBC",r?t.keys.client_write_key:t.keys.server_write_key),iv:r?t.keys.client_write_IV:t.keys.server_write_IV},u.read.cipherFunction=H00,u.write.cipherFunction=D00,u.read.macLength=u.write.macLength=t.mac_length,u.read.macFunction=u.write.macFunction=yr.hmac_sha1}c(yk,"initConnectionState");function D00(u,e){var t=!1,r=e.macFunction(e.macKey,e.sequenceNumber,u);u.fragment.putBytes(r),e.updateSequenceNumber();var i;u.version.minor===yr.Versions.TLS_1_0.minor?i=e.cipherState.init?null:e.cipherState.iv:i=Ds.random.getBytesSync(16),e.cipherState.init=!0;var s=e.cipherState.cipher;return s.start({iv:i}),u.version.minor>=yr.Versions.TLS_1_1.minor&&s.output.putBytes(i),s.update(u.fragment),s.finish(F00)&&(u.fragment=s.output,u.length=u.fragment.length(),t=!0),t}c(D00,"encrypt_aes_cbc_sha1");function F00(u,e,t){if(!t){var r=u-e.length()%u;e.fillWithByte(r-1,r)}return!0}c(F00,"encrypt_aes_cbc_sha1_padding");function M00(u,e,t){var r=!0;if(t){for(var i=e.length(),s=e.last(),a=i-1-s;a=s?(u.fragment=i.output.getBytes(o-s),a=i.output.getBytes(s)):u.fragment=i.output.getBytes(),u.fragment=Ds.util.createBuffer(u.fragment),u.length=u.fragment.length();var h=e.macFunction(e.macKey,e.sequenceNumber,u);return e.updateSequenceNumber(),t=q00(e.macKey,a,h)&&t,t}c(H00,"decrypt_aes_cbc_sha1");function q00(u,e,t){var r=Ds.hmac.create();return r.start("SHA1",u),r.update(e),e=r.digest().getBytes(),r.start(null,null),r.update(t),t=r.digest().getBytes(),e===t}c(q00,"compareMacs")});var VC=w((kf0,bk)=>{var ve=K0();li();X0();var jh=bk.exports=ve.sha512=ve.sha512||{};ve.md.sha512=ve.md.algorithms.sha512=jh;var xk=ve.sha384=ve.sha512.sha384=ve.sha512.sha384||{};xk.create=function(){return jh.create("SHA-384")};ve.md.sha384=ve.md.algorithms.sha384=xk;ve.sha512.sha256=ve.sha512.sha256||{create:function(){return jh.create("SHA-512/256")}};ve.md["sha512/256"]=ve.md.algorithms["sha512/256"]=ve.sha512.sha256;ve.sha512.sha224=ve.sha512.sha224||{create:function(){return jh.create("SHA-512/224")}};ve.md["sha512/224"]=ve.md.algorithms["sha512/224"]=ve.sha512.sha224;jh.create=function(u){if(Tk||V00(),typeof u>"u"&&(u="SHA-512"),!(u in ea))throw new Error("Invalid SHA-512 algorithm: "+u);for(var e=ea[u],t=null,r=ve.util.createBuffer(),i=new Array(80),s=0;s<80;++s)i[s]=new Array(2);var a=64;switch(u){case"SHA-384":a=48;break;case"SHA-512/256":a=32;break;case"SHA-512/224":a=28;break}var o={algorithm:u.replace("-","").toLowerCase(),blockLength:128,digestLength:a,messageLength:0,fullMessageLength:null,messageLengthSize:16};return o.start=function(){o.messageLength=0,o.fullMessageLength=o.messageLength128=[];for(var h=o.messageLengthSize/4,f=0;f>>0,d>>>0];for(var p=o.fullMessageLength.length-1;p>=0;--p)o.fullMessageLength[p]+=d[1],d[1]=d[0]+(o.fullMessageLength[p]/4294967296>>>0),o.fullMessageLength[p]=o.fullMessageLength[p]>>>0,d[0]=d[1]/4294967296>>>0;return r.putBytes(h),mk(t,i,r),(r.read>2048||r.length()===0)&&r.compact(),o},o.digest=function(){var h=ve.util.createBuffer();h.putBytes(r.bytes());var f=o.fullMessageLength[o.fullMessageLength.length-1]+o.messageLengthSize,d=f&o.blockLength-1;h.putBytes(HC.substr(0,o.blockLength-d));for(var p,E,x=o.fullMessageLength[0]*8,g=0;g>>0,x+=E,h.putInt32(x>>>0),x=p>>>0;h.putInt32(x);for(var m=new Array(t.length),g=0;g=128;){for($=0;$<16;++$)e[$][0]=t.getInt32()>>>0,e[$][1]=t.getInt32()>>>0;for(;$<80;++$)W0=e[$-2],d0=W0[0],r0=W0[1],r=((d0>>>19|r0<<13)^(r0>>>29|d0<<3)^d0>>>6)>>>0,i=((d0<<13|r0>>>19)^(r0<<3|d0>>>29)^(d0<<26|r0>>>6))>>>0,U0=e[$-15],d0=U0[0],r0=U0[1],s=((d0>>>1|r0<<31)^(d0>>>8|r0<<24)^d0>>>7)>>>0,a=((d0<<31|r0>>>1)^(d0<<24|r0>>>8)^(d0<<25|r0>>>7))>>>0,oe=e[$-7],z0=e[$-16],r0=i+oe[1]+a+z0[1],e[$][0]=r+oe[0]+s+z0[0]+(r0/4294967296>>>0)>>>0,e[$][1]=r0>>>0;for(m=u[0][0],A=u[0][1],T=u[1][0],I=u[1][1],L=u[2][0],N=u[2][1],k=u[3][0],M=u[3][1],X=u[4][0],u0=u[4][1],h0=u[5][0],i0=u[5][1],H=u[6][0],L0=u[6][1],V=u[7][0],v=u[7][1],$=0;$<80;++$)f=((X>>>14|u0<<18)^(X>>>18|u0<<14)^(u0>>>9|X<<23))>>>0,d=((X<<18|u0>>>14)^(X<<14|u0>>>18)^(u0<<23|X>>>9))>>>0,p=(H^X&(h0^H))>>>0,E=(L0^u0&(i0^L0))>>>0,o=((m>>>28|A<<4)^(A>>>2|m<<30)^(A>>>7|m<<25))>>>0,h=((m<<4|A>>>28)^(A<<30|m>>>2)^(A<<25|m>>>7))>>>0,x=(m&T|L&(m^T))>>>0,g=(A&I|N&(A^I))>>>0,r0=v+d+E+qC[$][1]+e[$][1],r=V+f+p+qC[$][0]+e[$][0]+(r0/4294967296>>>0)>>>0,i=r0>>>0,r0=h+g,s=o+x+(r0/4294967296>>>0)>>>0,a=r0>>>0,V=H,v=L0,H=h0,L0=i0,h0=X,i0=u0,r0=M+i,X=k+r+(r0/4294967296>>>0)>>>0,u0=r0>>>0,k=L,M=N,L=T,N=I,T=m,I=A,r0=i+a,m=r+s+(r0/4294967296>>>0)>>>0,A=r0>>>0;r0=u[0][1]+A,u[0][0]=u[0][0]+m+(r0/4294967296>>>0)>>>0,u[0][1]=r0>>>0,r0=u[1][1]+I,u[1][0]=u[1][0]+T+(r0/4294967296>>>0)>>>0,u[1][1]=r0>>>0,r0=u[2][1]+N,u[2][0]=u[2][0]+L+(r0/4294967296>>>0)>>>0,u[2][1]=r0>>>0,r0=u[3][1]+M,u[3][0]=u[3][0]+k+(r0/4294967296>>>0)>>>0,u[3][1]=r0>>>0,r0=u[4][1]+u0,u[4][0]=u[4][0]+X+(r0/4294967296>>>0)>>>0,u[4][1]=r0>>>0,r0=u[5][1]+i0,u[5][0]=u[5][0]+h0+(r0/4294967296>>>0)>>>0,u[5][1]=r0>>>0,r0=u[6][1]+L0,u[6][0]=u[6][0]+H+(r0/4294967296>>>0)>>>0,u[6][1]=r0>>>0,r0=u[7][1]+v,u[7][0]=u[7][0]+V+(r0/4294967296>>>0)>>>0,u[7][1]=r0>>>0,P0-=128}}c(mk,"_update")});var _k=w(GC=>{var G00=K0();Fr();var Ct=G00.asn1;GC.privateKeyValidator={name:"PrivateKeyInfo",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};GC.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:Ct.Class.UNIVERSAL,type:Ct.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Pk=w((Ff0,Uk)=>{var Bt=K0();Wh();lr();VC();X0();var Ik=_k(),W00=Ik.publicKeyValidator,z00=Ik.privateKeyValidator;typeof Ck>"u"&&(Ck=Bt.jsbn.BigInteger);var Ck,YC=Bt.util.ByteBuffer,Pu=typeof Buffer>"u"?Uint8Array:Buffer;Bt.pki=Bt.pki||{};Uk.exports=Bt.pki.ed25519=Bt.ed25519=Bt.ed25519||{};var H0=Bt.ed25519;H0.constants={};H0.constants.PUBLIC_KEY_BYTE_LENGTH=32;H0.constants.PRIVATE_KEY_BYTE_LENGTH=64;H0.constants.SEED_BYTE_LENGTH=32;H0.constants.SIGN_BYTE_LENGTH=64;H0.constants.HASH_BYTE_LENGTH=64;H0.generateKeyPair=function(u){u=u||{};var e=u.seed;if(e===void 0)e=Bt.random.getBytesSync(H0.constants.SEED_BYTE_LENGTH);else if(typeof e=="string"){if(e.length!==H0.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+H0.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=Wi({message:e,encoding:"binary"});for(var t=new Pu(H0.constants.PUBLIC_KEY_BYTE_LENGTH),r=new Pu(H0.constants.PRIVATE_KEY_BYTE_LENGTH),i=0;i<32;++i)r[i]=e[i];return $00(t,r),{publicKey:t,privateKey:r}};H0.privateKeyFromAsn1=function(u){var e={},t=[],r=Bt.asn1.validate(u,z00,e,t);if(!r){var i=new Error("Invalid Key.");throw i.errors=t,i}var s=Bt.asn1.derToOid(e.privateKeyOid),a=Bt.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var o=e.privateKey,h=Wi({message:Bt.asn1.fromDer(o).value,encoding:"binary"});return{privateKeyBytes:h}};H0.publicKeyFromAsn1=function(u){var e={},t=[],r=Bt.asn1.validate(u,W00,e,t);if(!r){var i=new Error("Invalid Key.");throw i.errors=t,i}var s=Bt.asn1.derToOid(e.publicKeyOid),a=Bt.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var o=e.ed25519PublicKey;if(o.length!==H0.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return Wi({message:o,encoding:"binary"})};H0.publicKeyFromPrivateKey=function(u){u=u||{};var e=Wi({message:u.privateKey,encoding:"binary"});if(e.length!==H0.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+H0.constants.PRIVATE_KEY_BYTE_LENGTH);for(var t=new Pu(H0.constants.PUBLIC_KEY_BYTE_LENGTH),r=0;r=0};function Wi(u){var e=u.message;if(e instanceof Uint8Array||e instanceof Pu)return e;var t=u.encoding;if(e===void 0)if(u.md)e=u.md.digest().getBytes(),t="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof e=="string"&&!t)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof e=="string"){if(typeof Buffer<"u")return Buffer.from(e,t);e=new YC(e,t)}else if(!(e instanceof YC))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var r=new Pu(e.length()),i=0;i=32;--r){for(t=0,i=r-32,s=r-12;i>8,e[i]-=t*256;e[i]+=t,e[r]=0}for(t=0,i=0;i<32;++i)e[i]+=t-(e[31]>>4)*WC[i],t=e[i]>>8,e[i]&=255;for(i=0;i<32;++i)e[i]-=t*WC[i];for(r=0;r<32;++r)e[r+1]+=e[r]>>8,u[r]=e[r]&255}c(Lk,"modL");function jC(u){for(var e=new Float64Array(64),t=0;t<64;++t)e[t]=u[t],u[t]=0;Lk(u,e)}c(jC,"reduce");function $C(u,e){var t=E0(),r=E0(),i=E0(),s=E0(),a=E0(),o=E0(),h=E0(),f=E0(),d=E0();zo(t,u[1],u[0]),zo(d,e[1],e[0]),ge(t,t,d),Wo(r,u[0],u[1]),Wo(d,e[0],e[1]),ge(r,r,d),ge(i,u[3],e[3]),ge(i,i,Q00),ge(s,u[2],e[2]),Wo(s,s,s),zo(a,r,t),zo(o,s,i),Wo(h,s,i),Wo(f,r,t),ge(u[0],a,o),ge(u[1],f,h),ge(u[2],h,o),ge(u[3],a,f)}c($C,"add");function wk(u,e,t){for(var r=0;r<4;++r)Nk(u[r],e[r],t)}c(wk,"cswap");function ZC(u,e){var t=E0(),r=E0(),i=E0();re0(i,e[2]),ge(t,e[0],i),ge(r,e[1],i),qy(u,r),u[31]^=Kk(t)<<7}c(ZC,"pack");function qy(u,e){var t,r,i,s=E0(),a=E0();for(t=0;t<16;++t)a[t]=e[t];for(zC(a),zC(a),zC(a),r=0;r<2;++r){for(s[0]=a[0]-65517,t=1;t<15;++t)s[t]=a[t]-65535-(s[t-1]>>16&1),s[t-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,Nk(a,s,1-i)}for(t=0;t<16;t++)u[2*t]=a[t]&255,u[2*t+1]=a[t]>>8}c(qy,"pack25519");function J00(u,e){var t=E0(),r=E0(),i=E0(),s=E0(),a=E0(),o=E0(),h=E0();return Fs(u[2],Hy),ee0(u[1],e),ta(i,u[1]),ge(s,i,Y00),zo(i,i,u[2]),Wo(s,u[2],s),ta(a,s),ta(o,a),ge(h,o,a),ge(t,h,i),ge(t,t,s),te0(t,t),ge(t,t,i),ge(t,t,s),ge(t,t,s),ge(u[0],t,s),ta(r,u[0]),ge(r,r,s),vk(r,i)&&ge(u[0],u[0],j00),ta(r,u[0]),ge(r,r,s),vk(r,i)?-1:(Kk(u[0])===e[31]>>7&&zo(u[0],QC,u[0]),ge(u[3],u[0],u[1]),0)}c(J00,"unpackneg");function ee0(u,e){var t;for(t=0;t<16;++t)u[t]=e[2*t]+(e[2*t+1]<<8);u[15]&=32767}c(ee0,"unpack25519");function te0(u,e){var t=E0(),r;for(r=0;r<16;++r)t[r]=e[r];for(r=250;r>=0;--r)ta(t,t),r!==1&&ge(t,t,e);for(r=0;r<16;++r)u[r]=t[r]}c(te0,"pow2523");function vk(u,e){var t=new Pu(32),r=new Pu(32);return qy(t,u),qy(r,e),Sk(t,0,r,0)}c(vk,"neq25519");function Sk(u,e,t,r){return ue0(u,e,t,r,32)}c(Sk,"crypto_verify_32");function ue0(u,e,t,r,i){var s,a=0;for(s=0;s>>8)-1}c(ue0,"vn");function Kk(u){var e=new Pu(32);return qy(e,u),e[0]&1}c(Kk,"par25519");function Ok(u,e,t){var r,i;for(Fs(u[0],QC),Fs(u[1],Hy),Fs(u[2],Hy),Fs(u[3],QC),i=255;i>=0;--i)r=t[i/8|0]>>(i&7)&1,wk(u,e,r),$C(e,u),$C(u,u),wk(u,e,r)}c(Ok,"scalarmult");function XC(u,e){var t=[E0(),E0(),E0(),E0()];Fs(t[0],Rk),Fs(t[1],Ak),Fs(t[2],Hy),ge(t[3],Rk,Ak),Ok(u,t,e)}c(XC,"scalarbase");function Fs(u,e){var t;for(t=0;t<16;t++)u[t]=e[t]|0}c(Fs,"set25519");function re0(u,e){var t=E0(),r;for(r=0;r<16;++r)t[r]=e[r];for(r=253;r>=0;--r)ta(t,t),r!==2&&r!==4&&ge(t,t,e);for(r=0;r<16;++r)u[r]=t[r]}c(re0,"inv25519");function zC(u){var e,t,r=1;for(e=0;e<16;++e)t=u[e]+r+65535,r=Math.floor(t/65536),u[e]=t-r*65536;u[0]+=r-1+37*(r-1)}c(zC,"car25519");function Nk(u,e,t){for(var r,i=~(t-1),s=0;s<16;++s)r=i&(u[s]^e[s]),u[s]^=r,e[s]^=r}c(Nk,"sel25519");function E0(u){var e,t=new Float64Array(16);if(u)for(e=0;e{var zu=K0();X0();lr();Wh();Dk.exports=zu.kem=zu.kem||{};var kk=zu.jsbn.BigInteger;zu.kem.rsa={};zu.kem.rsa.create=function(u,e){e=e||{};var t=e.prng||zu.random,r={};return r.encrypt=function(i,s){var a=Math.ceil(i.n.bitLength()/8),o;do o=new kk(zu.util.bytesToHex(t.getBytesSync(a)),16).mod(i.n);while(o.compareTo(kk.ONE)<=0);o=zu.util.hexToBytes(o.toString(16));var h=a-o.length;h>0&&(o=zu.util.fillString("\0",h)+o);var f=i.encrypt(o,"NONE"),d=u.generate(o,s);return{encapsulation:f,key:d}},r.decrypt=function(i,s,a){var o=i.decrypt(s,"NONE");return u.generate(o,a)},r};zu.kem.kdf1=function(u,e){Bk(this,u,0,e||u.digestLength)};zu.kem.kdf2=function(u,e){Bk(this,u,1,e||u.digestLength)};function Bk(u,e,t,r){u.generate=function(i,s){for(var a=new zu.util.ByteBuffer,o=Math.ceil(s/r)+t,h=new zu.util.ByteBuffer,f=t;f{var G0=K0();X0();qk.exports=G0.log=G0.log||{};G0.log.levels=["none","error","warning","info","debug","verbose","max"];var Vy={},tR=[],Xh=null;G0.log.LEVEL_LOCKED=2;G0.log.NO_LEVEL_CHECK=4;G0.log.INTERPOLATE=8;for(mi=0;mi"u"||e?u.flags|=G0.log.LEVEL_LOCKED:u.flags&=~G0.log.LEVEL_LOCKED};G0.log.addLogger=function(u){tR.push(u)};typeof console<"u"&&"log"in console?(console.error&&console.warn&&console.info&&console.debug?(Mk={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Jh=c(function(u,e){G0.log.prepareStandard(e);var t=Mk[e.level],r=[e.standard];r=r.concat(e.arguments.slice()),t.apply(console,r)},"f"),Yo=G0.log.makeLogger(Jh)):(Jh=c(function(e,t){G0.log.prepareStandardFull(t),console.log(t.standardFull)},"f"),Yo=G0.log.makeLogger(Jh)),G0.log.setLevel(Yo,"debug"),G0.log.addLogger(Yo),Xh=Yo):console={log:function(){}};var Yo,Mk,Jh;Xh!==null&&typeof window<"u"&&window.location&&(Zh=new URL(window.location.href).searchParams,Zh.has("console.level")&&G0.log.setLevel(Xh,Zh.get("console.level").slice(-1)[0]),Zh.has("console.lock")&&(Hk=Zh.get("console.lock").slice(-1)[0],Hk=="true"&&G0.log.lock(Xh)));var Zh,Hk;G0.log.consoleLogger=Xh});var Wk=w((Wf0,Gk)=>{Gk.exports=li();_y();Mo();pC();VC()});var Qk=w((zf0,Yk)=>{var s0=K0();Ks();Fr();Vh();Os();Qn();IC();lr();X0();ky();var U=s0.asn1,pu=Yk.exports=s0.pkcs7=s0.pkcs7||{};pu.messageFromPem=function(u){var e=s0.pem.decode(u)[0];if(e.type!=="PKCS7"){var t=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw t.headerType=e.type,t}if(e.procType&&e.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var r=U.fromDer(e.body);return pu.messageFromAsn1(r)};pu.messageToPem=function(u,e){var t={type:"PKCS7",body:U.toDer(u.toAsn1()).getBytes()};return s0.pem.encode(t,{maxline:e})};pu.messageFromAsn1=function(u){var e={},t=[];if(!U.validate(u,pu.asn1.contentInfoValidator,e,t)){var r=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw r.errors=t,r}var i=U.derToOid(e.contentType),s;switch(i){case s0.pki.oids.envelopedData:s=pu.createEnvelopedData();break;case s0.pki.oids.encryptedData:s=pu.createEncryptedData();break;case s0.pki.oids.signedData:s=pu.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+i+" is not (yet) supported.")}return s.fromAsn1(e.content.value[0]),s};pu.createSignedData=function(){var u=null;return u={type:s0.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(r){if(rR(u,r,pu.asn1.signedDataValidator),u.certificates=[],u.crls=[],u.digestAlgorithmIdentifiers=[],u.contentInfo=null,u.signerInfos=[],u.rawCapture.certificates)for(var i=u.rawCapture.certificates.value,s=0;s0&&a.value[0].value.push(U.create(U.Class.CONTEXT_SPECIFIC,0,!0,r)),s.length>0&&a.value[0].value.push(U.create(U.Class.CONTEXT_SPECIFIC,1,!0,s)),a.value[0].value.push(U.create(U.Class.UNIVERSAL,U.Type.SET,!0,u.signerInfos)),U.create(U.Class.UNIVERSAL,U.Type.SEQUENCE,!0,[U.create(U.Class.UNIVERSAL,U.Type.OID,!1,U.oidToDer(u.type).getBytes()),a])},addSigner:function(r){var i=r.issuer,s=r.serialNumber;if(r.certificate){var a=r.certificate;typeof a=="string"&&(a=s0.pki.certificateFromPem(a)),i=a.issuer.attributes,s=a.serialNumber}var o=r.key;if(!o)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof o=="string"&&(o=s0.pki.privateKeyFromPem(o));var h=r.digestAlgorithm||s0.pki.oids.sha1;switch(h){case s0.pki.oids.sha1:case s0.pki.oids.sha256:case s0.pki.oids.sha384:case s0.pki.oids.sha512:case s0.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+h)}var f=r.authenticatedAttributes||[];if(f.length>0){for(var d=!1,p=!1,E=0;E0){for(var t=U.create(U.Class.CONTEXT_SPECIFIC,1,!0,[]),r=0;r=t&&i{var $e=K0();Ks();ko();_y();Mo();X0();var Wy=jk.exports=$e.ssh=$e.ssh||{};Wy.privateKeyToPutty=function(u,e,t){t=t||"",e=e||"";var r="ssh-rsa",i=e===""?"none":"aes256-cbc",s="PuTTY-User-Key-File-2: "+r+`\r +`;s+="Encryption: "+i+`\r +`,s+="Comment: "+t+`\r +`;var a=$e.util.createBuffer();Qo(a,r),xi(a,u.e),xi(a,u.n);var o=$e.util.encode64(a.bytes(),64),h=Math.floor(o.length/66)+1;s+="Public-Lines: "+h+`\r +`,s+=o;var f=$e.util.createBuffer();xi(f,u.d),xi(f,u.p),xi(f,u.q),xi(f,u.qInv);var d;if(!e)d=$e.util.encode64(f.bytes(),64);else{var p=f.length()+16-1;p-=p%16;var E=Gy(f.bytes());E.truncate(E.length()-p+f.length()),f.putBuffer(E);var x=$e.util.createBuffer();x.putBuffer(Gy("\0\0\0\0",e)),x.putBuffer(Gy("\0\0\0",e));var g=$e.aes.createEncryptionCipher(x.truncate(8),"CBC");g.start($e.util.createBuffer().fillWithByte(0,16)),g.update(f.copy()),g.finish();var m=g.output;m.truncate(16),d=$e.util.encode64(m.bytes(),64)}h=Math.floor(d.length/66)+1,s+=`\r +Private-Lines: `+h+`\r +`,s+=d;var A=Gy("putty-private-key-file-mac-key",e),T=$e.util.createBuffer();Qo(T,r),Qo(T,i),Qo(T,t),T.putInt32(a.length()),T.putBuffer(a),T.putInt32(f.length()),T.putBuffer(f);var I=$e.hmac.create();return I.start("sha1",A),I.update(T.bytes()),s+=`\r +Private-MAC: `+I.digest().toHex()+`\r +`,s};Wy.publicKeyToOpenSSH=function(u,e){var t="ssh-rsa";e=e||"";var r=$e.util.createBuffer();return Qo(r,t),xi(r,u.e),xi(r,u.n),t+" "+$e.util.encode64(r.bytes())+" "+e};Wy.privateKeyToOpenSSH=function(u,e){return e?$e.pki.encryptRsaPrivateKey(u,e,{legacy:!0,algorithm:"aes128"}):$e.pki.privateKeyToPem(u)};Wy.getPublicKeyFingerprint=function(u,e){e=e||{};var t=e.md||$e.md.md5.create(),r="ssh-rsa",i=$e.util.createBuffer();Qo(i,r),xi(i,u.e),xi(i,u.n),t.start(),t.update(i.getBytes());var s=t.digest();if(e.encoding==="hex"){var a=s.toHex();return e.delimiter?a.match(/.{2}/g).join(e.delimiter):a}else{if(e.encoding==="binary")return s.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".')}return s};function xi(u,e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=$e.util.hexToBytes(t);u.putInt32(r.length),u.putBytes(r)}c(xi,"_addBigIntegerToBuffer");function Qo(u,e){u.putInt32(e.length),u.putString(e)}c(Qo,"_addStringToBuffer");function Gy(){for(var u=$e.md.sha1.create(),e=arguments.length,t=0;t{Zk.exports=K0();Ks();Ek();Fr();yy();Vh();Pk();ko();Fk();Vk();Wk();LC();wy();Qn();CC();OC();Qk();UC();AC();yC();Ny();lr();mC();$k();MC();X0()});var rB=w((Zf0,uB)=>{var Jk=zn(),Ti=Xk(),eB=[[813826048,33620784,2181038086,153781832,2264337665,117547136],[805306881,53477382,153781832,2264337665,117547008,67108864],[813760514,16986241,395562,2252900087,218171137,2692808708],[813826048,33620784,2164262409,713443462,4144824583,27296e3],[813891584,131331,813826048,101264006,1216804621,17236384],[813891584,131331,813891584,395562,2252900087,218171137],[813957120,513,53510912,1545,713443462,4144824583],[813957120,513,53511168,6,153781832,2264337665]],he0=[[4294901760,4294967295,4278190335,4294967295,4294967295,4294967280],[4278255615,4294902015,4294967295,4294967295,4294967040,4278190080],[4294902015,4294967295,16777215,4294967295,4294967295,4294902015],[4294901760,4294967295,4278255615,4294967295,4294967295,4294967040],[4294901760,16777215,4294901760,4294967295,4294967295,4294967295],[4294901760,16777215,4294901760,16777215,4294967295,4294967295],[4294901760,65535,4294967040,65535,4294967295,4294967295],[4294901760,65535,4294967040,255,4294967295,4294967295]],sR=class sR{constructor(e,t){this.keystore=e,this.password=t}static probe(e){let r=new Jk(e).read(24);for(let i=0;i(s.readInt()&f)>>>0).every((f,d)=>f===a[d]))return!0}return!1}parse(){let e=this.keystore.toString("base64"),t=Ti.util.decode64(e),r=Ti.asn1.fromDer(t);return Ti.pkcs12.pkcs12FromAsn1(r,this.password||"").safeContents.reduce((s,a)=>Array.isArray(a.safeBags)?s.concat(a.safeBags):s,[])}toPem(e){return e.reduce((t,r)=>{let i=r.attributes.friendlyName[0],s=!!r.attributes.localKeyId,a=t[i]||{};if(r.type===Ti.pki.oids.certBag){let o=s?"cert":"ca";r.cert?a={...a,[o]:Ti.pki.certificateToPem(r.cert).replace(/\r\n/g,` +`)}:r.asn1&&(a={...a,[o]:tB(r.asn1,"CERTIFICATE").replace(/\r\n/g,` +`)})}return r.key?a={...a,key:fe0(r.key).replace(/\r\n/g,` +`)}:r.asn1&&r.hasOwnProperty("key")&&(a={...a,key:tB(r.asn1,"PRIVATE KEY").replace(/\r\n/g,` +`)}),{...t,[i]:a}},{})}};c(sR,"PKCS12Parser");var iR=sR,fe0=c((u,e)=>Ti.pki.privateKeyInfoToPem(Ti.pki.wrapRsaPrivateKey(Ti.pki.privateKeyToAsn1(u))),"privateKeyToPem"),tB=c((u,e)=>{let t={type:e,body:Ti.asn1.toDer(u).getBytes()};return Ti.pem.encode(t)},"derToPem");uB.exports=iR});var ef=w((Jf0,sB)=>{var iB=zn(),de0=Oo(),Hr=class Hr{constructor(e){this.tag=null,this.length=0,this.data=null,this.buffer=null,this.buffer=de0(e.buffer,e.offset),this.init(e)}init(e){this.tag=e.readByte();let t=e.buffer.readUInt8(e.offset);if(this.length=Hr.getLength(e),this.length===-1){let r=e.available(),i=2,s=new OutputStream(Buffer.alloc(r+i));throw s.write(this.tag),s.write(t),s.write(e.read(r)),new Error("Length is not defined. The DerIndefLenConverter.convert() has not been implemented yet")}this.data=new iB(e.read(this.length))}isConstructed(e){return(this.tag&32)==32?e?(tag&31)==e:!0:!1}static getLength(e){let t=e.readByte();if(!(t&128))return t;let r=t&127;if(r===0)return-1;if(r<0)throw new Error("Incorrect DER encodding");if(r>4)throw new Error("DER length too big");let i;for(i=0;r>0;r--)i<<=8,i+=255&e.readByte();if(i<0)throw new Error("Invalid length byte");return i}getBigInteger(){let e=this.data;if(e.readByte()!=Hr.tag_Integer)throw new Error("DER input, Integer tag error");let t=Hr.getLength(e);return t<=1?e.readByte():t===2?e.readShort():t<=4?e.readInt():e.readLong()}getOctetString(){if(this.tag!==Hr.tag_OctetString&&!this.isConstructed(Hr.tag_OctetString))throw new Error("DerValue.getOctetString, not an Octet String: "+derValue.tag);let e=new iB(this.buffer),t=Buffer.from([]);for(;e.available();){let r=e.readByte();if(r!==Hr.tag_OctetString)throw new Error("DER input not an octet string: "+r);let i=Hr.getLength(e),s=e.read(i);t=Buffer.concat([t,s])}return t}getDerValue(){return new Hr(this.data)}};c(Hr,"DerValue");var ua=Hr;ua.tag_ObjectId=6;ua.tag_Sequence=48;ua.tag_OctetString=4;ua.tag_Integer=2;sB.exports=ua});var oR=w((t20,aB)=>{var nB=ef(),aR=class aR{constructor(e){let t=e.readByte();if(t!==nB.tag_ObjectId)throw new Error("data isn't an object ID ( tag = "+t+")");let r=nB.getLength(e);this.encoding=e.read(r)}toString(){let e=this.encoding.length,t="",r=0;for(let i=0;i{var pe0=zn(),ye0=oR(),cR=ef(),hR=class hR{constructor(e){let t=new cR(new pe0(e)),r=new cR(t.data),i=new cR(t.data);this.alghorithmId=this.createAlghorithmId(r),this.octetString=i.getOctetString()}createAlghorithmId(e){return new ye0(e.data).toString()}getAlgorithm(){return this.alghorithmId}getEncryptedData(){return this.octetString}};c(hR,"EncryptedPrivateKeyInfo");var lR=hR;oB.exports=lR});var yu=w((n20,jo)=>{var s20=require("crypto");jo.exports.linebrk=function(u,e){for(var t="",r=0;r+e0){if(t>=4)return u.readUIntBE(e,t);for(var r=0,i=e+t,s=0;i>e;i--,s+=2)r+=u[i-1]*Math.pow(16,s);return r}else return NaN};jo.exports._={isObject:function(u){var e=typeof u;return!!u&&(e=="object"||e=="function")},isString:function(u){return typeof u=="string"||u instanceof String},isNumber:function(u){return typeof u=="number"||!isNaN(parseFloat(u))&&isFinite(u)},omit:function(u,e){var t={};for(var r in u)!u.hasOwnProperty(r)||r===e||(t[r]=u[r]);return t}};jo.exports.trimSurroundingText=function(u,e,t){var r=0,i=u.length,s=u.indexOf(e);s>=0&&(r=s+e.length);var a=u.indexOf(t,s);return a>=0&&(i=a),u.substring(r,i)}});var sa=w((o20,pB)=>{var ge0=require("crypto"),Ee0=yu()._,$o,me0=0xdeadbeefcafe,a20=(me0&16777215)==15715070;function j(u,e){u!=null&&(typeof u=="number"?this.fromNumber(u,e):Buffer.isBuffer(u)?this.fromBuffer(u):e==null&&typeof u!="string"?this.fromByteArray(u):this.fromString(u,e))}c(j,"BigInteger");function Y0(){return new j(null)}c(Y0,"nbi");function xe0(u,e,t,r,i,s){for(var a=e&16383,o=e>>14;--s>=0;){var h=this[u]&16383,f=this[u++]>>14,d=o*h+f*a;h=a*h+((d&16383)<<14)+t[r]+i,i=(h>>28)+(d>>14)+o*f,t[r++]=h&268435455}return i}c(xe0,"am3");j.prototype.am=xe0;$o=28;j.prototype.DB=$o;j.prototype.DM=(1<<$o)-1;j.prototype.DV=1<<$o;var dR=52;j.prototype.FV=Math.pow(2,dR);j.prototype.F1=dR-$o;j.prototype.F2=2*$o-dR;var Te0="0123456789abcdefghijklmnopqrstuvwxyz",zy=new Array,Zo,gr;Zo=48;for(gr=0;gr<=9;++gr)zy[Zo++]=gr;Zo=97;for(gr=10;gr<36;++gr)zy[Zo++]=gr;Zo=65;for(gr=10;gr<36;++gr)zy[Zo++]=gr;function fR(u){return Te0.charAt(u)}c(fR,"int2char");function lB(u,e){var t=zy[u.charCodeAt(e)];return t??-1}c(lB,"intAt");function be0(u){for(var e=this.t-1;e>=0;--e)u[e]=this[e];u.t=this.t,u.s=this.s}c(be0,"bnpCopyTo");function _e0(u){this.t=1,this.s=u<0?-1:0,u>0?this[0]=u:u<-1?this[0]=u+DV:this.t=0}c(_e0,"bnpFromInt");function Ms(u){var e=Y0();return e.fromInt(u),e}c(Ms,"nbv");function Ce0(u,e,t){var r;switch(e){case 2:r=1;break;case 4:r=2;break;case 8:r=3;break;case 16:r=4;break;case 32:r=5;break;case 256:r=8;break;default:this.fromRadix(u,e);return}this.t=0,this.s=0;for(var i=u.length,s=!1,a=0;--i>=0;){var o=r==8?u[i]&255:lB(u,i);if(o<0){u.charAt(i)=="-"&&(s=!0);continue}s=!1,a===0?this[this.t++]=o:a+r>this.DB?(this[this.t-1]|=(o&(1<>this.DB-a):this[this.t-1]|=o<=this.DB&&(a-=this.DB)}!t&&r==8&&u[0]&128&&(this.s=-1,a>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==u;)--this.t}c(we0,"bnpClamp");function ve0(u){if(this.s<0)return"-"+this.negate().toString(u);var e;if(u==16)e=4;else if(u==8)e=3;else if(u==2)e=1;else if(u==32)e=5;else if(u==4)e=2;else return this.toRadix(u);var t=(1<0)for(o>o)>0&&(i=!0,s=fR(r));a>=0;)o>(o+=this.DB-e)):(r=this[a]>>(o-=e)&t,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=fR(r));return i?s:"0"}c(ve0,"bnToString");function Ie0(){var u=Y0();return j.ZERO.subTo(this,u),u}c(Ie0,"bnNegate");function Le0(){return this.s<0?this.negate():this}c(Le0,"bnAbs");function Se0(u){var e=this.s-u.s;if(e!=0)return e;var t=this.t;if(e=t-u.t,e!=0)return this.s<0?-e:e;for(;--t>=0;)if((e=this[t]-u[t])!=0)return e;return 0}c(Se0,"bnCompareTo");function Yy(u){var e=1,t;return(t=u>>>16)!=0&&(u=t,e+=16),(t=u>>8)!=0&&(u=t,e+=8),(t=u>>4)!=0&&(u=t,e+=4),(t=u>>2)!=0&&(u=t,e+=2),(t=u>>1)!=0&&(u=t,e+=1),e}c(Yy,"nbits");function Ke0(){return this.t<=0?0:this.DB*(this.t-1)+Yy(this[this.t-1]^this.s&this.DM)}c(Ke0,"bnBitLength");function Oe0(u,e){var t;for(t=this.t-1;t>=0;--t)e[t+u]=this[t];for(t=u-1;t>=0;--t)e[t]=0;e.t=this.t+u,e.s=this.s}c(Oe0,"bnpDLShiftTo");function Ne0(u,e){for(var t=u;t=0;--o)e[o+s+1]=this[o]>>r|a,a=(this[o]&i)<=0;--o)e[o]=0;e[s]=a,e.t=this.t+s+1,e.s=this.s,e.clamp()}c(Ue0,"bnpLShiftTo");function Pe0(u,e){e.s=this.s;var t=Math.floor(u/this.DB);if(t>=this.t){e.t=0;return}var r=u%this.DB,i=this.DB-r,s=(1<>r;for(var a=t+1;a>r;r>0&&(e[this.t-t-1]|=(this.s&s)<>=this.DB;if(u.t>=this.DB;r+=this.s}else{for(r+=this.s;t>=this.DB;r-=u.s}e.s=r<0?-1:0,r<-1?e[t++]=this.DV+r:r>0&&(e[t++]=r),e.t=t,e.clamp()}c(ke0,"bnpSubTo");function Be0(u,e){var t=this.abs(),r=u.abs(),i=t.t;for(e.t=i+r.t;--i>=0;)e[i]=0;for(i=0;i=0;)u[t]=0;for(t=0;t=e.DV&&(u[t+e.t]-=e.DV,u[t+e.t+1]=1)}u.t>0&&(u[u.t-1]+=e.am(t,e[t],u,2*t,0,1)),u.s=0,u.clamp()}c(De0,"bnpSquareTo");function Fe0(u,e,t){var r=u.abs();if(!(r.t<=0)){var i=this.abs();if(i.t0?(r.lShiftTo(h,s),i.lShiftTo(h,t)):(r.copyTo(s),i.copyTo(t));var f=s.t,d=s[f-1];if(d!==0){var p=d*(1<1?s[f-2]>>this.F2:0),E=this.FV/p,x=(1<=0&&(t[t.t++]=1,t.subTo(T,t)),j.ONE.dlShiftTo(f,T),T.subTo(s,s);s.t=0;){var I=t[--m]==d?this.DM:Math.floor(t[m]*E+(t[m-1]+g)*x);if((t[m]+=s.am(0,I,t,A,0,f))0&&t.rShiftTo(h,t),a<0&&j.ZERO.subTo(t,t)}}}c(Fe0,"bnpDivRemTo");function Me0(u){var e=Y0();return this.abs().divRemTo(u,null,e),this.s<0&&e.compareTo(j.ZERO)>0&&u.subTo(e,e),e}c(Me0,"bnMod");function ra(u){this.m=u}c(ra,"Classic");function He0(u){return u.s<0||u.compareTo(this.m)>=0?u.mod(this.m):u}c(He0,"cConvert");function qe0(u){return u}c(qe0,"cRevert");function Ve0(u){u.divRemTo(this.m,null,u)}c(Ve0,"cReduce");function Ge0(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(Ge0,"cMulTo");function We0(u,e){u.squareTo(e),this.reduce(e)}c(We0,"cSqrTo");ra.prototype.convert=He0;ra.prototype.revert=qe0;ra.prototype.reduce=Ve0;ra.prototype.mulTo=Ge0;ra.prototype.sqrTo=We0;function ze0(){if(this.t<1)return 0;var u=this[0];if(!(u&1))return 0;var e=u&3;return e=e*(2-(u&15)*e)&15,e=e*(2-(u&255)*e)&255,e=e*(2-((u&65535)*e&65535))&65535,e=e*(2-u*e%this.DV)%this.DV,e>0?this.DV-e:-e}c(ze0,"bnpInvDigit");function ia(u){this.m=u,this.mp=u.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<0&&this.m.subTo(e,e),e}c(Ye0,"montConvert");function Qe0(u){var e=Y0();return u.copyTo(e),this.reduce(e),e}c(Qe0,"montRevert");function je0(u){for(;u.t<=this.mt2;)u[u.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&u.DM;for(t=e+this.m.t,u[t]+=this.m.am(0,r,u,e,0,this.m.t);u[t]>=u.DV;)u[t]-=u.DV,u[++t]++}u.clamp(),u.drShiftTo(this.m.t,u),u.compareTo(this.m)>=0&&u.subTo(this.m,u)}c(je0,"montReduce");function $e0(u,e){u.squareTo(e),this.reduce(e)}c($e0,"montSqrTo");function Ze0(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(Ze0,"montMulTo");ia.prototype.convert=Ye0;ia.prototype.revert=Qe0;ia.prototype.reduce=je0;ia.prototype.mulTo=Ze0;ia.prototype.sqrTo=$e0;function Xe0(){return(this.t>0?this[0]&1:this.s)===0}c(Xe0,"bnpIsEven");function Je0(u,e){if(u>4294967295||u<1)return j.ONE;var t=Y0(),r=Y0(),i=e.convert(this),s=Yy(u)-1;for(i.copyTo(t);--s>=0;)if(e.sqrTo(t,r),(u&1<0)e.mulTo(r,i,t);else{var a=t;t=r,r=a}return e.revert(t)}c(Je0,"bnpExp");function et0(u,e){var t;return u<256||e.isEven()?t=new ra(e):t=new ia(e),this.exp(u,t)}c(et0,"bnModPowInt");function tt0(){var u=Y0();return this.copyTo(u),u}c(tt0,"bnClone");function ut0(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t===0)return-1}else{if(this.t==1)return this[0];if(this.t===0)return 0}return(this[1]&(1<<32-this.DB)-1)<>24}c(rt0,"bnByteValue");function it0(){return this.t==0?this.s:this[0]<<16>>16}c(it0,"bnShortValue");function st0(u){return Math.floor(Math.LN2*this.DB/Math.log(u))}c(st0,"bnpChunkSize");function nt0(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}c(nt0,"bnSigNum");function at0(u){if(u==null&&(u=10),this.signum()===0||u<2||u>36)return"0";var e=this.chunkSize(u),t=Math.pow(u,e),r=Ms(t),i=Y0(),s=Y0(),a="";for(this.divRemTo(r,i,s);i.signum()>0;)a=(t+s.intValue()).toString(u).substr(1)+a,i.divRemTo(r,i,s);return s.intValue().toString(u)+a}c(at0,"bnpToRadix");function ot0(u,e){this.fromInt(0),e==null&&(e=10);for(var t=this.chunkSize(e),r=Math.pow(e,t),i=!1,s=0,a=0,o=0;o=t&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0)}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&j.ZERO.subTo(this,this)}c(ot0,"bnpFromRadix");function ct0(u,e){if(typeof e=="number")if(u<2)this.fromInt(1);else for(this.fromNumber(u),this.testBit(u-1)||this.bitwiseTo(j.ONE.shiftLeft(u-1),pR,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>u&&this.subTo(j.ONE.shiftLeft(u-1),this);else{var t=ge0.randomBytes((u>>3)+1),r=u&7;r>0?t[0]&=(1<0)for(t>t)!=(this.s&this.DM)>>t&&(e[i++]=r|this.s<=0;)t<8?(r=(this[u]&(1<>(t+=this.DB-8)):(r=this[u]>>(t-=8)&255,t<=0&&(t+=this.DB,--u)),r&128&&(r|=-256),i===0&&(this.s&128)!=(r&128)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e}c(lt0,"bnToByteArray");function ht0(u){var e=Buffer.from(this.toByteArray());if(u===!0&&e[0]===0)e=e.slice(1);else if(Ee0.isNumber(u)){if(e.length>u){for(var t=0;t0?this:u}c(pt0,"bnMax");function yt0(u,e,t){var r,i,s=Math.min(u.t,this.t);for(r=0;r>=16,e+=16),u&255||(u>>=8,e+=8),u&15||(u>>=4,e+=4),u&3||(u>>=2,e+=2),u&1||++e,e}c(Rt0,"lbit");function At0(){for(var u=0;u=this.t?this.s!=0:(this[e]&1<>=this.DB;if(u.t>=this.DB;r+=this.s}else{for(r+=this.s;t>=this.DB;r+=u.s}e.s=r<0?-1:0,r>0?e[t++]=r:r<-1&&(e[t++]=this.DV+r),e.t=t,e.clamp()}c(Nt0,"bnpAddTo");function Ut0(u){var e=Y0();return this.addTo(u,e),e}c(Ut0,"bnAdd");function Pt0(u){var e=Y0();return this.subTo(u,e),e}c(Pt0,"bnSubtract");function kt0(u){var e=Y0();return this.multiplyTo(u,e),e}c(kt0,"bnMultiply");function Bt0(){var u=Y0();return this.squareTo(u),u}c(Bt0,"bnSquare");function Dt0(u){var e=Y0();return this.divRemTo(u,e,null),e}c(Dt0,"bnDivide");function Ft0(u){var e=Y0();return this.divRemTo(u,null,e),e}c(Ft0,"bnRemainder");function Mt0(u){var e=Y0(),t=Y0();return this.divRemTo(u,e,t),new Array(e,t)}c(Mt0,"bnDivideAndRemainder");function Ht0(u){this[this.t]=this.am(0,u-1,this,0,0,this.t),++this.t,this.clamp()}c(Ht0,"bnpDMultiply");function qt0(u,e){if(u!==0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=u;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}c(qt0,"bnpDAddOffset");function tf(){}c(tf,"NullExp");function dB(u){return u}c(dB,"nNop");function Vt0(u,e,t){u.multiplyTo(e,t)}c(Vt0,"nMulTo");function Gt0(u,e){u.squareTo(e)}c(Gt0,"nSqrTo");tf.prototype.convert=dB;tf.prototype.revert=dB;tf.prototype.mulTo=Vt0;tf.prototype.sqrTo=Gt0;function Wt0(u){return this.exp(u,new tf)}c(Wt0,"bnPow");function zt0(u,e,t){var r=Math.min(this.t+u.t,e);for(t.s=0,t.t=r;r>0;)t[--r]=0;var i;for(i=t.t-this.t;r=0;)t[r]=0;for(r=Math.max(e-this.t,0);r2*this.m.t)return u.mod(this.m);if(u.compareTo(this.m)<0)return u;var e=Y0();return u.copyTo(e),this.reduce(e),e}c(Qt0,"barrettConvert");function jt0(u){return u}c(jt0,"barrettRevert");function $t0(u){for(u.drShiftTo(this.m.t-1,this.r2),u.t>this.m.t+1&&(u.t=this.m.t+1,u.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);u.compareTo(this.r2)<0;)u.dAddOffset(1,this.m.t+1);for(u.subTo(this.r2,u);u.compareTo(this.m)>=0;)u.subTo(this.m,u)}c($t0,"barrettReduce");function Zt0(u,e){u.squareTo(e),this.reduce(e)}c(Zt0,"barrettSqrTo");function Xt0(u,e,t){u.multiplyTo(e,t),this.reduce(t)}c(Xt0,"barrettMulTo");Xo.prototype.convert=Qt0;Xo.prototype.revert=jt0;Xo.prototype.reduce=$t0;Xo.prototype.mulTo=Xt0;Xo.prototype.sqrTo=Zt0;function Jt0(u,e){var t=u.bitLength(),r,i=Ms(1),s;if(t<=0)return i;t<18?r=1:t<48?r=3:t<144?r=4:t<768?r=5:r=6,t<8?s=new ra(e):e.isEven()?s=new Xo(e):s=new ia(e);var a=new Array,o=3,h=r-1,f=(1<1){var d=Y0();for(s.sqrTo(a[1],d);o<=f;)a[o]=Y0(),s.mulTo(d,a[o-2],a[o]),o+=2}var p=u.t-1,E,x=!0,g=Y0(),m;for(t=Yy(u[p])-1;p>=0;){for(t>=h?E=u[p]>>t-h&f:(E=(u[p]&(1<0&&(E|=u[p-1]>>this.DB+t-h)),o=r;!(E&1);)E>>=1,--o;if((t-=o)<0&&(t+=this.DB,--p),x)a[E].copyTo(i),x=!1;else{for(;o>1;)s.sqrTo(i,g),s.sqrTo(g,i),o-=2;o>0?s.sqrTo(i,g):(m=i,i=g,g=m),s.mulTo(g,a[E],i)}for(;p>=0&&!(u[p]&1<0&&(e.rShiftTo(s,e),t.rShiftTo(s,t));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=t.getLowestSetBit())>0&&t.rShiftTo(i,t),e.compareTo(t)>=0?(e.subTo(t,e),e.rShiftTo(1,e)):(t.subTo(e,t),t.rShiftTo(1,t));return s>0&&t.lShiftTo(s,t),t}c(eu0,"bnGCD");function tu0(u){if(u<=0)return 0;var e=this.DV%u,t=this.s<0?u-1:0;if(this.t>0)if(e===0)t=this[0]%u;else for(var r=this.t-1;r>=0;--r)t=(e*t+this[r])%u;return t}c(tu0,"bnpModInt");function uu0(u){var e=u.isEven();if(this.isEven()&&e||u.signum()===0)return j.ZERO;for(var t=u.clone(),r=this.clone(),i=Ms(1),s=Ms(0),a=Ms(0),o=Ms(1);t.signum()!=0;){for(;t.isEven();)t.rShiftTo(1,t),e?((!i.isEven()||!s.isEven())&&(i.addTo(this,i),s.subTo(u,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(u,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?((!a.isEven()||!o.isEven())&&(a.addTo(this,a),o.subTo(u,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(u,o),o.rShiftTo(1,o);t.compareTo(r)>=0?(t.subTo(r,t),e&&i.subTo(a,i),s.subTo(o,s)):(r.subTo(t,r),e&&a.subTo(i,a),o.subTo(s,o))}if(r.compareTo(j.ONE)!=0)return j.ZERO;if(o.compareTo(u)>=0)return o.subtract(u);if(o.signum()<0)o.addTo(u,o);else return o;return o.signum()<0?o.add(u):o}c(uu0,"bnModInverse");var gu=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],ru0=(1<<26)/gu[gu.length-1];function iu0(u){var e,t=this.abs();if(t.t==1&&t[0]<=gu[gu.length-1]){for(e=0;e>1,u>gu.length&&(u=gu.length);for(var i=Y0(),s=0;s{var yB=sa(),Jo=require("crypto"),Qy=require("constants"),nu0={md2:Buffer.from("3020300c06082a864886f70d020205000410","hex"),md5:Buffer.from("3020300c06082a864886f70d020505000410","hex"),sha1:Buffer.from("3021300906052b0e03021a05000414","hex"),sha224:Buffer.from("302d300d06096086480165030402040500041c","hex"),sha256:Buffer.from("3031300d060960864801650304020105000420","hex"),sha384:Buffer.from("3041300d060960864801650304020205000430","hex"),sha512:Buffer.from("3051300d060960864801650304020305000440","hex"),ripemd160:Buffer.from("3021300906052b2403020105000414","hex"),rmd160:Buffer.from("3021300906052b2403020105000414","hex")},gB={ripemd160:"rmd160"},EB="sha256";yR.exports={isEncryption:!0,isSignature:!0};yR.exports.makeScheme=function(u,e){function t(r,i){this.key=r,this.options=i}return c(t,"Scheme"),t.prototype.maxMessageLength=function(){return this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==Qy.RSA_NO_PADDING?this.key.encryptedDataLength:this.key.encryptedDataLength-11},t.prototype.encPad=function(r,i){i=i||{};var s;if(r.length>this.key.maxMessageLength)throw new Error("Message too long for RSA (n="+this.key.encryptedDataLength+", l="+r.length+")");if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==Qy.RSA_NO_PADDING)return s=Buffer.alloc(this.key.maxMessageLength-r.length),s.fill(0),Buffer.concat([s,r]);if(i.type===1)return s=Buffer.alloc(this.key.encryptedDataLength-r.length-1),s.fill(255,0,s.length-1),s[0]=1,s[s.length-1]=0,Buffer.concat([s,r]);s=Buffer.alloc(this.key.encryptedDataLength-r.length),s[0]=0,s[1]=2;for(var a=Jo.randomBytes(s.length-3),o=0;o=r.length)return null}else{if(r[0]!==0||r[1]!==2)return null;for(s=3;r[s]!==0;)if(++s>=r.length)return null}return r.slice(s+1,r.length)},t.prototype.sign=function(r){var i=this.options.signingSchemeOptions.hash||EB;if(this.options.environment==="browser"){i=gB[i]||i;var s=Jo.createHash(i);s.update(r);var a=this.pkcs1pad(s.digest(),i),o=this.key.$doPrivate(new yB(a)).toBuffer(this.key.encryptedDataLength);return o}else{var h=Jo.createSign("RSA-"+i.toUpperCase());return h.update(r),h.sign(this.options.rsaUtils.exportKey("private"))}},t.prototype.verify=function(r,i,s){if(this.options.encryptionSchemeOptions&&this.options.encryptionSchemeOptions.padding==Qy.RSA_NO_PADDING)return!1;var a=this.options.signingSchemeOptions.hash||EB;if(this.options.environment==="browser"){a=gB[a]||a,s&&(i=Buffer.from(i,s));var o=Jo.createHash(a);o.update(r);var h=this.pkcs1pad(o.digest(),a),f=this.key.$doPublic(new yB(i));return f.toBuffer().toString("hex")==h.toString("hex")}else{var d=Jo.createVerify("RSA-"+a.toUpperCase());return d.update(r),d.verify(this.options.rsaUtils.exportKey("public"),i,s)}},t.prototype.pkcs0pad=function(r){var i=Buffer.alloc(this.key.maxMessageLength-r.length);return i.fill(0),Buffer.concat([i,r])},t.prototype.pkcs0unpad=function(r){var i;return typeof r.lastIndexOf=="function"?i=r.slice(r.lastIndexOf("\0")+1,r.length):i=r.slice(String.prototype.lastIndexOf.call(r,"\0")+1,r.length),i},t.prototype.pkcs1pad=function(r,i){var s=nu0[i];if(!s)throw Error("Unsupported hash algorithm");var a=Buffer.concat([s,r]);if(a.length+10>this.key.encryptedDataLength)throw Error("Key is too short for signing algorithm ("+i+")");var o=Buffer.alloc(this.key.encryptedDataLength-a.length-1);o.fill(255,0,o.length-1),o[0]=1,o[o.length-1]=0;var h=Buffer.concat([o,a]);return h},new t(u,e)}});var xB=w((d20,qr)=>{var f20=sa(),jy=require("crypto");qr.exports={isEncryption:!0,isSignature:!1};qr.exports.digestLength={md4:16,md5:16,ripemd160:20,rmd160:20,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64};var $y="sha1";qr.exports.eme_oaep_mgf1=function(u,e,t){t=t||$y;for(var r=qr.exports.digestLength[t],i=Math.ceil(e/r),s=Buffer.alloc(r*i),a=Buffer.alloc(4),o=0;oo-2*h-2)throw new Error("Message is too long to encode into an encoded message with a length of "+o+" bytes, increaseemLen to fix this error (minimum value for given parameters and options: "+(o-2*h-2)+")");var f=jy.createHash(i);f.update(a),f=f.digest();var d=Buffer.alloc(o-r.length-2*h-1);d.fill(0),d[d.length-1]=1;for(var p=Buffer.concat([f,d,r]),E=jy.randomBytes(h),x=s(E,p.length,i),g=0;g{var TB=sa(),uf=require("crypto");gR.exports={isEncryption:!1,isSignature:!0};var Zy="sha1",bB=20;gR.exports.makeScheme=function(u,e){var t=na().pkcs1_oaep;function r(i,s){this.key=i,this.options=s}return c(r,"Scheme"),r.prototype.sign=function(i){var s=uf.createHash(this.options.signingSchemeOptions.hash||Zy);s.update(i);var a=this.emsa_pss_encode(s.digest(),this.key.keySize-1);return this.key.$doPrivate(new TB(a)).toBuffer(this.key.encryptedDataLength)},r.prototype.verify=function(i,s,a){a&&(s=Buffer.from(s,a)),s=new TB(s);var o=Math.ceil((this.key.keySize-1)/8),h=this.key.$doPublic(s).toBuffer(o),f=uf.createHash(this.options.signingSchemeOptions.hash||Zy);return f.update(i),this.emsa_pss_verify(f.digest(),h,this.key.keySize-1)},r.prototype.emsa_pss_encode=function(i,s){var a=this.options.signingSchemeOptions.hash||Zy,o=this.options.signingSchemeOptions.mgf||t.eme_oaep_mgf1,h=this.options.signingSchemeOptions.saltLength||bB,f=t.digestLength[a],d=Math.ceil(s/8);if(d>8-L<<8-L;T[0]=T[0]&N;var k=Buffer.alloc(T.length+x.length+1);return T.copy(k,0),x.copy(k,T.length),k[k.length-1]=188,k},r.prototype.emsa_pss_verify=function(i,s,a){var o=this.options.signingSchemeOptions.hash||Zy,h=this.options.signingSchemeOptions.mgf||t.eme_oaep_mgf1,f=this.options.signingSchemeOptions.saltLength||bB,d=t.digestLength[o],p=Math.ceil(a/8);if(p>8-m<<8-m,E[0]=E[0]&x,g=0;E[g]===0&&g{ec.exports={pkcs1:mB(),pkcs1_oaep:xB(),pss:_B(),isEncryption:function(u){return ec.exports[u]&&ec.exports[u].isEncryption},isSignature:function(u){return ec.exports[u]&&ec.exports[u].isSignature}}});var mR=w((m20,CB)=>{var ER=sa(),au0=na();CB.exports=function(u,e){var t=au0.pkcs1.makeScheme(u,e);return{encrypt:function(r,i){var s,a;return i?(s=new ER(t.encPad(r,{type:1})),a=u.$doPrivate(s)):(s=new ER(u.encryptionScheme.encPad(r)),a=u.$doPublic(s)),a.toBuffer(u.encryptedDataLength)},decrypt:function(r,i){var s,a=new ER(r);return i?(s=u.$doPublic(a),t.encUnPad(s.toBuffer(u.encryptedDataLength),{type:1})):(s=u.$doPrivate(a),u.encryptionScheme.encUnPad(s.toBuffer(u.encryptedDataLength)))}}}});var AB=w((x20,RB)=>{var Xy=require("crypto"),Hs=require("constants"),ou0=na();RB.exports=function(u,e){var t=ou0.pkcs1.makeScheme(u,e);return{encrypt:function(r,i){var s;if(i)return s=Hs.RSA_PKCS1_PADDING,e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding),Xy.privateEncrypt({key:e.rsaUtils.exportKey("private"),padding:s},r);s=Hs.RSA_PKCS1_OAEP_PADDING,e.encryptionScheme==="pkcs1"&&(s=Hs.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding);var a=r;return s===Hs.RSA_NO_PADDING&&(a=t.pkcs0pad(r)),Xy.publicEncrypt({key:e.rsaUtils.exportKey("public"),padding:s},a)},decrypt:function(r,i){var s;if(i)return s=Hs.RSA_PKCS1_PADDING,e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding),Xy.publicDecrypt({key:e.rsaUtils.exportKey("public"),padding:s},r);s=Hs.RSA_PKCS1_OAEP_PADDING,e.encryptionScheme==="pkcs1"&&(s=Hs.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(s=e.encryptionSchemeOptions.padding);var a=Xy.privateDecrypt({key:e.rsaUtils.exportKey("private"),padding:s},r);return s===Hs.RSA_NO_PADDING?t.pkcs0unpad(a):a}}}});var IB=w((T20,vB)=>{var wB=require("crypto"),tc=require("constants"),cu0=na();vB.exports=function(u,e){var t=mR()(u,e),r=cu0.pkcs1.makeScheme(u,e);return{encrypt:function(i,s){if(s)return t.encrypt(i,s);var a=tc.RSA_PKCS1_OAEP_PADDING;e.encryptionScheme==="pkcs1"&&(a=tc.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(a=e.encryptionSchemeOptions.padding);var o=i;return a===tc.RSA_NO_PADDING&&(o=r.pkcs0pad(i)),wB.publicEncrypt({key:e.rsaUtils.exportKey("public"),padding:a},o)},decrypt:function(i,s){if(s)return t.decrypt(i,s);var a=tc.RSA_PKCS1_OAEP_PADDING;e.encryptionScheme==="pkcs1"&&(a=tc.RSA_PKCS1_PADDING),e.encryptionSchemeOptions&&e.encryptionSchemeOptions.padding&&(a=e.encryptionSchemeOptions.padding);var o=wB.privateDecrypt({key:e.rsaUtils.exportKey("private"),padding:a},i);return a===tc.RSA_NO_PADDING?r.pkcs0unpad(o):o}}}});var SB=w((b20,LB)=>{var Jy=require("crypto");LB.exports={getEngine:function(u,e){var t=mR();return e.environment==="node"&&typeof Jy.publicEncrypt=="function"&&typeof Jy.privateDecrypt=="function"&&(typeof Jy.privateEncrypt=="function"&&typeof Jy.publicDecrypt=="function"?t=AB():t=IB()),t(u,e)}}});var PB=w((NB,UB)=>{var eg=yu()._,_20=require("crypto"),st=sa(),KB=yu(),OB=na(),lu0=SB();NB.BigInteger=st;UB.exports.Key=function(){function u(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}return c(u,"RSAKey"),u.prototype.setOptions=function(e){var t=OB[e.signingScheme],r=OB[e.encryptionScheme];t===r?this.signingScheme=this.encryptionScheme=r.makeScheme(this,e):(this.encryptionScheme=r.makeScheme(this,e),this.signingScheme=t.makeScheme(this,e)),this.encryptEngine=lu0.getEngine(this,e)},u.prototype.generate=function(e,t){var r=e>>1;this.e=parseInt(t,16);for(var i=new st(t,16);;){for(;this.p=new st(e-r,1),!(this.p.subtract(st.ONE).gcd(i).compareTo(st.ONE)===0&&this.p.isProbablePrime(10)););for(;this.q=new st(r,1),!(this.q.subtract(st.ONE).gcd(i).compareTo(st.ONE)===0&&this.q.isProbablePrime(10)););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var a=this.p.subtract(st.ONE),o=this.q.subtract(st.ONE),h=a.multiply(o);if(h.gcd(i).compareTo(st.ONE)===0){if(this.n=this.p.multiply(this.q),this.n.bitLength()0&&(eg.isNumber(t)||t.length>0)&&r.length>0)this.n=new st(e),this.e=eg.isNumber(t)?t:KB.get32IntFromBuffer(t,0),this.d=new st(r),i&&s&&a&&o&&h&&(this.p=new st(i),this.q=new st(s),this.dmp1=new st(a),this.dmq1=new st(o),this.coeff=new st(h)),this.$$recalculateCache();else throw Error("Invalid RSA private key")},u.prototype.setPublic=function(e,t){if(e&&t&&e.length>0&&(eg.isNumber(t)||t.length>0))this.n=new st(e),this.e=eg.isNumber(t)?t:KB.get32IntFromBuffer(t,0),this.$$recalculateCache();else throw Error("Invalid RSA public key")},u.prototype.$doPrivate=function(e){if(this.p||this.q)return e.modPow(this.d,this.n);for(var t=e.mod(this.p).modPow(this.dmp1,this.p),r=e.mod(this.q).modPow(this.dmq1,this.q);t.compareTo(r)<0;)t=t.add(this.p);return t.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},u.prototype.$doPublic=function(e){return e.modPowInt(this.e,this.n)},u.prototype.encrypt=function(e,t){var r=[],i=[],s=e.length,a=Math.ceil(s/this.maxMessageLength)||1,o=Math.ceil(s/a||1);if(a==1)r.push(e);else for(var h=0;h0)throw Error("Incorrect data or key");for(var r=[],i=0,s=0,a=e.length/this.encryptedDataLength,o=0;o>3},u}()});var tg=w((R20,kB)=>{kB.exports={newInvalidAsn1Error:function(u){var e=new Error;return e.name="InvalidAsn1Error",e.message=u||"",e}}});var ug=w((A20,BB)=>{BB.exports={EOC:0,Boolean:1,Integer:2,BitString:3,OctetString:4,Null:5,OID:6,ObjectDescriptor:7,External:8,Real:9,Enumeration:10,PDV:11,Utf8String:12,RelativeOID:13,Sequence:16,Set:17,NumericString:18,PrintableString:19,T61String:20,VideotexString:21,IA5String:22,UTCTime:23,GeneralizedTime:24,GraphicString:25,VisibleString:26,GeneralString:28,UniversalString:29,CharacterString:30,BMPString:31,Constructor:32,Context:128}});var xR=w((w20,DB)=>{"use strict";var rg=require("buffer"),uc=rg.Buffer,Er={},mr;for(mr in rg)rg.hasOwnProperty(mr)&&(mr==="SlowBuffer"||mr==="Buffer"||(Er[mr]=rg[mr]));var rc=Er.Buffer={};for(mr in uc)uc.hasOwnProperty(mr)&&(mr==="allocUnsafe"||mr==="allocUnsafeSlow"||(rc[mr]=uc[mr]));Er.Buffer.prototype=uc.prototype;(!rc.from||rc.from===Uint8Array.from)&&(rc.from=function(u,e,t){if(typeof u=="number")throw new TypeError('The "value" argument must not be of type number. Received type '+typeof u);if(u&&typeof u.length>"u")throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof u);return uc(u,e,t)});rc.alloc||(rc.alloc=function(u,e,t){if(typeof u!="number")throw new TypeError('The "size" argument must be of type number. Received type '+typeof u);if(u<0||u>=2*(1<<30))throw new RangeError('The value "'+u+'" is invalid for option "size"');var r=uc(u);return!e||e.length===0?r.fill(0):typeof t=="string"?r.fill(e,t):r.fill(e),r});if(!Er.kStringMaxLength)try{Er.kStringMaxLength=process.binding("buffer").kStringMaxLength}catch{}Er.constants||(Er.constants={MAX_LENGTH:Er.kMaxLength},Er.kStringMaxLength&&(Er.constants.MAX_STRING_LENGTH=Er.kStringMaxLength));DB.exports=Er});var HB=w((v20,MB)=>{var hu0=require("assert"),FB=xR().Buffer,rf=ug(),fu0=tg(),ic=fu0.newInvalidAsn1Error;function Eu(u){if(!u||!FB.isBuffer(u))throw new TypeError("data must be a node Buffer");this._buf=u,this._size=u.length,this._len=0,this._offset=0}c(Eu,"Reader");Object.defineProperty(Eu.prototype,"length",{enumerable:!0,get:function(){return this._len}});Object.defineProperty(Eu.prototype,"offset",{enumerable:!0,get:function(){return this._offset}});Object.defineProperty(Eu.prototype,"remain",{get:function(){return this._size-this._offset}});Object.defineProperty(Eu.prototype,"buffer",{get:function(){return this._buf.slice(this._offset)}});Eu.prototype.readByte=function(u){if(this._size-this._offset<1)return null;var e=this._buf[this._offset]&255;return u||(this._offset+=1),e};Eu.prototype.peek=function(){return this.readByte(!0)};Eu.prototype.readLength=function(u){if(u===void 0&&(u=this._offset),u>=this._size)return null;var e=this._buf[u++]&255;if(e===null)return null;if((e&128)===128){if(e&=127,e===0)throw ic("Indefinite length not supported");if(e>4)throw ic("encoding too long");if(this._size-uthis._size-r)return null;if(this._offset=r,this.length===0)return e?FB.alloc(0):"";var i=this._buf.slice(this._offset,this._offset+this.length);return this._offset+=this.length,e?i:i.toString("utf8")};Eu.prototype.readOID=function(u){u||(u=rf.OID);var e=this.readString(u,!0);if(e===null)return null;for(var t=[],r=0,i=0;i>0),t.join(".")};Eu.prototype._readTag=function(u){hu0.ok(u!==void 0);var e=this.peek();if(e===null)return null;if(e!==u)throw ic("Expected 0x"+u.toString(16)+": got 0x"+e.toString(16));var t=this.readLength(this._offset+1);if(t===null)return null;if(this.length>4)throw ic("Integer too long: "+this.length);if(this.length>this._size-t)return null;this._offset=t;for(var r=this._buf[this._offset],i=0,s=0;s>0};MB.exports=Eu});var VB=w((L20,qB)=>{var qs=require("assert"),ig=xR().Buffer,Vs=ug(),du0=tg(),sg=du0.newInvalidAsn1Error,pu0={size:1024,growthFactor:8};function yu0(u,e){qs.ok(u),qs.equal(typeof u,"object"),qs.ok(e),qs.equal(typeof e,"object");var t=Object.getOwnPropertyNames(u);return t.forEach(function(r){if(!e[r]){var i=Object.getOwnPropertyDescriptor(u,r);Object.defineProperty(e,r,i)}}),e}c(yu0,"merge");function jt(u){u=yu0(pu0,u||{}),this._buf=ig.alloc(u.size||1024),this._size=this._buf.length,this._offset=0,this._options=u,this._seq=[]}c(jt,"Writer");Object.defineProperty(jt.prototype,"buffer",{get:function(){if(this._seq.length)throw sg(this._seq.length+" unended sequence(s)");return this._buf.slice(0,this._offset)}});jt.prototype.writeByte=function(u){if(typeof u!="number")throw new TypeError("argument must be a Number");this._ensure(1),this._buf[this._offset++]=u};jt.prototype.writeInt=function(u,e){if(typeof u!="number")throw new TypeError("argument must be a Number");typeof e!="number"&&(e=Vs.Integer);for(var t=4;(!(u&4286578688)||(u&4286578688)===-8388608)&&t>1;)t--,u<<=8;if(t>4)throw sg("BER ints cannot be > 0xffffffff");for(this._ensure(2+t),this._buf[this._offset++]=e,this._buf[this._offset++]=t;t-- >0;)this._buf[this._offset++]=(u&4278190080)>>>24,u<<=8};jt.prototype.writeNull=function(){this.writeByte(Vs.Null),this.writeByte(0)};jt.prototype.writeEnumeration=function(u,e){if(typeof u!="number")throw new TypeError("argument must be a Number");return typeof e!="number"&&(e=Vs.Enumeration),this.writeInt(u,e)};jt.prototype.writeBoolean=function(u,e){if(typeof u!="boolean")throw new TypeError("argument must be a Boolean");typeof e!="number"&&(e=Vs.Boolean),this._ensure(3),this._buf[this._offset++]=e,this._buf[this._offset++]=1,this._buf[this._offset++]=u?255:0};jt.prototype.writeString=function(u,e){if(typeof u!="string")throw new TypeError("argument must be a string (was: "+typeof u+")");typeof e!="number"&&(e=Vs.OctetString);var t=ig.byteLength(u);this.writeByte(e),this.writeLength(t),t&&(this._ensure(t),this._buf.write(u,this._offset),this._offset+=t)};jt.prototype.writeBuffer=function(u,e){if(typeof e!="number")throw new TypeError("tag must be a number");if(!ig.isBuffer(u))throw new TypeError("argument must be a buffer");this.writeByte(e),this.writeLength(u.length),this._ensure(u.length),u.copy(this._buf,this._offset,0,u.length),this._offset+=u.length};jt.prototype.writeStringArray=function(u){if(!u instanceof Array)throw new TypeError("argument must be an Array[String]");var e=this;u.forEach(function(t){e.writeString(t)})};jt.prototype.writeOID=function(u,e){if(typeof u!="string")throw new TypeError("argument must be a string");if(typeof e!="number"&&(e=Vs.OID),!/^([0-9]+\.){3,}[0-9]+$/.test(u))throw new Error("argument is not a valid OID string");function t(a,o){o<128?a.push(o):o<16384?(a.push(o>>>7|128),a.push(o&127)):o<2097152?(a.push(o>>>14|128),a.push((o>>>7|128)&255),a.push(o&127)):o<268435456?(a.push(o>>>21|128),a.push((o>>>14|128)&255),a.push((o>>>7|128)&255),a.push(o&127)):(a.push((o>>>28|128)&255),a.push((o>>>21|128)&255),a.push((o>>>14|128)&255),a.push((o>>>7|128)&255),a.push(o&127))}c(t,"encodeOctet");var r=u.split("."),i=[];i.push(parseInt(r[0],10)*40+parseInt(r[1],10)),r.slice(2).forEach(function(a){t(i,parseInt(a,10))});var s=this;this._ensure(2+i.length),this.writeByte(e),this.writeLength(i.length),i.forEach(function(a){s.writeByte(a)})};jt.prototype.writeLength=function(u){if(typeof u!="number")throw new TypeError("argument must be a Number");if(this._ensure(4),u<=127)this._buf[this._offset++]=u;else if(u<=255)this._buf[this._offset++]=129,this._buf[this._offset++]=u;else if(u<=65535)this._buf[this._offset++]=130,this._buf[this._offset++]=u>>8,this._buf[this._offset++]=u;else if(u<=16777215)this._buf[this._offset++]=131,this._buf[this._offset++]=u>>16,this._buf[this._offset++]=u>>8,this._buf[this._offset++]=u;else throw sg("Length too long (> 4 bytes)")};jt.prototype.startSequence=function(u){typeof u!="number"&&(u=Vs.Sequence|Vs.Constructor),this.writeByte(u),this._seq.push(this._offset),this._ensure(3),this._offset+=3};jt.prototype.endSequence=function(){var u=this._seq.pop(),e=u+3,t=this._offset-e;if(t<=127)this._shift(e,t,-2),this._buf[u]=t;else if(t<=255)this._shift(e,t,-1),this._buf[u]=129,this._buf[u+1]=t;else if(t<=65535)this._buf[u]=130,this._buf[u+1]=t>>8,this._buf[u+2]=t;else if(t<=16777215)this._shift(e,t,1),this._buf[u]=131,this._buf[u+1]=t>>16,this._buf[u+2]=t>>8,this._buf[u+3]=t;else throw sg("Sequence too long")};jt.prototype._shift=function(u,e,t){qs.ok(u!==void 0),qs.ok(e!==void 0),qs.ok(t),this._buf.copy(this._buf,u+t,u,u+e),this._offset+=t};jt.prototype._ensure=function(u){if(qs.ok(u),this._size-this._offset{var TR=tg(),bR=ug(),gu0=HB(),Eu0=VB();og.exports={Reader:gu0,Writer:Eu0};for(ng in bR)bR.hasOwnProperty(ng)&&(og.exports[ng]=bR[ng]);var ng;for(ag in TR)TR.hasOwnProperty(ag)&&(og.exports[ag]=TR[ag]);var ag});var cg=w((O20,WB)=>{var _R=GB();WB.exports={Ber:_R,BerReader:_R.Reader,BerWriter:_R.Writer}});var ZB=w((N20,fg)=>{var lg=cg().Ber,zB=yu()._,hg=yu(),YB="-----BEGIN RSA PRIVATE KEY-----",QB="-----END RSA PRIVATE KEY-----",jB="-----BEGIN RSA PUBLIC KEY-----",$B="-----END RSA PUBLIC KEY-----";fg.exports={privateExport:function(u,e){e=e||{};var t=u.n.toBuffer(),r=u.d.toBuffer(),i=u.p.toBuffer(),s=u.q.toBuffer(),a=u.dmp1.toBuffer(),o=u.dmq1.toBuffer(),h=u.coeff.toBuffer(),f=t.length+r.length+i.length+s.length+a.length+o.length+h.length+512,d=new lg.Writer({size:f});return d.startSequence(),d.writeInt(0),d.writeBuffer(t,2),d.writeInt(u.e),d.writeBuffer(r,2),d.writeBuffer(i,2),d.writeBuffer(s,2),d.writeBuffer(a,2),d.writeBuffer(o,2),d.writeBuffer(h,2),d.endSequence(),e.type==="der"?d.buffer:YB+` +`+hg.linebrk(d.buffer.toString("base64"),64)+` +`+QB},privateImport:function(u,e,t){t=t||{};var r;if(t.type!=="der")if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),zB.isString(e)){var i=hg.trimSurroundingText(e,YB,QB).replace(/\s+|\n\r|\n|\r$/gm,"");r=Buffer.from(i,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(e))r=e;else throw Error("Unsupported key format");var s=new lg.Reader(r);s.readSequence(),s.readString(2,!0),u.setPrivate(s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0),s.readString(2,!0))},publicExport:function(u,e){e=e||{};var t=u.n.toBuffer(),r=t.length+512,i=new lg.Writer({size:r});return i.startSequence(),i.writeBuffer(t,2),i.writeInt(u.e),i.endSequence(),e.type==="der"?i.buffer:jB+` +`+hg.linebrk(i.buffer.toString("base64"),64)+` +`+$B},publicImport:function(u,e,t){t=t||{};var r;if(t.type!=="der"){if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),zB.isString(e)){var i=hg.trimSurroundingText(e,jB,$B).replace(/\s+|\n\r|\n|\r$/gm,"");r=Buffer.from(i,"base64")}}else if(Buffer.isBuffer(e))r=e;else throw Error("Unsupported key format");var s=new lg.Reader(r);s.readSequence(),u.setPublic(s.readString(2,!0),s.readString(2,!0))},autoImport:function(u,e){return/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(e)?(fg.exports.privateImport(u,e),!0):/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(e)?(fg.exports.publicImport(u,e),!0):!1}}});var rD=w((U20,yg)=>{var bi=cg().Ber,XB=yu()._,dg="1.2.840.113549.1.1.1",pg=yu(),JB="-----BEGIN PRIVATE KEY-----",eD="-----END PRIVATE KEY-----",tD="-----BEGIN PUBLIC KEY-----",uD="-----END PUBLIC KEY-----";yg.exports={privateExport:function(u,e){e=e||{};var t=u.n.toBuffer(),r=u.d.toBuffer(),i=u.p.toBuffer(),s=u.q.toBuffer(),a=u.dmp1.toBuffer(),o=u.dmq1.toBuffer(),h=u.coeff.toBuffer(),f=t.length+r.length+i.length+s.length+a.length+o.length+h.length+512,d=new bi.Writer({size:f});d.startSequence(),d.writeInt(0),d.writeBuffer(t,2),d.writeInt(u.e),d.writeBuffer(r,2),d.writeBuffer(i,2),d.writeBuffer(s,2),d.writeBuffer(a,2),d.writeBuffer(o,2),d.writeBuffer(h,2),d.endSequence();var p=new bi.Writer({size:f});return p.startSequence(),p.writeInt(0),p.startSequence(),p.writeOID(dg),p.writeNull(),p.endSequence(),p.writeBuffer(d.buffer,4),p.endSequence(),e.type==="der"?p.buffer:JB+` +`+pg.linebrk(p.buffer.toString("base64"),64)+` +`+eD},privateImport:function(u,e,t){t=t||{};var r;if(t.type!=="der")if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),XB.isString(e)){var i=pg.trimSurroundingText(e,JB,eD).replace("-----END PRIVATE KEY-----","").replace(/\s+|\n\r|\n|\r$/gm,"");r=Buffer.from(i,"base64")}else throw Error("Unsupported key format");else if(Buffer.isBuffer(e))r=e;else throw Error("Unsupported key format");var s=new bi.Reader(r);s.readSequence(),s.readInt(0);var a=new bi.Reader(s.readString(48,!0));if(a.readOID(6,!0)!==dg)throw Error("Invalid Public key format");var o=new bi.Reader(s.readString(4,!0));o.readSequence(),o.readString(2,!0),u.setPrivate(o.readString(2,!0),o.readString(2,!0),o.readString(2,!0),o.readString(2,!0),o.readString(2,!0),o.readString(2,!0),o.readString(2,!0),o.readString(2,!0))},publicExport:function(u,e){e=e||{};var t=u.n.toBuffer(),r=t.length+512,i=new bi.Writer({size:r});i.writeByte(0),i.startSequence(),i.writeBuffer(t,2),i.writeInt(u.e),i.endSequence();var s=new bi.Writer({size:r});return s.startSequence(),s.startSequence(),s.writeOID(dg),s.writeNull(),s.endSequence(),s.writeBuffer(i.buffer,3),s.endSequence(),e.type==="der"?s.buffer:tD+` +`+pg.linebrk(s.buffer.toString("base64"),64)+` +`+uD},publicImport:function(u,e,t){t=t||{};var r;if(t.type!=="der"){if(Buffer.isBuffer(e)&&(e=e.toString("utf8")),XB.isString(e)){var i=pg.trimSurroundingText(e,tD,uD).replace(/\s+|\n\r|\n|\r$/gm,"");r=Buffer.from(i,"base64")}}else if(Buffer.isBuffer(e))r=e;else throw Error("Unsupported key format");var s=new bi.Reader(r);s.readSequence();var a=new bi.Reader(s.readString(48,!0));if(a.readOID(6,!0)!==dg)throw Error("Invalid Public key format");var o=new bi.Reader(s.readString(3,!0));o.readByte(),o.readSequence(),u.setPublic(o.readString(2,!0),o.readString(2,!0))},autoImport:function(u,e){return/^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(e)?(yg.exports.privateImport(u,e),!0):/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(e)?(yg.exports.publicImport(u,e),!0):!1}}});var iD=w((B20,gg)=>{var P20=yu()._,k20=yu();gg.exports={privateExport:function(u,e){return{n:u.n.toBuffer(),e:u.e,d:u.d.toBuffer(),p:u.p.toBuffer(),q:u.q.toBuffer(),dmp1:u.dmp1.toBuffer(),dmq1:u.dmq1.toBuffer(),coeff:u.coeff.toBuffer()}},privateImport:function(u,e,t){if(e.n&&e.e&&e.d&&e.p&&e.q&&e.dmp1&&e.dmq1&&e.coeff)u.setPrivate(e.n,e.e,e.d,e.p,e.q,e.dmp1,e.dmq1,e.coeff);else throw Error("Invalid key data")},publicExport:function(u,e){return{n:u.n.toBuffer(),e:u.e}},publicImport:function(u,e,t){if(e.n&&e.e)u.setPublic(e.n,e.e);else throw Error("Invalid key data")},autoImport:function(u,e){return e.n&&e.e?e.d&&e.p&&e.q&&e.dmp1&&e.dmq1&&e.coeff?(gg.exports.privateImport(u,e),!0):(gg.exports.publicImport(u,e),!0):!1}}});var cD=w((D20,Eg)=>{var sD=yu()._,nD=yu(),sf=sa(),aD="-----BEGIN OPENSSH PRIVATE KEY-----",oD="-----END OPENSSH PRIVATE KEY-----";Eg.exports={privateExport:function(u,e){let t=u.n.toBuffer(),r=Buffer.alloc(4);for(r.writeUInt32BE(u.e,0);r[0]===0;)r=r.slice(1);let i=u.d.toBuffer(),s=u.coeff.toBuffer(),a=u.p.toBuffer(),o=u.q.toBuffer(),h;typeof u.sshcomment<"u"?h=Buffer.from(u.sshcomment):h=Buffer.from([]);let f=15+r.byteLength+4+t.byteLength,d=23+t.byteLength+4+r.byteLength+4+i.byteLength+4+s.byteLength+4+a.byteLength+4+o.byteLength+4+h.byteLength,p=43+f+4+d,E=Math.ceil(d/8)*8-d;p+=E;let x=Buffer.alloc(p),g={buf:x,off:0};x.write("openssh-key-v1","utf8"),x.writeUInt8(0,14),g.off+=15,Ft(g,Buffer.from("none")),Ft(g,Buffer.from("none")),Ft(g,Buffer.from("")),g.off=g.buf.writeUInt32BE(1,g.off),g.off=g.buf.writeUInt32BE(f,g.off),Ft(g,Buffer.from("ssh-rsa")),Ft(g,r),Ft(g,t),g.off=g.buf.writeUInt32BE(p-47-f,g.off),g.off+=8,Ft(g,Buffer.from("ssh-rsa")),Ft(g,t),Ft(g,r),Ft(g,i),Ft(g,s),Ft(g,a),Ft(g,o),Ft(g,h);let m=1;for(;g.off{var M20=yu()._;function lD(u){u=u.split("-");for(var e="private",t={type:"default"},r=1;r{var fD=require("constants"),mu0=PB(),V20=require("crypto"),G20=cg().Ber,Yu=yu()._,xu0=yu(),dD=na(),pD=hD();typeof fD.RSA_NO_PADDING>"u"&&(fD.RSA_NO_PADDING=3);yD.exports=function(){var u={node10:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],node:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],iojs:["md4","md5","ripemd160","sha1","sha224","sha256","sha384","sha512"],browser:["md5","ripemd160","sha1","sha256","sha512"]},e="pkcs1_oaep",t="pkcs1",r="private",i={private:"pkcs1-private-pem","private-der":"pkcs1-private-der",public:"pkcs8-public-pem","public-der":"pkcs8-public-der"};function s(a,o,h){if(!(this instanceof s))return new s(a,o,h);Yu.isObject(o)&&(h=o,o=void 0),this.$options={signingScheme:t,signingSchemeOptions:{hash:"sha256",saltLength:null},encryptionScheme:e,encryptionSchemeOptions:{hash:"sha1",label:null},environment:xu0.detectEnvironment(),rsaUtils:this},this.keyPair=new mu0.Key,this.$cache={},Buffer.isBuffer(a)||Yu.isString(a)?this.importKey(a,o):Yu.isObject(a)&&this.generateKeyPair(a.b,a.e),this.setOptions(h)}return c(s,"NodeRSA"),s.prototype.setOptions=function(a){if(a=a||{},a.environment&&(this.$options.environment=a.environment),a.signingScheme){if(Yu.isString(a.signingScheme)){var o=a.signingScheme.toLowerCase().split("-");o.length==1?u.node.indexOf(o[0])>-1?(this.$options.signingSchemeOptions={hash:o[0]},this.$options.signingScheme=t):(this.$options.signingScheme=o[0],this.$options.signingSchemeOptions={hash:null}):(this.$options.signingSchemeOptions={hash:o[1]},this.$options.signingScheme=o[0])}else Yu.isObject(a.signingScheme)&&(this.$options.signingScheme=a.signingScheme.scheme||t,this.$options.signingSchemeOptions=Yu.omit(a.signingScheme,"scheme"));if(!dD.isSignature(this.$options.signingScheme))throw Error("Unsupported signing scheme");if(this.$options.signingSchemeOptions.hash&&u[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}if(a.encryptionScheme){if(Yu.isString(a.encryptionScheme)?(this.$options.encryptionScheme=a.encryptionScheme.toLowerCase(),this.$options.encryptionSchemeOptions={}):Yu.isObject(a.encryptionScheme)&&(this.$options.encryptionScheme=a.encryptionScheme.scheme||e,this.$options.encryptionSchemeOptions=Yu.omit(a.encryptionScheme,"scheme")),!dD.isEncryption(this.$options.encryptionScheme))throw Error("Unsupported encryption scheme");if(this.$options.encryptionSchemeOptions.hash&&u[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash)===-1)throw Error("Unsupported hashing algorithm for "+this.$options.environment+" environment")}this.keyPair.setOptions(this.$options)},s.prototype.generateKeyPair=function(a,o){if(a=a||2048,o=o||65537,a%8!==0)throw Error("Key size must be a multiple of 8.");return this.keyPair.generate(a,o.toString(16)),this.$cache={},this},s.prototype.importKey=function(a,o){if(!a)throw Error("Empty key given");if(o&&(o=i[o]||o),!pD.detectAndImport(this.keyPair,a,o)&&o===void 0)throw Error("Key format must be specified");return this.$cache={},this},s.prototype.exportKey=function(a){return a=a||r,a=i[a]||a,this.$cache[a]||(this.$cache[a]=pD.detectAndExport(this.keyPair,a)),this.$cache[a]},s.prototype.isPrivate=function(){return this.keyPair.isPrivate()},s.prototype.isPublic=function(a){return this.keyPair.isPublic(a)},s.prototype.isEmpty=function(a){return!(this.keyPair.n||this.keyPair.e||this.keyPair.d)},s.prototype.encrypt=function(a,o,h){return this.$$encryptKey(!1,a,o,h)},s.prototype.decrypt=function(a,o){return this.$$decryptKey(!1,a,o)},s.prototype.encryptPrivate=function(a,o,h){return this.$$encryptKey(!0,a,o,h)},s.prototype.decryptPublic=function(a,o){return this.$$decryptKey(!0,a,o)},s.prototype.$$encryptKey=function(a,o,h,f){try{var d=this.keyPair.encrypt(this.$getDataForEncrypt(o,f),a);return h=="buffer"||!h?d:d.toString(h)}catch(p){throw Error("Error during encryption. Original error: "+p)}},s.prototype.$$decryptKey=function(a,o,h){try{o=Yu.isString(o)?Buffer.from(o,"base64"):o;var f=this.keyPair.decrypt(o,a);if(f===null)throw Error("Key decrypt method returns null.");return this.$getDecryptedData(f,h)}catch(d){throw Error("Error during decryption (probably incorrect key). Original error: "+d)}},s.prototype.sign=function(a,o,h){if(!this.isPrivate())throw Error("This is not private key");var f=this.keyPair.sign(this.$getDataForEncrypt(a,h));return o&&o!="buffer"&&(f=f.toString(o)),f},s.prototype.verify=function(a,o,h,f){if(!this.isPublic())throw Error("This is not public key");return f=!f||f=="buffer"?null:f,this.keyPair.verify(this.$getDataForEncrypt(a,h),o,f)},s.prototype.getKeySize=function(){return this.keyPair.keySize},s.prototype.getMaxMessageSize=function(){return this.keyPair.maxMessageLength},s.prototype.$getDataForEncrypt=function(a,o){if(Yu.isString(a)||Yu.isNumber(a))return Buffer.from(""+a,o||"utf8");if(Buffer.isBuffer(a))return a;if(Yu.isObject(a))return Buffer.from(JSON.stringify(a));throw Error("Unexpected data type")},s.prototype.$getDecryptedData=function(a,o){return o=o||"buffer",o=="buffer"?a:o=="json"?JSON.parse(a.toString()):a.toString(o)},s}()});var xD=w((Y20,mD)=>{var ED=require("crypto"),Tu0=oR(),bu0=ef(),Gs=class Gs{static parseKey(e){if(e.tag!==bu0.tag_Sequence)throw new Error("corrupt private key");let t=e.getBigInteger();if(t!==Gs.version)throw new Error("version mismatch: (supported "+this.version+", parsed: "+t);let r=e.getDerValue(),i=e.getDerValue(),s=new Tu0(r.data);if(Gs.supportedTypes.dsa===s.toString()||Gs.supportedTypes.ec===s.toString())return Gs.format(e.buffer);try{let a=i.getOctetString();return Gs.export(a)}catch(a){let o=new Error("Something went wrong with algorithm "+s.toString()+". For more details see 'error.context'");throw o.context=a,o}}static export(e){if(typeof ED.createPrivateKey=="function")return ED.createPrivateKey({key:e,format:"der",type:"pkcs1"}).export({format:"pem",type:"pkcs8"});{let t=gD();return new t(e,"pkcs1-der").exportKey("pkcs8-pem")+` +`}}static format(e){return`-----BEGIN PRIVATE KEY----- +`+e.toString("base64").match(/.{1,64}/g).join(` +`)+` +-----END PRIVATE KEY----- +`}};c(Gs,"PKCS8Key");var nf=Gs;nf.supportedTypes={rsa:"1.2.840.113549.1.1.1","rsa-pss":"1.2.840.113549.1.1.10",dsa:"1.2.840.10040.4.1",ec:"1.2.840.10045.2.1",x25519:"1.3.101.110",x448:"1.3.101.111",ed25519:"1.3.101.112",ed448:"1.3.101.113",dh:"1.2.840.113549.1.3.1"};nf.version=0;mD.exports=nf});var _D=w((j20,bD)=>{var TD=require("crypto"),_u0=xD(),Cu0=ef(),Ru0=zn(),af=Oo(),mu=class mu{constructor(e){this.messageDigest=TD.createHash(mu.DIGEST_ALG),this.passwdBytes=Buffer.alloc(e.length*2);for(let t=0,r=0;t>8,this.passwdBytes[r++]=e[t].charCodeAt()}resetDigest(){this.messageDigest=TD.createHash(mu.DIGEST_ALG)}recover(e){let t,r,i;if(e.getAlgorithm()!==mu.KEY_PROTECTOR_OID)throw new Error("Unsupported key protection alghorithm");let a=e.getEncryptedData(),o=af(a,0,mu.SALT_LEN);i=a.length-mu.SALT_LEN-mu.DIGEST_LEN,r=Math.floor(i/mu.DIGEST_LEN),i%mu.DIGEST_LEN!==0&&r++;let h=af(a,mu.SALT_LEN,i+mu.SALT_LEN),f=Buffer.alloc(h.length);for(let p=0,E=0,x=o;p{var RR=class RR{generate(e){return`-----BEGIN CERTIFICATE----- +`+e.toString("base64").match(/.{1,64}/g).join(` +`)+` +-----END CERTIFICATE----- +`}};c(RR,"X509Cert");var CR=RR;CD.exports=CR});var vD=w((J20,wD)=>{var AD=RD(),wR=class wR{constructor(){this.algorithms={X509:AD,"X.509":AD}}get(e){if(!this.algorithms[e])throw new Error("The certificate type "+e+" is not supported");return new this.algorithms[e]}};c(wR,"CertificateRegistry");var AR=wR;wD.exports=AR});var OD=w((td0,KD)=>{var Au0=kU(),vR=rB(),wu0=Z_(),vu0=eC(),Iu0=cB(),Lu0=_D(),Su0=vD(),ID=c(u=>new Su0().get(u.certType).generate(u.value),"serializeCert"),LD=c((u,e="")=>{let t=new Iu0(u);return new Lu0(e).recover(t)},"decrypt"),SD=c((u,e)=>new Au0(u,e).parse(),"parseJks"),Ku0=c((u,e)=>new vR(u,e).parse(),"parsePkcs12"),Ou0=c((u,e)=>{let t=new vR(u,e),r=t.parse();return t.toPem(r)},"pkcs12ToPem"),Nu0=c((u,e,t)=>(t===void 0&&(t=e),SD(u,e).reduce((i,s)=>{if(s instanceof vu0)return Object.assign({},i,{[s.alias]:{ca:ID(s.cert)}});if(s instanceof wu0)return Object.assign({},i,{[s.alias]:{cert:s.chain.map(ID).join(` +`),key:LD(s.protectedPrivateKey,t)}})},{})),"jksToPem"),Uu0=c(function(u,e,t){return vR.probe(u)?Ou0(u,e,t):Nu0(u,e,t)},"toPem");KD.exports={toPem:Uu0,parseJks:SD,decrypt:LD,parsePkcs12:Ku0}});var PD=w((rd0,UD)=>{"use strict";var mg=fy(),Pu0=LN(),of=require("fs"),{createTableOptionsFromMeta:ku0}=PN(),{getEntityLevelConfig:Bu0}=DN(),IR=HN(),ND=xU(),Du0=bU(),at={client:null,isSshTunnel:null},Fu0=["solr_query"];UD.exports=u=>{let e=c(S=>new Promise((B,D)=>S.require("java-ssl",(W,z)=>{W?D(W):B(z)})),"requireKeyStore"),t=c(S=>{let B=c(D=>D?of.readFileSync(D):"","readFile");try{let D=B(S.sslCaFile),W=B(S.sslCertFile),z=B(S.sslKeyFile);return Promise.resolve({ca:D,cert:W,key:z})}catch(D){return Promise.reject(D)}},"getCertificatesFromFiles"),r=c((S,B,D)=>e(B).then(W=>{try{let z=W(S.keystore,S.keystorepass),e0=(z.getCert(S.alias)||"").replace(/\s*-----END CERTIFICATE-----$/,` +-----END CERTIFICATE-----`),_0=z.getPrivateKey(S.alias),p0=e0;return D.log("info",{message:"[info] certificates successfully retrieved from keystore",certLength:e0.length,keyLength:_0.length,pemCertValidity:e0.startsWith(`-----BEGIN CERTIFICATE----- +MII`),pemKeyValidity:_0.startsWith(`-----BEGIN PRIVATE KEY----- +MII`),countOfCerts:(e0.match(/-----BEGIN CERTIFICATE-----/gi)||[]).length},"Keystore Info"),S.truststore&&(p0=(W(S.truststore,S.truststorePass||"").getCert(S.truststoreAlias||S.alias)||"").replace(/\s*-----END CERTIFICATE-----$/,` +-----END CERTIFICATE-----`),D.log("info",{message:"[info] certificates successfully retrieved from truststore",certLength:p0.length,pemCertValidity:p0.startsWith(`-----BEGIN CERTIFICATE----- +MII`),countOfCerts:(p0.match(/-----BEGIN CERTIFICATE-----/gi)||[]).length},"Keystore Info")),{cert:e0,key:_0,ca:p0,...i(S,D)}}catch(z){return z.message.includes("java.lang.NullPointerException")?Promise.reject({message:"Please, check the alias name of the provided JKS certificates. Error message: "+z.message,error:z.message,stack:z.stack}):Promise.reject(z)}}).catch(W=>{D.log("error",{message:W.message,stack:W.stack},"Initialization java-ssl failed");let z=i(S,D);return Object.keys(z).length===0?Promise.reject(W):z}),"getCertificatesFromKeystore"),i=c((S,B)=>{try{let D=OD(),W;of.existsSync(S.keystore)?(W=D.toPem(of.readFileSync(S.keystore),S.keystorepass),Object.keys(W).forEach(e0=>{B.log("info",{type:"keystore",certLength:u.get(W,`[${e0}].cert.length`),keyLength:u.get(W,`[${e0}].key.length`),countOfCerts:(u.get(W,`[${e0}].cert`,"").match(/-----BEGIN CERTIFICATE-----/gi)||[]).length,alias:e0},"jks analyze")})):B.log("info",`[info] keystore file not found ${S.keystore}`,"jks analyze");let z;return of.existsSync(S.truststore)?(z=D.toPem(of.readFileSync(S.truststore),S.truststorePass),Object.keys(z).forEach(e0=>{B.log("info",{type:"truststore",certLength:u.get(z,`[${e0}].ca.length`),countOfCerts:(u.get(z,`[${e0}].ca`,"").match(/-----BEGIN CERTIFICATE-----/gi)||[]).length,alias:e0},"jks analyze")})):B.log("info",`[info] truststore file not found ${S.truststore}`,"jks analyze"),{cert:u.get(W,`[${S.alias}].cert`),key:u.get(W,`[${S.alias}].key`),ca:u.get(z,`[${S.truststoreAlias||S.alias}].ca`)||u.get(W,`[${S.alias}].cert`)}}catch(D){return B.log("info",`[info] issue with jks-js. Message: ${D.message}`,"jks analyze"),{}}},"analyzeJks"),s=c(S=>S&&S!=="false","isSsl"),a=c((S,B,D)=>{let W=c((_0,p0,w0)=>p0?Object.assign({},w0,{[_0]:p0}):w0,"add");if(!s(S.ssl))return Promise.resolve({});let z=u.get(S,"hosts[0].host",""),e0;return S.ssl==="jks"?e0=r(S,B,D):e0=t(S),e0.then(_0=>({sslOptions:u.flow([W.bind(null,"ca",_0.ca),W.bind(null,"cert",_0.cert),W.bind(null,"key",_0.key),W.bind(null,"host",z)])({rejectUnauthorized:!S.disableStrictSsl,host:z})}))},"getSslOptions"),o=c((S,B)=>S.localDataCenter?{localDataCenter:S.localDataCenter,policies:{retry:new IR(B)}}:{policies:{loadBalancing:new mg.policies.loadBalancing.RoundRobinPolicy,retry:new IR(B)}},"getPolicy"),h=c((S,B)=>{let W=Number(S),z=Number(B),e0=isNaN(W)?z:W;return isNaN(e0)||e0<=0?6e4:e0},"validateRequestTimeout"),f=c((S,B,D)=>{if(!Array.isArray(B.hosts))throw new Error("Hosts were not defined");let W=B.authType==="tokenBased"?{username:"token",password:B.astraToken}:{username:B.user,password:B.password},z=new mg.auth.PlainTextAuthProvider(W.username,W.password),e0=B.hosts.map(p0=>`${p0.host}:${p0.port}`),_0=h(B.requestTimeout,B.queryRequestTimeout);return a(B,S,D).then(p0=>new mg.Client(Object.assign({contactPoints:e0,authProvider:z,socketOptions:{readTimeout:_0}},o(B,D),p0)))},"getDistributedClient"),d=c(S=>{let B=h(S.requestTimeout,S.queryRequestTimeout),D=S.authType==="tokenBased"?{username:"token",password:S.astraToken}:{username:S.user,password:S.password},W=new mg.Client(Object.assign({cloud:{secureConnectBundle:S.secureConnectBundle},credentials:D,socketOptions:{readTimeout:B}}));return Promise.resolve(W)},"getCloudClient"),p=c((S,B,D)=>B.clusterType==="apolloCloud"?d(B):f(S,B,D),"getClient"),E=c((S,B)=>async D=>{if(at.client)return at.client.connect();if(D.ssh){let W=S.require("@hackolade/ssh-service"),z=D.hosts[0],{options:e0}=await W.openTunnel({sshAuthMethod:D.ssh_method==="privateKey"?"IDENTITY_FILE":"USER_PASSWORD",sshTunnelHostname:D.ssh_host,sshTunnelPort:D.ssh_port,sshTunnelUsername:D.ssh_user,sshTunnelPassword:D.ssh_password,sshTunnelIdentityFile:D.ssh_key_file,sshTunnelPassphrase:D.ssh_key_passphrase,host:z.host,port:z.port});at.isSshTunnel=!0,D={...D,hosts:[e0]}}return at.client=await p(S,D,B),at.client.on("log",(W,z,e0,_0)=>{if(B){let p0="["+W+"] "+z+": "+e0+". "+_0;B.log("info",{message:p0},"Cassandra Info")}}),at.client.connect()},"connect"),x=c(async S=>{at.client&&(at.client.shutdown(),at.client=null),at.isSshTunnel&&(await S.require("@hackolade/ssh-service").closeConsumer(),at.isSshTunnel=!1)},"close"),g=c(S=>at.client.metadata.keyspaces[S],"getKeyspaceMetaData"),m=c(S=>{let B=g(S),D=u.get(B,"strategy","").split(".").slice(-1).pop(),W={code:S,durableWrites:!!B.durableWrites,replStrategy:D};return D==="SimpleStrategy"?W.replFactor=Number(B.strategyOptions.replication_factor):D==="NetworkTopologyStrategy"&&(W.dataCenters=Object.keys(B.strategyOptions).map(z=>({dataCenterName:z,replFactorValue:Number(B.strategyOptions[z])}))),W},"getKeyspaceInfo"),A=c(()=>Object.keys(at.client.metadata.keyspaces),"getKeyspacesNames"),T=c(()=>{let S=u.get(at,"client.hosts._items");if(!S)return!1;let B=S[Object.keys(S)[0]];if(!B)return!1;let D=B.getCassandraVersion();return D.length?u.get(D,"[0]")<3:!1},"isOldVersion"),I=c(S=>{let W=T()?`SELECT columnfamily_name FROM system.schema_columnfamilies WHERE keyspace_name ='${S}'`:`SELECT table_name FROM system_schema.tables WHERE keyspace_name ='${S}'`;return N(W)},"getTablesNames"),L=c(S=>{let B=`SELECT view_name FROM system_schema.views WHERE keyspace_name ='${S}'`;return N(B).then(D=>D.rows.map(W=>W.view_name),()=>[])},"getViewsNames"),N=c(S=>at.client.execute(S),"execute"),k=c((S,B)=>at.client.metadata.getTable(S,B),"getTableMetadata"),M=c((S,B,D,W)=>Promise.all(D.map(z=>at.client.metadata.getMaterializedView(B,z).then(e0=>X(S,B,z,W).then(_0=>({documentTemplate:_0,view:e0})),()=>({documentTemplate:{},view:{}})))),"getViews"),X=c((S,B,D,W)=>V(B,D,S,W).then(r9,()=>({})),"getViewDocumentTemplate"),u0=c(async(S,B)=>{try{let D=await N(`select resource_name, resource_value from solr_admin.solr_resources where resource_name IN ('schema.xml', 'solrconfig.xml') AND core_name = '${S}.${B}';`);if(!D.rows.length)return{};let W={"schema.xml":"schema","solrconfig.xml":"config"};return D.rows.reduce((z,e0)=>({...z,[W[e0.resource_name]]:e0.resource_value.toString()}),{})}catch{return{}}},"describeSearchIndexes"),h0=c(S=>{let B=u.partition(S,_H);return{views:B[0].map(D=>D.slice(0,-4)),tables:B[1]}},"splitEntityNames"),i0=c((S,B)=>{let D=`SELECT * FROM system_schema.columns WHERE keyspace_name='${S}' AND table_name='${B}';`;return N(D)},"getColumnInfo"),H=c((S,B,D)=>({dbName:S,dbCollections:B,views:D}),"prepareConnectionDataItem"),L0=c((S,B,D={})=>{let W={};return S.filter(z=>!u.includes(Fu0,z.name)).forEach(z=>{let e0=Pu0(u).getColumnType(z,B,D?D[z.name]:void 0);W[z.name]=e0,W[z.name].code=z.name,W[z.name].static=z.isStatic,W[z.name].frozen=z.type.options.frozen}),{properties:W}},"getTableSchema"),V=c((S,B,D,W)=>v(S,B,D).then(z=>new Promise((e0,_0)=>{let p0=[];if(W.log("info",{table:`${S}.${B}`,limit:z},"Scan records"),!z)return e0(p0);let w0={prepare:!0,autoPage:!0,retry:new IR(W)},Te=`SELECT * FROM "${S}"."${B}" LIMIT ${z}`;at.client.eachRow(Te,[],w0,function(Z0,pt){p0.push(pt)},(Z0,pt)=>Z0?_0(Z0):e0(p0))})),"scanRecords"),v=c((S,B,D)=>{if(D.active==="absolute")return Promise.resolve(Number(D.absolute.value));let W=CH(D),z=`SELECT COUNT(*) FROM "${S}"."${B}" LIMIT ${W}`;return N(z).then(e0=>{let _0=u.get(e0,"rows[0].count.low",D.maxValue);return mH(_0,D)})},"getSizeOfRows"),$=c((S,B,D)=>{let W=oe(S.partitionKeys),z=U0(S);return{...z0(S.indexes,D),code:B,compositePartitionKey:W,compositeClusteringKey:z,comments:S.comment,tableOptions:r0(S)}},"getEntityLevelData"),d0=c(S=>S.structure.find(D=>D.propertyName==="Options").structure,"getOptionsFromTab"),r0=c(S=>{let[B]=Bu0(),D=d0(B);return ku0(S,D)},"getTableOptions"),W0=c(S=>{switch(S){case"DESC":return"descending";case"ASC":default:return"ascending"}},"getKeyOrder"),oe=c(S=>(S||[]).map(B=>B.name),"handlePartitionKeys"),U0=c(S=>(S.clusteringKeys||[]).map((B,D)=>{let W=S.clusteringOrder?S.clusteringOrder[D]:"";return{name:B.name,type:W0(W)}}),"handleClusteringKeys"),z0=c((S,B)=>({SecIndxs:P0(S),...te(B)}),"handleIndexes"),P0=c(S=>S.filter(B=>!(B.options&&B.options.class_name==="com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex")).map(B=>{let D=B.isCustomKind()?"custom":"secondary",W={};return B.options&&D==="custom"&&(W.case_sensitive=B.options.case_sensitive==="true",W.normalize=B.options.normalize==="true",W.ascii=B.options.ascii==="true",W.similarity_function=B.options.similarity_function||""),{name:B.name,SecIndxKey:[Ke(B.target)],customOptions:W,indexType:D}}),"getGeneralIndexes"),O0=c(S=>{let B={},D=u.get(S,"updateHandler.autoSoftCommit.maxTime"),W=u.get(S,"requestHandler",[]).find(_0=>_0.lst&&_0.lst["@_name"]==="defaults"),z=u.get(S,"query.filterCache"),e0=u.get(S,"indexConfig.mergeScheduler.int",[]).reduce((_0,p0)=>({..._0,[p0["@_name"]]:p0["#text"]}),{});return B.realtime=u.get(S,"indexConfig.rt",!1),B.directoryFactoryClass=u.get(S,"directoryFactory.@_class"),B.directoryFactory="",B.directoryFactoryClass==="solr.EncryptedFSDirectoryFactory"&&(B.directoryFactory="encrypted",B.directoryFactoryClass=""),B.directoryFactoryClass==="solr.StandardDirectoryFactory"&&(B.directoryFactory="standard",B.directoryFactoryClass=""),D&&(B.autoCommitTime=D),W&&(B.defaultQueryField=W.lst.str["#text"]),z&&(B.filterCacheLowWaterMark=z["@_lowWaterMarkMB"],B.filterCacheHighWaterMark=z["@_highWaterMarkMB"]),u.isEmpty(e0)||(e0.maxThreadCount&&(B.mergeMaxThreadCount=e0.maxThreadCount),e0.maxMergeCount&&(B.mergeMaxMergeCount=e0.maxMergeCount)),B},"getSearchIndexConfig"),$0=c(S=>Array.isArray(S)?S:[S],"transformObjectToArray"),k0=c(S=>{let B=$0(S.fields.field),D=$0(S.types.fieldType),W=(S.uniqueKey||"").replace(/^\(|\)$/g,"").split(","),z=B.filter(Z0=>Z0["@_name"]!=="_partitionKey"),e0=z.some(Z0=>!W.includes(Z0["@_name"])&&Z0["@_type"]==="StrField"),_0=D.some(Z0=>Z0["@_precisionStep"]===0),p0=z.some(Z0=>W.includes(Z0["@_name"])&&Z0["@_type"]==="StrField"),w0=D.some(Z0=>Z0["@_name"]==="StrField"),Te={spaceSavingSlowTriePrecision:_0,spaceSavingNoJoin:B.length!==z.length,spaceSavingNoTextfield:e0||!p0&&w0};return Object.entries(Te).filter(([Z0,pt])=>pt).map(([Z0])=>Z0)},"getSearchIndexProfile"),te=c(S=>{if(u.isEmpty(S))return{};let B=ND.parse(S.schema,{parseAttributeValue:!0,ignoreAttributes:!1}).schema,D=ND.parse(S.config,{parseAttributeValue:!0,ignoreAttributes:!1}).config,z=$0(B.fields.field).filter(p0=>p0["@_name"]!==B.uniqueKey&&p0["@_name"]!=="_partitionKey").map(p0=>{var w0;return{key:[p0["@_name"]],indexed:!!p0["@_indexed"],docValues:!!p0["@_docValues"],lowerCase:(w0=p0["@_type"])==null?void 0:w0.startsWith("LowerCase")}}),e0=O0(D),_0=k0(B);return{searchIndex:!0,searchIndexColumns:z,searchIndexConfig:e0,searchIndexProfiles:_0}},"getSearchIndex"),Ke=c(S=>{let B=/^values\(([\s\S]+)\)$/i,D=/^entries\(([\s\S]+)\)$/i,W=/^keys\(([\s\S]+)\)$/i,z="",e0=S;return B.test(S)&&(z="values",e0=S.match(B)[1]),D.test(S)&&(z="entries",e0=S.match(D)[1]),W.test(S)&&(z="keys",e0=S.match(W)[1]),{type:z,name:e0}},"getIndexKey"),Ye=c(S=>{if(S&&S.length){let B={},D=[];return S.forEach(({udt:W,sample:z})=>{let e0=u.get(W,"type.info",u.get(W,"info"),{}),_0=e0.name||W.name,p0=e0.fields||[];B[_0]={type:"udt",static:W.isStatic,properties:L0(p0,D,z).properties}}),{...B,...Ye(D)||{}}}else return null},"handleUdts"),It=c(S=>{let B=`SELECT * FROM system_schema.types WHERE keyspace_name='${S}'`;return N(B)},"getUDT"),ct=c(S=>{let B=`SELECT * FROM system_schema.functions WHERE keyspace_name='${S}'`;return N(B)},"getUDF"),lt=c(S=>{let B=`SELECT * FROM system_schema.aggregates WHERE keyspace_name='${S}'`;return N(B)},"getUDA"),Ve=c(S=>S.replace(/frozen\<(.*)\>/i,"$1"),"removeFrozen"),ht=c(S=>S.rows.map(D=>{let W=D.argument_names.map((p0,w0)=>`${p0} ${Ve(D.argument_types[w0]||"")}`).join(", "),z=D.deterministic?"DETERMINISTIC":"",e0=D.monotonic?"MONOTONIC ON"+D.monotonic_on.join(", "):"",_0=`CREATE OR REPLACE FUNCTION ${D.function_name} ( ${W} ) + ${D.called_on_null_input?"CALLED":"RETURNS NULL"} ON NULL INPUT + RETURNS ${Ve(D.return_type)} ${z} ${e0} + LANGUAGE ${D.language} AS + $$ ${D.body} $$ ;`;return{name:D.function_name,functionBody:_0}}),"handleUDF"),ft=c(S=>S.rows.map(D=>{let W=D.argument_types.map(Ve).join(", "),z=`CREATE OR REPLACE AGGREGATE ${D.aggregate_name} (${W}) + SFUNC ${D.state_func} + STYPE ${Ve(D.state_type)}`+(D.final_func!==null?` + FINALFUNC ${D.final_func}`:"")+` + INITCOND ${D.initcond}${D.deterministic?` + DETERMINISTIC`:""};`;return{name:D.aggregate_name,storedProcFunction:z}}),"handleUDA"),dt=c((S,B,D)=>S.filter(W=>u.get(W,"view.tableName")===B).map(W=>{let z=u.get(W,"view",{}),e0=Object.keys(u.get(W,"documentTemplate",{}));return{name:z.name,jsonSchema:dH(z,D),documentTemplate:e0,data:{compositePartitionKey:oe(z.partitionKeys),compositeClusteringKey:U0(z),comments:z.comment,tableOptions:r0(z)}}}),"getViewsData"),dH=c((S,B)=>{if(u.isEmpty(u.get(S,"columns")))return{};let D=Object.keys(S.columnsByName);return{properties:pH(B,S.tableName,D)}},"getViewData"),pH=c((S,B,D)=>D.reduce((W,z)=>u.get(S,["properties",z])?Object.assign({},W,{[z]:{$ref:`#collection/definitions/${B}/${z}`}}):W,{}),"getViewSchema"),yH=c((S,B)=>{var W,z;let D={dbName:S.keyspaceName,collectionName:S.tableName,documents:S.records};if((z=(W=S==null?void 0:S.table)==null?void 0:W.columns)!=null&&z.length){D.bucketInfo=m(S.keyspaceName),D.bucketInfo.UDFs=S.UDFs,D.bucketInfo.UDAs=S.UDAs,D.entityLevel=$(S.table,S.tableName,S.searchIndex);let e0=[],_0=r9(S.records),p0=L0(S.table.columns,e0,_0);D.validation={jsonSchema:p0},D.documentTemplate=_0,D.modelDefinitions={definitions:Ye(e0)},u.isEmpty(S.views)||(D.views=dt(S.views,S.tableName,p0)),D={...D,documents:Du0(u).filterUdts(p0.properties,S.records)}}else B||(D=null);return D},"getPackageData"),r9=c(S=>{let B=c((w0,Te)=>w0.reduce((Z0,pt)=>Te(pt)?[Z0[0].concat([pt]),Z0[1]]:[Z0[0],Z0[1].concat([pt])],[[],[]]),"split"),D=c(w0=>{let Te={};return w0.reduce((Z0,pt)=>Te[typeof pt]?Z0:(Te[typeof pt]=!0,Z0.concat([pt])),[])},"uniqByType"),W=c(w0=>{let[Te,Z0]=B(w0,Array.isArray),[pt,RH]=B(Z0,z),AH=D(RH),s9=pt.reduce(p0,{}),n9=AH.concat(Te.reduce(p0,[]));return Object.keys(s9).length?n9.concat([s9]):n9},"mergeByType"),z=c(w0=>w0&&typeof w0=="object"&&!Array.isArray(w0),"isObject"),e0=c((w0,Te)=>{let Z0=w0.concat(Te);return Z0.length?W(Z0):[]},"mergeArray"),_0=c((w0,Te)=>Object.keys(w0).concat(Object.keys(Te)).reduce((Z0,pt)=>Object.assign({},Z0,{[pt]:p0(w0[pt],Te[pt])}),{}),"mergeObjects"),p0=c((w0,Te)=>{if(Array.isArray(w0)&&Array.isArray(Te))return e0(w0,Te);if(z(w0)&&z(Te))return _0(w0,Te);if(Array.isArray(w0))return p0(w0,[]);if(Array.isArray(Te))return p0([],Te);if(z(w0))return p0(w0,{});if(z(Te))return p0({},Te);if(w0!==void 0)return w0;if(Te!==void 0)return Te},"merge");if(!Array.isArray(S)||!S.length)return{};try{return JSON.parse(JSON.stringify(S)).reduce(p0,{})}catch{return{}}},"mergeDocuments"),gH=c(S=>S instanceof Error?{message:S.message,stack:S.stack}:S,"prepareError"),EH=c((S,B)=>u.difference(S,B||[]),"filterKeyspaces"),mH=c((S,B)=>{let D=Math.ceil(S*B.relative.value/100);return Math.min(D,B.maxValue)},"getSampleDocSize"),xH=c(S=>S.replace(/\/\*([\s\S]+?)\*\//,""),"cleanOutComments"),TH=c(S=>{let B=c(e0=>(e0.match(/\$\$([\s\S]+?)\$\$/g)||[]).map(_0=>_0.trim().replace(/(^\$\$|\$\$$)/g,"")),"findFunctionStatements"),D=c(e0=>`$__HACKOLADE__PLACEHOLDER_${e0}__$`,"getPlaceholder");S=xH(S);let W=B(S),z=W.reduce((e0,_0,p0)=>e0.replace(_0,D(p0)),S).split(";").map(e0=>e0.trim()).filter(Boolean);return W.reduce((e0,_0,p0)=>e0.map(w0=>w0.replace(D(p0),_0)),z)},"splitScriptByQueries"),bH=c((S,B)=>{let D=TH(S),W=D.length,z=0;return i9(D.map(e0=>()=>at.client.execute(e0)),e0=>{let _0=D[z];B(_0,e0,z,W),z++}).then(e0=>e0,e0=>Promise.reject({error:e0,query:D[z]}))},"batch"),i9=c((S,B)=>S.length?S[0]().then(D=>(B(D),i9(S.slice(1),B))):Promise.resolve(),"promiseSeriesAll"),_H=c(S=>S.slice(-4)===" (v)","isView"),sE=c(S=>{if(S!==null)return Array.isArray(S)?S.map(sE).filter(B=>B!==void 0):typeof S=="object"?Object.keys(S).reduce((B,D)=>{let W=sE(S[D]);return W===void 0?B:{...B,[D]:W}},{}):S},"filterNullItems"),CH=c(S=>{let B=S.relative.value,D=S.maxValue;return Math.round(D/B*100)},"getCountLimit");return{connect:E,close:x,getKeyspacesNames:A,getTablesNames:I,prepareConnectionDataItem:H,getColumnInfo:i0,getTableMetadata:k,getTableSchema:L0,scanRecords:V,getEntityLevelData:$,getKeyspaceMetaData:g,getKeyspaceInfo:m,handleUdts:Ye,getUDF:ct,getUDA:lt,handleUDF:ht,handleUDA:ft,getPackageData:yH,prepareError:gH,filterKeyspaces:EH,batch:bH,isOldVersion:T,getViews:M,getViewsNames:L,splitEntityNames:h0,filterNullItems:sE,describeSearchIndexes:u0}}});var kD=w((sd0,Mu0)=>{Mu0.exports={name:"Datastax",description:"custom attributes to drive application behavior",systemKeyspaces:["cfs","cfs_archive","dse_leases","dse_perf","dse_security","dse_system","dsefs","HiveMetaStore","OpsCenter","solr_admin","spark_system","system","system_auth","system_distributed","system_schema","system_traces","system_views","system_virtual_schema"],type:"multi",installed:!0}});var BD=w((nd0,Hu0)=>{Hu0.exports={name:"Cassandra",version:"0.2.1",author:"hackolade",engines:{hackolade:"5.4.7",hackoladePlugin:"1.2.0"},contributes:{target:{applicationTarget:"CASSANDRA",title:"Cassandra Datastax",versions:["2.x","3.x","4.x","5.x","DSE 4.x","DSE 5.x","DSE 6.x","Astra DB"]},features:{views:!0,nestedCollections:!1,disablePatternField:!0,enableForwardEngineering:!0,disableMultipleTypes:!0,enableReverseEngineering:!0,disableChoices:!0,enableJsonType:!0,FEScriptCommentsSupported:!0,relationships:{compositeRelationships:{allowRelationshipsForNonPrimaryKey:!0}}}},description:"Hackolade plugin for Cassandra Datastax",dependencies:{antlr4:"4.8.0","cassandra-driver":"4.7.2","fast-xml-parser":"4.4.0","jks-js":"1.1.3",lodash:"4.17.21","tunnel-ssh":"github:hackolade/tunnel-ssh"},"lint-staged":{"*.{js,json}":"prettier --write"},"simple-git-hooks":{"pre-commit":"npx lint-staged","pre-push":"npx eslint ."},scripts:{lint:"eslint . --max-warnings=0",package:"node esbuild.package.js"},devDependencies:{"@hackolade/hck-esbuild-plugins-pack":"0.0.1","@typescript-eslint/eslint-plugin":"7.11.0","@typescript-eslint/parser":"7.11.0",esbuild:"0.20.2","esbuild-plugin-clean":"1.0.1",eslint:"8.57.0","eslint-config-prettier":"9.1.0","eslint-formatter-teamcity":"^1.0.0","eslint-plugin-import":"^2.26.0","eslint-plugin-prettier":"5.1.3","eslint-plugin-unused-imports":"3.2.0","lint-staged":"14.0.1",prettier:"3.2.5","simple-git-hooks":"2.11.1"},overrides:{"tunnel-ssh":{"cpu-features":"npm:-@0.0.1",ssh2:"npm:-@0.0.1"}}}});var FD=w((ad0,DD)=>{"use strict";var zi=require("os"),qu0=require("net"),Vu0=BD(),Gu0=c((u,e,t=5e3)=>new Promise((r,i)=>{let s=setTimeout(()=>{a.end(),i(new Error("Connection takes more than 5000 ms"))},t),a=qu0.createConnection(e,u,()=>{a.end(),clearTimeout(s),r()});a.on("error",o=>{clearTimeout(s),i(o)})}),"checkConnection"),Wu0=c(()=>Vu0.version,"getPluginVersion"),zu0=c(u=>`Date: ${new Date} +Application version: ${u} +Plugin version: ${Wu0()} + +System information: + Hostname: ${zi.hostname()} + Platform: ${zi.platform()} ${zi.arch()} + Release: ${zi.release()} + Uptime: ${ju0(zi.uptime())} + Total RAM: ${(zi.totalmem()/1073741824).toFixed(2)} GB + CPU Model: ${zi.cpus()[0].model} + CPU Clock: ${Yu0(zi.cpus())} MHZ + CPU Cores: ${zi.cpus().length} cores + +`,"getSystemInfo"),Yu0=c(u=>u.reduce((e,t)=>Math.max(e,t.speed),0),"maxClock"),Qu0=c(u=>u<10?"0"+u:u,"prefixZero"),ju0=c(u=>Math.floor(u/3600)+":"+Qu0(parseInt((u/3600-Math.floor(u/3600))*60)),"toTime"),$u0={getSystemInfo:zu0,checkConnection:Gu0};DD.exports=$u0});var VD=w((cd0,qD)=>{"use strict";var Zu0=c((u,e,t)=>{let r=u.findIndex(i=>xg(i.bucketName,e)&&xg(i.collectionName,t));return r!==-1?r:u.findIndex(i=>i.collectionName===t)},"findEntityIndex"),MD=c((u,e)=>u[e]?e:Object.keys(u).find(t=>xg(t,e)),"getCaseInsensitiveKey"),Xu0=c((u,e)=>{let t={...u};return delete t[MD(u,e)],t},"omitCaseInsensitive"),xg=c((u,e)=>(u||"").toLowerCase()===(e||"").toLowerCase(),"isEqualCaseInsensitive"),Ju0=c((u,e)=>[...u.slice(0,e),...u.slice(e+1)],"remove"),er0=c((u,e,t)=>[...u.slice(0,e),t,...u.slice(e+1)],"set"),HD=c((u,e)=>!LR(u)||!LR(e)?e||u:Object.keys(e).reduce((t,r)=>{let i=LR(e[r])?HD(t[r]||{},e[r]):e[r];return{...t,[r]:i}},u),"merge"),tr0=c((u,e)=>e.bucketName||u.currentBucket,"getCurrentBucket"),LR=c(u=>u&&typeof u=="object"&&!Array.isArray(u),"isObject");qD.exports={findEntityIndex:Zu0,getCaseInsensitiveKey:MD,omitCaseInsensitive:Xu0,isEqualCaseInsensitive:xg,remove:Ju0,set:er0,merge:HD,getCurrentBucket:tr0}});var KR=w((hd0,nF)=>{"use strict";var ie=VD(),GD="createCollection",WD="removeCollection",zD="createBucket",YD="removeBucket",QD="updateBucket",jD="useBucket",$D="createDefinition",ZD="addFieldsToCollection",XD="renameField",JD="createView",eF="addBucketData",tF="addCollectionLevelIndex",uF="addCollectionLevelSearchIndex",rF="updateEntityLevelData",iF="updateViewLevelData",sF="addFieldsToDefinition",SR="New Keyspace",ur0={entities:[],views:[],currentBucket:SR,buckets:{},definitions:{}},rr0=c(u=>u.reduce((e,t)=>{let r=t&&t.type,i=br0[r];return i?i(e,t):e},ur0),"convertCommandsToEntities"),ir0=c(u=>{let{entities:e,views:t,definitions:r,buckets:i}=rr0(u);return e.map(s=>{let a=t.filter(o=>o.collectionName.toLowerCase()===s.collectionName.toLowerCase());return{objectNames:{collectionName:s.collectionName},doc:{dbName:s.bucketName,collectionName:s.collectionName,modelDefinitions:{definitions:r},bucketInfo:i[s.bucketName]||{},entityLevel:s.entityLevelData,views:a.map(o=>({name:o.name,jsonSchema:o.jsonSchema,data:o.data}))},jsonSchema:s.schema}})},"convertCommandsToReDocs"),sr0=c((u,e)=>{let{entities:t,currentBucket:r}=u,i=ie.getCurrentBucket(u,e);return e.bucketName?r===SR?{...u,entities:[...t,e],bucketName:e.bucketName}:{...u,entities:[...t,e]}:{...u,entities:[...t,{...e,bucketName:i}]}},"createCollection"),nr0=c((u,e)=>{let{entities:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.collectionName);return i===-1?u:{...u,entities:ie.remove(t,i)}},"removeCollection"),ar0=c((u,e)=>{let{buckets:t}=u,r=e.name;return{...u,currentBucket:r,buckets:{...t,[r]:e.data||{}}}},"createBucket"),or0=c((u,e)=>{let{buckets:t}=u,r=ie.getCaseInsensitiveKey(t,e.name),i=u[r];return i?{...u,currentBucket:r,buckets:{...t,[r]:{...i,...e.data||{}}}}:u},"updateBucket"),cr0=c((u,e)=>{let{buckets:t,entities:r}=u,i=e.name;return{currentBucket:SR,buckets:ie.omitCaseInsensitive(t,i),entities:r.filter(s=>!ie.isEqualCaseInsensitive(s.bucketName,i))}},"removeBucket"),lr0=c((u,e)=>({...u,currentBucket:e.bucketName}),"useBucket"),hr0=c((u,e)=>{let{definitions:t}=u;return{...u,definitions:{...t,[e.name]:{type:"udt",properties:e.properties}}}},"createDefinition"),fr0=c((u,e)=>{let{definitions:t}=u,r=ie.getCaseInsensitiveKey(t,e.name),i=t[r];return i?{...u,definitions:{...t,[r]:{...i,properties:{...i.properties,...e.data}}}}:u},"addFieldsToDefinition"),dr0=c((u,e)=>{let{entities:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.collectionName);if(i===-1)return u;let s=t[i];return{...u,entities:ie.set(t,i,{...s,schema:{...s.schema,properties:{...s.schema.properties,...e.data}}})}},"addFieldsToCollection"),pr0=c((u,e)=>{let{entities:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.collectionName);if(i===-1)return u;let s=t[i];return{...u,entities:ie.set(t,i,{...s,entityLevelData:ie.merge(s.entityLevelData,e.data)})}},"updateEntityLevelData"),yr0=c((u,e)=>{let{views:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.name),s=t[i];return{...u,views:ie.set(t,i,{...s,data:ie.merge(s.data,e.data)})}},"updateViewLevelData"),gr0=c((u,e)=>{let{entities:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.collectionName);if(i===-1)return u;let s=t[i],a=s.entityLevelData||{},o=[...a.SecIndxs||[],{name:e.name,SecIndxKey:[{name:e.column,type:e.columnType}],indexType:e.indexType,customOptions:e.customOptions,indexIfNotExist:e.indexIfNotExist,isSASI:e.isSASI}];return{...u,entities:ie.set(t,i,{...s,entityLevelData:{...a,SecIndxs:o}})}},"addIndexToCollection"),Er0=c((u,e)=>{let t={...e},{entities:r}=u,i=ie.getCurrentBucket(u,e),s=ie.findEntityIndex(r,i,e.collectionName);if(s===-1)return u;let a=r[s],o=a.entityLevelData||{};if(t.searchIndexColumns.length===1&&t.searchIndexColumns[0].key[0]==="*"){let h=t.searchIndexColumns[0],d=Object.keys(a.schema.properties).map(p=>({...h,key:[p]}));t={...t,searchIndexColumns:d}}return{...u,entities:ie.set(r,s,{...a,entityLevelData:{...o,...t}})}},"addSearchIndexToCollection"),mr0=c((u,e)=>{let{entities:t}=u,r=ie.getCurrentBucket(u,e),i=ie.findEntityIndex(t,r,e.collectionName);if(i===-1)return u;let s=t[i],a=s[e.nameFrom];return{...u,entities:ie.set(t,i,{...s,schema:{...s.schema,properties:{...ie.omitCaseInsensitive(s.schema.properties,e.nameFrom),[e.nameTo]:a}}})}},"renameField"),xr0=c((u,e)=>{let{views:t}=u,r=ie.getCurrentBucket(u,e);return{...u,views:[...t,{...e,bucketName:r}]}},"createView"),Tr0=c((u,e)=>{let{buckets:t}=u,r=ie.getCurrentBucket(u,e),i=ie.getCaseInsensitiveKey(t,r),{key:s,data:a}=e;return{...u,buckets:{...t,[i]:{...t[i],[s]:[...t[i][s]||[],a]}}}},"addDataToBucket"),br0={[GD]:sr0,[WD]:nr0,[zD]:ar0,[QD]:or0,[YD]:cr0,[jD]:lr0,[$D]:hr0,[ZD]:dr0,[rF]:pr0,[iF]:yr0,[XD]:mr0,[JD]:xr0,[eF]:Tr0,[tF]:gr0,[uF]:Er0,[sF]:fr0};nF.exports={convertCommandsToReDocs:ir0,CREATE_COLLECTION_COMMAND:GD,REMOVE_COLLECTION_COMMAND:WD,CREATE_BUCKET_COMMAND:zD,REMOVE_BUCKET_COMMAND:YD,USE_BUCKET_COMMAND:jD,CREATE_DEFINITION_COMMAND:$D,ADD_FIELDS_TO_COLLECTION_COMMAND:ZD,RENAME_FIELD_COMMAND:XD,CREATE_VIEW_COMMAND:JD,ADD_BUCKET_DATA_COMMAND:eF,UPDATE_BUCKET_COMMAND:QD,ADD_COLLECTION_LEVEL_INDEX_COMMAND:tF,ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND:uF,UPDATE_ENTITY_LEVEL_DATA_COMMAND:rF,UPDATE_VIEW_LEVEL_DATA_COMMAND:iF,ADD_FIELDS_TO_DEFINITION_COMMAND:sF}});var Ie=w(Tr=>{function aF(u){return"["+u.join(", ")+"]"}c(aF,"arrayToString");String.prototype.seed=String.prototype.seed||Math.round(Math.random()*Math.pow(2,32));String.prototype.hashCode=function(){var u,e,t,r,i,s,a,o,h,f,d=this.toString();for(u=d.length&3,e=d.length-u,t=String.prototype.seed,i=3432918353,a=461845907,f=0;f>>16)*i&65535)<<16)&4294967295,h=h<<15|h>>>17,h=(h&65535)*a+(((h>>>16)*a&65535)<<16)&4294967295,t^=h,t=t<<13|t>>>19,r=(t&65535)*5+(((t>>>16)*5&65535)<<16)&4294967295,t=(r&65535)+27492+(((r>>>16)+58964&65535)<<16);switch(h=0,u){case 3:h^=(d.charCodeAt(f+2)&255)<<16;case 2:h^=(d.charCodeAt(f+1)&255)<<8;case 1:h^=d.charCodeAt(f)&255,h=(h&65535)*i+(((h>>>16)*i&65535)<<16)&4294967295,h=h<<15|h>>>17,h=(h&65535)*a+(((h>>>16)*a&65535)<<16)&4294967295,t^=h}return t^=d.length,t^=t>>>16,t=(t&65535)*2246822507+(((t>>>16)*2246822507&65535)<<16)&4294967295,t^=t>>>13,t=(t&65535)*3266489909+(((t>>>16)*3266489909&65535)<<16)&4294967295,t^=t>>>16,t>>>0};function oF(u,e){return u.equals(e)}c(oF,"standardEqualsFunction");function cF(u){return u.hashCode()}c(cF,"standardHashCodeFunction");function oa(u,e){return this.data={},this.hashFunction=u||cF,this.equalsFunction=e||oF,this}c(oa,"Set");Object.defineProperty(oa.prototype,"length",{get:function(){var u=0;for(var e in this.data)e.indexOf("hash_")===0&&(u=u+this.data[e].length);return u}});oa.prototype.add=function(u){var e=this.hashFunction(u),t="hash_"+e;if(t in this.data){for(var r=this.data[t],i=0;i>>17,t=t*461845907,this.count=this.count+1;var r=this.hash^t;r=r<<13|r>>>19,r=r*5+3864292196,this.hash=r}}};cf.prototype.finish=function(){var u=this.hash^this.count*4;return u=u^u>>>16,u=u*2246822507,u=u^u>>>13,u=u*3266489909,u=u^u>>>16,u};function _r0(){var u=new cf;return u.update.apply(u,arguments),u.finish()}c(_r0,"hashStuff");OR.prototype.get=function(u,e){var t=this.cacheMap.get(u)||null;return t===null?null:t.get(e)||null};OR.prototype.set=function(u,e,t){var r=this.cacheMap.get(u)||null;r===null&&(r=new this.defaultMapCtor,this.cacheMap.put(u,r)),r.put(e,t)};function Cr0(u,e){return u=u.replace(/\t/g,"\\t").replace(/\n/g,"\\n").replace(/\r/g,"\\r"),e&&(u=u.replace(/ /g,"\xB7")),u}c(Cr0,"escapeWhitespace");function Rr0(u){return u.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1)})}c(Rr0,"titleCase");function Ar0(u,e){if(!Array.isArray(u)||!Array.isArray(e))return!1;if(u==e)return!0;if(u.length!=e.length)return!1;for(var t=0;t{function Qu(){return this.source=null,this.type=null,this.channel=null,this.start=null,this.stop=null,this.tokenIndex=null,this.line=null,this.column=null,this._text=null,this}c(Qu,"Token");Qu.INVALID_TYPE=0;Qu.EPSILON=-2;Qu.MIN_USER_TOKEN_TYPE=1;Qu.EOF=-1;Qu.DEFAULT_CHANNEL=0;Qu.HIDDEN_CHANNEL=1;Object.defineProperty(Qu.prototype,"text",{get:function(){return this._text},set:function(u){this._text=u}});Qu.prototype.getTokenSource=function(){return this.source[0]};Qu.prototype.getInputStream=function(){return this.source[1]};function Ci(u,e,t,r,i){return Qu.call(this),this.source=u!==void 0?u:Ci.EMPTY_SOURCE,this.type=e!==void 0?e:null,this.channel=t!==void 0?t:Qu.DEFAULT_CHANNEL,this.start=r!==void 0?r:-1,this.stop=i!==void 0?i:-1,this.tokenIndex=-1,this.source[0]!==null?(this.line=u[0].line,this.column=u[0].column):this.column=-1,this}c(Ci,"CommonToken");Ci.prototype=Object.create(Qu.prototype);Ci.prototype.constructor=Ci;Ci.EMPTY_SOURCE=[null,null];Ci.prototype.clone=function(){var u=new Ci(this.source,this.type,this.channel,this.start,this.stop);return u.tokenIndex=this.tokenIndex,u.line=this.line,u.column=this.column,u.text=this.text,u};Object.defineProperty(Ci.prototype,"text",{get:function(){if(this._text!==null)return this._text;var u=this.getInputStream();if(u===null)return null;var e=u.size;return this.start"},set:function(u){this._text=u}});Ci.prototype.toString=function(){var u=this.text;return u!==null?u=u.replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t"):u="","[@"+this.tokenIndex+","+this.start+":"+this.stop+"='"+u+"',<"+this.type+">"+(this.channel>0?",channel="+this.channel:"")+","+this.line+":"+this.column+"]"};NR.Token=Qu;NR.CommonToken=Ci});var Vr=w($t=>{function T0(){return this.atn=null,this.stateNumber=T0.INVALID_STATE_NUMBER,this.stateType=null,this.ruleIndex=0,this.epsilonOnlyTransitions=!1,this.transitions=[],this.nextTokenWithinRule=null,this}c(T0,"ATNState");T0.INVALID_TYPE=0;T0.BASIC=1;T0.RULE_START=2;T0.BLOCK_START=3;T0.PLUS_BLOCK_START=4;T0.STAR_BLOCK_START=5;T0.TOKEN_START=6;T0.RULE_STOP=7;T0.BLOCK_END=8;T0.STAR_LOOP_BACK=9;T0.STAR_LOOP_ENTRY=10;T0.PLUS_LOOP_BACK=11;T0.LOOP_END=12;T0.serializationNames=["INVALID","BASIC","RULE_START","BLOCK_START","PLUS_BLOCK_START","STAR_BLOCK_START","TOKEN_START","RULE_STOP","BLOCK_END","STAR_LOOP_BACK","STAR_LOOP_ENTRY","PLUS_LOOP_BACK","LOOP_END"];T0.INVALID_STATE_NUMBER=-1;T0.prototype.toString=function(){return this.stateNumber};T0.prototype.equals=function(u){return u instanceof T0?this.stateNumber===u.stateNumber:!1};T0.prototype.isNonGreedyExitState=function(){return!1};T0.prototype.addTransition=function(u,e){e===void 0&&(e=-1),this.transitions.length===0?this.epsilonOnlyTransitions=u.isEpsilon:this.epsilonOnlyTransitions!==u.isEpsilon&&(this.epsilonOnlyTransitions=!1),e===-1?this.transitions.push(u):this.transitions.splice(e,1,u)};function bg(){return T0.call(this),this.stateType=T0.BASIC,this}c(bg,"BasicState");bg.prototype=Object.create(T0.prototype);bg.prototype.constructor=bg;function br(){return T0.call(this),this.decision=-1,this.nonGreedy=!1,this}c(br,"DecisionState");br.prototype=Object.create(T0.prototype);br.prototype.constructor=br;function Ri(){return br.call(this),this.endState=null,this}c(Ri,"BlockStartState");Ri.prototype=Object.create(br.prototype);Ri.prototype.constructor=Ri;function _g(){return Ri.call(this),this.stateType=T0.BLOCK_START,this}c(_g,"BasicBlockStartState");_g.prototype=Object.create(Ri.prototype);_g.prototype.constructor=_g;function Cg(){return T0.call(this),this.stateType=T0.BLOCK_END,this.startState=null,this}c(Cg,"BlockEndState");Cg.prototype=Object.create(T0.prototype);Cg.prototype.constructor=Cg;function Rg(){return T0.call(this),this.stateType=T0.RULE_STOP,this}c(Rg,"RuleStopState");Rg.prototype=Object.create(T0.prototype);Rg.prototype.constructor=Rg;function Ag(){return T0.call(this),this.stateType=T0.RULE_START,this.stopState=null,this.isPrecedenceRule=!1,this}c(Ag,"RuleStartState");Ag.prototype=Object.create(T0.prototype);Ag.prototype.constructor=Ag;function wg(){return br.call(this),this.stateType=T0.PLUS_LOOP_BACK,this}c(wg,"PlusLoopbackState");wg.prototype=Object.create(br.prototype);wg.prototype.constructor=wg;function vg(){return Ri.call(this),this.stateType=T0.PLUS_BLOCK_START,this.loopBackState=null,this}c(vg,"PlusBlockStartState");vg.prototype=Object.create(Ri.prototype);vg.prototype.constructor=vg;function Ig(){return Ri.call(this),this.stateType=T0.STAR_BLOCK_START,this}c(Ig,"StarBlockStartState");Ig.prototype=Object.create(Ri.prototype);Ig.prototype.constructor=Ig;function Lg(){return T0.call(this),this.stateType=T0.STAR_LOOP_BACK,this}c(Lg,"StarLoopbackState");Lg.prototype=Object.create(T0.prototype);Lg.prototype.constructor=Lg;function Sg(){return br.call(this),this.stateType=T0.STAR_LOOP_ENTRY,this.loopBackState=null,this.isPrecedenceDecision=null,this}c(Sg,"StarLoopEntryState");Sg.prototype=Object.create(br.prototype);Sg.prototype.constructor=Sg;function Kg(){return T0.call(this),this.stateType=T0.LOOP_END,this.loopBackState=null,this}c(Kg,"LoopEndState");Kg.prototype=Object.create(T0.prototype);Kg.prototype.constructor=Kg;function Og(){return br.call(this),this.stateType=T0.TOKEN_START,this}c(Og,"TokensStartState");Og.prototype=Object.create(br.prototype);Og.prototype.constructor=Og;$t.ATNState=T0;$t.BasicState=bg;$t.DecisionState=br;$t.BlockStartState=Ri;$t.BlockEndState=Cg;$t.LoopEndState=Kg;$t.RuleStartState=Ag;$t.RuleStopState=Rg;$t.TokensStartState=Og;$t.PlusLoopbackState=wg;$t.StarLoopbackState=Lg;$t.StarLoopEntryState=Sg;$t.PlusBlockStartState=vg;$t.StarBlockStartState=Ig;$t.BasicBlockStartState=_g});var ca=w(Ng=>{var lF=Ie().Set,wr0=Ie().Hash;function Ee(){return this}c(Ee,"SemanticContext");Ee.prototype.hashCode=function(){var u=new wr0;return this.updateHashCode(u),u.finish()};Ee.prototype.evaluate=function(u,e){};Ee.prototype.evalPrecedence=function(u,e){return this};Ee.andContext=function(u,e){if(u===null||u===Ee.NONE)return e;if(e===null||e===Ee.NONE)return u;var t=new _r(u,e);return t.opnds.length===1?t.opnds[0]:t};Ee.orContext=function(u,e){if(u===null)return e;if(e===null)return u;if(u===Ee.NONE||e===Ee.NONE)return Ee.NONE;var t=new Cr(u,e);return t.opnds.length===1?t.opnds[0]:t};function Ai(u,e,t){return Ee.call(this),this.ruleIndex=u===void 0?-1:u,this.predIndex=e===void 0?-1:e,this.isCtxDependent=t===void 0?!1:t,this}c(Ai,"Predicate");Ai.prototype=Object.create(Ee.prototype);Ai.prototype.constructor=Ai;Ee.NONE=new Ai;Ai.prototype.evaluate=function(u,e){var t=this.isCtxDependent?e:null;return u.sempred(t,this.ruleIndex,this.predIndex)};Ai.prototype.updateHashCode=function(u){u.update(this.ruleIndex,this.predIndex,this.isCtxDependent)};Ai.prototype.equals=function(u){return this===u?!0:u instanceof Ai?this.ruleIndex===u.ruleIndex&&this.predIndex===u.predIndex&&this.isCtxDependent===u.isCtxDependent:!1};Ai.prototype.toString=function(){return"{"+this.ruleIndex+":"+this.predIndex+"}?"};function xu(u){Ee.call(this),this.precedence=u===void 0?0:u}c(xu,"PrecedencePredicate");xu.prototype=Object.create(Ee.prototype);xu.prototype.constructor=xu;xu.prototype.evaluate=function(u,e){return u.precpred(e,this.precedence)};xu.prototype.evalPrecedence=function(u,e){return u.precpred(e,this.precedence)?Ee.NONE:null};xu.prototype.compareTo=function(u){return this.precedence-u.precedence};xu.prototype.updateHashCode=function(u){u.update(31)};xu.prototype.equals=function(u){return this===u?!0:u instanceof xu?this.precedence===u.precedence:!1};xu.prototype.toString=function(){return"{"+this.precedence+">=prec}?"};xu.filterPrecedencePredicates=function(u){var e=[];return u.values().map(function(t){t instanceof xu&&e.push(t)}),e};function _r(u,e){Ee.call(this);var t=new lF;u instanceof _r?u.opnds.map(function(s){t.add(s)}):t.add(u),e instanceof _r?e.opnds.map(function(s){t.add(s)}):t.add(e);var r=xu.filterPrecedencePredicates(t);if(r.length>0){var i=null;r.map(function(s){(i===null||s.precedence3?u.slice(3):u};function Cr(u,e){Ee.call(this);var t=new lF;u instanceof Cr?u.opnds.map(function(a){t.add(a)}):t.add(u),e instanceof Cr?e.opnds.map(function(a){t.add(a)}):t.add(e);var r=xu.filterPrecedencePredicates(t);if(r.length>0){var i=r.sort(function(a,o){return a.compareTo(o)}),s=i[i.length-1];t.add(s)}return this.opnds=t.values(),this}c(Cr,"OR");Cr.prototype=Object.create(Ee.prototype);Cr.prototype.constructor=Cr;Cr.prototype.constructor=function(u){return this===u?!0:u instanceof Cr?this.opnds===u.opnds:!1};Cr.prototype.updateHashCode=function(u){u.update(this.opnds,"OR")};Cr.prototype.evaluate=function(u,e){for(var t=0;t3?u.slice(3):u};Ng.SemanticContext=Ee;Ng.PrecedencePredicate=xu;Ng.Predicate=Ai});var lf=w(UR=>{var vr0=Vr().DecisionState,fF=ca().SemanticContext,dF=Ie().Hash;function hF(u,e){if(u===null){var t={state:null,alt:null,context:null,semanticContext:null};return e&&(t.reachesIntoOuterContext=0),t}else{var r={};return r.state=u.state||null,r.alt=u.alt===void 0?null:u.alt,r.context=u.context||null,r.semanticContext=u.semanticContext||null,e&&(r.reachesIntoOuterContext=u.reachesIntoOuterContext||0,r.precedenceFilterSuppressed=u.precedenceFilterSuppressed||!1),r}}c(hF,"checkParams");function ju(u,e){return this.checkContext(u,e),u=hF(u),e=hF(e,!0),this.state=u.state!==null?u.state:e.state,this.alt=u.alt!==null?u.alt:e.alt,this.context=u.context!==null?u.context:e.context,this.semanticContext=u.semanticContext!==null?u.semanticContext:e.semanticContext!==null?e.semanticContext:fF.NONE,this.reachesIntoOuterContext=e.reachesIntoOuterContext,this.precedenceFilterSuppressed=e.precedenceFilterSuppressed,this}c(ju,"ATNConfig");ju.prototype.checkContext=function(u,e){(u.context===null||u.context===void 0)&&(e===null||e.context===null||e.context===void 0)&&(this.context=null)};ju.prototype.hashCode=function(){var u=new dF;return this.updateHashCode(u),u.finish()};ju.prototype.updateHashCode=function(u){u.update(this.state.stateNumber,this.alt,this.context,this.semanticContext)};ju.prototype.equals=function(u){return this===u?!0:u instanceof ju?this.state.stateNumber===u.state.stateNumber&&this.alt===u.alt&&(this.context===null?u.context===null:this.context.equals(u.context))&&this.semanticContext.equals(u.semanticContext)&&this.precedenceFilterSuppressed===u.precedenceFilterSuppressed:!1};ju.prototype.hashCodeForConfigSet=function(){var u=new dF;return u.update(this.state.stateNumber,this.alt,this.semanticContext),u.finish()};ju.prototype.equalsForConfigSet=function(u){return this===u?!0:u instanceof ju?this.state.stateNumber===u.state.stateNumber&&this.alt===u.alt&&this.semanticContext.equals(u.semanticContext):!1};ju.prototype.toString=function(){return"("+this.state+","+this.alt+(this.context!==null?",["+this.context.toString()+"]":"")+(this.semanticContext!==fF.NONE?","+this.semanticContext.toString():"")+(this.reachesIntoOuterContext>0?",up="+this.reachesIntoOuterContext:"")+")"};function Rr(u,e){ju.call(this,u,e);var t=u.lexerActionExecutor||null;return this.lexerActionExecutor=t||(e!==null?e.lexerActionExecutor:null),this.passedThroughNonGreedyDecision=e!==null?this.checkNonGreedyDecision(e,this.state):!1,this}c(Rr,"LexerATNConfig");Rr.prototype=Object.create(ju.prototype);Rr.prototype.constructor=Rr;Rr.prototype.updateHashCode=function(u){u.update(this.state.stateNumber,this.alt,this.context,this.semanticContext,this.passedThroughNonGreedyDecision,this.lexerActionExecutor)};Rr.prototype.equals=function(u){return this===u||u instanceof Rr&&this.passedThroughNonGreedyDecision==u.passedThroughNonGreedyDecision&&(this.lexerActionExecutor?this.lexerActionExecutor.equals(u.lexerActionExecutor):!u.lexerActionExecutor)&&ju.prototype.equals.call(this,u)};Rr.prototype.hashCodeForConfigSet=Rr.prototype.hashCode;Rr.prototype.equalsForConfigSet=Rr.prototype.equals;Rr.prototype.checkNonGreedyDecision=function(u,e){return u.passedThroughNonGreedyDecision||e instanceof vr0&&e.nonGreedy};UR.ATNConfig=ju;UR.LexerATNConfig=Rr});var Zt=w(PR=>{var hf=Ze().Token;function Mt(u,e){return this.start=u,this.stop=e,this}c(Mt,"Interval");Mt.prototype.contains=function(u){return u>=this.start&&u=t.stop?(this.intervals.pop(u+1),this.reduce(u)):e.stop>=t.start&&(this.intervals[u]=new Mt(e.start,t.stop),this.intervals.pop(u+1))}};Rt.prototype.complement=function(u,e){var t=new Rt;t.addInterval(new Mt(u,e+1));for(var r=0;rr.start&&u.stop=r.stop?(this.intervals.splice(e,1),e=e-1):u.start"):u.push("'"+String.fromCharCode(t.start)+"'"):u.push("'"+String.fromCharCode(t.start)+"'..'"+String.fromCharCode(t.stop-1)+"'")}return u.length>1?"{"+u.join(", ")+"}":u[0]};Rt.prototype.toIndexString=function(){for(var u=[],e=0;e"):u.push(t.start.toString()):u.push(t.start.toString()+".."+(t.stop-1).toString())}return u.length>1?"{"+u.join(", ")+"}":u[0]};Rt.prototype.toTokenString=function(u,e){for(var t=[],r=0;r1?"{"+t.join(", ")+"}":t[0]};Rt.prototype.elementName=function(u,e,t){return t===hf.EOF?"":t===hf.EPSILON?"":u[t]||e[t]};PR.Interval=Mt;PR.IntervalSet=Rt});var Yi=w($u=>{var Ir0=Ze().Token,Ad0=Zt().Interval,kR=Zt().IntervalSet,Lr0=ca().Predicate,Sr0=ca().PrecedencePredicate;function x0(u){if(u==null)throw"target cannot be null.";return this.target=u,this.isEpsilon=!1,this.label=null,this}c(x0,"Transition");x0.EPSILON=1;x0.RANGE=2;x0.RULE=3;x0.PREDICATE=4;x0.ATOM=5;x0.ACTION=6;x0.SET=7;x0.NOT_SET=8;x0.WILDCARD=9;x0.PRECEDENCE=10;x0.serializationNames=["INVALID","EPSILON","RANGE","RULE","PREDICATE","ATOM","ACTION","SET","NOT_SET","WILDCARD","PRECEDENCE"];x0.serializationTypes={EpsilonTransition:x0.EPSILON,RangeTransition:x0.RANGE,RuleTransition:x0.RULE,PredicateTransition:x0.PREDICATE,AtomTransition:x0.ATOM,ActionTransition:x0.ACTION,SetTransition:x0.SET,NotSetTransition:x0.NOT_SET,WildcardTransition:x0.WILDCARD,PrecedencePredicateTransition:x0.PRECEDENCE};function la(u,e){return x0.call(this,u),this.label_=e,this.label=this.makeLabel(),this.serializationType=x0.ATOM,this}c(la,"AtomTransition");la.prototype=Object.create(x0.prototype);la.prototype.constructor=la;la.prototype.makeLabel=function(){var u=new kR;return u.addOne(this.label_),u};la.prototype.matches=function(u,e,t){return this.label_===u};la.prototype.toString=function(){return this.label_};function ff(u,e,t,r){return x0.call(this,u),this.ruleIndex=e,this.precedence=t,this.followState=r,this.serializationType=x0.RULE,this.isEpsilon=!0,this}c(ff,"RuleTransition");ff.prototype=Object.create(x0.prototype);ff.prototype.constructor=ff;ff.prototype.matches=function(u,e,t){return!1};function sc(u,e){return x0.call(this,u),this.serializationType=x0.EPSILON,this.isEpsilon=!0,this.outermostPrecedenceReturn=e,this}c(sc,"EpsilonTransition");sc.prototype=Object.create(x0.prototype);sc.prototype.constructor=sc;sc.prototype.matches=function(u,e,t){return!1};sc.prototype.toString=function(){return"epsilon"};function ha(u,e,t){return x0.call(this,u),this.serializationType=x0.RANGE,this.start=e,this.stop=t,this.label=this.makeLabel(),this}c(ha,"RangeTransition");ha.prototype=Object.create(x0.prototype);ha.prototype.constructor=ha;ha.prototype.makeLabel=function(){var u=new kR;return u.addRange(this.start,this.stop),u};ha.prototype.matches=function(u,e,t){return u>=this.start&&u<=this.stop};ha.prototype.toString=function(){return"'"+String.fromCharCode(this.start)+"'..'"+String.fromCharCode(this.stop)+"'"};function Ws(u){return x0.call(this,u),this}c(Ws,"AbstractPredicateTransition");Ws.prototype=Object.create(x0.prototype);Ws.prototype.constructor=Ws;function fa(u,e,t,r){return Ws.call(this,u),this.serializationType=x0.PREDICATE,this.ruleIndex=e,this.predIndex=t,this.isCtxDependent=r,this.isEpsilon=!0,this}c(fa,"PredicateTransition");fa.prototype=Object.create(Ws.prototype);fa.prototype.constructor=fa;fa.prototype.matches=function(u,e,t){return!1};fa.prototype.getPredicate=function(){return new Lr0(this.ruleIndex,this.predIndex,this.isCtxDependent)};fa.prototype.toString=function(){return"pred_"+this.ruleIndex+":"+this.predIndex};function nc(u,e,t,r){return x0.call(this,u),this.serializationType=x0.ACTION,this.ruleIndex=e,this.actionIndex=t===void 0?-1:t,this.isCtxDependent=r===void 0?!1:r,this.isEpsilon=!0,this}c(nc,"ActionTransition");nc.prototype=Object.create(x0.prototype);nc.prototype.constructor=nc;nc.prototype.matches=function(u,e,t){return!1};nc.prototype.toString=function(){return"action_"+this.ruleIndex+":"+this.actionIndex};function wi(u,e){return x0.call(this,u),this.serializationType=x0.SET,e!=null?this.label=e:(this.label=new kR,this.label.addOne(Ir0.INVALID_TYPE)),this}c(wi,"SetTransition");wi.prototype=Object.create(x0.prototype);wi.prototype.constructor=wi;wi.prototype.matches=function(u,e,t){return this.label.contains(u)};wi.prototype.toString=function(){return this.label.toString()};function ac(u,e){return wi.call(this,u,e),this.serializationType=x0.NOT_SET,this}c(ac,"NotSetTransition");ac.prototype=Object.create(wi.prototype);ac.prototype.constructor=ac;ac.prototype.matches=function(u,e,t){return u>=e&&u<=t&&!wi.prototype.matches.call(this,u,e,t)};ac.prototype.toString=function(){return"~"+wi.prototype.toString.call(this)};function oc(u){return x0.call(this,u),this.serializationType=x0.WILDCARD,this}c(oc,"WildcardTransition");oc.prototype=Object.create(x0.prototype);oc.prototype.constructor=oc;oc.prototype.matches=function(u,e,t){return u>=e&&u<=t};oc.prototype.toString=function(){return"."};function da(u,e){return Ws.call(this,u),this.serializationType=x0.PRECEDENCE,this.precedence=e,this.isEpsilon=!0,this}c(da,"PrecedencePredicateTransition");da.prototype=Object.create(Ws.prototype);da.prototype.constructor=da;da.prototype.matches=function(u,e,t){return!1};da.prototype.getPredicate=function(){return new Sr0(this.precedence)};da.prototype.toString=function(){return this.precedence+" >= _p"};$u.Transition=x0;$u.AtomTransition=la;$u.SetTransition=wi;$u.NotSetTransition=ac;$u.RuleTransition=ff;$u.ActionTransition=nc;$u.EpsilonTransition=sc;$u.RangeTransition=ha;$u.WildcardTransition=oc;$u.PredicateTransition=fa;$u.PrecedencePredicateTransition=da;$u.AbstractPredicateTransition=Ws});var Gr=w(vi=>{var Kr0=Ze().Token,pF=Zt().Interval,yF=new pF(-1,-2),Id0=Ie();function gF(){return this}c(gF,"Tree");function df(){return gF.call(this),this}c(df,"SyntaxTree");df.prototype=Object.create(gF.prototype);df.prototype.constructor=df;function pa(){return df.call(this),this}c(pa,"ParseTree");pa.prototype=Object.create(df.prototype);pa.prototype.constructor=pa;function Ug(){return pa.call(this),this}c(Ug,"RuleNode");Ug.prototype=Object.create(pa.prototype);Ug.prototype.constructor=Ug;function Qi(){return pa.call(this),this}c(Qi,"TerminalNode");Qi.prototype=Object.create(pa.prototype);Qi.prototype.constructor=Qi;function pf(){return Qi.call(this),this}c(pf,"ErrorNode");pf.prototype=Object.create(Qi.prototype);pf.prototype.constructor=pf;function yf(){return this}c(yf,"ParseTreeVisitor");yf.prototype.visit=function(u){return Array.isArray(u)?u.map(function(e){return e.accept(this)},this):u.accept(this)};yf.prototype.visitChildren=function(u){return u.children?this.visit(u.children):null};yf.prototype.visitTerminal=function(u){};yf.prototype.visitErrorNode=function(u){};function gf(){return this}c(gf,"ParseTreeListener");gf.prototype.visitTerminal=function(u){};gf.prototype.visitErrorNode=function(u){};gf.prototype.enterEveryRule=function(u){};gf.prototype.exitEveryRule=function(u){};function Tu(u){return Qi.call(this),this.parentCtx=null,this.symbol=u,this}c(Tu,"TerminalNodeImpl");Tu.prototype=Object.create(Qi.prototype);Tu.prototype.constructor=Tu;Tu.prototype.getChild=function(u){return null};Tu.prototype.getSymbol=function(){return this.symbol};Tu.prototype.getParent=function(){return this.parentCtx};Tu.prototype.getPayload=function(){return this.symbol};Tu.prototype.getSourceInterval=function(){if(this.symbol===null)return yF;var u=this.symbol.tokenIndex;return new pF(u,u)};Tu.prototype.getChildCount=function(){return 0};Tu.prototype.accept=function(u){return u.visitTerminal(this)};Tu.prototype.getText=function(){return this.symbol.text};Tu.prototype.toString=function(){return this.symbol.type===Kr0.EOF?"":this.symbol.text};function cc(u){return Tu.call(this,u),this}c(cc,"ErrorNodeImpl");cc.prototype=Object.create(Tu.prototype);cc.prototype.constructor=cc;cc.prototype.isErrorNode=function(){return!0};cc.prototype.accept=function(u){return u.visitErrorNode(this)};function lc(){return this}c(lc,"ParseTreeWalker");lc.prototype.walk=function(u,e){var t=e instanceof pf||e.isErrorNode!==void 0&&e.isErrorNode();if(t)u.visitErrorNode(e);else if(e instanceof Qi)u.visitTerminal(e);else{this.enterRule(u,e);for(var r=0;r{var DR=Ef().RuleContext,Pg=Gr(),Or0=Pg.INVALID_INTERVAL,EF=Pg.TerminalNode,Nr0=Pg.TerminalNodeImpl,mF=Pg.ErrorNodeImpl,Ur0=Zt().Interval;function We(u,e){u=u||null,e=e||null,DR.call(this,u,e),this.ruleIndex=-1,this.children=null,this.start=null,this.stop=null,this.exception=null}c(We,"ParserRuleContext");We.prototype=Object.create(DR.prototype);We.prototype.constructor=We;We.prototype.copyFrom=function(u){this.parentCtx=u.parentCtx,this.invokingState=u.invokingState,this.children=null,this.start=u.start,this.stop=u.stop,u.children&&(this.children=[],u.children.map(function(e){e instanceof mF&&(this.children.push(e),e.parentCtx=this)},this))};We.prototype.enterRule=function(u){};We.prototype.exitRule=function(u){};We.prototype.addChild=function(u){return this.children===null&&(this.children=[]),this.children.push(u),u};We.prototype.removeLastChild=function(){this.children!==null&&this.children.pop()};We.prototype.addTokenNode=function(u){var e=new Nr0(u);return this.addChild(e),e.parentCtx=this,e};We.prototype.addErrorNode=function(u){var e=new mF(u);return this.addChild(e),e.parentCtx=this,e};We.prototype.getChild=function(u,e){if(e=e||null,this.children===null||u<0||u>=this.children.length)return null;if(e===null)return this.children[u];for(var t=0;t=this.children.length)return null;for(var t=0;t{var Pr0=Ie(),kr0=Ze().Token,Nd0=Gr().RuleNode,Br0=Gr().ErrorNode,TF=Gr().TerminalNode,Dr0=kg().ParserRuleContext,Fr0=Ef().RuleContext,Mr0=ji().INVALID_ALT_NUMBER;function At(){}c(At,"Trees");At.toStringTree=function(u,e,t){e=e||null,t=t||null,t!==null&&(e=t.ruleNames);var r=At.getNodeText(u,e);r=Pr0.escapeWhitespace(r,!1);var i=u.getChildCount();if(i===0)return r;var s="("+r+" ";i>0&&(r=At.toStringTree(u.getChild(0),e),s=s.concat(r));for(var a=1;a{var _F=Gr().RuleNode,Hr0=Gr().INVALID_INTERVAL,qr0=ji().INVALID_ALT_NUMBER;function Ht(u,e){return _F.call(this),this.parentCtx=u||null,this.invokingState=e||-1,this}c(Ht,"RuleContext");Ht.prototype=Object.create(_F.prototype);Ht.prototype.constructor=Ht;Ht.prototype.depth=function(){for(var u=0,e=this;e!==null;)e=e.parentCtx,u+=1;return u};Ht.prototype.isEmpty=function(){return this.invokingState===-1};Ht.prototype.getSourceInterval=function(){return Hr0};Ht.prototype.getRuleContext=function(){return this};Ht.prototype.getPayload=function(){return this};Ht.prototype.getText=function(){return this.getChildCount()===0?"":this.children.map(function(u){return u.getText()}).join("")};Ht.prototype.getAltNumber=function(){return qr0};Ht.prototype.setAltNumber=function(u){};Ht.prototype.getChild=function(u){return null};Ht.prototype.getChildCount=function(){return 0};Ht.prototype.accept=function(u){return u.visitChildren(this)};CF.RuleContext=Ht;var Vr0=FR().Trees;Ht.prototype.toStringTree=function(u,e){return Vr0.toStringTree(this,u,e)};Ht.prototype.toString=function(u,e){u=u||null,e=e||null;for(var t=this,r="[";t!==null&&t!==e;){if(u===null)t.isEmpty()||(r+=t.invokingState);else{var i=t.ruleIndex,s=i>=0&&i{var RF=Ef().RuleContext,AF=Ie().Hash,wF=Ie().Map;function N0(u){this.cachedHashCode=u}c(N0,"PredictionContext");N0.EMPTY=null;N0.EMPTY_RETURN_STATE=2147483647;N0.globalNodeCount=1;N0.id=N0.globalNodeCount;N0.prototype.isEmpty=function(){return this===N0.EMPTY};N0.prototype.hasEmptyPath=function(){return this.getReturnState(this.length-1)===N0.EMPTY_RETURN_STATE};N0.prototype.hashCode=function(){return this.cachedHashCode};N0.prototype.updateHashCode=function(u){u.update(this.cachedHashCode)};function Bg(){return this.cache=new wF,this}c(Bg,"PredictionContextCache");Bg.prototype.add=function(u){if(u===N0.EMPTY)return N0.EMPTY;var e=this.cache.get(u)||null;return e!==null?e:(this.cache.put(u,u),u)};Bg.prototype.get=function(u){return this.cache.get(u)||null};Object.defineProperty(Bg.prototype,"length",{get:function(){return this.cache.length}});function Me(u,e){var t=0,r=new AF;u!==null?r.update(u,e):r.update(1),t=r.finish(),N0.call(this,t),this.parentCtx=u,this.returnState=e}c(Me,"SingletonPredictionContext");Me.prototype=Object.create(N0.prototype);Me.prototype.contructor=Me;Me.create=function(u,e){return e===N0.EMPTY_RETURN_STATE&&u===null?N0.EMPTY:new Me(u,e)};Object.defineProperty(Me.prototype,"length",{get:function(){return 1}});Me.prototype.getParent=function(u){return this.parentCtx};Me.prototype.getReturnState=function(u){return this.returnState};Me.prototype.equals=function(u){return this===u?!0:u instanceof Me?this.hashCode()!==u.hashCode()||this.returnState!==u.returnState?!1:this.parentCtx==null?u.parentCtx==null:this.parentCtx.equals(u.parentCtx):!1};Me.prototype.toString=function(){var u=this.parentCtx===null?"":this.parentCtx.toString();return u.length===0?this.returnState===N0.EMPTY_RETURN_STATE?"$":""+this.returnState:""+this.returnState+" "+u};function Wr(){return Me.call(this,null,N0.EMPTY_RETURN_STATE),this}c(Wr,"EmptyPredictionContext");Wr.prototype=Object.create(Me.prototype);Wr.prototype.constructor=Wr;Wr.prototype.isEmpty=function(){return!0};Wr.prototype.getParent=function(u){return null};Wr.prototype.getReturnState=function(u){return this.returnState};Wr.prototype.equals=function(u){return this===u};Wr.prototype.toString=function(){return"$"};N0.EMPTY=new Wr;function wt(u,e){var t=new AF;t.update(u,e);var r=t.finish();return N0.call(this,r),this.parents=u,this.returnStates=e,this}c(wt,"ArrayPredictionContext");wt.prototype=Object.create(N0.prototype);wt.prototype.constructor=wt;wt.prototype.isEmpty=function(){return this.returnStates[0]===N0.EMPTY_RETURN_STATE};Object.defineProperty(wt.prototype,"length",{get:function(){return this.returnStates.length}});wt.prototype.getParent=function(u){return this.parents[u]};wt.prototype.getReturnState=function(u){return this.returnStates[u]};wt.prototype.equals=function(u){return this===u?!0:u instanceof wt?this.hashCode()!==u.hashCode()?!1:this.returnStates===u.returnStates&&this.parents===u.parents:!1};wt.prototype.toString=function(){if(this.isEmpty())return"[]";for(var u="[",e=0;e0&&(u=u+", "),this.returnStates[e]===N0.EMPTY_RETURN_STATE){u=u+"$";continue}u=u+this.returnStates[e],this.parents[e]!==null?u=u+" "+this.parents[e]:u=u+"null"}return u+"]"};function vF(u,e){if(e==null&&(e=RF.EMPTY),e.parentCtx===null||e===RF.EMPTY)return N0.EMPTY;var t=vF(u,e.parentCtx),r=u.states[e.invokingState],i=r.transitions[0];return Me.create(t,i.followState.stateNumber)}c(vF,"predictionContextFromRuleContext");function MR(u,e,t,r){if(u===e)return u;if(u instanceof Me&&e instanceof Me)return Gr0(u,e,t,r);if(t){if(u instanceof Wr)return u;if(e instanceof Wr)return e}return u instanceof Me&&(u=new wt([u.getParent()],[u.returnState])),e instanceof Me&&(e=new wt([e.getParent()],[e.returnState])),zr0(u,e,t,r)}c(MR,"merge");function Gr0(u,e,t,r){if(r!==null){var i=r.get(u,e);if(i!==null||(i=r.get(e,u),i!==null))return i}var s=Wr0(u,e,t);if(s!==null)return r!==null&&r.set(u,e,s),s;if(u.returnState===e.returnState){var a=MR(u.parentCtx,e.parentCtx,t,r);if(a===u.parentCtx)return u;if(a===e.parentCtx)return e;var o=Me.create(a,u.returnState);return r!==null&&r.set(u,e,o),o}else{var h=null;if((u===e||u.parentCtx!==null&&u.parentCtx===e.parentCtx)&&(h=u.parentCtx),h!==null){var d=[u.returnState,e.returnState];u.returnState>e.returnState&&(d[0]=e.returnState,d[1]=u.returnState);var p=[h,h],f=new wt(p,d);return r!==null&&r.set(u,e,f),f}var d=[u.returnState,e.returnState],p=[u.parentCtx,e.parentCtx];u.returnState>e.returnState&&(d[0]=e.returnState,d[1]=u.returnState,p=[e.parentCtx,u.parentCtx]);var E=new wt(p,d);return r!==null&&r.set(u,e,E),E}}c(Gr0,"mergeSingletons");function Wr0(u,e,t){if(t){if(u===N0.EMPTY||e===N0.EMPTY)return N0.EMPTY}else{if(u===N0.EMPTY&&e===N0.EMPTY)return N0.EMPTY;if(u===N0.EMPTY){var r=[e.returnState,N0.EMPTY_RETURN_STATE],i=[e.parentCtx,null];return new wt(i,r)}else if(e===N0.EMPTY){var r=[u.returnState,N0.EMPTY_RETURN_STATE],i=[u.parentCtx,null];return new wt(i,r)}}return null}c(Wr0,"mergeRoot");function zr0(u,e,t,r){if(r!==null){var i=r.get(u,e);if(i!==null||(i=r.get(e,u),i!==null))return i}for(var s=0,a=0,o=0,h=[],f=[];s{var LF=Ie().Set,SF=Ie().BitSet,ga=Ze().Token,Qr0=lf().ATNConfig,Md0=Zt().Interval,KF=Zt().IntervalSet,jr0=Vr().RuleStopState,$r0=Yi().RuleTransition,Zr0=Yi().NotSetTransition,Xr0=Yi().WildcardTransition,Jr0=Yi().AbstractPredicateTransition,HR=Ii(),ei0=HR.predictionContextFromRuleContext,OF=HR.PredictionContext,ti0=HR.SingletonPredictionContext;function Ea(u){this.atn=u}c(Ea,"LL1Analyzer");Ea.HIT_PRED=ga.INVALID_TYPE;Ea.prototype.getDecisionLookahead=function(u){if(u===null)return null;for(var e=u.transitions.length,t=[],r=0;r{var ui0=UF().LL1Analyzer,ri0=Zt().IntervalSet;function Li(u,e){return this.grammarType=u,this.maxTokenType=e,this.states=[],this.decisionToState=[],this.ruleToStartState=[],this.ruleToStopState=null,this.modeNameToStartState={},this.ruleToTokenType=null,this.lexerActions=null,this.modeToStartState=[],this}c(Li,"ATN");Li.prototype.nextTokensInContext=function(u,e){var t=new ui0(this);return t.LOOK(u,null,e)};Li.prototype.nextTokensNoContext=function(u){return u.nextTokenWithinRule!==null||(u.nextTokenWithinRule=this.nextTokensInContext(u,null),u.nextTokenWithinRule.readOnly=!0),u.nextTokenWithinRule};Li.prototype.nextTokens=function(u,e){return e===void 0?this.nextTokensNoContext(u):this.nextTokensInContext(u,e)};Li.prototype.addState=function(u){u!==null&&(u.atn=this,u.stateNumber=this.states.length),this.states.push(u)};Li.prototype.removeState=function(u){this.states[u.stateNumber]=null};Li.prototype.defineDecisionState=function(u){return this.decisionToState.push(u),u.decision=this.decisionToState.length-1,u.decision};Li.prototype.getDecisionState=function(u){return this.decisionToState.length===0?null:this.decisionToState[u]};var hc=Ze().Token;Li.prototype.getExpectedTokens=function(u,e){if(u<0||u>=this.states.length)throw"Invalid state number.";var t=this.states[u],r=this.nextTokens(t);if(!r.contains(hc.EPSILON))return r;var i=new ri0;for(i.addSet(r),i.removeOne(hc.EPSILON);e!==null&&e.invokingState>=0&&r.contains(hc.EPSILON);){var s=this.states[e.invokingState],a=s.transitions[0];r=this.nextTokens(a.followState),i.addSet(r),i.removeOne(hc.EPSILON),e=e.parentCtx}return r.contains(hc.EPSILON)&&i.addOne(hc.EOF),i};Li.INVALID_ALT_NUMBER=0;PF.ATN=Li});var BF=w(kF=>{function qR(){}c(qR,"ATNType");qR.LEXER=0;qR.PARSER=1;kF.ATNType=qR});var VR=w(DF=>{function Dg(u){return u===void 0&&(u=null),this.readOnly=!1,this.verifyATN=u===null?!0:u.verifyATN,this.generateRuleBypassTransitions=u===null?!1:u.generateRuleBypassTransitions,this}c(Dg,"ATNDeserializationOptions");Dg.defaultOptions=new Dg;Dg.defaultOptions.readOnly=!0;DF.ATNDeserializationOptions=Dg});var GR=w(zr=>{function qt(){}c(qt,"LexerActionType");qt.CHANNEL=0;qt.CUSTOM=1;qt.MODE=2;qt.MORE=3;qt.POP_MODE=4;qt.PUSH_MODE=5;qt.SKIP=6;qt.TYPE=7;function ze(u){return this.actionType=u,this.isPositionDependent=!1,this}c(ze,"LexerAction");ze.prototype.hashCode=function(){var u=new Hash;return this.updateHashCode(u),u.finish()};ze.prototype.updateHashCode=function(u){u.update(this.actionType)};ze.prototype.equals=function(u){return this===u};function zs(){return ze.call(this,qt.SKIP),this}c(zs,"LexerSkipAction");zs.prototype=Object.create(ze.prototype);zs.prototype.constructor=zs;zs.INSTANCE=new zs;zs.prototype.execute=function(u){u.skip()};zs.prototype.toString=function(){return"skip"};function $i(u){return ze.call(this,qt.TYPE),this.type=u,this}c($i,"LexerTypeAction");$i.prototype=Object.create(ze.prototype);$i.prototype.constructor=$i;$i.prototype.execute=function(u){u.type=this.type};$i.prototype.updateHashCode=function(u){u.update(this.actionType,this.type)};$i.prototype.equals=function(u){return this===u?!0:u instanceof $i?this.type===u.type:!1};$i.prototype.toString=function(){return"type("+this.type+")"};function Zi(u){return ze.call(this,qt.PUSH_MODE),this.mode=u,this}c(Zi,"LexerPushModeAction");Zi.prototype=Object.create(ze.prototype);Zi.prototype.constructor=Zi;Zi.prototype.execute=function(u){u.pushMode(this.mode)};Zi.prototype.updateHashCode=function(u){u.update(this.actionType,this.mode)};Zi.prototype.equals=function(u){return this===u?!0:u instanceof Zi?this.mode===u.mode:!1};Zi.prototype.toString=function(){return"pushMode("+this.mode+")"};function Ys(){return ze.call(this,qt.POP_MODE),this}c(Ys,"LexerPopModeAction");Ys.prototype=Object.create(ze.prototype);Ys.prototype.constructor=Ys;Ys.INSTANCE=new Ys;Ys.prototype.execute=function(u){u.popMode()};Ys.prototype.toString=function(){return"popMode"};function Qs(){return ze.call(this,qt.MORE),this}c(Qs,"LexerMoreAction");Qs.prototype=Object.create(ze.prototype);Qs.prototype.constructor=Qs;Qs.INSTANCE=new Qs;Qs.prototype.execute=function(u){u.more()};Qs.prototype.toString=function(){return"more"};function Xi(u){return ze.call(this,qt.MODE),this.mode=u,this}c(Xi,"LexerModeAction");Xi.prototype=Object.create(ze.prototype);Xi.prototype.constructor=Xi;Xi.prototype.execute=function(u){u.mode(this.mode)};Xi.prototype.updateHashCode=function(u){u.update(this.actionType,this.mode)};Xi.prototype.equals=function(u){return this===u?!0:u instanceof Xi?this.mode===u.mode:!1};Xi.prototype.toString=function(){return"mode("+this.mode+")"};function js(u,e){return ze.call(this,qt.CUSTOM),this.ruleIndex=u,this.actionIndex=e,this.isPositionDependent=!0,this}c(js,"LexerCustomAction");js.prototype=Object.create(ze.prototype);js.prototype.constructor=js;js.prototype.execute=function(u){u.action(null,this.ruleIndex,this.actionIndex)};js.prototype.updateHashCode=function(u){u.update(this.actionType,this.ruleIndex,this.actionIndex)};js.prototype.equals=function(u){return this===u?!0:u instanceof js?this.ruleIndex===u.ruleIndex&&this.actionIndex===u.actionIndex:!1};function Ji(u){return ze.call(this,qt.CHANNEL),this.channel=u,this}c(Ji,"LexerChannelAction");Ji.prototype=Object.create(ze.prototype);Ji.prototype.constructor=Ji;Ji.prototype.execute=function(u){u._channel=this.channel};Ji.prototype.updateHashCode=function(u){u.update(this.actionType,this.channel)};Ji.prototype.equals=function(u){return this===u?!0:u instanceof Ji?this.channel===u.channel:!1};Ji.prototype.toString=function(){return"channel("+this.channel+")"};function $s(u,e){return ze.call(this,e.actionType),this.offset=u,this.action=e,this.isPositionDependent=!0,this}c($s,"LexerIndexedCustomAction");$s.prototype=Object.create(ze.prototype);$s.prototype.constructor=$s;$s.prototype.execute=function(u){this.action.execute(u)};$s.prototype.updateHashCode=function(u){u.update(this.actionType,this.offset,this.action)};$s.prototype.equals=function(u){return this===u?!0:u instanceof $s?this.offset===u.offset&&this.action===u.action:!1};zr.LexerActionType=qt;zr.LexerSkipAction=zs;zr.LexerChannelAction=Ji;zr.LexerCustomAction=js;zr.LexerIndexedCustomAction=$s;zr.LexerMoreAction=Qs;zr.LexerTypeAction=$i;zr.LexerPushModeAction=Zi;zr.LexerPopModeAction=Ys;zr.LexerModeAction=Xi});var eA=w(YF=>{var WR=Ze().Token,ii0=ji().ATN,Mg=BF().ATNType,_u=Vr(),bu=_u.ATNState,qF=_u.BasicState,si0=_u.DecisionState,jR=_u.BlockStartState,$R=_u.BlockEndState,fc=_u.LoopEndState,VF=_u.RuleStartState,xf=_u.RuleStopState,ni0=_u.TokensStartState,GF=_u.PlusLoopbackState,ZR=_u.StarLoopbackState,dc=_u.StarLoopEntryState,XR=_u.PlusBlockStartState,zR=_u.StarBlockStartState,WF=_u.BasicBlockStartState,Yr=Yi(),Si=Yr.Transition,YR=Yr.AtomTransition,ai0=Yr.SetTransition,oi0=Yr.NotSetTransition,zF=Yr.RuleTransition,FF=Yr.RangeTransition,ci0=Yr.ActionTransition,mf=Yr.EpsilonTransition,li0=Yr.WildcardTransition,hi0=Yr.PredicateTransition,fi0=Yr.PrecedencePredicateTransition,di0=Zt().IntervalSet,Zd0=Zt().Interval,pi0=VR().ATNDeserializationOptions,es=GR(),Zs=es.LexerActionType,yi0=es.LexerSkipAction,gi0=es.LexerChannelAction,Ei0=es.LexerCustomAction,mi0=es.LexerMoreAction,xi0=es.LexerTypeAction,Ti0=es.LexerPushModeAction,bi0=es.LexerPopModeAction,_i0=es.LexerModeAction,Ci0="AADB8D7E-AEEF-4415-AD2B-8204D6CF042E",JR="59627784-3BE5-417A-B9EB-8131A7286089",QR=[Ci0,JR],MF=3,HF=JR;function Fg(u,e){var t=[];return t[u-1]=e,t.map(function(r){return e})}c(Fg,"initArray");function me(u){return u==null&&(u=pi0.defaultOptions),this.deserializationOptions=u,this.stateFactories=null,this.actionFactories=null,this}c(me,"ATNDeserializer");me.prototype.isFeatureSupported=function(u,e){var t=QR.indexOf(u);if(t<0)return!1;var r=QR.indexOf(e);return r>=t};me.prototype.deserialize=function(u){this.reset(u),this.checkVersion(),this.checkUUID();var e=this.readATN();this.readStates(e),this.readRules(e),this.readModes(e);var t=[];return this.readSets(e,t,this.readInt.bind(this)),this.isFeatureSupported(JR,this.uuid)&&this.readSets(e,t,this.readInt32.bind(this)),this.readEdges(e,t),this.readDecisions(e),this.readLexerActions(e),this.markPrecedenceDecisions(e),this.verifyATN(e),this.deserializationOptions.generateRuleBypassTransitions&&e.grammarType===Mg.PARSER&&(this.generateRuleBypassTransitions(e),this.verifyATN(e)),e};me.prototype.reset=function(u){var e=c(function(r){var i=r.charCodeAt(0);return i>1?i-2:i+65534},"adjust"),t=u.split("").map(e);t[0]=u.charCodeAt(0),this.data=t,this.pos=0};me.prototype.checkVersion=function(){var u=this.readInt();if(u!==MF)throw"Could not deserialize ATN with version "+u+" (expected "+MF+")."};me.prototype.checkUUID=function(){var u=this.readUUID();if(QR.indexOf(u)<0)throw""+u+HF,HF;this.uuid=u};me.prototype.readATN=function(){var u=this.readInt(),e=this.readInt();return new ii0(u,e)};me.prototype.readStates=function(u){for(var e,t,r,i=[],s=[],a=this.readInt(),o=0;o0;)i.addTransition(d.transitions[p-1]),d.transitions=d.transitions.slice(-1);u.ruleToStartState[e].addTransition(new mf(i)),s.addTransition(new mf(o));var E=new qF;u.addState(E),E.addTransition(new YR(s,u.ruleToTokenType[e])),i.addTransition(new mf(E))};me.prototype.stateIsEndStateFor=function(u,e){if(u.ruleIndex!==e||!(u instanceof dc))return null;var t=u.transitions[u.transitions.length-1].target;return t instanceof fc&&t.epsilonOnlyTransitions&&t.transitions[0].target instanceof xf?u:null};me.prototype.markPrecedenceDecisions=function(u){for(var e=0;e=0):this.checkCondition(t.transitions.length<=1||t instanceof xf)}};me.prototype.checkCondition=function(u,e){if(!u)throw e==null&&(e="IllegalState"),e};me.prototype.readInt=function(){return this.data[this.pos++]};me.prototype.readInt32=function(){var u=this.readInt(),e=this.readInt();return u|e<<16};me.prototype.readLong=function(){var u=this.readInt32(),e=this.readInt32();return u&4294967295|e<<32};function Ri0(){for(var u=[],e=0;e<256;e++)u[e]=(e+256).toString(16).substr(1).toUpperCase();return u}c(Ri0,"createByteToHex");var Xt=Ri0();me.prototype.readUUID=function(){for(var u=[],e=7;e>=0;e--){var t=this.readInt();u[2*e+1]=t&255,u[2*e]=t>>8&255}return Xt[u[0]]+Xt[u[1]]+Xt[u[2]]+Xt[u[3]]+"-"+Xt[u[4]]+Xt[u[5]]+"-"+Xt[u[6]]+Xt[u[7]]+"-"+Xt[u[8]]+Xt[u[9]]+"-"+Xt[u[10]]+Xt[u[11]]+Xt[u[12]]+Xt[u[13]]+Xt[u[14]]+Xt[u[15]]};me.prototype.edgeFactory=function(u,e,t,r,i,s,a,o){var h=u.states[r];switch(e){case Si.EPSILON:return new mf(h);case Si.RANGE:return a!==0?new FF(h,WR.EOF,s):new FF(h,i,s);case Si.RULE:return new zF(u.states[i],s,a,h);case Si.PREDICATE:return new hi0(h,i,s,a!==0);case Si.PRECEDENCE:return new fi0(h,i);case Si.ATOM:return a!==0?new YR(h,WR.EOF):new YR(h,i);case Si.ACTION:return new ci0(h,i,s,a!==0);case Si.SET:return new ai0(h,o[i]);case Si.NOT_SET:return new oi0(h,o[i]);case Si.WILDCARD:return new li0(h);default:throw"The specified transition type: "+e+" is not valid."}};me.prototype.stateFactory=function(u,e){if(this.stateFactories===null){var t=[];t[bu.INVALID_TYPE]=null,t[bu.BASIC]=function(){return new qF},t[bu.RULE_START]=function(){return new VF},t[bu.BLOCK_START]=function(){return new WF},t[bu.PLUS_BLOCK_START]=function(){return new XR},t[bu.STAR_BLOCK_START]=function(){return new zR},t[bu.TOKEN_START]=function(){return new ni0},t[bu.RULE_STOP]=function(){return new xf},t[bu.BLOCK_END]=function(){return new $R},t[bu.STAR_LOOP_BACK]=function(){return new ZR},t[bu.STAR_LOOP_ENTRY]=function(){return new dc},t[bu.PLUS_LOOP_BACK]=function(){return new GF},t[bu.LOOP_END]=function(){return new fc},this.stateFactories=t}if(u>this.stateFactories.length||this.stateFactories[u]===null)throw"The specified state type "+u+" is not valid.";var r=this.stateFactories[u]();if(r!==null)return r.ruleIndex=e,r};me.prototype.lexerActionFactory=function(u,e,t){if(this.actionFactories===null){var r=[];r[Zs.CHANNEL]=function(i,s){return new gi0(i)},r[Zs.CUSTOM]=function(i,s){return new Ei0(i,s)},r[Zs.MODE]=function(i,s){return new _i0(i)},r[Zs.MORE]=function(i,s){return mi0.INSTANCE},r[Zs.POP_MODE]=function(i,s){return bi0.INSTANCE},r[Zs.PUSH_MODE]=function(i,s){return new Ti0(i)},r[Zs.SKIP]=function(i,s){return yi0.INSTANCE},r[Zs.TYPE]=function(i,s){return new xi0(i)},this.actionFactories=r}if(u>this.actionFactories.length||this.actionFactories[u]===null)throw"The specified lexer action type "+u+" is not valid.";return this.actionFactories[u](e,t)};YF.ATNDeserializer=me});var Tf=w(Hg=>{function ts(){return this}c(ts,"ErrorListener");ts.prototype.syntaxError=function(u,e,t,r,i,s){};ts.prototype.reportAmbiguity=function(u,e,t,r,i,s,a){};ts.prototype.reportAttemptingFullContext=function(u,e,t,r,i,s){};ts.prototype.reportContextSensitivity=function(u,e,t,r,i,s){};function ma(){return ts.call(this),this}c(ma,"ConsoleErrorListener");ma.prototype=Object.create(ts.prototype);ma.prototype.constructor=ma;ma.INSTANCE=new ma;ma.prototype.syntaxError=function(u,e,t,r,i,s){console.error("line "+t+":"+r+" "+i)};function Xs(u){if(ts.call(this),u===null)throw"delegates";return this.delegates=u,this}c(Xs,"ProxyErrorListener");Xs.prototype=Object.create(ts.prototype);Xs.prototype.constructor=Xs;Xs.prototype.syntaxError=function(u,e,t,r,i,s){this.delegates.map(function(a){a.syntaxError(u,e,t,r,i,s)})};Xs.prototype.reportAmbiguity=function(u,e,t,r,i,s,a){this.delegates.map(function(o){o.reportAmbiguity(u,e,t,r,i,s,a)})};Xs.prototype.reportAttemptingFullContext=function(u,e,t,r,i,s){this.delegates.map(function(a){a.reportAttemptingFullContext(u,e,t,r,i,s)})};Xs.prototype.reportContextSensitivity=function(u,e,t,r,i,s){this.delegates.map(function(a){a.reportContextSensitivity(u,e,t,r,i,s)})};Hg.ErrorListener=ts;Hg.ConsoleErrorListener=ma;Hg.ProxyErrorListener=Xs});var uA=w(QF=>{var tA=Ze().Token,Ai0=Tf().ConsoleErrorListener,wi0=Tf().ProxyErrorListener;function Cu(){return this._listeners=[Ai0.INSTANCE],this._interp=null,this._stateNumber=-1,this}c(Cu,"Recognizer");Cu.tokenTypeMapCache={};Cu.ruleIndexMapCache={};Cu.prototype.checkVersion=function(u){var e="4.8";e!==u&&console.log("ANTLR runtime and generated code versions disagree: "+e+"!="+u)};Cu.prototype.addErrorListener=function(u){this._listeners.push(u)};Cu.prototype.removeErrorListeners=function(){this._listeners=[]};Cu.prototype.getTokenTypeMap=function(){var u=this.getTokenNames();if(u===null)throw"The current recognizer does not provide a list of token names.";var e=this.tokenTypeMapCache[u];return e===void 0&&(e=u.reduce(function(t,r,i){t[r]=i}),e.EOF=tA.EOF,this.tokenTypeMapCache[u]=e),e};Cu.prototype.getRuleIndexMap=function(){var u=this.ruleNames;if(u===null)throw"The current recognizer does not provide a list of rule names.";var e=this.ruleIndexMapCache[u];return e===void 0&&(e=u.reduce(function(t,r,i){t[r]=i}),this.ruleIndexMapCache[u]=e),e};Cu.prototype.getTokenType=function(u){var e=this.getTokenTypeMap()[u];return e!==void 0?e:tA.INVALID_TYPE};Cu.prototype.getErrorHeader=function(u){var e=u.getOffendingToken().line,t=u.getOffendingToken().column;return"line "+e+":"+t};Cu.prototype.getTokenErrorDisplay=function(u){if(u===null)return"";var e=u.text;return e===null&&(u.type===tA.EOF?e="":e="<"+u.type+">"),e=e.replace(` +`,"\\n").replace("\r","\\r").replace(" ","\\t"),"'"+e+"'"};Cu.prototype.getErrorListenerDispatch=function(){return new wi0(this._listeners)};Cu.prototype.sempred=function(u,e,t){return!0};Cu.prototype.precpred=function(u,e){return!0};Object.defineProperty(Cu.prototype,"state",{get:function(){return this._stateNumber},set:function(u){this._stateNumber=u}});QF.Recognizer=Cu});var XF=w(ZF=>{var jF=Ze().CommonToken;function $F(){return this}c($F,"TokenFactory");function Js(u){return $F.call(this),this.copyText=u===void 0?!1:u,this}c(Js,"CommonTokenFactory");Js.prototype=Object.create($F.prototype);Js.prototype.constructor=Js;Js.DEFAULT=new Js;Js.prototype.create=function(u,e,t,r,i,s,a,o){var h=new jF(u,e,r,i,s);return h.line=a,h.column=o,t!==null?h.text=t:this.copyText&&u[1]!==null&&(h.text=u[1].getText(i,s)),h};Js.prototype.createThin=function(u,e){var t=new jF(null,u);return t.text=e,t};ZF.CommonTokenFactory=Js});var Qr=w(xa=>{var vi0=Yi().PredicateTransition;function Ru(u){if(Error.call(this),Error.captureStackTrace)Error.captureStackTrace(this,Ru);else var e=new Error().stack;return this.message=u.message,this.recognizer=u.recognizer,this.input=u.input,this.ctx=u.ctx,this.offendingToken=null,this.offendingState=-1,this.recognizer!==null&&(this.offendingState=this.recognizer.state),this}c(Ru,"RecognitionException");Ru.prototype=Object.create(Error.prototype);Ru.prototype.constructor=Ru;Ru.prototype.getExpectedTokens=function(){return this.recognizer!==null?this.recognizer.atn.getExpectedTokens(this.offendingState,this.ctx):null};Ru.prototype.toString=function(){return this.message};function bf(u,e,t,r){return Ru.call(this,{message:"",recognizer:u,input:e,ctx:null}),this.startIndex=t,this.deadEndConfigs=r,this}c(bf,"LexerNoViableAltException");bf.prototype=Object.create(Ru.prototype);bf.prototype.constructor=bf;bf.prototype.toString=function(){var u="";return this.startIndex>=0&&this.startIndex{var Au=Ze().Token,JF=uA().Recognizer,Ii0=XF().CommonTokenFactory,Li0=Qr().RecognitionException,Si0=Qr().LexerNoViableAltException;function I0(u){return JF.call(this),this._input=u,this._factory=Ii0.DEFAULT,this._tokenFactorySourcePair=[this,u],this._interp=null,this._token=null,this._tokenStartCharIndex=-1,this._tokenStartLine=-1,this._tokenStartColumn=-1,this._hitEOF=!1,this._channel=Au.DEFAULT_CHANNEL,this._type=Au.INVALID_TYPE,this._modeStack=[],this._mode=I0.DEFAULT_MODE,this._text=null,this}c(I0,"Lexer");I0.prototype=Object.create(JF.prototype);I0.prototype.constructor=I0;I0.DEFAULT_MODE=0;I0.MORE=-2;I0.SKIP=-3;I0.DEFAULT_TOKEN_CHANNEL=Au.DEFAULT_CHANNEL;I0.HIDDEN=Au.HIDDEN_CHANNEL;I0.MIN_CHAR_VALUE=0;I0.MAX_CHAR_VALUE=1114111;I0.prototype.reset=function(){this._input!==null&&this._input.seek(0),this._token=null,this._type=Au.INVALID_TYPE,this._channel=Au.DEFAULT_CHANNEL,this._tokenStartCharIndex=-1,this._tokenStartColumn=-1,this._tokenStartLine=-1,this._text=null,this._hitEOF=!1,this._mode=I0.DEFAULT_MODE,this._modeStack=[],this._interp.reset()};I0.prototype.nextToken=function(){if(this._input===null)throw"nextToken requires a non-null input stream.";var u=this._input.mark();try{for(;;){if(this._hitEOF)return this.emitEOF(),this._token;this._token=null,this._channel=Au.DEFAULT_CHANNEL,this._tokenStartCharIndex=this._input.index,this._tokenStartColumn=this._interp.column,this._tokenStartLine=this._interp.line,this._text=null;for(var e=!1;;){this._type=Au.INVALID_TYPE;var t=I0.SKIP;try{t=this._interp.match(this._input,this._mode)}catch(r){if(r instanceof Li0)this.notifyListeners(r),this.recover(r);else throw console.log(r.stack),r}if(this._input.LA(1)===Au.EOF&&(this._hitEOF=!0),this._type===Au.INVALID_TYPE&&(this._type=t),this._type===I0.SKIP){e=!0;break}if(this._type!==I0.MORE)break}if(!e)return this._token===null&&this.emit(),this._token}}finally{this._input.release(u)}};I0.prototype.skip=function(){this._type=I0.SKIP};I0.prototype.more=function(){this._type=I0.MORE};I0.prototype.mode=function(u){this._mode=u};I0.prototype.pushMode=function(u){this._interp.debug&&console.log("pushMode "+u),this._modeStack.push(this._mode),this.mode(u)};I0.prototype.popMode=function(){if(this._modeStack.length===0)throw"Empty Stack";return this._interp.debug&&console.log("popMode back to "+this._modeStack.slice(0,-1)),this.mode(this._modeStack.pop()),this._mode};Object.defineProperty(I0.prototype,"inputStream",{get:function(){return this._input},set:function(u){this._input=null,this._tokenFactorySourcePair=[this,this._input],this.reset(),this._input=u,this._tokenFactorySourcePair=[this,this._input]}});Object.defineProperty(I0.prototype,"sourceName",{get:c(function(){return this._input.sourceName},"sourceName")});I0.prototype.emitToken=function(u){this._token=u};I0.prototype.emit=function(){var u=this._factory.create(this._tokenFactorySourcePair,this._type,this._text,this._channel,this._tokenStartCharIndex,this.getCharIndex()-1,this._tokenStartLine,this._tokenStartColumn);return this.emitToken(u),u};I0.prototype.emitEOF=function(){var u=this.column,e=this.line,t=this._factory.create(this._tokenFactorySourcePair,Au.EOF,null,Au.DEFAULT_CHANNEL,this._input.index,this._input.index-1,e,u);return this.emitToken(t),t};Object.defineProperty(I0.prototype,"type",{get:function(){return this.type},set:function(u){this._type=u}});Object.defineProperty(I0.prototype,"line",{get:function(){return this._interp.line},set:function(u){this._interp.line=u}});Object.defineProperty(I0.prototype,"column",{get:function(){return this._interp.column},set:function(u){this._interp.column=u}});I0.prototype.getCharIndex=function(){return this._input.index};Object.defineProperty(I0.prototype,"text",{get:function(){return this._text!==null?this._text:this._interp.getText(this._input)},set:function(u){this._text=u}});I0.prototype.getAllTokens=function(){for(var u=[],e=this.nextToken();e.type!==Au.EOF;)u.push(e),e=this.nextToken();return u};I0.prototype.notifyListeners=function(u){var e=this._tokenStartCharIndex,t=this._input.index,r=this._input.getText(e,t),i="token recognition error at: '"+this.getErrorDisplay(r)+"'",s=this.getErrorListenerDispatch();s.syntaxError(this,null,this._tokenStartLine,this._tokenStartColumn,i,u)};I0.prototype.getErrorDisplay=function(u){for(var e=[],t=0;t":u===` +`?"\\n":u===" "?"\\t":u==="\r"?"\\r":u};I0.prototype.getCharErrorDisplay=function(u){return"'"+this.getErrorDisplayForChar(u)+"'"};I0.prototype.recover=function(u){this._input.LA(1)!==Au.EOF&&(u instanceof Si0?this._interp.consume(this._input):this._input.consume())};eM.Lexer=I0});var en=w(rA=>{var Ki0=ji().ATN,Wg=Ie(),Oi0=Wg.Hash,zg=Wg.Set,tM=ca().SemanticContext,Ni0=Ii().merge;function Ui0(u){return u.hashCodeForConfigSet()}c(Ui0,"hashATNConfig");function Pi0(u,e){return u===e?!0:u===null||e===null?!1:u.equalsForConfigSet(e)}c(Pi0,"equalATNConfigs");function Xe(u){return this.configLookup=new zg(Ui0,Pi0),this.fullCtx=u===void 0?!0:u,this.readOnly=!1,this.configs=[],this.uniqueAlt=0,this.conflictingAlts=null,this.hasSemanticContext=!1,this.dipsIntoOuterContext=!1,this.cachedHashCode=-1,this}c(Xe,"ATNConfigSet");Xe.prototype.add=function(u,e){if(e===void 0&&(e=null),this.readOnly)throw"This set is readonly";u.semanticContext!==tM.NONE&&(this.hasSemanticContext=!0),u.reachesIntoOuterContext>0&&(this.dipsIntoOuterContext=!0);var t=this.configLookup.add(u);if(t===u)return this.cachedHashCode=-1,this.configs.push(u),!0;var r=!this.fullCtx,i=Ni0(t.context,u.context,r,e);return t.reachesIntoOuterContext=Math.max(t.reachesIntoOuterContext,u.reachesIntoOuterContext),u.precedenceFilterSuppressed&&(t.precedenceFilterSuppressed=!0),t.context=i,!0};Xe.prototype.getStates=function(){for(var u=new zg,e=0;e{var ki0=en().ATNConfigSet,uM=Ie(),Bi0=uM.Hash,Di0=uM.Set;function rM(u,e){return this.alt=e,this.pred=u,this}c(rM,"PredPrediction");rM.prototype.toString=function(){return"("+this.pred+", "+this.alt+")"};function pc(u,e){return u===null&&(u=-1),e===null&&(e=new ki0),this.stateNumber=u,this.configs=e,this.edges=null,this.isAcceptState=!1,this.prediction=0,this.lexerActionExecutor=null,this.requiresFullContext=!1,this.predicates=null,this}c(pc,"DFAState");pc.prototype.getAltSet=function(){var u=new Di0;if(this.configs!==null)for(var e=0;e",this.predicates!==null?u=u+this.predicates:u=u+this.prediction),u};pc.prototype.hashCode=function(){var u=new Bi0;return u.update(this.configs),u.finish()};iA.DFAState=pc;iA.PredPrediction=rM});var nA=w(iM=>{var Fi0=Ta().DFAState,Mi0=en().ATNConfigSet,Hi0=Ii().getCachedPredictionContext,qi0=Ie().Map;function sA(u,e){return this.atn=u,this.sharedContextCache=e,this}c(sA,"ATNSimulator");sA.ERROR=new Fi0(2147483647,new Mi0);sA.prototype.getCachedContext=function(u){if(this.sharedContextCache===null)return u;var e=new qi0;return Hi0(u,this.sharedContextCache,e)};iM.ATNSimulator=sA});var nM=w(sM=>{var Vi0=Ie().hashStuff,aA=GR().LexerIndexedCustomAction;function jr(u){return this.lexerActions=u===null?[]:u,this.cachedHashCode=Vi0(u),this}c(jr,"LexerActionExecutor");jr.append=function(u,e){if(u===null)return new jr([e]);var t=u.lexerActions.concat([e]);return new jr(t)};jr.prototype.fixOffsetBeforeMatch=function(u){for(var e=null,t=0;t{var yc=Ze().Token,Yg=Rf().Lexer,Gi0=ji().ATN,Af=nA().ATNSimulator,Wi0=Ta().DFAState,mp0=en().ATNConfigSet,aM=en().OrderedATNConfigSet,oA=Ii().PredictionContext,zi0=Ii().SingletonPredictionContext,oM=Vr().RuleStopState,Ki=lf().LexerATNConfig,tn=Yi().Transition,Yi0=nM().LexerActionExecutor,Qi0=Qr().LexerNoViableAltException;function cM(u){u.index=-1,u.line=0,u.column=-1,u.dfaState=null}c(cM,"resetSimState");function lM(){return cM(this),this}c(lM,"SimState");lM.prototype.reset=function(){cM(this)};function b0(u,e,t,r){return Af.call(this,e,r),this.decisionToDFA=t,this.recog=u,this.startIndex=-1,this.line=1,this.column=0,this.mode=Yg.DEFAULT_MODE,this.prevAccept=new lM,this}c(b0,"LexerATNSimulator");b0.prototype=Object.create(Af.prototype);b0.prototype.constructor=b0;b0.debug=!1;b0.dfa_debug=!1;b0.MIN_DFA_EDGE=0;b0.MAX_DFA_EDGE=127;b0.match_calls=0;b0.prototype.copyState=function(u){this.column=u.column,this.line=u.line,this.mode=u.mode,this.startIndex=u.startIndex};b0.prototype.match=function(u,e){this.match_calls+=1,this.mode=e;var t=u.mark();try{this.startIndex=u.index,this.prevAccept.reset();var r=this.decisionToDFA[e];return r.s0===null?this.matchATN(u):this.execATN(u,r.s0)}finally{u.release(t)}};b0.prototype.reset=function(){this.prevAccept.reset(),this.startIndex=-1,this.line=1,this.column=0,this.mode=Yg.DEFAULT_MODE};b0.prototype.matchATN=function(u){var e=this.atn.modeToStartState[this.mode];b0.debug&&console.log("matchATN mode "+this.mode+" start: "+e);var t=this.mode,r=this.computeStartState(u,e),i=r.hasSemanticContext;r.hasSemanticContext=!1;var s=this.addDFAState(r);i||(this.decisionToDFA[this.mode].s0=s);var a=this.execATN(u,s);return b0.debug&&console.log("DFA after matchATN: "+this.decisionToDFA[t].toLexerString()),a};b0.prototype.execATN=function(u,e){b0.debug&&console.log("start state closure="+e.configs),e.isAcceptState&&this.captureSimState(this.prevAccept,u,e);for(var t=u.LA(1),r=e;;){b0.debug&&console.log("execATN loop starting closure: "+r.configs);var i=this.getExistingTargetState(r,t);if(i===null&&(i=this.computeTargetState(u,r,t)),i===Af.ERROR||(t!==yc.EOF&&this.consume(u),i.isAcceptState&&(this.captureSimState(this.prevAccept,u,i),t===yc.EOF)))break;t=u.LA(1),r=i}return this.failOrAccept(this.prevAccept,u,r.configs,t)};b0.prototype.getExistingTargetState=function(u,e){if(u.edges===null||eb0.MAX_DFA_EDGE)return null;var t=u.edges[e-b0.MIN_DFA_EDGE];return t===void 0&&(t=null),b0.debug&&t!==null&&console.log("reuse state "+u.stateNumber+" edge to "+t.stateNumber),t};b0.prototype.computeTargetState=function(u,e,t){var r=new aM;return this.getReachableConfigSet(u,e.configs,r,t),r.items.length===0?(r.hasSemanticContext||this.addDFAEdge(e,t,Af.ERROR),Af.ERROR):this.addDFAEdge(e,t,null,r)};b0.prototype.failOrAccept=function(u,e,t,r){if(this.prevAccept.dfaState!==null){var i=u.dfaState.lexerActionExecutor;return this.accept(e,i,this.startIndex,u.index,u.line,u.column),u.dfaState.prediction}else{if(r===yc.EOF&&e.index===this.startIndex)return yc.EOF;throw new Qi0(this.recog,e,this.startIndex,t)}};b0.prototype.getReachableConfigSet=function(u,e,t,r){for(var i=Gi0.INVALID_ALT_NUMBER,s=0;sb0.MAX_DFA_EDGE||(b0.debug&&console.log("EDGE "+u+" -> "+t+" upon "+e),u.edges===null&&(u.edges=[]),u.edges[e-b0.MIN_DFA_EDGE]=t),t};b0.prototype.addDFAState=function(u){for(var e=new Wi0(null,u),t=null,r=0;r{var bp0=Ie().Set,ji0=Ie().Map,cA=Ie().BitSet,$i0=Ie().AltDict,dM=ji().ATN,pM=Vr().RuleStopState,Zi0=en().ATNConfigSet,Xi0=lf().ATNConfig,Ji0=ca().SemanticContext,_p0=Ie().Hash,es0=Ie().hashStuff,Cp0=Ie().equalArrays;function xe(){return this}c(xe,"PredictionMode");xe.SLL=0;xe.LL=1;xe.LL_EXACT_AMBIG_DETECTION=2;xe.hasSLLConflictTerminatingPrediction=function(u,e){if(xe.allConfigsInRuleStopStates(e))return!0;if(u===xe.SLL&&e.hasSemanticContext){for(var t=new Zi0,r=0;r1)return!0}return!1};xe.allSubsetsEqual=function(u){for(var e=null,t=0;t{var _a=Ie(),mM=_a.Set,xM=_a.BitSet,ts0=_a.DoubleDict,Gt=ji().ATN,Qg=Vr().ATNState,Jt=lf().ATNConfig,ba=en().ATNConfigSet,us=Ze().Token,hA=Ta().DFAState,us0=Ta().PredPrediction,gc=nA().ATNSimulator,Vt=lA().PredictionMode,gM=Ef().RuleContext,wp0=kg().ParserRuleContext,rn=ca().SemanticContext,vp0=Vr().StarLoopEntryState,wf=Vr().RuleStopState,EM=Ii().PredictionContext,fA=Zt().Interval,vf=Yi(),un=vf.Transition,rs0=vf.SetTransition,is0=vf.NotSetTransition,ss0=vf.RuleTransition,ns0=vf.ActionTransition,as0=Qr().NoViableAltException,os0=Ii().SingletonPredictionContext,cs0=Ii().predictionContextFromRuleContext;function m0(u,e,t,r){return gc.call(this,e,r),this.parser=u,this.decisionToDFA=t,this.predictionMode=Vt.LL,this._input=null,this._startIndex=0,this._outerContext=null,this._dfa=null,this.mergeCache=null,this}c(m0,"ParserATNSimulator");m0.prototype=Object.create(gc.prototype);m0.prototype.constructor=m0;m0.prototype.debug=!1;m0.prototype.debug_closure=!1;m0.prototype.debug_add=!1;m0.prototype.debug_list_atn_decisions=!1;m0.prototype.dfa_debug=!1;m0.prototype.retry_debug=!1;m0.prototype.reset=function(){};m0.prototype.adaptivePredict=function(u,e,t){(this.debug||this.debug_list_atn_decisions)&&console.log("adaptivePredict decision "+e+" exec LA(1)=="+this.getLookaheadName(u)+" line "+u.LT(1).line+":"+u.LT(1).column),this._input=u,this._startIndex=u.index,this._outerContext=t;var r=this.decisionToDFA[e];this._dfa=r;var i=u.mark(),s=u.index;try{var a;if(r.precedenceDfa?a=r.getPrecedenceStartState(this.parser.getPrecedence()):a=r.s0,a===null){t===null&&(t=gM.EMPTY),(this.debug||this.debug_list_atn_decisions)&&console.log("predictATN decision "+r.decision+" exec LA(1)=="+this.getLookaheadName(u)+", outerContext="+t.toString(this.parser.ruleNames));var o=!1,h=this.computeStartState(r.atnStartState,gM.EMPTY,o);r.precedenceDfa?(r.s0.configs=h,h=this.applyPrecedenceFilter(h),a=this.addDFAState(r,new hA(null,h)),r.setPrecedenceStartState(this.parser.getPrecedence(),a)):(a=this.addDFAState(r,new hA(null,h)),r.s0=a)}var f=this.execATN(r,a,u,s,t);return this.debug&&console.log("DFA after predictATN: "+r.toString(this.parser.literalNames)),f}finally{this._dfa=null,this.mergeCache=null,u.seek(s),u.release(i)}};m0.prototype.execATN=function(u,e,t,r,i){(this.debug||this.debug_list_atn_decisions)&&console.log("execATN decision "+u.decision+" exec LA(1)=="+this.getLookaheadName(t)+" line "+t.LT(1).line+":"+t.LT(1).column);var s,a=e;this.debug&&console.log("s0 = "+e);for(var o=t.LA(1);;){var h=this.getExistingTargetState(a,o);if(h===null&&(h=this.computeTargetState(u,a,o)),h===gc.ERROR){var f=this.noViableAlt(t,i,a.configs,r);if(t.seek(r),s=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(a.configs,i),s!==Gt.INVALID_ALT_NUMBER)return s;throw f}if(h.requiresFullContext&&this.predictionMode!==Vt.SLL){var d=null;if(h.predicates!==null){this.debug&&console.log("DFA state has preds in DFA sim LL failover");var p=t.index;if(p!==r&&t.seek(r),d=this.evalSemanticContext(h.predicates,i,!0),d.length===1)return this.debug&&console.log("Full LL avoided"),d.minValue();p!==r&&t.seek(p)}this.dfa_debug&&console.log("ctx sensitive state "+i+" in "+h);var E=!0,x=this.computeStartState(u.atnStartState,i,E);return this.reportAttemptingFullContext(u,d,h.configs,r,t.index),s=this.execATNWithFullContext(u,h,x,t,r,i),s}if(h.isAcceptState){if(h.predicates===null)return h.prediction;var g=t.index;t.seek(r);var m=this.evalSemanticContext(h.predicates,i,!0);if(m.length===0)throw this.noViableAlt(t,i,h.configs,r);return m.length===1||this.reportAmbiguity(u,h,r,g,!1,m,h.configs),m.minValue()}a=h,o!==us.EOF&&(t.consume(),o=t.LA(1))}};m0.prototype.getExistingTargetState=function(u,e){var t=u.edges;return t===null?null:t[e+1]||null};m0.prototype.computeTargetState=function(u,e,t){var r=this.computeReachSet(e.configs,t,!1);if(r===null)return this.addDFAEdge(u,e,t,gc.ERROR),gc.ERROR;var i=new hA(null,r),s=this.getUniqueAlt(r);if(this.debug){var a=Vt.getConflictingAltSubsets(r);console.log("SLL altSubSets="+_a.arrayToString(a)+", previous="+e.configs+", configs="+r+", predict="+s+", allSubsetsConflict="+Vt.allSubsetsConflict(a)+", conflictingAlts="+this.getConflictingAlts(r))}return s!==Gt.INVALID_ALT_NUMBER?(i.isAcceptState=!0,i.configs.uniqueAlt=s,i.prediction=s):Vt.hasSLLConflictTerminatingPrediction(this.predictionMode,r)&&(i.configs.conflictingAlts=this.getConflictingAlts(r),i.requiresFullContext=!0,i.isAcceptState=!0,i.prediction=i.configs.conflictingAlts.minValue()),i.isAcceptState&&i.configs.hasSemanticContext&&(this.predicateDFAState(i,this.atn.getDecisionState(u.decision)),i.predicates!==null&&(i.prediction=Gt.INVALID_ALT_NUMBER)),i=this.addDFAEdge(u,e,t,i),i};m0.prototype.predicateDFAState=function(u,e){var t=e.transitions.length,r=this.getConflictingAltsOrUniqueAlt(u.configs),i=this.getPredsForAmbigAlts(r,u.configs,t);i!==null?(u.predicates=this.getPredicatePredictions(r,i),u.prediction=Gt.INVALID_ALT_NUMBER):u.prediction=r.minValue()};m0.prototype.execATNWithFullContext=function(u,e,t,r,i,s){(this.debug||this.debug_list_atn_decisions)&&console.log("execATNWithFullContext "+t);var a=!0,o=!1,h=null,f=t;r.seek(i);for(var d=r.LA(1),p=-1;;){if(h=this.computeReachSet(f,d,a),h===null){var E=this.noViableAlt(r,s,f,i);r.seek(i);var x=this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(f,s);if(x!==Gt.INVALID_ALT_NUMBER)return x;throw E}var g=Vt.getConflictingAltSubsets(h);if(this.debug&&console.log("LL altSubSets="+g+", predict="+Vt.getUniqueAlt(g)+", resolvesToJustOneViableAlt="+Vt.resolvesToJustOneViableAlt(g)),h.uniqueAlt=this.getUniqueAlt(h),h.uniqueAlt!==Gt.INVALID_ALT_NUMBER){p=h.uniqueAlt;break}else if(this.predictionMode!==Vt.LL_EXACT_AMBIG_DETECTION){if(p=Vt.resolvesToJustOneViableAlt(g),p!==Gt.INVALID_ALT_NUMBER)break}else if(Vt.allSubsetsConflict(g)&&Vt.allSubsetsEqual(g)){o=!0,p=Vt.getSingleViableAlt(g);break}f=h,d!==us.EOF&&(r.consume(),d=r.LA(1))}return h.uniqueAlt!==Gt.INVALID_ALT_NUMBER?(this.reportContextSensitivity(u,p,h,i,r.index),p):(this.reportAmbiguity(u,e,i,r.index,o,null,h),p)};m0.prototype.computeReachSet=function(u,e,t){this.debug&&console.log("in computeReachSet, starting closure: "+u),this.mergeCache===null&&(this.mergeCache=new ts0);for(var r=new ba(t),i=null,s=0;s0&&(s=this.getAltThatFinishedDecisionEntryRule(i),s!==Gt.INVALID_ALT_NUMBER)?s:Gt.INVALID_ALT_NUMBER};m0.prototype.getAltThatFinishedDecisionEntryRule=function(u){for(var e=[],t=0;t0||r.state instanceof wf&&r.context.hasEmptyPath())&&e.indexOf(r.alt)<0&&e.push(r.alt)}return e.length===0?Gt.INVALID_ALT_NUMBER:Math.min.apply(null,e)};m0.prototype.splitAccordingToSemanticValidity=function(u,e){for(var t=new ba(u.fullCtx),r=new ba(u.fullCtx),i=0;i50))throw"problem";if(u.state instanceof wf)if(u.context.isEmpty())if(i){e.add(u,this.mergeCache);return}else this.debug&&console.log("FALLING off rule "+this.getRuleName(u.state.ruleIndex));else{for(var o=0;o=0&&(E+=1)}this.closureCheckingStopState(p,e,t,d,i,E,a)}}};m0.prototype.canDropLoopEntryEdgeInLeftRecursiveRule=function(u){var e=u.state;if(e.stateType!=Qg.STAR_LOOP_ENTRY||e.stateType!=Qg.STAR_LOOP_ENTRY||!e.isPrecedenceDecision||u.context.isEmpty()||u.context.hasEmptyPath())return!1;for(var t=u.context.length,r=0;r=0?this.parser.ruleNames[u]:""};m0.prototype.getEpsilonTarget=function(u,e,t,r,i,s){switch(e.serializationType){case un.RULE:return this.ruleTransition(u,e);case un.PRECEDENCE:return this.precedenceTransition(u,e,t,r,i);case un.PREDICATE:return this.predTransition(u,e,t,r,i);case un.ACTION:return this.actionTransition(u,e);case un.EPSILON:return new Jt({state:e.target},u);case un.ATOM:case un.RANGE:case un.SET:return s&&e.matches(us.EOF,0,1)?new Jt({state:e.target},u):null;default:return null}};m0.prototype.actionTransition=function(u,e){if(this.debug){var t=e.actionIndex==-1?65535:e.actionIndex;console.log("ACTION edge "+e.ruleIndex+":"+t)}return new Jt({state:e.target},u)};m0.prototype.precedenceTransition=function(u,e,t,r,i){this.debug&&(console.log("PRED (collectPredicates="+t+") "+e.precedence+">=_p, ctx dependent=true"),this.parser!==null&&console.log("context surrounding pred is "+_a.arrayToString(this.parser.getRuleInvocationStack())));var s=null;if(t&&r)if(i){var a=this._input.index;this._input.seek(this._startIndex);var o=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(a),o&&(s=new Jt({state:e.target},u))}else{var h=rn.andContext(u.semanticContext,e.getPredicate());s=new Jt({state:e.target,semanticContext:h},u)}else s=new Jt({state:e.target},u);return this.debug&&console.log("config from pred transition="+s),s};m0.prototype.predTransition=function(u,e,t,r,i){this.debug&&(console.log("PRED (collectPredicates="+t+") "+e.ruleIndex+":"+e.predIndex+", ctx dependent="+e.isCtxDependent),this.parser!==null&&console.log("context surrounding pred is "+_a.arrayToString(this.parser.getRuleInvocationStack())));var s=null;if(t&&(e.isCtxDependent&&r||!e.isCtxDependent))if(i){var a=this._input.index;this._input.seek(this._startIndex);var o=e.getPredicate().evaluate(this.parser,this._outerContext);this._input.seek(a),o&&(s=new Jt({state:e.target},u))}else{var h=rn.andContext(u.semanticContext,e.getPredicate());s=new Jt({state:e.target,semanticContext:h},u)}else s=new Jt({state:e.target},u);return this.debug&&console.log("config from pred transition="+s),s};m0.prototype.ruleTransition=function(u,e){this.debug&&console.log("CALL rule "+this.getRuleName(e.target.ruleIndex)+", ctx="+u.context);var t=e.followState,r=os0.create(u.context,t.stateNumber);return new Jt({state:e.target,context:r},u)};m0.prototype.getConflictingAlts=function(u){var e=Vt.getConflictingAltSubsets(u);return Vt.getAlts(e)};m0.prototype.getConflictingAltsOrUniqueAlt=function(u){var e=null;return u.uniqueAlt!==Gt.INVALID_ALT_NUMBER?(e=new xM,e.add(u.uniqueAlt)):e=u.conflictingAlts,e};m0.prototype.getTokenName=function(u){if(u===us.EOF)return"EOF";if(this.parser!==null&&this.parser.literalNames!==null)if(u>=this.parser.literalNames.length&&u>=this.parser.symbolicNames.length)console.log(""+u+" ttype out of range: "+this.parser.literalNames),console.log(""+this.parser.getInputStream().getTokens());else{var e=this.parser.literalNames[u]||this.parser.symbolicNames[u];return e+"<"+u+">"}return""+u};m0.prototype.getLookaheadName=function(u){return this.getTokenName(u.LA(1))};m0.prototype.dumpDeadEndConfigs=function(u){console.log("dead end configs: ");for(var e=u.getDeadEndConfigs(),t=0;t0){var s=r.state.transitions[0];if(s instanceof AtomTransition)i="Atom "+this.getTokenName(s.label);else if(s instanceof rs0){var a=s instanceof is0;i=(a?"~":"")+"Set "+s.set}}console.error(r.toString(this.parser,!0)+":"+i)}};m0.prototype.noViableAlt=function(u,e,t,r){return new as0(this.parser,u,u.get(r),u.LT(1),t,e)};m0.prototype.getUniqueAlt=function(u){for(var e=Gt.INVALID_ALT_NUMBER,t=0;t "+r+" upon "+this.getTokenName(t)),r===null)return null;if(r=this.addDFAState(u,r),e===null||t<-1||t>this.atn.maxTokenType)return r;if(e.edges===null&&(e.edges=[]),e.edges[t+1]=r,this.debug){var i=this.parser===null?null:this.parser.literalNames,s=this.parser===null?null:this.parser.symbolicNames;console.log(`DFA= +`+u.toString(i,s))}return r};m0.prototype.addDFAState=function(u,e){if(e==gc.ERROR)return e;var t=u.states.get(e);return t!==null?t:(e.stateNumber=u.states.length,e.configs.readOnly||(e.configs.optimizeConfigs(this),e.configs.setReadonly(!0)),u.states.add(e),this.debug&&console.log("adding new DFA state: "+e),e)};m0.prototype.reportAttemptingFullContext=function(u,e,t,r,i){if(this.debug||this.retry_debug){var s=new fA(r,i+1);console.log("reportAttemptingFullContext decision="+u.decision+":"+t+", input="+this.parser.getTokenStream().getText(s))}this.parser!==null&&this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser,u,r,i,e,t)};m0.prototype.reportContextSensitivity=function(u,e,t,r,i){if(this.debug||this.retry_debug){var s=new fA(r,i+1);console.log("reportContextSensitivity decision="+u.decision+":"+t+", input="+this.parser.getTokenStream().getText(s))}this.parser!==null&&this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser,u,r,i,e,t)};m0.prototype.reportAmbiguity=function(u,e,t,r,i,s,a){if(this.debug||this.retry_debug){var o=new fA(t,r+1);console.log("reportAmbiguity "+s+":"+a+", input="+this.parser.getTokenStream().getText(o))}this.parser!==null&&this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser,u,t,r,i,s,a)};TM.ParserATNSimulator=m0});var _M=w(Ec=>{Ec.ATN=ji().ATN;Ec.ATNDeserializer=eA().ATNDeserializer;Ec.LexerATNSimulator=fM().LexerATNSimulator;Ec.ParserATNSimulator=bM().ParserATNSimulator;Ec.PredictionMode=lA().PredictionMode});var dA=w(()=>{String.prototype.codePointAt||function(){"use strict";var u=function(){try{var t={},r=Object.defineProperty,i=r(t,t,t)&&r}catch{}return i}(),e=c(function(t){if(this==null)throw TypeError();var r=String(this),i=r.length,s=t?Number(t):0;if(s!=s&&(s=0),!(s<0||s>=i)){var a=r.charCodeAt(s),o;return a>=55296&&a<=56319&&i>s+1&&(o=r.charCodeAt(s+1),o>=56320&&o<=57343)?(a-55296)*1024+o-56320+65536:a}},"codePointAt");u?u(String.prototype,"codePointAt",{value:e,configurable:!0,writable:!0}):String.prototype.codePointAt=e}()});var Lf=w(pA=>{function mc(u,e,t){return this.dfa=u,this.literalNames=e||[],this.symbolicNames=t||[],this}c(mc,"DFASerializer");mc.prototype.toString=function(){if(this.dfa.s0===null)return null;for(var u="",e=this.dfa.sortedStates(),t=0;t"),u=u.concat(this.getStateString(a)),u=u.concat(` +`))}}return u.length===0?null:u};mc.prototype.getEdgeLabel=function(u){return u===0?"EOF":this.literalNames!==null||this.symbolicNames!==null?this.literalNames[u-1]||this.symbolicNames[u-1]:String.fromCharCode(u-1)};mc.prototype.getStateString=function(u){var e=(u.isAcceptState?":":"")+"s"+u.stateNumber+(u.requiresFullContext?"^":"");return u.isAcceptState?u.predicates!==null?e+"=>"+u.predicates.toString():e+"=>"+u.prediction.toString():e};function If(u){return mc.call(this,u,null),this}c(If,"LexerDFASerializer");If.prototype=Object.create(mc.prototype);If.prototype.constructor=If;If.prototype.getEdgeLabel=function(u){return"'"+String.fromCharCode(u)+"'"};pA.DFASerializer=mc;pA.LexerDFASerializer=If});var wM=w(AM=>{var ls0=Ie().Set,CM=Ta().DFAState,hs0=Vr().StarLoopEntryState,RM=en().ATNConfigSet,fs0=Lf().DFASerializer,ds0=Lf().LexerDFASerializer;function sn(u,e){if(e===void 0&&(e=0),this.atnStartState=u,this.decision=e,this._states=new ls0,this.s0=null,this.precedenceDfa=!1,u instanceof hs0&&u.isPrecedenceDecision){this.precedenceDfa=!0;var t=new CM(null,new RM);t.edges=[],t.isAcceptState=!1,t.requiresFullContext=!1,this.s0=t}return this}c(sn,"DFA");sn.prototype.getPrecedenceStartState=function(u){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";return u<0||u>=this.s0.edges.length?null:this.s0.edges[u]||null};sn.prototype.setPrecedenceStartState=function(u,e){if(!this.precedenceDfa)throw"Only precedence DFAs may contain a precedence start state.";u<0||(this.s0.edges[u]=e)};sn.prototype.setPrecedenceDfa=function(u){if(this.precedenceDfa!==u){if(this._states=new DFAStatesSet,u){var e=new CM(null,new RM);e.edges=[],e.isAcceptState=!1,e.requiresFullContext=!1,this.s0=e}else this.s0=null;this.precedenceDfa=u}};Object.defineProperty(sn.prototype,"states",{get:function(){return this._states}});sn.prototype.sortedStates=function(){var u=this._states.values();return u.sort(function(e,t){return e.stateNumber-t.stateNumber})};sn.prototype.toString=function(u,e){if(u=u||null,e=e||null,this.s0===null)return"";var t=new fs0(this,u,e);return t.toString()};sn.prototype.toLexerString=function(){if(this.s0===null)return"";var u=new ds0(this);return u.toString()};AM.DFA=sn});var vM=w(Sf=>{Sf.DFA=wM().DFA;Sf.DFASerializer=Lf().DFASerializer;Sf.LexerDFASerializer=Lf().LexerDFASerializer;Sf.PredPrediction=Ta().PredPrediction});var yA=w(()=>{String.fromCodePoint||function(){var u=function(){try{var i={},s=Object.defineProperty,a=s(i,i,i)&&s}catch{}return a}(),e=String.fromCharCode,t=Math.floor,r=c(function(i){var s=16384,a=[],o,h,f=-1,d=arguments.length;if(!d)return"";for(var p="";++f1114111||t(E)!=E)throw RangeError("Invalid code point: "+E);E<=65535?a.push(E):(E-=65536,o=(E>>10)+55296,h=E%1024+56320,a.push(o,h)),(f+1==d||a.length>s)&&(p+=e.apply(null,a),a.length=0)}return p},"fromCodePoint");u?u(String,"fromCodePoint",{value:r,configurable:!0,writable:!0}):String.fromCodePoint=r}()});var IM=w(xc=>{var jg=Gr();xc.Trees=FR().Trees;xc.RuleNode=jg.RuleNode;xc.ParseTreeListener=jg.ParseTreeListener;xc.ParseTreeVisitor=jg.ParseTreeVisitor;xc.ParseTreeWalker=jg.ParseTreeWalker});var KM=w(SM=>{var ps0=Ie().BitSet,LM=Tf().ErrorListener,gA=Zt().Interval;function rs(u){return LM.call(this),u=u||!0,this.exactOnly=u,this}c(rs,"DiagnosticErrorListener");rs.prototype=Object.create(LM.prototype);rs.prototype.constructor=rs;rs.prototype.reportAmbiguity=function(u,e,t,r,i,s,a){if(!(this.exactOnly&&!i)){var o="reportAmbiguity d="+this.getDecisionDescription(u,e)+": ambigAlts="+this.getConflictingAlts(s,a)+", input='"+u.getTokenStream().getText(new gA(t,r))+"'";u.notifyErrorListeners(o)}};rs.prototype.reportAttemptingFullContext=function(u,e,t,r,i,s){var a="reportAttemptingFullContext d="+this.getDecisionDescription(u,e)+", input='"+u.getTokenStream().getText(new gA(t,r))+"'";u.notifyErrorListeners(a)};rs.prototype.reportContextSensitivity=function(u,e,t,r,i,s){var a="reportContextSensitivity d="+this.getDecisionDescription(u,e)+", input='"+u.getTokenStream().getText(new gA(t,r))+"'";u.notifyErrorListeners(a)};rs.prototype.getDecisionDescription=function(u,e){var t=e.decision,r=e.atnStartState.ruleIndex,i=u.ruleNames;if(r<0||r>=i.length)return""+t;var s=i[r]||null;return s===null||s.length===0?""+t:""+t+" ("+s+")"};rs.prototype.getConflictingAlts=function(u,e){if(u!==null)return u;for(var t=new ps0,r=0;r{var nn=Ze().Token,$g=Qr(),ys0=$g.NoViableAltException,Zg=$g.InputMismatchException,gs0=$g.FailedPredicateException,Es0=$g.ParseCancellationException,Tc=Vr().ATNState,ms0=Zt().Interval,OM=Zt().IntervalSet;function an(){}c(an,"ErrorStrategy");an.prototype.reset=function(u){};an.prototype.recoverInline=function(u){};an.prototype.recover=function(u,e){};an.prototype.sync=function(u){};an.prototype.inErrorRecoveryMode=function(u){};an.prototype.reportError=function(u){};function de(){return an.call(this),this.errorRecoveryMode=!1,this.lastErrorIndex=-1,this.lastErrorStates=null,this}c(de,"DefaultErrorStrategy");de.prototype=Object.create(an.prototype);de.prototype.constructor=de;de.prototype.reset=function(u){this.endErrorCondition(u)};de.prototype.beginErrorCondition=function(u){this.errorRecoveryMode=!0};de.prototype.inErrorRecoveryMode=function(u){return this.errorRecoveryMode};de.prototype.endErrorCondition=function(u){this.errorRecoveryMode=!1,this.lastErrorStates=null,this.lastErrorIndex=-1};de.prototype.reportMatch=function(u){this.endErrorCondition(u)};de.prototype.reportError=function(u,e){this.inErrorRecoveryMode(u)||(this.beginErrorCondition(u),e instanceof ys0?this.reportNoViableAlternative(u,e):e instanceof Zg?this.reportInputMismatch(u,e):e instanceof gs0?this.reportFailedPredicate(u,e):(console.log("unknown recognition error type: "+e.constructor.name),console.log(e.stack),u.notifyErrorListeners(e.getOffendingToken(),e.getMessage(),e)))};de.prototype.recover=function(u,e){this.lastErrorIndex===u.getInputStream().index&&this.lastErrorStates!==null&&this.lastErrorStates.indexOf(u.state)>=0&&u.consume(),this.lastErrorIndex=u._input.index,this.lastErrorStates===null&&(this.lastErrorStates=[]),this.lastErrorStates.push(u.state);var t=this.getErrorRecoverySet(u);this.consumeUntil(u,t)};de.prototype.sync=function(u){if(!this.inErrorRecoveryMode(u)){var e=u._interp.atn.states[u.state],t=u.getTokenStream().LA(1),r=u.atn.nextTokens(e);if(!(r.contains(nn.EPSILON)||r.contains(t)))switch(e.stateType){case Tc.BLOCK_START:case Tc.STAR_BLOCK_START:case Tc.PLUS_BLOCK_START:case Tc.STAR_LOOP_ENTRY:if(this.singleTokenDeletion(u)!==null)return;throw new Zg(u);case Tc.PLUS_LOOP_BACK:case Tc.STAR_LOOP_BACK:this.reportUnwantedToken(u);var i=new OM;i.addSet(u.getExpectedTokens());var s=i.addSet(this.getErrorRecoverySet(u));this.consumeUntil(u,s);break;default:}}};de.prototype.reportNoViableAlternative=function(u,e){var t=u.getTokenStream(),r;t!==null?e.startToken.type===nn.EOF?r="":r=t.getText(new ms0(e.startToken.tokenIndex,e.offendingToken.tokenIndex)):r="";var i="no viable alternative at input "+this.escapeWSAndQuote(r);u.notifyErrorListeners(i,e.offendingToken,e)};de.prototype.reportInputMismatch=function(u,e){var t="mismatched input "+this.getTokenErrorDisplay(e.offendingToken)+" expecting "+e.getExpectedTokens().toString(u.literalNames,u.symbolicNames);u.notifyErrorListeners(t,e.offendingToken,e)};de.prototype.reportFailedPredicate=function(u,e){var t=u.ruleNames[u._ctx.ruleIndex],r="rule "+t+" "+e.message;u.notifyErrorListeners(r,e.offendingToken,e)};de.prototype.reportUnwantedToken=function(u){if(!this.inErrorRecoveryMode(u)){this.beginErrorCondition(u);var e=u.getCurrentToken(),t=this.getTokenErrorDisplay(e),r=this.getExpectedTokens(u),i="extraneous input "+t+" expecting "+r.toString(u.literalNames,u.symbolicNames);u.notifyErrorListeners(i,e,null)}};de.prototype.reportMissingToken=function(u){if(!this.inErrorRecoveryMode(u)){this.beginErrorCondition(u);var e=u.getCurrentToken(),t=this.getExpectedTokens(u),r="missing "+t.toString(u.literalNames,u.symbolicNames)+" at "+this.getTokenErrorDisplay(e);u.notifyErrorListeners(r,e,null)}};de.prototype.recoverInline=function(u){var e=this.singleTokenDeletion(u);if(e!==null)return u.consume(),e;if(this.singleTokenInsertion(u))return this.getMissingSymbol(u);throw new Zg(u)};de.prototype.singleTokenInsertion=function(u){var e=u.getTokenStream().LA(1),t=u._interp.atn,r=t.states[u.state],i=r.transitions[0].target,s=t.nextTokens(i,u._ctx);return s.contains(e)?(this.reportMissingToken(u),!0):!1};de.prototype.singleTokenDeletion=function(u){var e=u.getTokenStream().LA(2),t=this.getExpectedTokens(u);if(t.contains(e)){this.reportUnwantedToken(u),u.consume();var r=u.getCurrentToken();return this.reportMatch(u),r}else return null};de.prototype.getMissingSymbol=function(u){var e=u.getCurrentToken(),t=this.getExpectedTokens(u),r=t.first(),i;r===nn.EOF?i="":i="";var s=e,a=u.getTokenStream().LT(-1);return s.type===nn.EOF&&a!==null&&(s=a),u.getTokenFactory().create(s.source,r,i,nn.DEFAULT_CHANNEL,-1,-1,s.line,s.column)};de.prototype.getExpectedTokens=function(u){return u.getExpectedTokens()};de.prototype.getTokenErrorDisplay=function(u){if(u===null)return"";var e=u.text;return e===null&&(u.type===nn.EOF?e="":e="<"+u.type+">"),this.escapeWSAndQuote(e)};de.prototype.escapeWSAndQuote=function(u){return u=u.replace(/\n/g,"\\n"),u=u.replace(/\r/g,"\\r"),u=u.replace(/\t/g,"\\t"),"'"+u+"'"};de.prototype.getErrorRecoverySet=function(u){for(var e=u._interp.atn,t=u._ctx,r=new OM;t!==null&&t.invokingState>=0;){var i=e.states[t.invokingState],s=i.transitions[0],a=e.nextTokens(s.followState);r.addSet(a),t=t.parentCtx}return r.removeOne(nn.EPSILON),r};de.prototype.consumeUntil=function(u,e){for(var t=u.getTokenStream().LA(1);t!==nn.EOF&&!e.contains(t);)u.consume(),t=u.getTokenStream().LA(1)};function Ca(){return de.call(this),this}c(Ca,"BailErrorStrategy");Ca.prototype=Object.create(de.prototype);Ca.prototype.constructor=Ca;Ca.prototype.recover=function(u,e){for(var t=u._ctx;t!==null;)t.exception=e,t=t.parentCtx;throw new Es0(e)};Ca.prototype.recoverInline=function(u){this.recover(u,new Zg(u))};Ca.prototype.sync=function(u){};EA.BailErrorStrategy=Ca;EA.DefaultErrorStrategy=de});var NM=w(is=>{is.RecognitionException=Qr().RecognitionException;is.NoViableAltException=Qr().NoViableAltException;is.LexerNoViableAltException=Qr().LexerNoViableAltException;is.InputMismatchException=Qr().InputMismatchException;is.FailedPredicateException=Qr().FailedPredicateException;is.DiagnosticErrorListener=KM().DiagnosticErrorListener;is.BailErrorStrategy=mA().BailErrorStrategy;is.ErrorListener=Tf().ErrorListener});var Xg=w(UM=>{var xs0=Ze().Token;dA();yA();function Ts0(u){if(u._index=0,u.data=[],u.decodeToUnicodeCodePoints)for(var e=0;e=this._size)throw"cannot consume EOF";this._index+=1};Ar.prototype.LA=function(u){if(u===0)return 0;u<0&&(u+=1);var e=this._index+u-1;return e<0||e>=this._size?xs0.EOF:this.data[e]};Ar.prototype.LT=function(u){return this.LA(u)};Ar.prototype.mark=function(){return-1};Ar.prototype.release=function(u){};Ar.prototype.seek=function(u){if(u<=this._index){this._index=u;return}this._index=Math.min(u,this._size)};Ar.prototype.getText=function(u,e){if(e>=this._size&&(e=this._size-1),u>=this._size)return"";if(this.decodeToUnicodeCodePoints){for(var t="",r=u;r<=e;r++)t+=String.fromCodePoint(this.data[r]);return t}else return this.strdata.slice(u,e+1)};Ar.prototype.toString=function(){return this.strdata};UM.InputStream=Ar});var BM=w(kM=>{var Kf=Xg().InputStream,bs0=typeof window>"u"&&typeof importScripts>"u",PM=bs0?require("fs"):null,_s0={fromString:function(u){return new Kf(u,!0)},fromBlob:function(u,e,t,r){var i=FileReader();i.onload=function(s){var a=new Kf(s.target.result,!0);t(a)},i.onerror=r,i.readAsText(u,e)},fromBuffer:function(u,e){return new Kf(u.toString(e),!0)},fromPath:function(u,e,t){PM.readFile(u,e,function(r,i){var s=null;i!==null&&(s=new Kf(i,!0)),t(r,s)})},fromPathSync:function(u,e){var t=PM.readFileSync(u,e);return new Kf(t,!0)}};kM.CharStreams=_s0});var MM=w(FM=>{var DM=Xg().InputStream,Cs0=typeof window>"u"&&typeof importScripts>"u",Rs0=Cs0?require("fs"):null;function Jg(u,e){var t=Rs0.readFileSync(u,"utf8");return DM.call(this,t,e),this.fileName=u,this}c(Jg,"FileStream");Jg.prototype=Object.create(DM.prototype);Jg.prototype.constructor=Jg;FM.FileStream=Jg});var VM=w(qM=>{var Ra=Ze().Token,xA=Rf().Lexer,As0=Zt().Interval;function HM(){return this}c(HM,"TokenStream");function pe(u){return HM.call(this),this.tokenSource=u,this.tokens=[],this.index=-1,this.fetchedEOF=!1,this}c(pe,"BufferedTokenStream");pe.prototype=Object.create(HM.prototype);pe.prototype.constructor=pe;pe.prototype.mark=function(){return 0};pe.prototype.release=function(u){};pe.prototype.reset=function(){this.seek(0)};pe.prototype.seek=function(u){this.lazyInit(),this.index=this.adjustSeekIndex(u)};pe.prototype.get=function(u){return this.lazyInit(),this.tokens[u]};pe.prototype.consume=function(){var u=!1;if(this.index>=0?this.fetchedEOF?u=this.index0){var t=this.fetch(e);return t>=e}return!0};pe.prototype.fetch=function(u){if(this.fetchedEOF)return 0;for(var e=0;e=this.tokens.length&&(e=this.tokens.length-1);for(var i=u;i=this.tokens.length?this.tokens[this.tokens.length-1]:this.tokens[e]};pe.prototype.adjustSeekIndex=function(u){return u};pe.prototype.lazyInit=function(){this.index===-1&&this.setup()};pe.prototype.setup=function(){this.sync(0),this.index=this.adjustSeekIndex(0)};pe.prototype.setTokenSource=function(u){this.tokenSource=u,this.tokens=[],this.index=-1,this.fetchedEOF=!1};pe.prototype.nextTokenOnChannel=function(u,e){if(this.sync(u),u>=this.tokens.length)return-1;for(var t=this.tokens[u];t.channel!==this.channel;){if(t.type===Ra.EOF)return-1;u+=1,this.sync(u),t=this.tokens[u]}return u};pe.prototype.previousTokenOnChannel=function(u,e){for(;u>=0&&this.tokens[u].channel!==e;)u-=1;return u};pe.prototype.getHiddenTokensToRight=function(u,e){if(e===void 0&&(e=-1),this.lazyInit(),u<0||u>=this.tokens.length)throw""+u+" not in 0.."+this.tokens.length-1;var t=this.nextTokenOnChannel(u+1,xA.DEFAULT_TOKEN_CHANNEL),r=u+1,i=t===-1?this.tokens.length-1:t;return this.filterForChannel(r,i,e)};pe.prototype.getHiddenTokensToLeft=function(u,e){if(e===void 0&&(e=-1),this.lazyInit(),u<0||u>=this.tokens.length)throw""+u+" not in 0.."+this.tokens.length-1;var t=this.previousTokenOnChannel(u-1,xA.DEFAULT_TOKEN_CHANNEL);if(t===u-1)return null;var r=t+1,i=u-1;return this.filterForChannel(r,i,e)};pe.prototype.filterForChannel=function(u,e,t){for(var r=[],i=u;i=this.tokens.length&&(t=this.tokens.length-1);for(var r="",i=e;i{var GM=Ze().Token,WM=VM().BufferedTokenStream;function on(u,e){return WM.call(this,u),this.channel=e===void 0?GM.DEFAULT_CHANNEL:e,this}c(on,"CommonTokenStream");on.prototype=Object.create(WM.prototype);on.prototype.constructor=on;on.prototype.adjustSeekIndex=function(u){return this.nextTokenOnChannel(u,this.channel)};on.prototype.LB=function(u){if(u===0||this.index-u<0)return null;for(var e=this.index,t=1;t<=u;)e=this.previousTokenOnChannel(e-1,this.channel),t+=1;return e<0?null:this.tokens[e]};on.prototype.LT=function(u){if(this.lazyInit(),u===0)return null;if(u<0)return this.LB(-u);for(var e=this.index,t=1;t{var Of=Ze().Token,QM=Gr().ParseTreeListener,jM=uA().Recognizer,ws0=mA().DefaultErrorStrategy,vs0=eA().ATNDeserializer,Is0=VR().ATNDeserializationOptions,Ls0=Gr().TerminalNode,Ss0=Gr().ErrorNode;function Aa(u){return QM.call(this),this.parser=u,this}c(Aa,"TraceListener");Aa.prototype=Object.create(QM.prototype);Aa.prototype.constructor=Aa;Aa.prototype.enterEveryRule=function(u){console.log("enter "+this.parser.ruleNames[u.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)};Aa.prototype.visitTerminal=function(u){console.log("consume "+u.symbol+" rule "+this.parser.ruleNames[this.parser._ctx.ruleIndex])};Aa.prototype.exitEveryRule=function(u){console.log("exit "+this.parser.ruleNames[u.ruleIndex]+", LT(1)="+this.parser._input.LT(1).text)};function C0(u){return jM.call(this),this._input=null,this._errHandler=new ws0,this._precedenceStack=[],this._precedenceStack.push(0),this._ctx=null,this.buildParseTrees=!0,this._tracer=null,this._parseListeners=null,this._syntaxErrors=0,this.setInputStream(u),this}c(C0,"Parser");C0.prototype=Object.create(jM.prototype);C0.prototype.contructor=C0;C0.bypassAltsAtnCache={};C0.prototype.reset=function(){this._input!==null&&this._input.seek(0),this._errHandler.reset(this),this._ctx=null,this._syntaxErrors=0,this.setTrace(!1),this._precedenceStack=[],this._precedenceStack.push(0),this._interp!==null&&this._interp.reset()};C0.prototype.match=function(u){var e=this.getCurrentToken();return e.type===u?(this._errHandler.reportMatch(this),this.consume()):(e=this._errHandler.recoverInline(this),this.buildParseTrees&&e.tokenIndex===-1&&this._ctx.addErrorNode(e)),e};C0.prototype.matchWildcard=function(){var u=this.getCurrentToken();return u.type>0?(this._errHandler.reportMatch(this),this.consume()):(u=this._errHandler.recoverInline(this),this._buildParseTrees&&u.tokenIndex===-1&&this._ctx.addErrorNode(u)),u};C0.prototype.getParseListeners=function(){return this._parseListeners||[]};C0.prototype.addParseListener=function(u){if(u===null)throw"listener";this._parseListeners===null&&(this._parseListeners=[]),this._parseListeners.push(u)};C0.prototype.removeParseListener=function(u){if(this._parseListeners!==null){var e=this._parseListeners.indexOf(u);e>=0&&this._parseListeners.splice(e,1),this._parseListeners.length===0&&(this._parseListeners=null)}};C0.prototype.removeParseListeners=function(){this._parseListeners=null};C0.prototype.triggerEnterRuleEvent=function(){if(this._parseListeners!==null){var u=this._ctx;this._parseListeners.map(function(e){e.enterEveryRule(u),u.enterRule(e)})}};C0.prototype.triggerExitRuleEvent=function(){if(this._parseListeners!==null){var u=this._ctx;this._parseListeners.slice(0).reverse().map(function(e){u.exitRule(e),e.exitEveryRule(u)})}};C0.prototype.getTokenFactory=function(){return this._input.tokenSource._factory};C0.prototype.setTokenFactory=function(u){this._input.tokenSource._factory=u};C0.prototype.getATNWithBypassAlts=function(){var u=this.getSerializedATN();if(u===null)throw"The current parser does not support an ATN with bypass alternatives.";var e=this.bypassAltsAtnCache[u];if(e===null){var t=new Is0;t.generateRuleBypassTransitions=!0,e=new vs0(t).deserialize(u),this.bypassAltsAtnCache[u]=e}return e};var Ks0=Rf().Lexer;C0.prototype.compileParseTreePattern=function(u,e,t){if(t=t||null,t===null&&this.getTokenStream()!==null){var r=this.getTokenStream().tokenSource;r instanceof Ks0&&(t=r)}if(t===null)throw"Parser can't discover a lexer to use";var i=new ParseTreePatternMatcher(t,this);return i.compile(u,e)};C0.prototype.getInputStream=function(){return this.getTokenStream()};C0.prototype.setInputStream=function(u){this.setTokenStream(u)};C0.prototype.getTokenStream=function(){return this._input};C0.prototype.setTokenStream=function(u){this._input=null,this.reset(),this._input=u};C0.prototype.getCurrentToken=function(){return this._input.LT(1)};C0.prototype.notifyErrorListeners=function(u,e,t){e=e||null,t=t||null,e===null&&(e=this.getCurrentToken()),this._syntaxErrors+=1;var r=e.line,i=e.column,s=this.getErrorListenerDispatch();s.syntaxError(this,e,r,i,u,t)};C0.prototype.consume=function(){var u=this.getCurrentToken();u.type!==Of.EOF&&this.getInputStream().consume();var e=this._parseListeners!==null&&this._parseListeners.length>0;if(this.buildParseTrees||e){var t;this._errHandler.inErrorRecoveryMode(this)?t=this._ctx.addErrorNode(u):t=this._ctx.addTokenNode(u),t.invokingState=this.state,e&&this._parseListeners.map(function(r){t instanceof Ss0||t.isErrorNode!==void 0&&t.isErrorNode()?r.visitErrorNode(t):t instanceof Ls0&&r.visitTerminal(t)})}return u};C0.prototype.addContextToParseTree=function(){this._ctx.parentCtx!==null&&this._ctx.parentCtx.addChild(this._ctx)};C0.prototype.enterRule=function(u,e,t){this.state=e,this._ctx=u,this._ctx.start=this._input.LT(1),this.buildParseTrees&&this.addContextToParseTree(),this._parseListeners!==null&&this.triggerEnterRuleEvent()};C0.prototype.exitRule=function(){this._ctx.stop=this._input.LT(-1),this._parseListeners!==null&&this.triggerExitRuleEvent(),this.state=this._ctx.invokingState,this._ctx=this._ctx.parentCtx};C0.prototype.enterOuterAlt=function(u,e){u.setAltNumber(e),this.buildParseTrees&&this._ctx!==u&&this._ctx.parentCtx!==null&&(this._ctx.parentCtx.removeLastChild(),this._ctx.parentCtx.addChild(u)),this._ctx=u};C0.prototype.getPrecedence=function(){return this._precedenceStack.length===0?-1:this._precedenceStack[this._precedenceStack.length-1]};C0.prototype.enterRecursionRule=function(u,e,t,r){this.state=e,this._precedenceStack.push(r),this._ctx=u,this._ctx.start=this._input.LT(1),this._parseListeners!==null&&this.triggerEnterRuleEvent()};C0.prototype.pushNewRecursionContext=function(u,e,t){var r=this._ctx;r.parentCtx=u,r.invokingState=e,r.stop=this._input.LT(-1),this._ctx=u,this._ctx.start=r.start,this.buildParseTrees&&this._ctx.addChild(r),this._parseListeners!==null&&this.triggerEnterRuleEvent()};C0.prototype.unrollRecursionContexts=function(u){this._precedenceStack.pop(),this._ctx.stop=this._input.LT(-1);var e=this._ctx;if(this._parseListeners!==null)for(;this._ctx!==u;)this.triggerExitRuleEvent(),this._ctx=this._ctx.parentCtx;else this._ctx=u;e.parentCtx=u,this.buildParseTrees&&u!==null&&u.addChild(e)};C0.prototype.getInvokingContext=function(u){for(var e=this._ctx;e!==null;){if(e.ruleIndex===u)return e;e=e.parentCtx}return null};C0.prototype.precpred=function(u,e){return e>=this._precedenceStack[this._precedenceStack.length-1]};C0.prototype.inContext=function(u){return!1};C0.prototype.isExpectedToken=function(u){var e=this._interp.atn,t=this._ctx,r=e.states[this.state],i=e.nextTokens(r);if(i.contains(u))return!0;if(!i.contains(Of.EPSILON))return!1;for(;t!==null&&t.invokingState>=0&&i.contains(Of.EPSILON);){var s=e.states[t.invokingState],a=s.transitions[0];if(i=e.nextTokens(a.followState),i.contains(u))return!0;t=t.parentCtx}return!!(i.contains(Of.EPSILON)&&u===Of.EOF)};C0.prototype.getExpectedTokens=function(){return this._interp.atn.getExpectedTokens(this.state,this._ctx)};C0.prototype.getExpectedTokensWithinCurrentRule=function(){var u=this._interp.atn,e=u.states[this.state];return u.nextTokens(e)};C0.prototype.getRuleIndex=function(u){var e=this.getRuleIndexMap()[u];return e!==null?e:-1};C0.prototype.getRuleInvocationStack=function(u){u=u||null,u===null&&(u=this._ctx);for(var e=[];u!==null;){var t=u.ruleIndex;t<0?e.push("n/a"):e.push(this.ruleNames[t]),u=u.parentCtx}return e};C0.prototype.getDFAStrings=function(){return this._interp.decisionToDFA.toString()};C0.prototype.dumpDFA=function(){for(var u=!1,e=0;e0&&(u&&console.log(),this.printer.println("Decision "+t.decision+":"),this.printer.print(t.toString(this.literalNames,this.symbolicNames)),u=!0)}};C0.prototype.getSourceName=function(){return this._input.sourceName};C0.prototype.setTrace=function(u){u?(this._tracer!==null&&this.removeParseListener(this._tracer),this._tracer=new Aa(this),this.addParseListener(this._tracer)):(this.removeParseListener(this._tracer),this._tracer=null)};$M.Parser=C0});var wa=w(ot=>{ot.atn=_M();ot.codepointat=dA();ot.dfa=vM();ot.fromcodepoint=yA();ot.tree=IM();ot.error=NM();ot.Token=Ze().Token;ot.CharStreams=BM().CharStreams;ot.CommonToken=Ze().CommonToken;ot.InputStream=Xg().InputStream;ot.FileStream=MM().FileStream;ot.CommonTokenStream=YM().CommonTokenStream;ot.Lexer=Rf().Lexer;ot.Parser=ZM().Parser;var Os0=Ii();ot.PredictionContextCache=Os0.PredictionContextCache;ot.ParserRuleContext=kg().ParserRuleContext;ot.Interval=Zt().Interval;ot.Utils=Ie()});var JM=w(XM=>{"use strict";var bc=wa(),Ns0=["\u608B\uA72A\u8133\uB9ED\u417C\u3BE7\u7786","\u5964\xE4\u0EB9\b  ","   \x07",` \x07\b \b  - async.map(keyspacesNames, (keyspaceName, keyspaceCallback) => { - const entityNames = cassandra.splitEntityNames(tables[keyspaceName]); - const viewNames = entityNames.views; - const tableNames = entityNames.tables; - - let udfData = []; - let udaData = []; - - cassandra.getUDF(keyspaceName) - .then(udf => { - progress(logger, keyspaceName, '', 'UDF has loaded'); - - udfData = cassandra.handleUDF(udf); - return cassandra.getUDA(keyspaceName) - }) - .then(uda => { - progress(logger, keyspaceName, '', 'UDA has loaded'); - - udaData = cassandra.handleUDA(uda); - - return cassandra.getViews(recordSamplingSettings, keyspaceName, viewNames, logger); - }) - .then(views => { - pipeline(udaData, udfData, views); - }, err => { - pipeline([], [], []); - }) - .catch(err => { - logger.log('error', cassandra.prepareError(err), 'Retrieving schema'); - keyspaceCallback(err); - }); - - const pipeline = (UDAs, UDFs, views) => { - if (!tableNames.length) { - let packageData = { - dbName: keyspaceName, - emptyBucket: true - }; - - packageData.bucketInfo = cassandra.getKeyspaceInfo(keyspaceName); - packageData.bucketInfo.UDFs = UDFs; - packageData.bucketInfo.UDAs = UDAs; - return keyspaceCallback(null, packageData); - } else { - async.map(tableNames, (tableName, tableCallback) => { - let packageData = { - dbName: keyspaceName, - collectionName: tableName, - documents: [] - }; - const loadProgress = progress.bind(null, logger, keyspaceName, tableName); - const exec = (promise, startMessage, finishMessage) => { - loadProgress(startMessage); - return promise.then(result => { - loadProgress(finishMessage); - - return result; - }); - }; +\v \v`,"\f \f\r \r  ","    ","   ","    ","\x1B \x1B  ",'   ! !" "#'," #$ $% %& &' '( () )","* *+ +, ,- -. ./ /0 0","1 12 23 34 45 56 67 7","8 89 9: :; ;< <= => >","? ?@ @A AB BC CD DE E","F FG GH HI IJ JK KL L","M MN NO OP PQ QR RS S","T TU UV VW WX XY YZ Z","[ [\\ \\] ]^ ^_ _` `a a","b bc cd de ef fg gh h","i ij jk kl lm mn no o","p pq qr rs st tu uv v","w wx xy yz z{ {| |} }","~ ~\x7F \x7F\x80 \x80\x81 \x81","\x82 \x82\x83 \x83\x84 \x84\x85 ","\x85\x86 \x86\x87 \x87\x88 \x88","\x89 \x89\x8A \x8A\x8B \x8B\x8C ","\x8C\x8D \x8D\x8E \x8E\x8F \x8F","\x90 \x90\x91 \x91\x92 \x92\x93 ","\x93\x94 \x94\x95 \x95\x96 \x96","\x97 \x97\x98 \x98\x99 \x99\x9A ","\x9A\x9B \x9B\x9C \x9C\x9D \x9D","\x9E \x9E\x9F \x9F\xA0 \xA0\xA1 ","\xA1\xA2 \xA2\xA3 \xA3\xA4 \xA4","\xA5 \xA5\xA6 \xA6\xA7 \xA7\xA8 ","\xA8\xA9 \xA9\xAA \xAA\xAB \xAB","\xAC \xAC\xAD \xAD\xAE \xAE\xAF ","\xAF\xB0 \xB0\xB1 \xB1\xB2 \xB2","\xB3 \xB3\xB4 \xB4\xB5 \xB5\xB6 ","\xB6\xB7 \xB7\xB8 \xB8\xB9 \xB9","\xBA \xBA\xBB \xBB\xBC \xBC\xBD ","\xBD\xBE \xBE\xBF \xBF\xC0 \xC0","\xC1 \xC1\xC2 \xC2\xC3 \xC3\xC4 ","\xC4\xC5 \xC5\xC6 \xC6\xC7 \xC7","\xC8 \xC8\xC9 \xC9\xCA \xCA\xCB ","\xCB\xCC \xCC\xCD \xCD\xCE \xCE","\xCF \xCF\xD0 \xD0\xD1 \xD1\xD2 ","\xD2\xD3 \xD3\xD4 \xD4\xD5 \xD5","\xD6 \xD6\xD7 \xD7\xD8 \xD8\xD9 ","\xD9\xDA \xDA\xDB \xDB\xDC \xDC","\xDD \xDD\xDE \xDE\xDF \xDF\xE0 ","\xE0\xE1 \xE1\xE2 \xE2\xE3 \xE3","\xE4 \xE4\xE5 \xE5\xE6 \xE6\xE7 ","\xE7\xE8 \xE8\xE9 \xE9\xEA \xEA","\xEB \xEB\xEC \xEC\xED \xED\xEE ","\xEE\xEF \xEF\xF0 \xF0\xF1 \xF1","\xF2 \xF2\xF3 \xF3\xF4 \xF4\xF5 ","\xF5\xF6 \xF6\xF7 \xF7\xF8 \xF8","\xF9 \xF9\xFA \xFA\xFB \xFB\xFC ","\xFC\xFD \xFD\xFE \xFE\xFF \xFF","\u0100 \u0100\u0101 \u0101\u0102 \u0102\u0103 ","\u0103\u0104 \u0104\u0105 \u0105\u0106 \u0106","\u0107 \u0107\u0108 \u0108\u0109 \u0109\u010A ","\u010A","\x07",`\x07\b\b   + +\v`,`\v\u0229 +\v\r\v\v\u022A\v\v`,`\f\f\f\f\f\f\u0234 +\f\r\f`,"\f\u0235\f\f\f\f\f\r\r",`\r\r\x07\r\u0241 +\r\f\r\r\u0244\v\r\r`,"\r\r\r\r",`\u0251 +`,`\x07\u0254 +\f\u0257\v`,`\u025A +`,`\u025E +`,`\u0264 +\u0268 +`,`\u026A +`,"","","","",`\u0288 +`,"","",`\u029D +`,"",`\u02A6 +\x1B\x1B`,"\x1B\x1B\x1B\x1B\x1B\x1B",`\x1B\x1B\x1B\x1B\u02B3 +\x1B`,"","\u02C0",` +`,`\u02C9 +`,"",`\u02D2 +`,"",`\u02DF +    `,`  \u02E6 + !!!!!!!`,`!\u02EF +!"""""""`,'"""""""""',`""""\u0304 +"####`,`########\u0311 +#$`,"$$$$$$$$$$",`$\u031E +$%%%%%%\u0325 +%`,"&&&&&&&&&&",`&&&&\u0334 +&''''`,"'''''''''","'''''''''\u034B",` +'(((((((((`,"(((((((((",`((((((((\u0366 +()`,"))))))))))",`)))))\u0377 +)****`,"**********","**********\u0390",` +*+++++++++`,`+++++++++\u03A3 ++`,",,,,,,,,,,",`,,,,\u03B2 +,-----`,`---------\u03C1 +-`,"..........",`....\u03D0 +./////`,`/////////\u03DF +/`,"0000000000\u03EA",` +0111111111`,`111111111\u03FD +1`,"2222222222",`22222222\u0410 +23`,`333333333\u041B +3`,"4444444444","4444444444","4444444444\u043A",` +4555555555`,"5555555555",`55555\u0453 +56666`,"6666666666",`66\u0464 +67777777`,`777777777\u0475 +7`,"8888888888",`8888\u0484 +899999`,"9999999999",`99999\u0499 +9::::`,"::::::::::",`::::::\u04AE +:;;;`,";;;;;;;;;;",`;;;;;;;\u04C3 +;<<`,`<<<<<<<<\u04CE +<=`,`=========\u04D9 +=`,">>>>>>>>>>",`>>>>>>>>\u04EC +>?`,"??????????",`?????????\u0501 +?`,"@@@@@@@@@@",`@@\u050E +@AAAAAA\u0515 +`,`ABBBBBB\u051C +BCC`,"CCCCCCCCCC\u0529",` +CDDDDDDDDD`,`DDDDDDDDD\u053C +D`,"EEEEEEEEEE",`EEEEEEEE\u054F +EF`,"FFFFFFFFFF",`F\u055C +FGGGGGGGG`,`GGGGGG\u056B +GHHH`,`HHHHHHH\u0576 +HII`,`IIII\u057D +IJJJJJ`,`JJJJJ\u0588 +JKKKK`,`KKKK\u0591 +KLLLLL`,`LLLLL\u059C +LMMMM`,"MMMMMMMMMM",`MMMM\u05AF +MNNNNN`,"NNNNNNNNNN",`NNNNN\u05C4 +NOOOO`,"OOOOOOOOOO",`OOOO\u05D7 +OPPPPP`,`PPPPPPP\u05E4 +PQQ`,"QQQQQQQQQQ\u05F1",` +QRRRRRRRRR`,"RRRRRRRRRR",`R\u0606 +RSSSSSSSS`,"SSSSSSSSSS",`SSSSSSSS\u0621 +ST`,"TTTTTTTTTT",`TTT\u0630 +TUUUUUU`,`UUUUUU\u063D +UVVV`,"VVVVVVVVVV","VVVVVVVVVV",`VVV\u0658 +VWWWWWW`,`WWWWWWWW\u0667 +WX`,`XXXXXXX\u0670 +XYY`,"YYYYYYYYYY","YYYYYYYYYY",`YY\u0689 +YZZZZZZZ`,"ZZZZZZZZZZ",`ZZZZZZZ\u06A2 +Z[[`,`[[[[[[\u06AB +[\\\\`,`\\\\\\\\\\\\\\\\\u06B6 +\\`,`]]]]]]\u06BD +]^^`,`^^^^\u06C4 +^_____`,"___\u06CD\n_``````","``````````\u06DE",` +\`aaaaaa\u06E5 +ab`,"bbbbbbbbbb",`b\u06F2 +bcccccccc`,"cccccccccc",`cc\u0707 +cddddddd`,"dddddddddd",`d\u071A +deeeeeeee\u0723`,` +efffffffff`,"ffffffffff",`fff\u073A +fgggggg`,"gggggggggg",`gggggggg\u0753 +gh`,"hhhhhhhhhh",`hhhhh\u0764 +hiiii`,"iiiiiiiiii\u0773",` +ijjjjjjjjj`,`jjjjj\u0782 +jkkkk`,"kkkkkkkkkk",`kk\u0793 +klllllll`,"llllllllll",`lllllll\u07AC +lmm`,"mmmmmmmmmm",`mmmm\u07BD +mnnnnn`,`nnnnnnnnn\u07CC +n`,"oooooooooo\u07D7",` +oppppppppp`,`ppp\u07E4 +pqqqqqq`,"qqqqqqqqqq",`qq\u07F7 +qrrrrrrr`,`rrr\u0802 +rssssss`,`sssssss\u0810 +stt`,"tttttttttt",`tt\u081F +tuuuuuuu`,`uuuuuuu\u082E +uvv`,`vvvvvv\u0837 +vwww`,`wwwwwwwww\u0844 +w`,"xxxxxxxxxx",`xxxx\u0853 +xyyyyy`,"yyyyyyyyyy",`y\u0864 +yzzzzzzzz`,`zzzz\u0871 +z{{{{{`,"{{{{{{{{{{",`{{{{{\u0886 +{||||`,`||||||||\u0893 +|}`,"}}}}}}}}}}",`}\u08A0 +}~~~~~~~~`,"~~~~~~~~~~",`~~\u08B5 +~\x7F\x7F\x7F\x7F`,`\x7F\x7F\u08BC +\x7F\x80\x80\x80`,"\x80\x80\x80\x80\x80\x80",`\x80\x80\x80\u08C9 +\x80\x81`,"\x81\x81\x81\x81\x81\x81","\x81\x81\x81\x81\x81\x81",`\x81\x81\x81\u08DA +\x81\x82\x82`,"\x82\x82\x82\x82\x82\x82","\x82\x82\x82\x82\x82\x82",`\x82\x82\x82\u08EC +\x82\x83`,"\x83\x83\x83\x83\x83\x83","\x83\x83\x83\x83\x83\x83",`\x83\x83\x83\x83\x83\u08FF +\x83`,"\x84\x84\x84\x84\x84\x84",`\x84\x84\u0908 +\x84\x85\x85`,"\x85\x85\x85\x85\x85\x85\u0911",` +\x85\x86\x86\x86\x86\x86`,`\x86\x86\x86\x86\x86\u091C +`,"\x86\x87\x87\x87\x87\x87","\x87\x87\x87\x87\x87\x87","\x87\x87\x87\x87\x87\x87",`\x87\u092F +\x87\x88\x88\x88\x88`,"\x88\x88\x88\x88\x88\x88",`\x88\x88\x88\x88\u093E +\x88`,"\x89\x89\x89\x89\x89\x89",`\x89\x89\u0947 +\x89\x8A\x8A\x8A`,"\x8A\x8A\x8A\x8A\x8A\x8A",`\x8A\u0952 +\x8A\x8B\x8B\x8B`,"\x8B\x8B\x8B\x8B\x8B\x8B",`\x8B\x8B\x8B\u095F +\x8B\x8C\x8C`,"\x8C\x8C\x8C\x8C\x8C\x8C",`\x8C\x8C\u096A +\x8C\x8D\x8D`,"\x8D\x8D\x8D\x8D\x8D\x8D","\x8D\x8D\x8D\x8D\x8D\x8D\u0979",` +\x8D\x8E\x8E\x8E\x8E\x8E`,`\x8E\x8E\x8E\x8E\x8E\u0984 +`,"\x8E\x8F\x8F\x8F\x8F\x8F","\x8F\x8F\x8F\x8F\x8F\x8F",`\x8F\u0991 +\x8F\x90\x90\x90\x90`,"\x90\x90\x90\x90\x90\x90",`\u099C +\x90\x91\x91\x91\x91`,"\x91\x91\x91\x91\x91\x91","\x91\x91\x91\x91\x91\x91",`\x91\x91\x91\x91\u09B1 +\x91\x92`,"\x92\x92\x92\x92\x92\x92","\x92\x92\x92\x92\x92\x92",`\x92\x92\u09C1 +\x92\x93\x93`,"\x93\x93\x93\x93\x93\x93","\x93\x93\x93\x93\x93\x93","\x93\x93\x93\x94\x94\x94","\x94\x94\x94\x94\x94\x94","\x94\x94\x94\x95\x95\x95","\x95\x95\x95\x95\x95\x95","\x95\x95\x95\x95\x95\x95","\x95\x95\x95\x95\x95\x95","\x95\x95\x95\x95\x95\x95","\x95\x95\x95\x95\x95\x95","\x95\x95\x95\x95\x95\x95",`\x95\x95\x95\x95\u0A0A +\x95\x96`,"\x96\x96\x96\x96\x96\x96","\x96\x96\x96\x96\x97\x97","\x97\x97\x97\x97\x97\x97","\x97\x97\x97\x97\x97\x98","\x98\x98\x98\x98\x98\x98","\x98\x98\x98\x98\x98\x98","\x98\x98\x98\x98\x98\x98","\x98\x98\x98\x98\x98\x98","\x98\x98\x98\x98\x98\x98","\x98\x98\x98\x98\x98\x99","\x99\x99\x99\x99\x99\x99","\x99\x99\x99\x99\x99\x99","\x99\x99\x99\x99\x99\x99","\x99\x99\x99\x99\x99\x99","\x99\x99\x99\x99\x99\x99","\x9A\x9A\x9A\x9A\x9A\x9A","\x9A\x9A\x9A\x9A\x9A\x9A","\x9A\x9A\x9A\x9A\x9A\x9A","\x9A\x9A\x9A\x9A\x9A\x9A","\x9A\x9A\x9A\x9A\x9A\x9A","\x9A\x9B\x9B\x9B\x9B\x9B","\x9B\x9B\x9B\x9B\x9B\x9B","\x9B\x9B\x9B\x9B\x9B\x9B","\x9B\x9B\x9B\x9B\x9B\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9D\x9D","\x9D\x9D\x9D\x9D\x9D\x9D","\x9D\x9D\x9D\x9D\x9D\x9D","\x9D\x9D\x9D\x9D\x9D\x9D","\x9D\x9D\x9D\x9D\x9D\x9D","\x9D\x9D\x9D\x9D\x9D\x9D","\x9D\x9D\x9D\x9E\x9E\x9E","\x9E\x9E\x9E\x9E\x9E\x9E","\x9E\x9E\x9E\x9E\x9E\x9E","\x9E\x9E\x9E\x9E\x9E\x9E","\x9E\x9F\x9F\x9F\x9F\x9F","\x9F\x9F\x9F\x9F\x9F\x9F","\x9F\x9F\x9F\x9F\x9F\x9F","\x9F\x9F\x9F\x9F\x9F\xA0","\xA0\xA0\xA0\xA0\xA0\xA0","\xA1\xA1\xA1\xA1\xA1\xA1","\xA1\xA1\xA1\xA1\xA1\xA1","\xA1\xA1\xA1\xA1\xA1\xA2","\xA2\xA2\xA2\xA2\xA2\xA2","\xA2\xA2\xA2\xA2\xA2\xA2","\xA2\xA2\xA2\xA2\xA2\xA2","\xA2\xA2\xA2\xA2\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA3\xA3\xA3\xA3\xA3\xA3","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA4\xA4\xA4\xA4\xA4\xA4","\xA5\xA5\xA5\xA5\xA5\xA5","\xA5\xA5\xA5\xA5\xA5\xA5","\xA5\xA5\xA5\xA5\xA5\xA5","\xA6\xA6\xA6\xA6\xA6\xA6","\xA6\xA6\xA6\xA6\xA6\xA6","\xA6\xA6\xA6\xA7\xA7\xA7","\xA7\xA7\xA7\xA7\xA7\xA7","\xA7\xA7\xA7\xA7\xA7\xA7","\xA7\xA7\xA7\xA7\xA7\xA7","\xA7\xA7\xA7\xA7\xA7\xA7","\xA7\xA7\xA8\xA8\xA8\xA8","\xA8\xA8\xA8\xA8\xA8\xA8","\xA8\xA8\xA8\xA8\xA8\xA8","\xA8\xA8\xA8\xA8\xA8\xA8","\xA8\xA9\xA9\xA9\xA9\xA9","\xA9\xA9\xA9\xA9\xA9\xAA","\xAA\xAA\xAA\xAA\xAA\xAA","\xAA\xAA\xAA\xAB\xAB\xAB","\xAB\xAB\xAB\xAB\xAB\xAB","\xAC\xAC\xAC\xAC\xAC\xAC","\xAC\xAC\xAD\xAD\xAD\xAD","\xAD\xAD\xAD\xAD\xAD\xAD","\xAE\xAE\xAE\xAE\xAE\xAE","\xAE\xAE\xAF\xAF\xAF\xAF","\xAF\xAF\xAF\xAF\xAF\xB0","\xB0\xB0\xB0\xB0\xB0\xB0","\xB1\xB1\xB1\xB1\xB1\xB1","\xB1\xB1\xB1\xB1\xB1\xB1","\xB1\xB1\xB1\xB2\xB2\xB2","\xB2\xB2\xB2\xB2\xB2\xB2","\xB2\xB2\xB2\xB2\xB2\xB2","\xB2\xB2\xB2\xB3\xB3\xB3","\xB3\xB3\xB3\xB3\xB3\xB3","\xB3\xB3\xB3\xB3\xB3\xB3","\xB3\xB3\xB4\xB4\xB4\xB4","\xB4\xB4\xB4\xB4\xB4\xB4","\xB4\xB4\xB4\xB4\xB4\xB4","\xB4\xB4\xB4\xB4\xB4\xB4","\xB4\xB4\xB5\xB5\xB5\xB5","\xB5\xB5\xB5\xB5\xB5\xB5","\xB5\xB5\xB5\xB5\xB5\xB5","\xB5\xB5\xB5\xB5\xB5\xB5","\xB5\xB5\xB5\xB6\xB6\xB6","\xB6\xB6\xB6\xB6\xB6\xB6","\xB6\xB6\xB6\xB6\xB6\xB6","\xB6\xB6\xB6\xB6\xB6\xB6","\xB6\xB7\xB7\xB7\xB7\xB7","\xB7\xB7\xB7\xB7\xB7\xB7","\xB7\xB7\xB7\xB7\xB7\xB7","\xB7\xB7\xB7\xB8\xB8\xB8","\xB8\xB8\xB8\xB8\xB8\xB8","\xB8\xB8\xB8\xB8\xB8\xB8","\xB8\xB8\xB8\xB8\xB9\xB9","\xB9\xB9\xB9\xB9\xB9\xB9","\xB9\xB9\xB9\xB9\xB9\xB9","\xBA\xBA\xBA\xBA\xBA\xBA","\xBA\xBA\xBA\xBB\xBB\xBB","\xBB\xBB\xBB\xBB\xBB\xBB","\xBC\xBC\xBC\xBC\xBC\xBC","\xBC\xBC\xBD\xBD\xBD\xBD","\xBD\xBD\xBD\xBD\xBE\xBE","\xBE\xBE\xBE\xBE\xBE\xBE","\xBE\xBE\xBE\xBF\xBF\xBF","\xBF\xBF\xBF\xBF\xBF\xBF","\xBF\xBF\xBF\xC0\xC0\xC0","\xC0\xC0\xC0\xC0\xC1\xC1","\xC1\xC1\xC1\xC2\xC2\xC2","\xC2\xC2\xC2\xC2\xC2\xC3","\xC3\xC3\xC3\xC3\xC3\xC3","\xC3\xC4\xC4\xC4\xC4\xC4","\xC5\xC5\xC5\xC5\xC5\xC5","\xC5\xC5\xC6\xC6\xC6\xC6","\xC6\xC6\xC6\xC7\xC7\xC7","\xC7\xC7\xC7\xC8\xC8\xC8","\xC8\xC8\xC8\xC8\xC9\xC9","\xC9\xC9\xC9\xCA\xCA\xCA","\xCA\xCB\xCB\xCB\xCB\xCB","\xCC\xCC\xCC\xCC\xCD\xCD","\xCD\xCD\xCD\xCD\xCD\xCD","\xCD\xCE\xCE\xCE\xCE\xCE","\xCF\xCF\xCF\xCF\xCF\xCF","\xCF\xCF\xCF\xD0\xD0\xD0","\xD0\xD0\xD1\xD1\xD1\xD1","\xD1\xD1\xD1\xD1\xD2\xD2","\xD2\xD2\xD2\xD2\xD3\xD3","\xD3\xD3\xD3\xD3\xD3\xD3","\xD4\xD4\xD4\xD4\xD4\xD4","\xD4\xD5\xD5\xD6\xD6\xD7","\xD7\xD8\xD8\xD9\xD9\xDA","\xDA\xDB\xDB\xDC\xDC\xDD","\xDD\xDE\xDE\xDF\xDF\xE0","\xE0\xE1\xE1\xE2\xE2\xE3","\xE3\xE4\xE4\xE5\xE5\xE6","\xE6\xE7\xE7\xE8\xE8\xE9","\xE9\xEA\xEA\xEB\xEB\xEC","\xEC\xED\xED\xEE\xEE\xEF","\xEF\xEF\xF0\xF0\xF0\xF0",`\xF0\xF0\x07\xF0\u0DE7 +\xF0\f\xF0\xF0`,"\u0DEA\v\xF0\xF0\xF0\xF0\xF1","\xF1\xF1\xF1\xF1\xF2\xF2\x07",`\xF2\u0DF6 +\xF2\f\xF2\xF2\u0DF9\v\xF2\xF2`,`\xF2\xF2\u0DFD +\xF2\r\xF2\xF2\u0DFE`,`\xF2\xF2\u0E02 +\xF2\xF3\xF3\xF3`,`\xF3\xF3\xF3\x07\xF3\u0E0A +\xF3\f\xF3`,"\xF3\u0E0D\v\xF3\xF3\xF3\xF4",`\xF4\xF5\xF5\xF6\xF6\u0E16 +\xF6`,`\r\xF6\xF6\u0E17\xF7\xF7\u0E1B +\xF7`,`\xF7\xF7\u0E1E +\xF7\r\xF7\xF7\u0E1F\xF7`,`\xF7\xF7\u0E24 +\xF7\r\xF7\xF7\u0E25`,`\xF7\u0E28 +\xF7\xF8\xF8\xF8\xF8`,`\xF8\xF8\u0E2F +\xF8\r\xF8\xF8\u0E30`,"\xF8\xF8\xF8\xF8\xF8\xF8",`\xF8\u0E39 +\xF8\r\xF8\xF8\u0E3A\xF8\u0E3D +\xF8`,`\xF9\xF9\u0E40 +\xF9\r\xF9\xF9\u0E41`,`\xF9\u0E44 +\xF9\xF9\xF9\xF9\u0E48 +\xF9`,`\r\xF9\xF9\u0E49\xF9\xF9\u0E4D +\xF9\r\xF9`,"\xF9\u0E4E\xF9\xF9\xF9\xF9",`\xF9\u0E55 +\xF9\r\xF9\xF9\u0E56\xF9\u0E59 +\xF9`,`\xF9\xF9\xF9\u0E5D +\xF9\r\xF9\xF9`,`\u0E5E\xF9\xF9\xF9\xF9\u0E64 +\xF9`,"\r\xF9\xF9\u0E65\xF9\xF9\xF9\u0E6A",` +\xF9\xFA\xFA\xFB\xFB\xFB`,"\xFB\xFB\xFB\xFB\xFB\xFB","\xFB\xFB\xFB\xFB\xFC\xFC",`\xFD\xFD\xFE\xFE\xFE\u0E81 +`,`\xFE\xFE\xFE\u0E84 +\xFE\r\xFE\xFE\u0E85`,"\xFF\xFF\u0100\u0100\u0101\u0101","\u0102\u0102\u0102\u0103\u0103\u0103","\u0104\u0104\u0105\u0105\u0106\u0106","\u0107\u0107\u0108\u0108\u0109\u0109","\u0109\u0109\u0109\u0109\u0109\u0109",`\u0109\u0109\u0109\u0109\u0EA9 +\u0109`,"\u010A\u010A\u010A\u010A\u010A\u010A","\u010A\u010A\u010A\u010A\u010A\u010A",`\u010A\u010A\u0EB8 +\u010A\u0235\u0242\u010B`,"\x07 \v\x07\r\b ",` +\v\f\r\x1B`,"!#%')+-/1",`3\x1B579;= ?!A"C#E$G%I&K'M(O)Q*S+U,W-Y.`,"[/]0_1a2c3e4g5i6k7m8o9q:s;u{?}@\x7FA\x81B\x83C\x85D\x87","E\x89F\x8BG\x8DH\x8FI\x91J\x93K\x95L\x97M\x99N\x9B","O\x9DP\x9FQ\xA1R\xA3S\xA5T\xA7U\xA9V\xABW\xADX\xAF","Y\xB1Z\xB3[\xB5\\\xB7]\xB9^\xBB_\xBD`\xBFa\xC1b\xC3","c\xC5d\xC7e\xC9f\xCBg\xCDh\xCFi\xD1j\xD3k\xD5l\xD7","m\xD9n\xDBo\xDDp\xDFq\xE1r\xE3s\xE5t\xE7u\xE9v\xEB","w\xEDx\xEFy\xF1z\xF3{\xF5|\xF7}\xF9~\xFB\x7F\xFD","\x80\xFF\x81\u0101\x82\u0103\x83\u0105\x84\u0107\x85\u0109","\x86\u010B\x87\u010D\x88\u010F\x89\u0111\x8A\u0113\x8B\u0115","\x8C\u0117\x8D\u0119\x8E\u011B\x8F\u011D\x90\u011F\x91\u0121","\x92\u0123\x93\u0125\x94\u0127\x95\u0129\x96\u012B\x97\u012D","\x98\u012F\x99\u0131\x9A\u0133\x9B\u0135\x9C\u0137\x9D\u0139","\x9E\u013B\x9F\u013D\xA0\u013F\xA1\u0141\xA2\u0143\xA3\u0145","\xA4\u0147\xA5\u0149\xA6\u014B\xA7\u014D\xA8\u014F\xA9\u0151","\xAA\u0153\xAB\u0155\xAC\u0157\xAD\u0159\xAE\u015B\xAF\u015D","\xB0\u015F\xB1\u0161\xB2\u0163\xB3\u0165\xB4\u0167\xB5\u0169","\xB6\u016B\xB7\u016D\xB8\u016F\xB9\u0171\xBA\u0173\xBB\u0175","\xBC\u0177\xBD\u0179\xBE\u017B\xBF\u017D\xC0\u017F\xC1\u0181","\xC2\u0183\xC3\u0185\xC4\u0187\xC5\u0189\xC6\u018B\xC7\u018D","\xC8\u018F\xC9\u0191\xCA\u0193\xCB\u0195\xCC\u0197\xCD\u0199","\xCE\u019B\xCF\u019D\xD0\u019F\xD1\u01A1\xD2\u01A3\xD3\u01A5","\xD4\u01A7\xD5\u01A9\u01AB\u01AD\u01AF\u01B1","\u01B3\u01B5\u01B7\u01B9\u01BB\u01BD","\u01BF\u01C1\u01C3\u01C5\u01C7\u01C9","\u01CB\u01CD\u01CF\u01D1\u01D3\u01D5","\u01D7\u01D9\u01DB\u01DD\u01DF\u01E1","\u01E3\u01E5\u01E7\xD6\u01E9\xD7\u01EB\xD8\u01ED","\xD9\u01EF\xDA\u01F1\xDB\u01F3\xDC\u01F5\xDD\u01F7\u01F9","\u01FB\u01FD\u01FF\u0201\u0203\u0205","\u0207\xDE\u0209\xDF\u020B\xE0\u020D\xE1\u020F\xE2\u0211",'\xE3\u0213\xE4&\v\f""',"\f\fCCccDDdd","EEeeFFffGGggHHhhIIi","iJJjjKKkkLLllMMmm","NNnnOOooPPppQQqq","RRrrSSssTTttUUuuVVv","vWWwwXXxxYYyyZZzz","[[{{\\\\||&&2;CHch","C\\c|\x07&&2;C\\aac|$$))^^","2;2;CH\u0F39","\x07"," \v","\r","","","\x1B","","!#%","')","+-","/1","35","79;","=?","AC","EG","IK","MOQ","SU","WY","[]","_a","ceg","ik","mo","qs","uw","y{}","\x7F\x81","\x83\x85","\x87\x89","\x8B\x8D","\x8F\x91","\x93\x95","\x97\x99","\x9B\x9D","\x9F\xA1","\xA3\xA5","\xA7\xA9","\xAB\xAD","\xAF\xB1","\xB3\xB5","\xB7\xB9","\xBB\xBD","\xBF\xC1","\xC3\xC5","\xC7\xC9","\xCB\xCD","\xCF\xD1","\xD3\xD5","\xD7\xD9","\xDB\xDD","\xDF\xE1","\xE3\xE5","\xE7\xE9","\xEB\xED","\xEF\xF1","\xF3\xF5","\xF7\xF9","\xFB\xFD","\xFF\u0101","\u0103\u0105","\u0107\u0109","\u010B\u010D","\u010F\u0111","\u0113\u0115","\u0117\u0119","\u011B\u011D","\u011F\u0121","\u0123\u0125","\u0127\u0129","\u012B\u012D","\u012F\u0131","\u0133\u0135","\u0137\u0139","\u013B\u013D","\u013F\u0141","\u0143\u0145","\u0147\u0149","\u014B\u014D","\u014F\u0151","\u0153\u0155","\u0157\u0159","\u015B\u015D","\u015F\u0161","\u0163\u0165","\u0167\u0169","\u016B\u016D","\u016F\u0171","\u0173\u0175","\u0177\u0179","\u017B\u017D","\u017F\u0181","\u0183\u0185","\u0187\u0189","\u018B\u018D","\u018F\u0191","\u0193\u0195","\u0197\u0199","\u019B\u019D","\u019F\u01A1","\u01A3\u01A5","\u01A7\u01E7","\u01E9\u01EB","\u01ED\u01EF","\u01F1\u01F3","\u01F5\u0207","\u0209\u020B","\u020D\u020F","\u0211\u0213","\u0215\u0217","\x07\u0219 \u021B","\v\u021D\r\u021F","\u0221\u0223","\u0225\u0228","\u022E\u023C","\x1B\u0269\u026D","\u026F!\u0271","#\u0273%\u0275","'\u0277)\u027A","+\u027C-\u027E","/\u02871\u029C3\u02A5","5\u02B27\u02BF","9\u02C8;\u02D1","=\u02DE?\u02E5","A\u02EEC\u0303","E\u0310G\u031DI\u0324","K\u0333M\u034A","O\u0365Q\u0376","S\u038FU\u03A2","W\u03B1Y\u03C0","[\u03CF]\u03DE_\u03E9","a\u03FCc\u040F","e\u041Ag\u0439","i\u0452k\u0463","m\u0474o\u0483","q\u0498s\u04ADu\u04C2","w\u04CDy\u04D8","{\u04EB}\u0500","\x7F\u050D\x81\u0514","\x83\u051B\x85\u0528","\x87\u053B\x89\u054E","\x8B\u055B\x8D\u056A","\x8F\u0575\x91\u057C","\x93\u0587\x95\u0590","\x97\u059B\x99\u05AE","\x9B\u05C3\x9D\u05D6","\x9F\u05E3\xA1\u05F0","\xA3\u0605\xA5\u0620","\xA7\u062F\xA9\u063C","\xAB\u0657\xAD\u0666","\xAF\u066F\xB1\u0688","\xB3\u06A1\xB5\u06AA","\xB7\u06B5\xB9\u06BC","\xBB\u06C3\xBD\u06CC","\xBF\u06DD\xC1\u06E4","\xC3\u06F1\xC5\u0706","\xC7\u0719\xC9\u0722","\xCB\u0739\xCD\u0752","\xCF\u0763\xD1\u0772","\xD3\u0781\xD5\u0792","\xD7\u07AB\xD9\u07BC","\xDB\u07CB\xDD\u07D6","\xDF\u07E3\xE1\u07F6","\xE3\u0801\xE5\u080F","\xE7\u081E\xE9\u082D","\xEB\u0836\xED\u0843","\xEF\u0852\xF1\u0863","\xF3\u0870\xF5\u0885","\xF7\u0892\xF9\u089F","\xFB\u08B4\xFD\u08BB","\xFF\u08C8\u0101\u08D9","\u0103\u08EB\u0105\u08FE","\u0107\u0907\u0109\u0910","\u010B\u091B\u010D\u092E","\u010F\u093D\u0111\u0946","\u0113\u0951\u0115\u095E","\u0117\u0969\u0119\u0978","\u011B\u0983\u011D\u0990","\u011F\u099B\u0121\u09B0","\u0123\u09C0\u0125\u09C2","\u0127\u09D3\u0129\u0A09","\u012B\u0A0B\u012D\u0A16","\u012F\u0A23\u0131\u0A47","\u0133\u0A66\u0135\u0A85","\u0137\u0A9B\u0139\u0ABE","\u013B\u0AE1\u013D\u0AF7","\u013F\u0B0D\u0141\u0B14","\u0143\u0B25\u0145\u0B3C","\u0147\u0B68\u0149\u0B9E","\u014B\u0BB0\u014D\u0BBF","\u014F\u0BDC\u0151\u0BF3","\u0153\u0BFD\u0155\u0C07","\u0157\u0C10\u0159\u0C18","\u015B\u0C22\u015D\u0C2A","\u015F\u0C33\u0161\u0C3A","\u0163\u0C49\u0165\u0C5B","\u0167\u0C6C\u0169\u0C84","\u016B\u0C9D\u016D\u0CB3","\u016F\u0CC7\u0171\u0CDA","\u0173\u0CE8\u0175\u0CF1","\u0177\u0CFA\u0179\u0D02","\u017B\u0D0A\u017D\u0D15","\u017F\u0D21\u0181\u0D28","\u0183\u0D2D\u0185\u0D35","\u0187\u0D3D\u0189\u0D42","\u018B\u0D4A\u018D\u0D51","\u018F\u0D57\u0191\u0D5E","\u0193\u0D63\u0195\u0D67","\u0197\u0D6C\u0199\u0D70","\u019B\u0D79\u019D\u0D7E","\u019F\u0D87\u01A1\u0D8C","\u01A3\u0D94\u01A5\u0D9A","\u01A7\u0DA2\u01A9\u0DA9","\u01AB\u0DAB\u01AD\u0DAD","\u01AF\u0DAF\u01B1\u0DB1","\u01B3\u0DB3\u01B5\u0DB5","\u01B7\u0DB7\u01B9\u0DB9","\u01BB\u0DBB\u01BD\u0DBD","\u01BF\u0DBF\u01C1\u0DC1","\u01C3\u0DC3\u01C5\u0DC5","\u01C7\u0DC7\u01C9\u0DC9","\u01CB\u0DCB\u01CD\u0DCD","\u01CF\u0DCF\u01D1\u0DD1","\u01D3\u0DD3\u01D5\u0DD5","\u01D7\u0DD7\u01D9\u0DD9","\u01DB\u0DDB\u01DD\u0DDD","\u01DF\u0DE0\u01E1\u0DEE","\u01E3\u0E01\u01E5\u0E03","\u01E7\u0E10\u01E9\u0E12","\u01EB\u0E15\u01ED\u0E1A","\u01EF\u0E3C\u01F1\u0E69","\u01F3\u0E6B\u01F5\u0E6D","\u01F7\u0E7A\u01F9\u0E7C","\u01FB\u0E7E\u01FD\u0E87","\u01FF\u0E89\u0201\u0E8B","\u0203\u0E8D\u0205\u0E90","\u0207\u0E93\u0209\u0E95","\u020B\u0E97\u020D\u0E99","\u020F\u0E9B\u0211\u0EA8","\u0213\u0EB7\u0215\u0216\x07*","\u0216\u0217\u0218\x07+","\u0218\u0219\u021A\x07}","\u021A\b\u021B\u021C\x07\x7F",`\u021C +\u021D\u021E\x07]`,"\u021E\f\u021F\u0220\x07_","\u0220\u0221\u0222\x07.","\u0222\u0223\u0224\x07=","\u0224\u0225\u0226\x07<","\u0226\u0227\u0229 ","\u0228\u0227\u0229\u022A","\u022A\u0228\u022A\u022B","\u022B\u022C\u022C\u022D\b\v","\u022D\u022E\u022F\x071","\u022F\u0230\x07,\u0230\u0231\x07#\u0231","\u0233\u0232\u0234\v\u0233","\u0232\u0234\u0235\u0235","\u0236\u0235\u0233\u0236","\u0237\u0237\u0238\x07,\u0238","\u0239\x071\u0239\u023A\u023A","\u023B\b\f\u023B\u023C\u023D","\x071\u023D\u023E\x07,\u023E\u0242","\u023F\u0241\v\u0240\u023F","\u0241\u0244\u0242\u0243","\u0242\u0240\u0243\u0245","\u0244\u0242\u0245\u0246\x07",",\u0246\u0247\x071\u0247\u0248","\u0248\u0249\b\r\u0249","\u024A\u024B\x07/\u024B\u024C\x07/",'\u024C\u0251\x07"\u024D\u0251\x07%\u024E',"\u024F\x071\u024F\u0251\x071\u0250\u024A","\u0250\u024D\u0250\u024E","\u0251\u0255\u0252\u0254",` +\u0253\u0252\u0254\u0257`,"\u0255\u0253\u0255\u0256","\u0256\u025D\u0257\u0255","\u0258\u025A\x07\u0259\u0258","\u0259\u025A\u025A\u025B","\u025B\u025E\x07\f\u025C\u025E","\x07\u025D\u0259\u025D\u025C","\u025E\u026A\u025F\u0260","\x07/\u0260\u0261\x07/\u0261\u0267","\u0262\u0264\x07\u0263\u0262","\u0263\u0264\u0264\u0265","\u0265\u0268\x07\f\u0266\u0268\x07","\u0267\u0263\u0267\u0266","\u0268\u026A\u0269\u0250","\u0269\u025F\u026A\u026B","\u026B\u026C\b\u026C","\u026D\u026E\x070\u026E","\u026F\u0270\x07,\u0270 ",'\u0271\u0272\x071\u0272"',"\u0273\u0274\x07'\u0274$","\u0275\u0276\x07-\u0276&\u0277","\u0278\x07/\u0278\u0279\x07/\u0279(","\u027A\u027B\x07/\u027B*","\u027C\u027D\x07$\u027D,","\u027E\u027F\x07)\u027F.","\u0280\u0281\u01A9\xD5\u0281\u0282\u01AF\xD8","\u0282\u0283\u01AF\xD8\u0283\u0288","\u0284\u0285\x07C\u0285\u0286\x07F\u0286","\u0288\x07F\u0287\u0280\u0287","\u0284\u02880\u0289","\u028A\u01A9\xD5\u028A\u028B\u01B5\xDB\u028B","\u028C\u01B5\xDB\u028C\u028D\u01CB\xE6\u028D","\u028E\u01B1\xD9\u028E\u028F\u01B5\xDB\u028F","\u0290\u01A9\xD5\u0290\u0291\u01CF\xE8\u0291","\u0292\u01B1\xD9\u0292\u029D\u0293","\u0294\x07C\u0294\u0295\x07I\u0295\u0296","\x07I\u0296\u0297\x07T\u0297\u0298\x07","G\u0298\u0299\x07I\u0299\u029A\x07C","\u029A\u029B\x07V\u029B\u029D\x07G","\u029C\u0289\u029C\u0293","\u029D2\u029E\u029F\u01A9\xD5","\u029F\u02A0\u01BF\xE0\u02A0\u02A1\u01BF\xE0","\u02A1\u02A6\u02A2\u02A3\x07C","\u02A3\u02A4\x07N\u02A4\u02A6\x07N\u02A5","\u029E\u02A5\u02A2\u02A6","4\u02A7\u02A8\u01A9\xD5\u02A8","\u02A9\u01BF\xE0\u02A9\u02AA\u01BF\xE0\u02AA","\u02AB\u01C5\xE3\u02AB\u02AC\u01D5\xEB\u02AC","\u02B3\u02AD\u02AE\x07C\u02AE","\u02AF\x07N\u02AF\u02B0\x07N\u02B0\u02B1","\x07Q\u02B1\u02B3\x07Y\u02B2\u02A7","\u02B2\u02AD\u02B36","\u02B4\u02B5\u01A9\xD5\u02B5\u02B6","\u01BF\xE0\u02B6\u02B7\u01CF\xE8\u02B7\u02B8","\u01B1\xD9\u02B8\u02B9\u01CB\xE6\u02B9\u02C0","\u02BA\u02BB\x07C\u02BB\u02BC\x07","N\u02BC\u02BD\x07V\u02BD\u02BE\x07G","\u02BE\u02C0\x07T\u02BF\u02B4","\u02BF\u02BA\u02C08","\u02C1\u02C2\u01A9\xD5\u02C2\u02C3\u01C3\xE2","\u02C3\u02C4\u01AF\xD8\u02C4\u02C9","\u02C5\u02C6\x07C\u02C6\u02C7\x07P","\u02C7\u02C9\x07F\u02C8\u02C1","\u02C8\u02C5\u02C9:","\u02CA\u02CB\u01A9\xD5\u02CB\u02CC\u01C3\xE2","\u02CC\u02CD\u01D9\xED\u02CD\u02D2","\u02CE\u02CF\x07C\u02CF\u02D0\x07P\u02D0","\u02D2\x07[\u02D1\u02CA\u02D1","\u02CE\u02D2<\u02D3","\u02D4\u01A9\xD5\u02D4\u02D5\u01C7\xE4\u02D5","\u02D6\u01C7\xE4\u02D6\u02D7\u01BF\xE0\u02D7","\u02D8\u01D9\xED\u02D8\u02DF\u02D9","\u02DA\x07C\u02DA\u02DB\x07R\u02DB\u02DC","\x07R\u02DC\u02DD\x07N\u02DD\u02DF\x07","[\u02DE\u02D3\u02DE\u02D9","\u02DF>\u02E0\u02E1","\u01A9\xD5\u02E1\u02E2\u01CD\xE7\u02E2\u02E6","\u02E3\u02E4\x07C\u02E4\u02E6\x07","U\u02E5\u02E0\u02E5\u02E3","\u02E6@\u02E7\u02E8","\u01A9\xD5\u02E8\u02E9\u01CD\xE7\u02E9\u02EA","\u01AD\xD7\u02EA\u02EF\u02EB\u02EC\x07","C\u02EC\u02ED\x07U\u02ED\u02EF\x07E","\u02EE\u02E7\u02EE\u02EB","\u02EFB\u02F0\u02F1\u01A9\xD5","\u02F1\u02F2\u01D1\xE9\u02F2\u02F3\u01CF\xE8","\u02F3\u02F4\u01B7\xDC\u02F4\u02F5\u01C5\xE3","\u02F5\u02F6\u01CB\xE6\u02F6\u02F7\u01B9\xDD","\u02F7\u02F8\u01DB\xEE\u02F8\u02F9\u01B1\xD9","\u02F9\u0304\u02FA\u02FB\x07C","\u02FB\u02FC\x07W\u02FC\u02FD\x07V","\u02FD\u02FE\x07J\u02FE\u02FF\x07Q\u02FF","\u0300\x07T\u0300\u0301\x07K\u0301\u0302","\x07\\\u0302\u0304\x07G\u0303\u02F0","\u0303\u02FA\u0304D","\u0305\u0306\u01AB\xD6\u0306\u0307","\u01A9\xD5\u0307\u0308\u01CF\xE8\u0308\u0309","\u01AD\xD7\u0309\u030A\u01B7\xDC\u030A\u0311","\u030B\u030C\x07D\u030C\u030D\x07","C\u030D\u030E\x07V\u030E\u030F\x07E","\u030F\u0311\x07J\u0310\u0305","\u0310\u030B\u0311F","\u0312\u0313\u01AB\xD6\u0313\u0314\u01B1\xD9","\u0314\u0315\u01B5\xDB\u0315\u0316\u01B9\xDD","\u0316\u0317\u01C3\xE2\u0317\u031E","\u0318\u0319\x07D\u0319\u031A\x07G","\u031A\u031B\x07I\u031B\u031C\x07K\u031C","\u031E\x07P\u031D\u0312\u031D","\u0318\u031EH\u031F","\u0320\u01AB\xD6\u0320\u0321\u01D9\xED\u0321","\u0325\u0322\u0323\x07D\u0323","\u0325\x07[\u0324\u031F\u0324","\u0322\u0325J\u0326","\u0327\u01AD\xD7\u0327\u0328\u01A9\xD5\u0328","\u0329\u01BF\xE0\u0329\u032A\u01BF\xE0\u032A","\u032B\u01B1\xD9\u032B\u032C\u01AF\xD8\u032C","\u0334\u032D\u032E\x07E\u032E","\u032F\x07C\u032F\u0330\x07N\u0330\u0331","\x07N\u0331\u0332\x07G\u0332\u0334\x07","F\u0333\u0326\u0333\u032D","\u0334L\u0335\u0336","\u01AD\xD7\u0336\u0337\u01BF\xE0\u0337\u0338","\u01D1\xE9\u0338\u0339\u01CD\xE7\u0339\u033A","\u01CF\xE8\u033A\u033B\u01B1\xD9\u033B\u033C","\u01CB\xE6\u033C\u033D\u01B9\xDD\u033D\u033E","\u01C3\xE2\u033E\u033F\u01B5\xDB\u033F\u034B","\u0340\u0341\x07E\u0341\u0342\x07","N\u0342\u0343\x07W\u0343\u0344\x07U","\u0344\u0345\x07V\u0345\u0346\x07G","\u0346\u0347\x07T\u0347\u0348\x07K\u0348","\u0349\x07P\u0349\u034B\x07I\u034A\u0335","\u034A\u0340\u034BN","\u034C\u034D\u01AD\xD7\u034D\u034E","\u01C5\xE3\u034E\u034F\u01BF\xE0\u034F\u0350","\u01D1\xE9\u0350\u0351\u01C1\xE1\u0351\u0352","\u01C3\xE2\u0352\u0353\u01B3\xDA\u0353\u0354","\u01A9\xD5\u0354\u0355\u01C1\xE1\u0355\u0356","\u01B9\xDD\u0356\u0357\u01BF\xE0\u0357\u0358","\u01D9\xED\u0358\u0366\u0359\u035A","\x07E\u035A\u035B\x07Q\u035B\u035C\x07","N\u035C\u035D\x07W\u035D\u035E\x07O","\u035E\u035F\x07P\u035F\u0360\x07H","\u0360\u0361\x07C\u0361\u0362\x07O\u0362","\u0363\x07K\u0363\u0364\x07N\u0364\u0366","\x07[\u0365\u034C\u0365\u0359","\u0366P\u0367\u0368","\u01AD\xD7\u0368\u0369\u01C5\xE3\u0369\u036A","\u01C1\xE1\u036A\u036B\u01C7\xE4\u036B\u036C","\u01A9\xD5\u036C\u036D\u01AD\xD7\u036D\u036E","\u01CF\xE8\u036E\u0377\u036F\u0370","\x07E\u0370\u0371\x07Q\u0371\u0372\x07","O\u0372\u0373\x07R\u0373\u0374\x07C","\u0374\u0375\x07E\u0375\u0377\x07V","\u0376\u0367\u0376\u036F","\u0377R\u0378\u0379\u01AD\xD7","\u0379\u037A\u01C5\xE3\u037A\u037B\u01C3\xE2","\u037B\u037C\u01CD\xE7\u037C\u037D\u01B9\xDD","\u037D\u037E\u01CD\xE7\u037E\u037F\u01CF\xE8","\u037F\u0380\u01B1\xD9\u0380\u0381\u01C3\xE2","\u0381\u0382\u01AD\xD7\u0382\u0383\u01D9\xED","\u0383\u0390\u0384\u0385\x07E","\u0385\u0386\x07Q\u0386\u0387\x07P\u0387","\u0388\x07U\u0388\u0389\x07K\u0389\u038A","\x07U\u038A\u038B\x07V\u038B\u038C\x07","G\u038C\u038D\x07P\u038D\u038E\x07E","\u038E\u0390\x07[\u038F\u0378","\u038F\u0384\u0390T","\u0391\u0392\u01AD\xD7\u0392\u0393\u01C5\xE3","\u0393\u0394\u01C3\xE2\u0394\u0395\u01CF\xE8","\u0395\u0396\u01A9\xD5\u0396\u0397\u01B9\xDD","\u0397\u0398\u01C3\xE2\u0398\u0399\u01CD\xE7","\u0399\u03A3\u039A\u039B\x07E","\u039B\u039C\x07Q\u039C\u039D\x07P","\u039D\u039E\x07V\u039E\u039F\x07C\u039F","\u03A0\x07K\u03A0\u03A1\x07P\u03A1\u03A3","\x07U\u03A2\u0391\u03A2\u039A","\u03A3V\u03A4\u03A5","\u01AD\xD7\u03A5\u03A6\u01CB\xE6\u03A6\u03A7","\u01B1\xD9\u03A7\u03A8\u01A9\xD5\u03A8\u03A9","\u01CF\xE8\u03A9\u03AA\u01B1\xD9\u03AA\u03B2","\u03AB\u03AC\x07E\u03AC\u03AD","\x07T\u03AD\u03AE\x07G\u03AE\u03AF\x07","C\u03AF\u03B0\x07V\u03B0\u03B2\x07G","\u03B1\u03A4\u03B1\u03AB","\u03B2X\u03B3\u03B4\u01AD\xD7","\u03B4\u03B5\u01D1\xE9\u03B5\u03B6\u01CD\xE7","\u03B6\u03B7\u01CF\xE8\u03B7\u03B8\u01C5\xE3","\u03B8\u03B9\u01C1\xE1\u03B9\u03C1","\u03BA\u03BB\x07E\u03BB\u03BC\x07W","\u03BC\u03BD\x07U\u03BD\u03BE\x07V\u03BE","\u03BF\x07Q\u03BF\u03C1\x07O\u03C0\u03B3","\u03C0\u03BA\u03C1Z","\u03C2\u03C3\u01CD\xE7\u03C3\u03C4","\u01B1\xD9\u03C4\u03C5\u01A9\xD5\u03C5\u03C6","\u01CB\xE6\u03C6\u03C7\u01AD\xD7\u03C7\u03C8","\u01B7\xDC\u03C8\u03D0\u03C9\u03CA","\x07U\u03CA\u03CB\x07G\u03CB\u03CC\x07","C\u03CC\u03CD\x07T\u03CD\u03CE\x07E","\u03CE\u03D0\x07J\u03CF\u03C2","\u03CF\u03C9\u03D0\\","\u03D1\u03D2\u01AF\xD8\u03D2\u03D3\u01B1\xD9","\u03D3\u03D4\u01BF\xE0\u03D4\u03D5\u01B1\xD9","\u03D5\u03D6\u01CF\xE8\u03D6\u03D7\u01B1\xD9","\u03D7\u03DF\u03D8\u03D9\x07F","\u03D9\u03DA\x07G\u03DA\u03DB\x07N","\u03DB\u03DC\x07G\u03DC\u03DD\x07V\u03DD","\u03DF\x07G\u03DE\u03D1\u03DE","\u03D8\u03DF^\u03E0","\u03E1\u01AF\xD8\u03E1\u03E2\u01B1\xD9\u03E2","\u03E3\u01CD\xE7\u03E3\u03E4\u01AD\xD7\u03E4","\u03EA\u03E5\u03E6\x07F\u03E6","\u03E7\x07G\u03E7\u03E8\x07U\u03E8\u03EA","\x07E\u03E9\u03E0\u03E9\u03E5","\u03EA`\u03EB\u03EC","\u01AF\xD8\u03EC\u03ED\u01B1\xD9\u03ED\u03EE","\u01CD\xE7\u03EE\u03EF\u01AD\xD7\u03EF\u03F0","\u01CB\xE6\u03F0\u03F1\u01B9\xDD\u03F1\u03F2","\u01AB\xD6\u03F2\u03F3\u01B1\xD9\u03F3\u03FD","\u03F4\u03F5\x07F\u03F5\u03F6","\x07G\u03F6\u03F7\x07U\u03F7\u03F8\x07","E\u03F8\u03F9\x07T\u03F9\u03FA\x07K","\u03FA\u03FB\x07D\u03FB\u03FD\x07G","\u03FC\u03EB\u03FC\u03F4","\u03FDb\u03FE\u03FF\u01AF\xD8","\u03FF\u0400\u01B9\xDD\u0400\u0401\u01CD\xE7","\u0401\u0402\u01CF\xE8\u0402\u0403\u01B9\xDD","\u0403\u0404\u01C3\xE2\u0404\u0405\u01AD\xD7","\u0405\u0406\u01CF\xE8\u0406\u0410","\u0407\u0408\x07F\u0408\u0409\x07K\u0409","\u040A\x07U\u040A\u040B\x07V\u040B\u040C","\x07K\u040C\u040D\x07P\u040D\u040E\x07","E\u040E\u0410\x07V\u040F\u03FE","\u040F\u0407\u0410d","\u0411\u0412\u01AF\xD8\u0412\u0413\u01CB","\xE6\u0413\u0414\u01C5\xE3\u0414\u0415\u01C7","\xE4\u0415\u041B\u0416\u0417\x07F","\u0417\u0418\x07T\u0418\u0419\x07Q","\u0419\u041B\x07R\u041A\u0411","\u041A\u0416\u041Bf","\u041C\u041D\u01AF\xD8\u041D\u041E\u01D1\xE9","\u041E\u041F\u01CB\xE6\u041F\u0420\u01A9\xD5","\u0420\u0421\u01AB\xD6\u0421\u0422\u01BF\xE0","\u0422\u0423\u01B1\xD9\u0423\u0424\x07a","\u0424\u0425\u01D5\xEB\u0425\u0426\u01CB\xE6","\u0426\u0427\u01B9\xDD\u0427\u0428\u01CF\xE8","\u0428\u0429\u01B1\xD9\u0429\u042A\u01CD\xE7","\u042A\u043A\u042B\u042C\x07F","\u042C\u042D\x07W\u042D\u042E\x07T","\u042E\u042F\x07C\u042F\u0430\x07D\u0430","\u0431\x07N\u0431\u0432\x07G\u0432\u0433","\x07a\u0433\u0434\x07Y\u0434\u0435\x07","T\u0435\u0436\x07K\u0436\u0437\x07V","\u0437\u0438\x07G\u0438\u043A\x07U","\u0439\u041C\u0439\u042B","\u043Ah\u043B\u043C\u01B1\xD9","\u043C\u043D\u01A9\xD5\u043D\u043E\u01AD\xD7","\u043E\u043F\u01B7\xDC\u043F\u0440\x07a","\u0440\u0441\u01C9\xE5\u0441\u0442\u01D1\xE9","\u0442\u0443\u01C5\xE3\u0443\u0444\u01CB\xE6","\u0444\u0445\u01D1\xE9\u0445\u0446\u01C1\xE1","\u0446\u0453\u0447\u0448\x07G","\u0448\u0449\x07C\u0449\u044A\x07E\u044A","\u044B\x07J\u044B\u044C\x07a\u044C\u044D","\x07S\u044D\u044E\x07W\u044E\u044F\x07","Q\u044F\u0450\x07T\u0450\u0451\x07W","\u0451\u0453\x07O\u0452\u043B","\u0452\u0447\u0453j","\u0454\u0455\u01B1\xD9\u0455\u0456\u01C3\xE2","\u0456\u0457\u01CF\xE8\u0457\u0458\u01CB\xE6","\u0458\u0459\u01B9\xDD\u0459\u045A\u01B1\xD9","\u045A\u045B\u01CD\xE7\u045B\u0464","\u045C\u045D\x07G\u045D\u045E\x07P","\u045E\u045F\x07V\u045F\u0460\x07T\u0460","\u0461\x07K\u0461\u0462\x07G\u0462\u0464","\x07U\u0463\u0454\u0463\u045C","\u0464l\u0465\u0466","\u01B1\xD9\u0466\u0467\u01D7\xEC\u0467\u0468","\u01B1\xD9\u0468\u0469\u01AD\xD7\u0469\u046A","\u01D1\xE9\u046A\u046B\u01CF\xE8\u046B\u046C","\u01B1\xD9\u046C\u0475\u046D\u046E","\x07G\u046E\u046F\x07Z\u046F\u0470\x07","G\u0470\u0471\x07E\u0471\u0472\x07W","\u0472\u0473\x07V\u0473\u0475\x07G","\u0474\u0465\u0474\u046D","\u0475n\u0476\u0477\u01B1\xD9","\u0477\u0478\u01D7\xEC\u0478\u0479\u01B9\xDD","\u0479\u047A\u01CD\xE7\u047A\u047B\u01CF\xE8","\u047B\u047C\u01CD\xE7\u047C\u0484","\u047D\u047E\x07G\u047E\u047F\x07Z\u047F","\u0480\x07K\u0480\u0481\x07U\u0481\u0482","\x07V\u0482\u0484\x07U\u0483\u0476","\u0483\u047D\u0484p","\u0485\u0486\u01B3\xDA\u0486\u0487","\u01A9\xD5\u0487\u0488\u01BF\xE0\u0488\u0489","\u01CD\xE7\u0489\u048A\u01B1\xD9\u048A\u0499","\u048B\u048C\x07H\u048C\u048D\x07","C\u048D\u048E\x07N\u048E\u048F\x07U","\u048F\u0499\x07G\u0490\u0491-","\u0491\u0492\u01B3\xDA\u0492\u0493\u01A9\xD5","\u0493\u0494\u01BF\xE0\u0494\u0495\u01CD\xE7","\u0495\u0496\u01B1\xD9\u0496\u0497-","\u0497\u0499\u0498\u0485","\u0498\u048B\u0498\u0490","\u0499r\u049A\u049B\u01B3\xDA","\u049B\u049C\u01B9\xDD\u049C\u049D\u01BF\xE0","\u049D\u049E\u01CF\xE8\u049E\u049F\u01B1\xD9","\u049F\u04A0\u01CB\xE6\u04A0\u04A1\u01B9\xDD","\u04A1\u04A2\u01C3\xE2\u04A2\u04A3\u01B5\xDB","\u04A3\u04AE\u04A4\u04A5\x07H","\u04A5\u04A6\x07K\u04A6\u04A7\x07N\u04A7","\u04A8\x07V\u04A8\u04A9\x07G\u04A9\u04AA","\x07T\u04AA\u04AB\x07K\u04AB\u04AC\x07","P\u04AC\u04AE\x07I\u04AD\u049A","\u04AD\u04A4\u04AEt","\u04AF\u04B0\u01B3\xDA\u04B0\u04B1\u01B9","\xDD\u04B1\u04B2\u01C3\xE2\u04B2\u04B3\u01A9","\xD5\u04B3\u04B4\u01BF\xE0\u04B4\u04B5\u01B3","\xDA\u04B5\u04B6\u01D1\xE9\u04B6\u04B7\u01C3","\xE2\u04B7\u04B8\u01AD\xD7\u04B8\u04C3","\u04B9\u04BA\x07H\u04BA\u04BB\x07K","\u04BB\u04BC\x07P\u04BC\u04BD\x07C","\u04BD\u04BE\x07N\u04BE\u04BF\x07H\u04BF","\u04C0\x07W\u04C0\u04C1\x07P\u04C1\u04C3","\x07E\u04C2\u04AF\u04C2\u04B9","\u04C3v\u04C4\u04C5","\u01B3\xDA\u04C5\u04C6\u01CB\xE6\u04C6\u04C7","\u01C5\xE3\u04C7\u04C8\u01C1\xE1\u04C8\u04CE","\u04C9\u04CA\x07H\u04CA\u04CB","\x07T\u04CB\u04CC\x07Q\u04CC\u04CE\x07","O\u04CD\u04C4\u04CD\u04C9","\u04CEx\u04CF\u04D0","\u01B3\xDA\u04D0\u04D1\u01D1\xE9\u04D1\u04D2","\u01BF\xE0\u04D2\u04D3\u01BF\xE0\u04D3\u04D9","\u04D4\u04D5\x07H\u04D5\u04D6\x07","W\u04D6\u04D7\x07N\u04D7\u04D9\x07N","\u04D8\u04CF\u04D8\u04D4","\u04D9z\u04DA\u04DB\u01B3\xDA","\u04DB\u04DC\u01D1\xE9\u04DC\u04DD\u01C3\xE2","\u04DD\u04DE\u01AD\xD7\u04DE\u04DF\u01CF\xE8","\u04DF\u04E0\u01B9\xDD\u04E0\u04E1\u01C5\xE3","\u04E1\u04E2\u01C3\xE2\u04E2\u04EC","\u04E3\u04E4\x07H\u04E4\u04E5\x07W","\u04E5\u04E6\x07P\u04E6\u04E7\x07E\u04E7","\u04E8\x07V\u04E8\u04E9\x07K\u04E9\u04EA","\x07Q\u04EA\u04EC\x07P\u04EB\u04DA","\u04EB\u04E3\u04EC|","\u04ED\u04EE\u01B3\xDA\u04EE\u04EF","\u01D1\xE9\u04EF\u04F0\u01C3\xE2\u04F0\u04F1","\u01AD\xD7\u04F1\u04F2\u01CF\xE8\u04F2\u04F3","\u01B9\xDD\u04F3\u04F4\u01C5\xE3\u04F4\u04F5","\u01C3\xE2\u04F5\u04F6\u01CD\xE7\u04F6\u0501","\u04F7\u04F8\x07H\u04F8\u04F9\x07","W\u04F9\u04FA\x07P\u04FA\u04FB\x07E","\u04FB\u04FC\x07V\u04FC\u04FD\x07K","\u04FD\u04FE\x07Q\u04FE\u04FF\x07P\u04FF","\u0501\x07U\u0500\u04ED\u0500","\u04F7\u0501~\u0502","\u0503\u01B5\xDB\u0503\u0504\u01CB\xE6\u0504","\u0505\u01A9\xD5\u0505\u0506\u01C3\xE2\u0506","\u0507\u01CF\xE8\u0507\u050E\u0508","\u0509\x07I\u0509\u050A\x07T\u050A\u050B","\x07C\u050B\u050C\x07P\u050C\u050E\x07","V\u050D\u0502\u050D\u0508","\u050E\x80\u050F\u0510","\u01B9\xDD\u0510\u0511\u01B3\xDA\u0511\u0515","\u0512\u0513\x07K\u0513\u0515\x07","H\u0514\u050F\u0514\u0512","\u0515\x82\u0516\u0517","\u01B9\xDD\u0517\u0518\u01C3\xE2\u0518\u051C","\u0519\u051A\x07K\u051A\u051C\x07","P\u051B\u0516\u051B\u0519","\u051C\x84\u051D\u051E","\u01B9\xDD\u051E\u051F\u01C3\xE2\u051F\u0520","\u01AF\xD8\u0520\u0521\u01B1\xD9\u0521\u0522","\u01D7\xEC\u0522\u0529\u0523\u0524\x07","K\u0524\u0525\x07P\u0525\u0526\x07F","\u0526\u0527\x07G\u0527\u0529\x07Z","\u0528\u051D\u0528\u0523","\u0529\x86\u052A\u052B\u01B9\xDD","\u052B\u052C\u01C3\xE2\u052C\u052D\u01B3\xDA","\u052D\u052E\u01B9\xDD\u052E\u052F\u01C3\xE2","\u052F\u0530\u01B9\xDD\u0530\u0531\u01CF\xE8","\u0531\u0532\u01D9\xED\u0532\u053C","\u0533\u0534\x07K\u0534\u0535\x07P\u0535","\u0536\x07H\u0536\u0537\x07K\u0537\u0538","\x07P\u0538\u0539\x07K\u0539\u053A\x07","V\u053A\u053C\x07[\u053B\u052A","\u053B\u0533\u053C\x88","\u053D\u053E\u01B9\xDD\u053E\u053F\u01C3","\xE2\u053F\u0540\u01B9\xDD\u0540\u0541\u01CF","\xE8\u0541\u0542\u01AD\xD7\u0542\u0543\u01C5","\xE3\u0543\u0544\u01C3\xE2\u0544\u0545\u01AF","\xD8\u0545\u054F\u0546\u0547\x07K","\u0547\u0548\x07P\u0548\u0549\x07K","\u0549\u054A\x07V\u054A\u054B\x07E","\u054B\u054C\x07Q\u054C\u054D\x07P\u054D","\u054F\x07F\u054E\u053D\u054E","\u0546\u054F\x8A\u0550","\u0551\u01B9\xDD\u0551\u0552\u01C3\xE2\u0552","\u0553\u01C7\xE4\u0553\u0554\u01D1\xE9\u0554","\u0555\u01CF\xE8\u0555\u055C\u0556","\u0557\x07K\u0557\u0558\x07P\u0558\u0559","\x07R\u0559\u055A\x07W\u055A\u055C\x07","V\u055B\u0550\u055B\u0556","\u055C\x8C\u055D\u055E","\u01B9\xDD\u055E\u055F\u01C3\xE2\u055F\u0560","\u01CD\xE7\u0560\u0561\u01B1\xD9\u0561\u0562","\u01CB\xE6\u0562\u0563\u01CF\xE8\u0563\u056B","\u0564\u0565\x07K\u0565\u0566\x07","P\u0566\u0567\x07U\u0567\u0568\x07G","\u0568\u0569\x07T\u0569\u056B\x07V","\u056A\u055D\u056A\u0564","\u056B\x8E\u056C\u056D\u01B9\xDD","\u056D\u056E\u01C3\xE2\u056E\u056F\u01CF\xE8","\u056F\u0570\u01C5\xE3\u0570\u0576","\u0571\u0572\x07K\u0572\u0573\x07P\u0573","\u0574\x07V\u0574\u0576\x07Q\u0575\u056C","\u0575\u0571\u0576\x90","\u0577\u0578\u01B9\xDD\u0578\u0579","\u01CD\xE7\u0579\u057D\u057A\u057B","\x07K\u057B\u057D\x07U\u057C\u0577","\u057C\u057A\u057D\x92","\u057E\u057F\u01BB\xDE\u057F\u0580","\u01CD\xE7\u0580\u0581\u01C5\xE3\u0581\u0582","\u01C3\xE2\u0582\u0588\u0583\u0584\x07","L\u0584\u0585\x07U\u0585\u0586\x07Q","\u0586\u0588\x07P\u0587\u057E","\u0587\u0583\u0588\x94","\u0589\u058A\u01BD\xDF\u058A\u058B\u01B1\xD9","\u058B\u058C\u01D9\xED\u058C\u0591","\u058D\u058E\x07M\u058E\u058F\x07G","\u058F\u0591\x07[\u0590\u0589","\u0590\u058D\u0591\x96","\u0592\u0593\u01BD\xDF\u0593\u0594\u01B1\xD9","\u0594\u0595\u01D9\xED\u0595\u0596\u01CD\xE7","\u0596\u059C\u0597\u0598\x07M","\u0598\u0599\x07G\u0599\u059A\x07[\u059A","\u059C\x07U\u059B\u0592\u059B","\u0597\u059C\x98\u059D","\u059E\u01BD\xDF\u059E\u059F\u01B1\xD9\u059F","\u05A0\u01D9\xED\u05A0\u05A1\u01CD\xE7\u05A1","\u05A2\u01C7\xE4\u05A2\u05A3\u01A9\xD5\u05A3","\u05A4\u01AD\xD7\u05A4\u05A5\u01B1\xD9\u05A5","\u05AF\u05A6\u05A7\x07M\u05A7","\u05A8\x07G\u05A8\u05A9\x07[\u05A9\u05AA","\x07U\u05AA\u05AB\x07R\u05AB\u05AC\x07","C\u05AC\u05AD\x07E\u05AD\u05AF\x07G","\u05AE\u059D\u05AE\u05A6","\u05AF\x9A\u05B0\u05B1\u01BD\xDF","\u05B1\u05B2\u01B1\xD9\u05B2\u05B3\u01D9\xED","\u05B3\u05B4\u01CD\xE7\u05B4\u05B5\u01C7\xE4","\u05B5\u05B6\u01A9\xD5\u05B6\u05B7\u01AD\xD7","\u05B7\u05B8\u01B1\xD9\u05B8\u05B9\u01CD\xE7","\u05B9\u05C4\u05BA\u05BB\x07M","\u05BB\u05BC\x07G\u05BC\u05BD\x07[","\u05BD\u05BE\x07U\u05BE\u05BF\x07R\u05BF","\u05C0\x07C\u05C0\u05C1\x07E\u05C1\u05C2","\x07G\u05C2\u05C4\x07U\u05C3\u05B0","\u05C3\u05BA\u05C4\x9C","\u05C5\u05C6\u01BF\xE0\u05C6\u05C7","\u01A9\xD5\u05C7\u05C8\u01C3\xE2\u05C8\u05C9","\u01B5\xDB\u05C9\u05CA\u01D1\xE9\u05CA\u05CB","\u01A9\xD5\u05CB\u05CC\u01B5\xDB\u05CC\u05CD","\u01B1\xD9\u05CD\u05D7\u05CE\u05CF\x07","N\u05CF\u05D0\x07C\u05D0\u05D1\x07P","\u05D1\u05D2\x07I\u05D2\u05D3\x07W","\u05D3\u05D4\x07C\u05D4\u05D5\x07I\u05D5","\u05D7\x07G\u05D6\u05C5\u05D6","\u05CE\u05D7\x9E\u05D8","\u05D9\u01BF\xE0\u05D9\u05DA\u01B1\xD9\u05DA","\u05DB\u01D3\xEA\u05DB\u05DC\u01B1\xD9\u05DC","\u05DD\u01BF\xE0\u05DD\u05E4\u05DE","\u05DF\x07N\u05DF\u05E0\x07G\u05E0\u05E1","\x07X\u05E1\u05E2\x07G\u05E2\u05E4\x07","N\u05E3\u05D8\u05E3\u05DE","\u05E4\xA0\u05E5\u05E6","\u01BF\xE0\u05E6\u05E7\u01B9\xDD\u05E7\u05E8","\u01C1\xE1\u05E8\u05E9\u01B9\xDD\u05E9\u05EA","\u01CF\xE8\u05EA\u05F1\u05EB\u05EC\x07","N\u05EC\u05ED\x07K\u05ED\u05EE\x07O","\u05EE\u05EF\x07K\u05EF\u05F1\x07V","\u05F0\u05E5\u05F0\u05EB","\u05F1\xA2\u05F2\u05F3\u01BF\xE0","\u05F3\u05F4\u01C5\xE3\u05F4\u05F5\u01AD\xD7","\u05F5\u05F6\u01A9\xD5\u05F6\u05F7\u01BF\xE0","\u05F7\u05F8\x07a\u05F8\u05F9\u01C5\xE3","\u05F9\u05FA\u01C3\xE2\u05FA\u05FB\u01B1\xD9","\u05FB\u0606\u05FC\u05FD\x07N","\u05FD\u05FE\x07Q\u05FE\u05FF\x07E\u05FF","\u0600\x07C\u0600\u0601\x07N\u0601\u0602","\x07a\u0602\u0603\x07Q\u0603\u0604\x07","P\u0604\u0606\x07G\u0605\u05F2","\u0605\u05FC\u0606\xA4","\u0607\u0608\u01BF\xE0\u0608\u0609\u01C5","\xE3\u0609\u060A\u01AD\xD7\u060A\u060B\u01A9","\xD5\u060B\u060C\u01BF\xE0\u060C\u060D\x07a","\u060D\u060E\u01C9\xE5\u060E\u060F\u01D1","\xE9\u060F\u0610\u01C5\xE3\u0610\u0611\u01CB","\xE6\u0611\u0612\u01D1\xE9\u0612\u0613\u01C1","\xE1\u0613\u0621\u0614\u0615\x07N","\u0615\u0616\x07Q\u0616\u0617\x07E","\u0617\u0618\x07C\u0618\u0619\x07N","\u0619\u061A\x07a\u061A\u061B\x07S\u061B","\u061C\x07W\u061C\u061D\x07Q\u061D\u061E","\x07T\u061E\u061F\x07W\u061F\u0621\x07","O\u0620\u0607\u0620\u0614","\u0621\xA6\u0622\u0623","\u01BF\xE0\u0623\u0624\u01C5\xE3\u0624\u0625","\u01B5\xDB\u0625\u0626\u01B5\xDB\u0626\u0627","\u01B1\xD9\u0627\u0628\u01AF\xD8\u0628\u0630","\u0629\u062A\x07N\u062A\u062B\x07","Q\u062B\u062C\x07I\u062C\u062D\x07I","\u062D\u062E\x07G\u062E\u0630\x07F","\u062F\u0622\u062F\u0629","\u0630\xA8\u0631\u0632\u01BF\xE0","\u0632\u0633\u01C5\xE3\u0633\u0634\u01B5\xDB","\u0634\u0635\u01B9\xDD\u0635\u0636\u01C3\xE2","\u0636\u063D\u0637\u0638\x07N","\u0638\u0639\x07Q\u0639\u063A\x07I\u063A","\u063B\x07K\u063B\u063D\x07P\u063C\u0631","\u063C\u0637\u063D\xAA","\u063E\u063F\u01C1\xE1\u063F\u0640","\u01A9\xD5\u0640\u0641\u01CF\xE8\u0641\u0642","\u01B1\xD9\u0642\u0643\u01CB\xE6\u0643\u0644","\u01B9\xDD\u0644\u0645\u01A9\xD5\u0645\u0646","\u01BF\xE0\u0646\u0647\u01B9\xDD\u0647\u0648","\u01DB\xEE\u0648\u0649\u01B1\xD9\u0649\u064A","\u01AF\xD8\u064A\u0658\u064B\u064C","\x07O\u064C\u064D\x07C\u064D\u064E\x07","V\u064E\u064F\x07G\u064F\u0650\x07T","\u0650\u0651\x07K\u0651\u0652\x07C","\u0652\u0653\x07N\u0653\u0654\x07K\u0654","\u0655\x07\\\u0655\u0656\x07G\u0656\u0658","\x07F\u0657\u063E\u0657\u064B","\u0658\xAC\u0659\u065A","\u01C1\xE1\u065A\u065B\u01C5\xE3\u065B\u065C","\u01AF\xD8\u065C\u065D\u01B9\xDD\u065D\u065E","\u01B3\xDA\u065E\u065F\u01D9\xED\u065F\u0667","\u0660\u0661\x07O\u0661\u0662","\x07Q\u0662\u0663\x07F\u0663\u0664\x07","K\u0664\u0665\x07H\u0665\u0667\x07[","\u0666\u0659\u0666\u0660","\u0667\xAE\u0668\u0669\u01C3\xE2","\u0669\u066A\u01A9\xD5\u066A\u066B\u01C3\xE2","\u066B\u0670\u066C\u066D\x07P","\u066D\u066E\x07C\u066E\u0670\x07P","\u066F\u0668\u066F\u066C","\u0670\xB0\u0671\u0672\u01C3\xE2","\u0672\u0673\u01C5\xE3\u0673\u0674\u01CB\xE6","\u0674\u0675\u01B1\xD9\u0675\u0676\u01AD\xD7","\u0676\u0677\u01D1\xE9\u0677\u0678\u01CB\xE6","\u0678\u0679\u01CD\xE7\u0679\u067A\u01B9\xDD","\u067A\u067B\u01D3\xEA\u067B\u067C\u01B1\xD9","\u067C\u0689\u067D\u067E\x07P","\u067E\u067F\x07Q\u067F\u0680\x07T\u0680","\u0681\x07G\u0681\u0682\x07E\u0682\u0683","\x07W\u0683\u0684\x07T\u0684\u0685\x07","U\u0685\u0686\x07K\u0686\u0687\x07X","\u0687\u0689\x07G\u0688\u0671","\u0688\u067D\u0689\xB2","\u068A\u068B\u01C3\xE2\u068B\u068C\u01C5\xE3","\u068C\u068D\u01CD\xE7\u068D\u068E\u01D1\xE9","\u068E\u068F\u01C7\xE4\u068F\u0690\u01B1\xD9","\u0690\u0691\u01CB\xE6\u0691\u0692\u01D1\xE9","\u0692\u0693\u01CD\xE7\u0693\u0694\u01B1\xD9","\u0694\u0695\u01CB\xE6\u0695\u06A2","\u0696\u0697\x07P\u0697\u0698\x07Q","\u0698\u0699\x07U\u0699\u069A\x07W\u069A","\u069B\x07R\u069B\u069C\x07G\u069C\u069D","\x07T\u069D\u069E\x07W\u069E\u069F\x07","U\u069F\u06A0\x07G\u06A0\u06A2\x07T","\u06A1\u068A\u06A1\u0696","\u06A2\xB4\u06A3\u06A4\u01C3\xE2","\u06A4\u06A5\u01C5\xE3\u06A5\u06A6\u01CF\xE8","\u06A6\u06AB\u06A7\u06A8\x07P","\u06A8\u06A9\x07Q\u06A9\u06AB\x07V","\u06AA\u06A3\u06AA\u06A7","\u06AB\xB6\u06AC\u06AD\u01C3\xE2","\u06AD\u06AE\u01D1\xE9\u06AE\u06AF\u01BF\xE0","\u06AF\u06B0\u01BF\xE0\u06B0\u06B6","\u06B1\u06B2\x07P\u06B2\u06B3\x07W\u06B3","\u06B4\x07N\u06B4\u06B6\x07N\u06B5\u06AC","\u06B5\u06B1\u06B6\xB8","\u06B7\u06B8\u01C5\xE3\u06B8\u06B9","\u01B3\xDA\u06B9\u06BD\u06BA\u06BB","\x07Q\u06BB\u06BD\x07H\u06BC\u06B7","\u06BC\u06BA\u06BD\xBA","\u06BE\u06BF\u01C5\xE3\u06BF\u06C0","\u01C3\xE2\u06C0\u06C4\u06C1\u06C2\x07","Q\u06C2\u06C4\x07P\u06C3\u06BE","\u06C3\u06C1\u06C4\xBC","\u06C5\u06C6\u01C5\xE3\u06C6\u06C7\u01C3","\xE2\u06C7\u06C8\u01B1\xD9\u06C8\u06CD","\u06C9\u06CA\x07Q\u06CA\u06CB\x07P","\u06CB\u06CD\x07G\u06CC\u06C5","\u06CC\u06C9\u06CD\xBE","\u06CE\u06CF\u01C5\xE3\u06CF\u06D0\u01C7\xE4","\u06D0\u06D1\u01CF\xE8\u06D1\u06D2\u01B9\xDD","\u06D2\u06D3\u01C5\xE3\u06D3\u06D4\u01C3\xE2","\u06D4\u06D5\u01CD\xE7\u06D5\u06DE","\u06D6\u06D7\x07Q\u06D7\u06D8\x07R","\u06D8\u06D9\x07V\u06D9\u06DA\x07K\u06DA","\u06DB\x07Q\u06DB\u06DC\x07P\u06DC\u06DE","\x07U\u06DD\u06CE\u06DD\u06D6","\u06DE\xC0\u06DF\u06E0","\u01C5\xE3\u06E0\u06E1\u01CB\xE6\u06E1\u06E5","\u06E2\u06E3\x07Q\u06E3\u06E5","\x07T\u06E4\u06DF\u06E4\u06E2","\u06E5\xC2\u06E6\u06E7","\u01C5\xE3\u06E7\u06E8\u01CB\xE6\u06E8\u06E9","\u01AF\xD8\u06E9\u06EA\u01B1\xD9\u06EA\u06EB","\u01CB\xE6\u06EB\u06F2\u06EC\u06ED","\x07Q\u06ED\u06EE\x07T\u06EE\u06EF\x07","F\u06EF\u06F0\x07G\u06F0\u06F2\x07T","\u06F1\u06E6\u06F1\u06EC","\u06F2\xC4\u06F3\u06F4\u01C7\xE4","\u06F4\u06F5\u01A9\xD5\u06F5\u06F6\u01CB\xE6","\u06F6\u06F7\u01CF\xE8\u06F7\u06F8\u01B9\xDD","\u06F8\u06F9\u01CF\xE8\u06F9\u06FA\u01B9\xDD","\u06FA\u06FB\u01C5\xE3\u06FB\u06FC\u01C3\xE2","\u06FC\u0707\u06FD\u06FE\x07R","\u06FE\u06FF\x07C\u06FF\u0700\x07T","\u0700\u0701\x07V\u0701\u0702\x07K\u0702","\u0703\x07V\u0703\u0704\x07K\u0704\u0705","\x07Q\u0705\u0707\x07P\u0706\u06F3","\u0706\u06FD\u0707\xC6","\u0708\u0709\u01C7\xE4\u0709\u070A","\u01A9\xD5\u070A\u070B\u01CD\xE7\u070B\u070C","\u01CD\xE7\u070C\u070D\u01D5\xEB\u070D\u070E","\u01C5\xE3\u070E\u070F\u01CB\xE6\u070F\u0710","\u01AF\xD8\u0710\u071A\u0711\u0712\x07","R\u0712\u0713\x07C\u0713\u0714\x07U","\u0714\u0715\x07U\u0715\u0716\x07Y","\u0716\u0717\x07Q\u0717\u0718\x07T\u0718","\u071A\x07F\u0719\u0708\u0719","\u0711\u071A\xC8\u071B","\u071C\u01C7\xE4\u071C\u071D\u01B1\xD9\u071D","\u071E\u01CB\xE6\u071E\u0723\u071F","\u0720\x07R\u0720\u0721\x07G\u0721\u0723","\x07T\u0722\u071B\u0722\u071F","\u0723\xCA\u0724\u0725","\u01C7\xE4\u0725\u0726\u01B1\xD9\u0726\u0727","\u01CB\xE6\u0727\u0728\u01C1\xE1\u0728\u0729","\u01B9\xDD\u0729\u072A\u01CD\xE7\u072A\u072B","\u01CD\xE7\u072B\u072C\u01B9\xDD\u072C\u072D","\u01C5\xE3\u072D\u072E\u01C3\xE2\u072E\u073A","\u072F\u0730\x07R\u0730\u0731","\x07G\u0731\u0732\x07T\u0732\u0733\x07","O\u0733\u0734\x07K\u0734\u0735\x07U","\u0735\u0736\x07U\u0736\u0737\x07K","\u0737\u0738\x07Q\u0738\u073A\x07P\u0739","\u0724\u0739\u072F\u073A","\xCC\u073B\u073C\u01C7\xE4\u073C","\u073D\u01B1\xD9\u073D\u073E\u01CB\xE6\u073E","\u073F\u01C1\xE1\u073F\u0740\u01B9\xDD\u0740","\u0741\u01CD\xE7\u0741\u0742\u01CD\xE7\u0742","\u0743\u01B9\xDD\u0743\u0744\u01C5\xE3\u0744","\u0745\u01C3\xE2\u0745\u0746\u01CD\xE7\u0746","\u0753\u0747\u0748\x07R\u0748","\u0749\x07G\u0749\u074A\x07T\u074A\u074B","\x07O\u074B\u074C\x07K\u074C\u074D\x07","U\u074D\u074E\x07U\u074E\u074F\x07K","\u074F\u0750\x07Q\u0750\u0751\x07P","\u0751\u0753\x07U\u0752\u073B","\u0752\u0747\u0753\xCE","\u0754\u0755\u01C7\xE4\u0755\u0756\u01CB\xE6","\u0756\u0757\u01B9\xDD\u0757\u0758\u01C1\xE1","\u0758\u0759\u01A9\xD5\u0759\u075A\u01CB\xE6","\u075A\u075B\u01D9\xED\u075B\u0764","\u075C\u075D\x07R\u075D\u075E\x07T\u075E","\u075F\x07K\u075F\u0760\x07O\u0760\u0761","\x07C\u0761\u0762\x07T\u0762\u0764\x07","[\u0763\u0754\u0763\u075C","\u0764\xD0\u0765\u0766","\u01C9\xE5\u0766\u0767\u01D1\xE9\u0767\u0768","\u01C5\xE3\u0768\u0769\u01CB\xE6\u0769\u076A","\u01D1\xE9\u076A\u076B\u01C1\xE1\u076B\u0773","\u076C\u076D\x07S\u076D\u076E\x07","W\u076E\u076F\x07Q\u076F\u0770\x07T","\u0770\u0771\x07W\u0771\u0773\x07O","\u0772\u0765\u0772\u076C","\u0773\xD2\u0774\u0775\u01CB\xE6","\u0775\u0776\u01B1\xD9\u0776\u0777\u01C3\xE2","\u0777\u0778\u01A9\xD5\u0778\u0779\u01C1\xE1","\u0779\u077A\u01B1\xD9\u077A\u0782","\u077B\u077C\x07T\u077C\u077D\x07G\u077D","\u077E\x07P\u077E\u077F\x07C\u077F\u0780","\x07O\u0780\u0782\x07G\u0781\u0774","\u0781\u077B\u0782\xD4","\u0783\u0784\u01CB\xE6\u0784\u0785","\u01B1\xD9\u0785\u0786\u01C7\xE4\u0786\u0787","\u01BF\xE0\u0787\u0788\u01A9\xD5\u0788\u0789","\u01AD\xD7\u0789\u078A\u01B1\xD9\u078A\u0793","\u078B\u078C\x07T\u078C\u078D\x07","G\u078D\u078E\x07R\u078E\u078F\x07N","\u078F\u0790\x07C\u0790\u0791\x07E","\u0791\u0793\x07G\u0792\u0783","\u0792\u078B\u0793\xD6","\u0794\u0795\u01CB\xE6\u0795\u0796\u01B1\xD9","\u0796\u0797\u01C7\xE4\u0797\u0798\u01BF\xE0","\u0798\u0799\u01B9\xDD\u0799\u079A\u01AD\xD7","\u079A\u079B\u01A9\xD5\u079B\u079C\u01CF\xE8","\u079C\u079D\u01B9\xDD\u079D\u079E\u01C5\xE3","\u079E\u079F\u01C3\xE2\u079F\u07AC","\u07A0\u07A1\x07T\u07A1\u07A2\x07G\u07A2","\u07A3\x07R\u07A3\u07A4\x07N\u07A4\u07A5","\x07K\u07A5\u07A6\x07E\u07A6\u07A7\x07","C\u07A7\u07A8\x07V\u07A8\u07A9\x07K","\u07A9\u07AA\x07Q\u07AA\u07AC\x07P","\u07AB\u0794\u07AB\u07A0","\u07AC\xD8\u07AD\u07AE\u01CB\xE6","\u07AE\u07AF\u01B1\xD9\u07AF\u07B0\u01CF\xE8","\u07B0\u07B1\u01D1\xE9\u07B1\u07B2\u01CB\xE6","\u07B2\u07B3\u01C3\xE2\u07B3\u07B4\u01CD\xE7","\u07B4\u07BD\u07B5\u07B6\x07T","\u07B6\u07B7\x07G\u07B7\u07B8\x07V\u07B8","\u07B9\x07W\u07B9\u07BA\x07T\u07BA\u07BB","\x07P\u07BB\u07BD\x07U\u07BC\u07AD","\u07BC\u07B5\u07BD\xDA","\u07BE\u07BF\u01CB\xE6\u07BF\u07C0","\u01B1\xD9\u07C0\u07C1\u01D3\xEA\u07C1\u07C2","\u01C5\xE3\u07C2\u07C3\u01BD\xDF\u07C3\u07C4","\u01B1\xD9\u07C4\u07CC\u07C5\u07C6\x07","T\u07C6\u07C7\x07G\u07C7\u07C8\x07X","\u07C8\u07C9\x07Q\u07C9\u07CA\x07M","\u07CA\u07CC\x07G\u07CB\u07BE","\u07CB\u07C5\u07CC\xDC","\u07CD\u07CE\u01CB\xE6\u07CE\u07CF\u01C5\xE3","\u07CF\u07D0\u01BF\xE0\u07D0\u07D1\u01B1\xD9","\u07D1\u07D7\u07D2\u07D3\x07T","\u07D3\u07D4\x07Q\u07D4\u07D5\x07N\u07D5","\u07D7\x07G\u07D6\u07CD\u07D6","\u07D2\u07D7\xDE\u07D8","\u07D9\u01CB\xE6\u07D9\u07DA\u01C5\xE3\u07DA","\u07DB\u01BF\xE0\u07DB\u07DC\u01B1\xD9\u07DC","\u07DD\u01CD\xE7\u07DD\u07E4\u07DE","\u07DF\x07T\u07DF\u07E0\x07Q\u07E0\u07E1","\x07N\u07E1\u07E2\x07G\u07E2\u07E4\x07","U\u07E3\u07D8\u07E3\u07DE","\u07E4\xE0\u07E5\u07E6","\u01B9\xDD\u07E6\u07E7\u01C3\xE2\u07E7\u07E8","\u01CF\xE8\u07E8\u07E9\u01B1\xD9\u07E9\u07EA","\u01CB\xE6\u07EA\u07EB\u01C3\xE2\u07EB\u07EC","\u01A9\xD5\u07EC\u07ED\u01BF\xE0\u07ED\u07F7","\u07EE\u07EF\x07K\u07EF\u07F0\x07","P\u07F0\u07F1\x07V\u07F1\u07F2\x07G","\u07F2\u07F3\x07T\u07F3\u07F4\x07P","\u07F4\u07F5\x07C\u07F5\u07F7\x07N\u07F6","\u07E5\u07F6\u07EE\u07F7","\xE2\u07F8\u07F9\u01BF\xE0\u07F9","\u07FA\u01AF\xD8\u07FA\u07FB\u01A9\xD5\u07FB","\u07FC\u01C7\xE4\u07FC\u0802\u07FD","\u07FE\x07N\u07FE\u07FF\x07F\u07FF\u0800","\x07C\u0800\u0802\x07R\u0801\u07F8","\u0801\u07FD\u0802\xE4","\u0803\u0804\u01CD\xE7\u0804\u0805","\u01AD\xD7\u0805\u0806\u01B1\xD9\u0806\u0807","\u01C1\xE1\u0807\u0808\u01B1\xD9\u0808\u0810","\u0809\u080A\x07U\u080A\u080B\x07","E\u080B\u080C\x07J\u080C\u080D\x07G","\u080D\u080E\x07O\u080E\u0810\x07G","\u080F\u0803\u080F\u0809","\u0810\xE6\u0811\u0812\u01CD\xE7","\u0812\u0813\u01AD\xD7\u0813\u0814\u01B7\xDC","\u0814\u0815\u01B1\xD9\u0815\u0816\u01C1\xE1","\u0816\u0817\u01A9\xD5\u0817\u081F","\u0818\u0819\x07U\u0819\u081A\x07E\u081A","\u081B\x07J\u081B\u081C\x07G\u081C\u081D","\x07O\u081D\u081F\x07C\u081E\u0811","\u081E\u0818\u081F\xE8","\u0820\u0821\u01CD\xE7\u0821\u0822","\u01B1\xD9\u0822\u0823\u01BF\xE0\u0823\u0824","\u01B1\xD9\u0824\u0825\u01AD\xD7\u0825\u0826","\u01CF\xE8\u0826\u082E\u0827\u0828\x07","U\u0828\u0829\x07G\u0829\u082A\x07N","\u082A\u082B\x07G\u082B\u082C\x07E","\u082C\u082E\x07V\u082D\u0820","\u082D\u0827\u082E\xEA","\u082F\u0830\u01CD\xE7\u0830\u0831\u01B1\xD9","\u0831\u0832\u01CF\xE8\u0832\u0837","\u0833\u0834\x07U\u0834\u0835\x07G\u0835","\u0837\x07V\u0836\u082F\u0836","\u0833\u0837\xEC\u0838","\u0839\u01CD\xE7\u0839\u083A\u01B3\xDA\u083A","\u083B\u01D1\xE9\u083B\u083C\u01C3\xE2\u083C","\u083D\u01AD\xD7\u083D\u0844\u083E","\u083F\x07U\u083F\u0840\x07H\u0840\u0841","\x07W\u0841\u0842\x07P\u0842\u0844\x07","E\u0843\u0838\u0843\u083E","\u0844\xEE\u0845\u0846","\u01CD\xE7\u0846\u0847\u01CF\xE8\u0847\u0848","\u01A9\xD5\u0848\u0849\u01CF\xE8\u0849\u084A","\u01B9\xDD\u084A\u084B\u01AD\xD7\u084B\u0853","\u084C\u084D\x07U\u084D\u084E\x07","V\u084E\u084F\x07C\u084F\u0850\x07V","\u0850\u0851\x07K\u0851\u0853\x07E","\u0852\u0845\u0852\u084C","\u0853\xF0\u0854\u0855\u01CD\xE7","\u0855\u0856\u01CF\xE8\u0856\u0857\u01C5\xE3","\u0857\u0858\u01CB\xE6\u0858\u0859\u01A9\xD5","\u0859\u085A\u01B5\xDB\u085A\u085B\u01B1\xD9","\u085B\u0864\u085C\u085D\x07U","\u085D\u085E\x07V\u085E\u085F\x07Q\u085F","\u0860\x07T\u0860\u0861\x07C\u0861\u0862","\x07I\u0862\u0864\x07G\u0863\u0854","\u0863\u085C\u0864\xF2","\u0865\u0866\u01CD\xE7\u0866\u0867","\u01CF\xE8\u0867\u0868\u01D9\xED\u0868\u0869","\u01C7\xE4\u0869\u086A\u01B1\xD9\u086A\u0871","\u086B\u086C\x07U\u086C\u086D\x07","V\u086D\u086E\x07[\u086E\u086F\x07R","\u086F\u0871\x07G\u0870\u0865","\u0870\u086B\u0871\xF4","\u0872\u0873\u01CD\xE7\u0873\u0874\u01D1\xE9","\u0874\u0875\u01C7\xE4\u0875\u0876\u01B1\xD9","\u0876\u0877\u01CB\xE6\u0877\u0878\u01D1\xE9","\u0878\u0879\u01CD\xE7\u0879\u087A\u01B1\xD9","\u087A\u087B\u01CB\xE6\u087B\u0886","\u087C\u087D\x07U\u087D\u087E\x07W","\u087E\u087F\x07R\u087F\u0880\x07G\u0880","\u0881\x07T\u0881\u0882\x07W\u0882\u0883","\x07U\u0883\u0884\x07G\u0884\u0886\x07","T\u0885\u0872\u0885\u087C","\u0886\xF6\u0887\u0888","\u01CF\xE8\u0888\u0889\u01A9\xD5\u0889\u088A","\u01AB\xD6\u088A\u088B\u01BF\xE0\u088B\u088C","\u01B1\xD9\u088C\u0893\u088D\u088E\x07","V\u088E\u088F\x07C\u088F\u0890\x07D","\u0890\u0891\x07N\u0891\u0893\x07G","\u0892\u0887\u0892\u088D","\u0893\xF8\u0894\u0895\u01CF\xE8","\u0895\u0896\u01B7\xDC\u0896\u0897\u01CB\xE6","\u0897\u0898\u01B1\xD9\u0898\u0899\u01B1\xD9","\u0899\u08A0\u089A\u089B\x07V","\u089B\u089C\x07J\u089C\u089D\x07T\u089D","\u089E\x07G\u089E\u08A0\x07G\u089F\u0894","\u089F\u089A\u08A0\xFA","\u08A1\u08A2\u01CF\xE8\u08A2\u08A3","\u01B9\xDD\u08A3\u08A4\u01C1\xE1\u08A4\u08A5","\u01B1\xD9\u08A5\u08A6\u01CD\xE7\u08A6\u08A7","\u01CF\xE8\u08A7\u08A8\u01A9\xD5\u08A8\u08A9","\u01C1\xE1\u08A9\u08AA\u01C7\xE4\u08AA\u08B5","\u08AB\u08AC\x07V\u08AC\u08AD","\x07K\u08AD\u08AE\x07O\u08AE\u08AF\x07","G\u08AF\u08B0\x07U\u08B0\u08B1\x07V","\u08B1\u08B2\x07C\u08B2\u08B3\x07O","\u08B3\u08B5\x07R\u08B4\u08A1","\u08B4\u08AB\u08B5\xFC","\u08B6\u08B7\u01CF\xE8\u08B7\u08B8\u01C5\xE3","\u08B8\u08BC\u08B9\u08BA\x07V","\u08BA\u08BC\x07Q\u08BB\u08B6","\u08BB\u08B9\u08BC\xFE","\u08BD\u08BE\u01CF\xE8\u08BE\u08BF\u01C5\xE3","\u08BF\u08C0\u01BD\xDF\u08C0\u08C1\u01B1\xD9","\u08C1\u08C2\u01C3\xE2\u08C2\u08C9","\u08C3\u08C4\x07V\u08C4\u08C5\x07Q\u08C5","\u08C6\x07M\u08C6\u08C7\x07G\u08C7\u08C9","\x07P\u08C8\u08BD\u08C8\u08C3","\u08C9\u0100\u08CA\u08CB","\u01CF\xE8\u08CB\u08CC\u01CB\xE6\u08CC\u08CD","\u01B9\xDD\u08CD\u08CE\u01B5\xDB\u08CE\u08CF","\u01B5\xDB\u08CF\u08D0\u01B1\xD9\u08D0\u08D1","\u01CB\xE6\u08D1\u08DA\u08D2\u08D3","\x07V\u08D3\u08D4\x07T\u08D4\u08D5\x07","K\u08D5\u08D6\x07I\u08D6\u08D7\x07I","\u08D7\u08D8\x07G\u08D8\u08DA\x07T","\u08D9\u08CA\u08D9\u08D2","\u08DA\u0102\u08DB\u08DC\u01CF\xE8","\u08DC\u08DD\u01CB\xE6\u08DD\u08DE\u01D1\xE9","\u08DE\u08DF\u01B1\xD9\u08DF\u08EC","\u08E0\u08E1\x07V\u08E1\u08E2\x07T\u08E2","\u08E3\x07W\u08E3\u08EC\x07G\u08E4\u08E5","-\u08E5\u08E6\u01CF\xE8\u08E6\u08E7","\u01CB\xE6\u08E7\u08E8\u01D1\xE9\u08E8\u08E9","\u01B1\xD9\u08E9\u08EA-\u08EA\u08EC","\u08EB\u08DB\u08EB\u08E0","\u08EB\u08E4\u08EC\u0104","\u08ED\u08EE\u01CF\xE8\u08EE\u08EF","\u01CB\xE6\u08EF\u08F0\u01D1\xE9\u08F0\u08F1","\u01C3\xE2\u08F1\u08F2\u01AD\xD7\u08F2\u08F3","\u01A9\xD5\u08F3\u08F4\u01CF\xE8\u08F4\u08F5","\u01B1\xD9\u08F5\u08FF\u08F6\u08F7","\x07V\u08F7\u08F8\x07T\u08F8\u08F9\x07","W\u08F9\u08FA\x07P\u08FA\u08FB\x07E","\u08FB\u08FC\x07C\u08FC\u08FD\x07V","\u08FD\u08FF\x07G\u08FE\u08ED","\u08FE\u08F6\u08FF\u0106","\u0900\u0901\u01CF\xE8\u0901\u0902\u01CF\xE8","\u0902\u0903\u01BF\xE0\u0903\u0908","\u0904\u0905\x07V\u0905\u0906\x07V\u0906","\u0908\x07N\u0907\u0900\u0907","\u0904\u0908\u0108\u0909","\u090A\u01CF\xE8\u090A\u090B\u01D5\xEB\u090B","\u090C\u01C5\xE3\u090C\u0911\u090D","\u090E\x07V\u090E\u090F\x07Y\u090F\u0911","\x07Q\u0910\u0909\u0910\u090D","\u0911\u010A\u0912\u0913","\u01CF\xE8\u0913\u0914\u01D9\xED\u0914\u0915","\u01C7\xE4\u0915\u0916\u01B1\xD9\u0916\u091C","\u0917\u0918\x07V\u0918\u0919","\x07[\u0919\u091A\x07R\u091A\u091C\x07","G\u091B\u0912\u091B\u0917","\u091C\u010C\u091D\u091E","\u01D1\xE9\u091E\u091F\u01C3\xE2\u091F\u0920","\u01BF\xE0\u0920\u0921\u01C5\xE3\u0921\u0922","\u01B5\xDB\u0922\u0923\u01B5\xDB\u0923\u0924","\u01B1\xD9\u0924\u0925\u01AF\xD8\u0925\u092F","\u0926\u0927\x07W\u0927\u0928\x07","P\u0928\u0929\x07N\u0929\u092A\x07Q","\u092A\u092B\x07I\u092B\u092C\x07I","\u092C\u092D\x07G\u092D\u092F\x07F\u092E","\u091D\u092E\u0926\u092F","\u010E\u0930\u0931\u01D1\xE9\u0931","\u0932\u01C7\xE4\u0932\u0933\u01AF\xD8\u0933","\u0934\u01A9\xD5\u0934\u0935\u01CF\xE8\u0935","\u0936\u01B1\xD9\u0936\u093E\u0937","\u0938\x07W\u0938\u0939\x07R\u0939\u093A","\x07F\u093A\u093B\x07C\u093B\u093C\x07","V\u093C\u093E\x07G\u093D\u0930","\u093D\u0937\u093E\u0110","\u093F\u0940\u01D1\xE9\u0940\u0941\u01CD","\xE7\u0941\u0942\u01B1\xD9\u0942\u0947","\u0943\u0944\x07W\u0944\u0945\x07U","\u0945\u0947\x07G\u0946\u093F","\u0946\u0943\u0947\u0112","\u0948\u0949\u01D1\xE9\u0949\u094A\u01CD\xE7","\u094A\u094B\u01B1\xD9\u094B\u094C\u01CB\xE6","\u094C\u0952\u094D\u094E\x07W","\u094E\u094F\x07U\u094F\u0950\x07G","\u0950\u0952\x07T\u0951\u0948","\u0951\u094D\u0952\u0114","\u0953\u0954\u01D1\xE9\u0954\u0955\u01CD\xE7","\u0955\u0956\u01B9\xDD\u0956\u0957\u01C3\xE2","\u0957\u0958\u01B5\xDB\u0958\u095F","\u0959\u095A\x07W\u095A\u095B\x07U\u095B","\u095C\x07K\u095C\u095D\x07P\u095D\u095F","\x07I\u095E\u0953\u095E\u0959","\u095F\u0116\u0960\u0961","\u01D1\xE9\u0961\u0962\u01D1\xE9\u0962\u0963","\u01B9\xDD\u0963\u0964\u01AF\xD8\u0964\u096A","\u0965\u0966\x07W\u0966\u0967","\x07W\u0967\u0968\x07K\u0968\u096A\x07","F\u0969\u0960\u0969\u0965","\u096A\u0118\u096B\u096C","\u01D3\xEA\u096C\u096D\u01A9\xD5\u096D\u096E","\u01BF\xE0\u096E\u096F\u01D1\xE9\u096F\u0970","\u01B1\xD9\u0970\u0971\u01CD\xE7\u0971\u0979","\u0972\u0973\x07X\u0973\u0974\x07","C\u0974\u0975\x07N\u0975\u0976\x07W","\u0976\u0977\x07G\u0977\u0979\x07U","\u0978\u096B\u0978\u0972","\u0979\u011A\u097A\u097B\u01D3\xEA","\u097B\u097C\u01B9\xDD\u097C\u097D\u01B1\xD9","\u097D\u097E\u01D5\xEB\u097E\u0984","\u097F\u0980\x07X\u0980\u0981\x07K\u0981","\u0982\x07G\u0982\u0984\x07Y\u0983\u097A","\u0983\u097F\u0984\u011C","\u0985\u0986\u01D5\xEB\u0986\u0987","\u01B7\xDC\u0987\u0988\u01B1\xD9\u0988\u0989","\u01CB\xE6\u0989\u098A\u01B1\xD9\u098A\u0991","\u098B\u098C\x07Y\u098C\u098D","\x07J\u098D\u098E\x07G\u098E\u098F\x07","T\u098F\u0991\x07G\u0990\u0985","\u0990\u098B\u0991\u011E","\u0992\u0993\u01D5\xEB\u0993\u0994\u01B9","\xDD\u0994\u0995\u01CF\xE8\u0995\u0996\u01B7","\xDC\u0996\u099C\u0997\u0998\x07Y","\u0998\u0999\x07K\u0999\u099A\x07V","\u099A\u099C\x07J\u099B\u0992","\u099B\u0997\u099C\u0120","\u099D\u099E\u01D5\xEB\u099E\u099F\u01CB\xE6","\u099F\u09A0\u01B9\xDD\u09A0\u09A1\u01CF\xE8","\u09A1\u09A2\u01B1\xD9\u09A2\u09A3\u01CF\xE8","\u09A3\u09A4\u01B9\xDD\u09A4\u09A5\u01C1\xE1","\u09A5\u09A6\u01B1\xD9\u09A6\u09B1","\u09A7\u09A8\x07Y\u09A8\u09A9\x07T","\u09A9\u09AA\x07K\u09AA\u09AB\x07V\u09AB","\u09AC\x07G\u09AC\u09AD\x07V\u09AD\u09AE","\x07K\u09AE\u09AF\x07O\u09AF\u09B1\x07","G\u09B0\u099D\u09B0\u09A7","\u09B1\u0122\u09B2\u09B3","\u01A9\xD5\u09B3\u09B4\u01CD\xE7\u09B4\u09B5","\u01AD\xD7\u09B5\u09B6\u01B9\xDD\u09B6\u09B7","\u01B9\xDD\u09B7\u09C1\u09B8\u09B9","-\u09B9\u09BA\u01A9\xD5\u09BA\u09BB","\u01CD\xE7\u09BB\u09BC\u01AD\xD7\u09BC\u09BD","\u01B9\xDD\u09BD\u09BE\u01B9\xDD\u09BE\u09BF","-\u09BF\u09C1\u09C0\u09B2","\u09C0\u09B8\u09C1\u0124","\u09C2\u09C3-\u09C3\u09C4","\u01AD\xD7\u09C4\u09C5\u01A9\xD5\u09C5\u09C6","\u01CD\xE7\u09C6\u09C7\u01B1\xD9\u09C7\u09C8\x07","a\u09C8\u09C9\u01CD\xE7\u09C9\u09CA","\u01B1\xD9\u09CA\u09CB\u01C3\xE2\u09CB\u09CC","\u01CD\xE7\u09CC\u09CD\u01B9\xDD\u09CD\u09CE","\u01CF\xE8\u09CE\u09CF\u01B9\xDD\u09CF\u09D0","\u01D3\xEA\u09D0\u09D1\u01B1\xD9\u09D1\u09D2","-\u09D2\u0126\u09D3\u09D4","-\u09D4\u09D5\u01C3\xE2\u09D5\u09D6","\u01C5\xE3\u09D6\u09D7\u01CB\xE6\u09D7\u09D8","\u01C1\xE1\u09D8\u09D9\u01A9\xD5\u09D9\u09DA","\u01BF\xE0\u09DA\u09DB\u01B9\xDD\u09DB\u09DC","\u01DB\xEE\u09DC\u09DD\u01B1\xD9\u09DD\u09DE","-\u09DE\u0128\u09DF\u09E0","\u01CD\xE7\u09E0\u09E1\u01B9\xDD\u09E1\u09E2","\u01C1\xE1\u09E2\u09E3\u01B9\xDD\u09E3\u09E4","\u01BF\xE0\u09E4\u09E5\u01A9\xD5\u09E5\u09E6","\u01CB\xE6\u09E6\u09E7\u01B9\xDD\u09E7\u09E8","\u01CF\xE8\u09E8\u09E9\u01D9\xED\u09E9\u09EA\x07","a\u09EA\u09EB\u01B3\xDA\u09EB\u09EC","\u01D1\xE9\u09EC\u09ED\u01C3\xE2\u09ED\u09EE","\u01AD\xD7\u09EE\u09EF\u01CF\xE8\u09EF\u09F0","\u01B9\xDD\u09F0\u09F1\u01C5\xE3\u09F1\u09F2","\u01C3\xE2\u09F2\u0A0A\u09F3\u09F4","-\u09F4\u09F5\u01CD\xE7\u09F5\u09F6","\u01B9\xDD\u09F6\u09F7\u01C1\xE1\u09F7\u09F8","\u01B9\xDD\u09F8\u09F9\u01BF\xE0\u09F9\u09FA","\u01A9\xD5\u09FA\u09FB\u01CB\xE6\u09FB\u09FC","\u01B9\xDD\u09FC\u09FD\u01CF\xE8\u09FD\u09FE","\u01D9\xED\u09FE\u09FF\x07a\u09FF\u0A00","\u01B3\xDA\u0A00\u0A01\u01D1\xE9\u0A01\u0A02","\u01C3\xE2\u0A02\u0A03\u01AD\xD7\u0A03\u0A04","\u01CF\xE8\u0A04\u0A05\u01B9\xDD\u0A05\u0A06","\u01C5\xE3\u0A06\u0A07\u01C3\xE2\u0A07\u0A08","-\u0A08\u0A0A\u0A09\u09DF","\u0A09\u09F3\u0A0A\u012A","\u0A0B\u0A0C-\u0A0C\u0A0D","\u01A9\xD5\u0A0D\u0A0E\u01C3\xE2\u0A0E\u0A0F","\u01A9\xD5\u0A0F\u0A10\u01BF\xE0\u0A10\u0A11","\u01D9\xED\u0A11\u0A12\u01DB\xEE\u0A12\u0A13","\u01B1\xD9\u0A13\u0A14\u01AF\xD8\u0A14\u0A15","-\u0A15\u012C\u0A16\u0A17","-\u0A17\u0A18\u01B9\xDD\u0A18\u0A19","\u01CD\xE7\u0A19\u0A1A\x07a\u0A1A\u0A1B","\u01BF\xE0\u0A1B\u0A1C\u01B9\xDD\u0A1C\u0A1D","\u01CF\xE8\u0A1D\u0A1E\u01B1\xD9\u0A1E\u0A1F","\u01CB\xE6\u0A1F\u0A20\u01A9\xD5\u0A20\u0A21","\u01BF\xE0\u0A21\u0A22-\u0A22\u012E","\u0A23\u0A24-\u0A24\u0A25","\u01C1\xE1\u0A25\u0A26\u01A9\xD5\u0A26\u0A27","\u01D7\xEC\u0A27\u0A28\x07a\u0A28\u0A29","\u01AD\xD7\u0A29\u0A2A\u01C5\xE3\u0A2A\u0A2B","\u01C1\xE1\u0A2B\u0A2C\u01C7\xE4\u0A2C\u0A2D","\u01A9\xD5\u0A2D\u0A2E\u01AD\xD7\u0A2E\u0A2F","\u01CF\xE8\u0A2F\u0A30\u01B9\xDD\u0A30\u0A31","\u01C5\xE3\u0A31\u0A32\u01C3\xE2\u0A32\u0A33\x07","a\u0A33\u0A34\u01B3\xDA\u0A34\u0A35","\u01BF\xE0\u0A35\u0A36\u01D1\xE9\u0A36\u0A37","\u01CD\xE7\u0A37\u0A38\u01B7\xDC\u0A38\u0A39\x07","a\u0A39\u0A3A\u01C1\xE1\u0A3A\u0A3B","\u01B1\xD9\u0A3B\u0A3C\u01C1\xE1\u0A3C\u0A3D","\u01C5\xE3\u0A3D\u0A3E\u01CB\xE6\u0A3E\u0A3F","\u01D9\xED\u0A3F\u0A40\x07a\u0A40\u0A41","\u01B9\xDD\u0A41\u0A42\u01C3\xE2\u0A42\u0A43\x07","a\u0A43\u0A44\u01C1\xE1\u0A44\u0A45","\u01AB\xD6\u0A45\u0A46-\u0A46\u0130","\u0A47\u0A48-\u0A48\u0A49","\u01CF\xE8\u0A49\u0A4A\u01C5\xE3\u0A4A\u0A4B","\u01BD\xDF\u0A4B\u0A4C\u01B1\xD9\u0A4C\u0A4D","\u01C3\xE2\u0A4D\u0A4E\u01B9\xDD\u0A4E\u0A4F","\u01DB\xEE\u0A4F\u0A50\u01A9\xD5\u0A50\u0A51","\u01CF\xE8\u0A51\u0A52\u01B9\xDD\u0A52\u0A53","\u01C5\xE3\u0A53\u0A54\u01C3\xE2\u0A54\u0A55\x07","a\u0A55\u0A56\u01B1\xD9\u0A56\u0A57","\u01C3\xE2\u0A57\u0A58\u01A9\xD5\u0A58\u0A59","\u01AB\xD6\u0A59\u0A5A\u01BF\xE0\u0A5A\u0A5B","\u01B1\xD9\u0A5B\u0A5C\x07a\u0A5C\u0A5D","\u01CD\xE7\u0A5D\u0A5E\u01CF\xE8\u0A5E\u0A5F","\u01B1\xD9\u0A5F\u0A60\u01C1\xE1\u0A60\u0A61","\u01C1\xE1\u0A61\u0A62\u01B9\xDD\u0A62\u0A63","\u01C3\xE2\u0A63\u0A64\u01B5\xDB\u0A64\u0A65","-\u0A65\u0132\u0A66\u0A67","-\u0A67\u0A68\u01CF\xE8\u0A68\u0A69","\u01C5\xE3\u0A69\u0A6A\u01BD\xDF\u0A6A\u0A6B","\u01B1\xD9\u0A6B\u0A6C\u01C3\xE2\u0A6C\u0A6D","\u01B9\xDD\u0A6D\u0A6E\u01DB\xEE\u0A6E\u0A6F","\u01A9\xD5\u0A6F\u0A70\u01CF\xE8\u0A70\u0A71","\u01B9\xDD\u0A71\u0A72\u01C5\xE3\u0A72\u0A73","\u01C3\xE2\u0A73\u0A74\x07a\u0A74\u0A75","\u01CD\xE7\u0A75\u0A76\u01BD\xDF\u0A76\u0A77","\u01B9\xDD\u0A77\u0A78\u01C7\xE4\u0A78\u0A79\x07","a\u0A79\u0A7A\u01CD\xE7\u0A7A\u0A7B","\u01CF\xE8\u0A7B\u0A7C\u01C5\xE3\u0A7C\u0A7D","\u01C7\xE4\u0A7D\u0A7E\x07a\u0A7E\u0A7F","\u01D5\xEB\u0A7F\u0A80\u01C5\xE3\u0A80\u0A81","\u01CB\xE6\u0A81\u0A82\u01AF\xD8\u0A82\u0A83","\u01CD\xE7\u0A83\u0A84-\u0A84\u0134","\u0A85\u0A86-\u0A86\u0A87","\u01CF\xE8\u0A87\u0A88\u01C5\xE3\u0A88\u0A89","\u01BD\xDF\u0A89\u0A8A\u01B1\xD9\u0A8A\u0A8B","\u01C3\xE2\u0A8B\u0A8C\u01B9\xDD\u0A8C\u0A8D","\u01DB\xEE\u0A8D\u0A8E\u01A9\xD5\u0A8E\u0A8F","\u01CF\xE8\u0A8F\u0A90\u01B9\xDD\u0A90\u0A91","\u01C5\xE3\u0A91\u0A92\u01C3\xE2\u0A92\u0A93\x07","a\u0A93\u0A94\u01BF\xE0\u0A94\u0A95","\u01C5\xE3\u0A95\u0A96\u01AD\xD7\u0A96\u0A97","\u01A9\xD5\u0A97\u0A98\u01BF\xE0\u0A98\u0A99","\u01B1\xD9\u0A99\u0A9A-\u0A9A\u0136","\u0A9B\u0A9C-\u0A9C\u0A9D","\u01CF\xE8\u0A9D\u0A9E\u01C5\xE3\u0A9E\u0A9F","\u01BD\xDF\u0A9F\u0AA0\u01B1\xD9\u0AA0\u0AA1","\u01C3\xE2\u0AA1\u0AA2\u01B9\xDD\u0AA2\u0AA3","\u01DB\xEE\u0AA3\u0AA4\u01A9\xD5\u0AA4\u0AA5","\u01CF\xE8\u0AA5\u0AA6\u01B9\xDD\u0AA6\u0AA7","\u01C5\xE3\u0AA7\u0AA8\u01C3\xE2\u0AA8\u0AA9\x07","a\u0AA9\u0AAA\u01C3\xE2\u0AAA\u0AAB","\u01C5\xE3\u0AAB\u0AAC\u01CB\xE6\u0AAC\u0AAD","\u01C1\xE1\u0AAD\u0AAE\u01A9\xD5\u0AAE\u0AAF","\u01BF\xE0\u0AAF\u0AB0\u01B9\xDD\u0AB0\u0AB1","\u01DB\xEE\u0AB1\u0AB2\u01B1\xD9\u0AB2\u0AB3\x07","a\u0AB3\u0AB4\u01BF\xE0\u0AB4\u0AB5","\u01C5\xE3\u0AB5\u0AB6\u01D5\xEB\u0AB6\u0AB7","\u01B1\xD9\u0AB7\u0AB8\u01CB\xE6\u0AB8\u0AB9","\u01AD\xD7\u0AB9\u0ABA\u01A9\xD5\u0ABA\u0ABB","\u01CD\xE7\u0ABB\u0ABC\u01B1\xD9\u0ABC\u0ABD","-\u0ABD\u0138\u0ABE\u0ABF","-\u0ABF\u0AC0\u01CF\xE8\u0AC0\u0AC1","\u01C5\xE3\u0AC1\u0AC2\u01BD\xDF\u0AC2\u0AC3","\u01B1\xD9\u0AC3\u0AC4\u01C3\xE2\u0AC4\u0AC5","\u01B9\xDD\u0AC5\u0AC6\u01DB\xEE\u0AC6\u0AC7","\u01A9\xD5\u0AC7\u0AC8\u01CF\xE8\u0AC8\u0AC9","\u01B9\xDD\u0AC9\u0ACA\u01C5\xE3\u0ACA\u0ACB","\u01C3\xE2\u0ACB\u0ACC\x07a\u0ACC\u0ACD","\u01C3\xE2\u0ACD\u0ACE\u01C5\xE3\u0ACE\u0ACF","\u01CB\xE6\u0ACF\u0AD0\u01C1\xE1\u0AD0\u0AD1","\u01A9\xD5\u0AD1\u0AD2\u01BF\xE0\u0AD2\u0AD3","\u01B9\xDD\u0AD3\u0AD4\u01DB\xEE\u0AD4\u0AD5","\u01B1\xD9\u0AD5\u0AD6\x07a\u0AD6\u0AD7","\u01D1\xE9\u0AD7\u0AD8\u01C7\xE4\u0AD8\u0AD9","\u01C7\xE4\u0AD9\u0ADA\u01B1\xD9\u0ADA\u0ADB","\u01CB\xE6\u0ADB\u0ADC\u01AD\xD7\u0ADC\u0ADD","\u01A9\xD5\u0ADD\u0ADE\u01CD\xE7\u0ADE\u0ADF","\u01B1\xD9\u0ADF\u0AE0-\u0AE0\u013A","\u0AE1\u0AE2-\u0AE2\u0AE3","\u01C3\xE2\u0AE3\u0AE4\u01C5\xE3\u0AE4\u0AE5","\u01CB\xE6\u0AE5\u0AE6\u01C1\xE1\u0AE6\u0AE7","\u01A9\xD5\u0AE7\u0AE8\u01BF\xE0\u0AE8\u0AE9","\u01B9\xDD\u0AE9\u0AEA\u01DB\xEE\u0AEA\u0AEB","\u01B1\xD9\u0AEB\u0AEC\x07a\u0AEC\u0AED","\u01BF\xE0\u0AED\u0AEE\u01C5\xE3\u0AEE\u0AEF","\u01D5\xEB\u0AEF\u0AF0\u01B1\xD9\u0AF0\u0AF1","\u01CB\xE6\u0AF1\u0AF2\u01AD\xD7\u0AF2\u0AF3","\u01A9\xD5\u0AF3\u0AF4\u01CD\xE7\u0AF4\u0AF5","\u01B1\xD9\u0AF5\u0AF6-\u0AF6\u013C","\u0AF7\u0AF8-\u0AF8\u0AF9","\u01C3\xE2\u0AF9\u0AFA\u01C5\xE3\u0AFA\u0AFB","\u01CB\xE6\u0AFB\u0AFC\u01C1\xE1\u0AFC\u0AFD","\u01A9\xD5\u0AFD\u0AFE\u01BF\xE0\u0AFE\u0AFF","\u01B9\xDD\u0AFF\u0B00\u01DB\xEE\u0B00\u0B01","\u01B1\xD9\u0B01\u0B02\x07a\u0B02\u0B03","\u01D1\xE9\u0B03\u0B04\u01C7\xE4\u0B04\u0B05","\u01C7\xE4\u0B05\u0B06\u01B1\xD9\u0B06\u0B07","\u01CB\xE6\u0B07\u0B08\u01AD\xD7\u0B08\u0B09","\u01A9\xD5\u0B09\u0B0A\u01CD\xE7\u0B0A\u0B0B","\u01B1\xD9\u0B0B\u0B0C-\u0B0C\u013E","\u0B0D\u0B0E-\u0B0E\u0B0F","\u01C1\xE1\u0B0F\u0B10\u01C5\xE3\u0B10\u0B11","\u01AF\xD8\u0B11\u0B12\u01B1\xD9\u0B12\u0B13","-\u0B13\u0140\u0B14\u0B15","-\u0B15\u0B16\u01A9\xD5\u0B16\u0B17","\u01C3\xE2\u0B17\u0B18\u01A9\xD5\u0B18\u0B19","\u01BF\xE0\u0B19\u0B1A\u01D9\xED\u0B1A\u0B1B","\u01DB\xEE\u0B1B\u0B1C\u01B1\xD9\u0B1C\u0B1D","\u01CB\xE6\u0B1D\u0B1E\x07a\u0B1E\u0B1F","\u01AD\xD7\u0B1F\u0B20\u01BF\xE0\u0B20\u0B21","\u01A9\xD5\u0B21\u0B22\u01CD\xE7\u0B22\u0B23","\u01CD\xE7\u0B23\u0B24-\u0B24\u0142","\u0B25\u0B26-\u0B26\u0B27","\u01CD\xE7\u0B27\u0B28\u01CF\xE8\u0B28\u0B29","\u01C5\xE3\u0B29\u0B2A\u01CB\xE6\u0B2A\u0B2B","\u01A9\xD5\u0B2B\u0B2C\u01B5\xDB\u0B2C\u0B2D","\u01B1\xD9\u0B2D\u0B2E\u01A9\xD5\u0B2E\u0B2F","\u01CF\xE8\u0B2F\u0B30\u01CF\xE8\u0B30\u0B31","\u01A9\xD5\u0B31\u0B32\u01AD\xD7\u0B32\u0B33","\u01B7\xDC\u0B33\u0B34\u01B1\xD9\u0B34\u0B35","\u01AF\xD8\u0B35\u0B36\u01B9\xDD\u0B36\u0B37","\u01C3\xE2\u0B37\u0B38\u01AF\xD8\u0B38\u0B39","\u01B1\xD9\u0B39\u0B3A\u01D7\xEC\u0B3A\u0B3B","-\u0B3B\u0144\u0B3C\u0B3D","-\u0B3D\u0B3E\u01C5\xE3\u0B3E\u0B3F","\u01CB\xE6\u0B3F\u0B40\u01B5\xDB\u0B40\u0B41","\u0B41\u0B42\u01A9\xD5\u0B42\u0B43","\u01C7\xE4\u0B43\u0B44\u01A9\xD5\u0B44\u0B45","\u01AD\xD7\u0B45\u0B46\u01B7\xDC\u0B46\u0B47","\u01B1\xD9\u0B47\u0B48\u0B48\u0B49","\u01AD\xD7\u0B49\u0B4A\u01A9\xD5\u0B4A\u0B4B","\u01CD\xE7\u0B4B\u0B4C\u01CD\xE7\u0B4C\u0B4D","\u01A9\xD5\u0B4D\u0B4E\u01C3\xE2\u0B4E\u0B4F","\u01AF\xD8\u0B4F\u0B50\u01CB\xE6\u0B50\u0B51","\u01A9\xD5\u0B51\u0B52\u0B52\u0B53","\u01B9\xDD\u0B53\u0B54\u01C3\xE2\u0B54\u0B55","\u01AF\xD8\u0B55\u0B56\u01B1\xD9\u0B56\u0B57","\u01D7\xEC\u0B57\u0B58\u0B58\u0B59","\u01CD\xE7\u0B59\u0B5A\u01A9\xD5\u0B5A\u0B5B","\u01CD\xE7\u0B5B\u0B5C\u01B9\xDD\u0B5C\u0B5D","\u0B5D\u0B5E\u01CD\xE7\u0B5E\u0B5F","\u01A9\xD5\u0B5F\u0B60\u01CD\xE7\u0B60\u0B61","\u01B9\xDD\u0B61\u0B62\u01B9\xDD\u0B62\u0B63","\u01C3\xE2\u0B63\u0B64\u01AF\xD8\u0B64\u0B65","\u01B1\xD9\u0B65\u0B66\u01D7\xEC\u0B66\u0B67","-\u0B67\u0146\u0B68\u0B69","-\u0B69\u0B6A\u01AD\xD7\u0B6A\u0B6B","\u01C5\xE3\u0B6B\u0B6C\u01C1\xE1\u0B6C\u0B6D","\u0B6D\u0B6E\u01AF\xD8\u0B6E\u0B6F","\u01A9\xD5\u0B6F\u0B70\u01CF\xE8\u0B70\u0B71","\u01A9\xD5\u0B71\u0B72\u01CD\xE7\u0B72\u0B73","\u01CF\xE8\u0B73\u0B74\u01A9\xD5\u0B74\u0B75","\u01D7\xEC\u0B75\u0B76\u0B76\u0B77","\u01AB\xD6\u0B77\u0B78\u01AF\xD8\u0B78\u0B79","\u01C7\xE4\u0B79\u0B7A\u0B7A\u0B7B","\u01CD\xE7\u0B7B\u0B7C\u01B1\xD9\u0B7C\u0B7D","\u01A9\xD5\u0B7D\u0B7E\u01CB\xE6\u0B7E\u0B7F","\u01AD\xD7\u0B7F\u0B80\u01B7\xDC\u0B80\u0B81","\u0B81\u0B82\u01CD\xE7\u0B82\u0B83","\u01C5\xE3\u0B83\u0B84\u01BF\xE0\u0B84\u0B85","\u01CB\xE6\u0B85\u0B86\u0B86\u0B87","\u01AD\xD7\u0B87\u0B88\u01C9\xE5\u0B88\u0B89","\u01BF\xE0\u0B89\u0B8A\x075\u0B8A\u0B8B","\u01CD\xE7\u0B8B\u0B8C\u01C5\xE3\u0B8C\u0B8D","\u01BF\xE0\u0B8D\u0B8E\u01CB\xE6\u0B8E\u0B8F","\u01CD\xE7\u0B8F\u0B90\u01B1\xD9\u0B90\u0B91","\u01AD\xD7\u0B91\u0B92\u01C5\xE3\u0B92\u0B93","\u01C3\xE2\u0B93\u0B94\u01AF\xD8\u0B94\u0B95","\u01A9\xD5\u0B95\u0B96\u01CB\xE6\u0B96\u0B97","\u01D9\xED\u0B97\u0B98\u01B9\xDD\u0B98\u0B99","\u01C3\xE2\u0B99\u0B9A\u01AF\xD8\u0B9A\u0B9B","\u01B1\xD9\u0B9B\u0B9C\u01D7\xEC\u0B9C\u0B9D","-\u0B9D\u0148\u0B9E\u0B9F","\u01CD\xE7\u0B9F\u0BA0\u01C7\xE4\u0BA0\u0BA1","\u01A9\xD5\u0BA1\u0BA2\u01AD\xD7\u0BA2\u0BA3","\u01B1\xD9\u0BA3\u0BA4\u01CD\xE7\u0BA4\u0BA5","\u01A9\xD5\u0BA5\u0BA6\u01D3\xEA\u0BA6\u0BA7","\u01B9\xDD\u0BA7\u0BA8\u01C3\xE2\u0BA8\u0BA9","\u01B5\xDB\u0BA9\u0BAA\u01C3\xE2\u0BAA\u0BAB","\u01C5\xE3\u0BAB\u0BAC\u01BB\xDE\u0BAC\u0BAD","\u01C5\xE3\u0BAD\u0BAE\u01B9\xDD\u0BAE\u0BAF","\u01C3\xE2\u0BAF\u014A\u0BB0\u0BB1","\u01CD\xE7\u0BB1\u0BB2\u01C7\xE4\u0BB2\u0BB3","\u01A9\xD5\u0BB3\u0BB4\u01AD\xD7\u0BB4\u0BB5","\u01B1\xD9\u0BB5\u0BB6\u01CD\xE7\u0BB6\u0BB7","\u01A9\xD5\u0BB7\u0BB8\u01D3\xEA\u0BB8\u0BB9","\u01B9\xDD\u0BB9\u0BBA\u01C3\xE2\u0BBA\u0BBB","\u01B5\xDB\u0BBB\u0BBC\u01A9\xD5\u0BBC\u0BBD","\u01BF\xE0\u0BBD\u0BBE\u01BF\xE0\u0BBE\u014C","\u0BBF\u0BC0\u01CD\xE7\u0BC0\u0BC1","\u01C7\xE4\u0BC1\u0BC2\u01A9\xD5\u0BC2\u0BC3","\u01AD\xD7\u0BC3\u0BC4\u01B1\xD9\u0BC4\u0BC5","\u01CD\xE7\u0BC5\u0BC6\u01A9\xD5\u0BC6\u0BC7","\u01D3\xEA\u0BC7\u0BC8\u01B9\xDD\u0BC8\u0BC9","\u01C3\xE2\u0BC9\u0BCA\u01B5\xDB\u0BCA\u0BCB","\u01CD\xE7\u0BCB\u0BCC\u01BF\xE0\u0BCC\u0BCD","\u01C5\xE3\u0BCD\u0BCE\u01D5\xEB\u0BCE\u0BCF","\u01CF\xE8\u0BCF\u0BD0\u01CB\xE6\u0BD0\u0BD1","\u01B9\xDD\u0BD1\u0BD2\u01B1\xD9\u0BD2\u0BD3","\u01C7\xE4\u0BD3\u0BD4\u01CB\xE6\u0BD4\u0BD5","\u01B1\xD9\u0BD5\u0BD6\u01AD\xD7\u0BD6\u0BD7","\u01B9\xDD\u0BD7\u0BD8\u01CD\xE7\u0BD8\u0BD9","\u01B9\xDD\u0BD9\u0BDA\u01C5\xE3\u0BDA\u0BDB","\u01C3\xE2\u0BDB\u014E\u0BDC\u0BDD","\u01CD\xE7\u0BDD\u0BDE\u01C7\xE4\u0BDE\u0BDF","\u01A9\xD5\u0BDF\u0BE0\u01AD\xD7\u0BE0\u0BE1","\u01B1\xD9\u0BE1\u0BE2\u01CD\xE7\u0BE2\u0BE3","\u01A9\xD5\u0BE3\u0BE4\u01D3\xEA\u0BE4\u0BE5","\u01B9\xDD\u0BE5\u0BE6\u01C3\xE2\u0BE6\u0BE7","\u01B5\xDB\u0BE7\u0BE8\u01C3\xE2\u0BE8\u0BE9","\u01C5\xE3\u0BE9\u0BEA\u01CF\xE8\u0BEA\u0BEB","\u01B1\xD9\u0BEB\u0BEC\u01D7\xEC\u0BEC\u0BED","\u01CF\xE8\u0BED\u0BEE\u01B3\xDA\u0BEE\u0BEF","\u01B9\xDD\u0BEF\u0BF0\u01B1\xD9\u0BF0\u0BF1","\u01BF\xE0\u0BF1\u0BF2\u01AF\xD8\u0BF2\u0150","\u0BF3\u0BF4\u01AF\xD8\u0BF4\u0BF5","\u01C5\xE3\u0BF5\u0BF6\u01AD\xD7\u0BF6\u0BF7","\u01D3\xEA\u0BF7\u0BF8\u01A9\xD5\u0BF8\u0BF9","\u01BF\xE0\u0BF9\u0BFA\u01D1\xE9\u0BFA\u0BFB","\u01B1\xD9\u0BFB\u0BFC\u01CD\xE7\u0BFC\u0152","\u0BFD\u0BFE\u01AD\xD7\u0BFE\u0BFF","\u01C5\xE3\u0BFF\u0C00\u01C7\xE4\u0C00\u0C01","\u01D9\xED\u0C01\u0C02\u01B3\xDA\u0C02\u0C03","\u01B9\xDD\u0C03\u0C04\u01B1\xD9\u0C04\u0C05","\u01BF\xE0\u0C05\u0C06\u01AF\xD8\u0C06\u0154","\u0C07\u0C08\u01B1\xD9\u0C08\u0C09","\u01D7\xEC\u0C09\u0C0A\u01AD\xD7\u0C0A\u0C0B","\u01BF\xE0\u0C0B\u0C0C\u01D1\xE9\u0C0C\u0C0D","\u01AF\xD8\u0C0D\u0C0E\u01B1\xD9\u0C0E\u0C0F","\u01AF\xD8\u0C0F\u0156\u0C10\u0C11","\u01B9\xDD\u0C11\u0C12\u01C3\xE2\u0C12\u0C13","\u01AF\xD8\u0C13\u0C14\u01B1\xD9\u0C14\u0C15","\u01D7\xEC\u0C15\u0C16\u01B1\xD9\u0C16\u0C17","\u01AF\xD8\u0C17\u0158\u0C18\u0C19","\u01BF\xE0\u0C19\u0C1A\u01C5\xE3\u0C1A\u0C1B","\u01D5\xEB\u0C1B\u0C1C\u01B1\xD9\u0C1C\u0C1D","\u01CB\xE6\u0C1D\u0C1E\u01AD\xD7\u0C1E\u0C1F","\u01A9\xD5\u0C1F\u0C20\u01CD\xE7\u0C20\u0C21","\u01B1\xD9\u0C21\u015A\u0C22\u0C23","\u01AD\xD7\u0C23\u0C24\u01C5\xE3\u0C24\u0C25","\u01BF\xE0\u0C25\u0C26\u01D1\xE9\u0C26\u0C27","\u01C1\xE1\u0C27\u0C28\u01C3\xE2\u0C28\u0C29","\u01CD\xE7\u0C29\u015C\u0C2A\u0C2B","\u01C7\xE4\u0C2B\u0C2C\u01CB\xE6\u0C2C\u0C2D","\u01C5\xE3\u0C2D\u0C2E\u01B3\xDA\u0C2E\u0C2F","\u01B9\xDD\u0C2F\u0C30\u01BF\xE0\u0C30\u0C31","\u01B1\xD9\u0C31\u0C32\u01CD\xE7\u0C32\u015E","\u0C33\u0C34\u01AD\xD7\u0C34\u0C35","\u01C5\xE3\u0C35\u0C36\u01C3\xE2\u0C36\u0C37","\u01B3\xDA\u0C37\u0C38\u01B9\xDD\u0C38\u0C39","\u01B5\xDB\u0C39\u0160\u0C3A\u0C3B","\u01A9\xD5\u0C3B\u0C3C\u01D1\xE9\u0C3C\u0C3D","\u01CF\xE8\u0C3D\u0C3E\u01C5\xE3\u0C3E\u0C3F","\u01AD\xD7\u0C3F\u0C40\u01C5\xE3\u0C40\u0C41","\u01C1\xE1\u0C41\u0C42\u01C1\xE1\u0C42\u0C43","\u01B9\xDD\u0C43\u0C44\u01CF\xE8\u0C44\u0C45","\u01CF\xE8\u0C45\u0C46\u01B9\xDD\u0C46\u0C47","\u01C1\xE1\u0C47\u0C48\u01B1\xD9\u0C48\u0162","\u0C49\u0C4A\u01AF\xD8\u0C4A\u0C4B","\u01B1\xD9\u0C4B\u0C4C\u01B3\xDA\u0C4C\u0C4D","\u01A9\xD5\u0C4D\u0C4E\u01D1\xE9\u0C4E\u0C4F","\u01BF\xE0\u0C4F\u0C50\u01CF\xE8\u0C50\u0C51","\u01C9\xE5\u0C51\u0C52\u01D1\xE9\u0C52\u0C53","\u01B1\xD9\u0C53\u0C54\u01CB\xE6\u0C54\u0C55","\u01D9\xED\u0C55\u0C56\u01B3\xDA\u0C56\u0C57","\u01B9\xDD\u0C57\u0C58\u01B1\xD9\u0C58\u0C59","\u01BF\xE0\u0C59\u0C5A\u01AF\xD8\u0C5A\u0164","\u0C5B\u0C5C\u01AF\xD8\u0C5C\u0C5D","\u01B9\xDD\u0C5D\u0C5E\u01CB\xE6\u0C5E\u0C5F","\u01B1\xD9\u0C5F\u0C60\u01AD\xD7\u0C60\u0C61","\u01CF\xE8\u0C61\u0C62\u01C5\xE3\u0C62\u0C63","\u01CB\xE6\u0C63\u0C64\u01D9\xED\u0C64\u0C65","\u01B3\xDA\u0C65\u0C66\u01A9\xD5\u0C66\u0C67","\u01AD\xD7\u0C67\u0C68\u01CF\xE8\u0C68\u0C69","\u01C5\xE3\u0C69\u0C6A\u01CB\xE6\u0C6A\u0C6B","\u01D9\xED\u0C6B\u0166\u0C6C\u0C6D","\u01B3\xDA\u0C6D\u0C6E\u01B9\xDD\u0C6E\u0C6F","\u01BF\xE0\u0C6F\u0C70\u01CF\xE8\u0C70\u0C71","\u01B1\xD9\u0C71\u0C72\u01CB\xE6\u0C72\u0C73","\u01AD\xD7\u0C73\u0C74\u01A9\xD5\u0C74\u0C75","\u01AD\xD7\u0C75\u0C76\u01B7\xDC\u0C76\u0C77","\u01B1\xD9\u0C77\u0C78\u01BF\xE0\u0C78\u0C79","\u01C5\xE3\u0C79\u0C7A\u01D5\xEB\u0C7A\u0C7B","\u01D5\xEB\u0C7B\u0C7C\u01A9\xD5\u0C7C\u0C7D","\u01CF\xE8\u0C7D\u0C7E\u01B1\xD9\u0C7E\u0C7F","\u01CB\xE6\u0C7F\u0C80\u01C1\xE1\u0C80\u0C81","\u01A9\xD5\u0C81\u0C82\u01CB\xE6\u0C82\u0C83","\u01BD\xDF\u0C83\u0168\u0C84\u0C85","\u01B3\xDA\u0C85\u0C86\u01B9\xDD\u0C86\u0C87","\u01BF\xE0\u0C87\u0C88\u01CF\xE8\u0C88\u0C89","\u01B1\xD9\u0C89\u0C8A\u01CB\xE6\u0C8A\u0C8B","\u01AD\xD7\u0C8B\u0C8C\u01A9\xD5\u0C8C\u0C8D","\u01AD\xD7\u0C8D\u0C8E\u01B7\xDC\u0C8E\u0C8F","\u01B1\xD9\u0C8F\u0C90\u01B7\xDC\u0C90\u0C91","\u01B9\xDD\u0C91\u0C92\u01B5\xDB\u0C92\u0C93","\u01B7\xDC\u0C93\u0C94\u01D5\xEB\u0C94\u0C95","\u01A9\xD5\u0C95\u0C96\u01CF\xE8\u0C96\u0C97","\u01B1\xD9\u0C97\u0C98\u01CB\xE6\u0C98\u0C99","\u01C1\xE1\u0C99\u0C9A\u01A9\xD5\u0C9A\u0C9B","\u01CB\xE6\u0C9B\u0C9C\u01BD\xDF\u0C9C\u016A","\u0C9D\u0C9E\u01AF\xD8\u0C9E\u0C9F","\u01B9\xDD\u0C9F\u0CA0\u01CB\xE6\u0CA0\u0CA1","\u01B1\xD9\u0CA1\u0CA2\u01AD\xD7\u0CA2\u0CA3","\u01CF\xE8\u0CA3\u0CA4\u01C5\xE3\u0CA4\u0CA5","\u01CB\xE6\u0CA5\u0CA6\u01D9\xED\u0CA6\u0CA7","\u01B3\xDA\u0CA7\u0CA8\u01A9\xD5\u0CA8\u0CA9","\u01AD\xD7\u0CA9\u0CAA\u01CF\xE8\u0CAA\u0CAB","\u01C5\xE3\u0CAB\u0CAC\u01CB\xE6\u0CAC\u0CAD","\u01D9\xED\u0CAD\u0CAE\u01AD\xD7\u0CAE\u0CAF","\u01BF\xE0\u0CAF\u0CB0\u01A9\xD5\u0CB0\u0CB1","\u01CD\xE7\u0CB1\u0CB2\u01CD\xE7\u0CB2\u016C","\u0CB3\u0CB4\u01C1\xE1\u0CB4\u0CB5","\u01B1\xD9\u0CB5\u0CB6\u01CB\xE6\u0CB6\u0CB7","\u01B5\xDB\u0CB7\u0CB8\u01B1\xD9\u0CB8\u0CB9","\u01C1\xE1\u0CB9\u0CBA\u01A9\xD5\u0CBA\u0CBB","\u01D7\xEC\u0CBB\u0CBC\u01CF\xE8\u0CBC\u0CBD","\u01B7\xDC\u0CBD\u0CBE\u01CB\xE6\u0CBE\u0CBF","\u01B1\xD9\u0CBF\u0CC0\u01A9\xD5\u0CC0\u0CC1","\u01AF\xD8\u0CC1\u0CC2\u01AD\xD7\u0CC2\u0CC3","\u01C5\xE3\u0CC3\u0CC4\u01D1\xE9\u0CC4\u0CC5","\u01C3\xE2\u0CC5\u0CC6\u01CF\xE8\u0CC6\u016E","\u0CC7\u0CC8\u01C1\xE1\u0CC8\u0CC9","\u01B1\xD9\u0CC9\u0CCA\u01CB\xE6\u0CCA\u0CCB","\u01B5\xDB\u0CCB\u0CCC\u01B1\xD9\u0CCC\u0CCD","\u01C1\xE1\u0CCD\u0CCE\u01A9\xD5\u0CCE\u0CCF","\u01D7\xEC\u0CCF\u0CD0\u01C1\xE1\u0CD0\u0CD1","\u01B1\xD9\u0CD1\u0CD2\u01CB\xE6\u0CD2\u0CD3","\u01B5\xDB\u0CD3\u0CD4\u01B1\xD9\u0CD4\u0CD5","\u01AD\xD7\u0CD5\u0CD6\u01C5\xE3\u0CD6\u0CD7","\u01D1\xE9\u0CD7\u0CD8\u01C3\xE2\u0CD8\u0CD9","\u01CF\xE8\u0CD9\u0170\u0CDA\u0CDB","\u01CB\xE6\u0CDB\u0CDC\u01A9\xD5\u0CDC\u0CDD","\u01C1\xE1\u0CDD\u0CDE\u01AB\xD6\u0CDE\u0CDF","\u01D1\xE9\u0CDF\u0CE0\u01B3\xDA\u0CE0\u0CE1","\u01B3\xDA\u0CE1\u0CE2\u01B1\xD9\u0CE2\u0CE3","\u01CB\xE6\u0CE3\u0CE4\u01CD\xE7\u0CE4\u0CE5","\u01B9\xDD\u0CE5\u0CE6\u01DB\xEE\u0CE6\u0CE7","\u01B1\xD9\u0CE7\u0172\u0CE8\u0CE9","\u01CB\xE6\u0CE9\u0CEA\u01B1\xD9\u0CEA\u0CEB","\u01A9\xD5\u0CEB\u0CEC\u01BF\xE0\u0CEC\u0CED","\u01CF\xE8\u0CED\u0CEE\u01B9\xDD\u0CEE\u0CEF","\u01C1\xE1\u0CEF\u0CF0\u01B1\xD9\u0CF0\u0174","\u0CF1\u0CF2\u01CB\xE6\u0CF2\u0CF3","\u01B1\xD9\u0CF3\u0CF4\u01AD\xD7\u0CF4\u0CF5","\u01C5\xE3\u0CF5\u0CF6\u01D3\xEA\u0CF6\u0CF7","\u01B1\xD9\u0CF7\u0CF8\u01CB\xE6\u0CF8\u0CF9","\u01D9\xED\u0CF9\u0176\u0CFA\u0CFB","\u01CB\xE6\u0CFB\u0CFC\u01B1\xD9\u0CFC\u0CFD","\u01B9\xDD\u0CFD\u0CFE\u01C3\xE2\u0CFE\u0CFF","\u01AF\xD8\u0CFF\u0D00\u01B1\xD9\u0D00\u0D01","\u01D7\xEC\u0D01\u0178\u0D02\u0D03","\u01BF\xE0\u0D03\u0D04\u01B1\xD9\u0D04\u0D05","\u01C3\xE2\u0D05\u0D06\u01B9\xDD\u0D06\u0D07","\u01B1\xD9\u0D07\u0D08\u01C3\xE2\u0D08\u0D09","\u01CF\xE8\u0D09\u017A\u0D0A\u0D0B","-\u0D0B\u0D0C\u01CD\xE7\u0D0C\u0D0D","\u01CF\xE8\u0D0D\u0D0E\u01A9\xD5\u0D0E\u0D0F","\u01C3\xE2\u0D0F\u0D10\u01AF\xD8\u0D10\u0D11","\u01A9\xD5\u0D11\u0D12\u01CB\xE6\u0D12\u0D13","\u01AF\xD8\u0D13\u0D14-\u0D14\u017C","\u0D15\u0D16-\u0D16\u0D17","\u01B1\xD9\u0D17\u0D18\u01C3\xE2\u0D18\u0D19","\u01AD\xD7\u0D19\u0D1A\u01CB\xE6\u0D1A\u0D1B","\u01D9\xED\u0D1B\u0D1C\u01C7\xE4\u0D1C\u0D1D","\u01CF\xE8\u0D1D\u0D1E\u01B1\xD9\u0D1E\u0D1F","\u01AF\xD8\u0D1F\u0D20-\u0D20\u017E","\u0D21\u0D22\u01AB\xD6\u0D22\u0D23","\u01B9\xDD\u0D23\u0D24\u01B5\xDB\u0D24\u0D25","\u01B9\xDD\u0D25\u0D26\u01C3\xE2\u0D26\u0D27","\u01CF\xE8\u0D27\u0180\u0D28\u0D29","\u01AB\xD6\u0D29\u0D2A\u01BF\xE0\u0D2A\u0D2B","\u01C5\xE3\u0D2B\u0D2C\u01AB\xD6\u0D2C\u0182","\u0D2D\u0D2E\u01AB\xD6\u0D2E\u0D2F","\u01C5\xE3\u0D2F\u0D30\u01C5\xE3\u0D30\u0D31","\u01BF\xE0\u0D31\u0D32\u01B1\xD9\u0D32\u0D33","\u01A9\xD5\u0D33\u0D34\u01C3\xE2\u0D34\u0184","\u0D35\u0D36\u01AD\xD7\u0D36\u0D37","\u01C5\xE3\u0D37\u0D38\u01D1\xE9\u0D38\u0D39","\u01C3\xE2\u0D39\u0D3A\u01CF\xE8\u0D3A\u0D3B","\u01B1\xD9\u0D3B\u0D3C\u01CB\xE6\u0D3C\u0186","\u0D3D\u0D3E\u01AF\xD8\u0D3E\u0D3F","\u01A9\xD5\u0D3F\u0D40\u01CF\xE8\u0D40\u0D41","\u01B1\xD9\u0D41\u0188\u0D42\u0D43","\u01AF\xD8\u0D43\u0D44\u01B1\xD9\u0D44\u0D45","\u01AD\xD7\u0D45\u0D46\u01B9\xDD\u0D46\u0D47","\u01C1\xE1\u0D47\u0D48\u01A9\xD5\u0D48\u0D49","\u01BF\xE0\u0D49\u018A\u0D4A\u0D4B","\u01AF\xD8\u0D4B\u0D4C\u01C5\xE3\u0D4C\u0D4D","\u01D1\xE9\u0D4D\u0D4E\u01AB\xD6\u0D4E\u0D4F","\u01BF\xE0\u0D4F\u0D50\u01B1\xD9\u0D50\u018C","\u0D51\u0D52\u01B3\xDA\u0D52\u0D53","\u01BF\xE0\u0D53\u0D54\u01C5\xE3\u0D54\u0D55","\u01A9\xD5\u0D55\u0D56\u01CF\xE8\u0D56\u018E","\u0D57\u0D58\u01B3\xDA\u0D58\u0D59","\u01CB\xE6\u0D59\u0D5A\u01C5\xE3\u0D5A\u0D5B","\u01DB\xEE\u0D5B\u0D5C\u01B1\xD9\u0D5C\u0D5D","\u01C3\xE2\u0D5D\u0190\u0D5E\u0D5F","\u01B9\xDD\u0D5F\u0D60\u01C3\xE2\u0D60\u0D61","\u01B1\xD9\u0D61\u0D62\u01CF\xE8\u0D62\u0192","\u0D63\u0D64\u01B9\xDD\u0D64\u0D65","\u01C3\xE2\u0D65\u0D66\u01CF\xE8\u0D66\u0194","\u0D67\u0D68\u01BF\xE0\u0D68\u0D69","\u01B9\xDD\u0D69\u0D6A\u01CD\xE7\u0D6A\u0D6B","\u01CF\xE8\u0D6B\u0196\u0D6C\u0D6D","\u01C1\xE1\u0D6D\u0D6E\u01A9\xD5\u0D6E\u0D6F","\u01C7\xE4\u0D6F\u0198\u0D70\u0D71","\u01CD\xE7\u0D71\u0D72\u01C1\xE1\u0D72\u0D73","\u01A9\xD5\u0D73\u0D74\u01BF\xE0\u0D74\u0D75","\u01BF\xE0\u0D75\u0D76\u01B9\xDD\u0D76\u0D77","\u01C3\xE2\u0D77\u0D78\u01CF\xE8\u0D78\u019A","\u0D79\u0D7A\u01CF\xE8\u0D7A\u0D7B","\u01B1\xD9\u0D7B\u0D7C\u01D7\xEC\u0D7C\u0D7D","\u01CF\xE8\u0D7D\u019C\u0D7E\u0D7F","\u01CF\xE8\u0D7F\u0D80\u01B9\xDD\u0D80\u0D81","\u01C1\xE1\u0D81\u0D82\u01B1\xD9\u0D82\u0D83","\u01D1\xE9\u0D83\u0D84\u01D1\xE9\u0D84\u0D85","\u01B9\xDD\u0D85\u0D86\u01AF\xD8\u0D86\u019E","\u0D87\u0D88\u01CF\xE8\u0D88\u0D89","\u01B9\xDD\u0D89\u0D8A\u01C1\xE1\u0D8A\u0D8B","\u01B1\xD9\u0D8B\u01A0\u0D8C\u0D8D","\u01CF\xE8\u0D8D\u0D8E\u01B9\xDD\u0D8E\u0D8F","\u01C3\xE2\u0D8F\u0D90\u01D9\xED\u0D90\u0D91","\u01B9\xDD\u0D91\u0D92\u01C3\xE2\u0D92\u0D93","\u01CF\xE8\u0D93\u01A2\u0D94\u0D95","\u01CF\xE8\u0D95\u0D96\u01D1\xE9\u0D96\u0D97","\u01C7\xE4\u0D97\u0D98\u01BF\xE0\u0D98\u0D99","\u01B1\xD9\u0D99\u01A4\u0D9A\u0D9B","\u01D3\xEA\u0D9B\u0D9C\u01A9\xD5\u0D9C\u0D9D","\u01CB\xE6\u0D9D\u0D9E\u01AD\xD7\u0D9E\u0D9F","\u01B7\xDC\u0D9F\u0DA0\u01A9\xD5\u0DA0\u0DA1","\u01CB\xE6\u0DA1\u01A6\u0DA2\u0DA3","\u01D3\xEA\u0DA3\u0DA4\u01A9\xD5\u0DA4\u0DA5","\u01CB\xE6\u0DA5\u0DA6\u01B9\xDD\u0DA6\u0DA7","\u01C3\xE2\u0DA7\u0DA8\u01CF\xE8\u0DA8\u01A8","\u0DA9\u0DAA \u0DAA\u01AA","\u0DAB\u0DAC \u0DAC\u01AC","\u0DAD\u0DAE \u0DAE\u01AE","\u0DAF\u0DB0 \x07\u0DB0\u01B0","\u0DB1\u0DB2 \b\u0DB2\u01B2","\u0DB3\u0DB4 \u0DB4\u01B4",`\u0DB5\u0DB6 +\u0DB6\u01B6`,"\u0DB7\u0DB8 \v\u0DB8\u01B8","\u0DB9\u0DBA \f\u0DBA\u01BA\u0DBB","\u0DBC \r\u0DBC\u01BC\u0DBD\u0DBE"," \u0DBE\u01BE\u0DBF\u0DC0"," \u0DC0\u01C0\u0DC1\u0DC2"," \u0DC2\u01C2\u0DC3\u0DC4"," \u0DC4\u01C4\u0DC5\u0DC6"," \u0DC6\u01C6\u0DC7\u0DC8"," \u0DC8\u01C8\u0DC9\u0DCA"," \u0DCA\u01CA\u0DCB\u0DCC"," \u0DCC\u01CC\u0DCD\u0DCE"," \u0DCE\u01CE\u0DCF\u0DD0"," \u0DD0\u01D0\u0DD1\u0DD2"," \u0DD2\u01D2\u0DD3\u0DD4"," \u0DD4\u01D4\u0DD5\u0DD6"," \u0DD6\u01D6\u0DD7\u0DD8"," \x1B\u0DD8\u01D8\u0DD9\u0DDA"," \u0DDA\u01DA\u0DDB\u0DDC"," \u0DDC\u01DC\u0DDD\u0DDE","\x07&\u0DDE\u0DDF\x07&\u0DDF\u01DE","\u0DE0\u0DE1\x07&\u0DE1\u0DE2\x07",`&\u0DE2\u0DE8\u0DE3\u0DE7 +`,`\u0DE4\u0DE5\x07&\u0DE5\u0DE7 +`,"\u0DE6\u0DE3\u0DE6\u0DE4","\u0DE7\u0DEA\u0DE8\u0DE6","\u0DE8\u0DE9\u0DE9\u0DEB","\u0DEA\u0DE8\u0DEB\u0DEC\x07&","\u0DEC\u0DED\x07&\u0DED\u01E0","\u0DEE\u0DEF \u0DEF\u0DF0 ","\u0DF0\u0DF1 \u0DF1\u0DF2 \u0DF2","\u01E2\u0DF3\u0DF7 \u0DF4\u0DF6"," !\u0DF5\u0DF4\u0DF6\u0DF9","\u0DF7\u0DF5\u0DF7\u0DF8","\u0DF8\u0E02\u0DF9\u0DF7",`\u0DFA\u0DFC\x07$\u0DFB\u0DFD +"`,"\u0DFC\u0DFB\u0DFD\u0DFE","\u0DFE\u0DFC\u0DFE\u0DFF","\u0DFF\u0E00\u0E00\u0E02\x07$","\u0E01\u0DF3\u0E01\u0DFA","\u0E02\u01E4\u0E03\u0E0B\x07)","\u0E04\u0E05\x07^\u0E05\u0E0A\v","\u0E06\u0E07\x07)\u0E07\u0E0A\x07)",`\u0E08\u0E0A +#\u0E09\u0E04\u0E09`,"\u0E06\u0E09\u0E08\u0E0A","\u0E0D\u0E0B\u0E09\u0E0B","\u0E0C\u0E0C\u0E0E\u0E0D","\u0E0B\u0E0E\u0E0F\x07)\u0E0F","\u01E6\u0E10\u0E11\u01DF\xF0\u0E11","\u01E8\u0E12\u0E13\u01E5\xF3\u0E13","\u01EA\u0E14\u0E16\u01F9\xFD\u0E15","\u0E14\u0E16\u0E17\u0E17","\u0E15\u0E17\u0E18\u0E18","\u01EC\u0E19\u0E1B)\u0E1A","\u0E19\u0E1A\u0E1B\u0E1B","\u0E1D\u0E1C\u0E1E $\u0E1D\u0E1C","\u0E1E\u0E1F\u0E1F\u0E1D","\u0E1F\u0E20\u0E20\u0E27","\u0E21\u0E23\u0E22\u0E24"," $\u0E23\u0E22\u0E24\u0E25","\u0E25\u0E23\u0E25\u0E26","\u0E26\u0E28\u0E27\u0E21","\u0E27\u0E28\u0E28\u01EE","\u0E29\u0E2A\x07Z\u0E2A\u0E2E\x07",")\u0E2B\u0E2C\u01F7\xFC\u0E2C\u0E2D","\u01F7\xFC\u0E2D\u0E2F\u0E2E\u0E2B","\u0E2F\u0E30\u0E30\u0E2E","\u0E30\u0E31\u0E31\u0E32","\u0E32\u0E33\x07)\u0E33\u0E3D","\u0E34\u0E35\x072\u0E35\u0E36\x07","Z\u0E36\u0E38\u0E37\u0E39","\u01F7\xFC\u0E38\u0E37\u0E39\u0E3A","\u0E3A\u0E38\u0E3A\u0E3B","\u0E3B\u0E3D\u0E3C\u0E29","\u0E3C\u0E34\u0E3D\u01F0","\u0E3E\u0E40\u01F9\xFD\u0E3F\u0E3E","\u0E40\u0E41\u0E41\u0E3F","\u0E41\u0E42\u0E42\u0E44","\u0E43\u0E3F\u0E43\u0E44","\u0E44\u0E45\u0E45\u0E47\x07","0\u0E46\u0E48\u01F9\xFD\u0E47\u0E46","\u0E48\u0E49\u0E49\u0E47","\u0E49\u0E4A\u0E4A\u0E6A","\u0E4B\u0E4D\u01F9\xFD\u0E4C\u0E4B","\u0E4D\u0E4E\u0E4E\u0E4C","\u0E4E\u0E4F\u0E4F\u0E50","\u0E50\u0E51\x070\u0E51\u0E52","\u01FB\xFE\u0E52\u0E6A\u0E53\u0E55","\u01F9\xFD\u0E54\u0E53\u0E55\u0E56","\u0E56\u0E54\u0E56\u0E57","\u0E57\u0E59\u0E58\u0E54","\u0E58\u0E59\u0E59\u0E5A","\u0E5A\u0E5C\x070\u0E5B\u0E5D","\u01F9\xFD\u0E5C\u0E5B\u0E5D\u0E5E","\u0E5E\u0E5C\u0E5E\u0E5F","\u0E5F\u0E60\u0E60\u0E61","\u01FB\xFE\u0E61\u0E6A\u0E62\u0E64","\u01F9\xFD\u0E63\u0E62\u0E64\u0E65","\u0E65\u0E63\u0E65\u0E66","\u0E66\u0E67\u0E67\u0E68","\u01FB\xFE\u0E68\u0E6A\u0E69\u0E43","\u0E69\u0E4C\u0E69\u0E58","\u0E69\u0E63\u0E6A\u01F2","\u0E6B\u0E6C\u01E3\xF2\u0E6C\u01F4","\u0E6D\u0E6E\u01E1\xF1\u0E6E\u0E6F","\u01E1\xF1\u0E6F\u0E70\x07/\u0E70\u0E71","\u01E1\xF1\u0E71\u0E72\x07/\u0E72\u0E73","\u01E1\xF1\u0E73\u0E74\x07/\u0E74\u0E75","\u01E1\xF1\u0E75\u0E76\x07/\u0E76\u0E77","\u01E1\xF1\u0E77\u0E78\u01E1\xF1\u0E78\u0E79","\u01E1\xF1\u0E79\u01F6\u0E7A\u0E7B ","%\u0E7B\u01F8\u0E7C\u0E7D $","\u0E7D\u01FA\u0E7E\u0E80\x07G","\u0E7F\u0E81\x07/\u0E80\u0E7F","\u0E80\u0E81\u0E81\u0E83","\u0E82\u0E84\u01F9\xFD\u0E83\u0E82","\u0E84\u0E85\u0E85\u0E83","\u0E85\u0E86\u0E86\u01FC","\u0E87\u0E88\x07?\u0E88\u01FE","\u0E89\u0E8A\x07>\u0E8A\u0200","\u0E8B\u0E8C\x07@\u0E8C\u0202","\u0E8D\u0E8E\x07@\u0E8E\u0E8F\x07?","\u0E8F\u0204\u0E90\u0E91\x07>","\u0E91\u0E92\x07?\u0E92\u0206","\u0E93\u0E94\u01FD\xFF\u0E94\u0208","\u0E95\u0E96\u01FF\u0100\u0E96\u020A","\u0E97\u0E98\u0201\u0101\u0E98\u020C","\u0E99\u0E9A\u0205\u0103\u0E9A\u020E","\u0E9B\u0E9C\u0203\u0102\u0E9C\u0210","\u0E9D\u0E9E\u01D1\xE9\u0E9E\u0E9F\u01CD\xE7","\u0E9F\u0EA0\u01B1\xD9\u0EA0\u0EA1\u01CB\xE6","\u0EA1\u0EA2\u01CD\xE7\u0EA2\u0EA9","\u0EA3\u0EA4\x07W\u0EA4\u0EA5\x07U\u0EA5","\u0EA6\x07G\u0EA6\u0EA7\x07T\u0EA7\u0EA9","\x07U\u0EA8\u0E9D\u0EA8\u0EA3","\u0EA9\u0212\u0EAA\u0EAB","\u01D3\xEA\u0EAB\u0EAC\u01B1\xD9\u0EAC\u0EAD","\u01AD\xD7\u0EAD\u0EAE\u01CF\xE8\u0EAE\u0EAF","\u01C5\xE3\u0EAF\u0EB0\u01CB\xE6\u0EB0\u0EB8","\u0EB1\u0EB2\x07X\u0EB2\u0EB3","\x07G\u0EB3\u0EB4\x07E\u0EB4\u0EB5\x07","V\u0EB5\u0EB6\x07Q\u0EB6\u0EB8\x07T","\u0EB7\u0EAA\u0EB7\u0EB1","\u0EB8\u0214\xA5\u022A\u0235\u0242","\u0250\u0255\u0259\u025D\u0263\u0267\u0269\u0287\u029C\u02A5\u02B2\u02BF","\u02C8\u02D1\u02DE\u02E5\u02EE\u0303\u0310\u031D\u0324\u0333\u034A\u0365","\u0376\u038F\u03A2\u03B1\u03C0\u03CF\u03DE\u03E9\u03FC\u040F\u041A\u0439","\u0452\u0463\u0474\u0483\u0498\u04AD\u04C2\u04CD\u04D8\u04EB\u0500\u050D","\u0514\u051B\u0528\u053B\u054E\u055B\u056A\u0575\u057C\u0587\u0590\u059B","\u05AE\u05C3\u05D6\u05E3\u05F0\u0605\u0620\u062F\u063C\u0657\u0666\u066F","\u0688\u06A1\u06AA\u06B5\u06BC\u06C3\u06CC\u06DD\u06E4\u06F1\u0706\u0719","\u0722\u0739\u0752\u0763\u0772\u0781\u0792\u07AB\u07BC\u07CB\u07D6\u07E3","\u07F6\u0801\u080F\u081E\u082D\u0836\u0843\u0852\u0863\u0870\u0885\u0892","\u089F\u08B4\u08BB\u08C8\u08D9\u08EB\u08FE\u0907\u0910\u091B\u092E\u093D","\u0946\u0951\u095E\u0969\u0978\u0983\u0990\u099B\u09B0\u09C0\u0A09\u0DE6","\u0DE8\u0DF7\u0DFE\u0E01\u0E09\u0E0B\u0E17\u0E1A\u0E1F\u0E25\u0E27\u0E30","\u0E3A\u0E3C\u0E41\u0E43\u0E49\u0E4E\u0E56\u0E58\u0E5E\u0E65\u0E69\u0E80","\u0E85\u0EA8\u0EB7"].join(""),TA=new bc.atn.ATNDeserializer().deserialize(Ns0),Us0=TA.decisionToState.map((u,e)=>new bc.dfa.DFA(u,e)),ss=class ss extends bc.Lexer{constructor(e){super(e),this._interp=new bc.atn.LexerATNSimulator(this,TA,Us0,new bc.PredictionContextCache)}get atn(){return TA}};c(ss,"CqlLexer"),Zu(ss,"grammarFileName","CqlLexer.g4"),Zu(ss,"channelNames",["DEFAULT_TOKEN_CHANNEL","HIDDEN"]),Zu(ss,"modeNames",["DEFAULT_MODE"]),Zu(ss,"literalNames",[null,"'('","')'","'{'","'}'","'['","']'","','","';'","':'",null,null,null,null,"'.'","'*'","'/'","'%'","'+'","'--'","'-'",`'"'`,"'''"]),Zu(ss,"symbolicNames",[null,"LR_BRACKET","RR_BRACKET","LC_BRACKET","RC_BRACKET","LS_BRACKET","RS_BRACKET","COMMA","SEMI","COLON","SPACE","SPEC_MYSQL_COMMENT","COMMENT_INPUT","LINE_COMMENT","DOT","STAR","DIVIDE","MODULE","PLUS","MINUSMINUS","MINUS","DQUOTE","SQUOTE","K_ADD","K_AGGREGATE","K_ALL","K_ALLOW","K_ALTER","K_AND","K_ANY","K_APPLY","K_AS","K_ASC","K_AUTHORIZE","K_BATCH","K_BEGIN","K_BY","K_CALLED","K_CLUSTERING","K_COLUMNFAMILY","K_COMPACT","K_CONSISTENCY","K_CONTAINS","K_CREATE","K_CUSTOM","K_SEARCH","K_DELETE","K_DESC","K_DESCRIBE","K_DISTINCT","K_DROP","K_DURABLE_WRITES","K_EACH_QUORUM","K_ENTRIES","K_EXECUTE","K_EXISTS","K_FALSE","K_FILTERING","K_FINALFUNC","K_FROM","K_FULL","K_FUNCTION","K_FUNCTIONS","K_GRANT","K_IF","K_IN","K_INDEX","K_INFINITY","K_INITCOND","K_INPUT","K_INSERT","K_INTO","K_IS","K_JSON","K_KEY","K_KEYS","K_KEYSPACE","K_KEYSPACES","K_LANGUAGE","K_LEVEL","K_LIMIT","K_LOCAL_ONE","K_LOCAL_QUORUM","K_LOGGED","K_LOGIN","K_MATERIALIZED","K_MODIFY","K_NAN","K_NORECURSIVE","K_NOSUPERUSER","K_NOT","K_NULL","K_OF","K_ON","K_ONE","K_OPTIONS","K_OR","K_ORDER","K_PARTITION","K_PASSWORD","K_PER","K_PERMISSION","K_PERMISSIONS","K_PRIMARY","K_QUORUM","K_RENAME","K_REPLACE","K_REPLICATION","K_RETURNS","K_REVOKE","K_ROLE","K_ROLES","K_INTERNAL","K_LDAP","K_SCHEME","K_SCHEMA","K_SELECT","K_SET","K_SFUNC","K_STATIC","K_STORAGE","K_STYPE","K_SUPERUSER","K_TABLE","K_THREE","K_TIMESTAMP","K_TO","K_TOKEN","K_TRIGGER","K_TRUE","K_TRUNCATE","K_TTL","K_TWO","K_TYPE","K_UNLOGGED","K_UPDATE","K_USE","K_USER","K_USING","K_UUID","K_VALUES","K_VIEW","K_WHERE","K_WITH","K_WRITETIME","K_ASCII","K_CASE_SENITIVE","K_NORMALIZE","K_SIMILARITY_FUNCTION","K_ANALYZED","K_IS_LITERAL","K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB","K_TOKENIZATION_ENABLE_STEMMING","K_TOKENIZATION_SKIP_STOP_WORDS","K_TOKENIZATION_LOCALE","K_TOKENIZATION_NORMALIZE_LOWERCASE","K_TOKENIZATION_NORMALIZE_UPPERCASE","K_NORMALIZE_LOWERCASE","K_NORMALIZE_UPPERCASE","K_MODE","K_ANALYZER_CLASS","K_STORAGE_ATTACHED_INDEX","K_SASI_INDEX","K_SOLR_INDEX","K_SPACE_SAVING_NO_JOIN","K_SPACE_SAVING_ALL","K_SPACE_SAVING_SLOW_TRIE_PRECISION","K_SPACE_SAVING_NO_TEXT_FIELD","K_DOC_VALUES","K_COPY_FIELD","K_EXCLUDED","K_INDEXED","K_LOWERCASE","K_COLUMNS","K_PROFILES","K_CONFIG","K_AUTOCOMMIT_TIME","K_DEFAULT_QUERY_FIELD","K_DIRECTORY_FACTORY","K_FILTER_CACHE_LOW_WATERMARK","K_FILTER_CACHE_HIGH_WATERMARK","K_DIRECTORY_FACTORY_CLASS","K_MERGE_MAX_THREAD_COUNT","K_MERGE_MAX_MERGE_COUNT","K_RAM_BUFFER_SIZE","K_REALTIME","K_RECOVERY","K_REINDEX","K_LENIENT","K_STANDARD","K_ENCRYPTED","K_BIGINT","K_BLOB","K_BOOLEAN","K_COUNTER","K_DATE","K_DECIMAL","K_DOUBLE","K_FLOAT","K_FROZEN","K_INET","K_INT","K_LIST","K_MAP","K_SMALLINT","K_TEXT","K_TIMEUUID","K_TIME","K_TINYINT","K_TUPLE","K_VARCHAR","K_VARINT","CODE_BLOCK","STRING_LITERAL","DECIMAL_LITERAL","FLOAT_LITERAL","HEXADECIMAL_LITERAL","REAL_LITERAL","OBJECT_NAME","UUID","OPERATOR_EQ","OPERATOR_LT","OPERATOR_GT","OPERATOR_LTE","OPERATOR_GTE","K_USERS","K_VECTOR"]),Zu(ss,"ruleNames",["LR_BRACKET","RR_BRACKET","LC_BRACKET","RC_BRACKET","LS_BRACKET","RS_BRACKET","COMMA","SEMI","COLON","SPACE","SPEC_MYSQL_COMMENT","COMMENT_INPUT","LINE_COMMENT","DOT","STAR","DIVIDE","MODULE","PLUS","MINUSMINUS","MINUS","DQUOTE","SQUOTE","K_ADD","K_AGGREGATE","K_ALL","K_ALLOW","K_ALTER","K_AND","K_ANY","K_APPLY","K_AS","K_ASC","K_AUTHORIZE","K_BATCH","K_BEGIN","K_BY","K_CALLED","K_CLUSTERING","K_COLUMNFAMILY","K_COMPACT","K_CONSISTENCY","K_CONTAINS","K_CREATE","K_CUSTOM","K_SEARCH","K_DELETE","K_DESC","K_DESCRIBE","K_DISTINCT","K_DROP","K_DURABLE_WRITES","K_EACH_QUORUM","K_ENTRIES","K_EXECUTE","K_EXISTS","K_FALSE","K_FILTERING","K_FINALFUNC","K_FROM","K_FULL","K_FUNCTION","K_FUNCTIONS","K_GRANT","K_IF","K_IN","K_INDEX","K_INFINITY","K_INITCOND","K_INPUT","K_INSERT","K_INTO","K_IS","K_JSON","K_KEY","K_KEYS","K_KEYSPACE","K_KEYSPACES","K_LANGUAGE","K_LEVEL","K_LIMIT","K_LOCAL_ONE","K_LOCAL_QUORUM","K_LOGGED","K_LOGIN","K_MATERIALIZED","K_MODIFY","K_NAN","K_NORECURSIVE","K_NOSUPERUSER","K_NOT","K_NULL","K_OF","K_ON","K_ONE","K_OPTIONS","K_OR","K_ORDER","K_PARTITION","K_PASSWORD","K_PER","K_PERMISSION","K_PERMISSIONS","K_PRIMARY","K_QUORUM","K_RENAME","K_REPLACE","K_REPLICATION","K_RETURNS","K_REVOKE","K_ROLE","K_ROLES","K_INTERNAL","K_LDAP","K_SCHEME","K_SCHEMA","K_SELECT","K_SET","K_SFUNC","K_STATIC","K_STORAGE","K_STYPE","K_SUPERUSER","K_TABLE","K_THREE","K_TIMESTAMP","K_TO","K_TOKEN","K_TRIGGER","K_TRUE","K_TRUNCATE","K_TTL","K_TWO","K_TYPE","K_UNLOGGED","K_UPDATE","K_USE","K_USER","K_USING","K_UUID","K_VALUES","K_VIEW","K_WHERE","K_WITH","K_WRITETIME","K_ASCII","K_CASE_SENITIVE","K_NORMALIZE","K_SIMILARITY_FUNCTION","K_ANALYZED","K_IS_LITERAL","K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB","K_TOKENIZATION_ENABLE_STEMMING","K_TOKENIZATION_SKIP_STOP_WORDS","K_TOKENIZATION_LOCALE","K_TOKENIZATION_NORMALIZE_LOWERCASE","K_TOKENIZATION_NORMALIZE_UPPERCASE","K_NORMALIZE_LOWERCASE","K_NORMALIZE_UPPERCASE","K_MODE","K_ANALYZER_CLASS","K_STORAGE_ATTACHED_INDEX","K_SASI_INDEX","K_SOLR_INDEX","K_SPACE_SAVING_NO_JOIN","K_SPACE_SAVING_ALL","K_SPACE_SAVING_SLOW_TRIE_PRECISION","K_SPACE_SAVING_NO_TEXT_FIELD","K_DOC_VALUES","K_COPY_FIELD","K_EXCLUDED","K_INDEXED","K_LOWERCASE","K_COLUMNS","K_PROFILES","K_CONFIG","K_AUTOCOMMIT_TIME","K_DEFAULT_QUERY_FIELD","K_DIRECTORY_FACTORY","K_FILTER_CACHE_LOW_WATERMARK","K_FILTER_CACHE_HIGH_WATERMARK","K_DIRECTORY_FACTORY_CLASS","K_MERGE_MAX_THREAD_COUNT","K_MERGE_MAX_MERGE_COUNT","K_RAM_BUFFER_SIZE","K_REALTIME","K_RECOVERY","K_REINDEX","K_LENIENT","K_STANDARD","K_ENCRYPTED","K_BIGINT","K_BLOB","K_BOOLEAN","K_COUNTER","K_DATE","K_DECIMAL","K_DOUBLE","K_FLOAT","K_FROZEN","K_INET","K_INT","K_LIST","K_MAP","K_SMALLINT","K_TEXT","K_TIMEUUID","K_TIME","K_TINYINT","K_TUPLE","K_VARCHAR","K_VARINT","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z","CODE_BLOCK_DELIMITER","CODE_BLOCK_FRAG","HEX_4DIGIT","OBJECT_NAME_FRAG","SQUOTA_STRING","CODE_BLOCK","STRING_LITERAL","DECIMAL_LITERAL","FLOAT_LITERAL","HEXADECIMAL_LITERAL","REAL_LITERAL","OBJECT_NAME","UUID","HEX_DIGIT","DEC_DIGIT","EXPONENT_NUM_PART","OPERATOR_EQ_FRAG","OPERATOR_LT_FRAG","OPERATOR_GT_FRAG","OPERATOR_GTE_FRAG","OPERATOR_LTE_FRAG","OPERATOR_EQ","OPERATOR_LT","OPERATOR_GT","OPERATOR_LTE","OPERATOR_GTE","K_USERS","K_VECTOR"]);var K=ss;K.EOF=bc.Token.EOF;K.LR_BRACKET=1;K.RR_BRACKET=2;K.LC_BRACKET=3;K.RC_BRACKET=4;K.LS_BRACKET=5;K.RS_BRACKET=6;K.COMMA=7;K.SEMI=8;K.COLON=9;K.SPACE=10;K.SPEC_MYSQL_COMMENT=11;K.COMMENT_INPUT=12;K.LINE_COMMENT=13;K.DOT=14;K.STAR=15;K.DIVIDE=16;K.MODULE=17;K.PLUS=18;K.MINUSMINUS=19;K.MINUS=20;K.DQUOTE=21;K.SQUOTE=22;K.K_ADD=23;K.K_AGGREGATE=24;K.K_ALL=25;K.K_ALLOW=26;K.K_ALTER=27;K.K_AND=28;K.K_ANY=29;K.K_APPLY=30;K.K_AS=31;K.K_ASC=32;K.K_AUTHORIZE=33;K.K_BATCH=34;K.K_BEGIN=35;K.K_BY=36;K.K_CALLED=37;K.K_CLUSTERING=38;K.K_COLUMNFAMILY=39;K.K_COMPACT=40;K.K_CONSISTENCY=41;K.K_CONTAINS=42;K.K_CREATE=43;K.K_CUSTOM=44;K.K_SEARCH=45;K.K_DELETE=46;K.K_DESC=47;K.K_DESCRIBE=48;K.K_DISTINCT=49;K.K_DROP=50;K.K_DURABLE_WRITES=51;K.K_EACH_QUORUM=52;K.K_ENTRIES=53;K.K_EXECUTE=54;K.K_EXISTS=55;K.K_FALSE=56;K.K_FILTERING=57;K.K_FINALFUNC=58;K.K_FROM=59;K.K_FULL=60;K.K_FUNCTION=61;K.K_FUNCTIONS=62;K.K_GRANT=63;K.K_IF=64;K.K_IN=65;K.K_INDEX=66;K.K_INFINITY=67;K.K_INITCOND=68;K.K_INPUT=69;K.K_INSERT=70;K.K_INTO=71;K.K_IS=72;K.K_JSON=73;K.K_KEY=74;K.K_KEYS=75;K.K_KEYSPACE=76;K.K_KEYSPACES=77;K.K_LANGUAGE=78;K.K_LEVEL=79;K.K_LIMIT=80;K.K_LOCAL_ONE=81;K.K_LOCAL_QUORUM=82;K.K_LOGGED=83;K.K_LOGIN=84;K.K_MATERIALIZED=85;K.K_MODIFY=86;K.K_NAN=87;K.K_NORECURSIVE=88;K.K_NOSUPERUSER=89;K.K_NOT=90;K.K_NULL=91;K.K_OF=92;K.K_ON=93;K.K_ONE=94;K.K_OPTIONS=95;K.K_OR=96;K.K_ORDER=97;K.K_PARTITION=98;K.K_PASSWORD=99;K.K_PER=100;K.K_PERMISSION=101;K.K_PERMISSIONS=102;K.K_PRIMARY=103;K.K_QUORUM=104;K.K_RENAME=105;K.K_REPLACE=106;K.K_REPLICATION=107;K.K_RETURNS=108;K.K_REVOKE=109;K.K_ROLE=110;K.K_ROLES=111;K.K_INTERNAL=112;K.K_LDAP=113;K.K_SCHEME=114;K.K_SCHEMA=115;K.K_SELECT=116;K.K_SET=117;K.K_SFUNC=118;K.K_STATIC=119;K.K_STORAGE=120;K.K_STYPE=121;K.K_SUPERUSER=122;K.K_TABLE=123;K.K_THREE=124;K.K_TIMESTAMP=125;K.K_TO=126;K.K_TOKEN=127;K.K_TRIGGER=128;K.K_TRUE=129;K.K_TRUNCATE=130;K.K_TTL=131;K.K_TWO=132;K.K_TYPE=133;K.K_UNLOGGED=134;K.K_UPDATE=135;K.K_USE=136;K.K_USER=137;K.K_USING=138;K.K_UUID=139;K.K_VALUES=140;K.K_VIEW=141;K.K_WHERE=142;K.K_WITH=143;K.K_WRITETIME=144;K.K_ASCII=145;K.K_CASE_SENITIVE=146;K.K_NORMALIZE=147;K.K_SIMILARITY_FUNCTION=148;K.K_ANALYZED=149;K.K_IS_LITERAL=150;K.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB=151;K.K_TOKENIZATION_ENABLE_STEMMING=152;K.K_TOKENIZATION_SKIP_STOP_WORDS=153;K.K_TOKENIZATION_LOCALE=154;K.K_TOKENIZATION_NORMALIZE_LOWERCASE=155;K.K_TOKENIZATION_NORMALIZE_UPPERCASE=156;K.K_NORMALIZE_LOWERCASE=157;K.K_NORMALIZE_UPPERCASE=158;K.K_MODE=159;K.K_ANALYZER_CLASS=160;K.K_STORAGE_ATTACHED_INDEX=161;K.K_SASI_INDEX=162;K.K_SOLR_INDEX=163;K.K_SPACE_SAVING_NO_JOIN=164;K.K_SPACE_SAVING_ALL=165;K.K_SPACE_SAVING_SLOW_TRIE_PRECISION=166;K.K_SPACE_SAVING_NO_TEXT_FIELD=167;K.K_DOC_VALUES=168;K.K_COPY_FIELD=169;K.K_EXCLUDED=170;K.K_INDEXED=171;K.K_LOWERCASE=172;K.K_COLUMNS=173;K.K_PROFILES=174;K.K_CONFIG=175;K.K_AUTOCOMMIT_TIME=176;K.K_DEFAULT_QUERY_FIELD=177;K.K_DIRECTORY_FACTORY=178;K.K_FILTER_CACHE_LOW_WATERMARK=179;K.K_FILTER_CACHE_HIGH_WATERMARK=180;K.K_DIRECTORY_FACTORY_CLASS=181;K.K_MERGE_MAX_THREAD_COUNT=182;K.K_MERGE_MAX_MERGE_COUNT=183;K.K_RAM_BUFFER_SIZE=184;K.K_REALTIME=185;K.K_RECOVERY=186;K.K_REINDEX=187;K.K_LENIENT=188;K.K_STANDARD=189;K.K_ENCRYPTED=190;K.K_BIGINT=191;K.K_BLOB=192;K.K_BOOLEAN=193;K.K_COUNTER=194;K.K_DATE=195;K.K_DECIMAL=196;K.K_DOUBLE=197;K.K_FLOAT=198;K.K_FROZEN=199;K.K_INET=200;K.K_INT=201;K.K_LIST=202;K.K_MAP=203;K.K_SMALLINT=204;K.K_TEXT=205;K.K_TIMEUUID=206;K.K_TIME=207;K.K_TINYINT=208;K.K_TUPLE=209;K.K_VARCHAR=210;K.K_VARINT=211;K.CODE_BLOCK=212;K.STRING_LITERAL=213;K.DECIMAL_LITERAL=214;K.FLOAT_LITERAL=215;K.HEXADECIMAL_LITERAL=216;K.REAL_LITERAL=217;K.OBJECT_NAME=218;K.UUID=219;K.OPERATOR_EQ=220;K.OPERATOR_LT=221;K.OPERATOR_GT=222;K.OPERATOR_LTE=223;K.OPERATOR_GTE=224;K.K_USERS=225;K.K_VECTOR=226;XM.CqlLexer=K});var tH=w(eH=>{"use strict";var Ps0=wa(),_A=class _A extends Ps0.tree.ParseTreeListener{enterRoot(e){}exitRoot(e){}enterCqls(e){}exitCqls(e){}enterStatementSeparator(e){}exitStatementSeparator(e){}enterEmpty(e){}exitEmpty(e){}enterCql(e){}exitCql(e){}enterRevoke(e){}exitRevoke(e){}enterListUsers(e){}exitListUsers(e){}enterListRoles(e){}exitListRoles(e){}enterListPermissions(e){}exitListPermissions(e){}enterGrant(e){}exitGrant(e){}enterPriviledge(e){}exitPriviledge(e){}enterResource(e){}exitResource(e){}enterCreateUser(e){}exitCreateUser(e){}enterCreateRole(e){}exitCreateRole(e){}enterCreateType(e){}exitCreateType(e){}enterTypeMemberColumnList(e){}exitTypeMemberColumnList(e){}enterCreateTrigger(e){}exitCreateTrigger(e){}enterCreateMaterializedView(e){}exitCreateMaterializedView(e){}enterMaterializedViewWhere(e){}exitMaterializedViewWhere(e){}enterColumnNotNullList(e){}exitColumnNotNullList(e){}enterColumnNotNull(e){}exitColumnNotNull(e){}enterMaterializedViewOptions(e){}exitMaterializedViewOptions(e){}enterCreateKeyspace(e){}exitCreateKeyspace(e){}enterCreateFunction(e){}exitCreateFunction(e){}enterCodeBlock(e){}exitCodeBlock(e){}enterParamList(e){}exitParamList(e){}enterReturnMode(e){}exitReturnMode(e){}enterCreateAggregate(e){}exitCreateAggregate(e){}enterInitCondDefinition(e){}exitInitCondDefinition(e){}enterInitCondHash(e){}exitInitCondHash(e){}enterInitCondHashItem(e){}exitInitCondHashItem(e){}enterInitCondListNested(e){}exitInitCondListNested(e){}enterInitCondList(e){}exitInitCondList(e){}enterOrReplace(e){}exitOrReplace(e){}enterAlterUser(e){}exitAlterUser(e){}enterUserPassword(e){}exitUserPassword(e){}enterUserSuperUser(e){}exitUserSuperUser(e){}enterAlterType(e){}exitAlterType(e){}enterAlterTypeOperation(e){}exitAlterTypeOperation(e){}enterAlterTypeRename(e){}exitAlterTypeRename(e){}enterAlterTypeRenameList(e){}exitAlterTypeRenameList(e){}enterAlterTypeRenameItem(e){}exitAlterTypeRenameItem(e){}enterAlterTypeAdd(e){}exitAlterTypeAdd(e){}enterAlterTypeAlterType(e){}exitAlterTypeAlterType(e){}enterAlterTable(e){}exitAlterTable(e){}enterAlterTableOperation(e){}exitAlterTableOperation(e){}enterAlterTableWith(e){}exitAlterTableWith(e){}enterAlterTableRename(e){}exitAlterTableRename(e){}enterAlterTableDropCompactStorage(e){}exitAlterTableDropCompactStorage(e){}enterAlterTableDropColumns(e){}exitAlterTableDropColumns(e){}enterAlterTableDropColumnList(e){}exitAlterTableDropColumnList(e){}enterAlterTableAdd(e){}exitAlterTableAdd(e){}enterAlterTableColumnDefinition(e){}exitAlterTableColumnDefinition(e){}enterAlterRole(e){}exitAlterRole(e){}enterRoleWith(e){}exitRoleWith(e){}enterRoleWithOptions(e){}exitRoleWithOptions(e){}enterAlterMaterializedView(e){}exitAlterMaterializedView(e){}enterDropUser(e){}exitDropUser(e){}enterDropType(e){}exitDropType(e){}enterDropMaterializedView(e){}exitDropMaterializedView(e){}enterDropAggregate(e){}exitDropAggregate(e){}enterDropFunction(e){}exitDropFunction(e){}enterDropTrigger(e){}exitDropTrigger(e){}enterDropRole(e){}exitDropRole(e){}enterDropTable(e){}exitDropTable(e){}enterDropKeyspace(e){}exitDropKeyspace(e){}enterDropIndex(e){}exitDropIndex(e){}enterCreateTable(e){}exitCreateTable(e){}enterWithElement(e){}exitWithElement(e){}enterClusteringOrderColumns(e){}exitClusteringOrderColumns(e){}enterClusteringOrder(e){}exitClusteringOrder(e){}enterTableOptions(e){}exitTableOptions(e){}enterTableOptionItem(e){}exitTableOptionItem(e){}enterTableOptionName(e){}exitTableOptionName(e){}enterTableOptionValue(e){}exitTableOptionValue(e){}enterOptionHash(e){}exitOptionHash(e){}enterOptionHashItem(e){}exitOptionHashItem(e){}enterOptionHashKey(e){}exitOptionHashKey(e){}enterOptionHashValue(e){}exitOptionHashValue(e){}enterColumnDefinitionList(e){}exitColumnDefinitionList(e){}enterColumnDefinition(e){}exitColumnDefinition(e){}enterPrimaryKeyColumn(e){}exitPrimaryKeyColumn(e){}enterPrimaryKeyElement(e){}exitPrimaryKeyElement(e){}enterPrimaryKeyDefinition(e){}exitPrimaryKeyDefinition(e){}enterSinglePrimaryKey(e){}exitSinglePrimaryKey(e){}enterCompoundKey(e){}exitCompoundKey(e){}enterCompositeKey(e){}exitCompositeKey(e){}enterPartitionKeyList(e){}exitPartitionKeyList(e){}enterClusteringKeyList(e){}exitClusteringKeyList(e){}enterPartitionKey(e){}exitPartitionKey(e){}enterClusteringKey(e){}exitClusteringKey(e){}enterApplyBatch(e){}exitApplyBatch(e){}enterBeginBatch(e){}exitBeginBatch(e){}enterBatchType(e){}exitBatchType(e){}enterAlterKeyspace(e){}exitAlterKeyspace(e){}enterReplicationList(e){}exitReplicationList(e){}enterReplicationListItem(e){}exitReplicationListItem(e){}enterDurableWrites(e){}exitDurableWrites(e){}enterUse(e){}exitUse(e){}enterTruncate(e){}exitTruncate(e){}enterSecondaryIndex(e){}exitSecondaryIndex(e){}enterCustomIndex(e){}exitCustomIndex(e){}enterCustomIndexOption(e){}exitCustomIndexOption(e){}enterCreateSearchIndex(e){}exitCreateSearchIndex(e){}enterSearchIndexConfigs(e){}exitSearchIndexConfigs(e){}enterDirectoryFactory(e){}exitDirectoryFactory(e){}enterSearchIndexOptions(e){}exitSearchIndexOptions(e){}enterSearchIndexProfile(e){}exitSearchIndexProfile(e){}enterSearchIndexProfiles(e){}exitSearchIndexProfiles(e){}enterSearchIndexColumnList(e){}exitSearchIndexColumnList(e){}enterSearchIndexColumn(e){}exitSearchIndexColumn(e){}enterIndexName(e){}exitIndexName(e){}enterIndexColumnSpec(e){}exitIndexColumnSpec(e){}enterIndexKeysSpec(e){}exitIndexKeysSpec(e){}enterIndexEntriesSSpec(e){}exitIndexEntriesSSpec(e){}enterIndexFullSpec(e){}exitIndexFullSpec(e){}enterIndexValuesSpec(e){}exitIndexValuesSpec(e){}enterDeleteStatement(e){}exitDeleteStatement(e){}enterDeleteColumnList(e){}exitDeleteColumnList(e){}enterDeleteColumnItem(e){}exitDeleteColumnItem(e){}enterUpdate(e){}exitUpdate(e){}enterIfSpec(e){}exitIfSpec(e){}enterIfConditionList(e){}exitIfConditionList(e){}enterIfCondition(e){}exitIfCondition(e){}enterAssignments(e){}exitAssignments(e){}enterAssignmentElement(e){}exitAssignmentElement(e){}enterAssignmentSet(e){}exitAssignmentSet(e){}enterAssignmentMap(e){}exitAssignmentMap(e){}enterAssignmentMapExpression(e){}exitAssignmentMapExpression(e){}enterAssignmentList(e){}exitAssignmentList(e){}enterAssignmentTuple(e){}exitAssignmentTuple(e){}enterInsert(e){}exitInsert(e){}enterUsingTtlTimestamp(e){}exitUsingTtlTimestamp(e){}enterTimestamp(e){}exitTimestamp(e){}enterTtl(e){}exitTtl(e){}enterUsingTimestampSpec(e){}exitUsingTimestampSpec(e){}enterIfNotExist(e){}exitIfNotExist(e){}enterIfExist(e){}exitIfExist(e){}enterInsertValuesSpec(e){}exitInsertValuesSpec(e){}enterInsertColumnSpec(e){}exitInsertColumnSpec(e){}enterColumnList(e){}exitColumnList(e){}enterExpressionList(e){}exitExpressionList(e){}enterExpression(e){}exitExpression(e){}enterSelect(e){}exitSelect(e){}enterAllowFilteringSpec(e){}exitAllowFilteringSpec(e){}enterLimitSpec(e){}exitLimitSpec(e){}enterFromSpec(e){}exitFromSpec(e){}enterFromSpecElement(e){}exitFromSpecElement(e){}enterOrderSpec(e){}exitOrderSpec(e){}enterOrderSpecElement(e){}exitOrderSpecElement(e){}enterWhereSpec(e){}exitWhereSpec(e){}enterDistinctSpec(e){}exitDistinctSpec(e){}enterSelectElements(e){}exitSelectElements(e){}enterSelectElement(e){}exitSelectElement(e){}enterRelationElements(e){}exitRelationElements(e){}enterRelationElement(e){}exitRelationElement(e){}enterRelalationContains(e){}exitRelalationContains(e){}enterRelalationContainsKey(e){}exitRelalationContainsKey(e){}enterFunctionCall(e){}exitFunctionCall(e){}enterFunctionArgs(e){}exitFunctionArgs(e){}enterConstant(e){}exitConstant(e){}enterDecimalLiteral(e){}exitDecimalLiteral(e){}enterFloatLiteral(e){}exitFloatLiteral(e){}enterStringLiteral(e){}exitStringLiteral(e){}enterBooleanLiteral(e){}exitBooleanLiteral(e){}enterHexadecimalLiteral(e){}exitHexadecimalLiteral(e){}enterKeyspace(e){}exitKeyspace(e){}enterTable(e){}exitTable(e){}enterColumn(e){}exitColumn(e){}enterDataType(e){}exitDataType(e){}enterDataTypeName(e){}exitDataTypeName(e){}enterDataTypeDefinition(e){}exitDataTypeDefinition(e){}enterOrderDirection(e){}exitOrderDirection(e){}enterRole(e){}exitRole(e){}enterTrigger(e){}exitTrigger(e){}enterTriggerClass(e){}exitTriggerClass(e){}enterMaterializedView(e){}exitMaterializedView(e){}enterType(e){}exitType(e){}enterAggregate(e){}exitAggregate(e){}enterFunctionStatement(e){}exitFunctionStatement(e){}enterLanguage(e){}exitLanguage(e){}enterUser(e){}exitUser(e){}enterPassword(e){}exitPassword(e){}enterHashKey(e){}exitHashKey(e){}enterParam(e){}exitParam(e){}enterParamName(e){}exitParamName(e){}enterKwAdd(e){}exitKwAdd(e){}enterKwAggregate(e){}exitKwAggregate(e){}enterKwAll(e){}exitKwAll(e){}enterKwAllPermissions(e){}exitKwAllPermissions(e){}enterKwAllow(e){}exitKwAllow(e){}enterKwAlter(e){}exitKwAlter(e){}enterKwAnd(e){}exitKwAnd(e){}enterKwApply(e){}exitKwApply(e){}enterKwAs(e){}exitKwAs(e){}enterKwAsc(e){}exitKwAsc(e){}enterKwAuthorize(e){}exitKwAuthorize(e){}enterKwBatch(e){}exitKwBatch(e){}enterKwBegin(e){}exitKwBegin(e){}enterKwBy(e){}exitKwBy(e){}enterKwCalled(e){}exitKwCalled(e){}enterKwClustering(e){}exitKwClustering(e){}enterKwCompact(e){}exitKwCompact(e){}enterKwContains(e){}exitKwContains(e){}enterKwCreate(e){}exitKwCreate(e){}enterKwDelete(e){}exitKwDelete(e){}enterKwDesc(e){}exitKwDesc(e){}enterKwDescibe(e){}exitKwDescibe(e){}enterKwDistinct(e){}exitKwDistinct(e){}enterKwDrop(e){}exitKwDrop(e){}enterKwDurableWrites(e){}exitKwDurableWrites(e){}enterKwEntries(e){}exitKwEntries(e){}enterKwExecute(e){}exitKwExecute(e){}enterKwExists(e){}exitKwExists(e){}enterKwFiltering(e){}exitKwFiltering(e){}enterKwFinalfunc(e){}exitKwFinalfunc(e){}enterKwFrom(e){}exitKwFrom(e){}enterKwFull(e){}exitKwFull(e){}enterKwFunction(e){}exitKwFunction(e){}enterKwFunctions(e){}exitKwFunctions(e){}enterKwGrant(e){}exitKwGrant(e){}enterKwIf(e){}exitKwIf(e){}enterKwIn(e){}exitKwIn(e){}enterKwIndex(e){}exitKwIndex(e){}enterKwCustom(e){}exitKwCustom(e){}enterKwSearch(e){}exitKwSearch(e){}enterKwAscii(e){}exitKwAscii(e){}enterKwNormalize(e){}exitKwNormalize(e){}enterKwAnalyzed(e){}exitKwAnalyzed(e){}enterKwIsLiteral(e){}exitKwIsLiteral(e){}enterKwMaxCompactionFlushMemoryInMb(e){}exitKwMaxCompactionFlushMemoryInMb(e){}enterKwTokenizationEnableStemming(e){}exitKwTokenizationEnableStemming(e){}enterKwTokenizationSkipStopWords(e){}exitKwTokenizationSkipStopWords(e){}enterKwTokenizationLocale(e){}exitKwTokenizationLocale(e){}enterKwTokenizationNormalizeLowercase(e){}exitKwTokenizationNormalizeLowercase(e){}enterKwTokenizationNormalizeUppercase(e){}exitKwTokenizationNormalizeUppercase(e){}enterKwNormalizeLowercase(e){}exitKwNormalizeLowercase(e){}enterKwNormalizeUppercase(e){}exitKwNormalizeUppercase(e){}enterKwMode(e){}exitKwMode(e){}enterKwAnalyzerClass(e){}exitKwAnalyzerClass(e){}enterKwStorageAttachedIndex(e){}exitKwStorageAttachedIndex(e){}enterKwSolrIndex(e){}exitKwSolrIndex(e){}enterKwSASIIndex(e){}exitKwSASIIndex(e){}enterKwSpaceSavingNoJoin(e){}exitKwSpaceSavingNoJoin(e){}enterKwSpaceSavingAll(e){}exitKwSpaceSavingAll(e){}enterKwSpaceSavingSlowTriePrecision(e){}exitKwSpaceSavingSlowTriePrecision(e){}enterKwSpaceSavingNoTextField(e){}exitKwSpaceSavingNoTextField(e){}enterKwCopyField(e){}exitKwCopyField(e){}enterKwDocValues(e){}exitKwDocValues(e){}enterKwExcluded(e){}exitKwExcluded(e){}enterKwIndexed(e){}exitKwIndexed(e){}enterKwLowerCase(e){}exitKwLowerCase(e){}enterKwColumns(e){}exitKwColumns(e){}enterKwProfiles(e){}exitKwProfiles(e){}enterKwConfig(e){}exitKwConfig(e){}enterKwAutoCommitTime(e){}exitKwAutoCommitTime(e){}enterKwDefaultQueryField(e){}exitKwDefaultQueryField(e){}enterKwDirectoryFactory(e){}exitKwDirectoryFactory(e){}enterKwFilterCacheLowWaterMark(e){}exitKwFilterCacheLowWaterMark(e){}enterKwFilterCacheHighWaterMark(e){}exitKwFilterCacheHighWaterMark(e){}enterKwDirectoryFactoryClass(e){}exitKwDirectoryFactoryClass(e){}enterKwMergeMaxThreadCount(e){}exitKwMergeMaxThreadCount(e){}enterKwMergeMaxMergeCount(e){}exitKwMergeMaxMergeCount(e){}enterKwRamBufferSize(e){}exitKwRamBufferSize(e){}enterKwRealtime(e){}exitKwRealtime(e){}enterKwRecovery(e){}exitKwRecovery(e){}enterKwReindex(e){}exitKwReindex(e){}enterKwLenient(e){}exitKwLenient(e){}enterKwStandard(e){}exitKwStandard(e){}enterKwEncrypted(e){}exitKwEncrypted(e){}enterKwCaseSensitive(e){}exitKwCaseSensitive(e){}enterKwInitcond(e){}exitKwInitcond(e){}enterKwInput(e){}exitKwInput(e){}enterKwInsert(e){}exitKwInsert(e){}enterKwInto(e){}exitKwInto(e){}enterKwIs(e){}exitKwIs(e){}enterKwJson(e){}exitKwJson(e){}enterKwKey(e){}exitKwKey(e){}enterKwKeys(e){}exitKwKeys(e){}enterKwKeyspace(e){}exitKwKeyspace(e){}enterKwKeyspaces(e){}exitKwKeyspaces(e){}enterKwLanguage(e){}exitKwLanguage(e){}enterKwLimit(e){}exitKwLimit(e){}enterKwList(e){}exitKwList(e){}enterKwLogged(e){}exitKwLogged(e){}enterKwLogin(e){}exitKwLogin(e){}enterKwMaterialized(e){}exitKwMaterialized(e){}enterKwModify(e){}exitKwModify(e){}enterKwNosuperuser(e){}exitKwNosuperuser(e){}enterKwNorecursive(e){}exitKwNorecursive(e){}enterKwNot(e){}exitKwNot(e){}enterKwNull(e){}exitKwNull(e){}enterKwOf(e){}exitKwOf(e){}enterKwOn(e){}exitKwOn(e){}enterKwOptions(e){}exitKwOptions(e){}enterKwOr(e){}exitKwOr(e){}enterKwOrder(e){}exitKwOrder(e){}enterKwPassword(e){}exitKwPassword(e){}enterKwPrimary(e){}exitKwPrimary(e){}enterKwRename(e){}exitKwRename(e){}enterKwReplace(e){}exitKwReplace(e){}enterKwReplication(e){}exitKwReplication(e){}enterKwReturns(e){}exitKwReturns(e){}enterKwRole(e){}exitKwRole(e){}enterKwInternal(e){}exitKwInternal(e){}enterKwLdap(e){}exitKwLdap(e){}enterKwScheme(e){}exitKwScheme(e){}enterKwRoles(e){}exitKwRoles(e){}enterKwSelect(e){}exitKwSelect(e){}enterKwSet(e){}exitKwSet(e){}enterKwSfunc(e){}exitKwSfunc(e){}enterKwStorage(e){}exitKwStorage(e){}enterKwStype(e){}exitKwStype(e){}enterKwSuperuser(e){}exitKwSuperuser(e){}enterKwTable(e){}exitKwTable(e){}enterKwTimestamp(e){}exitKwTimestamp(e){}enterKwTo(e){}exitKwTo(e){}enterKwTrigger(e){}exitKwTrigger(e){}enterKwTruncate(e){}exitKwTruncate(e){}enterKwTtl(e){}exitKwTtl(e){}enterKwType(e){}exitKwType(e){}enterKwUnlogged(e){}exitKwUnlogged(e){}enterKwUpdate(e){}exitKwUpdate(e){}enterKwUse(e){}exitKwUse(e){}enterKwUser(e){}exitKwUser(e){}enterKwUsers(e){}exitKwUsers(e){}enterKwUsing(e){}exitKwUsing(e){}enterKwValues(e){}exitKwValues(e){}enterKwView(e){}exitKwView(e){}enterKwWhere(e){}exitKwWhere(e){}enterKwWith(e){}exitKwWith(e){}enterKwRevoke(e){}exitKwRevoke(e){}enterEof(e){}exitEof(e){}enterSyntaxBracketLr(e){}exitSyntaxBracketLr(e){}enterSyntaxBracketRr(e){}exitSyntaxBracketRr(e){}enterSyntaxBracketLc(e){}exitSyntaxBracketLc(e){}enterSyntaxBracketRc(e){}exitSyntaxBracketRc(e){}enterSyntaxBracketLa(e){}exitSyntaxBracketLa(e){}enterSyntaxBracketRa(e){}exitSyntaxBracketRa(e){}enterSyntaxBracketLs(e){}exitSyntaxBracketLs(e){}enterSyntaxBracketRs(e){}exitSyntaxBracketRs(e){}enterSyntaxComma(e){}exitSyntaxComma(e){}enterSyntaxColon(e){}exitSyntaxColon(e){}enterId(e){}exitId(e){}};c(_A,"CqlParserListener");var bA=_A;eH.CqlParserListener=bA});var AA=w(uH=>{"use strict";var ks0=wa(),RA=class RA extends ks0.tree.ParseTreeVisitor{visitRoot(e){return this.visitChildren(e)}visitCqls(e){return this.visitChildren(e)}visitStatementSeparator(e){return this.visitChildren(e)}visitEmpty(e){return this.visitChildren(e)}visitCql(e){return this.visitChildren(e)}visitRevoke(e){return this.visitChildren(e)}visitListUsers(e){return this.visitChildren(e)}visitListRoles(e){return this.visitChildren(e)}visitListPermissions(e){return this.visitChildren(e)}visitGrant(e){return this.visitChildren(e)}visitPriviledge(e){return this.visitChildren(e)}visitResource(e){return this.visitChildren(e)}visitCreateUser(e){return this.visitChildren(e)}visitCreateRole(e){return this.visitChildren(e)}visitCreateType(e){return this.visitChildren(e)}visitTypeMemberColumnList(e){return this.visitChildren(e)}visitCreateTrigger(e){return this.visitChildren(e)}visitCreateMaterializedView(e){return this.visitChildren(e)}visitMaterializedViewWhere(e){return this.visitChildren(e)}visitColumnNotNullList(e){return this.visitChildren(e)}visitColumnNotNull(e){return this.visitChildren(e)}visitMaterializedViewOptions(e){return this.visitChildren(e)}visitCreateKeyspace(e){return this.visitChildren(e)}visitCreateFunction(e){return this.visitChildren(e)}visitCodeBlock(e){return this.visitChildren(e)}visitParamList(e){return this.visitChildren(e)}visitReturnMode(e){return this.visitChildren(e)}visitCreateAggregate(e){return this.visitChildren(e)}visitInitCondDefinition(e){return this.visitChildren(e)}visitInitCondHash(e){return this.visitChildren(e)}visitInitCondHashItem(e){return this.visitChildren(e)}visitInitCondListNested(e){return this.visitChildren(e)}visitInitCondList(e){return this.visitChildren(e)}visitOrReplace(e){return this.visitChildren(e)}visitAlterUser(e){return this.visitChildren(e)}visitUserPassword(e){return this.visitChildren(e)}visitUserSuperUser(e){return this.visitChildren(e)}visitAlterType(e){return this.visitChildren(e)}visitAlterTypeOperation(e){return this.visitChildren(e)}visitAlterTypeRename(e){return this.visitChildren(e)}visitAlterTypeRenameList(e){return this.visitChildren(e)}visitAlterTypeRenameItem(e){return this.visitChildren(e)}visitAlterTypeAdd(e){return this.visitChildren(e)}visitAlterTypeAlterType(e){return this.visitChildren(e)}visitAlterTable(e){return this.visitChildren(e)}visitAlterTableOperation(e){return this.visitChildren(e)}visitAlterTableWith(e){return this.visitChildren(e)}visitAlterTableRename(e){return this.visitChildren(e)}visitAlterTableDropCompactStorage(e){return this.visitChildren(e)}visitAlterTableDropColumns(e){return this.visitChildren(e)}visitAlterTableDropColumnList(e){return this.visitChildren(e)}visitAlterTableAdd(e){return this.visitChildren(e)}visitAlterTableColumnDefinition(e){return this.visitChildren(e)}visitAlterRole(e){return this.visitChildren(e)}visitRoleWith(e){return this.visitChildren(e)}visitRoleWithOptions(e){return this.visitChildren(e)}visitAlterMaterializedView(e){return this.visitChildren(e)}visitDropUser(e){return this.visitChildren(e)}visitDropType(e){return this.visitChildren(e)}visitDropMaterializedView(e){return this.visitChildren(e)}visitDropAggregate(e){return this.visitChildren(e)}visitDropFunction(e){return this.visitChildren(e)}visitDropTrigger(e){return this.visitChildren(e)}visitDropRole(e){return this.visitChildren(e)}visitDropTable(e){return this.visitChildren(e)}visitDropKeyspace(e){return this.visitChildren(e)}visitDropIndex(e){return this.visitChildren(e)}visitCreateTable(e){return this.visitChildren(e)}visitWithElement(e){return this.visitChildren(e)}visitClusteringOrderColumns(e){return this.visitChildren(e)}visitClusteringOrder(e){return this.visitChildren(e)}visitTableOptions(e){return this.visitChildren(e)}visitTableOptionItem(e){return this.visitChildren(e)}visitTableOptionName(e){return this.visitChildren(e)}visitTableOptionValue(e){return this.visitChildren(e)}visitOptionHash(e){return this.visitChildren(e)}visitOptionHashItem(e){return this.visitChildren(e)}visitOptionHashKey(e){return this.visitChildren(e)}visitOptionHashValue(e){return this.visitChildren(e)}visitColumnDefinitionList(e){return this.visitChildren(e)}visitColumnDefinition(e){return this.visitChildren(e)}visitPrimaryKeyColumn(e){return this.visitChildren(e)}visitPrimaryKeyElement(e){return this.visitChildren(e)}visitPrimaryKeyDefinition(e){return this.visitChildren(e)}visitSinglePrimaryKey(e){return this.visitChildren(e)}visitCompoundKey(e){return this.visitChildren(e)}visitCompositeKey(e){return this.visitChildren(e)}visitPartitionKeyList(e){return this.visitChildren(e)}visitClusteringKeyList(e){return this.visitChildren(e)}visitPartitionKey(e){return this.visitChildren(e)}visitClusteringKey(e){return this.visitChildren(e)}visitApplyBatch(e){return this.visitChildren(e)}visitBeginBatch(e){return this.visitChildren(e)}visitBatchType(e){return this.visitChildren(e)}visitAlterKeyspace(e){return this.visitChildren(e)}visitReplicationList(e){return this.visitChildren(e)}visitReplicationListItem(e){return this.visitChildren(e)}visitDurableWrites(e){return this.visitChildren(e)}visitUse(e){return this.visitChildren(e)}visitTruncate(e){return this.visitChildren(e)}visitSecondaryIndex(e){return this.visitChildren(e)}visitCustomIndex(e){return this.visitChildren(e)}visitCustomIndexOption(e){return this.visitChildren(e)}visitCreateSearchIndex(e){return this.visitChildren(e)}visitSearchIndexConfigs(e){return this.visitChildren(e)}visitDirectoryFactory(e){return this.visitChildren(e)}visitSearchIndexOptions(e){return this.visitChildren(e)}visitSearchIndexProfile(e){return this.visitChildren(e)}visitSearchIndexProfiles(e){return this.visitChildren(e)}visitSearchIndexColumnList(e){return this.visitChildren(e)}visitSearchIndexColumn(e){return this.visitChildren(e)}visitIndexName(e){return this.visitChildren(e)}visitIndexColumnSpec(e){return this.visitChildren(e)}visitIndexKeysSpec(e){return this.visitChildren(e)}visitIndexEntriesSSpec(e){return this.visitChildren(e)}visitIndexFullSpec(e){return this.visitChildren(e)}visitIndexValuesSpec(e){return this.visitChildren(e)}visitDeleteStatement(e){return this.visitChildren(e)}visitDeleteColumnList(e){return this.visitChildren(e)}visitDeleteColumnItem(e){return this.visitChildren(e)}visitUpdate(e){return this.visitChildren(e)}visitIfSpec(e){return this.visitChildren(e)}visitIfConditionList(e){return this.visitChildren(e)}visitIfCondition(e){return this.visitChildren(e)}visitAssignments(e){return this.visitChildren(e)}visitAssignmentElement(e){return this.visitChildren(e)}visitAssignmentSet(e){return this.visitChildren(e)}visitAssignmentMap(e){return this.visitChildren(e)}visitAssignmentMapExpression(e){return this.visitChildren(e)}visitAssignmentList(e){return this.visitChildren(e)}visitAssignmentTuple(e){return this.visitChildren(e)}visitInsert(e){return this.visitChildren(e)}visitUsingTtlTimestamp(e){return this.visitChildren(e)}visitTimestamp(e){return this.visitChildren(e)}visitTtl(e){return this.visitChildren(e)}visitUsingTimestampSpec(e){return this.visitChildren(e)}visitIfNotExist(e){return this.visitChildren(e)}visitIfExist(e){return this.visitChildren(e)}visitInsertValuesSpec(e){return this.visitChildren(e)}visitInsertColumnSpec(e){return this.visitChildren(e)}visitColumnList(e){return this.visitChildren(e)}visitExpressionList(e){return this.visitChildren(e)}visitExpression(e){return this.visitChildren(e)}visitSelect(e){return this.visitChildren(e)}visitAllowFilteringSpec(e){return this.visitChildren(e)}visitLimitSpec(e){return this.visitChildren(e)}visitFromSpec(e){return this.visitChildren(e)}visitFromSpecElement(e){return this.visitChildren(e)}visitOrderSpec(e){return this.visitChildren(e)}visitOrderSpecElement(e){return this.visitChildren(e)}visitWhereSpec(e){return this.visitChildren(e)}visitDistinctSpec(e){return this.visitChildren(e)}visitSelectElements(e){return this.visitChildren(e)}visitSelectElement(e){return this.visitChildren(e)}visitRelationElements(e){return this.visitChildren(e)}visitRelationElement(e){return this.visitChildren(e)}visitRelalationContains(e){return this.visitChildren(e)}visitRelalationContainsKey(e){return this.visitChildren(e)}visitFunctionCall(e){return this.visitChildren(e)}visitFunctionArgs(e){return this.visitChildren(e)}visitConstant(e){return this.visitChildren(e)}visitDecimalLiteral(e){return this.visitChildren(e)}visitFloatLiteral(e){return this.visitChildren(e)}visitStringLiteral(e){return this.visitChildren(e)}visitBooleanLiteral(e){return this.visitChildren(e)}visitHexadecimalLiteral(e){return this.visitChildren(e)}visitKeyspace(e){return this.visitChildren(e)}visitTable(e){return this.visitChildren(e)}visitColumn(e){return this.visitChildren(e)}visitDataType(e){return this.visitChildren(e)}visitDataTypeName(e){return this.visitChildren(e)}visitDataTypeDefinition(e){return this.visitChildren(e)}visitOrderDirection(e){return this.visitChildren(e)}visitRole(e){return this.visitChildren(e)}visitTrigger(e){return this.visitChildren(e)}visitTriggerClass(e){return this.visitChildren(e)}visitMaterializedView(e){return this.visitChildren(e)}visitType(e){return this.visitChildren(e)}visitAggregate(e){return this.visitChildren(e)}visitFunctionStatement(e){return this.visitChildren(e)}visitLanguage(e){return this.visitChildren(e)}visitUser(e){return this.visitChildren(e)}visitPassword(e){return this.visitChildren(e)}visitHashKey(e){return this.visitChildren(e)}visitParam(e){return this.visitChildren(e)}visitParamName(e){return this.visitChildren(e)}visitKwAdd(e){return this.visitChildren(e)}visitKwAggregate(e){return this.visitChildren(e)}visitKwAll(e){return this.visitChildren(e)}visitKwAllPermissions(e){return this.visitChildren(e)}visitKwAllow(e){return this.visitChildren(e)}visitKwAlter(e){return this.visitChildren(e)}visitKwAnd(e){return this.visitChildren(e)}visitKwApply(e){return this.visitChildren(e)}visitKwAs(e){return this.visitChildren(e)}visitKwAsc(e){return this.visitChildren(e)}visitKwAuthorize(e){return this.visitChildren(e)}visitKwBatch(e){return this.visitChildren(e)}visitKwBegin(e){return this.visitChildren(e)}visitKwBy(e){return this.visitChildren(e)}visitKwCalled(e){return this.visitChildren(e)}visitKwClustering(e){return this.visitChildren(e)}visitKwCompact(e){return this.visitChildren(e)}visitKwContains(e){return this.visitChildren(e)}visitKwCreate(e){return this.visitChildren(e)}visitKwDelete(e){return this.visitChildren(e)}visitKwDesc(e){return this.visitChildren(e)}visitKwDescibe(e){return this.visitChildren(e)}visitKwDistinct(e){return this.visitChildren(e)}visitKwDrop(e){return this.visitChildren(e)}visitKwDurableWrites(e){return this.visitChildren(e)}visitKwEntries(e){return this.visitChildren(e)}visitKwExecute(e){return this.visitChildren(e)}visitKwExists(e){return this.visitChildren(e)}visitKwFiltering(e){return this.visitChildren(e)}visitKwFinalfunc(e){return this.visitChildren(e)}visitKwFrom(e){return this.visitChildren(e)}visitKwFull(e){return this.visitChildren(e)}visitKwFunction(e){return this.visitChildren(e)}visitKwFunctions(e){return this.visitChildren(e)}visitKwGrant(e){return this.visitChildren(e)}visitKwIf(e){return this.visitChildren(e)}visitKwIn(e){return this.visitChildren(e)}visitKwIndex(e){return this.visitChildren(e)}visitKwCustom(e){return this.visitChildren(e)}visitKwSearch(e){return this.visitChildren(e)}visitKwAscii(e){return this.visitChildren(e)}visitKwNormalize(e){return this.visitChildren(e)}visitKwAnalyzed(e){return this.visitChildren(e)}visitKwIsLiteral(e){return this.visitChildren(e)}visitKwMaxCompactionFlushMemoryInMb(e){return this.visitChildren(e)}visitKwTokenizationEnableStemming(e){return this.visitChildren(e)}visitKwTokenizationSkipStopWords(e){return this.visitChildren(e)}visitKwTokenizationLocale(e){return this.visitChildren(e)}visitKwTokenizationNormalizeLowercase(e){return this.visitChildren(e)}visitKwTokenizationNormalizeUppercase(e){return this.visitChildren(e)}visitKwNormalizeLowercase(e){return this.visitChildren(e)}visitKwNormalizeUppercase(e){return this.visitChildren(e)}visitKwMode(e){return this.visitChildren(e)}visitKwAnalyzerClass(e){return this.visitChildren(e)}visitKwStorageAttachedIndex(e){return this.visitChildren(e)}visitKwSolrIndex(e){return this.visitChildren(e)}visitKwSASIIndex(e){return this.visitChildren(e)}visitKwSpaceSavingNoJoin(e){return this.visitChildren(e)}visitKwSpaceSavingAll(e){return this.visitChildren(e)}visitKwSpaceSavingSlowTriePrecision(e){return this.visitChildren(e)}visitKwSpaceSavingNoTextField(e){return this.visitChildren(e)}visitKwCopyField(e){return this.visitChildren(e)}visitKwDocValues(e){return this.visitChildren(e)}visitKwExcluded(e){return this.visitChildren(e)}visitKwIndexed(e){return this.visitChildren(e)}visitKwLowerCase(e){return this.visitChildren(e)}visitKwColumns(e){return this.visitChildren(e)}visitKwProfiles(e){return this.visitChildren(e)}visitKwConfig(e){return this.visitChildren(e)}visitKwAutoCommitTime(e){return this.visitChildren(e)}visitKwDefaultQueryField(e){return this.visitChildren(e)}visitKwDirectoryFactory(e){return this.visitChildren(e)}visitKwFilterCacheLowWaterMark(e){return this.visitChildren(e)}visitKwFilterCacheHighWaterMark(e){return this.visitChildren(e)}visitKwDirectoryFactoryClass(e){return this.visitChildren(e)}visitKwMergeMaxThreadCount(e){return this.visitChildren(e)}visitKwMergeMaxMergeCount(e){return this.visitChildren(e)}visitKwRamBufferSize(e){return this.visitChildren(e)}visitKwRealtime(e){return this.visitChildren(e)}visitKwRecovery(e){return this.visitChildren(e)}visitKwReindex(e){return this.visitChildren(e)}visitKwLenient(e){return this.visitChildren(e)}visitKwStandard(e){return this.visitChildren(e)}visitKwEncrypted(e){return this.visitChildren(e)}visitKwCaseSensitive(e){return this.visitChildren(e)}visitKwSimilarityFunction(e){return this.visitChildren(e)}visitKwInitcond(e){return this.visitChildren(e)}visitKwInput(e){return this.visitChildren(e)}visitKwInsert(e){return this.visitChildren(e)}visitKwInto(e){return this.visitChildren(e)}visitKwIs(e){return this.visitChildren(e)}visitKwJson(e){return this.visitChildren(e)}visitKwKey(e){return this.visitChildren(e)}visitKwKeys(e){return this.visitChildren(e)}visitKwKeyspace(e){return this.visitChildren(e)}visitKwKeyspaces(e){return this.visitChildren(e)}visitKwLanguage(e){return this.visitChildren(e)}visitKwLimit(e){return this.visitChildren(e)}visitKwList(e){return this.visitChildren(e)}visitKwLogged(e){return this.visitChildren(e)}visitKwLogin(e){return this.visitChildren(e)}visitKwMaterialized(e){return this.visitChildren(e)}visitKwModify(e){return this.visitChildren(e)}visitKwNosuperuser(e){return this.visitChildren(e)}visitKwNorecursive(e){return this.visitChildren(e)}visitKwNot(e){return this.visitChildren(e)}visitKwNull(e){return this.visitChildren(e)}visitKwOf(e){return this.visitChildren(e)}visitKwOn(e){return this.visitChildren(e)}visitKwOptions(e){return this.visitChildren(e)}visitKwOr(e){return this.visitChildren(e)}visitKwOrder(e){return this.visitChildren(e)}visitKwPassword(e){return this.visitChildren(e)}visitKwPrimary(e){return this.visitChildren(e)}visitKwRename(e){return this.visitChildren(e)}visitKwReplace(e){return this.visitChildren(e)}visitKwReplication(e){return this.visitChildren(e)}visitKwReturns(e){return this.visitChildren(e)}visitKwRole(e){return this.visitChildren(e)}visitKwInternal(e){return this.visitChildren(e)}visitKwLdap(e){return this.visitChildren(e)}visitKwScheme(e){return this.visitChildren(e)}visitKwRoles(e){return this.visitChildren(e)}visitKwSelect(e){return this.visitChildren(e)}visitKwSet(e){return this.visitChildren(e)}visitKwSfunc(e){return this.visitChildren(e)}visitKwStorage(e){return this.visitChildren(e)}visitKwStype(e){return this.visitChildren(e)}visitKwSuperuser(e){return this.visitChildren(e)}visitKwTable(e){return this.visitChildren(e)}visitKwTimestamp(e){return this.visitChildren(e)}visitKwTo(e){return this.visitChildren(e)}visitKwTrigger(e){return this.visitChildren(e)}visitKwTruncate(e){return this.visitChildren(e)}visitKwTtl(e){return this.visitChildren(e)}visitKwType(e){return this.visitChildren(e)}visitKwUnlogged(e){return this.visitChildren(e)}visitKwUpdate(e){return this.visitChildren(e)}visitKwUse(e){return this.visitChildren(e)}visitKwUser(e){return this.visitChildren(e)}visitKwUsers(e){return this.visitChildren(e)}visitKwUsing(e){return this.visitChildren(e)}visitKwValues(e){return this.visitChildren(e)}visitKwView(e){return this.visitChildren(e)}visitKwWhere(e){return this.visitChildren(e)}visitKwWith(e){return this.visitChildren(e)}visitKwRevoke(e){return this.visitChildren(e)}visitEof(e){return this.visitChildren(e)}visitSyntaxBracketLr(e){return this.visitChildren(e)}visitSyntaxBracketRr(e){return this.visitChildren(e)}visitSyntaxBracketLc(e){return this.visitChildren(e)}visitSyntaxBracketRc(e){return this.visitChildren(e)}visitSyntaxBracketLa(e){return this.visitChildren(e)}visitSyntaxBracketRa(e){return this.visitChildren(e)}visitSyntaxBracketLs(e){return this.visitChildren(e)}visitSyntaxBracketRs(e){return this.visitChildren(e)}visitSyntaxComma(e){return this.visitChildren(e)}visitSyntaxColon(e){return this.visitChildren(e)}visitId(e){return this.visitChildren(e)}};c(RA,"CqlParserVisitor");var CA=RA;uH.CqlParserVisitor=CA});var QI=w(rH=>{"use strict";var y=wa(),f10=tH().CqlParserListener,R=AA().CqlParserVisitor,Bs0=["\u608B\uA72A\u8133\uB9ED\u417C\u3BE7\u7786","\u5964\xE4\u0C83  ","   \x07 ",`\x07\b \b  - Promise.all([ - exec(cassandra.getTableMetadata(keyspaceName, tableName), 'Load meta data...', 'Meta data has loaded'), - exec(cassandra.scanRecords(keyspaceName, tableName, recordSamplingSettings, logger), 'Load records...', 'Records have loaded'), - cassandra.describeSearchIndexes(keyspaceName, tableName) - ]).then(([table, records, searchIndex]) => { - loadProgress('Records and Meta data have loaded'); - - packageData = cassandra.getPackageData({ - records: cassandra.filterNullItems(JSON.parse(JSON.stringify(records))), - keyspaceName, - table, - tableName, - UDFs, - UDAs, - views, - searchIndex, - }, includeEmptyCollection); - - return packageData; - }) - .then( - packageData => tableCallback(null, packageData), - err => tableCallback({...err, table: tableName}) - ); - }, (err, res) => { - if (err) { - logger.log('error', cassandra.prepareError(err), "Retrieving schema"); - } - - return keyspaceCallback(err, res) - }); - } - }; - }, (err, res) => { - err = cassandra.prepareError(err); - - if (!err) { - logger.progress({ message: 'Reverse-Engineering complete!', containerName: '', entityName: '' }); - } else { - logger.log('error', err, 'Retrieving schema'); - } - - return cb(err, res); - }); - } -}; - -const logInfo = (step, connectionInfo, logger) => { - logger.clear(); - logger.log('info', logHelper.getSystemInfo(connectionInfo.appVersion), step); - logger.log('info', connectionInfo, 'connectionInfo', connectionInfo.hiddenKeys); -}; - -const progress = (logger, keyspace, table, message) => { - logger.progress({ - containerName: keyspace, - entityName: table, - message: message - }); - logger.log('info', { keyspace, table, message }, 'Retrieving schema ...'); -} - -const handleErrorObject = (error, title) => { - const errorProperties = Object.getOwnPropertyNames(error).reduce((accumulator, key) => ({ ...accumulator, [key]: error[key] }), {}); - - return { title , ...errorProperties }; -}; +\v \v`,"\f \f\r \r  ","    ","   ","    ","\x1B \x1B  ",'   ! !" "#'," #$ $% %& &' '( () )","* *+ +, ,- -. ./ /0 0","1 12 23 34 45 56 67 7","8 89 9: :; ;< <= => >","? ?@ @A AB BC CD DE E","F FG GH HI IJ JK KL L","M MN NO OP PQ QR RS S","T TU UV VW WX XY YZ Z","[ [\\ \\] ]^ ^_ _` `a a","b bc cd de ef fg gh h","i ij jk kl lm mn no o","p pq qr rs st tu uv v","w wx xy yz z{ {| |} }","~ ~\x7F \x7F\x80 \x80\x81 \x81","\x82 \x82\x83 \x83\x84 \x84\x85 ","\x85\x86 \x86\x87 \x87\x88 \x88","\x89 \x89\x8A \x8A\x8B \x8B\x8C ","\x8C\x8D \x8D\x8E \x8E\x8F \x8F","\x90 \x90\x91 \x91\x92 \x92\x93 ","\x93\x94 \x94\x95 \x95\x96 \x96","\x97 \x97\x98 \x98\x99 \x99\x9A ","\x9A\x9B \x9B\x9C \x9C\x9D \x9D","\x9E \x9E\x9F \x9F\xA0 \xA0\xA1 ","\xA1\xA2 \xA2\xA3 \xA3\xA4 \xA4","\xA5 \xA5\xA6 \xA6\xA7 \xA7\xA8 ","\xA8\xA9 \xA9\xAA \xAA\xAB \xAB","\xAC \xAC\xAD \xAD\xAE \xAE\xAF ","\xAF\xB0 \xB0\xB1 \xB1\xB2 \xB2","\xB3 \xB3\xB4 \xB4\xB5 \xB5\xB6 ","\xB6\xB7 \xB7\xB8 \xB8\xB9 \xB9","\xBA \xBA\xBB \xBB\xBC \xBC\xBD ","\xBD\xBE \xBE\xBF \xBF\xC0 \xC0","\xC1 \xC1\xC2 \xC2\xC3 \xC3\xC4 ","\xC4\xC5 \xC5\xC6 \xC6\xC7 \xC7","\xC8 \xC8\xC9 \xC9\xCA \xCA\xCB ","\xCB\xCC \xCC\xCD \xCD\xCE \xCE","\xCF \xCF\xD0 \xD0\xD1 \xD1\xD2 ","\xD2\xD3 \xD3\xD4 \xD4\xD5 \xD5","\xD6 \xD6\xD7 \xD7\xD8 \xD8\xD9 ","\xD9\xDA \xDA\xDB \xDB\xDC \xDC","\xDD \xDD\xDE \xDE\xDF \xDF\xE0 ","\xE0\xE1 \xE1\xE2 \xE2\xE3 \xE3","\xE4 \xE4\xE5 \xE5\xE6 \xE6\xE7 ","\xE7\xE8 \xE8\xE9 \xE9\xEA \xEA","\xEB \xEB\xEC \xEC\xED \xED\xEE ","\xEE\xEF \xEF\xF0 \xF0\xF1 \xF1","\xF2 \xF2\xF3 \xF3\xF4 \xF4\xF5 ","\xF5\xF6 \xF6\xF7 \xF7\xF8 \xF8","\xF9 \xF9\xFA \xFA\xFB \xFB\xFC ","\xFC\xFD \xFD\xFE \xFE\xFF \xFF","\u0100 \u0100\u0101 \u0101\u0102 \u0102\u0103 ","\u0103\u0104 \u0104\u0105 \u0105\u0106 \u0106","\u0107 \u0107\u0108 \u0108\u0109 \u0109\u010A ","\u010A\u010B \u010B\u010C \u010C\u010D \u010D","\u010E \u010E\u010F \u010F\u0110 \u0110\u0111 ","\u0111\u0112 \u0112\u0113 \u0113\u0114 \u0114","\u0115 \u0115\u0116 \u0116\u0117 \u0117\u0118 ","\u0118\u0119 \u0119\u011A \u011A\u011B \u011B","\u011C \u011C\u011D \u011D\u011E \u011E\u011F ","\u011F\u0120 \u0120\u0121 \u0121\u0122 \u0122","\u0123 \u0123\u0124 \u0124\u0125 \u0125\u0126 ","\u0126\u0127 \u0127\u0128 \u0128\u0129 \u0129","\u012A \u012A\u012B \u012B\u012C \u012C\u012D ","\u012D\u012E \u012E\u012F \u012F\u0130 \u0130","\u0131 \u0131\u0132 \u0132\u0133 \u0133\u0134 ","\u0134\u0135 \u0135\u0136 \u0136\u0137 \u0137","\u0138 \u0138\u0139 \u0139\u013A \u013A\u013B ","\u013B\u013C \u013C\u013D \u013D\u013E \u013E","\u013F \u013F\u0140 \u0140\u0141 \u0141\u0142 ","\u0142\u0143 \u0143\u0144 \u0144\u0145 \u0145","\u0146 \u0146\u0147 \u0147\u0148 \u0148\u0149 ","\u0149\u014A \u014A\u014B \u014B\u014C \u014C","\u014D \u014D\u014E \u014E\u014F \u014F\u0150 ","\u0150\u0151 \u0151\u0152 \u0152\u0153 \u0153","\u0154 \u0154\u0155 \u0155\u0156 \u0156\u0157 ","\u0157\u0158 \u0158\u0159 \u0159",`\u02B4 +\u02B7 +`,`\u02BD +`,`\x07\u02C2 +\f`,`\u02C5\v\u02C9 +`,`\u02CC +\u02CF`,` +`,"","","","","","",`\u02FB +\x07\x07`,"\x07\x07\x07\x07\x07\b",`\b\b      \u030C + `,`  \u030F +  + + + + +`,` +\u0316 + + + + + +\u031B + +\v`,"\v\v\v\v\v\v",`\f\f\f\u0326 +\f\f\f\f\f\f`,`\f\f\f\f\u0330 +\f\r\r\r`,"\r\r\r\r\r\r\r\r\r",`\r\r\u033F +\r\r\r\r\r\r\r`,`\r\r\r\r\u034A +\r\r\r\r`,`\r\u034F +\r\r\r\r\r\r\r\r`,`\r\r\r\u035A +\r\r\r\r\u035E +\r`,`\u0363 +`,"",`\u036B +`,`\u0370 +\u0374 +`,`\u0379 +`,`\u037E +`,"",`\x07\u038B +`,"\f\u038E\v",`\u0393 +`,`\u0398 +`,"\u03A2",` +\u03A7 +`,"",`\u03B1 +`,`\u03B6 +`,`\u03BB +`,`\u03C2 +`,`\x07\u03C8 +\f`,"\u03CB\v","",`\u03D7 +`,"",`\u03E3 +`,`\u03E7 +\u03EB +`,`\u03F0 +`,`\u03F5 +`,"","\x1B\x1B",`\x1B\x1B\x07\x1B\u0406 +\x1B\f\x1B\x1B`,"\u0409\v\x1B",`\u040F +`,`\u0417 +`,`\u041B +`,`\u0420 +`,"","",`\u0433 +`,`\x07\u043A +\f`,"\u043D\v ","   !!!!!!\x07!\u044B",` +!\f!!\u044E\v!!!"""`,`""\x07"\u0457 +"\f""\u045A\v""`,'"###$$$$$$',`$\u0467 +$%%%&&&\u046E +&`,`''''''\u0475 +'''`,`'((((\u047D +()))`,`****\x07*\u0486 +*\f**\u0489\v*`,"++++,,,---",`--......\u049C +..`,`..///////\u04A7 +/`,"0001111122","223334444\x074\u04BC",` +4\f44\u04BF\v455566`,`6666\x076\u04CA +6\f66\u04CD\v6`,`77777\u04D3 +78888`,`8\x078\u04DA +8\f88\u04DD\v8999`,"9999999999",`9999\u04EF +9:::::`,`::\u04F7 +::::::\u04FD +:`,`;;;;\u0502 +;;;<<<`,`<\u0509 +<<<<<\u050E +<<<`,`=====\u0516 +=====\u051B`,` +===>>>>\u0522 +>>`,`>>>\u0527 +>>>????\u052E`,` +?????\u0533 +???@`,`@@@\u053A +@@@@@@@\u0541`,` +@@@AAAA\u0548 +AA`,`ABBBB\u054F +BBBBB\u0554`,` +BBBCCCC\u055B +CC`,`CDDDD\u0562 +DDDDD\u0567`,` +DDDEEEE\u056E +EE`,`EEE\u0573 +EEEEEEE\u057A`,` +EFFF\u057E +FGGG\u0582 +G`,`GGGG\u0587 +G\x07G\u0589 +G\fGG\u058C\v`,"GHHHHHHHII",`II\x07I\u0599 +I\fII\u059C\vIJJ`,`JJJJJJJJ\u05A7 +JK`,`KLLLL\u05AE +LMMMM`,`M\x07M\u05B5 +M\fMM\u05B8\vMMMN`,`NNNOOPPPP\u05C5 +P`,`QQQQ\x07Q\u05CB +Q\fQQ\u05CE\vQ`,`QQQQ\u05D3 +QRRRR\u05D8 +`,"RSSSTTTTTT",`UUUU\u05E6 +UVVWWW`,`WW\u05EE +WXXXXXXX\u05F6`,` +XYYYY\x07Y\u05FC +Y\fYY\u05FF\v`,`YZZZZ\x07Z\u0605 +Z\fZZ\u0608\v`,"Z[[\\\\]]]^^",`^\u0613 +^^^^\u0617 +^___\u061B`,"\n_`````````","````\u0629\n`aaaa\x07a\u062F",` +a\faa\u0632\vabbbbb`,`bb\u063A +bccccddd`,`eee\u0645 +eeeee\u064A +e`,`eeffff\u0651 +fff\u0654 +`,`ffffff\u065A +ffff`,`fffffff\u0665 +fff\u0668`,` +ffffff\u066E +fff`,`fffffff\u0678 +fff`,`ffff\u067F +f\rff\u0680ff`,`f\u0685 +ff\u0687 +fggggg\u068D`,` +gggggg\u0693 +ggg`,`ggg\u0699 +gggggg\u069F +`,`gggggg\u06A5 +gggg`,`gg\u06AB +gggggg\u06B1 +g`,`ggggg\u06B7 +ggggg`,`g\u06BD +gggggg\u06C3 +gg`,`gggg\u06C9 +gggggg\u06CF`,` +gggggg\u06D5 +ggg`,`ggg\u06DB +gggggg\u06E1 +`,`gggggg\u06E7 +gg\u06E9 +g`,`hhhhh\u06EF +hhhhh`,`h\u06F5 +hhhhhhh\u06FC +h`,`hh\u06FF +hhhhh\u0704 +hh`,`h\u0707 +hhh\u070A +hhh\u070D +hh`,`h\u0710 +hh\u0712 +hiiiii`,`ii\u071A +iii\u071D +iiii`,`ii\u0723 +iii\u0726 +iiii`,`ii\u072C +iii\u072F +iiii`,`ii\u0735 +iii\u0738 +iiii`,`ii\u073E +iii\u0741 +iiii`,`ii\u0747 +iii\u074A +iiii`,`ii\u0750 +iii\u0753 +iiii`,`ii\u0759 +iii\u075C +iiii`,`ii\u0762 +iii\u0765 +iiii`,`ii\u076B +iiijjj\u0771 +j`,`kkkkkkk\u0779 +kkk\u077C`,` +kkkkkk\u0782 +kkk\u0785`,` +kkkkkk\u078B +kkk`,`lllll\u0793 +lmmmm\x07`,`m\u0799 +m\fmm\u079C\vmnnnn\x07`,`n\u07A2 +n\fnn\u07A5\vnoooo`,`ooo\u07AD +ooo\u07B0 +ooo`,`ooo\u07B6 +ooo\u07B9 +ooo`,`ooo\u07BF +ooo\u07C2 +ooo`,`ooo\u07C8 +ooo\u07CB +ooo`,`ooo\u07D1 +ooo\u07D4 +ooo`,`ooooo\u07DC +ooo\u07DF +o`,`ooooo\u07E5 +ooo\u07E8 +o`,`ooooo\u07EE +ooo\u07F1 +o`,`ooooo\u07F7 +ooo\u07FA +o`,`ooooo\u0800 +ooo\u0803 +o`,`o\u0805 +oppp\u0809 +pqqq`,`qqq\u0810 +qrrrrrs`,"sssstttttu",`uuuuvv\u0827 +vvvv\u082B`,` +vvvv\u082F +vvvvv\u0834`,` +vwwww\x07w\u083A +w\fww\u083D\v`,`wxxxxxx\u0844 +xxx`,`x\u0848 +xyy\u084B +yyyyy`,`y\u0851 +yyyy\u0855 +yyyy`,`yyy\u085C +yzzz{{{`,`{\x07{\u0865 +{\f{{\u0868\v{|||`,`|}}}}\x07}\u0872 +}\f}}\u0875\v`,`}~~~~~~~\u087D +~~`,"~~~~~~~~~~","~~~~~~~~~~","~~~~~~~~~~","~~~~~~~~~~",`~~~~~~~~~\u08B0 +~`,"\x7F\x7F\x7F\x7F\x7F\x07\x7F\u08B7",` +\x7F\f\x7F\x7F\u08BA\v\x7F\x7F\u08BC +\x7F`,"\x7F\x7F\x80\x80\x80\x80","\x80\x80\x80\x80\x80\x80",`\x07\x80\u08CA +\x80\f\x80\x80\u08CD\v\x80`,"\x80\x80\x81\x81\x81\x81",`\x81\x07\x81\u08D6 +\x81\f\x81\x81\u08D9\v\x81`,"\x81\x81\x82\x82\x82\x82",`\x82\x07\x82\u08E2 +\x82\f\x82\x82\u08E5\v`,"\x82\x82\x82\x83\x83\x83",`\x83\x83\x07\x83\u08EE +\x83\f\x83\x83\u08F1`,`\v\x83\x83\x83\x83\x07\x83\u08F6 +`,`\x83\f\x83\x83\u08F9\v\x83\x83\u08FB +\x83`,`\x83\x83\x83\x83\x07\x83\u0901 +`,`\x83\f\x83\x83\u0904\v\x83\x83\u0906 +\x83`,`\x83\x83\x84\x84\u090B +\x84`,"\x84\x84\x84\x84\x84\x84\u0912",` +\x84\x84\x84\x84\u0916 +\x84\x84`,`\x84\x84\u091A +\x84\x84\x84\u091D`,` +\x84\x85\x85\x85\x85\x85`,"\x85\x85\x85\x85\x85\x85","\x85\x85\x85\x85\x85\x85",`\u092F +\x85\x86\x86\x86\x87`,"\x87\x87\x88\x88\x88\x89","\x89\x89\x89\x8A\x8A\x8A","\x8B\x8B\x8B\x8B\x8B\x8B",`\x8B\x8B\x8B\u0949 +\x8B\x8C\x8C`,"\x8C\x8C\x8D\x8D\x8D\x8D",`\x07\x8D\u0953 +\x8D\f\x8D\x8D\u0956\v\x8D`,`\x8E\x8E\x8E\x8E\x07\x8E\u095C +\x8E`,"\f\x8E\x8E\u095F\v\x8E\x8F\x8F",`\x8F\x8F\x8F\x8F\x8F\u0967 +\x8F`,`\x90\x90\x90\u096B +\x90\x90`,`\x90\u096E +\x90\x90\x90\x90\x90`,`\u0973 +\x90\x90\x90\u0976 +\x90\x90`,`\x90\u0979 +\x90\x90\x90\u097C +\x90\x91`,"\x91\x91\x92\x92\x92\x93","\x93\x93\x94\x94\x94\x94",`\x94\x94\u098C +\x94\x95\x95`,"\x95\x95\x96\x96\x96\x96\u0995",` +\x96\x97\x97\x97\x98\x98`,`\x99\x99\x99\u099E +\x99\x99`,`\x99\x99\x07\x99\u09A3 +\x99\f\x99\x99\u09A6`,"\v\x99\x9A\x9A\x9A\x9A\x9A",`\x9A\x9A\x9A\x9A\u09B0 +\x9A`,`\x9A\x9A\x9A\x9A\x9A\u09B6 +\x9A`,`\x9A\u09B8 +\x9A\x9B\x9B\x9B`,`\x9B\x07\x9B\u09BE +\x9B\f\x9B\x9B\u09C1\v\x9B`,"\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C","\x9C\x9C\x9C\x9C\x9C\x9C",`\x9C\x9C\x9C\x9C\x9C\u09D9 +`,"\x9C\x9C\x9C\x9C\x9C\x9C",`\x9C\x9C\x07\x9C\u09E2 +\x9C\f\x9C\x9C\u09E5`,"\v\x9C\x9C\x9C\x9C\x9C\x9C",`\x9C\x9C\x07\x9C\u09EE +\x9C\f\x9C\x9C`,"\u09F1\v\x9C\x9C\x9C\x9C\x9C",`\x9C\x9C\x9C\x07\x9C\u09FA +\x9C\f\x9C`,"\x9C\u09FD\v\x9C\x9C\x9C\x9C\x9C",`\x9C\x9C\x07\x9C\u0A05 +\x9C\f\x9C\x9C`,`\u0A08\v\x9C\x9C\x9C\x9C\u0A0C +\x9C`,"\x9D\x9D\x9D\x9D\x9E\x9E","\x9E\x9E\x9E\x9E\x9F\x9F","\x9F\x9F\x9F\x9F\x9F\x9F",`\x9F\u0A20 +\x9F\x9F\x9F\x9F\u0A24`,` +\x9F\xA0\xA0\xA0\xA0\u0A29 +\xA0`,`\xA0\xA0\xA0\xA0\xA0\u0A2F +`,`\xA0\x07\xA0\u0A31 +\xA0\f\xA0\xA0\u0A34\v\xA0`,"\xA1\xA1\xA1\xA1\xA1\xA1",`\xA1\xA1\xA1\xA1\u0A3F +\xA1`,"\xA2\xA2\xA3\xA3\xA4\xA4","\xA5\xA5\xA6\xA6\xA7\xA7",`\xA7\xA7\xA7\xA7\u0A50 +\xA7\xA8`,`\xA8\xA8\xA8\xA8\xA8\u0A57 +`,"\xA8\xA9\xA9\xA9\xA9\xA9",`\xA9\u0A5E +\xA9\xAA\xAA\xAA\u0A62 +\xAA`,`\xAB\xAB\xAB\xAB\u0A67 +\xAB`,"\xAB\xAB\xAB\xAB\xAB\xAB","\xAB\xAB\xAB\xAB\xAB\xAB","\xAB\xAB\xAB\xAB\xAB\xAB","\xAB\xAB\xAB\xAB\xAB\xAB","\xAB\xAB\xAB\xAB\xAB\xAB\u0A86",` +\xAB\xAC\xAC\xAC\xAC\xAC`,`\xAC\u0A8D +\xAC\x07\xAC\u0A8F +\xAC\f\xAC\xAC`,"\u0A92\v\xAC\xAC\xAC\xAD\xAD",`\xAD\u0A98 +\xAD\xAE\xAE\xAF\xAF`,"\xB0\xB0\xB1\xB1\xB2\xB2","\xB3\xB3\xB4\xB4\xB5\xB5","\xB6\xB6\xB7\xB7\xB8\xB8","\xB9\xB9\xB9\xBA\xBA\xBB","\xBB\xBC\xBC\xBD\xBD\xBE","\xBE\xBE\xBF\xBF\xC0\xC0","\xC1\xC1\xC2\xC2\xC3\xC3","\xC4\xC4\xC5\xC5\xC6\xC6","\xC7\xC7\xC8\xC8\xC9\xC9","\xCA\xCA\xCB\xCB\xCC\xCC","\xCD\xCD\xCE\xCE\xCF\xCF","\xD0\xD0\xD1\xD1\xD2\xD2","\xD3\xD3\xD4\xD4\xD5\xD5","\xD6\xD6\xD7\xD7\xD8\xD8","\xD9\xD9\xDA\xDA\xDB\xDB","\xDC\xDC\xDD\xDD\xDE\xDE","\xDF\xDF\xE0\xE0\xE1\xE1","\xE2\xE2\xE3\xE3\xE4\xE4","\xE5\xE5\xE6\xE6\xE7\xE7","\xE8\xE8\xE9\xE9\xEA\xEA","\xEB\xEB\xEC\xEC\xED\xED","\xEE\xEE\xEF\xEF\xF0\xF0","\xF1\xF1\xF2\xF2\xF3\xF3","\xF4\xF4\xF5\xF5\xF6\xF6","\xF7\xF7\xF8\xF8\xF9\xF9","\xFA\xFA\xFB\xFB\xFC\xFC","\xFD\xFD\xFE\xFE\xFF\xFF","\u0100\u0100\u0101\u0101\u0102\u0102","\u0103\u0103\u0104\u0104\u0105\u0105","\u0106\u0106\u0107\u0107\u0108\u0108","\u0109\u0109\u010A\u010A\u010B\u010B","\u010C\u010C\u010D\u010D\u010E\u010E","\u010F\u010F\u0110\u0110\u0111\u0111","\u0112\u0112\u0113\u0113\u0114\u0114","\u0115\u0115\u0116\u0116\u0117\u0117","\u0118\u0118\u0119\u0119\u011A\u011A","\u011B\u011B\u011C\u011C\u011D\u011D","\u011E\u011E\u011F\u011F\u0120\u0120","\u0121\u0121\u0122\u0122\u0123\u0123","\u0124\u0124\u0125\u0125\u0126\u0126","\u0127\u0127\u0128\u0128\u0129\u0129","\u012A\u012A\u012B\u012B\u012C\u012C","\u012D\u012D\u012E\u012E\u012F\u012F","\u0130\u0130\u0131\u0131\u0132\u0132","\u0133\u0133\u0134\u0134\u0135\u0135","\u0136\u0136\u0137\u0137\u0138\u0138","\u0139\u0139\u013A\u013A\u013B\u013B","\u013C\u013C\u013D\u013D\u013E\u013E","\u013F\u013F\u0140\u0140\u0141\u0141","\u0142\u0142\u0143\u0143\u0144\u0144","\u0145\u0145\u0146\u0146\u0147\u0147","\u0148\u0148\u0149\u0149\u014A\u014A","\u014B\u014B\u014C\u014C\u014D\u014D","\u014E\u014E\u014F\u014F\u0150\u0150","\u0151\u0151\u0152\u0152\u0153\u0153","\u0154\u0154\u0155\u0155\u0156\u0156","\u0157\u0157\u0158\u0158\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159","\u0159\u0159\u0159\u0159\u0159\u0159",`\u0159\u0159\u0159\u0159\u0C81 +\u0159`,`\u0159\u015A\b +\f`,' "$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bd',"fhjlnprtvxz|~\x80\x82\x84\x86\x88\x8A\x8C\x8E\x90","\x92\x94\x96\x98\x9A\x9C\x9E\xA0\xA2\xA4\xA6\xA8","\xAA\xAC\xAE\xB0\xB2\xB4\xB6\xB8\xBA\xBC\xBE\xC0","\xC2\xC4\xC6\xC8\xCA\xCC\xCE\xD0\xD2\xD4\xD6\xD8","\xDA\xDC\xDE\xE0\xE2\xE4\xE6\xE8\xEA\xEC\xEE\xF0","\xF2\xF4\xF6\xF8\xFA\xFC\xFE\u0100\u0102\u0104\u0106\u0108","\u010A\u010C\u010E\u0110\u0112\u0114\u0116\u0118\u011A\u011C\u011E\u0120","\u0122\u0124\u0126\u0128\u012A\u012C\u012E\u0130\u0132\u0134\u0136\u0138","\u013A\u013C\u013E\u0140\u0142\u0144\u0146\u0148\u014A\u014C\u014E\u0150","\u0152\u0154\u0156\u0158\u015A\u015C\u015E\u0160\u0162\u0164\u0166\u0168","\u016A\u016C\u016E\u0170\u0172\u0174\u0176\u0178\u017A\u017C\u017E\u0180","\u0182\u0184\u0186\u0188\u018A\u018C\u018E\u0190\u0192\u0194\u0196\u0198","\u019A\u019C\u019E\u01A0\u01A2\u01A4\u01A6\u01A8\u01AA\u01AC\u01AE\u01B0","\u01B2\u01B4\u01B6\u01B8\u01BA\u01BC\u01BE\u01C0\u01C2\u01C4\u01C6\u01C8","\u01CA\u01CC\u01CE\u01D0\u01D2\u01D4\u01D6\u01D8\u01DA\u01DC\u01DE\u01E0","\u01E2\u01E4\u01E6\u01E8\u01EA\u01EC\u01EE\u01F0\u01F2\u01F4\u01F6\u01F8","\u01FA\u01FC\u01FE\u0200\u0202\u0204\u0206\u0208\u020A\u020C\u020E\u0210","\u0212\u0214\u0216\u0218\u021A\u021C\u021E\u0220\u0222\u0224\u0226\u0228","\u022A\u022C\u022E\u0230\u0232\u0234\u0236\u0238\u023A\u023C\u023E\u0240","\u0242\u0244\u0246\u0248\u024A\u024C\u024E\u0250\u0252\u0254\u0256\u0258","\u025A\u025C\u025E\u0260\u0262\u0264\u0266\u0268\u026A\u026C\u026E\u0270","\u0272\u0274\u0276\u0278\u027A\u027C\u027E\u0280\u0282\u0284\u0286\u0288","\u028A\u028C\u028E\u0290\u0292\u0294\u0296\u0298\u029A\u029C\u029E\u02A0","\u02A2\u02A4\u02A6\u02A8\u02AA\u02AC\u02AE\u02B0\x07","\xD6\xD7\xDE\xE2","\xD8\xD9::\x83\x83\u0D56","\u02B3\u02C3",`\u02D0\b\u02D2 +\u02FA`,"\f\u02FC\u0303","\u0306\u0310","\u031C\u032F","\u035D\u035F","\u036C\u0375",' \u0384"\u038F',"$\u039D&\u03BC","(\u03C3*\u03CC",",\u03D1.\u03D3","0\u03E42\u03FF4\u0401","6\u040E8\u0414",":\u0432<\u0434",">\u0440@\u0444","B\u0451D\u045D","F\u0460H\u0468J\u046D","L\u046FN\u047C","P\u047ER\u0481","T\u048AV\u048E","X\u0491Z\u0496","\\\u04A6^\u04A8`\u04AB","b\u04B0d\u04B4","f\u04B7h\u04C0","j\u04C3l\u04CE","n\u04D4p\u04EE","r\u04F0t\u04FEv\u0505","x\u0511z\u051E","|\u052A~\u0536","\x80\u0544\x82\u054B","\x84\u0557\x86\u055E","\x88\u056A\x8A\u057B","\x8C\u057F\x8E\u058D","\x90\u0594\x92\u05A6","\x94\u05A8\x96\u05AD","\x98\u05AF\x9A\u05BB","\x9C\u05BF\x9E\u05C4","\xA0\u05C6\xA2\u05D4","\xA4\u05D9\xA6\u05DC","\xA8\u05E5\xAA\u05E7","\xAC\u05E9\xAE\u05EF","\xB0\u05F7\xB2\u0600","\xB4\u0609\xB6\u060B","\xB8\u060D\xBA\u0610","\xBC\u061A\xBE\u061C","\xC0\u062A\xC2\u0639","\xC4\u063B\xC6\u063F","\xC8\u0642\xCA\u0686","\xCC\u06E8\xCE\u06EA","\xD0\u0713\xD2\u0770","\xD4\u0772\xD6\u0792","\xD8\u0794\xDA\u079D","\xDC\u0804\xDE\u0808","\xE0\u080F\xE2\u0811","\xE4\u0816\xE6\u081B","\xE8\u0820\xEA\u0826","\xEC\u0835\xEE\u0847","\xF0\u084A\xF2\u085D","\xF4\u0860\xF6\u0869","\xF8\u086D\xFA\u08AF","\xFC\u08B1\xFE\u08BF","\u0100\u08D0\u0102\u08DC","\u0104\u08E8\u0106\u090A","\u0108\u092E\u010A\u0930","\u010C\u0933\u010E\u0936","\u0110\u0939\u0112\u093D","\u0114\u0948\u0116\u094A","\u0118\u094E\u011A\u0957","\u011C\u0966\u011E\u0968","\u0120\u097D\u0122\u0980","\u0124\u0983\u0126\u098B","\u0128\u098D\u012A\u0991","\u012C\u0996\u012E\u0999","\u0130\u099D\u0132\u09B7","\u0134\u09B9\u0136\u0A0B","\u0138\u0A0D\u013A\u0A11","\u013C\u0A23\u013E\u0A28","\u0140\u0A3E\u0142\u0A40","\u0144\u0A42\u0146\u0A44","\u0148\u0A46\u014A\u0A48","\u014C\u0A4F\u014E\u0A56","\u0150\u0A5D\u0152\u0A5F","\u0154\u0A85\u0156\u0A87","\u0158\u0A97\u015A\u0A99","\u015C\u0A9B\u015E\u0A9D","\u0160\u0A9F\u0162\u0AA1","\u0164\u0AA3\u0166\u0AA5","\u0168\u0AA7\u016A\u0AA9","\u016C\u0AAB\u016E\u0AAD","\u0170\u0AAF\u0172\u0AB2","\u0174\u0AB4\u0176\u0AB6","\u0178\u0AB8\u017A\u0ABA","\u017C\u0ABD\u017E\u0ABF","\u0180\u0AC1\u0182\u0AC3","\u0184\u0AC5\u0186\u0AC7","\u0188\u0AC9\u018A\u0ACB","\u018C\u0ACD\u018E\u0ACF","\u0190\u0AD1\u0192\u0AD3","\u0194\u0AD5\u0196\u0AD7","\u0198\u0AD9\u019A\u0ADB","\u019C\u0ADD\u019E\u0ADF","\u01A0\u0AE1\u01A2\u0AE3","\u01A4\u0AE5\u01A6\u0AE7","\u01A8\u0AE9\u01AA\u0AEB","\u01AC\u0AED\u01AE\u0AEF","\u01B0\u0AF1\u01B2\u0AF3","\u01B4\u0AF5\u01B6\u0AF7","\u01B8\u0AF9\u01BA\u0AFB","\u01BC\u0AFD\u01BE\u0AFF","\u01C0\u0B01\u01C2\u0B03","\u01C4\u0B05\u01C6\u0B07","\u01C8\u0B09\u01CA\u0B0B","\u01CC\u0B0D\u01CE\u0B0F","\u01D0\u0B11\u01D2\u0B13","\u01D4\u0B15\u01D6\u0B17","\u01D8\u0B19\u01DA\u0B1B","\u01DC\u0B1D\u01DE\u0B1F","\u01E0\u0B21\u01E2\u0B23","\u01E4\u0B25\u01E6\u0B27","\u01E8\u0B29\u01EA\u0B2B","\u01EC\u0B2D\u01EE\u0B2F","\u01F0\u0B31\u01F2\u0B33","\u01F4\u0B35\u01F6\u0B37","\u01F8\u0B39\u01FA\u0B3B","\u01FC\u0B3D\u01FE\u0B3F","\u0200\u0B41\u0202\u0B43","\u0204\u0B45\u0206\u0B47","\u0208\u0B49\u020A\u0B4B","\u020C\u0B4D\u020E\u0B4F","\u0210\u0B51\u0212\u0B53","\u0214\u0B55\u0216\u0B57","\u0218\u0B59\u021A\u0B5B","\u021C\u0B5D\u021E\u0B5F","\u0220\u0B61\u0222\u0B63","\u0224\u0B65\u0226\u0B67","\u0228\u0B69\u022A\u0B6B","\u022C\u0B6D\u022E\u0B6F","\u0230\u0B71\u0232\u0B73","\u0234\u0B75\u0236\u0B77","\u0238\u0B79\u023A\u0B7B","\u023C\u0B7D\u023E\u0B7F","\u0240\u0B81\u0242\u0B83","\u0244\u0B85\u0246\u0B87","\u0248\u0B89\u024A\u0B8B","\u024C\u0B8D\u024E\u0B8F","\u0250\u0B91\u0252\u0B93","\u0254\u0B95\u0256\u0B97","\u0258\u0B99\u025A\u0B9B","\u025C\u0B9D\u025E\u0B9F","\u0260\u0BA1\u0262\u0BA3","\u0264\u0BA5\u0266\u0BA7","\u0268\u0BA9\u026A\u0BAB","\u026C\u0BAD\u026E\u0BAF","\u0270\u0BB1\u0272\u0BB3","\u0274\u0BB5\u0276\u0BB7","\u0278\u0BB9\u027A\u0BBB","\u027C\u0BBD\u027E\u0BBF","\u0280\u0BC1\u0282\u0BC3","\u0284\u0BC5\u0286\u0BC7","\u0288\u0BC9\u028A\u0BCB","\u028C\u0BCD\u028E\u0BCF","\u0290\u0BD1\u0292\u0BD3","\u0294\u0BD5\u0296\u0BD7","\u0298\u0BD9\u029A\u0BDB","\u029C\u0BDD\u029E\u0BDF","\u02A0\u0BE1\u02A2\u0BE3","\u02A4\u0BE5\u02A6\u0BE7","\u02A8\u0BE9\u02AA\u0BEB","\u02AC\u0BED\u02AE\u0BEF","\u02B0\u0C80\u02B2\u02B4","\u02B3\u02B2\u02B3\u02B4","\u02B4\u02B6\u02B5\u02B7\x07","\u02B6\u02B5\u02B6\u02B7","\u02B7\u02B8\u02B8\u02B9\u029A",`\u014E\u02B9\u02BA\u02BC +`,"\u02BB\u02BD\x07\u02BC\u02BB","\u02BC\u02BD\u02BD\u02BE","\u02BE\u02BF\u02BF\u02C2","\u02C0\u02C2\b\u02C1\u02BA","\u02C1\u02C0\u02C2\u02C5","\u02C3\u02C1\u02C3\u02C4","\u02C4\u02CE\u02C5\u02C3",`\u02C6\u02CB +\u02C7\u02C9\x07`,"\u02C8\u02C7\u02C8\u02C9","\u02C9\u02CA\u02CA\u02CC","\u02CB\u02C8\u02CB\u02CC","\u02CC\u02CF\u02CD\u02CF\b","\u02CE\u02C6\u02CE\u02CD",`\u02CF\u02D0\u02D1\x07 +`,"\u02D1\x07\u02D2\u02D3","\u02D3 \u02D4\u02FB\xBE","`\u02D5\u02FBr:\u02D6\u02FBl7\u02D7\u02FB","Z.\u02D8\u02FBL'\u02D9\u02FBF$","\u02DA\u02FB\xB8]\u02DB\u02FB8\u02DC","\u02FB0\u02DD\u02FB\xCAf\u02DE\u02FB","\xCEh\u02DF\u02FB.\u02E0\u02FB","$\u02E1\u02FB\u02E2\u02FB",'\x88E\u02E3\u02FB"\u02E4\u02FB',"\u02E5\u02FB\u02E6\u02FB\xEA","v\u02E7\u02FBz>\u02E8\u02FB|?\u02E9\u02FB","\x86D\u02EA\u02FB\x84C\u02EB\u02FB","x=\u02EC\u02FB\x80A\u02ED\u02FB\x82B","\u02EE\u02FB~@\u02EF\u02FBv<\u02F0\u02FB","t;\u02F1\u02FB\v\u02F2\u02FB\u0106",`\x84\u02F3\u02FB +\u02F4\u02FB`," \u02F5\u02FB\f\x07\u02F6\u02FB\u011E\x90","\u02F7\u02FB\xC8e\u02F8\u02FB\xF0y","\u02F9\u02FB\xC6d\u02FA\u02D4","\u02FA\u02D5\u02FA\u02D6","\u02FA\u02D7\u02FA\u02D8","\u02FA\u02D9\u02FA\u02DA","\u02FA\u02DB\u02FA\u02DC","\u02FA\u02DD\u02FA\u02DE","\u02FA\u02DF\u02FA\u02E0","\u02FA\u02E1\u02FA\u02E2","\u02FA\u02E3\u02FA\u02E4","\u02FA\u02E5\u02FA\u02E6","\u02FA\u02E7\u02FA\u02E8","\u02FA\u02E9\u02FA\u02EA","\u02FA\u02EB\u02FA\u02EC","\u02FA\u02ED\u02FA\u02EE","\u02FA\u02EF\u02FA\u02F0","\u02FA\u02F1\u02FA\u02F2","\u02FA\u02F3\u02FA\u02F4","\u02FA\u02F5\u02FA\u02F6","\u02FA\u02F7\u02FA\u02F8","\u02FA\u02F9\u02FB\v","\u02FC\u02FD\u0298\u014D\u02FD\u02FE\f","\u02FE\u02FF\u024C\u0127\u02FF\u0300\r","\u0300\u0301\u01B0\xD9\u0301\u0302\u015A\xAE","\u0302\r\u0303\u0304\u0238\u011D","\u0304\u0305\u028C\u0147\u0305","\u0306\u0307\u0238\u011D\u0307\u030B\u0268\u0135","\u0308\u0309\u024A\u0126\u0309\u030A\u015A\xAE","\u030A\u030C\u030B\u0308","\u030B\u030C\u030C\u030E","\u030D\u030F\u0244\u0123\u030E\u030D","\u030E\u030F\u030F","\u0310\u0311\u0238\u011D\u0311\u0315\f","\u0312\u0313\u024C\u0127\u0313\u0314\r","\u0314\u0316\u0315\u0312","\u0315\u0316\u0316\u031A","\u0317\u0318\u024A\u0126\u0318\u0319\u015A\xAE","\u0319\u031B\u031A\u0317","\u031A\u031B\u031B","\u031C\u031D\u01B8\xDD\u031D\u031E\f","\u031E\u031F\u024C\u0127\u031F\u0320\r","\u0320\u0321\u027A\u013E\u0321\u0322\u015A\xAE","\u0322\u0323\u0326\u0178\xBD","\u0324\u0326\u017A\xBE\u0325\u0323","\u0325\u0324\u0326\u0330","\u0327\u0330\u017E\xC0\u0328\u0330\u0188\xC5","\u0329\u0330\u019E\xD0\u032A\u0330\u01A8\xD5","\u032B\u0330\u0198\xCD\u032C\u0330\u01A2\xD2","\u032D\u0330\u0240\u0121\u032E\u0330\u026A\u0136","\u032F\u0325\u032F\u0327","\u032F\u0328\u032F\u0329","\u032F\u032A\u032F\u032B","\u032F\u032C\u032F\u032D","\u032F\u032E\u0330","\u0331\u0332\u0178\xBD\u0332\u0333\u01B6\xDC","\u0333\u035E\u0334\u0335\u0178\xBD","\u0335\u0336\u01B6\xDC\u0336\u0337\u01BC\xDF","\u0337\u0338\u0230\u0119\u0338\u0339\u014C\xA7","\u0339\u035E\u033A\u033E\u01B4\xDB","\u033B\u033C\u014C\xA7\u033C\u033D\x07","\u033D\u033F\u033E\u033B","\u033E\u033F\u033F\u0340","\u0340\u0341\u0166\xB4\u0341\u035E","\u0342\u0343\u0178\xBD\u0343\u0344\u0232\u011A","\u0344\u035E\u0345\u0346\u0230\u0119","\u0346\u0347\u014C\xA7\u0347\u035E","\u0348\u034A\u0276\u013C\u0349\u0348","\u0349\u034A\u034A\u034E","\u034B\u034C\u014C\xA7\u034C\u034D\x07","\u034D\u034F\u034E\u034B","\u034E\u034F\u034F\u0350","\u0350\u035E\u014E\xA8\u0351\u0352\u0178\xBD","\u0352\u0353\u0268\u0135\u0353\u035E","\u0354\u0355\u0260\u0131\u0355\u0356\u015A\xAE","\u0356\u035E\u0357\u035A\u0262\u0132","\u0358\u035A\u0264\u0133\u0359\u0357","\u0359\u0358\u035A\u035B","\u035B\u035C\u0266\u0134\u035C\u035E","\u035D\u0331\u035D\u0334","\u035D\u033A\u035D\u0342","\u035D\u0345\u035D\u0349","\u035D\u0351\u035D\u0354","\u035D\u0359\u035E","\u035F\u0360\u0198\xCD\u0360\u0362\u028A\u0146","\u0361\u0363\u0110\x89\u0362\u0361","\u0362\u0363\u0363\u0364","\u0364\u0365\u016A\xB6\u0365\u0366\u0296\u014C","\u0366\u0367\u0254\u012B\u0367\u036A\u0146\xA4","\u0368\u036B\u0274\u013B\u0369\u036B\u0242\u0122","\u036A\u0368\u036A\u0369","\u036A\u036B\u036B\x1B","\u036C\u036D\u0198\xCD\u036D\u036F\u0260\u0131","\u036E\u0370\u0110\x89\u036F\u036E","\u036F\u0370\u0370\u0371","\u0371\u0373\u015A\xAE\u0372\u0374n8\u0373","\u0372\u0373\u0374\u0374","\u0375\u0376\u0198\xCD\u0376","\u0378\u0282\u0142\u0377\u0379\u0110\x89\u0378","\u0377\u0378\u0379\u0379","\u037D\u037A\u037B\u014C\xA7\u037B","\u037C\x07\u037C\u037E\u037D","\u037A\u037D\u037E\u037E","\u037F\u037F\u0380\u0162\xB2\u0380","\u0381\u029C\u014F\u0381\u0382 \u0382","\u0383\u029E\u0150\u0383\u0384","\u0385\u0150\xA9\u0385\u038C\u0152\xAA\u0386","\u0387\u02AC\u0157\u0387\u0388\u0150\xA9\u0388","\u0389\u0152\xAA\u0389\u038B\u038A","\u0386\u038B\u038E\u038C","\u038A\u038C\u038D\u038D","!\u038E\u038C\u038F","\u0390\u0198\xCD\u0390\u0392\u027C\u013F\u0391","\u0393\u0110\x89\u0392\u0391\u0392","\u0393\u0393\u0397\u0394","\u0395\u014C\xA7\u0395\u0396\x07\u0396","\u0398\u0397\u0394\u0397","\u0398\u0398\u0399\u0399","\u039A\u015C\xAF\u039A\u039B\u028E\u0148\u039B","\u039C\u015E\xB0\u039C#\u039D","\u039E\u0198\xCD\u039E\u039F\u023E\u0120\u039F","\u03A1\u0292\u014A\u03A0\u03A2\u0110\x89\u03A1","\u03A0\u03A1\u03A2\u03A2","\u03A6\u03A3\u03A4\u014C\xA7\u03A4","\u03A5\x07\u03A5\u03A7\u03A6","\u03A3\u03A6\u03A7\u03A7","\u03A8\u03A8\u03A9\u0160\xB1\u03A9","\u03AA\u0184\xC3\u03AA\u03AB\u026A\u0136\u03AB","\u03AC\u0118\x8D\u03AC\u03B0\u01B0\xD9\u03AD","\u03AE\u014C\xA7\u03AE\u03AF\x07\u03AF","\u03B1\u03B0\u03AD\u03B0","\u03B1\u03B1\u03B2\u03B2","\u03B3\u014E\xA8\u03B3\u03B5&\u03B4","\u03B6\xA6T\u03B5\u03B4\u03B5","\u03B6\u03B6\u03BA\u03B7","\u03B8\u0296\u014C\u03B8\u03B9,\u03B9","\u03BB\u03BA\u03B7\u03BA","\u03BB\u03BB%\u03BC","\u03BD\u0294\u014B\u03BD\u03C1(\u03BE","\u03BF\u0180\xC1\u03BF\u03C0\u0134\x9B\u03C0","\u03C2\u03C1\u03BE\u03C1","\u03C2\u03C2'\u03C3","\u03C9*\u03C4\u03C5\u0180\xC1\u03C5","\u03C6*\u03C6\u03C8\u03C7","\u03C4\u03C8\u03CB\u03C9","\u03C7\u03C9\u03CA\u03CA",")\u03CB\u03C9\u03CC","\u03CD\u0150\xA9\u03CD\u03CE\u0228\u0115\u03CE","\u03CF\u0246\u0124\u03CF\u03D0\u0248\u0125\u03D0","+\u03D1\u03D2\x90I\u03D2-","\u03D3\u03D4\u0198\xCD\u03D4\u03D6","\u0230\u0119\u03D5\u03D7\u0110\x89\u03D6\u03D5","\u03D6\u03D7\u03D7\u03D8","\u03D8\u03D9\u014C\xA7\u03D9\u03DA","\u0296\u014C\u03DA\u03DB\u025C\u012F\u03DB\u03DC\x07","\xDE\u03DC\u03DD\u02A0\u0151\u03DD\u03DE","\xC0a\u03DE\u03E2\u02A2\u0152\u03DF\u03E0","\u0180\xC1\u03E0\u03E1\xC4c\u03E1\u03E3","\u03E2\u03DF\u03E2\u03E3","\u03E3/\u03E4\u03E6","\u0198\xCD\u03E5\u03E7D#\u03E6\u03E5","\u03E6\u03E7\u03E7\u03E8","\u03E8\u03EA\u01B4\xDB\u03E9\u03EB\u0110","\x89\u03EA\u03E9\u03EA\u03EB","\u03EB\u03EF\u03EC\u03ED\u014C","\xA7\u03ED\u03EE\x07\u03EE\u03F0","\u03EF\u03EC\u03EF\u03F0","\u03F0\u03F1\u03F1\u03F2\u0166","\xB4\u03F2\u03F4\u029C\u014F\u03F3\u03F54","\x1B\u03F4\u03F3\u03F4\u03F5","\u03F5\u03F6\u03F6\u03F7\u029E","\u0150\u03F7\u03F86\u03F8\u03F9\u025E","\u0130\u03F9\u03FA\u0152\xAA\u03FA\u03FB\u0234","\u011B\u03FB\u03FC\u0168\xB5\u03FC\u03FD\u0184","\xC3\u03FD\u03FE2\u03FE1","\u03FF\u0400 \u04003","\u0401\u0407\u0170\xB9\u0402\u0403\u02AC\u0157","\u0403\u0404\u0170\xB9\u0404\u0406","\u0405\u0402\u0406\u0409","\u0407\u0405\u0407\u0408","\u04085\u0409\u0407","\u040A\u040F\u0190\xC9\u040B\u040C\u025E\u0130","\u040C\u040D\u0248\u0125\u040D\u040F","\u040E\u040A\u040E\u040B","\u040F\u0410\u0410\u0411\u024C\u0127","\u0411\u0412\u0248\u0125\u0412\u0413\u0222\u0112","\u04137\u0414\u0416\u0198\xCD","\u0415\u0417D#\u0416\u0415\u0416","\u0417\u0417\u0418\u0418","\u041A\u0176\xBC\u0419\u041B\u0110\x89\u041A","\u0419\u041A\u041B\u041B","\u041F\u041C\u041D\u014C\xA7\u041D","\u041E\x07\u041E\u0420\u041F","\u041C\u041F\u0420\u0420","\u0421\u0421\u0422\u0164\xB3\u0422","\u0423\u029C\u014F\u0423\u0424\u0152\xAA\u0424","\u0425\u029E\u0150\u0425\u0426\u026E\u0138\u0426","\u0427\u0166\xB4\u0427\u0428\u0272\u013A\u0428","\u0429\u0152\xAA\u0429\u042A\u01AE\xD8\u042A","\u042B\u0166\xB4\u042B\u042C\u0220\u0111\u042C","\u042D:\u042D9\u042E\u0433",'\u0140\xA1\u042F\u0433B"\u0430\u0433',"@!\u0431\u0433<\u0432\u042E","\u0432\u042F\u0432\u0430","\u0432\u0431\u0433;","\u0434\u0435\u02A0\u0151\u0435\u043B> ","\u0436\u0437\u02AC\u0157\u0437\u0438> \u0438","\u043A\u0439\u0436\u043A","\u043D\u043B\u0439\u043B","\u043C\u043C\u043E\u043D","\u043B\u043E\u043F\u02A2\u0152\u043F","=\u0440\u0441\u016E\xB8\u0441","\u0442\x07\v\u0442\u0443:\u0443","?\u0444\u0445\u029C\u014F\u0445",'\u044CB"\u0446\u0447\u02AC\u0157\u0447\u0448',"\u0140\xA1\u0448\u044B\u0449\u044B",'B"\u044A\u0446\u044A\u0449',"\u044B\u044E\u044C\u044A","\u044C\u044D\u044D\u044F","\u044E\u044C\u044F\u0450","\u029E\u0150\u0450A\u0451\u0452","\u029C\u014F\u0452\u0458\u0140\xA1\u0453\u0454","\u02AC\u0157\u0454\u0455\u0140\xA1\u0455\u0457","\u0456\u0453\u0457\u045A","\u0458\u0456\u0458\u0459","\u0459\u045B\u045A\u0458","\u045B\u045C\u029E\u0150\u045CC","\u045D\u045E\u0250\u0129\u045E\u045F","\u025A\u012E\u045FE\u0460\u0461","\u017E\xC0\u0461\u0462\u028A\u0146\u0462\u0463","\u016A\xB6\u0463\u0464\u0296\u014C\u0464\u0466","H%\u0465\u0467J&\u0466\u0465","\u0466\u0467\u0467G","\u0468\u0469\u0254\u012B\u0469\u046A\u0146\xA4","\u046AI\u046B\u046E\u0274\u013B","\u046C\u046E\u0242\u0122\u046D\u046B","\u046D\u046C\u046EK","\u046F\u0470\u017E\xC0\u0470\u0474\u0282\u0142","\u0471\u0472\u014C\xA7\u0472\u0473\x07","\u0473\u0475\u0474\u0471","\u0474\u0475\u0475\u0476","\u0476\u0477\u0162\xB2\u0477\u0478N(\u0478","M\u0479\u047DX-\u047A\u047D","V,\u047B\u047DP)\u047C\u0479","\u047C\u047A\u047C\u047B","\u047DO\u047E\u047F\u0258\u012D","\u047F\u0480R*\u0480Q\u0481\u0487","T+\u0482\u0483\u0180\xC1\u0483\u0484","T+\u0484\u0486\u0485\u0482","\u0486\u0489\u0487\u0485","\u0487\u0488\u0488S","\u0489\u0487\u048A\u048B\u0150","\xA9\u048B\u048C\u027A\u013E\u048C\u048D\u0150","\xA9\u048DU\u048E\u048F\u0174","\xBB\u048F\u0490 \u0490W","\u0491\u0492\u017E\xC0\u0492\u0493\u0150\xA9","\u0493\u0494\u0282\u0142\u0494\u0495\u0152\xAA","\u0495Y\u0496\u0497\u017E\xC0","\u0497\u049B\u0276\u013C\u0498\u0499\u014C\xA7","\u0499\u049A\x07\u049A\u049C","\u049B\u0498\u049B\u049C","\u049C\u049D\u049D\u049E\u014E\xA8","\u049E\u049F\\/\u049F[\u04A0","\u04A7h5\u04A1\u04A7d3\u04A2\u04A7d3","\u04A3\u04A7b2\u04A4\u04A7`1\u04A5\u04A7","^0\u04A6\u04A0\u04A6\u04A1","\u04A6\u04A2\u04A6\u04A3","\u04A6\u04A4\u04A6\u04A5","\u04A7]\u04A8\u04A9\u0296","\u014C\u04A9\u04AA\x90I\u04AA_","\u04AB\u04AC\u0258\u012D\u04AC\u04AD\u0150\xA9","\u04AD\u04AE\u027A\u013E\u04AE\u04AF\u0150\xA9","\u04AFa\u04B0\u04B1\u01A2\xD2","\u04B1\u04B2\u0194\xCB\u04B2\u04B3\u0270\u0139","\u04B3c\u04B4\u04B5\u01A2\xD2","\u04B5\u04B6f4\u04B6e\u04B7","\u04BD\u0150\xA9\u04B8\u04B9\u02AC\u0157\u04B9","\u04BA\u0150\xA9\u04BA\u04BC\u04BB","\u04B8\u04BC\u04BF\u04BD","\u04BB\u04BD\u04BE\u04BE","g\u04BF\u04BD\u04C0","\u04C1\u0174\xBB\u04C1\u04C2j6\u04C2i","\u04C3\u04C4\u0150\xA9\u04C4\u04CB","\u0152\xAA\u04C5\u04C6\u02AC\u0157\u04C6\u04C7","\u0150\xA9\u04C7\u04C8\u0152\xAA\u04C8\u04CA","\u04C9\u04C5\u04CA\u04CD","\u04CB\u04C9\u04CB\u04CC","\u04CCk\u04CD\u04CB","\u04CE\u04CF\u017E\xC0\u04CF\u04D0","\u0260\u0131\u04D0\u04D2\u015A\xAE\u04D1\u04D3","n8\u04D2\u04D1\u04D2\u04D3","\u04D3m\u04D4\u04D5\u0296","\u014C\u04D5\u04DBp9\u04D6\u04D7\u0180\xC1","\u04D7\u04D8p9\u04D8\u04DA","\u04D9\u04D6\u04DA\u04DD","\u04DB\u04D9\u04DB\u04DC","\u04DCo\u04DD\u04DB","\u04DE\u04DF\u0254\u012B\u04DF\u04E0\x07\xDE","\u04E0\u04E1\u0146\xA4\u04E1\u04EF","\u04E2\u04E3\u023C\u011F\u04E3\u04E4\x07\xDE","\u04E4\u04E5\u0148\xA5\u04E5\u04EF","\u04E6\u04E7\u0274\u013B\u04E7\u04E8\x07\xDE","\u04E8\u04E9\u0148\xA5\u04E9\u04EF","\u04EA\u04EB\u024E\u0128\u04EB\u04EC\x07\xDE","\u04EC\u04ED\x98M\u04ED\u04EF","\u04EE\u04DE\u04EE\u04E2","\u04EE\u04E6\u04EE\u04EA","\u04EFq\u04F0\u04F1\u017E\xC0","\u04F1\u04F2\u023E\u0120\u04F2\u04F6\u0292\u014A","\u04F3\u04F4\u014C\xA7\u04F4\u04F5\x07","\u04F5\u04F7\u04F6\u04F3","\u04F6\u04F7\u04F7\u04F8","\u04F8\u04FC\u0160\xB1\u04F9\u04FA\u0296\u014C","\u04FA\u04FB\x90I\u04FB\u04FD","\u04FC\u04F9\u04FC\u04FD","\u04FDs\u04FE\u04FF\u01A2\xD2","\u04FF\u0501\u028A\u0146\u0500\u0502\u0112\x8A","\u0501\u0500\u0501\u0502","\u0502\u0503\u0503\u0504\u016A\xB6","\u0504u\u0505\u0506\u01A2\xD2","\u0506\u0508\u0282\u0142\u0507\u0509\u0112\x8A","\u0508\u0507\u0508\u0509","\u0509\u050D\u050A\u050B\u014C\xA7","\u050B\u050C\x07\u050C\u050E","\u050D\u050A\u050D\u050E","\u050E\u050F\u050F\u0510\u0162\xB2","\u0510w\u0511\u0512\u01A2\xD2","\u0512\u0513\u023E\u0120\u0513\u0515\u0292\u014A","\u0514\u0516\u0112\x8A\u0515\u0514","\u0515\u0516\u0516\u051A","\u0517\u0518\u014C\xA7\u0518\u0519\x07","\u0519\u051B\u051A\u0517","\u051A\u051B\u051B\u051C","\u051C\u051D\u0160\xB1\u051Dy","\u051E\u051F\u01A2\xD2\u051F\u0521\u0176\xBC","\u0520\u0522\u0112\x8A\u0521\u0520","\u0521\u0522\u0522\u0526","\u0523\u0524\u014C\xA7\u0524\u0525\x07","\u0525\u0527\u0526\u0523","\u0526\u0527\u0527\u0528","\u0528\u0529\u0164\xB3\u0529{","\u052A\u052B\u01A2\xD2\u052B\u052D\u01B4\xDB","\u052C\u052E\u0112\x8A\u052D\u052C","\u052D\u052E\u052E\u0532","\u052F\u0530\u014C\xA7\u0530\u0531\x07","\u0531\u0533\u0532\u052F","\u0532\u0533\u0533\u0534","\u0534\u0535\u0166\xB4\u0535}","\u0536\u0537\u01A2\xD2\u0537\u0539\u027C\u013F","\u0538\u053A\u0112\x8A\u0539\u0538","\u0539\u053A\u053A\u053B","\u053B\u053C\u015C\xAF\u053C\u0540\u024C\u0127","\u053D\u053E\u014C\xA7\u053E\u053F\x07","\u053F\u0541\u0540\u053D","\u0540\u0541\u0541\u0542","\u0542\u0543\u014E\xA8\u0543\x7F","\u0544\u0545\u01A2\xD2\u0545\u0547\u0260\u0131","\u0546\u0548\u0112\x8A\u0547\u0546","\u0547\u0548\u0548\u0549","\u0549\u054A\u015A\xAE\u054A\x81","\u054B\u054C\u01A2\xD2\u054C\u054E\u0276\u013C","\u054D\u054F\u0112\x8A\u054E\u054D","\u054E\u054F\u054F\u0553","\u0550\u0551\u014C\xA7\u0551\u0552\x07","\u0552\u0554\u0553\u0550","\u0553\u0554\u0554\u0555","\u0555\u0556\u014E\xA8\u0556\x83","\u0557\u0558\u01A2\xD2\u0558\u055A\u0230\u0119","\u0559\u055B\u0112\x8A\u055A\u0559","\u055A\u055B\u055B\u055C","\u055C\u055D\u014C\xA7\u055D\x85","\u055E\u055F\u01A2\xD2\u055F\u0561\u01BE\xE0","\u0560\u0562\u0112\x8A\u0561\u0560","\u0561\u0562\u0562\u0566","\u0563\u0564\u014C\xA7\u0564\u0565\x07","\u0565\u0567\u0566\u0563","\u0566\u0567\u0567\u0568","\u0568\u0569\xDEp\u0569\x87","\u056A\u056B\u0198\xCD\u056B\u056D\u0276\u013C","\u056C\u056E\u0110\x89\u056D\u056C","\u056D\u056E\u056E\u0572","\u056F\u0570\u014C\xA7\u0570\u0571\x07","\u0571\u0573\u0572\u056F","\u0572\u0573\u0573\u0574","\u0574\u0575\u014E\xA8\u0575\u0576\u029C\u014F","\u0576\u0577\xA0Q\u0577\u0579\u029E\u0150","\u0578\u057A\x8AF\u0579\u0578","\u0579\u057A\u057A\x89","\u057B\u057D\u0296\u014C\u057C\u057E\x90I","\u057D\u057C\u057D\u057E","\u057E\x8B\u057F\u0581\u0150\xA9","\u0580\u0582\u0158\xAD\u0581\u0580","\u0581\u0582\u0582\u058A","\u0583\u0584\u02AC\u0157\u0584\u0586\u0150\xA9","\u0585\u0587\u0158\xAD\u0586\u0585","\u0586\u0587\u0587\u0589","\u0588\u0583\u0589\u058C","\u058A\u0588\u058A\u058B","\u058B\x8D\u058C\u058A","\u058D\u058E\u0192\xCA\u058E\u058F\u0252\u012A","\u058F\u0590\u018E\xC8\u0590\u0591\u029C\u014F","\u0591\u0592\x8CG\u0592\u0593\u029E\u0150","\u0593\x8F\u0594\u059A\x92J","\u0595\u0596\u0180\xC1\u0596\u0597\x92J","\u0597\u0599\u0598\u0595","\u0599\u059C\u059A\u0598","\u059A\u059B\u059B\x91","\u059C\u059A\u059D\u059E\x94K","\u059E\u059F\x07\xDE\u059F\u05A0\x96L","\u05A0\u05A7\u05A1\u05A2\x94K","\u05A2\u05A3\x07\xDE\u05A3\u05A4\x98M","\u05A4\u05A7\u05A5\u05A7\x8EH","\u05A6\u059D\u05A6\u05A1","\u05A6\u05A5\u05A7\x93","\u05A8\u05A9\u02B0\u0159\u05A9\x95","\u05AA\u05AE\u0146\xA4\u05AB\u05AE\u0144\xA3","\u05AC\u05AE\u02B0\u0159\u05AD\u05AA","\u05AD\u05AB\u05AD\u05AC","\u05AE\x97\u05AF\u05B0\u02A0\u0151","\u05B0\u05B6\x9AN\u05B1\u05B2\u02AC\u0157","\u05B2\u05B3\x9AN\u05B3\u05B5","\u05B4\u05B1\u05B5\u05B8","\u05B6\u05B4\u05B6\u05B7","\u05B7\u05B9\u05B8\u05B6","\u05B9\u05BA\u02A2\u0152\u05BA\x99","\u05BB\u05BC\x9CO\u05BC\u05BD\x07\v","\u05BD\u05BE\x9EP\u05BE\x9B","\u05BF\u05C0\u0146\xA4\u05C0\x9D","\u05C1\u05C5\u0146\xA4\u05C2\u05C5\u0148\xA5","\u05C3\u05C5\u0144\xA3\u05C4\u05C1","\u05C4\u05C2\u05C4\u05C3","\u05C5\x9F\u05C6\u05CC\xA2R","\u05C7\u05C8\u02AC\u0157\u05C8\u05C9\xA2R","\u05C9\u05CB\u05CA\u05C7","\u05CB\u05CE\u05CC\u05CA","\u05CC\u05CD\u05CD\u05D2","\u05CE\u05CC\u05CF\u05D0\u02AC\u0157","\u05D0\u05D1\xA6T\u05D1\u05D3","\u05D2\u05CF\u05D2\u05D3","\u05D3\xA1\u05D4\u05D5\u0150\xA9","\u05D5\u05D7\u0152\xAA\u05D6\u05D8\xA4S","\u05D7\u05D6\u05D7\u05D8","\u05D8\xA3\u05D9\u05DA\u0256\u012C","\u05DA\u05DB\u022C\u0117\u05DB\xA5","\u05DC\u05DD\u0256\u012C\u05DD\u05DE\u022C\u0117","\u05DE\u05DF\u029C\u014F\u05DF\u05E0\xA8U","\u05E0\u05E1\u029E\u0150\u05E1\xA7","\u05E2\u05E6\xAAV\u05E3\u05E6\xACW\u05E4","\u05E6\xAEX\u05E5\u05E2\u05E5","\u05E3\u05E5\u05E4\u05E6","\xA9\u05E7\u05E8\u0150\xA9\u05E8","\xAB\u05E9\u05ED\xB4[\u05EA","\u05EB\u02AC\u0157\u05EB\u05EC\xB2Z\u05EC","\u05EE\u05ED\u05EA\u05ED","\u05EE\u05EE\xAD\u05EF","\u05F0\u029C\u014F\u05F0\u05F1\xB0Y\u05F1","\u05F5\u029E\u0150\u05F2\u05F3\u02AC\u0157\u05F3","\u05F4\xB2Z\u05F4\u05F6\u05F5","\u05F2\u05F5\u05F6\u05F6","\xAF\u05F7\u05FD\xB4[\u05F8","\u05F9\u02AC\u0157\u05F9\u05FA\xB4[\u05FA","\u05FC\u05FB\u05F8\u05FC","\u05FF\u05FD\u05FB\u05FD","\u05FE\u05FE\xB1\u05FF","\u05FD\u0600\u0606\xB6\\\u0601","\u0602\u02AC\u0157\u0602\u0603\xB6\\\u0603","\u0605\u0604\u0601\u0605","\u0608\u0606\u0604\u0606","\u0607\u0607\xB3\u0608","\u0606\u0609\u060A\u0150\xA9\u060A","\xB5\u060B\u060C\u0150\xA9\u060C","\xB7\u060D\u060E\u0182\xC2\u060E","\u060F\u018A\xC6\u060F\xB9\u0610","\u0612\u018C\xC7\u0611\u0613\xBC_\u0612","\u0611\u0612\u0613\u0613","\u0614\u0614\u0616\u018A\xC6\u0615","\u0617\u010E\x88\u0616\u0615\u0616","\u0617\u0617\xBB\u0618","\u061B\u023A\u011E\u0619\u061B\u0284\u0143\u061A","\u0618\u061A\u0619\u061B","\xBD\u061C\u061D\u017E\xC0\u061D","\u061E\u0230\u0119\u061E\u061F\u014C\xA7\u061F","\u0620\u0296\u014C\u0620\u0621\u025C\u012F\u0621","\u0622\x07\xDE\u0622\u0623\u02A0\u0151\u0623","\u0624\xC0a\u0624\u0628\u02A2\u0152\u0625","\u0626\u0180\xC1\u0626\u0627\xC4c\u0627","\u0629\u0628\u0625\u0628","\u0629\u0629\xBF\u062A","\u0630\xC2b\u062B\u062C\u02AC\u0157\u062C","\u062D\xC2b\u062D\u062F\u062E","\u062B\u062F\u0632\u0630","\u062E\u0630\u0631\u0631","\xC1\u0632\u0630\u0633","\u0634\x07\xD7\u0634\u0635\x07\v\u0635","\u063A\x07\xD7\u0636\u0637\x07\xD7\u0637","\u0638\x07\v\u0638\u063A\x07\xD8\u0639","\u0633\u0639\u0636\u063A","\xC3\u063B\u063C\u01A4\xD3\u063C","\u063D\x07\xDE\u063D\u063E\u0148\xA5\u063E","\xC5\u063F\u0640\u0288\u0145\u0640","\u0641\u014C\xA7\u0641\xC7\u0642","\u0644\u027E\u0140\u0643\u0645\u0276\u013C\u0644","\u0643\u0644\u0645\u0645","\u0649\u0646\u0647\u014C\xA7\u0647","\u0648\x07\u0648\u064A\u0649","\u0646\u0649\u064A\u064A","\u064B\u064B\u064C\u014E\xA8\u064C","\xC9\u064D\u064E\u0198\xCD\u064E","\u0650\u01BE\xE0\u064F\u0651\u0110\x89\u0650","\u064F\u0650\u0651\u0651","\u0653\u0652\u0654\xDEp\u0653","\u0652\u0653\u0654\u0654","\u0655\u0655\u0659\u024C\u0127\u0656","\u0657\u014C\xA7\u0657\u0658\x07\u0658","\u065A\u0659\u0656\u0659","\u065A\u065A\u065B\u065B","\u065C\u014E\xA8\u065C\u065D\u029C\u014F\u065D","\u065E\xE0q\u065E\u065F\u029E\u0150\u065F","\u0687\u0660\u0661\u0198\xCD\u0661","\u0662\u01C0\xE1\u0662\u0664\u01BE\xE0\u0663","\u0665\u0110\x89\u0664\u0663\u0664","\u0665\u0665\u0667\u0666","\u0668\xDEp\u0667\u0666\u0667","\u0668\u0668\u0669\u0669","\u066D\u024C\u0127\u066A\u066B\u014C\xA7\u066B","\u066C\x07\u066C\u066E\u066D","\u066A\u066D\u066E\u066E","\u066F\u066F\u0670\u014E\xA8\u0670","\u0671\u029C\u014F\u0671\u0672\xE0q\u0672","\u0673\u029E\u0150\u0673\u0677\u028E\u0148\u0674","\u0678\u01E0\xF1\u0675\u0678\u01E4\xF3\u0676","\u0678\u01E2\xF2\u0677\u0674\u0677","\u0675\u0677\u0676\u0678","\u0684\u0679\u067A\u0296\u014C\u067A","\u067B\u024E\u0128\u067B\u067C\x07\xDE\u067C","\u067E\x07\u067D\u067F\xCCg\u067E","\u067D\u067F\u0680\u0680","\u067E\u0680\u0681\u0681","\u0682\u0682\u0683\x07\u0683","\u0685\u0684\u0679\u0684","\u0685\u0685\u0687\u0686","\u064D\u0686\u0660\u0687","\xCB\u0688\u0689\u021C\u010F\u0689","\u068A\x07\v\u068A\u068C\u0148\xA5\u068B","\u068D\x07 \u068C\u068B\u068C","\u068D\u068D\u06E9\u068E","\u068F\u01C6\xE4\u068F\u0690\x07\v\u0690","\u0692\u0148\xA5\u0691\u0693\x07 \u0692","\u0691\u0692\u0693\u0693","\u06E9\u0694\u0695\u01C4\xE3\u0695","\u0696\x07\v\u0696\u0698\u0148\xA5\u0697","\u0699\x07 \u0698\u0697\u0698","\u0699\u0699\u06E9\u069A","\u069B\u01C8\xE5\u069B\u069C\x07\v\u069C","\u069E\u0148\xA5\u069D\u069F\x07 \u069E","\u069D\u069E\u069F\u069F","\u06E9\u06A0\u06A1\u01CA\xE6\u06A1","\u06A2\x07\v\u06A2\u06A4\u0148\xA5\u06A3","\u06A5\x07 \u06A4\u06A3\u06A4","\u06A5\u06A5\u06E9\u06A6","\u06A7\u01CE\xE8\u06A7\u06A8\x07\v\u06A8","\u06AA\u0148\xA5\u06A9\u06AB\x07 \u06AA","\u06A9\u06AA\u06AB\u06AB","\u06E9\u06AC\u06AD\u01D4\xEB\u06AD","\u06AE\x07\v\u06AE\u06B0\u0148\xA5\u06AF","\u06B1\x07 \u06B0\u06AF\u06B0","\u06B1\u06B1\u06E9\u06B2","\u06B3\u01D6\xEC\u06B3\u06B4\x07\v\u06B4","\u06B6\u0148\xA5\u06B5\u06B7\x07 \u06B6","\u06B5\u06B6\u06B7\u06B7","\u06E9\u06B8\u06B9\u01DA\xEE\u06B9","\u06BA\x07\v\u06BA\u06BC\u0148\xA5\u06BB","\u06BD\x07 \u06BC\u06BB\u06BC","\u06BD\u06BD\u06E9\u06BE","\u06BF\u01D8\xED\u06BF\u06C0\x07\v\u06C0","\u06C2\u0148\xA5\u06C1\u06C3\x07 \u06C2","\u06C1\u06C2\u06C3\u06C3","\u06E9\u06C4\u06C5\u01CC\xE7\u06C5","\u06C6\x07\v\u06C6\u06C8\u0146\xA4\u06C7","\u06C9\x07 \u06C8\u06C7\u06C8","\u06C9\u06C9\u06E9\u06CA","\u06CB\u01DC\xEF\u06CB\u06CC\x07\v\u06CC","\u06CE\u0146\xA4\u06CD\u06CF\x07 \u06CE","\u06CD\u06CE\u06CF\u06CF","\u06E9\u06D0\u06D1\u01DE\xF0\u06D1","\u06D2\x07\v\u06D2\u06D4\u0146\xA4\u06D3","\u06D5\x07 \u06D4\u06D3\u06D4","\u06D5\u06D5\u06E9\u06D6","\u06D7\u01D2\xEA\u06D7\u06D8\x07\v\u06D8","\u06DA\u0146\xA4\u06D9\u06DB\x07 \u06DA","\u06D9\u06DA\u06DB\u06DB","\u06E9\u06DC\u06DD\u01D0\xE9\u06DD","\u06DE\x07\v\u06DE\u06E0\u0146\xA4\u06DF","\u06E1\x07 \u06E0\u06DF\u06E0","\u06E1\u06E1\u06E9\u06E2","\u06E3\u021E\u0110\u06E3\u06E4\x07\v\u06E4","\u06E6\u0146\xA4\u06E5\u06E7\x07 \u06E6","\u06E5\u06E6\u06E7\u06E7","\u06E9\u06E8\u0688\u06E8","\u068E\u06E8\u0694\u06E8","\u069A\u06E8\u06A0\u06E8","\u06A6\u06E8\u06AC\u06E8","\u06B2\u06E8\u06B8\u06E8","\u06BE\u06E8\u06C4\u06E8","\u06CA\u06E8\u06D0\u06E8","\u06D6\u06E8\u06DC\u06E8","\u06E2\u06E9\xCD\u06EA","\u06EB\u0198\xCD\u06EB\u06EC\u01C2\xE2\u06EC","\u06EE\u01BE\xE0\u06ED\u06EF\u0110\x89\u06EE","\u06ED\u06EE\u06EF\u06EF","\u06F0\u06F0\u06F4\u024C\u0127\u06F1","\u06F2\u014C\xA7\u06F2\u06F3\x07\u06F3","\u06F5\u06F4\u06F1\u06F4","\u06F5\u06F5\u06F6\u06F6","\u0711\u014E\xA8\u06F7\u06FB\x07\x91\u06F8","\u06F9\u01F8\xFD\u06F9\u06FA\xDAn\u06FA","\u06FC\u06FB\u06F8\u06FB","\u06FC\u06FC\u0703\u06FD","\u06FF\u0180\xC1\u06FE\u06FD\u06FE","\u06FF\u06FF\u0700\u0700","\u0701\u01FA\xFE\u0701\u0702\xD8m\u0702","\u0704\u0703\u06FE\u0703","\u0704\u0704\u0709\u0705","\u0707\u0180\xC1\u0706\u0705\u0706","\u0707\u0707\u0708\u0708","\u070A\xD0i\u0709\u0706\u0709","\u070A\u070A\u070F\u070B","\u070D\u0180\xC1\u070C\u070B\u070C","\u070D\u070D\u070E\u070E","\u0710\xD4k\u070F\u070C\u070F","\u0710\u0710\u0712\u0711","\u06F7\u0711\u0712\u0712","\xCF\u0713\u0714\u01FC\xFF\u0714","\u0719\x07\u0715\u0716\u01FE\u0100\u0716","\u0717\x07\v\u0717\u0718\u0142\xA2\u0718","\u071A\u0719\u0715\u0719","\u071A\u071A\u0722\u071B","\u071D\u02AC\u0157\u071C\u071B\u071C","\u071D\u071D\u071E\u071E","\u071F\u0200\u0101\u071F\u0720\x07\v\u0720","\u0721\u0146\xA4\u0721\u0723\u0722","\u071C\u0722\u0723\u0723","\u072B\u0724\u0726\u02AC\u0157\u0725","\u0724\u0725\u0726\u0726","\u0727\u0727\u0728\u0202\u0102\u0728","\u0729\x07\v\u0729\u072A\xD2j\u072A","\u072C\u072B\u0725\u072B","\u072C\u072C\u0734\u072D","\u072F\u02AC\u0157\u072E\u072D\u072E","\u072F\u072F\u0730\u0730","\u0731\u0204\u0103\u0731\u0732\x07\v\u0732","\u0733\u0142\xA2\u0733\u0735\u0734","\u072E\u0734\u0735\u0735","\u073D\u0736\u0738\u02AC\u0157\u0737","\u0736\u0737\u0738\u0738","\u0739\u0739\u073A\u0206\u0104\u073A","\u073B\x07\v\u073B\u073C\u0142\xA2\u073C","\u073E\u073D\u0737\u073D","\u073E\u073E\u0746\u073F","\u0741\u02AC\u0157\u0740\u073F\u0740","\u0741\u0741\u0742\u0742","\u0743\u0208\u0105\u0743\u0744\x07\v\u0744","\u0745\u0146\xA4\u0745\u0747\u0746","\u0740\u0746\u0747\u0747","\u074F\u0748\u074A\u02AC\u0157\u0749","\u0748\u0749\u074A\u074A","\u074B\u074B\u074C\u020A\u0106\u074C","\u074D\x07\v\u074D\u074E\u0142\xA2\u074E","\u0750\u074F\u0749\u074F","\u0750\u0750\u0758\u0751","\u0753\u02AC\u0157\u0752\u0751\u0752","\u0753\u0753\u0754\u0754","\u0755\u020C\u0107\u0755\u0756\x07\v\u0756","\u0757\u0142\xA2\u0757\u0759\u0758","\u0752\u0758\u0759\u0759","\u0761\u075A\u075C\u02AC\u0157\u075B","\u075A\u075B\u075C\u075C","\u075D\u075D\u075E\u020E\u0108\u075E","\u075F\x07\v\u075F\u0760\u0142\xA2\u0760","\u0762\u0761\u075B\u0761","\u0762\u0762\u076A\u0763","\u0765\u02AC\u0157\u0764\u0763\u0764","\u0765\u0765\u0766\u0766","\u0767\u0210\u0109\u0767\u0768\x07\v\u0768","\u0769\u0148\xA5\u0769\u076B\u076A","\u0764\u076A\u076B\u076B","\u076C\u076C\u076D\x07\u076D","\xD1\u076E\u0771\u0218\u010D\u076F","\u0771\u021A\u010E\u0770\u076E\u0770","\u076F\u0771\xD3\u0772","\u0773\u024E\u0128\u0773\u0778\x07\u0774","\u0775\u0212\u010A\u0775\u0776\x07\v\u0776","\u0777\u0148\xA5\u0777\u0779\u0778","\u0774\u0778\u0779\u0779","\u0781\u077A\u077C\u02AC\u0157\u077B","\u077A\u077B\u077C\u077C","\u077D\u077D\u077E\u0214\u010B\u077E","\u077F\x07\v\u077F\u0780\u0148\xA5\u0780","\u0782\u0781\u077B\u0781","\u0782\u0782\u078A\u0783","\u0785\u02AC\u0157\u0784\u0783\u0784","\u0785\u0785\u0786\u0786","\u0787\u0216\u010C\u0787\u0788\x07\v\u0788","\u0789\u0148\xA5\u0789\u078B\u078A","\u0784\u078A\u078B\u078B","\u078C\u078C\u078D\x07\u078D","\xD5\u078E\u0793\u01E8\xF5\u078F","\u0793\u01E6\xF4\u0790\u0793\u01EA\xF6\u0791","\u0793\u01EC\xF7\u0792\u078E\u0792","\u078F\u0792\u0790\u0792","\u0791\u0793\xD7\u0794","\u079A\xD6l\u0795\u0796\u02AC\u0157\u0796","\u0797\xD6l\u0797\u0799\u0798","\u0795\u0799\u079C\u079A","\u0798\u079A\u079B\u079B","\xD9\u079C\u079A\u079D","\u07A3\xDCo\u079E\u079F\u02AC\u0157\u079F","\u07A0\xDCo\u07A0\u07A2\u07A1","\u079E\u07A2\u07A5\u07A3","\u07A1\u07A3\u07A4\u07A4","\xDB\u07A5\u07A3\u07A6","\u07D3\u0150\xA9\u07A7\u07AC\x07\u07A8","\u07A9\u01EE\xF8\u07A9\u07AA\x07\v\u07AA","\u07AB\u0148\xA5\u07AB\u07AD\u07AC","\u07A8\u07AC\u07AD\u07AD","\u07B5\u07AE\u07B0\u02AC\u0157\u07AF","\u07AE\u07AF\u07B0\u07B0","\u07B1\u07B1\u07B2\u01F0\xF9\u07B2","\u07B3\x07\v\u07B3\u07B4\u0148\xA5\u07B4","\u07B6\u07B5\u07AF\u07B5","\u07B6\u07B6\u07BE\u07B7","\u07B9\u02AC\u0157\u07B8\u07B7\u07B8","\u07B9\u07B9\u07BA\u07BA","\u07BB\u01F2\xFA\u07BB\u07BC\x07\v\u07BC","\u07BD\u0148\xA5\u07BD\u07BF\u07BE","\u07B8\u07BE\u07BF\u07BF","\u07C7\u07C0\u07C2\u02AC\u0157\u07C1","\u07C0\u07C1\u07C2\u07C2","\u07C3\u07C3\u07C4\u01F4\xFB\u07C4","\u07C5\x07\v\u07C5\u07C6\u0148\xA5\u07C6","\u07C8\u07C7\u07C1\u07C7","\u07C8\u07C8\u07D0\u07C9","\u07CB\u02AC\u0157\u07CA\u07C9\u07CA","\u07CB\u07CB\u07CC\u07CC","\u07CD\u01F6\xFC\u07CD\u07CE\x07\v\u07CE","\u07CF\u0148\xA5\u07CF\u07D1\u07D0","\u07CA\u07D0\u07D1\u07D1","\u07D2\u07D2\u07D4\x07\u07D3","\u07A7\u07D3\u07D4\u07D4","\u0805\u07D5\u0802\x07\u07D6","\u07DB\x07\u07D7\u07D8\u01EE\xF8\u07D8","\u07D9\x07\v\u07D9\u07DA\u0148\xA5\u07DA","\u07DC\u07DB\u07D7\u07DB","\u07DC\u07DC\u07E4\u07DD","\u07DF\u02AC\u0157\u07DE\u07DD\u07DE","\u07DF\u07DF\u07E0\u07E0","\u07E1\u01F0\xF9\u07E1\u07E2\x07\v\u07E2","\u07E3\u0148\xA5\u07E3\u07E5\u07E4","\u07DE\u07E4\u07E5\u07E5","\u07ED\u07E6\u07E8\u02AC\u0157\u07E7","\u07E6\u07E7\u07E8\u07E8","\u07E9\u07E9\u07EA\u01F2\xFA\u07EA","\u07EB\x07\v\u07EB\u07EC\u0148\xA5\u07EC","\u07EE\u07ED\u07E7\u07ED","\u07EE\u07EE\u07F6\u07EF","\u07F1\u02AC\u0157\u07F0\u07EF\u07F0","\u07F1\u07F1\u07F2\u07F2","\u07F3\u01F4\xFB\u07F3\u07F4\x07\v\u07F4","\u07F5\u0148\xA5\u07F5\u07F7\u07F6","\u07F0\u07F6\u07F7\u07F7","\u07FF\u07F8\u07FA\u02AC\u0157\u07F9","\u07F8\u07F9\u07FA\u07FA","\u07FB\u07FB\u07FC\u01F6\xFC\u07FC","\u07FD\x07\v\u07FD\u07FE\u0148\xA5\u07FE","\u0800\u07FF\u07F9\u07FF","\u0800\u0800\u0801\u0801","\u0803\x07\u0802\u07D6\u0802","\u0803\u0803\u0805\u0804","\u07A6\u0804\u07D5\u0805","\xDD\u0806\u0809\u02B0\u0159\u0807","\u0809\u0146\xA4\u0808\u0806\u0808","\u0807\u0809\xDF\u080A","\u0810\u0150\xA9\u080B\u0810\xE2r\u080C","\u0810\xE4s\u080D\u0810\xE6t\u080E\u0810","\xE8u\u080F\u080A\u080F\u080B","\u080F\u080C\u080F\u080D","\u080F\u080E\u0810\xE1","\u0811\u0812\u022E\u0118\u0812\u0813","\u029C\u014F\u0813\u0814\u0150\xA9\u0814\u0815","\u029E\u0150\u0815\xE3\u0816\u0817","\u01A6\xD4\u0817\u0818\u029C\u014F\u0818\u0819","\u0150\xA9\u0819\u081A\u029E\u0150\u081A\xE5","\u081B\u081C\u01B2\xDA\u081C\u081D","\u029C\u014F\u081D\u081E\u0150\xA9\u081E\u081F","\u029E\u0150\u081F\xE7\u0820\u0821","\u0290\u0149\u0821\u0822\u029C\u014F\u0822\u0823","\u0150\xA9\u0823\u0824\u029E\u0150\u0824\xE9","\u0825\u0827\xBA^\u0826\u0825","\u0826\u0827\u0827\u0828","\u0828\u082A\u019A\xCE\u0829\u082B","\xECw\u082A\u0829\u082A\u082B","\u082B\u082C\u082C\u082E","\u0124\x93\u082D\u082F\u010E\x88\u082E\u082D","\u082E\u082F\u082F\u0830","\u0830\u0833\u012C\x97\u0831\u0834","\u0112\x8A\u0832\u0834\xF2z\u0833\u0831","\u0833\u0832\u0833\u0834","\u0834\xEB\u0835\u083B","\xEEx\u0836\u0837\u02AC\u0157\u0837\u0838","\xEEx\u0838\u083A\u0839\u0836","\u083A\u083D\u083B\u0839","\u083B\u083C\u083C\xED","\u083D\u083B\u083E\u0848","\u02B0\u0159\u083F\u0840\u02B0\u0159\u0840\u0843","\x07\x07\u0841\u0844\u0146\xA4\u0842\u0844","\u0142\xA2\u0843\u0841\u0843\u0842","\u0844\u0845\u0845\u0846","\x07\b\u0846\u0848\u0847\u083E","\u0847\u083F\u0848\xEF","\u0849\u084B\xBA^\u084A\u0849","\u084A\u084B\u084B\u084C","\u084C\u0850\u0286\u0144\u084D\u084E","\u014C\xA7\u084E\u084F\x07\u084F\u0851","\u0850\u084D\u0850\u0851","\u0851\u0852\u0852\u0854","\u014E\xA8\u0853\u0855\u0108\x85\u0854\u0853","\u0854\u0855\u0855\u0856","\u0856\u0857\u026C\u0137\u0857\u0858","\xF8}\u0858\u085B\u012C\x97\u0859\u085C","\u0112\x8A\u085A\u085C\xF2z\u085B\u0859","\u085B\u085A\u085B\u085C","\u085C\xF1\u085D\u085E","\u01BA\xDE\u085E\u085F\xF4{\u085F\xF3","\u0860\u0866\xF6|\u0861\u0862","\u0180\xC1\u0862\u0863\xF6|\u0863\u0865","\u0864\u0861\u0865\u0868","\u0866\u0864\u0866\u0867","\u0867\xF5\u0868\u0866","\u0869\u086A\u02B0\u0159\u086A\u086B","\x07\xDE\u086B\u086C\u0140\xA1\u086C\xF7","\u086D\u0873\xFA~\u086E\u086F","\u02AC\u0157\u086F\u0870\xFA~\u0870\u0872","\u0871\u086E\u0872\u0875","\u0873\u0871\u0873\u0874","\u0874\xF9\u0875\u0873","\u0876\u0877\u02B0\u0159\u0877\u087C","\x07\xDE\u0878\u087D\u0140\xA1\u0879\u087D","\xFE\x80\u087A\u087D\xFC\x7F\u087B\u087D","\u0102\x82\u087C\u0878\u087C\u0879","\u087C\u087A\u087C\u087B","\u087D\u08B0\u087E\u087F","\u02B0\u0159\u087F\u0880\x07\xDE\u0880\u0881","\u02B0\u0159\u0881\u0882 \u0882\u0883","\u0142\xA2\u0883\u08B0\u0884\u0885","\u02B0\u0159\u0885\u0886\x07\xDE\u0886\u0887","\u02B0\u0159\u0887\u0888 \u0888\u0889","\xFC\x7F\u0889\u08B0\u088A\u088B","\u02B0\u0159\u088B\u088C\x07\xDE\u088C\u088D","\xFC\x7F\u088D\u088E \u088E\u088F","\u02B0\u0159\u088F\u08B0\u0890\u0891","\u02B0\u0159\u0891\u0892\x07\xDE\u0892\u0893","\u02B0\u0159\u0893\u0894 \u0894\u0895","\xFE\x80\u0895\u08B0\u0896\u0897","\u02B0\u0159\u0897\u0898\x07\xDE\u0898\u0899","\xFE\x80\u0899\u089A \u089A\u089B","\u02B0\u0159\u089B\u08B0\u089C\u089D","\u02B0\u0159\u089D\u089E\x07\xDE\u089E\u089F","\u02B0\u0159\u089F\u08A0 \u08A0\u08A1","\u0102\x82\u08A1\u08B0\u08A2\u08A3","\u02B0\u0159\u08A3\u08A4\x07\xDE\u08A4\u08A5","\u0102\x82\u08A5\u08A6 \u08A6\u08A7","\u02B0\u0159\u08A7\u08B0\u08A8\u08A9","\u02B0\u0159\u08A9\u08AA\u02A8\u0155\u08AA\u08AB","\u0142\xA2\u08AB\u08AC\u02AA\u0156\u08AC\u08AD","\x07\xDE\u08AD\u08AE\u0140\xA1\u08AE\u08B0","\u08AF\u0876\u08AF\u087E","\u08AF\u0884\u08AF\u088A","\u08AF\u0890\u08AF\u0896","\u08AF\u089C\u08AF\u08A2","\u08AF\u08A8\u08B0\xFB","\u08B1\u08BB\u02A0\u0151\u08B2\u08B8","\u0140\xA1\u08B3\u08B4\u02AC\u0157\u08B4\u08B5","\u011C\x8F\u08B5\u08B7\u08B6\u08B3","\u08B7\u08BA\u08B8\u08B6","\u08B8\u08B9\u08B9\u08BC","\u08BA\u08B8\u08BB\u08B2","\u08BB\u08BC\u08BC\u08BD","\u08BD\u08BE\u02A2\u0152\u08BE\xFD","\u08BF\u08C0\u02A0\u0151\u08C0\u08C1","\u0140\xA1\u08C1\u08C2\u02AE\u0158\u08C2\u08C3","\u011C\x8F\u08C3\u08CB\u08C4\u08C5","\u02AC\u0157\u08C5\u08C6\u0140\xA1\u08C6\u08C7","\u02AE\u0158\u08C7\u08C8\u011C\x8F\u08C8\u08CA","\u08C9\u08C4\u08CA\u08CD","\u08CB\u08C9\u08CB\u08CC","\u08CC\u08CE\u08CD\u08CB","\u08CE\u08CF\u02A2\u0152\u08CF\xFF","\u08D0\u08D1\u02A0\u0151\u08D1\u08D7","\u011C\x8F\u08D2\u08D3\u02AC\u0157\u08D3\u08D4","\u011C\x8F\u08D4\u08D6\u08D5\u08D2","\u08D6\u08D9\u08D7\u08D5","\u08D7\u08D8\u08D8\u08DA","\u08D9\u08D7\u08DA\u08DB","\u02A2\u0152\u08DB\u0101\u08DC\u08DD","\u02A8\u0155\u08DD\u08E3\u0140\xA1\u08DE\u08DF","\u02AC\u0157\u08DF\u08E0\u011C\x8F\u08E0\u08E2","\u08E1\u08DE\u08E2\u08E5","\u08E3\u08E1\u08E3\u08E4","\u08E4\u08E6\u08E5\u08E3","\u08E6\u08E7\u02AA\u0156\u08E7\u0103","\u08E8\u0905\u029C\u014F\u08E9\u08FA","\u011C\x8F\u08EA\u08EB\u02AC\u0157\u08EB\u08EC","\u011C\x8F\u08EC\u08EE\u08ED\u08EA","\u08EE\u08F1\u08EF\u08ED","\u08EF\u08F0\u08F0\u08FB","\u08F1\u08EF\u08F2\u08F3","\u02AC\u0157\u08F3\u08F4\u0104\x83\u08F4\u08F6","\u08F5\u08F2\u08F6\u08F9","\u08F7\u08F5\u08F7\u08F8","\u08F8\u08FB\u08F9\u08F7","\u08FA\u08EF\u08FA\u08F7","\u08FB\u0906\u08FC\u0902","\u0104\x83\u08FD\u08FE\u02AC\u0157\u08FE\u08FF","\u0104\x83\u08FF\u0901\u0900\u08FD","\u0901\u0904\u0902\u0900","\u0902\u0903\u0903\u0906","\u0904\u0902\u0905\u08E9","\u0905\u08FC\u0906\u0907","\u0907\u0908\u029E\u0150\u0908\u0105","\u0909\u090B\xBA^\u090A\u0909","\u090A\u090B\u090B\u090C","\u090C\u090D\u0224\u0113\u090D\u0911","\u0226\u0114\u090E\u090F\u014C\xA7\u090F\u0910","\x07\u0910\u0912\u0911\u090E","\u0911\u0912\u0912\u0913","\u0913\u0915\u014E\xA8\u0914\u0916","\u0116\x8C\u0915\u0914\u0915\u0916","\u0916\u0917\u0917\u0919","\u0114\x8B\u0918\u091A\u0110\x89\u0919\u0918","\u0919\u091A\u091A\u091C","\u091B\u091D\u0108\x85\u091C\u091B","\u091C\u091D\u091D\u0107","\u091E\u091F\u028E\u0148\u091F\u0920","\u010C\x87\u0920\u092F\u0921\u0922","\u028E\u0148\u0922\u0923\u010C\x87\u0923\u0924","\u0180\xC1\u0924\u0925\u010A\x86\u0925\u092F","\u0926\u0927\u028E\u0148\u0927\u0928","\u010A\x86\u0928\u092F\u0929\u092A","\u028E\u0148\u092A\u092B\u010A\x86\u092B\u092C","\u0180\xC1\u092C\u092D\u010C\x87\u092D\u092F","\u092E\u091E\u092E\u0921","\u092E\u0926\u092E\u0929","\u092F\u0109\u0930\u0931","\u0278\u013D\u0931\u0932\u0142\xA2\u0932\u010B","\u0933\u0934\u0280\u0141\u0934\u0935","\u0142\xA2\u0935\u010D\u0936\u0937","\u028E\u0148\u0937\u0938\u010A\x86\u0938\u010F","\u0939\u093A\u01BA\xDE\u093A\u093B","\u0246\u0124\u093B\u093C\u01AA\xD6\u093C\u0111","\u093D\u093E\u01BA\xDE\u093E\u093F","\u01AA\xD6\u093F\u0113\u0940\u0941","\u0290\u0149\u0941\u0942\x07\u0942\u0943","\u011A\x8E\u0943\u0944\x07\u0944\u0949","\u0945\u0946\u022A\u0116\u0946\u0947","\u0140\xA1\u0947\u0949\u0948\u0940","\u0948\u0945\u0949\u0115","\u094A\u094B\x07\u094B\u094C","\u0118\x8D\u094C\u094D\x07\u094D\u0117","\u094E\u0954\u0150\xA9\u094F\u0950","\u02AC\u0157\u0950\u0951\u0150\xA9\u0951\u0953","\u0952\u094F\u0953\u0956","\u0954\u0952\u0954\u0955","\u0955\u0119\u0956\u0954","\u0957\u095D\u011C\x8F\u0958\u0959","\u02AC\u0157\u0959\u095A\u011C\x8F\u095A\u095C","\u095B\u0958\u095C\u095F","\u095D\u095B\u095D\u095E","\u095E\u011B\u095F\u095D","\u0960\u0967\u0140\xA1\u0961\u0967","\xFE\x80\u0962\u0967\xFC\x7F\u0963\u0967","\u0102\x82\u0964\u0967\u0104\x83\u0965\u0967","\u0100\x81\u0966\u0960\u0966\u0961","\u0966\u0962\u0966\u0963","\u0966\u0964\u0966\u0965","\u0967\u011D\u0968\u096A","\u026A\u0136\u0969\u096B\u012E\x98\u096A\u0969","\u096A\u096B\u096B\u096D","\u096C\u096E\u022A\u0116\u096D\u096C","\u096D\u096E\u096E\u096F","\u096F\u0970\u0130\x99\u0970\u0972","\u0124\x93\u0971\u0973\u012C\x97\u0972\u0971","\u0972\u0973\u0973\u0975","\u0974\u0976\u0128\x95\u0975\u0974","\u0975\u0976\u0976\u0978","\u0977\u0979\u0122\x92\u0978\u0977","\u0978\u0979\u0979\u097B","\u097A\u097C\u0120\x91\u097B\u097A","\u097B\u097C\u097C\u011F","\u097D\u097E\u017C\xBF\u097E\u097F","\u01AC\xD7\u097F\u0121\u0980\u0981","\u0236\u011C\u0981\u0982\u0142\xA2\u0982\u0123","\u0983\u0984\u01B0\xD9\u0984\u0985","\u0126\x94\u0985\u0125\u0986\u098C","\u02B0\u0159\u0987\u0988\u02B0\u0159\u0988\u0989","\x07\u0989\u098A\u02B0\u0159\u098A\u098C","\u098B\u0986\u098B\u0987","\u098C\u0127\u098D\u098E","\u0252\u012A\u098E\u098F\u018E\xC8\u098F\u0990","\u012A\x96\u0990\u0129\u0991\u0994","\u02B0\u0159\u0992\u0995\u0186\xC4\u0993\u0995","\u019C\xCF\u0994\u0992\u0994\u0993","\u0994\u0995\u0995\u012B","\u0996\u0997\u0294\u014B\u0997\u0998","\u0134\x9B\u0998\u012D\u0999\u099A","\u01A0\xD1\u099A\u012F\u099B\u099E","\x07\u099C\u099E\u0132\x9A\u099D\u099B","\u099D\u099C\u099E\u09A4","\u099F\u09A0\u02AC\u0157\u09A0\u09A1","\u0132\x9A\u09A1\u09A3\u09A2\u099F","\u09A3\u09A6\u09A4\u09A2","\u09A4\u09A5\u09A5\u0131","\u09A6\u09A4\u09A7\u09A8","\u02B0\u0159\u09A8\u09A9\x07\u09A9\u09AA","\x07\u09AA\u09B8\u09AB\u09AF","\u02B0\u0159\u09AC\u09AD\u0184\xC3\u09AD\u09AE","\u02B0\u0159\u09AE\u09B0\u09AF\u09AC","\u09AF\u09B0\u09B0\u09B8","\u09B1\u09B5\u013C\x9F\u09B2\u09B3","\u0184\xC3\u09B3\u09B4\u02B0\u0159\u09B4\u09B6","\u09B5\u09B2\u09B5\u09B6","\u09B6\u09B8\u09B7\u09A7","\u09B7\u09AB\u09B7\u09B1","\u09B8\u0133\u09B9\u09BF","\u0136\x9C\u09BA\u09BB\u0180\xC1\u09BB\u09BC","\u0136\x9C\u09BC\u09BE\u09BD\u09BA","\u09BE\u09C1\u09BF\u09BD","\u09BF\u09C0\u09C0\u0135","\u09C1\u09BF\u09C2\u09C3","\u02B0\u0159\u09C3\u09C4 \u09C4\u09C5","\u0140\xA1\u09C5\u0A0C\u09C6\u09C7","\u02B0\u0159\u09C7\u09C8\x07\u09C8\u09C9","\u02B0\u0159\u09C9\u09CA \u09CA\u09CB","\u0140\xA1\u09CB\u0A0C\u09CC\u09CD","\u013C\x9F\u09CD\u09CE \u09CE\u09CF","\u0140\xA1\u09CF\u0A0C\u09D0\u09D1","\u013C\x9F\u09D1\u09D2 \u09D2\u09D3","\u013C\x9F\u09D3\u0A0C\u09D4\u09D5","\u02B0\u0159\u09D5\u09D6\u01BC\xDF\u09D6\u09D8","\x07\u09D7\u09D9\u013E\xA0\u09D8\u09D7","\u09D8\u09D9\u09D9\u09DA","\u09DA\u09DB\x07\u09DB\u0A0C","\u09DC\u09DD\x07\u09DD\u09E3","\u02B0\u0159\u09DE\u09DF\u02AC\u0157\u09DF\u09E0","\u02B0\u0159\u09E0\u09E2\u09E1\u09DE","\u09E2\u09E5\u09E3\u09E1","\u09E3\u09E4\u09E4\u09E6","\u09E5\u09E3\u09E6\u09E7","\x07\u09E7\u09E8\u01BC\xDF\u09E8\u09E9","\x07\u09E9\u09EF\u0104\x83\u09EA\u09EB","\u02AC\u0157\u09EB\u09EC\u0104\x83\u09EC\u09EE","\u09ED\u09EA\u09EE\u09F1","\u09EF\u09ED\u09EF\u09F0","\u09F0\u09F2\u09F1\u09EF","\u09F2\u09F3\x07\u09F3\u0A0C","\u09F4\u09F5\x07\u09F5\u09FB","\u02B0\u0159\u09F6\u09F7\u02AC\u0157\u09F7\u09F8","\u02B0\u0159\u09F8\u09FA\u09F9\u09F6","\u09FA\u09FD\u09FB\u09F9","\u09FB\u09FC\u09FC\u09FE","\u09FD\u09FB\u09FE\u09FF","\x07\u09FF\u0A00 \u0A00\u0A06","\u0104\x83\u0A01\u0A02\u02AC\u0157\u0A02\u0A03","\u0104\x83\u0A03\u0A05\u0A04\u0A01","\u0A05\u0A08\u0A06\u0A04","\u0A06\u0A07\u0A07\u0A0C","\u0A08\u0A06\u0A09\u0A0C","\u013A\x9E\u0A0A\u0A0C\u0138\x9D\u0A0B\u09C2","\u0A0B\u09C6\u0A0B\u09CC","\u0A0B\u09D0\u0A0B\u09D4","\u0A0B\u09DC\u0A0B\u09F4","\u0A0B\u0A09\u0A0B\u0A0A","\u0A0C\u0137\u0A0D\u0A0E","\u02B0\u0159\u0A0E\u0A0F\u0196\xCC\u0A0F\u0A10","\u0140\xA1\u0A10\u0139\u0A11\u0A12","\u02B0\u0159\u0A12\u0A13\u0196\xCC\u0A13\u0A14","\u022C\u0117\u0A14\u0A15\u0A15\u0A16","\u0140\xA1\u0A16\u013B\u0A17\u0A18","\u02B0\u0159\u0A18\u0A19\x07\u0A19\u0A1A","\x07\u0A1A\u0A1B\x07\u0A1B\u0A24","\u0A1C\u0A1D\u02B0\u0159\u0A1D\u0A1F","\x07\u0A1E\u0A20\u013E\xA0\u0A1F\u0A1E","\u0A1F\u0A20\u0A20\u0A21","\u0A21\u0A22\x07\u0A22\u0A24","\u0A23\u0A17\u0A23\u0A1C","\u0A24\u013D\u0A25\u0A29","\u0140\xA1\u0A26\u0A29\u02B0\u0159\u0A27\u0A29","\u013C\x9F\u0A28\u0A25\u0A28\u0A26","\u0A28\u0A27\u0A29\u0A32","\u0A2A\u0A2E\u02AC\u0157\u0A2B\u0A2F","\u0140\xA1\u0A2C\u0A2F\u02B0\u0159\u0A2D\u0A2F","\u013C\x9F\u0A2E\u0A2B\u0A2E\u0A2C","\u0A2E\u0A2D\u0A2F\u0A31","\u0A30\u0A2A\u0A31\u0A34","\u0A32\u0A30\u0A32\u0A33","\u0A33\u013F\u0A34\u0A32","\u0A35\u0A3F\x07\xDD\u0A36\u0A3F","\u0146\xA4\u0A37\u0A3F\u0142\xA2\u0A38\u0A3F","\u0144\xA3\u0A39\u0A3F\u014A\xA6\u0A3A\u0A3F","\u0148\xA5\u0A3B\u0A3F2\u0A3C\u0A3F","\u0248\u0125\u0A3D\u0A3F\u02B0\u0159\u0A3E\u0A35","\u0A3E\u0A36\u0A3E\u0A37","\u0A3E\u0A38\u0A3E\u0A39","\u0A3E\u0A3A\u0A3E\u0A3B","\u0A3E\u0A3C\u0A3E\u0A3D","\u0A3F\u0141\u0A40\u0A41","\x07\xD8\u0A41\u0143\u0A42\u0A43"," \u0A43\u0145\u0A44\u0A45","\x07\xD7\u0A45\u0147\u0A46\u0A47"," \u0A47\u0149\u0A48\u0A49","\x07\xDA\u0A49\u014B\u0A4A\u0A50","\u02B0\u0159\u0A4B\u0A4C\x07\u0A4C\u0A4D","\u02B0\u0159\u0A4D\u0A4E\x07\u0A4E\u0A50","\u0A4F\u0A4A\u0A4F\u0A4B","\u0A50\u014D\u0A51\u0A57","\u02B0\u0159\u0A52\u0A53\x07\u0A53\u0A54","\u02B0\u0159\u0A54\u0A55\x07\u0A55\u0A57","\u0A56\u0A51\u0A56\u0A52","\u0A57\u014F\u0A58\u0A5E","\u02B0\u0159\u0A59\u0A5A\x07\u0A5A\u0A5B","\u02B0\u0159\u0A5B\u0A5C\x07\u0A5C\u0A5E","\u0A5D\u0A58\u0A5D\u0A59","\u0A5E\u0151\u0A5F\u0A61","\u0154\xAB\u0A60\u0A62\u0156\xAC\u0A61\u0A60","\u0A61\u0A62\u0A62\u0153","\u0A63\u0A64\u014C\xA7\u0A64\u0A65","\x07\u0A65\u0A67\u0A66\u0A63","\u0A66\u0A67\u0A67\u0A68","\u0A68\u0A86\u0162\xB2\u0A69\u0A86","\x07\xD7\u0A6A\u0A86\x07\x7F\u0A6B\u0A86","\x07w\u0A6C\u0A86\x07\x93\u0A6D\u0A86","\x07\xC1\u0A6E\u0A86\x07\xC2\u0A6F\u0A86","\x07\xC3\u0A70\u0A86\x07\xC4\u0A71\u0A86","\x07\xC5\u0A72\u0A86\x07\xC6\u0A73\u0A86","\x07\xC7\u0A74\u0A86\x07\xC8\u0A75\u0A86","\x07\xC9\u0A76\u0A86\x07\xCA\u0A77\u0A86","\x07\xCB\u0A78\u0A86\x07\xCC\u0A79\u0A86","\x07\xCD\u0A7A\u0A86\x07\xCE\u0A7B\u0A86","\x07\xCF\u0A7C\u0A86\x07\xD1\u0A7D\u0A86","\x07\xD0\u0A7E\u0A86\x07\xD2\u0A7F\u0A86","\x07\xD3\u0A80\u0A86\x07\xD4\u0A81\u0A86","\x07\xD5\u0A82\u0A86\x07\x7F\u0A83\u0A86","\x07\x8D\u0A84\u0A86\x07\xE4\u0A85\u0A66","\u0A85\u0A69\u0A85\u0A6A","\u0A85\u0A6B\u0A85\u0A6C","\u0A85\u0A6D\u0A85\u0A6E","\u0A85\u0A6F\u0A85\u0A70","\u0A85\u0A71\u0A85\u0A72","\u0A85\u0A73\u0A85\u0A74","\u0A85\u0A75\u0A85\u0A76","\u0A85\u0A77\u0A85\u0A78","\u0A85\u0A79\u0A85\u0A7A","\u0A85\u0A7B\u0A85\u0A7C","\u0A85\u0A7D\u0A85\u0A7E","\u0A85\u0A7F\u0A85\u0A80","\u0A85\u0A81\u0A85\u0A82","\u0A85\u0A83\u0A85\u0A84","\u0A86\u0155\u0A87\u0A88","\u02A4\u0153\u0A88\u0A90\u0152\xAA\u0A89\u0A8C","\u02AC\u0157\u0A8A\u0A8D\u0152\xAA\u0A8B\u0A8D","\u0142\xA2\u0A8C\u0A8A\u0A8C\u0A8B","\u0A8D\u0A8F\u0A8E\u0A89","\u0A8F\u0A92\u0A90\u0A8E","\u0A90\u0A91\u0A91\u0A93","\u0A92\u0A90\u0A93\u0A94","\u02A6\u0154\u0A94\u0157\u0A95\u0A98","\u0186\xC4\u0A96\u0A98\u019C\xCF\u0A97\u0A95","\u0A97\u0A96\u0A98\u0159","\u0A99\u0A9A\u02B0\u0159\u0A9A\u015B","\u0A9B\u0A9C\u02B0\u0159\u0A9C\u015D","\u0A9D\u0A9E\u0146\xA4\u0A9E\u015F","\u0A9F\u0AA0\u02B0\u0159\u0AA0\u0161","\u0AA1\u0AA2\u02B0\u0159\u0AA2\u0163","\u0AA3\u0AA4\u02B0\u0159\u0AA4\u0165","\u0AA5\u0AA6\u02B0\u0159\u0AA6\u0167","\u0AA7\u0AA8\u02B0\u0159\u0AA8\u0169","\u0AA9\u0AAA\u02B0\u0159\u0AAA\u016B","\u0AAB\u0AAC\u0146\xA4\u0AAC\u016D","\u0AAD\u0AAE\u02B0\u0159\u0AAE\u016F","\u0AAF\u0AB0\u0172\xBA\u0AB0\u0AB1","\u0152\xAA\u0AB1\u0171\u0AB2\u0AB3","\u02B0\u0159\u0AB3\u0173\u0AB4\u0AB5","\x07\u0AB5\u0175\u0AB6\u0AB7","\x07\u0AB7\u0177\u0AB8\u0AB9","\x07\x1B\u0AB9\u0179\u0ABA\u0ABB","\x07\x1B\u0ABB\u0ABC\x07h\u0ABC\u017B","\u0ABD\u0ABE\x07\u0ABE\u017D","\u0ABF\u0AC0\x07\u0AC0\u017F","\u0AC1\u0AC2\x07\u0AC2\u0181","\u0AC3\u0AC4\x07 \u0AC4\u0183","\u0AC5\u0AC6\x07!\u0AC6\u0185",'\u0AC7\u0AC8\x07"\u0AC8\u0187',"\u0AC9\u0ACA\x07#\u0ACA\u0189","\u0ACB\u0ACC\x07$\u0ACC\u018B","\u0ACD\u0ACE\x07%\u0ACE\u018D","\u0ACF\u0AD0\x07&\u0AD0\u018F","\u0AD1\u0AD2\x07'\u0AD2\u0191","\u0AD3\u0AD4\x07(\u0AD4\u0193","\u0AD5\u0AD6\x07*\u0AD6\u0195","\u0AD7\u0AD8\x07,\u0AD8\u0197","\u0AD9\u0ADA\x07-\u0ADA\u0199","\u0ADB\u0ADC\x070\u0ADC\u019B","\u0ADD\u0ADE\x071\u0ADE\u019D","\u0ADF\u0AE0\x072\u0AE0\u019F","\u0AE1\u0AE2\x073\u0AE2\u01A1","\u0AE3\u0AE4\x074\u0AE4\u01A3","\u0AE5\u0AE6\x075\u0AE6\u01A5","\u0AE7\u0AE8\x077\u0AE8\u01A7","\u0AE9\u0AEA\x078\u0AEA\u01A9","\u0AEB\u0AEC\x079\u0AEC\u01AB","\u0AED\u0AEE\x07;\u0AEE\u01AD","\u0AEF\u0AF0\x07<\u0AF0\u01AF","\u0AF1\u0AF2\x07=\u0AF2\u01B1","\u0AF3\u0AF4\x07>\u0AF4\u01B3","\u0AF5\u0AF6\x07?\u0AF6\u01B5","\u0AF7\u0AF8\x07@\u0AF8\u01B7","\u0AF9\u0AFA\x07A\u0AFA\u01B9","\u0AFB\u0AFC\x07B\u0AFC\u01BB","\u0AFD\u0AFE\x07C\u0AFE\u01BD","\u0AFF\u0B00\x07D\u0B00\u01BF","\u0B01\u0B02\x07.\u0B02\u01C1","\u0B03\u0B04\x07/\u0B04\u01C3","\u0B05\u0B06\x07\x93\u0B06\u01C5","\u0B07\u0B08\x07\x95\u0B08\u01C7","\u0B09\u0B0A\x07\x97\u0B0A\u01C9","\u0B0B\u0B0C\x07\x98\u0B0C\u01CB","\u0B0D\u0B0E\x07\x99\u0B0E\u01CD","\u0B0F\u0B10\x07\x9A\u0B10\u01CF","\u0B11\u0B12\x07\x9B\u0B12\u01D1","\u0B13\u0B14\x07\x9C\u0B14\u01D3","\u0B15\u0B16\x07\x9D\u0B16\u01D5","\u0B17\u0B18\x07\x9E\u0B18\u01D7","\u0B19\u0B1A\x07\x9F\u0B1A\u01D9","\u0B1B\u0B1C\x07\xA0\u0B1C\u01DB","\u0B1D\u0B1E\x07\xA1\u0B1E\u01DD","\u0B1F\u0B20\x07\xA2\u0B20\u01DF","\u0B21\u0B22\x07\xA3\u0B22\u01E1","\u0B23\u0B24\x07\xA5\u0B24\u01E3","\u0B25\u0B26\x07\xA4\u0B26\u01E5","\u0B27\u0B28\x07\xA6\u0B28\u01E7","\u0B29\u0B2A\x07\xA7\u0B2A\u01E9","\u0B2B\u0B2C\x07\xA8\u0B2C\u01EB","\u0B2D\u0B2E\x07\xA9\u0B2E\u01ED","\u0B2F\u0B30\x07\xAB\u0B30\u01EF","\u0B31\u0B32\x07\xAA\u0B32\u01F1","\u0B33\u0B34\x07\xAC\u0B34\u01F3","\u0B35\u0B36\x07\xAD\u0B36\u01F5","\u0B37\u0B38\x07\xAE\u0B38\u01F7","\u0B39\u0B3A\x07\xAF\u0B3A\u01F9","\u0B3B\u0B3C\x07\xB0\u0B3C\u01FB","\u0B3D\u0B3E\x07\xB1\u0B3E\u01FD","\u0B3F\u0B40\x07\xB2\u0B40\u01FF","\u0B41\u0B42\x07\xB3\u0B42\u0201","\u0B43\u0B44\x07\xB4\u0B44\u0203","\u0B45\u0B46\x07\xB5\u0B46\u0205","\u0B47\u0B48\x07\xB6\u0B48\u0207","\u0B49\u0B4A\x07\xB7\u0B4A\u0209","\u0B4B\u0B4C\x07\xB8\u0B4C\u020B","\u0B4D\u0B4E\x07\xB9\u0B4E\u020D","\u0B4F\u0B50\x07\xBA\u0B50\u020F","\u0B51\u0B52\x07\xBB\u0B52\u0211","\u0B53\u0B54\x07\xBC\u0B54\u0213","\u0B55\u0B56\x07\xBD\u0B56\u0215","\u0B57\u0B58\x07\xBE\u0B58\u0217","\u0B59\u0B5A\x07\xBF\u0B5A\u0219","\u0B5B\u0B5C\x07\xC0\u0B5C\u021B","\u0B5D\u0B5E\x07\x94\u0B5E\u021D","\u0B5F\u0B60\x07\x96\u0B60\u021F","\u0B61\u0B62\x07F\u0B62\u0221","\u0B63\u0B64\x07G\u0B64\u0223","\u0B65\u0B66\x07H\u0B66\u0225","\u0B67\u0B68\x07I\u0B68\u0227","\u0B69\u0B6A\x07J\u0B6A\u0229","\u0B6B\u0B6C\x07K\u0B6C\u022B","\u0B6D\u0B6E\x07L\u0B6E\u022D","\u0B6F\u0B70\x07M\u0B70\u022F","\u0B71\u0B72\x07N\u0B72\u0231","\u0B73\u0B74\x07O\u0B74\u0233","\u0B75\u0B76\x07P\u0B76\u0235","\u0B77\u0B78\x07R\u0B78\u0237","\u0B79\u0B7A\x07\xCC\u0B7A\u0239","\u0B7B\u0B7C\x07U\u0B7C\u023B","\u0B7D\u0B7E\x07V\u0B7E\u023D","\u0B7F\u0B80\x07W\u0B80\u023F","\u0B81\u0B82\x07X\u0B82\u0241","\u0B83\u0B84\x07[\u0B84\u0243","\u0B85\u0B86\x07Z\u0B86\u0245","\u0B87\u0B88\x07\\\u0B88\u0247","\u0B89\u0B8A\x07]\u0B8A\u0249","\u0B8B\u0B8C\x07^\u0B8C\u024B","\u0B8D\u0B8E\x07_\u0B8E\u024D","\u0B8F\u0B90\x07a\u0B90\u024F","\u0B91\u0B92\x07b\u0B92\u0251","\u0B93\u0B94\x07c\u0B94\u0253","\u0B95\u0B96\x07e\u0B96\u0255","\u0B97\u0B98\x07i\u0B98\u0257","\u0B99\u0B9A\x07k\u0B9A\u0259","\u0B9B\u0B9C\x07l\u0B9C\u025B","\u0B9D\u0B9E\x07m\u0B9E\u025D","\u0B9F\u0BA0\x07n\u0BA0\u025F","\u0BA1\u0BA2\x07p\u0BA2\u0261","\u0BA3\u0BA4\x07r\u0BA4\u0263","\u0BA5\u0BA6\x07s\u0BA6\u0265","\u0BA7\u0BA8\x07t\u0BA8\u0267","\u0BA9\u0BAA\x07q\u0BAA\u0269","\u0BAB\u0BAC\x07v\u0BAC\u026B","\u0BAD\u0BAE\x07w\u0BAE\u026D","\u0BAF\u0BB0\x07x\u0BB0\u026F","\u0BB1\u0BB2\x07z\u0BB2\u0271","\u0BB3\u0BB4\x07{\u0BB4\u0273","\u0BB5\u0BB6\x07|\u0BB6\u0275","\u0BB7\u0BB8\x07}\u0BB8\u0277","\u0BB9\u0BBA\x07\x7F\u0BBA\u0279","\u0BBB\u0BBC\x07\x80\u0BBC\u027B","\u0BBD\u0BBE\x07\x82\u0BBE\u027D","\u0BBF\u0BC0\x07\x84\u0BC0\u027F","\u0BC1\u0BC2\x07\x85\u0BC2\u0281","\u0BC3\u0BC4\x07\x87\u0BC4\u0283","\u0BC5\u0BC6\x07\x88\u0BC6\u0285","\u0BC7\u0BC8\x07\x89\u0BC8\u0287","\u0BC9\u0BCA\x07\x8A\u0BCA\u0289","\u0BCB\u0BCC\x07\x8B\u0BCC\u028B","\u0BCD\u0BCE\x07\xE3\u0BCE\u028D","\u0BCF\u0BD0\x07\x8C\u0BD0\u028F","\u0BD1\u0BD2\x07\x8E\u0BD2\u0291","\u0BD3\u0BD4\x07\x8F\u0BD4\u0293","\u0BD5\u0BD6\x07\x90\u0BD6\u0295","\u0BD7\u0BD8\x07\x91\u0BD8\u0297","\u0BD9\u0BDA\x07o\u0BDA\u0299","\u0BDB\u0BDC\x07\u0BDC\u029B","\u0BDD\u0BDE\x07\u0BDE\u029D","\u0BDF\u0BE0\x07\u0BE0\u029F","\u0BE1\u0BE2\x07\u0BE2\u02A1","\u0BE3\u0BE4\x07\u0BE4\u02A3","\u0BE5\u0BE6\x07\xDF\u0BE6\u02A5","\u0BE7\u0BE8\x07\xE0\u0BE8\u02A7","\u0BE9\u0BEA\x07\x07\u0BEA\u02A9","\u0BEB\u0BEC\x07\b\u0BEC\u02AB","\u0BED\u0BEE\x07 \u0BEE\u02AD","\u0BEF\u0BF0\x07\v\u0BF0\u02AF","\u0BF1\u0C81\x07\xDC\u0BF2\u0BF3","\x07\u0BF3\u0C81\x07\u0BF4\u0C81","\x07\x1B\u0BF5\u0C81\x07\u0BF6\u0C81","\x07\u0BF7\u0C81\x07\u0BF8\u0C81","\x07\u0BF9\u0C81\x07 \u0BFA\u0C81",'\x07!\u0BFB\u0C81\x07"\u0BFC\u0C81\x07',"#\u0BFD\u0C81\x07$\u0BFE\u0C81\x07%","\u0BFF\u0C81\x07&\u0C00\u0C81\x07'","\u0C01\u0C81\x07(\u0C02\u0C81\x07)\u0C03","\u0C81\x07*\u0C04\u0C81\x07+\u0C05\u0C81","\x07,\u0C06\u0C81\x07-\u0C07\u0C81\x07",".\u0C08\u0C81\x070\u0C09\u0C81\x071","\u0C0A\u0C81\x072\u0C0B\u0C81\x073","\u0C0C\u0C81\x074\u0C0D\u0C81\x075\u0C0E","\u0C81\x076\u0C0F\u0C81\x077\u0C10\u0C81","\x078\u0C11\u0C81\x079\u0C12\u0C81\x07",":\u0C13\u0C81\x07;\u0C14\u0C81\x07<","\u0C15\u0C81\x07=\u0C16\u0C81\x07>","\u0C17\u0C81\x07?\u0C18\u0C81\x07@\u0C19","\u0C81\x07A\u0C1A\u0C81\x07B\u0C1B\u0C81","\x07C\u0C1C\u0C81\x07D\u0C1D\u0C81\x07","E\u0C1E\u0C81\x07F\u0C1F\u0C81\x07G","\u0C20\u0C81\x07H\u0C21\u0C81\x07I","\u0C22\u0C81\x07J\u0C23\u0C81\x07K\u0C24","\u0C81\x07L\u0C25\u0C81\x07M\u0C26\u0C81","\x07N\u0C27\u0C81\x07O\u0C28\u0C81\x07","P\u0C29\u0C81\x07Q\u0C2A\u0C81\x07R","\u0C2B\u0C81\x07S\u0C2C\u0C81\x07T","\u0C2D\u0C81\x07U\u0C2E\u0C81\x07V\u0C2F","\u0C81\x07W\u0C30\u0C81\x07X\u0C31\u0C81","\x07Y\u0C32\u0C81\x07Z\u0C33\u0C81\x07","[\u0C34\u0C81\x07\\\u0C35\u0C81\x07]","\u0C36\u0C81\x07^\u0C37\u0C81\x07_","\u0C38\u0C81\x07`\u0C39\u0C81\x07a\u0C3A","\u0C81\x07b\u0C3B\u0C81\x07c\u0C3C\u0C81","\x07d\u0C3D\u0C81\x07e\u0C3E\u0C81\x07","f\u0C3F\u0C81\x07g\u0C40\u0C81\x07h","\u0C41\u0C81\x07i\u0C42\u0C81\x07j","\u0C43\u0C81\x07k\u0C44\u0C81\x07l\u0C45","\u0C81\x07m\u0C46\u0C81\x07n\u0C47\u0C81","\x07o\u0C48\u0C81\x07p\u0C49\u0C81\x07","q\u0C4A\u0C81\x07u\u0C4B\u0C81\x07v","\u0C4C\u0C81\x07w\u0C4D\u0C81\x07x","\u0C4E\u0C81\x07y\u0C4F\u0C81\x07z\u0C50","\u0C81\x07{\u0C51\u0C81\x07|\u0C52\u0C81","\x07}\u0C53\u0C81\x07~\u0C54\u0C81\x07","\x7F\u0C55\u0C81\x07\x80\u0C56\u0C81\x07","\x81\u0C57\u0C81\x07\x82\u0C58\u0C81\x07","\x83\u0C59\u0C81\x07\x84\u0C5A\u0C81\x07","\x85\u0C5B\u0C81\x07\x86\u0C5C\u0C81\x07","\x87\u0C5D\u0C81\x07\x88\u0C5E\u0C81\x07","\x89\u0C5F\u0C81\x07\x8A\u0C60\u0C81\x07","\x8B\u0C61\u0C81\x07\x8C\u0C62\u0C81\x07","\x8D\u0C63\u0C81\x07\x8E\u0C64\u0C81\x07","\x8F\u0C65\u0C81\x07\x90\u0C66\u0C81\x07","\x91\u0C67\u0C81\x07\x92\u0C68\u0C81\x07","\x93\u0C69\u0C81\x07\xC1\u0C6A\u0C81\x07","\xC2\u0C6B\u0C81\x07\xC3\u0C6C\u0C81\x07","\xC4\u0C6D\u0C81\x07\xC5\u0C6E\u0C81\x07","\xC6\u0C6F\u0C81\x07\xC7\u0C70\u0C81\x07","\xC8\u0C71\u0C81\x07\xC9\u0C72\u0C81\x07","\xCA\u0C73\u0C81\x07\xCB\u0C74\u0C81\x07","\xCC\u0C75\u0C81\x07\xCD\u0C76\u0C81\x07","\xCE\u0C77\u0C81\x07\xCF\u0C78\u0C81\x07","\xD0\u0C79\u0C81\x07\xD1\u0C7A\u0C81\x07","\xD2\u0C7B\u0C81\x07\xD3\u0C7C\u0C81\x07","\xD4\u0C7D\u0C81\x07\xD5\u0C7E\u0C81\x07","\xE3\u0C7F\u0C81\x07\xE4\u0C80\u0BF1","\u0C80\u0BF2\u0C80\u0BF4","\u0C80\u0BF5\u0C80\u0BF6","\u0C80\u0BF7\u0C80\u0BF8","\u0C80\u0BF9\u0C80\u0BFA","\u0C80\u0BFB\u0C80\u0BFC","\u0C80\u0BFD\u0C80\u0BFE","\u0C80\u0BFF\u0C80\u0C00","\u0C80\u0C01\u0C80\u0C02","\u0C80\u0C03\u0C80\u0C04","\u0C80\u0C05\u0C80\u0C06","\u0C80\u0C07\u0C80\u0C08","\u0C80\u0C09\u0C80\u0C0A","\u0C80\u0C0B\u0C80\u0C0C","\u0C80\u0C0D\u0C80\u0C0E","\u0C80\u0C0F\u0C80\u0C10","\u0C80\u0C11\u0C80\u0C12","\u0C80\u0C13\u0C80\u0C14","\u0C80\u0C15\u0C80\u0C16","\u0C80\u0C17\u0C80\u0C18","\u0C80\u0C19\u0C80\u0C1A","\u0C80\u0C1B\u0C80\u0C1C","\u0C80\u0C1D\u0C80\u0C1E","\u0C80\u0C1F\u0C80\u0C20","\u0C80\u0C21\u0C80\u0C22","\u0C80\u0C23\u0C80\u0C24","\u0C80\u0C25\u0C80\u0C26","\u0C80\u0C27\u0C80\u0C28","\u0C80\u0C29\u0C80\u0C2A","\u0C80\u0C2B\u0C80\u0C2C","\u0C80\u0C2D\u0C80\u0C2E","\u0C80\u0C2F\u0C80\u0C30","\u0C80\u0C31\u0C80\u0C32","\u0C80\u0C33\u0C80\u0C34","\u0C80\u0C35\u0C80\u0C36","\u0C80\u0C37\u0C80\u0C38","\u0C80\u0C39\u0C80\u0C3A","\u0C80\u0C3B\u0C80\u0C3C","\u0C80\u0C3D\u0C80\u0C3E","\u0C80\u0C3F\u0C80\u0C40","\u0C80\u0C41\u0C80\u0C42","\u0C80\u0C43\u0C80\u0C44","\u0C80\u0C45\u0C80\u0C46","\u0C80\u0C47\u0C80\u0C48","\u0C80\u0C49\u0C80\u0C4A","\u0C80\u0C4B\u0C80\u0C4C","\u0C80\u0C4D\u0C80\u0C4E","\u0C80\u0C4F\u0C80\u0C50","\u0C80\u0C51\u0C80\u0C52","\u0C80\u0C53\u0C80\u0C54","\u0C80\u0C55\u0C80\u0C56","\u0C80\u0C57\u0C80\u0C58","\u0C80\u0C59\u0C80\u0C5A","\u0C80\u0C5B\u0C80\u0C5C","\u0C80\u0C5D\u0C80\u0C5E","\u0C80\u0C5F\u0C80\u0C60","\u0C80\u0C61\u0C80\u0C62","\u0C80\u0C63\u0C80\u0C64","\u0C80\u0C65\u0C80\u0C66","\u0C80\u0C67\u0C80\u0C68","\u0C80\u0C69\u0C80\u0C6A","\u0C80\u0C6B\u0C80\u0C6C","\u0C80\u0C6D\u0C80\u0C6E","\u0C80\u0C6F\u0C80\u0C70","\u0C80\u0C71\u0C80\u0C72","\u0C80\u0C73\u0C80\u0C74","\u0C80\u0C75\u0C80\u0C76","\u0C80\u0C77\u0C80\u0C78","\u0C80\u0C79\u0C80\u0C7A","\u0C80\u0C7B\u0C80\u0C7C","\u0C80\u0C7D\u0C80\u0C7E","\u0C80\u0C7F\u0C81\u02B1","\u0110\u02B3\u02B6\u02BC\u02C1\u02C3\u02C8\u02CB\u02CE","\u02FA\u030B\u030E\u0315\u031A\u0325\u032F\u033E\u0349\u034E\u0359\u035D","\u0362\u036A\u036F\u0373\u0378\u037D\u038C\u0392\u0397\u03A1\u03A6\u03B0","\u03B5\u03BA\u03C1\u03C9\u03D6\u03E2\u03E6\u03EA\u03EF\u03F4\u0407\u040E","\u0416\u041A\u041F\u0432\u043B\u044A\u044C\u0458\u0466\u046D\u0474\u047C","\u0487\u049B\u04A6\u04BD\u04CB\u04D2\u04DB\u04EE\u04F6\u04FC\u0501\u0508","\u050D\u0515\u051A\u0521\u0526\u052D\u0532\u0539\u0540\u0547\u054E\u0553","\u055A\u0561\u0566\u056D\u0572\u0579\u057D\u0581\u0586\u058A\u059A\u05A6","\u05AD\u05B6\u05C4\u05CC\u05D2\u05D7\u05E5\u05ED\u05F5\u05FD\u0606\u0612","\u0616\u061A\u0628\u0630\u0639\u0644\u0649\u0650\u0653\u0659\u0664\u0667","\u066D\u0677\u0680\u0684\u0686\u068C\u0692\u0698\u069E\u06A4\u06AA\u06B0","\u06B6\u06BC\u06C2\u06C8\u06CE\u06D4\u06DA\u06E0\u06E6\u06E8\u06EE\u06F4","\u06FB\u06FE\u0703\u0706\u0709\u070C\u070F\u0711\u0719\u071C\u0722\u0725","\u072B\u072E\u0734\u0737\u073D\u0740\u0746\u0749\u074F\u0752\u0758\u075B","\u0761\u0764\u076A\u0770\u0778\u077B\u0781\u0784\u078A\u0792\u079A\u07A3","\u07AC\u07AF\u07B5\u07B8\u07BE\u07C1\u07C7\u07CA\u07D0\u07D3\u07DB\u07DE","\u07E4\u07E7\u07ED\u07F0\u07F6\u07F9\u07FF\u0802\u0804\u0808\u080F\u0826","\u082A\u082E\u0833\u083B\u0843\u0847\u084A\u0850\u0854\u085B\u0866\u0873","\u087C\u08AF\u08B8\u08BB\u08CB\u08D7\u08E3\u08EF\u08F7\u08FA\u0902\u0905","\u090A\u0911\u0915\u0919\u091C\u092E\u0948\u0954\u095D\u0966\u096A\u096D","\u0972\u0975\u0978\u097B\u098B\u0994\u099D\u09A4\u09AF\u09B5\u09B7\u09BF","\u09D8\u09E3\u09EF\u09FB\u0A06\u0A0B\u0A1F\u0A23\u0A28\u0A2E\u0A32\u0A3E","\u0A4F\u0A56\u0A5D\u0A61\u0A66\u0A85\u0A8C\u0A90\u0A97\u0C80"].join(""),wA=new y.atn.ATNDeserializer().deserialize(Bs0),Ds0=wA.decisionToState.map((u,e)=>new y.dfa.DFA(u,e)),Fs0=new y.PredictionContextCache,n=class n extends y.Parser{constructor(e){super(e),this._interp=new y.atn.ParserATNSimulator(this,wA,Ds0,Fs0),this.ruleNames=n.ruleNames,this.literalNames=n.literalNames,this.symbolicNames=n.symbolicNames}get atn(){return wA}root(){let e=new eE(this,this._ctx,this.state);this.enterRule(e,0,n.RULE_root);var t=0;try{this.enterOuterAlt(e,1),this.state=689,this._errHandler.sync(this),t=this._input.LA(1),(!(t-8&-32)&&1<{"use strict";var{CqlParserVisitor:Ms0}=AA(),{CqlParser:wu}=QI(),{CREATE_COLLECTION_COMMAND:Hs0,REMOVE_COLLECTION_COMMAND:qs0,CREATE_BUCKET_COMMAND:Vs0,REMOVE_BUCKET_COMMAND:Gs0,USE_BUCKET_COMMAND:Ws0,CREATE_DEFINITION_COMMAND:zs0,ADD_FIELDS_TO_COLLECTION_COMMAND:Ys0,RENAME_FIELD_COMMAND:Qs0,CREATE_VIEW_COMMAND:js0,ADD_BUCKET_DATA_COMMAND:iH,ADD_COLLECTION_LEVEL_INDEX_COMMAND:sH,ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND:$s0,UPDATE_BUCKET_COMMAND:Zs0,UPDATE_ENTITY_LEVEL_DATA_COMMAND:Xs0,UPDATE_VIEW_LEVEL_DATA_COMMAND:Js0,ADD_FIELDS_TO_DEFINITION_COMMAND:en0}=KR(),tn0=[wu.RULE_createTable,wu.RULE_createKeyspace,wu.RULE_dropTable,wu.RULE_dropKeyspace,wu.RULE_createType,wu.RULE_alterTable,wu.RULE_createMaterializedView,wu.RULE_use,wu.RULE_createFunction,wu.RULE_createAggregate,wu.RULE_alterKeyspace,wu.RULE_alterMaterializedView,wu.RULE_createIndex,wu.RULE_createSearchIndex,wu.RULE_alterType],ZI={type:"char"},JI=class JI extends Ms0{visitCql(e){if(tn0.includes(e.children[0].ruleIndex))return super.visitCql(e)[0]}visitCreateTable(e){let{properties:t,keyData:r}=this.visit(e.columnDefinitionList()),i=this.visit(e.table()),s=this.getKeyspaceName(e),a=e.withElement(),o=a?this.visit(a):{partitionKey:[],clusteringKey:[]},h=cs((o==null?void 0:o.comment)||"");o==null||delete o.comment;let f=this.visitFlagValue(e,"ifNotExist");return{type:Hs0,collectionName:i,bucketName:s,schema:{collectionName:i,type:"object",properties:t},entityLevelData:{comments:h,tableOptions:o,compositePartitionKey:r.partitionKey,compositeClusteringKey:an0(o.clusteringKey,r.clusteringKey),tableIfNotExist:f}}}visitCreateKeyspace(e){let t=this.getKeyspaceName(e),r=this.visit(e.replicationList()),i=e.durableWrites()?!!this.visit(e.durableWrites()):!0,s=this.visitFlagValue(e,"ifNotExist");return{type:Vs0,name:t,data:{...r,durableWrites:i,keyspaceIfNotExist:s}}}visitCreateMaterializedView(e){let t=this.visit(e.materializedView()),r=this.visit(e.table()),i=this.visit(e.columnList()),s=e.materializedViewOptions(),a=s?this.visit(s):{},o=cs((a==null?void 0:a.comment)||"");a==null||delete a.comment;let h=sn0(r,i),f=e.keyspace()[0],d=f?this.visit(f):"",p=e.primaryKeyElement(),E=p?this.visit(p):{partitionKey:[],clusteringKey:[]},x=this.visitFlagValue(e,"ifNotExist");return{type:js0,name:t,bucketName:d,collectionName:r,jsonSchema:{properties:h},data:{comments:o,tableOptions:a,compositePartitionKey:E.partitionKey,compositeClusteringKey:E.clusteringKey,viewIfNotExist:x}}}visitSecondaryIndex(e){let t=this.getKeyspaceName(e),r=this.visit(e.indexColumnSpec()),i=e.indexName(),s=i?this.visit(i):"",a=this.visitFlagValue(e,"ifNotExist");return{type:sH,bucketName:t,collectionName:this.visit(e.table()),name:s,column:r.name,columnType:r.type,indexIfNotExist:a}}visitCustomIndex(e){let t=this.getKeyspaceName(e),r=this.visit(e.indexColumnSpec()),i=e.indexName(),s=i?this.visit(i):"",a=this.visitFlagValue(e,"ifNotExist"),o=this.visitIfExists(e,"customIndexOption",[]).reduce((f,d)=>({...f,...d}),{}),h=this.visitFlagValue(e,"kwSASIIndex");return{type:sH,bucketName:t,collectionName:this.visit(e.table()),name:s,column:r.name,columnType:r.type,indexType:"custom",customOptions:o,indexIfNotExist:a,isSASI:h}}visitCustomIndexOption(e){return e.caseSensitiveOption?{case_sensitive:e.caseSensitiveOption.getText().toLowerCase()==="'true'"}:e.normalizeOption?{normalize:e.normalizeOption.getText().toLowerCase()==="'true'"}:e.asciiOption?{ascii:e.asciiOption.getText().toLowerCase()==="'true'"}:e.analyzedOption?{analyzed:e.analyzedOption.getText().toLowerCase()==="'true'"}:e.similarityFunctionOption?{similarity_function:e.similarityFunctionOption.getText().replaceAll("'","")}:e.isLiteralOption?{isLiteral:e.isLiteralOption.getText().toLowerCase()==="'true'"}:e.tokenizationEnableStemmingOption?{tokenizationEnableStemming:e.tokenizationEnableStemmingOption.getText().toLowerCase()==="'true'"}:e.tokenizationNormalizeLowercaseOption?{tokenizationNormalizeLowercase:e.tokenizationNormalizeLowercaseOption.getText().toLowerCase()==="'true'"}:e.tokenizationNormalizeUppercaseOption?{tokenizationNormalizeUppercase:e.tokenizationNormalizeUppercaseOption.getText().toLowerCase()==="'true'"}:e.normalizeUppercaseOption?{normalizeUppercase:e.normalizeUppercaseOption.getText().toLowerCase()==="'true'"}:e.normalizeLowercaseOption?{normalizeLowercase:e.normalizeLowercaseOption.getText().toLowerCase()==="'true'"}:e.maxCompactionFlushMemoryInMbOption?{maxCompactionFlushMemoryInMb:parseInt(e.maxCompactionFlushMemoryInMbOption.getText().replaceAll("'",""),10)}:e.modeOption?{mode:e.modeOption.getText().replaceAll("'","")}:e.analyzerClassOption?{analyzerClass:e.analyzerClassOption.getText().replaceAll("'","")}:e.tokenizationLocaleOption?{tokenizationLocale:e.tokenizationLocaleOption.getText().replaceAll("'","")}:e.tokenizationSkipStopWordsOption?{tokenizationSkipStopWords:e.tokenizationSkipStopWordsOption.getText().replaceAll("'","")}:{}}visitCreateSearchIndex(e){return{type:$s0,bucketName:this.getKeyspaceName(e),collectionName:this.visit(e.table()),searchIndex:!0,searchIndexColumns:this.visitIfExists(e,"searchIndexColumnList"),searchIndexProfiles:this.visitIfExists(e,"searchIndexProfiles"),searchIndexConfig:this.visitIfExists(e,"searchIndexConfigs"),searchIndexOptions:this.visitIfExists(e,"searchIndexOptions"),searchIndexIfNotExist:this.visitFlagValue(e,"ifNotExist")}}visitSearchIndexOptions(e){return{recovery:e.recoveryOption?e.recoveryOption.getText().toLowerCase()==="true":!1,reindex:e.reindexOption?e.reindexOption.getText().toLowerCase()==="true":!1,lenient:e.lenientOption?e.lenientOption.getText().toLowerCase()==="true":!1}}visitSearchIndexConfigs(e){return{autoCommitTime:e.autoCommitTimeConfig?e.autoCommitTimeConfig.getText():1e3,defaultQueryField:e.defaultQueryFieldConfig?cs(e.defaultQueryFieldConfig.getText()):"",directoryFactory:e.directoryFactoryConfig?cs(e.directoryFactoryConfig.getText()):"",filterCacheLowWaterMark:e.filterCacheLowWaterMarkConfig?e.filterCacheLowWaterMarkConfig.getText():1024,filterCacheHighWaterMark:e.filterCacheHighWaterMarkConfig?e.filterCacheHighWaterMarkConfig.getText():2048,directoryFactoryClass:e.directoryFactoryClassConfig?cs(e.directoryFactoryClassConfig.getText()):"",mergeMaxThreadCount:e.mergeMaxThreadCountConfig?e.mergeMaxThreadCountConfig.getText():"",mergeMaxMergeCount:e.mergeMaxMergeCountConfig?e.mergeMaxMergeCountConfig.getText():"",ramBufferSize:e.ramBufferSizeConfig?e.ramBufferSizeConfig.getText():512,realtime:e.realtimeConfig?e.realtimeConfig.getText().toLowerCase()==="true":!1}}visitSearchIndexProfiles(e){let t=e.getText();return typeof t=="string"&&(t=t.split(",").map(r=>r.trim())),t.map(r=>r.toLowerCase()).includes("spacesavingall")?["spaceSavingNoJoin","spaceSavingNoTextfield","spaceSavingSlowTriePrecision"]:t}visitSearchIndexColumnList(e){return this.visit(e.searchIndexColumn())}visitSearchIndexColumn(e){var h;let t;e.star?t="*":t=e.column().getText();let r=e.copyFieldOption?e.copyFieldOption.getText().toLowerCase()==="true":!1,i=e.docValuesOption?e.docValuesOption.getText().toLowerCase()==="true":!1,s=e.excludedOption?e.excludedOption.getText().toLowerCase()==="true":!1,a=e.indexedOption?e.indexedOption.getText().toLowerCase()==="true":!1,o=((h=e.lowerCase)==null?void 0:h.getText().toLowerCase())==="true";return{key:[t],copyField:r,docValues:i,excluded:s,indexed:a,lowerCase:o}}visitCreateType(e){let t=this.visit(e.type()),r=jI(this.visit(e.typeMemberColumnList()));return{type:zs0,name:t,properties:r}}visitCreateAggregate(e){let t=this.getKeyspaceName(e),r=this.visit(e.aggregate()),[i,s]=this.visit(e.functionStatement()),a=t?`${t}.${r}`:r,o=this.visit(e.initCondDefinition()),[h,f]=e.dataType().map(p=>p.getText()),d="CREATE";return e.orReplace()&&(d+=" OR REPLACE"),d+=" AGGREGATE",e.ifNotExist()&&(d+=" IF NOT EXIST"),d+=` ${a} (${h}) + SFUNC ${i} + STYPE ${f} + FINALFUNC ${s} + INITCOND ${o};`,{type:iH,bucketName:t,key:"UDAs",data:{name:r,storedProcFunction:d}}}visitCreateFunction(e){let t=this.getKeyspaceName(e),r=this.visit(e.functionStatement()),i=t?`${t}.${r}`:r,s=this.visit(e.codeBlock()),a=this.visit(e.language()),o=this.visit(e.paramList()),h=this.visit(e.returnMode()),f=e.dataType().getText(),d="CREATE";return e.orReplace()&&(d+=" OR REPLACE"),d+=" FUNCTION",e.ifNotExist()&&(d+=" IF NOT EXIST"),d+=` ${i} ${o} + ${h} + RETURNS ${f} + LANGUAGE ${a} AS + ${s};`,{type:iH,bucketName:t,key:"UDFs",data:{name:r,functionBody:d}}}visitUse(e){return{type:Ws0,bucketName:this.getKeyspaceName(e)}}visitAlterTable(e){let t=this.getKeyspaceName(e),r=e.alterTableOperation(),i=r.alterTableAdd(),s=r.alterTableRename(),a=r.alterTableWith(),o=this.visit(e.table());if(i)return{type:Ys0,collectionName:o,bucketName:t,data:jI(this.visit(i.alterTableColumnDefinition()))};if(s){let[h,f]=s.column();return{type:Qs0,collectionName:o,bucketName:t,nameFrom:this.visit(h),nameTo:this.visit(f)}}if(a){let h=this.visit(a.tableOptions());return{type:Xs0,collectionName:o,bucketName:t,data:{tableOptions:h}}}}visitAlterKeyspace(e){return{...this.visitCreateKeyspace(e),type:Zs0}}visitAlterMaterializedView(e){let t=this.visit(e.materializedView()),r=e.materializedViewOptions(),i=r?this.visit(r):{},s=this.getKeyspaceName(e),a=s?this.visit(s):"";return{type:Js0,name:t,bucketName:a,data:{tableOptions:i}}}visitAlterType(e){let t=this.visit(e.type()),r=this.getKeyspaceName(e);if(e.alterTypeOperation().alterTypeAdd())return{type:en0,name:t,bucketName:r,data:jI(this.visit(e.typeMemberColumnList()))}}visitDropTable(e){return{type:qs0,bucketName:this.getKeyspaceName(e),collectionName:this.visit(e.table())}}visitDropKeyspace(e){return{type:Gs0,bucketName:this.getKeyspaceName(e)}}visitDurableWrites(e){return this.visit(e.booleanLiteral())}visitReplicationList(e){let t=this.visit(e.replicationListItem()),r=["replStrategy","replFactor"];return t.reduce((i,s)=>{let a=Object.keys(s)[0];if(!r.includes(a)){let o={dataCenterName:a,replFactorValue:Number(s[a])||0};return{...i,dataCenters:[...i.dataCenters,o]}}return{...i,...s}},{dataCenters:[]})}visitReplicationListItem(e){let t=e.getText(),r={class:"replStrategy",replication_factor:"replFactor"},i={networktopologystrategy:"NetworkTopologyStrategy",simplestrategy:"SimpleStrategy"},[s,a]=t.split(":").map(cs),o=r[s.toLowerCase()]||s,h=i[s.toLowerCase()]||a;return o==="replFactor"&&(h=Number(h)||0),{[o]:h}}visitIndexColumnSpec(e){if(e.column())return{name:this.visit(e.column()),type:""};let t=e.indexKeysSpec(),r=e.indexEntriesSSpec(),i=e.indexFullSpec(),s=e.indexValuesSpec(),a=t||r||i||s;return this.visit(a)}visitIndexKeysSpec(e){return{name:this.visit(e.column()),type:"keys"}}visitIndexEntriesSSpec(e){return{name:this.visit(e.column()),type:"entries"}}visitIndexFullSpec(e){return{name:this.visit(e.column()),type:"full"}}visitIndexValuesSpec(e){return{name:this.visit(e.column()),type:"values"}}visitColumnList(e){return this.visit(e.column())}visitMaterializedViewOptions(e){return this.visit(e.tableOptions())}visitReturnMode(e){return`${e.kwCalled()?"CALLED":"RETURNS NULL"} ON NULL INPUT`}visitParamList(e){let t=e.param();return t?"("+this.visit(t).join(",")+")":"()"}visitParam(e){let t=this.visit(e.paramName()),r=e.dataType().getText();return`${t} ${r}`}visitTableOptions(e){return this.visit(e.tableOptionItem()).filter(Boolean).reduce((t,r)=>{if(r.key==="clusteringKey")return{...t,[r.key]:r.value};let i=in0[r.key.toLowerCase()];if(i==="caching")return{...t,[i]:nn0(r.value)};let s=isNaN(r.value)?cs(r.value||""):Number(r.value);if(!i){let a=t.otherProperties||[];return{...t,otherProperties:[...a,{name:r.key,value:s}]}}return{...t,[i]:s}},{})}visitTableOptionItem(e){if(e.clusteringOrder())return{key:"clusteringKey",value:this.visit(e.clusteringOrder())};let t=e.tableOptionValue()||e.optionHash();return{key:e.tableOptionName().getText(),value:t.getText()}}visitClusteringOrder(e){return this.visit(e.clusteringOrderColumns())}visitClusteringOrderColumns(e){let t={names:this.visit(e.column()),directions:this.visit(e.orderDirection())};return t.names.map((r,i)=>({name:r,type:$I(t.directions[i])}))}visitOrderDirection(e){return e.getText()}visitDataType(e){var f;let t=this.visit(e.dataTypeName()),r=["map","tuple","list","set","vector"],i=rn0(t),s=e.dataTypeDefinition();if(!i)return un0(t)?{...this.visit(s)[0],frozen:!0}:{type:"reference",$ref:"#/definitions/"+((f=(t||"").split(".").slice(-1))==null?void 0:f[0])||t};if(!r.includes(i.type))return i;let[o,h]=s?this.visit(s):[ZI,ZI];if(i.type==="map")return{...i,keyType:o.type,keySubtype:h.mode,subtype:`map<${nH(h.type||"")}>`,properties:[Object.assign({name:"New column"},h)]};if(i.type==="vector"){let d=s.decimalLiteral(),[p]=d?this.visit(d):[1];return{...i,subtype:o.mode,dimension:p,properties:[{...o,name:"New column"}]}}return{...i,subtype:`${i.type}<${nH(o.type||"")}>`,items:o}}visitColumnDefinitionList(e){let t=e.primaryKeyElement(),r=t?this.visit(t):{partitionKey:[],clusteringKey:[]},i=this.visit(e.columnDefinition()),s=i.filter(a=>a.isPrimaryKey).map(a=>({name:a.name}));return{properties:i.reduce((a,o)=>({...a,[o.name]:o.type}),{}),keyData:{...r,partitionKey:[...r.partitionKey,...s]}}}visitWithElement(e){return this.visit(e.tableOptions())}visitPrimaryKeyElement(e){let t=this.visit(e.primaryKeyDefinition())[0];return{partitionKey:t.partitionKey.map(r=>({name:r,type:$I()})),clusteringKey:t.clusteringKey.map(r=>({name:r,type:$I()}))}}visitSinglePrimaryKey(e){return{partitionKey:[this.visit(e.column())],clusteringKey:[]}}visitCompoundKey(e){let t=[this.visit(e.partitionKey())],r=e.clusteringKeyList(),i=r?this.visit(r):[];return{partitionKey:t,clusteringKey:i}}visitCompositeKey(e){let t=this.visit(e.partitionKeyList()),r=e.clusteringKeyList(),i=r?this.visit(r):[];return{partitionKey:t,clusteringKey:i}}visitColumnDefinition(e){let t=this.visit(e.column()),r=!!e.primaryKeyColumn();return{name:t,type:this.visit(e.dataType()),isPrimaryKey:r}}visitPartitionKeyList(e){return this.visit(e.partitionKey())}visitClusteringKeyList(e){return this.visit(e.clusteringKey())}visitPartitionKey(e){return this.visit(e.column())}visitClusteringKey(e){return this.visit(e.column())}visitCodeBlock(e){return e.getText()}visitDataTypeDefinition(e){return this.visit(e.dataType())}visitDecimalLiteral(e){return+e.getText()}visitBooleanLiteral(e){return(e.getText()||"").toLowerCase()==="true"}visitLanguage(e){return e.getText()}visitInitCondDefinition(e){return Xr(e)}visitFunctionStatement(e){return Xr(e)}visitAggregate(e){return Xr(e)}visitDataTypeName(e){return Xr(e)}visitKeyspace(e){return Xr(e)}visitColumn(e){return Xr(e)}visitTable(e){return Xr(e)}visitType(e){return Xr(e)}visitMaterializedView(e){return Xr(e)}visitParamName(e){return Xr(e)}visitIndexName(e){return Xr(e)}visitStatementSeparator(){}visitSyntaxComma(){}getKeyspaceName(e){let t=e.keyspace();return t?this.visit(t):""}visitIfExists(e,t,r){try{return this.visit(e[t]())}catch{return r}}visitFlagValue(e,t){try{return this.visit(e[t]()),!0}catch{return!1}}};c(JI,"Visitor");var XI=JI,Xr=c(u=>u?cs(u.getText()):"","getName"),cs=c(u=>u.replace(/^(['"])([\s\S]*)\1$/m,"$2"),"removeQuotes"),jI=c(u=>u.filter(Boolean).reduce((e,t,r)=>{if(r%2===0)return[...e,{key:t}];let i=e[e.length-1].key;return[...e.slice(0,-1),{key:i,value:t}]},[]).reduce((e,t)=>({...e,[t.key]:t.value||ZI}),{}),"listToJson"),un0=c(u=>u.toUpperCase()==="FROZEN","isFrozen"),rn0=c(u=>{switch(u=cs((u||"").toLowerCase()),u){case"int":return{type:"numeric",mode:"integer"};case"smallint":case"tinyint":case"bigint":case"counter":case"decimal":case"double":case"float":case"varint":return{type:"numeric",mode:u};case"text":case"varchar":case"ascii":case"inet":return{type:"char",mode:u};case"duration":return{type:"duration"};case"pointtype":case"linestringtype":case"polygontype":return{type:"geospatial"};case"daterangetype":return{type:"DateRangeType"};case"boolean":return{type:"bool"};case"timestamp":case"timeuuid":case"blob":case"date":case"time":case"uuid":return{type:u};case"tuple":case"list":case"set":case"map":case"vector":return{type:u};default:return}},"getTargetType"),nH=c(u=>{switch(u){case"numeric":return"num";case"char":return"str";case"timestamp":return"ts";case"blob":case"date":case"tuple":case"list":case"set":case"map":case"vector":return u;default:return"udt"}},"complexTypeMapper"),in0={comment:"comment",caching:"caching",compression:"compression",compaction:"compaction",dclocal_read_repair_chance:"localReadRepairChance",read_repair_chance:"readRepairChance",gc_grace_seconds:"gcGraceSeconds",bloom_filter_fp_chance:"bloomFilterFalsePositiveChance",default_time_to_live:"defaultTtl",speculative_retry:"speculativeRetry",min_index_interval:"minIndexInterval",max_index_interval:"maxIndexInterval",crc_check_chance:"crcCheckChance",memtable_flush_period_in_ms:"memtableFlushPeriod"},sn0=c((u,e)=>e.reduce((t,r)=>Object.assign({},t,{[r]:{$ref:`#collection/definitions/${u}/${r}`}}),{}),"getViewSchema"),nn0=c(u=>{try{let e=JSON.parse(u.replace(/'/g,'"'));return Object.keys(e).reduce((t,r)=>{let i=r.toLowerCase();return i==="rows_per_partition"?{...t,rowsPerPartition:e[r]}:{...t,[i]:e[r]}},{})}catch{return{}}},"getCachingOptionValue"),$I=c(u=>u==="DESC"?"descending":"ascending","getKeyType"),an0=c((u=[],e=[])=>{let t=u.map(r=>r.name);return e.filter(r=>!t.includes(r.name)).concat(u)},"mergeClusteringKeys");aH.exports=XI});var lH=w((E10,cH)=>{"use strict";var on0=wa(),t9=class t9 extends on0.error.ErrorListener{syntaxError(e,t,r,i,s,a){throw new Error(`line ${r}:${i} ${s}`)}};c(t9,"ExprErrorListener");var e9=t9;cH.exports=e9});var w1=PD(),cn0=kD().systemKeyspaces,ln0=FD(),hn0=KR(),fn0=require("fs"),hH=wa(),dn0=JM(),pn0=QI(),yn0=oH(),gn0=lH(),En0=c(u=>new Promise((e,t)=>{fn0.readFile(u,"utf-8",(r,i)=>{r?t(r):e(i)})}),"handleFileData");module.exports={connect:function(u,e,t,r){w1(r.require("lodash")).connect(r,e)(u).then(t,i=>{e.log("error",i,"Connection error"),t(i)})},reFromFile:async(u,e,t)=>{try{let r=await En0(u.filePath),i=new hH.InputStream(r),s=new dn0.CqlLexer(i),a=new hH.CommonTokenStream(s),o=new pn0.CqlParser(a);o.removeErrorListeners(),o.addErrorListener(new gn0);let f=o.root().cqls(),d=new yn0,p=hn0.convertCommandsToReDocs(f.accept(d));t(null,p,{},[],"multipleSchema")}catch(r){let{error:i,title:s,name:a}=r,o=mn0(i||r,s||a);e.log("error",o,s),t(o)}},disconnect:function(u,e,t){w1(t.require("lodash")).close(t),e()},testConnection:function(u,e,t,r){fH("Test connection",u,e),this.connect(u,e,i=>(i?e.log("info","Connection failed","Test connection"):e.log("info","Connection successful","Test connection"),this.disconnect(u,()=>{},r),t(w1(r.require("lodash")).prepareError(i))),r)},getDbCollectionsNames:function(u,e,t,r){let i=r.require("async");fH("Retrieving keyspaces and tables information",u,e);let{includeSystemCollection:s}=u,a=w1(r.require("lodash"));a.connect(r,e)(u).then(()=>{let o=a.getKeyspacesNames();s||(o=a.filterKeyspaces(o,cn0)),i.map(o,(h,f)=>{a.getTablesNames(h).then(d=>{let p=a.isOldVersion()?"columnfamily_name":"table_name";return d.rows.map(x=>x[p])}).then(d=>a.getViewsNames(h).then(p=>f(null,a.prepareConnectionDataItem(h,d,p)),()=>f(null,a.prepareConnectionDataItem(h,d,[])))).catch(f)},(h,f)=>t(h,f))}).catch(o=>(e.log("error",o,"Retrieving keyspaces and tables information"),t(a.prepareError(o)||"error")))},getDbCollectionsData:function(u,e,t,r){let i=r.require("async"),s=w1(r.require("lodash"));e.log("info",u,"Retrieving schema",u.hiddenKeys);let a=u.collectionData.collections,o=u.collectionData.dataBaseNames,h=u.includeEmptyCollection,f=u.recordSamplingSettings;i.map(o,(d,p)=>{let E=s.splitEntityNames(a[d]),x=E.views,g=E.tables,m=[],A=[];s.getUDF(d).then(I=>(u9(e,d,"","UDF has loaded"),m=s.handleUDF(I),s.getUDA(d))).then(I=>(u9(e,d,"","UDA has loaded"),A=s.handleUDA(I),s.getViews(f,d,x,e))).then(I=>{T(A,m,I)},I=>{T([],[],[])}).catch(I=>{e.log("error",s.prepareError(I),"Retrieving schema"),p(I)});let T=c((I,L,N)=>{if(g.length)i.map(g,(k,M)=>{let X={dbName:d,collectionName:k,documents:[]},u0=u9.bind(null,e,d,k),h0=c((i0,H,L0)=>(u0(H),i0.then(V=>(u0(L0),V))),"exec");Promise.all([h0(s.getTableMetadata(d,k),"Load meta data...","Meta data has loaded"),h0(s.scanRecords(d,k,f,e),"Load records...","Records have loaded"),s.describeSearchIndexes(d,k)]).then(([i0,H,L0])=>(u0("Records and Meta data have loaded"),X=s.getPackageData({records:s.filterNullItems(JSON.parse(JSON.stringify(H))),keyspaceName:d,table:i0,tableName:k,UDFs:L,UDAs:I,views:N,searchIndex:L0},h),X)).then(i0=>M(null,i0),i0=>M({...i0,table:k}))},(k,M)=>(k&&e.log("error",s.prepareError(k),"Retrieving schema"),p(k,M)));else{let k={dbName:d,emptyBucket:!0};return k.bucketInfo=s.getKeyspaceInfo(d),k.bucketInfo.UDFs=L,k.bucketInfo.UDAs=I,p(null,k)}},"pipeline")},(d,p)=>(d=s.prepareError(d),d?e.log("error",d,"Retrieving schema"):e.progress({message:"Reverse-Engineering complete!",containerName:"",entityName:""}),t(d,p)))}};var fH=c((u,e,t)=>{t.clear(),t.log("info",ln0.getSystemInfo(e.appVersion),u),t.log("info",e,"connectionInfo",e.hiddenKeys)},"logInfo"),u9=c((u,e,t,r)=>{u.progress({containerName:e,entityName:t,message:r}),u.log("info",{keyspace:e,table:t,message:r},"Retrieving schema ...")},"progress"),mn0=c((u,e)=>{let t=Object.getOwnPropertyNames(u).reduce((r,i)=>({...r,[i]:u[i]}),{});return{title:e,...t}},"handleErrorObject"); +/*! Bundled license information: + +long/umd/index.js: + (** + * @license + * Copyright 2009 The Closure Library Authors + * Copyright 2020 Daniel Wirtz / The long.js Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + *) + +node-rsa/src/NodeRSA.js: + (*! + * RSA library for Node.js + * + * Author: rzcoder + * License MIT + *) + +antlr4/polyfills/codepointat.js: + (*! https://mths.be/codepointat v0.2.0 by @mathias *) + +antlr4/polyfills/fromcodepoint.js: + (*! https://mths.be/fromcodepoint v0.2.1 by @mathias *) +*/ diff --git a/reverse_engineering/cassandraHelper.js b/reverse_engineering/cassandraHelper.js deleted file mode 100644 index de607874..00000000 --- a/reverse_engineering/cassandraHelper.js +++ /dev/null @@ -1,1186 +0,0 @@ -const cassandra = require('cassandra-driver'); -const typesHelper = require('./typesHelper'); -let _; -const fs = require('fs'); -const ssh = require('tunnel-ssh'); -const { createTableOptionsFromMeta } = require('./helpers/createTableOptionsFromMeta'); -const { getEntityLevelConfig } = require('../forward_engineering/helpers/generalHelper'); -const CassandraRetryPolicy = require('./cassandraRetryPolicy'); -const xmlParser = require('fast-xml-parser'); -const filterComplexUdt = require('./helpers/filterComplexUdt'); - -let state = { - client: null, - sshTunnel: null, -}; - -const COLUMNS_TO_FILTER_OUT = ['solr_query']; - -module.exports = (_) => { - - const requireKeyStore = (app) => new Promise((resolve, reject) => { - return app.require('java-ssl', (err, Keystore) => { - if (err) { - reject(err); - } else { - resolve(Keystore); - } - }); - }); - - const getCertificatesFromFiles = (info) => { - const readFile = (filePath) => filePath ? fs.readFileSync(filePath) : ''; - - try { - const ca = readFile(info.sslCaFile); - const cert = readFile(info.sslCertFile); - const key = readFile(info.sslKeyFile); - - return Promise.resolve({ - ca, cert, key - }); - } catch (e) { - return Promise.reject(e); - } - }; - - const getCertificatesFromKeystore = (info, app, logger) => { - return requireKeyStore(app).then((Keystore) => { - try { - const store = Keystore(info.keystore, info.keystorepass); - const cert = (store.getCert(info.alias) || '').replace(/\s*-----END CERTIFICATE-----$/, '\n-----END CERTIFICATE-----'); - const key = store.getPrivateKey(info.alias); - let ca = cert; - - logger.log('info', { - message: `[info] certificates successfully retrieved from keystore`, - certLength: cert.length, - keyLength: key.length, - pemCertValidity: cert.startsWith('-----BEGIN CERTIFICATE-----\nMII'), - pemKeyValidity: key.startsWith('-----BEGIN PRIVATE KEY-----\nMII'), - countOfCerts: (cert.match(/-----BEGIN CERTIFICATE-----/ig) || []).length, - }, 'Keystore Info'); - - if (info.truststore) { - const truststore = Keystore(info.truststore, info.truststorePass || ''); - ca = (truststore.getCert(info.truststoreAlias || info.alias) || '').replace(/\s*-----END CERTIFICATE-----$/, '\n-----END CERTIFICATE-----'); - - logger.log('info', { - message: `[info] certificates successfully retrieved from truststore`, - certLength: ca.length, - pemCertValidity: ca.startsWith('-----BEGIN CERTIFICATE-----\nMII'), - countOfCerts: (ca.match(/-----BEGIN CERTIFICATE-----/ig) || []).length, - }, 'Keystore Info'); - } - - return { - cert, - key, - ca, - ...analyzeJks(info, logger) - }; - } catch (error) { - if (error.message.includes('java.lang.NullPointerException')) { - return Promise.reject({ - message: 'Please, check the alias name of the provided JKS certificates. Error message: ' + error.message, - error: error.message, - stack: error.stack, - }); - } - - return Promise.reject(error); - } - }).catch(error => { - logger.log('error', { - message: error.message, - stack: error.stack, - }, 'Initialization java-ssl failed'); - - const certs = analyzeJks(info, logger); - - if (Object.keys(certs).length === 0) { - return Promise.reject(error); - } - - return certs; - }); - }; - - const analyzeJks = (info, logger) => { - try { - const jksJs = require('jks-js'); - let keystore; - - if (fs.existsSync(info.keystore)) { - keystore = jksJs.toPem( - fs.readFileSync(info.keystore), - info.keystorepass - ); - - Object.keys(keystore).forEach(alias => { - logger.log('info', { - type: 'keystore', - certLength: _.get(keystore, `[${alias}].cert.length`), - keyLength: _.get(keystore, `[${alias}].key.length`), - countOfCerts: (_.get(keystore, `[${alias}].cert`, '').match(/-----BEGIN CERTIFICATE-----/ig) || []).length, - alias, - }, 'jks analyze'); - }); - } else { - logger.log('info', `[info] keystore file not found ${info.keystore}`, 'jks analyze'); - } - - let truststore; - - if (fs.existsSync(info.truststore)) { - truststore = jksJs.toPem( - fs.readFileSync(info.truststore), - info.truststorePass - ); - - Object.keys(truststore).forEach(alias => { - logger.log('info', { - type: 'truststore', - certLength: _.get(truststore, `[${alias}].ca.length`), - countOfCerts: (_.get(truststore, `[${alias}].ca`, '').match(/-----BEGIN CERTIFICATE-----/ig) || []).length, - alias, - }, 'jks analyze'); - }); - } else { - logger.log('info', `[info] truststore file not found ${info.truststore}`, 'jks analyze'); - } - - return { - cert: _.get(keystore, `[${info.alias}].cert`), - key: _.get(keystore, `[${info.alias}].key`), - ca: _.get(truststore, `[${info.truststoreAlias || info.alias}].ca`) || _.get(keystore, `[${info.alias}].cert`), - }; - } catch (error) { - logger.log('info', `[info] issue with jks-js. Message: ${error.message}`, 'jks analyze'); - - return {}; - } - }; - - const isSsl = (ssl) => ssl && ssl !== 'false'; - - const getSslOptions = (info, app, logger) => { - const add = (key, value, obj) => !value ? obj : Object.assign({}, obj, { - [key]: value - }); - if (!isSsl(info.ssl)) { - return Promise.resolve({}); - } - - const host = _.get(info, 'hosts[0].host', ''); - let sslPromise; - - if (info.ssl === 'jks') { - sslPromise = getCertificatesFromKeystore(info, app, logger); - } else { - sslPromise = getCertificatesFromFiles(info); - } - - return sslPromise.then(ssl => { - const sslOptions = _.flow([ - add.bind(null, 'ca', ssl.ca), - add.bind(null, 'cert', ssl.cert), - add.bind(null, 'key', ssl.key), - add.bind(null, 'host', host), - ])({ - rejectUnauthorized: !info.disableStrictSsl, - host - }); - - return { sslOptions }; - }); - }; - - const getPolicy = (info, logger) => { - if (info.localDataCenter) { - return { - localDataCenter: info.localDataCenter, - policies : { - retry: new CassandraRetryPolicy(logger) - } - }; - } else { - return { - policies : { - loadBalancing : new cassandra.policies.loadBalancing.RoundRobinPolicy(), - retry: new CassandraRetryPolicy(logger) - } - }; - } - }; - - const validateRequestTimeout = (timeout, applicationQueryRequestTimeout) => { - const DEFAULT_TIMEOUT = 60 * 1000; - const connectionTimeout = Number(timeout); - const queryRequestTimeout = Number(applicationQueryRequestTimeout); - - const requestTimeout = isNaN(connectionTimeout) ? queryRequestTimeout : connectionTimeout; - - if (isNaN(requestTimeout)) { - return DEFAULT_TIMEOUT; - } - - if (requestTimeout <= 0) { - return DEFAULT_TIMEOUT; - } - - return requestTimeout; - }; - - const getDistributedClient = (app, info, logger) => { - if (!Array.isArray(info.hosts)) { - throw new Error('Hosts were not defined'); - } - const credentials = info.authType === 'tokenBased' ? - {username: 'token', password: info.astraToken} : - {username: info.user, password: info.password}; - const authProvider = new cassandra.auth.PlainTextAuthProvider(credentials.username, credentials.password); - const contactPoints = info.hosts.map(item => `${item.host}:${item.port}`); - const readTimeout = validateRequestTimeout(info.requestTimeout, info.queryRequestTimeout); - - return getSslOptions(info, app, logger) - .then(sslOptions => { - return new cassandra.Client(Object.assign({ - contactPoints, - authProvider, - socketOptions: { - readTimeout - } - }, getPolicy(info, logger), sslOptions)); - }); - }; - - const getCloudClient = (info) => { - const readTimeout = validateRequestTimeout(info.requestTimeout, info.queryRequestTimeout); - const credentials = info.authType === 'tokenBased' ? - {username: 'token', password: info.astraToken} : - {username: info.user, password: info.password}; - - const client = new cassandra.Client(Object.assign({ - cloud: { - secureConnectBundle: info.secureConnectBundle - }, - credentials, - socketOptions: { - readTimeout - } - })); - - return Promise.resolve(client); - }; - - const getClient = (app, info, logger) => { - if (info.clusterType === 'apolloCloud') { - return getCloudClient(info); - } else { - return getDistributedClient(app, info, logger); - } - }; - - const getSshConfig = (info) => { - if (!Array.isArray(info.hosts)) { - throw new Error('Hosts were not defined'); - } - - const host = info.hosts[0]; - const config = { - username: info.ssh_user, - host: info.ssh_host, - port: info.ssh_port, - dstHost: host.host, - dstPort: host.port, - localHost: '127.0.0.1', - localPort: host.port, - keepAlive: true - }; - - if (info.ssh_method === 'privateKey') { - return Object.assign({}, config, { - privateKey: fs.readFileSync(info.ssh_key_file), - passphrase: info.ssh_key_passphrase - }); - } else { - return Object.assign({}, config, { - password: info.ssh_password - }); - } - }; - - const connectViaSsh = (info) => new Promise((resolve, reject) => { - if (!info.ssh) { - return resolve({ - tunnel: null, - info - }); - } - - ssh(getSshConfig(info), (err, tunnel) => { - if (err) { - reject(err); - } else { - resolve({ - tunnel, - info: Object.assign({}, info, { - hosts: info.hosts.map(host => ({ - ...host, - host: '127.0.0.1' - })), - }) - }); - } - }); - }); - - const connect = (app, logger) => (info) => { - if (!state.client) { - return connectViaSsh(info).then(({ info, tunnel }) => { - state.sshTunnel = tunnel; - - return getClient(app, info, logger); - }) - .then((client) => { - state.client = client; - - client.on('log', (type, name, info, furtherInfo) => { - if (logger) { - logger.log('info', { message: '[' + type + '] ' + name + ': ' + info + '. ' + furtherInfo }, 'Cassandra Info'); - } - }); - - return state.client.connect(); - }); - } - - return state.client.connect(); - }; - - const close = () => { - if (state.client) { - state.client.shutdown(); - state.client = null; - } - - if (state.sshTunnel) { - state.sshTunnel.close(); - state.sshTunnel = null; - } - }; - - const getKeyspaceMetaData = (keyspace) => { - return state.client.metadata.keyspaces[keyspace]; - }; - - const getKeyspaceInfo = (keyspace) => { - const metaData = getKeyspaceMetaData(keyspace); - const strategy = _.get(metaData, 'strategy', '').split('.').slice(-1).pop(); - let keyspaceInfo = { - code: keyspace, - durableWrites: Boolean(metaData.durableWrites), - replStrategy: strategy - }; - - if (strategy === 'SimpleStrategy') { - keyspaceInfo.replFactor = Number(metaData.strategyOptions.replication_factor); - } else if (strategy === 'NetworkTopologyStrategy') { - keyspaceInfo.dataCenters = Object.keys(metaData.strategyOptions).map(key => { - return { - dataCenterName: key, - replFactorValue: Number(metaData.strategyOptions[key]) - }; - }); - } - return keyspaceInfo; - }; - - const getKeyspacesNames = () => { - return Object.keys(state.client.metadata.keyspaces); - }; - - const isOldVersion = () => { - const hosts = _.get(state, 'client.hosts._items'); - - if (!hosts) { - return false; - } - - const host = hosts[Object.keys(hosts)[0]]; - - if (!host) { - return false; - } - - const version = host.getCassandraVersion(); - - if (!version.length) { - return false; - } - - const majorDigit = _.get(version, '[0]'); - - return majorDigit < 3; - }; - - const getTablesNames = (keyspace) => { - const oldSelectTableNamePrefix = 'SELECT columnfamily_name FROM system.schema_columnfamilies'; - const newSelectTableNamePrefix = 'SELECT table_name FROM system_schema.tables'; - const query = isOldVersion() ? `${oldSelectTableNamePrefix} WHERE keyspace_name ='${keyspace}'` : - `${newSelectTableNamePrefix} WHERE keyspace_name ='${keyspace}'`; - - return execute(query); - }; - - const getViewsNames = (keyspace) => { - const query = `SELECT view_name FROM system_schema.views WHERE keyspace_name ='${keyspace}'`; - - return execute(query).then(viewData => viewData.rows.map(view => view.view_name), ()=>[]); - }; - - const execute = (query) => { - return state.client.execute(query); - }; - - const getTableMetadata = (keyspace, table) => { - return state.client.metadata.getTable(keyspace, table); - }; - - const getViews = (recordSamplingSettings, keyspace, views, logger) => { - return Promise.all(views.map(viewName => { - return state.client.metadata.getMaterializedView(keyspace, viewName) - .then(view => { - return getViewDocumentTemplate(recordSamplingSettings, keyspace, viewName, logger) - .then(documentTemplate => ({ - documentTemplate, - view - })) - }, () => ({ - documentTemplate: {}, - view: {} - })); - })); - }; - - const getViewDocumentTemplate = (recordSamplingSettings, keyspace, viewName, logger) => { - return scanRecords(keyspace, viewName, recordSamplingSettings, logger).then(mergeDocuments, () => ({})); - }; - - const describeSearchIndexes = async (keyspaceName, tableName) => { - try { - const result = await execute(`select resource_name, resource_value from solr_admin.solr_resources where resource_name IN ('schema.xml', 'solrconfig.xml') AND core_name = '${keyspaceName}.${tableName}';`); - - if (!result.rows.length) { - return {}; - } - - const keyMap = { - 'schema.xml': 'schema', - 'solrconfig.xml': 'config', - }; - - return result.rows.reduce((result, row) => { - return { - ...result, - [keyMap[row.resource_name]]: row.resource_value.toString(), - }; - }, {}); - } catch (error) { - return {}; - } - }; - - const splitEntityNames = names => { - const namesByCategory =_.partition(names, isView); - - return { views: namesByCategory[0].map(name => name.slice(0, -4)), tables: namesByCategory[1] }; - } - - const getColumnInfo = (keyspace, table) => { - const query = `SELECT * FROM system_schema.columns WHERE keyspace_name='${keyspace}' AND table_name='${table}';`; - return execute(query); - }; - - const prepareConnectionDataItem = (keyspace, tables, views) => { - const connectionDataItem = { - dbName: keyspace, - dbCollections: tables, - views - }; - - return connectionDataItem; - }; - - const getTableSchema = (columns, udtHash, sample = {}) => { - let schema = {}; - columns - .filter(column => !_.includes(COLUMNS_TO_FILTER_OUT, column.name)) - .forEach(column => { - const columnType = typesHelper(_).getColumnType(column, udtHash, sample ? sample[column.name] : undefined); - schema[column.name] = columnType; - schema[column.name].code = column.name; - schema[column.name].static = column.isStatic; - schema[column.name].frozen = column.type.options.frozen; - }); - return { properties: schema }; - }; - - const scanRecords = (keyspace, table, recordSamplingSettings, logger) => { - return getSizeOfRows(keyspace, table, recordSamplingSettings).then( - size => - new Promise((resolve, reject) => { - let rows = []; - - logger.log('info', { table: `${keyspace}.${table}`, limit: size }, 'Scan records'); - - if (!size) { - return resolve(rows); - } - - const options = { prepare: true, autoPage: true, retry: new CassandraRetryPolicy(logger) }; - const selQuery = `SELECT * FROM "${keyspace}"."${table}" LIMIT ${size}`; - - state.client.eachRow( - selQuery, - [], - options, - function (n, row) { - rows.push(row); - }, - (err, rs) => { - return err ? reject(err) : resolve(rows); - }, - ); - }), - ); - }; - - const getSizeOfRows = (keyspace, table, recordSamplingSettings) => { - if (recordSamplingSettings.active === 'absolute') { - return Promise.resolve(Number(recordSamplingSettings.absolute.value)); - } - - const countQueryLimit = getCountLimit(recordSamplingSettings); - const query = `SELECT COUNT(*) FROM "${keyspace}"."${table}" LIMIT ${countQueryLimit}`; - - return execute(query).then(count => { - const rowsCount = _.get(count, 'rows[0].count.low', recordSamplingSettings.maxValue); - - return getSampleDocSize(rowsCount, recordSamplingSettings); - }); - }; - - - const getEntityLevelData = (table, tableName, searchIndex) => { - const partitionKeys = handlePartitionKeys(table.partitionKeys); - const clusteringKeys = handleClusteringKeys(table); - const indexData = handleIndexes(table.indexes, searchIndex); - - return { - ...indexData, - code: tableName, - compositePartitionKey: partitionKeys, - compositeClusteringKey: clusteringKeys, - comments: table.comment, - tableOptions: getTableOptions(table) - }; - }; - - const changeQuotes = (str) => { - return String(str).replace(/\"/g, '\''); - }; - - const getCompaction = (data) => { - return Object.assign({}, data.compactionOptions, { - class: data.compactionClass - }); - }; - - const getOptionsFromTab = config => { - const optionsBlock = config.structure.find(prop => prop.propertyName === 'Options'); - return optionsBlock.structure; - } - - const getTableOptions = (table) => { - const [detailsTab] = getEntityLevelConfig(); - const configOptions = getOptionsFromTab(detailsTab); - return createTableOptionsFromMeta(table, configOptions); - }; - - const getKeyOrder = (order) => { - switch(order) { - case 'DESC': - return 'descending'; - case 'ASC': - default: - return 'ascending'; - } - }; - const handlePartitionKeys = (partitionKeys) => { - return (partitionKeys || []).map(item => item.name); - }; - - const handleClusteringKeys = (table) => { - return (table.clusteringKeys || []).map((item, index) => { - const clusteringOrder = table.clusteringOrder ? table.clusteringOrder[index] : ''; - return { - name: item.name, - type: getKeyOrder(clusteringOrder) - }; - }); - }; - - const handleIndexes = (indexes, searchIndex) => { - return { - SecIndxs: getGeneralIndexes(indexes), - ...getSearchIndex(searchIndex), - }; - }; - - const getGeneralIndexes = (indexes) => { - return indexes.filter(index => !(index.options && index.options['class_name'] === 'com.datastax.bdp.search.solr.Cql3SolrSecondaryIndex')).map(item => { - const indexType = item.isCustomKind() ? 'custom' : 'secondary'; - let customOptions = {}; - - if (item.options && indexType === 'custom') { - customOptions.case_sensitive = item.options.case_sensitive === 'true'; - customOptions.normalize = item.options.normalize === 'true'; - customOptions.ascii = item.options.ascii === 'true'; - customOptions.similarity_function = item.options.similarity_function || ''; - } - - return { - name: item.name, - SecIndxKey: [getIndexKey(item.target)], - customOptions, - indexType, - }; - }); - }; - - const getSearchIndexConfig = (config) => { - const result = {}; - const autoCommitTime = _.get(config, 'updateHandler.autoSoftCommit.maxTime'); - const defaultQueryFieldHandler = _.get(config, 'requestHandler', []).find(handler => handler.lst && handler.lst['@_name'] === 'defaults'); - const filterCache = _.get(config, 'query.filterCache'); - const mergeScheduler = _.get(config, 'indexConfig.mergeScheduler.int', []).reduce((result, item) => ({ - ...result, - [item['@_name']]: item['#text'], - }), {}); - - result.realtime = _.get(config, 'indexConfig.rt', false); - result.directoryFactoryClass = _.get(config, 'directoryFactory.@_class'); - result.directoryFactory = ''; - - if (result.directoryFactoryClass === 'solr.EncryptedFSDirectoryFactory') { - result.directoryFactory = 'encrypted'; - result.directoryFactoryClass = ''; - } - if (result.directoryFactoryClass === 'solr.StandardDirectoryFactory') { - result.directoryFactory = 'standard'; - result.directoryFactoryClass = ''; - } - - if (autoCommitTime) { - result.autoCommitTime = autoCommitTime; - } - - if (defaultQueryFieldHandler) { - result.defaultQueryField = defaultQueryFieldHandler.lst.str['#text']; - } - - if (filterCache) { - result.filterCacheLowWaterMark = filterCache['@_lowWaterMarkMB']; - result.filterCacheHighWaterMark = filterCache['@_highWaterMarkMB']; - } - - if (!_.isEmpty(mergeScheduler)) { - if (mergeScheduler.maxThreadCount) { - result.mergeMaxThreadCount = mergeScheduler.maxThreadCount; - } - if (mergeScheduler.maxMergeCount) { - result.mergeMaxMergeCount = mergeScheduler.maxMergeCount; - } - } - - return result; - }; - - const transformObjectToArray = schema => Array.isArray(schema) ? schema : [schema]; - - const getSearchIndexProfile = schema => { - const fields = transformObjectToArray(schema.fields.field); - const fieldTypes = transformObjectToArray(schema.types.fieldType); - const uniqueKeys = (schema.uniqueKey || '').replace(/^\(|\)$/g, '').split(','); - const fieldsWithoutNoJoin = fields.filter(field => field['@_name'] !== '_partitionKey'); - const isNotOnlyUniqueKeysHaveStrField = fieldsWithoutNoJoin - .some(field => !uniqueKeys.includes(field['@_name']) && field['@_type'] === 'StrField'); - const spaceSavingSlowTriePrecision = fieldTypes.some(fieldType => fieldType['@_precisionStep'] === 0); - const uniqueKeysHaveStrField = fieldsWithoutNoJoin.some(field => uniqueKeys.includes(field['@_name']) && field['@_type'] === 'StrField'); - const fieldTypesWithStrField = fieldTypes.some(fieldType => fieldType['@_name'] === 'StrField'); - const searchIndexProfiles = { - spaceSavingSlowTriePrecision, - spaceSavingNoJoin: fields.length !== fieldsWithoutNoJoin.length, - spaceSavingNoTextfield: isNotOnlyUniqueKeysHaveStrField || (!uniqueKeysHaveStrField && fieldTypesWithStrField), - }; - - return Object.entries(searchIndexProfiles).filter(([___, value]) => value).map(([spaceName]) => spaceName); - }; - - const getSearchIndex = (indexData) => { - if (_.isEmpty(indexData)) { - return {}; - } - - const schema = xmlParser.parse(indexData['schema'], { parseAttributeValue: true, ignoreAttributes: false }).schema; - const config = xmlParser.parse(indexData['config'], { parseAttributeValue: true, ignoreAttributes: false }).config; - const fields = transformObjectToArray(schema.fields.field); - - const searchIndexColumns = fields.filter(field => ( - field['@_name'] !== schema.uniqueKey - && - field['@_name'] !== '_partitionKey' - )).map(field => { - return { - key: [field['@_name']], - indexed: Boolean(field['@_indexed']), - docValues: Boolean(field['@_docValues']), - lowerCase: field['@_type']?.startsWith('LowerCase'), - }; - }); - - const searchIndexConfig = getSearchIndexConfig(config); - const searchIndexProfiles = getSearchIndexProfile(schema); - - return { - searchIndex: true, - searchIndexColumns, - searchIndexConfig, - searchIndexProfiles, - }; - }; - - const getIndexKey = (target) => { - const isValues = /^values\(([\s\S]+)\)$/i; - const isEntries = /^entries\(([\s\S]+)\)$/i; - const isKeys = /^keys\(([\s\S]+)\)$/i; - let type = ''; - let name = target; - - if (isValues.test(target)) { - type = 'values'; - name = target.match(isValues)[1]; - } - - if (isEntries.test(target)) { - type = 'entries'; - name = target.match(isEntries)[1]; - } - - if (isKeys.test(target)) { - type = 'keys'; - name = target.match(isKeys)[1]; - } - - return { - type, - name, - }; - }; - - const handleUdts = (udts) => { - if (udts && udts.length) { - let schema = {}; - let nestedUdts = []; - - udts.forEach(({ udt, sample }) => { - const info = _.get(udt, 'type.info', _.get(udt, 'info'), {}); - const name = info.name || udt.name; - const fields = info.fields || []; - schema[name] = { - type: 'udt', - static: udt.isStatic, - properties: getTableSchema(fields, nestedUdts, sample).properties - }; - }); - - return { - ...schema, - ...(handleUdts(nestedUdts) || {}) - }; - } else { - return null; - } - }; - - const getUDT = (keyspace) => { - const query = `SELECT * FROM system_schema.types WHERE keyspace_name='${keyspace}'`; - return execute(query); - }; - - const getUDF = (keyspace) => { - const query = `SELECT * FROM system_schema.functions WHERE keyspace_name='${keyspace}'`; - return execute(query); - }; - - const getUDA = (keyspace) => { - const query = `SELECT * FROM system_schema.aggregates WHERE keyspace_name='${keyspace}'`; - return execute(query); - }; - - const removeFrozen = str => str.replace(/frozen\<(.*)\>/i, '$1') - - const handleUDF = (udf) => { - const udfData = udf.rows.map(item => { - const args = item.argument_names.map((name, index) => { - return `${name} ${removeFrozen(item.argument_types[index] || '')}`; - }).join(', '); - - const deterministic = item.deterministic ? 'DETERMINISTIC' : ''; - const monotonic = item.monotonic ? 'MONOTONIC ON' + item.monotonic_on.join(', ') : ''; - - const func = `CREATE OR REPLACE FUNCTION ${item.function_name} ( ${args} ) - ${item.called_on_null_input ? 'CALLED' : 'RETURNS NULL'} ON NULL INPUT - RETURNS ${removeFrozen(item.return_type)} ${deterministic} ${monotonic} - LANGUAGE ${item.language} AS - $$ ${item.body} $$ ;`; - - return { - name: item.function_name, - functionBody: func - }; - }); - return udfData; - }; - - const handleUDA = (uda) => { - const udaData = uda.rows.map(item => { - const args = item.argument_types.map(removeFrozen).join(', '); - - const aggr = `CREATE OR REPLACE AGGREGATE ${item.aggregate_name} (${args})` + - `\n\t\t\tSFUNC ${item.state_func}` + - `\n\t\t\tSTYPE ${removeFrozen(item.state_type)}` + - (item.final_func !== null ? `\n\t\t\tFINALFUNC ${item.final_func}` : '') + - `\n\t\t\tINITCOND ${item.initcond}` + - `${item.deterministic ? '\n\t\t\tDETERMINISTIC' : ''};`; - - return { - name: item.aggregate_name, - storedProcFunction: aggr - }; - }); - return udaData; - }; - - const getViewsData = (views, tableName, tableSchema) => { - return views - .filter(viewData => _.get(viewData, 'view.tableName') === tableName) - .map(viewData => { - const view = _.get(viewData, 'view', {}); - const documentTemplate = Object.keys(_.get(viewData, 'documentTemplate', {})); - - return { - name: view.name, - jsonSchema: getViewData(view, tableSchema), - documentTemplate, - data: { - compositePartitionKey: handlePartitionKeys(view.partitionKeys), - compositeClusteringKey: handleClusteringKeys(view), - comments: view.comment, - tableOptions: getTableOptions(view) - } - } - }); - }; - - const getViewData = (viewData, parentTableSchema) => { - if (_.isEmpty(_.get(viewData, 'columns'))) { - return {}; - } - const columns = Object.keys(viewData.columnsByName); - - return { properties: getViewSchema(parentTableSchema, viewData.tableName, columns)} - }; - - const getViewSchema = (tableSchema, tableName, columns) => { - return columns.reduce((schema, name) => { - if (!_.get(tableSchema, ['properties', name])) { - return schema; - } - - return Object.assign({}, schema, { - [name]: {$ref: `#collection/definitions/${tableName}/${name}`} - }); - }, {}); - }; - - const getPackageData = (data, includeEmptyCollection) => { - let packageData = { - dbName: data.keyspaceName, - collectionName: data.tableName, - documents: data.records, - }; - - if (data?.table?.columns?.length) { - packageData.bucketInfo = getKeyspaceInfo(data.keyspaceName); - packageData.bucketInfo.UDFs = data.UDFs; - packageData.bucketInfo.UDAs = data.UDAs; - packageData.entityLevel = getEntityLevelData(data.table, data.tableName, data.searchIndex); - const udtHash = []; - const mergedDocument = mergeDocuments(data.records); - const schema = getTableSchema(data.table.columns, udtHash, mergedDocument); - packageData.validation = { - jsonSchema: schema - }; - packageData.documentTemplate = mergedDocument; - packageData.modelDefinitions = { - definitions: handleUdts(udtHash) - }; - - if (!_.isEmpty(data.views)) { - packageData.views = getViewsData(data.views, data.tableName, schema); - } - packageData = { - ...packageData, - documents: filterComplexUdt(_).filterUdts(schema.properties, data.records), - }; - } else if (!includeEmptyCollection) { - packageData = null; - } - return packageData; - }; - const mergeDocuments = (documents) => { - const split = (arr, f) => { - return arr.reduce((result, item) => { - if (f(item)) { - return [ - result[0].concat([ item ]), - result[1] - ]; - } else { - return [ - result[0], - result[1].concat([ item ]) - ]; - } - }, [[], []]); - }; - const uniqByType = (arr) => { - const hash = {}; - - return arr.reduce((result, item) => { - if (!hash[typeof item]) { - hash[typeof item] = true; - - return result.concat([item]); - } else { - return result; - } - }, []); - }; - const mergeByType = (arr) => { - const [arrays, noArrays] = split(arr, Array.isArray); - const [objects, rest] = split(noArrays, isObject); - const scalars = uniqByType(rest); - const mergedObject = objects.reduce(merge, {}); - const result = scalars.concat(arrays.reduce(merge, [])); - - if (Object.keys(mergedObject).length) { - return result.concat([mergedObject]); - } - - return result; - }; - const isObject = (obj) => obj && typeof obj === 'object' && !Array.isArray(obj); - const mergeArray = (arr1, arr2) => { - const arr = arr1.concat(arr2); - if (!arr.length) { - return []; - } - - return mergeByType(arr); - }; - const mergeObjects = (obj1, obj2) => { - return Object.keys(obj1).concat(Object.keys(obj2)).reduce((result, key) => { - return Object.assign({}, result, { - [key]: merge(obj1[key], obj2[key]) - }); - }, {}); - }; - const merge = (doc1, doc2) => { - if (Array.isArray(doc1) && Array.isArray(doc2)) { - return mergeArray(doc1, doc2); - } else if (isObject(doc1) && isObject(doc2)) { - return mergeObjects(doc1, doc2); - } else if (Array.isArray(doc1)) { - return merge(doc1, []); - } else if (Array.isArray(doc2)) { - return merge([], doc2); - } else if (isObject(doc1)) { - return merge(doc1, {}); - } else if (isObject(doc2)) { - return merge({}, doc2); - } else if (doc1 !== undefined) { - return doc1; - } else if (doc2 !== undefined) { - return doc2; - } - }; - - if (!Array.isArray(documents) || !documents.length) { - return {}; - } - - try { - return JSON.parse(JSON.stringify(documents)).reduce(merge, {}); - } catch (e) { - return {}; - } - }; - - const prepareError = (error) => { - if (!(error instanceof Error)) { - return error; - } - - return { - message: error.message, - stack: error.stack - }; - }; - - const filterKeyspaces = (keyspaces, systemKeyspaces) => { - return _.difference(keyspaces, systemKeyspaces || []); - }; - - - const getSampleDocSize = (count, recordSamplingSettings) => { - const limit = Math.ceil((count * recordSamplingSettings.relative.value) / 100); - - return Math.min(limit, recordSamplingSettings.maxValue); - }; - - const cleanOutComments = (script) => { - return script.replace(/\/\*([\s\S]+?)\*\//, ''); - }; - - const splitScriptByQueries = (script) => { - const findFunctionStatements = (script) => { - return (script.match(/\$\$([\s\S]+?)\$\$/g) || []) - .map(item => item.trim().replace(/(^\$\$|\$\$$)/g, '')); - }; - const getPlaceholder = (n) => `\$__HACKOLADE__PLACEHOLDER_${n}__\$`; - - script = cleanOutComments(script); - - const functionStatements = findFunctionStatements(script); - - const queries = functionStatements.reduce((script, func, i) => { - return script.replace(func, getPlaceholder(i)); - }, script) - .split(';') - .map(query => query.trim()) - .filter(Boolean); - - return functionStatements.reduce((queries, func, i) => { - return queries.map(query => query.replace(getPlaceholder(i), func)); - }, queries); - }; - - const batch = (script, progress) => { - const queries = splitScriptByQueries(script); - - const totalQueries = queries.length; - let currentQuery = 0; - - return promiseSeriesAll( - queries.map(query => () => state.client.execute(query)), - (result) => { - const query = queries[currentQuery]; - - progress(query, result, currentQuery, totalQueries); - - currentQuery++; - } - ).then( - result => result, - error => Promise.reject({ error, query: queries[currentQuery] }) - ); - }; - - const promiseSeriesAll = (promises, callback) => { - if (!promises.length) { - return Promise.resolve(); - } - - return promises[0]().then(result => { - callback(result); - - return promiseSeriesAll(promises.slice(1), callback); - }); - }; - - const isView = name => name.slice(-4) === ' (v)'; - - const filterNullItems = (doc) => { - if (doc === null) { - return undefined; - } else if (Array.isArray(doc)) { - return doc.map(filterNullItems).filter(item => item !== undefined); - } else if (typeof doc === 'object') { - return Object.keys(doc).reduce((result, key) => { - const item = filterNullItems(doc[key]); - - if (item === undefined) { - return result; - } - - return { - ...result, - [key]: item, - }; - }, {}); - } else { - return doc; - } - }; - - const getCountLimit = (recordSamplingSettings) => { - const per = recordSamplingSettings.relative.value; - const max = recordSamplingSettings.maxValue; - - return Math.round((max / per) * 100); - }; - - return { - connect, - close, - getKeyspacesNames, - getTablesNames, - prepareConnectionDataItem, - getColumnInfo, - getTableMetadata, - getTableSchema, - scanRecords, - getEntityLevelData, - getKeyspaceMetaData, - getKeyspaceInfo, - handleUdts, - getUDF, - getUDA, - handleUDF, - handleUDA, - getPackageData, - prepareError, - filterKeyspaces, - batch, - isOldVersion, - getViews, - getViewsNames, - splitEntityNames, - filterNullItems, - describeSearchIndexes - }; -} diff --git a/reverse_engineering/cassandraRetryPolicy.js b/reverse_engineering/cassandraRetryPolicy.js deleted file mode 100644 index 089ff6db..00000000 --- a/reverse_engineering/cassandraRetryPolicy.js +++ /dev/null @@ -1,76 +0,0 @@ -const cassandra = require('cassandra-driver'); - -class CassandraRetryPolicy extends cassandra.policies.retry.RetryPolicy { - constructor(logger) { - super(); - this.hackoladeLogger = logger; - } - - onReadTimeout(info, consistency, received, blockFor, isDataPresent) { - var totalRetry = 2; - var currentRetry = info.nbRetry; - - if (this.hackoladeLogger) { - this.hackoladeLogger.log( - 'info', - { - exception: 'Read timeout', - respondedNodes: received, - needNodesForSuccess: blockFor, - query: info.query, - nbRetry: info.nbRetry, - isLastTry: currentRetry > totalRetry, - }, - 'Retry policy info' - ); - } - - if (currentRetry > totalRetry) { - return this.rethrowResult(); - } - - return this.retryResult(cassandra.types.consistencies.one); - } - - onUnavailable(info, consistency, received, blockFor, isDataPresent) { - if (this.hackoladeLogger) { - this.hackoladeLogger.log( - 'info', - { - exception: 'Unavailable', - query: info.query, - nbRetry: info.nbRetry, - isLastTry: info.nbRetry > 0, - }, - 'Retry policy info' - ); - } - - // The default implementation - if (info.nbRetry > 0) { - return this.rethrowResult(); - } - - return this.retryResult(undefined, false); - } - - onRequestError = function (info, consistency, err) { - if (this.hackoladeLogger) { - this.hackoladeLogger.log( - 'info', - { - exception: 'Request error', - query: info.query, - nbRetry: info.nbRetry, - error: { ...err }, - }, - 'Retry policy info' - ); - } - - // The default implementation - return this.retryResult(undefined, false); - }; -} - -module.exports = CassandraRetryPolicy; diff --git a/reverse_engineering/commandsHelper.js b/reverse_engineering/commandsHelper.js deleted file mode 100644 index 11fb857c..00000000 --- a/reverse_engineering/commandsHelper.js +++ /dev/null @@ -1,303 +0,0 @@ -const CREATE_COLLECTION_COMMAND = 'createCollection'; -const REMOVE_COLLECTION_COMMAND = 'removeCollection'; -const CREATE_BUCKET_COMMAND = 'createBucket'; -const REMOVE_BUCKET_COMMAND = 'removeBucket'; -const USE_BUCKET_COMMAND = 'useBucket'; -const CREATE_DEFINITION_COMMAND = 'createDefinition'; -const ADD_FIELDS_TO_COLLECTION_COMMAND = 'addFieldsToCollection'; -const RENAME_FIELD_COMMAND = 'renameField'; -const CREATE_VIEW_COMMAND = 'createView'; -const ADD_BUCKET_DATA_COMMAND = 'addBucketData'; - -const DEFAULT_BUCKET = 'New Keyspace'; - - -const convertCommandsToEntities = commands => { - return commands.reduce((entitiesData, statementData) => { - const command = statementData && statementData.type; - - if (!command) { - return entitiesData; - } - - const bucket = statementData.bucketName || entitiesData.currentBucket; - if (command === CREATE_COLLECTION_COMMAND) { - return createCollection(entitiesData, bucket, statementData); - } - - if (command === REMOVE_COLLECTION_COMMAND) { - return removeCollection(entitiesData, bucket, statementData); - } - - if (command === CREATE_BUCKET_COMMAND) { - return createBucket(entitiesData, statementData); - } - - if (command === REMOVE_BUCKET_COMMAND) { - return removeBucket(entitiesData, statementData) - } - - if (command === USE_BUCKET_COMMAND) { - return useBucket(entitiesData, statementData); - } - - if (command === CREATE_DEFINITION_COMMAND) { - return createDefinition(entitiesData, statementData); - } - - if (command === ADD_FIELDS_TO_COLLECTION_COMMAND) { - return addFieldsToCollection(entitiesData, bucket, statementData); - } - - if (command === RENAME_FIELD_COMMAND) { - return renameField(entitiesData, bucket, statementData); - } - - if (command === CREATE_VIEW_COMMAND) { - return createView(entitiesData, bucket, statementData); - } - - if (command === ADD_BUCKET_DATA_COMMAND) { - return addDataToBucket(entitiesData, bucket, statementData); - } - - return entitiesData; - }, { - entities: [], - views: [], - currentBucket: DEFAULT_BUCKET, - buckets: {}, - definitions: {}, - }); -} - - -const convertCommandsToReDocs = commands => { - const reData = convertCommandsToEntities(commands); - - return reData.entities.map(entity => { - const relatedViews = reData.views.filter(view => view.collectionName === entity.collectionName); - return { - objectNames: { - collectionName: entity.collectionName - }, - doc: { - dbName: entity.bucketName, - collectionName: entity.collectionName, - modelDefinitions: { definitions: reData.definitions }, - bucketInfo: reData.buckets[entity.bucketName] || {}, - entityLevel: entity.entityLevelData, - views: relatedViews.map(view => ({ - name: view.name, - jsonSchema: view.jsonSchema - })) - }, - jsonSchema: entity.schema - } - }); -}; - -const createCollection = (entitiesData, bucket, statementData) => { - const { entities, currentBucket } = entitiesData; - if (!statementData.bucketName) { - return { ...entitiesData, entities: [ ...entities, { ...statementData, bucketName: bucket } ] }; - } - - if (currentBucket === DEFAULT_BUCKET) { - return { - ...entitiesData, - entities: [ ...entities, statementData ], - bucketName: statementData.bucketName - }; - } else { - return { ...entitiesData, entities: [ ...entities, statementData ] }; - } -}; - -const removeCollection = (entitiesData, bucket, statementData) => { - const { entities } = entitiesData; - const index = findEntityIndex(entities, bucket, statementData.collectionName) - if (index === -1) { - return entitiesData; - } - - return { ...entitiesData, entities: remove(entities, index) } -}; - -const createBucket = (entitiesData, statementData) => { - const { buckets } = entitiesData; - const bucketName = statementData.name; - return { - ...entitiesData, - currentBucket: bucketName, - buckets: { ...buckets, [bucketName]: statementData.data || {}} - }; -}; - -const removeBucket = (entitiesData, statementData) => { - const { buckets, entities } = entitiesData; - const bucketName = statementData.name; - - return { - currentBucket: DEFAULT_BUCKET, - buckets: omitCaseInsensitive(buckets, bucketName), - entities: entities.filter(entity => !isEqualCaseInsensitive(entity.bucketName, bucketName)) - }; -}; - -const useBucket = (entitiesData, statementData) => { - return { - ...entitiesData, - currentBucket: statementData.bucketName, - }; -}; - -const createDefinition = (entitiesData, statementData) => { - const { definitions } = entitiesData; - - return { - ...entitiesData, - definitions: { - ...definitions, - [statementData.name]: { - type: 'udt', - properties: statementData.properties - } - } - }; -}; - -const addFieldsToCollection = (entitiesData, bucket, statementData) => { - const { entities } = entitiesData; - const index = findEntityIndex(entities, bucket, statementData.collectionName); - if (index === -1) { - return entitiesData; - } - - const entity = entities[index]; - return { - ...entitiesData, - entities: [ - ...entities.slice(0, index), - { - ...entity, - schema: { - ...entity.schema, - properties: { - ...entity.schema.properties, - ...statementData.data - } - } - }, - ...entities.slice(index + 1) - ] - }; -}; - -const renameField = (entitiesData, bucket, statementData) => { - const { entities } = entitiesData; - - const index = findEntityIndex(entities, bucket, statementData.collectionName); - if (index === -1) { - return entitiesData; - } - - const entity = entities[index]; - const field = entity[statementData.nameFrom]; - - return { - ...entitiesData, - entities: [ - ...entities.slice(0, index), - { - ...entity, - schema: { - ...entity.schema, - properties: { - ...omitCaseInsensitive(entity.schema.properties, statementData.nameFrom), - [statementData.nameTo]: field - } - } - }, - ...entities.slice(index + 1) - ] - } -}; - -const createView = (entitiesData, bucket, statementData) => { - const { views } = entitiesData; - return { - ...entitiesData, - views: [ ...views, { - ...statementData, - bucketName: statementData.bucketName || bucket - }] - }; -}; - -const addDataToBucket = (entitiesData, bucket, statementData) => { - const { buckets } = entitiesData; - const bucketName = getCaseInsensitiveKey(buckets, bucket); - const { key, data } = statementData; - - return { - ...entitiesData, - buckets: { - ...buckets, - [bucketName]: { - ...buckets[bucketName], - [key]: [ - ...(buckets[bucketName][key] || []), - data - ] - } - } - } -} - -const findEntityIndex = (entities, bucket, name) => { - const entityIndex = entities.findIndex(entity => ( - isEqualCaseInsensitive(entity.bucketName, bucket) && - isEqualCaseInsensitive(entity.collectionName, name) - )); - - if (entityIndex !== -1) { - return entityIndex; - } - - return entities.findIndex(entity => entity.collectionName === name); -}; - -const getCaseInsensitiveKey = (object, key) => { - if (object[key]) { - return key; - } - - return Object.keys(object).find(objectKey => isEqualCaseInsensitive(objectKey, key)); -}; - -const omitCaseInsensitive = (object, key) => { - const objectCopy = { ...object }; - delete objectCopy[getCaseInsensitiveKey(object,key)]; - - return objectCopy; -}; - -const isEqualCaseInsensitive = (str1, str2) => (str1 || '').toLowerCase() ===(str2 || '').toLowerCase(); - -const remove = (items, index) => [...items.slice(0, index), ...items.slice(index + 1)]; - - -module.exports = { - convertCommandsToReDocs, - CREATE_COLLECTION_COMMAND, - REMOVE_COLLECTION_COMMAND, - CREATE_BUCKET_COMMAND, - REMOVE_BUCKET_COMMAND, - USE_BUCKET_COMMAND, - CREATE_DEFINITION_COMMAND, - ADD_FIELDS_TO_COLLECTION_COMMAND, - RENAME_FIELD_COMMAND, - CREATE_VIEW_COMMAND, - ADD_BUCKET_DATA_COMMAND, -} \ No newline at end of file diff --git a/reverse_engineering/commandsService.js b/reverse_engineering/commandsService.js deleted file mode 100644 index 40117c09..00000000 --- a/reverse_engineering/commandsService.js +++ /dev/null @@ -1,404 +0,0 @@ -const commandsHelper = require('./helpers/commandsHelper'); - -const CREATE_COLLECTION_COMMAND = 'createCollection'; -const REMOVE_COLLECTION_COMMAND = 'removeCollection'; -const CREATE_BUCKET_COMMAND = 'createBucket'; -const REMOVE_BUCKET_COMMAND = 'removeBucket'; -const UPDATE_BUCKET_COMMAND = 'updateBucket'; -const USE_BUCKET_COMMAND = 'useBucket'; -const CREATE_DEFINITION_COMMAND = 'createDefinition'; -const ADD_FIELDS_TO_COLLECTION_COMMAND = 'addFieldsToCollection'; -const RENAME_FIELD_COMMAND = 'renameField'; -const CREATE_VIEW_COMMAND = 'createView'; -const ADD_BUCKET_DATA_COMMAND = 'addBucketData'; -const ADD_COLLECTION_LEVEL_INDEX_COMMAND = 'addCollectionLevelIndex'; -const ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND = 'addCollectionLevelSearchIndex' -const UPDATE_ENTITY_LEVEL_DATA_COMMAND = 'updateEntityLevelData'; -const UPDATE_VIEW_LEVEL_DATA_COMMAND = 'updateViewLevelData'; -const ADD_FIELDS_TO_DEFINITION_COMMAND = 'addFieldsToDefinition' - -const DEFAULT_BUCKET = 'New Keyspace'; - -const initialState = { - entities: [], - views: [], - currentBucket: DEFAULT_BUCKET, - buckets: {}, - definitions: {}, -}; - -const convertCommandsToEntities = commands => { - return commands.reduce((entitiesData, statementData) => { - const command = statementData && statementData.type; - - const action = commandActionsMap[command]; - - if (!action) { - return entitiesData; - } - - return action(entitiesData, statementData); - }, initialState); -}; - - -const convertCommandsToReDocs = commands => { - const { entities, views, definitions, buckets} = convertCommandsToEntities(commands); - - return entities.map(entity => { - const relatedViews = views.filter(view => view.collectionName.toLowerCase() === entity.collectionName.toLowerCase()); - - return { - objectNames: { - collectionName: entity.collectionName - }, - doc: { - dbName: entity.bucketName, - collectionName: entity.collectionName, - modelDefinitions: { definitions }, - bucketInfo: buckets[entity.bucketName] || {}, - entityLevel: entity.entityLevelData, - views: relatedViews.map(view => ({ - name: view.name, - jsonSchema: view.jsonSchema, - data: view.data - })) - }, - jsonSchema: entity.schema - } - }); -}; - -const createCollection = (entitiesData, statementData) => { - const { entities, currentBucket } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - - if (!statementData.bucketName) { - return { ...entitiesData, entities: [ ...entities, { ...statementData, bucketName: bucket } ] }; - } - - if (currentBucket === DEFAULT_BUCKET) { - return { - ...entitiesData, - entities: [ ...entities, statementData ], - bucketName: statementData.bucketName - }; - } else { - return { ...entitiesData, entities: [ ...entities, statementData ] }; - } -}; - -const removeCollection = (entitiesData, statementData) => { - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const index = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName) - if (index === -1) { - return entitiesData; - } - - return { ...entitiesData, entities: commandsHelper.remove(entities, index) } -}; - -const createBucket = (entitiesData, statementData) => { - const { buckets } = entitiesData; - const bucketName = statementData.name; - return { - ...entitiesData, - currentBucket: bucketName, - buckets: { ...buckets, [bucketName]: statementData.data || {}} - }; -}; - -const updateBucket = (entitiesData, statementData) => { - const { buckets } = entitiesData; - const bucketName = commandsHelper.getCaseInsensitiveKey(buckets, statementData.name); - const bucket = entitiesData[bucketName]; - if (!bucket) { - return entitiesData; - } - - return { - ...entitiesData, - currentBucket: bucketName, - buckets: { ...buckets, [bucketName]: { ...bucket, ...(statementData.data || {}) } } - }; -}; - -const removeBucket = (entitiesData, statementData) => { - const { buckets, entities } = entitiesData; - const bucketName = statementData.name; - - return { - currentBucket: DEFAULT_BUCKET, - buckets: commandsHelper.omitCaseInsensitive(buckets, bucketName), - entities: entities.filter(entity => !commandsHelper.isEqualCaseInsensitive(entity.bucketName, bucketName)) - }; -}; - -const useBucket = (entitiesData, statementData) => { - return { - ...entitiesData, - currentBucket: statementData.bucketName, - }; -}; - -const createDefinition = (entitiesData, statementData) => { - const { definitions } = entitiesData; - - return { - ...entitiesData, - definitions: { - ...definitions, - [statementData.name]: { - type: 'udt', - properties: statementData.properties - } - } - }; -}; - -const addFieldsToDefinition = (entitiesData, statementData) => { - const { definitions } = entitiesData; - const definitionName = commandsHelper.getCaseInsensitiveKey(definitions, statementData.name); - const definition = definitions[definitionName]; - if (!definition) { - return entitiesData; - } - - return { - ...entitiesData, - definitions: { - ...definitions, - [definitionName]: { - ...definition, - properties: { - ...definition.properties, - ...statementData.data - } - } - } - } -} - -const addFieldsToCollection = (entitiesData, statementData) => { - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const index = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName); - if (index === -1) { - return entitiesData; - } - - const entity = entities[index]; - - return { - ...entitiesData, - entities: commandsHelper.set(entities, index, { - ...entity, - schema: { - ...entity.schema, - properties: { - ...entity.schema.properties, - ...statementData.data - } - } - }) - }; -}; - -const updateEntityLevelData = (entitiesData, statementData) => { - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const index = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName); - if (index === -1) { - return entitiesData; - } - - const entity = entities[index]; - - return { - ...entitiesData, - entities: commandsHelper.set(entities, index, { - ...entity, - entityLevelData: commandsHelper.merge(entity.entityLevelData, statementData.data) - }) - }; -} - - -const updateViewLevelData = (entitiesData, statementData) => { - const { views } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const index = commandsHelper.findEntityIndex(views, bucket, statementData.name); - - const view = views[index]; - - return { - ...entitiesData, - views: commandsHelper.set(views, index, { - ...view, - data: commandsHelper.merge(view.data, statementData.data) - }) - }; -} - -const addIndexToCollection = (entitiesData, statementData) => { - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const entityIndex = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName); - if (entityIndex === -1) { - return entitiesData; - } - const entity = entities[entityIndex]; - const entityLevelData = entity.entityLevelData || {}; - const indexes = [ - ...entityLevelData.SecIndxs || [], - { - name: statementData.name, - SecIndxKey: [{name: statementData.column, type: statementData.columnType}], - indexType: statementData.indexType, - customOptions: statementData.customOptions, - indexIfNotExist: statementData.indexIfNotExist, - isSASI: statementData.isSASI - } - ]; - - return { - ...entitiesData, - entities: commandsHelper.set(entities, entityIndex, { - ...entity, - entityLevelData: { - ...entityLevelData, - SecIndxs: indexes - } - }) - }; -}; - -const addSearchIndexToCollection = (entitiesData, statementData) => { - let indexData = {...statementData} - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const entityIndex = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName); - if (entityIndex === -1) { - return entitiesData; - } - const entity = entities[entityIndex]; - const entityLevelData = entity.entityLevelData || {}; - if(indexData.searchIndexColumns.length === 1 && indexData.searchIndexColumns[0].key[0] === '*'){ - const indexColumnOptions = indexData.searchIndexColumns[0]; - const entityColumnsNames = Object.keys(entity.schema.properties) - const indexColumns = entityColumnsNames.map(colName => ({...indexColumnOptions, ...{key: [colName], }})) - indexData = { ...indexData, searchIndexColumns: indexColumns } - } - - return { - ...entitiesData, - entities: commandsHelper.set(entities, entityIndex, { - ...entity, - entityLevelData: { - ...entityLevelData, - ...indexData - } - }) - }; -}; - -const renameField = (entitiesData, statementData) => { - const { entities } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const index = commandsHelper.findEntityIndex(entities, bucket, statementData.collectionName); - if (index === -1) { - return entitiesData; - } - - const entity = entities[index]; - const field = entity[statementData.nameFrom]; - - return { - ...entitiesData, - entities: commandsHelper.set(entities, index, { - ...entity, - schema: { - ...entity.schema, - properties: { - ...commandsHelper.omitCaseInsensitive(entity.schema.properties, statementData.nameFrom), - [statementData.nameTo]: field - } - } - }) - } -}; - -const createView = (entitiesData, statementData) => { - const { views } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - - return { - ...entitiesData, - views: [ ...views, { - ...statementData, - bucketName: bucket - }] - }; -}; - -const addDataToBucket = (entitiesData, statementData) => { - const { buckets } = entitiesData; - const bucket = commandsHelper.getCurrentBucket(entitiesData, statementData); - const bucketName = commandsHelper.getCaseInsensitiveKey(buckets, bucket); - const { key, data } = statementData; - - return { - ...entitiesData, - buckets: { - ...buckets, - [bucketName]: { - ...buckets[bucketName], - [key]: [ - ...(buckets[bucketName][key] || []), - data - ] - } - } - } -}; - -const commandActionsMap = { - [CREATE_COLLECTION_COMMAND]: createCollection, - [REMOVE_COLLECTION_COMMAND]: removeCollection, - [CREATE_BUCKET_COMMAND]: createBucket, - [UPDATE_BUCKET_COMMAND]: updateBucket, - [REMOVE_BUCKET_COMMAND]: removeBucket, - [USE_BUCKET_COMMAND]: useBucket, - [CREATE_DEFINITION_COMMAND]: createDefinition, - [ADD_FIELDS_TO_COLLECTION_COMMAND]: addFieldsToCollection, - [UPDATE_ENTITY_LEVEL_DATA_COMMAND]: updateEntityLevelData, - [UPDATE_VIEW_LEVEL_DATA_COMMAND]: updateViewLevelData, - [RENAME_FIELD_COMMAND]: renameField, - [CREATE_VIEW_COMMAND]: createView, - [ADD_BUCKET_DATA_COMMAND]: addDataToBucket, - [ADD_COLLECTION_LEVEL_INDEX_COMMAND]: addIndexToCollection, - [ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND]: addSearchIndexToCollection, - [ADD_FIELDS_TO_DEFINITION_COMMAND]: addFieldsToDefinition, -}; - -module.exports = { - convertCommandsToReDocs, - - CREATE_COLLECTION_COMMAND, - REMOVE_COLLECTION_COMMAND, - CREATE_BUCKET_COMMAND, - REMOVE_BUCKET_COMMAND, - USE_BUCKET_COMMAND, - CREATE_DEFINITION_COMMAND, - ADD_FIELDS_TO_COLLECTION_COMMAND, - RENAME_FIELD_COMMAND, - CREATE_VIEW_COMMAND, - ADD_BUCKET_DATA_COMMAND, - UPDATE_BUCKET_COMMAND, - ADD_COLLECTION_LEVEL_INDEX_COMMAND, - ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND, - UPDATE_ENTITY_LEVEL_DATA_COMMAND, - UPDATE_VIEW_LEVEL_DATA_COMMAND, - ADD_FIELDS_TO_DEFINITION_COMMAND, -}; diff --git a/reverse_engineering/compileGrammars.sh b/reverse_engineering/compileGrammars.sh old mode 100755 new mode 100644 diff --git a/reverse_engineering/config.json b/reverse_engineering/config.json index 13a508af..57292860 100644 --- a/reverse_engineering/config.json +++ b/reverse_engineering/config.json @@ -3,9 +3,7 @@ "type": "file", "menu_label": "CQL File...", "name": "cql", - "extensions": [ - "cql" - ], + "extensions": ["cql"], "useMultipleFileReverse": true }, { @@ -14,15 +12,9 @@ "NO_DATABASES": "There is no databases in Datastax instance", "WRONG_CONNECTION": "Can not connect to DataStax instance" }, - "excludeDocKind": [ - "id" - ], - "connectionList": [ - "name", - "localDataCenter", - "user" - ], + "excludeDocKind": ["id"], + "connectionList": ["name", "localDataCenter", "user"], "widestColumn": "name", "helpUrl": "https://hackolade.com/help/ConnecttoaCassandrainstance.html" } -] \ No newline at end of file +] diff --git a/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json b/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json index 9b184ce9..79c58ea0 100644 --- a/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json +++ b/reverse_engineering/connection_settings_modal/connectionSettingsModalConfig.json @@ -16,20 +16,22 @@ "inputKeyword": "name", "inputType": "text", "inputPlaceholder": "Name" - }, { "inputLabel": "Installation", "inputKeyword": "clusterType", "inputType": "select", "defaultValue": "", - "options": [{ - "label": "Private", - "value": "" - }, { - "label": "DataStax Astra", - "value": "apolloCloud" - }] + "options": [ + { + "label": "Private", + "value": "" + }, + { + "label": "DataStax Astra", + "value": "apolloCloud" + } + ] }, { "inputLabel": "Hosts", @@ -87,7 +89,8 @@ } } ] - }, { + }, + { "lowerTab": "Authentication", "helpUrl": "https://hackolade.com/help/Usernamepassword1.html", "structure": [ @@ -96,13 +99,16 @@ "inputKeyword": "authType", "inputType": "select", "defaultValue": "credentials", - "options": [{ - "label": "Credentials", - "value": "credentials" - }, { - "label": "Token-based", - "value": "tokenBased" - }] + "options": [ + { + "label": "Credentials", + "value": "credentials" + }, + { + "label": "Token-based", + "value": "tokenBased" + } + ] }, { "inputLabel": "Username", @@ -124,8 +130,7 @@ "key": "authType", "value": "credentials" } - } - , + }, { "inputLabel": "Astra token", "inputKeyword": "astraToken", @@ -137,8 +142,9 @@ "value": "tokenBased" } } - ] - }, { + ] + }, + { "lowerTab": "SSL", "helpUrl": "https://hackolade.com/help/LDAP2.html", "disable": { @@ -150,16 +156,20 @@ "inputLabel": "SSL Type", "inputKeyword": "ssl", "inputType": "select", - "options": [{ - "label": "None", - "value": false - }, { - "label": "Java Keystore", - "value": "jks" - }, { - "label": "Certificates", - "value": true - }] + "options": [ + { + "label": "None", + "value": false + }, + { + "label": "Java Keystore", + "value": "jks" + }, + { + "label": "Certificates", + "value": true + } + ] }, { "inputLabel": "Certificate Authority", @@ -262,7 +272,7 @@ "inputType": "checkbox", "dependency": { "key": "ssl", - "value": [true, "true", "jks"] + "value": [true, "true", "jks"] } } ] @@ -312,13 +322,16 @@ "inputLabel": "SSH Auth Method", "inputKeyword": "ssh_method", "inputType": "select", - "options": [{ - "value": "privateKey", - "label": "Private Key" - }, { - "value": "password", - "label": "Password" - }], + "options": [ + { + "value": "privateKey", + "label": "Private Key" + }, + { + "value": "password", + "label": "Password" + } + ], "disable": { "key": "ssh", "value": false @@ -371,7 +384,8 @@ } } ] - }, { + }, + { "lowerTab": "Advanced", "structure": [ { @@ -383,4 +397,4 @@ } ] } -] \ No newline at end of file +] diff --git a/reverse_engineering/cqlToCollectionsVisitor.js b/reverse_engineering/cqlToCollectionsVisitor.js deleted file mode 100644 index fcc5619f..00000000 --- a/reverse_engineering/cqlToCollectionsVisitor.js +++ /dev/null @@ -1,1105 +0,0 @@ -const { CqlParserVisitor } = require('./parser/CqlParserVisitor'); -const { CqlParser } = require('./parser/CqlParser'); -const { - CREATE_COLLECTION_COMMAND, - REMOVE_COLLECTION_COMMAND, - CREATE_BUCKET_COMMAND, - REMOVE_BUCKET_COMMAND, - USE_BUCKET_COMMAND, - CREATE_DEFINITION_COMMAND, - ADD_FIELDS_TO_COLLECTION_COMMAND, - RENAME_FIELD_COMMAND, - CREATE_VIEW_COMMAND, - ADD_BUCKET_DATA_COMMAND, - ADD_COLLECTION_LEVEL_INDEX_COMMAND, - ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND, - UPDATE_BUCKET_COMMAND, - UPDATE_ENTITY_LEVEL_DATA_COMMAND, - UPDATE_VIEW_LEVEL_DATA_COMMAND, - ADD_FIELDS_TO_DEFINITION_COMMAND, -} = require('./commandsService'); - -const ALLOWED_COMMANDS = [ - CqlParser.RULE_createTable, - CqlParser.RULE_createKeyspace, - CqlParser.RULE_dropTable, - CqlParser.RULE_dropKeyspace, - CqlParser.RULE_createType, - CqlParser.RULE_alterTable, - CqlParser.RULE_createMaterializedView, - CqlParser.RULE_use, - CqlParser.RULE_createFunction, - CqlParser.RULE_createAggregate, - CqlParser.RULE_alterKeyspace, - CqlParser.RULE_alterMaterializedView, - CqlParser.RULE_createIndex, - CqlParser.RULE_createSearchIndex, - CqlParser.RULE_alterType -]; - -const DEFAULT_TYPE = { type: 'char' }; - -class Visitor extends CqlParserVisitor { - visitCql(ctx) { - if (ALLOWED_COMMANDS.includes(ctx.children[0].ruleIndex)) { - return super.visitCql(ctx)[0]; - } - return; - } - - visitCreateTable(ctx) { - const { properties, keyData } = this.visit(ctx.columnDefinitionList()); - const collectionName = this.visit(ctx.table()); - const bucketName = this.getKeyspaceName(ctx); - const optionsContext = ctx.withElement(); - const options = optionsContext ? this.visit(optionsContext) : { partitionKey: [], clusteringKey: [] }; - const comments = removeQuotes(options?.comment || ''); - delete options?.comment; - const tableIfNotExist = this.visitFlagValue(ctx, 'ifNotExist'); - - return { - type: CREATE_COLLECTION_COMMAND, - collectionName, - bucketName, - schema: { - collectionName, - type: 'object', - properties, - }, - entityLevelData: { - comments, - tableOptions: options, - compositePartitionKey: keyData.partitionKey, - compositeClusteringKey: mergeClusteringKeys(options.clusteringKey, keyData.clusteringKey), - tableIfNotExist, - } - } - } - - visitCreateKeyspace(ctx) { - const name = this.getKeyspaceName(ctx) - const replicationProperties = this.visit(ctx.replicationList()); - const durableWrites = ctx.durableWrites() ? !!(this.visit(ctx.durableWrites())) : true; - const keyspaceIfNotExist = this.visitFlagValue(ctx, 'ifNotExist'); - return { - type: CREATE_BUCKET_COMMAND, - name, - data: { - ...replicationProperties, - durableWrites, - keyspaceIfNotExist - }, - }; - } - - visitCreateMaterializedView(ctx) { - const name = this.visit(ctx.materializedView()); - const table = this.visit(ctx.table()); - const columns = this.visit(ctx.columnList()); - const optionsContext = ctx.materializedViewOptions(); - const options = optionsContext ? this.visit(optionsContext) : {}; - const comments = removeQuotes(options?.comment || ''); - delete options?.comment; - const schema = getViewSchema(table, columns); - const keyspace = ctx.keyspace()[0]; - const bucketName = keyspace ? this.visit(keyspace) : ''; - const primaryKeyContext = ctx.primaryKeyElement(); - const keyData = primaryKeyContext ? this.visit(primaryKeyContext) : { partitionKey: [], clusteringKey: [] }; - const viewIfNotExist = this.visitFlagValue(ctx, 'ifNotExist') - - return { - type: CREATE_VIEW_COMMAND, - name, - bucketName, - collectionName: table, - jsonSchema: { properties: schema }, - data: { - comments, - tableOptions: options, - compositePartitionKey: keyData.partitionKey, - compositeClusteringKey: keyData.clusteringKey, - viewIfNotExist - } - }; - } - - visitSecondaryIndex(ctx) { - const keyspace = this.getKeyspaceName(ctx); - const column = this.visit(ctx.indexColumnSpec()); - const nameContext = ctx.indexName(); - const name = nameContext ? this.visit(nameContext) : ''; - const indexIfNotExist = this.visitFlagValue(ctx, 'ifNotExist') - return { - type: ADD_COLLECTION_LEVEL_INDEX_COMMAND, - bucketName: keyspace, - collectionName: this.visit(ctx.table()), - name, - column: column.name, - columnType: column.type, - indexIfNotExist - }; - } - - visitCustomIndex(ctx) { - const keyspace = this.getKeyspaceName(ctx); - const column = this.visit(ctx.indexColumnSpec()); - const nameContext = ctx.indexName(); - const name = nameContext ? this.visit(nameContext) : ''; - const indexIfNotExist = this.visitFlagValue(ctx, 'ifNotExist'); - const customOptions = this.visitIfExists(ctx, 'customIndexOption', []).reduce((options, option)=>({...options, ...option}),{}); - const isSASI = this.visitFlagValue(ctx, 'kwSASIIndex'); - return { - type: ADD_COLLECTION_LEVEL_INDEX_COMMAND, - bucketName: keyspace, - collectionName: this.visit(ctx.table()), - name, - column: column.name, - columnType: column.type, - indexType: 'custom', - customOptions, - indexIfNotExist, - isSASI - }; - } - - visitCustomIndexOption(ctx){ - if(ctx.caseSensitiveOption){ - return {case_sensitive: ctx.caseSensitiveOption.getText().toLowerCase() === `'true'`} - } - if(ctx.normalizeOption){ - return {normalize: ctx.normalizeOption.getText().toLowerCase() === `'true'`} - } - if(ctx.asciiOption){ - return {ascii: ctx.asciiOption.getText().toLowerCase() === `'true'`} - } - if(ctx.analyzedOption){ - return {analyzed: ctx.analyzedOption.getText().toLowerCase() === `'true'`} - } - if(ctx.similarityFunctionOption){ - return {similarity_function: ctx.similarityFunctionOption.getText().replaceAll('\'','')} - } - if(ctx.isLiteralOption){ - return {isLiteral: ctx.isLiteralOption.getText().toLowerCase() === `'true'`} - } - if(ctx.tokenizationEnableStemmingOption){ - return {tokenizationEnableStemming: ctx.tokenizationEnableStemmingOption.getText().toLowerCase() === `'true'`} - } - if(ctx.tokenizationNormalizeLowercaseOption){ - return {tokenizationNormalizeLowercase: ctx.tokenizationNormalizeLowercaseOption.getText().toLowerCase() === `'true'`} - } - if(ctx.tokenizationNormalizeUppercaseOption){ - return {tokenizationNormalizeUppercase: ctx.tokenizationNormalizeUppercaseOption.getText().toLowerCase() === `'true'`} - } - if(ctx.normalizeUppercaseOption){ - return {normalizeUppercase: ctx.normalizeUppercaseOption.getText().toLowerCase() === `'true'`} - } - if(ctx.normalizeLowercaseOption){ - return {normalizeLowercase: ctx.normalizeLowercaseOption.getText().toLowerCase() === `'true'`} - } - if(ctx.maxCompactionFlushMemoryInMbOption){ - return {maxCompactionFlushMemoryInMb: parseInt(ctx.maxCompactionFlushMemoryInMbOption.getText().replaceAll('\'',''),10)} - } - if(ctx.modeOption){ - return {mode: ctx.modeOption.getText().replaceAll('\'','')} - } - if(ctx.analyzerClassOption){ - return {analyzerClass: ctx.analyzerClassOption.getText().replaceAll('\'','')} - } - if(ctx.tokenizationLocaleOption){ - return {tokenizationLocale: ctx.tokenizationLocaleOption.getText().replaceAll('\'','')} - } - if(ctx.tokenizationSkipStopWordsOption){ - return {tokenizationSkipStopWords: ctx.tokenizationSkipStopWordsOption.getText().replaceAll('\'','')} - } - return {} - } - - visitCreateSearchIndex(ctx) { - return { - type: ADD_COLLECTION_LEVEL_SEARCH_INDEX_COMMAND, - bucketName: this.getKeyspaceName(ctx), - collectionName: this.visit(ctx.table()), - searchIndex: true, - searchIndexColumns: this.visitIfExists(ctx, 'searchIndexColumnList'), - searchIndexProfiles: this.visitIfExists(ctx, 'searchIndexProfiles'), - searchIndexConfig: this.visitIfExists(ctx, 'searchIndexConfigs'), - searchIndexOptions: this.visitIfExists(ctx, 'searchIndexOptions'), - searchIndexIfNotExist: this.visitFlagValue(ctx, 'ifNotExist') - }; - } - - visitSearchIndexOptions(ctx) { - return { - recovery: ctx.recoveryOption ? ctx.recoveryOption.getText().toLowerCase() === `true` : false, - reindex: ctx.reindexOption ? ctx.reindexOption.getText().toLowerCase() === `true` : false, - lenient: ctx.lenientOption ? ctx.lenientOption.getText().toLowerCase() === `true` : false - } - } - - visitSearchIndexConfigs(ctx) { - return { - autoCommitTime: ctx.autoCommitTimeConfig ? ctx.autoCommitTimeConfig.getText() : 1000, - defaultQueryField: ctx.defaultQueryFieldConfig ? removeQuotes(ctx.defaultQueryFieldConfig.getText()) : '', - directoryFactory: ctx.directoryFactoryConfig ? removeQuotes(ctx.directoryFactoryConfig.getText()) : '', - filterCacheLowWaterMark: ctx.filterCacheLowWaterMarkConfig ? ctx.filterCacheLowWaterMarkConfig.getText() : 1024, - filterCacheHighWaterMark: ctx.filterCacheHighWaterMarkConfig ? ctx.filterCacheHighWaterMarkConfig.getText() : 2048, - directoryFactoryClass: ctx.directoryFactoryClassConfig ? removeQuotes(ctx.directoryFactoryClassConfig.getText()) : '', - mergeMaxThreadCount: ctx.mergeMaxThreadCountConfig ? ctx.mergeMaxThreadCountConfig.getText() : '', - mergeMaxMergeCount: ctx.mergeMaxMergeCountConfig ? ctx.mergeMaxMergeCountConfig.getText() : '', - ramBufferSize: ctx.ramBufferSizeConfig ? ctx.ramBufferSizeConfig.getText() : 512, - realtime: ctx.realtimeConfig ? ctx.realtimeConfig.getText().toLowerCase() === `true` : false - } - } - - visitSearchIndexProfiles(ctx) { - let profiles = ctx.getText(); - - if (typeof profiles === 'string') { - profiles = profiles.split(',').map(item => item.trim()); - } - - if (profiles.map(item => item.toLowerCase()).includes('spacesavingall')) { - return [ - "spaceSavingNoJoin", - "spaceSavingNoTextfield", - "spaceSavingSlowTriePrecision" - ]; - } - - return profiles; - } - - visitSearchIndexColumnList(ctx) { - return this.visit(ctx.searchIndexColumn()) - } - - visitSearchIndexColumn(ctx) { - let key; - if (ctx.star) { - key = '*' - } else { - key = ctx.column().getText() - } - const copyField = ctx.copyFieldOption ? ctx.copyFieldOption.getText().toLowerCase() === `true` : false; - const docValues = ctx.docValuesOption ? ctx.docValuesOption.getText().toLowerCase() === `true` : false; - const excluded = ctx.excludedOption ? ctx.excludedOption.getText().toLowerCase() === `true` : false; - const indexed = ctx.indexedOption ? ctx.indexedOption.getText().toLowerCase() === `true` : false; - const lowerCase = ctx.lowerCase?.getText().toLowerCase() === 'true'; - return { - key: [key], - copyField, - docValues, - excluded, - indexed, - lowerCase, - }; - } - - visitCreateType(ctx) { - const name = this.visit(ctx.type()); - const properties = listToJson(this.visit(ctx.typeMemberColumnList())) - - return { - type: CREATE_DEFINITION_COMMAND, - name, - properties - } - } - - visitCreateAggregate(ctx) { - const keyspace = this.getKeyspaceName(ctx); - const name = this.visit(ctx.aggregate()); - const [sFunc, finalFunc] = this.visit(ctx.functionStatement()); - const fullName = keyspace ? `${keyspace}.${name}` : name; - const initCond = this.visit(ctx.initCondDefinition()); - - const [argType, sType] = ctx.dataType().map(context => context.getText()); - - let statement = 'CREATE'; - if (ctx.orReplace()) { - statement += ' OR REPLACE'; - } - statement += ` AGGREGATE` - if (ctx.ifNotExist()) { - statement += ' IF NOT EXIST'; - } - statement += ` ${fullName} (${argType})\n\tSFUNC ${sFunc}\n\tSTYPE ${sType}\n\tFINALFUNC ${finalFunc}\n\tINITCOND ${initCond};`; - - return { - type: ADD_BUCKET_DATA_COMMAND, - bucketName: keyspace, - key: 'UDAs', - data: { - name, - storedProcFunction: statement, - } - }; - } - - visitCreateFunction(ctx) { - const keyspace = this.getKeyspaceName(ctx); - const name = this.visit(ctx.functionStatement()); - const fullName = keyspace ? `${keyspace}.${name}` : name; - const body = this.visit(ctx.codeBlock()); - const language = this.visit(ctx.language()); - const params = this.visit(ctx.paramList()); - const returnMode = this.visit(ctx.returnMode()); - - const returnsType = ctx.dataType().getText(); - - let statement = 'CREATE'; - if (ctx.orReplace()) { - statement += ' OR REPLACE'; - } - statement += ` FUNCTION` - if (ctx.ifNotExist()) { - statement += ' IF NOT EXIST'; - } - statement += ` ${fullName} ${params}\n\t${returnMode}\n\tRETURNS ${returnsType}\n\tLANGUAGE ${language} AS\n\t${body};`; - - return { - type: ADD_BUCKET_DATA_COMMAND, - bucketName: keyspace, - key: 'UDFs', - data: { - name, - functionBody: statement, - } - }; - } - - visitUse(ctx) { - return { - type: USE_BUCKET_COMMAND, - bucketName: this.getKeyspaceName(ctx) - } - } - - visitAlterTable(ctx) { - const bucketName = this.getKeyspaceName(ctx); - const operationContext = ctx.alterTableOperation(); - const alterTableAdd = operationContext.alterTableAdd(); - const alterTableRename = operationContext.alterTableRename(); - const alterTableUpdateOptions = operationContext.alterTableWith(); - const collectionName = this.visit(ctx.table()); - - if (alterTableAdd) { - return { - type: ADD_FIELDS_TO_COLLECTION_COMMAND, - collectionName, - bucketName, - data: listToJson(this.visit(alterTableAdd.alterTableColumnDefinition())) - }; - } - - if (alterTableRename) { - const [column1, column2] = alterTableRename.column(); - - return { - type: RENAME_FIELD_COMMAND, - collectionName, - bucketName, - nameFrom: this.visit(column1), - nameTo: this.visit(column2) - } - } - - - if (alterTableUpdateOptions) { - const tableOptions = this.visit(alterTableUpdateOptions.tableOptions()); - - return { - type: UPDATE_ENTITY_LEVEL_DATA_COMMAND, - collectionName, - bucketName, - data: { - tableOptions - } - } - } - } - - visitAlterKeyspace(ctx) { - return { - ...this.visitCreateKeyspace(ctx), - type: UPDATE_BUCKET_COMMAND - }; - } - - visitAlterMaterializedView(ctx) { - const name = this.visit(ctx.materializedView()); - const optionsContext = ctx.materializedViewOptions(); - const options = optionsContext ? this.visit(optionsContext) : {}; - const keyspace = this.getKeyspaceName(ctx); - const bucketName = keyspace ? this.visit(keyspace) : ''; - - return { - type: UPDATE_VIEW_LEVEL_DATA_COMMAND, - name, - bucketName, - data: { - tableOptions: options - } - }; - } - - visitAlterType(ctx) { - const name = this.visit(ctx.type()); - const bucketName = this.getKeyspaceName(ctx); - const operationContext = ctx.alterTypeOperation(); - const alterTypeAdd = operationContext.alterTypeAdd(); - - if (alterTypeAdd) { - return { - type: ADD_FIELDS_TO_DEFINITION_COMMAND, - name, - bucketName, - data: listToJson(this.visit(ctx.typeMemberColumnList())) - }; - } - - } - - visitDropTable(ctx) { - return { - type: REMOVE_COLLECTION_COMMAND, - bucketName: this.getKeyspaceName(ctx), - collectionName: this.visit(ctx.table()) - } - } - - visitDropKeyspace(ctx) { - return { - type: REMOVE_BUCKET_COMMAND, - bucketName: this.getKeyspaceName(ctx) - } - } - - visitDurableWrites(ctx) { - return this.visit(ctx.booleanLiteral()); - } - - visitReplicationList(ctx) { - const items = this.visit(ctx.replicationListItem()); - - const definedKeys = ['replStrategy', 'replFactor'] - - return items.reduce( - (replicationProperties, item) => { - const key = Object.keys(item)[0]; - - if (!definedKeys.includes(key)) { - const dataCenter = { dataCenterName: key, replFactorValue: Number(item[key]) || 0 }; - - return { - ...replicationProperties, - dataCenters: [...replicationProperties.dataCenters, dataCenter], - }; - } - - return { - ...replicationProperties, - ...item, - }; - }, - { dataCenters: [] } - ); - } - - visitReplicationListItem(ctx) { - const data = ctx.getText(); - const REPLICATION_LIST_ITEMS_KEY_MAP = { - 'class': 'replStrategy', - 'replication_factor': 'replFactor' - }; - const REPLICATION_VALUE_MAP = { - 'networktopologystrategy': 'NetworkTopologyStrategy', - 'simplestrategy': 'SimpleStrategy' - }; - - const [key, value] = data.split(':').map(removeQuotes); - const targetKey = REPLICATION_LIST_ITEMS_KEY_MAP[key.toLowerCase()] || key; - let targetValue = REPLICATION_VALUE_MAP[key.toLowerCase()] || value; - - if (targetKey === 'replFactor') { - targetValue = Number(targetValue) || 0; - } - - return { [targetKey]: targetValue }; - } - - visitIndexColumnSpec(ctx) { - if (ctx.column()) { - return { - name: this.visit(ctx.column()), - type: '' - }; - } - const keysContext = ctx.indexKeysSpec(); - const entriesContext = ctx.indexEntriesSSpec(); - const fullContext = ctx.indexFullSpec(); - const valuesContext = ctx.indexValuesSpec(); - - const context = keysContext || entriesContext || fullContext || valuesContext; - - return this.visit(context); - } - - visitIndexKeysSpec(ctx) { - return { - name: this.visit(ctx.column()), - type: 'keys' - }; - } - - visitIndexEntriesSSpec(ctx) { - return { - name: this.visit(ctx.column()), - type: 'entries' - }; - } - - visitIndexFullSpec(ctx) { - return { - name: this.visit(ctx.column()), - type: 'full' - }; - } - - visitIndexValuesSpec(ctx) { - return { - name: this.visit(ctx.column()), - type: 'values' - }; - } - - visitColumnList(ctx) { - return this.visit(ctx.column()); - } - - visitMaterializedViewOptions(ctx) { - return this.visit(ctx.tableOptions()); - } - - visitReturnMode(ctx) { - const start = ctx.kwCalled() ? 'CALLED' : 'RETURNS NULL'; - return `${start} ON NULL INPUT`; - } - - visitParamList(ctx) { - const params = ctx.param(); - if (!params) { - return '()'; - } - - return '(' + this.visit(params).join(',') + ')'; - } - - visitParam(ctx) { - const name = this.visit(ctx.paramName()); - const type = ctx.dataType().getText(); - - return `${name} ${type}`; - } - - visitTableOptions(ctx) { - return this.visit(ctx.tableOptionItem()).filter(Boolean).reduce((options, data) => { - if (data.key === 'clusteringKey') { - return { - ...options, - [data.key]: data.value - } - } - - const key = tableOptionsHashMap[data.key.toLowerCase()]; - if (key === 'caching') { - return { - ...options, - [key]: getCachingOptionValue(data.value) - } - } - - const value = isNaN(data.value) ? removeQuotes(data.value || '') : Number(data.value); - if (!key) { - const otherProperties = options.otherProperties || []; - return { - ...options, - otherProperties: [ - ...otherProperties, - { - name: data.key, - value - }, - ], - } - } - - return { - ...options, - [key]: value - } - }, {}); - } - - visitTableOptionItem(ctx) { - if (ctx.clusteringOrder()) { - return { - key: 'clusteringKey', - value: this.visit(ctx.clusteringOrder()), - } - } - - const valueContext = ctx.tableOptionValue() || ctx.optionHash(); - - return { - key: ctx.tableOptionName().getText(), - value: valueContext.getText() - }; - } - - visitClusteringOrder(ctx) { - return this.visit(ctx.clusteringOrderColumns()); - } - - visitClusteringOrderColumns(ctx) { - const columnsData = { - names: this.visit(ctx.column()), - directions: this.visit(ctx.orderDirection()) - } - - return columnsData.names.map((columnName, index) => { - return { - name: columnName, - type: getKeyType(columnsData.directions[index]), - } - }) - } - - visitOrderDirection(ctx) { - return ctx.getText() - } - - visitDataType(ctx) { - const type = this.visit(ctx.dataTypeName()); - const COMPLEX_TYPES = ['map', 'tuple', 'list', 'set', 'vector']; - const hackoladeType = getTargetType(type); - - const typeDescription = ctx.dataTypeDefinition(); - if (!hackoladeType) { - if (isFrozen(type)) { - return { - ...this.visit(typeDescription)[0], - frozen: true, - } - } - - return { - type: 'reference', - $ref: '#/definitions/' + (type || '').split('.').slice(-1)?.[0] || type, - }; - } - - const isComplexType = COMPLEX_TYPES.includes(hackoladeType.type); - if (!isComplexType) { - return hackoladeType - } - - const [description1, description2] = typeDescription ? this.visit(typeDescription) : [DEFAULT_TYPE, DEFAULT_TYPE]; - - if (hackoladeType.type === 'map') { - return { - ...hackoladeType, - keyType: description1.type, - keySubtype: description2.mode, - subtype: `map<${complexTypeMapper(description2.type || '')}>`, - properties: [Object.assign({ name: 'New column' }, description2)], - }; - } - - if (hackoladeType.type === 'vector') { - const decimalLiteralContext = typeDescription.decimalLiteral(); - const [dimension] = decimalLiteralContext ? this.visit(decimalLiteralContext) : [1]; - - return { - ...hackoladeType, - subtype: description1.mode, - dimension: dimension, - properties: [{ - ...description1, - name: 'New column', - }], - }; - } - - return { - ...hackoladeType, - subtype: `${hackoladeType.type}<${complexTypeMapper(description1.type || '')}>`, - items: description1 - } - } - - visitColumnDefinitionList(ctx) { - const primaryKeyContext = ctx.primaryKeyElement(); - const keyData = primaryKeyContext ? this.visit(primaryKeyContext) : { partitionKey: [], clusteringKey: [] }; - const columns = this.visit(ctx.columnDefinition()); - const primaryKeysFromColumns = columns.filter(column => column.isPrimaryKey).map(column => ({ name: column.name })); - - return { - properties: columns.reduce((properties, column) => ({ - ...properties, - [column.name]: column.type - }), {}), - keyData: { - ...keyData, - partitionKey: [...keyData.partitionKey, ...primaryKeysFromColumns] - } - }; - } - - visitWithElement(ctx) { - return this.visit(ctx.tableOptions()); - } - - visitPrimaryKeyElement(ctx) { - const keyData = this.visit(ctx.primaryKeyDefinition())[0]; - - return { - partitionKey: keyData.partitionKey.map(key => ({ name: key, type: getKeyType() })), - clusteringKey: keyData.clusteringKey.map(key => ({ name: key, type: getKeyType() })), - } - } - - visitSinglePrimaryKey(ctx) { - return { - partitionKey: [this.visit(ctx.column())], - clusteringKey: [] - } - } - - visitCompoundKey(ctx) { - const partitionKey = [this.visit(ctx.partitionKey())]; - const clusteringKeyList = ctx.clusteringKeyList(); - const clusteringKey = clusteringKeyList ? this.visit(clusteringKeyList) : []; - - return { - partitionKey, clusteringKey - } - } - - visitCompositeKey(ctx) { - const partitionKey = this.visit(ctx.partitionKeyList()); - const clusteringKeyList = ctx.clusteringKeyList(); - const clusteringKey = clusteringKeyList ? this.visit(clusteringKeyList) : []; - - return { - partitionKey, clusteringKey - } - } - - visitColumnDefinition(ctx) { - const name = this.visit(ctx.column()); - const isPrimaryKey = !!ctx.primaryKeyColumn(); - - return { name, type: this.visit(ctx.dataType()), isPrimaryKey }; - } - - visitPartitionKeyList(ctx) { - return this.visit(ctx.partitionKey()); - } - - visitClusteringKeyList(ctx) { - return this.visit(ctx.clusteringKey()); - } - - visitPartitionKey(ctx) { - return this.visit(ctx.column()); - } - - visitClusteringKey(ctx) { - return this.visit(ctx.column()); - } - - visitCodeBlock(ctx) { - return ctx.getText(); - } - - visitDataTypeDefinition(ctx) { - return this.visit(ctx.dataType()); - } - - visitDecimalLiteral(ctx) { - return +ctx.getText(); - } - - visitBooleanLiteral(ctx) { - return (ctx.getText() || '').toLowerCase() === 'true'; - } - - visitLanguage(ctx) { - return ctx.getText(); - } - - visitParamName(ctx) { - return getName(ctx); - } - - visitInitCondDefinition(ctx) { - return getName(ctx); - } - - visitFunctionStatement(ctx) { - return getName(ctx); - } - - visitAggregate(ctx) { - return getName(ctx); - } - - visitDataTypeName(ctx) { - return getName(ctx); - } - - visitKeyspace(ctx) { - return getName(ctx); - } - - visitColumn(ctx) { - return getName(ctx); - } - - visitTable(ctx) { - return getName(ctx); - } - - visitType(ctx) { - return getName(ctx); - } - - visitMaterializedView(ctx) { - return getName(ctx); - } - - visitParamName(ctx) { - return getName(ctx); - } - - visitIndexName(ctx) { - return getName(ctx); - } - - visitStatementSeparator() { - return; - } - - visitSyntaxComma() { - return; - } - - getKeyspaceName(ctx) { - const keyspaceContext = ctx.keyspace(); - - return keyspaceContext ? this.visit(keyspaceContext) : ''; - } - - visitIfExists(ctx, funcName, defaultValue) { - try { - return this.visit(ctx[funcName]()); - } catch (e) { - return defaultValue; - } - } - - visitFlagValue(ctx, funcName) { - try { - this.visit(ctx[funcName]()); - return true; - } catch (e) { - return false; - } - } -} - -const getName = context => { - if (!context) { - return ''; - } - return removeQuotes(context.getText()); -} - -const removeQuotes = string => string.replace(/^(['"])([\s\S]*)\1$/m, '$2'); - -const listToJson = list => list.filter(Boolean).reduce((properties, data, index) => { - if (index % 2 === 0) { - return [...properties, { key: data }]; - } - const key = properties[properties.length - 1].key; - return [...properties.slice(0, -1), { key, value: data }]; -}, []).reduce((properties, item) => ({ - ...properties, [item.key]: item.value || DEFAULT_TYPE -}), {}); - -const isFrozen = type => type.toUpperCase() === 'FROZEN'; - -const getTargetType = (type) => { - type = removeQuotes((type || '').toLowerCase()); - switch (type) { - case "int": - return { - type: "numeric", - mode: "integer" - }; - case "smallint": - case "tinyint": - case "bigint": - case "counter": - case "decimal": - case "double": - case "float": - case "varint": - return { - type: "numeric", - mode: type - }; - case "text": - case "varchar": - case "ascii": - case "inet": - return { - type: "char", - mode: type - }; - case "duration": - return { - type: "duration" - } - case "pointtype": - case "linestringtype": - case "polygontype": - return { - type: "geospatial" - }; - case "daterangetype": - return { - type: "DateRangeType" - } - case "boolean": - return { - type: 'bool' - }; - case "timestamp": - case "timeuuid": - case "blob": - case "date": - case "time": - case "uuid": - return { type }; - case "tuple": - case "list": - case "set": - case "map": - case "vector": - return { type }; - default: - return; - } -}; - -const complexTypeMapper = type => { - switch (type) { - case "numeric": - return "num"; - case "char": - return "str"; - case "timestamp": - return "ts"; - case "blob": - case "date": - case "tuple": - case "list": - case "set": - case "map": - case "vector": - return type; - default: - return "udt"; - } -} - -const tableOptionsHashMap = { - 'comment': 'comment', - 'caching': 'caching', - 'compression': 'compression', - 'compaction': 'compaction', - 'dclocal_read_repair_chance': 'localReadRepairChance', - 'read_repair_chance': 'readRepairChance', - 'gc_grace_seconds': 'gcGraceSeconds', - 'bloom_filter_fp_chance': 'bloomFilterFalsePositiveChance', - 'default_time_to_live': 'defaultTtl', - 'speculative_retry': 'speculativeRetry', - 'min_index_interval': 'minIndexInterval', - 'max_index_interval': 'maxIndexInterval', - 'crc_check_chance': 'crcCheckChance', - 'memtable_flush_period_in_ms': 'memtableFlushPeriod', -}; - - -const getViewSchema = (tableName, columns) => { - return columns.reduce((schema, name) => { - return Object.assign({}, schema, { - [name]: { $ref: `#collection/definitions/${tableName}/${name}` } - }); - }, {}); -}; - -const getCachingOptionValue = value => { - try { - const data = JSON.parse(value.replace(/'/g, '"')); - return Object.keys(data).reduce((options, name) => { - const key = name.toLowerCase(); - if (key === 'rows_per_partition') { - return { - ...options, - rowsPerPartition: data[name] - } - } - - return { - ...options, - [key]: data[name] - } - }, {}); - } catch (err) { - return {}; - } -} - -const getKeyType = (type) => { - if (type === 'DESC') { - return 'descending'; - } - - return 'ascending'; -} - -const mergeClusteringKeys = (keysWithDirection = [], keys = []) => { - const keysWithDirectionNames = keysWithDirection.map(key => key.name); - - return keys.filter(key => !keysWithDirectionNames.includes(key.name)).concat(keysWithDirection); -} - -const checkIfSASI = (options) => { - return options.analyzed - || options.isLiteral - || options.tokenizationEnableStemming - || options.tokenizationNormalizeLowercase - || options.tokenizationNormalizeUppercase - || options.normalizeUppercase - || options.normalizeLowercase - || options.maxCompactionFlushMemoryInMb - || options.mode - || options.analyzerClass - || options.tokenizationLocale - || options.tokenizationSkipStopWords -} - -module.exports = Visitor; \ No newline at end of file diff --git a/reverse_engineering/grammars/CqlLexer.g4 b/reverse_engineering/grammars/CqlLexer.g4 deleted file mode 100644 index e328d9ed..00000000 --- a/reverse_engineering/grammars/CqlLexer.g4 +++ /dev/null @@ -1,1277 +0,0 @@ - -lexer grammar CqlLexer; - - -LR_BRACKET - : '(' - ; - - -RR_BRACKET - : ')' - ; - - -LC_BRACKET - : '{' - ; - - -RC_BRACKET - : '}' - ; - - -LS_BRACKET - : '[' - ; - - -RS_BRACKET - : ']' - ; - - -COMMA - : ',' - ; - - -SEMI - : ';' - ; - - -COLON - : ':' - ; - - -SPACE - : [ \t\r\n] + -> channel (HIDDEN) - ; - - -SPEC_MYSQL_COMMENT - : '/*!' . +? '*/' -> channel (HIDDEN) - ; - - -COMMENT_INPUT - : '/*' .*? '*/' -> channel (HIDDEN) - ; - - -LINE_COMMENT - : (('-- ' | '#' | '//') ~ [\r\n]* ('\r'? '\n' | EOF) | '--' ('\r'? '\n' | EOF)) -> channel (HIDDEN) - ; - - -DOT - : '.' - ; - - -STAR - : '*' - ; - - -DIVIDE - : '/' - ; - - -MODULE - : '%' - ; - - -PLUS - : '+' - ; - - -MINUSMINUS - : '--' - ; - - -MINUS - : '-' - ; - - -DQUOTE - : '"' - ; - - -SQUOTE - : '\'' - ; - -// Keywords - -K_ADD - : A D D | 'ADD' - ; - - -K_AGGREGATE - : A G G R E G A T E | 'AGGREGATE' - ; - - -K_ALL - : A L L | 'ALL' - ; - - -K_ALLOW - : A L L O W | 'ALLOW' - ; - - -K_ALTER - : A L T E R | 'ALTER' - ; - - -K_AND - : A N D | 'AND' - ; - - -K_ANY - : A N Y | 'ANY' - ; - - -K_APPLY - : A P P L Y | 'APPLY' - ; - - -K_AS - : A S | 'AS' - ; - - -K_ASC - : A S C | 'ASC' - ; - - -K_AUTHORIZE - : A U T H O R I Z E | 'AUTHORIZE' - ; - - -K_BATCH - : B A T C H | 'BATCH' - ; - - -K_BEGIN - : B E G I N | 'BEGIN' - ; - - -K_BY - : B Y | 'BY' - ; - - -K_CALLED - : C A L L E D | 'CALLED' - ; - - -K_CLUSTERING - : C L U S T E R I N G | 'CLUSTERING' - ; - - -K_COLUMNFAMILY - : C O L U M N F A M I L Y | 'COLUMNFAMILY' - ; - - -K_COMPACT - : C O M P A C T | 'COMPACT' - ; - - -K_CONSISTENCY - : C O N S I S T E N C Y | 'CONSISTENCY' - ; - - -K_CONTAINS - : C O N T A I N S | 'CONTAINS' - ; - - -K_CREATE - : C R E A T E | 'CREATE' - ; - - -K_CUSTOM - : C U S T O M | 'CUSTOM' - ; - -K_SEARCH - : S E A R C H | 'SEARCH' - ; - -K_DELETE - : D E L E T E | 'DELETE' - ; - - -K_DESC - : D E S C | 'DESC' - ; - - -K_DESCRIBE - : D E S C R I B E | 'DESCRIBE' - ; - - -K_DISTINCT - : D I S T I N C T | 'DISTINCT' - ; - - -K_DROP - : D R O P | 'DROP' - ; - - -K_DURABLE_WRITES - : D U R A B L E '_' W R I T E S | 'DURABLE_WRITES' - ; - - -K_EACH_QUORUM - : E A C H '_' Q U O R U M | 'EACH_QUORUM' - ; - - -K_ENTRIES - : E N T R I E S | 'ENTRIES' - ; - - -K_EXECUTE - : E X E C U T E | 'EXECUTE' - ; - - -K_EXISTS - : E X I S T S | 'EXISTS' - ; - - -K_FALSE - : F A L S E | 'FALSE' | SQUOTE F A L S E SQUOTE - ; - - -K_FILTERING - : F I L T E R I N G | 'FILTERING' - ; - - -K_FINALFUNC - : F I N A L F U N C | 'FINALFUNC' - ; - - -K_FROM - : F R O M | 'FROM' - ; - - -K_FULL - : F U L L | 'FULL' - ; - - -K_FUNCTION - : F U N C T I O N | 'FUNCTION' - ; - - -K_FUNCTIONS - : F U N C T I O N S | 'FUNCTIONS' - ; - - -K_GRANT - : G R A N T | 'GRANT' - ; - - -K_IF - : I F | 'IF' - ; - - -K_IN - : I N | 'IN' - ; - - -K_INDEX - : I N D E X | 'INDEX' - ; - - -K_INFINITY - : I N F I N I T Y | 'INFINITY' - ; - - -K_INITCOND - : I N I T C O N D | 'INITCOND' - ; - - -K_INPUT - : I N P U T | 'INPUT' - ; - - -K_INSERT - : I N S E R T | 'INSERT' - ; - - -K_INTO - : I N T O | 'INTO' - ; - - -K_IS - : I S | 'IS' - ; - -K_JSON - : J S O N | 'JSON' - ; - - -K_KEY - : K E Y | 'KEY' - ; - - -K_KEYS - : K E Y S | 'KEYS' - ; - - -K_KEYSPACE - : K E Y S P A C E | 'KEYSPACE' - ; - - -K_KEYSPACES - : K E Y S P A C E S | 'KEYSPACES' - ; - - -K_LANGUAGE - : L A N G U A G E | 'LANGUAGE' - ; - - -K_LEVEL - : L E V E L | 'LEVEL' - ; - - -K_LIMIT - : L I M I T | 'LIMIT' - ; - - -K_LOCAL_ONE - : L O C A L '_' O N E | 'LOCAL_ONE' - ; - - -K_LOCAL_QUORUM - : L O C A L '_' Q U O R U M | 'LOCAL_QUORUM' - ; - - -K_LOGGED - : L O G G E D | 'LOGGED' - ; - - -K_LOGIN - : L O G I N | 'LOGIN' - ; - - -K_MATERIALIZED - : M A T E R I A L I Z E D | 'MATERIALIZED' - ; - - -K_MODIFY - : M O D I F Y | 'MODIFY' - ; - - -K_NAN - : N A N | 'NAN' - ; - - -K_NORECURSIVE - : N O R E C U R S I V E | 'NORECURSIVE' - ; - - -K_NOSUPERUSER - : N O S U P E R U S E R | 'NOSUPERUSER' - ; - - -K_NOT - : N O T | 'NOT' - ; - - -K_NULL - : N U L L | 'NULL' - ; - - -K_OF - : O F | 'OF' - ; - - -K_ON - : O N | 'ON' - ; - - -K_ONE - : O N E | 'ONE' - ; - - -K_OPTIONS - : O P T I O N S | 'OPTIONS' - ; - - -K_OR - : O R | 'OR' - ; - - -K_ORDER - : O R D E R | 'ORDER' - ; - - -K_PARTITION - : P A R T I T I O N | 'PARTITION' - ; - - -K_PASSWORD - : P A S S W O R D | 'PASSWORD' - ; - - -K_PER - : P E R | 'PER' - ; - - -K_PERMISSION - : P E R M I S S I O N | 'PERMISSION' - ; - - -K_PERMISSIONS - : P E R M I S S I O N S | 'PERMISSIONS' - ; - - -K_PRIMARY - : P R I M A R Y | 'PRIMARY' - ; - - -K_QUORUM - : Q U O R U M | 'QUORUM' - ; - - -K_RENAME - : R E N A M E | 'RENAME' - ; - - -K_REPLACE - : R E P L A C E | 'REPLACE' - ; - - -K_REPLICATION - : R E P L I C A T I O N | 'REPLICATION' - ; - - -K_RETURNS - : R E T U R N S | 'RETURNS' - ; - - -K_REVOKE - : R E V O K E | 'REVOKE' - ; - - -K_ROLE - : R O L E | 'ROLE' - ; - -K_ROLES - : R O L E S | 'ROLES' - ; - -K_INTERNAL - : I N T E R N A L | 'INTERNAL' - ; - -K_LDAP - : L D A P | 'LDAP' - ; - -K_SCHEME - : S C E M E | 'SCHEME' - ; - - -K_SCHEMA - : S C H E M A | 'SCHEMA' - ; - - -K_SELECT - : S E L E C T | 'SELECT' - ; - - -K_SET - : S E T | 'SET' - ; - - -K_SFUNC - : S F U N C | 'SFUNC' - ; - - -K_STATIC - : S T A T I C | 'STATIC' - ; - - -K_STORAGE - : S T O R A G E | 'STORAGE' - ; - - -K_STYPE - : S T Y P E | 'STYPE' - ; - - -K_SUPERUSER - : S U P E R U S E R | 'SUPERUSER' - ; - - -K_TABLE - : T A B L E | 'TABLE' - ; - - -K_THREE - : T H R E E | 'THREE' - ; - - -K_TIMESTAMP - : T I M E S T A M P | 'TIMESTAMP' - ; - - -K_TO - : T O | 'TO' - ; - - -K_TOKEN - : T O K E N | 'TOKEN' - ; - - -K_TRIGGER - : T R I G G E R | 'TRIGGER' - ; - - -K_TRUE - : T R U E | 'TRUE' | SQUOTE T R U E SQUOTE - ; - - -K_TRUNCATE - : T R U N C A T E | 'TRUNCATE' - ; - - -K_TTL - : T T L | 'TTL' - ; - - -K_TWO - : T W O | 'TWO' - ; - - -K_TYPE - : T Y P E | 'TYPE' - ; - - -K_UNLOGGED - : U N L O G G E D | 'UNLOGGED' - ; - - -K_UPDATE - : U P D A T E | 'UPDATE' - ; - - -K_USE - : U S E | 'USE' - ; - - -K_USER - : U S E R | 'USER' - ; - - -K_USING - : U S I N G | 'USING' - ; - - -K_UUID - : U U I D | 'UUID' - ; - - -K_VALUES - : V A L U E S | 'VALUES' - ; - - -K_VIEW - : V I E W | 'VIEW' - ; - - -K_WHERE - : W H E R E | 'WHERE' - ; - - -K_WITH - : W I T H | 'WITH' - ; - - -K_WRITETIME - : W R I T E T I M E | 'WRITETIME' - ; - - -K_ASCII - : A S C I I - | SQUOTE A S C I I SQUOTE - ; - -K_CASE_SENITIVE - : SQUOTE C A S E '_' S E N S I T I V E SQUOTE - ; - -K_NORMALIZE - : SQUOTE N O R M A L I Z E SQUOTE - ; - -K_SIMILARITY_FUNCTION - : S I M I L A R I T Y '_' F U N C T I O N - | SQUOTE S I M I L A R I T Y '_' F U N C T I O N SQUOTE - ; - -K_ANALYZED - : SQUOTE A N A L Y Z E D SQUOTE - ; - -K_IS_LITERAL - : SQUOTE I S '_' L I T E R A L SQUOTE - ; - -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB - : SQUOTE M A X '_' C O M P A C T I O N '_' F L U S H '_' M E M O R Y '_' I N '_' M B SQUOTE - ; - -K_TOKENIZATION_ENABLE_STEMMING - : SQUOTE T O K E N I Z A T I O N '_' E N A B L E '_' S T E M M I N G SQUOTE - ; - -K_TOKENIZATION_SKIP_STOP_WORDS - : SQUOTE T O K E N I Z A T I O N '_' S K I P '_' S T O P '_' W O R D S SQUOTE - ; - -K_TOKENIZATION_LOCALE - : SQUOTE T O K E N I Z A T I O N '_' L O C A L E SQUOTE - ; - -K_TOKENIZATION_NORMALIZE_LOWERCASE - : SQUOTE T O K E N I Z A T I O N '_' N O R M A L I Z E '_' L O W E R C A S E SQUOTE - ; - -K_TOKENIZATION_NORMALIZE_UPPERCASE - : SQUOTE T O K E N I Z A T I O N '_' N O R M A L I Z E '_' U P P E R C A S E SQUOTE - ; - -K_NORMALIZE_LOWERCASE - : SQUOTE N O R M A L I Z E '_' L O W E R C A S E SQUOTE - ; - -K_NORMALIZE_UPPERCASE - : SQUOTE N O R M A L I Z E '_' U P P E R C A S E SQUOTE - ; - -K_MODE - : SQUOTE M O D E SQUOTE - ; - -K_ANALYZER_CLASS - : SQUOTE A N A L Y Z E R '_' C L A S S SQUOTE - ; - -K_STORAGE_ATTACHED_INDEX - : SQUOTE S T O R A G E A T T A C H E D I N D E X SQUOTE - ; - -K_SASI_INDEX - : SQUOTE O R G DOT A P A C H E DOT C A S S A N D R A DOT I N D E X DOT S A S I DOT S A S I I N D E X SQUOTE - ; - -K_SOLR_INDEX - : SQUOTE C O M DOT D A T A S T A X DOT B D P DOT S E A R C H DOT S O L R DOT C Q L '3' S O L R S E C O N D A R Y I N D E X SQUOTE - ; - -K_SPACE_SAVING_NO_JOIN - : S P A C E S A V I N G N O J O I N - ; - -K_SPACE_SAVING_ALL - : S P A C E S A V I N G A L L - ; - -K_SPACE_SAVING_SLOW_TRIE_PRECISION - : S P A C E S A V I N G S L O W T R I E P R E C I S I O N - ; - -K_SPACE_SAVING_NO_TEXT_FIELD - : S P A C E S A V I N G N O T E X T F I E L D - ; - -K_DOC_VALUES - : D O C V A L U E S - ; - -K_COPY_FIELD - : C O P Y F I E L D - ; - -K_EXCLUDED - : E X C L U D E D - ; - -K_INDEXED - : I N D E X E D - ; - -K_LOWERCASE - : L O W E R C A S E - ; - -K_COLUMNS - : C O L U M N S - ; - -K_PROFILES - : P R O F I L E S - ; - -K_CONFIG - : C O N F I G - ; - - -K_AUTOCOMMIT_TIME - : A U T O C O M M I T T I M E - ; - -K_DEFAULT_QUERY_FIELD - : D E F A U L T Q U E R Y F I E L D - ; - -K_DIRECTORY_FACTORY - : D I R E C T O R Y F A C T O R Y - ; - -K_FILTER_CACHE_LOW_WATERMARK - : F I L T E R C A C H E L O W W A T E R M A R K - ; - -K_FILTER_CACHE_HIGH_WATERMARK - : F I L T E R C A C H E H I G H W A T E R M A R K - ; - -K_DIRECTORY_FACTORY_CLASS - : D I R E C T O R Y F A C T O R Y C L A S S - ; - -K_MERGE_MAX_THREAD_COUNT - : M E R G E M A X T H R E A D C O U N T - ; - -K_MERGE_MAX_MERGE_COUNT - : M E R G E M A X M E R G E C O U N T - ; - -K_RAM_BUFFER_SIZE - : R A M B U F F E R S I Z E - ; - -K_REALTIME - : R E A L T I M E - ; - -K_RECOVERY - : R E C O V E R Y - ; - -K_REINDEX - : R E I N D E X - ; - -K_LENIENT - : L E N I E N T - ; - -K_STANDARD - :SQUOTE S T A N D A R D SQUOTE - ; - -K_ENCRYPTED - :SQUOTE E N C R Y P T E D SQUOTE - ; - -K_BIGINT - : B I G I N T - ; - - -K_BLOB - : B L O B - ; - - -K_BOOLEAN - : B O O L E A N - ; - - -K_COUNTER - : C O U N T E R - ; - - -K_DATE - : D A T E - ; - - -K_DECIMAL - : D E C I M A L - ; - - -K_DOUBLE - : D O U B L E - ; - - -K_FLOAT - : F L O A T - ; - - -K_FROZEN - : F R O Z E N - ; - - -K_INET - : I N E T - ; - - -K_INT - : I N T - ; - - -K_LIST - : L I S T - ; - - -K_MAP - : M A P - ; - - -K_SMALLINT - : S M A L L I N T - ; - - -K_TEXT - : T E X T - ; - - -K_TIMEUUID - : T I M E U U I D - ; - - -K_TIME - : T I M E - ; - - -K_TINYINT - : T I N Y I N T - ; - - -K_TUPLE - : T U P L E - ; - - -K_VARCHAR - : V A R C H A R - ; - - -K_VARINT - : V A R I N T - ; - - -fragment A - : [aA] - ; - - -fragment B - : [bB] - ; - - -fragment C - : [cC] - ; - - -fragment D - : [dD] - ; - - -fragment E - : [eE] - ; - - -fragment F - : [fF] - ; - - -fragment G - : [gG] - ; - - -fragment H - : [hH] - ; - - -fragment I - : [iI] - ; - - -fragment J - : [jJ] - ; - - -fragment K - : [kK] - ; - - -fragment L - : [lL] - ; - - -fragment M - : [mM] - ; - - -fragment N - : [nN] - ; - - -fragment O - : [oO] - ; - - -fragment P - : [pP] - ; - - -fragment Q - : [qQ] - ; - - -fragment R - : [rR] - ; - - -fragment S - : [sS] - ; - - -fragment T - : [tT] - ; - - -fragment U - : [uU] - ; - - -fragment V - : [vV] - ; - - -fragment W - : [wW] - ; - - -fragment X - : [xX] - ; - - -fragment Y - : [yY] - ; - - -fragment Z - : [zZ] - ; - - -fragment CODE_BLOCK_DELIMITER - : '$$' - ; - - -fragment CODE_BLOCK_FRAG - : '$$' (~ '$' | ('$' ~ ('$')))* '$$' - ; - - -fragment HEX_4DIGIT - : [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] [0-9a-fA-F] - ; - - -fragment OBJECT_NAME_FRAG - : [a-zA-Z] [A-Za-z0-9_$]* | '"' ~'"' + '"' - ; - - -fragment SQUOTA_STRING - : '\'' ('\\' . | '\'\'' | ~ ('\'' | '\\'))* '\'' - ; - - -CODE_BLOCK - : CODE_BLOCK_FRAG - ; - - -STRING_LITERAL - : SQUOTA_STRING - ; - - -DECIMAL_LITERAL - : DEC_DIGIT + - ; - - -FLOAT_LITERAL - : (MINUS)? [0-9] + (DOT [0-9] +)? - ; - - -HEXADECIMAL_LITERAL - : 'X' '\'' (HEX_DIGIT HEX_DIGIT) + '\'' | '0X' HEX_DIGIT + - ; - - -REAL_LITERAL - : (DEC_DIGIT +)? '.' DEC_DIGIT + | DEC_DIGIT + '.' EXPONENT_NUM_PART | (DEC_DIGIT +)? '.' (DEC_DIGIT + EXPONENT_NUM_PART) | DEC_DIGIT + EXPONENT_NUM_PART - ; - - -OBJECT_NAME - : OBJECT_NAME_FRAG - ; - - -UUID - : HEX_4DIGIT HEX_4DIGIT '-' HEX_4DIGIT '-' HEX_4DIGIT '-' HEX_4DIGIT '-' HEX_4DIGIT HEX_4DIGIT HEX_4DIGIT - ; - - -fragment HEX_DIGIT - : [0-9A-F] - ; - - -fragment DEC_DIGIT - : [0-9] - ; - - -fragment EXPONENT_NUM_PART - : 'E' '-'? DEC_DIGIT + - ; - - -fragment OPERATOR_EQ_FRAG - : '=' - ; - - -fragment OPERATOR_LT_FRAG - : '<' - ; - - -fragment OPERATOR_GT_FRAG - : '>' - ; - - -fragment OPERATOR_GTE_FRAG - : '>=' - ; - - -fragment OPERATOR_LTE_FRAG - : '<=' - ; - - -OPERATOR_EQ - : OPERATOR_EQ_FRAG - ; - - -OPERATOR_LT - : OPERATOR_LT_FRAG - ; - - -OPERATOR_GT - : OPERATOR_GT_FRAG - ; - - -OPERATOR_LTE - : OPERATOR_LTE_FRAG - ; - - -OPERATOR_GTE - : OPERATOR_GTE_FRAG - ; - - -K_USERS - : U S E R S | 'USERS' - ; - -K_VECTOR - : V E C T O R | 'VECTOR' - ; \ No newline at end of file diff --git a/reverse_engineering/grammars/CqlParser.g4 b/reverse_engineering/grammars/CqlParser.g4 deleted file mode 100644 index a5a6c8dd..00000000 --- a/reverse_engineering/grammars/CqlParser.g4 +++ /dev/null @@ -1,1749 +0,0 @@ -/* - * The MIT License (MIT) - * - * Copyright (c) 2014 by Domagoj Kovačević - * - * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and - * associated documentation files (the "Software"), to deal in the Software without restriction, - * including without limitation the rights to use, copy, modify, merge, publish, distribute, - * sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in all copies or - * substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT - * NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, - * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - * Project : cql-parser; an ANTLR4 grammar for Apache Cassandra CQL https://github.com/kdcro101cql-parser - */ - -parser grammar CqlParser; - -options - { tokenVocab = CqlLexer; } - -root - : cqls? MINUSMINUS? eof - ; - -cqls - : (cql MINUSMINUS? statementSeparator | empty)* (cql (MINUSMINUS? statementSeparator)? | empty) - ; - -statementSeparator - : SEMI - ; - -empty - : statementSeparator - ; - -cql - : alterKeyspace - | alterMaterializedView - | alterRole - | alterTable - | alterType - | alterUser - | applyBatch - | createAggregate - | createFunction - | createIndex - | createSearchIndex - | createKeyspace - | createMaterializedView - | createRole - | createTable - | createTrigger - | createType - | createUser - | deleteStatement - | dropAggregate - | dropFunction - | dropIndex - | dropKeyspace - | dropMaterializedView - | dropRole - | dropTable - | dropTrigger - | dropType - | dropUser - | grant - | insert - | listPermissions - | listRoles - | revoke - | select - | truncate - | update - | use - ; - -revoke - : kwRevoke priviledge kwOn resource kwFrom role - ; - -listUsers - : kwList kwUsers - ; - -listRoles - : kwList kwRoles (kwOf role)? kwNorecursive? - ; - -listPermissions - : kwList priviledge (kwOn resource)? (kwOf role)? - ; - -grant - : kwGrant priviledge kwOn resource kwTo role - ; - -priviledge - : (kwAll | kwAllPermissions) - | kwAlter - | kwAuthorize - | kwDescibe - | kwExecute - | kwCreate - | kwDrop - | kwModify - | kwSelect - ; - -resource - : kwAll kwFunctions - | kwAll kwFunctions kwIn kwKeyspace keyspace - | kwFunction (keyspace DOT)? functionStatement - | kwAll kwKeyspaces - | kwKeyspace keyspace - | (kwTable)? (keyspace DOT)? table - | kwAll kwRoles - | kwRole role - | (kwInternal|kwLdap) kwScheme - ; - -createUser - : kwCreate kwUser ifNotExist? user kwWith kwPassword stringLiteral (kwSuperuser | kwNosuperuser)? - ; - -createRole - : kwCreate kwRole ifNotExist? role roleWith? - ; - -createType - : kwCreate kwType ifNotExist? (keyspace DOT)? type syntaxBracketLr typeMemberColumnList syntaxBracketRr - ; - -typeMemberColumnList - : column dataType (syntaxComma column dataType)* - ; - -createTrigger - : kwCreate kwTrigger ifNotExist? (keyspace DOT)? trigger kwUsing triggerClass - ; - -createMaterializedView - : kwCreate kwMaterialized kwView ifNotExist? (keyspace DOT)? materializedView kwAs kwSelect columnList kwFrom (keyspace DOT)? table materializedViewWhere (primaryKeyElement)? (kwWith materializedViewOptions)? - ; - -materializedViewWhere - : kwWhere columnNotNullList (kwAnd relationElements)? - ; - -columnNotNullList - : columnNotNull (kwAnd columnNotNull)* - ; - -columnNotNull - : column kwIs kwNot kwNull - ; - -materializedViewOptions - : tableOptions - ; - -createKeyspace - : kwCreate kwKeyspace ifNotExist? keyspace kwWith kwReplication OPERATOR_EQ syntaxBracketLc replicationList syntaxBracketRc (kwAnd durableWrites)? - ; - -createFunction - : kwCreate orReplace? kwFunction ifNotExist? (keyspace DOT)? functionStatement syntaxBracketLr paramList? syntaxBracketRr returnMode kwReturns dataType kwLanguage language kwAs codeBlock - ; - -codeBlock - : CODE_BLOCK | STRING_LITERAL - ; - -paramList - : param (syntaxComma param)* - ; - -returnMode - : (kwCalled | kwReturns kwNull) kwOn kwNull kwInput - ; - -createAggregate - : kwCreate orReplace? kwAggregate ifNotExist? (keyspace DOT)? aggregate syntaxBracketLr dataType syntaxBracketRr kwSfunc functionStatement kwStype dataType kwFinalfunc functionStatement kwInitcond initCondDefinition - ; - -// paramList -// : -initCondDefinition - : constant - | initCondList - | initCondListNested - | initCondHash - ; - -initCondHash - : syntaxBracketLc initCondHashItem (syntaxComma initCondHashItem)* syntaxBracketRc - ; - -initCondHashItem - : hashKey COLON initCondDefinition - ; - -initCondListNested - : syntaxBracketLr initCondList (syntaxComma constant | initCondList)* syntaxBracketRr - ; - -initCondList - : syntaxBracketLr constant (syntaxComma constant)* syntaxBracketRr - ; - -orReplace - : kwOr kwReplace - ; - -alterUser - : kwAlter kwUser user kwWith userPassword userSuperUser? - ; - -userPassword - : kwPassword stringLiteral - ; - -userSuperUser - : kwSuperuser - | kwNosuperuser - ; - -alterType - : kwAlter kwType (keyspace DOT)? type alterTypeOperation - ; - -alterTypeOperation - : alterTypeAlterType - | alterTypeAdd - | alterTypeRename - ; - -alterTypeRename - : kwRename alterTypeRenameList - ; - -alterTypeRenameList - : alterTypeRenameItem (kwAnd alterTypeRenameItem)* - ; - -alterTypeRenameItem - : column kwTo column - ; - -alterTypeAdd - : kwAdd typeMemberColumnList - ; - -alterTypeAlterType - : kwAlter column kwType dataType - ; - -alterTable - : kwAlter kwTable (keyspace DOT)? table alterTableOperation - ; - -alterTableOperation - : alterTableAdd - | alterTableDropColumns - | alterTableDropColumns - | alterTableDropCompactStorage - | alterTableRename - | alterTableWith - ; - -alterTableWith - : kwWith tableOptions - ; - -alterTableRename - : kwRename column kwTo column - ; - -alterTableDropCompactStorage - : kwDrop kwCompact kwStorage - ; - -alterTableDropColumns - : kwDrop alterTableDropColumnList - ; - -alterTableDropColumnList - : column (syntaxComma column)* - ; - -alterTableAdd - : kwAdd alterTableColumnDefinition - ; - -alterTableColumnDefinition - : column dataType (syntaxComma column dataType)* - ; - -alterRole - : kwAlter kwRole role roleWith? - ; - -roleWith - : kwWith (roleWithOptions (kwAnd roleWithOptions)*) - ; - -roleWithOptions - : kwPassword OPERATOR_EQ stringLiteral - | kwLogin OPERATOR_EQ booleanLiteral - | kwSuperuser OPERATOR_EQ booleanLiteral - | kwOptions OPERATOR_EQ optionHash - ; - -alterMaterializedView - : kwAlter kwMaterialized kwView (keyspace DOT)? materializedView (kwWith tableOptions)? - ; - -dropUser - : kwDrop kwUser ifExist? user - ; - -dropType - : kwDrop kwType ifExist? (keyspace DOT)? type - ; - -dropMaterializedView - : kwDrop kwMaterialized kwView ifExist? (keyspace DOT)? materializedView - ; - -dropAggregate - : kwDrop kwAggregate ifExist? (keyspace DOT)? aggregate - ; - -dropFunction - : kwDrop kwFunction ifExist? (keyspace DOT)? functionStatement - ; - -dropTrigger - : kwDrop kwTrigger ifExist? trigger kwOn (keyspace DOT)? table - ; - -dropRole - : kwDrop kwRole ifExist? role - ; - -dropTable - : kwDrop kwTable ifExist? (keyspace DOT)? table - ; - -dropKeyspace - : kwDrop kwKeyspace ifExist? keyspace - ; - -dropIndex - : kwDrop kwIndex ifExist? (keyspace DOT)? indexName - ; - -createTable - : kwCreate kwTable ifNotExist? (keyspace DOT)? table syntaxBracketLr columnDefinitionList syntaxBracketRr withElement? - ; - -withElement - : kwWith tableOptions? - ; - -clusteringOrderColumns - : column orderDirection? (syntaxComma column orderDirection?)* - ; - -clusteringOrder - : kwClustering kwOrder kwBy syntaxBracketLr clusteringOrderColumns syntaxBracketRr - ; - -tableOptions - : tableOptionItem (kwAnd tableOptionItem)* - ; - -tableOptionItem - : tableOptionName OPERATOR_EQ tableOptionValue - | tableOptionName OPERATOR_EQ optionHash - | clusteringOrder - ; - -tableOptionName - : id - ; - -tableOptionValue - : stringLiteral - | floatLiteral - | id - ; - -optionHash - : syntaxBracketLc optionHashItem (syntaxComma optionHashItem)* syntaxBracketRc - ; - -optionHashItem - : optionHashKey COLON optionHashValue - ; - -optionHashKey - : stringLiteral - ; - -optionHashValue - : stringLiteral - | booleanLiteral - | floatLiteral - ; - -columnDefinitionList - : (columnDefinition) (syntaxComma columnDefinition)* (syntaxComma primaryKeyElement)? - ; - -// -columnDefinition - : column dataType primaryKeyColumn? - ; - -// -primaryKeyColumn - : kwPrimary kwKey - ; - -primaryKeyElement - : kwPrimary kwKey syntaxBracketLr primaryKeyDefinition syntaxBracketRr - ; - -primaryKeyDefinition - : singlePrimaryKey - | compoundKey - | compositeKey - ; - -singlePrimaryKey - : column - ; - -compoundKey - : partitionKey (syntaxComma clusteringKeyList)? - ; - -compositeKey - : syntaxBracketLr partitionKeyList syntaxBracketRr (syntaxComma clusteringKeyList)? - ; - -partitionKeyList - : (partitionKey) (syntaxComma partitionKey)* - ; - -clusteringKeyList - : (clusteringKey) (syntaxComma clusteringKey)* - ; - -partitionKey - : column - ; - -clusteringKey - : column - ; - -applyBatch - : kwApply kwBatch - ; - -beginBatch - : kwBegin batchType? kwBatch usingTimestampSpec? - ; - -batchType - : kwLogged - | kwUnlogged - ; - -alterKeyspace - : kwAlter kwKeyspace keyspace kwWith kwReplication OPERATOR_EQ syntaxBracketLc replicationList syntaxBracketRc (kwAnd durableWrites)? - ; - -replicationList - : (replicationListItem) (syntaxComma replicationListItem)* - ; - -replicationListItem - : STRING_LITERAL COLON STRING_LITERAL - | STRING_LITERAL COLON DECIMAL_LITERAL - ; - -durableWrites - : kwDurableWrites OPERATOR_EQ booleanLiteral - ; - -use - : kwUse keyspace - ; - -truncate - : kwTruncate (kwTable)? (keyspace DOT)? table - ; - -createIndex - : kwCreate kwIndex ifNotExist? indexName? kwOn (keyspace DOT)? table syntaxBracketLr indexColumnSpec syntaxBracketRr #secondaryIndex - | kwCreate kwCustom kwIndex ifNotExist? indexName? kwOn (keyspace DOT)? table syntaxBracketLr indexColumnSpec syntaxBracketRr kwUsing (kwStorageAttachedIndex | kwSASIIndex | kwSolrIndex) (kwWith kwOptions OPERATOR_EQ LC_BRACKET customIndexOption+ RC_BRACKET)? #customIndex - ; - -customIndexOption - : kwCaseSensitive COLON caseSensitiveOption=booleanLiteral COMMA? - | kwNormalize COLON normalizeOption=booleanLiteral COMMA? - | kwAscii COLON asciiOption=booleanLiteral COMMA? - | kwAnalyzed COLON analyzedOption=booleanLiteral COMMA? - | kwIsLiteral COLON isLiteralOption=booleanLiteral COMMA? - | kwTokenizationEnableStemming COLON tokenizationEnableStemmingOption=booleanLiteral COMMA? - | kwTokenizationNormalizeLowercase COLON tokenizationNormalizeLowercaseOption=booleanLiteral COMMA? - | kwTokenizationNormalizeUppercase COLON tokenizationNormalizeUppercaseOption=booleanLiteral COMMA? - | kwNormalizeUppercase COLON normalizeUppercaseOption=booleanLiteral COMMA? - | kwNormalizeLowercase COLON normalizeLowercaseOption=booleanLiteral COMMA? - | kwMaxCompactionFlushMemoryInMb COLON maxCompactionFlushMemoryInMbOption=stringLiteral COMMA? - | kwMode COLON modeOption=stringLiteral COMMA? - | kwAnalyzerClass COLON analyzerClassOption=stringLiteral COMMA? - | kwTokenizationLocale COLON tokenizationLocaleOption=stringLiteral COMMA? - | kwTokenizationSkipStopWords COLON tokenizationSkipStopWordsOption=stringLiteral COMMA? - | kwSimilarityFunction COLON similarityFunctionOption=stringLiteral COMMA? - ; - -createSearchIndex - : kwCreate kwSearch kwIndex ifNotExist? kwOn (keyspace DOT)? table ( K_WITH (kwColumns searchIndexColumnList)? (kwAnd? kwProfiles searchIndexProfiles)? (kwAnd? searchIndexConfigs)? (kwAnd? searchIndexOptions)?)? - ; - -searchIndexConfigs - : kwConfig LC_BRACKET (kwAutoCommitTime COLON autoCommitTimeConfig=decimalLiteral)? - (syntaxComma? kwDefaultQueryField COLON defaultQueryFieldConfig=stringLiteral)? - (syntaxComma? kwDirectoryFactory COLON directoryFactoryConfig=directoryFactory)? - (syntaxComma? kwFilterCacheLowWaterMark COLON filterCacheLowWaterMarkConfig=decimalLiteral)? - (syntaxComma? kwFilterCacheHighWaterMark COLON filterCacheHighWaterMarkConfig=decimalLiteral)? - (syntaxComma? kwDirectoryFactoryClass COLON directoryFactoryClassConfig=stringLiteral)? - (syntaxComma? kwMergeMaxThreadCount COLON mergeMaxThreadCountConfig=decimalLiteral)? - (syntaxComma? kwMergeMaxMergeCount COLON mergeMaxMergeCountConfig=decimalLiteral)? - (syntaxComma? kwRamBufferSize COLON ramBufferSizeConfig=decimalLiteral)? - (syntaxComma? kwRealtime COLON realtimeConfig=booleanLiteral)? - RC_BRACKET - ; - -directoryFactory - : kwStandard - | kwEncrypted - ; - -searchIndexOptions - : kwOptions LC_BRACKET (kwRecovery COLON recoveryOption=booleanLiteral)? - (syntaxComma? kwReindex COLON reindexOption=booleanLiteral)? - (syntaxComma? kwLenient COLON lenientOption=booleanLiteral)? - RC_BRACKET - ; - -searchIndexProfile - : kwSpaceSavingAll - | kwSpaceSavingNoJoin - | kwSpaceSavingSlowTriePrecision - | kwSpaceSavingNoTextField - ; - -searchIndexProfiles - : searchIndexProfile (syntaxComma searchIndexProfile)* - ; - -searchIndexColumnList - : searchIndexColumn (syntaxComma searchIndexColumn)* - ; - -searchIndexColumn - : column (LC_BRACKET (kwCopyField COLON copyFieldOption=booleanLiteral)? (syntaxComma? kwDocValues COLON docValuesOption=booleanLiteral)? (syntaxComma? kwExcluded COLON excludedOption=booleanLiteral)? (syntaxComma? kwIndexed COLON indexedOption=booleanLiteral)? (syntaxComma? kwLowerCase COLON lowerCase=booleanLiteral)? RC_BRACKET)? - | star=STAR (LC_BRACKET (kwCopyField COLON copyFieldOption=booleanLiteral)? (syntaxComma? kwDocValues COLON docValuesOption=booleanLiteral)? (syntaxComma? kwExcluded COLON excludedOption=booleanLiteral)? (syntaxComma? kwIndexed COLON indexedOption=booleanLiteral)? (syntaxComma? kwLowerCase COLON lowerCase=booleanLiteral)? RC_BRACKET)? - ; - - -indexName - : id - | stringLiteral - ; - -indexColumnSpec - : column - | indexKeysSpec - | indexEntriesSSpec - | indexFullSpec - | indexValuesSpec - ; - -indexKeysSpec - : kwKeys syntaxBracketLr column syntaxBracketRr - ; - -indexEntriesSSpec - : kwEntries syntaxBracketLr column syntaxBracketRr - ; - -indexFullSpec - : kwFull syntaxBracketLr column syntaxBracketRr - ; - -indexValuesSpec - : kwValues syntaxBracketLr column syntaxBracketRr - ; - -deleteStatement - : beginBatch? kwDelete deleteColumnList? fromSpec usingTimestampSpec? whereSpec (ifExist | ifSpec)? - ; - -deleteColumnList - : (deleteColumnItem) (syntaxComma deleteColumnItem)* - ; - -deleteColumnItem - : id - | id LS_BRACKET (stringLiteral | decimalLiteral) RS_BRACKET - ; - -update - : beginBatch? kwUpdate (keyspace DOT)? table usingTtlTimestamp? kwSet assignments whereSpec (ifExist | ifSpec)? - ; - -ifSpec - : kwIf ifConditionList - ; - -ifConditionList - : (ifCondition) (kwAnd ifCondition)* - ; - -ifCondition - : id OPERATOR_EQ constant - ; - -assignments - : (assignmentElement) (syntaxComma assignmentElement)* - ; - -assignmentElement - : id OPERATOR_EQ (constant | assignmentMap | assignmentSet | assignmentList) - | id OPERATOR_EQ id (PLUS | MINUS) decimalLiteral - | id OPERATOR_EQ id (PLUS | MINUS) assignmentSet - | id OPERATOR_EQ assignmentSet (PLUS | MINUS) id - | id OPERATOR_EQ id (PLUS | MINUS) assignmentMap - | id OPERATOR_EQ assignmentMap (PLUS | MINUS) id - | id OPERATOR_EQ id (PLUS | MINUS) assignmentList - | id OPERATOR_EQ assignmentList (PLUS | MINUS) id - | id syntaxBracketLs decimalLiteral syntaxBracketRs OPERATOR_EQ constant - ; - -assignmentSet - : syntaxBracketLc (constant (syntaxComma expression)*)? syntaxBracketRc - ; - -assignmentMap - : syntaxBracketLc (constant syntaxColon expression) (syntaxComma constant syntaxColon expression)* syntaxBracketRc - ; - -assignmentMapExpression - : syntaxBracketLc expression (syntaxComma expression)* syntaxBracketRc - ; - -assignmentList - : syntaxBracketLs constant (syntaxComma expression)* syntaxBracketRs - ; - -assignmentTuple - : syntaxBracketLr ( - expression ((syntaxComma expression)* | (syntaxComma assignmentTuple)*) | - assignmentTuple (syntaxComma assignmentTuple)* - ) syntaxBracketRr - ; - -insert - : beginBatch? kwInsert kwInto (keyspace DOT)? table insertColumnSpec? insertValuesSpec ifNotExist? usingTtlTimestamp? - ; - -usingTtlTimestamp - : kwUsing ttl - | kwUsing ttl kwAnd timestamp - | kwUsing timestamp - | kwUsing timestamp kwAnd ttl - ; - -timestamp - : kwTimestamp decimalLiteral - ; - -ttl - : kwTtl decimalLiteral - ; - -usingTimestampSpec - : kwUsing timestamp - ; - -ifNotExist - : kwIf kwNot kwExists - ; - -ifExist - : kwIf kwExists - ; - -insertValuesSpec - : kwValues '(' expressionList ')' - | kwJson constant - ; - -insertColumnSpec - : '(' columnList ')' - ; - -columnList - : column (syntaxComma column)* - ; - -expressionList - : expression (syntaxComma expression)* - ; - -expression - : constant - | assignmentMap - | assignmentSet - | assignmentList - | assignmentTuple - | assignmentMapExpression - ; - -select - : kwSelect distinctSpec? kwJson? selectElements fromSpec whereSpec? orderSpec? limitSpec? allowFilteringSpec? - ; - -allowFilteringSpec - : kwAllow kwFiltering - ; - -limitSpec - : kwLimit decimalLiteral - ; - -fromSpec - : kwFrom fromSpecElement - ; - -fromSpecElement - : id - | id '.' id - ; - -orderSpec - : kwOrder kwBy orderSpecElement - ; - -orderSpecElement - : id (kwAsc | kwDesc)? - ; - -whereSpec - : kwWhere relationElements - ; - -distinctSpec - : kwDistinct - ; - -selectElements - : (star = '*' | selectElement) (syntaxComma selectElement)* - ; - -selectElement - : id '.' '*' - | id (kwAs id)? - | functionCall (kwAs id)? - ; - -relationElements - : (relationElement) (kwAnd relationElement)* - ; - -relationElement - : id (OPERATOR_EQ | OPERATOR_LT | OPERATOR_GT | OPERATOR_LTE | OPERATOR_GTE) constant - | id '.' id (OPERATOR_EQ | OPERATOR_LT | OPERATOR_GT | OPERATOR_LTE | OPERATOR_GTE) constant - | functionCall (OPERATOR_EQ | OPERATOR_LT | OPERATOR_GT | OPERATOR_LTE | OPERATOR_GTE) constant - | functionCall (OPERATOR_EQ | OPERATOR_LT | OPERATOR_GT | OPERATOR_LTE | OPERATOR_GTE) functionCall - | id kwIn '(' functionArgs? ')' - | '(' id (syntaxComma id)* ')' kwIn '(' assignmentTuple (syntaxComma assignmentTuple)* ')' - | '(' id (syntaxComma id)* ')' (OPERATOR_EQ | OPERATOR_LT | OPERATOR_GT | OPERATOR_LTE | OPERATOR_GTE) ( assignmentTuple (syntaxComma assignmentTuple)* ) - | relalationContainsKey - | relalationContains - ; - -relalationContains - : id kwContains constant - ; - -relalationContainsKey - : id (kwContains kwKey) constant - ; - -functionCall - : id '(' STAR ')' - | id '(' functionArgs? ')' - ; - -functionArgs - : (constant | id | functionCall) (syntaxComma (constant | id | functionCall))* - ; - -constant - : UUID - | stringLiteral - | decimalLiteral - | floatLiteral - | hexadecimalLiteral - | booleanLiteral - | codeBlock - | kwNull - | id - ; - -decimalLiteral - : DECIMAL_LITERAL - ; - -floatLiteral - : DECIMAL_LITERAL - | FLOAT_LITERAL - ; - -stringLiteral - : STRING_LITERAL - ; - -booleanLiteral - : K_TRUE - | K_FALSE - ; - -hexadecimalLiteral - : HEXADECIMAL_LITERAL - ; - -keyspace - : id - | DQUOTE id DQUOTE - ; - -table - : id - | DQUOTE id DQUOTE - ; - -column - : id - | DQUOTE id DQUOTE - ; - -dataType - : dataTypeName dataTypeDefinition? - ; - -dataTypeName - : (keyspace DOT)? type - | STRING_LITERAL - | K_TIMESTAMP - | K_SET - | K_ASCII - | K_BIGINT - | K_BLOB - | K_BOOLEAN - | K_COUNTER - | K_DATE - | K_DECIMAL - | K_DOUBLE - | K_FLOAT - | K_FROZEN - | K_INET - | K_INT - | K_LIST - | K_MAP - | K_SMALLINT - | K_TEXT - | K_TIME - | K_TIMEUUID - | K_TINYINT - | K_TUPLE - | K_VARCHAR - | K_VARINT - | K_TIMESTAMP - | K_UUID - | K_VECTOR - ; - -dataTypeDefinition - : syntaxBracketLa dataType (syntaxComma (dataType | decimalLiteral))* syntaxBracketRa - ; - -orderDirection - : kwAsc - | kwDesc - ; - -role - : id - ; - -trigger - : id - ; - -triggerClass - : stringLiteral - ; - -materializedView - : id - ; - -type - : id - ; - -aggregate - : id - ; - -functionStatement - : id - ; - -language - : id - ; - -user - : id - ; - -password - : stringLiteral - ; - -hashKey - : id - ; - -param - : paramName dataType - ; - -paramName - : id - ; - -kwAdd - : K_ADD - ; - -kwAggregate - : K_AGGREGATE - ; - -kwAll - : K_ALL - ; - -kwAllPermissions - : K_ALL K_PERMISSIONS - ; - -kwAllow - : K_ALLOW - ; - -kwAlter - : K_ALTER - ; - -kwAnd - : K_AND - ; - -kwApply - : K_APPLY - ; - -kwAs - : K_AS - ; - -kwAsc - : K_ASC - ; - -kwAuthorize - : K_AUTHORIZE - ; - -kwBatch - : K_BATCH - ; - -kwBegin - : K_BEGIN - ; - -kwBy - : K_BY - ; - -kwCalled - : K_CALLED - ; - -kwClustering - : K_CLUSTERING - ; - -kwCompact - : K_COMPACT - ; - -kwContains - : K_CONTAINS - ; - -kwCreate - : K_CREATE - ; - -kwDelete - : K_DELETE - ; - -kwDesc - : K_DESC - ; - -kwDescibe - : K_DESCRIBE - ; - -kwDistinct - : K_DISTINCT - ; - -kwDrop - : K_DROP - ; - -kwDurableWrites - : K_DURABLE_WRITES - ; - -kwEntries - : K_ENTRIES - ; - -kwExecute - : K_EXECUTE - ; - -kwExists - : K_EXISTS - ; - -kwFiltering - : K_FILTERING - ; - -kwFinalfunc - : K_FINALFUNC - ; - -kwFrom - : K_FROM - ; - -kwFull - : K_FULL - ; - -kwFunction - : K_FUNCTION - ; - -kwFunctions - : K_FUNCTIONS - ; - -kwGrant - : K_GRANT - ; - -kwIf - : K_IF - ; - -kwIn - : K_IN - ; - -kwIndex - : K_INDEX - ; - -kwCustom - : K_CUSTOM - ; - - -kwSearch - : K_SEARCH - ; - -kwAscii - : K_ASCII - ; - -kwNormalize - : K_NORMALIZE - ; - -kwAnalyzed - : K_ANALYZED - ; - -kwIsLiteral - : K_IS_LITERAL - ; - -kwMaxCompactionFlushMemoryInMb - : K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB - ; - -kwTokenizationEnableStemming - : K_TOKENIZATION_ENABLE_STEMMING - ; - -kwTokenizationSkipStopWords - : K_TOKENIZATION_SKIP_STOP_WORDS - ; - -kwTokenizationLocale - : K_TOKENIZATION_LOCALE - ; - -kwTokenizationNormalizeLowercase - : K_TOKENIZATION_NORMALIZE_LOWERCASE - ; - -kwTokenizationNormalizeUppercase - : K_TOKENIZATION_NORMALIZE_UPPERCASE - ; - -kwNormalizeLowercase - : K_NORMALIZE_LOWERCASE - ; - -kwNormalizeUppercase - : K_NORMALIZE_UPPERCASE - ; - -kwMode - : K_MODE - ; - - -kwAnalyzerClass - : K_ANALYZER_CLASS - ; - -kwStorageAttachedIndex - : K_STORAGE_ATTACHED_INDEX - ; - -kwSolrIndex - : K_SOLR_INDEX - ; - -kwSASIIndex - : K_SASI_INDEX - ; - -kwSpaceSavingNoJoin - : K_SPACE_SAVING_NO_JOIN - ; - -kwSpaceSavingAll - : K_SPACE_SAVING_ALL - ; - -kwSpaceSavingSlowTriePrecision - : K_SPACE_SAVING_SLOW_TRIE_PRECISION - ; - -kwSpaceSavingNoTextField - : K_SPACE_SAVING_NO_TEXT_FIELD - ; - -kwCopyField - : K_COPY_FIELD - ; - -kwDocValues - : K_DOC_VALUES - ; - -kwExcluded - : K_EXCLUDED - ; - -kwIndexed - : K_INDEXED - ; - -kwLowerCase - : K_LOWERCASE - ; - -kwColumns - : K_COLUMNS - ; - -kwProfiles - : K_PROFILES - ; - -kwConfig - : K_CONFIG - ; - -kwAutoCommitTime - : K_AUTOCOMMIT_TIME - ; - -kwDefaultQueryField - : K_DEFAULT_QUERY_FIELD - ; - -kwDirectoryFactory - : K_DIRECTORY_FACTORY - ; - -kwFilterCacheLowWaterMark - : K_FILTER_CACHE_LOW_WATERMARK - ; - -kwFilterCacheHighWaterMark - : K_FILTER_CACHE_HIGH_WATERMARK - ; - -kwDirectoryFactoryClass - : K_DIRECTORY_FACTORY_CLASS - ; - -kwMergeMaxThreadCount - : K_MERGE_MAX_THREAD_COUNT - ; - -kwMergeMaxMergeCount - : K_MERGE_MAX_MERGE_COUNT - ; - -kwRamBufferSize - : K_RAM_BUFFER_SIZE - ; - -kwRealtime - : K_REALTIME - ; - -kwRecovery - : K_RECOVERY - ; - -kwReindex - : K_REINDEX - ; - -kwLenient - : K_LENIENT - ; - -kwStandard - : K_STANDARD - ; - -kwEncrypted - : K_ENCRYPTED - ; - -kwCaseSensitive - : K_CASE_SENITIVE - ; - -kwSimilarityFunction - : K_SIMILARITY_FUNCTION - ; - -kwInitcond - : K_INITCOND - ; - -kwInput - : K_INPUT - ; - -kwInsert - : K_INSERT - ; - -kwInto - : K_INTO - ; - -kwIs - : K_IS - ; - -kwJson - : K_JSON - ; - -kwKey - : K_KEY - ; - -kwKeys - : K_KEYS - ; - -kwKeyspace - : K_KEYSPACE - ; - -kwKeyspaces - : K_KEYSPACES - ; - -kwLanguage - : K_LANGUAGE - ; - -kwLimit - : K_LIMIT - ; - -kwList - : K_LIST - ; - -kwLogged - : K_LOGGED - ; - -kwLogin - : K_LOGIN - ; - -kwMaterialized - : K_MATERIALIZED - ; - -kwModify - : K_MODIFY - ; - -kwNosuperuser - : K_NOSUPERUSER - ; - -kwNorecursive - : K_NORECURSIVE - ; - -kwNot - : K_NOT - ; - -kwNull - : K_NULL - ; - -kwOf - : K_OF - ; - -kwOn - : K_ON - ; - -kwOptions - : K_OPTIONS - ; - -kwOr - : K_OR - ; - -kwOrder - : K_ORDER - ; - -kwPassword - : K_PASSWORD - ; - -kwPrimary - : K_PRIMARY - ; - -kwRename - : K_RENAME - ; - -kwReplace - : K_REPLACE - ; - -kwReplication - : K_REPLICATION - ; - -kwReturns - : K_RETURNS - ; - -kwRole - : K_ROLE - ; - -kwInternal - : K_INTERNAL - ; - -kwLdap - : K_LDAP - ; - -kwScheme - : K_SCHEME - ; - -kwRoles - : K_ROLES - ; - -kwSelect - : K_SELECT - ; - -kwSet - : K_SET - ; - -kwSfunc - : K_SFUNC - ; - -kwStorage - : K_STORAGE - ; - -kwStype - : K_STYPE - ; - -kwSuperuser - : K_SUPERUSER - ; - -kwTable - : K_TABLE - ; - -kwTimestamp - : K_TIMESTAMP - ; - -kwTo - : K_TO - ; - -kwTrigger - : K_TRIGGER - ; - -kwTruncate - : K_TRUNCATE - ; - -kwTtl - : K_TTL - ; - -kwType - : K_TYPE - ; - -kwUnlogged - : K_UNLOGGED - ; - -kwUpdate - : K_UPDATE - ; - -kwUse - : K_USE - ; - -kwUser - : K_USER - ; - -kwUsers - : K_USERS - ; - -kwUsing - : K_USING - ; - -kwValues - : K_VALUES - ; - -kwView - : K_VIEW - ; - -kwWhere - : K_WHERE - ; - -kwWith - : K_WITH - ; - -kwRevoke - : K_REVOKE - ; - -eof - : EOF - ; - -// BRACKETS -// L - left -// R - right -// a - angle -// c - curly -// r - rounded -syntaxBracketLr - : LR_BRACKET - ; - -syntaxBracketRr - : RR_BRACKET - ; - -syntaxBracketLc - : LC_BRACKET - ; - -syntaxBracketRc - : RC_BRACKET - ; - -syntaxBracketLa - : OPERATOR_LT - ; - -syntaxBracketRa - : OPERATOR_GT - ; - -syntaxBracketLs - : LS_BRACKET - ; - -syntaxBracketRs - : RS_BRACKET - ; - -syntaxComma - : COMMA - ; - -syntaxColon - : COLON - ; - -id - : OBJECT_NAME | - K_ADD - K_AGGREGATE | - K_ALL | - K_ALLOW | - K_ALTER | - K_AND | - K_ANY | - K_APPLY | - K_AS | - K_ASC | - K_AUTHORIZE | - K_BATCH | - K_BEGIN | - K_BY | - K_CALLED | - K_CLUSTERING | - K_COLUMNFAMILY | - K_COMPACT | - K_CONSISTENCY | - K_CONTAINS | - K_CREATE | - K_CUSTOM | - K_DELETE | - K_DESC | - K_DESCRIBE | - K_DISTINCT | - K_DROP | - K_DURABLE_WRITES | - K_EACH_QUORUM | - K_ENTRIES | - K_EXECUTE | - K_EXISTS | - K_FALSE | - K_FILTERING | - K_FINALFUNC | - K_FROM | - K_FULL | - K_FUNCTION | - K_FUNCTIONS | - K_GRANT | - K_IF | - K_IN | - K_INDEX | - K_INFINITY | - K_INITCOND | - K_INPUT | - K_INSERT | - K_INTO | - K_IS | - K_JSON | - K_KEY | - K_KEYS | - K_KEYSPACE | - K_KEYSPACES | - K_LANGUAGE | - K_LEVEL | - K_LIMIT | - K_LOCAL_ONE | - K_LOCAL_QUORUM | - K_LOGGED | - K_LOGIN | - K_MATERIALIZED | - K_MODIFY | - K_NAN | - K_NORECURSIVE | - K_NOSUPERUSER | - K_NOT | - K_NULL | - K_OF | - K_ON | - K_ONE | - K_OPTIONS | - K_OR | - K_ORDER | - K_PARTITION | - K_PASSWORD | - K_PER | - K_PERMISSION | - K_PERMISSIONS | - K_PRIMARY | - K_QUORUM | - K_RENAME | - K_REPLACE | - K_REPLICATION | - K_RETURNS | - K_REVOKE | - K_ROLE | - K_ROLES | - K_SCHEMA | - K_SELECT | - K_SET | - K_SFUNC | - K_STATIC | - K_STORAGE | - K_STYPE | - K_SUPERUSER | - K_TABLE | - K_THREE | - K_TIMESTAMP | - K_TO | - K_TOKEN | - K_TRIGGER | - K_TRUE | - K_TRUNCATE | - K_TTL | - K_TWO | - K_TYPE | - K_UNLOGGED | - K_UPDATE | - K_USE | - K_USER | - K_USING | - K_UUID | - K_VALUES | - K_VIEW | - K_WHERE | - K_WITH | - K_WRITETIME | - K_ASCII | - K_BIGINT | - K_BLOB | - K_BOOLEAN | - K_COUNTER | - K_DATE | - K_DECIMAL | - K_DOUBLE | - K_FLOAT | - K_FROZEN | - K_INET | - K_INT | - K_LIST | - K_MAP | - K_SMALLINT | - K_TEXT | - K_TIMEUUID | - K_TIME | - K_TINYINT | - K_TUPLE | - K_VARCHAR | - K_VARINT | - K_USERS | - K_VECTOR -; \ No newline at end of file diff --git a/reverse_engineering/helpers/commandsHelper.js b/reverse_engineering/helpers/commandsHelper.js deleted file mode 100644 index a776a14b..00000000 --- a/reverse_engineering/helpers/commandsHelper.js +++ /dev/null @@ -1,63 +0,0 @@ -const findEntityIndex = (entities, bucket, name) => { - const entityIndex = entities.findIndex(entity => ( - isEqualCaseInsensitive(entity.bucketName, bucket) && - isEqualCaseInsensitive(entity.collectionName, name) - )); - - if (entityIndex !== -1) { - return entityIndex; - } - - return entities.findIndex(entity => entity.collectionName === name); -}; - -const getCaseInsensitiveKey = (object, key) => { - if (object[key]) { - return key; - } - - return Object.keys(object).find(objectKey => isEqualCaseInsensitive(objectKey, key)); -}; - -const omitCaseInsensitive = (object, key) => { - const objectCopy = { ...object }; - delete objectCopy[getCaseInsensitiveKey(object,key)]; - - return objectCopy; -}; - -const isEqualCaseInsensitive = (str1, str2) => (str1 || '').toLowerCase() === (str2 || '').toLowerCase(); - -const remove = (items, index) => [...items.slice(0, index), ...items.slice(index + 1)]; - -const set = (items, index, value) => [...items.slice(0, index), value, ...items.slice(index + 1)]; - -const merge = (target, source) => { - if (!isObject(target) || !isObject(source)) { - return source || target; - } - - return Object.keys(source).reduce((merged, key) => { - const value = isObject(source[key]) ? merge(merged[key] || {}, source[key]) : source[key]; - - return { - ...merged, - [key]: value - }; - }, target); -}; - -const getCurrentBucket = (entitiesData, statementData) => statementData.bucketName || entitiesData.currentBucket; - -const isObject = item => item && typeof item === 'object' && !Array.isArray(item); - -module.exports = { - findEntityIndex, - getCaseInsensitiveKey, - omitCaseInsensitive, - isEqualCaseInsensitive, - remove, - set, - merge, - getCurrentBucket, -} \ No newline at end of file diff --git a/reverse_engineering/helpers/createTableOptionsFromMeta.js b/reverse_engineering/helpers/createTableOptionsFromMeta.js deleted file mode 100644 index 5dd5dec6..00000000 --- a/reverse_engineering/helpers/createTableOptionsFromMeta.js +++ /dev/null @@ -1,53 +0,0 @@ -const COMPACTION = 'compaction'; -const COMPRESSION = 'compression'; -const CACHING = 'caching'; -const specialOptions = [CACHING, COMPACTION, COMPRESSION]; - -const changeQuotes = str => String(str || '').replace(/[\"\`]/g, '\''); -const handleSpecialOption = (optionName, tableMeta) => { - switch (optionName) { - case COMPACTION: return handleCompactionOption(tableMeta); - case CACHING: return handleCashingOption(tableMeta); - case COMPRESSION: return handleCompressionOption(tableMeta); - default: return null; - } -}; - -const handleCompressionOption = tableMeta => { - const { compression } = tableMeta; - return changeQuotes(JSON.stringify(compression)); -} - -const handleCompactionOption = tableMeta => { - const { compactionClass, compactionOptions } = tableMeta; - const valueObj = Object.assign({}, { class: compactionClass }, compactionOptions); - return changeQuotes(JSON.stringify(valueObj)); -} - -const handleCashingOption = tableMeta => { - const obj = JSON.parse(tableMeta.caching); - return { - keys: obj.keys, - rowsPerPartition: obj['rows_per_partition'], - }; -} - -generateTableOptionsReducer = (tableMeta) => (options, configOption) => { - const optionName = configOption.propertyKeyword; - if (specialOptions.includes(optionName)) { - const specialOptionValue = handleSpecialOption(optionName, tableMeta); - return Object.assign({}, options, { [optionName]: specialOptionValue }); - } - - if (tableMeta.hasOwnProperty(optionName)) { - return Object.assign({}, options, { [optionName]: tableMeta[optionName] }); - } - - return options; -} - -module.exports = { - createTableOptionsFromMeta(tableMeta, config) { - return config.reduce(generateTableOptionsReducer(tableMeta), {}); - } -}; diff --git a/reverse_engineering/helpers/filterComplexUdt.js b/reverse_engineering/helpers/filterComplexUdt.js deleted file mode 100644 index 8fe88fc5..00000000 --- a/reverse_engineering/helpers/filterComplexUdt.js +++ /dev/null @@ -1,75 +0,0 @@ -module.exports = (_) => { - const handleItem = (properties, record, propertyValue) => { - if (_.isUndefined(propertyValue)) { - return record; - } - if (propertyValue?.type === 'reference') { - return; - } - if (Array.isArray(record) && propertyValue.items) { - const handler = propertyValue?.type === 'tuple' ? handleTuple : handleItems; - return handler(propertyValue.items, record); - } - - return _.isPlainObject(record) ? filterUdt(propertyValue.properties || {}, record) : record; - }; - const handleItems = (properties, records) => { - return records.map((record) => handleItem(properties, record, properties?.[0])).filter(record => { - return !_.isBoolean(record) && !_.isEmpty(record); - }); - }; - - const handleTuple = (properties, records) => { - const handlerRecords = records.map((record, index) => handleItem(properties, record, properties?.[index])); - - return handlerRecords.some(record => record === undefined) ? [] : handlerRecords; - }; - - const handleMap = ({ properties, records }) => { - return Object.entries(properties).reduce((result, [propertyName, propertyValue]) => { - return { - ...result, - [propertyName]: filterUdt(propertyValue?.properties, records?.[propertyName]) - } - }, {}); - }; - - const filterUdt = (properties, records) => { - if (!_.isPlainObject(records)) { - return records; - }; - return Object.entries(records).reduce((records, [recordName, recordValues]) => { - const propertyValue = properties?.[recordName]; - const type = propertyValue?.type; - if ((type === 'list' || type === 'set') && propertyValue.items) { - return { - ...records, - [recordName]: handleItems(propertyValue.items, recordValues), - }; - } else if (type === 'tuple' && propertyValue.items) { - return { - ...records, - [recordName]: handleTuple(propertyValue.items, recordValues), - } - } else if (type === 'map' && propertyValue.properties) { - return { - ...records, - [recordName]: handleMap({ properties: propertyValue.properties, records: recordValues }), - } - } - - return { - ...records, - [recordName]: recordValues, - }; - }, {}); - }; - - const filterUdts = (properties, records) => { - return records.map(record => filterUdt(properties, record)); - }; - - return { - filterUdts, - } -}; diff --git a/reverse_engineering/logHelper.js b/reverse_engineering/logHelper.js deleted file mode 100644 index dabf824c..00000000 --- a/reverse_engineering/logHelper.js +++ /dev/null @@ -1,56 +0,0 @@ -const os = require('os'); -const net = require('net'); -const packageFile = require('../package.json'); - -const checkConnection = (host, port, timeout = 5000) => new Promise((resolve, reject) => { - const timer = setTimeout(() => { - socket.end(); - reject(new Error('Connection takes more than ' + 5000 + ' ms')); - }, timeout); - - const socket = net.createConnection(port, host, () => { - socket.end(); - clearTimeout(timer); - resolve(); - }); - socket.on('error', (err) => { - clearTimeout(timer); - reject(err); - }); -}); - -const getPluginVersion = () => packageFile.version; - -const getSystemInfo = (appVersion) => { - return '' + - `Date: ${new Date()}` + '\n' + - `Application version: ${appVersion}` + '\n' + - `Plugin version: ${getPluginVersion()}` + '\n\n' + - `System information:` + '\n' + - ` Hostname: ${os.hostname()}` + '\n' + - ` Platform: ${os.platform()} ${os.arch()}` + '\n' + - ` Release: ${os.release()}` + '\n' + - ` Uptime: ${toTime(os.uptime())}` + '\n' + - ` Total RAM: ${(os.totalmem()/1073741824).toFixed(2)} GB` + '\n' + - ` CPU Model: ${os.cpus()[0].model}` + '\n' + - ` CPU Clock: ${maxClock(os.cpus())} MHZ` + '\n' + - ` CPU Cores: ${os.cpus().length} cores` + '\n\n'; -}; - - -const maxClock = (cpus) => { - return cpus.reduce((highestClock, cpu) => Math.max(highestClock, cpu.speed), 0); -}; - -const prefixZero = (number) => number < 10 ? "0" + number : number; - -const toTime = (number) => { - return (Math.floor(number/3600))+":"+prefixZero(parseInt((number/3600-Math.floor(number/3600))*60)) -}; - -const logHelper = { - getSystemInfo, - checkConnection -}; - -module.exports = logHelper; diff --git a/reverse_engineering/node_modules/.bin/xml2js b/reverse_engineering/node_modules/.bin/xml2js deleted file mode 120000 index 8cc0b9ef..00000000 --- a/reverse_engineering/node_modules/.bin/xml2js +++ /dev/null @@ -1 +0,0 @@ -../fast-xml-parser/cli.js \ No newline at end of file diff --git a/reverse_engineering/node_modules/.package-lock.json b/reverse_engineering/node_modules/.package-lock.json deleted file mode 100644 index bb92bc4c..00000000 --- a/reverse_engineering/node_modules/.package-lock.json +++ /dev/null @@ -1,165 +0,0 @@ -{ - "name": "Datastax", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "node_modules/@types/long": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-5.0.0.tgz", - "integrity": "sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA==", - "deprecated": "This is a stub types definition. long provides its own type definitions, so you do not need this installed.", - "dependencies": { - "long": "*" - } - }, - "node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/adm-zip": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", - "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==", - "engines": { - "node": ">=6.0" - } - }, - "node_modules/antlr4": { - "version": "4.8.0", - "integrity": "sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg==" - }, - "node_modules/asn1": { - "version": "0.2.4", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/cassandra-driver": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/cassandra-driver/-/cassandra-driver-4.7.2.tgz", - "integrity": "sha512-gwl1DeYvL8Wy3i1GDMzFtpUg5G473fU7EnHFZj7BUtdLB7loAfgZgB3zBhROc9fbaDSUDs6YwOPPojS5E1kbSA==", - "dependencies": { - "@types/long": "~5.0.0", - "@types/node": ">=8", - "adm-zip": "~0.5.10", - "long": "~5.2.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/fast-xml-parser": { - "version": "3.19.0", - "integrity": "sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==", - "bin": { - "xml2js": "cli.js" - }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" - } - }, - "node_modules/jks-js": { - "version": "1.0.0", - "integrity": "sha512-0ocOpotBAJNz3ajlflj39DG9Cs96SCx3qtNPHJyUTXD5pk8/cQRfR5BSyPhcTHGKe2sxfT18WGiINtLqi/W64g==", - "dependencies": { - "node-forge": "^0.10.0", - "node-int64": "^0.4.0", - "node-rsa": "^1.0.7" - } - }, - "node_modules/lodash.defaults": { - "version": "4.2.0", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "node_modules/ms": { - "version": "2.0.0", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/node-forge": { - "version": "0.10.0", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/node-int64": { - "version": "0.4.0", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" - }, - "node_modules/node-rsa": { - "version": "1.1.1", - "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", - "dependencies": { - "asn1": "^0.2.4" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/ssh2": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.4.0.tgz", - "integrity": "sha512-XvXwcXKvS452DyQvCa6Ct+chpucwc/UyxgliYz+rWXJ3jDHdtBb9xgmxJdMmnIn5bpgGAEV3KaEsH98ZGPHqwg==", - "hasInstallScript": true, - "dependencies": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2" - }, - "engines": { - "node": ">=10.16.0" - }, - "optionalDependencies": { - "cpu-features": "0.0.2", - "nan": "^2.15.0" - } - }, - "node_modules/tunnel-ssh": { - "version": "4.1.5", - "resolved": "git+ssh://git@github.com/hackolade/tunnel-ssh.git#e3dec106b0a3347f015f1fca4755ec0eaf880e21", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "lodash.defaults": "^4.1.0", - "ssh2": "1.4.0" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - } - } -} diff --git a/reverse_engineering/node_modules/@types/long/LICENSE b/reverse_engineering/node_modules/@types/long/LICENSE deleted file mode 100755 index 9e841e7a..00000000 --- a/reverse_engineering/node_modules/@types/long/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/reverse_engineering/node_modules/@types/long/README.md b/reverse_engineering/node_modules/@types/long/README.md deleted file mode 100755 index 7e4466fd..00000000 --- a/reverse_engineering/node_modules/@types/long/README.md +++ /dev/null @@ -1,3 +0,0 @@ -This is a stub types definition for @types/long (https://github.com/dcodeIO/long.js#readme). - -long provides its own type definitions, so you don't need @types/long installed! \ No newline at end of file diff --git a/reverse_engineering/node_modules/@types/long/package.json b/reverse_engineering/node_modules/@types/long/package.json deleted file mode 100755 index c7480307..00000000 --- a/reverse_engineering/node_modules/@types/long/package.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "@types/long", - "version": "5.0.0", - "description": "Stub TypeScript definitions entry for long, which provides its own types definitions", - "main": "", - "scripts": {}, - "license": "MIT", - "dependencies": { - "long": "*" - }, - "deprecated": "This is a stub types definition. long provides its own type definitions, so you do not need this installed." -} \ No newline at end of file diff --git a/reverse_engineering/node_modules/@types/node/LICENSE b/reverse_engineering/node_modules/@types/node/LICENSE deleted file mode 100644 index 9e841e7a..00000000 --- a/reverse_engineering/node_modules/@types/node/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ - MIT License - - Copyright (c) Microsoft Corporation. - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE diff --git a/reverse_engineering/node_modules/@types/node/README.md b/reverse_engineering/node_modules/@types/node/README.md deleted file mode 100644 index 12b648e9..00000000 --- a/reverse_engineering/node_modules/@types/node/README.md +++ /dev/null @@ -1,15 +0,0 @@ -# Installation -> `npm install --save @types/node` - -# Summary -This package contains type definitions for node (https://nodejs.org/). - -# Details -Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node. - -### Additional Details - * Last updated: Sun, 17 Dec 2023 21:35:25 GMT - * Dependencies: [undici-types](https://npmjs.com/package/undici-types) - -# Credits -These definitions were written by [Microsoft TypeScript](https://github.com/Microsoft), [Alberto Schiabel](https://github.com/jkomyno), [Alvis HT Tang](https://github.com/alvis), [Andrew Makarov](https://github.com/r3nya), [Benjamin Toueg](https://github.com/btoueg), [Chigozirim C.](https://github.com/smac89), [David Junger](https://github.com/touffy), [Deividas Bakanas](https://github.com/DeividasBakanas), [Eugene Y. Q. Shen](https://github.com/eyqs), [Hannes Magnusson](https://github.com/Hannes-Magnusson-CK), [Huw](https://github.com/hoo29), [Kelvin Jin](https://github.com/kjin), [Klaus Meinhardt](https://github.com/ajafff), [Lishude](https://github.com/islishude), [Mariusz Wiktorczyk](https://github.com/mwiktorczyk), [Mohsen Azimi](https://github.com/mohsen1), [Nicolas Even](https://github.com/n-e), [Nikita Galkin](https://github.com/galkin), [Parambir Singh](https://github.com/parambirs), [Sebastian Silbermann](https://github.com/eps1lon), [Thomas den Hollander](https://github.com/ThomasdenH), [Wilco Bakker](https://github.com/WilcoBakker), [wwwy3y3](https://github.com/wwwy3y3), [Samuel Ainsworth](https://github.com/samuela), [Kyle Uehlein](https://github.com/kuehlein), [Thanik Bhongbhibhat](https://github.com/bhongy), [Marcin Kopacz](https://github.com/chyzwar), [Trivikram Kamat](https://github.com/trivikr), [Junxiao Shi](https://github.com/yoursunny), [Ilia Baryshnikov](https://github.com/qwelias), [ExE Boss](https://github.com/ExE-Boss), [Piotr Błażejewicz](https://github.com/peterblazejewicz), [Anna Henningsen](https://github.com/addaleax), [Victor Perin](https://github.com/victorperin), [Yongsheng Zhang](https://github.com/ZYSzys), [NodeJS Contributors](https://github.com/NodeJS), [Linus Unnebäck](https://github.com/LinusU), [wafuwafu13](https://github.com/wafuwafu13), [Matteo Collina](https://github.com/mcollina), and [Dmitry Semigradsky](https://github.com/Semigradsky). diff --git a/reverse_engineering/node_modules/@types/node/assert.d.ts b/reverse_engineering/node_modules/@types/node/assert.d.ts deleted file mode 100644 index cd821433..00000000 --- a/reverse_engineering/node_modules/@types/node/assert.d.ts +++ /dev/null @@ -1,996 +0,0 @@ -/** - * The `node:assert` module provides a set of assertion functions for verifying - * invariants. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js) - */ -declare module "assert" { - /** - * An alias of {@link ok}. - * @since v0.5.9 - * @param value The input that is checked for being truthy. - */ - function assert(value: unknown, message?: string | Error): asserts value; - namespace assert { - /** - * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class. - */ - class AssertionError extends Error { - /** - * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. - */ - actual: unknown; - /** - * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. - */ - expected: unknown; - /** - * Set to the passed in operator value. - */ - operator: string; - /** - * Indicates if the message was auto-generated (`true`) or not. - */ - generatedMessage: boolean; - /** - * Value is always `ERR_ASSERTION` to show that the error is an assertion error. - */ - code: "ERR_ASSERTION"; - constructor(options?: { - /** If provided, the error message is set to this value. */ - message?: string | undefined; - /** The `actual` property on the error instance. */ - actual?: unknown | undefined; - /** The `expected` property on the error instance. */ - expected?: unknown | undefined; - /** The `operator` property on the error instance. */ - operator?: string | undefined; - /** If provided, the generated stack trace omits frames before this function. */ - // eslint-disable-next-line @typescript-eslint/ban-types - stackStartFn?: Function | undefined; - }); - } - /** - * This feature is deprecated and will be removed in a future version. - * Please consider using alternatives such as the `mock` helper function. - * @since v14.2.0, v12.19.0 - * @deprecated Deprecated - */ - class CallTracker { - /** - * The wrapper function is expected to be called exactly `exact` times. If the - * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an - * error. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func); - * ``` - * @since v14.2.0, v12.19.0 - * @param [fn='A no-op function'] - * @param [exact=1] - * @return that wraps `fn`. - */ - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - /** - * Example: - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * callsfunc(1, 2, 3); - * - * assert.deepStrictEqual(tracker.getCalls(callsfunc), - * [{ thisArg: undefined, arguments: [1, 2, 3] }]); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn - * @return An Array with all the calls to a tracked function. - */ - getCalls(fn: Function): CallTrackerCall[]; - /** - * The arrays contains information about the expected and actual number of calls of - * the functions that have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * // Returns an array containing information on callsfunc() - * console.log(tracker.report()); - * // [ - * // { - * // message: 'Expected the func function to be executed 2 time(s) but was - * // executed 0 time(s).', - * // actual: 0, - * // expected: 2, - * // operator: 'func', - * // stack: stack trace - * // } - * // ] - * ``` - * @since v14.2.0, v12.19.0 - * @return An Array of objects containing information about the wrapper functions returned by `calls`. - */ - report(): CallTrackerReportInformation[]; - /** - * Reset calls of the call tracker. - * If a tracked function is passed as an argument, the calls will be reset for it. - * If no arguments are passed, all tracked functions will be reset. - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * - * callsfunc(); - * // Tracker was called once - * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); - * - * tracker.reset(callsfunc); - * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn a tracked function to reset. - */ - reset(fn?: Function): void; - /** - * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that - * have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * callsfunc(); - * - * // Will throw an error since callsfunc() was only called once. - * tracker.verify(); - * ``` - * @since v14.2.0, v12.19.0 - */ - verify(): void; - } - interface CallTrackerCall { - thisArg: object; - arguments: unknown[]; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error; - /** - * Throws an `AssertionError` with the provided error message or a default - * error message. If the `message` parameter is an instance of an `Error` then - * it will be thrown instead of the `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.fail(); - * // AssertionError [ERR_ASSERTION]: Failed - * - * assert.fail('boom'); - * // AssertionError [ERR_ASSERTION]: boom - * - * assert.fail(new TypeError('need array')); - * // TypeError: need array - * ``` - * - * Using `assert.fail()` with more than two arguments is possible but deprecated. - * See below for further details. - * @since v0.1.21 - * @param [message='Failed'] - */ - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: unknown, - expected: unknown, - message?: string | Error, - operator?: string, - // eslint-disable-next-line @typescript-eslint/ban-types - stackStartFn?: Function, - ): never; - /** - * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`. - * - * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default - * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. - * - * Be aware that in the `repl` the error message will be different to the one - * thrown in a file! See below for further details. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ok(true); - * // OK - * assert.ok(1); - * // OK - * - * assert.ok(); - * // AssertionError: No value argument passed to `assert.ok()` - * - * assert.ok(false, 'it\'s false'); - * // AssertionError: it's false - * - * // In the repl: - * assert.ok(typeof 123 === 'string'); - * // AssertionError: false == true - * - * // In a file (e.g. test.js): - * assert.ok(typeof 123 === 'string'); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(typeof 123 === 'string') - * - * assert.ok(false); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(false) - * - * assert.ok(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(0) - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * // Using `assert()` works the same: - * assert(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert(0) - * ``` - * @since v0.1.21 - */ - function ok(value: unknown, message?: string | Error): asserts value; - /** - * **Strict assertion mode** - * - * An alias of {@link strictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link strictEqual} instead. - * - * Tests shallow, coercive equality between the `actual` and `expected` parameters - * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled - * and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.equal(1, 1); - * // OK, 1 == 1 - * assert.equal(1, '1'); - * // OK, 1 == '1' - * assert.equal(NaN, NaN); - * // OK - * - * assert.equal(1, 2); - * // AssertionError: 1 == 2 - * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); - * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } - * ``` - * - * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default - * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * @since v0.1.21 - */ - function equal(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. - * - * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is - * specially handled and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.notEqual(1, 2); - * // OK - * - * assert.notEqual(1, 1); - * // AssertionError: 1 != 1 - * - * assert.notEqual(1, '1'); - * // AssertionError: 1 != '1' - * ``` - * - * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error - * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * @since v0.1.21 - */ - function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link deepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. - * - * Tests for deep equality between the `actual` and `expected` parameters. Consider - * using {@link deepStrictEqual} instead. {@link deepEqual} can have - * surprising results. - * - * _Deep equality_ means that the enumerable "own" properties of child objects - * are also recursively evaluated by the following rules. - * @since v0.1.21 - */ - function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notDeepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. - * - * Tests for any deep inequality. Opposite of {@link deepEqual}. - * - * ```js - * import assert from 'node:assert'; - * - * const obj1 = { - * a: { - * b: 1, - * }, - * }; - * const obj2 = { - * a: { - * b: 2, - * }, - * }; - * const obj3 = { - * a: { - * b: 1, - * }, - * }; - * const obj4 = { __proto__: obj1 }; - * - * assert.notDeepEqual(obj1, obj1); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj2); - * // OK - * - * assert.notDeepEqual(obj1, obj3); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj4); - * // OK - * ``` - * - * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default - * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests strict equality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.strictEqual(1, 2); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // - * // 1 !== 2 - * - * assert.strictEqual(1, 1); - * // OK - * - * assert.strictEqual('Hello foobar', 'Hello World!'); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // + actual - expected - * // - * // + 'Hello foobar' - * // - 'Hello World!' - * // ^ - * - * const apples = 1; - * const oranges = 2; - * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); - * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 - * - * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); - * // TypeError: Inputs are not identical - * ``` - * - * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a - * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests strict inequality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notStrictEqual(1, 2); - * // OK - * - * assert.notStrictEqual(1, 1); - * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: - * // - * // 1 - * - * assert.notStrictEqual(1, '1'); - * // OK - * ``` - * - * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a - * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests for deep equality between the `actual` and `expected` parameters. - * "Deep" equality means that the enumerable "own" properties of child objects - * are recursively evaluated also by the following rules. - * @since v1.2.0 - */ - function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); - * // OK - * ``` - * - * If the values are deeply and strictly equal, an `AssertionError` is thrown - * with a `message` property set equal to the value of the `message` parameter. If - * the `message` parameter is undefined, a default error message is assigned. If - * the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v1.2.0 - */ - function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Expects the function `fn` to throw an error. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * a validation object where each property will be tested for strict deep equality, - * or an instance of error where each property will be tested for strict deep - * equality including the non-enumerable `message` and `name` properties. When - * using an object, it is also possible to use a regular expression, when - * validating against a string property. See below for examples. - * - * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation - * fails. - * - * Custom validation object/error instance: - * - * ```js - * import assert from 'node:assert/strict'; - * - * const err = new TypeError('Wrong value'); - * err.code = 404; - * err.foo = 'bar'; - * err.info = { - * nested: true, - * baz: 'text', - * }; - * err.reg = /abc/i; - * - * assert.throws( - * () => { - * throw err; - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * info: { - * nested: true, - * baz: 'text', - * }, - * // Only properties on the validation object will be tested for. - * // Using nested objects requires all properties to be present. Otherwise - * // the validation is going to fail. - * }, - * ); - * - * // Using regular expressions to validate error properties: - * assert.throws( - * () => { - * throw err; - * }, - * { - * // The `name` and `message` properties are strings and using regular - * // expressions on those will match against the string. If they fail, an - * // error is thrown. - * name: /^TypeError$/, - * message: /Wrong/, - * foo: 'bar', - * info: { - * nested: true, - * // It is not possible to use regular expressions for nested properties! - * baz: 'text', - * }, - * // The `reg` property contains a regular expression and only if the - * // validation object contains an identical regular expression, it is going - * // to pass. - * reg: /abc/i, - * }, - * ); - * - * // Fails due to the different `message` and `name` properties: - * assert.throws( - * () => { - * const otherErr = new Error('Not found'); - * // Copy all enumerable properties from `err` to `otherErr`. - * for (const [key, value] of Object.entries(err)) { - * otherErr[key] = value; - * } - * throw otherErr; - * }, - * // The error's `message` and `name` properties will also be checked when using - * // an error as validation object. - * err, - * ); - * ``` - * - * Validate instanceof using constructor: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * Error, - * ); - * ``` - * - * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): - * - * Using a regular expression runs `.toString` on the error object, and will - * therefore also include the error name. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * /^Error: Wrong value$/, - * ); - * ``` - * - * Custom error validation: - * - * The function must return `true` to indicate all internal validations passed. - * It will otherwise fail with an `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * (err) => { - * assert(err instanceof Error); - * assert(/value/.test(err)); - * // Avoid returning anything from validation functions besides `true`. - * // Otherwise, it's not clear what part of the validation failed. Instead, - * // throw an error about the specific validation that failed (as done in this - * // example) and add as much helpful debugging information to that error as - * // possible. - * return true; - * }, - * 'unexpected error', - * ); - * ``` - * - * `error` cannot be a string. If a string is provided as the second - * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same - * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using - * a string as the second argument gets considered: - * - * ```js - * import assert from 'node:assert/strict'; - * - * function throwingFirst() { - * throw new Error('First'); - * } - * - * function throwingSecond() { - * throw new Error('Second'); - * } - * - * function notThrowing() {} - * - * // The second argument is a string and the input function threw an Error. - * // The first case will not throw as it does not match for the error message - * // thrown by the input function! - * assert.throws(throwingFirst, 'Second'); - * // In the next example the message has no benefit over the message from the - * // error and since it is not clear if the user intended to actually match - * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. - * assert.throws(throwingSecond, 'Second'); - * // TypeError [ERR_AMBIGUOUS_ARGUMENT] - * - * // The string is only used (as message) in case the function does not throw: - * assert.throws(notThrowing, 'Second'); - * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second - * - * // If it was intended to match for the error message do this instead: - * // It does not throw because the error messages match. - * assert.throws(throwingSecond, /Second$/); - * - * // If the error message does not match, an AssertionError is thrown. - * assert.throws(throwingFirst, /Second$/); - * // AssertionError [ERR_ASSERTION] - * ``` - * - * Due to the confusing error-prone notation, avoid a string as the second - * argument. - * @since v0.1.21 - */ - function throws(block: () => unknown, message?: string | Error): void; - function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Asserts that the function `fn` does not throw an error. - * - * Using `assert.doesNotThrow()` is actually not useful because there - * is no benefit in catching an error and then rethrowing it. Instead, consider - * adding a comment next to the specific code path that should not throw and keep - * error messages as expressive as possible. - * - * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function. - * - * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a - * different type, or if the `error` parameter is undefined, the error is - * propagated back to the caller. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * The following, for instance, will throw the `TypeError` because there is no - * matching error type in the assertion: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * However, the following will result in an `AssertionError` with the message - * 'Got unwanted exception...': - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * TypeError, - * ); - * ``` - * - * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * /Wrong value/, - * 'Whoops', - * ); - * // Throws: AssertionError: Got unwanted exception: Whoops - * ``` - * @since v0.1.21 - */ - function doesNotThrow(block: () => unknown, message?: string | Error): void; - function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Throws `value` if `value` is not `undefined` or `null`. This is useful when - * testing the `error` argument in callbacks. The stack trace contains all frames - * from the error passed to `ifError()` including the potential new frames for`ifError()` itself. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ifError(null); - * // OK - * assert.ifError(0); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 - * assert.ifError('error'); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' - * assert.ifError(new Error()); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error - * - * // Create some random error frames. - * let err; - * (function errorFrame() { - * err = new Error('test error'); - * })(); - * - * (function ifErrorFrame() { - * assert.ifError(err); - * })(); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error - * // at ifErrorFrame - * // at errorFrame - * ``` - * @since v0.1.97 - */ - function ifError(value: unknown): asserts value is null | undefined; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is rejected. - * - * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the - * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error - * handler is skipped. - * - * Besides the async nature to await the completion behaves identically to {@link throws}. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * an object where each property will be tested for, or an instance of error where - * each property will be tested for including the non-enumerable `message` and`name` properties. - * - * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * (err) => { - * assert.strictEqual(err.name, 'TypeError'); - * assert.strictEqual(err.message, 'Wrong value'); - * return true; - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.rejects( - * Promise.reject(new Error('Wrong value')), - * Error, - * ).then(() => { - * // ... - * }); - * ``` - * - * `error` cannot be a string. If a string is provided as the second - * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the - * example in {@link throws} carefully if using a string as the second - * argument gets considered. - * @since v10.0.0 - */ - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is not rejected. - * - * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If - * the function does not return a promise, `assert.doesNotReject()` will return a - * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases - * the error handler is skipped. - * - * Using `assert.doesNotReject()` is actually not useful because there is little - * benefit in catching a rejection and then rejecting it again. Instead, consider - * adding a comment next to the specific code path that should not reject and keep - * error messages as expressive as possible. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.doesNotReject( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) - * .then(() => { - * // ... - * }); - * ``` - * @since v10.0.0 - */ - function doesNotReject( - block: (() => Promise) | Promise, - message?: string | Error, - ): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Expects the `string` input to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.match('I will fail', /pass/); - * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... - * - * assert.match(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.match('I will pass', /pass/); - * // OK - * ``` - * - * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v13.6.0, v12.16.0 - */ - function match(value: string, regExp: RegExp, message?: string | Error): void; - /** - * Expects the `string` input not to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotMatch('I will fail', /fail/); - * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... - * - * assert.doesNotMatch(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.doesNotMatch('I will pass', /different/); - * // OK - * ``` - * - * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v13.6.0, v12.16.0 - */ - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - const strict: - & Omit< - typeof assert, - | "equal" - | "notEqual" - | "deepEqual" - | "notDeepEqual" - | "ok" - | "strictEqual" - | "deepStrictEqual" - | "ifError" - | "strict" - > - & { - (value: unknown, message?: string | Error): asserts value; - equal: typeof strictEqual; - notEqual: typeof notStrictEqual; - deepEqual: typeof deepStrictEqual; - notDeepEqual: typeof notDeepStrictEqual; - // Mapped types and assertion functions are incompatible? - // TS2775: Assertions require every name in the call target - // to be declared with an explicit type annotation. - ok: typeof ok; - strictEqual: typeof strictEqual; - deepStrictEqual: typeof deepStrictEqual; - ifError: typeof ifError; - strict: typeof strict; - }; - } - export = assert; -} -declare module "node:assert" { - import assert = require("assert"); - export = assert; -} diff --git a/reverse_engineering/node_modules/@types/node/assert/strict.d.ts b/reverse_engineering/node_modules/@types/node/assert/strict.d.ts deleted file mode 100644 index f333913a..00000000 --- a/reverse_engineering/node_modules/@types/node/assert/strict.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare module "assert/strict" { - import { strict } from "node:assert"; - export = strict; -} -declare module "node:assert/strict" { - import { strict } from "node:assert"; - export = strict; -} diff --git a/reverse_engineering/node_modules/@types/node/async_hooks.d.ts b/reverse_engineering/node_modules/@types/node/async_hooks.d.ts deleted file mode 100644 index 0667a615..00000000 --- a/reverse_engineering/node_modules/@types/node/async_hooks.d.ts +++ /dev/null @@ -1,539 +0,0 @@ -/** - * We strongly discourage the use of the `async_hooks` API. - * Other APIs that can cover most of its use cases include: - * - * * `AsyncLocalStorage` tracks async context - * * `process.getActiveResourcesInfo()` tracks active resources - * - * The `node:async_hooks` module provides an API to track asynchronous resources. - * It can be accessed using: - * - * ```js - * import async_hooks from 'node:async_hooks'; - * ``` - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js) - */ -declare module "async_hooks" { - /** - * ```js - * import { executionAsyncId } from 'node:async_hooks'; - * import fs from 'node:fs'; - * - * console.log(executionAsyncId()); // 1 - bootstrap - * const path = '.'; - * fs.open(path, 'r', (err, fd) => { - * console.log(executionAsyncId()); // 6 - open() - * }); - * ``` - * - * The ID returned from `executionAsyncId()` is related to execution timing, not - * causality (which is covered by `triggerAsyncId()`): - * - * ```js - * const server = net.createServer((conn) => { - * // Returns the ID of the server, not of the new connection, because the - * // callback runs in the execution scope of the server's MakeCallback(). - * async_hooks.executionAsyncId(); - * - * }).listen(port, () => { - * // Returns the ID of a TickObject (process.nextTick()) because all - * // callbacks passed to .listen() are wrapped in a nextTick(). - * async_hooks.executionAsyncId(); - * }); - * ``` - * - * Promise contexts may not get precise `executionAsyncIds` by default. - * See the section on `promise execution tracking`. - * @since v8.1.0 - * @return The `asyncId` of the current execution context. Useful to track when something calls. - */ - function executionAsyncId(): number; - /** - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - * - * ```js - * import { open } from 'node:fs'; - * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; - * - * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} - * open(new URL(import.meta.url), 'r', (err, fd) => { - * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap - * }); - * ``` - * - * This can be used to implement continuation local storage without the - * use of a tracking `Map` to store the metadata: - * - * ```js - * import { createServer } from 'node:http'; - * import { - * executionAsyncId, - * executionAsyncResource, - * createHook, - * } from 'async_hooks'; - * const sym = Symbol('state'); // Private symbol to avoid pollution - * - * createHook({ - * init(asyncId, type, triggerAsyncId, resource) { - * const cr = executionAsyncResource(); - * if (cr) { - * resource[sym] = cr[sym]; - * } - * }, - * }).enable(); - * - * const server = createServer((req, res) => { - * executionAsyncResource()[sym] = { state: req.url }; - * setTimeout(function() { - * res.end(JSON.stringify(executionAsyncResource()[sym])); - * }, 100); - * }).listen(3000); - * ``` - * @since v13.9.0, v12.17.0 - * @return The resource representing the current execution. Useful to store data within the resource. - */ - function executionAsyncResource(): object; - /** - * ```js - * const server = net.createServer((conn) => { - * // The resource that caused (or triggered) this callback to be called - * // was that of the new connection. Thus the return value of triggerAsyncId() - * // is the asyncId of "conn". - * async_hooks.triggerAsyncId(); - * - * }).listen(port, () => { - * // Even though all callbacks passed to .listen() are wrapped in a nextTick() - * // the callback itself exists because the call to the server's .listen() - * // was made. So the return value would be the ID of the server. - * async_hooks.triggerAsyncId(); - * }); - * ``` - * - * Promise contexts may not get valid `triggerAsyncId`s by default. See - * the section on `promise execution tracking`. - * @return The ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId a unique ID for the async resource - * @param type the type of the async resource - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created - * @param resource reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - /** - * Called immediately after the callback specified in before is completed. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - /** - * Registers functions to be called for different lifetime events of each async - * operation. - * - * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the - * respective asynchronous event during a resource's lifetime. - * - * All callbacks are optional. For example, if only resource cleanup needs to - * be tracked, then only the `destroy` callback needs to be passed. The - * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. - * - * ```js - * import { createHook } from 'node:async_hooks'; - * - * const asyncHook = createHook({ - * init(asyncId, type, triggerAsyncId, resource) { }, - * destroy(asyncId) { }, - * }); - * ``` - * - * The callbacks will be inherited via the prototype chain: - * - * ```js - * class MyAsyncCallbacks { - * init(asyncId, type, triggerAsyncId, resource) { } - * destroy(asyncId) {} - * } - * - * class MyAddedCallbacks extends MyAsyncCallbacks { - * before(asyncId) { } - * after(asyncId) { } - * } - * - * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); - * ``` - * - * Because promises are asynchronous resources whose lifecycle is tracked - * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. - * @since v8.1.0 - * @param callbacks The `Hook Callbacks` to register - * @return Instance used for disabling and enabling hooks - */ - function createHook(callbacks: HookCallbacks): AsyncHook; - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * @default executionAsyncId() - */ - triggerAsyncId?: number | undefined; - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * @default false - */ - requireManualDestroy?: boolean | undefined; - } - /** - * The class `AsyncResource` is designed to be extended by the embedder's async - * resources. Using this, users can easily trigger the lifetime events of their - * own resources. - * - * The `init` hook will trigger when an `AsyncResource` is instantiated. - * - * The following is an overview of the `AsyncResource` API. - * - * ```js - * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; - * - * // AsyncResource() is meant to be extended. Instantiating a - * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * // async_hook.executionAsyncId() is used. - * const asyncResource = new AsyncResource( - * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, - * ); - * - * // Run a function in the execution context of the resource. This will - * // * establish the context of the resource - * // * trigger the AsyncHooks before callbacks - * // * call the provided function `fn` with the supplied arguments - * // * trigger the AsyncHooks after callbacks - * // * restore the original execution context - * asyncResource.runInAsyncScope(fn, thisArg, ...args); - * - * // Call AsyncHooks destroy callbacks. - * asyncResource.emitDestroy(); - * - * // Return the unique ID assigned to the AsyncResource instance. - * asyncResource.asyncId(); - * - * // Return the trigger ID for the AsyncResource instance. - * asyncResource.triggerAsyncId(); - * ``` - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since v9.3.0) - */ - constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); - /** - * Binds the given function to the current execution context. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current execution context. - * @param type An optional name to associate with the underlying `AsyncResource`. - */ - static bind any, ThisArg>( - fn: Func, - type?: string, - thisArg?: ThisArg, - ): Func; - /** - * Binds the given function to execute to this `AsyncResource`'s scope. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current `AsyncResource`. - */ - bind any>(fn: Func): Func; - /** - * Call the provided function with the provided arguments in the execution context - * of the async resource. This will establish the context, trigger the AsyncHooks - * before callbacks, call the function, trigger the AsyncHooks after callbacks, and - * then restore the original execution context. - * @since v9.6.0 - * @param fn The function to call in the execution context of this async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope( - fn: (this: This, ...args: any[]) => Result, - thisArg?: This, - ...args: any[] - ): Result; - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - * @return A reference to `asyncResource`. - */ - emitDestroy(): this; - /** - * @return The unique `asyncId` assigned to the resource. - */ - asyncId(): number; - /** - * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. - */ - triggerAsyncId(): number; - } - /** - * This class creates stores that stay coherent through asynchronous operations. - * - * While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory - * safe implementation that involves significant optimizations that are non-obvious - * to implement. - * - * The following example uses `AsyncLocalStorage` to build a simple logger - * that assigns IDs to incoming HTTP requests and includes them in messages - * logged within each request. - * - * ```js - * import http from 'node:http'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const asyncLocalStorage = new AsyncLocalStorage(); - * - * function logWithId(msg) { - * const id = asyncLocalStorage.getStore(); - * console.log(`${id !== undefined ? id : '-'}:`, msg); - * } - * - * let idSeq = 0; - * http.createServer((req, res) => { - * asyncLocalStorage.run(idSeq++, () => { - * logWithId('start'); - * // Imagine any chain of async operations here - * setImmediate(() => { - * logWithId('finish'); - * res.end(); - * }); - * }); - * }).listen(8080); - * - * http.get('http://localhost:8080'); - * http.get('http://localhost:8080'); - * // Prints: - * // 0: start - * // 1: start - * // 0: finish - * // 1: finish - * ``` - * - * Each instance of `AsyncLocalStorage` maintains an independent storage context. - * Multiple instances can safely exist simultaneously without risk of interfering - * with each other's data. - * @since v13.10.0, v12.17.0 - */ - class AsyncLocalStorage { - /** - * Binds the given function to the current execution context. - * @since v19.8.0 - * @experimental - * @param fn The function to bind to the current execution context. - * @return A new function that calls `fn` within the captured execution context. - */ - static bind any>(fn: Func): Func; - /** - * Captures the current execution context and returns a function that accepts a - * function as an argument. Whenever the returned function is called, it - * calls the function passed to it within the captured context. - * - * ```js - * const asyncLocalStorage = new AsyncLocalStorage(); - * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); - * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); - * console.log(result); // returns 123 - * ``` - * - * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple - * async context tracking purposes, for example: - * - * ```js - * class Foo { - * #runInAsyncScope = AsyncLocalStorage.snapshot(); - * - * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } - * } - * - * const foo = asyncLocalStorage.run(123, () => new Foo()); - * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 - * ``` - * @since v19.8.0 - * @experimental - * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. - */ - static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; - /** - * Disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * Use this method when the `asyncLocalStorage` is not in use anymore - * in the current process. - * @since v13.10.0, v12.17.0 - * @experimental - */ - disable(): void; - /** - * Returns the current store. - * If called outside of an asynchronous context initialized by - * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it - * returns `undefined`. - * @since v13.10.0, v12.17.0 - */ - getStore(): T | undefined; - /** - * Runs a function synchronously within a context and returns its - * return value. The store is not accessible outside of the callback function. - * The store is accessible to any asynchronous operations created within the - * callback. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `run()` too. - * The stacktrace is not impacted by this call and the context is exited. - * - * Example: - * - * ```js - * const store = { id: 2 }; - * try { - * asyncLocalStorage.run(store, () => { - * asyncLocalStorage.getStore(); // Returns the store object - * setTimeout(() => { - * asyncLocalStorage.getStore(); // Returns the store object - * }, 200); - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns undefined - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - */ - run(store: T, callback: () => R): R; - run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Runs a function synchronously outside of a context and returns its - * return value. The store is not accessible within the callback function or - * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `exit()` too. - * The stacktrace is not impacted by this call and the context is re-entered. - * - * Example: - * - * ```js - * // Within a call to run - * try { - * asyncLocalStorage.getStore(); // Returns the store object or value - * asyncLocalStorage.exit(() => { - * asyncLocalStorage.getStore(); // Returns undefined - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns the same object or value - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - * @experimental - */ - exit(callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Transitions into the context for the remainder of the current - * synchronous execution and then persists the store through any following - * asynchronous calls. - * - * Example: - * - * ```js - * const store = { id: 1 }; - * // Replaces previous store with the given store object - * asyncLocalStorage.enterWith(store); - * asyncLocalStorage.getStore(); // Returns the store object - * someAsyncOperation(() => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * ``` - * - * This transition will continue for the _entire_ synchronous execution. - * This means that if, for example, the context is entered within an event - * handler subsequent event handlers will also run within that context unless - * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons - * to use the latter method. - * - * ```js - * const store = { id: 1 }; - * - * emitter.on('my-event', () => { - * asyncLocalStorage.enterWith(store); - * }); - * emitter.on('my-event', () => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * - * asyncLocalStorage.getStore(); // Returns undefined - * emitter.emit('my-event'); - * asyncLocalStorage.getStore(); // Returns the same object - * ``` - * @since v13.11.0, v12.17.0 - * @experimental - */ - enterWith(store: T): void; - } -} -declare module "node:async_hooks" { - export * from "async_hooks"; -} diff --git a/reverse_engineering/node_modules/@types/node/buffer.d.ts b/reverse_engineering/node_modules/@types/node/buffer.d.ts deleted file mode 100644 index 1ee5c013..00000000 --- a/reverse_engineering/node_modules/@types/node/buffer.d.ts +++ /dev/null @@ -1,2362 +0,0 @@ -/** - * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many - * Node.js APIs support `Buffer`s. - * - * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and - * extends it with methods that cover additional use cases. Node.js APIs accept - * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. - * - * While the `Buffer` class is available within the global scope, it is still - * recommended to explicitly reference it via an import or require statement. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a zero-filled Buffer of length 10. - * const buf1 = Buffer.alloc(10); - * - * // Creates a Buffer of length 10, - * // filled with bytes which all have the value `1`. - * const buf2 = Buffer.alloc(10, 1); - * - * // Creates an uninitialized buffer of length 10. - * // This is faster than calling Buffer.alloc() but the returned - * // Buffer instance might contain old data that needs to be - * // overwritten using fill(), write(), or other functions that fill the Buffer's - * // contents. - * const buf3 = Buffer.allocUnsafe(10); - * - * // Creates a Buffer containing the bytes [1, 2, 3]. - * const buf4 = Buffer.from([1, 2, 3]); - * - * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries - * // are all truncated using `(value & 255)` to fit into the range 0–255. - * const buf5 = Buffer.from([257, 257.5, -255, '1']); - * - * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': - * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) - * // [116, 195, 169, 115, 116] (in decimal notation) - * const buf6 = Buffer.from('tést'); - * - * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. - * const buf7 = Buffer.from('tést', 'latin1'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js) - */ -declare module "buffer" { - import { BinaryLike } from "node:crypto"; - import { ReadableStream as WebReadableStream } from "node:stream/web"; - /** - * This function returns `true` if `input` contains only valid UTF-8-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.4.0, v18.14.0 - * @param input The input to validate. - */ - export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - /** - * This function returns `true` if `input` contains only valid ASCII-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.6.0, v18.15.0 - * @param input The input to validate. - */ - export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - export const INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - export type TranscodeEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "latin1" - | "binary"; - /** - * Re-encodes the given `Buffer` or `Uint8Array` instance from one character - * encoding to another. Returns a new `Buffer` instance. - * - * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if - * conversion from `fromEnc` to `toEnc` is not permitted. - * - * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. - * - * The transcoding process will use substitution characters if a given byte - * sequence cannot be adequately represented in the target encoding. For instance: - * - * ```js - * import { Buffer, transcode } from 'node:buffer'; - * - * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); - * console.log(newBuf.toString('ascii')); - * // Prints: '?' - * ``` - * - * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced - * with `?` in the transcoded `Buffer`. - * @since v7.1.0 - * @param source A `Buffer` or `Uint8Array` instance. - * @param fromEnc The current encoding. - * @param toEnc To target encoding. - */ - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; - export const SlowBuffer: { - /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ - new(size: number): Buffer; - prototype: Buffer; - }; - /** - * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using - * a prior call to `URL.createObjectURL()`. - * @since v16.7.0 - * @experimental - * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. - */ - export function resolveObjectURL(id: string): Blob | undefined; - export { Buffer }; - /** - * @experimental - */ - export interface BlobOptions { - /** - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * The Blob content-type. The intent is for `type` to convey - * the MIME media type of the data, however no validation of the type format - * is performed. - */ - type?: string | undefined; - } - /** - * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across - * multiple worker threads. - * @since v15.7.0, v14.18.0 - */ - export class Blob { - /** - * The total size of the `Blob` in bytes. - * @since v15.7.0, v14.18.0 - */ - readonly size: number; - /** - * The content-type of the `Blob`. - * @since v15.7.0, v14.18.0 - */ - readonly type: string; - /** - * Creates a new `Blob` object containing a concatenation of the given sources. - * - * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into - * the 'Blob' and can therefore be safely modified after the 'Blob' is created. - * - * String sources are also copied into the `Blob`. - */ - constructor(sources: Array, options?: BlobOptions); - /** - * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of - * the `Blob` data. - * @since v15.7.0, v14.18.0 - */ - arrayBuffer(): Promise; - /** - * Creates and returns a new `Blob` containing a subset of this `Blob` objects - * data. The original `Blob` is not altered. - * @since v15.7.0, v14.18.0 - * @param start The starting index. - * @param end The ending index. - * @param type The content-type for the new `Blob` - */ - slice(start?: number, end?: number, type?: string): Blob; - /** - * Returns a promise that fulfills with the contents of the `Blob` decoded as a - * UTF-8 string. - * @since v15.7.0, v14.18.0 - */ - text(): Promise; - /** - * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. - * @since v16.7.0 - */ - stream(): WebReadableStream; - } - export interface FileOptions { - /** - * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be - * converted to the platform native line-ending as specified by `require('node:os').EOL`. - */ - endings?: "native" | "transparent"; - /** The File content-type. */ - type?: string; - /** The last modified date of the file. `Default`: Date.now(). */ - lastModified?: number; - } - /** - * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. - * @since v19.2.0, v18.13.0 - */ - export class File extends Blob { - constructor(sources: Array, fileName: string, options?: FileOptions); - /** - * The name of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly name: string; - /** - * The last modified date of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly lastModified: number; - } - export import atob = globalThis.atob; - export import btoa = globalThis.btoa; - import { Blob as NodeBlob } from "buffer"; - // This conditional type will be the existing global Blob in a browser, or - // the copy below in a Node environment. - type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob; - global { - namespace NodeJS { - export { BufferEncoding }; - } - // Buffer class - type BufferEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "base64" - | "base64url" - | "latin1" - | "binary" - | "hex"; - type WithImplicitCoercion = - | T - | { - valueOf(): T; - }; - /** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' - */ - interface BufferConstructor { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - new(str: string, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - new(size: number): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: Uint8Array): Buffer; - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: readonly any[]): Buffer; - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. - */ - new(buffer: Buffer): Buffer; - /** - * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. - * Array entries outside that range will be truncated to fit into it. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. - * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); - * ``` - * - * If `array` is an `Array`\-like object (that is, one with a `length` property of - * type `number`), it is treated as if it is an array, unless it is a `Buffer` or - * a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. - * - * A `TypeError` will be thrown if `array` is not an `Array` or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v5.10.0 - */ - from( - arrayBuffer: WithImplicitCoercion, - byteOffset?: number, - length?: number, - ): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param data data to create a new Buffer - */ - from(data: Uint8Array | readonly number[]): Buffer; - from(data: WithImplicitCoercion): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - */ - from( - str: - | WithImplicitCoercion - | { - [Symbol.toPrimitive](hint: "string"): string; - }, - encoding?: BufferEncoding, - ): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - of(...items: number[]): Buffer; - /** - * Returns `true` if `obj` is a `Buffer`, `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * Buffer.isBuffer(Buffer.alloc(10)); // true - * Buffer.isBuffer(Buffer.from('foo')); // true - * Buffer.isBuffer('a string'); // false - * Buffer.isBuffer([]); // false - * Buffer.isBuffer(new Uint8Array(1024)); // false - * ``` - * @since v0.1.101 - */ - isBuffer(obj: any): obj is Buffer; - /** - * Returns `true` if `encoding` is the name of a supported character encoding, - * or `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * console.log(Buffer.isEncoding('utf8')); - * // Prints: true - * - * console.log(Buffer.isEncoding('hex')); - * // Prints: true - * - * console.log(Buffer.isEncoding('utf/8')); - * // Prints: false - * - * console.log(Buffer.isEncoding('')); - * // Prints: false - * ``` - * @since v0.9.1 - * @param encoding A character encoding name to check. - */ - isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account - * for the encoding that is used to convert the string into bytes. - * - * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. - * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the - * return value might be greater than the length of a `Buffer` created from the - * string. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const str = '\u00bd + \u00bc = \u00be'; - * - * console.log(`${str}: ${str.length} characters, ` + - * `${Buffer.byteLength(str, 'utf8')} bytes`); - * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes - * ``` - * - * When `string` is a - * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- - * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- - * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. - * @since v0.1.90 - * @param string A value to calculate the length of. - * @param [encoding='utf8'] If `string` is a string, this is its encoding. - * @return The number of bytes contained within `string`. - */ - byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, - encoding?: BufferEncoding, - ): number; - /** - * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. - * - * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned. - * - * If `totalLength` is not provided, it is calculated from the `Buffer` instances - * in `list` by adding their lengths. - * - * If `totalLength` is provided, it is coerced to an unsigned integer. If the - * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is - * truncated to `totalLength`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a single `Buffer` from a list of three `Buffer` instances. - * - * const buf1 = Buffer.alloc(10); - * const buf2 = Buffer.alloc(14); - * const buf3 = Buffer.alloc(18); - * const totalLength = buf1.length + buf2.length + buf3.length; - * - * console.log(totalLength); - * // Prints: 42 - * - * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); - * - * console.log(bufA); - * // Prints: - * console.log(bufA.length); - * // Prints: 42 - * ``` - * - * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v0.7.11 - * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. - * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. - */ - concat(list: readonly Uint8Array[], totalLength?: number): Buffer; - /** - * Copies the underlying memory of `view` into a new `Buffer`. - * - * ```js - * const u16 = new Uint16Array([0, 0xffff]); - * const buf = Buffer.copyBytesFrom(u16, 1, 1); - * u16[1] = 0; - * console.log(buf.length); // 2 - * console.log(buf[0]); // 255 - * console.log(buf[1]); // 255 - * ``` - * @since v19.8.0 - * @param view The {TypedArray} to copy. - * @param [offset=': 0'] The starting offset within `view`. - * @param [length=view.length - offset] The number of elements from `view` to copy. - */ - copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; - /** - * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('1234'); - * const buf2 = Buffer.from('0123'); - * const arr = [buf1, buf2]; - * - * console.log(arr.sort(Buffer.compare)); - * // Prints: [ , ] - * // (This result is equal to: [buf2, buf1].) - * ``` - * @since v0.11.13 - * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. - */ - compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; - /** - * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5); - * - * console.log(buf); - * // Prints: - * ``` - * - * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5, 'a'); - * - * console.log(buf); - * // Prints: - * ``` - * - * If both `fill` and `encoding` are specified, the allocated `Buffer` will be - * initialized by calling `buf.fill(fill, encoding)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); - * - * console.log(buf); - * // Prints: - * ``` - * - * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance - * contents will never contain sensitive data from previous allocations, including - * data that might not have been allocated for `Buffer`s. - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - * @param [fill=0] A value to pre-fill the new `Buffer` with. - * @param [encoding='utf8'] If `fill` is a string, this is its encoding. - */ - alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(10); - * - * console.log(buf); - * // Prints (contents may vary): - * - * buf.fill(0); - * - * console.log(buf); - * // Prints: - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * - * The `Buffer` module pre-allocates an internal `Buffer` instance of - * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, - * and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). - * - * Use of this pre-allocated internal memory pool is a key difference between - * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. - * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less - * than or equal to half `Buffer.poolSize`. The - * difference is subtle but can be important when an application requires the - * additional performance that `Buffer.allocUnsafe()` provides. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafe(size: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if - * `size` is 0. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize - * such `Buffer` instances with zeroes. - * - * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, - * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This - * allows applications to avoid the garbage collection overhead of creating many - * individually allocated `Buffer` instances. This approach improves both - * performance and memory usage by eliminating the need to track and clean up as - * many individual `ArrayBuffer` objects. - * - * However, in the case where a developer may need to retain a small chunk of - * memory from a pool for an indeterminate amount of time, it may be appropriate - * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and - * then copying out the relevant bits. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Need to keep around a few small chunks of memory. - * const store = []; - * - * socket.on('readable', () => { - * let data; - * while (null !== (data = readable.read())) { - * // Allocate for retained data. - * const sb = Buffer.allocUnsafeSlow(10); - * - * // Copy the data into the new allocation. - * data.copy(sb, 0, 0, 10); - * - * store.push(sb); - * } - * }); - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.12.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafeSlow(size: number): Buffer; - /** - * This is the size (in bytes) of pre-allocated internal `Buffer` instances used - * for pooling. This value may be modified. - * @since v0.11.3 - */ - poolSize: number; - } - interface Buffer extends Uint8Array { - /** - * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did - * not contain enough space to fit the entire string, only part of `string` will be - * written. However, partially encoded characters will not be written. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(256); - * - * const len = buf.write('\u00bd + \u00bc = \u00be', 0); - * - * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); - * // Prints: 12 bytes: ½ + ¼ = ¾ - * - * const buffer = Buffer.alloc(10); - * - * const length = buffer.write('abcd', 8); - * - * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); - * // Prints: 2 bytes : ab - * ``` - * @since v0.1.90 - * @param string String to write to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write `string`. - * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). - * @param [encoding='utf8'] The character encoding of `string`. - * @return Number of bytes written. - */ - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - /** - * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. - * - * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, - * then each invalid byte is replaced with the replacement character `U+FFFD`. - * - * The maximum length of a string instance (in UTF-16 code units) is available - * as {@link constants.MAX_STRING_LENGTH}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * console.log(buf1.toString('utf8')); - * // Prints: abcdefghijklmnopqrstuvwxyz - * console.log(buf1.toString('utf8', 0, 5)); - * // Prints: abcde - * - * const buf2 = Buffer.from('tést'); - * - * console.log(buf2.toString('hex')); - * // Prints: 74c3a97374 - * console.log(buf2.toString('utf8', 0, 3)); - * // Prints: té - * console.log(buf2.toString(undefined, 0, 3)); - * // Prints: té - * ``` - * @since v0.1.90 - * @param [encoding='utf8'] The character encoding to use. - * @param [start=0] The byte offset to start decoding at. - * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). - */ - toString(encoding?: BufferEncoding, start?: number, end?: number): string; - /** - * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls - * this function when stringifying a `Buffer` instance. - * - * `Buffer.from()` accepts objects in the format returned from this method. - * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); - * const json = JSON.stringify(buf); - * - * console.log(json); - * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} - * - * const copy = JSON.parse(json, (key, value) => { - * return value && value.type === 'Buffer' ? - * Buffer.from(value) : - * value; - * }); - * - * console.log(copy); - * // Prints: - * ``` - * @since v0.9.2 - */ - toJSON(): { - type: "Buffer"; - data: number[]; - }; - /** - * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('414243', 'hex'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.equals(buf2)); - * // Prints: true - * console.log(buf1.equals(buf3)); - * // Prints: false - * ``` - * @since v0.11.13 - * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. - */ - equals(otherBuffer: Uint8Array): boolean; - /** - * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. - * Comparison is based on the actual sequence of bytes in each `Buffer`. - * - * * `0` is returned if `target` is the same as `buf` - * * `1` is returned if `target` should come _before_`buf` when sorted. - * * `-1` is returned if `target` should come _after_`buf` when sorted. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('BCD'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.compare(buf1)); - * // Prints: 0 - * console.log(buf1.compare(buf2)); - * // Prints: -1 - * console.log(buf1.compare(buf3)); - * // Prints: -1 - * console.log(buf2.compare(buf1)); - * // Prints: 1 - * console.log(buf2.compare(buf3)); - * // Prints: 1 - * console.log([buf1, buf2, buf3].sort(Buffer.compare)); - * // Prints: [ , , ] - * // (This result is equal to: [buf1, buf3, buf2].) - * ``` - * - * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); - * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); - * - * console.log(buf1.compare(buf2, 5, 9, 0, 4)); - * // Prints: 0 - * console.log(buf1.compare(buf2, 0, 6, 4)); - * // Prints: -1 - * console.log(buf1.compare(buf2, 5, 6, 5)); - * // Prints: 1 - * ``` - * - * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. - * @since v0.11.13 - * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. - * @param [targetStart=0] The offset within `target` at which to begin comparison. - * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). - * @param [sourceStart=0] The offset within `buf` at which to begin comparison. - * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). - */ - compare( - target: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number, - ): -1 | 0 | 1; - /** - * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. - * - * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available - * for all TypedArrays, including Node.js `Buffer`s, although it takes - * different function arguments. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create two `Buffer` instances. - * const buf1 = Buffer.allocUnsafe(26); - * const buf2 = Buffer.allocUnsafe(26).fill('!'); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. - * buf1.copy(buf2, 8, 16, 20); - * // This is equivalent to: - * // buf2.set(buf1.subarray(16, 20), 8); - * - * console.log(buf2.toString('ascii', 0, 25)); - * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! - * ``` - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` and copy data from one region to an overlapping region - * // within the same `Buffer`. - * - * const buf = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf[i] = i + 97; - * } - * - * buf.copy(buf, 0, 4, 10); - * - * console.log(buf.toString()); - * // Prints: efghijghijklmnopqrstuvwxyz - * ``` - * @since v0.1.90 - * @param target A `Buffer` or {@link Uint8Array} to copy into. - * @param [targetStart=0] The offset within `target` at which to begin writing. - * @param [sourceStart=0] The offset within `buf` from which to begin copying. - * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). - * @return The number of bytes copied. - */ - copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * This method is not compatible with the `Uint8Array.prototype.slice()`, - * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * const copiedBuf = Uint8Array.prototype.slice.call(buf); - * copiedBuf[0]++; - * console.log(copiedBuf.toString()); - * // Prints: cuffer - * - * console.log(buf.toString()); - * // Prints: buffer - * - * // With buf.slice(), the original buffer is modified. - * const notReallyCopiedBuf = buf.slice(); - * notReallyCopiedBuf[0]++; - * console.log(notReallyCopiedBuf.toString()); - * // Prints: cuffer - * console.log(buf.toString()); - * // Also prints: cuffer (!) - * ``` - * @since v0.3.0 - * @deprecated Use `subarray` instead. - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - slice(start?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * Specifying `end` greater than `buf.length` will return the same result as - * that of `end` equal to `buf.length`. - * - * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). - * - * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte - * // from the original `Buffer`. - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * const buf2 = buf1.subarray(0, 3); - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: abc - * - * buf1[0] = 33; - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: !bc - * ``` - * - * Specifying negative indexes causes the slice to be generated relative to the - * end of `buf` rather than the beginning. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * console.log(buf.subarray(-6, -1).toString()); - * // Prints: buffe - * // (Equivalent to buf.subarray(0, 5).) - * - * console.log(buf.subarray(-6, -2).toString()); - * // Prints: buff - * // (Equivalent to buf.subarray(0, 4).) - * - * console.log(buf.subarray(-5, -2).toString()); - * // Prints: uff - * // (Equivalent to buf.subarray(1, 4).) - * ``` - * @since v3.0.0 - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - subarray(start?: number, end?: number): Buffer; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64BE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64LE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64LE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * This function is also available under the `writeBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64BE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * - * This function is also available under the `writeBigUint64LE` alias. - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64LE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64LE(value: bigint, offset?: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntLE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntLE - * @since v14.9.0, v12.19.0 - */ - writeUintLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntBE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntBE - * @since v14.9.0, v12.19.0 - */ - writeUintBE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than a signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a - * signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntBE(value: number, offset: number, byteLength: number): number; - /** - * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64BE(0)); - * // Prints: 4294967295n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64BE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - readBigUint64BE(offset?: number): bigint; - /** - * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64LE(0)); - * // Prints: 18446744069414584320n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64LE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - readBigUint64LE(offset?: number): bigint; - /** - * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64BE(offset?: number): bigint; - /** - * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64LE(offset?: number): bigint; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntLE(0, 6).toString(16)); - * // Prints: ab9078563412 - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntLE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntLE - * @since v14.9.0, v12.19.0 - */ - readUintLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readUIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntBE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntBE - * @since v14.9.0, v12.19.0 - */ - readUintBE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntLE(0, 6).toString(16)); - * // Prints: -546f87a9cbee - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * console.log(buf.readIntBE(1, 0).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntBE(offset: number, byteLength: number): number; - /** - * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. - * - * This function is also available under the `readUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, -2]); - * - * console.log(buf.readUInt8(0)); - * // Prints: 1 - * console.log(buf.readUInt8(1)); - * // Prints: 254 - * console.log(buf.readUInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readUInt8(offset?: number): number; - /** - * @alias Buffer.readUInt8 - * @since v14.9.0, v12.19.0 - */ - readUint8(offset?: number): number; - /** - * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16LE(0).toString(16)); - * // Prints: 3412 - * console.log(buf.readUInt16LE(1).toString(16)); - * // Prints: 5634 - * console.log(buf.readUInt16LE(2).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16LE(offset?: number): number; - /** - * @alias Buffer.readUInt16LE - * @since v14.9.0, v12.19.0 - */ - readUint16LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16BE(0).toString(16)); - * // Prints: 1234 - * console.log(buf.readUInt16BE(1).toString(16)); - * // Prints: 3456 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16BE(offset?: number): number; - /** - * @alias Buffer.readUInt16BE - * @since v14.9.0, v12.19.0 - */ - readUint16BE(offset?: number): number; - /** - * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32LE(0).toString(16)); - * // Prints: 78563412 - * console.log(buf.readUInt32LE(1).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32LE(offset?: number): number; - /** - * @alias Buffer.readUInt32LE - * @since v14.9.0, v12.19.0 - */ - readUint32LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32BE(0).toString(16)); - * // Prints: 12345678 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32BE(offset?: number): number; - /** - * @alias Buffer.readUInt32BE - * @since v14.9.0, v12.19.0 - */ - readUint32BE(offset?: number): number; - /** - * Reads a signed 8-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([-1, 5]); - * - * console.log(buf.readInt8(0)); - * // Prints: -1 - * console.log(buf.readInt8(1)); - * // Prints: 5 - * console.log(buf.readInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readInt8(offset?: number): number; - /** - * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16LE(0)); - * // Prints: 1280 - * console.log(buf.readInt16LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16LE(offset?: number): number; - /** - * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16BE(offset?: number): number; - /** - * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32LE(0)); - * // Prints: 83886080 - * console.log(buf.readInt32LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32LE(offset?: number): number; - /** - * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32BE(offset?: number): number; - /** - * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatLE(0)); - * // Prints: 1.539989614439558e-36 - * console.log(buf.readFloatLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatLE(offset?: number): number; - /** - * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatBE(0)); - * // Prints: 2.387939260590663e-38 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatBE(offset?: number): number; - /** - * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleLE(0)); - * // Prints: 5.447603722011605e-270 - * console.log(buf.readDoubleLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleLE(offset?: number): number; - /** - * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleBE(0)); - * // Prints: 8.20788039913184e-304 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleBE(offset?: number): number; - reverse(): this; - /** - * Interprets `buf` as an array of unsigned 16-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap16(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap16(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * - * One convenient use of `buf.swap16()` is to perform a fast in-place conversion - * between UTF-16 little-endian and UTF-16 big-endian: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); - * buf.swap16(); // Convert to big-endian UTF-16 text. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap16(): Buffer; - /** - * Interprets `buf` as an array of unsigned 32-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap32(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap32(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap32(): Buffer; - /** - * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. - * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap64(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap64(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v6.3.0 - * @return A reference to `buf`. - */ - swap64(): Buffer; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a - * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything - * other than an unsigned 8-bit integer. - * - * This function is also available under the `writeUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt8(0x3, 0); - * buf.writeUInt8(0x4, 1); - * buf.writeUInt8(0x23, 2); - * buf.writeUInt8(0x42, 3); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeUInt8(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt8 - * @since v14.9.0, v12.19.0 - */ - writeUint8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 16-bit integer. - * - * This function is also available under the `writeUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16LE(0xdead, 0); - * buf.writeUInt16LE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16LE - * @since v14.9.0, v12.19.0 - */ - writeUint16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 16-bit integer. - * - * This function is also available under the `writeUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16BE(0xdead, 0); - * buf.writeUInt16BE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16BE - * @since v14.9.0, v12.19.0 - */ - writeUint16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 32-bit integer. - * - * This function is also available under the `writeUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32LE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32LE - * @since v14.9.0, v12.19.0 - */ - writeUint32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 32-bit integer. - * - * This function is also available under the `writeUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32BE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32BE - * @since v14.9.0, v12.19.0 - */ - writeUint32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a valid - * signed 8-bit integer. Behavior is undefined when `value` is anything other than - * a signed 8-bit integer. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt8(2, 0); - * buf.writeInt8(-2, 1); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeInt8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16LE(0x0304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16BE(0x0102, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32LE(0x05060708, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32BE(0x01020304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatLE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatBE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatBE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleLE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleBE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleBE(value: number, offset?: number): number; - /** - * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, - * the entire `buf` will be filled: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with the ASCII character 'h'. - * - * const b = Buffer.allocUnsafe(50).fill('h'); - * - * console.log(b.toString()); - * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - * - * // Fill a buffer with empty string - * const c = Buffer.allocUnsafe(5).fill(''); - * - * console.log(c.fill('')); - * // Prints: - * ``` - * - * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or - * integer. If the resulting integer is greater than `255` (decimal), `buf` will be - * filled with `value & 255`. - * - * If the final write of a `fill()` operation falls on a multi-byte character, - * then only the bytes of that character that fit into `buf` are written: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with character that takes up two bytes in UTF-8. - * - * console.log(Buffer.allocUnsafe(5).fill('\u0222')); - * // Prints: - * ``` - * - * If `value` contains invalid characters, it is truncated; if no valid - * fill data remains, an exception is thrown: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(5); - * - * console.log(buf.fill('a')); - * // Prints: - * console.log(buf.fill('aazz', 'hex')); - * // Prints: - * console.log(buf.fill('zz', 'hex')); - * // Throws an exception. - * ``` - * @since v0.5.0 - * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. - * @param [offset=0] Number of bytes to skip before starting to fill `buf`. - * @param [end=buf.length] Where to stop filling `buf` (not inclusive). - * @param [encoding='utf8'] The encoding for `value` if `value` is a string. - * @return A reference to `buf`. - */ - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - /** - * If `value` is: - * - * * a string, `value` is interpreted according to the character encoding in`encoding`. - * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. - * To compare a partial `Buffer`, use `buf.subarray`. - * * a number, `value` will be interpreted as an unsigned 8-bit integer - * value between `0` and `255`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.indexOf('this')); - * // Prints: 0 - * console.log(buf.indexOf('is')); - * // Prints: 2 - * console.log(buf.indexOf(Buffer.from('a buffer'))); - * // Prints: 8 - * console.log(buf.indexOf(97)); - * // Prints: 8 (97 is the decimal ASCII value for 'a') - * console.log(buf.indexOf(Buffer.from('a buffer example'))); - * // Prints: -1 - * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: 8 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); - * // Prints: 4 - * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); - * // Prints: 6 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. If the result - * of coercion is `NaN` or `0`, then the entire buffer will be searched. This - * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.indexOf(99.9)); - * console.log(b.indexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN or 0. - * // Prints: 1, searching the whole buffer. - * console.log(b.indexOf('b', undefined)); - * console.log(b.indexOf('b', {})); - * console.log(b.indexOf('b', null)); - * console.log(b.indexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer` and `byteOffset` is less - * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. - * @since v1.5.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - /** - * Identical to `buf.indexOf()`, except the last occurrence of `value` is found - * rather than the first occurrence. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this buffer is a buffer'); - * - * console.log(buf.lastIndexOf('this')); - * // Prints: 0 - * console.log(buf.lastIndexOf('buffer')); - * // Prints: 17 - * console.log(buf.lastIndexOf(Buffer.from('buffer'))); - * // Prints: 17 - * console.log(buf.lastIndexOf(97)); - * // Prints: 15 (97 is the decimal ASCII value for 'a') - * console.log(buf.lastIndexOf(Buffer.from('yolo'))); - * // Prints: -1 - * console.log(buf.lastIndexOf('buffer', 5)); - * // Prints: 5 - * console.log(buf.lastIndexOf('buffer', 4)); - * // Prints: -1 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); - * // Prints: 6 - * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); - * // Prints: 4 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. Any arguments - * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. - * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.lastIndexOf(99.9)); - * console.log(b.lastIndexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN. - * // Prints: 1, searching the whole buffer. - * console.log(b.lastIndexOf('b', undefined)); - * console.log(b.lastIndexOf('b', {})); - * - * // Passing a byteOffset that coerces to 0. - * // Prints: -1, equivalent to passing 0. - * console.log(b.lastIndexOf('b', null)); - * console.log(b.lastIndexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. - * @since v6.0.0 - * @param value What to search for. - * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents - * of `buf`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Log the entire contents of a `Buffer`. - * - * const buf = Buffer.from('buffer'); - * - * for (const pair of buf.entries()) { - * console.log(pair); - * } - * // Prints: - * // [0, 98] - * // [1, 117] - * // [2, 102] - * // [3, 102] - * // [4, 101] - * // [5, 114] - * ``` - * @since v1.1.0 - */ - entries(): IterableIterator<[number, number]>; - /** - * Equivalent to `buf.indexOf() !== -1`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.includes('this')); - * // Prints: true - * console.log(buf.includes('is')); - * // Prints: true - * console.log(buf.includes(Buffer.from('a buffer'))); - * // Prints: true - * console.log(buf.includes(97)); - * // Prints: true (97 is the decimal ASCII value for 'a') - * console.log(buf.includes(Buffer.from('a buffer example'))); - * // Prints: false - * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: true - * console.log(buf.includes('this', 4)); - * // Prints: false - * ``` - * @since v5.3.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is its encoding. - * @return `true` if `value` was found in `buf`, `false` otherwise. - */ - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * for (const key of buf.keys()) { - * console.log(key); - * } - * // Prints: - * // 0 - * // 1 - * // 2 - * // 3 - * // 4 - * // 5 - * ``` - * @since v1.1.0 - */ - keys(): IterableIterator; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is - * called automatically when a `Buffer` is used in a `for..of` statement. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * for (const value of buf.values()) { - * console.log(value); - * } - * // Prints: - * // 98 - * // 117 - * // 102 - * // 102 - * // 101 - * // 114 - * - * for (const value of buf) { - * console.log(value); - * } - * // Prints: - * // 98 - * // 117 - * // 102 - * // 102 - * // 101 - * // 114 - * ``` - * @since v1.1.0 - */ - values(): IterableIterator; - } - var Buffer: BufferConstructor; - /** - * Decodes a string of Base64-encoded data into bytes, and encodes those bytes - * into a string using Latin-1 (ISO-8859-1). - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `Buffer.from(data, 'base64')` instead. - * @param data The Base64-encoded input string. - */ - function atob(data: string): string; - /** - * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes - * into a string using Base64. - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `buf.toString('base64')` instead. - * @param data An ASCII (Latin1) string. - */ - function btoa(data: string): string; - interface Blob extends __Blob {} - /** - * `Blob` class is a global reference for `require('node:buffer').Blob` - * https://nodejs.org/api/buffer.html#class-blob - * @since v18.0.0 - */ - var Blob: typeof globalThis extends { - onmessage: any; - Blob: infer T; - } ? T - : typeof NodeBlob; - } -} -declare module "node:buffer" { - export * from "buffer"; -} diff --git a/reverse_engineering/node_modules/@types/node/child_process.d.ts b/reverse_engineering/node_modules/@types/node/child_process.d.ts deleted file mode 100644 index a97532b4..00000000 --- a/reverse_engineering/node_modules/@types/node/child_process.d.ts +++ /dev/null @@ -1,1540 +0,0 @@ -/** - * The `node:child_process` module provides the ability to spawn subprocesses in - * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability - * is primarily provided by the {@link spawn} function: - * - * ```js - * const { spawn } = require('node:child_process'); - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * By default, pipes for `stdin`, `stdout`, and `stderr` are established between - * the parent Node.js process and the spawned subprocess. These pipes have - * limited (and platform-specific) capacity. If the subprocess writes to - * stdout in excess of that limit without the output being captured, the - * subprocess blocks waiting for the pipe buffer to accept more data. This is - * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed. - * - * The command lookup is performed using the `options.env.PATH` environment - * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is - * used. If `options.env` is set without `PATH`, lookup on Unix is performed - * on a default search path search of `/usr/bin:/bin` (see your operating system's - * manual for execvpe/execvp), on Windows the current processes environment - * variable `PATH` is used. - * - * On Windows, environment variables are case-insensitive. Node.js - * lexicographically sorts the `env` keys and uses the first one that - * case-insensitively matches. Only first (in lexicographic order) entry will be - * passed to the subprocess. This might lead to issues on Windows when passing - * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`. - * - * The {@link spawn} method spawns the child process asynchronously, - * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks - * the event loop until the spawned process either exits or is terminated. - * - * For convenience, the `node:child_process` module provides a handful of - * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on - * top of {@link spawn} or {@link spawnSync}. - * - * * {@link exec}: spawns a shell and runs a command within that - * shell, passing the `stdout` and `stderr` to a callback function when - * complete. - * * {@link execFile}: similar to {@link exec} except - * that it spawns the command directly without first spawning a shell by - * default. - * * {@link fork}: spawns a new Node.js process and invokes a - * specified module with an IPC communication channel established that allows - * sending messages between parent and child. - * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. - * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. - * - * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, - * the synchronous methods can have significant impact on performance due to - * stalling the event loop while spawned processes complete. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js) - */ -declare module "child_process" { - import { ObjectEncodingOptions } from "node:fs"; - import { Abortable, EventEmitter } from "node:events"; - import * as net from "node:net"; - import { Pipe, Readable, Stream, Writable } from "node:stream"; - import { URL } from "node:url"; - type Serializable = string | object | number | boolean | bigint; - type SendHandle = net.Socket | net.Server; - /** - * Instances of the `ChildProcess` represent spawned child processes. - * - * Instances of `ChildProcess` are not intended to be created directly. Rather, - * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create - * instances of `ChildProcess`. - * @since v2.2.0 - */ - class ChildProcess extends EventEmitter { - /** - * A `Writable Stream` that represents the child process's `stdin`. - * - * If a child process waits to read all of its input, the child will not continue - * until this stream has been closed via `end()`. - * - * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will - * refer to the same value. - * - * The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdin: Writable | null; - /** - * A `Readable Stream` that represents the child process's `stdout`. - * - * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will - * refer to the same value. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn('ls'); - * - * subprocess.stdout.on('data', (data) => { - * console.log(`Received chunk ${data}`); - * }); - * ``` - * - * The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdout: Readable | null; - /** - * A `Readable Stream` that represents the child process's `stderr`. - * - * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will - * refer to the same value. - * - * The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stderr: Readable | null; - /** - * The `subprocess.channel` property is a reference to the child's IPC channel. If - * no IPC channel exists, this property is `undefined`. - * @since v7.1.0 - */ - readonly channel?: Pipe | null | undefined; - /** - * A sparse array of pipes to the child process, corresponding with positions in - * the `stdio` option passed to {@link spawn} that have been set - * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`, - * respectively. - * - * In the following example, only the child's fd `1` (stdout) is configured as a - * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values - * in the array are `null`. - * - * ```js - * const assert = require('node:assert'); - * const fs = require('node:fs'); - * const child_process = require('node:child_process'); - * - * const subprocess = child_process.spawn('ls', { - * stdio: [ - * 0, // Use parent's stdin for child. - * 'pipe', // Pipe child's stdout to parent. - * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. - * ], - * }); - * - * assert.strictEqual(subprocess.stdio[0], null); - * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); - * - * assert(subprocess.stdout); - * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); - * - * assert.strictEqual(subprocess.stdio[2], null); - * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); - * ``` - * - * The `subprocess.stdio` property can be `undefined` if the child process could - * not be successfully spawned. - * @since v0.7.10 - */ - readonly stdio: [ - Writable | null, - // stdin - Readable | null, - // stdout - Readable | null, - // stderr - Readable | Writable | null | undefined, - // extra - Readable | Writable | null | undefined, // extra - ]; - /** - * The `subprocess.killed` property indicates whether the child process - * successfully received a signal from `subprocess.kill()`. The `killed` property - * does not indicate that the child process has been terminated. - * @since v0.5.10 - */ - readonly killed: boolean; - /** - * Returns the process identifier (PID) of the child process. If the child process - * fails to spawn due to errors, then the value is `undefined` and `error` is - * emitted. - * - * ```js - * const { spawn } = require('node:child_process'); - * const grep = spawn('grep', ['ssh']); - * - * console.log(`Spawned child pid: ${grep.pid}`); - * grep.stdin.end(); - * ``` - * @since v0.1.90 - */ - readonly pid?: number | undefined; - /** - * The `subprocess.connected` property indicates whether it is still possible to - * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages. - * @since v0.7.2 - */ - readonly connected: boolean; - /** - * The `subprocess.exitCode` property indicates the exit code of the child process. - * If the child process is still running, the field will be `null`. - */ - readonly exitCode: number | null; - /** - * The `subprocess.signalCode` property indicates the signal received by - * the child process if any, else `null`. - */ - readonly signalCode: NodeJS.Signals | null; - /** - * The `subprocess.spawnargs` property represents the full list of command-line - * arguments the child process was launched with. - */ - readonly spawnargs: string[]; - /** - * The `subprocess.spawnfile` property indicates the executable file name of - * the child process that is launched. - * - * For {@link fork}, its value will be equal to `process.execPath`. - * For {@link spawn}, its value will be the name of - * the executable file. - * For {@link exec}, its value will be the name of the shell - * in which the child process is launched. - */ - readonly spawnfile: string; - /** - * The `subprocess.kill()` method sends a signal to the child process. If no - * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function - * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. - * - * ```js - * const { spawn } = require('node:child_process'); - * const grep = spawn('grep', ['ssh']); - * - * grep.on('close', (code, signal) => { - * console.log( - * `child process terminated due to receipt of signal ${signal}`); - * }); - * - * // Send SIGHUP to process. - * grep.kill('SIGHUP'); - * ``` - * - * The `ChildProcess` object may emit an `'error'` event if the signal - * cannot be delivered. Sending a signal to a child process that has already exited - * is not an error but may have unforeseen consequences. Specifically, if the - * process identifier (PID) has been reassigned to another process, the signal will - * be delivered to that process instead which can have unexpected results. - * - * While the function is called `kill`, the signal delivered to the child process - * may not actually terminate the process. - * - * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. - * - * On Windows, where POSIX signals do not exist, the `signal` argument will be - * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`). - * See `Signal Events` for more details. - * - * On Linux, child processes of child processes will not be terminated - * when attempting to kill their parent. This is likely to happen when running a - * new process in a shell or with the use of the `shell` option of `ChildProcess`: - * - * ```js - * 'use strict'; - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn( - * 'sh', - * [ - * '-c', - * `node -e "setInterval(() => { - * console.log(process.pid, 'is alive') - * }, 500);"`, - * ], { - * stdio: ['inherit', 'inherit', 'inherit'], - * }, - * ); - * - * setTimeout(() => { - * subprocess.kill(); // Does not terminate the Node.js process in the shell. - * }, 2000); - * ``` - * @since v0.1.90 - */ - kill(signal?: NodeJS.Signals | number): boolean; - /** - * Calls {@link ChildProcess.kill} with `'SIGTERM'`. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - /** - * When an IPC channel has been established between the parent and child ( - * i.e. when using {@link fork}), the `subprocess.send()` method can - * be used to send messages to the child process. When the child process is a - * Node.js instance, these messages can be received via the `'message'` event. - * - * The message goes through serialization and parsing. The resulting - * message might not be the same as what is originally sent. - * - * For example, in the parent script: - * - * ```js - * const cp = require('node:child_process'); - * const n = cp.fork(`${__dirname}/sub.js`); - * - * n.on('message', (m) => { - * console.log('PARENT got message:', m); - * }); - * - * // Causes the child to print: CHILD got message: { hello: 'world' } - * n.send({ hello: 'world' }); - * ``` - * - * And then the child script, `'sub.js'` might look like this: - * - * ```js - * process.on('message', (m) => { - * console.log('CHILD got message:', m); - * }); - * - * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } - * process.send({ foo: 'bar', baz: NaN }); - * ``` - * - * Child Node.js processes will have a `process.send()` method of their own - * that allows the child to send messages back to the parent. - * - * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages - * containing a `NODE_` prefix in the `cmd` property are reserved for use within - * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js. - * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice. - * - * The optional `sendHandle` argument that may be passed to `subprocess.send()` is - * for passing a TCP server or socket object to the child process. The child will - * receive the object as the second argument passed to the callback function - * registered on the `'message'` event. Any data that is received - * and buffered in the socket will not be sent to the child. - * - * The optional `callback` is a function that is invoked after the message is - * sent but before the child may have received it. The function is called with a - * single argument: `null` on success, or an `Error` object on failure. - * - * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can - * happen, for instance, when the child process has already exited. - * - * `subprocess.send()` will return `false` if the channel has closed or when the - * backlog of unsent messages exceeds a threshold that makes it unwise to send - * more. Otherwise, the method returns `true`. The `callback` function can be - * used to implement flow control. - * - * #### Example: sending a server object - * - * The `sendHandle` argument can be used, for instance, to pass the handle of - * a TCP server object to the child process as illustrated in the example below: - * - * ```js - * const subprocess = require('node:child_process').fork('subprocess.js'); - * - * // Open up the server object and send the handle. - * const server = require('node:net').createServer(); - * server.on('connection', (socket) => { - * socket.end('handled by parent'); - * }); - * server.listen(1337, () => { - * subprocess.send('server', server); - * }); - * ``` - * - * The child would then receive the server object as: - * - * ```js - * process.on('message', (m, server) => { - * if (m === 'server') { - * server.on('connection', (socket) => { - * socket.end('handled by child'); - * }); - * } - * }); - * ``` - * - * Once the server is now shared between the parent and child, some connections - * can be handled by the parent and some by the child. - * - * While the example above uses a server created using the `node:net` module,`node:dgram` module servers use exactly the same workflow with the exceptions of - * listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only - * supported on Unix platforms. - * - * #### Example: sending a socket object - * - * Similarly, the `sendHandler` argument can be used to pass the handle of a - * socket to the child process. The example below spawns two children that each - * handle connections with "normal" or "special" priority: - * - * ```js - * const { fork } = require('node:child_process'); - * const normal = fork('subprocess.js', ['normal']); - * const special = fork('subprocess.js', ['special']); - * - * // Open up the server and send sockets to child. Use pauseOnConnect to prevent - * // the sockets from being read before they are sent to the child process. - * const server = require('node:net').createServer({ pauseOnConnect: true }); - * server.on('connection', (socket) => { - * - * // If this is special priority... - * if (socket.remoteAddress === '74.125.127.100') { - * special.send('socket', socket); - * return; - * } - * // This is normal priority. - * normal.send('socket', socket); - * }); - * server.listen(1337); - * ``` - * - * The `subprocess.js` would receive the socket handle as the second argument - * passed to the event callback function: - * - * ```js - * process.on('message', (m, socket) => { - * if (m === 'socket') { - * if (socket) { - * // Check that the client socket exists. - * // It is possible for the socket to be closed between the time it is - * // sent and the time it is received in the child process. - * socket.end(`Request handled with ${process.argv[2]} priority`); - * } - * } - * }); - * ``` - * - * Do not use `.maxConnections` on a socket that has been passed to a subprocess. - * The parent cannot track when the socket is destroyed. - * - * Any `'message'` handlers in the subprocess should verify that `socket` exists, - * as the connection may have been closed during the time it takes to send the - * connection to the child. - * @since v0.5.9 - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send(message: Serializable, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; - send( - message: Serializable, - sendHandle?: SendHandle, - options?: MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * Closes the IPC channel between parent and child, allowing the child to exit - * gracefully once there are no other connections keeping it alive. After calling - * this method the `subprocess.connected` and `process.connected` properties in - * both the parent and child (respectively) will be set to `false`, and it will be - * no longer possible to pass messages between the processes. - * - * The `'disconnect'` event will be emitted when there are no messages in the - * process of being received. This will most often be triggered immediately after - * calling `subprocess.disconnect()`. - * - * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked - * within the child process to close the IPC channel as well. - * @since v0.7.2 - */ - disconnect(): void; - /** - * By default, the parent will wait for the detached child to exit. To prevent the - * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not - * include the child in its reference count, allowing the parent to exit - * independently of the child, unless there is an established IPC channel between - * the child and the parent. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * ``` - * @since v0.7.10 - */ - unref(): void; - /** - * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will - * restore the removed reference count for the child process, forcing the parent - * to wait for the child to exit before exiting itself. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * subprocess.ref(); - * ``` - * @since v0.7.10 - */ - ref(): void; - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - * 6. spawn - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - addListener(event: "spawn", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; - emit(event: "spawn", listener: () => void): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - on(event: "spawn", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - once(event: "spawn", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependListener(event: "spawn", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "close", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "exit", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependOnceListener(event: "spawn", listener: () => void): this; - } - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, - Readable, - Readable, - // stderr - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio - extends ChildProcess - { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - interface MessageOptions { - keepOpen?: boolean | undefined; - } - type IOType = "overlapped" | "pipe" | "ignore" | "inherit"; - type StdioOptions = IOType | Array; - type SerializationType = "json" | "advanced"; - interface MessagingOptions extends Abortable { - /** - * Specify the kind of serialization used for sending messages between processes. - * @default 'json' - */ - serialization?: SerializationType | undefined; - /** - * The signal value to be used when the spawned process will be killed by the abort signal. - * @default 'SIGTERM' - */ - killSignal?: NodeJS.Signals | number | undefined; - /** - * In milliseconds the maximum amount of time the process is allowed to run. - */ - timeout?: number | undefined; - } - interface ProcessEnvOptions { - uid?: number | undefined; - gid?: number | undefined; - cwd?: string | URL | undefined; - env?: NodeJS.ProcessEnv | undefined; - } - interface CommonOptions extends ProcessEnvOptions { - /** - * @default false - */ - windowsHide?: boolean | undefined; - /** - * @default 0 - */ - timeout?: number | undefined; - } - interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { - argv0?: string | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - shell?: boolean | string | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - interface SpawnOptions extends CommonSpawnOptions { - detached?: boolean | undefined; - } - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: StdioPipeNamed | StdioPipe[] | undefined; - } - type StdioNull = "inherit" | "ignore" | Stream; - type StdioPipeNamed = "pipe" | "overlapped"; - type StdioPipe = undefined | null | StdioPipeNamed; - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - /** - * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults - * to an empty array. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * A third argument may be used to specify additional options, with these defaults: - * - * ```js - * const defaults = { - * cwd: undefined, - * env: process.env, - * }; - * ``` - * - * Use `cwd` to specify the working directory from which the process is spawned. - * If not given, the default is to inherit the current working directory. If given, - * but the path does not exist, the child process emits an `ENOENT` error - * and exits immediately. `ENOENT` is also emitted when the command - * does not exist. - * - * Use `env` to specify environment variables that will be visible to the new - * process, the default is `process.env`. - * - * `undefined` values in `env` will be ignored. - * - * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the - * exit code: - * - * ```js - * const { spawn } = require('node:child_process'); - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * Example: A very elaborate way to run `ps ax | grep ssh` - * - * ```js - * const { spawn } = require('node:child_process'); - * const ps = spawn('ps', ['ax']); - * const grep = spawn('grep', ['ssh']); - * - * ps.stdout.on('data', (data) => { - * grep.stdin.write(data); - * }); - * - * ps.stderr.on('data', (data) => { - * console.error(`ps stderr: ${data}`); - * }); - * - * ps.on('close', (code) => { - * if (code !== 0) { - * console.log(`ps process exited with code ${code}`); - * } - * grep.stdin.end(); - * }); - * - * grep.stdout.on('data', (data) => { - * console.log(data.toString()); - * }); - * - * grep.stderr.on('data', (data) => { - * console.error(`grep stderr: ${data}`); - * }); - * - * grep.on('close', (code) => { - * if (code !== 0) { - * console.log(`grep process exited with code ${code}`); - * } - * }); - * ``` - * - * Example of checking for failed `spawn`: - * - * ```js - * const { spawn } = require('node:child_process'); - * const subprocess = spawn('bad_command'); - * - * subprocess.on('error', (err) => { - * console.error('Failed to start subprocess.'); - * }); - * ``` - * - * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process - * title while others (Windows, SunOS) will use `command`. - * - * Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve - * it with the`process.argv0` property instead. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { spawn } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const grep = spawn('grep', ['ssh'], { signal }); - * grep.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * ``` - * @since v0.1.90 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, options: SpawnOptions): ChildProcess; - // overloads of spawn with 'args' - function spawn( - command: string, - args?: readonly string[], - options?: SpawnOptionsWithoutStdio, - ): ChildProcessWithoutNullStreams; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess; - interface ExecOptions extends CommonOptions { - shell?: string | undefined; - signal?: AbortSignal | undefined; - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - } - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding: BufferEncoding; - } - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: BufferEncoding | null; // specify `null`. - } - interface ExecException extends Error { - cmd?: string | undefined; - killed?: boolean | undefined; - code?: number | undefined; - signal?: NodeJS.Signals | undefined; - } - /** - * Spawns a shell then executes the `command` within that shell, buffering any - * generated output. The `command` string passed to the exec function is processed - * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) - * need to be dealt with accordingly: - * - * ```js - * const { exec } = require('node:child_process'); - * - * exec('"/path/to/test file/test.sh" arg1 arg2'); - * // Double quotes are used so that the space in the path is not interpreted as - * // a delimiter of multiple arguments. - * - * exec('echo "The \\$HOME variable is $HOME"'); - * // The $HOME variable is escaped in the first instance, but not in the second. - * ``` - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * - * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The - * `error.code` property will be - * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the - * process. - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * ```js - * const { exec } = require('node:child_process'); - * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { - * if (error) { - * console.error(`exec error: ${error}`); - * return; - * } - * console.log(`stdout: ${stdout}`); - * console.error(`stderr: ${stderr}`); - * }); - * ``` - * - * If `timeout` is greater than `0`, the parent will send the signal - * identified by the `killSignal` property (the default is `'SIGTERM'`) if the - * child runs longer than `timeout` milliseconds. - * - * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace - * the existing process and uses a shell to execute the command. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * const util = require('node:util'); - * const exec = util.promisify(require('node:child_process').exec); - * - * async function lsExample() { - * const { stdout, stderr } = await exec('ls'); - * console.log('stdout:', stdout); - * console.error('stderr:', stderr); - * } - * lsExample(); - * ``` - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { exec } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = exec('grep ssh', { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.90 - * @param command The command to run, with space-separated arguments. - * @param callback called with the output when process terminates. - */ - function exec( - command: string, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec( - command: string, - options: { - encoding: "buffer" | null; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function exec( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function exec( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function exec( - command: string, - options: ExecOptions, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: (ObjectEncodingOptions & ExecOptions) | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: { - encoding: "buffer" | null; - } & ExecOptions, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: ExecOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options?: (ObjectEncodingOptions & ExecOptions) | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - } - interface ExecFileOptions extends CommonOptions, Abortable { - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - windowsVerbatimArguments?: boolean | undefined; - shell?: boolean | string | undefined; - signal?: AbortSignal | undefined; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: "buffer" | null; - } - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - type ExecFileException = - & Omit - & Omit - & { code?: string | number | undefined | null }; - /** - * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified - * executable `file` is spawned directly as a new process making it slightly more - * efficient than {@link exec}. - * - * The same options as {@link exec} are supported. Since a shell is - * not spawned, behaviors such as I/O redirection and file globbing are not - * supported. - * - * ```js - * const { execFile } = require('node:child_process'); - * const child = execFile('node', ['--version'], (error, stdout, stderr) => { - * if (error) { - * throw error; - * } - * console.log(stdout); - * }); - * ``` - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * const util = require('node:util'); - * const execFile = util.promisify(require('node:child_process').execFile); - * async function getVersion() { - * const { stdout } = await execFile('node', ['--version']); - * console.log(stdout); - * } - * getVersion(); - * ``` - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { execFile } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = execFile('node', ['--version'], { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.91 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @param callback Called with the output when process terminates. - */ - function execFile(file: string): ChildProcess; - function execFile( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): ChildProcess; - function execFile(file: string, args?: readonly string[] | null): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): ChildProcess; - // no `options` definitely means stdout/stderr are `string`. - function execFile( - file: string, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile( - file: string, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function execFile( - file: string, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function execFile( - file: string, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function execFile( - file: string, - options: ExecFileOptions, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) - | undefined - | null, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) - | undefined - | null, - ): ChildProcess; - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - options: ExecFileOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - } - interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { - execPath?: string | undefined; - execArgv?: string[] | undefined; - silent?: boolean | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - detached?: boolean | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - /** - * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. - * Like {@link spawn}, a `ChildProcess` object is returned. The - * returned `ChildProcess` will have an additional communication channel - * built-in that allows messages to be passed back and forth between the parent and - * child. See `subprocess.send()` for details. - * - * Keep in mind that spawned Node.js child processes are - * independent of the parent with exception of the IPC communication channel - * that is established between the two. Each process has its own memory, with - * their own V8 instances. Because of the additional resource allocations - * required, spawning a large number of child Node.js processes is not - * recommended. - * - * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative - * execution path to be used. - * - * Node.js processes launched with a custom `execPath` will communicate with the - * parent process using the file descriptor (fd) identified using the - * environment variable `NODE_CHANNEL_FD` on the child process. - * - * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the - * current process. - * - * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * if (process.argv[2] === 'child') { - * setTimeout(() => { - * console.log(`Hello from ${process.argv[2]}!`); - * }, 1_000); - * } else { - * const { fork } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = fork(__filename, ['child'], { signal }); - * child.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * } - * ``` - * @since v0.5.0 - * @param modulePath The module to run in the child. - * @param args List of string arguments. - */ - function fork(modulePath: string, options?: ForkOptions): ChildProcess; - function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess; - interface SpawnSyncOptions extends CommonSpawnOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding?: "buffer" | null | undefined; - } - interface SpawnSyncReturns { - pid: number; - output: Array; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error | undefined; - } - /** - * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the process intercepts and handles the `SIGTERM` signal - * and doesn't exit, the parent process will wait until the child process has - * exited. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithStringEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithBufferEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args?: readonly string[], - options?: SpawnSyncOptions, - ): SpawnSyncReturns; - interface CommonExecOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - /** - * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - killSignal?: NodeJS.Signals | number | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface ExecSyncOptions extends CommonExecOptions { - shell?: string | undefined; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding?: "buffer" | null | undefined; - } - /** - * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process - * has exited. - * - * If the process times out or has a non-zero exit code, this method will throw. - * The `Error` object will contain the entire result from {@link spawnSync}. - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @return The stdout from the command. - */ - function execSync(command: string): Buffer; - function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): string | Buffer; - interface ExecFileSyncOptions extends CommonExecOptions { - shell?: boolean | string | undefined; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding?: "buffer" | null; // specify `null`. - } - /** - * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not - * return until the child process has fully closed. When a timeout has been - * encountered and `killSignal` is sent, the method won't return until the process - * has completely exited. - * - * If the child process intercepts and handles the `SIGTERM` signal and - * does not exit, the parent process will still wait until the child process has - * exited. - * - * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @return The stdout from the command. - */ - function execFileSync(file: string): Buffer; - function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; - function execFileSync(file: string, args: readonly string[]): Buffer; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithStringEncoding, - ): string; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithBufferEncoding, - ): Buffer; - function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer; -} -declare module "node:child_process" { - export * from "child_process"; -} diff --git a/reverse_engineering/node_modules/@types/node/cluster.d.ts b/reverse_engineering/node_modules/@types/node/cluster.d.ts deleted file mode 100644 index 39cd56ad..00000000 --- a/reverse_engineering/node_modules/@types/node/cluster.d.ts +++ /dev/null @@ -1,432 +0,0 @@ -/** - * Clusters of Node.js processes can be used to run multiple instances of Node.js - * that can distribute workloads among their application threads. When process - * isolation is not needed, use the `worker_threads` module instead, which - * allows running multiple application threads within a single Node.js instance. - * - * The cluster module allows easy creation of child processes that all share - * server ports. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('exit', (worker, code, signal) => { - * console.log(`worker ${worker.process.pid} died`); - * }); - * } else { - * // Workers can share any TCP connection - * // In this case it is an HTTP server - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * - * console.log(`Worker ${process.pid} started`); - * } - * ``` - * - * Running Node.js will now share port 8000 between the workers: - * - * ```console - * $ node server.js - * Primary 3596 is running - * Worker 4324 started - * Worker 4520 started - * Worker 6056 started - * Worker 5644 started - * ``` - * - * On Windows, it is not yet possible to set up a named pipe server in a worker. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js) - */ -declare module "cluster" { - import * as child from "node:child_process"; - import EventEmitter = require("node:events"); - import * as net from "node:net"; - type SerializationType = "json" | "advanced"; - export interface ClusterSettings { - execArgv?: string[] | undefined; // default: process.execArgv - exec?: string | undefined; - args?: string[] | undefined; - silent?: boolean | undefined; - stdio?: any[] | undefined; - uid?: number | undefined; - gid?: number | undefined; - inspectPort?: number | (() => number) | undefined; - serialization?: SerializationType | undefined; - cwd?: string | undefined; - windowsHide?: boolean | undefined; - } - export interface Address { - address: string; - port: number; - addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" - } - /** - * A `Worker` object contains all public information and method about a worker. - * In the primary it can be obtained using `cluster.workers`. In a worker - * it can be obtained using `cluster.worker`. - * @since v0.7.0 - */ - export class Worker extends EventEmitter { - /** - * Each new worker is given its own unique id, this id is stored in the`id`. - * - * While a worker is alive, this is the key that indexes it in`cluster.workers`. - * @since v0.8.0 - */ - id: number; - /** - * All workers are created using `child_process.fork()`, the returned object - * from this function is stored as `.process`. In a worker, the global `process`is stored. - * - * See: `Child Process module`. - * - * Workers will call `process.exit(0)` if the `'disconnect'` event occurs - * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against - * accidental disconnection. - * @since v0.7.0 - */ - process: child.ChildProcess; - /** - * Send a message to a worker or primary, optionally with a handle. - * - * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`. - * - * In a worker, this sends a message to the primary. It is identical to`process.send()`. - * - * This example will echo back all messages from the primary: - * - * ```js - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * worker.send('hi there'); - * - * } else if (cluster.isWorker) { - * process.on('message', (msg) => { - * process.send(msg); - * }); - * } - * ``` - * @since v0.7.0 - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - callback?: (error: Error | null) => void, - ): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - options?: child.MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * This function will kill the worker. In the primary worker, it does this by - * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`. - * - * The `kill()` function kills the worker process without waiting for a graceful - * disconnect, it has the same behavior as `worker.process.kill()`. - * - * This method is aliased as `worker.destroy()` for backwards compatibility. - * - * In a worker, `process.kill()` exists, but it is not this function; - * it is `kill()`. - * @since v0.9.12 - * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. - */ - kill(signal?: string): void; - destroy(signal?: string): void; - /** - * In a worker, this function will close all servers, wait for the `'close'` event - * on those servers, and then disconnect the IPC channel. - * - * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself. - * - * Causes `.exitedAfterDisconnect` to be set. - * - * After a server is closed, it will no longer accept new connections, - * but connections may be accepted by any other listening worker. Existing - * connections will be allowed to close as usual. When no more connections exist, - * see `server.close()`, the IPC channel to the worker will close allowing it - * to die gracefully. - * - * The above applies _only_ to server connections, client connections are not - * automatically closed by workers, and disconnect does not wait for them to close - * before exiting. - * - * In a worker, `process.disconnect` exists, but it is not this function; - * it is `disconnect()`. - * - * Because long living server connections may block workers from disconnecting, it - * may be useful to send a message, so application specific actions may be taken to - * close them. It also may be useful to implement a timeout, killing a worker if - * the `'disconnect'` event has not been emitted after some time. - * - * ```js - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * let timeout; - * - * worker.on('listening', (address) => { - * worker.send('shutdown'); - * worker.disconnect(); - * timeout = setTimeout(() => { - * worker.kill(); - * }, 2000); - * }); - * - * worker.on('disconnect', () => { - * clearTimeout(timeout); - * }); - * - * } else if (cluster.isWorker) { - * const net = require('node:net'); - * const server = net.createServer((socket) => { - * // Connections never end - * }); - * - * server.listen(8000); - * - * process.on('message', (msg) => { - * if (msg === 'shutdown') { - * // Initiate graceful close of any connections to server - * } - * }); - * } - * ``` - * @since v0.7.7 - * @return A reference to `worker`. - */ - disconnect(): void; - /** - * This function returns `true` if the worker is connected to its primary via its - * IPC channel, `false` otherwise. A worker is connected to its primary after it - * has been created. It is disconnected after the `'disconnect'` event is emitted. - * @since v0.11.14 - */ - isConnected(): boolean; - /** - * This function returns `true` if the worker's process has terminated (either - * because of exiting or being signaled). Otherwise, it returns `false`. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('fork', (worker) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * - * cluster.on('exit', (worker, code, signal) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * } else { - * // Workers can share any TCP connection. In this case, it is an HTTP server. - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end(`Current process\n ${process.pid}`); - * process.kill(process.pid); - * }).listen(8000); - * } - * ``` - * @since v0.11.14 - */ - isDead(): boolean; - /** - * This property is `true` if the worker exited due to `.disconnect()`. - * If the worker exited any other way, it is `false`. If the - * worker has not exited, it is `undefined`. - * - * The boolean `worker.exitedAfterDisconnect` allows distinguishing between - * voluntary and accidental exit, the primary may choose not to respawn a worker - * based on this value. - * - * ```js - * cluster.on('exit', (worker, code, signal) => { - * if (worker.exitedAfterDisconnect === true) { - * console.log('Oh, it was just voluntary – no need to worry'); - * } - * }); - * - * // kill worker - * worker.kill(); - * ``` - * @since v6.0.0 - */ - exitedAfterDisconnect: boolean; - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - export interface Cluster extends EventEmitter { - disconnect(callback?: () => void): void; - fork(env?: any): Worker; - /** @deprecated since v16.0.0 - use isPrimary. */ - readonly isMaster: boolean; - readonly isPrimary: boolean; - readonly isWorker: boolean; - schedulingPolicy: number; - readonly settings: ClusterSettings; - /** @deprecated since v16.0.0 - use setupPrimary. */ - setupMaster(settings?: ClusterSettings): void; - /** - * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings. - */ - setupPrimary(settings?: ClusterSettings): void; - readonly worker?: Worker | undefined; - readonly workers?: NodeJS.Dict | undefined; - readonly SCHED_NONE: number; - readonly SCHED_RR: number; - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependListener( - event: "message", - listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void, - ): this; - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - const cluster: Cluster; - export default cluster; -} -declare module "node:cluster" { - export * from "cluster"; - export { default as default } from "cluster"; -} diff --git a/reverse_engineering/node_modules/@types/node/console.d.ts b/reverse_engineering/node_modules/@types/node/console.d.ts deleted file mode 100644 index bcc34504..00000000 --- a/reverse_engineering/node_modules/@types/node/console.d.ts +++ /dev/null @@ -1,415 +0,0 @@ -/** - * The `node:console` module provides a simple debugging console that is similar to - * the JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node:console')`. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the `note on process I/O` for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js) - */ -declare module "console" { - import console = require("node:console"); - export = console; -} -declare module "node:console" { - import { InspectOptions } from "node:util"; - global { - // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build - interface Console { - Console: console.ConsoleConstructor; - /** - * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only - * writes a message and does not otherwise affect execution. The output always - * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`. - * - * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. - * - * ```js - * console.assert(true, 'does nothing'); - * - * console.assert(false, 'Whoops %s work', 'didn\'t'); - * // Assertion failed: Whoops didn't work - * - * console.assert(); - * // Assertion failed - * ``` - * @since v0.1.101 - * @param value The value tested for being truthy. - * @param message All arguments besides `value` are used as error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the - * TTY. When `stdout` is not a TTY, this method does nothing. - * - * The specific operation of `console.clear()` can vary across operating systems - * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the - * current terminal viewport for the Node.js - * binary. - * @since v8.3.0 - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the - * number of times `console.count()` has been called with the given `label`. - * - * ```js - * > console.count() - * default: 1 - * undefined - * > console.count('default') - * default: 2 - * undefined - * > console.count('abc') - * abc: 1 - * undefined - * > console.count('xyz') - * xyz: 1 - * undefined - * > console.count('abc') - * abc: 2 - * undefined - * > console.count() - * default: 3 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - * - * ```js - * > console.count('abc'); - * abc: 1 - * undefined - * > console.countReset('abc'); - * undefined - * > console.count('abc'); - * abc: 1 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link log}. - * @since v8.0.0 - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - * @since v0.1.101 - */ - dir(obj: any, options?: InspectOptions): void; - /** - * This method calls `console.log()` passing it the arguments received. - * This method does not produce any XML formatting. - * @since v8.0.0 - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). - * - * ```js - * const code = 5; - * console.error('error #%d', code); - * // Prints: error #5, to stderr - * console.error('error', code); - * // Prints: error 5, to stderr - * ``` - * - * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string - * values are concatenated. See `util.format()` for more information. - * @since v0.1.100 - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by spaces for `groupIndentation`length. - * - * If one or more `label`s are provided, those are printed first without the - * additional indentation. - * @since v8.5.0 - */ - group(...label: any[]): void; - /** - * An alias for {@link group}. - * @since v8.5.0 - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by spaces for `groupIndentation`length. - * @since v8.5.0 - */ - groupEnd(): void; - /** - * The `console.info()` function is an alias for {@link log}. - * @since v0.1.100 - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). - * - * ```js - * const count = 5; - * console.log('count: %d', count); - * // Prints: count: 5, to stdout - * console.log('count:', count); - * // Prints: count: 5, to stdout - * ``` - * - * See `util.format()` for more information. - * @since v0.1.100 - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just - * logging the argument if it can't be parsed as tabular. - * - * ```js - * // These can't be parsed as tabular data - * console.table(Symbol()); - * // Symbol() - * - * console.table(undefined); - * // undefined - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); - * // ┌─────────┬─────┬─────┐ - * // │ (index) │ a │ b │ - * // ├─────────┼─────┼─────┤ - * // │ 0 │ 1 │ 'Y' │ - * // │ 1 │ 'Z' │ 2 │ - * // └─────────┴─────┴─────┘ - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); - * // ┌─────────┬─────┐ - * // │ (index) │ a │ - * // ├─────────┼─────┤ - * // │ 0 │ 1 │ - * // │ 1 │ 'Z' │ - * // └─────────┴─────┘ - * ``` - * @since v10.0.0 - * @param properties Alternate properties for constructing the table. - */ - table(tabularData: any, properties?: readonly string[]): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers - * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in - * suitable time units to `stdout`. For example, if the elapsed - * time is 3869ms, `console.timeEnd()` displays "3.869s". - * @since v0.1.104 - * @param [label='default'] - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link time} and - * prints the result to `stdout`: - * - * ```js - * console.time('bunch-of-stuff'); - * // Do a bunch of stuff. - * console.timeEnd('bunch-of-stuff'); - * // Prints: bunch-of-stuff: 225.438ms - * ``` - * @since v0.1.104 - * @param [label='default'] - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link time}, prints - * the elapsed time and other `data` arguments to `stdout`: - * - * ```js - * console.time('process'); - * const value = expensiveProcess1(); // Returns 42 - * console.timeLog('process', value); - * // Prints "process: 365.227ms 42". - * doExpensiveProcess2(value); - * console.timeEnd('process'); - * ``` - * @since v10.7.0 - * @param [label='default'] - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code. - * - * ```js - * console.trace('Show me'); - * // Prints: (stack trace will vary based on where trace is called) - * // Trace: Show me - * // at repl:2:9 - * // at REPLServer.defaultEval (repl.js:248:27) - * // at bound (domain.js:287:14) - * // at REPLServer.runBound [as eval] (domain.js:300:12) - * // at REPLServer. (repl.js:412:12) - * // at emitOne (events.js:82:20) - * // at REPLServer.emit (events.js:169:7) - * // at REPLServer.Interface._onLine (readline.js:210:10) - * // at REPLServer.Interface._line (readline.js:549:8) - * // at REPLServer.Interface._ttyWrite (readline.js:826:14) - * ``` - * @since v0.1.104 - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The `console.warn()` function is an alias for {@link error}. - * @since v0.1.100 - */ - warn(message?: any, ...optionalParams: any[]): void; - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. - * Starts a JavaScript CPU profile with an optional label. - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Adds an event with the label `label` to the Timeline panel of the inspector. - */ - timeStamp(label?: string): void; - } - /** - * The `console` module provides a simple debugging console that is similar to the - * JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the `note on process I/O` for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js) - */ - namespace console { - interface ConsoleConstructorOptions { - stdout: NodeJS.WritableStream; - stderr?: NodeJS.WritableStream | undefined; - ignoreErrors?: boolean | undefined; - colorMode?: boolean | "auto" | undefined; - inspectOptions?: InspectOptions | undefined; - /** - * Set group indentation - * @default 2 - */ - groupIndentation?: number | undefined; - } - interface ConsoleConstructor { - prototype: Console; - new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - } - var console: Console; - } - export = globalThis.console; -} diff --git a/reverse_engineering/node_modules/@types/node/constants.d.ts b/reverse_engineering/node_modules/@types/node/constants.d.ts deleted file mode 100644 index c3ac2b82..00000000 --- a/reverse_engineering/node_modules/@types/node/constants.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ -declare module "constants" { - import { constants as osConstants, SignalConstants } from "node:os"; - import { constants as cryptoConstants } from "node:crypto"; - import { constants as fsConstants } from "node:fs"; - - const exp: - & typeof osConstants.errno - & typeof osConstants.priority - & SignalConstants - & typeof cryptoConstants - & typeof fsConstants; - export = exp; -} - -declare module "node:constants" { - import constants = require("constants"); - export = constants; -} diff --git a/reverse_engineering/node_modules/@types/node/crypto.d.ts b/reverse_engineering/node_modules/@types/node/crypto.d.ts deleted file mode 100644 index 2f2038e0..00000000 --- a/reverse_engineering/node_modules/@types/node/crypto.d.ts +++ /dev/null @@ -1,4456 +0,0 @@ -/** - * The `node:crypto` module provides cryptographic functionality that includes a - * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify - * functions. - * - * ```js - * const { createHmac } = await import('node:crypto'); - * - * const secret = 'abcdefg'; - * const hash = createHmac('sha256', secret) - * .update('I love cupcakes') - * .digest('hex'); - * console.log(hash); - * // Prints: - * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js) - */ -declare module "crypto" { - import * as stream from "node:stream"; - import { PeerCertificate } from "node:tls"; - /** - * SPKAC is a Certificate Signing Request mechanism originally implemented by - * Netscape and was specified formally as part of HTML5's `keygen` element. - * - * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects - * should not use this element anymore. - * - * The `node:crypto` module provides the `Certificate` class for working with SPKAC - * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC - * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. - * @since v0.11.8 - */ - class Certificate { - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const challenge = Certificate.exportChallenge(spkac); - * console.log(challenge.toString('utf8')); - * // Prints: the challenge as a UTF8 string - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportChallenge(spkac: BinaryLike): Buffer; - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const publicKey = Certificate.exportPublicKey(spkac); - * console.log(publicKey); - * // Prints: the public key as - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; - /** - * ```js - * import { Buffer } from 'node:buffer'; - * const { Certificate } = await import('node:crypto'); - * - * const spkac = getSpkacSomehow(); - * console.log(Certificate.verifySpkac(Buffer.from(spkac))); - * // Prints: true or false - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return `true` if the given `spkac` data structure is valid, `false` otherwise. - */ - static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - /** - * @deprecated - * @param spkac - * @returns The challenge component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportChallenge(spkac: BinaryLike): Buffer; - /** - * @deprecated - * @param spkac - * @param encoding The encoding of the spkac string. - * @returns The public key component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; - /** - * @deprecated - * @param spkac - * @returns `true` if the given `spkac` data structure is valid, - * `false` otherwise. - */ - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - namespace constants { - // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants - const OPENSSL_VERSION_NUMBER: number; - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number | undefined; - } - /** @deprecated since v10.0.0 */ - const fips: boolean; - /** - * Creates and returns a `Hash` object that can be used to generate hash digests - * using the given `algorithm`. Optional `options` argument controls stream - * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option - * can be used to specify the desired output length in bytes. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * Example: generating the sha256 sum of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHash, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hash = createHash('sha256'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hash.update(data); - * else { - * console.log(`${hash.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.92 - * @param options `stream.transform` options - */ - function createHash(algorithm: string, options?: HashOptions): Hash; - /** - * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. - * Optional `options` argument controls stream behavior. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is - * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was - * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not - * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). - * - * Example: generating the sha256 HMAC of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hmac.update(data); - * else { - * console.log(`${hmac.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; - // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings - type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary"; - type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1"; - type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; - type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - /** - * The `Hash` class is a utility for creating hash digests of data. It can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed hash digest on the readable side, or - * * Using the `hash.update()` and `hash.digest()` methods to produce the - * computed hash. - * - * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hash` objects as streams: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hash.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * } - * }); - * - * hash.write('some data to hash'); - * hash.end(); - * ``` - * - * Example: Using `Hash` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { createHash } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * const input = createReadStream('test.js'); - * input.pipe(hash).setEncoding('hex').pipe(stdout); - * ``` - * - * Example: Using the `hash.update()` and `hash.digest()` methods: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('some data to hash'); - * console.log(hash.digest('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * ``` - * @since v0.1.92 - */ - class Hash extends stream.Transform { - private constructor(); - /** - * Creates a new `Hash` object that contains a deep copy of the internal state - * of the current `Hash` object. - * - * The optional `options` argument controls stream behavior. For XOF hash - * functions such as `'shake256'`, the `outputLength` option can be used to - * specify the desired output length in bytes. - * - * An error is thrown when an attempt is made to copy the `Hash` object after - * its `hash.digest()` method has been called. - * - * ```js - * // Calculate a rolling hash. - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('one'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('two'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('three'); - * console.log(hash.copy().digest('hex')); - * - * // Etc. - * ``` - * @since v13.1.0 - * @param options `stream.transform` options - */ - copy(options?: stream.TransformOptions): Hash; - /** - * Updates the hash content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hash; - update(data: string, inputEncoding: Encoding): Hash; - /** - * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). - * If `encoding` is provided a string will be returned; otherwise - * a `Buffer` is returned. - * - * The `Hash` object can not be used again after `hash.digest()` method has been - * called. Multiple calls will cause an error to be thrown. - * @since v0.1.92 - * @param encoding The `encoding` of the return value. - */ - digest(): Buffer; - digest(encoding: BinaryToTextEncoding): string; - } - /** - * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can - * be used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed HMAC digest on the readable side, or - * * Using the `hmac.update()` and `hmac.digest()` methods to produce the - * computed HMAC digest. - * - * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hmac` objects as streams: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hmac.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * } - * }); - * - * hmac.write('some data to hash'); - * hmac.end(); - * ``` - * - * Example: Using `Hmac` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream('test.js'); - * input.pipe(hmac).pipe(stdout); - * ``` - * - * Example: Using the `hmac.update()` and `hmac.digest()` methods: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.update('some data to hash'); - * console.log(hmac.digest('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * ``` - * @since v0.1.94 - */ - class Hmac extends stream.Transform { - private constructor(); - /** - * Updates the `Hmac` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hmac; - update(data: string, inputEncoding: Encoding): Hmac; - /** - * Calculates the HMAC digest of all of the data passed using `hmac.update()`. - * If `encoding` is - * provided a string is returned; otherwise a `Buffer` is returned; - * - * The `Hmac` object can not be used again after `hmac.digest()` has been - * called. Multiple calls to `hmac.digest()` will result in an error being thrown. - * @since v0.1.94 - * @param encoding The `encoding` of the return value. - */ - digest(): Buffer; - digest(encoding: BinaryToTextEncoding): string; - } - type KeyObjectType = "secret" | "public" | "private"; - interface KeyExportOptions { - type: "pkcs1" | "spki" | "pkcs8" | "sec1"; - format: T; - cipher?: string | undefined; - passphrase?: string | Buffer | undefined; - } - interface JwkKeyExportOptions { - format: "jwk"; - } - interface JsonWebKey { - crv?: string | undefined; - d?: string | undefined; - dp?: string | undefined; - dq?: string | undefined; - e?: string | undefined; - k?: string | undefined; - kty?: string | undefined; - n?: string | undefined; - p?: string | undefined; - q?: string | undefined; - qi?: string | undefined; - x?: string | undefined; - y?: string | undefined; - [key: string]: unknown; - } - interface AsymmetricKeyDetails { - /** - * Key size in bits (RSA, DSA). - */ - modulusLength?: number | undefined; - /** - * Public exponent (RSA). - */ - publicExponent?: bigint | undefined; - /** - * Name of the message digest (RSA-PSS). - */ - hashAlgorithm?: string | undefined; - /** - * Name of the message digest used by MGF1 (RSA-PSS). - */ - mgf1HashAlgorithm?: string | undefined; - /** - * Minimal salt length in bytes (RSA-PSS). - */ - saltLength?: number | undefined; - /** - * Size of q in bits (DSA). - */ - divisorLength?: number | undefined; - /** - * Name of the curve (EC). - */ - namedCurve?: string | undefined; - } - /** - * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, - * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` - * objects are not to be created directly using the `new`keyword. - * - * Most applications should consider using the new `KeyObject` API instead of - * passing keys as strings or `Buffer`s due to improved security features. - * - * `KeyObject` instances can be passed to other threads via `postMessage()`. - * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to - * be listed in the `transferList` argument. - * @since v11.6.0 - */ - class KeyObject { - private constructor(); - /** - * Example: Converting a `CryptoKey` instance to a `KeyObject`: - * - * ```js - * const { KeyObject } = await import('node:crypto'); - * const { subtle } = globalThis.crypto; - * - * const key = await subtle.generateKey({ - * name: 'HMAC', - * hash: 'SHA-256', - * length: 256, - * }, true, ['sign', 'verify']); - * - * const keyObject = KeyObject.from(key); - * console.log(keyObject.symmetricKeySize); - * // Prints: 32 (symmetric key size in bytes) - * ``` - * @since v15.0.0 - */ - static from(key: webcrypto.CryptoKey): KeyObject; - /** - * For asymmetric keys, this property represents the type of the key. Supported key - * types are: - * - * * `'rsa'` (OID 1.2.840.113549.1.1.1) - * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) - * * `'dsa'` (OID 1.2.840.10040.4.1) - * * `'ec'` (OID 1.2.840.10045.2.1) - * * `'x25519'` (OID 1.3.101.110) - * * `'x448'` (OID 1.3.101.111) - * * `'ed25519'` (OID 1.3.101.112) - * * `'ed448'` (OID 1.3.101.113) - * * `'dh'` (OID 1.2.840.113549.1.3.1) - * - * This property is `undefined` for unrecognized `KeyObject` types and symmetric - * keys. - * @since v11.6.0 - */ - asymmetricKeyType?: KeyType | undefined; - /** - * For asymmetric keys, this property represents the size of the embedded key in - * bytes. This property is `undefined` for symmetric keys. - */ - asymmetricKeySize?: number | undefined; - /** - * This property exists only on asymmetric keys. Depending on the type of the key, - * this object contains information about the key. None of the information obtained - * through this property can be used to uniquely identify a key or to compromise - * the security of the key. - * - * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, - * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be - * set. - * - * Other key details might be exposed via this API using additional attributes. - * @since v15.7.0 - */ - asymmetricKeyDetails?: AsymmetricKeyDetails | undefined; - /** - * For symmetric keys, the following encoding options can be used: - * - * For public keys, the following encoding options can be used: - * - * For private keys, the following encoding options can be used: - * - * The result type depends on the selected encoding format, when PEM the - * result is a string, when DER it will be a buffer containing the data - * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. - * - * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are - * ignored. - * - * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of - * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be - * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for - * encrypted private keys. Since PKCS#8 defines its own - * encryption mechanism, PEM-level encryption is not supported when encrypting - * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for - * PKCS#1 and SEC1 encryption. - * @since v11.6.0 - */ - export(options: KeyExportOptions<"pem">): string | Buffer; - export(options?: KeyExportOptions<"der">): Buffer; - export(options?: JwkKeyExportOptions): JsonWebKey; - /** - * For secret keys, this property represents the size of the key in bytes. This - * property is `undefined` for asymmetric keys. - * @since v11.6.0 - */ - symmetricKeySize?: number | undefined; - /** - * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys - * or `'private'` for private (asymmetric) keys. - * @since v11.6.0 - */ - type: KeyObjectType; - } - type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305"; - type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm"; - type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb"; - type BinaryLike = string | NodeJS.ArrayBufferView; - type CipherKey = BinaryLike | KeyObject; - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number | undefined; - } - interface CipherOCBOptions extends stream.TransformOptions { - authTagLength: number; - } - /** - * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`. - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication - * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `password` is used to derive the cipher key and initialization vector (IV). - * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`. - * - * **This function is semantically insecure for all** - * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** - * **GCM, or CCM).** - * - * The implementation of `crypto.createCipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one - * iteration, and no salt. The lack of salt allows dictionary attacks as the same - * password always creates the same key. The low iteration count and - * non-cryptographically secure hash algorithm allow passwords to be tested very - * rapidly. - * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that - * developers derive a key and IV on - * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode - * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when - * they are used in order to avoid the risk of IV reuse that causes - * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. - * @since v0.1.94 - * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead. - * @param options `stream.transform` options - */ - function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; - /** - * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and - * initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication - * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a - * given IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): CipherCCM; - function createCipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): CipherOCB; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): CipherGCM; - function createCipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Cipher; - /** - * Instances of the `Cipher` class are used to encrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain unencrypted - * data is written to produce encrypted data on the readable side, or - * * Using the `cipher.update()` and `cipher.final()` methods to produce - * the encrypted data. - * - * The {@link createCipher} or {@link createCipheriv} methods are - * used to create `Cipher` instances. `Cipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Cipher` objects as streams: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * // Once we have the key and iv, we can create and use the cipher... - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = ''; - * cipher.setEncoding('hex'); - * - * cipher.on('data', (chunk) => encrypted += chunk); - * cipher.on('end', () => console.log(encrypted)); - * - * cipher.write('some clear text data'); - * cipher.end(); - * }); - * }); - * ``` - * - * Example: Using `Cipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * - * import { - * pipeline, - * } from 'node:stream'; - * - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.js'); - * const output = createWriteStream('test.enc'); - * - * pipeline(input, cipher, output, (err) => { - * if (err) throw err; - * }); - * }); - * }); - * ``` - * - * Example: Using the `cipher.update()` and `cipher.final()` methods: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); - * encrypted += cipher.final('hex'); - * console.log(encrypted); - * }); - * }); - * ``` - * @since v0.1.94 - */ - class Cipher extends stream.Transform { - private constructor(); - /** - * Updates the cipher with `data`. If the `inputEncoding` argument is given, - * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`, - * `TypedArray`, or `DataView`, then`inputEncoding` is ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. - * - * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being - * thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the data. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: BinaryLike): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `cipher.final()` method has been called, the `Cipher` object can no - * longer be used to encrypt data. Attempts to call `cipher.final()` more than - * once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): Buffer; - final(outputEncoding: BufferEncoding): string; - /** - * When using block encryption algorithms, the `Cipher` class will automatically - * add padding to the input data to the appropriate block size. To disable the - * default padding call `cipher.setAutoPadding(false)`. - * - * When `autoPadding` is `false`, the length of the entire input data must be a - * multiple of the cipher's block size or `cipher.final()` will throw an error. - * Disabling automatic padding is useful for non-standard padding, for instance - * using `0x0` instead of PKCS padding. - * - * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(autoPadding?: boolean): this; - } - interface CipherCCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - interface CipherGCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - interface CipherOCB extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - /** - * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * **This function is semantically insecure for all** - * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** - * **GCM, or CCM).** - * - * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one - * iteration, and no salt. The lack of salt allows dictionary attacks as the same - * password always creates the same key. The low iteration count and - * non-cryptographically secure hash algorithm allow passwords to be tested very - * rapidly. - * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that - * developers derive a key and IV on - * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. - * @since v0.1.94 - * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead. - * @param options `stream.transform` options - */ - function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; - /** - * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags - * to those with the specified length. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a given - * IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createDecipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): DecipherOCB; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Decipher; - /** - * Instances of the `Decipher` class are used to decrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain encrypted - * data is written to produce unencrypted data on the readable side, or - * * Using the `decipher.update()` and `decipher.final()` methods to - * produce the unencrypted data. - * - * The {@link createDecipher} or {@link createDecipheriv} methods are - * used to create `Decipher` instances. `Decipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Decipher` objects as streams: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Key length is dependent on the algorithm. In this case for aes192, it is - * // 24 bytes (192 bits). - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * let decrypted = ''; - * decipher.on('readable', () => { - * let chunk; - * while (null !== (chunk = decipher.read())) { - * decrypted += chunk.toString('utf8'); - * } - * }); - * decipher.on('end', () => { - * console.log(decrypted); - * // Prints: some clear text data - * }); - * - * // Encrypted with same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * decipher.write(encrypted, 'hex'); - * decipher.end(); - * ``` - * - * Example: Using `Decipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.enc'); - * const output = createWriteStream('test.js'); - * - * input.pipe(decipher).pipe(output); - * ``` - * - * Example: Using the `decipher.update()` and `decipher.final()` methods: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * // Encrypted using same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); - * decrypted += decipher.final('utf8'); - * console.log(decrypted); - * // Prints: some clear text data - * ``` - * @since v0.1.94 - */ - class Decipher extends stream.Transform { - private constructor(); - /** - * Updates the decipher with `data`. If the `inputEncoding` argument is given, - * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is - * ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. - * - * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error - * being thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `decipher.final()` method has been called, the `Decipher` object can - * no longer be used to decrypt data. Attempts to call `decipher.final()` more - * than once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): Buffer; - final(outputEncoding: BufferEncoding): string; - /** - * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and - * removing padding. - * - * Turning auto padding off will only work if the input data's length is a - * multiple of the ciphers block size. - * - * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(auto_padding?: boolean): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface DecipherOCB extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "pkcs8" | "sec1" | undefined; - passphrase?: string | Buffer | undefined; - encoding?: string | undefined; - } - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "spki" | undefined; - encoding?: string | undefined; - } - /** - * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKey, - * } = await import('node:crypto'); - * - * generateKey('hmac', { length: 512 }, (err, key) => { - * if (err) throw err; - * console.log(key.export().toString('hex')); // 46e..........620 - * }); - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKey( - type: "hmac" | "aes", - options: { - length: number; - }, - callback: (err: Error | null, key: KeyObject) => void, - ): void; - /** - * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKeySync, - * } = await import('node:crypto'); - * - * const key = generateKeySync('hmac', { length: 512 }); - * console.log(key.export().toString('hex')); // e89..........41e - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKeySync( - type: "hmac" | "aes", - options: { - length: number; - }, - ): KeyObject; - interface JsonWebKeyInput { - key: JsonWebKey; - format: "jwk"; - } - /** - * Creates and returns a new key object containing a private key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above. - * - * If the private key is encrypted, a `passphrase` must be specified. The length - * of the passphrase is limited to 1024 bytes. - * @since v11.6.0 - */ - function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a public key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key; - * otherwise, `key` must be an object with the properties described above. - * - * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. - * - * Because public keys can be derived from private keys, a private key may be - * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the - * returned `KeyObject` will be `'public'` and that the private key cannot be - * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned - * and it will be impossible to extract the private key from the returned object. - * @since v11.6.0 - */ - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a secret key for symmetric - * encryption or `Hmac`. - * @since v11.6.0 - * @param encoding The string encoding when `key` is a string. - */ - function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; - function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; - /** - * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. - * Optional `options` argument controls the `stream.Writable` behavior. - * - * In some cases, a `Sign` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createSign(algorithm: string, options?: stream.WritableOptions): Sign; - type DSAEncoding = "der" | "ieee-p1363"; - interface SigningOptions { - /** - * @see crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number | undefined; - saltLength?: number | undefined; - dsaEncoding?: DSAEncoding | undefined; - } - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} - interface SignKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} - interface VerifyKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} - type KeyLike = string | Buffer | KeyObject; - /** - * The `Sign` class is a utility for generating signatures. It can be used in one - * of two ways: - * - * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or - * * Using the `sign.update()` and `sign.sign()` methods to produce the - * signature. - * - * The {@link createSign} method is used to create `Sign` instances. The - * argument is the string name of the hash function to use. `Sign` objects are not - * to be created directly using the `new` keyword. - * - * Example: Using `Sign` and `Verify` objects as streams: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('ec', { - * namedCurve: 'sect239k1', - * }); - * - * const sign = createSign('SHA256'); - * sign.write('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey, 'hex'); - * - * const verify = createVerify('SHA256'); - * verify.write('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature, 'hex')); - * // Prints: true - * ``` - * - * Example: Using the `sign.update()` and `verify.update()` methods: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('rsa', { - * modulusLength: 2048, - * }); - * - * const sign = createSign('SHA256'); - * sign.update('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey); - * - * const verify = createVerify('SHA256'); - * verify.update('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature)); - * // Prints: true - * ``` - * @since v0.1.92 - */ - class Sign extends stream.Writable { - private constructor(); - /** - * Updates the `Sign` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): this; - update(data: string, inputEncoding: Encoding): this; - /** - * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the following additional properties can be passed: - * - * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * The `Sign` object can not be again used after `sign.sign()` method has been - * called. Multiple calls to `sign.sign()` will result in an error being thrown. - * @since v0.1.92 - */ - sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - sign( - privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - outputFormat: BinaryToTextEncoding, - ): string; - } - /** - * Creates and returns a `Verify` object that uses the given algorithm. - * Use {@link getHashes} to obtain an array of names of the available - * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior. - * - * In some cases, a `Verify` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - /** - * The `Verify` class is a utility for verifying signatures. It can be used in one - * of two ways: - * - * * As a writable `stream` where written data is used to validate against the - * supplied signature, or - * * Using the `verify.update()` and `verify.verify()` methods to verify - * the signature. - * - * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword. - * - * See `Sign` for examples. - * @since v0.1.92 - */ - class Verify extends stream.Writable { - private constructor(); - /** - * Updates the `Verify` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `inputEncoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Verify; - update(data: string, inputEncoding: Encoding): Verify; - /** - * Verifies the provided data using the given `object` and `signature`. - * - * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an - * object, the following additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the data, in - * the `signatureEncoding`. - * If a `signatureEncoding` is specified, the `signature` is expected to be a - * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * The `verify` object can not be used again after `verify.verify()` has been - * called. Multiple calls to `verify.verify()` will result in an error being - * thrown. - * - * Because public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.1.92 - */ - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: string, - signature_format?: BinaryToTextEncoding, - ): boolean; - } - /** - * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an - * optional specific `generator`. - * - * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used. - * - * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise - * a `Buffer`, `TypedArray`, or `DataView` is expected. - * - * If `generatorEncoding` is specified, `generator` is expected to be a string; - * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. - * @since v0.11.12 - * @param primeEncoding The `encoding` of the `prime` string. - * @param [generator=2] - * @param generatorEncoding The `encoding` of the `generator` string. - */ - function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - /** - * The `DiffieHellman` class is a utility for creating Diffie-Hellman key - * exchanges. - * - * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createDiffieHellman, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createDiffieHellman(2048); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * // OK - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * ``` - * @since v0.5.0 - */ - class DiffieHellman { - private constructor(); - /** - * Generates private and public Diffie-Hellman key values unless they have been - * generated or computed already, and returns - * the public key in the specified `encoding`. This key should be - * transferred to the other party. - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, - * once a private key has been generated or set, calling this function only updates - * the public key but does not generate a new private key. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - generateKeys(): Buffer; - generateKeys(encoding: BinaryToTextEncoding): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using the specified `inputEncoding`, and secret is - * encoded using specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. - * @since v0.5.0 - * @param inputEncoding The `encoding` of an `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; - computeSecret( - otherPublicKey: NodeJS.ArrayBufferView, - inputEncoding: null, - outputEncoding: BinaryToTextEncoding, - ): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * Returns the Diffie-Hellman prime in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrime(): Buffer; - getPrime(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman generator in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getGenerator(): Buffer; - getGenerator(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman public key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPublicKey(): Buffer; - getPublicKey(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman private key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrivateKey(): Buffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected - * to be a string. If no `encoding` is provided, `publicKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * @since v0.5.0 - * @param encoding The `encoding` of the `publicKey` string. - */ - setPublicKey(publicKey: NodeJS.ArrayBufferView): void; - setPublicKey(publicKey: string, encoding: BufferEncoding): void; - /** - * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected - * to be a string. If no `encoding` is provided, `privateKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * - * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be - * used to manually provide the public key or to automatically derive it. - * @since v0.5.0 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BufferEncoding): void; - /** - * A bit field containing any warnings and/or errors resulting from a check - * performed during initialization of the `DiffieHellman` object. - * - * The following values are valid for this property (as defined in `node:constants` module): - * - * * `DH_CHECK_P_NOT_SAFE_PRIME` - * * `DH_CHECK_P_NOT_PRIME` - * * `DH_UNABLE_TO_CHECK_GENERATOR` - * * `DH_NOT_SUITABLE_GENERATOR` - * @since v0.11.12 - */ - verifyError: number; - } - /** - * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. - * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. - * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. - * - * ```js - * const { createDiffieHellmanGroup } = await import('node:crypto'); - * const dh = createDiffieHellmanGroup('modp1'); - * ``` - * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): - * ```bash - * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h - * modp1 # 768 bits - * modp2 # 1024 bits - * modp5 # 1536 bits - * modp14 # 2048 bits - * modp15 # etc. - * modp16 - * modp17 - * modp18 - * ``` - * @since v0.7.5 - */ - const DiffieHellmanGroup: DiffieHellmanGroupConstructor; - interface DiffieHellmanGroupConstructor { - new(name: string): DiffieHellmanGroup; - (name: string): DiffieHellmanGroup; - readonly prototype: DiffieHellmanGroup; - } - type DiffieHellmanGroup = Omit; - /** - * Creates a predefined `DiffieHellmanGroup` key exchange object. The - * supported groups are listed in the documentation for `DiffieHellmanGroup`. - * - * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing - * the keys (with `diffieHellman.setPublicKey()`, for example). The - * advantage of using this method is that the parties do not have to - * generate nor exchange a group modulus beforehand, saving both processor - * and communication time. - * - * Example (obtaining a shared secret): - * - * ```js - * const { - * getDiffieHellman, - * } = await import('node:crypto'); - * const alice = getDiffieHellman('modp14'); - * const bob = getDiffieHellman('modp14'); - * - * alice.generateKeys(); - * bob.generateKeys(); - * - * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); - * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); - * - * // aliceSecret and bobSecret should be the same - * console.log(aliceSecret === bobSecret); - * ``` - * @since v0.7.5 - */ - function getDiffieHellman(groupName: string): DiffieHellmanGroup; - /** - * An alias for {@link getDiffieHellman} - * @since v0.9.3 - */ - function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; - /** - * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. - * - * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be - * thrown if any of the input arguments specify invalid values or types. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2, - * } = await import('node:crypto'); - * - * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * @since v0.5.5 - */ - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - /** - * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. - * - * If an error occurs an `Error` will be thrown, otherwise the derived key will be - * returned as a `Buffer`. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2Sync, - * } = await import('node:crypto'); - * - * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); - * console.log(key.toString('hex')); // '3745e48...08d59ae' - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * @since v0.9.3 - */ - function pbkdf2Sync( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - ): Buffer; - /** - * Generates cryptographically strong pseudorandom data. The `size` argument - * is a number indicating the number of bytes to generate. - * - * If a `callback` function is provided, the bytes are generated asynchronously - * and the `callback` function is invoked with two arguments: `err` and `buf`. - * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes. - * - * ```js - * // Asynchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * randomBytes(256, (err, buf) => { - * if (err) throw err; - * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); - * }); - * ``` - * - * If the `callback` function is not provided, the random bytes are generated - * synchronously and returned as a `Buffer`. An error will be thrown if - * there is a problem generating the bytes. - * - * ```js - * // Synchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * const buf = randomBytes(256); - * console.log( - * `${buf.length} bytes of random data: ${buf.toString('hex')}`); - * ``` - * - * The `crypto.randomBytes()` method will not complete until there is - * sufficient entropy available. - * This should normally never take longer than a few milliseconds. The only time - * when generating the random bytes may conceivably block for a longer period of - * time is right after boot, when the whole system is still low on entropy. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomBytes()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomBytes` requests when doing so as part of fulfilling a client - * request. - * @since v0.5.8 - * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. - * @return if the `callback` function is not provided. - */ - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - /** - * Return a random integer `n` such that `min <= n < max`. This - * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). - * - * The range (`max - min`) must be less than 248. `min` and `max` must - * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). - * - * If the `callback` function is not provided, the random integer is - * generated synchronously. - * - * ```js - * // Asynchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * randomInt(3, (err, n) => { - * if (err) throw err; - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * }); - * ``` - * - * ```js - * // Synchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(3); - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * ``` - * - * ```js - * // With `min` argument - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(1, 7); - * console.log(`The dice rolled: ${n}`); - * ``` - * @since v14.10.0, v12.19.0 - * @param [min=0] Start of random range (inclusive). - * @param max End of random range (exclusive). - * @param callback `function(err, n) {}`. - */ - function randomInt(max: number): number; - function randomInt(min: number, max: number): number; - function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; - function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; - /** - * Synchronous version of {@link randomFill}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * console.log(randomFillSync(buf).toString('hex')); - * - * randomFillSync(buf, 5); - * console.log(buf.toString('hex')); - * - * // The above is equivalent to the following: - * randomFillSync(buf, 5, 5); - * console.log(buf.toString('hex')); - * ``` - * - * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * console.log(Buffer.from(randomFillSync(a).buffer, - * a.byteOffset, a.byteLength).toString('hex')); - * - * const b = new DataView(new ArrayBuffer(10)); - * console.log(Buffer.from(randomFillSync(b).buffer, - * b.byteOffset, b.byteLength).toString('hex')); - * - * const c = new ArrayBuffer(10); - * console.log(Buffer.from(randomFillSync(c)).toString('hex')); - * ``` - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @return The object passed as `buffer` argument. - */ - function randomFillSync(buffer: T, offset?: number, size?: number): T; - /** - * This function is similar to {@link randomBytes} but requires the first - * argument to be a `Buffer` that will be filled. It also - * requires that a callback is passed in. - * - * If the `callback` function is not provided, an error will be thrown. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * randomFill(buf, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * randomFill(buf, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * // The above is equivalent to the following: - * randomFill(buf, 5, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * ``` - * - * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`. - * - * While this includes instances of `Float32Array` and `Float64Array`, this - * function should not be used to generate random floating-point numbers. The - * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array - * contains finite numbers only, they are not drawn from a uniform random - * distribution and have no meaningful lower or upper bounds. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * randomFill(a, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const b = new DataView(new ArrayBuffer(10)); - * randomFill(b, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const c = new ArrayBuffer(10); - * randomFill(c, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf).toString('hex')); - * }); - * ``` - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomFill()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomFill` requests when doing so as part of fulfilling a client - * request. - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @param callback `function(err, buf) {}`. - */ - function randomFill( - buffer: T, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - size: number, - callback: (err: Error | null, buf: T) => void, - ): void; - interface ScryptOptions { - cost?: number | undefined; - blockSize?: number | undefined; - parallelization?: number | undefined; - N?: number | undefined; - r?: number | undefined; - p?: number | undefined; - maxmem?: number | undefined; - } - /** - * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the - * callback as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scrypt, - * } = await import('node:crypto'); - * - * // Using the factory defaults. - * scrypt('password', 'salt', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * // Using a custom N parameter. Must be a power of two. - * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' - * }); - * ``` - * @since v10.5.0 - */ - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - /** - * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * An exception is thrown when key derivation fails, otherwise the derived key is - * returned as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scryptSync, - * } = await import('node:crypto'); - * // Using the factory defaults. - * - * const key1 = scryptSync('password', 'salt', 64); - * console.log(key1.toString('hex')); // '3745e48...08d59ae' - * // Using a custom N parameter. Must be a power of two. - * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); - * console.log(key2.toString('hex')); // '3745e48...aa39b34' - * ``` - * @since v10.5.0 - */ - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; - interface RsaPublicKey { - key: KeyLike; - padding?: number | undefined; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string | undefined; - /** - * @default 'sha1' - */ - oaepHash?: string | undefined; - oaepLabel?: NodeJS.TypedArray | undefined; - padding?: number | undefined; - } - /** - * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using - * the corresponding private key, for example using {@link privateDecrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.11.14 - */ - function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Decrypts `buffer` with `key`.`buffer` was previously encrypted using - * the corresponding private key, for example using {@link privateEncrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v1.1.0 - */ - function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using - * the corresponding public key, for example using {@link publicEncrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. - * @since v0.11.14 - */ - function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using - * the corresponding public key, for example using {@link publicDecrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. - * @since v1.1.0 - */ - function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * ```js - * const { - * getCiphers, - * } = await import('node:crypto'); - * - * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] - * ``` - * @since v0.9.3 - * @return An array with the names of the supported cipher algorithms. - */ - function getCiphers(): string[]; - /** - * ```js - * const { - * getCurves, - * } = await import('node:crypto'); - * - * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] - * ``` - * @since v2.3.0 - * @return An array with the names of the supported elliptic curves. - */ - function getCurves(): string[]; - /** - * @since v10.0.0 - * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. - */ - function getFips(): 1 | 0; - /** - * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. - * Throws an error if FIPS mode is not available. - * @since v10.0.0 - * @param bool `true` to enable FIPS mode. - */ - function setFips(bool: boolean): void; - /** - * ```js - * const { - * getHashes, - * } = await import('node:crypto'); - * - * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] - * ``` - * @since v0.9.3 - * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. - */ - function getHashes(): string[]; - /** - * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) - * key exchanges. - * - * Instances of the `ECDH` class can be created using the {@link createECDH} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createECDH, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createECDH('secp521r1'); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createECDH('secp521r1'); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * // OK - * ``` - * @since v0.11.14 - */ - class ECDH { - private constructor(); - /** - * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the - * format specified by `format`. The `format` argument specifies point encoding - * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is - * interpreted using the specified `inputEncoding`, and the returned key is encoded - * using the specified `outputEncoding`. - * - * Use {@link getCurves} to obtain a list of available curve names. - * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display - * the name and description of each available elliptic curve. - * - * If `format` is not specified the point will be returned in `'uncompressed'`format. - * - * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * Example (uncompressing a key): - * - * ```js - * const { - * createECDH, - * ECDH, - * } = await import('node:crypto'); - * - * const ecdh = createECDH('secp256k1'); - * ecdh.generateKeys(); - * - * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); - * - * const uncompressedKey = ECDH.convertKey(compressedKey, - * 'secp256k1', - * 'hex', - * 'hex', - * 'uncompressed'); - * - * // The converted key and the uncompressed public key should be the same - * console.log(uncompressedKey === ecdh.getPublicKey('hex')); - * ``` - * @since v10.0.0 - * @param inputEncoding The `encoding` of the `key` string. - * @param outputEncoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: BinaryToTextEncoding, - outputEncoding?: "latin1" | "hex" | "base64" | "base64url", - format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; - /** - * Generates private and public EC Diffie-Hellman key values, and returns - * the public key in the specified `format` and `encoding`. This key should be - * transferred to the other party. - * - * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. - * - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - generateKeys(): Buffer; - generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using specified `inputEncoding`, and the returned secret - * is encoded using the specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`. - * - * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. - * - * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is - * usually supplied from a remote user over an insecure network, - * be sure to handle this exception accordingly. - * @since v0.11.14 - * @param inputEncoding The `encoding` of the `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @return The EC Diffie-Hellman in the specified `encoding`. - */ - getPrivateKey(): Buffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. - * - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. - */ - getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; - getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Sets the EC Diffie-Hellman private key. - * If `encoding` is provided, `privateKey` is expected - * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * If `privateKey` is not valid for the curve specified when the `ECDH` object was - * created, an error is thrown. Upon setting the private key, the associated - * public point (key) is also generated and set in the `ECDH` object. - * @since v0.11.14 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; - } - /** - * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a - * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent - * OpenSSL releases, `openssl ecparam -list_curves` will also display the name - * and description of each available elliptic curve. - * @since v0.11.14 - */ - function createECDH(curveName: string): ECDH; - /** - * This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time - * algorithm. - * - * This function does not leak timing information that - * would allow an attacker to guess one of the values. This is suitable for - * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). - * - * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they - * must have the same byte length. An error is thrown if `a` and `b` have - * different byte lengths. - * - * If at least one of `a` and `b` is a `TypedArray` with more than one byte per - * entry, such as `Uint16Array`, the result will be computed using the platform - * byte order. - * - * **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754** - * **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point** - * **numbers `x` and `y` are equal.** - * - * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code - * is timing-safe. Care should be taken to ensure that the surrounding code does - * not introduce timing vulnerabilities. - * @since v6.6.0 - */ - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; - type KeyFormat = "pem" | "der" | "jwk"; - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string | undefined; - passphrase?: string | undefined; - } - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - interface ED25519KeyPairKeyObjectOptions {} - interface ED448KeyPairKeyObjectOptions {} - interface X25519KeyPairKeyObjectOptions {} - interface X448KeyPairKeyObjectOptions {} - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use - */ - namedCurve: string; - } - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - } - interface RSAPSSKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string; - /** - * Minimal salt length in bytes - */ - saltLength?: string; - } - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - } - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs1" | "pkcs8"; - }; - } - interface RSAPSSKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string; - /** - * Minimal salt length in bytes - */ - saltLength?: string; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ECKeyPairOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "sec1" | "pkcs8"; - }; - } - interface ED25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ED448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * When encoding public keys, it is recommended to use `'spki'`. When encoding - * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, - * and to keep the passphrase confidential. - * - * ```js - * const { - * generateKeyPairSync, - * } = await import('node:crypto'); - * - * const { - * publicKey, - * privateKey, - * } = generateKeyPairSync('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }); - * ``` - * - * The return value `{ publicKey, privateKey }` represents the generated key pair. - * When PEM encoding was selected, the respective key will be a string, otherwise - * it will be a buffer containing the data encoded as DER. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage: - * - * ```js - * const { - * generateKeyPair, - * } = await import('node:crypto'); - * - * generateKeyPair('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }, (err, publicKey, privateKey) => { - * // Handle errors and use the generated key pair. - * }); - * ``` - * - * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - namespace generateKeyPair { - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed25519", - options?: ED25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "x25519", - options?: X25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - } - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPrivateKey}. If it is an object, the following - * additional properties can be passed: - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - ): Buffer; - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - callback: (error: Error | null, data: Buffer) => void, - ): void; - /** - * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the - * key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPublicKey}. If it is an object, the following - * additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the `data`. - * - * Because public keys can be derived from private keys, a private key or a public - * key may be passed for `key`. - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - callback: (error: Error | null, result: boolean) => void, - ): void; - /** - * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. - * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`(for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). - * @since v13.9.0, v12.17.0 - */ - function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; - type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; - interface CipherInfoOptions { - /** - * A test key length. - */ - keyLength?: number | undefined; - /** - * A test IV length. - */ - ivLength?: number | undefined; - } - interface CipherInfo { - /** - * The name of the cipher. - */ - name: string; - /** - * The nid of the cipher. - */ - nid: number; - /** - * The block size of the cipher in bytes. - * This property is omitted when mode is 'stream'. - */ - blockSize?: number | undefined; - /** - * The expected or default initialization vector length in bytes. - * This property is omitted if the cipher does not use an initialization vector. - */ - ivLength?: number | undefined; - /** - * The expected or default key length in bytes. - */ - keyLength: number; - /** - * The cipher mode. - */ - mode: CipherMode; - } - /** - * Returns information about a given cipher. - * - * Some ciphers accept variable length keys and initialization vectors. By default, - * the `crypto.getCipherInfo()` method will return the default values for these - * ciphers. To test if a given key length or iv length is acceptable for given - * cipher, use the `keyLength` and `ivLength` options. If the given values are - * unacceptable, `undefined` will be returned. - * @since v15.0.0 - * @param nameOrNid The name or nid of the cipher to query. - */ - function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; - /** - * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. - * - * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. The successfully generated `derivedKey` will - * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any - * of the input arguments specify invalid values or types. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdf, - * } = await import('node:crypto'); - * - * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * }); - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdf( - digest: string, - irm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: ArrayBuffer) => void, - ): void; - /** - * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The - * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes. - * - * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). - * - * An error will be thrown if any of the input arguments specify invalid values or - * types, or if the derived key cannot be generated. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdfSync, - * } = await import('node:crypto'); - * - * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdfSync( - digest: string, - ikm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - ): ArrayBuffer; - interface SecureHeapUsage { - /** - * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. - */ - total: number; - /** - * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. - */ - min: number; - /** - * The total number of bytes currently allocated from the secure heap. - */ - used: number; - /** - * The calculated ratio of `used` to `total` allocated bytes. - */ - utilization: number; - } - /** - * @since v15.6.0 - */ - function secureHeapUsed(): SecureHeapUsage; - interface RandomUUIDOptions { - /** - * By default, to improve performance, - * Node.js will pre-emptively generate and persistently cache enough - * random data to generate up to 128 random UUIDs. To generate a UUID - * without using the cache, set `disableEntropyCache` to `true`. - * - * @default `false` - */ - disableEntropyCache?: boolean | undefined; - } - type UUID = `${string}-${string}-${string}-${string}-${string}`; - /** - * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a - * cryptographic pseudorandom number generator. - * @since v15.6.0, v14.17.0 - */ - function randomUUID(options?: RandomUUIDOptions): UUID; - interface X509CheckOptions { - /** - * @default 'always' - */ - subject?: "always" | "default" | "never"; - /** - * @default true - */ - wildcards?: boolean; - /** - * @default true - */ - partialWildcards?: boolean; - /** - * @default false - */ - multiLabelWildcards?: boolean; - /** - * @default false - */ - singleLabelSubdomains?: boolean; - } - /** - * Encapsulates an X509 certificate and provides read-only access to - * its information. - * - * ```js - * const { X509Certificate } = await import('node:crypto'); - * - * const x509 = new X509Certificate('{... pem encoded cert ...}'); - * - * console.log(x509.subject); - * ``` - * @since v15.6.0 - */ - class X509Certificate { - /** - * Will be \`true\` if this is a Certificate Authority (CA) certificate. - * @since v15.6.0 - */ - readonly ca: boolean; - /** - * The SHA-1 fingerprint of this certificate. - * - * Because SHA-1 is cryptographically broken and because the security of SHA-1 is - * significantly worse than that of algorithms that are commonly used to sign - * certificates, consider using `x509.fingerprint256` instead. - * @since v15.6.0 - */ - readonly fingerprint: string; - /** - * The SHA-256 fingerprint of this certificate. - * @since v15.6.0 - */ - readonly fingerprint256: string; - /** - * The SHA-512 fingerprint of this certificate. - * - * Because computing the SHA-256 fingerprint is usually faster and because it is - * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be - * a better choice. While SHA-512 presumably provides a higher level of security in - * general, the security of SHA-256 matches that of most algorithms that are - * commonly used to sign certificates. - * @since v17.2.0, v16.14.0 - */ - readonly fingerprint512: string; - /** - * The complete subject of this certificate. - * @since v15.6.0 - */ - readonly subject: string; - /** - * The subject alternative name specified for this certificate. - * - * This is a comma-separated list of subject alternative names. Each entry begins - * with a string identifying the kind of the subject alternative name followed by - * a colon and the value associated with the entry. - * - * Earlier versions of Node.js incorrectly assumed that it is safe to split this - * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, - * both malicious and legitimate certificates can contain subject alternative names - * that include this sequence when represented as a string. - * - * After the prefix denoting the type of the entry, the remainder of each entry - * might be enclosed in quotes to indicate that the value is a JSON string literal. - * For backward compatibility, Node.js only uses JSON string literals within this - * property when necessary to avoid ambiguity. Third-party code should be prepared - * to handle both possible entry formats. - * @since v15.6.0 - */ - readonly subjectAltName: string | undefined; - /** - * A textual representation of the certificate's authority information access - * extension. - * - * This is a line feed separated list of access descriptions. Each line begins with - * the access method and the kind of the access location, followed by a colon and - * the value associated with the access location. - * - * After the prefix denoting the access method and the kind of the access location, - * the remainder of each line might be enclosed in quotes to indicate that the - * value is a JSON string literal. For backward compatibility, Node.js only uses - * JSON string literals within this property when necessary to avoid ambiguity. - * Third-party code should be prepared to handle both possible entry formats. - * @since v15.6.0 - */ - readonly infoAccess: string | undefined; - /** - * An array detailing the key usages for this certificate. - * @since v15.6.0 - */ - readonly keyUsage: string[]; - /** - * The issuer identification included in this certificate. - * @since v15.6.0 - */ - readonly issuer: string; - /** - * The issuer certificate or `undefined` if the issuer certificate is not - * available. - * @since v15.9.0 - */ - readonly issuerCertificate?: X509Certificate | undefined; - /** - * The public key `KeyObject` for this certificate. - * @since v15.6.0 - */ - readonly publicKey: KeyObject; - /** - * A `Buffer` containing the DER encoding of this certificate. - * @since v15.6.0 - */ - readonly raw: Buffer; - /** - * The serial number of this certificate. - * - * Serial numbers are assigned by certificate authorities and do not uniquely - * identify certificates. Consider using `x509.fingerprint256` as a unique - * identifier instead. - * @since v15.6.0 - */ - readonly serialNumber: string; - /** - * The date/time from which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validFrom: string; - /** - * The date/time until which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validTo: string; - constructor(buffer: BinaryLike); - /** - * Checks whether the certificate matches the given email address. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any email addresses. - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching email - * address, the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns `email` if the certificate matches, `undefined` if it does not. - */ - checkEmail(email: string, options?: Pick): string | undefined; - /** - * Checks whether the certificate matches the given host name. - * - * If the certificate matches the given host name, the matching subject name is - * returned. The returned name might be an exact match (e.g., `foo.example.com`) - * or it might contain wildcards (e.g., `*.example.com`). Because host name - * comparisons are case-insensitive, the returned subject name might also differ - * from the given `name` in capitalization. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching DNS name, - * the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. - */ - checkHost(name: string, options?: X509CheckOptions): string | undefined; - /** - * Checks whether the certificate matches the given IP address (IPv4 or IPv6). - * - * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they - * must match the given `ip` address exactly. Other subject alternative names as - * well as the subject field of the certificate are ignored. - * @since v15.6.0 - * @return Returns `ip` if the certificate matches, `undefined` if it does not. - */ - checkIP(ip: string): string | undefined; - /** - * Checks whether this certificate was issued by the given `otherCert`. - * @since v15.6.0 - */ - checkIssued(otherCert: X509Certificate): boolean; - /** - * Checks whether the public key for this certificate is consistent with - * the given private key. - * @since v15.6.0 - * @param privateKey A private key. - */ - checkPrivateKey(privateKey: KeyObject): boolean; - /** - * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded - * certificate. - * @since v15.6.0 - */ - toJSON(): string; - /** - * Returns information about this certificate using the legacy `certificate object` encoding. - * @since v15.6.0 - */ - toLegacyObject(): PeerCertificate; - /** - * Returns the PEM-encoded certificate. - * @since v15.6.0 - */ - toString(): string; - /** - * Verifies that this certificate was signed by the given public key. - * Does not perform any other validation checks on the certificate. - * @since v15.6.0 - * @param publicKey A public key. - */ - verify(publicKey: KeyObject): boolean; - } - type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; - interface GeneratePrimeOptions { - add?: LargeNumberLike | undefined; - rem?: LargeNumberLike | undefined; - /** - * @default false - */ - safe?: boolean | undefined; - bigint?: boolean | undefined; - } - interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { - bigint: true; - } - interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { - bigint?: false | undefined; - } - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsBigInt, - callback: (err: Error | null, prime: bigint) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsArrayBuffer, - callback: (err: Error | null, prime: ArrayBuffer) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptions, - callback: (err: Error | null, prime: ArrayBuffer | bigint) => void, - ): void; - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrimeSync(size: number): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; - interface CheckPrimeOptions { - /** - * The number of Miller-Rabin probabilistic primality iterations to perform. - * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. - * Care must be used when selecting a number of checks. - * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. - * - * @default 0 - */ - checks?: number | undefined; - } - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - */ - function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; - function checkPrime( - value: LargeNumberLike, - options: CheckPrimeOptions, - callback: (err: Error | null, result: boolean) => void, - ): void; - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. - */ - function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; - /** - * Load and set the `engine` for some or all OpenSSL functions (selected by flags). - * - * `engine` could be either an id or a path to the engine's shared library. - * - * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`): - * - * * `crypto.constants.ENGINE_METHOD_RSA` - * * `crypto.constants.ENGINE_METHOD_DSA` - * * `crypto.constants.ENGINE_METHOD_DH` - * * `crypto.constants.ENGINE_METHOD_RAND` - * * `crypto.constants.ENGINE_METHOD_EC` - * * `crypto.constants.ENGINE_METHOD_CIPHERS` - * * `crypto.constants.ENGINE_METHOD_DIGESTS` - * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` - * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` - * * `crypto.constants.ENGINE_METHOD_ALL` - * * `crypto.constants.ENGINE_METHOD_NONE` - * @since v0.11.11 - * @param flags - */ - function setEngine(engine: string, flags?: number): void; - /** - * A convenient alias for {@link webcrypto.getRandomValues}. This - * implementation is not compliant with the Web Crypto spec, to write - * web-compatible code use {@link webcrypto.getRandomValues} instead. - * @since v17.4.0 - * @return Returns `typedArray`. - */ - function getRandomValues(typedArray: T): T; - /** - * A convenient alias for `crypto.webcrypto.subtle`. - * @since v17.4.0 - */ - const subtle: webcrypto.SubtleCrypto; - /** - * An implementation of the Web Crypto API standard. - * - * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. - * @since v15.0.0 - */ - const webcrypto: webcrypto.Crypto; - namespace webcrypto { - type BufferSource = ArrayBufferView | ArrayBuffer; - type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; - type KeyType = "private" | "public" | "secret"; - type KeyUsage = - | "decrypt" - | "deriveBits" - | "deriveKey" - | "encrypt" - | "sign" - | "unwrapKey" - | "verify" - | "wrapKey"; - type AlgorithmIdentifier = Algorithm | string; - type HashAlgorithmIdentifier = AlgorithmIdentifier; - type NamedCurve = string; - type BigInteger = Uint8Array; - interface AesCbcParams extends Algorithm { - iv: BufferSource; - } - interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; - } - interface AesDerivedKeyParams extends Algorithm { - length: number; - } - interface AesGcmParams extends Algorithm { - additionalData?: BufferSource; - iv: BufferSource; - tagLength?: number; - } - interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; - } - interface AesKeyGenParams extends Algorithm { - length: number; - } - interface Algorithm { - name: string; - } - interface EcKeyAlgorithm extends KeyAlgorithm { - namedCurve: NamedCurve; - } - interface EcKeyGenParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcKeyImportParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; - } - interface EcdsaParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface Ed448Params extends Algorithm { - context?: BufferSource; - } - interface HkdfParams extends Algorithm { - hash: HashAlgorithmIdentifier; - info: BufferSource; - salt: BufferSource; - } - interface HmacImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: KeyAlgorithm; - length: number; - } - interface HmacKeyGenParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface JsonWebKey { - alg?: string; - crv?: string; - d?: string; - dp?: string; - dq?: string; - e?: string; - ext?: boolean; - k?: string; - key_ops?: string[]; - kty?: string; - n?: string; - oth?: RsaOtherPrimesInfo[]; - p?: string; - q?: string; - qi?: string; - use?: string; - x?: string; - y?: string; - } - interface KeyAlgorithm { - name: string; - } - interface Pbkdf2Params extends Algorithm { - hash: HashAlgorithmIdentifier; - iterations: number; - salt: BufferSource; - } - interface RsaHashedImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: KeyAlgorithm; - } - interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: HashAlgorithmIdentifier; - } - interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaOaepParams extends Algorithm { - label?: BufferSource; - } - interface RsaOtherPrimesInfo { - d?: string; - r?: string; - t?: string; - } - interface RsaPssParams extends Algorithm { - saltLength: number; - } - /** - * Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class. - * `Crypto` is a singleton that provides access to the remainder of the crypto API. - * @since v15.0.0 - */ - interface Crypto { - /** - * Provides access to the `SubtleCrypto` API. - * @since v15.0.0 - */ - readonly subtle: SubtleCrypto; - /** - * Generates cryptographically strong random values. - * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. - * - * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. - * - * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. - * @since v15.0.0 - */ - getRandomValues>(typedArray: T): T; - /** - * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. - * The UUID is generated using a cryptographic pseudorandom number generator. - * @since v16.7.0 - */ - randomUUID(): UUID; - CryptoKey: CryptoKeyConstructor; - } - // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. - interface CryptoKeyConstructor { - /** Illegal constructor */ - (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. - readonly length: 0; - readonly name: "CryptoKey"; - readonly prototype: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface CryptoKey { - /** - * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. - * @since v15.0.0 - */ - readonly algorithm: KeyAlgorithm; - /** - * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. - * @since v15.0.0 - */ - readonly extractable: boolean; - /** - * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. - * @since v15.0.0 - */ - readonly type: KeyType; - /** - * An array of strings identifying the operations for which the key may be used. - * - * The possible usages are: - * - `'encrypt'` - The key may be used to encrypt data. - * - `'decrypt'` - The key may be used to decrypt data. - * - `'sign'` - The key may be used to generate digital signatures. - * - `'verify'` - The key may be used to verify digital signatures. - * - `'deriveKey'` - The key may be used to derive a new key. - * - `'deriveBits'` - The key may be used to derive bits. - * - `'wrapKey'` - The key may be used to wrap another key. - * - `'unwrapKey'` - The key may be used to unwrap another key. - * - * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). - * @since v15.0.0 - */ - readonly usages: KeyUsage[]; - } - /** - * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. - * @since v15.0.0 - */ - interface CryptoKeyPair { - /** - * A {@link CryptoKey} whose type will be `'private'`. - * @since v15.0.0 - */ - privateKey: CryptoKey; - /** - * A {@link CryptoKey} whose type will be `'public'`. - * @since v15.0.0 - */ - publicKey: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface SubtleCrypto { - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, - * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, - * the returned promise will be resolved with an `` containing the plaintext result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - decrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, - * `subtle.deriveBits()` attempts to generate `length` bits. - * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. - * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed - * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. - * If successful, the returned promise will be resolved with an `` containing the generated data. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @since v15.0.0 - */ - deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise; - deriveBits( - algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - length: number, - ): Promise; - /** - * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, - * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. - * - * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, - * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - deriveKey( - algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - derivedKeyAlgorithm: - | AlgorithmIdentifier - | AesDerivedKeyParams - | HmacImportParams - | HkdfParams - | Pbkdf2Params, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - /** - * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. - * If successful, the returned promise is resolved with an `` containing the computed digest. - * - * If `algorithm` is provided as a ``, it must be one of: - * - * - `'SHA-1'` - * - `'SHA-256'` - * - `'SHA-384'` - * - `'SHA-512'` - * - * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. - * @since v15.0.0 - */ - digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; - /** - * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, - * `subtle.encrypt()` attempts to encipher `data`. If successful, - * the returned promise is resolved with an `` containing the encrypted result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - encrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Exports the given key into the specified format, if supported. - * - * If the `` is not extractable, the returned promise will reject. - * - * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, - * the returned promise will be resolved with an `` containing the exported key data. - * - * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a - * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @returns `` containing ``. - * @since v15.0.0 - */ - exportKey(format: "jwk", key: CryptoKey): Promise; - exportKey(format: Exclude, key: CryptoKey): Promise; - /** - * Using the method and parameters provided in `algorithm`, - * `subtle.generateKey()` attempts to generate new keying material. - * Depending the method used, the method may generate either a single `` or a ``. - * - * The `` (public and private key) generating algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * The `` (secret key) generating algorithms supported include: - * - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - generateKey( - algorithm: RsaHashedKeyGenParams | EcKeyGenParams, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AlgorithmIdentifier, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` - * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. - * If the import is successful, the returned promise will be resolved with the created ``. - * - * If importing a `'PBKDF2'` key, `extractable` must be `false`. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - importKey( - format: "jwk", - keyData: JsonWebKey, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - importKey( - format: Exclude, - keyData: BufferSource, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given by `algorithm` and the keying material provided by `key`, - * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, - * the returned promise is resolved with an `` containing the generated signature. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - sign( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. - * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) - * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. - * If successful, the returned promise is resolved with a `` object. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * - * The unwrapped key algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - unwrapKey( - format: KeyFormat, - wrappedKey: BufferSource, - unwrappingKey: CryptoKey, - unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - unwrappedKeyAlgorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given in `algorithm` and the keying material provided by `key`, - * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. - * The returned promise is resolved with either `true` or `false`. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - verify( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - signature: BufferSource, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, - * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. - * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, - * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. - * If successful, the returned promise will be resolved with an `` containing the encrypted key data. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @since v15.0.0 - */ - wrapKey( - format: KeyFormat, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - ): Promise; - } - } -} -declare module "node:crypto" { - export * from "crypto"; -} diff --git a/reverse_engineering/node_modules/@types/node/dgram.d.ts b/reverse_engineering/node_modules/@types/node/dgram.d.ts deleted file mode 100644 index 692e547f..00000000 --- a/reverse_engineering/node_modules/@types/node/dgram.d.ts +++ /dev/null @@ -1,586 +0,0 @@ -/** - * The `node:dgram` module provides an implementation of UDP datagram sockets. - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js) - */ -declare module "dgram" { - import { AddressInfo } from "node:net"; - import * as dns from "node:dns"; - import { Abortable, EventEmitter } from "node:events"; - interface RemoteInfo { - address: string; - family: "IPv4" | "IPv6"; - port: number; - size: number; - } - interface BindOptions { - port?: number | undefined; - address?: string | undefined; - exclusive?: boolean | undefined; - fd?: number | undefined; - } - type SocketType = "udp4" | "udp6"; - interface SocketOptions extends Abortable { - type: SocketType; - reuseAddr?: boolean | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - recvBufferSize?: number | undefined; - sendBufferSize?: number | undefined; - lookup?: - | (( - hostname: string, - options: dns.LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ) => void) - | undefined; - } - /** - * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram - * messages. When `address` and `port` are not passed to `socket.bind()` the - * method will bind the socket to the "all interfaces" address on a random port - * (it does the right thing for both `udp4` and `udp6` sockets). The bound address - * and port can be retrieved using `socket.address().address` and `socket.address().port`. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket: - * - * ```js - * const controller = new AbortController(); - * const { signal } = controller; - * const server = dgram.createSocket({ type: 'udp4', signal }); - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * // Later, when you want to close the server. - * controller.abort(); - * ``` - * @since v0.11.13 - * @param options Available options are: - * @param callback Attached as a listener for `'message'` events. Optional. - */ - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - /** - * Encapsulates the datagram functionality. - * - * New instances of `dgram.Socket` are created using {@link createSocket}. - * The `new` keyword is not to be used to create `dgram.Socket` instances. - * @since v0.1.99 - */ - class Socket extends EventEmitter { - /** - * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not - * specified, the operating system will choose - * one interface and will add membership to it. To add membership to every - * available interface, call `addMembership` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * - * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: - * - * ```js - * import cluster from 'node:cluster'; - * import dgram from 'node:dgram'; - * - * if (cluster.isPrimary) { - * cluster.fork(); // Works ok. - * cluster.fork(); // Fails with EADDRINUSE. - * } else { - * const s = dgram.createSocket('udp4'); - * s.bind(1234, () => { - * s.addMembership('224.0.0.114'); - * }); - * } - * ``` - * @since v0.6.9 - */ - addMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * Returns an object containing the address information for a socket. - * For UDP sockets, this object will contain `address`, `family`, and `port`properties. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.99 - */ - address(): AddressInfo; - /** - * For UDP sockets, causes the `dgram.Socket` to listen for datagram - * messages on a named `port` and optional `address`. If `port` is not - * specified or is `0`, the operating system will attempt to bind to a - * random port. If `address` is not specified, the operating system will - * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is - * called. - * - * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very - * useful. - * - * A bound datagram socket keeps the Node.js process running to receive - * datagram messages. - * - * If binding fails, an `'error'` event is generated. In rare case (e.g. - * attempting to bind with a closed socket), an `Error` may be thrown. - * - * Example of a UDP server listening on port 41234: - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @since v0.1.99 - * @param callback with no parameters. Called when binding is complete. - */ - bind(port?: number, address?: string, callback?: () => void): this; - bind(port?: number, callback?: () => void): this; - bind(callback?: () => void): this; - bind(options: BindOptions, callback?: () => void): this; - /** - * Close the underlying socket and stop listening for data on it. If a callback is - * provided, it is added as a listener for the `'close'` event. - * @since v0.1.99 - * @param callback Called when the socket has been closed. - */ - close(callback?: () => void): this; - /** - * Associates the `dgram.Socket` to a remote address and port. Every - * message sent by this handle is automatically sent to that destination. Also, - * the socket will only receive messages from that remote peer. - * Trying to call `connect()` on an already connected socket will result - * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not - * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) - * will be used by default. Once the connection is complete, a `'connect'` event - * is emitted and the optional `callback` function is called. In case of failure, - * the `callback` is called or, failing this, an `'error'` event is emitted. - * @since v12.0.0 - * @param callback Called when the connection is completed or on error. - */ - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - /** - * A synchronous function that disassociates a connected `dgram.Socket` from - * its remote address. Trying to call `disconnect()` on an unbound or already - * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. - * @since v12.0.0 - */ - disconnect(): void; - /** - * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the - * kernel when the socket is closed or the process terminates, so most apps will - * never have reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v0.6.9 - */ - dropMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_RCVBUF` socket receive buffer size in bytes. - */ - getRecvBufferSize(): number; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_SNDBUF` socket send buffer size in bytes. - */ - getSendBufferSize(): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active. The `socket.ref()` method adds the socket back to the reference - * counting and restores the default behavior. - * - * Calling `socket.ref()` multiples times will have no additional effect. - * - * The `socket.ref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - ref(): this; - /** - * Returns an object containing the `address`, `family`, and `port` of the remote - * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception - * if the socket is not connected. - * @since v12.0.0 - */ - remoteAddress(): AddressInfo; - /** - * Broadcasts a datagram on the socket. - * For connectionless sockets, the destination `port` and `address` must be - * specified. Connected sockets, on the other hand, will use their associated - * remote endpoint, so the `port` and `address` arguments must not be set. - * - * The `msg` argument contains the message to be sent. - * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, - * any `TypedArray` or a `DataView`, - * the `offset` and `length` specify the offset within the `Buffer` where the - * message begins and the number of bytes in the message, respectively. - * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that - * contain multi-byte characters, `offset` and `length` will be calculated with - * respect to `byte length` and not the character position. - * If `msg` is an array, `offset` and `length` must not be specified. - * - * The `address` argument is a string. If the value of `address` is a host name, - * DNS will be used to resolve the address of the host. If `address` is not - * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default. - * - * If the socket has not been previously bound with a call to `bind`, the socket - * is assigned a random port number and is bound to the "all interfaces" address - * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) - * - * An optional `callback` function may be specified to as a way of reporting - * DNS errors or for determining when it is safe to reuse the `buf` object. - * DNS lookups delay the time to send for at least one tick of the - * Node.js event loop. - * - * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be - * passed as the first argument to the `callback`. If a `callback` is not given, - * the error is emitted as an `'error'` event on the `socket` object. - * - * Offset and length are optional but both _must_ be set if either are used. - * They are supported only when the first argument is a `Buffer`, a `TypedArray`, - * or a `DataView`. - * - * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. - * - * Example of sending a UDP packet to a port on `localhost`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.send(message, 41234, 'localhost', (err) => { - * client.close(); - * }); - * ``` - * - * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('Some '); - * const buf2 = Buffer.from('bytes'); - * const client = dgram.createSocket('udp4'); - * client.send([buf1, buf2], 41234, (err) => { - * client.close(); - * }); - * ``` - * - * Sending multiple buffers might be faster or slower depending on the - * application and operating system. Run benchmarks to - * determine the optimal strategy on a case-by-case basis. Generally speaking, - * however, sending multiple buffers is faster. - * - * Example of sending a UDP packet using a socket connected to a port on`localhost`: - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.connect(41234, 'localhost', (err) => { - * client.send(message, (err) => { - * client.close(); - * }); - * }); - * ``` - * @since v0.1.99 - * @param msg Message to be sent. - * @param offset Offset in the buffer where the message starts. - * @param length Number of bytes in the message. - * @param port Destination port. - * @param address Destination host name or IP address. - * @param callback Called when the message has been sent. - */ - send( - msg: string | Uint8Array | readonly any[], - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array | readonly any[], - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array | readonly any[], - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - /** - * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP - * packets may be sent to a local interface's broadcast address. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.6.9 - */ - setBroadcast(flag: boolean): void; - /** - * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC - * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ - * _with a scope index is written as `'IP%scope'` where scope is an interface name_ - * _or interface number._ - * - * Sets the default outgoing multicast interface of the socket to a chosen - * interface or back to system interface selection. The `multicastInterface` must - * be a valid string representation of an IP from the socket's family. - * - * For IPv4 sockets, this should be the IP configured for the desired physical - * interface. All packets sent to multicast on the socket will be sent on the - * interface determined by the most recent successful use of this call. - * - * For IPv6 sockets, `multicastInterface` should include a scope to indicate the - * interface as in the examples that follow. In IPv6, individual `send` calls can - * also use explicit scope in addresses, so only packets sent to a multicast - * address without specifying an explicit scope are affected by the most recent - * successful use of this call. - * - * This method throws `EBADF` if called on an unbound socket. - * - * #### Example: IPv6 outgoing multicast interface - * - * On most systems, where scope format uses the interface name: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%eth1'); - * }); - * ``` - * - * On Windows, where scope format uses an interface number: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%2'); - * }); - * ``` - * - * #### Example: IPv4 outgoing multicast interface - * - * All systems use an IP of the host on the desired physical interface: - * - * ```js - * const socket = dgram.createSocket('udp4'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('10.0.0.2'); - * }); - * ``` - * @since v8.6.0 - */ - setMulticastInterface(multicastInterface: string): void; - /** - * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, - * multicast packets will also be received on the local interface. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastLoopback(flag: boolean): boolean; - /** - * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for - * "Time to Live", in this context it specifies the number of IP hops that a - * packet is allowed to travel through, specifically for multicast traffic. Each - * router or gateway that forwards a packet decrements the TTL. If the TTL is - * decremented to 0 by a router, it will not be forwarded. - * - * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastTTL(ttl: number): number; - /** - * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setRecvBufferSize(size: number): void; - /** - * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setSendBufferSize(size: number): void; - /** - * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", - * in this context it specifies the number of IP hops that a packet is allowed to - * travel through. Each router or gateway that forwards a packet decrements the - * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. - * Changing TTL values is typically done for network probes or when multicasting. - * - * The `ttl` argument may be between 1 and 255\. The default on most systems - * is 64. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.101 - */ - setTTL(ttl: number): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active, allowing the process to exit even if the socket is still - * listening. - * - * Calling `socket.unref()` multiple times will have no additional effect. - * - * The `socket.unref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - unref(): this; - /** - * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket - * option. If the `multicastInterface` argument - * is not specified, the operating system will choose one interface and will add - * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * @since v13.1.0, v12.16.0 - */ - addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is - * automatically called by the kernel when the - * socket is closed or the process terminates, so most apps will never have - * reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v13.1.0, v12.16.0 - */ - dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - /** - * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } -} -declare module "node:dgram" { - export * from "dgram"; -} diff --git a/reverse_engineering/node_modules/@types/node/diagnostics_channel.d.ts b/reverse_engineering/node_modules/@types/node/diagnostics_channel.d.ts deleted file mode 100644 index b02f5917..00000000 --- a/reverse_engineering/node_modules/@types/node/diagnostics_channel.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -/** - * The `node:diagnostics_channel` module provides an API to create named channels - * to report arbitrary message data for diagnostics purposes. - * - * It can be accessed using: - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * ``` - * - * It is intended that a module writer wanting to report diagnostics messages - * will create one or many top-level channels to report messages through. - * Channels may also be acquired at runtime but it is not encouraged - * due to the additional overhead of doing so. Channels may be exported for - * convenience, but as long as the name is known it can be acquired anywhere. - * - * If you intend for your module to produce diagnostics data for others to - * consume it is recommended that you include documentation of what named - * channels are used along with the shape of the message data. Channel names - * should generally include the module name to avoid collisions with data from - * other modules. - * @since v15.1.0, v14.17.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js) - */ -declare module "diagnostics_channel" { - /** - * Check if there are active subscribers to the named channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * if (diagnostics_channel.hasSubscribers('my-channel')) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return If there are active subscribers - */ - function hasSubscribers(name: string | symbol): boolean; - /** - * This is the primary entry-point for anyone wanting to publish to a named - * channel. It produces a channel object which is optimized to reduce overhead at - * publish time as much as possible. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return The named channel object - */ - function channel(name: string | symbol): Channel; - type ChannelListener = (message: unknown, name: string | symbol) => void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * diagnostics_channel.subscribe('my-channel', (message, name) => { - * // Received data - * }); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The handler to receive channel messages - */ - function subscribe(name: string | symbol, onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with {@link subscribe}. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * function onMessage(message, name) { - * // Received data - * } - * - * diagnostics_channel.subscribe('my-channel', onMessage); - * - * diagnostics_channel.unsubscribe('my-channel', onMessage); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; - /** - * The class `Channel` represents an individual named channel within the data - * pipeline. It is used to track subscribers and to publish messages when there - * are subscribers present. It exists as a separate object to avoid channel - * lookups at publish time, enabling very fast publish speeds and allowing - * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly - * with `new Channel(name)` is not supported. - * @since v15.1.0, v14.17.0 - */ - class Channel { - readonly name: string | symbol; - /** - * Check if there are active subscribers to this channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * if (channel.hasSubscribers) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - */ - readonly hasSubscribers: boolean; - private constructor(name: string | symbol); - /** - * Publish a message to any subscribers to the channel. This will trigger - * message handlers synchronously so they will execute within the same context. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.publish({ - * some: 'message', - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @param message The message to send to the channel subscribers - */ - publish(message: unknown): void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.subscribe((message, name) => { - * // Received data - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} - * @param onMessage The handler to receive channel messages - */ - subscribe(onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * function onMessage(message, name) { - * // Received data - * } - * - * channel.subscribe(onMessage); - * - * channel.unsubscribe(onMessage); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - unsubscribe(onMessage: ChannelListener): void; - } -} -declare module "node:diagnostics_channel" { - export * from "diagnostics_channel"; -} diff --git a/reverse_engineering/node_modules/@types/node/dns.d.ts b/reverse_engineering/node_modules/@types/node/dns.d.ts deleted file mode 100644 index 380cf7d7..00000000 --- a/reverse_engineering/node_modules/@types/node/dns.d.ts +++ /dev/null @@ -1,809 +0,0 @@ -/** - * The `node:dns` module enables name resolution. For example, use it to look up IP - * addresses of host names. - * - * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the - * DNS protocol for lookups. {@link lookup} uses the operating system - * facilities to perform name resolution. It may not need to perform any network - * communication. To perform name resolution the way other applications on the same - * system do, use {@link lookup}. - * - * ```js - * const dns = require('node:dns'); - * - * dns.lookup('example.org', (err, address, family) => { - * console.log('address: %j family: IPv%s', address, family); - * }); - * // address: "93.184.216.34" family: IPv4 - * ``` - * - * All other functions in the `node:dns` module connect to an actual DNS server to - * perform name resolution. They will always use the network to perform DNS - * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform - * DNS queries, bypassing other name-resolution facilities. - * - * ```js - * const dns = require('node:dns'); - * - * dns.resolve4('archive.org', (err, addresses) => { - * if (err) throw err; - * - * console.log(`addresses: ${JSON.stringify(addresses)}`); - * - * addresses.forEach((a) => { - * dns.reverse(a, (err, hostnames) => { - * if (err) { - * throw err; - * } - * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); - * }); - * }); - * }); - * ``` - * - * See the `Implementation considerations section` for more information. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js) - */ -declare module "dns" { - import * as dnsPromises from "node:dns/promises"; - // Supported getaddrinfo flags. - export const ADDRCONFIG: number; - export const V4MAPPED: number; - /** - * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as - * well as IPv4 mapped IPv6 addresses. - */ - export const ALL: number; - export interface LookupOptions { - family?: number | undefined; - hints?: number | undefined; - all?: boolean | undefined; - /** - * @default true - */ - verbatim?: boolean | undefined; - } - export interface LookupOneOptions extends LookupOptions { - all?: false | undefined; - } - export interface LookupAllOptions extends LookupOptions { - all: true; - } - export interface LookupAddress { - address: string; - family: number; - } - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then - * IPv4 and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the - * properties `address` and `family`. - * - * On error, `err` is an `Error` object, where `err.code` is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. - * The implementation uses an operating system facility that can associate names - * with addresses and vice versa. This implementation can have subtle but - * important consequences on the behavior of any Node.js program. Please take some - * time to consult the `Implementation considerations section` before using`dns.lookup()`. - * - * Example usage: - * - * ```js - * const dns = require('node:dns'); - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * dns.lookup('example.com', options, (err, address, family) => - * console.log('address: %j family: IPv%s', address, family)); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dns.lookup('example.com', options, (err, addresses) => - * console.log('addresses: %j', addresses)); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * ``` - * - * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties. - * @since v0.1.90 - */ - export function lookup( - hostname: string, - family: number, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupAllOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOptions, - callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, - ): void; - export function lookup( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. - * - * On an error, `err` is an `Error` object, where `err.code` is the error code. - * - * ```js - * const dns = require('node:dns'); - * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { - * console.log(hostname, service); - * // Prints: localhost ssh - * }); - * ``` - * - * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties. - * @since v0.11.14 - */ - export function lookupService( - address: string, - port: number, - callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, - ): void; - export namespace lookupService { - function __promisify__( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - } - export interface ResolveOptions { - ttl: boolean; - } - export interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - export interface RecordWithTtl { - address: string; - ttl: number; - } - /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ - export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - export interface AnyARecord extends RecordWithTtl { - type: "A"; - } - export interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - export interface CaaRecord { - critical: number; - issue?: string | undefined; - issuewild?: string | undefined; - iodef?: string | undefined; - contactemail?: string | undefined; - contactphone?: string | undefined; - } - export interface MxRecord { - priority: number; - exchange: string; - } - export interface AnyMxRecord extends MxRecord { - type: "MX"; - } - export interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - export interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - export interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - export interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - export interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - export interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - export interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - export interface AnyNsRecord { - type: "NS"; - value: string; - } - export interface AnyPtrRecord { - type: "PTR"; - value: string; - } - export interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - export type AnyRecord = - | AnyARecord - | AnyAaaaRecord - | AnyCnameRecord - | AnyMxRecord - | AnyNaptrRecord - | AnyNsRecord - | AnyPtrRecord - | AnySoaRecord - | AnySrvRecord - | AnyTxtRecord; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource - * records. The type and structure of individual results varies based on `rrtype`: - * - * - * - * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`. - * @since v0.1.27 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - export function resolve( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "A", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "AAAA", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "ANY", - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "CNAME", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "MX", - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "NAPTR", - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "NS", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "PTR", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SOA", - callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SRV", - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "TXT", - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: string, - callback: ( - err: NodeJS.ErrnoException | null, - addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[], - ) => void, - ): void; - export namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__( - hostname: string, - rrtype: string, - ): Promise; - } - /** - * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve4( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv6 addresses. - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve6( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function - * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`). - * @since v0.3.2 - */ - export function resolveCname( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function - * will contain an array of certification authority authorization records - * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - export function resolveCaa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void, - ): void; - export namespace resolveCaa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v0.1.27 - */ - export function resolveMx( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of - * objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v0.9.12 - */ - export function resolveNaptr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`). - * @since v0.1.90 - */ - export function resolveNs( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * be an array of strings containing the reply records. - * @since v6.0.0 - */ - export function resolvePtr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. The `address` argument passed to the `callback` function will - * be an object with the following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v0.11.10 - */ - export function resolveSoa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, - ): void; - export namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * be an array of objects with the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v0.1.27 - */ - export function resolveSrv( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a - * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v0.1.27 - */ - export function resolveTxt( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * The `ret` argument passed to the `callback` function will be an array containing - * various types of records. Each object has a property `type` that indicates the - * type of the current record. And depending on the `type`, additional properties - * will be present on the object: - * - * - * - * Here is an example of the `ret` object passed to the callback: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * - * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC - * 8482](https://tools.ietf.org/html/rfc8482). - */ - export function resolveAny( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, `err` is an `Error` object, where `err.code` is - * one of the `DNS error codes`. - * @since v0.1.16 - */ - export function reverse( - ip: string, - callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, - ): void; - /** - * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: for `verbatim` defaulting to `false`. - * * `verbatim`: for `verbatim` defaulting to `true`. - * @since v20.1.0 - */ - export function getDefaultResultOrder(): "ipv4first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dns.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dns.setServers()` method must not be called while a DNS query is in - * progress. - * - * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v0.11.3 - * @param servers array of `RFC 5952` formatted addresses - */ - export function setServers(servers: readonly string[]): void; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v0.11.3 - */ - export function getServers(): string[]; - /** - * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: sets default `verbatim` `false`. - * * `verbatim`: sets default `verbatim` `true`. - * - * The default is `verbatim` and {@link setDefaultResultOrder} have higher - * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default - * dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'` or `'verbatim'`. - */ - export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; - // Error codes - export const NODATA: string; - export const FORMERR: string; - export const SERVFAIL: string; - export const NOTFOUND: string; - export const NOTIMP: string; - export const REFUSED: string; - export const BADQUERY: string; - export const BADNAME: string; - export const BADFAMILY: string; - export const BADRESP: string; - export const CONNREFUSED: string; - export const TIMEOUT: string; - export const EOF: string; - export const FILE: string; - export const NOMEM: string; - export const DESTRUCTION: string; - export const BADSTR: string; - export const BADFLAGS: string; - export const NONAME: string; - export const BADHINTS: string; - export const NOTINITIALIZED: string; - export const LOADIPHLPAPI: string; - export const ADDRGETNETWORKPARAMS: string; - export const CANCELLED: string; - export interface ResolverOptions { - timeout?: number | undefined; - /** - * @default 4 - */ - tries?: number; - } - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using `resolver.setServers()` does not affect - * other resolvers: - * - * ```js - * const { Resolver } = require('node:dns'); - * const resolver = new Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org', (err, addresses) => { - * // ... - * }); - * ``` - * - * The following methods from the `node:dns` module are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v8.3.0 - */ - export class Resolver { - constructor(options?: ResolverOptions); - /** - * Cancel all outstanding DNS queries made by this resolver. The corresponding - * callbacks will be called with an error with code `ECANCELLED`. - * @since v8.3.0 - */ - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - /** - * The resolver instance will send its requests from the specified IP address. - * This allows programs to specify outbound interfaces when used on multi-homed - * systems. - * - * If a v4 or v6 address is not specified, it is set to the default and the - * operating system will choose a local address automatically. - * - * The resolver will use the v4 local address when making requests to IPv4 DNS - * servers, and the v6 local address when making requests to IPv6 DNS servers. - * The `rrtype` of resolution requests has no impact on the local address used. - * @since v15.1.0, v14.17.0 - * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. - * @param [ipv6='::0'] A string representation of an IPv6 address. - */ - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } - export { dnsPromises as promises }; -} -declare module "node:dns" { - export * from "dns"; -} diff --git a/reverse_engineering/node_modules/@types/node/dns/promises.d.ts b/reverse_engineering/node_modules/@types/node/dns/promises.d.ts deleted file mode 100644 index ef9b2228..00000000 --- a/reverse_engineering/node_modules/@types/node/dns/promises.d.ts +++ /dev/null @@ -1,425 +0,0 @@ -/** - * The `dns.promises` API provides an alternative set of asynchronous DNS methods - * that return `Promise` objects rather than using callbacks. The API is accessible - * via `require('node:dns').promises` or `require('node:dns/promises')`. - * @since v10.6.0 - */ -declare module "dns/promises" { - import { - AnyRecord, - CaaRecord, - LookupAddress, - LookupAllOptions, - LookupOneOptions, - LookupOptions, - MxRecord, - NaptrRecord, - RecordWithTtl, - ResolveOptions, - ResolverOptions, - ResolveWithTtlOptions, - SoaRecord, - SrvRecord, - } from "node:dns"; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v10.6.0 - */ - function getServers(): string[]; - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 - * and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS - * protocol. The implementation uses an operating system facility that can - * associate names with addresses and vice versa. This implementation can have - * subtle but important consequences on the behavior of any Node.js program. Please - * take some time to consult the `Implementation considerations section` before - * using `dnsPromises.lookup()`. - * - * Example usage: - * - * ```js - * const dns = require('node:dns'); - * const dnsPromises = dns.promises; - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('address: %j family: IPv%s', result.address, result.family); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * }); - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('addresses: %j', result); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * }); - * ``` - * @since v10.6.0 - */ - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. - * - * ```js - * const dnsPromises = require('node:dns').promises; - * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { - * console.log(result.hostname, result.service); - * // Prints: localhost ssh - * }); - * ``` - * @since v10.6.0 - */ - function lookupService( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. When successful, the `Promise` is resolved with an - * array of resource records. The type and structure of individual results vary - * based on `rrtype`: - * - * - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. - * @since v10.6.0 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A"): Promise; - function resolve(hostname: string, rrtype: "AAAA"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CAA"): Promise; - function resolve(hostname: string, rrtype: "CNAME"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "NS"): Promise; - function resolve(hostname: string, rrtype: "PTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve( - hostname: string, - rrtype: string, - ): Promise; - /** - * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4 - * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6 - * addresses. - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * On success, the `Promise` is resolved with an array containing various types of - * records. Each object has a property `type` that indicates the type of the - * current record. And depending on the `type`, additional properties will be - * present on the object: - * - * - * - * Here is an example of the result object: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * @since v10.6.0 - */ - function resolveAny(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, - * the `Promise` is resolved with an array of objects containing available - * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - function resolveCaa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, - * the `Promise` is resolved with an array of canonical name records available for - * the `hostname` (e.g. `['bar.example.com']`). - * @since v10.6.0 - */ - function resolveCname(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects - * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v10.6.0 - */ - function resolveMx(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array - * of objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v10.6.0 - */ - function resolveNaptr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server - * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). - * @since v10.6.0 - */ - function resolveNs(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings - * containing the reply records. - * @since v10.6.0 - */ - function resolvePtr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. On success, the `Promise` is resolved with an object with the - * following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v10.6.0 - */ - function resolveSoa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with - * the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v10.6.0 - */ - function resolveSrv(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array - * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v10.6.0 - */ - function resolveTxt(hostname: string): Promise; - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. - * @since v10.6.0 - */ - function reverse(ip: string): Promise; - /** - * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: for `verbatim` defaulting to `false`. - * * `verbatim`: for `verbatim` defaulting to `true`. - * @since v20.1.0 - */ - function getDefaultResultOrder(): "ipv4first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dnsPromises.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dnsPromises.setServers()` method must not be called while a DNS query is in - * progress. - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v10.6.0 - * @param servers array of `RFC 5952` formatted addresses - */ - function setServers(servers: readonly string[]): void; - /** - * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: sets default `verbatim` `false`. - * * `verbatim`: sets default `verbatim` `true`. - * - * The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have - * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the - * default dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'` or `'verbatim'`. - */ - function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using `resolver.setServers()` does not affect - * other resolvers: - * - * ```js - * const { Resolver } = require('node:dns').promises; - * const resolver = new Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org').then((addresses) => { - * // ... - * }); - * - * // Alternatively, the same code can be written using async-await style. - * (async function() { - * const addresses = await resolver.resolve4('example.org'); - * })(); - * ``` - * - * The following methods from the `dnsPromises` API are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v10.6.0 - */ - class Resolver { - constructor(options?: ResolverOptions); - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } -} -declare module "node:dns/promises" { - export * from "dns/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/dom-events.d.ts b/reverse_engineering/node_modules/@types/node/dom-events.d.ts deleted file mode 100644 index 147a7b65..00000000 --- a/reverse_engineering/node_modules/@types/node/dom-events.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -export {}; // Don't export anything! - -//// DOM-like Events -// NB: The Event / EventTarget / EventListener implementations below were copied -// from lib.dom.d.ts, then edited to reflect Node's documentation at -// https://nodejs.org/api/events.html#class-eventtarget. -// Please read that link to understand important implementation differences. - -// This conditional type will be the existing global Event in a browser, or -// the copy below in a Node environment. -type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {} - : { - /** This is not used in Node.js and is provided purely for completeness. */ - readonly bubbles: boolean; - /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */ - cancelBubble: () => void; - /** True if the event was created with the cancelable option */ - readonly cancelable: boolean; - /** This is not used in Node.js and is provided purely for completeness. */ - readonly composed: boolean; - /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */ - composedPath(): [EventTarget?]; - /** Alias for event.target. */ - readonly currentTarget: EventTarget | null; - /** Is true if cancelable is true and event.preventDefault() has been called. */ - readonly defaultPrevented: boolean; - /** This is not used in Node.js and is provided purely for completeness. */ - readonly eventPhase: 0 | 2; - /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */ - readonly isTrusted: boolean; - /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */ - preventDefault(): void; - /** This is not used in Node.js and is provided purely for completeness. */ - returnValue: boolean; - /** Alias for event.target. */ - readonly srcElement: EventTarget | null; - /** Stops the invocation of event listeners after the current one completes. */ - stopImmediatePropagation(): void; - /** This is not used in Node.js and is provided purely for completeness. */ - stopPropagation(): void; - /** The `EventTarget` dispatching the event */ - readonly target: EventTarget | null; - /** The millisecond timestamp when the Event object was created. */ - readonly timeStamp: number; - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - }; - -// See comment above explaining conditional type -type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {} - : { - /** - * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value. - * - * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched. - * - * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification. - * Specifically, the `capture` option is used as part of the key when registering a `listener`. - * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`. - */ - addEventListener( - type: string, - listener: EventListener | EventListenerObject, - options?: AddEventListenerOptions | boolean, - ): void; - /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ - dispatchEvent(event: Event): boolean; - /** Removes the event listener in target's event listener list with the same type, callback, and options. */ - removeEventListener( - type: string, - listener: EventListener | EventListenerObject, - options?: EventListenerOptions | boolean, - ): void; - }; - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} - -interface EventListenerOptions { - /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ - capture?: boolean; -} - -interface AddEventListenerOptions extends EventListenerOptions { - /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ - once?: boolean; - /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ - passive?: boolean; -} - -interface EventListener { - (evt: Event): void; -} - -interface EventListenerObject { - handleEvent(object: Event): void; -} - -import {} from "events"; // Make this an ambient declaration -declare global { - /** An event which takes place in the DOM. */ - interface Event extends __Event {} - var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T - : { - prototype: __Event; - new(type: string, eventInitDict?: EventInit): __Event; - }; - - /** - * EventTarget is a DOM interface implemented by objects that can - * receive events and may have listeners for them. - */ - interface EventTarget extends __EventTarget {} - var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T - : { - prototype: __EventTarget; - new(): __EventTarget; - }; -} diff --git a/reverse_engineering/node_modules/@types/node/domain.d.ts b/reverse_engineering/node_modules/@types/node/domain.d.ts deleted file mode 100644 index 72f17bd8..00000000 --- a/reverse_engineering/node_modules/@types/node/domain.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -/** - * **This module is pending deprecation.** Once a replacement API has been - * finalized, this module will be fully deprecated. Most developers should - * **not** have cause to use this module. Users who absolutely must have - * the functionality that domains provide may rely on it for the time being - * but should expect to have to migrate to a different solution - * in the future. - * - * Domains provide a way to handle multiple different IO operations as a - * single group. If any of the event emitters or callbacks registered to a - * domain emit an `'error'` event, or throw an error, then the domain object - * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to - * exit immediately with an error code. - * @deprecated Since v1.4.2 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js) - */ -declare module "domain" { - import EventEmitter = require("node:events"); - /** - * The `Domain` class encapsulates the functionality of routing errors and - * uncaught exceptions to the active `Domain` object. - * - * To handle the errors that it catches, listen to its `'error'` event. - */ - class Domain extends EventEmitter { - /** - * An array of timers and event emitters that have been explicitly added - * to the domain. - */ - members: Array; - /** - * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly - * pushes the domain onto the domain - * stack managed by the domain module (see {@link exit} for details on the - * domain stack). The call to `enter()` delimits the beginning of a chain of - * asynchronous calls and I/O operations bound to a domain. - * - * Calling `enter()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - enter(): void; - /** - * The `exit()` method exits the current domain, popping it off the domain stack. - * Any time execution is going to switch to the context of a different chain of - * asynchronous calls, it's important to ensure that the current domain is exited. - * The call to `exit()` delimits either the end of or an interruption to the chain - * of asynchronous calls and I/O operations bound to a domain. - * - * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain. - * - * Calling `exit()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - exit(): void; - /** - * Run the supplied function in the context of the domain, implicitly - * binding all event emitters, timers, and low-level requests that are - * created in that context. Optionally, arguments can be passed to - * the function. - * - * This is the most basic way to use a domain. - * - * ```js - * const domain = require('node:domain'); - * const fs = require('node:fs'); - * const d = domain.create(); - * d.on('error', (er) => { - * console.error('Caught error!', er); - * }); - * d.run(() => { - * process.nextTick(() => { - * setTimeout(() => { // Simulating some various async stuff - * fs.open('non-existent file', 'r', (er, fd) => { - * if (er) throw er; - * // proceed... - * }); - * }, 100); - * }); - * }); - * ``` - * - * In this example, the `d.on('error')` handler will be triggered, rather - * than crashing the program. - */ - run(fn: (...args: any[]) => T, ...args: any[]): T; - /** - * Explicitly adds an emitter to the domain. If any event handlers called by - * the emitter throw an error, or if the emitter emits an `'error'` event, it - * will be routed to the domain's `'error'` event, just like with implicit - * binding. - * - * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by - * the domain `'error'` handler. - * - * If the Timer or `EventEmitter` was already bound to a domain, it is removed - * from that one, and bound to this one instead. - * @param emitter emitter or timer to be added to the domain - */ - add(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The opposite of {@link add}. Removes domain handling from the - * specified emitter. - * @param emitter emitter or timer to be removed from the domain - */ - remove(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The returned function will be a wrapper around the supplied callback - * function. When the returned function is called, any errors that are - * thrown will be routed to the domain's `'error'` event. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.bind((er, data) => { - * // If this throws, it will also be passed to the domain. - * return cb(er, data ? JSON.parse(data) : null); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The bound function - */ - bind(callback: T): T; - /** - * This method is almost identical to {@link bind}. However, in - * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. - * - * In this way, the common `if (err) return callback(err);` pattern can be replaced - * with a single error handler in a single place. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.intercept((data) => { - * // Note, the first argument is never passed to the - * // callback since it is assumed to be the 'Error' argument - * // and thus intercepted by the domain. - * - * // If this throws, it will also be passed to the domain - * // so the error-handling logic can be moved to the 'error' - * // event on the domain instead of being repeated throughout - * // the program. - * return cb(null, JSON.parse(data)); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The intercepted function - */ - intercept(callback: T): T; - } - function create(): Domain; -} -declare module "node:domain" { - export * from "domain"; -} diff --git a/reverse_engineering/node_modules/@types/node/events.d.ts b/reverse_engineering/node_modules/@types/node/events.d.ts deleted file mode 100644 index 6ed47c53..00000000 --- a/reverse_engineering/node_modules/@types/node/events.d.ts +++ /dev/null @@ -1,879 +0,0 @@ -/** - * Much of the Node.js core API is built around an idiomatic asynchronous - * event-driven architecture in which certain kinds of objects (called "emitters") - * emit named events that cause `Function` objects ("listeners") to be called. - * - * For instance: a `net.Server` object emits an event each time a peer - * connects to it; a `fs.ReadStream` emits an event when the file is opened; - * a `stream` emits an event whenever data is available to be read. - * - * All objects that emit events are instances of the `EventEmitter` class. These - * objects expose an `eventEmitter.on()` function that allows one or more - * functions to be attached to named events emitted by the object. Typically, - * event names are camel-cased strings but any valid JavaScript property key - * can be used. - * - * When the `EventEmitter` object emits an event, all of the functions attached - * to that specific event are called _synchronously_. Any values returned by the - * called listeners are _ignored_ and discarded. - * - * The following example shows a simple `EventEmitter` instance with a single - * listener. The `eventEmitter.on()` method is used to register listeners, while - * the `eventEmitter.emit()` method is used to trigger the event. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * class MyEmitter extends EventEmitter {} - * - * const myEmitter = new MyEmitter(); - * myEmitter.on('event', () => { - * console.log('an event occurred!'); - * }); - * myEmitter.emit('event'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js) - */ -declare module "events" { - import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } - interface EventEmitterOptions { - /** - * Enables automatic capturing of promise rejection. - */ - captureRejections?: boolean | undefined; - } - // Any EventTarget with a Node-style `once` function - interface _NodeEventTarget { - once(eventName: string | symbol, listener: (...args: any[]) => void): this; - } - // Any EventTarget with a DOM-style `addEventListener` - interface _DOMEventTarget { - addEventListener( - eventName: string, - listener: (...args: any[]) => void, - opts?: { - once: boolean; - }, - ): any; - } - interface StaticEventEmitterOptions { - signal?: AbortSignal | undefined; - } - interface EventEmitter extends NodeJS.EventEmitter {} - /** - * The `EventEmitter` class is defined and exposed by the `node:events` module: - * - * ```js - * import { EventEmitter } from 'node:events'; - * ``` - * - * All `EventEmitter`s emit the event `'newListener'` when new listeners are - * added and `'removeListener'` when existing listeners are removed. - * - * It supports the following option: - * @since v0.1.26 - */ - class EventEmitter { - constructor(options?: EventEmitterOptions); - - [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void; - - /** - * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given - * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. - * The `Promise` will resolve with an array of all the arguments emitted to the - * given event. - * - * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event - * semantics and does not listen to the `'error'` event. - * - * ```js - * import { once, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * process.nextTick(() => { - * ee.emit('myevent', 42); - * }); - * - * const [value] = await once(ee, 'myevent'); - * console.log(value); - * - * const err = new Error('kaboom'); - * process.nextTick(() => { - * ee.emit('error', err); - * }); - * - * try { - * await once(ee, 'myevent'); - * } catch (err) { - * console.error('error happened', err); - * } - * ``` - * - * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the - * '`error'` event itself, then it is treated as any other kind of event without - * special handling: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * - * once(ee, 'error') - * .then(([err]) => console.log('ok', err.message)) - * .catch((err) => console.error('error', err.message)); - * - * ee.emit('error', new Error('boom')); - * - * // Prints: ok boom - * ``` - * - * An `AbortSignal` can be used to cancel waiting for the event: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * const ac = new AbortController(); - * - * async function foo(emitter, event, signal) { - * try { - * await once(emitter, event, { signal }); - * console.log('event emitted!'); - * } catch (error) { - * if (error.name === 'AbortError') { - * console.error('Waiting for the event was canceled!'); - * } else { - * console.error('There was an error', error.message); - * } - * } - * } - * - * foo(ee, 'foo', ac.signal); - * ac.abort(); // Abort waiting for the event - * ee.emit('foo'); // Prints: Waiting for the event was canceled! - * ``` - * @since v11.13.0, v10.16.0 - */ - static once( - emitter: _NodeEventTarget, - eventName: string | symbol, - options?: StaticEventEmitterOptions, - ): Promise; - static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; - /** - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo')) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * ``` - * - * Returns an `AsyncIterator` that iterates `eventName` events. It will throw - * if the `EventEmitter` emits `'error'`. It removes all listeners when - * exiting the loop. The `value` returned by each iteration is an array - * composed of the emitted event arguments. - * - * An `AbortSignal` can be used to cancel waiting on events: - * - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ac = new AbortController(); - * - * (async () => { - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo', { signal: ac.signal })) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * })(); - * - * process.nextTick(() => ac.abort()); - * ``` - * @since v13.6.0, v12.16.0 - * @param eventName The name of the event being listened for - * @return that iterates `eventName` events emitted by the `emitter` - */ - static on( - emitter: NodeJS.EventEmitter, - eventName: string, - options?: StaticEventEmitterOptions, - ): AsyncIterableIterator; - /** - * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - * - * ```js - * import { EventEmitter, listenerCount } from 'node:events'; - * - * const myEmitter = new EventEmitter(); - * myEmitter.on('event', () => {}); - * myEmitter.on('event', () => {}); - * console.log(listenerCount(myEmitter, 'event')); - * // Prints: 2 - * ``` - * @since v0.9.12 - * @deprecated Since v3.2.0 - Use `listenerCount` instead. - * @param emitter The emitter to query - * @param eventName The event name - */ - static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the event listeners for the - * event target. This is useful for debugging and diagnostic purposes. - * - * ```js - * import { getEventListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * const listener = () => console.log('Events are fun'); - * ee.on('foo', listener); - * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] - * } - * { - * const et = new EventTarget(); - * const listener = () => console.log('Events are fun'); - * et.addEventListener('foo', listener); - * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] - * } - * ``` - * @since v15.2.0, v14.17.0 - */ - static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; - /** - * Returns the currently set max amount of listeners. - * - * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the max event listeners for the - * event target. If the number of event handlers on a single EventTarget exceeds - * the max set, the EventTarget will print a warning. - * - * ```js - * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * console.log(getMaxListeners(ee)); // 10 - * setMaxListeners(11, ee); - * console.log(getMaxListeners(ee)); // 11 - * } - * { - * const et = new EventTarget(); - * console.log(getMaxListeners(et)); // 10 - * setMaxListeners(11, et); - * console.log(getMaxListeners(et)); // 11 - * } - * ``` - * @since v19.9.0 - */ - static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number; - /** - * ```js - * import { setMaxListeners, EventEmitter } from 'node:events'; - * - * const target = new EventTarget(); - * const emitter = new EventEmitter(); - * - * setMaxListeners(5, target, emitter); - * ``` - * @since v15.4.0 - * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. - * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} - * objects. - */ - static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void; - /** - * Listens once to the `abort` event on the provided `signal`. - * - * Listening to the `abort` event on abort signals is unsafe and may - * lead to resource leaks since another third party with the signal can - * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change - * this since it would violate the web standard. Additionally, the original - * API makes it easy to forget to remove listeners. - * - * This API allows safely using `AbortSignal`s in Node.js APIs by solving these - * two issues by listening to the event such that `stopImmediatePropagation` does - * not prevent the listener from running. - * - * Returns a disposable so that it may be unsubscribed from more easily. - * - * ```js - * import { addAbortListener } from 'node:events'; - * - * function example(signal) { - * let disposable; - * try { - * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); - * disposable = addAbortListener(signal, (e) => { - * // Do something when signal is aborted. - * }); - * } finally { - * disposable?.[Symbol.dispose](); - * } - * } - * ``` - * @since v20.5.0 - * @experimental - * @return Disposable that removes the `abort` listener. - */ - static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; - /** - * This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no - * regular `'error'` listener is installed. - * @since v13.6.0, v12.17.0 - */ - static readonly errorMonitor: unique symbol; - /** - * Value: `Symbol.for('nodejs.rejection')` - * - * See how to write a custom `rejection handler`. - * @since v13.4.0, v12.16.0 - */ - static readonly captureRejectionSymbol: unique symbol; - /** - * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) - * - * Change the default `captureRejections` option on all new `EventEmitter` objects. - * @since v13.4.0, v12.16.0 - */ - static captureRejections: boolean; - /** - * By default, a maximum of `10` listeners can be registered for any single - * event. This limit can be changed for individual `EventEmitter` instances - * using the `emitter.setMaxListeners(n)` method. To change the default - * for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown. - * - * Take caution when setting the `events.defaultMaxListeners` because the - * change affects _all_`EventEmitter` instances, including those created before - * the change is made. However, calling `emitter.setMaxListeners(n)` still has - * precedence over `events.defaultMaxListeners`. - * - * This is not a hard limit. The `EventEmitter` instance will allow - * more listeners to be added but will output a trace warning to stderr indicating - * that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to - * temporarily avoid this warning: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.setMaxListeners(emitter.getMaxListeners() + 1); - * emitter.once('event', () => { - * // do stuff - * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); - * }); - * ``` - * - * The `--trace-warnings` command-line flag can be used to display the - * stack trace for such warnings. - * - * The emitted warning can be inspected with `process.on('warning')` and will - * have the additional `emitter`, `type`, and `count` properties, referring to - * the event emitter instance, the event's name and the number of attached - * listeners, respectively. - * Its `name` property is set to `'MaxListenersExceededWarning'`. - * @since v0.11.2 - */ - static defaultMaxListeners: number; - } - import internal = require("node:events"); - namespace EventEmitter { - // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 - export { internal as EventEmitter }; - export interface Abortable { - /** - * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. - */ - signal?: AbortSignal | undefined; - } - - export interface EventEmitterReferencingAsyncResource extends AsyncResource { - readonly eventEmitter: EventEmitterAsyncResource; - } - - export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions { - /** - * The type of async event, this is required when instantiating `EventEmitterAsyncResource` - * directly rather than as a child class. - * @default new.target.name if instantiated as a child class. - */ - name?: string; - } - - /** - * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that - * require manual async tracking. Specifically, all events emitted by instances - * of `events.EventEmitterAsyncResource` will run within its `async context`. - * - * ```js - * import { EventEmitterAsyncResource, EventEmitter } from 'node:events'; - * import { notStrictEqual, strictEqual } from 'node:assert'; - * import { executionAsyncId, triggerAsyncId } from 'node:async_hooks'; - * - * // Async tracking tooling will identify this as 'Q'. - * const ee1 = new EventEmitterAsyncResource({ name: 'Q' }); - * - * // 'foo' listeners will run in the EventEmitters async context. - * ee1.on('foo', () => { - * strictEqual(executionAsyncId(), ee1.asyncId); - * strictEqual(triggerAsyncId(), ee1.triggerAsyncId); - * }); - * - * const ee2 = new EventEmitter(); - * - * // 'foo' listeners on ordinary EventEmitters that do not track async - * // context, however, run in the same async context as the emit(). - * ee2.on('foo', () => { - * notStrictEqual(executionAsyncId(), ee2.asyncId); - * notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId); - * }); - * - * Promise.resolve().then(() => { - * ee1.emit('foo'); - * ee2.emit('foo'); - * }); - * ``` - * - * The `EventEmitterAsyncResource` class has the same methods and takes the - * same options as `EventEmitter` and `AsyncResource` themselves. - * @since v17.4.0, v16.14.0 - */ - export class EventEmitterAsyncResource extends EventEmitter { - /** - * @param options Only optional in child class. - */ - constructor(options?: EventEmitterAsyncResourceOptions); - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - */ - emitDestroy(): void; - /** - * The unique `asyncId` assigned to the resource. - */ - readonly asyncId: number; - /** - * The same triggerAsyncId that is passed to the AsyncResource constructor. - */ - readonly triggerAsyncId: number; - /** - * The returned `AsyncResource` object has an additional `eventEmitter` property - * that provides a reference to this `EventEmitterAsyncResource`. - */ - readonly asyncResource: EventEmitterReferencingAsyncResource; - } - } - global { - namespace NodeJS { - interface EventEmitter { - [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void; - /** - * Alias for `emitter.on(eventName, listener)`. - * @since v0.1.26 - */ - addListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds the `listener` function to the end of the listeners array for the - * event named `eventName`. No checks are made to see if the `listener` has - * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple - * times. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.on('foo', () => console.log('a')); - * myEE.prependListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.1.101 - * @param eventName The name of the event. - * @param listener The callback function - */ - on(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds a **one-time**`listener` function for the event named `eventName`. The - * next time `eventName` is triggered, this listener is removed and then invoked. - * - * ```js - * server.once('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.once('foo', () => console.log('a')); - * myEE.prependOnceListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.3.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - once(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Removes the specified `listener` from the listener array for the event named`eventName`. - * - * ```js - * const callback = (stream) => { - * console.log('someone connected!'); - * }; - * server.on('connection', callback); - * // ... - * server.removeListener('connection', callback); - * ``` - * - * `removeListener()` will remove, at most, one instance of a listener from the - * listener array. If any single listener has been added multiple times to the - * listener array for the specified `eventName`, then `removeListener()` must be - * called multiple times to remove each instance. - * - * Once an event is emitted, all listeners attached to it at the - * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution - * will not remove them from`emit()` in progress. Subsequent events behave as expected. - * - * ```js - * import { EventEmitter } from 'node:events'; - * class MyEmitter extends EventEmitter {} - * const myEmitter = new MyEmitter(); - * - * const callbackA = () => { - * console.log('A'); - * myEmitter.removeListener('event', callbackB); - * }; - * - * const callbackB = () => { - * console.log('B'); - * }; - * - * myEmitter.on('event', callbackA); - * - * myEmitter.on('event', callbackB); - * - * // callbackA removes listener callbackB but it will still be called. - * // Internal listener array at time of emit [callbackA, callbackB] - * myEmitter.emit('event'); - * // Prints: - * // A - * // B - * - * // callbackB is now removed. - * // Internal listener array [callbackA] - * myEmitter.emit('event'); - * // Prints: - * // A - * ``` - * - * Because listeners are managed using an internal array, calling this will - * change the position indices of any listener registered _after_ the listener - * being removed. This will not impact the order in which listeners are called, - * but it means that any copies of the listener array as returned by - * the `emitter.listeners()` method will need to be recreated. - * - * When a single function has been added as a handler multiple times for a single - * event (as in the example below), `removeListener()` will remove the most - * recently added instance. In the example the `once('ping')`listener is removed: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const ee = new EventEmitter(); - * - * function pong() { - * console.log('pong'); - * } - * - * ee.on('ping', pong); - * ee.once('ping', pong); - * ee.removeListener('ping', pong); - * - * ee.emit('ping'); - * ee.emit('ping'); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Alias for `emitter.removeListener()`. - * @since v10.0.0 - */ - off(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Removes all listeners, or those of the specified `eventName`. - * - * It is bad practice to remove listeners added elsewhere in the code, - * particularly when the `EventEmitter` instance was created by some other - * component or module (e.g. sockets or file streams). - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeAllListeners(event?: string | symbol): this; - /** - * By default `EventEmitter`s will print a warning if more than `10` listeners are - * added for a particular event. This is a useful default that helps finding - * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be - * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.3.5 - */ - setMaxListeners(n: number): this; - /** - * Returns the current max listener value for the `EventEmitter` which is either - * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}. - * @since v1.0.0 - */ - getMaxListeners(): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * console.log(util.inspect(server.listeners('connection'))); - * // Prints: [ [Function] ] - * ``` - * @since v0.1.26 - */ - listeners(eventName: string | symbol): Function[]; - /** - * Returns a copy of the array of listeners for the event named `eventName`, - * including any wrappers (such as those created by `.once()`). - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.once('log', () => console.log('log once')); - * - * // Returns a new Array with a function `onceWrapper` which has a property - * // `listener` which contains the original listener bound above - * const listeners = emitter.rawListeners('log'); - * const logFnWrapper = listeners[0]; - * - * // Logs "log once" to the console and does not unbind the `once` event - * logFnWrapper.listener(); - * - * // Logs "log once" to the console and removes the listener - * logFnWrapper(); - * - * emitter.on('log', () => console.log('log persistently')); - * // Will return a new Array with a single function bound by `.on()` above - * const newListeners = emitter.rawListeners('log'); - * - * // Logs "log persistently" twice - * newListeners[0](); - * emitter.emit('log'); - * ``` - * @since v9.4.0 - */ - rawListeners(eventName: string | symbol): Function[]; - /** - * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments - * to each. - * - * Returns `true` if the event had listeners, `false` otherwise. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEmitter = new EventEmitter(); - * - * // First listener - * myEmitter.on('event', function firstListener() { - * console.log('Helloooo! first listener'); - * }); - * // Second listener - * myEmitter.on('event', function secondListener(arg1, arg2) { - * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); - * }); - * // Third listener - * myEmitter.on('event', function thirdListener(...args) { - * const parameters = args.join(', '); - * console.log(`event with parameters ${parameters} in third listener`); - * }); - * - * console.log(myEmitter.listeners('event')); - * - * myEmitter.emit('event', 1, 2, 3, 4, 5); - * - * // Prints: - * // [ - * // [Function: firstListener], - * // [Function: secondListener], - * // [Function: thirdListener] - * // ] - * // Helloooo! first listener - * // event with parameters 1, 2 in second listener - * // event with parameters 1, 2, 3, 4, 5 in third listener - * ``` - * @since v0.1.26 - */ - emit(eventName: string | symbol, ...args: any[]): boolean; - /** - * Returns the number of listeners listening for the event named `eventName`. - * If `listener` is provided, it will return how many times the listener is found - * in the list of the listeners of the event. - * @since v3.2.0 - * @param eventName The name of the event being listened for - * @param listener The event handler function - */ - listenerCount(eventName: string | symbol, listener?: Function): number; - /** - * Adds the `listener` function to the _beginning_ of the listeners array for the - * event named `eventName`. No checks are made to see if the `listener` has - * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple - * times. - * - * ```js - * server.prependListener('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this - * listener is removed, and then invoked. - * - * ```js - * server.prependOnceListener('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Returns an array listing the events for which the emitter has registered - * listeners. The values in the array are strings or `Symbol`s. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * const myEE = new EventEmitter(); - * myEE.on('foo', () => {}); - * myEE.on('bar', () => {}); - * - * const sym = Symbol('symbol'); - * myEE.on(sym, () => {}); - * - * console.log(myEE.eventNames()); - * // Prints: [ 'foo', 'bar', Symbol(symbol) ] - * ``` - * @since v6.0.0 - */ - eventNames(): Array; - } - } - } - export = EventEmitter; -} -declare module "node:events" { - import events = require("events"); - export = events; -} diff --git a/reverse_engineering/node_modules/@types/node/fs.d.ts b/reverse_engineering/node_modules/@types/node/fs.d.ts deleted file mode 100644 index f98453a5..00000000 --- a/reverse_engineering/node_modules/@types/node/fs.d.ts +++ /dev/null @@ -1,4291 +0,0 @@ -/** - * The `node:fs` module enables interacting with the file system in a - * way modeled on standard POSIX functions. - * - * To use the promise-based APIs: - * - * ```js - * import * as fs from 'node:fs/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as fs from 'node:fs'; - * ``` - * - * All file system operations have synchronous, callback, and promise-based - * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/fs.js) - */ -declare module "fs" { - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import { URL } from "node:url"; - import * as promises from "node:fs/promises"; - export { promises }; - /** - * Valid types for path values in "fs". - */ - export type PathLike = string | Buffer | URL; - export type PathOrFileDescriptor = PathLike | number; - export type TimeLike = string | number | Date; - export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - export type BufferEncodingOption = - | "buffer" - | { - encoding: "buffer"; - }; - export interface ObjectEncodingOptions { - encoding?: BufferEncoding | null | undefined; - } - export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; - export type OpenMode = number | string; - export type Mode = number | string; - export interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - export interface Stats extends StatsBase {} - /** - * A `fs.Stats` object provides information about a file. - * - * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and - * their synchronous counterparts are of this type. - * If `bigint` in the `options` passed to those methods is true, the numeric values - * will be `bigint` instead of `number`, and the object will contain additional - * nanosecond-precision properties suffixed with `Ns`. - * - * ```console - * Stats { - * dev: 2114, - * ino: 48064969, - * mode: 33188, - * nlink: 1, - * uid: 85, - * gid: 100, - * rdev: 0, - * size: 527, - * blksize: 4096, - * blocks: 8, - * atimeMs: 1318289051000.1, - * mtimeMs: 1318289051000.1, - * ctimeMs: 1318289051000.1, - * birthtimeMs: 1318289051000.1, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * - * `bigint` version: - * - * ```console - * BigIntStats { - * dev: 2114n, - * ino: 48064969n, - * mode: 33188n, - * nlink: 1n, - * uid: 85n, - * gid: 100n, - * rdev: 0n, - * size: 527n, - * blksize: 4096n, - * blocks: 8n, - * atimeMs: 1318289051000n, - * mtimeMs: 1318289051000n, - * ctimeMs: 1318289051000n, - * birthtimeMs: 1318289051000n, - * atimeNs: 1318289051000000000n, - * mtimeNs: 1318289051000000000n, - * ctimeNs: 1318289051000000000n, - * birthtimeNs: 1318289051000000000n, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * @since v0.1.21 - */ - export class Stats {} - export interface StatsFsBase { - /** Type of file system. */ - type: T; - /** Optimal transfer block size. */ - bsize: T; - /** Total data blocks in file system. */ - blocks: T; - /** Free blocks in file system. */ - bfree: T; - /** Available blocks for unprivileged users */ - bavail: T; - /** Total file nodes in file system. */ - files: T; - /** Free file nodes in file system. */ - ffree: T; - } - export interface StatsFs extends StatsFsBase {} - /** - * Provides information about a mounted file system. - * - * Objects returned from {@link statfs} and its synchronous counterpart are of - * this type. If `bigint` in the `options` passed to those methods is `true`, the - * numeric values will be `bigint` instead of `number`. - * - * ```console - * StatFs { - * type: 1397114950, - * bsize: 4096, - * blocks: 121938943, - * bfree: 61058895, - * bavail: 61058895, - * files: 999, - * ffree: 1000000 - * } - * ``` - * - * `bigint` version: - * - * ```console - * StatFs { - * type: 1397114950n, - * bsize: 4096n, - * blocks: 121938943n, - * bfree: 61058895n, - * bavail: 61058895n, - * files: 999n, - * ffree: 1000000n - * } - * ``` - * @since v19.6.0, v18.15.0 - */ - export class StatsFs {} - export interface BigIntStatsFs extends StatsFsBase {} - export interface StatFsOptions { - bigint?: boolean | undefined; - } - /** - * A representation of a directory entry, which can be a file or a subdirectory - * within the directory, as returned by reading from an `fs.Dir`. The - * directory entry is a combination of the file name and file type pairs. - * - * Additionally, when {@link readdir} or {@link readdirSync} is called with - * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. - * @since v10.10.0 - */ - export class Dirent { - /** - * Returns `true` if the `fs.Dirent` object describes a regular file. - * @since v10.10.0 - */ - isFile(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a file system - * directory. - * @since v10.10.0 - */ - isDirectory(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a block device. - * @since v10.10.0 - */ - isBlockDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a character device. - * @since v10.10.0 - */ - isCharacterDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a symbolic link. - * @since v10.10.0 - */ - isSymbolicLink(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a first-in-first-out - * (FIFO) pipe. - * @since v10.10.0 - */ - isFIFO(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a socket. - * @since v10.10.0 - */ - isSocket(): boolean; - /** - * The file name that this `fs.Dirent` object refers to. The type of this - * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. - * @since v10.10.0 - */ - name: string; - /** - * The base path that this `fs.Dirent` object refers to. - * @since v20.1.0 - */ - path: string; - } - /** - * A class representing a directory stream. - * - * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - */ - export class Dir implements AsyncIterable { - /** - * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. - * @since v12.12.0 - */ - readonly path: string; - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): AsyncIterableIterator; - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * - * A promise is returned that will be resolved after the resource has been - * closed. - * @since v12.12.0 - */ - close(): Promise; - close(cb: NoParamCallback): void; - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * @since v12.12.0 - */ - closeSync(): void; - /** - * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. - * - * A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - * @return containing {fs.Dirent|null} - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - /** - * Synchronously read the next directory entry as an `fs.Dirent`. See the - * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. - * - * If there are no more directory entries to read, `null` will be returned. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - */ - readSync(): Dirent | null; - } - /** - * Class: fs.StatWatcher - * @since v14.3.0, v12.20.0 - * Extends `EventEmitter` - * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. - */ - export interface StatWatcher extends EventEmitter { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have - * no effect. - * - * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally - * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been - * called previously. - * @since v14.3.0, v12.20.0 - */ - ref(): this; - /** - * When called, the active `fs.StatWatcher` object will not require the Node.js - * event loop to remain active. If there is no other activity keeping the - * event loop running, the process may exit before the `fs.StatWatcher` object's - * callback is invoked. Calling `watcher.unref()` multiple times will have - * no effect. - * @since v14.3.0, v12.20.0 - */ - unref(): this; - } - export interface FSWatcher extends EventEmitter { - /** - * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. - * @since v0.5.8 - */ - close(): void; - /** - * events.EventEmitter - * 1. change - * 2. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "close", listener: () => void): this; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "close", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "close", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "close", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - /** - * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. - * @since v0.1.93 - */ - export class ReadStream extends stream.Readable { - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes that have been read so far. - * @since v6.4.0 - */ - bytesRead: number; - /** - * The path to the file the stream is reading from as specified in the first - * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a - * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0, v10.16.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "ready", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "ready", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * * Extends `stream.Writable` - * - * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. - * @since v0.1.93 - */ - export class WriteStream extends stream.Writable { - /** - * Closes `writeStream`. Optionally accepts a - * callback that will be executed once the `writeStream`is closed. - * @since v0.9.4 - */ - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes written so far. Does not include data that is still queued - * for writing. - * @since v0.4.7 - */ - bytesWritten: number; - /** - * The path to the file the stream is writing to as specified in the first - * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a - * `Buffer`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "ready", listener: () => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "ready", listener: () => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * Asynchronously rename file at `oldPath` to the pathname provided - * as `newPath`. In the case that `newPath` already exists, it will - * be overwritten. If there is a directory at `newPath`, an error will - * be raised instead. No arguments other than a possible exception are - * given to the completion callback. - * - * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). - * - * ```js - * import { rename } from 'node:fs'; - * - * rename('oldFile.txt', 'newFile.txt', (err) => { - * if (err) throw err; - * console.log('Rename complete!'); - * }); - * ``` - * @since v0.0.2 - */ - export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - /** - * Renames the file from `oldPath` to `newPath`. Returns `undefined`. - * - * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. - * @since v0.1.21 - */ - export function renameSync(oldPath: PathLike, newPath: PathLike): void; - /** - * Truncates the file. No arguments other than a possible exception are - * given to the completion callback. A file descriptor can also be passed as the - * first argument. In this case, `fs.ftruncate()` is called. - * - * ```js - * import { truncate } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * truncate('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was truncated'); - * }); - * ``` - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * - * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. - * @since v0.8.6 - * @param [len=0] - */ - export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function truncate(path: PathLike, callback: NoParamCallback): void; - export namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number | null): Promise; - } - /** - * Truncates the file. Returns `undefined`. A file descriptor can also be - * passed as the first argument. In this case, `fs.ftruncateSync()` is called. - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * @since v0.8.6 - * @param [len=0] - */ - export function truncateSync(path: PathLike, len?: number | null): void; - /** - * Truncates the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. - * - * If the file referred to by the file descriptor was larger than `len` bytes, only - * the first `len` bytes will be retained in the file. - * - * For example, the following program retains only the first four bytes of the - * file: - * - * ```js - * import { open, close, ftruncate } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('temp.txt', 'r+', (err, fd) => { - * if (err) throw err; - * - * try { - * ftruncate(fd, 4, (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * if (err) throw err; - * } - * }); - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - export function ftruncate(fd: number, callback: NoParamCallback): void; - export namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number | null): Promise; - } - /** - * Truncates the file descriptor. Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link ftruncate}. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncateSync(fd: number, len?: number | null): void; - /** - * Asynchronously changes owner and group of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Synchronously changes owner and group of a file. Returns `undefined`. - * This is the synchronous version of {@link chown}. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chownSync(path: PathLike, uid: number, gid: number): void; - /** - * Sets the owner of the file. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - export namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - /** - * Sets the owner of the file. Returns `undefined`. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function fchownSync(fd: number, uid: number, gid: number): void; - /** - * Set the owner of the symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. - */ - export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Set the owner for the path. Returns `undefined`. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function lchownSync(path: PathLike, uid: number, gid: number): void; - /** - * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic - * link, then the link is not dereferenced: instead, the timestamps of the - * symbolic link itself are changed. - * - * No arguments other than a possible exception are given to the completion - * callback. - * @since v14.5.0, v12.19.0 - */ - export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace lutimes { - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Change the file system timestamps of the symbolic link referenced by `path`. - * Returns `undefined`, or throws an exception when parameters are incorrect or - * the operation fails. This is the synchronous version of {@link lutimes}. - * @since v14.5.0, v12.19.0 - */ - export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Asynchronously changes the permissions of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * - * ```js - * import { chmod } from 'node:fs'; - * - * chmod('my_file.txt', 0o775, (err) => { - * if (err) throw err; - * console.log('The permissions for file "my_file.txt" have been changed!'); - * }); - * ``` - * @since v0.1.30 - */ - export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - export namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link chmod}. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * @since v0.6.7 - */ - export function chmodSync(path: PathLike, mode: Mode): void; - /** - * Sets the permissions on the file. No arguments other than a possible exception - * are given to the completion callback. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; - export namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: Mode): Promise; - } - /** - * Sets the permissions on the file. Returns `undefined`. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmodSync(fd: number, mode: Mode): void; - /** - * Changes the permissions on a symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - /** @deprecated */ - export namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * Changes the permissions on a symbolic link. Returns `undefined`. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmodSync(path: PathLike, mode: Mode): void; - /** - * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * - * {@link stat} follows symbolic links. Use {@link lstat} to look at the - * links themselves. - * - * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. - * Instead, user code should open/read/write the file directly and handle the - * error raised if the file is not available. - * - * To check if a file exists without manipulating it afterwards, {@link access} is recommended. - * - * For example, given the following directory structure: - * - * ```text - * - txtDir - * -- file.txt - * - app.js - * ``` - * - * The next program will check for the stats of the given paths: - * - * ```js - * import { stat } from 'node:fs'; - * - * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; - * - * for (let i = 0; i < pathsToCheck.length; i++) { - * stat(pathsToCheck[i], (err, stats) => { - * console.log(stats.isDirectory()); - * console.log(stats); - * }); - * } - * ``` - * - * The resulting output will resemble: - * - * ```console - * true - * Stats { - * dev: 16777220, - * mode: 16877, - * nlink: 3, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214262, - * size: 96, - * blocks: 0, - * atimeMs: 1561174653071.963, - * mtimeMs: 1561174614583.3518, - * ctimeMs: 1561174626623.5366, - * birthtimeMs: 1561174126937.2893, - * atime: 2019-06-22T03:37:33.072Z, - * mtime: 2019-06-22T03:36:54.583Z, - * ctime: 2019-06-22T03:37:06.624Z, - * birthtime: 2019-06-22T03:28:46.937Z - * } - * false - * Stats { - * dev: 16777220, - * mode: 33188, - * nlink: 1, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214074, - * size: 8, - * blocks: 8, - * atimeMs: 1561174616618.8555, - * mtimeMs: 1561174614584, - * ctimeMs: 1561174614583.8145, - * birthtimeMs: 1561174007710.7478, - * atime: 2019-06-22T03:36:56.619Z, - * mtime: 2019-06-22T03:36:54.584Z, - * ctime: 2019-06-22T03:36:54.584Z, - * birthtime: 2019-06-22T03:26:47.711Z - * } - * ``` - * @since v0.0.2 - */ - export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function stat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - export interface StatSyncFn extends Function { - (path: PathLike, options?: undefined): Stats; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - throwIfNoEntry: false; - }, - ): Stats | undefined; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - throwIfNoEntry: false; - }, - ): BigIntStats | undefined; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - }, - ): Stats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - }, - ): BigIntStats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: boolean; - throwIfNoEntry?: false | undefined; - }, - ): Stats | BigIntStats; - (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; - } - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const statSync: StatSyncFn; - /** - * Invokes the callback with the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function fstat( - fd: number, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(fd: number, options?: StatOptions): Promise; - } - /** - * Retrieves the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstatSync( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Stats; - export function fstatSync( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): BigIntStats; - export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; - /** - * Retrieves the `fs.Stats` for the symbolic link referred to by the path. - * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic - * link, then the link itself is stat-ed, not the file that it refers to. - * - * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. - * @since v0.1.30 - */ - export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function lstat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - /** - * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; - export function statfs( - path: PathLike, - options: - | (StatFsOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void, - ): void; - export namespace statfs { - /** - * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. - * @param path A path to an existing file or directory on the file system to be queried. - */ - function __promisify__( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatFsOptions): Promise; - } - /** - * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfsSync( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): StatsFs; - export function statfsSync( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): BigIntStatsFs; - export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const lstatSync: StatSyncFn; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than - * a possible - * exception are given to the completion callback. - * @since v0.1.31 - */ - export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.31 - */ - export function linkSync(existingPath: PathLike, newPath: PathLike): void; - /** - * Creates the link called `path` pointing to `target`. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. - * - * The `type` argument is only available on Windows and ignored on other platforms. - * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is - * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. - * If the `target` does not exist, `'file'` will be used. Windows junction points - * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction - * points on NTFS volumes can only point to directories. - * - * Relative targets are relative to the link's parent directory. - * - * ```js - * import { symlink } from 'node:fs'; - * - * symlink('./mew', './mewtwo', callback); - * ``` - * - * The above example creates a symbolic link `mewtwo` which points to `mew` in the - * same directory: - * - * ```bash - * $ tree . - * . - * ├── mew - * └── mewtwo -> ./mew - * ``` - * @since v0.1.31 - * @param [type='null'] - */ - export function symlink( - target: PathLike, - path: PathLike, - type: symlink.Type | undefined | null, - callback: NoParamCallback, - ): void; - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - export namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - type Type = "dir" | "file" | "junction"; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link symlink}. - * @since v0.1.31 - * @param [type='null'] - */ - export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - /** - * Reads the contents of the symbolic link referred to by `path`. The callback gets - * two arguments `(err, linkString)`. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path passed to the callback. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readlink( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - export namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - } - /** - * Returns the symbolic link's string value. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; - /** - * Asynchronously computes the canonical pathname by resolving `.`, `..`, and - * symbolic links. - * - * A canonical pathname is not necessarily unique. Hard links and bind mounts can - * expose a file system entity through many pathnames. - * - * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: - * - * 1. No case conversion is performed on case-insensitive file systems. - * 2. The maximum number of symbolic links is platform-independent and generally - * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. - * - * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * If `path` resolves to a socket or a pipe, the function will return a system - * dependent name for that object. - * @since v0.1.31 - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function realpath( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - export namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). - * - * The `callback` gets two arguments `(err, resolvedPath)`. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v9.2.0 - */ - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - function native( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, - ): void; - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, - ): void; - function native( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - } - /** - * Returns the resolved pathname. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link realpath}. - * @since v0.1.31 - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; - export namespace realpathSync { - function native(path: PathLike, options?: EncodingOption): string; - function native(path: PathLike, options: BufferEncodingOption): Buffer; - function native(path: PathLike, options?: EncodingOption): string | Buffer; - } - /** - * Asynchronously removes a file or symbolic link. No arguments other than a - * possible exception are given to the completion callback. - * - * ```js - * import { unlink } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * unlink('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was deleted'); - * }); - * ``` - * - * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a - * directory, use {@link rmdir}. - * - * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. - * @since v0.0.2 - */ - export function unlink(path: PathLike, callback: NoParamCallback): void; - export namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. - * @since v0.1.21 - */ - export function unlinkSync(path: PathLike): void; - export interface RmDirOptions { - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning - * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. - * Use `fs.rm(path, { recursive: true, force: true })` instead. - * - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given - * to the completion callback. - * - * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on - * Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. - * @since v0.0.2 - */ - export function rmdir(path: PathLike, callback: NoParamCallback): void; - export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - export namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - /** - * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. - * - * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error - * on Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. - * @since v0.1.21 - */ - export function rmdirSync(path: PathLike, options?: RmDirOptions): void; - export interface RmOptions { - /** - * When `true`, exceptions will be ignored if `path` does not exist. - * @default false - */ - force?: boolean | undefined; - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the - * completion callback. - * @since v14.14.0 - */ - export function rm(path: PathLike, callback: NoParamCallback): void; - export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; - export namespace rm { - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - function __promisify__(path: PathLike, options?: RmOptions): Promise; - } - /** - * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. - * @since v14.14.0 - */ - export function rmSync(path: PathLike, options?: RmOptions): void; - export interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * If a folder was created, the path to the first created folder will be returned. - * @default false - */ - recursive?: boolean | undefined; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777 - */ - mode?: Mode | undefined; - } - /** - * Asynchronously creates a directory. - * - * The callback is given a possible exception and, if `recursive` is `true`, the - * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was - * created (for instance, if it was previously created). - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that - * exists results in an error only - * when `recursive` is false. If `recursive` is false and the directory exists, - * an `EEXIST` error occurs. - * - * ```js - * import { mkdir } from 'node:fs'; - * - * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. - * mkdir('./tmp/a/apple', { recursive: true }, (err) => { - * if (err) throw err; - * }); - * ``` - * - * On Windows, using `fs.mkdir()` on the root directory even with recursion will - * result in an error: - * - * ```js - * import { mkdir } from 'node:fs'; - * - * mkdir('/', { recursive: true }, (err) => { - * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] - * }); - * ``` - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.8 - */ - export function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null - | undefined, - callback: NoParamCallback, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: Mode | MakeDirectoryOptions | null | undefined, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function mkdir(path: PathLike, callback: NoParamCallback): void; - export namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: Mode | MakeDirectoryOptions | null, - ): Promise; - } - /** - * Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created. - * This is the synchronous version of {@link mkdir}. - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.21 - */ - export function mkdirSync( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): string | undefined; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): void; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; - /** - * Creates a unique temporary directory. - * - * Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform - * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, - * notably the BSDs, can return more than six random characters, and replace - * trailing `X` characters in `prefix` with random characters. - * - * The created directory path is passed as a string to the callback's second - * parameter. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 - * }); - * ``` - * - * The `fs.mkdtemp()` method will append the six randomly selected characters - * directly to the `prefix` string. For instance, given a directory `/tmp`, if the - * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator - * (`require('node:path').sep`). - * - * ```js - * import { tmpdir } from 'node:os'; - * import { mkdtemp } from 'node:fs'; - * - * // The parent directory for the new temporary directory - * const tmpDir = tmpdir(); - * - * // This method is *INCORRECT*: - * mkdtemp(tmpDir, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmpabc123`. - * // A new temporary directory is created at the file system root - * // rather than *within* the /tmp directory. - * }); - * - * // This method is *CORRECT*: - * import { sep } from 'node:path'; - * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmp/abc123`. - * // A new temporary directory is created within - * // the /tmp directory. - * }); - * ``` - * @since v5.10.0 - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: - | "buffer" - | { - encoding: "buffer"; - }, - callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - export function mkdtemp( - prefix: string, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - export namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - } - /** - * Returns the created directory path. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link mkdtemp}. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * @since v5.10.0 - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; - /** - * Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. - * @since v0.1.8 - */ - export function readdir( - path: PathLike, - options: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readdir( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, - ): void; - export namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options: - | "buffer" - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - } - /** - * Reads the contents of the directory. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames returned. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. - * @since v0.1.21 - */ - export function readdirSync( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): string[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): Buffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): string[] | Buffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdirSync( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Dirent[]; - /** - * Closes the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.0.2 - */ - export function close(fd: number, callback?: NoParamCallback): void; - export namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Closes the file descriptor. Returns `undefined`. - * - * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.1.21 - */ - export function closeSync(fd: number): void; - /** - * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. - * - * `mode` sets the file mode (permission and sticky bits), but only if the file was - * created. On Windows, only the write permission can be manipulated; see {@link chmod}. - * - * The callback gets two arguments `(err, fd)`. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * - * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. - * @since v0.0.2 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - mode: Mode | undefined | null, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param [flags='r'] See `support of file system `flags``. - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - export namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; - } - /** - * Returns an integer representing the file descriptor. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link open}. - * @since v0.1.21 - * @param [flags='r'] - * @param [mode=0o666] - */ - export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time in seconds,`Date`s, or a numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. - * @since v0.4.2 - */ - export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link utimes}. - * @since v0.4.2 - */ - export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Change the file system timestamps of the object referenced by the supplied file - * descriptor. See {@link utimes}. - * @since v0.4.2 - */ - export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Synchronous version of {@link futimes}. Returns `undefined`. - * @since v0.4.2 - */ - export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other - * than a possible exception are given to the completion callback. - * @since v0.1.96 - */ - export function fsync(fd: number, callback: NoParamCallback): void; - export namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.96 - */ - export function fsyncSync(fd: number): void; - /** - * Write `buffer` to the file specified by `fd`. - * - * `offset` determines the part of the buffer to be written, and `length` is - * an integer specifying the number of bytes to write. - * - * `position` refers to the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). - * - * The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesWritten` and `buffer` properties. - * - * It is unsafe to use `fs.write()` multiple times on the same file without waiting - * for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v0.0.2 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - export function write( - fd: number, - buffer: TBuffer, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - encoding: BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - */ - export function write( - fd: number, - string: string, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - export namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link write}. - * @since v0.1.21 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - * @return The number of bytes written. - */ - export function writeSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset?: number | null, - length?: number | null, - position?: number | null, - ): number; - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function writeSync( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): number; - export type ReadPosition = number | bigint; - export interface ReadSyncOptions { - /** - * @default 0 - */ - offset?: number | undefined; - /** - * @default `length of buffer` - */ - length?: number | undefined; - /** - * @default null - */ - position?: ReadPosition | null | undefined; - } - export interface ReadAsyncOptions extends ReadSyncOptions { - buffer?: TBuffer; - } - /** - * Read data from the file specified by `fd`. - * - * The callback is given the three arguments, `(err, bytesRead, buffer)`. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffer` properties. - * @since v0.0.2 - * @param buffer The buffer that the data will be written to. - * @param offset The position in `buffer` to write the data to. - * @param length The number of bytes to read. - * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If - * `position` is an integer, the file position will be unchanged. - */ - export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: ReadPosition | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - /** - * Similar to the above `fs.read` function, this version takes an optional `options` object. - * If not otherwise specified in an `options` object, - * `buffer` defaults to `Buffer.alloc(16384)`, - * `offset` defaults to `0`, - * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 - * `position` defaults to `null` - * @since v12.17.0, 13.11.0 - */ - export function read( - fd: number, - options: ReadAsyncOptions, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - export function read( - fd: number, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void, - ): void; - export namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__( - fd: number, - options: ReadAsyncOptions, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__(fd: number): Promise<{ - bytesRead: number; - buffer: NodeJS.ArrayBufferView; - }>; - } - /** - * Returns the number of `bytesRead`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link read}. - * @since v0.1.21 - * @param [position='null'] - */ - export function readSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset: number, - length: number, - position: ReadPosition | null, - ): number; - /** - * Similar to the above `fs.readSync` function, this version takes an optional `options` object. - * If no `options` object is specified, it will default with the above values. - */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; - /** - * Asynchronously reads the entire contents of a file. - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', (err, data) => { - * if (err) throw err; - * console.log(data); - * }); - * ``` - * - * The callback is passed two arguments `(err, data)`, where `data` is the - * contents of the file. - * - * If no encoding is specified, then the raw buffer is returned. - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', 'utf8', callback); - * ``` - * - * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an - * error will be returned. On FreeBSD, a representation of the directory's contents - * will be returned. - * - * ```js - * import { readFile } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFile('', (err, data) => { - * // => [Error: EISDIR: illegal operation on a directory, read ] - * }); - * - * // FreeBSD - * readFile('', (err, data) => { - * // => null, - * }); - * ``` - * - * It is possible to abort an ongoing request using an `AbortSignal`. If a - * request is aborted the callback is called with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs'; - * - * const controller = new AbortController(); - * const signal = controller.signal; - * readFile(fileInfo[0].name, { signal }, (err, buf) => { - * // ... - * }); - * // When you want to abort the request - * controller.abort(); - * ``` - * - * The `fs.readFile()` function buffers the entire file. To minimize memory costs, - * when possible prefer streaming via `fs.createReadStream()`. - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * @since v0.1.29 - * @param path filename or file descriptor - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding?: null | undefined; - flag?: string | undefined; - } & Abortable) - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding: BufferEncoding; - flag?: string | undefined; - } & Abortable) - | BufferEncoding, - callback: (err: NodeJS.ErrnoException | null, data: string) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | (ObjectEncodingOptions & { - flag?: string | undefined; - } & Abortable) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - export function readFile( - path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, - ): void; - export namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): Promise; - } - /** - * Returns the contents of the `path`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readFile}. - * - * If the `encoding` option is specified then this function returns a - * string. Otherwise it returns a buffer. - * - * Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific. - * - * ```js - * import { readFileSync } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFileSync(''); - * // => [Error: EISDIR: illegal operation on a directory, read ] - * - * // FreeBSD - * readFileSync(''); // => - * ``` - * @since v0.1.8 - * @param path filename or file descriptor - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): Buffer; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): string; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): string | Buffer; - export type WriteFileOptions = - | ( - & ObjectEncodingOptions - & Abortable - & { - mode?: Mode | undefined; - flag?: string | undefined; - flush?: boolean | undefined; - } - ) - | BufferEncoding - | null; - /** - * When `file` is a filename, asynchronously writes data to the file, replacing the - * file if it already exists. `data` can be a string or a buffer. - * - * When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using - * a file descriptor. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, (err) => { - * if (err) throw err; - * console.log('The file has been saved!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { writeFile } from 'node:fs'; - * - * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); - * ``` - * - * It is unsafe to use `fs.writeFile()` multiple times on the same file without - * waiting for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that - * performs multiple `write` calls internally to write the buffer passed to it. - * For performance sensitive code consider using {@link createWriteStream}. - * - * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, { signal }, (err) => { - * // When a request is aborted - the callback is called with an AbortError - * }); - * // When the request should be aborted - * controller.abort(); - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFile( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function writeFile( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - callback: NoParamCallback, - ): void; - export namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): Promise; - } - /** - * Returns `undefined`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writeFile}. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFileSync( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', (err) => { - * if (err) throw err; - * console.log('The "data to append" was appended to file!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', 'utf8', callback); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { open, close, appendFile } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('message.txt', 'a', (err, fd) => { - * if (err) throw err; - * - * try { - * appendFile(fd, 'data to append', 'utf8', (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * throw err; - * } - * }); - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFile( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; - export namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__( - file: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): Promise; - } - /** - * Synchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * try { - * appendFileSync('message.txt', 'data to append'); - * console.log('The "data to append" was appended to file!'); - * } catch (err) { - * // Handle the error - * } - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * appendFileSync('message.txt', 'data to append', 'utf8'); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { openSync, closeSync, appendFileSync } from 'node:fs'; - * - * let fd; - * - * try { - * fd = openSync('message.txt', 'a'); - * appendFileSync(fd, 'data to append', 'utf8'); - * } catch (err) { - * // Handle the error - * } finally { - * if (fd !== undefined) - * closeSync(fd); - * } - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFileSync( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): void; - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export interface WatchFileOptions { - bigint?: boolean | undefined; - persistent?: boolean | undefined; - interval?: number | undefined; - } - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'node:fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint?: false | undefined; - }) - | undefined, - listener: StatsListener, - ): StatWatcher; - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint: true; - }) - | undefined, - listener: BigIntStatsListener, - ): StatWatcher; - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; - /** - * Stop watching for changes on `filename`. If `listener` is specified, only that - * particular listener is removed. Otherwise, _all_ listeners are removed, - * effectively stopping watching of `filename`. - * - * Calling `fs.unwatchFile()` with a filename that is not being watched is a - * no-op, not an error. - * - * Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible. - * @since v0.1.31 - * @param listener Optional, a listener previously attached using `fs.watchFile()` - */ - export function unwatchFile(filename: PathLike, listener?: StatsListener): void; - export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; - export interface WatchOptions extends Abortable { - encoding?: BufferEncoding | "buffer" | undefined; - persistent?: boolean | undefined; - recursive?: boolean | undefined; - } - export type WatchEventType = "rename" | "change"; - export type WatchListener = (event: WatchEventType, filename: T | null) => void; - export type StatsListener = (curr: Stats, prev: Stats) => void; - export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; - /** - * Watch for changes on `filename`, where `filename` is either a file or a - * directory. - * - * The second argument is optional. If `options` is provided as a string, it - * specifies the `encoding`. Otherwise `options` should be passed as an object. - * - * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file - * which triggered the event. - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`. - * - * If a `signal` is passed, aborting the corresponding AbortController will close - * the returned `fs.FSWatcher`. - * @since v0.5.10 - * @param listener - */ - export function watch( - filename: PathLike, - options: - | (WatchOptions & { - encoding: "buffer"; - }) - | "buffer", - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options?: WatchOptions | BufferEncoding | null, - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options: WatchOptions | string, - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function watch(filename: PathLike, listener?: WatchListener): FSWatcher; - /** - * Test whether or not the given path exists by checking with the file system. - * Then call the `callback` argument with either true or false: - * - * ```js - * import { exists } from 'node:fs'; - * - * exists('/etc/passwd', (e) => { - * console.log(e ? 'it exists' : 'no passwd!'); - * }); - * ``` - * - * **The parameters for this callback are not consistent with other Node.js** - * **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback - * has only one boolean parameter. This is one reason `fs.access()` is recommended - * instead of `fs.exists()`. - * - * Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file does not exist. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { exists, open, close } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * console.error('myfile already exists'); - * } else { - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { open, close, exists } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } else { - * console.error('myfile does not exist'); - * } - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for existence and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the existence of a file only if the file won't be - * used directly, for example when its existence is a signal from another - * process. - * @since v0.0.2 - * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. - */ - export function exists(path: PathLike, callback: (exists: boolean) => void): void; - /** @deprecated */ - export namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Returns `true` if the path exists, `false` otherwise. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link exists}. - * - * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other - * Node.js callbacks. `fs.existsSync()` does not use a callback. - * - * ```js - * import { existsSync } from 'node:fs'; - * - * if (existsSync('/etc/passwd')) - * console.log('The path exists.'); - * ``` - * @since v0.1.21 - */ - export function existsSync(path: PathLike): boolean; - export namespace constants { - // File Access Constants - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - // File Copy Constants - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - // File Open Constants - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - // File Type Constants - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - // File Mode Constants - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * The final argument, `callback`, is a callback function that is invoked with - * a possible error argument. If any of the accessibility checks fail, the error - * argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable. - * - * ```js - * import { access, constants } from 'node:fs'; - * - * const file = 'package.json'; - * - * // Check if the file exists in the current directory. - * access(file, constants.F_OK, (err) => { - * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); - * }); - * - * // Check if the file is readable. - * access(file, constants.R_OK, (err) => { - * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); - * }); - * - * // Check if the file is writable. - * access(file, constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); - * }); - * - * // Check if the file is readable and writable. - * access(file, constants.R_OK | constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); - * }); - * ``` - * - * Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file is not accessible. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * - * access('myfile', (err) => { - * if (!err) { - * console.error('myfile already exists'); - * return; - * } - * - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * access('myfile', (err) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for accessibility and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the accessibility of a file only if the file will not be - * used directly, for example when its accessibility is a signal from another - * process. - * - * On Windows, access-control policies (ACLs) on a directory may limit access to - * a file or directory. The `fs.access()` function, however, does not check the - * ACL and therefore may report that a path is accessible even if the ACL restricts - * the user from reading or writing to it. - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function access(path: PathLike, callback: NoParamCallback): void; - export namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - /** - * Synchronously tests a user's permissions for the file or directory specified - * by `path`. The `mode` argument is an optional integer that specifies the - * accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and - * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, - * the method will return `undefined`. - * - * ```js - * import { accessSync, constants } from 'node:fs'; - * - * try { - * accessSync('etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can read/write'); - * } catch (err) { - * console.error('no access!'); - * } - * ``` - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function accessSync(path: PathLike, mode?: number): void; - interface StreamOptions { - flags?: string | undefined; - encoding?: BufferEncoding | undefined; - fd?: number | promises.FileHandle | undefined; - mode?: number | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - signal?: AbortSignal | null | undefined; - highWaterMark?: number | undefined; - } - interface FSImplementation { - open?: (...args: any[]) => any; - close?: (...args: any[]) => any; - } - interface CreateReadStreamFSImplementation extends FSImplementation { - read: (...args: any[]) => any; - } - interface CreateWriteStreamFSImplementation extends FSImplementation { - write: (...args: any[]) => any; - writev?: (...args: any[]) => any; - } - interface ReadStreamOptions extends StreamOptions { - fs?: CreateReadStreamFSImplementation | null | undefined; - end?: number | undefined; - } - interface WriteStreamOptions extends StreamOptions { - fs?: CreateWriteStreamFSImplementation | null | undefined; - flush?: boolean | undefined; - } - /** - * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream - * returned by this method has a default `highWaterMark` of 64 KiB. - * - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is - * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the - * current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use - * the specified file descriptor. This means that no `'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. - * - * If `fd` points to a character device that only supports blocking reads - * (such as keyboard or sound card), read operations do not finish until data is - * available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option, - * an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is - * also required. - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * // Create a stream from some character device. - * const stream = createReadStream('/dev/input/event0'); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * `mode` sets the file mode (permission and sticky bits), but only if the - * file was created. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * createReadStream('sample.txt', { start: 90, end: 99 }); - * ``` - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` option to be set to `r+` rather than the - * default `w`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev`, and `close`. Overriding `write()`without `writev()` can reduce - * performance as some optimizations (`_writev()`) - * will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override - * for `open` is also required. If `autoClose` is `true`, an override for `close`is also required. - * - * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s - * should be passed to `net.Socket`. - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other - * than a possible - * exception are given to the completion callback. - * @since v0.1.96 - */ - export function fdatasync(fd: number, callback: NoParamCallback): void; - export namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. - * @since v0.1.96 - */ - export function fdatasyncSync(fd: number): void; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. No arguments other than a possible exception are given to the - * callback function. Node.js makes no guarantees about the atomicity of the copy - * operation. If an error occurs after the destination file has been opened for - * writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFile, constants } from 'node:fs'; - * - * function callback(err) { - * if (err) throw err; - * console.log('source.txt was copied to destination.txt'); - * } - * - * // destination.txt will be created or overwritten by default. - * copyFile('source.txt', 'destination.txt', callback); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; - export namespace copyFile { - function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; - } - /** - * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. Returns `undefined`. Node.js makes no guarantees about the - * atomicity of the copy operation. If an error occurs after the destination file - * has been opened for writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFileSync, constants } from 'node:fs'; - * - * // destination.txt will be created or overwritten by default. - * copyFileSync('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; - /** - * Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`. - * - * `position` is the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. - * - * The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`. - * - * If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties. - * - * It is unsafe to use `fs.writev()` multiple times on the same file without - * waiting for the callback. For this scenario, use {@link createWriteStream}. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] - */ - export function writev( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export function writev( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export interface WriteVResult { - bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; - } - export namespace writev { - function __promisify__( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position?: number, - ): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writev}. - * @since v12.9.0 - * @param [position='null'] - * @return The number of bytes written. - */ - export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - /** - * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s - * using `readv()`. - * - * `position` is the offset from the beginning of the file from where data - * should be read. If `typeof position !== 'number'`, the data will be read - * from the current position. - * - * The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffers` properties. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - */ - export function readv( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export function readv( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export interface ReadVResult { - bytesRead: number; - buffers: NodeJS.ArrayBufferView[]; - } - export namespace readv { - function __promisify__( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position?: number, - ): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readv}. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - * @return The number of bytes read. - */ - export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - - export interface OpenAsBlobOptions { - /** - * An optional mime type for the blob. - * - * @default 'undefined' - */ - type?: string | undefined; - } - - /** - * Returns a `Blob` whose data is backed by the given file. - * - * The file must not be modified after the `Blob` is created. Any modifications - * will cause reading the `Blob` data to fail with a `DOMException` error. - * Synchronous stat operations on the file when the `Blob` is created, and before - * each read in order to detect whether the file data has been modified on disk. - * - * ```js - * import { openAsBlob } from 'node:fs'; - * - * const blob = await openAsBlob('the.file.txt'); - * const ab = await blob.arrayBuffer(); - * blob.stream(); - * ``` - * @since v19.8.0 - * @experimental - */ - export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; - - export interface OpenDirOptions { - /** - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * Number of directory entries that are buffered - * internally when reading from the directory. Higher values lead to better - * performance but higher memory usage. - * @default 32 - */ - bufferSize?: number | undefined; - /** - * @default false - */ - recursive?: boolean; - } - /** - * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; - /** - * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for - * more details. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - export function opendir( - path: PathLike, - options: OpenDirOptions, - cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void, - ): void; - export namespace opendir { - function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; - } - export interface BigIntStats extends StatsBase { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - export interface BigIntOptions { - bigint: true; - } - export interface StatOptions { - bigint?: boolean | undefined; - } - export interface StatSyncOptions extends StatOptions { - throwIfNoEntry?: boolean | undefined; - } - interface CopyOptionsBase { - /** - * Dereference symlinks - * @default false - */ - dereference?: boolean; - /** - * When `force` is `false`, and the destination - * exists, throw an error. - * @default false - */ - errorOnExist?: boolean; - /** - * Overwrite existing file or directory. _The copy - * operation will ignore errors if you set this to false and the destination - * exists. Use the `errorOnExist` option to change this behavior. - * @default true - */ - force?: boolean; - /** - * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} - */ - mode?: number; - /** - * When `true` timestamps from `src` will - * be preserved. - * @default false - */ - preserveTimestamps?: boolean; - /** - * Copy directories recursively. - * @default false - */ - recursive?: boolean; - /** - * When true, path resolution for symlinks will be skipped - * @default false - */ - verbatimSymlinks?: boolean; - } - export interface CopyOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?(source: string, destination: string): boolean | Promise; - } - export interface CopySyncOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?(source: string, destination: string): boolean; - } - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cp( - source: string | URL, - destination: string | URL, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - export function cp( - source: string | URL, - destination: string | URL, - opts: CopyOptions, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - /** - * Synchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; -} -declare module "node:fs" { - export * from "fs"; -} diff --git a/reverse_engineering/node_modules/@types/node/fs/promises.d.ts b/reverse_engineering/node_modules/@types/node/fs/promises.d.ts deleted file mode 100644 index 88a9fc33..00000000 --- a/reverse_engineering/node_modules/@types/node/fs/promises.d.ts +++ /dev/null @@ -1,1239 +0,0 @@ -/** - * The `fs/promises` API provides asynchronous file system methods that return - * promises. - * - * The promise APIs use the underlying Node.js threadpool to perform file - * system operations off the event loop thread. These operations are not - * synchronized or threadsafe. Care must be taken when performing multiple - * concurrent modifications on the same file or data corruption may occur. - * @since v10.0.0 - */ -declare module "fs/promises" { - import { Abortable } from "node:events"; - import { Stream } from "node:stream"; - import { ReadableStream } from "node:stream/web"; - import { - BigIntStats, - BigIntStatsFs, - BufferEncodingOption, - constants as fsConstants, - CopyOptions, - Dir, - Dirent, - MakeDirectoryOptions, - Mode, - ObjectEncodingOptions, - OpenDirOptions, - OpenMode, - PathLike, - ReadStream, - ReadVResult, - RmDirOptions, - RmOptions, - StatFsOptions, - StatOptions, - Stats, - StatsFs, - TimeLike, - WatchEventType, - WatchOptions, - WriteStream, - WriteVResult, - } from "node:fs"; - import { Interface as ReadlineInterface } from "node:readline"; - interface FileChangeInfo { - eventType: WatchEventType; - filename: T | null; - } - interface FlagAndOpenMode { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - } - interface FileReadResult { - bytesRead: number; - buffer: T; - } - interface FileReadOptions { - /** - * @default `Buffer.alloc(0xffff)` - */ - buffer?: T; - /** - * @default 0 - */ - offset?: number | null; - /** - * @default `buffer.byteLength` - */ - length?: number | null; - position?: number | null; - } - interface CreateReadStreamOptions { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - end?: number | undefined; - highWaterMark?: number | undefined; - } - interface CreateWriteStreamOptions { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - highWaterMark?: number | undefined; - flush?: boolean | undefined; - } - interface ReadableWebStreamOptions { - /** - * Whether to open a normal or a `'bytes'` stream. - * @since v20.0.0 - */ - type?: "bytes" | undefined; - } - // TODO: Add `EventEmitter` close - interface FileHandle { - /** - * The numeric file descriptor managed by the {FileHandle} object. - * @since v10.0.0 - */ - readonly fd: number; - /** - * Alias of `filehandle.writeFile()`. - * - * When operating on file handles, the mode cannot be changed from what it was set - * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - appendFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) - | BufferEncoding - | null, - ): Promise; - /** - * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). - * @since v10.0.0 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - * @return Fulfills with `undefined` upon success. - */ - chown(uid: number, gid: number): Promise; - /** - * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). - * @since v10.0.0 - * @param mode the file mode bit mask. - * @return Fulfills with `undefined` upon success. - */ - chmod(mode: Mode): Promise; - /** - * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream - * returned by this method has a default `highWaterMark` of 64 KiB. - * - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is - * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from - * the current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If the `FileHandle` points to a character device that only supports blocking - * reads (such as keyboard or sound card), read operations do not finish until data - * is available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('/dev/input/event0'); - * // Create a stream from some character device. - * const stream = fd.createReadStream(); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('sample.txt'); - * fd.createReadStream({ start: 90, end: 99 }); - * ``` - * @since v16.11.0 - */ - createReadStream(options?: CreateReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` `open` option to be set to `r+` rather than - * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * @since v16.11.0 - */ - createWriteStream(options?: CreateWriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. - * - * Unlike `filehandle.sync` this method does not flush modified metadata. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - datasync(): Promise; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - sync(): Promise; - /** - * Reads data from the file and stores that in the given buffer. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * @since v10.0.0 - * @param buffer A buffer that will be filled with the file data read. - * @param offset The location in the buffer at which to start filling. - * @param length The number of bytes to read. - * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an - * integer, the current file position will remain unchanged. - * @return Fulfills upon success with an object with two properties: - */ - read( - buffer: T, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise>; - read(options?: FileReadOptions): Promise>; - /** - * Returns a `ReadableStream` that may be used to read the files data. - * - * An error will be thrown if this method is called more than once or is called - * after the `FileHandle` is closed or closing. - * - * ```js - * import { - * open, - * } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const chunk of file.readableWebStream()) - * console.log(chunk); - * - * await file.close(); - * ``` - * - * While the `ReadableStream` will read the file to completion, it will not - * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. - * @since v17.0.0 - * @experimental - */ - readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; - /** - * Asynchronously reads the entire contents of a file. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support reading. - * - * If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current - * position till the end of the file. It doesn't always read from the beginning - * of the file. - * @since v10.0.0 - * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the - * data will be a string. - */ - readFile( - options?: { - encoding?: null | undefined; - flag?: OpenMode | undefined; - } | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile( - options: - | { - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile( - options?: - | (ObjectEncodingOptions & { - flag?: OpenMode | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Convenience method to create a `readline` interface and stream over the file. - * See `filehandle.createReadStream()` for the options. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const line of file.readLines()) { - * console.log(line); - * } - * ``` - * @since v18.11.0 - */ - readLines(options?: CreateReadStreamOptions): ReadlineInterface; - /** - * @since v10.0.0 - * @return Fulfills with an {fs.Stats} for the file. - */ - stat( - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - stat( - opts: StatOptions & { - bigint: true; - }, - ): Promise; - stat(opts?: StatOptions): Promise; - /** - * Truncates the file. - * - * If the file was larger than `len` bytes, only the first `len` bytes will be - * retained in the file. - * - * The following example retains only the first four bytes of the file: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle = null; - * try { - * filehandle = await open('temp.txt', 'r+'); - * await filehandle.truncate(4); - * } finally { - * await filehandle?.close(); - * } - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - truncate(len?: number): Promise; - /** - * Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success. - * @since v10.0.0 - */ - utimes(atime: TimeLike, mtime: TimeLike): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * The promise is fulfilled with no arguments upon success. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support writing. - * - * It is unsafe to use `filehandle.writeFile()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). - * - * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the - * current position till the end of the file. It doesn't always write from the - * beginning of the file. - * @since v10.0.0 - */ - writeFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined }) - | BufferEncoding - | null, - ): Promise; - /** - * Write `buffer` to the file. - * - * The promise is fulfilled with an object containing two properties: - * - * It is unsafe to use `filehandle.write()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). For this - * scenario, use `filehandle.createWriteStream()`. - * - * On Linux, positional writes do not work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v10.0.0 - * @param offset The start position from within `buffer` where the data to write begins. - * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. - * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current - * position. See the POSIX pwrite(2) documentation for more detail. - */ - write( - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - write( - data: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - /** - * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. - * - * The promise is fulfilled with an object containing a two properties: - * - * It is unsafe to call `writev()` multiple times on the same file without waiting - * for the promise to be fulfilled (or rejected). - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current - * position. - */ - writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; - /** - * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s - * @since v13.13.0, v12.17.0 - * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. - * @return Fulfills upon success an object containing two properties: - */ - readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; - /** - * Closes the file handle after waiting for any pending operation on the handle to - * complete. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle; - * try { - * filehandle = await open('thefile.txt', 'r'); - * } finally { - * await filehandle?.close(); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - close(): Promise; - /** - * An alias for {@link FileHandle.close()}. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - const constants: typeof fsConstants; - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If the accessibility check is successful, the promise is fulfilled with no - * value. If any of the accessibility checks fail, the promise is rejected - * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and - * written by the current process. - * - * ```js - * import { access, constants } from 'node:fs/promises'; - * - * try { - * await access('/etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can access'); - * } catch { - * console.error('cannot access'); - * } - * ``` - * - * Using `fsPromises.access()` to check for the accessibility of a file before - * calling `fsPromises.open()` is not recommended. Doing so introduces a race - * condition, since other processes may change the file's state between the two - * calls. Instead, user code should open/read/write the file directly and handle - * the error raised if the file is not accessible. - * @since v10.0.0 - * @param [mode=fs.constants.F_OK] - * @return Fulfills with `undefined` upon success. - */ - function access(path: PathLike, mode?: number): Promise; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. - * - * No guarantees are made about the atomicity of the copy operation. If an - * error occurs after the destination file has been opened for writing, an attempt - * will be made to remove the destination. - * - * ```js - * import { copyFile, constants } from 'node:fs/promises'; - * - * try { - * await copyFile('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * try { - * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * ``` - * @since v10.0.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. - * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) - * @return Fulfills with `undefined` upon success. - */ - function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; - /** - * Opens a `FileHandle`. - * - * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * @since v10.0.0 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. - * @return Fulfills with a {FileHandle} object. - */ - function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; - /** - * Renames `oldPath` to `newPath`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - /** - * Truncates (shortens or extends the length) of the content at `path` to `len`bytes. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - function truncate(path: PathLike, len?: number): Promise; - /** - * Removes the directory identified by `path`. - * - * Using `fsPromises.rmdir()` on a file (not a directory) results in the - * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - /** - * Removes files and directories (modeled on the standard POSIX `rm` utility). - * @since v14.14.0 - * @return Fulfills with `undefined` upon success. - */ - function rm(path: PathLike, options?: RmOptions): Promise; - /** - * Asynchronously creates a directory. - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory - * that exists results in a - * rejection only when `recursive` is false. - * - * ```js - * import { mkdir } from 'node:fs/promises'; - * - * try { - * const projectFolder = new URL('./test/project/', import.meta.url); - * const createDir = await mkdir(projectFolder, { recursive: true }); - * - * console.log(`created ${createDir}`); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * @since v10.0.0 - * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. - */ - function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; - /** - * Reads the contents of a directory. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned - * will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects. - * - * ```js - * import { readdir } from 'node:fs/promises'; - * - * try { - * const files = await readdir(path); - * for (const file of files) - * console.log(file); - * } catch (err) { - * console.error(err); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is - * fulfilled with the`linkString` upon success. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, the link path - * returned will be passed as a `Buffer` object. - * @since v10.0.0 - * @return Fulfills with the `linkString` upon success. - */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; - /** - * Creates a symbolic link. - * - * The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will - * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not - * exist, `'file'` will be used. Windows junction points require the destination - * path to be absolute. When using `'junction'`, the `target` argument will - * automatically be normalized to absolute path. Junction points on NTFS volumes - * can only point to directories. - * @since v10.0.0 - * @param [type='null'] - * @return Fulfills with `undefined` upon success. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - /** - * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, - * in which case the link itself is stat-ed, not the file that it refers to. - * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. - */ - function lstat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function lstat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function lstat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given `path`. - */ - function stat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function stat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function stat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v19.6.0, v18.15.0 - * @return Fulfills with the {fs.StatFs} object for the given `path`. - */ - function statfs( - path: PathLike, - opts?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function statfs( - path: PathLike, - opts: StatFsOptions & { - bigint: true; - }, - ): Promise; - function statfs(path: PathLike, opts?: StatFsOptions): Promise; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - /** - * If `path` refers to a symbolic link, then the link is removed without affecting - * the file or directory to which that link refers. If the `path` refers to a file - * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function unlink(path: PathLike): Promise; - /** - * Changes the permissions of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the permissions on a symbolic link. - * - * This method is only implemented on macOS. - * @deprecated Since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the ownership on a symbolic link. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a - * symbolic link, then the link is not dereferenced: instead, the timestamps of - * the symbolic link itself are changed. - * @since v14.5.0, v12.19.0 - * @return Fulfills with `undefined` upon success. - */ - function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Changes the ownership of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time, `Date`s, or a - * numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path. If the `encoding` is set to `'buffer'`, the path returned will be - * passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v10.0.0 - * @return Fulfills with the resolved path upon success. - */ - function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath( - path: PathLike, - options?: ObjectEncodingOptions | BufferEncoding | null, - ): Promise; - /** - * Creates a unique temporary directory. A unique directory name is generated by - * appending six random characters to the end of the provided `prefix`. Due to - * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some - * platforms, notably the BSDs, can return more than six random characters, and - * replace trailing `X` characters in `prefix` with random characters. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs/promises'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * try { - * await mkdtemp(join(tmpdir(), 'foo-')); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * The `fsPromises.mkdtemp()` method will append the six randomly selected - * characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing - * platform-specific path separator - * (`require('node:path').sep`). - * @since v10.0.0 - * @return Fulfills with a string containing the file system path of the newly created temporary directory. - */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * If `options` is a string, then it specifies the encoding. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * Any specified `FileHandle` has to support writing. - * - * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file - * without waiting for the promise to be settled. - * - * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience - * method that performs multiple `write` calls internally to write the buffer - * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. - * - * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs/promises'; - * import { Buffer } from 'node:buffer'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * const promise = writeFile('message.txt', data, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v10.0.0 - * @param file filename or `FileHandle` - * @return Fulfills with `undefined` upon success. - */ - function writeFile( - file: PathLike | FileHandle, - data: - | string - | NodeJS.ArrayBufferView - | Iterable - | AsyncIterable - | Stream, - options?: - | (ObjectEncodingOptions & { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - } & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * The `path` may be specified as a `FileHandle` that has been opened - * for appending (using `fsPromises.open()`). - * @since v10.0.0 - * @param path filename or {FileHandle} - * @return Fulfills with `undefined` upon success. - */ - function appendFile( - path: PathLike | FileHandle, - data: string | Uint8Array, - options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * - * If no encoding is specified (using `options.encoding`), the data is returned - * as a `Buffer` object. Otherwise, the data will be a string. - * - * If `options` is a string, then it specifies the encoding. - * - * When the `path` is a directory, the behavior of `fsPromises.readFile()` is - * platform-specific. On macOS, Linux, and Windows, the promise will be rejected - * with an error. On FreeBSD, a representation of the directory's contents will be - * returned. - * - * An example of reading a `package.json` file located in the same directory of the - * running code: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * try { - * const filePath = new URL('./package.json', import.meta.url); - * const contents = await readFile(filePath, { encoding: 'utf8' }); - * console.log(contents); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * - * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a - * request is aborted the promise returned is rejected with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const promise = readFile(fileName, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * - * Any specified `FileHandle` has to support reading. - * @since v10.0.0 - * @param path filename or `FileHandle` - * @return Fulfills with the contents of the file. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ({ - encoding?: null | undefined; - flag?: OpenMode | undefined; - } & Abortable) - | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options: - | ({ - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } & Abortable) - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ( - & ObjectEncodingOptions - & Abortable - & { - flag?: OpenMode | undefined; - } - ) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * - * Example using async iteration: - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - * @return Fulfills with an {fs.Dir}. - */ - function opendir(path: PathLike, options?: OpenDirOptions): Promise; - /** - * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. - * - * ```js - * const { watch } = require('node:fs/promises'); - * - * const ac = new AbortController(); - * const { signal } = ac; - * setTimeout(() => ac.abort(), 10000); - * - * (async () => { - * try { - * const watcher = watch(__filename, { signal }); - * for await (const event of watcher) - * console.log(event); - * } catch (err) { - * if (err.name === 'AbortError') - * return; - * throw err; - * } - * })(); - * ``` - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. - * @since v15.9.0, v14.18.0 - * @return of objects with the properties: - */ - function watch( - filename: PathLike, - options: - | (WatchOptions & { - encoding: "buffer"; - }) - | "buffer", - ): AsyncIterable>; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable>; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: WatchOptions | string, - ): AsyncIterable> | AsyncIterable>; - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - * @return Fulfills with `undefined` upon success. - */ - function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; -} -declare module "node:fs/promises" { - export * from "fs/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/globals.d.ts b/reverse_engineering/node_modules/@types/node/globals.d.ts deleted file mode 100644 index 5f250062..00000000 --- a/reverse_engineering/node_modules/@types/node/globals.d.ts +++ /dev/null @@ -1,411 +0,0 @@ -export {}; // Make this a module - -// #region Fetch and friends -// Conditional type aliases, used at the end of this file. -// Will either be empty if lib-dom is included, or the undici version otherwise. -type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request; -type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response; -type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData; -type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers; -type _RequestInit = typeof globalThis extends { onmessage: any } ? {} - : import("undici-types").RequestInit; -type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} - : import("undici-types").ResponseInit; -type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File; -// #endregion Fetch and friends - -declare global { - // Declare "static" methods in Error - interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - - stackTraceLimit: number; - } - - /*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - - // For backwards compability - interface NodeRequire extends NodeJS.Require {} - interface RequireResolve extends NodeJS.RequireResolve {} - interface NodeModule extends NodeJS.Module {} - - var process: NodeJS.Process; - var console: Console; - - var __filename: string; - var __dirname: string; - - var require: NodeRequire; - var module: NodeModule; - - // Same as module.exports - var exports: any; - - /** - * Only available if `--expose-gc` is passed to the process. - */ - var gc: undefined | (() => void); - - // #region borrowed - // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib - /** A controller object that allows you to abort one or more DOM requests as and when desired. */ - interface AbortController { - /** - * Returns the AbortSignal object associated with this object. - */ - - readonly signal: AbortSignal; - /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. - */ - abort(reason?: any): void; - } - - /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ - interface AbortSignal extends EventTarget { - /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. - */ - readonly aborted: boolean; - readonly reason: any; - onabort: null | ((this: AbortSignal, event: Event) => any); - throwIfAborted(): void; - } - - var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T - : { - prototype: AbortController; - new(): AbortController; - }; - - var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T - : { - prototype: AbortSignal; - new(): AbortSignal; - abort(reason?: any): AbortSignal; - timeout(milliseconds: number): AbortSignal; - }; - // #endregion borrowed - - // #region Disposable - interface SymbolConstructor { - /** - * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. - */ - readonly dispose: unique symbol; - - /** - * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. - */ - readonly asyncDispose: unique symbol; - } - - interface Disposable { - [Symbol.dispose](): void; - } - - interface AsyncDisposable { - [Symbol.asyncDispose](): PromiseLike; - } - // #endregion Disposable - - // #region ArrayLike.at() - interface RelativeIndexable { - /** - * Takes an integer value and returns the item at that index, - * allowing for positive and negative integers. - * Negative integers count back from the last item in the array. - */ - at(index: number): T | undefined; - } - interface String extends RelativeIndexable {} - interface Array extends RelativeIndexable {} - interface ReadonlyArray extends RelativeIndexable {} - interface Int8Array extends RelativeIndexable {} - interface Uint8Array extends RelativeIndexable {} - interface Uint8ClampedArray extends RelativeIndexable {} - interface Int16Array extends RelativeIndexable {} - interface Uint16Array extends RelativeIndexable {} - interface Int32Array extends RelativeIndexable {} - interface Uint32Array extends RelativeIndexable {} - interface Float32Array extends RelativeIndexable {} - interface Float64Array extends RelativeIndexable {} - interface BigInt64Array extends RelativeIndexable {} - interface BigUint64Array extends RelativeIndexable {} - // #endregion ArrayLike.at() end - - /** - * @since v17.0.0 - * - * Creates a deep clone of an object. - */ - function structuredClone( - value: T, - transfer?: { transfer: ReadonlyArray }, - ): T; - - /*----------------------------------------------* - * * - * GLOBAL INTERFACES * - * * - *-----------------------------------------------*/ - namespace NodeJS { - interface CallSite { - /** - * Value of "this" - */ - getThis(): unknown; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ - getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | undefined; - - /** - * Current line number [if this function was defined in a script] - */ - getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ - isEval(): boolean; - - /** - * Is this call in native V8 code? - */ - isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - - /** - * is this an async call (i.e. await, Promise.all(), or Promise.any())? - */ - isAsync(): boolean; - - /** - * is this an async call to Promise.all()? - */ - isPromiseAll(): boolean; - - /** - * returns the index of the promise element that was followed in - * Promise.all() or Promise.any() for async stack traces, or null - * if the CallSite is not an async - */ - getPromiseIndex(): number | null; - - getScriptNameOrSourceURL(): string; - getScriptHash(): string; - - getEnclosingColumnNumber(): number; - getEnclosingLineNumber(): number; - getPosition(): number; - - toString(): string; - } - - interface ErrnoException extends Error { - errno?: number | undefined; - code?: string | undefined; - path?: string | undefined; - syscall?: string | undefined; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: BufferEncoding): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean | undefined }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): this; - end(data: string | Uint8Array, cb?: () => void): this; - end(str: string, encoding?: BufferEncoding, cb?: () => void): this; - } - - interface ReadWriteStream extends ReadableStream, WritableStream {} - - interface RefCounted { - ref(): this; - unref(): this; - } - - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; - - interface Require { - (id: string): any; - resolve: RequireResolve; - cache: Dict; - /** - * @deprecated - */ - extensions: RequireExtensions; - main: Module | undefined; - } - - interface RequireResolve { - (id: string, options?: { paths?: string[] | undefined }): string; - paths(request: string): string[] | null; - } - - interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { - ".js": (m: Module, filename: string) => any; - ".json": (m: Module, filename: string) => any; - ".node": (m: Module, filename: string) => any; - } - interface Module { - /** - * `true` if the module is running during the Node.js preload - */ - isPreloading: boolean; - exports: any; - require: Require; - id: string; - filename: string; - loaded: boolean; - /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ - parent: Module | null | undefined; - children: Module[]; - /** - * @since v11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - paths: string[]; - } - - interface Dict { - [key: string]: T | undefined; - } - - interface ReadOnlyDict { - readonly [key: string]: T | undefined; - } - } - - interface RequestInit extends _RequestInit {} - - function fetch( - input: string | URL | globalThis.Request, - init?: RequestInit, - ): Promise; - - interface Request extends _Request {} - var Request: typeof globalThis extends { - onmessage: any; - Request: infer T; - } ? T - : typeof import("undici-types").Request; - - interface ResponseInit extends _ResponseInit {} - - interface Response extends _Response {} - var Response: typeof globalThis extends { - onmessage: any; - Response: infer T; - } ? T - : typeof import("undici-types").Response; - - interface FormData extends _FormData {} - var FormData: typeof globalThis extends { - onmessage: any; - FormData: infer T; - } ? T - : typeof import("undici-types").FormData; - - interface Headers extends _Headers {} - var Headers: typeof globalThis extends { - onmessage: any; - Headers: infer T; - } ? T - : typeof import("undici-types").Headers; - - interface File extends _File {} - var File: typeof globalThis extends { - onmessage: any; - File: infer T; - } ? T - : typeof import("node:buffer").File; -} diff --git a/reverse_engineering/node_modules/@types/node/globals.global.d.ts b/reverse_engineering/node_modules/@types/node/globals.global.d.ts deleted file mode 100644 index ef1198c0..00000000 --- a/reverse_engineering/node_modules/@types/node/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: typeof globalThis; diff --git a/reverse_engineering/node_modules/@types/node/http.d.ts b/reverse_engineering/node_modules/@types/node/http.d.ts deleted file mode 100644 index 9b2c3c2c..00000000 --- a/reverse_engineering/node_modules/@types/node/http.d.ts +++ /dev/null @@ -1,1888 +0,0 @@ -/** - * To use the HTTP server and client one must `require('node:http')`. - * - * The HTTP interfaces in Node.js are designed to support many features - * of the protocol which have been traditionally difficult to use. - * In particular, large, possibly chunk-encoded, messages. The interface is - * careful to never buffer entire requests or responses, so the - * user is able to stream data. - * - * HTTP message headers are represented by an object like this: - * - * ```js - * { 'content-length': '123', - * 'content-type': 'text/plain', - * 'connection': 'keep-alive', - * 'host': 'example.com', - * 'accept': '*' } - * ``` - * - * Keys are lowercased. Values are not modified. - * - * In order to support the full spectrum of possible HTTP applications, the Node.js - * HTTP API is very low-level. It deals with stream handling and message - * parsing only. It parses a message into headers and body but it does not - * parse the actual headers or the body. - * - * See `message.headers` for details on how duplicate headers are handled. - * - * The raw headers as they were received are retained in the `rawHeaders`property, which is an array of `[key, value, key2, value2, ...]`. For - * example, the previous message header object might have a `rawHeaders`list like the following: - * - * ```js - * [ 'ConTent-Length', '123456', - * 'content-LENGTH', '123', - * 'content-type', 'text/plain', - * 'CONNECTION', 'keep-alive', - * 'Host', 'example.com', - * 'accepT', '*' ] - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http.js) - */ -declare module "http" { - import * as stream from "node:stream"; - import { URL } from "node:url"; - import { LookupOptions } from "node:dns"; - import { EventEmitter } from "node:events"; - import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net"; - // incoming headers will never contain number - interface IncomingHttpHeaders extends NodeJS.Dict { - accept?: string | undefined; - "accept-language"?: string | undefined; - "accept-patch"?: string | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - "alt-svc"?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - connection?: string | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-type"?: string | undefined; - cookie?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - location?: string | undefined; - origin?: string | undefined; - pragma?: string | undefined; - "proxy-authenticate"?: string | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "retry-after"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | undefined; - "sec-websocket-version"?: string | undefined; - "set-cookie"?: string[] | undefined; - "strict-transport-security"?: string | undefined; - tk?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - upgrade?: string | undefined; - "user-agent"?: string | undefined; - vary?: string | undefined; - via?: string | undefined; - warning?: string | undefined; - "www-authenticate"?: string | undefined; - } - // outgoing headers allows numbers (as they are converted internally to strings) - type OutgoingHttpHeader = number | string | string[]; - interface OutgoingHttpHeaders extends NodeJS.Dict { - accept?: string | string[] | undefined; - "accept-charset"?: string | string[] | undefined; - "accept-encoding"?: string | string[] | undefined; - "accept-language"?: string | string[] | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - "cdn-cache-control"?: string | undefined; - connection?: string | string[] | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | number | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-security-policy"?: string | undefined; - "content-security-policy-report-only"?: string | undefined; - cookie?: string | string[] | undefined; - dav?: string | string[] | undefined; - dnt?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-range"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - link?: string | string[] | undefined; - location?: string | undefined; - "max-forwards"?: string | undefined; - origin?: string | undefined; - prgama?: string | string[] | undefined; - "proxy-authenticate"?: string | string[] | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - "public-key-pins-report-only"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "referrer-policy"?: string | undefined; - refresh?: string | undefined; - "retry-after"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | string[] | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | string[] | undefined; - "sec-websocket-version"?: string | undefined; - server?: string | undefined; - "set-cookie"?: string | string[] | undefined; - "strict-transport-security"?: string | undefined; - te?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - "user-agent"?: string | undefined; - upgrade?: string | undefined; - "upgrade-insecure-requests"?: string | undefined; - vary?: string | undefined; - via?: string | string[] | undefined; - warning?: string | undefined; - "www-authenticate"?: string | string[] | undefined; - "x-content-type-options"?: string | undefined; - "x-dns-prefetch-control"?: string | undefined; - "x-frame-options"?: string | undefined; - "x-xss-protection"?: string | undefined; - } - interface ClientRequestArgs { - _defaultAgent?: Agent | undefined; - agent?: Agent | boolean | undefined; - auth?: string | null | undefined; - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 - createConnection?: - | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) - | undefined; - defaultPort?: number | string | undefined; - family?: number | undefined; - headers?: OutgoingHttpHeaders | undefined; - hints?: LookupOptions["hints"]; - host?: string | null | undefined; - hostname?: string | null | undefined; - insecureHTTPParser?: boolean | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - lookup?: LookupFunction | undefined; - /** - * @default 16384 - */ - maxHeaderSize?: number | undefined; - method?: string | undefined; - path?: string | null | undefined; - port?: number | string | null | undefined; - protocol?: string | null | undefined; - setHost?: boolean | undefined; - signal?: AbortSignal | undefined; - socketPath?: string | undefined; - timeout?: number | undefined; - uniqueHeaders?: Array | undefined; - joinDuplicateHeaders?: boolean; - } - interface ServerOptions< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > { - /** - * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. - */ - IncomingMessage?: Request | undefined; - /** - * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. - */ - ServerResponse?: Response | undefined; - /** - * Sets the timeout value in milliseconds for receiving the entire request from the client. - * @see Server.requestTimeout for more information. - * @default 300000 - * @since v18.0.0 - */ - requestTimeout?: number | undefined; - /** - * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. - * @default false - * @since v18.14.0 - */ - joinDuplicateHeaders?: boolean; - /** - * The number of milliseconds of inactivity a server needs to wait for additional incoming data, - * after it has finished writing the last response, before a socket will be destroyed. - * @see Server.keepAliveTimeout for more information. - * @default 5000 - * @since v18.0.0 - */ - keepAliveTimeout?: number | undefined; - /** - * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. - * @default 30000 - */ - connectionsCheckingInterval?: number | undefined; - /** - * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. - * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. - * Default: @see stream.getDefaultHighWaterMark(). - * @since v20.1.0 - */ - highWaterMark?: number | undefined; - /** - * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. - * Using the insecure parser should be avoided. - * See --insecure-http-parser for more information. - * @default false - */ - insecureHTTPParser?: boolean | undefined; - /** - * Optionally overrides the value of - * `--max-http-header-size` for requests received by this server, i.e. - * the maximum length of request headers in bytes. - * @default 16384 - * @since v13.3.0 - */ - maxHeaderSize?: number | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default true - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - /** - * A list of response headers that should be sent only once. - * If the header's value is an array, the items will be joined using `; `. - */ - uniqueHeaders?: Array | undefined; - } - type RequestListener< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; - /** - * @since v0.1.17 - */ - class Server< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - /** - * Sets the timeout value for sockets, and emits a `'timeout'` event on - * the Server object, passing the socket as an argument, if a timeout - * occurs. - * - * If there is a `'timeout'` event listener on the Server object, then it - * will be called with the timed-out socket as an argument. - * - * By default, the Server does not timeout sockets. However, if a callback - * is assigned to the Server's `'timeout'` event, timeouts must be handled - * explicitly. - * @since v0.9.12 - * @param [msecs=0 (no timeout)] - */ - setTimeout(msecs?: number, callback?: () => void): this; - setTimeout(callback: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @since v0.7.0 - */ - maxHeadersCount: number | null; - /** - * The maximum number of requests socket can handle - * before closing keep alive connection. - * - * A value of `0` will disable the limit. - * - * When the limit is reached it will set the `Connection` header value to `close`, - * but will not actually close the connection, subsequent requests sent - * after the limit is reached will get `503 Service Unavailable` as a response. - * @since v16.10.0 - */ - maxRequestsPerSocket: number | null; - /** - * The number of milliseconds of inactivity before a socket is presumed - * to have timed out. - * - * A value of `0` will disable the timeout behavior on incoming connections. - * - * The socket timeout logic is set up on connection, so changing this - * value only affects new connections to the server, not any existing connections. - * @since v0.9.12 - */ - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP - * headers. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v11.3.0, v10.14.0 - */ - headersTimeout: number; - /** - * The number of milliseconds of inactivity a server needs to wait for additional - * incoming data, after it has finished writing the last response, before a socket - * will be destroyed. If the server receives new data before the keep-alive - * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`. - * - * A value of `0` will disable the keep-alive timeout behavior on incoming - * connections. - * A value of `0` makes the http server behave similarly to Node.js versions prior - * to 8.0.0, which did not have a keep-alive timeout. - * - * The socket timeout logic is set up on connection, so changing this value only - * affects new connections to the server, not any existing connections. - * @since v8.0.0 - */ - keepAliveTimeout: number; - /** - * Sets the timeout value in milliseconds for receiving the entire request from - * the client. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v14.11.0 - */ - requestTimeout: number; - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request - * or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: RequestListener): this; - addListener(event: "checkExpectation", listener: RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - addListener(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - addListener(event: "request", listener: RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; - emit(event: "dropRequest", req: InstanceType, socket: stream.Duplex): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: RequestListener): this; - on(event: "checkExpectation", listener: RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; - on(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - on(event: "request", listener: RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: RequestListener): this; - once(event: "checkExpectation", listener: RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - once( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - once(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - once(event: "request", listener: RequestListener): this; - once( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: RequestListener): this; - prependListener(event: "checkExpectation", listener: RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependListener(event: "request", listener: RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependOnceListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependOnceListener(event: "request", listener: RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - } - /** - * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from - * the perspective of the participants of an HTTP transaction. - * @since v0.1.17 - */ - class OutgoingMessage extends stream.Writable { - readonly req: Request; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - /** - * @deprecated Use `writableEnded` instead. - */ - finished: boolean; - /** - * Read-only. `true` if the headers were sent, otherwise `false`. - * @since v0.9.3 - */ - readonly headersSent: boolean; - /** - * Alias of `outgoingMessage.socket`. - * @since v0.3.0 - * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. - */ - readonly connection: Socket | null; - /** - * Reference to the underlying socket. Usually, users will not want to access - * this property. - * - * After calling `outgoingMessage.end()`, this property will be nulled. - * @since v0.3.0 - */ - readonly socket: Socket | null; - constructor(); - /** - * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter. - * @since v0.9.12 - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * Sets a single header value. If the header already exists in the to-be-sent - * headers, its value will be replaced. Use an array of strings to send multiple - * headers with the same name. - * @since v0.4.0 - * @param name Header name - * @param value Header value - */ - setHeader(name: string, value: number | string | readonly string[]): this; - /** - * Append a single header value for the header object. - * - * If the value is an array, this is equivalent of calling this method multiple - * times. - * - * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`. - * - * Depending of the value of `options.uniqueHeaders` when the client request or the - * server were created, this will end up in the header being sent multiple times or - * a single time with values joined using `; `. - * @since v18.3.0, v16.17.0 - * @param name Header name - * @param value Header value - */ - appendHeader(name: string, value: string | readonly string[]): this; - /** - * Gets the value of the HTTP header with the given name. If that header is not - * set, the returned value will be `undefined`. - * @since v0.4.0 - * @param name Name of header - */ - getHeader(name: string): number | string | string[] | undefined; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow - * copy is used, array values may be mutated without additional calls to - * various header-related HTTP module methods. The keys of the returned - * object are the header names and the values are the respective header - * values. All header names are lowercase. - * - * The object returned by the `outgoingMessage.getHeaders()` method does - * not prototypically inherit from the JavaScript `Object`. This means that - * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, - * and others are not defined and will not work. - * - * ```js - * outgoingMessage.setHeader('Foo', 'bar'); - * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = outgoingMessage.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v7.7.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All names are lowercase. - * @since v7.7.0 - */ - getHeaderNames(): string[]; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name is case-insensitive. - * - * ```js - * const hasContentType = outgoingMessage.hasHeader('content-type'); - * ``` - * @since v7.7.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that is queued for implicit sending. - * - * ```js - * outgoingMessage.removeHeader('Content-Encoding'); - * ``` - * @since v0.4.0 - * @param name Header name - */ - removeHeader(name: string): void; - /** - * Adds HTTP trailers (headers but at the end of the message) to the message. - * - * Trailers will **only** be emitted if the message is chunked encoded. If not, - * the trailers will be silently discarded. - * - * HTTP requires the `Trailer` header to be sent to emit trailers, - * with a list of header field names in its value, e.g. - * - * ```js - * message.writeHead(200, { 'Content-Type': 'text/plain', - * 'Trailer': 'Content-MD5' }); - * message.write(fileData); - * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); - * message.end(); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v0.3.0 - */ - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - /** - * Flushes the message headers. - * - * For efficiency reason, Node.js normally buffers the message headers - * until `outgoingMessage.end()` is called or the first chunk of message data - * is written. It then tries to pack the headers and data into a single TCP - * packet. - * - * It is usually desired (it saves a TCP round-trip), but not when the first - * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message. - * @since v1.6.0 - */ - flushHeaders(): void; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v0.1.17 - */ - class ServerResponse extends OutgoingMessage { - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v0.4.0 - */ - statusCode: number; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status message that will be sent to the client when - * the headers get flushed. If this is left as `undefined` then the standard - * message for the status code will be used. - * - * ```js - * response.statusMessage = 'Not found'; - * ``` - * - * After response header was sent to the client, this property indicates the - * status message which was sent out. - * @since v0.11.8 - */ - statusMessage: string; - /** - * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal. - * Mismatching the `Content-Length` header value will result - * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * @since v18.10.0, v16.18.0 - */ - strictContentLength: boolean; - constructor(req: Request); - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - /** - * Sends an HTTP/1.1 100 Continue message to the client, indicating that - * the request body should be sent. See the `'checkContinue'` event on`Server`. - * @since v0.3.0 - */ - writeContinue(callback?: () => void): void; - /** - * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. The optional `callback` argument will be called when - * the response message has been written. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * 'x-trace-id': 'id for diagnostics', - * }); - * - * const earlyHintsCallback = () => console.log('early hints message sent'); - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }, earlyHintsCallback); - * ``` - * @since v18.11.0 - * @param hints An object containing the values of headers - * @param callback Will be called when the response message has been written - */ - writeEarlyHints(hints: Record, callback?: () => void): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * Optionally one can give a human-readable `statusMessage` as the second - * argument. - * - * `headers` may be an `Array` where the keys and values are in the same list. - * It is _not_ a list of tuples. So, the even-numbered offsets are key values, - * and the odd-numbered offsets are the associated values. The array is in the same - * format as `request.rawHeaders`. - * - * Returns a reference to the `ServerResponse`, so that calls can be chained. - * - * ```js - * const body = 'hello world'; - * response - * .writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain', - * }) - * .end(body); - * ``` - * - * This method must only be called once on a message and it must - * be called before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * If this method is called and `response.setHeader()` has not been called, - * it will directly write the supplied header values onto the network channel - * without caching internally, and the `response.getHeader()` on the header - * will not yield the expected result. If progressive population of headers is - * desired with potential future retrieval and modification, use `response.setHeader()` instead. - * - * ```js - * // Returns content-type = text/plain - * const server = http.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain' }); - * res.end('ok'); - * }); - * ``` - * - * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js - * will check whether `Content-Length` and the length of the body which has - * been transmitted are equal or not. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a \[`Error`\]\[\] being thrown. - * @since v0.1.30 - */ - writeHead( - statusCode: number, - statusMessage?: string, - headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], - ): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; - /** - * Sends a HTTP/1.1 102 Processing message to the client, indicating that - * the request body should be sent. - * @since v10.0.0 - */ - writeProcessing(): void; - } - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - /** - * This object is created internally and returned from {@link request}. It - * represents an _in-progress_ request whose header has already been queued. The - * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will - * be sent along with the first data chunk or when calling `request.end()`. - * - * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response - * headers have been received. The `'response'` event is executed with one - * argument which is an instance of {@link IncomingMessage}. - * - * During the `'response'` event, one can add listeners to the - * response object; particularly to listen for the `'data'` event. - * - * If no `'response'` handler is added, then the response will be - * entirely discarded. However, if a `'response'` event handler is added, - * then the data from the response object **must** be consumed, either by - * calling `response.read()` whenever there is a `'readable'` event, or - * by adding a `'data'` handler, or by calling the `.resume()` method. - * Until the data is consumed, the `'end'` event will not fire. Also, until - * the data is read it will consume memory that can eventually lead to a - * 'process out of memory' error. - * - * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered. - * - * Set `Content-Length` header to limit the response body size. - * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown, - * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * - * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. - * @since v0.1.17 - */ - class ClientRequest extends OutgoingMessage { - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v0.11.14 - * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead. - */ - aborted: boolean; - /** - * The request host. - * @since v14.5.0, v12.19.0 - */ - host: string; - /** - * The request protocol. - * @since v14.5.0, v12.19.0 - */ - protocol: string; - /** - * When sending request through a keep-alive enabled agent, the underlying socket - * might be reused. But if server closes connection at unfortunate time, client - * may run into a 'ECONNRESET' error. - * - * ```js - * import http from 'node:http'; - * - * // Server has a 5 seconds keep-alive timeout by default - * http - * .createServer((req, res) => { - * res.write('hello\n'); - * res.end(); - * }) - * .listen(3000); - * - * setInterval(() => { - * // Adapting a keep-alive agent - * http.get('http://localhost:3000', { agent }, (res) => { - * res.on('data', (data) => { - * // Do nothing - * }); - * }); - * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout - * ``` - * - * By marking a request whether it reused socket or not, we can do - * automatic error retry base on it. - * - * ```js - * import http from 'node:http'; - * const agent = new http.Agent({ keepAlive: true }); - * - * function retriableRequest() { - * const req = http - * .get('http://localhost:3000', { agent }, (res) => { - * // ... - * }) - * .on('error', (err) => { - * // Check if retry is needed - * if (req.reusedSocket && err.code === 'ECONNRESET') { - * retriableRequest(); - * } - * }); - * } - * - * retriableRequest(); - * ``` - * @since v13.0.0, v12.16.0 - */ - reusedSocket: boolean; - /** - * Limits maximum response headers count. If set to 0, no limit will be applied. - */ - maxHeadersCount: number; - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - /** - * The request method. - * @since v0.1.97 - */ - method: string; - /** - * The request path. - * @since v0.4.0 - */ - path: string; - /** - * Marks the request as aborting. Calling this will cause remaining data - * in the response to be dropped and the socket to be destroyed. - * @since v0.3.8 - * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. - */ - abort(): void; - onSocket(socket: Socket): void; - /** - * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. - * @since v0.5.9 - * @param timeout Milliseconds before a request times out. - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. - * @since v0.5.9 - */ - setNoDelay(noDelay?: boolean): void; - /** - * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. - * @since v0.5.9 - */ - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - /** - * Returns an array containing the unique names of the current outgoing raw - * headers. Header names are returned with their exact casing being set. - * - * ```js - * request.setHeader('Foo', 'bar'); - * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = request.getRawHeaderNames(); - * // headerNames === ['Foo', 'Set-Cookie'] - * ``` - * @since v15.13.0, v14.17.0 - */ - getRawHeaderNames(): string[]; - /** - * @deprecated - */ - addListener(event: "abort", listener: () => void): this; - addListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - addListener(event: "continue", listener: () => void): this; - addListener(event: "information", listener: (info: InformationEvent) => void): this; - addListener(event: "response", listener: (response: IncomingMessage) => void): this; - addListener(event: "socket", listener: (socket: Socket) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - on(event: "abort", listener: () => void): this; - on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: "continue", listener: () => void): this; - on(event: "information", listener: (info: InformationEvent) => void): this; - on(event: "response", listener: (response: IncomingMessage) => void): this; - on(event: "socket", listener: (socket: Socket) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - once(event: "abort", listener: () => void): this; - once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: "continue", listener: () => void): this; - once(event: "information", listener: (info: InformationEvent) => void): this; - once(event: "response", listener: (response: IncomingMessage) => void): this; - once(event: "socket", listener: (socket: Socket) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependListener(event: "abort", listener: () => void): this; - prependListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependListener(event: "continue", listener: () => void): this; - prependListener(event: "information", listener: (info: InformationEvent) => void): this; - prependListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependListener(event: "socket", listener: (socket: Socket) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependOnceListener(event: "abort", listener: () => void): this; - prependOnceListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependOnceListener(event: "continue", listener: () => void): this; - prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; - prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: "socket", listener: (socket: Socket) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to - * access response - * status, headers, and data. - * - * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to - * parse and emit the incoming HTTP headers and payload, as the underlying socket - * may be reused multiple times in case of keep-alive. - * @since v0.1.17 - */ - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - /** - * The `message.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. - */ - aborted: boolean; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. - * Probably either `'1.1'` or `'1.0'`. - * - * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. - * @since v0.1.1 - */ - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - /** - * The `message.complete` property will be `true` if a complete HTTP message has - * been received and successfully parsed. - * - * This property is particularly useful as a means of determining if a client or - * server fully transmitted a message before a connection was terminated: - * - * ```js - * const req = http.request({ - * host: '127.0.0.1', - * port: 8080, - * method: 'POST', - * }, (res) => { - * res.resume(); - * res.on('end', () => { - * if (!res.complete) - * console.error( - * 'The connection was terminated while the message was still being sent'); - * }); - * }); - * ``` - * @since v0.3.0 - */ - complete: boolean; - /** - * Alias for `message.socket`. - * @since v0.1.90 - * @deprecated Since v16.0.0 - Use `socket`. - */ - connection: Socket; - /** - * The `net.Socket` object associated with the connection. - * - * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the - * client's authentication details. - * - * This property is guaranteed to be an instance of the `net.Socket` class, - * a subclass of `stream.Duplex`, unless the user specified a socket - * type other than `net.Socket` or internally nulled. - * @since v0.3.0 - */ - socket: Socket; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * Duplicates in raw headers are handled in the following ways, depending on the - * header name: - * - * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`, - * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded. - * To allow duplicate values of the headers listed above to be joined, - * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more - * information. - * * `set-cookie` is always an array. Duplicates are added to the array. - * * For duplicate `cookie` headers, the values are joined together with `; `. - * * For all other headers, the values are joined together with `, `. - * @since v0.1.5 - */ - headers: IncomingHttpHeaders; - /** - * Similar to `message.headers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': ['curl/7.22.0'], - * // host: ['127.0.0.1:8000'], - * // accept: ['*'] } - * console.log(request.headersDistinct); - * ``` - * @since v18.3.0, v16.17.0 - */ - headersDistinct: NodeJS.Dict; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v0.11.6 - */ - rawHeaders: string[]; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v0.3.0 - */ - trailers: NodeJS.Dict; - /** - * Similar to `message.trailers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * Only populated at the `'end'` event. - * @since v18.3.0, v16.17.0 - */ - trailersDistinct: NodeJS.Dict; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v0.11.6 - */ - rawTrailers: string[]; - /** - * Calls `message.socket.setTimeout(msecs, callback)`. - * @since v0.5.9 - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * **Only valid for request obtained from {@link Server}.** - * - * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. - * @since v0.1.1 - */ - method?: string | undefined; - /** - * **Only valid for request obtained from {@link Server}.** - * - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. Take the following request: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * To parse the URL into its parts: - * - * ```js - * new URL(request.url, `http://${request.headers.host}`); - * ``` - * - * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`: - * - * ```console - * $ node - * > new URL(request.url, `http://${request.headers.host}`) - * URL { - * href: 'http://localhost:3000/status?name=ryan', - * origin: 'http://localhost:3000', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'localhost:3000', - * hostname: 'localhost', - * port: '3000', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * @since v0.1.90 - */ - url?: string | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The 3-digit HTTP response status code. E.G. `404`. - * @since v0.1.1 - */ - statusCode?: number | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. - * @since v0.11.10 - */ - statusMessage?: string | undefined; - /** - * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error`is provided, an `'error'` event is emitted on the socket and `error` is passed - * as an argument to any listeners on the event. - * @since v0.3.0 - */ - destroy(error?: Error): this; - } - interface AgentOptions extends Partial { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean | undefined; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number | undefined; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number | undefined; - /** - * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. - */ - maxTotalSockets?: number | undefined; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number | undefined; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number | undefined; - /** - * Scheduling strategy to apply when picking the next free socket to use. - * @default `lifo` - */ - scheduling?: "fifo" | "lifo" | undefined; - } - /** - * An `Agent` is responsible for managing connection persistence - * and reuse for HTTP clients. It maintains a queue of pending requests - * for a given host and port, reusing a single socket connection for each - * until the queue is empty, at which time the socket is either destroyed - * or put into a pool where it is kept to be used again for requests to the - * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`. - * - * Pooled connections have TCP Keep-Alive enabled for them, but servers may - * still close idle connections, in which case they will be removed from the - * pool and a new connection will be made when a new HTTP request is made for - * that host and port. Servers may also refuse to allow multiple requests - * over the same connection, in which case the connection will have to be - * remade for every request and cannot be pooled. The `Agent` will still make - * the requests to that server, but each one will occur over a new connection. - * - * When a connection is closed by the client or the server, it is removed - * from the pool. Any unused sockets in the pool will be unrefed so as not - * to keep the Node.js process running when there are no outstanding requests. - * (see `socket.unref()`). - * - * It is good practice, to `destroy()` an `Agent` instance when it is no - * longer in use, because unused sockets consume OS resources. - * - * Sockets are removed from an agent when the socket emits either - * a `'close'` event or an `'agentRemove'` event. When intending to keep one - * HTTP request open for a long time without keeping it in the agent, something - * like the following may be done: - * - * ```js - * http.get(options, (res) => { - * // Do stuff - * }).on('socket', (socket) => { - * socket.emit('agentRemove'); - * }); - * ``` - * - * An agent may also be used for an individual request. By providing`{agent: false}` as an option to the `http.get()` or `http.request()`functions, a one-time use `Agent` with default options - * will be used - * for the client connection. - * - * `agent:false`: - * - * ```js - * http.get({ - * hostname: 'localhost', - * port: 80, - * path: '/', - * agent: false, // Create a new agent just for this one request - * }, (res) => { - * // Do stuff with response - * }); - * ``` - * @since v0.3.4 - */ - class Agent extends EventEmitter { - /** - * By default set to 256. For agents with `keepAlive` enabled, this - * sets the maximum number of sockets that will be left open in the free - * state. - * @since v0.11.7 - */ - maxFreeSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open per origin. Origin is the returned value of `agent.getName()`. - * @since v0.3.6 - */ - maxSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open. Unlike `maxSockets`, this parameter applies across all origins. - * @since v14.5.0, v12.19.0 - */ - maxTotalSockets: number; - /** - * An object which contains arrays of sockets currently awaiting use by - * the agent when `keepAlive` is enabled. Do not modify. - * - * Sockets in the `freeSockets` list will be automatically destroyed and - * removed from the array on `'timeout'`. - * @since v0.11.4 - */ - readonly freeSockets: NodeJS.ReadOnlyDict; - /** - * An object which contains arrays of sockets currently in use by the - * agent. Do not modify. - * @since v0.3.6 - */ - readonly sockets: NodeJS.ReadOnlyDict; - /** - * An object which contains queues of requests that have not yet been assigned to - * sockets. Do not modify. - * @since v0.5.9 - */ - readonly requests: NodeJS.ReadOnlyDict; - constructor(opts?: AgentOptions); - /** - * Destroy any sockets that are currently in use by the agent. - * - * It is usually not necessary to do this. However, if using an - * agent with `keepAlive` enabled, then it is best to explicitly shut down - * the agent when it is no longer needed. Otherwise, - * sockets might stay open for quite a long time before the server - * terminates them. - * @since v0.11.4 - */ - destroy(): void; - } - const METHODS: string[]; - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - /** - * Returns a new instance of {@link Server}. - * - * The `requestListener` is a function which is automatically - * added to the `'request'` event. - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer(); - * - * // Listen to the request event - * server.on('request', (request, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.1.13 - */ - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - >(requestListener?: RequestListener): Server; - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - >( - options: ServerOptions, - requestListener?: RequestListener, - ): Server; - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs {} - /** - * `options` in `socket.connect()` are also supported. - * - * Node.js maintains several connections per server to make HTTP requests. - * This function allows one to transparently issue requests. - * - * `url` can be a string or a `URL` object. If `url` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence. - * - * The optional `callback` parameter will be added as a one-time listener for - * the `'response'` event. - * - * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * import http from 'node:http'; - * import { Buffer } from 'node:buffer'; - * - * const postData = JSON.stringify({ - * 'msg': 'Hello World!', - * }); - * - * const options = { - * hostname: 'www.google.com', - * port: 80, - * path: '/upload', - * method: 'POST', - * headers: { - * 'Content-Type': 'application/json', - * 'Content-Length': Buffer.byteLength(postData), - * }, - * }; - * - * const req = http.request(options, (res) => { - * console.log(`STATUS: ${res.statusCode}`); - * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); - * res.setEncoding('utf8'); - * res.on('data', (chunk) => { - * console.log(`BODY: ${chunk}`); - * }); - * res.on('end', () => { - * console.log('No more data in response.'); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(`problem with request: ${e.message}`); - * }); - * - * // Write data to request body - * req.write(postData); - * req.end(); - * ``` - * - * In the example `req.end()` was called. With `http.request()` one - * must always call `req.end()` to signify the end of the request - - * even if there is no data being written to the request body. - * - * If any error is encountered during the request (be that with DNS resolution, - * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted - * on the returned request object. As with all `'error'` events, if no listeners - * are registered the error will be thrown. - * - * There are a few special headers that should be noted. - * - * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to - * the server should be persisted until the next request. - * * Sending a 'Content-Length' header will disable the default chunked encoding. - * * Sending an 'Expect' header will immediately send the request headers. - * Usually, when sending 'Expect: 100-continue', both a timeout and a listener - * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more - * information. - * * Sending an Authorization header will override using the `auth` option - * to compute basic authentication. - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('http://abc:xyz@example.com'); - * - * const req = http.request(options, (res) => { - * // ... - * }); - * ``` - * - * In a successful request, the following events will be emitted in the following - * order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * (`'data'` will not be emitted at all if the response body is empty, for - * instance, in most redirects) - * * `'end'` on the `res` object - * * `'close'` - * - * In the case of a connection error, the following events will be emitted: - * - * * `'socket'` - * * `'error'` - * * `'close'` - * - * In the case of a premature connection close before the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` - * * `'close'` - * - * In the case of a premature connection close after the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (connection closed here) - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'` - * * `'close'` - * * `'close'` on the `res` object - * - * If `req.destroy()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.destroy()` called here) - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * * `'close'` on the `res` object - * - * If `req.abort()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.abort()` called here) - * * `'abort'` - * * `'close'` - * - * If `req.abort()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.abort()` called here) - * * `'abort'` - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` - * * `'close'` - * - * If `req.abort()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.abort()` called here) - * * `'abort'` - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`. - * * `'close'` - * * `'close'` on the `res` object - * - * Setting the `timeout` option or using the `setTimeout()` function will - * not abort the request or do anything besides add a `'timeout'` event. - * - * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the - * request. Specifically, the `'error'` event will be emitted with an error with - * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided. - * @since v0.3.6 - */ - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: IncomingMessage) => void, - ): ClientRequest; - /** - * Since most requests are GET requests without bodies, Node.js provides this - * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()`automatically. The callback must take care to - * consume the response - * data for reasons stated in {@link ClientRequest} section. - * - * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. - * - * JSON fetching example: - * - * ```js - * http.get('http://localhost:8000/', (res) => { - * const { statusCode } = res; - * const contentType = res.headers['content-type']; - * - * let error; - * // Any 2xx status code signals a successful response but - * // here we're only checking for 200. - * if (statusCode !== 200) { - * error = new Error('Request Failed.\n' + - * `Status Code: ${statusCode}`); - * } else if (!/^application\/json/.test(contentType)) { - * error = new Error('Invalid content-type.\n' + - * `Expected application/json but received ${contentType}`); - * } - * if (error) { - * console.error(error.message); - * // Consume response data to free up memory - * res.resume(); - * return; - * } - * - * res.setEncoding('utf8'); - * let rawData = ''; - * res.on('data', (chunk) => { rawData += chunk; }); - * res.on('end', () => { - * try { - * const parsedData = JSON.parse(rawData); - * console.log(parsedData); - * } catch (e) { - * console.error(e.message); - * } - * }); - * }).on('error', (e) => { - * console.error(`Got error: ${e.message}`); - * }); - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the method set to GET by default. - */ - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - /** - * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called. - * - * Passing illegal value as `name` will result in a `TypeError` being thrown, - * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * Examples: - * - * Example: - * - * ```js - * import { validateHeaderName } from 'node:http'; - * - * try { - * validateHeaderName(''); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' - * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' - * } - * ``` - * @since v14.3.0 - * @param [label='Header name'] Label for error message. - */ - function validateHeaderName(name: string): void; - /** - * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called. - * - * Passing illegal value as `value` will result in a `TypeError` being thrown. - * - * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. - * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * - * Examples: - * - * ```js - * import { validateHeaderValue } from 'node:http'; - * - * try { - * validateHeaderValue('x-my-header', undefined); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true - * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' - * } - * - * try { - * validateHeaderValue('x-my-header', 'oʊmɪɡə'); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true - * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' - * } - * ``` - * @since v14.3.0 - * @param name Header name - * @param value Header value - */ - function validateHeaderValue(name: string, value: string): void; - /** - * Set the maximum number of idle HTTP parsers. - * @since v18.8.0, v16.18.0 - * @param [max=1000] - */ - function setMaxIdleHTTPParsers(max: number): void; - let globalAgent: Agent; - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. - */ - const maxHeaderSize: number; -} -declare module "node:http" { - export * from "http"; -} diff --git a/reverse_engineering/node_modules/@types/node/http2.d.ts b/reverse_engineering/node_modules/@types/node/http2.d.ts deleted file mode 100644 index c3b3e8ec..00000000 --- a/reverse_engineering/node_modules/@types/node/http2.d.ts +++ /dev/null @@ -1,2382 +0,0 @@ -/** - * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. - * It can be accessed using: - * - * ```js - * const http2 = require('node:http2'); - * ``` - * @since v8.4.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http2.js) - */ -declare module "http2" { - import EventEmitter = require("node:events"); - import * as fs from "node:fs"; - import * as net from "node:net"; - import * as stream from "node:stream"; - import * as tls from "node:tls"; - import * as url from "node:url"; - import { - IncomingHttpHeaders as Http1IncomingHttpHeaders, - IncomingMessage, - OutgoingHttpHeaders, - ServerResponse, - } from "node:http"; - export { OutgoingHttpHeaders } from "node:http"; - export interface IncomingHttpStatusHeader { - ":status"?: number | undefined; - } - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string | undefined; - ":method"?: string | undefined; - ":authority"?: string | undefined; - ":scheme"?: string | undefined; - } - // Http2Stream - export interface StreamPriorityOptions { - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - silent?: boolean | undefined; - } - export interface StreamState { - localWindowSize?: number | undefined; - state?: number | undefined; - localClose?: number | undefined; - remoteClose?: number | undefined; - sumDependencyWeight?: number | undefined; - weight?: number | undefined; - } - export interface ServerStreamResponseOptions { - endStream?: boolean | undefined; - waitForTrailers?: boolean | undefined; - } - export interface StatOptions { - offset: number; - length: number; - } - export interface ServerStreamFileResponseOptions { - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; - waitForTrailers?: boolean | undefined; - offset?: number | undefined; - length?: number | undefined; - } - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?(err: NodeJS.ErrnoException): void; - } - export interface Http2Stream extends stream.Duplex { - /** - * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, - * the `'aborted'` event will have been emitted. - * @since v8.4.0 - */ - readonly aborted: boolean; - /** - * This property shows the number of characters currently buffered to be written. - * See `net.Socket.bufferSize` for details. - * @since v11.2.0, v10.16.0 - */ - readonly bufferSize: number; - /** - * Set to `true` if the `Http2Stream` instance has been closed. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer - * usable. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Set to `true` if the `END_STREAM` flag was set in the request or response - * HEADERS frame received, indicating that no additional data should be received - * and the readable side of the `Http2Stream` will be closed. - * @since v10.11.0 - */ - readonly endAfterHeaders: boolean; - /** - * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned. - * @since v8.4.0 - */ - readonly id?: number | undefined; - /** - * Set to `true` if the `Http2Stream` instance has not yet been assigned a - * numeric stream identifier. - * @since v9.4.0 - */ - readonly pending: boolean; - /** - * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is - * destroyed after either receiving an `RST_STREAM` frame from the connected peer, - * calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed. - * @since v8.4.0 - */ - readonly rstCode: number; - /** - * An object containing the outbound headers sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentHeaders: OutgoingHttpHeaders; - /** - * An array of objects containing the outbound informational (additional) headers - * sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; - /** - * An object containing the outbound trailers sent for this `HttpStream`. - * @since v9.5.0 - */ - readonly sentTrailers?: OutgoingHttpHeaders | undefined; - /** - * A reference to the `Http2Session` instance that owns this `Http2Stream`. The - * value will be `undefined` after the `Http2Stream` instance is destroyed. - * @since v8.4.0 - */ - readonly session: Http2Session | undefined; - /** - * Provides miscellaneous information about the current state of the`Http2Stream`. - * - * A current state of this `Http2Stream`. - * @since v8.4.0 - */ - readonly state: StreamState; - /** - * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the - * connected HTTP/2 peer. - * @since v8.4.0 - * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. - * @param callback An optional function registered to listen for the `'close'` event. - */ - close(code?: number, callback?: () => void): void; - /** - * Updates the priority for this `Http2Stream` instance. - * @since v8.4.0 - */ - priority(options: StreamPriorityOptions): void; - /** - * ```js - * const http2 = require('node:http2'); - * const client = http2.connect('http://example.org:8000'); - * const { NGHTTP2_CANCEL } = http2.constants; - * const req = client.request({ ':path': '/' }); - * - * // Cancel the stream if there's no activity after 5 seconds - * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); - * ``` - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method - * will cause the `Http2Stream` to be immediately closed and must only be - * called after the `'wantTrailers'` event has been emitted. When sending a - * request or sending a response, the `options.waitForTrailers` option must be set - * in order to keep the `Http2Stream` open after the final `DATA` frame so that - * trailers can be sent. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond(undefined, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ xyz: 'abc' }); - * }); - * stream.end('Hello World'); - * }); - * ``` - * - * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header - * fields (e.g. `':method'`, `':path'`, etc). - * @since v10.0.0 - */ - sendTrailers(headers: OutgoingHttpHeaders): void; - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "continue", listener: () => {}): this; - on( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "continue", listener: () => {}): this; - once( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "continue", listener: () => {}): this; - prependListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ServerHttp2Stream extends Http2Stream { - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote - * client's most recent `SETTINGS` frame. Will be `true` if the remote peer - * accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`. - * @since v8.4.0 - */ - readonly pushAllowed: boolean; - /** - * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. - * @since v8.4.0 - */ - additionalHeaders(headers: OutgoingHttpHeaders): void; - /** - * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { - * if (err) throw err; - * pushStream.respond({ ':status': 200 }); - * pushStream.end('some pushed data'); - * }); - * stream.end('some data'); - * }); - * ``` - * - * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass - * a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams. - * - * Calling `http2stream.pushStream()` from within a pushed stream is not permitted - * and will throw an error. - * @since v8.4.0 - * @param callback Callback that is called once the push stream has been initiated. - */ - pushStream( - headers: OutgoingHttpHeaders, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - pushStream( - headers: OutgoingHttpHeaders, - options?: StreamPriorityOptions, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - /** - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.end('some data'); - * }); - * ``` - * - * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk - * of payload data to be sent. The `http2stream.sendTrailers()` method can then be - * used to sent trailing header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * stream.end('some data'); - * }); - * ``` - * @since v8.4.0 - */ - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - /** - * Initiates a response whose data is read from the given file descriptor. No - * validation is performed on the given file descriptor. If an error occurs while - * attempting to read data using the file descriptor, the `Http2Stream` will be - * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers); - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given fd. If the `statCheck` function is provided, the`http2stream.respondWithFD()` method will perform an `fs.fstat()` call to - * collect details on the provided file descriptor. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The file descriptor or `FileHandle` is not closed when the stream is closed, - * so it will need to be closed manually once it is no longer needed. - * Using the same file descriptor concurrently for multiple streams - * is not supported and may result in data loss. Re-using a file descriptor - * after a stream has finished is supported. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * @since v8.4.0 - * @param fd A readable file descriptor. - */ - respondWithFD( - fd: number | fs.promises.FileHandle, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptions, - ): void; - /** - * Sends a regular file as the response. The `path` must specify a regular file - * or an `'error'` event will be emitted on the `Http2Stream` object. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given file: - * - * If an error occurs while attempting to read the file data, the `Http2Stream`will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`code. If the `onError` callback is - * defined, then it will be called. Otherwise - * the stream will be destroyed. - * - * Example using a file path: - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * headers['last-modified'] = stat.mtime.toUTCString(); - * } - * - * function onError(err) { - * // stream.respond() can throw if the stream has been destroyed by - * // the other side. - * try { - * if (err.code === 'ENOENT') { - * stream.respond({ ':status': 404 }); - * } else { - * stream.respond({ ':status': 500 }); - * } - * } catch (err) { - * // Perform actual error handling. - * console.error(err); - * } - * stream.end(); - * } - * - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck, onError }); - * }); - * ``` - * - * The `options.statCheck` function may also be used to cancel the send operation - * by returning `false`. For instance, a conditional request may check the stat - * results to determine if the file has been modified to return an appropriate`304` response: - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * // Check the stat here... - * stream.respond({ ':status': 304 }); - * return false; // Cancel the send operation - * } - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck }); - * }); - * ``` - * - * The `content-length` header field will be automatically set. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The `options.onError` function may also be used to handle all the errors - * that could happen before the delivery of the file is initiated. The - * default behavior is to destroy the stream. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * }); - * ``` - * @since v8.4.0 - */ - respondWithFile( - path: string, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptionsWithError, - ): void; - } - // Http2Session - export interface Settings { - headerTableSize?: number | undefined; - enablePush?: boolean | undefined; - initialWindowSize?: number | undefined; - maxFrameSize?: number | undefined; - maxConcurrentStreams?: number | undefined; - maxHeaderListSize?: number | undefined; - enableConnectProtocol?: boolean | undefined; - } - export interface ClientSessionRequestOptions { - endStream?: boolean | undefined; - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - waitForTrailers?: boolean | undefined; - signal?: AbortSignal | undefined; - } - export interface SessionState { - effectiveLocalWindowSize?: number | undefined; - effectiveRecvDataLength?: number | undefined; - nextStreamID?: number | undefined; - localWindowSize?: number | undefined; - lastProcStreamID?: number | undefined; - remoteWindowSize?: number | undefined; - outboundQueueSize?: number | undefined; - deflateDynamicTableSize?: number | undefined; - inflateDynamicTableSize?: number | undefined; - } - export interface Http2Session extends EventEmitter { - /** - * Value will be `undefined` if the `Http2Session` is not yet connected to a - * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or - * will return the value of the connected `TLSSocket`'s own `alpnProtocol`property. - * @since v9.4.0 - */ - readonly alpnProtocol?: string | undefined; - /** - * Will be `true` if this `Http2Session` instance has been closed, otherwise`false`. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Will be `true` if this `Http2Session` instance is still connecting, will be set - * to `false` before emitting `connect` event and/or calling the `http2.connect`callback. - * @since v10.0.0 - */ - readonly connecting: boolean; - /** - * Will be `true` if this `Http2Session` instance has been destroyed and must no - * longer be used, otherwise `false`. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Value is `undefined` if the `Http2Session` session socket has not yet been - * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, - * and `false` if the `Http2Session` is connected to any other kind of socket - * or stream. - * @since v9.4.0 - */ - readonly encrypted?: boolean | undefined; - /** - * A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance. - * @since v8.4.0 - */ - readonly localSettings: Settings; - /** - * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property - * will return an `Array` of origins for which the `Http2Session` may be - * considered authoritative. - * - * The `originSet` property is only available when using a secure TLS connection. - * @since v9.4.0 - */ - readonly originSet?: string[] | undefined; - /** - * Indicates whether the `Http2Session` is currently waiting for acknowledgment of - * a sent `SETTINGS` frame. Will be `true` after calling the`http2session.settings()` method. Will be `false` once all sent `SETTINGS`frames have been acknowledged. - * @since v8.4.0 - */ - readonly pendingSettingsAck: boolean; - /** - * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer. - * @since v8.4.0 - */ - readonly remoteSettings: Settings; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * limits available methods to ones safe to use with HTTP/2. - * - * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw - * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. - * - * `setTimeout` method will be called on this `Http2Session`. - * - * All other interactions will be routed directly to the socket. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * Provides miscellaneous information about the current state of the`Http2Session`. - * - * An object describing the current status of this `Http2Session`. - * @since v8.4.0 - */ - readonly state: SessionState; - /** - * The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a - * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a - * client. - * @since v8.4.0 - */ - readonly type: number; - /** - * Gracefully closes the `Http2Session`, allowing any existing streams to - * complete on their own and preventing new `Http2Stream` instances from being - * created. Once closed, `http2session.destroy()`_might_ be called if there - * are no open `Http2Stream` instances. - * - * If specified, the `callback` function is registered as a handler for the`'close'` event. - * @since v9.4.0 - */ - close(callback?: () => void): void; - /** - * Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`. - * - * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event. - * - * If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed. - * @since v8.4.0 - * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. - * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. - */ - destroy(error?: Error, code?: number): void; - /** - * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. - * @since v9.4.0 - * @param code An HTTP/2 error code - * @param lastStreamID The numeric ID of the last processed `Http2Stream` - * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. - */ - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - /** - * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must - * be provided. The method will return `true` if the `PING` was sent, `false`otherwise. - * - * The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10. - * - * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView`containing 8 bytes of data that will be transmitted with the `PING` and - * returned with the ping acknowledgment. - * - * The callback will be invoked with three arguments: an error argument that will - * be `null` if the `PING` was successfully acknowledged, a `duration` argument - * that reports the number of milliseconds elapsed since the ping was sent and the - * acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload. - * - * ```js - * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { - * if (!err) { - * console.log(`Ping acknowledged in ${duration} milliseconds`); - * console.log(`With payload '${payload.toString()}'`); - * } - * }); - * ``` - * - * If the `payload` argument is not specified, the default payload will be the - * 64-bit timestamp (little endian) marking the start of the `PING` duration. - * @since v8.9.3 - * @param payload Optional ping payload. - */ - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ping( - payload: NodeJS.ArrayBufferView, - callback: (err: Error | null, duration: number, payload: Buffer) => void, - ): boolean; - /** - * Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`. - * @since v9.4.0 - */ - ref(): void; - /** - * Sets the local endpoint's window size. - * The `windowSize` is the total window size to set, not - * the delta. - * - * ```js - * const http2 = require('node:http2'); - * - * const server = http2.createServer(); - * const expectedWindowSize = 2 ** 20; - * server.on('connect', (session) => { - * - * // Set local window size to be 2 ** 20 - * session.setLocalWindowSize(expectedWindowSize); - * }); - * ``` - * @since v15.3.0, v14.18.0 - */ - setLocalWindowSize(windowSize: number): void; - /** - * Used to set a callback function that is called when there is no activity on - * the `Http2Session` after `msecs` milliseconds. The given `callback` is - * registered as a listener on the `'timeout'` event. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer. - * - * Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new - * settings. - * - * The new settings will not become effective until the `SETTINGS` acknowledgment - * is received and the `'localSettings'` event is emitted. It is possible to send - * multiple `SETTINGS` frames while acknowledgment is still pending. - * @since v8.4.0 - * @param callback Callback that is called once the session is connected or right away if the session is already connected. - */ - settings( - settings: Settings, - callback?: (err: Error | null, settings: Settings, duration: number) => void, - ): void; - /** - * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. - * @since v9.4.0 - */ - unref(): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - addListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - prependListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - prependOnceListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Session extends Http2Session { - /** - * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an - * HTTP/2 request to the connected server. - * - * When a `ClientHttp2Session` is first created, the socket may not yet be - * connected. if `clienthttp2session.request()` is called during this time, the - * actual request will be deferred until the socket is ready to go. - * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown. - * - * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`. - * - * ```js - * const http2 = require('node:http2'); - * const clientSession = http2.connect('https://localhost:1234'); - * const { - * HTTP2_HEADER_PATH, - * HTTP2_HEADER_STATUS, - * } = http2.constants; - * - * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); - * req.on('response', (headers) => { - * console.log(headers[HTTP2_HEADER_STATUS]); - * req.on('data', (chunk) => { // .. }); - * req.on('end', () => { // .. }); - * }); - * ``` - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * is emitted immediately after queuing the last chunk of payload data to be sent. - * The `http2stream.sendTrailers()` method can then be called to send trailing - * headers to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * When `options.signal` is set with an `AbortSignal` and then `abort` on the - * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. - * - * The `:method` and `:path` pseudo-headers are not specified within `headers`, - * they respectively default to: - * - * * `:method` \= `'GET'` - * * `:path` \= `/` - * @since v8.4.0 - */ - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - addListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: readonly string[]): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit( - event: "stream", - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - once( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependOnceListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - export interface ServerHttp2Session extends Http2Session { - readonly server: Http2Server | Http2SecureServer; - /** - * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. - * - * ```js - * const http2 = require('node:http2'); - * - * const server = http2.createServer(); - * server.on('session', (session) => { - * // Set altsvc for origin https://example.org:80 - * session.altsvc('h2=":8000"', 'https://example.org:80'); - * }); - * - * server.on('stream', (stream) => { - * // Set altsvc for a specific stream - * stream.session.altsvc('h2=":8000"', stream.id); - * }); - * ``` - * - * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate - * service is associated with the origin of the given `Http2Stream`. - * - * The `alt` and origin string _must_ contain only ASCII bytes and are - * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given - * domain. - * - * When a string is passed for the `originOrStream` argument, it will be parsed as - * a URL and the origin will be derived. For instance, the origin for the - * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * @since v9.4.0 - * @param alt A description of the alternative service configuration as defined by `RFC 7838`. - * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the - * `http2stream.id` property. - */ - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - /** - * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client - * to advertise the set of origins for which the server is capable of providing - * authoritative responses. - * - * ```js - * const http2 = require('node:http2'); - * const options = getSecureOptionsSomehow(); - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * server.on('session', (session) => { - * session.origin('https://example.com', 'https://example.org'); - * }); - * ``` - * - * When a string is passed as an `origin`, it will be parsed as a URL and the - * origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given - * string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as - * an `origin`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * - * Alternatively, the `origins` option may be used when creating a new HTTP/2 - * server using the `http2.createSecureServer()` method: - * - * ```js - * const http2 = require('node:http2'); - * const options = getSecureOptionsSomehow(); - * options.origins = ['https://example.com', 'https://example.org']; - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * ``` - * @since v10.12.0 - * @param origins One or more URL Strings passed as separate arguments. - */ - origin( - ...origins: Array< - | string - | url.URL - | { - origin: string; - } - > - ): void; - addListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - // Http2Server - export interface SessionOptions { - maxDeflateDynamicTableSize?: number | undefined; - maxSessionMemory?: number | undefined; - maxHeaderListPairs?: number | undefined; - maxOutstandingPings?: number | undefined; - maxSendHeaderBlockLength?: number | undefined; - paddingStrategy?: number | undefined; - peerMaxConcurrentStreams?: number | undefined; - settings?: Settings | undefined; - /** - * Specifies a timeout in milliseconds that - * a server should wait when an [`'unknownProtocol'`][] is emitted. If the - * socket has not been destroyed by that time the server will destroy it. - * @default 100000 - */ - unknownProtocolTimeout?: number | undefined; - selectPadding?(frameLen: number, maxFrameLen: number): number; - } - export interface ClientSessionOptions extends SessionOptions { - maxReservedRemoteStreams?: number | undefined; - createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; - protocol?: "http:" | "https:" | undefined; - } - export interface ServerSessionOptions extends SessionOptions { - Http1IncomingMessage?: typeof IncomingMessage | undefined; - Http1ServerResponse?: typeof ServerResponse | undefined; - Http2ServerRequest?: typeof Http2ServerRequest | undefined; - Http2ServerResponse?: typeof Http2ServerResponse | undefined; - } - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {} - export interface ServerOptions extends ServerSessionOptions {} - export interface SecureServerOptions extends SecureServerSessionOptions { - allowHTTP1?: boolean | undefined; - origins?: string[] | undefined; - } - interface HTTP2ServerCommon { - setTimeout(msec?: number, callback?: () => void): this; - /** - * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. - * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. - */ - updateSettings(settings: Settings): void; - } - export interface Http2Server extends net.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, - * headers, and - * data. - * @since v8.4.0 - */ - export class Http2ServerRequest extends stream.Readable { - constructor( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - options: stream.ReadableOptions, - rawHeaders: readonly string[], - ); - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - */ - readonly aborted: boolean; - /** - * The request authority pseudo header field. Because HTTP/2 allows requests - * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`. - * @since v8.4.0 - */ - readonly authority: string; - /** - * See `request.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * The `request.complete` property will be `true` if the request has - * been completed, aborted, or destroyed. - * @since v12.10.0 - */ - readonly complete: boolean; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * See `HTTP/2 Headers Object`. - * - * In HTTP/2, the request path, host name, protocol, and method are represented as - * special headers prefixed with the `:` character (e.g. `':path'`). These special - * headers will be included in the `request.headers` object. Care must be taken not - * to inadvertently modify these special headers or errors may occur. For instance, - * removing all headers from the request will cause errors to occur: - * - * ```js - * removeAllHeaders(request.headers); - * assert(request.url); // Fails because the :path header has been removed - * ``` - * @since v8.4.0 - */ - readonly headers: IncomingHttpHeaders; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. Returns`'2.0'`. - * - * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. - * @since v8.4.0 - */ - readonly httpVersion: string; - readonly httpVersionMinor: number; - readonly httpVersionMajor: number; - /** - * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. - * @since v8.4.0 - */ - readonly method: string; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v8.4.0 - */ - readonly rawHeaders: string[]; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly rawTrailers: string[]; - /** - * The request scheme pseudo header field indicating the scheme - * portion of the target URL. - * @since v8.4.0 - */ - readonly scheme: string; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `request.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`. - * - * `setTimeout` method will be called on `request.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. With TLS support, - * use `request.socket.getPeerCertificate()` to obtain the client's - * authentication details. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the request. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly trailers: IncomingHttpHeaders; - /** - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. If the request is: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * Then `request.url` will be: - * - * ```js - * '/status?name=ryan' - * ``` - * - * To parse the url into its parts, `new URL()` can be used: - * - * ```console - * $ node - * > new URL('/status?name=ryan', 'http://example.com') - * URL { - * href: 'http://example.com/status?name=ryan', - * origin: 'http://example.com', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'example.com', - * hostname: 'example.com', - * port: '', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * @since v8.4.0 - */ - url: string; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream` s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v8.4.0 - */ - export class Http2ServerResponse extends stream.Writable { - constructor(stream: ServerHttp2Stream); - /** - * See `response.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * Boolean value that indicates whether the response has completed. Starts - * as `false`. After `response.end()` executes, the value will be `true`. - * @since v8.4.0 - * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. - */ - readonly finished: boolean; - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * A reference to the original HTTP2 `request` object. - * @since v15.7.0 - */ - readonly req: Http2ServerRequest; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `response.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`. - * - * `setTimeout` method will be called on `response.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer((req, res) => { - * const ip = req.socket.remoteAddress; - * const port = req.socket.remotePort; - * res.end(`Your IP address is ${ip} and your source port is ${port}.`); - * }).listen(3000); - * ``` - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the response. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * When true, the Date header will be automatically generated and sent in - * the response if it is not already present in the headers. Defaults to true. - * - * This should only be disabled for testing; HTTP requires the Date header - * in responses. - * @since v8.4.0 - */ - sendDate: boolean; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v8.4.0 - */ - statusCode: number; - /** - * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns - * an empty string. - * @since v8.4.0 - */ - statusMessage: ""; - /** - * This method adds HTTP trailing headers (a header but at the end of the - * message) to the response. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - addTrailers(trailers: OutgoingHttpHeaders): void; - /** - * This method signals to the server that all of the response headers and body - * have been sent; that server should consider this message complete. - * The method, `response.end()`, MUST be called on each response. - * - * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. - * - * If `callback` is specified, it will be called when the response stream - * is finished. - * @since v8.4.0 - */ - end(callback?: () => void): this; - end(data: string | Uint8Array, callback?: () => void): this; - end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; - /** - * Reads out a header that has already been queued but not sent to the client. - * The name is case-insensitive. - * - * ```js - * const contentType = response.getHeader('content-type'); - * ``` - * @since v8.4.0 - */ - getHeader(name: string): string; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All header names are lowercase. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = response.getHeaderNames(); - * // headerNames === ['foo', 'set-cookie'] - * ``` - * @since v8.4.0 - */ - getHeaderNames(): string[]; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow copy - * is used, array values may be mutated without additional calls to various - * header-related http module methods. The keys of the returned object are the - * header names and the values are the respective header values. All header names - * are lowercase. - * - * The object returned by the `response.getHeaders()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = response.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v8.4.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name matching is case-insensitive. - * - * ```js - * const hasContentType = response.hasHeader('content-type'); - * ``` - * @since v8.4.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that has been queued for implicit sending. - * - * ```js - * response.removeHeader('Content-Encoding'); - * ``` - * @since v8.4.0 - */ - removeHeader(name: string): void; - /** - * Sets a single header value for implicit headers. If this header already exists - * in the to-be-sent headers, its value will be replaced. Use an array of strings - * here to send multiple headers with the same name. - * - * ```js - * response.setHeader('Content-Type', 'text/html; charset=utf-8'); - * ``` - * - * or - * - * ```js - * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * @since v8.4.0 - */ - setHeader(name: string, value: number | string | readonly string[]): void; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream` s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * If this method is called and `response.writeHead()` has not been called, - * it will switch to implicit header mode and flush the implicit headers. - * - * This sends a chunk of the response body. This method may - * be called multiple times to provide successive parts of the body. - * - * In the `node:http` module, the response body is omitted when the - * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. - * - * `chunk` can be a string or a buffer. If `chunk` is a string, - * the second parameter specifies how to encode it into a byte stream. - * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk - * of data is flushed. - * - * This is the raw HTTP body and has nothing to do with higher-level multi-part - * body encodings that may be used. - * - * The first time `response.write()` is called, it will send the buffered - * header information and the first chunk of the body to the client. The second - * time `response.write()` is called, Node.js assumes data will be streamed, - * and sends the new data separately. That is, the response is buffered up to the - * first chunk of the body. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. - * @since v8.4.0 - */ - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; - /** - * Sends a status `100 Continue` to the client, indicating that the request body - * should be sent. See the `'checkContinue'` event on `Http2Server` and`Http2SecureServer`. - * @since v8.4.0 - */ - writeContinue(): void; - /** - * Sends a status `103 Early Hints` to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }); - * ``` - * @since v18.11.0 - */ - writeEarlyHints(hints: Record): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * - * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. - * - * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be - * passed as the second argument. However, because the `statusMessage` has no - * meaning within HTTP/2, the argument will have no effect and a process warning - * will be emitted. - * - * ```js - * const body = 'hello world'; - * response.writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain; charset=utf-8', - * }); - * ``` - * - * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a - * given encoding. On outbound messages, Node.js does not check if Content-Length - * and the length of the body being transmitted are equal or not. However, when - * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size. - * - * This method may be called at most one time on a message before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - /** - * Call `http2stream.pushStream()` with the given headers, and wrap the - * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback - * parameter if successful. When `Http2ServerRequest` is closed, the callback is - * called with an error `ERR_HTTP2_INVALID_STREAM`. - * @since v8.4.0 - * @param headers An object describing the headers - * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of - * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method - */ - createPushResponse( - headers: OutgoingHttpHeaders, - callback: (err: Error | null, res: Http2ServerResponse) => void, - ): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - /** - * This symbol can be set as a property on the HTTP/2 headers object with - * an array value in order to provide a list of headers considered sensitive. - */ - export const sensitiveHeaders: symbol; - /** - * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called - * so instances returned may be safely modified for use. - * @since v8.4.0 - */ - export function getDefaultSettings(): Settings; - /** - * Returns a `Buffer` instance containing serialized representation of the given - * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended - * for use with the `HTTP2-Settings` header field. - * - * ```js - * const http2 = require('node:http2'); - * - * const packed = http2.getPackedSettings({ enablePush: false }); - * - * console.log(packed.toString('base64')); - * // Prints: AAIAAAAA - * ``` - * @since v8.4.0 - */ - export function getPackedSettings(settings: Settings): Buffer; - /** - * Returns a `HTTP/2 Settings Object` containing the deserialized settings from - * the given `Buffer` as generated by `http2.getPackedSettings()`. - * @since v8.4.0 - * @param buf The packed settings. - */ - export function getUnpackedSettings(buf: Uint8Array): Settings; - /** - * Returns a `net.Server` instance that creates and manages `Http2Session`instances. - * - * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when - * communicating - * with browser clients. - * - * ```js - * const http2 = require('node:http2'); - * - * // Create an unencrypted HTTP/2 server. - * // Since there are no browsers known that support - * // unencrypted HTTP/2, the use of `http2.createSecureServer()` - * // is necessary when communicating with browser clients. - * const server = http2.createServer(); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

Hello World

'); - * }); - * - * server.listen(8000); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2Server; - export function createServer( - options: ServerOptions, - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2Server; - /** - * Returns a `tls.Server` instance that creates and manages `Http2Session`instances. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * }; - * - * // Create a secure HTTP/2 server - * const server = http2.createSecureServer(options); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

Hello World

'); - * }); - * - * server.listen(8443); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createSecureServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2SecureServer; - export function createSecureServer( - options: SecureServerOptions, - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2SecureServer; - /** - * Returns a `ClientHttp2Session` instance. - * - * ```js - * const http2 = require('node:http2'); - * const client = http2.connect('https://localhost:1234'); - * - * // Use the client - * - * client.close(); - * ``` - * @since v8.4.0 - * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port - * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. - * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. - */ - export function connect( - authority: string | url.URL, - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; -} -declare module "node:http2" { - export * from "http2"; -} diff --git a/reverse_engineering/node_modules/@types/node/https.d.ts b/reverse_engineering/node_modules/@types/node/https.d.ts deleted file mode 100644 index 36ae5b2f..00000000 --- a/reverse_engineering/node_modules/@types/node/https.d.ts +++ /dev/null @@ -1,550 +0,0 @@ -/** - * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a - * separate module. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js) - */ -declare module "https" { - import { Duplex } from "node:stream"; - import * as tls from "node:tls"; - import * as http from "node:http"; - import { URL } from "node:url"; - type ServerOptions< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; - type RequestOptions = - & http.RequestOptions - & tls.SecureContextOptions - & { - checkServerIdentity?: typeof tls.checkServerIdentity | undefined; - rejectUnauthorized?: boolean | undefined; // Defaults to true - servername?: string | undefined; // SNI TLS Extension - }; - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - rejectUnauthorized?: boolean | undefined; - maxCachedSessions?: number | undefined; - } - /** - * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. - * @since v0.4.5 - */ - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - } - interface Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > extends http.Server {} - /** - * See `http.Server` for more information. - * @since v0.3.4 - */ - class Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor( - options: ServerOptions, - requestListener?: http.RequestListener, - ); - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Duplex) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: http.RequestListener): this; - addListener(event: "checkExpectation", listener: http.RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - addListener(event: "request", listener: http.RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean; - emit( - event: "newSession", - sessionId: Buffer, - sessionData: Buffer, - callback: (err: Error, resp: Buffer) => void, - ): boolean; - emit( - event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; - emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Duplex): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit(event: "clientError", err: Error, socket: Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: Duplex, head: Buffer): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: Duplex, head: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - on( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - on( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Duplex) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: http.RequestListener): this; - on(event: "checkExpectation", listener: http.RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - on(event: "request", listener: http.RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Duplex) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: http.RequestListener): this; - once(event: "checkExpectation", listener: http.RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - once(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - once(event: "request", listener: http.RequestListener): this; - once(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Duplex) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: http.RequestListener): this; - prependListener(event: "checkExpectation", listener: http.RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependListener(event: "request", listener: http.RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: http.RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: http.RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: "request", listener: http.RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - } - /** - * ```js - * // curl -k https://localhost:8000/ - * const https = require('node:https'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * - * Or - * - * ```js - * const https = require('node:https'); - * const fs = require('node:fs'); - * - * const options = { - * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), - * passphrase: 'sample', - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * @since v0.3.4 - * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. - * @param requestListener A listener to be added to the `'request'` event. - */ - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - >(requestListener?: http.RequestListener): Server; - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - >( - options: ServerOptions, - requestListener?: http.RequestListener, - ): Server; - /** - * Makes a request to a secure web server. - * - * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`, - * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * const https = require('node:https'); - * - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * }; - * - * const req = https.request(options, (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(e); - * }); - * req.end(); - * ``` - * - * Example using options from `tls.connect()`: - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * options.agent = new https.Agent(options); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Alternatively, opt out of connection pooling by not using an `Agent`. - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * agent: false, - * }; - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('https://abc:xyz@example.com'); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): - * - * ```js - * const tls = require('node:tls'); - * const https = require('node:https'); - * const crypto = require('node:crypto'); - * - * function sha256(s) { - * return crypto.createHash('sha256').update(s).digest('base64'); - * } - * const options = { - * hostname: 'github.com', - * port: 443, - * path: '/', - * method: 'GET', - * checkServerIdentity: function(host, cert) { - * // Make sure the certificate is issued to the host we are connected to - * const err = tls.checkServerIdentity(host, cert); - * if (err) { - * return err; - * } - * - * // Pin the public key, similar to HPKP pin-sha256 pinning - * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; - * if (sha256(cert.pubkey) !== pubkey256) { - * const msg = 'Certificate verification error: ' + - * `The public key of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // Pin the exact certificate, rather than the pub key - * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + - * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; - * if (cert.fingerprint256 !== cert256) { - * const msg = 'Certificate verification error: ' + - * `The certificate of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // This loop is informational only. - * // Print the certificate and public key fingerprints of all certs in the - * // chain. Its common to pin the public key of the issuer on the public - * // internet, while pinning the public key of the service in sensitive - * // environments. - * do { - * console.log('Subject Common Name:', cert.subject.CN); - * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); - * - * hash = crypto.createHash('sha256'); - * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); - * - * lastprint256 = cert.fingerprint256; - * cert = cert.issuerCertificate; - * } while (cert.fingerprint256 !== lastprint256); - * - * }, - * }; - * - * options.agent = new https.Agent(options); - * const req = https.request(options, (res) => { - * console.log('All OK. Server matched our pinned cert or public key'); - * console.log('statusCode:', res.statusCode); - * // Print the HPKP values - * console.log('headers:', res.headers['public-key-pins']); - * - * res.on('data', (d) => {}); - * }); - * - * req.on('error', (e) => { - * console.error(e.message); - * }); - * req.end(); - * ``` - * - * Outputs for example: - * - * ```text - * Subject Common Name: github.com - * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 - * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= - * Subject Common Name: DigiCert SHA2 Extended Validation Server CA - * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A - * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= - * Subject Common Name: DigiCert High Assurance EV Root CA - * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF - * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= - * All OK. Server matched our pinned cert or public key - * statusCode: 200 - * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; - * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; - * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains - * ``` - * @since v0.3.6 - * @param options Accepts all `options` from `request`, with some differences in default values: - */ - function request( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - /** - * Like `http.get()` but for HTTPS. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * ```js - * const https = require('node:https'); - * - * https.get('https://encrypted.google.com/', (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * - * }).on('error', (e) => { - * console.error(e); - * }); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. - */ - function get( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function get( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - let globalAgent: Agent; -} -declare module "node:https" { - export * from "https"; -} diff --git a/reverse_engineering/node_modules/@types/node/index.d.ts b/reverse_engineering/node_modules/@types/node/index.d.ts deleted file mode 100644 index a596cad0..00000000 --- a/reverse_engineering/node_modules/@types/node/index.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * License for programmatically and manually incorporated - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc - * - * Copyright Node.js contributors. All rights reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -// NOTE: These definitions support NodeJS and TypeScript 4.9+. - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - -/// diff --git a/reverse_engineering/node_modules/@types/node/inspector.d.ts b/reverse_engineering/node_modules/@types/node/inspector.d.ts deleted file mode 100644 index 3927b816..00000000 --- a/reverse_engineering/node_modules/@types/node/inspector.d.ts +++ /dev/null @@ -1,2747 +0,0 @@ -// Type definitions for inspector - -// These definitions are auto-generated. -// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 -// for more information. - - -/** - * The `node:inspector` module provides an API for interacting with the V8 - * inspector. - * - * It can be accessed using: - * - * ```js - * import * as inspector from 'node:inspector/promises'; - * ``` - * - * or - * - * ```js - * import * as inspector from 'node:inspector'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js) - */ -declare module 'inspector' { - import EventEmitter = require('node:events'); - interface InspectorNotification { - method: string; - params: T; - } - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string | undefined; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId | undefined; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview | undefined; - /** - * @experimental - */ - customPreview?: CustomPreview | undefined; - } - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId | undefined; - } - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[] | undefined; - } - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string | undefined; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview | undefined; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - } - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview | undefined; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean | undefined; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject | undefined; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject | undefined; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean | undefined; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean | undefined; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject | undefined; - } - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - } - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId | undefined; - } - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: {} | undefined; - } - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId | undefined; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string | undefined; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace | undefined; - /** - * Exception object if available. - */ - exception?: RemoteObject | undefined; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId | undefined; - } - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string | undefined; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace | undefined; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId | undefined; - } - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId | undefined; - } - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - } - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId | undefined; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[] | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string | undefined; - } - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean | undefined; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean | undefined; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean | undefined; - } - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[] | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace | undefined; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string | undefined; - } - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: {}; - } - } - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - /** - * Call frame identifier. - */ - type CallFrameId = string; - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - } - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location | undefined; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject | undefined; - } - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string | undefined; - /** - * Location in the source code where scope starts - */ - startLocation?: Location | undefined; - /** - * Location in the source code where scope ends - */ - endLocation?: Location | undefined; - } - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - type?: string | undefined; - } - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string | undefined; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string | undefined; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string | undefined; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number | undefined; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location | undefined; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean | undefined; - } - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string | undefined; - } - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean | undefined; - } - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean | undefined; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean | undefined; - } - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean | undefined; - } - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string | undefined; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean | undefined; - } - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[] | undefined; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - } - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {} | undefined; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {} | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {} | undefined; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[] | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId | undefined; - } - } - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string | undefined; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number | undefined; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number | undefined; - } - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number | undefined; - /** - * Child node ids. - */ - children?: number[] | undefined; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string | undefined; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[] | undefined; - } - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[] | undefined; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[] | undefined; - } - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - /** - * Describes a type collected during runtime. - * @experimental - */ - interface TypeObject { - /** - * Name of a type collected with type profiling. - */ - name: string; - } - /** - * Source offset and types for a parameter or return value. - * @experimental - */ - interface TypeProfileEntry { - /** - * Source offset of the parameter or end of function for return values. - */ - offset: number; - /** - * The types for this parameter or return value. - */ - types: TypeObject[]; - } - /** - * Type profile data collected during runtime for a JavaScript script. - * @experimental - */ - interface ScriptTypeProfile { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Type profile entries for parameters and return values of the functions in the script. - */ - entries: TypeProfileEntry[]; - } - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean | undefined; - /** - * Collect block-based coverage. - */ - detailed?: boolean | undefined; - } - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface TakeTypeProfileReturnType { - /** - * Type profile for all scripts since startTypeProfile() was turned on. - */ - result: ScriptTypeProfile[]; - } - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - } - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean | undefined; - } - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean | undefined; - } - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean | undefined; - } - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - } - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number | undefined; - } - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean | undefined; - } - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string | undefined; - /** - * Included category filters. - */ - includedCategories: string[]; - } - interface StartParameterType { - traceConfig: TraceConfig; - } - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - interface DataCollectedEventDataType { - value: Array<{}>; - } - } - namespace NodeWorker { - type WorkerID = string; - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - interface DetachParameterType { - sessionId: SessionID; - } - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - /** - * The `inspector.Session` is used for dispatching messages to the V8 inspector - * back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. - */ - constructor(); - /** - * Connects a session to the inspector back-end. - * @since v8.0.0 - */ - connect(): void; - /** - * Immediately close the session. All pending message callbacks will be called - * with an error. `session.connect()` will need to be called to be able to send - * messages again. Reconnected session will lose all inspector state, such as - * enabled agents or configured breakpoints. - * @since v8.0.0 - */ - disconnect(): void; - /** - * Posts a message to the inspector back-end. `callback` will be notified when - * a response is received. `callback` is a function that accepts two optional - * arguments: error and message-specific result. - * - * ```js - * session.post('Runtime.evaluate', { expression: '2 + 2' }, - * (error, { result }) => console.log(result)); - * // Output: { type: 'number', value: 4, description: '4' } - * ``` - * - * The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). - * - * Node.js inspector supports all the Chrome DevTools Protocol domains declared - * by V8\. Chrome DevTools Protocol domain provides an interface for interacting - * with one of the runtime agents used to inspect the application state and listen - * to the run-time events. - * - * ## Example usage - * - * Apart from the debugger, various V8 Profilers are available through the DevTools - * protocol. - * @since v8.0.0 - */ - post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; - post(method: string, callback?: (err: Error | null, params?: {}) => void): void; - /** - * Returns supported domains. - */ - post(method: 'Schema.getDomains', callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - /** - * Evaluates expression on global object. - */ - post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: 'Runtime.evaluate', callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - /** - * Add handler to promise with given promise object id. - */ - post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: 'Runtime.awaitPromise', callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: 'Runtime.callFunctionOn', callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: 'Runtime.getProperties', callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - /** - * Releases remote object with given id. - */ - post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.releaseObject', callback?: (err: Error | null) => void): void; - /** - * Releases all remote objects that belong to a given group. - */ - post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.releaseObjectGroup', callback?: (err: Error | null) => void): void; - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: 'Runtime.runIfWaitingForDebugger', callback?: (err: Error | null) => void): void; - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: 'Runtime.enable', callback?: (err: Error | null) => void): void; - /** - * Disables reporting of execution contexts creation. - */ - post(method: 'Runtime.disable', callback?: (err: Error | null) => void): void; - /** - * Discards collected exceptions and console API calls. - */ - post(method: 'Runtime.discardConsoleEntries', callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.setCustomObjectFormatterEnabled', callback?: (err: Error | null) => void): void; - /** - * Compiles expression. - */ - post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: 'Runtime.compileScript', callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - /** - * Runs script with given id in a given context. - */ - post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: 'Runtime.runScript', callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: 'Runtime.queryObjects', callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: 'Runtime.globalLexicalScopeNames', - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: 'Runtime.globalLexicalScopeNames', callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: 'Debugger.enable', callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - /** - * Disables debugger for given page. - */ - post(method: 'Debugger.disable', callback?: (err: Error | null) => void): void; - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBreakpointsActive', callback?: (err: Error | null) => void): void; - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setSkipAllPauses', callback?: (err: Error | null) => void): void; - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: 'Debugger.setBreakpointByUrl', callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: 'Debugger.setBreakpoint', callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - /** - * Removes JavaScript breakpoint. - */ - post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.removeBreakpoint', callback?: (err: Error | null) => void): void; - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: 'Debugger.getPossibleBreakpoints', - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: 'Debugger.getPossibleBreakpoints', callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - /** - * Continues execution until specific location is reached. - */ - post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.continueToLocation', callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.pauseOnAsyncCall', callback?: (err: Error | null) => void): void; - /** - * Steps over the statement. - */ - post(method: 'Debugger.stepOver', callback?: (err: Error | null) => void): void; - /** - * Steps into the function call. - */ - post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.stepInto', callback?: (err: Error | null) => void): void; - /** - * Steps out of the function call. - */ - post(method: 'Debugger.stepOut', callback?: (err: Error | null) => void): void; - /** - * Stops on the next JavaScript statement. - */ - post(method: 'Debugger.pause', callback?: (err: Error | null) => void): void; - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: 'Debugger.scheduleStepIntoAsync', callback?: (err: Error | null) => void): void; - /** - * Resumes JavaScript execution. - */ - post(method: 'Debugger.resume', callback?: (err: Error | null) => void): void; - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: 'Debugger.getStackTrace', callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - /** - * Searches for given string in script content. - */ - post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: 'Debugger.searchInContent', callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - /** - * Edits JavaScript source live. - */ - post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: 'Debugger.setScriptSource', callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - /** - * Restarts particular call frame from the beginning. - */ - post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: 'Debugger.restartFrame', callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - /** - * Returns source for the script with given id. - */ - post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: 'Debugger.getScriptSource', callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setPauseOnExceptions', callback?: (err: Error | null) => void): void; - /** - * Evaluates expression on a given call frame. - */ - post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: 'Debugger.evaluateOnCallFrame', callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setVariableValue', callback?: (err: Error | null) => void): void; - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setReturnValue', callback?: (err: Error | null) => void): void; - /** - * Enables or disables async call stacks tracking. - */ - post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setAsyncCallStackDepth', callback?: (err: Error | null) => void): void; - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBlackboxPatterns', callback?: (err: Error | null) => void): void; - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBlackboxedRanges', callback?: (err: Error | null) => void): void; - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: 'Console.enable', callback?: (err: Error | null) => void): void; - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: 'Console.disable', callback?: (err: Error | null) => void): void; - /** - * Does nothing. - */ - post(method: 'Console.clearMessages', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.enable', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.disable', callback?: (err: Error | null) => void): void; - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Profiler.setSamplingInterval', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.start', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.stop', callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Profiler.startPreciseCoverage', callback?: (err: Error | null) => void): void; - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: 'Profiler.stopPreciseCoverage', callback?: (err: Error | null) => void): void; - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: 'Profiler.takePreciseCoverage', callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: 'Profiler.getBestEffortCoverage', callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - /** - * Enable type profile. - * @experimental - */ - post(method: 'Profiler.startTypeProfile', callback?: (err: Error | null) => void): void; - /** - * Disable type profile. Disabling releases type profile data collected so far. - * @experimental - */ - post(method: 'Profiler.stopTypeProfile', callback?: (err: Error | null) => void): void; - /** - * Collect type profile. - * @experimental - */ - post(method: 'Profiler.takeTypeProfile', callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; - post(method: 'HeapProfiler.enable', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.disable', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startTrackingHeapObjects', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopTrackingHeapObjects', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.takeHeapSnapshot', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.collectGarbage', callback?: (err: Error | null) => void): void; - post( - method: 'HeapProfiler.getObjectByHeapObjectId', - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: 'HeapProfiler.getObjectByHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.addInspectedHeapObject', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: 'HeapProfiler.getHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startSampling', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopSampling', callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - post(method: 'HeapProfiler.getSamplingProfile', callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - /** - * Gets supported tracing categories. - */ - post(method: 'NodeTracing.getCategories', callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - /** - * Start trace events collection. - */ - post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeTracing.start', callback?: (err: Error | null) => void): void; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: 'NodeTracing.stop', callback?: (err: Error | null) => void): void; - /** - * Sends protocol message over session with given id. - */ - post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.sendMessageToWorker', callback?: (err: Error | null) => void): void; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.enable', callback?: (err: Error | null) => void): void; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: 'NodeWorker.disable', callback?: (err: Error | null) => void): void; - /** - * Detached from the worker with given sessionId. - */ - post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void; - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; - // Events - addListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: 'inspectorNotification', message: InspectorNotification<{}>): boolean; - emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; - emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; - emit(event: 'Runtime.executionContextsCleared'): boolean; - emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; - emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; - emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; - emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; - emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; - emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; - emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; - emit(event: 'Debugger.paused', message: InspectorNotification): boolean; - emit(event: 'Debugger.resumed'): boolean; - emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; - emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; - emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.resetProfiles'): boolean; - emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; - emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; - emit(event: 'NodeTracing.tracingComplete'): boolean; - emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; - emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; - emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; - emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; - on(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - on(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - once(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - } - /** - * Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has - * started. - * - * If wait is `true`, will block until a client has connected to the inspect port - * and flow control has been passed to the debugger client. - * - * See the `security warning` regarding the `host`parameter usage. - * @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional. - * @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional. - * @param [wait=false] Block until a client has connected. Optional. - * @returns Disposable that calls `inspector.close()`. - */ - function open(port?: number, host?: string, wait?: boolean): Disposable; - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - /** - * Return the URL of the active inspector, or `undefined` if there is none. - * - * ```console - * $ node --inspect -p 'inspector.url()' - * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * For help, see: https://nodejs.org/en/docs/inspector - * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * - * $ node --inspect=localhost:3000 -p 'inspector.url()' - * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * For help, see: https://nodejs.org/en/docs/inspector - * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * - * $ node -p 'inspector.url()' - * undefined - * ``` - */ - function url(): string | undefined; - /** - * Blocks until a client (existing or connected later) has sent`Runtime.runIfWaitingForDebugger` command. - * - * An exception will be thrown if there is no active inspector. - * @since v12.7.0 - */ - function waitForDebugger(): void; -} -/** - * The inspector module provides an API for interacting with the V8 inspector. - */ -declare module 'node:inspector' { - import inspector = require('inspector'); - export = inspector; -} diff --git a/reverse_engineering/node_modules/@types/node/module.d.ts b/reverse_engineering/node_modules/@types/node/module.d.ts deleted file mode 100644 index 68d59c77..00000000 --- a/reverse_engineering/node_modules/@types/node/module.d.ts +++ /dev/null @@ -1,301 +0,0 @@ -/** - * @since v0.3.7 - * @experimental - */ -declare module "module" { - import { URL } from "node:url"; - import { MessagePort } from "node:worker_threads"; - namespace Module { - /** - * The `module.syncBuiltinESMExports()` method updates all the live bindings for - * builtin `ES Modules` to match the properties of the `CommonJS` exports. It - * does not add or remove exported names from the `ES Modules`. - * - * ```js - * const fs = require('node:fs'); - * const assert = require('node:assert'); - * const { syncBuiltinESMExports } = require('node:module'); - * - * fs.readFile = newAPI; - * - * delete fs.readFileSync; - * - * function newAPI() { - * // ... - * } - * - * fs.newAPI = newAPI; - * - * syncBuiltinESMExports(); - * - * import('node:fs').then((esmFS) => { - * // It syncs the existing readFile property with the new value - * assert.strictEqual(esmFS.readFile, newAPI); - * // readFileSync has been deleted from the required fs - * assert.strictEqual('readFileSync' in fs, false); - * // syncBuiltinESMExports() does not remove readFileSync from esmFS - * assert.strictEqual('readFileSync' in esmFS, true); - * // syncBuiltinESMExports() does not add names - * assert.strictEqual(esmFS.newAPI, undefined); - * }); - * ``` - * @since v12.12.0 - */ - function syncBuiltinESMExports(): void; - /** - * `path` is the resolved path for the file for which a corresponding source map - * should be fetched. - * @since v13.7.0, v12.17.0 - * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. - */ - function findSourceMap(path: string, error?: Error): SourceMap; - interface SourceMapPayload { - file: string; - version: number; - sources: string[]; - sourcesContent: string[]; - names: string[]; - mappings: string; - sourceRoot: string; - } - interface SourceMapping { - generatedLine: number; - generatedColumn: number; - originalSource: string; - originalLine: number; - originalColumn: number; - } - interface SourceOrigin { - /** - * The name of the range in the source map, if one was provided - */ - name?: string; - /** - * The file name of the original source, as reported in the SourceMap - */ - fileName: string; - /** - * The 1-indexed lineNumber of the corresponding call site in the original source - */ - lineNumber: number; - /** - * The 1-indexed columnNumber of the corresponding call site in the original source - */ - columnNumber: number; - } - /** - * @since v13.7.0, v12.17.0 - */ - class SourceMap { - /** - * Getter for the payload used to construct the `SourceMap` instance. - */ - readonly payload: SourceMapPayload; - constructor(payload: SourceMapPayload); - /** - * Given a line offset and column offset in the generated source - * file, returns an object representing the SourceMap range in the - * original file if found, or an empty object if not. - * - * The object returned contains the following keys: - * - * The returned value represents the raw range as it appears in the - * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and - * column numbers as they appear in Error messages and CallSite - * objects. - * - * To get the corresponding 1-indexed line and column numbers from a - * lineNumber and columnNumber as they are reported by Error stacks - * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` - * @param lineOffset The zero-indexed line number offset in the generated source - * @param columnOffset The zero-indexed column number offset in the generated source - */ - findEntry(lineOffset: number, columnOffset: number): SourceMapping; - /** - * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source, - * find the corresponding call site location in the original source. - * - * If the `lineNumber` and `columnNumber` provided are not found in any source map, - * then an empty object is returned. - * @param lineNumber The 1-indexed line number of the call site in the generated source - * @param columnNumber The 1-indexed column number of the call site in the generated source - */ - findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {}; - } - /** @deprecated Use `ImportAttributes` instead */ - interface ImportAssertions extends ImportAttributes {} - interface ImportAttributes extends NodeJS.Dict { - type?: string | undefined; - } - type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm"; - type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; - interface GlobalPreloadContext { - port: MessagePort; - } - /** - * @deprecated This hook will be removed in a future version. - * Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored. - * - * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. - * This hook allows the return of a string that is run as a sloppy-mode script on startup. - * - * @param context Information to assist the preload code - * @return Code to run before application startup - */ - type GlobalPreloadHook = (context: GlobalPreloadContext) => string; - /** - * The `initialize` hook provides a way to define a custom function that runs in the hooks thread - * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`. - * - * This hook can receive data from a `register` invocation, including ports and other transferrable objects. - * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes. - */ - type InitializeHook = (data: Data) => void | Promise; - interface ResolveHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions: ImportAttributes; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - /** - * The module importing this one, or undefined if this is the Node.js entry point - */ - parentURL: string | undefined; - } - interface ResolveFnOutput { - /** - * A hint to the load hook (it might be ignored) - */ - format?: ModuleFormat | null | undefined; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions?: ImportAttributes | undefined; - /** - * The import attributes to use when caching the module (optional; if excluded the input will be used) - */ - importAttributes?: ImportAttributes | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The absolute URL to which this input resolves - */ - url: string; - } - /** - * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. - * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); - * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook. - * - * @param specifier The specified URL path of the module to be resolved - * @param context - * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook - */ - type ResolveHook = ( - specifier: string, - context: ResolveHookContext, - nextResolve: ( - specifier: string, - context?: ResolveHookContext, - ) => ResolveFnOutput | Promise, - ) => ResolveFnOutput | Promise; - interface LoadHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * The format optionally supplied by the `resolve` hook chain - */ - format: ModuleFormat; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions: ImportAttributes; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - } - interface LoadFnOutput { - format: ModuleFormat; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The source for Node.js to evaluate - */ - source?: ModuleSource; - } - /** - * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. - * It is also in charge of validating the import assertion. - * - * @param url The URL/path of the module to be loaded - * @param context Metadata about the module - * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook - */ - type LoadHook = ( - url: string, - context: LoadHookContext, - nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise, - ) => LoadFnOutput | Promise; - } - interface RegisterOptions { - parentURL: string | URL; - data?: Data | undefined; - transferList?: any[] | undefined; - } - interface Module extends NodeModule {} - class Module { - static runMain(): void; - static wrap(code: string): string; - static createRequire(path: string | URL): NodeRequire; - static builtinModules: string[]; - static isBuiltin(moduleName: string): boolean; - static Module: typeof Module; - static register( - specifier: string | URL, - parentURL?: string | URL, - options?: RegisterOptions, - ): void; - static register(specifier: string | URL, options?: RegisterOptions): void; - constructor(id: string, parent?: Module); - } - global { - interface ImportMeta { - url: string; - /** - * Provides a module-relative resolution function scoped to each module, returning - * the URL string. - * - * Second `parent` parameter is only used when the `--experimental-import-meta-resolve` - * command flag enabled. - * - * @since v20.6.0 - * - * @param specifier The module specifier to resolve relative to `parent`. - * @param parent The absolute parent module URL to resolve from. - * @returns The absolute (`file:`) URL string for the resolved module. - */ - resolve(specifier: string, parent?: string | URL | undefined): string; - } - } - export = Module; -} -declare module "node:module" { - import module = require("module"); - export = module; -} diff --git a/reverse_engineering/node_modules/@types/node/net.d.ts b/reverse_engineering/node_modules/@types/node/net.d.ts deleted file mode 100644 index 70789e1b..00000000 --- a/reverse_engineering/node_modules/@types/node/net.d.ts +++ /dev/null @@ -1,949 +0,0 @@ -/** - * > Stability: 2 - Stable - * - * The `node:net` module provides an asynchronous network API for creating stream-based - * TCP or `IPC` servers ({@link createServer}) and clients - * ({@link createConnection}). - * - * It can be accessed using: - * - * ```js - * const net = require('node:net'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js) - */ -declare module "net" { - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import * as dns from "node:dns"; - type LookupFunction = ( - hostname: string, - options: dns.LookupAllOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void, - ) => void; - interface AddressInfo { - address: string; - family: string; - port: number; - } - interface SocketConstructorOpts { - fd?: number | undefined; - allowHalfOpen?: boolean | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - signal?: AbortSignal; - } - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. - * Return false from this function to implicitly pause() the socket. - */ - callback(bytesWritten: number, buf: Uint8Array): boolean; - } - interface ConnectOpts { - /** - * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. - * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will - * still be emitted as normal and methods like pause() and resume() will also behave as expected. - */ - onread?: OnReadOpts | undefined; - } - interface TcpSocketConnectOpts extends ConnectOpts { - port: number; - host?: string | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - hints?: number | undefined; - family?: number | undefined; - lookup?: LookupFunction | undefined; - noDelay?: boolean | undefined; - keepAlive?: boolean | undefined; - keepAliveInitialDelay?: number | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamily?: boolean | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamilyAttemptTimeout?: number | undefined; - } - interface IpcSocketConnectOpts extends ConnectOpts { - path: string; - } - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; - /** - * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint - * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also - * an `EventEmitter`. - * - * A `net.Socket` can be created by the user and used directly to interact with - * a server. For example, it is returned by {@link createConnection}, - * so the user can use it to talk to the server. - * - * It can also be created by Node.js and passed to the user when a connection - * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use - * it to interact with the client. - * @since v0.3.4 - */ - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - /** - * Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately. - * If the socket is still writable it implicitly calls `socket.end()`. - * @since v0.3.4 - */ - destroySoon(): void; - /** - * Sends data on the socket. The second parameter specifies the encoding in the - * case of a string. It defaults to UTF8 encoding. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. - * - * The optional `callback` parameter will be executed when the data is finally - * written out, which may not be immediately. - * - * See `Writable` stream `write()` method for more - * information. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - */ - write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; - write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; - /** - * Initiate a connection on a given socket. - * - * Possible signatures: - * - * * `socket.connect(options[, connectListener])` - * * `socket.connect(path[, connectListener])` for `IPC` connections. - * * `socket.connect(port[, host][, connectListener])` for TCP connections. - * * Returns: `net.Socket` The socket itself. - * - * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, - * instead of a `'connect'` event, an `'error'` event will be emitted with - * the error passed to the `'error'` listener. - * The last parameter `connectListener`, if supplied, will be added as a listener - * for the `'connect'` event **once**. - * - * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined - * behavior. - */ - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - /** - * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. - * @since v0.1.90 - * @return The socket itself. - */ - setEncoding(encoding?: BufferEncoding): this; - /** - * Pauses the reading of data. That is, `'data'` events will not be emitted. - * Useful to throttle back an upload. - * @return The socket itself. - */ - pause(): this; - /** - * Close the TCP connection by sending an RST packet and destroy the stream. - * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. - * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. - * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. - * @since v18.3.0, v16.17.0 - */ - resetAndDestroy(): this; - /** - * Resumes reading after a call to `socket.pause()`. - * @return The socket itself. - */ - resume(): this; - /** - * Sets the socket to timeout after `timeout` milliseconds of inactivity on - * the socket. By default `net.Socket` do not have a timeout. - * - * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to - * end the connection. - * - * ```js - * socket.setTimeout(3000); - * socket.on('timeout', () => { - * console.log('socket timeout'); - * socket.end(); - * }); - * ``` - * - * If `timeout` is 0, then the existing idle timeout is disabled. - * - * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. - * @since v0.1.90 - * @return The socket itself. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Enable/disable the use of Nagle's algorithm. - * - * When a TCP connection is created, it will have Nagle's algorithm enabled. - * - * Nagle's algorithm delays data before it is sent via the network. It attempts - * to optimize throughput at the expense of latency. - * - * Passing `true` for `noDelay` or not passing an argument will disable Nagle's - * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's - * algorithm. - * @since v0.1.90 - * @param [noDelay=true] - * @return The socket itself. - */ - setNoDelay(noDelay?: boolean): this; - /** - * Enable/disable keep-alive functionality, and optionally set the initial - * delay before the first keepalive probe is sent on an idle socket. - * - * Set `initialDelay` (in milliseconds) to set the delay between the last - * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default - * (or previous) setting. - * - * Enabling the keep-alive functionality will set the following socket options: - * - * * `SO_KEEPALIVE=1` - * * `TCP_KEEPIDLE=initialDelay` - * * `TCP_KEEPCNT=10` - * * `TCP_KEEPINTVL=1` - * @since v0.1.92 - * @param [enable=false] - * @param [initialDelay=0] - * @return The socket itself. - */ - setKeepAlive(enable?: boolean, initialDelay?: number): this; - /** - * Returns the bound `address`, the address `family` name and `port` of the - * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - * @since v0.1.90 - */ - address(): AddressInfo | {}; - /** - * Calling `unref()` on a socket will allow the program to exit if this is the only - * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - unref(): this; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). - * If the socket is `ref`ed calling `ref` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - ref(): this; - /** - * This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)` - * and it is an array of the addresses that have been attempted. - * - * Each address is a string in the form of `$IP:$PORT`. - * If the connection was successful, then the last address is the one that the socket is currently connected to. - * @since v19.4.0 - */ - readonly autoSelectFamilyAttemptedAddresses: string[]; - /** - * This property shows the number of characters buffered for writing. The buffer - * may contain strings whose length after encoding is not yet known. So this number - * is only an approximation of the number of bytes in the buffer. - * - * `net.Socket` has the property that `socket.write()` always works. This is to - * help users get up and running quickly. The computer cannot always keep up - * with the amount of data that is written to a socket. The network connection - * simply might be too slow. Node.js will internally queue up the data written to a - * socket and send it out over the wire when it is possible. - * - * The consequence of this internal buffering is that memory may grow. - * Users who experience large or growing `bufferSize` should attempt to - * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. - * @since v0.3.8 - * @deprecated Since v14.6.0 - Use `writableLength` instead. - */ - readonly bufferSize: number; - /** - * The amount of received bytes. - * @since v0.5.3 - */ - readonly bytesRead: number; - /** - * The amount of bytes sent. - * @since v0.5.3 - */ - readonly bytesWritten: number; - /** - * If `true`,`socket.connect(options[, connectListener])` was - * called and has not yet finished. It will stay `true` until the socket becomes - * connected, then it is set to `false` and the `'connect'` event is emitted. Note - * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. - * @since v6.1.0 - */ - readonly connecting: boolean; - /** - * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting - * (see `socket.connecting`). - * @since v11.2.0, v10.16.0 - */ - readonly pending: boolean; - /** - * See `writable.destroyed` for further details. - */ - readonly destroyed: boolean; - /** - * The string representation of the local IP address the remote client is - * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client - * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. - * @since v0.9.6 - */ - readonly localAddress?: string; - /** - * The numeric representation of the local port. For example, `80` or `21`. - * @since v0.9.6 - */ - readonly localPort?: number; - /** - * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. - * @since v18.8.0, v16.18.0 - */ - readonly localFamily?: string; - /** - * This property represents the state of the connection as a string. - * - * * If the stream is connecting `socket.readyState` is `opening`. - * * If the stream is readable and writable, it is `open`. - * * If the stream is readable and not writable, it is `readOnly`. - * * If the stream is not readable and writable, it is `writeOnly`. - * @since v0.5.0 - */ - readonly readyState: SocketReadyState; - /** - * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remoteAddress?: string | undefined; - /** - * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.11.14 - */ - readonly remoteFamily?: string | undefined; - /** - * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remotePort?: number | undefined; - /** - * The socket timeout in milliseconds as set by `socket.setTimeout()`. - * It is `undefined` if a timeout has not been set. - * @since v10.7.0 - */ - readonly timeout?: number | undefined; - /** - * Half-closes the socket. i.e., it sends a FIN packet. It is possible the - * server will still send some data. - * - * See `writable.end()` for further details. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - * @param callback Optional callback for when the socket is finished. - * @return The socket itself. - */ - end(callback?: () => void): this; - end(buffer: Uint8Array | string, callback?: () => void): this; - end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. data - * 4. drain - * 5. end - * 6. error - * 7. lookup - * 8. ready - * 9. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (hadError: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "data", listener: (data: Buffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "timeout", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", hadError: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "data", data: Buffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "ready"): boolean; - emit(event: "timeout"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (hadError: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "data", listener: (data: Buffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - on(event: "ready", listener: () => void): this; - on(event: "timeout", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (hadError: boolean) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - once(event: "ready", listener: () => void): this; - once(event: "timeout", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (hadError: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (hadError: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - interface ListenOptions extends Abortable { - port?: number | undefined; - host?: string | undefined; - backlog?: number | undefined; - path?: string | undefined; - exclusive?: boolean | undefined; - readableAll?: boolean | undefined; - writableAll?: boolean | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - } - interface ServerOpts { - /** - * Indicates whether half-opened TCP connections are allowed. - * @default false - */ - allowHalfOpen?: boolean | undefined; - /** - * Indicates whether the socket should be paused on incoming connections. - * @default false - */ - pauseOnConnect?: boolean | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default false - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - } - interface DropArgument { - localAddress?: string; - localPort?: number; - localFamily?: string; - remoteAddress?: string; - remotePort?: number; - remoteFamily?: string; - } - /** - * This class is used to create a TCP or `IPC` server. - * @since v0.1.90 - */ - class Server extends EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); - /** - * Start a server listening for connections. A `net.Server` can be a TCP or - * an `IPC` server depending on what it listens to. - * - * Possible signatures: - * - * * `server.listen(handle[, backlog][, callback])` - * * `server.listen(options[, callback])` - * * `server.listen(path[, backlog][, callback])` for `IPC` servers - * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers - * - * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` - * event. - * - * All `listen()` methods can take a `backlog` parameter to specify the maximum - * length of the queue of pending connections. The actual length will be determined - * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512). - * - * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for - * details). - * - * The `server.listen()` method can be called again if and only if there was an - * error during the first `server.listen()` call or `server.close()` has been - * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. - * - * One of the most common errors raised when listening is `EADDRINUSE`. - * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry - * after a certain amount of time: - * - * ```js - * server.on('error', (e) => { - * if (e.code === 'EADDRINUSE') { - * console.error('Address in use, retrying...'); - * setTimeout(() => { - * server.close(); - * server.listen(PORT, HOST); - * }, 1000); - * } - * }); - * ``` - */ - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - /** - * Stops the server from accepting new connections and keeps existing - * connections. This function is asynchronous, the server is finally closed - * when all connections are ended and the server emits a `'close'` event. - * The optional `callback` will be called once the `'close'` event occurs. Unlike - * that event, it will be called with an `Error` as its only argument if the server - * was not open when it was closed. - * @since v0.1.90 - * @param callback Called when the server is closed. - */ - close(callback?: (err?: Error) => void): this; - /** - * Returns the bound `address`, the address `family` name, and `port` of the server - * as reported by the operating system if listening on an IP socket - * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. - * - * For a server listening on a pipe or Unix domain socket, the name is returned - * as a string. - * - * ```js - * const server = net.createServer((socket) => { - * socket.end('goodbye\n'); - * }).on('error', (err) => { - * // Handle errors here. - * throw err; - * }); - * - * // Grab an arbitrary unused port. - * server.listen(() => { - * console.log('opened server on', server.address()); - * }); - * ``` - * - * `server.address()` returns `null` before the `'listening'` event has been - * emitted or after calling `server.close()`. - * @since v0.1.90 - */ - address(): AddressInfo | string | null; - /** - * Asynchronously get the number of concurrent connections on the server. Works - * when sockets were sent to forks. - * - * Callback should take two arguments `err` and `count`. - * @since v0.9.7 - */ - getConnections(cb: (error: Error | null, count: number) => void): void; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). - * If the server is `ref`ed calling `ref()` again will have no effect. - * @since v0.9.1 - */ - ref(): this; - /** - * Calling `unref()` on a server will allow the program to exit if this is the only - * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - */ - unref(): this; - /** - * Set this property to reject connections when the server's connection count gets - * high. - * - * It is not recommended to use this option once a socket has been sent to a child - * with `child_process.fork()`. - * @since v0.2.0 - */ - maxConnections: number; - connections: number; - /** - * Indicates whether or not the server is listening for connections. - * @since v5.7.0 - */ - listening: boolean; - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - * 5. drop - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "drop", listener: (data?: DropArgument) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "drop", data?: DropArgument): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "drop", listener: (data?: DropArgument) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "drop", listener: (data?: DropArgument) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "drop", listener: (data?: DropArgument) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this; - /** - * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } - type IPVersion = "ipv4" | "ipv6"; - /** - * The `BlockList` object can be used with some network APIs to specify rules for - * disabling inbound or outbound access to specific IP addresses, IP ranges, or - * IP subnets. - * @since v15.0.0, v14.18.0 - */ - class BlockList { - /** - * Adds a rule to block the given IP address. - * @since v15.0.0, v14.18.0 - * @param address An IPv4 or IPv6 address. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addAddress(address: string, type?: IPVersion): void; - addAddress(address: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). - * @since v15.0.0, v14.18.0 - * @param start The starting IPv4 or IPv6 address in the range. - * @param end The ending IPv4 or IPv6 address in the range. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addRange(start: string, end: string, type?: IPVersion): void; - addRange(start: SocketAddress, end: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses specified as a subnet mask. - * @since v15.0.0, v14.18.0 - * @param net The network IPv4 or IPv6 address. - * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addSubnet(net: SocketAddress, prefix: number): void; - addSubnet(net: string, prefix: number, type?: IPVersion): void; - /** - * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. - * - * ```js - * const blockList = new net.BlockList(); - * blockList.addAddress('123.123.123.123'); - * blockList.addRange('10.0.0.1', '10.0.0.10'); - * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); - * - * console.log(blockList.check('123.123.123.123')); // Prints: true - * console.log(blockList.check('10.0.0.3')); // Prints: true - * console.log(blockList.check('222.111.111.222')); // Prints: false - * - * // IPv6 notation for IPv4 addresses works: - * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true - * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true - * ``` - * @since v15.0.0, v14.18.0 - * @param address The IP address to check - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - check(address: SocketAddress): boolean; - check(address: string, type?: IPVersion): boolean; - } - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - /** - * Creates a new TCP or `IPC` server. - * - * If `allowHalfOpen` is set to `true`, when the other end of the socket - * signals the end of transmission, the server will only send back the end of - * transmission when `socket.end()` is explicitly called. For example, in the - * context of TCP, when a FIN packed is received, a FIN packed is sent - * back only when `socket.end()` is explicitly called. Until then the - * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. - * - * If `pauseOnConnect` is set to `true`, then the socket associated with each - * incoming connection will be paused, and no data will be read from its handle. - * This allows connections to be passed between processes without any data being - * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. - * - * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. - * - * Here is an example of a TCP echo server which listens for connections - * on port 8124: - * - * ```js - * const net = require('node:net'); - * const server = net.createServer((c) => { - * // 'connection' listener. - * console.log('client connected'); - * c.on('end', () => { - * console.log('client disconnected'); - * }); - * c.write('hello\r\n'); - * c.pipe(c); - * }); - * server.on('error', (err) => { - * throw err; - * }); - * server.listen(8124, () => { - * console.log('server bound'); - * }); - * ``` - * - * Test this by using `telnet`: - * - * ```bash - * telnet localhost 8124 - * ``` - * - * To listen on the socket `/tmp/echo.sock`: - * - * ```js - * server.listen('/tmp/echo.sock', () => { - * console.log('server bound'); - * }); - * ``` - * - * Use `nc` to connect to a Unix domain socket server: - * - * ```bash - * nc -U /tmp/echo.sock - * ``` - * @since v0.5.0 - * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. - */ - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; - /** - * Aliases to {@link createConnection}. - * - * Possible signatures: - * - * * {@link connect} - * * {@link connect} for `IPC` connections. - * * {@link connect} for TCP connections. - */ - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - /** - * A factory function, which creates a new {@link Socket}, - * immediately initiates connection with `socket.connect()`, - * then returns the `net.Socket` that starts the connection. - * - * When the connection is established, a `'connect'` event will be emitted - * on the returned socket. The last parameter `connectListener`, if supplied, - * will be added as a listener for the `'connect'` event **once**. - * - * Possible signatures: - * - * * {@link createConnection} - * * {@link createConnection} for `IPC` connections. - * * {@link createConnection} for TCP connections. - * - * The {@link connect} function is an alias to this function. - */ - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - /** - * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`. - * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided. - * @since v19.4.0 - */ - function getDefaultAutoSelectFamily(): boolean; - /** - * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`. - * @since v19.4.0 - */ - function setDefaultAutoSelectFamily(value: boolean): void; - /** - * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * The initial default value is `250`. - * @since v19.8.0 - */ - function getDefaultAutoSelectFamilyAttemptTimeout(): number; - /** - * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * @since v19.8.0 - */ - function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void; - /** - * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 - * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. - * - * ```js - * net.isIP('::1'); // returns 6 - * net.isIP('127.0.0.1'); // returns 4 - * net.isIP('127.000.000.001'); // returns 0 - * net.isIP('127.0.0.1/24'); // returns 0 - * net.isIP('fhqwhgads'); // returns 0 - * ``` - * @since v0.3.0 - */ - function isIP(input: string): number; - /** - * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no - * leading zeroes. Otherwise, returns `false`. - * - * ```js - * net.isIPv4('127.0.0.1'); // returns true - * net.isIPv4('127.000.000.001'); // returns false - * net.isIPv4('127.0.0.1/24'); // returns false - * net.isIPv4('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv4(input: string): boolean; - /** - * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. - * - * ```js - * net.isIPv6('::1'); // returns true - * net.isIPv6('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv6(input: string): boolean; - interface SocketAddressInitOptions { - /** - * The network address as either an IPv4 or IPv6 string. - * @default 127.0.0.1 - */ - address?: string | undefined; - /** - * @default `'ipv4'` - */ - family?: IPVersion | undefined; - /** - * An IPv6 flow-label used only if `family` is `'ipv6'`. - * @default 0 - */ - flowlabel?: number | undefined; - /** - * An IP port. - * @default 0 - */ - port?: number | undefined; - } - /** - * @since v15.14.0, v14.18.0 - */ - class SocketAddress { - constructor(options: SocketAddressInitOptions); - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly address: string; - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly family: IPVersion; - /** - * @since v15.14.0, v14.18.0 - */ - readonly port: number; - /** - * @since v15.14.0, v14.18.0 - */ - readonly flowlabel: number; - } -} -declare module "node:net" { - export * from "net"; -} diff --git a/reverse_engineering/node_modules/@types/node/os.d.ts b/reverse_engineering/node_modules/@types/node/os.d.ts deleted file mode 100644 index 39a33f7f..00000000 --- a/reverse_engineering/node_modules/@types/node/os.d.ts +++ /dev/null @@ -1,478 +0,0 @@ -/** - * The `node:os` module provides operating system-related utility methods and - * properties. It can be accessed using: - * - * ```js - * const os = require('node:os'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js) - */ -declare module "os" { - interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - } - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - scopeid?: undefined; - } - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T | null; - homedir: T; - } - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - /** - * Returns the host name of the operating system as a string. - * @since v0.3.3 - */ - function hostname(): string; - /** - * Returns an array containing the 1, 5, and 15 minute load averages. - * - * The load average is a measure of system activity calculated by the operating - * system and expressed as a fractional number. - * - * The load average is a Unix-specific concept. On Windows, the return value is - * always `[0, 0, 0]`. - * @since v0.3.3 - */ - function loadavg(): number[]; - /** - * Returns the system uptime in number of seconds. - * @since v0.3.3 - */ - function uptime(): number; - /** - * Returns the amount of free system memory in bytes as an integer. - * @since v0.3.3 - */ - function freemem(): number; - /** - * Returns the total amount of system memory in bytes as an integer. - * @since v0.3.3 - */ - function totalmem(): number; - /** - * Returns an array of objects containing information about each logical CPU core. - * The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable. - * - * The properties included on each object include: - * - * ```js - * [ - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 252020, - * nice: 0, - * sys: 30340, - * idle: 1070356870, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 306960, - * nice: 0, - * sys: 26980, - * idle: 1071569080, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 248450, - * nice: 0, - * sys: 21750, - * idle: 1070919370, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 256880, - * nice: 0, - * sys: 19430, - * idle: 1070905480, - * irq: 20, - * }, - * }, - * ] - * ``` - * - * `nice` values are POSIX-only. On Windows, the `nice` values of all processors - * are always 0. - * - * `os.cpus().length` should not be used to calculate the amount of parallelism - * available to an application. Use {@link availableParallelism} for this purpose. - * @since v0.3.3 - */ - function cpus(): CpuInfo[]; - /** - * Returns an estimate of the default amount of parallelism a program should use. - * Always returns a value greater than zero. - * - * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). - * @since v19.4.0, v18.14.0 - */ - function availableParallelism(): number; - /** - * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it - * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. - * - * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information - * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. - * @since v0.3.3 - */ - function type(): string; - /** - * Returns the operating system as a string. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See - * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v0.3.3 - */ - function release(): string; - /** - * Returns an object containing network interfaces that have been assigned a - * network address. - * - * Each key on the returned object identifies a network interface. The associated - * value is an array of objects that each describe an assigned network address. - * - * The properties available on the assigned network address object include: - * - * ```js - * { - * lo: [ - * { - * address: '127.0.0.1', - * netmask: '255.0.0.0', - * family: 'IPv4', - * mac: '00:00:00:00:00:00', - * internal: true, - * cidr: '127.0.0.1/8' - * }, - * { - * address: '::1', - * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - * family: 'IPv6', - * mac: '00:00:00:00:00:00', - * scopeid: 0, - * internal: true, - * cidr: '::1/128' - * } - * ], - * eth0: [ - * { - * address: '192.168.1.108', - * netmask: '255.255.255.0', - * family: 'IPv4', - * mac: '01:02:03:0a:0b:0c', - * internal: false, - * cidr: '192.168.1.108/24' - * }, - * { - * address: 'fe80::a00:27ff:fe4e:66a1', - * netmask: 'ffff:ffff:ffff:ffff::', - * family: 'IPv6', - * mac: '01:02:03:0a:0b:0c', - * scopeid: 1, - * internal: false, - * cidr: 'fe80::a00:27ff:fe4e:66a1/64' - * } - * ] - * } - * ``` - * @since v0.6.0 - */ - function networkInterfaces(): NodeJS.Dict; - /** - * Returns the string path of the current user's home directory. - * - * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it - * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. - * - * On Windows, it uses the `USERPROFILE` environment variable if defined. - * Otherwise it uses the path to the profile directory of the current user. - * @since v2.3.0 - */ - function homedir(): string; - /** - * Returns information about the currently effective user. On POSIX platforms, - * this is typically a subset of the password file. The returned object includes - * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`. - * - * The value of `homedir` returned by `os.userInfo()` is provided by the operating - * system. This differs from the result of `os.homedir()`, which queries - * environment variables for the home directory before falling back to the - * operating system response. - * - * Throws a `SystemError` if a user has no `username` or `homedir`. - * @since v6.0.0 - */ - function userInfo(options: { encoding: "buffer" }): UserInfo; - function userInfo(options?: { encoding: BufferEncoding }): UserInfo; - type SignalConstants = { - [key in NodeJS.Signals]: number; - }; - namespace constants { - const UV_UDP_REUSEADDR: number; - namespace signals {} - const signals: SignalConstants; - namespace errno { - const E2BIG: number; - const EACCES: number; - const EADDRINUSE: number; - const EADDRNOTAVAIL: number; - const EAFNOSUPPORT: number; - const EAGAIN: number; - const EALREADY: number; - const EBADF: number; - const EBADMSG: number; - const EBUSY: number; - const ECANCELED: number; - const ECHILD: number; - const ECONNABORTED: number; - const ECONNREFUSED: number; - const ECONNRESET: number; - const EDEADLK: number; - const EDESTADDRREQ: number; - const EDOM: number; - const EDQUOT: number; - const EEXIST: number; - const EFAULT: number; - const EFBIG: number; - const EHOSTUNREACH: number; - const EIDRM: number; - const EILSEQ: number; - const EINPROGRESS: number; - const EINTR: number; - const EINVAL: number; - const EIO: number; - const EISCONN: number; - const EISDIR: number; - const ELOOP: number; - const EMFILE: number; - const EMLINK: number; - const EMSGSIZE: number; - const EMULTIHOP: number; - const ENAMETOOLONG: number; - const ENETDOWN: number; - const ENETRESET: number; - const ENETUNREACH: number; - const ENFILE: number; - const ENOBUFS: number; - const ENODATA: number; - const ENODEV: number; - const ENOENT: number; - const ENOEXEC: number; - const ENOLCK: number; - const ENOLINK: number; - const ENOMEM: number; - const ENOMSG: number; - const ENOPROTOOPT: number; - const ENOSPC: number; - const ENOSR: number; - const ENOSTR: number; - const ENOSYS: number; - const ENOTCONN: number; - const ENOTDIR: number; - const ENOTEMPTY: number; - const ENOTSOCK: number; - const ENOTSUP: number; - const ENOTTY: number; - const ENXIO: number; - const EOPNOTSUPP: number; - const EOVERFLOW: number; - const EPERM: number; - const EPIPE: number; - const EPROTO: number; - const EPROTONOSUPPORT: number; - const EPROTOTYPE: number; - const ERANGE: number; - const EROFS: number; - const ESPIPE: number; - const ESRCH: number; - const ESTALE: number; - const ETIME: number; - const ETIMEDOUT: number; - const ETXTBSY: number; - const EWOULDBLOCK: number; - const EXDEV: number; - const WSAEINTR: number; - const WSAEBADF: number; - const WSAEACCES: number; - const WSAEFAULT: number; - const WSAEINVAL: number; - const WSAEMFILE: number; - const WSAEWOULDBLOCK: number; - const WSAEINPROGRESS: number; - const WSAEALREADY: number; - const WSAENOTSOCK: number; - const WSAEDESTADDRREQ: number; - const WSAEMSGSIZE: number; - const WSAEPROTOTYPE: number; - const WSAENOPROTOOPT: number; - const WSAEPROTONOSUPPORT: number; - const WSAESOCKTNOSUPPORT: number; - const WSAEOPNOTSUPP: number; - const WSAEPFNOSUPPORT: number; - const WSAEAFNOSUPPORT: number; - const WSAEADDRINUSE: number; - const WSAEADDRNOTAVAIL: number; - const WSAENETDOWN: number; - const WSAENETUNREACH: number; - const WSAENETRESET: number; - const WSAECONNABORTED: number; - const WSAECONNRESET: number; - const WSAENOBUFS: number; - const WSAEISCONN: number; - const WSAENOTCONN: number; - const WSAESHUTDOWN: number; - const WSAETOOMANYREFS: number; - const WSAETIMEDOUT: number; - const WSAECONNREFUSED: number; - const WSAELOOP: number; - const WSAENAMETOOLONG: number; - const WSAEHOSTDOWN: number; - const WSAEHOSTUNREACH: number; - const WSAENOTEMPTY: number; - const WSAEPROCLIM: number; - const WSAEUSERS: number; - const WSAEDQUOT: number; - const WSAESTALE: number; - const WSAEREMOTE: number; - const WSASYSNOTREADY: number; - const WSAVERNOTSUPPORTED: number; - const WSANOTINITIALISED: number; - const WSAEDISCON: number; - const WSAENOMORE: number; - const WSAECANCELLED: number; - const WSAEINVALIDPROCTABLE: number; - const WSAEINVALIDPROVIDER: number; - const WSAEPROVIDERFAILEDINIT: number; - const WSASYSCALLFAILURE: number; - const WSASERVICE_NOT_FOUND: number; - const WSATYPE_NOT_FOUND: number; - const WSA_E_NO_MORE: number; - const WSA_E_CANCELLED: number; - const WSAEREFUSED: number; - } - namespace priority { - const PRIORITY_LOW: number; - const PRIORITY_BELOW_NORMAL: number; - const PRIORITY_NORMAL: number; - const PRIORITY_ABOVE_NORMAL: number; - const PRIORITY_HIGH: number; - const PRIORITY_HIGHEST: number; - } - } - const devNull: string; - const EOL: string; - /** - * Returns the operating system CPU architecture for which the Node.js binary was - * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,`'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, - * and `'x64'`. - * - * The return value is equivalent to `process.arch`. - * @since v0.5.0 - */ - function arch(): string; - /** - * Returns a string identifying the kernel version. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v13.11.0, v12.17.0 - */ - function version(): string; - /** - * Returns a string identifying the operating system platform for which - * the Node.js binary was compiled. The value is set at compile time. - * Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`. - * - * The return value is equivalent to `process.platform`. - * - * The value `'android'` may also be returned if Node.js is built on the Android - * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.5.0 - */ - function platform(): NodeJS.Platform; - /** - * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. - * - * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v18.9.0, v16.18.0 - */ - function machine(): string; - /** - * Returns the operating system's default directory for temporary files as a - * string. - * @since v0.9.9 - */ - function tmpdir(): string; - /** - * Returns a string identifying the endianness of the CPU for which the Node.js - * binary was compiled. - * - * Possible values are `'BE'` for big endian and `'LE'` for little endian. - * @since v0.9.4 - */ - function endianness(): "BE" | "LE"; - /** - * Returns the scheduling priority for the process specified by `pid`. If `pid` is - * not provided or is `0`, the priority of the current process is returned. - * @since v10.10.0 - * @param [pid=0] The process ID to retrieve scheduling priority for. - */ - function getPriority(pid?: number): number; - /** - * Attempts to set the scheduling priority for the process specified by `pid`. If`pid` is not provided or is `0`, the process ID of the current process is used. - * - * The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows - * priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range - * mapping may cause the return value to be slightly different on Windows. To avoid - * confusion, set `priority` to one of the priority constants. - * - * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user - * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`. - * @since v10.10.0 - * @param [pid=0] The process ID to set scheduling priority for. - * @param priority The scheduling priority to assign to the process. - */ - function setPriority(priority: number): void; - function setPriority(pid: number, priority: number): void; -} -declare module "node:os" { - export * from "os"; -} diff --git a/reverse_engineering/node_modules/@types/node/package.json b/reverse_engineering/node_modules/@types/node/package.json deleted file mode 100644 index 2d269ab1..00000000 --- a/reverse_engineering/node_modules/@types/node/package.json +++ /dev/null @@ -1,230 +0,0 @@ -{ - "name": "@types/node", - "version": "20.10.5", - "description": "TypeScript definitions for node", - "homepage": "https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/node", - "license": "MIT", - "contributors": [ - { - "name": "Microsoft TypeScript", - "githubUsername": "Microsoft", - "url": "https://github.com/Microsoft" - }, - { - "name": "Alberto Schiabel", - "githubUsername": "jkomyno", - "url": "https://github.com/jkomyno" - }, - { - "name": "Alvis HT Tang", - "githubUsername": "alvis", - "url": "https://github.com/alvis" - }, - { - "name": "Andrew Makarov", - "githubUsername": "r3nya", - "url": "https://github.com/r3nya" - }, - { - "name": "Benjamin Toueg", - "githubUsername": "btoueg", - "url": "https://github.com/btoueg" - }, - { - "name": "Chigozirim C.", - "githubUsername": "smac89", - "url": "https://github.com/smac89" - }, - { - "name": "David Junger", - "githubUsername": "touffy", - "url": "https://github.com/touffy" - }, - { - "name": "Deividas Bakanas", - "githubUsername": "DeividasBakanas", - "url": "https://github.com/DeividasBakanas" - }, - { - "name": "Eugene Y. Q. Shen", - "githubUsername": "eyqs", - "url": "https://github.com/eyqs" - }, - { - "name": "Hannes Magnusson", - "githubUsername": "Hannes-Magnusson-CK", - "url": "https://github.com/Hannes-Magnusson-CK" - }, - { - "name": "Huw", - "githubUsername": "hoo29", - "url": "https://github.com/hoo29" - }, - { - "name": "Kelvin Jin", - "githubUsername": "kjin", - "url": "https://github.com/kjin" - }, - { - "name": "Klaus Meinhardt", - "githubUsername": "ajafff", - "url": "https://github.com/ajafff" - }, - { - "name": "Lishude", - "githubUsername": "islishude", - "url": "https://github.com/islishude" - }, - { - "name": "Mariusz Wiktorczyk", - "githubUsername": "mwiktorczyk", - "url": "https://github.com/mwiktorczyk" - }, - { - "name": "Mohsen Azimi", - "githubUsername": "mohsen1", - "url": "https://github.com/mohsen1" - }, - { - "name": "Nicolas Even", - "githubUsername": "n-e", - "url": "https://github.com/n-e" - }, - { - "name": "Nikita Galkin", - "githubUsername": "galkin", - "url": "https://github.com/galkin" - }, - { - "name": "Parambir Singh", - "githubUsername": "parambirs", - "url": "https://github.com/parambirs" - }, - { - "name": "Sebastian Silbermann", - "githubUsername": "eps1lon", - "url": "https://github.com/eps1lon" - }, - { - "name": "Thomas den Hollander", - "githubUsername": "ThomasdenH", - "url": "https://github.com/ThomasdenH" - }, - { - "name": "Wilco Bakker", - "githubUsername": "WilcoBakker", - "url": "https://github.com/WilcoBakker" - }, - { - "name": "wwwy3y3", - "githubUsername": "wwwy3y3", - "url": "https://github.com/wwwy3y3" - }, - { - "name": "Samuel Ainsworth", - "githubUsername": "samuela", - "url": "https://github.com/samuela" - }, - { - "name": "Kyle Uehlein", - "githubUsername": "kuehlein", - "url": "https://github.com/kuehlein" - }, - { - "name": "Thanik Bhongbhibhat", - "githubUsername": "bhongy", - "url": "https://github.com/bhongy" - }, - { - "name": "Marcin Kopacz", - "githubUsername": "chyzwar", - "url": "https://github.com/chyzwar" - }, - { - "name": "Trivikram Kamat", - "githubUsername": "trivikr", - "url": "https://github.com/trivikr" - }, - { - "name": "Junxiao Shi", - "githubUsername": "yoursunny", - "url": "https://github.com/yoursunny" - }, - { - "name": "Ilia Baryshnikov", - "githubUsername": "qwelias", - "url": "https://github.com/qwelias" - }, - { - "name": "ExE Boss", - "githubUsername": "ExE-Boss", - "url": "https://github.com/ExE-Boss" - }, - { - "name": "Piotr Błażejewicz", - "githubUsername": "peterblazejewicz", - "url": "https://github.com/peterblazejewicz" - }, - { - "name": "Anna Henningsen", - "githubUsername": "addaleax", - "url": "https://github.com/addaleax" - }, - { - "name": "Victor Perin", - "githubUsername": "victorperin", - "url": "https://github.com/victorperin" - }, - { - "name": "Yongsheng Zhang", - "githubUsername": "ZYSzys", - "url": "https://github.com/ZYSzys" - }, - { - "name": "NodeJS Contributors", - "githubUsername": "NodeJS", - "url": "https://github.com/NodeJS" - }, - { - "name": "Linus Unnebäck", - "githubUsername": "LinusU", - "url": "https://github.com/LinusU" - }, - { - "name": "wafuwafu13", - "githubUsername": "wafuwafu13", - "url": "https://github.com/wafuwafu13" - }, - { - "name": "Matteo Collina", - "githubUsername": "mcollina", - "url": "https://github.com/mcollina" - }, - { - "name": "Dmitry Semigradsky", - "githubUsername": "Semigradsky", - "url": "https://github.com/Semigradsky" - } - ], - "main": "", - "types": "index.d.ts", - "typesVersions": { - "<=4.8": { - "*": [ - "ts4.8/*" - ] - } - }, - "repository": { - "type": "git", - "url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git", - "directory": "types/node" - }, - "scripts": {}, - "dependencies": { - "undici-types": "~5.26.4" - }, - "typesPublisherContentHash": "6dfd7431379ce9a950fc3c1f9e449887a70990e4487390b39d58be7add68a95a", - "typeScriptVersion": "4.6", - "nonNpm": true -} \ No newline at end of file diff --git a/reverse_engineering/node_modules/@types/node/path.d.ts b/reverse_engineering/node_modules/@types/node/path.d.ts deleted file mode 100644 index 6f07681a..00000000 --- a/reverse_engineering/node_modules/@types/node/path.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -declare module "path/posix" { - import path = require("path"); - export = path; -} -declare module "path/win32" { - import path = require("path"); - export = path; -} -/** - * The `node:path` module provides utilities for working with file and directory - * paths. It can be accessed using: - * - * ```js - * const path = require('node:path'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js) - */ -declare module "path" { - namespace path { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string | undefined; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string | undefined; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string | undefined; - /** - * The file extension (if any) such as '.html' - */ - ext?: string | undefined; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string | undefined; - } - interface PlatformPath { - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param path string path to normalize. - * @throws {TypeError} if `path` is not a string. - */ - normalize(path: string): string; - /** - * Join all arguments together and normalize the resulting path. - * - * @param paths paths to join. - * @throws {TypeError} if any of the path segments is not a string. - */ - join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param paths A sequence of paths or path segments. - * @throws {TypeError} if any of the arguments is not a string. - */ - resolve(...paths: string[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * If the given {path} is a zero-length string, `false` will be returned. - * - * @param path path to test. - * @throws {TypeError} if `path` is not a string. - */ - isAbsolute(path: string): boolean; - /** - * Solve the relative path from {from} to {to} based on the current working directory. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - * - * @throws {TypeError} if either `from` or `to` is not a string. - */ - relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - dirname(path: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param path the path to evaluate. - * @param suffix optionally, an extension to remove from the result. - * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. - */ - basename(path: string, suffix?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - extname(path: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - readonly sep: "\\" | "/"; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - readonly delimiter: ";" | ":"; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param path path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - parse(path: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathObject path to evaluate. - */ - format(pathObject: FormatInputPathObject): string; - /** - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. - * If path is not a string, path will be returned without modifications. - * This method is meaningful only on Windows system. - * On POSIX systems, the method is non-operational and always returns path without modifications. - */ - toNamespacedPath(path: string): string; - /** - * Posix specific pathing. - * Same as parent object on posix. - */ - readonly posix: PlatformPath; - /** - * Windows specific pathing. - * Same as parent object on windows - */ - readonly win32: PlatformPath; - } - } - const path: path.PlatformPath; - export = path; -} -declare module "node:path" { - import path = require("path"); - export = path; -} -declare module "node:path/posix" { - import path = require("path/posix"); - export = path; -} -declare module "node:path/win32" { - import path = require("path/win32"); - export = path; -} diff --git a/reverse_engineering/node_modules/@types/node/perf_hooks.d.ts b/reverse_engineering/node_modules/@types/node/perf_hooks.d.ts deleted file mode 100644 index b369bb69..00000000 --- a/reverse_engineering/node_modules/@types/node/perf_hooks.d.ts +++ /dev/null @@ -1,639 +0,0 @@ -/** - * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for - * Node.js-specific performance measurements. - * - * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): - * - * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) - * * [Performance Timeline](https://w3c.github.io/performance-timeline/) - * * [User Timing](https://www.w3.org/TR/user-timing/) - * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) - * - * ```js - * const { PerformanceObserver, performance } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((items) => { - * console.log(items.getEntries()[0].duration); - * performance.clearMarks(); - * }); - * obs.observe({ type: 'measure' }); - * performance.measure('Start to Now'); - * - * performance.mark('A'); - * doSomeLongRunningProcess(() => { - * performance.measure('A to Now', 'A'); - * - * performance.mark('B'); - * performance.measure('A to B', 'A', 'B'); - * }); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js) - */ -declare module "perf_hooks" { - import { AsyncResource } from "node:async_hooks"; - type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http" | "dns" | "net"; - interface NodeGCPerformanceDetail { - /** - * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies - * the type of garbage collection operation that occurred. - * See perf_hooks.constants for valid values. - */ - readonly kind?: number | undefined; - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` - * property contains additional information about garbage collection operation. - * See perf_hooks.constants for valid values. - */ - readonly flags?: number | undefined; - } - /** - * The constructor of this class is not exposed to users directly. - * @since v8.5.0 - */ - class PerformanceEntry { - protected constructor(); - /** - * The total number of milliseconds elapsed for this entry. This value will not - * be meaningful for all Performance Entry types. - * @since v8.5.0 - */ - readonly duration: number; - /** - * The name of the performance entry. - * @since v8.5.0 - */ - readonly name: string; - /** - * The high resolution millisecond timestamp marking the starting time of the - * Performance Entry. - * @since v8.5.0 - */ - readonly startTime: number; - /** - * The type of the performance entry. It may be one of: - * - * * `'node'` (Node.js only) - * * `'mark'` (available on the Web) - * * `'measure'` (available on the Web) - * * `'gc'` (Node.js only) - * * `'function'` (Node.js only) - * * `'http2'` (Node.js only) - * * `'http'` (Node.js only) - * @since v8.5.0 - */ - readonly entryType: EntryType; - /** - * Additional detail specific to the `entryType`. - * @since v16.0.0 - */ - readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type. - toJSON(): any; - } - /** - * Exposes marks created via the `Performance.mark()` method. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMark extends PerformanceEntry { - readonly duration: 0; - readonly entryType: "mark"; - } - /** - * Exposes measures created via the `Performance.measure()` method. - * - * The constructor of this class is not exposed to users directly. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMeasure extends PerformanceEntry { - readonly entryType: "measure"; - } - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Provides timing details for Node.js itself. The constructor of this class - * is not exposed to users. - * @since v8.5.0 - */ - class PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process - * completed bootstrapping. If bootstrapping has not yet finished, the property - * has the value of -1. - * @since v8.5.0 - */ - readonly bootstrapComplete: number; - /** - * The high resolution millisecond timestamp at which the Node.js environment was - * initialized. - * @since v8.5.0 - */ - readonly environment: number; - /** - * The high resolution millisecond timestamp of the amount of time the event loop - * has been idle within the event loop's event provider (e.g. `epoll_wait`). This - * does not take CPU usage into consideration. If the event loop has not yet - * started (e.g., in the first tick of the main script), the property has the - * value of 0. - * @since v14.10.0, v12.19.0 - */ - readonly idleTime: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * exited. If the event loop has not yet exited, the property has the value of -1\. - * It can only have a value of not -1 in a handler of the `'exit'` event. - * @since v8.5.0 - */ - readonly loopExit: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * started. If the event loop has not yet started (e.g., in the first tick of the - * main script), the property has the value of -1. - * @since v8.5.0 - */ - readonly loopStart: number; - /** - * The high resolution millisecond timestamp at which the V8 platform was - * initialized. - * @since v8.5.0 - */ - readonly v8Start: number; - } - interface EventLoopUtilization { - idle: number; - active: number; - utilization: number; - } - /** - * @param util1 The result of a previous call to eventLoopUtilization() - * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 - */ - type EventLoopUtilityFunction = ( - util1?: EventLoopUtilization, - util2?: EventLoopUtilization, - ) => EventLoopUtilization; - interface MarkOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown | undefined; - /** - * An optional timestamp to be used as the mark time. - * @default `performance.now()`. - */ - startTime?: number | undefined; - } - interface MeasureOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown | undefined; - /** - * Duration between start and end times. - */ - duration?: number | undefined; - /** - * Timestamp to be used as the end time, or a string identifying a previously recorded mark. - */ - end?: number | string | undefined; - /** - * Timestamp to be used as the start time, or a string identifying a previously recorded mark. - */ - start?: number | string | undefined; - } - interface TimerifyOptions { - /** - * A histogram object created using - * `perf_hooks.createHistogram()` that will record runtime durations in - * nanoseconds. - */ - histogram?: RecordableHistogram | undefined; - } - interface Performance { - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; - /** - * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. - * If name is provided, removes only the named measure. - * @param name - * @since v16.7.0 - */ - clearMeasures(name?: string): void; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. - * If you are only interested in performance entries of certain types or that have certain names, see - * `performance.getEntriesByType()` and `performance.getEntriesByName()`. - * @since v16.7.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. - * @param name - * @param type - * @since v16.7.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.entryType` is equal to `type`. - * @param type - * @since v16.7.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - * @return The PerformanceMark entry that was created - */ - mark(name?: string, options?: MarkOptions): PerformanceMark; - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - * @return The PerformanceMeasure entry that was created - */ - measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; - measure(name: string, options: MeasureOptions): PerformanceMeasure; - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T, options?: TimerifyOptions): T; - /** - * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. - * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). - * No other CPU idle time is taken into consideration. - */ - eventLoopUtilization: EventLoopUtilityFunction; - } - interface PerformanceObserverEntryList { - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntries()); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 81.465639, - * * duration: 0 - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 81.860064, - * * duration: 0 - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is - * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByName('meow')); - * - * * [ - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 98.545991, - * * duration: 0 - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('nope')); // [] - * - * console.log(perfObserverList.getEntriesByName('test', 'mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 63.518931, - * * duration: 0 - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ entryTypes: ['mark', 'measure'] }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByType('mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 55.897834, - * * duration: 0 - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 56.350146, - * * duration: 0 - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - } - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - /** - * @since v8.5.0 - */ - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - /** - * Disconnects the `PerformanceObserver` instance from all notifications. - * @since v8.5.0 - */ - disconnect(): void; - /** - * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`: - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((list, observer) => { - * // Called once asynchronously. `list` contains three items. - * }); - * obs.observe({ type: 'mark' }); - * - * for (let n = 0; n < 3; n++) - * performance.mark(`test${n}`); - * ``` - * @since v8.5.0 - */ - observe( - options: - | { - entryTypes: readonly EntryType[]; - buffered?: boolean | undefined; - } - | { - type: EntryType; - buffered?: boolean | undefined; - }, - ): void; - } - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - const NODE_PERFORMANCE_GC_FLAGS_NO: number; - const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; - const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; - const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; - const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; - } - const performance: Performance; - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number | undefined; - } - interface Histogram { - /** - * Returns a `Map` object detailing the accumulated percentile distribution. - * @since v11.10.0 - */ - readonly percentiles: Map; - /** - * The number of times the event loop delay exceeded the maximum 1 hour event - * loop delay threshold. - * @since v11.10.0 - */ - readonly exceeds: number; - /** - * The minimum recorded event loop delay. - * @since v11.10.0 - */ - readonly min: number; - /** - * The maximum recorded event loop delay. - * @since v11.10.0 - */ - readonly max: number; - /** - * The mean of the recorded event loop delays. - * @since v11.10.0 - */ - readonly mean: number; - /** - * The standard deviation of the recorded event loop delays. - * @since v11.10.0 - */ - readonly stddev: number; - /** - * Resets the collected histogram data. - * @since v11.10.0 - */ - reset(): void; - /** - * Returns the value at the given percentile. - * @since v11.10.0 - * @param percentile A percentile value in the range (0, 100]. - */ - percentile(percentile: number): number; - } - interface IntervalHistogram extends Histogram { - /** - * Enables the update interval timer. Returns `true` if the timer was - * started, `false` if it was already started. - * @since v11.10.0 - */ - enable(): boolean; - /** - * Disables the update interval timer. Returns `true` if the timer was - * stopped, `false` if it was already stopped. - * @since v11.10.0 - */ - disable(): boolean; - } - interface RecordableHistogram extends Histogram { - /** - * @since v15.9.0, v14.18.0 - * @param val The amount to record in the histogram. - */ - record(val: number | bigint): void; - /** - * Calculates the amount of time (in nanoseconds) that has passed since the - * previous call to `recordDelta()` and records that amount in the histogram. - * - * ## Examples - * @since v15.9.0, v14.18.0 - */ - recordDelta(): void; - /** - * Adds the values from `other` to this histogram. - * @since v17.4.0, v16.14.0 - */ - add(other: RecordableHistogram): void; - } - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Creates an `IntervalHistogram` object that samples and reports the event loop - * delay over time. The delays will be reported in nanoseconds. - * - * Using a timer to detect approximate event loop delay works because the - * execution of timers is tied specifically to the lifecycle of the libuv - * event loop. That is, a delay in the loop will cause a delay in the execution - * of the timer, and those delays are specifically what this API is intended to - * detect. - * - * ```js - * const { monitorEventLoopDelay } = require('node:perf_hooks'); - * const h = monitorEventLoopDelay({ resolution: 20 }); - * h.enable(); - * // Do something. - * h.disable(); - * console.log(h.min); - * console.log(h.max); - * console.log(h.mean); - * console.log(h.stddev); - * console.log(h.percentiles); - * console.log(h.percentile(50)); - * console.log(h.percentile(99)); - * ``` - * @since v11.10.0 - */ - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; - interface CreateHistogramOptions { - /** - * The minimum recordable value. Must be an integer value greater than 0. - * @default 1 - */ - min?: number | bigint | undefined; - /** - * The maximum recordable value. Must be an integer value greater than min. - * @default Number.MAX_SAFE_INTEGER - */ - max?: number | bigint | undefined; - /** - * The number of accuracy digits. Must be a number between 1 and 5. - * @default 3 - */ - figures?: number | undefined; - } - /** - * Returns a `RecordableHistogram`. - * @since v15.9.0, v14.18.0 - */ - function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; - import { performance as _performance } from "perf_hooks"; - global { - /** - * `performance` is a global reference for `require('perf_hooks').performance` - * https://nodejs.org/api/globals.html#performance - * @since v16.0.0 - */ - var performance: typeof globalThis extends { - onmessage: any; - performance: infer T; - } ? T - : typeof _performance; - } -} -declare module "node:perf_hooks" { - export * from "perf_hooks"; -} diff --git a/reverse_engineering/node_modules/@types/node/process.d.ts b/reverse_engineering/node_modules/@types/node/process.d.ts deleted file mode 100644 index 0e274737..00000000 --- a/reverse_engineering/node_modules/@types/node/process.d.ts +++ /dev/null @@ -1,1539 +0,0 @@ -declare module "process" { - import * as tty from "node:tty"; - import { Worker } from "node:worker_threads"; - global { - var process: NodeJS.Process; - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - interface MemoryUsageFn { - /** - * The `process.memoryUsage()` method iterate over each page to gather informations about memory - * usage which can be slow depending on the program memory allocations. - */ - (): MemoryUsage; - /** - * method returns an integer representing the Resident Set Size (RSS) in bytes. - */ - rss(): number; - } - interface MemoryUsage { - rss: number; - heapTotal: number; - heapUsed: number; - external: number; - arrayBuffers: number; - } - interface CpuUsage { - user: number; - system: number; - } - interface ProcessRelease { - name: string; - sourceUrl?: string | undefined; - headersUrl?: string | undefined; - libUrl?: string | undefined; - lts?: string | undefined; - } - interface ProcessVersions extends Dict { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - type Platform = - | "aix" - | "android" - | "darwin" - | "freebsd" - | "haiku" - | "linux" - | "openbsd" - | "sunos" - | "win32" - | "cygwin" - | "netbsd"; - type Architecture = - | "arm" - | "arm64" - | "ia32" - | "mips" - | "mipsel" - | "ppc" - | "ppc64" - | "riscv64" - | "s390" - | "s390x" - | "x64"; - type Signals = - | "SIGABRT" - | "SIGALRM" - | "SIGBUS" - | "SIGCHLD" - | "SIGCONT" - | "SIGFPE" - | "SIGHUP" - | "SIGILL" - | "SIGINT" - | "SIGIO" - | "SIGIOT" - | "SIGKILL" - | "SIGPIPE" - | "SIGPOLL" - | "SIGPROF" - | "SIGPWR" - | "SIGQUIT" - | "SIGSEGV" - | "SIGSTKFLT" - | "SIGSTOP" - | "SIGSYS" - | "SIGTERM" - | "SIGTRAP" - | "SIGTSTP" - | "SIGTTIN" - | "SIGTTOU" - | "SIGUNUSED" - | "SIGURG" - | "SIGUSR1" - | "SIGUSR2" - | "SIGVTALRM" - | "SIGWINCH" - | "SIGXCPU" - | "SIGXFSZ" - | "SIGBREAK" - | "SIGLOST" - | "SIGINFO"; - type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection"; - type MultipleResolveType = "resolve" | "reject"; - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; - /** - * Most of the time the unhandledRejection will be an Error, but this should not be relied upon - * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. - */ - type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: unknown, sendHandle: unknown) => void; - type SignalsListener = (signal: Signals) => void; - type MultipleResolveListener = ( - type: MultipleResolveType, - promise: Promise, - value: unknown, - ) => void; - type WorkerListener = (worker: Worker) => void; - interface Socket extends ReadWriteStream { - isTTY?: true | undefined; - } - // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string; - } - interface HRTime { - (time?: [number, number]): [number, number]; - bigint(): bigint; - } - interface ProcessReport { - /** - * Directory where the report is written. - * working directory of the Node.js process. - * @default '' indicating that reports are written to the current - */ - directory: string; - /** - * Filename where the report is written. - * The default value is the empty string. - * @default '' the output filename will be comprised of a timestamp, - * PID, and sequence number. - */ - filename: string; - /** - * Returns a JSON-formatted diagnostic report for the running process. - * The report's JavaScript stack trace is taken from err, if present. - */ - getReport(err?: Error): string; - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @default false - */ - reportOnSignal: boolean; - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from err, if present. - * - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param error A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string): string; - writeReport(error?: Error): string; - writeReport(fileName?: string, err?: Error): string; - } - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - interface EmitWarningOptions { - /** - * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. - * - * @default 'Warning' - */ - type?: string | undefined; - /** - * A unique identifier for the warning instance being emitted. - */ - code?: string | undefined; - /** - * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. - * - * @default process.emitWarning - */ - ctor?: Function | undefined; - /** - * Additional text to include with the error. - */ - detail?: string | undefined; - } - interface ProcessConfig { - readonly target_defaults: { - readonly cflags: any[]; - readonly default_configuration: string; - readonly defines: string[]; - readonly include_dirs: string[]; - readonly libraries: string[]; - }; - readonly variables: { - readonly clang: number; - readonly host_arch: string; - readonly node_install_npm: boolean; - readonly node_install_waf: boolean; - readonly node_prefix: string; - readonly node_shared_openssl: boolean; - readonly node_shared_v8: boolean; - readonly node_shared_zlib: boolean; - readonly node_use_dtrace: boolean; - readonly node_use_etw: boolean; - readonly node_use_openssl: boolean; - readonly target_arch: string; - readonly v8_no_strict_aliasing: number; - readonly v8_use_snapshot: boolean; - readonly visibility: string; - }; - } - interface Process extends EventEmitter { - /** - * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is - * a `Writable` stream. - * - * For example, to copy `process.stdin` to `process.stdout`: - * - * ```js - * import { stdin, stdout } from 'node:process'; - * - * stdin.pipe(stdout); - * ``` - * - * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stdout: WriteStream & { - fd: 1; - }; - /** - * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is - * a `Writable` stream. - * - * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stderr: WriteStream & { - fd: 2; - }; - /** - * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is - * a `Readable` stream. - * - * For details of how to read from `stdin` see `readable.read()`. - * - * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that - * is compatible with scripts written for Node.js prior to v0.10\. - * For more information see `Stream compatibility`. - * - * In "old" streams mode the `stdin` stream is paused by default, so one - * must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode. - */ - stdin: ReadStream & { - fd: 0; - }; - openStdin(): Socket; - /** - * The `process.argv` property returns an array containing the command-line - * arguments passed when the Node.js process was launched. The first element will - * be {@link execPath}. See `process.argv0` if access to the original value - * of `argv[0]` is needed. The second element will be the path to the JavaScript - * file being executed. The remaining elements will be any additional command-line - * arguments. - * - * For example, assuming the following script for `process-args.js`: - * - * ```js - * import { argv } from 'node:process'; - * - * // print process.argv - * argv.forEach((val, index) => { - * console.log(`${index}: ${val}`); - * }); - * ``` - * - * Launching the Node.js process as: - * - * ```bash - * node process-args.js one two=three four - * ``` - * - * Would generate the output: - * - * ```text - * 0: /usr/local/bin/node - * 1: /Users/mjr/work/node/process-args.js - * 2: one - * 3: two=three - * 4: four - * ``` - * @since v0.1.27 - */ - argv: string[]; - /** - * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. - * - * ```console - * $ bash -c 'exec -a customArgv0 ./node' - * > process.argv[0] - * '/Volumes/code/external/node/out/Release/node' - * > process.argv0 - * 'customArgv0' - * ``` - * @since v6.4.0 - */ - argv0: string; - /** - * The `process.execArgv` property returns the set of Node.js-specific command-line - * options passed when the Node.js process was launched. These options do not - * appear in the array returned by the {@link argv} property, and do not - * include the Node.js executable, the name of the script, or any options following - * the script name. These options are useful in order to spawn child processes with - * the same execution environment as the parent. - * - * ```bash - * node --harmony script.js --version - * ``` - * - * Results in `process.execArgv`: - * - * ```js - * ['--harmony'] - * ``` - * - * And `process.argv`: - * - * ```js - * ['/usr/local/bin/node', 'script.js', '--version'] - * ``` - * - * Refer to `Worker constructor` for the detailed behavior of worker - * threads with this property. - * @since v0.7.7 - */ - execArgv: string[]; - /** - * The `process.execPath` property returns the absolute pathname of the executable - * that started the Node.js process. Symbolic links, if any, are resolved. - * - * ```js - * '/usr/local/bin/node' - * ``` - * @since v0.1.100 - */ - execPath: string; - /** - * The `process.abort()` method causes the Node.js process to exit immediately and - * generate a core file. - * - * This feature is not available in `Worker` threads. - * @since v0.7.0 - */ - abort(): never; - /** - * The `process.chdir()` method changes the current working directory of the - * Node.js process or throws an exception if doing so fails (for instance, if - * the specified `directory` does not exist). - * - * ```js - * import { chdir, cwd } from 'node:process'; - * - * console.log(`Starting directory: ${cwd()}`); - * try { - * chdir('/tmp'); - * console.log(`New directory: ${cwd()}`); - * } catch (err) { - * console.error(`chdir: ${err}`); - * } - * ``` - * - * This feature is not available in `Worker` threads. - * @since v0.1.17 - */ - chdir(directory: string): void; - /** - * The `process.cwd()` method returns the current working directory of the Node.js - * process. - * - * ```js - * import { cwd } from 'node:process'; - * - * console.log(`Current directory: ${cwd()}`); - * ``` - * @since v0.1.8 - */ - cwd(): string; - /** - * The port used by the Node.js debugger when enabled. - * - * ```js - * import process from 'node:process'; - * - * process.debugPort = 5858; - * ``` - * @since v0.7.2 - */ - debugPort: number; - /** - * The `process.emitWarning()` method can be used to emit custom or application - * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. - * - * ```js - * import { emitWarning } from 'node:process'; - * - * // Emit a warning with a code and additional detail. - * emitWarning('Something happened!', { - * code: 'MY_WARNING', - * detail: 'This is some additional information', - * }); - * // Emits: - * // (node:56338) [MY_WARNING] Warning: Something happened! - * // This is some additional information - * ``` - * - * In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler. - * - * ```js - * import process from 'node:process'; - * - * process.on('warning', (warning) => { - * console.warn(warning.name); // 'Warning' - * console.warn(warning.message); // 'Something happened!' - * console.warn(warning.code); // 'MY_WARNING' - * console.warn(warning.stack); // Stack trace - * console.warn(warning.detail); // 'This is some additional information' - * }); - * ``` - * - * If `warning` is passed as an `Error` object, the `options` argument is ignored. - * @since v8.0.0 - * @param warning The warning to emit. - */ - emitWarning(warning: string | Error, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; - emitWarning(warning: string | Error, options?: EmitWarningOptions): void; - /** - * The `process.env` property returns an object containing the user environment. - * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). - * - * An example of this object looks like: - * - * ```js - * { - * TERM: 'xterm-256color', - * SHELL: '/usr/local/bin/bash', - * USER: 'maciej', - * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', - * PWD: '/Users/maciej', - * EDITOR: 'vim', - * SHLVL: '1', - * HOME: '/Users/maciej', - * LOGNAME: 'maciej', - * _: '/usr/local/bin/node' - * } - * ``` - * - * It is possible to modify this object, but such modifications will not be - * reflected outside the Node.js process, or (unless explicitly requested) - * to other `Worker` threads. - * In other words, the following example would not work: - * - * ```bash - * node -e 'process.env.foo = "bar"' && echo $foo - * ``` - * - * While the following will: - * - * ```js - * import { env } from 'node:process'; - * - * env.foo = 'bar'; - * console.log(env.foo); - * ``` - * - * Assigning a property on `process.env` will implicitly convert the value - * to a string. **This behavior is deprecated.** Future versions of Node.js may - * throw an error when the value is not a string, number, or boolean. - * - * ```js - * import { env } from 'node:process'; - * - * env.test = null; - * console.log(env.test); - * // => 'null' - * env.test = undefined; - * console.log(env.test); - * // => 'undefined' - * ``` - * - * Use `delete` to delete a property from `process.env`. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * delete env.TEST; - * console.log(env.TEST); - * // => undefined - * ``` - * - * On Windows operating systems, environment variables are case-insensitive. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * console.log(env.test); - * // => 1 - * ``` - * - * Unless explicitly specified when creating a `Worker` instance, - * each `Worker` thread has its own copy of `process.env`, based on its - * parent thread's `process.env`, or whatever was specified as the `env` option - * to the `Worker` constructor. Changes to `process.env` will not be visible - * across `Worker` threads, and only the main thread can make changes that - * are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner - * unlike the main thread. - * @since v0.1.27 - */ - env: ProcessEnv; - /** - * The `process.exit()` method instructs Node.js to terminate the process - * synchronously with an exit status of `code`. If `code` is omitted, exit uses - * either the 'success' code `0` or the value of `process.exitCode` if it has been - * set. Node.js will not terminate until all the `'exit'` event listeners are - * called. - * - * To exit with a 'failure' code: - * - * ```js - * import { exit } from 'node:process'; - * - * exit(1); - * ``` - * - * The shell that executed Node.js should see the exit code as `1`. - * - * Calling `process.exit()` will force the process to exit as quickly as possible - * even if there are still asynchronous operations pending that have not yet - * completed fully, including I/O operations to `process.stdout` and`process.stderr`. - * - * In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_ - * _work pending_ in the event loop. The `process.exitCode` property can be set to - * tell the process which exit code to use when the process exits gracefully. - * - * For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being - * truncated and lost: - * - * ```js - * import { exit } from 'node:process'; - * - * // This is an example of what *not* to do: - * if (someConditionNotMet()) { - * printUsageToStdout(); - * exit(1); - * } - * ``` - * - * The reason this is problematic is because writes to `process.stdout` in Node.js - * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js - * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. - * - * Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding - * scheduling any additional work for the event loop: - * - * ```js - * import process from 'node:process'; - * - * // How to properly set the exit code while letting - * // the process exit gracefully. - * if (someConditionNotMet()) { - * printUsageToStdout(); - * process.exitCode = 1; - * } - * ``` - * - * If it is necessary to terminate the Node.js process due to an error condition, - * throwing an _uncaught_ error and allowing the process to terminate accordingly - * is safer than calling `process.exit()`. - * - * In `Worker` threads, this function stops the current thread rather - * than the current process. - * @since v0.1.13 - * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. - */ - exit(code?: number): never; - /** - * A number which will be the process exit code, when the process either - * exits gracefully, or is exited via {@link exit} without specifying - * a code. - * - * Specifying a code to {@link exit} will override any - * previous setting of `process.exitCode`. - * @since v0.11.8 - */ - exitCode?: number | undefined; - /** - * The `process.getgid()` method returns the numerical group identity of the - * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getgid) { - * console.log(`Current gid: ${process.getgid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.31 - */ - getgid?: () => number; - /** - * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a - * numeric ID or a group name - * string. If a group name is specified, this method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getgid && process.setgid) { - * console.log(`Current gid: ${process.getgid()}`); - * try { - * process.setgid(501); - * console.log(`New gid: ${process.getgid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.31 - * @param id The group name or ID - */ - setgid?: (id: number | string) => void; - /** - * The `process.getuid()` method returns the numeric user identity of the process. - * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getuid) { - * console.log(`Current uid: ${process.getuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.28 - */ - getuid?: () => number; - /** - * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a - * numeric ID or a username string. - * If a username is specified, the method blocks while resolving the associated - * numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getuid && process.setuid) { - * console.log(`Current uid: ${process.getuid()}`); - * try { - * process.setuid(501); - * console.log(`New uid: ${process.getuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.28 - */ - setuid?: (id: number | string) => void; - /** - * The `process.geteuid()` method returns the numerical effective user identity of - * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.geteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - geteuid?: () => number; - /** - * The `process.seteuid()` method sets the effective user identity of the process. - * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username - * string. If a username is specified, the method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.geteuid && process.seteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * try { - * process.seteuid(501); - * console.log(`New uid: ${process.geteuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A user name or ID - */ - seteuid?: (id: number | string) => void; - /** - * The `process.getegid()` method returns the numerical effective group identity - * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getegid) { - * console.log(`Current gid: ${process.getegid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - getegid?: () => number; - /** - * The `process.setegid()` method sets the effective group identity of the process. - * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group - * name string. If a group name is specified, this method blocks while resolving - * the associated a numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getegid && process.setegid) { - * console.log(`Current gid: ${process.getegid()}`); - * try { - * process.setegid(501); - * console.log(`New gid: ${process.getegid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A group name or ID - */ - setegid?: (id: number | string) => void; - /** - * The `process.getgroups()` method returns an array with the supplementary group - * IDs. POSIX leaves it unspecified if the effective group ID is included but - * Node.js ensures it always is. - * - * ```js - * import process from 'process'; - * - * if (process.getgroups) { - * console.log(process.getgroups()); // [ 16, 21, 297 ] - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.9.4 - */ - getgroups?: () => number[]; - /** - * The `process.setgroups()` method sets the supplementary group IDs for the - * Node.js process. This is a privileged operation that requires the Node.js - * process to have `root` or the `CAP_SETGID` capability. - * - * The `groups` array can contain numeric group IDs, group names, or both. - * - * ```js - * import process from 'process'; - * - * if (process.getgroups && process.setgroups) { - * try { - * process.setgroups([501]); - * console.log(process.getgroups()); // new groups - * } catch (err) { - * console.log(`Failed to set groups: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.9.4 - */ - setgroups?: (groups: ReadonlyArray) => void; - /** - * The `process.setUncaughtExceptionCaptureCallback()` function sets a function - * that will be invoked when an uncaught exception occurs, which will receive the - * exception value itself as its first argument. - * - * If such a function is set, the `'uncaughtException'` event will - * not be emitted. If `--abort-on-uncaught-exception` was passed from the - * command line or set through `v8.setFlagsFromString()`, the process will - * not abort. Actions configured to take place on exceptions such as report - * generations will be affected too - * - * To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this - * method with a non-`null` argument while another capture function is set will - * throw an error. - * - * Using this function is mutually exclusive with using the deprecated `domain` built-in module. - * @since v9.3.0 - */ - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - /** - * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. - * @since v9.3.0 - */ - hasUncaughtExceptionCaptureCallback(): boolean; - /** - * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled. - * @since v20.7.0 - * @experimental - */ - readonly sourceMapsEnabled: boolean; - /** - * This function enables or disables the Source Map v3 support for stack traces. - * It provides same features as launching Node.js process with commandline options --enable-source-maps. - * @since v16.6.0 - * @experimental - */ - setSourceMapsEnabled(value: boolean): void; - /** - * The `process.version` property contains the Node.js version string. - * - * ```js - * import { version } from 'node:process'; - * - * console.log(`Version: ${version}`); - * // Version: v14.8.0 - * ``` - * - * To get the version string without the prepended _v_, use`process.versions.node`. - * @since v0.1.3 - */ - readonly version: string; - /** - * The `process.versions` property returns an object listing the version strings of - * Node.js and its dependencies. `process.versions.modules` indicates the current - * ABI version, which is increased whenever a C++ API changes. Node.js will refuse - * to load modules that were compiled against a different module ABI version. - * - * ```js - * import { versions } from 'node:process'; - * - * console.log(versions); - * ``` - * - * Will generate an object similar to: - * - * ```console - * { node: '20.2.0', - * acorn: '8.8.2', - * ada: '2.4.0', - * ares: '1.19.0', - * base64: '0.5.0', - * brotli: '1.0.9', - * cjs_module_lexer: '1.2.2', - * cldr: '43.0', - * icu: '73.1', - * llhttp: '8.1.0', - * modules: '115', - * napi: '8', - * nghttp2: '1.52.0', - * nghttp3: '0.7.0', - * ngtcp2: '0.8.1', - * openssl: '3.0.8+quic', - * simdutf: '3.2.9', - * tz: '2023c', - * undici: '5.22.0', - * unicode: '15.0', - * uv: '1.44.2', - * uvwasi: '0.0.16', - * v8: '11.3.244.8-node.9', - * zlib: '1.2.13' } - * ``` - * @since v0.2.0 - */ - readonly versions: ProcessVersions; - /** - * The `process.config` property returns a frozen `Object` containing the - * JavaScript representation of the configure options used to compile the current - * Node.js executable. This is the same as the `config.gypi` file that was produced - * when running the `./configure` script. - * - * An example of the possible output looks like: - * - * ```js - * { - * target_defaults: - * { cflags: [], - * default_configuration: 'Release', - * defines: [], - * include_dirs: [], - * libraries: [] }, - * variables: - * { - * host_arch: 'x64', - * napi_build_version: 5, - * node_install_npm: 'true', - * node_prefix: '', - * node_shared_cares: 'false', - * node_shared_http_parser: 'false', - * node_shared_libuv: 'false', - * node_shared_zlib: 'false', - * node_use_openssl: 'true', - * node_shared_openssl: 'false', - * strict_aliasing: 'true', - * target_arch: 'x64', - * v8_use_snapshot: 1 - * } - * } - * ``` - * @since v0.7.7 - */ - readonly config: ProcessConfig; - /** - * The `process.kill()` method sends the `signal` to the process identified by`pid`. - * - * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. - * - * This method will throw an error if the target `pid` does not exist. As a special - * case, a signal of `0` can be used to test for the existence of a process. - * Windows platforms will throw an error if the `pid` is used to kill a process - * group. - * - * Even though the name of this function is `process.kill()`, it is really just a - * signal sender, like the `kill` system call. The signal sent may do something - * other than kill the target process. - * - * ```js - * import process, { kill } from 'node:process'; - * - * process.on('SIGHUP', () => { - * console.log('Got SIGHUP signal.'); - * }); - * - * setTimeout(() => { - * console.log('Exiting.'); - * process.exit(0); - * }, 100); - * - * kill(process.pid, 'SIGHUP'); - * ``` - * - * When `SIGUSR1` is received by a Node.js process, Node.js will start the - * debugger. See `Signal Events`. - * @since v0.0.6 - * @param pid A process ID - * @param [signal='SIGTERM'] The signal to send, either as a string or number. - */ - kill(pid: number, signal?: string | number): true; - /** - * The `process.pid` property returns the PID of the process. - * - * ```js - * import { pid } from 'node:process'; - * - * console.log(`This process is pid ${pid}`); - * ``` - * @since v0.1.15 - */ - readonly pid: number; - /** - * The `process.ppid` property returns the PID of the parent of the - * current process. - * - * ```js - * import { ppid } from 'node:process'; - * - * console.log(`The parent process is pid ${ppid}`); - * ``` - * @since v9.2.0, v8.10.0, v6.13.0 - */ - readonly ppid: number; - /** - * The `process.title` property returns the current process title (i.e. returns - * the current value of `ps`). Assigning a new value to `process.title` modifies - * the current value of `ps`. - * - * When a new value is assigned, different platforms will impose different maximum - * length restrictions on the title. Usually such restrictions are quite limited. - * For instance, on Linux and macOS, `process.title` is limited to the size of the - * binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8 - * allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure) - * cases. - * - * Assigning a value to `process.title` might not result in an accurate label - * within process manager applications such as macOS Activity Monitor or Windows - * Services Manager. - * @since v0.1.104 - */ - title: string; - /** - * The operating system CPU architecture for which the Node.js binary was compiled. - * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`. - * - * ```js - * import { arch } from 'node:process'; - * - * console.log(`This processor architecture is ${arch}`); - * ``` - * @since v0.5.0 - */ - readonly arch: Architecture; - /** - * The `process.platform` property returns a string identifying the operating - * system platform for which the Node.js binary was compiled. - * - * Currently possible values are: - * - * * `'aix'` - * * `'darwin'` - * * `'freebsd'` - * * `'linux'` - * * `'openbsd'` - * * `'sunos'` - * * `'win32'` - * - * ```js - * import { platform } from 'node:process'; - * - * console.log(`This platform is ${platform}`); - * ``` - * - * The value `'android'` may also be returned if the Node.js is built on the - * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.1.16 - */ - readonly platform: Platform; - /** - * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at - * runtime, `require.main` may still refer to the original main module in - * modules that were required before the change occurred. Generally, it's - * safe to assume that the two refer to the same module. - * - * As with `require.main`, `process.mainModule` will be `undefined` if there - * is no entry script. - * @since v0.1.17 - * @deprecated Since v14.0.0 - Use `main` instead. - */ - mainModule?: Module | undefined; - memoryUsage: MemoryUsageFn; - /** - * Gets the amount of memory available to the process (in bytes) based on - * limits imposed by the OS. If there is no such constraint, or the constraint - * is unknown, `undefined` is returned. - * - * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more - * information. - * @since v19.6.0, v18.15.0 - * @experimental - */ - constrainedMemory(): number | undefined; - /** - * The `process.cpuUsage()` method returns the user and system CPU time usage of - * the current process, in an object with properties `user` and `system`, whose - * values are microsecond values (millionth of a second). These values measure time - * spent in user and system code respectively, and may end up being greater than - * actual elapsed time if multiple CPU cores are performing work for this process. - * - * The result of a previous call to `process.cpuUsage()` can be passed as the - * argument to the function, to get a diff reading. - * - * ```js - * import { cpuUsage } from 'node:process'; - * - * const startUsage = cpuUsage(); - * // { user: 38579, system: 6986 } - * - * // spin the CPU for 500 milliseconds - * const now = Date.now(); - * while (Date.now() - now < 500); - * - * console.log(cpuUsage(startUsage)); - * // { user: 514883, system: 11226 } - * ``` - * @since v6.1.0 - * @param previousValue A previous return value from calling `process.cpuUsage()` - */ - cpuUsage(previousValue?: CpuUsage): CpuUsage; - /** - * `process.nextTick()` adds `callback` to the "next tick queue". This queue is - * fully drained after the current operation on the JavaScript stack runs to - * completion and before the event loop is allowed to continue. It's possible to - * create an infinite loop if one were to recursively call `process.nextTick()`. - * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. - * - * ```js - * import { nextTick } from 'node:process'; - * - * console.log('start'); - * nextTick(() => { - * console.log('nextTick callback'); - * }); - * console.log('scheduled'); - * // Output: - * // start - * // scheduled - * // nextTick callback - * ``` - * - * This is important when developing APIs in order to give users the opportunity - * to assign event handlers _after_ an object has been constructed but before any - * I/O has occurred: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function MyThing(options) { - * this.setupOptions(options); - * - * nextTick(() => { - * this.startDoingStuff(); - * }); - * } - * - * const thing = new MyThing(); - * thing.getReadyForStuff(); - * - * // thing.startDoingStuff() gets called now, not before. - * ``` - * - * It is very important for APIs to be either 100% synchronous or 100% - * asynchronous. Consider this example: - * - * ```js - * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! - * function maybeSync(arg, cb) { - * if (arg) { - * cb(); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * - * This API is hazardous because in the following case: - * - * ```js - * const maybeTrue = Math.random() > 0.5; - * - * maybeSync(maybeTrue, () => { - * foo(); - * }); - * - * bar(); - * ``` - * - * It is not clear whether `foo()` or `bar()` will be called first. - * - * The following approach is much better: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function definitelyAsync(arg, cb) { - * if (arg) { - * nextTick(cb); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * @since v0.1.26 - * @param args Additional arguments to pass when invoking the `callback` - */ - nextTick(callback: Function, ...args: any[]): void; - /** - * The `process.release` property returns an `Object` containing metadata related - * to the current release, including URLs for the source tarball and headers-only - * tarball. - * - * `process.release` contains the following properties: - * - * ```js - * { - * name: 'node', - * lts: 'Hydrogen', - * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', - * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', - * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' - * } - * ``` - * - * In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be - * relied upon to exist. - * @since v3.0.0 - */ - readonly release: ProcessRelease; - features: { - inspector: boolean; - debug: boolean; - uv: boolean; - ipv6: boolean; - tls_alpn: boolean; - tls_sni: boolean; - tls_ocsp: boolean; - tls: boolean; - }; - /** - * `process.umask()` returns the Node.js process's file mode creation mask. Child - * processes inherit the mask from the parent process. - * @since v0.1.19 - * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential * - * security vulnerability. There is no safe, cross-platform alternative API. - */ - umask(): number; - /** - * Can only be set if not in worker thread. - */ - umask(mask: string | number): number; - /** - * The `process.uptime()` method returns the number of seconds the current Node.js - * process has been running. - * - * The return value includes fractions of a second. Use `Math.floor()` to get whole - * seconds. - * @since v0.5.0 - */ - uptime(): number; - hrtime: HRTime; - /** - * If Node.js is spawned with an IPC channel, the `process.send()` method can be - * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. - * - * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`. - * - * The message goes through serialization and parsing. The resulting message might - * not be the same as what is originally sent. - * @since v0.5.9 - * @param options used to parameterize the sending of certain types of handles.`options` supports the following properties: - */ - send?( - message: any, - sendHandle?: any, - options?: { - swallowErrors?: boolean | undefined; - }, - callback?: (error: Error | null) => void, - ): boolean; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the - * IPC channel to the parent process, allowing the child process to exit gracefully - * once there are no other connections keeping it alive. - * - * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. - * - * If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`. - * @since v0.7.2 - */ - disconnect(): void; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC - * channel is connected and will return `false` after`process.disconnect()` is called. - * - * Once `process.connected` is `false`, it is no longer possible to send messages - * over the IPC channel using `process.send()`. - * @since v0.7.2 - */ - connected: boolean; - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. - * - * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag - * representations. `process.allowedNodeEnvironmentFlags.has()` will - * return `true` in the following cases: - * - * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`. - * * Flags passed through to V8 (as listed in `--v8-options`) may replace - * one or more _non-leading_ dashes for an underscore, or vice-versa; - * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, - * etc. - * * Flags may contain one or more equals (`=`) characters; all - * characters after and including the first equals will be ignored; - * e.g., `--stack-trace-limit=100`. - * * Flags _must_ be allowable within `NODE_OPTIONS`. - * - * When iterating over `process.allowedNodeEnvironmentFlags`, flags will - * appear only _once_; each will begin with one or more dashes. Flags - * passed through to V8 will contain underscores instead of non-leading - * dashes: - * - * ```js - * import { allowedNodeEnvironmentFlags } from 'node:process'; - * - * allowedNodeEnvironmentFlags.forEach((flag) => { - * // -r - * // --inspect-brk - * // --abort_on_uncaught_exception - * // ... - * }); - * ``` - * - * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail - * silently. - * - * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will - * contain what _would have_ been allowable. - * @since v10.10.0 - */ - allowedNodeEnvironmentFlags: ReadonlySet; - /** - * `process.report` is an object whose methods are used to generate diagnostic - * reports for the current process. Additional documentation is available in the `report documentation`. - * @since v11.8.0 - */ - report?: ProcessReport | undefined; - /** - * ```js - * import { resourceUsage } from 'node:process'; - * - * console.log(resourceUsage()); - * /* - * Will output: - * { - * userCPUTime: 82872, - * systemCPUTime: 4143, - * maxRSS: 33164, - * sharedMemorySize: 0, - * unsharedDataSize: 0, - * unsharedStackSize: 0, - * minorPageFault: 2469, - * majorPageFault: 0, - * swappedOut: 0, - * fsRead: 0, - * fsWrite: 8, - * ipcSent: 0, - * ipcReceived: 0, - * signalsCount: 0, - * voluntaryContextSwitches: 79, - * involuntaryContextSwitches: 1 - * } - * - * ``` - * @since v12.6.0 - * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. - */ - resourceUsage(): ResourceUsage; - /** - * The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the - * documentation for the `'warning' event` and the `emitWarning() method` for more information about this - * flag's behavior. - * @since v0.8.0 - */ - traceDeprecation: boolean; - /* EventEmitter */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - addListener(event: "worker", listener: WorkerListener): this; - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "uncaughtExceptionMonitor", error: Error): boolean; - emit(event: "unhandledRejection", reason: unknown, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: unknown, sendHandle: unknown): this; - emit(event: Signals, signal?: Signals): boolean; - emit( - event: "multipleResolves", - type: MultipleResolveType, - promise: Promise, - value: unknown, - ): this; - emit(event: "worker", listener: WorkerListener): this; - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - on(event: "worker", listener: WorkerListener): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - once(event: "worker", listener: WorkerListener): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependListener(event: "worker", listener: WorkerListener): this; - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependOnceListener(event: "worker", listener: WorkerListener): this; - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - listeners(event: "worker"): WorkerListener[]; - } - } - } - export = process; -} -declare module "node:process" { - import process = require("process"); - export = process; -} diff --git a/reverse_engineering/node_modules/@types/node/punycode.d.ts b/reverse_engineering/node_modules/@types/node/punycode.d.ts deleted file mode 100644 index d2fc9f9a..00000000 --- a/reverse_engineering/node_modules/@types/node/punycode.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users - * currently depending on the `punycode` module should switch to using the - * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL - * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. - * - * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It - * can be accessed using: - * - * ```js - * const punycode = require('punycode'); - * ``` - * - * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is - * primarily intended for use in Internationalized Domain Names. Because host - * names in URLs are limited to ASCII characters only, Domain Names that contain - * non-ASCII characters must be converted into ASCII using the Punycode scheme. - * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent - * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`. - * - * The `punycode` module provides a simple implementation of the Punycode standard. - * - * The `punycode` module is a third-party dependency used by Node.js and - * made available to developers as a convenience. Fixes or other modifications to - * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. - * @deprecated Since v7.0.0 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js) - */ -declare module "punycode" { - /** - * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only - * characters to the equivalent string of Unicode codepoints. - * - * ```js - * punycode.decode('maana-pta'); // 'mañana' - * punycode.decode('--dqo34k'); // '☃-⌘' - * ``` - * @since v0.5.1 - */ - function decode(string: string): string; - /** - * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. - * - * ```js - * punycode.encode('mañana'); // 'maana-pta' - * punycode.encode('☃-⌘'); // '--dqo34k' - * ``` - * @since v0.5.1 - */ - function encode(string: string): string; - /** - * The `punycode.toUnicode()` method converts a string representing a domain name - * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be - * converted. - * - * ```js - * // decode domain names - * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' - * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' - * punycode.toUnicode('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toUnicode(domain: string): string; - /** - * The `punycode.toASCII()` method converts a Unicode string representing an - * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the - * domain name will be converted. Calling `punycode.toASCII()` on a string that - * already only contains ASCII characters will have no effect. - * - * ```js - * // encode domain names - * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' - * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' - * punycode.toASCII('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: readonly number[]): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} -declare module "node:punycode" { - export * from "punycode"; -} diff --git a/reverse_engineering/node_modules/@types/node/querystring.d.ts b/reverse_engineering/node_modules/@types/node/querystring.d.ts deleted file mode 100644 index 54ecc967..00000000 --- a/reverse_engineering/node_modules/@types/node/querystring.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * The `node:querystring` module provides utilities for parsing and formatting URL - * query strings. It can be accessed using: - * - * ```js - * const querystring = require('node:querystring'); - * ``` - * - * `querystring` is more performant than `URLSearchParams` but is not a - * standardized API. Use `URLSearchParams` when performance is not critical or - * when compatibility with browser code is desirable. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/querystring.js) - */ -declare module "querystring" { - interface StringifyOptions { - encodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParseOptions { - maxKeys?: number | undefined; - decodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParsedUrlQuery extends NodeJS.Dict {} - interface ParsedUrlQueryInput extends - NodeJS.Dict< - | string - | number - | boolean - | readonly string[] - | readonly number[] - | readonly boolean[] - | null - > - {} - /** - * The `querystring.stringify()` method produces a URL query string from a - * given `obj` by iterating through the object's "own properties". - * - * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | - * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to - * empty strings. - * - * ```js - * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); - * // Returns 'foo=bar&baz=qux&baz=quux&corge=' - * - * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); - * // Returns 'foo:bar;baz:qux' - * ``` - * - * By default, characters requiring percent-encoding within the query string will - * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkEncodeURIComponent function already exists, - * - * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, - * { encodeURIComponent: gbkEncodeURIComponent }); - * ``` - * @since v0.1.25 - * @param obj The object to serialize into a URL query string - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] . The substring used to delimit keys and values in the query string. - */ - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - /** - * The `querystring.parse()` method parses a URL query string (`str`) into a - * collection of key and value pairs. - * - * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: - * - * ```js - * { - * foo: 'bar', - * abc: ['xyz', '123'] - * } - * ``` - * - * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * By default, percent-encoded characters within the query string will be assumed - * to use UTF-8 encoding. If an alternative character encoding is used, then an - * alternative `decodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkDecodeURIComponent function already exists... - * - * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, - * { decodeURIComponent: gbkDecodeURIComponent }); - * ``` - * @since v0.1.25 - * @param str The URL query string to parse - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] . The substring used to delimit keys and values in the query string. - */ - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - /** - * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL - * query strings. - * - * The `querystring.escape()` method is used by `querystring.stringify()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement percent-encoding implementation if - * necessary by assigning `querystring.escape` to an alternative function. - * @since v0.1.25 - */ - function escape(str: string): string; - /** - * The `querystring.unescape()` method performs decoding of URL percent-encoded - * characters on the given `str`. - * - * The `querystring.unescape()` method is used by `querystring.parse()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement decoding implementation if - * necessary by assigning `querystring.unescape` to an alternative function. - * - * By default, the `querystring.unescape()` method will attempt to use the - * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, - * a safer equivalent that does not throw on malformed URLs will be used. - * @since v0.1.25 - */ - function unescape(str: string): string; -} -declare module "node:querystring" { - export * from "querystring"; -} diff --git a/reverse_engineering/node_modules/@types/node/readline.d.ts b/reverse_engineering/node_modules/@types/node/readline.d.ts deleted file mode 100644 index b06d58b8..00000000 --- a/reverse_engineering/node_modules/@types/node/readline.d.ts +++ /dev/null @@ -1,539 +0,0 @@ -/** - * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time. - * - * To use the promise-based APIs: - * - * ```js - * import * as readline from 'node:readline/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as readline from 'node:readline'; - * ``` - * - * The following simple example illustrates the basic use of the `node:readline`module. - * - * ```js - * import * as readline from 'node:readline/promises'; - * import { stdin as input, stdout as output } from 'node:process'; - * - * const rl = readline.createInterface({ input, output }); - * - * const answer = await rl.question('What do you think of Node.js? '); - * - * console.log(`Thank you for your valuable feedback: ${answer}`); - * - * rl.close(); - * ``` - * - * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be - * received on the `input` stream. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js) - */ -declare module "readline" { - import { Abortable, EventEmitter } from "node:events"; - import * as promises from "node:readline/promises"; - export { promises }; - export interface Key { - sequence?: string | undefined; - name?: string | undefined; - ctrl?: boolean | undefined; - meta?: boolean | undefined; - shift?: boolean | undefined; - } - /** - * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a - * single `input` `Readable` stream and a single `output` `Writable` stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v0.1.104 - */ - export class Interface extends EventEmitter { - readonly terminal: boolean; - /** - * The current input data being processed by node. - * - * This can be used when collecting input from a TTY stream to retrieve the - * current value that has been processed thus far, prior to the `line` event - * being emitted. Once the `line` event has been emitted, this property will - * be an empty string. - * - * Be aware that modifying the value during the instance runtime may have - * unintended consequences if `rl.cursor` is not also controlled. - * - * **If not using a TTY stream for input, use the `'line'` event.** - * - * One possible use case would be as follows: - * - * ```js - * const values = ['lorem ipsum', 'dolor sit amet']; - * const rl = readline.createInterface(process.stdin); - * const showResults = debounce(() => { - * console.log( - * '\n', - * values.filter((val) => val.startsWith(rl.line)).join(' '), - * ); - * }, 300); - * process.stdin.on('keypress', (c, k) => { - * showResults(); - * }); - * ``` - * @since v0.1.98 - */ - readonly line: string; - /** - * The cursor position relative to `rl.line`. - * - * This will track where the current cursor lands in the input string, when - * reading input from a TTY stream. The position of cursor determines the - * portion of the input string that will be modified as input is processed, - * as well as the column where the terminal caret will be rendered. - * @since v0.1.98 - */ - readonly cursor: number; - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor(options: ReadLineOptions); - /** - * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. - * @since v15.3.0, v14.17.0 - * @return the current prompt string - */ - getPrompt(): string; - /** - * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called. - * @since v0.1.98 - */ - setPrompt(prompt: string): void; - /** - * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new - * location at which to provide input. - * - * When called, `rl.prompt()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written. - * @since v0.1.98 - * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. - */ - prompt(preserveCursor?: boolean): void; - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. - * - * The `callback` function passed to `rl.question()` does not follow the typical - * pattern of accepting an `Error` object or `null` as the first argument. - * The `callback` is called with the provided answer as the only argument. - * - * An error will be thrown if calling `rl.question()` after `rl.close()`. - * - * Example usage: - * - * ```js - * rl.question('What is your favorite food? ', (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * ``` - * - * Using an `AbortController` to cancel a question. - * - * ```js - * const ac = new AbortController(); - * const signal = ac.signal; - * - * rl.question('What is your favorite food? ', { signal }, (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * setTimeout(() => ac.abort(), 10000); - * ``` - * @since v0.3.3 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @param callback A callback function that is invoked with the user's input in response to the `query`. - */ - question(query: string, callback: (answer: string) => void): void; - question(query: string, options: Abortable, callback: (answer: string) => void): void; - /** - * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed - * later if necessary. - * - * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance. - * @since v0.3.4 - */ - pause(): this; - /** - * The `rl.resume()` method resumes the `input` stream if it has been paused. - * @since v0.3.4 - */ - resume(): this; - /** - * The `rl.close()` method closes the `Interface` instance and - * relinquishes control over the `input` and `output` streams. When called, - * the `'close'` event will be emitted. - * - * Calling `rl.close()` does not immediately stop other events (including `'line'`) - * from being emitted by the `Interface` instance. - * @since v0.1.98 - */ - close(): void; - /** - * The `rl.write()` method will write either `data` or a key sequence identified - * by `key` to the `output`. The `key` argument is supported only if `output` is - * a `TTY` text terminal. See `TTY keybindings` for a list of key - * combinations. - * - * If `key` is specified, `data` is ignored. - * - * When called, `rl.write()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written. - * - * ```js - * rl.write('Delete this!'); - * // Simulate Ctrl+U to delete the line written previously - * rl.write(null, { ctrl: true, name: 'u' }); - * ``` - * - * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_. - * @since v0.1.98 - */ - write(data: string | Buffer, key?: Key): void; - write(data: undefined | null | string | Buffer, key: Key): void; - /** - * Returns the real position of the cursor in relation to the input - * prompt + string. Long input (wrapping) strings, as well as multiple - * line prompts are included in the calculations. - * @since v13.5.0, v12.16.0 - */ - getCursorPos(): CursorPos; - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - * 8. history - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "history", listener: (history: string[]) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "history", history: string[]): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "history", listener: (history: string[]) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "history", listener: (history: string[]) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "history", listener: (history: string[]) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "history", listener: (history: string[]) => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - export type ReadLine = Interface; // type forwarded for backwards compatibility - export type Completer = (line: string) => CompleterResult; - export type AsyncCompleter = ( - line: string, - callback: (err?: null | Error, result?: CompleterResult) => void, - ) => void; - export type CompleterResult = [string[], string]; - export interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream | undefined; - completer?: Completer | AsyncCompleter | undefined; - terminal?: boolean | undefined; - /** - * Initial list of history lines. This option makes sense - * only if `terminal` is set to `true` by the user or by an internal `output` - * check, otherwise the history caching mechanism is not initialized at all. - * @default [] - */ - history?: string[] | undefined; - historySize?: number | undefined; - prompt?: string | undefined; - crlfDelay?: number | undefined; - /** - * If `true`, when a new input line added - * to the history list duplicates an older one, this removes the older line - * from the list. - * @default false - */ - removeHistoryDuplicates?: boolean | undefined; - escapeCodeTimeout?: number | undefined; - tabSize?: number | undefined; - } - /** - * The `readline.createInterface()` method creates a new `readline.Interface`instance. - * - * ```js - * const readline = require('node:readline'); - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readline.Interface` instance is created, the most common case is to - * listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * - * When creating a `readline.Interface` using `stdin` as input, the program - * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without - * waiting for user input, call `process.stdin.unref()`. - * @since v0.1.98 - */ - export function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ): Interface; - export function createInterface(options: ReadLineOptions): Interface; - /** - * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. - * - * Optionally, `interface` specifies a `readline.Interface` instance for which - * autocompletion is disabled when copy-pasted input is detected. - * - * If the `stream` is a `TTY`, then it must be in raw mode. - * - * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop - * the `input` from emitting `'keypress'` events. - * - * ```js - * readline.emitKeypressEvents(process.stdin); - * if (process.stdin.isTTY) - * process.stdin.setRawMode(true); - * ``` - * - * ## Example: Tiny CLI - * - * The following example illustrates the use of `readline.Interface` class to - * implement a small command-line interface: - * - * ```js - * const readline = require('node:readline'); - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * prompt: 'OHAI> ', - * }); - * - * rl.prompt(); - * - * rl.on('line', (line) => { - * switch (line.trim()) { - * case 'hello': - * console.log('world!'); - * break; - * default: - * console.log(`Say what? I might have heard '${line.trim()}'`); - * break; - * } - * rl.prompt(); - * }).on('close', () => { - * console.log('Have a great day!'); - * process.exit(0); - * }); - * ``` - * - * ## Example: Read file stream line-by-Line - * - * A common use case for `readline` is to consume an input file one line at a - * time. The easiest way to do so is leveraging the `fs.ReadStream` API as - * well as a `for await...of` loop: - * - * ```js - * const fs = require('node:fs'); - * const readline = require('node:readline'); - * - * async function processLineByLine() { - * const fileStream = fs.createReadStream('input.txt'); - * - * const rl = readline.createInterface({ - * input: fileStream, - * crlfDelay: Infinity, - * }); - * // Note: we use the crlfDelay option to recognize all instances of CR LF - * // ('\r\n') in input.txt as a single line break. - * - * for await (const line of rl) { - * // Each line in input.txt will be successively available here as `line`. - * console.log(`Line from file: ${line}`); - * } - * } - * - * processLineByLine(); - * ``` - * - * Alternatively, one could use the `'line'` event: - * - * ```js - * const fs = require('node:fs'); - * const readline = require('node:readline'); - * - * const rl = readline.createInterface({ - * input: fs.createReadStream('sample.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * console.log(`Line from file: ${line}`); - * }); - * ``` - * - * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied: - * - * ```js - * const { once } = require('node:events'); - * const { createReadStream } = require('node:fs'); - * const { createInterface } = require('node:readline'); - * - * (async function processLineByLine() { - * try { - * const rl = createInterface({ - * input: createReadStream('big-file.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * // Process the line. - * }); - * - * await once(rl, 'close'); - * - * console.log('File processed.'); - * } catch (err) { - * console.error(err); - * } - * })(); - * ``` - * @since v0.7.7 - */ - export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - export type Direction = -1 | 0 | 1; - export interface CursorPos { - rows: number; - cols: number; - } - /** - * The `readline.clearLine()` method clears current line of given `TTY` stream - * in a specified direction identified by `dir`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * The `readline.clearScreenDown()` method clears the given `TTY` stream from - * the current position of the cursor down. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * The `readline.cursorTo()` method moves cursor to the specified position in a - * given `TTY` `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * The `readline.moveCursor()` method moves the cursor _relative_ to its current - * position in a given `TTY` `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} -declare module "node:readline" { - export * from "readline"; -} diff --git a/reverse_engineering/node_modules/@types/node/readline/promises.d.ts b/reverse_engineering/node_modules/@types/node/readline/promises.d.ts deleted file mode 100644 index 73fb1115..00000000 --- a/reverse_engineering/node_modules/@types/node/readline/promises.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @since v17.0.0 - * @experimental - */ -declare module "readline/promises" { - import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline"; - import { Abortable } from "node:events"; - /** - * Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a - * single `input` `Readable` stream and a single `output` `Writable` stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v17.0.0 - */ - class Interface extends _Interface { - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. - * - * If the question is called after `rl.close()`, it returns a rejected promise. - * - * Example usage: - * - * ```js - * const answer = await rl.question('What is your favorite food? '); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * - * Using an `AbortSignal` to cancel a question. - * - * ```js - * const signal = AbortSignal.timeout(10_000); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * const answer = await rl.question('What is your favorite food? ', { signal }); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * @since v17.0.0 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @return A promise that is fulfilled with the user's input in response to the `query`. - */ - question(query: string): Promise; - question(query: string, options: Abortable): Promise; - } - /** - * @since v17.0.0 - */ - class Readline { - /** - * @param stream A TTY stream. - */ - constructor( - stream: NodeJS.WritableStream, - options?: { - autoCommit?: boolean; - }, - ); - /** - * The `rl.clearLine()` method adds to the internal list of pending action an - * action that clears current line of the associated `stream` in a specified - * direction identified by `dir`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearLine(dir: Direction): this; - /** - * The `rl.clearScreenDown()` method adds to the internal list of pending action an - * action that clears the associated stream from the current position of the - * cursor down. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearScreenDown(): this; - /** - * The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions. - * @since v17.0.0 - */ - commit(): Promise; - /** - * The `rl.cursorTo()` method adds to the internal list of pending action an action - * that moves cursor to the specified position in the associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - cursorTo(x: number, y?: number): this; - /** - * The `rl.moveCursor()` method adds to the internal list of pending action an - * action that moves the cursor _relative_ to its current position in the - * associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - moveCursor(dx: number, dy: number): this; - /** - * The `rl.rollback` methods clears the internal list of pending actions without - * sending it to the associated `stream`. - * @since v17.0.0 - * @return this - */ - rollback(): this; - } - /** - * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance. - * - * ```js - * const readlinePromises = require('node:readline/promises'); - * const rl = readlinePromises.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readlinePromises.Interface` instance is created, the most common case - * is to listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * @since v17.0.0 - */ - function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ): Interface; - function createInterface(options: ReadLineOptions): Interface; -} -declare module "node:readline/promises" { - export * from "readline/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/repl.d.ts b/reverse_engineering/node_modules/@types/node/repl.d.ts deleted file mode 100644 index 6c5f81b3..00000000 --- a/reverse_engineering/node_modules/@types/node/repl.d.ts +++ /dev/null @@ -1,430 +0,0 @@ -/** - * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation - * that is available both as a standalone program or includible in other - * applications. It can be accessed using: - * - * ```js - * const repl = require('node:repl'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js) - */ -declare module "repl" { - import { AsyncCompleter, Completer, Interface } from "node:readline"; - import { Context } from "node:vm"; - import { InspectOptions } from "node:util"; - interface ReplOptions { - /** - * The input prompt to display. - * @default "> " - */ - prompt?: string | undefined; - /** - * The `Readable` stream from which REPL input will be read. - * @default process.stdin - */ - input?: NodeJS.ReadableStream | undefined; - /** - * The `Writable` stream to which REPL output will be written. - * @default process.stdout - */ - output?: NodeJS.WritableStream | undefined; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean | undefined; - /** - * The function to be used when evaluating each given line of input. - * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions - */ - eval?: REPLEval | undefined; - /** - * Defines if the repl prints output previews or not. - * @default `true` Always `false` in case `terminal` is falsy. - */ - preview?: boolean | undefined; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * Default: the REPL instance's `terminal` value. - */ - useColors?: boolean | undefined; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * Default: `false`. - */ - useGlobal?: boolean | undefined; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * Default: `false`. - */ - ignoreUndefined?: boolean | undefined; - /** - * The function to invoke to format the output of each command before writing to `output`. - * Default: a wrapper for `util.inspect`. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter | undefined; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter | undefined; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * Default: `false`. - */ - breakEvalOnSigint?: boolean | undefined; - } - type REPLEval = ( - this: REPLServer, - evalCmd: string, - context: Context, - file: string, - cb: (err: Error | null, result: any) => void, - ) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { - options: InspectOptions; - }; - type REPLCommandAction = (this: REPLServer, text: string) => void; - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string | undefined; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - /** - * Instances of `repl.REPLServer` are created using the {@link start} method - * or directly using the JavaScript `new` keyword. - * - * ```js - * const repl = require('node:repl'); - * - * const options = { useColors: true }; - * - * const firstInstance = repl.start(options); - * const secondInstance = new repl.REPLServer(options); - * ``` - * @since v0.1.91 - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * @deprecated since v14.3.0 - Use `input` instead. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * @deprecated since v14.3.0 - Use `output` instead. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: NodeJS.ReadOnlyDict; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - /** - * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands - * to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following - * properties: - * - * The following example shows two new commands added to the REPL instance: - * - * ```js - * const repl = require('node:repl'); - * - * const replServer = repl.start({ prompt: '> ' }); - * replServer.defineCommand('sayhello', { - * help: 'Say hello', - * action(name) { - * this.clearBufferedCommand(); - * console.log(`Hello, ${name}!`); - * this.displayPrompt(); - * }, - * }); - * replServer.defineCommand('saybye', function saybye() { - * console.log('Goodbye!'); - * this.close(); - * }); - * ``` - * - * The new commands can then be used from within the REPL instance: - * - * ```console - * > .sayhello Node.js User - * Hello, Node.js User! - * > .saybye - * Goodbye! - * ``` - * @since v0.3.0 - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * The `replServer.displayPrompt()` method readies the REPL instance for input - * from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the - * 'prompt'. - * - * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. - * - * The `replServer.displayPrompt` method is primarily intended to be called from - * within the action function for commands registered using the`replServer.defineCommand()` method. - * @since v0.1.91 - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * The `replServer.clearBufferedCommand()` method clears any command that has been - * buffered but not yet executed. This method is primarily intended to be - * called from within the action function for commands registered using the`replServer.defineCommand()` method. - * @since v9.0.0 - */ - clearBufferedCommand(): void; - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command-line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @since v11.10.0 - * @param historyPath the path to the history file - * @param callback called when history writes are ready or upon error - */ - setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: unique symbol; - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: unique symbol; - /** - * The `repl.start()` method creates and starts a {@link REPLServer} instance. - * - * If `options` is a string, then it specifies the input prompt: - * - * ```js - * const repl = require('node:repl'); - * - * // a Unix style prompt - * repl.start('$ '); - * ``` - * @since v0.1.91 - */ - function start(options?: string | ReplOptions): REPLServer; - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - constructor(err: Error); - } -} -declare module "node:repl" { - export * from "repl"; -} diff --git a/reverse_engineering/node_modules/@types/node/stream.d.ts b/reverse_engineering/node_modules/@types/node/stream.d.ts deleted file mode 100644 index 947a0193..00000000 --- a/reverse_engineering/node_modules/@types/node/stream.d.ts +++ /dev/null @@ -1,1701 +0,0 @@ -/** - * A stream is an abstract interface for working with streaming data in Node.js. - * The `node:stream` module provides an API for implementing the stream interface. - * - * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances. - * - * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`. - * - * To access the `node:stream` module: - * - * ```js - * const stream = require('node:stream'); - * ``` - * - * The `node:stream` module is useful for creating new types of stream instances. - * It is usually not necessary to use the `node:stream` module to consume streams. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/stream.js) - */ -declare module "stream" { - import { Abortable, EventEmitter } from "node:events"; - import { Blob as NodeBlob } from "node:buffer"; - import * as streamPromises from "node:stream/promises"; - import * as streamConsumers from "node:stream/consumers"; - import * as streamWeb from "node:stream/web"; - - type ComposeFnParam = (source: any) => void; - - class internal extends EventEmitter { - pipe( - destination: T, - options?: { - end?: boolean | undefined; - }, - ): T; - compose( - stream: T | ComposeFnParam | Iterable | AsyncIterable, - options?: { signal: AbortSignal }, - ): T; - } - import Stream = internal.Stream; - import Readable = internal.Readable; - import ReadableOptions = internal.ReadableOptions; - interface ArrayOptions { - /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */ - concurrency?: number; - /** allows destroying the stream if the signal is aborted. */ - signal?: AbortSignal; - } - class ReadableBase extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - /** - * Returns whether the stream has been read from or cancelled. - * @since v16.8.0 - */ - static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; - /** - * Returns whether the stream was destroyed or errored before emitting `'end'`. - * @since v16.8.0 - * @experimental - */ - readonly readableAborted: boolean; - /** - * Is `true` if it is safe to call `readable.read()`, which means - * the stream has not been destroyed or emitted `'error'` or `'end'`. - * @since v11.4.0 - */ - readable: boolean; - /** - * Returns whether `'data'` has been emitted. - * @since v16.7.0, v14.18.0 - * @experimental - */ - readonly readableDidRead: boolean; - /** - * Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method. - * @since v12.7.0 - */ - readonly readableEncoding: BufferEncoding | null; - /** - * Becomes `true` when `'end'` event is emitted. - * @since v12.9.0 - */ - readonly readableEnded: boolean; - /** - * This property reflects the current state of a `Readable` stream as described - * in the `Three states` section. - * @since v9.4.0 - */ - readonly readableFlowing: boolean | null; - /** - * Returns the value of `highWaterMark` passed when creating this `Readable`. - * @since v9.3.0 - */ - readonly readableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be read. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly readableLength: number; - /** - * Getter for the property `objectMode` of a given `Readable` stream. - * @since v12.3.0 - */ - readonly readableObjectMode: boolean; - /** - * Is `true` after `readable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - constructor(opts?: ReadableOptions); - _construct?(callback: (error?: Error | null) => void): void; - _read(size: number): void; - /** - * The `readable.read()` method reads data out of the internal buffer and - * returns it. If no data is available to be read, `null` is returned. By default, - * the data is returned as a `Buffer` object unless an encoding has been - * specified using the `readable.setEncoding()` method or the stream is operating - * in object mode. - * - * The optional `size` argument specifies a specific number of bytes to read. If`size` bytes are not available to be read, `null` will be returned _unless_the stream has ended, in which - * case all of the data remaining in the internal - * buffer will be returned. - * - * If the `size` argument is not specified, all of the data contained in the - * internal buffer will be returned. - * - * The `size` argument must be less than or equal to 1 GiB. - * - * The `readable.read()` method should only be called on `Readable` streams - * operating in paused mode. In flowing mode, `readable.read()` is called - * automatically until the internal buffer is fully drained. - * - * ```js - * const readable = getReadableStreamSomehow(); - * - * // 'readable' may be triggered multiple times as data is buffered in - * readable.on('readable', () => { - * let chunk; - * console.log('Stream is readable (new data received in buffer)'); - * // Use a loop to make sure we read all currently available data - * while (null !== (chunk = readable.read())) { - * console.log(`Read ${chunk.length} bytes of data...`); - * } - * }); - * - * // 'end' will be triggered once when there is no more data available - * readable.on('end', () => { - * console.log('Reached end of stream.'); - * }); - * ``` - * - * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks - * are not concatenated. A `while` loop is necessary to consume all data - * currently in the buffer. When reading a large file `.read()` may return `null`, - * having consumed all buffered content so far, but there is still more data to - * come not yet buffered. In this case a new `'readable'` event will be emitted - * when there is more data in the buffer. Finally the `'end'` event will be - * emitted when there is no more data to come. - * - * Therefore to read a file's whole contents from a `readable`, it is necessary - * to collect chunks across multiple `'readable'` events: - * - * ```js - * const chunks = []; - * - * readable.on('readable', () => { - * let chunk; - * while (null !== (chunk = readable.read())) { - * chunks.push(chunk); - * } - * }); - * - * readable.on('end', () => { - * const content = chunks.join(''); - * }); - * ``` - * - * A `Readable` stream in object mode will always return a single item from - * a call to `readable.read(size)`, regardless of the value of the`size` argument. - * - * If the `readable.read()` method returns a chunk of data, a `'data'` event will - * also be emitted. - * - * Calling {@link read} after the `'end'` event has - * been emitted will return `null`. No runtime error will be raised. - * @since v0.9.4 - * @param size Optional argument to specify how much data to read. - */ - read(size?: number): any; - /** - * The `readable.setEncoding()` method sets the character encoding for - * data read from the `Readable` stream. - * - * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data - * to be returned as strings of the specified encoding rather than as `Buffer`objects. For instance, calling `readable.setEncoding('utf8')` will cause the - * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal - * string format. - * - * The `Readable` stream will properly handle multi-byte characters delivered - * through the stream that would otherwise become improperly decoded if simply - * pulled from the stream as `Buffer` objects. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.setEncoding('utf8'); - * readable.on('data', (chunk) => { - * assert.equal(typeof chunk, 'string'); - * console.log('Got %d characters of string data:', chunk.length); - * }); - * ``` - * @since v0.9.4 - * @param encoding The encoding to use. - */ - setEncoding(encoding: BufferEncoding): this; - /** - * The `readable.pause()` method will cause a stream in flowing mode to stop - * emitting `'data'` events, switching out of flowing mode. Any data that - * becomes available will remain in the internal buffer. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.on('data', (chunk) => { - * console.log(`Received ${chunk.length} bytes of data.`); - * readable.pause(); - * console.log('There will be no additional data for 1 second.'); - * setTimeout(() => { - * console.log('Now data will start flowing again.'); - * readable.resume(); - * }, 1000); - * }); - * ``` - * - * The `readable.pause()` method has no effect if there is a `'readable'`event listener. - * @since v0.9.4 - */ - pause(): this; - /** - * The `readable.resume()` method causes an explicitly paused `Readable` stream to - * resume emitting `'data'` events, switching the stream into flowing mode. - * - * The `readable.resume()` method can be used to fully consume the data from a - * stream without actually processing any of that data: - * - * ```js - * getReadableStreamSomehow() - * .resume() - * .on('end', () => { - * console.log('Reached the end, but did not read anything.'); - * }); - * ``` - * - * The `readable.resume()` method has no effect if there is a `'readable'`event listener. - * @since v0.9.4 - */ - resume(): this; - /** - * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most - * typical cases, there will be no reason to - * use this method directly. - * - * ```js - * const readable = new stream.Readable(); - * - * readable.isPaused(); // === false - * readable.pause(); - * readable.isPaused(); // === true - * readable.resume(); - * readable.isPaused(); // === false - * ``` - * @since v0.11.14 - */ - isPaused(): boolean; - /** - * The `readable.unpipe()` method detaches a `Writable` stream previously attached - * using the {@link pipe} method. - * - * If the `destination` is not specified, then _all_ pipes are detached. - * - * If the `destination` is specified, but no pipe is set up for it, then - * the method does nothing. - * - * ```js - * const fs = require('node:fs'); - * const readable = getReadableStreamSomehow(); - * const writable = fs.createWriteStream('file.txt'); - * // All the data from readable goes into 'file.txt', - * // but only for the first second. - * readable.pipe(writable); - * setTimeout(() => { - * console.log('Stop writing to file.txt.'); - * readable.unpipe(writable); - * console.log('Manually close the file stream.'); - * writable.end(); - * }, 1000); - * ``` - * @since v0.9.4 - * @param destination Optional specific stream to unpipe - */ - unpipe(destination?: NodeJS.WritableStream): this; - /** - * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the - * same as `readable.push(null)`, after which no more data can be written. The EOF - * signal is put at the end of the buffer and any buffered data will still be - * flushed. - * - * The `readable.unshift()` method pushes a chunk of data back into the internal - * buffer. This is useful in certain situations where a stream is being consumed by - * code that needs to "un-consume" some amount of data that it has optimistically - * pulled out of the source, so that the data can be passed on to some other party. - * - * The `stream.unshift(chunk)` method cannot be called after the `'end'` event - * has been emitted or a runtime error will be thrown. - * - * Developers using `stream.unshift()` often should consider switching to - * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. - * - * ```js - * // Pull off a header delimited by \n\n. - * // Use unshift() if we get too much. - * // Call the callback with (error, header, stream). - * const { StringDecoder } = require('node:string_decoder'); - * function parseHeader(stream, callback) { - * stream.on('error', callback); - * stream.on('readable', onReadable); - * const decoder = new StringDecoder('utf8'); - * let header = ''; - * function onReadable() { - * let chunk; - * while (null !== (chunk = stream.read())) { - * const str = decoder.write(chunk); - * if (str.includes('\n\n')) { - * // Found the header boundary. - * const split = str.split(/\n\n/); - * header += split.shift(); - * const remaining = split.join('\n\n'); - * const buf = Buffer.from(remaining, 'utf8'); - * stream.removeListener('error', callback); - * // Remove the 'readable' listener before unshifting. - * stream.removeListener('readable', onReadable); - * if (buf.length) - * stream.unshift(buf); - * // Now the body of the message can be read from the stream. - * callback(null, header, stream); - * return; - * } - * // Still reading the header. - * header += str; - * } - * } - * } - * ``` - * - * Unlike {@link push}, `stream.unshift(chunk)` will not - * end the reading process by resetting the internal reading state of the stream. - * This can cause unexpected results if `readable.unshift()` is called during a - * read (i.e. from within a {@link _read} implementation on a - * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, - * however it is best to simply avoid calling `readable.unshift()` while in the - * process of performing a read. - * @since v0.9.11 - * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a string, `Buffer`, `Uint8Array`, or `null`. For object mode - * streams, `chunk` may be any JavaScript value. - * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. - */ - unshift(chunk: any, encoding?: BufferEncoding): void; - /** - * Prior to Node.js 0.10, streams did not implement the entire `node:stream`module API as it is currently defined. (See `Compatibility` for more - * information.) - * - * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable` - * stream that uses - * the old stream as its data source. - * - * It will rarely be necessary to use `readable.wrap()` but the method has been - * provided as a convenience for interacting with older Node.js applications and - * libraries. - * - * ```js - * const { OldReader } = require('./old-api-module.js'); - * const { Readable } = require('node:stream'); - * const oreader = new OldReader(); - * const myReader = new Readable().wrap(oreader); - * - * myReader.on('readable', () => { - * myReader.read(); // etc. - * }); - * ``` - * @since v0.9.4 - * @param stream An "old style" readable stream - */ - wrap(stream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: BufferEncoding): boolean; - /** - * The iterator created by this method gives users the option to cancel the destruction - * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, - * or if the iterator should destroy the stream if the stream emitted an error during iteration. - * @since v16.3.0 - * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator, - * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. - * **Default: `true`**. - */ - iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator; - /** - * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. - * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream. - * @since v17.4.0, v16.14.0 - * @param fn a function to map over every chunk in the stream. Async or not. - * @returns a stream mapped with the function *fn*. - */ - map(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called - * and if it returns a truthy value, the chunk will be passed to the result stream. - * If the *fn* function returns a promise - that promise will be `await`ed. - * @since v17.4.0, v16.14.0 - * @param fn a function to filter chunks from the stream. Async or not. - * @returns a stream filtered with the predicate *fn*. - */ - filter( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Readable; - /** - * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called. - * If the *fn* function returns a promise - that promise will be `await`ed. - * - * This method is different from `for await...of` loops in that it can optionally process chunks concurrently. - * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option - * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`. - * In either case the stream will be destroyed. - * - * This method is different from listening to the `'data'` event in that it uses the `readable` event - * in the underlying machinary and can limit the number of concurrent *fn* calls. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise for when the stream has finished. - */ - forEach( - fn: (data: any, options?: Pick) => void | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method allows easily obtaining the contents of a stream. - * - * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended - * for interoperability and convenience, not as the primary way to consume streams. - * @since v17.5.0 - * @returns a promise containing an array with the contents of the stream. - */ - toArray(options?: Pick): Promise; - /** - * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream - * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk - * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. - * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks. - */ - some( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream - * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy, - * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value. - * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value, - * or `undefined` if no element was found. - */ - find( - fn: (data: any, options?: Pick) => data is T, - options?: ArrayOptions, - ): Promise; - find( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream - * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk - * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. - * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks. - */ - every( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method returns a new stream by applying the given callback to each chunk of the stream - * and then flattening the result. - * - * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams - * will be merged (flattened) into the returned stream. - * @since v17.5.0 - * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator. - * @returns a stream flat-mapped with the function *fn*. - */ - flatMap(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method returns a new stream with the first *limit* chunks dropped from the start. - * @since v17.5.0 - * @param limit the number of chunks to drop from the readable. - * @returns a stream with *limit* chunks dropped from the start. - */ - drop(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with the first *limit* chunks. - * @since v17.5.0 - * @param limit the number of chunks to take from the readable. - * @returns a stream with *limit* chunks taken. - */ - take(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with chunks of the underlying stream paired with a counter - * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced. - * @since v17.5.0 - * @returns a stream of indexed pairs. - */ - asIndexedPairs(options?: Pick): Readable; - /** - * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation - * on the previous element. It returns a promise for the final value of the reduction. - * - * If no *initial* value is supplied the first chunk of the stream is used as the initial value. - * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property. - * - * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter - * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method. - * @since v17.5.0 - * @param fn a reducer function to call over every chunk in the stream. Async or not. - * @param initial the initial value to use in the reduction. - * @returns a promise for the final value of the reduction. - */ - reduce( - fn: (previous: any, data: any, options?: Pick) => T, - initial?: undefined, - options?: Pick, - ): Promise; - reduce( - fn: (previous: T, data: any, options?: Pick) => T, - initial: T, - options?: Pick, - ): Promise; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable - * stream will release any internal resources and subsequent calls to `push()`will be ignored. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, but instead implement `readable._destroy()`. - * @since v8.0.0 - * @param error Error which will be passed as payload in `'error'` event - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. error - * 5. pause - * 6. readable - * 7. resume - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "pause"): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - /** - * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - import WritableOptions = internal.WritableOptions; - class WritableBase extends Stream implements NodeJS.WritableStream { - /** - * Is `true` if it is safe to call `writable.write()`, which means - * the stream has not been destroyed, errored, or ended. - * @since v11.4.0 - */ - readonly writable: boolean; - /** - * Is `true` after `writable.end()` has been called. This property - * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. - * @since v12.9.0 - */ - readonly writableEnded: boolean; - /** - * Is set to `true` immediately before the `'finish'` event is emitted. - * @since v12.6.0 - */ - readonly writableFinished: boolean; - /** - * Return the value of `highWaterMark` passed when creating this `Writable`. - * @since v9.3.0 - */ - readonly writableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be written. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly writableLength: number; - /** - * Getter for the property `objectMode` of a given `Writable` stream. - * @since v12.3.0 - */ - readonly writableObjectMode: boolean; - /** - * Number of times `writable.uncork()` needs to be - * called in order to fully uncork the stream. - * @since v13.2.0, v12.16.0 - */ - readonly writableCorked: number; - /** - * Is `true` after `writable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - /** - * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. - * @since v15.2.0, v14.17.0 - */ - readonly writableNeedDrain: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?( - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - _construct?(callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - /** - * The `writable.write()` method writes some data to the stream, and calls the - * supplied `callback` once the data has been fully handled. If an error - * occurs, the `callback` will be called with the error as its - * first argument. The `callback` is called asynchronously and before `'error'` is - * emitted. - * - * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`. - * If `false` is returned, further attempts to write data to the stream should - * stop until the `'drain'` event is emitted. - * - * While a stream is not draining, calls to `write()` will buffer `chunk`, and - * return false. Once all currently buffered chunks are drained (accepted for - * delivery by the operating system), the `'drain'` event will be emitted. - * Once `write()` returns false, do not write more chunks - * until the `'drain'` event is emitted. While calling `write()` on a stream that - * is not draining is allowed, Node.js will buffer all written chunks until - * maximum memory usage occurs, at which point it will abort unconditionally. - * Even before it aborts, high memory usage will cause poor garbage collector - * performance and high RSS (which is not typically released back to the system, - * even after the memory is no longer required). Since TCP sockets may never - * drain if the remote peer does not read the data, writing a socket that is - * not draining may lead to a remotely exploitable vulnerability. - * - * Writing data while the stream is not draining is particularly - * problematic for a `Transform`, because the `Transform` streams are paused - * by default until they are piped or a `'data'` or `'readable'` event handler - * is added. - * - * If the data to be written can be generated or fetched on demand, it is - * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is - * possible to respect backpressure and avoid memory issues using the `'drain'` event: - * - * ```js - * function write(data, cb) { - * if (!stream.write(data)) { - * stream.once('drain', cb); - * } else { - * process.nextTick(cb); - * } - * } - * - * // Wait for cb to be called before doing any other write. - * write('hello', () => { - * console.log('Write completed, do more writes now.'); - * }); - * ``` - * - * A `Writable` stream in object mode will always ignore the `encoding` argument. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any - * JavaScript value other than `null`. - * @param [encoding='utf8'] The encoding, if `chunk` is a string. - * @param callback Callback for when this chunk of data is flushed. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; - /** - * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. - * @since v0.11.15 - * @param encoding The new default encoding - */ - setDefaultEncoding(encoding: BufferEncoding): this; - /** - * Calling the `writable.end()` method signals that no more data will be written - * to the `Writable`. The optional `chunk` and `encoding` arguments allow one - * final additional chunk of data to be written immediately before closing the - * stream. - * - * Calling the {@link write} method after calling {@link end} will raise an error. - * - * ```js - * // Write 'hello, ' and then end with 'world!'. - * const fs = require('node:fs'); - * const file = fs.createWriteStream('example.txt'); - * file.write('hello, '); - * file.end('world!'); - * // Writing more now is not allowed! - * ``` - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any - * JavaScript value other than `null`. - * @param encoding The encoding if `chunk` is a string - * @param callback Callback for when the stream is finished. - */ - end(cb?: () => void): this; - end(chunk: any, cb?: () => void): this; - end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; - /** - * The `writable.cork()` method forces all written data to be buffered in memory. - * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. - * - * The primary intent of `writable.cork()` is to accommodate a situation in which - * several small chunks are written to the stream in rapid succession. Instead of - * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them - * all to `writable._writev()`, if present. This prevents a head-of-line blocking - * situation where data is being buffered while waiting for the first small chunk - * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput. - * - * See also: `writable.uncork()`, `writable._writev()`. - * @since v0.11.2 - */ - cork(): void; - /** - * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. - * - * When using `writable.cork()` and `writable.uncork()` to manage the buffering - * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event - * loop phase. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.write('data '); - * process.nextTick(() => stream.uncork()); - * ``` - * - * If the `writable.cork()` method is called multiple times on a stream, the - * same number of calls to `writable.uncork()` must be called to flush the buffered - * data. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.cork(); - * stream.write('data '); - * process.nextTick(() => { - * stream.uncork(); - * // The data will not be flushed until uncork() is called a second time. - * stream.uncork(); - * }); - * ``` - * - * See also: `writable.cork()`. - * @since v0.11.2 - */ - uncork(): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable - * stream has ended and subsequent calls to `write()` or `end()` will result in - * an `ERR_STREAM_DESTROYED` error. - * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. - * Use `end()` instead of destroy if data should flush before close, or wait for - * the `'drain'` event before destroying the stream. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, - * but instead implement `writable._destroy()`. - * @since v8.0.0 - * @param error Optional, an error to emit with `'error'` event. - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - namespace internal { - class Stream extends internal { - constructor(opts?: ReadableOptions); - } - interface StreamOptions extends Abortable { - emitClose?: boolean | undefined; - highWaterMark?: number | undefined; - objectMode?: boolean | undefined; - construct?(this: T, callback: (error?: Error | null) => void): void; - destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void; - autoDestroy?: boolean | undefined; - } - interface ReadableOptions extends StreamOptions { - encoding?: BufferEncoding | undefined; - read?(this: Readable, size: number): void; - } - /** - * @since v0.9.4 - */ - class Readable extends ReadableBase { - /** - * A utility method for creating a `Readable` from a web `ReadableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - readableStream: streamWeb.ReadableStream, - options?: Pick, - ): Readable; - /** - * A utility method for creating a web `ReadableStream` from a `Readable`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamReadable: Readable): streamWeb.ReadableStream; - } - interface WritableOptions extends StreamOptions { - decodeStrings?: boolean | undefined; - defaultEncoding?: BufferEncoding | undefined; - write?( - this: Writable, - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void, - ): void; - writev?( - this: Writable, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Writable, callback: (error?: Error | null) => void): void; - } - /** - * @since v0.9.4 - */ - class Writable extends WritableBase { - /** - * A utility method for creating a `Writable` from a web `WritableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - writableStream: streamWeb.WritableStream, - options?: Pick, - ): Writable; - /** - * A utility method for creating a web `WritableStream` from a `Writable`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamWritable: Writable): streamWeb.WritableStream; - } - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean | undefined; - readableObjectMode?: boolean | undefined; - writableObjectMode?: boolean | undefined; - readableHighWaterMark?: number | undefined; - writableHighWaterMark?: number | undefined; - writableCorked?: number | undefined; - construct?(this: Duplex, callback: (error?: Error | null) => void): void; - read?(this: Duplex, size: number): void; - write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - writev?( - this: Duplex, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Duplex, callback: (error?: Error | null) => void): void; - destroy?(this: Duplex, error: Error | null, callback: (error?: Error | null) => void): void; - } - /** - * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Duplex` streams include: - * - * * `TCP sockets` - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Duplex extends ReadableBase implements WritableBase { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - readonly writableNeedDrain: boolean; - readonly closed: boolean; - readonly errored: Error | null; - /** - * If `false` then the stream will automatically end the writable side when the - * readable side ends. Set initially by the `allowHalfOpen` constructor option, - * which defaults to `true`. - * - * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is - * emitted. - * @since v0.9.4 - */ - allowHalfOpen: boolean; - constructor(opts?: DuplexOptions); - /** - * A utility method for creating duplex streams. - * - * - `Stream` converts writable stream into writable `Duplex` and readable stream - * to `Duplex`. - * - `Blob` converts into readable `Duplex`. - * - `string` converts into readable `Duplex`. - * - `ArrayBuffer` converts into readable `Duplex`. - * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. - * - `AsyncGeneratorFunction` converts into a readable/writable transform - * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield - * `null`. - * - `AsyncFunction` converts into a writable `Duplex`. Must return - * either `null` or `undefined` - * - `Object ({ writable, readable })` converts `readable` and - * `writable` into `Stream` and then combines them into `Duplex` where the - * `Duplex` will write to the `writable` and read from the `readable`. - * - `Promise` converts into readable `Duplex`. Value `null` is ignored. - * - * @since v16.8.0 - */ - static from( - src: - | Stream - | NodeBlob - | ArrayBuffer - | string - | Iterable - | AsyncIterable - | AsyncGeneratorFunction - | Promise - | Object, - ): Duplex; - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?( - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: BufferEncoding): this; - end(cb?: () => void): this; - end(chunk: any, cb?: () => void): this; - end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this; - cork(): void; - uncork(): void; - /** - * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamDuplex: Duplex): { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }; - /** - * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - duplexStream: { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }, - options?: Pick< - DuplexOptions, - "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal" - >, - ): Duplex; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. drain - * 4. end - * 5. error - * 6. finish - * 7. pause - * 8. pipe - * 9. readable - * 10. resume - * 11. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pause"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pause", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pause", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - type TransformCallback = (error?: Error | null, data?: any) => void; - interface TransformOptions extends DuplexOptions { - construct?(this: Transform, callback: (error?: Error | null) => void): void; - read?(this: Transform, size: number): void; - write?( - this: Transform, - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void, - ): void; - writev?( - this: Transform, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Transform, callback: (error?: Error | null) => void): void; - destroy?(this: Transform, error: Error | null, callback: (error?: Error | null) => void): void; - transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - flush?(this: Transform, callback: TransformCallback): void; - } - /** - * Transform streams are `Duplex` streams where the output is in some way - * related to the input. Like all `Duplex` streams, `Transform` streams - * implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Transform` streams include: - * - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - /** - * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is - * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams. - */ - class PassThrough extends Transform {} - /** - * A stream to attach a signal to. - * - * Attaches an AbortSignal to a readable or writeable stream. This lets code - * control stream destruction using an `AbortController`. - * - * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new - * AbortError())` for webstreams. - * - * ```js - * const fs = require('node:fs'); - * - * const controller = new AbortController(); - * const read = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * // Later, abort the operation closing the stream - * controller.abort(); - * ``` - * - * Or using an `AbortSignal` with a readable stream as an async iterable: - * - * ```js - * const controller = new AbortController(); - * setTimeout(() => controller.abort(), 10_000); // set a timeout - * const stream = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * (async () => { - * try { - * for await (const chunk of stream) { - * await process(chunk); - * } - * } catch (e) { - * if (e.name === 'AbortError') { - * // The operation was cancelled - * } else { - * throw e; - * } - * } - * })(); - * ``` - * - * Or using an `AbortSignal` with a ReadableStream: - * - * ```js - * const controller = new AbortController(); - * const rs = new ReadableStream({ - * start(controller) { - * controller.enqueue('hello'); - * controller.enqueue('world'); - * controller.close(); - * }, - * }); - * - * addAbortSignal(controller.signal, rs); - * - * finished(rs, (err) => { - * if (err) { - * if (err.name === 'AbortError') { - * // The operation was cancelled - * } - * } - * }); - * - * const reader = rs.getReader(); - * - * reader.read().then(({ value, done }) => { - * console.log(value); // hello - * console.log(done); // false - * controller.abort(); - * }); - * ``` - * @since v15.4.0 - * @param signal A signal representing possible cancellation - * @param stream a stream to attach a signal to - */ - function addAbortSignal(signal: AbortSignal, stream: T): T; - /** - * Returns the default highWaterMark used by streams. - * Defaults to `16384` (16 KiB), or `16` for `objectMode`. - * @since v19.9.0 - * @param objectMode - */ - function getDefaultHighWaterMark(objectMode: boolean): number; - /** - * Sets the default highWaterMark used by streams. - * @since v19.9.0 - * @param objectMode - * @param value highWaterMark value - */ - function setDefaultHighWaterMark(objectMode: boolean, value: number): void; - interface FinishedOptions extends Abortable { - error?: boolean | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - } - /** - * A readable and/or writable stream/webstream. - * - * A function to get notified when a stream is no longer readable, writable - * or has experienced an error or a premature close event. - * - * ```js - * const { finished } = require('node:stream'); - * const fs = require('node:fs'); - * - * const rs = fs.createReadStream('archive.tar'); - * - * finished(rs, (err) => { - * if (err) { - * console.error('Stream failed.', err); - * } else { - * console.log('Stream is done reading.'); - * } - * }); - * - * rs.resume(); // Drain the stream. - * ``` - * - * Especially useful in error handling scenarios where a stream is destroyed - * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`. - * - * The `finished` API provides `promise version`. - * - * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been - * invoked. The reason for this is so that unexpected `'error'` events (due to - * incorrect stream implementations) do not cause unexpected crashes. - * If this is unwanted behavior then the returned cleanup function needs to be - * invoked in the callback: - * - * ```js - * const cleanup = finished(rs, (err) => { - * cleanup(); - * // ... - * }); - * ``` - * @since v10.0.0 - * @param stream A readable and/or writable stream. - * @param callback A callback function that takes an optional error argument. - * @return A cleanup function which removes all registered listeners. - */ - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options: FinishedOptions, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - namespace finished { - function __promisify__( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - } - type PipelineSourceFunction = () => Iterable | AsyncIterable; - type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; - type PipelineTransform, U> = - | NodeJS.ReadWriteStream - | (( - source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable - : S, - ) => AsyncIterable); - type PipelineTransformSource = PipelineSource | PipelineTransform; - type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; - type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

; - type PipelineDestination, P> = S extends - PipelineTransformSource ? - | NodeJS.WritableStream - | PipelineDestinationIterableFunction - | PipelineDestinationPromiseFunction - : never; - type PipelineCallback> = S extends - PipelineDestinationPromiseFunction ? (err: NodeJS.ErrnoException | null, value: P) => void - : (err: NodeJS.ErrnoException | null) => void; - type PipelinePromise> = S extends - PipelineDestinationPromiseFunction ? Promise

: Promise; - interface PipelineOptions { - signal?: AbortSignal | undefined; - end?: boolean | undefined; - } - /** - * A module method to pipe between streams and generators forwarding errors and - * properly cleaning up and provide a callback when the pipeline is complete. - * - * ```js - * const { pipeline } = require('node:stream'); - * const fs = require('node:fs'); - * const zlib = require('node:zlib'); - * - * // Use the pipeline API to easily pipe a series of streams - * // together and get notified when the pipeline is fully done. - * - * // A pipeline to gzip a potentially huge tar file efficiently: - * - * pipeline( - * fs.createReadStream('archive.tar'), - * zlib.createGzip(), - * fs.createWriteStream('archive.tar.gz'), - * (err) => { - * if (err) { - * console.error('Pipeline failed.', err); - * } else { - * console.log('Pipeline succeeded.'); - * } - * }, - * ); - * ``` - * - * The `pipeline` API provides a `promise version`. - * - * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: - * - * * `Readable` streams which have emitted `'end'` or `'close'`. - * * `Writable` streams which have emitted `'finish'` or `'close'`. - * - * `stream.pipeline()` leaves dangling event listeners on the streams - * after the `callback` has been invoked. In the case of reuse of streams after - * failure, this can cause event listener leaks and swallowed errors. If the last - * stream is readable, dangling event listeners will be removed so that the last - * stream can be consumed later. - * - * `stream.pipeline()` closes all the streams when an error is raised. - * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior - * once it would destroy the socket without sending the expected response. - * See the example below: - * - * ```js - * const fs = require('node:fs'); - * const http = require('node:http'); - * const { pipeline } = require('node:stream'); - * - * const server = http.createServer((req, res) => { - * const fileStream = fs.createReadStream('./fileNotExist.txt'); - * pipeline(fileStream, res, (err) => { - * if (err) { - * console.log(err); // No such file - * // this message can't be sent once `pipeline` already destroyed the socket - * return res.end('error!!!'); - * } - * }); - * }); - * ``` - * @since v10.0.0 - * @param callback Called when the pipeline is fully done. - */ - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline( - streams: ReadonlyArray, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array< - NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void) - > - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; - } - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - /** - * Returns whether the stream has encountered an error. - * @since v17.3.0, v16.14.0 - * @experimental - */ - function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; - /** - * Returns whether the stream is readable. - * @since v17.4.0, v16.14.0 - * @experimental - */ - function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; - const promises: typeof streamPromises; - const consumers: typeof streamConsumers; - } - export = internal; -} -declare module "node:stream" { - import stream = require("stream"); - export = stream; -} diff --git a/reverse_engineering/node_modules/@types/node/stream/consumers.d.ts b/reverse_engineering/node_modules/@types/node/stream/consumers.d.ts deleted file mode 100644 index 5ad9cbab..00000000 --- a/reverse_engineering/node_modules/@types/node/stream/consumers.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare module "stream/consumers" { - import { Blob as NodeBlob } from "node:buffer"; - import { Readable } from "node:stream"; - function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; -} -declare module "node:stream/consumers" { - export * from "stream/consumers"; -} diff --git a/reverse_engineering/node_modules/@types/node/stream/promises.d.ts b/reverse_engineering/node_modules/@types/node/stream/promises.d.ts deleted file mode 100644 index 6eac5b71..00000000 --- a/reverse_engineering/node_modules/@types/node/stream/promises.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare module "stream/promises" { - import { - FinishedOptions, - PipelineDestination, - PipelineOptions, - PipelinePromise, - PipelineSource, - PipelineTransform, - } from "node:stream"; - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; -} -declare module "node:stream/promises" { - export * from "stream/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/stream/web.d.ts b/reverse_engineering/node_modules/@types/node/stream/web.d.ts deleted file mode 100644 index 0d916137..00000000 --- a/reverse_engineering/node_modules/@types/node/stream/web.d.ts +++ /dev/null @@ -1,350 +0,0 @@ -declare module "stream/web" { - // stub module, pending copy&paste from .d.ts or manual impl - // copy from lib.dom.d.ts - interface ReadableWritablePair { - readable: ReadableStream; - /** - * Provides a convenient, chainable way of piping this readable stream - * through a transform stream (or any other { writable, readable } - * pair). It simply pipes the stream into the writable side of the - * supplied pair, and returns the readable side for further use. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - */ - writable: WritableStream; - } - interface StreamPipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - /** - * Pipes this readable stream to a given writable stream destination. - * The way in which the piping process behaves under various error - * conditions can be customized with a number of passed options. It - * returns a promise that fulfills when the piping process completes - * successfully, or rejects if any errors were encountered. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - * - * Errors and closures of the source and destination streams propagate - * as follows: - * - * An error in this source readable stream will abort destination, - * unless preventAbort is truthy. The returned promise will be rejected - * with the source's error, or with any error that occurs during - * aborting the destination. - * - * An error in destination will cancel this source readable stream, - * unless preventCancel is truthy. The returned promise will be rejected - * with the destination's error, or with any error that occurs during - * canceling the source. - * - * When this source readable stream closes, destination will be closed, - * unless preventClose is truthy. The returned promise will be fulfilled - * once this process completes, unless an error is encountered while - * closing the destination, in which case it will be rejected with that - * error. - * - * If destination starts out closed or closing, this source readable - * stream will be canceled, unless preventCancel is true. The returned - * promise will be rejected with an error indicating piping to a closed - * stream failed, or with any error that occurs during canceling the - * source. - * - * The signal option can be set to an AbortSignal to allow aborting an - * ongoing pipe operation via the corresponding AbortController. In this - * case, this source readable stream will be canceled, and destination - * aborted, unless the respective options preventCancel or preventAbort - * are set. - */ - preventClose?: boolean; - signal?: AbortSignal; - } - interface ReadableStreamGenericReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - } - interface ReadableStreamDefaultReadValueResult { - done: false; - value: T; - } - interface ReadableStreamDefaultReadDoneResult { - done: true; - value?: undefined; - } - type ReadableStreamController = ReadableStreamDefaultController; - type ReadableStreamDefaultReadResult = - | ReadableStreamDefaultReadValueResult - | ReadableStreamDefaultReadDoneResult; - interface ReadableStreamReadValueResult { - done: false; - value: T; - } - interface ReadableStreamReadDoneResult { - done: true; - value?: T; - } - type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; - interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike; - } - interface UnderlyingSinkAbortCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSinkCloseCallback { - (): void | PromiseLike; - } - interface UnderlyingSinkStartCallback { - (controller: WritableStreamDefaultController): any; - } - interface UnderlyingSinkWriteCallback { - (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; - } - interface UnderlyingSourceCancelCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSourcePullCallback { - (controller: ReadableStreamController): void | PromiseLike; - } - interface UnderlyingSourceStartCallback { - (controller: ReadableStreamController): any; - } - interface TransformerFlushCallback { - (controller: TransformStreamDefaultController): void | PromiseLike; - } - interface TransformerStartCallback { - (controller: TransformStreamDefaultController): any; - } - interface TransformerTransformCallback { - (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; - } - interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; - } - interface UnderlyingSource { - cancel?: UnderlyingSourceCancelCallback; - pull?: UnderlyingSourcePullCallback; - start?: UnderlyingSourceStartCallback; - type?: undefined; - } - interface UnderlyingSink { - abort?: UnderlyingSinkAbortCallback; - close?: UnderlyingSinkCloseCallback; - start?: UnderlyingSinkStartCallback; - type?: undefined; - write?: UnderlyingSinkWriteCallback; - } - interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike; - } - /** This Streams API interface represents a readable stream of byte data. */ - interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; - pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; - pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: { preventCancel?: boolean }): AsyncIterableIterator; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - const ReadableStream: { - prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; - new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; - }; - interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { - read(): Promise>; - releaseLock(): void; - } - interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: T): Promise>; - releaseLock(): void; - } - const ReadableStreamDefaultReader: { - prototype: ReadableStreamDefaultReader; - new(stream: ReadableStream): ReadableStreamDefaultReader; - }; - const ReadableStreamBYOBReader: any; - const ReadableStreamBYOBRequest: any; - interface ReadableByteStreamController { - readonly byobRequest: undefined; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; - } - const ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; - }; - interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(e?: any): void; - } - const ReadableStreamDefaultController: { - prototype: ReadableStreamDefaultController; - new(): ReadableStreamDefaultController; - }; - interface Transformer { - flush?: TransformerFlushCallback; - readableType?: undefined; - start?: TransformerStartCallback; - transform?: TransformerTransformCallback; - writableType?: undefined; - } - interface TransformStream { - readonly readable: ReadableStream; - readonly writable: WritableStream; - } - const TransformStream: { - prototype: TransformStream; - new( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy, - ): TransformStream; - }; - interface TransformStreamDefaultController { - readonly desiredSize: number | null; - enqueue(chunk?: O): void; - error(reason?: any): void; - terminate(): void; - } - const TransformStreamDefaultController: { - prototype: TransformStreamDefaultController; - new(): TransformStreamDefaultController; - }; - /** - * This Streams API interface provides a standard abstraction for writing - * streaming data to a destination, known as a sink. This object comes with - * built-in back pressure and queuing. - */ - interface WritableStream { - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; - } - const WritableStream: { - prototype: WritableStream; - new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; - }; - /** - * This Streams API interface is the object returned by - * WritableStream.getWriter() and once created locks the < writer to the - * WritableStream ensuring that no other streams can write to the underlying - * sink. - */ - interface WritableStreamDefaultWriter { - readonly closed: Promise; - readonly desiredSize: number | null; - readonly ready: Promise; - abort(reason?: any): Promise; - close(): Promise; - releaseLock(): void; - write(chunk?: W): Promise; - } - const WritableStreamDefaultWriter: { - prototype: WritableStreamDefaultWriter; - new(stream: WritableStream): WritableStreamDefaultWriter; - }; - /** - * This Streams API interface represents a controller allowing control of a - * WritableStream's state. When constructing a WritableStream, the - * underlying sink is given a corresponding WritableStreamDefaultController - * instance to manipulate. - */ - interface WritableStreamDefaultController { - error(e?: any): void; - } - const WritableStreamDefaultController: { - prototype: WritableStreamDefaultController; - new(): WritableStreamDefaultController; - }; - interface QueuingStrategy { - highWaterMark?: number; - size?: QueuingStrategySize; - } - interface QueuingStrategySize { - (chunk?: T): number; - } - interface QueuingStrategyInit { - /** - * Creates a new ByteLengthQueuingStrategy with the provided high water - * mark. - * - * Note that the provided high water mark will not be validated ahead of - * time. Instead, if it is negative, NaN, or not a number, the resulting - * ByteLengthQueuingStrategy will cause the corresponding stream - * constructor to throw. - */ - highWaterMark: number; - } - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface ByteLengthQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const ByteLengthQueuingStrategy: { - prototype: ByteLengthQueuingStrategy; - new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; - }; - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface CountQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const CountQueuingStrategy: { - prototype: CountQueuingStrategy; - new(init: QueuingStrategyInit): CountQueuingStrategy; - }; - interface TextEncoderStream { - /** Returns "utf-8". */ - readonly encoding: "utf-8"; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextEncoderStream: { - prototype: TextEncoderStream; - new(): TextEncoderStream; - }; - interface TextDecoderOptions { - fatal?: boolean; - ignoreBOM?: boolean; - } - type BufferSource = ArrayBufferView | ArrayBuffer; - interface TextDecoderStream { - /** Returns encoding's name, lower cased. */ - readonly encoding: string; - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ - readonly fatal: boolean; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ - readonly ignoreBOM: boolean; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextDecoderStream: { - prototype: TextDecoderStream; - new(label?: string, options?: TextDecoderOptions): TextDecoderStream; - }; -} -declare module "node:stream/web" { - export * from "stream/web"; -} diff --git a/reverse_engineering/node_modules/@types/node/string_decoder.d.ts b/reverse_engineering/node_modules/@types/node/string_decoder.d.ts deleted file mode 100644 index b8691e1f..00000000 --- a/reverse_engineering/node_modules/@types/node/string_decoder.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * The `node:string_decoder` module provides an API for decoding `Buffer` objects - * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 - * characters. It can be accessed using: - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * ``` - * - * The following example shows the basic use of the `StringDecoder` class. - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * const decoder = new StringDecoder('utf8'); - * - * const cent = Buffer.from([0xC2, 0xA2]); - * console.log(decoder.write(cent)); // Prints: ¢ - * - * const euro = Buffer.from([0xE2, 0x82, 0xAC]); - * console.log(decoder.write(euro)); // Prints: € - * ``` - * - * When a `Buffer` instance is written to the `StringDecoder` instance, an - * internal buffer is used to ensure that the decoded string does not contain - * any incomplete multibyte characters. These are held in the buffer until the - * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. - * - * In the following example, the three UTF-8 encoded bytes of the European Euro - * symbol (`€`) are written over three separate operations: - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * const decoder = new StringDecoder('utf8'); - * - * decoder.write(Buffer.from([0xE2])); - * decoder.write(Buffer.from([0x82])); - * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js) - */ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: BufferEncoding); - /** - * Returns a decoded string, ensuring that any incomplete multibyte characters at - * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the - * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`. - * @since v0.1.99 - * @param buffer The bytes to decode. - */ - write(buffer: Buffer): string; - /** - * Returns any remaining input stored in the internal buffer as a string. Bytes - * representing incomplete UTF-8 and UTF-16 characters will be replaced with - * substitution characters appropriate for the character encoding. - * - * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input. - * After `end()` is called, the `stringDecoder` object can be reused for new input. - * @since v0.9.3 - * @param buffer The bytes to decode. - */ - end(buffer?: Buffer): string; - } -} -declare module "node:string_decoder" { - export * from "string_decoder"; -} diff --git a/reverse_engineering/node_modules/@types/node/test.d.ts b/reverse_engineering/node_modules/@types/node/test.d.ts deleted file mode 100644 index 44b6a964..00000000 --- a/reverse_engineering/node_modules/@types/node/test.d.ts +++ /dev/null @@ -1,1382 +0,0 @@ -/** - * The `node:test` module facilitates the creation of JavaScript tests. - * To access it: - * - * ```js - * import test from 'node:test'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'test'; - * ``` - * - * Tests created via the `test` module consist of a single function that is - * processed in one of three ways: - * - * 1. A synchronous function that is considered failing if it throws an exception, - * and is considered passing otherwise. - * 2. A function that returns a `Promise` that is considered failing if the`Promise` rejects, and is considered passing if the `Promise` fulfills. - * 3. A function that receives a callback function. If the callback receives any - * truthy value as its first argument, the test is considered failing. If a - * falsy value is passed as the first argument to the callback, the test is - * considered passing. If the test function receives a callback function and - * also returns a `Promise`, the test will fail. - * - * The following example illustrates how tests are written using the`test` module. - * - * ```js - * test('synchronous passing test', (t) => { - * // This test passes because it does not throw an exception. - * assert.strictEqual(1, 1); - * }); - * - * test('synchronous failing test', (t) => { - * // This test fails because it throws an exception. - * assert.strictEqual(1, 2); - * }); - * - * test('asynchronous passing test', async (t) => { - * // This test passes because the Promise returned by the async - * // function is settled and not rejected. - * assert.strictEqual(1, 1); - * }); - * - * test('asynchronous failing test', async (t) => { - * // This test fails because the Promise returned by the async - * // function is rejected. - * assert.strictEqual(1, 2); - * }); - * - * test('failing test using Promises', (t) => { - * // Promises can be used directly as well. - * return new Promise((resolve, reject) => { - * setImmediate(() => { - * reject(new Error('this will cause the test to fail')); - * }); - * }); - * }); - * - * test('callback passing test', (t, done) => { - * // done() is the callback function. When the setImmediate() runs, it invokes - * // done() with no arguments. - * setImmediate(done); - * }); - * - * test('callback failing test', (t, done) => { - * // When the setImmediate() runs, done() is invoked with an Error object and - * // the test fails. - * setImmediate(() => { - * done(new Error('callback failure')); - * }); - * }); - * ``` - * - * If any tests fail, the process exit code is set to `1`. - * @since v18.0.0, v16.17.0 - * @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js) - */ -declare module "node:test" { - import { Readable } from "node:stream"; - import { AsyncResource } from "node:async_hooks"; - /** - * ```js - * import { tap } from 'node:test/reporters'; - * import { run } from 'node:test'; - * import process from 'node:process'; - * import path from 'node:path'; - * - * run({ files: [path.resolve('./tests/test.js')] }) - * .compose(tap) - * .pipe(process.stdout); - * ``` - * @since v18.9.0, v16.19.0 - * @param options Configuration options for running tests. The following properties are supported: - */ - function run(options?: RunOptions): TestsStream; - /** - * The `test()` function is the value imported from the `test` module. Each - * invocation of this function results in reporting the test to the `TestsStream`. - * - * The `TestContext` object passed to the `fn` argument can be used to perform - * actions related to the current test. Examples include skipping the test, adding - * additional diagnostic information, or creating subtests. - * - * `test()` returns a `Promise` that fulfills once the test completes. - * if `test()` is called within a `describe()` block, it fulfills immediately. - * The return value can usually be discarded for top level tests. - * However, the return value from subtests should be used to prevent the parent - * test from finishing first and cancelling the subtest - * as shown in the following example. - * - * ```js - * test('top level test', async (t) => { - * // The setTimeout() in the following subtest would cause it to outlive its - * // parent test if 'await' is removed on the next line. Once the parent test - * // completes, it will cancel any outstanding subtests. - * await t.test('longer running subtest', async (t) => { - * return new Promise((resolve, reject) => { - * setTimeout(resolve, 1000); - * }); - * }); - * }); - * ``` - * - * The `timeout` option can be used to fail the test if it takes longer than`timeout` milliseconds to complete. However, it is not a reliable mechanism for - * canceling tests because a running test might block the application thread and - * thus prevent the scheduled cancellation. - * @since v18.0.0, v16.17.0 - * @param [name='The name'] The name of the test, which is displayed when reporting test results. - * @param options Configuration options for the test. The following properties are supported: - * @param [fn='A no-op function'] The function under test. The first argument to this function is a {@link TestContext} object. If the test uses callbacks, the callback function is passed as the - * second argument. - * @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within {@link describe}. - */ - function test(name?: string, fn?: TestFn): Promise; - function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function test(options?: TestOptions, fn?: TestFn): Promise; - function test(fn?: TestFn): Promise; - namespace test { - export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, todo }; - } - /** - * The `describe()` function imported from the `node:test` module. Each - * invocation of this function results in the creation of a Subtest. - * After invocation of top level `describe` functions, - * all top level tests and suites will execute. - * @param [name='The name'] The name of the suite, which is displayed when reporting test results. - * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. - * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. - * @return Immediately fulfilled with `undefined`. - */ - function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function describe(name?: string, fn?: SuiteFn): Promise; - function describe(options?: TestOptions, fn?: SuiteFn): Promise; - function describe(fn?: SuiteFn): Promise; - namespace describe { - /** - * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`. - */ - function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function skip(name?: string, fn?: SuiteFn): Promise; - function skip(options?: TestOptions, fn?: SuiteFn): Promise; - function skip(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`. - */ - function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function todo(name?: string, fn?: SuiteFn): Promise; - function todo(options?: TestOptions, fn?: SuiteFn): Promise; - function todo(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`. - * @since v18.15.0 - */ - function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function only(name?: string, fn?: SuiteFn): Promise; - function only(options?: TestOptions, fn?: SuiteFn): Promise; - function only(fn?: SuiteFn): Promise; - } - /** - * Shorthand for `test()`. - * - * The `it()` function is imported from the `node:test` module. - * @since v18.6.0, v16.17.0 - */ - function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function it(name?: string, fn?: TestFn): Promise; - function it(options?: TestOptions, fn?: TestFn): Promise; - function it(fn?: TestFn): Promise; - namespace it { - /** - * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`. - */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function skip(name?: string, fn?: TestFn): Promise; - function skip(options?: TestOptions, fn?: TestFn): Promise; - function skip(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`. - */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function todo(name?: string, fn?: TestFn): Promise; - function todo(options?: TestOptions, fn?: TestFn): Promise; - function todo(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`. - * @since v18.15.0 - */ - function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function only(name?: string, fn?: TestFn): Promise; - function only(options?: TestOptions, fn?: TestFn): Promise; - function only(fn?: TestFn): Promise; - } - /** - * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`. - * @since v20.2.0 - */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function skip(name?: string, fn?: TestFn): Promise; - function skip(options?: TestOptions, fn?: TestFn): Promise; - function skip(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`. - * @since v20.2.0 - */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function todo(name?: string, fn?: TestFn): Promise; - function todo(options?: TestOptions, fn?: TestFn): Promise; - function todo(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`. - * @since v20.2.0 - */ - function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function only(name?: string, fn?: TestFn): Promise; - function only(options?: TestOptions, fn?: TestFn): Promise; - function only(fn?: TestFn): Promise; - /** - * The type of a function under test. The first argument to this function is a - * {@link TestContext} object. If the test uses callbacks, the callback function is passed as - * the second argument. - */ - type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; - /** - * The type of a function under Suite. - */ - type SuiteFn = (s: SuiteContext) => void | Promise; - interface TestShard { - /** - * A positive integer between 1 and `` that specifies the index of the shard to run. - */ - index: number; - /** - * A positive integer that specifies the total number of shards to split the test files to. - */ - total: number; - } - interface RunOptions { - /** - * If a number is provided, then that many files would run in parallel. - * If truthy, it would run (number of cpu cores - 1) files in parallel. - * If falsy, it would only run one file at a time. - * If unspecified, subtests inherit this value from their parent. - * @default true - */ - concurrency?: number | boolean | undefined; - /** - * An array containing the list of files to run. - * If unspecified, the test runner execution model will be used. - */ - files?: readonly string[] | undefined; - /** - * Allows aborting an in-progress test execution. - * @default undefined - */ - signal?: AbortSignal | undefined; - /** - * A number of milliseconds the test will fail after. - * If unspecified, subtests inherit this value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - /** - * Sets inspector port of test child process. - * If a nullish value is provided, each process gets its own port, - * incremented from the primary's `process.debugPort`. - */ - inspectPort?: number | (() => number) | undefined; - /** - * That can be used to only run tests whose name matches the provided pattern. - * Test name patterns are interpreted as JavaScript regular expressions. - * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run. - */ - testNamePatterns?: string | RegExp | string[] | RegExp[]; - /** - * If truthy, the test context will only run tests that have the `only` option set - */ - only?: boolean; - /** - * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run. - */ - setup?: (root: Test) => void | Promise; - /** - * Whether to run in watch mode or not. - * @default false - */ - watch?: boolean | undefined; - /** - * Running tests in a specific shard. - * @default undefined - */ - shard?: TestShard | undefined; - } - class Test extends AsyncResource { - concurrency: number; - nesting: number; - only: boolean; - reporter: TestsStream; - runOnlySubtests: boolean; - testNumber: number; - timeout: number | null; - } - /** - * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the - * order of the tests definition - * @since v18.9.0, v16.19.0 - */ - class TestsStream extends Readable implements NodeJS.ReadableStream { - addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - addListener(event: "test:fail", listener: (data: TestFail) => void): this; - addListener(event: "test:pass", listener: (data: TestPass) => void): this; - addListener(event: "test:plan", listener: (data: TestPlan) => void): this; - addListener(event: "test:start", listener: (data: TestStart) => void): this; - addListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - addListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; - emit(event: "test:diagnostic", data: DiagnosticData): boolean; - emit(event: "test:fail", data: TestFail): boolean; - emit(event: "test:pass", data: TestPass): boolean; - emit(event: "test:plan", data: TestPlan): boolean; - emit(event: "test:start", data: TestStart): boolean; - emit(event: "test:stderr", data: TestStderr): boolean; - emit(event: "test:stdout", data: TestStdout): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - on(event: "test:fail", listener: (data: TestFail) => void): this; - on(event: "test:pass", listener: (data: TestPass) => void): this; - on(event: "test:plan", listener: (data: TestPlan) => void): this; - on(event: "test:start", listener: (data: TestStart) => void): this; - on(event: "test:stderr", listener: (data: TestStderr) => void): this; - on(event: "test:stdout", listener: (data: TestStdout) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - once(event: "test:fail", listener: (data: TestFail) => void): this; - once(event: "test:pass", listener: (data: TestPass) => void): this; - once(event: "test:plan", listener: (data: TestPlan) => void): this; - once(event: "test:start", listener: (data: TestStart) => void): this; - once(event: "test:stderr", listener: (data: TestStderr) => void): this; - once(event: "test:stdout", listener: (data: TestStdout) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - prependListener(event: "test:fail", listener: (data: TestFail) => void): this; - prependListener(event: "test:pass", listener: (data: TestPass) => void): this; - prependListener(event: "test:plan", listener: (data: TestPlan) => void): this; - prependListener(event: "test:start", listener: (data: TestStart) => void): this; - prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this; - prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this; - prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this; - prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this; - prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - } - /** - * An instance of `TestContext` is passed to each test function in order to - * interact with the test runner. However, the `TestContext` constructor is not - * exposed as part of the API. - * @since v18.0.0, v16.17.0 - */ - class TestContext { - /** - * This function is used to create a hook running before subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v20.1.0 - */ - before: typeof before; - /** - * This function is used to create a hook running before each subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - beforeEach: typeof beforeEach; - /** - * This function is used to create a hook that runs after the current test finishes. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.13.0 - */ - after: typeof after; - /** - * This function is used to create a hook running after each subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - afterEach: typeof afterEach; - /** - * This function is used to write diagnostics to the output. Any diagnostic - * information is included at the end of the test's results. This function does - * not return a value. - * - * ```js - * test('top level test', (t) => { - * t.diagnostic('A diagnostic message'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Message to be reported. - */ - diagnostic(message: string): void; - /** - * The name of the test. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * If `shouldRunOnlyTests` is truthy, the test context will only run tests that - * have the `only` option set. Otherwise, all tests are run. If Node.js was not - * started with the `--test-only` command-line option, this function is a - * no-op. - * - * ```js - * test('top level test', (t) => { - * // The test context can be set to run subtests with the 'only' option. - * t.runOnly(true); - * return Promise.all([ - * t.test('this subtest is now skipped'), - * t.test('this subtest is run', { only: true }), - * ]); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param shouldRunOnlyTests Whether or not to run `only` tests. - */ - runOnly(shouldRunOnlyTests: boolean): void; - /** - * ```js - * test('top level test', async (t) => { - * await fetch('some/uri', { signal: t.signal }); - * }); - * ``` - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - /** - * This function causes the test's output to indicate the test as skipped. If`message` is provided, it is included in the output. Calling `skip()` does - * not terminate execution of the test function. This function does not return a - * value. - * - * ```js - * test('top level test', (t) => { - * // Make sure to return here as well if the test contains additional logic. - * t.skip('this is skipped'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional skip message. - */ - skip(message?: string): void; - /** - * This function adds a `TODO` directive to the test's output. If `message` is - * provided, it is included in the output. Calling `todo()` does not terminate - * execution of the test function. This function does not return a value. - * - * ```js - * test('top level test', (t) => { - * // This test is marked as `TODO` - * t.todo('this is a todo'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional `TODO` message. - */ - todo(message?: string): void; - /** - * This function is used to create subtests under the current test. This function behaves in - * the same fashion as the top level {@link test} function. - * @since v18.0.0 - * @param name The name of the test, which is displayed when reporting test results. - * Default: The `name` property of fn, or `''` if `fn` does not have a name. - * @param options Configuration options for the test - * @param fn The function under test. This first argument to this function is a - * {@link TestContext} object. If the test uses callbacks, the callback function is - * passed as the second argument. Default: A no-op function. - * @returns A {@link Promise} resolved with `undefined` once the test completes. - */ - test: typeof test; - /** - * Each test provides its own MockTracker instance. - */ - readonly mock: MockTracker; - } - /** - * An instance of `SuiteContext` is passed to each suite function in order to - * interact with the test runner. However, the `SuiteContext` constructor is not - * exposed as part of the API. - * @since v18.7.0, v16.17.0 - */ - class SuiteContext { - /** - * The name of the suite. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * Can be used to abort test subtasks when the test has been aborted. - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - } - interface TestOptions { - /** - * If a number is provided, then that many tests would run in parallel. - * If truthy, it would run (number of cpu cores - 1) tests in parallel. - * For subtests, it will be `Infinity` tests in parallel. - * If falsy, it would only run one test at a time. - * If unspecified, subtests inherit this value from their parent. - * @default false - */ - concurrency?: number | boolean | undefined; - /** - * If truthy, and the test context is configured to run `only` tests, then this test will be - * run. Otherwise, the test is skipped. - * @default false - */ - only?: boolean | undefined; - /** - * Allows aborting an in-progress test. - * @since v18.8.0 - */ - signal?: AbortSignal | undefined; - /** - * If truthy, the test is skipped. If a string is provided, that string is displayed in the - * test results as the reason for skipping the test. - * @default false - */ - skip?: boolean | string | undefined; - /** - * A number of milliseconds the test will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - * @since v18.7.0 - */ - timeout?: number | undefined; - /** - * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in - * the test results as the reason why the test is `TODO`. - * @default false - */ - todo?: boolean | string | undefined; - } - /** - * This function is used to create a hook running before running a suite. - * - * ```js - * describe('tests', async () => { - * before(() => console.log('about to run some test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function before(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running after running a suite. - * - * ```js - * describe('tests', async () => { - * after(() => console.log('finished running tests')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function after(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running - * before each subtest of the current suite. - * - * ```js - * describe('tests', async () => { - * beforeEach(() => console.log('about to run a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function beforeEach(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running - * after each subtest of the current test. - * - * ```js - * describe('tests', async () => { - * afterEach(() => console.log('finished running a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function afterEach(fn?: HookFn, options?: HookOptions): void; - /** - * The hook function. If the hook uses callbacks, the callback function is passed as the - * second argument. - */ - type HookFn = (s: SuiteContext, done: (result?: any) => void) => any; - /** - * Configuration options for hooks. - * @since v18.8.0 - */ - interface HookOptions { - /** - * Allows aborting an in-progress hook. - */ - signal?: AbortSignal | undefined; - /** - * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - } - interface MockFunctionOptions { - /** - * The number of times that the mock will use the behavior of `implementation`. - * Once the mock function has been called `times` times, - * it will automatically restore the behavior of `original`. - * This value must be an integer greater than zero. - * @default Infinity - */ - times?: number | undefined; - } - interface MockMethodOptions extends MockFunctionOptions { - /** - * If `true`, `object[methodName]` is treated as a getter. - * This option cannot be used with the `setter` option. - */ - getter?: boolean | undefined; - /** - * If `true`, `object[methodName]` is treated as a setter. - * This option cannot be used with the `getter` option. - */ - setter?: boolean | undefined; - } - type Mock = F & { - mock: MockFunctionContext; - }; - type NoOpFunction = (...args: any[]) => undefined; - type FunctionPropertyNames = { - [K in keyof T]: T[K] extends Function ? K : never; - }[keyof T]; - /** - * The `MockTracker` class is used to manage mocking functionality. The test runner - * module provides a top level `mock` export which is a `MockTracker` instance. - * Each test also provides its own `MockTracker` instance via the test context's`mock` property. - * @since v19.1.0, v18.13.0 - */ - class MockTracker { - /** - * This function is used to create a mock function. - * - * The following example creates a mock function that increments a counter by one - * on each invocation. The `times` option is used to modify the mock behavior such - * that the first two invocations add two to the counter instead of one. - * - * ```js - * test('mocks a counting function', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); - * - * assert.strictEqual(fn(), 2); - * assert.strictEqual(fn(), 4); - * assert.strictEqual(fn(), 5); - * assert.strictEqual(fn(), 6); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param [original='A no-op function'] An optional function to create a mock on. - * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and - * then restore the behavior of `original`. - * @param options Optional configuration options for the mock function. The following properties are supported: - * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked function. - */ - fn(original?: F, options?: MockFunctionOptions): Mock; - fn( - original?: F, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock; - /** - * This function is used to create a mock on an existing object method. The - * following example demonstrates how a mock is created on an existing object - * method. - * - * ```js - * test('spies on an object method', (t) => { - * const number = { - * value: 5, - * subtract(a) { - * return this.value - a; - * }, - * }; - * - * t.mock.method(number, 'subtract'); - * assert.strictEqual(number.subtract.mock.calls.length, 0); - * assert.strictEqual(number.subtract(3), 2); - * assert.strictEqual(number.subtract.mock.calls.length, 1); - * - * const call = number.subtract.mock.calls[0]; - * - * assert.deepStrictEqual(call.arguments, [3]); - * assert.strictEqual(call.result, 2); - * assert.strictEqual(call.error, undefined); - * assert.strictEqual(call.target, undefined); - * assert.strictEqual(call.this, number); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param object The object whose method is being mocked. - * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. - * @param implementation An optional function used as the mock implementation for `object[methodName]`. - * @param options Optional configuration options for the mock method. The following properties are supported: - * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked method. - */ - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation: Implementation, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method( - object: MockedObject, - methodName: keyof MockedObject, - options: MockMethodOptions, - ): Mock; - method( - object: MockedObject, - methodName: keyof MockedObject, - implementation: Function, - options: MockMethodOptions, - ): Mock; - - /** - * This function is syntax sugar for `MockTracker.method` with `options.getter`set to `true`. - * @since v19.3.0, v18.13.0 - */ - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<() => MockedObject[MethodName]>; - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<(() => MockedObject[MethodName]) | Implementation>; - /** - * This function is syntax sugar for `MockTracker.method` with `options.setter`set to `true`. - * @since v19.3.0, v18.13.0 - */ - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<(value: MockedObject[MethodName]) => void>; - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker` and disassociates the mocks from the`MockTracker` instance. Once disassociated, the mocks can still be used, but the`MockTracker` instance can no longer be - * used to reset their behavior or - * otherwise interact with them. - * - * After each test completes, this function is called on the test context's`MockTracker`. If the global `MockTracker` is used extensively, calling this - * function manually is recommended. - * @since v19.1.0, v18.13.0 - */ - reset(): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does - * not disassociate the mocks from the `MockTracker` instance. - * @since v19.1.0, v18.13.0 - */ - restoreAll(): void; - timers: MockTimers; - } - const mock: MockTracker; - interface MockFunctionCall< - F extends Function, - ReturnType = F extends (...args: any) => infer T ? T - : F extends abstract new(...args: any) => infer T ? T - : unknown, - Args = F extends (...args: infer Y) => any ? Y - : F extends abstract new(...args: infer Y) => any ? Y - : unknown[], - > { - /** - * An array of the arguments passed to the mock function. - */ - arguments: Args; - /** - * If the mocked function threw then this property contains the thrown value. - */ - error: unknown | undefined; - /** - * The value returned by the mocked function. - * - * If the mocked function threw, it will be `undefined`. - */ - result: ReturnType | undefined; - /** - * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. - */ - stack: Error; - /** - * If the mocked function is a constructor, this field contains the class being constructed. - * Otherwise this will be `undefined`. - */ - target: F extends abstract new(...args: any) => any ? F : undefined; - /** - * The mocked function's `this` value. - */ - this: unknown; - } - /** - * The `MockFunctionContext` class is used to inspect or manipulate the behavior of - * mocks created via the `MockTracker` APIs. - * @since v19.1.0, v18.13.0 - */ - class MockFunctionContext { - /** - * A getter that returns a copy of the internal array used to track calls to the - * mock. Each entry in the array is an object with the following properties. - * @since v19.1.0, v18.13.0 - */ - readonly calls: Array>; - /** - * This function returns the number of times that this mock has been invoked. This - * function is more efficient than checking `ctx.calls.length` because `ctx.calls`is a getter that creates a copy of the internal call tracking array. - * @since v19.1.0, v18.13.0 - * @return The number of times that this mock has been invoked. - */ - callCount(): number; - /** - * This function is used to change the behavior of an existing mock. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, and then changes the mock implementation to a different function. - * - * ```js - * test('changes a mock behavior', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementation(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 5); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's new implementation. - */ - mockImplementation(implementation: Function): void; - /** - * This function is used to change the behavior of an existing mock for a single - * invocation. Once invocation `onCall` has occurred, the mock will revert to - * whatever behavior it would have used had `mockImplementationOnce()` not been - * called. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, changes the mock implementation to a different function for the - * next invocation, and then resumes its previous behavior. - * - * ```js - * test('changes a mock behavior once', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementationOnce(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 4); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. - * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. - */ - mockImplementationOnce(implementation: Function, onCall?: number): void; - /** - * Resets the call history of the mock function. - * @since v19.3.0, v18.13.0 - */ - resetCalls(): void; - /** - * Resets the implementation of the mock function to its original behavior. The - * mock can still be used after calling this function. - * @since v19.1.0, v18.13.0 - */ - restore(): void; - } - type Timer = "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout"; - /** - * Mocking timers is a technique commonly used in software testing to simulate and - * control the behavior of timers, such as `setInterval` and `setTimeout`, - * without actually waiting for the specified time intervals. - * - * The `MockTracker` provides a top-level `timers` export - * which is a `MockTimers` instance. - * @since v20.4.0 - * @experimental - */ - class MockTimers { - /** - * Enables timer mocking for the specified timers. - * - * **Note:** When you enable mocking for a specific timer, its associated - * clear function will also be implicitly mocked. - * - * Example usage: - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.enable(['setInterval']); - * ``` - * - * The above example enables mocking for the `setInterval` timer and - * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. - * - * Alternatively, if you call `mock.timers.enable()` without any parameters: - * - * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) - * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, - * and `globalThis` will be mocked. - * @since v20.4.0 - */ - enable(timers?: Timer[]): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTimers` instance and disassociates the mocks - * from the `MockTracker` instance. - * - * **Note:** After each test completes, this function is called on - * the test context's `MockTracker`. - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.reset(); - * ``` - * @since v20.4.0 - */ - reset(): void; - /** - * Advances time for all mocked timers. - * - * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts - * only positive numbers. In Node.js, `setTimeout` with negative numbers is - * only supported for web compatibility reasons. - * - * The following example mocks a `setTimeout` function and - * by using `.tick` advances in - * time triggering all pending timers. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * - * context.mock.timers.enable(['setTimeout']); - * - * setTimeout(fn, 9999); - * - * assert.strictEqual(fn.mock.callCount(), 0); - * - * // Advance in time - * context.mock.timers.tick(9999); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * - * Alternativelly, the `.tick` function can be called many times - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * context.mock.timers.enable(['setTimeout']); - * const nineSecs = 9000; - * setTimeout(fn, nineSecs); - * - * const twoSeconds = 3000; - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * @since v20.4.0 - */ - tick(milliseconds: number): void; - /** - * Triggers all pending mocked timers immediately. - * - * The example below triggers all pending timers immediately, - * causing them to execute without any delay. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('runAll functions following the given order', (context) => { - * context.mock.timers.enable(['setTimeout']); - * const results = []; - * setTimeout(() => results.push(1), 9999); - * - * // Notice that if both timers have the same timeout, - * // the order of execution is guaranteed - * setTimeout(() => results.push(3), 8888); - * setTimeout(() => results.push(2), 8888); - * - * assert.deepStrictEqual(results, []); - * - * context.mock.timers.runAll(); - * - * assert.deepStrictEqual(results, [3, 2, 1]); - * }); - * ``` - * - * **Note:** The `runAll()` function is specifically designed for - * triggering timers in the context of timer mocking. - * It does not have any effect on real-time system - * clocks or actual timers outside of the mocking environment. - * @since v20.4.0 - */ - runAll(): void; - /** - * Calls {@link MockTimers.reset()}. - */ - [Symbol.dispose](): void; - } - export { - after, - afterEach, - before, - beforeEach, - describe, - it, - Mock, - mock, - only, - run, - skip, - test, - test as default, - todo, - }; -} - -interface TestLocationInfo { - /** - * The column number where the test is defined, or - * `undefined` if the test was run through the REPL. - */ - column?: number; - /** - * The path of the test file, `undefined` if test is not ran through a file. - */ - file?: string; - /** - * The line number where the test is defined, or - * `undefined` if the test was run through the REPL. - */ - line?: number; -} -interface DiagnosticData extends TestLocationInfo { - /** - * The diagnostic message. - */ - message: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestFail extends TestLocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * The error thrown by the test. - */ - error: Error; - /** - * The type of the test, used to denote whether this is a suite. - * @since 20.0.0, 19.9.0, 18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; -} -interface TestPass extends TestLocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * The type of the test, used to denote whether this is a suite. - * @since 20.0.0, 19.9.0, 18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; -} -interface TestPlan extends TestLocationInfo { - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The number of subtests that have ran. - */ - count: number; -} -interface TestStart extends TestLocationInfo { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestStderr extends TestLocationInfo { - /** - * The message written to `stderr` - */ - message: string; -} -interface TestStdout extends TestLocationInfo { - /** - * The message written to `stdout` - */ - message: string; -} -interface TestEnqueue extends TestLocationInfo { - /** - * The test name - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestDequeue extends TestLocationInfo { - /** - * The test name - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} - -/** - * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. - * To access it: - * - * ```js - * import test from 'node:test/reporters'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'test/reporters'; - * ``` - * @since v19.9.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) - */ -declare module "node:test/reporters" { - import { Transform } from "node:stream"; - - type TestEvent = - | { type: "test:diagnostic"; data: DiagnosticData } - | { type: "test:fail"; data: TestFail } - | { type: "test:pass"; data: TestPass } - | { type: "test:plan"; data: TestPlan } - | { type: "test:start"; data: TestStart } - | { type: "test:stderr"; data: TestStderr } - | { type: "test:stdout"; data: TestStdout } - | { type: "test:enqueue"; data: TestEnqueue } - | { type: "test:dequeue"; data: TestDequeue } - | { type: "test:watch:drained" }; - type TestEventGenerator = AsyncGenerator; - - /** - * The `dot` reporter outputs the test results in a compact format, - * where each passing test is represented by a `.`, - * and each failing test is represented by a `X`. - */ - function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>; - /** - * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. - */ - function tap(source: TestEventGenerator): AsyncGenerator; - /** - * The `spec` reporter outputs the test results in a human-readable format. - */ - class Spec extends Transform { - constructor(); - } - /** - * The `junit` reporter outputs test results in a jUnit XML format - */ - function junit(source: TestEventGenerator): AsyncGenerator; - export { dot, junit, Spec as spec, tap, TestEvent }; -} diff --git a/reverse_engineering/node_modules/@types/node/timers.d.ts b/reverse_engineering/node_modules/@types/node/timers.d.ts deleted file mode 100644 index 039f31f7..00000000 --- a/reverse_engineering/node_modules/@types/node/timers.d.ts +++ /dev/null @@ -1,240 +0,0 @@ -/** - * The `timer` module exposes a global API for scheduling functions to - * be called at some future period of time. Because the timer functions are - * globals, there is no need to call `require('node:timers')` to use the API. - * - * The timer functions within Node.js implement a similar API as the timers API - * provided by Web Browsers but use a different internal implementation that is - * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js) - */ -declare module "timers" { - import { Abortable } from "node:events"; - import { - setImmediate as setImmediatePromise, - setInterval as setIntervalPromise, - setTimeout as setTimeoutPromise, - } from "node:timers/promises"; - interface TimerOptions extends Abortable { - /** - * Set to `false` to indicate that the scheduled `Timeout` - * should not require the Node.js event loop to remain active. - * @default true - */ - ref?: boolean | undefined; - } - let setTimeout: typeof global.setTimeout; - let clearTimeout: typeof global.clearTimeout; - let setInterval: typeof global.setInterval; - let clearInterval: typeof global.clearInterval; - let setImmediate: typeof global.setImmediate; - let clearImmediate: typeof global.clearImmediate; - global { - namespace NodeJS { - // compatibility with older typings - interface Timer extends RefCounted { - hasRef(): boolean; - refresh(): this; - [Symbol.toPrimitive](): number; - } - /** - * This object is created internally and is returned from `setImmediate()`. It - * can be passed to `clearImmediate()` in order to cancel the scheduled - * actions. - * - * By default, when an immediate is scheduled, the Node.js event loop will continue - * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to - * control this default behavior. - */ - class Immediate implements RefCounted { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no - * effect. - * - * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary - * to call `immediate.ref()` unless `immediate.unref()` had been called previously. - * @since v9.7.0 - * @return a reference to `immediate` - */ - ref(): this; - /** - * When called, the active `Immediate` object will not require the Node.js event - * loop to remain active. If there is no other activity keeping the event loop - * running, the process may exit before the `Immediate` object's callback is - * invoked. Calling `immediate.unref()` multiple times will have no effect. - * @since v9.7.0 - * @return a reference to `immediate` - */ - unref(): this; - /** - * If true, the `Immediate` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - _onImmediate: Function; // to distinguish it from the Timeout class - /** - * Cancels the immediate. This is similar to calling `clearImmediate()`. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - } - /** - * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the - * scheduled actions. - * - * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the - * timer is active. Each of the `Timeout` objects returned by these functions - * export both `timeout.ref()` and `timeout.unref()` functions that can be used to - * control this default behavior. - */ - class Timeout implements Timer { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. - * - * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary - * to call `timeout.ref()` unless `timeout.unref()` had been called previously. - * @since v0.9.1 - * @return a reference to `timeout` - */ - ref(): this; - /** - * When called, the active `Timeout` object will not require the Node.js event loop - * to remain active. If there is no other activity keeping the event loop running, - * the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect. - * @since v0.9.1 - * @return a reference to `timeout` - */ - unref(): this; - /** - * If true, the `Timeout` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - /** - * Sets the timer's start time to the current time, and reschedules the timer to - * call its callback at the previously specified duration adjusted to the current - * time. This is useful for refreshing a timer without allocating a new - * JavaScript object. - * - * Using this on a timer that has already called its callback will reactivate the - * timer. - * @since v10.2.0 - * @return a reference to `timeout` - */ - refresh(): this; - [Symbol.toPrimitive](): number; - /** - * Cancels the timeout. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - } - } - /** - * Schedules execution of a one-time `callback` after `delay` milliseconds. - * - * The `callback` will likely not be invoked in precisely `delay` milliseconds. - * Node.js makes no guarantees about the exact timing of when callbacks will fire, - * nor of their ordering. The callback will be called as close as possible to the - * time specified. - * - * When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param [delay=1] The number of milliseconds to wait before calling the `callback`. - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearTimeout} - */ - function setTimeout( - callback: (...args: TArgs) => void, - ms?: number, - ...args: TArgs - ): NodeJS.Timeout; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout; - namespace setTimeout { - const __promisify__: typeof setTimeoutPromise; - } - /** - * Cancels a `Timeout` object created by `setTimeout()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number. - */ - function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; - /** - * Schedules repeated execution of `callback` every `delay` milliseconds. - * - * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be - * set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setInterval()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param [delay=1] The number of milliseconds to wait before calling the `callback`. - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearInterval} - */ - function setInterval( - callback: (...args: TArgs) => void, - ms?: number, - ...args: TArgs - ): NodeJS.Timeout; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout; - namespace setInterval { - const __promisify__: typeof setIntervalPromise; - } - /** - * Cancels a `Timeout` object created by `setInterval()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number. - */ - function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; - /** - * Schedules the "immediate" execution of the `callback` after I/O events' - * callbacks. - * - * When multiple calls to `setImmediate()` are made, the `callback` functions are - * queued for execution in the order in which they are created. The entire callback - * queue is processed every event loop iteration. If an immediate timer is queued - * from inside an executing callback, that timer will not be triggered until the - * next event loop iteration. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`. - * @since v0.9.1 - * @param callback The function to call at the end of this turn of the Node.js `Event Loop` - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearImmediate} - */ - function setImmediate( - callback: (...args: TArgs) => void, - ...args: TArgs - ): NodeJS.Immediate; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setImmediate(callback: (args: void) => void): NodeJS.Immediate; - namespace setImmediate { - const __promisify__: typeof setImmediatePromise; - } - /** - * Cancels an `Immediate` object created by `setImmediate()`. - * @since v0.9.1 - * @param immediate An `Immediate` object as returned by {@link setImmediate}. - */ - function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; - function queueMicrotask(callback: () => void): void; - } -} -declare module "node:timers" { - export * from "timers"; -} diff --git a/reverse_engineering/node_modules/@types/node/timers/promises.d.ts b/reverse_engineering/node_modules/@types/node/timers/promises.d.ts deleted file mode 100644 index 5a54dc77..00000000 --- a/reverse_engineering/node_modules/@types/node/timers/promises.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * The `timers/promises` API provides an alternative set of timer functions - * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`. - * - * ```js - * import { - * setTimeout, - * setImmediate, - * setInterval, - * } from 'timers/promises'; - * ``` - * @since v15.0.0 - */ -declare module "timers/promises" { - import { TimerOptions } from "node:timers"; - /** - * ```js - * import { - * setTimeout, - * } from 'timers/promises'; - * - * const res = await setTimeout(100, 'result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. - * @param value A value with which the promise is fulfilled. - */ - function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; - /** - * ```js - * import { - * setImmediate, - * } from 'timers/promises'; - * - * const res = await setImmediate('result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param value A value with which the promise is fulfilled. - */ - function setImmediate(value?: T, options?: TimerOptions): Promise; - /** - * Returns an async iterator that generates values in an interval of `delay` ms. - * If `ref` is `true`, you need to call `next()` of async iterator explicitly - * or implicitly to keep the event loop alive. - * - * ```js - * import { - * setInterval, - * } from 'timers/promises'; - * - * const interval = 100; - * for await (const startTime of setInterval(interval, Date.now())) { - * const now = Date.now(); - * console.log(now); - * if ((now - startTime) > 1000) - * break; - * } - * console.log(Date.now()); - * ``` - * @since v15.9.0 - */ - function setInterval(delay?: number, value?: T, options?: TimerOptions): AsyncIterable; - interface Scheduler { - /** - * ```js - * import { scheduler } from 'node:timers/promises'; - * - * await scheduler.wait(1000); // Wait one second before continuing - * ``` - * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. - * Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported. - * @since v16.14.0 - * @experimental - * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. - */ - wait: (delay?: number, options?: TimerOptions) => Promise; - /** - * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. - * Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments. - * @since v16.14.0 - * @experimental - */ - yield: () => Promise; - } - const scheduler: Scheduler; -} -declare module "node:timers/promises" { - export * from "timers/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/tls.d.ts b/reverse_engineering/node_modules/@types/node/tls.d.ts deleted file mode 100644 index b289e841..00000000 --- a/reverse_engineering/node_modules/@types/node/tls.d.ts +++ /dev/null @@ -1,1210 +0,0 @@ -/** - * The `node:tls` module provides an implementation of the Transport Layer Security - * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. - * The module can be accessed using: - * - * ```js - * const tls = require('node:tls'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js) - */ -declare module "tls" { - import { X509Certificate } from "node:crypto"; - import * as net from "node:net"; - import * as stream from "stream"; - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - interface Certificate { - /** - * Country code. - */ - C: string; - /** - * Street. - */ - ST: string; - /** - * Locality. - */ - L: string; - /** - * Organization. - */ - O: string; - /** - * Organizational unit. - */ - OU: string; - /** - * Common name. - */ - CN: string; - } - interface PeerCertificate { - /** - * `true` if a Certificate Authority (CA), `false` otherwise. - * @since v18.13.0 - */ - ca: boolean; - /** - * The DER encoded X.509 certificate data. - */ - raw: Buffer; - /** - * The certificate subject. - */ - subject: Certificate; - /** - * The certificate issuer, described in the same terms as the `subject`. - */ - issuer: Certificate; - /** - * The date-time the certificate is valid from. - */ - valid_from: string; - /** - * The date-time the certificate is valid to. - */ - valid_to: string; - /** - * The certificate serial number, as a hex string. - */ - serialNumber: string; - /** - * The SHA-1 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint: string; - /** - * The SHA-256 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint256: string; - /** - * The SHA-512 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint512: string; - /** - * The extended key usage, a set of OIDs. - */ - ext_key_usage?: string[]; - /** - * A string containing concatenated names for the subject, - * an alternative to the `subject` names. - */ - subjectaltname?: string; - /** - * An array describing the AuthorityInfoAccess, used with OCSP. - */ - infoAccess?: NodeJS.Dict; - /** - * For RSA keys: The RSA bit size. - * - * For EC keys: The key size in bits. - */ - bits?: number; - /** - * The RSA exponent, as a string in hexadecimal number notation. - */ - exponent?: string; - /** - * The RSA modulus, as a hexadecimal string. - */ - modulus?: string; - /** - * The public key. - */ - pubkey?: Buffer; - /** - * The ASN.1 name of the OID of the elliptic curve. - * Well-known curves are identified by an OID. - * While it is unusual, it is possible that the curve - * is identified by its mathematical properties, - * in which case it will not have an OID. - */ - asn1Curve?: string; - /** - * The NIST name for the elliptic curve,if it has one - * (not all well-known curves have been assigned names by NIST). - */ - nistCurve?: string; - } - interface DetailedPeerCertificate extends PeerCertificate { - /** - * The issuer certificate object. - * For self-signed certificates, this may be a circular reference. - */ - issuerCertificate: DetailedPeerCertificate; - } - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - /** - * IETF name for the cipher suite. - */ - standardName: string; - } - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string | undefined; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean | undefined; - /** - * An optional net.Server instance. - */ - server?: net.Server | undefined; - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer | undefined; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean | undefined; - } - /** - * Performs transparent encryption of written data and all required TLS - * negotiation. - * - * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. - * - * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the - * connection is open. - * @since v0.11.4 - */ - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket, options?: TLSSocketOptions); - /** - * This property is `true` if the peer certificate was signed by one of the CAs - * specified when creating the `tls.TLSSocket` instance, otherwise `false`. - * @since v0.11.4 - */ - authorized: boolean; - /** - * Returns the reason why the peer's certificate was not been verified. This - * property is set only when `tlsSocket.authorized === false`. - * @since v0.11.4 - */ - authorizationError: Error; - /** - * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. - * @since v0.11.4 - */ - encrypted: true; - /** - * String containing the selected ALPN protocol. - * Before a handshake has completed, this value is always null. - * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol: string | false | null; - /** - * Returns an object representing the local certificate. The returned object has - * some properties corresponding to the fields of the certificate. - * - * See {@link TLSSocket.getPeerCertificate} for an example of the certificate - * structure. - * - * If there is no local certificate, an empty object will be returned. If the - * socket has been destroyed, `null` will be returned. - * @since v11.2.0 - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object containing information on the negotiated cipher suite. - * - * For example, a TLSv1.2 protocol with AES256-SHA cipher: - * - * ```json - * { - * "name": "AES256-SHA", - * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", - * "version": "SSLv3" - * } - * ``` - * - * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. - * @since v0.11.4 - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter of - * an ephemeral key exchange in `perfect forward secrecy` on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; `null` is returned - * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`. - * - * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. - * @since v5.0.0 - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. - */ - getFinished(): Buffer | undefined; - /** - * Returns an object representing the peer's certificate. If the peer does not - * provide a certificate, an empty object will be returned. If the socket has been - * destroyed, `null` will be returned. - * - * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's - * certificate. - * @since v0.11.4 - * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. - * @return A certificate object. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so - * far. - */ - getPeerFinished(): Buffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the - * current connection. The value `'unknown'` will be returned for connected - * sockets that have not completed the handshaking process. The value `null` will - * be returned for server sockets or disconnected client sockets. - * - * Protocol versions are: - * - * * `'SSLv3'` - * * `'TLSv1'` - * * `'TLSv1.1'` - * * `'TLSv1.2'` - * * `'TLSv1.3'` - * - * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. - * @since v5.7.0 - */ - getProtocol(): string | null; - /** - * Returns the TLS session data or `undefined` if no session was - * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful - * for debugging. - * - * See `Session Resumption` for more information. - * - * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications - * must use the `'session'` event (it also works for TLSv1.2 and below). - * @since v0.11.4 - */ - getSession(): Buffer | undefined; - /** - * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. - * @since v12.11.0 - * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. - * - * It may be useful for debugging. - * - * See `Session Resumption` for more information. - * @since v0.11.4 - */ - getTLSTicket(): Buffer | undefined; - /** - * See `Session Resumption` for more information. - * @since v0.5.6 - * @return `true` if the session was reused, `false` otherwise. - */ - isSessionReused(): boolean; - /** - * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. - * Upon completion, the `callback` function will be passed a single argument - * that is either an `Error` (if the request failed) or `null`. - * - * This method can be used to request a peer's certificate after the secure - * connection has been established. - * - * When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout. - * - * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the - * protocol. - * @since v0.11.8 - * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with - * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. - * @return `true` if renegotiation was initiated, `false` otherwise. - */ - renegotiate( - options: { - rejectUnauthorized?: boolean | undefined; - requestCert?: boolean | undefined; - }, - callback: (err: Error | null) => void, - ): undefined | boolean; - /** - * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. - * Returns `true` if setting the limit succeeded; `false` otherwise. - * - * Smaller fragment sizes decrease the buffering latency on the client: larger - * fragments are buffered by the TLS layer until the entire fragment is received - * and its integrity is verified; large fragments can span multiple roundtrips - * and their processing can be delayed due to packet loss or reordering. However, - * smaller fragments add extra TLS framing bytes and CPU overhead, which may - * decrease overall server throughput. - * @since v0.11.11 - * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. - */ - setMaxSendFragment(size: number): boolean; - /** - * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts - * to renegotiate will trigger an `'error'` event on the `TLSSocket`. - * @since v8.4.0 - */ - disableRenegotiation(): void; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by - * OpenSSL's `SSL_trace()` function, the format is undocumented, can change - * without notice, and should not be relied on. - * @since v12.2.0 - */ - enableTrace(): void; - /** - * Returns the peer certificate as an `X509Certificate` object. - * - * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getPeerX509Certificate(): X509Certificate | undefined; - /** - * Returns the local certificate as an `X509Certificate` object. - * - * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getX509Certificate(): X509Certificate | undefined; - /** - * Keying material is used for validations to prevent different kind of attacks in - * network protocols, for example in the specifications of IEEE 802.1X. - * - * Example - * - * ```js - * const keyingMaterial = tlsSocket.exportKeyingMaterial( - * 128, - * 'client finished'); - * - * /* - * Example return value of keyingMaterial: - * - * - * ``` - * - * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more - * information. - * @since v13.10.0, v12.17.0 - * @param length number of bytes to retrieve from keying material - * @param label an application specific label, typically this will be a value from the [IANA Exporter Label - * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). - * @param context Optionally provide a context. - * @return requested bytes of the keying material - */ - exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; - } - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext | undefined; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean | undefined; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean | undefined; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean | undefined; - } - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer | undefined; - /** - * @param socket - * @param identity identity parameter sent from the client. - * @return pre-shared key that must either be - * a buffer or `null` to stop the negotiation process. Returned PSK must be - * compatible with the selected cipher's digest. - * - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with the identity provided by the client. - * If the return value is `null` the negotiation process will stop and an - * "unknown_psk_identity" alert message will be sent to the other party. - * If the server wishes to hide the fact that the PSK identity was not known, - * the callback must provide some random data as `psk` to make the connection - * fail with "decrypt_error" before negotiation is finished. - * PSK ciphers are disabled by default, and using TLS-PSK thus - * requires explicitly specifying a cipher suite with the `ciphers` option. - * More information can be found in the RFC 4279. - */ - pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; - /** - * hint to send to a client to help - * with selecting the identity during TLS-PSK negotiation. Will be ignored - * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be - * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. - */ - pskIdentityHint?: string | undefined; - } - interface PSKCallbackNegotation { - psk: DataView | NodeJS.TypedArray; - identity: string; - } - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string | undefined; - port?: number | undefined; - path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity | undefined; - servername?: string | undefined; // SNI TLS Extension - session?: Buffer | undefined; - minDHSize?: number | undefined; - lookup?: net.LookupFunction | undefined; - timeout?: number | undefined; - /** - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with optional identity `hint` provided by the server or `null` - * in case of TLS 1.3 where `hint` was removed. - * It will be necessary to provide a custom `tls.checkServerIdentity()` - * for the connection as the default one will try to check hostname/IP - * of the server against the certificate but that's not applicable for PSK - * because there won't be a certificate present. - * More information can be found in the RFC 4279. - * - * @param hint message sent from the server to help client - * decide which identity to use during negotiation. - * Always `null` if TLS 1.3 is used. - * @returns Return `null` to stop the negotiation process. `psk` must be - * compatible with the selected cipher's digest. - * `identity` must use UTF-8 encoding. - */ - pskCallback?(hint: string | null): PSKCallbackNegotation | null; - } - /** - * Accepts encrypted connections using TLS or SSL. - * @since v0.3.2 - */ - class Server extends net.Server { - constructor(secureConnectionListener?: (socket: TLSSocket) => void); - constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); - /** - * The `server.addContext()` method adds a secure context that will be used if - * the client request's SNI name matches the supplied `hostname` (or wildcard). - * - * When there are multiple matching contexts, the most recently added one is - * used. - * @since v0.5.3 - * @param hostname A SNI host name or wildcard (e.g. `'*'`) - * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created - * with {@link createSecureContext} itself. - */ - addContext(hostname: string, context: SecureContextOptions): void; - /** - * Returns the session ticket keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @return A 48-byte buffer containing the session ticket keys. - */ - getTicketKeys(): Buffer; - /** - * The `server.setSecureContext()` method replaces the secure context of an - * existing server. Existing connections to the server are not interrupted. - * @since v11.0.0 - * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). - */ - setSecureContext(options: SecureContextOptions): void; - /** - * Sets the session ticket keys. - * - * Changes to the ticket keys are effective only for future server connections. - * Existing or currently pending server connections will use the previous keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @param keys A 48-byte buffer containing the session ticket keys. - */ - setTicketKeys(keys: Buffer): void; - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; - emit( - event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ): boolean; - emit( - event: "resumeSession", - sessionId: Buffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; - on( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - } - /** - * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. - */ - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; - interface SecureContextOptions { - /** - * If set, this will be called when a client opens a connection using the ALPN extension. - * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, - * respectively containing the server name from the SNI extension (if any) and an array of - * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, - * which will be returned to the client as the selected ALPN protocol, or `undefined`, - * to reject the connection with a fatal alert. If a string is returned that does not match one of - * the client's ALPN protocols, an error will be thrown. - * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. - */ - ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array | undefined; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array | undefined; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string | undefined; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string | undefined; - /** - * Name of an OpenSSL engine which can provide the client certificate. - */ - clientCertEngine?: string | undefined; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array | undefined; - /** - * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. - * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. - * ECDHE-based perfect forward secrecy will still be available. - */ - dhparam?: string | Buffer | undefined; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string | undefined; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean | undefined; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array | undefined; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - */ - privateKeyEngine?: string | undefined; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - */ - privateKeyIdentifier?: string | undefined; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion | undefined; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion | undefined; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string | undefined; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array | undefined; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string | undefined; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - * See Session Resumption for more information. - */ - ticketKeys?: Buffer | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - } - interface SecureContext { - context: any; - } - /** - * Verifies the certificate `cert` is issued to `hostname`. - * - * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on - * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). - * - * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as - * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. - * - * This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The - * overwriting function can call `tls.checkServerIdentity()` of course, to augment - * the checks done with additional verification. - * - * This function is only called if the certificate passed all other checks, such as - * being issued by trusted CA (`options.ca`). - * - * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name - * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use - * a custom`options.checkServerIdentity` function that implements the desired behavior. - * @since v0.8.4 - * @param hostname The host name or IP address to verify the certificate against. - * @param cert A `certificate object` representing the peer's certificate. - */ - function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; - /** - * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is - * automatically set as a listener for the `'secureConnection'` event. - * - * The `ticketKeys` options is automatically shared between `node:cluster` module - * workers. - * - * The following illustrates a simple echo server: - * - * ```js - * const tls = require('node:tls'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * - * // This is necessary only if using client certificate authentication. - * requestCert: true, - * - * // This is necessary only if the client uses a self-signed certificate. - * ca: [ fs.readFileSync('client-cert.pem') ], - * }; - * - * const server = tls.createServer(options, (socket) => { - * console.log('server connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * socket.write('welcome!\n'); - * socket.setEncoding('utf8'); - * socket.pipe(socket); - * }); - * server.listen(8000, () => { - * console.log('server bound'); - * }); - * ``` - * - * The server can be tested by connecting to it using the example client from {@link connect}. - * @since v0.3.2 - */ - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - /** - * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. - * - * `tls.connect()` returns a {@link TLSSocket} object. - * - * Unlike the `https` API, `tls.connect()` does not enable the - * SNI (Server Name Indication) extension by default, which may cause some - * servers to return an incorrect certificate or reject the connection - * altogether. To enable SNI, set the `servername` option in addition - * to `host`. - * - * The following illustrates a client for the echo server example from {@link createServer}: - * - * ```js - * // Assumes an echo server that is listening on port 8000. - * const tls = require('node:tls'); - * const fs = require('node:fs'); - * - * const options = { - * // Necessary only if the server requires client certificate authentication. - * key: fs.readFileSync('client-key.pem'), - * cert: fs.readFileSync('client-cert.pem'), - * - * // Necessary only if the server uses a self-signed certificate. - * ca: [ fs.readFileSync('server-cert.pem') ], - * - * // Necessary only if the server's cert isn't for "localhost". - * checkServerIdentity: () => { return null; }, - * }; - * - * const socket = tls.connect(8000, options, () => { - * console.log('client connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * process.stdin.pipe(socket); - * process.stdin.resume(); - * }); - * socket.setEncoding('utf8'); - * socket.on('data', (data) => { - * console.log(data); - * }); - * socket.on('end', () => { - * console.log('server ends connection'); - * }); - * ``` - * @since v0.11.3 - */ - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect( - port: number, - host?: string, - options?: ConnectionOptions, - secureConnectListener?: () => void, - ): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * Creates a new secure pair object with two streams, one of which reads and writes - * the encrypted data and the other of which reads and writes the cleartext data. - * Generally, the encrypted stream is piped to/from an incoming encrypted data - * stream and the cleartext one is used as a replacement for the initial encrypted - * stream. - * - * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties. - * - * Using `cleartext` has the same API as {@link TLSSocket}. - * - * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: - * - * ```js - * pair = tls.createSecurePair(// ... ); - * pair.encrypted.pipe(socket); - * socket.pipe(pair.encrypted); - * ``` - * - * can be replaced by: - * - * ```js - * secureSocket = tls.TLSSocket(socket, options); - * ``` - * - * where `secureSocket` has the same API as `pair.cleartext`. - * @since v0.3.2 - * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. - * @param context A secure context object as returned by `tls.createSecureContext()` - * @param isServer `true` to specify that this TLS connection should be opened as a server. - * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. - * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. - */ - function createSecurePair( - context?: SecureContext, - isServer?: boolean, - requestCert?: boolean, - rejectUnauthorized?: boolean, - ): SecurePair; - /** - * {@link createServer} sets the default value of the `honorCipherOrder` option - * to `true`, other APIs that create secure contexts leave it unset. - * - * {@link createServer} uses a 128 bit truncated SHA1 hash value generated - * from `process.argv` as the default value of the `sessionIdContext` option, other - * APIs that create secure contexts have no default value. - * - * The `tls.createSecureContext()` method creates a `SecureContext` object. It is - * usable as an argument to several `tls` APIs, such as `server.addContext()`, - * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. - * - * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it. - * - * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of - * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). - * - * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength - * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can - * be used to create custom parameters. The key length must be greater than or - * equal to 1024 bits or else an error will be thrown. Although 1024 bits is - * permissible, use 2048 bits or larger for stronger security. - * @since v0.11.13 - */ - function createSecureContext(options?: SecureContextOptions): SecureContext; - /** - * Returns an array with the names of the supported TLS ciphers. The names are - * lower-case for historical reasons, but must be uppercased to be used in - * the `ciphers` option of {@link createSecureContext}. - * - * Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`. - * - * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for - * TLSv1.2 and below. - * - * ```js - * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] - * ``` - * @since v0.10.2 - */ - function getCiphers(): string[]; - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is 'auto'. See tls.createSecureContext() for further - * information. - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the maxVersion option of - * tls.createSecureContext(). It can be assigned any of the supported TLS - * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: - * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets - * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the highest maximum - * is used. - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the minVersion option of tls.createSecureContext(). - * It can be assigned any of the supported TLS protocol versions, - * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless - * changed using CLI options. Using --tls-min-v1.0 sets the default to - * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using - * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options - * are provided, the lowest minimum is used. - */ - let DEFAULT_MIN_VERSION: SecureVersion; - /** - * The default value of the ciphers option of tls.createSecureContext(). - * It can be assigned any of the supported OpenSSL ciphers. - * Defaults to the content of crypto.constants.defaultCoreCipherList, unless - * changed using CLI options using --tls-default-ciphers. - */ - let DEFAULT_CIPHERS: string; - /** - * An immutable array of strings representing the root certificates (in PEM - * format) used for verifying peer certificates. This is the default value - * of the ca option to tls.createSecureContext(). - */ - const rootCertificates: readonly string[]; -} -declare module "node:tls" { - export * from "tls"; -} diff --git a/reverse_engineering/node_modules/@types/node/trace_events.d.ts b/reverse_engineering/node_modules/@types/node/trace_events.d.ts deleted file mode 100644 index 33613595..00000000 --- a/reverse_engineering/node_modules/@types/node/trace_events.d.ts +++ /dev/null @@ -1,182 +0,0 @@ -/** - * The `node:trace_events` module provides a mechanism to centralize tracing - * information generated by V8, Node.js core, and userspace code. - * - * Tracing can be enabled with the `--trace-event-categories` command-line flag - * or by using the `node:trace_events` module. The `--trace-event-categories` flag - * accepts a list of comma-separated category names. - * - * The available categories are: - * - * * `node`: An empty placeholder. - * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data. - * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. - * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. - * * `node.console`: Enables capture of `console.time()` and `console.count()`output. - * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool - * synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool - * asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.dns.native`: Enables capture of trace data for DNS queries. - * * `node.net.native`: Enables capture of trace data for network. - * * `node.environment`: Enables capture of Node.js Environment milestones. - * * `node.fs.sync`: Enables capture of trace data for file system sync methods. - * * `node.fs_dir.sync`: Enables capture of trace data for file system sync - * directory methods. - * * `node.fs.async`: Enables capture of trace data for file system async methods. - * * `node.fs_dir.async`: Enables capture of trace data for file system async - * directory methods. - * * `node.perf`: Enables capture of `Performance API` measurements. - * * `node.perf.usertiming`: Enables capture of only Performance API User Timing - * measures and marks. - * * `node.perf.timerify`: Enables capture of only Performance API timerify - * measurements. - * * `node.promises.rejections`: Enables capture of trace data tracking the number - * of unhandled Promise rejections and handled-after-rejections. - * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. - * * `v8`: The `V8` events are GC, compiling, and execution related. - * * `node.http`: Enables capture of trace data for http request / response. - * - * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. - * - * ```bash - * node --trace-event-categories v8,node,node.async_hooks server.js - * ``` - * - * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be - * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default. - * - * ```bash - * node --trace-events-enabled - * - * # is equivalent to - * - * node --trace-event-categories v8,node,node.async_hooks - * ``` - * - * Alternatively, trace events may be enabled using the `node:trace_events` module: - * - * ```js - * const trace_events = require('node:trace_events'); - * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); - * tracing.enable(); // Enable trace event capture for the 'node.perf' category - * - * // do work - * - * tracing.disable(); // Disable trace event capture for the 'node.perf' category - * ``` - * - * Running Node.js with tracing enabled will produce log files that can be opened - * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. - * - * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can - * be specified with `--trace-event-file-pattern` that accepts a template - * string that supports `${rotation}` and `${pid}`: - * - * ```bash - * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js - * ``` - * - * To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers - * in your code, such as: - * - * ```js - * process.on('SIGINT', function onSigint() { - * console.info('Received SIGINT.'); - * process.exit(130); // Or applicable exit code depending on OS and signal - * }); - * ``` - * - * The tracing system uses the same time source - * as the one used by `process.hrtime()`. - * However the trace-event timestamps are expressed in microseconds, - * unlike `process.hrtime()` which returns nanoseconds. - * - * The features from this module are not available in `Worker` threads. - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js) - */ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - */ - readonly categories: string; - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - */ - disable(): void; - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - */ - enable(): void; - /** - * `true` only if the `Tracing` object has been enabled. - */ - readonly enabled: boolean; - } - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - /** - * Creates and returns a `Tracing` object for the given set of `categories`. - * - * ```js - * const trace_events = require('node:trace_events'); - * const categories = ['node.perf', 'node.async_hooks']; - * const tracing = trace_events.createTracing({ categories }); - * tracing.enable(); - * // do stuff - * tracing.disable(); - * ``` - * @since v10.0.0 - * @return . - */ - function createTracing(options: CreateTracingOptions): Tracing; - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is determined - * by the _union_ of all currently-enabled `Tracing` objects and any categories - * enabled using the `--trace-event-categories` flag. - * - * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console. - * - * ```js - * const trace_events = require('node:trace_events'); - * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); - * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); - * const t3 = trace_events.createTracing({ categories: ['v8'] }); - * - * t1.enable(); - * t2.enable(); - * - * console.log(trace_events.getEnabledCategories()); - * ``` - * @since v10.0.0 - */ - function getEnabledCategories(): string | undefined; -} -declare module "node:trace_events" { - export * from "trace_events"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/assert.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/assert.d.ts deleted file mode 100644 index cd821433..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/assert.d.ts +++ /dev/null @@ -1,996 +0,0 @@ -/** - * The `node:assert` module provides a set of assertion functions for verifying - * invariants. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/assert.js) - */ -declare module "assert" { - /** - * An alias of {@link ok}. - * @since v0.5.9 - * @param value The input that is checked for being truthy. - */ - function assert(value: unknown, message?: string | Error): asserts value; - namespace assert { - /** - * Indicates the failure of an assertion. All errors thrown by the `node:assert`module will be instances of the `AssertionError` class. - */ - class AssertionError extends Error { - /** - * Set to the `actual` argument for methods such as {@link assert.strictEqual()}. - */ - actual: unknown; - /** - * Set to the `expected` argument for methods such as {@link assert.strictEqual()}. - */ - expected: unknown; - /** - * Set to the passed in operator value. - */ - operator: string; - /** - * Indicates if the message was auto-generated (`true`) or not. - */ - generatedMessage: boolean; - /** - * Value is always `ERR_ASSERTION` to show that the error is an assertion error. - */ - code: "ERR_ASSERTION"; - constructor(options?: { - /** If provided, the error message is set to this value. */ - message?: string | undefined; - /** The `actual` property on the error instance. */ - actual?: unknown | undefined; - /** The `expected` property on the error instance. */ - expected?: unknown | undefined; - /** The `operator` property on the error instance. */ - operator?: string | undefined; - /** If provided, the generated stack trace omits frames before this function. */ - // eslint-disable-next-line @typescript-eslint/ban-types - stackStartFn?: Function | undefined; - }); - } - /** - * This feature is deprecated and will be removed in a future version. - * Please consider using alternatives such as the `mock` helper function. - * @since v14.2.0, v12.19.0 - * @deprecated Deprecated - */ - class CallTracker { - /** - * The wrapper function is expected to be called exactly `exact` times. If the - * function has not been called exactly `exact` times when `tracker.verify()` is called, then `tracker.verify()` will throw an - * error. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func); - * ``` - * @since v14.2.0, v12.19.0 - * @param [fn='A no-op function'] - * @param [exact=1] - * @return that wraps `fn`. - */ - calls(exact?: number): () => void; - calls any>(fn?: Func, exact?: number): Func; - /** - * Example: - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * callsfunc(1, 2, 3); - * - * assert.deepStrictEqual(tracker.getCalls(callsfunc), - * [{ thisArg: undefined, arguments: [1, 2, 3] }]); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn - * @return An Array with all the calls to a tracked function. - */ - getCalls(fn: Function): CallTrackerCall[]; - /** - * The arrays contains information about the expected and actual number of calls of - * the functions that have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * // Returns an array containing information on callsfunc() - * console.log(tracker.report()); - * // [ - * // { - * // message: 'Expected the func function to be executed 2 time(s) but was - * // executed 0 time(s).', - * // actual: 0, - * // expected: 2, - * // operator: 'func', - * // stack: stack trace - * // } - * // ] - * ``` - * @since v14.2.0, v12.19.0 - * @return An Array of objects containing information about the wrapper functions returned by `calls`. - */ - report(): CallTrackerReportInformation[]; - /** - * Reset calls of the call tracker. - * If a tracked function is passed as an argument, the calls will be reset for it. - * If no arguments are passed, all tracked functions will be reset. - * - * ```js - * import assert from 'node:assert'; - * - * const tracker = new assert.CallTracker(); - * - * function func() {} - * const callsfunc = tracker.calls(func); - * - * callsfunc(); - * // Tracker was called once - * assert.strictEqual(tracker.getCalls(callsfunc).length, 1); - * - * tracker.reset(callsfunc); - * assert.strictEqual(tracker.getCalls(callsfunc).length, 0); - * ``` - * @since v18.8.0, v16.18.0 - * @param fn a tracked function to reset. - */ - reset(fn?: Function): void; - /** - * Iterates through the list of functions passed to `tracker.calls()` and will throw an error for functions that - * have not been called the expected number of times. - * - * ```js - * import assert from 'node:assert'; - * - * // Creates call tracker. - * const tracker = new assert.CallTracker(); - * - * function func() {} - * - * // Returns a function that wraps func() that must be called exact times - * // before tracker.verify(). - * const callsfunc = tracker.calls(func, 2); - * - * callsfunc(); - * - * // Will throw an error since callsfunc() was only called once. - * tracker.verify(); - * ``` - * @since v14.2.0, v12.19.0 - */ - verify(): void; - } - interface CallTrackerCall { - thisArg: object; - arguments: unknown[]; - } - interface CallTrackerReportInformation { - message: string; - /** The actual number of times the function was called. */ - actual: number; - /** The number of times the function was expected to be called. */ - expected: number; - /** The name of the function that is wrapped. */ - operator: string; - /** A stack trace of the function. */ - stack: object; - } - type AssertPredicate = RegExp | (new() => object) | ((thrown: unknown) => boolean) | object | Error; - /** - * Throws an `AssertionError` with the provided error message or a default - * error message. If the `message` parameter is an instance of an `Error` then - * it will be thrown instead of the `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.fail(); - * // AssertionError [ERR_ASSERTION]: Failed - * - * assert.fail('boom'); - * // AssertionError [ERR_ASSERTION]: boom - * - * assert.fail(new TypeError('need array')); - * // TypeError: need array - * ``` - * - * Using `assert.fail()` with more than two arguments is possible but deprecated. - * See below for further details. - * @since v0.1.21 - * @param [message='Failed'] - */ - function fail(message?: string | Error): never; - /** @deprecated since v10.0.0 - use fail([message]) or other assert functions instead. */ - function fail( - actual: unknown, - expected: unknown, - message?: string | Error, - operator?: string, - // eslint-disable-next-line @typescript-eslint/ban-types - stackStartFn?: Function, - ): never; - /** - * Tests if `value` is truthy. It is equivalent to`assert.equal(!!value, true, message)`. - * - * If `value` is not truthy, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is `undefined`, a default - * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * If no arguments are passed in at all `message` will be set to the string:`` 'No value argument passed to `assert.ok()`' ``. - * - * Be aware that in the `repl` the error message will be different to the one - * thrown in a file! See below for further details. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ok(true); - * // OK - * assert.ok(1); - * // OK - * - * assert.ok(); - * // AssertionError: No value argument passed to `assert.ok()` - * - * assert.ok(false, 'it\'s false'); - * // AssertionError: it's false - * - * // In the repl: - * assert.ok(typeof 123 === 'string'); - * // AssertionError: false == true - * - * // In a file (e.g. test.js): - * assert.ok(typeof 123 === 'string'); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(typeof 123 === 'string') - * - * assert.ok(false); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(false) - * - * assert.ok(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert.ok(0) - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * // Using `assert()` works the same: - * assert(0); - * // AssertionError: The expression evaluated to a falsy value: - * // - * // assert(0) - * ``` - * @since v0.1.21 - */ - function ok(value: unknown, message?: string | Error): asserts value; - /** - * **Strict assertion mode** - * - * An alias of {@link strictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link strictEqual} instead. - * - * Tests shallow, coercive equality between the `actual` and `expected` parameters - * using the [`==` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Equality). `NaN` is specially handled - * and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.equal(1, 1); - * // OK, 1 == 1 - * assert.equal(1, '1'); - * // OK, 1 == '1' - * assert.equal(NaN, NaN); - * // OK - * - * assert.equal(1, 2); - * // AssertionError: 1 == 2 - * assert.equal({ a: { b: 1 } }, { a: { b: 1 } }); - * // AssertionError: { a: { b: 1 } } == { a: { b: 1 } } - * ``` - * - * If the values are not equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default - * error message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * @since v0.1.21 - */ - function equal(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notStrictEqual} instead. - * - * Tests shallow, coercive inequality with the [`!=` operator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Inequality). `NaN` is - * specially handled and treated as being identical if both sides are `NaN`. - * - * ```js - * import assert from 'node:assert'; - * - * assert.notEqual(1, 2); - * // OK - * - * assert.notEqual(1, 1); - * // AssertionError: 1 != 1 - * - * assert.notEqual(1, '1'); - * // AssertionError: 1 != '1' - * ``` - * - * If the values are equal, an `AssertionError` is thrown with a `message`property set equal to the value of the `message` parameter. If the `message`parameter is undefined, a default error - * message is assigned. If the `message`parameter is an instance of an `Error` then it will be thrown instead of the`AssertionError`. - * @since v0.1.21 - */ - function notEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link deepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link deepStrictEqual} instead. - * - * Tests for deep equality between the `actual` and `expected` parameters. Consider - * using {@link deepStrictEqual} instead. {@link deepEqual} can have - * surprising results. - * - * _Deep equality_ means that the enumerable "own" properties of child objects - * are also recursively evaluated by the following rules. - * @since v0.1.21 - */ - function deepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * **Strict assertion mode** - * - * An alias of {@link notDeepStrictEqual}. - * - * **Legacy assertion mode** - * - * > Stability: 3 - Legacy: Use {@link notDeepStrictEqual} instead. - * - * Tests for any deep inequality. Opposite of {@link deepEqual}. - * - * ```js - * import assert from 'node:assert'; - * - * const obj1 = { - * a: { - * b: 1, - * }, - * }; - * const obj2 = { - * a: { - * b: 2, - * }, - * }; - * const obj3 = { - * a: { - * b: 1, - * }, - * }; - * const obj4 = { __proto__: obj1 }; - * - * assert.notDeepEqual(obj1, obj1); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj2); - * // OK - * - * assert.notDeepEqual(obj1, obj3); - * // AssertionError: { a: { b: 1 } } notDeepEqual { a: { b: 1 } } - * - * assert.notDeepEqual(obj1, obj4); - * // OK - * ``` - * - * If the values are deeply equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a default - * error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notDeepEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests strict equality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.strictEqual(1, 2); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // - * // 1 !== 2 - * - * assert.strictEqual(1, 1); - * // OK - * - * assert.strictEqual('Hello foobar', 'Hello World!'); - * // AssertionError [ERR_ASSERTION]: Expected inputs to be strictly equal: - * // + actual - expected - * // - * // + 'Hello foobar' - * // - 'Hello World!' - * // ^ - * - * const apples = 1; - * const oranges = 2; - * assert.strictEqual(apples, oranges, `apples ${apples} !== oranges ${oranges}`); - * // AssertionError [ERR_ASSERTION]: apples 1 !== oranges 2 - * - * assert.strictEqual(1, '1', new TypeError('Inputs are not identical')); - * // TypeError: Inputs are not identical - * ``` - * - * If the values are not strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a - * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function strictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests strict inequality between the `actual` and `expected` parameters as - * determined by [`Object.is()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is). - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notStrictEqual(1, 2); - * // OK - * - * assert.notStrictEqual(1, 1); - * // AssertionError [ERR_ASSERTION]: Expected "actual" to be strictly unequal to: - * // - * // 1 - * - * assert.notStrictEqual(1, '1'); - * // OK - * ``` - * - * If the values are strictly equal, an `AssertionError` is thrown with a`message` property set equal to the value of the `message` parameter. If the`message` parameter is undefined, a - * default error message is assigned. If the`message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v0.1.21 - */ - function notStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Tests for deep equality between the `actual` and `expected` parameters. - * "Deep" equality means that the enumerable "own" properties of child objects - * are recursively evaluated also by the following rules. - * @since v1.2.0 - */ - function deepStrictEqual(actual: unknown, expected: T, message?: string | Error): asserts actual is T; - /** - * Tests for deep strict inequality. Opposite of {@link deepStrictEqual}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.notDeepStrictEqual({ a: 1 }, { a: '1' }); - * // OK - * ``` - * - * If the values are deeply and strictly equal, an `AssertionError` is thrown - * with a `message` property set equal to the value of the `message` parameter. If - * the `message` parameter is undefined, a default error message is assigned. If - * the `message` parameter is an instance of an `Error` then it will be thrown - * instead of the `AssertionError`. - * @since v1.2.0 - */ - function notDeepStrictEqual(actual: unknown, expected: unknown, message?: string | Error): void; - /** - * Expects the function `fn` to throw an error. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * a validation object where each property will be tested for strict deep equality, - * or an instance of error where each property will be tested for strict deep - * equality including the non-enumerable `message` and `name` properties. When - * using an object, it is also possible to use a regular expression, when - * validating against a string property. See below for examples. - * - * If specified, `message` will be appended to the message provided by the`AssertionError` if the `fn` call fails to throw or in case the error validation - * fails. - * - * Custom validation object/error instance: - * - * ```js - * import assert from 'node:assert/strict'; - * - * const err = new TypeError('Wrong value'); - * err.code = 404; - * err.foo = 'bar'; - * err.info = { - * nested: true, - * baz: 'text', - * }; - * err.reg = /abc/i; - * - * assert.throws( - * () => { - * throw err; - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * info: { - * nested: true, - * baz: 'text', - * }, - * // Only properties on the validation object will be tested for. - * // Using nested objects requires all properties to be present. Otherwise - * // the validation is going to fail. - * }, - * ); - * - * // Using regular expressions to validate error properties: - * assert.throws( - * () => { - * throw err; - * }, - * { - * // The `name` and `message` properties are strings and using regular - * // expressions on those will match against the string. If they fail, an - * // error is thrown. - * name: /^TypeError$/, - * message: /Wrong/, - * foo: 'bar', - * info: { - * nested: true, - * // It is not possible to use regular expressions for nested properties! - * baz: 'text', - * }, - * // The `reg` property contains a regular expression and only if the - * // validation object contains an identical regular expression, it is going - * // to pass. - * reg: /abc/i, - * }, - * ); - * - * // Fails due to the different `message` and `name` properties: - * assert.throws( - * () => { - * const otherErr = new Error('Not found'); - * // Copy all enumerable properties from `err` to `otherErr`. - * for (const [key, value] of Object.entries(err)) { - * otherErr[key] = value; - * } - * throw otherErr; - * }, - * // The error's `message` and `name` properties will also be checked when using - * // an error as validation object. - * err, - * ); - * ``` - * - * Validate instanceof using constructor: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * Error, - * ); - * ``` - * - * Validate error message using [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions): - * - * Using a regular expression runs `.toString` on the error object, and will - * therefore also include the error name. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * /^Error: Wrong value$/, - * ); - * ``` - * - * Custom error validation: - * - * The function must return `true` to indicate all internal validations passed. - * It will otherwise fail with an `AssertionError`. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.throws( - * () => { - * throw new Error('Wrong value'); - * }, - * (err) => { - * assert(err instanceof Error); - * assert(/value/.test(err)); - * // Avoid returning anything from validation functions besides `true`. - * // Otherwise, it's not clear what part of the validation failed. Instead, - * // throw an error about the specific validation that failed (as done in this - * // example) and add as much helpful debugging information to that error as - * // possible. - * return true; - * }, - * 'unexpected error', - * ); - * ``` - * - * `error` cannot be a string. If a string is provided as the second - * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Using the same - * message as the thrown error message is going to result in an`ERR_AMBIGUOUS_ARGUMENT` error. Please read the example below carefully if using - * a string as the second argument gets considered: - * - * ```js - * import assert from 'node:assert/strict'; - * - * function throwingFirst() { - * throw new Error('First'); - * } - * - * function throwingSecond() { - * throw new Error('Second'); - * } - * - * function notThrowing() {} - * - * // The second argument is a string and the input function threw an Error. - * // The first case will not throw as it does not match for the error message - * // thrown by the input function! - * assert.throws(throwingFirst, 'Second'); - * // In the next example the message has no benefit over the message from the - * // error and since it is not clear if the user intended to actually match - * // against the error message, Node.js throws an `ERR_AMBIGUOUS_ARGUMENT` error. - * assert.throws(throwingSecond, 'Second'); - * // TypeError [ERR_AMBIGUOUS_ARGUMENT] - * - * // The string is only used (as message) in case the function does not throw: - * assert.throws(notThrowing, 'Second'); - * // AssertionError [ERR_ASSERTION]: Missing expected exception: Second - * - * // If it was intended to match for the error message do this instead: - * // It does not throw because the error messages match. - * assert.throws(throwingSecond, /Second$/); - * - * // If the error message does not match, an AssertionError is thrown. - * assert.throws(throwingFirst, /Second$/); - * // AssertionError [ERR_ASSERTION] - * ``` - * - * Due to the confusing error-prone notation, avoid a string as the second - * argument. - * @since v0.1.21 - */ - function throws(block: () => unknown, message?: string | Error): void; - function throws(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Asserts that the function `fn` does not throw an error. - * - * Using `assert.doesNotThrow()` is actually not useful because there - * is no benefit in catching an error and then rethrowing it. Instead, consider - * adding a comment next to the specific code path that should not throw and keep - * error messages as expressive as possible. - * - * When `assert.doesNotThrow()` is called, it will immediately call the `fn`function. - * - * If an error is thrown and it is the same type as that specified by the `error`parameter, then an `AssertionError` is thrown. If the error is of a - * different type, or if the `error` parameter is undefined, the error is - * propagated back to the caller. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * The following, for instance, will throw the `TypeError` because there is no - * matching error type in the assertion: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * However, the following will result in an `AssertionError` with the message - * 'Got unwanted exception...': - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * TypeError, - * ); - * ``` - * - * If an `AssertionError` is thrown and a value is provided for the `message`parameter, the value of `message` will be appended to the `AssertionError` message: - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotThrow( - * () => { - * throw new TypeError('Wrong value'); - * }, - * /Wrong value/, - * 'Whoops', - * ); - * // Throws: AssertionError: Got unwanted exception: Whoops - * ``` - * @since v0.1.21 - */ - function doesNotThrow(block: () => unknown, message?: string | Error): void; - function doesNotThrow(block: () => unknown, error: AssertPredicate, message?: string | Error): void; - /** - * Throws `value` if `value` is not `undefined` or `null`. This is useful when - * testing the `error` argument in callbacks. The stack trace contains all frames - * from the error passed to `ifError()` including the potential new frames for`ifError()` itself. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.ifError(null); - * // OK - * assert.ifError(0); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 0 - * assert.ifError('error'); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: 'error' - * assert.ifError(new Error()); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: Error - * - * // Create some random error frames. - * let err; - * (function errorFrame() { - * err = new Error('test error'); - * })(); - * - * (function ifErrorFrame() { - * assert.ifError(err); - * })(); - * // AssertionError [ERR_ASSERTION]: ifError got unwanted exception: test error - * // at ifErrorFrame - * // at errorFrame - * ``` - * @since v0.1.97 - */ - function ifError(value: unknown): asserts value is null | undefined; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is rejected. - * - * If `asyncFn` is a function and it throws an error synchronously,`assert.rejects()` will return a rejected `Promise` with that error. If the - * function does not return a promise, `assert.rejects()` will return a rejected`Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases the error - * handler is skipped. - * - * Besides the async nature to await the completion behaves identically to {@link throws}. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), a validation function, - * an object where each property will be tested for, or an instance of error where - * each property will be tested for including the non-enumerable `message` and`name` properties. - * - * If specified, `message` will be the message provided by the `AssertionError` if the `asyncFn` fails to reject. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * { - * name: 'TypeError', - * message: 'Wrong value', - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.rejects( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * (err) => { - * assert.strictEqual(err.name, 'TypeError'); - * assert.strictEqual(err.message, 'Wrong value'); - * return true; - * }, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.rejects( - * Promise.reject(new Error('Wrong value')), - * Error, - * ).then(() => { - * // ... - * }); - * ``` - * - * `error` cannot be a string. If a string is provided as the second - * argument, then `error` is assumed to be omitted and the string will be used for`message` instead. This can lead to easy-to-miss mistakes. Please read the - * example in {@link throws} carefully if using a string as the second - * argument gets considered. - * @since v10.0.0 - */ - function rejects(block: (() => Promise) | Promise, message?: string | Error): Promise; - function rejects( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Awaits the `asyncFn` promise or, if `asyncFn` is a function, immediately - * calls the function and awaits the returned promise to complete. It will then - * check that the promise is not rejected. - * - * If `asyncFn` is a function and it throws an error synchronously,`assert.doesNotReject()` will return a rejected `Promise` with that error. If - * the function does not return a promise, `assert.doesNotReject()` will return a - * rejected `Promise` with an `ERR_INVALID_RETURN_VALUE` error. In both cases - * the error handler is skipped. - * - * Using `assert.doesNotReject()` is actually not useful because there is little - * benefit in catching a rejection and then rejecting it again. Instead, consider - * adding a comment next to the specific code path that should not reject and keep - * error messages as expressive as possible. - * - * If specified, `error` can be a [`Class`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes), - * [`RegExp`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), or a validation - * function. See {@link throws} for more details. - * - * Besides the async nature to await the completion behaves identically to {@link doesNotThrow}. - * - * ```js - * import assert from 'node:assert/strict'; - * - * await assert.doesNotReject( - * async () => { - * throw new TypeError('Wrong value'); - * }, - * SyntaxError, - * ); - * ``` - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotReject(Promise.reject(new TypeError('Wrong value'))) - * .then(() => { - * // ... - * }); - * ``` - * @since v10.0.0 - */ - function doesNotReject( - block: (() => Promise) | Promise, - message?: string | Error, - ): Promise; - function doesNotReject( - block: (() => Promise) | Promise, - error: AssertPredicate, - message?: string | Error, - ): Promise; - /** - * Expects the `string` input to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.match('I will fail', /pass/); - * // AssertionError [ERR_ASSERTION]: The input did not match the regular ... - * - * assert.match(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.match('I will pass', /pass/); - * // OK - * ``` - * - * If the values do not match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v13.6.0, v12.16.0 - */ - function match(value: string, regExp: RegExp, message?: string | Error): void; - /** - * Expects the `string` input not to match the regular expression. - * - * ```js - * import assert from 'node:assert/strict'; - * - * assert.doesNotMatch('I will fail', /fail/); - * // AssertionError [ERR_ASSERTION]: The input was expected to not match the ... - * - * assert.doesNotMatch(123, /pass/); - * // AssertionError [ERR_ASSERTION]: The "string" argument must be of type string. - * - * assert.doesNotMatch('I will pass', /different/); - * // OK - * ``` - * - * If the values do match, or if the `string` argument is of another type than`string`, an `AssertionError` is thrown with a `message` property set equal - * to the value of the `message` parameter. If the `message` parameter is - * undefined, a default error message is assigned. If the `message` parameter is an - * instance of an `Error` then it will be thrown instead of the `AssertionError`. - * @since v13.6.0, v12.16.0 - */ - function doesNotMatch(value: string, regExp: RegExp, message?: string | Error): void; - const strict: - & Omit< - typeof assert, - | "equal" - | "notEqual" - | "deepEqual" - | "notDeepEqual" - | "ok" - | "strictEqual" - | "deepStrictEqual" - | "ifError" - | "strict" - > - & { - (value: unknown, message?: string | Error): asserts value; - equal: typeof strictEqual; - notEqual: typeof notStrictEqual; - deepEqual: typeof deepStrictEqual; - notDeepEqual: typeof notDeepStrictEqual; - // Mapped types and assertion functions are incompatible? - // TS2775: Assertions require every name in the call target - // to be declared with an explicit type annotation. - ok: typeof ok; - strictEqual: typeof strictEqual; - deepStrictEqual: typeof deepStrictEqual; - ifError: typeof ifError; - strict: typeof strict; - }; - } - export = assert; -} -declare module "node:assert" { - import assert = require("assert"); - export = assert; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/assert/strict.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/assert/strict.d.ts deleted file mode 100644 index f333913a..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/assert/strict.d.ts +++ /dev/null @@ -1,8 +0,0 @@ -declare module "assert/strict" { - import { strict } from "node:assert"; - export = strict; -} -declare module "node:assert/strict" { - import { strict } from "node:assert"; - export = strict; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/async_hooks.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/async_hooks.d.ts deleted file mode 100644 index 0667a615..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/async_hooks.d.ts +++ /dev/null @@ -1,539 +0,0 @@ -/** - * We strongly discourage the use of the `async_hooks` API. - * Other APIs that can cover most of its use cases include: - * - * * `AsyncLocalStorage` tracks async context - * * `process.getActiveResourcesInfo()` tracks active resources - * - * The `node:async_hooks` module provides an API to track asynchronous resources. - * It can be accessed using: - * - * ```js - * import async_hooks from 'node:async_hooks'; - * ``` - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/async_hooks.js) - */ -declare module "async_hooks" { - /** - * ```js - * import { executionAsyncId } from 'node:async_hooks'; - * import fs from 'node:fs'; - * - * console.log(executionAsyncId()); // 1 - bootstrap - * const path = '.'; - * fs.open(path, 'r', (err, fd) => { - * console.log(executionAsyncId()); // 6 - open() - * }); - * ``` - * - * The ID returned from `executionAsyncId()` is related to execution timing, not - * causality (which is covered by `triggerAsyncId()`): - * - * ```js - * const server = net.createServer((conn) => { - * // Returns the ID of the server, not of the new connection, because the - * // callback runs in the execution scope of the server's MakeCallback(). - * async_hooks.executionAsyncId(); - * - * }).listen(port, () => { - * // Returns the ID of a TickObject (process.nextTick()) because all - * // callbacks passed to .listen() are wrapped in a nextTick(). - * async_hooks.executionAsyncId(); - * }); - * ``` - * - * Promise contexts may not get precise `executionAsyncIds` by default. - * See the section on `promise execution tracking`. - * @since v8.1.0 - * @return The `asyncId` of the current execution context. Useful to track when something calls. - */ - function executionAsyncId(): number; - /** - * Resource objects returned by `executionAsyncResource()` are most often internal - * Node.js handle objects with undocumented APIs. Using any functions or properties - * on the object is likely to crash your application and should be avoided. - * - * Using `executionAsyncResource()` in the top-level execution context will - * return an empty object as there is no handle or request object to use, - * but having an object representing the top-level can be helpful. - * - * ```js - * import { open } from 'node:fs'; - * import { executionAsyncId, executionAsyncResource } from 'node:async_hooks'; - * - * console.log(executionAsyncId(), executionAsyncResource()); // 1 {} - * open(new URL(import.meta.url), 'r', (err, fd) => { - * console.log(executionAsyncId(), executionAsyncResource()); // 7 FSReqWrap - * }); - * ``` - * - * This can be used to implement continuation local storage without the - * use of a tracking `Map` to store the metadata: - * - * ```js - * import { createServer } from 'node:http'; - * import { - * executionAsyncId, - * executionAsyncResource, - * createHook, - * } from 'async_hooks'; - * const sym = Symbol('state'); // Private symbol to avoid pollution - * - * createHook({ - * init(asyncId, type, triggerAsyncId, resource) { - * const cr = executionAsyncResource(); - * if (cr) { - * resource[sym] = cr[sym]; - * } - * }, - * }).enable(); - * - * const server = createServer((req, res) => { - * executionAsyncResource()[sym] = { state: req.url }; - * setTimeout(function() { - * res.end(JSON.stringify(executionAsyncResource()[sym])); - * }, 100); - * }).listen(3000); - * ``` - * @since v13.9.0, v12.17.0 - * @return The resource representing the current execution. Useful to store data within the resource. - */ - function executionAsyncResource(): object; - /** - * ```js - * const server = net.createServer((conn) => { - * // The resource that caused (or triggered) this callback to be called - * // was that of the new connection. Thus the return value of triggerAsyncId() - * // is the asyncId of "conn". - * async_hooks.triggerAsyncId(); - * - * }).listen(port, () => { - * // Even though all callbacks passed to .listen() are wrapped in a nextTick() - * // the callback itself exists because the call to the server's .listen() - * // was made. So the return value would be the ID of the server. - * async_hooks.triggerAsyncId(); - * }); - * ``` - * - * Promise contexts may not get valid `triggerAsyncId`s by default. See - * the section on `promise execution tracking`. - * @return The ID of the resource responsible for calling the callback that is currently being executed. - */ - function triggerAsyncId(): number; - interface HookCallbacks { - /** - * Called when a class is constructed that has the possibility to emit an asynchronous event. - * @param asyncId a unique ID for the async resource - * @param type the type of the async resource - * @param triggerAsyncId the unique ID of the async resource in whose execution context this async resource was created - * @param resource reference to the resource representing the async operation, needs to be released during destroy - */ - init?(asyncId: number, type: string, triggerAsyncId: number, resource: object): void; - /** - * When an asynchronous operation is initiated or completes a callback is called to notify the user. - * The before callback is called just before said callback is executed. - * @param asyncId the unique identifier assigned to the resource about to execute the callback. - */ - before?(asyncId: number): void; - /** - * Called immediately after the callback specified in before is completed. - * @param asyncId the unique identifier assigned to the resource which has executed the callback. - */ - after?(asyncId: number): void; - /** - * Called when a promise has resolve() called. This may not be in the same execution id - * as the promise itself. - * @param asyncId the unique id for the promise that was resolve()d. - */ - promiseResolve?(asyncId: number): void; - /** - * Called after the resource corresponding to asyncId is destroyed - * @param asyncId a unique ID for the async resource - */ - destroy?(asyncId: number): void; - } - interface AsyncHook { - /** - * Enable the callbacks for a given AsyncHook instance. If no callbacks are provided enabling is a noop. - */ - enable(): this; - /** - * Disable the callbacks for a given AsyncHook instance from the global pool of AsyncHook callbacks to be executed. Once a hook has been disabled it will not be called again until enabled. - */ - disable(): this; - } - /** - * Registers functions to be called for different lifetime events of each async - * operation. - * - * The callbacks `init()`/`before()`/`after()`/`destroy()` are called for the - * respective asynchronous event during a resource's lifetime. - * - * All callbacks are optional. For example, if only resource cleanup needs to - * be tracked, then only the `destroy` callback needs to be passed. The - * specifics of all functions that can be passed to `callbacks` is in the `Hook Callbacks` section. - * - * ```js - * import { createHook } from 'node:async_hooks'; - * - * const asyncHook = createHook({ - * init(asyncId, type, triggerAsyncId, resource) { }, - * destroy(asyncId) { }, - * }); - * ``` - * - * The callbacks will be inherited via the prototype chain: - * - * ```js - * class MyAsyncCallbacks { - * init(asyncId, type, triggerAsyncId, resource) { } - * destroy(asyncId) {} - * } - * - * class MyAddedCallbacks extends MyAsyncCallbacks { - * before(asyncId) { } - * after(asyncId) { } - * } - * - * const asyncHook = async_hooks.createHook(new MyAddedCallbacks()); - * ``` - * - * Because promises are asynchronous resources whose lifecycle is tracked - * via the async hooks mechanism, the `init()`, `before()`, `after()`, and`destroy()` callbacks _must not_ be async functions that return promises. - * @since v8.1.0 - * @param callbacks The `Hook Callbacks` to register - * @return Instance used for disabling and enabling hooks - */ - function createHook(callbacks: HookCallbacks): AsyncHook; - interface AsyncResourceOptions { - /** - * The ID of the execution context that created this async event. - * @default executionAsyncId() - */ - triggerAsyncId?: number | undefined; - /** - * Disables automatic `emitDestroy` when the object is garbage collected. - * This usually does not need to be set (even if `emitDestroy` is called - * manually), unless the resource's `asyncId` is retrieved and the - * sensitive API's `emitDestroy` is called with it. - * @default false - */ - requireManualDestroy?: boolean | undefined; - } - /** - * The class `AsyncResource` is designed to be extended by the embedder's async - * resources. Using this, users can easily trigger the lifetime events of their - * own resources. - * - * The `init` hook will trigger when an `AsyncResource` is instantiated. - * - * The following is an overview of the `AsyncResource` API. - * - * ```js - * import { AsyncResource, executionAsyncId } from 'node:async_hooks'; - * - * // AsyncResource() is meant to be extended. Instantiating a - * // new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * // async_hook.executionAsyncId() is used. - * const asyncResource = new AsyncResource( - * type, { triggerAsyncId: executionAsyncId(), requireManualDestroy: false }, - * ); - * - * // Run a function in the execution context of the resource. This will - * // * establish the context of the resource - * // * trigger the AsyncHooks before callbacks - * // * call the provided function `fn` with the supplied arguments - * // * trigger the AsyncHooks after callbacks - * // * restore the original execution context - * asyncResource.runInAsyncScope(fn, thisArg, ...args); - * - * // Call AsyncHooks destroy callbacks. - * asyncResource.emitDestroy(); - * - * // Return the unique ID assigned to the AsyncResource instance. - * asyncResource.asyncId(); - * - * // Return the trigger ID for the AsyncResource instance. - * asyncResource.triggerAsyncId(); - * ``` - */ - class AsyncResource { - /** - * AsyncResource() is meant to be extended. Instantiating a - * new AsyncResource() also triggers init. If triggerAsyncId is omitted then - * async_hook.executionAsyncId() is used. - * @param type The type of async event. - * @param triggerAsyncId The ID of the execution context that created - * this async event (default: `executionAsyncId()`), or an - * AsyncResourceOptions object (since v9.3.0) - */ - constructor(type: string, triggerAsyncId?: number | AsyncResourceOptions); - /** - * Binds the given function to the current execution context. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current execution context. - * @param type An optional name to associate with the underlying `AsyncResource`. - */ - static bind any, ThisArg>( - fn: Func, - type?: string, - thisArg?: ThisArg, - ): Func; - /** - * Binds the given function to execute to this `AsyncResource`'s scope. - * @since v14.8.0, v12.19.0 - * @param fn The function to bind to the current `AsyncResource`. - */ - bind any>(fn: Func): Func; - /** - * Call the provided function with the provided arguments in the execution context - * of the async resource. This will establish the context, trigger the AsyncHooks - * before callbacks, call the function, trigger the AsyncHooks after callbacks, and - * then restore the original execution context. - * @since v9.6.0 - * @param fn The function to call in the execution context of this async resource. - * @param thisArg The receiver to be used for the function call. - * @param args Optional arguments to pass to the function. - */ - runInAsyncScope( - fn: (this: This, ...args: any[]) => Result, - thisArg?: This, - ...args: any[] - ): Result; - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - * @return A reference to `asyncResource`. - */ - emitDestroy(): this; - /** - * @return The unique `asyncId` assigned to the resource. - */ - asyncId(): number; - /** - * @return The same `triggerAsyncId` that is passed to the `AsyncResource` constructor. - */ - triggerAsyncId(): number; - } - /** - * This class creates stores that stay coherent through asynchronous operations. - * - * While you can create your own implementation on top of the `node:async_hooks`module, `AsyncLocalStorage` should be preferred as it is a performant and memory - * safe implementation that involves significant optimizations that are non-obvious - * to implement. - * - * The following example uses `AsyncLocalStorage` to build a simple logger - * that assigns IDs to incoming HTTP requests and includes them in messages - * logged within each request. - * - * ```js - * import http from 'node:http'; - * import { AsyncLocalStorage } from 'node:async_hooks'; - * - * const asyncLocalStorage = new AsyncLocalStorage(); - * - * function logWithId(msg) { - * const id = asyncLocalStorage.getStore(); - * console.log(`${id !== undefined ? id : '-'}:`, msg); - * } - * - * let idSeq = 0; - * http.createServer((req, res) => { - * asyncLocalStorage.run(idSeq++, () => { - * logWithId('start'); - * // Imagine any chain of async operations here - * setImmediate(() => { - * logWithId('finish'); - * res.end(); - * }); - * }); - * }).listen(8080); - * - * http.get('http://localhost:8080'); - * http.get('http://localhost:8080'); - * // Prints: - * // 0: start - * // 1: start - * // 0: finish - * // 1: finish - * ``` - * - * Each instance of `AsyncLocalStorage` maintains an independent storage context. - * Multiple instances can safely exist simultaneously without risk of interfering - * with each other's data. - * @since v13.10.0, v12.17.0 - */ - class AsyncLocalStorage { - /** - * Binds the given function to the current execution context. - * @since v19.8.0 - * @experimental - * @param fn The function to bind to the current execution context. - * @return A new function that calls `fn` within the captured execution context. - */ - static bind any>(fn: Func): Func; - /** - * Captures the current execution context and returns a function that accepts a - * function as an argument. Whenever the returned function is called, it - * calls the function passed to it within the captured context. - * - * ```js - * const asyncLocalStorage = new AsyncLocalStorage(); - * const runInAsyncScope = asyncLocalStorage.run(123, () => AsyncLocalStorage.snapshot()); - * const result = asyncLocalStorage.run(321, () => runInAsyncScope(() => asyncLocalStorage.getStore())); - * console.log(result); // returns 123 - * ``` - * - * AsyncLocalStorage.snapshot() can replace the use of AsyncResource for simple - * async context tracking purposes, for example: - * - * ```js - * class Foo { - * #runInAsyncScope = AsyncLocalStorage.snapshot(); - * - * get() { return this.#runInAsyncScope(() => asyncLocalStorage.getStore()); } - * } - * - * const foo = asyncLocalStorage.run(123, () => new Foo()); - * console.log(asyncLocalStorage.run(321, () => foo.get())); // returns 123 - * ``` - * @since v19.8.0 - * @experimental - * @return A new function with the signature `(fn: (...args) : R, ...args) : R`. - */ - static snapshot(): (fn: (...args: TArgs) => R, ...args: TArgs) => R; - /** - * Disables the instance of `AsyncLocalStorage`. All subsequent calls - * to `asyncLocalStorage.getStore()` will return `undefined` until`asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()` is called again. - * - * When calling `asyncLocalStorage.disable()`, all current contexts linked to the - * instance will be exited. - * - * Calling `asyncLocalStorage.disable()` is required before the`asyncLocalStorage` can be garbage collected. This does not apply to stores - * provided by the `asyncLocalStorage`, as those objects are garbage collected - * along with the corresponding async resources. - * - * Use this method when the `asyncLocalStorage` is not in use anymore - * in the current process. - * @since v13.10.0, v12.17.0 - * @experimental - */ - disable(): void; - /** - * Returns the current store. - * If called outside of an asynchronous context initialized by - * calling `asyncLocalStorage.run()` or `asyncLocalStorage.enterWith()`, it - * returns `undefined`. - * @since v13.10.0, v12.17.0 - */ - getStore(): T | undefined; - /** - * Runs a function synchronously within a context and returns its - * return value. The store is not accessible outside of the callback function. - * The store is accessible to any asynchronous operations created within the - * callback. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `run()` too. - * The stacktrace is not impacted by this call and the context is exited. - * - * Example: - * - * ```js - * const store = { id: 2 }; - * try { - * asyncLocalStorage.run(store, () => { - * asyncLocalStorage.getStore(); // Returns the store object - * setTimeout(() => { - * asyncLocalStorage.getStore(); // Returns the store object - * }, 200); - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns undefined - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - */ - run(store: T, callback: () => R): R; - run(store: T, callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Runs a function synchronously outside of a context and returns its - * return value. The store is not accessible within the callback function or - * the asynchronous operations created within the callback. Any `getStore()`call done within the callback function will always return `undefined`. - * - * The optional `args` are passed to the callback function. - * - * If the callback function throws an error, the error is thrown by `exit()` too. - * The stacktrace is not impacted by this call and the context is re-entered. - * - * Example: - * - * ```js - * // Within a call to run - * try { - * asyncLocalStorage.getStore(); // Returns the store object or value - * asyncLocalStorage.exit(() => { - * asyncLocalStorage.getStore(); // Returns undefined - * throw new Error(); - * }); - * } catch (e) { - * asyncLocalStorage.getStore(); // Returns the same object or value - * // The error will be caught here - * } - * ``` - * @since v13.10.0, v12.17.0 - * @experimental - */ - exit(callback: (...args: TArgs) => R, ...args: TArgs): R; - /** - * Transitions into the context for the remainder of the current - * synchronous execution and then persists the store through any following - * asynchronous calls. - * - * Example: - * - * ```js - * const store = { id: 1 }; - * // Replaces previous store with the given store object - * asyncLocalStorage.enterWith(store); - * asyncLocalStorage.getStore(); // Returns the store object - * someAsyncOperation(() => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * ``` - * - * This transition will continue for the _entire_ synchronous execution. - * This means that if, for example, the context is entered within an event - * handler subsequent event handlers will also run within that context unless - * specifically bound to another context with an `AsyncResource`. That is why`run()` should be preferred over `enterWith()` unless there are strong reasons - * to use the latter method. - * - * ```js - * const store = { id: 1 }; - * - * emitter.on('my-event', () => { - * asyncLocalStorage.enterWith(store); - * }); - * emitter.on('my-event', () => { - * asyncLocalStorage.getStore(); // Returns the same object - * }); - * - * asyncLocalStorage.getStore(); // Returns undefined - * emitter.emit('my-event'); - * asyncLocalStorage.getStore(); // Returns the same object - * ``` - * @since v13.11.0, v12.17.0 - * @experimental - */ - enterWith(store: T): void; - } -} -declare module "node:async_hooks" { - export * from "async_hooks"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/buffer.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/buffer.d.ts deleted file mode 100644 index 1ee5c013..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/buffer.d.ts +++ /dev/null @@ -1,2362 +0,0 @@ -/** - * `Buffer` objects are used to represent a fixed-length sequence of bytes. Many - * Node.js APIs support `Buffer`s. - * - * The `Buffer` class is a subclass of JavaScript's [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) class and - * extends it with methods that cover additional use cases. Node.js APIs accept - * plain [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) s wherever `Buffer`s are supported as well. - * - * While the `Buffer` class is available within the global scope, it is still - * recommended to explicitly reference it via an import or require statement. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a zero-filled Buffer of length 10. - * const buf1 = Buffer.alloc(10); - * - * // Creates a Buffer of length 10, - * // filled with bytes which all have the value `1`. - * const buf2 = Buffer.alloc(10, 1); - * - * // Creates an uninitialized buffer of length 10. - * // This is faster than calling Buffer.alloc() but the returned - * // Buffer instance might contain old data that needs to be - * // overwritten using fill(), write(), or other functions that fill the Buffer's - * // contents. - * const buf3 = Buffer.allocUnsafe(10); - * - * // Creates a Buffer containing the bytes [1, 2, 3]. - * const buf4 = Buffer.from([1, 2, 3]); - * - * // Creates a Buffer containing the bytes [1, 1, 1, 1] – the entries - * // are all truncated using `(value & 255)` to fit into the range 0–255. - * const buf5 = Buffer.from([257, 257.5, -255, '1']); - * - * // Creates a Buffer containing the UTF-8-encoded bytes for the string 'tést': - * // [0x74, 0xc3, 0xa9, 0x73, 0x74] (in hexadecimal notation) - * // [116, 195, 169, 115, 116] (in decimal notation) - * const buf6 = Buffer.from('tést'); - * - * // Creates a Buffer containing the Latin-1 bytes [0x74, 0xe9, 0x73, 0x74]. - * const buf7 = Buffer.from('tést', 'latin1'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/buffer.js) - */ -declare module "buffer" { - import { BinaryLike } from "node:crypto"; - import { ReadableStream as WebReadableStream } from "node:stream/web"; - /** - * This function returns `true` if `input` contains only valid UTF-8-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.4.0, v18.14.0 - * @param input The input to validate. - */ - export function isUtf8(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - /** - * This function returns `true` if `input` contains only valid ASCII-encoded data, - * including the case in which `input` is empty. - * - * Throws if the `input` is a detached array buffer. - * @since v19.6.0, v18.15.0 - * @param input The input to validate. - */ - export function isAscii(input: Buffer | ArrayBuffer | NodeJS.TypedArray): boolean; - export const INSPECT_MAX_BYTES: number; - export const kMaxLength: number; - export const kStringMaxLength: number; - export const constants: { - MAX_LENGTH: number; - MAX_STRING_LENGTH: number; - }; - export type TranscodeEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "latin1" - | "binary"; - /** - * Re-encodes the given `Buffer` or `Uint8Array` instance from one character - * encoding to another. Returns a new `Buffer` instance. - * - * Throws if the `fromEnc` or `toEnc` specify invalid character encodings or if - * conversion from `fromEnc` to `toEnc` is not permitted. - * - * Encodings supported by `buffer.transcode()` are: `'ascii'`, `'utf8'`,`'utf16le'`, `'ucs2'`, `'latin1'`, and `'binary'`. - * - * The transcoding process will use substitution characters if a given byte - * sequence cannot be adequately represented in the target encoding. For instance: - * - * ```js - * import { Buffer, transcode } from 'node:buffer'; - * - * const newBuf = transcode(Buffer.from('€'), 'utf8', 'ascii'); - * console.log(newBuf.toString('ascii')); - * // Prints: '?' - * ``` - * - * Because the Euro (`€`) sign is not representable in US-ASCII, it is replaced - * with `?` in the transcoded `Buffer`. - * @since v7.1.0 - * @param source A `Buffer` or `Uint8Array` instance. - * @param fromEnc The current encoding. - * @param toEnc To target encoding. - */ - export function transcode(source: Uint8Array, fromEnc: TranscodeEncoding, toEnc: TranscodeEncoding): Buffer; - export const SlowBuffer: { - /** @deprecated since v6.0.0, use `Buffer.allocUnsafeSlow()` */ - new(size: number): Buffer; - prototype: Buffer; - }; - /** - * Resolves a `'blob:nodedata:...'` an associated `Blob` object registered using - * a prior call to `URL.createObjectURL()`. - * @since v16.7.0 - * @experimental - * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. - */ - export function resolveObjectURL(id: string): Blob | undefined; - export { Buffer }; - /** - * @experimental - */ - export interface BlobOptions { - /** - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * The Blob content-type. The intent is for `type` to convey - * the MIME media type of the data, however no validation of the type format - * is performed. - */ - type?: string | undefined; - } - /** - * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data that can be safely shared across - * multiple worker threads. - * @since v15.7.0, v14.18.0 - */ - export class Blob { - /** - * The total size of the `Blob` in bytes. - * @since v15.7.0, v14.18.0 - */ - readonly size: number; - /** - * The content-type of the `Blob`. - * @since v15.7.0, v14.18.0 - */ - readonly type: string; - /** - * Creates a new `Blob` object containing a concatenation of the given sources. - * - * {ArrayBuffer}, {TypedArray}, {DataView}, and {Buffer} sources are copied into - * the 'Blob' and can therefore be safely modified after the 'Blob' is created. - * - * String sources are also copied into the `Blob`. - */ - constructor(sources: Array, options?: BlobOptions); - /** - * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of - * the `Blob` data. - * @since v15.7.0, v14.18.0 - */ - arrayBuffer(): Promise; - /** - * Creates and returns a new `Blob` containing a subset of this `Blob` objects - * data. The original `Blob` is not altered. - * @since v15.7.0, v14.18.0 - * @param start The starting index. - * @param end The ending index. - * @param type The content-type for the new `Blob` - */ - slice(start?: number, end?: number, type?: string): Blob; - /** - * Returns a promise that fulfills with the contents of the `Blob` decoded as a - * UTF-8 string. - * @since v15.7.0, v14.18.0 - */ - text(): Promise; - /** - * Returns a new `ReadableStream` that allows the content of the `Blob` to be read. - * @since v16.7.0 - */ - stream(): WebReadableStream; - } - export interface FileOptions { - /** - * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts will be - * converted to the platform native line-ending as specified by `require('node:os').EOL`. - */ - endings?: "native" | "transparent"; - /** The File content-type. */ - type?: string; - /** The last modified date of the file. `Default`: Date.now(). */ - lastModified?: number; - } - /** - * A [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File) provides information about files. - * @since v19.2.0, v18.13.0 - */ - export class File extends Blob { - constructor(sources: Array, fileName: string, options?: FileOptions); - /** - * The name of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly name: string; - /** - * The last modified date of the `File`. - * @since v19.2.0, v18.13.0 - */ - readonly lastModified: number; - } - export import atob = globalThis.atob; - export import btoa = globalThis.btoa; - import { Blob as NodeBlob } from "buffer"; - // This conditional type will be the existing global Blob in a browser, or - // the copy below in a Node environment. - type __Blob = typeof globalThis extends { onmessage: any; Blob: any } ? {} : NodeBlob; - global { - namespace NodeJS { - export { BufferEncoding }; - } - // Buffer class - type BufferEncoding = - | "ascii" - | "utf8" - | "utf-8" - | "utf16le" - | "utf-16le" - | "ucs2" - | "ucs-2" - | "base64" - | "base64url" - | "latin1" - | "binary" - | "hex"; - type WithImplicitCoercion = - | T - | { - valueOf(): T; - }; - /** - * Raw data is stored in instances of the Buffer class. - * A Buffer is similar to an array of integers but corresponds to a raw memory allocation outside the V8 heap. A Buffer cannot be resized. - * Valid string encodings: 'ascii'|'utf8'|'utf16le'|'ucs2'(alias of 'utf16le')|'base64'|'base64url'|'binary'(deprecated)|'hex' - */ - interface BufferConstructor { - /** - * Allocates a new buffer containing the given {str}. - * - * @param str String to store in buffer. - * @param encoding encoding to use, optional. Default is 'utf8' - * @deprecated since v10.0.0 - Use `Buffer.from(string[, encoding])` instead. - */ - new(str: string, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new buffer of {size} octets. - * - * @param size count of octets to allocate. - * @deprecated since v10.0.0 - Use `Buffer.alloc()` instead (also see `Buffer.allocUnsafe()`). - */ - new(size: number): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: Uint8Array): Buffer; - /** - * Produces a Buffer backed by the same allocated memory as - * the given {ArrayBuffer}/{SharedArrayBuffer}. - * - * @param arrayBuffer The ArrayBuffer with which to share memory. - * @deprecated since v10.0.0 - Use `Buffer.from(arrayBuffer[, byteOffset[, length]])` instead. - */ - new(arrayBuffer: ArrayBuffer | SharedArrayBuffer): Buffer; - /** - * Allocates a new buffer containing the given {array} of octets. - * - * @param array The octets to store. - * @deprecated since v10.0.0 - Use `Buffer.from(array)` instead. - */ - new(array: readonly any[]): Buffer; - /** - * Copies the passed {buffer} data onto a new {Buffer} instance. - * - * @param buffer The buffer to copy. - * @deprecated since v10.0.0 - Use `Buffer.from(buffer)` instead. - */ - new(buffer: Buffer): Buffer; - /** - * Allocates a new `Buffer` using an `array` of bytes in the range `0` – `255`. - * Array entries outside that range will be truncated to fit into it. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Creates a new Buffer containing the UTF-8 bytes of the string 'buffer'. - * const buf = Buffer.from([0x62, 0x75, 0x66, 0x66, 0x65, 0x72]); - * ``` - * - * If `array` is an `Array`\-like object (that is, one with a `length` property of - * type `number`), it is treated as if it is an array, unless it is a `Buffer` or - * a `Uint8Array`. This means all other `TypedArray` variants get treated as an`Array`. To create a `Buffer` from the bytes backing a `TypedArray`, use `Buffer.copyBytesFrom()`. - * - * A `TypeError` will be thrown if `array` is not an `Array` or another type - * appropriate for `Buffer.from()` variants. - * - * `Buffer.from(array)` and `Buffer.from(string)` may also use the internal`Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v5.10.0 - */ - from( - arrayBuffer: WithImplicitCoercion, - byteOffset?: number, - length?: number, - ): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param data data to create a new Buffer - */ - from(data: Uint8Array | readonly number[]): Buffer; - from(data: WithImplicitCoercion): Buffer; - /** - * Creates a new Buffer containing the given JavaScript string {str}. - * If provided, the {encoding} parameter identifies the character encoding. - * If not provided, {encoding} defaults to 'utf8'. - */ - from( - str: - | WithImplicitCoercion - | { - [Symbol.toPrimitive](hint: "string"): string; - }, - encoding?: BufferEncoding, - ): Buffer; - /** - * Creates a new Buffer using the passed {data} - * @param values to create a new Buffer - */ - of(...items: number[]): Buffer; - /** - * Returns `true` if `obj` is a `Buffer`, `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * Buffer.isBuffer(Buffer.alloc(10)); // true - * Buffer.isBuffer(Buffer.from('foo')); // true - * Buffer.isBuffer('a string'); // false - * Buffer.isBuffer([]); // false - * Buffer.isBuffer(new Uint8Array(1024)); // false - * ``` - * @since v0.1.101 - */ - isBuffer(obj: any): obj is Buffer; - /** - * Returns `true` if `encoding` is the name of a supported character encoding, - * or `false` otherwise. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * console.log(Buffer.isEncoding('utf8')); - * // Prints: true - * - * console.log(Buffer.isEncoding('hex')); - * // Prints: true - * - * console.log(Buffer.isEncoding('utf/8')); - * // Prints: false - * - * console.log(Buffer.isEncoding('')); - * // Prints: false - * ``` - * @since v0.9.1 - * @param encoding A character encoding name to check. - */ - isEncoding(encoding: string): encoding is BufferEncoding; - /** - * Returns the byte length of a string when encoded using `encoding`. - * This is not the same as [`String.prototype.length`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/length), which does not account - * for the encoding that is used to convert the string into bytes. - * - * For `'base64'`, `'base64url'`, and `'hex'`, this function assumes valid input. - * For strings that contain non-base64/hex-encoded data (e.g. whitespace), the - * return value might be greater than the length of a `Buffer` created from the - * string. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const str = '\u00bd + \u00bc = \u00be'; - * - * console.log(`${str}: ${str.length} characters, ` + - * `${Buffer.byteLength(str, 'utf8')} bytes`); - * // Prints: ½ + ¼ = ¾: 9 characters, 12 bytes - * ``` - * - * When `string` is a - * `Buffer`/[`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView)/[`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/- - * Reference/Global_Objects/TypedArray)/[`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer)/[`SharedArrayBuffer`](https://develop- - * er.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer), the byte length as reported by `.byteLength`is returned. - * @since v0.1.90 - * @param string A value to calculate the length of. - * @param [encoding='utf8'] If `string` is a string, this is its encoding. - * @return The number of bytes contained within `string`. - */ - byteLength( - string: string | NodeJS.ArrayBufferView | ArrayBuffer | SharedArrayBuffer, - encoding?: BufferEncoding, - ): number; - /** - * Returns a new `Buffer` which is the result of concatenating all the `Buffer`instances in the `list` together. - * - * If the list has no items, or if the `totalLength` is 0, then a new zero-length`Buffer` is returned. - * - * If `totalLength` is not provided, it is calculated from the `Buffer` instances - * in `list` by adding their lengths. - * - * If `totalLength` is provided, it is coerced to an unsigned integer. If the - * combined length of the `Buffer`s in `list` exceeds `totalLength`, the result is - * truncated to `totalLength`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a single `Buffer` from a list of three `Buffer` instances. - * - * const buf1 = Buffer.alloc(10); - * const buf2 = Buffer.alloc(14); - * const buf3 = Buffer.alloc(18); - * const totalLength = buf1.length + buf2.length + buf3.length; - * - * console.log(totalLength); - * // Prints: 42 - * - * const bufA = Buffer.concat([buf1, buf2, buf3], totalLength); - * - * console.log(bufA); - * // Prints: - * console.log(bufA.length); - * // Prints: 42 - * ``` - * - * `Buffer.concat()` may also use the internal `Buffer` pool like `Buffer.allocUnsafe()` does. - * @since v0.7.11 - * @param list List of `Buffer` or {@link Uint8Array} instances to concatenate. - * @param totalLength Total length of the `Buffer` instances in `list` when concatenated. - */ - concat(list: readonly Uint8Array[], totalLength?: number): Buffer; - /** - * Copies the underlying memory of `view` into a new `Buffer`. - * - * ```js - * const u16 = new Uint16Array([0, 0xffff]); - * const buf = Buffer.copyBytesFrom(u16, 1, 1); - * u16[1] = 0; - * console.log(buf.length); // 2 - * console.log(buf[0]); // 255 - * console.log(buf[1]); // 255 - * ``` - * @since v19.8.0 - * @param view The {TypedArray} to copy. - * @param [offset=': 0'] The starting offset within `view`. - * @param [length=view.length - offset] The number of elements from `view` to copy. - */ - copyBytesFrom(view: NodeJS.TypedArray, offset?: number, length?: number): Buffer; - /** - * Compares `buf1` to `buf2`, typically for the purpose of sorting arrays of`Buffer` instances. This is equivalent to calling `buf1.compare(buf2)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('1234'); - * const buf2 = Buffer.from('0123'); - * const arr = [buf1, buf2]; - * - * console.log(arr.sort(Buffer.compare)); - * // Prints: [ , ] - * // (This result is equal to: [buf2, buf1].) - * ``` - * @since v0.11.13 - * @return Either `-1`, `0`, or `1`, depending on the result of the comparison. See `compare` for details. - */ - compare(buf1: Uint8Array, buf2: Uint8Array): -1 | 0 | 1; - /** - * Allocates a new `Buffer` of `size` bytes. If `fill` is `undefined`, the`Buffer` will be zero-filled. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5); - * - * console.log(buf); - * // Prints: - * ``` - * - * If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * If `fill` is specified, the allocated `Buffer` will be initialized by calling `buf.fill(fill)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(5, 'a'); - * - * console.log(buf); - * // Prints: - * ``` - * - * If both `fill` and `encoding` are specified, the allocated `Buffer` will be - * initialized by calling `buf.fill(fill, encoding)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(11, 'aGVsbG8gd29ybGQ=', 'base64'); - * - * console.log(buf); - * // Prints: - * ``` - * - * Calling `Buffer.alloc()` can be measurably slower than the alternative `Buffer.allocUnsafe()` but ensures that the newly created `Buffer` instance - * contents will never contain sensitive data from previous allocations, including - * data that might not have been allocated for `Buffer`s. - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - * @param [fill=0] A value to pre-fill the new `Buffer` with. - * @param [encoding='utf8'] If `fill` is a string, this is its encoding. - */ - alloc(size: number, fill?: string | Uint8Array | number, encoding?: BufferEncoding): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `Buffer.alloc()` instead to initialize`Buffer` instances with zeroes. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(10); - * - * console.log(buf); - * // Prints (contents may vary): - * - * buf.fill(0); - * - * console.log(buf); - * // Prints: - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * - * The `Buffer` module pre-allocates an internal `Buffer` instance of - * size `Buffer.poolSize` that is used as a pool for the fast allocation of new`Buffer` instances created using `Buffer.allocUnsafe()`, `Buffer.from(array)`, - * and `Buffer.concat()` only when `size` is less than or equal to`Buffer.poolSize >> 1` (floor of `Buffer.poolSize` divided by two). - * - * Use of this pre-allocated internal memory pool is a key difference between - * calling `Buffer.alloc(size, fill)` vs. `Buffer.allocUnsafe(size).fill(fill)`. - * Specifically, `Buffer.alloc(size, fill)` will _never_ use the internal `Buffer`pool, while `Buffer.allocUnsafe(size).fill(fill)`_will_ use the internal`Buffer` pool if `size` is less - * than or equal to half `Buffer.poolSize`. The - * difference is subtle but can be important when an application requires the - * additional performance that `Buffer.allocUnsafe()` provides. - * @since v5.10.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafe(size: number): Buffer; - /** - * Allocates a new `Buffer` of `size` bytes. If `size` is larger than {@link constants.MAX_LENGTH} or smaller than 0, `ERR_OUT_OF_RANGE` is thrown. A zero-length `Buffer` is created if - * `size` is 0. - * - * The underlying memory for `Buffer` instances created in this way is _not_ - * _initialized_. The contents of the newly created `Buffer` are unknown and _may contain sensitive data_. Use `buf.fill(0)` to initialize - * such `Buffer` instances with zeroes. - * - * When using `Buffer.allocUnsafe()` to allocate new `Buffer` instances, - * allocations under 4 KiB are sliced from a single pre-allocated `Buffer`. This - * allows applications to avoid the garbage collection overhead of creating many - * individually allocated `Buffer` instances. This approach improves both - * performance and memory usage by eliminating the need to track and clean up as - * many individual `ArrayBuffer` objects. - * - * However, in the case where a developer may need to retain a small chunk of - * memory from a pool for an indeterminate amount of time, it may be appropriate - * to create an un-pooled `Buffer` instance using `Buffer.allocUnsafeSlow()` and - * then copying out the relevant bits. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Need to keep around a few small chunks of memory. - * const store = []; - * - * socket.on('readable', () => { - * let data; - * while (null !== (data = readable.read())) { - * // Allocate for retained data. - * const sb = Buffer.allocUnsafeSlow(10); - * - * // Copy the data into the new allocation. - * data.copy(sb, 0, 0, 10); - * - * store.push(sb); - * } - * }); - * ``` - * - * A `TypeError` will be thrown if `size` is not a number. - * @since v5.12.0 - * @param size The desired length of the new `Buffer`. - */ - allocUnsafeSlow(size: number): Buffer; - /** - * This is the size (in bytes) of pre-allocated internal `Buffer` instances used - * for pooling. This value may be modified. - * @since v0.11.3 - */ - poolSize: number; - } - interface Buffer extends Uint8Array { - /** - * Writes `string` to `buf` at `offset` according to the character encoding in`encoding`. The `length` parameter is the number of bytes to write. If `buf` did - * not contain enough space to fit the entire string, only part of `string` will be - * written. However, partially encoded characters will not be written. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.alloc(256); - * - * const len = buf.write('\u00bd + \u00bc = \u00be', 0); - * - * console.log(`${len} bytes: ${buf.toString('utf8', 0, len)}`); - * // Prints: 12 bytes: ½ + ¼ = ¾ - * - * const buffer = Buffer.alloc(10); - * - * const length = buffer.write('abcd', 8); - * - * console.log(`${length} bytes: ${buffer.toString('utf8', 8, 10)}`); - * // Prints: 2 bytes : ab - * ``` - * @since v0.1.90 - * @param string String to write to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write `string`. - * @param [length=buf.length - offset] Maximum number of bytes to write (written bytes will not exceed `buf.length - offset`). - * @param [encoding='utf8'] The character encoding of `string`. - * @return Number of bytes written. - */ - write(string: string, encoding?: BufferEncoding): number; - write(string: string, offset: number, encoding?: BufferEncoding): number; - write(string: string, offset: number, length: number, encoding?: BufferEncoding): number; - /** - * Decodes `buf` to a string according to the specified character encoding in`encoding`. `start` and `end` may be passed to decode only a subset of `buf`. - * - * If `encoding` is `'utf8'` and a byte sequence in the input is not valid UTF-8, - * then each invalid byte is replaced with the replacement character `U+FFFD`. - * - * The maximum length of a string instance (in UTF-16 code units) is available - * as {@link constants.MAX_STRING_LENGTH}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * console.log(buf1.toString('utf8')); - * // Prints: abcdefghijklmnopqrstuvwxyz - * console.log(buf1.toString('utf8', 0, 5)); - * // Prints: abcde - * - * const buf2 = Buffer.from('tést'); - * - * console.log(buf2.toString('hex')); - * // Prints: 74c3a97374 - * console.log(buf2.toString('utf8', 0, 3)); - * // Prints: té - * console.log(buf2.toString(undefined, 0, 3)); - * // Prints: té - * ``` - * @since v0.1.90 - * @param [encoding='utf8'] The character encoding to use. - * @param [start=0] The byte offset to start decoding at. - * @param [end=buf.length] The byte offset to stop decoding at (not inclusive). - */ - toString(encoding?: BufferEncoding, start?: number, end?: number): string; - /** - * Returns a JSON representation of `buf`. [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify) implicitly calls - * this function when stringifying a `Buffer` instance. - * - * `Buffer.from()` accepts objects in the format returned from this method. - * In particular, `Buffer.from(buf.toJSON())` works like `Buffer.from(buf)`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5]); - * const json = JSON.stringify(buf); - * - * console.log(json); - * // Prints: {"type":"Buffer","data":[1,2,3,4,5]} - * - * const copy = JSON.parse(json, (key, value) => { - * return value && value.type === 'Buffer' ? - * Buffer.from(value) : - * value; - * }); - * - * console.log(copy); - * // Prints: - * ``` - * @since v0.9.2 - */ - toJSON(): { - type: "Buffer"; - data: number[]; - }; - /** - * Returns `true` if both `buf` and `otherBuffer` have exactly the same bytes,`false` otherwise. Equivalent to `buf.compare(otherBuffer) === 0`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('414243', 'hex'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.equals(buf2)); - * // Prints: true - * console.log(buf1.equals(buf3)); - * // Prints: false - * ``` - * @since v0.11.13 - * @param otherBuffer A `Buffer` or {@link Uint8Array} with which to compare `buf`. - */ - equals(otherBuffer: Uint8Array): boolean; - /** - * Compares `buf` with `target` and returns a number indicating whether `buf`comes before, after, or is the same as `target` in sort order. - * Comparison is based on the actual sequence of bytes in each `Buffer`. - * - * * `0` is returned if `target` is the same as `buf` - * * `1` is returned if `target` should come _before_`buf` when sorted. - * * `-1` is returned if `target` should come _after_`buf` when sorted. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('ABC'); - * const buf2 = Buffer.from('BCD'); - * const buf3 = Buffer.from('ABCD'); - * - * console.log(buf1.compare(buf1)); - * // Prints: 0 - * console.log(buf1.compare(buf2)); - * // Prints: -1 - * console.log(buf1.compare(buf3)); - * // Prints: -1 - * console.log(buf2.compare(buf1)); - * // Prints: 1 - * console.log(buf2.compare(buf3)); - * // Prints: 1 - * console.log([buf1, buf2, buf3].sort(Buffer.compare)); - * // Prints: [ , , ] - * // (This result is equal to: [buf1, buf3, buf2].) - * ``` - * - * The optional `targetStart`, `targetEnd`, `sourceStart`, and `sourceEnd`arguments can be used to limit the comparison to specific ranges within `target`and `buf` respectively. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8, 9]); - * const buf2 = Buffer.from([5, 6, 7, 8, 9, 1, 2, 3, 4]); - * - * console.log(buf1.compare(buf2, 5, 9, 0, 4)); - * // Prints: 0 - * console.log(buf1.compare(buf2, 0, 6, 4)); - * // Prints: -1 - * console.log(buf1.compare(buf2, 5, 6, 5)); - * // Prints: 1 - * ``` - * - * `ERR_OUT_OF_RANGE` is thrown if `targetStart < 0`, `sourceStart < 0`,`targetEnd > target.byteLength`, or `sourceEnd > source.byteLength`. - * @since v0.11.13 - * @param target A `Buffer` or {@link Uint8Array} with which to compare `buf`. - * @param [targetStart=0] The offset within `target` at which to begin comparison. - * @param [targetEnd=target.length] The offset within `target` at which to end comparison (not inclusive). - * @param [sourceStart=0] The offset within `buf` at which to begin comparison. - * @param [sourceEnd=buf.length] The offset within `buf` at which to end comparison (not inclusive). - */ - compare( - target: Uint8Array, - targetStart?: number, - targetEnd?: number, - sourceStart?: number, - sourceEnd?: number, - ): -1 | 0 | 1; - /** - * Copies data from a region of `buf` to a region in `target`, even if the `target`memory region overlaps with `buf`. - * - * [`TypedArray.prototype.set()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/set) performs the same operation, and is available - * for all TypedArrays, including Node.js `Buffer`s, although it takes - * different function arguments. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create two `Buffer` instances. - * const buf1 = Buffer.allocUnsafe(26); - * const buf2 = Buffer.allocUnsafe(26).fill('!'); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * // Copy `buf1` bytes 16 through 19 into `buf2` starting at byte 8 of `buf2`. - * buf1.copy(buf2, 8, 16, 20); - * // This is equivalent to: - * // buf2.set(buf1.subarray(16, 20), 8); - * - * console.log(buf2.toString('ascii', 0, 25)); - * // Prints: !!!!!!!!qrst!!!!!!!!!!!!! - * ``` - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` and copy data from one region to an overlapping region - * // within the same `Buffer`. - * - * const buf = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf[i] = i + 97; - * } - * - * buf.copy(buf, 0, 4, 10); - * - * console.log(buf.toString()); - * // Prints: efghijghijklmnopqrstuvwxyz - * ``` - * @since v0.1.90 - * @param target A `Buffer` or {@link Uint8Array} to copy into. - * @param [targetStart=0] The offset within `target` at which to begin writing. - * @param [sourceStart=0] The offset within `buf` from which to begin copying. - * @param [sourceEnd=buf.length] The offset within `buf` at which to stop copying (not inclusive). - * @return The number of bytes copied. - */ - copy(target: Uint8Array, targetStart?: number, sourceStart?: number, sourceEnd?: number): number; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * This method is not compatible with the `Uint8Array.prototype.slice()`, - * which is a superclass of `Buffer`. To copy the slice, use`Uint8Array.prototype.slice()`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * const copiedBuf = Uint8Array.prototype.slice.call(buf); - * copiedBuf[0]++; - * console.log(copiedBuf.toString()); - * // Prints: cuffer - * - * console.log(buf.toString()); - * // Prints: buffer - * - * // With buf.slice(), the original buffer is modified. - * const notReallyCopiedBuf = buf.slice(); - * notReallyCopiedBuf[0]++; - * console.log(notReallyCopiedBuf.toString()); - * // Prints: cuffer - * console.log(buf.toString()); - * // Also prints: cuffer (!) - * ``` - * @since v0.3.0 - * @deprecated Use `subarray` instead. - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - slice(start?: number, end?: number): Buffer; - /** - * Returns a new `Buffer` that references the same memory as the original, but - * offset and cropped by the `start` and `end` indices. - * - * Specifying `end` greater than `buf.length` will return the same result as - * that of `end` equal to `buf.length`. - * - * This method is inherited from [`TypedArray.prototype.subarray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray/subarray). - * - * Modifying the new `Buffer` slice will modify the memory in the original `Buffer`because the allocated memory of the two objects overlap. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Create a `Buffer` with the ASCII alphabet, take a slice, and modify one byte - * // from the original `Buffer`. - * - * const buf1 = Buffer.allocUnsafe(26); - * - * for (let i = 0; i < 26; i++) { - * // 97 is the decimal ASCII value for 'a'. - * buf1[i] = i + 97; - * } - * - * const buf2 = buf1.subarray(0, 3); - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: abc - * - * buf1[0] = 33; - * - * console.log(buf2.toString('ascii', 0, buf2.length)); - * // Prints: !bc - * ``` - * - * Specifying negative indexes causes the slice to be generated relative to the - * end of `buf` rather than the beginning. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * console.log(buf.subarray(-6, -1).toString()); - * // Prints: buffe - * // (Equivalent to buf.subarray(0, 5).) - * - * console.log(buf.subarray(-6, -2).toString()); - * // Prints: buff - * // (Equivalent to buf.subarray(0, 4).) - * - * console.log(buf.subarray(-5, -2).toString()); - * // Prints: uff - * // (Equivalent to buf.subarray(1, 4).) - * ``` - * @since v3.0.0 - * @param [start=0] Where the new `Buffer` will start. - * @param [end=buf.length] Where the new `Buffer` will end (not inclusive). - */ - subarray(start?: number, end?: number): Buffer; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64BE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigInt64LE(0x0102030405060708n, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigInt64LE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. - * - * This function is also available under the `writeBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64BE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64BE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64BE(value: bigint, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeBigUInt64LE(0xdecafafecacefaden, 0); - * - * console.log(buf); - * // Prints: - * ``` - * - * This function is also available under the `writeBigUint64LE` alias. - * @since v12.0.0, v10.20.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy: `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeBigUInt64LE(value: bigint, offset?: number): number; - /** - * @alias Buffer.writeBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - writeBigUint64LE(value: bigint, offset?: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntLE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntLE - * @since v14.9.0, v12.19.0 - */ - writeUintLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than an unsigned integer. - * - * This function is also available under the `writeUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeUIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeUIntBE(value: number, offset: number, byteLength: number): number; - /** - * @alias Buffer.writeUIntBE - * @since v14.9.0, v12.19.0 - */ - writeUintBE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as little-endian. Supports up to 48 bits of accuracy. Behavior is undefined - * when `value` is anything other than a signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntLE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntLE(value: number, offset: number, byteLength: number): number; - /** - * Writes `byteLength` bytes of `value` to `buf` at the specified `offset`as big-endian. Supports up to 48 bits of accuracy. Behavior is undefined when`value` is anything other than a - * signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(6); - * - * buf.writeIntBE(0x1234567890ab, 0, 6); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param offset Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to write. Must satisfy `0 < byteLength <= 6`. - * @return `offset` plus the number of bytes written. - */ - writeIntBE(value: number, offset: number, byteLength: number): number; - /** - * Reads an unsigned, big-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64BE(0)); - * // Prints: 4294967295n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64BE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64BE - * @since v14.10.0, v12.19.0 - */ - readBigUint64BE(offset?: number): bigint; - /** - * Reads an unsigned, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readBigUint64LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff]); - * - * console.log(buf.readBigUInt64LE(0)); - * // Prints: 18446744069414584320n - * ``` - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigUInt64LE(offset?: number): bigint; - /** - * @alias Buffer.readBigUInt64LE - * @since v14.10.0, v12.19.0 - */ - readBigUint64LE(offset?: number): bigint; - /** - * Reads a signed, big-endian 64-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64BE(offset?: number): bigint; - /** - * Reads a signed, little-endian 64-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed - * values. - * @since v12.0.0, v10.20.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy: `0 <= offset <= buf.length - 8`. - */ - readBigInt64LE(offset?: number): bigint; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned, little-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintLE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntLE(0, 6).toString(16)); - * // Prints: ab9078563412 - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntLE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntLE - * @since v14.9.0, v12.19.0 - */ - readUintLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as an unsigned big-endian integer supporting - * up to 48 bits of accuracy. - * - * This function is also available under the `readUintBE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readUIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readUIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readUIntBE(offset: number, byteLength: number): number; - /** - * @alias Buffer.readUIntBE - * @since v14.9.0, v12.19.0 - */ - readUintBE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a little-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntLE(0, 6).toString(16)); - * // Prints: -546f87a9cbee - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntLE(offset: number, byteLength: number): number; - /** - * Reads `byteLength` number of bytes from `buf` at the specified `offset`and interprets the result as a big-endian, two's complement signed value - * supporting up to 48 bits of accuracy. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78, 0x90, 0xab]); - * - * console.log(buf.readIntBE(0, 6).toString(16)); - * // Prints: 1234567890ab - * console.log(buf.readIntBE(1, 6).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * console.log(buf.readIntBE(1, 0).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param offset Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - byteLength`. - * @param byteLength Number of bytes to read. Must satisfy `0 < byteLength <= 6`. - */ - readIntBE(offset: number, byteLength: number): number; - /** - * Reads an unsigned 8-bit integer from `buf` at the specified `offset`. - * - * This function is also available under the `readUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, -2]); - * - * console.log(buf.readUInt8(0)); - * // Prints: 1 - * console.log(buf.readUInt8(1)); - * // Prints: 254 - * console.log(buf.readUInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readUInt8(offset?: number): number; - /** - * @alias Buffer.readUInt8 - * @since v14.9.0, v12.19.0 - */ - readUint8(offset?: number): number; - /** - * Reads an unsigned, little-endian 16-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16LE(0).toString(16)); - * // Prints: 3412 - * console.log(buf.readUInt16LE(1).toString(16)); - * // Prints: 5634 - * console.log(buf.readUInt16LE(2).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16LE(offset?: number): number; - /** - * @alias Buffer.readUInt16LE - * @since v14.9.0, v12.19.0 - */ - readUint16LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 16-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56]); - * - * console.log(buf.readUInt16BE(0).toString(16)); - * // Prints: 1234 - * console.log(buf.readUInt16BE(1).toString(16)); - * // Prints: 3456 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readUInt16BE(offset?: number): number; - /** - * @alias Buffer.readUInt16BE - * @since v14.9.0, v12.19.0 - */ - readUint16BE(offset?: number): number; - /** - * Reads an unsigned, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32LE(0).toString(16)); - * // Prints: 78563412 - * console.log(buf.readUInt32LE(1).toString(16)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32LE(offset?: number): number; - /** - * @alias Buffer.readUInt32LE - * @since v14.9.0, v12.19.0 - */ - readUint32LE(offset?: number): number; - /** - * Reads an unsigned, big-endian 32-bit integer from `buf` at the specified`offset`. - * - * This function is also available under the `readUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0x12, 0x34, 0x56, 0x78]); - * - * console.log(buf.readUInt32BE(0).toString(16)); - * // Prints: 12345678 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readUInt32BE(offset?: number): number; - /** - * @alias Buffer.readUInt32BE - * @since v14.9.0, v12.19.0 - */ - readUint32BE(offset?: number): number; - /** - * Reads a signed 8-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([-1, 5]); - * - * console.log(buf.readInt8(0)); - * // Prints: -1 - * console.log(buf.readInt8(1)); - * // Prints: 5 - * console.log(buf.readInt8(2)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.0 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 1`. - */ - readInt8(offset?: number): number; - /** - * Reads a signed, little-endian 16-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16LE(0)); - * // Prints: 1280 - * console.log(buf.readInt16LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16LE(offset?: number): number; - /** - * Reads a signed, big-endian 16-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 5]); - * - * console.log(buf.readInt16BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 2`. - */ - readInt16BE(offset?: number): number; - /** - * Reads a signed, little-endian 32-bit integer from `buf` at the specified`offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32LE(0)); - * // Prints: 83886080 - * console.log(buf.readInt32LE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32LE(offset?: number): number; - /** - * Reads a signed, big-endian 32-bit integer from `buf` at the specified `offset`. - * - * Integers read from a `Buffer` are interpreted as two's complement signed values. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([0, 0, 0, 5]); - * - * console.log(buf.readInt32BE(0)); - * // Prints: 5 - * ``` - * @since v0.5.5 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readInt32BE(offset?: number): number; - /** - * Reads a 32-bit, little-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatLE(0)); - * // Prints: 1.539989614439558e-36 - * console.log(buf.readFloatLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatLE(offset?: number): number; - /** - * Reads a 32-bit, big-endian float from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4]); - * - * console.log(buf.readFloatBE(0)); - * // Prints: 2.387939260590663e-38 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 4`. - */ - readFloatBE(offset?: number): number; - /** - * Reads a 64-bit, little-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleLE(0)); - * // Prints: 5.447603722011605e-270 - * console.log(buf.readDoubleLE(1)); - * // Throws ERR_OUT_OF_RANGE. - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleLE(offset?: number): number; - /** - * Reads a 64-bit, big-endian double from `buf` at the specified `offset`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from([1, 2, 3, 4, 5, 6, 7, 8]); - * - * console.log(buf.readDoubleBE(0)); - * // Prints: 8.20788039913184e-304 - * ``` - * @since v0.11.15 - * @param [offset=0] Number of bytes to skip before starting to read. Must satisfy `0 <= offset <= buf.length - 8`. - */ - readDoubleBE(offset?: number): number; - reverse(): this; - /** - * Interprets `buf` as an array of unsigned 16-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 2. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap16(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap16(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * - * One convenient use of `buf.swap16()` is to perform a fast in-place conversion - * between UTF-16 little-endian and UTF-16 big-endian: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('This is little-endian UTF-16', 'utf16le'); - * buf.swap16(); // Convert to big-endian UTF-16 text. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap16(): Buffer; - /** - * Interprets `buf` as an array of unsigned 32-bit integers and swaps the - * byte order _in-place_. Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 4. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap32(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap32(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v5.10.0 - * @return A reference to `buf`. - */ - swap32(): Buffer; - /** - * Interprets `buf` as an array of 64-bit numbers and swaps byte order _in-place_. - * Throws `ERR_INVALID_BUFFER_SIZE` if `buf.length` is not a multiple of 8. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from([0x1, 0x2, 0x3, 0x4, 0x5, 0x6, 0x7, 0x8]); - * - * console.log(buf1); - * // Prints: - * - * buf1.swap64(); - * - * console.log(buf1); - * // Prints: - * - * const buf2 = Buffer.from([0x1, 0x2, 0x3]); - * - * buf2.swap64(); - * // Throws ERR_INVALID_BUFFER_SIZE. - * ``` - * @since v6.3.0 - * @return A reference to `buf`. - */ - swap64(): Buffer; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a - * valid unsigned 8-bit integer. Behavior is undefined when `value` is anything - * other than an unsigned 8-bit integer. - * - * This function is also available under the `writeUint8` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt8(0x3, 0); - * buf.writeUInt8(0x4, 1); - * buf.writeUInt8(0x23, 2); - * buf.writeUInt8(0x42, 3); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeUInt8(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt8 - * @since v14.9.0, v12.19.0 - */ - writeUint8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 16-bit integer. - * - * This function is also available under the `writeUint16LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16LE(0xdead, 0); - * buf.writeUInt16LE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16LE - * @since v14.9.0, v12.19.0 - */ - writeUint16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 16-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 16-bit integer. - * - * This function is also available under the `writeUint16BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt16BE(0xdead, 0); - * buf.writeUInt16BE(0xbeef, 2); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeUInt16BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt16BE - * @since v14.9.0, v12.19.0 - */ - writeUint16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value` is - * anything other than an unsigned 32-bit integer. - * - * This function is also available under the `writeUint32LE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32LE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32LE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32LE - * @since v14.9.0, v12.19.0 - */ - writeUint32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid unsigned 32-bit integer. Behavior is undefined when `value`is anything other than an - * unsigned 32-bit integer. - * - * This function is also available under the `writeUint32BE` alias. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeUInt32BE(0xfeedface, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeUInt32BE(value: number, offset?: number): number; - /** - * @alias Buffer.writeUInt32BE - * @since v14.9.0, v12.19.0 - */ - writeUint32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset`. `value` must be a valid - * signed 8-bit integer. Behavior is undefined when `value` is anything other than - * a signed 8-bit integer. - * - * `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt8(2, 0); - * buf.writeInt8(-2, 1); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.0 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 1`. - * @return `offset` plus the number of bytes written. - */ - writeInt8(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16LE(0x0304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 16-bit integer. Behavior is undefined when `value` is - * anything other than a signed 16-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(2); - * - * buf.writeInt16BE(0x0102, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 2`. - * @return `offset` plus the number of bytes written. - */ - writeInt16BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32LE(0x05060708, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32LE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a valid signed 32-bit integer. Behavior is undefined when `value` is - * anything other than a signed 32-bit integer. - * - * The `value` is interpreted and written as a two's complement signed integer. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeInt32BE(0x01020304, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.5.5 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeInt32BE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatLE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. Behavior is - * undefined when `value` is anything other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(4); - * - * buf.writeFloatBE(0xcafebabe, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 4`. - * @return `offset` plus the number of bytes written. - */ - writeFloatBE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as little-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleLE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleLE(value: number, offset?: number): number; - /** - * Writes `value` to `buf` at the specified `offset` as big-endian. The `value`must be a JavaScript number. Behavior is undefined when `value` is anything - * other than a JavaScript number. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(8); - * - * buf.writeDoubleBE(123.456, 0); - * - * console.log(buf); - * // Prints: - * ``` - * @since v0.11.15 - * @param value Number to be written to `buf`. - * @param [offset=0] Number of bytes to skip before starting to write. Must satisfy `0 <= offset <= buf.length - 8`. - * @return `offset` plus the number of bytes written. - */ - writeDoubleBE(value: number, offset?: number): number; - /** - * Fills `buf` with the specified `value`. If the `offset` and `end` are not given, - * the entire `buf` will be filled: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with the ASCII character 'h'. - * - * const b = Buffer.allocUnsafe(50).fill('h'); - * - * console.log(b.toString()); - * // Prints: hhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh - * - * // Fill a buffer with empty string - * const c = Buffer.allocUnsafe(5).fill(''); - * - * console.log(c.fill('')); - * // Prints: - * ``` - * - * `value` is coerced to a `uint32` value if it is not a string, `Buffer`, or - * integer. If the resulting integer is greater than `255` (decimal), `buf` will be - * filled with `value & 255`. - * - * If the final write of a `fill()` operation falls on a multi-byte character, - * then only the bytes of that character that fit into `buf` are written: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Fill a `Buffer` with character that takes up two bytes in UTF-8. - * - * console.log(Buffer.allocUnsafe(5).fill('\u0222')); - * // Prints: - * ``` - * - * If `value` contains invalid characters, it is truncated; if no valid - * fill data remains, an exception is thrown: - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.allocUnsafe(5); - * - * console.log(buf.fill('a')); - * // Prints: - * console.log(buf.fill('aazz', 'hex')); - * // Prints: - * console.log(buf.fill('zz', 'hex')); - * // Throws an exception. - * ``` - * @since v0.5.0 - * @param value The value with which to fill `buf`. Empty value (string, Uint8Array, Buffer) is coerced to `0`. - * @param [offset=0] Number of bytes to skip before starting to fill `buf`. - * @param [end=buf.length] Where to stop filling `buf` (not inclusive). - * @param [encoding='utf8'] The encoding for `value` if `value` is a string. - * @return A reference to `buf`. - */ - fill(value: string | Uint8Array | number, offset?: number, end?: number, encoding?: BufferEncoding): this; - /** - * If `value` is: - * - * * a string, `value` is interpreted according to the character encoding in`encoding`. - * * a `Buffer` or [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array), `value` will be used in its entirety. - * To compare a partial `Buffer`, use `buf.subarray`. - * * a number, `value` will be interpreted as an unsigned 8-bit integer - * value between `0` and `255`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.indexOf('this')); - * // Prints: 0 - * console.log(buf.indexOf('is')); - * // Prints: 2 - * console.log(buf.indexOf(Buffer.from('a buffer'))); - * // Prints: 8 - * console.log(buf.indexOf(97)); - * // Prints: 8 (97 is the decimal ASCII value for 'a') - * console.log(buf.indexOf(Buffer.from('a buffer example'))); - * // Prints: -1 - * console.log(buf.indexOf(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: 8 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.indexOf('\u03a3', 0, 'utf16le')); - * // Prints: 4 - * console.log(utf16Buffer.indexOf('\u03a3', -4, 'utf16le')); - * // Prints: 6 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. If the result - * of coercion is `NaN` or `0`, then the entire buffer will be searched. This - * behavior matches [`String.prototype.indexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/indexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.indexOf(99.9)); - * console.log(b.indexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN or 0. - * // Prints: 1, searching the whole buffer. - * console.log(b.indexOf('b', undefined)); - * console.log(b.indexOf('b', {})); - * console.log(b.indexOf('b', null)); - * console.log(b.indexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer` and `byteOffset` is less - * than `buf.length`, `byteOffset` will be returned. If `value` is empty and`byteOffset` is at least `buf.length`, `buf.length` will be returned. - * @since v1.5.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the first occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - indexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - /** - * Identical to `buf.indexOf()`, except the last occurrence of `value` is found - * rather than the first occurrence. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this buffer is a buffer'); - * - * console.log(buf.lastIndexOf('this')); - * // Prints: 0 - * console.log(buf.lastIndexOf('buffer')); - * // Prints: 17 - * console.log(buf.lastIndexOf(Buffer.from('buffer'))); - * // Prints: 17 - * console.log(buf.lastIndexOf(97)); - * // Prints: 15 (97 is the decimal ASCII value for 'a') - * console.log(buf.lastIndexOf(Buffer.from('yolo'))); - * // Prints: -1 - * console.log(buf.lastIndexOf('buffer', 5)); - * // Prints: 5 - * console.log(buf.lastIndexOf('buffer', 4)); - * // Prints: -1 - * - * const utf16Buffer = Buffer.from('\u039a\u0391\u03a3\u03a3\u0395', 'utf16le'); - * - * console.log(utf16Buffer.lastIndexOf('\u03a3', undefined, 'utf16le')); - * // Prints: 6 - * console.log(utf16Buffer.lastIndexOf('\u03a3', -5, 'utf16le')); - * // Prints: 4 - * ``` - * - * If `value` is not a string, number, or `Buffer`, this method will throw a`TypeError`. If `value` is a number, it will be coerced to a valid byte value, - * an integer between 0 and 255. - * - * If `byteOffset` is not a number, it will be coerced to a number. Any arguments - * that coerce to `NaN`, like `{}` or `undefined`, will search the whole buffer. - * This behavior matches [`String.prototype.lastIndexOf()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/lastIndexOf). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const b = Buffer.from('abcdef'); - * - * // Passing a value that's a number, but not a valid byte. - * // Prints: 2, equivalent to searching for 99 or 'c'. - * console.log(b.lastIndexOf(99.9)); - * console.log(b.lastIndexOf(256 + 99)); - * - * // Passing a byteOffset that coerces to NaN. - * // Prints: 1, searching the whole buffer. - * console.log(b.lastIndexOf('b', undefined)); - * console.log(b.lastIndexOf('b', {})); - * - * // Passing a byteOffset that coerces to 0. - * // Prints: -1, equivalent to passing 0. - * console.log(b.lastIndexOf('b', null)); - * console.log(b.lastIndexOf('b', [])); - * ``` - * - * If `value` is an empty string or empty `Buffer`, `byteOffset` will be returned. - * @since v6.0.0 - * @param value What to search for. - * @param [byteOffset=buf.length - 1] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is the encoding used to determine the binary representation of the string that will be searched for in `buf`. - * @return The index of the last occurrence of `value` in `buf`, or `-1` if `buf` does not contain `value`. - */ - lastIndexOf(value: string | number | Uint8Array, byteOffset?: number, encoding?: BufferEncoding): number; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `[index, byte]` pairs from the contents - * of `buf`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * // Log the entire contents of a `Buffer`. - * - * const buf = Buffer.from('buffer'); - * - * for (const pair of buf.entries()) { - * console.log(pair); - * } - * // Prints: - * // [0, 98] - * // [1, 117] - * // [2, 102] - * // [3, 102] - * // [4, 101] - * // [5, 114] - * ``` - * @since v1.1.0 - */ - entries(): IterableIterator<[number, number]>; - /** - * Equivalent to `buf.indexOf() !== -1`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('this is a buffer'); - * - * console.log(buf.includes('this')); - * // Prints: true - * console.log(buf.includes('is')); - * // Prints: true - * console.log(buf.includes(Buffer.from('a buffer'))); - * // Prints: true - * console.log(buf.includes(97)); - * // Prints: true (97 is the decimal ASCII value for 'a') - * console.log(buf.includes(Buffer.from('a buffer example'))); - * // Prints: false - * console.log(buf.includes(Buffer.from('a buffer example').slice(0, 8))); - * // Prints: true - * console.log(buf.includes('this', 4)); - * // Prints: false - * ``` - * @since v5.3.0 - * @param value What to search for. - * @param [byteOffset=0] Where to begin searching in `buf`. If negative, then offset is calculated from the end of `buf`. - * @param [encoding='utf8'] If `value` is a string, this is its encoding. - * @return `true` if `value` was found in `buf`, `false` otherwise. - */ - includes(value: string | number | Buffer, byteOffset?: number, encoding?: BufferEncoding): boolean; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) of `buf` keys (indices). - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * for (const key of buf.keys()) { - * console.log(key); - * } - * // Prints: - * // 0 - * // 1 - * // 2 - * // 3 - * // 4 - * // 5 - * ``` - * @since v1.1.0 - */ - keys(): IterableIterator; - /** - * Creates and returns an [iterator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) for `buf` values (bytes). This function is - * called automatically when a `Buffer` is used in a `for..of` statement. - * - * ```js - * import { Buffer } from 'node:buffer'; - * - * const buf = Buffer.from('buffer'); - * - * for (const value of buf.values()) { - * console.log(value); - * } - * // Prints: - * // 98 - * // 117 - * // 102 - * // 102 - * // 101 - * // 114 - * - * for (const value of buf) { - * console.log(value); - * } - * // Prints: - * // 98 - * // 117 - * // 102 - * // 102 - * // 101 - * // 114 - * ``` - * @since v1.1.0 - */ - values(): IterableIterator; - } - var Buffer: BufferConstructor; - /** - * Decodes a string of Base64-encoded data into bytes, and encodes those bytes - * into a string using Latin-1 (ISO-8859-1). - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `Buffer.from(data, 'base64')` instead. - * @param data The Base64-encoded input string. - */ - function atob(data: string): string; - /** - * Decodes a string into bytes using Latin-1 (ISO-8859), and encodes those bytes - * into a string using Base64. - * - * The `data` may be any JavaScript-value that can be coerced into a string. - * - * **This function is only provided for compatibility with legacy web platform APIs** - * **and should never be used in new code, because they use strings to represent** - * **binary data and predate the introduction of typed arrays in JavaScript.** - * **For code running using Node.js APIs, converting between base64-encoded strings** - * **and binary data should be performed using `Buffer.from(str, 'base64')` and`buf.toString('base64')`.** - * @since v15.13.0, v14.17.0 - * @legacy Use `buf.toString('base64')` instead. - * @param data An ASCII (Latin1) string. - */ - function btoa(data: string): string; - interface Blob extends __Blob {} - /** - * `Blob` class is a global reference for `require('node:buffer').Blob` - * https://nodejs.org/api/buffer.html#class-blob - * @since v18.0.0 - */ - var Blob: typeof globalThis extends { - onmessage: any; - Blob: infer T; - } ? T - : typeof NodeBlob; - } -} -declare module "node:buffer" { - export * from "buffer"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/child_process.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/child_process.d.ts deleted file mode 100644 index a97532b4..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/child_process.d.ts +++ /dev/null @@ -1,1540 +0,0 @@ -/** - * The `node:child_process` module provides the ability to spawn subprocesses in - * a manner that is similar, but not identical, to [`popen(3)`](http://man7.org/linux/man-pages/man3/popen.3.html). This capability - * is primarily provided by the {@link spawn} function: - * - * ```js - * const { spawn } = require('node:child_process'); - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * By default, pipes for `stdin`, `stdout`, and `stderr` are established between - * the parent Node.js process and the spawned subprocess. These pipes have - * limited (and platform-specific) capacity. If the subprocess writes to - * stdout in excess of that limit without the output being captured, the - * subprocess blocks waiting for the pipe buffer to accept more data. This is - * identical to the behavior of pipes in the shell. Use the `{ stdio: 'ignore' }`option if the output will not be consumed. - * - * The command lookup is performed using the `options.env.PATH` environment - * variable if `env` is in the `options` object. Otherwise, `process.env.PATH` is - * used. If `options.env` is set without `PATH`, lookup on Unix is performed - * on a default search path search of `/usr/bin:/bin` (see your operating system's - * manual for execvpe/execvp), on Windows the current processes environment - * variable `PATH` is used. - * - * On Windows, environment variables are case-insensitive. Node.js - * lexicographically sorts the `env` keys and uses the first one that - * case-insensitively matches. Only first (in lexicographic order) entry will be - * passed to the subprocess. This might lead to issues on Windows when passing - * objects to the `env` option that have multiple variants of the same key, such as`PATH` and `Path`. - * - * The {@link spawn} method spawns the child process asynchronously, - * without blocking the Node.js event loop. The {@link spawnSync} function provides equivalent functionality in a synchronous manner that blocks - * the event loop until the spawned process either exits or is terminated. - * - * For convenience, the `node:child_process` module provides a handful of - * synchronous and asynchronous alternatives to {@link spawn} and {@link spawnSync}. Each of these alternatives are implemented on - * top of {@link spawn} or {@link spawnSync}. - * - * * {@link exec}: spawns a shell and runs a command within that - * shell, passing the `stdout` and `stderr` to a callback function when - * complete. - * * {@link execFile}: similar to {@link exec} except - * that it spawns the command directly without first spawning a shell by - * default. - * * {@link fork}: spawns a new Node.js process and invokes a - * specified module with an IPC communication channel established that allows - * sending messages between parent and child. - * * {@link execSync}: a synchronous version of {@link exec} that will block the Node.js event loop. - * * {@link execFileSync}: a synchronous version of {@link execFile} that will block the Node.js event loop. - * - * For certain use cases, such as automating shell scripts, the `synchronous counterparts` may be more convenient. In many cases, however, - * the synchronous methods can have significant impact on performance due to - * stalling the event loop while spawned processes complete. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/child_process.js) - */ -declare module "child_process" { - import { ObjectEncodingOptions } from "node:fs"; - import { Abortable, EventEmitter } from "node:events"; - import * as net from "node:net"; - import { Pipe, Readable, Stream, Writable } from "node:stream"; - import { URL } from "node:url"; - type Serializable = string | object | number | boolean | bigint; - type SendHandle = net.Socket | net.Server; - /** - * Instances of the `ChildProcess` represent spawned child processes. - * - * Instances of `ChildProcess` are not intended to be created directly. Rather, - * use the {@link spawn}, {@link exec},{@link execFile}, or {@link fork} methods to create - * instances of `ChildProcess`. - * @since v2.2.0 - */ - class ChildProcess extends EventEmitter { - /** - * A `Writable Stream` that represents the child process's `stdin`. - * - * If a child process waits to read all of its input, the child will not continue - * until this stream has been closed via `end()`. - * - * If the child was spawned with `stdio[0]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdin` is an alias for `subprocess.stdio[0]`. Both properties will - * refer to the same value. - * - * The `subprocess.stdin` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdin: Writable | null; - /** - * A `Readable Stream` that represents the child process's `stdout`. - * - * If the child was spawned with `stdio[1]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stdout` is an alias for `subprocess.stdio[1]`. Both properties will - * refer to the same value. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn('ls'); - * - * subprocess.stdout.on('data', (data) => { - * console.log(`Received chunk ${data}`); - * }); - * ``` - * - * The `subprocess.stdout` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stdout: Readable | null; - /** - * A `Readable Stream` that represents the child process's `stderr`. - * - * If the child was spawned with `stdio[2]` set to anything other than `'pipe'`, - * then this will be `null`. - * - * `subprocess.stderr` is an alias for `subprocess.stdio[2]`. Both properties will - * refer to the same value. - * - * The `subprocess.stderr` property can be `null` or `undefined`if the child process could not be successfully spawned. - * @since v0.1.90 - */ - stderr: Readable | null; - /** - * The `subprocess.channel` property is a reference to the child's IPC channel. If - * no IPC channel exists, this property is `undefined`. - * @since v7.1.0 - */ - readonly channel?: Pipe | null | undefined; - /** - * A sparse array of pipes to the child process, corresponding with positions in - * the `stdio` option passed to {@link spawn} that have been set - * to the value `'pipe'`. `subprocess.stdio[0]`, `subprocess.stdio[1]`, and`subprocess.stdio[2]` are also available as `subprocess.stdin`,`subprocess.stdout`, and `subprocess.stderr`, - * respectively. - * - * In the following example, only the child's fd `1` (stdout) is configured as a - * pipe, so only the parent's `subprocess.stdio[1]` is a stream, all other values - * in the array are `null`. - * - * ```js - * const assert = require('node:assert'); - * const fs = require('node:fs'); - * const child_process = require('node:child_process'); - * - * const subprocess = child_process.spawn('ls', { - * stdio: [ - * 0, // Use parent's stdin for child. - * 'pipe', // Pipe child's stdout to parent. - * fs.openSync('err.out', 'w'), // Direct child's stderr to a file. - * ], - * }); - * - * assert.strictEqual(subprocess.stdio[0], null); - * assert.strictEqual(subprocess.stdio[0], subprocess.stdin); - * - * assert(subprocess.stdout); - * assert.strictEqual(subprocess.stdio[1], subprocess.stdout); - * - * assert.strictEqual(subprocess.stdio[2], null); - * assert.strictEqual(subprocess.stdio[2], subprocess.stderr); - * ``` - * - * The `subprocess.stdio` property can be `undefined` if the child process could - * not be successfully spawned. - * @since v0.7.10 - */ - readonly stdio: [ - Writable | null, - // stdin - Readable | null, - // stdout - Readable | null, - // stderr - Readable | Writable | null | undefined, - // extra - Readable | Writable | null | undefined, // extra - ]; - /** - * The `subprocess.killed` property indicates whether the child process - * successfully received a signal from `subprocess.kill()`. The `killed` property - * does not indicate that the child process has been terminated. - * @since v0.5.10 - */ - readonly killed: boolean; - /** - * Returns the process identifier (PID) of the child process. If the child process - * fails to spawn due to errors, then the value is `undefined` and `error` is - * emitted. - * - * ```js - * const { spawn } = require('node:child_process'); - * const grep = spawn('grep', ['ssh']); - * - * console.log(`Spawned child pid: ${grep.pid}`); - * grep.stdin.end(); - * ``` - * @since v0.1.90 - */ - readonly pid?: number | undefined; - /** - * The `subprocess.connected` property indicates whether it is still possible to - * send and receive messages from a child process. When `subprocess.connected` is`false`, it is no longer possible to send or receive messages. - * @since v0.7.2 - */ - readonly connected: boolean; - /** - * The `subprocess.exitCode` property indicates the exit code of the child process. - * If the child process is still running, the field will be `null`. - */ - readonly exitCode: number | null; - /** - * The `subprocess.signalCode` property indicates the signal received by - * the child process if any, else `null`. - */ - readonly signalCode: NodeJS.Signals | null; - /** - * The `subprocess.spawnargs` property represents the full list of command-line - * arguments the child process was launched with. - */ - readonly spawnargs: string[]; - /** - * The `subprocess.spawnfile` property indicates the executable file name of - * the child process that is launched. - * - * For {@link fork}, its value will be equal to `process.execPath`. - * For {@link spawn}, its value will be the name of - * the executable file. - * For {@link exec}, its value will be the name of the shell - * in which the child process is launched. - */ - readonly spawnfile: string; - /** - * The `subprocess.kill()` method sends a signal to the child process. If no - * argument is given, the process will be sent the `'SIGTERM'` signal. See [`signal(7)`](http://man7.org/linux/man-pages/man7/signal.7.html) for a list of available signals. This function - * returns `true` if [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) succeeds, and `false` otherwise. - * - * ```js - * const { spawn } = require('node:child_process'); - * const grep = spawn('grep', ['ssh']); - * - * grep.on('close', (code, signal) => { - * console.log( - * `child process terminated due to receipt of signal ${signal}`); - * }); - * - * // Send SIGHUP to process. - * grep.kill('SIGHUP'); - * ``` - * - * The `ChildProcess` object may emit an `'error'` event if the signal - * cannot be delivered. Sending a signal to a child process that has already exited - * is not an error but may have unforeseen consequences. Specifically, if the - * process identifier (PID) has been reassigned to another process, the signal will - * be delivered to that process instead which can have unexpected results. - * - * While the function is called `kill`, the signal delivered to the child process - * may not actually terminate the process. - * - * See [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for reference. - * - * On Windows, where POSIX signals do not exist, the `signal` argument will be - * ignored, and the process will be killed forcefully and abruptly (similar to`'SIGKILL'`). - * See `Signal Events` for more details. - * - * On Linux, child processes of child processes will not be terminated - * when attempting to kill their parent. This is likely to happen when running a - * new process in a shell or with the use of the `shell` option of `ChildProcess`: - * - * ```js - * 'use strict'; - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn( - * 'sh', - * [ - * '-c', - * `node -e "setInterval(() => { - * console.log(process.pid, 'is alive') - * }, 500);"`, - * ], { - * stdio: ['inherit', 'inherit', 'inherit'], - * }, - * ); - * - * setTimeout(() => { - * subprocess.kill(); // Does not terminate the Node.js process in the shell. - * }, 2000); - * ``` - * @since v0.1.90 - */ - kill(signal?: NodeJS.Signals | number): boolean; - /** - * Calls {@link ChildProcess.kill} with `'SIGTERM'`. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - /** - * When an IPC channel has been established between the parent and child ( - * i.e. when using {@link fork}), the `subprocess.send()` method can - * be used to send messages to the child process. When the child process is a - * Node.js instance, these messages can be received via the `'message'` event. - * - * The message goes through serialization and parsing. The resulting - * message might not be the same as what is originally sent. - * - * For example, in the parent script: - * - * ```js - * const cp = require('node:child_process'); - * const n = cp.fork(`${__dirname}/sub.js`); - * - * n.on('message', (m) => { - * console.log('PARENT got message:', m); - * }); - * - * // Causes the child to print: CHILD got message: { hello: 'world' } - * n.send({ hello: 'world' }); - * ``` - * - * And then the child script, `'sub.js'` might look like this: - * - * ```js - * process.on('message', (m) => { - * console.log('CHILD got message:', m); - * }); - * - * // Causes the parent to print: PARENT got message: { foo: 'bar', baz: null } - * process.send({ foo: 'bar', baz: NaN }); - * ``` - * - * Child Node.js processes will have a `process.send()` method of their own - * that allows the child to send messages back to the parent. - * - * There is a special case when sending a `{cmd: 'NODE_foo'}` message. Messages - * containing a `NODE_` prefix in the `cmd` property are reserved for use within - * Node.js core and will not be emitted in the child's `'message'` event. Rather, such messages are emitted using the`'internalMessage'` event and are consumed internally by Node.js. - * Applications should avoid using such messages or listening for`'internalMessage'` events as it is subject to change without notice. - * - * The optional `sendHandle` argument that may be passed to `subprocess.send()` is - * for passing a TCP server or socket object to the child process. The child will - * receive the object as the second argument passed to the callback function - * registered on the `'message'` event. Any data that is received - * and buffered in the socket will not be sent to the child. - * - * The optional `callback` is a function that is invoked after the message is - * sent but before the child may have received it. The function is called with a - * single argument: `null` on success, or an `Error` object on failure. - * - * If no `callback` function is provided and the message cannot be sent, an`'error'` event will be emitted by the `ChildProcess` object. This can - * happen, for instance, when the child process has already exited. - * - * `subprocess.send()` will return `false` if the channel has closed or when the - * backlog of unsent messages exceeds a threshold that makes it unwise to send - * more. Otherwise, the method returns `true`. The `callback` function can be - * used to implement flow control. - * - * #### Example: sending a server object - * - * The `sendHandle` argument can be used, for instance, to pass the handle of - * a TCP server object to the child process as illustrated in the example below: - * - * ```js - * const subprocess = require('node:child_process').fork('subprocess.js'); - * - * // Open up the server object and send the handle. - * const server = require('node:net').createServer(); - * server.on('connection', (socket) => { - * socket.end('handled by parent'); - * }); - * server.listen(1337, () => { - * subprocess.send('server', server); - * }); - * ``` - * - * The child would then receive the server object as: - * - * ```js - * process.on('message', (m, server) => { - * if (m === 'server') { - * server.on('connection', (socket) => { - * socket.end('handled by child'); - * }); - * } - * }); - * ``` - * - * Once the server is now shared between the parent and child, some connections - * can be handled by the parent and some by the child. - * - * While the example above uses a server created using the `node:net` module,`node:dgram` module servers use exactly the same workflow with the exceptions of - * listening on a `'message'` event instead of `'connection'` and using`server.bind()` instead of `server.listen()`. This is, however, only - * supported on Unix platforms. - * - * #### Example: sending a socket object - * - * Similarly, the `sendHandler` argument can be used to pass the handle of a - * socket to the child process. The example below spawns two children that each - * handle connections with "normal" or "special" priority: - * - * ```js - * const { fork } = require('node:child_process'); - * const normal = fork('subprocess.js', ['normal']); - * const special = fork('subprocess.js', ['special']); - * - * // Open up the server and send sockets to child. Use pauseOnConnect to prevent - * // the sockets from being read before they are sent to the child process. - * const server = require('node:net').createServer({ pauseOnConnect: true }); - * server.on('connection', (socket) => { - * - * // If this is special priority... - * if (socket.remoteAddress === '74.125.127.100') { - * special.send('socket', socket); - * return; - * } - * // This is normal priority. - * normal.send('socket', socket); - * }); - * server.listen(1337); - * ``` - * - * The `subprocess.js` would receive the socket handle as the second argument - * passed to the event callback function: - * - * ```js - * process.on('message', (m, socket) => { - * if (m === 'socket') { - * if (socket) { - * // Check that the client socket exists. - * // It is possible for the socket to be closed between the time it is - * // sent and the time it is received in the child process. - * socket.end(`Request handled with ${process.argv[2]} priority`); - * } - * } - * }); - * ``` - * - * Do not use `.maxConnections` on a socket that has been passed to a subprocess. - * The parent cannot track when the socket is destroyed. - * - * Any `'message'` handlers in the subprocess should verify that `socket` exists, - * as the connection may have been closed during the time it takes to send the - * connection to the child. - * @since v0.5.9 - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send(message: Serializable, callback?: (error: Error | null) => void): boolean; - send(message: Serializable, sendHandle?: SendHandle, callback?: (error: Error | null) => void): boolean; - send( - message: Serializable, - sendHandle?: SendHandle, - options?: MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * Closes the IPC channel between parent and child, allowing the child to exit - * gracefully once there are no other connections keeping it alive. After calling - * this method the `subprocess.connected` and `process.connected` properties in - * both the parent and child (respectively) will be set to `false`, and it will be - * no longer possible to pass messages between the processes. - * - * The `'disconnect'` event will be emitted when there are no messages in the - * process of being received. This will most often be triggered immediately after - * calling `subprocess.disconnect()`. - * - * When the child process is a Node.js instance (e.g. spawned using {@link fork}), the `process.disconnect()` method can be invoked - * within the child process to close the IPC channel as well. - * @since v0.7.2 - */ - disconnect(): void; - /** - * By default, the parent will wait for the detached child to exit. To prevent the - * parent from waiting for a given `subprocess` to exit, use the`subprocess.unref()` method. Doing so will cause the parent's event loop to not - * include the child in its reference count, allowing the parent to exit - * independently of the child, unless there is an established IPC channel between - * the child and the parent. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * ``` - * @since v0.7.10 - */ - unref(): void; - /** - * Calling `subprocess.ref()` after making a call to `subprocess.unref()` will - * restore the removed reference count for the child process, forcing the parent - * to wait for the child to exit before exiting itself. - * - * ```js - * const { spawn } = require('node:child_process'); - * - * const subprocess = spawn(process.argv[0], ['child_program.js'], { - * detached: true, - * stdio: 'ignore', - * }); - * - * subprocess.unref(); - * subprocess.ref(); - * ``` - * @since v0.7.10 - */ - ref(): void; - /** - * events.EventEmitter - * 1. close - * 2. disconnect - * 3. error - * 4. exit - * 5. message - * 6. spawn - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - addListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - addListener(event: "spawn", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "exit", code: number | null, signal: NodeJS.Signals | null): boolean; - emit(event: "message", message: Serializable, sendHandle: SendHandle): boolean; - emit(event: "spawn", listener: () => void): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - on(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - on(event: "spawn", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - once(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - once(event: "spawn", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "exit", listener: (code: number | null, signal: NodeJS.Signals | null) => void): this; - prependListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependListener(event: "spawn", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "close", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "exit", - listener: (code: number | null, signal: NodeJS.Signals | null) => void, - ): this; - prependOnceListener(event: "message", listener: (message: Serializable, sendHandle: SendHandle) => void): this; - prependOnceListener(event: "spawn", listener: () => void): this; - } - // return this object when stdio option is undefined or not specified - interface ChildProcessWithoutNullStreams extends ChildProcess { - stdin: Writable; - stdout: Readable; - stderr: Readable; - readonly stdio: [ - Writable, - Readable, - Readable, - // stderr - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - // return this object when stdio option is a tuple of 3 - interface ChildProcessByStdio - extends ChildProcess - { - stdin: I; - stdout: O; - stderr: E; - readonly stdio: [ - I, - O, - E, - Readable | Writable | null | undefined, - // extra, no modification - Readable | Writable | null | undefined, // extra, no modification - ]; - } - interface MessageOptions { - keepOpen?: boolean | undefined; - } - type IOType = "overlapped" | "pipe" | "ignore" | "inherit"; - type StdioOptions = IOType | Array; - type SerializationType = "json" | "advanced"; - interface MessagingOptions extends Abortable { - /** - * Specify the kind of serialization used for sending messages between processes. - * @default 'json' - */ - serialization?: SerializationType | undefined; - /** - * The signal value to be used when the spawned process will be killed by the abort signal. - * @default 'SIGTERM' - */ - killSignal?: NodeJS.Signals | number | undefined; - /** - * In milliseconds the maximum amount of time the process is allowed to run. - */ - timeout?: number | undefined; - } - interface ProcessEnvOptions { - uid?: number | undefined; - gid?: number | undefined; - cwd?: string | URL | undefined; - env?: NodeJS.ProcessEnv | undefined; - } - interface CommonOptions extends ProcessEnvOptions { - /** - * @default false - */ - windowsHide?: boolean | undefined; - /** - * @default 0 - */ - timeout?: number | undefined; - } - interface CommonSpawnOptions extends CommonOptions, MessagingOptions, Abortable { - argv0?: string | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - shell?: boolean | string | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - interface SpawnOptions extends CommonSpawnOptions { - detached?: boolean | undefined; - } - interface SpawnOptionsWithoutStdio extends SpawnOptions { - stdio?: StdioPipeNamed | StdioPipe[] | undefined; - } - type StdioNull = "inherit" | "ignore" | Stream; - type StdioPipeNamed = "pipe" | "overlapped"; - type StdioPipe = undefined | null | StdioPipeNamed; - interface SpawnOptionsWithStdioTuple< - Stdin extends StdioNull | StdioPipe, - Stdout extends StdioNull | StdioPipe, - Stderr extends StdioNull | StdioPipe, - > extends SpawnOptions { - stdio: [Stdin, Stdout, Stderr]; - } - /** - * The `child_process.spawn()` method spawns a new process using the given`command`, with command-line arguments in `args`. If omitted, `args` defaults - * to an empty array. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * A third argument may be used to specify additional options, with these defaults: - * - * ```js - * const defaults = { - * cwd: undefined, - * env: process.env, - * }; - * ``` - * - * Use `cwd` to specify the working directory from which the process is spawned. - * If not given, the default is to inherit the current working directory. If given, - * but the path does not exist, the child process emits an `ENOENT` error - * and exits immediately. `ENOENT` is also emitted when the command - * does not exist. - * - * Use `env` to specify environment variables that will be visible to the new - * process, the default is `process.env`. - * - * `undefined` values in `env` will be ignored. - * - * Example of running `ls -lh /usr`, capturing `stdout`, `stderr`, and the - * exit code: - * - * ```js - * const { spawn } = require('node:child_process'); - * const ls = spawn('ls', ['-lh', '/usr']); - * - * ls.stdout.on('data', (data) => { - * console.log(`stdout: ${data}`); - * }); - * - * ls.stderr.on('data', (data) => { - * console.error(`stderr: ${data}`); - * }); - * - * ls.on('close', (code) => { - * console.log(`child process exited with code ${code}`); - * }); - * ``` - * - * Example: A very elaborate way to run `ps ax | grep ssh` - * - * ```js - * const { spawn } = require('node:child_process'); - * const ps = spawn('ps', ['ax']); - * const grep = spawn('grep', ['ssh']); - * - * ps.stdout.on('data', (data) => { - * grep.stdin.write(data); - * }); - * - * ps.stderr.on('data', (data) => { - * console.error(`ps stderr: ${data}`); - * }); - * - * ps.on('close', (code) => { - * if (code !== 0) { - * console.log(`ps process exited with code ${code}`); - * } - * grep.stdin.end(); - * }); - * - * grep.stdout.on('data', (data) => { - * console.log(data.toString()); - * }); - * - * grep.stderr.on('data', (data) => { - * console.error(`grep stderr: ${data}`); - * }); - * - * grep.on('close', (code) => { - * if (code !== 0) { - * console.log(`grep process exited with code ${code}`); - * } - * }); - * ``` - * - * Example of checking for failed `spawn`: - * - * ```js - * const { spawn } = require('node:child_process'); - * const subprocess = spawn('bad_command'); - * - * subprocess.on('error', (err) => { - * console.error('Failed to start subprocess.'); - * }); - * ``` - * - * Certain platforms (macOS, Linux) will use the value of `argv[0]` for the process - * title while others (Windows, SunOS) will use `command`. - * - * Node.js overwrites `argv[0]` with `process.execPath` on startup, so`process.argv[0]` in a Node.js child process will not match the `argv0`parameter passed to `spawn` from the parent. Retrieve - * it with the`process.argv0` property instead. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { spawn } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const grep = spawn('grep', ['ssh'], { signal }); - * grep.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * ``` - * @since v0.1.90 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawn(command: string, options?: SpawnOptionsWithoutStdio): ChildProcessWithoutNullStreams; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, options: SpawnOptions): ChildProcess; - // overloads of spawn with 'args' - function spawn( - command: string, - args?: readonly string[], - options?: SpawnOptionsWithoutStdio, - ): ChildProcessWithoutNullStreams; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn( - command: string, - args: readonly string[], - options: SpawnOptionsWithStdioTuple, - ): ChildProcessByStdio; - function spawn(command: string, args: readonly string[], options: SpawnOptions): ChildProcess; - interface ExecOptions extends CommonOptions { - shell?: string | undefined; - signal?: AbortSignal | undefined; - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - } - interface ExecOptionsWithStringEncoding extends ExecOptions { - encoding: BufferEncoding; - } - interface ExecOptionsWithBufferEncoding extends ExecOptions { - encoding: BufferEncoding | null; // specify `null`. - } - interface ExecException extends Error { - cmd?: string | undefined; - killed?: boolean | undefined; - code?: number | undefined; - signal?: NodeJS.Signals | undefined; - } - /** - * Spawns a shell then executes the `command` within that shell, buffering any - * generated output. The `command` string passed to the exec function is processed - * directly by the shell and special characters (vary based on [shell](https://en.wikipedia.org/wiki/List_of_command-line_interpreters)) - * need to be dealt with accordingly: - * - * ```js - * const { exec } = require('node:child_process'); - * - * exec('"/path/to/test file/test.sh" arg1 arg2'); - * // Double quotes are used so that the space in the path is not interpreted as - * // a delimiter of multiple arguments. - * - * exec('echo "The \\$HOME variable is $HOME"'); - * // The $HOME variable is escaped in the first instance, but not in the second. - * ``` - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * - * If a `callback` function is provided, it is called with the arguments`(error, stdout, stderr)`. On success, `error` will be `null`. On error,`error` will be an instance of `Error`. The - * `error.code` property will be - * the exit code of the process. By convention, any exit code other than `0`indicates an error. `error.signal` will be the signal that terminated the - * process. - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * ```js - * const { exec } = require('node:child_process'); - * exec('cat *.js missing_file | wc -l', (error, stdout, stderr) => { - * if (error) { - * console.error(`exec error: ${error}`); - * return; - * } - * console.log(`stdout: ${stdout}`); - * console.error(`stderr: ${stderr}`); - * }); - * ``` - * - * If `timeout` is greater than `0`, the parent will send the signal - * identified by the `killSignal` property (the default is `'SIGTERM'`) if the - * child runs longer than `timeout` milliseconds. - * - * Unlike the [`exec(3)`](http://man7.org/linux/man-pages/man3/exec.3.html) POSIX system call, `child_process.exec()` does not replace - * the existing process and uses a shell to execute the command. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * const util = require('node:util'); - * const exec = util.promisify(require('node:child_process').exec); - * - * async function lsExample() { - * const { stdout, stderr } = await exec('ls'); - * console.log('stdout:', stdout); - * console.error('stderr:', stderr); - * } - * lsExample(); - * ``` - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { exec } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = exec('grep ssh', { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.90 - * @param command The command to run, with space-separated arguments. - * @param callback called with the output when process terminates. - */ - function exec( - command: string, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function exec( - command: string, - options: { - encoding: "buffer" | null; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function exec( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function exec( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function exec( - command: string, - options: ExecOptions, - callback?: (error: ExecException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function exec( - command: string, - options: (ObjectEncodingOptions & ExecOptions) | undefined | null, - callback?: (error: ExecException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - interface PromiseWithChild extends Promise { - child: ChildProcess; - } - namespace exec { - function __promisify__(command: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: { - encoding: "buffer" | null; - } & ExecOptions, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - command: string, - options: { - encoding: BufferEncoding; - } & ExecOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options: ExecOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - command: string, - options?: (ObjectEncodingOptions & ExecOptions) | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - } - interface ExecFileOptions extends CommonOptions, Abortable { - maxBuffer?: number | undefined; - killSignal?: NodeJS.Signals | number | undefined; - windowsVerbatimArguments?: boolean | undefined; - shell?: boolean | string | undefined; - signal?: AbortSignal | undefined; - } - interface ExecFileOptionsWithStringEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - interface ExecFileOptionsWithBufferEncoding extends ExecFileOptions { - encoding: "buffer" | null; - } - interface ExecFileOptionsWithOtherEncoding extends ExecFileOptions { - encoding: BufferEncoding; - } - type ExecFileException = - & Omit - & Omit - & { code?: string | number | undefined | null }; - /** - * The `child_process.execFile()` function is similar to {@link exec} except that it does not spawn a shell by default. Rather, the specified - * executable `file` is spawned directly as a new process making it slightly more - * efficient than {@link exec}. - * - * The same options as {@link exec} are supported. Since a shell is - * not spawned, behaviors such as I/O redirection and file globbing are not - * supported. - * - * ```js - * const { execFile } = require('node:child_process'); - * const child = execFile('node', ['--version'], (error, stdout, stderr) => { - * if (error) { - * throw error; - * } - * console.log(stdout); - * }); - * ``` - * - * The `stdout` and `stderr` arguments passed to the callback will contain the - * stdout and stderr output of the child process. By default, Node.js will decode - * the output as UTF-8 and pass strings to the callback. The `encoding` option - * can be used to specify the character encoding used to decode the stdout and - * stderr output. If `encoding` is `'buffer'`, or an unrecognized character - * encoding, `Buffer` objects will be passed to the callback instead. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `stdout` and `stderr` properties. The returned`ChildProcess` instance is attached to the `Promise` as a `child` property. In - * case of an error (including any error resulting in an exit code other than 0), a - * rejected promise is returned, with the same `error` object given in the - * callback, but with two additional properties `stdout` and `stderr`. - * - * ```js - * const util = require('node:util'); - * const execFile = util.promisify(require('node:child_process').execFile); - * async function getVersion() { - * const { stdout } = await execFile('node', ['--version']); - * console.log(stdout); - * } - * getVersion(); - * ``` - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * const { execFile } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = execFile('node', ['--version'], { signal }, (error) => { - * console.error(error); // an AbortError - * }); - * controller.abort(); - * ``` - * @since v0.1.91 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @param callback Called with the output when process terminates. - */ - function execFile(file: string): ChildProcess; - function execFile( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): ChildProcess; - function execFile(file: string, args?: readonly string[] | null): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): ChildProcess; - // no `options` definitely means stdout/stderr are `string`. - function execFile( - file: string, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with `"buffer"` or `null` for `encoding` means stdout/stderr are definitely `Buffer`. - function execFile( - file: string, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - callback: (error: ExecFileException | null, stdout: Buffer, stderr: Buffer) => void, - ): ChildProcess; - // `options` with well known `encoding` means stdout/stderr are definitely `string`. - function execFile( - file: string, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // `options` with an `encoding` whose type is `string` means stdout/stderr could either be `Buffer` or `string`. - // There is no guarantee the `encoding` is unknown as `string` is a superset of `BufferEncoding`. - function execFile( - file: string, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - callback: (error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void, - ): ChildProcess; - // `options` without an `encoding` means stdout/stderr are definitely `string`. - function execFile( - file: string, - options: ExecFileOptions, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions, - callback: (error: ExecFileException | null, stdout: string, stderr: string) => void, - ): ChildProcess; - // fallback if nothing else matches. Worst case is always `string | Buffer`. - function execFile( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) - | undefined - | null, - ): ChildProcess; - function execFile( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - callback: - | ((error: ExecFileException | null, stdout: string | Buffer, stderr: string | Buffer) => void) - | undefined - | null, - ): ChildProcess; - namespace execFile { - function __promisify__(file: string): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithBufferEncoding, - ): PromiseWithChild<{ - stdout: Buffer; - stderr: Buffer; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithStringEncoding, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptionsWithOtherEncoding, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - options: ExecFileOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: ExecFileOptions, - ): PromiseWithChild<{ - stdout: string; - stderr: string; - }>; - function __promisify__( - file: string, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - function __promisify__( - file: string, - args: readonly string[] | undefined | null, - options: (ObjectEncodingOptions & ExecFileOptions) | undefined | null, - ): PromiseWithChild<{ - stdout: string | Buffer; - stderr: string | Buffer; - }>; - } - interface ForkOptions extends ProcessEnvOptions, MessagingOptions, Abortable { - execPath?: string | undefined; - execArgv?: string[] | undefined; - silent?: boolean | undefined; - /** - * Can be set to 'pipe', 'inherit', 'overlapped', or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - detached?: boolean | undefined; - windowsVerbatimArguments?: boolean | undefined; - } - /** - * The `child_process.fork()` method is a special case of {@link spawn} used specifically to spawn new Node.js processes. - * Like {@link spawn}, a `ChildProcess` object is returned. The - * returned `ChildProcess` will have an additional communication channel - * built-in that allows messages to be passed back and forth between the parent and - * child. See `subprocess.send()` for details. - * - * Keep in mind that spawned Node.js child processes are - * independent of the parent with exception of the IPC communication channel - * that is established between the two. Each process has its own memory, with - * their own V8 instances. Because of the additional resource allocations - * required, spawning a large number of child Node.js processes is not - * recommended. - * - * By default, `child_process.fork()` will spawn new Node.js instances using the `process.execPath` of the parent process. The `execPath` property in the`options` object allows for an alternative - * execution path to be used. - * - * Node.js processes launched with a custom `execPath` will communicate with the - * parent process using the file descriptor (fd) identified using the - * environment variable `NODE_CHANNEL_FD` on the child process. - * - * Unlike the [`fork(2)`](http://man7.org/linux/man-pages/man2/fork.2.html) POSIX system call, `child_process.fork()` does not clone the - * current process. - * - * The `shell` option available in {@link spawn} is not supported by`child_process.fork()` and will be ignored if set. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.kill()` on the child process except - * the error passed to the callback will be an `AbortError`: - * - * ```js - * if (process.argv[2] === 'child') { - * setTimeout(() => { - * console.log(`Hello from ${process.argv[2]}!`); - * }, 1_000); - * } else { - * const { fork } = require('node:child_process'); - * const controller = new AbortController(); - * const { signal } = controller; - * const child = fork(__filename, ['child'], { signal }); - * child.on('error', (err) => { - * // This will be called with err being an AbortError if the controller aborts - * }); - * controller.abort(); // Stops the child process - * } - * ``` - * @since v0.5.0 - * @param modulePath The module to run in the child. - * @param args List of string arguments. - */ - function fork(modulePath: string, options?: ForkOptions): ChildProcess; - function fork(modulePath: string, args?: readonly string[], options?: ForkOptions): ChildProcess; - interface SpawnSyncOptions extends CommonSpawnOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface SpawnSyncOptionsWithStringEncoding extends SpawnSyncOptions { - encoding: BufferEncoding; - } - interface SpawnSyncOptionsWithBufferEncoding extends SpawnSyncOptions { - encoding?: "buffer" | null | undefined; - } - interface SpawnSyncReturns { - pid: number; - output: Array; - stdout: T; - stderr: T; - status: number | null; - signal: NodeJS.Signals | null; - error?: Error | undefined; - } - /** - * The `child_process.spawnSync()` method is generally identical to {@link spawn} with the exception that the function will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the process intercepts and handles the `SIGTERM` signal - * and doesn't exit, the parent process will wait until the child process has - * exited. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @param args List of string arguments. - */ - function spawnSync(command: string): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithStringEncoding): SpawnSyncReturns; - function spawnSync(command: string, options: SpawnSyncOptionsWithBufferEncoding): SpawnSyncReturns; - function spawnSync(command: string, options?: SpawnSyncOptions): SpawnSyncReturns; - function spawnSync(command: string, args: readonly string[]): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithStringEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args: readonly string[], - options: SpawnSyncOptionsWithBufferEncoding, - ): SpawnSyncReturns; - function spawnSync( - command: string, - args?: readonly string[], - options?: SpawnSyncOptions, - ): SpawnSyncReturns; - interface CommonExecOptions extends CommonOptions { - input?: string | NodeJS.ArrayBufferView | undefined; - /** - * Can be set to 'pipe', 'inherit, or 'ignore', or an array of these strings. - * If passed as an array, the first element is used for `stdin`, the second for - * `stdout`, and the third for `stderr`. A fourth element can be used to - * specify the `stdio` behavior beyond the standard streams. See - * {@link ChildProcess.stdio} for more information. - * - * @default 'pipe' - */ - stdio?: StdioOptions | undefined; - killSignal?: NodeJS.Signals | number | undefined; - maxBuffer?: number | undefined; - encoding?: BufferEncoding | "buffer" | null | undefined; - } - interface ExecSyncOptions extends CommonExecOptions { - shell?: string | undefined; - } - interface ExecSyncOptionsWithStringEncoding extends ExecSyncOptions { - encoding: BufferEncoding; - } - interface ExecSyncOptionsWithBufferEncoding extends ExecSyncOptions { - encoding?: "buffer" | null | undefined; - } - /** - * The `child_process.execSync()` method is generally identical to {@link exec} with the exception that the method will not return - * until the child process has fully closed. When a timeout has been encountered - * and `killSignal` is sent, the method won't return until the process has - * completely exited. If the child process intercepts and handles the `SIGTERM`signal and doesn't exit, the parent process will wait until the child process - * has exited. - * - * If the process times out or has a non-zero exit code, this method will throw. - * The `Error` object will contain the entire result from {@link spawnSync}. - * - * **Never pass unsanitized user input to this function. Any input containing shell** - * **metacharacters may be used to trigger arbitrary command execution.** - * @since v0.11.12 - * @param command The command to run. - * @return The stdout from the command. - */ - function execSync(command: string): Buffer; - function execSync(command: string, options: ExecSyncOptionsWithStringEncoding): string; - function execSync(command: string, options: ExecSyncOptionsWithBufferEncoding): Buffer; - function execSync(command: string, options?: ExecSyncOptions): string | Buffer; - interface ExecFileSyncOptions extends CommonExecOptions { - shell?: boolean | string | undefined; - } - interface ExecFileSyncOptionsWithStringEncoding extends ExecFileSyncOptions { - encoding: BufferEncoding; - } - interface ExecFileSyncOptionsWithBufferEncoding extends ExecFileSyncOptions { - encoding?: "buffer" | null; // specify `null`. - } - /** - * The `child_process.execFileSync()` method is generally identical to {@link execFile} with the exception that the method will not - * return until the child process has fully closed. When a timeout has been - * encountered and `killSignal` is sent, the method won't return until the process - * has completely exited. - * - * If the child process intercepts and handles the `SIGTERM` signal and - * does not exit, the parent process will still wait until the child process has - * exited. - * - * If the process times out or has a non-zero exit code, this method will throw an `Error` that will include the full result of the underlying {@link spawnSync}. - * - * **If the `shell` option is enabled, do not pass unsanitized user input to this** - * **function. Any input containing shell metacharacters may be used to trigger** - * **arbitrary command execution.** - * @since v0.11.12 - * @param file The name or path of the executable file to run. - * @param args List of string arguments. - * @return The stdout from the command. - */ - function execFileSync(file: string): Buffer; - function execFileSync(file: string, options: ExecFileSyncOptionsWithStringEncoding): string; - function execFileSync(file: string, options: ExecFileSyncOptionsWithBufferEncoding): Buffer; - function execFileSync(file: string, options?: ExecFileSyncOptions): string | Buffer; - function execFileSync(file: string, args: readonly string[]): Buffer; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithStringEncoding, - ): string; - function execFileSync( - file: string, - args: readonly string[], - options: ExecFileSyncOptionsWithBufferEncoding, - ): Buffer; - function execFileSync(file: string, args?: readonly string[], options?: ExecFileSyncOptions): string | Buffer; -} -declare module "node:child_process" { - export * from "child_process"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/cluster.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/cluster.d.ts deleted file mode 100644 index 39cd56ad..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/cluster.d.ts +++ /dev/null @@ -1,432 +0,0 @@ -/** - * Clusters of Node.js processes can be used to run multiple instances of Node.js - * that can distribute workloads among their application threads. When process - * isolation is not needed, use the `worker_threads` module instead, which - * allows running multiple application threads within a single Node.js instance. - * - * The cluster module allows easy creation of child processes that all share - * server ports. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('exit', (worker, code, signal) => { - * console.log(`worker ${worker.process.pid} died`); - * }); - * } else { - * // Workers can share any TCP connection - * // In this case it is an HTTP server - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * - * console.log(`Worker ${process.pid} started`); - * } - * ``` - * - * Running Node.js will now share port 8000 between the workers: - * - * ```console - * $ node server.js - * Primary 3596 is running - * Worker 4324 started - * Worker 4520 started - * Worker 6056 started - * Worker 5644 started - * ``` - * - * On Windows, it is not yet possible to set up a named pipe server in a worker. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/cluster.js) - */ -declare module "cluster" { - import * as child from "node:child_process"; - import EventEmitter = require("node:events"); - import * as net from "node:net"; - type SerializationType = "json" | "advanced"; - export interface ClusterSettings { - execArgv?: string[] | undefined; // default: process.execArgv - exec?: string | undefined; - args?: string[] | undefined; - silent?: boolean | undefined; - stdio?: any[] | undefined; - uid?: number | undefined; - gid?: number | undefined; - inspectPort?: number | (() => number) | undefined; - serialization?: SerializationType | undefined; - cwd?: string | undefined; - windowsHide?: boolean | undefined; - } - export interface Address { - address: string; - port: number; - addressType: number | "udp4" | "udp6"; // 4, 6, -1, "udp4", "udp6" - } - /** - * A `Worker` object contains all public information and method about a worker. - * In the primary it can be obtained using `cluster.workers`. In a worker - * it can be obtained using `cluster.worker`. - * @since v0.7.0 - */ - export class Worker extends EventEmitter { - /** - * Each new worker is given its own unique id, this id is stored in the`id`. - * - * While a worker is alive, this is the key that indexes it in`cluster.workers`. - * @since v0.8.0 - */ - id: number; - /** - * All workers are created using `child_process.fork()`, the returned object - * from this function is stored as `.process`. In a worker, the global `process`is stored. - * - * See: `Child Process module`. - * - * Workers will call `process.exit(0)` if the `'disconnect'` event occurs - * on `process` and `.exitedAfterDisconnect` is not `true`. This protects against - * accidental disconnection. - * @since v0.7.0 - */ - process: child.ChildProcess; - /** - * Send a message to a worker or primary, optionally with a handle. - * - * In the primary, this sends a message to a specific worker. It is identical to `ChildProcess.send()`. - * - * In a worker, this sends a message to the primary. It is identical to`process.send()`. - * - * This example will echo back all messages from the primary: - * - * ```js - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * worker.send('hi there'); - * - * } else if (cluster.isWorker) { - * process.on('message', (msg) => { - * process.send(msg); - * }); - * } - * ``` - * @since v0.7.0 - * @param options The `options` argument, if present, is an object used to parameterize the sending of certain types of handles. `options` supports the following properties: - */ - send(message: child.Serializable, callback?: (error: Error | null) => void): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - callback?: (error: Error | null) => void, - ): boolean; - send( - message: child.Serializable, - sendHandle: child.SendHandle, - options?: child.MessageOptions, - callback?: (error: Error | null) => void, - ): boolean; - /** - * This function will kill the worker. In the primary worker, it does this by - * disconnecting the `worker.process`, and once disconnected, killing with`signal`. In the worker, it does it by killing the process with `signal`. - * - * The `kill()` function kills the worker process without waiting for a graceful - * disconnect, it has the same behavior as `worker.process.kill()`. - * - * This method is aliased as `worker.destroy()` for backwards compatibility. - * - * In a worker, `process.kill()` exists, but it is not this function; - * it is `kill()`. - * @since v0.9.12 - * @param [signal='SIGTERM'] Name of the kill signal to send to the worker process. - */ - kill(signal?: string): void; - destroy(signal?: string): void; - /** - * In a worker, this function will close all servers, wait for the `'close'` event - * on those servers, and then disconnect the IPC channel. - * - * In the primary, an internal message is sent to the worker causing it to call`.disconnect()` on itself. - * - * Causes `.exitedAfterDisconnect` to be set. - * - * After a server is closed, it will no longer accept new connections, - * but connections may be accepted by any other listening worker. Existing - * connections will be allowed to close as usual. When no more connections exist, - * see `server.close()`, the IPC channel to the worker will close allowing it - * to die gracefully. - * - * The above applies _only_ to server connections, client connections are not - * automatically closed by workers, and disconnect does not wait for them to close - * before exiting. - * - * In a worker, `process.disconnect` exists, but it is not this function; - * it is `disconnect()`. - * - * Because long living server connections may block workers from disconnecting, it - * may be useful to send a message, so application specific actions may be taken to - * close them. It also may be useful to implement a timeout, killing a worker if - * the `'disconnect'` event has not been emitted after some time. - * - * ```js - * if (cluster.isPrimary) { - * const worker = cluster.fork(); - * let timeout; - * - * worker.on('listening', (address) => { - * worker.send('shutdown'); - * worker.disconnect(); - * timeout = setTimeout(() => { - * worker.kill(); - * }, 2000); - * }); - * - * worker.on('disconnect', () => { - * clearTimeout(timeout); - * }); - * - * } else if (cluster.isWorker) { - * const net = require('node:net'); - * const server = net.createServer((socket) => { - * // Connections never end - * }); - * - * server.listen(8000); - * - * process.on('message', (msg) => { - * if (msg === 'shutdown') { - * // Initiate graceful close of any connections to server - * } - * }); - * } - * ``` - * @since v0.7.7 - * @return A reference to `worker`. - */ - disconnect(): void; - /** - * This function returns `true` if the worker is connected to its primary via its - * IPC channel, `false` otherwise. A worker is connected to its primary after it - * has been created. It is disconnected after the `'disconnect'` event is emitted. - * @since v0.11.14 - */ - isConnected(): boolean; - /** - * This function returns `true` if the worker's process has terminated (either - * because of exiting or being signaled). Otherwise, it returns `false`. - * - * ```js - * import cluster from 'node:cluster'; - * import http from 'node:http'; - * import { availableParallelism } from 'node:os'; - * import process from 'node:process'; - * - * const numCPUs = availableParallelism(); - * - * if (cluster.isPrimary) { - * console.log(`Primary ${process.pid} is running`); - * - * // Fork workers. - * for (let i = 0; i < numCPUs; i++) { - * cluster.fork(); - * } - * - * cluster.on('fork', (worker) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * - * cluster.on('exit', (worker, code, signal) => { - * console.log('worker is dead:', worker.isDead()); - * }); - * } else { - * // Workers can share any TCP connection. In this case, it is an HTTP server. - * http.createServer((req, res) => { - * res.writeHead(200); - * res.end(`Current process\n ${process.pid}`); - * process.kill(process.pid); - * }).listen(8000); - * } - * ``` - * @since v0.11.14 - */ - isDead(): boolean; - /** - * This property is `true` if the worker exited due to `.disconnect()`. - * If the worker exited any other way, it is `false`. If the - * worker has not exited, it is `undefined`. - * - * The boolean `worker.exitedAfterDisconnect` allows distinguishing between - * voluntary and accidental exit, the primary may choose not to respawn a worker - * based on this value. - * - * ```js - * cluster.on('exit', (worker, code, signal) => { - * if (worker.exitedAfterDisconnect === true) { - * console.log('Oh, it was just voluntary – no need to worry'); - * } - * }); - * - * // kill worker - * worker.kill(); - * ``` - * @since v6.0.0 - */ - exitedAfterDisconnect: boolean; - /** - * events.EventEmitter - * 1. disconnect - * 2. error - * 3. exit - * 4. listening - * 5. message - * 6. online - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "exit", listener: (code: number, signal: string) => void): this; - addListener(event: "listening", listener: (address: Address) => void): this; - addListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "exit", code: number, signal: string): boolean; - emit(event: "listening", address: Address): boolean; - emit(event: "message", message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "exit", listener: (code: number, signal: string) => void): this; - on(event: "listening", listener: (address: Address) => void): this; - on(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "exit", listener: (code: number, signal: string) => void): this; - once(event: "listening", listener: (address: Address) => void): this; - once(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependListener(event: "listening", listener: (address: Address) => void): this; - prependListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependListener(event: "online", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "exit", listener: (code: number, signal: string) => void): this; - prependOnceListener(event: "listening", listener: (address: Address) => void): this; - prependOnceListener(event: "message", listener: (message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener(event: "online", listener: () => void): this; - } - export interface Cluster extends EventEmitter { - disconnect(callback?: () => void): void; - fork(env?: any): Worker; - /** @deprecated since v16.0.0 - use isPrimary. */ - readonly isMaster: boolean; - readonly isPrimary: boolean; - readonly isWorker: boolean; - schedulingPolicy: number; - readonly settings: ClusterSettings; - /** @deprecated since v16.0.0 - use setupPrimary. */ - setupMaster(settings?: ClusterSettings): void; - /** - * `setupPrimary` is used to change the default 'fork' behavior. Once called, the settings will be present in cluster.settings. - */ - setupPrimary(settings?: ClusterSettings): void; - readonly worker?: Worker | undefined; - readonly workers?: NodeJS.Dict | undefined; - readonly SCHED_NONE: number; - readonly SCHED_RR: number; - /** - * events.EventEmitter - * 1. disconnect - * 2. exit - * 3. fork - * 4. listening - * 5. message - * 6. online - * 7. setup - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "disconnect", listener: (worker: Worker) => void): this; - addListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - addListener(event: "fork", listener: (worker: Worker) => void): this; - addListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - addListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; // the handle is a net.Socket or net.Server object, or undefined. - addListener(event: "online", listener: (worker: Worker) => void): this; - addListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "disconnect", worker: Worker): boolean; - emit(event: "exit", worker: Worker, code: number, signal: string): boolean; - emit(event: "fork", worker: Worker): boolean; - emit(event: "listening", worker: Worker, address: Address): boolean; - emit(event: "message", worker: Worker, message: any, handle: net.Socket | net.Server): boolean; - emit(event: "online", worker: Worker): boolean; - emit(event: "setup", settings: ClusterSettings): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "disconnect", listener: (worker: Worker) => void): this; - on(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - on(event: "fork", listener: (worker: Worker) => void): this; - on(event: "listening", listener: (worker: Worker, address: Address) => void): this; - on(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - on(event: "online", listener: (worker: Worker) => void): this; - on(event: "setup", listener: (settings: ClusterSettings) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "disconnect", listener: (worker: Worker) => void): this; - once(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - once(event: "fork", listener: (worker: Worker) => void): this; - once(event: "listening", listener: (worker: Worker, address: Address) => void): this; - once(event: "message", listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void): this; // the handle is a net.Socket or net.Server object, or undefined. - once(event: "online", listener: (worker: Worker) => void): this; - once(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependListener(event: "fork", listener: (worker: Worker) => void): this; - prependListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependListener( - event: "message", - listener: (worker: Worker, message: any, handle?: net.Socket | net.Server) => void, - ): this; - prependListener(event: "online", listener: (worker: Worker) => void): this; - prependListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "disconnect", listener: (worker: Worker) => void): this; - prependOnceListener(event: "exit", listener: (worker: Worker, code: number, signal: string) => void): this; - prependOnceListener(event: "fork", listener: (worker: Worker) => void): this; - prependOnceListener(event: "listening", listener: (worker: Worker, address: Address) => void): this; - // the handle is a net.Socket or net.Server object, or undefined. - prependOnceListener( - event: "message", - listener: (worker: Worker, message: any, handle: net.Socket | net.Server) => void, - ): this; - prependOnceListener(event: "online", listener: (worker: Worker) => void): this; - prependOnceListener(event: "setup", listener: (settings: ClusterSettings) => void): this; - } - const cluster: Cluster; - export default cluster; -} -declare module "node:cluster" { - export * from "cluster"; - export { default as default } from "cluster"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/console.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/console.d.ts deleted file mode 100644 index bcc34504..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/console.d.ts +++ /dev/null @@ -1,415 +0,0 @@ -/** - * The `node:console` module provides a simple debugging console that is similar to - * the JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()`, and`console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('node:console')`. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the `note on process I/O` for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/console.js) - */ -declare module "console" { - import console = require("node:console"); - export = console; -} -declare module "node:console" { - import { InspectOptions } from "node:util"; - global { - // This needs to be global to avoid TS2403 in case lib.dom.d.ts is present in the same build - interface Console { - Console: console.ConsoleConstructor; - /** - * `console.assert()` writes a message if `value` is [falsy](https://developer.mozilla.org/en-US/docs/Glossary/Falsy) or omitted. It only - * writes a message and does not otherwise affect execution. The output always - * starts with `"Assertion failed"`. If provided, `message` is formatted using `util.format()`. - * - * If `value` is [truthy](https://developer.mozilla.org/en-US/docs/Glossary/Truthy), nothing happens. - * - * ```js - * console.assert(true, 'does nothing'); - * - * console.assert(false, 'Whoops %s work', 'didn\'t'); - * // Assertion failed: Whoops didn't work - * - * console.assert(); - * // Assertion failed - * ``` - * @since v0.1.101 - * @param value The value tested for being truthy. - * @param message All arguments besides `value` are used as error message. - */ - assert(value: any, message?: string, ...optionalParams: any[]): void; - /** - * When `stdout` is a TTY, calling `console.clear()` will attempt to clear the - * TTY. When `stdout` is not a TTY, this method does nothing. - * - * The specific operation of `console.clear()` can vary across operating systems - * and terminal types. For most Linux operating systems, `console.clear()`operates similarly to the `clear` shell command. On Windows, `console.clear()`will clear only the output in the - * current terminal viewport for the Node.js - * binary. - * @since v8.3.0 - */ - clear(): void; - /** - * Maintains an internal counter specific to `label` and outputs to `stdout` the - * number of times `console.count()` has been called with the given `label`. - * - * ```js - * > console.count() - * default: 1 - * undefined - * > console.count('default') - * default: 2 - * undefined - * > console.count('abc') - * abc: 1 - * undefined - * > console.count('xyz') - * xyz: 1 - * undefined - * > console.count('abc') - * abc: 2 - * undefined - * > console.count() - * default: 3 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - count(label?: string): void; - /** - * Resets the internal counter specific to `label`. - * - * ```js - * > console.count('abc'); - * abc: 1 - * undefined - * > console.countReset('abc'); - * undefined - * > console.count('abc'); - * abc: 1 - * undefined - * > - * ``` - * @since v8.3.0 - * @param [label='default'] The display label for the counter. - */ - countReset(label?: string): void; - /** - * The `console.debug()` function is an alias for {@link log}. - * @since v8.0.0 - */ - debug(message?: any, ...optionalParams: any[]): void; - /** - * Uses `util.inspect()` on `obj` and prints the resulting string to `stdout`. - * This function bypasses any custom `inspect()` function defined on `obj`. - * @since v0.1.101 - */ - dir(obj: any, options?: InspectOptions): void; - /** - * This method calls `console.log()` passing it the arguments received. - * This method does not produce any XML formatting. - * @since v8.0.0 - */ - dirxml(...data: any[]): void; - /** - * Prints to `stderr` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). - * - * ```js - * const code = 5; - * console.error('error #%d', code); - * // Prints: error #5, to stderr - * console.error('error', code); - * // Prints: error 5, to stderr - * ``` - * - * If formatting elements (e.g. `%d`) are not found in the first string then `util.inspect()` is called on each argument and the resulting string - * values are concatenated. See `util.format()` for more information. - * @since v0.1.100 - */ - error(message?: any, ...optionalParams: any[]): void; - /** - * Increases indentation of subsequent lines by spaces for `groupIndentation`length. - * - * If one or more `label`s are provided, those are printed first without the - * additional indentation. - * @since v8.5.0 - */ - group(...label: any[]): void; - /** - * An alias for {@link group}. - * @since v8.5.0 - */ - groupCollapsed(...label: any[]): void; - /** - * Decreases indentation of subsequent lines by spaces for `groupIndentation`length. - * @since v8.5.0 - */ - groupEnd(): void; - /** - * The `console.info()` function is an alias for {@link log}. - * @since v0.1.100 - */ - info(message?: any, ...optionalParams: any[]): void; - /** - * Prints to `stdout` with newline. Multiple arguments can be passed, with the - * first used as the primary message and all additional used as substitution - * values similar to [`printf(3)`](http://man7.org/linux/man-pages/man3/printf.3.html) (the arguments are all passed to `util.format()`). - * - * ```js - * const count = 5; - * console.log('count: %d', count); - * // Prints: count: 5, to stdout - * console.log('count:', count); - * // Prints: count: 5, to stdout - * ``` - * - * See `util.format()` for more information. - * @since v0.1.100 - */ - log(message?: any, ...optionalParams: any[]): void; - /** - * Try to construct a table with the columns of the properties of `tabularData`(or use `properties`) and rows of `tabularData` and log it. Falls back to just - * logging the argument if it can't be parsed as tabular. - * - * ```js - * // These can't be parsed as tabular data - * console.table(Symbol()); - * // Symbol() - * - * console.table(undefined); - * // undefined - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }]); - * // ┌─────────┬─────┬─────┐ - * // │ (index) │ a │ b │ - * // ├─────────┼─────┼─────┤ - * // │ 0 │ 1 │ 'Y' │ - * // │ 1 │ 'Z' │ 2 │ - * // └─────────┴─────┴─────┘ - * - * console.table([{ a: 1, b: 'Y' }, { a: 'Z', b: 2 }], ['a']); - * // ┌─────────┬─────┐ - * // │ (index) │ a │ - * // ├─────────┼─────┤ - * // │ 0 │ 1 │ - * // │ 1 │ 'Z' │ - * // └─────────┴─────┘ - * ``` - * @since v10.0.0 - * @param properties Alternate properties for constructing the table. - */ - table(tabularData: any, properties?: readonly string[]): void; - /** - * Starts a timer that can be used to compute the duration of an operation. Timers - * are identified by a unique `label`. Use the same `label` when calling {@link timeEnd} to stop the timer and output the elapsed time in - * suitable time units to `stdout`. For example, if the elapsed - * time is 3869ms, `console.timeEnd()` displays "3.869s". - * @since v0.1.104 - * @param [label='default'] - */ - time(label?: string): void; - /** - * Stops a timer that was previously started by calling {@link time} and - * prints the result to `stdout`: - * - * ```js - * console.time('bunch-of-stuff'); - * // Do a bunch of stuff. - * console.timeEnd('bunch-of-stuff'); - * // Prints: bunch-of-stuff: 225.438ms - * ``` - * @since v0.1.104 - * @param [label='default'] - */ - timeEnd(label?: string): void; - /** - * For a timer that was previously started by calling {@link time}, prints - * the elapsed time and other `data` arguments to `stdout`: - * - * ```js - * console.time('process'); - * const value = expensiveProcess1(); // Returns 42 - * console.timeLog('process', value); - * // Prints "process: 365.227ms 42". - * doExpensiveProcess2(value); - * console.timeEnd('process'); - * ``` - * @since v10.7.0 - * @param [label='default'] - */ - timeLog(label?: string, ...data: any[]): void; - /** - * Prints to `stderr` the string `'Trace: '`, followed by the `util.format()` formatted message and stack trace to the current position in the code. - * - * ```js - * console.trace('Show me'); - * // Prints: (stack trace will vary based on where trace is called) - * // Trace: Show me - * // at repl:2:9 - * // at REPLServer.defaultEval (repl.js:248:27) - * // at bound (domain.js:287:14) - * // at REPLServer.runBound [as eval] (domain.js:300:12) - * // at REPLServer. (repl.js:412:12) - * // at emitOne (events.js:82:20) - * // at REPLServer.emit (events.js:169:7) - * // at REPLServer.Interface._onLine (readline.js:210:10) - * // at REPLServer.Interface._line (readline.js:549:8) - * // at REPLServer.Interface._ttyWrite (readline.js:826:14) - * ``` - * @since v0.1.104 - */ - trace(message?: any, ...optionalParams: any[]): void; - /** - * The `console.warn()` function is an alias for {@link error}. - * @since v0.1.100 - */ - warn(message?: any, ...optionalParams: any[]): void; - // --- Inspector mode only --- - /** - * This method does not display anything unless used in the inspector. - * Starts a JavaScript CPU profile with an optional label. - */ - profile(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Stops the current JavaScript CPU profiling session if one has been started and prints the report to the Profiles panel of the inspector. - */ - profileEnd(label?: string): void; - /** - * This method does not display anything unless used in the inspector. - * Adds an event with the label `label` to the Timeline panel of the inspector. - */ - timeStamp(label?: string): void; - } - /** - * The `console` module provides a simple debugging console that is similar to the - * JavaScript console mechanism provided by web browsers. - * - * The module exports two specific components: - * - * * A `Console` class with methods such as `console.log()`, `console.error()` and`console.warn()` that can be used to write to any Node.js stream. - * * A global `console` instance configured to write to `process.stdout` and `process.stderr`. The global `console` can be used without calling`require('console')`. - * - * _**Warning**_: The global console object's methods are neither consistently - * synchronous like the browser APIs they resemble, nor are they consistently - * asynchronous like all other Node.js streams. See the `note on process I/O` for - * more information. - * - * Example using the global `console`: - * - * ```js - * console.log('hello world'); - * // Prints: hello world, to stdout - * console.log('hello %s', 'world'); - * // Prints: hello world, to stdout - * console.error(new Error('Whoops, something bad happened')); - * // Prints error message and stack trace to stderr: - * // Error: Whoops, something bad happened - * // at [eval]:5:15 - * // at Script.runInThisContext (node:vm:132:18) - * // at Object.runInThisContext (node:vm:309:38) - * // at node:internal/process/execution:77:19 - * // at [eval]-wrapper:6:22 - * // at evalScript (node:internal/process/execution:76:60) - * // at node:internal/main/eval_string:23:3 - * - * const name = 'Will Robinson'; - * console.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to stderr - * ``` - * - * Example using the `Console` class: - * - * ```js - * const out = getStreamSomehow(); - * const err = getStreamSomehow(); - * const myConsole = new console.Console(out, err); - * - * myConsole.log('hello world'); - * // Prints: hello world, to out - * myConsole.log('hello %s', 'world'); - * // Prints: hello world, to out - * myConsole.error(new Error('Whoops, something bad happened')); - * // Prints: [Error: Whoops, something bad happened], to err - * - * const name = 'Will Robinson'; - * myConsole.warn(`Danger ${name}! Danger!`); - * // Prints: Danger Will Robinson! Danger!, to err - * ``` - * @see [source](https://github.com/nodejs/node/blob/v16.4.2/lib/console.js) - */ - namespace console { - interface ConsoleConstructorOptions { - stdout: NodeJS.WritableStream; - stderr?: NodeJS.WritableStream | undefined; - ignoreErrors?: boolean | undefined; - colorMode?: boolean | "auto" | undefined; - inspectOptions?: InspectOptions | undefined; - /** - * Set group indentation - * @default 2 - */ - groupIndentation?: number | undefined; - } - interface ConsoleConstructor { - prototype: Console; - new(stdout: NodeJS.WritableStream, stderr?: NodeJS.WritableStream, ignoreErrors?: boolean): Console; - new(options: ConsoleConstructorOptions): Console; - } - } - var console: Console; - } - export = globalThis.console; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/constants.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/constants.d.ts deleted file mode 100644 index c3ac2b82..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/constants.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -/** @deprecated since v6.3.0 - use constants property exposed by the relevant module instead. */ -declare module "constants" { - import { constants as osConstants, SignalConstants } from "node:os"; - import { constants as cryptoConstants } from "node:crypto"; - import { constants as fsConstants } from "node:fs"; - - const exp: - & typeof osConstants.errno - & typeof osConstants.priority - & SignalConstants - & typeof cryptoConstants - & typeof fsConstants; - export = exp; -} - -declare module "node:constants" { - import constants = require("constants"); - export = constants; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/crypto.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/crypto.d.ts deleted file mode 100644 index a540d91f..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/crypto.d.ts +++ /dev/null @@ -1,4455 +0,0 @@ -/** - * The `node:crypto` module provides cryptographic functionality that includes a - * set of wrappers for OpenSSL's hash, HMAC, cipher, decipher, sign, and verify - * functions. - * - * ```js - * const { createHmac } = await import('node:crypto'); - * - * const secret = 'abcdefg'; - * const hash = createHmac('sha256', secret) - * .update('I love cupcakes') - * .digest('hex'); - * console.log(hash); - * // Prints: - * // c0fa1bc00531bd78ef38c628449c5102aeabd49b5dc3a2a516ea6ea959d6658e - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/crypto.js) - */ -declare module "crypto" { - import * as stream from "node:stream"; - import { PeerCertificate } from "node:tls"; - /** - * SPKAC is a Certificate Signing Request mechanism originally implemented by - * Netscape and was specified formally as part of HTML5's `keygen` element. - * - * `` is deprecated since [HTML 5.2](https://www.w3.org/TR/html52/changes.html#features-removed) and new projects - * should not use this element anymore. - * - * The `node:crypto` module provides the `Certificate` class for working with SPKAC - * data. The most common usage is handling output generated by the HTML5`` element. Node.js uses [OpenSSL's SPKAC - * implementation](https://www.openssl.org/docs/man3.0/man1/openssl-spkac.html) internally. - * @since v0.11.8 - */ - class Certificate { - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const challenge = Certificate.exportChallenge(spkac); - * console.log(challenge.toString('utf8')); - * // Prints: the challenge as a UTF8 string - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The challenge component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportChallenge(spkac: BinaryLike): Buffer; - /** - * ```js - * const { Certificate } = await import('node:crypto'); - * const spkac = getSpkacSomehow(); - * const publicKey = Certificate.exportPublicKey(spkac); - * console.log(publicKey); - * // Prints: the public key as - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return The public key component of the `spkac` data structure, which includes a public key and a challenge. - */ - static exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; - /** - * ```js - * import { Buffer } from 'node:buffer'; - * const { Certificate } = await import('node:crypto'); - * - * const spkac = getSpkacSomehow(); - * console.log(Certificate.verifySpkac(Buffer.from(spkac))); - * // Prints: true or false - * ``` - * @since v9.0.0 - * @param encoding The `encoding` of the `spkac` string. - * @return `true` if the given `spkac` data structure is valid, `false` otherwise. - */ - static verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - /** - * @deprecated - * @param spkac - * @returns The challenge component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportChallenge(spkac: BinaryLike): Buffer; - /** - * @deprecated - * @param spkac - * @param encoding The encoding of the spkac string. - * @returns The public key component of the `spkac` data structure, - * which includes a public key and a challenge. - */ - exportPublicKey(spkac: BinaryLike, encoding?: string): Buffer; - /** - * @deprecated - * @param spkac - * @returns `true` if the given `spkac` data structure is valid, - * `false` otherwise. - */ - verifySpkac(spkac: NodeJS.ArrayBufferView): boolean; - } - namespace constants { - // https://nodejs.org/dist/latest-v20.x/docs/api/crypto.html#crypto-constants - const OPENSSL_VERSION_NUMBER: number; - /** Applies multiple bug workarounds within OpenSSL. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html for detail. */ - const SSL_OP_ALL: number; - /** Allows legacy insecure renegotiation between OpenSSL and unpatched clients or servers. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_ALLOW_UNSAFE_LEGACY_RENEGOTIATION: number; - /** Attempts to use the server's preferences instead of the client's when selecting a cipher. See https://www.openssl.org/docs/man1.0.2/ssl/SSL_CTX_set_options.html. */ - const SSL_OP_CIPHER_SERVER_PREFERENCE: number; - /** Instructs OpenSSL to use Cisco's "speshul" version of DTLS_BAD_VER. */ - const SSL_OP_CISCO_ANYCONNECT: number; - /** Instructs OpenSSL to turn on cookie exchange. */ - const SSL_OP_COOKIE_EXCHANGE: number; - /** Instructs OpenSSL to add server-hello extension from an early version of the cryptopro draft. */ - const SSL_OP_CRYPTOPRO_TLSEXT_BUG: number; - /** Instructs OpenSSL to disable a SSL 3.0/TLS 1.0 vulnerability workaround added in OpenSSL 0.9.6d. */ - const SSL_OP_DONT_INSERT_EMPTY_FRAGMENTS: number; - /** Allows initial connection to servers that do not support RI. */ - const SSL_OP_LEGACY_SERVER_CONNECT: number; - /** Instructs OpenSSL to disable support for SSL/TLS compression. */ - const SSL_OP_NO_COMPRESSION: number; - const SSL_OP_NO_QUERY_MTU: number; - /** Instructs OpenSSL to always start a new session when performing renegotiation. */ - const SSL_OP_NO_SESSION_RESUMPTION_ON_RENEGOTIATION: number; - const SSL_OP_NO_SSLv2: number; - const SSL_OP_NO_SSLv3: number; - const SSL_OP_NO_TICKET: number; - const SSL_OP_NO_TLSv1: number; - const SSL_OP_NO_TLSv1_1: number; - const SSL_OP_NO_TLSv1_2: number; - /** Instructs OpenSSL to disable version rollback attack detection. */ - const SSL_OP_TLS_ROLLBACK_BUG: number; - const ENGINE_METHOD_RSA: number; - const ENGINE_METHOD_DSA: number; - const ENGINE_METHOD_DH: number; - const ENGINE_METHOD_RAND: number; - const ENGINE_METHOD_EC: number; - const ENGINE_METHOD_CIPHERS: number; - const ENGINE_METHOD_DIGESTS: number; - const ENGINE_METHOD_PKEY_METHS: number; - const ENGINE_METHOD_PKEY_ASN1_METHS: number; - const ENGINE_METHOD_ALL: number; - const ENGINE_METHOD_NONE: number; - const DH_CHECK_P_NOT_SAFE_PRIME: number; - const DH_CHECK_P_NOT_PRIME: number; - const DH_UNABLE_TO_CHECK_GENERATOR: number; - const DH_NOT_SUITABLE_GENERATOR: number; - const RSA_PKCS1_PADDING: number; - const RSA_SSLV23_PADDING: number; - const RSA_NO_PADDING: number; - const RSA_PKCS1_OAEP_PADDING: number; - const RSA_X931_PADDING: number; - const RSA_PKCS1_PSS_PADDING: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the digest size when signing or verifying. */ - const RSA_PSS_SALTLEN_DIGEST: number; - /** Sets the salt length for RSA_PKCS1_PSS_PADDING to the maximum permissible value when signing data. */ - const RSA_PSS_SALTLEN_MAX_SIGN: number; - /** Causes the salt length for RSA_PKCS1_PSS_PADDING to be determined automatically when verifying a signature. */ - const RSA_PSS_SALTLEN_AUTO: number; - const POINT_CONVERSION_COMPRESSED: number; - const POINT_CONVERSION_UNCOMPRESSED: number; - const POINT_CONVERSION_HYBRID: number; - /** Specifies the built-in default cipher list used by Node.js (colon-separated values). */ - const defaultCoreCipherList: string; - /** Specifies the active default cipher list used by the current Node.js process (colon-separated values). */ - const defaultCipherList: string; - } - interface HashOptions extends stream.TransformOptions { - /** - * For XOF hash functions such as `shake256`, the - * outputLength option can be used to specify the desired output length in bytes. - */ - outputLength?: number | undefined; - } - /** @deprecated since v10.0.0 */ - const fips: boolean; - /** - * Creates and returns a `Hash` object that can be used to generate hash digests - * using the given `algorithm`. Optional `options` argument controls stream - * behavior. For XOF hash functions such as `'shake256'`, the `outputLength` option - * can be used to specify the desired output length in bytes. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * Example: generating the sha256 sum of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHash, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hash = createHash('sha256'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hash.update(data); - * else { - * console.log(`${hash.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.92 - * @param options `stream.transform` options - */ - function createHash(algorithm: string, options?: HashOptions): Hash; - /** - * Creates and returns an `Hmac` object that uses the given `algorithm` and `key`. - * Optional `options` argument controls stream behavior. - * - * The `algorithm` is dependent on the available algorithms supported by the - * version of OpenSSL on the platform. Examples are `'sha256'`, `'sha512'`, etc. - * On recent releases of OpenSSL, `openssl list -digest-algorithms` will - * display the available digest algorithms. - * - * The `key` is the HMAC key used to generate the cryptographic HMAC hash. If it is - * a `KeyObject`, its type must be `secret`. If it is a string, please consider `caveats when using strings as inputs to cryptographic APIs`. If it was - * obtained from a cryptographically secure source of entropy, such as {@link randomBytes} or {@link generateKey}, its length should not - * exceed the block size of `algorithm` (e.g., 512 bits for SHA-256). - * - * Example: generating the sha256 HMAC of a file - * - * ```js - * import { - * createReadStream, - * } from 'node:fs'; - * import { argv } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const filename = argv[2]; - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream(filename); - * input.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = input.read(); - * if (data) - * hmac.update(data); - * else { - * console.log(`${hmac.digest('hex')} ${filename}`); - * } - * }); - * ``` - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createHmac(algorithm: string, key: BinaryLike | KeyObject, options?: stream.TransformOptions): Hmac; - // https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings - type BinaryToTextEncoding = "base64" | "base64url" | "hex" | "binary"; - type CharacterEncoding = "utf8" | "utf-8" | "utf16le" | "utf-16le" | "latin1"; - type LegacyCharacterEncoding = "ascii" | "binary" | "ucs2" | "ucs-2"; - type Encoding = BinaryToTextEncoding | CharacterEncoding | LegacyCharacterEncoding; - type ECDHKeyFormat = "compressed" | "uncompressed" | "hybrid"; - /** - * The `Hash` class is a utility for creating hash digests of data. It can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed hash digest on the readable side, or - * * Using the `hash.update()` and `hash.digest()` methods to produce the - * computed hash. - * - * The {@link createHash} method is used to create `Hash` instances. `Hash`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hash` objects as streams: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hash.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * } - * }); - * - * hash.write('some data to hash'); - * hash.end(); - * ``` - * - * Example: Using `Hash` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { createHash } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * const input = createReadStream('test.js'); - * input.pipe(hash).setEncoding('hex').pipe(stdout); - * ``` - * - * Example: Using the `hash.update()` and `hash.digest()` methods: - * - * ```js - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('some data to hash'); - * console.log(hash.digest('hex')); - * // Prints: - * // 6a2da20943931e9834fc12cfe5bb47bbd9ae43489a30726962b576f4e3993e50 - * ``` - * @since v0.1.92 - */ - class Hash extends stream.Transform { - private constructor(); - /** - * Creates a new `Hash` object that contains a deep copy of the internal state - * of the current `Hash` object. - * - * The optional `options` argument controls stream behavior. For XOF hash - * functions such as `'shake256'`, the `outputLength` option can be used to - * specify the desired output length in bytes. - * - * An error is thrown when an attempt is made to copy the `Hash` object after - * its `hash.digest()` method has been called. - * - * ```js - * // Calculate a rolling hash. - * const { - * createHash, - * } = await import('node:crypto'); - * - * const hash = createHash('sha256'); - * - * hash.update('one'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('two'); - * console.log(hash.copy().digest('hex')); - * - * hash.update('three'); - * console.log(hash.copy().digest('hex')); - * - * // Etc. - * ``` - * @since v13.1.0 - * @param options `stream.transform` options - */ - copy(options?: stream.TransformOptions): Hash; - /** - * Updates the hash content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hash; - update(data: string, inputEncoding: Encoding): Hash; - /** - * Calculates the digest of all of the data passed to be hashed (using the `hash.update()` method). - * If `encoding` is provided a string will be returned; otherwise - * a `Buffer` is returned. - * - * The `Hash` object can not be used again after `hash.digest()` method has been - * called. Multiple calls will cause an error to be thrown. - * @since v0.1.92 - * @param encoding The `encoding` of the return value. - */ - digest(): Buffer; - digest(encoding: BinaryToTextEncoding): string; - } - /** - * The `Hmac` class is a utility for creating cryptographic HMAC digests. It can - * be used in one of two ways: - * - * * As a `stream` that is both readable and writable, where data is written - * to produce a computed HMAC digest on the readable side, or - * * Using the `hmac.update()` and `hmac.digest()` methods to produce the - * computed HMAC digest. - * - * The {@link createHmac} method is used to create `Hmac` instances. `Hmac`objects are not to be created directly using the `new` keyword. - * - * Example: Using `Hmac` objects as streams: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.on('readable', () => { - * // Only one element is going to be produced by the - * // hash stream. - * const data = hmac.read(); - * if (data) { - * console.log(data.toString('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * } - * }); - * - * hmac.write('some data to hash'); - * hmac.end(); - * ``` - * - * Example: Using `Hmac` and piped streams: - * - * ```js - * import { createReadStream } from 'node:fs'; - * import { stdout } from 'node:process'; - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * const input = createReadStream('test.js'); - * input.pipe(hmac).pipe(stdout); - * ``` - * - * Example: Using the `hmac.update()` and `hmac.digest()` methods: - * - * ```js - * const { - * createHmac, - * } = await import('node:crypto'); - * - * const hmac = createHmac('sha256', 'a secret'); - * - * hmac.update('some data to hash'); - * console.log(hmac.digest('hex')); - * // Prints: - * // 7fd04df92f636fd450bc841c9418e5825c17f33ad9c87c518115a45971f7f77e - * ``` - * @since v0.1.94 - */ - class Hmac extends stream.Transform { - private constructor(); - /** - * Updates the `Hmac` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Hmac; - update(data: string, inputEncoding: Encoding): Hmac; - /** - * Calculates the HMAC digest of all of the data passed using `hmac.update()`. - * If `encoding` is - * provided a string is returned; otherwise a `Buffer` is returned; - * - * The `Hmac` object can not be used again after `hmac.digest()` has been - * called. Multiple calls to `hmac.digest()` will result in an error being thrown. - * @since v0.1.94 - * @param encoding The `encoding` of the return value. - */ - digest(): Buffer; - digest(encoding: BinaryToTextEncoding): string; - } - type KeyObjectType = "secret" | "public" | "private"; - interface KeyExportOptions { - type: "pkcs1" | "spki" | "pkcs8" | "sec1"; - format: T; - cipher?: string | undefined; - passphrase?: string | Buffer | undefined; - } - interface JwkKeyExportOptions { - format: "jwk"; - } - interface JsonWebKey { - crv?: string | undefined; - d?: string | undefined; - dp?: string | undefined; - dq?: string | undefined; - e?: string | undefined; - k?: string | undefined; - kty?: string | undefined; - n?: string | undefined; - p?: string | undefined; - q?: string | undefined; - qi?: string | undefined; - x?: string | undefined; - y?: string | undefined; - [key: string]: unknown; - } - interface AsymmetricKeyDetails { - /** - * Key size in bits (RSA, DSA). - */ - modulusLength?: number | undefined; - /** - * Public exponent (RSA). - */ - publicExponent?: bigint | undefined; - /** - * Name of the message digest (RSA-PSS). - */ - hashAlgorithm?: string | undefined; - /** - * Name of the message digest used by MGF1 (RSA-PSS). - */ - mgf1HashAlgorithm?: string | undefined; - /** - * Minimal salt length in bytes (RSA-PSS). - */ - saltLength?: number | undefined; - /** - * Size of q in bits (DSA). - */ - divisorLength?: number | undefined; - /** - * Name of the curve (EC). - */ - namedCurve?: string | undefined; - } - /** - * Node.js uses a `KeyObject` class to represent a symmetric or asymmetric key, - * and each kind of key exposes different functions. The {@link createSecretKey}, {@link createPublicKey} and {@link createPrivateKey} methods are used to create `KeyObject`instances. `KeyObject` - * objects are not to be created directly using the `new`keyword. - * - * Most applications should consider using the new `KeyObject` API instead of - * passing keys as strings or `Buffer`s due to improved security features. - * - * `KeyObject` instances can be passed to other threads via `postMessage()`. - * The receiver obtains a cloned `KeyObject`, and the `KeyObject` does not need to - * be listed in the `transferList` argument. - * @since v11.6.0 - */ - class KeyObject { - private constructor(); - /** - * Example: Converting a `CryptoKey` instance to a `KeyObject`: - * - * ```js - * const { KeyObject } = await import('node:crypto'); - * const { subtle } = globalThis.crypto; - * - * const key = await subtle.generateKey({ - * name: 'HMAC', - * hash: 'SHA-256', - * length: 256, - * }, true, ['sign', 'verify']); - * - * const keyObject = KeyObject.from(key); - * console.log(keyObject.symmetricKeySize); - * // Prints: 32 (symmetric key size in bytes) - * ``` - * @since v15.0.0 - */ - static from(key: webcrypto.CryptoKey): KeyObject; - /** - * For asymmetric keys, this property represents the type of the key. Supported key - * types are: - * - * * `'rsa'` (OID 1.2.840.113549.1.1.1) - * * `'rsa-pss'` (OID 1.2.840.113549.1.1.10) - * * `'dsa'` (OID 1.2.840.10040.4.1) - * * `'ec'` (OID 1.2.840.10045.2.1) - * * `'x25519'` (OID 1.3.101.110) - * * `'x448'` (OID 1.3.101.111) - * * `'ed25519'` (OID 1.3.101.112) - * * `'ed448'` (OID 1.3.101.113) - * * `'dh'` (OID 1.2.840.113549.1.3.1) - * - * This property is `undefined` for unrecognized `KeyObject` types and symmetric - * keys. - * @since v11.6.0 - */ - asymmetricKeyType?: KeyType | undefined; - /** - * For asymmetric keys, this property represents the size of the embedded key in - * bytes. This property is `undefined` for symmetric keys. - */ - asymmetricKeySize?: number | undefined; - /** - * This property exists only on asymmetric keys. Depending on the type of the key, - * this object contains information about the key. None of the information obtained - * through this property can be used to uniquely identify a key or to compromise - * the security of the key. - * - * For RSA-PSS keys, if the key material contains a `RSASSA-PSS-params` sequence, - * the `hashAlgorithm`, `mgf1HashAlgorithm`, and `saltLength` properties will be - * set. - * - * Other key details might be exposed via this API using additional attributes. - * @since v15.7.0 - */ - asymmetricKeyDetails?: AsymmetricKeyDetails | undefined; - /** - * For symmetric keys, the following encoding options can be used: - * - * For public keys, the following encoding options can be used: - * - * For private keys, the following encoding options can be used: - * - * The result type depends on the selected encoding format, when PEM the - * result is a string, when DER it will be a buffer containing the data - * encoded as DER, when [JWK](https://tools.ietf.org/html/rfc7517) it will be an object. - * - * When [JWK](https://tools.ietf.org/html/rfc7517) encoding format was selected, all other encoding options are - * ignored. - * - * PKCS#1, SEC1, and PKCS#8 type keys can be encrypted by using a combination of - * the `cipher` and `format` options. The PKCS#8 `type` can be used with any`format` to encrypt any key algorithm (RSA, EC, or DH) by specifying a`cipher`. PKCS#1 and SEC1 can only be - * encrypted by specifying a `cipher`when the PEM `format` is used. For maximum compatibility, use PKCS#8 for - * encrypted private keys. Since PKCS#8 defines its own - * encryption mechanism, PEM-level encryption is not supported when encrypting - * a PKCS#8 key. See [RFC 5208](https://www.rfc-editor.org/rfc/rfc5208.txt) for PKCS#8 encryption and [RFC 1421](https://www.rfc-editor.org/rfc/rfc1421.txt) for - * PKCS#1 and SEC1 encryption. - * @since v11.6.0 - */ - export(options: KeyExportOptions<"pem">): string | Buffer; - export(options?: KeyExportOptions<"der">): Buffer; - export(options?: JwkKeyExportOptions): JsonWebKey; - /** - * For secret keys, this property represents the size of the key in bytes. This - * property is `undefined` for asymmetric keys. - * @since v11.6.0 - */ - symmetricKeySize?: number | undefined; - /** - * Depending on the type of this `KeyObject`, this property is either`'secret'` for secret (symmetric) keys, `'public'` for public (asymmetric) keys - * or `'private'` for private (asymmetric) keys. - * @since v11.6.0 - */ - type: KeyObjectType; - } - type CipherCCMTypes = "aes-128-ccm" | "aes-192-ccm" | "aes-256-ccm" | "chacha20-poly1305"; - type CipherGCMTypes = "aes-128-gcm" | "aes-192-gcm" | "aes-256-gcm"; - type CipherOCBTypes = "aes-128-ocb" | "aes-192-ocb" | "aes-256-ocb"; - type BinaryLike = string | NodeJS.ArrayBufferView; - type CipherKey = BinaryLike | KeyObject; - interface CipherCCMOptions extends stream.TransformOptions { - authTagLength: number; - } - interface CipherGCMOptions extends stream.TransformOptions { - authTagLength?: number | undefined; - } - interface CipherOCBOptions extends stream.TransformOptions { - authTagLength: number; - } - /** - * Creates and returns a `Cipher` object that uses the given `algorithm` and`password`. - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication - * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `password` is used to derive the cipher key and initialization vector (IV). - * The value must be either a `'latin1'` encoded string, a `Buffer`, a`TypedArray`, or a `DataView`. - * - * **This function is semantically insecure for all** - * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** - * **GCM, or CCM).** - * - * The implementation of `crypto.createCipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one - * iteration, and no salt. The lack of salt allows dictionary attacks as the same - * password always creates the same key. The low iteration count and - * non-cryptographically secure hash algorithm allow passwords to be tested very - * rapidly. - * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that - * developers derive a key and IV on - * their own using {@link scrypt} and to use {@link createCipheriv} to create the `Cipher` object. Users should not use ciphers with counter mode - * (e.g. CTR, GCM, or CCM) in `crypto.createCipher()`. A warning is emitted when - * they are used in order to avoid the risk of IV reuse that causes - * vulnerabilities. For the case when IV is reused in GCM, see [Nonce-Disrespecting Adversaries](https://github.com/nonce-disrespect/nonce-disrespect) for details. - * @since v0.1.94 - * @deprecated Since v10.0.0 - Use {@link createCipheriv} instead. - * @param options `stream.transform` options - */ - function createCipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): CipherCCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): CipherGCM; - /** @deprecated since v10.0.0 use `createCipheriv()` */ - function createCipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Cipher; - /** - * Creates and returns a `Cipher` object, with the given `algorithm`, `key` and - * initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to set the length of the authentication - * tag that will be returned by `getAuthTag()` and defaults to 16 bytes. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a - * given IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createCipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): CipherCCM; - function createCipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): CipherOCB; - function createCipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): CipherGCM; - function createCipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Cipher; - /** - * Instances of the `Cipher` class are used to encrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain unencrypted - * data is written to produce encrypted data on the readable side, or - * * Using the `cipher.update()` and `cipher.final()` methods to produce - * the encrypted data. - * - * The {@link createCipher} or {@link createCipheriv} methods are - * used to create `Cipher` instances. `Cipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Cipher` objects as streams: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * // Once we have the key and iv, we can create and use the cipher... - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = ''; - * cipher.setEncoding('hex'); - * - * cipher.on('data', (chunk) => encrypted += chunk); - * cipher.on('end', () => console.log(encrypted)); - * - * cipher.write('some clear text data'); - * cipher.end(); - * }); - * }); - * ``` - * - * Example: Using `Cipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * - * import { - * pipeline, - * } from 'node:stream'; - * - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.js'); - * const output = createWriteStream('test.enc'); - * - * pipeline(input, cipher, output, (err) => { - * if (err) throw err; - * }); - * }); - * }); - * ``` - * - * Example: Using the `cipher.update()` and `cipher.final()` methods: - * - * ```js - * const { - * scrypt, - * randomFill, - * createCipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * - * // First, we'll generate the key. The key length is dependent on the algorithm. - * // In this case for aes192, it is 24 bytes (192 bits). - * scrypt(password, 'salt', 24, (err, key) => { - * if (err) throw err; - * // Then, we'll generate a random initialization vector - * randomFill(new Uint8Array(16), (err, iv) => { - * if (err) throw err; - * - * const cipher = createCipheriv(algorithm, key, iv); - * - * let encrypted = cipher.update('some clear text data', 'utf8', 'hex'); - * encrypted += cipher.final('hex'); - * console.log(encrypted); - * }); - * }); - * ``` - * @since v0.1.94 - */ - class Cipher extends stream.Transform { - private constructor(); - /** - * Updates the cipher with `data`. If the `inputEncoding` argument is given, - * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`, `TypedArray`, or`DataView`. If `data` is a `Buffer`, - * `TypedArray`, or `DataView`, then`inputEncoding` is ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. - * - * The `cipher.update()` method can be called multiple times with new data until `cipher.final()` is called. Calling `cipher.update()` after `cipher.final()` will result in an error being - * thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the data. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: BinaryLike): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `cipher.final()` method has been called, the `Cipher` object can no - * longer be used to encrypt data. Attempts to call `cipher.final()` more than - * once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining enciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): Buffer; - final(outputEncoding: BufferEncoding): string; - /** - * When using block encryption algorithms, the `Cipher` class will automatically - * add padding to the input data to the appropriate block size. To disable the - * default padding call `cipher.setAutoPadding(false)`. - * - * When `autoPadding` is `false`, the length of the entire input data must be a - * multiple of the cipher's block size or `cipher.final()` will throw an error. - * Disabling automatic padding is useful for non-standard padding, for instance - * using `0x0` instead of PKCS padding. - * - * The `cipher.setAutoPadding()` method must be called before `cipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(autoPadding?: boolean): this; - } - interface CipherCCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - interface CipherGCM extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - interface CipherOCB extends Cipher { - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - getAuthTag(): Buffer; - } - /** - * Creates and returns a `Decipher` object that uses the given `algorithm` and`password` (key). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * **This function is semantically insecure for all** - * **supported ciphers and fatally flawed for ciphers in counter mode (such as CTR,** - * **GCM, or CCM).** - * - * The implementation of `crypto.createDecipher()` derives keys using the OpenSSL - * function [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) with the digest algorithm set to MD5, one - * iteration, and no salt. The lack of salt allows dictionary attacks as the same - * password always creates the same key. The low iteration count and - * non-cryptographically secure hash algorithm allow passwords to be tested very - * rapidly. - * - * In line with OpenSSL's recommendation to use a more modern algorithm instead of [`EVP_BytesToKey`](https://www.openssl.org/docs/man3.0/man3/EVP_BytesToKey.html) it is recommended that - * developers derive a key and IV on - * their own using {@link scrypt} and to use {@link createDecipheriv} to create the `Decipher` object. - * @since v0.1.94 - * @deprecated Since v10.0.0 - Use {@link createDecipheriv} instead. - * @param options `stream.transform` options - */ - function createDecipher(algorithm: CipherCCMTypes, password: BinaryLike, options: CipherCCMOptions): DecipherCCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: CipherGCMTypes, password: BinaryLike, options?: CipherGCMOptions): DecipherGCM; - /** @deprecated since v10.0.0 use `createDecipheriv()` */ - function createDecipher(algorithm: string, password: BinaryLike, options?: stream.TransformOptions): Decipher; - /** - * Creates and returns a `Decipher` object that uses the given `algorithm`, `key`and initialization vector (`iv`). - * - * The `options` argument controls stream behavior and is optional except when a - * cipher in CCM or OCB mode (e.g. `'aes-128-ccm'`) is used. In that case, the`authTagLength` option is required and specifies the length of the - * authentication tag in bytes, see `CCM mode`. In GCM mode, the `authTagLength`option is not required but can be used to restrict accepted authentication tags - * to those with the specified length. - * For `chacha20-poly1305`, the `authTagLength` option defaults to 16 bytes. - * - * The `algorithm` is dependent on OpenSSL, examples are `'aes192'`, etc. On - * recent OpenSSL releases, `openssl list -cipher-algorithms` will - * display the available cipher algorithms. - * - * The `key` is the raw key used by the `algorithm` and `iv` is an [initialization vector](https://en.wikipedia.org/wiki/Initialization_vector). Both arguments must be `'utf8'` encoded - * strings,`Buffers`, `TypedArray`, or `DataView`s. The `key` may optionally be - * a `KeyObject` of type `secret`. If the cipher does not need - * an initialization vector, `iv` may be `null`. - * - * When passing strings for `key` or `iv`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * Initialization vectors should be unpredictable and unique; ideally, they will be - * cryptographically random. They do not have to be secret: IVs are typically just - * added to ciphertext messages unencrypted. It may sound contradictory that - * something has to be unpredictable and unique, but does not have to be secret; - * remember that an attacker must not be able to predict ahead of time what a given - * IV will be. - * @since v0.1.94 - * @param options `stream.transform` options - */ - function createDecipheriv( - algorithm: CipherCCMTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherCCMOptions, - ): DecipherCCM; - function createDecipheriv( - algorithm: CipherOCBTypes, - key: CipherKey, - iv: BinaryLike, - options: CipherOCBOptions, - ): DecipherOCB; - function createDecipheriv( - algorithm: CipherGCMTypes, - key: CipherKey, - iv: BinaryLike, - options?: CipherGCMOptions, - ): DecipherGCM; - function createDecipheriv( - algorithm: string, - key: CipherKey, - iv: BinaryLike | null, - options?: stream.TransformOptions, - ): Decipher; - /** - * Instances of the `Decipher` class are used to decrypt data. The class can be - * used in one of two ways: - * - * * As a `stream` that is both readable and writable, where plain encrypted - * data is written to produce unencrypted data on the readable side, or - * * Using the `decipher.update()` and `decipher.final()` methods to - * produce the unencrypted data. - * - * The {@link createDecipher} or {@link createDecipheriv} methods are - * used to create `Decipher` instances. `Decipher` objects are not to be created - * directly using the `new` keyword. - * - * Example: Using `Decipher` objects as streams: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Key length is dependent on the algorithm. In this case for aes192, it is - * // 24 bytes (192 bits). - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * let decrypted = ''; - * decipher.on('readable', () => { - * let chunk; - * while (null !== (chunk = decipher.read())) { - * decrypted += chunk.toString('utf8'); - * } - * }); - * decipher.on('end', () => { - * console.log(decrypted); - * // Prints: some clear text data - * }); - * - * // Encrypted with same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * decipher.write(encrypted, 'hex'); - * decipher.end(); - * ``` - * - * Example: Using `Decipher` and piped streams: - * - * ```js - * import { - * createReadStream, - * createWriteStream, - * } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * const input = createReadStream('test.enc'); - * const output = createWriteStream('test.js'); - * - * input.pipe(decipher).pipe(output); - * ``` - * - * Example: Using the `decipher.update()` and `decipher.final()` methods: - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * scryptSync, - * createDecipheriv, - * } = await import('node:crypto'); - * - * const algorithm = 'aes-192-cbc'; - * const password = 'Password used to generate key'; - * // Use the async `crypto.scrypt()` instead. - * const key = scryptSync(password, 'salt', 24); - * // The IV is usually passed along with the ciphertext. - * const iv = Buffer.alloc(16, 0); // Initialization vector. - * - * const decipher = createDecipheriv(algorithm, key, iv); - * - * // Encrypted using same algorithm, key and iv. - * const encrypted = - * 'e5f79c5915c02171eec6b212d5520d44480993d7d622a7c4c2da32f6efda0ffa'; - * let decrypted = decipher.update(encrypted, 'hex', 'utf8'); - * decrypted += decipher.final('utf8'); - * console.log(decrypted); - * // Prints: some clear text data - * ``` - * @since v0.1.94 - */ - class Decipher extends stream.Transform { - private constructor(); - /** - * Updates the decipher with `data`. If the `inputEncoding` argument is given, - * the `data`argument is a string using the specified encoding. If the `inputEncoding`argument is not given, `data` must be a `Buffer`. If `data` is a `Buffer` then `inputEncoding` is - * ignored. - * - * The `outputEncoding` specifies the output format of the enciphered - * data. If the `outputEncoding`is specified, a string using the specified encoding is returned. If no`outputEncoding` is provided, a `Buffer` is returned. - * - * The `decipher.update()` method can be called multiple times with new data until `decipher.final()` is called. Calling `decipher.update()` after `decipher.final()` will result in an error - * being thrown. - * @since v0.1.94 - * @param inputEncoding The `encoding` of the `data` string. - * @param outputEncoding The `encoding` of the return value. - */ - update(data: NodeJS.ArrayBufferView): Buffer; - update(data: string, inputEncoding: Encoding): Buffer; - update(data: NodeJS.ArrayBufferView, inputEncoding: undefined, outputEncoding: Encoding): string; - update(data: string, inputEncoding: Encoding | undefined, outputEncoding: Encoding): string; - /** - * Once the `decipher.final()` method has been called, the `Decipher` object can - * no longer be used to decrypt data. Attempts to call `decipher.final()` more - * than once will result in an error being thrown. - * @since v0.1.94 - * @param outputEncoding The `encoding` of the return value. - * @return Any remaining deciphered contents. If `outputEncoding` is specified, a string is returned. If an `outputEncoding` is not provided, a {@link Buffer} is returned. - */ - final(): Buffer; - final(outputEncoding: BufferEncoding): string; - /** - * When data has been encrypted without standard block padding, calling`decipher.setAutoPadding(false)` will disable automatic padding to prevent `decipher.final()` from checking for and - * removing padding. - * - * Turning auto padding off will only work if the input data's length is a - * multiple of the ciphers block size. - * - * The `decipher.setAutoPadding()` method must be called before `decipher.final()`. - * @since v0.7.1 - * @param [autoPadding=true] - * @return for method chaining. - */ - setAutoPadding(auto_padding?: boolean): this; - } - interface DecipherCCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options: { - plaintextLength: number; - }, - ): this; - } - interface DecipherGCM extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface DecipherOCB extends Decipher { - setAuthTag(buffer: NodeJS.ArrayBufferView): this; - setAAD( - buffer: NodeJS.ArrayBufferView, - options?: { - plaintextLength: number; - }, - ): this; - } - interface PrivateKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "pkcs8" | "sec1" | undefined; - passphrase?: string | Buffer | undefined; - encoding?: string | undefined; - } - interface PublicKeyInput { - key: string | Buffer; - format?: KeyFormat | undefined; - type?: "pkcs1" | "spki" | undefined; - encoding?: string | undefined; - } - /** - * Asynchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKey, - * } = await import('node:crypto'); - * - * generateKey('hmac', { length: 512 }, (err, key) => { - * if (err) throw err; - * console.log(key.export().toString('hex')); // 46e..........620 - * }); - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKey( - type: "hmac" | "aes", - options: { - length: number; - }, - callback: (err: Error | null, key: KeyObject) => void, - ): void; - /** - * Synchronously generates a new random secret key of the given `length`. The`type` will determine which validations will be performed on the `length`. - * - * ```js - * const { - * generateKeySync, - * } = await import('node:crypto'); - * - * const key = generateKeySync('hmac', { length: 512 }); - * console.log(key.export().toString('hex')); // e89..........41e - * ``` - * - * The size of a generated HMAC key should not exceed the block size of the - * underlying hash function. See {@link createHmac} for more information. - * @since v15.0.0 - * @param type The intended use of the generated secret key. Currently accepted values are `'hmac'` and `'aes'`. - */ - function generateKeySync( - type: "hmac" | "aes", - options: { - length: number; - }, - ): KeyObject; - interface JsonWebKeyInput { - key: JsonWebKey; - format: "jwk"; - } - /** - * Creates and returns a new key object containing a private key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; otherwise, `key`must be an object with the properties described above. - * - * If the private key is encrypted, a `passphrase` must be specified. The length - * of the passphrase is limited to 1024 bytes. - * @since v11.6.0 - */ - function createPrivateKey(key: PrivateKeyInput | string | Buffer | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a public key. If `key` is a - * string or `Buffer`, `format` is assumed to be `'pem'`; if `key` is a `KeyObject`with type `'private'`, the public key is derived from the given private key; - * otherwise, `key` must be an object with the properties described above. - * - * If the format is `'pem'`, the `'key'` may also be an X.509 certificate. - * - * Because public keys can be derived from private keys, a private key may be - * passed instead of a public key. In that case, this function behaves as if {@link createPrivateKey} had been called, except that the type of the - * returned `KeyObject` will be `'public'` and that the private key cannot be - * extracted from the returned `KeyObject`. Similarly, if a `KeyObject` with type`'private'` is given, a new `KeyObject` with type `'public'` will be returned - * and it will be impossible to extract the private key from the returned object. - * @since v11.6.0 - */ - function createPublicKey(key: PublicKeyInput | string | Buffer | KeyObject | JsonWebKeyInput): KeyObject; - /** - * Creates and returns a new key object containing a secret key for symmetric - * encryption or `Hmac`. - * @since v11.6.0 - * @param encoding The string encoding when `key` is a string. - */ - function createSecretKey(key: NodeJS.ArrayBufferView): KeyObject; - function createSecretKey(key: string, encoding: BufferEncoding): KeyObject; - /** - * Creates and returns a `Sign` object that uses the given `algorithm`. Use {@link getHashes} to obtain the names of the available digest algorithms. - * Optional `options` argument controls the `stream.Writable` behavior. - * - * In some cases, a `Sign` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createSign(algorithm: string, options?: stream.WritableOptions): Sign; - type DSAEncoding = "der" | "ieee-p1363"; - interface SigningOptions { - /** - * @see crypto.constants.RSA_PKCS1_PADDING - */ - padding?: number | undefined; - saltLength?: number | undefined; - dsaEncoding?: DSAEncoding | undefined; - } - interface SignPrivateKeyInput extends PrivateKeyInput, SigningOptions {} - interface SignKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyPublicKeyInput extends PublicKeyInput, SigningOptions {} - interface VerifyKeyObjectInput extends SigningOptions { - key: KeyObject; - } - interface VerifyJsonWebKeyInput extends JsonWebKeyInput, SigningOptions {} - type KeyLike = string | Buffer | KeyObject; - /** - * The `Sign` class is a utility for generating signatures. It can be used in one - * of two ways: - * - * * As a writable `stream`, where data to be signed is written and the `sign.sign()` method is used to generate and return the signature, or - * * Using the `sign.update()` and `sign.sign()` methods to produce the - * signature. - * - * The {@link createSign} method is used to create `Sign` instances. The - * argument is the string name of the hash function to use. `Sign` objects are not - * to be created directly using the `new` keyword. - * - * Example: Using `Sign` and `Verify` objects as streams: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('ec', { - * namedCurve: 'sect239k1', - * }); - * - * const sign = createSign('SHA256'); - * sign.write('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey, 'hex'); - * - * const verify = createVerify('SHA256'); - * verify.write('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature, 'hex')); - * // Prints: true - * ``` - * - * Example: Using the `sign.update()` and `verify.update()` methods: - * - * ```js - * const { - * generateKeyPairSync, - * createSign, - * createVerify, - * } = await import('node:crypto'); - * - * const { privateKey, publicKey } = generateKeyPairSync('rsa', { - * modulusLength: 2048, - * }); - * - * const sign = createSign('SHA256'); - * sign.update('some data to sign'); - * sign.end(); - * const signature = sign.sign(privateKey); - * - * const verify = createVerify('SHA256'); - * verify.update('some data to sign'); - * verify.end(); - * console.log(verify.verify(publicKey, signature)); - * // Prints: true - * ``` - * @since v0.1.92 - */ - class Sign extends stream.Writable { - private constructor(); - /** - * Updates the `Sign` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `encoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): this; - update(data: string, inputEncoding: Encoding): this; - /** - * Calculates the signature on all the data passed through using either `sign.update()` or `sign.write()`. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the following additional properties can be passed: - * - * If `outputEncoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * The `Sign` object can not be again used after `sign.sign()` method has been - * called. Multiple calls to `sign.sign()` will result in an error being thrown. - * @since v0.1.92 - */ - sign(privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput): Buffer; - sign( - privateKey: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - outputFormat: BinaryToTextEncoding, - ): string; - } - /** - * Creates and returns a `Verify` object that uses the given algorithm. - * Use {@link getHashes} to obtain an array of names of the available - * signing algorithms. Optional `options` argument controls the`stream.Writable` behavior. - * - * In some cases, a `Verify` instance can be created using the name of a signature - * algorithm, such as `'RSA-SHA256'`, instead of a digest algorithm. This will use - * the corresponding digest algorithm. This does not work for all signature - * algorithms, such as `'ecdsa-with-SHA256'`, so it is best to always use digest - * algorithm names. - * @since v0.1.92 - * @param options `stream.Writable` options - */ - function createVerify(algorithm: string, options?: stream.WritableOptions): Verify; - /** - * The `Verify` class is a utility for verifying signatures. It can be used in one - * of two ways: - * - * * As a writable `stream` where written data is used to validate against the - * supplied signature, or - * * Using the `verify.update()` and `verify.verify()` methods to verify - * the signature. - * - * The {@link createVerify} method is used to create `Verify` instances.`Verify` objects are not to be created directly using the `new` keyword. - * - * See `Sign` for examples. - * @since v0.1.92 - */ - class Verify extends stream.Writable { - private constructor(); - /** - * Updates the `Verify` content with the given `data`, the encoding of which - * is given in `inputEncoding`. - * If `inputEncoding` is not provided, and the `data` is a string, an - * encoding of `'utf8'` is enforced. If `data` is a `Buffer`, `TypedArray`, or`DataView`, then `inputEncoding` is ignored. - * - * This can be called many times with new data as it is streamed. - * @since v0.1.92 - * @param inputEncoding The `encoding` of the `data` string. - */ - update(data: BinaryLike): Verify; - update(data: string, inputEncoding: Encoding): Verify; - /** - * Verifies the provided data using the given `object` and `signature`. - * - * If `object` is not a `KeyObject`, this function behaves as if`object` had been passed to {@link createPublicKey}. If it is an - * object, the following additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the data, in - * the `signatureEncoding`. - * If a `signatureEncoding` is specified, the `signature` is expected to be a - * string; otherwise `signature` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * The `verify` object can not be used again after `verify.verify()` has been - * called. Multiple calls to `verify.verify()` will result in an error being - * thrown. - * - * Because public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.1.92 - */ - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - verify( - object: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: string, - signature_format?: BinaryToTextEncoding, - ): boolean; - } - /** - * Creates a `DiffieHellman` key exchange object using the supplied `prime` and an - * optional specific `generator`. - * - * The `generator` argument can be a number, string, or `Buffer`. If`generator` is not specified, the value `2` is used. - * - * If `primeEncoding` is specified, `prime` is expected to be a string; otherwise - * a `Buffer`, `TypedArray`, or `DataView` is expected. - * - * If `generatorEncoding` is specified, `generator` is expected to be a string; - * otherwise a number, `Buffer`, `TypedArray`, or `DataView` is expected. - * @since v0.11.12 - * @param primeEncoding The `encoding` of the `prime` string. - * @param [generator=2] - * @param generatorEncoding The `encoding` of the `generator` string. - */ - function createDiffieHellman(primeLength: number, generator?: number): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: ArrayBuffer | NodeJS.ArrayBufferView, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator?: number | ArrayBuffer | NodeJS.ArrayBufferView, - ): DiffieHellman; - function createDiffieHellman( - prime: string, - primeEncoding: BinaryToTextEncoding, - generator: string, - generatorEncoding: BinaryToTextEncoding, - ): DiffieHellman; - /** - * The `DiffieHellman` class is a utility for creating Diffie-Hellman key - * exchanges. - * - * Instances of the `DiffieHellman` class can be created using the {@link createDiffieHellman} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createDiffieHellman, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createDiffieHellman(2048); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createDiffieHellman(alice.getPrime(), alice.getGenerator()); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * // OK - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * ``` - * @since v0.5.0 - */ - class DiffieHellman { - private constructor(); - /** - * Generates private and public Diffie-Hellman key values unless they have been - * generated or computed already, and returns - * the public key in the specified `encoding`. This key should be - * transferred to the other party. - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * - * This function is a thin wrapper around [`DH_generate_key()`](https://www.openssl.org/docs/man3.0/man3/DH_generate_key.html). In particular, - * once a private key has been generated or set, calling this function only updates - * the public key but does not generate a new private key. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - generateKeys(): Buffer; - generateKeys(encoding: BinaryToTextEncoding): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using the specified `inputEncoding`, and secret is - * encoded using specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * If `outputEncoding` is given a string is returned; otherwise, a `Buffer` is returned. - * @since v0.5.0 - * @param inputEncoding The `encoding` of an `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, inputEncoding?: null, outputEncoding?: null): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding, outputEncoding?: null): Buffer; - computeSecret( - otherPublicKey: NodeJS.ArrayBufferView, - inputEncoding: null, - outputEncoding: BinaryToTextEncoding, - ): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * Returns the Diffie-Hellman prime in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrime(): Buffer; - getPrime(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman generator in the specified `encoding`. - * If `encoding` is provided a string is - * returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getGenerator(): Buffer; - getGenerator(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman public key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPublicKey(): Buffer; - getPublicKey(encoding: BinaryToTextEncoding): string; - /** - * Returns the Diffie-Hellman private key in the specified `encoding`. - * If `encoding` is provided a - * string is returned; otherwise a `Buffer` is returned. - * @since v0.5.0 - * @param encoding The `encoding` of the return value. - */ - getPrivateKey(): Buffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * Sets the Diffie-Hellman public key. If the `encoding` argument is provided,`publicKey` is expected - * to be a string. If no `encoding` is provided, `publicKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * @since v0.5.0 - * @param encoding The `encoding` of the `publicKey` string. - */ - setPublicKey(publicKey: NodeJS.ArrayBufferView): void; - setPublicKey(publicKey: string, encoding: BufferEncoding): void; - /** - * Sets the Diffie-Hellman private key. If the `encoding` argument is provided,`privateKey` is expected - * to be a string. If no `encoding` is provided, `privateKey` is expected - * to be a `Buffer`, `TypedArray`, or `DataView`. - * - * This function does not automatically compute the associated public key. Either `diffieHellman.setPublicKey()` or `diffieHellman.generateKeys()` can be - * used to manually provide the public key or to automatically derive it. - * @since v0.5.0 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BufferEncoding): void; - /** - * A bit field containing any warnings and/or errors resulting from a check - * performed during initialization of the `DiffieHellman` object. - * - * The following values are valid for this property (as defined in `node:constants` module): - * - * * `DH_CHECK_P_NOT_SAFE_PRIME` - * * `DH_CHECK_P_NOT_PRIME` - * * `DH_UNABLE_TO_CHECK_GENERATOR` - * * `DH_NOT_SUITABLE_GENERATOR` - * @since v0.11.12 - */ - verifyError: number; - } - /** - * The `DiffieHellmanGroup` class takes a well-known modp group as its argument. - * It works the same as `DiffieHellman`, except that it does not allow changing its keys after creation. - * In other words, it does not implement `setPublicKey()` or `setPrivateKey()` methods. - * - * ```js - * const { createDiffieHellmanGroup } = await import('node:crypto'); - * const dh = createDiffieHellmanGroup('modp1'); - * ``` - * The name (e.g. `'modp1'`) is taken from [RFC 2412](https://www.rfc-editor.org/rfc/rfc2412.txt) (modp1 and 2) and [RFC 3526](https://www.rfc-editor.org/rfc/rfc3526.txt): - * ```bash - * $ perl -ne 'print "$1\n" if /"(modp\d+)"/' src/node_crypto_groups.h - * modp1 # 768 bits - * modp2 # 1024 bits - * modp5 # 1536 bits - * modp14 # 2048 bits - * modp15 # etc. - * modp16 - * modp17 - * modp18 - * ``` - * @since v0.7.5 - */ - const DiffieHellmanGroup: DiffieHellmanGroupConstructor; - interface DiffieHellmanGroupConstructor { - new(name: string): DiffieHellmanGroup; - (name: string): DiffieHellmanGroup; - readonly prototype: DiffieHellmanGroup; - } - type DiffieHellmanGroup = Omit; - /** - * Creates a predefined `DiffieHellmanGroup` key exchange object. The - * supported groups are listed in the documentation for `DiffieHellmanGroup`. - * - * The returned object mimics the interface of objects created by {@link createDiffieHellman}, but will not allow changing - * the keys (with `diffieHellman.setPublicKey()`, for example). The - * advantage of using this method is that the parties do not have to - * generate nor exchange a group modulus beforehand, saving both processor - * and communication time. - * - * Example (obtaining a shared secret): - * - * ```js - * const { - * getDiffieHellman, - * } = await import('node:crypto'); - * const alice = getDiffieHellman('modp14'); - * const bob = getDiffieHellman('modp14'); - * - * alice.generateKeys(); - * bob.generateKeys(); - * - * const aliceSecret = alice.computeSecret(bob.getPublicKey(), null, 'hex'); - * const bobSecret = bob.computeSecret(alice.getPublicKey(), null, 'hex'); - * - * // aliceSecret and bobSecret should be the same - * console.log(aliceSecret === bobSecret); - * ``` - * @since v0.7.5 - */ - function getDiffieHellman(groupName: string): DiffieHellmanGroup; - /** - * An alias for {@link getDiffieHellman} - * @since v0.9.3 - */ - function createDiffieHellmanGroup(name: string): DiffieHellmanGroup; - /** - * Provides an asynchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. - * - * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an error occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. By default, the successfully generated`derivedKey` will be passed to the callback as a `Buffer`. An error will be - * thrown if any of the input arguments specify invalid values or types. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2, - * } = await import('node:crypto'); - * - * pbkdf2('secret', 'salt', 100000, 64, 'sha512', (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * @since v0.5.5 - */ - function pbkdf2( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - /** - * Provides a synchronous Password-Based Key Derivation Function 2 (PBKDF2) - * implementation. A selected HMAC digest algorithm specified by `digest` is - * applied to derive a key of the requested byte length (`keylen`) from the`password`, `salt` and `iterations`. - * - * If an error occurs an `Error` will be thrown, otherwise the derived key will be - * returned as a `Buffer`. - * - * The `iterations` argument must be a number set as high as possible. The - * higher the number of iterations, the more secure the derived key will be, - * but will take a longer amount of time to complete. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * ```js - * const { - * pbkdf2Sync, - * } = await import('node:crypto'); - * - * const key = pbkdf2Sync('secret', 'salt', 100000, 64, 'sha512'); - * console.log(key.toString('hex')); // '3745e48...08d59ae' - * ``` - * - * An array of supported digest functions can be retrieved using {@link getHashes}. - * @since v0.9.3 - */ - function pbkdf2Sync( - password: BinaryLike, - salt: BinaryLike, - iterations: number, - keylen: number, - digest: string, - ): Buffer; - /** - * Generates cryptographically strong pseudorandom data. The `size` argument - * is a number indicating the number of bytes to generate. - * - * If a `callback` function is provided, the bytes are generated asynchronously - * and the `callback` function is invoked with two arguments: `err` and `buf`. - * If an error occurs, `err` will be an `Error` object; otherwise it is `null`. The`buf` argument is a `Buffer` containing the generated bytes. - * - * ```js - * // Asynchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * randomBytes(256, (err, buf) => { - * if (err) throw err; - * console.log(`${buf.length} bytes of random data: ${buf.toString('hex')}`); - * }); - * ``` - * - * If the `callback` function is not provided, the random bytes are generated - * synchronously and returned as a `Buffer`. An error will be thrown if - * there is a problem generating the bytes. - * - * ```js - * // Synchronous - * const { - * randomBytes, - * } = await import('node:crypto'); - * - * const buf = randomBytes(256); - * console.log( - * `${buf.length} bytes of random data: ${buf.toString('hex')}`); - * ``` - * - * The `crypto.randomBytes()` method will not complete until there is - * sufficient entropy available. - * This should normally never take longer than a few milliseconds. The only time - * when generating the random bytes may conceivably block for a longer period of - * time is right after boot, when the whole system is still low on entropy. - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomBytes()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomBytes` requests when doing so as part of fulfilling a client - * request. - * @since v0.5.8 - * @param size The number of bytes to generate. The `size` must not be larger than `2**31 - 1`. - * @return if the `callback` function is not provided. - */ - function randomBytes(size: number): Buffer; - function randomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - function pseudoRandomBytes(size: number): Buffer; - function pseudoRandomBytes(size: number, callback: (err: Error | null, buf: Buffer) => void): void; - /** - * Return a random integer `n` such that `min <= n < max`. This - * implementation avoids [modulo bias](https://en.wikipedia.org/wiki/Fisher%E2%80%93Yates_shuffle#Modulo_bias). - * - * The range (`max - min`) must be less than 248. `min` and `max` must - * be [safe integers](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/isSafeInteger). - * - * If the `callback` function is not provided, the random integer is - * generated synchronously. - * - * ```js - * // Asynchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * randomInt(3, (err, n) => { - * if (err) throw err; - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * }); - * ``` - * - * ```js - * // Synchronous - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(3); - * console.log(`Random number chosen from (0, 1, 2): ${n}`); - * ``` - * - * ```js - * // With `min` argument - * const { - * randomInt, - * } = await import('node:crypto'); - * - * const n = randomInt(1, 7); - * console.log(`The dice rolled: ${n}`); - * ``` - * @since v14.10.0, v12.19.0 - * @param [min=0] Start of random range (inclusive). - * @param max End of random range (exclusive). - * @param callback `function(err, n) {}`. - */ - function randomInt(max: number): number; - function randomInt(min: number, max: number): number; - function randomInt(max: number, callback: (err: Error | null, value: number) => void): void; - function randomInt(min: number, max: number, callback: (err: Error | null, value: number) => void): void; - /** - * Synchronous version of {@link randomFill}. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * console.log(randomFillSync(buf).toString('hex')); - * - * randomFillSync(buf, 5); - * console.log(buf.toString('hex')); - * - * // The above is equivalent to the following: - * randomFillSync(buf, 5, 5); - * console.log(buf.toString('hex')); - * ``` - * - * Any `ArrayBuffer`, `TypedArray` or `DataView` instance may be passed as`buffer`. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFillSync } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * console.log(Buffer.from(randomFillSync(a).buffer, - * a.byteOffset, a.byteLength).toString('hex')); - * - * const b = new DataView(new ArrayBuffer(10)); - * console.log(Buffer.from(randomFillSync(b).buffer, - * b.byteOffset, b.byteLength).toString('hex')); - * - * const c = new ArrayBuffer(10); - * console.log(Buffer.from(randomFillSync(c)).toString('hex')); - * ``` - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @return The object passed as `buffer` argument. - */ - function randomFillSync(buffer: T, offset?: number, size?: number): T; - /** - * This function is similar to {@link randomBytes} but requires the first - * argument to be a `Buffer` that will be filled. It also - * requires that a callback is passed in. - * - * If the `callback` function is not provided, an error will be thrown. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const buf = Buffer.alloc(10); - * randomFill(buf, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * randomFill(buf, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * - * // The above is equivalent to the following: - * randomFill(buf, 5, 5, (err, buf) => { - * if (err) throw err; - * console.log(buf.toString('hex')); - * }); - * ``` - * - * Any `ArrayBuffer`, `TypedArray`, or `DataView` instance may be passed as`buffer`. - * - * While this includes instances of `Float32Array` and `Float64Array`, this - * function should not be used to generate random floating-point numbers. The - * result may contain `+Infinity`, `-Infinity`, and `NaN`, and even if the array - * contains finite numbers only, they are not drawn from a uniform random - * distribution and have no meaningful lower or upper bounds. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { randomFill } = await import('node:crypto'); - * - * const a = new Uint32Array(10); - * randomFill(a, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const b = new DataView(new ArrayBuffer(10)); - * randomFill(b, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf.buffer, buf.byteOffset, buf.byteLength) - * .toString('hex')); - * }); - * - * const c = new ArrayBuffer(10); - * randomFill(c, (err, buf) => { - * if (err) throw err; - * console.log(Buffer.from(buf).toString('hex')); - * }); - * ``` - * - * This API uses libuv's threadpool, which can have surprising and - * negative performance implications for some applications; see the `UV_THREADPOOL_SIZE` documentation for more information. - * - * The asynchronous version of `crypto.randomFill()` is carried out in a single - * threadpool request. To minimize threadpool task length variation, partition - * large `randomFill` requests when doing so as part of fulfilling a client - * request. - * @since v7.10.0, v6.13.0 - * @param buffer Must be supplied. The size of the provided `buffer` must not be larger than `2**31 - 1`. - * @param [offset=0] - * @param [size=buffer.length - offset] - * @param callback `function(err, buf) {}`. - */ - function randomFill( - buffer: T, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - callback: (err: Error | null, buf: T) => void, - ): void; - function randomFill( - buffer: T, - offset: number, - size: number, - callback: (err: Error | null, buf: T) => void, - ): void; - interface ScryptOptions { - cost?: number | undefined; - blockSize?: number | undefined; - parallelization?: number | undefined; - N?: number | undefined; - r?: number | undefined; - p?: number | undefined; - maxmem?: number | undefined; - } - /** - * Provides an asynchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * The `callback` function is called with two arguments: `err` and `derivedKey`.`err` is an exception object when key derivation fails, otherwise `err` is`null`. `derivedKey` is passed to the - * callback as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scrypt, - * } = await import('node:crypto'); - * - * // Using the factory defaults. - * scrypt('password', 'salt', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...08d59ae' - * }); - * // Using a custom N parameter. Must be a power of two. - * scrypt('password', 'salt', 64, { N: 1024 }, (err, derivedKey) => { - * if (err) throw err; - * console.log(derivedKey.toString('hex')); // '3745e48...aa39b34' - * }); - * ``` - * @since v10.5.0 - */ - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - function scrypt( - password: BinaryLike, - salt: BinaryLike, - keylen: number, - options: ScryptOptions, - callback: (err: Error | null, derivedKey: Buffer) => void, - ): void; - /** - * Provides a synchronous [scrypt](https://en.wikipedia.org/wiki/Scrypt) implementation. Scrypt is a password-based - * key derivation function that is designed to be expensive computationally and - * memory-wise in order to make brute-force attacks unrewarding. - * - * The `salt` should be as unique as possible. It is recommended that a salt is - * random and at least 16 bytes long. See [NIST SP 800-132](https://nvlpubs.nist.gov/nistpubs/Legacy/SP/nistspecialpublication800-132.pdf) for details. - * - * When passing strings for `password` or `salt`, please consider `caveats when using strings as inputs to cryptographic APIs`. - * - * An exception is thrown when key derivation fails, otherwise the derived key is - * returned as a `Buffer`. - * - * An exception is thrown when any of the input arguments specify invalid values - * or types. - * - * ```js - * const { - * scryptSync, - * } = await import('node:crypto'); - * // Using the factory defaults. - * - * const key1 = scryptSync('password', 'salt', 64); - * console.log(key1.toString('hex')); // '3745e48...08d59ae' - * // Using a custom N parameter. Must be a power of two. - * const key2 = scryptSync('password', 'salt', 64, { N: 1024 }); - * console.log(key2.toString('hex')); // '3745e48...aa39b34' - * ``` - * @since v10.5.0 - */ - function scryptSync(password: BinaryLike, salt: BinaryLike, keylen: number, options?: ScryptOptions): Buffer; - interface RsaPublicKey { - key: KeyLike; - padding?: number | undefined; - } - interface RsaPrivateKey { - key: KeyLike; - passphrase?: string | undefined; - /** - * @default 'sha1' - */ - oaepHash?: string | undefined; - oaepLabel?: NodeJS.TypedArray | undefined; - padding?: number | undefined; - } - /** - * Encrypts the content of `buffer` with `key` and returns a new `Buffer` with encrypted content. The returned data can be decrypted using - * the corresponding private key, for example using {@link privateDecrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v0.11.14 - */ - function publicEncrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Decrypts `buffer` with `key`.`buffer` was previously encrypted using - * the corresponding private key, for example using {@link privateEncrypt}. - * - * If `key` is not a `KeyObject`, this function behaves as if`key` had been passed to {@link createPublicKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. - * - * Because RSA public keys can be derived from private keys, a private key may - * be passed instead of a public key. - * @since v1.1.0 - */ - function publicDecrypt(key: RsaPublicKey | RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Decrypts `buffer` with `privateKey`. `buffer` was previously encrypted using - * the corresponding public key, for example using {@link publicEncrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_OAEP_PADDING`. - * @since v0.11.14 - */ - function privateDecrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * Encrypts `buffer` with `privateKey`. The returned data can be decrypted using - * the corresponding public key, for example using {@link publicDecrypt}. - * - * If `privateKey` is not a `KeyObject`, this function behaves as if`privateKey` had been passed to {@link createPrivateKey}. If it is an - * object, the `padding` property can be passed. Otherwise, this function uses`RSA_PKCS1_PADDING`. - * @since v1.1.0 - */ - function privateEncrypt(privateKey: RsaPrivateKey | KeyLike, buffer: NodeJS.ArrayBufferView): Buffer; - /** - * ```js - * const { - * getCiphers, - * } = await import('node:crypto'); - * - * console.log(getCiphers()); // ['aes-128-cbc', 'aes-128-ccm', ...] - * ``` - * @since v0.9.3 - * @return An array with the names of the supported cipher algorithms. - */ - function getCiphers(): string[]; - /** - * ```js - * const { - * getCurves, - * } = await import('node:crypto'); - * - * console.log(getCurves()); // ['Oakley-EC2N-3', 'Oakley-EC2N-4', ...] - * ``` - * @since v2.3.0 - * @return An array with the names of the supported elliptic curves. - */ - function getCurves(): string[]; - /** - * @since v10.0.0 - * @return `1` if and only if a FIPS compliant crypto provider is currently in use, `0` otherwise. A future semver-major release may change the return type of this API to a {boolean}. - */ - function getFips(): 1 | 0; - /** - * Enables the FIPS compliant crypto provider in a FIPS-enabled Node.js build. - * Throws an error if FIPS mode is not available. - * @since v10.0.0 - * @param bool `true` to enable FIPS mode. - */ - function setFips(bool: boolean): void; - /** - * ```js - * const { - * getHashes, - * } = await import('node:crypto'); - * - * console.log(getHashes()); // ['DSA', 'DSA-SHA', 'DSA-SHA1', ...] - * ``` - * @since v0.9.3 - * @return An array of the names of the supported hash algorithms, such as `'RSA-SHA256'`. Hash algorithms are also called "digest" algorithms. - */ - function getHashes(): string[]; - /** - * The `ECDH` class is a utility for creating Elliptic Curve Diffie-Hellman (ECDH) - * key exchanges. - * - * Instances of the `ECDH` class can be created using the {@link createECDH} function. - * - * ```js - * import assert from 'node:assert'; - * - * const { - * createECDH, - * } = await import('node:crypto'); - * - * // Generate Alice's keys... - * const alice = createECDH('secp521r1'); - * const aliceKey = alice.generateKeys(); - * - * // Generate Bob's keys... - * const bob = createECDH('secp521r1'); - * const bobKey = bob.generateKeys(); - * - * // Exchange and generate the secret... - * const aliceSecret = alice.computeSecret(bobKey); - * const bobSecret = bob.computeSecret(aliceKey); - * - * assert.strictEqual(aliceSecret.toString('hex'), bobSecret.toString('hex')); - * // OK - * ``` - * @since v0.11.14 - */ - class ECDH { - private constructor(); - /** - * Converts the EC Diffie-Hellman public key specified by `key` and `curve` to the - * format specified by `format`. The `format` argument specifies point encoding - * and can be `'compressed'`, `'uncompressed'` or `'hybrid'`. The supplied key is - * interpreted using the specified `inputEncoding`, and the returned key is encoded - * using the specified `outputEncoding`. - * - * Use {@link getCurves} to obtain a list of available curve names. - * On recent OpenSSL releases, `openssl ecparam -list_curves` will also display - * the name and description of each available elliptic curve. - * - * If `format` is not specified the point will be returned in `'uncompressed'`format. - * - * If the `inputEncoding` is not provided, `key` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * Example (uncompressing a key): - * - * ```js - * const { - * createECDH, - * ECDH, - * } = await import('node:crypto'); - * - * const ecdh = createECDH('secp256k1'); - * ecdh.generateKeys(); - * - * const compressedKey = ecdh.getPublicKey('hex', 'compressed'); - * - * const uncompressedKey = ECDH.convertKey(compressedKey, - * 'secp256k1', - * 'hex', - * 'hex', - * 'uncompressed'); - * - * // The converted key and the uncompressed public key should be the same - * console.log(uncompressedKey === ecdh.getPublicKey('hex')); - * ``` - * @since v10.0.0 - * @param inputEncoding The `encoding` of the `key` string. - * @param outputEncoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - static convertKey( - key: BinaryLike, - curve: string, - inputEncoding?: BinaryToTextEncoding, - outputEncoding?: "latin1" | "hex" | "base64" | "base64url", - format?: "uncompressed" | "compressed" | "hybrid", - ): Buffer | string; - /** - * Generates private and public EC Diffie-Hellman key values, and returns - * the public key in the specified `format` and `encoding`. This key should be - * transferred to the other party. - * - * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified, the point will be returned in`'uncompressed'` format. - * - * If `encoding` is provided a string is returned; otherwise a `Buffer` is returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - */ - generateKeys(): Buffer; - generateKeys(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Computes the shared secret using `otherPublicKey` as the other - * party's public key and returns the computed shared secret. The supplied - * key is interpreted using specified `inputEncoding`, and the returned secret - * is encoded using the specified `outputEncoding`. - * If the `inputEncoding` is not - * provided, `otherPublicKey` is expected to be a `Buffer`, `TypedArray`, or`DataView`. - * - * If `outputEncoding` is given a string will be returned; otherwise a `Buffer` is returned. - * - * `ecdh.computeSecret` will throw an`ERR_CRYPTO_ECDH_INVALID_PUBLIC_KEY` error when `otherPublicKey`lies outside of the elliptic curve. Since `otherPublicKey` is - * usually supplied from a remote user over an insecure network, - * be sure to handle this exception accordingly. - * @since v0.11.14 - * @param inputEncoding The `encoding` of the `otherPublicKey` string. - * @param outputEncoding The `encoding` of the return value. - */ - computeSecret(otherPublicKey: NodeJS.ArrayBufferView): Buffer; - computeSecret(otherPublicKey: string, inputEncoding: BinaryToTextEncoding): Buffer; - computeSecret(otherPublicKey: NodeJS.ArrayBufferView, outputEncoding: BinaryToTextEncoding): string; - computeSecret( - otherPublicKey: string, - inputEncoding: BinaryToTextEncoding, - outputEncoding: BinaryToTextEncoding, - ): string; - /** - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @return The EC Diffie-Hellman in the specified `encoding`. - */ - getPrivateKey(): Buffer; - getPrivateKey(encoding: BinaryToTextEncoding): string; - /** - * The `format` argument specifies point encoding and can be `'compressed'` or`'uncompressed'`. If `format` is not specified the point will be returned in`'uncompressed'` format. - * - * If `encoding` is specified, a string is returned; otherwise a `Buffer` is - * returned. - * @since v0.11.14 - * @param encoding The `encoding` of the return value. - * @param [format='uncompressed'] - * @return The EC Diffie-Hellman public key in the specified `encoding` and `format`. - */ - getPublicKey(encoding?: null, format?: ECDHKeyFormat): Buffer; - getPublicKey(encoding: BinaryToTextEncoding, format?: ECDHKeyFormat): string; - /** - * Sets the EC Diffie-Hellman private key. - * If `encoding` is provided, `privateKey` is expected - * to be a string; otherwise `privateKey` is expected to be a `Buffer`,`TypedArray`, or `DataView`. - * - * If `privateKey` is not valid for the curve specified when the `ECDH` object was - * created, an error is thrown. Upon setting the private key, the associated - * public point (key) is also generated and set in the `ECDH` object. - * @since v0.11.14 - * @param encoding The `encoding` of the `privateKey` string. - */ - setPrivateKey(privateKey: NodeJS.ArrayBufferView): void; - setPrivateKey(privateKey: string, encoding: BinaryToTextEncoding): void; - } - /** - * Creates an Elliptic Curve Diffie-Hellman (`ECDH`) key exchange object using a - * predefined curve specified by the `curveName` string. Use {@link getCurves} to obtain a list of available curve names. On recent - * OpenSSL releases, `openssl ecparam -list_curves` will also display the name - * and description of each available elliptic curve. - * @since v0.11.14 - */ - function createECDH(curveName: string): ECDH; - /** - * This function compares the underlying bytes that represent the given`ArrayBuffer`, `TypedArray`, or `DataView` instances using a constant-time - * algorithm. - * - * This function does not leak timing information that - * would allow an attacker to guess one of the values. This is suitable for - * comparing HMAC digests or secret values like authentication cookies or [capability urls](https://www.w3.org/TR/capability-urls/). - * - * `a` and `b` must both be `Buffer`s, `TypedArray`s, or `DataView`s, and they - * must have the same byte length. An error is thrown if `a` and `b` have - * different byte lengths. - * - * If at least one of `a` and `b` is a `TypedArray` with more than one byte per - * entry, such as `Uint16Array`, the result will be computed using the platform - * byte order. - * - * **When both of the inputs are `Float32Array`s or`Float64Array`s, this function might return unexpected results due to IEEE 754** - * **encoding of floating-point numbers. In particular, neither `x === y` nor`Object.is(x, y)` implies that the byte representations of two floating-point** - * **numbers `x` and `y` are equal.** - * - * Use of `crypto.timingSafeEqual` does not guarantee that the _surrounding_ code - * is timing-safe. Care should be taken to ensure that the surrounding code does - * not introduce timing vulnerabilities. - * @since v6.6.0 - */ - function timingSafeEqual(a: NodeJS.ArrayBufferView, b: NodeJS.ArrayBufferView): boolean; - type KeyType = "rsa" | "rsa-pss" | "dsa" | "ec" | "ed25519" | "ed448" | "x25519" | "x448"; - type KeyFormat = "pem" | "der" | "jwk"; - interface BasePrivateKeyEncodingOptions { - format: T; - cipher?: string | undefined; - passphrase?: string | undefined; - } - interface KeyPairKeyObjectResult { - publicKey: KeyObject; - privateKey: KeyObject; - } - interface ED25519KeyPairKeyObjectOptions {} - interface ED448KeyPairKeyObjectOptions {} - interface X25519KeyPairKeyObjectOptions {} - interface X448KeyPairKeyObjectOptions {} - interface ECKeyPairKeyObjectOptions { - /** - * Name of the curve to use - */ - namedCurve: string; - } - interface RSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - } - interface RSAPSSKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string; - /** - * Minimal salt length in bytes - */ - saltLength?: string; - } - interface DSAKeyPairKeyObjectOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - } - interface RSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs1" | "pkcs8"; - }; - } - interface RSAPSSKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Public exponent - * @default 0x10001 - */ - publicExponent?: number | undefined; - /** - * Name of the message digest - */ - hashAlgorithm?: string; - /** - * Name of the message digest used by MGF1 - */ - mgf1HashAlgorithm?: string; - /** - * Minimal salt length in bytes - */ - saltLength?: string; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface DSAKeyPairOptions { - /** - * Key size in bits - */ - modulusLength: number; - /** - * Size of q in bits - */ - divisorLength: number; - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ECKeyPairOptions { - /** - * Name of the curve to use. - */ - namedCurve: string; - publicKeyEncoding: { - type: "pkcs1" | "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "sec1" | "pkcs8"; - }; - } - interface ED25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface ED448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X25519KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface X448KeyPairOptions { - publicKeyEncoding: { - type: "spki"; - format: PubF; - }; - privateKeyEncoding: BasePrivateKeyEncodingOptions & { - type: "pkcs8"; - }; - } - interface KeyPairSyncResult { - publicKey: T1; - privateKey: T2; - } - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * When encoding public keys, it is recommended to use `'spki'`. When encoding - * private keys, it is recommended to use `'pkcs8'` with a strong passphrase, - * and to keep the passphrase confidential. - * - * ```js - * const { - * generateKeyPairSync, - * } = await import('node:crypto'); - * - * const { - * publicKey, - * privateKey, - * } = generateKeyPairSync('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }); - * ``` - * - * The return value `{ publicKey, privateKey }` represents the generated key pair. - * When PEM encoding was selected, the respective key will be a string, otherwise - * it will be a buffer containing the data encoded as DER. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa", options: RSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "rsa-pss", options: RSAPSSKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "dsa", options: DSAKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ec", options: ECKeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed25519", options?: ED25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "ed448", options?: ED448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x25519", options?: X25519KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): KeyPairSyncResult; - function generateKeyPairSync( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): KeyPairSyncResult; - function generateKeyPairSync(type: "x448", options?: X448KeyPairKeyObjectOptions): KeyPairKeyObjectResult; - /** - * Generates a new asymmetric key pair of the given `type`. RSA, RSA-PSS, DSA, EC, - * Ed25519, Ed448, X25519, X448, and DH are currently supported. - * - * If a `publicKeyEncoding` or `privateKeyEncoding` was specified, this function - * behaves as if `keyObject.export()` had been called on its result. Otherwise, - * the respective part of the key is returned as a `KeyObject`. - * - * It is recommended to encode public keys as `'spki'` and private keys as`'pkcs8'` with encryption for long-term storage: - * - * ```js - * const { - * generateKeyPair, - * } = await import('node:crypto'); - * - * generateKeyPair('rsa', { - * modulusLength: 4096, - * publicKeyEncoding: { - * type: 'spki', - * format: 'pem', - * }, - * privateKeyEncoding: { - * type: 'pkcs8', - * format: 'pem', - * cipher: 'aes-256-cbc', - * passphrase: 'top secret', - * }, - * }, (err, publicKey, privateKey) => { - * // Handle errors and use the generated key pair. - * }); - * ``` - * - * On completion, `callback` will be called with `err` set to `undefined` and`publicKey` / `privateKey` representing the generated key pair. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a `Promise` for an `Object` with `publicKey` and `privateKey` properties. - * @since v10.12.0 - * @param type Must be `'rsa'`, `'rsa-pss'`, `'dsa'`, `'ec'`, `'ed25519'`, `'ed448'`, `'x25519'`, `'x448'`, or `'dh'`. - */ - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa", - options: RSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "dsa", - options: DSAKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ec", - options: ECKeyPairKeyObjectOptions, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed25519", - options: ED25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "ed448", - options: ED448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x25519", - options: X25519KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - callback: (err: Error | null, publicKey: string, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - callback: (err: Error | null, publicKey: string, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - callback: (err: Error | null, publicKey: Buffer, privateKey: string) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - callback: (err: Error | null, publicKey: Buffer, privateKey: Buffer) => void, - ): void; - function generateKeyPair( - type: "x448", - options: X448KeyPairKeyObjectOptions | undefined, - callback: (err: Error | null, publicKey: KeyObject, privateKey: KeyObject) => void, - ): void; - namespace generateKeyPair { - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa", - options: RSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "rsa", options: RSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "rsa-pss", - options: RSAPSSKeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "dsa", - options: DSAKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "dsa", options: DSAKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ec", - options: ECKeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "ec", options: ECKeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ed25519", - options: ED25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed25519", - options?: ED25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "ed448", - options: ED448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "ed448", options?: ED448KeyPairKeyObjectOptions): Promise; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "x25519", - options: X25519KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__( - type: "x25519", - options?: X25519KeyPairKeyObjectOptions, - ): Promise; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "pem">, - ): Promise<{ - publicKey: string; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"pem", "der">, - ): Promise<{ - publicKey: string; - privateKey: Buffer; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "pem">, - ): Promise<{ - publicKey: Buffer; - privateKey: string; - }>; - function __promisify__( - type: "x448", - options: X448KeyPairOptions<"der", "der">, - ): Promise<{ - publicKey: Buffer; - privateKey: Buffer; - }>; - function __promisify__(type: "x448", options?: X448KeyPairKeyObjectOptions): Promise; - } - /** - * Calculates and returns the signature for `data` using the given private key and - * algorithm. If `algorithm` is `null` or `undefined`, then the algorithm is - * dependent upon the key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPrivateKey}. If it is an object, the following - * additional properties can be passed: - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - ): Buffer; - function sign( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | SignKeyObjectInput | SignPrivateKeyInput, - callback: (error: Error | null, data: Buffer) => void, - ): void; - /** - * Verifies the given signature for `data` using the given key and algorithm. If`algorithm` is `null` or `undefined`, then the algorithm is dependent upon the - * key type (especially Ed25519 and Ed448). - * - * If `key` is not a `KeyObject`, this function behaves as if `key` had been - * passed to {@link createPublicKey}. If it is an object, the following - * additional properties can be passed: - * - * The `signature` argument is the previously calculated signature for the `data`. - * - * Because public keys can be derived from private keys, a private key or a public - * key may be passed for `key`. - * - * If the `callback` function is provided this function uses libuv's threadpool. - * @since v12.0.0 - */ - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - ): boolean; - function verify( - algorithm: string | null | undefined, - data: NodeJS.ArrayBufferView, - key: KeyLike | VerifyKeyObjectInput | VerifyPublicKeyInput | VerifyJsonWebKeyInput, - signature: NodeJS.ArrayBufferView, - callback: (error: Error | null, result: boolean) => void, - ): void; - /** - * Computes the Diffie-Hellman secret based on a `privateKey` and a `publicKey`. - * Both keys must have the same `asymmetricKeyType`, which must be one of `'dh'`(for Diffie-Hellman), `'ec'` (for ECDH), `'x448'`, or `'x25519'` (for ECDH-ES). - * @since v13.9.0, v12.17.0 - */ - function diffieHellman(options: { privateKey: KeyObject; publicKey: KeyObject }): Buffer; - type CipherMode = "cbc" | "ccm" | "cfb" | "ctr" | "ecb" | "gcm" | "ocb" | "ofb" | "stream" | "wrap" | "xts"; - interface CipherInfoOptions { - /** - * A test key length. - */ - keyLength?: number | undefined; - /** - * A test IV length. - */ - ivLength?: number | undefined; - } - interface CipherInfo { - /** - * The name of the cipher. - */ - name: string; - /** - * The nid of the cipher. - */ - nid: number; - /** - * The block size of the cipher in bytes. - * This property is omitted when mode is 'stream'. - */ - blockSize?: number | undefined; - /** - * The expected or default initialization vector length in bytes. - * This property is omitted if the cipher does not use an initialization vector. - */ - ivLength?: number | undefined; - /** - * The expected or default key length in bytes. - */ - keyLength: number; - /** - * The cipher mode. - */ - mode: CipherMode; - } - /** - * Returns information about a given cipher. - * - * Some ciphers accept variable length keys and initialization vectors. By default, - * the `crypto.getCipherInfo()` method will return the default values for these - * ciphers. To test if a given key length or iv length is acceptable for given - * cipher, use the `keyLength` and `ivLength` options. If the given values are - * unacceptable, `undefined` will be returned. - * @since v15.0.0 - * @param nameOrNid The name or nid of the cipher to query. - */ - function getCipherInfo(nameOrNid: string | number, options?: CipherInfoOptions): CipherInfo | undefined; - /** - * HKDF is a simple key derivation function defined in RFC 5869\. The given `ikm`,`salt` and `info` are used with the `digest` to derive a key of `keylen` bytes. - * - * The supplied `callback` function is called with two arguments: `err` and`derivedKey`. If an errors occurs while deriving the key, `err` will be set; - * otherwise `err` will be `null`. The successfully generated `derivedKey` will - * be passed to the callback as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). An error will be thrown if any - * of the input arguments specify invalid values or types. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdf, - * } = await import('node:crypto'); - * - * hkdf('sha512', 'key', 'salt', 'info', 64, (err, derivedKey) => { - * if (err) throw err; - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * }); - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdf( - digest: string, - irm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - callback: (err: Error | null, derivedKey: ArrayBuffer) => void, - ): void; - /** - * Provides a synchronous HKDF key derivation function as defined in RFC 5869\. The - * given `ikm`, `salt` and `info` are used with the `digest` to derive a key of`keylen` bytes. - * - * The successfully generated `derivedKey` will be returned as an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). - * - * An error will be thrown if any of the input arguments specify invalid values or - * types, or if the derived key cannot be generated. - * - * ```js - * import { Buffer } from 'node:buffer'; - * const { - * hkdfSync, - * } = await import('node:crypto'); - * - * const derivedKey = hkdfSync('sha512', 'key', 'salt', 'info', 64); - * console.log(Buffer.from(derivedKey).toString('hex')); // '24156e2...5391653' - * ``` - * @since v15.0.0 - * @param digest The digest algorithm to use. - * @param ikm The input keying material. Must be provided but can be zero-length. - * @param salt The salt value. Must be provided but can be zero-length. - * @param info Additional info value. Must be provided but can be zero-length, and cannot be more than 1024 bytes. - * @param keylen The length of the key to generate. Must be greater than 0. The maximum allowable value is `255` times the number of bytes produced by the selected digest function (e.g. `sha512` - * generates 64-byte hashes, making the maximum HKDF output 16320 bytes). - */ - function hkdfSync( - digest: string, - ikm: BinaryLike | KeyObject, - salt: BinaryLike, - info: BinaryLike, - keylen: number, - ): ArrayBuffer; - interface SecureHeapUsage { - /** - * The total allocated secure heap size as specified using the `--secure-heap=n` command-line flag. - */ - total: number; - /** - * The minimum allocation from the secure heap as specified using the `--secure-heap-min` command-line flag. - */ - min: number; - /** - * The total number of bytes currently allocated from the secure heap. - */ - used: number; - /** - * The calculated ratio of `used` to `total` allocated bytes. - */ - utilization: number; - } - /** - * @since v15.6.0 - */ - function secureHeapUsed(): SecureHeapUsage; - interface RandomUUIDOptions { - /** - * By default, to improve performance, - * Node.js will pre-emptively generate and persistently cache enough - * random data to generate up to 128 random UUIDs. To generate a UUID - * without using the cache, set `disableEntropyCache` to `true`. - * - * @default `false` - */ - disableEntropyCache?: boolean | undefined; - } - /** - * Generates a random [RFC 4122](https://www.rfc-editor.org/rfc/rfc4122.txt) version 4 UUID. The UUID is generated using a - * cryptographic pseudorandom number generator. - * @since v15.6.0, v14.17.0 - */ - function randomUUID(options?: RandomUUIDOptions): string; - interface X509CheckOptions { - /** - * @default 'always' - */ - subject?: "always" | "default" | "never"; - /** - * @default true - */ - wildcards?: boolean; - /** - * @default true - */ - partialWildcards?: boolean; - /** - * @default false - */ - multiLabelWildcards?: boolean; - /** - * @default false - */ - singleLabelSubdomains?: boolean; - } - /** - * Encapsulates an X509 certificate and provides read-only access to - * its information. - * - * ```js - * const { X509Certificate } = await import('node:crypto'); - * - * const x509 = new X509Certificate('{... pem encoded cert ...}'); - * - * console.log(x509.subject); - * ``` - * @since v15.6.0 - */ - class X509Certificate { - /** - * Will be \`true\` if this is a Certificate Authority (CA) certificate. - * @since v15.6.0 - */ - readonly ca: boolean; - /** - * The SHA-1 fingerprint of this certificate. - * - * Because SHA-1 is cryptographically broken and because the security of SHA-1 is - * significantly worse than that of algorithms that are commonly used to sign - * certificates, consider using `x509.fingerprint256` instead. - * @since v15.6.0 - */ - readonly fingerprint: string; - /** - * The SHA-256 fingerprint of this certificate. - * @since v15.6.0 - */ - readonly fingerprint256: string; - /** - * The SHA-512 fingerprint of this certificate. - * - * Because computing the SHA-256 fingerprint is usually faster and because it is - * only half the size of the SHA-512 fingerprint, `x509.fingerprint256` may be - * a better choice. While SHA-512 presumably provides a higher level of security in - * general, the security of SHA-256 matches that of most algorithms that are - * commonly used to sign certificates. - * @since v17.2.0, v16.14.0 - */ - readonly fingerprint512: string; - /** - * The complete subject of this certificate. - * @since v15.6.0 - */ - readonly subject: string; - /** - * The subject alternative name specified for this certificate. - * - * This is a comma-separated list of subject alternative names. Each entry begins - * with a string identifying the kind of the subject alternative name followed by - * a colon and the value associated with the entry. - * - * Earlier versions of Node.js incorrectly assumed that it is safe to split this - * property at the two-character sequence `', '` (see [CVE-2021-44532](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44532)). However, - * both malicious and legitimate certificates can contain subject alternative names - * that include this sequence when represented as a string. - * - * After the prefix denoting the type of the entry, the remainder of each entry - * might be enclosed in quotes to indicate that the value is a JSON string literal. - * For backward compatibility, Node.js only uses JSON string literals within this - * property when necessary to avoid ambiguity. Third-party code should be prepared - * to handle both possible entry formats. - * @since v15.6.0 - */ - readonly subjectAltName: string | undefined; - /** - * A textual representation of the certificate's authority information access - * extension. - * - * This is a line feed separated list of access descriptions. Each line begins with - * the access method and the kind of the access location, followed by a colon and - * the value associated with the access location. - * - * After the prefix denoting the access method and the kind of the access location, - * the remainder of each line might be enclosed in quotes to indicate that the - * value is a JSON string literal. For backward compatibility, Node.js only uses - * JSON string literals within this property when necessary to avoid ambiguity. - * Third-party code should be prepared to handle both possible entry formats. - * @since v15.6.0 - */ - readonly infoAccess: string | undefined; - /** - * An array detailing the key usages for this certificate. - * @since v15.6.0 - */ - readonly keyUsage: string[]; - /** - * The issuer identification included in this certificate. - * @since v15.6.0 - */ - readonly issuer: string; - /** - * The issuer certificate or `undefined` if the issuer certificate is not - * available. - * @since v15.9.0 - */ - readonly issuerCertificate?: X509Certificate | undefined; - /** - * The public key `KeyObject` for this certificate. - * @since v15.6.0 - */ - readonly publicKey: KeyObject; - /** - * A `Buffer` containing the DER encoding of this certificate. - * @since v15.6.0 - */ - readonly raw: Buffer; - /** - * The serial number of this certificate. - * - * Serial numbers are assigned by certificate authorities and do not uniquely - * identify certificates. Consider using `x509.fingerprint256` as a unique - * identifier instead. - * @since v15.6.0 - */ - readonly serialNumber: string; - /** - * The date/time from which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validFrom: string; - /** - * The date/time until which this certificate is considered valid. - * @since v15.6.0 - */ - readonly validTo: string; - constructor(buffer: BinaryLike); - /** - * Checks whether the certificate matches the given email address. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any email addresses. - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching email - * address, the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns `email` if the certificate matches, `undefined` if it does not. - */ - checkEmail(email: string, options?: Pick): string | undefined; - /** - * Checks whether the certificate matches the given host name. - * - * If the certificate matches the given host name, the matching subject name is - * returned. The returned name might be an exact match (e.g., `foo.example.com`) - * or it might contain wildcards (e.g., `*.example.com`). Because host name - * comparisons are case-insensitive, the returned subject name might also differ - * from the given `name` in capitalization. - * - * If the `'subject'` option is undefined or set to `'default'`, the certificate - * subject is only considered if the subject alternative name extension either does - * not exist or does not contain any DNS names. This behavior is consistent with [RFC 2818](https://www.rfc-editor.org/rfc/rfc2818.txt) ("HTTP Over TLS"). - * - * If the `'subject'` option is set to `'always'` and if the subject alternative - * name extension either does not exist or does not contain a matching DNS name, - * the certificate subject is considered. - * - * If the `'subject'` option is set to `'never'`, the certificate subject is never - * considered, even if the certificate contains no subject alternative names. - * @since v15.6.0 - * @return Returns a subject name that matches `name`, or `undefined` if no subject name matches `name`. - */ - checkHost(name: string, options?: X509CheckOptions): string | undefined; - /** - * Checks whether the certificate matches the given IP address (IPv4 or IPv6). - * - * Only [RFC 5280](https://www.rfc-editor.org/rfc/rfc5280.txt) `iPAddress` subject alternative names are considered, and they - * must match the given `ip` address exactly. Other subject alternative names as - * well as the subject field of the certificate are ignored. - * @since v15.6.0 - * @return Returns `ip` if the certificate matches, `undefined` if it does not. - */ - checkIP(ip: string): string | undefined; - /** - * Checks whether this certificate was issued by the given `otherCert`. - * @since v15.6.0 - */ - checkIssued(otherCert: X509Certificate): boolean; - /** - * Checks whether the public key for this certificate is consistent with - * the given private key. - * @since v15.6.0 - * @param privateKey A private key. - */ - checkPrivateKey(privateKey: KeyObject): boolean; - /** - * There is no standard JSON encoding for X509 certificates. The`toJSON()` method returns a string containing the PEM encoded - * certificate. - * @since v15.6.0 - */ - toJSON(): string; - /** - * Returns information about this certificate using the legacy `certificate object` encoding. - * @since v15.6.0 - */ - toLegacyObject(): PeerCertificate; - /** - * Returns the PEM-encoded certificate. - * @since v15.6.0 - */ - toString(): string; - /** - * Verifies that this certificate was signed by the given public key. - * Does not perform any other validation checks on the certificate. - * @since v15.6.0 - * @param publicKey A public key. - */ - verify(publicKey: KeyObject): boolean; - } - type LargeNumberLike = NodeJS.ArrayBufferView | SharedArrayBuffer | ArrayBuffer | bigint; - interface GeneratePrimeOptions { - add?: LargeNumberLike | undefined; - rem?: LargeNumberLike | undefined; - /** - * @default false - */ - safe?: boolean | undefined; - bigint?: boolean | undefined; - } - interface GeneratePrimeOptionsBigInt extends GeneratePrimeOptions { - bigint: true; - } - interface GeneratePrimeOptionsArrayBuffer extends GeneratePrimeOptions { - bigint?: false | undefined; - } - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrime(size: number, callback: (err: Error | null, prime: ArrayBuffer) => void): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsBigInt, - callback: (err: Error | null, prime: bigint) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptionsArrayBuffer, - callback: (err: Error | null, prime: ArrayBuffer) => void, - ): void; - function generatePrime( - size: number, - options: GeneratePrimeOptions, - callback: (err: Error | null, prime: ArrayBuffer | bigint) => void, - ): void; - /** - * Generates a pseudorandom prime of `size` bits. - * - * If `options.safe` is `true`, the prime will be a safe prime -- that is,`(prime - 1) / 2` will also be a prime. - * - * The `options.add` and `options.rem` parameters can be used to enforce additional - * requirements, e.g., for Diffie-Hellman: - * - * * If `options.add` and `options.rem` are both set, the prime will satisfy the - * condition that `prime % add = rem`. - * * If only `options.add` is set and `options.safe` is not `true`, the prime will - * satisfy the condition that `prime % add = 1`. - * * If only `options.add` is set and `options.safe` is set to `true`, the prime - * will instead satisfy the condition that `prime % add = 3`. This is necessary - * because `prime % add = 1` for `options.add > 2` would contradict the condition - * enforced by `options.safe`. - * * `options.rem` is ignored if `options.add` is not given. - * - * Both `options.add` and `options.rem` must be encoded as big-endian sequences - * if given as an `ArrayBuffer`, `SharedArrayBuffer`, `TypedArray`, `Buffer`, or`DataView`. - * - * By default, the prime is encoded as a big-endian sequence of octets - * in an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer). If the `bigint` option is `true`, then a - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) is provided. - * @since v15.8.0 - * @param size The size (in bits) of the prime to generate. - */ - function generatePrimeSync(size: number): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsBigInt): bigint; - function generatePrimeSync(size: number, options: GeneratePrimeOptionsArrayBuffer): ArrayBuffer; - function generatePrimeSync(size: number, options: GeneratePrimeOptions): ArrayBuffer | bigint; - interface CheckPrimeOptions { - /** - * The number of Miller-Rabin probabilistic primality iterations to perform. - * When the value is 0 (zero), a number of checks is used that yields a false positive rate of at most `2**-64` for random input. - * Care must be used when selecting a number of checks. - * Refer to the OpenSSL documentation for the BN_is_prime_ex function nchecks options for more details. - * - * @default 0 - */ - checks?: number | undefined; - } - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - */ - function checkPrime(value: LargeNumberLike, callback: (err: Error | null, result: boolean) => void): void; - function checkPrime( - value: LargeNumberLike, - options: CheckPrimeOptions, - callback: (err: Error | null, result: boolean) => void, - ): void; - /** - * Checks the primality of the `candidate`. - * @since v15.8.0 - * @param candidate A possible prime encoded as a sequence of big endian octets of arbitrary length. - * @return `true` if the candidate is a prime with an error probability less than `0.25 ** options.checks`. - */ - function checkPrimeSync(candidate: LargeNumberLike, options?: CheckPrimeOptions): boolean; - /** - * Load and set the `engine` for some or all OpenSSL functions (selected by flags). - * - * `engine` could be either an id or a path to the engine's shared library. - * - * The optional `flags` argument uses `ENGINE_METHOD_ALL` by default. The `flags`is a bit field taking one of or a mix of the following flags (defined in`crypto.constants`): - * - * * `crypto.constants.ENGINE_METHOD_RSA` - * * `crypto.constants.ENGINE_METHOD_DSA` - * * `crypto.constants.ENGINE_METHOD_DH` - * * `crypto.constants.ENGINE_METHOD_RAND` - * * `crypto.constants.ENGINE_METHOD_EC` - * * `crypto.constants.ENGINE_METHOD_CIPHERS` - * * `crypto.constants.ENGINE_METHOD_DIGESTS` - * * `crypto.constants.ENGINE_METHOD_PKEY_METHS` - * * `crypto.constants.ENGINE_METHOD_PKEY_ASN1_METHS` - * * `crypto.constants.ENGINE_METHOD_ALL` - * * `crypto.constants.ENGINE_METHOD_NONE` - * @since v0.11.11 - * @param flags - */ - function setEngine(engine: string, flags?: number): void; - /** - * A convenient alias for {@link webcrypto.getRandomValues}. This - * implementation is not compliant with the Web Crypto spec, to write - * web-compatible code use {@link webcrypto.getRandomValues} instead. - * @since v17.4.0 - * @return Returns `typedArray`. - */ - function getRandomValues(typedArray: T): T; - /** - * A convenient alias for `crypto.webcrypto.subtle`. - * @since v17.4.0 - */ - const subtle: webcrypto.SubtleCrypto; - /** - * An implementation of the Web Crypto API standard. - * - * See the {@link https://nodejs.org/docs/latest/api/webcrypto.html Web Crypto API documentation} for details. - * @since v15.0.0 - */ - const webcrypto: webcrypto.Crypto; - namespace webcrypto { - type BufferSource = ArrayBufferView | ArrayBuffer; - type KeyFormat = "jwk" | "pkcs8" | "raw" | "spki"; - type KeyType = "private" | "public" | "secret"; - type KeyUsage = - | "decrypt" - | "deriveBits" - | "deriveKey" - | "encrypt" - | "sign" - | "unwrapKey" - | "verify" - | "wrapKey"; - type AlgorithmIdentifier = Algorithm | string; - type HashAlgorithmIdentifier = AlgorithmIdentifier; - type NamedCurve = string; - type BigInteger = Uint8Array; - interface AesCbcParams extends Algorithm { - iv: BufferSource; - } - interface AesCtrParams extends Algorithm { - counter: BufferSource; - length: number; - } - interface AesDerivedKeyParams extends Algorithm { - length: number; - } - interface AesGcmParams extends Algorithm { - additionalData?: BufferSource; - iv: BufferSource; - tagLength?: number; - } - interface AesKeyAlgorithm extends KeyAlgorithm { - length: number; - } - interface AesKeyGenParams extends Algorithm { - length: number; - } - interface Algorithm { - name: string; - } - interface EcKeyAlgorithm extends KeyAlgorithm { - namedCurve: NamedCurve; - } - interface EcKeyGenParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcKeyImportParams extends Algorithm { - namedCurve: NamedCurve; - } - interface EcdhKeyDeriveParams extends Algorithm { - public: CryptoKey; - } - interface EcdsaParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface Ed448Params extends Algorithm { - context?: BufferSource; - } - interface HkdfParams extends Algorithm { - hash: HashAlgorithmIdentifier; - info: BufferSource; - salt: BufferSource; - } - interface HmacImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface HmacKeyAlgorithm extends KeyAlgorithm { - hash: KeyAlgorithm; - length: number; - } - interface HmacKeyGenParams extends Algorithm { - hash: HashAlgorithmIdentifier; - length?: number; - } - interface JsonWebKey { - alg?: string; - crv?: string; - d?: string; - dp?: string; - dq?: string; - e?: string; - ext?: boolean; - k?: string; - key_ops?: string[]; - kty?: string; - n?: string; - oth?: RsaOtherPrimesInfo[]; - p?: string; - q?: string; - qi?: string; - use?: string; - x?: string; - y?: string; - } - interface KeyAlgorithm { - name: string; - } - interface Pbkdf2Params extends Algorithm { - hash: HashAlgorithmIdentifier; - iterations: number; - salt: BufferSource; - } - interface RsaHashedImportParams extends Algorithm { - hash: HashAlgorithmIdentifier; - } - interface RsaHashedKeyAlgorithm extends RsaKeyAlgorithm { - hash: KeyAlgorithm; - } - interface RsaHashedKeyGenParams extends RsaKeyGenParams { - hash: HashAlgorithmIdentifier; - } - interface RsaKeyAlgorithm extends KeyAlgorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaKeyGenParams extends Algorithm { - modulusLength: number; - publicExponent: BigInteger; - } - interface RsaOaepParams extends Algorithm { - label?: BufferSource; - } - interface RsaOtherPrimesInfo { - d?: string; - r?: string; - t?: string; - } - interface RsaPssParams extends Algorithm { - saltLength: number; - } - /** - * Calling `require('node:crypto').webcrypto` returns an instance of the `Crypto` class. - * `Crypto` is a singleton that provides access to the remainder of the crypto API. - * @since v15.0.0 - */ - interface Crypto { - /** - * Provides access to the `SubtleCrypto` API. - * @since v15.0.0 - */ - readonly subtle: SubtleCrypto; - /** - * Generates cryptographically strong random values. - * The given `typedArray` is filled with random values, and a reference to `typedArray` is returned. - * - * The given `typedArray` must be an integer-based instance of {@link NodeJS.TypedArray}, i.e. `Float32Array` and `Float64Array` are not accepted. - * - * An error will be thrown if the given `typedArray` is larger than 65,536 bytes. - * @since v15.0.0 - */ - getRandomValues>(typedArray: T): T; - /** - * Generates a random {@link https://www.rfc-editor.org/rfc/rfc4122.txt RFC 4122} version 4 UUID. - * The UUID is generated using a cryptographic pseudorandom number generator. - * @since v16.7.0 - */ - randomUUID(): string; - CryptoKey: CryptoKeyConstructor; - } - // This constructor throws ILLEGAL_CONSTRUCTOR so it should not be newable. - interface CryptoKeyConstructor { - /** Illegal constructor */ - (_: { readonly _: unique symbol }): never; // Allows instanceof to work but not be callable by the user. - readonly length: 0; - readonly name: "CryptoKey"; - readonly prototype: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface CryptoKey { - /** - * An object detailing the algorithm for which the key can be used along with additional algorithm-specific parameters. - * @since v15.0.0 - */ - readonly algorithm: KeyAlgorithm; - /** - * When `true`, the {@link CryptoKey} can be extracted using either `subtleCrypto.exportKey()` or `subtleCrypto.wrapKey()`. - * @since v15.0.0 - */ - readonly extractable: boolean; - /** - * A string identifying whether the key is a symmetric (`'secret'`) or asymmetric (`'private'` or `'public'`) key. - * @since v15.0.0 - */ - readonly type: KeyType; - /** - * An array of strings identifying the operations for which the key may be used. - * - * The possible usages are: - * - `'encrypt'` - The key may be used to encrypt data. - * - `'decrypt'` - The key may be used to decrypt data. - * - `'sign'` - The key may be used to generate digital signatures. - * - `'verify'` - The key may be used to verify digital signatures. - * - `'deriveKey'` - The key may be used to derive a new key. - * - `'deriveBits'` - The key may be used to derive bits. - * - `'wrapKey'` - The key may be used to wrap another key. - * - `'unwrapKey'` - The key may be used to unwrap another key. - * - * Valid key usages depend on the key algorithm (identified by `cryptokey.algorithm.name`). - * @since v15.0.0 - */ - readonly usages: KeyUsage[]; - } - /** - * The `CryptoKeyPair` is a simple dictionary object with `publicKey` and `privateKey` properties, representing an asymmetric key pair. - * @since v15.0.0 - */ - interface CryptoKeyPair { - /** - * A {@link CryptoKey} whose type will be `'private'`. - * @since v15.0.0 - */ - privateKey: CryptoKey; - /** - * A {@link CryptoKey} whose type will be `'public'`. - * @since v15.0.0 - */ - publicKey: CryptoKey; - } - /** - * @since v15.0.0 - */ - interface SubtleCrypto { - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `key`, - * `subtle.decrypt()` attempts to decipher the provided `data`. If successful, - * the returned promise will be resolved with an `` containing the plaintext result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - decrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Using the method and parameters specified in `algorithm` and the keying material provided by `baseKey`, - * `subtle.deriveBits()` attempts to generate `length` bits. - * The Node.js implementation requires that when `length` is a number it must be multiple of `8`. - * When `length` is `null` the maximum number of bits for a given algorithm is generated. This is allowed - * for the `'ECDH'`, `'X25519'`, and `'X448'` algorithms. - * If successful, the returned promise will be resolved with an `` containing the generated data. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @since v15.0.0 - */ - deriveBits(algorithm: EcdhKeyDeriveParams, baseKey: CryptoKey, length: number | null): Promise; - deriveBits( - algorithm: AlgorithmIdentifier | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - length: number, - ): Promise; - /** - * Using the method and parameters specified in `algorithm`, and the keying material provided by `baseKey`, - * `subtle.deriveKey()` attempts to generate a new ` based on the method and parameters in `derivedKeyAlgorithm`. - * - * Calling `subtle.deriveKey()` is equivalent to calling `subtle.deriveBits()` to generate raw keying material, - * then passing the result into the `subtle.importKey()` method using the `deriveKeyAlgorithm`, `extractable`, and `keyUsages` parameters as input. - * - * The algorithms currently supported include: - * - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HKDF'` - * - `'PBKDF2'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - deriveKey( - algorithm: AlgorithmIdentifier | EcdhKeyDeriveParams | HkdfParams | Pbkdf2Params, - baseKey: CryptoKey, - derivedKeyAlgorithm: - | AlgorithmIdentifier - | AesDerivedKeyParams - | HmacImportParams - | HkdfParams - | Pbkdf2Params, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - /** - * Using the method identified by `algorithm`, `subtle.digest()` attempts to generate a digest of `data`. - * If successful, the returned promise is resolved with an `` containing the computed digest. - * - * If `algorithm` is provided as a ``, it must be one of: - * - * - `'SHA-1'` - * - `'SHA-256'` - * - `'SHA-384'` - * - `'SHA-512'` - * - * If `algorithm` is provided as an ``, it must have a `name` property whose value is one of the above. - * @since v15.0.0 - */ - digest(algorithm: AlgorithmIdentifier, data: BufferSource): Promise; - /** - * Using the method and parameters specified by `algorithm` and the keying material provided by `key`, - * `subtle.encrypt()` attempts to encipher `data`. If successful, - * the returned promise is resolved with an `` containing the encrypted result. - * - * The algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * @since v15.0.0 - */ - encrypt( - algorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * Exports the given key into the specified format, if supported. - * - * If the `` is not extractable, the returned promise will reject. - * - * When `format` is either `'pkcs8'` or `'spki'` and the export is successful, - * the returned promise will be resolved with an `` containing the exported key data. - * - * When `format` is `'jwk'` and the export is successful, the returned promise will be resolved with a - * JavaScript object conforming to the {@link https://tools.ietf.org/html/rfc7517 JSON Web Key} specification. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @returns `` containing ``. - * @since v15.0.0 - */ - exportKey(format: "jwk", key: CryptoKey): Promise; - exportKey(format: Exclude, key: CryptoKey): Promise; - /** - * Using the method and parameters provided in `algorithm`, - * `subtle.generateKey()` attempts to generate new keying material. - * Depending the method used, the method may generate either a single `` or a ``. - * - * The `` (public and private key) generating algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * The `` (secret key) generating algorithms supported include: - * - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - generateKey( - algorithm: RsaHashedKeyGenParams | EcKeyGenParams, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AesKeyGenParams | HmacKeyGenParams | Pbkdf2Params, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - generateKey( - algorithm: AlgorithmIdentifier, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * The `subtle.importKey()` method attempts to interpret the provided `keyData` as the given `format` - * to create a `` instance using the provided `algorithm`, `extractable`, and `keyUsages` arguments. - * If the import is successful, the returned promise will be resolved with the created ``. - * - * If importing a `'PBKDF2'` key, `extractable` must be `false`. - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - importKey( - format: "jwk", - keyData: JsonWebKey, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: readonly KeyUsage[], - ): Promise; - importKey( - format: Exclude, - keyData: BufferSource, - algorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given by `algorithm` and the keying material provided by `key`, - * `subtle.sign()` attempts to generate a cryptographic signature of `data`. If successful, - * the returned promise is resolved with an `` containing the generated signature. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - sign( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.unwrapKey()` method attempts to decrypt a wrapped key and create a `` instance. - * It is equivalent to calling `subtle.decrypt()` first on the encrypted key data (using the `wrappedKey`, `unwrapAlgo`, and `unwrappingKey` arguments as input) - * then passing the results in to the `subtle.importKey()` method using the `unwrappedKeyAlgo`, `extractable`, and `keyUsages` arguments as inputs. - * If successful, the returned promise is resolved with a `` object. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * - * The unwrapped key algorithms supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'RSA-OAEP'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'ECDH'` - * - `'X25519'` - * - `'X448'` - * - `'HMAC'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @param keyUsages See {@link https://nodejs.org/docs/latest/api/webcrypto.html#cryptokeyusages Key usages}. - * @since v15.0.0 - */ - unwrapKey( - format: KeyFormat, - wrappedKey: BufferSource, - unwrappingKey: CryptoKey, - unwrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - unwrappedKeyAlgorithm: - | AlgorithmIdentifier - | RsaHashedImportParams - | EcKeyImportParams - | HmacImportParams - | AesKeyAlgorithm, - extractable: boolean, - keyUsages: KeyUsage[], - ): Promise; - /** - * Using the method and parameters given in `algorithm` and the keying material provided by `key`, - * `subtle.verify()` attempts to verify that `signature` is a valid cryptographic signature of `data`. - * The returned promise is resolved with either `true` or `false`. - * - * The algorithms currently supported include: - * - * - `'RSASSA-PKCS1-v1_5'` - * - `'RSA-PSS'` - * - `'ECDSA'` - * - `'Ed25519'` - * - `'Ed448'` - * - `'HMAC'` - * @since v15.0.0 - */ - verify( - algorithm: AlgorithmIdentifier | RsaPssParams | EcdsaParams | Ed448Params, - key: CryptoKey, - signature: BufferSource, - data: BufferSource, - ): Promise; - /** - * In cryptography, "wrapping a key" refers to exporting and then encrypting the keying material. - * The `subtle.wrapKey()` method exports the keying material into the format identified by `format`, - * then encrypts it using the method and parameters specified by `wrapAlgo` and the keying material provided by `wrappingKey`. - * It is the equivalent to calling `subtle.exportKey()` using `format` and `key` as the arguments, - * then passing the result to the `subtle.encrypt()` method using `wrappingKey` and `wrapAlgo` as inputs. - * If successful, the returned promise will be resolved with an `` containing the encrypted key data. - * - * The wrapping algorithms currently supported include: - * - * - `'RSA-OAEP'` - * - `'AES-CTR'` - * - `'AES-CBC'` - * - `'AES-GCM'` - * - `'AES-KW'` - * @param format Must be one of `'raw'`, `'pkcs8'`, `'spki'`, or `'jwk'`. - * @since v15.0.0 - */ - wrapKey( - format: KeyFormat, - key: CryptoKey, - wrappingKey: CryptoKey, - wrapAlgorithm: AlgorithmIdentifier | RsaOaepParams | AesCtrParams | AesCbcParams | AesGcmParams, - ): Promise; - } - } -} -declare module "node:crypto" { - export * from "crypto"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/dgram.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/dgram.d.ts deleted file mode 100644 index 692e547f..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/dgram.d.ts +++ /dev/null @@ -1,586 +0,0 @@ -/** - * The `node:dgram` module provides an implementation of UDP datagram sockets. - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dgram.js) - */ -declare module "dgram" { - import { AddressInfo } from "node:net"; - import * as dns from "node:dns"; - import { Abortable, EventEmitter } from "node:events"; - interface RemoteInfo { - address: string; - family: "IPv4" | "IPv6"; - port: number; - size: number; - } - interface BindOptions { - port?: number | undefined; - address?: string | undefined; - exclusive?: boolean | undefined; - fd?: number | undefined; - } - type SocketType = "udp4" | "udp6"; - interface SocketOptions extends Abortable { - type: SocketType; - reuseAddr?: boolean | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - recvBufferSize?: number | undefined; - sendBufferSize?: number | undefined; - lookup?: - | (( - hostname: string, - options: dns.LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ) => void) - | undefined; - } - /** - * Creates a `dgram.Socket` object. Once the socket is created, calling `socket.bind()` will instruct the socket to begin listening for datagram - * messages. When `address` and `port` are not passed to `socket.bind()` the - * method will bind the socket to the "all interfaces" address on a random port - * (it does the right thing for both `udp4` and `udp6` sockets). The bound address - * and port can be retrieved using `socket.address().address` and `socket.address().port`. - * - * If the `signal` option is enabled, calling `.abort()` on the corresponding`AbortController` is similar to calling `.close()` on the socket: - * - * ```js - * const controller = new AbortController(); - * const { signal } = controller; - * const server = dgram.createSocket({ type: 'udp4', signal }); - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * // Later, when you want to close the server. - * controller.abort(); - * ``` - * @since v0.11.13 - * @param options Available options are: - * @param callback Attached as a listener for `'message'` events. Optional. - */ - function createSocket(type: SocketType, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - function createSocket(options: SocketOptions, callback?: (msg: Buffer, rinfo: RemoteInfo) => void): Socket; - /** - * Encapsulates the datagram functionality. - * - * New instances of `dgram.Socket` are created using {@link createSocket}. - * The `new` keyword is not to be used to create `dgram.Socket` instances. - * @since v0.1.99 - */ - class Socket extends EventEmitter { - /** - * Tells the kernel to join a multicast group at the given `multicastAddress` and`multicastInterface` using the `IP_ADD_MEMBERSHIP` socket option. If the`multicastInterface` argument is not - * specified, the operating system will choose - * one interface and will add membership to it. To add membership to every - * available interface, call `addMembership` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * - * When sharing a UDP socket across multiple `cluster` workers, the`socket.addMembership()` function must be called only once or an`EADDRINUSE` error will occur: - * - * ```js - * import cluster from 'node:cluster'; - * import dgram from 'node:dgram'; - * - * if (cluster.isPrimary) { - * cluster.fork(); // Works ok. - * cluster.fork(); // Fails with EADDRINUSE. - * } else { - * const s = dgram.createSocket('udp4'); - * s.bind(1234, () => { - * s.addMembership('224.0.0.114'); - * }); - * } - * ``` - * @since v0.6.9 - */ - addMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * Returns an object containing the address information for a socket. - * For UDP sockets, this object will contain `address`, `family`, and `port`properties. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.99 - */ - address(): AddressInfo; - /** - * For UDP sockets, causes the `dgram.Socket` to listen for datagram - * messages on a named `port` and optional `address`. If `port` is not - * specified or is `0`, the operating system will attempt to bind to a - * random port. If `address` is not specified, the operating system will - * attempt to listen on all addresses. Once binding is complete, a`'listening'` event is emitted and the optional `callback` function is - * called. - * - * Specifying both a `'listening'` event listener and passing a`callback` to the `socket.bind()` method is not harmful but not very - * useful. - * - * A bound datagram socket keeps the Node.js process running to receive - * datagram messages. - * - * If binding fails, an `'error'` event is generated. In rare case (e.g. - * attempting to bind with a closed socket), an `Error` may be thrown. - * - * Example of a UDP server listening on port 41234: - * - * ```js - * import dgram from 'node:dgram'; - * - * const server = dgram.createSocket('udp4'); - * - * server.on('error', (err) => { - * console.error(`server error:\n${err.stack}`); - * server.close(); - * }); - * - * server.on('message', (msg, rinfo) => { - * console.log(`server got: ${msg} from ${rinfo.address}:${rinfo.port}`); - * }); - * - * server.on('listening', () => { - * const address = server.address(); - * console.log(`server listening ${address.address}:${address.port}`); - * }); - * - * server.bind(41234); - * // Prints: server listening 0.0.0.0:41234 - * ``` - * @since v0.1.99 - * @param callback with no parameters. Called when binding is complete. - */ - bind(port?: number, address?: string, callback?: () => void): this; - bind(port?: number, callback?: () => void): this; - bind(callback?: () => void): this; - bind(options: BindOptions, callback?: () => void): this; - /** - * Close the underlying socket and stop listening for data on it. If a callback is - * provided, it is added as a listener for the `'close'` event. - * @since v0.1.99 - * @param callback Called when the socket has been closed. - */ - close(callback?: () => void): this; - /** - * Associates the `dgram.Socket` to a remote address and port. Every - * message sent by this handle is automatically sent to that destination. Also, - * the socket will only receive messages from that remote peer. - * Trying to call `connect()` on an already connected socket will result - * in an `ERR_SOCKET_DGRAM_IS_CONNECTED` exception. If `address` is not - * provided, `'127.0.0.1'` (for `udp4` sockets) or `'::1'` (for `udp6` sockets) - * will be used by default. Once the connection is complete, a `'connect'` event - * is emitted and the optional `callback` function is called. In case of failure, - * the `callback` is called or, failing this, an `'error'` event is emitted. - * @since v12.0.0 - * @param callback Called when the connection is completed or on error. - */ - connect(port: number, address?: string, callback?: () => void): void; - connect(port: number, callback: () => void): void; - /** - * A synchronous function that disassociates a connected `dgram.Socket` from - * its remote address. Trying to call `disconnect()` on an unbound or already - * disconnected socket will result in an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception. - * @since v12.0.0 - */ - disconnect(): void; - /** - * Instructs the kernel to leave a multicast group at `multicastAddress` using the`IP_DROP_MEMBERSHIP` socket option. This method is automatically called by the - * kernel when the socket is closed or the process terminates, so most apps will - * never have reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v0.6.9 - */ - dropMembership(multicastAddress: string, multicastInterface?: string): void; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_RCVBUF` socket receive buffer size in bytes. - */ - getRecvBufferSize(): number; - /** - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - * @return the `SO_SNDBUF` socket send buffer size in bytes. - */ - getSendBufferSize(): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active. The `socket.ref()` method adds the socket back to the reference - * counting and restores the default behavior. - * - * Calling `socket.ref()` multiples times will have no additional effect. - * - * The `socket.ref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - ref(): this; - /** - * Returns an object containing the `address`, `family`, and `port` of the remote - * endpoint. This method throws an `ERR_SOCKET_DGRAM_NOT_CONNECTED` exception - * if the socket is not connected. - * @since v12.0.0 - */ - remoteAddress(): AddressInfo; - /** - * Broadcasts a datagram on the socket. - * For connectionless sockets, the destination `port` and `address` must be - * specified. Connected sockets, on the other hand, will use their associated - * remote endpoint, so the `port` and `address` arguments must not be set. - * - * The `msg` argument contains the message to be sent. - * Depending on its type, different behavior can apply. If `msg` is a `Buffer`, - * any `TypedArray` or a `DataView`, - * the `offset` and `length` specify the offset within the `Buffer` where the - * message begins and the number of bytes in the message, respectively. - * If `msg` is a `String`, then it is automatically converted to a `Buffer`with `'utf8'` encoding. With messages that - * contain multi-byte characters, `offset` and `length` will be calculated with - * respect to `byte length` and not the character position. - * If `msg` is an array, `offset` and `length` must not be specified. - * - * The `address` argument is a string. If the value of `address` is a host name, - * DNS will be used to resolve the address of the host. If `address` is not - * provided or otherwise nullish, `'127.0.0.1'` (for `udp4` sockets) or `'::1'`(for `udp6` sockets) will be used by default. - * - * If the socket has not been previously bound with a call to `bind`, the socket - * is assigned a random port number and is bound to the "all interfaces" address - * (`'0.0.0.0'` for `udp4` sockets, `'::0'` for `udp6` sockets.) - * - * An optional `callback` function may be specified to as a way of reporting - * DNS errors or for determining when it is safe to reuse the `buf` object. - * DNS lookups delay the time to send for at least one tick of the - * Node.js event loop. - * - * The only way to know for sure that the datagram has been sent is by using a`callback`. If an error occurs and a `callback` is given, the error will be - * passed as the first argument to the `callback`. If a `callback` is not given, - * the error is emitted as an `'error'` event on the `socket` object. - * - * Offset and length are optional but both _must_ be set if either are used. - * They are supported only when the first argument is a `Buffer`, a `TypedArray`, - * or a `DataView`. - * - * This method throws `ERR_SOCKET_BAD_PORT` if called on an unbound socket. - * - * Example of sending a UDP packet to a port on `localhost`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.send(message, 41234, 'localhost', (err) => { - * client.close(); - * }); - * ``` - * - * Example of sending a UDP packet composed of multiple buffers to a port on`127.0.0.1`; - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const buf1 = Buffer.from('Some '); - * const buf2 = Buffer.from('bytes'); - * const client = dgram.createSocket('udp4'); - * client.send([buf1, buf2], 41234, (err) => { - * client.close(); - * }); - * ``` - * - * Sending multiple buffers might be faster or slower depending on the - * application and operating system. Run benchmarks to - * determine the optimal strategy on a case-by-case basis. Generally speaking, - * however, sending multiple buffers is faster. - * - * Example of sending a UDP packet using a socket connected to a port on`localhost`: - * - * ```js - * import dgram from 'node:dgram'; - * import { Buffer } from 'node:buffer'; - * - * const message = Buffer.from('Some bytes'); - * const client = dgram.createSocket('udp4'); - * client.connect(41234, 'localhost', (err) => { - * client.send(message, (err) => { - * client.close(); - * }); - * }); - * ``` - * @since v0.1.99 - * @param msg Message to be sent. - * @param offset Offset in the buffer where the message starts. - * @param length Number of bytes in the message. - * @param port Destination port. - * @param address Destination host name or IP address. - * @param callback Called when the message has been sent. - */ - send( - msg: string | Uint8Array | readonly any[], - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array | readonly any[], - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array | readonly any[], - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - port?: number, - address?: string, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - port?: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - send( - msg: string | Uint8Array, - offset: number, - length: number, - callback?: (error: Error | null, bytes: number) => void, - ): void; - /** - * Sets or clears the `SO_BROADCAST` socket option. When set to `true`, UDP - * packets may be sent to a local interface's broadcast address. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.6.9 - */ - setBroadcast(flag: boolean): void; - /** - * _All references to scope in this section are referring to [IPv6 Zone Indices](https://en.wikipedia.org/wiki/IPv6_address#Scoped_literal_IPv6_addresses), which are defined by [RFC - * 4007](https://tools.ietf.org/html/rfc4007). In string form, an IP_ - * _with a scope index is written as `'IP%scope'` where scope is an interface name_ - * _or interface number._ - * - * Sets the default outgoing multicast interface of the socket to a chosen - * interface or back to system interface selection. The `multicastInterface` must - * be a valid string representation of an IP from the socket's family. - * - * For IPv4 sockets, this should be the IP configured for the desired physical - * interface. All packets sent to multicast on the socket will be sent on the - * interface determined by the most recent successful use of this call. - * - * For IPv6 sockets, `multicastInterface` should include a scope to indicate the - * interface as in the examples that follow. In IPv6, individual `send` calls can - * also use explicit scope in addresses, so only packets sent to a multicast - * address without specifying an explicit scope are affected by the most recent - * successful use of this call. - * - * This method throws `EBADF` if called on an unbound socket. - * - * #### Example: IPv6 outgoing multicast interface - * - * On most systems, where scope format uses the interface name: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%eth1'); - * }); - * ``` - * - * On Windows, where scope format uses an interface number: - * - * ```js - * const socket = dgram.createSocket('udp6'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('::%2'); - * }); - * ``` - * - * #### Example: IPv4 outgoing multicast interface - * - * All systems use an IP of the host on the desired physical interface: - * - * ```js - * const socket = dgram.createSocket('udp4'); - * - * socket.bind(1234, () => { - * socket.setMulticastInterface('10.0.0.2'); - * }); - * ``` - * @since v8.6.0 - */ - setMulticastInterface(multicastInterface: string): void; - /** - * Sets or clears the `IP_MULTICAST_LOOP` socket option. When set to `true`, - * multicast packets will also be received on the local interface. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastLoopback(flag: boolean): boolean; - /** - * Sets the `IP_MULTICAST_TTL` socket option. While TTL generally stands for - * "Time to Live", in this context it specifies the number of IP hops that a - * packet is allowed to travel through, specifically for multicast traffic. Each - * router or gateway that forwards a packet decrements the TTL. If the TTL is - * decremented to 0 by a router, it will not be forwarded. - * - * The `ttl` argument may be between 0 and 255\. The default on most systems is `1`. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.3.8 - */ - setMulticastTTL(ttl: number): number; - /** - * Sets the `SO_RCVBUF` socket option. Sets the maximum socket receive buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setRecvBufferSize(size: number): void; - /** - * Sets the `SO_SNDBUF` socket option. Sets the maximum socket send buffer - * in bytes. - * - * This method throws `ERR_SOCKET_BUFFER_SIZE` if called on an unbound socket. - * @since v8.7.0 - */ - setSendBufferSize(size: number): void; - /** - * Sets the `IP_TTL` socket option. While TTL generally stands for "Time to Live", - * in this context it specifies the number of IP hops that a packet is allowed to - * travel through. Each router or gateway that forwards a packet decrements the - * TTL. If the TTL is decremented to 0 by a router, it will not be forwarded. - * Changing TTL values is typically done for network probes or when multicasting. - * - * The `ttl` argument may be between 1 and 255\. The default on most systems - * is 64. - * - * This method throws `EBADF` if called on an unbound socket. - * @since v0.1.101 - */ - setTTL(ttl: number): number; - /** - * By default, binding a socket will cause it to block the Node.js process from - * exiting as long as the socket is open. The `socket.unref()` method can be used - * to exclude the socket from the reference counting that keeps the Node.js - * process active, allowing the process to exit even if the socket is still - * listening. - * - * Calling `socket.unref()` multiple times will have no additional effect. - * - * The `socket.unref()` method returns a reference to the socket so calls can be - * chained. - * @since v0.9.1 - */ - unref(): this; - /** - * Tells the kernel to join a source-specific multicast channel at the given`sourceAddress` and `groupAddress`, using the `multicastInterface` with the`IP_ADD_SOURCE_MEMBERSHIP` socket - * option. If the `multicastInterface` argument - * is not specified, the operating system will choose one interface and will add - * membership to it. To add membership to every available interface, call`socket.addSourceSpecificMembership()` multiple times, once per interface. - * - * When called on an unbound socket, this method will implicitly bind to a random - * port, listening on all interfaces. - * @since v13.1.0, v12.16.0 - */ - addSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * Instructs the kernel to leave a source-specific multicast channel at the given`sourceAddress` and `groupAddress` using the `IP_DROP_SOURCE_MEMBERSHIP`socket option. This method is - * automatically called by the kernel when the - * socket is closed or the process terminates, so most apps will never have - * reason to call this. - * - * If `multicastInterface` is not specified, the operating system will attempt to - * drop membership on all valid interfaces. - * @since v13.1.0, v12.16.0 - */ - dropSourceSpecificMembership(sourceAddress: string, groupAddress: string, multicastInterface?: string): void; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. error - * 4. listening - * 5. message - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connect"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "message", msg: Buffer, rinfo: RemoteInfo): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connect", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connect", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "message", listener: (msg: Buffer, rinfo: RemoteInfo) => void): this; - /** - * Calls `socket.close()` and returns a promise that fulfills when the socket has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } -} -declare module "node:dgram" { - export * from "dgram"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts deleted file mode 100644 index b02f5917..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/diagnostics_channel.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -/** - * The `node:diagnostics_channel` module provides an API to create named channels - * to report arbitrary message data for diagnostics purposes. - * - * It can be accessed using: - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * ``` - * - * It is intended that a module writer wanting to report diagnostics messages - * will create one or many top-level channels to report messages through. - * Channels may also be acquired at runtime but it is not encouraged - * due to the additional overhead of doing so. Channels may be exported for - * convenience, but as long as the name is known it can be acquired anywhere. - * - * If you intend for your module to produce diagnostics data for others to - * consume it is recommended that you include documentation of what named - * channels are used along with the shape of the message data. Channel names - * should generally include the module name to avoid collisions with data from - * other modules. - * @since v15.1.0, v14.17.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/diagnostics_channel.js) - */ -declare module "diagnostics_channel" { - /** - * Check if there are active subscribers to the named channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * if (diagnostics_channel.hasSubscribers('my-channel')) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return If there are active subscribers - */ - function hasSubscribers(name: string | symbol): boolean; - /** - * This is the primary entry-point for anyone wanting to publish to a named - * channel. It produces a channel object which is optimized to reduce overhead at - * publish time as much as possible. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * ``` - * @since v15.1.0, v14.17.0 - * @param name The channel name - * @return The named channel object - */ - function channel(name: string | symbol): Channel; - type ChannelListener = (message: unknown, name: string | symbol) => void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * diagnostics_channel.subscribe('my-channel', (message, name) => { - * // Received data - * }); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The handler to receive channel messages - */ - function subscribe(name: string | symbol, onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with {@link subscribe}. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * function onMessage(message, name) { - * // Received data - * } - * - * diagnostics_channel.subscribe('my-channel', onMessage); - * - * diagnostics_channel.unsubscribe('my-channel', onMessage); - * ``` - * @since v18.7.0, v16.17.0 - * @param name The channel name - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - function unsubscribe(name: string | symbol, onMessage: ChannelListener): boolean; - /** - * The class `Channel` represents an individual named channel within the data - * pipeline. It is used to track subscribers and to publish messages when there - * are subscribers present. It exists as a separate object to avoid channel - * lookups at publish time, enabling very fast publish speeds and allowing - * for heavy use while incurring very minimal cost. Channels are created with {@link channel}, constructing a channel directly - * with `new Channel(name)` is not supported. - * @since v15.1.0, v14.17.0 - */ - class Channel { - readonly name: string | symbol; - /** - * Check if there are active subscribers to this channel. This is helpful if - * the message you want to send might be expensive to prepare. - * - * This API is optional but helpful when trying to publish messages from very - * performance-sensitive code. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * if (channel.hasSubscribers) { - * // There are subscribers, prepare and publish message - * } - * ``` - * @since v15.1.0, v14.17.0 - */ - readonly hasSubscribers: boolean; - private constructor(name: string | symbol); - /** - * Publish a message to any subscribers to the channel. This will trigger - * message handlers synchronously so they will execute within the same context. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.publish({ - * some: 'message', - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @param message The message to send to the channel subscribers - */ - publish(message: unknown): void; - /** - * Register a message handler to subscribe to this channel. This message handler - * will be run synchronously whenever a message is published to the channel. Any - * errors thrown in the message handler will trigger an `'uncaughtException'`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * channel.subscribe((message, name) => { - * // Received data - * }); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link subscribe(name, onMessage)} - * @param onMessage The handler to receive channel messages - */ - subscribe(onMessage: ChannelListener): void; - /** - * Remove a message handler previously registered to this channel with `channel.subscribe(onMessage)`. - * - * ```js - * import diagnostics_channel from 'node:diagnostics_channel'; - * - * const channel = diagnostics_channel.channel('my-channel'); - * - * function onMessage(message, name) { - * // Received data - * } - * - * channel.subscribe(onMessage); - * - * channel.unsubscribe(onMessage); - * ``` - * @since v15.1.0, v14.17.0 - * @deprecated Since v18.7.0,v16.17.0 - Use {@link unsubscribe(name, onMessage)} - * @param onMessage The previous subscribed handler to remove - * @return `true` if the handler was found, `false` otherwise. - */ - unsubscribe(onMessage: ChannelListener): void; - } -} -declare module "node:diagnostics_channel" { - export * from "diagnostics_channel"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/dns.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/dns.d.ts deleted file mode 100644 index 380cf7d7..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/dns.d.ts +++ /dev/null @@ -1,809 +0,0 @@ -/** - * The `node:dns` module enables name resolution. For example, use it to look up IP - * addresses of host names. - * - * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the - * DNS protocol for lookups. {@link lookup} uses the operating system - * facilities to perform name resolution. It may not need to perform any network - * communication. To perform name resolution the way other applications on the same - * system do, use {@link lookup}. - * - * ```js - * const dns = require('node:dns'); - * - * dns.lookup('example.org', (err, address, family) => { - * console.log('address: %j family: IPv%s', address, family); - * }); - * // address: "93.184.216.34" family: IPv4 - * ``` - * - * All other functions in the `node:dns` module connect to an actual DNS server to - * perform name resolution. They will always use the network to perform DNS - * queries. These functions do not use the same set of configuration files used by {@link lookup} (e.g. `/etc/hosts`). Use these functions to always perform - * DNS queries, bypassing other name-resolution facilities. - * - * ```js - * const dns = require('node:dns'); - * - * dns.resolve4('archive.org', (err, addresses) => { - * if (err) throw err; - * - * console.log(`addresses: ${JSON.stringify(addresses)}`); - * - * addresses.forEach((a) => { - * dns.reverse(a, (err, hostnames) => { - * if (err) { - * throw err; - * } - * console.log(`reverse for ${a}: ${JSON.stringify(hostnames)}`); - * }); - * }); - * }); - * ``` - * - * See the `Implementation considerations section` for more information. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/dns.js) - */ -declare module "dns" { - import * as dnsPromises from "node:dns/promises"; - // Supported getaddrinfo flags. - export const ADDRCONFIG: number; - export const V4MAPPED: number; - /** - * If `dns.V4MAPPED` is specified, return resolved IPv6 addresses as - * well as IPv4 mapped IPv6 addresses. - */ - export const ALL: number; - export interface LookupOptions { - family?: number | undefined; - hints?: number | undefined; - all?: boolean | undefined; - /** - * @default true - */ - verbatim?: boolean | undefined; - } - export interface LookupOneOptions extends LookupOptions { - all?: false | undefined; - } - export interface LookupAllOptions extends LookupOptions { - all: true; - } - export interface LookupAddress { - address: string; - family: number; - } - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then - * IPv4 and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the arguments for `callback` change to`(err, addresses)`, with `addresses` being an array of objects with the - * properties `address` and `family`. - * - * On error, `err` is an `Error` object, where `err.code` is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * `dns.lookup()` does not necessarily have anything to do with the DNS protocol. - * The implementation uses an operating system facility that can associate names - * with addresses and vice versa. This implementation can have subtle but - * important consequences on the behavior of any Node.js program. Please take some - * time to consult the `Implementation considerations section` before using`dns.lookup()`. - * - * Example usage: - * - * ```js - * const dns = require('node:dns'); - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * dns.lookup('example.com', options, (err, address, family) => - * console.log('address: %j family: IPv%s', address, family)); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dns.lookup('example.com', options, (err, addresses) => - * console.log('addresses: %j', addresses)); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * ``` - * - * If this method is invoked as its `util.promisify()` ed version, and `all`is not set to `true`, it returns a `Promise` for an `Object` with `address` and`family` properties. - * @since v0.1.90 - */ - export function lookup( - hostname: string, - family: number, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOneOptions, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export function lookup( - hostname: string, - options: LookupAllOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: LookupAddress[]) => void, - ): void; - export function lookup( - hostname: string, - options: LookupOptions, - callback: (err: NodeJS.ErrnoException | null, address: string | LookupAddress[], family: number) => void, - ): void; - export function lookup( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: string, family: number) => void, - ): void; - export namespace lookup { - function __promisify__(hostname: string, options: LookupAllOptions): Promise; - function __promisify__(hostname: string, options?: LookupOneOptions | number): Promise; - function __promisify__(hostname: string, options: LookupOptions): Promise; - } - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. - * - * On an error, `err` is an `Error` object, where `err.code` is the error code. - * - * ```js - * const dns = require('node:dns'); - * dns.lookupService('127.0.0.1', 22, (err, hostname, service) => { - * console.log(hostname, service); - * // Prints: localhost ssh - * }); - * ``` - * - * If this method is invoked as its `util.promisify()` ed version, it returns a`Promise` for an `Object` with `hostname` and `service` properties. - * @since v0.11.14 - */ - export function lookupService( - address: string, - port: number, - callback: (err: NodeJS.ErrnoException | null, hostname: string, service: string) => void, - ): void; - export namespace lookupService { - function __promisify__( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - } - export interface ResolveOptions { - ttl: boolean; - } - export interface ResolveWithTtlOptions extends ResolveOptions { - ttl: true; - } - export interface RecordWithTtl { - address: string; - ttl: number; - } - /** @deprecated Use `AnyARecord` or `AnyAaaaRecord` instead. */ - export type AnyRecordWithTtl = AnyARecord | AnyAaaaRecord; - export interface AnyARecord extends RecordWithTtl { - type: "A"; - } - export interface AnyAaaaRecord extends RecordWithTtl { - type: "AAAA"; - } - export interface CaaRecord { - critical: number; - issue?: string | undefined; - issuewild?: string | undefined; - iodef?: string | undefined; - contactemail?: string | undefined; - contactphone?: string | undefined; - } - export interface MxRecord { - priority: number; - exchange: string; - } - export interface AnyMxRecord extends MxRecord { - type: "MX"; - } - export interface NaptrRecord { - flags: string; - service: string; - regexp: string; - replacement: string; - order: number; - preference: number; - } - export interface AnyNaptrRecord extends NaptrRecord { - type: "NAPTR"; - } - export interface SoaRecord { - nsname: string; - hostmaster: string; - serial: number; - refresh: number; - retry: number; - expire: number; - minttl: number; - } - export interface AnySoaRecord extends SoaRecord { - type: "SOA"; - } - export interface SrvRecord { - priority: number; - weight: number; - port: number; - name: string; - } - export interface AnySrvRecord extends SrvRecord { - type: "SRV"; - } - export interface AnyTxtRecord { - type: "TXT"; - entries: string[]; - } - export interface AnyNsRecord { - type: "NS"; - value: string; - } - export interface AnyPtrRecord { - type: "PTR"; - value: string; - } - export interface AnyCnameRecord { - type: "CNAME"; - value: string; - } - export type AnyRecord = - | AnyARecord - | AnyAaaaRecord - | AnyCnameRecord - | AnyMxRecord - | AnyNaptrRecord - | AnyNsRecord - | AnyPtrRecord - | AnySoaRecord - | AnySrvRecord - | AnyTxtRecord; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. The `callback` function has arguments`(err, records)`. When successful, `records` will be an array of resource - * records. The type and structure of individual results varies based on `rrtype`: - * - * - * - * On error, `err` is an `Error` object, where `err.code` is one of the `DNS error codes`. - * @since v0.1.27 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - export function resolve( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "A", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "AAAA", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "ANY", - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "CNAME", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "MX", - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "NAPTR", - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "NS", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "PTR", - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SOA", - callback: (err: NodeJS.ErrnoException | null, addresses: SoaRecord) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "SRV", - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: "TXT", - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export function resolve( - hostname: string, - rrtype: string, - callback: ( - err: NodeJS.ErrnoException | null, - addresses: string[] | MxRecord[] | NaptrRecord[] | SoaRecord | SrvRecord[] | string[][] | AnyRecord[], - ) => void, - ): void; - export namespace resolve { - function __promisify__(hostname: string, rrtype?: "A" | "AAAA" | "CNAME" | "NS" | "PTR"): Promise; - function __promisify__(hostname: string, rrtype: "ANY"): Promise; - function __promisify__(hostname: string, rrtype: "MX"): Promise; - function __promisify__(hostname: string, rrtype: "NAPTR"): Promise; - function __promisify__(hostname: string, rrtype: "SOA"): Promise; - function __promisify__(hostname: string, rrtype: "SRV"): Promise; - function __promisify__(hostname: string, rrtype: "TXT"): Promise; - function __promisify__( - hostname: string, - rrtype: string, - ): Promise; - } - /** - * Uses the DNS protocol to resolve a IPv4 addresses (`A` records) for the`hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv4 addresses (e.g.`['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve4( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve4( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve4 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. The `addresses` argument passed to the `callback` function - * will contain an array of IPv6 addresses. - * @since v0.1.16 - * @param hostname Host name to resolve. - */ - export function resolve6( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveWithTtlOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: RecordWithTtl[]) => void, - ): void; - export function resolve6( - hostname: string, - options: ResolveOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: string[] | RecordWithTtl[]) => void, - ): void; - export namespace resolve6 { - function __promisify__(hostname: string): Promise; - function __promisify__(hostname: string, options: ResolveWithTtlOptions): Promise; - function __promisify__(hostname: string, options?: ResolveOptions): Promise; - } - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. The`addresses` argument passed to the `callback` function - * will contain an array of canonical name records available for the `hostname`(e.g. `['bar.example.com']`). - * @since v0.3.2 - */ - export function resolveCname( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveCname { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. The`addresses` argument passed to the `callback` function - * will contain an array of certification authority authorization records - * available for the `hostname` (e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'}, {critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - export function resolveCaa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, records: CaaRecord[]) => void, - ): void; - export namespace resolveCaa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of objects containing both a `priority` and `exchange`property (e.g. `[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v0.1.27 - */ - export function resolveMx( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: MxRecord[]) => void, - ): void; - export namespace resolveMx { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. The `addresses` argument passed to the `callback`function will contain an array of - * objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v0.9.12 - */ - export function resolveNaptr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: NaptrRecord[]) => void, - ): void; - export namespace resolveNaptr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * contain an array of name server records available for `hostname`(e.g. `['ns1.example.com', 'ns2.example.com']`). - * @since v0.1.90 - */ - export function resolveNs( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolveNs { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * be an array of strings containing the reply records. - * @since v6.0.0 - */ - export function resolvePtr( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[]) => void, - ): void; - export namespace resolvePtr { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. The `address` argument passed to the `callback` function will - * be an object with the following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v0.11.10 - */ - export function resolveSoa( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, address: SoaRecord) => void, - ): void; - export namespace resolveSoa { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. The `addresses` argument passed to the `callback` function will - * be an array of objects with the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v0.1.27 - */ - export function resolveSrv( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: SrvRecord[]) => void, - ): void; - export namespace resolveSrv { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. The `records` argument passed to the `callback` function is a - * two-dimensional array of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v0.1.27 - */ - export function resolveTxt( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: string[][]) => void, - ): void; - export namespace resolveTxt { - function __promisify__(hostname: string): Promise; - } - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * The `ret` argument passed to the `callback` function will be an array containing - * various types of records. Each object has a property `type` that indicates the - * type of the current record. And depending on the `type`, additional properties - * will be present on the object: - * - * - * - * Here is an example of the `ret` object passed to the callback: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * - * DNS server operators may choose not to respond to `ANY`queries. It may be better to call individual methods like {@link resolve4},{@link resolveMx}, and so on. For more details, see [RFC - * 8482](https://tools.ietf.org/html/rfc8482). - */ - export function resolveAny( - hostname: string, - callback: (err: NodeJS.ErrnoException | null, addresses: AnyRecord[]) => void, - ): void; - export namespace resolveAny { - function __promisify__(hostname: string): Promise; - } - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, `err` is an `Error` object, where `err.code` is - * one of the `DNS error codes`. - * @since v0.1.16 - */ - export function reverse( - ip: string, - callback: (err: NodeJS.ErrnoException | null, hostnames: string[]) => void, - ): void; - /** - * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: for `verbatim` defaulting to `false`. - * * `verbatim`: for `verbatim` defaulting to `true`. - * @since v20.1.0 - */ - export function getDefaultResultOrder(): "ipv4first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dns.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dns.setServers()` method must not be called while a DNS query is in - * progress. - * - * The {@link setServers} method affects only {@link resolve},`dns.resolve*()` and {@link reverse} (and specifically _not_ {@link lookup}). - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v0.11.3 - * @param servers array of `RFC 5952` formatted addresses - */ - export function setServers(servers: readonly string[]): void; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v0.11.3 - */ - export function getServers(): string[]; - /** - * Set the default value of `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: sets default `verbatim` `false`. - * * `verbatim`: sets default `verbatim` `true`. - * - * The default is `verbatim` and {@link setDefaultResultOrder} have higher - * priority than `--dns-result-order`. When using `worker threads`,{@link setDefaultResultOrder} from the main thread won't affect the default - * dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'` or `'verbatim'`. - */ - export function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; - // Error codes - export const NODATA: string; - export const FORMERR: string; - export const SERVFAIL: string; - export const NOTFOUND: string; - export const NOTIMP: string; - export const REFUSED: string; - export const BADQUERY: string; - export const BADNAME: string; - export const BADFAMILY: string; - export const BADRESP: string; - export const CONNREFUSED: string; - export const TIMEOUT: string; - export const EOF: string; - export const FILE: string; - export const NOMEM: string; - export const DESTRUCTION: string; - export const BADSTR: string; - export const BADFLAGS: string; - export const NONAME: string; - export const BADHINTS: string; - export const NOTINITIALIZED: string; - export const LOADIPHLPAPI: string; - export const ADDRGETNETWORKPARAMS: string; - export const CANCELLED: string; - export interface ResolverOptions { - timeout?: number | undefined; - /** - * @default 4 - */ - tries?: number; - } - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using `resolver.setServers()` does not affect - * other resolvers: - * - * ```js - * const { Resolver } = require('node:dns'); - * const resolver = new Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org', (err, addresses) => { - * // ... - * }); - * ``` - * - * The following methods from the `node:dns` module are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v8.3.0 - */ - export class Resolver { - constructor(options?: ResolverOptions); - /** - * Cancel all outstanding DNS queries made by this resolver. The corresponding - * callbacks will be called with an error with code `ECANCELLED`. - * @since v8.3.0 - */ - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - /** - * The resolver instance will send its requests from the specified IP address. - * This allows programs to specify outbound interfaces when used on multi-homed - * systems. - * - * If a v4 or v6 address is not specified, it is set to the default and the - * operating system will choose a local address automatically. - * - * The resolver will use the v4 local address when making requests to IPv4 DNS - * servers, and the v6 local address when making requests to IPv6 DNS servers. - * The `rrtype` of resolution requests has no impact on the local address used. - * @since v15.1.0, v14.17.0 - * @param [ipv4='0.0.0.0'] A string representation of an IPv4 address. - * @param [ipv6='::0'] A string representation of an IPv6 address. - */ - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } - export { dnsPromises as promises }; -} -declare module "node:dns" { - export * from "dns"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/dns/promises.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/dns/promises.d.ts deleted file mode 100644 index ef9b2228..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/dns/promises.d.ts +++ /dev/null @@ -1,425 +0,0 @@ -/** - * The `dns.promises` API provides an alternative set of asynchronous DNS methods - * that return `Promise` objects rather than using callbacks. The API is accessible - * via `require('node:dns').promises` or `require('node:dns/promises')`. - * @since v10.6.0 - */ -declare module "dns/promises" { - import { - AnyRecord, - CaaRecord, - LookupAddress, - LookupAllOptions, - LookupOneOptions, - LookupOptions, - MxRecord, - NaptrRecord, - RecordWithTtl, - ResolveOptions, - ResolverOptions, - ResolveWithTtlOptions, - SoaRecord, - SrvRecord, - } from "node:dns"; - /** - * Returns an array of IP address strings, formatted according to [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6), - * that are currently configured for DNS resolution. A string will include a port - * section if a custom port is used. - * - * ```js - * [ - * '4.4.4.4', - * '2001:4860:4860::8888', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ] - * ``` - * @since v10.6.0 - */ - function getServers(): string[]; - /** - * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or - * AAAA (IPv6) record. All `option` properties are optional. If `options` is an - * integer, then it must be `4` or `6` – if `options` is not provided, then IPv4 - * and IPv6 addresses are both returned if found. - * - * With the `all` option set to `true`, the `Promise` is resolved with `addresses`being an array of objects with the properties `address` and `family`. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. - * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when - * the host name does not exist but also when the lookup fails in other ways - * such as no available file descriptors. - * - * `dnsPromises.lookup()` does not necessarily have anything to do with the DNS - * protocol. The implementation uses an operating system facility that can - * associate names with addresses and vice versa. This implementation can have - * subtle but important consequences on the behavior of any Node.js program. Please - * take some time to consult the `Implementation considerations section` before - * using `dnsPromises.lookup()`. - * - * Example usage: - * - * ```js - * const dns = require('node:dns'); - * const dnsPromises = dns.promises; - * const options = { - * family: 6, - * hints: dns.ADDRCONFIG | dns.V4MAPPED, - * }; - * - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('address: %j family: IPv%s', result.address, result.family); - * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6 - * }); - * - * // When options.all is true, the result will be an Array. - * options.all = true; - * dnsPromises.lookup('example.com', options).then((result) => { - * console.log('addresses: %j', result); - * // addresses: [{"address":"2606:2800:220:1:248:1893:25c8:1946","family":6}] - * }); - * ``` - * @since v10.6.0 - */ - function lookup(hostname: string, family: number): Promise; - function lookup(hostname: string, options: LookupOneOptions): Promise; - function lookup(hostname: string, options: LookupAllOptions): Promise; - function lookup(hostname: string, options: LookupOptions): Promise; - function lookup(hostname: string): Promise; - /** - * Resolves the given `address` and `port` into a host name and service using - * the operating system's underlying `getnameinfo` implementation. - * - * If `address` is not a valid IP address, a `TypeError` will be thrown. - * The `port` will be coerced to a number. If it is not a legal port, a `TypeError`will be thrown. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is the error code. - * - * ```js - * const dnsPromises = require('node:dns').promises; - * dnsPromises.lookupService('127.0.0.1', 22).then((result) => { - * console.log(result.hostname, result.service); - * // Prints: localhost ssh - * }); - * ``` - * @since v10.6.0 - */ - function lookupService( - address: string, - port: number, - ): Promise<{ - hostname: string; - service: string; - }>; - /** - * Uses the DNS protocol to resolve a host name (e.g. `'nodejs.org'`) into an array - * of the resource records. When successful, the `Promise` is resolved with an - * array of resource records. The type and structure of individual results vary - * based on `rrtype`: - * - * - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. - * @since v10.6.0 - * @param hostname Host name to resolve. - * @param [rrtype='A'] Resource record type. - */ - function resolve(hostname: string): Promise; - function resolve(hostname: string, rrtype: "A"): Promise; - function resolve(hostname: string, rrtype: "AAAA"): Promise; - function resolve(hostname: string, rrtype: "ANY"): Promise; - function resolve(hostname: string, rrtype: "CAA"): Promise; - function resolve(hostname: string, rrtype: "CNAME"): Promise; - function resolve(hostname: string, rrtype: "MX"): Promise; - function resolve(hostname: string, rrtype: "NAPTR"): Promise; - function resolve(hostname: string, rrtype: "NS"): Promise; - function resolve(hostname: string, rrtype: "PTR"): Promise; - function resolve(hostname: string, rrtype: "SOA"): Promise; - function resolve(hostname: string, rrtype: "SRV"): Promise; - function resolve(hostname: string, rrtype: "TXT"): Promise; - function resolve( - hostname: string, - rrtype: string, - ): Promise; - /** - * Uses the DNS protocol to resolve IPv4 addresses (`A` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv4 - * addresses (e.g. `['74.125.79.104', '74.125.79.105', '74.125.79.106']`). - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve4(hostname: string): Promise; - function resolve4(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve4(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve IPv6 addresses (`AAAA` records) for the`hostname`. On success, the `Promise` is resolved with an array of IPv6 - * addresses. - * @since v10.6.0 - * @param hostname Host name to resolve. - */ - function resolve6(hostname: string): Promise; - function resolve6(hostname: string, options: ResolveWithTtlOptions): Promise; - function resolve6(hostname: string, options: ResolveOptions): Promise; - /** - * Uses the DNS protocol to resolve all records (also known as `ANY` or `*` query). - * On success, the `Promise` is resolved with an array containing various types of - * records. Each object has a property `type` that indicates the type of the - * current record. And depending on the `type`, additional properties will be - * present on the object: - * - * - * - * Here is an example of the result object: - * - * ```js - * [ { type: 'A', address: '127.0.0.1', ttl: 299 }, - * { type: 'CNAME', value: 'example.com' }, - * { type: 'MX', exchange: 'alt4.aspmx.l.example.com', priority: 50 }, - * { type: 'NS', value: 'ns1.example.com' }, - * { type: 'TXT', entries: [ 'v=spf1 include:_spf.example.com ~all' ] }, - * { type: 'SOA', - * nsname: 'ns1.example.com', - * hostmaster: 'admin.example.com', - * serial: 156696742, - * refresh: 900, - * retry: 900, - * expire: 1800, - * minttl: 60 } ] - * ``` - * @since v10.6.0 - */ - function resolveAny(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CAA` records for the `hostname`. On success, - * the `Promise` is resolved with an array of objects containing available - * certification authority authorization records available for the `hostname`(e.g. `[{critical: 0, iodef: 'mailto:pki@example.com'},{critical: 128, issue: 'pki.example.com'}]`). - * @since v15.0.0, v14.17.0 - */ - function resolveCaa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve `CNAME` records for the `hostname`. On success, - * the `Promise` is resolved with an array of canonical name records available for - * the `hostname` (e.g. `['bar.example.com']`). - * @since v10.6.0 - */ - function resolveCname(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve mail exchange records (`MX` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects - * containing both a `priority` and `exchange` property (e.g.`[{priority: 10, exchange: 'mx.example.com'}, ...]`). - * @since v10.6.0 - */ - function resolveMx(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve regular expression-based records (`NAPTR`records) for the `hostname`. On success, the `Promise` is resolved with an array - * of objects with the following properties: - * - * * `flags` - * * `service` - * * `regexp` - * * `replacement` - * * `order` - * * `preference` - * - * ```js - * { - * flags: 's', - * service: 'SIP+D2U', - * regexp: '', - * replacement: '_sip._udp.example.com', - * order: 30, - * preference: 100 - * } - * ``` - * @since v10.6.0 - */ - function resolveNaptr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve name server records (`NS` records) for the`hostname`. On success, the `Promise` is resolved with an array of name server - * records available for `hostname` (e.g.`['ns1.example.com', 'ns2.example.com']`). - * @since v10.6.0 - */ - function resolveNs(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve pointer records (`PTR` records) for the`hostname`. On success, the `Promise` is resolved with an array of strings - * containing the reply records. - * @since v10.6.0 - */ - function resolvePtr(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve a start of authority record (`SOA` record) for - * the `hostname`. On success, the `Promise` is resolved with an object with the - * following properties: - * - * * `nsname` - * * `hostmaster` - * * `serial` - * * `refresh` - * * `retry` - * * `expire` - * * `minttl` - * - * ```js - * { - * nsname: 'ns.example.com', - * hostmaster: 'root.example.com', - * serial: 2013101809, - * refresh: 10000, - * retry: 2400, - * expire: 604800, - * minttl: 3600 - * } - * ``` - * @since v10.6.0 - */ - function resolveSoa(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve service records (`SRV` records) for the`hostname`. On success, the `Promise` is resolved with an array of objects with - * the following properties: - * - * * `priority` - * * `weight` - * * `port` - * * `name` - * - * ```js - * { - * priority: 10, - * weight: 5, - * port: 21223, - * name: 'service.example.com' - * } - * ``` - * @since v10.6.0 - */ - function resolveSrv(hostname: string): Promise; - /** - * Uses the DNS protocol to resolve text queries (`TXT` records) for the`hostname`. On success, the `Promise` is resolved with a two-dimensional array - * of the text records available for `hostname` (e.g.`[ ['v=spf1 ip4:0.0.0.0 ', '~all' ] ]`). Each sub-array contains TXT chunks of - * one record. Depending on the use case, these could be either joined together or - * treated separately. - * @since v10.6.0 - */ - function resolveTxt(hostname: string): Promise; - /** - * Performs a reverse DNS query that resolves an IPv4 or IPv6 address to an - * array of host names. - * - * On error, the `Promise` is rejected with an `Error` object, where `err.code`is one of the `DNS error codes`. - * @since v10.6.0 - */ - function reverse(ip: string): Promise; - /** - * Get the default value for `verbatim` in {@link lookup} and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: for `verbatim` defaulting to `false`. - * * `verbatim`: for `verbatim` defaulting to `true`. - * @since v20.1.0 - */ - function getDefaultResultOrder(): "ipv4first" | "verbatim"; - /** - * Sets the IP address and port of servers to be used when performing DNS - * resolution. The `servers` argument is an array of [RFC 5952](https://tools.ietf.org/html/rfc5952#section-6) formatted - * addresses. If the port is the IANA default DNS port (53) it can be omitted. - * - * ```js - * dnsPromises.setServers([ - * '4.4.4.4', - * '[2001:4860:4860::8888]', - * '4.4.4.4:1053', - * '[2001:4860:4860::8888]:1053', - * ]); - * ``` - * - * An error will be thrown if an invalid address is provided. - * - * The `dnsPromises.setServers()` method must not be called while a DNS query is in - * progress. - * - * This method works much like [resolve.conf](https://man7.org/linux/man-pages/man5/resolv.conf.5.html). - * That is, if attempting to resolve with the first server provided results in a`NOTFOUND` error, the `resolve()` method will _not_ attempt to resolve with - * subsequent servers provided. Fallback DNS servers will only be used if the - * earlier ones time out or result in some other error. - * @since v10.6.0 - * @param servers array of `RFC 5952` formatted addresses - */ - function setServers(servers: readonly string[]): void; - /** - * Set the default value of `verbatim` in `dns.lookup()` and `dnsPromises.lookup()`. The value could be: - * - * * `ipv4first`: sets default `verbatim` `false`. - * * `verbatim`: sets default `verbatim` `true`. - * - * The default is `verbatim` and `dnsPromises.setDefaultResultOrder()` have - * higher priority than `--dns-result-order`. When using `worker threads`,`dnsPromises.setDefaultResultOrder()` from the main thread won't affect the - * default dns orders in workers. - * @since v16.4.0, v14.18.0 - * @param order must be `'ipv4first'` or `'verbatim'`. - */ - function setDefaultResultOrder(order: "ipv4first" | "verbatim"): void; - /** - * An independent resolver for DNS requests. - * - * Creating a new resolver uses the default server settings. Setting - * the servers used for a resolver using `resolver.setServers()` does not affect - * other resolvers: - * - * ```js - * const { Resolver } = require('node:dns').promises; - * const resolver = new Resolver(); - * resolver.setServers(['4.4.4.4']); - * - * // This request will use the server at 4.4.4.4, independent of global settings. - * resolver.resolve4('example.org').then((addresses) => { - * // ... - * }); - * - * // Alternatively, the same code can be written using async-await style. - * (async function() { - * const addresses = await resolver.resolve4('example.org'); - * })(); - * ``` - * - * The following methods from the `dnsPromises` API are available: - * - * * `resolver.getServers()` - * * `resolver.resolve()` - * * `resolver.resolve4()` - * * `resolver.resolve6()` - * * `resolver.resolveAny()` - * * `resolver.resolveCaa()` - * * `resolver.resolveCname()` - * * `resolver.resolveMx()` - * * `resolver.resolveNaptr()` - * * `resolver.resolveNs()` - * * `resolver.resolvePtr()` - * * `resolver.resolveSoa()` - * * `resolver.resolveSrv()` - * * `resolver.resolveTxt()` - * * `resolver.reverse()` - * * `resolver.setServers()` - * @since v10.6.0 - */ - class Resolver { - constructor(options?: ResolverOptions); - cancel(): void; - getServers: typeof getServers; - resolve: typeof resolve; - resolve4: typeof resolve4; - resolve6: typeof resolve6; - resolveAny: typeof resolveAny; - resolveCaa: typeof resolveCaa; - resolveCname: typeof resolveCname; - resolveMx: typeof resolveMx; - resolveNaptr: typeof resolveNaptr; - resolveNs: typeof resolveNs; - resolvePtr: typeof resolvePtr; - resolveSoa: typeof resolveSoa; - resolveSrv: typeof resolveSrv; - resolveTxt: typeof resolveTxt; - reverse: typeof reverse; - setLocalAddress(ipv4?: string, ipv6?: string): void; - setServers: typeof setServers; - } -} -declare module "node:dns/promises" { - export * from "dns/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/dom-events.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/dom-events.d.ts deleted file mode 100644 index 147a7b65..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/dom-events.d.ts +++ /dev/null @@ -1,122 +0,0 @@ -export {}; // Don't export anything! - -//// DOM-like Events -// NB: The Event / EventTarget / EventListener implementations below were copied -// from lib.dom.d.ts, then edited to reflect Node's documentation at -// https://nodejs.org/api/events.html#class-eventtarget. -// Please read that link to understand important implementation differences. - -// This conditional type will be the existing global Event in a browser, or -// the copy below in a Node environment. -type __Event = typeof globalThis extends { onmessage: any; Event: any } ? {} - : { - /** This is not used in Node.js and is provided purely for completeness. */ - readonly bubbles: boolean; - /** Alias for event.stopPropagation(). This is not used in Node.js and is provided purely for completeness. */ - cancelBubble: () => void; - /** True if the event was created with the cancelable option */ - readonly cancelable: boolean; - /** This is not used in Node.js and is provided purely for completeness. */ - readonly composed: boolean; - /** Returns an array containing the current EventTarget as the only entry or empty if the event is not being dispatched. This is not used in Node.js and is provided purely for completeness. */ - composedPath(): [EventTarget?]; - /** Alias for event.target. */ - readonly currentTarget: EventTarget | null; - /** Is true if cancelable is true and event.preventDefault() has been called. */ - readonly defaultPrevented: boolean; - /** This is not used in Node.js and is provided purely for completeness. */ - readonly eventPhase: 0 | 2; - /** The `AbortSignal` "abort" event is emitted with `isTrusted` set to `true`. The value is `false` in all other cases. */ - readonly isTrusted: boolean; - /** Sets the `defaultPrevented` property to `true` if `cancelable` is `true`. */ - preventDefault(): void; - /** This is not used in Node.js and is provided purely for completeness. */ - returnValue: boolean; - /** Alias for event.target. */ - readonly srcElement: EventTarget | null; - /** Stops the invocation of event listeners after the current one completes. */ - stopImmediatePropagation(): void; - /** This is not used in Node.js and is provided purely for completeness. */ - stopPropagation(): void; - /** The `EventTarget` dispatching the event */ - readonly target: EventTarget | null; - /** The millisecond timestamp when the Event object was created. */ - readonly timeStamp: number; - /** Returns the type of event, e.g. "click", "hashchange", or "submit". */ - readonly type: string; - }; - -// See comment above explaining conditional type -type __EventTarget = typeof globalThis extends { onmessage: any; EventTarget: any } ? {} - : { - /** - * Adds a new handler for the `type` event. Any given `listener` is added only once per `type` and per `capture` option value. - * - * If the `once` option is true, the `listener` is removed after the next time a `type` event is dispatched. - * - * The `capture` option is not used by Node.js in any functional way other than tracking registered event listeners per the `EventTarget` specification. - * Specifically, the `capture` option is used as part of the key when registering a `listener`. - * Any individual `listener` may be added once with `capture = false`, and once with `capture = true`. - */ - addEventListener( - type: string, - listener: EventListener | EventListenerObject, - options?: AddEventListenerOptions | boolean, - ): void; - /** Dispatches a synthetic event event to target and returns true if either event's cancelable attribute value is false or its preventDefault() method was not invoked, and false otherwise. */ - dispatchEvent(event: Event): boolean; - /** Removes the event listener in target's event listener list with the same type, callback, and options. */ - removeEventListener( - type: string, - listener: EventListener | EventListenerObject, - options?: EventListenerOptions | boolean, - ): void; - }; - -interface EventInit { - bubbles?: boolean; - cancelable?: boolean; - composed?: boolean; -} - -interface EventListenerOptions { - /** Not directly used by Node.js. Added for API completeness. Default: `false`. */ - capture?: boolean; -} - -interface AddEventListenerOptions extends EventListenerOptions { - /** When `true`, the listener is automatically removed when it is first invoked. Default: `false`. */ - once?: boolean; - /** When `true`, serves as a hint that the listener will not call the `Event` object's `preventDefault()` method. Default: false. */ - passive?: boolean; -} - -interface EventListener { - (evt: Event): void; -} - -interface EventListenerObject { - handleEvent(object: Event): void; -} - -import {} from "events"; // Make this an ambient declaration -declare global { - /** An event which takes place in the DOM. */ - interface Event extends __Event {} - var Event: typeof globalThis extends { onmessage: any; Event: infer T } ? T - : { - prototype: __Event; - new(type: string, eventInitDict?: EventInit): __Event; - }; - - /** - * EventTarget is a DOM interface implemented by objects that can - * receive events and may have listeners for them. - */ - interface EventTarget extends __EventTarget {} - var EventTarget: typeof globalThis extends { onmessage: any; EventTarget: infer T } ? T - : { - prototype: __EventTarget; - new(): __EventTarget; - }; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/domain.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/domain.d.ts deleted file mode 100644 index 72f17bd8..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/domain.d.ts +++ /dev/null @@ -1,170 +0,0 @@ -/** - * **This module is pending deprecation.** Once a replacement API has been - * finalized, this module will be fully deprecated. Most developers should - * **not** have cause to use this module. Users who absolutely must have - * the functionality that domains provide may rely on it for the time being - * but should expect to have to migrate to a different solution - * in the future. - * - * Domains provide a way to handle multiple different IO operations as a - * single group. If any of the event emitters or callbacks registered to a - * domain emit an `'error'` event, or throw an error, then the domain object - * will be notified, rather than losing the context of the error in the`process.on('uncaughtException')` handler, or causing the program to - * exit immediately with an error code. - * @deprecated Since v1.4.2 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/domain.js) - */ -declare module "domain" { - import EventEmitter = require("node:events"); - /** - * The `Domain` class encapsulates the functionality of routing errors and - * uncaught exceptions to the active `Domain` object. - * - * To handle the errors that it catches, listen to its `'error'` event. - */ - class Domain extends EventEmitter { - /** - * An array of timers and event emitters that have been explicitly added - * to the domain. - */ - members: Array; - /** - * The `enter()` method is plumbing used by the `run()`, `bind()`, and`intercept()` methods to set the active domain. It sets `domain.active` and`process.domain` to the domain, and implicitly - * pushes the domain onto the domain - * stack managed by the domain module (see {@link exit} for details on the - * domain stack). The call to `enter()` delimits the beginning of a chain of - * asynchronous calls and I/O operations bound to a domain. - * - * Calling `enter()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - enter(): void; - /** - * The `exit()` method exits the current domain, popping it off the domain stack. - * Any time execution is going to switch to the context of a different chain of - * asynchronous calls, it's important to ensure that the current domain is exited. - * The call to `exit()` delimits either the end of or an interruption to the chain - * of asynchronous calls and I/O operations bound to a domain. - * - * If there are multiple, nested domains bound to the current execution context,`exit()` will exit any domains nested within this domain. - * - * Calling `exit()` changes only the active domain, and does not alter the domain - * itself. `enter()` and `exit()` can be called an arbitrary number of times on a - * single domain. - */ - exit(): void; - /** - * Run the supplied function in the context of the domain, implicitly - * binding all event emitters, timers, and low-level requests that are - * created in that context. Optionally, arguments can be passed to - * the function. - * - * This is the most basic way to use a domain. - * - * ```js - * const domain = require('node:domain'); - * const fs = require('node:fs'); - * const d = domain.create(); - * d.on('error', (er) => { - * console.error('Caught error!', er); - * }); - * d.run(() => { - * process.nextTick(() => { - * setTimeout(() => { // Simulating some various async stuff - * fs.open('non-existent file', 'r', (er, fd) => { - * if (er) throw er; - * // proceed... - * }); - * }, 100); - * }); - * }); - * ``` - * - * In this example, the `d.on('error')` handler will be triggered, rather - * than crashing the program. - */ - run(fn: (...args: any[]) => T, ...args: any[]): T; - /** - * Explicitly adds an emitter to the domain. If any event handlers called by - * the emitter throw an error, or if the emitter emits an `'error'` event, it - * will be routed to the domain's `'error'` event, just like with implicit - * binding. - * - * This also works with timers that are returned from `setInterval()` and `setTimeout()`. If their callback function throws, it will be caught by - * the domain `'error'` handler. - * - * If the Timer or `EventEmitter` was already bound to a domain, it is removed - * from that one, and bound to this one instead. - * @param emitter emitter or timer to be added to the domain - */ - add(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The opposite of {@link add}. Removes domain handling from the - * specified emitter. - * @param emitter emitter or timer to be removed from the domain - */ - remove(emitter: EventEmitter | NodeJS.Timer): void; - /** - * The returned function will be a wrapper around the supplied callback - * function. When the returned function is called, any errors that are - * thrown will be routed to the domain's `'error'` event. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.bind((er, data) => { - * // If this throws, it will also be passed to the domain. - * return cb(er, data ? JSON.parse(data) : null); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The bound function - */ - bind(callback: T): T; - /** - * This method is almost identical to {@link bind}. However, in - * addition to catching thrown errors, it will also intercept `Error` objects sent as the first argument to the function. - * - * In this way, the common `if (err) return callback(err);` pattern can be replaced - * with a single error handler in a single place. - * - * ```js - * const d = domain.create(); - * - * function readSomeFile(filename, cb) { - * fs.readFile(filename, 'utf8', d.intercept((data) => { - * // Note, the first argument is never passed to the - * // callback since it is assumed to be the 'Error' argument - * // and thus intercepted by the domain. - * - * // If this throws, it will also be passed to the domain - * // so the error-handling logic can be moved to the 'error' - * // event on the domain instead of being repeated throughout - * // the program. - * return cb(null, JSON.parse(data)); - * })); - * } - * - * d.on('error', (er) => { - * // An error occurred somewhere. If we throw it now, it will crash the program - * // with the normal line number and stack message. - * }); - * ``` - * @param callback The callback function - * @return The intercepted function - */ - intercept(callback: T): T; - } - function create(): Domain; -} -declare module "node:domain" { - export * from "domain"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/events.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/events.d.ts deleted file mode 100644 index 6ed47c53..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/events.d.ts +++ /dev/null @@ -1,879 +0,0 @@ -/** - * Much of the Node.js core API is built around an idiomatic asynchronous - * event-driven architecture in which certain kinds of objects (called "emitters") - * emit named events that cause `Function` objects ("listeners") to be called. - * - * For instance: a `net.Server` object emits an event each time a peer - * connects to it; a `fs.ReadStream` emits an event when the file is opened; - * a `stream` emits an event whenever data is available to be read. - * - * All objects that emit events are instances of the `EventEmitter` class. These - * objects expose an `eventEmitter.on()` function that allows one or more - * functions to be attached to named events emitted by the object. Typically, - * event names are camel-cased strings but any valid JavaScript property key - * can be used. - * - * When the `EventEmitter` object emits an event, all of the functions attached - * to that specific event are called _synchronously_. Any values returned by the - * called listeners are _ignored_ and discarded. - * - * The following example shows a simple `EventEmitter` instance with a single - * listener. The `eventEmitter.on()` method is used to register listeners, while - * the `eventEmitter.emit()` method is used to trigger the event. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * class MyEmitter extends EventEmitter {} - * - * const myEmitter = new MyEmitter(); - * myEmitter.on('event', () => { - * console.log('an event occurred!'); - * }); - * myEmitter.emit('event'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/events.js) - */ -declare module "events" { - import { AsyncResource, AsyncResourceOptions } from "node:async_hooks"; - // NOTE: This class is in the docs but is **not actually exported** by Node. - // If https://github.com/nodejs/node/issues/39903 gets resolved and Node - // actually starts exporting the class, uncomment below. - // import { EventListener, EventListenerObject } from '__dom-events'; - // /** The NodeEventTarget is a Node.js-specific extension to EventTarget that emulates a subset of the EventEmitter API. */ - // interface NodeEventTarget extends EventTarget { - // /** - // * Node.js-specific extension to the `EventTarget` class that emulates the equivalent `EventEmitter` API. - // * The only difference between `addListener()` and `addEventListener()` is that addListener() will return a reference to the EventTarget. - // */ - // addListener(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that returns an array of event `type` names for which event listeners are registered. */ - // eventNames(): string[]; - // /** Node.js-specific extension to the `EventTarget` class that returns the number of event listeners registered for the `type`. */ - // listenerCount(type: string): number; - // /** Node.js-specific alias for `eventTarget.removeListener()`. */ - // off(type: string, listener: EventListener | EventListenerObject): this; - // /** Node.js-specific alias for `eventTarget.addListener()`. */ - // on(type: string, listener: EventListener | EventListenerObject, options?: { once: boolean }): this; - // /** Node.js-specific extension to the `EventTarget` class that adds a `once` listener for the given event `type`. This is equivalent to calling `on` with the `once` option set to `true`. */ - // once(type: string, listener: EventListener | EventListenerObject): this; - // /** - // * Node.js-specific extension to the `EventTarget` class. - // * If `type` is specified, removes all registered listeners for `type`, - // * otherwise removes all registered listeners. - // */ - // removeAllListeners(type: string): this; - // /** - // * Node.js-specific extension to the `EventTarget` class that removes the listener for the given `type`. - // * The only difference between `removeListener()` and `removeEventListener()` is that `removeListener()` will return a reference to the `EventTarget`. - // */ - // removeListener(type: string, listener: EventListener | EventListenerObject): this; - // } - interface EventEmitterOptions { - /** - * Enables automatic capturing of promise rejection. - */ - captureRejections?: boolean | undefined; - } - // Any EventTarget with a Node-style `once` function - interface _NodeEventTarget { - once(eventName: string | symbol, listener: (...args: any[]) => void): this; - } - // Any EventTarget with a DOM-style `addEventListener` - interface _DOMEventTarget { - addEventListener( - eventName: string, - listener: (...args: any[]) => void, - opts?: { - once: boolean; - }, - ): any; - } - interface StaticEventEmitterOptions { - signal?: AbortSignal | undefined; - } - interface EventEmitter extends NodeJS.EventEmitter {} - /** - * The `EventEmitter` class is defined and exposed by the `node:events` module: - * - * ```js - * import { EventEmitter } from 'node:events'; - * ``` - * - * All `EventEmitter`s emit the event `'newListener'` when new listeners are - * added and `'removeListener'` when existing listeners are removed. - * - * It supports the following option: - * @since v0.1.26 - */ - class EventEmitter { - constructor(options?: EventEmitterOptions); - - [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void; - - /** - * Creates a `Promise` that is fulfilled when the `EventEmitter` emits the given - * event or that is rejected if the `EventEmitter` emits `'error'` while waiting. - * The `Promise` will resolve with an array of all the arguments emitted to the - * given event. - * - * This method is intentionally generic and works with the web platform [EventTarget](https://dom.spec.whatwg.org/#interface-eventtarget) interface, which has no special`'error'` event - * semantics and does not listen to the `'error'` event. - * - * ```js - * import { once, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * process.nextTick(() => { - * ee.emit('myevent', 42); - * }); - * - * const [value] = await once(ee, 'myevent'); - * console.log(value); - * - * const err = new Error('kaboom'); - * process.nextTick(() => { - * ee.emit('error', err); - * }); - * - * try { - * await once(ee, 'myevent'); - * } catch (err) { - * console.error('error happened', err); - * } - * ``` - * - * The special handling of the `'error'` event is only used when `events.once()`is used to wait for another event. If `events.once()` is used to wait for the - * '`error'` event itself, then it is treated as any other kind of event without - * special handling: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * - * once(ee, 'error') - * .then(([err]) => console.log('ok', err.message)) - * .catch((err) => console.error('error', err.message)); - * - * ee.emit('error', new Error('boom')); - * - * // Prints: ok boom - * ``` - * - * An `AbortSignal` can be used to cancel waiting for the event: - * - * ```js - * import { EventEmitter, once } from 'node:events'; - * - * const ee = new EventEmitter(); - * const ac = new AbortController(); - * - * async function foo(emitter, event, signal) { - * try { - * await once(emitter, event, { signal }); - * console.log('event emitted!'); - * } catch (error) { - * if (error.name === 'AbortError') { - * console.error('Waiting for the event was canceled!'); - * } else { - * console.error('There was an error', error.message); - * } - * } - * } - * - * foo(ee, 'foo', ac.signal); - * ac.abort(); // Abort waiting for the event - * ee.emit('foo'); // Prints: Waiting for the event was canceled! - * ``` - * @since v11.13.0, v10.16.0 - */ - static once( - emitter: _NodeEventTarget, - eventName: string | symbol, - options?: StaticEventEmitterOptions, - ): Promise; - static once(emitter: _DOMEventTarget, eventName: string, options?: StaticEventEmitterOptions): Promise; - /** - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo')) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * ``` - * - * Returns an `AsyncIterator` that iterates `eventName` events. It will throw - * if the `EventEmitter` emits `'error'`. It removes all listeners when - * exiting the loop. The `value` returned by each iteration is an array - * composed of the emitted event arguments. - * - * An `AbortSignal` can be used to cancel waiting on events: - * - * ```js - * import { on, EventEmitter } from 'node:events'; - * import process from 'node:process'; - * - * const ac = new AbortController(); - * - * (async () => { - * const ee = new EventEmitter(); - * - * // Emit later on - * process.nextTick(() => { - * ee.emit('foo', 'bar'); - * ee.emit('foo', 42); - * }); - * - * for await (const event of on(ee, 'foo', { signal: ac.signal })) { - * // The execution of this inner block is synchronous and it - * // processes one event at a time (even with await). Do not use - * // if concurrent execution is required. - * console.log(event); // prints ['bar'] [42] - * } - * // Unreachable here - * })(); - * - * process.nextTick(() => ac.abort()); - * ``` - * @since v13.6.0, v12.16.0 - * @param eventName The name of the event being listened for - * @return that iterates `eventName` events emitted by the `emitter` - */ - static on( - emitter: NodeJS.EventEmitter, - eventName: string, - options?: StaticEventEmitterOptions, - ): AsyncIterableIterator; - /** - * A class method that returns the number of listeners for the given `eventName`registered on the given `emitter`. - * - * ```js - * import { EventEmitter, listenerCount } from 'node:events'; - * - * const myEmitter = new EventEmitter(); - * myEmitter.on('event', () => {}); - * myEmitter.on('event', () => {}); - * console.log(listenerCount(myEmitter, 'event')); - * // Prints: 2 - * ``` - * @since v0.9.12 - * @deprecated Since v3.2.0 - Use `listenerCount` instead. - * @param emitter The emitter to query - * @param eventName The event name - */ - static listenerCount(emitter: NodeJS.EventEmitter, eventName: string | symbol): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * For `EventEmitter`s this behaves exactly the same as calling `.listeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the event listeners for the - * event target. This is useful for debugging and diagnostic purposes. - * - * ```js - * import { getEventListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * const listener = () => console.log('Events are fun'); - * ee.on('foo', listener); - * console.log(getEventListeners(ee, 'foo')); // [ [Function: listener] ] - * } - * { - * const et = new EventTarget(); - * const listener = () => console.log('Events are fun'); - * et.addEventListener('foo', listener); - * console.log(getEventListeners(et, 'foo')); // [ [Function: listener] ] - * } - * ``` - * @since v15.2.0, v14.17.0 - */ - static getEventListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter, name: string | symbol): Function[]; - /** - * Returns the currently set max amount of listeners. - * - * For `EventEmitter`s this behaves exactly the same as calling `.getMaxListeners` on - * the emitter. - * - * For `EventTarget`s this is the only way to get the max event listeners for the - * event target. If the number of event handlers on a single EventTarget exceeds - * the max set, the EventTarget will print a warning. - * - * ```js - * import { getMaxListeners, setMaxListeners, EventEmitter } from 'node:events'; - * - * { - * const ee = new EventEmitter(); - * console.log(getMaxListeners(ee)); // 10 - * setMaxListeners(11, ee); - * console.log(getMaxListeners(ee)); // 11 - * } - * { - * const et = new EventTarget(); - * console.log(getMaxListeners(et)); // 10 - * setMaxListeners(11, et); - * console.log(getMaxListeners(et)); // 11 - * } - * ``` - * @since v19.9.0 - */ - static getMaxListeners(emitter: _DOMEventTarget | NodeJS.EventEmitter): number; - /** - * ```js - * import { setMaxListeners, EventEmitter } from 'node:events'; - * - * const target = new EventTarget(); - * const emitter = new EventEmitter(); - * - * setMaxListeners(5, target, emitter); - * ``` - * @since v15.4.0 - * @param n A non-negative number. The maximum number of listeners per `EventTarget` event. - * @param eventsTargets Zero or more {EventTarget} or {EventEmitter} instances. If none are specified, `n` is set as the default max for all newly created {EventTarget} and {EventEmitter} - * objects. - */ - static setMaxListeners(n?: number, ...eventTargets: Array<_DOMEventTarget | NodeJS.EventEmitter>): void; - /** - * Listens once to the `abort` event on the provided `signal`. - * - * Listening to the `abort` event on abort signals is unsafe and may - * lead to resource leaks since another third party with the signal can - * call `e.stopImmediatePropagation()`. Unfortunately Node.js cannot change - * this since it would violate the web standard. Additionally, the original - * API makes it easy to forget to remove listeners. - * - * This API allows safely using `AbortSignal`s in Node.js APIs by solving these - * two issues by listening to the event such that `stopImmediatePropagation` does - * not prevent the listener from running. - * - * Returns a disposable so that it may be unsubscribed from more easily. - * - * ```js - * import { addAbortListener } from 'node:events'; - * - * function example(signal) { - * let disposable; - * try { - * signal.addEventListener('abort', (e) => e.stopImmediatePropagation()); - * disposable = addAbortListener(signal, (e) => { - * // Do something when signal is aborted. - * }); - * } finally { - * disposable?.[Symbol.dispose](); - * } - * } - * ``` - * @since v20.5.0 - * @experimental - * @return Disposable that removes the `abort` listener. - */ - static addAbortListener(signal: AbortSignal, resource: (event: Event) => void): Disposable; - /** - * This symbol shall be used to install a listener for only monitoring `'error'`events. Listeners installed using this symbol are called before the regular`'error'` listeners are called. - * - * Installing a listener using this symbol does not change the behavior once an`'error'` event is emitted. Therefore, the process will still crash if no - * regular `'error'` listener is installed. - * @since v13.6.0, v12.17.0 - */ - static readonly errorMonitor: unique symbol; - /** - * Value: `Symbol.for('nodejs.rejection')` - * - * See how to write a custom `rejection handler`. - * @since v13.4.0, v12.16.0 - */ - static readonly captureRejectionSymbol: unique symbol; - /** - * Value: [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) - * - * Change the default `captureRejections` option on all new `EventEmitter` objects. - * @since v13.4.0, v12.16.0 - */ - static captureRejections: boolean; - /** - * By default, a maximum of `10` listeners can be registered for any single - * event. This limit can be changed for individual `EventEmitter` instances - * using the `emitter.setMaxListeners(n)` method. To change the default - * for _all_`EventEmitter` instances, the `events.defaultMaxListeners`property can be used. If this value is not a positive number, a `RangeError`is thrown. - * - * Take caution when setting the `events.defaultMaxListeners` because the - * change affects _all_`EventEmitter` instances, including those created before - * the change is made. However, calling `emitter.setMaxListeners(n)` still has - * precedence over `events.defaultMaxListeners`. - * - * This is not a hard limit. The `EventEmitter` instance will allow - * more listeners to be added but will output a trace warning to stderr indicating - * that a "possible EventEmitter memory leak" has been detected. For any single`EventEmitter`, the `emitter.getMaxListeners()` and `emitter.setMaxListeners()`methods can be used to - * temporarily avoid this warning: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.setMaxListeners(emitter.getMaxListeners() + 1); - * emitter.once('event', () => { - * // do stuff - * emitter.setMaxListeners(Math.max(emitter.getMaxListeners() - 1, 0)); - * }); - * ``` - * - * The `--trace-warnings` command-line flag can be used to display the - * stack trace for such warnings. - * - * The emitted warning can be inspected with `process.on('warning')` and will - * have the additional `emitter`, `type`, and `count` properties, referring to - * the event emitter instance, the event's name and the number of attached - * listeners, respectively. - * Its `name` property is set to `'MaxListenersExceededWarning'`. - * @since v0.11.2 - */ - static defaultMaxListeners: number; - } - import internal = require("node:events"); - namespace EventEmitter { - // Should just be `export { EventEmitter }`, but that doesn't work in TypeScript 3.4 - export { internal as EventEmitter }; - export interface Abortable { - /** - * When provided the corresponding `AbortController` can be used to cancel an asynchronous action. - */ - signal?: AbortSignal | undefined; - } - - export interface EventEmitterReferencingAsyncResource extends AsyncResource { - readonly eventEmitter: EventEmitterAsyncResource; - } - - export interface EventEmitterAsyncResourceOptions extends AsyncResourceOptions, EventEmitterOptions { - /** - * The type of async event, this is required when instantiating `EventEmitterAsyncResource` - * directly rather than as a child class. - * @default new.target.name if instantiated as a child class. - */ - name?: string; - } - - /** - * Integrates `EventEmitter` with `AsyncResource` for `EventEmitter`s that - * require manual async tracking. Specifically, all events emitted by instances - * of `events.EventEmitterAsyncResource` will run within its `async context`. - * - * ```js - * import { EventEmitterAsyncResource, EventEmitter } from 'node:events'; - * import { notStrictEqual, strictEqual } from 'node:assert'; - * import { executionAsyncId, triggerAsyncId } from 'node:async_hooks'; - * - * // Async tracking tooling will identify this as 'Q'. - * const ee1 = new EventEmitterAsyncResource({ name: 'Q' }); - * - * // 'foo' listeners will run in the EventEmitters async context. - * ee1.on('foo', () => { - * strictEqual(executionAsyncId(), ee1.asyncId); - * strictEqual(triggerAsyncId(), ee1.triggerAsyncId); - * }); - * - * const ee2 = new EventEmitter(); - * - * // 'foo' listeners on ordinary EventEmitters that do not track async - * // context, however, run in the same async context as the emit(). - * ee2.on('foo', () => { - * notStrictEqual(executionAsyncId(), ee2.asyncId); - * notStrictEqual(triggerAsyncId(), ee2.triggerAsyncId); - * }); - * - * Promise.resolve().then(() => { - * ee1.emit('foo'); - * ee2.emit('foo'); - * }); - * ``` - * - * The `EventEmitterAsyncResource` class has the same methods and takes the - * same options as `EventEmitter` and `AsyncResource` themselves. - * @since v17.4.0, v16.14.0 - */ - export class EventEmitterAsyncResource extends EventEmitter { - /** - * @param options Only optional in child class. - */ - constructor(options?: EventEmitterAsyncResourceOptions); - /** - * Call all `destroy` hooks. This should only ever be called once. An error will - * be thrown if it is called more than once. This **must** be manually called. If - * the resource is left to be collected by the GC then the `destroy` hooks will - * never be called. - */ - emitDestroy(): void; - /** - * The unique `asyncId` assigned to the resource. - */ - readonly asyncId: number; - /** - * The same triggerAsyncId that is passed to the AsyncResource constructor. - */ - readonly triggerAsyncId: number; - /** - * The returned `AsyncResource` object has an additional `eventEmitter` property - * that provides a reference to this `EventEmitterAsyncResource`. - */ - readonly asyncResource: EventEmitterReferencingAsyncResource; - } - } - global { - namespace NodeJS { - interface EventEmitter { - [EventEmitter.captureRejectionSymbol]?(error: Error, event: string, ...args: any[]): void; - /** - * Alias for `emitter.on(eventName, listener)`. - * @since v0.1.26 - */ - addListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds the `listener` function to the end of the listeners array for the - * event named `eventName`. No checks are made to see if the `listener` has - * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple - * times. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The`emitter.prependListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.on('foo', () => console.log('a')); - * myEE.prependListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.1.101 - * @param eventName The name of the event. - * @param listener The callback function - */ - on(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds a **one-time**`listener` function for the event named `eventName`. The - * next time `eventName` is triggered, this listener is removed and then invoked. - * - * ```js - * server.once('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * - * By default, event listeners are invoked in the order they are added. The`emitter.prependOnceListener()` method can be used as an alternative to add the - * event listener to the beginning of the listeners array. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEE = new EventEmitter(); - * myEE.once('foo', () => console.log('a')); - * myEE.prependOnceListener('foo', () => console.log('b')); - * myEE.emit('foo'); - * // Prints: - * // b - * // a - * ``` - * @since v0.3.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - once(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Removes the specified `listener` from the listener array for the event named`eventName`. - * - * ```js - * const callback = (stream) => { - * console.log('someone connected!'); - * }; - * server.on('connection', callback); - * // ... - * server.removeListener('connection', callback); - * ``` - * - * `removeListener()` will remove, at most, one instance of a listener from the - * listener array. If any single listener has been added multiple times to the - * listener array for the specified `eventName`, then `removeListener()` must be - * called multiple times to remove each instance. - * - * Once an event is emitted, all listeners attached to it at the - * time of emitting are called in order. This implies that any`removeListener()` or `removeAllListeners()` calls _after_ emitting and _before_ the last listener finishes execution - * will not remove them from`emit()` in progress. Subsequent events behave as expected. - * - * ```js - * import { EventEmitter } from 'node:events'; - * class MyEmitter extends EventEmitter {} - * const myEmitter = new MyEmitter(); - * - * const callbackA = () => { - * console.log('A'); - * myEmitter.removeListener('event', callbackB); - * }; - * - * const callbackB = () => { - * console.log('B'); - * }; - * - * myEmitter.on('event', callbackA); - * - * myEmitter.on('event', callbackB); - * - * // callbackA removes listener callbackB but it will still be called. - * // Internal listener array at time of emit [callbackA, callbackB] - * myEmitter.emit('event'); - * // Prints: - * // A - * // B - * - * // callbackB is now removed. - * // Internal listener array [callbackA] - * myEmitter.emit('event'); - * // Prints: - * // A - * ``` - * - * Because listeners are managed using an internal array, calling this will - * change the position indices of any listener registered _after_ the listener - * being removed. This will not impact the order in which listeners are called, - * but it means that any copies of the listener array as returned by - * the `emitter.listeners()` method will need to be recreated. - * - * When a single function has been added as a handler multiple times for a single - * event (as in the example below), `removeListener()` will remove the most - * recently added instance. In the example the `once('ping')`listener is removed: - * - * ```js - * import { EventEmitter } from 'node:events'; - * const ee = new EventEmitter(); - * - * function pong() { - * console.log('pong'); - * } - * - * ee.on('ping', pong); - * ee.once('ping', pong); - * ee.removeListener('ping', pong); - * - * ee.emit('ping'); - * ee.emit('ping'); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Alias for `emitter.removeListener()`. - * @since v10.0.0 - */ - off(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Removes all listeners, or those of the specified `eventName`. - * - * It is bad practice to remove listeners added elsewhere in the code, - * particularly when the `EventEmitter` instance was created by some other - * component or module (e.g. sockets or file streams). - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.1.26 - */ - removeAllListeners(event?: string | symbol): this; - /** - * By default `EventEmitter`s will print a warning if more than `10` listeners are - * added for a particular event. This is a useful default that helps finding - * memory leaks. The `emitter.setMaxListeners()` method allows the limit to be - * modified for this specific `EventEmitter` instance. The value can be set to`Infinity` (or `0`) to indicate an unlimited number of listeners. - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v0.3.5 - */ - setMaxListeners(n: number): this; - /** - * Returns the current max listener value for the `EventEmitter` which is either - * set by `emitter.setMaxListeners(n)` or defaults to {@link defaultMaxListeners}. - * @since v1.0.0 - */ - getMaxListeners(): number; - /** - * Returns a copy of the array of listeners for the event named `eventName`. - * - * ```js - * server.on('connection', (stream) => { - * console.log('someone connected!'); - * }); - * console.log(util.inspect(server.listeners('connection'))); - * // Prints: [ [Function] ] - * ``` - * @since v0.1.26 - */ - listeners(eventName: string | symbol): Function[]; - /** - * Returns a copy of the array of listeners for the event named `eventName`, - * including any wrappers (such as those created by `.once()`). - * - * ```js - * import { EventEmitter } from 'node:events'; - * const emitter = new EventEmitter(); - * emitter.once('log', () => console.log('log once')); - * - * // Returns a new Array with a function `onceWrapper` which has a property - * // `listener` which contains the original listener bound above - * const listeners = emitter.rawListeners('log'); - * const logFnWrapper = listeners[0]; - * - * // Logs "log once" to the console and does not unbind the `once` event - * logFnWrapper.listener(); - * - * // Logs "log once" to the console and removes the listener - * logFnWrapper(); - * - * emitter.on('log', () => console.log('log persistently')); - * // Will return a new Array with a single function bound by `.on()` above - * const newListeners = emitter.rawListeners('log'); - * - * // Logs "log persistently" twice - * newListeners[0](); - * emitter.emit('log'); - * ``` - * @since v9.4.0 - */ - rawListeners(eventName: string | symbol): Function[]; - /** - * Synchronously calls each of the listeners registered for the event named`eventName`, in the order they were registered, passing the supplied arguments - * to each. - * - * Returns `true` if the event had listeners, `false` otherwise. - * - * ```js - * import { EventEmitter } from 'node:events'; - * const myEmitter = new EventEmitter(); - * - * // First listener - * myEmitter.on('event', function firstListener() { - * console.log('Helloooo! first listener'); - * }); - * // Second listener - * myEmitter.on('event', function secondListener(arg1, arg2) { - * console.log(`event with parameters ${arg1}, ${arg2} in second listener`); - * }); - * // Third listener - * myEmitter.on('event', function thirdListener(...args) { - * const parameters = args.join(', '); - * console.log(`event with parameters ${parameters} in third listener`); - * }); - * - * console.log(myEmitter.listeners('event')); - * - * myEmitter.emit('event', 1, 2, 3, 4, 5); - * - * // Prints: - * // [ - * // [Function: firstListener], - * // [Function: secondListener], - * // [Function: thirdListener] - * // ] - * // Helloooo! first listener - * // event with parameters 1, 2 in second listener - * // event with parameters 1, 2, 3, 4, 5 in third listener - * ``` - * @since v0.1.26 - */ - emit(eventName: string | symbol, ...args: any[]): boolean; - /** - * Returns the number of listeners listening for the event named `eventName`. - * If `listener` is provided, it will return how many times the listener is found - * in the list of the listeners of the event. - * @since v3.2.0 - * @param eventName The name of the event being listened for - * @param listener The event handler function - */ - listenerCount(eventName: string | symbol, listener?: Function): number; - /** - * Adds the `listener` function to the _beginning_ of the listeners array for the - * event named `eventName`. No checks are made to see if the `listener` has - * already been added. Multiple calls passing the same combination of `eventName`and `listener` will result in the `listener` being added, and called, multiple - * times. - * - * ```js - * server.prependListener('connection', (stream) => { - * console.log('someone connected!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array. The next time `eventName` is triggered, this - * listener is removed, and then invoked. - * - * ```js - * server.prependOnceListener('connection', (stream) => { - * console.log('Ah, we have our first user!'); - * }); - * ``` - * - * Returns a reference to the `EventEmitter`, so that calls can be chained. - * @since v6.0.0 - * @param eventName The name of the event. - * @param listener The callback function - */ - prependOnceListener(eventName: string | symbol, listener: (...args: any[]) => void): this; - /** - * Returns an array listing the events for which the emitter has registered - * listeners. The values in the array are strings or `Symbol`s. - * - * ```js - * import { EventEmitter } from 'node:events'; - * - * const myEE = new EventEmitter(); - * myEE.on('foo', () => {}); - * myEE.on('bar', () => {}); - * - * const sym = Symbol('symbol'); - * myEE.on(sym, () => {}); - * - * console.log(myEE.eventNames()); - * // Prints: [ 'foo', 'bar', Symbol(symbol) ] - * ``` - * @since v6.0.0 - */ - eventNames(): Array; - } - } - } - export = EventEmitter; -} -declare module "node:events" { - import events = require("events"); - export = events; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/fs.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/fs.d.ts deleted file mode 100644 index f98453a5..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/fs.d.ts +++ /dev/null @@ -1,4291 +0,0 @@ -/** - * The `node:fs` module enables interacting with the file system in a - * way modeled on standard POSIX functions. - * - * To use the promise-based APIs: - * - * ```js - * import * as fs from 'node:fs/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as fs from 'node:fs'; - * ``` - * - * All file system operations have synchronous, callback, and promise-based - * forms, and are accessible using both CommonJS syntax and ES6 Modules (ESM). - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/fs.js) - */ -declare module "fs" { - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import { URL } from "node:url"; - import * as promises from "node:fs/promises"; - export { promises }; - /** - * Valid types for path values in "fs". - */ - export type PathLike = string | Buffer | URL; - export type PathOrFileDescriptor = PathLike | number; - export type TimeLike = string | number | Date; - export type NoParamCallback = (err: NodeJS.ErrnoException | null) => void; - export type BufferEncodingOption = - | "buffer" - | { - encoding: "buffer"; - }; - export interface ObjectEncodingOptions { - encoding?: BufferEncoding | null | undefined; - } - export type EncodingOption = ObjectEncodingOptions | BufferEncoding | undefined | null; - export type OpenMode = number | string; - export type Mode = number | string; - export interface StatsBase { - isFile(): boolean; - isDirectory(): boolean; - isBlockDevice(): boolean; - isCharacterDevice(): boolean; - isSymbolicLink(): boolean; - isFIFO(): boolean; - isSocket(): boolean; - dev: T; - ino: T; - mode: T; - nlink: T; - uid: T; - gid: T; - rdev: T; - size: T; - blksize: T; - blocks: T; - atimeMs: T; - mtimeMs: T; - ctimeMs: T; - birthtimeMs: T; - atime: Date; - mtime: Date; - ctime: Date; - birthtime: Date; - } - export interface Stats extends StatsBase {} - /** - * A `fs.Stats` object provides information about a file. - * - * Objects returned from {@link stat}, {@link lstat}, {@link fstat}, and - * their synchronous counterparts are of this type. - * If `bigint` in the `options` passed to those methods is true, the numeric values - * will be `bigint` instead of `number`, and the object will contain additional - * nanosecond-precision properties suffixed with `Ns`. - * - * ```console - * Stats { - * dev: 2114, - * ino: 48064969, - * mode: 33188, - * nlink: 1, - * uid: 85, - * gid: 100, - * rdev: 0, - * size: 527, - * blksize: 4096, - * blocks: 8, - * atimeMs: 1318289051000.1, - * mtimeMs: 1318289051000.1, - * ctimeMs: 1318289051000.1, - * birthtimeMs: 1318289051000.1, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * - * `bigint` version: - * - * ```console - * BigIntStats { - * dev: 2114n, - * ino: 48064969n, - * mode: 33188n, - * nlink: 1n, - * uid: 85n, - * gid: 100n, - * rdev: 0n, - * size: 527n, - * blksize: 4096n, - * blocks: 8n, - * atimeMs: 1318289051000n, - * mtimeMs: 1318289051000n, - * ctimeMs: 1318289051000n, - * birthtimeMs: 1318289051000n, - * atimeNs: 1318289051000000000n, - * mtimeNs: 1318289051000000000n, - * ctimeNs: 1318289051000000000n, - * birthtimeNs: 1318289051000000000n, - * atime: Mon, 10 Oct 2011 23:24:11 GMT, - * mtime: Mon, 10 Oct 2011 23:24:11 GMT, - * ctime: Mon, 10 Oct 2011 23:24:11 GMT, - * birthtime: Mon, 10 Oct 2011 23:24:11 GMT } - * ``` - * @since v0.1.21 - */ - export class Stats {} - export interface StatsFsBase { - /** Type of file system. */ - type: T; - /** Optimal transfer block size. */ - bsize: T; - /** Total data blocks in file system. */ - blocks: T; - /** Free blocks in file system. */ - bfree: T; - /** Available blocks for unprivileged users */ - bavail: T; - /** Total file nodes in file system. */ - files: T; - /** Free file nodes in file system. */ - ffree: T; - } - export interface StatsFs extends StatsFsBase {} - /** - * Provides information about a mounted file system. - * - * Objects returned from {@link statfs} and its synchronous counterpart are of - * this type. If `bigint` in the `options` passed to those methods is `true`, the - * numeric values will be `bigint` instead of `number`. - * - * ```console - * StatFs { - * type: 1397114950, - * bsize: 4096, - * blocks: 121938943, - * bfree: 61058895, - * bavail: 61058895, - * files: 999, - * ffree: 1000000 - * } - * ``` - * - * `bigint` version: - * - * ```console - * StatFs { - * type: 1397114950n, - * bsize: 4096n, - * blocks: 121938943n, - * bfree: 61058895n, - * bavail: 61058895n, - * files: 999n, - * ffree: 1000000n - * } - * ``` - * @since v19.6.0, v18.15.0 - */ - export class StatsFs {} - export interface BigIntStatsFs extends StatsFsBase {} - export interface StatFsOptions { - bigint?: boolean | undefined; - } - /** - * A representation of a directory entry, which can be a file or a subdirectory - * within the directory, as returned by reading from an `fs.Dir`. The - * directory entry is a combination of the file name and file type pairs. - * - * Additionally, when {@link readdir} or {@link readdirSync} is called with - * the `withFileTypes` option set to `true`, the resulting array is filled with `fs.Dirent` objects, rather than strings or `Buffer` s. - * @since v10.10.0 - */ - export class Dirent { - /** - * Returns `true` if the `fs.Dirent` object describes a regular file. - * @since v10.10.0 - */ - isFile(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a file system - * directory. - * @since v10.10.0 - */ - isDirectory(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a block device. - * @since v10.10.0 - */ - isBlockDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a character device. - * @since v10.10.0 - */ - isCharacterDevice(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a symbolic link. - * @since v10.10.0 - */ - isSymbolicLink(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a first-in-first-out - * (FIFO) pipe. - * @since v10.10.0 - */ - isFIFO(): boolean; - /** - * Returns `true` if the `fs.Dirent` object describes a socket. - * @since v10.10.0 - */ - isSocket(): boolean; - /** - * The file name that this `fs.Dirent` object refers to. The type of this - * value is determined by the `options.encoding` passed to {@link readdir} or {@link readdirSync}. - * @since v10.10.0 - */ - name: string; - /** - * The base path that this `fs.Dirent` object refers to. - * @since v20.1.0 - */ - path: string; - } - /** - * A class representing a directory stream. - * - * Created by {@link opendir}, {@link opendirSync}, or `fsPromises.opendir()`. - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - */ - export class Dir implements AsyncIterable { - /** - * The read-only path of this directory as was provided to {@link opendir},{@link opendirSync}, or `fsPromises.opendir()`. - * @since v12.12.0 - */ - readonly path: string; - /** - * Asynchronously iterates over the directory via `readdir(3)` until all entries have been read. - */ - [Symbol.asyncIterator](): AsyncIterableIterator; - /** - * Asynchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * - * A promise is returned that will be resolved after the resource has been - * closed. - * @since v12.12.0 - */ - close(): Promise; - close(cb: NoParamCallback): void; - /** - * Synchronously close the directory's underlying resource handle. - * Subsequent reads will result in errors. - * @since v12.12.0 - */ - closeSync(): void; - /** - * Asynchronously read the next directory entry via [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) as an `fs.Dirent`. - * - * A promise is returned that will be resolved with an `fs.Dirent`, or `null`if there are no more directory entries to read. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - * @return containing {fs.Dirent|null} - */ - read(): Promise; - read(cb: (err: NodeJS.ErrnoException | null, dirEnt: Dirent | null) => void): void; - /** - * Synchronously read the next directory entry as an `fs.Dirent`. See the - * POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more detail. - * - * If there are no more directory entries to read, `null` will be returned. - * - * Directory entries returned by this function are in no particular order as - * provided by the operating system's underlying directory mechanisms. - * Entries added or removed while iterating over the directory might not be - * included in the iteration results. - * @since v12.12.0 - */ - readSync(): Dirent | null; - } - /** - * Class: fs.StatWatcher - * @since v14.3.0, v12.20.0 - * Extends `EventEmitter` - * A successful call to {@link watchFile} method will return a new fs.StatWatcher object. - */ - export interface StatWatcher extends EventEmitter { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the `fs.StatWatcher` is active. Calling `watcher.ref()` multiple times will have - * no effect. - * - * By default, all `fs.StatWatcher` objects are "ref'ed", making it normally - * unnecessary to call `watcher.ref()` unless `watcher.unref()` had been - * called previously. - * @since v14.3.0, v12.20.0 - */ - ref(): this; - /** - * When called, the active `fs.StatWatcher` object will not require the Node.js - * event loop to remain active. If there is no other activity keeping the - * event loop running, the process may exit before the `fs.StatWatcher` object's - * callback is invoked. Calling `watcher.unref()` multiple times will have - * no effect. - * @since v14.3.0, v12.20.0 - */ - unref(): this; - } - export interface FSWatcher extends EventEmitter { - /** - * Stop watching for changes on the given `fs.FSWatcher`. Once stopped, the `fs.FSWatcher` object is no longer usable. - * @since v0.5.8 - */ - close(): void; - /** - * events.EventEmitter - * 1. change - * 2. error - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "close", listener: () => void): this; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "close", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "close", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "close", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "change", listener: (eventType: string, filename: string | Buffer) => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - } - /** - * Instances of `fs.ReadStream` are created and returned using the {@link createReadStream} function. - * @since v0.1.93 - */ - export class ReadStream extends stream.Readable { - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes that have been read so far. - * @since v6.4.0 - */ - bytesRead: number; - /** - * The path to the file the stream is reading from as specified in the first - * argument to `fs.createReadStream()`. If `path` is passed as a string, then`readStream.path` will be a string. If `path` is passed as a `Buffer`, then`readStream.path` will be a - * `Buffer`. If `fd` is specified, then`readStream.path` will be `undefined`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0, v10.16.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "ready", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "ready", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * * Extends `stream.Writable` - * - * Instances of `fs.WriteStream` are created and returned using the {@link createWriteStream} function. - * @since v0.1.93 - */ - export class WriteStream extends stream.Writable { - /** - * Closes `writeStream`. Optionally accepts a - * callback that will be executed once the `writeStream`is closed. - * @since v0.9.4 - */ - close(callback?: (err?: NodeJS.ErrnoException | null) => void): void; - /** - * The number of bytes written so far. Does not include data that is still queued - * for writing. - * @since v0.4.7 - */ - bytesWritten: number; - /** - * The path to the file the stream is writing to as specified in the first - * argument to {@link createWriteStream}. If `path` is passed as a string, then`writeStream.path` will be a string. If `path` is passed as a `Buffer`, then`writeStream.path` will be a - * `Buffer`. - * @since v0.1.93 - */ - path: string | Buffer; - /** - * This property is `true` if the underlying file has not been opened yet, - * i.e. before the `'ready'` event is emitted. - * @since v11.2.0 - */ - pending: boolean; - /** - * events.EventEmitter - * 1. open - * 2. close - * 3. ready - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "open", listener: (fd: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "open", listener: (fd: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "ready", listener: () => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "open", listener: (fd: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "ready", listener: () => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "open", listener: (fd: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "open", listener: (fd: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * Asynchronously rename file at `oldPath` to the pathname provided - * as `newPath`. In the case that `newPath` already exists, it will - * be overwritten. If there is a directory at `newPath`, an error will - * be raised instead. No arguments other than a possible exception are - * given to the completion callback. - * - * See also: [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html). - * - * ```js - * import { rename } from 'node:fs'; - * - * rename('oldFile.txt', 'newFile.txt', (err) => { - * if (err) throw err; - * console.log('Rename complete!'); - * }); - * ``` - * @since v0.0.2 - */ - export function rename(oldPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace rename { - /** - * Asynchronous rename(2) - Change the name or location of a file or directory. - * @param oldPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(oldPath: PathLike, newPath: PathLike): Promise; - } - /** - * Renames the file from `oldPath` to `newPath`. Returns `undefined`. - * - * See the POSIX [`rename(2)`](http://man7.org/linux/man-pages/man2/rename.2.html) documentation for more details. - * @since v0.1.21 - */ - export function renameSync(oldPath: PathLike, newPath: PathLike): void; - /** - * Truncates the file. No arguments other than a possible exception are - * given to the completion callback. A file descriptor can also be passed as the - * first argument. In this case, `fs.ftruncate()` is called. - * - * ```js - * import { truncate } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * truncate('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was truncated'); - * }); - * ``` - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * - * See the POSIX [`truncate(2)`](http://man7.org/linux/man-pages/man2/truncate.2.html) documentation for more details. - * @since v0.8.6 - * @param [len=0] - */ - export function truncate(path: PathLike, len: number | undefined | null, callback: NoParamCallback): void; - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function truncate(path: PathLike, callback: NoParamCallback): void; - export namespace truncate { - /** - * Asynchronous truncate(2) - Truncate a file to a specified length. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(path: PathLike, len?: number | null): Promise; - } - /** - * Truncates the file. Returns `undefined`. A file descriptor can also be - * passed as the first argument. In this case, `fs.ftruncateSync()` is called. - * - * Passing a file descriptor is deprecated and may result in an error being thrown - * in the future. - * @since v0.8.6 - * @param [len=0] - */ - export function truncateSync(path: PathLike, len?: number | null): void; - /** - * Truncates the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`ftruncate(2)`](http://man7.org/linux/man-pages/man2/ftruncate.2.html) documentation for more detail. - * - * If the file referred to by the file descriptor was larger than `len` bytes, only - * the first `len` bytes will be retained in the file. - * - * For example, the following program retains only the first four bytes of the - * file: - * - * ```js - * import { open, close, ftruncate } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('temp.txt', 'r+', (err, fd) => { - * if (err) throw err; - * - * try { - * ftruncate(fd, 4, (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * if (err) throw err; - * } - * }); - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncate(fd: number, len: number | undefined | null, callback: NoParamCallback): void; - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - */ - export function ftruncate(fd: number, callback: NoParamCallback): void; - export namespace ftruncate { - /** - * Asynchronous ftruncate(2) - Truncate a file to a specified length. - * @param fd A file descriptor. - * @param len If not specified, defaults to `0`. - */ - function __promisify__(fd: number, len?: number | null): Promise; - } - /** - * Truncates the file descriptor. Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link ftruncate}. - * @since v0.8.6 - * @param [len=0] - */ - export function ftruncateSync(fd: number, len?: number | null): void; - /** - * Asynchronously changes owner and group of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace chown { - /** - * Asynchronous chown(2) - Change ownership of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Synchronously changes owner and group of a file. Returns `undefined`. - * This is the synchronous version of {@link chown}. - * - * See the POSIX [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html) documentation for more detail. - * @since v0.1.97 - */ - export function chownSync(path: PathLike, uid: number, gid: number): void; - /** - * Sets the owner of the file. No arguments other than a possible exception are - * given to the completion callback. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchown(fd: number, uid: number, gid: number, callback: NoParamCallback): void; - export namespace fchown { - /** - * Asynchronous fchown(2) - Change ownership of a file. - * @param fd A file descriptor. - */ - function __promisify__(fd: number, uid: number, gid: number): Promise; - } - /** - * Sets the owner of the file. Returns `undefined`. - * - * See the POSIX [`fchown(2)`](http://man7.org/linux/man-pages/man2/fchown.2.html) documentation for more detail. - * @since v0.4.7 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function fchownSync(fd: number, uid: number, gid: number): void; - /** - * Set the owner of the symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more detail. - */ - export function lchown(path: PathLike, uid: number, gid: number, callback: NoParamCallback): void; - export namespace lchown { - /** - * Asynchronous lchown(2) - Change ownership of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, uid: number, gid: number): Promise; - } - /** - * Set the owner for the path. Returns `undefined`. - * - * See the POSIX [`lchown(2)`](http://man7.org/linux/man-pages/man2/lchown.2.html) documentation for more details. - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - */ - export function lchownSync(path: PathLike, uid: number, gid: number): void; - /** - * Changes the access and modification times of a file in the same way as {@link utimes}, with the difference that if the path refers to a symbolic - * link, then the link is not dereferenced: instead, the timestamps of the - * symbolic link itself are changed. - * - * No arguments other than a possible exception are given to the completion - * callback. - * @since v14.5.0, v12.19.0 - */ - export function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace lutimes { - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, - * with the difference that if the path refers to a symbolic link, then the link is not - * dereferenced: instead, the timestamps of the symbolic link itself are changed. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Change the file system timestamps of the symbolic link referenced by `path`. - * Returns `undefined`, or throws an exception when parameters are incorrect or - * the operation fails. This is the synchronous version of {@link lutimes}. - * @since v14.5.0, v12.19.0 - */ - export function lutimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Asynchronously changes the permissions of a file. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * - * ```js - * import { chmod } from 'node:fs'; - * - * chmod('my_file.txt', 0o775, (err) => { - * if (err) throw err; - * console.log('The permissions for file "my_file.txt" have been changed!'); - * }); - * ``` - * @since v0.1.30 - */ - export function chmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - export namespace chmod { - /** - * Asynchronous chmod(2) - Change permissions of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link chmod}. - * - * See the POSIX [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html) documentation for more detail. - * @since v0.6.7 - */ - export function chmodSync(path: PathLike, mode: Mode): void; - /** - * Sets the permissions on the file. No arguments other than a possible exception - * are given to the completion callback. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmod(fd: number, mode: Mode, callback: NoParamCallback): void; - export namespace fchmod { - /** - * Asynchronous fchmod(2) - Change permissions of a file. - * @param fd A file descriptor. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(fd: number, mode: Mode): Promise; - } - /** - * Sets the permissions on the file. Returns `undefined`. - * - * See the POSIX [`fchmod(2)`](http://man7.org/linux/man-pages/man2/fchmod.2.html) documentation for more detail. - * @since v0.4.7 - */ - export function fchmodSync(fd: number, mode: Mode): void; - /** - * Changes the permissions on a symbolic link. No arguments other than a possible - * exception are given to the completion callback. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmod(path: PathLike, mode: Mode, callback: NoParamCallback): void; - /** @deprecated */ - export namespace lchmod { - /** - * Asynchronous lchmod(2) - Change permissions of a file. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. - */ - function __promisify__(path: PathLike, mode: Mode): Promise; - } - /** - * Changes the permissions on a symbolic link. Returns `undefined`. - * - * This method is only implemented on macOS. - * - * See the POSIX [`lchmod(2)`](https://www.freebsd.org/cgi/man.cgi?query=lchmod&sektion=2) documentation for more detail. - * @deprecated Since v0.4.7 - */ - export function lchmodSync(path: PathLike, mode: Mode): void; - /** - * Asynchronous [`stat(2)`](http://man7.org/linux/man-pages/man2/stat.2.html). The callback gets two arguments `(err, stats)` where`stats` is an `fs.Stats` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * - * {@link stat} follows symbolic links. Use {@link lstat} to look at the - * links themselves. - * - * Using `fs.stat()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. - * Instead, user code should open/read/write the file directly and handle the - * error raised if the file is not available. - * - * To check if a file exists without manipulating it afterwards, {@link access} is recommended. - * - * For example, given the following directory structure: - * - * ```text - * - txtDir - * -- file.txt - * - app.js - * ``` - * - * The next program will check for the stats of the given paths: - * - * ```js - * import { stat } from 'node:fs'; - * - * const pathsToCheck = ['./txtDir', './txtDir/file.txt']; - * - * for (let i = 0; i < pathsToCheck.length; i++) { - * stat(pathsToCheck[i], (err, stats) => { - * console.log(stats.isDirectory()); - * console.log(stats); - * }); - * } - * ``` - * - * The resulting output will resemble: - * - * ```console - * true - * Stats { - * dev: 16777220, - * mode: 16877, - * nlink: 3, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214262, - * size: 96, - * blocks: 0, - * atimeMs: 1561174653071.963, - * mtimeMs: 1561174614583.3518, - * ctimeMs: 1561174626623.5366, - * birthtimeMs: 1561174126937.2893, - * atime: 2019-06-22T03:37:33.072Z, - * mtime: 2019-06-22T03:36:54.583Z, - * ctime: 2019-06-22T03:37:06.624Z, - * birthtime: 2019-06-22T03:28:46.937Z - * } - * false - * Stats { - * dev: 16777220, - * mode: 33188, - * nlink: 1, - * uid: 501, - * gid: 20, - * rdev: 0, - * blksize: 4096, - * ino: 14214074, - * size: 8, - * blocks: 8, - * atimeMs: 1561174616618.8555, - * mtimeMs: 1561174614584, - * ctimeMs: 1561174614583.8145, - * birthtimeMs: 1561174007710.7478, - * atime: 2019-06-22T03:36:56.619Z, - * mtime: 2019-06-22T03:36:54.584Z, - * ctime: 2019-06-22T03:36:54.584Z, - * birthtime: 2019-06-22T03:26:47.711Z - * } - * ``` - * @since v0.0.2 - */ - export function stat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function stat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function stat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace stat { - /** - * Asynchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - export interface StatSyncFn extends Function { - (path: PathLike, options?: undefined): Stats; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - throwIfNoEntry: false; - }, - ): Stats | undefined; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - throwIfNoEntry: false; - }, - ): BigIntStats | undefined; - ( - path: PathLike, - options?: StatSyncOptions & { - bigint?: false | undefined; - }, - ): Stats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: true; - }, - ): BigIntStats; - ( - path: PathLike, - options: StatSyncOptions & { - bigint: boolean; - throwIfNoEntry?: false | undefined; - }, - ): Stats | BigIntStats; - (path: PathLike, options?: StatSyncOptions): Stats | BigIntStats | undefined; - } - /** - * Synchronous stat(2) - Get file status. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const statSync: StatSyncFn; - /** - * Invokes the callback with the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function fstat( - fd: number, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function fstat( - fd: number, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace fstat { - /** - * Asynchronous fstat(2) - Get file status. - * @param fd A file descriptor. - */ - function __promisify__( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(fd: number, options?: StatOptions): Promise; - } - /** - * Retrieves the `fs.Stats` for the file descriptor. - * - * See the POSIX [`fstat(2)`](http://man7.org/linux/man-pages/man2/fstat.2.html) documentation for more detail. - * @since v0.1.95 - */ - export function fstatSync( - fd: number, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Stats; - export function fstatSync( - fd: number, - options: StatOptions & { - bigint: true; - }, - ): BigIntStats; - export function fstatSync(fd: number, options?: StatOptions): Stats | BigIntStats; - /** - * Retrieves the `fs.Stats` for the symbolic link referred to by the path. - * The callback gets two arguments `(err, stats)` where `stats` is a `fs.Stats` object. `lstat()` is identical to `stat()`, except that if `path` is a symbolic - * link, then the link itself is stat-ed, not the file that it refers to. - * - * See the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) documentation for more details. - * @since v0.1.30 - */ - export function lstat(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void): void; - export function lstat( - path: PathLike, - options: - | (StatOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStats) => void, - ): void; - export function lstat( - path: PathLike, - options: StatOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: Stats | BigIntStats) => void, - ): void; - export namespace lstat { - /** - * Asynchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__( - path: PathLike, - options?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatOptions): Promise; - } - /** - * Asynchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. The callback gets two arguments `(err, stats)` where `stats`is an `fs.StatFs` object. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfs(path: PathLike, callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void): void; - export function statfs( - path: PathLike, - options: - | (StatFsOptions & { - bigint?: false | undefined; - }) - | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - callback: (err: NodeJS.ErrnoException | null, stats: BigIntStatsFs) => void, - ): void; - export function statfs( - path: PathLike, - options: StatFsOptions | undefined, - callback: (err: NodeJS.ErrnoException | null, stats: StatsFs | BigIntStatsFs) => void, - ): void; - export namespace statfs { - /** - * Asynchronous statfs(2) - Returns information about the mounted file system which contains path. The callback gets two arguments (err, stats) where stats is an object. - * @param path A path to an existing file or directory on the file system to be queried. - */ - function __promisify__( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function __promisify__( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): Promise; - function __promisify__(path: PathLike, options?: StatFsOptions): Promise; - } - /** - * Synchronous [`statfs(2)`](http://man7.org/linux/man-pages/man2/statfs.2.html). Returns information about the mounted file system which - * contains `path`. - * - * In case of an error, the `err.code` will be one of `Common System Errors`. - * @since v19.6.0, v18.15.0 - * @param path A path to an existing file or directory on the file system to be queried. - */ - export function statfsSync( - path: PathLike, - options?: StatFsOptions & { - bigint?: false | undefined; - }, - ): StatsFs; - export function statfsSync( - path: PathLike, - options: StatFsOptions & { - bigint: true; - }, - ): BigIntStatsFs; - export function statfsSync(path: PathLike, options?: StatFsOptions): StatsFs | BigIntStatsFs; - /** - * Synchronous lstat(2) - Get file status. Does not dereference symbolic links. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export const lstatSync: StatSyncFn; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. No arguments other than - * a possible - * exception are given to the completion callback. - * @since v0.1.31 - */ - export function link(existingPath: PathLike, newPath: PathLike, callback: NoParamCallback): void; - export namespace link { - /** - * Asynchronous link(2) - Create a new link (also known as a hard link) to an existing file. - * @param existingPath A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param newPath A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(existingPath: PathLike, newPath: PathLike): Promise; - } - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.31 - */ - export function linkSync(existingPath: PathLike, newPath: PathLike): void; - /** - * Creates the link called `path` pointing to `target`. No arguments other than a - * possible exception are given to the completion callback. - * - * See the POSIX [`symlink(2)`](http://man7.org/linux/man-pages/man2/symlink.2.html) documentation for more details. - * - * The `type` argument is only available on Windows and ignored on other platforms. - * It can be set to `'dir'`, `'file'`, or `'junction'`. If the `type` argument is - * not a string, Node.js will autodetect `target` type and use `'file'` or `'dir'`. - * If the `target` does not exist, `'file'` will be used. Windows junction points - * require the destination path to be absolute. When using `'junction'`, the`target` argument will automatically be normalized to absolute path. Junction - * points on NTFS volumes can only point to directories. - * - * Relative targets are relative to the link's parent directory. - * - * ```js - * import { symlink } from 'node:fs'; - * - * symlink('./mew', './mewtwo', callback); - * ``` - * - * The above example creates a symbolic link `mewtwo` which points to `mew` in the - * same directory: - * - * ```bash - * $ tree . - * . - * ├── mew - * └── mewtwo -> ./mew - * ``` - * @since v0.1.31 - * @param [type='null'] - */ - export function symlink( - target: PathLike, - path: PathLike, - type: symlink.Type | undefined | null, - callback: NoParamCallback, - ): void; - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - */ - export function symlink(target: PathLike, path: PathLike, callback: NoParamCallback): void; - export namespace symlink { - /** - * Asynchronous symlink(2) - Create a new symbolic link to an existing file. - * @param target A path to an existing file. If a URL is provided, it must use the `file:` protocol. - * @param path A path to the new symlink. If a URL is provided, it must use the `file:` protocol. - * @param type May be set to `'dir'`, `'file'`, or `'junction'` (default is `'file'`) and is only available on Windows (ignored on other platforms). - * When using `'junction'`, the `target` argument will automatically be normalized to an absolute path. - */ - function __promisify__(target: PathLike, path: PathLike, type?: string | null): Promise; - type Type = "dir" | "file" | "junction"; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link symlink}. - * @since v0.1.31 - * @param [type='null'] - */ - export function symlinkSync(target: PathLike, path: PathLike, type?: symlink.Type | null): void; - /** - * Reads the contents of the symbolic link referred to by `path`. The callback gets - * two arguments `(err, linkString)`. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path passed to the callback. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: Buffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlink( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, linkString: string | Buffer) => void, - ): void; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readlink( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, linkString: string) => void, - ): void; - export namespace readlink { - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - } - /** - * Returns the symbolic link's string value. - * - * See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, - * the link path returned will be passed as a `Buffer` object. - * @since v0.1.31 - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options: BufferEncodingOption): Buffer; - /** - * Synchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readlinkSync(path: PathLike, options?: EncodingOption): string | Buffer; - /** - * Asynchronously computes the canonical pathname by resolving `.`, `..`, and - * symbolic links. - * - * A canonical pathname is not necessarily unique. Hard links and bind mounts can - * expose a file system entity through many pathnames. - * - * This function behaves like [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html), with some exceptions: - * - * 1. No case conversion is performed on case-insensitive file systems. - * 2. The maximum number of symbolic links is platform-independent and generally - * (much) higher than what the native [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html) implementation supports. - * - * The `callback` gets two arguments `(err, resolvedPath)`. May use `process.cwd`to resolve relative paths. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * If `path` resolves to a socket or a pipe, the function will return a system - * dependent name for that object. - * @since v0.1.31 - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpath( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, - ): void; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function realpath( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - export namespace realpath { - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(path: PathLike, options?: EncodingOption): Promise; - /** - * Asynchronous [`realpath(3)`](http://man7.org/linux/man-pages/man3/realpath.3.html). - * - * The `callback` gets two arguments `(err, resolvedPath)`. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path passed to the callback. If the `encoding` is set to `'buffer'`, - * the path returned will be passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v9.2.0 - */ - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - function native( - path: PathLike, - options: BufferEncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: Buffer) => void, - ): void; - function native( - path: PathLike, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string | Buffer) => void, - ): void; - function native( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => void, - ): void; - } - /** - * Returns the resolved pathname. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link realpath}. - * @since v0.1.31 - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options: BufferEncodingOption): Buffer; - /** - * Synchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function realpathSync(path: PathLike, options?: EncodingOption): string | Buffer; - export namespace realpathSync { - function native(path: PathLike, options?: EncodingOption): string; - function native(path: PathLike, options: BufferEncodingOption): Buffer; - function native(path: PathLike, options?: EncodingOption): string | Buffer; - } - /** - * Asynchronously removes a file or symbolic link. No arguments other than a - * possible exception are given to the completion callback. - * - * ```js - * import { unlink } from 'node:fs'; - * // Assuming that 'path/file.txt' is a regular file. - * unlink('path/file.txt', (err) => { - * if (err) throw err; - * console.log('path/file.txt was deleted'); - * }); - * ``` - * - * `fs.unlink()` will not work on a directory, empty or otherwise. To remove a - * directory, use {@link rmdir}. - * - * See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more details. - * @since v0.0.2 - */ - export function unlink(path: PathLike, callback: NoParamCallback): void; - export namespace unlink { - /** - * Asynchronous unlink(2) - delete a name and possibly the file it refers to. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Synchronous [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html). Returns `undefined`. - * @since v0.1.21 - */ - export function unlinkSync(path: PathLike): void; - export interface RmDirOptions { - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * @deprecated since v14.14.0 In future versions of Node.js and will trigger a warning - * `fs.rmdir(path, { recursive: true })` will throw if `path` does not exist or is a file. - * Use `fs.rm(path, { recursive: true, force: true })` instead. - * - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). No arguments other than a possible exception are given - * to the completion callback. - * - * Using `fs.rmdir()` on a file (not a directory) results in an `ENOENT` error on - * Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rm} with options `{ recursive: true, force: true }`. - * @since v0.0.2 - */ - export function rmdir(path: PathLike, callback: NoParamCallback): void; - export function rmdir(path: PathLike, options: RmDirOptions, callback: NoParamCallback): void; - export namespace rmdir { - /** - * Asynchronous rmdir(2) - delete a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - function __promisify__(path: PathLike, options?: RmDirOptions): Promise; - } - /** - * Synchronous [`rmdir(2)`](http://man7.org/linux/man-pages/man2/rmdir.2.html). Returns `undefined`. - * - * Using `fs.rmdirSync()` on a file (not a directory) results in an `ENOENT` error - * on Windows and an `ENOTDIR` error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use {@link rmSync} with options `{ recursive: true, force: true }`. - * @since v0.1.21 - */ - export function rmdirSync(path: PathLike, options?: RmDirOptions): void; - export interface RmOptions { - /** - * When `true`, exceptions will be ignored if `path` does not exist. - * @default false - */ - force?: boolean | undefined; - /** - * If an `EBUSY`, `EMFILE`, `ENFILE`, `ENOTEMPTY`, or - * `EPERM` error is encountered, Node.js will retry the operation with a linear - * backoff wait of `retryDelay` ms longer on each try. This option represents the - * number of retries. This option is ignored if the `recursive` option is not - * `true`. - * @default 0 - */ - maxRetries?: number | undefined; - /** - * If `true`, perform a recursive directory removal. In - * recursive mode, operations are retried on failure. - * @default false - */ - recursive?: boolean | undefined; - /** - * The amount of time in milliseconds to wait between retries. - * This option is ignored if the `recursive` option is not `true`. - * @default 100 - */ - retryDelay?: number | undefined; - } - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm`utility). No arguments other than a possible exception are given to the - * completion callback. - * @since v14.14.0 - */ - export function rm(path: PathLike, callback: NoParamCallback): void; - export function rm(path: PathLike, options: RmOptions, callback: NoParamCallback): void; - export namespace rm { - /** - * Asynchronously removes files and directories (modeled on the standard POSIX `rm` utility). - */ - function __promisify__(path: PathLike, options?: RmOptions): Promise; - } - /** - * Synchronously removes files and directories (modeled on the standard POSIX `rm`utility). Returns `undefined`. - * @since v14.14.0 - */ - export function rmSync(path: PathLike, options?: RmOptions): void; - export interface MakeDirectoryOptions { - /** - * Indicates whether parent folders should be created. - * If a folder was created, the path to the first created folder will be returned. - * @default false - */ - recursive?: boolean | undefined; - /** - * A file mode. If a string is passed, it is parsed as an octal integer. If not specified - * @default 0o777 - */ - mode?: Mode | undefined; - } - /** - * Asynchronously creates a directory. - * - * The callback is given a possible exception and, if `recursive` is `true`, the - * first directory path created, `(err[, path])`.`path` can still be `undefined` when `recursive` is `true`, if no directory was - * created (for instance, if it was previously created). - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fs.mkdir()` when `path` is a directory that - * exists results in an error only - * when `recursive` is false. If `recursive` is false and the directory exists, - * an `EEXIST` error occurs. - * - * ```js - * import { mkdir } from 'node:fs'; - * - * // Create ./tmp/a/apple, regardless of whether ./tmp and ./tmp/a exist. - * mkdir('./tmp/a/apple', { recursive: true }, (err) => { - * if (err) throw err; - * }); - * ``` - * - * On Windows, using `fs.mkdir()` on the root directory even with recursion will - * result in an error: - * - * ```js - * import { mkdir } from 'node:fs'; - * - * mkdir('/', { recursive: true }, (err) => { - * // => [Error: EPERM: operation not permitted, mkdir 'C:\'] - * }); - * ``` - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.8 - */ - export function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null - | undefined, - callback: NoParamCallback, - ): void; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdir( - path: PathLike, - options: Mode | MakeDirectoryOptions | null | undefined, - callback: (err: NodeJS.ErrnoException | null, path?: string) => void, - ): void; - /** - * Asynchronous mkdir(2) - create a directory with a mode of `0o777`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function mkdir(path: PathLike, callback: NoParamCallback): void; - export namespace mkdir { - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function __promisify__( - path: PathLike, - options?: Mode | MakeDirectoryOptions | null, - ): Promise; - } - /** - * Synchronously creates a directory. Returns `undefined`, or if `recursive` is`true`, the first directory path created. - * This is the synchronous version of {@link mkdir}. - * - * See the POSIX [`mkdir(2)`](http://man7.org/linux/man-pages/man2/mkdir.2.html) documentation for more details. - * @since v0.1.21 - */ - export function mkdirSync( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): string | undefined; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): void; - /** - * Synchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - export function mkdirSync(path: PathLike, options?: Mode | MakeDirectoryOptions | null): string | undefined; - /** - * Creates a unique temporary directory. - * - * Generates six random characters to be appended behind a required`prefix` to create a unique temporary directory. Due to platform - * inconsistencies, avoid trailing `X` characters in `prefix`. Some platforms, - * notably the BSDs, can return more than six random characters, and replace - * trailing `X` characters in `prefix` with random characters. - * - * The created directory path is passed as a string to the callback's second - * parameter. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * mkdtemp(join(tmpdir(), 'foo-'), (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Prints: /tmp/foo-itXde2 or C:\Users\...\AppData\Local\Temp\foo-itXde2 - * }); - * ``` - * - * The `fs.mkdtemp()` method will append the six randomly selected characters - * directly to the `prefix` string. For instance, given a directory `/tmp`, if the - * intention is to create a temporary directory _within_`/tmp`, the `prefix`must end with a trailing platform-specific path separator - * (`require('node:path').sep`). - * - * ```js - * import { tmpdir } from 'node:os'; - * import { mkdtemp } from 'node:fs'; - * - * // The parent directory for the new temporary directory - * const tmpDir = tmpdir(); - * - * // This method is *INCORRECT*: - * mkdtemp(tmpDir, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmpabc123`. - * // A new temporary directory is created at the file system root - * // rather than *within* the /tmp directory. - * }); - * - * // This method is *CORRECT*: - * import { sep } from 'node:path'; - * mkdtemp(`${tmpDir}${sep}`, (err, directory) => { - * if (err) throw err; - * console.log(directory); - * // Will print something similar to `/tmp/abc123`. - * // A new temporary directory is created within - * // the /tmp directory. - * }); - * ``` - * @since v5.10.0 - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: - | "buffer" - | { - encoding: "buffer"; - }, - callback: (err: NodeJS.ErrnoException | null, folder: Buffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtemp( - prefix: string, - options: EncodingOption, - callback: (err: NodeJS.ErrnoException | null, folder: string | Buffer) => void, - ): void; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - */ - export function mkdtemp( - prefix: string, - callback: (err: NodeJS.ErrnoException | null, folder: string) => void, - ): void; - export namespace mkdtemp { - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__(prefix: string, options?: EncodingOption): Promise; - } - /** - * Returns the created directory path. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link mkdtemp}. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * @since v5.10.0 - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options: BufferEncodingOption): Buffer; - /** - * Synchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required prefix to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function mkdtempSync(prefix: string, options?: EncodingOption): string | Buffer; - /** - * Reads the contents of a directory. The callback gets two arguments `(err, files)`where `files` is an array of the names of the files in the directory excluding`'.'` and `'..'`. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames passed to the callback. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the `files` array will contain `fs.Dirent` objects. - * @since v0.1.8 - */ - export function readdir( - path: PathLike, - options: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - callback: (err: NodeJS.ErrnoException | null, files: Buffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdir( - path: PathLike, - options: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, files: string[] | Buffer[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function readdir( - path: PathLike, - callback: (err: NodeJS.ErrnoException | null, files: string[]) => void, - ): void; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - callback: (err: NodeJS.ErrnoException | null, files: Dirent[]) => void, - ): void; - export namespace readdir { - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options: - | "buffer" - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function __promisify__( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent - */ - function __promisify__( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - } - /** - * Reads the contents of the directory. - * - * See the POSIX [`readdir(3)`](http://man7.org/linux/man-pages/man3/readdir.3.html) documentation for more details. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames returned. If the `encoding` is set to `'buffer'`, - * the filenames returned will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the result will contain `fs.Dirent` objects. - * @since v0.1.21 - */ - export function readdirSync( - path: PathLike, - options?: - | { - encoding: BufferEncoding | null; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | BufferEncoding - | null, - ): string[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): Buffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - export function readdirSync( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): string[] | Buffer[]; - /** - * Synchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - export function readdirSync( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Dirent[]; - /** - * Closes the file descriptor. No arguments other than a possible exception are - * given to the completion callback. - * - * Calling `fs.close()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.0.2 - */ - export function close(fd: number, callback?: NoParamCallback): void; - export namespace close { - /** - * Asynchronous close(2) - close a file descriptor. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Closes the file descriptor. Returns `undefined`. - * - * Calling `fs.closeSync()` on any file descriptor (`fd`) that is currently in use - * through any other `fs` operation may lead to undefined behavior. - * - * See the POSIX [`close(2)`](http://man7.org/linux/man-pages/man2/close.2.html) documentation for more detail. - * @since v0.1.21 - */ - export function closeSync(fd: number): void; - /** - * Asynchronous file open. See the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more details. - * - * `mode` sets the file mode (permission and sticky bits), but only if the file was - * created. On Windows, only the write permission can be manipulated; see {@link chmod}. - * - * The callback gets two arguments `(err, fd)`. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * - * Functions based on `fs.open()` exhibit this behavior as well:`fs.writeFile()`, `fs.readFile()`, etc. - * @since v0.0.2 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - mode: Mode | undefined | null, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param [flags='r'] See `support of file system `flags``. - */ - export function open( - path: PathLike, - flags: OpenMode | undefined, - callback: (err: NodeJS.ErrnoException | null, fd: number) => void, - ): void; - /** - * Asynchronous open(2) - open and possibly create a file. If the file is created, its mode will be `0o666`. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - */ - export function open(path: PathLike, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void; - export namespace open { - /** - * Asynchronous open(2) - open and possibly create a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param mode A file mode. If a string is passed, it is parsed as an octal integer. If not supplied, defaults to `0o666`. - */ - function __promisify__(path: PathLike, flags: OpenMode, mode?: Mode | null): Promise; - } - /** - * Returns an integer representing the file descriptor. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link open}. - * @since v0.1.21 - * @param [flags='r'] - * @param [mode=0o666] - */ - export function openSync(path: PathLike, flags: OpenMode, mode?: Mode | null): number; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time in seconds,`Date`s, or a numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. - * @since v0.4.2 - */ - export function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace utimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied path. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Returns `undefined`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link utimes}. - * @since v0.4.2 - */ - export function utimesSync(path: PathLike, atime: TimeLike, mtime: TimeLike): void; - /** - * Change the file system timestamps of the object referenced by the supplied file - * descriptor. See {@link utimes}. - * @since v0.4.2 - */ - export function futimes(fd: number, atime: TimeLike, mtime: TimeLike, callback: NoParamCallback): void; - export namespace futimes { - /** - * Asynchronously change file timestamps of the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param atime The last access time. If a string is provided, it will be coerced to number. - * @param mtime The last modified time. If a string is provided, it will be coerced to number. - */ - function __promisify__(fd: number, atime: TimeLike, mtime: TimeLike): Promise; - } - /** - * Synchronous version of {@link futimes}. Returns `undefined`. - * @since v0.4.2 - */ - export function futimesSync(fd: number, atime: TimeLike, mtime: TimeLike): void; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. No arguments other - * than a possible exception are given to the completion callback. - * @since v0.1.96 - */ - export function fsync(fd: number, callback: NoParamCallback): void; - export namespace fsync { - /** - * Asynchronous fsync(2) - synchronize a file's in-core state with the underlying storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. Returns `undefined`. - * @since v0.1.96 - */ - export function fsyncSync(fd: number): void; - /** - * Write `buffer` to the file specified by `fd`. - * - * `offset` determines the part of the buffer to be written, and `length` is - * an integer specifying the number of bytes to write. - * - * `position` refers to the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. See [`pwrite(2)`](http://man7.org/linux/man-pages/man2/pwrite.2.html). - * - * The callback will be given three arguments `(err, bytesWritten, buffer)` where`bytesWritten` specifies how many _bytes_ were written from `buffer`. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesWritten` and `buffer` properties. - * - * It is unsafe to use `fs.write()` multiple times on the same file without waiting - * for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v0.0.2 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - length: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - */ - export function write( - fd: number, - buffer: TBuffer, - offset: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - */ - export function write( - fd: number, - buffer: TBuffer, - callback: (err: NodeJS.ErrnoException | null, written: number, buffer: TBuffer) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - encoding: BufferEncoding | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - export function write( - fd: number, - string: string, - position: number | undefined | null, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - */ - export function write( - fd: number, - string: string, - callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void, - ): void; - export namespace write { - /** - * Asynchronously writes `buffer` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param offset The part of the buffer to be written. If not supplied, defaults to `0`. - * @param length The number of bytes to write. If not supplied, defaults to `buffer.length - offset`. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - */ - function __promisify__( - fd: number, - buffer?: TBuffer, - offset?: number, - length?: number, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - /** - * Asynchronously writes `string` to the file referenced by the supplied file descriptor. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - function __promisify__( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link write}. - * @since v0.1.21 - * @param [offset=0] - * @param [length=buffer.byteLength - offset] - * @param [position='null'] - * @return The number of bytes written. - */ - export function writeSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset?: number | null, - length?: number | null, - position?: number | null, - ): number; - /** - * Synchronously writes `string` to the file referenced by the supplied file descriptor, returning the number of bytes written. - * @param fd A file descriptor. - * @param string A string to write. - * @param position The offset from the beginning of the file where this data should be written. If not supplied, defaults to the current position. - * @param encoding The expected string encoding. - */ - export function writeSync( - fd: number, - string: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): number; - export type ReadPosition = number | bigint; - export interface ReadSyncOptions { - /** - * @default 0 - */ - offset?: number | undefined; - /** - * @default `length of buffer` - */ - length?: number | undefined; - /** - * @default null - */ - position?: ReadPosition | null | undefined; - } - export interface ReadAsyncOptions extends ReadSyncOptions { - buffer?: TBuffer; - } - /** - * Read data from the file specified by `fd`. - * - * The callback is given the three arguments, `(err, bytesRead, buffer)`. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffer` properties. - * @since v0.0.2 - * @param buffer The buffer that the data will be written to. - * @param offset The position in `buffer` to write the data to. - * @param length The number of bytes to read. - * @param position Specifies where to begin reading from in the file. If `position` is `null` or `-1 `, data will be read from the current file position, and the file position will be updated. If - * `position` is an integer, the file position will be unchanged. - */ - export function read( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: ReadPosition | null, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - /** - * Similar to the above `fs.read` function, this version takes an optional `options` object. - * If not otherwise specified in an `options` object, - * `buffer` defaults to `Buffer.alloc(16384)`, - * `offset` defaults to `0`, - * `length` defaults to `buffer.byteLength`, `- offset` as of Node 17.6.0 - * `position` defaults to `null` - * @since v12.17.0, 13.11.0 - */ - export function read( - fd: number, - options: ReadAsyncOptions, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: TBuffer) => void, - ): void; - export function read( - fd: number, - callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: NodeJS.ArrayBufferView) => void, - ): void; - export namespace read { - /** - * @param fd A file descriptor. - * @param buffer The buffer that the data will be written to. - * @param offset The offset in the buffer at which to start writing. - * @param length The number of bytes to read. - * @param position The offset from the beginning of the file from which data should be read. If `null`, data will be read from the current position. - */ - function __promisify__( - fd: number, - buffer: TBuffer, - offset: number, - length: number, - position: number | null, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__( - fd: number, - options: ReadAsyncOptions, - ): Promise<{ - bytesRead: number; - buffer: TBuffer; - }>; - function __promisify__(fd: number): Promise<{ - bytesRead: number; - buffer: NodeJS.ArrayBufferView; - }>; - } - /** - * Returns the number of `bytesRead`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link read}. - * @since v0.1.21 - * @param [position='null'] - */ - export function readSync( - fd: number, - buffer: NodeJS.ArrayBufferView, - offset: number, - length: number, - position: ReadPosition | null, - ): number; - /** - * Similar to the above `fs.readSync` function, this version takes an optional `options` object. - * If no `options` object is specified, it will default with the above values. - */ - export function readSync(fd: number, buffer: NodeJS.ArrayBufferView, opts?: ReadSyncOptions): number; - /** - * Asynchronously reads the entire contents of a file. - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', (err, data) => { - * if (err) throw err; - * console.log(data); - * }); - * ``` - * - * The callback is passed two arguments `(err, data)`, where `data` is the - * contents of the file. - * - * If no encoding is specified, then the raw buffer is returned. - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { readFile } from 'node:fs'; - * - * readFile('/etc/passwd', 'utf8', callback); - * ``` - * - * When the path is a directory, the behavior of `fs.readFile()` and {@link readFileSync} is platform-specific. On macOS, Linux, and Windows, an - * error will be returned. On FreeBSD, a representation of the directory's contents - * will be returned. - * - * ```js - * import { readFile } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFile('', (err, data) => { - * // => [Error: EISDIR: illegal operation on a directory, read ] - * }); - * - * // FreeBSD - * readFile('', (err, data) => { - * // => null, - * }); - * ``` - * - * It is possible to abort an ongoing request using an `AbortSignal`. If a - * request is aborted the callback is called with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs'; - * - * const controller = new AbortController(); - * const signal = controller.signal; - * readFile(fileInfo[0].name, { signal }, (err, buf) => { - * // ... - * }); - * // When you want to abort the request - * controller.abort(); - * ``` - * - * The `fs.readFile()` function buffers the entire file. To minimize memory costs, - * when possible prefer streaming via `fs.createReadStream()`. - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * @since v0.1.29 - * @param path filename or file descriptor - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding?: null | undefined; - flag?: string | undefined; - } & Abortable) - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | ({ - encoding: BufferEncoding; - flag?: string | undefined; - } & Abortable) - | BufferEncoding, - callback: (err: NodeJS.ErrnoException | null, data: string) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFile( - path: PathOrFileDescriptor, - options: - | (ObjectEncodingOptions & { - flag?: string | undefined; - } & Abortable) - | BufferEncoding - | undefined - | null, - callback: (err: NodeJS.ErrnoException | null, data: string | Buffer) => void, - ): void; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - */ - export function readFile( - path: PathOrFileDescriptor, - callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void, - ): void; - export namespace readFile { - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function __promisify__( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): Promise; - } - /** - * Returns the contents of the `path`. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readFile}. - * - * If the `encoding` option is specified then this function returns a - * string. Otherwise it returns a buffer. - * - * Similar to {@link readFile}, when the path is a directory, the behavior of`fs.readFileSync()` is platform-specific. - * - * ```js - * import { readFileSync } from 'node:fs'; - * - * // macOS, Linux, and Windows - * readFileSync(''); - * // => [Error: EISDIR: illegal operation on a directory, read ] - * - * // FreeBSD - * readFileSync(''); // => - * ``` - * @since v0.1.8 - * @param path filename or file descriptor - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: { - encoding?: null | undefined; - flag?: string | undefined; - } | null, - ): Buffer; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options: - | { - encoding: BufferEncoding; - flag?: string | undefined; - } - | BufferEncoding, - ): string; - /** - * Synchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param options Either the encoding for the result, or an object that contains the encoding and an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - export function readFileSync( - path: PathOrFileDescriptor, - options?: - | (ObjectEncodingOptions & { - flag?: string | undefined; - }) - | BufferEncoding - | null, - ): string | Buffer; - export type WriteFileOptions = - | ( - & ObjectEncodingOptions - & Abortable - & { - mode?: Mode | undefined; - flag?: string | undefined; - flush?: boolean | undefined; - } - ) - | BufferEncoding - | null; - /** - * When `file` is a filename, asynchronously writes data to the file, replacing the - * file if it already exists. `data` can be a string or a buffer. - * - * When `file` is a file descriptor, the behavior is similar to calling`fs.write()` directly (which is recommended). See the notes below on using - * a file descriptor. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, (err) => { - * if (err) throw err; - * console.log('The file has been saved!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { writeFile } from 'node:fs'; - * - * writeFile('message.txt', 'Hello Node.js', 'utf8', callback); - * ``` - * - * It is unsafe to use `fs.writeFile()` multiple times on the same file without - * waiting for the callback. For this scenario, {@link createWriteStream} is - * recommended. - * - * Similarly to `fs.readFile` \- `fs.writeFile` is a convenience method that - * performs multiple `write` calls internally to write the buffer passed to it. - * For performance sensitive code consider using {@link createWriteStream}. - * - * It is possible to use an `AbortSignal` to cancel an `fs.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs'; - * import { Buffer } from 'node:buffer'; - * - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * writeFile('message.txt', data, { signal }, (err) => { - * // When a request is aborted - the callback is called with an AbortError - * }); - * // When the request should be aborted - * controller.abort(); - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFile( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function writeFile( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - callback: NoParamCallback, - ): void; - export namespace writeFile { - /** - * Asynchronously writes data to a file, replacing the file if it already exists. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'w'` is used. - */ - function __promisify__( - path: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): Promise; - } - /** - * Returns `undefined`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writeFile}. - * @since v0.1.29 - * @param file filename or file descriptor - */ - export function writeFileSync( - file: PathOrFileDescriptor, - data: string | NodeJS.ArrayBufferView, - options?: WriteFileOptions, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', (err) => { - * if (err) throw err; - * console.log('The "data to append" was appended to file!'); - * }); - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFile } from 'node:fs'; - * - * appendFile('message.txt', 'data to append', 'utf8', callback); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { open, close, appendFile } from 'node:fs'; - * - * function closeFd(fd) { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * - * open('message.txt', 'a', (err, fd) => { - * if (err) throw err; - * - * try { - * appendFile(fd, 'data to append', 'utf8', (err) => { - * closeFd(fd); - * if (err) throw err; - * }); - * } catch (err) { - * closeFd(fd); - * throw err; - * } - * }); - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFile( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options: WriteFileOptions, - callback: NoParamCallback, - ): void; - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - */ - export function appendFile(file: PathOrFileDescriptor, data: string | Uint8Array, callback: NoParamCallback): void; - export namespace appendFile { - /** - * Asynchronously append data to a file, creating the file if it does not exist. - * @param file A path to a file. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - * If a file descriptor is provided, the underlying file will _not_ be closed automatically. - * @param data The data to write. If something other than a Buffer or Uint8Array is provided, the value is coerced to a string. - * @param options Either the encoding for the file, or an object optionally specifying the encoding, file mode, and flag. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `mode` is not supplied, the default of `0o666` is used. - * If `mode` is a string, it is parsed as an octal integer. - * If `flag` is not supplied, the default of `'a'` is used. - */ - function __promisify__( - file: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): Promise; - } - /** - * Synchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * The `mode` option only affects the newly created file. See {@link open} for more details. - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * try { - * appendFileSync('message.txt', 'data to append'); - * console.log('The "data to append" was appended to file!'); - * } catch (err) { - * // Handle the error - * } - * ``` - * - * If `options` is a string, then it specifies the encoding: - * - * ```js - * import { appendFileSync } from 'node:fs'; - * - * appendFileSync('message.txt', 'data to append', 'utf8'); - * ``` - * - * The `path` may be specified as a numeric file descriptor that has been opened - * for appending (using `fs.open()` or `fs.openSync()`). The file descriptor will - * not be closed automatically. - * - * ```js - * import { openSync, closeSync, appendFileSync } from 'node:fs'; - * - * let fd; - * - * try { - * fd = openSync('message.txt', 'a'); - * appendFileSync(fd, 'data to append', 'utf8'); - * } catch (err) { - * // Handle the error - * } finally { - * if (fd !== undefined) - * closeSync(fd); - * } - * ``` - * @since v0.6.7 - * @param path filename or file descriptor - */ - export function appendFileSync( - path: PathOrFileDescriptor, - data: string | Uint8Array, - options?: WriteFileOptions, - ): void; - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export interface WatchFileOptions { - bigint?: boolean | undefined; - persistent?: boolean | undefined; - interval?: number | undefined; - } - /** - * Watch for changes on `filename`. The callback `listener` will be called each - * time the file is accessed. - * - * The `options` argument may be omitted. If provided, it should be an object. The`options` object may contain a boolean named `persistent` that indicates - * whether the process should continue to run as long as files are being watched. - * The `options` object may specify an `interval` property indicating how often the - * target should be polled in milliseconds. - * - * The `listener` gets two arguments the current stat object and the previous - * stat object: - * - * ```js - * import { watchFile } from 'node:fs'; - * - * watchFile('message.text', (curr, prev) => { - * console.log(`the current mtime is: ${curr.mtime}`); - * console.log(`the previous mtime was: ${prev.mtime}`); - * }); - * ``` - * - * These stat objects are instances of `fs.Stat`. If the `bigint` option is `true`, - * the numeric values in these objects are specified as `BigInt`s. - * - * To be notified when the file was modified, not just accessed, it is necessary - * to compare `curr.mtimeMs` and `prev.mtimeMs`. - * - * When an `fs.watchFile` operation results in an `ENOENT` error, it - * will invoke the listener once, with all the fields zeroed (or, for dates, the - * Unix Epoch). If the file is created later on, the listener will be called - * again, with the latest stat objects. This is a change in functionality since - * v0.10. - * - * Using {@link watch} is more efficient than `fs.watchFile` and`fs.unwatchFile`. `fs.watch` should be used instead of `fs.watchFile` and`fs.unwatchFile` when possible. - * - * When a file being watched by `fs.watchFile()` disappears and reappears, - * then the contents of `previous` in the second callback event (the file's - * reappearance) will be the same as the contents of `previous` in the first - * callback event (its disappearance). - * - * This happens when: - * - * * the file is deleted, followed by a restore - * * the file is renamed and then renamed a second time back to its original name - * @since v0.1.31 - */ - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint?: false | undefined; - }) - | undefined, - listener: StatsListener, - ): StatWatcher; - export function watchFile( - filename: PathLike, - options: - | (WatchFileOptions & { - bigint: true; - }) - | undefined, - listener: BigIntStatsListener, - ): StatWatcher; - /** - * Watch for changes on `filename`. The callback `listener` will be called each time the file is accessed. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function watchFile(filename: PathLike, listener: StatsListener): StatWatcher; - /** - * Stop watching for changes on `filename`. If `listener` is specified, only that - * particular listener is removed. Otherwise, _all_ listeners are removed, - * effectively stopping watching of `filename`. - * - * Calling `fs.unwatchFile()` with a filename that is not being watched is a - * no-op, not an error. - * - * Using {@link watch} is more efficient than `fs.watchFile()` and`fs.unwatchFile()`. `fs.watch()` should be used instead of `fs.watchFile()`and `fs.unwatchFile()` when possible. - * @since v0.1.31 - * @param listener Optional, a listener previously attached using `fs.watchFile()` - */ - export function unwatchFile(filename: PathLike, listener?: StatsListener): void; - export function unwatchFile(filename: PathLike, listener?: BigIntStatsListener): void; - export interface WatchOptions extends Abortable { - encoding?: BufferEncoding | "buffer" | undefined; - persistent?: boolean | undefined; - recursive?: boolean | undefined; - } - export type WatchEventType = "rename" | "change"; - export type WatchListener = (event: WatchEventType, filename: T | null) => void; - export type StatsListener = (curr: Stats, prev: Stats) => void; - export type BigIntStatsListener = (curr: BigIntStats, prev: BigIntStats) => void; - /** - * Watch for changes on `filename`, where `filename` is either a file or a - * directory. - * - * The second argument is optional. If `options` is provided as a string, it - * specifies the `encoding`. Otherwise `options` should be passed as an object. - * - * The listener callback gets two arguments `(eventType, filename)`. `eventType`is either `'rename'` or `'change'`, and `filename` is the name of the file - * which triggered the event. - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * The listener callback is attached to the `'change'` event fired by `fs.FSWatcher`, but it is not the same thing as the `'change'` value of`eventType`. - * - * If a `signal` is passed, aborting the corresponding AbortController will close - * the returned `fs.FSWatcher`. - * @since v0.5.10 - * @param listener - */ - export function watch( - filename: PathLike, - options: - | (WatchOptions & { - encoding: "buffer"; - }) - | "buffer", - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options?: WatchOptions | BufferEncoding | null, - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - export function watch( - filename: PathLike, - options: WatchOptions | string, - listener?: WatchListener, - ): FSWatcher; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function watch(filename: PathLike, listener?: WatchListener): FSWatcher; - /** - * Test whether or not the given path exists by checking with the file system. - * Then call the `callback` argument with either true or false: - * - * ```js - * import { exists } from 'node:fs'; - * - * exists('/etc/passwd', (e) => { - * console.log(e ? 'it exists' : 'no passwd!'); - * }); - * ``` - * - * **The parameters for this callback are not consistent with other Node.js** - * **callbacks.** Normally, the first parameter to a Node.js callback is an `err`parameter, optionally followed by other parameters. The `fs.exists()` callback - * has only one boolean parameter. This is one reason `fs.access()` is recommended - * instead of `fs.exists()`. - * - * Using `fs.exists()` to check for the existence of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()` is not recommended. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file does not exist. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { exists, open, close } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * console.error('myfile already exists'); - * } else { - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { open, close, exists } from 'node:fs'; - * - * exists('myfile', (e) => { - * if (e) { - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * } else { - * console.error('myfile does not exist'); - * } - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for existence and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the existence of a file only if the file won't be - * used directly, for example when its existence is a signal from another - * process. - * @since v0.0.2 - * @deprecated Since v1.0.0 - Use {@link stat} or {@link access} instead. - */ - export function exists(path: PathLike, callback: (exists: boolean) => void): void; - /** @deprecated */ - export namespace exists { - /** - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike): Promise; - } - /** - * Returns `true` if the path exists, `false` otherwise. - * - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link exists}. - * - * `fs.exists()` is deprecated, but `fs.existsSync()` is not. The `callback`parameter to `fs.exists()` accepts parameters that are inconsistent with other - * Node.js callbacks. `fs.existsSync()` does not use a callback. - * - * ```js - * import { existsSync } from 'node:fs'; - * - * if (existsSync('/etc/passwd')) - * console.log('The path exists.'); - * ``` - * @since v0.1.21 - */ - export function existsSync(path: PathLike): boolean; - export namespace constants { - // File Access Constants - /** Constant for fs.access(). File is visible to the calling process. */ - const F_OK: number; - /** Constant for fs.access(). File can be read by the calling process. */ - const R_OK: number; - /** Constant for fs.access(). File can be written by the calling process. */ - const W_OK: number; - /** Constant for fs.access(). File can be executed by the calling process. */ - const X_OK: number; - // File Copy Constants - /** Constant for fs.copyFile. Flag indicating the destination file should not be overwritten if it already exists. */ - const COPYFILE_EXCL: number; - /** - * Constant for fs.copyFile. copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then a fallback copy mechanism is used. - */ - const COPYFILE_FICLONE: number; - /** - * Constant for fs.copyFile. Copy operation will attempt to create a copy-on-write reflink. - * If the underlying platform does not support copy-on-write, then the operation will fail with an error. - */ - const COPYFILE_FICLONE_FORCE: number; - // File Open Constants - /** Constant for fs.open(). Flag indicating to open a file for read-only access. */ - const O_RDONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for write-only access. */ - const O_WRONLY: number; - /** Constant for fs.open(). Flag indicating to open a file for read-write access. */ - const O_RDWR: number; - /** Constant for fs.open(). Flag indicating to create the file if it does not already exist. */ - const O_CREAT: number; - /** Constant for fs.open(). Flag indicating that opening a file should fail if the O_CREAT flag is set and the file already exists. */ - const O_EXCL: number; - /** - * Constant for fs.open(). Flag indicating that if path identifies a terminal device, - * opening the path shall not cause that terminal to become the controlling terminal for the process - * (if the process does not already have one). - */ - const O_NOCTTY: number; - /** Constant for fs.open(). Flag indicating that if the file exists and is a regular file, and the file is opened successfully for write access, its length shall be truncated to zero. */ - const O_TRUNC: number; - /** Constant for fs.open(). Flag indicating that data will be appended to the end of the file. */ - const O_APPEND: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is not a directory. */ - const O_DIRECTORY: number; - /** - * constant for fs.open(). - * Flag indicating reading accesses to the file system will no longer result in - * an update to the atime information associated with the file. - * This flag is available on Linux operating systems only. - */ - const O_NOATIME: number; - /** Constant for fs.open(). Flag indicating that the open should fail if the path is a symbolic link. */ - const O_NOFOLLOW: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O. */ - const O_SYNC: number; - /** Constant for fs.open(). Flag indicating that the file is opened for synchronous I/O with write operations waiting for data integrity. */ - const O_DSYNC: number; - /** Constant for fs.open(). Flag indicating to open the symbolic link itself rather than the resource it is pointing to. */ - const O_SYMLINK: number; - /** Constant for fs.open(). When set, an attempt will be made to minimize caching effects of file I/O. */ - const O_DIRECT: number; - /** Constant for fs.open(). Flag indicating to open the file in nonblocking mode when possible. */ - const O_NONBLOCK: number; - // File Type Constants - /** Constant for fs.Stats mode property for determining a file's type. Bit mask used to extract the file type code. */ - const S_IFMT: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a regular file. */ - const S_IFREG: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a directory. */ - const S_IFDIR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a character-oriented device file. */ - const S_IFCHR: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a block-oriented device file. */ - const S_IFBLK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a FIFO/pipe. */ - const S_IFIFO: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a symbolic link. */ - const S_IFLNK: number; - /** Constant for fs.Stats mode property for determining a file's type. File type constant for a socket. */ - const S_IFSOCK: number; - // File Mode Constants - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by owner. */ - const S_IRWXU: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by owner. */ - const S_IRUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by owner. */ - const S_IWUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by owner. */ - const S_IXUSR: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by group. */ - const S_IRWXG: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by group. */ - const S_IRGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by group. */ - const S_IWGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by group. */ - const S_IXGRP: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable, writable and executable by others. */ - const S_IRWXO: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating readable by others. */ - const S_IROTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating writable by others. */ - const S_IWOTH: number; - /** Constant for fs.Stats mode property for determining access permissions for a file. File mode indicating executable by others. */ - const S_IXOTH: number; - /** - * When set, a memory file mapping is used to access the file. This flag - * is available on Windows operating systems only. On other operating systems, - * this flag is ignored. - */ - const UV_FS_O_FILEMAP: number; - } - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * The final argument, `callback`, is a callback function that is invoked with - * a possible error argument. If any of the accessibility checks fail, the error - * argument will be an `Error` object. The following examples check if`package.json` exists, and if it is readable or writable. - * - * ```js - * import { access, constants } from 'node:fs'; - * - * const file = 'package.json'; - * - * // Check if the file exists in the current directory. - * access(file, constants.F_OK, (err) => { - * console.log(`${file} ${err ? 'does not exist' : 'exists'}`); - * }); - * - * // Check if the file is readable. - * access(file, constants.R_OK, (err) => { - * console.log(`${file} ${err ? 'is not readable' : 'is readable'}`); - * }); - * - * // Check if the file is writable. - * access(file, constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not writable' : 'is writable'}`); - * }); - * - * // Check if the file is readable and writable. - * access(file, constants.R_OK | constants.W_OK, (err) => { - * console.log(`${file} ${err ? 'is not' : 'is'} readable and writable`); - * }); - * ``` - * - * Do not use `fs.access()` to check for the accessibility of a file before calling`fs.open()`, `fs.readFile()`, or `fs.writeFile()`. Doing - * so introduces a race condition, since other processes may change the file's - * state between the two calls. Instead, user code should open/read/write the - * file directly and handle the error raised if the file is not accessible. - * - * **write (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * - * access('myfile', (err) => { - * if (!err) { - * console.error('myfile already exists'); - * return; - * } - * - * open('myfile', 'wx', (err, fd) => { - * if (err) throw err; - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **write (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'wx', (err, fd) => { - * if (err) { - * if (err.code === 'EEXIST') { - * console.error('myfile already exists'); - * return; - * } - * - * throw err; - * } - * - * try { - * writeMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * **read (NOT RECOMMENDED)** - * - * ```js - * import { access, open, close } from 'node:fs'; - * access('myfile', (err) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * open('myfile', 'r', (err, fd) => { - * if (err) throw err; - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * }); - * ``` - * - * **read (RECOMMENDED)** - * - * ```js - * import { open, close } from 'node:fs'; - * - * open('myfile', 'r', (err, fd) => { - * if (err) { - * if (err.code === 'ENOENT') { - * console.error('myfile does not exist'); - * return; - * } - * - * throw err; - * } - * - * try { - * readMyData(fd); - * } finally { - * close(fd, (err) => { - * if (err) throw err; - * }); - * } - * }); - * ``` - * - * The "not recommended" examples above check for accessibility and then use the - * file; the "recommended" examples are better because they use the file directly - * and handle the error, if any. - * - * In general, check for the accessibility of a file only if the file will not be - * used directly, for example when its accessibility is a signal from another - * process. - * - * On Windows, access-control policies (ACLs) on a directory may limit access to - * a file or directory. The `fs.access()` function, however, does not check the - * ACL and therefore may report that a path is accessible even if the ACL restricts - * the user from reading or writing to it. - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function access(path: PathLike, mode: number | undefined, callback: NoParamCallback): void; - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - */ - export function access(path: PathLike, callback: NoParamCallback): void; - export namespace access { - /** - * Asynchronously tests a user's permissions for the file specified by path. - * @param path A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * URL support is _experimental_. - */ - function __promisify__(path: PathLike, mode?: number): Promise; - } - /** - * Synchronously tests a user's permissions for the file or directory specified - * by `path`. The `mode` argument is an optional integer that specifies the - * accessibility checks to be performed. `mode` should be either the value`fs.constants.F_OK` or a mask consisting of the bitwise OR of any of`fs.constants.R_OK`, `fs.constants.W_OK`, and - * `fs.constants.X_OK` (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If any of the accessibility checks fail, an `Error` will be thrown. Otherwise, - * the method will return `undefined`. - * - * ```js - * import { accessSync, constants } from 'node:fs'; - * - * try { - * accessSync('etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can read/write'); - * } catch (err) { - * console.error('no access!'); - * } - * ``` - * @since v0.11.15 - * @param [mode=fs.constants.F_OK] - */ - export function accessSync(path: PathLike, mode?: number): void; - interface StreamOptions { - flags?: string | undefined; - encoding?: BufferEncoding | undefined; - fd?: number | promises.FileHandle | undefined; - mode?: number | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - signal?: AbortSignal | null | undefined; - highWaterMark?: number | undefined; - } - interface FSImplementation { - open?: (...args: any[]) => any; - close?: (...args: any[]) => any; - } - interface CreateReadStreamFSImplementation extends FSImplementation { - read: (...args: any[]) => any; - } - interface CreateWriteStreamFSImplementation extends FSImplementation { - write: (...args: any[]) => any; - writev?: (...args: any[]) => any; - } - interface ReadStreamOptions extends StreamOptions { - fs?: CreateReadStreamFSImplementation | null | undefined; - end?: number | undefined; - } - interface WriteStreamOptions extends StreamOptions { - fs?: CreateWriteStreamFSImplementation | null | undefined; - flush?: boolean | undefined; - } - /** - * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream - * returned by this method has a default `highWaterMark` of 64 KiB. - * - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `fd` is specified and `start` is - * omitted or `undefined`, `fs.createReadStream()` reads sequentially from the - * current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `fd` is specified, `ReadStream` will ignore the `path` argument and will use - * the specified file descriptor. This means that no `'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s should be passed to `net.Socket`. - * - * If `fd` points to a character device that only supports blocking reads - * (such as keyboard or sound card), read operations do not finish until data is - * available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option, it is possible to override the corresponding `fs`implementations for `open`, `read`, and `close`. When providing the `fs` option, - * an override for `read` is required. If no `fd` is provided, an override for`open` is also required. If `autoClose` is `true`, an override for `close` is - * also required. - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * // Create a stream from some character device. - * const stream = createReadStream('/dev/input/event0'); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * `mode` sets the file mode (permission and sticky bits), but only if the - * file was created. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { createReadStream } from 'node:fs'; - * - * createReadStream('sample.txt', { start: 90, end: 99 }); - * ``` - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createReadStream(path: PathLike, options?: BufferEncoding | ReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` option to be set to `r+` rather than the - * default `w`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * By providing the `fs` option it is possible to override the corresponding `fs`implementations for `open`, `write`, `writev`, and `close`. Overriding `write()`without `writev()` can reduce - * performance as some optimizations (`_writev()`) - * will be disabled. When providing the `fs` option, overrides for at least one of`write` and `writev` are required. If no `fd` option is supplied, an override - * for `open` is also required. If `autoClose` is `true`, an override for `close`is also required. - * - * Like `fs.ReadStream`, if `fd` is specified, `fs.WriteStream` will ignore the`path` argument and will use the specified file descriptor. This means that no`'open'` event will be - * emitted. `fd` should be blocking; non-blocking `fd`s - * should be passed to `net.Socket`. - * - * If `options` is a string, then it specifies the encoding. - * @since v0.1.31 - */ - export function createWriteStream(path: PathLike, options?: BufferEncoding | WriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. No arguments other - * than a possible - * exception are given to the completion callback. - * @since v0.1.96 - */ - export function fdatasync(fd: number, callback: NoParamCallback): void; - export namespace fdatasync { - /** - * Asynchronous fdatasync(2) - synchronize a file's in-core state with storage device. - * @param fd A file descriptor. - */ - function __promisify__(fd: number): Promise; - } - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. Returns `undefined`. - * @since v0.1.96 - */ - export function fdatasyncSync(fd: number): void; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. No arguments other than a possible exception are given to the - * callback function. Node.js makes no guarantees about the atomicity of the copy - * operation. If an error occurs after the destination file has been opened for - * writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFile, constants } from 'node:fs'; - * - * function callback(err) { - * if (err) throw err; - * console.log('source.txt was copied to destination.txt'); - * } - * - * // destination.txt will be created or overwritten by default. - * copyFile('source.txt', 'destination.txt', callback); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL, callback); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFile(src: PathLike, dest: PathLike, callback: NoParamCallback): void; - export function copyFile(src: PathLike, dest: PathLike, mode: number, callback: NoParamCallback): void; - export namespace copyFile { - function __promisify__(src: PathLike, dst: PathLike, mode?: number): Promise; - } - /** - * Synchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. Returns `undefined`. Node.js makes no guarantees about the - * atomicity of the copy operation. If an error occurs after the destination file - * has been opened for writing, Node.js will attempt to remove the destination. - * - * `mode` is an optional integer that specifies the behavior - * of the copy operation. It is possible to create a mask consisting of the bitwise - * OR of two or more values (e.g.`fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`). - * - * * `fs.constants.COPYFILE_EXCL`: The copy operation will fail if `dest` already - * exists. - * * `fs.constants.COPYFILE_FICLONE`: The copy operation will attempt to create a - * copy-on-write reflink. If the platform does not support copy-on-write, then a - * fallback copy mechanism is used. - * * `fs.constants.COPYFILE_FICLONE_FORCE`: The copy operation will attempt to - * create a copy-on-write reflink. If the platform does not support - * copy-on-write, then the operation will fail. - * - * ```js - * import { copyFileSync, constants } from 'node:fs'; - * - * // destination.txt will be created or overwritten by default. - * copyFileSync('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * copyFileSync('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * ``` - * @since v8.5.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] modifiers for copy operation. - */ - export function copyFileSync(src: PathLike, dest: PathLike, mode?: number): void; - /** - * Write an array of `ArrayBufferView`s to the file specified by `fd` using`writev()`. - * - * `position` is the offset from the beginning of the file where this data - * should be written. If `typeof position !== 'number'`, the data will be written - * at the current position. - * - * The callback will be given three arguments: `err`, `bytesWritten`, and`buffers`. `bytesWritten` is how many bytes were written from `buffers`. - * - * If this method is `util.promisify()` ed, it returns a promise for an`Object` with `bytesWritten` and `buffers` properties. - * - * It is unsafe to use `fs.writev()` multiple times on the same file without - * waiting for the callback. For this scenario, use {@link createWriteStream}. - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] - */ - export function writev( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export function writev( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesWritten: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export interface WriteVResult { - bytesWritten: number; - buffers: NodeJS.ArrayBufferView[]; - } - export namespace writev { - function __promisify__( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position?: number, - ): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link writev}. - * @since v12.9.0 - * @param [position='null'] - * @return The number of bytes written. - */ - export function writevSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - /** - * Read from a file specified by `fd` and write to an array of `ArrayBufferView`s - * using `readv()`. - * - * `position` is the offset from the beginning of the file from where data - * should be read. If `typeof position !== 'number'`, the data will be read - * from the current position. - * - * The callback will be given three arguments: `err`, `bytesRead`, and`buffers`. `bytesRead` is how many bytes were read from the file. - * - * If this method is invoked as its `util.promisify()` ed version, it returns - * a promise for an `Object` with `bytesRead` and `buffers` properties. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - */ - export function readv( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export function readv( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position: number, - cb: (err: NodeJS.ErrnoException | null, bytesRead: number, buffers: NodeJS.ArrayBufferView[]) => void, - ): void; - export interface ReadVResult { - bytesRead: number; - buffers: NodeJS.ArrayBufferView[]; - } - export namespace readv { - function __promisify__( - fd: number, - buffers: readonly NodeJS.ArrayBufferView[], - position?: number, - ): Promise; - } - /** - * For detailed information, see the documentation of the asynchronous version of - * this API: {@link readv}. - * @since v13.13.0, v12.17.0 - * @param [position='null'] - * @return The number of bytes read. - */ - export function readvSync(fd: number, buffers: readonly NodeJS.ArrayBufferView[], position?: number): number; - - export interface OpenAsBlobOptions { - /** - * An optional mime type for the blob. - * - * @default 'undefined' - */ - type?: string | undefined; - } - - /** - * Returns a `Blob` whose data is backed by the given file. - * - * The file must not be modified after the `Blob` is created. Any modifications - * will cause reading the `Blob` data to fail with a `DOMException` error. - * Synchronous stat operations on the file when the `Blob` is created, and before - * each read in order to detect whether the file data has been modified on disk. - * - * ```js - * import { openAsBlob } from 'node:fs'; - * - * const blob = await openAsBlob('the.file.txt'); - * const ab = await blob.arrayBuffer(); - * blob.stream(); - * ``` - * @since v19.8.0 - * @experimental - */ - export function openAsBlob(path: PathLike, options?: OpenAsBlobOptions): Promise; - - export interface OpenDirOptions { - /** - * @default 'utf8' - */ - encoding?: BufferEncoding | undefined; - /** - * Number of directory entries that are buffered - * internally when reading from the directory. Higher values lead to better - * performance but higher memory usage. - * @default 32 - */ - bufferSize?: number | undefined; - /** - * @default false - */ - recursive?: boolean; - } - /** - * Synchronously open a directory. See [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html). - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendirSync(path: PathLike, options?: OpenDirOptions): Dir; - /** - * Asynchronously open a directory. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for - * more details. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * @since v12.12.0 - */ - export function opendir(path: PathLike, cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void): void; - export function opendir( - path: PathLike, - options: OpenDirOptions, - cb: (err: NodeJS.ErrnoException | null, dir: Dir) => void, - ): void; - export namespace opendir { - function __promisify__(path: PathLike, options?: OpenDirOptions): Promise; - } - export interface BigIntStats extends StatsBase { - atimeNs: bigint; - mtimeNs: bigint; - ctimeNs: bigint; - birthtimeNs: bigint; - } - export interface BigIntOptions { - bigint: true; - } - export interface StatOptions { - bigint?: boolean | undefined; - } - export interface StatSyncOptions extends StatOptions { - throwIfNoEntry?: boolean | undefined; - } - interface CopyOptionsBase { - /** - * Dereference symlinks - * @default false - */ - dereference?: boolean; - /** - * When `force` is `false`, and the destination - * exists, throw an error. - * @default false - */ - errorOnExist?: boolean; - /** - * Overwrite existing file or directory. _The copy - * operation will ignore errors if you set this to false and the destination - * exists. Use the `errorOnExist` option to change this behavior. - * @default true - */ - force?: boolean; - /** - * Modifiers for copy operation. See `mode` flag of {@link copyFileSync()} - */ - mode?: number; - /** - * When `true` timestamps from `src` will - * be preserved. - * @default false - */ - preserveTimestamps?: boolean; - /** - * Copy directories recursively. - * @default false - */ - recursive?: boolean; - /** - * When true, path resolution for symlinks will be skipped - * @default false - */ - verbatimSymlinks?: boolean; - } - export interface CopyOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?(source: string, destination: string): boolean | Promise; - } - export interface CopySyncOptions extends CopyOptionsBase { - /** - * Function to filter copied files/directories. Return - * `true` to copy the item, `false` to ignore it. - */ - filter?(source: string, destination: string): boolean; - } - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cp( - source: string | URL, - destination: string | URL, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - export function cp( - source: string | URL, - destination: string | URL, - opts: CopyOptions, - callback: (err: NodeJS.ErrnoException | null) => void, - ): void; - /** - * Synchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - */ - export function cpSync(source: string | URL, destination: string | URL, opts?: CopySyncOptions): void; -} -declare module "node:fs" { - export * from "fs"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/fs/promises.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/fs/promises.d.ts deleted file mode 100644 index 88a9fc33..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/fs/promises.d.ts +++ /dev/null @@ -1,1239 +0,0 @@ -/** - * The `fs/promises` API provides asynchronous file system methods that return - * promises. - * - * The promise APIs use the underlying Node.js threadpool to perform file - * system operations off the event loop thread. These operations are not - * synchronized or threadsafe. Care must be taken when performing multiple - * concurrent modifications on the same file or data corruption may occur. - * @since v10.0.0 - */ -declare module "fs/promises" { - import { Abortable } from "node:events"; - import { Stream } from "node:stream"; - import { ReadableStream } from "node:stream/web"; - import { - BigIntStats, - BigIntStatsFs, - BufferEncodingOption, - constants as fsConstants, - CopyOptions, - Dir, - Dirent, - MakeDirectoryOptions, - Mode, - ObjectEncodingOptions, - OpenDirOptions, - OpenMode, - PathLike, - ReadStream, - ReadVResult, - RmDirOptions, - RmOptions, - StatFsOptions, - StatOptions, - Stats, - StatsFs, - TimeLike, - WatchEventType, - WatchOptions, - WriteStream, - WriteVResult, - } from "node:fs"; - import { Interface as ReadlineInterface } from "node:readline"; - interface FileChangeInfo { - eventType: WatchEventType; - filename: T | null; - } - interface FlagAndOpenMode { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - } - interface FileReadResult { - bytesRead: number; - buffer: T; - } - interface FileReadOptions { - /** - * @default `Buffer.alloc(0xffff)` - */ - buffer?: T; - /** - * @default 0 - */ - offset?: number | null; - /** - * @default `buffer.byteLength` - */ - length?: number | null; - position?: number | null; - } - interface CreateReadStreamOptions { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - end?: number | undefined; - highWaterMark?: number | undefined; - } - interface CreateWriteStreamOptions { - encoding?: BufferEncoding | null | undefined; - autoClose?: boolean | undefined; - emitClose?: boolean | undefined; - start?: number | undefined; - highWaterMark?: number | undefined; - flush?: boolean | undefined; - } - interface ReadableWebStreamOptions { - /** - * Whether to open a normal or a `'bytes'` stream. - * @since v20.0.0 - */ - type?: "bytes" | undefined; - } - // TODO: Add `EventEmitter` close - interface FileHandle { - /** - * The numeric file descriptor managed by the {FileHandle} object. - * @since v10.0.0 - */ - readonly fd: number; - /** - * Alias of `filehandle.writeFile()`. - * - * When operating on file handles, the mode cannot be changed from what it was set - * to with `fsPromises.open()`. Therefore, this is equivalent to `filehandle.writeFile()`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - appendFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) - | BufferEncoding - | null, - ): Promise; - /** - * Changes the ownership of the file. A wrapper for [`chown(2)`](http://man7.org/linux/man-pages/man2/chown.2.html). - * @since v10.0.0 - * @param uid The file's new owner's user id. - * @param gid The file's new group's group id. - * @return Fulfills with `undefined` upon success. - */ - chown(uid: number, gid: number): Promise; - /** - * Modifies the permissions on the file. See [`chmod(2)`](http://man7.org/linux/man-pages/man2/chmod.2.html). - * @since v10.0.0 - * @param mode the file mode bit mask. - * @return Fulfills with `undefined` upon success. - */ - chmod(mode: Mode): Promise; - /** - * Unlike the 16 KiB default `highWaterMark` for a `stream.Readable`, the stream - * returned by this method has a default `highWaterMark` of 64 KiB. - * - * `options` can include `start` and `end` values to read a range of bytes from - * the file instead of the entire file. Both `start` and `end` are inclusive and - * start counting at 0, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. If `start` is - * omitted or `undefined`, `filehandle.createReadStream()` reads sequentially from - * the current file position. The `encoding` can be any one of those accepted by `Buffer`. - * - * If the `FileHandle` points to a character device that only supports blocking - * reads (such as keyboard or sound card), read operations do not finish until data - * is available. This can prevent the process from exiting and the stream from - * closing naturally. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('/dev/input/event0'); - * // Create a stream from some character device. - * const stream = fd.createReadStream(); - * setTimeout(() => { - * stream.close(); // This may not close the stream. - * // Artificially marking end-of-stream, as if the underlying resource had - * // indicated end-of-file by itself, allows the stream to close. - * // This does not cancel pending read operations, and if there is such an - * // operation, the process may still not be able to exit successfully - * // until it finishes. - * stream.push(null); - * stream.read(0); - * }, 100); - * ``` - * - * If `autoClose` is false, then the file descriptor won't be closed, even if - * there's an error. It is the application's responsibility to close it and make - * sure there's no file descriptor leak. If `autoClose` is set to true (default - * behavior), on `'error'` or `'end'` the file descriptor will be closed - * automatically. - * - * An example to read the last 10 bytes of a file which is 100 bytes long: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const fd = await open('sample.txt'); - * fd.createReadStream({ start: 90, end: 99 }); - * ``` - * @since v16.11.0 - */ - createReadStream(options?: CreateReadStreamOptions): ReadStream; - /** - * `options` may also include a `start` option to allow writing data at some - * position past the beginning of the file, allowed values are in the - * \[0, [`Number.MAX_SAFE_INTEGER`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER)\] range. Modifying a file rather than - * replacing it may require the `flags` `open` option to be set to `r+` rather than - * the default `r`. The `encoding` can be any one of those accepted by `Buffer`. - * - * If `autoClose` is set to true (default behavior) on `'error'` or `'finish'`the file descriptor will be closed automatically. If `autoClose` is false, - * then the file descriptor won't be closed, even if there's an error. - * It is the application's responsibility to close it and make sure there's no - * file descriptor leak. - * - * By default, the stream will emit a `'close'` event after it has been - * destroyed. Set the `emitClose` option to `false` to change this behavior. - * @since v16.11.0 - */ - createWriteStream(options?: CreateWriteStreamOptions): WriteStream; - /** - * Forces all currently queued I/O operations associated with the file to the - * operating system's synchronized I/O completion state. Refer to the POSIX [`fdatasync(2)`](http://man7.org/linux/man-pages/man2/fdatasync.2.html) documentation for details. - * - * Unlike `filehandle.sync` this method does not flush modified metadata. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - datasync(): Promise; - /** - * Request that all data for the open file descriptor is flushed to the storage - * device. The specific implementation is operating system and device specific. - * Refer to the POSIX [`fsync(2)`](http://man7.org/linux/man-pages/man2/fsync.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - sync(): Promise; - /** - * Reads data from the file and stores that in the given buffer. - * - * If the file is not modified concurrently, the end-of-file is reached when the - * number of bytes read is zero. - * @since v10.0.0 - * @param buffer A buffer that will be filled with the file data read. - * @param offset The location in the buffer at which to start filling. - * @param length The number of bytes to read. - * @param position The location where to begin reading data from the file. If `null`, data will be read from the current file position, and the position will be updated. If `position` is an - * integer, the current file position will remain unchanged. - * @return Fulfills upon success with an object with two properties: - */ - read( - buffer: T, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise>; - read(options?: FileReadOptions): Promise>; - /** - * Returns a `ReadableStream` that may be used to read the files data. - * - * An error will be thrown if this method is called more than once or is called - * after the `FileHandle` is closed or closing. - * - * ```js - * import { - * open, - * } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const chunk of file.readableWebStream()) - * console.log(chunk); - * - * await file.close(); - * ``` - * - * While the `ReadableStream` will read the file to completion, it will not - * close the `FileHandle` automatically. User code must still call the`fileHandle.close()` method. - * @since v17.0.0 - * @experimental - */ - readableWebStream(options?: ReadableWebStreamOptions): ReadableStream; - /** - * Asynchronously reads the entire contents of a file. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support reading. - * - * If one or more `filehandle.read()` calls are made on a file handle and then a`filehandle.readFile()` call is made, the data will be read from the current - * position till the end of the file. It doesn't always read from the beginning - * of the file. - * @since v10.0.0 - * @return Fulfills upon a successful read with the contents of the file. If no encoding is specified (using `options.encoding`), the data is returned as a {Buffer} object. Otherwise, the - * data will be a string. - */ - readFile( - options?: { - encoding?: null | undefined; - flag?: OpenMode | undefined; - } | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile( - options: - | { - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. The underlying file will _not_ be closed automatically. - * The `FileHandle` must have been opened for reading. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - readFile( - options?: - | (ObjectEncodingOptions & { - flag?: OpenMode | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Convenience method to create a `readline` interface and stream over the file. - * See `filehandle.createReadStream()` for the options. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * const file = await open('./some/file/to/read'); - * - * for await (const line of file.readLines()) { - * console.log(line); - * } - * ``` - * @since v18.11.0 - */ - readLines(options?: CreateReadStreamOptions): ReadlineInterface; - /** - * @since v10.0.0 - * @return Fulfills with an {fs.Stats} for the file. - */ - stat( - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - stat( - opts: StatOptions & { - bigint: true; - }, - ): Promise; - stat(opts?: StatOptions): Promise; - /** - * Truncates the file. - * - * If the file was larger than `len` bytes, only the first `len` bytes will be - * retained in the file. - * - * The following example retains only the first four bytes of the file: - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle = null; - * try { - * filehandle = await open('temp.txt', 'r+'); - * await filehandle.truncate(4); - * } finally { - * await filehandle?.close(); - * } - * ``` - * - * If the file previously was shorter than `len` bytes, it is extended, and the - * extended part is filled with null bytes (`'\0'`): - * - * If `len` is negative then `0` will be used. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - truncate(len?: number): Promise; - /** - * Change the file system timestamps of the object referenced by the `FileHandle` then fulfills the promise with no arguments upon success. - * @since v10.0.0 - */ - utimes(atime: TimeLike, mtime: TimeLike): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * The promise is fulfilled with no arguments upon success. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `FileHandle` has to support writing. - * - * It is unsafe to use `filehandle.writeFile()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). - * - * If one or more `filehandle.write()` calls are made on a file handle and then a`filehandle.writeFile()` call is made, the data will be written from the - * current position till the end of the file. It doesn't always write from the - * beginning of the file. - * @since v10.0.0 - */ - writeFile( - data: string | Uint8Array, - options?: - | (ObjectEncodingOptions & FlagAndOpenMode & Abortable & { flush?: boolean | undefined }) - | BufferEncoding - | null, - ): Promise; - /** - * Write `buffer` to the file. - * - * The promise is fulfilled with an object containing two properties: - * - * It is unsafe to use `filehandle.write()` multiple times on the same file - * without waiting for the promise to be fulfilled (or rejected). For this - * scenario, use `filehandle.createWriteStream()`. - * - * On Linux, positional writes do not work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v10.0.0 - * @param offset The start position from within `buffer` where the data to write begins. - * @param [length=buffer.byteLength - offset] The number of bytes from `buffer` to write. - * @param [position='null'] The offset from the beginning of the file where the data from `buffer` should be written. If `position` is not a `number`, the data will be written at the current - * position. See the POSIX pwrite(2) documentation for more detail. - */ - write( - buffer: TBuffer, - offset?: number | null, - length?: number | null, - position?: number | null, - ): Promise<{ - bytesWritten: number; - buffer: TBuffer; - }>; - write( - data: string, - position?: number | null, - encoding?: BufferEncoding | null, - ): Promise<{ - bytesWritten: number; - buffer: string; - }>; - /** - * Write an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s to the file. - * - * The promise is fulfilled with an object containing a two properties: - * - * It is unsafe to call `writev()` multiple times on the same file without waiting - * for the promise to be fulfilled (or rejected). - * - * On Linux, positional writes don't work when the file is opened in append mode. - * The kernel ignores the position argument and always appends the data to - * the end of the file. - * @since v12.9.0 - * @param [position='null'] The offset from the beginning of the file where the data from `buffers` should be written. If `position` is not a `number`, the data will be written at the current - * position. - */ - writev(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; - /** - * Read from a file and write to an array of [ArrayBufferView](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView) s - * @since v13.13.0, v12.17.0 - * @param [position='null'] The offset from the beginning of the file where the data should be read from. If `position` is not a `number`, the data will be read from the current position. - * @return Fulfills upon success an object containing two properties: - */ - readv(buffers: readonly NodeJS.ArrayBufferView[], position?: number): Promise; - /** - * Closes the file handle after waiting for any pending operation on the handle to - * complete. - * - * ```js - * import { open } from 'node:fs/promises'; - * - * let filehandle; - * try { - * filehandle = await open('thefile.txt', 'r'); - * } finally { - * await filehandle?.close(); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - close(): Promise; - /** - * An alias for {@link FileHandle.close()}. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - const constants: typeof fsConstants; - /** - * Tests a user's permissions for the file or directory specified by `path`. - * The `mode` argument is an optional integer that specifies the accessibility - * checks to be performed. `mode` should be either the value `fs.constants.F_OK`or a mask consisting of the bitwise OR of any of `fs.constants.R_OK`,`fs.constants.W_OK`, and `fs.constants.X_OK` - * (e.g.`fs.constants.W_OK | fs.constants.R_OK`). Check `File access constants` for - * possible values of `mode`. - * - * If the accessibility check is successful, the promise is fulfilled with no - * value. If any of the accessibility checks fail, the promise is rejected - * with an [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object. The following example checks if the file`/etc/passwd` can be read and - * written by the current process. - * - * ```js - * import { access, constants } from 'node:fs/promises'; - * - * try { - * await access('/etc/passwd', constants.R_OK | constants.W_OK); - * console.log('can access'); - * } catch { - * console.error('cannot access'); - * } - * ``` - * - * Using `fsPromises.access()` to check for the accessibility of a file before - * calling `fsPromises.open()` is not recommended. Doing so introduces a race - * condition, since other processes may change the file's state between the two - * calls. Instead, user code should open/read/write the file directly and handle - * the error raised if the file is not accessible. - * @since v10.0.0 - * @param [mode=fs.constants.F_OK] - * @return Fulfills with `undefined` upon success. - */ - function access(path: PathLike, mode?: number): Promise; - /** - * Asynchronously copies `src` to `dest`. By default, `dest` is overwritten if it - * already exists. - * - * No guarantees are made about the atomicity of the copy operation. If an - * error occurs after the destination file has been opened for writing, an attempt - * will be made to remove the destination. - * - * ```js - * import { copyFile, constants } from 'node:fs/promises'; - * - * try { - * await copyFile('source.txt', 'destination.txt'); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * - * // By using COPYFILE_EXCL, the operation will fail if destination.txt exists. - * try { - * await copyFile('source.txt', 'destination.txt', constants.COPYFILE_EXCL); - * console.log('source.txt was copied to destination.txt'); - * } catch { - * console.error('The file could not be copied'); - * } - * ``` - * @since v10.0.0 - * @param src source filename to copy - * @param dest destination filename of the copy operation - * @param [mode=0] Optional modifiers that specify the behavior of the copy operation. It is possible to create a mask consisting of the bitwise OR of two or more values (e.g. - * `fs.constants.COPYFILE_EXCL | fs.constants.COPYFILE_FICLONE`) - * @return Fulfills with `undefined` upon success. - */ - function copyFile(src: PathLike, dest: PathLike, mode?: number): Promise; - /** - * Opens a `FileHandle`. - * - * Refer to the POSIX [`open(2)`](http://man7.org/linux/man-pages/man2/open.2.html) documentation for more detail. - * - * Some characters (`< > : " / \ | ? *`) are reserved under Windows as documented - * by [Naming Files, Paths, and Namespaces](https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file). Under NTFS, if the filename contains - * a colon, Node.js will open a file system stream, as described by [this MSDN page](https://docs.microsoft.com/en-us/windows/desktop/FileIO/using-streams). - * @since v10.0.0 - * @param [flags='r'] See `support of file system `flags``. - * @param [mode=0o666] Sets the file mode (permission and sticky bits) if the file is created. - * @return Fulfills with a {FileHandle} object. - */ - function open(path: PathLike, flags?: string | number, mode?: Mode): Promise; - /** - * Renames `oldPath` to `newPath`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rename(oldPath: PathLike, newPath: PathLike): Promise; - /** - * Truncates (shortens or extends the length) of the content at `path` to `len`bytes. - * @since v10.0.0 - * @param [len=0] - * @return Fulfills with `undefined` upon success. - */ - function truncate(path: PathLike, len?: number): Promise; - /** - * Removes the directory identified by `path`. - * - * Using `fsPromises.rmdir()` on a file (not a directory) results in the - * promise being rejected with an `ENOENT` error on Windows and an `ENOTDIR`error on POSIX. - * - * To get a behavior similar to the `rm -rf` Unix command, use `fsPromises.rm()` with options `{ recursive: true, force: true }`. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function rmdir(path: PathLike, options?: RmDirOptions): Promise; - /** - * Removes files and directories (modeled on the standard POSIX `rm` utility). - * @since v14.14.0 - * @return Fulfills with `undefined` upon success. - */ - function rm(path: PathLike, options?: RmOptions): Promise; - /** - * Asynchronously creates a directory. - * - * The optional `options` argument can be an integer specifying `mode` (permission - * and sticky bits), or an object with a `mode` property and a `recursive`property indicating whether parent directories should be created. Calling`fsPromises.mkdir()` when `path` is a directory - * that exists results in a - * rejection only when `recursive` is false. - * - * ```js - * import { mkdir } from 'node:fs/promises'; - * - * try { - * const projectFolder = new URL('./test/project/', import.meta.url); - * const createDir = await mkdir(projectFolder, { recursive: true }); - * - * console.log(`created ${createDir}`); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * @since v10.0.0 - * @return Upon success, fulfills with `undefined` if `recursive` is `false`, or the first directory path created if `recursive` is `true`. - */ - function mkdir( - path: PathLike, - options: MakeDirectoryOptions & { - recursive: true; - }, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir( - path: PathLike, - options?: - | Mode - | (MakeDirectoryOptions & { - recursive?: false | undefined; - }) - | null, - ): Promise; - /** - * Asynchronous mkdir(2) - create a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options Either the file mode, or an object optionally specifying the file mode and whether parent folders - * should be created. If a string is passed, it is parsed as an octal integer. If not specified, defaults to `0o777`. - */ - function mkdir(path: PathLike, options?: Mode | MakeDirectoryOptions | null): Promise; - /** - * Reads the contents of a directory. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the filenames. If the `encoding` is set to `'buffer'`, the filenames returned - * will be passed as `Buffer` objects. - * - * If `options.withFileTypes` is set to `true`, the returned array will contain `fs.Dirent` objects. - * - * ```js - * import { readdir } from 'node:fs/promises'; - * - * try { - * const files = await readdir(path); - * for (const file of files) - * console.log(file); - * } catch (err) { - * console.error(err); - * } - * ``` - * @since v10.0.0 - * @return Fulfills with an array of the names of the files in the directory excluding `'.'` and `'..'`. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options: - | { - encoding: "buffer"; - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - } - | "buffer", - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readdir( - path: PathLike, - options?: - | (ObjectEncodingOptions & { - withFileTypes?: false | undefined; - recursive?: boolean | undefined; - }) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronous readdir(3) - read a directory. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options If called with `withFileTypes: true` the result data will be an array of Dirent. - */ - function readdir( - path: PathLike, - options: ObjectEncodingOptions & { - withFileTypes: true; - recursive?: boolean | undefined; - }, - ): Promise; - /** - * Reads the contents of the symbolic link referred to by `path`. See the POSIX [`readlink(2)`](http://man7.org/linux/man-pages/man2/readlink.2.html) documentation for more detail. The promise is - * fulfilled with the`linkString` upon success. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the link path returned. If the `encoding` is set to `'buffer'`, the link path - * returned will be passed as a `Buffer` object. - * @since v10.0.0 - * @return Fulfills with the `linkString` upon success. - */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous readlink(2) - read value of a symbolic link. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function readlink(path: PathLike, options?: ObjectEncodingOptions | string | null): Promise; - /** - * Creates a symbolic link. - * - * The `type` argument is only used on Windows platforms and can be one of `'dir'`,`'file'`, or `'junction'`. If the `type` argument is not a string, Node.js will - * autodetect `target` type and use `'file'` or `'dir'`. If the `target` does not - * exist, `'file'` will be used. Windows junction points require the destination - * path to be absolute. When using `'junction'`, the `target` argument will - * automatically be normalized to absolute path. Junction points on NTFS volumes - * can only point to directories. - * @since v10.0.0 - * @param [type='null'] - * @return Fulfills with `undefined` upon success. - */ - function symlink(target: PathLike, path: PathLike, type?: string | null): Promise; - /** - * Equivalent to `fsPromises.stat()` unless `path` refers to a symbolic link, - * in which case the link itself is stat-ed, not the file that it refers to. - * Refer to the POSIX [`lstat(2)`](http://man7.org/linux/man-pages/man2/lstat.2.html) document for more detail. - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given symbolic link `path`. - */ - function lstat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function lstat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function lstat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v10.0.0 - * @return Fulfills with the {fs.Stats} object for the given `path`. - */ - function stat( - path: PathLike, - opts?: StatOptions & { - bigint?: false | undefined; - }, - ): Promise; - function stat( - path: PathLike, - opts: StatOptions & { - bigint: true; - }, - ): Promise; - function stat(path: PathLike, opts?: StatOptions): Promise; - /** - * @since v19.6.0, v18.15.0 - * @return Fulfills with the {fs.StatFs} object for the given `path`. - */ - function statfs( - path: PathLike, - opts?: StatFsOptions & { - bigint?: false | undefined; - }, - ): Promise; - function statfs( - path: PathLike, - opts: StatFsOptions & { - bigint: true; - }, - ): Promise; - function statfs(path: PathLike, opts?: StatFsOptions): Promise; - /** - * Creates a new link from the `existingPath` to the `newPath`. See the POSIX [`link(2)`](http://man7.org/linux/man-pages/man2/link.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function link(existingPath: PathLike, newPath: PathLike): Promise; - /** - * If `path` refers to a symbolic link, then the link is removed without affecting - * the file or directory to which that link refers. If the `path` refers to a file - * path that is not a symbolic link, the file is deleted. See the POSIX [`unlink(2)`](http://man7.org/linux/man-pages/man2/unlink.2.html) documentation for more detail. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function unlink(path: PathLike): Promise; - /** - * Changes the permissions of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the permissions on a symbolic link. - * - * This method is only implemented on macOS. - * @deprecated Since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchmod(path: PathLike, mode: Mode): Promise; - /** - * Changes the ownership on a symbolic link. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function lchown(path: PathLike, uid: number, gid: number): Promise; - /** - * Changes the access and modification times of a file in the same way as `fsPromises.utimes()`, with the difference that if the path refers to a - * symbolic link, then the link is not dereferenced: instead, the timestamps of - * the symbolic link itself are changed. - * @since v14.5.0, v12.19.0 - * @return Fulfills with `undefined` upon success. - */ - function lutimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Changes the ownership of a file. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function chown(path: PathLike, uid: number, gid: number): Promise; - /** - * Change the file system timestamps of the object referenced by `path`. - * - * The `atime` and `mtime` arguments follow these rules: - * - * * Values can be either numbers representing Unix epoch time, `Date`s, or a - * numeric string like `'123456789.0'`. - * * If the value can not be converted to a number, or is `NaN`, `Infinity`, or`-Infinity`, an `Error` will be thrown. - * @since v10.0.0 - * @return Fulfills with `undefined` upon success. - */ - function utimes(path: PathLike, atime: TimeLike, mtime: TimeLike): Promise; - /** - * Determines the actual location of `path` using the same semantics as the`fs.realpath.native()` function. - * - * Only paths that can be converted to UTF8 strings are supported. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use for - * the path. If the `encoding` is set to `'buffer'`, the path returned will be - * passed as a `Buffer` object. - * - * On Linux, when Node.js is linked against musl libc, the procfs file system must - * be mounted on `/proc` in order for this function to work. Glibc does not have - * this restriction. - * @since v10.0.0 - * @return Fulfills with the resolved path upon success. - */ - function realpath(path: PathLike, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath(path: PathLike, options: BufferEncodingOption): Promise; - /** - * Asynchronous realpath(3) - return the canonicalized absolute pathname. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function realpath( - path: PathLike, - options?: ObjectEncodingOptions | BufferEncoding | null, - ): Promise; - /** - * Creates a unique temporary directory. A unique directory name is generated by - * appending six random characters to the end of the provided `prefix`. Due to - * platform inconsistencies, avoid trailing `X` characters in `prefix`. Some - * platforms, notably the BSDs, can return more than six random characters, and - * replace trailing `X` characters in `prefix` with random characters. - * - * The optional `options` argument can be a string specifying an encoding, or an - * object with an `encoding` property specifying the character encoding to use. - * - * ```js - * import { mkdtemp } from 'node:fs/promises'; - * import { join } from 'node:path'; - * import { tmpdir } from 'node:os'; - * - * try { - * await mkdtemp(join(tmpdir(), 'foo-')); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * The `fsPromises.mkdtemp()` method will append the six randomly selected - * characters directly to the `prefix` string. For instance, given a directory`/tmp`, if the intention is to create a temporary directory _within_`/tmp`, the`prefix` must end with a trailing - * platform-specific path separator - * (`require('node:path').sep`). - * @since v10.0.0 - * @return Fulfills with a string containing the file system path of the newly created temporary directory. - */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options: BufferEncodingOption): Promise; - /** - * Asynchronously creates a unique temporary directory. - * Generates six random characters to be appended behind a required `prefix` to create a unique temporary directory. - * @param options The encoding (or an object specifying the encoding), used as the encoding of the result. If not provided, `'utf8'` is used. - */ - function mkdtemp(prefix: string, options?: ObjectEncodingOptions | BufferEncoding | null): Promise; - /** - * Asynchronously writes data to a file, replacing the file if it already exists.`data` can be a string, a buffer, an - * [AsyncIterable](https://tc39.github.io/ecma262/#sec-asynciterable-interface), or an - * [Iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#The_iterable_protocol) object. - * - * The `encoding` option is ignored if `data` is a buffer. - * - * If `options` is a string, then it specifies the encoding. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * Any specified `FileHandle` has to support writing. - * - * It is unsafe to use `fsPromises.writeFile()` multiple times on the same file - * without waiting for the promise to be settled. - * - * Similarly to `fsPromises.readFile` \- `fsPromises.writeFile` is a convenience - * method that performs multiple `write` calls internally to write the buffer - * passed to it. For performance sensitive code consider using `fs.createWriteStream()` or `filehandle.createWriteStream()`. - * - * It is possible to use an `AbortSignal` to cancel an `fsPromises.writeFile()`. - * Cancelation is "best effort", and some amount of data is likely still - * to be written. - * - * ```js - * import { writeFile } from 'node:fs/promises'; - * import { Buffer } from 'node:buffer'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const data = new Uint8Array(Buffer.from('Hello Node.js')); - * const promise = writeFile('message.txt', data, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.writeFile` performs. - * @since v10.0.0 - * @param file filename or `FileHandle` - * @return Fulfills with `undefined` upon success. - */ - function writeFile( - file: PathLike | FileHandle, - data: - | string - | NodeJS.ArrayBufferView - | Iterable - | AsyncIterable - | Stream, - options?: - | (ObjectEncodingOptions & { - mode?: Mode | undefined; - flag?: OpenMode | undefined; - } & Abortable) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously append data to a file, creating the file if it does not yet - * exist. `data` can be a string or a `Buffer`. - * - * If `options` is a string, then it specifies the `encoding`. - * - * The `mode` option only affects the newly created file. See `fs.open()` for more details. - * - * The `path` may be specified as a `FileHandle` that has been opened - * for appending (using `fsPromises.open()`). - * @since v10.0.0 - * @param path filename or {FileHandle} - * @return Fulfills with `undefined` upon success. - */ - function appendFile( - path: PathLike | FileHandle, - data: string | Uint8Array, - options?: (ObjectEncodingOptions & FlagAndOpenMode & { flush?: boolean | undefined }) | BufferEncoding | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * - * If no encoding is specified (using `options.encoding`), the data is returned - * as a `Buffer` object. Otherwise, the data will be a string. - * - * If `options` is a string, then it specifies the encoding. - * - * When the `path` is a directory, the behavior of `fsPromises.readFile()` is - * platform-specific. On macOS, Linux, and Windows, the promise will be rejected - * with an error. On FreeBSD, a representation of the directory's contents will be - * returned. - * - * An example of reading a `package.json` file located in the same directory of the - * running code: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * try { - * const filePath = new URL('./package.json', import.meta.url); - * const contents = await readFile(filePath, { encoding: 'utf8' }); - * console.log(contents); - * } catch (err) { - * console.error(err.message); - * } - * ``` - * - * It is possible to abort an ongoing `readFile` using an `AbortSignal`. If a - * request is aborted the promise returned is rejected with an `AbortError`: - * - * ```js - * import { readFile } from 'node:fs/promises'; - * - * try { - * const controller = new AbortController(); - * const { signal } = controller; - * const promise = readFile(fileName, { signal }); - * - * // Abort the request before the promise settles. - * controller.abort(); - * - * await promise; - * } catch (err) { - * // When a request is aborted - err is an AbortError - * console.error(err); - * } - * ``` - * - * Aborting an ongoing request does not abort individual operating - * system requests but rather the internal buffering `fs.readFile` performs. - * - * Any specified `FileHandle` has to support reading. - * @since v10.0.0 - * @param path filename or `FileHandle` - * @return Fulfills with the contents of the file. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ({ - encoding?: null | undefined; - flag?: OpenMode | undefined; - } & Abortable) - | null, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options: - | ({ - encoding: BufferEncoding; - flag?: OpenMode | undefined; - } & Abortable) - | BufferEncoding, - ): Promise; - /** - * Asynchronously reads the entire contents of a file. - * @param path A path to a file. If a URL is provided, it must use the `file:` protocol. - * If a `FileHandle` is provided, the underlying file will _not_ be closed automatically. - * @param options An object that may contain an optional flag. - * If a flag is not provided, it defaults to `'r'`. - */ - function readFile( - path: PathLike | FileHandle, - options?: - | ( - & ObjectEncodingOptions - & Abortable - & { - flag?: OpenMode | undefined; - } - ) - | BufferEncoding - | null, - ): Promise; - /** - * Asynchronously open a directory for iterative scanning. See the POSIX [`opendir(3)`](http://man7.org/linux/man-pages/man3/opendir.3.html) documentation for more detail. - * - * Creates an `fs.Dir`, which contains all further functions for reading from - * and cleaning up the directory. - * - * The `encoding` option sets the encoding for the `path` while opening the - * directory and subsequent read operations. - * - * Example using async iteration: - * - * ```js - * import { opendir } from 'node:fs/promises'; - * - * try { - * const dir = await opendir('./'); - * for await (const dirent of dir) - * console.log(dirent.name); - * } catch (err) { - * console.error(err); - * } - * ``` - * - * When using the async iterator, the `fs.Dir` object will be automatically - * closed after the iterator exits. - * @since v12.12.0 - * @return Fulfills with an {fs.Dir}. - */ - function opendir(path: PathLike, options?: OpenDirOptions): Promise; - /** - * Returns an async iterator that watches for changes on `filename`, where `filename`is either a file or a directory. - * - * ```js - * const { watch } = require('node:fs/promises'); - * - * const ac = new AbortController(); - * const { signal } = ac; - * setTimeout(() => ac.abort(), 10000); - * - * (async () => { - * try { - * const watcher = watch(__filename, { signal }); - * for await (const event of watcher) - * console.log(event); - * } catch (err) { - * if (err.name === 'AbortError') - * return; - * throw err; - * } - * })(); - * ``` - * - * On most platforms, `'rename'` is emitted whenever a filename appears or - * disappears in the directory. - * - * All the `caveats` for `fs.watch()` also apply to `fsPromises.watch()`. - * @since v15.9.0, v14.18.0 - * @return of objects with the properties: - */ - function watch( - filename: PathLike, - options: - | (WatchOptions & { - encoding: "buffer"; - }) - | "buffer", - ): AsyncIterable>; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch(filename: PathLike, options?: WatchOptions | BufferEncoding): AsyncIterable>; - /** - * Watch for changes on `filename`, where `filename` is either a file or a directory, returning an `FSWatcher`. - * @param filename A path to a file or directory. If a URL is provided, it must use the `file:` protocol. - * @param options Either the encoding for the filename provided to the listener, or an object optionally specifying encoding, persistent, and recursive options. - * If `encoding` is not supplied, the default of `'utf8'` is used. - * If `persistent` is not supplied, the default of `true` is used. - * If `recursive` is not supplied, the default of `false` is used. - */ - function watch( - filename: PathLike, - options: WatchOptions | string, - ): AsyncIterable> | AsyncIterable>; - /** - * Asynchronously copies the entire directory structure from `src` to `dest`, - * including subdirectories and files. - * - * When copying a directory to another directory, globs are not supported and - * behavior is similar to `cp dir1/ dir2/`. - * @since v16.7.0 - * @experimental - * @param src source path to copy. - * @param dest destination path to copy to. - * @return Fulfills with `undefined` upon success. - */ - function cp(source: string | URL, destination: string | URL, opts?: CopyOptions): Promise; -} -declare module "node:fs/promises" { - export * from "fs/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/globals.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/globals.d.ts deleted file mode 100644 index 5f250062..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/globals.d.ts +++ /dev/null @@ -1,411 +0,0 @@ -export {}; // Make this a module - -// #region Fetch and friends -// Conditional type aliases, used at the end of this file. -// Will either be empty if lib-dom is included, or the undici version otherwise. -type _Request = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Request; -type _Response = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Response; -type _FormData = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").FormData; -type _Headers = typeof globalThis extends { onmessage: any } ? {} : import("undici-types").Headers; -type _RequestInit = typeof globalThis extends { onmessage: any } ? {} - : import("undici-types").RequestInit; -type _ResponseInit = typeof globalThis extends { onmessage: any } ? {} - : import("undici-types").ResponseInit; -type _File = typeof globalThis extends { onmessage: any } ? {} : import("node:buffer").File; -// #endregion Fetch and friends - -declare global { - // Declare "static" methods in Error - interface ErrorConstructor { - /** Create .stack property on a target object */ - captureStackTrace(targetObject: object, constructorOpt?: Function): void; - - /** - * Optional override for formatting stack traces - * - * @see https://v8.dev/docs/stack-trace-api#customizing-stack-traces - */ - prepareStackTrace?: ((err: Error, stackTraces: NodeJS.CallSite[]) => any) | undefined; - - stackTraceLimit: number; - } - - /*-----------------------------------------------* - * * - * GLOBAL * - * * - ------------------------------------------------*/ - - // For backwards compability - interface NodeRequire extends NodeJS.Require {} - interface RequireResolve extends NodeJS.RequireResolve {} - interface NodeModule extends NodeJS.Module {} - - var process: NodeJS.Process; - var console: Console; - - var __filename: string; - var __dirname: string; - - var require: NodeRequire; - var module: NodeModule; - - // Same as module.exports - var exports: any; - - /** - * Only available if `--expose-gc` is passed to the process. - */ - var gc: undefined | (() => void); - - // #region borrowed - // from https://github.com/microsoft/TypeScript/blob/38da7c600c83e7b31193a62495239a0fe478cb67/lib/lib.webworker.d.ts#L633 until moved to separate lib - /** A controller object that allows you to abort one or more DOM requests as and when desired. */ - interface AbortController { - /** - * Returns the AbortSignal object associated with this object. - */ - - readonly signal: AbortSignal; - /** - * Invoking this method will set this object's AbortSignal's aborted flag and signal to any observers that the associated activity is to be aborted. - */ - abort(reason?: any): void; - } - - /** A signal object that allows you to communicate with a DOM request (such as a Fetch) and abort it if required via an AbortController object. */ - interface AbortSignal extends EventTarget { - /** - * Returns true if this AbortSignal's AbortController has signaled to abort, and false otherwise. - */ - readonly aborted: boolean; - readonly reason: any; - onabort: null | ((this: AbortSignal, event: Event) => any); - throwIfAborted(): void; - } - - var AbortController: typeof globalThis extends { onmessage: any; AbortController: infer T } ? T - : { - prototype: AbortController; - new(): AbortController; - }; - - var AbortSignal: typeof globalThis extends { onmessage: any; AbortSignal: infer T } ? T - : { - prototype: AbortSignal; - new(): AbortSignal; - abort(reason?: any): AbortSignal; - timeout(milliseconds: number): AbortSignal; - }; - // #endregion borrowed - - // #region Disposable - interface SymbolConstructor { - /** - * A method that is used to release resources held by an object. Called by the semantics of the `using` statement. - */ - readonly dispose: unique symbol; - - /** - * A method that is used to asynchronously release resources held by an object. Called by the semantics of the `await using` statement. - */ - readonly asyncDispose: unique symbol; - } - - interface Disposable { - [Symbol.dispose](): void; - } - - interface AsyncDisposable { - [Symbol.asyncDispose](): PromiseLike; - } - // #endregion Disposable - - // #region ArrayLike.at() - interface RelativeIndexable { - /** - * Takes an integer value and returns the item at that index, - * allowing for positive and negative integers. - * Negative integers count back from the last item in the array. - */ - at(index: number): T | undefined; - } - interface String extends RelativeIndexable {} - interface Array extends RelativeIndexable {} - interface ReadonlyArray extends RelativeIndexable {} - interface Int8Array extends RelativeIndexable {} - interface Uint8Array extends RelativeIndexable {} - interface Uint8ClampedArray extends RelativeIndexable {} - interface Int16Array extends RelativeIndexable {} - interface Uint16Array extends RelativeIndexable {} - interface Int32Array extends RelativeIndexable {} - interface Uint32Array extends RelativeIndexable {} - interface Float32Array extends RelativeIndexable {} - interface Float64Array extends RelativeIndexable {} - interface BigInt64Array extends RelativeIndexable {} - interface BigUint64Array extends RelativeIndexable {} - // #endregion ArrayLike.at() end - - /** - * @since v17.0.0 - * - * Creates a deep clone of an object. - */ - function structuredClone( - value: T, - transfer?: { transfer: ReadonlyArray }, - ): T; - - /*----------------------------------------------* - * * - * GLOBAL INTERFACES * - * * - *-----------------------------------------------*/ - namespace NodeJS { - interface CallSite { - /** - * Value of "this" - */ - getThis(): unknown; - - /** - * Type of "this" as a string. - * This is the name of the function stored in the constructor field of - * "this", if available. Otherwise the object's [[Class]] internal - * property. - */ - getTypeName(): string | null; - - /** - * Current function - */ - getFunction(): Function | undefined; - - /** - * Name of the current function, typically its name property. - * If a name property is not available an attempt will be made to try - * to infer a name from the function's context. - */ - getFunctionName(): string | null; - - /** - * Name of the property [of "this" or one of its prototypes] that holds - * the current function - */ - getMethodName(): string | null; - - /** - * Name of the script [if this function was defined in a script] - */ - getFileName(): string | undefined; - - /** - * Current line number [if this function was defined in a script] - */ - getLineNumber(): number | null; - - /** - * Current column number [if this function was defined in a script] - */ - getColumnNumber(): number | null; - - /** - * A call site object representing the location where eval was called - * [if this function was created using a call to eval] - */ - getEvalOrigin(): string | undefined; - - /** - * Is this a toplevel invocation, that is, is "this" the global object? - */ - isToplevel(): boolean; - - /** - * Does this call take place in code defined by a call to eval? - */ - isEval(): boolean; - - /** - * Is this call in native V8 code? - */ - isNative(): boolean; - - /** - * Is this a constructor call? - */ - isConstructor(): boolean; - - /** - * is this an async call (i.e. await, Promise.all(), or Promise.any())? - */ - isAsync(): boolean; - - /** - * is this an async call to Promise.all()? - */ - isPromiseAll(): boolean; - - /** - * returns the index of the promise element that was followed in - * Promise.all() or Promise.any() for async stack traces, or null - * if the CallSite is not an async - */ - getPromiseIndex(): number | null; - - getScriptNameOrSourceURL(): string; - getScriptHash(): string; - - getEnclosingColumnNumber(): number; - getEnclosingLineNumber(): number; - getPosition(): number; - - toString(): string; - } - - interface ErrnoException extends Error { - errno?: number | undefined; - code?: string | undefined; - path?: string | undefined; - syscall?: string | undefined; - } - - interface ReadableStream extends EventEmitter { - readable: boolean; - read(size?: number): string | Buffer; - setEncoding(encoding: BufferEncoding): this; - pause(): this; - resume(): this; - isPaused(): boolean; - pipe(destination: T, options?: { end?: boolean | undefined }): T; - unpipe(destination?: WritableStream): this; - unshift(chunk: string | Uint8Array, encoding?: BufferEncoding): void; - wrap(oldStream: ReadableStream): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - - interface WritableStream extends EventEmitter { - writable: boolean; - write(buffer: Uint8Array | string, cb?: (err?: Error | null) => void): boolean; - write(str: string, encoding?: BufferEncoding, cb?: (err?: Error | null) => void): boolean; - end(cb?: () => void): this; - end(data: string | Uint8Array, cb?: () => void): this; - end(str: string, encoding?: BufferEncoding, cb?: () => void): this; - } - - interface ReadWriteStream extends ReadableStream, WritableStream {} - - interface RefCounted { - ref(): this; - unref(): this; - } - - type TypedArray = - | Uint8Array - | Uint8ClampedArray - | Uint16Array - | Uint32Array - | Int8Array - | Int16Array - | Int32Array - | BigUint64Array - | BigInt64Array - | Float32Array - | Float64Array; - type ArrayBufferView = TypedArray | DataView; - - interface Require { - (id: string): any; - resolve: RequireResolve; - cache: Dict; - /** - * @deprecated - */ - extensions: RequireExtensions; - main: Module | undefined; - } - - interface RequireResolve { - (id: string, options?: { paths?: string[] | undefined }): string; - paths(request: string): string[] | null; - } - - interface RequireExtensions extends Dict<(m: Module, filename: string) => any> { - ".js": (m: Module, filename: string) => any; - ".json": (m: Module, filename: string) => any; - ".node": (m: Module, filename: string) => any; - } - interface Module { - /** - * `true` if the module is running during the Node.js preload - */ - isPreloading: boolean; - exports: any; - require: Require; - id: string; - filename: string; - loaded: boolean; - /** @deprecated since v14.6.0 Please use `require.main` and `module.children` instead. */ - parent: Module | null | undefined; - children: Module[]; - /** - * @since v11.14.0 - * - * The directory name of the module. This is usually the same as the path.dirname() of the module.id. - */ - path: string; - paths: string[]; - } - - interface Dict { - [key: string]: T | undefined; - } - - interface ReadOnlyDict { - readonly [key: string]: T | undefined; - } - } - - interface RequestInit extends _RequestInit {} - - function fetch( - input: string | URL | globalThis.Request, - init?: RequestInit, - ): Promise; - - interface Request extends _Request {} - var Request: typeof globalThis extends { - onmessage: any; - Request: infer T; - } ? T - : typeof import("undici-types").Request; - - interface ResponseInit extends _ResponseInit {} - - interface Response extends _Response {} - var Response: typeof globalThis extends { - onmessage: any; - Response: infer T; - } ? T - : typeof import("undici-types").Response; - - interface FormData extends _FormData {} - var FormData: typeof globalThis extends { - onmessage: any; - FormData: infer T; - } ? T - : typeof import("undici-types").FormData; - - interface Headers extends _Headers {} - var Headers: typeof globalThis extends { - onmessage: any; - Headers: infer T; - } ? T - : typeof import("undici-types").Headers; - - interface File extends _File {} - var File: typeof globalThis extends { - onmessage: any; - File: infer T; - } ? T - : typeof import("node:buffer").File; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/globals.global.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/globals.global.d.ts deleted file mode 100644 index ef1198c0..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/globals.global.d.ts +++ /dev/null @@ -1 +0,0 @@ -declare var global: typeof globalThis; diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/http.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/http.d.ts deleted file mode 100644 index 9b2c3c2c..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/http.d.ts +++ /dev/null @@ -1,1888 +0,0 @@ -/** - * To use the HTTP server and client one must `require('node:http')`. - * - * The HTTP interfaces in Node.js are designed to support many features - * of the protocol which have been traditionally difficult to use. - * In particular, large, possibly chunk-encoded, messages. The interface is - * careful to never buffer entire requests or responses, so the - * user is able to stream data. - * - * HTTP message headers are represented by an object like this: - * - * ```js - * { 'content-length': '123', - * 'content-type': 'text/plain', - * 'connection': 'keep-alive', - * 'host': 'example.com', - * 'accept': '*' } - * ``` - * - * Keys are lowercased. Values are not modified. - * - * In order to support the full spectrum of possible HTTP applications, the Node.js - * HTTP API is very low-level. It deals with stream handling and message - * parsing only. It parses a message into headers and body but it does not - * parse the actual headers or the body. - * - * See `message.headers` for details on how duplicate headers are handled. - * - * The raw headers as they were received are retained in the `rawHeaders`property, which is an array of `[key, value, key2, value2, ...]`. For - * example, the previous message header object might have a `rawHeaders`list like the following: - * - * ```js - * [ 'ConTent-Length', '123456', - * 'content-LENGTH', '123', - * 'content-type', 'text/plain', - * 'CONNECTION', 'keep-alive', - * 'Host', 'example.com', - * 'accepT', '*' ] - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http.js) - */ -declare module "http" { - import * as stream from "node:stream"; - import { URL } from "node:url"; - import { LookupOptions } from "node:dns"; - import { EventEmitter } from "node:events"; - import { LookupFunction, Server as NetServer, Socket, TcpSocketConnectOpts } from "node:net"; - // incoming headers will never contain number - interface IncomingHttpHeaders extends NodeJS.Dict { - accept?: string | undefined; - "accept-language"?: string | undefined; - "accept-patch"?: string | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - "alt-svc"?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - connection?: string | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-type"?: string | undefined; - cookie?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - location?: string | undefined; - origin?: string | undefined; - pragma?: string | undefined; - "proxy-authenticate"?: string | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "retry-after"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | undefined; - "sec-websocket-version"?: string | undefined; - "set-cookie"?: string[] | undefined; - "strict-transport-security"?: string | undefined; - tk?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - upgrade?: string | undefined; - "user-agent"?: string | undefined; - vary?: string | undefined; - via?: string | undefined; - warning?: string | undefined; - "www-authenticate"?: string | undefined; - } - // outgoing headers allows numbers (as they are converted internally to strings) - type OutgoingHttpHeader = number | string | string[]; - interface OutgoingHttpHeaders extends NodeJS.Dict { - accept?: string | string[] | undefined; - "accept-charset"?: string | string[] | undefined; - "accept-encoding"?: string | string[] | undefined; - "accept-language"?: string | string[] | undefined; - "accept-ranges"?: string | undefined; - "access-control-allow-credentials"?: string | undefined; - "access-control-allow-headers"?: string | undefined; - "access-control-allow-methods"?: string | undefined; - "access-control-allow-origin"?: string | undefined; - "access-control-expose-headers"?: string | undefined; - "access-control-max-age"?: string | undefined; - "access-control-request-headers"?: string | undefined; - "access-control-request-method"?: string | undefined; - age?: string | undefined; - allow?: string | undefined; - authorization?: string | undefined; - "cache-control"?: string | undefined; - "cdn-cache-control"?: string | undefined; - connection?: string | string[] | undefined; - "content-disposition"?: string | undefined; - "content-encoding"?: string | undefined; - "content-language"?: string | undefined; - "content-length"?: string | number | undefined; - "content-location"?: string | undefined; - "content-range"?: string | undefined; - "content-security-policy"?: string | undefined; - "content-security-policy-report-only"?: string | undefined; - cookie?: string | string[] | undefined; - dav?: string | string[] | undefined; - dnt?: string | undefined; - date?: string | undefined; - etag?: string | undefined; - expect?: string | undefined; - expires?: string | undefined; - forwarded?: string | undefined; - from?: string | undefined; - host?: string | undefined; - "if-match"?: string | undefined; - "if-modified-since"?: string | undefined; - "if-none-match"?: string | undefined; - "if-range"?: string | undefined; - "if-unmodified-since"?: string | undefined; - "last-modified"?: string | undefined; - link?: string | string[] | undefined; - location?: string | undefined; - "max-forwards"?: string | undefined; - origin?: string | undefined; - prgama?: string | string[] | undefined; - "proxy-authenticate"?: string | string[] | undefined; - "proxy-authorization"?: string | undefined; - "public-key-pins"?: string | undefined; - "public-key-pins-report-only"?: string | undefined; - range?: string | undefined; - referer?: string | undefined; - "referrer-policy"?: string | undefined; - refresh?: string | undefined; - "retry-after"?: string | undefined; - "sec-websocket-accept"?: string | undefined; - "sec-websocket-extensions"?: string | string[] | undefined; - "sec-websocket-key"?: string | undefined; - "sec-websocket-protocol"?: string | string[] | undefined; - "sec-websocket-version"?: string | undefined; - server?: string | undefined; - "set-cookie"?: string | string[] | undefined; - "strict-transport-security"?: string | undefined; - te?: string | undefined; - trailer?: string | undefined; - "transfer-encoding"?: string | undefined; - "user-agent"?: string | undefined; - upgrade?: string | undefined; - "upgrade-insecure-requests"?: string | undefined; - vary?: string | undefined; - via?: string | string[] | undefined; - warning?: string | undefined; - "www-authenticate"?: string | string[] | undefined; - "x-content-type-options"?: string | undefined; - "x-dns-prefetch-control"?: string | undefined; - "x-frame-options"?: string | undefined; - "x-xss-protection"?: string | undefined; - } - interface ClientRequestArgs { - _defaultAgent?: Agent | undefined; - agent?: Agent | boolean | undefined; - auth?: string | null | undefined; - // https://github.com/nodejs/node/blob/master/lib/_http_client.js#L278 - createConnection?: - | ((options: ClientRequestArgs, oncreate: (err: Error, socket: Socket) => void) => Socket) - | undefined; - defaultPort?: number | string | undefined; - family?: number | undefined; - headers?: OutgoingHttpHeaders | undefined; - hints?: LookupOptions["hints"]; - host?: string | null | undefined; - hostname?: string | null | undefined; - insecureHTTPParser?: boolean | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - lookup?: LookupFunction | undefined; - /** - * @default 16384 - */ - maxHeaderSize?: number | undefined; - method?: string | undefined; - path?: string | null | undefined; - port?: number | string | null | undefined; - protocol?: string | null | undefined; - setHost?: boolean | undefined; - signal?: AbortSignal | undefined; - socketPath?: string | undefined; - timeout?: number | undefined; - uniqueHeaders?: Array | undefined; - joinDuplicateHeaders?: boolean; - } - interface ServerOptions< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > { - /** - * Specifies the `IncomingMessage` class to be used. Useful for extending the original `IncomingMessage`. - */ - IncomingMessage?: Request | undefined; - /** - * Specifies the `ServerResponse` class to be used. Useful for extending the original `ServerResponse`. - */ - ServerResponse?: Response | undefined; - /** - * Sets the timeout value in milliseconds for receiving the entire request from the client. - * @see Server.requestTimeout for more information. - * @default 300000 - * @since v18.0.0 - */ - requestTimeout?: number | undefined; - /** - * It joins the field line values of multiple headers in a request with `, ` instead of discarding the duplicates. - * @default false - * @since v18.14.0 - */ - joinDuplicateHeaders?: boolean; - /** - * The number of milliseconds of inactivity a server needs to wait for additional incoming data, - * after it has finished writing the last response, before a socket will be destroyed. - * @see Server.keepAliveTimeout for more information. - * @default 5000 - * @since v18.0.0 - */ - keepAliveTimeout?: number | undefined; - /** - * Sets the interval value in milliseconds to check for request and headers timeout in incomplete requests. - * @default 30000 - */ - connectionsCheckingInterval?: number | undefined; - /** - * Optionally overrides all `socket`s' `readableHighWaterMark` and `writableHighWaterMark`. - * This affects `highWaterMark` property of both `IncomingMessage` and `ServerResponse`. - * Default: @see stream.getDefaultHighWaterMark(). - * @since v20.1.0 - */ - highWaterMark?: number | undefined; - /** - * Use an insecure HTTP parser that accepts invalid HTTP headers when `true`. - * Using the insecure parser should be avoided. - * See --insecure-http-parser for more information. - * @default false - */ - insecureHTTPParser?: boolean | undefined; - /** - * Optionally overrides the value of - * `--max-http-header-size` for requests received by this server, i.e. - * the maximum length of request headers in bytes. - * @default 16384 - * @since v13.3.0 - */ - maxHeaderSize?: number | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default true - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - /** - * A list of response headers that should be sent only once. - * If the header's value is an array, the items will be joined using `; `. - */ - uniqueHeaders?: Array | undefined; - } - type RequestListener< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > = (req: InstanceType, res: InstanceType & { req: InstanceType }) => void; - /** - * @since v0.1.17 - */ - class Server< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - > extends NetServer { - constructor(requestListener?: RequestListener); - constructor(options: ServerOptions, requestListener?: RequestListener); - /** - * Sets the timeout value for sockets, and emits a `'timeout'` event on - * the Server object, passing the socket as an argument, if a timeout - * occurs. - * - * If there is a `'timeout'` event listener on the Server object, then it - * will be called with the timed-out socket as an argument. - * - * By default, the Server does not timeout sockets. However, if a callback - * is assigned to the Server's `'timeout'` event, timeouts must be handled - * explicitly. - * @since v0.9.12 - * @param [msecs=0 (no timeout)] - */ - setTimeout(msecs?: number, callback?: () => void): this; - setTimeout(callback: () => void): this; - /** - * Limits maximum incoming headers count. If set to 0, no limit will be applied. - * @since v0.7.0 - */ - maxHeadersCount: number | null; - /** - * The maximum number of requests socket can handle - * before closing keep alive connection. - * - * A value of `0` will disable the limit. - * - * When the limit is reached it will set the `Connection` header value to `close`, - * but will not actually close the connection, subsequent requests sent - * after the limit is reached will get `503 Service Unavailable` as a response. - * @since v16.10.0 - */ - maxRequestsPerSocket: number | null; - /** - * The number of milliseconds of inactivity before a socket is presumed - * to have timed out. - * - * A value of `0` will disable the timeout behavior on incoming connections. - * - * The socket timeout logic is set up on connection, so changing this - * value only affects new connections to the server, not any existing connections. - * @since v0.9.12 - */ - timeout: number; - /** - * Limit the amount of time the parser will wait to receive the complete HTTP - * headers. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v11.3.0, v10.14.0 - */ - headersTimeout: number; - /** - * The number of milliseconds of inactivity a server needs to wait for additional - * incoming data, after it has finished writing the last response, before a socket - * will be destroyed. If the server receives new data before the keep-alive - * timeout has fired, it will reset the regular inactivity timeout, i.e.,`server.timeout`. - * - * A value of `0` will disable the keep-alive timeout behavior on incoming - * connections. - * A value of `0` makes the http server behave similarly to Node.js versions prior - * to 8.0.0, which did not have a keep-alive timeout. - * - * The socket timeout logic is set up on connection, so changing this value only - * affects new connections to the server, not any existing connections. - * @since v8.0.0 - */ - keepAliveTimeout: number; - /** - * Sets the timeout value in milliseconds for receiving the entire request from - * the client. - * - * If the timeout expires, the server responds with status 408 without - * forwarding the request to the request listener and then closes the connection. - * - * It must be set to a non-zero value (e.g. 120 seconds) to protect against - * potential Denial-of-Service attacks in case the server is deployed without a - * reverse proxy in front. - * @since v14.11.0 - */ - requestTimeout: number; - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request - * or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: RequestListener): this; - addListener(event: "checkExpectation", listener: RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - addListener(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - addListener(event: "request", listener: RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "clientError", err: Error, socket: stream.Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; - emit(event: "dropRequest", req: InstanceType, socket: stream.Duplex): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType & { req: InstanceType }, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: stream.Duplex, head: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: RequestListener): this; - on(event: "checkExpectation", listener: RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; - on(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - on(event: "request", listener: RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: RequestListener): this; - once(event: "checkExpectation", listener: RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - once( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - once(event: "dropRequest", listener: (req: InstanceType, socket: stream.Duplex) => void): this; - once(event: "request", listener: RequestListener): this; - once( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: RequestListener): this; - prependListener(event: "checkExpectation", listener: RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependListener(event: "request", listener: RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: stream.Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - prependOnceListener( - event: "dropRequest", - listener: (req: InstanceType, socket: stream.Duplex) => void, - ): this; - prependOnceListener(event: "request", listener: RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: stream.Duplex, head: Buffer) => void, - ): this; - } - /** - * This class serves as the parent class of {@link ClientRequest} and {@link ServerResponse}. It is an abstract outgoing message from - * the perspective of the participants of an HTTP transaction. - * @since v0.1.17 - */ - class OutgoingMessage extends stream.Writable { - readonly req: Request; - chunkedEncoding: boolean; - shouldKeepAlive: boolean; - useChunkedEncodingByDefault: boolean; - sendDate: boolean; - /** - * @deprecated Use `writableEnded` instead. - */ - finished: boolean; - /** - * Read-only. `true` if the headers were sent, otherwise `false`. - * @since v0.9.3 - */ - readonly headersSent: boolean; - /** - * Alias of `outgoingMessage.socket`. - * @since v0.3.0 - * @deprecated Since v15.12.0,v14.17.1 - Use `socket` instead. - */ - readonly connection: Socket | null; - /** - * Reference to the underlying socket. Usually, users will not want to access - * this property. - * - * After calling `outgoingMessage.end()`, this property will be nulled. - * @since v0.3.0 - */ - readonly socket: Socket | null; - constructor(); - /** - * Once a socket is associated with the message and is connected,`socket.setTimeout()` will be called with `msecs` as the first parameter. - * @since v0.9.12 - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `timeout` event. - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * Sets a single header value. If the header already exists in the to-be-sent - * headers, its value will be replaced. Use an array of strings to send multiple - * headers with the same name. - * @since v0.4.0 - * @param name Header name - * @param value Header value - */ - setHeader(name: string, value: number | string | readonly string[]): this; - /** - * Append a single header value for the header object. - * - * If the value is an array, this is equivalent of calling this method multiple - * times. - * - * If there were no previous value for the header, this is equivalent of calling `outgoingMessage.setHeader(name, value)`. - * - * Depending of the value of `options.uniqueHeaders` when the client request or the - * server were created, this will end up in the header being sent multiple times or - * a single time with values joined using `; `. - * @since v18.3.0, v16.17.0 - * @param name Header name - * @param value Header value - */ - appendHeader(name: string, value: string | readonly string[]): this; - /** - * Gets the value of the HTTP header with the given name. If that header is not - * set, the returned value will be `undefined`. - * @since v0.4.0 - * @param name Name of header - */ - getHeader(name: string): number | string | string[] | undefined; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow - * copy is used, array values may be mutated without additional calls to - * various header-related HTTP module methods. The keys of the returned - * object are the header names and the values are the respective header - * values. All header names are lowercase. - * - * The object returned by the `outgoingMessage.getHeaders()` method does - * not prototypically inherit from the JavaScript `Object`. This means that - * typical `Object` methods such as `obj.toString()`, `obj.hasOwnProperty()`, - * and others are not defined and will not work. - * - * ```js - * outgoingMessage.setHeader('Foo', 'bar'); - * outgoingMessage.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = outgoingMessage.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v7.7.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All names are lowercase. - * @since v7.7.0 - */ - getHeaderNames(): string[]; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name is case-insensitive. - * - * ```js - * const hasContentType = outgoingMessage.hasHeader('content-type'); - * ``` - * @since v7.7.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that is queued for implicit sending. - * - * ```js - * outgoingMessage.removeHeader('Content-Encoding'); - * ``` - * @since v0.4.0 - * @param name Header name - */ - removeHeader(name: string): void; - /** - * Adds HTTP trailers (headers but at the end of the message) to the message. - * - * Trailers will **only** be emitted if the message is chunked encoded. If not, - * the trailers will be silently discarded. - * - * HTTP requires the `Trailer` header to be sent to emit trailers, - * with a list of header field names in its value, e.g. - * - * ```js - * message.writeHead(200, { 'Content-Type': 'text/plain', - * 'Trailer': 'Content-MD5' }); - * message.write(fileData); - * message.addTrailers({ 'Content-MD5': '7895bf4b8828b55ceaf47747b4bca667' }); - * message.end(); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v0.3.0 - */ - addTrailers(headers: OutgoingHttpHeaders | ReadonlyArray<[string, string]>): void; - /** - * Flushes the message headers. - * - * For efficiency reason, Node.js normally buffers the message headers - * until `outgoingMessage.end()` is called or the first chunk of message data - * is written. It then tries to pack the headers and data into a single TCP - * packet. - * - * It is usually desired (it saves a TCP round-trip), but not when the first - * data is not sent until possibly much later. `outgoingMessage.flushHeaders()`bypasses the optimization and kickstarts the message. - * @since v1.6.0 - */ - flushHeaders(): void; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v0.1.17 - */ - class ServerResponse extends OutgoingMessage { - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v0.4.0 - */ - statusCode: number; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status message that will be sent to the client when - * the headers get flushed. If this is left as `undefined` then the standard - * message for the status code will be used. - * - * ```js - * response.statusMessage = 'Not found'; - * ``` - * - * After response header was sent to the client, this property indicates the - * status message which was sent out. - * @since v0.11.8 - */ - statusMessage: string; - /** - * If set to `true`, Node.js will check whether the `Content-Length`header value and the size of the body, in bytes, are equal. - * Mismatching the `Content-Length` header value will result - * in an `Error` being thrown, identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * @since v18.10.0, v16.18.0 - */ - strictContentLength: boolean; - constructor(req: Request); - assignSocket(socket: Socket): void; - detachSocket(socket: Socket): void; - /** - * Sends an HTTP/1.1 100 Continue message to the client, indicating that - * the request body should be sent. See the `'checkContinue'` event on`Server`. - * @since v0.3.0 - */ - writeContinue(callback?: () => void): void; - /** - * Sends an HTTP/1.1 103 Early Hints message to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. The optional `callback` argument will be called when - * the response message has been written. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * 'x-trace-id': 'id for diagnostics', - * }); - * - * const earlyHintsCallback = () => console.log('early hints message sent'); - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }, earlyHintsCallback); - * ``` - * @since v18.11.0 - * @param hints An object containing the values of headers - * @param callback Will be called when the response message has been written - */ - writeEarlyHints(hints: Record, callback?: () => void): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * Optionally one can give a human-readable `statusMessage` as the second - * argument. - * - * `headers` may be an `Array` where the keys and values are in the same list. - * It is _not_ a list of tuples. So, the even-numbered offsets are key values, - * and the odd-numbered offsets are the associated values. The array is in the same - * format as `request.rawHeaders`. - * - * Returns a reference to the `ServerResponse`, so that calls can be chained. - * - * ```js - * const body = 'hello world'; - * response - * .writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain', - * }) - * .end(body); - * ``` - * - * This method must only be called once on a message and it must - * be called before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * If this method is called and `response.setHeader()` has not been called, - * it will directly write the supplied header values onto the network channel - * without caching internally, and the `response.getHeader()` on the header - * will not yield the expected result. If progressive population of headers is - * desired with potential future retrieval and modification, use `response.setHeader()` instead. - * - * ```js - * // Returns content-type = text/plain - * const server = http.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain' }); - * res.end('ok'); - * }); - * ``` - * - * `Content-Length` is read in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. Node.js - * will check whether `Content-Length` and the length of the body which has - * been transmitted are equal or not. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a \[`Error`\]\[\] being thrown. - * @since v0.1.30 - */ - writeHead( - statusCode: number, - statusMessage?: string, - headers?: OutgoingHttpHeaders | OutgoingHttpHeader[], - ): this; - writeHead(statusCode: number, headers?: OutgoingHttpHeaders | OutgoingHttpHeader[]): this; - /** - * Sends a HTTP/1.1 102 Processing message to the client, indicating that - * the request body should be sent. - * @since v10.0.0 - */ - writeProcessing(): void; - } - interface InformationEvent { - statusCode: number; - statusMessage: string; - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - headers: IncomingHttpHeaders; - rawHeaders: string[]; - } - /** - * This object is created internally and returned from {@link request}. It - * represents an _in-progress_ request whose header has already been queued. The - * header is still mutable using the `setHeader(name, value)`,`getHeader(name)`, `removeHeader(name)` API. The actual header will - * be sent along with the first data chunk or when calling `request.end()`. - * - * To get the response, add a listener for `'response'` to the request object.`'response'` will be emitted from the request object when the response - * headers have been received. The `'response'` event is executed with one - * argument which is an instance of {@link IncomingMessage}. - * - * During the `'response'` event, one can add listeners to the - * response object; particularly to listen for the `'data'` event. - * - * If no `'response'` handler is added, then the response will be - * entirely discarded. However, if a `'response'` event handler is added, - * then the data from the response object **must** be consumed, either by - * calling `response.read()` whenever there is a `'readable'` event, or - * by adding a `'data'` handler, or by calling the `.resume()` method. - * Until the data is consumed, the `'end'` event will not fire. Also, until - * the data is read it will consume memory that can eventually lead to a - * 'process out of memory' error. - * - * For backward compatibility, `res` will only emit `'error'` if there is an`'error'` listener registered. - * - * Set `Content-Length` header to limit the response body size. - * If `response.strictContentLength` is set to `true`, mismatching the`Content-Length` header value will result in an `Error` being thrown, - * identified by `code:``'ERR_HTTP_CONTENT_LENGTH_MISMATCH'`. - * - * `Content-Length` value should be in bytes, not characters. Use `Buffer.byteLength()` to determine the length of the body in bytes. - * @since v0.1.17 - */ - class ClientRequest extends OutgoingMessage { - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v0.11.14 - * @deprecated Since v17.0.0,v16.12.0 - Check `destroyed` instead. - */ - aborted: boolean; - /** - * The request host. - * @since v14.5.0, v12.19.0 - */ - host: string; - /** - * The request protocol. - * @since v14.5.0, v12.19.0 - */ - protocol: string; - /** - * When sending request through a keep-alive enabled agent, the underlying socket - * might be reused. But if server closes connection at unfortunate time, client - * may run into a 'ECONNRESET' error. - * - * ```js - * import http from 'node:http'; - * - * // Server has a 5 seconds keep-alive timeout by default - * http - * .createServer((req, res) => { - * res.write('hello\n'); - * res.end(); - * }) - * .listen(3000); - * - * setInterval(() => { - * // Adapting a keep-alive agent - * http.get('http://localhost:3000', { agent }, (res) => { - * res.on('data', (data) => { - * // Do nothing - * }); - * }); - * }, 5000); // Sending request on 5s interval so it's easy to hit idle timeout - * ``` - * - * By marking a request whether it reused socket or not, we can do - * automatic error retry base on it. - * - * ```js - * import http from 'node:http'; - * const agent = new http.Agent({ keepAlive: true }); - * - * function retriableRequest() { - * const req = http - * .get('http://localhost:3000', { agent }, (res) => { - * // ... - * }) - * .on('error', (err) => { - * // Check if retry is needed - * if (req.reusedSocket && err.code === 'ECONNRESET') { - * retriableRequest(); - * } - * }); - * } - * - * retriableRequest(); - * ``` - * @since v13.0.0, v12.16.0 - */ - reusedSocket: boolean; - /** - * Limits maximum response headers count. If set to 0, no limit will be applied. - */ - maxHeadersCount: number; - constructor(url: string | URL | ClientRequestArgs, cb?: (res: IncomingMessage) => void); - /** - * The request method. - * @since v0.1.97 - */ - method: string; - /** - * The request path. - * @since v0.4.0 - */ - path: string; - /** - * Marks the request as aborting. Calling this will cause remaining data - * in the response to be dropped and the socket to be destroyed. - * @since v0.3.8 - * @deprecated Since v14.1.0,v13.14.0 - Use `destroy` instead. - */ - abort(): void; - onSocket(socket: Socket): void; - /** - * Once a socket is assigned to this request and is connected `socket.setTimeout()` will be called. - * @since v0.5.9 - * @param timeout Milliseconds before a request times out. - * @param callback Optional function to be called when a timeout occurs. Same as binding to the `'timeout'` event. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Once a socket is assigned to this request and is connected `socket.setNoDelay()` will be called. - * @since v0.5.9 - */ - setNoDelay(noDelay?: boolean): void; - /** - * Once a socket is assigned to this request and is connected `socket.setKeepAlive()` will be called. - * @since v0.5.9 - */ - setSocketKeepAlive(enable?: boolean, initialDelay?: number): void; - /** - * Returns an array containing the unique names of the current outgoing raw - * headers. Header names are returned with their exact casing being set. - * - * ```js - * request.setHeader('Foo', 'bar'); - * request.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = request.getRawHeaderNames(); - * // headerNames === ['Foo', 'Set-Cookie'] - * ``` - * @since v15.13.0, v14.17.0 - */ - getRawHeaderNames(): string[]; - /** - * @deprecated - */ - addListener(event: "abort", listener: () => void): this; - addListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - addListener(event: "continue", listener: () => void): this; - addListener(event: "information", listener: (info: InformationEvent) => void): this; - addListener(event: "response", listener: (response: IncomingMessage) => void): this; - addListener(event: "socket", listener: (socket: Socket) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - on(event: "abort", listener: () => void): this; - on(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: "continue", listener: () => void): this; - on(event: "information", listener: (info: InformationEvent) => void): this; - on(event: "response", listener: (response: IncomingMessage) => void): this; - on(event: "socket", listener: (socket: Socket) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - once(event: "abort", listener: () => void): this; - once(event: "connect", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: "continue", listener: () => void): this; - once(event: "information", listener: (info: InformationEvent) => void): this; - once(event: "response", listener: (response: IncomingMessage) => void): this; - once(event: "socket", listener: (socket: Socket) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "upgrade", listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependListener(event: "abort", listener: () => void): this; - prependListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependListener(event: "continue", listener: () => void): this; - prependListener(event: "information", listener: (info: InformationEvent) => void): this; - prependListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependListener(event: "socket", listener: (socket: Socket) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - /** - * @deprecated - */ - prependOnceListener(event: "abort", listener: () => void): this; - prependOnceListener( - event: "connect", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependOnceListener(event: "continue", listener: () => void): this; - prependOnceListener(event: "information", listener: (info: InformationEvent) => void): this; - prependOnceListener(event: "response", listener: (response: IncomingMessage) => void): this; - prependOnceListener(event: "socket", listener: (socket: Socket) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener( - event: "upgrade", - listener: (response: IncomingMessage, socket: Socket, head: Buffer) => void, - ): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * An `IncomingMessage` object is created by {@link Server} or {@link ClientRequest} and passed as the first argument to the `'request'` and `'response'` event respectively. It may be used to - * access response - * status, headers, and data. - * - * Different from its `socket` value which is a subclass of `stream.Duplex`, the`IncomingMessage` itself extends `stream.Readable` and is created separately to - * parse and emit the incoming HTTP headers and payload, as the underlying socket - * may be reused multiple times in case of keep-alive. - * @since v0.1.17 - */ - class IncomingMessage extends stream.Readable { - constructor(socket: Socket); - /** - * The `message.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - * @deprecated Since v17.0.0,v16.12.0 - Check `message.destroyed` from stream.Readable. - */ - aborted: boolean; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. - * Probably either `'1.1'` or `'1.0'`. - * - * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. - * @since v0.1.1 - */ - httpVersion: string; - httpVersionMajor: number; - httpVersionMinor: number; - /** - * The `message.complete` property will be `true` if a complete HTTP message has - * been received and successfully parsed. - * - * This property is particularly useful as a means of determining if a client or - * server fully transmitted a message before a connection was terminated: - * - * ```js - * const req = http.request({ - * host: '127.0.0.1', - * port: 8080, - * method: 'POST', - * }, (res) => { - * res.resume(); - * res.on('end', () => { - * if (!res.complete) - * console.error( - * 'The connection was terminated while the message was still being sent'); - * }); - * }); - * ``` - * @since v0.3.0 - */ - complete: boolean; - /** - * Alias for `message.socket`. - * @since v0.1.90 - * @deprecated Since v16.0.0 - Use `socket`. - */ - connection: Socket; - /** - * The `net.Socket` object associated with the connection. - * - * With HTTPS support, use `request.socket.getPeerCertificate()` to obtain the - * client's authentication details. - * - * This property is guaranteed to be an instance of the `net.Socket` class, - * a subclass of `stream.Duplex`, unless the user specified a socket - * type other than `net.Socket` or internally nulled. - * @since v0.3.0 - */ - socket: Socket; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * Duplicates in raw headers are handled in the following ways, depending on the - * header name: - * - * * Duplicates of `age`, `authorization`, `content-length`, `content-type`,`etag`, `expires`, `from`, `host`, `if-modified-since`, `if-unmodified-since`,`last-modified`, `location`, - * `max-forwards`, `proxy-authorization`, `referer`,`retry-after`, `server`, or `user-agent` are discarded. - * To allow duplicate values of the headers listed above to be joined, - * use the option `joinDuplicateHeaders` in {@link request} and {@link createServer}. See RFC 9110 Section 5.3 for more - * information. - * * `set-cookie` is always an array. Duplicates are added to the array. - * * For duplicate `cookie` headers, the values are joined together with `; `. - * * For all other headers, the values are joined together with `, `. - * @since v0.1.5 - */ - headers: IncomingHttpHeaders; - /** - * Similar to `message.headers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': ['curl/7.22.0'], - * // host: ['127.0.0.1:8000'], - * // accept: ['*'] } - * console.log(request.headersDistinct); - * ``` - * @since v18.3.0, v16.17.0 - */ - headersDistinct: NodeJS.Dict; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v0.11.6 - */ - rawHeaders: string[]; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v0.3.0 - */ - trailers: NodeJS.Dict; - /** - * Similar to `message.trailers`, but there is no join logic and the values are - * always arrays of strings, even for headers received just once. - * Only populated at the `'end'` event. - * @since v18.3.0, v16.17.0 - */ - trailersDistinct: NodeJS.Dict; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v0.11.6 - */ - rawTrailers: string[]; - /** - * Calls `message.socket.setTimeout(msecs, callback)`. - * @since v0.5.9 - */ - setTimeout(msecs: number, callback?: () => void): this; - /** - * **Only valid for request obtained from {@link Server}.** - * - * The request method as a string. Read only. Examples: `'GET'`, `'DELETE'`. - * @since v0.1.1 - */ - method?: string | undefined; - /** - * **Only valid for request obtained from {@link Server}.** - * - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. Take the following request: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * To parse the URL into its parts: - * - * ```js - * new URL(request.url, `http://${request.headers.host}`); - * ``` - * - * When `request.url` is `'/status?name=ryan'` and `request.headers.host` is`'localhost:3000'`: - * - * ```console - * $ node - * > new URL(request.url, `http://${request.headers.host}`) - * URL { - * href: 'http://localhost:3000/status?name=ryan', - * origin: 'http://localhost:3000', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'localhost:3000', - * hostname: 'localhost', - * port: '3000', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * @since v0.1.90 - */ - url?: string | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The 3-digit HTTP response status code. E.G. `404`. - * @since v0.1.1 - */ - statusCode?: number | undefined; - /** - * **Only valid for response obtained from {@link ClientRequest}.** - * - * The HTTP response status message (reason phrase). E.G. `OK` or `Internal Server Error`. - * @since v0.11.10 - */ - statusMessage?: string | undefined; - /** - * Calls `destroy()` on the socket that received the `IncomingMessage`. If `error`is provided, an `'error'` event is emitted on the socket and `error` is passed - * as an argument to any listeners on the event. - * @since v0.3.0 - */ - destroy(error?: Error): this; - } - interface AgentOptions extends Partial { - /** - * Keep sockets around in a pool to be used by other requests in the future. Default = false - */ - keepAlive?: boolean | undefined; - /** - * When using HTTP KeepAlive, how often to send TCP KeepAlive packets over sockets being kept alive. Default = 1000. - * Only relevant if keepAlive is set to true. - */ - keepAliveMsecs?: number | undefined; - /** - * Maximum number of sockets to allow per host. Default for Node 0.10 is 5, default for Node 0.12 is Infinity - */ - maxSockets?: number | undefined; - /** - * Maximum number of sockets allowed for all hosts in total. Each request will use a new socket until the maximum is reached. Default: Infinity. - */ - maxTotalSockets?: number | undefined; - /** - * Maximum number of sockets to leave open in a free state. Only relevant if keepAlive is set to true. Default = 256. - */ - maxFreeSockets?: number | undefined; - /** - * Socket timeout in milliseconds. This will set the timeout after the socket is connected. - */ - timeout?: number | undefined; - /** - * Scheduling strategy to apply when picking the next free socket to use. - * @default `lifo` - */ - scheduling?: "fifo" | "lifo" | undefined; - } - /** - * An `Agent` is responsible for managing connection persistence - * and reuse for HTTP clients. It maintains a queue of pending requests - * for a given host and port, reusing a single socket connection for each - * until the queue is empty, at which time the socket is either destroyed - * or put into a pool where it is kept to be used again for requests to the - * same host and port. Whether it is destroyed or pooled depends on the`keepAlive` `option`. - * - * Pooled connections have TCP Keep-Alive enabled for them, but servers may - * still close idle connections, in which case they will be removed from the - * pool and a new connection will be made when a new HTTP request is made for - * that host and port. Servers may also refuse to allow multiple requests - * over the same connection, in which case the connection will have to be - * remade for every request and cannot be pooled. The `Agent` will still make - * the requests to that server, but each one will occur over a new connection. - * - * When a connection is closed by the client or the server, it is removed - * from the pool. Any unused sockets in the pool will be unrefed so as not - * to keep the Node.js process running when there are no outstanding requests. - * (see `socket.unref()`). - * - * It is good practice, to `destroy()` an `Agent` instance when it is no - * longer in use, because unused sockets consume OS resources. - * - * Sockets are removed from an agent when the socket emits either - * a `'close'` event or an `'agentRemove'` event. When intending to keep one - * HTTP request open for a long time without keeping it in the agent, something - * like the following may be done: - * - * ```js - * http.get(options, (res) => { - * // Do stuff - * }).on('socket', (socket) => { - * socket.emit('agentRemove'); - * }); - * ``` - * - * An agent may also be used for an individual request. By providing`{agent: false}` as an option to the `http.get()` or `http.request()`functions, a one-time use `Agent` with default options - * will be used - * for the client connection. - * - * `agent:false`: - * - * ```js - * http.get({ - * hostname: 'localhost', - * port: 80, - * path: '/', - * agent: false, // Create a new agent just for this one request - * }, (res) => { - * // Do stuff with response - * }); - * ``` - * @since v0.3.4 - */ - class Agent extends EventEmitter { - /** - * By default set to 256. For agents with `keepAlive` enabled, this - * sets the maximum number of sockets that will be left open in the free - * state. - * @since v0.11.7 - */ - maxFreeSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open per origin. Origin is the returned value of `agent.getName()`. - * @since v0.3.6 - */ - maxSockets: number; - /** - * By default set to `Infinity`. Determines how many concurrent sockets the agent - * can have open. Unlike `maxSockets`, this parameter applies across all origins. - * @since v14.5.0, v12.19.0 - */ - maxTotalSockets: number; - /** - * An object which contains arrays of sockets currently awaiting use by - * the agent when `keepAlive` is enabled. Do not modify. - * - * Sockets in the `freeSockets` list will be automatically destroyed and - * removed from the array on `'timeout'`. - * @since v0.11.4 - */ - readonly freeSockets: NodeJS.ReadOnlyDict; - /** - * An object which contains arrays of sockets currently in use by the - * agent. Do not modify. - * @since v0.3.6 - */ - readonly sockets: NodeJS.ReadOnlyDict; - /** - * An object which contains queues of requests that have not yet been assigned to - * sockets. Do not modify. - * @since v0.5.9 - */ - readonly requests: NodeJS.ReadOnlyDict; - constructor(opts?: AgentOptions); - /** - * Destroy any sockets that are currently in use by the agent. - * - * It is usually not necessary to do this. However, if using an - * agent with `keepAlive` enabled, then it is best to explicitly shut down - * the agent when it is no longer needed. Otherwise, - * sockets might stay open for quite a long time before the server - * terminates them. - * @since v0.11.4 - */ - destroy(): void; - } - const METHODS: string[]; - const STATUS_CODES: { - [errorCode: number]: string | undefined; - [errorCode: string]: string | undefined; - }; - /** - * Returns a new instance of {@link Server}. - * - * The `requestListener` is a function which is automatically - * added to the `'request'` event. - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * - * ```js - * import http from 'node:http'; - * - * // Create a local server to receive data from - * const server = http.createServer(); - * - * // Listen to the request event - * server.on('request', (request, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.1.13 - */ - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - >(requestListener?: RequestListener): Server; - function createServer< - Request extends typeof IncomingMessage = typeof IncomingMessage, - Response extends typeof ServerResponse = typeof ServerResponse, - >( - options: ServerOptions, - requestListener?: RequestListener, - ): Server; - // although RequestOptions are passed as ClientRequestArgs to ClientRequest directly, - // create interface RequestOptions would make the naming more clear to developers - interface RequestOptions extends ClientRequestArgs {} - /** - * `options` in `socket.connect()` are also supported. - * - * Node.js maintains several connections per server to make HTTP requests. - * This function allows one to transparently issue requests. - * - * `url` can be a string or a `URL` object. If `url` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * If both `url` and `options` are specified, the objects are merged, with the`options` properties taking precedence. - * - * The optional `callback` parameter will be added as a one-time listener for - * the `'response'` event. - * - * `http.request()` returns an instance of the {@link ClientRequest} class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * import http from 'node:http'; - * import { Buffer } from 'node:buffer'; - * - * const postData = JSON.stringify({ - * 'msg': 'Hello World!', - * }); - * - * const options = { - * hostname: 'www.google.com', - * port: 80, - * path: '/upload', - * method: 'POST', - * headers: { - * 'Content-Type': 'application/json', - * 'Content-Length': Buffer.byteLength(postData), - * }, - * }; - * - * const req = http.request(options, (res) => { - * console.log(`STATUS: ${res.statusCode}`); - * console.log(`HEADERS: ${JSON.stringify(res.headers)}`); - * res.setEncoding('utf8'); - * res.on('data', (chunk) => { - * console.log(`BODY: ${chunk}`); - * }); - * res.on('end', () => { - * console.log('No more data in response.'); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(`problem with request: ${e.message}`); - * }); - * - * // Write data to request body - * req.write(postData); - * req.end(); - * ``` - * - * In the example `req.end()` was called. With `http.request()` one - * must always call `req.end()` to signify the end of the request - - * even if there is no data being written to the request body. - * - * If any error is encountered during the request (be that with DNS resolution, - * TCP level errors, or actual HTTP parse errors) an `'error'` event is emitted - * on the returned request object. As with all `'error'` events, if no listeners - * are registered the error will be thrown. - * - * There are a few special headers that should be noted. - * - * * Sending a 'Connection: keep-alive' will notify Node.js that the connection to - * the server should be persisted until the next request. - * * Sending a 'Content-Length' header will disable the default chunked encoding. - * * Sending an 'Expect' header will immediately send the request headers. - * Usually, when sending 'Expect: 100-continue', both a timeout and a listener - * for the `'continue'` event should be set. See RFC 2616 Section 8.2.3 for more - * information. - * * Sending an Authorization header will override using the `auth` option - * to compute basic authentication. - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('http://abc:xyz@example.com'); - * - * const req = http.request(options, (res) => { - * // ... - * }); - * ``` - * - * In a successful request, the following events will be emitted in the following - * order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * (`'data'` will not be emitted at all if the response body is empty, for - * instance, in most redirects) - * * `'end'` on the `res` object - * * `'close'` - * - * In the case of a connection error, the following events will be emitted: - * - * * `'socket'` - * * `'error'` - * * `'close'` - * - * In the case of a premature connection close before the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` - * * `'close'` - * - * In the case of a premature connection close after the response is received, - * the following events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (connection closed here) - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'` - * * `'close'` - * * `'close'` on the `res` object - * - * If `req.destroy()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.destroy()` called here) - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * - * If `req.destroy()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.destroy()` called here) - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message `'Error: aborted'`and code `'ECONNRESET'`, or the error with which `req.destroy()` was called - * * `'close'` - * * `'close'` on the `res` object - * - * If `req.abort()` is called before a socket is assigned, the following - * events will be emitted in the following order: - * - * * (`req.abort()` called here) - * * `'abort'` - * * `'close'` - * - * If `req.abort()` is called before the connection succeeds, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * (`req.abort()` called here) - * * `'abort'` - * * `'error'` with an error with message `'Error: socket hang up'` and code`'ECONNRESET'` - * * `'close'` - * - * If `req.abort()` is called after the response is received, the following - * events will be emitted in the following order: - * - * * `'socket'` - * * `'response'` - * * `'data'` any number of times, on the `res` object - * * (`req.abort()` called here) - * * `'abort'` - * * `'aborted'` on the `res` object - * * `'error'` on the `res` object with an error with message`'Error: aborted'` and code `'ECONNRESET'`. - * * `'close'` - * * `'close'` on the `res` object - * - * Setting the `timeout` option or using the `setTimeout()` function will - * not abort the request or do anything besides add a `'timeout'` event. - * - * Passing an `AbortSignal` and then calling `abort()` on the corresponding`AbortController` will behave the same way as calling `.destroy()` on the - * request. Specifically, the `'error'` event will be emitted with an error with - * the message `'AbortError: The operation was aborted'`, the code `'ABORT_ERR'`and the `cause`, if one was provided. - * @since v0.3.6 - */ - function request(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: IncomingMessage) => void, - ): ClientRequest; - /** - * Since most requests are GET requests without bodies, Node.js provides this - * convenience method. The only difference between this method and {@link request} is that it sets the method to GET by default and calls `req.end()`automatically. The callback must take care to - * consume the response - * data for reasons stated in {@link ClientRequest} section. - * - * The `callback` is invoked with a single argument that is an instance of {@link IncomingMessage}. - * - * JSON fetching example: - * - * ```js - * http.get('http://localhost:8000/', (res) => { - * const { statusCode } = res; - * const contentType = res.headers['content-type']; - * - * let error; - * // Any 2xx status code signals a successful response but - * // here we're only checking for 200. - * if (statusCode !== 200) { - * error = new Error('Request Failed.\n' + - * `Status Code: ${statusCode}`); - * } else if (!/^application\/json/.test(contentType)) { - * error = new Error('Invalid content-type.\n' + - * `Expected application/json but received ${contentType}`); - * } - * if (error) { - * console.error(error.message); - * // Consume response data to free up memory - * res.resume(); - * return; - * } - * - * res.setEncoding('utf8'); - * let rawData = ''; - * res.on('data', (chunk) => { rawData += chunk; }); - * res.on('end', () => { - * try { - * const parsedData = JSON.parse(rawData); - * console.log(parsedData); - * } catch (e) { - * console.error(e.message); - * } - * }); - * }).on('error', (e) => { - * console.error(`Got error: ${e.message}`); - * }); - * - * // Create a local server to receive data from - * const server = http.createServer((req, res) => { - * res.writeHead(200, { 'Content-Type': 'application/json' }); - * res.end(JSON.stringify({ - * data: 'Hello World!', - * })); - * }); - * - * server.listen(8000); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the method set to GET by default. - */ - function get(options: RequestOptions | string | URL, callback?: (res: IncomingMessage) => void): ClientRequest; - function get(url: string | URL, options: RequestOptions, callback?: (res: IncomingMessage) => void): ClientRequest; - /** - * Performs the low-level validations on the provided `name` that are done when`res.setHeader(name, value)` is called. - * - * Passing illegal value as `name` will result in a `TypeError` being thrown, - * identified by `code: 'ERR_INVALID_HTTP_TOKEN'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * Examples: - * - * Example: - * - * ```js - * import { validateHeaderName } from 'node:http'; - * - * try { - * validateHeaderName(''); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code); // --> 'ERR_INVALID_HTTP_TOKEN' - * console.error(err.message); // --> 'Header name must be a valid HTTP token [""]' - * } - * ``` - * @since v14.3.0 - * @param [label='Header name'] Label for error message. - */ - function validateHeaderName(name: string): void; - /** - * Performs the low-level validations on the provided `value` that are done when`res.setHeader(name, value)` is called. - * - * Passing illegal value as `value` will result in a `TypeError` being thrown. - * - * * Undefined value error is identified by `code: 'ERR_HTTP_INVALID_HEADER_VALUE'`. - * * Invalid value character error is identified by `code: 'ERR_INVALID_CHAR'`. - * - * It is not necessary to use this method before passing headers to an HTTP request - * or response. The HTTP module will automatically validate such headers. - * - * Examples: - * - * ```js - * import { validateHeaderValue } from 'node:http'; - * - * try { - * validateHeaderValue('x-my-header', undefined); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_HTTP_INVALID_HEADER_VALUE'); // --> true - * console.error(err.message); // --> 'Invalid value "undefined" for header "x-my-header"' - * } - * - * try { - * validateHeaderValue('x-my-header', 'oʊmɪɡə'); - * } catch (err) { - * console.error(err instanceof TypeError); // --> true - * console.error(err.code === 'ERR_INVALID_CHAR'); // --> true - * console.error(err.message); // --> 'Invalid character in header content ["x-my-header"]' - * } - * ``` - * @since v14.3.0 - * @param name Header name - * @param value Header value - */ - function validateHeaderValue(name: string, value: string): void; - /** - * Set the maximum number of idle HTTP parsers. - * @since v18.8.0, v16.18.0 - * @param [max=1000] - */ - function setMaxIdleHTTPParsers(max: number): void; - let globalAgent: Agent; - /** - * Read-only property specifying the maximum allowed size of HTTP headers in bytes. - * Defaults to 16KB. Configurable using the `--max-http-header-size` CLI option. - */ - const maxHeaderSize: number; -} -declare module "node:http" { - export * from "http"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/http2.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/http2.d.ts deleted file mode 100644 index c3b3e8ec..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/http2.d.ts +++ /dev/null @@ -1,2382 +0,0 @@ -/** - * The `node:http2` module provides an implementation of the [HTTP/2](https://tools.ietf.org/html/rfc7540) protocol. - * It can be accessed using: - * - * ```js - * const http2 = require('node:http2'); - * ``` - * @since v8.4.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/http2.js) - */ -declare module "http2" { - import EventEmitter = require("node:events"); - import * as fs from "node:fs"; - import * as net from "node:net"; - import * as stream from "node:stream"; - import * as tls from "node:tls"; - import * as url from "node:url"; - import { - IncomingHttpHeaders as Http1IncomingHttpHeaders, - IncomingMessage, - OutgoingHttpHeaders, - ServerResponse, - } from "node:http"; - export { OutgoingHttpHeaders } from "node:http"; - export interface IncomingHttpStatusHeader { - ":status"?: number | undefined; - } - export interface IncomingHttpHeaders extends Http1IncomingHttpHeaders { - ":path"?: string | undefined; - ":method"?: string | undefined; - ":authority"?: string | undefined; - ":scheme"?: string | undefined; - } - // Http2Stream - export interface StreamPriorityOptions { - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - silent?: boolean | undefined; - } - export interface StreamState { - localWindowSize?: number | undefined; - state?: number | undefined; - localClose?: number | undefined; - remoteClose?: number | undefined; - sumDependencyWeight?: number | undefined; - weight?: number | undefined; - } - export interface ServerStreamResponseOptions { - endStream?: boolean | undefined; - waitForTrailers?: boolean | undefined; - } - export interface StatOptions { - offset: number; - length: number; - } - export interface ServerStreamFileResponseOptions { - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - statCheck?(stats: fs.Stats, headers: OutgoingHttpHeaders, statOptions: StatOptions): void | boolean; - waitForTrailers?: boolean | undefined; - offset?: number | undefined; - length?: number | undefined; - } - export interface ServerStreamFileResponseOptionsWithError extends ServerStreamFileResponseOptions { - onError?(err: NodeJS.ErrnoException): void; - } - export interface Http2Stream extends stream.Duplex { - /** - * Set to `true` if the `Http2Stream` instance was aborted abnormally. When set, - * the `'aborted'` event will have been emitted. - * @since v8.4.0 - */ - readonly aborted: boolean; - /** - * This property shows the number of characters currently buffered to be written. - * See `net.Socket.bufferSize` for details. - * @since v11.2.0, v10.16.0 - */ - readonly bufferSize: number; - /** - * Set to `true` if the `Http2Stream` instance has been closed. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Set to `true` if the `Http2Stream` instance has been destroyed and is no longer - * usable. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Set to `true` if the `END_STREAM` flag was set in the request or response - * HEADERS frame received, indicating that no additional data should be received - * and the readable side of the `Http2Stream` will be closed. - * @since v10.11.0 - */ - readonly endAfterHeaders: boolean; - /** - * The numeric stream identifier of this `Http2Stream` instance. Set to `undefined`if the stream identifier has not yet been assigned. - * @since v8.4.0 - */ - readonly id?: number | undefined; - /** - * Set to `true` if the `Http2Stream` instance has not yet been assigned a - * numeric stream identifier. - * @since v9.4.0 - */ - readonly pending: boolean; - /** - * Set to the `RST_STREAM` `error code` reported when the `Http2Stream` is - * destroyed after either receiving an `RST_STREAM` frame from the connected peer, - * calling `http2stream.close()`, or `http2stream.destroy()`. Will be`undefined` if the `Http2Stream` has not been closed. - * @since v8.4.0 - */ - readonly rstCode: number; - /** - * An object containing the outbound headers sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentHeaders: OutgoingHttpHeaders; - /** - * An array of objects containing the outbound informational (additional) headers - * sent for this `Http2Stream`. - * @since v9.5.0 - */ - readonly sentInfoHeaders?: OutgoingHttpHeaders[] | undefined; - /** - * An object containing the outbound trailers sent for this `HttpStream`. - * @since v9.5.0 - */ - readonly sentTrailers?: OutgoingHttpHeaders | undefined; - /** - * A reference to the `Http2Session` instance that owns this `Http2Stream`. The - * value will be `undefined` after the `Http2Stream` instance is destroyed. - * @since v8.4.0 - */ - readonly session: Http2Session | undefined; - /** - * Provides miscellaneous information about the current state of the`Http2Stream`. - * - * A current state of this `Http2Stream`. - * @since v8.4.0 - */ - readonly state: StreamState; - /** - * Closes the `Http2Stream` instance by sending an `RST_STREAM` frame to the - * connected HTTP/2 peer. - * @since v8.4.0 - * @param [code=http2.constants.NGHTTP2_NO_ERROR] Unsigned 32-bit integer identifying the error code. - * @param callback An optional function registered to listen for the `'close'` event. - */ - close(code?: number, callback?: () => void): void; - /** - * Updates the priority for this `Http2Stream` instance. - * @since v8.4.0 - */ - priority(options: StreamPriorityOptions): void; - /** - * ```js - * const http2 = require('node:http2'); - * const client = http2.connect('http://example.org:8000'); - * const { NGHTTP2_CANCEL } = http2.constants; - * const req = client.request({ ':path': '/' }); - * - * // Cancel the stream if there's no activity after 5 seconds - * req.setTimeout(5000, () => req.close(NGHTTP2_CANCEL)); - * ``` - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Sends a trailing `HEADERS` frame to the connected HTTP/2 peer. This method - * will cause the `Http2Stream` to be immediately closed and must only be - * called after the `'wantTrailers'` event has been emitted. When sending a - * request or sending a response, the `options.waitForTrailers` option must be set - * in order to keep the `Http2Stream` open after the final `DATA` frame so that - * trailers can be sent. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond(undefined, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ xyz: 'abc' }); - * }); - * stream.end('Hello World'); - * }); - * ``` - * - * The HTTP/1 specification forbids trailers from containing HTTP/2 pseudo-header - * fields (e.g. `':method'`, `':path'`, etc). - * @since v10.0.0 - */ - sendTrailers(headers: OutgoingHttpHeaders): void; - addListener(event: "aborted", listener: () => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: "streamClosed", listener: (code: number) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - addListener(event: "wantTrailers", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted"): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "frameError", frameType: number, errorCode: number): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: "streamClosed", code: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "trailers", trailers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "wantTrailers"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: () => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: "streamClosed", listener: (code: number) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - on(event: "wantTrailers", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: () => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: "streamClosed", listener: (code: number) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - once(event: "wantTrailers", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: () => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "streamClosed", listener: (code: number) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependListener(event: "wantTrailers", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: () => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "frameError", listener: (frameType: number, errorCode: number) => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "streamClosed", listener: (code: number) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "trailers", listener: (trailers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener(event: "wantTrailers", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Stream extends Http2Stream { - addListener(event: "continue", listener: () => {}): this; - addListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - addListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "continue"): boolean; - emit(event: "headers", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: "push", headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "response", headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "continue", listener: () => {}): this; - on( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - on( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "continue", listener: () => {}): this; - once( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - once( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "continue", listener: () => {}): this; - prependListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "continue", listener: () => {}): this; - prependOnceListener( - event: "headers", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: "push", listener: (headers: IncomingHttpHeaders, flags: number) => void): this; - prependOnceListener( - event: "response", - listener: (headers: IncomingHttpHeaders & IncomingHttpStatusHeader, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ServerHttp2Stream extends Http2Stream { - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * Read-only property mapped to the `SETTINGS_ENABLE_PUSH` flag of the remote - * client's most recent `SETTINGS` frame. Will be `true` if the remote peer - * accepts push streams, `false` otherwise. Settings are the same for every`Http2Stream` in the same `Http2Session`. - * @since v8.4.0 - */ - readonly pushAllowed: boolean; - /** - * Sends an additional informational `HEADERS` frame to the connected HTTP/2 peer. - * @since v8.4.0 - */ - additionalHeaders(headers: OutgoingHttpHeaders): void; - /** - * Initiates a push stream. The callback is invoked with the new `Http2Stream`instance created for the push stream passed as the second argument, or an`Error` passed as the first argument. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.pushStream({ ':path': '/' }, (err, pushStream, headers) => { - * if (err) throw err; - * pushStream.respond({ ':status': 200 }); - * pushStream.end('some pushed data'); - * }); - * stream.end('some data'); - * }); - * ``` - * - * Setting the weight of a push stream is not allowed in the `HEADERS` frame. Pass - * a `weight` value to `http2stream.priority` with the `silent` option set to`true` to enable server-side bandwidth balancing between concurrent streams. - * - * Calling `http2stream.pushStream()` from within a pushed stream is not permitted - * and will throw an error. - * @since v8.4.0 - * @param callback Callback that is called once the push stream has been initiated. - */ - pushStream( - headers: OutgoingHttpHeaders, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - pushStream( - headers: OutgoingHttpHeaders, - options?: StreamPriorityOptions, - callback?: (err: Error | null, pushStream: ServerHttp2Stream, headers: OutgoingHttpHeaders) => void, - ): void; - /** - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }); - * stream.end('some data'); - * }); - * ``` - * - * Initiates a response. When the `options.waitForTrailers` option is set, the`'wantTrailers'` event will be emitted immediately after queuing the last chunk - * of payload data to be sent. The `http2stream.sendTrailers()` method can then be - * used to sent trailing header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respond({ ':status': 200 }, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * stream.end('some data'); - * }); - * ``` - * @since v8.4.0 - */ - respond(headers?: OutgoingHttpHeaders, options?: ServerStreamResponseOptions): void; - /** - * Initiates a response whose data is read from the given file descriptor. No - * validation is performed on the given file descriptor. If an error occurs while - * attempting to read data using the file descriptor, the `Http2Stream` will be - * closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR` code. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers); - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given fd. If the `statCheck` function is provided, the`http2stream.respondWithFD()` method will perform an `fs.fstat()` call to - * collect details on the provided file descriptor. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The file descriptor or `FileHandle` is not closed when the stream is closed, - * so it will need to be closed manually once it is no longer needed. - * Using the same file descriptor concurrently for multiple streams - * is not supported and may result in data loss. Re-using a file descriptor - * after a stream has finished is supported. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code _must_ call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * const fd = fs.openSync('/some/file', 'r'); - * - * const stat = fs.fstatSync(fd); - * const headers = { - * 'content-length': stat.size, - * 'last-modified': stat.mtime.toUTCString(), - * 'content-type': 'text/plain; charset=utf-8', - * }; - * stream.respondWithFD(fd, headers, { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * - * stream.on('close', () => fs.closeSync(fd)); - * }); - * ``` - * @since v8.4.0 - * @param fd A readable file descriptor. - */ - respondWithFD( - fd: number | fs.promises.FileHandle, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptions, - ): void; - /** - * Sends a regular file as the response. The `path` must specify a regular file - * or an `'error'` event will be emitted on the `Http2Stream` object. - * - * When used, the `Http2Stream` object's `Duplex` interface will be closed - * automatically. - * - * The optional `options.statCheck` function may be specified to give user code - * an opportunity to set additional content headers based on the `fs.Stat` details - * of the given file: - * - * If an error occurs while attempting to read the file data, the `Http2Stream`will be closed using an `RST_STREAM` frame using the standard `INTERNAL_ERROR`code. If the `onError` callback is - * defined, then it will be called. Otherwise - * the stream will be destroyed. - * - * Example using a file path: - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * headers['last-modified'] = stat.mtime.toUTCString(); - * } - * - * function onError(err) { - * // stream.respond() can throw if the stream has been destroyed by - * // the other side. - * try { - * if (err.code === 'ENOENT') { - * stream.respond({ ':status': 404 }); - * } else { - * stream.respond({ ':status': 500 }); - * } - * } catch (err) { - * // Perform actual error handling. - * console.error(err); - * } - * stream.end(); - * } - * - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck, onError }); - * }); - * ``` - * - * The `options.statCheck` function may also be used to cancel the send operation - * by returning `false`. For instance, a conditional request may check the stat - * results to determine if the file has been modified to return an appropriate`304` response: - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * function statCheck(stat, headers) { - * // Check the stat here... - * stream.respond({ ':status': 304 }); - * return false; // Cancel the send operation - * } - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { statCheck }); - * }); - * ``` - * - * The `content-length` header field will be automatically set. - * - * The `offset` and `length` options may be used to limit the response to a - * specific range subset. This can be used, for instance, to support HTTP Range - * requests. - * - * The `options.onError` function may also be used to handle all the errors - * that could happen before the delivery of the file is initiated. The - * default behavior is to destroy the stream. - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * will be emitted immediately after queuing the last chunk of payload data to be - * sent. The `http2stream.sendTrailers()` method can then be used to sent trailing - * header fields to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer(); - * server.on('stream', (stream) => { - * stream.respondWithFile('/some/file', - * { 'content-type': 'text/plain; charset=utf-8' }, - * { waitForTrailers: true }); - * stream.on('wantTrailers', () => { - * stream.sendTrailers({ ABC: 'some value to send' }); - * }); - * }); - * ``` - * @since v8.4.0 - */ - respondWithFile( - path: string, - headers?: OutgoingHttpHeaders, - options?: ServerStreamFileResponseOptionsWithError, - ): void; - } - // Http2Session - export interface Settings { - headerTableSize?: number | undefined; - enablePush?: boolean | undefined; - initialWindowSize?: number | undefined; - maxFrameSize?: number | undefined; - maxConcurrentStreams?: number | undefined; - maxHeaderListSize?: number | undefined; - enableConnectProtocol?: boolean | undefined; - } - export interface ClientSessionRequestOptions { - endStream?: boolean | undefined; - exclusive?: boolean | undefined; - parent?: number | undefined; - weight?: number | undefined; - waitForTrailers?: boolean | undefined; - signal?: AbortSignal | undefined; - } - export interface SessionState { - effectiveLocalWindowSize?: number | undefined; - effectiveRecvDataLength?: number | undefined; - nextStreamID?: number | undefined; - localWindowSize?: number | undefined; - lastProcStreamID?: number | undefined; - remoteWindowSize?: number | undefined; - outboundQueueSize?: number | undefined; - deflateDynamicTableSize?: number | undefined; - inflateDynamicTableSize?: number | undefined; - } - export interface Http2Session extends EventEmitter { - /** - * Value will be `undefined` if the `Http2Session` is not yet connected to a - * socket, `h2c` if the `Http2Session` is not connected to a `TLSSocket`, or - * will return the value of the connected `TLSSocket`'s own `alpnProtocol`property. - * @since v9.4.0 - */ - readonly alpnProtocol?: string | undefined; - /** - * Will be `true` if this `Http2Session` instance has been closed, otherwise`false`. - * @since v9.4.0 - */ - readonly closed: boolean; - /** - * Will be `true` if this `Http2Session` instance is still connecting, will be set - * to `false` before emitting `connect` event and/or calling the `http2.connect`callback. - * @since v10.0.0 - */ - readonly connecting: boolean; - /** - * Will be `true` if this `Http2Session` instance has been destroyed and must no - * longer be used, otherwise `false`. - * @since v8.4.0 - */ - readonly destroyed: boolean; - /** - * Value is `undefined` if the `Http2Session` session socket has not yet been - * connected, `true` if the `Http2Session` is connected with a `TLSSocket`, - * and `false` if the `Http2Session` is connected to any other kind of socket - * or stream. - * @since v9.4.0 - */ - readonly encrypted?: boolean | undefined; - /** - * A prototype-less object describing the current local settings of this`Http2Session`. The local settings are local to _this_`Http2Session` instance. - * @since v8.4.0 - */ - readonly localSettings: Settings; - /** - * If the `Http2Session` is connected to a `TLSSocket`, the `originSet` property - * will return an `Array` of origins for which the `Http2Session` may be - * considered authoritative. - * - * The `originSet` property is only available when using a secure TLS connection. - * @since v9.4.0 - */ - readonly originSet?: string[] | undefined; - /** - * Indicates whether the `Http2Session` is currently waiting for acknowledgment of - * a sent `SETTINGS` frame. Will be `true` after calling the`http2session.settings()` method. Will be `false` once all sent `SETTINGS`frames have been acknowledged. - * @since v8.4.0 - */ - readonly pendingSettingsAck: boolean; - /** - * A prototype-less object describing the current remote settings of this`Http2Session`. The remote settings are set by the _connected_ HTTP/2 peer. - * @since v8.4.0 - */ - readonly remoteSettings: Settings; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * limits available methods to ones safe to use with HTTP/2. - * - * `destroy`, `emit`, `end`, `pause`, `read`, `resume`, and `write` will throw - * an error with code `ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for more information. - * - * `setTimeout` method will be called on this `Http2Session`. - * - * All other interactions will be routed directly to the socket. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * Provides miscellaneous information about the current state of the`Http2Session`. - * - * An object describing the current status of this `Http2Session`. - * @since v8.4.0 - */ - readonly state: SessionState; - /** - * The `http2session.type` will be equal to`http2.constants.NGHTTP2_SESSION_SERVER` if this `Http2Session` instance is a - * server, and `http2.constants.NGHTTP2_SESSION_CLIENT` if the instance is a - * client. - * @since v8.4.0 - */ - readonly type: number; - /** - * Gracefully closes the `Http2Session`, allowing any existing streams to - * complete on their own and preventing new `Http2Stream` instances from being - * created. Once closed, `http2session.destroy()`_might_ be called if there - * are no open `Http2Stream` instances. - * - * If specified, the `callback` function is registered as a handler for the`'close'` event. - * @since v9.4.0 - */ - close(callback?: () => void): void; - /** - * Immediately terminates the `Http2Session` and the associated `net.Socket` or`tls.TLSSocket`. - * - * Once destroyed, the `Http2Session` will emit the `'close'` event. If `error`is not undefined, an `'error'` event will be emitted immediately before the`'close'` event. - * - * If there are any remaining open `Http2Streams` associated with the`Http2Session`, those will also be destroyed. - * @since v8.4.0 - * @param error An `Error` object if the `Http2Session` is being destroyed due to an error. - * @param code The HTTP/2 error code to send in the final `GOAWAY` frame. If unspecified, and `error` is not undefined, the default is `INTERNAL_ERROR`, otherwise defaults to `NO_ERROR`. - */ - destroy(error?: Error, code?: number): void; - /** - * Transmits a `GOAWAY` frame to the connected peer _without_ shutting down the`Http2Session`. - * @since v9.4.0 - * @param code An HTTP/2 error code - * @param lastStreamID The numeric ID of the last processed `Http2Stream` - * @param opaqueData A `TypedArray` or `DataView` instance containing additional data to be carried within the `GOAWAY` frame. - */ - goaway(code?: number, lastStreamID?: number, opaqueData?: NodeJS.ArrayBufferView): void; - /** - * Sends a `PING` frame to the connected HTTP/2 peer. A `callback` function must - * be provided. The method will return `true` if the `PING` was sent, `false`otherwise. - * - * The maximum number of outstanding (unacknowledged) pings is determined by the`maxOutstandingPings` configuration option. The default maximum is 10. - * - * If provided, the `payload` must be a `Buffer`, `TypedArray`, or `DataView`containing 8 bytes of data that will be transmitted with the `PING` and - * returned with the ping acknowledgment. - * - * The callback will be invoked with three arguments: an error argument that will - * be `null` if the `PING` was successfully acknowledged, a `duration` argument - * that reports the number of milliseconds elapsed since the ping was sent and the - * acknowledgment was received, and a `Buffer` containing the 8-byte `PING`payload. - * - * ```js - * session.ping(Buffer.from('abcdefgh'), (err, duration, payload) => { - * if (!err) { - * console.log(`Ping acknowledged in ${duration} milliseconds`); - * console.log(`With payload '${payload.toString()}'`); - * } - * }); - * ``` - * - * If the `payload` argument is not specified, the default payload will be the - * 64-bit timestamp (little endian) marking the start of the `PING` duration. - * @since v8.9.3 - * @param payload Optional ping payload. - */ - ping(callback: (err: Error | null, duration: number, payload: Buffer) => void): boolean; - ping( - payload: NodeJS.ArrayBufferView, - callback: (err: Error | null, duration: number, payload: Buffer) => void, - ): boolean; - /** - * Calls `ref()` on this `Http2Session`instance's underlying `net.Socket`. - * @since v9.4.0 - */ - ref(): void; - /** - * Sets the local endpoint's window size. - * The `windowSize` is the total window size to set, not - * the delta. - * - * ```js - * const http2 = require('node:http2'); - * - * const server = http2.createServer(); - * const expectedWindowSize = 2 ** 20; - * server.on('connect', (session) => { - * - * // Set local window size to be 2 ** 20 - * session.setLocalWindowSize(expectedWindowSize); - * }); - * ``` - * @since v15.3.0, v14.18.0 - */ - setLocalWindowSize(windowSize: number): void; - /** - * Used to set a callback function that is called when there is no activity on - * the `Http2Session` after `msecs` milliseconds. The given `callback` is - * registered as a listener on the `'timeout'` event. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * Updates the current local settings for this `Http2Session` and sends a new`SETTINGS` frame to the connected HTTP/2 peer. - * - * Once called, the `http2session.pendingSettingsAck` property will be `true`while the session is waiting for the remote peer to acknowledge the new - * settings. - * - * The new settings will not become effective until the `SETTINGS` acknowledgment - * is received and the `'localSettings'` event is emitted. It is possible to send - * multiple `SETTINGS` frames while acknowledgment is still pending. - * @since v8.4.0 - * @param callback Callback that is called once the session is connected or right away if the session is already connected. - */ - settings( - settings: Settings, - callback?: (err: Error | null, settings: Settings, duration: number) => void, - ): void; - /** - * Calls `unref()` on this `Http2Session`instance's underlying `net.Socket`. - * @since v9.4.0 - */ - unref(): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - addListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - addListener(event: "localSettings", listener: (settings: Settings) => void): this; - addListener(event: "ping", listener: () => void): this; - addListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "frameError", frameType: number, errorCode: number, streamID: number): boolean; - emit(event: "goaway", errorCode: number, lastStreamID: number, opaqueData?: Buffer): boolean; - emit(event: "localSettings", settings: Settings): boolean; - emit(event: "ping"): boolean; - emit(event: "remoteSettings", settings: Settings): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - on(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; - on(event: "localSettings", listener: (settings: Settings) => void): this; - on(event: "ping", listener: () => void): this; - on(event: "remoteSettings", listener: (settings: Settings) => void): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "frameError", listener: (frameType: number, errorCode: number, streamID: number) => void): this; - once(event: "goaway", listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void): this; - once(event: "localSettings", listener: (settings: Settings) => void): this; - once(event: "ping", listener: () => void): this; - once(event: "remoteSettings", listener: (settings: Settings) => void): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - prependListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - prependListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependListener(event: "ping", listener: () => void): this; - prependListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "frameError", - listener: (frameType: number, errorCode: number, streamID: number) => void, - ): this; - prependOnceListener( - event: "goaway", - listener: (errorCode: number, lastStreamID: number, opaqueData?: Buffer) => void, - ): this; - prependOnceListener(event: "localSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "ping", listener: () => void): this; - prependOnceListener(event: "remoteSettings", listener: (settings: Settings) => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface ClientHttp2Session extends Http2Session { - /** - * For HTTP/2 Client `Http2Session` instances only, the `http2session.request()`creates and returns an `Http2Stream` instance that can be used to send an - * HTTP/2 request to the connected server. - * - * When a `ClientHttp2Session` is first created, the socket may not yet be - * connected. if `clienthttp2session.request()` is called during this time, the - * actual request will be deferred until the socket is ready to go. - * If the `session` is closed before the actual request be executed, an`ERR_HTTP2_GOAWAY_SESSION` is thrown. - * - * This method is only available if `http2session.type` is equal to`http2.constants.NGHTTP2_SESSION_CLIENT`. - * - * ```js - * const http2 = require('node:http2'); - * const clientSession = http2.connect('https://localhost:1234'); - * const { - * HTTP2_HEADER_PATH, - * HTTP2_HEADER_STATUS, - * } = http2.constants; - * - * const req = clientSession.request({ [HTTP2_HEADER_PATH]: '/' }); - * req.on('response', (headers) => { - * console.log(headers[HTTP2_HEADER_STATUS]); - * req.on('data', (chunk) => { // .. }); - * req.on('end', () => { // .. }); - * }); - * ``` - * - * When the `options.waitForTrailers` option is set, the `'wantTrailers'` event - * is emitted immediately after queuing the last chunk of payload data to be sent. - * The `http2stream.sendTrailers()` method can then be called to send trailing - * headers to the peer. - * - * When `options.waitForTrailers` is set, the `Http2Stream` will not automatically - * close when the final `DATA` frame is transmitted. User code must call either`http2stream.sendTrailers()` or `http2stream.close()` to close the`Http2Stream`. - * - * When `options.signal` is set with an `AbortSignal` and then `abort` on the - * corresponding `AbortController` is called, the request will emit an `'error'`event with an `AbortError` error. - * - * The `:method` and `:path` pseudo-headers are not specified within `headers`, - * they respectively default to: - * - * * `:method` \= `'GET'` - * * `:path` \= `/` - * @since v8.4.0 - */ - request(headers?: OutgoingHttpHeaders, options?: ClientSessionRequestOptions): ClientHttp2Stream; - addListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - addListener(event: "origin", listener: (origins: string[]) => void): this; - addListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - addListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "altsvc", alt: string, origin: string, stream: number): boolean; - emit(event: "origin", origins: readonly string[]): boolean; - emit(event: "connect", session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit( - event: "stream", - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - on(event: "origin", listener: (origins: string[]) => void): this; - on(event: "connect", listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - once(event: "origin", listener: (origins: string[]) => void): this; - once( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - once( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependListener(event: "origin", listener: (origins: string[]) => void): this; - prependListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "altsvc", listener: (alt: string, origin: string, stream: number) => void): this; - prependOnceListener(event: "origin", listener: (origins: string[]) => void): this; - prependOnceListener( - event: "connect", - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependOnceListener( - event: "stream", - listener: ( - stream: ClientHttp2Stream, - headers: IncomingHttpHeaders & IncomingHttpStatusHeader, - flags: number, - ) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface AlternativeServiceOptions { - origin: number | string | url.URL; - } - export interface ServerHttp2Session extends Http2Session { - readonly server: Http2Server | Http2SecureServer; - /** - * Submits an `ALTSVC` frame (as defined by [RFC 7838](https://tools.ietf.org/html/rfc7838)) to the connected client. - * - * ```js - * const http2 = require('node:http2'); - * - * const server = http2.createServer(); - * server.on('session', (session) => { - * // Set altsvc for origin https://example.org:80 - * session.altsvc('h2=":8000"', 'https://example.org:80'); - * }); - * - * server.on('stream', (stream) => { - * // Set altsvc for a specific stream - * stream.session.altsvc('h2=":8000"', stream.id); - * }); - * ``` - * - * Sending an `ALTSVC` frame with a specific stream ID indicates that the alternate - * service is associated with the origin of the given `Http2Stream`. - * - * The `alt` and origin string _must_ contain only ASCII bytes and are - * strictly interpreted as a sequence of ASCII bytes. The special value `'clear'`may be passed to clear any previously set alternative service for a given - * domain. - * - * When a string is passed for the `originOrStream` argument, it will be parsed as - * a URL and the origin will be derived. For instance, the origin for the - * HTTP URL `'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as`originOrStream`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * @since v9.4.0 - * @param alt A description of the alternative service configuration as defined by `RFC 7838`. - * @param originOrStream Either a URL string specifying the origin (or an `Object` with an `origin` property) or the numeric identifier of an active `Http2Stream` as given by the - * `http2stream.id` property. - */ - altsvc(alt: string, originOrStream: number | string | url.URL | AlternativeServiceOptions): void; - /** - * Submits an `ORIGIN` frame (as defined by [RFC 8336](https://tools.ietf.org/html/rfc8336)) to the connected client - * to advertise the set of origins for which the server is capable of providing - * authoritative responses. - * - * ```js - * const http2 = require('node:http2'); - * const options = getSecureOptionsSomehow(); - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * server.on('session', (session) => { - * session.origin('https://example.com', 'https://example.org'); - * }); - * ``` - * - * When a string is passed as an `origin`, it will be parsed as a URL and the - * origin will be derived. For instance, the origin for the HTTP URL`'https://example.org/foo/bar'` is the ASCII string`'https://example.org'`. An error will be thrown if either the given - * string - * cannot be parsed as a URL or if a valid origin cannot be derived. - * - * A `URL` object, or any object with an `origin` property, may be passed as - * an `origin`, in which case the value of the `origin` property will be - * used. The value of the `origin` property _must_ be a properly serialized - * ASCII origin. - * - * Alternatively, the `origins` option may be used when creating a new HTTP/2 - * server using the `http2.createSecureServer()` method: - * - * ```js - * const http2 = require('node:http2'); - * const options = getSecureOptionsSomehow(); - * options.origins = ['https://example.com', 'https://example.org']; - * const server = http2.createSecureServer(options); - * server.on('stream', (stream) => { - * stream.respond(); - * stream.end('ok'); - * }); - * ``` - * @since v10.12.0 - * @param origins One or more URL Strings passed as separate arguments. - */ - origin( - ...origins: Array< - | string - | url.URL - | { - origin: string; - } - > - ): void; - addListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "connect", session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "connect", listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "connect", - listener: (session: ServerHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - // Http2Server - export interface SessionOptions { - maxDeflateDynamicTableSize?: number | undefined; - maxSessionMemory?: number | undefined; - maxHeaderListPairs?: number | undefined; - maxOutstandingPings?: number | undefined; - maxSendHeaderBlockLength?: number | undefined; - paddingStrategy?: number | undefined; - peerMaxConcurrentStreams?: number | undefined; - settings?: Settings | undefined; - /** - * Specifies a timeout in milliseconds that - * a server should wait when an [`'unknownProtocol'`][] is emitted. If the - * socket has not been destroyed by that time the server will destroy it. - * @default 100000 - */ - unknownProtocolTimeout?: number | undefined; - selectPadding?(frameLen: number, maxFrameLen: number): number; - } - export interface ClientSessionOptions extends SessionOptions { - maxReservedRemoteStreams?: number | undefined; - createConnection?: ((authority: url.URL, option: SessionOptions) => stream.Duplex) | undefined; - protocol?: "http:" | "https:" | undefined; - } - export interface ServerSessionOptions extends SessionOptions { - Http1IncomingMessage?: typeof IncomingMessage | undefined; - Http1ServerResponse?: typeof ServerResponse | undefined; - Http2ServerRequest?: typeof Http2ServerRequest | undefined; - Http2ServerResponse?: typeof Http2ServerResponse | undefined; - } - export interface SecureClientSessionOptions extends ClientSessionOptions, tls.ConnectionOptions {} - export interface SecureServerSessionOptions extends ServerSessionOptions, tls.TlsOptions {} - export interface ServerOptions extends ServerSessionOptions {} - export interface SecureServerOptions extends SecureServerSessionOptions { - allowHTTP1?: boolean | undefined; - origins?: string[] | undefined; - } - interface HTTP2ServerCommon { - setTimeout(msec?: number, callback?: () => void): this; - /** - * Throws ERR_HTTP2_INVALID_SETTING_VALUE for invalid settings values. - * Throws ERR_INVALID_ARG_TYPE for invalid settings argument. - */ - updateSettings(settings: Settings): void; - } - export interface Http2Server extends net.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export interface Http2SecureServer extends tls.Server, HTTP2ServerCommon { - addListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - addListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - addListener(event: "sessionError", listener: (err: Error) => void): this; - addListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - addListener(event: "timeout", listener: () => void): this; - addListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "checkContinue", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "request", request: Http2ServerRequest, response: Http2ServerResponse): boolean; - emit(event: "session", session: ServerHttp2Session): boolean; - emit(event: "sessionError", err: Error): boolean; - emit(event: "stream", stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number): boolean; - emit(event: "timeout"): boolean; - emit(event: "unknownProtocol", socket: tls.TLSSocket): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - on(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - on(event: "session", listener: (session: ServerHttp2Session) => void): this; - on(event: "sessionError", listener: (err: Error) => void): this; - on( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - on(event: "timeout", listener: () => void): this; - on(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - once(event: "request", listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void): this; - once(event: "session", listener: (session: ServerHttp2Session) => void): this; - once(event: "sessionError", listener: (err: Error) => void): this; - once( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - once(event: "timeout", listener: () => void): this; - once(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependListener(event: "sessionError", listener: (err: Error) => void): this; - prependListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependListener(event: "timeout", listener: () => void): this; - prependListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener( - event: "checkContinue", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener( - event: "request", - listener: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): this; - prependOnceListener(event: "session", listener: (session: ServerHttp2Session) => void): this; - prependOnceListener(event: "sessionError", listener: (err: Error) => void): this; - prependOnceListener( - event: "stream", - listener: (stream: ServerHttp2Stream, headers: IncomingHttpHeaders, flags: number) => void, - ): this; - prependOnceListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: "unknownProtocol", listener: (socket: tls.TLSSocket) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * A `Http2ServerRequest` object is created by {@link Server} or {@link SecureServer} and passed as the first argument to the `'request'` event. It may be used to access a request status, - * headers, and - * data. - * @since v8.4.0 - */ - export class Http2ServerRequest extends stream.Readable { - constructor( - stream: ServerHttp2Stream, - headers: IncomingHttpHeaders, - options: stream.ReadableOptions, - rawHeaders: readonly string[], - ); - /** - * The `request.aborted` property will be `true` if the request has - * been aborted. - * @since v10.1.0 - */ - readonly aborted: boolean; - /** - * The request authority pseudo header field. Because HTTP/2 allows requests - * to set either `:authority` or `host`, this value is derived from`req.headers[':authority']` if present. Otherwise, it is derived from`req.headers['host']`. - * @since v8.4.0 - */ - readonly authority: string; - /** - * See `request.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * The `request.complete` property will be `true` if the request has - * been completed, aborted, or destroyed. - * @since v12.10.0 - */ - readonly complete: boolean; - /** - * The request/response headers object. - * - * Key-value pairs of header names and values. Header names are lower-cased. - * - * ```js - * // Prints something like: - * // - * // { 'user-agent': 'curl/7.22.0', - * // host: '127.0.0.1:8000', - * // accept: '*' } - * console.log(request.headers); - * ``` - * - * See `HTTP/2 Headers Object`. - * - * In HTTP/2, the request path, host name, protocol, and method are represented as - * special headers prefixed with the `:` character (e.g. `':path'`). These special - * headers will be included in the `request.headers` object. Care must be taken not - * to inadvertently modify these special headers or errors may occur. For instance, - * removing all headers from the request will cause errors to occur: - * - * ```js - * removeAllHeaders(request.headers); - * assert(request.url); // Fails because the :path header has been removed - * ``` - * @since v8.4.0 - */ - readonly headers: IncomingHttpHeaders; - /** - * In case of server request, the HTTP version sent by the client. In the case of - * client response, the HTTP version of the connected-to server. Returns`'2.0'`. - * - * Also `message.httpVersionMajor` is the first integer and`message.httpVersionMinor` is the second. - * @since v8.4.0 - */ - readonly httpVersion: string; - readonly httpVersionMinor: number; - readonly httpVersionMajor: number; - /** - * The request method as a string. Read-only. Examples: `'GET'`, `'DELETE'`. - * @since v8.4.0 - */ - readonly method: string; - /** - * The raw request/response headers list exactly as they were received. - * - * The keys and values are in the same list. It is _not_ a - * list of tuples. So, the even-numbered offsets are key values, and the - * odd-numbered offsets are the associated values. - * - * Header names are not lowercased, and duplicates are not merged. - * - * ```js - * // Prints something like: - * // - * // [ 'user-agent', - * // 'this is invalid because there can be only one', - * // 'User-Agent', - * // 'curl/7.22.0', - * // 'Host', - * // '127.0.0.1:8000', - * // 'ACCEPT', - * // '*' ] - * console.log(request.rawHeaders); - * ``` - * @since v8.4.0 - */ - readonly rawHeaders: string[]; - /** - * The raw request/response trailer keys and values exactly as they were - * received. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly rawTrailers: string[]; - /** - * The request scheme pseudo header field indicating the scheme - * portion of the target URL. - * @since v8.4.0 - */ - readonly scheme: string; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `request.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`request.stream`. - * - * `setTimeout` method will be called on `request.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. With TLS support, - * use `request.socket.getPeerCertificate()` to obtain the client's - * authentication details. - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the request. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * The request/response trailers object. Only populated at the `'end'` event. - * @since v8.4.0 - */ - readonly trailers: IncomingHttpHeaders; - /** - * Request URL string. This contains only the URL that is present in the actual - * HTTP request. If the request is: - * - * ```http - * GET /status?name=ryan HTTP/1.1 - * Accept: text/plain - * ``` - * - * Then `request.url` will be: - * - * ```js - * '/status?name=ryan' - * ``` - * - * To parse the url into its parts, `new URL()` can be used: - * - * ```console - * $ node - * > new URL('/status?name=ryan', 'http://example.com') - * URL { - * href: 'http://example.com/status?name=ryan', - * origin: 'http://example.com', - * protocol: 'http:', - * username: '', - * password: '', - * host: 'example.com', - * hostname: 'example.com', - * port: '', - * pathname: '/status', - * search: '?name=ryan', - * searchParams: URLSearchParams { 'name' => 'ryan' }, - * hash: '' - * } - * ``` - * @since v8.4.0 - */ - url: string; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream` s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - read(size?: number): Buffer | string | null; - addListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: Buffer | string) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "aborted", hadError: boolean, code: number): boolean; - emit(event: "close"): boolean; - emit(event: "data", chunk: Buffer | string): boolean; - emit(event: "end"): boolean; - emit(event: "readable"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: Buffer | string) => void): this; - on(event: "end", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: Buffer | string) => void): this; - once(event: "end", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "aborted", listener: (hadError: boolean, code: number) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: Buffer | string) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - /** - * This object is created internally by an HTTP server, not by the user. It is - * passed as the second parameter to the `'request'` event. - * @since v8.4.0 - */ - export class Http2ServerResponse extends stream.Writable { - constructor(stream: ServerHttp2Stream); - /** - * See `response.socket`. - * @since v8.4.0 - * @deprecated Since v13.0.0 - Use `socket`. - */ - readonly connection: net.Socket | tls.TLSSocket; - /** - * Boolean value that indicates whether the response has completed. Starts - * as `false`. After `response.end()` executes, the value will be `true`. - * @since v8.4.0 - * @deprecated Since v13.4.0,v12.16.0 - Use `writableEnded`. - */ - readonly finished: boolean; - /** - * True if headers were sent, false otherwise (read-only). - * @since v8.4.0 - */ - readonly headersSent: boolean; - /** - * A reference to the original HTTP2 `request` object. - * @since v15.7.0 - */ - readonly req: Http2ServerRequest; - /** - * Returns a `Proxy` object that acts as a `net.Socket` (or `tls.TLSSocket`) but - * applies getters, setters, and methods based on HTTP/2 logic. - * - * `destroyed`, `readable`, and `writable` properties will be retrieved from and - * set on `response.stream`. - * - * `destroy`, `emit`, `end`, `on` and `once` methods will be called on`response.stream`. - * - * `setTimeout` method will be called on `response.stream.session`. - * - * `pause`, `read`, `resume`, and `write` will throw an error with code`ERR_HTTP2_NO_SOCKET_MANIPULATION`. See `Http2Session and Sockets` for - * more information. - * - * All other interactions will be routed directly to the socket. - * - * ```js - * const http2 = require('node:http2'); - * const server = http2.createServer((req, res) => { - * const ip = req.socket.remoteAddress; - * const port = req.socket.remotePort; - * res.end(`Your IP address is ${ip} and your source port is ${port}.`); - * }).listen(3000); - * ``` - * @since v8.4.0 - */ - readonly socket: net.Socket | tls.TLSSocket; - /** - * The `Http2Stream` object backing the response. - * @since v8.4.0 - */ - readonly stream: ServerHttp2Stream; - /** - * When true, the Date header will be automatically generated and sent in - * the response if it is not already present in the headers. Defaults to true. - * - * This should only be disabled for testing; HTTP requires the Date header - * in responses. - * @since v8.4.0 - */ - sendDate: boolean; - /** - * When using implicit headers (not calling `response.writeHead()` explicitly), - * this property controls the status code that will be sent to the client when - * the headers get flushed. - * - * ```js - * response.statusCode = 404; - * ``` - * - * After response header was sent to the client, this property indicates the - * status code which was sent out. - * @since v8.4.0 - */ - statusCode: number; - /** - * Status message is not supported by HTTP/2 (RFC 7540 8.1.2.4). It returns - * an empty string. - * @since v8.4.0 - */ - statusMessage: ""; - /** - * This method adds HTTP trailing headers (a header but at the end of the - * message) to the response. - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - addTrailers(trailers: OutgoingHttpHeaders): void; - /** - * This method signals to the server that all of the response headers and body - * have been sent; that server should consider this message complete. - * The method, `response.end()`, MUST be called on each response. - * - * If `data` is specified, it is equivalent to calling `response.write(data, encoding)` followed by `response.end(callback)`. - * - * If `callback` is specified, it will be called when the response stream - * is finished. - * @since v8.4.0 - */ - end(callback?: () => void): this; - end(data: string | Uint8Array, callback?: () => void): this; - end(data: string | Uint8Array, encoding: BufferEncoding, callback?: () => void): this; - /** - * Reads out a header that has already been queued but not sent to the client. - * The name is case-insensitive. - * - * ```js - * const contentType = response.getHeader('content-type'); - * ``` - * @since v8.4.0 - */ - getHeader(name: string): string; - /** - * Returns an array containing the unique names of the current outgoing headers. - * All header names are lowercase. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headerNames = response.getHeaderNames(); - * // headerNames === ['foo', 'set-cookie'] - * ``` - * @since v8.4.0 - */ - getHeaderNames(): string[]; - /** - * Returns a shallow copy of the current outgoing headers. Since a shallow copy - * is used, array values may be mutated without additional calls to various - * header-related http module methods. The keys of the returned object are the - * header names and the values are the respective header values. All header names - * are lowercase. - * - * The object returned by the `response.getHeaders()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * ```js - * response.setHeader('Foo', 'bar'); - * response.setHeader('Set-Cookie', ['foo=bar', 'bar=baz']); - * - * const headers = response.getHeaders(); - * // headers === { foo: 'bar', 'set-cookie': ['foo=bar', 'bar=baz'] } - * ``` - * @since v8.4.0 - */ - getHeaders(): OutgoingHttpHeaders; - /** - * Returns `true` if the header identified by `name` is currently set in the - * outgoing headers. The header name matching is case-insensitive. - * - * ```js - * const hasContentType = response.hasHeader('content-type'); - * ``` - * @since v8.4.0 - */ - hasHeader(name: string): boolean; - /** - * Removes a header that has been queued for implicit sending. - * - * ```js - * response.removeHeader('Content-Encoding'); - * ``` - * @since v8.4.0 - */ - removeHeader(name: string): void; - /** - * Sets a single header value for implicit headers. If this header already exists - * in the to-be-sent headers, its value will be replaced. Use an array of strings - * here to send multiple headers with the same name. - * - * ```js - * response.setHeader('Content-Type', 'text/html; charset=utf-8'); - * ``` - * - * or - * - * ```js - * response.setHeader('Set-Cookie', ['type=ninja', 'language=javascript']); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * @since v8.4.0 - */ - setHeader(name: string, value: number | string | readonly string[]): void; - /** - * Sets the `Http2Stream`'s timeout value to `msecs`. If a callback is - * provided, then it is added as a listener on the `'timeout'` event on - * the response object. - * - * If no `'timeout'` listener is added to the request, the response, or - * the server, then `Http2Stream` s are destroyed when they time out. If a - * handler is assigned to the request, the response, or the server's `'timeout'`events, timed out sockets must be handled explicitly. - * @since v8.4.0 - */ - setTimeout(msecs: number, callback?: () => void): void; - /** - * If this method is called and `response.writeHead()` has not been called, - * it will switch to implicit header mode and flush the implicit headers. - * - * This sends a chunk of the response body. This method may - * be called multiple times to provide successive parts of the body. - * - * In the `node:http` module, the response body is omitted when the - * request is a HEAD request. Similarly, the `204` and `304` responses _must not_ include a message body. - * - * `chunk` can be a string or a buffer. If `chunk` is a string, - * the second parameter specifies how to encode it into a byte stream. - * By default the `encoding` is `'utf8'`. `callback` will be called when this chunk - * of data is flushed. - * - * This is the raw HTTP body and has nothing to do with higher-level multi-part - * body encodings that may be used. - * - * The first time `response.write()` is called, it will send the buffered - * header information and the first chunk of the body to the client. The second - * time `response.write()` is called, Node.js assumes data will be streamed, - * and sends the new data separately. That is, the response is buffered up to the - * first chunk of the body. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is free again. - * @since v8.4.0 - */ - write(chunk: string | Uint8Array, callback?: (err: Error) => void): boolean; - write(chunk: string | Uint8Array, encoding: BufferEncoding, callback?: (err: Error) => void): boolean; - /** - * Sends a status `100 Continue` to the client, indicating that the request body - * should be sent. See the `'checkContinue'` event on `Http2Server` and`Http2SecureServer`. - * @since v8.4.0 - */ - writeContinue(): void; - /** - * Sends a status `103 Early Hints` to the client with a Link header, - * indicating that the user agent can preload/preconnect the linked resources. - * The `hints` is an object containing the values of headers to be sent with - * early hints message. - * - * **Example** - * - * ```js - * const earlyHintsLink = '; rel=preload; as=style'; - * response.writeEarlyHints({ - * 'link': earlyHintsLink, - * }); - * - * const earlyHintsLinks = [ - * '; rel=preload; as=style', - * '; rel=preload; as=script', - * ]; - * response.writeEarlyHints({ - * 'link': earlyHintsLinks, - * }); - * ``` - * @since v18.11.0 - */ - writeEarlyHints(hints: Record): void; - /** - * Sends a response header to the request. The status code is a 3-digit HTTP - * status code, like `404`. The last argument, `headers`, are the response headers. - * - * Returns a reference to the `Http2ServerResponse`, so that calls can be chained. - * - * For compatibility with `HTTP/1`, a human-readable `statusMessage` may be - * passed as the second argument. However, because the `statusMessage` has no - * meaning within HTTP/2, the argument will have no effect and a process warning - * will be emitted. - * - * ```js - * const body = 'hello world'; - * response.writeHead(200, { - * 'Content-Length': Buffer.byteLength(body), - * 'Content-Type': 'text/plain; charset=utf-8', - * }); - * ``` - * - * `Content-Length` is given in bytes not characters. The`Buffer.byteLength()` API may be used to determine the number of bytes in a - * given encoding. On outbound messages, Node.js does not check if Content-Length - * and the length of the body being transmitted are equal or not. However, when - * receiving messages, Node.js will automatically reject messages when the`Content-Length` does not match the actual payload size. - * - * This method may be called at most one time on a message before `response.end()` is called. - * - * If `response.write()` or `response.end()` are called before calling - * this, the implicit/mutable headers will be calculated and call this function. - * - * When headers have been set with `response.setHeader()`, they will be merged - * with any headers passed to `response.writeHead()`, with the headers passed - * to `response.writeHead()` given precedence. - * - * ```js - * // Returns content-type = text/plain - * const server = http2.createServer((req, res) => { - * res.setHeader('Content-Type', 'text/html; charset=utf-8'); - * res.setHeader('X-Foo', 'bar'); - * res.writeHead(200, { 'Content-Type': 'text/plain; charset=utf-8' }); - * res.end('ok'); - * }); - * ``` - * - * Attempting to set a header field name or value that contains invalid characters - * will result in a `TypeError` being thrown. - * @since v8.4.0 - */ - writeHead(statusCode: number, headers?: OutgoingHttpHeaders): this; - writeHead(statusCode: number, statusMessage: string, headers?: OutgoingHttpHeaders): this; - /** - * Call `http2stream.pushStream()` with the given headers, and wrap the - * given `Http2Stream` on a newly created `Http2ServerResponse` as the callback - * parameter if successful. When `Http2ServerRequest` is closed, the callback is - * called with an error `ERR_HTTP2_INVALID_STREAM`. - * @since v8.4.0 - * @param headers An object describing the headers - * @param callback Called once `http2stream.pushStream()` is finished, or either when the attempt to create the pushed `Http2Stream` has failed or has been rejected, or the state of - * `Http2ServerRequest` is closed prior to calling the `http2stream.pushStream()` method - */ - createPushResponse( - headers: OutgoingHttpHeaders, - callback: (err: Error | null, res: Http2ServerResponse) => void, - ): void; - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (error: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: stream.Readable) => void): this; - addListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", error: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: stream.Readable): boolean; - emit(event: "unpipe", src: stream.Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (error: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: stream.Readable) => void): this; - on(event: "unpipe", listener: (src: stream.Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (error: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: stream.Readable) => void): this; - once(event: "unpipe", listener: (src: stream.Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (error: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (error: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: stream.Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - export namespace constants { - const NGHTTP2_SESSION_SERVER: number; - const NGHTTP2_SESSION_CLIENT: number; - const NGHTTP2_STREAM_STATE_IDLE: number; - const NGHTTP2_STREAM_STATE_OPEN: number; - const NGHTTP2_STREAM_STATE_RESERVED_LOCAL: number; - const NGHTTP2_STREAM_STATE_RESERVED_REMOTE: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_LOCAL: number; - const NGHTTP2_STREAM_STATE_HALF_CLOSED_REMOTE: number; - const NGHTTP2_STREAM_STATE_CLOSED: number; - const NGHTTP2_NO_ERROR: number; - const NGHTTP2_PROTOCOL_ERROR: number; - const NGHTTP2_INTERNAL_ERROR: number; - const NGHTTP2_FLOW_CONTROL_ERROR: number; - const NGHTTP2_SETTINGS_TIMEOUT: number; - const NGHTTP2_STREAM_CLOSED: number; - const NGHTTP2_FRAME_SIZE_ERROR: number; - const NGHTTP2_REFUSED_STREAM: number; - const NGHTTP2_CANCEL: number; - const NGHTTP2_COMPRESSION_ERROR: number; - const NGHTTP2_CONNECT_ERROR: number; - const NGHTTP2_ENHANCE_YOUR_CALM: number; - const NGHTTP2_INADEQUATE_SECURITY: number; - const NGHTTP2_HTTP_1_1_REQUIRED: number; - const NGHTTP2_ERR_FRAME_SIZE_ERROR: number; - const NGHTTP2_FLAG_NONE: number; - const NGHTTP2_FLAG_END_STREAM: number; - const NGHTTP2_FLAG_END_HEADERS: number; - const NGHTTP2_FLAG_ACK: number; - const NGHTTP2_FLAG_PADDED: number; - const NGHTTP2_FLAG_PRIORITY: number; - const DEFAULT_SETTINGS_HEADER_TABLE_SIZE: number; - const DEFAULT_SETTINGS_ENABLE_PUSH: number; - const DEFAULT_SETTINGS_INITIAL_WINDOW_SIZE: number; - const DEFAULT_SETTINGS_MAX_FRAME_SIZE: number; - const MAX_MAX_FRAME_SIZE: number; - const MIN_MAX_FRAME_SIZE: number; - const MAX_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_DEFAULT_WEIGHT: number; - const NGHTTP2_SETTINGS_HEADER_TABLE_SIZE: number; - const NGHTTP2_SETTINGS_ENABLE_PUSH: number; - const NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS: number; - const NGHTTP2_SETTINGS_INITIAL_WINDOW_SIZE: number; - const NGHTTP2_SETTINGS_MAX_FRAME_SIZE: number; - const NGHTTP2_SETTINGS_MAX_HEADER_LIST_SIZE: number; - const PADDING_STRATEGY_NONE: number; - const PADDING_STRATEGY_MAX: number; - const PADDING_STRATEGY_CALLBACK: number; - const HTTP2_HEADER_STATUS: string; - const HTTP2_HEADER_METHOD: string; - const HTTP2_HEADER_AUTHORITY: string; - const HTTP2_HEADER_SCHEME: string; - const HTTP2_HEADER_PATH: string; - const HTTP2_HEADER_ACCEPT_CHARSET: string; - const HTTP2_HEADER_ACCEPT_ENCODING: string; - const HTTP2_HEADER_ACCEPT_LANGUAGE: string; - const HTTP2_HEADER_ACCEPT_RANGES: string; - const HTTP2_HEADER_ACCEPT: string; - const HTTP2_HEADER_ACCESS_CONTROL_ALLOW_ORIGIN: string; - const HTTP2_HEADER_AGE: string; - const HTTP2_HEADER_ALLOW: string; - const HTTP2_HEADER_AUTHORIZATION: string; - const HTTP2_HEADER_CACHE_CONTROL: string; - const HTTP2_HEADER_CONNECTION: string; - const HTTP2_HEADER_CONTENT_DISPOSITION: string; - const HTTP2_HEADER_CONTENT_ENCODING: string; - const HTTP2_HEADER_CONTENT_LANGUAGE: string; - const HTTP2_HEADER_CONTENT_LENGTH: string; - const HTTP2_HEADER_CONTENT_LOCATION: string; - const HTTP2_HEADER_CONTENT_MD5: string; - const HTTP2_HEADER_CONTENT_RANGE: string; - const HTTP2_HEADER_CONTENT_TYPE: string; - const HTTP2_HEADER_COOKIE: string; - const HTTP2_HEADER_DATE: string; - const HTTP2_HEADER_ETAG: string; - const HTTP2_HEADER_EXPECT: string; - const HTTP2_HEADER_EXPIRES: string; - const HTTP2_HEADER_FROM: string; - const HTTP2_HEADER_HOST: string; - const HTTP2_HEADER_IF_MATCH: string; - const HTTP2_HEADER_IF_MODIFIED_SINCE: string; - const HTTP2_HEADER_IF_NONE_MATCH: string; - const HTTP2_HEADER_IF_RANGE: string; - const HTTP2_HEADER_IF_UNMODIFIED_SINCE: string; - const HTTP2_HEADER_LAST_MODIFIED: string; - const HTTP2_HEADER_LINK: string; - const HTTP2_HEADER_LOCATION: string; - const HTTP2_HEADER_MAX_FORWARDS: string; - const HTTP2_HEADER_PREFER: string; - const HTTP2_HEADER_PROXY_AUTHENTICATE: string; - const HTTP2_HEADER_PROXY_AUTHORIZATION: string; - const HTTP2_HEADER_RANGE: string; - const HTTP2_HEADER_REFERER: string; - const HTTP2_HEADER_REFRESH: string; - const HTTP2_HEADER_RETRY_AFTER: string; - const HTTP2_HEADER_SERVER: string; - const HTTP2_HEADER_SET_COOKIE: string; - const HTTP2_HEADER_STRICT_TRANSPORT_SECURITY: string; - const HTTP2_HEADER_TRANSFER_ENCODING: string; - const HTTP2_HEADER_TE: string; - const HTTP2_HEADER_UPGRADE: string; - const HTTP2_HEADER_USER_AGENT: string; - const HTTP2_HEADER_VARY: string; - const HTTP2_HEADER_VIA: string; - const HTTP2_HEADER_WWW_AUTHENTICATE: string; - const HTTP2_HEADER_HTTP2_SETTINGS: string; - const HTTP2_HEADER_KEEP_ALIVE: string; - const HTTP2_HEADER_PROXY_CONNECTION: string; - const HTTP2_METHOD_ACL: string; - const HTTP2_METHOD_BASELINE_CONTROL: string; - const HTTP2_METHOD_BIND: string; - const HTTP2_METHOD_CHECKIN: string; - const HTTP2_METHOD_CHECKOUT: string; - const HTTP2_METHOD_CONNECT: string; - const HTTP2_METHOD_COPY: string; - const HTTP2_METHOD_DELETE: string; - const HTTP2_METHOD_GET: string; - const HTTP2_METHOD_HEAD: string; - const HTTP2_METHOD_LABEL: string; - const HTTP2_METHOD_LINK: string; - const HTTP2_METHOD_LOCK: string; - const HTTP2_METHOD_MERGE: string; - const HTTP2_METHOD_MKACTIVITY: string; - const HTTP2_METHOD_MKCALENDAR: string; - const HTTP2_METHOD_MKCOL: string; - const HTTP2_METHOD_MKREDIRECTREF: string; - const HTTP2_METHOD_MKWORKSPACE: string; - const HTTP2_METHOD_MOVE: string; - const HTTP2_METHOD_OPTIONS: string; - const HTTP2_METHOD_ORDERPATCH: string; - const HTTP2_METHOD_PATCH: string; - const HTTP2_METHOD_POST: string; - const HTTP2_METHOD_PRI: string; - const HTTP2_METHOD_PROPFIND: string; - const HTTP2_METHOD_PROPPATCH: string; - const HTTP2_METHOD_PUT: string; - const HTTP2_METHOD_REBIND: string; - const HTTP2_METHOD_REPORT: string; - const HTTP2_METHOD_SEARCH: string; - const HTTP2_METHOD_TRACE: string; - const HTTP2_METHOD_UNBIND: string; - const HTTP2_METHOD_UNCHECKOUT: string; - const HTTP2_METHOD_UNLINK: string; - const HTTP2_METHOD_UNLOCK: string; - const HTTP2_METHOD_UPDATE: string; - const HTTP2_METHOD_UPDATEREDIRECTREF: string; - const HTTP2_METHOD_VERSION_CONTROL: string; - const HTTP_STATUS_CONTINUE: number; - const HTTP_STATUS_SWITCHING_PROTOCOLS: number; - const HTTP_STATUS_PROCESSING: number; - const HTTP_STATUS_OK: number; - const HTTP_STATUS_CREATED: number; - const HTTP_STATUS_ACCEPTED: number; - const HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION: number; - const HTTP_STATUS_NO_CONTENT: number; - const HTTP_STATUS_RESET_CONTENT: number; - const HTTP_STATUS_PARTIAL_CONTENT: number; - const HTTP_STATUS_MULTI_STATUS: number; - const HTTP_STATUS_ALREADY_REPORTED: number; - const HTTP_STATUS_IM_USED: number; - const HTTP_STATUS_MULTIPLE_CHOICES: number; - const HTTP_STATUS_MOVED_PERMANENTLY: number; - const HTTP_STATUS_FOUND: number; - const HTTP_STATUS_SEE_OTHER: number; - const HTTP_STATUS_NOT_MODIFIED: number; - const HTTP_STATUS_USE_PROXY: number; - const HTTP_STATUS_TEMPORARY_REDIRECT: number; - const HTTP_STATUS_PERMANENT_REDIRECT: number; - const HTTP_STATUS_BAD_REQUEST: number; - const HTTP_STATUS_UNAUTHORIZED: number; - const HTTP_STATUS_PAYMENT_REQUIRED: number; - const HTTP_STATUS_FORBIDDEN: number; - const HTTP_STATUS_NOT_FOUND: number; - const HTTP_STATUS_METHOD_NOT_ALLOWED: number; - const HTTP_STATUS_NOT_ACCEPTABLE: number; - const HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED: number; - const HTTP_STATUS_REQUEST_TIMEOUT: number; - const HTTP_STATUS_CONFLICT: number; - const HTTP_STATUS_GONE: number; - const HTTP_STATUS_LENGTH_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_FAILED: number; - const HTTP_STATUS_PAYLOAD_TOO_LARGE: number; - const HTTP_STATUS_URI_TOO_LONG: number; - const HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE: number; - const HTTP_STATUS_RANGE_NOT_SATISFIABLE: number; - const HTTP_STATUS_EXPECTATION_FAILED: number; - const HTTP_STATUS_TEAPOT: number; - const HTTP_STATUS_MISDIRECTED_REQUEST: number; - const HTTP_STATUS_UNPROCESSABLE_ENTITY: number; - const HTTP_STATUS_LOCKED: number; - const HTTP_STATUS_FAILED_DEPENDENCY: number; - const HTTP_STATUS_UNORDERED_COLLECTION: number; - const HTTP_STATUS_UPGRADE_REQUIRED: number; - const HTTP_STATUS_PRECONDITION_REQUIRED: number; - const HTTP_STATUS_TOO_MANY_REQUESTS: number; - const HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE: number; - const HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS: number; - const HTTP_STATUS_INTERNAL_SERVER_ERROR: number; - const HTTP_STATUS_NOT_IMPLEMENTED: number; - const HTTP_STATUS_BAD_GATEWAY: number; - const HTTP_STATUS_SERVICE_UNAVAILABLE: number; - const HTTP_STATUS_GATEWAY_TIMEOUT: number; - const HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED: number; - const HTTP_STATUS_VARIANT_ALSO_NEGOTIATES: number; - const HTTP_STATUS_INSUFFICIENT_STORAGE: number; - const HTTP_STATUS_LOOP_DETECTED: number; - const HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED: number; - const HTTP_STATUS_NOT_EXTENDED: number; - const HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED: number; - } - /** - * This symbol can be set as a property on the HTTP/2 headers object with - * an array value in order to provide a list of headers considered sensitive. - */ - export const sensitiveHeaders: symbol; - /** - * Returns an object containing the default settings for an `Http2Session`instance. This method returns a new object instance every time it is called - * so instances returned may be safely modified for use. - * @since v8.4.0 - */ - export function getDefaultSettings(): Settings; - /** - * Returns a `Buffer` instance containing serialized representation of the given - * HTTP/2 settings as specified in the [HTTP/2](https://tools.ietf.org/html/rfc7540) specification. This is intended - * for use with the `HTTP2-Settings` header field. - * - * ```js - * const http2 = require('node:http2'); - * - * const packed = http2.getPackedSettings({ enablePush: false }); - * - * console.log(packed.toString('base64')); - * // Prints: AAIAAAAA - * ``` - * @since v8.4.0 - */ - export function getPackedSettings(settings: Settings): Buffer; - /** - * Returns a `HTTP/2 Settings Object` containing the deserialized settings from - * the given `Buffer` as generated by `http2.getPackedSettings()`. - * @since v8.4.0 - * @param buf The packed settings. - */ - export function getUnpackedSettings(buf: Uint8Array): Settings; - /** - * Returns a `net.Server` instance that creates and manages `Http2Session`instances. - * - * Since there are no browsers known that support [unencrypted HTTP/2](https://http2.github.io/faq/#does-http2-require-encryption), the use of {@link createSecureServer} is necessary when - * communicating - * with browser clients. - * - * ```js - * const http2 = require('node:http2'); - * - * // Create an unencrypted HTTP/2 server. - * // Since there are no browsers known that support - * // unencrypted HTTP/2, the use of `http2.createSecureServer()` - * // is necessary when communicating with browser clients. - * const server = http2.createServer(); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

Hello World

'); - * }); - * - * server.listen(8000); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2Server; - export function createServer( - options: ServerOptions, - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2Server; - /** - * Returns a `tls.Server` instance that creates and manages `Http2Session`instances. - * - * ```js - * const http2 = require('node:http2'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * }; - * - * // Create a secure HTTP/2 server - * const server = http2.createSecureServer(options); - * - * server.on('stream', (stream, headers) => { - * stream.respond({ - * 'content-type': 'text/html; charset=utf-8', - * ':status': 200, - * }); - * stream.end('

Hello World

'); - * }); - * - * server.listen(8443); - * ``` - * @since v8.4.0 - * @param onRequestHandler See `Compatibility API` - */ - export function createSecureServer( - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2SecureServer; - export function createSecureServer( - options: SecureServerOptions, - onRequestHandler?: (request: Http2ServerRequest, response: Http2ServerResponse) => void, - ): Http2SecureServer; - /** - * Returns a `ClientHttp2Session` instance. - * - * ```js - * const http2 = require('node:http2'); - * const client = http2.connect('https://localhost:1234'); - * - * // Use the client - * - * client.close(); - * ``` - * @since v8.4.0 - * @param authority The remote HTTP/2 server to connect to. This must be in the form of a minimal, valid URL with the `http://` or `https://` prefix, host name, and IP port (if a non-default port - * is used). Userinfo (user ID and password), path, querystring, and fragment details in the URL will be ignored. - * @param listener Will be registered as a one-time listener of the {@link 'connect'} event. - */ - export function connect( - authority: string | url.URL, - listener: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; - export function connect( - authority: string | url.URL, - options?: ClientSessionOptions | SecureClientSessionOptions, - listener?: (session: ClientHttp2Session, socket: net.Socket | tls.TLSSocket) => void, - ): ClientHttp2Session; -} -declare module "node:http2" { - export * from "http2"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/https.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/https.d.ts deleted file mode 100644 index 36ae5b2f..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/https.d.ts +++ /dev/null @@ -1,550 +0,0 @@ -/** - * HTTPS is the HTTP protocol over TLS/SSL. In Node.js this is implemented as a - * separate module. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/https.js) - */ -declare module "https" { - import { Duplex } from "node:stream"; - import * as tls from "node:tls"; - import * as http from "node:http"; - import { URL } from "node:url"; - type ServerOptions< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > = tls.SecureContextOptions & tls.TlsOptions & http.ServerOptions; - type RequestOptions = - & http.RequestOptions - & tls.SecureContextOptions - & { - checkServerIdentity?: typeof tls.checkServerIdentity | undefined; - rejectUnauthorized?: boolean | undefined; // Defaults to true - servername?: string | undefined; // SNI TLS Extension - }; - interface AgentOptions extends http.AgentOptions, tls.ConnectionOptions { - rejectUnauthorized?: boolean | undefined; - maxCachedSessions?: number | undefined; - } - /** - * An `Agent` object for HTTPS similar to `http.Agent`. See {@link request} for more information. - * @since v0.4.5 - */ - class Agent extends http.Agent { - constructor(options?: AgentOptions); - options: AgentOptions; - } - interface Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > extends http.Server {} - /** - * See `http.Server` for more information. - * @since v0.3.4 - */ - class Server< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - > extends tls.Server { - constructor(requestListener?: http.RequestListener); - constructor( - options: ServerOptions, - requestListener?: http.RequestListener, - ); - /** - * Closes all connections connected to this server. - * @since v18.2.0 - */ - closeAllConnections(): void; - /** - * Closes all connections connected to this server which are not sending a request or waiting for a response. - * @since v18.2.0 - */ - closeIdleConnections(): void; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Duplex) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "checkContinue", listener: http.RequestListener): this; - addListener(event: "checkExpectation", listener: http.RequestListener): this; - addListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - addListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - addListener(event: "request", listener: http.RequestListener): this; - addListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - emit(event: string, ...args: any[]): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: tls.TLSSocket): boolean; - emit( - event: "newSession", - sessionId: Buffer, - sessionData: Buffer, - callback: (err: Error, resp: Buffer) => void, - ): boolean; - emit( - event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ): boolean; - emit(event: "resumeSession", sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void): boolean; - emit(event: "secureConnection", tlsSocket: tls.TLSSocket): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: tls.TLSSocket): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Duplex): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit( - event: "checkContinue", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit( - event: "checkExpectation", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit(event: "clientError", err: Error, socket: Duplex): boolean; - emit(event: "connect", req: InstanceType, socket: Duplex, head: Buffer): boolean; - emit( - event: "request", - req: InstanceType, - res: InstanceType & { - req: InstanceType; - }, - ): boolean; - emit(event: "upgrade", req: InstanceType, socket: Duplex, head: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - on( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - on( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Duplex) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "checkContinue", listener: http.RequestListener): this; - on(event: "checkExpectation", listener: http.RequestListener): this; - on(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - on(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - on(event: "request", listener: http.RequestListener): this; - on(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Duplex) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "checkContinue", listener: http.RequestListener): this; - once(event: "checkExpectation", listener: http.RequestListener): this; - once(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - once(event: "connect", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - once(event: "request", listener: http.RequestListener): this; - once(event: "upgrade", listener: (req: InstanceType, socket: Duplex, head: Buffer) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Duplex) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "checkContinue", listener: http.RequestListener): this; - prependListener(event: "checkExpectation", listener: http.RequestListener): this; - prependListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependListener(event: "request", listener: http.RequestListener): this; - prependListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: (err: Error, resp: Buffer) => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error, sessionData: Buffer) => void) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: tls.TLSSocket) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Duplex) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "checkContinue", listener: http.RequestListener): this; - prependOnceListener(event: "checkExpectation", listener: http.RequestListener): this; - prependOnceListener(event: "clientError", listener: (err: Error, socket: Duplex) => void): this; - prependOnceListener( - event: "connect", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - prependOnceListener(event: "request", listener: http.RequestListener): this; - prependOnceListener( - event: "upgrade", - listener: (req: InstanceType, socket: Duplex, head: Buffer) => void, - ): this; - } - /** - * ```js - * // curl -k https://localhost:8000/ - * const https = require('node:https'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * - * Or - * - * ```js - * const https = require('node:https'); - * const fs = require('node:fs'); - * - * const options = { - * pfx: fs.readFileSync('test/fixtures/test_cert.pfx'), - * passphrase: 'sample', - * }; - * - * https.createServer(options, (req, res) => { - * res.writeHead(200); - * res.end('hello world\n'); - * }).listen(8000); - * ``` - * @since v0.3.4 - * @param options Accepts `options` from `createServer`, `createSecureContext` and `createServer`. - * @param requestListener A listener to be added to the `'request'` event. - */ - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - >(requestListener?: http.RequestListener): Server; - function createServer< - Request extends typeof http.IncomingMessage = typeof http.IncomingMessage, - Response extends typeof http.ServerResponse = typeof http.ServerResponse, - >( - options: ServerOptions, - requestListener?: http.RequestListener, - ): Server; - /** - * Makes a request to a secure web server. - * - * The following additional `options` from `tls.connect()` are also accepted:`ca`, `cert`, `ciphers`, `clientCertEngine`, `crl`, `dhparam`, `ecdhCurve`,`honorCipherOrder`, `key`, `passphrase`, - * `pfx`, `rejectUnauthorized`,`secureOptions`, `secureProtocol`, `servername`, `sessionIdContext`,`highWaterMark`. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * `https.request()` returns an instance of the `http.ClientRequest` class. The `ClientRequest` instance is a writable stream. If one needs to - * upload a file with a POST request, then write to the `ClientRequest` object. - * - * ```js - * const https = require('node:https'); - * - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * }; - * - * const req = https.request(options, (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * }); - * - * req.on('error', (e) => { - * console.error(e); - * }); - * req.end(); - * ``` - * - * Example using options from `tls.connect()`: - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * }; - * options.agent = new https.Agent(options); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Alternatively, opt out of connection pooling by not using an `Agent`. - * - * ```js - * const options = { - * hostname: 'encrypted.google.com', - * port: 443, - * path: '/', - * method: 'GET', - * key: fs.readFileSync('test/fixtures/keys/agent2-key.pem'), - * cert: fs.readFileSync('test/fixtures/keys/agent2-cert.pem'), - * agent: false, - * }; - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example using a `URL` as `options`: - * - * ```js - * const options = new URL('https://abc:xyz@example.com'); - * - * const req = https.request(options, (res) => { - * // ... - * }); - * ``` - * - * Example pinning on certificate fingerprint, or the public key (similar to`pin-sha256`): - * - * ```js - * const tls = require('node:tls'); - * const https = require('node:https'); - * const crypto = require('node:crypto'); - * - * function sha256(s) { - * return crypto.createHash('sha256').update(s).digest('base64'); - * } - * const options = { - * hostname: 'github.com', - * port: 443, - * path: '/', - * method: 'GET', - * checkServerIdentity: function(host, cert) { - * // Make sure the certificate is issued to the host we are connected to - * const err = tls.checkServerIdentity(host, cert); - * if (err) { - * return err; - * } - * - * // Pin the public key, similar to HPKP pin-sha256 pinning - * const pubkey256 = 'pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU='; - * if (sha256(cert.pubkey) !== pubkey256) { - * const msg = 'Certificate verification error: ' + - * `The public key of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // Pin the exact certificate, rather than the pub key - * const cert256 = '25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:' + - * 'D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16'; - * if (cert.fingerprint256 !== cert256) { - * const msg = 'Certificate verification error: ' + - * `The certificate of '${cert.subject.CN}' ` + - * 'does not match our pinned fingerprint'; - * return new Error(msg); - * } - * - * // This loop is informational only. - * // Print the certificate and public key fingerprints of all certs in the - * // chain. Its common to pin the public key of the issuer on the public - * // internet, while pinning the public key of the service in sensitive - * // environments. - * do { - * console.log('Subject Common Name:', cert.subject.CN); - * console.log(' Certificate SHA256 fingerprint:', cert.fingerprint256); - * - * hash = crypto.createHash('sha256'); - * console.log(' Public key ping-sha256:', sha256(cert.pubkey)); - * - * lastprint256 = cert.fingerprint256; - * cert = cert.issuerCertificate; - * } while (cert.fingerprint256 !== lastprint256); - * - * }, - * }; - * - * options.agent = new https.Agent(options); - * const req = https.request(options, (res) => { - * console.log('All OK. Server matched our pinned cert or public key'); - * console.log('statusCode:', res.statusCode); - * // Print the HPKP values - * console.log('headers:', res.headers['public-key-pins']); - * - * res.on('data', (d) => {}); - * }); - * - * req.on('error', (e) => { - * console.error(e.message); - * }); - * req.end(); - * ``` - * - * Outputs for example: - * - * ```text - * Subject Common Name: github.com - * Certificate SHA256 fingerprint: 25:FE:39:32:D9:63:8C:8A:FC:A1:9A:29:87:D8:3E:4C:1D:98:DB:71:E4:1A:48:03:98:EA:22:6A:BD:8B:93:16 - * Public key ping-sha256: pL1+qb9HTMRZJmuC/bB/ZI9d302BYrrqiVuRyW+DGrU= - * Subject Common Name: DigiCert SHA2 Extended Validation Server CA - * Certificate SHA256 fingerprint: 40:3E:06:2A:26:53:05:91:13:28:5B:AF:80:A0:D4:AE:42:2C:84:8C:9F:78:FA:D0:1F:C9:4B:C5:B8:7F:EF:1A - * Public key ping-sha256: RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho= - * Subject Common Name: DigiCert High Assurance EV Root CA - * Certificate SHA256 fingerprint: 74:31:E5:F4:C3:C1:CE:46:90:77:4F:0B:61:E0:54:40:88:3B:A9:A0:1E:D0:0B:A6:AB:D7:80:6E:D3:B1:18:CF - * Public key ping-sha256: WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= - * All OK. Server matched our pinned cert or public key - * statusCode: 200 - * headers: max-age=0; pin-sha256="WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18="; pin-sha256="RRM1dGqnDFsCJXBTHky16vi1obOlCgFFn/yOhI/y+ho="; - * pin-sha256="k2v657xBsOVe1PQRwOsHsw3bsGT2VzIqz5K+59sNQws="; pin-sha256="K87oWBWM9UZfyddvDfoxL+8lpNyoUB2ptGtn0fv6G2Q="; pin-sha256="IQBnNBEiFuhj+8x6X8XLgh01V9Ic5/V3IRQLNFFc7v4="; - * pin-sha256="iie1VXtL7HzAMF+/PVPR9xzT80kQxdZeJ+zduCB3uj0="; pin-sha256="LvRiGEjRqfzurezaWuj8Wie2gyHMrW5Q06LspMnox7A="; includeSubDomains - * ``` - * @since v0.3.6 - * @param options Accepts all `options` from `request`, with some differences in default values: - */ - function request( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function request( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - /** - * Like `http.get()` but for HTTPS. - * - * `options` can be an object, a string, or a `URL` object. If `options` is a - * string, it is automatically parsed with `new URL()`. If it is a `URL` object, it will be automatically converted to an ordinary `options` object. - * - * ```js - * const https = require('node:https'); - * - * https.get('https://encrypted.google.com/', (res) => { - * console.log('statusCode:', res.statusCode); - * console.log('headers:', res.headers); - * - * res.on('data', (d) => { - * process.stdout.write(d); - * }); - * - * }).on('error', (e) => { - * console.error(e); - * }); - * ``` - * @since v0.3.6 - * @param options Accepts the same `options` as {@link request}, with the `method` always set to `GET`. - */ - function get( - options: RequestOptions | string | URL, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - function get( - url: string | URL, - options: RequestOptions, - callback?: (res: http.IncomingMessage) => void, - ): http.ClientRequest; - let globalAgent: Agent; -} -declare module "node:https" { - export * from "https"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/index.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/index.d.ts deleted file mode 100644 index 7c8b38c6..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/index.d.ts +++ /dev/null @@ -1,88 +0,0 @@ -/** - * License for programmatically and manually incorporated - * documentation aka. `JSDoc` from https://github.com/nodejs/node/tree/master/doc - * - * Copyright Node.js contributors. All rights reserved. - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to - * deal in the Software without restriction, including without limitation the - * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or - * sell copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS - * IN THE SOFTWARE. - */ - -// NOTE: These definitions support NodeJS and TypeScript 4.8 and earlier. - -// Reference required types from the default lib: -/// -/// -/// -/// - -// Base definitions for all NodeJS modules that are not specific to any version of TypeScript: -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// -/// - -/// diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/inspector.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/inspector.d.ts deleted file mode 100644 index 3927b816..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/inspector.d.ts +++ /dev/null @@ -1,2747 +0,0 @@ -// Type definitions for inspector - -// These definitions are auto-generated. -// Please see https://github.com/DefinitelyTyped/DefinitelyTyped/pull/19330 -// for more information. - - -/** - * The `node:inspector` module provides an API for interacting with the V8 - * inspector. - * - * It can be accessed using: - * - * ```js - * import * as inspector from 'node:inspector/promises'; - * ``` - * - * or - * - * ```js - * import * as inspector from 'node:inspector'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/inspector.js) - */ -declare module 'inspector' { - import EventEmitter = require('node:events'); - interface InspectorNotification { - method: string; - params: T; - } - namespace Schema { - /** - * Description of the protocol domain. - */ - interface Domain { - /** - * Domain name. - */ - name: string; - /** - * Domain version. - */ - version: string; - } - interface GetDomainsReturnType { - /** - * List of supported domains. - */ - domains: Domain[]; - } - } - namespace Runtime { - /** - * Unique script identifier. - */ - type ScriptId = string; - /** - * Unique object identifier. - */ - type RemoteObjectId = string; - /** - * Primitive value which cannot be JSON-stringified. - */ - type UnserializableValue = string; - /** - * Mirror object referencing original JavaScript object. - */ - interface RemoteObject { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * Object class (constructor) name. Specified for object type values only. - */ - className?: string | undefined; - /** - * Remote object value in case of primitive values or JSON values (if it was requested). - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified does not have value, but gets this property. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * Unique object identifier (for non-primitive values). - */ - objectId?: RemoteObjectId | undefined; - /** - * Preview containing abbreviated property values. Specified for object type values only. - * @experimental - */ - preview?: ObjectPreview | undefined; - /** - * @experimental - */ - customPreview?: CustomPreview | undefined; - } - /** - * @experimental - */ - interface CustomPreview { - header: string; - hasBody: boolean; - formatterObjectId: RemoteObjectId; - bindRemoteObjectFunctionId: RemoteObjectId; - configObjectId?: RemoteObjectId | undefined; - } - /** - * Object containing abbreviated remote object value. - * @experimental - */ - interface ObjectPreview { - /** - * Object type. - */ - type: string; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - /** - * String representation of the object. - */ - description?: string | undefined; - /** - * True iff some of the properties or entries of the original object did not fit. - */ - overflow: boolean; - /** - * List of the properties. - */ - properties: PropertyPreview[]; - /** - * List of the entries. Specified for map and set subtype values only. - */ - entries?: EntryPreview[] | undefined; - } - /** - * @experimental - */ - interface PropertyPreview { - /** - * Property name. - */ - name: string; - /** - * Object type. Accessor means that the property itself is an accessor property. - */ - type: string; - /** - * User-friendly property value string. - */ - value?: string | undefined; - /** - * Nested value preview. - */ - valuePreview?: ObjectPreview | undefined; - /** - * Object subtype hint. Specified for object type values only. - */ - subtype?: string | undefined; - } - /** - * @experimental - */ - interface EntryPreview { - /** - * Preview of the key. Specified for map-like collection entries. - */ - key?: ObjectPreview | undefined; - /** - * Preview of the value. - */ - value: ObjectPreview; - } - /** - * Object property descriptor. - */ - interface PropertyDescriptor { - /** - * Property name or symbol description. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - /** - * True if the value associated with the property may be changed (data descriptors only). - */ - writable?: boolean | undefined; - /** - * A function which serves as a getter for the property, or undefined if there is no getter (accessor descriptors only). - */ - get?: RemoteObject | undefined; - /** - * A function which serves as a setter for the property, or undefined if there is no setter (accessor descriptors only). - */ - set?: RemoteObject | undefined; - /** - * True if the type of this property descriptor may be changed and if the property may be deleted from the corresponding object. - */ - configurable: boolean; - /** - * True if this property shows up during enumeration of the properties on the corresponding object. - */ - enumerable: boolean; - /** - * True if the result was thrown during the evaluation. - */ - wasThrown?: boolean | undefined; - /** - * True if the property is owned for the object. - */ - isOwn?: boolean | undefined; - /** - * Property symbol object, if the property is of the symbol type. - */ - symbol?: RemoteObject | undefined; - } - /** - * Object internal property descriptor. This property isn't normally visible in JavaScript code. - */ - interface InternalPropertyDescriptor { - /** - * Conventional property name. - */ - name: string; - /** - * The value associated with the property. - */ - value?: RemoteObject | undefined; - } - /** - * Represents function call argument. Either remote object id objectId, primitive value, unserializable primitive value or neither of (for undefined) them should be specified. - */ - interface CallArgument { - /** - * Primitive value or serializable javascript object. - */ - value?: any; - /** - * Primitive value which can not be JSON-stringified. - */ - unserializableValue?: UnserializableValue | undefined; - /** - * Remote object handle. - */ - objectId?: RemoteObjectId | undefined; - } - /** - * Id of an execution context. - */ - type ExecutionContextId = number; - /** - * Description of an isolated world. - */ - interface ExecutionContextDescription { - /** - * Unique id of the execution context. It can be used to specify in which execution context script evaluation should be performed. - */ - id: ExecutionContextId; - /** - * Execution context origin. - */ - origin: string; - /** - * Human readable name describing given context. - */ - name: string; - /** - * Embedder-specific auxiliary data. - */ - auxData?: {} | undefined; - } - /** - * Detailed information about exception (or error) that was thrown during script compilation or execution. - */ - interface ExceptionDetails { - /** - * Exception id. - */ - exceptionId: number; - /** - * Exception text, which should be used together with exception object when available. - */ - text: string; - /** - * Line number of the exception location (0-based). - */ - lineNumber: number; - /** - * Column number of the exception location (0-based). - */ - columnNumber: number; - /** - * Script ID of the exception location. - */ - scriptId?: ScriptId | undefined; - /** - * URL of the exception location, to be used when the script was not reported. - */ - url?: string | undefined; - /** - * JavaScript stack trace if available. - */ - stackTrace?: StackTrace | undefined; - /** - * Exception object if available. - */ - exception?: RemoteObject | undefined; - /** - * Identifier of the context where exception happened. - */ - executionContextId?: ExecutionContextId | undefined; - } - /** - * Number of milliseconds since epoch. - */ - type Timestamp = number; - /** - * Stack entry for runtime errors and assertions. - */ - interface CallFrame { - /** - * JavaScript function name. - */ - functionName: string; - /** - * JavaScript script id. - */ - scriptId: ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * JavaScript script line number (0-based). - */ - lineNumber: number; - /** - * JavaScript script column number (0-based). - */ - columnNumber: number; - } - /** - * Call frames for assertions or error messages. - */ - interface StackTrace { - /** - * String label of this stack trace. For async traces this may be a name of the function that initiated the async call. - */ - description?: string | undefined; - /** - * JavaScript function name. - */ - callFrames: CallFrame[]; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - */ - parent?: StackTrace | undefined; - /** - * Asynchronous JavaScript stack trace that preceded this stack, if available. - * @experimental - */ - parentId?: StackTraceId | undefined; - } - /** - * Unique identifier of current debugger. - * @experimental - */ - type UniqueDebuggerId = string; - /** - * If debuggerId is set stack trace comes from another debugger and can be resolved there. This allows to track cross-debugger calls. See Runtime.StackTrace and Debugger.paused for usages. - * @experimental - */ - interface StackTraceId { - id: string; - debuggerId?: UniqueDebuggerId | undefined; - } - interface EvaluateParameterType { - /** - * Expression to evaluate. - */ - expression: string; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Specifies in which execution context to perform evaluation. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - contextId?: ExecutionContextId | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface AwaitPromiseParameterType { - /** - * Identifier of the promise. - */ - promiseObjectId: RemoteObjectId; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - } - interface CallFunctionOnParameterType { - /** - * Declaration of the function to call. - */ - functionDeclaration: string; - /** - * Identifier of the object to call function on. Either objectId or executionContextId should be specified. - */ - objectId?: RemoteObjectId | undefined; - /** - * Call arguments. All call arguments must belong to the same JavaScript world as the target object. - */ - arguments?: CallArgument[] | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should be treated as initiated by user in the UI. - */ - userGesture?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - /** - * Specifies execution context which global object will be used to call function on. Either executionContextId or objectId should be specified. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. If objectGroup is not specified and objectId is, objectGroup will be inherited from object. - */ - objectGroup?: string | undefined; - } - interface GetPropertiesParameterType { - /** - * Identifier of the object to return properties for. - */ - objectId: RemoteObjectId; - /** - * If true, returns properties belonging only to the element itself, not to its prototype chain. - */ - ownProperties?: boolean | undefined; - /** - * If true, returns accessor properties (with getter/setter) only; internal properties are not returned either. - * @experimental - */ - accessorPropertiesOnly?: boolean | undefined; - /** - * Whether preview should be generated for the results. - * @experimental - */ - generatePreview?: boolean | undefined; - } - interface ReleaseObjectParameterType { - /** - * Identifier of the object to release. - */ - objectId: RemoteObjectId; - } - interface ReleaseObjectGroupParameterType { - /** - * Symbolic object group name. - */ - objectGroup: string; - } - interface SetCustomObjectFormatterEnabledParameterType { - enabled: boolean; - } - interface CompileScriptParameterType { - /** - * Expression to compile. - */ - expression: string; - /** - * Source url to be set for the script. - */ - sourceURL: string; - /** - * Specifies whether the compiled script should be persisted. - */ - persistScript: boolean; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface RunScriptParameterType { - /** - * Id of the script to run. - */ - scriptId: ScriptId; - /** - * Specifies in which execution context to perform script run. If the parameter is omitted the evaluation will be performed in the context of the inspected page. - */ - executionContextId?: ExecutionContextId | undefined; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Determines whether Command Line API should be available during the evaluation. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object which should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - */ - generatePreview?: boolean | undefined; - /** - * Whether execution should await for resulting value and return once awaited promise is resolved. - */ - awaitPromise?: boolean | undefined; - } - interface QueryObjectsParameterType { - /** - * Identifier of the prototype to return objects for. - */ - prototypeObjectId: RemoteObjectId; - } - interface GlobalLexicalScopeNamesParameterType { - /** - * Specifies in which execution context to lookup global scope variables. - */ - executionContextId?: ExecutionContextId | undefined; - } - interface EvaluateReturnType { - /** - * Evaluation result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface AwaitPromiseReturnType { - /** - * Promise result. Will contain rejected value if promise was rejected. - */ - result: RemoteObject; - /** - * Exception details if stack strace is available. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CallFunctionOnReturnType { - /** - * Call result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface GetPropertiesReturnType { - /** - * Object properties. - */ - result: PropertyDescriptor[]; - /** - * Internal object properties (only of the element itself). - */ - internalProperties?: InternalPropertyDescriptor[] | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface CompileScriptReturnType { - /** - * Id of the script. - */ - scriptId?: ScriptId | undefined; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface RunScriptReturnType { - /** - * Run result. - */ - result: RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: ExceptionDetails | undefined; - } - interface QueryObjectsReturnType { - /** - * Array with objects. - */ - objects: RemoteObject; - } - interface GlobalLexicalScopeNamesReturnType { - names: string[]; - } - interface ExecutionContextCreatedEventDataType { - /** - * A newly created execution context. - */ - context: ExecutionContextDescription; - } - interface ExecutionContextDestroyedEventDataType { - /** - * Id of the destroyed context - */ - executionContextId: ExecutionContextId; - } - interface ExceptionThrownEventDataType { - /** - * Timestamp of the exception. - */ - timestamp: Timestamp; - exceptionDetails: ExceptionDetails; - } - interface ExceptionRevokedEventDataType { - /** - * Reason describing why exception was revoked. - */ - reason: string; - /** - * The id of revoked exception, as reported in exceptionThrown. - */ - exceptionId: number; - } - interface ConsoleAPICalledEventDataType { - /** - * Type of the call. - */ - type: string; - /** - * Call arguments. - */ - args: RemoteObject[]; - /** - * Identifier of the context where the call was made. - */ - executionContextId: ExecutionContextId; - /** - * Call timestamp. - */ - timestamp: Timestamp; - /** - * Stack trace captured when the call was made. - */ - stackTrace?: StackTrace | undefined; - /** - * Console context descriptor for calls on non-default console context (not console.*): 'anonymous#unique-logger-id' for call on unnamed context, 'name#unique-logger-id' for call on named context. - * @experimental - */ - context?: string | undefined; - } - interface InspectRequestedEventDataType { - object: RemoteObject; - hints: {}; - } - } - namespace Debugger { - /** - * Breakpoint identifier. - */ - type BreakpointId = string; - /** - * Call frame identifier. - */ - type CallFrameId = string; - /** - * Location in the source code. - */ - interface Location { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - } - /** - * Location in the source code. - * @experimental - */ - interface ScriptPosition { - lineNumber: number; - columnNumber: number; - } - /** - * JavaScript call frame. Array of call frames form the call stack. - */ - interface CallFrame { - /** - * Call frame identifier. This identifier is only valid while the virtual machine is paused. - */ - callFrameId: CallFrameId; - /** - * Name of the JavaScript function called on this call frame. - */ - functionName: string; - /** - * Location in the source code. - */ - functionLocation?: Location | undefined; - /** - * Location in the source code. - */ - location: Location; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Scope chain for this call frame. - */ - scopeChain: Scope[]; - /** - * this object for this call frame. - */ - this: Runtime.RemoteObject; - /** - * The value being returned, if the function is at return point. - */ - returnValue?: Runtime.RemoteObject | undefined; - } - /** - * Scope description. - */ - interface Scope { - /** - * Scope type. - */ - type: string; - /** - * Object representing the scope. For global and with scopes it represents the actual object; for the rest of the scopes, it is artificial transient object enumerating scope variables as its properties. - */ - object: Runtime.RemoteObject; - name?: string | undefined; - /** - * Location in the source code where scope starts - */ - startLocation?: Location | undefined; - /** - * Location in the source code where scope ends - */ - endLocation?: Location | undefined; - } - /** - * Search match for resource. - */ - interface SearchMatch { - /** - * Line number in resource content. - */ - lineNumber: number; - /** - * Line with match content. - */ - lineContent: string; - } - interface BreakLocation { - /** - * Script identifier as reported in the Debugger.scriptParsed. - */ - scriptId: Runtime.ScriptId; - /** - * Line number in the script (0-based). - */ - lineNumber: number; - /** - * Column number in the script (0-based). - */ - columnNumber?: number | undefined; - type?: string | undefined; - } - interface SetBreakpointsActiveParameterType { - /** - * New value for breakpoints active state. - */ - active: boolean; - } - interface SetSkipAllPausesParameterType { - /** - * New value for skip pauses state. - */ - skip: boolean; - } - interface SetBreakpointByUrlParameterType { - /** - * Line number to set breakpoint at. - */ - lineNumber: number; - /** - * URL of the resources to set breakpoint on. - */ - url?: string | undefined; - /** - * Regex pattern for the URLs of the resources to set breakpoints on. Either url or urlRegex must be specified. - */ - urlRegex?: string | undefined; - /** - * Script hash of the resources to set breakpoint on. - */ - scriptHash?: string | undefined; - /** - * Offset in the line to set breakpoint at. - */ - columnNumber?: number | undefined; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface SetBreakpointParameterType { - /** - * Location to set breakpoint in. - */ - location: Location; - /** - * Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true. - */ - condition?: string | undefined; - } - interface RemoveBreakpointParameterType { - breakpointId: BreakpointId; - } - interface GetPossibleBreakpointsParameterType { - /** - * Start of range to search possible breakpoint locations in. - */ - start: Location; - /** - * End of range to search possible breakpoint locations in (excluding). When not specified, end of scripts is used as end of range. - */ - end?: Location | undefined; - /** - * Only consider locations which are in the same (non-nested) function as start. - */ - restrictToFunction?: boolean | undefined; - } - interface ContinueToLocationParameterType { - /** - * Location to continue to. - */ - location: Location; - targetCallFrames?: string | undefined; - } - interface PauseOnAsyncCallParameterType { - /** - * Debugger will pause when async call with given stack trace is started. - */ - parentStackTraceId: Runtime.StackTraceId; - } - interface StepIntoParameterType { - /** - * Debugger will issue additional Debugger.paused notification if any async task is scheduled before next pause. - * @experimental - */ - breakOnAsyncCall?: boolean | undefined; - } - interface GetStackTraceParameterType { - stackTraceId: Runtime.StackTraceId; - } - interface SearchInContentParameterType { - /** - * Id of the script to search in. - */ - scriptId: Runtime.ScriptId; - /** - * String to search for. - */ - query: string; - /** - * If true, search is case sensitive. - */ - caseSensitive?: boolean | undefined; - /** - * If true, treats string parameter as regex. - */ - isRegex?: boolean | undefined; - } - interface SetScriptSourceParameterType { - /** - * Id of the script to edit. - */ - scriptId: Runtime.ScriptId; - /** - * New content of the script. - */ - scriptSource: string; - /** - * If true the change will not actually be applied. Dry run may be used to get result description without actually modifying the code. - */ - dryRun?: boolean | undefined; - } - interface RestartFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - } - interface GetScriptSourceParameterType { - /** - * Id of the script to get source for. - */ - scriptId: Runtime.ScriptId; - } - interface SetPauseOnExceptionsParameterType { - /** - * Pause on exceptions mode. - */ - state: string; - } - interface EvaluateOnCallFrameParameterType { - /** - * Call frame identifier to evaluate on. - */ - callFrameId: CallFrameId; - /** - * Expression to evaluate. - */ - expression: string; - /** - * String object group name to put result into (allows rapid releasing resulting object handles using releaseObjectGroup). - */ - objectGroup?: string | undefined; - /** - * Specifies whether command line API should be available to the evaluated expression, defaults to false. - */ - includeCommandLineAPI?: boolean | undefined; - /** - * In silent mode exceptions thrown during evaluation are not reported and do not pause execution. Overrides setPauseOnException state. - */ - silent?: boolean | undefined; - /** - * Whether the result is expected to be a JSON object that should be sent by value. - */ - returnByValue?: boolean | undefined; - /** - * Whether preview should be generated for the result. - * @experimental - */ - generatePreview?: boolean | undefined; - /** - * Whether to throw an exception if side effect cannot be ruled out during evaluation. - */ - throwOnSideEffect?: boolean | undefined; - } - interface SetVariableValueParameterType { - /** - * 0-based number of scope as was listed in scope chain. Only 'local', 'closure' and 'catch' scope types are allowed. Other scopes could be manipulated manually. - */ - scopeNumber: number; - /** - * Variable name. - */ - variableName: string; - /** - * New variable value. - */ - newValue: Runtime.CallArgument; - /** - * Id of callframe that holds variable. - */ - callFrameId: CallFrameId; - } - interface SetReturnValueParameterType { - /** - * New return value. - */ - newValue: Runtime.CallArgument; - } - interface SetAsyncCallStackDepthParameterType { - /** - * Maximum depth of async call stacks. Setting to 0 will effectively disable collecting async call stacks (default). - */ - maxDepth: number; - } - interface SetBlackboxPatternsParameterType { - /** - * Array of regexps that will be used to check script url for blackbox state. - */ - patterns: string[]; - } - interface SetBlackboxedRangesParameterType { - /** - * Id of the script. - */ - scriptId: Runtime.ScriptId; - positions: ScriptPosition[]; - } - interface EnableReturnType { - /** - * Unique identifier of the debugger. - * @experimental - */ - debuggerId: Runtime.UniqueDebuggerId; - } - interface SetBreakpointByUrlReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * List of the locations this breakpoint resolved into upon addition. - */ - locations: Location[]; - } - interface SetBreakpointReturnType { - /** - * Id of the created breakpoint for further reference. - */ - breakpointId: BreakpointId; - /** - * Location this breakpoint resolved into. - */ - actualLocation: Location; - } - interface GetPossibleBreakpointsReturnType { - /** - * List of the possible breakpoint locations. - */ - locations: BreakLocation[]; - } - interface GetStackTraceReturnType { - stackTrace: Runtime.StackTrace; - } - interface SearchInContentReturnType { - /** - * List of search matches. - */ - result: SearchMatch[]; - } - interface SetScriptSourceReturnType { - /** - * New stack trace in case editing has happened while VM was stopped. - */ - callFrames?: CallFrame[] | undefined; - /** - * Whether current call stack was modified after applying the changes. - */ - stackChanged?: boolean | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Exception details if any. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface RestartFrameReturnType { - /** - * New stack trace. - */ - callFrames: CallFrame[]; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - } - interface GetScriptSourceReturnType { - /** - * Script source. - */ - scriptSource: string; - } - interface EvaluateOnCallFrameReturnType { - /** - * Object wrapper for the evaluation result. - */ - result: Runtime.RemoteObject; - /** - * Exception details. - */ - exceptionDetails?: Runtime.ExceptionDetails | undefined; - } - interface ScriptParsedEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {} | undefined; - /** - * True, if this script is generated as a result of the live edit operation. - * @experimental - */ - isLiveEdit?: boolean | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface ScriptFailedToParseEventDataType { - /** - * Identifier of the script parsed. - */ - scriptId: Runtime.ScriptId; - /** - * URL or name of the script parsed (if any). - */ - url: string; - /** - * Line offset of the script within the resource with given URL (for script tags). - */ - startLine: number; - /** - * Column offset of the script within the resource with given URL. - */ - startColumn: number; - /** - * Last line of the script. - */ - endLine: number; - /** - * Length of the last line of the script. - */ - endColumn: number; - /** - * Specifies script creation context. - */ - executionContextId: Runtime.ExecutionContextId; - /** - * Content hash of the script. - */ - hash: string; - /** - * Embedder-specific auxiliary data. - */ - executionContextAuxData?: {} | undefined; - /** - * URL of source map associated with script (if any). - */ - sourceMapURL?: string | undefined; - /** - * True, if this script has sourceURL. - */ - hasSourceURL?: boolean | undefined; - /** - * True, if this script is ES6 module. - */ - isModule?: boolean | undefined; - /** - * This script length. - */ - length?: number | undefined; - /** - * JavaScript top stack frame of where the script parsed event was triggered if available. - * @experimental - */ - stackTrace?: Runtime.StackTrace | undefined; - } - interface BreakpointResolvedEventDataType { - /** - * Breakpoint unique identifier. - */ - breakpointId: BreakpointId; - /** - * Actual breakpoint location. - */ - location: Location; - } - interface PausedEventDataType { - /** - * Call stack the virtual machine stopped on. - */ - callFrames: CallFrame[]; - /** - * Pause reason. - */ - reason: string; - /** - * Object containing break-specific auxiliary properties. - */ - data?: {} | undefined; - /** - * Hit breakpoints IDs - */ - hitBreakpoints?: string[] | undefined; - /** - * Async stack trace, if any. - */ - asyncStackTrace?: Runtime.StackTrace | undefined; - /** - * Async stack trace, if any. - * @experimental - */ - asyncStackTraceId?: Runtime.StackTraceId | undefined; - /** - * Just scheduled async call will have this stack trace as parent stack during async execution. This field is available only after Debugger.stepInto call with breakOnAsynCall flag. - * @experimental - */ - asyncCallStackTraceId?: Runtime.StackTraceId | undefined; - } - } - namespace Console { - /** - * Console message. - */ - interface ConsoleMessage { - /** - * Message source. - */ - source: string; - /** - * Message severity. - */ - level: string; - /** - * Message text. - */ - text: string; - /** - * URL of the message origin. - */ - url?: string | undefined; - /** - * Line number in the resource that generated this message (1-based). - */ - line?: number | undefined; - /** - * Column number in the resource that generated this message (1-based). - */ - column?: number | undefined; - } - interface MessageAddedEventDataType { - /** - * Console message that has been added. - */ - message: ConsoleMessage; - } - } - namespace Profiler { - /** - * Profile node. Holds callsite information, execution statistics and child nodes. - */ - interface ProfileNode { - /** - * Unique id of the node. - */ - id: number; - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Number of samples where this node was on top of the call stack. - */ - hitCount?: number | undefined; - /** - * Child node ids. - */ - children?: number[] | undefined; - /** - * The reason of being not optimized. The function may be deoptimized or marked as don't optimize. - */ - deoptReason?: string | undefined; - /** - * An array of source position ticks. - */ - positionTicks?: PositionTickInfo[] | undefined; - } - /** - * Profile. - */ - interface Profile { - /** - * The list of profile nodes. First item is the root node. - */ - nodes: ProfileNode[]; - /** - * Profiling start timestamp in microseconds. - */ - startTime: number; - /** - * Profiling end timestamp in microseconds. - */ - endTime: number; - /** - * Ids of samples top nodes. - */ - samples?: number[] | undefined; - /** - * Time intervals between adjacent samples in microseconds. The first delta is relative to the profile startTime. - */ - timeDeltas?: number[] | undefined; - } - /** - * Specifies a number of samples attributed to a certain source position. - */ - interface PositionTickInfo { - /** - * Source line number (1-based). - */ - line: number; - /** - * Number of samples attributed to the source line. - */ - ticks: number; - } - /** - * Coverage data for a source range. - */ - interface CoverageRange { - /** - * JavaScript script source offset for the range start. - */ - startOffset: number; - /** - * JavaScript script source offset for the range end. - */ - endOffset: number; - /** - * Collected execution count of the source range. - */ - count: number; - } - /** - * Coverage data for a JavaScript function. - */ - interface FunctionCoverage { - /** - * JavaScript function name. - */ - functionName: string; - /** - * Source ranges inside the function with coverage data. - */ - ranges: CoverageRange[]; - /** - * Whether coverage data for this function has block granularity. - */ - isBlockCoverage: boolean; - } - /** - * Coverage data for a JavaScript script. - */ - interface ScriptCoverage { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Functions contained in the script that has coverage data. - */ - functions: FunctionCoverage[]; - } - /** - * Describes a type collected during runtime. - * @experimental - */ - interface TypeObject { - /** - * Name of a type collected with type profiling. - */ - name: string; - } - /** - * Source offset and types for a parameter or return value. - * @experimental - */ - interface TypeProfileEntry { - /** - * Source offset of the parameter or end of function for return values. - */ - offset: number; - /** - * The types for this parameter or return value. - */ - types: TypeObject[]; - } - /** - * Type profile data collected during runtime for a JavaScript script. - * @experimental - */ - interface ScriptTypeProfile { - /** - * JavaScript script id. - */ - scriptId: Runtime.ScriptId; - /** - * JavaScript script name or url. - */ - url: string; - /** - * Type profile entries for parameters and return values of the functions in the script. - */ - entries: TypeProfileEntry[]; - } - interface SetSamplingIntervalParameterType { - /** - * New sampling interval in microseconds. - */ - interval: number; - } - interface StartPreciseCoverageParameterType { - /** - * Collect accurate call counts beyond simple 'covered' or 'not covered'. - */ - callCount?: boolean | undefined; - /** - * Collect block-based coverage. - */ - detailed?: boolean | undefined; - } - interface StopReturnType { - /** - * Recorded profile. - */ - profile: Profile; - } - interface TakePreciseCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface GetBestEffortCoverageReturnType { - /** - * Coverage data for the current isolate. - */ - result: ScriptCoverage[]; - } - interface TakeTypeProfileReturnType { - /** - * Type profile for all scripts since startTypeProfile() was turned on. - */ - result: ScriptTypeProfile[]; - } - interface ConsoleProfileStartedEventDataType { - id: string; - /** - * Location of console.profile(). - */ - location: Debugger.Location; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - interface ConsoleProfileFinishedEventDataType { - id: string; - /** - * Location of console.profileEnd(). - */ - location: Debugger.Location; - profile: Profile; - /** - * Profile title passed as an argument to console.profile(). - */ - title?: string | undefined; - } - } - namespace HeapProfiler { - /** - * Heap snapshot object id. - */ - type HeapSnapshotObjectId = string; - /** - * Sampling Heap Profile node. Holds callsite information, allocation statistics and child nodes. - */ - interface SamplingHeapProfileNode { - /** - * Function location. - */ - callFrame: Runtime.CallFrame; - /** - * Allocations size in bytes for the node excluding children. - */ - selfSize: number; - /** - * Child nodes. - */ - children: SamplingHeapProfileNode[]; - } - /** - * Profile. - */ - interface SamplingHeapProfile { - head: SamplingHeapProfileNode; - } - interface StartTrackingHeapObjectsParameterType { - trackAllocations?: boolean | undefined; - } - interface StopTrackingHeapObjectsParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken when the tracking is stopped. - */ - reportProgress?: boolean | undefined; - } - interface TakeHeapSnapshotParameterType { - /** - * If true 'reportHeapSnapshotProgress' events will be generated while snapshot is being taken. - */ - reportProgress?: boolean | undefined; - } - interface GetObjectByHeapObjectIdParameterType { - objectId: HeapSnapshotObjectId; - /** - * Symbolic group name that can be used to release multiple objects. - */ - objectGroup?: string | undefined; - } - interface AddInspectedHeapObjectParameterType { - /** - * Heap snapshot object id to be accessible by means of $x command line API. - */ - heapObjectId: HeapSnapshotObjectId; - } - interface GetHeapObjectIdParameterType { - /** - * Identifier of the object to get heap object id for. - */ - objectId: Runtime.RemoteObjectId; - } - interface StartSamplingParameterType { - /** - * Average sample interval in bytes. Poisson distribution is used for the intervals. The default value is 32768 bytes. - */ - samplingInterval?: number | undefined; - } - interface GetObjectByHeapObjectIdReturnType { - /** - * Evaluation result. - */ - result: Runtime.RemoteObject; - } - interface GetHeapObjectIdReturnType { - /** - * Id of the heap snapshot object corresponding to the passed remote object id. - */ - heapSnapshotObjectId: HeapSnapshotObjectId; - } - interface StopSamplingReturnType { - /** - * Recorded sampling heap profile. - */ - profile: SamplingHeapProfile; - } - interface GetSamplingProfileReturnType { - /** - * Return the sampling profile being collected. - */ - profile: SamplingHeapProfile; - } - interface AddHeapSnapshotChunkEventDataType { - chunk: string; - } - interface ReportHeapSnapshotProgressEventDataType { - done: number; - total: number; - finished?: boolean | undefined; - } - interface LastSeenObjectIdEventDataType { - lastSeenObjectId: number; - timestamp: number; - } - interface HeapStatsUpdateEventDataType { - /** - * An array of triplets. Each triplet describes a fragment. The first integer is the fragment index, the second integer is a total count of objects for the fragment, the third integer is a total size of the objects for the fragment. - */ - statsUpdate: number[]; - } - } - namespace NodeTracing { - interface TraceConfig { - /** - * Controls how the trace buffer stores data. - */ - recordMode?: string | undefined; - /** - * Included category filters. - */ - includedCategories: string[]; - } - interface StartParameterType { - traceConfig: TraceConfig; - } - interface GetCategoriesReturnType { - /** - * A list of supported tracing categories. - */ - categories: string[]; - } - interface DataCollectedEventDataType { - value: Array<{}>; - } - } - namespace NodeWorker { - type WorkerID = string; - /** - * Unique identifier of attached debugging session. - */ - type SessionID = string; - interface WorkerInfo { - workerId: WorkerID; - type: string; - title: string; - url: string; - } - interface SendMessageToWorkerParameterType { - message: string; - /** - * Identifier of the session. - */ - sessionId: SessionID; - } - interface EnableParameterType { - /** - * Whether to new workers should be paused until the frontend sends `Runtime.runIfWaitingForDebugger` - * message to run them. - */ - waitForDebuggerOnStart: boolean; - } - interface DetachParameterType { - sessionId: SessionID; - } - interface AttachedToWorkerEventDataType { - /** - * Identifier assigned to the session used to send/receive messages. - */ - sessionId: SessionID; - workerInfo: WorkerInfo; - waitingForDebugger: boolean; - } - interface DetachedFromWorkerEventDataType { - /** - * Detached session identifier. - */ - sessionId: SessionID; - } - interface ReceivedMessageFromWorkerEventDataType { - /** - * Identifier of a session which sends a message. - */ - sessionId: SessionID; - message: string; - } - } - namespace NodeRuntime { - interface NotifyWhenWaitingForDisconnectParameterType { - enabled: boolean; - } - } - /** - * The `inspector.Session` is used for dispatching messages to the V8 inspector - * back-end and receiving message responses and notifications. - */ - class Session extends EventEmitter { - /** - * Create a new instance of the inspector.Session class. - * The inspector session needs to be connected through session.connect() before the messages can be dispatched to the inspector backend. - */ - constructor(); - /** - * Connects a session to the inspector back-end. - * @since v8.0.0 - */ - connect(): void; - /** - * Immediately close the session. All pending message callbacks will be called - * with an error. `session.connect()` will need to be called to be able to send - * messages again. Reconnected session will lose all inspector state, such as - * enabled agents or configured breakpoints. - * @since v8.0.0 - */ - disconnect(): void; - /** - * Posts a message to the inspector back-end. `callback` will be notified when - * a response is received. `callback` is a function that accepts two optional - * arguments: error and message-specific result. - * - * ```js - * session.post('Runtime.evaluate', { expression: '2 + 2' }, - * (error, { result }) => console.log(result)); - * // Output: { type: 'number', value: 4, description: '4' } - * ``` - * - * The latest version of the V8 inspector protocol is published on the [Chrome DevTools Protocol Viewer](https://chromedevtools.github.io/devtools-protocol/v8/). - * - * Node.js inspector supports all the Chrome DevTools Protocol domains declared - * by V8\. Chrome DevTools Protocol domain provides an interface for interacting - * with one of the runtime agents used to inspect the application state and listen - * to the run-time events. - * - * ## Example usage - * - * Apart from the debugger, various V8 Profilers are available through the DevTools - * protocol. - * @since v8.0.0 - */ - post(method: string, params?: {}, callback?: (err: Error | null, params?: {}) => void): void; - post(method: string, callback?: (err: Error | null, params?: {}) => void): void; - /** - * Returns supported domains. - */ - post(method: 'Schema.getDomains', callback?: (err: Error | null, params: Schema.GetDomainsReturnType) => void): void; - /** - * Evaluates expression on global object. - */ - post(method: 'Runtime.evaluate', params?: Runtime.EvaluateParameterType, callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - post(method: 'Runtime.evaluate', callback?: (err: Error | null, params: Runtime.EvaluateReturnType) => void): void; - /** - * Add handler to promise with given promise object id. - */ - post(method: 'Runtime.awaitPromise', params?: Runtime.AwaitPromiseParameterType, callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - post(method: 'Runtime.awaitPromise', callback?: (err: Error | null, params: Runtime.AwaitPromiseReturnType) => void): void; - /** - * Calls function with given declaration on the given object. Object group of the result is inherited from the target object. - */ - post(method: 'Runtime.callFunctionOn', params?: Runtime.CallFunctionOnParameterType, callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - post(method: 'Runtime.callFunctionOn', callback?: (err: Error | null, params: Runtime.CallFunctionOnReturnType) => void): void; - /** - * Returns properties of a given object. Object group of the result is inherited from the target object. - */ - post(method: 'Runtime.getProperties', params?: Runtime.GetPropertiesParameterType, callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - post(method: 'Runtime.getProperties', callback?: (err: Error | null, params: Runtime.GetPropertiesReturnType) => void): void; - /** - * Releases remote object with given id. - */ - post(method: 'Runtime.releaseObject', params?: Runtime.ReleaseObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.releaseObject', callback?: (err: Error | null) => void): void; - /** - * Releases all remote objects that belong to a given group. - */ - post(method: 'Runtime.releaseObjectGroup', params?: Runtime.ReleaseObjectGroupParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.releaseObjectGroup', callback?: (err: Error | null) => void): void; - /** - * Tells inspected instance to run if it was waiting for debugger to attach. - */ - post(method: 'Runtime.runIfWaitingForDebugger', callback?: (err: Error | null) => void): void; - /** - * Enables reporting of execution contexts creation by means of executionContextCreated event. When the reporting gets enabled the event will be sent immediately for each existing execution context. - */ - post(method: 'Runtime.enable', callback?: (err: Error | null) => void): void; - /** - * Disables reporting of execution contexts creation. - */ - post(method: 'Runtime.disable', callback?: (err: Error | null) => void): void; - /** - * Discards collected exceptions and console API calls. - */ - post(method: 'Runtime.discardConsoleEntries', callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: 'Runtime.setCustomObjectFormatterEnabled', params?: Runtime.SetCustomObjectFormatterEnabledParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Runtime.setCustomObjectFormatterEnabled', callback?: (err: Error | null) => void): void; - /** - * Compiles expression. - */ - post(method: 'Runtime.compileScript', params?: Runtime.CompileScriptParameterType, callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - post(method: 'Runtime.compileScript', callback?: (err: Error | null, params: Runtime.CompileScriptReturnType) => void): void; - /** - * Runs script with given id in a given context. - */ - post(method: 'Runtime.runScript', params?: Runtime.RunScriptParameterType, callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: 'Runtime.runScript', callback?: (err: Error | null, params: Runtime.RunScriptReturnType) => void): void; - post(method: 'Runtime.queryObjects', params?: Runtime.QueryObjectsParameterType, callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - post(method: 'Runtime.queryObjects', callback?: (err: Error | null, params: Runtime.QueryObjectsReturnType) => void): void; - /** - * Returns all let, const and class variables from global scope. - */ - post( - method: 'Runtime.globalLexicalScopeNames', - params?: Runtime.GlobalLexicalScopeNamesParameterType, - callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void - ): void; - post(method: 'Runtime.globalLexicalScopeNames', callback?: (err: Error | null, params: Runtime.GlobalLexicalScopeNamesReturnType) => void): void; - /** - * Enables debugger for the given page. Clients should not assume that the debugging has been enabled until the result for this command is received. - */ - post(method: 'Debugger.enable', callback?: (err: Error | null, params: Debugger.EnableReturnType) => void): void; - /** - * Disables debugger for given page. - */ - post(method: 'Debugger.disable', callback?: (err: Error | null) => void): void; - /** - * Activates / deactivates all breakpoints on the page. - */ - post(method: 'Debugger.setBreakpointsActive', params?: Debugger.SetBreakpointsActiveParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBreakpointsActive', callback?: (err: Error | null) => void): void; - /** - * Makes page not interrupt on any pauses (breakpoint, exception, dom exception etc). - */ - post(method: 'Debugger.setSkipAllPauses', params?: Debugger.SetSkipAllPausesParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setSkipAllPauses', callback?: (err: Error | null) => void): void; - /** - * Sets JavaScript breakpoint at given location specified either by URL or URL regex. Once this command is issued, all existing parsed scripts will have breakpoints resolved and returned in locations property. Further matching script parsing will result in subsequent breakpointResolved events issued. This logical breakpoint will survive page reloads. - */ - post(method: 'Debugger.setBreakpointByUrl', params?: Debugger.SetBreakpointByUrlParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - post(method: 'Debugger.setBreakpointByUrl', callback?: (err: Error | null, params: Debugger.SetBreakpointByUrlReturnType) => void): void; - /** - * Sets JavaScript breakpoint at a given location. - */ - post(method: 'Debugger.setBreakpoint', params?: Debugger.SetBreakpointParameterType, callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - post(method: 'Debugger.setBreakpoint', callback?: (err: Error | null, params: Debugger.SetBreakpointReturnType) => void): void; - /** - * Removes JavaScript breakpoint. - */ - post(method: 'Debugger.removeBreakpoint', params?: Debugger.RemoveBreakpointParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.removeBreakpoint', callback?: (err: Error | null) => void): void; - /** - * Returns possible locations for breakpoint. scriptId in start and end range locations should be the same. - */ - post( - method: 'Debugger.getPossibleBreakpoints', - params?: Debugger.GetPossibleBreakpointsParameterType, - callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void - ): void; - post(method: 'Debugger.getPossibleBreakpoints', callback?: (err: Error | null, params: Debugger.GetPossibleBreakpointsReturnType) => void): void; - /** - * Continues execution until specific location is reached. - */ - post(method: 'Debugger.continueToLocation', params?: Debugger.ContinueToLocationParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.continueToLocation', callback?: (err: Error | null) => void): void; - /** - * @experimental - */ - post(method: 'Debugger.pauseOnAsyncCall', params?: Debugger.PauseOnAsyncCallParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.pauseOnAsyncCall', callback?: (err: Error | null) => void): void; - /** - * Steps over the statement. - */ - post(method: 'Debugger.stepOver', callback?: (err: Error | null) => void): void; - /** - * Steps into the function call. - */ - post(method: 'Debugger.stepInto', params?: Debugger.StepIntoParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.stepInto', callback?: (err: Error | null) => void): void; - /** - * Steps out of the function call. - */ - post(method: 'Debugger.stepOut', callback?: (err: Error | null) => void): void; - /** - * Stops on the next JavaScript statement. - */ - post(method: 'Debugger.pause', callback?: (err: Error | null) => void): void; - /** - * This method is deprecated - use Debugger.stepInto with breakOnAsyncCall and Debugger.pauseOnAsyncTask instead. Steps into next scheduled async task if any is scheduled before next pause. Returns success when async task is actually scheduled, returns error if no task were scheduled or another scheduleStepIntoAsync was called. - * @experimental - */ - post(method: 'Debugger.scheduleStepIntoAsync', callback?: (err: Error | null) => void): void; - /** - * Resumes JavaScript execution. - */ - post(method: 'Debugger.resume', callback?: (err: Error | null) => void): void; - /** - * Returns stack trace with given stackTraceId. - * @experimental - */ - post(method: 'Debugger.getStackTrace', params?: Debugger.GetStackTraceParameterType, callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - post(method: 'Debugger.getStackTrace', callback?: (err: Error | null, params: Debugger.GetStackTraceReturnType) => void): void; - /** - * Searches for given string in script content. - */ - post(method: 'Debugger.searchInContent', params?: Debugger.SearchInContentParameterType, callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - post(method: 'Debugger.searchInContent', callback?: (err: Error | null, params: Debugger.SearchInContentReturnType) => void): void; - /** - * Edits JavaScript source live. - */ - post(method: 'Debugger.setScriptSource', params?: Debugger.SetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - post(method: 'Debugger.setScriptSource', callback?: (err: Error | null, params: Debugger.SetScriptSourceReturnType) => void): void; - /** - * Restarts particular call frame from the beginning. - */ - post(method: 'Debugger.restartFrame', params?: Debugger.RestartFrameParameterType, callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - post(method: 'Debugger.restartFrame', callback?: (err: Error | null, params: Debugger.RestartFrameReturnType) => void): void; - /** - * Returns source for the script with given id. - */ - post(method: 'Debugger.getScriptSource', params?: Debugger.GetScriptSourceParameterType, callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - post(method: 'Debugger.getScriptSource', callback?: (err: Error | null, params: Debugger.GetScriptSourceReturnType) => void): void; - /** - * Defines pause on exceptions state. Can be set to stop on all exceptions, uncaught exceptions or no exceptions. Initial pause on exceptions state is none. - */ - post(method: 'Debugger.setPauseOnExceptions', params?: Debugger.SetPauseOnExceptionsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setPauseOnExceptions', callback?: (err: Error | null) => void): void; - /** - * Evaluates expression on a given call frame. - */ - post(method: 'Debugger.evaluateOnCallFrame', params?: Debugger.EvaluateOnCallFrameParameterType, callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - post(method: 'Debugger.evaluateOnCallFrame', callback?: (err: Error | null, params: Debugger.EvaluateOnCallFrameReturnType) => void): void; - /** - * Changes value of variable in a callframe. Object-based scopes are not supported and must be mutated manually. - */ - post(method: 'Debugger.setVariableValue', params?: Debugger.SetVariableValueParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setVariableValue', callback?: (err: Error | null) => void): void; - /** - * Changes return value in top frame. Available only at return break position. - * @experimental - */ - post(method: 'Debugger.setReturnValue', params?: Debugger.SetReturnValueParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setReturnValue', callback?: (err: Error | null) => void): void; - /** - * Enables or disables async call stacks tracking. - */ - post(method: 'Debugger.setAsyncCallStackDepth', params?: Debugger.SetAsyncCallStackDepthParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setAsyncCallStackDepth', callback?: (err: Error | null) => void): void; - /** - * Replace previous blackbox patterns with passed ones. Forces backend to skip stepping/pausing in scripts with url matching one of the patterns. VM will try to leave blackboxed script by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. - * @experimental - */ - post(method: 'Debugger.setBlackboxPatterns', params?: Debugger.SetBlackboxPatternsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBlackboxPatterns', callback?: (err: Error | null) => void): void; - /** - * Makes backend skip steps in the script in blackboxed ranges. VM will try leave blacklisted scripts by performing 'step in' several times, finally resorting to 'step out' if unsuccessful. Positions array contains positions where blackbox state is changed. First interval isn't blackboxed. Array should be sorted. - * @experimental - */ - post(method: 'Debugger.setBlackboxedRanges', params?: Debugger.SetBlackboxedRangesParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Debugger.setBlackboxedRanges', callback?: (err: Error | null) => void): void; - /** - * Enables console domain, sends the messages collected so far to the client by means of the messageAdded notification. - */ - post(method: 'Console.enable', callback?: (err: Error | null) => void): void; - /** - * Disables console domain, prevents further console messages from being reported to the client. - */ - post(method: 'Console.disable', callback?: (err: Error | null) => void): void; - /** - * Does nothing. - */ - post(method: 'Console.clearMessages', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.enable', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.disable', callback?: (err: Error | null) => void): void; - /** - * Changes CPU profiler sampling interval. Must be called before CPU profiles recording started. - */ - post(method: 'Profiler.setSamplingInterval', params?: Profiler.SetSamplingIntervalParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Profiler.setSamplingInterval', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.start', callback?: (err: Error | null) => void): void; - post(method: 'Profiler.stop', callback?: (err: Error | null, params: Profiler.StopReturnType) => void): void; - /** - * Enable precise code coverage. Coverage data for JavaScript executed before enabling precise code coverage may be incomplete. Enabling prevents running optimized code and resets execution counters. - */ - post(method: 'Profiler.startPreciseCoverage', params?: Profiler.StartPreciseCoverageParameterType, callback?: (err: Error | null) => void): void; - post(method: 'Profiler.startPreciseCoverage', callback?: (err: Error | null) => void): void; - /** - * Disable precise code coverage. Disabling releases unnecessary execution count records and allows executing optimized code. - */ - post(method: 'Profiler.stopPreciseCoverage', callback?: (err: Error | null) => void): void; - /** - * Collect coverage data for the current isolate, and resets execution counters. Precise code coverage needs to have started. - */ - post(method: 'Profiler.takePreciseCoverage', callback?: (err: Error | null, params: Profiler.TakePreciseCoverageReturnType) => void): void; - /** - * Collect coverage data for the current isolate. The coverage data may be incomplete due to garbage collection. - */ - post(method: 'Profiler.getBestEffortCoverage', callback?: (err: Error | null, params: Profiler.GetBestEffortCoverageReturnType) => void): void; - /** - * Enable type profile. - * @experimental - */ - post(method: 'Profiler.startTypeProfile', callback?: (err: Error | null) => void): void; - /** - * Disable type profile. Disabling releases type profile data collected so far. - * @experimental - */ - post(method: 'Profiler.stopTypeProfile', callback?: (err: Error | null) => void): void; - /** - * Collect type profile. - * @experimental - */ - post(method: 'Profiler.takeTypeProfile', callback?: (err: Error | null, params: Profiler.TakeTypeProfileReturnType) => void): void; - post(method: 'HeapProfiler.enable', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.disable', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startTrackingHeapObjects', params?: HeapProfiler.StartTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startTrackingHeapObjects', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopTrackingHeapObjects', params?: HeapProfiler.StopTrackingHeapObjectsParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopTrackingHeapObjects', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.takeHeapSnapshot', params?: HeapProfiler.TakeHeapSnapshotParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.takeHeapSnapshot', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.collectGarbage', callback?: (err: Error | null) => void): void; - post( - method: 'HeapProfiler.getObjectByHeapObjectId', - params?: HeapProfiler.GetObjectByHeapObjectIdParameterType, - callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void - ): void; - post(method: 'HeapProfiler.getObjectByHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetObjectByHeapObjectIdReturnType) => void): void; - /** - * Enables console to refer to the node with given id via $x (see Command Line API for more details $x functions). - */ - post(method: 'HeapProfiler.addInspectedHeapObject', params?: HeapProfiler.AddInspectedHeapObjectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.addInspectedHeapObject', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.getHeapObjectId', params?: HeapProfiler.GetHeapObjectIdParameterType, callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: 'HeapProfiler.getHeapObjectId', callback?: (err: Error | null, params: HeapProfiler.GetHeapObjectIdReturnType) => void): void; - post(method: 'HeapProfiler.startSampling', params?: HeapProfiler.StartSamplingParameterType, callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.startSampling', callback?: (err: Error | null) => void): void; - post(method: 'HeapProfiler.stopSampling', callback?: (err: Error | null, params: HeapProfiler.StopSamplingReturnType) => void): void; - post(method: 'HeapProfiler.getSamplingProfile', callback?: (err: Error | null, params: HeapProfiler.GetSamplingProfileReturnType) => void): void; - /** - * Gets supported tracing categories. - */ - post(method: 'NodeTracing.getCategories', callback?: (err: Error | null, params: NodeTracing.GetCategoriesReturnType) => void): void; - /** - * Start trace events collection. - */ - post(method: 'NodeTracing.start', params?: NodeTracing.StartParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeTracing.start', callback?: (err: Error | null) => void): void; - /** - * Stop trace events collection. Remaining collected events will be sent as a sequence of - * dataCollected events followed by tracingComplete event. - */ - post(method: 'NodeTracing.stop', callback?: (err: Error | null) => void): void; - /** - * Sends protocol message over session with given id. - */ - post(method: 'NodeWorker.sendMessageToWorker', params?: NodeWorker.SendMessageToWorkerParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.sendMessageToWorker', callback?: (err: Error | null) => void): void; - /** - * Instructs the inspector to attach to running workers. Will also attach to new workers - * as they start - */ - post(method: 'NodeWorker.enable', params?: NodeWorker.EnableParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.enable', callback?: (err: Error | null) => void): void; - /** - * Detaches from all running workers and disables attaching to new workers as they are started. - */ - post(method: 'NodeWorker.disable', callback?: (err: Error | null) => void): void; - /** - * Detached from the worker with given sessionId. - */ - post(method: 'NodeWorker.detach', params?: NodeWorker.DetachParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeWorker.detach', callback?: (err: Error | null) => void): void; - /** - * Enable the `NodeRuntime.waitingForDisconnect`. - */ - post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', params?: NodeRuntime.NotifyWhenWaitingForDisconnectParameterType, callback?: (err: Error | null) => void): void; - post(method: 'NodeRuntime.notifyWhenWaitingForDisconnect', callback?: (err: Error | null) => void): void; - // Events - addListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - addListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - addListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - addListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - addListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - addListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - addListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - addListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - addListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - addListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - addListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - addListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - addListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - addListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - addListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - addListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - addListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - addListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - addListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - addListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - addListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - addListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - addListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - addListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - addListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - addListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - addListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - addListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: 'inspectorNotification', message: InspectorNotification<{}>): boolean; - emit(event: 'Runtime.executionContextCreated', message: InspectorNotification): boolean; - emit(event: 'Runtime.executionContextDestroyed', message: InspectorNotification): boolean; - emit(event: 'Runtime.executionContextsCleared'): boolean; - emit(event: 'Runtime.exceptionThrown', message: InspectorNotification): boolean; - emit(event: 'Runtime.exceptionRevoked', message: InspectorNotification): boolean; - emit(event: 'Runtime.consoleAPICalled', message: InspectorNotification): boolean; - emit(event: 'Runtime.inspectRequested', message: InspectorNotification): boolean; - emit(event: 'Debugger.scriptParsed', message: InspectorNotification): boolean; - emit(event: 'Debugger.scriptFailedToParse', message: InspectorNotification): boolean; - emit(event: 'Debugger.breakpointResolved', message: InspectorNotification): boolean; - emit(event: 'Debugger.paused', message: InspectorNotification): boolean; - emit(event: 'Debugger.resumed'): boolean; - emit(event: 'Console.messageAdded', message: InspectorNotification): boolean; - emit(event: 'Profiler.consoleProfileStarted', message: InspectorNotification): boolean; - emit(event: 'Profiler.consoleProfileFinished', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.addHeapSnapshotChunk', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.resetProfiles'): boolean; - emit(event: 'HeapProfiler.reportHeapSnapshotProgress', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.lastSeenObjectId', message: InspectorNotification): boolean; - emit(event: 'HeapProfiler.heapStatsUpdate', message: InspectorNotification): boolean; - emit(event: 'NodeTracing.dataCollected', message: InspectorNotification): boolean; - emit(event: 'NodeTracing.tracingComplete'): boolean; - emit(event: 'NodeWorker.attachedToWorker', message: InspectorNotification): boolean; - emit(event: 'NodeWorker.detachedFromWorker', message: InspectorNotification): boolean; - emit(event: 'NodeWorker.receivedMessageFromWorker', message: InspectorNotification): boolean; - emit(event: 'NodeRuntime.waitingForDisconnect'): boolean; - on(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - on(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - on(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - on(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - on(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - on(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - on(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - on(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - on(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - on(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - on(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - on(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - on(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - on(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - on(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - on(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - on(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - on(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - on(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - on(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - on(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - on(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - on(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - on(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - on(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - on(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - on(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - on(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - once(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - once(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - once(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - once(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - once(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - once(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - once(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - once(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - once(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - once(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - once(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - once(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - once(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - once(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - once(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - once(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - once(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - once(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - once(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - once(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - once(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - once(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - once(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - once(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - once(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - once(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - once(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - prependListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - prependListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - prependListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - /** - * Emitted when any notification from the V8 Inspector is received. - */ - prependOnceListener(event: 'inspectorNotification', listener: (message: InspectorNotification<{}>) => void): this; - /** - * Issued when new execution context is created. - */ - prependOnceListener(event: 'Runtime.executionContextCreated', listener: (message: InspectorNotification) => void): this; - /** - * Issued when execution context is destroyed. - */ - prependOnceListener(event: 'Runtime.executionContextDestroyed', listener: (message: InspectorNotification) => void): this; - /** - * Issued when all executionContexts were cleared in browser - */ - prependOnceListener(event: 'Runtime.executionContextsCleared', listener: () => void): this; - /** - * Issued when exception was thrown and unhandled. - */ - prependOnceListener(event: 'Runtime.exceptionThrown', listener: (message: InspectorNotification) => void): this; - /** - * Issued when unhandled exception was revoked. - */ - prependOnceListener(event: 'Runtime.exceptionRevoked', listener: (message: InspectorNotification) => void): this; - /** - * Issued when console API was called. - */ - prependOnceListener(event: 'Runtime.consoleAPICalled', listener: (message: InspectorNotification) => void): this; - /** - * Issued when object should be inspected (for example, as a result of inspect() command line API call). - */ - prependOnceListener(event: 'Runtime.inspectRequested', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine parses script. This event is also fired for all known and uncollected scripts upon enabling debugger. - */ - prependOnceListener(event: 'Debugger.scriptParsed', listener: (message: InspectorNotification) => void): this; - /** - * Fired when virtual machine fails to parse the script. - */ - prependOnceListener(event: 'Debugger.scriptFailedToParse', listener: (message: InspectorNotification) => void): this; - /** - * Fired when breakpoint is resolved to an actual script and location. - */ - prependOnceListener(event: 'Debugger.breakpointResolved', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine stopped on breakpoint or exception or any other stop criteria. - */ - prependOnceListener(event: 'Debugger.paused', listener: (message: InspectorNotification) => void): this; - /** - * Fired when the virtual machine resumed execution. - */ - prependOnceListener(event: 'Debugger.resumed', listener: () => void): this; - /** - * Issued when new console message is added. - */ - prependOnceListener(event: 'Console.messageAdded', listener: (message: InspectorNotification) => void): this; - /** - * Sent when new profile recording is started using console.profile() call. - */ - prependOnceListener(event: 'Profiler.consoleProfileStarted', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'Profiler.consoleProfileFinished', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'HeapProfiler.addHeapSnapshotChunk', listener: (message: InspectorNotification) => void): this; - prependOnceListener(event: 'HeapProfiler.resetProfiles', listener: () => void): this; - prependOnceListener(event: 'HeapProfiler.reportHeapSnapshotProgress', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend regularly sends a current value for last seen object id and corresponding timestamp. If the were changes in the heap since last event then one or more heapStatsUpdate events will be sent before a new lastSeenObjectId event. - */ - prependOnceListener(event: 'HeapProfiler.lastSeenObjectId', listener: (message: InspectorNotification) => void): this; - /** - * If heap objects tracking has been started then backend may send update for one or more fragments - */ - prependOnceListener(event: 'HeapProfiler.heapStatsUpdate', listener: (message: InspectorNotification) => void): this; - /** - * Contains an bucket of collected trace events. - */ - prependOnceListener(event: 'NodeTracing.dataCollected', listener: (message: InspectorNotification) => void): this; - /** - * Signals that tracing is stopped and there is no trace buffers pending flush, all data were - * delivered via dataCollected events. - */ - prependOnceListener(event: 'NodeTracing.tracingComplete', listener: () => void): this; - /** - * Issued when attached to a worker. - */ - prependOnceListener(event: 'NodeWorker.attachedToWorker', listener: (message: InspectorNotification) => void): this; - /** - * Issued when detached from the worker. - */ - prependOnceListener(event: 'NodeWorker.detachedFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * Notifies about a new protocol message received from the session - * (session ID is provided in attachedToWorker notification). - */ - prependOnceListener(event: 'NodeWorker.receivedMessageFromWorker', listener: (message: InspectorNotification) => void): this; - /** - * This event is fired instead of `Runtime.executionContextDestroyed` when - * enabled. - * It is fired when the Node process finished all code execution and is - * waiting for all frontends to disconnect. - */ - prependOnceListener(event: 'NodeRuntime.waitingForDisconnect', listener: () => void): this; - } - /** - * Activate inspector on host and port. Equivalent to`node --inspect=[[host:]port]`, but can be done programmatically after node has - * started. - * - * If wait is `true`, will block until a client has connected to the inspect port - * and flow control has been passed to the debugger client. - * - * See the `security warning` regarding the `host`parameter usage. - * @param [port='what was specified on the CLI'] Port to listen on for inspector connections. Optional. - * @param [host='what was specified on the CLI'] Host to listen on for inspector connections. Optional. - * @param [wait=false] Block until a client has connected. Optional. - * @returns Disposable that calls `inspector.close()`. - */ - function open(port?: number, host?: string, wait?: boolean): Disposable; - /** - * Deactivate the inspector. Blocks until there are no active connections. - */ - function close(): void; - /** - * Return the URL of the active inspector, or `undefined` if there is none. - * - * ```console - * $ node --inspect -p 'inspector.url()' - * Debugger listening on ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * For help, see: https://nodejs.org/en/docs/inspector - * ws://127.0.0.1:9229/166e272e-7a30-4d09-97ce-f1c012b43c34 - * - * $ node --inspect=localhost:3000 -p 'inspector.url()' - * Debugger listening on ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * For help, see: https://nodejs.org/en/docs/inspector - * ws://localhost:3000/51cf8d0e-3c36-4c59-8efd-54519839e56a - * - * $ node -p 'inspector.url()' - * undefined - * ``` - */ - function url(): string | undefined; - /** - * Blocks until a client (existing or connected later) has sent`Runtime.runIfWaitingForDebugger` command. - * - * An exception will be thrown if there is no active inspector. - * @since v12.7.0 - */ - function waitForDebugger(): void; -} -/** - * The inspector module provides an API for interacting with the V8 inspector. - */ -declare module 'node:inspector' { - import inspector = require('inspector'); - export = inspector; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/module.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/module.d.ts deleted file mode 100644 index 68d59c77..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/module.d.ts +++ /dev/null @@ -1,301 +0,0 @@ -/** - * @since v0.3.7 - * @experimental - */ -declare module "module" { - import { URL } from "node:url"; - import { MessagePort } from "node:worker_threads"; - namespace Module { - /** - * The `module.syncBuiltinESMExports()` method updates all the live bindings for - * builtin `ES Modules` to match the properties of the `CommonJS` exports. It - * does not add or remove exported names from the `ES Modules`. - * - * ```js - * const fs = require('node:fs'); - * const assert = require('node:assert'); - * const { syncBuiltinESMExports } = require('node:module'); - * - * fs.readFile = newAPI; - * - * delete fs.readFileSync; - * - * function newAPI() { - * // ... - * } - * - * fs.newAPI = newAPI; - * - * syncBuiltinESMExports(); - * - * import('node:fs').then((esmFS) => { - * // It syncs the existing readFile property with the new value - * assert.strictEqual(esmFS.readFile, newAPI); - * // readFileSync has been deleted from the required fs - * assert.strictEqual('readFileSync' in fs, false); - * // syncBuiltinESMExports() does not remove readFileSync from esmFS - * assert.strictEqual('readFileSync' in esmFS, true); - * // syncBuiltinESMExports() does not add names - * assert.strictEqual(esmFS.newAPI, undefined); - * }); - * ``` - * @since v12.12.0 - */ - function syncBuiltinESMExports(): void; - /** - * `path` is the resolved path for the file for which a corresponding source map - * should be fetched. - * @since v13.7.0, v12.17.0 - * @return Returns `module.SourceMap` if a source map is found, `undefined` otherwise. - */ - function findSourceMap(path: string, error?: Error): SourceMap; - interface SourceMapPayload { - file: string; - version: number; - sources: string[]; - sourcesContent: string[]; - names: string[]; - mappings: string; - sourceRoot: string; - } - interface SourceMapping { - generatedLine: number; - generatedColumn: number; - originalSource: string; - originalLine: number; - originalColumn: number; - } - interface SourceOrigin { - /** - * The name of the range in the source map, if one was provided - */ - name?: string; - /** - * The file name of the original source, as reported in the SourceMap - */ - fileName: string; - /** - * The 1-indexed lineNumber of the corresponding call site in the original source - */ - lineNumber: number; - /** - * The 1-indexed columnNumber of the corresponding call site in the original source - */ - columnNumber: number; - } - /** - * @since v13.7.0, v12.17.0 - */ - class SourceMap { - /** - * Getter for the payload used to construct the `SourceMap` instance. - */ - readonly payload: SourceMapPayload; - constructor(payload: SourceMapPayload); - /** - * Given a line offset and column offset in the generated source - * file, returns an object representing the SourceMap range in the - * original file if found, or an empty object if not. - * - * The object returned contains the following keys: - * - * The returned value represents the raw range as it appears in the - * SourceMap, based on zero-indexed offsets, _not_ 1-indexed line and - * column numbers as they appear in Error messages and CallSite - * objects. - * - * To get the corresponding 1-indexed line and column numbers from a - * lineNumber and columnNumber as they are reported by Error stacks - * and CallSite objects, use `sourceMap.findOrigin(lineNumber, columnNumber)` - * @param lineOffset The zero-indexed line number offset in the generated source - * @param columnOffset The zero-indexed column number offset in the generated source - */ - findEntry(lineOffset: number, columnOffset: number): SourceMapping; - /** - * Given a 1-indexed `lineNumber` and `columnNumber` from a call site in the generated source, - * find the corresponding call site location in the original source. - * - * If the `lineNumber` and `columnNumber` provided are not found in any source map, - * then an empty object is returned. - * @param lineNumber The 1-indexed line number of the call site in the generated source - * @param columnNumber The 1-indexed column number of the call site in the generated source - */ - findOrigin(lineNumber: number, columnNumber: number): SourceOrigin | {}; - } - /** @deprecated Use `ImportAttributes` instead */ - interface ImportAssertions extends ImportAttributes {} - interface ImportAttributes extends NodeJS.Dict { - type?: string | undefined; - } - type ModuleFormat = "builtin" | "commonjs" | "json" | "module" | "wasm"; - type ModuleSource = string | ArrayBuffer | NodeJS.TypedArray; - interface GlobalPreloadContext { - port: MessagePort; - } - /** - * @deprecated This hook will be removed in a future version. - * Use `initialize` instead. When a loader has an `initialize` export, `globalPreload` will be ignored. - * - * Sometimes it might be necessary to run some code inside of the same global scope that the application runs in. - * This hook allows the return of a string that is run as a sloppy-mode script on startup. - * - * @param context Information to assist the preload code - * @return Code to run before application startup - */ - type GlobalPreloadHook = (context: GlobalPreloadContext) => string; - /** - * The `initialize` hook provides a way to define a custom function that runs in the hooks thread - * when the hooks module is initialized. Initialization happens when the hooks module is registered via `register`. - * - * This hook can receive data from a `register` invocation, including ports and other transferrable objects. - * The return value of `initialize` can be a `Promise`, in which case it will be awaited before the main application thread execution resumes. - */ - type InitializeHook = (data: Data) => void | Promise; - interface ResolveHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions: ImportAttributes; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - /** - * The module importing this one, or undefined if this is the Node.js entry point - */ - parentURL: string | undefined; - } - interface ResolveFnOutput { - /** - * A hint to the load hook (it might be ignored) - */ - format?: ModuleFormat | null | undefined; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions?: ImportAttributes | undefined; - /** - * The import attributes to use when caching the module (optional; if excluded the input will be used) - */ - importAttributes?: ImportAttributes | undefined; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The absolute URL to which this input resolves - */ - url: string; - } - /** - * The `resolve` hook chain is responsible for resolving file URL for a given module specifier and parent URL, and optionally its format (such as `'module'`) as a hint to the `load` hook. - * If a format is specified, the load hook is ultimately responsible for providing the final `format` value (and it is free to ignore the hint provided by `resolve`); - * if `resolve` provides a format, a custom `load` hook is required even if only to pass the value to the Node.js default `load` hook. - * - * @param specifier The specified URL path of the module to be resolved - * @param context - * @param nextResolve The subsequent `resolve` hook in the chain, or the Node.js default `resolve` hook after the last user-supplied resolve hook - */ - type ResolveHook = ( - specifier: string, - context: ResolveHookContext, - nextResolve: ( - specifier: string, - context?: ResolveHookContext, - ) => ResolveFnOutput | Promise, - ) => ResolveFnOutput | Promise; - interface LoadHookContext { - /** - * Export conditions of the relevant `package.json` - */ - conditions: string[]; - /** - * The format optionally supplied by the `resolve` hook chain - */ - format: ModuleFormat; - /** - * @deprecated Use `importAttributes` instead - */ - importAssertions: ImportAttributes; - /** - * An object whose key-value pairs represent the assertions for the module to import - */ - importAttributes: ImportAttributes; - } - interface LoadFnOutput { - format: ModuleFormat; - /** - * A signal that this hook intends to terminate the chain of `resolve` hooks. - * @default false - */ - shortCircuit?: boolean | undefined; - /** - * The source for Node.js to evaluate - */ - source?: ModuleSource; - } - /** - * The `load` hook provides a way to define a custom method of determining how a URL should be interpreted, retrieved, and parsed. - * It is also in charge of validating the import assertion. - * - * @param url The URL/path of the module to be loaded - * @param context Metadata about the module - * @param nextLoad The subsequent `load` hook in the chain, or the Node.js default `load` hook after the last user-supplied `load` hook - */ - type LoadHook = ( - url: string, - context: LoadHookContext, - nextLoad: (url: string, context?: LoadHookContext) => LoadFnOutput | Promise, - ) => LoadFnOutput | Promise; - } - interface RegisterOptions { - parentURL: string | URL; - data?: Data | undefined; - transferList?: any[] | undefined; - } - interface Module extends NodeModule {} - class Module { - static runMain(): void; - static wrap(code: string): string; - static createRequire(path: string | URL): NodeRequire; - static builtinModules: string[]; - static isBuiltin(moduleName: string): boolean; - static Module: typeof Module; - static register( - specifier: string | URL, - parentURL?: string | URL, - options?: RegisterOptions, - ): void; - static register(specifier: string | URL, options?: RegisterOptions): void; - constructor(id: string, parent?: Module); - } - global { - interface ImportMeta { - url: string; - /** - * Provides a module-relative resolution function scoped to each module, returning - * the URL string. - * - * Second `parent` parameter is only used when the `--experimental-import-meta-resolve` - * command flag enabled. - * - * @since v20.6.0 - * - * @param specifier The module specifier to resolve relative to `parent`. - * @param parent The absolute parent module URL to resolve from. - * @returns The absolute (`file:`) URL string for the resolved module. - */ - resolve(specifier: string, parent?: string | URL | undefined): string; - } - } - export = Module; -} -declare module "node:module" { - import module = require("module"); - export = module; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/net.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/net.d.ts deleted file mode 100644 index 70789e1b..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/net.d.ts +++ /dev/null @@ -1,949 +0,0 @@ -/** - * > Stability: 2 - Stable - * - * The `node:net` module provides an asynchronous network API for creating stream-based - * TCP or `IPC` servers ({@link createServer}) and clients - * ({@link createConnection}). - * - * It can be accessed using: - * - * ```js - * const net = require('node:net'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/net.js) - */ -declare module "net" { - import * as stream from "node:stream"; - import { Abortable, EventEmitter } from "node:events"; - import * as dns from "node:dns"; - type LookupFunction = ( - hostname: string, - options: dns.LookupAllOptions, - callback: (err: NodeJS.ErrnoException | null, addresses: dns.LookupAddress[]) => void, - ) => void; - interface AddressInfo { - address: string; - family: string; - port: number; - } - interface SocketConstructorOpts { - fd?: number | undefined; - allowHalfOpen?: boolean | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - signal?: AbortSignal; - } - interface OnReadOpts { - buffer: Uint8Array | (() => Uint8Array); - /** - * This function is called for every chunk of incoming data. - * Two arguments are passed to it: the number of bytes written to buffer and a reference to buffer. - * Return false from this function to implicitly pause() the socket. - */ - callback(bytesWritten: number, buf: Uint8Array): boolean; - } - interface ConnectOpts { - /** - * If specified, incoming data is stored in a single buffer and passed to the supplied callback when data arrives on the socket. - * Note: this will cause the streaming functionality to not provide any data, however events like 'error', 'end', and 'close' will - * still be emitted as normal and methods like pause() and resume() will also behave as expected. - */ - onread?: OnReadOpts | undefined; - } - interface TcpSocketConnectOpts extends ConnectOpts { - port: number; - host?: string | undefined; - localAddress?: string | undefined; - localPort?: number | undefined; - hints?: number | undefined; - family?: number | undefined; - lookup?: LookupFunction | undefined; - noDelay?: boolean | undefined; - keepAlive?: boolean | undefined; - keepAliveInitialDelay?: number | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamily?: boolean | undefined; - /** - * @since v18.13.0 - */ - autoSelectFamilyAttemptTimeout?: number | undefined; - } - interface IpcSocketConnectOpts extends ConnectOpts { - path: string; - } - type SocketConnectOpts = TcpSocketConnectOpts | IpcSocketConnectOpts; - type SocketReadyState = "opening" | "open" | "readOnly" | "writeOnly" | "closed"; - /** - * This class is an abstraction of a TCP socket or a streaming `IPC` endpoint - * (uses named pipes on Windows, and Unix domain sockets otherwise). It is also - * an `EventEmitter`. - * - * A `net.Socket` can be created by the user and used directly to interact with - * a server. For example, it is returned by {@link createConnection}, - * so the user can use it to talk to the server. - * - * It can also be created by Node.js and passed to the user when a connection - * is received. For example, it is passed to the listeners of a `'connection'` event emitted on a {@link Server}, so the user can use - * it to interact with the client. - * @since v0.3.4 - */ - class Socket extends stream.Duplex { - constructor(options?: SocketConstructorOpts); - /** - * Destroys the socket after all data is written. If the `finish` event was already emitted the socket is destroyed immediately. - * If the socket is still writable it implicitly calls `socket.end()`. - * @since v0.3.4 - */ - destroySoon(): void; - /** - * Sends data on the socket. The second parameter specifies the encoding in the - * case of a string. It defaults to UTF8 encoding. - * - * Returns `true` if the entire data was flushed successfully to the kernel - * buffer. Returns `false` if all or part of the data was queued in user memory.`'drain'` will be emitted when the buffer is again free. - * - * The optional `callback` parameter will be executed when the data is finally - * written out, which may not be immediately. - * - * See `Writable` stream `write()` method for more - * information. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - */ - write(buffer: Uint8Array | string, cb?: (err?: Error) => void): boolean; - write(str: Uint8Array | string, encoding?: BufferEncoding, cb?: (err?: Error) => void): boolean; - /** - * Initiate a connection on a given socket. - * - * Possible signatures: - * - * * `socket.connect(options[, connectListener])` - * * `socket.connect(path[, connectListener])` for `IPC` connections. - * * `socket.connect(port[, host][, connectListener])` for TCP connections. - * * Returns: `net.Socket` The socket itself. - * - * This function is asynchronous. When the connection is established, the `'connect'` event will be emitted. If there is a problem connecting, - * instead of a `'connect'` event, an `'error'` event will be emitted with - * the error passed to the `'error'` listener. - * The last parameter `connectListener`, if supplied, will be added as a listener - * for the `'connect'` event **once**. - * - * This function should only be used for reconnecting a socket after`'close'` has been emitted or otherwise it may lead to undefined - * behavior. - */ - connect(options: SocketConnectOpts, connectionListener?: () => void): this; - connect(port: number, host: string, connectionListener?: () => void): this; - connect(port: number, connectionListener?: () => void): this; - connect(path: string, connectionListener?: () => void): this; - /** - * Set the encoding for the socket as a `Readable Stream`. See `readable.setEncoding()` for more information. - * @since v0.1.90 - * @return The socket itself. - */ - setEncoding(encoding?: BufferEncoding): this; - /** - * Pauses the reading of data. That is, `'data'` events will not be emitted. - * Useful to throttle back an upload. - * @return The socket itself. - */ - pause(): this; - /** - * Close the TCP connection by sending an RST packet and destroy the stream. - * If this TCP socket is in connecting status, it will send an RST packet and destroy this TCP socket once it is connected. - * Otherwise, it will call `socket.destroy` with an `ERR_SOCKET_CLOSED` Error. - * If this is not a TCP socket (for example, a pipe), calling this method will immediately throw an `ERR_INVALID_HANDLE_TYPE` Error. - * @since v18.3.0, v16.17.0 - */ - resetAndDestroy(): this; - /** - * Resumes reading after a call to `socket.pause()`. - * @return The socket itself. - */ - resume(): this; - /** - * Sets the socket to timeout after `timeout` milliseconds of inactivity on - * the socket. By default `net.Socket` do not have a timeout. - * - * When an idle timeout is triggered the socket will receive a `'timeout'` event but the connection will not be severed. The user must manually call `socket.end()` or `socket.destroy()` to - * end the connection. - * - * ```js - * socket.setTimeout(3000); - * socket.on('timeout', () => { - * console.log('socket timeout'); - * socket.end(); - * }); - * ``` - * - * If `timeout` is 0, then the existing idle timeout is disabled. - * - * The optional `callback` parameter will be added as a one-time listener for the `'timeout'` event. - * @since v0.1.90 - * @return The socket itself. - */ - setTimeout(timeout: number, callback?: () => void): this; - /** - * Enable/disable the use of Nagle's algorithm. - * - * When a TCP connection is created, it will have Nagle's algorithm enabled. - * - * Nagle's algorithm delays data before it is sent via the network. It attempts - * to optimize throughput at the expense of latency. - * - * Passing `true` for `noDelay` or not passing an argument will disable Nagle's - * algorithm for the socket. Passing `false` for `noDelay` will enable Nagle's - * algorithm. - * @since v0.1.90 - * @param [noDelay=true] - * @return The socket itself. - */ - setNoDelay(noDelay?: boolean): this; - /** - * Enable/disable keep-alive functionality, and optionally set the initial - * delay before the first keepalive probe is sent on an idle socket. - * - * Set `initialDelay` (in milliseconds) to set the delay between the last - * data packet received and the first keepalive probe. Setting `0` for`initialDelay` will leave the value unchanged from the default - * (or previous) setting. - * - * Enabling the keep-alive functionality will set the following socket options: - * - * * `SO_KEEPALIVE=1` - * * `TCP_KEEPIDLE=initialDelay` - * * `TCP_KEEPCNT=10` - * * `TCP_KEEPINTVL=1` - * @since v0.1.92 - * @param [enable=false] - * @param [initialDelay=0] - * @return The socket itself. - */ - setKeepAlive(enable?: boolean, initialDelay?: number): this; - /** - * Returns the bound `address`, the address `family` name and `port` of the - * socket as reported by the operating system:`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }` - * @since v0.1.90 - */ - address(): AddressInfo | {}; - /** - * Calling `unref()` on a socket will allow the program to exit if this is the only - * active socket in the event system. If the socket is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - unref(): this; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed socket will _not_ let the program exit if it's the only socket left (the default behavior). - * If the socket is `ref`ed calling `ref` again will have no effect. - * @since v0.9.1 - * @return The socket itself. - */ - ref(): this; - /** - * This property is only present if the family autoselection algorithm is enabled in `socket.connect(options)` - * and it is an array of the addresses that have been attempted. - * - * Each address is a string in the form of `$IP:$PORT`. - * If the connection was successful, then the last address is the one that the socket is currently connected to. - * @since v19.4.0 - */ - readonly autoSelectFamilyAttemptedAddresses: string[]; - /** - * This property shows the number of characters buffered for writing. The buffer - * may contain strings whose length after encoding is not yet known. So this number - * is only an approximation of the number of bytes in the buffer. - * - * `net.Socket` has the property that `socket.write()` always works. This is to - * help users get up and running quickly. The computer cannot always keep up - * with the amount of data that is written to a socket. The network connection - * simply might be too slow. Node.js will internally queue up the data written to a - * socket and send it out over the wire when it is possible. - * - * The consequence of this internal buffering is that memory may grow. - * Users who experience large or growing `bufferSize` should attempt to - * "throttle" the data flows in their program with `socket.pause()` and `socket.resume()`. - * @since v0.3.8 - * @deprecated Since v14.6.0 - Use `writableLength` instead. - */ - readonly bufferSize: number; - /** - * The amount of received bytes. - * @since v0.5.3 - */ - readonly bytesRead: number; - /** - * The amount of bytes sent. - * @since v0.5.3 - */ - readonly bytesWritten: number; - /** - * If `true`,`socket.connect(options[, connectListener])` was - * called and has not yet finished. It will stay `true` until the socket becomes - * connected, then it is set to `false` and the `'connect'` event is emitted. Note - * that the `socket.connect(options[, connectListener])` callback is a listener for the `'connect'` event. - * @since v6.1.0 - */ - readonly connecting: boolean; - /** - * This is `true` if the socket is not connected yet, either because `.connect()`has not yet been called or because it is still in the process of connecting - * (see `socket.connecting`). - * @since v11.2.0, v10.16.0 - */ - readonly pending: boolean; - /** - * See `writable.destroyed` for further details. - */ - readonly destroyed: boolean; - /** - * The string representation of the local IP address the remote client is - * connecting on. For example, in a server listening on `'0.0.0.0'`, if a client - * connects on `'192.168.1.1'`, the value of `socket.localAddress` would be`'192.168.1.1'`. - * @since v0.9.6 - */ - readonly localAddress?: string; - /** - * The numeric representation of the local port. For example, `80` or `21`. - * @since v0.9.6 - */ - readonly localPort?: number; - /** - * The string representation of the local IP family. `'IPv4'` or `'IPv6'`. - * @since v18.8.0, v16.18.0 - */ - readonly localFamily?: string; - /** - * This property represents the state of the connection as a string. - * - * * If the stream is connecting `socket.readyState` is `opening`. - * * If the stream is readable and writable, it is `open`. - * * If the stream is readable and not writable, it is `readOnly`. - * * If the stream is not readable and writable, it is `writeOnly`. - * @since v0.5.0 - */ - readonly readyState: SocketReadyState; - /** - * The string representation of the remote IP address. For example,`'74.125.127.100'` or `'2001:4860:a005::68'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remoteAddress?: string | undefined; - /** - * The string representation of the remote IP family. `'IPv4'` or `'IPv6'`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.11.14 - */ - readonly remoteFamily?: string | undefined; - /** - * The numeric representation of the remote port. For example, `80` or `21`. Value may be `undefined` if - * the socket is destroyed (for example, if the client disconnected). - * @since v0.5.10 - */ - readonly remotePort?: number | undefined; - /** - * The socket timeout in milliseconds as set by `socket.setTimeout()`. - * It is `undefined` if a timeout has not been set. - * @since v10.7.0 - */ - readonly timeout?: number | undefined; - /** - * Half-closes the socket. i.e., it sends a FIN packet. It is possible the - * server will still send some data. - * - * See `writable.end()` for further details. - * @since v0.1.90 - * @param [encoding='utf8'] Only used when data is `string`. - * @param callback Optional callback for when the socket is finished. - * @return The socket itself. - */ - end(callback?: () => void): this; - end(buffer: Uint8Array | string, callback?: () => void): this; - end(str: Uint8Array | string, encoding?: BufferEncoding, callback?: () => void): this; - /** - * events.EventEmitter - * 1. close - * 2. connect - * 3. data - * 4. drain - * 5. end - * 6. error - * 7. lookup - * 8. ready - * 9. timeout - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: (hadError: boolean) => void): this; - addListener(event: "connect", listener: () => void): this; - addListener(event: "data", listener: (data: Buffer) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - addListener(event: "ready", listener: () => void): this; - addListener(event: "timeout", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close", hadError: boolean): boolean; - emit(event: "connect"): boolean; - emit(event: "data", data: Buffer): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "lookup", err: Error, address: string, family: string | number, host: string): boolean; - emit(event: "ready"): boolean; - emit(event: "timeout"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: (hadError: boolean) => void): this; - on(event: "connect", listener: () => void): this; - on(event: "data", listener: (data: Buffer) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - on(event: "ready", listener: () => void): this; - on(event: "timeout", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: (hadError: boolean) => void): this; - once(event: "connect", listener: () => void): this; - once(event: "data", listener: (data: Buffer) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - once(event: "ready", listener: () => void): this; - once(event: "timeout", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: (hadError: boolean) => void): this; - prependListener(event: "connect", listener: () => void): this; - prependListener(event: "data", listener: (data: Buffer) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependListener(event: "ready", listener: () => void): this; - prependListener(event: "timeout", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: (hadError: boolean) => void): this; - prependOnceListener(event: "connect", listener: () => void): this; - prependOnceListener(event: "data", listener: (data: Buffer) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener( - event: "lookup", - listener: (err: Error, address: string, family: string | number, host: string) => void, - ): this; - prependOnceListener(event: "ready", listener: () => void): this; - prependOnceListener(event: "timeout", listener: () => void): this; - } - interface ListenOptions extends Abortable { - port?: number | undefined; - host?: string | undefined; - backlog?: number | undefined; - path?: string | undefined; - exclusive?: boolean | undefined; - readableAll?: boolean | undefined; - writableAll?: boolean | undefined; - /** - * @default false - */ - ipv6Only?: boolean | undefined; - } - interface ServerOpts { - /** - * Indicates whether half-opened TCP connections are allowed. - * @default false - */ - allowHalfOpen?: boolean | undefined; - /** - * Indicates whether the socket should be paused on incoming connections. - * @default false - */ - pauseOnConnect?: boolean | undefined; - /** - * If set to `true`, it disables the use of Nagle's algorithm immediately after a new incoming connection is received. - * @default false - * @since v16.5.0 - */ - noDelay?: boolean | undefined; - /** - * If set to `true`, it enables keep-alive functionality on the socket immediately after a new incoming connection is received, - * similarly on what is done in `socket.setKeepAlive([enable][, initialDelay])`. - * @default false - * @since v16.5.0 - */ - keepAlive?: boolean | undefined; - /** - * If set to a positive number, it sets the initial delay before the first keepalive probe is sent on an idle socket. - * @default 0 - * @since v16.5.0 - */ - keepAliveInitialDelay?: number | undefined; - } - interface DropArgument { - localAddress?: string; - localPort?: number; - localFamily?: string; - remoteAddress?: string; - remotePort?: number; - remoteFamily?: string; - } - /** - * This class is used to create a TCP or `IPC` server. - * @since v0.1.90 - */ - class Server extends EventEmitter { - constructor(connectionListener?: (socket: Socket) => void); - constructor(options?: ServerOpts, connectionListener?: (socket: Socket) => void); - /** - * Start a server listening for connections. A `net.Server` can be a TCP or - * an `IPC` server depending on what it listens to. - * - * Possible signatures: - * - * * `server.listen(handle[, backlog][, callback])` - * * `server.listen(options[, callback])` - * * `server.listen(path[, backlog][, callback])` for `IPC` servers - * * `server.listen([port[, host[, backlog]]][, callback])` for TCP servers - * - * This function is asynchronous. When the server starts listening, the `'listening'` event will be emitted. The last parameter `callback`will be added as a listener for the `'listening'` - * event. - * - * All `listen()` methods can take a `backlog` parameter to specify the maximum - * length of the queue of pending connections. The actual length will be determined - * by the OS through sysctl settings such as `tcp_max_syn_backlog` and `somaxconn`on Linux. The default value of this parameter is 511 (not 512). - * - * All {@link Socket} are set to `SO_REUSEADDR` (see [`socket(7)`](https://man7.org/linux/man-pages/man7/socket.7.html) for - * details). - * - * The `server.listen()` method can be called again if and only if there was an - * error during the first `server.listen()` call or `server.close()` has been - * called. Otherwise, an `ERR_SERVER_ALREADY_LISTEN` error will be thrown. - * - * One of the most common errors raised when listening is `EADDRINUSE`. - * This happens when another server is already listening on the requested`port`/`path`/`handle`. One way to handle this would be to retry - * after a certain amount of time: - * - * ```js - * server.on('error', (e) => { - * if (e.code === 'EADDRINUSE') { - * console.error('Address in use, retrying...'); - * setTimeout(() => { - * server.close(); - * server.listen(PORT, HOST); - * }, 1000); - * } - * }); - * ``` - */ - listen(port?: number, hostname?: string, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, hostname?: string, listeningListener?: () => void): this; - listen(port?: number, backlog?: number, listeningListener?: () => void): this; - listen(port?: number, listeningListener?: () => void): this; - listen(path: string, backlog?: number, listeningListener?: () => void): this; - listen(path: string, listeningListener?: () => void): this; - listen(options: ListenOptions, listeningListener?: () => void): this; - listen(handle: any, backlog?: number, listeningListener?: () => void): this; - listen(handle: any, listeningListener?: () => void): this; - /** - * Stops the server from accepting new connections and keeps existing - * connections. This function is asynchronous, the server is finally closed - * when all connections are ended and the server emits a `'close'` event. - * The optional `callback` will be called once the `'close'` event occurs. Unlike - * that event, it will be called with an `Error` as its only argument if the server - * was not open when it was closed. - * @since v0.1.90 - * @param callback Called when the server is closed. - */ - close(callback?: (err?: Error) => void): this; - /** - * Returns the bound `address`, the address `family` name, and `port` of the server - * as reported by the operating system if listening on an IP socket - * (useful to find which port was assigned when getting an OS-assigned address):`{ port: 12346, family: 'IPv4', address: '127.0.0.1' }`. - * - * For a server listening on a pipe or Unix domain socket, the name is returned - * as a string. - * - * ```js - * const server = net.createServer((socket) => { - * socket.end('goodbye\n'); - * }).on('error', (err) => { - * // Handle errors here. - * throw err; - * }); - * - * // Grab an arbitrary unused port. - * server.listen(() => { - * console.log('opened server on', server.address()); - * }); - * ``` - * - * `server.address()` returns `null` before the `'listening'` event has been - * emitted or after calling `server.close()`. - * @since v0.1.90 - */ - address(): AddressInfo | string | null; - /** - * Asynchronously get the number of concurrent connections on the server. Works - * when sockets were sent to forks. - * - * Callback should take two arguments `err` and `count`. - * @since v0.9.7 - */ - getConnections(cb: (error: Error | null, count: number) => void): void; - /** - * Opposite of `unref()`, calling `ref()` on a previously `unref`ed server will _not_ let the program exit if it's the only server left (the default behavior). - * If the server is `ref`ed calling `ref()` again will have no effect. - * @since v0.9.1 - */ - ref(): this; - /** - * Calling `unref()` on a server will allow the program to exit if this is the only - * active server in the event system. If the server is already `unref`ed calling`unref()` again will have no effect. - * @since v0.9.1 - */ - unref(): this; - /** - * Set this property to reject connections when the server's connection count gets - * high. - * - * It is not recommended to use this option once a socket has been sent to a child - * with `child_process.fork()`. - * @since v0.2.0 - */ - maxConnections: number; - connections: number; - /** - * Indicates whether or not the server is listening for connections. - * @since v5.7.0 - */ - listening: boolean; - /** - * events.EventEmitter - * 1. close - * 2. connection - * 3. error - * 4. listening - * 5. drop - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "connection", listener: (socket: Socket) => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "listening", listener: () => void): this; - addListener(event: "drop", listener: (data?: DropArgument) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "connection", socket: Socket): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "listening"): boolean; - emit(event: "drop", data?: DropArgument): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "connection", listener: (socket: Socket) => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "listening", listener: () => void): this; - on(event: "drop", listener: (data?: DropArgument) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "connection", listener: (socket: Socket) => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "listening", listener: () => void): this; - once(event: "drop", listener: (data?: DropArgument) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "connection", listener: (socket: Socket) => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "listening", listener: () => void): this; - prependListener(event: "drop", listener: (data?: DropArgument) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "connection", listener: (socket: Socket) => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "listening", listener: () => void): this; - prependOnceListener(event: "drop", listener: (data?: DropArgument) => void): this; - /** - * Calls {@link Server.close()} and returns a promise that fulfills when the server has closed. - * @since v20.5.0 - */ - [Symbol.asyncDispose](): Promise; - } - type IPVersion = "ipv4" | "ipv6"; - /** - * The `BlockList` object can be used with some network APIs to specify rules for - * disabling inbound or outbound access to specific IP addresses, IP ranges, or - * IP subnets. - * @since v15.0.0, v14.18.0 - */ - class BlockList { - /** - * Adds a rule to block the given IP address. - * @since v15.0.0, v14.18.0 - * @param address An IPv4 or IPv6 address. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addAddress(address: string, type?: IPVersion): void; - addAddress(address: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses from `start` (inclusive) to`end` (inclusive). - * @since v15.0.0, v14.18.0 - * @param start The starting IPv4 or IPv6 address in the range. - * @param end The ending IPv4 or IPv6 address in the range. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addRange(start: string, end: string, type?: IPVersion): void; - addRange(start: SocketAddress, end: SocketAddress): void; - /** - * Adds a rule to block a range of IP addresses specified as a subnet mask. - * @since v15.0.0, v14.18.0 - * @param net The network IPv4 or IPv6 address. - * @param prefix The number of CIDR prefix bits. For IPv4, this must be a value between `0` and `32`. For IPv6, this must be between `0` and `128`. - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - addSubnet(net: SocketAddress, prefix: number): void; - addSubnet(net: string, prefix: number, type?: IPVersion): void; - /** - * Returns `true` if the given IP address matches any of the rules added to the`BlockList`. - * - * ```js - * const blockList = new net.BlockList(); - * blockList.addAddress('123.123.123.123'); - * blockList.addRange('10.0.0.1', '10.0.0.10'); - * blockList.addSubnet('8592:757c:efae:4e45::', 64, 'ipv6'); - * - * console.log(blockList.check('123.123.123.123')); // Prints: true - * console.log(blockList.check('10.0.0.3')); // Prints: true - * console.log(blockList.check('222.111.111.222')); // Prints: false - * - * // IPv6 notation for IPv4 addresses works: - * console.log(blockList.check('::ffff:7b7b:7b7b', 'ipv6')); // Prints: true - * console.log(blockList.check('::ffff:123.123.123.123', 'ipv6')); // Prints: true - * ``` - * @since v15.0.0, v14.18.0 - * @param address The IP address to check - * @param [type='ipv4'] Either `'ipv4'` or `'ipv6'`. - */ - check(address: SocketAddress): boolean; - check(address: string, type?: IPVersion): boolean; - } - interface TcpNetConnectOpts extends TcpSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - interface IpcNetConnectOpts extends IpcSocketConnectOpts, SocketConstructorOpts { - timeout?: number | undefined; - } - type NetConnectOpts = TcpNetConnectOpts | IpcNetConnectOpts; - /** - * Creates a new TCP or `IPC` server. - * - * If `allowHalfOpen` is set to `true`, when the other end of the socket - * signals the end of transmission, the server will only send back the end of - * transmission when `socket.end()` is explicitly called. For example, in the - * context of TCP, when a FIN packed is received, a FIN packed is sent - * back only when `socket.end()` is explicitly called. Until then the - * connection is half-closed (non-readable but still writable). See `'end'` event and [RFC 1122](https://tools.ietf.org/html/rfc1122) (section 4.2.2.13) for more information. - * - * If `pauseOnConnect` is set to `true`, then the socket associated with each - * incoming connection will be paused, and no data will be read from its handle. - * This allows connections to be passed between processes without any data being - * read by the original process. To begin reading data from a paused socket, call `socket.resume()`. - * - * The server can be a TCP server or an `IPC` server, depending on what it `listen()` to. - * - * Here is an example of a TCP echo server which listens for connections - * on port 8124: - * - * ```js - * const net = require('node:net'); - * const server = net.createServer((c) => { - * // 'connection' listener. - * console.log('client connected'); - * c.on('end', () => { - * console.log('client disconnected'); - * }); - * c.write('hello\r\n'); - * c.pipe(c); - * }); - * server.on('error', (err) => { - * throw err; - * }); - * server.listen(8124, () => { - * console.log('server bound'); - * }); - * ``` - * - * Test this by using `telnet`: - * - * ```bash - * telnet localhost 8124 - * ``` - * - * To listen on the socket `/tmp/echo.sock`: - * - * ```js - * server.listen('/tmp/echo.sock', () => { - * console.log('server bound'); - * }); - * ``` - * - * Use `nc` to connect to a Unix domain socket server: - * - * ```bash - * nc -U /tmp/echo.sock - * ``` - * @since v0.5.0 - * @param connectionListener Automatically set as a listener for the {@link 'connection'} event. - */ - function createServer(connectionListener?: (socket: Socket) => void): Server; - function createServer(options?: ServerOpts, connectionListener?: (socket: Socket) => void): Server; - /** - * Aliases to {@link createConnection}. - * - * Possible signatures: - * - * * {@link connect} - * * {@link connect} for `IPC` connections. - * * {@link connect} for TCP connections. - */ - function connect(options: NetConnectOpts, connectionListener?: () => void): Socket; - function connect(port: number, host?: string, connectionListener?: () => void): Socket; - function connect(path: string, connectionListener?: () => void): Socket; - /** - * A factory function, which creates a new {@link Socket}, - * immediately initiates connection with `socket.connect()`, - * then returns the `net.Socket` that starts the connection. - * - * When the connection is established, a `'connect'` event will be emitted - * on the returned socket. The last parameter `connectListener`, if supplied, - * will be added as a listener for the `'connect'` event **once**. - * - * Possible signatures: - * - * * {@link createConnection} - * * {@link createConnection} for `IPC` connections. - * * {@link createConnection} for TCP connections. - * - * The {@link connect} function is an alias to this function. - */ - function createConnection(options: NetConnectOpts, connectionListener?: () => void): Socket; - function createConnection(port: number, host?: string, connectionListener?: () => void): Socket; - function createConnection(path: string, connectionListener?: () => void): Socket; - /** - * Gets the current default value of the `autoSelectFamily` option of `socket.connect(options)`. - * The initial default value is `true`, unless the command line option`--no-network-family-autoselection` is provided. - * @since v19.4.0 - */ - function getDefaultAutoSelectFamily(): boolean; - /** - * Sets the default value of the `autoSelectFamily` option of `socket.connect(options)`. - * @since v19.4.0 - */ - function setDefaultAutoSelectFamily(value: boolean): void; - /** - * Gets the current default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * The initial default value is `250`. - * @since v19.8.0 - */ - function getDefaultAutoSelectFamilyAttemptTimeout(): number; - /** - * Sets the default value of the `autoSelectFamilyAttemptTimeout` option of `socket.connect(options)`. - * @since v19.8.0 - */ - function setDefaultAutoSelectFamilyAttemptTimeout(value: number): void; - /** - * Returns `6` if `input` is an IPv6 address. Returns `4` if `input` is an IPv4 - * address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no leading zeroes. Otherwise, returns`0`. - * - * ```js - * net.isIP('::1'); // returns 6 - * net.isIP('127.0.0.1'); // returns 4 - * net.isIP('127.000.000.001'); // returns 0 - * net.isIP('127.0.0.1/24'); // returns 0 - * net.isIP('fhqwhgads'); // returns 0 - * ``` - * @since v0.3.0 - */ - function isIP(input: string): number; - /** - * Returns `true` if `input` is an IPv4 address in [dot-decimal notation](https://en.wikipedia.org/wiki/Dot-decimal_notation) with no - * leading zeroes. Otherwise, returns `false`. - * - * ```js - * net.isIPv4('127.0.0.1'); // returns true - * net.isIPv4('127.000.000.001'); // returns false - * net.isIPv4('127.0.0.1/24'); // returns false - * net.isIPv4('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv4(input: string): boolean; - /** - * Returns `true` if `input` is an IPv6 address. Otherwise, returns `false`. - * - * ```js - * net.isIPv6('::1'); // returns true - * net.isIPv6('fhqwhgads'); // returns false - * ``` - * @since v0.3.0 - */ - function isIPv6(input: string): boolean; - interface SocketAddressInitOptions { - /** - * The network address as either an IPv4 or IPv6 string. - * @default 127.0.0.1 - */ - address?: string | undefined; - /** - * @default `'ipv4'` - */ - family?: IPVersion | undefined; - /** - * An IPv6 flow-label used only if `family` is `'ipv6'`. - * @default 0 - */ - flowlabel?: number | undefined; - /** - * An IP port. - * @default 0 - */ - port?: number | undefined; - } - /** - * @since v15.14.0, v14.18.0 - */ - class SocketAddress { - constructor(options: SocketAddressInitOptions); - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly address: string; - /** - * Either \`'ipv4'\` or \`'ipv6'\`. - * @since v15.14.0, v14.18.0 - */ - readonly family: IPVersion; - /** - * @since v15.14.0, v14.18.0 - */ - readonly port: number; - /** - * @since v15.14.0, v14.18.0 - */ - readonly flowlabel: number; - } -} -declare module "node:net" { - export * from "net"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/os.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/os.d.ts deleted file mode 100644 index 39a33f7f..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/os.d.ts +++ /dev/null @@ -1,478 +0,0 @@ -/** - * The `node:os` module provides operating system-related utility methods and - * properties. It can be accessed using: - * - * ```js - * const os = require('node:os'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/os.js) - */ -declare module "os" { - interface CpuInfo { - model: string; - speed: number; - times: { - user: number; - nice: number; - sys: number; - idle: number; - irq: number; - }; - } - interface NetworkInterfaceBase { - address: string; - netmask: string; - mac: string; - internal: boolean; - cidr: string | null; - } - interface NetworkInterfaceInfoIPv4 extends NetworkInterfaceBase { - family: "IPv4"; - scopeid?: undefined; - } - interface NetworkInterfaceInfoIPv6 extends NetworkInterfaceBase { - family: "IPv6"; - scopeid: number; - } - interface UserInfo { - username: T; - uid: number; - gid: number; - shell: T | null; - homedir: T; - } - type NetworkInterfaceInfo = NetworkInterfaceInfoIPv4 | NetworkInterfaceInfoIPv6; - /** - * Returns the host name of the operating system as a string. - * @since v0.3.3 - */ - function hostname(): string; - /** - * Returns an array containing the 1, 5, and 15 minute load averages. - * - * The load average is a measure of system activity calculated by the operating - * system and expressed as a fractional number. - * - * The load average is a Unix-specific concept. On Windows, the return value is - * always `[0, 0, 0]`. - * @since v0.3.3 - */ - function loadavg(): number[]; - /** - * Returns the system uptime in number of seconds. - * @since v0.3.3 - */ - function uptime(): number; - /** - * Returns the amount of free system memory in bytes as an integer. - * @since v0.3.3 - */ - function freemem(): number; - /** - * Returns the total amount of system memory in bytes as an integer. - * @since v0.3.3 - */ - function totalmem(): number; - /** - * Returns an array of objects containing information about each logical CPU core. - * The array will be empty if no CPU information is available, such as if the`/proc` file system is unavailable. - * - * The properties included on each object include: - * - * ```js - * [ - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 252020, - * nice: 0, - * sys: 30340, - * idle: 1070356870, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 306960, - * nice: 0, - * sys: 26980, - * idle: 1071569080, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 248450, - * nice: 0, - * sys: 21750, - * idle: 1070919370, - * irq: 0, - * }, - * }, - * { - * model: 'Intel(R) Core(TM) i7 CPU 860 @ 2.80GHz', - * speed: 2926, - * times: { - * user: 256880, - * nice: 0, - * sys: 19430, - * idle: 1070905480, - * irq: 20, - * }, - * }, - * ] - * ``` - * - * `nice` values are POSIX-only. On Windows, the `nice` values of all processors - * are always 0. - * - * `os.cpus().length` should not be used to calculate the amount of parallelism - * available to an application. Use {@link availableParallelism} for this purpose. - * @since v0.3.3 - */ - function cpus(): CpuInfo[]; - /** - * Returns an estimate of the default amount of parallelism a program should use. - * Always returns a value greater than zero. - * - * This function is a small wrapper about libuv's [`uv_available_parallelism()`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_available_parallelism). - * @since v19.4.0, v18.14.0 - */ - function availableParallelism(): number; - /** - * Returns the operating system name as returned by [`uname(3)`](https://linux.die.net/man/3/uname). For example, it - * returns `'Linux'` on Linux, `'Darwin'` on macOS, and `'Windows_NT'` on Windows. - * - * See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for additional information - * about the output of running [`uname(3)`](https://linux.die.net/man/3/uname) on various operating systems. - * @since v0.3.3 - */ - function type(): string; - /** - * Returns the operating system as a string. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `GetVersionExW()` is used. See - * [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v0.3.3 - */ - function release(): string; - /** - * Returns an object containing network interfaces that have been assigned a - * network address. - * - * Each key on the returned object identifies a network interface. The associated - * value is an array of objects that each describe an assigned network address. - * - * The properties available on the assigned network address object include: - * - * ```js - * { - * lo: [ - * { - * address: '127.0.0.1', - * netmask: '255.0.0.0', - * family: 'IPv4', - * mac: '00:00:00:00:00:00', - * internal: true, - * cidr: '127.0.0.1/8' - * }, - * { - * address: '::1', - * netmask: 'ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff', - * family: 'IPv6', - * mac: '00:00:00:00:00:00', - * scopeid: 0, - * internal: true, - * cidr: '::1/128' - * } - * ], - * eth0: [ - * { - * address: '192.168.1.108', - * netmask: '255.255.255.0', - * family: 'IPv4', - * mac: '01:02:03:0a:0b:0c', - * internal: false, - * cidr: '192.168.1.108/24' - * }, - * { - * address: 'fe80::a00:27ff:fe4e:66a1', - * netmask: 'ffff:ffff:ffff:ffff::', - * family: 'IPv6', - * mac: '01:02:03:0a:0b:0c', - * scopeid: 1, - * internal: false, - * cidr: 'fe80::a00:27ff:fe4e:66a1/64' - * } - * ] - * } - * ``` - * @since v0.6.0 - */ - function networkInterfaces(): NodeJS.Dict; - /** - * Returns the string path of the current user's home directory. - * - * On POSIX, it uses the `$HOME` environment variable if defined. Otherwise it - * uses the [effective UID](https://en.wikipedia.org/wiki/User_identifier#Effective_user_ID) to look up the user's home directory. - * - * On Windows, it uses the `USERPROFILE` environment variable if defined. - * Otherwise it uses the path to the profile directory of the current user. - * @since v2.3.0 - */ - function homedir(): string; - /** - * Returns information about the currently effective user. On POSIX platforms, - * this is typically a subset of the password file. The returned object includes - * the `username`, `uid`, `gid`, `shell`, and `homedir`. On Windows, the `uid` and`gid` fields are `-1`, and `shell` is `null`. - * - * The value of `homedir` returned by `os.userInfo()` is provided by the operating - * system. This differs from the result of `os.homedir()`, which queries - * environment variables for the home directory before falling back to the - * operating system response. - * - * Throws a `SystemError` if a user has no `username` or `homedir`. - * @since v6.0.0 - */ - function userInfo(options: { encoding: "buffer" }): UserInfo; - function userInfo(options?: { encoding: BufferEncoding }): UserInfo; - type SignalConstants = { - [key in NodeJS.Signals]: number; - }; - namespace constants { - const UV_UDP_REUSEADDR: number; - namespace signals {} - const signals: SignalConstants; - namespace errno { - const E2BIG: number; - const EACCES: number; - const EADDRINUSE: number; - const EADDRNOTAVAIL: number; - const EAFNOSUPPORT: number; - const EAGAIN: number; - const EALREADY: number; - const EBADF: number; - const EBADMSG: number; - const EBUSY: number; - const ECANCELED: number; - const ECHILD: number; - const ECONNABORTED: number; - const ECONNREFUSED: number; - const ECONNRESET: number; - const EDEADLK: number; - const EDESTADDRREQ: number; - const EDOM: number; - const EDQUOT: number; - const EEXIST: number; - const EFAULT: number; - const EFBIG: number; - const EHOSTUNREACH: number; - const EIDRM: number; - const EILSEQ: number; - const EINPROGRESS: number; - const EINTR: number; - const EINVAL: number; - const EIO: number; - const EISCONN: number; - const EISDIR: number; - const ELOOP: number; - const EMFILE: number; - const EMLINK: number; - const EMSGSIZE: number; - const EMULTIHOP: number; - const ENAMETOOLONG: number; - const ENETDOWN: number; - const ENETRESET: number; - const ENETUNREACH: number; - const ENFILE: number; - const ENOBUFS: number; - const ENODATA: number; - const ENODEV: number; - const ENOENT: number; - const ENOEXEC: number; - const ENOLCK: number; - const ENOLINK: number; - const ENOMEM: number; - const ENOMSG: number; - const ENOPROTOOPT: number; - const ENOSPC: number; - const ENOSR: number; - const ENOSTR: number; - const ENOSYS: number; - const ENOTCONN: number; - const ENOTDIR: number; - const ENOTEMPTY: number; - const ENOTSOCK: number; - const ENOTSUP: number; - const ENOTTY: number; - const ENXIO: number; - const EOPNOTSUPP: number; - const EOVERFLOW: number; - const EPERM: number; - const EPIPE: number; - const EPROTO: number; - const EPROTONOSUPPORT: number; - const EPROTOTYPE: number; - const ERANGE: number; - const EROFS: number; - const ESPIPE: number; - const ESRCH: number; - const ESTALE: number; - const ETIME: number; - const ETIMEDOUT: number; - const ETXTBSY: number; - const EWOULDBLOCK: number; - const EXDEV: number; - const WSAEINTR: number; - const WSAEBADF: number; - const WSAEACCES: number; - const WSAEFAULT: number; - const WSAEINVAL: number; - const WSAEMFILE: number; - const WSAEWOULDBLOCK: number; - const WSAEINPROGRESS: number; - const WSAEALREADY: number; - const WSAENOTSOCK: number; - const WSAEDESTADDRREQ: number; - const WSAEMSGSIZE: number; - const WSAEPROTOTYPE: number; - const WSAENOPROTOOPT: number; - const WSAEPROTONOSUPPORT: number; - const WSAESOCKTNOSUPPORT: number; - const WSAEOPNOTSUPP: number; - const WSAEPFNOSUPPORT: number; - const WSAEAFNOSUPPORT: number; - const WSAEADDRINUSE: number; - const WSAEADDRNOTAVAIL: number; - const WSAENETDOWN: number; - const WSAENETUNREACH: number; - const WSAENETRESET: number; - const WSAECONNABORTED: number; - const WSAECONNRESET: number; - const WSAENOBUFS: number; - const WSAEISCONN: number; - const WSAENOTCONN: number; - const WSAESHUTDOWN: number; - const WSAETOOMANYREFS: number; - const WSAETIMEDOUT: number; - const WSAECONNREFUSED: number; - const WSAELOOP: number; - const WSAENAMETOOLONG: number; - const WSAEHOSTDOWN: number; - const WSAEHOSTUNREACH: number; - const WSAENOTEMPTY: number; - const WSAEPROCLIM: number; - const WSAEUSERS: number; - const WSAEDQUOT: number; - const WSAESTALE: number; - const WSAEREMOTE: number; - const WSASYSNOTREADY: number; - const WSAVERNOTSUPPORTED: number; - const WSANOTINITIALISED: number; - const WSAEDISCON: number; - const WSAENOMORE: number; - const WSAECANCELLED: number; - const WSAEINVALIDPROCTABLE: number; - const WSAEINVALIDPROVIDER: number; - const WSAEPROVIDERFAILEDINIT: number; - const WSASYSCALLFAILURE: number; - const WSASERVICE_NOT_FOUND: number; - const WSATYPE_NOT_FOUND: number; - const WSA_E_NO_MORE: number; - const WSA_E_CANCELLED: number; - const WSAEREFUSED: number; - } - namespace priority { - const PRIORITY_LOW: number; - const PRIORITY_BELOW_NORMAL: number; - const PRIORITY_NORMAL: number; - const PRIORITY_ABOVE_NORMAL: number; - const PRIORITY_HIGH: number; - const PRIORITY_HIGHEST: number; - } - } - const devNull: string; - const EOL: string; - /** - * Returns the operating system CPU architecture for which the Node.js binary was - * compiled. Possible values are `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`,`'mips'`, `'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, - * and `'x64'`. - * - * The return value is equivalent to `process.arch`. - * @since v0.5.0 - */ - function arch(): string; - /** - * Returns a string identifying the kernel version. - * - * On POSIX systems, the operating system release is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v13.11.0, v12.17.0 - */ - function version(): string; - /** - * Returns a string identifying the operating system platform for which - * the Node.js binary was compiled. The value is set at compile time. - * Possible values are `'aix'`, `'darwin'`, `'freebsd'`,`'linux'`,`'openbsd'`, `'sunos'`, and `'win32'`. - * - * The return value is equivalent to `process.platform`. - * - * The value `'android'` may also be returned if Node.js is built on the Android - * operating system. [Android support is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.5.0 - */ - function platform(): NodeJS.Platform; - /** - * Returns the machine type as a string, such as `arm`, `arm64`, `aarch64`,`mips`, `mips64`, `ppc64`, `ppc64le`, `s390`, `s390x`, `i386`, `i686`, `x86_64`. - * - * On POSIX systems, the machine type is determined by calling [`uname(3)`](https://linux.die.net/man/3/uname). On Windows, `RtlGetVersion()` is used, and if it is not - * available, `GetVersionExW()` will be used. See [https://en.wikipedia.org/wiki/Uname#Examples](https://en.wikipedia.org/wiki/Uname#Examples) for more information. - * @since v18.9.0, v16.18.0 - */ - function machine(): string; - /** - * Returns the operating system's default directory for temporary files as a - * string. - * @since v0.9.9 - */ - function tmpdir(): string; - /** - * Returns a string identifying the endianness of the CPU for which the Node.js - * binary was compiled. - * - * Possible values are `'BE'` for big endian and `'LE'` for little endian. - * @since v0.9.4 - */ - function endianness(): "BE" | "LE"; - /** - * Returns the scheduling priority for the process specified by `pid`. If `pid` is - * not provided or is `0`, the priority of the current process is returned. - * @since v10.10.0 - * @param [pid=0] The process ID to retrieve scheduling priority for. - */ - function getPriority(pid?: number): number; - /** - * Attempts to set the scheduling priority for the process specified by `pid`. If`pid` is not provided or is `0`, the process ID of the current process is used. - * - * The `priority` input must be an integer between `-20` (high priority) and `19`(low priority). Due to differences between Unix priority levels and Windows - * priority classes, `priority` is mapped to one of six priority constants in`os.constants.priority`. When retrieving a process priority level, this range - * mapping may cause the return value to be slightly different on Windows. To avoid - * confusion, set `priority` to one of the priority constants. - * - * On Windows, setting priority to `PRIORITY_HIGHEST` requires elevated user - * privileges. Otherwise the set priority will be silently reduced to`PRIORITY_HIGH`. - * @since v10.10.0 - * @param [pid=0] The process ID to set scheduling priority for. - * @param priority The scheduling priority to assign to the process. - */ - function setPriority(priority: number): void; - function setPriority(pid: number, priority: number): void; -} -declare module "node:os" { - export * from "os"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/path.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/path.d.ts deleted file mode 100644 index 6f07681a..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/path.d.ts +++ /dev/null @@ -1,191 +0,0 @@ -declare module "path/posix" { - import path = require("path"); - export = path; -} -declare module "path/win32" { - import path = require("path"); - export = path; -} -/** - * The `node:path` module provides utilities for working with file and directory - * paths. It can be accessed using: - * - * ```js - * const path = require('node:path'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/path.js) - */ -declare module "path" { - namespace path { - /** - * A parsed path object generated by path.parse() or consumed by path.format(). - */ - interface ParsedPath { - /** - * The root of the path such as '/' or 'c:\' - */ - root: string; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir: string; - /** - * The file name including extension (if any) such as 'index.html' - */ - base: string; - /** - * The file extension (if any) such as '.html' - */ - ext: string; - /** - * The file name without extension (if any) such as 'index' - */ - name: string; - } - interface FormatInputPathObject { - /** - * The root of the path such as '/' or 'c:\' - */ - root?: string | undefined; - /** - * The full directory path such as '/home/user/dir' or 'c:\path\dir' - */ - dir?: string | undefined; - /** - * The file name including extension (if any) such as 'index.html' - */ - base?: string | undefined; - /** - * The file extension (if any) such as '.html' - */ - ext?: string | undefined; - /** - * The file name without extension (if any) such as 'index' - */ - name?: string | undefined; - } - interface PlatformPath { - /** - * Normalize a string path, reducing '..' and '.' parts. - * When multiple slashes are found, they're replaced by a single one; when the path contains a trailing slash, it is preserved. On Windows backslashes are used. - * - * @param path string path to normalize. - * @throws {TypeError} if `path` is not a string. - */ - normalize(path: string): string; - /** - * Join all arguments together and normalize the resulting path. - * - * @param paths paths to join. - * @throws {TypeError} if any of the path segments is not a string. - */ - join(...paths: string[]): string; - /** - * The right-most parameter is considered {to}. Other parameters are considered an array of {from}. - * - * Starting from leftmost {from} parameter, resolves {to} to an absolute path. - * - * If {to} isn't already absolute, {from} arguments are prepended in right to left order, - * until an absolute path is found. If after using all {from} paths still no absolute path is found, - * the current working directory is used as well. The resulting path is normalized, - * and trailing slashes are removed unless the path gets resolved to the root directory. - * - * @param paths A sequence of paths or path segments. - * @throws {TypeError} if any of the arguments is not a string. - */ - resolve(...paths: string[]): string; - /** - * Determines whether {path} is an absolute path. An absolute path will always resolve to the same location, regardless of the working directory. - * - * If the given {path} is a zero-length string, `false` will be returned. - * - * @param path path to test. - * @throws {TypeError} if `path` is not a string. - */ - isAbsolute(path: string): boolean; - /** - * Solve the relative path from {from} to {to} based on the current working directory. - * At times we have two absolute paths, and we need to derive the relative path from one to the other. This is actually the reverse transform of path.resolve. - * - * @throws {TypeError} if either `from` or `to` is not a string. - */ - relative(from: string, to: string): string; - /** - * Return the directory name of a path. Similar to the Unix dirname command. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - dirname(path: string): string; - /** - * Return the last portion of a path. Similar to the Unix basename command. - * Often used to extract the file name from a fully qualified path. - * - * @param path the path to evaluate. - * @param suffix optionally, an extension to remove from the result. - * @throws {TypeError} if `path` is not a string or if `ext` is given and is not a string. - */ - basename(path: string, suffix?: string): string; - /** - * Return the extension of the path, from the last '.' to end of string in the last portion of the path. - * If there is no '.' in the last portion of the path or the first character of it is '.', then it returns an empty string. - * - * @param path the path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - extname(path: string): string; - /** - * The platform-specific file separator. '\\' or '/'. - */ - readonly sep: "\\" | "/"; - /** - * The platform-specific file delimiter. ';' or ':'. - */ - readonly delimiter: ";" | ":"; - /** - * Returns an object from a path string - the opposite of format(). - * - * @param path path to evaluate. - * @throws {TypeError} if `path` is not a string. - */ - parse(path: string): ParsedPath; - /** - * Returns a path string from an object - the opposite of parse(). - * - * @param pathObject path to evaluate. - */ - format(pathObject: FormatInputPathObject): string; - /** - * On Windows systems only, returns an equivalent namespace-prefixed path for the given path. - * If path is not a string, path will be returned without modifications. - * This method is meaningful only on Windows system. - * On POSIX systems, the method is non-operational and always returns path without modifications. - */ - toNamespacedPath(path: string): string; - /** - * Posix specific pathing. - * Same as parent object on posix. - */ - readonly posix: PlatformPath; - /** - * Windows specific pathing. - * Same as parent object on windows - */ - readonly win32: PlatformPath; - } - } - const path: path.PlatformPath; - export = path; -} -declare module "node:path" { - import path = require("path"); - export = path; -} -declare module "node:path/posix" { - import path = require("path/posix"); - export = path; -} -declare module "node:path/win32" { - import path = require("path/win32"); - export = path; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/perf_hooks.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/perf_hooks.d.ts deleted file mode 100644 index 0e16e581..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/perf_hooks.d.ts +++ /dev/null @@ -1,639 +0,0 @@ -/** - * This module provides an implementation of a subset of the W3C [Web Performance APIs](https://w3c.github.io/perf-timing-primer/) as well as additional APIs for - * Node.js-specific performance measurements. - * - * Node.js supports the following [Web Performance APIs](https://w3c.github.io/perf-timing-primer/): - * - * * [High Resolution Time](https://www.w3.org/TR/hr-time-2) - * * [Performance Timeline](https://w3c.github.io/performance-timeline/) - * * [User Timing](https://www.w3.org/TR/user-timing/) - * * [Resource Timing](https://www.w3.org/TR/resource-timing-2/) - * - * ```js - * const { PerformanceObserver, performance } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((items) => { - * console.log(items.getEntries()[0].duration); - * performance.clearMarks(); - * }); - * obs.observe({ type: 'measure' }); - * performance.measure('Start to Now'); - * - * performance.mark('A'); - * doSomeLongRunningProcess(() => { - * performance.measure('A to Now', 'A'); - * - * performance.mark('B'); - * performance.measure('A to B', 'A', 'B'); - * }); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/perf_hooks.js) - */ -declare module "perf_hooks" { - import { AsyncResource } from "node:async_hooks"; - type EntryType = "node" | "mark" | "measure" | "gc" | "function" | "http2" | "http"; - interface NodeGCPerformanceDetail { - /** - * When `performanceEntry.entryType` is equal to 'gc', `the performance.kind` property identifies - * the type of garbage collection operation that occurred. - * See perf_hooks.constants for valid values. - */ - readonly kind?: number | undefined; - /** - * When `performanceEntry.entryType` is equal to 'gc', the `performance.flags` - * property contains additional information about garbage collection operation. - * See perf_hooks.constants for valid values. - */ - readonly flags?: number | undefined; - } - /** - * The constructor of this class is not exposed to users directly. - * @since v8.5.0 - */ - class PerformanceEntry { - protected constructor(); - /** - * The total number of milliseconds elapsed for this entry. This value will not - * be meaningful for all Performance Entry types. - * @since v8.5.0 - */ - readonly duration: number; - /** - * The name of the performance entry. - * @since v8.5.0 - */ - readonly name: string; - /** - * The high resolution millisecond timestamp marking the starting time of the - * Performance Entry. - * @since v8.5.0 - */ - readonly startTime: number; - /** - * The type of the performance entry. It may be one of: - * - * * `'node'` (Node.js only) - * * `'mark'` (available on the Web) - * * `'measure'` (available on the Web) - * * `'gc'` (Node.js only) - * * `'function'` (Node.js only) - * * `'http2'` (Node.js only) - * * `'http'` (Node.js only) - * @since v8.5.0 - */ - readonly entryType: EntryType; - /** - * Additional detail specific to the `entryType`. - * @since v16.0.0 - */ - readonly detail?: NodeGCPerformanceDetail | unknown | undefined; // TODO: Narrow this based on entry type. - toJSON(): any; - } - /** - * Exposes marks created via the `Performance.mark()` method. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMark extends PerformanceEntry { - readonly duration: 0; - readonly entryType: "mark"; - } - /** - * Exposes measures created via the `Performance.measure()` method. - * - * The constructor of this class is not exposed to users directly. - * @since v18.2.0, v16.17.0 - */ - class PerformanceMeasure extends PerformanceEntry { - readonly entryType: "measure"; - } - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Provides timing details for Node.js itself. The constructor of this class - * is not exposed to users. - * @since v8.5.0 - */ - class PerformanceNodeTiming extends PerformanceEntry { - /** - * The high resolution millisecond timestamp at which the Node.js process - * completed bootstrapping. If bootstrapping has not yet finished, the property - * has the value of -1. - * @since v8.5.0 - */ - readonly bootstrapComplete: number; - /** - * The high resolution millisecond timestamp at which the Node.js environment was - * initialized. - * @since v8.5.0 - */ - readonly environment: number; - /** - * The high resolution millisecond timestamp of the amount of time the event loop - * has been idle within the event loop's event provider (e.g. `epoll_wait`). This - * does not take CPU usage into consideration. If the event loop has not yet - * started (e.g., in the first tick of the main script), the property has the - * value of 0. - * @since v14.10.0, v12.19.0 - */ - readonly idleTime: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * exited. If the event loop has not yet exited, the property has the value of -1\. - * It can only have a value of not -1 in a handler of the `'exit'` event. - * @since v8.5.0 - */ - readonly loopExit: number; - /** - * The high resolution millisecond timestamp at which the Node.js event loop - * started. If the event loop has not yet started (e.g., in the first tick of the - * main script), the property has the value of -1. - * @since v8.5.0 - */ - readonly loopStart: number; - /** - * The high resolution millisecond timestamp at which the V8 platform was - * initialized. - * @since v8.5.0 - */ - readonly v8Start: number; - } - interface EventLoopUtilization { - idle: number; - active: number; - utilization: number; - } - /** - * @param util1 The result of a previous call to eventLoopUtilization() - * @param util2 The result of a previous call to eventLoopUtilization() prior to util1 - */ - type EventLoopUtilityFunction = ( - util1?: EventLoopUtilization, - util2?: EventLoopUtilization, - ) => EventLoopUtilization; - interface MarkOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown | undefined; - /** - * An optional timestamp to be used as the mark time. - * @default `performance.now()`. - */ - startTime?: number | undefined; - } - interface MeasureOptions { - /** - * Additional optional detail to include with the mark. - */ - detail?: unknown | undefined; - /** - * Duration between start and end times. - */ - duration?: number | undefined; - /** - * Timestamp to be used as the end time, or a string identifying a previously recorded mark. - */ - end?: number | string | undefined; - /** - * Timestamp to be used as the start time, or a string identifying a previously recorded mark. - */ - start?: number | string | undefined; - } - interface TimerifyOptions { - /** - * A histogram object created using - * `perf_hooks.createHistogram()` that will record runtime durations in - * nanoseconds. - */ - histogram?: RecordableHistogram | undefined; - } - interface Performance { - /** - * If name is not provided, removes all PerformanceMark objects from the Performance Timeline. - * If name is provided, removes only the named mark. - * @param name - */ - clearMarks(name?: string): void; - /** - * If name is not provided, removes all PerformanceMeasure objects from the Performance Timeline. - * If name is provided, removes only the named measure. - * @param name - * @since v16.7.0 - */ - clearMeasures(name?: string): void; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime`. - * If you are only interested in performance entries of certain types or that have certain names, see - * `performance.getEntriesByType()` and `performance.getEntriesByName()`. - * @since v16.7.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.name` is equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to `type`. - * @param name - * @param type - * @since v16.7.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order with respect to `performanceEntry.startTime` - * whose `performanceEntry.entryType` is equal to `type`. - * @param type - * @since v16.7.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - /** - * Creates a new PerformanceMark entry in the Performance Timeline. - * A PerformanceMark is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'mark', - * and whose performanceEntry.duration is always 0. - * Performance marks are used to mark specific significant moments in the Performance Timeline. - * @param name - * @return The PerformanceMark entry that was created - */ - mark(name?: string, options?: MarkOptions): PerformanceMark; - /** - * Creates a new PerformanceMeasure entry in the Performance Timeline. - * A PerformanceMeasure is a subclass of PerformanceEntry whose performanceEntry.entryType is always 'measure', - * and whose performanceEntry.duration measures the number of milliseconds elapsed since startMark and endMark. - * - * The startMark argument may identify any existing PerformanceMark in the the Performance Timeline, or may identify - * any of the timestamp properties provided by the PerformanceNodeTiming class. If the named startMark does not exist, - * then startMark is set to timeOrigin by default. - * - * The endMark argument must identify any existing PerformanceMark in the the Performance Timeline or any of the timestamp - * properties provided by the PerformanceNodeTiming class. If the named endMark does not exist, an error will be thrown. - * @param name - * @param startMark - * @param endMark - * @return The PerformanceMeasure entry that was created - */ - measure(name: string, startMark?: string, endMark?: string): PerformanceMeasure; - measure(name: string, options: MeasureOptions): PerformanceMeasure; - /** - * An instance of the PerformanceNodeTiming class that provides performance metrics for specific Node.js operational milestones. - */ - readonly nodeTiming: PerformanceNodeTiming; - /** - * @return the current high resolution millisecond timestamp - */ - now(): number; - /** - * The timeOrigin specifies the high resolution millisecond timestamp from which all performance metric durations are measured. - */ - readonly timeOrigin: number; - /** - * Wraps a function within a new function that measures the running time of the wrapped function. - * A PerformanceObserver must be subscribed to the 'function' event type in order for the timing details to be accessed. - * @param fn - */ - timerify any>(fn: T, options?: TimerifyOptions): T; - /** - * eventLoopUtilization is similar to CPU utilization except that it is calculated using high precision wall-clock time. - * It represents the percentage of time the event loop has spent outside the event loop's event provider (e.g. epoll_wait). - * No other CPU idle time is taken into consideration. - */ - eventLoopUtilization: EventLoopUtilityFunction; - } - interface PerformanceObserverEntryList { - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntries()); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 81.465639, - * * duration: 0 - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 81.860064, - * * duration: 0 - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntries(): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.name` is - * equal to `name`, and optionally, whose `performanceEntry.entryType` is equal to`type`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByName('meow')); - * - * * [ - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 98.545991, - * * duration: 0 - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('nope')); // [] - * - * console.log(perfObserverList.getEntriesByName('test', 'mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 63.518931, - * * duration: 0 - * * } - * * ] - * - * console.log(perfObserverList.getEntriesByName('test', 'measure')); // [] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ entryTypes: ['mark', 'measure'] }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByName(name: string, type?: EntryType): PerformanceEntry[]; - /** - * Returns a list of `PerformanceEntry` objects in chronological order - * with respect to `performanceEntry.startTime` whose `performanceEntry.entryType`is equal to `type`. - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((perfObserverList, observer) => { - * console.log(perfObserverList.getEntriesByType('mark')); - * - * * [ - * * PerformanceEntry { - * * name: 'test', - * * entryType: 'mark', - * * startTime: 55.897834, - * * duration: 0 - * * }, - * * PerformanceEntry { - * * name: 'meow', - * * entryType: 'mark', - * * startTime: 56.350146, - * * duration: 0 - * * } - * * ] - * - * performance.clearMarks(); - * performance.clearMeasures(); - * observer.disconnect(); - * }); - * obs.observe({ type: 'mark' }); - * - * performance.mark('test'); - * performance.mark('meow'); - * ``` - * @since v8.5.0 - */ - getEntriesByType(type: EntryType): PerformanceEntry[]; - } - type PerformanceObserverCallback = (list: PerformanceObserverEntryList, observer: PerformanceObserver) => void; - /** - * @since v8.5.0 - */ - class PerformanceObserver extends AsyncResource { - constructor(callback: PerformanceObserverCallback); - /** - * Disconnects the `PerformanceObserver` instance from all notifications. - * @since v8.5.0 - */ - disconnect(): void; - /** - * Subscribes the `PerformanceObserver` instance to notifications of new `PerformanceEntry` instances identified either by `options.entryTypes`or `options.type`: - * - * ```js - * const { - * performance, - * PerformanceObserver, - * } = require('node:perf_hooks'); - * - * const obs = new PerformanceObserver((list, observer) => { - * // Called once asynchronously. `list` contains three items. - * }); - * obs.observe({ type: 'mark' }); - * - * for (let n = 0; n < 3; n++) - * performance.mark(`test${n}`); - * ``` - * @since v8.5.0 - */ - observe( - options: - | { - entryTypes: readonly EntryType[]; - buffered?: boolean | undefined; - } - | { - type: EntryType; - buffered?: boolean | undefined; - }, - ): void; - } - namespace constants { - const NODE_PERFORMANCE_GC_MAJOR: number; - const NODE_PERFORMANCE_GC_MINOR: number; - const NODE_PERFORMANCE_GC_INCREMENTAL: number; - const NODE_PERFORMANCE_GC_WEAKCB: number; - const NODE_PERFORMANCE_GC_FLAGS_NO: number; - const NODE_PERFORMANCE_GC_FLAGS_CONSTRUCT_RETAINED: number; - const NODE_PERFORMANCE_GC_FLAGS_FORCED: number; - const NODE_PERFORMANCE_GC_FLAGS_SYNCHRONOUS_PHANTOM_PROCESSING: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_AVAILABLE_GARBAGE: number; - const NODE_PERFORMANCE_GC_FLAGS_ALL_EXTERNAL_MEMORY: number; - const NODE_PERFORMANCE_GC_FLAGS_SCHEDULE_IDLE: number; - } - const performance: Performance; - interface EventLoopMonitorOptions { - /** - * The sampling rate in milliseconds. - * Must be greater than zero. - * @default 10 - */ - resolution?: number | undefined; - } - interface Histogram { - /** - * Returns a `Map` object detailing the accumulated percentile distribution. - * @since v11.10.0 - */ - readonly percentiles: Map; - /** - * The number of times the event loop delay exceeded the maximum 1 hour event - * loop delay threshold. - * @since v11.10.0 - */ - readonly exceeds: number; - /** - * The minimum recorded event loop delay. - * @since v11.10.0 - */ - readonly min: number; - /** - * The maximum recorded event loop delay. - * @since v11.10.0 - */ - readonly max: number; - /** - * The mean of the recorded event loop delays. - * @since v11.10.0 - */ - readonly mean: number; - /** - * The standard deviation of the recorded event loop delays. - * @since v11.10.0 - */ - readonly stddev: number; - /** - * Resets the collected histogram data. - * @since v11.10.0 - */ - reset(): void; - /** - * Returns the value at the given percentile. - * @since v11.10.0 - * @param percentile A percentile value in the range (0, 100]. - */ - percentile(percentile: number): number; - } - interface IntervalHistogram extends Histogram { - /** - * Enables the update interval timer. Returns `true` if the timer was - * started, `false` if it was already started. - * @since v11.10.0 - */ - enable(): boolean; - /** - * Disables the update interval timer. Returns `true` if the timer was - * stopped, `false` if it was already stopped. - * @since v11.10.0 - */ - disable(): boolean; - } - interface RecordableHistogram extends Histogram { - /** - * @since v15.9.0, v14.18.0 - * @param val The amount to record in the histogram. - */ - record(val: number | bigint): void; - /** - * Calculates the amount of time (in nanoseconds) that has passed since the - * previous call to `recordDelta()` and records that amount in the histogram. - * - * ## Examples - * @since v15.9.0, v14.18.0 - */ - recordDelta(): void; - /** - * Adds the values from `other` to this histogram. - * @since v17.4.0, v16.14.0 - */ - add(other: RecordableHistogram): void; - } - /** - * _This property is an extension by Node.js. It is not available in Web browsers._ - * - * Creates an `IntervalHistogram` object that samples and reports the event loop - * delay over time. The delays will be reported in nanoseconds. - * - * Using a timer to detect approximate event loop delay works because the - * execution of timers is tied specifically to the lifecycle of the libuv - * event loop. That is, a delay in the loop will cause a delay in the execution - * of the timer, and those delays are specifically what this API is intended to - * detect. - * - * ```js - * const { monitorEventLoopDelay } = require('node:perf_hooks'); - * const h = monitorEventLoopDelay({ resolution: 20 }); - * h.enable(); - * // Do something. - * h.disable(); - * console.log(h.min); - * console.log(h.max); - * console.log(h.mean); - * console.log(h.stddev); - * console.log(h.percentiles); - * console.log(h.percentile(50)); - * console.log(h.percentile(99)); - * ``` - * @since v11.10.0 - */ - function monitorEventLoopDelay(options?: EventLoopMonitorOptions): IntervalHistogram; - interface CreateHistogramOptions { - /** - * The minimum recordable value. Must be an integer value greater than 0. - * @default 1 - */ - min?: number | bigint | undefined; - /** - * The maximum recordable value. Must be an integer value greater than min. - * @default Number.MAX_SAFE_INTEGER - */ - max?: number | bigint | undefined; - /** - * The number of accuracy digits. Must be a number between 1 and 5. - * @default 3 - */ - figures?: number | undefined; - } - /** - * Returns a `RecordableHistogram`. - * @since v15.9.0, v14.18.0 - */ - function createHistogram(options?: CreateHistogramOptions): RecordableHistogram; - import { performance as _performance } from "perf_hooks"; - global { - /** - * `performance` is a global reference for `require('perf_hooks').performance` - * https://nodejs.org/api/globals.html#performance - * @since v16.0.0 - */ - var performance: typeof globalThis extends { - onmessage: any; - performance: infer T; - } ? T - : typeof _performance; - } -} -declare module "node:perf_hooks" { - export * from "perf_hooks"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/process.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/process.d.ts deleted file mode 100644 index 0e274737..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/process.d.ts +++ /dev/null @@ -1,1539 +0,0 @@ -declare module "process" { - import * as tty from "node:tty"; - import { Worker } from "node:worker_threads"; - global { - var process: NodeJS.Process; - namespace NodeJS { - // this namespace merge is here because these are specifically used - // as the type for process.stdin, process.stdout, and process.stderr. - // they can't live in tty.d.ts because we need to disambiguate the imported name. - interface ReadStream extends tty.ReadStream {} - interface WriteStream extends tty.WriteStream {} - interface MemoryUsageFn { - /** - * The `process.memoryUsage()` method iterate over each page to gather informations about memory - * usage which can be slow depending on the program memory allocations. - */ - (): MemoryUsage; - /** - * method returns an integer representing the Resident Set Size (RSS) in bytes. - */ - rss(): number; - } - interface MemoryUsage { - rss: number; - heapTotal: number; - heapUsed: number; - external: number; - arrayBuffers: number; - } - interface CpuUsage { - user: number; - system: number; - } - interface ProcessRelease { - name: string; - sourceUrl?: string | undefined; - headersUrl?: string | undefined; - libUrl?: string | undefined; - lts?: string | undefined; - } - interface ProcessVersions extends Dict { - http_parser: string; - node: string; - v8: string; - ares: string; - uv: string; - zlib: string; - modules: string; - openssl: string; - } - type Platform = - | "aix" - | "android" - | "darwin" - | "freebsd" - | "haiku" - | "linux" - | "openbsd" - | "sunos" - | "win32" - | "cygwin" - | "netbsd"; - type Architecture = - | "arm" - | "arm64" - | "ia32" - | "mips" - | "mipsel" - | "ppc" - | "ppc64" - | "riscv64" - | "s390" - | "s390x" - | "x64"; - type Signals = - | "SIGABRT" - | "SIGALRM" - | "SIGBUS" - | "SIGCHLD" - | "SIGCONT" - | "SIGFPE" - | "SIGHUP" - | "SIGILL" - | "SIGINT" - | "SIGIO" - | "SIGIOT" - | "SIGKILL" - | "SIGPIPE" - | "SIGPOLL" - | "SIGPROF" - | "SIGPWR" - | "SIGQUIT" - | "SIGSEGV" - | "SIGSTKFLT" - | "SIGSTOP" - | "SIGSYS" - | "SIGTERM" - | "SIGTRAP" - | "SIGTSTP" - | "SIGTTIN" - | "SIGTTOU" - | "SIGUNUSED" - | "SIGURG" - | "SIGUSR1" - | "SIGUSR2" - | "SIGVTALRM" - | "SIGWINCH" - | "SIGXCPU" - | "SIGXFSZ" - | "SIGBREAK" - | "SIGLOST" - | "SIGINFO"; - type UncaughtExceptionOrigin = "uncaughtException" | "unhandledRejection"; - type MultipleResolveType = "resolve" | "reject"; - type BeforeExitListener = (code: number) => void; - type DisconnectListener = () => void; - type ExitListener = (code: number) => void; - type RejectionHandledListener = (promise: Promise) => void; - type UncaughtExceptionListener = (error: Error, origin: UncaughtExceptionOrigin) => void; - /** - * Most of the time the unhandledRejection will be an Error, but this should not be relied upon - * as *anything* can be thrown/rejected, it is therefore unsafe to assume that the value is an Error. - */ - type UnhandledRejectionListener = (reason: unknown, promise: Promise) => void; - type WarningListener = (warning: Error) => void; - type MessageListener = (message: unknown, sendHandle: unknown) => void; - type SignalsListener = (signal: Signals) => void; - type MultipleResolveListener = ( - type: MultipleResolveType, - promise: Promise, - value: unknown, - ) => void; - type WorkerListener = (worker: Worker) => void; - interface Socket extends ReadWriteStream { - isTTY?: true | undefined; - } - // Alias for compatibility - interface ProcessEnv extends Dict { - /** - * Can be used to change the default timezone at runtime - */ - TZ?: string; - } - interface HRTime { - (time?: [number, number]): [number, number]; - bigint(): bigint; - } - interface ProcessReport { - /** - * Directory where the report is written. - * working directory of the Node.js process. - * @default '' indicating that reports are written to the current - */ - directory: string; - /** - * Filename where the report is written. - * The default value is the empty string. - * @default '' the output filename will be comprised of a timestamp, - * PID, and sequence number. - */ - filename: string; - /** - * Returns a JSON-formatted diagnostic report for the running process. - * The report's JavaScript stack trace is taken from err, if present. - */ - getReport(err?: Error): string; - /** - * If true, a diagnostic report is generated on fatal errors, - * such as out of memory errors or failed C++ assertions. - * @default false - */ - reportOnFatalError: boolean; - /** - * If true, a diagnostic report is generated when the process - * receives the signal specified by process.report.signal. - * @default false - */ - reportOnSignal: boolean; - /** - * If true, a diagnostic report is generated on uncaught exception. - * @default false - */ - reportOnUncaughtException: boolean; - /** - * The signal used to trigger the creation of a diagnostic report. - * @default 'SIGUSR2' - */ - signal: Signals; - /** - * Writes a diagnostic report to a file. If filename is not provided, the default filename - * includes the date, time, PID, and a sequence number. - * The report's JavaScript stack trace is taken from err, if present. - * - * @param fileName Name of the file where the report is written. - * This should be a relative path, that will be appended to the directory specified in - * `process.report.directory`, or the current working directory of the Node.js process, - * if unspecified. - * @param error A custom error used for reporting the JavaScript stack. - * @return Filename of the generated report. - */ - writeReport(fileName?: string): string; - writeReport(error?: Error): string; - writeReport(fileName?: string, err?: Error): string; - } - interface ResourceUsage { - fsRead: number; - fsWrite: number; - involuntaryContextSwitches: number; - ipcReceived: number; - ipcSent: number; - majorPageFault: number; - maxRSS: number; - minorPageFault: number; - sharedMemorySize: number; - signalsCount: number; - swappedOut: number; - systemCPUTime: number; - unsharedDataSize: number; - unsharedStackSize: number; - userCPUTime: number; - voluntaryContextSwitches: number; - } - interface EmitWarningOptions { - /** - * When `warning` is a `string`, `type` is the name to use for the _type_ of warning being emitted. - * - * @default 'Warning' - */ - type?: string | undefined; - /** - * A unique identifier for the warning instance being emitted. - */ - code?: string | undefined; - /** - * When `warning` is a `string`, `ctor` is an optional function used to limit the generated stack trace. - * - * @default process.emitWarning - */ - ctor?: Function | undefined; - /** - * Additional text to include with the error. - */ - detail?: string | undefined; - } - interface ProcessConfig { - readonly target_defaults: { - readonly cflags: any[]; - readonly default_configuration: string; - readonly defines: string[]; - readonly include_dirs: string[]; - readonly libraries: string[]; - }; - readonly variables: { - readonly clang: number; - readonly host_arch: string; - readonly node_install_npm: boolean; - readonly node_install_waf: boolean; - readonly node_prefix: string; - readonly node_shared_openssl: boolean; - readonly node_shared_v8: boolean; - readonly node_shared_zlib: boolean; - readonly node_use_dtrace: boolean; - readonly node_use_etw: boolean; - readonly node_use_openssl: boolean; - readonly target_arch: string; - readonly v8_no_strict_aliasing: number; - readonly v8_use_snapshot: boolean; - readonly visibility: string; - }; - } - interface Process extends EventEmitter { - /** - * The `process.stdout` property returns a stream connected to`stdout` (fd `1`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `1` refers to a file, in which case it is - * a `Writable` stream. - * - * For example, to copy `process.stdin` to `process.stdout`: - * - * ```js - * import { stdin, stdout } from 'node:process'; - * - * stdin.pipe(stdout); - * ``` - * - * `process.stdout` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stdout: WriteStream & { - fd: 1; - }; - /** - * The `process.stderr` property returns a stream connected to`stderr` (fd `2`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `2` refers to a file, in which case it is - * a `Writable` stream. - * - * `process.stderr` differs from other Node.js streams in important ways. See `note on process I/O` for more information. - */ - stderr: WriteStream & { - fd: 2; - }; - /** - * The `process.stdin` property returns a stream connected to`stdin` (fd `0`). It is a `net.Socket` (which is a `Duplex` stream) unless fd `0` refers to a file, in which case it is - * a `Readable` stream. - * - * For details of how to read from `stdin` see `readable.read()`. - * - * As a `Duplex` stream, `process.stdin` can also be used in "old" mode that - * is compatible with scripts written for Node.js prior to v0.10\. - * For more information see `Stream compatibility`. - * - * In "old" streams mode the `stdin` stream is paused by default, so one - * must call `process.stdin.resume()` to read from it. Note also that calling`process.stdin.resume()` itself would switch stream to "old" mode. - */ - stdin: ReadStream & { - fd: 0; - }; - openStdin(): Socket; - /** - * The `process.argv` property returns an array containing the command-line - * arguments passed when the Node.js process was launched. The first element will - * be {@link execPath}. See `process.argv0` if access to the original value - * of `argv[0]` is needed. The second element will be the path to the JavaScript - * file being executed. The remaining elements will be any additional command-line - * arguments. - * - * For example, assuming the following script for `process-args.js`: - * - * ```js - * import { argv } from 'node:process'; - * - * // print process.argv - * argv.forEach((val, index) => { - * console.log(`${index}: ${val}`); - * }); - * ``` - * - * Launching the Node.js process as: - * - * ```bash - * node process-args.js one two=three four - * ``` - * - * Would generate the output: - * - * ```text - * 0: /usr/local/bin/node - * 1: /Users/mjr/work/node/process-args.js - * 2: one - * 3: two=three - * 4: four - * ``` - * @since v0.1.27 - */ - argv: string[]; - /** - * The `process.argv0` property stores a read-only copy of the original value of`argv[0]` passed when Node.js starts. - * - * ```console - * $ bash -c 'exec -a customArgv0 ./node' - * > process.argv[0] - * '/Volumes/code/external/node/out/Release/node' - * > process.argv0 - * 'customArgv0' - * ``` - * @since v6.4.0 - */ - argv0: string; - /** - * The `process.execArgv` property returns the set of Node.js-specific command-line - * options passed when the Node.js process was launched. These options do not - * appear in the array returned by the {@link argv} property, and do not - * include the Node.js executable, the name of the script, or any options following - * the script name. These options are useful in order to spawn child processes with - * the same execution environment as the parent. - * - * ```bash - * node --harmony script.js --version - * ``` - * - * Results in `process.execArgv`: - * - * ```js - * ['--harmony'] - * ``` - * - * And `process.argv`: - * - * ```js - * ['/usr/local/bin/node', 'script.js', '--version'] - * ``` - * - * Refer to `Worker constructor` for the detailed behavior of worker - * threads with this property. - * @since v0.7.7 - */ - execArgv: string[]; - /** - * The `process.execPath` property returns the absolute pathname of the executable - * that started the Node.js process. Symbolic links, if any, are resolved. - * - * ```js - * '/usr/local/bin/node' - * ``` - * @since v0.1.100 - */ - execPath: string; - /** - * The `process.abort()` method causes the Node.js process to exit immediately and - * generate a core file. - * - * This feature is not available in `Worker` threads. - * @since v0.7.0 - */ - abort(): never; - /** - * The `process.chdir()` method changes the current working directory of the - * Node.js process or throws an exception if doing so fails (for instance, if - * the specified `directory` does not exist). - * - * ```js - * import { chdir, cwd } from 'node:process'; - * - * console.log(`Starting directory: ${cwd()}`); - * try { - * chdir('/tmp'); - * console.log(`New directory: ${cwd()}`); - * } catch (err) { - * console.error(`chdir: ${err}`); - * } - * ``` - * - * This feature is not available in `Worker` threads. - * @since v0.1.17 - */ - chdir(directory: string): void; - /** - * The `process.cwd()` method returns the current working directory of the Node.js - * process. - * - * ```js - * import { cwd } from 'node:process'; - * - * console.log(`Current directory: ${cwd()}`); - * ``` - * @since v0.1.8 - */ - cwd(): string; - /** - * The port used by the Node.js debugger when enabled. - * - * ```js - * import process from 'node:process'; - * - * process.debugPort = 5858; - * ``` - * @since v0.7.2 - */ - debugPort: number; - /** - * The `process.emitWarning()` method can be used to emit custom or application - * specific process warnings. These can be listened for by adding a handler to the `'warning'` event. - * - * ```js - * import { emitWarning } from 'node:process'; - * - * // Emit a warning with a code and additional detail. - * emitWarning('Something happened!', { - * code: 'MY_WARNING', - * detail: 'This is some additional information', - * }); - * // Emits: - * // (node:56338) [MY_WARNING] Warning: Something happened! - * // This is some additional information - * ``` - * - * In this example, an `Error` object is generated internally by`process.emitWarning()` and passed through to the `'warning'` handler. - * - * ```js - * import process from 'node:process'; - * - * process.on('warning', (warning) => { - * console.warn(warning.name); // 'Warning' - * console.warn(warning.message); // 'Something happened!' - * console.warn(warning.code); // 'MY_WARNING' - * console.warn(warning.stack); // Stack trace - * console.warn(warning.detail); // 'This is some additional information' - * }); - * ``` - * - * If `warning` is passed as an `Error` object, the `options` argument is ignored. - * @since v8.0.0 - * @param warning The warning to emit. - */ - emitWarning(warning: string | Error, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, ctor?: Function): void; - emitWarning(warning: string | Error, type?: string, code?: string, ctor?: Function): void; - emitWarning(warning: string | Error, options?: EmitWarningOptions): void; - /** - * The `process.env` property returns an object containing the user environment. - * See [`environ(7)`](http://man7.org/linux/man-pages/man7/environ.7.html). - * - * An example of this object looks like: - * - * ```js - * { - * TERM: 'xterm-256color', - * SHELL: '/usr/local/bin/bash', - * USER: 'maciej', - * PATH: '~/.bin/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin', - * PWD: '/Users/maciej', - * EDITOR: 'vim', - * SHLVL: '1', - * HOME: '/Users/maciej', - * LOGNAME: 'maciej', - * _: '/usr/local/bin/node' - * } - * ``` - * - * It is possible to modify this object, but such modifications will not be - * reflected outside the Node.js process, or (unless explicitly requested) - * to other `Worker` threads. - * In other words, the following example would not work: - * - * ```bash - * node -e 'process.env.foo = "bar"' && echo $foo - * ``` - * - * While the following will: - * - * ```js - * import { env } from 'node:process'; - * - * env.foo = 'bar'; - * console.log(env.foo); - * ``` - * - * Assigning a property on `process.env` will implicitly convert the value - * to a string. **This behavior is deprecated.** Future versions of Node.js may - * throw an error when the value is not a string, number, or boolean. - * - * ```js - * import { env } from 'node:process'; - * - * env.test = null; - * console.log(env.test); - * // => 'null' - * env.test = undefined; - * console.log(env.test); - * // => 'undefined' - * ``` - * - * Use `delete` to delete a property from `process.env`. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * delete env.TEST; - * console.log(env.TEST); - * // => undefined - * ``` - * - * On Windows operating systems, environment variables are case-insensitive. - * - * ```js - * import { env } from 'node:process'; - * - * env.TEST = 1; - * console.log(env.test); - * // => 1 - * ``` - * - * Unless explicitly specified when creating a `Worker` instance, - * each `Worker` thread has its own copy of `process.env`, based on its - * parent thread's `process.env`, or whatever was specified as the `env` option - * to the `Worker` constructor. Changes to `process.env` will not be visible - * across `Worker` threads, and only the main thread can make changes that - * are visible to the operating system or to native add-ons. On Windows, a copy of`process.env` on a `Worker` instance operates in a case-sensitive manner - * unlike the main thread. - * @since v0.1.27 - */ - env: ProcessEnv; - /** - * The `process.exit()` method instructs Node.js to terminate the process - * synchronously with an exit status of `code`. If `code` is omitted, exit uses - * either the 'success' code `0` or the value of `process.exitCode` if it has been - * set. Node.js will not terminate until all the `'exit'` event listeners are - * called. - * - * To exit with a 'failure' code: - * - * ```js - * import { exit } from 'node:process'; - * - * exit(1); - * ``` - * - * The shell that executed Node.js should see the exit code as `1`. - * - * Calling `process.exit()` will force the process to exit as quickly as possible - * even if there are still asynchronous operations pending that have not yet - * completed fully, including I/O operations to `process.stdout` and`process.stderr`. - * - * In most situations, it is not actually necessary to call `process.exit()`explicitly. The Node.js process will exit on its own _if there is no additional_ - * _work pending_ in the event loop. The `process.exitCode` property can be set to - * tell the process which exit code to use when the process exits gracefully. - * - * For instance, the following example illustrates a _misuse_ of the`process.exit()` method that could lead to data printed to stdout being - * truncated and lost: - * - * ```js - * import { exit } from 'node:process'; - * - * // This is an example of what *not* to do: - * if (someConditionNotMet()) { - * printUsageToStdout(); - * exit(1); - * } - * ``` - * - * The reason this is problematic is because writes to `process.stdout` in Node.js - * are sometimes _asynchronous_ and may occur over multiple ticks of the Node.js - * event loop. Calling `process.exit()`, however, forces the process to exit _before_ those additional writes to `stdout` can be performed. - * - * Rather than calling `process.exit()` directly, the code _should_ set the`process.exitCode` and allow the process to exit naturally by avoiding - * scheduling any additional work for the event loop: - * - * ```js - * import process from 'node:process'; - * - * // How to properly set the exit code while letting - * // the process exit gracefully. - * if (someConditionNotMet()) { - * printUsageToStdout(); - * process.exitCode = 1; - * } - * ``` - * - * If it is necessary to terminate the Node.js process due to an error condition, - * throwing an _uncaught_ error and allowing the process to terminate accordingly - * is safer than calling `process.exit()`. - * - * In `Worker` threads, this function stops the current thread rather - * than the current process. - * @since v0.1.13 - * @param [code=0] The exit code. For string type, only integer strings (e.g.,'1') are allowed. - */ - exit(code?: number): never; - /** - * A number which will be the process exit code, when the process either - * exits gracefully, or is exited via {@link exit} without specifying - * a code. - * - * Specifying a code to {@link exit} will override any - * previous setting of `process.exitCode`. - * @since v0.11.8 - */ - exitCode?: number | undefined; - /** - * The `process.getgid()` method returns the numerical group identity of the - * process. (See [`getgid(2)`](http://man7.org/linux/man-pages/man2/getgid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getgid) { - * console.log(`Current gid: ${process.getgid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.31 - */ - getgid?: () => number; - /** - * The `process.setgid()` method sets the group identity of the process. (See [`setgid(2)`](http://man7.org/linux/man-pages/man2/setgid.2.html).) The `id` can be passed as either a - * numeric ID or a group name - * string. If a group name is specified, this method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getgid && process.setgid) { - * console.log(`Current gid: ${process.getgid()}`); - * try { - * process.setgid(501); - * console.log(`New gid: ${process.getgid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.31 - * @param id The group name or ID - */ - setgid?: (id: number | string) => void; - /** - * The `process.getuid()` method returns the numeric user identity of the process. - * (See [`getuid(2)`](http://man7.org/linux/man-pages/man2/getuid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getuid) { - * console.log(`Current uid: ${process.getuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.1.28 - */ - getuid?: () => number; - /** - * The `process.setuid(id)` method sets the user identity of the process. (See [`setuid(2)`](http://man7.org/linux/man-pages/man2/setuid.2.html).) The `id` can be passed as either a - * numeric ID or a username string. - * If a username is specified, the method blocks while resolving the associated - * numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getuid && process.setuid) { - * console.log(`Current uid: ${process.getuid()}`); - * try { - * process.setuid(501); - * console.log(`New uid: ${process.getuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.1.28 - */ - setuid?: (id: number | string) => void; - /** - * The `process.geteuid()` method returns the numerical effective user identity of - * the process. (See [`geteuid(2)`](http://man7.org/linux/man-pages/man2/geteuid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.geteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - geteuid?: () => number; - /** - * The `process.seteuid()` method sets the effective user identity of the process. - * (See [`seteuid(2)`](http://man7.org/linux/man-pages/man2/seteuid.2.html).) The `id` can be passed as either a numeric ID or a username - * string. If a username is specified, the method blocks while resolving the - * associated numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.geteuid && process.seteuid) { - * console.log(`Current uid: ${process.geteuid()}`); - * try { - * process.seteuid(501); - * console.log(`New uid: ${process.geteuid()}`); - * } catch (err) { - * console.log(`Failed to set uid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A user name or ID - */ - seteuid?: (id: number | string) => void; - /** - * The `process.getegid()` method returns the numerical effective group identity - * of the Node.js process. (See [`getegid(2)`](http://man7.org/linux/man-pages/man2/getegid.2.html).) - * - * ```js - * import process from 'process'; - * - * if (process.getegid) { - * console.log(`Current gid: ${process.getegid()}`); - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v2.0.0 - */ - getegid?: () => number; - /** - * The `process.setegid()` method sets the effective group identity of the process. - * (See [`setegid(2)`](http://man7.org/linux/man-pages/man2/setegid.2.html).) The `id` can be passed as either a numeric ID or a group - * name string. If a group name is specified, this method blocks while resolving - * the associated a numeric ID. - * - * ```js - * import process from 'process'; - * - * if (process.getegid && process.setegid) { - * console.log(`Current gid: ${process.getegid()}`); - * try { - * process.setegid(501); - * console.log(`New gid: ${process.getegid()}`); - * } catch (err) { - * console.log(`Failed to set gid: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v2.0.0 - * @param id A group name or ID - */ - setegid?: (id: number | string) => void; - /** - * The `process.getgroups()` method returns an array with the supplementary group - * IDs. POSIX leaves it unspecified if the effective group ID is included but - * Node.js ensures it always is. - * - * ```js - * import process from 'process'; - * - * if (process.getgroups) { - * console.log(process.getgroups()); // [ 16, 21, 297 ] - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * @since v0.9.4 - */ - getgroups?: () => number[]; - /** - * The `process.setgroups()` method sets the supplementary group IDs for the - * Node.js process. This is a privileged operation that requires the Node.js - * process to have `root` or the `CAP_SETGID` capability. - * - * The `groups` array can contain numeric group IDs, group names, or both. - * - * ```js - * import process from 'process'; - * - * if (process.getgroups && process.setgroups) { - * try { - * process.setgroups([501]); - * console.log(process.getgroups()); // new groups - * } catch (err) { - * console.log(`Failed to set groups: ${err}`); - * } - * } - * ``` - * - * This function is only available on POSIX platforms (i.e. not Windows or - * Android). - * This feature is not available in `Worker` threads. - * @since v0.9.4 - */ - setgroups?: (groups: ReadonlyArray) => void; - /** - * The `process.setUncaughtExceptionCaptureCallback()` function sets a function - * that will be invoked when an uncaught exception occurs, which will receive the - * exception value itself as its first argument. - * - * If such a function is set, the `'uncaughtException'` event will - * not be emitted. If `--abort-on-uncaught-exception` was passed from the - * command line or set through `v8.setFlagsFromString()`, the process will - * not abort. Actions configured to take place on exceptions such as report - * generations will be affected too - * - * To unset the capture function,`process.setUncaughtExceptionCaptureCallback(null)` may be used. Calling this - * method with a non-`null` argument while another capture function is set will - * throw an error. - * - * Using this function is mutually exclusive with using the deprecated `domain` built-in module. - * @since v9.3.0 - */ - setUncaughtExceptionCaptureCallback(cb: ((err: Error) => void) | null): void; - /** - * Indicates whether a callback has been set using {@link setUncaughtExceptionCaptureCallback}. - * @since v9.3.0 - */ - hasUncaughtExceptionCaptureCallback(): boolean; - /** - * The `process.sourceMapsEnabled` property returns whether the [Source Map v3](https://sourcemaps.info/spec.html) support for stack traces is enabled. - * @since v20.7.0 - * @experimental - */ - readonly sourceMapsEnabled: boolean; - /** - * This function enables or disables the Source Map v3 support for stack traces. - * It provides same features as launching Node.js process with commandline options --enable-source-maps. - * @since v16.6.0 - * @experimental - */ - setSourceMapsEnabled(value: boolean): void; - /** - * The `process.version` property contains the Node.js version string. - * - * ```js - * import { version } from 'node:process'; - * - * console.log(`Version: ${version}`); - * // Version: v14.8.0 - * ``` - * - * To get the version string without the prepended _v_, use`process.versions.node`. - * @since v0.1.3 - */ - readonly version: string; - /** - * The `process.versions` property returns an object listing the version strings of - * Node.js and its dependencies. `process.versions.modules` indicates the current - * ABI version, which is increased whenever a C++ API changes. Node.js will refuse - * to load modules that were compiled against a different module ABI version. - * - * ```js - * import { versions } from 'node:process'; - * - * console.log(versions); - * ``` - * - * Will generate an object similar to: - * - * ```console - * { node: '20.2.0', - * acorn: '8.8.2', - * ada: '2.4.0', - * ares: '1.19.0', - * base64: '0.5.0', - * brotli: '1.0.9', - * cjs_module_lexer: '1.2.2', - * cldr: '43.0', - * icu: '73.1', - * llhttp: '8.1.0', - * modules: '115', - * napi: '8', - * nghttp2: '1.52.0', - * nghttp3: '0.7.0', - * ngtcp2: '0.8.1', - * openssl: '3.0.8+quic', - * simdutf: '3.2.9', - * tz: '2023c', - * undici: '5.22.0', - * unicode: '15.0', - * uv: '1.44.2', - * uvwasi: '0.0.16', - * v8: '11.3.244.8-node.9', - * zlib: '1.2.13' } - * ``` - * @since v0.2.0 - */ - readonly versions: ProcessVersions; - /** - * The `process.config` property returns a frozen `Object` containing the - * JavaScript representation of the configure options used to compile the current - * Node.js executable. This is the same as the `config.gypi` file that was produced - * when running the `./configure` script. - * - * An example of the possible output looks like: - * - * ```js - * { - * target_defaults: - * { cflags: [], - * default_configuration: 'Release', - * defines: [], - * include_dirs: [], - * libraries: [] }, - * variables: - * { - * host_arch: 'x64', - * napi_build_version: 5, - * node_install_npm: 'true', - * node_prefix: '', - * node_shared_cares: 'false', - * node_shared_http_parser: 'false', - * node_shared_libuv: 'false', - * node_shared_zlib: 'false', - * node_use_openssl: 'true', - * node_shared_openssl: 'false', - * strict_aliasing: 'true', - * target_arch: 'x64', - * v8_use_snapshot: 1 - * } - * } - * ``` - * @since v0.7.7 - */ - readonly config: ProcessConfig; - /** - * The `process.kill()` method sends the `signal` to the process identified by`pid`. - * - * Signal names are strings such as `'SIGINT'` or `'SIGHUP'`. See `Signal Events` and [`kill(2)`](http://man7.org/linux/man-pages/man2/kill.2.html) for more information. - * - * This method will throw an error if the target `pid` does not exist. As a special - * case, a signal of `0` can be used to test for the existence of a process. - * Windows platforms will throw an error if the `pid` is used to kill a process - * group. - * - * Even though the name of this function is `process.kill()`, it is really just a - * signal sender, like the `kill` system call. The signal sent may do something - * other than kill the target process. - * - * ```js - * import process, { kill } from 'node:process'; - * - * process.on('SIGHUP', () => { - * console.log('Got SIGHUP signal.'); - * }); - * - * setTimeout(() => { - * console.log('Exiting.'); - * process.exit(0); - * }, 100); - * - * kill(process.pid, 'SIGHUP'); - * ``` - * - * When `SIGUSR1` is received by a Node.js process, Node.js will start the - * debugger. See `Signal Events`. - * @since v0.0.6 - * @param pid A process ID - * @param [signal='SIGTERM'] The signal to send, either as a string or number. - */ - kill(pid: number, signal?: string | number): true; - /** - * The `process.pid` property returns the PID of the process. - * - * ```js - * import { pid } from 'node:process'; - * - * console.log(`This process is pid ${pid}`); - * ``` - * @since v0.1.15 - */ - readonly pid: number; - /** - * The `process.ppid` property returns the PID of the parent of the - * current process. - * - * ```js - * import { ppid } from 'node:process'; - * - * console.log(`The parent process is pid ${ppid}`); - * ``` - * @since v9.2.0, v8.10.0, v6.13.0 - */ - readonly ppid: number; - /** - * The `process.title` property returns the current process title (i.e. returns - * the current value of `ps`). Assigning a new value to `process.title` modifies - * the current value of `ps`. - * - * When a new value is assigned, different platforms will impose different maximum - * length restrictions on the title. Usually such restrictions are quite limited. - * For instance, on Linux and macOS, `process.title` is limited to the size of the - * binary name plus the length of the command-line arguments because setting the`process.title` overwrites the `argv` memory of the process. Node.js v0.8 - * allowed for longer process title strings by also overwriting the `environ`memory but that was potentially insecure and confusing in some (rather obscure) - * cases. - * - * Assigning a value to `process.title` might not result in an accurate label - * within process manager applications such as macOS Activity Monitor or Windows - * Services Manager. - * @since v0.1.104 - */ - title: string; - /** - * The operating system CPU architecture for which the Node.js binary was compiled. - * Possible values are: `'arm'`, `'arm64'`, `'ia32'`, `'loong64'`, `'mips'`,`'mipsel'`, `'ppc'`, `'ppc64'`, `'riscv64'`, `'s390'`, `'s390x'`, and `'x64'`. - * - * ```js - * import { arch } from 'node:process'; - * - * console.log(`This processor architecture is ${arch}`); - * ``` - * @since v0.5.0 - */ - readonly arch: Architecture; - /** - * The `process.platform` property returns a string identifying the operating - * system platform for which the Node.js binary was compiled. - * - * Currently possible values are: - * - * * `'aix'` - * * `'darwin'` - * * `'freebsd'` - * * `'linux'` - * * `'openbsd'` - * * `'sunos'` - * * `'win32'` - * - * ```js - * import { platform } from 'node:process'; - * - * console.log(`This platform is ${platform}`); - * ``` - * - * The value `'android'` may also be returned if the Node.js is built on the - * Android operating system. However, Android support in Node.js [is experimental](https://github.com/nodejs/node/blob/HEAD/BUILDING.md#androidandroid-based-devices-eg-firefox-os). - * @since v0.1.16 - */ - readonly platform: Platform; - /** - * The `process.mainModule` property provides an alternative way of retrieving `require.main`. The difference is that if the main module changes at - * runtime, `require.main` may still refer to the original main module in - * modules that were required before the change occurred. Generally, it's - * safe to assume that the two refer to the same module. - * - * As with `require.main`, `process.mainModule` will be `undefined` if there - * is no entry script. - * @since v0.1.17 - * @deprecated Since v14.0.0 - Use `main` instead. - */ - mainModule?: Module | undefined; - memoryUsage: MemoryUsageFn; - /** - * Gets the amount of memory available to the process (in bytes) based on - * limits imposed by the OS. If there is no such constraint, or the constraint - * is unknown, `undefined` is returned. - * - * See [`uv_get_constrained_memory`](https://docs.libuv.org/en/v1.x/misc.html#c.uv_get_constrained_memory) for more - * information. - * @since v19.6.0, v18.15.0 - * @experimental - */ - constrainedMemory(): number | undefined; - /** - * The `process.cpuUsage()` method returns the user and system CPU time usage of - * the current process, in an object with properties `user` and `system`, whose - * values are microsecond values (millionth of a second). These values measure time - * spent in user and system code respectively, and may end up being greater than - * actual elapsed time if multiple CPU cores are performing work for this process. - * - * The result of a previous call to `process.cpuUsage()` can be passed as the - * argument to the function, to get a diff reading. - * - * ```js - * import { cpuUsage } from 'node:process'; - * - * const startUsage = cpuUsage(); - * // { user: 38579, system: 6986 } - * - * // spin the CPU for 500 milliseconds - * const now = Date.now(); - * while (Date.now() - now < 500); - * - * console.log(cpuUsage(startUsage)); - * // { user: 514883, system: 11226 } - * ``` - * @since v6.1.0 - * @param previousValue A previous return value from calling `process.cpuUsage()` - */ - cpuUsage(previousValue?: CpuUsage): CpuUsage; - /** - * `process.nextTick()` adds `callback` to the "next tick queue". This queue is - * fully drained after the current operation on the JavaScript stack runs to - * completion and before the event loop is allowed to continue. It's possible to - * create an infinite loop if one were to recursively call `process.nextTick()`. - * See the [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#process-nexttick) guide for more background. - * - * ```js - * import { nextTick } from 'node:process'; - * - * console.log('start'); - * nextTick(() => { - * console.log('nextTick callback'); - * }); - * console.log('scheduled'); - * // Output: - * // start - * // scheduled - * // nextTick callback - * ``` - * - * This is important when developing APIs in order to give users the opportunity - * to assign event handlers _after_ an object has been constructed but before any - * I/O has occurred: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function MyThing(options) { - * this.setupOptions(options); - * - * nextTick(() => { - * this.startDoingStuff(); - * }); - * } - * - * const thing = new MyThing(); - * thing.getReadyForStuff(); - * - * // thing.startDoingStuff() gets called now, not before. - * ``` - * - * It is very important for APIs to be either 100% synchronous or 100% - * asynchronous. Consider this example: - * - * ```js - * // WARNING! DO NOT USE! BAD UNSAFE HAZARD! - * function maybeSync(arg, cb) { - * if (arg) { - * cb(); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * - * This API is hazardous because in the following case: - * - * ```js - * const maybeTrue = Math.random() > 0.5; - * - * maybeSync(maybeTrue, () => { - * foo(); - * }); - * - * bar(); - * ``` - * - * It is not clear whether `foo()` or `bar()` will be called first. - * - * The following approach is much better: - * - * ```js - * import { nextTick } from 'node:process'; - * - * function definitelyAsync(arg, cb) { - * if (arg) { - * nextTick(cb); - * return; - * } - * - * fs.stat('file', cb); - * } - * ``` - * @since v0.1.26 - * @param args Additional arguments to pass when invoking the `callback` - */ - nextTick(callback: Function, ...args: any[]): void; - /** - * The `process.release` property returns an `Object` containing metadata related - * to the current release, including URLs for the source tarball and headers-only - * tarball. - * - * `process.release` contains the following properties: - * - * ```js - * { - * name: 'node', - * lts: 'Hydrogen', - * sourceUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0.tar.gz', - * headersUrl: 'https://nodejs.org/download/release/v18.12.0/node-v18.12.0-headers.tar.gz', - * libUrl: 'https://nodejs.org/download/release/v18.12.0/win-x64/node.lib' - * } - * ``` - * - * In custom builds from non-release versions of the source tree, only the`name` property may be present. The additional properties should not be - * relied upon to exist. - * @since v3.0.0 - */ - readonly release: ProcessRelease; - features: { - inspector: boolean; - debug: boolean; - uv: boolean; - ipv6: boolean; - tls_alpn: boolean; - tls_sni: boolean; - tls_ocsp: boolean; - tls: boolean; - }; - /** - * `process.umask()` returns the Node.js process's file mode creation mask. Child - * processes inherit the mask from the parent process. - * @since v0.1.19 - * @deprecated Calling `process.umask()` with no argument causes the process-wide umask to be written twice. This introduces a race condition between threads, and is a potential * - * security vulnerability. There is no safe, cross-platform alternative API. - */ - umask(): number; - /** - * Can only be set if not in worker thread. - */ - umask(mask: string | number): number; - /** - * The `process.uptime()` method returns the number of seconds the current Node.js - * process has been running. - * - * The return value includes fractions of a second. Use `Math.floor()` to get whole - * seconds. - * @since v0.5.0 - */ - uptime(): number; - hrtime: HRTime; - /** - * If Node.js is spawned with an IPC channel, the `process.send()` method can be - * used to send messages to the parent process. Messages will be received as a `'message'` event on the parent's `ChildProcess` object. - * - * If Node.js was not spawned with an IPC channel, `process.send` will be `undefined`. - * - * The message goes through serialization and parsing. The resulting message might - * not be the same as what is originally sent. - * @since v0.5.9 - * @param options used to parameterize the sending of certain types of handles.`options` supports the following properties: - */ - send?( - message: any, - sendHandle?: any, - options?: { - swallowErrors?: boolean | undefined; - }, - callback?: (error: Error | null) => void, - ): boolean; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.disconnect()` method will close the - * IPC channel to the parent process, allowing the child process to exit gracefully - * once there are no other connections keeping it alive. - * - * The effect of calling `process.disconnect()` is the same as calling `ChildProcess.disconnect()` from the parent process. - * - * If the Node.js process was not spawned with an IPC channel,`process.disconnect()` will be `undefined`. - * @since v0.7.2 - */ - disconnect(): void; - /** - * If the Node.js process is spawned with an IPC channel (see the `Child Process` and `Cluster` documentation), the `process.connected` property will return`true` so long as the IPC - * channel is connected and will return `false` after`process.disconnect()` is called. - * - * Once `process.connected` is `false`, it is no longer possible to send messages - * over the IPC channel using `process.send()`. - * @since v0.7.2 - */ - connected: boolean; - /** - * The `process.allowedNodeEnvironmentFlags` property is a special, - * read-only `Set` of flags allowable within the `NODE_OPTIONS` environment variable. - * - * `process.allowedNodeEnvironmentFlags` extends `Set`, but overrides`Set.prototype.has` to recognize several different possible flag - * representations. `process.allowedNodeEnvironmentFlags.has()` will - * return `true` in the following cases: - * - * * Flags may omit leading single (`-`) or double (`--`) dashes; e.g.,`inspect-brk` for `--inspect-brk`, or `r` for `-r`. - * * Flags passed through to V8 (as listed in `--v8-options`) may replace - * one or more _non-leading_ dashes for an underscore, or vice-versa; - * e.g., `--perf_basic_prof`, `--perf-basic-prof`, `--perf_basic-prof`, - * etc. - * * Flags may contain one or more equals (`=`) characters; all - * characters after and including the first equals will be ignored; - * e.g., `--stack-trace-limit=100`. - * * Flags _must_ be allowable within `NODE_OPTIONS`. - * - * When iterating over `process.allowedNodeEnvironmentFlags`, flags will - * appear only _once_; each will begin with one or more dashes. Flags - * passed through to V8 will contain underscores instead of non-leading - * dashes: - * - * ```js - * import { allowedNodeEnvironmentFlags } from 'node:process'; - * - * allowedNodeEnvironmentFlags.forEach((flag) => { - * // -r - * // --inspect-brk - * // --abort_on_uncaught_exception - * // ... - * }); - * ``` - * - * The methods `add()`, `clear()`, and `delete()` of`process.allowedNodeEnvironmentFlags` do nothing, and will fail - * silently. - * - * If Node.js was compiled _without_ `NODE_OPTIONS` support (shown in {@link config}), `process.allowedNodeEnvironmentFlags` will - * contain what _would have_ been allowable. - * @since v10.10.0 - */ - allowedNodeEnvironmentFlags: ReadonlySet; - /** - * `process.report` is an object whose methods are used to generate diagnostic - * reports for the current process. Additional documentation is available in the `report documentation`. - * @since v11.8.0 - */ - report?: ProcessReport | undefined; - /** - * ```js - * import { resourceUsage } from 'node:process'; - * - * console.log(resourceUsage()); - * /* - * Will output: - * { - * userCPUTime: 82872, - * systemCPUTime: 4143, - * maxRSS: 33164, - * sharedMemorySize: 0, - * unsharedDataSize: 0, - * unsharedStackSize: 0, - * minorPageFault: 2469, - * majorPageFault: 0, - * swappedOut: 0, - * fsRead: 0, - * fsWrite: 8, - * ipcSent: 0, - * ipcReceived: 0, - * signalsCount: 0, - * voluntaryContextSwitches: 79, - * involuntaryContextSwitches: 1 - * } - * - * ``` - * @since v12.6.0 - * @return the resource usage for the current process. All of these values come from the `uv_getrusage` call which returns a [`uv_rusage_t` struct][uv_rusage_t]. - */ - resourceUsage(): ResourceUsage; - /** - * The `process.traceDeprecation` property indicates whether the`--trace-deprecation` flag is set on the current Node.js process. See the - * documentation for the `'warning' event` and the `emitWarning() method` for more information about this - * flag's behavior. - * @since v0.8.0 - */ - traceDeprecation: boolean; - /* EventEmitter */ - addListener(event: "beforeExit", listener: BeforeExitListener): this; - addListener(event: "disconnect", listener: DisconnectListener): this; - addListener(event: "exit", listener: ExitListener): this; - addListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - addListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - addListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - addListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - addListener(event: "warning", listener: WarningListener): this; - addListener(event: "message", listener: MessageListener): this; - addListener(event: Signals, listener: SignalsListener): this; - addListener(event: "multipleResolves", listener: MultipleResolveListener): this; - addListener(event: "worker", listener: WorkerListener): this; - emit(event: "beforeExit", code: number): boolean; - emit(event: "disconnect"): boolean; - emit(event: "exit", code: number): boolean; - emit(event: "rejectionHandled", promise: Promise): boolean; - emit(event: "uncaughtException", error: Error): boolean; - emit(event: "uncaughtExceptionMonitor", error: Error): boolean; - emit(event: "unhandledRejection", reason: unknown, promise: Promise): boolean; - emit(event: "warning", warning: Error): boolean; - emit(event: "message", message: unknown, sendHandle: unknown): this; - emit(event: Signals, signal?: Signals): boolean; - emit( - event: "multipleResolves", - type: MultipleResolveType, - promise: Promise, - value: unknown, - ): this; - emit(event: "worker", listener: WorkerListener): this; - on(event: "beforeExit", listener: BeforeExitListener): this; - on(event: "disconnect", listener: DisconnectListener): this; - on(event: "exit", listener: ExitListener): this; - on(event: "rejectionHandled", listener: RejectionHandledListener): this; - on(event: "uncaughtException", listener: UncaughtExceptionListener): this; - on(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - on(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - on(event: "warning", listener: WarningListener): this; - on(event: "message", listener: MessageListener): this; - on(event: Signals, listener: SignalsListener): this; - on(event: "multipleResolves", listener: MultipleResolveListener): this; - on(event: "worker", listener: WorkerListener): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "beforeExit", listener: BeforeExitListener): this; - once(event: "disconnect", listener: DisconnectListener): this; - once(event: "exit", listener: ExitListener): this; - once(event: "rejectionHandled", listener: RejectionHandledListener): this; - once(event: "uncaughtException", listener: UncaughtExceptionListener): this; - once(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - once(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - once(event: "warning", listener: WarningListener): this; - once(event: "message", listener: MessageListener): this; - once(event: Signals, listener: SignalsListener): this; - once(event: "multipleResolves", listener: MultipleResolveListener): this; - once(event: "worker", listener: WorkerListener): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "beforeExit", listener: BeforeExitListener): this; - prependListener(event: "disconnect", listener: DisconnectListener): this; - prependListener(event: "exit", listener: ExitListener): this; - prependListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependListener(event: "warning", listener: WarningListener): this; - prependListener(event: "message", listener: MessageListener): this; - prependListener(event: Signals, listener: SignalsListener): this; - prependListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependListener(event: "worker", listener: WorkerListener): this; - prependOnceListener(event: "beforeExit", listener: BeforeExitListener): this; - prependOnceListener(event: "disconnect", listener: DisconnectListener): this; - prependOnceListener(event: "exit", listener: ExitListener): this; - prependOnceListener(event: "rejectionHandled", listener: RejectionHandledListener): this; - prependOnceListener(event: "uncaughtException", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "uncaughtExceptionMonitor", listener: UncaughtExceptionListener): this; - prependOnceListener(event: "unhandledRejection", listener: UnhandledRejectionListener): this; - prependOnceListener(event: "warning", listener: WarningListener): this; - prependOnceListener(event: "message", listener: MessageListener): this; - prependOnceListener(event: Signals, listener: SignalsListener): this; - prependOnceListener(event: "multipleResolves", listener: MultipleResolveListener): this; - prependOnceListener(event: "worker", listener: WorkerListener): this; - listeners(event: "beforeExit"): BeforeExitListener[]; - listeners(event: "disconnect"): DisconnectListener[]; - listeners(event: "exit"): ExitListener[]; - listeners(event: "rejectionHandled"): RejectionHandledListener[]; - listeners(event: "uncaughtException"): UncaughtExceptionListener[]; - listeners(event: "uncaughtExceptionMonitor"): UncaughtExceptionListener[]; - listeners(event: "unhandledRejection"): UnhandledRejectionListener[]; - listeners(event: "warning"): WarningListener[]; - listeners(event: "message"): MessageListener[]; - listeners(event: Signals): SignalsListener[]; - listeners(event: "multipleResolves"): MultipleResolveListener[]; - listeners(event: "worker"): WorkerListener[]; - } - } - } - export = process; -} -declare module "node:process" { - import process = require("process"); - export = process; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/punycode.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/punycode.d.ts deleted file mode 100644 index d2fc9f9a..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/punycode.d.ts +++ /dev/null @@ -1,117 +0,0 @@ -/** - * **The version of the punycode module bundled in Node.js is being deprecated.**In a future major version of Node.js this module will be removed. Users - * currently depending on the `punycode` module should switch to using the - * userland-provided [Punycode.js](https://github.com/bestiejs/punycode.js) module instead. For punycode-based URL - * encoding, see `url.domainToASCII` or, more generally, the `WHATWG URL API`. - * - * The `punycode` module is a bundled version of the [Punycode.js](https://github.com/bestiejs/punycode.js) module. It - * can be accessed using: - * - * ```js - * const punycode = require('punycode'); - * ``` - * - * [Punycode](https://tools.ietf.org/html/rfc3492) is a character encoding scheme defined by RFC 3492 that is - * primarily intended for use in Internationalized Domain Names. Because host - * names in URLs are limited to ASCII characters only, Domain Names that contain - * non-ASCII characters must be converted into ASCII using the Punycode scheme. - * For instance, the Japanese character that translates into the English word,`'example'` is `'例'`. The Internationalized Domain Name, `'例.com'` (equivalent - * to `'example.com'`) is represented by Punycode as the ASCII string`'xn--fsq.com'`. - * - * The `punycode` module provides a simple implementation of the Punycode standard. - * - * The `punycode` module is a third-party dependency used by Node.js and - * made available to developers as a convenience. Fixes or other modifications to - * the module must be directed to the [Punycode.js](https://github.com/bestiejs/punycode.js) project. - * @deprecated Since v7.0.0 - Deprecated - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/punycode.js) - */ -declare module "punycode" { - /** - * The `punycode.decode()` method converts a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only - * characters to the equivalent string of Unicode codepoints. - * - * ```js - * punycode.decode('maana-pta'); // 'mañana' - * punycode.decode('--dqo34k'); // '☃-⌘' - * ``` - * @since v0.5.1 - */ - function decode(string: string): string; - /** - * The `punycode.encode()` method converts a string of Unicode codepoints to a [Punycode](https://tools.ietf.org/html/rfc3492) string of ASCII-only characters. - * - * ```js - * punycode.encode('mañana'); // 'maana-pta' - * punycode.encode('☃-⌘'); // '--dqo34k' - * ``` - * @since v0.5.1 - */ - function encode(string: string): string; - /** - * The `punycode.toUnicode()` method converts a string representing a domain name - * containing [Punycode](https://tools.ietf.org/html/rfc3492) encoded characters into Unicode. Only the [Punycode](https://tools.ietf.org/html/rfc3492) encoded parts of the domain name are be - * converted. - * - * ```js - * // decode domain names - * punycode.toUnicode('xn--maana-pta.com'); // 'mañana.com' - * punycode.toUnicode('xn----dqo34k.com'); // '☃-⌘.com' - * punycode.toUnicode('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toUnicode(domain: string): string; - /** - * The `punycode.toASCII()` method converts a Unicode string representing an - * Internationalized Domain Name to [Punycode](https://tools.ietf.org/html/rfc3492). Only the non-ASCII parts of the - * domain name will be converted. Calling `punycode.toASCII()` on a string that - * already only contains ASCII characters will have no effect. - * - * ```js - * // encode domain names - * punycode.toASCII('mañana.com'); // 'xn--maana-pta.com' - * punycode.toASCII('☃-⌘.com'); // 'xn----dqo34k.com' - * punycode.toASCII('example.com'); // 'example.com' - * ``` - * @since v0.6.1 - */ - function toASCII(domain: string): string; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const ucs2: ucs2; - interface ucs2 { - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - decode(string: string): number[]; - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - encode(codePoints: readonly number[]): string; - } - /** - * @deprecated since v7.0.0 - * The version of the punycode module bundled in Node.js is being deprecated. - * In a future major version of Node.js this module will be removed. - * Users currently depending on the punycode module should switch to using - * the userland-provided Punycode.js module instead. - */ - const version: string; -} -declare module "node:punycode" { - export * from "punycode"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/querystring.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/querystring.d.ts deleted file mode 100644 index 54ecc967..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/querystring.d.ts +++ /dev/null @@ -1,141 +0,0 @@ -/** - * The `node:querystring` module provides utilities for parsing and formatting URL - * query strings. It can be accessed using: - * - * ```js - * const querystring = require('node:querystring'); - * ``` - * - * `querystring` is more performant than `URLSearchParams` but is not a - * standardized API. Use `URLSearchParams` when performance is not critical or - * when compatibility with browser code is desirable. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/querystring.js) - */ -declare module "querystring" { - interface StringifyOptions { - encodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParseOptions { - maxKeys?: number | undefined; - decodeURIComponent?: ((str: string) => string) | undefined; - } - interface ParsedUrlQuery extends NodeJS.Dict {} - interface ParsedUrlQueryInput extends - NodeJS.Dict< - | string - | number - | boolean - | readonly string[] - | readonly number[] - | readonly boolean[] - | null - > - {} - /** - * The `querystring.stringify()` method produces a URL query string from a - * given `obj` by iterating through the object's "own properties". - * - * It serializes the following types of values passed in `obj`:[string](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) | - * [string\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type) | - * [number\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Number_type) | - * [bigint\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/BigInt) | - * [boolean\[\]](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Boolean_type) The numeric values must be finite. Any other input values will be coerced to - * empty strings. - * - * ```js - * querystring.stringify({ foo: 'bar', baz: ['qux', 'quux'], corge: '' }); - * // Returns 'foo=bar&baz=qux&baz=quux&corge=' - * - * querystring.stringify({ foo: 'bar', baz: 'qux' }, ';', ':'); - * // Returns 'foo:bar;baz:qux' - * ``` - * - * By default, characters requiring percent-encoding within the query string will - * be encoded as UTF-8\. If an alternative encoding is required, then an alternative`encodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkEncodeURIComponent function already exists, - * - * querystring.stringify({ w: '中文', foo: 'bar' }, null, null, - * { encodeURIComponent: gbkEncodeURIComponent }); - * ``` - * @since v0.1.25 - * @param obj The object to serialize into a URL query string - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] . The substring used to delimit keys and values in the query string. - */ - function stringify(obj?: ParsedUrlQueryInput, sep?: string, eq?: string, options?: StringifyOptions): string; - /** - * The `querystring.parse()` method parses a URL query string (`str`) into a - * collection of key and value pairs. - * - * For example, the query string `'foo=bar&abc=xyz&abc=123'` is parsed into: - * - * ```js - * { - * foo: 'bar', - * abc: ['xyz', '123'] - * } - * ``` - * - * The object returned by the `querystring.parse()` method _does not_prototypically inherit from the JavaScript `Object`. This means that typical`Object` methods such as `obj.toString()`, - * `obj.hasOwnProperty()`, and others - * are not defined and _will not work_. - * - * By default, percent-encoded characters within the query string will be assumed - * to use UTF-8 encoding. If an alternative character encoding is used, then an - * alternative `decodeURIComponent` option will need to be specified: - * - * ```js - * // Assuming gbkDecodeURIComponent function already exists... - * - * querystring.parse('w=%D6%D0%CE%C4&foo=bar', null, null, - * { decodeURIComponent: gbkDecodeURIComponent }); - * ``` - * @since v0.1.25 - * @param str The URL query string to parse - * @param [sep='&'] The substring used to delimit key and value pairs in the query string. - * @param [eq='='] . The substring used to delimit keys and values in the query string. - */ - function parse(str: string, sep?: string, eq?: string, options?: ParseOptions): ParsedUrlQuery; - /** - * The querystring.encode() function is an alias for querystring.stringify(). - */ - const encode: typeof stringify; - /** - * The querystring.decode() function is an alias for querystring.parse(). - */ - const decode: typeof parse; - /** - * The `querystring.escape()` method performs URL percent-encoding on the given`str` in a manner that is optimized for the specific requirements of URL - * query strings. - * - * The `querystring.escape()` method is used by `querystring.stringify()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement percent-encoding implementation if - * necessary by assigning `querystring.escape` to an alternative function. - * @since v0.1.25 - */ - function escape(str: string): string; - /** - * The `querystring.unescape()` method performs decoding of URL percent-encoded - * characters on the given `str`. - * - * The `querystring.unescape()` method is used by `querystring.parse()` and is - * generally not expected to be used directly. It is exported primarily to allow - * application code to provide a replacement decoding implementation if - * necessary by assigning `querystring.unescape` to an alternative function. - * - * By default, the `querystring.unescape()` method will attempt to use the - * JavaScript built-in `decodeURIComponent()` method to decode. If that fails, - * a safer equivalent that does not throw on malformed URLs will be used. - * @since v0.1.25 - */ - function unescape(str: string): string; -} -declare module "node:querystring" { - export * from "querystring"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/readline.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/readline.d.ts deleted file mode 100644 index b06d58b8..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/readline.d.ts +++ /dev/null @@ -1,539 +0,0 @@ -/** - * The `node:readline` module provides an interface for reading data from a `Readable` stream (such as `process.stdin`) one line at a time. - * - * To use the promise-based APIs: - * - * ```js - * import * as readline from 'node:readline/promises'; - * ``` - * - * To use the callback and sync APIs: - * - * ```js - * import * as readline from 'node:readline'; - * ``` - * - * The following simple example illustrates the basic use of the `node:readline`module. - * - * ```js - * import * as readline from 'node:readline/promises'; - * import { stdin as input, stdout as output } from 'node:process'; - * - * const rl = readline.createInterface({ input, output }); - * - * const answer = await rl.question('What do you think of Node.js? '); - * - * console.log(`Thank you for your valuable feedback: ${answer}`); - * - * rl.close(); - * ``` - * - * Once this code is invoked, the Node.js application will not terminate until the`readline.Interface` is closed because the interface waits for data to be - * received on the `input` stream. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/readline.js) - */ -declare module "readline" { - import { Abortable, EventEmitter } from "node:events"; - import * as promises from "node:readline/promises"; - export { promises }; - export interface Key { - sequence?: string | undefined; - name?: string | undefined; - ctrl?: boolean | undefined; - meta?: boolean | undefined; - shift?: boolean | undefined; - } - /** - * Instances of the `readline.Interface` class are constructed using the`readline.createInterface()` method. Every instance is associated with a - * single `input` `Readable` stream and a single `output` `Writable` stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v0.1.104 - */ - export class Interface extends EventEmitter { - readonly terminal: boolean; - /** - * The current input data being processed by node. - * - * This can be used when collecting input from a TTY stream to retrieve the - * current value that has been processed thus far, prior to the `line` event - * being emitted. Once the `line` event has been emitted, this property will - * be an empty string. - * - * Be aware that modifying the value during the instance runtime may have - * unintended consequences if `rl.cursor` is not also controlled. - * - * **If not using a TTY stream for input, use the `'line'` event.** - * - * One possible use case would be as follows: - * - * ```js - * const values = ['lorem ipsum', 'dolor sit amet']; - * const rl = readline.createInterface(process.stdin); - * const showResults = debounce(() => { - * console.log( - * '\n', - * values.filter((val) => val.startsWith(rl.line)).join(' '), - * ); - * }, 300); - * process.stdin.on('keypress', (c, k) => { - * showResults(); - * }); - * ``` - * @since v0.1.98 - */ - readonly line: string; - /** - * The cursor position relative to `rl.line`. - * - * This will track where the current cursor lands in the input string, when - * reading input from a TTY stream. The position of cursor determines the - * portion of the input string that will be modified as input is processed, - * as well as the column where the terminal caret will be rendered. - * @since v0.1.98 - */ - readonly cursor: number; - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ); - /** - * NOTE: According to the documentation: - * - * > Instances of the `readline.Interface` class are constructed using the - * > `readline.createInterface()` method. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#class-interfaceconstructor - */ - protected constructor(options: ReadLineOptions); - /** - * The `rl.getPrompt()` method returns the current prompt used by `rl.prompt()`. - * @since v15.3.0, v14.17.0 - * @return the current prompt string - */ - getPrompt(): string; - /** - * The `rl.setPrompt()` method sets the prompt that will be written to `output`whenever `rl.prompt()` is called. - * @since v0.1.98 - */ - setPrompt(prompt: string): void; - /** - * The `rl.prompt()` method writes the `Interface` instances configured`prompt` to a new line in `output` in order to provide a user with a new - * location at which to provide input. - * - * When called, `rl.prompt()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the prompt is not written. - * @since v0.1.98 - * @param preserveCursor If `true`, prevents the cursor placement from being reset to `0`. - */ - prompt(preserveCursor?: boolean): void; - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. - * - * The `callback` function passed to `rl.question()` does not follow the typical - * pattern of accepting an `Error` object or `null` as the first argument. - * The `callback` is called with the provided answer as the only argument. - * - * An error will be thrown if calling `rl.question()` after `rl.close()`. - * - * Example usage: - * - * ```js - * rl.question('What is your favorite food? ', (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * ``` - * - * Using an `AbortController` to cancel a question. - * - * ```js - * const ac = new AbortController(); - * const signal = ac.signal; - * - * rl.question('What is your favorite food? ', { signal }, (answer) => { - * console.log(`Oh, so your favorite food is ${answer}`); - * }); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * setTimeout(() => ac.abort(), 10000); - * ``` - * @since v0.3.3 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @param callback A callback function that is invoked with the user's input in response to the `query`. - */ - question(query: string, callback: (answer: string) => void): void; - question(query: string, options: Abortable, callback: (answer: string) => void): void; - /** - * The `rl.pause()` method pauses the `input` stream, allowing it to be resumed - * later if necessary. - * - * Calling `rl.pause()` does not immediately pause other events (including`'line'`) from being emitted by the `Interface` instance. - * @since v0.3.4 - */ - pause(): this; - /** - * The `rl.resume()` method resumes the `input` stream if it has been paused. - * @since v0.3.4 - */ - resume(): this; - /** - * The `rl.close()` method closes the `Interface` instance and - * relinquishes control over the `input` and `output` streams. When called, - * the `'close'` event will be emitted. - * - * Calling `rl.close()` does not immediately stop other events (including `'line'`) - * from being emitted by the `Interface` instance. - * @since v0.1.98 - */ - close(): void; - /** - * The `rl.write()` method will write either `data` or a key sequence identified - * by `key` to the `output`. The `key` argument is supported only if `output` is - * a `TTY` text terminal. See `TTY keybindings` for a list of key - * combinations. - * - * If `key` is specified, `data` is ignored. - * - * When called, `rl.write()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `data` and `key` are not written. - * - * ```js - * rl.write('Delete this!'); - * // Simulate Ctrl+U to delete the line written previously - * rl.write(null, { ctrl: true, name: 'u' }); - * ``` - * - * The `rl.write()` method will write the data to the `readline` `Interface`'s`input`_as if it were provided by the user_. - * @since v0.1.98 - */ - write(data: string | Buffer, key?: Key): void; - write(data: undefined | null | string | Buffer, key: Key): void; - /** - * Returns the real position of the cursor in relation to the input - * prompt + string. Long input (wrapping) strings, as well as multiple - * line prompts are included in the calculations. - * @since v13.5.0, v12.16.0 - */ - getCursorPos(): CursorPos; - /** - * events.EventEmitter - * 1. close - * 2. line - * 3. pause - * 4. resume - * 5. SIGCONT - * 6. SIGINT - * 7. SIGTSTP - * 8. history - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "history", listener: (history: string[]) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "history", history: string[]): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "history", listener: (history: string[]) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "history", listener: (history: string[]) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "history", listener: (history: string[]) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "history", listener: (history: string[]) => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - export type ReadLine = Interface; // type forwarded for backwards compatibility - export type Completer = (line: string) => CompleterResult; - export type AsyncCompleter = ( - line: string, - callback: (err?: null | Error, result?: CompleterResult) => void, - ) => void; - export type CompleterResult = [string[], string]; - export interface ReadLineOptions { - input: NodeJS.ReadableStream; - output?: NodeJS.WritableStream | undefined; - completer?: Completer | AsyncCompleter | undefined; - terminal?: boolean | undefined; - /** - * Initial list of history lines. This option makes sense - * only if `terminal` is set to `true` by the user or by an internal `output` - * check, otherwise the history caching mechanism is not initialized at all. - * @default [] - */ - history?: string[] | undefined; - historySize?: number | undefined; - prompt?: string | undefined; - crlfDelay?: number | undefined; - /** - * If `true`, when a new input line added - * to the history list duplicates an older one, this removes the older line - * from the list. - * @default false - */ - removeHistoryDuplicates?: boolean | undefined; - escapeCodeTimeout?: number | undefined; - tabSize?: number | undefined; - } - /** - * The `readline.createInterface()` method creates a new `readline.Interface`instance. - * - * ```js - * const readline = require('node:readline'); - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readline.Interface` instance is created, the most common case is to - * listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * - * When creating a `readline.Interface` using `stdin` as input, the program - * will not terminate until it receives an [EOF character](https://en.wikipedia.org/wiki/End-of-file#EOF_character). To exit without - * waiting for user input, call `process.stdin.unref()`. - * @since v0.1.98 - */ - export function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ): Interface; - export function createInterface(options: ReadLineOptions): Interface; - /** - * The `readline.emitKeypressEvents()` method causes the given `Readable` stream to begin emitting `'keypress'` events corresponding to received input. - * - * Optionally, `interface` specifies a `readline.Interface` instance for which - * autocompletion is disabled when copy-pasted input is detected. - * - * If the `stream` is a `TTY`, then it must be in raw mode. - * - * This is automatically called by any readline instance on its `input` if the`input` is a terminal. Closing the `readline` instance does not stop - * the `input` from emitting `'keypress'` events. - * - * ```js - * readline.emitKeypressEvents(process.stdin); - * if (process.stdin.isTTY) - * process.stdin.setRawMode(true); - * ``` - * - * ## Example: Tiny CLI - * - * The following example illustrates the use of `readline.Interface` class to - * implement a small command-line interface: - * - * ```js - * const readline = require('node:readline'); - * const rl = readline.createInterface({ - * input: process.stdin, - * output: process.stdout, - * prompt: 'OHAI> ', - * }); - * - * rl.prompt(); - * - * rl.on('line', (line) => { - * switch (line.trim()) { - * case 'hello': - * console.log('world!'); - * break; - * default: - * console.log(`Say what? I might have heard '${line.trim()}'`); - * break; - * } - * rl.prompt(); - * }).on('close', () => { - * console.log('Have a great day!'); - * process.exit(0); - * }); - * ``` - * - * ## Example: Read file stream line-by-Line - * - * A common use case for `readline` is to consume an input file one line at a - * time. The easiest way to do so is leveraging the `fs.ReadStream` API as - * well as a `for await...of` loop: - * - * ```js - * const fs = require('node:fs'); - * const readline = require('node:readline'); - * - * async function processLineByLine() { - * const fileStream = fs.createReadStream('input.txt'); - * - * const rl = readline.createInterface({ - * input: fileStream, - * crlfDelay: Infinity, - * }); - * // Note: we use the crlfDelay option to recognize all instances of CR LF - * // ('\r\n') in input.txt as a single line break. - * - * for await (const line of rl) { - * // Each line in input.txt will be successively available here as `line`. - * console.log(`Line from file: ${line}`); - * } - * } - * - * processLineByLine(); - * ``` - * - * Alternatively, one could use the `'line'` event: - * - * ```js - * const fs = require('node:fs'); - * const readline = require('node:readline'); - * - * const rl = readline.createInterface({ - * input: fs.createReadStream('sample.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * console.log(`Line from file: ${line}`); - * }); - * ``` - * - * Currently, `for await...of` loop can be a bit slower. If `async` / `await`flow and speed are both essential, a mixed approach can be applied: - * - * ```js - * const { once } = require('node:events'); - * const { createReadStream } = require('node:fs'); - * const { createInterface } = require('node:readline'); - * - * (async function processLineByLine() { - * try { - * const rl = createInterface({ - * input: createReadStream('big-file.txt'), - * crlfDelay: Infinity, - * }); - * - * rl.on('line', (line) => { - * // Process the line. - * }); - * - * await once(rl, 'close'); - * - * console.log('File processed.'); - * } catch (err) { - * console.error(err); - * } - * })(); - * ``` - * @since v0.7.7 - */ - export function emitKeypressEvents(stream: NodeJS.ReadableStream, readlineInterface?: Interface): void; - export type Direction = -1 | 0 | 1; - export interface CursorPos { - rows: number; - cols: number; - } - /** - * The `readline.clearLine()` method clears current line of given `TTY` stream - * in a specified direction identified by `dir`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearLine(stream: NodeJS.WritableStream, dir: Direction, callback?: () => void): boolean; - /** - * The `readline.clearScreenDown()` method clears the given `TTY` stream from - * the current position of the cursor down. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function clearScreenDown(stream: NodeJS.WritableStream, callback?: () => void): boolean; - /** - * The `readline.cursorTo()` method moves cursor to the specified position in a - * given `TTY` `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function cursorTo(stream: NodeJS.WritableStream, x: number, y?: number, callback?: () => void): boolean; - /** - * The `readline.moveCursor()` method moves the cursor _relative_ to its current - * position in a given `TTY` `stream`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if `stream` wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - export function moveCursor(stream: NodeJS.WritableStream, dx: number, dy: number, callback?: () => void): boolean; -} -declare module "node:readline" { - export * from "readline"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/readline/promises.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/readline/promises.d.ts deleted file mode 100644 index 73fb1115..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/readline/promises.d.ts +++ /dev/null @@ -1,150 +0,0 @@ -/** - * @since v17.0.0 - * @experimental - */ -declare module "readline/promises" { - import { AsyncCompleter, Completer, Direction, Interface as _Interface, ReadLineOptions } from "node:readline"; - import { Abortable } from "node:events"; - /** - * Instances of the `readlinePromises.Interface` class are constructed using the`readlinePromises.createInterface()` method. Every instance is associated with a - * single `input` `Readable` stream and a single `output` `Writable` stream. - * The `output` stream is used to print prompts for user input that arrives on, - * and is read from, the `input` stream. - * @since v17.0.0 - */ - class Interface extends _Interface { - /** - * The `rl.question()` method displays the `query` by writing it to the `output`, - * waits for user input to be provided on `input`, then invokes the `callback`function passing the provided input as the first argument. - * - * When called, `rl.question()` will resume the `input` stream if it has been - * paused. - * - * If the `Interface` was created with `output` set to `null` or`undefined` the `query` is not written. - * - * If the question is called after `rl.close()`, it returns a rejected promise. - * - * Example usage: - * - * ```js - * const answer = await rl.question('What is your favorite food? '); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * - * Using an `AbortSignal` to cancel a question. - * - * ```js - * const signal = AbortSignal.timeout(10_000); - * - * signal.addEventListener('abort', () => { - * console.log('The food question timed out'); - * }, { once: true }); - * - * const answer = await rl.question('What is your favorite food? ', { signal }); - * console.log(`Oh, so your favorite food is ${answer}`); - * ``` - * @since v17.0.0 - * @param query A statement or query to write to `output`, prepended to the prompt. - * @return A promise that is fulfilled with the user's input in response to the `query`. - */ - question(query: string): Promise; - question(query: string, options: Abortable): Promise; - } - /** - * @since v17.0.0 - */ - class Readline { - /** - * @param stream A TTY stream. - */ - constructor( - stream: NodeJS.WritableStream, - options?: { - autoCommit?: boolean; - }, - ); - /** - * The `rl.clearLine()` method adds to the internal list of pending action an - * action that clears current line of the associated `stream` in a specified - * direction identified by `dir`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearLine(dir: Direction): this; - /** - * The `rl.clearScreenDown()` method adds to the internal list of pending action an - * action that clears the associated stream from the current position of the - * cursor down. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - clearScreenDown(): this; - /** - * The `rl.commit()` method sends all the pending actions to the associated`stream` and clears the internal list of pending actions. - * @since v17.0.0 - */ - commit(): Promise; - /** - * The `rl.cursorTo()` method adds to the internal list of pending action an action - * that moves cursor to the specified position in the associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - cursorTo(x: number, y?: number): this; - /** - * The `rl.moveCursor()` method adds to the internal list of pending action an - * action that moves the cursor _relative_ to its current position in the - * associated `stream`. - * Call `rl.commit()` to see the effect of this method, unless `autoCommit: true`was passed to the constructor. - * @since v17.0.0 - * @return this - */ - moveCursor(dx: number, dy: number): this; - /** - * The `rl.rollback` methods clears the internal list of pending actions without - * sending it to the associated `stream`. - * @since v17.0.0 - * @return this - */ - rollback(): this; - } - /** - * The `readlinePromises.createInterface()` method creates a new `readlinePromises.Interface`instance. - * - * ```js - * const readlinePromises = require('node:readline/promises'); - * const rl = readlinePromises.createInterface({ - * input: process.stdin, - * output: process.stdout, - * }); - * ``` - * - * Once the `readlinePromises.Interface` instance is created, the most common case - * is to listen for the `'line'` event: - * - * ```js - * rl.on('line', (line) => { - * console.log(`Received: ${line}`); - * }); - * ``` - * - * If `terminal` is `true` for this instance then the `output` stream will get - * the best compatibility if it defines an `output.columns` property and emits - * a `'resize'` event on the `output` if or when the columns ever change - * (`process.stdout` does this automatically when it is a TTY). - * @since v17.0.0 - */ - function createInterface( - input: NodeJS.ReadableStream, - output?: NodeJS.WritableStream, - completer?: Completer | AsyncCompleter, - terminal?: boolean, - ): Interface; - function createInterface(options: ReadLineOptions): Interface; -} -declare module "node:readline/promises" { - export * from "readline/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/repl.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/repl.d.ts deleted file mode 100644 index 6c5f81b3..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/repl.d.ts +++ /dev/null @@ -1,430 +0,0 @@ -/** - * The `node:repl` module provides a Read-Eval-Print-Loop (REPL) implementation - * that is available both as a standalone program or includible in other - * applications. It can be accessed using: - * - * ```js - * const repl = require('node:repl'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/repl.js) - */ -declare module "repl" { - import { AsyncCompleter, Completer, Interface } from "node:readline"; - import { Context } from "node:vm"; - import { InspectOptions } from "node:util"; - interface ReplOptions { - /** - * The input prompt to display. - * @default "> " - */ - prompt?: string | undefined; - /** - * The `Readable` stream from which REPL input will be read. - * @default process.stdin - */ - input?: NodeJS.ReadableStream | undefined; - /** - * The `Writable` stream to which REPL output will be written. - * @default process.stdout - */ - output?: NodeJS.WritableStream | undefined; - /** - * If `true`, specifies that the output should be treated as a TTY terminal, and have - * ANSI/VT100 escape codes written to it. - * Default: checking the value of the `isTTY` property on the output stream upon - * instantiation. - */ - terminal?: boolean | undefined; - /** - * The function to be used when evaluating each given line of input. - * Default: an async wrapper for the JavaScript `eval()` function. An `eval` function can - * error with `repl.Recoverable` to indicate the input was incomplete and prompt for - * additional lines. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_default_evaluation - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_custom_evaluation_functions - */ - eval?: REPLEval | undefined; - /** - * Defines if the repl prints output previews or not. - * @default `true` Always `false` in case `terminal` is falsy. - */ - preview?: boolean | undefined; - /** - * If `true`, specifies that the default `writer` function should include ANSI color - * styling to REPL output. If a custom `writer` function is provided then this has no - * effect. - * Default: the REPL instance's `terminal` value. - */ - useColors?: boolean | undefined; - /** - * If `true`, specifies that the default evaluation function will use the JavaScript - * `global` as the context as opposed to creating a new separate context for the REPL - * instance. The node CLI REPL sets this value to `true`. - * Default: `false`. - */ - useGlobal?: boolean | undefined; - /** - * If `true`, specifies that the default writer will not output the return value of a - * command if it evaluates to `undefined`. - * Default: `false`. - */ - ignoreUndefined?: boolean | undefined; - /** - * The function to invoke to format the output of each command before writing to `output`. - * Default: a wrapper for `util.inspect`. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_customizing_repl_output - */ - writer?: REPLWriter | undefined; - /** - * An optional function used for custom Tab auto completion. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/readline.html#readline_use_of_the_completer_function - */ - completer?: Completer | AsyncCompleter | undefined; - /** - * A flag that specifies whether the default evaluator executes all JavaScript commands in - * strict mode or default (sloppy) mode. - * Accepted values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - replMode?: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT | undefined; - /** - * Stop evaluating the current piece of code when `SIGINT` is received, i.e. `Ctrl+C` is - * pressed. This cannot be used together with a custom `eval` function. - * Default: `false`. - */ - breakEvalOnSigint?: boolean | undefined; - } - type REPLEval = ( - this: REPLServer, - evalCmd: string, - context: Context, - file: string, - cb: (err: Error | null, result: any) => void, - ) => void; - type REPLWriter = (this: REPLServer, obj: any) => string; - /** - * This is the default "writer" value, if none is passed in the REPL options, - * and it can be overridden by custom print functions. - */ - const writer: REPLWriter & { - options: InspectOptions; - }; - type REPLCommandAction = (this: REPLServer, text: string) => void; - interface REPLCommand { - /** - * Help text to be displayed when `.help` is entered. - */ - help?: string | undefined; - /** - * The function to execute, optionally accepting a single string argument. - */ - action: REPLCommandAction; - } - /** - * Instances of `repl.REPLServer` are created using the {@link start} method - * or directly using the JavaScript `new` keyword. - * - * ```js - * const repl = require('node:repl'); - * - * const options = { useColors: true }; - * - * const firstInstance = repl.start(options); - * const secondInstance = new repl.REPLServer(options); - * ``` - * @since v0.1.91 - */ - class REPLServer extends Interface { - /** - * The `vm.Context` provided to the `eval` function to be used for JavaScript - * evaluation. - */ - readonly context: Context; - /** - * @deprecated since v14.3.0 - Use `input` instead. - */ - readonly inputStream: NodeJS.ReadableStream; - /** - * @deprecated since v14.3.0 - Use `output` instead. - */ - readonly outputStream: NodeJS.WritableStream; - /** - * The `Readable` stream from which REPL input will be read. - */ - readonly input: NodeJS.ReadableStream; - /** - * The `Writable` stream to which REPL output will be written. - */ - readonly output: NodeJS.WritableStream; - /** - * The commands registered via `replServer.defineCommand()`. - */ - readonly commands: NodeJS.ReadOnlyDict; - /** - * A value indicating whether the REPL is currently in "editor mode". - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_commands_and_special_keys - */ - readonly editorMode: boolean; - /** - * A value indicating whether the `_` variable has been assigned. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreAssigned: boolean; - /** - * The last evaluation result from the REPL (assigned to the `_` variable inside of the REPL). - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly last: any; - /** - * A value indicating whether the `_error` variable has been assigned. - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly underscoreErrAssigned: boolean; - /** - * The last error raised inside the REPL (assigned to the `_error` variable inside of the REPL). - * - * @since v9.8.0 - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_assignment_of_the_underscore_variable - */ - readonly lastError: any; - /** - * Specified in the REPL options, this is the function to be used when evaluating each - * given line of input. If not specified in the REPL options, this is an async wrapper - * for the JavaScript `eval()` function. - */ - readonly eval: REPLEval; - /** - * Specified in the REPL options, this is a value indicating whether the default - * `writer` function should include ANSI color styling to REPL output. - */ - readonly useColors: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `eval` - * function will use the JavaScript `global` as the context as opposed to creating a new - * separate context for the REPL instance. - */ - readonly useGlobal: boolean; - /** - * Specified in the REPL options, this is a value indicating whether the default `writer` - * function should output the result of a command if it evaluates to `undefined`. - */ - readonly ignoreUndefined: boolean; - /** - * Specified in the REPL options, this is the function to invoke to format the output of - * each command before writing to `outputStream`. If not specified in the REPL options, - * this will be a wrapper for `util.inspect`. - */ - readonly writer: REPLWriter; - /** - * Specified in the REPL options, this is the function to use for custom Tab auto-completion. - */ - readonly completer: Completer | AsyncCompleter; - /** - * Specified in the REPL options, this is a flag that specifies whether the default `eval` - * function should execute all JavaScript commands in strict mode or default (sloppy) mode. - * Possible values are: - * - `repl.REPL_MODE_SLOPPY` - evaluates expressions in sloppy mode. - * - `repl.REPL_MODE_STRICT` - evaluates expressions in strict mode. This is equivalent to - * prefacing every repl statement with `'use strict'`. - */ - readonly replMode: typeof REPL_MODE_SLOPPY | typeof REPL_MODE_STRICT; - /** - * NOTE: According to the documentation: - * - * > Instances of `repl.REPLServer` are created using the `repl.start()` method and - * > _should not_ be created directly using the JavaScript `new` keyword. - * - * `REPLServer` cannot be subclassed due to implementation specifics in NodeJS. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_class_replserver - */ - private constructor(); - /** - * The `replServer.defineCommand()` method is used to add new `.`\-prefixed commands - * to the REPL instance. Such commands are invoked by typing a `.` followed by the`keyword`. The `cmd` is either a `Function` or an `Object` with the following - * properties: - * - * The following example shows two new commands added to the REPL instance: - * - * ```js - * const repl = require('node:repl'); - * - * const replServer = repl.start({ prompt: '> ' }); - * replServer.defineCommand('sayhello', { - * help: 'Say hello', - * action(name) { - * this.clearBufferedCommand(); - * console.log(`Hello, ${name}!`); - * this.displayPrompt(); - * }, - * }); - * replServer.defineCommand('saybye', function saybye() { - * console.log('Goodbye!'); - * this.close(); - * }); - * ``` - * - * The new commands can then be used from within the REPL instance: - * - * ```console - * > .sayhello Node.js User - * Hello, Node.js User! - * > .saybye - * Goodbye! - * ``` - * @since v0.3.0 - * @param keyword The command keyword (_without_ a leading `.` character). - * @param cmd The function to invoke when the command is processed. - */ - defineCommand(keyword: string, cmd: REPLCommandAction | REPLCommand): void; - /** - * The `replServer.displayPrompt()` method readies the REPL instance for input - * from the user, printing the configured `prompt` to a new line in the `output`and resuming the `input` to accept new input. - * - * When multi-line input is being entered, an ellipsis is printed rather than the - * 'prompt'. - * - * When `preserveCursor` is `true`, the cursor placement will not be reset to `0`. - * - * The `replServer.displayPrompt` method is primarily intended to be called from - * within the action function for commands registered using the`replServer.defineCommand()` method. - * @since v0.1.91 - */ - displayPrompt(preserveCursor?: boolean): void; - /** - * The `replServer.clearBufferedCommand()` method clears any command that has been - * buffered but not yet executed. This method is primarily intended to be - * called from within the action function for commands registered using the`replServer.defineCommand()` method. - * @since v9.0.0 - */ - clearBufferedCommand(): void; - /** - * Initializes a history log file for the REPL instance. When executing the - * Node.js binary and using the command-line REPL, a history file is initialized - * by default. However, this is not the case when creating a REPL - * programmatically. Use this method to initialize a history log file when working - * with REPL instances programmatically. - * @since v11.10.0 - * @param historyPath the path to the history file - * @param callback called when history writes are ready or upon error - */ - setupHistory(path: string, callback: (err: Error | null, repl: this) => void): void; - /** - * events.EventEmitter - * 1. close - inherited from `readline.Interface` - * 2. line - inherited from `readline.Interface` - * 3. pause - inherited from `readline.Interface` - * 4. resume - inherited from `readline.Interface` - * 5. SIGCONT - inherited from `readline.Interface` - * 6. SIGINT - inherited from `readline.Interface` - * 7. SIGTSTP - inherited from `readline.Interface` - * 8. exit - * 9. reset - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "close", listener: () => void): this; - addListener(event: "line", listener: (input: string) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "SIGCONT", listener: () => void): this; - addListener(event: "SIGINT", listener: () => void): this; - addListener(event: "SIGTSTP", listener: () => void): this; - addListener(event: "exit", listener: () => void): this; - addListener(event: "reset", listener: (context: Context) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "close"): boolean; - emit(event: "line", input: string): boolean; - emit(event: "pause"): boolean; - emit(event: "resume"): boolean; - emit(event: "SIGCONT"): boolean; - emit(event: "SIGINT"): boolean; - emit(event: "SIGTSTP"): boolean; - emit(event: "exit"): boolean; - emit(event: "reset", context: Context): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "close", listener: () => void): this; - on(event: "line", listener: (input: string) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "SIGCONT", listener: () => void): this; - on(event: "SIGINT", listener: () => void): this; - on(event: "SIGTSTP", listener: () => void): this; - on(event: "exit", listener: () => void): this; - on(event: "reset", listener: (context: Context) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "line", listener: (input: string) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "SIGCONT", listener: () => void): this; - once(event: "SIGINT", listener: () => void): this; - once(event: "SIGTSTP", listener: () => void): this; - once(event: "exit", listener: () => void): this; - once(event: "reset", listener: (context: Context) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "line", listener: (input: string) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "SIGCONT", listener: () => void): this; - prependListener(event: "SIGINT", listener: () => void): this; - prependListener(event: "SIGTSTP", listener: () => void): this; - prependListener(event: "exit", listener: () => void): this; - prependListener(event: "reset", listener: (context: Context) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "line", listener: (input: string) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "SIGCONT", listener: () => void): this; - prependOnceListener(event: "SIGINT", listener: () => void): this; - prependOnceListener(event: "SIGTSTP", listener: () => void): this; - prependOnceListener(event: "exit", listener: () => void): this; - prependOnceListener(event: "reset", listener: (context: Context) => void): this; - } - /** - * A flag passed in the REPL options. Evaluates expressions in sloppy mode. - */ - const REPL_MODE_SLOPPY: unique symbol; - /** - * A flag passed in the REPL options. Evaluates expressions in strict mode. - * This is equivalent to prefacing every repl statement with `'use strict'`. - */ - const REPL_MODE_STRICT: unique symbol; - /** - * The `repl.start()` method creates and starts a {@link REPLServer} instance. - * - * If `options` is a string, then it specifies the input prompt: - * - * ```js - * const repl = require('node:repl'); - * - * // a Unix style prompt - * repl.start('$ '); - * ``` - * @since v0.1.91 - */ - function start(options?: string | ReplOptions): REPLServer; - /** - * Indicates a recoverable error that a `REPLServer` can use to support multi-line input. - * - * @see https://nodejs.org/dist/latest-v20.x/docs/api/repl.html#repl_recoverable_errors - */ - class Recoverable extends SyntaxError { - err: Error; - constructor(err: Error); - } -} -declare module "node:repl" { - export * from "repl"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/stream.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/stream.d.ts deleted file mode 100644 index 947a0193..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/stream.d.ts +++ /dev/null @@ -1,1701 +0,0 @@ -/** - * A stream is an abstract interface for working with streaming data in Node.js. - * The `node:stream` module provides an API for implementing the stream interface. - * - * There are many stream objects provided by Node.js. For instance, a `request to an HTTP server` and `process.stdout` are both stream instances. - * - * Streams can be readable, writable, or both. All streams are instances of `EventEmitter`. - * - * To access the `node:stream` module: - * - * ```js - * const stream = require('node:stream'); - * ``` - * - * The `node:stream` module is useful for creating new types of stream instances. - * It is usually not necessary to use the `node:stream` module to consume streams. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/stream.js) - */ -declare module "stream" { - import { Abortable, EventEmitter } from "node:events"; - import { Blob as NodeBlob } from "node:buffer"; - import * as streamPromises from "node:stream/promises"; - import * as streamConsumers from "node:stream/consumers"; - import * as streamWeb from "node:stream/web"; - - type ComposeFnParam = (source: any) => void; - - class internal extends EventEmitter { - pipe( - destination: T, - options?: { - end?: boolean | undefined; - }, - ): T; - compose( - stream: T | ComposeFnParam | Iterable | AsyncIterable, - options?: { signal: AbortSignal }, - ): T; - } - import Stream = internal.Stream; - import Readable = internal.Readable; - import ReadableOptions = internal.ReadableOptions; - interface ArrayOptions { - /** the maximum concurrent invocations of `fn` to call on the stream at once. **Default: 1**. */ - concurrency?: number; - /** allows destroying the stream if the signal is aborted. */ - signal?: AbortSignal; - } - class ReadableBase extends Stream implements NodeJS.ReadableStream { - /** - * A utility method for creating Readable Streams out of iterators. - */ - static from(iterable: Iterable | AsyncIterable, options?: ReadableOptions): Readable; - /** - * Returns whether the stream has been read from or cancelled. - * @since v16.8.0 - */ - static isDisturbed(stream: Readable | NodeJS.ReadableStream): boolean; - /** - * Returns whether the stream was destroyed or errored before emitting `'end'`. - * @since v16.8.0 - * @experimental - */ - readonly readableAborted: boolean; - /** - * Is `true` if it is safe to call `readable.read()`, which means - * the stream has not been destroyed or emitted `'error'` or `'end'`. - * @since v11.4.0 - */ - readable: boolean; - /** - * Returns whether `'data'` has been emitted. - * @since v16.7.0, v14.18.0 - * @experimental - */ - readonly readableDidRead: boolean; - /** - * Getter for the property `encoding` of a given `Readable` stream. The `encoding`property can be set using the `readable.setEncoding()` method. - * @since v12.7.0 - */ - readonly readableEncoding: BufferEncoding | null; - /** - * Becomes `true` when `'end'` event is emitted. - * @since v12.9.0 - */ - readonly readableEnded: boolean; - /** - * This property reflects the current state of a `Readable` stream as described - * in the `Three states` section. - * @since v9.4.0 - */ - readonly readableFlowing: boolean | null; - /** - * Returns the value of `highWaterMark` passed when creating this `Readable`. - * @since v9.3.0 - */ - readonly readableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be read. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly readableLength: number; - /** - * Getter for the property `objectMode` of a given `Readable` stream. - * @since v12.3.0 - */ - readonly readableObjectMode: boolean; - /** - * Is `true` after `readable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - constructor(opts?: ReadableOptions); - _construct?(callback: (error?: Error | null) => void): void; - _read(size: number): void; - /** - * The `readable.read()` method reads data out of the internal buffer and - * returns it. If no data is available to be read, `null` is returned. By default, - * the data is returned as a `Buffer` object unless an encoding has been - * specified using the `readable.setEncoding()` method or the stream is operating - * in object mode. - * - * The optional `size` argument specifies a specific number of bytes to read. If`size` bytes are not available to be read, `null` will be returned _unless_the stream has ended, in which - * case all of the data remaining in the internal - * buffer will be returned. - * - * If the `size` argument is not specified, all of the data contained in the - * internal buffer will be returned. - * - * The `size` argument must be less than or equal to 1 GiB. - * - * The `readable.read()` method should only be called on `Readable` streams - * operating in paused mode. In flowing mode, `readable.read()` is called - * automatically until the internal buffer is fully drained. - * - * ```js - * const readable = getReadableStreamSomehow(); - * - * // 'readable' may be triggered multiple times as data is buffered in - * readable.on('readable', () => { - * let chunk; - * console.log('Stream is readable (new data received in buffer)'); - * // Use a loop to make sure we read all currently available data - * while (null !== (chunk = readable.read())) { - * console.log(`Read ${chunk.length} bytes of data...`); - * } - * }); - * - * // 'end' will be triggered once when there is no more data available - * readable.on('end', () => { - * console.log('Reached end of stream.'); - * }); - * ``` - * - * Each call to `readable.read()` returns a chunk of data, or `null`. The chunks - * are not concatenated. A `while` loop is necessary to consume all data - * currently in the buffer. When reading a large file `.read()` may return `null`, - * having consumed all buffered content so far, but there is still more data to - * come not yet buffered. In this case a new `'readable'` event will be emitted - * when there is more data in the buffer. Finally the `'end'` event will be - * emitted when there is no more data to come. - * - * Therefore to read a file's whole contents from a `readable`, it is necessary - * to collect chunks across multiple `'readable'` events: - * - * ```js - * const chunks = []; - * - * readable.on('readable', () => { - * let chunk; - * while (null !== (chunk = readable.read())) { - * chunks.push(chunk); - * } - * }); - * - * readable.on('end', () => { - * const content = chunks.join(''); - * }); - * ``` - * - * A `Readable` stream in object mode will always return a single item from - * a call to `readable.read(size)`, regardless of the value of the`size` argument. - * - * If the `readable.read()` method returns a chunk of data, a `'data'` event will - * also be emitted. - * - * Calling {@link read} after the `'end'` event has - * been emitted will return `null`. No runtime error will be raised. - * @since v0.9.4 - * @param size Optional argument to specify how much data to read. - */ - read(size?: number): any; - /** - * The `readable.setEncoding()` method sets the character encoding for - * data read from the `Readable` stream. - * - * By default, no encoding is assigned and stream data will be returned as`Buffer` objects. Setting an encoding causes the stream data - * to be returned as strings of the specified encoding rather than as `Buffer`objects. For instance, calling `readable.setEncoding('utf8')` will cause the - * output data to be interpreted as UTF-8 data, and passed as strings. Calling`readable.setEncoding('hex')` will cause the data to be encoded in hexadecimal - * string format. - * - * The `Readable` stream will properly handle multi-byte characters delivered - * through the stream that would otherwise become improperly decoded if simply - * pulled from the stream as `Buffer` objects. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.setEncoding('utf8'); - * readable.on('data', (chunk) => { - * assert.equal(typeof chunk, 'string'); - * console.log('Got %d characters of string data:', chunk.length); - * }); - * ``` - * @since v0.9.4 - * @param encoding The encoding to use. - */ - setEncoding(encoding: BufferEncoding): this; - /** - * The `readable.pause()` method will cause a stream in flowing mode to stop - * emitting `'data'` events, switching out of flowing mode. Any data that - * becomes available will remain in the internal buffer. - * - * ```js - * const readable = getReadableStreamSomehow(); - * readable.on('data', (chunk) => { - * console.log(`Received ${chunk.length} bytes of data.`); - * readable.pause(); - * console.log('There will be no additional data for 1 second.'); - * setTimeout(() => { - * console.log('Now data will start flowing again.'); - * readable.resume(); - * }, 1000); - * }); - * ``` - * - * The `readable.pause()` method has no effect if there is a `'readable'`event listener. - * @since v0.9.4 - */ - pause(): this; - /** - * The `readable.resume()` method causes an explicitly paused `Readable` stream to - * resume emitting `'data'` events, switching the stream into flowing mode. - * - * The `readable.resume()` method can be used to fully consume the data from a - * stream without actually processing any of that data: - * - * ```js - * getReadableStreamSomehow() - * .resume() - * .on('end', () => { - * console.log('Reached the end, but did not read anything.'); - * }); - * ``` - * - * The `readable.resume()` method has no effect if there is a `'readable'`event listener. - * @since v0.9.4 - */ - resume(): this; - /** - * The `readable.isPaused()` method returns the current operating state of the`Readable`. This is used primarily by the mechanism that underlies the`readable.pipe()` method. In most - * typical cases, there will be no reason to - * use this method directly. - * - * ```js - * const readable = new stream.Readable(); - * - * readable.isPaused(); // === false - * readable.pause(); - * readable.isPaused(); // === true - * readable.resume(); - * readable.isPaused(); // === false - * ``` - * @since v0.11.14 - */ - isPaused(): boolean; - /** - * The `readable.unpipe()` method detaches a `Writable` stream previously attached - * using the {@link pipe} method. - * - * If the `destination` is not specified, then _all_ pipes are detached. - * - * If the `destination` is specified, but no pipe is set up for it, then - * the method does nothing. - * - * ```js - * const fs = require('node:fs'); - * const readable = getReadableStreamSomehow(); - * const writable = fs.createWriteStream('file.txt'); - * // All the data from readable goes into 'file.txt', - * // but only for the first second. - * readable.pipe(writable); - * setTimeout(() => { - * console.log('Stop writing to file.txt.'); - * readable.unpipe(writable); - * console.log('Manually close the file stream.'); - * writable.end(); - * }, 1000); - * ``` - * @since v0.9.4 - * @param destination Optional specific stream to unpipe - */ - unpipe(destination?: NodeJS.WritableStream): this; - /** - * Passing `chunk` as `null` signals the end of the stream (EOF) and behaves the - * same as `readable.push(null)`, after which no more data can be written. The EOF - * signal is put at the end of the buffer and any buffered data will still be - * flushed. - * - * The `readable.unshift()` method pushes a chunk of data back into the internal - * buffer. This is useful in certain situations where a stream is being consumed by - * code that needs to "un-consume" some amount of data that it has optimistically - * pulled out of the source, so that the data can be passed on to some other party. - * - * The `stream.unshift(chunk)` method cannot be called after the `'end'` event - * has been emitted or a runtime error will be thrown. - * - * Developers using `stream.unshift()` often should consider switching to - * use of a `Transform` stream instead. See the `API for stream implementers` section for more information. - * - * ```js - * // Pull off a header delimited by \n\n. - * // Use unshift() if we get too much. - * // Call the callback with (error, header, stream). - * const { StringDecoder } = require('node:string_decoder'); - * function parseHeader(stream, callback) { - * stream.on('error', callback); - * stream.on('readable', onReadable); - * const decoder = new StringDecoder('utf8'); - * let header = ''; - * function onReadable() { - * let chunk; - * while (null !== (chunk = stream.read())) { - * const str = decoder.write(chunk); - * if (str.includes('\n\n')) { - * // Found the header boundary. - * const split = str.split(/\n\n/); - * header += split.shift(); - * const remaining = split.join('\n\n'); - * const buf = Buffer.from(remaining, 'utf8'); - * stream.removeListener('error', callback); - * // Remove the 'readable' listener before unshifting. - * stream.removeListener('readable', onReadable); - * if (buf.length) - * stream.unshift(buf); - * // Now the body of the message can be read from the stream. - * callback(null, header, stream); - * return; - * } - * // Still reading the header. - * header += str; - * } - * } - * } - * ``` - * - * Unlike {@link push}, `stream.unshift(chunk)` will not - * end the reading process by resetting the internal reading state of the stream. - * This can cause unexpected results if `readable.unshift()` is called during a - * read (i.e. from within a {@link _read} implementation on a - * custom stream). Following the call to `readable.unshift()` with an immediate {@link push} will reset the reading state appropriately, - * however it is best to simply avoid calling `readable.unshift()` while in the - * process of performing a read. - * @since v0.9.11 - * @param chunk Chunk of data to unshift onto the read queue. For streams not operating in object mode, `chunk` must be a string, `Buffer`, `Uint8Array`, or `null`. For object mode - * streams, `chunk` may be any JavaScript value. - * @param encoding Encoding of string chunks. Must be a valid `Buffer` encoding, such as `'utf8'` or `'ascii'`. - */ - unshift(chunk: any, encoding?: BufferEncoding): void; - /** - * Prior to Node.js 0.10, streams did not implement the entire `node:stream`module API as it is currently defined. (See `Compatibility` for more - * information.) - * - * When using an older Node.js library that emits `'data'` events and has a {@link pause} method that is advisory only, the`readable.wrap()` method can be used to create a `Readable` - * stream that uses - * the old stream as its data source. - * - * It will rarely be necessary to use `readable.wrap()` but the method has been - * provided as a convenience for interacting with older Node.js applications and - * libraries. - * - * ```js - * const { OldReader } = require('./old-api-module.js'); - * const { Readable } = require('node:stream'); - * const oreader = new OldReader(); - * const myReader = new Readable().wrap(oreader); - * - * myReader.on('readable', () => { - * myReader.read(); // etc. - * }); - * ``` - * @since v0.9.4 - * @param stream An "old style" readable stream - */ - wrap(stream: NodeJS.ReadableStream): this; - push(chunk: any, encoding?: BufferEncoding): boolean; - /** - * The iterator created by this method gives users the option to cancel the destruction - * of the stream if the `for await...of` loop is exited by `return`, `break`, or `throw`, - * or if the iterator should destroy the stream if the stream emitted an error during iteration. - * @since v16.3.0 - * @param options.destroyOnReturn When set to `false`, calling `return` on the async iterator, - * or exiting a `for await...of` iteration using a `break`, `return`, or `throw` will not destroy the stream. - * **Default: `true`**. - */ - iterator(options?: { destroyOnReturn?: boolean }): AsyncIterableIterator; - /** - * This method allows mapping over the stream. The *fn* function will be called for every chunk in the stream. - * If the *fn* function returns a promise - that promise will be `await`ed before being passed to the result stream. - * @since v17.4.0, v16.14.0 - * @param fn a function to map over every chunk in the stream. Async or not. - * @returns a stream mapped with the function *fn*. - */ - map(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method allows filtering the stream. For each chunk in the stream the *fn* function will be called - * and if it returns a truthy value, the chunk will be passed to the result stream. - * If the *fn* function returns a promise - that promise will be `await`ed. - * @since v17.4.0, v16.14.0 - * @param fn a function to filter chunks from the stream. Async or not. - * @returns a stream filtered with the predicate *fn*. - */ - filter( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Readable; - /** - * This method allows iterating a stream. For each chunk in the stream the *fn* function will be called. - * If the *fn* function returns a promise - that promise will be `await`ed. - * - * This method is different from `for await...of` loops in that it can optionally process chunks concurrently. - * In addition, a `forEach` iteration can only be stopped by having passed a `signal` option - * and aborting the related AbortController while `for await...of` can be stopped with `break` or `return`. - * In either case the stream will be destroyed. - * - * This method is different from listening to the `'data'` event in that it uses the `readable` event - * in the underlying machinary and can limit the number of concurrent *fn* calls. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise for when the stream has finished. - */ - forEach( - fn: (data: any, options?: Pick) => void | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method allows easily obtaining the contents of a stream. - * - * As this method reads the entire stream into memory, it negates the benefits of streams. It's intended - * for interoperability and convenience, not as the primary way to consume streams. - * @since v17.5.0 - * @returns a promise containing an array with the contents of the stream. - */ - toArray(options?: Pick): Promise; - /** - * This method is similar to `Array.prototype.some` and calls *fn* on each chunk in the stream - * until the awaited return value is `true` (or any truthy value). Once an *fn* call on a chunk - * `await`ed return value is truthy, the stream is destroyed and the promise is fulfilled with `true`. - * If none of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `false`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for at least one of the chunks. - */ - some( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.find` and calls *fn* on each chunk in the stream - * to find a chunk with a truthy value for *fn*. Once an *fn* call's awaited return value is truthy, - * the stream is destroyed and the promise is fulfilled with value for which *fn* returned a truthy value. - * If all of the *fn* calls on the chunks return a falsy value, the promise is fulfilled with `undefined`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to the first chunk for which *fn* evaluated with a truthy value, - * or `undefined` if no element was found. - */ - find( - fn: (data: any, options?: Pick) => data is T, - options?: ArrayOptions, - ): Promise; - find( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method is similar to `Array.prototype.every` and calls *fn* on each chunk in the stream - * to check if all awaited return values are truthy value for *fn*. Once an *fn* call on a chunk - * `await`ed return value is falsy, the stream is destroyed and the promise is fulfilled with `false`. - * If all of the *fn* calls on the chunks return a truthy value, the promise is fulfilled with `true`. - * @since v17.5.0 - * @param fn a function to call on each chunk of the stream. Async or not. - * @returns a promise evaluating to `true` if *fn* returned a truthy value for every one of the chunks. - */ - every( - fn: (data: any, options?: Pick) => boolean | Promise, - options?: ArrayOptions, - ): Promise; - /** - * This method returns a new stream by applying the given callback to each chunk of the stream - * and then flattening the result. - * - * It is possible to return a stream or another iterable or async iterable from *fn* and the result streams - * will be merged (flattened) into the returned stream. - * @since v17.5.0 - * @param fn a function to map over every chunk in the stream. May be async. May be a stream or generator. - * @returns a stream flat-mapped with the function *fn*. - */ - flatMap(fn: (data: any, options?: Pick) => any, options?: ArrayOptions): Readable; - /** - * This method returns a new stream with the first *limit* chunks dropped from the start. - * @since v17.5.0 - * @param limit the number of chunks to drop from the readable. - * @returns a stream with *limit* chunks dropped from the start. - */ - drop(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with the first *limit* chunks. - * @since v17.5.0 - * @param limit the number of chunks to take from the readable. - * @returns a stream with *limit* chunks taken. - */ - take(limit: number, options?: Pick): Readable; - /** - * This method returns a new stream with chunks of the underlying stream paired with a counter - * in the form `[index, chunk]`. The first index value is `0` and it increases by 1 for each chunk produced. - * @since v17.5.0 - * @returns a stream of indexed pairs. - */ - asIndexedPairs(options?: Pick): Readable; - /** - * This method calls *fn* on each chunk of the stream in order, passing it the result from the calculation - * on the previous element. It returns a promise for the final value of the reduction. - * - * If no *initial* value is supplied the first chunk of the stream is used as the initial value. - * If the stream is empty, the promise is rejected with a `TypeError` with the `ERR_INVALID_ARGS` code property. - * - * The reducer function iterates the stream element-by-element which means that there is no *concurrency* parameter - * or parallelism. To perform a reduce concurrently, you can extract the async function to `readable.map` method. - * @since v17.5.0 - * @param fn a reducer function to call over every chunk in the stream. Async or not. - * @param initial the initial value to use in the reduction. - * @returns a promise for the final value of the reduction. - */ - reduce( - fn: (previous: any, data: any, options?: Pick) => T, - initial?: undefined, - options?: Pick, - ): Promise; - reduce( - fn: (previous: T, data: any, options?: Pick) => T, - initial: T, - options?: Pick, - ): Promise; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the readable - * stream will release any internal resources and subsequent calls to `push()`will be ignored. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, but instead implement `readable._destroy()`. - * @since v8.0.0 - * @param error Error which will be passed as payload in `'error'` event - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. end - * 4. error - * 5. pause - * 6. readable - * 7. resume - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "pause"): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "pause", listener: () => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "pause", listener: () => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - [Symbol.asyncIterator](): AsyncIterableIterator; - /** - * Calls `readable.destroy()` with an `AbortError` and returns a promise that fulfills when the stream is finished. - * @since v20.4.0 - */ - [Symbol.asyncDispose](): Promise; - } - import WritableOptions = internal.WritableOptions; - class WritableBase extends Stream implements NodeJS.WritableStream { - /** - * Is `true` if it is safe to call `writable.write()`, which means - * the stream has not been destroyed, errored, or ended. - * @since v11.4.0 - */ - readonly writable: boolean; - /** - * Is `true` after `writable.end()` has been called. This property - * does not indicate whether the data has been flushed, for this use `writable.writableFinished` instead. - * @since v12.9.0 - */ - readonly writableEnded: boolean; - /** - * Is set to `true` immediately before the `'finish'` event is emitted. - * @since v12.6.0 - */ - readonly writableFinished: boolean; - /** - * Return the value of `highWaterMark` passed when creating this `Writable`. - * @since v9.3.0 - */ - readonly writableHighWaterMark: number; - /** - * This property contains the number of bytes (or objects) in the queue - * ready to be written. The value provides introspection data regarding - * the status of the `highWaterMark`. - * @since v9.4.0 - */ - readonly writableLength: number; - /** - * Getter for the property `objectMode` of a given `Writable` stream. - * @since v12.3.0 - */ - readonly writableObjectMode: boolean; - /** - * Number of times `writable.uncork()` needs to be - * called in order to fully uncork the stream. - * @since v13.2.0, v12.16.0 - */ - readonly writableCorked: number; - /** - * Is `true` after `writable.destroy()` has been called. - * @since v8.0.0 - */ - destroyed: boolean; - /** - * Is `true` after `'close'` has been emitted. - * @since v18.0.0 - */ - readonly closed: boolean; - /** - * Returns error if the stream has been destroyed with an error. - * @since v18.0.0 - */ - readonly errored: Error | null; - /** - * Is `true` if the stream's buffer has been full and stream will emit `'drain'`. - * @since v15.2.0, v14.17.0 - */ - readonly writableNeedDrain: boolean; - constructor(opts?: WritableOptions); - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?( - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - _construct?(callback: (error?: Error | null) => void): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - /** - * The `writable.write()` method writes some data to the stream, and calls the - * supplied `callback` once the data has been fully handled. If an error - * occurs, the `callback` will be called with the error as its - * first argument. The `callback` is called asynchronously and before `'error'` is - * emitted. - * - * The return value is `true` if the internal buffer is less than the`highWaterMark` configured when the stream was created after admitting `chunk`. - * If `false` is returned, further attempts to write data to the stream should - * stop until the `'drain'` event is emitted. - * - * While a stream is not draining, calls to `write()` will buffer `chunk`, and - * return false. Once all currently buffered chunks are drained (accepted for - * delivery by the operating system), the `'drain'` event will be emitted. - * Once `write()` returns false, do not write more chunks - * until the `'drain'` event is emitted. While calling `write()` on a stream that - * is not draining is allowed, Node.js will buffer all written chunks until - * maximum memory usage occurs, at which point it will abort unconditionally. - * Even before it aborts, high memory usage will cause poor garbage collector - * performance and high RSS (which is not typically released back to the system, - * even after the memory is no longer required). Since TCP sockets may never - * drain if the remote peer does not read the data, writing a socket that is - * not draining may lead to a remotely exploitable vulnerability. - * - * Writing data while the stream is not draining is particularly - * problematic for a `Transform`, because the `Transform` streams are paused - * by default until they are piped or a `'data'` or `'readable'` event handler - * is added. - * - * If the data to be written can be generated or fetched on demand, it is - * recommended to encapsulate the logic into a `Readable` and use {@link pipe}. However, if calling `write()` is preferred, it is - * possible to respect backpressure and avoid memory issues using the `'drain'` event: - * - * ```js - * function write(data, cb) { - * if (!stream.write(data)) { - * stream.once('drain', cb); - * } else { - * process.nextTick(cb); - * } - * } - * - * // Wait for cb to be called before doing any other write. - * write('hello', () => { - * console.log('Write completed, do more writes now.'); - * }); - * ``` - * - * A `Writable` stream in object mode will always ignore the `encoding` argument. - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any - * JavaScript value other than `null`. - * @param [encoding='utf8'] The encoding, if `chunk` is a string. - * @param callback Callback for when this chunk of data is flushed. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - write(chunk: any, callback?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, encoding: BufferEncoding, callback?: (error: Error | null | undefined) => void): boolean; - /** - * The `writable.setDefaultEncoding()` method sets the default `encoding` for a `Writable` stream. - * @since v0.11.15 - * @param encoding The new default encoding - */ - setDefaultEncoding(encoding: BufferEncoding): this; - /** - * Calling the `writable.end()` method signals that no more data will be written - * to the `Writable`. The optional `chunk` and `encoding` arguments allow one - * final additional chunk of data to be written immediately before closing the - * stream. - * - * Calling the {@link write} method after calling {@link end} will raise an error. - * - * ```js - * // Write 'hello, ' and then end with 'world!'. - * const fs = require('node:fs'); - * const file = fs.createWriteStream('example.txt'); - * file.write('hello, '); - * file.end('world!'); - * // Writing more now is not allowed! - * ``` - * @since v0.9.4 - * @param chunk Optional data to write. For streams not operating in object mode, `chunk` must be a string, `Buffer` or `Uint8Array`. For object mode streams, `chunk` may be any - * JavaScript value other than `null`. - * @param encoding The encoding if `chunk` is a string - * @param callback Callback for when the stream is finished. - */ - end(cb?: () => void): this; - end(chunk: any, cb?: () => void): this; - end(chunk: any, encoding: BufferEncoding, cb?: () => void): this; - /** - * The `writable.cork()` method forces all written data to be buffered in memory. - * The buffered data will be flushed when either the {@link uncork} or {@link end} methods are called. - * - * The primary intent of `writable.cork()` is to accommodate a situation in which - * several small chunks are written to the stream in rapid succession. Instead of - * immediately forwarding them to the underlying destination, `writable.cork()`buffers all the chunks until `writable.uncork()` is called, which will pass them - * all to `writable._writev()`, if present. This prevents a head-of-line blocking - * situation where data is being buffered while waiting for the first small chunk - * to be processed. However, use of `writable.cork()` without implementing`writable._writev()` may have an adverse effect on throughput. - * - * See also: `writable.uncork()`, `writable._writev()`. - * @since v0.11.2 - */ - cork(): void; - /** - * The `writable.uncork()` method flushes all data buffered since {@link cork} was called. - * - * When using `writable.cork()` and `writable.uncork()` to manage the buffering - * of writes to a stream, defer calls to `writable.uncork()` using`process.nextTick()`. Doing so allows batching of all`writable.write()` calls that occur within a given Node.js event - * loop phase. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.write('data '); - * process.nextTick(() => stream.uncork()); - * ``` - * - * If the `writable.cork()` method is called multiple times on a stream, the - * same number of calls to `writable.uncork()` must be called to flush the buffered - * data. - * - * ```js - * stream.cork(); - * stream.write('some '); - * stream.cork(); - * stream.write('data '); - * process.nextTick(() => { - * stream.uncork(); - * // The data will not be flushed until uncork() is called a second time. - * stream.uncork(); - * }); - * ``` - * - * See also: `writable.cork()`. - * @since v0.11.2 - */ - uncork(): void; - /** - * Destroy the stream. Optionally emit an `'error'` event, and emit a `'close'`event (unless `emitClose` is set to `false`). After this call, the writable - * stream has ended and subsequent calls to `write()` or `end()` will result in - * an `ERR_STREAM_DESTROYED` error. - * This is a destructive and immediate way to destroy a stream. Previous calls to`write()` may not have drained, and may trigger an `ERR_STREAM_DESTROYED` error. - * Use `end()` instead of destroy if data should flush before close, or wait for - * the `'drain'` event before destroying the stream. - * - * Once `destroy()` has been called any further calls will be a no-op and no - * further errors except from `_destroy()` may be emitted as `'error'`. - * - * Implementors should not override this method, - * but instead implement `writable._destroy()`. - * @since v8.0.0 - * @param error Optional, an error to emit with `'error'` event. - */ - destroy(error?: Error): this; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. drain - * 3. error - * 4. finish - * 5. pipe - * 6. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "drain"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "drain", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "drain", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - namespace internal { - class Stream extends internal { - constructor(opts?: ReadableOptions); - } - interface StreamOptions extends Abortable { - emitClose?: boolean | undefined; - highWaterMark?: number | undefined; - objectMode?: boolean | undefined; - construct?(this: T, callback: (error?: Error | null) => void): void; - destroy?(this: T, error: Error | null, callback: (error?: Error | null) => void): void; - autoDestroy?: boolean | undefined; - } - interface ReadableOptions extends StreamOptions { - encoding?: BufferEncoding | undefined; - read?(this: Readable, size: number): void; - } - /** - * @since v0.9.4 - */ - class Readable extends ReadableBase { - /** - * A utility method for creating a `Readable` from a web `ReadableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - readableStream: streamWeb.ReadableStream, - options?: Pick, - ): Readable; - /** - * A utility method for creating a web `ReadableStream` from a `Readable`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamReadable: Readable): streamWeb.ReadableStream; - } - interface WritableOptions extends StreamOptions { - decodeStrings?: boolean | undefined; - defaultEncoding?: BufferEncoding | undefined; - write?( - this: Writable, - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void, - ): void; - writev?( - this: Writable, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Writable, callback: (error?: Error | null) => void): void; - } - /** - * @since v0.9.4 - */ - class Writable extends WritableBase { - /** - * A utility method for creating a `Writable` from a web `WritableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - writableStream: streamWeb.WritableStream, - options?: Pick, - ): Writable; - /** - * A utility method for creating a web `WritableStream` from a `Writable`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamWritable: Writable): streamWeb.WritableStream; - } - interface DuplexOptions extends ReadableOptions, WritableOptions { - allowHalfOpen?: boolean | undefined; - readableObjectMode?: boolean | undefined; - writableObjectMode?: boolean | undefined; - readableHighWaterMark?: number | undefined; - writableHighWaterMark?: number | undefined; - writableCorked?: number | undefined; - construct?(this: Duplex, callback: (error?: Error | null) => void): void; - read?(this: Duplex, size: number): void; - write?(this: Duplex, chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - writev?( - this: Duplex, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Duplex, callback: (error?: Error | null) => void): void; - destroy?(this: Duplex, error: Error | null, callback: (error?: Error | null) => void): void; - } - /** - * Duplex streams are streams that implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Duplex` streams include: - * - * * `TCP sockets` - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Duplex extends ReadableBase implements WritableBase { - readonly writable: boolean; - readonly writableEnded: boolean; - readonly writableFinished: boolean; - readonly writableHighWaterMark: number; - readonly writableLength: number; - readonly writableObjectMode: boolean; - readonly writableCorked: number; - readonly writableNeedDrain: boolean; - readonly closed: boolean; - readonly errored: Error | null; - /** - * If `false` then the stream will automatically end the writable side when the - * readable side ends. Set initially by the `allowHalfOpen` constructor option, - * which defaults to `true`. - * - * This can be changed manually to change the half-open behavior of an existing`Duplex` stream instance, but must be changed before the `'end'` event is - * emitted. - * @since v0.9.4 - */ - allowHalfOpen: boolean; - constructor(opts?: DuplexOptions); - /** - * A utility method for creating duplex streams. - * - * - `Stream` converts writable stream into writable `Duplex` and readable stream - * to `Duplex`. - * - `Blob` converts into readable `Duplex`. - * - `string` converts into readable `Duplex`. - * - `ArrayBuffer` converts into readable `Duplex`. - * - `AsyncIterable` converts into a readable `Duplex`. Cannot yield `null`. - * - `AsyncGeneratorFunction` converts into a readable/writable transform - * `Duplex`. Must take a source `AsyncIterable` as first parameter. Cannot yield - * `null`. - * - `AsyncFunction` converts into a writable `Duplex`. Must return - * either `null` or `undefined` - * - `Object ({ writable, readable })` converts `readable` and - * `writable` into `Stream` and then combines them into `Duplex` where the - * `Duplex` will write to the `writable` and read from the `readable`. - * - `Promise` converts into readable `Duplex`. Value `null` is ignored. - * - * @since v16.8.0 - */ - static from( - src: - | Stream - | NodeBlob - | ArrayBuffer - | string - | Iterable - | AsyncIterable - | AsyncGeneratorFunction - | Promise - | Object, - ): Duplex; - _write(chunk: any, encoding: BufferEncoding, callback: (error?: Error | null) => void): void; - _writev?( - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - _destroy(error: Error | null, callback: (error?: Error | null) => void): void; - _final(callback: (error?: Error | null) => void): void; - write(chunk: any, encoding?: BufferEncoding, cb?: (error: Error | null | undefined) => void): boolean; - write(chunk: any, cb?: (error: Error | null | undefined) => void): boolean; - setDefaultEncoding(encoding: BufferEncoding): this; - end(cb?: () => void): this; - end(chunk: any, cb?: () => void): this; - end(chunk: any, encoding?: BufferEncoding, cb?: () => void): this; - cork(): void; - uncork(): void; - /** - * A utility method for creating a web `ReadableStream` and `WritableStream` from a `Duplex`. - * @since v17.0.0 - * @experimental - */ - static toWeb(streamDuplex: Duplex): { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }; - /** - * A utility method for creating a `Duplex` from a web `ReadableStream` and `WritableStream`. - * @since v17.0.0 - * @experimental - */ - static fromWeb( - duplexStream: { - readable: streamWeb.ReadableStream; - writable: streamWeb.WritableStream; - }, - options?: Pick< - DuplexOptions, - "allowHalfOpen" | "decodeStrings" | "encoding" | "highWaterMark" | "objectMode" | "signal" - >, - ): Duplex; - /** - * Event emitter - * The defined events on documents including: - * 1. close - * 2. data - * 3. drain - * 4. end - * 5. error - * 6. finish - * 7. pause - * 8. pipe - * 9. readable - * 10. resume - * 11. unpipe - */ - addListener(event: "close", listener: () => void): this; - addListener(event: "data", listener: (chunk: any) => void): this; - addListener(event: "drain", listener: () => void): this; - addListener(event: "end", listener: () => void): this; - addListener(event: "error", listener: (err: Error) => void): this; - addListener(event: "finish", listener: () => void): this; - addListener(event: "pause", listener: () => void): this; - addListener(event: "pipe", listener: (src: Readable) => void): this; - addListener(event: "readable", listener: () => void): this; - addListener(event: "resume", listener: () => void): this; - addListener(event: "unpipe", listener: (src: Readable) => void): this; - addListener(event: string | symbol, listener: (...args: any[]) => void): this; - emit(event: "close"): boolean; - emit(event: "data", chunk: any): boolean; - emit(event: "drain"): boolean; - emit(event: "end"): boolean; - emit(event: "error", err: Error): boolean; - emit(event: "finish"): boolean; - emit(event: "pause"): boolean; - emit(event: "pipe", src: Readable): boolean; - emit(event: "readable"): boolean; - emit(event: "resume"): boolean; - emit(event: "unpipe", src: Readable): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "close", listener: () => void): this; - on(event: "data", listener: (chunk: any) => void): this; - on(event: "drain", listener: () => void): this; - on(event: "end", listener: () => void): this; - on(event: "error", listener: (err: Error) => void): this; - on(event: "finish", listener: () => void): this; - on(event: "pause", listener: () => void): this; - on(event: "pipe", listener: (src: Readable) => void): this; - on(event: "readable", listener: () => void): this; - on(event: "resume", listener: () => void): this; - on(event: "unpipe", listener: (src: Readable) => void): this; - on(event: string | symbol, listener: (...args: any[]) => void): this; - once(event: "close", listener: () => void): this; - once(event: "data", listener: (chunk: any) => void): this; - once(event: "drain", listener: () => void): this; - once(event: "end", listener: () => void): this; - once(event: "error", listener: (err: Error) => void): this; - once(event: "finish", listener: () => void): this; - once(event: "pause", listener: () => void): this; - once(event: "pipe", listener: (src: Readable) => void): this; - once(event: "readable", listener: () => void): this; - once(event: "resume", listener: () => void): this; - once(event: "unpipe", listener: (src: Readable) => void): this; - once(event: string | symbol, listener: (...args: any[]) => void): this; - prependListener(event: "close", listener: () => void): this; - prependListener(event: "data", listener: (chunk: any) => void): this; - prependListener(event: "drain", listener: () => void): this; - prependListener(event: "end", listener: () => void): this; - prependListener(event: "error", listener: (err: Error) => void): this; - prependListener(event: "finish", listener: () => void): this; - prependListener(event: "pause", listener: () => void): this; - prependListener(event: "pipe", listener: (src: Readable) => void): this; - prependListener(event: "readable", listener: () => void): this; - prependListener(event: "resume", listener: () => void): this; - prependListener(event: "unpipe", listener: (src: Readable) => void): this; - prependListener(event: string | symbol, listener: (...args: any[]) => void): this; - prependOnceListener(event: "close", listener: () => void): this; - prependOnceListener(event: "data", listener: (chunk: any) => void): this; - prependOnceListener(event: "drain", listener: () => void): this; - prependOnceListener(event: "end", listener: () => void): this; - prependOnceListener(event: "error", listener: (err: Error) => void): this; - prependOnceListener(event: "finish", listener: () => void): this; - prependOnceListener(event: "pause", listener: () => void): this; - prependOnceListener(event: "pipe", listener: (src: Readable) => void): this; - prependOnceListener(event: "readable", listener: () => void): this; - prependOnceListener(event: "resume", listener: () => void): this; - prependOnceListener(event: "unpipe", listener: (src: Readable) => void): this; - prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): this; - removeListener(event: "close", listener: () => void): this; - removeListener(event: "data", listener: (chunk: any) => void): this; - removeListener(event: "drain", listener: () => void): this; - removeListener(event: "end", listener: () => void): this; - removeListener(event: "error", listener: (err: Error) => void): this; - removeListener(event: "finish", listener: () => void): this; - removeListener(event: "pause", listener: () => void): this; - removeListener(event: "pipe", listener: (src: Readable) => void): this; - removeListener(event: "readable", listener: () => void): this; - removeListener(event: "resume", listener: () => void): this; - removeListener(event: "unpipe", listener: (src: Readable) => void): this; - removeListener(event: string | symbol, listener: (...args: any[]) => void): this; - } - type TransformCallback = (error?: Error | null, data?: any) => void; - interface TransformOptions extends DuplexOptions { - construct?(this: Transform, callback: (error?: Error | null) => void): void; - read?(this: Transform, size: number): void; - write?( - this: Transform, - chunk: any, - encoding: BufferEncoding, - callback: (error?: Error | null) => void, - ): void; - writev?( - this: Transform, - chunks: Array<{ - chunk: any; - encoding: BufferEncoding; - }>, - callback: (error?: Error | null) => void, - ): void; - final?(this: Transform, callback: (error?: Error | null) => void): void; - destroy?(this: Transform, error: Error | null, callback: (error?: Error | null) => void): void; - transform?(this: Transform, chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - flush?(this: Transform, callback: TransformCallback): void; - } - /** - * Transform streams are `Duplex` streams where the output is in some way - * related to the input. Like all `Duplex` streams, `Transform` streams - * implement both the `Readable` and `Writable` interfaces. - * - * Examples of `Transform` streams include: - * - * * `zlib streams` - * * `crypto streams` - * @since v0.9.4 - */ - class Transform extends Duplex { - constructor(opts?: TransformOptions); - _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void; - _flush(callback: TransformCallback): void; - } - /** - * The `stream.PassThrough` class is a trivial implementation of a `Transform` stream that simply passes the input bytes across to the output. Its purpose is - * primarily for examples and testing, but there are some use cases where`stream.PassThrough` is useful as a building block for novel sorts of streams. - */ - class PassThrough extends Transform {} - /** - * A stream to attach a signal to. - * - * Attaches an AbortSignal to a readable or writeable stream. This lets code - * control stream destruction using an `AbortController`. - * - * Calling `abort` on the `AbortController` corresponding to the passed`AbortSignal` will behave the same way as calling `.destroy(new AbortError())`on the stream, and `controller.error(new - * AbortError())` for webstreams. - * - * ```js - * const fs = require('node:fs'); - * - * const controller = new AbortController(); - * const read = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * // Later, abort the operation closing the stream - * controller.abort(); - * ``` - * - * Or using an `AbortSignal` with a readable stream as an async iterable: - * - * ```js - * const controller = new AbortController(); - * setTimeout(() => controller.abort(), 10_000); // set a timeout - * const stream = addAbortSignal( - * controller.signal, - * fs.createReadStream(('object.json')), - * ); - * (async () => { - * try { - * for await (const chunk of stream) { - * await process(chunk); - * } - * } catch (e) { - * if (e.name === 'AbortError') { - * // The operation was cancelled - * } else { - * throw e; - * } - * } - * })(); - * ``` - * - * Or using an `AbortSignal` with a ReadableStream: - * - * ```js - * const controller = new AbortController(); - * const rs = new ReadableStream({ - * start(controller) { - * controller.enqueue('hello'); - * controller.enqueue('world'); - * controller.close(); - * }, - * }); - * - * addAbortSignal(controller.signal, rs); - * - * finished(rs, (err) => { - * if (err) { - * if (err.name === 'AbortError') { - * // The operation was cancelled - * } - * } - * }); - * - * const reader = rs.getReader(); - * - * reader.read().then(({ value, done }) => { - * console.log(value); // hello - * console.log(done); // false - * controller.abort(); - * }); - * ``` - * @since v15.4.0 - * @param signal A signal representing possible cancellation - * @param stream a stream to attach a signal to - */ - function addAbortSignal(signal: AbortSignal, stream: T): T; - /** - * Returns the default highWaterMark used by streams. - * Defaults to `16384` (16 KiB), or `16` for `objectMode`. - * @since v19.9.0 - * @param objectMode - */ - function getDefaultHighWaterMark(objectMode: boolean): number; - /** - * Sets the default highWaterMark used by streams. - * @since v19.9.0 - * @param objectMode - * @param value highWaterMark value - */ - function setDefaultHighWaterMark(objectMode: boolean, value: number): void; - interface FinishedOptions extends Abortable { - error?: boolean | undefined; - readable?: boolean | undefined; - writable?: boolean | undefined; - } - /** - * A readable and/or writable stream/webstream. - * - * A function to get notified when a stream is no longer readable, writable - * or has experienced an error or a premature close event. - * - * ```js - * const { finished } = require('node:stream'); - * const fs = require('node:fs'); - * - * const rs = fs.createReadStream('archive.tar'); - * - * finished(rs, (err) => { - * if (err) { - * console.error('Stream failed.', err); - * } else { - * console.log('Stream is done reading.'); - * } - * }); - * - * rs.resume(); // Drain the stream. - * ``` - * - * Especially useful in error handling scenarios where a stream is destroyed - * prematurely (like an aborted HTTP request), and will not emit `'end'`or `'finish'`. - * - * The `finished` API provides `promise version`. - * - * `stream.finished()` leaves dangling event listeners (in particular`'error'`, `'end'`, `'finish'` and `'close'`) after `callback` has been - * invoked. The reason for this is so that unexpected `'error'` events (due to - * incorrect stream implementations) do not cause unexpected crashes. - * If this is unwanted behavior then the returned cleanup function needs to be - * invoked in the callback: - * - * ```js - * const cleanup = finished(rs, (err) => { - * cleanup(); - * // ... - * }); - * ``` - * @since v10.0.0 - * @param stream A readable and/or writable stream. - * @param callback A callback function that takes an optional error argument. - * @return A cleanup function which removes all registered listeners. - */ - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options: FinishedOptions, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - callback: (err?: NodeJS.ErrnoException | null) => void, - ): () => void; - namespace finished { - function __promisify__( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - } - type PipelineSourceFunction = () => Iterable | AsyncIterable; - type PipelineSource = Iterable | AsyncIterable | NodeJS.ReadableStream | PipelineSourceFunction; - type PipelineTransform, U> = - | NodeJS.ReadWriteStream - | (( - source: S extends (...args: any[]) => Iterable | AsyncIterable ? AsyncIterable - : S, - ) => AsyncIterable); - type PipelineTransformSource = PipelineSource | PipelineTransform; - type PipelineDestinationIterableFunction = (source: AsyncIterable) => AsyncIterable; - type PipelineDestinationPromiseFunction = (source: AsyncIterable) => Promise

; - type PipelineDestination, P> = S extends - PipelineTransformSource ? - | NodeJS.WritableStream - | PipelineDestinationIterableFunction - | PipelineDestinationPromiseFunction - : never; - type PipelineCallback> = S extends - PipelineDestinationPromiseFunction ? (err: NodeJS.ErrnoException | null, value: P) => void - : (err: NodeJS.ErrnoException | null) => void; - type PipelinePromise> = S extends - PipelineDestinationPromiseFunction ? Promise

: Promise; - interface PipelineOptions { - signal?: AbortSignal | undefined; - end?: boolean | undefined; - } - /** - * A module method to pipe between streams and generators forwarding errors and - * properly cleaning up and provide a callback when the pipeline is complete. - * - * ```js - * const { pipeline } = require('node:stream'); - * const fs = require('node:fs'); - * const zlib = require('node:zlib'); - * - * // Use the pipeline API to easily pipe a series of streams - * // together and get notified when the pipeline is fully done. - * - * // A pipeline to gzip a potentially huge tar file efficiently: - * - * pipeline( - * fs.createReadStream('archive.tar'), - * zlib.createGzip(), - * fs.createWriteStream('archive.tar.gz'), - * (err) => { - * if (err) { - * console.error('Pipeline failed.', err); - * } else { - * console.log('Pipeline succeeded.'); - * } - * }, - * ); - * ``` - * - * The `pipeline` API provides a `promise version`. - * - * `stream.pipeline()` will call `stream.destroy(err)` on all streams except: - * - * * `Readable` streams which have emitted `'end'` or `'close'`. - * * `Writable` streams which have emitted `'finish'` or `'close'`. - * - * `stream.pipeline()` leaves dangling event listeners on the streams - * after the `callback` has been invoked. In the case of reuse of streams after - * failure, this can cause event listener leaks and swallowed errors. If the last - * stream is readable, dangling event listeners will be removed so that the last - * stream can be consumed later. - * - * `stream.pipeline()` closes all the streams when an error is raised. - * The `IncomingRequest` usage with `pipeline` could lead to an unexpected behavior - * once it would destroy the socket without sending the expected response. - * See the example below: - * - * ```js - * const fs = require('node:fs'); - * const http = require('node:http'); - * const { pipeline } = require('node:stream'); - * - * const server = http.createServer((req, res) => { - * const fileStream = fs.createReadStream('./fileNotExist.txt'); - * pipeline(fileStream, res, (err) => { - * if (err) { - * console.log(err); // No such file - * // this message can't be sent once `pipeline` already destroyed the socket - * return res.end('error!!!'); - * } - * }); - * }); - * ``` - * @since v10.0.0 - * @param callback Called when the pipeline is fully done. - */ - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - callback?: PipelineCallback, - ): B extends NodeJS.WritableStream ? B : NodeJS.WritableStream; - function pipeline( - streams: ReadonlyArray, - callback?: (err: NodeJS.ErrnoException | null) => void, - ): NodeJS.WritableStream; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array< - NodeJS.ReadWriteStream | NodeJS.WritableStream | ((err: NodeJS.ErrnoException | null) => void) - > - ): NodeJS.WritableStream; - namespace pipeline { - function __promisify__, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function __promisify__( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function __promisify__( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; - } - interface Pipe { - close(): void; - hasRef(): boolean; - ref(): void; - unref(): void; - } - /** - * Returns whether the stream has encountered an error. - * @since v17.3.0, v16.14.0 - * @experimental - */ - function isErrored(stream: Readable | Writable | NodeJS.ReadableStream | NodeJS.WritableStream): boolean; - /** - * Returns whether the stream is readable. - * @since v17.4.0, v16.14.0 - * @experimental - */ - function isReadable(stream: Readable | NodeJS.ReadableStream): boolean; - const promises: typeof streamPromises; - const consumers: typeof streamConsumers; - } - export = internal; -} -declare module "node:stream" { - import stream = require("stream"); - export = stream; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/stream/consumers.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/stream/consumers.d.ts deleted file mode 100644 index 5ad9cbab..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/stream/consumers.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -declare module "stream/consumers" { - import { Blob as NodeBlob } from "node:buffer"; - import { Readable } from "node:stream"; - function buffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function text(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function arrayBuffer(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function blob(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; - function json(stream: NodeJS.ReadableStream | Readable | AsyncIterable): Promise; -} -declare module "node:stream/consumers" { - export * from "stream/consumers"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/stream/promises.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/stream/promises.d.ts deleted file mode 100644 index 6eac5b71..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/stream/promises.d.ts +++ /dev/null @@ -1,83 +0,0 @@ -declare module "stream/promises" { - import { - FinishedOptions, - PipelineDestination, - PipelineOptions, - PipelinePromise, - PipelineSource, - PipelineTransform, - } from "node:stream"; - function finished( - stream: NodeJS.ReadableStream | NodeJS.WritableStream | NodeJS.ReadWriteStream, - options?: FinishedOptions, - ): Promise; - function pipeline, B extends PipelineDestination>( - source: A, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline< - A extends PipelineSource, - T1 extends PipelineTransform, - T2 extends PipelineTransform, - T3 extends PipelineTransform, - T4 extends PipelineTransform, - B extends PipelineDestination, - >( - source: A, - transform1: T1, - transform2: T2, - transform3: T3, - transform4: T4, - destination: B, - options?: PipelineOptions, - ): PipelinePromise; - function pipeline( - streams: ReadonlyArray, - options?: PipelineOptions, - ): Promise; - function pipeline( - stream1: NodeJS.ReadableStream, - stream2: NodeJS.ReadWriteStream | NodeJS.WritableStream, - ...streams: Array - ): Promise; -} -declare module "node:stream/promises" { - export * from "stream/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/stream/web.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/stream/web.d.ts deleted file mode 100644 index 0d916137..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/stream/web.d.ts +++ /dev/null @@ -1,350 +0,0 @@ -declare module "stream/web" { - // stub module, pending copy&paste from .d.ts or manual impl - // copy from lib.dom.d.ts - interface ReadableWritablePair { - readable: ReadableStream; - /** - * Provides a convenient, chainable way of piping this readable stream - * through a transform stream (or any other { writable, readable } - * pair). It simply pipes the stream into the writable side of the - * supplied pair, and returns the readable side for further use. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - */ - writable: WritableStream; - } - interface StreamPipeOptions { - preventAbort?: boolean; - preventCancel?: boolean; - /** - * Pipes this readable stream to a given writable stream destination. - * The way in which the piping process behaves under various error - * conditions can be customized with a number of passed options. It - * returns a promise that fulfills when the piping process completes - * successfully, or rejects if any errors were encountered. - * - * Piping a stream will lock it for the duration of the pipe, preventing - * any other consumer from acquiring a reader. - * - * Errors and closures of the source and destination streams propagate - * as follows: - * - * An error in this source readable stream will abort destination, - * unless preventAbort is truthy. The returned promise will be rejected - * with the source's error, or with any error that occurs during - * aborting the destination. - * - * An error in destination will cancel this source readable stream, - * unless preventCancel is truthy. The returned promise will be rejected - * with the destination's error, or with any error that occurs during - * canceling the source. - * - * When this source readable stream closes, destination will be closed, - * unless preventClose is truthy. The returned promise will be fulfilled - * once this process completes, unless an error is encountered while - * closing the destination, in which case it will be rejected with that - * error. - * - * If destination starts out closed or closing, this source readable - * stream will be canceled, unless preventCancel is true. The returned - * promise will be rejected with an error indicating piping to a closed - * stream failed, or with any error that occurs during canceling the - * source. - * - * The signal option can be set to an AbortSignal to allow aborting an - * ongoing pipe operation via the corresponding AbortController. In this - * case, this source readable stream will be canceled, and destination - * aborted, unless the respective options preventCancel or preventAbort - * are set. - */ - preventClose?: boolean; - signal?: AbortSignal; - } - interface ReadableStreamGenericReader { - readonly closed: Promise; - cancel(reason?: any): Promise; - } - interface ReadableStreamDefaultReadValueResult { - done: false; - value: T; - } - interface ReadableStreamDefaultReadDoneResult { - done: true; - value?: undefined; - } - type ReadableStreamController = ReadableStreamDefaultController; - type ReadableStreamDefaultReadResult = - | ReadableStreamDefaultReadValueResult - | ReadableStreamDefaultReadDoneResult; - interface ReadableStreamReadValueResult { - done: false; - value: T; - } - interface ReadableStreamReadDoneResult { - done: true; - value?: T; - } - type ReadableStreamReadResult = ReadableStreamReadValueResult | ReadableStreamReadDoneResult; - interface ReadableByteStreamControllerCallback { - (controller: ReadableByteStreamController): void | PromiseLike; - } - interface UnderlyingSinkAbortCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSinkCloseCallback { - (): void | PromiseLike; - } - interface UnderlyingSinkStartCallback { - (controller: WritableStreamDefaultController): any; - } - interface UnderlyingSinkWriteCallback { - (chunk: W, controller: WritableStreamDefaultController): void | PromiseLike; - } - interface UnderlyingSourceCancelCallback { - (reason?: any): void | PromiseLike; - } - interface UnderlyingSourcePullCallback { - (controller: ReadableStreamController): void | PromiseLike; - } - interface UnderlyingSourceStartCallback { - (controller: ReadableStreamController): any; - } - interface TransformerFlushCallback { - (controller: TransformStreamDefaultController): void | PromiseLike; - } - interface TransformerStartCallback { - (controller: TransformStreamDefaultController): any; - } - interface TransformerTransformCallback { - (chunk: I, controller: TransformStreamDefaultController): void | PromiseLike; - } - interface UnderlyingByteSource { - autoAllocateChunkSize?: number; - cancel?: ReadableStreamErrorCallback; - pull?: ReadableByteStreamControllerCallback; - start?: ReadableByteStreamControllerCallback; - type: "bytes"; - } - interface UnderlyingSource { - cancel?: UnderlyingSourceCancelCallback; - pull?: UnderlyingSourcePullCallback; - start?: UnderlyingSourceStartCallback; - type?: undefined; - } - interface UnderlyingSink { - abort?: UnderlyingSinkAbortCallback; - close?: UnderlyingSinkCloseCallback; - start?: UnderlyingSinkStartCallback; - type?: undefined; - write?: UnderlyingSinkWriteCallback; - } - interface ReadableStreamErrorCallback { - (reason: any): void | PromiseLike; - } - /** This Streams API interface represents a readable stream of byte data. */ - interface ReadableStream { - readonly locked: boolean; - cancel(reason?: any): Promise; - getReader(): ReadableStreamDefaultReader; - getReader(options: { mode: "byob" }): ReadableStreamBYOBReader; - pipeThrough(transform: ReadableWritablePair, options?: StreamPipeOptions): ReadableStream; - pipeTo(destination: WritableStream, options?: StreamPipeOptions): Promise; - tee(): [ReadableStream, ReadableStream]; - values(options?: { preventCancel?: boolean }): AsyncIterableIterator; - [Symbol.asyncIterator](): AsyncIterableIterator; - } - const ReadableStream: { - prototype: ReadableStream; - new(underlyingSource: UnderlyingByteSource, strategy?: QueuingStrategy): ReadableStream; - new(underlyingSource?: UnderlyingSource, strategy?: QueuingStrategy): ReadableStream; - }; - interface ReadableStreamDefaultReader extends ReadableStreamGenericReader { - read(): Promise>; - releaseLock(): void; - } - interface ReadableStreamBYOBReader extends ReadableStreamGenericReader { - read(view: T): Promise>; - releaseLock(): void; - } - const ReadableStreamDefaultReader: { - prototype: ReadableStreamDefaultReader; - new(stream: ReadableStream): ReadableStreamDefaultReader; - }; - const ReadableStreamBYOBReader: any; - const ReadableStreamBYOBRequest: any; - interface ReadableByteStreamController { - readonly byobRequest: undefined; - readonly desiredSize: number | null; - close(): void; - enqueue(chunk: ArrayBufferView): void; - error(error?: any): void; - } - const ReadableByteStreamController: { - prototype: ReadableByteStreamController; - new(): ReadableByteStreamController; - }; - interface ReadableStreamDefaultController { - readonly desiredSize: number | null; - close(): void; - enqueue(chunk?: R): void; - error(e?: any): void; - } - const ReadableStreamDefaultController: { - prototype: ReadableStreamDefaultController; - new(): ReadableStreamDefaultController; - }; - interface Transformer { - flush?: TransformerFlushCallback; - readableType?: undefined; - start?: TransformerStartCallback; - transform?: TransformerTransformCallback; - writableType?: undefined; - } - interface TransformStream { - readonly readable: ReadableStream; - readonly writable: WritableStream; - } - const TransformStream: { - prototype: TransformStream; - new( - transformer?: Transformer, - writableStrategy?: QueuingStrategy, - readableStrategy?: QueuingStrategy, - ): TransformStream; - }; - interface TransformStreamDefaultController { - readonly desiredSize: number | null; - enqueue(chunk?: O): void; - error(reason?: any): void; - terminate(): void; - } - const TransformStreamDefaultController: { - prototype: TransformStreamDefaultController; - new(): TransformStreamDefaultController; - }; - /** - * This Streams API interface provides a standard abstraction for writing - * streaming data to a destination, known as a sink. This object comes with - * built-in back pressure and queuing. - */ - interface WritableStream { - readonly locked: boolean; - abort(reason?: any): Promise; - close(): Promise; - getWriter(): WritableStreamDefaultWriter; - } - const WritableStream: { - prototype: WritableStream; - new(underlyingSink?: UnderlyingSink, strategy?: QueuingStrategy): WritableStream; - }; - /** - * This Streams API interface is the object returned by - * WritableStream.getWriter() and once created locks the < writer to the - * WritableStream ensuring that no other streams can write to the underlying - * sink. - */ - interface WritableStreamDefaultWriter { - readonly closed: Promise; - readonly desiredSize: number | null; - readonly ready: Promise; - abort(reason?: any): Promise; - close(): Promise; - releaseLock(): void; - write(chunk?: W): Promise; - } - const WritableStreamDefaultWriter: { - prototype: WritableStreamDefaultWriter; - new(stream: WritableStream): WritableStreamDefaultWriter; - }; - /** - * This Streams API interface represents a controller allowing control of a - * WritableStream's state. When constructing a WritableStream, the - * underlying sink is given a corresponding WritableStreamDefaultController - * instance to manipulate. - */ - interface WritableStreamDefaultController { - error(e?: any): void; - } - const WritableStreamDefaultController: { - prototype: WritableStreamDefaultController; - new(): WritableStreamDefaultController; - }; - interface QueuingStrategy { - highWaterMark?: number; - size?: QueuingStrategySize; - } - interface QueuingStrategySize { - (chunk?: T): number; - } - interface QueuingStrategyInit { - /** - * Creates a new ByteLengthQueuingStrategy with the provided high water - * mark. - * - * Note that the provided high water mark will not be validated ahead of - * time. Instead, if it is negative, NaN, or not a number, the resulting - * ByteLengthQueuingStrategy will cause the corresponding stream - * constructor to throw. - */ - highWaterMark: number; - } - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface ByteLengthQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const ByteLengthQueuingStrategy: { - prototype: ByteLengthQueuingStrategy; - new(init: QueuingStrategyInit): ByteLengthQueuingStrategy; - }; - /** - * This Streams API interface provides a built-in byte length queuing - * strategy that can be used when constructing streams. - */ - interface CountQueuingStrategy extends QueuingStrategy { - readonly highWaterMark: number; - readonly size: QueuingStrategySize; - } - const CountQueuingStrategy: { - prototype: CountQueuingStrategy; - new(init: QueuingStrategyInit): CountQueuingStrategy; - }; - interface TextEncoderStream { - /** Returns "utf-8". */ - readonly encoding: "utf-8"; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextEncoderStream: { - prototype: TextEncoderStream; - new(): TextEncoderStream; - }; - interface TextDecoderOptions { - fatal?: boolean; - ignoreBOM?: boolean; - } - type BufferSource = ArrayBufferView | ArrayBuffer; - interface TextDecoderStream { - /** Returns encoding's name, lower cased. */ - readonly encoding: string; - /** Returns `true` if error mode is "fatal", and `false` otherwise. */ - readonly fatal: boolean; - /** Returns `true` if ignore BOM flag is set, and `false` otherwise. */ - readonly ignoreBOM: boolean; - readonly readable: ReadableStream; - readonly writable: WritableStream; - readonly [Symbol.toStringTag]: string; - } - const TextDecoderStream: { - prototype: TextDecoderStream; - new(label?: string, options?: TextDecoderOptions): TextDecoderStream; - }; -} -declare module "node:stream/web" { - export * from "stream/web"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/string_decoder.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/string_decoder.d.ts deleted file mode 100644 index b8691e1f..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/string_decoder.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -/** - * The `node:string_decoder` module provides an API for decoding `Buffer` objects - * into strings in a manner that preserves encoded multi-byte UTF-8 and UTF-16 - * characters. It can be accessed using: - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * ``` - * - * The following example shows the basic use of the `StringDecoder` class. - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * const decoder = new StringDecoder('utf8'); - * - * const cent = Buffer.from([0xC2, 0xA2]); - * console.log(decoder.write(cent)); // Prints: ¢ - * - * const euro = Buffer.from([0xE2, 0x82, 0xAC]); - * console.log(decoder.write(euro)); // Prints: € - * ``` - * - * When a `Buffer` instance is written to the `StringDecoder` instance, an - * internal buffer is used to ensure that the decoded string does not contain - * any incomplete multibyte characters. These are held in the buffer until the - * next call to `stringDecoder.write()` or until `stringDecoder.end()` is called. - * - * In the following example, the three UTF-8 encoded bytes of the European Euro - * symbol (`€`) are written over three separate operations: - * - * ```js - * const { StringDecoder } = require('node:string_decoder'); - * const decoder = new StringDecoder('utf8'); - * - * decoder.write(Buffer.from([0xE2])); - * decoder.write(Buffer.from([0x82])); - * console.log(decoder.end(Buffer.from([0xAC]))); // Prints: € - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/string_decoder.js) - */ -declare module "string_decoder" { - class StringDecoder { - constructor(encoding?: BufferEncoding); - /** - * Returns a decoded string, ensuring that any incomplete multibyte characters at - * the end of the `Buffer`, or `TypedArray`, or `DataView` are omitted from the - * returned string and stored in an internal buffer for the next call to`stringDecoder.write()` or `stringDecoder.end()`. - * @since v0.1.99 - * @param buffer The bytes to decode. - */ - write(buffer: Buffer): string; - /** - * Returns any remaining input stored in the internal buffer as a string. Bytes - * representing incomplete UTF-8 and UTF-16 characters will be replaced with - * substitution characters appropriate for the character encoding. - * - * If the `buffer` argument is provided, one final call to `stringDecoder.write()`is performed before returning the remaining input. - * After `end()` is called, the `stringDecoder` object can be reused for new input. - * @since v0.9.3 - * @param buffer The bytes to decode. - */ - end(buffer?: Buffer): string; - } -} -declare module "node:string_decoder" { - export * from "string_decoder"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/test.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/test.d.ts deleted file mode 100644 index 44b6a964..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/test.d.ts +++ /dev/null @@ -1,1382 +0,0 @@ -/** - * The `node:test` module facilitates the creation of JavaScript tests. - * To access it: - * - * ```js - * import test from 'node:test'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'test'; - * ``` - * - * Tests created via the `test` module consist of a single function that is - * processed in one of three ways: - * - * 1. A synchronous function that is considered failing if it throws an exception, - * and is considered passing otherwise. - * 2. A function that returns a `Promise` that is considered failing if the`Promise` rejects, and is considered passing if the `Promise` fulfills. - * 3. A function that receives a callback function. If the callback receives any - * truthy value as its first argument, the test is considered failing. If a - * falsy value is passed as the first argument to the callback, the test is - * considered passing. If the test function receives a callback function and - * also returns a `Promise`, the test will fail. - * - * The following example illustrates how tests are written using the`test` module. - * - * ```js - * test('synchronous passing test', (t) => { - * // This test passes because it does not throw an exception. - * assert.strictEqual(1, 1); - * }); - * - * test('synchronous failing test', (t) => { - * // This test fails because it throws an exception. - * assert.strictEqual(1, 2); - * }); - * - * test('asynchronous passing test', async (t) => { - * // This test passes because the Promise returned by the async - * // function is settled and not rejected. - * assert.strictEqual(1, 1); - * }); - * - * test('asynchronous failing test', async (t) => { - * // This test fails because the Promise returned by the async - * // function is rejected. - * assert.strictEqual(1, 2); - * }); - * - * test('failing test using Promises', (t) => { - * // Promises can be used directly as well. - * return new Promise((resolve, reject) => { - * setImmediate(() => { - * reject(new Error('this will cause the test to fail')); - * }); - * }); - * }); - * - * test('callback passing test', (t, done) => { - * // done() is the callback function. When the setImmediate() runs, it invokes - * // done() with no arguments. - * setImmediate(done); - * }); - * - * test('callback failing test', (t, done) => { - * // When the setImmediate() runs, done() is invoked with an Error object and - * // the test fails. - * setImmediate(() => { - * done(new Error('callback failure')); - * }); - * }); - * ``` - * - * If any tests fail, the process exit code is set to `1`. - * @since v18.0.0, v16.17.0 - * @see [source](https://github.com/nodejs/node/blob/v20.4.0/lib/test.js) - */ -declare module "node:test" { - import { Readable } from "node:stream"; - import { AsyncResource } from "node:async_hooks"; - /** - * ```js - * import { tap } from 'node:test/reporters'; - * import { run } from 'node:test'; - * import process from 'node:process'; - * import path from 'node:path'; - * - * run({ files: [path.resolve('./tests/test.js')] }) - * .compose(tap) - * .pipe(process.stdout); - * ``` - * @since v18.9.0, v16.19.0 - * @param options Configuration options for running tests. The following properties are supported: - */ - function run(options?: RunOptions): TestsStream; - /** - * The `test()` function is the value imported from the `test` module. Each - * invocation of this function results in reporting the test to the `TestsStream`. - * - * The `TestContext` object passed to the `fn` argument can be used to perform - * actions related to the current test. Examples include skipping the test, adding - * additional diagnostic information, or creating subtests. - * - * `test()` returns a `Promise` that fulfills once the test completes. - * if `test()` is called within a `describe()` block, it fulfills immediately. - * The return value can usually be discarded for top level tests. - * However, the return value from subtests should be used to prevent the parent - * test from finishing first and cancelling the subtest - * as shown in the following example. - * - * ```js - * test('top level test', async (t) => { - * // The setTimeout() in the following subtest would cause it to outlive its - * // parent test if 'await' is removed on the next line. Once the parent test - * // completes, it will cancel any outstanding subtests. - * await t.test('longer running subtest', async (t) => { - * return new Promise((resolve, reject) => { - * setTimeout(resolve, 1000); - * }); - * }); - * }); - * ``` - * - * The `timeout` option can be used to fail the test if it takes longer than`timeout` milliseconds to complete. However, it is not a reliable mechanism for - * canceling tests because a running test might block the application thread and - * thus prevent the scheduled cancellation. - * @since v18.0.0, v16.17.0 - * @param [name='The name'] The name of the test, which is displayed when reporting test results. - * @param options Configuration options for the test. The following properties are supported: - * @param [fn='A no-op function'] The function under test. The first argument to this function is a {@link TestContext} object. If the test uses callbacks, the callback function is passed as the - * second argument. - * @return Fulfilled with `undefined` once the test completes, or immediately if the test runs within {@link describe}. - */ - function test(name?: string, fn?: TestFn): Promise; - function test(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function test(options?: TestOptions, fn?: TestFn): Promise; - function test(fn?: TestFn): Promise; - namespace test { - export { after, afterEach, before, beforeEach, describe, it, mock, only, run, skip, test, todo }; - } - /** - * The `describe()` function imported from the `node:test` module. Each - * invocation of this function results in the creation of a Subtest. - * After invocation of top level `describe` functions, - * all top level tests and suites will execute. - * @param [name='The name'] The name of the suite, which is displayed when reporting test results. - * @param options Configuration options for the suite. supports the same options as `test([name][, options][, fn])`. - * @param [fn='A no-op function'] The function under suite declaring all subtests and subsuites. The first argument to this function is a {@link SuiteContext} object. - * @return Immediately fulfilled with `undefined`. - */ - function describe(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function describe(name?: string, fn?: SuiteFn): Promise; - function describe(options?: TestOptions, fn?: SuiteFn): Promise; - function describe(fn?: SuiteFn): Promise; - namespace describe { - /** - * Shorthand for skipping a suite, same as `describe([name], { skip: true }[, fn])`. - */ - function skip(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function skip(name?: string, fn?: SuiteFn): Promise; - function skip(options?: TestOptions, fn?: SuiteFn): Promise; - function skip(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `TODO`, same as `describe([name], { todo: true }[, fn])`. - */ - function todo(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function todo(name?: string, fn?: SuiteFn): Promise; - function todo(options?: TestOptions, fn?: SuiteFn): Promise; - function todo(fn?: SuiteFn): Promise; - /** - * Shorthand for marking a suite as `only`, same as `describe([name], { only: true }[, fn])`. - * @since v18.15.0 - */ - function only(name?: string, options?: TestOptions, fn?: SuiteFn): Promise; - function only(name?: string, fn?: SuiteFn): Promise; - function only(options?: TestOptions, fn?: SuiteFn): Promise; - function only(fn?: SuiteFn): Promise; - } - /** - * Shorthand for `test()`. - * - * The `it()` function is imported from the `node:test` module. - * @since v18.6.0, v16.17.0 - */ - function it(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function it(name?: string, fn?: TestFn): Promise; - function it(options?: TestOptions, fn?: TestFn): Promise; - function it(fn?: TestFn): Promise; - namespace it { - /** - * Shorthand for skipping a test, same as `it([name], { skip: true }[, fn])`. - */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function skip(name?: string, fn?: TestFn): Promise; - function skip(options?: TestOptions, fn?: TestFn): Promise; - function skip(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `TODO`, same as `it([name], { todo: true }[, fn])`. - */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function todo(name?: string, fn?: TestFn): Promise; - function todo(options?: TestOptions, fn?: TestFn): Promise; - function todo(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `only`, same as `it([name], { only: true }[, fn])`. - * @since v18.15.0 - */ - function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function only(name?: string, fn?: TestFn): Promise; - function only(options?: TestOptions, fn?: TestFn): Promise; - function only(fn?: TestFn): Promise; - } - /** - * Shorthand for skipping a test, same as `test([name], { skip: true }[, fn])`. - * @since v20.2.0 - */ - function skip(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function skip(name?: string, fn?: TestFn): Promise; - function skip(options?: TestOptions, fn?: TestFn): Promise; - function skip(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `TODO`, same as `test([name], { todo: true }[, fn])`. - * @since v20.2.0 - */ - function todo(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function todo(name?: string, fn?: TestFn): Promise; - function todo(options?: TestOptions, fn?: TestFn): Promise; - function todo(fn?: TestFn): Promise; - /** - * Shorthand for marking a test as `only`, same as `test([name], { only: true }[, fn])`. - * @since v20.2.0 - */ - function only(name?: string, options?: TestOptions, fn?: TestFn): Promise; - function only(name?: string, fn?: TestFn): Promise; - function only(options?: TestOptions, fn?: TestFn): Promise; - function only(fn?: TestFn): Promise; - /** - * The type of a function under test. The first argument to this function is a - * {@link TestContext} object. If the test uses callbacks, the callback function is passed as - * the second argument. - */ - type TestFn = (t: TestContext, done: (result?: any) => void) => void | Promise; - /** - * The type of a function under Suite. - */ - type SuiteFn = (s: SuiteContext) => void | Promise; - interface TestShard { - /** - * A positive integer between 1 and `` that specifies the index of the shard to run. - */ - index: number; - /** - * A positive integer that specifies the total number of shards to split the test files to. - */ - total: number; - } - interface RunOptions { - /** - * If a number is provided, then that many files would run in parallel. - * If truthy, it would run (number of cpu cores - 1) files in parallel. - * If falsy, it would only run one file at a time. - * If unspecified, subtests inherit this value from their parent. - * @default true - */ - concurrency?: number | boolean | undefined; - /** - * An array containing the list of files to run. - * If unspecified, the test runner execution model will be used. - */ - files?: readonly string[] | undefined; - /** - * Allows aborting an in-progress test execution. - * @default undefined - */ - signal?: AbortSignal | undefined; - /** - * A number of milliseconds the test will fail after. - * If unspecified, subtests inherit this value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - /** - * Sets inspector port of test child process. - * If a nullish value is provided, each process gets its own port, - * incremented from the primary's `process.debugPort`. - */ - inspectPort?: number | (() => number) | undefined; - /** - * That can be used to only run tests whose name matches the provided pattern. - * Test name patterns are interpreted as JavaScript regular expressions. - * For each test that is executed, any corresponding test hooks, such as `beforeEach()`, are also run. - */ - testNamePatterns?: string | RegExp | string[] | RegExp[]; - /** - * If truthy, the test context will only run tests that have the `only` option set - */ - only?: boolean; - /** - * A function that accepts the TestsStream instance and can be used to setup listeners before any tests are run. - */ - setup?: (root: Test) => void | Promise; - /** - * Whether to run in watch mode or not. - * @default false - */ - watch?: boolean | undefined; - /** - * Running tests in a specific shard. - * @default undefined - */ - shard?: TestShard | undefined; - } - class Test extends AsyncResource { - concurrency: number; - nesting: number; - only: boolean; - reporter: TestsStream; - runOnlySubtests: boolean; - testNumber: number; - timeout: number | null; - } - /** - * A successful call to `run()` method will return a new `TestsStream` object, streaming a series of events representing the execution of the tests.`TestsStream` will emit events, in the - * order of the tests definition - * @since v18.9.0, v16.19.0 - */ - class TestsStream extends Readable implements NodeJS.ReadableStream { - addListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - addListener(event: "test:fail", listener: (data: TestFail) => void): this; - addListener(event: "test:pass", listener: (data: TestPass) => void): this; - addListener(event: "test:plan", listener: (data: TestPlan) => void): this; - addListener(event: "test:start", listener: (data: TestStart) => void): this; - addListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - addListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - addListener(event: string, listener: (...args: any[]) => void): this; - emit(event: "test:diagnostic", data: DiagnosticData): boolean; - emit(event: "test:fail", data: TestFail): boolean; - emit(event: "test:pass", data: TestPass): boolean; - emit(event: "test:plan", data: TestPlan): boolean; - emit(event: "test:start", data: TestStart): boolean; - emit(event: "test:stderr", data: TestStderr): boolean; - emit(event: "test:stdout", data: TestStdout): boolean; - emit(event: string | symbol, ...args: any[]): boolean; - on(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - on(event: "test:fail", listener: (data: TestFail) => void): this; - on(event: "test:pass", listener: (data: TestPass) => void): this; - on(event: "test:plan", listener: (data: TestPlan) => void): this; - on(event: "test:start", listener: (data: TestStart) => void): this; - on(event: "test:stderr", listener: (data: TestStderr) => void): this; - on(event: "test:stdout", listener: (data: TestStdout) => void): this; - on(event: string, listener: (...args: any[]) => void): this; - once(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - once(event: "test:fail", listener: (data: TestFail) => void): this; - once(event: "test:pass", listener: (data: TestPass) => void): this; - once(event: "test:plan", listener: (data: TestPlan) => void): this; - once(event: "test:start", listener: (data: TestStart) => void): this; - once(event: "test:stderr", listener: (data: TestStderr) => void): this; - once(event: "test:stdout", listener: (data: TestStdout) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - prependListener(event: "test:fail", listener: (data: TestFail) => void): this; - prependListener(event: "test:pass", listener: (data: TestPass) => void): this; - prependListener(event: "test:plan", listener: (data: TestPlan) => void): this; - prependListener(event: "test:start", listener: (data: TestStart) => void): this; - prependListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - prependListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "test:diagnostic", listener: (data: DiagnosticData) => void): this; - prependOnceListener(event: "test:fail", listener: (data: TestFail) => void): this; - prependOnceListener(event: "test:pass", listener: (data: TestPass) => void): this; - prependOnceListener(event: "test:plan", listener: (data: TestPlan) => void): this; - prependOnceListener(event: "test:start", listener: (data: TestStart) => void): this; - prependOnceListener(event: "test:stderr", listener: (data: TestStderr) => void): this; - prependOnceListener(event: "test:stdout", listener: (data: TestStdout) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - } - /** - * An instance of `TestContext` is passed to each test function in order to - * interact with the test runner. However, the `TestContext` constructor is not - * exposed as part of the API. - * @since v18.0.0, v16.17.0 - */ - class TestContext { - /** - * This function is used to create a hook running before subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v20.1.0 - */ - before: typeof before; - /** - * This function is used to create a hook running before each subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - beforeEach: typeof beforeEach; - /** - * This function is used to create a hook that runs after the current test finishes. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.13.0 - */ - after: typeof after; - /** - * This function is used to create a hook running after each subtest of the current test. - * @param fn The hook function. If the hook uses callbacks, the callback function is passed as - * the second argument. Default: A no-op function. - * @param options Configuration options for the hook. - * @since v18.8.0 - */ - afterEach: typeof afterEach; - /** - * This function is used to write diagnostics to the output. Any diagnostic - * information is included at the end of the test's results. This function does - * not return a value. - * - * ```js - * test('top level test', (t) => { - * t.diagnostic('A diagnostic message'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Message to be reported. - */ - diagnostic(message: string): void; - /** - * The name of the test. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * If `shouldRunOnlyTests` is truthy, the test context will only run tests that - * have the `only` option set. Otherwise, all tests are run. If Node.js was not - * started with the `--test-only` command-line option, this function is a - * no-op. - * - * ```js - * test('top level test', (t) => { - * // The test context can be set to run subtests with the 'only' option. - * t.runOnly(true); - * return Promise.all([ - * t.test('this subtest is now skipped'), - * t.test('this subtest is run', { only: true }), - * ]); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param shouldRunOnlyTests Whether or not to run `only` tests. - */ - runOnly(shouldRunOnlyTests: boolean): void; - /** - * ```js - * test('top level test', async (t) => { - * await fetch('some/uri', { signal: t.signal }); - * }); - * ``` - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - /** - * This function causes the test's output to indicate the test as skipped. If`message` is provided, it is included in the output. Calling `skip()` does - * not terminate execution of the test function. This function does not return a - * value. - * - * ```js - * test('top level test', (t) => { - * // Make sure to return here as well if the test contains additional logic. - * t.skip('this is skipped'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional skip message. - */ - skip(message?: string): void; - /** - * This function adds a `TODO` directive to the test's output. If `message` is - * provided, it is included in the output. Calling `todo()` does not terminate - * execution of the test function. This function does not return a value. - * - * ```js - * test('top level test', (t) => { - * // This test is marked as `TODO` - * t.todo('this is a todo'); - * }); - * ``` - * @since v18.0.0, v16.17.0 - * @param message Optional `TODO` message. - */ - todo(message?: string): void; - /** - * This function is used to create subtests under the current test. This function behaves in - * the same fashion as the top level {@link test} function. - * @since v18.0.0 - * @param name The name of the test, which is displayed when reporting test results. - * Default: The `name` property of fn, or `''` if `fn` does not have a name. - * @param options Configuration options for the test - * @param fn The function under test. This first argument to this function is a - * {@link TestContext} object. If the test uses callbacks, the callback function is - * passed as the second argument. Default: A no-op function. - * @returns A {@link Promise} resolved with `undefined` once the test completes. - */ - test: typeof test; - /** - * Each test provides its own MockTracker instance. - */ - readonly mock: MockTracker; - } - /** - * An instance of `SuiteContext` is passed to each suite function in order to - * interact with the test runner. However, the `SuiteContext` constructor is not - * exposed as part of the API. - * @since v18.7.0, v16.17.0 - */ - class SuiteContext { - /** - * The name of the suite. - * @since v18.8.0, v16.18.0 - */ - readonly name: string; - /** - * Can be used to abort test subtasks when the test has been aborted. - * @since v18.7.0, v16.17.0 - */ - readonly signal: AbortSignal; - } - interface TestOptions { - /** - * If a number is provided, then that many tests would run in parallel. - * If truthy, it would run (number of cpu cores - 1) tests in parallel. - * For subtests, it will be `Infinity` tests in parallel. - * If falsy, it would only run one test at a time. - * If unspecified, subtests inherit this value from their parent. - * @default false - */ - concurrency?: number | boolean | undefined; - /** - * If truthy, and the test context is configured to run `only` tests, then this test will be - * run. Otherwise, the test is skipped. - * @default false - */ - only?: boolean | undefined; - /** - * Allows aborting an in-progress test. - * @since v18.8.0 - */ - signal?: AbortSignal | undefined; - /** - * If truthy, the test is skipped. If a string is provided, that string is displayed in the - * test results as the reason for skipping the test. - * @default false - */ - skip?: boolean | string | undefined; - /** - * A number of milliseconds the test will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - * @since v18.7.0 - */ - timeout?: number | undefined; - /** - * If truthy, the test marked as `TODO`. If a string is provided, that string is displayed in - * the test results as the reason why the test is `TODO`. - * @default false - */ - todo?: boolean | string | undefined; - } - /** - * This function is used to create a hook running before running a suite. - * - * ```js - * describe('tests', async () => { - * before(() => console.log('about to run some test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function before(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running after running a suite. - * - * ```js - * describe('tests', async () => { - * after(() => console.log('finished running tests')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function after(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running - * before each subtest of the current suite. - * - * ```js - * describe('tests', async () => { - * beforeEach(() => console.log('about to run a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function beforeEach(fn?: HookFn, options?: HookOptions): void; - /** - * This function is used to create a hook running - * after each subtest of the current test. - * - * ```js - * describe('tests', async () => { - * afterEach(() => console.log('finished running a test')); - * it('is a subtest', () => { - * assert.ok('some relevant assertion here'); - * }); - * }); - * ``` - * @since v18.8.0, v16.18.0 - * @param [fn='A no-op function'] The hook function. If the hook uses callbacks, the callback function is passed as the second argument. - * @param options Configuration options for the hook. The following properties are supported: - */ - function afterEach(fn?: HookFn, options?: HookOptions): void; - /** - * The hook function. If the hook uses callbacks, the callback function is passed as the - * second argument. - */ - type HookFn = (s: SuiteContext, done: (result?: any) => void) => any; - /** - * Configuration options for hooks. - * @since v18.8.0 - */ - interface HookOptions { - /** - * Allows aborting an in-progress hook. - */ - signal?: AbortSignal | undefined; - /** - * A number of milliseconds the hook will fail after. If unspecified, subtests inherit this - * value from their parent. - * @default Infinity - */ - timeout?: number | undefined; - } - interface MockFunctionOptions { - /** - * The number of times that the mock will use the behavior of `implementation`. - * Once the mock function has been called `times` times, - * it will automatically restore the behavior of `original`. - * This value must be an integer greater than zero. - * @default Infinity - */ - times?: number | undefined; - } - interface MockMethodOptions extends MockFunctionOptions { - /** - * If `true`, `object[methodName]` is treated as a getter. - * This option cannot be used with the `setter` option. - */ - getter?: boolean | undefined; - /** - * If `true`, `object[methodName]` is treated as a setter. - * This option cannot be used with the `getter` option. - */ - setter?: boolean | undefined; - } - type Mock = F & { - mock: MockFunctionContext; - }; - type NoOpFunction = (...args: any[]) => undefined; - type FunctionPropertyNames = { - [K in keyof T]: T[K] extends Function ? K : never; - }[keyof T]; - /** - * The `MockTracker` class is used to manage mocking functionality. The test runner - * module provides a top level `mock` export which is a `MockTracker` instance. - * Each test also provides its own `MockTracker` instance via the test context's`mock` property. - * @since v19.1.0, v18.13.0 - */ - class MockTracker { - /** - * This function is used to create a mock function. - * - * The following example creates a mock function that increments a counter by one - * on each invocation. The `times` option is used to modify the mock behavior such - * that the first two invocations add two to the counter instead of one. - * - * ```js - * test('mocks a counting function', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne, addTwo, { times: 2 }); - * - * assert.strictEqual(fn(), 2); - * assert.strictEqual(fn(), 4); - * assert.strictEqual(fn(), 5); - * assert.strictEqual(fn(), 6); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param [original='A no-op function'] An optional function to create a mock on. - * @param implementation An optional function used as the mock implementation for `original`. This is useful for creating mocks that exhibit one behavior for a specified number of calls and - * then restore the behavior of `original`. - * @param options Optional configuration options for the mock function. The following properties are supported: - * @return The mocked function. The mocked function contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked function. - */ - fn(original?: F, options?: MockFunctionOptions): Mock; - fn( - original?: F, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock; - /** - * This function is used to create a mock on an existing object method. The - * following example demonstrates how a mock is created on an existing object - * method. - * - * ```js - * test('spies on an object method', (t) => { - * const number = { - * value: 5, - * subtract(a) { - * return this.value - a; - * }, - * }; - * - * t.mock.method(number, 'subtract'); - * assert.strictEqual(number.subtract.mock.calls.length, 0); - * assert.strictEqual(number.subtract(3), 2); - * assert.strictEqual(number.subtract.mock.calls.length, 1); - * - * const call = number.subtract.mock.calls[0]; - * - * assert.deepStrictEqual(call.arguments, [3]); - * assert.strictEqual(call.result, 2); - * assert.strictEqual(call.error, undefined); - * assert.strictEqual(call.target, undefined); - * assert.strictEqual(call.this, number); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param object The object whose method is being mocked. - * @param methodName The identifier of the method on `object` to mock. If `object[methodName]` is not a function, an error is thrown. - * @param implementation An optional function used as the mock implementation for `object[methodName]`. - * @param options Optional configuration options for the mock method. The following properties are supported: - * @return The mocked method. The mocked method contains a special `mock` property, which is an instance of {@link MockFunctionContext}, and can be used for inspecting and changing the - * behavior of the mocked method. - */ - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method< - MockedObject extends object, - MethodName extends FunctionPropertyNames, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation: Implementation, - options?: MockFunctionOptions, - ): MockedObject[MethodName] extends Function ? Mock - : never; - method( - object: MockedObject, - methodName: keyof MockedObject, - options: MockMethodOptions, - ): Mock; - method( - object: MockedObject, - methodName: keyof MockedObject, - implementation: Function, - options: MockMethodOptions, - ): Mock; - - /** - * This function is syntax sugar for `MockTracker.method` with `options.getter`set to `true`. - * @since v19.3.0, v18.13.0 - */ - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<() => MockedObject[MethodName]>; - getter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<(() => MockedObject[MethodName]) | Implementation>; - /** - * This function is syntax sugar for `MockTracker.method` with `options.setter`set to `true`. - * @since v19.3.0, v18.13.0 - */ - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - >( - object: MockedObject, - methodName: MethodName, - options?: MockFunctionOptions, - ): Mock<(value: MockedObject[MethodName]) => void>; - setter< - MockedObject extends object, - MethodName extends keyof MockedObject, - Implementation extends Function, - >( - object: MockedObject, - methodName: MethodName, - implementation?: Implementation, - options?: MockFunctionOptions, - ): Mock<((value: MockedObject[MethodName]) => void) | Implementation>; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker` and disassociates the mocks from the`MockTracker` instance. Once disassociated, the mocks can still be used, but the`MockTracker` instance can no longer be - * used to reset their behavior or - * otherwise interact with them. - * - * After each test completes, this function is called on the test context's`MockTracker`. If the global `MockTracker` is used extensively, calling this - * function manually is recommended. - * @since v19.1.0, v18.13.0 - */ - reset(): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTracker`. Unlike `mock.reset()`, `mock.restoreAll()` does - * not disassociate the mocks from the `MockTracker` instance. - * @since v19.1.0, v18.13.0 - */ - restoreAll(): void; - timers: MockTimers; - } - const mock: MockTracker; - interface MockFunctionCall< - F extends Function, - ReturnType = F extends (...args: any) => infer T ? T - : F extends abstract new(...args: any) => infer T ? T - : unknown, - Args = F extends (...args: infer Y) => any ? Y - : F extends abstract new(...args: infer Y) => any ? Y - : unknown[], - > { - /** - * An array of the arguments passed to the mock function. - */ - arguments: Args; - /** - * If the mocked function threw then this property contains the thrown value. - */ - error: unknown | undefined; - /** - * The value returned by the mocked function. - * - * If the mocked function threw, it will be `undefined`. - */ - result: ReturnType | undefined; - /** - * An `Error` object whose stack can be used to determine the callsite of the mocked function invocation. - */ - stack: Error; - /** - * If the mocked function is a constructor, this field contains the class being constructed. - * Otherwise this will be `undefined`. - */ - target: F extends abstract new(...args: any) => any ? F : undefined; - /** - * The mocked function's `this` value. - */ - this: unknown; - } - /** - * The `MockFunctionContext` class is used to inspect or manipulate the behavior of - * mocks created via the `MockTracker` APIs. - * @since v19.1.0, v18.13.0 - */ - class MockFunctionContext { - /** - * A getter that returns a copy of the internal array used to track calls to the - * mock. Each entry in the array is an object with the following properties. - * @since v19.1.0, v18.13.0 - */ - readonly calls: Array>; - /** - * This function returns the number of times that this mock has been invoked. This - * function is more efficient than checking `ctx.calls.length` because `ctx.calls`is a getter that creates a copy of the internal call tracking array. - * @since v19.1.0, v18.13.0 - * @return The number of times that this mock has been invoked. - */ - callCount(): number; - /** - * This function is used to change the behavior of an existing mock. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, and then changes the mock implementation to a different function. - * - * ```js - * test('changes a mock behavior', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementation(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 5); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's new implementation. - */ - mockImplementation(implementation: Function): void; - /** - * This function is used to change the behavior of an existing mock for a single - * invocation. Once invocation `onCall` has occurred, the mock will revert to - * whatever behavior it would have used had `mockImplementationOnce()` not been - * called. - * - * The following example creates a mock function using `t.mock.fn()`, calls the - * mock function, changes the mock implementation to a different function for the - * next invocation, and then resumes its previous behavior. - * - * ```js - * test('changes a mock behavior once', (t) => { - * let cnt = 0; - * - * function addOne() { - * cnt++; - * return cnt; - * } - * - * function addTwo() { - * cnt += 2; - * return cnt; - * } - * - * const fn = t.mock.fn(addOne); - * - * assert.strictEqual(fn(), 1); - * fn.mock.mockImplementationOnce(addTwo); - * assert.strictEqual(fn(), 3); - * assert.strictEqual(fn(), 4); - * }); - * ``` - * @since v19.1.0, v18.13.0 - * @param implementation The function to be used as the mock's implementation for the invocation number specified by `onCall`. - * @param onCall The invocation number that will use `implementation`. If the specified invocation has already occurred then an exception is thrown. - */ - mockImplementationOnce(implementation: Function, onCall?: number): void; - /** - * Resets the call history of the mock function. - * @since v19.3.0, v18.13.0 - */ - resetCalls(): void; - /** - * Resets the implementation of the mock function to its original behavior. The - * mock can still be used after calling this function. - * @since v19.1.0, v18.13.0 - */ - restore(): void; - } - type Timer = "setInterval" | "clearInterval" | "setTimeout" | "clearTimeout"; - /** - * Mocking timers is a technique commonly used in software testing to simulate and - * control the behavior of timers, such as `setInterval` and `setTimeout`, - * without actually waiting for the specified time intervals. - * - * The `MockTracker` provides a top-level `timers` export - * which is a `MockTimers` instance. - * @since v20.4.0 - * @experimental - */ - class MockTimers { - /** - * Enables timer mocking for the specified timers. - * - * **Note:** When you enable mocking for a specific timer, its associated - * clear function will also be implicitly mocked. - * - * Example usage: - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.enable(['setInterval']); - * ``` - * - * The above example enables mocking for the `setInterval` timer and - * implicitly mocks the `clearInterval` function. Only the `setInterval`and `clearInterval` functions from `node:timers`,`node:timers/promises`, and`globalThis` will be mocked. - * - * Alternatively, if you call `mock.timers.enable()` without any parameters: - * - * All timers (`'setInterval'`, `'clearInterval'`, `'setTimeout'`, and `'clearTimeout'`) - * will be mocked. The `setInterval`, `clearInterval`, `setTimeout`, and `clearTimeout`functions from `node:timers`, `node:timers/promises`, - * and `globalThis` will be mocked. - * @since v20.4.0 - */ - enable(timers?: Timer[]): void; - /** - * This function restores the default behavior of all mocks that were previously - * created by this `MockTimers` instance and disassociates the mocks - * from the `MockTracker` instance. - * - * **Note:** After each test completes, this function is called on - * the test context's `MockTracker`. - * - * ```js - * import { mock } from 'node:test'; - * mock.timers.reset(); - * ``` - * @since v20.4.0 - */ - reset(): void; - /** - * Advances time for all mocked timers. - * - * **Note:** This diverges from how `setTimeout` in Node.js behaves and accepts - * only positive numbers. In Node.js, `setTimeout` with negative numbers is - * only supported for web compatibility reasons. - * - * The following example mocks a `setTimeout` function and - * by using `.tick` advances in - * time triggering all pending timers. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * - * context.mock.timers.enable(['setTimeout']); - * - * setTimeout(fn, 9999); - * - * assert.strictEqual(fn.mock.callCount(), 0); - * - * // Advance in time - * context.mock.timers.tick(9999); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * - * Alternativelly, the `.tick` function can be called many times - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('mocks setTimeout to be executed synchronously without having to actually wait for it', (context) => { - * const fn = context.mock.fn(); - * context.mock.timers.enable(['setTimeout']); - * const nineSecs = 9000; - * setTimeout(fn, nineSecs); - * - * const twoSeconds = 3000; - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * context.mock.timers.tick(twoSeconds); - * - * assert.strictEqual(fn.mock.callCount(), 1); - * }); - * ``` - * @since v20.4.0 - */ - tick(milliseconds: number): void; - /** - * Triggers all pending mocked timers immediately. - * - * The example below triggers all pending timers immediately, - * causing them to execute without any delay. - * - * ```js - * import assert from 'node:assert'; - * import { test } from 'node:test'; - * - * test('runAll functions following the given order', (context) => { - * context.mock.timers.enable(['setTimeout']); - * const results = []; - * setTimeout(() => results.push(1), 9999); - * - * // Notice that if both timers have the same timeout, - * // the order of execution is guaranteed - * setTimeout(() => results.push(3), 8888); - * setTimeout(() => results.push(2), 8888); - * - * assert.deepStrictEqual(results, []); - * - * context.mock.timers.runAll(); - * - * assert.deepStrictEqual(results, [3, 2, 1]); - * }); - * ``` - * - * **Note:** The `runAll()` function is specifically designed for - * triggering timers in the context of timer mocking. - * It does not have any effect on real-time system - * clocks or actual timers outside of the mocking environment. - * @since v20.4.0 - */ - runAll(): void; - /** - * Calls {@link MockTimers.reset()}. - */ - [Symbol.dispose](): void; - } - export { - after, - afterEach, - before, - beforeEach, - describe, - it, - Mock, - mock, - only, - run, - skip, - test, - test as default, - todo, - }; -} - -interface TestLocationInfo { - /** - * The column number where the test is defined, or - * `undefined` if the test was run through the REPL. - */ - column?: number; - /** - * The path of the test file, `undefined` if test is not ran through a file. - */ - file?: string; - /** - * The line number where the test is defined, or - * `undefined` if the test was run through the REPL. - */ - line?: number; -} -interface DiagnosticData extends TestLocationInfo { - /** - * The diagnostic message. - */ - message: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestFail extends TestLocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * The error thrown by the test. - */ - error: Error; - /** - * The type of the test, used to denote whether this is a suite. - * @since 20.0.0, 19.9.0, 18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; -} -interface TestPass extends TestLocationInfo { - /** - * Additional execution metadata. - */ - details: { - /** - * The duration of the test in milliseconds. - */ - duration_ms: number; - /** - * The type of the test, used to denote whether this is a suite. - * @since 20.0.0, 19.9.0, 18.17.0 - */ - type?: "suite"; - }; - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The ordinal number of the test. - */ - testNumber: number; - /** - * Present if `context.todo` is called. - */ - todo?: string | boolean; - /** - * Present if `context.skip` is called. - */ - skip?: string | boolean; -} -interface TestPlan extends TestLocationInfo { - /** - * The nesting level of the test. - */ - nesting: number; - /** - * The number of subtests that have ran. - */ - count: number; -} -interface TestStart extends TestLocationInfo { - /** - * The test name. - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestStderr extends TestLocationInfo { - /** - * The message written to `stderr` - */ - message: string; -} -interface TestStdout extends TestLocationInfo { - /** - * The message written to `stdout` - */ - message: string; -} -interface TestEnqueue extends TestLocationInfo { - /** - * The test name - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} -interface TestDequeue extends TestLocationInfo { - /** - * The test name - */ - name: string; - /** - * The nesting level of the test. - */ - nesting: number; -} - -/** - * The `node:test/reporters` module exposes the builtin-reporters for `node:test`. - * To access it: - * - * ```js - * import test from 'node:test/reporters'; - * ``` - * - * This module is only available under the `node:` scheme. The following will not - * work: - * - * ```js - * import test from 'test/reporters'; - * ``` - * @since v19.9.0 - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/test/reporters.js) - */ -declare module "node:test/reporters" { - import { Transform } from "node:stream"; - - type TestEvent = - | { type: "test:diagnostic"; data: DiagnosticData } - | { type: "test:fail"; data: TestFail } - | { type: "test:pass"; data: TestPass } - | { type: "test:plan"; data: TestPlan } - | { type: "test:start"; data: TestStart } - | { type: "test:stderr"; data: TestStderr } - | { type: "test:stdout"; data: TestStdout } - | { type: "test:enqueue"; data: TestEnqueue } - | { type: "test:dequeue"; data: TestDequeue } - | { type: "test:watch:drained" }; - type TestEventGenerator = AsyncGenerator; - - /** - * The `dot` reporter outputs the test results in a compact format, - * where each passing test is represented by a `.`, - * and each failing test is represented by a `X`. - */ - function dot(source: TestEventGenerator): AsyncGenerator<"\n" | "." | "X", void>; - /** - * The `tap` reporter outputs the test results in the [TAP](https://testanything.org/) format. - */ - function tap(source: TestEventGenerator): AsyncGenerator; - /** - * The `spec` reporter outputs the test results in a human-readable format. - */ - class Spec extends Transform { - constructor(); - } - /** - * The `junit` reporter outputs test results in a jUnit XML format - */ - function junit(source: TestEventGenerator): AsyncGenerator; - export { dot, junit, Spec as spec, tap, TestEvent }; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/timers.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/timers.d.ts deleted file mode 100644 index 039f31f7..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/timers.d.ts +++ /dev/null @@ -1,240 +0,0 @@ -/** - * The `timer` module exposes a global API for scheduling functions to - * be called at some future period of time. Because the timer functions are - * globals, there is no need to call `require('node:timers')` to use the API. - * - * The timer functions within Node.js implement a similar API as the timers API - * provided by Web Browsers but use a different internal implementation that is - * built around the Node.js [Event Loop](https://nodejs.org/en/docs/guides/event-loop-timers-and-nexttick/#setimmediate-vs-settimeout). - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/timers.js) - */ -declare module "timers" { - import { Abortable } from "node:events"; - import { - setImmediate as setImmediatePromise, - setInterval as setIntervalPromise, - setTimeout as setTimeoutPromise, - } from "node:timers/promises"; - interface TimerOptions extends Abortable { - /** - * Set to `false` to indicate that the scheduled `Timeout` - * should not require the Node.js event loop to remain active. - * @default true - */ - ref?: boolean | undefined; - } - let setTimeout: typeof global.setTimeout; - let clearTimeout: typeof global.clearTimeout; - let setInterval: typeof global.setInterval; - let clearInterval: typeof global.clearInterval; - let setImmediate: typeof global.setImmediate; - let clearImmediate: typeof global.clearImmediate; - global { - namespace NodeJS { - // compatibility with older typings - interface Timer extends RefCounted { - hasRef(): boolean; - refresh(): this; - [Symbol.toPrimitive](): number; - } - /** - * This object is created internally and is returned from `setImmediate()`. It - * can be passed to `clearImmediate()` in order to cancel the scheduled - * actions. - * - * By default, when an immediate is scheduled, the Node.js event loop will continue - * running as long as the immediate is active. The `Immediate` object returned by `setImmediate()` exports both `immediate.ref()` and `immediate.unref()`functions that can be used to - * control this default behavior. - */ - class Immediate implements RefCounted { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the`Immediate` is active. Calling `immediate.ref()` multiple times will have no - * effect. - * - * By default, all `Immediate` objects are "ref'ed", making it normally unnecessary - * to call `immediate.ref()` unless `immediate.unref()` had been called previously. - * @since v9.7.0 - * @return a reference to `immediate` - */ - ref(): this; - /** - * When called, the active `Immediate` object will not require the Node.js event - * loop to remain active. If there is no other activity keeping the event loop - * running, the process may exit before the `Immediate` object's callback is - * invoked. Calling `immediate.unref()` multiple times will have no effect. - * @since v9.7.0 - * @return a reference to `immediate` - */ - unref(): this; - /** - * If true, the `Immediate` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - _onImmediate: Function; // to distinguish it from the Timeout class - /** - * Cancels the immediate. This is similar to calling `clearImmediate()`. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - } - /** - * This object is created internally and is returned from `setTimeout()` and `setInterval()`. It can be passed to either `clearTimeout()` or `clearInterval()` in order to cancel the - * scheduled actions. - * - * By default, when a timer is scheduled using either `setTimeout()` or `setInterval()`, the Node.js event loop will continue running as long as the - * timer is active. Each of the `Timeout` objects returned by these functions - * export both `timeout.ref()` and `timeout.unref()` functions that can be used to - * control this default behavior. - */ - class Timeout implements Timer { - /** - * When called, requests that the Node.js event loop _not_ exit so long as the`Timeout` is active. Calling `timeout.ref()` multiple times will have no effect. - * - * By default, all `Timeout` objects are "ref'ed", making it normally unnecessary - * to call `timeout.ref()` unless `timeout.unref()` had been called previously. - * @since v0.9.1 - * @return a reference to `timeout` - */ - ref(): this; - /** - * When called, the active `Timeout` object will not require the Node.js event loop - * to remain active. If there is no other activity keeping the event loop running, - * the process may exit before the `Timeout` object's callback is invoked. Calling`timeout.unref()` multiple times will have no effect. - * @since v0.9.1 - * @return a reference to `timeout` - */ - unref(): this; - /** - * If true, the `Timeout` object will keep the Node.js event loop active. - * @since v11.0.0 - */ - hasRef(): boolean; - /** - * Sets the timer's start time to the current time, and reschedules the timer to - * call its callback at the previously specified duration adjusted to the current - * time. This is useful for refreshing a timer without allocating a new - * JavaScript object. - * - * Using this on a timer that has already called its callback will reactivate the - * timer. - * @since v10.2.0 - * @return a reference to `timeout` - */ - refresh(): this; - [Symbol.toPrimitive](): number; - /** - * Cancels the timeout. - * @since v20.5.0 - */ - [Symbol.dispose](): void; - } - } - /** - * Schedules execution of a one-time `callback` after `delay` milliseconds. - * - * The `callback` will likely not be invoked in precisely `delay` milliseconds. - * Node.js makes no guarantees about the exact timing of when callbacks will fire, - * nor of their ordering. The callback will be called as close as possible to the - * time specified. - * - * When `delay` is larger than `2147483647` or less than `1`, the `delay`will be set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setTimeout()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param [delay=1] The number of milliseconds to wait before calling the `callback`. - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearTimeout} - */ - function setTimeout( - callback: (...args: TArgs) => void, - ms?: number, - ...args: TArgs - ): NodeJS.Timeout; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setTimeout(callback: (args: void) => void, ms?: number): NodeJS.Timeout; - namespace setTimeout { - const __promisify__: typeof setTimeoutPromise; - } - /** - * Cancels a `Timeout` object created by `setTimeout()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by {@link setTimeout} or the `primitive` of the `Timeout` object as a string or a number. - */ - function clearTimeout(timeoutId: NodeJS.Timeout | string | number | undefined): void; - /** - * Schedules repeated execution of `callback` every `delay` milliseconds. - * - * When `delay` is larger than `2147483647` or less than `1`, the `delay` will be - * set to `1`. Non-integer delays are truncated to an integer. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setInterval()`. - * @since v0.0.1 - * @param callback The function to call when the timer elapses. - * @param [delay=1] The number of milliseconds to wait before calling the `callback`. - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearInterval} - */ - function setInterval( - callback: (...args: TArgs) => void, - ms?: number, - ...args: TArgs - ): NodeJS.Timeout; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setInterval(callback: (args: void) => void, ms?: number): NodeJS.Timeout; - namespace setInterval { - const __promisify__: typeof setIntervalPromise; - } - /** - * Cancels a `Timeout` object created by `setInterval()`. - * @since v0.0.1 - * @param timeout A `Timeout` object as returned by {@link setInterval} or the `primitive` of the `Timeout` object as a string or a number. - */ - function clearInterval(intervalId: NodeJS.Timeout | string | number | undefined): void; - /** - * Schedules the "immediate" execution of the `callback` after I/O events' - * callbacks. - * - * When multiple calls to `setImmediate()` are made, the `callback` functions are - * queued for execution in the order in which they are created. The entire callback - * queue is processed every event loop iteration. If an immediate timer is queued - * from inside an executing callback, that timer will not be triggered until the - * next event loop iteration. - * - * If `callback` is not a function, a `TypeError` will be thrown. - * - * This method has a custom variant for promises that is available using `timersPromises.setImmediate()`. - * @since v0.9.1 - * @param callback The function to call at the end of this turn of the Node.js `Event Loop` - * @param args Optional arguments to pass when the `callback` is called. - * @return for use with {@link clearImmediate} - */ - function setImmediate( - callback: (...args: TArgs) => void, - ...args: TArgs - ): NodeJS.Immediate; - // util.promisify no rest args compability - // eslint-disable-next-line @typescript-eslint/no-invalid-void-type - function setImmediate(callback: (args: void) => void): NodeJS.Immediate; - namespace setImmediate { - const __promisify__: typeof setImmediatePromise; - } - /** - * Cancels an `Immediate` object created by `setImmediate()`. - * @since v0.9.1 - * @param immediate An `Immediate` object as returned by {@link setImmediate}. - */ - function clearImmediate(immediateId: NodeJS.Immediate | undefined): void; - function queueMicrotask(callback: () => void): void; - } -} -declare module "node:timers" { - export * from "timers"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/timers/promises.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/timers/promises.d.ts deleted file mode 100644 index 5a54dc77..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/timers/promises.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/** - * The `timers/promises` API provides an alternative set of timer functions - * that return `Promise` objects. The API is accessible via`require('node:timers/promises')`. - * - * ```js - * import { - * setTimeout, - * setImmediate, - * setInterval, - * } from 'timers/promises'; - * ``` - * @since v15.0.0 - */ -declare module "timers/promises" { - import { TimerOptions } from "node:timers"; - /** - * ```js - * import { - * setTimeout, - * } from 'timers/promises'; - * - * const res = await setTimeout(100, 'result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. - * @param value A value with which the promise is fulfilled. - */ - function setTimeout(delay?: number, value?: T, options?: TimerOptions): Promise; - /** - * ```js - * import { - * setImmediate, - * } from 'timers/promises'; - * - * const res = await setImmediate('result'); - * - * console.log(res); // Prints 'result' - * ``` - * @since v15.0.0 - * @param value A value with which the promise is fulfilled. - */ - function setImmediate(value?: T, options?: TimerOptions): Promise; - /** - * Returns an async iterator that generates values in an interval of `delay` ms. - * If `ref` is `true`, you need to call `next()` of async iterator explicitly - * or implicitly to keep the event loop alive. - * - * ```js - * import { - * setInterval, - * } from 'timers/promises'; - * - * const interval = 100; - * for await (const startTime of setInterval(interval, Date.now())) { - * const now = Date.now(); - * console.log(now); - * if ((now - startTime) > 1000) - * break; - * } - * console.log(Date.now()); - * ``` - * @since v15.9.0 - */ - function setInterval(delay?: number, value?: T, options?: TimerOptions): AsyncIterable; - interface Scheduler { - /** - * ```js - * import { scheduler } from 'node:timers/promises'; - * - * await scheduler.wait(1000); // Wait one second before continuing - * ``` - * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. - * Calling timersPromises.scheduler.wait(delay, options) is roughly equivalent to calling timersPromises.setTimeout(delay, undefined, options) except that the ref option is not supported. - * @since v16.14.0 - * @experimental - * @param [delay=1] The number of milliseconds to wait before fulfilling the promise. - */ - wait: (delay?: number, options?: TimerOptions) => Promise; - /** - * An experimental API defined by the Scheduling APIs draft specification being developed as a standard Web Platform API. - * Calling timersPromises.scheduler.yield() is equivalent to calling timersPromises.setImmediate() with no arguments. - * @since v16.14.0 - * @experimental - */ - yield: () => Promise; - } - const scheduler: Scheduler; -} -declare module "node:timers/promises" { - export * from "timers/promises"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/tls.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/tls.d.ts deleted file mode 100644 index b289e841..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/tls.d.ts +++ /dev/null @@ -1,1210 +0,0 @@ -/** - * The `node:tls` module provides an implementation of the Transport Layer Security - * (TLS) and Secure Socket Layer (SSL) protocols that is built on top of OpenSSL. - * The module can be accessed using: - * - * ```js - * const tls = require('node:tls'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tls.js) - */ -declare module "tls" { - import { X509Certificate } from "node:crypto"; - import * as net from "node:net"; - import * as stream from "stream"; - const CLIENT_RENEG_LIMIT: number; - const CLIENT_RENEG_WINDOW: number; - interface Certificate { - /** - * Country code. - */ - C: string; - /** - * Street. - */ - ST: string; - /** - * Locality. - */ - L: string; - /** - * Organization. - */ - O: string; - /** - * Organizational unit. - */ - OU: string; - /** - * Common name. - */ - CN: string; - } - interface PeerCertificate { - /** - * `true` if a Certificate Authority (CA), `false` otherwise. - * @since v18.13.0 - */ - ca: boolean; - /** - * The DER encoded X.509 certificate data. - */ - raw: Buffer; - /** - * The certificate subject. - */ - subject: Certificate; - /** - * The certificate issuer, described in the same terms as the `subject`. - */ - issuer: Certificate; - /** - * The date-time the certificate is valid from. - */ - valid_from: string; - /** - * The date-time the certificate is valid to. - */ - valid_to: string; - /** - * The certificate serial number, as a hex string. - */ - serialNumber: string; - /** - * The SHA-1 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint: string; - /** - * The SHA-256 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint256: string; - /** - * The SHA-512 digest of the DER encoded certificate. - * It is returned as a `:` separated hexadecimal string. - */ - fingerprint512: string; - /** - * The extended key usage, a set of OIDs. - */ - ext_key_usage?: string[]; - /** - * A string containing concatenated names for the subject, - * an alternative to the `subject` names. - */ - subjectaltname?: string; - /** - * An array describing the AuthorityInfoAccess, used with OCSP. - */ - infoAccess?: NodeJS.Dict; - /** - * For RSA keys: The RSA bit size. - * - * For EC keys: The key size in bits. - */ - bits?: number; - /** - * The RSA exponent, as a string in hexadecimal number notation. - */ - exponent?: string; - /** - * The RSA modulus, as a hexadecimal string. - */ - modulus?: string; - /** - * The public key. - */ - pubkey?: Buffer; - /** - * The ASN.1 name of the OID of the elliptic curve. - * Well-known curves are identified by an OID. - * While it is unusual, it is possible that the curve - * is identified by its mathematical properties, - * in which case it will not have an OID. - */ - asn1Curve?: string; - /** - * The NIST name for the elliptic curve,if it has one - * (not all well-known curves have been assigned names by NIST). - */ - nistCurve?: string; - } - interface DetailedPeerCertificate extends PeerCertificate { - /** - * The issuer certificate object. - * For self-signed certificates, this may be a circular reference. - */ - issuerCertificate: DetailedPeerCertificate; - } - interface CipherNameAndProtocol { - /** - * The cipher name. - */ - name: string; - /** - * SSL/TLS protocol version. - */ - version: string; - /** - * IETF name for the cipher suite. - */ - standardName: string; - } - interface EphemeralKeyInfo { - /** - * The supported types are 'DH' and 'ECDH'. - */ - type: string; - /** - * The name property is available only when type is 'ECDH'. - */ - name?: string | undefined; - /** - * The size of parameter of an ephemeral key exchange. - */ - size: number; - } - interface KeyObject { - /** - * Private keys in PEM format. - */ - pem: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface PxfObject { - /** - * PFX or PKCS12 encoded private key and certificate chain. - */ - buf: string | Buffer; - /** - * Optional passphrase. - */ - passphrase?: string | undefined; - } - interface TLSSocketOptions extends SecureContextOptions, CommonConnectionOptions { - /** - * If true the TLS socket will be instantiated in server-mode. - * Defaults to false. - */ - isServer?: boolean | undefined; - /** - * An optional net.Server instance. - */ - server?: net.Server | undefined; - /** - * An optional Buffer instance containing a TLS session. - */ - session?: Buffer | undefined; - /** - * If true, specifies that the OCSP status request extension will be - * added to the client hello and an 'OCSPResponse' event will be - * emitted on the socket before establishing a secure communication - */ - requestOCSP?: boolean | undefined; - } - /** - * Performs transparent encryption of written data and all required TLS - * negotiation. - * - * Instances of `tls.TLSSocket` implement the duplex `Stream` interface. - * - * Methods that return TLS connection metadata (e.g.{@link TLSSocket.getPeerCertificate}) will only return data while the - * connection is open. - * @since v0.11.4 - */ - class TLSSocket extends net.Socket { - /** - * Construct a new tls.TLSSocket object from an existing TCP socket. - */ - constructor(socket: net.Socket, options?: TLSSocketOptions); - /** - * This property is `true` if the peer certificate was signed by one of the CAs - * specified when creating the `tls.TLSSocket` instance, otherwise `false`. - * @since v0.11.4 - */ - authorized: boolean; - /** - * Returns the reason why the peer's certificate was not been verified. This - * property is set only when `tlsSocket.authorized === false`. - * @since v0.11.4 - */ - authorizationError: Error; - /** - * Always returns `true`. This may be used to distinguish TLS sockets from regular`net.Socket` instances. - * @since v0.11.4 - */ - encrypted: true; - /** - * String containing the selected ALPN protocol. - * Before a handshake has completed, this value is always null. - * When a handshake is completed but not ALPN protocol was selected, tlsSocket.alpnProtocol equals false. - */ - alpnProtocol: string | false | null; - /** - * Returns an object representing the local certificate. The returned object has - * some properties corresponding to the fields of the certificate. - * - * See {@link TLSSocket.getPeerCertificate} for an example of the certificate - * structure. - * - * If there is no local certificate, an empty object will be returned. If the - * socket has been destroyed, `null` will be returned. - * @since v11.2.0 - */ - getCertificate(): PeerCertificate | object | null; - /** - * Returns an object containing information on the negotiated cipher suite. - * - * For example, a TLSv1.2 protocol with AES256-SHA cipher: - * - * ```json - * { - * "name": "AES256-SHA", - * "standardName": "TLS_RSA_WITH_AES_256_CBC_SHA", - * "version": "SSLv3" - * } - * ``` - * - * See [SSL\_CIPHER\_get\_name](https://www.openssl.org/docs/man1.1.1/man3/SSL_CIPHER_get_name.html) for more information. - * @since v0.11.4 - */ - getCipher(): CipherNameAndProtocol; - /** - * Returns an object representing the type, name, and size of parameter of - * an ephemeral key exchange in `perfect forward secrecy` on a client - * connection. It returns an empty object when the key exchange is not - * ephemeral. As this is only supported on a client socket; `null` is returned - * if called on a server socket. The supported types are `'DH'` and `'ECDH'`. The`name` property is available only when type is `'ECDH'`. - * - * For example: `{ type: 'ECDH', name: 'prime256v1', size: 256 }`. - * @since v5.0.0 - */ - getEphemeralKeyInfo(): EphemeralKeyInfo | object | null; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that has been sent to the socket as part of a SSL/TLS handshake, or `undefined` if no `Finished` message has been sent yet. - */ - getFinished(): Buffer | undefined; - /** - * Returns an object representing the peer's certificate. If the peer does not - * provide a certificate, an empty object will be returned. If the socket has been - * destroyed, `null` will be returned. - * - * If the full certificate chain was requested, each certificate will include an`issuerCertificate` property containing an object representing its issuer's - * certificate. - * @since v0.11.4 - * @param detailed Include the full certificate chain if `true`, otherwise include just the peer's certificate. - * @return A certificate object. - */ - getPeerCertificate(detailed: true): DetailedPeerCertificate; - getPeerCertificate(detailed?: false): PeerCertificate; - getPeerCertificate(detailed?: boolean): PeerCertificate | DetailedPeerCertificate; - /** - * As the `Finished` messages are message digests of the complete handshake - * (with a total of 192 bits for TLS 1.0 and more for SSL 3.0), they can - * be used for external authentication procedures when the authentication - * provided by SSL/TLS is not desired or is not enough. - * - * Corresponds to the `SSL_get_peer_finished` routine in OpenSSL and may be used - * to implement the `tls-unique` channel binding from [RFC 5929](https://tools.ietf.org/html/rfc5929). - * @since v9.9.0 - * @return The latest `Finished` message that is expected or has actually been received from the socket as part of a SSL/TLS handshake, or `undefined` if there is no `Finished` message so - * far. - */ - getPeerFinished(): Buffer | undefined; - /** - * Returns a string containing the negotiated SSL/TLS protocol version of the - * current connection. The value `'unknown'` will be returned for connected - * sockets that have not completed the handshaking process. The value `null` will - * be returned for server sockets or disconnected client sockets. - * - * Protocol versions are: - * - * * `'SSLv3'` - * * `'TLSv1'` - * * `'TLSv1.1'` - * * `'TLSv1.2'` - * * `'TLSv1.3'` - * - * See the OpenSSL [`SSL_get_version`](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_version.html) documentation for more information. - * @since v5.7.0 - */ - getProtocol(): string | null; - /** - * Returns the TLS session data or `undefined` if no session was - * negotiated. On the client, the data can be provided to the `session` option of {@link connect} to resume the connection. On the server, it may be useful - * for debugging. - * - * See `Session Resumption` for more information. - * - * Note: `getSession()` works only for TLSv1.2 and below. For TLSv1.3, applications - * must use the `'session'` event (it also works for TLSv1.2 and below). - * @since v0.11.4 - */ - getSession(): Buffer | undefined; - /** - * See [SSL\_get\_shared\_sigalgs](https://www.openssl.org/docs/man1.1.1/man3/SSL_get_shared_sigalgs.html) for more information. - * @since v12.11.0 - * @return List of signature algorithms shared between the server and the client in the order of decreasing preference. - */ - getSharedSigalgs(): string[]; - /** - * For a client, returns the TLS session ticket if one is available, or`undefined`. For a server, always returns `undefined`. - * - * It may be useful for debugging. - * - * See `Session Resumption` for more information. - * @since v0.11.4 - */ - getTLSTicket(): Buffer | undefined; - /** - * See `Session Resumption` for more information. - * @since v0.5.6 - * @return `true` if the session was reused, `false` otherwise. - */ - isSessionReused(): boolean; - /** - * The `tlsSocket.renegotiate()` method initiates a TLS renegotiation process. - * Upon completion, the `callback` function will be passed a single argument - * that is either an `Error` (if the request failed) or `null`. - * - * This method can be used to request a peer's certificate after the secure - * connection has been established. - * - * When running as the server, the socket will be destroyed with an error after`handshakeTimeout` timeout. - * - * For TLSv1.3, renegotiation cannot be initiated, it is not supported by the - * protocol. - * @since v0.11.8 - * @param callback If `renegotiate()` returned `true`, callback is attached once to the `'secure'` event. If `renegotiate()` returned `false`, `callback` will be called in the next tick with - * an error, unless the `tlsSocket` has been destroyed, in which case `callback` will not be called at all. - * @return `true` if renegotiation was initiated, `false` otherwise. - */ - renegotiate( - options: { - rejectUnauthorized?: boolean | undefined; - requestCert?: boolean | undefined; - }, - callback: (err: Error | null) => void, - ): undefined | boolean; - /** - * The `tlsSocket.setMaxSendFragment()` method sets the maximum TLS fragment size. - * Returns `true` if setting the limit succeeded; `false` otherwise. - * - * Smaller fragment sizes decrease the buffering latency on the client: larger - * fragments are buffered by the TLS layer until the entire fragment is received - * and its integrity is verified; large fragments can span multiple roundtrips - * and their processing can be delayed due to packet loss or reordering. However, - * smaller fragments add extra TLS framing bytes and CPU overhead, which may - * decrease overall server throughput. - * @since v0.11.11 - * @param [size=16384] The maximum TLS fragment size. The maximum value is `16384`. - */ - setMaxSendFragment(size: number): boolean; - /** - * Disables TLS renegotiation for this `TLSSocket` instance. Once called, attempts - * to renegotiate will trigger an `'error'` event on the `TLSSocket`. - * @since v8.4.0 - */ - disableRenegotiation(): void; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * - * The format of the output is identical to the output of`openssl s_client -trace` or `openssl s_server -trace`. While it is produced by - * OpenSSL's `SSL_trace()` function, the format is undocumented, can change - * without notice, and should not be relied on. - * @since v12.2.0 - */ - enableTrace(): void; - /** - * Returns the peer certificate as an `X509Certificate` object. - * - * If there is no peer certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getPeerX509Certificate(): X509Certificate | undefined; - /** - * Returns the local certificate as an `X509Certificate` object. - * - * If there is no local certificate, or the socket has been destroyed,`undefined` will be returned. - * @since v15.9.0 - */ - getX509Certificate(): X509Certificate | undefined; - /** - * Keying material is used for validations to prevent different kind of attacks in - * network protocols, for example in the specifications of IEEE 802.1X. - * - * Example - * - * ```js - * const keyingMaterial = tlsSocket.exportKeyingMaterial( - * 128, - * 'client finished'); - * - * /* - * Example return value of keyingMaterial: - * - * - * ``` - * - * See the OpenSSL [`SSL_export_keying_material`](https://www.openssl.org/docs/man1.1.1/man3/SSL_export_keying_material.html) documentation for more - * information. - * @since v13.10.0, v12.17.0 - * @param length number of bytes to retrieve from keying material - * @param label an application specific label, typically this will be a value from the [IANA Exporter Label - * Registry](https://www.iana.org/assignments/tls-parameters/tls-parameters.xhtml#exporter-labels). - * @param context Optionally provide a context. - * @return requested bytes of the keying material - */ - exportKeyingMaterial(length: number, label: string, context: Buffer): Buffer; - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - addListener(event: "secureConnect", listener: () => void): this; - addListener(event: "session", listener: (session: Buffer) => void): this; - addListener(event: "keylog", listener: (line: Buffer) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "OCSPResponse", response: Buffer): boolean; - emit(event: "secureConnect"): boolean; - emit(event: "session", session: Buffer): boolean; - emit(event: "keylog", line: Buffer): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "OCSPResponse", listener: (response: Buffer) => void): this; - on(event: "secureConnect", listener: () => void): this; - on(event: "session", listener: (session: Buffer) => void): this; - on(event: "keylog", listener: (line: Buffer) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "OCSPResponse", listener: (response: Buffer) => void): this; - once(event: "secureConnect", listener: () => void): this; - once(event: "session", listener: (session: Buffer) => void): this; - once(event: "keylog", listener: (line: Buffer) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependListener(event: "secureConnect", listener: () => void): this; - prependListener(event: "session", listener: (session: Buffer) => void): this; - prependListener(event: "keylog", listener: (line: Buffer) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "OCSPResponse", listener: (response: Buffer) => void): this; - prependOnceListener(event: "secureConnect", listener: () => void): this; - prependOnceListener(event: "session", listener: (session: Buffer) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer) => void): this; - } - interface CommonConnectionOptions { - /** - * An optional TLS context object from tls.createSecureContext() - */ - secureContext?: SecureContext | undefined; - /** - * When enabled, TLS packet trace information is written to `stderr`. This can be - * used to debug TLS connection problems. - * @default false - */ - enableTrace?: boolean | undefined; - /** - * If true the server will request a certificate from clients that - * connect and attempt to verify that certificate. Defaults to - * false. - */ - requestCert?: boolean | undefined; - /** - * An array of strings or a Buffer naming possible ALPN protocols. - * (Protocols should be ordered by their priority.) - */ - ALPNProtocols?: string[] | Uint8Array[] | Uint8Array | undefined; - /** - * SNICallback(servername, cb) A function that will be - * called if the client supports SNI TLS extension. Two arguments - * will be passed when called: servername and cb. SNICallback should - * invoke cb(null, ctx), where ctx is a SecureContext instance. - * (tls.createSecureContext(...) can be used to get a proper - * SecureContext.) If SNICallback wasn't provided the default callback - * with high-level API will be used (see below). - */ - SNICallback?: ((servername: string, cb: (err: Error | null, ctx?: SecureContext) => void) => void) | undefined; - /** - * If true the server will reject any connection which is not - * authorized with the list of supplied CAs. This option only has an - * effect if requestCert is true. - * @default true - */ - rejectUnauthorized?: boolean | undefined; - } - interface TlsOptions extends SecureContextOptions, CommonConnectionOptions, net.ServerOpts { - /** - * Abort the connection if the SSL/TLS handshake does not finish in the - * specified number of milliseconds. A 'tlsClientError' is emitted on - * the tls.Server object whenever a handshake times out. Default: - * 120000 (120 seconds). - */ - handshakeTimeout?: number | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - */ - ticketKeys?: Buffer | undefined; - /** - * @param socket - * @param identity identity parameter sent from the client. - * @return pre-shared key that must either be - * a buffer or `null` to stop the negotiation process. Returned PSK must be - * compatible with the selected cipher's digest. - * - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with the identity provided by the client. - * If the return value is `null` the negotiation process will stop and an - * "unknown_psk_identity" alert message will be sent to the other party. - * If the server wishes to hide the fact that the PSK identity was not known, - * the callback must provide some random data as `psk` to make the connection - * fail with "decrypt_error" before negotiation is finished. - * PSK ciphers are disabled by default, and using TLS-PSK thus - * requires explicitly specifying a cipher suite with the `ciphers` option. - * More information can be found in the RFC 4279. - */ - pskCallback?(socket: TLSSocket, identity: string): DataView | NodeJS.TypedArray | null; - /** - * hint to send to a client to help - * with selecting the identity during TLS-PSK negotiation. Will be ignored - * in TLS 1.3. Upon failing to set pskIdentityHint `tlsClientError` will be - * emitted with `ERR_TLS_PSK_SET_IDENTIY_HINT_FAILED` code. - */ - pskIdentityHint?: string | undefined; - } - interface PSKCallbackNegotation { - psk: DataView | NodeJS.TypedArray; - identity: string; - } - interface ConnectionOptions extends SecureContextOptions, CommonConnectionOptions { - host?: string | undefined; - port?: number | undefined; - path?: string | undefined; // Creates unix socket connection to path. If this option is specified, `host` and `port` are ignored. - socket?: stream.Duplex | undefined; // Establish secure connection on a given socket rather than creating a new socket - checkServerIdentity?: typeof checkServerIdentity | undefined; - servername?: string | undefined; // SNI TLS Extension - session?: Buffer | undefined; - minDHSize?: number | undefined; - lookup?: net.LookupFunction | undefined; - timeout?: number | undefined; - /** - * When negotiating TLS-PSK (pre-shared keys), this function is called - * with optional identity `hint` provided by the server or `null` - * in case of TLS 1.3 where `hint` was removed. - * It will be necessary to provide a custom `tls.checkServerIdentity()` - * for the connection as the default one will try to check hostname/IP - * of the server against the certificate but that's not applicable for PSK - * because there won't be a certificate present. - * More information can be found in the RFC 4279. - * - * @param hint message sent from the server to help client - * decide which identity to use during negotiation. - * Always `null` if TLS 1.3 is used. - * @returns Return `null` to stop the negotiation process. `psk` must be - * compatible with the selected cipher's digest. - * `identity` must use UTF-8 encoding. - */ - pskCallback?(hint: string | null): PSKCallbackNegotation | null; - } - /** - * Accepts encrypted connections using TLS or SSL. - * @since v0.3.2 - */ - class Server extends net.Server { - constructor(secureConnectionListener?: (socket: TLSSocket) => void); - constructor(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void); - /** - * The `server.addContext()` method adds a secure context that will be used if - * the client request's SNI name matches the supplied `hostname` (or wildcard). - * - * When there are multiple matching contexts, the most recently added one is - * used. - * @since v0.5.3 - * @param hostname A SNI host name or wildcard (e.g. `'*'`) - * @param context An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc), or a TLS context object created - * with {@link createSecureContext} itself. - */ - addContext(hostname: string, context: SecureContextOptions): void; - /** - * Returns the session ticket keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @return A 48-byte buffer containing the session ticket keys. - */ - getTicketKeys(): Buffer; - /** - * The `server.setSecureContext()` method replaces the secure context of an - * existing server. Existing connections to the server are not interrupted. - * @since v11.0.0 - * @param options An object containing any of the possible properties from the {@link createSecureContext} `options` arguments (e.g. `key`, `cert`, `ca`, etc). - */ - setSecureContext(options: SecureContextOptions): void; - /** - * Sets the session ticket keys. - * - * Changes to the ticket keys are effective only for future server connections. - * Existing or currently pending server connections will use the previous keys. - * - * See `Session Resumption` for more information. - * @since v3.0.0 - * @param keys A 48-byte buffer containing the session ticket keys. - */ - setTicketKeys(keys: Buffer): void; - /** - * events.EventEmitter - * 1. tlsClientError - * 2. newSession - * 3. OCSPRequest - * 4. resumeSession - * 5. secureConnection - * 6. keylog - */ - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - addListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - addListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - addListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - addListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - addListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "tlsClientError", err: Error, tlsSocket: TLSSocket): boolean; - emit(event: "newSession", sessionId: Buffer, sessionData: Buffer, callback: () => void): boolean; - emit( - event: "OCSPRequest", - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ): boolean; - emit( - event: "resumeSession", - sessionId: Buffer, - callback: (err: Error | null, sessionData: Buffer | null) => void, - ): boolean; - emit(event: "secureConnection", tlsSocket: TLSSocket): boolean; - emit(event: "keylog", line: Buffer, tlsSocket: TLSSocket): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - on(event: "newSession", listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void): this; - on( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - on( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - on(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - on(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - once( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - once( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - once( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - once(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - once(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - prependListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - prependListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "tlsClientError", listener: (err: Error, tlsSocket: TLSSocket) => void): this; - prependOnceListener( - event: "newSession", - listener: (sessionId: Buffer, sessionData: Buffer, callback: () => void) => void, - ): this; - prependOnceListener( - event: "OCSPRequest", - listener: ( - certificate: Buffer, - issuer: Buffer, - callback: (err: Error | null, resp: Buffer) => void, - ) => void, - ): this; - prependOnceListener( - event: "resumeSession", - listener: (sessionId: Buffer, callback: (err: Error | null, sessionData: Buffer | null) => void) => void, - ): this; - prependOnceListener(event: "secureConnection", listener: (tlsSocket: TLSSocket) => void): this; - prependOnceListener(event: "keylog", listener: (line: Buffer, tlsSocket: TLSSocket) => void): this; - } - /** - * @deprecated since v0.11.3 Use `tls.TLSSocket` instead. - */ - interface SecurePair { - encrypted: TLSSocket; - cleartext: TLSSocket; - } - type SecureVersion = "TLSv1.3" | "TLSv1.2" | "TLSv1.1" | "TLSv1"; - interface SecureContextOptions { - /** - * If set, this will be called when a client opens a connection using the ALPN extension. - * One argument will be passed to the callback: an object containing `servername` and `protocols` fields, - * respectively containing the server name from the SNI extension (if any) and an array of - * ALPN protocol name strings. The callback must return either one of the strings listed in `protocols`, - * which will be returned to the client as the selected ALPN protocol, or `undefined`, - * to reject the connection with a fatal alert. If a string is returned that does not match one of - * the client's ALPN protocols, an error will be thrown. - * This option cannot be used with the `ALPNProtocols` option, and setting both options will throw an error. - */ - ALPNCallback?: ((arg: { servername: string; protocols: string[] }) => string | undefined) | undefined; - /** - * Optionally override the trusted CA certificates. Default is to trust - * the well-known CAs curated by Mozilla. Mozilla's CAs are completely - * replaced when CAs are explicitly specified using this option. - */ - ca?: string | Buffer | Array | undefined; - /** - * Cert chains in PEM format. One cert chain should be provided per - * private key. Each cert chain should consist of the PEM formatted - * certificate for a provided private key, followed by the PEM - * formatted intermediate certificates (if any), in order, and not - * including the root CA (the root CA must be pre-known to the peer, - * see ca). When providing multiple cert chains, they do not have to - * be in the same order as their private keys in key. If the - * intermediate certificates are not provided, the peer will not be - * able to validate the certificate, and the handshake will fail. - */ - cert?: string | Buffer | Array | undefined; - /** - * Colon-separated list of supported signature algorithms. The list - * can contain digest algorithms (SHA256, MD5 etc.), public key - * algorithms (RSA-PSS, ECDSA etc.), combination of both (e.g - * 'RSA+SHA384') or TLS v1.3 scheme names (e.g. rsa_pss_pss_sha512). - */ - sigalgs?: string | undefined; - /** - * Cipher suite specification, replacing the default. For more - * information, see modifying the default cipher suite. Permitted - * ciphers can be obtained via tls.getCiphers(). Cipher names must be - * uppercased in order for OpenSSL to accept them. - */ - ciphers?: string | undefined; - /** - * Name of an OpenSSL engine which can provide the client certificate. - */ - clientCertEngine?: string | undefined; - /** - * PEM formatted CRLs (Certificate Revocation Lists). - */ - crl?: string | Buffer | Array | undefined; - /** - * `'auto'` or custom Diffie-Hellman parameters, required for non-ECDHE perfect forward secrecy. - * If omitted or invalid, the parameters are silently discarded and DHE ciphers will not be available. - * ECDHE-based perfect forward secrecy will still be available. - */ - dhparam?: string | Buffer | undefined; - /** - * A string describing a named curve or a colon separated list of curve - * NIDs or names, for example P-521:P-384:P-256, to use for ECDH key - * agreement. Set to auto to select the curve automatically. Use - * crypto.getCurves() to obtain a list of available curve names. On - * recent releases, openssl ecparam -list_curves will also display the - * name and description of each available elliptic curve. Default: - * tls.DEFAULT_ECDH_CURVE. - */ - ecdhCurve?: string | undefined; - /** - * Attempt to use the server's cipher suite preferences instead of the - * client's. When true, causes SSL_OP_CIPHER_SERVER_PREFERENCE to be - * set in secureOptions - */ - honorCipherOrder?: boolean | undefined; - /** - * Private keys in PEM format. PEM allows the option of private keys - * being encrypted. Encrypted keys will be decrypted with - * options.passphrase. Multiple keys using different algorithms can be - * provided either as an array of unencrypted key strings or buffers, - * or an array of objects in the form {pem: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted keys will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - key?: string | Buffer | Array | undefined; - /** - * Name of an OpenSSL engine to get private key from. Should be used - * together with privateKeyIdentifier. - */ - privateKeyEngine?: string | undefined; - /** - * Identifier of a private key managed by an OpenSSL engine. Should be - * used together with privateKeyEngine. Should not be set together with - * key, because both options define a private key in different ways. - */ - privateKeyIdentifier?: string | undefined; - /** - * Optionally set the maximum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. - * **Default:** `'TLSv1.3'`, unless changed using CLI options. Using - * `--tls-max-v1.2` sets the default to `'TLSv1.2'`. Using `--tls-max-v1.3` sets the default to - * `'TLSv1.3'`. If multiple of the options are provided, the highest maximum is used. - */ - maxVersion?: SecureVersion | undefined; - /** - * Optionally set the minimum TLS version to allow. One - * of `'TLSv1.3'`, `'TLSv1.2'`, `'TLSv1.1'`, or `'TLSv1'`. Cannot be specified along with the - * `secureProtocol` option, use one or the other. It is not recommended to use - * less than TLSv1.2, but it may be required for interoperability. - * **Default:** `'TLSv1.2'`, unless changed using CLI options. Using - * `--tls-v1.0` sets the default to `'TLSv1'`. Using `--tls-v1.1` sets the default to - * `'TLSv1.1'`. Using `--tls-min-v1.3` sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the lowest minimum is used. - */ - minVersion?: SecureVersion | undefined; - /** - * Shared passphrase used for a single private key and/or a PFX. - */ - passphrase?: string | undefined; - /** - * PFX or PKCS12 encoded private key and certificate chain. pfx is an - * alternative to providing key and cert individually. PFX is usually - * encrypted, if it is, passphrase will be used to decrypt it. Multiple - * PFX can be provided either as an array of unencrypted PFX buffers, - * or an array of objects in the form {buf: [, - * passphrase: ]}. The object form can only occur in an array. - * object.passphrase is optional. Encrypted PFX will be decrypted with - * object.passphrase if provided, or options.passphrase if it is not. - */ - pfx?: string | Buffer | Array | undefined; - /** - * Optionally affect the OpenSSL protocol behavior, which is not - * usually necessary. This should be used carefully if at all! Value is - * a numeric bitmask of the SSL_OP_* options from OpenSSL Options - */ - secureOptions?: number | undefined; // Value is a numeric bitmask of the `SSL_OP_*` options - /** - * Legacy mechanism to select the TLS protocol version to use, it does - * not support independent control of the minimum and maximum version, - * and does not support limiting the protocol to TLSv1.3. Use - * minVersion and maxVersion instead. The possible values are listed as - * SSL_METHODS, use the function names as strings. For example, use - * 'TLSv1_1_method' to force TLS version 1.1, or 'TLS_method' to allow - * any TLS protocol version up to TLSv1.3. It is not recommended to use - * TLS versions less than 1.2, but it may be required for - * interoperability. Default: none, see minVersion. - */ - secureProtocol?: string | undefined; - /** - * Opaque identifier used by servers to ensure session state is not - * shared between applications. Unused by clients. - */ - sessionIdContext?: string | undefined; - /** - * 48-bytes of cryptographically strong pseudo-random data. - * See Session Resumption for more information. - */ - ticketKeys?: Buffer | undefined; - /** - * The number of seconds after which a TLS session created by the - * server will no longer be resumable. See Session Resumption for more - * information. Default: 300. - */ - sessionTimeout?: number | undefined; - } - interface SecureContext { - context: any; - } - /** - * Verifies the certificate `cert` is issued to `hostname`. - * - * Returns [Error](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) object, populating it with `reason`, `host`, and `cert` on - * failure. On success, returns [undefined](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#Undefined_type). - * - * This function is intended to be used in combination with the`checkServerIdentity` option that can be passed to {@link connect} and as - * such operates on a `certificate object`. For other purposes, consider using `x509.checkHost()` instead. - * - * This function can be overwritten by providing an alternative function as the`options.checkServerIdentity` option that is passed to `tls.connect()`. The - * overwriting function can call `tls.checkServerIdentity()` of course, to augment - * the checks done with additional verification. - * - * This function is only called if the certificate passed all other checks, such as - * being issued by trusted CA (`options.ca`). - * - * Earlier versions of Node.js incorrectly accepted certificates for a given`hostname` if a matching `uniformResourceIdentifier` subject alternative name - * was present (see [CVE-2021-44531](https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-44531)). Applications that wish to accept`uniformResourceIdentifier` subject alternative names can use - * a custom`options.checkServerIdentity` function that implements the desired behavior. - * @since v0.8.4 - * @param hostname The host name or IP address to verify the certificate against. - * @param cert A `certificate object` representing the peer's certificate. - */ - function checkServerIdentity(hostname: string, cert: PeerCertificate): Error | undefined; - /** - * Creates a new {@link Server}. The `secureConnectionListener`, if provided, is - * automatically set as a listener for the `'secureConnection'` event. - * - * The `ticketKeys` options is automatically shared between `node:cluster` module - * workers. - * - * The following illustrates a simple echo server: - * - * ```js - * const tls = require('node:tls'); - * const fs = require('node:fs'); - * - * const options = { - * key: fs.readFileSync('server-key.pem'), - * cert: fs.readFileSync('server-cert.pem'), - * - * // This is necessary only if using client certificate authentication. - * requestCert: true, - * - * // This is necessary only if the client uses a self-signed certificate. - * ca: [ fs.readFileSync('client-cert.pem') ], - * }; - * - * const server = tls.createServer(options, (socket) => { - * console.log('server connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * socket.write('welcome!\n'); - * socket.setEncoding('utf8'); - * socket.pipe(socket); - * }); - * server.listen(8000, () => { - * console.log('server bound'); - * }); - * ``` - * - * The server can be tested by connecting to it using the example client from {@link connect}. - * @since v0.3.2 - */ - function createServer(secureConnectionListener?: (socket: TLSSocket) => void): Server; - function createServer(options: TlsOptions, secureConnectionListener?: (socket: TLSSocket) => void): Server; - /** - * The `callback` function, if specified, will be added as a listener for the `'secureConnect'` event. - * - * `tls.connect()` returns a {@link TLSSocket} object. - * - * Unlike the `https` API, `tls.connect()` does not enable the - * SNI (Server Name Indication) extension by default, which may cause some - * servers to return an incorrect certificate or reject the connection - * altogether. To enable SNI, set the `servername` option in addition - * to `host`. - * - * The following illustrates a client for the echo server example from {@link createServer}: - * - * ```js - * // Assumes an echo server that is listening on port 8000. - * const tls = require('node:tls'); - * const fs = require('node:fs'); - * - * const options = { - * // Necessary only if the server requires client certificate authentication. - * key: fs.readFileSync('client-key.pem'), - * cert: fs.readFileSync('client-cert.pem'), - * - * // Necessary only if the server uses a self-signed certificate. - * ca: [ fs.readFileSync('server-cert.pem') ], - * - * // Necessary only if the server's cert isn't for "localhost". - * checkServerIdentity: () => { return null; }, - * }; - * - * const socket = tls.connect(8000, options, () => { - * console.log('client connected', - * socket.authorized ? 'authorized' : 'unauthorized'); - * process.stdin.pipe(socket); - * process.stdin.resume(); - * }); - * socket.setEncoding('utf8'); - * socket.on('data', (data) => { - * console.log(data); - * }); - * socket.on('end', () => { - * console.log('server ends connection'); - * }); - * ``` - * @since v0.11.3 - */ - function connect(options: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - function connect( - port: number, - host?: string, - options?: ConnectionOptions, - secureConnectListener?: () => void, - ): TLSSocket; - function connect(port: number, options?: ConnectionOptions, secureConnectListener?: () => void): TLSSocket; - /** - * Creates a new secure pair object with two streams, one of which reads and writes - * the encrypted data and the other of which reads and writes the cleartext data. - * Generally, the encrypted stream is piped to/from an incoming encrypted data - * stream and the cleartext one is used as a replacement for the initial encrypted - * stream. - * - * `tls.createSecurePair()` returns a `tls.SecurePair` object with `cleartext` and`encrypted` stream properties. - * - * Using `cleartext` has the same API as {@link TLSSocket}. - * - * The `tls.createSecurePair()` method is now deprecated in favor of`tls.TLSSocket()`. For example, the code: - * - * ```js - * pair = tls.createSecurePair(// ... ); - * pair.encrypted.pipe(socket); - * socket.pipe(pair.encrypted); - * ``` - * - * can be replaced by: - * - * ```js - * secureSocket = tls.TLSSocket(socket, options); - * ``` - * - * where `secureSocket` has the same API as `pair.cleartext`. - * @since v0.3.2 - * @deprecated Since v0.11.3 - Use {@link TLSSocket} instead. - * @param context A secure context object as returned by `tls.createSecureContext()` - * @param isServer `true` to specify that this TLS connection should be opened as a server. - * @param requestCert `true` to specify whether a server should request a certificate from a connecting client. Only applies when `isServer` is `true`. - * @param rejectUnauthorized If not `false` a server automatically reject clients with invalid certificates. Only applies when `isServer` is `true`. - */ - function createSecurePair( - context?: SecureContext, - isServer?: boolean, - requestCert?: boolean, - rejectUnauthorized?: boolean, - ): SecurePair; - /** - * {@link createServer} sets the default value of the `honorCipherOrder` option - * to `true`, other APIs that create secure contexts leave it unset. - * - * {@link createServer} uses a 128 bit truncated SHA1 hash value generated - * from `process.argv` as the default value of the `sessionIdContext` option, other - * APIs that create secure contexts have no default value. - * - * The `tls.createSecureContext()` method creates a `SecureContext` object. It is - * usable as an argument to several `tls` APIs, such as `server.addContext()`, - * but has no public methods. The {@link Server} constructor and the {@link createServer} method do not support the `secureContext` option. - * - * A key is _required_ for ciphers that use certificates. Either `key` or`pfx` can be used to provide it. - * - * If the `ca` option is not given, then Node.js will default to using [Mozilla's publicly trusted list of - * CAs](https://hg.mozilla.org/mozilla-central/raw-file/tip/security/nss/lib/ckfw/builtins/certdata.txt). - * - * Custom DHE parameters are discouraged in favor of the new `dhparam: 'auto'`option. When set to `'auto'`, well-known DHE parameters of sufficient strength - * will be selected automatically. Otherwise, if necessary, `openssl dhparam` can - * be used to create custom parameters. The key length must be greater than or - * equal to 1024 bits or else an error will be thrown. Although 1024 bits is - * permissible, use 2048 bits or larger for stronger security. - * @since v0.11.13 - */ - function createSecureContext(options?: SecureContextOptions): SecureContext; - /** - * Returns an array with the names of the supported TLS ciphers. The names are - * lower-case for historical reasons, but must be uppercased to be used in - * the `ciphers` option of {@link createSecureContext}. - * - * Not all supported ciphers are enabled by default. See `Modifying the default TLS cipher suite`. - * - * Cipher names that start with `'tls_'` are for TLSv1.3, all the others are for - * TLSv1.2 and below. - * - * ```js - * console.log(tls.getCiphers()); // ['aes128-gcm-sha256', 'aes128-sha', ...] - * ``` - * @since v0.10.2 - */ - function getCiphers(): string[]; - /** - * The default curve name to use for ECDH key agreement in a tls server. - * The default value is 'auto'. See tls.createSecureContext() for further - * information. - */ - let DEFAULT_ECDH_CURVE: string; - /** - * The default value of the maxVersion option of - * tls.createSecureContext(). It can be assigned any of the supported TLS - * protocol versions, 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: - * 'TLSv1.3', unless changed using CLI options. Using --tls-max-v1.2 sets - * the default to 'TLSv1.2'. Using --tls-max-v1.3 sets the default to - * 'TLSv1.3'. If multiple of the options are provided, the highest maximum - * is used. - */ - let DEFAULT_MAX_VERSION: SecureVersion; - /** - * The default value of the minVersion option of tls.createSecureContext(). - * It can be assigned any of the supported TLS protocol versions, - * 'TLSv1.3', 'TLSv1.2', 'TLSv1.1', or 'TLSv1'. Default: 'TLSv1.2', unless - * changed using CLI options. Using --tls-min-v1.0 sets the default to - * 'TLSv1'. Using --tls-min-v1.1 sets the default to 'TLSv1.1'. Using - * --tls-min-v1.3 sets the default to 'TLSv1.3'. If multiple of the options - * are provided, the lowest minimum is used. - */ - let DEFAULT_MIN_VERSION: SecureVersion; - /** - * The default value of the ciphers option of tls.createSecureContext(). - * It can be assigned any of the supported OpenSSL ciphers. - * Defaults to the content of crypto.constants.defaultCoreCipherList, unless - * changed using CLI options using --tls-default-ciphers. - */ - let DEFAULT_CIPHERS: string; - /** - * An immutable array of strings representing the root certificates (in PEM - * format) used for verifying peer certificates. This is the default value - * of the ca option to tls.createSecureContext(). - */ - const rootCertificates: readonly string[]; -} -declare module "node:tls" { - export * from "tls"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/trace_events.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/trace_events.d.ts deleted file mode 100644 index 33613595..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/trace_events.d.ts +++ /dev/null @@ -1,182 +0,0 @@ -/** - * The `node:trace_events` module provides a mechanism to centralize tracing - * information generated by V8, Node.js core, and userspace code. - * - * Tracing can be enabled with the `--trace-event-categories` command-line flag - * or by using the `node:trace_events` module. The `--trace-event-categories` flag - * accepts a list of comma-separated category names. - * - * The available categories are: - * - * * `node`: An empty placeholder. - * * `node.async_hooks`: Enables capture of detailed `async_hooks` trace data. - * The `async_hooks` events have a unique `asyncId` and a special `triggerId` `triggerAsyncId` property. - * * `node.bootstrap`: Enables capture of Node.js bootstrap milestones. - * * `node.console`: Enables capture of `console.time()` and `console.count()`output. - * * `node.threadpoolwork.sync`: Enables capture of trace data for threadpool - * synchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.threadpoolwork.async`: Enables capture of trace data for threadpool - * asynchronous operations, such as `blob`, `zlib`, `crypto` and `node_api`. - * * `node.dns.native`: Enables capture of trace data for DNS queries. - * * `node.net.native`: Enables capture of trace data for network. - * * `node.environment`: Enables capture of Node.js Environment milestones. - * * `node.fs.sync`: Enables capture of trace data for file system sync methods. - * * `node.fs_dir.sync`: Enables capture of trace data for file system sync - * directory methods. - * * `node.fs.async`: Enables capture of trace data for file system async methods. - * * `node.fs_dir.async`: Enables capture of trace data for file system async - * directory methods. - * * `node.perf`: Enables capture of `Performance API` measurements. - * * `node.perf.usertiming`: Enables capture of only Performance API User Timing - * measures and marks. - * * `node.perf.timerify`: Enables capture of only Performance API timerify - * measurements. - * * `node.promises.rejections`: Enables capture of trace data tracking the number - * of unhandled Promise rejections and handled-after-rejections. - * * `node.vm.script`: Enables capture of trace data for the `node:vm` module's`runInNewContext()`, `runInContext()`, and `runInThisContext()` methods. - * * `v8`: The `V8` events are GC, compiling, and execution related. - * * `node.http`: Enables capture of trace data for http request / response. - * - * By default the `node`, `node.async_hooks`, and `v8` categories are enabled. - * - * ```bash - * node --trace-event-categories v8,node,node.async_hooks server.js - * ``` - * - * Prior versions of Node.js required the use of the `--trace-events-enabled`flag to enable trace events. This requirement has been removed. However, the`--trace-events-enabled` flag _may_ still be - * used and will enable the`node`, `node.async_hooks`, and `v8` trace event categories by default. - * - * ```bash - * node --trace-events-enabled - * - * # is equivalent to - * - * node --trace-event-categories v8,node,node.async_hooks - * ``` - * - * Alternatively, trace events may be enabled using the `node:trace_events` module: - * - * ```js - * const trace_events = require('node:trace_events'); - * const tracing = trace_events.createTracing({ categories: ['node.perf'] }); - * tracing.enable(); // Enable trace event capture for the 'node.perf' category - * - * // do work - * - * tracing.disable(); // Disable trace event capture for the 'node.perf' category - * ``` - * - * Running Node.js with tracing enabled will produce log files that can be opened - * in the [`chrome://tracing`](https://www.chromium.org/developers/how-tos/trace-event-profiling-tool) tab of Chrome. - * - * The logging file is by default called `node_trace.${rotation}.log`, where`${rotation}` is an incrementing log-rotation id. The filepath pattern can - * be specified with `--trace-event-file-pattern` that accepts a template - * string that supports `${rotation}` and `${pid}`: - * - * ```bash - * node --trace-event-categories v8 --trace-event-file-pattern '${pid}-${rotation}.log' server.js - * ``` - * - * To guarantee that the log file is properly generated after signal events like`SIGINT`, `SIGTERM`, or `SIGBREAK`, make sure to have the appropriate handlers - * in your code, such as: - * - * ```js - * process.on('SIGINT', function onSigint() { - * console.info('Received SIGINT.'); - * process.exit(130); // Or applicable exit code depending on OS and signal - * }); - * ``` - * - * The tracing system uses the same time source - * as the one used by `process.hrtime()`. - * However the trace-event timestamps are expressed in microseconds, - * unlike `process.hrtime()` which returns nanoseconds. - * - * The features from this module are not available in `Worker` threads. - * @experimental - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/trace_events.js) - */ -declare module "trace_events" { - /** - * The `Tracing` object is used to enable or disable tracing for sets of - * categories. Instances are created using the - * `trace_events.createTracing()` method. - * - * When created, the `Tracing` object is disabled. Calling the - * `tracing.enable()` method adds the categories to the set of enabled trace - * event categories. Calling `tracing.disable()` will remove the categories - * from the set of enabled trace event categories. - */ - interface Tracing { - /** - * A comma-separated list of the trace event categories covered by this - * `Tracing` object. - */ - readonly categories: string; - /** - * Disables this `Tracing` object. - * - * Only trace event categories _not_ covered by other enabled `Tracing` - * objects and _not_ specified by the `--trace-event-categories` flag - * will be disabled. - */ - disable(): void; - /** - * Enables this `Tracing` object for the set of categories covered by - * the `Tracing` object. - */ - enable(): void; - /** - * `true` only if the `Tracing` object has been enabled. - */ - readonly enabled: boolean; - } - interface CreateTracingOptions { - /** - * An array of trace category names. Values included in the array are - * coerced to a string when possible. An error will be thrown if the - * value cannot be coerced. - */ - categories: string[]; - } - /** - * Creates and returns a `Tracing` object for the given set of `categories`. - * - * ```js - * const trace_events = require('node:trace_events'); - * const categories = ['node.perf', 'node.async_hooks']; - * const tracing = trace_events.createTracing({ categories }); - * tracing.enable(); - * // do stuff - * tracing.disable(); - * ``` - * @since v10.0.0 - * @return . - */ - function createTracing(options: CreateTracingOptions): Tracing; - /** - * Returns a comma-separated list of all currently-enabled trace event - * categories. The current set of enabled trace event categories is determined - * by the _union_ of all currently-enabled `Tracing` objects and any categories - * enabled using the `--trace-event-categories` flag. - * - * Given the file `test.js` below, the command`node --trace-event-categories node.perf test.js` will print`'node.async_hooks,node.perf'` to the console. - * - * ```js - * const trace_events = require('node:trace_events'); - * const t1 = trace_events.createTracing({ categories: ['node.async_hooks'] }); - * const t2 = trace_events.createTracing({ categories: ['node.perf'] }); - * const t3 = trace_events.createTracing({ categories: ['v8'] }); - * - * t1.enable(); - * t2.enable(); - * - * console.log(trace_events.getEnabledCategories()); - * ``` - * @since v10.0.0 - */ - function getEnabledCategories(): string | undefined; -} -declare module "node:trace_events" { - export * from "trace_events"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/tty.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/tty.d.ts deleted file mode 100644 index 1c0dafd3..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/tty.d.ts +++ /dev/null @@ -1,208 +0,0 @@ -/** - * The `node:tty` module provides the `tty.ReadStream` and `tty.WriteStream`classes. In most cases, it will not be necessary or possible to use this module - * directly. However, it can be accessed using: - * - * ```js - * const tty = require('node:tty'); - * ``` - * - * When Node.js detects that it is being run with a text terminal ("TTY") - * attached, `process.stdin` will, by default, be initialized as an instance of`tty.ReadStream` and both `process.stdout` and `process.stderr` will, by - * default, be instances of `tty.WriteStream`. The preferred method of determining - * whether Node.js is being run within a TTY context is to check that the value of - * the `process.stdout.isTTY` property is `true`: - * - * ```console - * $ node -p -e "Boolean(process.stdout.isTTY)" - * true - * $ node -p -e "Boolean(process.stdout.isTTY)" | cat - * false - * ``` - * - * In most cases, there should be little to no reason for an application to - * manually create instances of the `tty.ReadStream` and `tty.WriteStream`classes. - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/tty.js) - */ -declare module "tty" { - import * as net from "node:net"; - /** - * The `tty.isatty()` method returns `true` if the given `fd` is associated with - * a TTY and `false` if it is not, including whenever `fd` is not a non-negative - * integer. - * @since v0.5.8 - * @param fd A numeric file descriptor - */ - function isatty(fd: number): boolean; - /** - * Represents the readable side of a TTY. In normal circumstances `process.stdin` will be the only `tty.ReadStream` instance in a Node.js - * process and there should be no reason to create additional instances. - * @since v0.5.8 - */ - class ReadStream extends net.Socket { - constructor(fd: number, options?: net.SocketConstructorOpts); - /** - * A `boolean` that is `true` if the TTY is currently configured to operate as a - * raw device. - * - * This flag is always `false` when a process starts, even if the terminal is - * operating in raw mode. Its value will change with subsequent calls to`setRawMode`. - * @since v0.7.7 - */ - isRaw: boolean; - /** - * Allows configuration of `tty.ReadStream` so that it operates as a raw device. - * - * When in raw mode, input is always available character-by-character, not - * including modifiers. Additionally, all special processing of characters by the - * terminal is disabled, including echoing input - * characters. Ctrl+C will no longer cause a `SIGINT` when - * in this mode. - * @since v0.7.7 - * @param mode If `true`, configures the `tty.ReadStream` to operate as a raw device. If `false`, configures the `tty.ReadStream` to operate in its default mode. The `readStream.isRaw` - * property will be set to the resulting mode. - * @return The read stream instance. - */ - setRawMode(mode: boolean): this; - /** - * A `boolean` that is always `true` for `tty.ReadStream` instances. - * @since v0.5.8 - */ - isTTY: boolean; - } - /** - * -1 - to the left from cursor - * 0 - the entire line - * 1 - to the right from cursor - */ - type Direction = -1 | 0 | 1; - /** - * Represents the writable side of a TTY. In normal circumstances,`process.stdout` and `process.stderr` will be the only`tty.WriteStream` instances created for a Node.js process and there - * should be no reason to create additional instances. - * @since v0.5.8 - */ - class WriteStream extends net.Socket { - constructor(fd: number); - addListener(event: string, listener: (...args: any[]) => void): this; - addListener(event: "resize", listener: () => void): this; - emit(event: string | symbol, ...args: any[]): boolean; - emit(event: "resize"): boolean; - on(event: string, listener: (...args: any[]) => void): this; - on(event: "resize", listener: () => void): this; - once(event: string, listener: (...args: any[]) => void): this; - once(event: "resize", listener: () => void): this; - prependListener(event: string, listener: (...args: any[]) => void): this; - prependListener(event: "resize", listener: () => void): this; - prependOnceListener(event: string, listener: (...args: any[]) => void): this; - prependOnceListener(event: "resize", listener: () => void): this; - /** - * `writeStream.clearLine()` clears the current line of this `WriteStream` in a - * direction identified by `dir`. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - clearLine(dir: Direction, callback?: () => void): boolean; - /** - * `writeStream.clearScreenDown()` clears this `WriteStream` from the current - * cursor down. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - clearScreenDown(callback?: () => void): boolean; - /** - * `writeStream.cursorTo()` moves this `WriteStream`'s cursor to the specified - * position. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - cursorTo(x: number, y?: number, callback?: () => void): boolean; - cursorTo(x: number, callback: () => void): boolean; - /** - * `writeStream.moveCursor()` moves this `WriteStream`'s cursor _relative_ to its - * current position. - * @since v0.7.7 - * @param callback Invoked once the operation completes. - * @return `false` if the stream wishes for the calling code to wait for the `'drain'` event to be emitted before continuing to write additional data; otherwise `true`. - */ - moveCursor(dx: number, dy: number, callback?: () => void): boolean; - /** - * Returns: - * - * * `1` for 2, - * * `4` for 16, - * * `8` for 256, - * * `24` for 16,777,216 colors supported. - * - * Use this to determine what colors the terminal supports. Due to the nature of - * colors in terminals it is possible to either have false positives or false - * negatives. It depends on process information and the environment variables that - * may lie about what terminal is used. - * It is possible to pass in an `env` object to simulate the usage of a specific - * terminal. This can be useful to check how specific environment settings behave. - * - * To enforce a specific color support, use one of the below environment settings. - * - * * 2 colors: `FORCE_COLOR = 0` (Disables colors) - * * 16 colors: `FORCE_COLOR = 1` - * * 256 colors: `FORCE_COLOR = 2` - * * 16,777,216 colors: `FORCE_COLOR = 3` - * - * Disabling color support is also possible by using the `NO_COLOR` and`NODE_DISABLE_COLORS` environment variables. - * @since v9.9.0 - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. - */ - getColorDepth(env?: object): number; - /** - * Returns `true` if the `writeStream` supports at least as many colors as provided - * in `count`. Minimum support is 2 (black and white). - * - * This has the same false positives and negatives as described in `writeStream.getColorDepth()`. - * - * ```js - * process.stdout.hasColors(); - * // Returns true or false depending on if `stdout` supports at least 16 colors. - * process.stdout.hasColors(256); - * // Returns true or false depending on if `stdout` supports at least 256 colors. - * process.stdout.hasColors({ TMUX: '1' }); - * // Returns true. - * process.stdout.hasColors(2 ** 24, { TMUX: '1' }); - * // Returns false (the environment setting pretends to support 2 ** 8 colors). - * ``` - * @since v11.13.0, v10.16.0 - * @param [count=16] The number of colors that are requested (minimum 2). - * @param [env=process.env] An object containing the environment variables to check. This enables simulating the usage of a specific terminal. - */ - hasColors(count?: number): boolean; - hasColors(env?: object): boolean; - hasColors(count: number, env?: object): boolean; - /** - * `writeStream.getWindowSize()` returns the size of the TTY - * corresponding to this `WriteStream`. The array is of the type`[numColumns, numRows]` where `numColumns` and `numRows` represent the number - * of columns and rows in the corresponding TTY. - * @since v0.7.7 - */ - getWindowSize(): [number, number]; - /** - * A `number` specifying the number of columns the TTY currently has. This property - * is updated whenever the `'resize'` event is emitted. - * @since v0.7.7 - */ - columns: number; - /** - * A `number` specifying the number of rows the TTY currently has. This property - * is updated whenever the `'resize'` event is emitted. - * @since v0.7.7 - */ - rows: number; - /** - * A `boolean` that is always `true`. - * @since v0.5.8 - */ - isTTY: boolean; - } -} -declare module "node:tty" { - export * from "tty"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/url.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/url.d.ts deleted file mode 100644 index 20a5d851..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/url.d.ts +++ /dev/null @@ -1,927 +0,0 @@ -/** - * The `node:url` module provides utilities for URL resolution and parsing. It can - * be accessed using: - * - * ```js - * import url from 'node:url'; - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/url.js) - */ -declare module "url" { - import { Blob as NodeBlob } from "node:buffer"; - import { ClientRequestArgs } from "node:http"; - import { ParsedUrlQuery, ParsedUrlQueryInput } from "node:querystring"; - // Input to `url.format` - interface UrlObject { - auth?: string | null | undefined; - hash?: string | null | undefined; - host?: string | null | undefined; - hostname?: string | null | undefined; - href?: string | null | undefined; - pathname?: string | null | undefined; - protocol?: string | null | undefined; - search?: string | null | undefined; - slashes?: boolean | null | undefined; - port?: string | number | null | undefined; - query?: string | null | ParsedUrlQueryInput | undefined; - } - // Output of `url.parse` - interface Url { - auth: string | null; - hash: string | null; - host: string | null; - hostname: string | null; - href: string; - path: string | null; - pathname: string | null; - protocol: string | null; - search: string | null; - slashes: boolean | null; - port: string | null; - query: string | null | ParsedUrlQuery; - } - interface UrlWithParsedQuery extends Url { - query: ParsedUrlQuery; - } - interface UrlWithStringQuery extends Url { - query: string | null; - } - /** - * The `url.parse()` method takes a URL string, parses it, and returns a URL - * object. - * - * A `TypeError` is thrown if `urlString` is not a string. - * - * A `URIError` is thrown if the `auth` property is present but cannot be decoded. - * - * `url.parse()` uses a lenient, non-standard algorithm for parsing URL - * strings. It is prone to security issues such as [host name spoofing](https://hackerone.com/reports/678487) and incorrect handling of usernames and passwords. Do not use with untrusted - * input. CVEs are not issued for `url.parse()` vulnerabilities. Use the `WHATWG URL` API instead. - * @since v0.1.25 - * @deprecated Use the WHATWG URL API instead. - * @param urlString The URL string to parse. - * @param [parseQueryString=false] If `true`, the `query` property will always be set to an object returned by the {@link querystring} module's `parse()` method. If `false`, the `query` property - * on the returned URL object will be an unparsed, undecoded string. - * @param [slashesDenoteHost=false] If `true`, the first token after the literal string `//` and preceding the next `/` will be interpreted as the `host`. For instance, given `//foo/bar`, the - * result would be `{host: 'foo', pathname: '/bar'}` rather than `{pathname: '//foo/bar'}`. - */ - function parse(urlString: string): UrlWithStringQuery; - function parse( - urlString: string, - parseQueryString: false | undefined, - slashesDenoteHost?: boolean, - ): UrlWithStringQuery; - function parse(urlString: string, parseQueryString: true, slashesDenoteHost?: boolean): UrlWithParsedQuery; - function parse(urlString: string, parseQueryString: boolean, slashesDenoteHost?: boolean): Url; - /** - * The `url.format()` method returns a formatted URL string derived from`urlObject`. - * - * ```js - * const url = require('node:url'); - * url.format({ - * protocol: 'https', - * hostname: 'example.com', - * pathname: '/some/path', - * query: { - * page: 1, - * format: 'json', - * }, - * }); - * - * // => 'https://example.com/some/path?page=1&format=json' - * ``` - * - * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. - * - * The formatting process operates as follows: - * - * * A new empty string `result` is created. - * * If `urlObject.protocol` is a string, it is appended as-is to `result`. - * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. - * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII - * colon (`:`) character, the literal string `:` will be appended to `result`. - * * If either of the following conditions is true, then the literal string `//`will be appended to `result`: - * * `urlObject.slashes` property is true; - * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`; - * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string - * and appended to `result`followed by the literal string `@`. - * * If the `urlObject.host` property is `undefined` then: - * * If the `urlObject.hostname` is a string, it is appended to `result`. - * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, - * an `Error` is thrown. - * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`: - * * The literal string `:` is appended to `result`, and - * * The value of `urlObject.port` is coerced to a string and appended to`result`. - * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`. - * * If the `urlObject.pathname` property is a string that is not an empty string: - * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash - * (`/`), then the literal string `'/'` is appended to `result`. - * * The value of `urlObject.pathname` is appended to `result`. - * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the - * `querystring` module's `stringify()`method passing the value of `urlObject.query`. - * * Otherwise, if `urlObject.search` is a string: - * * If the value of `urlObject.search`_does not start_ with the ASCII question - * mark (`?`) character, the literal string `?` is appended to `result`. - * * The value of `urlObject.search` is appended to `result`. - * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.hash` property is a string: - * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`) - * character, the literal string `#` is appended to `result`. - * * The value of `urlObject.hash` is appended to `result`. - * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a - * string, an `Error` is thrown. - * * `result` is returned. - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. - */ - function format(urlObject: URL, options?: URLFormatOptions): string; - /** - * The `url.format()` method returns a formatted URL string derived from`urlObject`. - * - * ```js - * const url = require('url'); - * url.format({ - * protocol: 'https', - * hostname: 'example.com', - * pathname: '/some/path', - * query: { - * page: 1, - * format: 'json' - * } - * }); - * - * // => 'https://example.com/some/path?page=1&format=json' - * ``` - * - * If `urlObject` is not an object or a string, `url.format()` will throw a `TypeError`. - * - * The formatting process operates as follows: - * - * * A new empty string `result` is created. - * * If `urlObject.protocol` is a string, it is appended as-is to `result`. - * * Otherwise, if `urlObject.protocol` is not `undefined` and is not a string, an `Error` is thrown. - * * For all string values of `urlObject.protocol` that _do not end_ with an ASCII - * colon (`:`) character, the literal string `:` will be appended to `result`. - * * If either of the following conditions is true, then the literal string `//`will be appended to `result`: - * * `urlObject.slashes` property is true; - * * `urlObject.protocol` begins with `http`, `https`, `ftp`, `gopher`, or`file`; - * * If the value of the `urlObject.auth` property is truthy, and either`urlObject.host` or `urlObject.hostname` are not `undefined`, the value of`urlObject.auth` will be coerced into a string - * and appended to `result`followed by the literal string `@`. - * * If the `urlObject.host` property is `undefined` then: - * * If the `urlObject.hostname` is a string, it is appended to `result`. - * * Otherwise, if `urlObject.hostname` is not `undefined` and is not a string, - * an `Error` is thrown. - * * If the `urlObject.port` property value is truthy, and `urlObject.hostname`is not `undefined`: - * * The literal string `:` is appended to `result`, and - * * The value of `urlObject.port` is coerced to a string and appended to`result`. - * * Otherwise, if the `urlObject.host` property value is truthy, the value of`urlObject.host` is coerced to a string and appended to `result`. - * * If the `urlObject.pathname` property is a string that is not an empty string: - * * If the `urlObject.pathname`_does not start_ with an ASCII forward slash - * (`/`), then the literal string `'/'` is appended to `result`. - * * The value of `urlObject.pathname` is appended to `result`. - * * Otherwise, if `urlObject.pathname` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.search` property is `undefined` and if the `urlObject.query`property is an `Object`, the literal string `?` is appended to `result`followed by the output of calling the - * `querystring` module's `stringify()`method passing the value of `urlObject.query`. - * * Otherwise, if `urlObject.search` is a string: - * * If the value of `urlObject.search`_does not start_ with the ASCII question - * mark (`?`) character, the literal string `?` is appended to `result`. - * * The value of `urlObject.search` is appended to `result`. - * * Otherwise, if `urlObject.search` is not `undefined` and is not a string, an `Error` is thrown. - * * If the `urlObject.hash` property is a string: - * * If the value of `urlObject.hash`_does not start_ with the ASCII hash (`#`) - * character, the literal string `#` is appended to `result`. - * * The value of `urlObject.hash` is appended to `result`. - * * Otherwise, if the `urlObject.hash` property is not `undefined` and is not a - * string, an `Error` is thrown. - * * `result` is returned. - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param urlObject A URL object (as returned by `url.parse()` or constructed otherwise). If a string, it is converted to an object by passing it to `url.parse()`. - */ - function format(urlObject: UrlObject | string): string; - /** - * The `url.resolve()` method resolves a target URL relative to a base URL in a - * manner similar to that of a web browser resolving an anchor tag. - * - * ```js - * const url = require('node:url'); - * url.resolve('/one/two/three', 'four'); // '/one/two/four' - * url.resolve('http://example.com/', '/one'); // 'http://example.com/one' - * url.resolve('http://example.com/one', '/two'); // 'http://example.com/two' - * ``` - * - * To achieve the same result using the WHATWG URL API: - * - * ```js - * function resolve(from, to) { - * const resolvedUrl = new URL(to, new URL(from, 'resolve://')); - * if (resolvedUrl.protocol === 'resolve:') { - * // `from` is a relative URL. - * const { pathname, search, hash } = resolvedUrl; - * return pathname + search + hash; - * } - * return resolvedUrl.toString(); - * } - * - * resolve('/one/two/three', 'four'); // '/one/two/four' - * resolve('http://example.com/', '/one'); // 'http://example.com/one' - * resolve('http://example.com/one', '/two'); // 'http://example.com/two' - * ``` - * @since v0.1.25 - * @legacy Use the WHATWG URL API instead. - * @param from The base URL to use if `to` is a relative URL. - * @param to The target URL to resolve. - */ - function resolve(from: string, to: string): string; - /** - * Returns the [Punycode](https://tools.ietf.org/html/rfc5891#section-4.4) ASCII serialization of the `domain`. If `domain` is an - * invalid domain, the empty string is returned. - * - * It performs the inverse operation to {@link domainToUnicode}. - * - * ```js - * import url from 'node:url'; - * - * console.log(url.domainToASCII('español.com')); - * // Prints xn--espaol-zwa.com - * console.log(url.domainToASCII('中文.com')); - * // Prints xn--fiq228c.com - * console.log(url.domainToASCII('xn--iñvalid.com')); - * // Prints an empty string - * ``` - * @since v7.4.0, v6.13.0 - */ - function domainToASCII(domain: string): string; - /** - * Returns the Unicode serialization of the `domain`. If `domain` is an invalid - * domain, the empty string is returned. - * - * It performs the inverse operation to {@link domainToASCII}. - * - * ```js - * import url from 'node:url'; - * - * console.log(url.domainToUnicode('xn--espaol-zwa.com')); - * // Prints español.com - * console.log(url.domainToUnicode('xn--fiq228c.com')); - * // Prints 中文.com - * console.log(url.domainToUnicode('xn--iñvalid.com')); - * // Prints an empty string - * ``` - * @since v7.4.0, v6.13.0 - */ - function domainToUnicode(domain: string): string; - /** - * This function ensures the correct decodings of percent-encoded characters as - * well as ensuring a cross-platform valid absolute path string. - * - * ```js - * import { fileURLToPath } from 'node:url'; - * - * const __filename = fileURLToPath(import.meta.url); - * - * new URL('file:///C:/path/').pathname; // Incorrect: /C:/path/ - * fileURLToPath('file:///C:/path/'); // Correct: C:\path\ (Windows) - * - * new URL('file://nas/foo.txt').pathname; // Incorrect: /foo.txt - * fileURLToPath('file://nas/foo.txt'); // Correct: \\nas\foo.txt (Windows) - * - * new URL('file:///你好.txt').pathname; // Incorrect: /%E4%BD%A0%E5%A5%BD.txt - * fileURLToPath('file:///你好.txt'); // Correct: /你好.txt (POSIX) - * - * new URL('file:///hello world').pathname; // Incorrect: /hello%20world - * fileURLToPath('file:///hello world'); // Correct: /hello world (POSIX) - * ``` - * @since v10.12.0 - * @param url The file URL string or URL object to convert to a path. - * @return The fully-resolved platform-specific Node.js file path. - */ - function fileURLToPath(url: string | URL): string; - /** - * This function ensures that `path` is resolved absolutely, and that the URL - * control characters are correctly encoded when converting into a File URL. - * - * ```js - * import { pathToFileURL } from 'node:url'; - * - * new URL('/foo#1', 'file:'); // Incorrect: file:///foo#1 - * pathToFileURL('/foo#1'); // Correct: file:///foo%231 (POSIX) - * - * new URL('/some/path%.c', 'file:'); // Incorrect: file:///some/path%.c - * pathToFileURL('/some/path%.c'); // Correct: file:///some/path%25.c (POSIX) - * ``` - * @since v10.12.0 - * @param path The path to convert to a File URL. - * @return The file URL object. - */ - function pathToFileURL(path: string): URL; - /** - * This utility function converts a URL object into an ordinary options object as - * expected by the `http.request()` and `https.request()` APIs. - * - * ```js - * import { urlToHttpOptions } from 'node:url'; - * const myURL = new URL('https://a:b@測試?abc#foo'); - * - * console.log(urlToHttpOptions(myURL)); - * /* - * { - * protocol: 'https:', - * hostname: 'xn--g6w251d', - * hash: '#foo', - * search: '?abc', - * pathname: '/', - * path: '/?abc', - * href: 'https://a:b@xn--g6w251d/?abc#foo', - * auth: 'a:b' - * } - * - * ``` - * @since v15.7.0, v14.18.0 - * @param url The `WHATWG URL` object to convert to an options object. - * @return Options object - */ - function urlToHttpOptions(url: URL): ClientRequestArgs; - interface URLFormatOptions { - auth?: boolean | undefined; - fragment?: boolean | undefined; - search?: boolean | undefined; - unicode?: boolean | undefined; - } - /** - * Browser-compatible `URL` class, implemented by following the WHATWG URL - * Standard. [Examples of parsed URLs](https://url.spec.whatwg.org/#example-url-parsing) may be found in the Standard itself. - * The `URL` class is also available on the global object. - * - * In accordance with browser conventions, all properties of `URL` objects - * are implemented as getters and setters on the class prototype, rather than as - * data properties on the object itself. Thus, unlike `legacy urlObject` s, - * using the `delete` keyword on any properties of `URL` objects (e.g. `delete myURL.protocol`, `delete myURL.pathname`, etc) has no effect but will still - * return `true`. - * @since v7.0.0, v6.13.0 - */ - class URL { - /** - * Creates a `'blob:nodedata:...'` URL string that represents the given `Blob` object and can be used to retrieve the `Blob` later. - * - * ```js - * const { - * Blob, - * resolveObjectURL, - * } = require('node:buffer'); - * - * const blob = new Blob(['hello']); - * const id = URL.createObjectURL(blob); - * - * // later... - * - * const otherBlob = resolveObjectURL(id); - * console.log(otherBlob.size); - * ``` - * - * The data stored by the registered `Blob` will be retained in memory until`URL.revokeObjectURL()` is called to remove it. - * - * `Blob` objects are registered within the current thread. If using Worker - * Threads, `Blob` objects registered within one Worker will not be available - * to other workers or the main thread. - * @since v16.7.0 - * @experimental - */ - static createObjectURL(blob: NodeBlob): string; - /** - * Removes the stored `Blob` identified by the given ID. Attempting to revoke a - * ID that isn't registered will silently fail. - * @since v16.7.0 - * @experimental - * @param id A `'blob:nodedata:...` URL string returned by a prior call to `URL.createObjectURL()`. - */ - static revokeObjectURL(objectUrl: string): void; - /** - * Checks if an `input` relative to the `base` can be parsed to a `URL`. - * - * ```js - * const isValid = URL.canParse('/foo', 'https://example.org/'); // true - * - * const isNotValid = URL.canParse('/foo'); // false - * ``` - * @since v19.9.0 - * @param input The absolute or relative input URL to parse. If `input` is relative, then `base` is required. If `input` is absolute, the `base` is ignored. If `input` is not a string, it is - * `converted to a string` first. - * @param base The base URL to resolve against if the `input` is not absolute. If `base` is not a string, it is `converted to a string` first. - */ - static canParse(input: string, base?: string): boolean; - constructor(input: string, base?: string | URL); - /** - * Gets and sets the fragment portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/foo#bar'); - * console.log(myURL.hash); - * // Prints #bar - * - * myURL.hash = 'baz'; - * console.log(myURL.href); - * // Prints https://example.org/foo#baz - * ``` - * - * Invalid URL characters included in the value assigned to the `hash` property - * are `percent-encoded`. The selection of which characters to - * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - hash: string; - /** - * Gets and sets the host portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org:81/foo'); - * console.log(myURL.host); - * // Prints example.org:81 - * - * myURL.host = 'example.com:82'; - * console.log(myURL.href); - * // Prints https://example.com:82/foo - * ``` - * - * Invalid host values assigned to the `host` property are ignored. - */ - host: string; - /** - * Gets and sets the host name portion of the URL. The key difference between`url.host` and `url.hostname` is that `url.hostname` does _not_ include the - * port. - * - * ```js - * const myURL = new URL('https://example.org:81/foo'); - * console.log(myURL.hostname); - * // Prints example.org - * - * // Setting the hostname does not change the port - * myURL.hostname = 'example.com'; - * console.log(myURL.href); - * // Prints https://example.com:81/foo - * - * // Use myURL.host to change the hostname and port - * myURL.host = 'example.org:82'; - * console.log(myURL.href); - * // Prints https://example.org:82/foo - * ``` - * - * Invalid host name values assigned to the `hostname` property are ignored. - */ - hostname: string; - /** - * Gets and sets the serialized URL. - * - * ```js - * const myURL = new URL('https://example.org/foo'); - * console.log(myURL.href); - * // Prints https://example.org/foo - * - * myURL.href = 'https://example.com/bar'; - * console.log(myURL.href); - * // Prints https://example.com/bar - * ``` - * - * Getting the value of the `href` property is equivalent to calling {@link toString}. - * - * Setting the value of this property to a new value is equivalent to creating a - * new `URL` object using `new URL(value)`. Each of the `URL`object's properties will be modified. - * - * If the value assigned to the `href` property is not a valid URL, a `TypeError`will be thrown. - */ - href: string; - /** - * Gets the read-only serialization of the URL's origin. - * - * ```js - * const myURL = new URL('https://example.org/foo/bar?baz'); - * console.log(myURL.origin); - * // Prints https://example.org - * ``` - * - * ```js - * const idnURL = new URL('https://測試'); - * console.log(idnURL.origin); - * // Prints https://xn--g6w251d - * - * console.log(idnURL.hostname); - * // Prints xn--g6w251d - * ``` - */ - readonly origin: string; - /** - * Gets and sets the password portion of the URL. - * - * ```js - * const myURL = new URL('https://abc:xyz@example.com'); - * console.log(myURL.password); - * // Prints xyz - * - * myURL.password = '123'; - * console.log(myURL.href); - * // Prints https://abc:123@example.com/ - * ``` - * - * Invalid URL characters included in the value assigned to the `password` property - * are `percent-encoded`. The selection of which characters to - * percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - password: string; - /** - * Gets and sets the path portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/abc/xyz?123'); - * console.log(myURL.pathname); - * // Prints /abc/xyz - * - * myURL.pathname = '/abcdef'; - * console.log(myURL.href); - * // Prints https://example.org/abcdef?123 - * ``` - * - * Invalid URL characters included in the value assigned to the `pathname`property are `percent-encoded`. The selection of which characters - * to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - pathname: string; - /** - * Gets and sets the port portion of the URL. - * - * The port value may be a number or a string containing a number in the range`0` to `65535` (inclusive). Setting the value to the default port of the`URL` objects given `protocol` will - * result in the `port` value becoming - * the empty string (`''`). - * - * The port value can be an empty string in which case the port depends on - * the protocol/scheme: - * - * - * - * Upon assigning a value to the port, the value will first be converted to a - * string using `.toString()`. - * - * If that string is invalid but it begins with a number, the leading number is - * assigned to `port`. - * If the number lies outside the range denoted above, it is ignored. - * - * ```js - * const myURL = new URL('https://example.org:8888'); - * console.log(myURL.port); - * // Prints 8888 - * - * // Default ports are automatically transformed to the empty string - * // (HTTPS protocol's default port is 443) - * myURL.port = '443'; - * console.log(myURL.port); - * // Prints the empty string - * console.log(myURL.href); - * // Prints https://example.org/ - * - * myURL.port = 1234; - * console.log(myURL.port); - * // Prints 1234 - * console.log(myURL.href); - * // Prints https://example.org:1234/ - * - * // Completely invalid port strings are ignored - * myURL.port = 'abcd'; - * console.log(myURL.port); - * // Prints 1234 - * - * // Leading numbers are treated as a port number - * myURL.port = '5678abcd'; - * console.log(myURL.port); - * // Prints 5678 - * - * // Non-integers are truncated - * myURL.port = 1234.5678; - * console.log(myURL.port); - * // Prints 1234 - * - * // Out-of-range numbers which are not represented in scientific notation - * // will be ignored. - * myURL.port = 1e10; // 10000000000, will be range-checked as described below - * console.log(myURL.port); - * // Prints 1234 - * ``` - * - * Numbers which contain a decimal point, - * such as floating-point numbers or numbers in scientific notation, - * are not an exception to this rule. - * Leading numbers up to the decimal point will be set as the URL's port, - * assuming they are valid: - * - * ```js - * myURL.port = 4.567e21; - * console.log(myURL.port); - * // Prints 4 (because it is the leading number in the string '4.567e21') - * ``` - */ - port: string; - /** - * Gets and sets the protocol portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org'); - * console.log(myURL.protocol); - * // Prints https: - * - * myURL.protocol = 'ftp'; - * console.log(myURL.href); - * // Prints ftp://example.org/ - * ``` - * - * Invalid URL protocol values assigned to the `protocol` property are ignored. - */ - protocol: string; - /** - * Gets and sets the serialized query portion of the URL. - * - * ```js - * const myURL = new URL('https://example.org/abc?123'); - * console.log(myURL.search); - * // Prints ?123 - * - * myURL.search = 'abc=xyz'; - * console.log(myURL.href); - * // Prints https://example.org/abc?abc=xyz - * ``` - * - * Any invalid URL characters appearing in the value assigned the `search`property will be `percent-encoded`. The selection of which - * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - search: string; - /** - * Gets the `URLSearchParams` object representing the query parameters of the - * URL. This property is read-only but the `URLSearchParams` object it provides - * can be used to mutate the URL instance; to replace the entirety of query - * parameters of the URL, use the {@link search} setter. See `URLSearchParams` documentation for details. - * - * Use care when using `.searchParams` to modify the `URL` because, - * per the WHATWG specification, the `URLSearchParams` object uses - * different rules to determine which characters to percent-encode. For - * instance, the `URL` object will not percent encode the ASCII tilde (`~`) - * character, while `URLSearchParams` will always encode it: - * - * ```js - * const myURL = new URL('https://example.org/abc?foo=~bar'); - * - * console.log(myURL.search); // prints ?foo=~bar - * - * // Modify the URL via searchParams... - * myURL.searchParams.sort(); - * - * console.log(myURL.search); // prints ?foo=%7Ebar - * ``` - */ - readonly searchParams: URLSearchParams; - /** - * Gets and sets the username portion of the URL. - * - * ```js - * const myURL = new URL('https://abc:xyz@example.com'); - * console.log(myURL.username); - * // Prints abc - * - * myURL.username = '123'; - * console.log(myURL.href); - * // Prints https://123:xyz@example.com/ - * ``` - * - * Any invalid URL characters appearing in the value assigned the `username`property will be `percent-encoded`. The selection of which - * characters to percent-encode may vary somewhat from what the {@link parse} and {@link format} methods would produce. - */ - username: string; - /** - * The `toString()` method on the `URL` object returns the serialized URL. The - * value returned is equivalent to that of {@link href} and {@link toJSON}. - */ - toString(): string; - /** - * The `toJSON()` method on the `URL` object returns the serialized URL. The - * value returned is equivalent to that of {@link href} and {@link toString}. - * - * This method is automatically called when an `URL` object is serialized - * with [`JSON.stringify()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify). - * - * ```js - * const myURLs = [ - * new URL('https://www.example.com'), - * new URL('https://test.example.org'), - * ]; - * console.log(JSON.stringify(myURLs)); - * // Prints ["https://www.example.com/","https://test.example.org/"] - * ``` - */ - toJSON(): string; - } - /** - * The `URLSearchParams` API provides read and write access to the query of a`URL`. The `URLSearchParams` class can also be used standalone with one of the - * four following constructors. - * The `URLSearchParams` class is also available on the global object. - * - * The WHATWG `URLSearchParams` interface and the `querystring` module have - * similar purpose, but the purpose of the `querystring` module is more - * general, as it allows the customization of delimiter characters (`&` and `=`). - * On the other hand, this API is designed purely for URL query strings. - * - * ```js - * const myURL = new URL('https://example.org/?abc=123'); - * console.log(myURL.searchParams.get('abc')); - * // Prints 123 - * - * myURL.searchParams.append('abc', 'xyz'); - * console.log(myURL.href); - * // Prints https://example.org/?abc=123&abc=xyz - * - * myURL.searchParams.delete('abc'); - * myURL.searchParams.set('a', 'b'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b - * - * const newSearchParams = new URLSearchParams(myURL.searchParams); - * // The above is equivalent to - * // const newSearchParams = new URLSearchParams(myURL.search); - * - * newSearchParams.append('a', 'c'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b - * console.log(newSearchParams.toString()); - * // Prints a=b&a=c - * - * // newSearchParams.toString() is implicitly called - * myURL.search = newSearchParams; - * console.log(myURL.href); - * // Prints https://example.org/?a=b&a=c - * newSearchParams.delete('a'); - * console.log(myURL.href); - * // Prints https://example.org/?a=b&a=c - * ``` - * @since v7.5.0, v6.13.0 - */ - class URLSearchParams implements Iterable<[string, string]> { - constructor( - init?: - | URLSearchParams - | string - | Record - | Iterable<[string, string]> - | ReadonlyArray<[string, string]>, - ); - /** - * Append a new name-value pair to the query string. - */ - append(name: string, value: string): void; - /** - * If `value` is provided, removes all name-value pairs - * where name is `name` and value is `value`.. - * - * If `value` is not provided, removes all name-value pairs whose name is `name`. - */ - delete(name: string, value?: string): void; - /** - * Returns an ES6 `Iterator` over each of the name-value pairs in the query. - * Each item of the iterator is a JavaScript `Array`. The first item of the `Array`is the `name`, the second item of the `Array` is the `value`. - * - * Alias for `urlSearchParams[@@iterator]()`. - */ - entries(): IterableIterator<[string, string]>; - /** - * Iterates over each name-value pair in the query and invokes the given function. - * - * ```js - * const myURL = new URL('https://example.org/?a=b&c=d'); - * myURL.searchParams.forEach((value, name, searchParams) => { - * console.log(name, value, myURL.searchParams === searchParams); - * }); - * // Prints: - * // a b true - * // c d true - * ``` - * @param fn Invoked for each name-value pair in the query - * @param thisArg To be used as `this` value for when `fn` is called - */ - forEach( - callback: (this: TThis, value: string, name: string, searchParams: URLSearchParams) => void, - thisArg?: TThis, - ): void; - /** - * Returns the value of the first name-value pair whose name is `name`. If there - * are no such pairs, `null` is returned. - * @return or `null` if there is no name-value pair with the given `name`. - */ - get(name: string): string | null; - /** - * Returns the values of all name-value pairs whose name is `name`. If there are - * no such pairs, an empty array is returned. - */ - getAll(name: string): string[]; - /** - * Checks if the `URLSearchParams` object contains key-value pair(s) based on`name` and an optional `value` argument. - * - * If `value` is provided, returns `true` when name-value pair with - * same `name` and `value` exists. - * - * If `value` is not provided, returns `true` if there is at least one name-value - * pair whose name is `name`. - */ - has(name: string, value?: string): boolean; - /** - * Returns an ES6 `Iterator` over the names of each name-value pair. - * - * ```js - * const params = new URLSearchParams('foo=bar&foo=baz'); - * for (const name of params.keys()) { - * console.log(name); - * } - * // Prints: - * // foo - * // foo - * ``` - */ - keys(): IterableIterator; - /** - * Sets the value in the `URLSearchParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, - * set the first such pair's value to `value` and remove all others. If not, - * append the name-value pair to the query string. - * - * ```js - * const params = new URLSearchParams(); - * params.append('foo', 'bar'); - * params.append('foo', 'baz'); - * params.append('abc', 'def'); - * console.log(params.toString()); - * // Prints foo=bar&foo=baz&abc=def - * - * params.set('foo', 'def'); - * params.set('xyz', 'opq'); - * console.log(params.toString()); - * // Prints foo=def&abc=def&xyz=opq - * ``` - */ - set(name: string, value: string): void; - /** - * The total number of parameter entries. - * @since v19.8.0 - */ - readonly size: number; - /** - * Sort all existing name-value pairs in-place by their names. Sorting is done - * with a [stable sorting algorithm](https://en.wikipedia.org/wiki/Sorting_algorithm#Stability), so relative order between name-value pairs - * with the same name is preserved. - * - * This method can be used, in particular, to increase cache hits. - * - * ```js - * const params = new URLSearchParams('query[]=abc&type=search&query[]=123'); - * params.sort(); - * console.log(params.toString()); - * // Prints query%5B%5D=abc&query%5B%5D=123&type=search - * ``` - * @since v7.7.0, v6.13.0 - */ - sort(): void; - /** - * Returns the search parameters serialized as a string, with characters - * percent-encoded where necessary. - */ - toString(): string; - /** - * Returns an ES6 `Iterator` over the values of each name-value pair. - */ - values(): IterableIterator; - [Symbol.iterator](): IterableIterator<[string, string]>; - } - import { URL as _URL, URLSearchParams as _URLSearchParams } from "url"; - global { - interface URLSearchParams extends _URLSearchParams {} - interface URL extends _URL {} - interface Global { - URL: typeof _URL; - URLSearchParams: typeof _URLSearchParams; - } - /** - * `URL` class is a global reference for `require('url').URL` - * https://nodejs.org/api/url.html#the-whatwg-url-api - * @since v10.0.0 - */ - var URL: typeof globalThis extends { - onmessage: any; - URL: infer T; - } ? T - : typeof _URL; - /** - * `URLSearchParams` class is a global reference for `require('url').URLSearchParams` - * https://nodejs.org/api/url.html#class-urlsearchparams - * @since v10.0.0 - */ - var URLSearchParams: typeof globalThis extends { - onmessage: any; - URLSearchParams: infer T; - } ? T - : typeof _URLSearchParams; - } -} -declare module "node:url" { - export * from "url"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/util.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/util.d.ts deleted file mode 100644 index ac269ec1..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/util.d.ts +++ /dev/null @@ -1,2183 +0,0 @@ -/** - * The `node:util` module supports the needs of Node.js internal APIs. Many of the - * utilities are useful for application and module developers as well. To access - * it: - * - * ```js - * const util = require('node:util'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/util.js) - */ -declare module "util" { - import * as types from "node:util/types"; - export interface InspectOptions { - /** - * If `true`, object's non-enumerable symbols and properties are included in the formatted result. - * `WeakMap` and `WeakSet` entries are also included as well as user defined prototype properties (excluding method properties). - * @default false - */ - showHidden?: boolean | undefined; - /** - * Specifies the number of times to recurse while formatting object. - * This is useful for inspecting large objects. - * To recurse up to the maximum call stack size pass `Infinity` or `null`. - * @default 2 - */ - depth?: number | null | undefined; - /** - * If `true`, the output is styled with ANSI color codes. Colors are customizable. - */ - colors?: boolean | undefined; - /** - * If `false`, `[util.inspect.custom](depth, opts, inspect)` functions are not invoked. - * @default true - */ - customInspect?: boolean | undefined; - /** - * If `true`, `Proxy` inspection includes the target and handler objects. - * @default false - */ - showProxy?: boolean | undefined; - /** - * Specifies the maximum number of `Array`, `TypedArray`, `WeakMap`, and `WeakSet` elements - * to include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no elements. - * @default 100 - */ - maxArrayLength?: number | null | undefined; - /** - * Specifies the maximum number of characters to - * include when formatting. Set to `null` or `Infinity` to show all elements. - * Set to `0` or negative to show no characters. - * @default 10000 - */ - maxStringLength?: number | null | undefined; - /** - * The length at which input values are split across multiple lines. - * Set to `Infinity` to format the input as a single line - * (in combination with `compact` set to `true` or any number >= `1`). - * @default 80 - */ - breakLength?: number | undefined; - /** - * Setting this to `false` causes each object key - * to be displayed on a new line. It will also add new lines to text that is - * longer than `breakLength`. If set to a number, the most `n` inner elements - * are united on a single line as long as all properties fit into - * `breakLength`. Short array elements are also grouped together. Note that no - * text will be reduced below 16 characters, no matter the `breakLength` size. - * For more information, see the example below. - * @default true - */ - compact?: boolean | number | undefined; - /** - * If set to `true` or a function, all properties of an object, and `Set` and `Map` - * entries are sorted in the resulting string. - * If set to `true` the default sort is used. - * If set to a function, it is used as a compare function. - */ - sorted?: boolean | ((a: string, b: string) => number) | undefined; - /** - * If set to `true`, getters are going to be - * inspected as well. If set to `'get'` only getters without setter are going - * to be inspected. If set to `'set'` only getters having a corresponding - * setter are going to be inspected. This might cause side effects depending on - * the getter function. - * @default false - */ - getters?: "get" | "set" | boolean | undefined; - /** - * If set to `true`, an underscore is used to separate every three digits in all bigints and numbers. - * @default false - */ - numericSeparator?: boolean | undefined; - } - export type Style = - | "special" - | "number" - | "bigint" - | "boolean" - | "undefined" - | "null" - | "string" - | "symbol" - | "date" - | "regexp" - | "module"; - export type CustomInspectFunction = (depth: number, options: InspectOptionsStylized) => any; // TODO: , inspect: inspect - export interface InspectOptionsStylized extends InspectOptions { - stylize(text: string, styleType: Style): string; - } - /** - * The `util.format()` method returns a formatted string using the first argument - * as a `printf`\-like format string which can contain zero or more format - * specifiers. Each specifier is replaced with the converted value from the - * corresponding argument. Supported specifiers are: - * - * If a specifier does not have a corresponding argument, it is not replaced: - * - * ```js - * util.format('%s:%s', 'foo'); - * // Returns: 'foo:%s' - * ``` - * - * Values that are not part of the format string are formatted using`util.inspect()` if their type is not `string`. - * - * If there are more arguments passed to the `util.format()` method than the - * number of specifiers, the extra arguments are concatenated to the returned - * string, separated by spaces: - * - * ```js - * util.format('%s:%s', 'foo', 'bar', 'baz'); - * // Returns: 'foo:bar baz' - * ``` - * - * If the first argument does not contain a valid format specifier, `util.format()`returns a string that is the concatenation of all arguments separated by spaces: - * - * ```js - * util.format(1, 2, 3); - * // Returns: '1 2 3' - * ``` - * - * If only one argument is passed to `util.format()`, it is returned as it is - * without any formatting: - * - * ```js - * util.format('%% %s'); - * // Returns: '%% %s' - * ``` - * - * `util.format()` is a synchronous method that is intended as a debugging tool. - * Some input values can have a significant performance overhead that can block the - * event loop. Use this function with care and never in a hot code path. - * @since v0.5.3 - * @param format A `printf`-like format string. - */ - export function format(format?: any, ...param: any[]): string; - /** - * This function is identical to {@link format}, except in that it takes - * an `inspectOptions` argument which specifies options that are passed along to {@link inspect}. - * - * ```js - * util.formatWithOptions({ colors: true }, 'See object %O', { foo: 42 }); - * // Returns 'See object { foo: 42 }', where `42` is colored as a number - * // when printed to a terminal. - * ``` - * @since v10.0.0 - */ - export function formatWithOptions(inspectOptions: InspectOptions, format?: any, ...param: any[]): string; - /** - * Returns the string name for a numeric error code that comes from a Node.js API. - * The mapping between error codes and error names is platform-dependent. - * See `Common System Errors` for the names of common errors. - * - * ```js - * fs.access('file/that/does/not/exist', (err) => { - * const name = util.getSystemErrorName(err.errno); - * console.error(name); // ENOENT - * }); - * ``` - * @since v9.7.0 - */ - export function getSystemErrorName(err: number): string; - /** - * Returns a Map of all system error codes available from the Node.js API. - * The mapping between error codes and error names is platform-dependent. - * See `Common System Errors` for the names of common errors. - * - * ```js - * fs.access('file/that/does/not/exist', (err) => { - * const errorMap = util.getSystemErrorMap(); - * const name = errorMap.get(err.errno); - * console.error(name); // ENOENT - * }); - * ``` - * @since v16.0.0, v14.17.0 - */ - export function getSystemErrorMap(): Map; - /** - * The `util.log()` method prints the given `string` to `stdout` with an included - * timestamp. - * - * ```js - * const util = require('node:util'); - * - * util.log('Timestamped message.'); - * ``` - * @since v0.3.0 - * @deprecated Since v6.0.0 - Use a third party module instead. - */ - export function log(string: string): void; - /** - * Returns the `string` after replacing any surrogate code points - * (or equivalently, any unpaired surrogate code units) with the - * Unicode "replacement character" U+FFFD. - * @since v16.8.0, v14.18.0 - */ - export function toUSVString(string: string): string; - /** - * Creates and returns an `AbortController` instance whose `AbortSignal` is marked - * as transferable and can be used with `structuredClone()` or `postMessage()`. - * @since v18.11.0 - * @experimental - * @returns A transferable AbortController - */ - export function transferableAbortController(): AbortController; - /** - * Marks the given `AbortSignal` as transferable so that it can be used with`structuredClone()` and `postMessage()`. - * - * ```js - * const signal = transferableAbortSignal(AbortSignal.timeout(100)); - * const channel = new MessageChannel(); - * channel.port2.postMessage(signal, [signal]); - * ``` - * @since v18.11.0 - * @experimental - * @param signal The AbortSignal - * @returns The same AbortSignal - */ - export function transferableAbortSignal(signal: AbortSignal): AbortSignal; - /** - * Listens to abort event on the provided `signal` and - * returns a promise that is fulfilled when the `signal` is - * aborted. If the passed `resource` is garbage collected before the `signal` is - * aborted, the returned promise shall remain pending indefinitely. - * - * ```js - * import { aborted } from 'node:util'; - * - * const dependent = obtainSomethingAbortable(); - * - * aborted(dependent.signal, dependent).then(() => { - * // Do something when dependent is aborted. - * }); - * - * dependent.on('event', () => { - * dependent.abort(); - * }); - * ``` - * @since v19.7.0 - * @experimental - * @param resource Any non-null entity, reference to which is held weakly. - */ - export function aborted(signal: AbortSignal, resource: any): Promise; - /** - * The `util.inspect()` method returns a string representation of `object` that is - * intended for debugging. The output of `util.inspect` may change at any time - * and should not be depended upon programmatically. Additional `options` may be - * passed that alter the result.`util.inspect()` will use the constructor's name and/or `@@toStringTag` to make - * an identifiable tag for an inspected value. - * - * ```js - * class Foo { - * get [Symbol.toStringTag]() { - * return 'bar'; - * } - * } - * - * class Bar {} - * - * const baz = Object.create(null, { [Symbol.toStringTag]: { value: 'foo' } }); - * - * util.inspect(new Foo()); // 'Foo [bar] {}' - * util.inspect(new Bar()); // 'Bar {}' - * util.inspect(baz); // '[foo] {}' - * ``` - * - * Circular references point to their anchor by using a reference index: - * - * ```js - * const { inspect } = require('node:util'); - * - * const obj = {}; - * obj.a = [obj]; - * obj.b = {}; - * obj.b.inner = obj.b; - * obj.b.obj = obj; - * - * console.log(inspect(obj)); - * // { - * // a: [ [Circular *1] ], - * // b: { inner: [Circular *2], obj: [Circular *1] } - * // } - * ``` - * - * The following example inspects all properties of the `util` object: - * - * ```js - * const util = require('node:util'); - * - * console.log(util.inspect(util, { showHidden: true, depth: null })); - * ``` - * - * The following example highlights the effect of the `compact` option: - * - * ```js - * const util = require('node:util'); - * - * const o = { - * a: [1, 2, [[ - * 'Lorem ipsum dolor sit amet,\nconsectetur adipiscing elit, sed do ' + - * 'eiusmod \ntempor incididunt ut labore et dolore magna aliqua.', - * 'test', - * 'foo']], 4], - * b: new Map([['za', 1], ['zb', 'test']]), - * }; - * console.log(util.inspect(o, { compact: true, depth: 5, breakLength: 80 })); - * - * // { a: - * // [ 1, - * // 2, - * // [ [ 'Lorem ipsum dolor sit amet,\nconsectetur [...]', // A long line - * // 'test', - * // 'foo' ] ], - * // 4 ], - * // b: Map(2) { 'za' => 1, 'zb' => 'test' } } - * - * // Setting `compact` to false or an integer creates more reader friendly output. - * console.log(util.inspect(o, { compact: false, depth: 5, breakLength: 80 })); - * - * // { - * // a: [ - * // 1, - * // 2, - * // [ - * // [ - * // 'Lorem ipsum dolor sit amet,\n' + - * // 'consectetur adipiscing elit, sed do eiusmod \n' + - * // 'tempor incididunt ut labore et dolore magna aliqua.', - * // 'test', - * // 'foo' - * // ] - * // ], - * // 4 - * // ], - * // b: Map(2) { - * // 'za' => 1, - * // 'zb' => 'test' - * // } - * // } - * - * // Setting `breakLength` to e.g. 150 will print the "Lorem ipsum" text in a - * // single line. - * ``` - * - * The `showHidden` option allows [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) and - * [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries to be - * inspected. If there are more entries than `maxArrayLength`, there is no - * guarantee which entries are displayed. That means retrieving the same [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) entries twice may - * result in different output. Furthermore, entries - * with no remaining strong references may be garbage collected at any time. - * - * ```js - * const { inspect } = require('node:util'); - * - * const obj = { a: 1 }; - * const obj2 = { b: 2 }; - * const weakSet = new WeakSet([obj, obj2]); - * - * console.log(inspect(weakSet, { showHidden: true })); - * // WeakSet { { a: 1 }, { b: 2 } } - * ``` - * - * The `sorted` option ensures that an object's property insertion order does not - * impact the result of `util.inspect()`. - * - * ```js - * const { inspect } = require('node:util'); - * const assert = require('node:assert'); - * - * const o1 = { - * b: [2, 3, 1], - * a: '`a` comes before `b`', - * c: new Set([2, 3, 1]), - * }; - * console.log(inspect(o1, { sorted: true })); - * // { a: '`a` comes before `b`', b: [ 2, 3, 1 ], c: Set(3) { 1, 2, 3 } } - * console.log(inspect(o1, { sorted: (a, b) => b.localeCompare(a) })); - * // { c: Set(3) { 3, 2, 1 }, b: [ 2, 3, 1 ], a: '`a` comes before `b`' } - * - * const o2 = { - * c: new Set([2, 1, 3]), - * a: '`a` comes before `b`', - * b: [2, 3, 1], - * }; - * assert.strict.equal( - * inspect(o1, { sorted: true }), - * inspect(o2, { sorted: true }), - * ); - * ``` - * - * The `numericSeparator` option adds an underscore every three digits to all - * numbers. - * - * ```js - * const { inspect } = require('node:util'); - * - * const thousand = 1_000; - * const million = 1_000_000; - * const bigNumber = 123_456_789n; - * const bigDecimal = 1_234.123_45; - * - * console.log(inspect(thousand, { numericSeparator: true })); - * // 1_000 - * console.log(inspect(million, { numericSeparator: true })); - * // 1_000_000 - * console.log(inspect(bigNumber, { numericSeparator: true })); - * // 123_456_789n - * console.log(inspect(bigDecimal, { numericSeparator: true })); - * // 1_234.123_45 - * ``` - * - * `util.inspect()` is a synchronous method intended for debugging. Its maximum - * output length is approximately 128 MiB. Inputs that result in longer output will - * be truncated. - * @since v0.3.0 - * @param object Any JavaScript primitive or `Object`. - * @return The representation of `object`. - */ - export function inspect(object: any, showHidden?: boolean, depth?: number | null, color?: boolean): string; - export function inspect(object: any, options?: InspectOptions): string; - export namespace inspect { - let colors: NodeJS.Dict<[number, number]>; - let styles: { - [K in Style]: string; - }; - let defaultOptions: InspectOptions; - /** - * Allows changing inspect settings from the repl. - */ - let replDefaults: InspectOptions; - /** - * That can be used to declare custom inspect functions. - */ - const custom: unique symbol; - } - /** - * Alias for [`Array.isArray()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/isArray). - * - * Returns `true` if the given `object` is an `Array`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isArray([]); - * // Returns: true - * util.isArray(new Array()); - * // Returns: true - * util.isArray({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use `isArray` instead. - */ - export function isArray(object: unknown): object is unknown[]; - /** - * Returns `true` if the given `object` is a `RegExp`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isRegExp(/some regexp/); - * // Returns: true - * util.isRegExp(new RegExp('another regexp')); - * // Returns: true - * util.isRegExp({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Deprecated - */ - export function isRegExp(object: unknown): object is RegExp; - /** - * Returns `true` if the given `object` is a `Date`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isDate(new Date()); - * // Returns: true - * util.isDate(Date()); - * // false (without 'new' returns a String) - * util.isDate({}); - * // Returns: false - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use {@link types.isDate} instead. - */ - export function isDate(object: unknown): object is Date; - /** - * Returns `true` if the given `object` is an `Error`. Otherwise, returns`false`. - * - * ```js - * const util = require('node:util'); - * - * util.isError(new Error()); - * // Returns: true - * util.isError(new TypeError()); - * // Returns: true - * util.isError({ name: 'Error', message: 'an error occurred' }); - * // Returns: false - * ``` - * - * This method relies on `Object.prototype.toString()` behavior. It is - * possible to obtain an incorrect result when the `object` argument manipulates`@@toStringTag`. - * - * ```js - * const util = require('node:util'); - * const obj = { name: 'Error', message: 'an error occurred' }; - * - * util.isError(obj); - * // Returns: false - * obj[Symbol.toStringTag] = 'Error'; - * util.isError(obj); - * // Returns: true - * ``` - * @since v0.6.0 - * @deprecated Since v4.0.0 - Use {@link types.isNativeError} instead. - */ - export function isError(object: unknown): object is Error; - /** - * Usage of `util.inherits()` is discouraged. Please use the ES6 `class` and`extends` keywords to get language level inheritance support. Also note - * that the two styles are [semantically incompatible](https://github.com/nodejs/node/issues/4179). - * - * Inherit the prototype methods from one [constructor](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/constructor) into another. The - * prototype of `constructor` will be set to a new object created from`superConstructor`. - * - * This mainly adds some input validation on top of`Object.setPrototypeOf(constructor.prototype, superConstructor.prototype)`. - * As an additional convenience, `superConstructor` will be accessible - * through the `constructor.super_` property. - * - * ```js - * const util = require('node:util'); - * const EventEmitter = require('node:events'); - * - * function MyStream() { - * EventEmitter.call(this); - * } - * - * util.inherits(MyStream, EventEmitter); - * - * MyStream.prototype.write = function(data) { - * this.emit('data', data); - * }; - * - * const stream = new MyStream(); - * - * console.log(stream instanceof EventEmitter); // true - * console.log(MyStream.super_ === EventEmitter); // true - * - * stream.on('data', (data) => { - * console.log(`Received data: "${data}"`); - * }); - * stream.write('It works!'); // Received data: "It works!" - * ``` - * - * ES6 example using `class` and `extends`: - * - * ```js - * const EventEmitter = require('node:events'); - * - * class MyStream extends EventEmitter { - * write(data) { - * this.emit('data', data); - * } - * } - * - * const stream = new MyStream(); - * - * stream.on('data', (data) => { - * console.log(`Received data: "${data}"`); - * }); - * stream.write('With ES6'); - * ``` - * @since v0.3.0 - * @legacy Use ES2015 class syntax and `extends` keyword instead. - */ - export function inherits(constructor: unknown, superConstructor: unknown): void; - export type DebugLoggerFunction = (msg: string, ...param: unknown[]) => void; - export interface DebugLogger extends DebugLoggerFunction { - enabled: boolean; - } - /** - * The `util.debuglog()` method is used to create a function that conditionally - * writes debug messages to `stderr` based on the existence of the `NODE_DEBUG`environment variable. If the `section` name appears within the value of that - * environment variable, then the returned function operates similar to `console.error()`. If not, then the returned function is a no-op. - * - * ```js - * const util = require('node:util'); - * const debuglog = util.debuglog('foo'); - * - * debuglog('hello from foo [%d]', 123); - * ``` - * - * If this program is run with `NODE_DEBUG=foo` in the environment, then - * it will output something like: - * - * ```console - * FOO 3245: hello from foo [123] - * ``` - * - * where `3245` is the process id. If it is not run with that - * environment variable set, then it will not print anything. - * - * The `section` supports wildcard also: - * - * ```js - * const util = require('node:util'); - * const debuglog = util.debuglog('foo-bar'); - * - * debuglog('hi there, it\'s foo-bar [%d]', 2333); - * ``` - * - * if it is run with `NODE_DEBUG=foo*` in the environment, then it will output - * something like: - * - * ```console - * FOO-BAR 3257: hi there, it's foo-bar [2333] - * ``` - * - * Multiple comma-separated `section` names may be specified in the `NODE_DEBUG`environment variable: `NODE_DEBUG=fs,net,tls`. - * - * The optional `callback` argument can be used to replace the logging function - * with a different function that doesn't have any initialization or - * unnecessary wrapping. - * - * ```js - * const util = require('node:util'); - * let debuglog = util.debuglog('internals', (debug) => { - * // Replace with a logging function that optimizes out - * // testing if the section is enabled - * debuglog = debug; - * }); - * ``` - * @since v0.11.3 - * @param section A string identifying the portion of the application for which the `debuglog` function is being created. - * @param callback A callback invoked the first time the logging function is called with a function argument that is a more optimized logging function. - * @return The logging function - */ - export function debuglog(section: string, callback?: (fn: DebugLoggerFunction) => void): DebugLogger; - export const debug: typeof debuglog; - /** - * Returns `true` if the given `object` is a `Boolean`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isBoolean(1); - * // Returns: false - * util.isBoolean(0); - * // Returns: false - * util.isBoolean(false); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'boolean'` instead. - */ - export function isBoolean(object: unknown): object is boolean; - /** - * Returns `true` if the given `object` is a `Buffer`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isBuffer({ length: 0 }); - * // Returns: false - * util.isBuffer([]); - * // Returns: false - * util.isBuffer(Buffer.from('hello world')); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `isBuffer` instead. - */ - export function isBuffer(object: unknown): object is Buffer; - /** - * Returns `true` if the given `object` is a `Function`. Otherwise, returns`false`. - * - * ```js - * const util = require('node:util'); - * - * function Foo() {} - * const Bar = () => {}; - * - * util.isFunction({}); - * // Returns: false - * util.isFunction(Foo); - * // Returns: true - * util.isFunction(Bar); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'function'` instead. - */ - export function isFunction(object: unknown): boolean; - /** - * Returns `true` if the given `object` is strictly `null`. Otherwise, returns`false`. - * - * ```js - * const util = require('node:util'); - * - * util.isNull(0); - * // Returns: false - * util.isNull(undefined); - * // Returns: false - * util.isNull(null); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === null` instead. - */ - export function isNull(object: unknown): object is null; - /** - * Returns `true` if the given `object` is `null` or `undefined`. Otherwise, - * returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isNullOrUndefined(0); - * // Returns: false - * util.isNullOrUndefined(undefined); - * // Returns: true - * util.isNullOrUndefined(null); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === undefined || value === null` instead. - */ - export function isNullOrUndefined(object: unknown): object is null | undefined; - /** - * Returns `true` if the given `object` is a `Number`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isNumber(false); - * // Returns: false - * util.isNumber(Infinity); - * // Returns: true - * util.isNumber(0); - * // Returns: true - * util.isNumber(NaN); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'number'` instead. - */ - export function isNumber(object: unknown): object is number; - /** - * Returns `true` if the given `object` is strictly an `Object`**and** not a`Function` (even though functions are objects in JavaScript). - * Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isObject(5); - * // Returns: false - * util.isObject(null); - * // Returns: false - * util.isObject({}); - * // Returns: true - * util.isObject(() => {}); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value !== null && typeof value === 'object'` instead. - */ - export function isObject(object: unknown): boolean; - /** - * Returns `true` if the given `object` is a primitive type. Otherwise, returns`false`. - * - * ```js - * const util = require('node:util'); - * - * util.isPrimitive(5); - * // Returns: true - * util.isPrimitive('foo'); - * // Returns: true - * util.isPrimitive(false); - * // Returns: true - * util.isPrimitive(null); - * // Returns: true - * util.isPrimitive(undefined); - * // Returns: true - * util.isPrimitive({}); - * // Returns: false - * util.isPrimitive(() => {}); - * // Returns: false - * util.isPrimitive(/^$/); - * // Returns: false - * util.isPrimitive(new Date()); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `(typeof value !== 'object' && typeof value !== 'function') || value === null` instead. - */ - export function isPrimitive(object: unknown): boolean; - /** - * Returns `true` if the given `object` is a `string`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isString(''); - * // Returns: true - * util.isString('foo'); - * // Returns: true - * util.isString(String('foo')); - * // Returns: true - * util.isString(5); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'string'` instead. - */ - export function isString(object: unknown): object is string; - /** - * Returns `true` if the given `object` is a `Symbol`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * util.isSymbol(5); - * // Returns: false - * util.isSymbol('foo'); - * // Returns: false - * util.isSymbol(Symbol('foo')); - * // Returns: true - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `typeof value === 'symbol'` instead. - */ - export function isSymbol(object: unknown): object is symbol; - /** - * Returns `true` if the given `object` is `undefined`. Otherwise, returns `false`. - * - * ```js - * const util = require('node:util'); - * - * const foo = undefined; - * util.isUndefined(5); - * // Returns: false - * util.isUndefined(foo); - * // Returns: true - * util.isUndefined(null); - * // Returns: false - * ``` - * @since v0.11.5 - * @deprecated Since v4.0.0 - Use `value === undefined` instead. - */ - export function isUndefined(object: unknown): object is undefined; - /** - * The `util.deprecate()` method wraps `fn` (which may be a function or class) in - * such a way that it is marked as deprecated. - * - * ```js - * const util = require('node:util'); - * - * exports.obsoleteFunction = util.deprecate(() => { - * // Do something here. - * }, 'obsoleteFunction() is deprecated. Use newShinyFunction() instead.'); - * ``` - * - * When called, `util.deprecate()` will return a function that will emit a`DeprecationWarning` using the `'warning'` event. The warning will - * be emitted and printed to `stderr` the first time the returned function is - * called. After the warning is emitted, the wrapped function is called without - * emitting a warning. - * - * If the same optional `code` is supplied in multiple calls to `util.deprecate()`, - * the warning will be emitted only once for that `code`. - * - * ```js - * const util = require('node:util'); - * - * const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); - * const fn2 = util.deprecate(someOtherFunction, someOtherMessage, 'DEP0001'); - * fn1(); // Emits a deprecation warning with code DEP0001 - * fn2(); // Does not emit a deprecation warning because it has the same code - * ``` - * - * If either the `--no-deprecation` or `--no-warnings` command-line flags are - * used, or if the `process.noDeprecation` property is set to `true`_prior_ to - * the first deprecation warning, the `util.deprecate()` method does nothing. - * - * If the `--trace-deprecation` or `--trace-warnings` command-line flags are set, - * or the `process.traceDeprecation` property is set to `true`, a warning and a - * stack trace are printed to `stderr` the first time the deprecated function is - * called. - * - * If the `--throw-deprecation` command-line flag is set, or the`process.throwDeprecation` property is set to `true`, then an exception will be - * thrown when the deprecated function is called. - * - * The `--throw-deprecation` command-line flag and `process.throwDeprecation`property take precedence over `--trace-deprecation` and`process.traceDeprecation`. - * @since v0.8.0 - * @param fn The function that is being deprecated. - * @param msg A warning message to display when the deprecated function is invoked. - * @param code A deprecation code. See the `list of deprecated APIs` for a list of codes. - * @return The deprecated function wrapped to emit a warning. - */ - export function deprecate(fn: T, msg: string, code?: string): T; - /** - * Returns `true` if there is deep strict equality between `val1` and `val2`. - * Otherwise, returns `false`. - * - * See `assert.deepStrictEqual()` for more information about deep strict - * equality. - * @since v9.0.0 - */ - export function isDeepStrictEqual(val1: unknown, val2: unknown): boolean; - /** - * Returns `str` with any ANSI escape codes removed. - * - * ```js - * console.log(util.stripVTControlCharacters('\u001B[4mvalue\u001B[0m')); - * // Prints "value" - * ``` - * @since v16.11.0 - */ - export function stripVTControlCharacters(str: string): string; - /** - * Takes an `async` function (or a function that returns a `Promise`) and returns a - * function following the error-first callback style, i.e. taking - * an `(err, value) => ...` callback as the last argument. In the callback, the - * first argument will be the rejection reason (or `null` if the `Promise`resolved), and the second argument will be the resolved value. - * - * ```js - * const util = require('node:util'); - * - * async function fn() { - * return 'hello world'; - * } - * const callbackFunction = util.callbackify(fn); - * - * callbackFunction((err, ret) => { - * if (err) throw err; - * console.log(ret); - * }); - * ``` - * - * Will print: - * - * ```text - * hello world - * ``` - * - * The callback is executed asynchronously, and will have a limited stack trace. - * If the callback throws, the process will emit an `'uncaughtException'` event, and if not handled will exit. - * - * Since `null` has a special meaning as the first argument to a callback, if a - * wrapped function rejects a `Promise` with a falsy value as a reason, the value - * is wrapped in an `Error` with the original value stored in a field named`reason`. - * - * ```js - * function fn() { - * return Promise.reject(null); - * } - * const callbackFunction = util.callbackify(fn); - * - * callbackFunction((err, ret) => { - * // When the Promise was rejected with `null` it is wrapped with an Error and - * // the original value is stored in `reason`. - * err && Object.hasOwn(err, 'reason') && err.reason === null; // true - * }); - * ``` - * @since v8.2.0 - * @param fn An `async` function - * @return a callback style function - */ - export function callbackify(fn: () => Promise): (callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: () => Promise, - ): (callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1) => Promise, - ): (arg1: T1, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1) => Promise, - ): (arg1: T1, callback: (err: NodeJS.ErrnoException, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2) => Promise, - ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2) => Promise, - ): (arg1: T1, arg2: T2, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, callback: (err: NodeJS.ErrnoException | null, result: TResult) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: NodeJS.ErrnoException) => void) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - callback: (err: NodeJS.ErrnoException) => void, - ) => void; - export function callbackify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, arg6: T6) => Promise, - ): ( - arg1: T1, - arg2: T2, - arg3: T3, - arg4: T4, - arg5: T5, - arg6: T6, - callback: (err: NodeJS.ErrnoException | null, result: TResult) => void, - ) => void; - export interface CustomPromisifyLegacy extends Function { - __promisify__: TCustom; - } - export interface CustomPromisifySymbol extends Function { - [promisify.custom]: TCustom; - } - export type CustomPromisify = - | CustomPromisifySymbol - | CustomPromisifyLegacy; - /** - * Takes a function following the common error-first callback style, i.e. taking - * an `(err, value) => ...` callback as the last argument, and returns a version - * that returns promises. - * - * ```js - * const util = require('node:util'); - * const fs = require('node:fs'); - * - * const stat = util.promisify(fs.stat); - * stat('.').then((stats) => { - * // Do something with `stats` - * }).catch((error) => { - * // Handle the error. - * }); - * ``` - * - * Or, equivalently using `async function`s: - * - * ```js - * const util = require('node:util'); - * const fs = require('node:fs'); - * - * const stat = util.promisify(fs.stat); - * - * async function callStat() { - * const stats = await stat('.'); - * console.log(`This directory is owned by ${stats.uid}`); - * } - * - * callStat(); - * ``` - * - * If there is an `original[util.promisify.custom]` property present, `promisify`will return its value, see `Custom promisified functions`. - * - * `promisify()` assumes that `original` is a function taking a callback as its - * final argument in all cases. If `original` is not a function, `promisify()`will throw an error. If `original` is a function but its last argument is not - * an error-first callback, it will still be passed an error-first - * callback as its last argument. - * - * Using `promisify()` on class methods or other methods that use `this` may not - * work as expected unless handled specially: - * - * ```js - * const util = require('node:util'); - * - * class Foo { - * constructor() { - * this.a = 42; - * } - * - * bar(callback) { - * callback(null, this.a); - * } - * } - * - * const foo = new Foo(); - * - * const naiveBar = util.promisify(foo.bar); - * // TypeError: Cannot read property 'a' of undefined - * // naiveBar().then(a => console.log(a)); - * - * naiveBar.call(foo).then((a) => console.log(a)); // '42' - * - * const bindBar = naiveBar.bind(foo); - * bindBar().then((a) => console.log(a)); // '42' - * ``` - * @since v8.0.0 - */ - export function promisify(fn: CustomPromisify): TCustom; - export function promisify( - fn: (callback: (err: any, result: TResult) => void) => void, - ): () => Promise; - export function promisify(fn: (callback: (err?: any) => void) => void): () => Promise; - export function promisify( - fn: (arg1: T1, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1) => Promise; - export function promisify(fn: (arg1: T1, callback: (err?: any) => void) => void): (arg1: T1) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err: any, result: TResult) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify( - fn: (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5, callback: (err?: any) => void) => void, - ): (arg1: T1, arg2: T2, arg3: T3, arg4: T4, arg5: T5) => Promise; - export function promisify(fn: Function): Function; - export namespace promisify { - /** - * That can be used to declare custom promisified variants of functions. - */ - const custom: unique symbol; - } - /** - * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextDecoder` API. - * - * ```js - * const decoder = new TextDecoder(); - * const u8arr = new Uint8Array([72, 101, 108, 108, 111]); - * console.log(decoder.decode(u8arr)); // Hello - * ``` - * @since v8.3.0 - */ - export class TextDecoder { - /** - * The encoding supported by the `TextDecoder` instance. - */ - readonly encoding: string; - /** - * The value will be `true` if decoding errors result in a `TypeError` being - * thrown. - */ - readonly fatal: boolean; - /** - * The value will be `true` if the decoding result will include the byte order - * mark. - */ - readonly ignoreBOM: boolean; - constructor( - encoding?: string, - options?: { - fatal?: boolean | undefined; - ignoreBOM?: boolean | undefined; - }, - ); - /** - * Decodes the `input` and returns a string. If `options.stream` is `true`, any - * incomplete byte sequences occurring at the end of the `input` are buffered - * internally and emitted after the next call to `textDecoder.decode()`. - * - * If `textDecoder.fatal` is `true`, decoding errors that occur will result in a`TypeError` being thrown. - * @param input An `ArrayBuffer`, `DataView`, or `TypedArray` instance containing the encoded data. - */ - decode( - input?: NodeJS.ArrayBufferView | ArrayBuffer | null, - options?: { - stream?: boolean | undefined; - }, - ): string; - } - export interface EncodeIntoResult { - /** - * The read Unicode code units of input. - */ - read: number; - /** - * The written UTF-8 bytes of output. - */ - written: number; - } - export { types }; - - //// TextEncoder/Decoder - /** - * An implementation of the [WHATWG Encoding Standard](https://encoding.spec.whatwg.org/) `TextEncoder` API. All - * instances of `TextEncoder` only support UTF-8 encoding. - * - * ```js - * const encoder = new TextEncoder(); - * const uint8array = encoder.encode('this is some data'); - * ``` - * - * The `TextEncoder` class is also available on the global object. - * @since v8.3.0 - */ - export class TextEncoder { - /** - * The encoding supported by the `TextEncoder` instance. Always set to `'utf-8'`. - */ - readonly encoding: string; - /** - * UTF-8 encodes the `input` string and returns a `Uint8Array` containing the - * encoded bytes. - * @param [input='an empty string'] The text to encode. - */ - encode(input?: string): Uint8Array; - /** - * UTF-8 encodes the `src` string to the `dest` Uint8Array and returns an object - * containing the read Unicode code units and written UTF-8 bytes. - * - * ```js - * const encoder = new TextEncoder(); - * const src = 'this is some data'; - * const dest = new Uint8Array(10); - * const { read, written } = encoder.encodeInto(src, dest); - * ``` - * @param src The text to encode. - * @param dest The array to hold the encode result. - */ - encodeInto(src: string, dest: Uint8Array): EncodeIntoResult; - } - import { TextDecoder as _TextDecoder, TextEncoder as _TextEncoder } from "util"; - global { - /** - * `TextDecoder` class is a global reference for `require('util').TextDecoder` - * https://nodejs.org/api/globals.html#textdecoder - * @since v11.0.0 - */ - var TextDecoder: typeof globalThis extends { - onmessage: any; - TextDecoder: infer TextDecoder; - } ? TextDecoder - : typeof _TextDecoder; - /** - * `TextEncoder` class is a global reference for `require('util').TextEncoder` - * https://nodejs.org/api/globals.html#textencoder - * @since v11.0.0 - */ - var TextEncoder: typeof globalThis extends { - onmessage: any; - TextEncoder: infer TextEncoder; - } ? TextEncoder - : typeof _TextEncoder; - } - - //// parseArgs - /** - * Provides a higher level API for command-line argument parsing than interacting - * with `process.argv` directly. Takes a specification for the expected arguments - * and returns a structured object with the parsed options and positionals. - * - * ```js - * import { parseArgs } from 'node:util'; - * const args = ['-f', '--bar', 'b']; - * const options = { - * foo: { - * type: 'boolean', - * short: 'f', - * }, - * bar: { - * type: 'string', - * }, - * }; - * const { - * values, - * positionals, - * } = parseArgs({ args, options }); - * console.log(values, positionals); - * // Prints: [Object: null prototype] { foo: true, bar: 'b' } [] - * ``` - * @since v18.3.0, v16.17.0 - * @param config Used to provide arguments for parsing and to configure the parser. `config` supports the following properties: - * @return The parsed command line arguments: - */ - export function parseArgs(config?: T): ParsedResults; - interface ParseArgsOptionConfig { - /** - * Type of argument. - */ - type: "string" | "boolean"; - /** - * Whether this option can be provided multiple times. - * If `true`, all values will be collected in an array. - * If `false`, values for the option are last-wins. - * @default false. - */ - multiple?: boolean | undefined; - /** - * A single character alias for the option. - */ - short?: string | undefined; - /** - * The default option value when it is not set by args. - * It must be of the same type as the the `type` property. - * When `multiple` is `true`, it must be an array. - * @since v18.11.0 - */ - default?: string | boolean | string[] | boolean[] | undefined; - } - interface ParseArgsOptionsConfig { - [longOption: string]: ParseArgsOptionConfig; - } - export interface ParseArgsConfig { - /** - * Array of argument strings. - */ - args?: string[] | undefined; - /** - * Used to describe arguments known to the parser. - */ - options?: ParseArgsOptionsConfig | undefined; - /** - * Should an error be thrown when unknown arguments are encountered, - * or when arguments are passed that do not match the `type` configured in `options`. - * @default true - */ - strict?: boolean | undefined; - /** - * Whether this command accepts positional arguments. - */ - allowPositionals?: boolean | undefined; - /** - * Return the parsed tokens. This is useful for extending the built-in behavior, - * from adding additional checks through to reprocessing the tokens in different ways. - * @default false - */ - tokens?: boolean | undefined; - } - /* - IfDefaultsTrue and IfDefaultsFalse are helpers to handle default values for missing boolean properties. - TypeScript does not have exact types for objects: https://github.com/microsoft/TypeScript/issues/12936 - This means it is impossible to distinguish between "field X is definitely not present" and "field X may or may not be present". - But we expect users to generally provide their config inline or `as const`, which means TS will always know whether a given field is present. - So this helper treats "not definitely present" (i.e., not `extends boolean`) as being "definitely not present", i.e. it should have its default value. - This is technically incorrect but is a much nicer UX for the common case. - The IfDefaultsTrue version is for things which default to true; the IfDefaultsFalse version is for things which default to false. - */ - type IfDefaultsTrue = T extends true ? IfTrue - : T extends false ? IfFalse - : IfTrue; - - // we put the `extends false` condition first here because `undefined` compares like `any` when `strictNullChecks: false` - type IfDefaultsFalse = T extends false ? IfFalse - : T extends true ? IfTrue - : IfFalse; - - type ExtractOptionValue = IfDefaultsTrue< - T["strict"], - O["type"] extends "string" ? string : O["type"] extends "boolean" ? boolean : string | boolean, - string | boolean - >; - - type ParsedValues = - & IfDefaultsTrue - & (T["options"] extends ParseArgsOptionsConfig ? { - -readonly [LongOption in keyof T["options"]]: IfDefaultsFalse< - T["options"][LongOption]["multiple"], - undefined | Array>, - undefined | ExtractOptionValue - >; - } - : {}); - - type ParsedPositionals = IfDefaultsTrue< - T["strict"], - IfDefaultsFalse, - IfDefaultsTrue - >; - - type PreciseTokenForOptions< - K extends string, - O extends ParseArgsOptionConfig, - > = O["type"] extends "string" ? { - kind: "option"; - index: number; - name: K; - rawName: string; - value: string; - inlineValue: boolean; - } - : O["type"] extends "boolean" ? { - kind: "option"; - index: number; - name: K; - rawName: string; - value: undefined; - inlineValue: undefined; - } - : OptionToken & { name: K }; - - type TokenForOptions< - T extends ParseArgsConfig, - K extends keyof T["options"] = keyof T["options"], - > = K extends unknown - ? T["options"] extends ParseArgsOptionsConfig ? PreciseTokenForOptions - : OptionToken - : never; - - type ParsedOptionToken = IfDefaultsTrue, OptionToken>; - - type ParsedPositionalToken = IfDefaultsTrue< - T["strict"], - IfDefaultsFalse, - IfDefaultsTrue - >; - - type ParsedTokens = Array< - ParsedOptionToken | ParsedPositionalToken | { kind: "option-terminator"; index: number } - >; - - type PreciseParsedResults = IfDefaultsFalse< - T["tokens"], - { - values: ParsedValues; - positionals: ParsedPositionals; - tokens: ParsedTokens; - }, - { - values: ParsedValues; - positionals: ParsedPositionals; - } - >; - - type OptionToken = - | { kind: "option"; index: number; name: string; rawName: string; value: string; inlineValue: boolean } - | { - kind: "option"; - index: number; - name: string; - rawName: string; - value: undefined; - inlineValue: undefined; - }; - - type Token = - | OptionToken - | { kind: "positional"; index: number; value: string } - | { kind: "option-terminator"; index: number }; - - // If ParseArgsConfig extends T, then the user passed config constructed elsewhere. - // So we can't rely on the `"not definitely present" implies "definitely not present"` assumption mentioned above. - type ParsedResults = ParseArgsConfig extends T ? { - values: { - [longOption: string]: undefined | string | boolean | Array; - }; - positionals: string[]; - tokens?: Token[]; - } - : PreciseParsedResults; - - /** - * An implementation of [the MIMEType class](https://bmeck.github.io/node-proposal-mime-api/). - * - * In accordance with browser conventions, all properties of `MIMEType` objects - * are implemented as getters and setters on the class prototype, rather than as - * data properties on the object itself. - * - * A MIME string is a structured string containing multiple meaningful - * components. When parsed, a `MIMEType` object is returned containing - * properties for each of these components. - * @since v19.1.0, v18.13.0 - * @experimental - */ - export class MIMEType { - /** - * Creates a new MIMEType object by parsing the input. - * - * A `TypeError` will be thrown if the `input` is not a valid MIME. - * Note that an effort will be made to coerce the given values into strings. - * @param input The input MIME to parse. - */ - constructor(input: string | { toString: () => string }); - - /** - * Gets and sets the type portion of the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/javascript'); - * console.log(myMIME.type); - * // Prints: text - * myMIME.type = 'application'; - * console.log(myMIME.type); - * // Prints: application - * console.log(String(myMIME)); - * // Prints: application/javascript - * ``` - */ - type: string; - /** - * Gets and sets the subtype portion of the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/ecmascript'); - * console.log(myMIME.subtype); - * // Prints: ecmascript - * myMIME.subtype = 'javascript'; - * console.log(myMIME.subtype); - * // Prints: javascript - * console.log(String(myMIME)); - * // Prints: text/javascript - * ``` - */ - subtype: string; - /** - * Gets the essence of the MIME. This property is read only. - * Use `mime.type` or `mime.subtype` to alter the MIME. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const myMIME = new MIMEType('text/javascript;key=value'); - * console.log(myMIME.essence); - * // Prints: text/javascript - * myMIME.type = 'application'; - * console.log(myMIME.essence); - * // Prints: application/javascript - * console.log(String(myMIME)); - * // Prints: application/javascript;key=value - * ``` - */ - readonly essence: string; - /** - * Gets the `MIMEParams` object representing the - * parameters of the MIME. This property is read-only. See `MIMEParams` documentation for details. - */ - readonly params: MIMEParams; - /** - * The `toString()` method on the `MIMEType` object returns the serialized MIME. - * - * Because of the need for standard compliance, this method does not allow users - * to customize the serialization process of the MIME. - */ - toString(): string; - } - /** - * The `MIMEParams` API provides read and write access to the parameters of a`MIMEType`. - * @since v19.1.0, v18.13.0 - */ - export class MIMEParams { - /** - * Remove all name-value pairs whose name is `name`. - */ - delete(name: string): void; - /** - * Returns an iterator over each of the name-value pairs in the parameters. - * Each item of the iterator is a JavaScript `Array`. The first item of the array - * is the `name`, the second item of the array is the `value`. - */ - entries(): IterableIterator<[string, string]>; - /** - * Returns the value of the first name-value pair whose name is `name`. If there - * are no such pairs, `null` is returned. - * @return or `null` if there is no name-value pair with the given `name`. - */ - get(name: string): string | null; - /** - * Returns `true` if there is at least one name-value pair whose name is `name`. - */ - has(name: string): boolean; - /** - * Returns an iterator over the names of each name-value pair. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const { params } = new MIMEType('text/plain;foo=0;bar=1'); - * for (const name of params.keys()) { - * console.log(name); - * } - * // Prints: - * // foo - * // bar - * ``` - */ - keys(): IterableIterator; - /** - * Sets the value in the `MIMEParams` object associated with `name` to`value`. If there are any pre-existing name-value pairs whose names are `name`, - * set the first such pair's value to `value`. - * - * ```js - * import { MIMEType } from 'node:util'; - * - * const { params } = new MIMEType('text/plain;foo=0;bar=1'); - * params.set('foo', 'def'); - * params.set('baz', 'xyz'); - * console.log(params.toString()); - * // Prints: foo=def;bar=1;baz=xyz - * ``` - */ - set(name: string, value: string): void; - /** - * Returns an iterator over the values of each name-value pair. - */ - values(): IterableIterator; - /** - * Returns an iterator over each of the name-value pairs in the parameters. - */ - [Symbol.iterator]: typeof MIMEParams.prototype.entries; - } -} -declare module "util/types" { - import { KeyObject, webcrypto } from "node:crypto"; - /** - * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) or - * [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. - * - * See also `util.types.isArrayBuffer()` and `util.types.isSharedArrayBuffer()`. - * - * ```js - * util.types.isAnyArrayBuffer(new ArrayBuffer()); // Returns true - * util.types.isAnyArrayBuffer(new SharedArrayBuffer()); // Returns true - * ``` - * @since v10.0.0 - */ - function isAnyArrayBuffer(object: unknown): object is ArrayBufferLike; - /** - * Returns `true` if the value is an `arguments` object. - * - * ```js - * function foo() { - * util.types.isArgumentsObject(arguments); // Returns true - * } - * ``` - * @since v10.0.0 - */ - function isArgumentsObject(object: unknown): object is IArguments; - /** - * Returns `true` if the value is a built-in [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instance. - * This does _not_ include [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instances. Usually, it is - * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. - * - * ```js - * util.types.isArrayBuffer(new ArrayBuffer()); // Returns true - * util.types.isArrayBuffer(new SharedArrayBuffer()); // Returns false - * ``` - * @since v10.0.0 - */ - function isArrayBuffer(object: unknown): object is ArrayBuffer; - /** - * Returns `true` if the value is an instance of one of the [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) views, such as typed - * array objects or [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView). Equivalent to - * [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * - * ```js - * util.types.isArrayBufferView(new Int8Array()); // true - * util.types.isArrayBufferView(Buffer.from('hello world')); // true - * util.types.isArrayBufferView(new DataView(new ArrayBuffer(16))); // true - * util.types.isArrayBufferView(new ArrayBuffer()); // false - * ``` - * @since v10.0.0 - */ - function isArrayBufferView(object: unknown): object is NodeJS.ArrayBufferView; - /** - * Returns `true` if the value is an [async function](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/async_function). - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * util.types.isAsyncFunction(function foo() {}); // Returns false - * util.types.isAsyncFunction(async function foo() {}); // Returns true - * ``` - * @since v10.0.0 - */ - function isAsyncFunction(object: unknown): boolean; - /** - * Returns `true` if the value is a `BigInt64Array` instance. - * - * ```js - * util.types.isBigInt64Array(new BigInt64Array()); // Returns true - * util.types.isBigInt64Array(new BigUint64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isBigInt64Array(value: unknown): value is BigInt64Array; - /** - * Returns `true` if the value is a `BigUint64Array` instance. - * - * ```js - * util.types.isBigUint64Array(new BigInt64Array()); // Returns false - * util.types.isBigUint64Array(new BigUint64Array()); // Returns true - * ``` - * @since v10.0.0 - */ - function isBigUint64Array(value: unknown): value is BigUint64Array; - /** - * Returns `true` if the value is a boolean object, e.g. created - * by `new Boolean()`. - * - * ```js - * util.types.isBooleanObject(false); // Returns false - * util.types.isBooleanObject(true); // Returns false - * util.types.isBooleanObject(new Boolean(false)); // Returns true - * util.types.isBooleanObject(new Boolean(true)); // Returns true - * util.types.isBooleanObject(Boolean(false)); // Returns false - * util.types.isBooleanObject(Boolean(true)); // Returns false - * ``` - * @since v10.0.0 - */ - function isBooleanObject(object: unknown): object is Boolean; - /** - * Returns `true` if the value is any boxed primitive object, e.g. created - * by `new Boolean()`, `new String()` or `Object(Symbol())`. - * - * For example: - * - * ```js - * util.types.isBoxedPrimitive(false); // Returns false - * util.types.isBoxedPrimitive(new Boolean(false)); // Returns true - * util.types.isBoxedPrimitive(Symbol('foo')); // Returns false - * util.types.isBoxedPrimitive(Object(Symbol('foo'))); // Returns true - * util.types.isBoxedPrimitive(Object(BigInt(5))); // Returns true - * ``` - * @since v10.11.0 - */ - function isBoxedPrimitive(object: unknown): object is String | Number | BigInt | Boolean | Symbol; - /** - * Returns `true` if the value is a built-in [`DataView`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/DataView) instance. - * - * ```js - * const ab = new ArrayBuffer(20); - * util.types.isDataView(new DataView(ab)); // Returns true - * util.types.isDataView(new Float64Array()); // Returns false - * ``` - * - * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * @since v10.0.0 - */ - function isDataView(object: unknown): object is DataView; - /** - * Returns `true` if the value is a built-in [`Date`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date) instance. - * - * ```js - * util.types.isDate(new Date()); // Returns true - * ``` - * @since v10.0.0 - */ - function isDate(object: unknown): object is Date; - /** - * Returns `true` if the value is a native `External` value. - * - * A native `External` value is a special type of object that contains a - * raw C++ pointer (`void*`) for access from native code, and has no other - * properties. Such objects are created either by Node.js internals or native - * addons. In JavaScript, they are [frozen](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze) objects with a`null` prototype. - * - * ```c - * #include - * #include - * napi_value result; - * static napi_value MyNapi(napi_env env, napi_callback_info info) { - * int* raw = (int*) malloc(1024); - * napi_status status = napi_create_external(env, (void*) raw, NULL, NULL, &result); - * if (status != napi_ok) { - * napi_throw_error(env, NULL, "napi_create_external failed"); - * return NULL; - * } - * return result; - * } - * ... - * DECLARE_NAPI_PROPERTY("myNapi", MyNapi) - * ... - * ``` - * - * ```js - * const native = require('napi_addon.node'); - * const data = native.myNapi(); - * util.types.isExternal(data); // returns true - * util.types.isExternal(0); // returns false - * util.types.isExternal(new String('foo')); // returns false - * ``` - * - * For further information on `napi_create_external`, refer to `napi_create_external()`. - * @since v10.0.0 - */ - function isExternal(object: unknown): boolean; - /** - * Returns `true` if the value is a built-in [`Float32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float32Array) instance. - * - * ```js - * util.types.isFloat32Array(new ArrayBuffer()); // Returns false - * util.types.isFloat32Array(new Float32Array()); // Returns true - * util.types.isFloat32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isFloat32Array(object: unknown): object is Float32Array; - /** - * Returns `true` if the value is a built-in [`Float64Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Float64Array) instance. - * - * ```js - * util.types.isFloat64Array(new ArrayBuffer()); // Returns false - * util.types.isFloat64Array(new Uint8Array()); // Returns false - * util.types.isFloat64Array(new Float64Array()); // Returns true - * ``` - * @since v10.0.0 - */ - function isFloat64Array(object: unknown): object is Float64Array; - /** - * Returns `true` if the value is a generator function. - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * util.types.isGeneratorFunction(function foo() {}); // Returns false - * util.types.isGeneratorFunction(function* foo() {}); // Returns true - * ``` - * @since v10.0.0 - */ - function isGeneratorFunction(object: unknown): object is GeneratorFunction; - /** - * Returns `true` if the value is a generator object as returned from a - * built-in generator function. - * This only reports back what the JavaScript engine is seeing; - * in particular, the return value may not match the original source code if - * a transpilation tool was used. - * - * ```js - * function* foo() {} - * const generator = foo(); - * util.types.isGeneratorObject(generator); // Returns true - * ``` - * @since v10.0.0 - */ - function isGeneratorObject(object: unknown): object is Generator; - /** - * Returns `true` if the value is a built-in [`Int8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array) instance. - * - * ```js - * util.types.isInt8Array(new ArrayBuffer()); // Returns false - * util.types.isInt8Array(new Int8Array()); // Returns true - * util.types.isInt8Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt8Array(object: unknown): object is Int8Array; - /** - * Returns `true` if the value is a built-in [`Int16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array) instance. - * - * ```js - * util.types.isInt16Array(new ArrayBuffer()); // Returns false - * util.types.isInt16Array(new Int16Array()); // Returns true - * util.types.isInt16Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt16Array(object: unknown): object is Int16Array; - /** - * Returns `true` if the value is a built-in [`Int32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int32Array) instance. - * - * ```js - * util.types.isInt32Array(new ArrayBuffer()); // Returns false - * util.types.isInt32Array(new Int32Array()); // Returns true - * util.types.isInt32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isInt32Array(object: unknown): object is Int32Array; - /** - * Returns `true` if the value is a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. - * - * ```js - * util.types.isMap(new Map()); // Returns true - * ``` - * @since v10.0.0 - */ - function isMap( - object: T | {}, - ): object is T extends ReadonlyMap ? (unknown extends T ? never : ReadonlyMap) - : Map; - /** - * Returns `true` if the value is an iterator returned for a built-in [`Map`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map) instance. - * - * ```js - * const map = new Map(); - * util.types.isMapIterator(map.keys()); // Returns true - * util.types.isMapIterator(map.values()); // Returns true - * util.types.isMapIterator(map.entries()); // Returns true - * util.types.isMapIterator(map[Symbol.iterator]()); // Returns true - * ``` - * @since v10.0.0 - */ - function isMapIterator(object: unknown): boolean; - /** - * Returns `true` if the value is an instance of a [Module Namespace Object](https://tc39.github.io/ecma262/#sec-module-namespace-exotic-objects). - * - * ```js - * import * as ns from './a.js'; - * - * util.types.isModuleNamespaceObject(ns); // Returns true - * ``` - * @since v10.0.0 - */ - function isModuleNamespaceObject(value: unknown): boolean; - /** - * Returns `true` if the value was returned by the constructor of a [built-in `Error` type](https://tc39.es/ecma262/#sec-error-objects). - * - * ```js - * console.log(util.types.isNativeError(new Error())); // true - * console.log(util.types.isNativeError(new TypeError())); // true - * console.log(util.types.isNativeError(new RangeError())); // true - * ``` - * - * Subclasses of the native error types are also native errors: - * - * ```js - * class MyError extends Error {} - * console.log(util.types.isNativeError(new MyError())); // true - * ``` - * - * A value being `instanceof` a native error class is not equivalent to `isNativeError()`returning `true` for that value. `isNativeError()` returns `true` for errors - * which come from a different [realm](https://tc39.es/ecma262/#realm) while `instanceof Error` returns `false`for these errors: - * - * ```js - * const vm = require('node:vm'); - * const context = vm.createContext({}); - * const myError = vm.runInContext('new Error()', context); - * console.log(util.types.isNativeError(myError)); // true - * console.log(myError instanceof Error); // false - * ``` - * - * Conversely, `isNativeError()` returns `false` for all objects which were not - * returned by the constructor of a native error. That includes values - * which are `instanceof` native errors: - * - * ```js - * const myError = { __proto__: Error.prototype }; - * console.log(util.types.isNativeError(myError)); // false - * console.log(myError instanceof Error); // true - * ``` - * @since v10.0.0 - */ - function isNativeError(object: unknown): object is Error; - /** - * Returns `true` if the value is a number object, e.g. created - * by `new Number()`. - * - * ```js - * util.types.isNumberObject(0); // Returns false - * util.types.isNumberObject(new Number(0)); // Returns true - * ``` - * @since v10.0.0 - */ - function isNumberObject(object: unknown): object is Number; - /** - * Returns `true` if the value is a built-in [`Promise`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise). - * - * ```js - * util.types.isPromise(Promise.resolve(42)); // Returns true - * ``` - * @since v10.0.0 - */ - function isPromise(object: unknown): object is Promise; - /** - * Returns `true` if the value is a [`Proxy`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy) instance. - * - * ```js - * const target = {}; - * const proxy = new Proxy(target, {}); - * util.types.isProxy(target); // Returns false - * util.types.isProxy(proxy); // Returns true - * ``` - * @since v10.0.0 - */ - function isProxy(object: unknown): boolean; - /** - * Returns `true` if the value is a regular expression object. - * - * ```js - * util.types.isRegExp(/abc/); // Returns true - * util.types.isRegExp(new RegExp('abc')); // Returns true - * ``` - * @since v10.0.0 - */ - function isRegExp(object: unknown): object is RegExp; - /** - * Returns `true` if the value is a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. - * - * ```js - * util.types.isSet(new Set()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSet( - object: T | {}, - ): object is T extends ReadonlySet ? (unknown extends T ? never : ReadonlySet) : Set; - /** - * Returns `true` if the value is an iterator returned for a built-in [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) instance. - * - * ```js - * const set = new Set(); - * util.types.isSetIterator(set.keys()); // Returns true - * util.types.isSetIterator(set.values()); // Returns true - * util.types.isSetIterator(set.entries()); // Returns true - * util.types.isSetIterator(set[Symbol.iterator]()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSetIterator(object: unknown): boolean; - /** - * Returns `true` if the value is a built-in [`SharedArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/SharedArrayBuffer) instance. - * This does _not_ include [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) instances. Usually, it is - * desirable to test for both; See `util.types.isAnyArrayBuffer()` for that. - * - * ```js - * util.types.isSharedArrayBuffer(new ArrayBuffer()); // Returns false - * util.types.isSharedArrayBuffer(new SharedArrayBuffer()); // Returns true - * ``` - * @since v10.0.0 - */ - function isSharedArrayBuffer(object: unknown): object is SharedArrayBuffer; - /** - * Returns `true` if the value is a string object, e.g. created - * by `new String()`. - * - * ```js - * util.types.isStringObject('foo'); // Returns false - * util.types.isStringObject(new String('foo')); // Returns true - * ``` - * @since v10.0.0 - */ - function isStringObject(object: unknown): object is String; - /** - * Returns `true` if the value is a symbol object, created - * by calling `Object()` on a `Symbol` primitive. - * - * ```js - * const symbol = Symbol('foo'); - * util.types.isSymbolObject(symbol); // Returns false - * util.types.isSymbolObject(Object(symbol)); // Returns true - * ``` - * @since v10.0.0 - */ - function isSymbolObject(object: unknown): object is Symbol; - /** - * Returns `true` if the value is a built-in [`TypedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/TypedArray) instance. - * - * ```js - * util.types.isTypedArray(new ArrayBuffer()); // Returns false - * util.types.isTypedArray(new Uint8Array()); // Returns true - * util.types.isTypedArray(new Float64Array()); // Returns true - * ``` - * - * See also [`ArrayBuffer.isView()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer/isView). - * @since v10.0.0 - */ - function isTypedArray(object: unknown): object is NodeJS.TypedArray; - /** - * Returns `true` if the value is a built-in [`Uint8Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8Array) instance. - * - * ```js - * util.types.isUint8Array(new ArrayBuffer()); // Returns false - * util.types.isUint8Array(new Uint8Array()); // Returns true - * util.types.isUint8Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint8Array(object: unknown): object is Uint8Array; - /** - * Returns `true` if the value is a built-in [`Uint8ClampedArray`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint8ClampedArray) instance. - * - * ```js - * util.types.isUint8ClampedArray(new ArrayBuffer()); // Returns false - * util.types.isUint8ClampedArray(new Uint8ClampedArray()); // Returns true - * util.types.isUint8ClampedArray(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint8ClampedArray(object: unknown): object is Uint8ClampedArray; - /** - * Returns `true` if the value is a built-in [`Uint16Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint16Array) instance. - * - * ```js - * util.types.isUint16Array(new ArrayBuffer()); // Returns false - * util.types.isUint16Array(new Uint16Array()); // Returns true - * util.types.isUint16Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint16Array(object: unknown): object is Uint16Array; - /** - * Returns `true` if the value is a built-in [`Uint32Array`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Uint32Array) instance. - * - * ```js - * util.types.isUint32Array(new ArrayBuffer()); // Returns false - * util.types.isUint32Array(new Uint32Array()); // Returns true - * util.types.isUint32Array(new Float64Array()); // Returns false - * ``` - * @since v10.0.0 - */ - function isUint32Array(object: unknown): object is Uint32Array; - /** - * Returns `true` if the value is a built-in [`WeakMap`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakMap) instance. - * - * ```js - * util.types.isWeakMap(new WeakMap()); // Returns true - * ``` - * @since v10.0.0 - */ - function isWeakMap(object: unknown): object is WeakMap; - /** - * Returns `true` if the value is a built-in [`WeakSet`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WeakSet) instance. - * - * ```js - * util.types.isWeakSet(new WeakSet()); // Returns true - * ``` - * @since v10.0.0 - */ - function isWeakSet(object: unknown): object is WeakSet; - /** - * Returns `true` if `value` is a `KeyObject`, `false` otherwise. - * @since v16.2.0 - */ - function isKeyObject(object: unknown): object is KeyObject; - /** - * Returns `true` if `value` is a `CryptoKey`, `false` otherwise. - * @since v16.2.0 - */ - function isCryptoKey(object: unknown): object is webcrypto.CryptoKey; -} -declare module "node:util" { - export * from "util"; -} -declare module "node:util/types" { - export * from "util/types"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/v8.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/v8.d.ts deleted file mode 100644 index 6790e762..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/v8.d.ts +++ /dev/null @@ -1,635 +0,0 @@ -/** - * The `node:v8` module exposes APIs that are specific to the version of [V8](https://developers.google.com/v8/) built into the Node.js binary. It can be accessed using: - * - * ```js - * const v8 = require('node:v8'); - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/v8.js) - */ -declare module "v8" { - import { Readable } from "node:stream"; - interface HeapSpaceInfo { - space_name: string; - space_size: number; - space_used_size: number; - space_available_size: number; - physical_space_size: number; - } - // ** Signifies if the --zap_code_space option is enabled or not. 1 == enabled, 0 == disabled. */ - type DoesZapCodeSpaceFlag = 0 | 1; - interface HeapInfo { - total_heap_size: number; - total_heap_size_executable: number; - total_physical_size: number; - total_available_size: number; - used_heap_size: number; - heap_size_limit: number; - malloced_memory: number; - peak_malloced_memory: number; - does_zap_garbage: DoesZapCodeSpaceFlag; - number_of_native_contexts: number; - number_of_detached_contexts: number; - total_global_handles_size: number; - used_global_handles_size: number; - external_memory: number; - } - interface HeapCodeStatistics { - code_and_metadata_size: number; - bytecode_and_metadata_size: number; - external_script_source_size: number; - } - /** - * Returns an integer representing a version tag derived from the V8 version, - * command-line flags, and detected CPU features. This is useful for determining - * whether a `vm.Script` `cachedData` buffer is compatible with this instance - * of V8. - * - * ```js - * console.log(v8.cachedDataVersionTag()); // 3947234607 - * // The value returned by v8.cachedDataVersionTag() is derived from the V8 - * // version, command-line flags, and detected CPU features. Test that the value - * // does indeed update when flags are toggled. - * v8.setFlagsFromString('--allow_natives_syntax'); - * console.log(v8.cachedDataVersionTag()); // 183726201 - * ``` - * @since v8.0.0 - */ - function cachedDataVersionTag(): number; - /** - * Returns an object with the following properties: - * - * `does_zap_garbage` is a 0/1 boolean, which signifies whether the`--zap_code_space` option is enabled or not. This makes V8 overwrite heap - * garbage with a bit pattern. The RSS footprint (resident set size) gets bigger - * because it continuously touches all heap pages and that makes them less likely - * to get swapped out by the operating system. - * - * `number_of_native_contexts` The value of native\_context is the number of the - * top-level contexts currently active. Increase of this number over time indicates - * a memory leak. - * - * `number_of_detached_contexts` The value of detached\_context is the number - * of contexts that were detached and not yet garbage collected. This number - * being non-zero indicates a potential memory leak. - * - * `total_global_handles_size` The value of total\_global\_handles\_size is the - * total memory size of V8 global handles. - * - * `used_global_handles_size` The value of used\_global\_handles\_size is the - * used memory size of V8 global handles. - * - * `external_memory` The value of external\_memory is the memory size of array - * buffers and external strings. - * - * ```js - * { - * total_heap_size: 7326976, - * total_heap_size_executable: 4194304, - * total_physical_size: 7326976, - * total_available_size: 1152656, - * used_heap_size: 3476208, - * heap_size_limit: 1535115264, - * malloced_memory: 16384, - * peak_malloced_memory: 1127496, - * does_zap_garbage: 0, - * number_of_native_contexts: 1, - * number_of_detached_contexts: 0, - * total_global_handles_size: 8192, - * used_global_handles_size: 3296, - * external_memory: 318824 - * } - * ``` - * @since v1.0.0 - */ - function getHeapStatistics(): HeapInfo; - /** - * Returns statistics about the V8 heap spaces, i.e. the segments which make up - * the V8 heap. Neither the ordering of heap spaces, nor the availability of a - * heap space can be guaranteed as the statistics are provided via the - * V8[`GetHeapSpaceStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#ac673576f24fdc7a33378f8f57e1d13a4) function and may change from one V8 version to the - * next. - * - * The value returned is an array of objects containing the following properties: - * - * ```json - * [ - * { - * "space_name": "new_space", - * "space_size": 2063872, - * "space_used_size": 951112, - * "space_available_size": 80824, - * "physical_space_size": 2063872 - * }, - * { - * "space_name": "old_space", - * "space_size": 3090560, - * "space_used_size": 2493792, - * "space_available_size": 0, - * "physical_space_size": 3090560 - * }, - * { - * "space_name": "code_space", - * "space_size": 1260160, - * "space_used_size": 644256, - * "space_available_size": 960, - * "physical_space_size": 1260160 - * }, - * { - * "space_name": "map_space", - * "space_size": 1094160, - * "space_used_size": 201608, - * "space_available_size": 0, - * "physical_space_size": 1094160 - * }, - * { - * "space_name": "large_object_space", - * "space_size": 0, - * "space_used_size": 0, - * "space_available_size": 1490980608, - * "physical_space_size": 0 - * } - * ] - * ``` - * @since v6.0.0 - */ - function getHeapSpaceStatistics(): HeapSpaceInfo[]; - /** - * The `v8.setFlagsFromString()` method can be used to programmatically set - * V8 command-line flags. This method should be used with care. Changing settings - * after the VM has started may result in unpredictable behavior, including - * crashes and data loss; or it may simply do nothing. - * - * The V8 options available for a version of Node.js may be determined by running`node --v8-options`. - * - * Usage: - * - * ```js - * // Print GC events to stdout for one minute. - * const v8 = require('node:v8'); - * v8.setFlagsFromString('--trace_gc'); - * setTimeout(() => { v8.setFlagsFromString('--notrace_gc'); }, 60e3); - * ``` - * @since v1.0.0 - */ - function setFlagsFromString(flags: string): void; - /** - * Generates a snapshot of the current V8 heap and returns a Readable - * Stream that may be used to read the JSON serialized representation. - * This JSON stream format is intended to be used with tools such as - * Chrome DevTools. The JSON schema is undocumented and specific to the - * V8 engine. Therefore, the schema may change from one version of V8 to the next. - * - * Creating a heap snapshot requires memory about twice the size of the heap at - * the time the snapshot is created. This results in the risk of OOM killers - * terminating the process. - * - * Generating a snapshot is a synchronous operation which blocks the event loop - * for a duration depending on the heap size. - * - * ```js - * // Print heap snapshot to the console - * const v8 = require('node:v8'); - * const stream = v8.getHeapSnapshot(); - * stream.pipe(process.stdout); - * ``` - * @since v11.13.0 - * @return A Readable containing the V8 heap snapshot. - */ - function getHeapSnapshot(): Readable; - /** - * Generates a snapshot of the current V8 heap and writes it to a JSON - * file. This file is intended to be used with tools such as Chrome - * DevTools. The JSON schema is undocumented and specific to the V8 - * engine, and may change from one version of V8 to the next. - * - * A heap snapshot is specific to a single V8 isolate. When using `worker threads`, a heap snapshot generated from the main thread will - * not contain any information about the workers, and vice versa. - * - * Creating a heap snapshot requires memory about twice the size of the heap at - * the time the snapshot is created. This results in the risk of OOM killers - * terminating the process. - * - * Generating a snapshot is a synchronous operation which blocks the event loop - * for a duration depending on the heap size. - * - * ```js - * const { writeHeapSnapshot } = require('node:v8'); - * const { - * Worker, - * isMainThread, - * parentPort, - * } = require('node:worker_threads'); - * - * if (isMainThread) { - * const worker = new Worker(__filename); - * - * worker.once('message', (filename) => { - * console.log(`worker heapdump: ${filename}`); - * // Now get a heapdump for the main thread. - * console.log(`main thread heapdump: ${writeHeapSnapshot()}`); - * }); - * - * // Tell the worker to create a heapdump. - * worker.postMessage('heapdump'); - * } else { - * parentPort.once('message', (message) => { - * if (message === 'heapdump') { - * // Generate a heapdump for the worker - * // and return the filename to the parent. - * parentPort.postMessage(writeHeapSnapshot()); - * } - * }); - * } - * ``` - * @since v11.13.0 - * @param filename The file path where the V8 heap snapshot is to be saved. If not specified, a file name with the pattern `'Heap-${yyyymmdd}-${hhmmss}-${pid}-${thread_id}.heapsnapshot'` will be - * generated, where `{pid}` will be the PID of the Node.js process, `{thread_id}` will be `0` when `writeHeapSnapshot()` is called from the main Node.js thread or the id of a - * worker thread. - * @return The filename where the snapshot was saved. - */ - function writeHeapSnapshot(filename?: string): string; - /** - * Get statistics about code and its metadata in the heap, see - * V8[`GetHeapCodeAndMetadataStatistics`](https://v8docs.nodesource.com/node-13.2/d5/dda/classv8_1_1_isolate.html#a6079122af17612ef54ef3348ce170866) API. Returns an object with the - * following properties: - * - * ```js - * { - * code_and_metadata_size: 212208, - * bytecode_and_metadata_size: 161368, - * external_script_source_size: 1410794, - * cpu_profiler_metadata_size: 0, - * } - * ``` - * @since v12.8.0 - */ - function getHeapCodeStatistics(): HeapCodeStatistics; - /** - * @since v8.0.0 - */ - class Serializer { - /** - * Writes out a header, which includes the serialization format version. - */ - writeHeader(): void; - /** - * Serializes a JavaScript value and adds the serialized representation to the - * internal buffer. - * - * This throws an error if `value` cannot be serialized. - */ - writeValue(val: any): boolean; - /** - * Returns the stored internal buffer. This serializer should not be used once - * the buffer is released. Calling this method results in undefined behavior - * if a previous write has failed. - */ - releaseBuffer(): Buffer; - /** - * Marks an `ArrayBuffer` as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the deserializing context to `deserializer.transferArrayBuffer()`. - * @param id A 32-bit unsigned integer. - * @param arrayBuffer An `ArrayBuffer` instance. - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - /** - * Write a raw 32-bit unsigned integer. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeUint32(value: number): void; - /** - * Write a raw 64-bit unsigned integer, split into high and low 32-bit parts. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeUint64(hi: number, lo: number): void; - /** - * Write a JS `number` value. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeDouble(value: number): void; - /** - * Write raw bytes into the serializer's internal buffer. The deserializer - * will require a way to compute the length of the buffer. - * For use inside of a custom `serializer._writeHostObject()`. - */ - writeRawBytes(buffer: NodeJS.TypedArray): void; - } - /** - * A subclass of `Serializer` that serializes `TypedArray`(in particular `Buffer`) and `DataView` objects as host objects, and only - * stores the part of their underlying `ArrayBuffer`s that they are referring to. - * @since v8.0.0 - */ - class DefaultSerializer extends Serializer {} - /** - * @since v8.0.0 - */ - class Deserializer { - constructor(data: NodeJS.TypedArray); - /** - * Reads and validates a header (including the format version). - * May, for example, reject an invalid or unsupported wire format. In that case, - * an `Error` is thrown. - */ - readHeader(): boolean; - /** - * Deserializes a JavaScript value from the buffer and returns it. - */ - readValue(): any; - /** - * Marks an `ArrayBuffer` as having its contents transferred out of band. - * Pass the corresponding `ArrayBuffer` in the serializing context to `serializer.transferArrayBuffer()` (or return the `id` from `serializer._getSharedArrayBufferId()` in the case of - * `SharedArrayBuffer`s). - * @param id A 32-bit unsigned integer. - * @param arrayBuffer An `ArrayBuffer` instance. - */ - transferArrayBuffer(id: number, arrayBuffer: ArrayBuffer): void; - /** - * Reads the underlying wire format version. Likely mostly to be useful to - * legacy code reading old wire format versions. May not be called before`.readHeader()`. - */ - getWireFormatVersion(): number; - /** - * Read a raw 32-bit unsigned integer and return it. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readUint32(): number; - /** - * Read a raw 64-bit unsigned integer and return it as an array `[hi, lo]`with two 32-bit unsigned integer entries. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readUint64(): [number, number]; - /** - * Read a JS `number` value. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readDouble(): number; - /** - * Read raw bytes from the deserializer's internal buffer. The `length` parameter - * must correspond to the length of the buffer that was passed to `serializer.writeRawBytes()`. - * For use inside of a custom `deserializer._readHostObject()`. - */ - readRawBytes(length: number): Buffer; - } - /** - * A subclass of `Deserializer` corresponding to the format written by `DefaultSerializer`. - * @since v8.0.0 - */ - class DefaultDeserializer extends Deserializer {} - /** - * Uses a `DefaultSerializer` to serialize `value` into a buffer. - * - * `ERR_BUFFER_TOO_LARGE` will be thrown when trying to - * serialize a huge object which requires buffer - * larger than `buffer.constants.MAX_LENGTH`. - * @since v8.0.0 - */ - function serialize(value: any): Buffer; - /** - * Uses a `DefaultDeserializer` with default options to read a JS value - * from a buffer. - * @since v8.0.0 - * @param buffer A buffer returned by {@link serialize}. - */ - function deserialize(buffer: NodeJS.TypedArray): any; - /** - * The `v8.takeCoverage()` method allows the user to write the coverage started by `NODE_V8_COVERAGE` to disk on demand. This method can be invoked multiple - * times during the lifetime of the process. Each time the execution counter will - * be reset and a new coverage report will be written to the directory specified - * by `NODE_V8_COVERAGE`. - * - * When the process is about to exit, one last coverage will still be written to - * disk unless {@link stopCoverage} is invoked before the process exits. - * @since v15.1.0, v14.18.0, v12.22.0 - */ - function takeCoverage(): void; - /** - * The `v8.stopCoverage()` method allows the user to stop the coverage collection - * started by `NODE_V8_COVERAGE`, so that V8 can release the execution count - * records and optimize code. This can be used in conjunction with {@link takeCoverage} if the user wants to collect the coverage on demand. - * @since v15.1.0, v14.18.0, v12.22.0 - */ - function stopCoverage(): void; - /** - * This API collects GC data in current thread. - * @since v19.6.0, v18.15.0 - */ - class GCProfiler { - /** - * Start collecting GC data. - * @since v19.6.0, v18.15.0 - */ - start(): void; - /** - * Stop collecting GC data and return an object.The content of object - * is as follows. - * - * ```json - * { - * "version": 1, - * "startTime": 1674059033862, - * "statistics": [ - * { - * "gcType": "Scavenge", - * "beforeGC": { - * "heapStatistics": { - * "totalHeapSize": 5005312, - * "totalHeapSizeExecutable": 524288, - * "totalPhysicalSize": 5226496, - * "totalAvailableSize": 4341325216, - * "totalGlobalHandlesSize": 8192, - * "usedGlobalHandlesSize": 2112, - * "usedHeapSize": 4883840, - * "heapSizeLimit": 4345298944, - * "mallocedMemory": 254128, - * "externalMemory": 225138, - * "peakMallocedMemory": 181760 - * }, - * "heapSpaceStatistics": [ - * { - * "spaceName": "read_only_space", - * "spaceSize": 0, - * "spaceUsedSize": 0, - * "spaceAvailableSize": 0, - * "physicalSpaceSize": 0 - * } - * ] - * }, - * "cost": 1574.14, - * "afterGC": { - * "heapStatistics": { - * "totalHeapSize": 6053888, - * "totalHeapSizeExecutable": 524288, - * "totalPhysicalSize": 5500928, - * "totalAvailableSize": 4341101384, - * "totalGlobalHandlesSize": 8192, - * "usedGlobalHandlesSize": 2112, - * "usedHeapSize": 4059096, - * "heapSizeLimit": 4345298944, - * "mallocedMemory": 254128, - * "externalMemory": 225138, - * "peakMallocedMemory": 181760 - * }, - * "heapSpaceStatistics": [ - * { - * "spaceName": "read_only_space", - * "spaceSize": 0, - * "spaceUsedSize": 0, - * "spaceAvailableSize": 0, - * "physicalSpaceSize": 0 - * } - * ] - * } - * } - * ], - * "endTime": 1674059036865 - * } - * ``` - * - * Here's an example. - * - * ```js - * const { GCProfiler } = require('v8'); - * const profiler = new GCProfiler(); - * profiler.start(); - * setTimeout(() => { - * console.log(profiler.stop()); - * }, 1000); - * ``` - * @since v19.6.0, v18.15.0 - */ - stop(): GCProfilerResult; - } - interface GCProfilerResult { - version: number; - startTime: number; - endTime: number; - statistics: Array<{ - gcType: string; - cost: number; - beforeGC: { - heapStatistics: HeapStatistics; - heapSpaceStatistics: HeapSpaceStatistics[]; - }; - afterGC: { - heapStatistics: HeapStatistics; - heapSpaceStatistics: HeapSpaceStatistics[]; - }; - }>; - } - interface HeapStatistics { - totalHeapSize: number; - totalHeapSizeExecutable: number; - totalPhysicalSize: number; - totalAvailableSize: number; - totalGlobalHandlesSize: number; - usedGlobalHandlesSize: number; - usedHeapSize: number; - heapSizeLimit: number; - mallocedMemory: number; - externalMemory: number; - peakMallocedMemory: number; - } - interface HeapSpaceStatistics { - spaceName: string; - spaceSize: number; - spaceUsedSize: number; - spaceAvailableSize: number; - physicalSpaceSize: number; - } - /** - * Called when a promise is constructed. This does not mean that corresponding before/after events will occur, only that the possibility exists. This will - * happen if a promise is created without ever getting a continuation. - * @since v17.1.0, v16.14.0 - * @param promise The promise being created. - * @param parent The promise continued from, if applicable. - */ - interface Init { - (promise: Promise, parent: Promise): void; - } - /** - * Called before a promise continuation executes. This can be in the form of `then()`, `catch()`, or `finally()` handlers or an await resuming. - * - * The before callback will be called 0 to N times. The before callback will typically be called 0 times if no continuation was ever made for the promise. - * The before callback may be called many times in the case where many continuations have been made from the same promise. - * @since v17.1.0, v16.14.0 - */ - interface Before { - (promise: Promise): void; - } - /** - * Called immediately after a promise continuation executes. This may be after a `then()`, `catch()`, or `finally()` handler or before an await after another await. - * @since v17.1.0, v16.14.0 - */ - interface After { - (promise: Promise): void; - } - /** - * Called when the promise receives a resolution or rejection value. This may occur synchronously in the case of {@link Promise.resolve()} or - * {@link Promise.reject()}. - * @since v17.1.0, v16.14.0 - */ - interface Settled { - (promise: Promise): void; - } - /** - * Key events in the lifetime of a promise have been categorized into four areas: creation of a promise, before/after a continuation handler is called or - * around an await, and when the promise resolves or rejects. - * - * Because promises are asynchronous resources whose lifecycle is tracked via the promise hooks mechanism, the `init()`, `before()`, `after()`, and - * `settled()` callbacks must not be async functions as they create more promises which would produce an infinite loop. - * @since v17.1.0, v16.14.0 - */ - interface HookCallbacks { - init?: Init; - before?: Before; - after?: After; - settled?: Settled; - } - interface PromiseHooks { - /** - * The `init` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param init The {@link Init | `init` callback} to call when a promise is created. - * @return Call to stop the hook. - */ - onInit: (init: Init) => Function; - /** - * The `settled` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param settled The {@link Settled | `settled` callback} to call when a promise is created. - * @return Call to stop the hook. - */ - onSettled: (settled: Settled) => Function; - /** - * The `before` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param before The {@link Before | `before` callback} to call before a promise continuation executes. - * @return Call to stop the hook. - */ - onBefore: (before: Before) => Function; - /** - * The `after` hook must be a plain function. Providing an async function will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param after The {@link After | `after` callback} to call after a promise continuation executes. - * @return Call to stop the hook. - */ - onAfter: (after: After) => Function; - /** - * Registers functions to be called for different lifetime events of each promise. - * The callbacks `init()`/`before()`/`after()`/`settled()` are called for the respective events during a promise's lifetime. - * All callbacks are optional. For example, if only promise creation needs to be tracked, then only the init callback needs to be passed. - * The hook callbacks must be plain functions. Providing async functions will throw as it would produce an infinite microtask loop. - * @since v17.1.0, v16.14.0 - * @param callbacks The {@link HookCallbacks | Hook Callbacks} to register - * @return Used for disabling hooks - */ - createHook: (callbacks: HookCallbacks) => Function; - } - /** - * The `promiseHooks` interface can be used to track promise lifecycle events. - * @since v17.1.0, v16.14.0 - */ - const promiseHooks: PromiseHooks; -} -declare module "node:v8" { - export * from "v8"; -} diff --git a/reverse_engineering/node_modules/@types/node/ts4.8/vm.d.ts b/reverse_engineering/node_modules/@types/node/ts4.8/vm.d.ts deleted file mode 100644 index 3a310ccb..00000000 --- a/reverse_engineering/node_modules/@types/node/ts4.8/vm.d.ts +++ /dev/null @@ -1,903 +0,0 @@ -/** - * The `node:vm` module enables compiling and running code within V8 Virtual - * Machine contexts. - * - * **The `node:vm` module is not a security** - * **mechanism. Do not use it to run untrusted code.** - * - * JavaScript code can be compiled and run immediately or - * compiled, saved, and run later. - * - * A common use case is to run the code in a different V8 Context. This means - * invoked code has a different global object than the invoking code. - * - * One can provide the context by `contextifying` an - * object. The invoked code treats any property in the context like a - * global variable. Any changes to global variables caused by the invoked - * code are reflected in the context object. - * - * ```js - * const vm = require('node:vm'); - * - * const x = 1; - * - * const context = { x: 2 }; - * vm.createContext(context); // Contextify the object. - * - * const code = 'x += 40; var y = 17;'; - * // `x` and `y` are global variables in the context. - * // Initially, x has the value 2 because that is the value of context.x. - * vm.runInContext(code, context); - * - * console.log(context.x); // 42 - * console.log(context.y); // 17 - * - * console.log(x); // 1; y is not defined. - * ``` - * @see [source](https://github.com/nodejs/node/blob/v20.2.0/lib/vm.js) - */ -declare module "vm" { - import { ImportAttributes } from "node:module"; - interface Context extends NodeJS.Dict {} - interface BaseOptions { - /** - * Specifies the filename used in stack traces produced by this script. - * Default: `''`. - */ - filename?: string | undefined; - /** - * Specifies the line number offset that is displayed in stack traces produced by this script. - * Default: `0`. - */ - lineOffset?: number | undefined; - /** - * Specifies the column number offset that is displayed in stack traces produced by this script. - * @default 0 - */ - columnOffset?: number | undefined; - } - interface ScriptOptions extends BaseOptions { - /** - * V8's code cache data for the supplied source. - */ - cachedData?: Buffer | NodeJS.ArrayBufferView | undefined; - /** @deprecated in favor of `script.createCachedData()` */ - produceCachedData?: boolean | undefined; - /** - * Called during evaluation of this module when `import()` is called. - * If this option is not specified, calls to `import()` will reject with `ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`. - */ - importModuleDynamically?: - | ((specifier: string, script: Script, importAttributes: ImportAttributes) => Module) - | undefined; - } - interface RunningScriptOptions extends BaseOptions { - /** - * When `true`, if an `Error` occurs while compiling the `code`, the line of code causing the error is attached to the stack trace. - * Default: `true`. - */ - displayErrors?: boolean | undefined; - /** - * Specifies the number of milliseconds to execute code before terminating execution. - * If execution is terminated, an `Error` will be thrown. This value must be a strictly positive integer. - */ - timeout?: number | undefined; - /** - * If `true`, the execution will be terminated when `SIGINT` (Ctrl+C) is received. - * Existing handlers for the event that have been attached via `process.on('SIGINT')` will be disabled during script execution, but will continue to work after that. - * If execution is terminated, an `Error` will be thrown. - * Default: `false`. - */ - breakOnSigint?: boolean | undefined; - } - interface RunningScriptInNewContextOptions extends RunningScriptOptions { - /** - * Human-readable name of the newly created context. - */ - contextName?: CreateContextOptions["name"]; - /** - * Origin corresponding to the newly created context for display purposes. The origin should be formatted like a URL, - * but with only the scheme, host, and port (if necessary), like the value of the `url.origin` property of a `URL` object. - * Most notably, this string should omit the trailing slash, as that denotes a path. - */ - contextOrigin?: CreateContextOptions["origin"]; - contextCodeGeneration?: CreateContextOptions["codeGeneration"]; - /** - * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. - */ - microtaskMode?: CreateContextOptions["microtaskMode"]; - } - interface RunningCodeOptions extends RunningScriptOptions { - cachedData?: ScriptOptions["cachedData"]; - importModuleDynamically?: ScriptOptions["importModuleDynamically"]; - } - interface RunningCodeInNewContextOptions extends RunningScriptInNewContextOptions { - cachedData?: ScriptOptions["cachedData"]; - importModuleDynamically?: ScriptOptions["importModuleDynamically"]; - } - interface CompileFunctionOptions extends BaseOptions { - /** - * Provides an optional data with V8's code cache data for the supplied source. - */ - cachedData?: Buffer | undefined; - /** - * Specifies whether to produce new cache data. - * Default: `false`, - */ - produceCachedData?: boolean | undefined; - /** - * The sandbox/context in which the said function should be compiled in. - */ - parsingContext?: Context | undefined; - /** - * An array containing a collection of context extensions (objects wrapping the current scope) to be applied while compiling - */ - contextExtensions?: Object[] | undefined; - } - interface CreateContextOptions { - /** - * Human-readable name of the newly created context. - * @default 'VM Context i' Where i is an ascending numerical index of the created context. - */ - name?: string | undefined; - /** - * Corresponds to the newly created context for display purposes. - * The origin should be formatted like a `URL`, but with only the scheme, host, and port (if necessary), - * like the value of the `url.origin` property of a URL object. - * Most notably, this string should omit the trailing slash, as that denotes a path. - * @default '' - */ - origin?: string | undefined; - codeGeneration?: - | { - /** - * If set to false any calls to eval or function constructors (Function, GeneratorFunction, etc) - * will throw an EvalError. - * @default true - */ - strings?: boolean | undefined; - /** - * If set to false any attempt to compile a WebAssembly module will throw a WebAssembly.CompileError. - * @default true - */ - wasm?: boolean | undefined; - } - | undefined; - /** - * If set to `afterEvaluate`, microtasks will be run immediately after the script has run. - */ - microtaskMode?: "afterEvaluate" | undefined; - } - type MeasureMemoryMode = "summary" | "detailed"; - interface MeasureMemoryOptions { - /** - * @default 'summary' - */ - mode?: MeasureMemoryMode | undefined; - /** - * @default 'default' - */ - execution?: "default" | "eager" | undefined; - } - interface MemoryMeasurement { - total: { - jsMemoryEstimate: number; - jsMemoryRange: [number, number]; - }; - } - /** - * Instances of the `vm.Script` class contain precompiled scripts that can be - * executed in specific contexts. - * @since v0.3.1 - */ - class Script { - constructor(code: string, options?: ScriptOptions | string); - /** - * Runs the compiled code contained by the `vm.Script` object within the given`contextifiedObject` and returns the result. Running code does not have access - * to local scope. - * - * The following example compiles code that increments a global variable, sets - * the value of another global variable, then execute the code multiple times. - * The globals are contained in the `context` object. - * - * ```js - * const vm = require('node:vm'); - * - * const context = { - * animal: 'cat', - * count: 2, - * }; - * - * const script = new vm.Script('count += 1; name = "kitty";'); - * - * vm.createContext(context); - * for (let i = 0; i < 10; ++i) { - * script.runInContext(context); - * } - * - * console.log(context); - * // Prints: { animal: 'cat', count: 12, name: 'kitty' } - * ``` - * - * Using the `timeout` or `breakOnSigint` options will result in new event loops - * and corresponding threads being started, which have a non-zero performance - * overhead. - * @since v0.3.1 - * @param contextifiedObject A `contextified` object as returned by the `vm.createContext()` method. - * @return the result of the very last statement executed in the script. - */ - runInContext(contextifiedObject: Context, options?: RunningScriptOptions): any; - /** - * First contextifies the given `contextObject`, runs the compiled code contained - * by the `vm.Script` object within the created context, and returns the result. - * Running code does not have access to local scope. - * - * The following example compiles code that sets a global variable, then executes - * the code multiple times in different contexts. The globals are set on and - * contained within each individual `context`. - * - * ```js - * const vm = require('node:vm'); - * - * const script = new vm.Script('globalVar = "set"'); - * - * const contexts = [{}, {}, {}]; - * contexts.forEach((context) => { - * script.runInNewContext(context); - * }); - * - * console.log(contexts); - * // Prints: [{ globalVar: 'set' }, { globalVar: 'set' }, { globalVar: 'set' }] - * ``` - * @since v0.3.1 - * @param contextObject An object that will be `contextified`. If `undefined`, a new object will be created. - * @return the result of the very last statement executed in the script. - */ - runInNewContext(contextObject?: Context, options?: RunningScriptInNewContextOptions): any; - /** - * Runs the compiled code contained by the `vm.Script` within the context of the - * current `global` object. Running code does not have access to local scope, but _does_ have access to the current `global` object. - * - * The following example compiles code that increments a `global` variable then - * executes that code multiple times: - * - * ```js - * const vm = require('node:vm'); - * - * global.globalVar = 0; - * - * const script = new vm.Script('globalVar += 1', { filename: 'myfile.vm' }); - * - * for (let i = 0; i < 1000; ++i) { - * script.runInThisContext(); - * } - * - * console.log(globalVar); - * - * // 1000 - * ``` - * @since v0.3.1 - * @return the result of the very last statement executed in the script. - */ - runInThisContext(options?: RunningScriptOptions): any; - /** - * Creates a code cache that can be used with the `Script` constructor's`cachedData` option. Returns a `Buffer`. This method may be called at any - * time and any number of times. - * - * The code cache of the `Script` doesn't contain any JavaScript observable - * states. The code cache is safe to be saved along side the script source and - * used to construct new `Script` instances multiple times. - * - * Functions in the `Script` source can be marked as lazily compiled and they are - * not compiled at construction of the `Script`. These functions are going to be - * compiled when they are invoked the first time. The code cache serializes the - * metadata that V8 currently knows about the `Script` that it can use to speed up - * future compilations. - * - * ```js - * const script = new vm.Script(` - * function add(a, b) { - * return a + b; - * } - * - * const x = add(1, 2); - * `); - * - * const cacheWithoutAdd = script.createCachedData(); - * // In `cacheWithoutAdd` the function `add()` is marked for full compilation - * // upon invocation. - * - * script.runInThisContext(); - * - * const cacheWithAdd = script.createCachedData(); - * // `cacheWithAdd` contains fully compiled function `add()`. - * ``` - * @since v10.6.0 - */ - createCachedData(): Buffer; - /** @deprecated in favor of `script.createCachedData()` */ - cachedDataProduced?: boolean | undefined; - /** - * When `cachedData` is supplied to create the `vm.Script`, this value will be set - * to either `true` or `false` depending on acceptance of the data by V8\. - * Otherwise the value is `undefined`. - * @since v5.7.0 - */ - cachedDataRejected?: boolean | undefined; - cachedData?: Buffer | undefined; - /** - * When the script is compiled from a source that contains a source map magic - * comment, this property will be set to the URL of the source map. - * - * ```js - * import vm from 'node:vm'; - * - * const script = new vm.Script(` - * function myFunc() {} - * //# sourceMappingURL=sourcemap.json - * `); - * - * console.log(script.sourceMapURL); - * // Prints: sourcemap.json - * ``` - * @since v19.1.0, v18.13.0 - */ - sourceMapURL?: string | undefined; - } - /** - * If given a `contextObject`, the `vm.createContext()` method will `prepare - * that object` so that it can be used in calls to {@link runInContext} or `script.runInContext()`. Inside such scripts, - * the `contextObject` will be the global object, retaining all of its existing - * properties but also having the built-in objects and functions any standard [global object](https://es5.github.io/#x15.1) has. Outside of scripts run by the vm module, global variables - * will remain unchanged. - * - * ```js - * const vm = require('node:vm'); - * - * global.globalVar = 3; - * - * const context = { globalVar: 1 }; - * vm.createContext(context); - * - * vm.runInContext('globalVar *= 2;', context); - * - * console.log(context); - * // Prints: { globalVar: 2 } - * - * console.log(global.globalVar); - * // Prints: 3 - * ``` - * - * If `contextObject` is omitted (or passed explicitly as `undefined`), a new, - * empty `contextified` object will be returned. - * - * The `vm.createContext()` method is primarily useful for creating a single - * context that can be used to run multiple scripts. For instance, if emulating a - * web browser, the method can be used to create a single context representing a - * window's global object, then run all ` -``` - -### unpkg CDN - -To use it via [unpkg](https://unpkg.com/#/) include this in your html: - -```html - -``` - -### Development Requirements - -The core JavaScript has the following requirements to build and test: - -* Building a browser bundle: - * Node.js - * npm -* Testing - * Node.js - * npm - * Chrome, Firefox, Safari (optional) - -Some special networking features can optionally use a Flash component. See the -[Flash README](./flash/README.md) for details. - -### Building for a web browser - -To create single file bundles for use with browsers run the following: - - npm install - npm run build - -This will create single non-minimized and minimized files that can be -included in the browser: - - dist/forge.js - dist/forge.min.js - -A bundle that adds some utilities and networking support is also available: - - dist/forge.all.js - dist/forge.all.min.js - -Include the file via: - -```html - -``` -or -```html - -``` - -The above bundles will synchronously create a global 'forge' object. - -**Note**: These bundles will not include any WebWorker scripts (eg: -`dist/prime.worker.js`), so these will need to be accessible from the browser -if any WebWorkers are used. - -### Building a custom browser bundle - -The build process uses [webpack][] and the [config](./webpack.config.js) file -can be modified to generate a file or files that only contain the parts of -forge you need. - -[Browserify][] override support is also present in `package.json`. - -Testing -------- - -### Prepare to run tests - - npm install - -### Running automated tests with Node.js - -Forge natively runs in a [Node.js][] environment: - - npm test - -### Running automated tests with Headless Chrome - -Automated testing is done via [Karma][]. By default it will run the tests with -Headless Chrome. - - npm run test-karma - -Is 'mocha' reporter output too verbose? Other reporters are available. Try -'dots', 'progress', or 'tap'. - - npm run test-karma -- --reporters progress - -By default [webpack][] is used. [Browserify][] can also be used. - - BUNDLER=browserify npm run test-karma - -### Running automated tests with one or more browsers - -You can also specify one or more browsers to use. - - npm run test-karma -- --browsers Chrome,Firefox,Safari,ChromeHeadless - -The reporter option and `BUNDLER` environment variable can also be used. - -### Running manual tests in a browser - -Testing in a browser uses [webpack][] to combine forge and all tests and then -loading the result in a browser. A simple web server is provided that will -output the HTTP or HTTPS URLs to load. It also will start a simple Flash Policy -Server. Unit tests and older legacy tests are provided. Custom ports can be -used by running `node tests/server.js` manually. - -To run the unit tests in a browser a special forge build is required: - - npm run test-build - -To run legacy browser based tests the main forge build is required: - - npm run build - -The tests are run with a custom server that prints out the URLs to use: - - npm run test-server - -### Running other tests - -There are some other random tests and benchmarks available in the tests -directory. - -### Coverage testing - -To perform coverage testing of the unit tests, run the following. The results -will be put in the `coverage/` directory. Note that coverage testing can slow -down some tests considerably. - - npm install - npm run coverage - -Contributing ------------- - -Any contributions (eg: PRs) that are accepted will be brought under the same -license used by the rest of the Forge project. This license allows Forge to -be used under the terms of either the BSD License or the GNU General Public -License (GPL) Version 2. - -See: [LICENSE](https://github.com/digitalbazaar/forge/blob/cbebca3780658703d925b61b2caffb1d263a6c1d/LICENSE) - -If a contribution contains 3rd party source code with its own license, it -may retain it, so long as that license is compatible with the Forge license. - -API ---- - - - -### Options - -If at any time you wish to disable the use of native code, where available, -for particular forge features like its secure random number generator, you -may set the ```forge.options.usePureJavaScript``` flag to ```true```. It is -not recommended that you set this flag as native code is typically more -performant and may have stronger security properties. It may be useful to -set this flag to test certain features that you plan to run in environments -that are different from your testing environment. - -To disable native code when including forge in the browser: - -```js -// run this *after* including the forge script -forge.options.usePureJavaScript = true; -``` - -To disable native code when using Node.js: - -```js -var forge = require('node-forge'); -forge.options.usePureJavaScript = true; -``` - -Transports ----------- - - - -### TLS - -Provides a native javascript client and server-side [TLS][] implementation. - -__Examples__ - -```js -// create TLS client -var client = forge.tls.createConnection({ - server: false, - caStore: /* Array of PEM-formatted certs or a CA store object */, - sessionCache: {}, - // supported cipher suites in order of preference - cipherSuites: [ - forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, - forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], - virtualHost: 'example.com', - verify: function(connection, verified, depth, certs) { - if(depth === 0) { - var cn = certs[0].subject.getField('CN').value; - if(cn !== 'example.com') { - verified = { - alert: forge.tls.Alert.Description.bad_certificate, - message: 'Certificate common name does not match hostname.' - }; - } - } - return verified; - }, - connected: function(connection) { - console.log('connected'); - // send message to server - connection.prepare(forge.util.encodeUtf8('Hi server!')); - /* NOTE: experimental, start heartbeat retransmission timer - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000);*/ - }, - /* provide a client-side cert if you want - getCertificate: function(connection, hint) { - return myClientCertificate; - }, - /* the private key for the client-side cert if provided */ - getPrivateKey: function(connection, cert) { - return myClientPrivateKey; - }, - tlsDataReady: function(connection) { - // TLS data (encrypted) is ready to be sent to the server - sendToServerSomehow(connection.tlsData.getBytes()); - // if you were communicating with the server below, you'd do: - // server.process(connection.tlsData.getBytes()); - }, - dataReady: function(connection) { - // clear data from the server is ready - console.log('the server sent: ' + - forge.util.decodeUtf8(connection.data.getBytes())); - // close connection - connection.close(); - }, - /* NOTE: experimental - heartbeatReceived: function(connection, payload) { - // restart retransmission timer, look at payload - clearInterval(myHeartbeatTimer); - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000); - payload.getBytes(); - },*/ - closed: function(connection) { - console.log('disconnected'); - }, - error: function(connection, error) { - console.log('uh oh', error); - } -}); - -// start the handshake process -client.handshake(); - -// when encrypted TLS data is received from the server, process it -client.process(encryptedBytesFromServer); - -// create TLS server -var server = forge.tls.createConnection({ - server: true, - caStore: /* Array of PEM-formatted certs or a CA store object */, - sessionCache: {}, - // supported cipher suites in order of preference - cipherSuites: [ - forge.tls.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA, - forge.tls.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA], - // require a client-side certificate if you want - verifyClient: true, - verify: function(connection, verified, depth, certs) { - if(depth === 0) { - var cn = certs[0].subject.getField('CN').value; - if(cn !== 'the-client') { - verified = { - alert: forge.tls.Alert.Description.bad_certificate, - message: 'Certificate common name does not match expected client.' - }; - } - } - return verified; - }, - connected: function(connection) { - console.log('connected'); - // send message to client - connection.prepare(forge.util.encodeUtf8('Hi client!')); - /* NOTE: experimental, start heartbeat retransmission timer - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000);*/ - }, - getCertificate: function(connection, hint) { - return myServerCertificate; - }, - getPrivateKey: function(connection, cert) { - return myServerPrivateKey; - }, - tlsDataReady: function(connection) { - // TLS data (encrypted) is ready to be sent to the client - sendToClientSomehow(connection.tlsData.getBytes()); - // if you were communicating with the client above you'd do: - // client.process(connection.tlsData.getBytes()); - }, - dataReady: function(connection) { - // clear data from the client is ready - console.log('the client sent: ' + - forge.util.decodeUtf8(connection.data.getBytes())); - // close connection - connection.close(); - }, - /* NOTE: experimental - heartbeatReceived: function(connection, payload) { - // restart retransmission timer, look at payload - clearInterval(myHeartbeatTimer); - myHeartbeatTimer = setInterval(function() { - connection.prepareHeartbeatRequest(forge.util.createBuffer('1234')); - }, 5*60*1000); - payload.getBytes(); - },*/ - closed: function(connection) { - console.log('disconnected'); - }, - error: function(connection, error) { - console.log('uh oh', error); - } -}); - -// when encrypted TLS data is received from the client, process it -server.process(encryptedBytesFromClient); -``` - -Connect to a TLS server using node's net.Socket: - -```js -var socket = new net.Socket(); - -var client = forge.tls.createConnection({ - server: false, - verify: function(connection, verified, depth, certs) { - // skip verification for testing - console.log('[tls] server certificate verified'); - return true; - }, - connected: function(connection) { - console.log('[tls] connected'); - // prepare some data to send (note that the string is interpreted as - // 'binary' encoded, which works for HTTP which only uses ASCII, use - // forge.util.encodeUtf8(str) otherwise - client.prepare('GET / HTTP/1.0\r\n\r\n'); - }, - tlsDataReady: function(connection) { - // encrypted data is ready to be sent to the server - var data = connection.tlsData.getBytes(); - socket.write(data, 'binary'); // encoding should be 'binary' - }, - dataReady: function(connection) { - // clear data from the server is ready - var data = connection.data.getBytes(); - console.log('[tls] data received from the server: ' + data); - }, - closed: function() { - console.log('[tls] disconnected'); - }, - error: function(connection, error) { - console.log('[tls] error', error); - } -}); - -socket.on('connect', function() { - console.log('[socket] connected'); - client.handshake(); -}); -socket.on('data', function(data) { - client.process(data.toString('binary')); // encoding should be 'binary' -}); -socket.on('end', function() { - console.log('[socket] disconnected'); -}); - -// connect to google.com -socket.connect(443, 'google.com'); - -// or connect to gmail's imap server (but don't send the HTTP header above) -//socket.connect(993, 'imap.gmail.com'); -``` - - - -### HTTP - -Provides a native [JavaScript][] mini-implementation of an http client that -uses pooled sockets. - -__Examples__ - -```js -// create an HTTP GET request -var request = forge.http.createRequest({method: 'GET', path: url.path}); - -// send the request somewhere -sendSomehow(request.toString()); - -// receive response -var buffer = forge.util.createBuffer(); -var response = forge.http.createResponse(); -var someAsyncDataHandler = function(bytes) { - if(!response.bodyReceived) { - buffer.putBytes(bytes); - if(!response.headerReceived) { - if(response.readHeader(buffer)) { - console.log('HTTP response header: ' + response.toString()); - } - } - if(response.headerReceived && !response.bodyReceived) { - if(response.readBody(buffer)) { - console.log('HTTP response body: ' + response.body); - } - } - } -}; -``` - - - -### SSH - -Provides some SSH utility functions. - -__Examples__ - -```js -// encodes (and optionally encrypts) a private RSA key as a Putty PPK file -forge.ssh.privateKeyToPutty(privateKey, passphrase, comment); - -// encodes a public RSA key as an OpenSSH file -forge.ssh.publicKeyToOpenSSH(key, comment); - -// encodes a private RSA key as an OpenSSH file -forge.ssh.privateKeyToOpenSSH(privateKey, passphrase); - -// gets the SSH public key fingerprint in a byte buffer -forge.ssh.getPublicKeyFingerprint(key); - -// gets a hex-encoded, colon-delimited SSH public key fingerprint -forge.ssh.getPublicKeyFingerprint(key, {encoding: 'hex', delimiter: ':'}); -``` - - - -### XHR - -Provides an XmlHttpRequest implementation using forge.http as a backend. - -__Examples__ - -```js -// TODO -``` - - - -### Sockets - -Provides an interface to create and use raw sockets provided via Flash. - -__Examples__ - -```js -// TODO -``` - -Ciphers -------- - - - -### CIPHER - -Provides a basic API for block encryption and decryption. There is built-in -support for the ciphers: [AES][], [3DES][], and [DES][], and for the modes -of operation: [ECB][], [CBC][], [CFB][], [OFB][], [CTR][], and [GCM][]. - -These algorithms are currently supported: - -* AES-ECB -* AES-CBC -* AES-CFB -* AES-OFB -* AES-CTR -* AES-GCM -* 3DES-ECB -* 3DES-CBC -* DES-ECB -* DES-CBC - -When using an [AES][] algorithm, the key size will determine whether -AES-128, AES-192, or AES-256 is used (all are supported). When a [DES][] -algorithm is used, the key size will determine whether [3DES][] or regular -[DES][] is used. Use a [3DES][] algorithm to enforce Triple-DES. - -__Examples__ - -```js -// generate a random key and IV -// Note: a key size of 16 bytes will use AES-128, 24 => AES-192, 32 => AES-256 -var key = forge.random.getBytesSync(16); -var iv = forge.random.getBytesSync(16); - -/* alternatively, generate a password-based 16-byte key -var salt = forge.random.getBytesSync(128); -var key = forge.pkcs5.pbkdf2('password', salt, numIterations, 16); -*/ - -// encrypt some bytes using CBC mode -// (other modes include: ECB, CFB, OFB, CTR, and GCM) -// Note: CBC and ECB modes use PKCS#7 padding as default -var cipher = forge.cipher.createCipher('AES-CBC', key); -cipher.start({iv: iv}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -// outputs encrypted hex -console.log(encrypted.toHex()); - -// decrypt some bytes using CBC mode -// (other modes include: CFB, OFB, CTR, and GCM) -var decipher = forge.cipher.createDecipher('AES-CBC', key); -decipher.start({iv: iv}); -decipher.update(encrypted); -var result = decipher.finish(); // check 'result' for true/false -// outputs decrypted hex -console.log(decipher.output.toHex()); - -// decrypt bytes using CBC mode and streaming -// Performance can suffer for large multi-MB inputs due to buffer -// manipulations. Stream processing in chunks can offer significant -// improvement. CPU intensive update() calls could also be performed with -// setImmediate/setTimeout to avoid blocking the main browser UI thread (not -// shown here). Optimal block size depends on the JavaScript VM and other -// factors. Encryption can use a simple technique for increased performance. -var encryptedBytes = encrypted.bytes(); -var decipher = forge.cipher.createDecipher('AES-CBC', key); -decipher.start({iv: iv}); -var length = encryptedBytes.length; -var chunkSize = 1024 * 64; -var index = 0; -var decrypted = ''; -do { - decrypted += decipher.output.getBytes(); - var buf = forge.util.createBuffer(encryptedBytes.substr(index, chunkSize)); - decipher.update(buf); - index += chunkSize; -} while(index < length); -var result = decipher.finish(); -assert(result); -decrypted += decipher.output.getBytes(); -console.log(forge.util.bytesToHex(decrypted)); - -// encrypt some bytes using GCM mode -var cipher = forge.cipher.createCipher('AES-GCM', key); -cipher.start({ - iv: iv, // should be a 12-byte binary-encoded string or byte buffer - additionalData: 'binary-encoded string', // optional - tagLength: 128 // optional, defaults to 128 bits -}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -var tag = cipher.mode.tag; -// outputs encrypted hex -console.log(encrypted.toHex()); -// outputs authentication tag -console.log(tag.toHex()); - -// decrypt some bytes using GCM mode -var decipher = forge.cipher.createDecipher('AES-GCM', key); -decipher.start({ - iv: iv, - additionalData: 'binary-encoded string', // optional - tagLength: 128, // optional, defaults to 128 bits - tag: tag // authentication tag from encryption -}); -decipher.update(encrypted); -var pass = decipher.finish(); -// pass is false if there was a failure (eg: authentication tag didn't match) -if(pass) { - // outputs decrypted hex - console.log(decipher.output.toHex()); -} -``` - -Using forge in Node.js to match openssl's "enc" command line tool (**Note**: OpenSSL "enc" uses a non-standard file format with a custom key derivation function and a fixed iteration count of 1, which some consider less secure than alternatives such as [OpenPGP](https://tools.ietf.org/html/rfc4880)/[GnuPG](https://www.gnupg.org/)): - -```js -var forge = require('node-forge'); -var fs = require('fs'); - -// openssl enc -des3 -in input.txt -out input.enc -function encrypt(password) { - var input = fs.readFileSync('input.txt', {encoding: 'binary'}); - - // 3DES key and IV sizes - var keySize = 24; - var ivSize = 8; - - // get derived bytes - // Notes: - // 1. If using an alternative hash (eg: "-md sha1") pass - // "forge.md.sha1.create()" as the final parameter. - // 2. If using "-nosalt", set salt to null. - var salt = forge.random.getBytesSync(8); - // var md = forge.md.sha1.create(); // "-md sha1" - var derivedBytes = forge.pbe.opensslDeriveBytes( - password, salt, keySize + ivSize/*, md*/); - var buffer = forge.util.createBuffer(derivedBytes); - var key = buffer.getBytes(keySize); - var iv = buffer.getBytes(ivSize); - - var cipher = forge.cipher.createCipher('3DES-CBC', key); - cipher.start({iv: iv}); - cipher.update(forge.util.createBuffer(input, 'binary')); - cipher.finish(); - - var output = forge.util.createBuffer(); - - // if using a salt, prepend this to the output: - if(salt !== null) { - output.putBytes('Salted__'); // (add to match openssl tool output) - output.putBytes(salt); - } - output.putBuffer(cipher.output); - - fs.writeFileSync('input.enc', output.getBytes(), {encoding: 'binary'}); -} - -// openssl enc -d -des3 -in input.enc -out input.dec.txt -function decrypt(password) { - var input = fs.readFileSync('input.enc', {encoding: 'binary'}); - - // parse salt from input - input = forge.util.createBuffer(input, 'binary'); - // skip "Salted__" (if known to be present) - input.getBytes('Salted__'.length); - // read 8-byte salt - var salt = input.getBytes(8); - - // Note: if using "-nosalt", skip above parsing and use - // var salt = null; - - // 3DES key and IV sizes - var keySize = 24; - var ivSize = 8; - - var derivedBytes = forge.pbe.opensslDeriveBytes( - password, salt, keySize + ivSize); - var buffer = forge.util.createBuffer(derivedBytes); - var key = buffer.getBytes(keySize); - var iv = buffer.getBytes(ivSize); - - var decipher = forge.cipher.createDecipher('3DES-CBC', key); - decipher.start({iv: iv}); - decipher.update(input); - var result = decipher.finish(); // check 'result' for true/false - - fs.writeFileSync( - 'input.dec.txt', decipher.output.getBytes(), {encoding: 'binary'}); -} -``` - - - -### AES - -Provides [AES][] encryption and decryption in [CBC][], [CFB][], [OFB][], -[CTR][], and [GCM][] modes. See [CIPHER](#cipher) for examples. - - - -### DES - -Provides [3DES][] and [DES][] encryption and decryption in [ECB][] and -[CBC][] modes. See [CIPHER](#cipher) for examples. - - - -### RC2 - -__Examples__ - -```js -// generate a random key and IV -var key = forge.random.getBytesSync(16); -var iv = forge.random.getBytesSync(8); - -// encrypt some bytes -var cipher = forge.rc2.createEncryptionCipher(key); -cipher.start(iv); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output; -// outputs encrypted hex -console.log(encrypted.toHex()); - -// decrypt some bytes -var cipher = forge.rc2.createDecryptionCipher(key); -cipher.start(iv); -cipher.update(encrypted); -cipher.finish(); -// outputs decrypted hex -console.log(cipher.output.toHex()); -``` - -PKI ---- - -Provides [X.509][] certificate support, ED25519 key generation and -signing/verifying, and RSA public and private key encoding, decoding, -encryption/decryption, and signing/verifying. - - - -### ED25519 - -Special thanks to [TweetNaCl.js][] for providing the bulk of the implementation. - -__Examples__ - -```js -var ed25519 = forge.pki.ed25519; - -// generate a random ED25519 keypair -var keypair = ed25519.generateKeyPair(); -// `keypair.publicKey` is a node.js Buffer or Uint8Array -// `keypair.privateKey` is a node.js Buffer or Uint8Array - -// generate a random ED25519 keypair based on a random 32-byte seed -var seed = forge.random.getBytesSync(32); -var keypair = ed25519.generateKeyPair({seed: seed}); - -// generate a random ED25519 keypair based on a "password" 32-byte seed -var password = 'Mai9ohgh6ahxee0jutheew0pungoozil'; -var seed = new forge.util.ByteBuffer(password, 'utf8'); -var keypair = ed25519.generateKeyPair({seed: seed}); - -// sign a UTF-8 message -var signature = ED25519.sign({ - message: 'test', - // also accepts `binary` if you want to pass a binary string - encoding: 'utf8', - // node.js Buffer, Uint8Array, forge ByteBuffer, binary string - privateKey: privateKey -}); -// `signature` is a node.js Buffer or Uint8Array - -// sign a message passed as a buffer -var signature = ED25519.sign({ - // also accepts a forge ByteBuffer or Uint8Array - message: Buffer.from('test', 'utf8'), - privateKey: privateKey -}); - -// sign a message digest (shorter "message" == better performance) -var md = forge.md.sha256.create(); -md.update('test', 'utf8'); -var signature = ED25519.sign({ - md: md, - privateKey: privateKey -}); - -// verify a signature on a UTF-8 message -var verified = ED25519.verify({ - message: 'test', - encoding: 'utf8', - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); -// `verified` is true/false - -// sign a message passed as a buffer -var verified = ED25519.verify({ - // also accepts a forge ByteBuffer or Uint8Array - message: Buffer.from('test', 'utf8'), - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); - -// verify a signature on a message digest -var md = forge.md.sha256.create(); -md.update('test', 'utf8'); -var verified = ED25519.verify({ - md: md, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - signature: signature, - // node.js Buffer, Uint8Array, forge ByteBuffer, or binary string - publicKey: publicKey -}); -``` - - - -### RSA - -__Examples__ - -```js -var rsa = forge.pki.rsa; - -// generate an RSA key pair synchronously -// *NOT RECOMMENDED*: Can be significantly slower than async and may block -// JavaScript execution. Will use native Node.js 10.12.0+ API if possible. -var keypair = rsa.generateKeyPair({bits: 2048, e: 0x10001}); - -// generate an RSA key pair asynchronously (uses web workers if available) -// use workers: -1 to run a fast core estimator to optimize # of workers -// *RECOMMENDED*: Can be significantly faster than sync. Will use native -// Node.js 10.12.0+ or WebCrypto API if possible. -rsa.generateKeyPair({bits: 2048, workers: 2}, function(err, keypair) { - // keypair.privateKey, keypair.publicKey -}); - -// generate an RSA key pair in steps that attempt to run for a specified period -// of time on the main JS thread -var state = rsa.createKeyPairGenerationState(2048, 0x10001); -var step = function() { - // run for 100 ms - if(!rsa.stepKeyPairGenerationState(state, 100)) { - setTimeout(step, 1); - } - else { - // done, turn off progress indicator, use state.keys - } -}; -// turn on progress indicator, schedule generation to run -setTimeout(step); - -// sign data with a private key and output DigestInfo DER-encoded bytes -// (defaults to RSASSA PKCS#1 v1.5) -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -var signature = privateKey.sign(md); - -// verify data with a public key -// (defaults to RSASSA PKCS#1 v1.5) -var verified = publicKey.verify(md.digest().bytes(), signature); - -// sign data using RSASSA-PSS where PSS uses a SHA-1 hash, a SHA-1 based -// masking function MGF1, and a 20 byte salt -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -var pss = forge.pss.create({ - md: forge.md.sha1.create(), - mgf: forge.mgf.mgf1.create(forge.md.sha1.create()), - saltLength: 20 - // optionally pass 'prng' with a custom PRNG implementation - // optionalls pass 'salt' with a forge.util.ByteBuffer w/custom salt -}); -var signature = privateKey.sign(md, pss); - -// verify RSASSA-PSS signature -var pss = forge.pss.create({ - md: forge.md.sha1.create(), - mgf: forge.mgf.mgf1.create(forge.md.sha1.create()), - saltLength: 20 - // optionally pass 'prng' with a custom PRNG implementation -}); -var md = forge.md.sha1.create(); -md.update('sign this', 'utf8'); -publicKey.verify(md.digest().getBytes(), signature, pss); - -// encrypt data with a public key (defaults to RSAES PKCS#1 v1.5) -var encrypted = publicKey.encrypt(bytes); - -// decrypt data with a private key (defaults to RSAES PKCS#1 v1.5) -var decrypted = privateKey.decrypt(encrypted); - -// encrypt data with a public key using RSAES PKCS#1 v1.5 -var encrypted = publicKey.encrypt(bytes, 'RSAES-PKCS1-V1_5'); - -// decrypt data with a private key using RSAES PKCS#1 v1.5 -var decrypted = privateKey.decrypt(encrypted, 'RSAES-PKCS1-V1_5'); - -// encrypt data with a public key using RSAES-OAEP -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP'); - -// decrypt data with a private key using RSAES-OAEP -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP'); - -// encrypt data with a public key using RSAES-OAEP/SHA-256 -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP', { - md: forge.md.sha256.create() -}); - -// decrypt data with a private key using RSAES-OAEP/SHA-256 -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP', { - md: forge.md.sha256.create() -}); - -// encrypt data with a public key using RSAES-OAEP/SHA-256/MGF1-SHA-1 -// compatible with Java's RSA/ECB/OAEPWithSHA-256AndMGF1Padding -var encrypted = publicKey.encrypt(bytes, 'RSA-OAEP', { - md: forge.md.sha256.create(), - mgf1: { - md: forge.md.sha1.create() - } -}); - -// decrypt data with a private key using RSAES-OAEP/SHA-256/MGF1-SHA-1 -// compatible with Java's RSA/ECB/OAEPWithSHA-256AndMGF1Padding -var decrypted = privateKey.decrypt(encrypted, 'RSA-OAEP', { - md: forge.md.sha256.create(), - mgf1: { - md: forge.md.sha1.create() - } -}); - -``` - - - -### RSA-KEM - -__Examples__ - -```js -// generate an RSA key pair asynchronously (uses web workers if available) -// use workers: -1 to run a fast core estimator to optimize # of workers -forge.rsa.generateKeyPair({bits: 2048, workers: -1}, function(err, keypair) { - // keypair.privateKey, keypair.publicKey -}); - -// generate and encapsulate a 16-byte secret key -var kdf1 = new forge.kem.kdf1(forge.md.sha1.create()); -var kem = forge.kem.rsa.create(kdf1); -var result = kem.encrypt(keypair.publicKey, 16); -// result has 'encapsulation' and 'key' - -// encrypt some bytes -var iv = forge.random.getBytesSync(12); -var someBytes = 'hello world!'; -var cipher = forge.cipher.createCipher('AES-GCM', result.key); -cipher.start({iv: iv}); -cipher.update(forge.util.createBuffer(someBytes)); -cipher.finish(); -var encrypted = cipher.output.getBytes(); -var tag = cipher.mode.tag.getBytes(); - -// send 'encrypted', 'iv', 'tag', and result.encapsulation to recipient - -// decrypt encapsulated 16-byte secret key -var kdf1 = new forge.kem.kdf1(forge.md.sha1.create()); -var kem = forge.kem.rsa.create(kdf1); -var key = kem.decrypt(keypair.privateKey, result.encapsulation, 16); - -// decrypt some bytes -var decipher = forge.cipher.createDecipher('AES-GCM', key); -decipher.start({iv: iv, tag: tag}); -decipher.update(forge.util.createBuffer(encrypted)); -var pass = decipher.finish(); -// pass is false if there was a failure (eg: authentication tag didn't match) -if(pass) { - // outputs 'hello world!' - console.log(decipher.output.getBytes()); -} - -``` - - - -### X.509 - -__Examples__ - -```js -var pki = forge.pki; - -// convert a PEM-formatted public key to a Forge public key -var publicKey = pki.publicKeyFromPem(pem); - -// convert a Forge public key to PEM-format -var pem = pki.publicKeyToPem(publicKey); - -// convert an ASN.1 SubjectPublicKeyInfo to a Forge public key -var publicKey = pki.publicKeyFromAsn1(subjectPublicKeyInfo); - -// convert a Forge public key to an ASN.1 SubjectPublicKeyInfo -var subjectPublicKeyInfo = pki.publicKeyToAsn1(publicKey); - -// gets a SHA-1 RSAPublicKey fingerprint a byte buffer -pki.getPublicKeyFingerprint(key); - -// gets a SHA-1 SubjectPublicKeyInfo fingerprint a byte buffer -pki.getPublicKeyFingerprint(key, {type: 'SubjectPublicKeyInfo'}); - -// gets a hex-encoded, colon-delimited SHA-1 RSAPublicKey public key fingerprint -pki.getPublicKeyFingerprint(key, {encoding: 'hex', delimiter: ':'}); - -// gets a hex-encoded, colon-delimited SHA-1 SubjectPublicKeyInfo public key fingerprint -pki.getPublicKeyFingerprint(key, { - type: 'SubjectPublicKeyInfo', - encoding: 'hex', - delimiter: ':' -}); - -// gets a hex-encoded, colon-delimited MD5 RSAPublicKey public key fingerprint -pki.getPublicKeyFingerprint(key, { - md: forge.md.md5.create(), - encoding: 'hex', - delimiter: ':' -}); - -// creates a CA store -var caStore = pki.createCaStore([/* PEM-encoded cert */, ...]); - -// add a certificate to the CA store -caStore.addCertificate(certObjectOrPemString); - -// gets the issuer (its certificate) for the given certificate -var issuerCert = caStore.getIssuer(subjectCert); - -// verifies a certificate chain against a CA store -pki.verifyCertificateChain(caStore, chain, customVerifyCallback); - -// signs a certificate using the given private key -cert.sign(privateKey); - -// signs a certificate using SHA-256 instead of SHA-1 -cert.sign(privateKey, forge.md.sha256.create()); - -// verifies an issued certificate using the certificates public key -var verified = issuer.verify(issued); - -// generate a keypair and create an X.509v3 certificate -var keys = pki.rsa.generateKeyPair(2048); -var cert = pki.createCertificate(); -cert.publicKey = keys.publicKey; -// alternatively set public key from a csr -//cert.publicKey = csr.publicKey; -// NOTE: serialNumber is the hex encoded value of an ASN.1 INTEGER. -// Conforming CAs should ensure serialNumber is: -// - no more than 20 octets -// - non-negative (prefix a '00' if your value starts with a '1' bit) -cert.serialNumber = '01'; -cert.validity.notBefore = new Date(); -cert.validity.notAfter = new Date(); -cert.validity.notAfter.setFullYear(cert.validity.notBefore.getFullYear() + 1); -var attrs = [{ - name: 'commonName', - value: 'example.org' -}, { - name: 'countryName', - value: 'US' -}, { - shortName: 'ST', - value: 'Virginia' -}, { - name: 'localityName', - value: 'Blacksburg' -}, { - name: 'organizationName', - value: 'Test' -}, { - shortName: 'OU', - value: 'Test' -}]; -cert.setSubject(attrs); -// alternatively set subject from a csr -//cert.setSubject(csr.subject.attributes); -cert.setIssuer(attrs); -cert.setExtensions([{ - name: 'basicConstraints', - cA: true -}, { - name: 'keyUsage', - keyCertSign: true, - digitalSignature: true, - nonRepudiation: true, - keyEncipherment: true, - dataEncipherment: true -}, { - name: 'extKeyUsage', - serverAuth: true, - clientAuth: true, - codeSigning: true, - emailProtection: true, - timeStamping: true -}, { - name: 'nsCertType', - client: true, - server: true, - email: true, - objsign: true, - sslCA: true, - emailCA: true, - objCA: true -}, { - name: 'subjectAltName', - altNames: [{ - type: 6, // URI - value: 'http://example.org/webid#me' - }, { - type: 7, // IP - ip: '127.0.0.1' - }] -}, { - name: 'subjectKeyIdentifier' -}]); -/* alternatively set extensions from a csr -var extensions = csr.getAttribute({name: 'extensionRequest'}).extensions; -// optionally add more extensions -extensions.push.apply(extensions, [{ - name: 'basicConstraints', - cA: true -}, { - name: 'keyUsage', - keyCertSign: true, - digitalSignature: true, - nonRepudiation: true, - keyEncipherment: true, - dataEncipherment: true -}]); -cert.setExtensions(extensions); -*/ -// self-sign certificate -cert.sign(keys.privateKey); - -// convert a Forge certificate to PEM -var pem = pki.certificateToPem(cert); - -// convert a Forge certificate from PEM -var cert = pki.certificateFromPem(pem); - -// convert an ASN.1 X.509x3 object to a Forge certificate -var cert = pki.certificateFromAsn1(obj); - -// convert a Forge certificate to an ASN.1 X.509v3 object -var asn1Cert = pki.certificateToAsn1(cert); -``` - - - -### PKCS#5 - -Provides the password-based key-derivation function from [PKCS#5][]. - -__Examples__ - -```js -// generate a password-based 16-byte key -// note an optional message digest can be passed as the final parameter -var salt = forge.random.getBytesSync(128); -var derivedKey = forge.pkcs5.pbkdf2('password', salt, numIterations, 16); - -// generate key asynchronously -// note an optional message digest can be passed before the callback -forge.pkcs5.pbkdf2('password', salt, numIterations, 16, function(err, derivedKey) { - // do something w/derivedKey -}); -``` - - - -### PKCS#7 - -Provides cryptographically protected messages from [PKCS#7][]. - -__Examples__ - -```js -// convert a message from PEM -var p7 = forge.pkcs7.messageFromPem(pem); -// look at p7.recipients - -// find a recipient by the issuer of a certificate -var recipient = p7.findRecipient(cert); - -// decrypt -p7.decrypt(p7.recipients[0], privateKey); - -// create a p7 enveloped message -var p7 = forge.pkcs7.createEnvelopedData(); - -// add a recipient -var cert = forge.pki.certificateFromPem(certPem); -p7.addRecipient(cert); - -// set content -p7.content = forge.util.createBuffer('Hello'); - -// encrypt -p7.encrypt(); - -// convert message to PEM -var pem = forge.pkcs7.messageToPem(p7); - -// create a degenerate PKCS#7 certificate container -// (CRLs not currently supported, only certificates) -var p7 = forge.pkcs7.createSignedData(); -p7.addCertificate(certOrCertPem1); -p7.addCertificate(certOrCertPem2); -var pem = forge.pkcs7.messageToPem(p7); - -// create PKCS#7 signed data with authenticatedAttributes -// attributes include: PKCS#9 content-type, message-digest, and signing-time -var p7 = forge.pkcs7.createSignedData(); -p7.content = forge.util.createBuffer('Some content to be signed.', 'utf8'); -p7.addCertificate(certOrCertPem); -p7.addSigner({ - key: privateKeyAssociatedWithCert, - certificate: certOrCertPem, - digestAlgorithm: forge.pki.oids.sha256, - authenticatedAttributes: [{ - type: forge.pki.oids.contentType, - value: forge.pki.oids.data - }, { - type: forge.pki.oids.messageDigest - // value will be auto-populated at signing time - }, { - type: forge.pki.oids.signingTime, - // value can also be auto-populated at signing time - value: new Date() - }] -}); -p7.sign(); -var pem = forge.pkcs7.messageToPem(p7); - -// PKCS#7 Sign in detached mode. -// Includes the signature and certificate without the signed data. -p7.sign({detached: true}); - -``` - - - -### PKCS#8 - -__Examples__ - -```js -var pki = forge.pki; - -// convert a PEM-formatted private key to a Forge private key -var privateKey = pki.privateKeyFromPem(pem); - -// convert a Forge private key to PEM-format -var pem = pki.privateKeyToPem(privateKey); - -// convert an ASN.1 PrivateKeyInfo or RSAPrivateKey to a Forge private key -var privateKey = pki.privateKeyFromAsn1(rsaPrivateKey); - -// convert a Forge private key to an ASN.1 RSAPrivateKey -var rsaPrivateKey = pki.privateKeyToAsn1(privateKey); - -// wrap an RSAPrivateKey ASN.1 object in a PKCS#8 ASN.1 PrivateKeyInfo -var privateKeyInfo = pki.wrapRsaPrivateKey(rsaPrivateKey); - -// convert a PKCS#8 ASN.1 PrivateKeyInfo to PEM -var pem = pki.privateKeyInfoToPem(privateKeyInfo); - -// encrypts a PrivateKeyInfo using a custom password and -// outputs an EncryptedPrivateKeyInfo -var encryptedPrivateKeyInfo = pki.encryptPrivateKeyInfo( - privateKeyInfo, 'myCustomPasswordHere', { - algorithm: 'aes256', // 'aes128', 'aes192', 'aes256', '3des' - }); - -// decrypts an ASN.1 EncryptedPrivateKeyInfo that was encrypted -// with a custom password -var privateKeyInfo = pki.decryptPrivateKeyInfo( - encryptedPrivateKeyInfo, 'myCustomPasswordHere'); - -// converts an EncryptedPrivateKeyInfo to PEM -var pem = pki.encryptedPrivateKeyToPem(encryptedPrivateKeyInfo); - -// converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format -var encryptedPrivateKeyInfo = pki.encryptedPrivateKeyFromPem(pem); - -// wraps and encrypts a Forge private key and outputs it in PEM format -var pem = pki.encryptRsaPrivateKey(privateKey, 'password'); - -// encrypts a Forge private key and outputs it in PEM format using OpenSSL's -// proprietary legacy format + encapsulated PEM headers (DEK-Info) -var pem = pki.encryptRsaPrivateKey(privateKey, 'password', {legacy: true}); - -// decrypts a PEM-formatted, encrypted private key -var privateKey = pki.decryptRsaPrivateKey(pem, 'password'); - -// sets an RSA public key from a private key -var publicKey = pki.setRsaPublicKey(privateKey.n, privateKey.e); -``` - - - -### PKCS#10 - -Provides certification requests or certificate signing requests (CSR) from -[PKCS#10][]. - -__Examples__ - -```js -// generate a key pair -var keys = forge.pki.rsa.generateKeyPair(1024); - -// create a certification request (CSR) -var csr = forge.pki.createCertificationRequest(); -csr.publicKey = keys.publicKey; -csr.setSubject([{ - name: 'commonName', - value: 'example.org' -}, { - name: 'countryName', - value: 'US' -}, { - shortName: 'ST', - value: 'Virginia' -}, { - name: 'localityName', - value: 'Blacksburg' -}, { - name: 'organizationName', - value: 'Test' -}, { - shortName: 'OU', - value: 'Test' -}]); -// set (optional) attributes -csr.setAttributes([{ - name: 'challengePassword', - value: 'password' -}, { - name: 'unstructuredName', - value: 'My Company, Inc.' -}, { - name: 'extensionRequest', - extensions: [{ - name: 'subjectAltName', - altNames: [{ - // 2 is DNS type - type: 2, - value: 'test.domain.com' - }, { - type: 2, - value: 'other.domain.com', - }, { - type: 2, - value: 'www.domain.net' - }] - }] -}]); - -// sign certification request -csr.sign(keys.privateKey); - -// verify certification request -var verified = csr.verify(); - -// convert certification request to PEM-format -var pem = forge.pki.certificationRequestToPem(csr); - -// convert a Forge certification request from PEM-format -var csr = forge.pki.certificationRequestFromPem(pem); - -// get an attribute -csr.getAttribute({name: 'challengePassword'}); - -// get extensions array -csr.getAttribute({name: 'extensionRequest'}).extensions; - -``` - - - -### PKCS#12 - -Provides the cryptographic archive file format from [PKCS#12][]. - -**Note for Chrome/Firefox/iOS/similar users**: If you have trouble importing -a PKCS#12 container, try using the TripleDES algorithm. It can be passed -to `forge.pkcs12.toPkcs12Asn1` using the `{algorithm: '3des'}` option. - -__Examples__ - -```js -// decode p12 from base64 -var p12Der = forge.util.decode64(p12b64); -// get p12 as ASN.1 object -var p12Asn1 = forge.asn1.fromDer(p12Der); -// decrypt p12 using the password 'password' -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, 'password'); -// decrypt p12 using non-strict parsing mode (resolves some ASN.1 parse errors) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, false, 'password'); -// decrypt p12 using literally no password (eg: Mac OS X/apple push) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1); -// decrypt p12 using an "empty" password (eg: OpenSSL with no password input) -var p12 = forge.pkcs12.pkcs12FromAsn1(p12Asn1, ''); -// p12.safeContents is an array of safe contents, each of -// which contains an array of safeBags - -// get bags by friendlyName -var bags = p12.getBags({friendlyName: 'test'}); -// bags are key'd by attribute type (here "friendlyName") -// and the key values are an array of matching objects -var cert = bags.friendlyName[0]; - -// get bags by localKeyId -var bags = p12.getBags({localKeyId: buffer}); -// bags are key'd by attribute type (here "localKeyId") -// and the key values are an array of matching objects -var cert = bags.localKeyId[0]; - -// get bags by localKeyId (input in hex) -var bags = p12.getBags({localKeyIdHex: '7b59377ff142d0be4565e9ac3d396c01401cd879'}); -// bags are key'd by attribute type (here "localKeyId", *not* "localKeyIdHex") -// and the key values are an array of matching objects -var cert = bags.localKeyId[0]; - -// get bags by type -var bags = p12.getBags({bagType: forge.pki.oids.certBag}); -// bags are key'd by bagType and each bagType key's value -// is an array of matches (in this case, certificate objects) -var cert = bags[forge.pki.oids.certBag][0]; - -// get bags by friendlyName and filter on bag type -var bags = p12.getBags({ - friendlyName: 'test', - bagType: forge.pki.oids.certBag -}); - -// get key bags -var bags = p12.getBags({bagType: forge.pki.oids.keyBag}); -// get key -var bag = bags[forge.pki.oids.keyBag][0]; -var key = bag.key; -// if the key is in a format unrecognized by forge then -// bag.key will be `null`, use bag.asn1 to get the ASN.1 -// representation of the key -if(bag.key === null) { - var keyAsn1 = bag.asn1; - // can now convert back to DER/PEM/etc for export -} - -// generate a p12 using AES (default) -var p12Asn1 = forge.pkcs12.toPkcs12Asn1( - privateKey, certificateChain, 'password'); - -// generate a p12 that can be imported by Chrome/Firefox/iOS -// (requires the use of Triple DES instead of AES) -var p12Asn1 = forge.pkcs12.toPkcs12Asn1( - privateKey, certificateChain, 'password', - {algorithm: '3des'}); - -// base64-encode p12 -var p12Der = forge.asn1.toDer(p12Asn1).getBytes(); -var p12b64 = forge.util.encode64(p12Der); - -// create download link for p12 -var a = document.createElement('a'); -a.download = 'example.p12'; -a.setAttribute('href', 'data:application/x-pkcs12;base64,' + p12b64); -a.appendChild(document.createTextNode('Download')); -``` - - - -### ASN.1 - -Provides [ASN.1][] DER encoding and decoding. - -__Examples__ - -```js -var asn1 = forge.asn1; - -// create a SubjectPublicKeyInfo -var subjectPublicKeyInfo = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids['rsaEncryption']).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // subjectPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [ - // RSAPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)) - ]) - ]) - ]); - -// serialize an ASN.1 object to DER format -var derBuffer = asn1.toDer(subjectPublicKeyInfo); - -// deserialize to an ASN.1 object from a byte buffer filled with DER data -var object = asn1.fromDer(derBuffer); - -// convert an OID dot-separated string to a byte buffer -var derOidBuffer = asn1.oidToDer('1.2.840.113549.1.1.5'); - -// convert a byte buffer with a DER-encoded OID to a dot-separated string -console.log(asn1.derToOid(derOidBuffer)); -// output: 1.2.840.113549.1.1.5 - -// validates that an ASN.1 object matches a particular ASN.1 structure and -// captures data of interest from that structure for easy access -var publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - }] -}; - -var capture = {}; -var errors = []; -if(!asn1.validate( - publicKeyValidator, subjectPublicKeyInfo, validator, capture, errors)) { - throw 'ASN.1 object is not a SubjectPublicKeyInfo.'; -} -// capture.subjectPublicKeyInfo contains the full ASN.1 object -// capture.rsaPublicKey contains the full ASN.1 object for the RSA public key -// capture.publicKeyOid only contains the value for the OID -var oid = asn1.derToOid(capture.publicKeyOid); -if(oid !== pki.oids['rsaEncryption']) { - throw 'Unsupported OID.'; -} - -// pretty print an ASN.1 object to a string for debugging purposes -asn1.prettyPrint(object); -``` - -Message Digests ----------------- - - - -### SHA1 - -Provides [SHA-1][] message digests. - -__Examples__ - -```js -var md = forge.md.sha1.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 2fd4e1c67a2d28fced849ee1bb76e7391b93eb12 -``` - - - -### SHA256 - -Provides [SHA-256][] message digests. - -__Examples__ - -```js -var md = forge.md.sha256.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592 -``` - - - -### SHA384 - -Provides [SHA-384][] message digests. - -__Examples__ - -```js -var md = forge.md.sha384.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: ca737f1014a48f4c0b6dd43cb177b0afd9e5169367544c494011e3317dbf9a509cb1e5dc1e85a941bbee3d7f2afbc9b1 -``` - - - -### SHA512 - -Provides [SHA-512][] message digests. - -__Examples__ - -```js -// SHA-512 -var md = forge.md.sha512.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 07e547d9586f6a73f73fbac0435ed76951218fb7d0c8d788a309d785436bbb642e93a252a954f23912547d1e8a3b5ed6e1bfd7097821233fa0538f3db854fee6 - -// SHA-512/224 -var md = forge.md.sha512.sha224.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 944cd2847fb54558d4775db0485a50003111c8e5daa63fe722c6aa37 - -// SHA-512/256 -var md = forge.md.sha512.sha256.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: dd9d67b371519c339ed8dbd25af90e976a1eeefd4ad3d889005e532fc5bef04d -``` - - - -### MD5 - -Provides [MD5][] message digests. - -__Examples__ - -```js -var md = forge.md.md5.create(); -md.update('The quick brown fox jumps over the lazy dog'); -console.log(md.digest().toHex()); -// output: 9e107d9d372bb6826bd81d3542a419d6 -``` - - - -### HMAC - -Provides [HMAC][] w/any supported message digest algorithm. - -__Examples__ - -```js -var hmac = forge.hmac.create(); -hmac.start('sha1', 'Jefe'); -hmac.update('what do ya want for nothing?'); -console.log(hmac.digest().toHex()); -// output: effcdf6ae5eb2fa2d27416d5f184df9c259a7c79 -``` - -Utilities ---------- - - - -### Prime - -Provides an API for generating large, random, probable primes. - -__Examples__ - -```js -// generate a random prime on the main JS thread -var bits = 1024; -forge.prime.generateProbablePrime(bits, function(err, num) { - console.log('random prime', num.toString(16)); -}); - -// generate a random prime using Web Workers (if available, otherwise -// falls back to the main thread) -var bits = 1024; -var options = { - algorithm: { - name: 'PRIMEINC', - workers: -1 // auto-optimize # of workers - } -}; -forge.prime.generateProbablePrime(bits, options, function(err, num) { - console.log('random prime', num.toString(16)); -}); -``` - - - -### PRNG - -Provides a [Fortuna][]-based cryptographically-secure pseudo-random number -generator, to be used with a cryptographic function backend, e.g. [AES][]. An -implementation using [AES][] as a backend is provided. An API for collecting -entropy is given, though if window.crypto.getRandomValues is available, it will -be used automatically. - -__Examples__ - -```js -// get some random bytes synchronously -var bytes = forge.random.getBytesSync(32); -console.log(forge.util.bytesToHex(bytes)); - -// get some random bytes asynchronously -forge.random.getBytes(32, function(err, bytes) { - console.log(forge.util.bytesToHex(bytes)); -}); - -// collect some entropy if you'd like -forge.random.collect(someRandomBytes); -jQuery().mousemove(function(e) { - forge.random.collectInt(e.clientX, 16); - forge.random.collectInt(e.clientY, 16); -}); - -// specify a seed file for use with the synchronous API if you'd like -forge.random.seedFileSync = function(needed) { - // get 'needed' number of random bytes from somewhere - return fetchedRandomBytes; -}; - -// specify a seed file for use with the asynchronous API if you'd like -forge.random.seedFile = function(needed, callback) { - // get the 'needed' number of random bytes from somewhere - callback(null, fetchedRandomBytes); -}); - -// register the main thread to send entropy or a Web Worker to receive -// entropy on demand from the main thread -forge.random.registerWorker(self); - -// generate a new instance of a PRNG with no collected entropy -var myPrng = forge.random.createInstance(); -``` - - - -### Tasks - -Provides queuing and synchronizing tasks in a web application. - -__Examples__ - -```js -// TODO -``` - - - -### Utilities - -Provides utility functions, including byte buffer support, base64, -bytes to/from hex, zlib inflate/deflate, etc. - -__Examples__ - -```js -// encode/decode base64 -var encoded = forge.util.encode64(str); -var str = forge.util.decode64(encoded); - -// encode/decode UTF-8 -var encoded = forge.util.encodeUtf8(str); -var str = forge.util.decodeUtf8(encoded); - -// bytes to/from hex -var bytes = forge.util.hexToBytes(hex); -var hex = forge.util.bytesToHex(bytes); - -// create an empty byte buffer -var buffer = forge.util.createBuffer(); -// create a byte buffer from raw binary bytes -var buffer = forge.util.createBuffer(input, 'raw'); -// create a byte buffer from utf8 bytes -var buffer = forge.util.createBuffer(input, 'utf8'); - -// get the length of the buffer in bytes -buffer.length(); -// put bytes into the buffer -buffer.putBytes(bytes); -// put a 32-bit integer into the buffer -buffer.putInt32(10); -// buffer to hex -buffer.toHex(); -// get a copy of the bytes in the buffer -bytes.bytes(/* count */); -// empty this buffer and get its contents -bytes.getBytes(/* count */); - -// convert a forge buffer into a Node.js Buffer -// make sure you specify the encoding as 'binary' -var forgeBuffer = forge.util.createBuffer(); -var nodeBuffer = Buffer.from(forgeBuffer.getBytes(), 'binary'); - -// convert a Node.js Buffer into a forge buffer -// make sure you specify the encoding as 'binary' -var nodeBuffer = Buffer.from('CAFE', 'hex'); -var forgeBuffer = forge.util.createBuffer(nodeBuffer.toString('binary')); - -// parse a URL -var parsed = forge.util.parseUrl('http://example.com/foo?bar=baz'); -// parsed.scheme, parsed.host, parsed.port, parsed.path, parsed.fullHost -``` - - - -### Logging - -Provides logging to a javascript console using various categories and -levels of verbosity. - -__Examples__ - -```js -// TODO -``` - - - -### Debugging - -Provides storage of debugging information normally inaccessible in -closures for viewing/investigation. - -__Examples__ - -```js -// TODO -``` - - - -### Flash Networking Support - -The [flash README](./flash/README.md) provides details on rebuilding the -optional Flash component used for networking. It also provides details on -Policy Server support. - -Security Considerations ------------------------ - -When using this code please keep the following in mind: - -- Cryptography is hard. Please review and test this code before depending on it - for critical functionality. -- The nature of JavaScript is that execution of this code depends on trusting a - very large set of JavaScript tools and systems. Consider runtime variations, - runtime characteristics, runtime optimization, code optimization, code - minimization, code obfuscation, bundling tools, possible bugs, the Forge code - itself, and so on. -- If using pre-built bundles from [Bower][] or similar be aware someone else - ran the tools to create those files. -- Use a secure transport channel such as [TLS][] to load scripts and consider - using additional security mechanisms such as [Subresource Integrity][] script - attributes. -- Use "native" functionality where possible. This can be critical when dealing - with performance and random number generation. Note that the JavaScript - random number algorithms should perform well if given suitable entropy. -- Understand possible attacks against cryptographic systems. For instance side - channel and timing attacks may be possible due to the difficulty in - implementing constant time algorithms in pure JavaScript. -- Certain features in this library are less susceptible to attacks depending on - usage. This primarily includes features that deal with data format - manipulation or those that are not involved in communication. - -Library Background ------------------- - -* https://digitalbazaar.com/2010/07/20/javascript-tls-1/ -* https://digitalbazaar.com/2010/07/20/javascript-tls-2/ - -Contact -------- - -* Code: https://github.com/digitalbazaar/forge -* Bugs: https://github.com/digitalbazaar/forge/issues -* Email: support@digitalbazaar.com -* IRC: [#forgejs][] on [freenode][] - -Donations ---------- - -Financial support is welcome and helps contribute to futher development: - -* For [PayPal][] please send to paypal@digitalbazaar.com. -* Something else? Please contact support@digitalbazaar.com. - -[#forgejs]: https://webchat.freenode.net/?channels=#forgejs -[0.6.x]: https://github.com/digitalbazaar/forge/tree/0.6.x -[3DES]: https://en.wikipedia.org/wiki/Triple_DES -[AES]: https://en.wikipedia.org/wiki/Advanced_Encryption_Standard -[ASN.1]: https://en.wikipedia.org/wiki/ASN.1 -[Bower]: https://bower.io/ -[Browserify]: http://browserify.org/ -[CBC]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CTR]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[CommonJS]: https://en.wikipedia.org/wiki/CommonJS -[DES]: https://en.wikipedia.org/wiki/Data_Encryption_Standard -[ECB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[Fortuna]: https://en.wikipedia.org/wiki/Fortuna_(PRNG) -[GCM]: https://en.wikipedia.org/wiki/GCM_mode -[HMAC]: https://en.wikipedia.org/wiki/HMAC -[JavaScript]: https://en.wikipedia.org/wiki/JavaScript -[Karma]: https://karma-runner.github.io/ -[MD5]: https://en.wikipedia.org/wiki/MD5 -[Node.js]: https://nodejs.org/ -[OFB]: https://en.wikipedia.org/wiki/Block_cipher_mode_of_operation -[PKCS#10]: https://en.wikipedia.org/wiki/Certificate_signing_request -[PKCS#12]: https://en.wikipedia.org/wiki/PKCS_%E2%99%AF12 -[PKCS#5]: https://en.wikipedia.org/wiki/PKCS -[PKCS#7]: https://en.wikipedia.org/wiki/Cryptographic_Message_Syntax -[PayPal]: https://www.paypal.com/ -[RC2]: https://en.wikipedia.org/wiki/RC2 -[SHA-1]: https://en.wikipedia.org/wiki/SHA-1 -[SHA-256]: https://en.wikipedia.org/wiki/SHA-256 -[SHA-384]: https://en.wikipedia.org/wiki/SHA-384 -[SHA-512]: https://en.wikipedia.org/wiki/SHA-512 -[Subresource Integrity]: https://www.w3.org/TR/SRI/ -[TLS]: https://en.wikipedia.org/wiki/Transport_Layer_Security -[UMD]: https://github.com/umdjs/umd -[X.509]: https://en.wikipedia.org/wiki/X.509 -[freenode]: https://freenode.net/ -[unpkg]: https://unpkg.com/ -[webpack]: https://webpack.github.io/ -[TweetNaCl.js]: https://github.com/dchest/tweetnacl-js diff --git a/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js b/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js deleted file mode 100644 index 340fb127..00000000 --- a/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(window,(function(){return function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}return r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=36)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t){var n=r(0),a=r(40),i=e.exports=n.util=n.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(i.isArrayBuffer(e)||i.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&a.setAttribute("a",n=!n))}}i.nextTick=i.setImmediate}(),i.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,i.globalScope=i.isNodejs?t:"undefined"==typeof self?window:self,i.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},i.isArrayBufferView=function(e){return e&&i.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},i.ByteBuffer=o,i.ByteStringBuffer=o;i.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},i.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},i.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},i.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(i.encodeUtf8(e))},i.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},i.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},i.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},i.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var e=i.createBuffer(this.data);return e.read=this.read,e},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+t);return n.set(r),this.data=new DataView(n.buffer),this},i.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},i.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},i.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},i.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},i.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},i.xorBytes=function(e,t,r){for(var n="",a="",i="",s=0,o=0;r>0;--r,++s)a=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(n+=i,i="",o=0),i+=String.fromCharCode(a),++o;return n+=i},i.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(e,t){for(var r,n,a,i="",s="",o=0;o>2),i+=c.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=c.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":c.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,n,a,i="",s=0;s>4),64!==n&&(i+=String.fromCharCode((15&r)<<4|n>>2),64!==a&&(i+=String.fromCharCode((3&n)<<6|a)));return i},i.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},i.decodeUtf8=function(e){return decodeURIComponent(escape(e))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},i.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},i.binary.raw.decode=function(e,t,r){var n=t;n||(n=new Uint8Array(e.length));for(var a=r=r||0,i=0;i>2),i+=c.charAt((3&r)<<4|n>>4),isNaN(n)?i+="==":(i+=c.charAt((15&n)<<2|a>>6),i+=isNaN(a)?"=":c.charAt(63&a)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.binary.base64.decode=function(e,t,r){var n,a,i,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,l=r=r||0;c>4,64!==i&&(o[l++]=(15&a)<<4|i>>2,64!==s&&(o[l++]=(3&i)<<6|s));return t?l-r:o.subarray(0,l)},i.binary.base58.encode=function(e,t){return i.binary.baseN.encode(e,l,t)},i.binary.base58.decode=function(e,t){return i.binary.baseN.decode(e,l,t)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(e,t,r){e=i.encodeUtf8(e);var n=t;n||(n=new Uint8Array(e.length));for(var a=r=r||0,s=0;s0?(a=r[n].substring(0,s),i=r[n].substring(s+1)):(a=r[n],i=null),a in t||(t[a]=[]),a in Object.prototype||null===i||t[a].push(unescape(i))}return t};return void 0===e?(null===m&&(m="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=m):t=r(e),t},i.parseFragment=function(e){var t=e,r="",n=e.indexOf("?");n>0&&(t=e.substring(0,n),r=e.substring(n+1));var a=t.split("/");return a.length>0&&""===a[0]&&a.shift(),{pathString:t,queryString:r,path:a,query:""===r?{}:i.getQueryVariables(r)}},i.makeRequest=function(e){var t=i.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var n;return void 0===e?n=t.query:(n=t.query[e])&&void 0!==r&&(n=n[r]),n},getQueryLast:function(e,t){var n=r.getQuery(e);return n?n[n.length-1]:t}};return r},i.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var n=jQuery.param(t||{});return r=r||"",e+(n.length>0?"?"+n:"")+(r.length>0?"#"+r:"")},i.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},i.format=function(e){for(var t,r,n=/%./g,a=0,i=[],s=0;t=n.exec(e);){(r=e.substring(s,n.lastIndex-2)).length>0&&i.push(r),s=n.lastIndex;var o=t[0][1];switch(o){case"s":case"o":a");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")},i.formatNumber=function(e,t,r,n){var a=e,i=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===n?".":n,c=a<0?"-":"",u=parseInt(a=Math.abs(+a||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(a-u).toFixed(i).slice(2):"")},i.formatSize=function(e){return e=e>=1073741824?i.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?i.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?i.formatNumber(e/1024,0)+" KiB":i.formatNumber(e,0)+" bytes"},i.bytesFromIP=function(e){return-1!==e.indexOf(".")?i.bytesFromIPv4(e):-1!==e.indexOf(":")?i.bytesFromIPv6(e):null},i.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=i.createBuffer(),r=0;rr[n].end-r[n].start&&(n=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[n];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},i.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in i&&!e.update)return t(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,t(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,t(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,t(null,i.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()o.st&&a.sta.st&&o.stt){var n=new Error("Too few bytes to parse DER.");throw n.available=e.length(),n.remaining=t,n.requested=r,n}}a.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},a.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},a.create=function(e,t,r,i,s){if(n.util.isArray(i)){for(var o=[],c=0;cr){if(s.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=r,d.requested=h,d}h=r}var y=32==(32&c);if(y)if(p=[],void 0===h)for(;;){if(i(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),p.push(e(t,r,n+1,s)),r-=o-t.length()}else for(;h>0;)o=t.length(),p.push(e(t,h,n+1,s)),r-=o-t.length(),h-=o-t.length();void 0===p&&u===a.Class.UNIVERSAL&&l===a.Type.BITSTRING&&(f=t.bytes(h));if(void 0===p&&s.decodeBitStrings&&u===a.Class.UNIVERSAL&&l===a.Type.BITSTRING&&h>1){var g=t.read,v=r,m=0;if(l===a.Type.BITSTRING&&(i(t,r,1),m=t.getByte(),r--),0===m)try{o=t.length();var C={verbose:s.verbose,strict:!0,decodeBitStrings:!0},E=e(t,r,n+1,C),S=o-t.length();r-=S,l==a.Type.BITSTRING&&S++;var T=E.tagClass;S!==h||T!==a.Class.UNIVERSAL&&T!==a.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(t.read=g,r=v)}if(void 0===p){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=r}if(l===a.Type.BMPSTRING)for(p="";h>0;h-=2)i(t,r,2),p+=String.fromCharCode(t.getInt16()),r-=2;else p=t.getBytes(h)}var b=void 0===f?null:{bitStringContents:f};return a.create(u,l,y,p,b)}(e,e.length(),0,t)},a.toDer=function(e){var t=n.util.createBuffer(),r=e.tagClass|e.type,i=n.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=a.equals(e,e.original))),s)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:i.putByte(0);for(var o=0;o1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(t.putByte(r),i.length()<=127)t.putByte(127&i.length());else{var c=i.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(i),t},a.oidToDer=function(e){var t,r,a,i,s=e.split("."),o=n.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(i|=128),r.push(i),t=!1}while(a>0);for(var u=r.length-1;u>=0;--u)o.putByte(r[u])}return o},a.derToOid=function(e){var t;"string"==typeof e&&(e=n.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var a=0;e.length()>0;)a<<=7,128&(r=e.getByte())?a+=127&r:(t+="."+(a+r),a=0);return t},a.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(e.substr(2,2),10)-1,a=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},a.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),n=parseInt(e.substr(4,2),10)-1,a=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,n,a),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,n,a),t.setHours(i,s,o,c)),t},a.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var n=0;n=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},a.derToInteger=function(e){"string"==typeof e&&(e=n.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},a.validate=function(e,t,r,i){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)i&&(e.tagClass!==t.tagClass&&i.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&i.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&n.util.isArray(t.value))for(var o=0,c=0;s&&c0&&(i+="\n");for(var o="",c=0;c1?i+="0x"+n.util.bytesToHex(e.value.slice(1)):i+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?i+=" (1 unused bit shown)":f>1&&(i+=" ("+f+" unused bits shown)")}}else e.type===a.Type.OCTETSTRING?(s.test(e.value)||(i+="("+e.value+") "),i+="0x"+n.util.bytesToHex(e.value)):e.type===a.Type.UTF8?i+=n.util.decodeUtf8(e.value):e.type===a.Type.PRINTABLESTRING||e.type===a.Type.IA5String?i+=e.value:s.test(e.value)?i+="0x"+n.util.bytesToHex(e.value):0===e.value.length?i+="[null]":i+=e.value}return i}},function(e,t,r){var n=r(0);e.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},function(e,t,r){var n=r(0);function a(e,t){n.cipher.registerAlgorithm(e,(function(){return new n.aes.Algorithm(e,t)}))}r(14),r(21),r(1),e.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(e,t,r,n){var a=d({key:e,output:r,decrypt:!1,mode:n});return a.start(t),a},n.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},n.aes.startDecrypting=function(e,t,r,n){var a=d({key:e,output:r,decrypt:!0,mode:n});return a.start(t),a},n.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},n.aes.Algorithm=function(e,t){l||p();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(r._w,e,t,!1)},decrypt:function(e,t){return h(r._w,e,t,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=n.util.createBuffer();for(var a=0;a>>=2;for(a=0;a>8^255&p^99,i[y]=p,s[p]=y,h=(f=e[p])<<24^p<<16^p<<8^p^f,d=((r=e[y])^(n=e[r])^(a=e[n]))<<24^(y^a)<<16^(y^n^a)<<8^y^r^a;for(var v=0;v<4;++v)c[v][y]=h,u[v][p]=d,h=h<<24|h>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^a]]],g^=e[e[g]])}}function f(e,t){for(var r,n=e.slice(0),a=1,s=n.length,c=4*(s+6+1),l=s;l>>16&255]<<24^i[r>>>8&255]<<16^i[255&r]<<8^i[r>>>24]^o[a]<<24,a++):s>6&&l%s==4&&(r=i[r>>>24]<<24^i[r>>>16&255]<<16^i[r>>>8&255]<<8^i[255&r]),n[l]=n[l-s]^r;if(t){for(var p,f=u[0],h=u[1],d=u[2],y=u[3],g=n.slice(0),v=(l=0,(c=n.length)-4);l>>24]]^h[i[p>>>16&255]]^d[i[p>>>8&255]]^y[i[255&p]];n=g}return n}function h(e,t,r,n){var a,o,l,p,f,h,d,y,g,v,m,C,E=e.length/4-1;n?(a=u[0],o=u[1],l=u[2],p=u[3],f=s):(a=c[0],o=c[1],l=c[2],p=c[3],f=i),h=t[0]^e[0],d=t[n?3:1]^e[1],y=t[2]^e[2],g=t[n?1:3]^e[3];for(var S=3,T=1;T>>24]^o[d>>>16&255]^l[y>>>8&255]^p[255&g]^e[++S],m=a[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^p[255&h]^e[++S],C=a[y>>>24]^o[g>>>16&255]^l[h>>>8&255]^p[255&d]^e[++S],g=a[g>>>24]^o[h>>>16&255]^l[d>>>8&255]^p[255&y]^e[++S],h=v,d=m,y=C;r[0]=f[h>>>24]<<24^f[d>>>16&255]<<16^f[y>>>8&255]<<8^f[255&g]^e[++S],r[n?3:1]=f[d>>>24]<<24^f[y>>>16&255]<<16^f[g>>>8&255]<<8^f[255&h]^e[++S],r[2]=f[y>>>24]<<24^f[g>>>16&255]<<16^f[h>>>8&255]<<8^f[255&d]^e[++S],r[n?1:3]=f[g>>>24]<<24^f[h>>>16&255]<<16^f[d>>>8&255]<<8^f[255&y]^e[++S]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),a=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,a.call(t,r)},t}},function(e,t,r){var n=r(0);n.pki=n.pki||{};var a=e.exports=n.pki.oids=n.oids=n.oids||{};function i(e,t){a[e]=t,a[t]=e}function s(e,t){a[e]=t}i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.5","serialName"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){var n=r(0);r(1);var a=e.exports=n.pem=n.pem||{};function i(e){for(var t=e.name+": ",r=[],n=function(e,t){return" "+t},a=0;a65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),i=a-s-1,s=-1,++a}else" "!==t[a]&&"\t"!==t[a]&&","!==t[a]||(s=a);return t}function s(e){return e.replace(/^\s+/,"")}a.encode=function(e,t){t=t||{};var r,a="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(a+=i(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(a+=i(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),a+=i(r)),e.headers)for(var s=0;st.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=n.util.createBuffer(),a=n.util.createBuffer(),u=s.length();for(c=0;c>>0,c>>>0];for(var u=a.fullMessageLength.length-1;u>=0;--u)a.fullMessageLength[u]+=c[1],c[1]=c[0]+(a.fullMessageLength[u]/4294967296>>>0),a.fullMessageLength[u]=a.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(i),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var c,u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-u));for(var l=8*a.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(f,r,s);var h=n.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},a};var i=null,s=!1;function o(e,t,r){for(var n,a,i,s,o,c,u,l=r.length();l>=64;){for(a=e.h0,i=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)n=r.getInt32(),t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<20;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(o^i&(s^o))+c+1518500249+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<32;++u)n=(n=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|n>>>31,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<40;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+1859775393+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<60;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i&s|o&(i^s))+c+2400959708+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;for(;u<80;++u)n=(n=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|n>>>30,t[u]=n,n=(a<<5|a>>>27)+(i^s^o)+c+3395469782+n,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=a,a=n;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}},function(e,t,r){var n=r(0);r(3),r(8),r(15),r(7),r(22),r(2),r(9),r(1);var a=function(e,t,r,a){var i=n.util.createBuffer(),s=e.length>>1,o=s+(1&e.length),c=e.substr(0,o),u=e.substr(s,o),l=n.util.createBuffer(),p=n.hmac.create();r=t+r;var f=Math.ceil(a/16),h=Math.ceil(a/20);p.start("MD5",c);var d=n.util.createBuffer();l.putBytes(r);for(var y=0;y0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var a=null,i=e.entity===u.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var s=t.fragment,c=s.length();if(a={version:{major:s.getByte(),minor:s.getByte()},random:n.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},i?(a.cipher_suite=s.getBytes(2),a.compression_method=s.getByte()):(a.cipher_suites=o(s,2),a.compression_methods=o(s,1)),(c=r-(c-s.length()))>0){for(var l=o(s,2);l.length()>0;)a.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!i)for(var p=0;p0;){if(0!==h.getByte())break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(a.version.major!==e.session.version.major||a.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=u.getCipherSuite(a.cipher_suite);else for(var d=n.util.createBuffer(a.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=u.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(a.cipher_suite)});e.session.compressionMethod=i?a.compression_method:u.CompressionMethod.none}return a},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,n=t.random.bytes(),a=r?e.session.sp.client_random:n,i=r?n:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:a,server_random:i}},u.handleServerHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(n.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=n.version.minor,e.session.version=e.version;var a=n.session_id.bytes();a.length>0&&a===e.session.id?(e.expect=d,e.session.resuming=!0,e.session.sp.server_random=n.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,n)),e.session.id=a,e.process()}},u.handleClientHello=function(e,t,r){var a=u.parseHelloMessage(e,t,r);if(!e.fail){var i=a.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(i))?i="":(s.version.major!==a.version.major||s.version.minor>a.version.minor)&&(s=null,i="")),0===i.length&&(i=n.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=a.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,c=1;c0;)a=o(c.certificate_list,3),i=n.asn1.fromDer(a),a=n.pki.certificateFromAsn1(i,!0),l.push(a)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var f=e.entity===u.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=f?p:C:(f?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],u.verifyCertificateChain(e,l)&&(e.expect=f?p:C)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});e.expect=f,e.process()},u.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var a=t.fragment,i={enc_pre_master_secret:o(a,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=n.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){c.pre_master_secret=n.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},u.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment,a={certificate_types:o(n,1),certificate_authorities:o(n,2)};e.session.certificateRequest=a,e.expect=h,e.process()},u.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var a=t.fragment;a.read-=4;var i=a.bytes();a.read+=4;var s={signature:o(a,2).getBytes()},c=n.util.createBuffer();c.putBuffer(e.session.md5.digest()),c.putBuffer(e.session.sha1.digest()),c=c.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=S,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var a={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},i=e.verify(e,a.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||n.util.isArray(i)?"number"==typeof i&&(a.alert.description=i):(i.message&&(a.message=i.message),i.alert&&(a.alert.description=i.alert))),e.error(e,a)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}),u.queue(e,t),e.expect=v;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=d,u.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);u.getClientSignature(e,s)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?y:T,e.process()},u.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var s=i.bytes();i.read+=4;var o=t.fragment.getBytes();(i=n.util.createBuffer()).putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var c=e.entity===u.ConnectionEnd.client,l=c?"server finished":"client finished",p=e.session.sp;if((i=a(p.master_secret,l,i.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&c||!e.session.resuming&&!c)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=c?g:b,e.handshaking=!1,++e.handshakes,e.peerCertificate=c?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),e.process()},u.handleAlert=function(e,t){var r,n=t.fragment,a={level:n.getByte(),description:n.getByte()};switch(a.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(a.description===u.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server":"client",alert:a}),e.process()},u.handleHandshake=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=n.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(i+4);r.read+=4,a in x[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),a!==u.HandshakeType.hello_request&&a!==u.HandshakeType.certificate_verify&&a!==u.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),x[e.entity][e.expect][a](e,t,i)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,a=r.getByte(),i=r.getInt16(),s=r.getBytes(i);if(a===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>s.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,s)})),u.flush(e)}else if(a===u.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,n.util.createBuffer(s))}e.process()};var l=1,p=2,f=3,h=4,d=5,y=6,g=7,v=8,m=1,C=2,E=3,S=4,T=5,b=6,I=u.handleUnexpected,A=u.handleChangeCipherSpec,B=u.handleAlert,k=u.handleHandshake,N=u.handleApplicationData,w=u.handleHeartbeat,R=[];R[u.ConnectionEnd.client]=[[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[A,B,I,I,w],[I,B,k,I,w],[I,B,k,N,w],[I,B,k,I,w]],R[u.ConnectionEnd.server]=[[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[I,B,k,I,w],[A,B,I,I,w],[I,B,k,I,w],[I,B,k,N,w],[I,B,k,I,w]];var L=u.handleHelloRequest,_=u.handleServerHello,U=u.handleCertificate,D=u.handleServerKeyExchange,P=u.handleCertificateRequest,O=u.handleServerHelloDone,V=u.handleFinished,x=[];x[u.ConnectionEnd.client]=[[I,I,_,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,U,D,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,D,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,P,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,O,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[L,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]];var K=u.handleClientHello,M=u.handleClientKeyExchange,F=u.handleCertificateVerify;x[u.ConnectionEnd.server]=[[I,K,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,U,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,M,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,F,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,V],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I],[I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I,I]],u.generateKeys=function(e,t){var r=a,n=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",n,48).bytes(),t.pre_master_secret=null),n=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",n,i),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},n={read:r(),write:r()};if(n.read.update=function(e,t){return n.read.cipherFunction(t,n.read)?n.read.compressFunction(e,t,n.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},n.write.update=function(e,t){return n.write.compressFunction(e,t,n.write)?n.write.cipherFunction(t,n.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var a=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(a),a.keys=u.generateKeys(e,a),n.read.macKey=t?a.keys.server_write_MAC_key:a.keys.client_write_MAC_key,n.write.macKey=t?a.keys.client_write_MAC_key:a.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(n,e,a),a.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:n.read.compressFunction=s,n.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return n},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(t),r.putBytes(n.random.getBytes(28)),r},u.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},u.createAlert=function(e,t){var r=n.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=n.util.createBuffer(),r=0;r0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+i+1+o+d,v=n.util.createBuffer();return v.putByte(u.HandshakeType.client_hello),v.putInt24(g),v.putByte(e.version.major),v.putByte(e.version.minor),v.putBytes(e.session.sp.client_random),c(v,1,n.util.createBuffer(y)),c(v,2,t),c(v,1,s),d>0&&c(v,2,l),v},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,a=n.util.createBuffer();return a.putByte(u.HandshakeType.server_hello),a.putInt24(r),a.putByte(e.version.major),a.putByte(e.version.minor),a.putBytes(e.session.sp.server_random),c(a,1,n.util.createBuffer(t)),a.putByte(e.session.cipherSuite.id[0]),a.putByte(e.session.cipherSuite.id[1]),a.putByte(e.session.compressionMethod),a},u.createCertificate=function(e){var t,r=e.entity===u.ConnectionEnd.client,a=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,a=e.getCertificate(e,t));var i=n.util.createBuffer();if(null!==a)try{n.util.isArray(a)||(a=[a]);for(var s=null,o=0;ou.MaxFragment;)a.push(u.createRecord(e,{type:t.type,data:n.util.createBuffer(i.slice(0,u.MaxFragment))})),i=i.slice(u.MaxFragment);i.length>0&&a.push(u.createRecord(e,{type:t.type,data:n.util.createBuffer(i)}))}for(var s=0;s0&&(a=r.order[0]),null!==a&&a in r.cache)for(var i in t=r.cache[a],delete r.cache[a],r.order)if(r.order[i]===a){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var a=r.order.shift();delete r.cache[a]}a=n.util.bytesToHex(e);r.order.push(a),r.cache[a]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?n.util.isArray(e.caStore)?n.pki.createCaStore(e.caStore):e.caStore:n.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var a in r=[],u.CipherSuites)r.push(u.CipherSuites[a]);var i=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,s=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,n){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var n=!1!==r.fatal;n&&(t.fail=!0),e.error(t,r),n&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,u.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)}};o.reset();return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,a=r.length();if(a<5)t=5-a;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,n=r.length();n8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,E=0;E>>4^T))<<4,S^=t=65535&((T^=t)>>>-16^S),S^=(t=858993459&(S>>>2^(T^=t<<-16)))<<2,S^=t=65535&((T^=t)>>>-16^S),S^=(t=1431655765&(S>>>1^(T^=t<<-16)))<<1,S^=t=16711935&((T^=t)>>>8^S),t=(S^=(t=1431655765&(S>>>1^(T^=t<<8)))<<1)<<8|(T^=t)>>>20&240,S=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=t;for(var b=0;b>>26,T=T<<2|T>>>26):(S=S<<1|S>>>27,T=T<<1|T>>>27);var I=r[(S&=-15)>>>28]|n[S>>>24&15]|a[S>>>20&15]|i[S>>>16&15]|s[S>>>12&15]|o[S>>>8&15]|c[S>>>4&15],A=u[(T&=-15)>>>28]|l[T>>>24&15]|p[T>>>20&15]|f[T>>>16&15]|h[T>>>12&15]|d[T>>>8&15]|y[T>>>4&15];t=65535&(A>>>16^I),v[C++]=I^t,v[C++]=A^t<<16}}return v}(t),this._init=!0}},a("DES-ECB",n.cipher.modes.ecb),a("DES-CBC",n.cipher.modes.cbc),a("DES-CFB",n.cipher.modes.cfb),a("DES-OFB",n.cipher.modes.ofb),a("DES-CTR",n.cipher.modes.ctr),a("3DES-ECB",n.cipher.modes.ecb),a("3DES-CBC",n.cipher.modes.cbc),a("3DES-CFB",n.cipher.modes.cfb),a("3DES-OFB",n.cipher.modes.ofb),a("3DES-CTR",n.cipher.modes.ctr);var i=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,r,n){var a,h,d=32===e.length?3:9;a=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(h=252645135&(y>>>4^g))<<4,y^=(h=65535&(y>>>16^(g^=h)))<<16,y^=h=858993459&((g^=h)>>>2^y),y^=h=16711935&((g^=h<<2)>>>8^y),y=(y^=(h=1431655765&(y>>>1^(g^=h<<8)))<<1)<<1|y>>>31,g=(g^=h)<<1|g>>>31;for(var v=0;v>>4|g<<28)^e[E+1];h=y,y=g,g=h^(s[S>>>24&63]|c[S>>>16&63]|l[S>>>8&63]|f[63&S]|i[T>>>24&63]|o[T>>>16&63]|u[T>>>8&63]|p[63&T])}h=y,y=g,g=h}g=g>>>1|g<<31,g^=h=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(h=16711935&(g>>>8^(y^=h<<1)))<<8,g^=(h=858993459&(g>>>2^(y^=h)))<<2,g^=h=65535&((y^=h)>>>16^g),g^=h=252645135&((y^=h<<16)>>>4^g),y^=h<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),a=(t=e.decrypt?n.cipher.createDecipher(r,e.key):n.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof n.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,a.call(t,r)},t}},function(e,t,r){var n=r(0);if(r(3),r(13),r(6),r(27),r(28),r(2),r(1),void 0===a)var a=n.jsbn.BigInteger;var i=n.util.isNodejs?r(17):null,s=n.asn1,o=n.util;n.pki=n.pki||{},e.exports=n.pki.rsa=n.rsa=n.rsa||{};var c=n.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var n=s.oidToDer(t).getBytes(),a=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);i.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,n)),i.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return a.value.push(i),a.value.push(o),s.toDer(a).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var i;t.dP||(t.dP=t.d.mod(t.p.subtract(a.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(a.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{i=new a(n.util.bytesToHex(n.random.getBytes(t.n.bitLength()/8)),16)}while(i.compareTo(t.n)>=0||!i.gcd(t.n).equals(a.ONE));for(var s=(e=e.multiply(i.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var c=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return c=c.multiply(i.modInverse(t.n)).mod(t.n)};function g(e,t,r){var a=n.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}a.putByte(0),a.putByte(r);var o,c=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u0;){var l=0,p=n.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function m(e,t,r){"function"==typeof t&&(r=t,t={});var i={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,n){return t?r(t):(e.p=n,null!==e.q?u(t,e.q):void o(e.qBits,u))}))}function o(e,t){n.prime.generateProbablePrime(e,i,t)}function u(t,n){if(t)return r(t);if(e.q=n,e.p.compareTo(e.q)<0){var i=e.p;e.p=e.q,e.q=i}if(0!==e.p.subtract(a.ONE).gcd(e.e).compareTo(a.ONE))return e.p=null,void s();if(0!==e.q.subtract(a.ONE).gcd(e.e).compareTo(a.ONE))return e.q=null,void o(e.qBits,u);if(e.p1=e.p.subtract(a.ONE),e.q1=e.q.subtract(a.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(a.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(i.prng=t.prng),s()}function C(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=n.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(e){return n.util.isNodejs&&"function"==typeof i[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function b(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function I(e){for(var t=n.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),a=0;a0;)l.putByte(0),--p;return l.putBytes(n.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var c=new a(n.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),l=n.util.createBuffer(),p=s-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(n.util.hexToBytes(u)),!1!==i?v(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var i,s=(r=r||{}).prng||n.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new a(null);r.fromInt(30);for(var n,i=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||lp?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(a.ONE).gcd(e.e).compareTo(a.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(a.ONE),e.q1=e.q.subtract(a.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(a.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(n=+new Date)-o,o=n}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,a){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(a=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(a=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,a=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(a=r,r=void 0):(a=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(a){if(S("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return a(e);a(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(T("generateKey")&&T("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){a(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(e)));a(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(b("generateKey")&&b("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:I(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(n.util.createBuffer(t)));a(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){a(e)}},void(u.onerror=function(e){a(e)})}}else if(S("generateKeyPairSync")){var l=i.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var p=c.rsa.createKeyPairGenerationState(e,t,r);if(!a)return c.rsa.stepKeyPairGenerationState(p,0),p.keys;m(p,r,a)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,a){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return n.pkcs1.encode_rsa_oaep(t,e,a)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return c.rsa.encrypt(i,r,!0)},verify:function(e,t,n){"string"==typeof n?n=n.toUpperCase():void 0===n&&(n="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===n?n={verify:function(e,t){return t=v(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==n&&"NULL"!==n&&null!==n||(n={verify:function(e,t){return e===(t=v(t,r,!0))}});var a=c.rsa.decrypt(t,r,!0,!1);return n.verify(e,a,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,a,i,s,o,u){var l={n:e,e:t,d:r,p:a,q:i,dP:s,dQ:o,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var a=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:v};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return n.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(a,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var n=t.encode(e,l.n.bitLength());return c.rsa.encrypt(n,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,i,o,u,f,h,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(n.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,p,y,g)){var v=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw v.errors=g,v}return t=n.util.createBuffer(y.privateKeyModulus).toHex(),r=n.util.createBuffer(y.privateKeyPublicExponent).toHex(),i=n.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(y.privateKeyPrime1).toHex(),u=n.util.createBuffer(y.privateKeyPrime2).toHex(),f=n.util.createBuffer(y.privateKeyExponent1).toHex(),h=n.util.createBuffer(y.privateKeyExponent2).toHex(),d=n.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new a(t,16),new a(r,16),new a(i,16),new a(o,16),new a(u,16),new a(f,16),new a(h,16),new a(d,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,h,t,r)){var i,o=s.derToOid(t.publicKeyOid);if(o!==c.oids.rsaEncryption)throw(i=new Error("Cannot read public key. Unknown OID.")).oid=o,i;e=t.rsaPublicKey}if(r=[],!s.validate(e,f,t,r))throw(i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,i;var u=n.util.createBuffer(t.publicKeyModulus).toHex(),l=n.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new a(u,16),new a(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e))])}},function(e,t,r){var n,a=r(0);e.exports=a.jsbn=a.jsbn||{};function i(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new i(null)}function o(e,t,r,n,a,i){for(var s=16383&t,o=t>>14;--i>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;a=((c=s*c+((16383&l)<<14)+r.data[n]+a)>>28)+(l>>14)+o*u,r.data[n++]=268435455&c}return a}a.jsbn.BigInteger=i,"undefined"==typeof navigator?(i.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(e,t,r,n,a,i){for(var s=32767&t,o=t>>15;--i>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;a=((c=s*c+((32767&l)<<15)+r.data[n]+(1073741823&a))>>>30)+(l>>>15)+o*u+(a>>>30),r.data[n++]=1073741823&c}return a},n=30):"Netscape"!=navigator.appName?(i.prototype.am=function(e,t,r,n,a,i){for(;--i>=0;){var s=t*this.data[e++]+r.data[n]+a;a=Math.floor(s/67108864),r.data[n++]=67108863&s}return a},n=26):(i.prototype.am=o,n=28),i.prototype.DB=n,i.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function T(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function b(){}function I(e){return e}function A(e){this.r2=s(),this.q3=s(),i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,n,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},i.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},i.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var n=e.length,a=!1,s=0;--n>=0;){var o=8==r?255&e[n]:f(e,n);o<0?"-"==e.charAt(n)&&(a=!0):(a=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},i.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},i.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>a|o,o=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},i.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var n=e%this.DB,a=this.DB-n,i=(1<>n;for(var s=r+1;s>n;n>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n-=e.s}t.s=n<0?-1:0,n<-1?t.data[r++]=this.DV+n:n>0&&(t.data[r++]=n),t.t=r,t.clamp()},i.prototype.multiplyTo=function(e,t){var r=this.abs(),n=e.abs(),a=r.t;for(t.t=a+n.t;--a>=0;)t.data[a]=0;for(a=0;a=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},i.prototype.divRemTo=function(e,t,r){var n=e.abs();if(!(n.t<=0)){var a=this.abs();if(a.t0?(n.lShiftTo(l,o),a.lShiftTo(l,r)):(n.copyTo(o),a.copyTo(r));var p=o.t,f=o.data[p-1];if(0!=f){var h=f*(1<1?o.data[p-2]>>this.F2:0),y=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(E,r)),i.ONE.dlShiftTo(p,E),E.subTo(o,o);o.t=0;){var S=r.data[--m]==f?this.DM:Math.floor(r.data[m]*y+(r.data[m-1]+v)*g);if((r.data[m]+=o.am(0,S,r,C,0,p))0&&r.rShiftTo(l,r),c<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},i.prototype.exp=function(e,t){if(e>4294967295||e<1)return i.ONE;var r=s(),n=s(),a=t.convert(this),o=d(e)-1;for(a.copyTo(r);--o>=0;)if(t.sqrTo(r,n),(e&1<0)t.mulTo(n,a,r);else{var c=r;r=n,n=c}return t.revert(r)},i.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,n=(1<0)for(o>o)>0&&(a=!0,i=p(r));s>=0;)o>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&n,o<=0&&(o+=this.DB,--s)),r>0&&(a=!0),a&&(i+=p(r));return a?i:"0"},i.prototype.negate=function(){var e=s();return i.ZERO.subTo(this,e),e},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},i.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t},i.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},i.ZERO=h(0),i.ONE=h(1),b.prototype.convert=I,b.prototype.revert=I,b.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},b.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],k=(1<<26)/B[B.length-1];i.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),n=h(r),a=s(),i=s(),o="";for(this.divRemTo(n,a,i);a.signum()>0;)o=(r+i.intValue()).toString(e).substr(1)+o,a.divRemTo(n,a,i);return i.intValue().toString(e)+o},i.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),n=Math.pow(t,r),a=!1,s=0,o=0,c=0;c=r&&(this.dMultiply(n),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),a&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(i.ONE.shiftLeft(e-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(i.ONE.shiftLeft(e-1),this);else{var n=new Array,a=7&e;n.length=1+(e>>3),t.nextBytes(n),a>0?n[0]&=(1<>=this.DB;if(e.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=this.DB;n+=e.s}t.s=n<0?-1:0,n>0?t.data[r++]=n:n<-1&&(t.data[r++]=this.DV+n),t.t=r,t.clamp()},i.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},i.prototype.multiplyLowerTo=function(e,t,r){var n,a=Math.min(this.t+e.t,t);for(r.s=0,r.t=a;a>0;)r.data[--a]=0;for(n=r.t-this.t;a=0;)r.data[n]=0;for(n=Math.max(t-this.t,0);n0)if(0==t)r=this.data[0]%e;else for(var n=this.t-1;n>=0;--n)r=(t*r+this.data[n])%e;return r},i.prototype.millerRabin=function(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var n,a=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=n.modPow(a,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},i.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,n=this.DB-e*this.DB%8,a=0;if(e-- >0)for(n>n)!=(this.s&this.DM)>>n&&(t[a++]=r|this.s<=0;)n<8?(r=(this.data[e]&(1<>(n+=this.DB-8)):(r=this.data[e]>>(n-=8)&255,n<=0&&(n+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==a&&(128&this.s)!=(128&r)&&++a,(a>0||r!=this.s)&&(t[a++]=r);return t},i.prototype.equals=function(e){return 0==this.compareTo(e)},i.prototype.min=function(e){return this.compareTo(e)<0?this:e},i.prototype.max=function(e){return this.compareTo(e)>0?this:e},i.prototype.and=function(e){var t=s();return this.bitwiseTo(e,v,t),t},i.prototype.or=function(e){var t=s();return this.bitwiseTo(e,m,t),t},i.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,C,t),t},i.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},i.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var p=s();for(n.sqrTo(o[1],p);c<=l;)o[c]=s(),n.mulTo(p,o[c-2],o[c]),c+=2}var f,v,m=e.t-1,C=!0,E=s();for(a=d(e.data[m])-1;m>=0;){for(a>=u?f=e.data[m]>>a-u&l:(f=(e.data[m]&(1<0&&(f|=e.data[m-1]>>this.DB+a-u)),c=r;0==(1&f);)f>>=1,--c;if((a-=c)<0&&(a+=this.DB,--m),C)o[f].copyTo(i),C=!1;else{for(;c>1;)n.sqrTo(i,E),n.sqrTo(E,i),c-=2;c>0?n.sqrTo(i,E):(v=i,i=E,E=v),n.mulTo(E,o[f],i)}for(;m>=0&&0==(e.data[m]&1<=0?(r.subTo(n,r),t&&a.subTo(o,a),s.subTo(c,s)):(n.subTo(r,n),t&&o.subTo(a,o),c.subTo(s,c))}return 0!=n.compareTo(i.ONE)?i.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},i.prototype.pow=function(e){return this.exp(e,new b)},i.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var n=t;t=r,r=n}var a=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(a0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(a=t.getLowestSetBit())>0&&t.rShiftTo(a,t),(a=r.getLowestSetBit())>0&&r.rShiftTo(a,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},i.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(t=0;t>>0,o>>>0];for(var c=a.fullMessageLength.length-1;c>=0;--c)a.fullMessageLength[c]+=o[1],o[1]=o[0]+(a.fullMessageLength[c]/4294967296>>>0),a.fullMessageLength[c]=a.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-o));for(var c,u=0,p=a.fullMessageLength.length-1;p>=0;--p)u=(c=8*a.fullMessageLength[p]+u)/4294967296>>>0,s.putInt32Le(c>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(f,r,s);var h=n.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},a};var i=null,s=null,o=null,c=null,u=!1;function l(e,t,r){for(var n,a,i,u,l,p,f,h=r.length();h>=64;){for(a=e.h0,i=e.h1,u=e.h2,l=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),n=a+(l^i&(u^l))+c[f]+t[f],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<32;++f)n=a+(u^l&(i^u))+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<48;++f)n=a+(i^u^l)+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;for(;f<64;++f)n=a+(u^(i|~l))+c[f]+t[s[f]],a=l,l=u,u=i,i+=n<<(p=o[f])|n>>>32-p;e.h0=e.h0+a|0,e.h1=e.h1+i|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,r){var n=r(0);r(8),r(4),r(1);var a,i=n.pkcs5=n.pkcs5||{};n.util.isNodejs&&!n.options.usePureJavaScript&&(a=r(17)),e.exports=n.pbkdf2=i.pbkdf2=function(e,t,r,i,s,o){if("function"==typeof s&&(o=s,s=null),n.util.isNodejs&&!n.options.usePureJavaScript&&a.pbkdf2&&(null===s||"object"!=typeof s)&&(a.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===a.pbkdf2Sync.length?a.pbkdf2(e,t,r,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):a.pbkdf2(e,t,r,i,s,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===a.pbkdf2Sync.length?a.pbkdf2Sync(e,t,r,i).toString("binary"):a.pbkdf2Sync(e,t,r,i,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in n.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=n.md[s].create()}var c=s.digestLength;if(i>4294967295*c){var u=new Error("Derived key is too long.");if(o)return o(u);throw u}var l=Math.ceil(i/c),p=i-(l-1)*c,f=n.hmac.create();f.start(s,e);var h,d,y,g="";if(!o){for(var v=1;v<=l;++v){f.start(null,null),f.update(t),f.update(n.util.int32ToBytes(v)),h=y=f.digest().getBytes();for(var m=2;m<=r;++m)f.start(null,null),f.update(y),d=f.digest().getBytes(),h=n.util.xorBytes(h,d,c),y=d;g+=vl)return o(null,g);f.start(null,null),f.update(t),f.update(n.util.int32ToBytes(v)),h=y=f.digest().getBytes(),m=2,E()}function E(){if(m<=r)return f.start(null,null),f.update(y),d=f.digest().getBytes(),h=n.util.xorBytes(h,d,c),y=d,++m,n.util.setImmediate(E);g+=v128)throw new Error('Invalid "nsComment" content.');e.value=a.create(a.Class.UNIVERSAL,a.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(a.create(a.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[a.create(a.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(a.create(a.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var v=n.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(a.create(a.Class.CONTEXT_SPECIFIC,2,!1,v))}}else if("cRLDistributionPoints"===e.name){e.value=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);l=e.value.value;var m,C=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),E=a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=p[0],c.validity.notAfter=p[1],c.tbsCertificate=r.tbsCertificate,t){var f;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=n.md.sha1.create();break;case"md5WithRSAEncryption":c.md=n.md.md5.create();break;case"sha256WithRSAEncryption":c.md=n.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=n.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=n.md.sha512.create();break;case"RSASSA-PSS":c.md=n.md.sha256.create()}if(null===c.md)throw(f=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,f;var y=a.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var v=n.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer,v),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=v.digest().toHex();var m=n.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=i.RDNAttributesAsArray(r.certSubject,m),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=m.digest().toHex(),r.certExtensions?c.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},i.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),i=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&i)}else if("basicConstraints"===t.name){(c=a.fromDer(t.value)).value.length>0&&c.value[0].type===a.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var o=null;c.value.length>0&&c.value[0].type===a.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(t.pathLenConstraint=a.derToInteger(o))}else if("extKeyUsage"===t.name)for(var c=a.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var p;t.altNames=[];c=a.fromDer(t.value);for(var f=0;f=E&&e0&&s.value.push(i.certificateExtensionsToAsn1(e.extensions)),s},i.getCertificationRequestInfo=function(e){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(e.version).getBytes()),y(e.subject),i.publicKeyToAsn1(e.publicKey),C(e)])},i.distinguishedNameToAsn1=function(e){return y(e)},i.certificateToAsn1=function(e){var t=e.tbsCertificate||i.getTBSCertificate(e);return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[t,a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(e.signatureOid).getBytes()),m(e.signatureOid,e.signatureParameters)]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},i.certificateExtensionsToAsn1=function(e){var t=a.create(a.Class.CONTEXT_SPECIFIC,3,!0,[]),r=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);t.value.push(r);for(var n=0;nl.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(p=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(f=!0,p=l),p){var h=p;n.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){p=h.shift();try{d=p.verify(l)}catch(e){}}d||(c={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}null!==c||p&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gm.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}var E=null===c||c.error,S=r.verify?r.verify(E,u,a):E;if(!0!==S)throw!0===E&&(c={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||n.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,o=!1,++u}while(t.length>0);return!0}},function(e,t,r){var n=r(0);r(2),r(1),(e.exports=n.pss=n.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,a=e.mgf,i=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=n.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||n.random,c={encode:function(e,c){var u,l,p=c-1,f=Math.ceil(p/8),h=e.digest().getBytes();if(f>8*f-p&255;return(E=String.fromCharCode(E.charCodeAt(0)&~S)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l>8*l-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=a.generate(h,p),g="";for(c=0;c4){var r=e;e=n.util.createBuffer();for(var a=0;a0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},a.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},a.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},a.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var n=0;n0))return!0;for(var n=0;n0)return!1;var r=e.length(),n=e.at(r-1);return!(n>this.blockSize<<2)&&(e.truncate(n),!0)},a.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.cfb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.cfb.prototype.decrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.ofb.prototype.encrypt=function(e,t,r){var n=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0)e.read-=this.blockSize;else for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},a.ofb.prototype.decrypt=a.ofb.prototype.encrypt,a.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},a.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},a.ctr.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},a.ctr.prototype.decrypt=a.ctr.prototype.encrypt,a.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},a.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=n.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?n.util.createBuffer(e.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=n.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var a=r.length();if(12===a)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*a)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=n.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},a.gcm.prototype.encrypt=function(e,t,r){var n=e.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var a=0;a0&&(i=this.blockSize-i),this._partialOutput.clear();for(a=0;a0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},a.gcm.prototype.decrypt=function(e,t,r){var n=e.length();if(n0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var a=0;a0;--n)t[n]=e[n]>>>1|(1&e[n-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},a.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var n=e[r/8|0]>>>4*(7-r%8)&15,a=this._m[r][n];t[0]^=a[0],t[1]^=a[1],t[2]^=a[2],t[3]^=a[3]}return t},a.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},a.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,n=4*r,a=16*r,i=new Array(a),s=0;s>>1,a=new Array(r);a[n]=e.slice(0);for(var i=n>>>1;i>0;)this.pow(a[2*i],a[i]=[]),i>>=1;for(i=2;i=0;c--)w>>=8,w+=A.at(c)+N.at(c),N.setAt(c,255&w);k.putBuffer(N)}E=k,p.putBuffer(b)}return p.truncate(p.length()-i),p},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=e,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},s.pbe.getCipherForPBES2=function(e,t,r){var a,o={},c=[];if(!i.validate(t,u,o,c))throw(a=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,a;if((e=i.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(a=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,a.supportedOids=["pkcs5PBKDF2"],a;if((e=i.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(a=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,a.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],a;var l,p,h=o.kdfSalt,d=n.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,p=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,p=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,p=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,p=n.des.createDecryptionCipher;break;case"desCBC":l=8,p=n.des.createDecryptionCipher}var y=f(o.prfOid),g=n.pkcs5.pbkdf2(r,h,d,l,y),v=o.encIv,m=p(g);return m.start(v),m},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var a={},o=[];if(!i.validate(t,l,a,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var c,u,p,h=n.util.createBuffer(a.salt),d=n.util.createBuffer(a.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,p=n.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,p=function(e,t){var r=n.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=f(a.prfOid),v=s.pbe.generatePkcs12Key(r,h,1,d,c,g);return g.start(),p(v,s.pbe.generatePkcs12Key(r,h,2,d,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,a){if(null==a){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');a=n.md.md5.create()}null===t&&(t="");for(var i=[p(a,e+t)],s=16,o=1;s>>0,o>>>0];for(var u=a.fullMessageLength.length-1;u>=0;--u)a.fullMessageLength[u]+=o[1],o[1]=o[0]+(a.fullMessageLength[u]/4294967296>>>0),a.fullMessageLength[u]=a.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),a},a.digest=function(){var s=n.util.createBuffer();s.putBytes(t.bytes());var o,u=a.fullMessageLength[a.fullMessageLength.length-1]+a.messageLengthSize&a.blockLength-1;s.putBytes(i.substr(0,a.blockLength-u));for(var l=8*a.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(f,r,s);var h=n.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},a};var i=null,s=!1,o=null;function c(e,t,r){for(var n,a,i,s,c,u,l,p,f,h,d,y,g,v=r.length();v>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)n=((n=t[c-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,a=((a=t[c-15])>>>7|a<<25)^(a>>>18|a<<14)^a>>>3,t[c]=n+t[c-7]+a+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,f=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)i=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|p&(u^l),n=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+o[c]+t[c],g=y,y=d,d=h,h=f+n>>>0,f=p,p=l,l=u,u=n+(a=i+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,v-=64}}},function(e,t,r){var n=r(0);r(1);var a=null;!n.util.isNodejs||n.options.usePureJavaScript||process.versions["node-webkit"]||(a=r(17)),(e.exports=n.prng=n.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,i=new Array(32),s=0;s<32;++s)i[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,n=0;n<32;++n)t.reseeds%r==0&&(e.update(t.pools[n].digest().getBytes()),t.pools[n].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var a=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(a),t.generated=0}function u(e){var t=null,r=n.util.globalScope,a=r.crypto||r.msCrypto;a&&a.getRandomValues&&(t=function(e){return a.getRandomValues(e)});var i=n.util.createBuffer();if(t)for(;i.length()>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)p=f>>>(c<<3),p^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&p))}return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var a=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,u=n.util.createBuffer();t.key=null,function l(p){if(p)return r(p);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return n.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,n){if(r)return e(r);t.collect(n),c(),e()}))}(l)}));var f=a(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(a(t.key,i(t.seed))),t.seed=o(a(t.key,t.seed)),n.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,a=t.plugin.increment,i=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=n.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&o();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=i(r(t.key,a(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},a?(t.seedFile=function(e,t){a.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return a.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,n=0;n>a&255);t.collect(n)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",e),t(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&t.seedFile(n.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},function(e,t,r){var n=r(0);r(1);var a=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],s=function(e,t){return e<>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(e,t){"string"==typeof e&&(e=n.util.createBuffer(e)),t=t||128;var r,i=e,s=e.length(),o=t,c=Math.ceil(o/8),u=255>>(7&o);for(r=s;r<128;r++)i.putByte(a[i.at(r-1)+i.at(r-s)&255]);for(i.setAt(128-c,a[i.at(128-c)&u]),r=127-c;r>=0;r--)i.setAt(r,a[i.at(r+1)^i.at(r+c)]);return i};var c=function(e,t,r){var a,c,u,l,p=!1,f=null,h=null,d=null,y=[];for(e=n.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(a=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],i[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(a=function(e){for(u=3;u>=0;u--)e[u]=o(e[u],i[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var n=f.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),t.push(65535&n)}l=r?0:63;for(var a=0;a=8;)g([[5,a],[1,c],[6,a],[1,c],[5,a]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(t&&(p=!0,v.update()),!r&&(t=0===f.length()))if(e)t=e(8,h,!r);else{var a=h.length(),i=h.at(a-1);i>a?t=!1:h.truncate(i)}return t}}};n.rc2.startEncrypting=function(e,t,r){var a=n.rc2.createEncryptionCipher(e,128);return a.start(t,r),a},n.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},n.rc2.startDecrypting=function(e,t,r){var a=n.rc2.createDecryptionCipher(e,128);return a.start(t,r),a},n.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){var n=r(0);r(1),r(2),r(9);var a=e.exports=n.pkcs1=n.pkcs1||{};function i(e,t,r){r||(r=n.md.sha1.create());for(var a="",i=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),a+=r.digest().getBytes()}return a.substring(0,t)}a.encode_rsa_oaep=function(e,t,r){var a,s,o,c;"string"==typeof r?(a=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(a=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),o?o.start():o=n.md.sha1.create(),c||(c=o);var u=Math.ceil(e.n.bitLength()/8),l=u-2*o.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;a||(a=""),o.update(a,"raw");for(var p=o.digest(),f="",h=l-t.length,d=0;de&&(s=c(e,t));var h=s.toString(16);a.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(p,0)}}}h()}(e,t,a,i);return o(e,t,a,i)}(e,u,i.options,a);throw new Error("Invalid prime generation algorithm: "+i.name)}}function o(e,t,r,i){var s=c(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(s.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,i,s,o,u,l){var p=+new Date;do{if(t.bitLength()>r&&(t=c(r,i)),t.isProbablePrime(o))return l(null,t);t.dAddOffset(a[s++%8],0)}while(u<0||+new Date-p=0&&a.push(o):a.push(o))}return a}function h(e){if(e.composed||e.constructed){for(var t=n.util.createBuffer(),r=0;r0&&(c=a.create(a.Class.UNIVERSAL,a.Type.SET,!0,p));var f=[],h=[];null!==t&&(h=n.util.isArray(t)?t:[t]);for(var d=[],y=0;y0){var C=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,d),E=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(C).getBytes())])]);f.push(E)}var S=null;if(null!==e){var T=i.wrapRsaPrivateKey(i.privateKeyToAsn1(e));S=null===r?a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.keyBag).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[T]),c]):a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(T,r,o)]),c]);var b=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[S]),I=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(b).getBytes())])]);f.push(I)}var A,B=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,f);if(o.useMac){var k=n.md.sha1.create(),N=new n.util.ByteBuffer(n.random.getBytes(o.saltSize)),w=o.count,R=(e=s.generateKey(r,N,3,w,20),n.hmac.create());R.start(k,e),R.update(a.toDer(B).getBytes());var L=R.getMac();A=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.sha1).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,L.getBytes())]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,N.getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(w).getBytes())])}return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(3).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(i.oids.data).getBytes()),a.create(a.Class.CONTEXT_SPECIFIC,0,!0,[a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(B).getBytes())])]),A])},s.generateKey=n.pbe.generatePkcs12Key},function(e,t,r){var n=r(0);r(3),r(1);var a=n.asn1,i=e.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=i;var s={name:"ContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},i.encryptedDataValidator={name:"EncryptedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var c={name:"SignerInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:a.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:a.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:a.Class.UNIVERSAL,type:a.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:a.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var n=r(0);r(1),n.mgf=n.mgf||{},(e.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(e){return{generate:function(t,r){for(var a=new n.util.ByteBuffer,i=Math.ceil(r/e.digestLength),s=0;s>>0,s>>>0];for(var o=h.fullMessageLength.length-1;o>=0;--o)h.fullMessageLength[o]+=s[1],s[1]=s[0]+(h.fullMessageLength[o]/4294967296>>>0),h.fullMessageLength[o]=h.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return a.putBytes(e),l(r,i,a),(a.read>2048||0===a.length())&&a.compact(),h},h.digest=function(){var t=n.util.createBuffer();t.putBytes(a.bytes());var o,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],p=0;p>>0,t.putInt32(u>>>0),u=o>>>0;t.putInt32(u);var f=new Array(r.length);for(p=0;p=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)n=(((L=(U=t[R-2])[0])>>>19|(_=U[1])<<13)^(_>>>29|L<<3)^L>>>6)>>>0,a=((L<<13|_>>>19)^(_<<3|L>>>29)^(L<<26|_>>>6))>>>0,i=(((L=(P=t[R-15])[0])>>>1|(_=P[1])<<31)^(L>>>8|_<<24)^L>>>7)>>>0,s=((L<<31|_>>>1)^(L<<24|_>>>8)^(L<<25|_>>>7))>>>0,D=t[R-7],O=t[R-16],_=a+D[1]+s+O[1],t[R][0]=n+D[0]+i+O[0]+(_/4294967296>>>0)>>>0,t[R][1]=_>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],v=e[1][1],m=e[2][0],C=e[2][1],E=e[3][0],S=e[3][1],T=e[4][0],b=e[4][1],I=e[5][0],A=e[5][1],B=e[6][0],k=e[6][1],N=e[7][0],w=e[7][1],R=0;R<80;++R)l=((T>>>14|b<<18)^(T>>>18|b<<14)^(b>>>9|T<<23))>>>0,p=(B^T&(I^B))>>>0,o=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,f=(d&g|m&(d^g))>>>0,h=(y&v|C&(y^v))>>>0,_=w+(((T<<18|b>>>14)^(T<<14|b>>>18)^(b<<23|T>>>9))>>>0)+((k^b&(A^k))>>>0)+c[R][1]+t[R][1],n=N+l+p+c[R][0]+t[R][0]+(_/4294967296>>>0)>>>0,a=_>>>0,i=o+f+((_=u+h)/4294967296>>>0)>>>0,s=_>>>0,N=B,w=k,B=I,k=A,I=T,A=b,T=E+n+((_=S+a)/4294967296>>>0)>>>0,b=_>>>0,E=m,S=C,m=g,C=v,g=d,v=y,d=n+i+((_=a+s)/4294967296>>>0)>>>0,y=_>>>0;_=e[0][1]+y,e[0][0]=e[0][0]+d+(_/4294967296>>>0)>>>0,e[0][1]=_>>>0,_=e[1][1]+v,e[1][0]=e[1][0]+g+(_/4294967296>>>0)>>>0,e[1][1]=_>>>0,_=e[2][1]+C,e[2][0]=e[2][0]+m+(_/4294967296>>>0)>>>0,e[2][1]=_>>>0,_=e[3][1]+S,e[3][0]=e[3][0]+E+(_/4294967296>>>0)>>>0,e[3][1]=_>>>0,_=e[4][1]+b,e[4][0]=e[4][0]+T+(_/4294967296>>>0)>>>0,e[4][1]=_>>>0,_=e[5][1]+A,e[5][0]=e[5][0]+I+(_/4294967296>>>0)>>>0,e[5][1]=_>>>0,_=e[6][1]+k,e[6][0]=e[6][0]+B+(_/4294967296>>>0)>>>0,e[6][1]=_>>>0,_=e[7][1]+w,e[7][0]=e[7][0]+N+(_/4294967296>>>0)>>>0,e[7][1]=_>>>0,V-=128}}},function(e,t,r){var n=r(0);r(1),e.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var a={},i=[],s=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var o=0;o0;)(r=e.requests.shift()).request.aborted&&(r=null);null===r?(null!==t.options&&(t.options=null),e.idle.push(t)):(t.retries=1,t.options=r,u(e,t))},p=function(e,t,r){t.options=null,t.connected=function(r){if(null===t.options)l(e,t);else{var n=t.options.request;if(n.connectTime=+new Date-n.connectTime,r.socket=t,t.options.connected(r),n.aborted)t.close();else{var a=n.toString();n.body&&(a+=n.body),n.time=+new Date,t.send(a),n.time=+new Date-n.time,t.options.response.time=+new Date,t.sending=!0}}},t.closed=function(r){if(t.sending)t.sending=!1,t.retries>0?(--t.retries,u(e,t)):t.error({id:t.id,type:"ioError",message:"Connection closed during send. Broken pipe.",bytesAvailable:0});else{var n=t.options.response;n.readBodyUntilClose&&(n.time=+new Date-n.time,n.bodyReceived=!0,t.options.bodyReady({request:t.options.request,response:n,socket:t})),t.options.closed(r),l(e,t)}},t.data=function(r){if(t.sending=!1,t.options.request.aborted)t.close();else{var n=t.options.response,a=t.receive(r.bytesAvailable);if(null!==a)if(t.buffer.putBytes(a),n.headerReceived||(n.readHeader(t.buffer),n.headerReceived&&t.options.headerReady({request:t.options.request,response:n,socket:t})),n.headerReceived&&!n.bodyReceived&&n.readBody(t.buffer),n.bodyReceived)t.options.bodyReady({request:t.options.request,response:n,socket:t}),-1!=(n.getField("Connection")||"").indexOf("close")||"HTTP/1.0"===n.version&&null===n.getField("Keep-Alive")?t.close():l(e,t)}},t.error=function(e){t.options.error({type:e.type,message:e.message,request:t.options.request,response:t.options.response,socket:t}),t.close()},r?((t=n.tls.wrapSocket({sessionId:null,sessionCache:{},caStore:r.caStore,cipherSuites:r.cipherSuites,socket:t,virtualHost:r.virtualHost,verify:r.verify,getCertificate:r.getCertificate,getPrivateKey:r.getPrivateKey,getSignature:r.getSignature,deflate:r.deflate||null,inflate:r.inflate||null})).options=null,t.buffer=n.util.createBuffer(),e.sockets.push(t),r.prime?t.connect({host:e.url.host,port:e.url.port,policyPort:e.policyPort,policyUrl:e.policyUrl}):e.idle.push(t)):(t.buffer=n.util.createBuffer(),e.sockets.push(t),e.idle.push(t))},f=function(e){var t=!1;if(-1!==e.maxAge){var r=y(new Date);e.created+e.maxAge<=r&&(t=!0)}return t};a.createClient=function(e){var t=null;e.caCerts&&(t=n.pki.createCaStore(e.caCerts)),e.url=e.url||window.location.protocol+"//"+window.location.host;var r=a.parseUrl(e.url);if(!r){var i=new Error("Invalid url.");throw i.details={url:e.url},i}e.connections=e.connections||1;var l=e.socketPool,h={url:r,socketPool:l,policyPort:e.policyPort,policyUrl:e.policyUrl,requests:[],sockets:[],idle:[],secure:"https"===r.scheme,cookies:{},persistCookies:void 0===e.persistCookies||e.persistCookies};n.debug&&n.debug.get("forge.http","clients").push(h),o(h);var d=null;h.secure&&(d={caStore:t,cipherSuites:e.cipherSuites||null,virtualHost:e.virtualHost||r.host,verify:e.verify||function(e,t,r,n){if(0===r&&!0===t){var a=n[r].subject.getField("CN");null!==a&&h.url.host===a.value||(t={message:"Certificate common name does not match url host."})}return t},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,prime:e.primeTlsSockets||!1},null!==l.flashApi&&(d.deflate=function(e){return n.util.deflate(l.flashApi,e,!0)},d.inflate=function(e){return n.util.inflate(l.flashApi,e,!0)}));for(var g=0;g100?(t.body=n.util.deflate(t.flashApi,t.body),t.bodyDeflated=!0,t.setField("Content-Encoding","deflate"),t.setField("Content-Length",t.body.length)):null!==t.body&&t.setField("Content-Length",t.body.length);var e=t.method.toUpperCase()+" "+t.path+" "+t.version+"\r\n";for(var r in t.fields)for(var a=t.fields[r],i=0;i=3)){var o=new Error("Invalid http response header.");throw o.details={line:r},o}a.version=n[0],a.code=parseInt(n[1],10),a.message=n.slice(2).join(" ")}else 0===r.length?a.headerReceived=!0:s(r);return a.headerReceived};return a.readBody=function(e){var o=a.getField("Content-Length"),c=a.getField("Transfer-Encoding");if(null!==o&&(o=parseInt(o)),null!==o&&o>=0)a.body=a.body||"",a.body+=e.getBytes(o),a.bodyReceived=a.body.length===o;else if(null!==c){if(-1==c.indexOf("chunked")){var u=new Error("Unknown Transfer-Encoding.");throw u.details={transferEncoding:c},u}a.body=a.body||"",function(e){for(var n="";null!==n&&e.length()>0;)if(t>0){if(t+2>e.length())break;a.body+=e.getBytes(t),e.getBytes(2),t=0}else if(r)for(n=i(e);null!==n;)n.length>0?(s(n),n=i(e)):(a.bodyReceived=!0,n=null);else null!==(n=i(e))&&(t=parseInt(n.split(";",1)[0],16),r=0===t);a.bodyReceived}(e)}else null!==o&&o<0||null===o&&null!==a.getField("Content-Type")?(a.body=a.body||"",a.body+=e.getBytes(),a.readBodyUntilClose=!0):(a.body=null,a.bodyReceived=!0);return a.bodyReceived&&(a.time=+new Date-a.time),null!==a.flashApi&&a.bodyReceived&&null!==a.body&&"deflate"===a.getField("Content-Encoding")&&(a.body=n.util.inflate(a.flashApi,a.body)),a.bodyReceived},a.getCookies=function(){var e=[];if("Set-Cookie"in a.fields)for(var t=a.fields["Set-Cookie"],r=+new Date/1e3,n=/\s*([^=]*)=?([^;]*)(;|$)/g,i=0;i0;)o.push(u%i),u=u/i|0}for(a=0;0===e[a]&&a=0;--a)n+=t[o[a]]}else n=function(e,t){var r=0,n=t.length,a=t.charAt(0),i=[0];for(r=0;r0;)i.push(o%n),o=o/n|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[i[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},r.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=n[t];if(!r){r=n[t]=[];for(var a=0;a>=8;for(;l>0;)o.push(255&l),l>>=8}for(var p=0;e[p]===s&&p=a.Versions.TLS_1_1.minor&&c.output.putBytes(r),c.update(e.fragment),c.finish(o)&&(e.fragment=c.output,e.length=e.fragment.length(),i=!0),i}function o(e,t,r){if(!r){var n=e-t.length()%e;t.fillWithByte(n-1,n)}return!0}function c(e,t,r){var n=!0;if(r){for(var a=t.length(),i=t.last(),s=a-1-i;s=o?(e.fragment=s.output.getBytes(l-o),u=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=n.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),i=function(e,t,r){var a=n.hmac.create();return a.start("SHA1",e),a.update(t),t=a.digest().getBytes(),a.start(null,null),a.update(r),r=a.digest().getBytes(),t===r}(t.macKey,u,p)&&i}a.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=a.BulkCipherAlgorithm.aes,e.cipher_type=a.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=a.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i},a.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=a.BulkCipherAlgorithm.aes,e.cipher_type=a.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=a.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i}},function(e,t,r){var n=r(0);r(31),e.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},function(e,t,r){var n=r(0);r(13),r(2),r(32),r(1);var a=r(44),i=a.publicKeyValidator,s=a.privateKeyValidator;if(void 0===o)var o=n.jsbn.BigInteger;var c=n.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;n.pki=n.pki||{},e.exports=n.pki.ed25519=n.ed25519=n.ed25519||{};var l=n.ed25519;function p(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var n=new u(t.length()),a=0;a=0;--r)x(n,n),1!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(r,r),K(r,r,a),K(r,r,i),K(r,r,i),K(e[0],r,i),x(n,e[0]),K(n,n,i),k(n,a)&&K(e[0],e[0],C);if(x(n,e[0]),K(n,n,i),k(n,a))return-1;w(e[0])===t[31]>>7&&V(e[0],f,e[0]);return K(e[3],e[0],e[1]),0}(o,n))return-1;for(a=0;a=0};var f=P(),h=P([1]),d=P([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=P([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=P([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=P([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),C=P([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(e,t){var r=n.md.sha512.create(),a=new c(e);r.update(a.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var s=new u(l.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)s[o]=i.charCodeAt(o);return s}function S(e,t){var r,n,a,i;for(n=63;n>=32;--n){for(r=0,a=n-32,i=n-12;a>8,t[a]-=256*r;t[a]+=r,t[n]=0}for(r=0,a=0;a<32;++a)t[a]+=r-(t[31]>>4)*m[a],r=t[a]>>8,t[a]&=255;for(a=0;a<32;++a)t[a]-=r*m[a];for(n=0;n<32;++n)t[n+1]+=t[n]>>8,e[n]=255&t[n]}function T(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;S(e,t)}function b(e,t){var r=P(),n=P(),a=P(),i=P(),s=P(),o=P(),c=P(),u=P(),l=P();V(r,e[1],e[0]),V(l,t[1],t[0]),K(r,r,l),O(n,e[0],e[1]),O(l,t[0],t[1]),K(n,n,l),K(a,e[3],t[3]),K(a,a,y),K(i,e[2],t[2]),O(i,i,i),V(s,n,r),V(o,i,a),O(c,i,a),O(u,n,r),K(e[0],s,o),K(e[1],u,c),K(e[2],c,o),K(e[3],s,u)}function I(e,t,r){for(var n=0;n<4;++n)D(e[n],t[n],r)}function A(e,t){var r=P(),n=P(),a=P();!function(e,t){var r,n=P();for(r=0;r<16;++r)n[r]=t[r];for(r=253;r>=0;--r)x(n,n),2!==r&&4!==r&&K(n,n,t);for(r=0;r<16;++r)e[r]=n[r]}(a,t[2]),K(r,t[0],a),K(n,t[1],a),B(e,n),e[31]^=w(r)<<7}function B(e,t){var r,n,a,i=P(),s=P();for(r=0;r<16;++r)s[r]=t[r];for(U(s),U(s),U(s),n=0;n<2;++n){for(i[0]=s[0]-65517,r=1;r<15;++r)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),a=i[15]>>16&1,i[14]&=65535,D(s,i,1-a)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function k(e,t){var r=new u(32),n=new u(32);return B(r,e),B(n,t),N(r,0,n,0)}function N(e,t,r,n){return function(e,t,r,n,a){var i,s=0;for(i=0;i>>8)-1}(e,t,r,n,32)}function w(e){var t=new u(32);return B(t,e),1&t[0]}function R(e,t,r){var n,a;for(_(e[0],f),_(e[1],h),_(e[2],h),_(e[3],f),a=255;a>=0;--a)I(e,t,n=r[a/8|0]>>(7&a)&1),b(t,e),b(e,e),I(e,t,n)}function L(e,t){var r=[P(),P(),P(),P()];_(r[0],g),_(r[1],v),_(r[2],h),K(r[3],g,v),R(e,r,t)}function _(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function U(e){var t,r,n=1;for(t=0;t<16;++t)r=e[t]+n+65535,n=Math.floor(r/65536),e[t]=r-65536*n;e[0]+=n-1+37*(n-1)}function D(e,t,r){for(var n,a=~(r-1),i=0;i<16;++i)n=a&(e[i]^t[i]),e[i]^=n,t[i]^=n}function P(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(s=n.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,i)}},decrypt:function(t,r,n){var a=t.decrypt(r,"NONE");return e.generate(a,n)}};return i},n.kem.kdf1=function(e,t){i(this,e,0,t||e.digestLength)},n.kem.kdf2=function(e,t){i(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(15),r(9),r(24),r(32)},function(e,t,r){var n=r(0);r(5),r(3),r(11),r(6),r(7),r(30),r(2),r(1),r(18);var a=n.asn1,i=e.exports=n.pkcs7=n.pkcs7||{};function s(e){var t={},r=[];if(!a.validate(e,i.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(t.issuer),serialNumber:n.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:a.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){for(var t,r=[],i=0;i0){for(var r=a.create(a.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&s0&&s.value[0].value.push(a.create(a.Class.CONTEXT_SPECIFIC,0,!0,t)),i.length>0&&s.value[0].value.push(a.create(a.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(a.create(a.Class.UNIVERSAL,a.Type.SET,!0,e.signerInfos)),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,a=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=n.pki.certificateFromPem(i)),r=i.issuer.attributes,a=i.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=n.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||n.pki.oids.sha1;switch(o){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,p=0;p="8"&&(r="00"+r);var a=n.util.hexToBytes(r);e.putInt32(a.length),e.putBytes(a)}function s(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=n.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=g[this.state].block)},v.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==f&&(this.state=u,m(this,0)),this.blocks},v.prototype.sleep=function(e){e=void 0===e?0:e,this.state=g[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=u,m(t,0)}),e)},v.prototype.wait=function(e){e.wait(this)},v.prototype.wakeup=function(){this.state===p&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=u,m(this,0))},v.prototype.cancel=function(){this.state=g[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},v.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,m(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var m=function(e,t){var r=t>30||+new Date-e.swapTime>20,n=function(t){if(t++,e.state===u)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var n=e.subtasks.shift();n.error=e.error,n.swapTime=e.swapTime,n.userData=e.userData,n.run(n),n.error||m(n,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,m(e.parent,t))};r?setTimeout(n,0):n(t)},C=function(e,t){e.state=f,delete i[e.id],null===e.parent&&(e.type in o?0===o[e.type].length?n.log.error(a,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):o[e.type][0]!==e?n.log.error(a,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(o[e.type].shift(),0===o[e.type].length?delete o[e.type]:o[e.type][0].start()):n.log.error(a,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=n.task=n.task||{},n.task.start=function(e){var t=new v({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in o?o[e.type].push(t):(o[t.type]=[t],function(e){e.error=!1,e.state=g[e.state][y],setTimeout((function(){e.state===u&&(e.swapTime=+new Date,e.run(e),m(e,0))}),0)}(t))},n.task.cancel=function(e){e in o&&(o[e]=[o[e][0]])},n.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}},function(e,t,r){var n,a,i,s=r(0),o=e.exports=s.form=s.form||{};n=jQuery,a=/([^\[]*?)\[(.*?)\]/g,i=function(e,t,r,i){for(var s=[],o=0;o0&&r.push(t[1]),t.length>=2&&r.push(t[2]);return 0===r.length&&r.push(e),r}(t))})),t=s,n.each(t,(function(a,s){if(i&&0!==s.length&&s in i&&(s=i[s]),0===s.length&&(s=e.length),e[s])a==t.length-1?(n.isArray(e[s])||(e[s]=[e[s]]),e[s].push(r)):e=e[s];else if(a==t.length-1)e[s]=r;else{var o=t[a+1];if(0===o.length)e[s]=[];else{var c=o-0==o&&o.length>0;e[s]=c?[]:{}}e=e[s]}}))},o.serialize=function(e,t,r){var a={};return t=t||".",n.each(e.serializeArray(),(function(){i(a,this.name.split(t),this.value||"",r)})),a}},function(e,t,r){var n=r(0);r(10),n.tls.wrapSocket=function(e){var t=e.socket,r={id:t.id,connected:t.connected||function(e){},closed:t.closed||function(e){},data:t.data||function(e){},error:t.error||function(e){}},a=n.tls.createConnection({server:!1,sessionId:e.sessionId||null,caStore:e.caStore||[],sessionCache:e.sessionCache||null,cipherSuites:e.cipherSuites||null,virtualHost:e.virtualHost,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature,deflate:e.deflate,inflate:e.inflate,connected:function(e){1===e.handshakes&&r.connected({id:t.id,type:"connect",bytesAvailable:e.data.length()})},tlsDataReady:function(e){return t.send(e.tlsData.getBytes())},dataReady:function(e){r.data({id:t.id,type:"socketData",bytesAvailable:e.data.length()})},closed:function(e){t.close()},error:function(e,n){r.error({id:t.id,type:"tlsError",message:n.message,bytesAvailable:0,error:n}),t.close()}});t.connected=function(t){a.handshake(e.sessionId)},t.closed=function(e){a.open&&a.handshaking&&r.error({id:t.id,type:"ioError",message:"Connection closed during handshake.",bytesAvailable:0}),a.close(),r.closed({id:t.id,type:"close",bytesAvailable:0})},t.error=function(e){r.error({id:t.id,type:e.type,message:e.message,bytesAvailable:0}),a.close()};var i=0;return t.data=function(e){if(a.open){if(e.bytesAvailable>=i){var r=Math.max(e.bytesAvailable,i),n=t.receive(r);null!==n&&(i=a.process(n))}}else t.receive(e.bytesAvailable)},r.destroy=function(){t.destroy()},r.setSessionCache=function(e){a.sessionCache=tls.createSessionCache(e)},r.connect=function(e){t.connect(e)},r.close=function(){a.close()},r.isConnected=function(){return a.isConnected&&t.isConnected()},r.send=function(e){return a.prepare(e)},r.receive=function(e){return a.data.getBytes(e)},r.bytesAvailable=function(){return a.data.length()},r}},function(e,t,r){var n=r(0);r(34),r(35);var a,i,s,o,c,u,l,p,f,h,d=e.exports=n.xhr=n.xhr||{};a=jQuery,i="forge.xhr",s=null,o=0,c=null,u=null,l={},p=10,f=n.net,h=n.http,d.init=function(e){n.log.debug(i,"initializing",e),o=e.policyPort||o,c=e.policyUrl||c,p=e.connections||p,s=f.createSocketPool({flashId:e.flashId,policyPort:o,policyUrl:c,msie:e.msie||!1}),u=h.createClient({url:e.url||window.location.protocol+"//"+window.location.host,socketPool:s,policyPort:o,policyUrl:c,connections:e.connections||p,caCerts:e.caCerts,cipherSuites:e.cipherSuites,persistCookies:e.persistCookies||!0,primeTlsSockets:e.primeTlsSockets||!1,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature}),l[u.url.full]=u,n.log.debug(i,"ready")},d.cleanup=function(){for(var e in l)l[e].destroy();l={},u=null,s.destroy(),s=null},d.setCookie=function(e){if(e.maxAge=e.maxAge||-1,e.domain)for(var t in l){var r=l[t];h.withinCookieDomain(r.url,e)&&r.secure===e.secure&&r.setCookie(e)}else u.setCookie(e)},d.getCookie=function(e,t,r){var a=null;if(r)for(var i in l){var s=l[i];if(h.withinCookieDomain(s.url,r)){var o=s.getCookie(e,t);null!==o&&(null===a?a=o:n.util.isArray(a)?a.push(o):a=[a,o])}}else a=u.getCookie(e,t);return a},d.removeCookie=function(e,t,r){var n=!1;if(r)for(var a in l){var i=l[a];h.withinCookieDomain(i.url,r)&&i.removeCookie(e,t)&&(n=!0)}else n=u.removeCookie(e,t);return n},d.create=function(e){e=a.extend({logWarningOnError:!0,verbose:!1,logError:function(){},logWarning:function(){},logDebug:function(){},logVerbose:function(){},url:null},e||{});var t={client:null,request:null,response:null,asynchronous:!0,sendFlag:!1,errorFlag:!1},r={error:e.logError||n.log.error,warning:e.logWarning||n.log.warning,debug:e.logDebug||n.log.debug,verbose:e.logVerbose||n.log.verbose},f={onreadystatechange:null,readyState:0,responseText:"",responseXML:null,status:0,statusText:""};if(null===e.url)t.client=u;else{var d=h.parseUrl(e.url);d||(new Error("Invalid url.").details={url:e.url}),d.full in l?t.client=l[d.full]:(t.client=h.createClient({url:e.url,socketPool:s,policyPort:e.policyPort||o,policyUrl:e.policyUrl||c,connections:e.connections||p,caCerts:e.caCerts,cipherSuites:e.cipherSuites,persistCookies:e.persistCookies||!0,primeTlsSockets:e.primeTlsSockets||!1,verify:e.verify,getCertificate:e.getCertificate,getPrivateKey:e.getPrivateKey,getSignature:e.getSignature}),l[d.full]=t.client)}return f.open=function(e,r,n,a,i){switch(e){case"DELETE":case"GET":case"HEAD":case"OPTIONS":case"PATCH":case"POST":case"PUT":break;case"CONNECT":case"TRACE":case"TRACK":throw new Error("CONNECT, TRACE and TRACK methods are disallowed");default:throw new Error("Invalid method: "+e)}t.sendFlag=!1,f.responseText="",f.responseXML=null,f.status=0,f.statusText="",t.request=h.createRequest({method:e,path:r}),f.readyState=1,f.onreadystatechange&&f.onreadystatechange()},f.setRequestHeader=function(e,r){if(1!=f.readyState||t.sendFlag)throw new Error("XHR not open or sending");t.request.setField(e,r)},f.send=function(e){if(1!=f.readyState||t.sendFlag)throw new Error("XHR not open or sending");if(e&&"GET"!==t.request.method&&"HEAD"!==t.request.method)if("undefined"!=typeof XMLSerializer)if(e instanceof Document){var n=new XMLSerializer;t.request.body=n.serializeToString(e)}else t.request.body=e;else void 0!==e.xml?t.request.body=e.xml:t.request.body=e;t.errorFlag=!1,t.sendFlag=!0,f.onreadystatechange&&f.onreadystatechange();var a={};a.request=t.request,a.headerReady=function(e){f.cookies=t.client.cookies,f.readyState=2,f.status=e.response.code,f.statusText=e.response.message,t.response=e.response,f.onreadystatechange&&f.onreadystatechange(),t.response.aborted||(f.readyState=3,f.onreadystatechange&&f.onreadystatechange())},a.bodyReady=function(e){f.readyState=4;var n=e.response.getField("Content-Type");if(n&&(0===n.indexOf("text/xml")||0===n.indexOf("application/xml")||-1!==n.indexOf("+xml")))try{var s=new ActiveXObject("MicrosoftXMLDOM");s.async=!1,s.loadXML(e.response.body),f.responseXML=s}catch(e){var o=new DOMParser;f.responseXML=o.parseFromString(e.body,"text/xml")}var c=0;null!==e.response.body&&(f.responseText=e.response.body,c=e.response.body.length);var u=t.request,l=u.method+" "+u.path+" "+f.status+" "+f.statusText+" "+c+"B "+(e.request.connectTime+e.request.time+e.response.time)+"ms";a.verbose?(f.status>=400&&a.logWarningOnError?r.warning:r.verbose)(i,l,e,e.response.body?"\n"+e.response.body:"\nNo content"):(f.status>=400&&a.logWarningOnError?r.warning:r.debug)(i,l),f.onreadystatechange&&f.onreadystatechange()},a.error=function(e){var n=t.request;r.error(i,n.method+" "+n.path,e),f.responseText="",f.responseXML=null,t.errorFlag=!0,f.status=0,f.statusText="",f.readyState=4,f.onreadystatechange&&f.onreadystatechange()},t.client.send(a)},f.abort=function(){t.request.abort(),f.responseText="",f.responseXML=null,t.errorFlag=!0,f.status=0,f.statusText="",t.request=null,t.response=null,4===f.readyState||0===f.readyState||1===f.readyState&&!t.sendFlag||(f.readyState=4,t.sendFlag=!1,f.onreadystatechange&&f.onreadystatechange()),f.readyState=0},f.getAllResponseHeaders=function(){var e="";if(null!==t.response){var r=t.response.fields;a.each(r,(function(t,r){a.each(r,(function(r,n){e+=t+": "+n+"\r\n"}))}))}return e},f.getResponseHeader=function(e){var r=null;return null!==t.response&&e in t.response.fields&&(r=t.response.fields[e],n.util.isArray(r)&&(r=r.join())),r},f}}])})); -//# sourceMappingURL=forge.all.min.js.map \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js.map b/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js.map deleted file mode 100644 index 225d220e..00000000 --- a/reverse_engineering/node_modules/node-forge/dist/forge.all.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"forge.all.min.js","sources":["webpack://[name]/forge.all.min.js"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-forge/dist/forge.min.js b/reverse_engineering/node_modules/node-forge/dist/forge.min.js deleted file mode 100644 index 997e6d78..00000000 --- a/reverse_engineering/node_modules/node-forge/dist/forge.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.forge=t():e.forge=t()}(window,(function(){return function(e){var t={};function r(a){if(t[a])return t[a].exports;var n=t[a]={i:a,l:!1,exports:{}};return e[a].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,a){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:a})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var a=Object.create(null);if(r.r(a),Object.defineProperty(a,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(a,n,function(t){return e[t]}.bind(null,n));return a},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=34)}([function(e,t){e.exports={options:{usePureJavaScript:!1}}},function(e,t,r){(function(t){var a=r(0),n=r(37),i=e.exports=a.util=a.util||{};function s(e){if(8!==e&&16!==e&&24!==e&&32!==e)throw new Error("Only 8, 16, 24, or 32 bits supported: "+e)}function o(e){if(this.data="",this.read=0,"string"==typeof e)this.data=e;else if(i.isArrayBuffer(e)||i.isArrayBufferView(e))if("undefined"!=typeof Buffer&&e instanceof Buffer)this.data=e.toString("binary");else{var t=new Uint8Array(e);try{this.data=String.fromCharCode.apply(null,t)}catch(e){for(var r=0;r15?(r=Date.now(),s(e)):(t.push(e),1===t.length&&n.setAttribute("a",a=!a))}}i.nextTick=i.setImmediate}(),i.isNodejs="undefined"!=typeof process&&process.versions&&process.versions.node,i.globalScope=i.isNodejs?t:"undefined"==typeof self?window:self,i.isArray=Array.isArray||function(e){return"[object Array]"===Object.prototype.toString.call(e)},i.isArrayBuffer=function(e){return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer},i.isArrayBufferView=function(e){return e&&i.isArrayBuffer(e.buffer)&&void 0!==e.byteLength},i.ByteBuffer=o,i.ByteStringBuffer=o;i.ByteStringBuffer.prototype._optimizeConstructedString=function(e){this._constructedStringLength+=e,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(e){return this.putBytes(String.fromCharCode(e))},i.ByteStringBuffer.prototype.fillWithByte=function(e,t){e=String.fromCharCode(e);for(var r=this.data;t>0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return this.data=r,this._optimizeConstructedString(t),this},i.ByteStringBuffer.prototype.putBytes=function(e){return this.data+=e,this._optimizeConstructedString(e.length),this},i.ByteStringBuffer.prototype.putString=function(e){return this.putBytes(i.encodeUtf8(e))},i.ByteStringBuffer.prototype.putInt16=function(e){return this.putBytes(String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt24=function(e){return this.putBytes(String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt32=function(e){return this.putBytes(String.fromCharCode(e>>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e))},i.ByteStringBuffer.prototype.putInt16Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255))},i.ByteStringBuffer.prototype.putInt32Le=function(e){return this.putBytes(String.fromCharCode(255&e)+String.fromCharCode(e>>8&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>24&255))},i.ByteStringBuffer.prototype.putInt=function(e,t){s(t);var r="";do{t-=8,r+=String.fromCharCode(e>>t&255)}while(t>0);return this.putBytes(r)},i.ByteStringBuffer.prototype.putSignedInt=function(e,t){return e<0&&(e+=2<0);return t},i.ByteStringBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.ByteStringBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.ByteStringBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.ByteStringBuffer.prototype.at=function(e){return this.data.charCodeAt(this.read+e)},i.ByteStringBuffer.prototype.setAt=function(e,t){return this.data=this.data.substr(0,this.read+e)+String.fromCharCode(t)+this.data.substr(this.read+e+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var e=i.createBuffer(this.data);return e.read=this.read,e},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(e){var t=Math.max(0,this.length()-e);return this.data=this.data.substr(this.read,t),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var e="",t=this.read;t=e)return this;t=Math.max(t||this.growSize,e);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),a=new Uint8Array(this.length()+t);return a.set(r),this.data=new DataView(a.buffer),this},i.DataBuffer.prototype.putByte=function(e){return this.accommodate(1),this.data.setUint8(this.write++,e),this},i.DataBuffer.prototype.fillWithByte=function(e,t){this.accommodate(t);for(var r=0;r>8&65535),this.data.setInt8(this.write,e>>16&255),this.write+=3,this},i.DataBuffer.prototype.putInt32=function(e){return this.accommodate(4),this.data.setInt32(this.write,e),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(e){return this.accommodate(2),this.data.setInt16(this.write,e,!0),this.write+=2,this},i.DataBuffer.prototype.putInt24Le=function(e){return this.accommodate(3),this.data.setInt8(this.write,e>>16&255),this.data.setInt16(this.write,e>>8&65535,!0),this.write+=3,this},i.DataBuffer.prototype.putInt32Le=function(e){return this.accommodate(4),this.data.setInt32(this.write,e,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(e,t){s(t),this.accommodate(t/8);do{t-=8,this.data.setInt8(this.write++,e>>t&255)}while(t>0);return this},i.DataBuffer.prototype.putSignedInt=function(e,t){return s(t),this.accommodate(t/8),e<0&&(e+=2<0);return t},i.DataBuffer.prototype.getSignedInt=function(e){var t=this.getInt(e),r=2<=r&&(t-=r<<1),t},i.DataBuffer.prototype.getBytes=function(e){var t;return e?(e=Math.min(this.length(),e),t=this.data.slice(this.read,this.read+e),this.read+=e):0===e?t="":(t=0===this.read?this.data:this.data.slice(this.read),this.clear()),t},i.DataBuffer.prototype.bytes=function(e){return void 0===e?this.data.slice(this.read):this.data.slice(this.read,this.read+e)},i.DataBuffer.prototype.at=function(e){return this.data.getUint8(this.read+e)},i.DataBuffer.prototype.setAt=function(e,t){return this.data.setUint8(e,t),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var e=new Uint8Array(this.data.buffer,this.read),t=new Uint8Array(e.byteLength);t.set(e),this.data=new DataView(t),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(e){return this.write=Math.max(0,this.length()-e),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var e="",t=this.read;t0;)1&t&&(r+=e),(t>>>=1)>0&&(e+=e);return r},i.xorBytes=function(e,t,r){for(var a="",n="",i="",s=0,o=0;r>0;--r,++s)n=e.charCodeAt(s)^t.charCodeAt(s),o>=10&&(a+=i,i="",o=0),i+=String.fromCharCode(n),++o;return a+=i},i.hexToBytes=function(e){var t="",r=0;for(!0&e.length&&(r=1,t+=String.fromCharCode(parseInt(e[0],16)));r>24&255)+String.fromCharCode(e>>16&255)+String.fromCharCode(e>>8&255)+String.fromCharCode(255&e)};var c="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",u=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(e,t){for(var r,a,n,i="",s="",o=0;o>2),i+=c.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=c.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":c.charAt(63&n)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.decode64=function(e){e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var t,r,a,n,i="",s=0;s>4),64!==a&&(i+=String.fromCharCode((15&r)<<4|a>>2),64!==n&&(i+=String.fromCharCode((3&a)<<6|n)));return i},i.encodeUtf8=function(e){return unescape(encodeURIComponent(e))},i.decodeUtf8=function(e){return decodeURIComponent(escape(e))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:n.encode,decode:n.decode}},i.binary.raw.encode=function(e){return String.fromCharCode.apply(null,e)},i.binary.raw.decode=function(e,t,r){var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,i=0;i>2),i+=c.charAt((3&r)<<4|a>>4),isNaN(a)?i+="==":(i+=c.charAt((15&a)<<2|n>>6),i+=isNaN(n)?"=":c.charAt(63&n)),t&&i.length>t&&(s+=i.substr(0,t)+"\r\n",i=i.substr(t));return s+=i},i.binary.base64.decode=function(e,t,r){var a,n,i,s,o=t;o||(o=new Uint8Array(3*Math.ceil(e.length/4))),e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var c=0,l=r=r||0;c>4,64!==i&&(o[l++]=(15&n)<<4|i>>2,64!==s&&(o[l++]=(3&i)<<6|s));return t?l-r:o.subarray(0,l)},i.binary.base58.encode=function(e,t){return i.binary.baseN.encode(e,l,t)},i.binary.base58.decode=function(e,t){return i.binary.baseN.decode(e,l,t)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(e,t,r){e=i.encodeUtf8(e);var a=t;a||(a=new Uint8Array(e.length));for(var n=r=r||0,s=0;s0?(n=r[a].substring(0,s),i=r[a].substring(s+1)):(n=r[a],i=null),n in t||(t[n]=[]),n in Object.prototype||null===i||t[n].push(unescape(i))}return t};return void 0===e?(null===v&&(v="undefined"!=typeof window&&window.location&&window.location.search?r(window.location.search.substring(1)):{}),t=v):t=r(e),t},i.parseFragment=function(e){var t=e,r="",a=e.indexOf("?");a>0&&(t=e.substring(0,a),r=e.substring(a+1));var n=t.split("/");return n.length>0&&""===n[0]&&n.shift(),{pathString:t,queryString:r,path:n,query:""===r?{}:i.getQueryVariables(r)}},i.makeRequest=function(e){var t=i.parseFragment(e),r={path:t.pathString,query:t.queryString,getPath:function(e){return void 0===e?t.path:t.path[e]},getQuery:function(e,r){var a;return void 0===e?a=t.query:(a=t.query[e])&&void 0!==r&&(a=a[r]),a},getQueryLast:function(e,t){var a=r.getQuery(e);return a?a[a.length-1]:t}};return r},i.makeLink=function(e,t,r){e=jQuery.isArray(e)?e.join("/"):e;var a=jQuery.param(t||{});return r=r||"",e+(a.length>0?"?"+a:"")+(r.length>0?"#"+r:"")},i.isEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},i.format=function(e){for(var t,r,a=/%./g,n=0,i=[],s=0;t=a.exec(e);){(r=e.substring(s,a.lastIndex-2)).length>0&&i.push(r),s=a.lastIndex;var o=t[0][1];switch(o){case"s":case"o":n");break;case"%":i.push("%");break;default:i.push("<%"+o+"?>")}}return i.push(e.substring(s)),i.join("")},i.formatNumber=function(e,t,r,a){var n=e,i=isNaN(t=Math.abs(t))?2:t,s=void 0===r?",":r,o=void 0===a?".":a,c=n<0?"-":"",u=parseInt(n=Math.abs(+n||0).toFixed(i),10)+"",l=u.length>3?u.length%3:0;return c+(l?u.substr(0,l)+o:"")+u.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(i?s+Math.abs(n-u).toFixed(i).slice(2):"")},i.formatSize=function(e){return e=e>=1073741824?i.formatNumber(e/1073741824,2,".","")+" GiB":e>=1048576?i.formatNumber(e/1048576,2,".","")+" MiB":e>=1024?i.formatNumber(e/1024,0)+" KiB":i.formatNumber(e,0)+" bytes"},i.bytesFromIP=function(e){return-1!==e.indexOf(".")?i.bytesFromIPv4(e):-1!==e.indexOf(":")?i.bytesFromIPv6(e):null},i.bytesFromIPv4=function(e){if(4!==(e=e.split(".")).length)return null;for(var t=i.createBuffer(),r=0;rr[a].end-r[a].start&&(a=r.length-1)):r.push({start:c,end:c})}t.push(s)}if(r.length>0){var u=r[a];u.end-u.start>0&&(t.splice(u.start,u.end-u.start+1,""),0===u.start&&t.unshift(""),7===u.end&&t.push(""))}return t.join(":")},i.estimateCores=function(e,t){if("function"==typeof e&&(t=e,e={}),e=e||{},"cores"in i&&!e.update)return t(null,i.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,t(null,i.cores);if("undefined"==typeof Worker)return i.cores=1,t(null,i.cores);if("undefined"==typeof Blob)return i.cores=2,t(null,i.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(e){for(var t=Date.now(),r=t+4;Date.now()o.st&&n.stn.st&&o.stt){var a=new Error("Too few bytes to parse DER.");throw a.available=e.length(),a.remaining=t,a.requested=r,a}}n.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},n.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},n.create=function(e,t,r,i,s){if(a.util.isArray(i)){for(var o=[],c=0;cr){if(s.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=r,d.requested=h,d}h=r}var y=32==(32&c);if(y)if(p=[],void 0===h)for(;;){if(i(t,r,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),r-=2;break}o=t.length(),p.push(e(t,r,a+1,s)),r-=o-t.length()}else for(;h>0;)o=t.length(),p.push(e(t,h,a+1,s)),r-=o-t.length(),h-=o-t.length();void 0===p&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&(f=t.bytes(h));if(void 0===p&&s.decodeBitStrings&&u===n.Class.UNIVERSAL&&l===n.Type.BITSTRING&&h>1){var g=t.read,m=r,v=0;if(l===n.Type.BITSTRING&&(i(t,r,1),v=t.getByte(),r--),0===v)try{o=t.length();var C={verbose:s.verbose,strict:!0,decodeBitStrings:!0},E=e(t,r,a+1,C),S=o-t.length();r-=S,l==n.Type.BITSTRING&&S++;var T=E.tagClass;S!==h||T!==n.Class.UNIVERSAL&&T!==n.Class.CONTEXT_SPECIFIC||(p=[E])}catch(e){}void 0===p&&(t.read=g,r=m)}if(void 0===p){if(void 0===h){if(s.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");h=r}if(l===n.Type.BMPSTRING)for(p="";h>0;h-=2)i(t,r,2),p+=String.fromCharCode(t.getInt16()),r-=2;else p=t.getBytes(h)}var I=void 0===f?null:{bitStringContents:f};return n.create(u,l,y,p,I)}(e,e.length(),0,t)},n.toDer=function(e){var t=a.util.createBuffer(),r=e.tagClass|e.type,i=a.util.createBuffer(),s=!1;if("bitStringContents"in e&&(s=!0,e.original&&(s=n.equals(e,e.original))),s)i.putBytes(e.bitStringContents);else if(e.composed){e.constructed?r|=32:i.putByte(0);for(var o=0;o1&&(0===e.value.charCodeAt(0)&&0==(128&e.value.charCodeAt(1))||255===e.value.charCodeAt(0)&&128==(128&e.value.charCodeAt(1)))?i.putBytes(e.value.substr(1)):i.putBytes(e.value);if(t.putByte(r),i.length()<=127)t.putByte(127&i.length());else{var c=i.length(),u="";do{u+=String.fromCharCode(255&c),c>>>=8}while(c>0);t.putByte(128|u.length);for(o=u.length-1;o>=0;--o)t.putByte(u.charCodeAt(o))}return t.putBuffer(i),t},n.oidToDer=function(e){var t,r,n,i,s=e.split("."),o=a.util.createBuffer();o.putByte(40*parseInt(s[0],10)+parseInt(s[1],10));for(var c=2;c>>=7,t||(i|=128),r.push(i),t=!1}while(n>0);for(var u=r.length-1;u>=0;--u)o.putByte(r[u])}return o},n.derToOid=function(e){var t;"string"==typeof e&&(e=a.util.createBuffer(e));var r=e.getByte();t=Math.floor(r/40)+"."+r%40;for(var n=0;e.length()>0;)n<<=7,128&(r=e.getByte())?n+=127&r:(t+="."+(n+r),n=0);return t},n.utcTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,2),10);r=r>=50?1900+r:2e3+r;var a=parseInt(e.substr(2,2),10)-1,n=parseInt(e.substr(4,2),10),i=parseInt(e.substr(6,2),10),s=parseInt(e.substr(8,2),10),o=0;if(e.length>11){var c=e.charAt(10),u=10;"+"!==c&&"-"!==c&&(o=parseInt(e.substr(10,2),10),u+=2)}if(t.setUTCFullYear(r,a,n),t.setUTCHours(i,s,o,0),u&&("+"===(c=e.charAt(u))||"-"===c)){var l=60*parseInt(e.substr(u+1,2),10)+parseInt(e.substr(u+4,2),10);l*=6e4,"+"===c?t.setTime(+t-l):t.setTime(+t+l)}return t},n.generalizedTimeToDate=function(e){var t=new Date,r=parseInt(e.substr(0,4),10),a=parseInt(e.substr(4,2),10)-1,n=parseInt(e.substr(6,2),10),i=parseInt(e.substr(8,2),10),s=parseInt(e.substr(10,2),10),o=parseInt(e.substr(12,2),10),c=0,u=0,l=!1;"Z"===e.charAt(e.length-1)&&(l=!0);var p=e.length-5,f=e.charAt(p);"+"!==f&&"-"!==f||(u=60*parseInt(e.substr(p+1,2),10)+parseInt(e.substr(p+4,2),10),u*=6e4,"+"===f&&(u*=-1),l=!0);return"."===e.charAt(14)&&(c=1e3*parseFloat(e.substr(14),10)),l?(t.setUTCFullYear(r,a,n),t.setUTCHours(i,s,o,c),t.setTime(+t+u)):(t.setFullYear(r,a,n),t.setHours(i,s,o,c)),t},n.dateToUtcTime=function(e){if("string"==typeof e)return e;var t="",r=[];r.push((""+e.getUTCFullYear()).substr(2)),r.push(""+(e.getUTCMonth()+1)),r.push(""+e.getUTCDate()),r.push(""+e.getUTCHours()),r.push(""+e.getUTCMinutes()),r.push(""+e.getUTCSeconds());for(var a=0;a=-128&&e<128)return t.putSignedInt(e,8);if(e>=-32768&&e<32768)return t.putSignedInt(e,16);if(e>=-8388608&&e<8388608)return t.putSignedInt(e,24);if(e>=-2147483648&&e<2147483648)return t.putSignedInt(e,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=e,r},n.derToInteger=function(e){"string"==typeof e&&(e=a.util.createBuffer(e));var t=8*e.length();if(t>32)throw new Error("Integer too large; max is 32-bits.");return e.getSignedInt(t)},n.validate=function(e,t,r,i){var s=!1;if(e.tagClass!==t.tagClass&&void 0!==t.tagClass||e.type!==t.type&&void 0!==t.type)i&&(e.tagClass!==t.tagClass&&i.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+e.tagClass+'"'),e.type!==t.type&&i.push("["+t.name+'] Expected type "'+t.type+'", got "'+e.type+'"'));else if(e.constructed===t.constructed||void 0===t.constructed){if(s=!0,t.value&&a.util.isArray(t.value))for(var o=0,c=0;s&&c0&&(i+="\n");for(var o="",c=0;c1?i+="0x"+a.util.bytesToHex(e.value.slice(1)):i+="(none)",e.value.length>0){var f=e.value.charCodeAt(0);1==f?i+=" (1 unused bit shown)":f>1&&(i+=" ("+f+" unused bits shown)")}}else e.type===n.Type.OCTETSTRING?(s.test(e.value)||(i+="("+e.value+") "),i+="0x"+a.util.bytesToHex(e.value)):e.type===n.Type.UTF8?i+=a.util.decodeUtf8(e.value):e.type===n.Type.PRINTABLESTRING||e.type===n.Type.IA5String?i+=e.value:s.test(e.value)?i+="0x"+a.util.bytesToHex(e.value):0===e.value.length?i+="[null]":i+=e.value}return i}},function(e,t,r){var a=r(0);e.exports=a.md=a.md||{},a.md.algorithms=a.md.algorithms||{}},function(e,t,r){var a=r(0);function n(e,t){a.cipher.registerAlgorithm(e,(function(){return new a.aes.Algorithm(e,t)}))}r(13),r(19),r(1),e.exports=a.aes=a.aes||{},a.aes.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a});return n.start(t),n},a.aes.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},a.aes.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a});return n.start(t),n},a.aes.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},a.aes.Algorithm=function(e,t){l||p();var r=this;r.name=e,r.mode=new t({blockSize:16,cipher:{encrypt:function(e,t){return h(r._w,e,t,!1)},decrypt:function(e,t){return h(r._w,e,t,!0)}}}),r._init=!1},a.aes.Algorithm.prototype.initialize=function(e){if(!this._init){var t,r=e.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(a.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){t=r,r=a.util.createBuffer();for(var n=0;n>>=2;for(n=0;n>8^255&p^99,i[y]=p,s[p]=y,h=(f=e[p])<<24^p<<16^p<<8^p^f,d=((r=e[y])^(a=e[r])^(n=e[a]))<<24^(y^n)<<16^(y^a^n)<<8^y^r^n;for(var m=0;m<4;++m)c[m][y]=h,u[m][p]=d,h=h<<24|h>>>8,d=d<<24|d>>>8;0===y?y=g=1:(y=r^e[e[e[r^n]]],g^=e[e[g]])}}function f(e,t){for(var r,a=e.slice(0),n=1,s=a.length,c=4*(s+6+1),l=s;l>>16&255]<<24^i[r>>>8&255]<<16^i[255&r]<<8^i[r>>>24]^o[n]<<24,n++):s>6&&l%s==4&&(r=i[r>>>24]<<24^i[r>>>16&255]<<16^i[r>>>8&255]<<8^i[255&r]),a[l]=a[l-s]^r;if(t){for(var p,f=u[0],h=u[1],d=u[2],y=u[3],g=a.slice(0),m=(l=0,(c=a.length)-4);l>>24]]^h[i[p>>>16&255]]^d[i[p>>>8&255]]^y[i[255&p]];a=g}return a}function h(e,t,r,a){var n,o,l,p,f,h,d,y,g,m,v,C,E=e.length/4-1;a?(n=u[0],o=u[1],l=u[2],p=u[3],f=s):(n=c[0],o=c[1],l=c[2],p=c[3],f=i),h=t[0]^e[0],d=t[a?3:1]^e[1],y=t[2]^e[2],g=t[a?1:3]^e[3];for(var S=3,T=1;T>>24]^o[d>>>16&255]^l[y>>>8&255]^p[255&g]^e[++S],v=n[d>>>24]^o[y>>>16&255]^l[g>>>8&255]^p[255&h]^e[++S],C=n[y>>>24]^o[g>>>16&255]^l[h>>>8&255]^p[255&d]^e[++S],g=n[g>>>24]^o[h>>>16&255]^l[d>>>8&255]^p[255&y]^e[++S],h=m,d=v,y=C;r[0]=f[h>>>24]<<24^f[d>>>16&255]<<16^f[y>>>8&255]<<8^f[255&g]^e[++S],r[a?3:1]=f[d>>>24]<<24^f[y>>>16&255]<<16^f[g>>>8&255]<<8^f[255&h]^e[++S],r[2]=f[y>>>24]<<24^f[g>>>16&255]<<16^f[h>>>8&255]<<8^f[255&d]^e[++S],r[a?1:3]=f[g>>>24]<<24^f[h>>>16&255]<<16^f[d>>>8&255]<<8^f[255&y]^e[++S]}function d(e){var t,r="AES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?a.cipher.createDecipher(r,e.key):a.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof a.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}},function(e,t,r){var a=r(0);a.pki=a.pki||{};var n=e.exports=a.pki.oids=a.oids=a.oids||{};function i(e,t){n[e]=t,n[t]=e}function s(e,t){n[e]=t}i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.5","serialName"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),s("2.5.29.1","authorityKeyIdentifier"),s("2.5.29.2","keyAttributes"),s("2.5.29.3","certificatePolicies"),s("2.5.29.4","keyUsageRestriction"),s("2.5.29.5","policyMapping"),s("2.5.29.6","subtreesConstraint"),s("2.5.29.7","subjectAltName"),s("2.5.29.8","issuerAltName"),s("2.5.29.9","subjectDirectoryAttributes"),s("2.5.29.10","basicConstraints"),s("2.5.29.11","nameConstraints"),s("2.5.29.12","policyConstraints"),s("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),s("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),s("2.5.29.20","cRLNumber"),s("2.5.29.21","cRLReason"),s("2.5.29.22","expirationDate"),s("2.5.29.23","instructionCode"),s("2.5.29.24","invalidityDate"),s("2.5.29.25","cRLDistributionPoints"),s("2.5.29.26","issuingDistributionPoint"),s("2.5.29.27","deltaCRLIndicator"),s("2.5.29.28","issuingDistributionPoint"),s("2.5.29.29","certificateIssuer"),s("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),s("2.5.29.33","policyMappings"),s("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),s("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),s("2.5.29.46","freshestCRL"),s("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping")},function(e,t,r){var a=r(0);r(1);var n=e.exports=a.pem=a.pem||{};function i(e){for(var t=e.name+": ",r=[],a=function(e,t){return" "+t},n=0;n65&&-1!==s){var o=t[s];","===o?(++s,t=t.substr(0,s)+"\r\n "+t.substr(s)):t=t.substr(0,s)+"\r\n"+o+t.substr(s+1),i=n-s-1,s=-1,++n}else" "!==t[n]&&"\t"!==t[n]&&","!==t[n]||(s=n);return t}function s(e){return e.replace(/^\s+/,"")}n.encode=function(e,t){t=t||{};var r,n="-----BEGIN "+e.type+"-----\r\n";if(e.procType&&(n+=i(r={name:"Proc-Type",values:[String(e.procType.version),e.procType.type]})),e.contentDomain&&(n+=i(r={name:"Content-Domain",values:[e.contentDomain]})),e.dekInfo&&(r={name:"DEK-Info",values:[e.dekInfo.algorithm]},e.dekInfo.parameters&&r.values.push(e.dekInfo.parameters),n+=i(r)),e.headers)for(var s=0;st.blockLength&&(t.start(),t.update(s.bytes()),s=t.digest()),r=a.util.createBuffer(),n=a.util.createBuffer(),u=s.length();for(c=0;c>>0,c>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=c[1],c[1]=c[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,c[0]=c[1]/4294967296>>>0;return t.putBytes(i),o(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var c,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=c>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4};o(f,r,s);var h=a.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h},n};var i=null,s=!1;function o(e,t,r){for(var a,n,i,s,o,c,u,l=r.length();l>=64;){for(n=e.h0,i=e.h1,s=e.h2,o=e.h3,c=e.h4,u=0;u<16;++u)a=r.getInt32(),t[u]=a,a=(n<<5|n>>>27)+(o^i&(s^o))+c+1518500249+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<20;++u)a=(a=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|a>>>31,t[u]=a,a=(n<<5|n>>>27)+(o^i&(s^o))+c+1518500249+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<32;++u)a=(a=t[u-3]^t[u-8]^t[u-14]^t[u-16])<<1|a>>>31,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+1859775393+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<40;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+1859775393+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<60;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i&s|o&(i^s))+c+2400959708+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;for(;u<80;++u)a=(a=t[u-6]^t[u-16]^t[u-28]^t[u-32])<<2|a>>>30,t[u]=a,a=(n<<5|n>>>27)+(i^s^o)+c+3395469782+a,c=o,o=s,s=(i<<30|i>>>2)>>>0,i=n,n=a;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+s|0,e.h3=e.h3+o|0,e.h4=e.h4+c|0,l-=64}}},function(e,t,r){var a=r(0);function n(e,t){a.cipher.registerAlgorithm(e,(function(){return new a.des.Algorithm(e,t)}))}r(13),r(19),r(1),e.exports=a.des=a.des||{},a.des.startEncrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!1,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},a.des.createEncryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!1,mode:t})},a.des.startDecrypting=function(e,t,r,a){var n=d({key:e,output:r,decrypt:!0,mode:a||(null===t?"ECB":"CBC")});return n.start(t),n},a.des.createDecryptionCipher=function(e,t){return d({key:e,output:null,decrypt:!0,mode:t})},a.des.Algorithm=function(e,t){var r=this;r.name=e,r.mode=new t({blockSize:8,cipher:{encrypt:function(e,t){return h(r._keys,e,t,!1)},decrypt:function(e,t){return h(r._keys,e,t,!0)}}}),r._init=!1},a.des.Algorithm.prototype.initialize=function(e){if(!this._init){var t=a.util.createBuffer(e.key);if(0===this.name.indexOf("3DES")&&24!==t.length())throw new Error("Invalid Triple-DES key size: "+8*t.length());this._keys=function(e){for(var t,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],a=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],n=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],i=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],s=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],c=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],u=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],p=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],h=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],d=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],y=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],g=e.length()>8?3:1,m=[],v=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],C=0,E=0;E>>4^T))<<4,S^=t=65535&((T^=t)>>>-16^S),S^=(t=858993459&(S>>>2^(T^=t<<-16)))<<2,S^=t=65535&((T^=t)>>>-16^S),S^=(t=1431655765&(S>>>1^(T^=t<<-16)))<<1,S^=t=16711935&((T^=t)>>>8^S),t=(S^=(t=1431655765&(S>>>1^(T^=t<<8)))<<1)<<8|(T^=t)>>>20&240,S=T<<24|T<<8&16711680|T>>>8&65280|T>>>24&240,T=t;for(var I=0;I>>26,T=T<<2|T>>>26):(S=S<<1|S>>>27,T=T<<1|T>>>27);var b=r[(S&=-15)>>>28]|a[S>>>24&15]|n[S>>>20&15]|i[S>>>16&15]|s[S>>>12&15]|o[S>>>8&15]|c[S>>>4&15],A=u[(T&=-15)>>>28]|l[T>>>24&15]|p[T>>>20&15]|f[T>>>16&15]|h[T>>>12&15]|d[T>>>8&15]|y[T>>>4&15];t=65535&(A>>>16^b),m[C++]=b^t,m[C++]=A^t<<16}}return m}(t),this._init=!0}},n("DES-ECB",a.cipher.modes.ecb),n("DES-CBC",a.cipher.modes.cbc),n("DES-CFB",a.cipher.modes.cfb),n("DES-OFB",a.cipher.modes.ofb),n("DES-CTR",a.cipher.modes.ctr),n("3DES-ECB",a.cipher.modes.ecb),n("3DES-CBC",a.cipher.modes.cbc),n("3DES-CFB",a.cipher.modes.cfb),n("3DES-OFB",a.cipher.modes.ofb),n("3DES-CTR",a.cipher.modes.ctr);var i=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],s=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],o=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],c=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],u=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],l=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],p=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],f=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function h(e,t,r,a){var n,h,d=32===e.length?3:9;n=3===d?a?[30,-2,-2]:[0,32,2]:a?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var y=t[0],g=t[1];y^=(h=252645135&(y>>>4^g))<<4,y^=(h=65535&(y>>>16^(g^=h)))<<16,y^=h=858993459&((g^=h)>>>2^y),y^=h=16711935&((g^=h<<2)>>>8^y),y=(y^=(h=1431655765&(y>>>1^(g^=h<<8)))<<1)<<1|y>>>31,g=(g^=h)<<1|g>>>31;for(var m=0;m>>4|g<<28)^e[E+1];h=y,y=g,g=h^(s[S>>>24&63]|c[S>>>16&63]|l[S>>>8&63]|f[63&S]|i[T>>>24&63]|o[T>>>16&63]|u[T>>>8&63]|p[63&T])}h=y,y=g,g=h}g=g>>>1|g<<31,g^=h=1431655765&((y=y>>>1|y<<31)>>>1^g),g^=(h=16711935&(g>>>8^(y^=h<<1)))<<8,g^=(h=858993459&(g>>>2^(y^=h)))<<2,g^=h=65535&((y^=h)>>>16^g),g^=h=252645135&((y^=h<<16)>>>4^g),y^=h<<4,r[0]=y,r[1]=g}function d(e){var t,r="DES-"+((e=e||{}).mode||"CBC").toUpperCase(),n=(t=e.decrypt?a.cipher.createDecipher(r,e.key):a.cipher.createCipher(r,e.key)).start;return t.start=function(e,r){var i=null;r instanceof a.util.ByteBuffer&&(i=r,r={}),(r=r||{}).output=i,r.iv=e,n.call(t,r)},t}},function(e,t,r){var a=r(0);if(r(3),r(12),r(6),r(26),r(27),r(2),r(1),void 0===n)var n=a.jsbn.BigInteger;var i=a.util.isNodejs?r(16):null,s=a.asn1,o=a.util;a.pki=a.pki||{},e.exports=a.pki.rsa=a.rsa=a.rsa||{};var c=a.pki,u=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},p={name:"RSAPrivateKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},h=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d=function(e){var t;if(!(e.algorithm in c.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=e.algorithm,r}t=c.oids[e.algorithm];var a=s.oidToDer(t).getBytes(),n=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]),i=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[]);i.value.push(s.create(s.Class.UNIVERSAL,s.Type.OID,!1,a)),i.value.push(s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,""));var o=s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,e.digest().getBytes());return n.value.push(i),n.value.push(o),s.toDer(n).getBytes()},y=function(e,t,r){if(r)return e.modPow(t.e,t.n);if(!t.p||!t.q)return e.modPow(t.d,t.n);var i;t.dP||(t.dP=t.d.mod(t.p.subtract(n.ONE))),t.dQ||(t.dQ=t.d.mod(t.q.subtract(n.ONE))),t.qInv||(t.qInv=t.q.modInverse(t.p));do{i=new n(a.util.bytesToHex(a.random.getBytes(t.n.bitLength()/8)),16)}while(i.compareTo(t.n)>=0||!i.gcd(t.n).equals(n.ONE));for(var s=(e=e.multiply(i.modPow(t.e,t.n)).mod(t.n)).mod(t.p).modPow(t.dP,t.p),o=e.mod(t.q).modPow(t.dQ,t.q);s.compareTo(o)<0;)s=s.add(t.p);var c=s.subtract(o).multiply(t.qInv).mod(t.p).multiply(t.q).add(o);return c=c.multiply(i.modInverse(t.n)).mod(t.n)};function g(e,t,r){var n=a.util.createBuffer(),i=Math.ceil(t.n.bitLength()/8);if(e.length>i-11){var s=new Error("Message is too long for PKCS#1 v1.5 padding.");throw s.length=e.length,s.max=i-11,s}n.putByte(0),n.putByte(r);var o,c=i-3-e.length;if(0===r||1===r){o=0===r?0:255;for(var u=0;u0;){var l=0,p=a.random.getBytes(c);for(u=0;u1;){if(255!==s.getByte()){--s.read;break}++u}else if(2===c)for(u=0;s.length()>1;){if(0===s.getByte()){--s.read;break}++u}if(0!==s.getByte()||u!==i-3-s.length())throw new Error("Encryption block is invalid.");return s.getBytes()}function v(e,t,r){"function"==typeof t&&(r=t,t={});var i={algorithm:{name:(t=t||{}).algorithm||"PRIMEINC",options:{workers:t.workers||2,workLoad:t.workLoad||100,workerScript:t.workerScript}}};function s(){o(e.pBits,(function(t,a){return t?r(t):(e.p=a,null!==e.q?u(t,e.q):void o(e.qBits,u))}))}function o(e,t){a.prime.generateProbablePrime(e,i,t)}function u(t,a){if(t)return r(t);if(e.q=a,e.p.compareTo(e.q)<0){var i=e.p;e.p=e.q,e.q=i}if(0!==e.p.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.p=null,void s();if(0!==e.q.subtract(n.ONE).gcd(e.e).compareTo(n.ONE))return e.q=null,void o(e.qBits,u);if(e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),0!==e.phi.gcd(e.e).compareTo(n.ONE))return e.p=e.q=null,void s();if(e.n=e.p.multiply(e.q),e.n.bitLength()!==e.bits)return e.q=null,void o(e.qBits,u);var l=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,l,e.p,e.q,l.mod(e.p1),l.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)},r(null,e.keys)}"prng"in t&&(i.prng=t.prng),s()}function C(e){var t=e.toString(16);t[0]>="8"&&(t="00"+t);var r=a.util.hexToBytes(t);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function E(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}function S(e){return a.util.isNodejs&&"function"==typeof i[e]}function T(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[e]}function I(e){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[e]}function b(e){for(var t=a.util.hexToBytes(e.toString(16)),r=new Uint8Array(t.length),n=0;n0;)l.putByte(0),--p;return l.putBytes(a.util.hexToBytes(u)),l.getBytes()},c.rsa.decrypt=function(e,t,r,i){var s=Math.ceil(t.n.bitLength()/8);if(e.length!==s){var o=new Error("Encrypted message length is invalid.");throw o.length=e.length,o.expected=s,o}var c=new n(a.util.createBuffer(e).toHex(),16);if(c.compareTo(t.n)>=0)throw new Error("Encrypted message is invalid.");for(var u=y(c,t,r).toString(16),l=a.util.createBuffer(),p=s-Math.ceil(u.length/2);p>0;)l.putByte(0),--p;return l.putBytes(a.util.hexToBytes(u)),!1!==i?m(l.getBytes(),t,r):l.getBytes()},c.rsa.createKeyPairGenerationState=function(e,t,r){"string"==typeof e&&(e=parseInt(e,10)),e=e||2048;var i,s=(r=r||{}).prng||a.random,o={nextBytes:function(e){for(var t=s.getBytesSync(e.length),r=0;r>1,pBits:e-(e>>1),pqState:0,num:null,keys:null}).e.fromInt(i.eInt),i},c.rsa.stepKeyPairGenerationState=function(e,t){"algorithm"in e||(e.algorithm="PRIMEINC");var r=new n(null);r.fromInt(30);for(var a,i=0,s=function(e,t){return e|t},o=+new Date,l=0;null===e.keys&&(t<=0||lp?e.pqState=0:e.num.isProbablePrime(E(e.num.bitLength()))?++e.pqState:e.num.dAddOffset(u[i++%8],0):2===e.pqState?e.pqState=0===e.num.subtract(n.ONE).gcd(e.e).compareTo(n.ONE)?3:0:3===e.pqState&&(e.pqState=0,null===e.p?e.p=e.num:e.q=e.num,null!==e.p&&null!==e.q&&++e.state,e.num=null)}else if(1===e.state)e.p.compareTo(e.q)<0&&(e.num=e.p,e.p=e.q,e.q=e.num),++e.state;else if(2===e.state)e.p1=e.p.subtract(n.ONE),e.q1=e.q.subtract(n.ONE),e.phi=e.p1.multiply(e.q1),++e.state;else if(3===e.state)0===e.phi.gcd(e.e).compareTo(n.ONE)?++e.state:(e.p=null,e.q=null,e.state=0);else if(4===e.state)e.n=e.p.multiply(e.q),e.n.bitLength()===e.bits?++e.state:(e.q=null,e.state=0);else if(5===e.state){var h=e.e.modInverse(e.phi);e.keys={privateKey:c.rsa.setPrivateKey(e.n,e.e,h,e.p,e.q,h.mod(e.p1),h.mod(e.q1),e.q.modInverse(e.p)),publicKey:c.rsa.setPublicKey(e.n,e.e)}}l+=(a=+new Date)-o,o=a}return null!==e.keys},c.rsa.generateKeyPair=function(e,t,r,n){if(1===arguments.length?"object"==typeof e?(r=e,e=void 0):"function"==typeof e&&(n=e,e=void 0):2===arguments.length?"number"==typeof e?"function"==typeof t?(n=t,t=void 0):"number"!=typeof t&&(r=t,t=void 0):(r=e,n=t,e=void 0,t=void 0):3===arguments.length&&("number"==typeof t?"function"==typeof r&&(n=r,r=void 0):(n=r,r=t,t=void 0)),r=r||{},void 0===e&&(e=r.bits||2048),void 0===t&&(t=r.e||65537),!a.options.usePureJavaScript&&!r.prng&&e>=256&&e<=16384&&(65537===t||3===t))if(n){if(S("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(e,t,r){if(e)return n(e);n(null,{privateKey:c.privateKeyFromPem(r),publicKey:c.publicKeyFromPem(t)})}));if(T("generateKey")&&T("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:b(t),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(e){return o.globalScope.crypto.subtle.exportKey("pkcs8",e.privateKey)})).then(void 0,(function(e){n(e)})).then((function(e){if(e){var t=c.privateKeyFromAsn1(s.fromDer(a.util.createBuffer(e)));n(null,{privateKey:t,publicKey:c.setRsaPublicKey(t.n,t.e)})}}));if(I("generateKey")&&I("exportKey")){var u=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:e,publicExponent:b(t),hash:{name:"SHA-256"}},!0,["sign","verify"]);return u.oncomplete=function(e){var t=e.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",t.privateKey);r.oncomplete=function(e){var t=e.target.result,r=c.privateKeyFromAsn1(s.fromDer(a.util.createBuffer(t)));n(null,{privateKey:r,publicKey:c.setRsaPublicKey(r.n,r.e)})},r.onerror=function(e){n(e)}},void(u.onerror=function(e){n(e)})}}else if(S("generateKeyPairSync")){var l=i.generateKeyPairSync("rsa",{modulusLength:e,publicExponent:t,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:c.privateKeyFromPem(l.privateKey),publicKey:c.publicKeyFromPem(l.publicKey)}}var p=c.rsa.createKeyPairGenerationState(e,t,r);if(!n)return c.rsa.stepKeyPairGenerationState(p,0),p.keys;v(p,r,n)},c.setRsaPublicKey=c.rsa.setPublicKey=function(e,t){var r={n:e,e:t,encrypt:function(e,t,n){if("string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===t)t={encode:function(e,t,r){return g(e,t,2).getBytes()}};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={encode:function(e,t){return a.pkcs1.encode_rsa_oaep(t,e,n)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(t))t={encode:function(e){return e}};else if("string"==typeof t)throw new Error('Unsupported encryption scheme: "'+t+'".');var i=t.encode(e,r,!0);return c.rsa.encrypt(i,r,!0)},verify:function(e,t,a){"string"==typeof a?a=a.toUpperCase():void 0===a&&(a="RSASSA-PKCS1-V1_5"),"RSASSA-PKCS1-V1_5"===a?a={verify:function(e,t){return t=m(t,r,!0),e===s.fromDer(t).value[1].value}}:"NONE"!==a&&"NULL"!==a&&null!==a||(a={verify:function(e,t){return e===(t=m(t,r,!0))}});var n=c.rsa.decrypt(t,r,!0,!1);return a.verify(e,n,r.n.bitLength())}};return r},c.setRsaPrivateKey=c.rsa.setPrivateKey=function(e,t,r,n,i,s,o,u){var l={n:e,e:t,d:r,p:n,q:i,dP:s,dQ:o,qInv:u,decrypt:function(e,t,r){"string"==typeof t?t=t.toUpperCase():void 0===t&&(t="RSAES-PKCS1-V1_5");var n=c.rsa.decrypt(e,l,!1,!1);if("RSAES-PKCS1-V1_5"===t)t={decode:m};else if("RSA-OAEP"===t||"RSAES-OAEP"===t)t={decode:function(e,t){return a.pkcs1.decode_rsa_oaep(t,e,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(t))throw new Error('Unsupported encryption scheme: "'+t+'".');t={decode:function(e){return e}}}return t.decode(n,l,!1)},sign:function(e,t){var r=!1;"string"==typeof t&&(t=t.toUpperCase()),void 0===t||"RSASSA-PKCS1-V1_5"===t?(t={encode:d},r=1):"NONE"!==t&&"NULL"!==t&&null!==t||(t={encode:function(){return e}},r=1);var a=t.encode(e,l.n.bitLength());return c.rsa.encrypt(a,l,r)}};return l},c.wrapRsaPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,s.toDer(e).getBytes())])},c.privateKeyFromAsn1=function(e){var t,r,i,o,u,f,h,d,y={},g=[];if(s.validate(e,l,y,g)&&(e=s.fromDer(a.util.createBuffer(y.privateKey))),y={},g=[],!s.validate(e,p,y,g)){var m=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw m.errors=g,m}return t=a.util.createBuffer(y.privateKeyModulus).toHex(),r=a.util.createBuffer(y.privateKeyPublicExponent).toHex(),i=a.util.createBuffer(y.privateKeyPrivateExponent).toHex(),o=a.util.createBuffer(y.privateKeyPrime1).toHex(),u=a.util.createBuffer(y.privateKeyPrime2).toHex(),f=a.util.createBuffer(y.privateKeyExponent1).toHex(),h=a.util.createBuffer(y.privateKeyExponent2).toHex(),d=a.util.createBuffer(y.privateKeyCoefficient).toHex(),c.setRsaPrivateKey(new n(t,16),new n(r,16),new n(i,16),new n(o,16),new n(u,16),new n(f,16),new n(h,16),new n(d,16))},c.privateKeyToAsn1=c.privateKeyToRSAPrivateKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,s.integerToDer(0).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.d)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.p)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.q)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dP)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.dQ)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.qInv))])},c.publicKeyFromAsn1=function(e){var t={},r=[];if(s.validate(e,h,t,r)){var i,o=s.derToOid(t.publicKeyOid);if(o!==c.oids.rsaEncryption)throw(i=new Error("Cannot read public key. Unknown OID.")).oid=o,i;e=t.rsaPublicKey}if(r=[],!s.validate(e,f,t,r))throw(i=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,i;var u=a.util.createBuffer(t.publicKeyModulus).toHex(),l=a.util.createBuffer(t.publicKeyExponent).toHex();return c.setRsaPublicKey(new n(u,16),new n(l,16))},c.publicKeyToAsn1=c.publicKeyToSubjectPublicKeyInfo=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(c.oids.rsaEncryption).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")]),s.create(s.Class.UNIVERSAL,s.Type.BITSTRING,!1,[c.publicKeyToRSAPublicKey(e)])])},c.publicKeyToRSAPublicKey=function(e){return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.n)),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,C(e.e))])}},function(e,t,r){var a,n=r(0);e.exports=n.jsbn=n.jsbn||{};function i(e,t,r){this.data=[],null!=e&&("number"==typeof e?this.fromNumber(e,t,r):null==t&&"string"!=typeof e?this.fromString(e,256):this.fromString(e,t))}function s(){return new i(null)}function o(e,t,r,a,n,i){for(var s=16383&t,o=t>>14;--i>=0;){var c=16383&this.data[e],u=this.data[e++]>>14,l=o*c+u*s;n=((c=s*c+((16383&l)<<14)+r.data[a]+n)>>28)+(l>>14)+o*u,r.data[a++]=268435455&c}return n}n.jsbn.BigInteger=i,"undefined"==typeof navigator?(i.prototype.am=o,a=28):"Microsoft Internet Explorer"==navigator.appName?(i.prototype.am=function(e,t,r,a,n,i){for(var s=32767&t,o=t>>15;--i>=0;){var c=32767&this.data[e],u=this.data[e++]>>15,l=o*c+u*s;n=((c=s*c+((32767&l)<<15)+r.data[a]+(1073741823&n))>>>30)+(l>>>15)+o*u+(n>>>30),r.data[a++]=1073741823&c}return n},a=30):"Netscape"!=navigator.appName?(i.prototype.am=function(e,t,r,a,n,i){for(;--i>=0;){var s=t*this.data[e++]+r.data[a]+n;n=Math.floor(s/67108864),r.data[a++]=67108863&s}return n},a=26):(i.prototype.am=o,a=28),i.prototype.DB=a,i.prototype.DM=(1<>>16)&&(e=t,r+=16),0!=(t=e>>8)&&(e=t,r+=8),0!=(t=e>>4)&&(e=t,r+=4),0!=(t=e>>2)&&(e=t,r+=2),0!=(t=e>>1)&&(e=t,r+=1),r}function y(e){this.m=e}function g(e){this.m=e,this.mp=e.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,t+=16),0==(255&e)&&(e>>=8,t+=8),0==(15&e)&&(e>>=4,t+=4),0==(3&e)&&(e>>=2,t+=2),0==(1&e)&&++t,t}function T(e){for(var t=0;0!=e;)e&=e-1,++t;return t}function I(){}function b(e){return e}function A(e){this.r2=s(),this.q3=s(),i.ONE.dlShiftTo(2*e.t,this.r2),this.mu=this.r2.divide(e),this.m=e}y.prototype.convert=function(e){return e.s<0||e.compareTo(this.m)>=0?e.mod(this.m):e},y.prototype.revert=function(e){return e},y.prototype.reduce=function(e){e.divRemTo(this.m,null,e)},y.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},y.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},g.prototype.convert=function(e){var t=s();return e.abs().dlShiftTo(this.m.t,t),t.divRemTo(this.m,null,t),e.s<0&&t.compareTo(i.ZERO)>0&&this.m.subTo(t,t),t},g.prototype.revert=function(e){var t=s();return e.copyTo(t),this.reduce(t),t},g.prototype.reduce=function(e){for(;e.t<=this.mt2;)e.data[e.t++]=0;for(var t=0;t>15)*this.mpl&this.um)<<15)&e.DM;for(r=t+this.m.t,e.data[r]+=this.m.am(0,a,e,t,0,this.m.t);e.data[r]>=e.DV;)e.data[r]-=e.DV,e.data[++r]++}e.clamp(),e.drShiftTo(this.m.t,e),e.compareTo(this.m)>=0&&e.subTo(this.m,e)},g.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},g.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)},i.prototype.copyTo=function(e){for(var t=this.t-1;t>=0;--t)e.data[t]=this.data[t];e.t=this.t,e.s=this.s},i.prototype.fromInt=function(e){this.t=1,this.s=e<0?-1:0,e>0?this.data[0]=e:e<-1?this.data[0]=e+this.DV:this.t=0},i.prototype.fromString=function(e,t){var r;if(16==t)r=4;else if(8==t)r=3;else if(256==t)r=8;else if(2==t)r=1;else if(32==t)r=5;else{if(4!=t)return void this.fromRadix(e,t);r=2}this.t=0,this.s=0;for(var a=e.length,n=!1,s=0;--a>=0;){var o=8==r?255&e[a]:f(e,a);o<0?"-"==e.charAt(a)&&(n=!0):(n=!1,0==s?this.data[this.t++]=o:s+r>this.DB?(this.data[this.t-1]|=(o&(1<>this.DB-s):this.data[this.t-1]|=o<=this.DB&&(s-=this.DB))}8==r&&0!=(128&e[0])&&(this.s=-1,s>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==e;)--this.t},i.prototype.dlShiftTo=function(e,t){var r;for(r=this.t-1;r>=0;--r)t.data[r+e]=this.data[r];for(r=e-1;r>=0;--r)t.data[r]=0;t.t=this.t+e,t.s=this.s},i.prototype.drShiftTo=function(e,t){for(var r=e;r=0;--r)t.data[r+s+1]=this.data[r]>>n|o,o=(this.data[r]&i)<=0;--r)t.data[r]=0;t.data[s]=o,t.t=this.t+s+1,t.s=this.s,t.clamp()},i.prototype.rShiftTo=function(e,t){t.s=this.s;var r=Math.floor(e/this.DB);if(r>=this.t)t.t=0;else{var a=e%this.DB,n=this.DB-a,i=(1<>a;for(var s=r+1;s>a;a>0&&(t.data[this.t-r-1]|=(this.s&i)<>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;r>=this.DB;a-=e.s}t.s=a<0?-1:0,a<-1?t.data[r++]=this.DV+a:a>0&&(t.data[r++]=a),t.t=r,t.clamp()},i.prototype.multiplyTo=function(e,t){var r=this.abs(),a=e.abs(),n=r.t;for(t.t=n+a.t;--n>=0;)t.data[n]=0;for(n=0;n=0;)e.data[r]=0;for(r=0;r=t.DV&&(e.data[r+t.t]-=t.DV,e.data[r+t.t+1]=1)}e.t>0&&(e.data[e.t-1]+=t.am(r,t.data[r],e,2*r,0,1)),e.s=0,e.clamp()},i.prototype.divRemTo=function(e,t,r){var a=e.abs();if(!(a.t<=0)){var n=this.abs();if(n.t0?(a.lShiftTo(l,o),n.lShiftTo(l,r)):(a.copyTo(o),n.copyTo(r));var p=o.t,f=o.data[p-1];if(0!=f){var h=f*(1<1?o.data[p-2]>>this.F2:0),y=this.FV/h,g=(1<=0&&(r.data[r.t++]=1,r.subTo(E,r)),i.ONE.dlShiftTo(p,E),E.subTo(o,o);o.t=0;){var S=r.data[--v]==f?this.DM:Math.floor(r.data[v]*y+(r.data[v-1]+m)*g);if((r.data[v]+=o.am(0,S,r,C,0,p))0&&r.rShiftTo(l,r),c<0&&i.ZERO.subTo(r,r)}}},i.prototype.invDigit=function(){if(this.t<1)return 0;var e=this.data[0];if(0==(1&e))return 0;var t=3&e;return(t=(t=(t=(t=t*(2-(15&e)*t)&15)*(2-(255&e)*t)&255)*(2-((65535&e)*t&65535))&65535)*(2-e*t%this.DV)%this.DV)>0?this.DV-t:-t},i.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},i.prototype.exp=function(e,t){if(e>4294967295||e<1)return i.ONE;var r=s(),a=s(),n=t.convert(this),o=d(e)-1;for(n.copyTo(r);--o>=0;)if(t.sqrTo(r,a),(e&1<0)t.mulTo(a,n,r);else{var c=r;r=a,a=c}return t.revert(r)},i.prototype.toString=function(e){if(this.s<0)return"-"+this.negate().toString(e);var t;if(16==e)t=4;else if(8==e)t=3;else if(2==e)t=1;else if(32==e)t=5;else{if(4!=e)return this.toRadix(e);t=2}var r,a=(1<0)for(o>o)>0&&(n=!0,i=p(r));s>=0;)o>(o+=this.DB-t)):(r=this.data[s]>>(o-=t)&a,o<=0&&(o+=this.DB,--s)),r>0&&(n=!0),n&&(i+=p(r));return n?i:"0"},i.prototype.negate=function(){var e=s();return i.ZERO.subTo(this,e),e},i.prototype.abs=function(){return this.s<0?this.negate():this},i.prototype.compareTo=function(e){var t=this.s-e.s;if(0!=t)return t;var r=this.t;if(0!=(t=r-e.t))return this.s<0?-t:t;for(;--r>=0;)if(0!=(t=this.data[r]-e.data[r]))return t;return 0},i.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},i.prototype.mod=function(e){var t=s();return this.abs().divRemTo(e,null,t),this.s<0&&t.compareTo(i.ZERO)>0&&e.subTo(t,t),t},i.prototype.modPowInt=function(e,t){var r;return r=e<256||t.isEven()?new y(t):new g(t),this.exp(e,r)},i.ZERO=h(0),i.ONE=h(1),I.prototype.convert=b,I.prototype.revert=b,I.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r)},I.prototype.sqrTo=function(e,t){e.squareTo(t)},A.prototype.convert=function(e){if(e.s<0||e.t>2*this.m.t)return e.mod(this.m);if(e.compareTo(this.m)<0)return e;var t=s();return e.copyTo(t),this.reduce(t),t},A.prototype.revert=function(e){return e},A.prototype.reduce=function(e){for(e.drShiftTo(this.m.t-1,this.r2),e.t>this.m.t+1&&(e.t=this.m.t+1,e.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);e.compareTo(this.r2)<0;)e.dAddOffset(1,this.m.t+1);for(e.subTo(this.r2,e);e.compareTo(this.m)>=0;)e.subTo(this.m,e)},A.prototype.mulTo=function(e,t,r){e.multiplyTo(t,r),this.reduce(r)},A.prototype.sqrTo=function(e,t){e.squareTo(t),this.reduce(t)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],N=(1<<26)/B[B.length-1];i.prototype.chunkSize=function(e){return Math.floor(Math.LN2*this.DB/Math.log(e))},i.prototype.toRadix=function(e){if(null==e&&(e=10),0==this.signum()||e<2||e>36)return"0";var t=this.chunkSize(e),r=Math.pow(e,t),a=h(r),n=s(),i=s(),o="";for(this.divRemTo(a,n,i);n.signum()>0;)o=(r+i.intValue()).toString(e).substr(1)+o,n.divRemTo(a,n,i);return i.intValue().toString(e)+o},i.prototype.fromRadix=function(e,t){this.fromInt(0),null==t&&(t=10);for(var r=this.chunkSize(t),a=Math.pow(t,r),n=!1,s=0,o=0,c=0;c=r&&(this.dMultiply(a),this.dAddOffset(o,0),s=0,o=0))}s>0&&(this.dMultiply(Math.pow(t,s)),this.dAddOffset(o,0)),n&&i.ZERO.subTo(this,this)},i.prototype.fromNumber=function(e,t,r){if("number"==typeof t)if(e<2)this.fromInt(1);else for(this.fromNumber(e,r),this.testBit(e-1)||this.bitwiseTo(i.ONE.shiftLeft(e-1),v,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(t);)this.dAddOffset(2,0),this.bitLength()>e&&this.subTo(i.ONE.shiftLeft(e-1),this);else{var a=new Array,n=7&e;a.length=1+(e>>3),t.nextBytes(a),n>0?a[0]&=(1<>=this.DB;if(e.t>=this.DB;a+=this.s}else{for(a+=this.s;r>=this.DB;a+=e.s}t.s=a<0?-1:0,a>0?t.data[r++]=a:a<-1&&(t.data[r++]=this.DV+a),t.t=r,t.clamp()},i.prototype.dMultiply=function(e){this.data[this.t]=this.am(0,e-1,this,0,0,this.t),++this.t,this.clamp()},i.prototype.dAddOffset=function(e,t){if(0!=e){for(;this.t<=t;)this.data[this.t++]=0;for(this.data[t]+=e;this.data[t]>=this.DV;)this.data[t]-=this.DV,++t>=this.t&&(this.data[this.t++]=0),++this.data[t]}},i.prototype.multiplyLowerTo=function(e,t,r){var a,n=Math.min(this.t+e.t,t);for(r.s=0,r.t=n;n>0;)r.data[--n]=0;for(a=r.t-this.t;n=0;)r.data[a]=0;for(a=Math.max(t-this.t,0);a0)if(0==t)r=this.data[0]%e;else for(var a=this.t-1;a>=0;--a)r=(t*r+this.data[a])%e;return r},i.prototype.millerRabin=function(e){var t=this.subtract(i.ONE),r=t.getLowestSetBit();if(r<=0)return!1;for(var a,n=t.shiftRight(r),s={nextBytes:function(e){for(var t=0;t=0);var c=a.modPow(n,this);if(0!=c.compareTo(i.ONE)&&0!=c.compareTo(t)){for(var u=1;u++>24},i.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},i.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},i.prototype.toByteArray=function(){var e=this.t,t=new Array;t[0]=this.s;var r,a=this.DB-e*this.DB%8,n=0;if(e-- >0)for(a>a)!=(this.s&this.DM)>>a&&(t[n++]=r|this.s<=0;)a<8?(r=(this.data[e]&(1<>(a+=this.DB-8)):(r=this.data[e]>>(a-=8)&255,a<=0&&(a+=this.DB,--e)),0!=(128&r)&&(r|=-256),0==n&&(128&this.s)!=(128&r)&&++n,(n>0||r!=this.s)&&(t[n++]=r);return t},i.prototype.equals=function(e){return 0==this.compareTo(e)},i.prototype.min=function(e){return this.compareTo(e)<0?this:e},i.prototype.max=function(e){return this.compareTo(e)>0?this:e},i.prototype.and=function(e){var t=s();return this.bitwiseTo(e,m,t),t},i.prototype.or=function(e){var t=s();return this.bitwiseTo(e,v,t),t},i.prototype.xor=function(e){var t=s();return this.bitwiseTo(e,C,t),t},i.prototype.andNot=function(e){var t=s();return this.bitwiseTo(e,E,t),t},i.prototype.not=function(){for(var e=s(),t=0;t=this.t?0!=this.s:0!=(this.data[t]&1<1){var p=s();for(a.sqrTo(o[1],p);c<=l;)o[c]=s(),a.mulTo(p,o[c-2],o[c]),c+=2}var f,m,v=e.t-1,C=!0,E=s();for(n=d(e.data[v])-1;v>=0;){for(n>=u?f=e.data[v]>>n-u&l:(f=(e.data[v]&(1<0&&(f|=e.data[v-1]>>this.DB+n-u)),c=r;0==(1&f);)f>>=1,--c;if((n-=c)<0&&(n+=this.DB,--v),C)o[f].copyTo(i),C=!1;else{for(;c>1;)a.sqrTo(i,E),a.sqrTo(E,i),c-=2;c>0?a.sqrTo(i,E):(m=i,i=E,E=m),a.mulTo(E,o[f],i)}for(;v>=0&&0==(e.data[v]&1<=0?(r.subTo(a,r),t&&n.subTo(o,n),s.subTo(c,s)):(a.subTo(r,a),t&&o.subTo(n,o),c.subTo(s,c))}return 0!=a.compareTo(i.ONE)?i.ZERO:c.compareTo(e)>=0?c.subtract(e):c.signum()<0?(c.addTo(e,c),c.signum()<0?c.add(e):c):c},i.prototype.pow=function(e){return this.exp(e,new I)},i.prototype.gcd=function(e){var t=this.s<0?this.negate():this.clone(),r=e.s<0?e.negate():e.clone();if(t.compareTo(r)<0){var a=t;t=r,r=a}var n=t.getLowestSetBit(),i=r.getLowestSetBit();if(i<0)return t;for(n0&&(t.rShiftTo(i,t),r.rShiftTo(i,r));t.signum()>0;)(n=t.getLowestSetBit())>0&&t.rShiftTo(n,t),(n=r.getLowestSetBit())>0&&r.rShiftTo(n,r),t.compareTo(r)>=0?(t.subTo(r,t),t.rShiftTo(1,t)):(r.subTo(t,r),r.rShiftTo(1,r));return i>0&&r.lShiftTo(i,r),r},i.prototype.isProbablePrime=function(e){var t,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(t=0;t>>0,o>>>0];for(var c=n.fullMessageLength.length-1;c>=0;--c)n.fullMessageLength[c]+=o[1],o[1]=o[0]+(n.fullMessageLength[c]/4294967296>>>0),n.fullMessageLength[c]=n.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),l(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var o=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-o));for(var c,u=0,p=n.fullMessageLength.length-1;p>=0;--p)u=(c=8*n.fullMessageLength[p]+u)/4294967296>>>0,s.putInt32Le(c>>>0);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3};l(f,r,s);var h=a.util.createBuffer();return h.putInt32Le(f.h0),h.putInt32Le(f.h1),h.putInt32Le(f.h2),h.putInt32Le(f.h3),h},n};var i=null,s=null,o=null,c=null,u=!1;function l(e,t,r){for(var a,n,i,u,l,p,f,h=r.length();h>=64;){for(n=e.h0,i=e.h1,u=e.h2,l=e.h3,f=0;f<16;++f)t[f]=r.getInt32Le(),a=n+(l^i&(u^l))+c[f]+t[f],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<32;++f)a=n+(u^l&(i^u))+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<48;++f)a=n+(i^u^l)+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;for(;f<64;++f)a=n+(u^(i|~l))+c[f]+t[s[f]],n=l,l=u,u=i,i+=a<<(p=o[f])|a>>>32-p;e.h0=e.h0+n|0,e.h1=e.h1+i|0,e.h2=e.h2+u|0,e.h3=e.h3+l|0,h-=64}}},function(e,t,r){var a=r(0);r(8),r(4),r(1);var n,i=a.pkcs5=a.pkcs5||{};a.util.isNodejs&&!a.options.usePureJavaScript&&(n=r(16)),e.exports=a.pbkdf2=i.pbkdf2=function(e,t,r,i,s,o){if("function"==typeof s&&(o=s,s=null),a.util.isNodejs&&!a.options.usePureJavaScript&&n.pbkdf2&&(null===s||"object"!=typeof s)&&(n.pbkdf2Sync.length>4||!s||"sha1"===s))return"string"!=typeof s&&(s="sha1"),e=Buffer.from(e,"binary"),t=Buffer.from(t,"binary"),o?4===n.pbkdf2Sync.length?n.pbkdf2(e,t,r,i,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):n.pbkdf2(e,t,r,i,s,(function(e,t){if(e)return o(e);o(null,t.toString("binary"))})):4===n.pbkdf2Sync.length?n.pbkdf2Sync(e,t,r,i).toString("binary"):n.pbkdf2Sync(e,t,r,i,s).toString("binary");if(null==s&&(s="sha1"),"string"==typeof s){if(!(s in a.md.algorithms))throw new Error("Unknown hash algorithm: "+s);s=a.md[s].create()}var c=s.digestLength;if(i>4294967295*c){var u=new Error("Derived key is too long.");if(o)return o(u);throw u}var l=Math.ceil(i/c),p=i-(l-1)*c,f=a.hmac.create();f.start(s,e);var h,d,y,g="";if(!o){for(var m=1;m<=l;++m){f.start(null,null),f.update(t),f.update(a.util.int32ToBytes(m)),h=y=f.digest().getBytes();for(var v=2;v<=r;++v)f.start(null,null),f.update(y),d=f.digest().getBytes(),h=a.util.xorBytes(h,d,c),y=d;g+=ml)return o(null,g);f.start(null,null),f.update(t),f.update(a.util.int32ToBytes(m)),h=y=f.digest().getBytes(),v=2,E()}function E(){if(v<=r)return f.start(null,null),f.update(y),d=f.digest().getBytes(),h=a.util.xorBytes(h,d,c),y=d,++v,a.util.setImmediate(E);g+=m128)throw new Error('Invalid "nsComment" content.');e.value=n.create(n.Class.UNIVERSAL,n.Type.IA5STRING,!1,e.comment)}else if("subjectKeyIdentifier"===e.name&&t.cert){var h=t.cert.generateSubjectKeyIdentifier();e.subjectKeyIdentifier=h.toHex(),e.value=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,h.getBytes())}else if("authorityKeyIdentifier"===e.name&&t.cert){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;if(e.keyIdentifier){var d=!0===e.keyIdentifier?t.cert.generateSubjectKeyIdentifier().getBytes():e.keyIdentifier;l.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!1,d))}if(e.authorityCertIssuer){var g=[n.create(n.Class.CONTEXT_SPECIFIC,4,!0,[y(!0===e.authorityCertIssuer?t.cert.issuer:e.authorityCertIssuer)])];l.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,g))}if(e.serialNumber){var m=a.util.hexToBytes(!0===e.serialNumber?t.cert.serialNumber:e.serialNumber);l.push(n.create(n.Class.CONTEXT_SPECIFIC,2,!1,m))}}else if("cRLDistributionPoints"===e.name){e.value=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);l=e.value.value;var v,C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]),E=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(p.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(c.validity.notBefore=p[0],c.validity.notAfter=p[1],c.tbsCertificate=r.tbsCertificate,t){var f;if(c.md=null,c.signatureOid in s)switch(s[c.signatureOid]){case"sha1WithRSAEncryption":c.md=a.md.sha1.create();break;case"md5WithRSAEncryption":c.md=a.md.md5.create();break;case"sha256WithRSAEncryption":c.md=a.md.sha256.create();break;case"sha384WithRSAEncryption":c.md=a.md.sha384.create();break;case"sha512WithRSAEncryption":c.md=a.md.sha512.create();break;case"RSASSA-PSS":c.md=a.md.sha256.create()}if(null===c.md)throw(f=new Error("Could not compute certificate digest. Unknown signature OID.")).signatureOid=c.signatureOid,f;var y=n.toDer(c.tbsCertificate);c.md.update(y.getBytes())}var m=a.md.sha1.create();c.issuer.getField=function(e){return h(c.issuer,e)},c.issuer.addField=function(e){g([e]),c.issuer.attributes.push(e)},c.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer,m),r.certIssuerUniqueId&&(c.issuer.uniqueId=r.certIssuerUniqueId),c.issuer.hash=m.digest().toHex();var v=a.md.sha1.create();return c.subject.getField=function(e){return h(c.subject,e)},c.subject.addField=function(e){g([e]),c.subject.attributes.push(e)},c.subject.attributes=i.RDNAttributesAsArray(r.certSubject,v),r.certSubjectUniqueId&&(c.subject.uniqueId=r.certSubjectUniqueId),c.subject.hash=v.digest().toHex(),r.certExtensions?c.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):c.extensions=[],c.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),c},i.certificateExtensionsFromAsn1=function(e){for(var t=[],r=0;r1&&(r=c.value.charCodeAt(1),i=c.value.length>2?c.value.charCodeAt(2):0),t.digitalSignature=128==(128&r),t.nonRepudiation=64==(64&r),t.keyEncipherment=32==(32&r),t.dataEncipherment=16==(16&r),t.keyAgreement=8==(8&r),t.keyCertSign=4==(4&r),t.cRLSign=2==(2&r),t.encipherOnly=1==(1&r),t.decipherOnly=128==(128&i)}else if("basicConstraints"===t.name){(c=n.fromDer(t.value)).value.length>0&&c.value[0].type===n.Type.BOOLEAN?t.cA=0!==c.value[0].value.charCodeAt(0):t.cA=!1;var o=null;c.value.length>0&&c.value[0].type===n.Type.INTEGER?o=c.value[0].value:c.value.length>1&&(o=c.value[1].value),null!==o&&(t.pathLenConstraint=n.derToInteger(o))}else if("extKeyUsage"===t.name)for(var c=n.fromDer(t.value),u=0;u1&&(r=c.value.charCodeAt(1)),t.client=128==(128&r),t.server=64==(64&r),t.email=32==(32&r),t.objsign=16==(16&r),t.reserved=8==(8&r),t.sslCA=4==(4&r),t.emailCA=2==(2&r),t.objCA=1==(1&r)}else if("subjectAltName"===t.name||"issuerAltName"===t.name){var p;t.altNames=[];c=n.fromDer(t.value);for(var f=0;f=E&&e0&&s.value.push(i.certificateExtensionsToAsn1(e.extensions)),s},i.getCertificationRequestInfo=function(e){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(e.version).getBytes()),y(e.subject),i.publicKeyToAsn1(e.publicKey),C(e)])},i.distinguishedNameToAsn1=function(e){return y(e)},i.certificateToAsn1=function(e){var t=e.tbsCertificate||i.getTBSCertificate(e);return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[t,n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.signatureOid).getBytes()),v(e.signatureOid,e.signatureParameters)]),n.create(n.Class.UNIVERSAL,n.Type.BITSTRING,!1,String.fromCharCode(0)+e.signature)])},i.certificateExtensionsToAsn1=function(e){var t=n.create(n.Class.CONTEXT_SPECIFIC,3,!0,[]),r=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[]);t.value.push(r);for(var a=0;al.validity.notAfter)&&(c={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:s}),null===c){if(null===(p=t[0]||e.getIssuer(l))&&l.isIssuer(l)&&(f=!0,p=l),p){var h=p;a.util.isArray(h)||(h=[h]);for(var d=!1;!d&&h.length>0;){p=h.shift();try{d=p.verify(l)}catch(e){}}d||(c={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}null!==c||p&&!f||e.hasCertificate(l)||(c={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(null===c&&p&&!l.isIssuer(p)&&(c={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),null===c)for(var y={keyUsage:!0,basicConstraints:!0},g=0;null===c&&gv.pathLenConstraint&&(c={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}var E=null===c||c.error,S=r.verify?r.verify(E,u,n):E;if(!0!==S)throw!0===E&&(c={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(S||0===S)&&("object"!=typeof S||a.util.isArray(S)?"string"==typeof S&&(c.error=S):(S.message&&(c.message=S.message),S.error&&(c.error=S.error))),c;c=null,o=!1,++u}while(t.length>0);return!0}},function(e,t,r){var a=r(0);r(2),r(1),(e.exports=a.pss=a.pss||{}).create=function(e){3===arguments.length&&(e={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var t,r=e.md,n=e.mgf,i=r.digestLength,s=e.salt||null;if("string"==typeof s&&(s=a.util.createBuffer(s)),"saltLength"in e)t=e.saltLength;else{if(null===s)throw new Error("Salt length not specified or specific salt not given.");t=s.length()}if(null!==s&&s.length()!==t)throw new Error("Given salt length does not match length of given salt.");var o=e.prng||a.random,c={encode:function(e,c){var u,l,p=c-1,f=Math.ceil(p/8),h=e.digest().getBytes();if(f>8*f-p&255;return(E=String.fromCharCode(E.charCodeAt(0)&~S)+E.substr(1))+y+String.fromCharCode(188)},verify:function(e,s,o){var c,u=o-1,l=Math.ceil(u/8);if(s=s.substr(-l),l>8*l-u&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var y=n.generate(h,p),g="";for(c=0;c4){var r=e;e=a.util.createBuffer();for(var n=0;n0))return!0;for(var a=0;a0))return!0;for(var a=0;a0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},n.cbc=function(e){e=e||{},this.name="CBC",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},n.cbc.prototype.start=function(e){if(null===e.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._prev=this._iv.slice(0)}},n.cbc.prototype.encrypt=function(e,t,r){if(e.length()0))return!0;for(var a=0;a0))return!0;for(var a=0;a0)return!1;var r=e.length(),a=e.at(r-1);return!(a>this.blockSize<<2)&&(e.truncate(a),!0)},n.cfb=function(e){e=e||{},this.name="CFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.cfb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.cfb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.cfb.prototype.decrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.ofb=function(e){e=e||{},this.name="OFB",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.ofb.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ofb.prototype.encrypt=function(e,t,r){var a=e.length();if(0===e.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0)e.read-=this.blockSize;else for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}},n.ofb.prototype.decrypt=n.ofb.prototype.encrypt,n.ctr=function(e){e=e||{},this.name="CTR",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},n.ctr.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");this._iv=i(e.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},n.ctr.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize)for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0&&(e.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}s(this._inBlock)},n.ctr.prototype.decrypt=n.ctr.prototype.encrypt,n.gcm=function(e){e=e||{},this.name="GCM",this.cipher=e.cipher,this.blockSize=e.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},n.gcm.prototype.start=function(e){if(!("iv"in e))throw new Error("Invalid IV parameter.");var t,r=a.util.createBuffer(e.iv);if(this._cipherLength=0,t="additionalData"in e?a.util.createBuffer(e.additionalData):a.util.createBuffer(),this._tagLength="tagLength"in e?e.tagLength:128,this._tag=null,e.decrypt&&(this._tag=a.util.createBuffer(e.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var n=r.length();if(12===n)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*n)))}this._inBlock=this._j0.slice(0),s(this._inBlock),this._partialBytes=0,t=a.util.createBuffer(t),this._aDataLength=o(8*t.length());var i=t.length()%this.blockSize;for(i&&t.fillWithByte(0,this.blockSize-i),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},n.gcm.prototype.encrypt=function(e,t,r){var a=e.length();if(0===a)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&a>=this.blockSize){for(var n=0;n0&&(i=this.blockSize-i),this._partialOutput.clear();for(n=0;n0&&this._partialOutput.getBytes(this._partialBytes),i>0&&!r)return e.read-=this.blockSize,t.putBytes(this._partialOutput.getBytes(i-this._partialBytes)),this._partialBytes=i,!0;t.putBytes(this._partialOutput.getBytes(a-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),s(this._inBlock)},n.gcm.prototype.decrypt=function(e,t,r){var a=e.length();if(a0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),s(this._inBlock),this._hashBlock[0]=e.getInt32(),this._hashBlock[1]=e.getInt32(),this._hashBlock[2]=e.getInt32(),this._hashBlock[3]=e.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var n=0;n0;--a)t[a]=e[a]>>>1|(1&e[a-1])<<31;t[0]=e[0]>>>1,r&&(t[0]^=this._R)},n.gcm.prototype.tableMultiply=function(e){for(var t=[0,0,0,0],r=0;r<32;++r){var a=e[r/8|0]>>>4*(7-r%8)&15,n=this._m[r][a];t[0]^=n[0],t[1]^=n[1],t[2]^=n[2],t[3]^=n[3]}return t},n.gcm.prototype.ghash=function(e,t,r){return t[0]^=r[0],t[1]^=r[1],t[2]^=r[2],t[3]^=r[3],this.tableMultiply(t)},n.gcm.prototype.generateHashTable=function(e,t){for(var r=8/t,a=4*r,n=16*r,i=new Array(n),s=0;s>>1,n=new Array(r);n[a]=e.slice(0);for(var i=a>>>1;i>0;)this.pow(n[2*i],n[i]=[]),i>>=1;for(i=2;i>1,o=s+(1&e.length),c=e.substr(0,o),u=e.substr(s,o),l=a.util.createBuffer(),p=a.hmac.create();r=t+r;var f=Math.ceil(n/16),h=Math.ceil(n/20);p.start("MD5",c);var d=a.util.createBuffer();l.putBytes(r);for(var y=0;y0&&(u.queue(e,u.createAlert(e,{level:u.Alert.Level.warning,description:u.Alert.Description.no_renegotiation})),u.flush(e)),e.process()},u.parseHelloMessage=function(e,t,r){var n=null,i=e.entity===u.ConnectionEnd.client;if(r<38)e.error(e,{message:i?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});else{var s=t.fragment,c=s.length();if(n={version:{major:s.getByte(),minor:s.getByte()},random:a.util.createBuffer(s.getBytes(32)),session_id:o(s,1),extensions:[]},i?(n.cipher_suite=s.getBytes(2),n.compression_method=s.getByte()):(n.cipher_suites=o(s,2),n.compression_methods=o(s,1)),(c=r-(c-s.length()))>0){for(var l=o(s,2);l.length()>0;)n.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!i)for(var p=0;p0;){if(0!==h.getByte())break;e.session.extensions.server_name.serverNameList.push(o(h,2).getBytes())}}}if(e.session.version&&(n.version.major!==e.session.version.major||n.version.minor!==e.session.version.minor))return e.error(e,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});if(i)e.session.cipherSuite=u.getCipherSuite(n.cipher_suite);else for(var d=a.util.createBuffer(n.cipher_suites.bytes());d.length()>0&&(e.session.cipherSuite=u.getCipherSuite(d.getBytes(2)),null===e.session.cipherSuite););if(null===e.session.cipherSuite)return e.error(e,{message:"No cipher suites in common.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(n.cipher_suite)});e.session.compressionMethod=i?n.compression_method:u.CompressionMethod.none}return n},u.createSecurityParameters=function(e,t){var r=e.entity===u.ConnectionEnd.client,a=t.random.bytes(),n=r?e.session.sp.client_random:a,i=r?a:u.createRandom().getBytes();e.session.sp={entity:e.entity,prf_algorithm:u.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:e.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:n,server_random:i}},u.handleServerHello=function(e,t,r){var a=u.parseHelloMessage(e,t,r);if(!e.fail){if(!(a.version.minor<=e.version.minor))return e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}});e.version.minor=a.version.minor,e.session.version=e.version;var n=a.session_id.bytes();n.length>0&&n===e.session.id?(e.expect=d,e.session.resuming=!0,e.session.sp.server_random=a.random.bytes()):(e.expect=l,e.session.resuming=!1,u.createSecurityParameters(e,a)),e.session.id=n,e.process()}},u.handleClientHello=function(e,t,r){var n=u.parseHelloMessage(e,t,r);if(!e.fail){var i=n.session_id.bytes(),s=null;if(e.sessionCache&&(null===(s=e.sessionCache.getSession(i))?i="":(s.version.major!==n.version.major||s.version.minor>n.version.minor)&&(s=null,i="")),0===i.length&&(i=a.random.getBytes(32)),e.session.id=i,e.session.clientHelloVersion=n.version,e.session.sp={},s)e.version=e.session.version=s.version,e.session.sp=s.sp;else{for(var o,c=1;c0;)n=o(c.certificate_list,3),i=a.asn1.fromDer(n),n=a.pki.certificateFromAsn1(i,!0),l.push(n)}catch(t){return e.error(e,{message:"Could not parse certificate list.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_certificate}})}var f=e.entity===u.ConnectionEnd.client;!f&&!0!==e.verifyClient||0!==l.length?0===l.length?e.expect=f?p:C:(f?e.session.serverCertificate=l[0]:e.session.clientCertificate=l[0],u.verifyCertificateChain(e,l)&&(e.expect=f?p:C)):e.error(e,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}}),e.process()},u.handleServerKeyExchange=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});e.expect=f,e.process()},u.handleClientKeyExchange=function(e,t,r){if(r<48)return e.error(e,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.unsupported_certificate}});var n=t.fragment,i={enc_pre_master_secret:o(n,2).getBytes()},s=null;if(e.getPrivateKey)try{s=e.getPrivateKey(e,e.session.serverCertificate),s=a.pki.privateKeyFromPem(s)}catch(t){e.error(e,{message:"Could not get private key.",cause:t,send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}})}if(null===s)return e.error(e,{message:"No private key set.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}});try{var c=e.session.sp;c.pre_master_secret=s.decrypt(i.enc_pre_master_secret);var l=e.session.clientHelloVersion;if(l.major!==c.pre_master_secret.charCodeAt(0)||l.minor!==c.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(e){c.pre_master_secret=a.random.getBytes(48)}e.expect=S,null!==e.session.clientCertificate&&(e.expect=E),e.process()},u.handleCertificateRequest=function(e,t,r){if(r<3)return e.error(e,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var a=t.fragment,n={certificate_types:o(a,1),certificate_authorities:o(a,2)};e.session.certificateRequest=n,e.expect=h,e.process()},u.handleCertificateVerify=function(e,t,r){if(r<2)return e.error(e,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var n=t.fragment;n.read-=4;var i=n.bytes();n.read+=4;var s={signature:o(n,2).getBytes()},c=a.util.createBuffer();c.putBuffer(e.session.md5.digest()),c.putBuffer(e.session.sha1.digest()),c=c.getBytes();try{if(!e.session.clientCertificate.publicKey.verify(c,s.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");e.session.md5.update(i),e.session.sha1.update(i)}catch(t){return e.error(e,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.handshake_failure}})}e.expect=S,e.process()},u.handleServerHelloDone=function(e,t,r){if(r>0)return e.error(e,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.record_overflow}});if(null===e.serverCertificate){var n={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.insufficient_security}},i=e.verify(e,n.alert.description,0,[]);if(!0!==i)return(i||0===i)&&("object"!=typeof i||a.util.isArray(i)?"number"==typeof i&&(n.alert.description=i):(i.message&&(n.message=i.message),i.alert&&(n.alert.description=i.alert))),e.error(e,n)}null!==e.session.certificateRequest&&(t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificate(e)}),u.queue(e,t)),t=u.createRecord(e,{type:u.ContentType.handshake,data:u.createClientKeyExchange(e)}),u.queue(e,t),e.expect=m;var s=function(e,t){null!==e.session.certificateRequest&&null!==e.session.clientCertificate&&u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createCertificateVerify(e,t)})),u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.pending=u.createConnectionState(e),e.state.current.write=e.state.pending.write,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)})),e.expect=d,u.flush(e),e.process()};if(null===e.session.certificateRequest||null===e.session.clientCertificate)return s(e,null);u.getClientSignature(e,s)},u.handleChangeCipherSpec=function(e,t){if(1!==t.fragment.getByte())return e.error(e,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.illegal_parameter}});var r=e.entity===u.ConnectionEnd.client;(e.session.resuming&&r||!e.session.resuming&&!r)&&(e.state.pending=u.createConnectionState(e)),e.state.current.read=e.state.pending.read,(!e.session.resuming&&r||e.session.resuming&&!r)&&(e.state.pending=null),e.expect=r?y:T,e.process()},u.handleFinished=function(e,t,r){var i=t.fragment;i.read-=4;var s=i.bytes();i.read+=4;var o=t.fragment.getBytes();(i=a.util.createBuffer()).putBuffer(e.session.md5.digest()),i.putBuffer(e.session.sha1.digest());var c=e.entity===u.ConnectionEnd.client,l=c?"server finished":"client finished",p=e.session.sp;if((i=n(p.master_secret,l,i.getBytes(),12)).getBytes()!==o)return e.error(e,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decrypt_error}});e.session.md5.update(s),e.session.sha1.update(s),(e.session.resuming&&c||!e.session.resuming&&!c)&&(u.queue(e,u.createRecord(e,{type:u.ContentType.change_cipher_spec,data:u.createChangeCipherSpec()})),e.state.current.write=e.state.pending.write,e.state.pending=null,u.queue(e,u.createRecord(e,{type:u.ContentType.handshake,data:u.createFinished(e)}))),e.expect=c?g:I,e.handshaking=!1,++e.handshakes,e.peerCertificate=c?e.session.serverCertificate:e.session.clientCertificate,u.flush(e),e.isConnected=!0,e.connected(e),e.process()},u.handleAlert=function(e,t){var r,a=t.fragment,n={level:a.getByte(),description:a.getByte()};switch(n.description){case u.Alert.Description.close_notify:r="Connection closed.";break;case u.Alert.Description.unexpected_message:r="Unexpected message.";break;case u.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case u.Alert.Description.decryption_failed:r="Decryption failed.";break;case u.Alert.Description.record_overflow:r="Record overflow.";break;case u.Alert.Description.decompression_failure:r="Decompression failed.";break;case u.Alert.Description.handshake_failure:r="Handshake failure.";break;case u.Alert.Description.bad_certificate:r="Bad certificate.";break;case u.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case u.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case u.Alert.Description.certificate_expired:r="Certificate expired.";break;case u.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case u.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case u.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case u.Alert.Description.access_denied:r="Access denied.";break;case u.Alert.Description.decode_error:r="Decode error.";break;case u.Alert.Description.decrypt_error:r="Decrypt error.";break;case u.Alert.Description.export_restriction:r="Export restriction.";break;case u.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case u.Alert.Description.insufficient_security:r="Insufficient security.";break;case u.Alert.Description.internal_error:r="Internal error.";break;case u.Alert.Description.user_canceled:r="User canceled.";break;case u.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(n.description===u.Alert.Description.close_notify)return e.close();e.error(e,{message:r,send:!1,origin:e.entity===u.ConnectionEnd.client?"server":"client",alert:n}),e.process()},u.handleHandshake=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt24();if(i>r.length())return e.fragmented=t,t.fragment=a.util.createBuffer(),r.read-=4,e.process();e.fragmented=null,r.read-=4;var s=r.bytes(i+4);r.read+=4,n in K[e.entity][e.expect]?(e.entity!==u.ConnectionEnd.server||e.open||e.fail||(e.handshaking=!0,e.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),n!==u.HandshakeType.hello_request&&n!==u.HandshakeType.certificate_verify&&n!==u.HandshakeType.finished&&(e.session.md5.update(s),e.session.sha1.update(s)),K[e.entity][e.expect][n](e,t,i)):u.handleUnexpected(e,t)},u.handleApplicationData=function(e,t){e.data.putBuffer(t.fragment),e.dataReady(e),e.process()},u.handleHeartbeat=function(e,t){var r=t.fragment,n=r.getByte(),i=r.getInt16(),s=r.getBytes(i);if(n===u.HeartbeatMessageType.heartbeat_request){if(e.handshaking||i>s.length)return e.process();u.queue(e,u.createRecord(e,{type:u.ContentType.heartbeat,data:u.createHeartbeat(u.HeartbeatMessageType.heartbeat_response,s)})),u.flush(e)}else if(n===u.HeartbeatMessageType.heartbeat_response){if(s!==e.expectedHeartbeatPayload)return e.process();e.heartbeatReceived&&e.heartbeatReceived(e,a.util.createBuffer(s))}e.process()};var l=1,p=2,f=3,h=4,d=5,y=6,g=7,m=8,v=1,C=2,E=3,S=4,T=5,I=6,b=u.handleUnexpected,A=u.handleChangeCipherSpec,B=u.handleAlert,N=u.handleHandshake,k=u.handleApplicationData,w=u.handleHeartbeat,R=[];R[u.ConnectionEnd.client]=[[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[A,B,b,b,w],[b,B,N,b,w],[b,B,N,k,w],[b,B,N,b,w]],R[u.ConnectionEnd.server]=[[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[b,B,N,b,w],[A,B,b,b,w],[b,B,N,b,w],[b,B,N,k,w],[b,B,N,b,w]];var _=u.handleHelloRequest,L=u.handleServerHello,U=u.handleCertificate,D=u.handleServerKeyExchange,P=u.handleCertificateRequest,V=u.handleServerHelloDone,O=u.handleFinished,K=[];K[u.ConnectionEnd.client]=[[b,b,L,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,U,D,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,D,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,P,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,V,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,O],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[_,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b]];var x=u.handleClientHello,M=u.handleClientKeyExchange,F=u.handleCertificateVerify;K[u.ConnectionEnd.server]=[[b,x,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,U,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,M,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,F,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,O],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b],[b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b,b]],u.generateKeys=function(e,t){var r=n,a=t.client_random+t.server_random;e.session.resuming||(t.master_secret=r(t.pre_master_secret,"master secret",a,48).bytes(),t.pre_master_secret=null),a=t.server_random+t.client_random;var i=2*t.mac_key_length+2*t.enc_key_length,s=e.version.major===u.Versions.TLS_1_0.major&&e.version.minor===u.Versions.TLS_1_0.minor;s&&(i+=2*t.fixed_iv_length);var o=r(t.master_secret,"key expansion",a,i),c={client_write_MAC_key:o.getBytes(t.mac_key_length),server_write_MAC_key:o.getBytes(t.mac_key_length),client_write_key:o.getBytes(t.enc_key_length),server_write_key:o.getBytes(t.enc_key_length)};return s&&(c.client_write_IV=o.getBytes(t.fixed_iv_length),c.server_write_IV=o.getBytes(t.fixed_iv_length)),c},u.createConnectionState=function(e){var t=e.entity===u.ConnectionEnd.client,r=function(){var e={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(e){return!0},compressionState:null,compressFunction:function(e){return!0},updateSequenceNumber:function(){4294967295===e.sequenceNumber[1]?(e.sequenceNumber[1]=0,++e.sequenceNumber[0]):++e.sequenceNumber[1]}};return e},a={read:r(),write:r()};if(a.read.update=function(e,t){return a.read.cipherFunction(t,a.read)?a.read.compressFunction(e,t,a.read)||e.error(e,{message:"Could not decompress record.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.decompression_failure}}):e.error(e,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.bad_record_mac}}),!e.fail},a.write.update=function(e,t){return a.write.compressFunction(e,t,a.write)?a.write.cipherFunction(t,a.write)||e.error(e,{message:"Could not encrypt record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}):e.error(e,{message:"Could not compress record.",send:!1,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.internal_error}}),!e.fail},e.session){var n=e.session.sp;switch(e.session.cipherSuite.initSecurityParameters(n),n.keys=u.generateKeys(e,n),a.read.macKey=t?n.keys.server_write_MAC_key:n.keys.client_write_MAC_key,a.write.macKey=t?n.keys.client_write_MAC_key:n.keys.server_write_MAC_key,e.session.cipherSuite.initConnectionState(a,e,n),n.compression_algorithm){case u.CompressionMethod.none:break;case u.CompressionMethod.deflate:a.read.compressFunction=s,a.write.compressFunction=i;break;default:throw new Error("Unsupported compression algorithm.")}}return a},u.createRandom=function(){var e=new Date,t=+e+6e4*e.getTimezoneOffset(),r=a.util.createBuffer();return r.putInt32(t),r.putBytes(a.random.getBytes(28)),r},u.createRecord=function(e,t){return t.data?{type:t.type,version:{major:e.version.major,minor:e.version.minor},length:t.data.length(),fragment:t.data}:null},u.createAlert=function(e,t){var r=a.util.createBuffer();return r.putByte(t.level),r.putByte(t.description),u.createRecord(e,{type:u.ContentType.alert,data:r})},u.createClientHello=function(e){e.session.clientHelloVersion={major:e.version.major,minor:e.version.minor};for(var t=a.util.createBuffer(),r=0;r0&&(d+=2);var y=e.session.id,g=y.length+1+2+4+28+2+i+1+o+d,m=a.util.createBuffer();return m.putByte(u.HandshakeType.client_hello),m.putInt24(g),m.putByte(e.version.major),m.putByte(e.version.minor),m.putBytes(e.session.sp.client_random),c(m,1,a.util.createBuffer(y)),c(m,2,t),c(m,1,s),d>0&&c(m,2,l),m},u.createServerHello=function(e){var t=e.session.id,r=t.length+1+2+4+28+2+1,n=a.util.createBuffer();return n.putByte(u.HandshakeType.server_hello),n.putInt24(r),n.putByte(e.version.major),n.putByte(e.version.minor),n.putBytes(e.session.sp.server_random),c(n,1,a.util.createBuffer(t)),n.putByte(e.session.cipherSuite.id[0]),n.putByte(e.session.cipherSuite.id[1]),n.putByte(e.session.compressionMethod),n},u.createCertificate=function(e){var t,r=e.entity===u.ConnectionEnd.client,n=null;e.getCertificate&&(t=r?e.session.certificateRequest:e.session.extensions.server_name.serverNameList,n=e.getCertificate(e,t));var i=a.util.createBuffer();if(null!==n)try{a.util.isArray(n)||(n=[n]);for(var s=null,o=0;ou.MaxFragment;)n.push(u.createRecord(e,{type:t.type,data:a.util.createBuffer(i.slice(0,u.MaxFragment))})),i=i.slice(u.MaxFragment);i.length>0&&n.push(u.createRecord(e,{type:t.type,data:a.util.createBuffer(i)}))}for(var s=0;s0&&(n=r.order[0]),null!==n&&n in r.cache)for(var i in t=r.cache[n],delete r.cache[n],r.order)if(r.order[i]===n){r.order.splice(i,1);break}return t},r.setSession=function(e,t){if(r.order.length===r.capacity){var n=r.order.shift();delete r.cache[n]}n=a.util.bytesToHex(e);r.order.push(n),r.cache[n]=t}}return r},u.createConnection=function(e){var t=null;t=e.caStore?a.util.isArray(e.caStore)?a.pki.createCaStore(e.caStore):e.caStore:a.pki.createCaStore();var r=e.cipherSuites||null;if(null===r)for(var n in r=[],u.CipherSuites)r.push(u.CipherSuites[n]);var i=e.server?u.ConnectionEnd.server:u.ConnectionEnd.client,s=e.sessionCache?u.createSessionCache(e.sessionCache):null,o={version:{major:u.Version.major,minor:u.Version.minor},entity:i,sessionId:e.sessionId,caStore:t,sessionCache:s,cipherSuites:r,connected:e.connected,virtualHost:e.virtualHost||null,verifyClient:e.verifyClient||!1,verify:e.verify||function(e,t,r,a){return t},verifyOptions:e.verifyOptions||{},getCertificate:e.getCertificate||null,getPrivateKey:e.getPrivateKey||null,getSignature:e.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:e.tlsDataReady,dataReady:e.dataReady,heartbeatReceived:e.heartbeatReceived,closed:e.closed,error:function(t,r){r.origin=r.origin||(t.entity===u.ConnectionEnd.client?"client":"server"),r.send&&(u.queue(t,u.createAlert(t,r.alert)),u.flush(t));var a=!1!==r.fatal;a&&(t.fail=!0),e.error(t,r),a&&t.close(!1)},deflate:e.deflate||null,inflate:e.inflate||null,reset:function(e){o.version={major:u.Version.major,minor:u.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,u.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(e||void 0===e),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=u.createConnectionState(o)}};o.reset();return o.handshake=function(e){if(o.entity!==u.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var t=null;(e=e||"").length>0&&(o.sessionCache&&(t=o.sessionCache.getSession(e)),null===t&&(e="")),0===e.length&&o.sessionCache&&null!==(t=o.sessionCache.getSession())&&(e=t.id),o.session={id:e,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()},t&&(o.version=t.version,o.session.sp=t.sp),o.session.sp.client_random=u.createRandom().getBytes(),o.open=!0,u.queue(o,u.createRecord(o,{type:u.ContentType.handshake,data:u.createClientHello(o)})),u.flush(o)}},o.process=function(e){var t=0;return e&&o.input.putBytes(e),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(t=function(e){var t=0,r=e.input,n=r.length();if(n<5)t=5-n;else{e.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:a.util.createBuffer(),ready:!1};var i=e.record.version.major===e.version.major;i&&e.session&&e.session.version&&(i=e.record.version.minor===e.version.minor),i||e.error(e,{message:"Incompatible TLS version.",send:!0,alert:{level:u.Alert.Level.fatal,description:u.Alert.Description.protocol_version}})}return t}(o)),o.fail||null===o.record||o.record.ready||(t=function(e){var t=0,r=e.input,a=r.length();a=0;c--)w>>=8,w+=A.at(c)+k.at(c),k.setAt(c,255&w);N.putBuffer(k)}E=N,p.putBuffer(I)}return p.truncate(p.length()-i),p},s.pbe.getCipher=function(e,t,r){switch(e){case s.oids.pkcs5PBES2:return s.pbe.getCipherForPBES2(e,t,r);case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case s.oids["pbewithSHAAnd40BitRC2-CBC"]:return s.pbe.getCipherForPKCS12PBE(e,t,r);default:var a=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw a.oid=e,a.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],a}},s.pbe.getCipherForPBES2=function(e,t,r){var n,o={},c=[];if(!i.validate(t,u,o,c))throw(n=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=c,n;if((e=i.derToOid(o.kdfOid))!==s.oids.pkcs5PBKDF2)throw(n=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=e,n.supportedOids=["pkcs5PBKDF2"],n;if((e=i.derToOid(o.encOid))!==s.oids["aes128-CBC"]&&e!==s.oids["aes192-CBC"]&&e!==s.oids["aes256-CBC"]&&e!==s.oids["des-EDE3-CBC"]&&e!==s.oids.desCBC)throw(n=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=e,n.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],n;var l,p,h=o.kdfSalt,d=a.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),s.oids[e]){case"aes128-CBC":l=16,p=a.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,p=a.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,p=a.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,p=a.des.createDecryptionCipher;break;case"desCBC":l=8,p=a.des.createDecryptionCipher}var y=f(o.prfOid),g=a.pkcs5.pbkdf2(r,h,d,l,y),m=o.encIv,v=p(g);return v.start(m),v},s.pbe.getCipherForPKCS12PBE=function(e,t,r){var n={},o=[];if(!i.validate(t,l,n,o))throw(y=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,y;var c,u,p,h=a.util.createBuffer(n.salt),d=a.util.createBuffer(n.iterations);switch(d=d.getInt(d.length()<<3),e){case s.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:c=24,u=8,p=a.des.startDecrypting;break;case s.oids["pbewithSHAAnd40BitRC2-CBC"]:c=5,u=8,p=function(e,t){var r=a.rc2.createDecryptionCipher(e,40);return r.start(t,null),r};break;default:var y;throw(y=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=e,y}var g=f(n.prfOid),m=s.pbe.generatePkcs12Key(r,h,1,d,c,g);return g.start(),p(m,s.pbe.generatePkcs12Key(r,h,2,d,u,g))},s.pbe.opensslDeriveBytes=function(e,t,r,n){if(null==n){if(!("md5"in a.md))throw new Error('"md5" hash algorithm unavailable.');n=a.md.md5.create()}null===t&&(t="");for(var i=[p(n,e+t)],s=16,o=1;s>>0,o>>>0];for(var u=n.fullMessageLength.length-1;u>=0;--u)n.fullMessageLength[u]+=o[1],o[1]=o[0]+(n.fullMessageLength[u]/4294967296>>>0),n.fullMessageLength[u]=n.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return t.putBytes(i),c(e,r,t),(t.read>2048||0===t.length())&&t.compact(),n},n.digest=function(){var s=a.util.createBuffer();s.putBytes(t.bytes());var o,u=n.fullMessageLength[n.fullMessageLength.length-1]+n.messageLengthSize&n.blockLength-1;s.putBytes(i.substr(0,n.blockLength-u));for(var l=8*n.fullMessageLength[0],p=0;p>>0,s.putInt32(l>>>0),l=o>>>0;s.putInt32(l);var f={h0:e.h0,h1:e.h1,h2:e.h2,h3:e.h3,h4:e.h4,h5:e.h5,h6:e.h6,h7:e.h7};c(f,r,s);var h=a.util.createBuffer();return h.putInt32(f.h0),h.putInt32(f.h1),h.putInt32(f.h2),h.putInt32(f.h3),h.putInt32(f.h4),h.putInt32(f.h5),h.putInt32(f.h6),h.putInt32(f.h7),h},n};var i=null,s=!1,o=null;function c(e,t,r){for(var a,n,i,s,c,u,l,p,f,h,d,y,g,m=r.length();m>=64;){for(c=0;c<16;++c)t[c]=r.getInt32();for(;c<64;++c)a=((a=t[c-2])>>>17|a<<15)^(a>>>19|a<<13)^a>>>10,n=((n=t[c-15])>>>7|n<<25)^(n>>>18|n<<14)^n>>>3,t[c]=a+t[c-7]+n+t[c-16]|0;for(u=e.h0,l=e.h1,p=e.h2,f=e.h3,h=e.h4,d=e.h5,y=e.h6,g=e.h7,c=0;c<64;++c)i=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<10),s=u&l|p&(u^l),a=g+((h>>>6|h<<26)^(h>>>11|h<<21)^(h>>>25|h<<7))+(y^h&(d^y))+o[c]+t[c],g=y,y=d,d=h,h=f+a>>>0,f=p,p=l,l=u,u=a+(n=i+s)>>>0;e.h0=e.h0+u|0,e.h1=e.h1+l|0,e.h2=e.h2+p|0,e.h3=e.h3+f|0,e.h4=e.h4+h|0,e.h5=e.h5+d|0,e.h6=e.h6+y|0,e.h7=e.h7+g|0,m-=64}}},function(e,t,r){var a=r(0);r(1);var n=null;!a.util.isNodejs||a.options.usePureJavaScript||process.versions["node-webkit"]||(n=r(16)),(e.exports=a.prng=a.prng||{}).create=function(e){for(var t={plugin:e,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=e.md,i=new Array(32),s=0;s<32;++s)i[s]=r.create();function o(){if(t.pools[0].messageLength>=32)return c();var e=32-t.pools[0].messageLength<<5;t.collect(t.seedFileSync(e)),c()}function c(){t.reseeds=4294967295===t.reseeds?0:t.reseeds+1;var e=t.plugin.md.create();e.update(t.keyBytes);for(var r=1,a=0;a<32;++a)t.reseeds%r==0&&(e.update(t.pools[a].digest().getBytes()),t.pools[a].start()),r<<=1;t.keyBytes=e.digest().getBytes(),e.start(),e.update(t.keyBytes);var n=e.digest().getBytes();t.key=t.plugin.formatKey(t.keyBytes),t.seed=t.plugin.formatSeed(n),t.generated=0}function u(e){var t=null,r=a.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(t=function(e){return n.getRandomValues(e)});var i=a.util.createBuffer();if(t)for(;i.length()>16)))<<16,f=4294967295&(l=(2147483647&(l+=u>>15))+(l>>31));for(c=0;c<3;++c)p=f>>>(c<<3),p^=Math.floor(256*Math.random()),i.putByte(String.fromCharCode(255&p))}return i.getBytes(e)}return t.pools=i,t.pool=0,t.generate=function(e,r){if(!r)return t.generateSync(e);var n=t.plugin.cipher,i=t.plugin.increment,s=t.plugin.formatKey,o=t.plugin.formatSeed,u=a.util.createBuffer();t.key=null,function l(p){if(p)return r(p);if(u.length()>=e)return r(null,u.getBytes(e));t.generated>1048575&&(t.key=null);if(null===t.key)return a.util.nextTick((function(){!function(e){if(t.pools[0].messageLength>=32)return c(),e();var r=32-t.pools[0].messageLength<<5;t.seedFile(r,(function(r,a){if(r)return e(r);t.collect(a),c(),e()}))}(l)}));var f=n(t.key,t.seed);t.generated+=f.length,u.putBytes(f),t.key=s(n(t.key,i(t.seed))),t.seed=o(n(t.key,t.seed)),a.util.setImmediate(l)}()},t.generateSync=function(e){var r=t.plugin.cipher,n=t.plugin.increment,i=t.plugin.formatKey,s=t.plugin.formatSeed;t.key=null;for(var c=a.util.createBuffer();c.length()1048575&&(t.key=null),null===t.key&&o();var u=r(t.key,t.seed);t.generated+=u.length,c.putBytes(u),t.key=i(r(t.key,n(t.seed))),t.seed=s(r(t.key,t.seed))}return c.getBytes(e)},n?(t.seedFile=function(e,t){n.randomBytes(e,(function(e,r){if(e)return t(e);t(null,r.toString())}))},t.seedFileSync=function(e){return n.randomBytes(e).toString()}):(t.seedFile=function(e,t){try{t(null,u(e))}catch(e){t(e)}},t.seedFileSync=u),t.collect=function(e){for(var r=e.length,a=0;a>n&255);t.collect(a)},t.registerWorker=function(e){if(e===self)t.seedFile=function(e,t){self.addEventListener("message",(function e(r){var a=r.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",e),t(a.forge.prng.err,a.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:e}}})};else{e.addEventListener("message",(function(r){var a=r.data;a.forge&&a.forge.prng&&t.seedFile(a.forge.prng.needed,(function(t,r){e.postMessage({forge:{prng:{err:t,bytes:r}}})}))}))}},t}},function(e,t,r){var a=r(0);r(1);var n=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],i=[1,2,3,5],s=function(e,t){return e<>16-t},o=function(e,t){return(65535&e)>>t|e<<16-t&65535};e.exports=a.rc2=a.rc2||{},a.rc2.expandKey=function(e,t){"string"==typeof e&&(e=a.util.createBuffer(e)),t=t||128;var r,i=e,s=e.length(),o=t,c=Math.ceil(o/8),u=255>>(7&o);for(r=s;r<128;r++)i.putByte(n[i.at(r-1)+i.at(r-s)&255]);for(i.setAt(128-c,n[i.at(128-c)&u]),r=127-c;r>=0;r--)i.setAt(r,n[i.at(r+1)^i.at(r+c)]);return i};var c=function(e,t,r){var n,c,u,l,p=!1,f=null,h=null,d=null,y=[];for(e=a.rc2.expandKey(e,t),u=0;u<64;u++)y.push(e.getInt16Le());r?(n=function(e){for(u=0;u<4;u++)e[u]+=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),e[u]=s(e[u],i[u]),l++},c=function(e){for(u=0;u<4;u++)e[u]+=y[63&e[(u+3)%4]]}):(n=function(e){for(u=3;u>=0;u--)e[u]=o(e[u],i[u]),e[u]-=y[l]+(e[(u+3)%4]&e[(u+2)%4])+(~e[(u+3)%4]&e[(u+1)%4]),l--},c=function(e){for(u=3;u>=0;u--)e[u]-=y[63&e[(u+3)%4]]});var g=function(e){var t=[];for(u=0;u<4;u++){var a=f.getInt16Le();null!==d&&(r?a^=d.getInt16Le():d.putInt16Le(a)),t.push(65535&a)}l=r?0:63;for(var n=0;n=8;)g([[5,n],[1,c],[6,n],[1,c],[5,n]])},finish:function(e){var t=!0;if(r)if(e)t=e(8,f,!r);else{var a=8===f.length()?8:8-f.length();f.fillWithByte(a,a)}if(t&&(p=!0,m.update()),!r&&(t=0===f.length()))if(e)t=e(8,h,!r);else{var n=h.length(),i=h.at(n-1);i>n?t=!1:h.truncate(i)}return t}}};a.rc2.startEncrypting=function(e,t,r){var n=a.rc2.createEncryptionCipher(e,128);return n.start(t,r),n},a.rc2.createEncryptionCipher=function(e,t){return c(e,t,!0)},a.rc2.startDecrypting=function(e,t,r){var n=a.rc2.createDecryptionCipher(e,128);return n.start(t,r),n},a.rc2.createDecryptionCipher=function(e,t){return c(e,t,!1)}},function(e,t,r){var a=r(0);r(1),r(2),r(9);var n=e.exports=a.pkcs1=a.pkcs1||{};function i(e,t,r){r||(r=a.md.sha1.create());for(var n="",i=Math.ceil(t/r.digestLength),s=0;s>24&255,s>>16&255,s>>8&255,255&s);r.start(),r.update(e+o),n+=r.digest().getBytes()}return n.substring(0,t)}n.encode_rsa_oaep=function(e,t,r){var n,s,o,c;"string"==typeof r?(n=r,s=arguments[3]||void 0,o=arguments[4]||void 0):r&&(n=r.label||void 0,s=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(c=r.mgf1.md)),o?o.start():o=a.md.sha1.create(),c||(c=o);var u=Math.ceil(e.n.bitLength()/8),l=u-2*o.digestLength-2;if(t.length>l)throw(g=new Error("RSAES-OAEP input message length is too long.")).length=t.length,g.maxLength=l,g;n||(n=""),o.update(n,"raw");for(var p=o.digest(),f="",h=l-t.length,d=0;de&&(s=c(e,t));var h=s.toString(16);n.target.postMessage({hex:h,workLoad:l}),s.dAddOffset(p,0)}}}h()}(e,t,n,i);return o(e,t,n,i)}(e,u,i.options,n);throw new Error("Invalid prime generation algorithm: "+i.name)}}function o(e,t,r,i){var s=c(e,t),o=function(e){return e<=100?27:e<=150?18:e<=200?15:e<=250?12:e<=300?9:e<=350?8:e<=400?7:e<=500?6:e<=600?5:e<=800?4:e<=1250?3:2}(s.bitLength());"millerRabinTests"in r&&(o=r.millerRabinTests);var u=10;"maxBlockTime"in r&&(u=r.maxBlockTime),function e(t,r,i,s,o,u,l){var p=+new Date;do{if(t.bitLength()>r&&(t=c(r,i)),t.isProbablePrime(o))return l(null,t);t.dAddOffset(n[s++%8],0)}while(u<0||+new Date-p=0&&n.push(o):n.push(o))}return n}function h(e){if(e.composed||e.constructed){for(var t=a.util.createBuffer(),r=0;r0&&(c=n.create(n.Class.UNIVERSAL,n.Type.SET,!0,p));var f=[],h=[];null!==t&&(h=a.util.isArray(t)?t:[t]);for(var d=[],y=0;y0){var C=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,d),E=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(C).getBytes())])]);f.push(E)}var S=null;if(null!==e){var T=i.wrapRsaPrivateKey(i.privateKeyToAsn1(e));S=null===r?n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.keyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[T]),c]):n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(T,r,o)]),c]);var I=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[S]),b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(I).getBytes())])]);f.push(b)}var A,B=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,f);if(o.useMac){var N=a.md.sha1.create(),k=new a.util.ByteBuffer(a.random.getBytes(o.saltSize)),w=o.count,R=(e=s.generateKey(r,k,3,w,20),a.hmac.create());R.start(N,e),R.update(n.toDer(B).getBytes());var _=R.getMac();A=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.sha1).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,_.getBytes())]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,k.getBytes()),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(w).getBytes())])}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(3).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(i.oids.data).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,n.toDer(B).getBytes())])]),A])},s.generateKey=a.pbe.generatePkcs12Key},function(e,t,r){var a=r(0);r(3),r(1);var n=a.asn1,i=e.exports=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=a.pkcs7||{},a.pkcs7.asn1=i;var s={name:"ContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};i.contentInfoValidator=s;var o={name:"EncryptedContentInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};i.envelopedDataValidator={name:"EnvelopedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},i.encryptedDataValidator={name:"EncryptedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var c={name:"SignerInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};i.signedDataValidator={name:"SignedData",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},s,{name:"SignedData.Certificates",tagClass:n.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:n.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:n.Class.UNIVERSAL,type:n.Type.SET,capture:"signerInfos",optional:!0,value:[c]}]},i.recipientInfoValidator={name:"RecipientInfo",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:n.Class.UNIVERSAL,type:n.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:n.Class.UNIVERSAL,type:n.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:n.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:n.Class.UNIVERSAL,type:n.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},function(e,t,r){var a=r(0);r(1),a.mgf=a.mgf||{},(e.exports=a.mgf.mgf1=a.mgf1=a.mgf1||{}).create=function(e){return{generate:function(t,r){for(var n=new a.util.ByteBuffer,i=Math.ceil(r/e.digestLength),s=0;s>>0,s>>>0];for(var o=h.fullMessageLength.length-1;o>=0;--o)h.fullMessageLength[o]+=s[1],s[1]=s[0]+(h.fullMessageLength[o]/4294967296>>>0),h.fullMessageLength[o]=h.fullMessageLength[o]>>>0,s[0]=s[1]/4294967296>>>0;return n.putBytes(e),l(r,i,n),(n.read>2048||0===n.length())&&n.compact(),h},h.digest=function(){var t=a.util.createBuffer();t.putBytes(n.bytes());var o,c=h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1;t.putBytes(s.substr(0,h.blockLength-c));for(var u=8*h.fullMessageLength[0],p=0;p>>0,t.putInt32(u>>>0),u=o>>>0;t.putInt32(u);var f=new Array(r.length);for(p=0;p=128;){for(R=0;R<16;++R)t[R][0]=r.getInt32()>>>0,t[R][1]=r.getInt32()>>>0;for(;R<80;++R)a=(((_=(U=t[R-2])[0])>>>19|(L=U[1])<<13)^(L>>>29|_<<3)^_>>>6)>>>0,n=((_<<13|L>>>19)^(L<<3|_>>>29)^(_<<26|L>>>6))>>>0,i=(((_=(P=t[R-15])[0])>>>1|(L=P[1])<<31)^(_>>>8|L<<24)^_>>>7)>>>0,s=((_<<31|L>>>1)^(_<<24|L>>>8)^(_<<25|L>>>7))>>>0,D=t[R-7],V=t[R-16],L=n+D[1]+s+V[1],t[R][0]=a+D[0]+i+V[0]+(L/4294967296>>>0)>>>0,t[R][1]=L>>>0;for(d=e[0][0],y=e[0][1],g=e[1][0],m=e[1][1],v=e[2][0],C=e[2][1],E=e[3][0],S=e[3][1],T=e[4][0],I=e[4][1],b=e[5][0],A=e[5][1],B=e[6][0],N=e[6][1],k=e[7][0],w=e[7][1],R=0;R<80;++R)l=((T>>>14|I<<18)^(T>>>18|I<<14)^(I>>>9|T<<23))>>>0,p=(B^T&(b^B))>>>0,o=((d>>>28|y<<4)^(y>>>2|d<<30)^(y>>>7|d<<25))>>>0,u=((d<<4|y>>>28)^(y<<30|d>>>2)^(y<<25|d>>>7))>>>0,f=(d&g|v&(d^g))>>>0,h=(y&m|C&(y^m))>>>0,L=w+(((T<<18|I>>>14)^(T<<14|I>>>18)^(I<<23|T>>>9))>>>0)+((N^I&(A^N))>>>0)+c[R][1]+t[R][1],a=k+l+p+c[R][0]+t[R][0]+(L/4294967296>>>0)>>>0,n=L>>>0,i=o+f+((L=u+h)/4294967296>>>0)>>>0,s=L>>>0,k=B,w=N,B=b,N=A,b=T,A=I,T=E+a+((L=S+n)/4294967296>>>0)>>>0,I=L>>>0,E=v,S=C,v=g,C=m,g=d,m=y,d=a+i+((L=n+s)/4294967296>>>0)>>>0,y=L>>>0;L=e[0][1]+y,e[0][0]=e[0][0]+d+(L/4294967296>>>0)>>>0,e[0][1]=L>>>0,L=e[1][1]+m,e[1][0]=e[1][0]+g+(L/4294967296>>>0)>>>0,e[1][1]=L>>>0,L=e[2][1]+C,e[2][0]=e[2][0]+v+(L/4294967296>>>0)>>>0,e[2][1]=L>>>0,L=e[3][1]+S,e[3][0]=e[3][0]+E+(L/4294967296>>>0)>>>0,e[3][1]=L>>>0,L=e[4][1]+I,e[4][0]=e[4][0]+T+(L/4294967296>>>0)>>>0,e[4][1]=L>>>0,L=e[5][1]+A,e[5][0]=e[5][0]+b+(L/4294967296>>>0)>>>0,e[5][1]=L>>>0,L=e[6][1]+N,e[6][0]=e[6][0]+B+(L/4294967296>>>0)>>>0,e[6][1]=L>>>0,L=e[7][1]+w,e[7][0]=e[7][0]+k+(L/4294967296>>>0)>>>0,e[7][1]=L>>>0,O-=128}}},function(e,t,r){var a=r(0);r(1),e.exports=a.log=a.log||{},a.log.levels=["none","error","warning","info","debug","verbose","max"];var n={},i=[],s=null;a.log.LEVEL_LOCKED=2,a.log.NO_LEVEL_CHECK=4,a.log.INTERPOLATE=8;for(var o=0;o0;)o.push(u%i),u=u/i|0}for(n=0;0===e[n]&&n=0;--n)a+=t[o[n]]}else a=function(e,t){var r=0,a=t.length,n=t.charAt(0),i=[0];for(r=0;r0;)i.push(o%a),o=o/a|0}var c="";for(r=0;0===e.at(r)&&r=0;--r)c+=t[i[r]];return c}(e,t);if(r){var l=new RegExp(".{1,"+r+"}","g");a=a.match(l).join("\r\n")}return a},r.decode=function(e,t){if("string"!=typeof e)throw new TypeError('"input" must be a string.');if("string"!=typeof t)throw new TypeError('"alphabet" must be a string.');var r=a[t];if(!r){r=a[t]=[];for(var n=0;n>=8;for(;l>0;)o.push(255&l),l>>=8}for(var p=0;e[p]===s&&p=n.Versions.TLS_1_1.minor&&c.output.putBytes(r),c.update(e.fragment),c.finish(o)&&(e.fragment=c.output,e.length=e.fragment.length(),i=!0),i}function o(e,t,r){if(!r){var a=e-t.length()%e;t.fillWithByte(a-1,a)}return!0}function c(e,t,r){var a=!0;if(r){for(var n=t.length(),i=t.last(),s=n-1-i;s=o?(e.fragment=s.output.getBytes(l-o),u=s.output.getBytes(o)):e.fragment=s.output.getBytes(),e.fragment=a.util.createBuffer(e.fragment),e.length=e.fragment.length();var p=t.macFunction(t.macKey,t.sequenceNumber,e);return t.updateSequenceNumber(),i=function(e,t,r){var n=a.hmac.create();return n.start("SHA1",e),n.update(t),t=n.digest().getBytes(),n.start(null,null),n.update(r),r=n.digest().getBytes(),t===r}(t.macKey,u,p)&&i}n.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=16,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i},n.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(e){e.bulk_cipher_algorithm=n.BulkCipherAlgorithm.aes,e.cipher_type=n.CipherType.block,e.enc_key_length=32,e.block_length=16,e.fixed_iv_length=16,e.record_iv_length=16,e.mac_algorithm=n.MACAlgorithm.hmac_sha1,e.mac_length=20,e.mac_key_length=20},initConnectionState:i}},function(e,t,r){var a=r(0);r(30),e.exports=a.mgf=a.mgf||{},a.mgf.mgf1=a.mgf1},function(e,t,r){var a=r(0);r(12),r(2),r(32),r(1);var n=r(41),i=n.publicKeyValidator,s=n.privateKeyValidator;if(void 0===o)var o=a.jsbn.BigInteger;var c=a.util.ByteBuffer,u="undefined"==typeof Buffer?Uint8Array:Buffer;a.pki=a.pki||{},e.exports=a.pki.ed25519=a.ed25519=a.ed25519||{};var l=a.ed25519;function p(e){var t=e.message;if(t instanceof Uint8Array||t instanceof u)return t;var r=e.encoding;if(void 0===t){if(!e.md)throw new TypeError('"options.message" or "options.md" not specified.');t=e.md.digest().getBytes(),r="binary"}if("string"==typeof t&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof t){if("undefined"!=typeof Buffer)return Buffer.from(t,r);t=new c(t,r)}else if(!(t instanceof c))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var a=new u(t.length()),n=0;n=0;--r)K(a,a),1!==r&&x(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(r,r),x(r,r,n),x(r,r,i),x(r,r,i),x(e[0],r,i),K(a,e[0]),x(a,a,i),N(a,n)&&x(e[0],e[0],C);if(K(a,e[0]),x(a,a,i),N(a,n))return-1;w(e[0])===t[31]>>7&&O(e[0],f,e[0]);return x(e[3],e[0],e[1]),0}(o,a))return-1;for(n=0;n=0};var f=P(),h=P([1]),d=P([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=P([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),g=P([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=P([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),v=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),C=P([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function E(e,t){var r=a.md.sha512.create(),n=new c(e);r.update(n.getBytes(t),"binary");var i=r.digest().getBytes();if("undefined"!=typeof Buffer)return Buffer.from(i,"binary");for(var s=new u(l.constants.HASH_BYTE_LENGTH),o=0;o<64;++o)s[o]=i.charCodeAt(o);return s}function S(e,t){var r,a,n,i;for(a=63;a>=32;--a){for(r=0,n=a-32,i=a-12;n>8,t[n]-=256*r;t[n]+=r,t[a]=0}for(r=0,n=0;n<32;++n)t[n]+=r-(t[31]>>4)*v[n],r=t[n]>>8,t[n]&=255;for(n=0;n<32;++n)t[n]-=r*v[n];for(a=0;a<32;++a)t[a+1]+=t[a]>>8,e[a]=255&t[a]}function T(e){for(var t=new Float64Array(64),r=0;r<64;++r)t[r]=e[r],e[r]=0;S(e,t)}function I(e,t){var r=P(),a=P(),n=P(),i=P(),s=P(),o=P(),c=P(),u=P(),l=P();O(r,e[1],e[0]),O(l,t[1],t[0]),x(r,r,l),V(a,e[0],e[1]),V(l,t[0],t[1]),x(a,a,l),x(n,e[3],t[3]),x(n,n,y),x(i,e[2],t[2]),V(i,i,i),O(s,a,r),O(o,i,n),V(c,i,n),V(u,a,r),x(e[0],s,o),x(e[1],u,c),x(e[2],c,o),x(e[3],s,u)}function b(e,t,r){for(var a=0;a<4;++a)D(e[a],t[a],r)}function A(e,t){var r=P(),a=P(),n=P();!function(e,t){var r,a=P();for(r=0;r<16;++r)a[r]=t[r];for(r=253;r>=0;--r)K(a,a),2!==r&&4!==r&&x(a,a,t);for(r=0;r<16;++r)e[r]=a[r]}(n,t[2]),x(r,t[0],n),x(a,t[1],n),B(e,a),e[31]^=w(r)<<7}function B(e,t){var r,a,n,i=P(),s=P();for(r=0;r<16;++r)s[r]=t[r];for(U(s),U(s),U(s),a=0;a<2;++a){for(i[0]=s[0]-65517,r=1;r<15;++r)i[r]=s[r]-65535-(i[r-1]>>16&1),i[r-1]&=65535;i[15]=s[15]-32767-(i[14]>>16&1),n=i[15]>>16&1,i[14]&=65535,D(s,i,1-n)}for(r=0;r<16;r++)e[2*r]=255&s[r],e[2*r+1]=s[r]>>8}function N(e,t){var r=new u(32),a=new u(32);return B(r,e),B(a,t),k(r,0,a,0)}function k(e,t,r,a){return function(e,t,r,a,n){var i,s=0;for(i=0;i>>8)-1}(e,t,r,a,32)}function w(e){var t=new u(32);return B(t,e),1&t[0]}function R(e,t,r){var a,n;for(L(e[0],f),L(e[1],h),L(e[2],h),L(e[3],f),n=255;n>=0;--n)b(e,t,a=r[n/8|0]>>(7&n)&1),I(t,e),I(e,e),b(e,t,a)}function _(e,t){var r=[P(),P(),P(),P()];L(r[0],g),L(r[1],m),L(r[2],h),x(r[3],g,m),R(e,r,t)}function L(e,t){var r;for(r=0;r<16;r++)e[r]=0|t[r]}function U(e){var t,r,a=1;for(t=0;t<16;++t)r=e[t]+a+65535,a=Math.floor(r/65536),e[t]=r-65536*a;e[0]+=a-1+37*(a-1)}function D(e,t,r){for(var a,n=~(r-1),i=0;i<16;++i)a=n&(e[i]^t[i]),e[i]^=a,t[i]^=a}function P(e){var t,r=new Float64Array(16);if(e)for(t=0;t0&&(s=a.util.fillString(String.fromCharCode(0),c)+s),{encapsulation:t.encrypt(s,"NONE"),key:e.generate(s,i)}},decrypt:function(t,r,a){var n=t.decrypt(r,"NONE");return e.generate(n,a)}};return i},a.kem.kdf1=function(e,t){i(this,e,0,t||e.digestLength)},a.kem.kdf2=function(e,t){i(this,e,1,t||e.digestLength)}},function(e,t,r){e.exports=r(4),r(14),r(9),r(23),r(32)},function(e,t,r){var a=r(0);r(5),r(3),r(10),r(6),r(7),r(29),r(2),r(1),r(17);var n=a.asn1,i=e.exports=a.pkcs7=a.pkcs7||{};function s(e){var t={},r=[];if(!n.validate(e,i.asn1.recipientInfoValidator,t,r)){var s=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw s.errors=r,s}return{version:t.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(t.issuer),serialNumber:a.util.createBuffer(t.serial).toHex(),encryptedContent:{algorithm:n.derToOid(t.encAlgorithm),parameter:t.encParameter.value,content:t.encKey}}}function o(e){for(var t,r=[],i=0;i0){for(var r=n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),i=0;i=r&&s0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,t)),i.length>0&&s.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,1,!0,i)),s.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,e.signerInfos)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(e.type).getBytes()),s])},addSigner:function(t){var r=t.issuer,n=t.serialNumber;if(t.certificate){var i=t.certificate;"string"==typeof i&&(i=a.pki.certificateFromPem(i)),r=i.issuer.attributes,n=i.serialNumber}var s=t.key;if(!s)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof s&&(s=a.pki.privateKeyFromPem(s));var o=t.digestAlgorithm||a.pki.oids.sha1;switch(o){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var c=t.authenticatedAttributes||[];if(c.length>0){for(var u=!1,l=!1,p=0;p="8"&&(r="00"+r);var n=a.util.hexToBytes(r);e.putInt32(n.length),e.putBytes(n)}function s(e,t){e.putInt32(t.length),e.putString(t)}function o(){for(var e=a.md.sha1.create(),t=arguments.length,r=0;r0&&(this.state=g[this.state].block)},m.prototype.unblock=function(e){return e=void 0===e?1:e,this.blocks-=e,0===this.blocks&&this.state!==f&&(this.state=u,v(this,0)),this.blocks},m.prototype.sleep=function(e){e=void 0===e?0:e,this.state=g[this.state].sleep;var t=this;this.timeoutId=setTimeout((function(){t.timeoutId=null,t.state=u,v(t,0)}),e)},m.prototype.wait=function(e){e.wait(this)},m.prototype.wakeup=function(){this.state===p&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state=u,v(this,0))},m.prototype.cancel=function(){this.state=g[this.state].cancel,this.permitsNeeded=0,null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null),this.subtasks=[]},m.prototype.fail=function(e){if(this.error=!0,C(this,!0),e)e.error=this.error,e.swapTime=this.swapTime,e.userData=this.userData,v(e,0);else{if(null!==this.parent){for(var t=this.parent;null!==t.parent;)t.error=this.error,t.swapTime=this.swapTime,t.userData=this.userData,t=t.parent;C(t,!0)}this.failureCallback&&this.failureCallback(this)}};var v=function(e,t){var r=t>30||+new Date-e.swapTime>20,a=function(t){if(t++,e.state===u)if(r&&(e.swapTime=+new Date),e.subtasks.length>0){var a=e.subtasks.shift();a.error=e.error,a.swapTime=e.swapTime,a.userData=e.userData,a.run(a),a.error||v(a,t)}else C(e),e.error||null!==e.parent&&(e.parent.error=e.error,e.parent.swapTime=e.swapTime,e.parent.userData=e.userData,v(e.parent,t))};r?setTimeout(a,0):a(t)},C=function(e,t){e.state=f,delete i[e.id],null===e.parent&&(e.type in o?0===o[e.type].length?a.log.error(n,"[%s][%s] task queue empty [%s]",e.id,e.name,e.type):o[e.type][0]!==e?a.log.error(n,"[%s][%s] task not first in queue [%s]",e.id,e.name,e.type):(o[e.type].shift(),0===o[e.type].length?delete o[e.type]:o[e.type][0].start()):a.log.error(n,"[%s][%s] task queue missing [%s]",e.id,e.name,e.type),t||(e.error&&e.failureCallback?e.failureCallback(e):!e.error&&e.successCallback&&e.successCallback(e)))};e.exports=a.task=a.task||{},a.task.start=function(e){var t=new m({run:e.run,name:e.name||"?"});t.type=e.type,t.successCallback=e.success||null,t.failureCallback=e.failure||null,t.type in o?o[e.type].push(t):(o[t.type]=[t],function(e){e.error=!1,e.state=g[e.state][y],setTimeout((function(){e.state===u&&(e.swapTime=+new Date,e.run(e),v(e,0))}),0)}(t))},a.task.cancel=function(e){e in o&&(o[e]=[o[e][0]])},a.task.createCondition=function(){var e={tasks:{},wait:function(t){t.id in e.tasks||(t.block(),e.tasks[t.id]=t)},notify:function(){var t=e.tasks;for(var r in e.tasks={},t)t[r].unblock()}};return e}}])})); -//# sourceMappingURL=forge.min.js.map \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-forge/dist/forge.min.js.map b/reverse_engineering/node_modules/node-forge/dist/forge.min.js.map deleted file mode 100644 index 8e904656..00000000 --- a/reverse_engineering/node_modules/node-forge/dist/forge.min.js.map +++ /dev/null @@ -1 +0,0 @@ -{"version":3,"file":"forge.min.js","sources":["webpack://[name]/forge.min.js"],"mappings":"AAAA","sourceRoot":""} \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-forge/dist/prime.worker.min.js b/reverse_engineering/node_modules/node-forge/dist/prime.worker.min.js deleted file mode 100644 index 41433bed..00000000 --- a/reverse_engineering/node_modules/node-forge/dist/prime.worker.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(t){var i={};function r(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,r),s.l=!0,s.exports}r.m=t,r.c=i,r.d=function(t,i,o){r.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},r.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},r.t=function(t,i){if(1&i&&(t=r(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var s in t)r.d(o,s,function(i){return t[i]}.bind(null,s));return o},r.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(i,"a",i),i},r.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},r.p="",r(r.s=1)}([function(t,i){t.exports={options:{usePureJavaScript:!1}}},function(t,i,r){r(2),t.exports=r(0)},function(t,i,r){var o=r(0);r(3);var s=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],e=(1<<26)/s[s.length-1],a=o.jsbn.BigInteger;new a(null).fromInt(2),self.addEventListener("message",(function(t){var i=function(t){for(var i=new a(t.hex,16),r=0,o=t.workLoad,s=0;s=0);var u=o.modPow(s,t);if(0!==u.compareTo(a.ONE)&&0!==u.compareTo(i)){for(var f=r;--f;){if(0===(u=u.modPowInt(2,t)).compareTo(a.ONE))return!1;if(0===u.compareTo(i))break}if(0===f)return!1}}var p;return!0}(t)}},function(t,i,r){var o,s=r(0);t.exports=s.jsbn=s.jsbn||{};function e(t,i,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,i,r):null==i&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,i))}function a(){return new e(null)}function n(t,i,r,o,s,e){for(var a=16383&i,n=i>>14;--e>=0;){var h=16383&this.data[t],u=this.data[t++]>>14,f=n*h+u*a;s=((h=a*h+((16383&f)<<14)+r.data[o]+s)>>28)+(f>>14)+n*u,r.data[o++]=268435455&h}return s}s.jsbn.BigInteger=e,"undefined"==typeof navigator?(e.prototype.am=n,o=28):"Microsoft Internet Explorer"==navigator.appName?(e.prototype.am=function(t,i,r,o,s,e){for(var a=32767&i,n=i>>15;--e>=0;){var h=32767&this.data[t],u=this.data[t++]>>15,f=n*h+u*a;s=((h=a*h+((32767&f)<<15)+r.data[o]+(1073741823&s))>>>30)+(f>>>15)+n*u+(s>>>30),r.data[o++]=1073741823&h}return s},o=30):"Netscape"!=navigator.appName?(e.prototype.am=function(t,i,r,o,s,e){for(;--e>=0;){var a=i*this.data[t++]+r.data[o]+s;s=Math.floor(a/67108864),r.data[o++]=67108863&a}return s},o=26):(e.prototype.am=n,o=28),e.prototype.DB=o,e.prototype.DM=(1<>>16)&&(t=i,r+=16),0!=(i=t>>8)&&(t=i,r+=8),0!=(i=t>>4)&&(t=i,r+=4),0!=(i=t>>2)&&(t=i,r+=2),0!=(i=t>>1)&&(t=i,r+=1),r}function l(t){this.m=t}function v(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=16,i+=16),0==(255&t)&&(t>>=8,i+=8),0==(15&t)&&(t>>=4,i+=4),0==(3&t)&&(t>>=2,i+=2),0==(1&t)&&++i,i}function B(t){for(var i=0;0!=t;)t&=t-1,++i;return i}function S(){}function M(t){return t}function w(t){this.r2=a(),this.q3=a(),e.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}l.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},l.prototype.revert=function(t){return t},l.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},l.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},l.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},v.prototype.convert=function(t){var i=a();return t.abs().dlShiftTo(this.m.t,i),i.divRemTo(this.m,null,i),t.s<0&&i.compareTo(e.ZERO)>0&&this.m.subTo(i,i),i},v.prototype.revert=function(t){var i=a();return t.copyTo(i),this.reduce(i),i},v.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var i=0;i>15)*this.mpl&this.um)<<15)&t.DM;for(r=i+this.m.t,t.data[r]+=this.m.am(0,o,t,i,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},v.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},v.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)},e.prototype.copyTo=function(t){for(var i=this.t-1;i>=0;--i)t.data[i]=this.data[i];t.t=this.t,t.s=this.s},e.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this.data[0]=t:t<-1?this.data[0]=t+this.DV:this.t=0},e.prototype.fromString=function(t,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromRadix(t,i);r=2}this.t=0,this.s=0;for(var o=t.length,s=!1,a=0;--o>=0;){var n=8==r?255&t[o]:d(t,o);n<0?"-"==t.charAt(o)&&(s=!0):(s=!1,0==a?this.data[this.t++]=n:a+r>this.DB?(this.data[this.t-1]|=(n&(1<>this.DB-a):this.data[this.t-1]|=n<=this.DB&&(a-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<0&&this.data[this.t-1]==t;)--this.t},e.prototype.dlShiftTo=function(t,i){var r;for(r=this.t-1;r>=0;--r)i.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)i.data[r]=0;i.t=this.t+t,i.s=this.s},e.prototype.drShiftTo=function(t,i){for(var r=t;r=0;--r)i.data[r+a+1]=this.data[r]>>s|n,n=(this.data[r]&e)<=0;--r)i.data[r]=0;i.data[a]=n,i.t=this.t+a+1,i.s=this.s,i.clamp()},e.prototype.rShiftTo=function(t,i){i.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)i.t=0;else{var o=t%this.DB,s=this.DB-o,e=(1<>o;for(var a=r+1;a>o;o>0&&(i.data[this.t-r-1]|=(this.s&e)<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;r>=this.DB;o-=t.s}i.s=o<0?-1:0,o<-1?i.data[r++]=this.DV+o:o>0&&(i.data[r++]=o),i.t=r,i.clamp()},e.prototype.multiplyTo=function(t,i){var r=this.abs(),o=t.abs(),s=r.t;for(i.t=s+o.t;--s>=0;)i.data[s]=0;for(s=0;s=0;)t.data[r]=0;for(r=0;r=i.DV&&(t.data[r+i.t]-=i.DV,t.data[r+i.t+1]=1)}t.t>0&&(t.data[t.t-1]+=i.am(r,i.data[r],t,2*r,0,1)),t.s=0,t.clamp()},e.prototype.divRemTo=function(t,i,r){var o=t.abs();if(!(o.t<=0)){var s=this.abs();if(s.t0?(o.lShiftTo(f,n),s.lShiftTo(f,r)):(o.copyTo(n),s.copyTo(r));var p=n.t,d=n.data[p-1];if(0!=d){var c=d*(1<1?n.data[p-2]>>this.F2:0),l=this.FV/c,v=(1<=0&&(r.data[r.t++]=1,r.subTo(g,r)),e.ONE.dlShiftTo(p,g),g.subTo(n,n);n.t=0;){var D=r.data[--y]==d?this.DM:Math.floor(r.data[y]*l+(r.data[y-1]+T)*v);if((r.data[y]+=n.am(0,D,r,b,0,p))0&&r.rShiftTo(f,r),h<0&&e.ZERO.subTo(r,r)}}},e.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var i=3&t;return(i=(i=(i=(i=i*(2-(15&t)*i)&15)*(2-(255&t)*i)&255)*(2-((65535&t)*i&65535))&65535)*(2-t*i%this.DV)%this.DV)>0?this.DV-i:-i},e.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},e.prototype.exp=function(t,i){if(t>4294967295||t<1)return e.ONE;var r=a(),o=a(),s=i.convert(this),n=m(t)-1;for(s.copyTo(r);--n>=0;)if(i.sqrTo(r,o),(t&1<0)i.mulTo(o,s,r);else{var h=r;r=o,o=h}return i.revert(r)},e.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toRadix(t);i=2}var r,o=(1<0)for(n>n)>0&&(s=!0,e=p(r));a>=0;)n>(n+=this.DB-i)):(r=this.data[a]>>(n-=i)&o,n<=0&&(n+=this.DB,--a)),r>0&&(s=!0),s&&(e+=p(r));return s?e:"0"},e.prototype.negate=function(){var t=a();return e.ZERO.subTo(this,t),t},e.prototype.abs=function(){return this.s<0?this.negate():this},e.prototype.compareTo=function(t){var i=this.s-t.s;if(0!=i)return i;var r=this.t;if(0!=(i=r-t.t))return this.s<0?-i:i;for(;--r>=0;)if(0!=(i=this.data[r]-t.data[r]))return i;return 0},e.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+m(this.data[this.t-1]^this.s&this.DM)},e.prototype.mod=function(t){var i=a();return this.abs().divRemTo(t,null,i),this.s<0&&i.compareTo(e.ZERO)>0&&t.subTo(i,i),i},e.prototype.modPowInt=function(t,i){var r;return r=t<256||i.isEven()?new l(i):new v(i),this.exp(t,r)},e.ZERO=c(0),e.ONE=c(1),S.prototype.convert=M,S.prototype.revert=M,S.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r)},S.prototype.sqrTo=function(t,i){t.squareTo(i)},w.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var i=a();return t.copyTo(i),this.reduce(i),i},w.prototype.revert=function(t){return t},w.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},w.prototype.mulTo=function(t,i,r){t.multiplyTo(i,r),this.reduce(r)},w.prototype.sqrTo=function(t,i){t.squareTo(i),this.reduce(i)};var E=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],O=(1<<26)/E[E.length-1];e.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},e.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var i=this.chunkSize(t),r=Math.pow(t,i),o=c(r),s=a(),e=a(),n="";for(this.divRemTo(o,s,e);s.signum()>0;)n=(r+e.intValue()).toString(t).substr(1)+n,s.divRemTo(o,s,e);return e.intValue().toString(t)+n},e.prototype.fromRadix=function(t,i){this.fromInt(0),null==i&&(i=10);for(var r=this.chunkSize(i),o=Math.pow(i,r),s=!1,a=0,n=0,h=0;h=r&&(this.dMultiply(o),this.dAddOffset(n,0),a=0,n=0))}a>0&&(this.dMultiply(Math.pow(i,a)),this.dAddOffset(n,0)),s&&e.ZERO.subTo(this,this)},e.prototype.fromNumber=function(t,i,r){if("number"==typeof i)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(e.ONE.shiftLeft(t-1),y,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(i);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(e.ONE.shiftLeft(t-1),this);else{var o=new Array,s=7&t;o.length=1+(t>>3),i.nextBytes(o),s>0?o[0]&=(1<>=this.DB;if(t.t>=this.DB;o+=this.s}else{for(o+=this.s;r>=this.DB;o+=t.s}i.s=o<0?-1:0,o>0?i.data[r++]=o:o<-1&&(i.data[r++]=this.DV+o),i.t=r,i.clamp()},e.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},e.prototype.dAddOffset=function(t,i){if(0!=t){for(;this.t<=i;)this.data[this.t++]=0;for(this.data[i]+=t;this.data[i]>=this.DV;)this.data[i]-=this.DV,++i>=this.t&&(this.data[this.t++]=0),++this.data[i]}},e.prototype.multiplyLowerTo=function(t,i,r){var o,s=Math.min(this.t+t.t,i);for(r.s=0,r.t=s;s>0;)r.data[--s]=0;for(o=r.t-this.t;s=0;)r.data[o]=0;for(o=Math.max(i-this.t,0);o0)if(0==i)r=this.data[0]%t;else for(var o=this.t-1;o>=0;--o)r=(i*r+this.data[o])%t;return r},e.prototype.millerRabin=function(t){var i=this.subtract(e.ONE),r=i.getLowestSetBit();if(r<=0)return!1;for(var o,s=i.shiftRight(r),a={nextBytes:function(t){for(var i=0;i=0);var h=o.modPow(s,this);if(0!=h.compareTo(e.ONE)&&0!=h.compareTo(i)){for(var u=1;u++>24},e.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},e.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},e.prototype.toByteArray=function(){var t=this.t,i=new Array;i[0]=this.s;var r,o=this.DB-t*this.DB%8,s=0;if(t-- >0)for(o>o)!=(this.s&this.DM)>>o&&(i[s++]=r|this.s<=0;)o<8?(r=(this.data[t]&(1<>(o+=this.DB-8)):(r=this.data[t]>>(o-=8)&255,o<=0&&(o+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==s&&(128&this.s)!=(128&r)&&++s,(s>0||r!=this.s)&&(i[s++]=r);return i},e.prototype.equals=function(t){return 0==this.compareTo(t)},e.prototype.min=function(t){return this.compareTo(t)<0?this:t},e.prototype.max=function(t){return this.compareTo(t)>0?this:t},e.prototype.and=function(t){var i=a();return this.bitwiseTo(t,T,i),i},e.prototype.or=function(t){var i=a();return this.bitwiseTo(t,y,i),i},e.prototype.xor=function(t){var i=a();return this.bitwiseTo(t,b,i),i},e.prototype.andNot=function(t){var i=a();return this.bitwiseTo(t,g,i),i},e.prototype.not=function(){for(var t=a(),i=0;i=this.t?0!=this.s:0!=(this.data[i]&1<1){var p=a();for(o.sqrTo(n[1],p);h<=f;)n[h]=a(),o.mulTo(p,n[h-2],n[h]),h+=2}var d,T,y=t.t-1,b=!0,g=a();for(s=m(t.data[y])-1;y>=0;){for(s>=u?d=t.data[y]>>s-u&f:(d=(t.data[y]&(1<0&&(d|=t.data[y-1]>>this.DB+s-u)),h=r;0==(1&d);)d>>=1,--h;if((s-=h)<0&&(s+=this.DB,--y),b)n[d].copyTo(e),b=!1;else{for(;h>1;)o.sqrTo(e,g),o.sqrTo(g,e),h-=2;h>0?o.sqrTo(e,g):(T=e,e=g,g=T),o.mulTo(g,n[d],e)}for(;y>=0&&0==(t.data[y]&1<=0?(r.subTo(o,r),i&&s.subTo(n,s),a.subTo(h,a)):(o.subTo(r,o),i&&n.subTo(s,n),h.subTo(a,h))}return 0!=o.compareTo(e.ONE)?e.ZERO:h.compareTo(t)>=0?h.subtract(t):h.signum()<0?(h.addTo(t,h),h.signum()<0?h.add(t):h):h},e.prototype.pow=function(t){return this.exp(t,new S)},e.prototype.gcd=function(t){var i=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(i.compareTo(r)<0){var o=i;i=r,r=o}var s=i.getLowestSetBit(),e=r.getLowestSetBit();if(e<0)return i;for(s0&&(i.rShiftTo(e,i),r.rShiftTo(e,r));i.signum()>0;)(s=i.getLowestSetBit())>0&&i.rShiftTo(s,i),(s=r.getLowestSetBit())>0&&r.rShiftTo(s,r),i.compareTo(r)>=0?(i.subTo(r,i),i.rShiftTo(1,i)):(r.subTo(i,r),r.rShiftTo(1,r));return e>0&&r.lShiftTo(e,r),r},e.prototype.isProbablePrime=function(t){var i,r=this.abs();if(1==r.t&&r.data[0]<=E[E.length-1]){for(i=0;in8uFT685yDP~}E^(ZSfF+G3387pF)roE5ki@}G z0q%8?WGOPSB_qix+{?Wo5JCwh^iJp{bV6?-^e)RJruW`^2fyE$UCFW&xc~3H_kEu) zXLshz%$YN1&N*{tW|g~45$`BU;nj*#!IY}vVTz*sr}P=7DEr1+!&B?4YJAH&+M|i7 z$n7^al1z3^oiu6b(xnrZ?lv(NUo>ggz4zXG(&QU_9hc#s=2N;HbRaA6?YtUliKEdX6m1<|U8*WN81YP|!DJH_JC= z@~(T@Y!G(eNrR;AU@(FED^=c))P0rdysxkCaF2=^)&WAl>~KZ?ja)c;{9%~!XFLs% zXDB&07Hd}?DznZ~6kwHb+}{z}Rq-kll{{rXPhTHnTooE7_R$<89GJqN^>MG^T-W$REwKdy(Y@n65>ki3toJgVZYHasTo>n@m@- ztv%tMwmcb<*nHwD)M~f&*2>mZZHZ2QG6>l^T_=_&lA(^`oLR1lb@kTkj;Nbwyj-L;9SqjzB1`f@5tus3yGG3bXxDa2fZYc?XoC zJ(S3+oh=i!(QwRF(-jR;pKg@fLddgAC9|HISg`m9Elbw6dOHTqO3|Ra+8$dZ+M;bqBS?zS)tLw4t&V(jX$B#1 zkVwX3%Z*?x8U=4!usxOt<+UZI+xbwdNQ9!TMm!V@wJix1FA60|M-r7w{B7;Tu{+Tf zAS(zEDTn|h+oJY65lYrVKa558+Y=9U#Fm6)k{F6pDlwvYdaR?f4Z1c^FQk|;TT(9z zruh@0J$HvK#vs)440`GSwB9P;T5B9Sr-j?Q5)lpa8A|3QV_Ch{g0Ze>QoxA)dbq6} z-HN5L_~N4YK%H~jlNk-cq@>(=TdTuFb#$9dIOxK*Xd)C(&Iv7@)fNpU^pHds+OPTZ zYNYV;?5s??k}=z8Gst%I=V}ggg~OqELT{G*YR&DSrZp3*dO|W}bU;Zn}fnmX8a z^4g`MPLDt&CGAkjY`N6svaaaX$YOu%pt&fsXKo;J^tOz zk(?V3VOa4{>#Tmh2yeHZ1JBn_fpl$9mtmO6K-9vvWF&)eqk-)jDP>EwFq@LoPX)Ha z(Mc;|+<480?;$=Nhv`C6dZN*o%cQ@(ecK9}7(%Ai=5KF1DwH#tk=vdRyNxH19VZ!F zlI+l)p~8U`M+~4cux!FM*UKrBC+{iO%1Ir|CSgFKc+}sX*WBNstJ&$%XtukgAy2na zp60CR%0toS`3({3;Ohjb@YfT%xc&ig5k^8ipj{bA1GUjmxD$_OnX?x&t-Hwh5qFo*JG|O1} zLW$B&KN86SL0PeXaBQjDHb_p4M5x>Lr8i3(ef zCqS&vi@_L+`lX5pb=mSA|62004x&ELh-b#rsx?!y*MwQ)YYeQ7qJ>Br^U zw$}hd4aJ8Ia8$V^BXcvv(XL=A6Cw-RQ|b0bNsosXVI~U^zapp%wKh{(!nMR7Z}Y<% zJrbWljf4wP?-FQUBHu~OqMG?Ze>4__K9DohA!HaFV%3H=m`HR{UAQ)LvgG6c>!w$!!+I9r67*hwTtNo*}5Pi(tFgG&oK;ZdZqP_77yKQ{-FmqW31 z8*~aFoA%nM3>20nDJCO#ARhGx4+-xt>k1oy~n=}S(iNC!oR5n0+9iO?~pLsK< zyeK0OXWLZKyp>y+=f}o2IrLBPMssW1BJiNwFL!eU(fz#Togr5y;cg~1S`-bnx-yAE zXYMll!vVR%=FS*;T3&-?a(?}+f&n?BIi6_8Ten{Y%}YY@w(#;Q*?E3$MtT!kX`MxG zL~xrcuMCX6)eX}t=TU_0~QU98X(LOqI4_)@8mb)JY~C4K8=dAcEYe46*IBD@c_PofKsBMYd8atEyCJ zWHH{&HFeYHH#E<#oKtyFbv@~++`>DmP*yp2?yTDBmGi(T*q%LiR`tB<(wzC8?)c@r zY4hjJL!GL+g>w*ZCzHhb(x`V@<@AG_53W9}d2W4mLql~{A&v0h(DJ$D+(WG%$Yahy z)y>s&s@(P_ygJ&N?;soIRo2hTv(XJne>~}u1+{Yya!DkdPx18n>VeF8}1JMtzI@Afxrw?jTFnxY~LtTCI{JB+?^Q!YO*Vi*;sdISzA&f%W7s- zAKJXIb`HeaTseJS?E(~+5YdH*>0(PO5jT*VF3+u3Rh_9>)?c$KR-~fhz=K}%x2l$ln<`mfc%_;$_7?$KrXsy$eikh=&*KHRdbHMmu@5Q zE&$K{qb48UKk!175lfids=7JV*##h8g%EdGZsBxWJDQ=8Rfm=5)C)=tsh9DoEY#~^ z88FMN9@Ue%$AO+*x1d_LBPitNLbZ|Wgd%(FoHQvLLnh@QZIiOm(xki%)w8On+h!pp zUX(x}EW=S->Y`yr-9nLw#Fh@R<>(k^))^#7j&|LQ&QuJjSxfp}KYuP}wLGV?+@8d{ zIx)ZAdG(cZ8fxn5XJ?qmMih2kyF#sGQx3td&_-;^VHD<6z`zUoi!t~j+mN#?7uts; zS=WWd!s)llgCN%KvQ?8>tVtctM|!>_FuQhMo?KGVx}z;wo{V+Q!iw8IU{jJP55!_g zgf;%o{sT$$Qbb~$9qUSjrc0kPCga9tk#CNoVQsW7iOugoYCE+$yJFOoN-!_BjanWA z@=zWKHIYx-xy%MkAg=5vriVO>sdjE1^4k&%BW(!vI{m?rhmI4IZAloLD^5p~*pL*U zED2e};W)6j2D_OfrD@COW`kU>Bphv>LpKs+1x3+J%C0>OE6V)#WLpO$UW1^9{J&jN zZfnWh`r6r*^@laj!UW968ssQX^`Y}f^{cY@hJ444r`Olco#$lgs}I7I7uuNxmG!li zbLKU8b12XX+fbP8iM(P%A=WRLQAQG;a6HywN8g4`99_wG^R&a7Ypb@es;;S=KWm=T z86ktER%+3~9I|*s{*r|rx z{>*W%cYj5`jLcaX2Xg{$$=;(AuH%Bd%>*Yk}&L&H1qTKNcipzDm(b&(B zui7eRi6{(@g>+gA#*Nq8L(xUa$o9^GVgF%aWy5avfnlJl4HgkC8*q0q)xL5t2O_KN zw|z=T+W|y_*vJm7B;_R6_mEw2#9t5@nR|gXbNryk4h+vG>%Yq?!#g@pkN9Ak9 zDkc!uCyba~;CAje#*Ht`rerNQ?ZG5rLAw``M5M1L<(8lz-sN=T(x!0(gaE}cVGQwg$>n+<7(#}X4f$6 zsr0#gcBiccna(B8F6TyO92@WPIq6WV?i4!LG~@D@b+p@bFtKcEMHih7f?zC>*rioQ z>OL$WQ+=)sJB75e&&}>q^n`RXZfq|?VN7JJ)M_U%g0?Q-idGRA2-(Vys1SQ8c~dmb z9n4%5<>y=)jnnAXXq;y$DUv*f$=p_wR1$_GI!zvPh&a|UmQVwG?#==(=cZ{~VPN1r z6KTDDW6~M37u1riE~CbkNM-V6<~Gzi)#sKdx!DUkmgULbS&b9E{r2}2RK^!|k?-n0K+QY z$_&f5ZM~X2?APS6j|U+@e0r=kRGD;Vr;X0!D5#XTQdQ`v6Z1@~)O4q^MmsR@(3OZ3 z$X1yprC z+&?EDO^$VUpHzV`)hflan?KtF1L9~*pEZUnjlP)*2}_Q6t3^Cb5&AZw*fom|)`WWr9RHMFcQEH721 zfig2M=N5)d9N({;beQhToEK~*yRn61A=tRjKHc|?rIO1=$N;8&{>uS4QWdj zIQ-b#eUBZWVmVx7&W{rBWC`RZ`a87GMSP?czM=7L-=XBuYBw+5wg@8Al5`!f&8wYV zU7s)0ncES26EVQ;3g~-hVPe4d1e(0hhb2HabUR#D=lJL3C1bN+YG zy1&yOXv3f&I(O#Nj)W_d(hwF0Lp#oi`Q+h*FLN>hX_DmHvTOd>A<&CMx?uHW{1#RU<$m6$JnS*OG zuj*wOIqBlahJ`iR*h5Z$oDAo5kxaKTsU_guL*j^7Ta@{jn-wq*%hwUFRWIx0|M(~W z$I)z&fgM*nMLaN1=c1O*$J>)07_t*p7bkKqVC2z!dDk}MW*v)UWqUhoV@I&XtlemL z+IMDKIus44a7Qc|GCJ)lY!}wdmhrY-n4cZRCbPW@!A{-M=v-UVmkWyVb<#(S2Ra)S zp=6{DYra1q0*GluaCy94BqM&mNVWx%0-@$&v8d~axQK)TanTxD;z#9A)k}>KBXQKtVJX6CLf#J4DBF6d;iFgFw7XU>%K!q`w2?L+xGEN1KQ)MrE36 zfnAb(Bt=IIY$TS)gFLW^2mL&h;73Jxaw!i+c`(6)NAXraZ(Yn=Lp;>Z7sYuf%DWOg z+{VLk9trWbb{^^CZ3*6%10fz*&J(E6#zRRS3i0+OygkXoe%==6OWOF7 zD32`X{toUxiif&*$71de^P~KHv7avr@oepHtlO~lkh#}NQOAOVQ-K!OMS+#lfnIQJ*Ge>o38t`Xh} z#$!Bugc^>=c^GuT47y&zBT3!{CfoVq4&LtP?E&5%ct<<$i1DbOM_YL` z#G{b&avtm8F-R}LkL=>{D334Y35>LZCt^I2;E5zpw((>;PlDA1UlQU=V|;m=8te?I zt%(2_NT`bvOVtR{@JcG;2Q}K7P@`=a(UBNYEULna)a2rJHQ5nSlbvm9a!I>-Q~)!- zm`A{PWKlUQ7v=fo-tyA&VdW#seVU>v<>SgHR7}>CirVs-6|<0ESW#H$OYH-b9y1@*CxeVquSe~I47_89XMTRIg zM2Vr58ElBb$_+Nu&?*dlxWPsk#wdf2Hu!diYkPz5VDKFc!!+DG8J;nQI@ZV=Z{+W6 zxU5k=w!Oh78+p4Lg;R{e-HgKB4Zep_xTjJ0H=}Sbqi}DdaH>(bk5RaHb`V6zQ2$6$2^n`^K`jFNhzq`@ee zXOzr0N){NUhZ^iK!+W^F{$a32gEbkf*6-$hYrAEavqhh&Hagl88=28j|l>L{+~@!yB|2Xit0|Z_uCk z0^aCjVhV5c!@7}9F7`PQ#(6R~ z^flZ#;54L9$9pZ_XW)G%-e=)`Hs0speJ z%aOhUa24QcZj=L8ehn1%S^yMu#P!@5xt<#b-T=4}b#8*j;azz%(zgI^1>6p}18^7M z9>9Ho2LKNN9tJ!Dcnt6a;3>c}fad@&0J;G^fX#qjz{`MF0j~qz1iTG+7w|sdL%_#? zPXV6;z65*?_!jUT;0M4@fL{Q=0sa82P+@3*;{eA4P5_()SOYi}a5~@&z*&H^0p|eD z1)K+f+}Zi6G3^4RF9ci!xEOE=;AfJfYD`~;^ku41bvfV)z?H~f1-Ke;4d7b9b%5&u z>s4cq8}PnSHL7m{+zhw{a4X<8;BNBeT`v4CB9#Re0M%AdMtSpifYVw6~6rqq~8R*MWX|}19%VcKHvkuhp6)r z-XG)r3ErQohWHWhp8&rA_JvUK+7C`l7;}#m#*D*^8OPzZ3UEANHQ)qvdJ^Ddz#8Q1 zjTxs2_hG{QmMYvQ3E^G@?e7CV5F<*EW9|o;3ddXO-l-J6wiLdu)TsR! zOnf3nlo_?3qUzVkeJ|YaBNABngBUTySokBD{|WFj;1|HJfZqVW1O5Q?0pKqduF#By z#{gCWj@3q#yI&IJM(rBS-L00pPtlM*MKfwo)kX|O$x!!)7}S^w_YbVXeHN0V3f+HT zP}>){%|iDYuDY#)JGuR%0fjS0Nv7!ZD*?vncLjnHcxX%rO%sZX<>yNT)A8WC5DMoU z0U9DLS=S&sgk_xacyN^qAUxPAqUN9kRiL+$`Exli=uh^kxE)~5`_KMRS7qQ=adD>N ze@r6WSp-#(L^5yZ4+S23jJfQ3(4zXSt#6j=lt)vD19Fb=O3TWe*-}bL6hm?!PP0K$?dMz+LLiwzl%qEn*PU9q zl!j)f!t>`-VGFvD=qdkwUjAR05$ZdqL&lVhL1k@C6a!T(wjpTnqhlc4gFi+66BVZ! zlIBXk{Hbu>82~}S@(bJ*ic91>f07qz*A;_ItCX0i;DcsZageguo>WTY|4EnLKk1gU z{EWrsfXzfUqtatoHZ`0cBeK~+B4EnM|H1fW4}T$qAvpx4amopkUXAhsd2a^Gbxmx; z9SN7q1r75+TcEQpSB8>Qt^SFY1*1fkdz(Fdl=F}bD_I8mc^U9G$f^xe5%}X$#if&) zkW-W6E0y|_{nMR#ic9OSHbAGOjp@0G(Zuw2J2*4W$U~HImu+I?Fl>G0Qiu6qUxV&A zoFsKNsH1`0<4=dIT}EbRsKqX}ieK7lFf&LC$oMFUwK)s0C^aZP55dsn7-rZ6RMH>Tw8&Xj^Zm{PPSQ@np;O7UJy zDcKwDYbsO9_F>A9eYv|x8LsTd-Nni%&;CpqeE?IoJCG^9N~UZ-jVU`!hwd}AiWa15 znXIANI*5FoXNJ2>*@@K>=QFu`h%&C=V2mIy4>ZQlV#~`2Q7pltym0o=L%Fi&p{nw?!7@s8nj1vba*2$&_}c9NfW_S%t)r8s*B|7*`JI|(QyLMJF*j5=a`ci>BGs4baoA+j!%)# zQwi_!oW@9Qr^8Dec{-d(d@Wih&cGviCLUd9;j!dwJeHn=$3M@-<6r0DarF6k{QCkt z{&OK7E7(PN9>Xrib0xb3&tuu8jJR8e=PGs?p2xGxS*1eUU4i!rcwdS4iFjXy_epqP zjrYlTUxW7=ysyRk6uhs)`&7KI2b{*%<9Rx}0nfGUMm*18H{p3E_Ws&vh9_N*=@j&Q`XUP3thOG<=>9MUcqk1Xs^Uho}>Fa@Vpv3d5*5{!t+|};yJp# z2hZ!VgJ;Tm?A@7i19t9AxeVu>lpjXv-E0${_pp)U z+`B0EvF#s0$)ikp46nzT@&uDc@FXMKeF~l2&z`oY;~8WgV9(;*fM zLS`fDwlisD9!4n5l}+qLMyj+K=||WWbp0snWz^qGcs|ZvX4L5`cs|Kq#q%ll8lF$H z*YSLYy@BVm>`gqMV{hU4JocPSd4c_hDJk|2lHKeWJk#u5JbT!q822P}r9SKMPYd3A z_K@C(C?>NH(7E?RU`8q**{psnb?y_e_Y(UAl7E@eNMDg7eU;G=Ut=`3*BK4!4Mqcb zQ!@FM9M0Qv2=7Sd-({cT`5yZWd`wZkV9Mu6?56y{lu_KhyYdSw_=1GN*q8R}EBp1e z)bwxU^IOTzcQXCG&EXHA`748S`HlUE$8oYaO*w(HU%}sM zK4h4CFXdz|ev`ugU0UZKC|Scv^-ke^Y?ynhaysXB1wyXn6`*h#FId63au#2~Rpo4c z4ASS|sVe94l}Mk*kL64`pC5$(p=K*sYKVPOVK>Bump=@;#(i@N($}i?6YQ-hIL<}3r zFXcKb;_5oCbC+T&W3|hG5La?`Iajz>Rj=SW;zadI?2}OKD#Q^kWs0(gQm4!pS5wvN zIJ*W_1r0^bSFYp5>VhUEkS)9(g(tv7QCfnL6|2ETN}Cc@Gvzm;+%AZn&9n^mCSYlh z#p*fiI>eagGStw{V;8dBGF5H?%i=c9ZUu*81829_5+0$GfDL&xr8Lp2KA9409*GG#_ zID3xk+lkLOd!Fk)@daluaD9966=x}~?;yV6tefjQin|y~bKMl*bJoN4oy3ovy~y=3 z;%Ck_bA7D%m9s5eA18k2te5NKMIUD`aeaa~MrAK^eP?m3%3k5RC042IRj%(MR;%na zu1^#vs_b>HPZB4q>?AhP<1D+X6CXE1}Tj%;GZ>TT>{%=7K+W6bjgczfkuroe4( zVaf;0m8tj%6yihnDRzDzvCmNPWA-^O)<0oi@M7ar_9ZWNea61x#qQ7HRyqfwWG|8*0KS7bahWaz~$m>#nff{+;>aWlu zuSfk2w0>g0gVxV%1$X^{_AaFl&AGBd)m5$>gS`}2R;s!Nccd1p$MEB@r&`HZsm0o{ za1+W&T+c9eyb2B8z}RZE6nCpMlY(aQ1eG+Hu@hBjFxIrwcvey;QIq>sYN|R-1vQ0Z zxPtRct&^$NgDMP@tx>T%%g?`_vrOTLa<-#j$_TbE-0qHSKcVn3%p(+aS2h#T@9xYH ziZ+Lp2t}XA3WZ`cvLg}Z`q@7PbBEZ`Lh*#zDVSSjgzGG(o`8Ks!M}x)cN`M=h&gV? zyAVOfEqE6pw73m#?=6frVa4w=?LlNq9>Sw^B%<<1kr?tm9_3#$EEz%>x{9lx<6VL6 z#;{+I7!F5zEZ!qdoL`OTwP~9p{|>GI`$SQwEmU~ zPpDg~a!T)&3h$grPfdk)$)xv5g(qgx`=-K^GU@$N;mMiw{;BY;ne+jv@RUsYz*Km* zOu8}^-aV6^mJ08YNl#CO_spcLQsKX4($%T(UYT@FD!g|leNZYqHItr^3h$FiKc&{4 zp)&8jijtb#J^65D!j=h>ckW<~}Z5N~JUGcow*)O9j_R!(}sy1Ma{ zWDjCveuLVduAZ&Z>6qJN3s_Z!2Qy6q-ZDAFx;t3PN~zQw{{yLWR8zURq)1UHXDZ=y z)fHG;6vej!D{Kc(HS(EUiR_dzS!7JAaoo&tN@Ogma^L!MCX`_7J>GgrrTm5oB_8A` z89q-Pb3=)#&}5GBpRam{(E!slz+Pv7#5;Hxt8DvG0!hh$x&UX(jp@` zb9+XoCa0{|s8-6C;lvjio3dV)EwP2sRJUgj$gt%i_4bkiMWMv%@WtvXFVBCS8%l;ioM?T-x$1bQ_18{o zS@j#4!N^>y;r2X>k@;45f_lpOmP(;QY5DAt&w#LB+Q2T3vb!K{K+}LQm0{QbTi>Z@ z`@L+nDyXHbA5=6%qn7KCsJkAzyoaI$G~W#w-S}B;S+Cx3PRUTv+eU4J(7)1<1A4lr z?go{63kW3#^_w%OZwCy@tzxe0<(RgltltOAW<(C-Thieh)e=on(sehf$~GwfK7g`E z6>iTQNx63{X!i}KU6w<;w+FPBY}p3UzJ8)<%wwLWd5TVx4z3sW2jU%qUi)=u^m2FT z(kMeL-N8d_YzGu#g&=C0oga~H~OD#azYs}z@PpmTEN4pq_iQ|?q1 z-L2%45VveCM7J%(nFEFBTSZbl(dm_ZCgie}ID57w&UP*bc9&Y1PsL6qNmLu%Gu?{a zqm-y7CCcmWmf}Rte-9FkGiT0JY=+wPvHpYUm94Ci_~)pSu3l58tor{#`di7to(5|b z;nn$U2K#3ZHk~Mv}L)axWs4%UK?7%|u@ZJkirSW0aI!jn*%Q|e`%!d)icvsr1ZBWQ%Bp`+<#uf7Wq#kUPHtD7Hv7Q#9=`<&{zrmcq(WIr1>Fuf8q$)kq037v)E<^VN z0>~a)=Tp|X!q&QgfaXK(6s6ceX!1oiH1ScqVY^1vHf~`Xx8{T`RnmMx!Z)AUbu-?N zR9>om#`~$Z_Y=}O9#N&046;z^F>MRg>|$wEj)h7`pn+5WqpEkmKZ{?eo^_ZLs#(vg zPM~HjvaNN#>VHg?G0yqIsXc@3eHpt-20Gf~Qp&f>K<5cqoAh?Vtvm^9o2ir-x~J%A zDV?Bj#3Kdrl zYCplyj>aoTs>+cHjI@kq`5gWyBONQ(w^aj| zx9n8^?+iLnjEE; zU4&kcW~Pq$zbL;wUtm2_WAs0lU`nO)i*Bq<*sYRBIdyA~0@0|B2(!}T8R@Z%^rY1| z!{B57Zy3I9@ndGpqA{q?(HJE6Tyn31`*M!G@R-!(kkY~@w~U+Il2#|T^Z;H2nE3Bd zWt9Aj?1)urC}XOy_jMJNbfqR+*NO$?OowIi*V*~uj0sIo(ViN$N1z+EDANr;l#Pn) z3-riiI9iImw)C?rKgkcl+NT&;MVrUYWDfJs0bkUK`^n7_k_2o=7FUX z{;Gvj&2Ag(!yRqV5aB3!*O z2nQ3;{MF=8s2ZmhePu*+B@wO4v^B+5nQ}>n|0Nl{eUR>ULKWKnsmabBU^A$N??F_Hw~Q*fWrDEw{tBryp=BXSqnft#KEZ`H36b-v z%_J(Na3t|{5G>ZZ0W42nz-mJ3s?Ck3tKIUrD^+uVf@a%uD8UdYfiv5-bcrZ9+kt^5 z3_DeGpk%DBQlYMPBzyOQ;g?j~;Q6S?eg{!d$u!+|AUiRp8(9Z21`V_dG2h??zw@bM?QXLLv2V{o0@r&;y3Q-etISl%p2fte;R!2P?EF zUuLrPC1apMb#tY~Q4I`}2q3|rdv=P;R6wi+7o_4t*7T81?@a$D@5ro9Q$+uU%F?#V zrt9X=k%%SSLc4wNaJotNgQA;M97EIWq3HvMrh6CX3{8VX?U5NYGFQL|xG*x8%h+mU z@H77pN2Xz98hNK7r}Xtfj9?4A??T@Vj=tSlbp$3y$m9>(I^cCM;s4`$4?H=)H z_{(n5#Uxr|4cquYZn6f6uH@9^A-0m7nNg(8B$SpbcoDY23l!v0-Yu1;Xp({4d^%%W?h*9EuKVk27U*%n?GRlbsETJyr; z{jI6KdBC;Xta@+>EF_f*H<)7Gge{SVw2Paw%H)CT2bc4eNEbPe?#NQ`nn>lmYd0^ZIw7B{}HT6c?@_f=L? z%<69DylFjeEOF}Iz*$WR^RMT0Xffc%gKC|?W}d(ll#X(7^f80&UOQV}X0#57WJ4J_ zeBj8zGb(a4@L@*(%D9xnqW&m3!l7klvMpwA1;f-G!=PvXL0MbB~&5oR?o#}B}C!&p{lF`%(nsFFrwA8YAjpwS)v2=K8wvyZ7O`WOWi zpQ!#%RJ`9~{`VN(zcK%BtZ|*1cJ3nDiN@|(8ms>+jhwa}9BoHt+nz*i7`4f%6QxjM z(A>rdSDu>Oaw8`P+;k&PO;h|ga^#^Xohl@AI`&M^Yq1zBhatZFl0N=LO_VBB!xb-NlS_C7~5*`n7ZcvMT7o{x%QqeBX+~ zU;+8yAhx_%r_yv&kw%XRd0?g_f<_OadU8=Nw03(B!HSj+xWSG?kFGo1J%K!l$xn3$ zJb`>H<7Y6jqHsd6fDS@wUFw>E6-u8FEDRL*KUH0YoALsA0oRa6`uaAx1MYw^3Df^nYHsnPSSk zBkh-p0-oaS&?##Eb)_9p$?oK@>(TlVK8cmkz1$3Pc8`djb=ISTE~Oq5w!3RQGT@n} z)Evn$Q!Zp&NT&Tuom7uMkqWp1qV7D#F+xS@QguzQhCc~^r6R(z-e#DNfL5uvG9#KApo18&<;Wg+*-0nN zJh(=g!{W)|knL_e8wdQM;MNVhk)>DEy z$VX6Ut+V^WECw*Edb(yURLB)XbaXl^M&Om|sXLpofPvvIC0_-5O|^W^x>GebFvT~f z=4&oM68taYs;=+S9sYxb?_f2nxw3Lg%PCCe?;*LQ{okl9->Sq|a|Af)u@ zNEjK9j>6?AbUB5`(^-xyQI6UsD_7Y+ER&Wy18e2#l!YG!0ik1v)xY7<*Zy9}i$!ti?_F~;>I8uWa zh=9H_=<%8)FHgWdny5i0E@Hu;C^_J2DO^poOPG@5 zhETkUad_mth;lDc-a<#qnSs#3av_nI$I89w9!Xyl#h=?fIb;DQquwpe8DZaJ?Wd+uCvUi0(hyym;|6br)S9QzCItuy_)t1x=$)-PtEoAQZ9(Smi6ikj3-7ah>9mL zVQBh3vLY6Jr>160qY-<2yJn4`z@Uego|ey8K<}yfoFi_4p@PPVOoOjz9o(5Dk?9JP zMbtpYS+~eT=+ZZk!n?c`BonB(Bri3+<`Yi#w+Z7#VDlCN8|v&NCZG}%wl%Wj#enXL z&|MKlbSKLu;|Dj9x4#2gc+tX3E!O-`TfoL@G-`2*Y%zHoG8nrJ8Pu#6iuJNskA|np zhCBVW@Gv9TNTT*>jQ;PBOw_Jh&y*ftDa8Uk-8JVU4k;uh0hOA|D1*wUOC@L_OFosA zke5a%eX4C|()0@n*ODJTL9EE%+-=oTv?aYc!Y$-7;ntRP_(a4Iz3K2t6iSE``O3Pr zOvUy`h6-z?%a|e7n85DT)WInt`EMRnw0S?b#DuSfHQ^O;-z{bhy zy2GakGVQ-ProAJI8c&7GT$TrNG%mXdUM$;zNXM+yjf13JuqilG;O4P!A}I{AQ2 zwhsVvXJRj}=?mau{$iuS%SH~|BxLs(rwQ(rVsbVbThel)k(L_`kjE3dKiX-XE}Zku zafcRQ2Ydo+Tr2F2W!|XBzZ=i!FV08taU{628Euiva<)-TH*u^~HxcD?XzwY8gYlbq zclb;}=Lp3ZF=f;KGihw+Lh!2aWUD}==gC&P=Cs<9E-to@1KyzHfJ|(hp3rOE#8IOM z@h!Q6^Vxvy@dY$6wHO0C%Na)DsL0L4HI`^pd|u6E`xb89#v`}zrdzqSfk$rTO}BCD zP9C|9H{H&yyLsex-n4;R_wvXF-gF1I?&py^c+;KSdXPu%XFVtw(v}9^P~>w;tz_dwJ7++wC=WDQ7wfz7c+t7xfD8Z3v0PVZTU!T zL9~90jCU@Pia!KpXN&CVS`jq+7SfSRrDh{SYI=t+Q2g%@{dEHs?6Rzao#QB&cU0sy zYJ54%9M0XsGN*GNFyEoYky7ApW!pGcx=mU_5h{MnYd+>mcg?wi{POKv;m?!!4Uz~J z$d)xcyhbgig>4OQe2C3_h$;Rxs*Og)I|ed+C+k1!xl0B`Ub;`QBgu`-u5>q};CZbK zo_Vit#YpVoXm>_iWWDix0e_A4l!6&-%QhlTa(Ne!C&N02kf67xW#sA=Bk3+FC4YD8 z-CM@dPq7vGSP0T`PdtY9!~tY7P8zEzq5_S+T?**8m*}#|vuwr`mr;BLoT1BQP+)Km zQ?cG3Ie@c~#EE8eqI<{L3$fPE358r6DG0hibW^k#5NIL;6kRLs25sG?rHf0z(a7$Z zBN++-eiDK0seZcKe}QOxpQUHM&q(6;=1A^7xnSgFPSakbslK1lIgC7Je}u_BF5Ys` z_D96|pz#39p4B`}G#}h%n`haI3cF1O>O9on<~eG!u|NL;jky2-V$^WgUDMhwHFFP z&b&~t6&DIb2p5T&7YSv>MS?CuXszjn1i(gPzFeti=0hU>r&wB^3LyR+-*TNAzF5%n z60u%Ryq@-7DpHM)vzd=GCGr^dH;=LKI{A$lI(w7ZUkzt)Ct=U?_5j>4c}n@#0G#vv z@qco0&R57;9Gy_rZIR33V=_=#2NUQYP;bv)jK}&=^lTte^&mCIfBF9j|Nj$Sv0b=A z5T}nzE3UEiK}J6`;l)#E;xU`FbYjml1UvT=)tN)&o+srarpD3~kBxNG;{|#=O=|pv zR1U90PHs|Pm7CNjnaVZy&vXEa?n}NP`jWMh)@-tWguiTKguiTKhJM+`sDIhUs57`F zB|A91Ex|gJ3Ln!?Vu`f@h<7DIZhGldeX~4OALU|F7{l$h@*`-w2FtC15{%U;;W;HF zuY=U(SF!8Z>FP7=A@&4&My6h7Z?pGhN_k4o!vPf9zQX=e_K(ox$v>Nbr%BHGGRJ=H z`OGo8Qi*ANl+An;x&>0G)$MW!e?dSj+w%T`wLUZ!Y4?Ld0A@AbBumb@Qz$YhHM$cvpr=k6|2E} zcD8yQiK~tuEJma&`O7(L8=`_(TAs9}yd@?$Ehh>hS zvTUuR#R@i^)scR_NWfc(^&non{Z6C=*Rp%q1GYLm&*+E+dkRP3gZTgR+lv=i=K5rt z4Kobd%`>^dL{gH--k7E_qzC_1gx%qb)qxi<-I*n>I~9JC`A;TSla`ZTC#k-`a>Zr$ zpVg%Q!l<;6oW6P_-C2&FY?HQZ(%mvd{-~vKNOz6w#9NTn54+bKqA#-k%dgD?gP<)r zOL;G&Q{+%)DgTgl%b87uKh5ez=Gto@hOWH^VvgUc&WQss=hI4p*pV)Ks`&S*9M@TC)Dc$P$@#aF#we&)SClPn+f$+|9Ke(UkB1) z<89Q^^e1f7rP%62R`(KlwU1b_3{#MQozd0SN6g`revFf`jN>zwVSl$Ic`P}?Nv2uJ z-}|d(jmY7<)N@bJ}UXL;pghUO}V$ z$ceNtgf}pRu^0j>yer*zi!BCP2I!qt1$&W^h}DA;wj$&pjvrj(#4G|Gy_Yd8@ZIg` z>icppG7q>bovlR4sK|q?@v8nkcPVxz53$Cp`!Qv}jBLEdX)t6|Bl_648!6TS3xo4e=X zUMla&mVesU*OM;FgU3ks&>h_Mg3qu>u|A>?tVEmrT@js(P?X+HH$YCDj|i}&hT7TZ zX}$8E(XQq#m)D6}%V!MF@OmK+)7Fbk^mU6E@=jkL{SvE?!mV`84cLsxdZ=3{2K$IkFBK?hr`&qUh!X+aeR`?-^2-aV1~!pU*kI#^#iIn|3`!TQR{ZT({c zJ_5TEZCzhq?tefj$|p=<-2ZWI9Bb8_0pkhddSz9LNxdc`v6r0QsSoL>IsMb3qx%f2w=bkS!jbj^pS zOFrH5>5<>o=TW6m9Yud~i+JGIY(-f|VTh3)5XJe5O|tPDF0U8A;jrS4{0xFSh=RuN zC|e-EDgTahyLb78q4S%te7ZBlNa*FaUmHVgXL;pFkWXJ3ruzCa+!Hm@jt-A^7e-WC zMmZfApi=WYx|PFdFKo@hSF-ULR8dWxf-KFSdk{{her8JXd(_{b5S9bjPd0YSiG3-- z_9EFPk1E&v#N-Y<(?y<5f8gLeL+)}$=91L%<;dLqHPL;=Vn@}{Da*LpU zSm7?A7+&RWp}4%tJwkDNm3xKa@hbNTB~K{#3nkyBJRp<;m-3)c3d@v-gi`=lbWWi z7`3J4d!Fd+-g@-(k_)f&=DKs!ZFrw$&Mo&wQS-1+K(7ZR$_}7gI_r3i{AhZN|9j>g zFEPJ~GMG_19sYt@tF?9hFPJxz54b4X@&o$!CK)Q*F5Qjwh>ivQgo0nc&c09r!#${b zlRX9S(CYdUAAOMYH3-qTDMj}_Ds3`bek7`+nbLz)e;cu$e!-s(xcpzTmY=A~uULza zLX~2>3SU2=xW5Od_E)UsXR7@i)&7}kS5g&^b%J(_^YMzuI#KKI2xGX7v0Jb0{_bBv+$qf)$?WqhbeTlve#Qpp+kB!eYpQE>#o@(ScyDpLI&K0AAv5F6*!0^ zHj44yGAEO%QuC-#!0Z&27jNk6bEz(#N?~Ga9utzA6vQRd-%$EHI}M(~Uor$Dn5|UH zFUWntYK~J`?RPLMgQFe=OWDEIe!MF0$f(hAA3kZ{z zqAaIyxW5h1WbzqMec!^@(xP!|5mt>qxW%l~H0yNDTB})SXx5pUb(UtGty$-2 z*14K>o@Sk|Sr=&5g_?DdW?igVmuS|dnzc@|F4L^bHR}q^x>B>Q(yXgB>l)3vRB5 z(XP|lpv~vj9kT3BD!WT2@22EEGIzr;R3$y@tLJ}8q9Qt~00e29`8 zG4f99VM=b2*iDptL?$1hxlGv9h`7)-s z(|U!HhY|8HBwm#ryhga!W%3P5z9}2MMaj2i@*PUPE0gb1@;#Y+kCN|8svl7DLy7%} zk{?4uI;~GA`KiQyDye@;v-DZNxIdTJ&nfwZ#C}Q1ub@<&*4LE$Mq&AVn{~H#gy$ zQu-(0U(&+gfd2@52>7p5cm!A%SeIjUh+lVO+F+{;n;bOhCqh^->8=nKO}aaTLnhrB z!o8-Y$*_YZgLX@X;fQJVaMV>8GwIYG8b^h)Nt-=X0h}-`bJ!(lJzl zkBTvh`H0ntv(j-Kg_(%M(h0C9K^8$U6Lbm$6HKRp;LT!9;!|`6WpHaTTDS&JSGwum z;@EW7@Cop1u}m>JIwwjQ4ty{SadkS6vI`(f(m%s-5S}8QLmx^{L16WC(QttL2rSG= zOj>4^&6{lQ^BPJuDh||;8D7y-R$U@hEu7e=Dh+Bz!h+{~Yp&N$h{U)lw0_heAf)3pV zLVS_HLwCR;LeO0x*eC@USePiSfYd}T$TuPq1pY&7Am2*MAm4#}Z}`G7FET)W5PJjp z5#%T78^|vvy)`rH*@EsbYQALfm4dG`-1j7|96j`_VZ!s!lZmnO;%G09!u=XCj+U%C zo5M5A{$}W2I2m3>WqeyidPzayS#3wKJy+B#`KvxM4x;70)tVF_{XHznt*dP3fWNEL z<0HGS`FIsyR9b8QIc}j4wy;)ft6yuYJ|qHna`nMTV6LH>l3w>$Q;W@Kg8@Ia_;jd- z6FK}M5&&P2wb{L@?ZI_eVO@%X?b++$x>Q%v-uJRMLasY$li8ag^K8;S#O-lOMcd5A zaJu5V%v3pNt$Q_-H^+fgb|H~;P4iaozuSk9#M<@v|^GR}HxJFYi& zitA4)6F2eA8#PC=p~6?GlFjW&8@1|dct{hS5tX>_**k42$qyhj&`z~A{0CK(WOSE@ zzsGiQ*&!9~m3A7JIcjQKhJJ??GAo~oGNo{zD=+wtsF;%6k!+%+T97ZRzJx!RkR|q` zD%z76xU8vO)+xcKA5*xMeUgP%bn3MVBpq)zv=b^?09^^KDV4Mph(4+QX909ksSZE( zQuK0eUIjHfr-D^Gsi5;T)0nL)jO~JgRZQSva=)^(IQx`}cBSSgu-0?h@sr@sIDQ)Z zS;tqwpL6^y_z&a*9L<+?BH+BMFoy~k96t|!$?*%|msPZ7uNL-xTheaBZ!Y1j{wDW{ N=}kMC{SRmsVf86^2=M>_ diff --git a/reverse_engineering/node_modules/node-forge/lib/aes.js b/reverse_engineering/node_modules/node-forge/lib/aes.js deleted file mode 100644 index 3c1ddb29..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/aes.js +++ /dev/null @@ -1,1091 +0,0 @@ -/** - * Advanced Encryption Standard (AES) implementation. - * - * This implementation is based on the public domain library 'jscrypto' which - * was written by: - * - * Emily Stark (estark@stanford.edu) - * Mike Hamburg (mhamburg@stanford.edu) - * Dan Boneh (dabo@cs.stanford.edu) - * - * Parts of this code are based on the OpenSSL implementation of AES: - * http://www.openssl.org - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./cipher'); -require('./cipherModes'); -require('./util'); - -/* AES API */ -module.exports = forge.aes = forge.aes || {}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('AES-', key); - * cipher.start({iv: iv}); - * - * Creates an AES cipher object to encrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as a string of bytes, an array of bytes, - * a byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.startEncrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: false, - mode: mode - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('AES-', key); - * - * Creates an AES cipher object to encrypt data using the given symmetric key. - * - * The key may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.createEncryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: false, - mode: mode - }); -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('AES-', key); - * decipher.start({iv: iv}); - * - * Creates an AES cipher object to decrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as a string of bytes, an array of bytes, - * a byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.startDecrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: true, - mode: mode - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('AES-', key); - * - * Creates an AES cipher object to decrypt data using the given symmetric key. - * - * The key may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param key the symmetric key to use. - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.aes.createDecryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: true, - mode: mode - }); -}; - -/** - * Creates a new AES cipher algorithm object. - * - * @param name the name of the algorithm. - * @param mode the mode factory function. - * - * @return the AES algorithm object. - */ -forge.aes.Algorithm = function(name, mode) { - if(!init) { - initialize(); - } - var self = this; - self.name = name; - self.mode = new mode({ - blockSize: 16, - cipher: { - encrypt: function(inBlock, outBlock) { - return _updateBlock(self._w, inBlock, outBlock, false); - }, - decrypt: function(inBlock, outBlock) { - return _updateBlock(self._w, inBlock, outBlock, true); - } - } - }); - self._init = false; -}; - -/** - * Initializes this AES algorithm by expanding its key. - * - * @param options the options to use. - * key the key to use with this algorithm. - * decrypt true if the algorithm should be initialized for decryption, - * false for encryption. - */ -forge.aes.Algorithm.prototype.initialize = function(options) { - if(this._init) { - return; - } - - var key = options.key; - var tmp; - - /* Note: The key may be a string of bytes, an array of bytes, a byte - buffer, or an array of 32-bit integers. If the key is in bytes, then - it must be 16, 24, or 32 bytes in length. If it is in 32-bit - integers, it must be 4, 6, or 8 integers long. */ - - if(typeof key === 'string' && - (key.length === 16 || key.length === 24 || key.length === 32)) { - // convert key string into byte buffer - key = forge.util.createBuffer(key); - } else if(forge.util.isArray(key) && - (key.length === 16 || key.length === 24 || key.length === 32)) { - // convert key integer array into byte buffer - tmp = key; - key = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - key.putByte(tmp[i]); - } - } - - // convert key byte buffer into 32-bit integer array - if(!forge.util.isArray(key)) { - tmp = key; - key = []; - - // key lengths of 16, 24, 32 bytes allowed - var len = tmp.length(); - if(len === 16 || len === 24 || len === 32) { - len = len >>> 2; - for(var i = 0; i < len; ++i) { - key.push(tmp.getInt32()); - } - } - } - - // key must be an array of 32-bit integers by now - if(!forge.util.isArray(key) || - !(key.length === 4 || key.length === 6 || key.length === 8)) { - throw new Error('Invalid key parameter.'); - } - - // encryption operation is always used for these modes - var mode = this.mode.name; - var encryptOp = (['CFB', 'OFB', 'CTR', 'GCM'].indexOf(mode) !== -1); - - // do key expansion - this._w = _expandKey(key, options.decrypt && !encryptOp); - this._init = true; -}; - -/** - * Expands a key. Typically only used for testing. - * - * @param key the symmetric key to expand, as an array of 32-bit words. - * @param decrypt true to expand for decryption, false for encryption. - * - * @return the expanded key. - */ -forge.aes._expandKey = function(key, decrypt) { - if(!init) { - initialize(); - } - return _expandKey(key, decrypt); -}; - -/** - * Updates a single block. Typically only used for testing. - * - * @param w the expanded key to use. - * @param input an array of block-size 32-bit words. - * @param output an array of block-size 32-bit words. - * @param decrypt true to decrypt, false to encrypt. - */ -forge.aes._updateBlock = _updateBlock; - -/** Register AES algorithms **/ - -registerAlgorithm('AES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('AES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('AES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('AES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('AES-CTR', forge.cipher.modes.ctr); -registerAlgorithm('AES-GCM', forge.cipher.modes.gcm); - -function registerAlgorithm(name, mode) { - var factory = function() { - return new forge.aes.Algorithm(name, mode); - }; - forge.cipher.registerAlgorithm(name, factory); -} - -/** AES implementation **/ - -var init = false; // not yet initialized -var Nb = 4; // number of words comprising the state (AES = 4) -var sbox; // non-linear substitution table used in key expansion -var isbox; // inversion of sbox -var rcon; // round constant word array -var mix; // mix-columns table -var imix; // inverse mix-columns table - -/** - * Performs initialization, ie: precomputes tables to optimize for speed. - * - * One way to understand how AES works is to imagine that 'addition' and - * 'multiplication' are interfaces that require certain mathematical - * properties to hold true (ie: they are associative) but they might have - * different implementations and produce different kinds of results ... - * provided that their mathematical properties remain true. AES defines - * its own methods of addition and multiplication but keeps some important - * properties the same, ie: associativity and distributivity. The - * explanation below tries to shed some light on how AES defines addition - * and multiplication of bytes and 32-bit words in order to perform its - * encryption and decryption algorithms. - * - * The basics: - * - * The AES algorithm views bytes as binary representations of polynomials - * that have either 1 or 0 as the coefficients. It defines the addition - * or subtraction of two bytes as the XOR operation. It also defines the - * multiplication of two bytes as a finite field referred to as GF(2^8) - * (Note: 'GF' means "Galois Field" which is a field that contains a finite - * number of elements so GF(2^8) has 256 elements). - * - * This means that any two bytes can be represented as binary polynomials; - * when they multiplied together and modularly reduced by an irreducible - * polynomial of the 8th degree, the results are the field GF(2^8). The - * specific irreducible polynomial that AES uses in hexadecimal is 0x11b. - * This multiplication is associative with 0x01 as the identity: - * - * (b * 0x01 = GF(b, 0x01) = b). - * - * The operation GF(b, 0x02) can be performed at the byte level by left - * shifting b once and then XOR'ing it (to perform the modular reduction) - * with 0x11b if b is >= 128. Repeated application of the multiplication - * of 0x02 can be used to implement the multiplication of any two bytes. - * - * For instance, multiplying 0x57 and 0x13, denoted as GF(0x57, 0x13), can - * be performed by factoring 0x13 into 0x01, 0x02, and 0x10. Then these - * factors can each be multiplied by 0x57 and then added together. To do - * the multiplication, values for 0x57 multiplied by each of these 3 factors - * can be precomputed and stored in a table. To add them, the values from - * the table are XOR'd together. - * - * AES also defines addition and multiplication of words, that is 4-byte - * numbers represented as polynomials of 3 degrees where the coefficients - * are the values of the bytes. - * - * The word [a0, a1, a2, a3] is a polynomial a3x^3 + a2x^2 + a1x + a0. - * - * Addition is performed by XOR'ing like powers of x. Multiplication - * is performed in two steps, the first is an algebriac expansion as - * you would do normally (where addition is XOR). But the result is - * a polynomial larger than 3 degrees and thus it cannot fit in a word. So - * next the result is modularly reduced by an AES-specific polynomial of - * degree 4 which will always produce a polynomial of less than 4 degrees - * such that it will fit in a word. In AES, this polynomial is x^4 + 1. - * - * The modular product of two polynomials 'a' and 'b' is thus: - * - * d(x) = d3x^3 + d2x^2 + d1x + d0 - * with - * d0 = GF(a0, b0) ^ GF(a3, b1) ^ GF(a2, b2) ^ GF(a1, b3) - * d1 = GF(a1, b0) ^ GF(a0, b1) ^ GF(a3, b2) ^ GF(a2, b3) - * d2 = GF(a2, b0) ^ GF(a1, b1) ^ GF(a0, b2) ^ GF(a3, b3) - * d3 = GF(a3, b0) ^ GF(a2, b1) ^ GF(a1, b2) ^ GF(a0, b3) - * - * As a matrix: - * - * [d0] = [a0 a3 a2 a1][b0] - * [d1] [a1 a0 a3 a2][b1] - * [d2] [a2 a1 a0 a3][b2] - * [d3] [a3 a2 a1 a0][b3] - * - * Special polynomials defined by AES (0x02 == {02}): - * a(x) = {03}x^3 + {01}x^2 + {01}x + {02} - * a^-1(x) = {0b}x^3 + {0d}x^2 + {09}x + {0e}. - * - * These polynomials are used in the MixColumns() and InverseMixColumns() - * operations, respectively, to cause each element in the state to affect - * the output (referred to as diffusing). - * - * RotWord() uses: a0 = a1 = a2 = {00} and a3 = {01}, which is the - * polynomial x3. - * - * The ShiftRows() method modifies the last 3 rows in the state (where - * the state is 4 words with 4 bytes per word) by shifting bytes cyclically. - * The 1st byte in the second row is moved to the end of the row. The 1st - * and 2nd bytes in the third row are moved to the end of the row. The 1st, - * 2nd, and 3rd bytes are moved in the fourth row. - * - * More details on how AES arithmetic works: - * - * In the polynomial representation of binary numbers, XOR performs addition - * and subtraction and multiplication in GF(2^8) denoted as GF(a, b) - * corresponds with the multiplication of polynomials modulo an irreducible - * polynomial of degree 8. In other words, for AES, GF(a, b) will multiply - * polynomial 'a' with polynomial 'b' and then do a modular reduction by - * an AES-specific irreducible polynomial of degree 8. - * - * A polynomial is irreducible if its only divisors are one and itself. For - * the AES algorithm, this irreducible polynomial is: - * - * m(x) = x^8 + x^4 + x^3 + x + 1, - * - * or {01}{1b} in hexadecimal notation, where each coefficient is a bit: - * 100011011 = 283 = 0x11b. - * - * For example, GF(0x57, 0x83) = 0xc1 because - * - * 0x57 = 87 = 01010111 = x^6 + x^4 + x^2 + x + 1 - * 0x85 = 131 = 10000101 = x^7 + x + 1 - * - * (x^6 + x^4 + x^2 + x + 1) * (x^7 + x + 1) - * = x^13 + x^11 + x^9 + x^8 + x^7 + - * x^7 + x^5 + x^3 + x^2 + x + - * x^6 + x^4 + x^2 + x + 1 - * = x^13 + x^11 + x^9 + x^8 + x^6 + x^5 + x^4 + x^3 + 1 = y - * y modulo (x^8 + x^4 + x^3 + x + 1) - * = x^7 + x^6 + 1. - * - * The modular reduction by m(x) guarantees the result will be a binary - * polynomial of less than degree 8, so that it can fit in a byte. - * - * The operation to multiply a binary polynomial b with x (the polynomial - * x in binary representation is 00000010) is: - * - * b_7x^8 + b_6x^7 + b_5x^6 + b_4x^5 + b_3x^4 + b_2x^3 + b_1x^2 + b_0x^1 - * - * To get GF(b, x) we must reduce that by m(x). If b_7 is 0 (that is the - * most significant bit is 0 in b) then the result is already reduced. If - * it is 1, then we can reduce it by subtracting m(x) via an XOR. - * - * It follows that multiplication by x (00000010 or 0x02) can be implemented - * by performing a left shift followed by a conditional bitwise XOR with - * 0x1b. This operation on bytes is denoted by xtime(). Multiplication by - * higher powers of x can be implemented by repeated application of xtime(). - * - * By adding intermediate results, multiplication by any constant can be - * implemented. For instance: - * - * GF(0x57, 0x13) = 0xfe because: - * - * xtime(b) = (b & 128) ? (b << 1 ^ 0x11b) : (b << 1) - * - * Note: We XOR with 0x11b instead of 0x1b because in javascript our - * datatype for b can be larger than 1 byte, so a left shift will not - * automatically eliminate bits that overflow a byte ... by XOR'ing the - * overflow bit with 1 (the extra one from 0x11b) we zero it out. - * - * GF(0x57, 0x02) = xtime(0x57) = 0xae - * GF(0x57, 0x04) = xtime(0xae) = 0x47 - * GF(0x57, 0x08) = xtime(0x47) = 0x8e - * GF(0x57, 0x10) = xtime(0x8e) = 0x07 - * - * GF(0x57, 0x13) = GF(0x57, (0x01 ^ 0x02 ^ 0x10)) - * - * And by the distributive property (since XOR is addition and GF() is - * multiplication): - * - * = GF(0x57, 0x01) ^ GF(0x57, 0x02) ^ GF(0x57, 0x10) - * = 0x57 ^ 0xae ^ 0x07 - * = 0xfe. - */ -function initialize() { - init = true; - - /* Populate the Rcon table. These are the values given by - [x^(i-1),{00},{00},{00}] where x^(i-1) are powers of x (and x = 0x02) - in the field of GF(2^8), where i starts at 1. - - rcon[0] = [0x00, 0x00, 0x00, 0x00] - rcon[1] = [0x01, 0x00, 0x00, 0x00] 2^(1-1) = 2^0 = 1 - rcon[2] = [0x02, 0x00, 0x00, 0x00] 2^(2-1) = 2^1 = 2 - ... - rcon[9] = [0x1B, 0x00, 0x00, 0x00] 2^(9-1) = 2^8 = 0x1B - rcon[10] = [0x36, 0x00, 0x00, 0x00] 2^(10-1) = 2^9 = 0x36 - - We only store the first byte because it is the only one used. - */ - rcon = [0x00, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x1B, 0x36]; - - // compute xtime table which maps i onto GF(i, 0x02) - var xtime = new Array(256); - for(var i = 0; i < 128; ++i) { - xtime[i] = i << 1; - xtime[i + 128] = (i + 128) << 1 ^ 0x11B; - } - - // compute all other tables - sbox = new Array(256); - isbox = new Array(256); - mix = new Array(4); - imix = new Array(4); - for(var i = 0; i < 4; ++i) { - mix[i] = new Array(256); - imix[i] = new Array(256); - } - var e = 0, ei = 0, e2, e4, e8, sx, sx2, me, ime; - for(var i = 0; i < 256; ++i) { - /* We need to generate the SubBytes() sbox and isbox tables so that - we can perform byte substitutions. This requires us to traverse - all of the elements in GF, find their multiplicative inverses, - and apply to each the following affine transformation: - - bi' = bi ^ b(i + 4) mod 8 ^ b(i + 5) mod 8 ^ b(i + 6) mod 8 ^ - b(i + 7) mod 8 ^ ci - for 0 <= i < 8, where bi is the ith bit of the byte, and ci is the - ith bit of a byte c with the value {63} or {01100011}. - - It is possible to traverse every possible value in a Galois field - using what is referred to as a 'generator'. There are many - generators (128 out of 256): 3,5,6,9,11,82 to name a few. To fully - traverse GF we iterate 255 times, multiplying by our generator - each time. - - On each iteration we can determine the multiplicative inverse for - the current element. - - Suppose there is an element in GF 'e'. For a given generator 'g', - e = g^x. The multiplicative inverse of e is g^(255 - x). It turns - out that if use the inverse of a generator as another generator - it will produce all of the corresponding multiplicative inverses - at the same time. For this reason, we choose 5 as our inverse - generator because it only requires 2 multiplies and 1 add and its - inverse, 82, requires relatively few operations as well. - - In order to apply the affine transformation, the multiplicative - inverse 'ei' of 'e' can be repeatedly XOR'd (4 times) with a - bit-cycling of 'ei'. To do this 'ei' is first stored in 's' and - 'x'. Then 's' is left shifted and the high bit of 's' is made the - low bit. The resulting value is stored in 's'. Then 'x' is XOR'd - with 's' and stored in 'x'. On each subsequent iteration the same - operation is performed. When 4 iterations are complete, 'x' is - XOR'd with 'c' (0x63) and the transformed value is stored in 'x'. - For example: - - s = 01000001 - x = 01000001 - - iteration 1: s = 10000010, x ^= s - iteration 2: s = 00000101, x ^= s - iteration 3: s = 00001010, x ^= s - iteration 4: s = 00010100, x ^= s - x ^= 0x63 - - This can be done with a loop where s = (s << 1) | (s >> 7). However, - it can also be done by using a single 16-bit (in this case 32-bit) - number 'sx'. Since XOR is an associative operation, we can set 'sx' - to 'ei' and then XOR it with 'sx' left-shifted 1,2,3, and 4 times. - The most significant bits will flow into the high 8 bit positions - and be correctly XOR'd with one another. All that remains will be - to cycle the high 8 bits by XOR'ing them all with the lower 8 bits - afterwards. - - At the same time we're populating sbox and isbox we can precompute - the multiplication we'll need to do to do MixColumns() later. - */ - - // apply affine transformation - sx = ei ^ (ei << 1) ^ (ei << 2) ^ (ei << 3) ^ (ei << 4); - sx = (sx >> 8) ^ (sx & 255) ^ 0x63; - - // update tables - sbox[e] = sx; - isbox[sx] = e; - - /* Mixing columns is done using matrix multiplication. The columns - that are to be mixed are each a single word in the current state. - The state has Nb columns (4 columns). Therefore each column is a - 4 byte word. So to mix the columns in a single column 'c' where - its rows are r0, r1, r2, and r3, we use the following matrix - multiplication: - - [2 3 1 1]*[r0,c]=[r'0,c] - [1 2 3 1] [r1,c] [r'1,c] - [1 1 2 3] [r2,c] [r'2,c] - [3 1 1 2] [r3,c] [r'3,c] - - r0, r1, r2, and r3 are each 1 byte of one of the words in the - state (a column). To do matrix multiplication for each mixed - column c' we multiply the corresponding row from the left matrix - with the corresponding column from the right matrix. In total, we - get 4 equations: - - r0,c' = 2*r0,c + 3*r1,c + 1*r2,c + 1*r3,c - r1,c' = 1*r0,c + 2*r1,c + 3*r2,c + 1*r3,c - r2,c' = 1*r0,c + 1*r1,c + 2*r2,c + 3*r3,c - r3,c' = 3*r0,c + 1*r1,c + 1*r2,c + 2*r3,c - - As usual, the multiplication is as previously defined and the - addition is XOR. In order to optimize mixing columns we can store - the multiplication results in tables. If you think of the whole - column as a word (it might help to visualize by mentally rotating - the equations above by counterclockwise 90 degrees) then you can - see that it would be useful to map the multiplications performed on - each byte (r0, r1, r2, r3) onto a word as well. For instance, we - could map 2*r0,1*r0,1*r0,3*r0 onto a word by storing 2*r0 in the - highest 8 bits and 3*r0 in the lowest 8 bits (with the other two - respectively in the middle). This means that a table can be - constructed that uses r0 as an index to the word. We can do the - same with r1, r2, and r3, creating a total of 4 tables. - - To construct a full c', we can just look up each byte of c in - their respective tables and XOR the results together. - - Also, to build each table we only have to calculate the word - for 2,1,1,3 for every byte ... which we can do on each iteration - of this loop since we will iterate over every byte. After we have - calculated 2,1,1,3 we can get the results for the other tables - by cycling the byte at the end to the beginning. For instance - we can take the result of table 2,1,1,3 and produce table 3,2,1,1 - by moving the right most byte to the left most position just like - how you can imagine the 3 moved out of 2,1,1,3 and to the front - to produce 3,2,1,1. - - There is another optimization in that the same multiples of - the current element we need in order to advance our generator - to the next iteration can be reused in performing the 2,1,1,3 - calculation. We also calculate the inverse mix column tables, - with e,9,d,b being the inverse of 2,1,1,3. - - When we're done, and we need to actually mix columns, the first - byte of each state word should be put through mix[0] (2,1,1,3), - the second through mix[1] (3,2,1,1) and so forth. Then they should - be XOR'd together to produce the fully mixed column. - */ - - // calculate mix and imix table values - sx2 = xtime[sx]; - e2 = xtime[e]; - e4 = xtime[e2]; - e8 = xtime[e4]; - me = - (sx2 << 24) ^ // 2 - (sx << 16) ^ // 1 - (sx << 8) ^ // 1 - (sx ^ sx2); // 3 - ime = - (e2 ^ e4 ^ e8) << 24 ^ // E (14) - (e ^ e8) << 16 ^ // 9 - (e ^ e4 ^ e8) << 8 ^ // D (13) - (e ^ e2 ^ e8); // B (11) - // produce each of the mix tables by rotating the 2,1,1,3 value - for(var n = 0; n < 4; ++n) { - mix[n][e] = me; - imix[n][sx] = ime; - // cycle the right most byte to the left most position - // ie: 2,1,1,3 becomes 3,2,1,1 - me = me << 24 | me >>> 8; - ime = ime << 24 | ime >>> 8; - } - - // get next element and inverse - if(e === 0) { - // 1 is the inverse of 1 - e = ei = 1; - } else { - // e = 2e + 2*2*2*(10e)) = multiply e by 82 (chosen generator) - // ei = ei + 2*2*ei = multiply ei by 5 (inverse generator) - e = e2 ^ xtime[xtime[xtime[e2 ^ e8]]]; - ei ^= xtime[xtime[ei]]; - } - } -} - -/** - * Generates a key schedule using the AES key expansion algorithm. - * - * The AES algorithm takes the Cipher Key, K, and performs a Key Expansion - * routine to generate a key schedule. The Key Expansion generates a total - * of Nb*(Nr + 1) words: the algorithm requires an initial set of Nb words, - * and each of the Nr rounds requires Nb words of key data. The resulting - * key schedule consists of a linear array of 4-byte words, denoted [wi ], - * with i in the range 0 <= i < Nb(Nr + 1). - * - * KeyExpansion(byte key[4*Nk], word w[Nb*(Nr+1)], Nk) - * AES-128 (Nb=4, Nk=4, Nr=10) - * AES-192 (Nb=4, Nk=6, Nr=12) - * AES-256 (Nb=4, Nk=8, Nr=14) - * Note: Nr=Nk+6. - * - * Nb is the number of columns (32-bit words) comprising the State (or - * number of bytes in a block). For AES, Nb=4. - * - * @param key the key to schedule (as an array of 32-bit words). - * @param decrypt true to modify the key schedule to decrypt, false not to. - * - * @return the generated key schedule. - */ -function _expandKey(key, decrypt) { - // copy the key's words to initialize the key schedule - var w = key.slice(0); - - /* RotWord() will rotate a word, moving the first byte to the last - byte's position (shifting the other bytes left). - - We will be getting the value of Rcon at i / Nk. 'i' will iterate - from Nk to (Nb * Nr+1). Nk = 4 (4 byte key), Nb = 4 (4 words in - a block), Nr = Nk + 6 (10). Therefore 'i' will iterate from - 4 to 44 (exclusive). Each time we iterate 4 times, i / Nk will - increase by 1. We use a counter iNk to keep track of this. - */ - - // go through the rounds expanding the key - var temp, iNk = 1; - var Nk = w.length; - var Nr1 = Nk + 6 + 1; - var end = Nb * Nr1; - for(var i = Nk; i < end; ++i) { - temp = w[i - 1]; - if(i % Nk === 0) { - // temp = SubWord(RotWord(temp)) ^ Rcon[i / Nk] - temp = - sbox[temp >>> 16 & 255] << 24 ^ - sbox[temp >>> 8 & 255] << 16 ^ - sbox[temp & 255] << 8 ^ - sbox[temp >>> 24] ^ (rcon[iNk] << 24); - iNk++; - } else if(Nk > 6 && (i % Nk === 4)) { - // temp = SubWord(temp) - temp = - sbox[temp >>> 24] << 24 ^ - sbox[temp >>> 16 & 255] << 16 ^ - sbox[temp >>> 8 & 255] << 8 ^ - sbox[temp & 255]; - } - w[i] = w[i - Nk] ^ temp; - } - - /* When we are updating a cipher block we always use the code path for - encryption whether we are decrypting or not (to shorten code and - simplify the generation of look up tables). However, because there - are differences in the decryption algorithm, other than just swapping - in different look up tables, we must transform our key schedule to - account for these changes: - - 1. The decryption algorithm gets its key rounds in reverse order. - 2. The decryption algorithm adds the round key before mixing columns - instead of afterwards. - - We don't need to modify our key schedule to handle the first case, - we can just traverse the key schedule in reverse order when decrypting. - - The second case requires a little work. - - The tables we built for performing rounds will take an input and then - perform SubBytes() and MixColumns() or, for the decrypt version, - InvSubBytes() and InvMixColumns(). But the decrypt algorithm requires - us to AddRoundKey() before InvMixColumns(). This means we'll need to - apply some transformations to the round key to inverse-mix its columns - so they'll be correct for moving AddRoundKey() to after the state has - had its columns inverse-mixed. - - To inverse-mix the columns of the state when we're decrypting we use a - lookup table that will apply InvSubBytes() and InvMixColumns() at the - same time. However, the round key's bytes are not inverse-substituted - in the decryption algorithm. To get around this problem, we can first - substitute the bytes in the round key so that when we apply the - transformation via the InvSubBytes()+InvMixColumns() table, it will - undo our substitution leaving us with the original value that we - want -- and then inverse-mix that value. - - This change will correctly alter our key schedule so that we can XOR - each round key with our already transformed decryption state. This - allows us to use the same code path as the encryption algorithm. - - We make one more change to the decryption key. Since the decryption - algorithm runs in reverse from the encryption algorithm, we reverse - the order of the round keys to avoid having to iterate over the key - schedule backwards when running the encryption algorithm later in - decryption mode. In addition to reversing the order of the round keys, - we also swap each round key's 2nd and 4th rows. See the comments - section where rounds are performed for more details about why this is - done. These changes are done inline with the other substitution - described above. - */ - if(decrypt) { - var tmp; - var m0 = imix[0]; - var m1 = imix[1]; - var m2 = imix[2]; - var m3 = imix[3]; - var wnew = w.slice(0); - end = w.length; - for(var i = 0, wi = end - Nb; i < end; i += Nb, wi -= Nb) { - // do not sub the first or last round key (round keys are Nb - // words) as no column mixing is performed before they are added, - // but do change the key order - if(i === 0 || i === (end - Nb)) { - wnew[i] = w[wi]; - wnew[i + 1] = w[wi + 3]; - wnew[i + 2] = w[wi + 2]; - wnew[i + 3] = w[wi + 1]; - } else { - // substitute each round key byte because the inverse-mix - // table will inverse-substitute it (effectively cancel the - // substitution because round key bytes aren't sub'd in - // decryption mode) and swap indexes 3 and 1 - for(var n = 0; n < Nb; ++n) { - tmp = w[wi + n]; - wnew[i + (3&-n)] = - m0[sbox[tmp >>> 24]] ^ - m1[sbox[tmp >>> 16 & 255]] ^ - m2[sbox[tmp >>> 8 & 255]] ^ - m3[sbox[tmp & 255]]; - } - } - } - w = wnew; - } - - return w; -} - -/** - * Updates a single block (16 bytes) using AES. The update will either - * encrypt or decrypt the block. - * - * @param w the key schedule. - * @param input the input block (an array of 32-bit words). - * @param output the updated output block. - * @param decrypt true to decrypt the block, false to encrypt it. - */ -function _updateBlock(w, input, output, decrypt) { - /* - Cipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) - begin - byte state[4,Nb] - state = in - AddRoundKey(state, w[0, Nb-1]) - for round = 1 step 1 to Nr-1 - SubBytes(state) - ShiftRows(state) - MixColumns(state) - AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) - end for - SubBytes(state) - ShiftRows(state) - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - out = state - end - - InvCipher(byte in[4*Nb], byte out[4*Nb], word w[Nb*(Nr+1)]) - begin - byte state[4,Nb] - state = in - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - for round = Nr-1 step -1 downto 1 - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[round*Nb, (round+1)*Nb-1]) - InvMixColumns(state) - end for - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[0, Nb-1]) - out = state - end - */ - - // Encrypt: AddRoundKey(state, w[0, Nb-1]) - // Decrypt: AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - var Nr = w.length / 4 - 1; - var m0, m1, m2, m3, sub; - if(decrypt) { - m0 = imix[0]; - m1 = imix[1]; - m2 = imix[2]; - m3 = imix[3]; - sub = isbox; - } else { - m0 = mix[0]; - m1 = mix[1]; - m2 = mix[2]; - m3 = mix[3]; - sub = sbox; - } - var a, b, c, d, a2, b2, c2; - a = input[0] ^ w[0]; - b = input[decrypt ? 3 : 1] ^ w[1]; - c = input[2] ^ w[2]; - d = input[decrypt ? 1 : 3] ^ w[3]; - var i = 3; - - /* In order to share code we follow the encryption algorithm when both - encrypting and decrypting. To account for the changes required in the - decryption algorithm, we use different lookup tables when decrypting - and use a modified key schedule to account for the difference in the - order of transformations applied when performing rounds. We also get - key rounds in reverse order (relative to encryption). */ - for(var round = 1; round < Nr; ++round) { - /* As described above, we'll be using table lookups to perform the - column mixing. Each column is stored as a word in the state (the - array 'input' has one column as a word at each index). In order to - mix a column, we perform these transformations on each row in c, - which is 1 byte in each word. The new column for c0 is c'0: - - m0 m1 m2 m3 - r0,c'0 = 2*r0,c0 + 3*r1,c0 + 1*r2,c0 + 1*r3,c0 - r1,c'0 = 1*r0,c0 + 2*r1,c0 + 3*r2,c0 + 1*r3,c0 - r2,c'0 = 1*r0,c0 + 1*r1,c0 + 2*r2,c0 + 3*r3,c0 - r3,c'0 = 3*r0,c0 + 1*r1,c0 + 1*r2,c0 + 2*r3,c0 - - So using mix tables where c0 is a word with r0 being its upper - 8 bits and r3 being its lower 8 bits: - - m0[c0 >> 24] will yield this word: [2*r0,1*r0,1*r0,3*r0] - ... - m3[c0 & 255] will yield this word: [1*r3,1*r3,3*r3,2*r3] - - Therefore to mix the columns in each word in the state we - do the following (& 255 omitted for brevity): - c'0,r0 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r1 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r2 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - c'0,r3 = m0[c0 >> 24] ^ m1[c1 >> 16] ^ m2[c2 >> 8] ^ m3[c3] - - However, before mixing, the algorithm requires us to perform - ShiftRows(). The ShiftRows() transformation cyclically shifts the - last 3 rows of the state over different offsets. The first row - (r = 0) is not shifted. - - s'_r,c = s_r,(c + shift(r, Nb) mod Nb - for 0 < r < 4 and 0 <= c < Nb and - shift(1, 4) = 1 - shift(2, 4) = 2 - shift(3, 4) = 3. - - This causes the first byte in r = 1 to be moved to the end of - the row, the first 2 bytes in r = 2 to be moved to the end of - the row, the first 3 bytes in r = 3 to be moved to the end of - the row: - - r1: [c0 c1 c2 c3] => [c1 c2 c3 c0] - r2: [c0 c1 c2 c3] [c2 c3 c0 c1] - r3: [c0 c1 c2 c3] [c3 c0 c1 c2] - - We can make these substitutions inline with our column mixing to - generate an updated set of equations to produce each word in the - state (note the columns have changed positions): - - c0 c1 c2 c3 => c0 c1 c2 c3 - c0 c1 c2 c3 c1 c2 c3 c0 (cycled 1 byte) - c0 c1 c2 c3 c2 c3 c0 c1 (cycled 2 bytes) - c0 c1 c2 c3 c3 c0 c1 c2 (cycled 3 bytes) - - Therefore: - - c'0 = 2*r0,c0 + 3*r1,c1 + 1*r2,c2 + 1*r3,c3 - c'0 = 1*r0,c0 + 2*r1,c1 + 3*r2,c2 + 1*r3,c3 - c'0 = 1*r0,c0 + 1*r1,c1 + 2*r2,c2 + 3*r3,c3 - c'0 = 3*r0,c0 + 1*r1,c1 + 1*r2,c2 + 2*r3,c3 - - c'1 = 2*r0,c1 + 3*r1,c2 + 1*r2,c3 + 1*r3,c0 - c'1 = 1*r0,c1 + 2*r1,c2 + 3*r2,c3 + 1*r3,c0 - c'1 = 1*r0,c1 + 1*r1,c2 + 2*r2,c3 + 3*r3,c0 - c'1 = 3*r0,c1 + 1*r1,c2 + 1*r2,c3 + 2*r3,c0 - - ... and so forth for c'2 and c'3. The important distinction is - that the columns are cycling, with c0 being used with the m0 - map when calculating c0, but c1 being used with the m0 map when - calculating c1 ... and so forth. - - When performing the inverse we transform the mirror image and - skip the bottom row, instead of the top one, and move upwards: - - c3 c2 c1 c0 => c0 c3 c2 c1 (cycled 3 bytes) *same as encryption - c3 c2 c1 c0 c1 c0 c3 c2 (cycled 2 bytes) - c3 c2 c1 c0 c2 c1 c0 c3 (cycled 1 byte) *same as encryption - c3 c2 c1 c0 c3 c2 c1 c0 - - If you compare the resulting matrices for ShiftRows()+MixColumns() - and for InvShiftRows()+InvMixColumns() the 2nd and 4th columns are - different (in encrypt mode vs. decrypt mode). So in order to use - the same code to handle both encryption and decryption, we will - need to do some mapping. - - If in encryption mode we let a=c0, b=c1, c=c2, d=c3, and r be - a row number in the state, then the resulting matrix in encryption - mode for applying the above transformations would be: - - r1: a b c d - r2: b c d a - r3: c d a b - r4: d a b c - - If we did the same in decryption mode we would get: - - r1: a d c b - r2: b a d c - r3: c b a d - r4: d c b a - - If instead we swap d and b (set b=c3 and d=c1), then we get: - - r1: a b c d - r2: d a b c - r3: c d a b - r4: b c d a - - Now the 1st and 3rd rows are the same as the encryption matrix. All - we need to do then to make the mapping exactly the same is to swap - the 2nd and 4th rows when in decryption mode. To do this without - having to do it on each iteration, we swapped the 2nd and 4th rows - in the decryption key schedule. We also have to do the swap above - when we first pull in the input and when we set the final output. */ - a2 = - m0[a >>> 24] ^ - m1[b >>> 16 & 255] ^ - m2[c >>> 8 & 255] ^ - m3[d & 255] ^ w[++i]; - b2 = - m0[b >>> 24] ^ - m1[c >>> 16 & 255] ^ - m2[d >>> 8 & 255] ^ - m3[a & 255] ^ w[++i]; - c2 = - m0[c >>> 24] ^ - m1[d >>> 16 & 255] ^ - m2[a >>> 8 & 255] ^ - m3[b & 255] ^ w[++i]; - d = - m0[d >>> 24] ^ - m1[a >>> 16 & 255] ^ - m2[b >>> 8 & 255] ^ - m3[c & 255] ^ w[++i]; - a = a2; - b = b2; - c = c2; - } - - /* - Encrypt: - SubBytes(state) - ShiftRows(state) - AddRoundKey(state, w[Nr*Nb, (Nr+1)*Nb-1]) - - Decrypt: - InvShiftRows(state) - InvSubBytes(state) - AddRoundKey(state, w[0, Nb-1]) - */ - // Note: rows are shifted inline - output[0] = - (sub[a >>> 24] << 24) ^ - (sub[b >>> 16 & 255] << 16) ^ - (sub[c >>> 8 & 255] << 8) ^ - (sub[d & 255]) ^ w[++i]; - output[decrypt ? 3 : 1] = - (sub[b >>> 24] << 24) ^ - (sub[c >>> 16 & 255] << 16) ^ - (sub[d >>> 8 & 255] << 8) ^ - (sub[a & 255]) ^ w[++i]; - output[2] = - (sub[c >>> 24] << 24) ^ - (sub[d >>> 16 & 255] << 16) ^ - (sub[a >>> 8 & 255] << 8) ^ - (sub[b & 255]) ^ w[++i]; - output[decrypt ? 1 : 3] = - (sub[d >>> 24] << 24) ^ - (sub[a >>> 16 & 255] << 16) ^ - (sub[b >>> 8 & 255] << 8) ^ - (sub[c & 255]) ^ w[++i]; -} - -/** - * Deprecated. Instead, use: - * - * forge.cipher.createCipher('AES-', key); - * forge.cipher.createDecipher('AES-', key); - * - * Creates a deprecated AES cipher object. This object's mode will default to - * CBC (cipher-block-chaining). - * - * The key and iv may be given as a string of bytes, an array of bytes, a - * byte buffer, or an array of 32-bit words. - * - * @param options the options to use. - * key the symmetric key to use. - * output the buffer to write to. - * decrypt true for decryption, false for encryption. - * mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -function _createCipher(options) { - options = options || {}; - var mode = (options.mode || 'CBC').toUpperCase(); - var algorithm = 'AES-' + mode; - - var cipher; - if(options.decrypt) { - cipher = forge.cipher.createDecipher(algorithm, options.key); - } else { - cipher = forge.cipher.createCipher(algorithm, options.key); - } - - // backwards compatible start API - var start = cipher.start; - cipher.start = function(iv, options) { - // backwards compatibility: support second arg as output buffer - var output = null; - if(options instanceof forge.util.ByteBuffer) { - output = options; - options = {}; - } - options = options || {}; - options.output = output; - options.iv = iv; - start.call(cipher, options); - }; - - return cipher; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/aesCipherSuites.js b/reverse_engineering/node_modules/node-forge/lib/aesCipherSuites.js deleted file mode 100644 index fed60f36..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/aesCipherSuites.js +++ /dev/null @@ -1,282 +0,0 @@ -/** - * A Javascript implementation of AES Cipher Suites for TLS. - * - * @author Dave Longley - * - * Copyright (c) 2009-2015 Digital Bazaar, Inc. - * - */ -var forge = require('./forge'); -require('./aes'); -require('./tls'); - -var tls = module.exports = forge.tls; - -/** - * Supported cipher suites. - */ -tls.CipherSuites['TLS_RSA_WITH_AES_128_CBC_SHA'] = { - id: [0x00, 0x2f], - name: 'TLS_RSA_WITH_AES_128_CBC_SHA', - initSecurityParameters: function(sp) { - sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; - sp.cipher_type = tls.CipherType.block; - sp.enc_key_length = 16; - sp.block_length = 16; - sp.fixed_iv_length = 16; - sp.record_iv_length = 16; - sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; - sp.mac_length = 20; - sp.mac_key_length = 20; - }, - initConnectionState: initConnectionState -}; -tls.CipherSuites['TLS_RSA_WITH_AES_256_CBC_SHA'] = { - id: [0x00, 0x35], - name: 'TLS_RSA_WITH_AES_256_CBC_SHA', - initSecurityParameters: function(sp) { - sp.bulk_cipher_algorithm = tls.BulkCipherAlgorithm.aes; - sp.cipher_type = tls.CipherType.block; - sp.enc_key_length = 32; - sp.block_length = 16; - sp.fixed_iv_length = 16; - sp.record_iv_length = 16; - sp.mac_algorithm = tls.MACAlgorithm.hmac_sha1; - sp.mac_length = 20; - sp.mac_key_length = 20; - }, - initConnectionState: initConnectionState -}; - -function initConnectionState(state, c, sp) { - var client = (c.entity === forge.tls.ConnectionEnd.client); - - // cipher setup - state.read.cipherState = { - init: false, - cipher: forge.cipher.createDecipher('AES-CBC', client ? - sp.keys.server_write_key : sp.keys.client_write_key), - iv: client ? sp.keys.server_write_IV : sp.keys.client_write_IV - }; - state.write.cipherState = { - init: false, - cipher: forge.cipher.createCipher('AES-CBC', client ? - sp.keys.client_write_key : sp.keys.server_write_key), - iv: client ? sp.keys.client_write_IV : sp.keys.server_write_IV - }; - state.read.cipherFunction = decrypt_aes_cbc_sha1; - state.write.cipherFunction = encrypt_aes_cbc_sha1; - - // MAC setup - state.read.macLength = state.write.macLength = sp.mac_length; - state.read.macFunction = state.write.macFunction = tls.hmac_sha1; -} - -/** - * Encrypts the TLSCompressed record into a TLSCipherText record using AES - * in CBC mode. - * - * @param record the TLSCompressed record to encrypt. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -function encrypt_aes_cbc_sha1(record, s) { - var rval = false; - - // append MAC to fragment, update sequence number - var mac = s.macFunction(s.macKey, s.sequenceNumber, record); - record.fragment.putBytes(mac); - s.updateSequenceNumber(); - - // TLS 1.1+ use an explicit IV every time to protect against CBC attacks - var iv; - if(record.version.minor === tls.Versions.TLS_1_0.minor) { - // use the pre-generated IV when initializing for TLS 1.0, otherwise use - // the residue from the previous encryption - iv = s.cipherState.init ? null : s.cipherState.iv; - } else { - iv = forge.random.getBytesSync(16); - } - - s.cipherState.init = true; - - // start cipher - var cipher = s.cipherState.cipher; - cipher.start({iv: iv}); - - // TLS 1.1+ write IV into output - if(record.version.minor >= tls.Versions.TLS_1_1.minor) { - cipher.output.putBytes(iv); - } - - // do encryption (default padding is appropriate) - cipher.update(record.fragment); - if(cipher.finish(encrypt_aes_cbc_sha1_padding)) { - // set record fragment to encrypted output - record.fragment = cipher.output; - record.length = record.fragment.length(); - rval = true; - } - - return rval; -} - -/** - * Handles padding for aes_cbc_sha1 in encrypt mode. - * - * @param blockSize the block size. - * @param input the input buffer. - * @param decrypt true in decrypt mode, false in encrypt mode. - * - * @return true on success, false on failure. - */ -function encrypt_aes_cbc_sha1_padding(blockSize, input, decrypt) { - /* The encrypted data length (TLSCiphertext.length) is one more than the sum - of SecurityParameters.block_length, TLSCompressed.length, - SecurityParameters.mac_length, and padding_length. - - The padding may be any length up to 255 bytes long, as long as it results in - the TLSCiphertext.length being an integral multiple of the block length. - Lengths longer than necessary might be desirable to frustrate attacks on a - protocol based on analysis of the lengths of exchanged messages. Each uint8 - in the padding data vector must be filled with the padding length value. - - The padding length should be such that the total size of the - GenericBlockCipher structure is a multiple of the cipher's block length. - Legal values range from zero to 255, inclusive. This length specifies the - length of the padding field exclusive of the padding_length field itself. - - This is slightly different from PKCS#7 because the padding value is 1 - less than the actual number of padding bytes if you include the - padding_length uint8 itself as a padding byte. */ - if(!decrypt) { - // get the number of padding bytes required to reach the blockSize and - // subtract 1 for the padding value (to make room for the padding_length - // uint8) - var padding = blockSize - (input.length() % blockSize); - input.fillWithByte(padding - 1, padding); - } - return true; -} - -/** - * Handles padding for aes_cbc_sha1 in decrypt mode. - * - * @param blockSize the block size. - * @param output the output buffer. - * @param decrypt true in decrypt mode, false in encrypt mode. - * - * @return true on success, false on failure. - */ -function decrypt_aes_cbc_sha1_padding(blockSize, output, decrypt) { - var rval = true; - if(decrypt) { - /* The last byte in the output specifies the number of padding bytes not - including itself. Each of the padding bytes has the same value as that - last byte (known as the padding_length). Here we check all padding - bytes to ensure they have the value of padding_length even if one of - them is bad in order to ward-off timing attacks. */ - var len = output.length(); - var paddingLength = output.last(); - for(var i = len - 1 - paddingLength; i < len - 1; ++i) { - rval = rval && (output.at(i) == paddingLength); - } - if(rval) { - // trim off padding bytes and last padding length byte - output.truncate(paddingLength + 1); - } - } - return rval; -} - -/** - * Decrypts a TLSCipherText record into a TLSCompressed record using - * AES in CBC mode. - * - * @param record the TLSCipherText record to decrypt. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -function decrypt_aes_cbc_sha1(record, s) { - var rval = false; - - var iv; - if(record.version.minor === tls.Versions.TLS_1_0.minor) { - // use pre-generated IV when initializing for TLS 1.0, otherwise use the - // residue from the previous decryption - iv = s.cipherState.init ? null : s.cipherState.iv; - } else { - // TLS 1.1+ use an explicit IV every time to protect against CBC attacks - // that is appended to the record fragment - iv = record.fragment.getBytes(16); - } - - s.cipherState.init = true; - - // start cipher - var cipher = s.cipherState.cipher; - cipher.start({iv: iv}); - - // do decryption - cipher.update(record.fragment); - rval = cipher.finish(decrypt_aes_cbc_sha1_padding); - - // even if decryption fails, keep going to minimize timing attacks - - // decrypted data: - // first (len - 20) bytes = application data - // last 20 bytes = MAC - var macLen = s.macLength; - - // create a random MAC to check against should the mac length check fail - // Note: do this regardless of the failure to keep timing consistent - var mac = forge.random.getBytesSync(macLen); - - // get fragment and mac - var len = cipher.output.length(); - if(len >= macLen) { - record.fragment = cipher.output.getBytes(len - macLen); - mac = cipher.output.getBytes(macLen); - } else { - // bad data, but get bytes anyway to try to keep timing consistent - record.fragment = cipher.output.getBytes(); - } - record.fragment = forge.util.createBuffer(record.fragment); - record.length = record.fragment.length(); - - // see if data integrity checks out, update sequence number - var mac2 = s.macFunction(s.macKey, s.sequenceNumber, record); - s.updateSequenceNumber(); - rval = compareMacs(s.macKey, mac, mac2) && rval; - return rval; -} - -/** - * Safely compare two MACs. This function will compare two MACs in a way - * that protects against timing attacks. - * - * TODO: Expose elsewhere as a utility API. - * - * See: https://www.nccgroup.trust/us/about-us/newsroom-and-events/blog/2011/february/double-hmac-verification/ - * - * @param key the MAC key to use. - * @param mac1 as a binary-encoded string of bytes. - * @param mac2 as a binary-encoded string of bytes. - * - * @return true if the MACs are the same, false if not. - */ -function compareMacs(key, mac1, mac2) { - var hmac = forge.hmac.create(); - - hmac.start('SHA1', key); - hmac.update(mac1); - mac1 = hmac.digest().getBytes(); - - hmac.start(null, null); - hmac.update(mac2); - mac2 = hmac.digest().getBytes(); - - return mac1 === mac2; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/asn1-validator.js b/reverse_engineering/node_modules/node-forge/lib/asn1-validator.js deleted file mode 100644 index 2be32850..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/asn1-validator.js +++ /dev/null @@ -1,91 +0,0 @@ -/** - * Copyright (c) 2019 Digital Bazaar, Inc. - */ - -var forge = require('./forge'); -require('./asn1'); -var asn1 = forge.asn1; - -exports.privateKeyValidator = { - // PrivateKeyInfo - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'PrivateKeyInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // privateKeyAlgorithm - name: 'PrivateKeyInfo.privateKeyAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'privateKeyOid' - }] - }, { - // PrivateKey - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'privateKey' - }] -}; - -exports.publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, - // capture group for ed25519PublicKey - { - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - composed: true, - captureBitStringValue: 'ed25519PublicKey' - } - // FIXME: this is capture group for rsaPublicKey, use it in this API or - // discard? - /* { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - } */ - ] -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/asn1.js b/reverse_engineering/node_modules/node-forge/lib/asn1.js deleted file mode 100644 index e0fea0e0..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/asn1.js +++ /dev/null @@ -1,1408 +0,0 @@ -/** - * Javascript implementation of Abstract Syntax Notation Number One. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - * - * An API for storing data using the Abstract Syntax Notation Number One - * format using DER (Distinguished Encoding Rules) encoding. This encoding is - * commonly used to store data for PKI, i.e. X.509 Certificates, and this - * implementation exists for that purpose. - * - * Abstract Syntax Notation Number One (ASN.1) is used to define the abstract - * syntax of information without restricting the way the information is encoded - * for transmission. It provides a standard that allows for open systems - * communication. ASN.1 defines the syntax of information data and a number of - * simple data types as well as a notation for describing them and specifying - * values for them. - * - * The RSA algorithm creates public and private keys that are often stored in - * X.509 or PKCS#X formats -- which use ASN.1 (encoded in DER format). This - * class provides the most basic functionality required to store and load DSA - * keys that are encoded according to ASN.1. - * - * The most common binary encodings for ASN.1 are BER (Basic Encoding Rules) - * and DER (Distinguished Encoding Rules). DER is just a subset of BER that - * has stricter requirements for how data must be encoded. - * - * Each ASN.1 structure has a tag (a byte identifying the ASN.1 structure type) - * and a byte array for the value of this ASN1 structure which may be data or a - * list of ASN.1 structures. - * - * Each ASN.1 structure using BER is (Tag-Length-Value): - * - * | byte 0 | bytes X | bytes Y | - * |--------|---------|---------- - * | tag | length | value | - * - * ASN.1 allows for tags to be of "High-tag-number form" which allows a tag to - * be two or more octets, but that is not supported by this class. A tag is - * only 1 byte. Bits 1-5 give the tag number (ie the data type within a - * particular 'class'), 6 indicates whether or not the ASN.1 value is - * constructed from other ASN.1 values, and bits 7 and 8 give the 'class'. If - * bits 7 and 8 are both zero, the class is UNIVERSAL. If only bit 7 is set, - * then the class is APPLICATION. If only bit 8 is set, then the class is - * CONTEXT_SPECIFIC. If both bits 7 and 8 are set, then the class is PRIVATE. - * The tag numbers for the data types for the class UNIVERSAL are listed below: - * - * UNIVERSAL 0 Reserved for use by the encoding rules - * UNIVERSAL 1 Boolean type - * UNIVERSAL 2 Integer type - * UNIVERSAL 3 Bitstring type - * UNIVERSAL 4 Octetstring type - * UNIVERSAL 5 Null type - * UNIVERSAL 6 Object identifier type - * UNIVERSAL 7 Object descriptor type - * UNIVERSAL 8 External type and Instance-of type - * UNIVERSAL 9 Real type - * UNIVERSAL 10 Enumerated type - * UNIVERSAL 11 Embedded-pdv type - * UNIVERSAL 12 UTF8String type - * UNIVERSAL 13 Relative object identifier type - * UNIVERSAL 14-15 Reserved for future editions - * UNIVERSAL 16 Sequence and Sequence-of types - * UNIVERSAL 17 Set and Set-of types - * UNIVERSAL 18-22, 25-30 Character string types - * UNIVERSAL 23-24 Time types - * - * The length of an ASN.1 structure is specified after the tag identifier. - * There is a definite form and an indefinite form. The indefinite form may - * be used if the encoding is constructed and not all immediately available. - * The indefinite form is encoded using a length byte with only the 8th bit - * set. The end of the constructed object is marked using end-of-contents - * octets (two zero bytes). - * - * The definite form looks like this: - * - * The length may take up 1 or more bytes, it depends on the length of the - * value of the ASN.1 structure. DER encoding requires that if the ASN.1 - * structure has a value that has a length greater than 127, more than 1 byte - * will be used to store its length, otherwise just one byte will be used. - * This is strict. - * - * In the case that the length of the ASN.1 value is less than 127, 1 octet - * (byte) is used to store the "short form" length. The 8th bit has a value of - * 0 indicating the length is "short form" and not "long form" and bits 7-1 - * give the length of the data. (The 8th bit is the left-most, most significant - * bit: also known as big endian or network format). - * - * In the case that the length of the ASN.1 value is greater than 127, 2 to - * 127 octets (bytes) are used to store the "long form" length. The first - * byte's 8th bit is set to 1 to indicate the length is "long form." Bits 7-1 - * give the number of additional octets. All following octets are in base 256 - * with the most significant digit first (typical big-endian binary unsigned - * integer storage). So, for instance, if the length of a value was 257, the - * first byte would be set to: - * - * 10000010 = 130 = 0x82. - * - * This indicates there are 2 octets (base 256) for the length. The second and - * third bytes (the octets just mentioned) would store the length in base 256: - * - * octet 2: 00000001 = 1 * 256^1 = 256 - * octet 3: 00000001 = 1 * 256^0 = 1 - * total = 257 - * - * The algorithm for converting a js integer value of 257 to base-256 is: - * - * var value = 257; - * var bytes = []; - * bytes[0] = (value >>> 8) & 0xFF; // most significant byte first - * bytes[1] = value & 0xFF; // least significant byte last - * - * On the ASN.1 UNIVERSAL Object Identifier (OID) type: - * - * An OID can be written like: "value1.value2.value3...valueN" - * - * The DER encoding rules: - * - * The first byte has the value 40 * value1 + value2. - * The following bytes, if any, encode the remaining values. Each value is - * encoded in base 128, most significant digit first (big endian), with as - * few digits as possible, and the most significant bit of each byte set - * to 1 except the last in each value's encoding. For example: Given the - * OID "1.2.840.113549", its DER encoding is (remember each byte except the - * last one in each encoding is OR'd with 0x80): - * - * byte 1: 40 * 1 + 2 = 42 = 0x2A. - * bytes 2-3: 128 * 6 + 72 = 840 = 6 72 = 6 72 = 0x0648 = 0x8648 - * bytes 4-6: 16384 * 6 + 128 * 119 + 13 = 6 119 13 = 0x06770D = 0x86F70D - * - * The final value is: 0x2A864886F70D. - * The full OID (including ASN.1 tag and length of 6 bytes) is: - * 0x06062A864886F70D - */ -var forge = require('./forge'); -require('./util'); -require('./oids'); - -/* ASN.1 API */ -var asn1 = module.exports = forge.asn1 = forge.asn1 || {}; - -/** - * ASN.1 classes. - */ -asn1.Class = { - UNIVERSAL: 0x00, - APPLICATION: 0x40, - CONTEXT_SPECIFIC: 0x80, - PRIVATE: 0xC0 -}; - -/** - * ASN.1 types. Not all types are supported by this implementation, only - * those necessary to implement a simple PKI are implemented. - */ -asn1.Type = { - NONE: 0, - BOOLEAN: 1, - INTEGER: 2, - BITSTRING: 3, - OCTETSTRING: 4, - NULL: 5, - OID: 6, - ODESC: 7, - EXTERNAL: 8, - REAL: 9, - ENUMERATED: 10, - EMBEDDED: 11, - UTF8: 12, - ROID: 13, - SEQUENCE: 16, - SET: 17, - PRINTABLESTRING: 19, - IA5STRING: 22, - UTCTIME: 23, - GENERALIZEDTIME: 24, - BMPSTRING: 30 -}; - -/** - * Creates a new asn1 object. - * - * @param tagClass the tag class for the object. - * @param type the data type (tag number) for the object. - * @param constructed true if the asn1 object is in constructed form. - * @param value the value for the object, if it is not constructed. - * @param [options] the options to use: - * [bitStringContents] the plain BIT STRING content including padding - * byte. - * - * @return the asn1 object. - */ -asn1.create = function(tagClass, type, constructed, value, options) { - /* An asn1 object has a tagClass, a type, a constructed flag, and a - value. The value's type depends on the constructed flag. If - constructed, it will contain a list of other asn1 objects. If not, - it will contain the ASN.1 value as an array of bytes formatted - according to the ASN.1 data type. */ - - // remove undefined values - if(forge.util.isArray(value)) { - var tmp = []; - for(var i = 0; i < value.length; ++i) { - if(value[i] !== undefined) { - tmp.push(value[i]); - } - } - value = tmp; - } - - var obj = { - tagClass: tagClass, - type: type, - constructed: constructed, - composed: constructed || forge.util.isArray(value), - value: value - }; - if(options && 'bitStringContents' in options) { - // TODO: copy byte buffer if it's a buffer not a string - obj.bitStringContents = options.bitStringContents; - // TODO: add readonly flag to avoid this overhead - // save copy to detect changes - obj.original = asn1.copy(obj); - } - return obj; -}; - -/** - * Copies an asn1 object. - * - * @param obj the asn1 object. - * @param [options] copy options: - * [excludeBitStringContents] true to not copy bitStringContents - * - * @return the a copy of the asn1 object. - */ -asn1.copy = function(obj, options) { - var copy; - - if(forge.util.isArray(obj)) { - copy = []; - for(var i = 0; i < obj.length; ++i) { - copy.push(asn1.copy(obj[i], options)); - } - return copy; - } - - if(typeof obj === 'string') { - // TODO: copy byte buffer if it's a buffer not a string - return obj; - } - - copy = { - tagClass: obj.tagClass, - type: obj.type, - constructed: obj.constructed, - composed: obj.composed, - value: asn1.copy(obj.value, options) - }; - if(options && !options.excludeBitStringContents) { - // TODO: copy byte buffer if it's a buffer not a string - copy.bitStringContents = obj.bitStringContents; - } - return copy; -}; - -/** - * Compares asn1 objects for equality. - * - * Note this function does not run in constant time. - * - * @param obj1 the first asn1 object. - * @param obj2 the second asn1 object. - * @param [options] compare options: - * [includeBitStringContents] true to compare bitStringContents - * - * @return true if the asn1 objects are equal. - */ -asn1.equals = function(obj1, obj2, options) { - if(forge.util.isArray(obj1)) { - if(!forge.util.isArray(obj2)) { - return false; - } - if(obj1.length !== obj2.length) { - return false; - } - for(var i = 0; i < obj1.length; ++i) { - if(!asn1.equals(obj1[i], obj2[i])) { - return false; - } - } - return true; - } - - if(typeof obj1 !== typeof obj2) { - return false; - } - - if(typeof obj1 === 'string') { - return obj1 === obj2; - } - - var equal = obj1.tagClass === obj2.tagClass && - obj1.type === obj2.type && - obj1.constructed === obj2.constructed && - obj1.composed === obj2.composed && - asn1.equals(obj1.value, obj2.value); - if(options && options.includeBitStringContents) { - equal = equal && (obj1.bitStringContents === obj2.bitStringContents); - } - - return equal; -}; - -/** - * Gets the length of a BER-encoded ASN.1 value. - * - * In case the length is not specified, undefined is returned. - * - * @param b the BER-encoded ASN.1 byte buffer, starting with the first - * length byte. - * - * @return the length of the BER-encoded ASN.1 value or undefined. - */ -asn1.getBerValueLength = function(b) { - // TODO: move this function and related DER/BER functions to a der.js - // file; better abstract ASN.1 away from der/ber. - var b2 = b.getByte(); - if(b2 === 0x80) { - return undefined; - } - - // see if the length is "short form" or "long form" (bit 8 set) - var length; - var longForm = b2 & 0x80; - if(!longForm) { - // length is just the first byte - length = b2; - } else { - // the number of bytes the length is specified in bits 7 through 1 - // and each length byte is in big-endian base-256 - length = b.getInt((b2 & 0x7F) << 3); - } - return length; -}; - -/** - * Check if the byte buffer has enough bytes. Throws an Error if not. - * - * @param bytes the byte buffer to parse from. - * @param remaining the bytes remaining in the current parsing state. - * @param n the number of bytes the buffer must have. - */ -function _checkBufferLength(bytes, remaining, n) { - if(n > remaining) { - var error = new Error('Too few bytes to parse DER.'); - error.available = bytes.length(); - error.remaining = remaining; - error.requested = n; - throw error; - } -} - -/** - * Gets the length of a BER-encoded ASN.1 value. - * - * In case the length is not specified, undefined is returned. - * - * @param bytes the byte buffer to parse from. - * @param remaining the bytes remaining in the current parsing state. - * - * @return the length of the BER-encoded ASN.1 value or undefined. - */ -var _getValueLength = function(bytes, remaining) { - // TODO: move this function and related DER/BER functions to a der.js - // file; better abstract ASN.1 away from der/ber. - // fromDer already checked that this byte exists - var b2 = bytes.getByte(); - remaining--; - if(b2 === 0x80) { - return undefined; - } - - // see if the length is "short form" or "long form" (bit 8 set) - var length; - var longForm = b2 & 0x80; - if(!longForm) { - // length is just the first byte - length = b2; - } else { - // the number of bytes the length is specified in bits 7 through 1 - // and each length byte is in big-endian base-256 - var longFormBytes = b2 & 0x7F; - _checkBufferLength(bytes, remaining, longFormBytes); - length = bytes.getInt(longFormBytes << 3); - } - // FIXME: this will only happen for 32 bit getInt with high bit set - if(length < 0) { - throw new Error('Negative length: ' + length); - } - return length; -}; - -/** - * Parses an asn1 object from a byte buffer in DER format. - * - * @param bytes the byte buffer to parse from. - * @param [strict] true to be strict when checking value lengths, false to - * allow truncated values (default: true). - * @param [options] object with options or boolean strict flag - * [strict] true to be strict when checking value lengths, false to - * allow truncated values (default: true). - * [decodeBitStrings] true to attempt to decode the content of - * BIT STRINGs (not OCTET STRINGs) using strict mode. Note that - * without schema support to understand the data context this can - * erroneously decode values that happen to be valid ASN.1. This - * flag will be deprecated or removed as soon as schema support is - * available. (default: true) - * - * @return the parsed asn1 object. - */ -asn1.fromDer = function(bytes, options) { - if(options === undefined) { - options = { - strict: true, - decodeBitStrings: true - }; - } - if(typeof options === 'boolean') { - options = { - strict: options, - decodeBitStrings: true - }; - } - if(!('strict' in options)) { - options.strict = true; - } - if(!('decodeBitStrings' in options)) { - options.decodeBitStrings = true; - } - - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - return _fromDer(bytes, bytes.length(), 0, options); -}; - -/** - * Internal function to parse an asn1 object from a byte buffer in DER format. - * - * @param bytes the byte buffer to parse from. - * @param remaining the number of bytes remaining for this chunk. - * @param depth the current parsing depth. - * @param options object with same options as fromDer(). - * - * @return the parsed asn1 object. - */ -function _fromDer(bytes, remaining, depth, options) { - // temporary storage for consumption calculations - var start; - - // minimum length for ASN.1 DER structure is 2 - _checkBufferLength(bytes, remaining, 2); - - // get the first byte - var b1 = bytes.getByte(); - // consumed one byte - remaining--; - - // get the tag class - var tagClass = (b1 & 0xC0); - - // get the type (bits 1-5) - var type = b1 & 0x1F; - - // get the variable value length and adjust remaining bytes - start = bytes.length(); - var length = _getValueLength(bytes, remaining); - remaining -= start - bytes.length(); - - // ensure there are enough bytes to get the value - if(length !== undefined && length > remaining) { - if(options.strict) { - var error = new Error('Too few bytes to read ASN.1 value.'); - error.available = bytes.length(); - error.remaining = remaining; - error.requested = length; - throw error; - } - // Note: be lenient with truncated values and use remaining state bytes - length = remaining; - } - - // value storage - var value; - // possible BIT STRING contents storage - var bitStringContents; - - // constructed flag is bit 6 (32 = 0x20) of the first byte - var constructed = ((b1 & 0x20) === 0x20); - if(constructed) { - // parse child asn1 objects from the value - value = []; - if(length === undefined) { - // asn1 object of indefinite length, read until end tag - for(;;) { - _checkBufferLength(bytes, remaining, 2); - if(bytes.bytes(2) === String.fromCharCode(0, 0)) { - bytes.getBytes(2); - remaining -= 2; - break; - } - start = bytes.length(); - value.push(_fromDer(bytes, remaining, depth + 1, options)); - remaining -= start - bytes.length(); - } - } else { - // parsing asn1 object of definite length - while(length > 0) { - start = bytes.length(); - value.push(_fromDer(bytes, length, depth + 1, options)); - remaining -= start - bytes.length(); - length -= start - bytes.length(); - } - } - } - - // if a BIT STRING, save the contents including padding - if(value === undefined && tagClass === asn1.Class.UNIVERSAL && - type === asn1.Type.BITSTRING) { - bitStringContents = bytes.bytes(length); - } - - // determine if a non-constructed value should be decoded as a composed - // value that contains other ASN.1 objects. BIT STRINGs (and OCTET STRINGs) - // can be used this way. - if(value === undefined && options.decodeBitStrings && - tagClass === asn1.Class.UNIVERSAL && - // FIXME: OCTET STRINGs not yet supported here - // .. other parts of forge expect to decode OCTET STRINGs manually - (type === asn1.Type.BITSTRING /*|| type === asn1.Type.OCTETSTRING*/) && - length > 1) { - // save read position - var savedRead = bytes.read; - var savedRemaining = remaining; - var unused = 0; - if(type === asn1.Type.BITSTRING) { - /* The first octet gives the number of bits by which the length of the - bit string is less than the next multiple of eight (this is called - the "number of unused bits"). - - The second and following octets give the value of the bit string - converted to an octet string. */ - _checkBufferLength(bytes, remaining, 1); - unused = bytes.getByte(); - remaining--; - } - // if all bits are used, maybe the BIT/OCTET STRING holds ASN.1 objs - if(unused === 0) { - try { - // attempt to parse child asn1 object from the value - // (stored in array to signal composed value) - start = bytes.length(); - var subOptions = { - // enforce strict mode to avoid parsing ASN.1 from plain data - verbose: options.verbose, - strict: true, - decodeBitStrings: true - }; - var composed = _fromDer(bytes, remaining, depth + 1, subOptions); - var used = start - bytes.length(); - remaining -= used; - if(type == asn1.Type.BITSTRING) { - used++; - } - - // if the data all decoded and the class indicates UNIVERSAL or - // CONTEXT_SPECIFIC then assume we've got an encapsulated ASN.1 object - var tc = composed.tagClass; - if(used === length && - (tc === asn1.Class.UNIVERSAL || tc === asn1.Class.CONTEXT_SPECIFIC)) { - value = [composed]; - } - } catch(ex) { - } - } - if(value === undefined) { - // restore read position - bytes.read = savedRead; - remaining = savedRemaining; - } - } - - if(value === undefined) { - // asn1 not constructed or composed, get raw value - // TODO: do DER to OID conversion and vice-versa in .toDer? - - if(length === undefined) { - if(options.strict) { - throw new Error('Non-constructed ASN.1 object of indefinite length.'); - } - // be lenient and use remaining state bytes - length = remaining; - } - - if(type === asn1.Type.BMPSTRING) { - value = ''; - for(; length > 0; length -= 2) { - _checkBufferLength(bytes, remaining, 2); - value += String.fromCharCode(bytes.getInt16()); - remaining -= 2; - } - } else { - value = bytes.getBytes(length); - } - } - - // add BIT STRING contents if available - var asn1Options = bitStringContents === undefined ? null : { - bitStringContents: bitStringContents - }; - - // create and return asn1 object - return asn1.create(tagClass, type, constructed, value, asn1Options); -} - -/** - * Converts the given asn1 object to a buffer of bytes in DER format. - * - * @param asn1 the asn1 object to convert to bytes. - * - * @return the buffer of bytes. - */ -asn1.toDer = function(obj) { - var bytes = forge.util.createBuffer(); - - // build the first byte - var b1 = obj.tagClass | obj.type; - - // for storing the ASN.1 value - var value = forge.util.createBuffer(); - - // use BIT STRING contents if available and data not changed - var useBitStringContents = false; - if('bitStringContents' in obj) { - useBitStringContents = true; - if(obj.original) { - useBitStringContents = asn1.equals(obj, obj.original); - } - } - - if(useBitStringContents) { - value.putBytes(obj.bitStringContents); - } else if(obj.composed) { - // if composed, use each child asn1 object's DER bytes as value - // turn on 6th bit (0x20 = 32) to indicate asn1 is constructed - // from other asn1 objects - if(obj.constructed) { - b1 |= 0x20; - } else { - // type is a bit string, add unused bits of 0x00 - value.putByte(0x00); - } - - // add all of the child DER bytes together - for(var i = 0; i < obj.value.length; ++i) { - if(obj.value[i] !== undefined) { - value.putBuffer(asn1.toDer(obj.value[i])); - } - } - } else { - // use asn1.value directly - if(obj.type === asn1.Type.BMPSTRING) { - for(var i = 0; i < obj.value.length; ++i) { - value.putInt16(obj.value.charCodeAt(i)); - } - } else { - // ensure integer is minimally-encoded - // TODO: should all leading bytes be stripped vs just one? - // .. ex '00 00 01' => '01'? - if(obj.type === asn1.Type.INTEGER && - obj.value.length > 1 && - // leading 0x00 for positive integer - ((obj.value.charCodeAt(0) === 0 && - (obj.value.charCodeAt(1) & 0x80) === 0) || - // leading 0xFF for negative integer - (obj.value.charCodeAt(0) === 0xFF && - (obj.value.charCodeAt(1) & 0x80) === 0x80))) { - value.putBytes(obj.value.substr(1)); - } else { - value.putBytes(obj.value); - } - } - } - - // add tag byte - bytes.putByte(b1); - - // use "short form" encoding - if(value.length() <= 127) { - // one byte describes the length - // bit 8 = 0 and bits 7-1 = length - bytes.putByte(value.length() & 0x7F); - } else { - // use "long form" encoding - // 2 to 127 bytes describe the length - // first byte: bit 8 = 1 and bits 7-1 = # of additional bytes - // other bytes: length in base 256, big-endian - var len = value.length(); - var lenBytes = ''; - do { - lenBytes += String.fromCharCode(len & 0xFF); - len = len >>> 8; - } while(len > 0); - - // set first byte to # bytes used to store the length and turn on - // bit 8 to indicate long-form length is used - bytes.putByte(lenBytes.length | 0x80); - - // concatenate length bytes in reverse since they were generated - // little endian and we need big endian - for(var i = lenBytes.length - 1; i >= 0; --i) { - bytes.putByte(lenBytes.charCodeAt(i)); - } - } - - // concatenate value bytes - bytes.putBuffer(value); - return bytes; -}; - -/** - * Converts an OID dot-separated string to a byte buffer. The byte buffer - * contains only the DER-encoded value, not any tag or length bytes. - * - * @param oid the OID dot-separated string. - * - * @return the byte buffer. - */ -asn1.oidToDer = function(oid) { - // split OID into individual values - var values = oid.split('.'); - var bytes = forge.util.createBuffer(); - - // first byte is 40 * value1 + value2 - bytes.putByte(40 * parseInt(values[0], 10) + parseInt(values[1], 10)); - // other bytes are each value in base 128 with 8th bit set except for - // the last byte for each value - var last, valueBytes, value, b; - for(var i = 2; i < values.length; ++i) { - // produce value bytes in reverse because we don't know how many - // bytes it will take to store the value - last = true; - valueBytes = []; - value = parseInt(values[i], 10); - do { - b = value & 0x7F; - value = value >>> 7; - // if value is not last, then turn on 8th bit - if(!last) { - b |= 0x80; - } - valueBytes.push(b); - last = false; - } while(value > 0); - - // add value bytes in reverse (needs to be in big endian) - for(var n = valueBytes.length - 1; n >= 0; --n) { - bytes.putByte(valueBytes[n]); - } - } - - return bytes; -}; - -/** - * Converts a DER-encoded byte buffer to an OID dot-separated string. The - * byte buffer should contain only the DER-encoded value, not any tag or - * length bytes. - * - * @param bytes the byte buffer. - * - * @return the OID dot-separated string. - */ -asn1.derToOid = function(bytes) { - var oid; - - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - // first byte is 40 * value1 + value2 - var b = bytes.getByte(); - oid = Math.floor(b / 40) + '.' + (b % 40); - - // other bytes are each value in base 128 with 8th bit set except for - // the last byte for each value - var value = 0; - while(bytes.length() > 0) { - b = bytes.getByte(); - value = value << 7; - // not the last byte for the value - if(b & 0x80) { - value += b & 0x7F; - } else { - // last byte - oid += '.' + (value + b); - value = 0; - } - } - - return oid; -}; - -/** - * Converts a UTCTime value to a date. - * - * Note: GeneralizedTime has 4 digits for the year and is used for X.509 - * dates past 2049. Parsing that structure hasn't been implemented yet. - * - * @param utc the UTCTime value to convert. - * - * @return the date. - */ -asn1.utcTimeToDate = function(utc) { - /* The following formats can be used: - - YYMMDDhhmmZ - YYMMDDhhmm+hh'mm' - YYMMDDhhmm-hh'mm' - YYMMDDhhmmssZ - YYMMDDhhmmss+hh'mm' - YYMMDDhhmmss-hh'mm' - - Where: - - YY is the least significant two digits of the year - MM is the month (01 to 12) - DD is the day (01 to 31) - hh is the hour (00 to 23) - mm are the minutes (00 to 59) - ss are the seconds (00 to 59) - Z indicates that local time is GMT, + indicates that local time is - later than GMT, and - indicates that local time is earlier than GMT - hh' is the absolute value of the offset from GMT in hours - mm' is the absolute value of the offset from GMT in minutes */ - var date = new Date(); - - // if YY >= 50 use 19xx, if YY < 50 use 20xx - var year = parseInt(utc.substr(0, 2), 10); - year = (year >= 50) ? 1900 + year : 2000 + year; - var MM = parseInt(utc.substr(2, 2), 10) - 1; // use 0-11 for month - var DD = parseInt(utc.substr(4, 2), 10); - var hh = parseInt(utc.substr(6, 2), 10); - var mm = parseInt(utc.substr(8, 2), 10); - var ss = 0; - - // not just YYMMDDhhmmZ - if(utc.length > 11) { - // get character after minutes - var c = utc.charAt(10); - var end = 10; - - // see if seconds are present - if(c !== '+' && c !== '-') { - // get seconds - ss = parseInt(utc.substr(10, 2), 10); - end += 2; - } - } - - // update date - date.setUTCFullYear(year, MM, DD); - date.setUTCHours(hh, mm, ss, 0); - - if(end) { - // get +/- after end of time - c = utc.charAt(end); - if(c === '+' || c === '-') { - // get hours+minutes offset - var hhoffset = parseInt(utc.substr(end + 1, 2), 10); - var mmoffset = parseInt(utc.substr(end + 4, 2), 10); - - // calculate offset in milliseconds - var offset = hhoffset * 60 + mmoffset; - offset *= 60000; - - // apply offset - if(c === '+') { - date.setTime(+date - offset); - } else { - date.setTime(+date + offset); - } - } - } - - return date; -}; - -/** - * Converts a GeneralizedTime value to a date. - * - * @param gentime the GeneralizedTime value to convert. - * - * @return the date. - */ -asn1.generalizedTimeToDate = function(gentime) { - /* The following formats can be used: - - YYYYMMDDHHMMSS - YYYYMMDDHHMMSS.fff - YYYYMMDDHHMMSSZ - YYYYMMDDHHMMSS.fffZ - YYYYMMDDHHMMSS+hh'mm' - YYYYMMDDHHMMSS.fff+hh'mm' - YYYYMMDDHHMMSS-hh'mm' - YYYYMMDDHHMMSS.fff-hh'mm' - - Where: - - YYYY is the year - MM is the month (01 to 12) - DD is the day (01 to 31) - hh is the hour (00 to 23) - mm are the minutes (00 to 59) - ss are the seconds (00 to 59) - .fff is the second fraction, accurate to three decimal places - Z indicates that local time is GMT, + indicates that local time is - later than GMT, and - indicates that local time is earlier than GMT - hh' is the absolute value of the offset from GMT in hours - mm' is the absolute value of the offset from GMT in minutes */ - var date = new Date(); - - var YYYY = parseInt(gentime.substr(0, 4), 10); - var MM = parseInt(gentime.substr(4, 2), 10) - 1; // use 0-11 for month - var DD = parseInt(gentime.substr(6, 2), 10); - var hh = parseInt(gentime.substr(8, 2), 10); - var mm = parseInt(gentime.substr(10, 2), 10); - var ss = parseInt(gentime.substr(12, 2), 10); - var fff = 0; - var offset = 0; - var isUTC = false; - - if(gentime.charAt(gentime.length - 1) === 'Z') { - isUTC = true; - } - - var end = gentime.length - 5, c = gentime.charAt(end); - if(c === '+' || c === '-') { - // get hours+minutes offset - var hhoffset = parseInt(gentime.substr(end + 1, 2), 10); - var mmoffset = parseInt(gentime.substr(end + 4, 2), 10); - - // calculate offset in milliseconds - offset = hhoffset * 60 + mmoffset; - offset *= 60000; - - // apply offset - if(c === '+') { - offset *= -1; - } - - isUTC = true; - } - - // check for second fraction - if(gentime.charAt(14) === '.') { - fff = parseFloat(gentime.substr(14), 10) * 1000; - } - - if(isUTC) { - date.setUTCFullYear(YYYY, MM, DD); - date.setUTCHours(hh, mm, ss, fff); - - // apply offset - date.setTime(+date + offset); - } else { - date.setFullYear(YYYY, MM, DD); - date.setHours(hh, mm, ss, fff); - } - - return date; -}; - -/** - * Converts a date to a UTCTime value. - * - * Note: GeneralizedTime has 4 digits for the year and is used for X.509 - * dates past 2049. Converting to a GeneralizedTime hasn't been - * implemented yet. - * - * @param date the date to convert. - * - * @return the UTCTime value. - */ -asn1.dateToUtcTime = function(date) { - // TODO: validate; currently assumes proper format - if(typeof date === 'string') { - return date; - } - - var rval = ''; - - // create format YYMMDDhhmmssZ - var format = []; - format.push(('' + date.getUTCFullYear()).substr(2)); - format.push('' + (date.getUTCMonth() + 1)); - format.push('' + date.getUTCDate()); - format.push('' + date.getUTCHours()); - format.push('' + date.getUTCMinutes()); - format.push('' + date.getUTCSeconds()); - - // ensure 2 digits are used for each format entry - for(var i = 0; i < format.length; ++i) { - if(format[i].length < 2) { - rval += '0'; - } - rval += format[i]; - } - rval += 'Z'; - - return rval; -}; - -/** - * Converts a date to a GeneralizedTime value. - * - * @param date the date to convert. - * - * @return the GeneralizedTime value as a string. - */ -asn1.dateToGeneralizedTime = function(date) { - // TODO: validate; currently assumes proper format - if(typeof date === 'string') { - return date; - } - - var rval = ''; - - // create format YYYYMMDDHHMMSSZ - var format = []; - format.push('' + date.getUTCFullYear()); - format.push('' + (date.getUTCMonth() + 1)); - format.push('' + date.getUTCDate()); - format.push('' + date.getUTCHours()); - format.push('' + date.getUTCMinutes()); - format.push('' + date.getUTCSeconds()); - - // ensure 2 digits are used for each format entry - for(var i = 0; i < format.length; ++i) { - if(format[i].length < 2) { - rval += '0'; - } - rval += format[i]; - } - rval += 'Z'; - - return rval; -}; - -/** - * Converts a javascript integer to a DER-encoded byte buffer to be used - * as the value for an INTEGER type. - * - * @param x the integer. - * - * @return the byte buffer. - */ -asn1.integerToDer = function(x) { - var rval = forge.util.createBuffer(); - if(x >= -0x80 && x < 0x80) { - return rval.putSignedInt(x, 8); - } - if(x >= -0x8000 && x < 0x8000) { - return rval.putSignedInt(x, 16); - } - if(x >= -0x800000 && x < 0x800000) { - return rval.putSignedInt(x, 24); - } - if(x >= -0x80000000 && x < 0x80000000) { - return rval.putSignedInt(x, 32); - } - var error = new Error('Integer too large; max is 32-bits.'); - error.integer = x; - throw error; -}; - -/** - * Converts a DER-encoded byte buffer to a javascript integer. This is - * typically used to decode the value of an INTEGER type. - * - * @param bytes the byte buffer. - * - * @return the integer. - */ -asn1.derToInteger = function(bytes) { - // wrap in buffer if needed - if(typeof bytes === 'string') { - bytes = forge.util.createBuffer(bytes); - } - - var n = bytes.length() * 8; - if(n > 32) { - throw new Error('Integer too large; max is 32-bits.'); - } - return bytes.getSignedInt(n); -}; - -/** - * Validates that the given ASN.1 object is at least a super set of the - * given ASN.1 structure. Only tag classes and types are checked. An - * optional map may also be provided to capture ASN.1 values while the - * structure is checked. - * - * To capture an ASN.1 value, set an object in the validator's 'capture' - * parameter to the key to use in the capture map. To capture the full - * ASN.1 object, specify 'captureAsn1'. To capture BIT STRING bytes, including - * the leading unused bits counter byte, specify 'captureBitStringContents'. - * To capture BIT STRING bytes, without the leading unused bits counter byte, - * specify 'captureBitStringValue'. - * - * Objects in the validator may set a field 'optional' to true to indicate - * that it isn't necessary to pass validation. - * - * @param obj the ASN.1 object to validate. - * @param v the ASN.1 structure validator. - * @param capture an optional map to capture values in. - * @param errors an optional array for storing validation errors. - * - * @return true on success, false on failure. - */ -asn1.validate = function(obj, v, capture, errors) { - var rval = false; - - // ensure tag class and type are the same if specified - if((obj.tagClass === v.tagClass || typeof(v.tagClass) === 'undefined') && - (obj.type === v.type || typeof(v.type) === 'undefined')) { - // ensure constructed flag is the same if specified - if(obj.constructed === v.constructed || - typeof(v.constructed) === 'undefined') { - rval = true; - - // handle sub values - if(v.value && forge.util.isArray(v.value)) { - var j = 0; - for(var i = 0; rval && i < v.value.length; ++i) { - rval = v.value[i].optional || false; - if(obj.value[j]) { - rval = asn1.validate(obj.value[j], v.value[i], capture, errors); - if(rval) { - ++j; - } else if(v.value[i].optional) { - rval = true; - } - } - if(!rval && errors) { - errors.push( - '[' + v.name + '] ' + - 'Tag class "' + v.tagClass + '", type "' + - v.type + '" expected value length "' + - v.value.length + '", got "' + - obj.value.length + '"'); - } - } - } - - if(rval && capture) { - if(v.capture) { - capture[v.capture] = obj.value; - } - if(v.captureAsn1) { - capture[v.captureAsn1] = obj; - } - if(v.captureBitStringContents && 'bitStringContents' in obj) { - capture[v.captureBitStringContents] = obj.bitStringContents; - } - if(v.captureBitStringValue && 'bitStringContents' in obj) { - var value; - if(obj.bitStringContents.length < 2) { - capture[v.captureBitStringValue] = ''; - } else { - // FIXME: support unused bits with data shifting - var unused = obj.bitStringContents.charCodeAt(0); - if(unused !== 0) { - throw new Error( - 'captureBitStringValue only supported for zero unused bits'); - } - capture[v.captureBitStringValue] = obj.bitStringContents.slice(1); - } - } - } - } else if(errors) { - errors.push( - '[' + v.name + '] ' + - 'Expected constructed "' + v.constructed + '", got "' + - obj.constructed + '"'); - } - } else if(errors) { - if(obj.tagClass !== v.tagClass) { - errors.push( - '[' + v.name + '] ' + - 'Expected tag class "' + v.tagClass + '", got "' + - obj.tagClass + '"'); - } - if(obj.type !== v.type) { - errors.push( - '[' + v.name + '] ' + - 'Expected type "' + v.type + '", got "' + obj.type + '"'); - } - } - return rval; -}; - -// regex for testing for non-latin characters -var _nonLatinRegex = /[^\\u0000-\\u00ff]/; - -/** - * Pretty prints an ASN.1 object to a string. - * - * @param obj the object to write out. - * @param level the level in the tree. - * @param indentation the indentation to use. - * - * @return the string. - */ -asn1.prettyPrint = function(obj, level, indentation) { - var rval = ''; - - // set default level and indentation - level = level || 0; - indentation = indentation || 2; - - // start new line for deep levels - if(level > 0) { - rval += '\n'; - } - - // create indent - var indent = ''; - for(var i = 0; i < level * indentation; ++i) { - indent += ' '; - } - - // print class:type - rval += indent + 'Tag: '; - switch(obj.tagClass) { - case asn1.Class.UNIVERSAL: - rval += 'Universal:'; - break; - case asn1.Class.APPLICATION: - rval += 'Application:'; - break; - case asn1.Class.CONTEXT_SPECIFIC: - rval += 'Context-Specific:'; - break; - case asn1.Class.PRIVATE: - rval += 'Private:'; - break; - } - - if(obj.tagClass === asn1.Class.UNIVERSAL) { - rval += obj.type; - - // known types - switch(obj.type) { - case asn1.Type.NONE: - rval += ' (None)'; - break; - case asn1.Type.BOOLEAN: - rval += ' (Boolean)'; - break; - case asn1.Type.INTEGER: - rval += ' (Integer)'; - break; - case asn1.Type.BITSTRING: - rval += ' (Bit string)'; - break; - case asn1.Type.OCTETSTRING: - rval += ' (Octet string)'; - break; - case asn1.Type.NULL: - rval += ' (Null)'; - break; - case asn1.Type.OID: - rval += ' (Object Identifier)'; - break; - case asn1.Type.ODESC: - rval += ' (Object Descriptor)'; - break; - case asn1.Type.EXTERNAL: - rval += ' (External or Instance of)'; - break; - case asn1.Type.REAL: - rval += ' (Real)'; - break; - case asn1.Type.ENUMERATED: - rval += ' (Enumerated)'; - break; - case asn1.Type.EMBEDDED: - rval += ' (Embedded PDV)'; - break; - case asn1.Type.UTF8: - rval += ' (UTF8)'; - break; - case asn1.Type.ROID: - rval += ' (Relative Object Identifier)'; - break; - case asn1.Type.SEQUENCE: - rval += ' (Sequence)'; - break; - case asn1.Type.SET: - rval += ' (Set)'; - break; - case asn1.Type.PRINTABLESTRING: - rval += ' (Printable String)'; - break; - case asn1.Type.IA5String: - rval += ' (IA5String (ASCII))'; - break; - case asn1.Type.UTCTIME: - rval += ' (UTC time)'; - break; - case asn1.Type.GENERALIZEDTIME: - rval += ' (Generalized time)'; - break; - case asn1.Type.BMPSTRING: - rval += ' (BMP String)'; - break; - } - } else { - rval += obj.type; - } - - rval += '\n'; - rval += indent + 'Constructed: ' + obj.constructed + '\n'; - - if(obj.composed) { - var subvalues = 0; - var sub = ''; - for(var i = 0; i < obj.value.length; ++i) { - if(obj.value[i] !== undefined) { - subvalues += 1; - sub += asn1.prettyPrint(obj.value[i], level + 1, indentation); - if((i + 1) < obj.value.length) { - sub += ','; - } - } - } - rval += indent + 'Sub values: ' + subvalues + sub; - } else { - rval += indent + 'Value: '; - if(obj.type === asn1.Type.OID) { - var oid = asn1.derToOid(obj.value); - rval += oid; - if(forge.pki && forge.pki.oids) { - if(oid in forge.pki.oids) { - rval += ' (' + forge.pki.oids[oid] + ') '; - } - } - } - if(obj.type === asn1.Type.INTEGER) { - try { - rval += asn1.derToInteger(obj.value); - } catch(ex) { - rval += '0x' + forge.util.bytesToHex(obj.value); - } - } else if(obj.type === asn1.Type.BITSTRING) { - // TODO: shift bits as needed to display without padding - if(obj.value.length > 1) { - // remove unused bits field - rval += '0x' + forge.util.bytesToHex(obj.value.slice(1)); - } else { - rval += '(none)'; - } - // show unused bit count - if(obj.value.length > 0) { - var unused = obj.value.charCodeAt(0); - if(unused == 1) { - rval += ' (1 unused bit shown)'; - } else if(unused > 1) { - rval += ' (' + unused + ' unused bits shown)'; - } - } - } else if(obj.type === asn1.Type.OCTETSTRING) { - if(!_nonLatinRegex.test(obj.value)) { - rval += '(' + obj.value + ') '; - } - rval += '0x' + forge.util.bytesToHex(obj.value); - } else if(obj.type === asn1.Type.UTF8) { - rval += forge.util.decodeUtf8(obj.value); - } else if(obj.type === asn1.Type.PRINTABLESTRING || - obj.type === asn1.Type.IA5String) { - rval += obj.value; - } else if(_nonLatinRegex.test(obj.value)) { - rval += '0x' + forge.util.bytesToHex(obj.value); - } else if(obj.value.length === 0) { - rval += '[null]'; - } else { - rval += obj.value; - } - } - - return rval; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/baseN.js b/reverse_engineering/node_modules/node-forge/lib/baseN.js deleted file mode 100644 index 824fa36d..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/baseN.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Base-N/Base-X encoding/decoding functions. - * - * Original implementation from base-x: - * https://github.com/cryptocoinjs/base-x - * - * Which is MIT licensed: - * - * The MIT License (MIT) - * - * Copyright base-x contributors (c) 2016 - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -var api = {}; -module.exports = api; - -// baseN alphabet indexes -var _reverseAlphabets = {}; - -/** - * BaseN-encodes a Uint8Array using the given alphabet. - * - * @param input the Uint8Array to encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the baseN-encoded output string. - */ -api.encode = function(input, alphabet, maxline) { - if(typeof alphabet !== 'string') { - throw new TypeError('"alphabet" must be a string.'); - } - if(maxline !== undefined && typeof maxline !== 'number') { - throw new TypeError('"maxline" must be a number.'); - } - - var output = ''; - - if(!(input instanceof Uint8Array)) { - // assume forge byte buffer - output = _encodeWithByteBuffer(input, alphabet); - } else { - var i = 0; - var base = alphabet.length; - var first = alphabet.charAt(0); - var digits = [0]; - for(i = 0; i < input.length; ++i) { - for(var j = 0, carry = input[i]; j < digits.length; ++j) { - carry += digits[j] << 8; - digits[j] = carry % base; - carry = (carry / base) | 0; - } - - while(carry > 0) { - digits.push(carry % base); - carry = (carry / base) | 0; - } - } - - // deal with leading zeros - for(i = 0; input[i] === 0 && i < input.length - 1; ++i) { - output += first; - } - // convert digits to a string - for(i = digits.length - 1; i >= 0; --i) { - output += alphabet[digits[i]]; - } - } - - if(maxline) { - var regex = new RegExp('.{1,' + maxline + '}', 'g'); - output = output.match(regex).join('\r\n'); - } - - return output; -}; - -/** - * Decodes a baseN-encoded (using the given alphabet) string to a - * Uint8Array. - * - * @param input the baseN-encoded input string. - * - * @return the Uint8Array. - */ -api.decode = function(input, alphabet) { - if(typeof input !== 'string') { - throw new TypeError('"input" must be a string.'); - } - if(typeof alphabet !== 'string') { - throw new TypeError('"alphabet" must be a string.'); - } - - var table = _reverseAlphabets[alphabet]; - if(!table) { - // compute reverse alphabet - table = _reverseAlphabets[alphabet] = []; - for(var i = 0; i < alphabet.length; ++i) { - table[alphabet.charCodeAt(i)] = i; - } - } - - // remove whitespace characters - input = input.replace(/\s/g, ''); - - var base = alphabet.length; - var first = alphabet.charAt(0); - var bytes = [0]; - for(var i = 0; i < input.length; i++) { - var value = table[input.charCodeAt(i)]; - if(value === undefined) { - return; - } - - for(var j = 0, carry = value; j < bytes.length; ++j) { - carry += bytes[j] * base; - bytes[j] = carry & 0xff; - carry >>= 8; - } - - while(carry > 0) { - bytes.push(carry & 0xff); - carry >>= 8; - } - } - - // deal with leading zeros - for(var k = 0; input[k] === first && k < input.length - 1; ++k) { - bytes.push(0); - } - - if(typeof Buffer !== 'undefined') { - return Buffer.from(bytes.reverse()); - } - - return new Uint8Array(bytes.reverse()); -}; - -function _encodeWithByteBuffer(input, alphabet) { - var i = 0; - var base = alphabet.length; - var first = alphabet.charAt(0); - var digits = [0]; - for(i = 0; i < input.length(); ++i) { - for(var j = 0, carry = input.at(i); j < digits.length; ++j) { - carry += digits[j] << 8; - digits[j] = carry % base; - carry = (carry / base) | 0; - } - - while(carry > 0) { - digits.push(carry % base); - carry = (carry / base) | 0; - } - } - - var output = ''; - - // deal with leading zeros - for(i = 0; input.at(i) === 0 && i < input.length() - 1; ++i) { - output += first; - } - // convert digits to a string - for(i = digits.length - 1; i >= 0; --i) { - output += alphabet[digits[i]]; - } - - return output; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/cipher.js b/reverse_engineering/node_modules/node-forge/lib/cipher.js deleted file mode 100644 index f2c36e65..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/cipher.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Cipher base API. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -module.exports = forge.cipher = forge.cipher || {}; - -// registered algorithms -forge.cipher.algorithms = forge.cipher.algorithms || {}; - -/** - * Creates a cipher object that can be used to encrypt data using the given - * algorithm and key. The algorithm may be provided as a string value for a - * previously registered algorithm or it may be given as a cipher algorithm - * API object. - * - * @param algorithm the algorithm to use, either a string or an algorithm API - * object. - * @param key the key to use, as a binary-encoded string of bytes or a - * byte buffer. - * - * @return the cipher. - */ -forge.cipher.createCipher = function(algorithm, key) { - var api = algorithm; - if(typeof api === 'string') { - api = forge.cipher.getAlgorithm(api); - if(api) { - api = api(); - } - } - if(!api) { - throw new Error('Unsupported algorithm: ' + algorithm); - } - - // assume block cipher - return new forge.cipher.BlockCipher({ - algorithm: api, - key: key, - decrypt: false - }); -}; - -/** - * Creates a decipher object that can be used to decrypt data using the given - * algorithm and key. The algorithm may be provided as a string value for a - * previously registered algorithm or it may be given as a cipher algorithm - * API object. - * - * @param algorithm the algorithm to use, either a string or an algorithm API - * object. - * @param key the key to use, as a binary-encoded string of bytes or a - * byte buffer. - * - * @return the cipher. - */ -forge.cipher.createDecipher = function(algorithm, key) { - var api = algorithm; - if(typeof api === 'string') { - api = forge.cipher.getAlgorithm(api); - if(api) { - api = api(); - } - } - if(!api) { - throw new Error('Unsupported algorithm: ' + algorithm); - } - - // assume block cipher - return new forge.cipher.BlockCipher({ - algorithm: api, - key: key, - decrypt: true - }); -}; - -/** - * Registers an algorithm by name. If the name was already registered, the - * algorithm API object will be overwritten. - * - * @param name the name of the algorithm. - * @param algorithm the algorithm API object. - */ -forge.cipher.registerAlgorithm = function(name, algorithm) { - name = name.toUpperCase(); - forge.cipher.algorithms[name] = algorithm; -}; - -/** - * Gets a registered algorithm by name. - * - * @param name the name of the algorithm. - * - * @return the algorithm, if found, null if not. - */ -forge.cipher.getAlgorithm = function(name) { - name = name.toUpperCase(); - if(name in forge.cipher.algorithms) { - return forge.cipher.algorithms[name]; - } - return null; -}; - -var BlockCipher = forge.cipher.BlockCipher = function(options) { - this.algorithm = options.algorithm; - this.mode = this.algorithm.mode; - this.blockSize = this.mode.blockSize; - this._finish = false; - this._input = null; - this.output = null; - this._op = options.decrypt ? this.mode.decrypt : this.mode.encrypt; - this._decrypt = options.decrypt; - this.algorithm.initialize(options); -}; - -/** - * Starts or restarts the encryption or decryption process, whichever - * was previously configured. - * - * For non-GCM mode, the IV may be a binary-encoded string of bytes, an array - * of bytes, a byte buffer, or an array of 32-bit integers. If the IV is in - * bytes, then it must be Nb (16) bytes in length. If the IV is given in as - * 32-bit integers, then it must be 4 integers long. - * - * Note: an IV is not required or used in ECB mode. - * - * For GCM-mode, the IV must be given as a binary-encoded string of bytes or - * a byte buffer. The number of bytes should be 12 (96 bits) as recommended - * by NIST SP-800-38D but another length may be given. - * - * @param options the options to use: - * iv the initialization vector to use as a binary-encoded string of - * bytes, null to reuse the last ciphered block from a previous - * update() (this "residue" method is for legacy support only). - * additionalData additional authentication data as a binary-encoded - * string of bytes, for 'GCM' mode, (default: none). - * tagLength desired length of authentication tag, in bits, for - * 'GCM' mode (0-128, default: 128). - * tag the authentication tag to check if decrypting, as a - * binary-encoded string of bytes. - * output the output the buffer to write to, null to create one. - */ -BlockCipher.prototype.start = function(options) { - options = options || {}; - var opts = {}; - for(var key in options) { - opts[key] = options[key]; - } - opts.decrypt = this._decrypt; - this._finish = false; - this._input = forge.util.createBuffer(); - this.output = options.output || forge.util.createBuffer(); - this.mode.start(opts); -}; - -/** - * Updates the next block according to the cipher mode. - * - * @param input the buffer to read from. - */ -BlockCipher.prototype.update = function(input) { - if(input) { - // input given, so empty it into the input buffer - this._input.putBuffer(input); - } - - // do cipher operation until it needs more input and not finished - while(!this._op.call(this.mode, this._input, this.output, this._finish) && - !this._finish) {} - - // free consumed memory from input buffer - this._input.compact(); -}; - -/** - * Finishes encrypting or decrypting. - * - * @param pad a padding function to use in CBC mode, null for default, - * signature(blockSize, buffer, decrypt). - * - * @return true if successful, false on error. - */ -BlockCipher.prototype.finish = function(pad) { - // backwards-compatibility w/deprecated padding API - // Note: will overwrite padding functions even after another start() call - if(pad && (this.mode.name === 'ECB' || this.mode.name === 'CBC')) { - this.mode.pad = function(input) { - return pad(this.blockSize, input, false); - }; - this.mode.unpad = function(output) { - return pad(this.blockSize, output, true); - }; - } - - // build options for padding and afterFinish functions - var options = {}; - options.decrypt = this._decrypt; - - // get # of bytes that won't fill a block - options.overflow = this._input.length() % this.blockSize; - - if(!this._decrypt && this.mode.pad) { - if(!this.mode.pad(this._input, options)) { - return false; - } - } - - // do final update - this._finish = true; - this.update(); - - if(this._decrypt && this.mode.unpad) { - if(!this.mode.unpad(this.output, options)) { - return false; - } - } - - if(this.mode.afterFinish) { - if(!this.mode.afterFinish(this.output, options)) { - return false; - } - } - - return true; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/cipherModes.js b/reverse_engineering/node_modules/node-forge/lib/cipherModes.js deleted file mode 100644 index 339915cc..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/cipherModes.js +++ /dev/null @@ -1,999 +0,0 @@ -/** - * Supported cipher modes. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -forge.cipher = forge.cipher || {}; - -// supported cipher modes -var modes = module.exports = forge.cipher.modes = forge.cipher.modes || {}; - -/** Electronic codebook (ECB) (Don't use this; it's not secure) **/ - -modes.ecb = function(options) { - options = options || {}; - this.name = 'ECB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); -}; - -modes.ecb.prototype.start = function(options) {}; - -modes.ecb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // write output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } -}; - -modes.ecb.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // decrypt block - this.cipher.decrypt(this._inBlock, this._outBlock); - - // write output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } -}; - -modes.ecb.prototype.pad = function(input, options) { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (input.length() === this.blockSize ? - this.blockSize : (this.blockSize - input.length())); - input.fillWithByte(padding, padding); - return true; -}; - -modes.ecb.prototype.unpad = function(output, options) { - // check for error: input data not a multiple of blockSize - if(options.overflow > 0) { - return false; - } - - // ensure padding byte count is valid - var len = output.length(); - var count = output.at(len - 1); - if(count > (this.blockSize << 2)) { - return false; - } - - // trim off padding bytes - output.truncate(count); - return true; -}; - -/** Cipher-block Chaining (CBC) **/ - -modes.cbc = function(options) { - options = options || {}; - this.name = 'CBC'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); -}; - -modes.cbc.prototype.start = function(options) { - // Note: legacy support for using IV residue (has security flaws) - // if IV is null, reuse block from previous processing - if(options.iv === null) { - // must have a previous block - if(!this._prev) { - throw new Error('Invalid IV parameter.'); - } - this._iv = this._prev.slice(0); - } else if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } else { - // save IV as "previous" block - this._iv = transformIV(options.iv, this.blockSize); - this._prev = this._iv.slice(0); - } -}; - -modes.cbc.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - // CBC XOR's IV (or previous block) with plaintext - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._prev[i] ^ input.getInt32(); - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // write output, save previous block - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i]); - } - this._prev = this._outBlock; -}; - -modes.cbc.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - if(input.length() < this.blockSize && !(finish && input.length() > 0)) { - return true; - } - - // get next block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - } - - // decrypt block - this.cipher.decrypt(this._inBlock, this._outBlock); - - // write output, save previous ciphered block - // CBC XOR's IV (or previous block) with ciphertext - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._prev[i] ^ this._outBlock[i]); - } - this._prev = this._inBlock.slice(0); -}; - -modes.cbc.prototype.pad = function(input, options) { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (input.length() === this.blockSize ? - this.blockSize : (this.blockSize - input.length())); - input.fillWithByte(padding, padding); - return true; -}; - -modes.cbc.prototype.unpad = function(output, options) { - // check for error: input data not a multiple of blockSize - if(options.overflow > 0) { - return false; - } - - // ensure padding byte count is valid - var len = output.length(); - var count = output.at(len - 1); - if(count > (this.blockSize << 2)) { - return false; - } - - // trim off padding bytes - output.truncate(count); - return true; -}; - -/** Cipher feedback (CFB) **/ - -modes.cfb = function(options) { - options = options || {}; - this.name = 'CFB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.cfb.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.cfb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output, write input as output - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32() ^ this._outBlock[i]; - output.putInt32(this._inBlock[i]); - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output, write input as partial output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialBlock[i] = input.getInt32() ^ this._outBlock[i]; - this._partialOutput.putInt32(this._partialBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._partialBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -modes.cfb.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block (CFB always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output, write input as output - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = input.getInt32(); - output.putInt32(this._inBlock[i] ^ this._outBlock[i]); - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output, write input as partial output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialBlock[i] = input.getInt32(); - this._partialOutput.putInt32(this._partialBlock[i] ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._partialBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -/** Output feedback (OFB) **/ - -modes.ofb = function(options) { - options = options || {}; - this.name = 'OFB'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.ofb.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.ofb.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(input.length() === 0) { - return true; - } - - // encrypt block (OFB always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output and update next input - for(var i = 0; i < this._ints; ++i) { - output.putInt32(input.getInt32() ^ this._outBlock[i]); - this._inBlock[i] = this._outBlock[i]; - } - return; - } - - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } else { - // block complete, update input block - for(var i = 0; i < this._ints; ++i) { - this._inBlock[i] = this._outBlock[i]; - } - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; -}; - -modes.ofb.prototype.decrypt = modes.ofb.prototype.encrypt; - -/** Counter (CTR) **/ - -modes.ctr = function(options) { - options = options || {}; - this.name = 'CTR'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = null; - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; -}; - -modes.ctr.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // use IV as first input - this._iv = transformIV(options.iv, this.blockSize); - this._inBlock = this._iv.slice(0); - this._partialBytes = 0; -}; - -modes.ctr.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block (CTR always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(input.getInt32() ^ this._outBlock[i]); - } - } else { - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes > 0) { - // block still incomplete, restore input buffer - input.read -= this.blockSize; - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; - } - - // block complete, increment counter (input block) - inc32(this._inBlock); -}; - -modes.ctr.prototype.decrypt = modes.ctr.prototype.encrypt; - -/** Galois/Counter Mode (GCM) **/ - -modes.gcm = function(options) { - options = options || {}; - this.name = 'GCM'; - this.cipher = options.cipher; - this.blockSize = options.blockSize || 16; - this._ints = this.blockSize / 4; - this._inBlock = new Array(this._ints); - this._outBlock = new Array(this._ints); - this._partialOutput = forge.util.createBuffer(); - this._partialBytes = 0; - - // R is actually this value concatenated with 120 more zero bits, but - // we only XOR against R so the other zeros have no effect -- we just - // apply this value to the first integer in a block - this._R = 0xE1000000; -}; - -modes.gcm.prototype.start = function(options) { - if(!('iv' in options)) { - throw new Error('Invalid IV parameter.'); - } - // ensure IV is a byte buffer - var iv = forge.util.createBuffer(options.iv); - - // no ciphered data processed yet - this._cipherLength = 0; - - // default additional data is none - var additionalData; - if('additionalData' in options) { - additionalData = forge.util.createBuffer(options.additionalData); - } else { - additionalData = forge.util.createBuffer(); - } - - // default tag length is 128 bits - if('tagLength' in options) { - this._tagLength = options.tagLength; - } else { - this._tagLength = 128; - } - - // if tag is given, ensure tag matches tag length - this._tag = null; - if(options.decrypt) { - // save tag to check later - this._tag = forge.util.createBuffer(options.tag).getBytes(); - if(this._tag.length !== (this._tagLength / 8)) { - throw new Error('Authentication tag does not match tag length.'); - } - } - - // create tmp storage for hash calculation - this._hashBlock = new Array(this._ints); - - // no tag generated yet - this.tag = null; - - // generate hash subkey - // (apply block cipher to "zero" block) - this._hashSubkey = new Array(this._ints); - this.cipher.encrypt([0, 0, 0, 0], this._hashSubkey); - - // generate table M - // use 4-bit tables (32 component decomposition of a 16 byte value) - // 8-bit tables take more space and are known to have security - // vulnerabilities (in native implementations) - this.componentBits = 4; - this._m = this.generateHashTable(this._hashSubkey, this.componentBits); - - // Note: support IV length different from 96 bits? (only supporting - // 96 bits is recommended by NIST SP-800-38D) - // generate J_0 - var ivLength = iv.length(); - if(ivLength === 12) { - // 96-bit IV - this._j0 = [iv.getInt32(), iv.getInt32(), iv.getInt32(), 1]; - } else { - // IV is NOT 96-bits - this._j0 = [0, 0, 0, 0]; - while(iv.length() > 0) { - this._j0 = this.ghash( - this._hashSubkey, this._j0, - [iv.getInt32(), iv.getInt32(), iv.getInt32(), iv.getInt32()]); - } - this._j0 = this.ghash( - this._hashSubkey, this._j0, [0, 0].concat(from64To32(ivLength * 8))); - } - - // generate ICB (initial counter block) - this._inBlock = this._j0.slice(0); - inc32(this._inBlock); - this._partialBytes = 0; - - // consume authentication data - additionalData = forge.util.createBuffer(additionalData); - // save additional data length as a BE 64-bit number - this._aDataLength = from64To32(additionalData.length() * 8); - // pad additional data to 128 bit (16 byte) block size - var overflow = additionalData.length() % this.blockSize; - if(overflow) { - additionalData.fillWithByte(0, this.blockSize - overflow); - } - this._s = [0, 0, 0, 0]; - while(additionalData.length() > 0) { - this._s = this.ghash(this._hashSubkey, this._s, [ - additionalData.getInt32(), - additionalData.getInt32(), - additionalData.getInt32(), - additionalData.getInt32() - ]); - } -}; - -modes.gcm.prototype.encrypt = function(input, output, finish) { - // not enough input to encrypt - var inputLength = input.length(); - if(inputLength === 0) { - return true; - } - - // encrypt block - this.cipher.encrypt(this._inBlock, this._outBlock); - - // handle full block - if(this._partialBytes === 0 && inputLength >= this.blockSize) { - // XOR input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i] ^= input.getInt32()); - } - this._cipherLength += this.blockSize; - } else { - // handle partial block - var partialBytes = (this.blockSize - inputLength) % this.blockSize; - if(partialBytes > 0) { - partialBytes = this.blockSize - partialBytes; - } - - // XOR input with output - this._partialOutput.clear(); - for(var i = 0; i < this._ints; ++i) { - this._partialOutput.putInt32(input.getInt32() ^ this._outBlock[i]); - } - - if(partialBytes <= 0 || finish) { - // handle overflow prior to hashing - if(finish) { - // get block overflow - var overflow = inputLength % this.blockSize; - this._cipherLength += overflow; - // truncate for hash function - this._partialOutput.truncate(this.blockSize - overflow); - } else { - this._cipherLength += this.blockSize; - } - - // get output block for hashing - for(var i = 0; i < this._ints; ++i) { - this._outBlock[i] = this._partialOutput.getInt32(); - } - this._partialOutput.read -= this.blockSize; - } - - // skip any previous partial bytes - if(this._partialBytes > 0) { - this._partialOutput.getBytes(this._partialBytes); - } - - if(partialBytes > 0 && !finish) { - // block still incomplete, restore input buffer, get partial output, - // and return early - input.read -= this.blockSize; - output.putBytes(this._partialOutput.getBytes( - partialBytes - this._partialBytes)); - this._partialBytes = partialBytes; - return true; - } - - output.putBytes(this._partialOutput.getBytes( - inputLength - this._partialBytes)); - this._partialBytes = 0; - } - - // update hash block S - this._s = this.ghash(this._hashSubkey, this._s, this._outBlock); - - // increment counter (input block) - inc32(this._inBlock); -}; - -modes.gcm.prototype.decrypt = function(input, output, finish) { - // not enough input to decrypt - var inputLength = input.length(); - if(inputLength < this.blockSize && !(finish && inputLength > 0)) { - return true; - } - - // encrypt block (GCM always uses encryption mode) - this.cipher.encrypt(this._inBlock, this._outBlock); - - // increment counter (input block) - inc32(this._inBlock); - - // update hash block S - this._hashBlock[0] = input.getInt32(); - this._hashBlock[1] = input.getInt32(); - this._hashBlock[2] = input.getInt32(); - this._hashBlock[3] = input.getInt32(); - this._s = this.ghash(this._hashSubkey, this._s, this._hashBlock); - - // XOR hash input with output - for(var i = 0; i < this._ints; ++i) { - output.putInt32(this._outBlock[i] ^ this._hashBlock[i]); - } - - // increment cipher data length - if(inputLength < this.blockSize) { - this._cipherLength += inputLength % this.blockSize; - } else { - this._cipherLength += this.blockSize; - } -}; - -modes.gcm.prototype.afterFinish = function(output, options) { - var rval = true; - - // handle overflow - if(options.decrypt && options.overflow) { - output.truncate(this.blockSize - options.overflow); - } - - // handle authentication tag - this.tag = forge.util.createBuffer(); - - // concatenate additional data length with cipher length - var lengths = this._aDataLength.concat(from64To32(this._cipherLength * 8)); - - // include lengths in hash - this._s = this.ghash(this._hashSubkey, this._s, lengths); - - // do GCTR(J_0, S) - var tag = []; - this.cipher.encrypt(this._j0, tag); - for(var i = 0; i < this._ints; ++i) { - this.tag.putInt32(this._s[i] ^ tag[i]); - } - - // trim tag to length - this.tag.truncate(this.tag.length() % (this._tagLength / 8)); - - // check authentication tag - if(options.decrypt && this.tag.bytes() !== this._tag) { - rval = false; - } - - return rval; -}; - -/** - * See NIST SP-800-38D 6.3 (Algorithm 1). This function performs Galois - * field multiplication. The field, GF(2^128), is defined by the polynomial: - * - * x^128 + x^7 + x^2 + x + 1 - * - * Which is represented in little-endian binary form as: 11100001 (0xe1). When - * the value of a coefficient is 1, a bit is set. The value R, is the - * concatenation of this value and 120 zero bits, yielding a 128-bit value - * which matches the block size. - * - * This function will multiply two elements (vectors of bytes), X and Y, in - * the field GF(2^128). The result is initialized to zero. For each bit of - * X (out of 128), x_i, if x_i is set, then the result is multiplied (XOR'd) - * by the current value of Y. For each bit, the value of Y will be raised by - * a power of x (multiplied by the polynomial x). This can be achieved by - * shifting Y once to the right. If the current value of Y, prior to being - * multiplied by x, has 0 as its LSB, then it is a 127th degree polynomial. - * Otherwise, we must divide by R after shifting to find the remainder. - * - * @param x the first block to multiply by the second. - * @param y the second block to multiply by the first. - * - * @return the block result of the multiplication. - */ -modes.gcm.prototype.multiply = function(x, y) { - var z_i = [0, 0, 0, 0]; - var v_i = y.slice(0); - - // calculate Z_128 (block has 128 bits) - for(var i = 0; i < 128; ++i) { - // if x_i is 0, Z_{i+1} = Z_i (unchanged) - // else Z_{i+1} = Z_i ^ V_i - // get x_i by finding 32-bit int position, then left shift 1 by remainder - var x_i = x[(i / 32) | 0] & (1 << (31 - i % 32)); - if(x_i) { - z_i[0] ^= v_i[0]; - z_i[1] ^= v_i[1]; - z_i[2] ^= v_i[2]; - z_i[3] ^= v_i[3]; - } - - // if LSB(V_i) is 1, V_i = V_i >> 1 - // else V_i = (V_i >> 1) ^ R - this.pow(v_i, v_i); - } - - return z_i; -}; - -modes.gcm.prototype.pow = function(x, out) { - // if LSB(x) is 1, x = x >>> 1 - // else x = (x >>> 1) ^ R - var lsb = x[3] & 1; - - // always do x >>> 1: - // starting with the rightmost integer, shift each integer to the right - // one bit, pulling in the bit from the integer to the left as its top - // most bit (do this for the last 3 integers) - for(var i = 3; i > 0; --i) { - out[i] = (x[i] >>> 1) | ((x[i - 1] & 1) << 31); - } - // shift the first integer normally - out[0] = x[0] >>> 1; - - // if lsb was not set, then polynomial had a degree of 127 and doesn't - // need to divided; otherwise, XOR with R to find the remainder; we only - // need to XOR the first integer since R technically ends w/120 zero bits - if(lsb) { - out[0] ^= this._R; - } -}; - -modes.gcm.prototype.tableMultiply = function(x) { - // assumes 4-bit tables are used - var z = [0, 0, 0, 0]; - for(var i = 0; i < 32; ++i) { - var idx = (i / 8) | 0; - var x_i = (x[idx] >>> ((7 - (i % 8)) * 4)) & 0xF; - var ah = this._m[i][x_i]; - z[0] ^= ah[0]; - z[1] ^= ah[1]; - z[2] ^= ah[2]; - z[3] ^= ah[3]; - } - return z; -}; - -/** - * A continuing version of the GHASH algorithm that operates on a single - * block. The hash block, last hash value (Ym) and the new block to hash - * are given. - * - * @param h the hash block. - * @param y the previous value for Ym, use [0, 0, 0, 0] for a new hash. - * @param x the block to hash. - * - * @return the hashed value (Ym). - */ -modes.gcm.prototype.ghash = function(h, y, x) { - y[0] ^= x[0]; - y[1] ^= x[1]; - y[2] ^= x[2]; - y[3] ^= x[3]; - return this.tableMultiply(y); - //return this.multiply(y, h); -}; - -/** - * Precomputes a table for multiplying against the hash subkey. This - * mechanism provides a substantial speed increase over multiplication - * performed without a table. The table-based multiplication this table is - * for solves X * H by multiplying each component of X by H and then - * composing the results together using XOR. - * - * This function can be used to generate tables with different bit sizes - * for the components, however, this implementation assumes there are - * 32 components of X (which is a 16 byte vector), therefore each component - * takes 4-bits (so the table is constructed with bits=4). - * - * @param h the hash subkey. - * @param bits the bit size for a component. - */ -modes.gcm.prototype.generateHashTable = function(h, bits) { - // TODO: There are further optimizations that would use only the - // first table M_0 (or some variant) along with a remainder table; - // this can be explored in the future - var multiplier = 8 / bits; - var perInt = 4 * multiplier; - var size = 16 * multiplier; - var m = new Array(size); - for(var i = 0; i < size; ++i) { - var tmp = [0, 0, 0, 0]; - var idx = (i / perInt) | 0; - var shft = ((perInt - 1 - (i % perInt)) * bits); - tmp[idx] = (1 << (bits - 1)) << shft; - m[i] = this.generateSubHashTable(this.multiply(tmp, h), bits); - } - return m; -}; - -/** - * Generates a table for multiplying against the hash subkey for one - * particular component (out of all possible component values). - * - * @param mid the pre-multiplied value for the middle key of the table. - * @param bits the bit size for a component. - */ -modes.gcm.prototype.generateSubHashTable = function(mid, bits) { - // compute the table quickly by minimizing the number of - // POW operations -- they only need to be performed for powers of 2, - // all other entries can be composed from those powers using XOR - var size = 1 << bits; - var half = size >>> 1; - var m = new Array(size); - m[half] = mid.slice(0); - var i = half >>> 1; - while(i > 0) { - // raise m0[2 * i] and store in m0[i] - this.pow(m[2 * i], m[i] = []); - i >>= 1; - } - i = 2; - while(i < half) { - for(var j = 1; j < i; ++j) { - var m_i = m[i]; - var m_j = m[j]; - m[i + j] = [ - m_i[0] ^ m_j[0], - m_i[1] ^ m_j[1], - m_i[2] ^ m_j[2], - m_i[3] ^ m_j[3] - ]; - } - i *= 2; - } - m[0] = [0, 0, 0, 0]; - /* Note: We could avoid storing these by doing composition during multiply - calculate top half using composition by speed is preferred. */ - for(i = half + 1; i < size; ++i) { - var c = m[i ^ half]; - m[i] = [mid[0] ^ c[0], mid[1] ^ c[1], mid[2] ^ c[2], mid[3] ^ c[3]]; - } - return m; -}; - -/** Utility functions */ - -function transformIV(iv, blockSize) { - if(typeof iv === 'string') { - // convert iv string into byte buffer - iv = forge.util.createBuffer(iv); - } - - if(forge.util.isArray(iv) && iv.length > 4) { - // convert iv byte array into byte buffer - var tmp = iv; - iv = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - iv.putByte(tmp[i]); - } - } - - if(iv.length() < blockSize) { - throw new Error( - 'Invalid IV length; got ' + iv.length() + - ' bytes and expected ' + blockSize + ' bytes.'); - } - - if(!forge.util.isArray(iv)) { - // convert iv byte buffer into 32-bit integer array - var ints = []; - var blocks = blockSize / 4; - for(var i = 0; i < blocks; ++i) { - ints.push(iv.getInt32()); - } - iv = ints; - } - - return iv; -} - -function inc32(block) { - // increment last 32 bits of block only - block[block.length - 1] = (block[block.length - 1] + 1) & 0xFFFFFFFF; -} - -function from64To32(num) { - // convert 64-bit number to two BE Int32s - return [(num / 0x100000000) | 0, num & 0xFFFFFFFF]; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/debug.js b/reverse_engineering/node_modules/node-forge/lib/debug.js deleted file mode 100644 index 26756350..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/debug.js +++ /dev/null @@ -1,78 +0,0 @@ -/** - * Debugging support for web applications. - * - * @author David I. Lehn - * - * Copyright 2008-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -/* DEBUG API */ -module.exports = forge.debug = forge.debug || {}; - -// Private storage for debugging. -// Useful to expose data that is otherwise unviewable behind closures. -// NOTE: remember that this can hold references to data and cause leaks! -// format is "forge._debug.. = data" -// Example: -// (function() { -// var cat = 'forge.test.Test'; // debugging category -// var sState = {...}; // local state -// forge.debug.set(cat, 'sState', sState); -// })(); -forge.debug.storage = {}; - -/** - * Gets debug data. Omit name for all cat data Omit name and cat for - * all data. - * - * @param cat name of debugging category. - * @param name name of data to get (optional). - * @return object with requested debug data or undefined. - */ -forge.debug.get = function(cat, name) { - var rval; - if(typeof(cat) === 'undefined') { - rval = forge.debug.storage; - } else if(cat in forge.debug.storage) { - if(typeof(name) === 'undefined') { - rval = forge.debug.storage[cat]; - } else { - rval = forge.debug.storage[cat][name]; - } - } - return rval; -}; - -/** - * Sets debug data. - * - * @param cat name of debugging category. - * @param name name of data to set. - * @param data data to set. - */ -forge.debug.set = function(cat, name, data) { - if(!(cat in forge.debug.storage)) { - forge.debug.storage[cat] = {}; - } - forge.debug.storage[cat][name] = data; -}; - -/** - * Clears debug data. Omit name for all cat data. Omit name and cat for - * all data. - * - * @param cat name of debugging category. - * @param name name of data to clear or omit to clear entire category. - */ -forge.debug.clear = function(cat, name) { - if(typeof(cat) === 'undefined') { - forge.debug.storage = {}; - } else if(cat in forge.debug.storage) { - if(typeof(name) === 'undefined') { - delete forge.debug.storage[cat]; - } else { - delete forge.debug.storage[cat][name]; - } - } -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/des.js b/reverse_engineering/node_modules/node-forge/lib/des.js deleted file mode 100644 index ed8239aa..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/des.js +++ /dev/null @@ -1,496 +0,0 @@ -/** - * DES (Data Encryption Standard) implementation. - * - * This implementation supports DES as well as 3DES-EDE in ECB and CBC mode. - * It is based on the BSD-licensed implementation by Paul Tero: - * - * Paul Tero, July 2001 - * http://www.tero.co.uk/des/ - * - * Optimised for performance with large blocks by - * Michael Hayworth, November 2001 - * http://www.netdealing.com - * - * THIS SOFTWARE IS PROVIDED "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2012-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./cipher'); -require('./cipherModes'); -require('./util'); - -/* DES API */ -module.exports = forge.des = forge.des || {}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('DES-', key); - * cipher.start({iv: iv}); - * - * Creates an DES cipher object to encrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as binary-encoded strings of bytes or - * byte buffers. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC' if IV is - * given, 'ECB' if null). - * - * @return the cipher. - */ -forge.des.startEncrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: false, - mode: mode || (iv === null ? 'ECB' : 'CBC') - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var cipher = forge.cipher.createCipher('DES-', key); - * - * Creates an DES cipher object to encrypt data using the given symmetric key. - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.des.createEncryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: false, - mode: mode - }); -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('DES-', key); - * decipher.start({iv: iv}); - * - * Creates an DES cipher object to decrypt data using the given symmetric key. - * The output will be stored in the 'output' member of the returned cipher. - * - * The key and iv may be given as binary-encoded strings of bytes or - * byte buffers. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * @param mode the cipher mode to use (default: 'CBC' if IV is - * given, 'ECB' if null). - * - * @return the cipher. - */ -forge.des.startDecrypting = function(key, iv, output, mode) { - var cipher = _createCipher({ - key: key, - output: output, - decrypt: true, - mode: mode || (iv === null ? 'ECB' : 'CBC') - }); - cipher.start(iv); - return cipher; -}; - -/** - * Deprecated. Instead, use: - * - * var decipher = forge.cipher.createDecipher('DES-', key); - * - * Creates an DES cipher object to decrypt data using the given symmetric key. - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param key the symmetric key to use (64 or 192 bits). - * @param mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -forge.des.createDecryptionCipher = function(key, mode) { - return _createCipher({ - key: key, - output: null, - decrypt: true, - mode: mode - }); -}; - -/** - * Creates a new DES cipher algorithm object. - * - * @param name the name of the algorithm. - * @param mode the mode factory function. - * - * @return the DES algorithm object. - */ -forge.des.Algorithm = function(name, mode) { - var self = this; - self.name = name; - self.mode = new mode({ - blockSize: 8, - cipher: { - encrypt: function(inBlock, outBlock) { - return _updateBlock(self._keys, inBlock, outBlock, false); - }, - decrypt: function(inBlock, outBlock) { - return _updateBlock(self._keys, inBlock, outBlock, true); - } - } - }); - self._init = false; -}; - -/** - * Initializes this DES algorithm by expanding its key. - * - * @param options the options to use. - * key the key to use with this algorithm. - * decrypt true if the algorithm should be initialized for decryption, - * false for encryption. - */ -forge.des.Algorithm.prototype.initialize = function(options) { - if(this._init) { - return; - } - - var key = forge.util.createBuffer(options.key); - if(this.name.indexOf('3DES') === 0) { - if(key.length() !== 24) { - throw new Error('Invalid Triple-DES key size: ' + key.length() * 8); - } - } - - // do key expansion to 16 or 48 subkeys (single or triple DES) - this._keys = _createKeys(key); - this._init = true; -}; - -/** Register DES algorithms **/ - -registerAlgorithm('DES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('DES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('DES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('DES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('DES-CTR', forge.cipher.modes.ctr); - -registerAlgorithm('3DES-ECB', forge.cipher.modes.ecb); -registerAlgorithm('3DES-CBC', forge.cipher.modes.cbc); -registerAlgorithm('3DES-CFB', forge.cipher.modes.cfb); -registerAlgorithm('3DES-OFB', forge.cipher.modes.ofb); -registerAlgorithm('3DES-CTR', forge.cipher.modes.ctr); - -function registerAlgorithm(name, mode) { - var factory = function() { - return new forge.des.Algorithm(name, mode); - }; - forge.cipher.registerAlgorithm(name, factory); -} - -/** DES implementation **/ - -var spfunction1 = [0x1010400,0,0x10000,0x1010404,0x1010004,0x10404,0x4,0x10000,0x400,0x1010400,0x1010404,0x400,0x1000404,0x1010004,0x1000000,0x4,0x404,0x1000400,0x1000400,0x10400,0x10400,0x1010000,0x1010000,0x1000404,0x10004,0x1000004,0x1000004,0x10004,0,0x404,0x10404,0x1000000,0x10000,0x1010404,0x4,0x1010000,0x1010400,0x1000000,0x1000000,0x400,0x1010004,0x10000,0x10400,0x1000004,0x400,0x4,0x1000404,0x10404,0x1010404,0x10004,0x1010000,0x1000404,0x1000004,0x404,0x10404,0x1010400,0x404,0x1000400,0x1000400,0,0x10004,0x10400,0,0x1010004]; -var spfunction2 = [-0x7fef7fe0,-0x7fff8000,0x8000,0x108020,0x100000,0x20,-0x7fefffe0,-0x7fff7fe0,-0x7fffffe0,-0x7fef7fe0,-0x7fef8000,-0x80000000,-0x7fff8000,0x100000,0x20,-0x7fefffe0,0x108000,0x100020,-0x7fff7fe0,0,-0x80000000,0x8000,0x108020,-0x7ff00000,0x100020,-0x7fffffe0,0,0x108000,0x8020,-0x7fef8000,-0x7ff00000,0x8020,0,0x108020,-0x7fefffe0,0x100000,-0x7fff7fe0,-0x7ff00000,-0x7fef8000,0x8000,-0x7ff00000,-0x7fff8000,0x20,-0x7fef7fe0,0x108020,0x20,0x8000,-0x80000000,0x8020,-0x7fef8000,0x100000,-0x7fffffe0,0x100020,-0x7fff7fe0,-0x7fffffe0,0x100020,0x108000,0,-0x7fff8000,0x8020,-0x80000000,-0x7fefffe0,-0x7fef7fe0,0x108000]; -var spfunction3 = [0x208,0x8020200,0,0x8020008,0x8000200,0,0x20208,0x8000200,0x20008,0x8000008,0x8000008,0x20000,0x8020208,0x20008,0x8020000,0x208,0x8000000,0x8,0x8020200,0x200,0x20200,0x8020000,0x8020008,0x20208,0x8000208,0x20200,0x20000,0x8000208,0x8,0x8020208,0x200,0x8000000,0x8020200,0x8000000,0x20008,0x208,0x20000,0x8020200,0x8000200,0,0x200,0x20008,0x8020208,0x8000200,0x8000008,0x200,0,0x8020008,0x8000208,0x20000,0x8000000,0x8020208,0x8,0x20208,0x20200,0x8000008,0x8020000,0x8000208,0x208,0x8020000,0x20208,0x8,0x8020008,0x20200]; -var spfunction4 = [0x802001,0x2081,0x2081,0x80,0x802080,0x800081,0x800001,0x2001,0,0x802000,0x802000,0x802081,0x81,0,0x800080,0x800001,0x1,0x2000,0x800000,0x802001,0x80,0x800000,0x2001,0x2080,0x800081,0x1,0x2080,0x800080,0x2000,0x802080,0x802081,0x81,0x800080,0x800001,0x802000,0x802081,0x81,0,0,0x802000,0x2080,0x800080,0x800081,0x1,0x802001,0x2081,0x2081,0x80,0x802081,0x81,0x1,0x2000,0x800001,0x2001,0x802080,0x800081,0x2001,0x2080,0x800000,0x802001,0x80,0x800000,0x2000,0x802080]; -var spfunction5 = [0x100,0x2080100,0x2080000,0x42000100,0x80000,0x100,0x40000000,0x2080000,0x40080100,0x80000,0x2000100,0x40080100,0x42000100,0x42080000,0x80100,0x40000000,0x2000000,0x40080000,0x40080000,0,0x40000100,0x42080100,0x42080100,0x2000100,0x42080000,0x40000100,0,0x42000000,0x2080100,0x2000000,0x42000000,0x80100,0x80000,0x42000100,0x100,0x2000000,0x40000000,0x2080000,0x42000100,0x40080100,0x2000100,0x40000000,0x42080000,0x2080100,0x40080100,0x100,0x2000000,0x42080000,0x42080100,0x80100,0x42000000,0x42080100,0x2080000,0,0x40080000,0x42000000,0x80100,0x2000100,0x40000100,0x80000,0,0x40080000,0x2080100,0x40000100]; -var spfunction6 = [0x20000010,0x20400000,0x4000,0x20404010,0x20400000,0x10,0x20404010,0x400000,0x20004000,0x404010,0x400000,0x20000010,0x400010,0x20004000,0x20000000,0x4010,0,0x400010,0x20004010,0x4000,0x404000,0x20004010,0x10,0x20400010,0x20400010,0,0x404010,0x20404000,0x4010,0x404000,0x20404000,0x20000000,0x20004000,0x10,0x20400010,0x404000,0x20404010,0x400000,0x4010,0x20000010,0x400000,0x20004000,0x20000000,0x4010,0x20000010,0x20404010,0x404000,0x20400000,0x404010,0x20404000,0,0x20400010,0x10,0x4000,0x20400000,0x404010,0x4000,0x400010,0x20004010,0,0x20404000,0x20000000,0x400010,0x20004010]; -var spfunction7 = [0x200000,0x4200002,0x4000802,0,0x800,0x4000802,0x200802,0x4200800,0x4200802,0x200000,0,0x4000002,0x2,0x4000000,0x4200002,0x802,0x4000800,0x200802,0x200002,0x4000800,0x4000002,0x4200000,0x4200800,0x200002,0x4200000,0x800,0x802,0x4200802,0x200800,0x2,0x4000000,0x200800,0x4000000,0x200800,0x200000,0x4000802,0x4000802,0x4200002,0x4200002,0x2,0x200002,0x4000000,0x4000800,0x200000,0x4200800,0x802,0x200802,0x4200800,0x802,0x4000002,0x4200802,0x4200000,0x200800,0,0x2,0x4200802,0,0x200802,0x4200000,0x800,0x4000002,0x4000800,0x800,0x200002]; -var spfunction8 = [0x10001040,0x1000,0x40000,0x10041040,0x10000000,0x10001040,0x40,0x10000000,0x40040,0x10040000,0x10041040,0x41000,0x10041000,0x41040,0x1000,0x40,0x10040000,0x10000040,0x10001000,0x1040,0x41000,0x40040,0x10040040,0x10041000,0x1040,0,0,0x10040040,0x10000040,0x10001000,0x41040,0x40000,0x41040,0x40000,0x10041000,0x1000,0x40,0x10040040,0x1000,0x41040,0x10001000,0x40,0x10000040,0x10040000,0x10040040,0x10000000,0x40000,0x10001040,0,0x10041040,0x40040,0x10000040,0x10040000,0x10001000,0x10001040,0,0x10041040,0x41000,0x41000,0x1040,0x1040,0x40040,0x10000000,0x10041000]; - -/** - * Create necessary sub keys. - * - * @param key the 64-bit or 192-bit key. - * - * @return the expanded keys. - */ -function _createKeys(key) { - var pc2bytes0 = [0,0x4,0x20000000,0x20000004,0x10000,0x10004,0x20010000,0x20010004,0x200,0x204,0x20000200,0x20000204,0x10200,0x10204,0x20010200,0x20010204], - pc2bytes1 = [0,0x1,0x100000,0x100001,0x4000000,0x4000001,0x4100000,0x4100001,0x100,0x101,0x100100,0x100101,0x4000100,0x4000101,0x4100100,0x4100101], - pc2bytes2 = [0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808,0,0x8,0x800,0x808,0x1000000,0x1000008,0x1000800,0x1000808], - pc2bytes3 = [0,0x200000,0x8000000,0x8200000,0x2000,0x202000,0x8002000,0x8202000,0x20000,0x220000,0x8020000,0x8220000,0x22000,0x222000,0x8022000,0x8222000], - pc2bytes4 = [0,0x40000,0x10,0x40010,0,0x40000,0x10,0x40010,0x1000,0x41000,0x1010,0x41010,0x1000,0x41000,0x1010,0x41010], - pc2bytes5 = [0,0x400,0x20,0x420,0,0x400,0x20,0x420,0x2000000,0x2000400,0x2000020,0x2000420,0x2000000,0x2000400,0x2000020,0x2000420], - pc2bytes6 = [0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002,0,0x10000000,0x80000,0x10080000,0x2,0x10000002,0x80002,0x10080002], - pc2bytes7 = [0,0x10000,0x800,0x10800,0x20000000,0x20010000,0x20000800,0x20010800,0x20000,0x30000,0x20800,0x30800,0x20020000,0x20030000,0x20020800,0x20030800], - pc2bytes8 = [0,0x40000,0,0x40000,0x2,0x40002,0x2,0x40002,0x2000000,0x2040000,0x2000000,0x2040000,0x2000002,0x2040002,0x2000002,0x2040002], - pc2bytes9 = [0,0x10000000,0x8,0x10000008,0,0x10000000,0x8,0x10000008,0x400,0x10000400,0x408,0x10000408,0x400,0x10000400,0x408,0x10000408], - pc2bytes10 = [0,0x20,0,0x20,0x100000,0x100020,0x100000,0x100020,0x2000,0x2020,0x2000,0x2020,0x102000,0x102020,0x102000,0x102020], - pc2bytes11 = [0,0x1000000,0x200,0x1000200,0x200000,0x1200000,0x200200,0x1200200,0x4000000,0x5000000,0x4000200,0x5000200,0x4200000,0x5200000,0x4200200,0x5200200], - pc2bytes12 = [0,0x1000,0x8000000,0x8001000,0x80000,0x81000,0x8080000,0x8081000,0x10,0x1010,0x8000010,0x8001010,0x80010,0x81010,0x8080010,0x8081010], - pc2bytes13 = [0,0x4,0x100,0x104,0,0x4,0x100,0x104,0x1,0x5,0x101,0x105,0x1,0x5,0x101,0x105]; - - // how many iterations (1 for des, 3 for triple des) - // changed by Paul 16/6/2007 to use Triple DES for 9+ byte keys - var iterations = key.length() > 8 ? 3 : 1; - - // stores the return keys - var keys = []; - - // now define the left shifts which need to be done - var shifts = [0, 0, 1, 1, 1, 1, 1, 1, 0, 1, 1, 1, 1, 1, 1, 0]; - - var n = 0, tmp; - for(var j = 0; j < iterations; j++) { - var left = key.getInt32(); - var right = key.getInt32(); - - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - tmp = ((right >>> -16) ^ left) & 0x0000ffff; - left ^= tmp; - right ^= (tmp << -16); - - tmp = ((left >>> 2) ^ right) & 0x33333333; - right ^= tmp; - left ^= (tmp << 2); - - tmp = ((right >>> -16) ^ left) & 0x0000ffff; - left ^= tmp; - right ^= (tmp << -16); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - // right needs to be shifted and OR'd with last four bits of left - tmp = (left << 8) | ((right >>> 20) & 0x000000f0); - - // left needs to be put upside down - left = ((right << 24) | ((right << 8) & 0xff0000) | - ((right >>> 8) & 0xff00) | ((right >>> 24) & 0xf0)); - right = tmp; - - // now go through and perform these shifts on the left and right keys - for(var i = 0; i < shifts.length; ++i) { - //shift the keys either one or two bits to the left - if(shifts[i]) { - left = (left << 2) | (left >>> 26); - right = (right << 2) | (right >>> 26); - } else { - left = (left << 1) | (left >>> 27); - right = (right << 1) | (right >>> 27); - } - left &= -0xf; - right &= -0xf; - - // now apply PC-2, in such a way that E is easier when encrypting or - // decrypting this conversion will look like PC-2 except only the last 6 - // bits of each byte are used rather than 48 consecutive bits and the - // order of lines will be according to how the S selection functions will - // be applied: S2, S4, S6, S8, S1, S3, S5, S7 - var lefttmp = ( - pc2bytes0[left >>> 28] | pc2bytes1[(left >>> 24) & 0xf] | - pc2bytes2[(left >>> 20) & 0xf] | pc2bytes3[(left >>> 16) & 0xf] | - pc2bytes4[(left >>> 12) & 0xf] | pc2bytes5[(left >>> 8) & 0xf] | - pc2bytes6[(left >>> 4) & 0xf]); - var righttmp = ( - pc2bytes7[right >>> 28] | pc2bytes8[(right >>> 24) & 0xf] | - pc2bytes9[(right >>> 20) & 0xf] | pc2bytes10[(right >>> 16) & 0xf] | - pc2bytes11[(right >>> 12) & 0xf] | pc2bytes12[(right >>> 8) & 0xf] | - pc2bytes13[(right >>> 4) & 0xf]); - tmp = ((righttmp >>> 16) ^ lefttmp) & 0x0000ffff; - keys[n++] = lefttmp ^ tmp; - keys[n++] = righttmp ^ (tmp << 16); - } - } - - return keys; -} - -/** - * Updates a single block (1 byte) using DES. The update will either - * encrypt or decrypt the block. - * - * @param keys the expanded keys. - * @param input the input block (an array of 32-bit words). - * @param output the updated output block. - * @param decrypt true to decrypt the block, false to encrypt it. - */ -function _updateBlock(keys, input, output, decrypt) { - // set up loops for single or triple DES - var iterations = keys.length === 32 ? 3 : 9; - var looping; - if(iterations === 3) { - looping = decrypt ? [30, -2, -2] : [0, 32, 2]; - } else { - looping = (decrypt ? - [94, 62, -2, 32, 64, 2, 30, -2, -2] : - [0, 32, 2, 62, 30, -2, 64, 96, 2]); - } - - var tmp; - - var left = input[0]; - var right = input[1]; - - // first each 64 bit chunk of the message must be permuted according to IP - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - tmp = ((left >>> 16) ^ right) & 0x0000ffff; - right ^= tmp; - left ^= (tmp << 16); - - tmp = ((right >>> 2) ^ left) & 0x33333333; - left ^= tmp; - right ^= (tmp << 2); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - // rotate left 1 bit - left = ((left << 1) | (left >>> 31)); - right = ((right << 1) | (right >>> 31)); - - for(var j = 0; j < iterations; j += 3) { - var endloop = looping[j + 1]; - var loopinc = looping[j + 2]; - - // now go through and perform the encryption or decryption - for(var i = looping[j]; i != endloop; i += loopinc) { - var right1 = right ^ keys[i]; - var right2 = ((right >>> 4) | (right << 28)) ^ keys[i + 1]; - - // passing these bytes through the S selection functions - tmp = left; - left = right; - right = tmp ^ ( - spfunction2[(right1 >>> 24) & 0x3f] | - spfunction4[(right1 >>> 16) & 0x3f] | - spfunction6[(right1 >>> 8) & 0x3f] | - spfunction8[right1 & 0x3f] | - spfunction1[(right2 >>> 24) & 0x3f] | - spfunction3[(right2 >>> 16) & 0x3f] | - spfunction5[(right2 >>> 8) & 0x3f] | - spfunction7[right2 & 0x3f]); - } - // unreverse left and right - tmp = left; - left = right; - right = tmp; - } - - // rotate right 1 bit - left = ((left >>> 1) | (left << 31)); - right = ((right >>> 1) | (right << 31)); - - // now perform IP-1, which is IP in the opposite direction - tmp = ((left >>> 1) ^ right) & 0x55555555; - right ^= tmp; - left ^= (tmp << 1); - - tmp = ((right >>> 8) ^ left) & 0x00ff00ff; - left ^= tmp; - right ^= (tmp << 8); - - tmp = ((right >>> 2) ^ left) & 0x33333333; - left ^= tmp; - right ^= (tmp << 2); - - tmp = ((left >>> 16) ^ right) & 0x0000ffff; - right ^= tmp; - left ^= (tmp << 16); - - tmp = ((left >>> 4) ^ right) & 0x0f0f0f0f; - right ^= tmp; - left ^= (tmp << 4); - - output[0] = left; - output[1] = right; -} - -/** - * Deprecated. Instead, use: - * - * forge.cipher.createCipher('DES-', key); - * forge.cipher.createDecipher('DES-', key); - * - * Creates a deprecated DES cipher object. This object's mode will default to - * CBC (cipher-block-chaining). - * - * The key may be given as a binary-encoded string of bytes or a byte buffer. - * - * @param options the options to use. - * key the symmetric key to use (64 or 192 bits). - * output the buffer to write to. - * decrypt true for decryption, false for encryption. - * mode the cipher mode to use (default: 'CBC'). - * - * @return the cipher. - */ -function _createCipher(options) { - options = options || {}; - var mode = (options.mode || 'CBC').toUpperCase(); - var algorithm = 'DES-' + mode; - - var cipher; - if(options.decrypt) { - cipher = forge.cipher.createDecipher(algorithm, options.key); - } else { - cipher = forge.cipher.createCipher(algorithm, options.key); - } - - // backwards compatible start API - var start = cipher.start; - cipher.start = function(iv, options) { - // backwards compatibility: support second arg as output buffer - var output = null; - if(options instanceof forge.util.ByteBuffer) { - output = options; - options = {}; - } - options = options || {}; - options.output = output; - options.iv = iv; - start.call(cipher, options); - }; - - return cipher; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/ed25519.js b/reverse_engineering/node_modules/node-forge/lib/ed25519.js deleted file mode 100644 index f3e6faaa..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/ed25519.js +++ /dev/null @@ -1,1072 +0,0 @@ -/** - * JavaScript implementation of Ed25519. - * - * Copyright (c) 2017-2019 Digital Bazaar, Inc. - * - * This implementation is based on the most excellent TweetNaCl which is - * in the public domain. Many thanks to its contributors: - * - * https://github.com/dchest/tweetnacl-js - */ -var forge = require('./forge'); -require('./jsbn'); -require('./random'); -require('./sha512'); -require('./util'); -var asn1Validator = require('./asn1-validator'); -var publicKeyValidator = asn1Validator.publicKeyValidator; -var privateKeyValidator = asn1Validator.privateKeyValidator; - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -var ByteBuffer = forge.util.ByteBuffer; -var NativeBuffer = typeof Buffer === 'undefined' ? Uint8Array : Buffer; - -/* - * Ed25519 algorithms, see RFC 8032: - * https://tools.ietf.org/html/rfc8032 - */ -forge.pki = forge.pki || {}; -module.exports = forge.pki.ed25519 = forge.ed25519 = forge.ed25519 || {}; -var ed25519 = forge.ed25519; - -ed25519.constants = {}; -ed25519.constants.PUBLIC_KEY_BYTE_LENGTH = 32; -ed25519.constants.PRIVATE_KEY_BYTE_LENGTH = 64; -ed25519.constants.SEED_BYTE_LENGTH = 32; -ed25519.constants.SIGN_BYTE_LENGTH = 64; -ed25519.constants.HASH_BYTE_LENGTH = 64; - -ed25519.generateKeyPair = function(options) { - options = options || {}; - var seed = options.seed; - if(seed === undefined) { - // generate seed - seed = forge.random.getBytesSync(ed25519.constants.SEED_BYTE_LENGTH); - } else if(typeof seed === 'string') { - if(seed.length !== ed25519.constants.SEED_BYTE_LENGTH) { - throw new TypeError( - '"seed" must be ' + ed25519.constants.SEED_BYTE_LENGTH + - ' bytes in length.'); - } - } else if(!(seed instanceof Uint8Array)) { - throw new TypeError( - '"seed" must be a node.js Buffer, Uint8Array, or a binary string.'); - } - - seed = messageToNativeBuffer({message: seed, encoding: 'binary'}); - - var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - var sk = new NativeBuffer(ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - for(var i = 0; i < 32; ++i) { - sk[i] = seed[i]; - } - crypto_sign_keypair(pk, sk); - return {publicKey: pk, privateKey: sk}; -}; - -/** - * Converts a private key from a RFC8410 ASN.1 encoding. - * - * @param obj - The asn1 representation of a private key. - * - * @returns {Object} keyInfo - The key information. - * @returns {Buffer|Uint8Array} keyInfo.privateKeyBytes - 32 private key bytes. - */ -ed25519.privateKeyFromAsn1 = function(obj) { - var capture = {}; - var errors = []; - var valid = forge.asn1.validate(obj, privateKeyValidator, capture, errors); - if(!valid) { - var error = new Error('Invalid Key.'); - error.errors = errors; - throw error; - } - var oid = forge.asn1.derToOid(capture.privateKeyOid); - var ed25519Oid = forge.oids.EdDSA25519; - if(oid !== ed25519Oid) { - throw new Error('Invalid OID "' + oid + '"; OID must be "' + - ed25519Oid + '".'); - } - var privateKey = capture.privateKey; - // manually extract the private key bytes from nested octet string, see FIXME: - // https://github.com/digitalbazaar/forge/blob/master/lib/asn1.js#L542 - var privateKeyBytes = messageToNativeBuffer({ - message: forge.asn1.fromDer(privateKey).value, - encoding: 'binary' - }); - // TODO: RFC8410 specifies a format for encoding the public key bytes along - // with the private key bytes. `publicKeyBytes` can be returned in the - // future. https://tools.ietf.org/html/rfc8410#section-10.3 - return {privateKeyBytes: privateKeyBytes}; -}; - -/** - * Converts a public key from a RFC8410 ASN.1 encoding. - * - * @param obj - The asn1 representation of a public key. - * - * @return {Buffer|Uint8Array} - 32 public key bytes. - */ -ed25519.publicKeyFromAsn1 = function(obj) { - // get SubjectPublicKeyInfo - var capture = {}; - var errors = []; - var valid = forge.asn1.validate(obj, publicKeyValidator, capture, errors); - if(!valid) { - var error = new Error('Invalid Key.'); - error.errors = errors; - throw error; - } - var oid = forge.asn1.derToOid(capture.publicKeyOid); - var ed25519Oid = forge.oids.EdDSA25519; - if(oid !== ed25519Oid) { - throw new Error('Invalid OID "' + oid + '"; OID must be "' + - ed25519Oid + '".'); - } - var publicKeyBytes = capture.ed25519PublicKey; - if(publicKeyBytes.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { - throw new Error('Key length is invalid.'); - } - return messageToNativeBuffer({ - message: publicKeyBytes, - encoding: 'binary' - }); -}; - -ed25519.publicKeyFromPrivateKey = function(options) { - options = options || {}; - var privateKey = messageToNativeBuffer({ - message: options.privateKey, encoding: 'binary' - }); - if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.privateKey" must have a byte length of ' + - ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - } - - var pk = new NativeBuffer(ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - for(var i = 0; i < pk.length; ++i) { - pk[i] = privateKey[32 + i]; - } - return pk; -}; - -ed25519.sign = function(options) { - options = options || {}; - var msg = messageToNativeBuffer(options); - var privateKey = messageToNativeBuffer({ - message: options.privateKey, - encoding: 'binary' - }); - if(privateKey.length === ed25519.constants.SEED_BYTE_LENGTH) { - var keyPair = ed25519.generateKeyPair({seed: privateKey}); - privateKey = keyPair.privateKey; - } else if(privateKey.length !== ed25519.constants.PRIVATE_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.privateKey" must have a byte length of ' + - ed25519.constants.SEED_BYTE_LENGTH + ' or ' + - ed25519.constants.PRIVATE_KEY_BYTE_LENGTH); - } - - var signedMsg = new NativeBuffer( - ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - crypto_sign(signedMsg, msg, msg.length, privateKey); - - var sig = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH); - for(var i = 0; i < sig.length; ++i) { - sig[i] = signedMsg[i]; - } - return sig; -}; - -ed25519.verify = function(options) { - options = options || {}; - var msg = messageToNativeBuffer(options); - if(options.signature === undefined) { - throw new TypeError( - '"options.signature" must be a node.js Buffer, a Uint8Array, a forge ' + - 'ByteBuffer, or a binary string.'); - } - var sig = messageToNativeBuffer({ - message: options.signature, - encoding: 'binary' - }); - if(sig.length !== ed25519.constants.SIGN_BYTE_LENGTH) { - throw new TypeError( - '"options.signature" must have a byte length of ' + - ed25519.constants.SIGN_BYTE_LENGTH); - } - var publicKey = messageToNativeBuffer({ - message: options.publicKey, - encoding: 'binary' - }); - if(publicKey.length !== ed25519.constants.PUBLIC_KEY_BYTE_LENGTH) { - throw new TypeError( - '"options.publicKey" must have a byte length of ' + - ed25519.constants.PUBLIC_KEY_BYTE_LENGTH); - } - - var sm = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - var m = new NativeBuffer(ed25519.constants.SIGN_BYTE_LENGTH + msg.length); - var i; - for(i = 0; i < ed25519.constants.SIGN_BYTE_LENGTH; ++i) { - sm[i] = sig[i]; - } - for(i = 0; i < msg.length; ++i) { - sm[i + ed25519.constants.SIGN_BYTE_LENGTH] = msg[i]; - } - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -function messageToNativeBuffer(options) { - var message = options.message; - if(message instanceof Uint8Array || message instanceof NativeBuffer) { - return message; - } - - var encoding = options.encoding; - if(message === undefined) { - if(options.md) { - // TODO: more rigorous validation that `md` is a MessageDigest - message = options.md.digest().getBytes(); - encoding = 'binary'; - } else { - throw new TypeError('"options.message" or "options.md" not specified.'); - } - } - - if(typeof message === 'string' && !encoding) { - throw new TypeError('"options.encoding" must be "binary" or "utf8".'); - } - - if(typeof message === 'string') { - if(typeof Buffer !== 'undefined') { - return Buffer.from(message, encoding); - } - message = new ByteBuffer(message, encoding); - } else if(!(message instanceof ByteBuffer)) { - throw new TypeError( - '"options.message" must be a node.js Buffer, a Uint8Array, a forge ' + - 'ByteBuffer, or a string with "options.encoding" specifying its ' + - 'encoding.'); - } - - // convert to native buffer - var buffer = new NativeBuffer(message.length()); - for(var i = 0; i < buffer.length; ++i) { - buffer[i] = message.at(i); - } - return buffer; -} - -var gf0 = gf(); -var gf1 = gf([1]); -var D = gf([ - 0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, - 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]); -var D2 = gf([ - 0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, - 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]); -var X = gf([ - 0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, - 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]); -var Y = gf([ - 0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, - 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]); -var L = new Float64Array([ - 0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, - 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); -var I = gf([ - 0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, - 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -// TODO: update forge buffer implementation to use `Buffer` or `Uint8Array`, -// whichever is available, to improve performance -function sha512(msg, msgLen) { - // Note: `out` and `msg` are NativeBuffer - var md = forge.md.sha512.create(); - var buffer = new ByteBuffer(msg); - md.update(buffer.getBytes(msgLen), 'binary'); - var hash = md.digest().getBytes(); - if(typeof Buffer !== 'undefined') { - return Buffer.from(hash, 'binary'); - } - var out = new NativeBuffer(ed25519.constants.HASH_BYTE_LENGTH); - for(var i = 0; i < 64; ++i) { - out[i] = hash.charCodeAt(i); - } - return out; -} - -function crypto_sign_keypair(pk, sk) { - var p = [gf(), gf(), gf(), gf()]; - var i; - - var d = sha512(sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for(i = 0; i < 32; ++i) { - sk[i + 32] = pk[i]; - } - return 0; -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - var d = sha512(sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for(i = 0; i < n; ++i) { - sm[64 + i] = m[i]; - } - for(i = 0; i < 32; ++i) { - sm[32 + i] = d[32 + i]; - } - - var r = sha512(sm.subarray(32), n + 32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for(i = 32; i < 64; ++i) { - sm[i] = sk[i]; - } - var h = sha512(sm, n + 64); - reduce(h); - - for(i = 32; i < 64; ++i) { - x[i] = 0; - } - for(i = 0; i < 32; ++i) { - x[i] = r[i]; - } - for(i = 0; i < 32; ++i) { - for(j = 0; j < 32; j++) { - x[i + j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new NativeBuffer(32); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if(n < 64) { - return -1; - } - - if(unpackneg(q, pk)) { - return -1; - } - - for(i = 0; i < n; ++i) { - m[i] = sm[i]; - } - for(i = 0; i < 32; ++i) { - m[i + 32] = pk[i]; - } - var h = sha512(m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if(crypto_verify_32(sm, 0, t, 0)) { - for(i = 0; i < n; ++i) { - m[i] = 0; - } - return -1; - } - - for(i = 0; i < n; ++i) { - m[i] = sm[i + 64]; - } - mlen = n; - return mlen; -} - -function modL(r, x) { - var carry, i, j, k; - for(i = 63; i >= 32; --i) { - carry = 0; - for(j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for(j = 0; j < 32; ++j) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for(j = 0; j < 32; ++j) { - x[j] -= carry * L[j]; - } - for(i = 0; i < 32; ++i) { - x[i + 1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64); - for(var i = 0; i < 64; ++i) { - x[i] = r[i]; - r[i] = 0; - } - modL(r, x); -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - for(var i = 0; i < 4; ++i) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for(i = 0; i < 16; ++i) { - t[i] = n[i]; - } - car25519(t); - car25519(t); - car25519(t); - for(j = 0; j < 2; ++j) { - m[0] = t[0] - 0xffed; - for(i = 1; i < 15; ++i) { - m[i] = t[i] - 0xffff - ((m[i - 1] >> 16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14] >> 16) & 1); - b = (m[15] >> 16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1 - b); - } - for (i = 0; i < 16; i++) { - o[2 * i] = t[i] & 0xff; - o[2 * i + 1] = t[i] >> 8; - } -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if(neq25519(chk, num)) { - M(r[0], r[0], I); - } - - S(chk, r[0]); - M(chk, chk, den); - if(neq25519(chk, num)) { - return -1; - } - - if(par25519(r[0]) === (p[31] >> 7)) { - Z(r[0], gf0, r[0]); - } - - M(r[3], r[0], r[1]); - return 0; -} - -function unpack25519(o, n) { - var i; - for(i = 0; i < 16; ++i) { - o[i] = n[2 * i] + (n[2 * i + 1] << 8); - } - o[15] &= 0x7fff; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for(a = 0; a < 16; ++a) { - c[a] = i[a]; - } - for(a = 250; a >= 0; --a) { - S(c, c); - if(a !== 1) { - M(c, c, i); - } - } - for(a = 0; a < 16; ++a) { - o[a] = c[a]; - } -} - -function neq25519(a, b) { - var c = new NativeBuffer(32); - var d = new NativeBuffer(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x, xi, y, yi, 32); -} - -function vn(x, xi, y, yi, n) { - var i, d = 0; - for(i = 0; i < n; ++i) { - d |= x[xi + i] ^ y[yi + i]; - } - return (1 & ((d - 1) >>> 8)) - 1; -} - -function par25519(a) { - var d = new NativeBuffer(32); - pack25519(d, a); - return d[0] & 1; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for(i = 255; i >= 0; --i) { - b = (s[(i / 8)|0] >> (i & 7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function set25519(r, a) { - var i; - for(i = 0; i < 16; i++) { - r[i] = a[i] | 0; - } -} - -function inv25519(o, i) { - var c = gf(); - var a; - for(a = 0; a < 16; ++a) { - c[a] = i[a]; - } - for(a = 253; a >= 0; --a) { - S(c, c); - if(a !== 2 && a !== 4) { - M(c, c, i); - } - } - for(a = 0; a < 16; ++a) { - o[a] = c[a]; - } -} - -function car25519(o) { - var i, v, c = 1; - for(i = 0; i < 16; ++i) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c - 1 + 37 * (c - 1); -} - -function sel25519(p, q, b) { - var t, c = ~(b - 1); - for(var i = 0; i < 16; ++i) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function gf(init) { - var i, r = new Float64Array(16); - if(init) { - for(i = 0; i < init.length; ++i) { - r[i] = init[i]; - } - } - return r; -} - -function A(o, a, b) { - for(var i = 0; i < 16; ++i) { - o[i] = a[i] + b[i]; - } -} - -function Z(o, a, b) { - for(var i = 0; i < 16; ++i) { - o[i] = a[i] - b[i]; - } -} - -function S(o, a) { - M(o, a, a); -} - -function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; - - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is - - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/forge.js b/reverse_engineering/node_modules/node-forge/lib/forge.js deleted file mode 100644 index 2e243a9d..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/forge.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Node.js module for Forge. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = { - // default options - options: { - usePureJavaScript: false - } -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/form.js b/reverse_engineering/node_modules/node-forge/lib/form.js deleted file mode 100644 index 4d7843a2..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/form.js +++ /dev/null @@ -1,149 +0,0 @@ -/** - * Functions for manipulating web forms. - * - * @author David I. Lehn - * @author Dave Longley - * @author Mike Johnson - * - * Copyright (c) 2011-2014 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); - -/* Form API */ -var form = module.exports = forge.form = forge.form || {}; - -(function($) { - -/** - * Regex for parsing a single name property (handles array brackets). - */ -var _regex = /([^\[]*?)\[(.*?)\]/g; - -/** - * Parses a single name property into an array with the name and any - * array indices. - * - * @param name the name to parse. - * - * @return the array of the name and its array indices in order. - */ -var _parseName = function(name) { - var rval = []; - - var matches; - while(!!(matches = _regex.exec(name))) { - if(matches[1].length > 0) { - rval.push(matches[1]); - } - if(matches.length >= 2) { - rval.push(matches[2]); - } - } - if(rval.length === 0) { - rval.push(name); - } - - return rval; -}; - -/** - * Adds a field from the given form to the given object. - * - * @param obj the object. - * @param names the field as an array of object property names. - * @param value the value of the field. - * @param dict a dictionary of names to replace. - */ -var _addField = function(obj, names, value, dict) { - // combine array names that fall within square brackets - var tmp = []; - for(var i = 0; i < names.length; ++i) { - // check name for starting square bracket but no ending one - var name = names[i]; - if(name.indexOf('[') !== -1 && name.indexOf(']') === -1 && - i < names.length - 1) { - do { - name += '.' + names[++i]; - } while(i < names.length - 1 && names[i].indexOf(']') === -1); - } - tmp.push(name); - } - names = tmp; - - // split out array indexes - var tmp = []; - $.each(names, function(n, name) { - tmp = tmp.concat(_parseName(name)); - }); - names = tmp; - - // iterate over object property names until value is set - $.each(names, function(n, name) { - // do dictionary name replacement - if(dict && name.length !== 0 && name in dict) { - name = dict[name]; - } - - // blank name indicates appending to an array, set name to - // new last index of array - if(name.length === 0) { - name = obj.length; - } - - // value already exists, append value - if(obj[name]) { - // last name in the field - if(n == names.length - 1) { - // more than one value, so convert into an array - if(!$.isArray(obj[name])) { - obj[name] = [obj[name]]; - } - obj[name].push(value); - } else { - // not last name, go deeper into object - obj = obj[name]; - } - } else if(n == names.length - 1) { - // new value, last name in the field, set value - obj[name] = value; - } else { - // new value, not last name, go deeper - // get next name - var next = names[n + 1]; - - // blank next value indicates array-appending, so create array - if(next.length === 0) { - obj[name] = []; - } else { - // if next name is a number create an array, otherwise a map - var isNum = ((next - 0) == next && next.length > 0); - obj[name] = isNum ? [] : {}; - } - obj = obj[name]; - } - }); -}; - -/** - * Serializes a form to a JSON object. Object properties will be separated - * using the given separator (defaults to '.') and by square brackets. - * - * @param input the jquery form to serialize. - * @param sep the object-property separator (defaults to '.'). - * @param dict a dictionary of names to replace (name=replace). - * - * @return the JSON-serialized form. - */ -form.serialize = function(input, sep, dict) { - var rval = {}; - - // add all fields in the form to the object - sep = sep || '.'; - $.each(input.serializeArray(), function() { - _addField(rval, this.name.split(sep), this.value || '', dict); - }); - - return rval; -}; - -})(jQuery); diff --git a/reverse_engineering/node_modules/node-forge/lib/hmac.js b/reverse_engineering/node_modules/node-forge/lib/hmac.js deleted file mode 100644 index b155f247..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/hmac.js +++ /dev/null @@ -1,146 +0,0 @@ -/** - * Hash-based Message Authentication Code implementation. Requires a message - * digest object that can be obtained, for example, from forge.md.sha1 or - * forge.md.md5. - * - * @author Dave Longley - * - * Copyright (c) 2010-2012 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -/* HMAC API */ -var hmac = module.exports = forge.hmac = forge.hmac || {}; - -/** - * Creates an HMAC object that uses the given message digest object. - * - * @return an HMAC object. - */ -hmac.create = function() { - // the hmac key to use - var _key = null; - - // the message digest to use - var _md = null; - - // the inner padding - var _ipadding = null; - - // the outer padding - var _opadding = null; - - // hmac context - var ctx = {}; - - /** - * Starts or restarts the HMAC with the given key and message digest. - * - * @param md the message digest to use, null to reuse the previous one, - * a string to use builtin 'sha1', 'md5', 'sha256'. - * @param key the key to use as a string, array of bytes, byte buffer, - * or null to reuse the previous key. - */ - ctx.start = function(md, key) { - if(md !== null) { - if(typeof md === 'string') { - // create builtin message digest - md = md.toLowerCase(); - if(md in forge.md.algorithms) { - _md = forge.md.algorithms[md].create(); - } else { - throw new Error('Unknown hash algorithm "' + md + '"'); - } - } else { - // store message digest - _md = md; - } - } - - if(key === null) { - // reuse previous key - key = _key; - } else { - if(typeof key === 'string') { - // convert string into byte buffer - key = forge.util.createBuffer(key); - } else if(forge.util.isArray(key)) { - // convert byte array into byte buffer - var tmp = key; - key = forge.util.createBuffer(); - for(var i = 0; i < tmp.length; ++i) { - key.putByte(tmp[i]); - } - } - - // if key is longer than blocksize, hash it - var keylen = key.length(); - if(keylen > _md.blockLength) { - _md.start(); - _md.update(key.bytes()); - key = _md.digest(); - } - - // mix key into inner and outer padding - // ipadding = [0x36 * blocksize] ^ key - // opadding = [0x5C * blocksize] ^ key - _ipadding = forge.util.createBuffer(); - _opadding = forge.util.createBuffer(); - keylen = key.length(); - for(var i = 0; i < keylen; ++i) { - var tmp = key.at(i); - _ipadding.putByte(0x36 ^ tmp); - _opadding.putByte(0x5C ^ tmp); - } - - // if key is shorter than blocksize, add additional padding - if(keylen < _md.blockLength) { - var tmp = _md.blockLength - keylen; - for(var i = 0; i < tmp; ++i) { - _ipadding.putByte(0x36); - _opadding.putByte(0x5C); - } - } - _key = key; - _ipadding = _ipadding.bytes(); - _opadding = _opadding.bytes(); - } - - // digest is done like so: hash(opadding | hash(ipadding | message)) - - // prepare to do inner hash - // hash(ipadding | message) - _md.start(); - _md.update(_ipadding); - }; - - /** - * Updates the HMAC with the given message bytes. - * - * @param bytes the bytes to update with. - */ - ctx.update = function(bytes) { - _md.update(bytes); - }; - - /** - * Produces the Message Authentication Code (MAC). - * - * @return a byte buffer containing the digest value. - */ - ctx.getMac = function() { - // digest is done like so: hash(opadding | hash(ipadding | message)) - // here we do the outer hashing - var inner = _md.digest().bytes(); - _md.start(); - _md.update(_opadding); - _md.update(inner); - return _md.digest(); - }; - // alias for getMac - ctx.digest = ctx.getMac; - - return ctx; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/http.js b/reverse_engineering/node_modules/node-forge/lib/http.js deleted file mode 100644 index 1dcb0a65..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/http.js +++ /dev/null @@ -1,1364 +0,0 @@ -/** - * HTTP client-side implementation that uses forge.net sockets. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. All rights reserved. - */ -var forge = require('./forge'); -require('./debug'); -require('./tls'); -require('./util'); - -// define http namespace -var http = module.exports = forge.http = forge.http || {}; - -// logging category -var cat = 'forge.http'; - -// add array of clients to debug storage -if(forge.debug) { - forge.debug.set('forge.http', 'clients', []); -} - -// normalizes an http header field name -var _normalize = function(name) { - return name.toLowerCase().replace(/(^.)|(-.)/g, - function(a) {return a.toUpperCase();}); -}; - -/** - * Gets the local storage ID for the given client. - * - * @param client the client to get the local storage ID for. - * - * @return the local storage ID to use. - */ -var _getStorageId = function(client) { - // TODO: include browser in ID to avoid sharing cookies between - // browsers (if this is undesirable) - // navigator.userAgent - return 'forge.http.' + - client.url.scheme + '.' + - client.url.host + '.' + - client.url.port; -}; - -/** - * Loads persistent cookies from disk for the given client. - * - * @param client the client. - */ -var _loadCookies = function(client) { - if(client.persistCookies) { - try { - var cookies = forge.util.getItem( - client.socketPool.flashApi, - _getStorageId(client), 'cookies'); - client.cookies = cookies || {}; - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } -}; - -/** - * Saves persistent cookies on disk for the given client. - * - * @param client the client. - */ -var _saveCookies = function(client) { - if(client.persistCookies) { - try { - forge.util.setItem( - client.socketPool.flashApi, - _getStorageId(client), 'cookies', client.cookies); - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } - - // FIXME: remove me - _loadCookies(client); -}; - -/** - * Clears persistent cookies on disk for the given client. - * - * @param client the client. - */ -var _clearCookies = function(client) { - if(client.persistCookies) { - try { - // only thing stored is 'cookies', so clear whole storage - forge.util.clearItems( - client.socketPool.flashApi, - _getStorageId(client)); - } catch(ex) { - // no flash storage available, just silently fail - // TODO: i assume we want this logged somewhere or - // should it actually generate an error - //forge.log.error(cat, ex); - } - } -}; - -/** - * Connects and sends a request. - * - * @param client the http client. - * @param socket the socket to use. - */ -var _doRequest = function(client, socket) { - if(socket.isConnected()) { - // already connected - socket.options.request.connectTime = +new Date(); - socket.connected({ - type: 'connect', - id: socket.id - }); - } else { - // connect - socket.options.request.connectTime = +new Date(); - socket.connect({ - host: client.url.host, - port: client.url.port, - policyPort: client.policyPort, - policyUrl: client.policyUrl - }); - } -}; - -/** - * Handles the next request or marks a socket as idle. - * - * @param client the http client. - * @param socket the socket. - */ -var _handleNextRequest = function(client, socket) { - // clear buffer - socket.buffer.clear(); - - // get pending request - var pending = null; - while(pending === null && client.requests.length > 0) { - pending = client.requests.shift(); - if(pending.request.aborted) { - pending = null; - } - } - - // mark socket idle if no pending requests - if(pending === null) { - if(socket.options !== null) { - socket.options = null; - } - client.idle.push(socket); - } else { - // handle pending request, allow 1 retry - socket.retries = 1; - socket.options = pending; - _doRequest(client, socket); - } -}; - -/** - * Sets up a socket for use with an http client. - * - * @param client the parent http client. - * @param socket the socket to set up. - * @param tlsOptions if the socket must use TLS, the TLS options. - */ -var _initSocket = function(client, socket, tlsOptions) { - // no socket options yet - socket.options = null; - - // set up handlers - socket.connected = function(e) { - // socket primed by caching TLS session, handle next request - if(socket.options === null) { - _handleNextRequest(client, socket); - } else { - // socket in use - var request = socket.options.request; - request.connectTime = +new Date() - request.connectTime; - e.socket = socket; - socket.options.connected(e); - if(request.aborted) { - socket.close(); - } else { - var out = request.toString(); - if(request.body) { - out += request.body; - } - request.time = +new Date(); - socket.send(out); - request.time = +new Date() - request.time; - socket.options.response.time = +new Date(); - socket.sending = true; - } - } - }; - socket.closed = function(e) { - if(socket.sending) { - socket.sending = false; - if(socket.retries > 0) { - --socket.retries; - _doRequest(client, socket); - } else { - // error, closed during send - socket.error({ - id: socket.id, - type: 'ioError', - message: 'Connection closed during send. Broken pipe.', - bytesAvailable: 0 - }); - } - } else { - // handle unspecified content-length transfer - var response = socket.options.response; - if(response.readBodyUntilClose) { - response.time = +new Date() - response.time; - response.bodyReceived = true; - socket.options.bodyReady({ - request: socket.options.request, - response: response, - socket: socket - }); - } - socket.options.closed(e); - _handleNextRequest(client, socket); - } - }; - socket.data = function(e) { - socket.sending = false; - var request = socket.options.request; - if(request.aborted) { - socket.close(); - } else { - // receive all bytes available - var response = socket.options.response; - var bytes = socket.receive(e.bytesAvailable); - if(bytes !== null) { - // receive header and then body - socket.buffer.putBytes(bytes); - if(!response.headerReceived) { - response.readHeader(socket.buffer); - if(response.headerReceived) { - socket.options.headerReady({ - request: socket.options.request, - response: response, - socket: socket - }); - } - } - if(response.headerReceived && !response.bodyReceived) { - response.readBody(socket.buffer); - } - if(response.bodyReceived) { - socket.options.bodyReady({ - request: socket.options.request, - response: response, - socket: socket - }); - // close connection if requested or by default on http/1.0 - var value = response.getField('Connection') || ''; - if(value.indexOf('close') != -1 || - (response.version === 'HTTP/1.0' && - response.getField('Keep-Alive') === null)) { - socket.close(); - } else { - _handleNextRequest(client, socket); - } - } - } - } - }; - socket.error = function(e) { - // do error callback, include request - socket.options.error({ - type: e.type, - message: e.message, - request: socket.options.request, - response: socket.options.response, - socket: socket - }); - socket.close(); - }; - - // wrap socket for TLS - if(tlsOptions) { - socket = forge.tls.wrapSocket({ - sessionId: null, - sessionCache: {}, - caStore: tlsOptions.caStore, - cipherSuites: tlsOptions.cipherSuites, - socket: socket, - virtualHost: tlsOptions.virtualHost, - verify: tlsOptions.verify, - getCertificate: tlsOptions.getCertificate, - getPrivateKey: tlsOptions.getPrivateKey, - getSignature: tlsOptions.getSignature, - deflate: tlsOptions.deflate || null, - inflate: tlsOptions.inflate || null - }); - - socket.options = null; - socket.buffer = forge.util.createBuffer(); - client.sockets.push(socket); - if(tlsOptions.prime) { - // prime socket by connecting and caching TLS session, will do - // next request from there - socket.connect({ - host: client.url.host, - port: client.url.port, - policyPort: client.policyPort, - policyUrl: client.policyUrl - }); - } else { - // do not prime socket, just add as idle - client.idle.push(socket); - } - } else { - // no need to prime non-TLS sockets - socket.buffer = forge.util.createBuffer(); - client.sockets.push(socket); - client.idle.push(socket); - } -}; - -/** - * Checks to see if the given cookie has expired. If the cookie's max-age - * plus its created time is less than the time now, it has expired, unless - * its max-age is set to -1 which indicates it will never expire. - * - * @param cookie the cookie to check. - * - * @return true if it has expired, false if not. - */ -var _hasCookieExpired = function(cookie) { - var rval = false; - - if(cookie.maxAge !== -1) { - var now = _getUtcTime(new Date()); - var expires = cookie.created + cookie.maxAge; - if(expires <= now) { - rval = true; - } - } - - return rval; -}; - -/** - * Adds cookies in the given client to the given request. - * - * @param client the client. - * @param request the request. - */ -var _writeCookies = function(client, request) { - var expired = []; - var url = client.url; - var cookies = client.cookies; - for(var name in cookies) { - // get cookie paths - var paths = cookies[name]; - for(var p in paths) { - var cookie = paths[p]; - if(_hasCookieExpired(cookie)) { - // store for clean up - expired.push(cookie); - } else if(request.path.indexOf(cookie.path) === 0) { - // path or path's ancestor must match cookie.path - request.addCookie(cookie); - } - } - } - - // clean up expired cookies - for(var i = 0; i < expired.length; ++i) { - var cookie = expired[i]; - client.removeCookie(cookie.name, cookie.path); - } -}; - -/** - * Gets cookies from the given response and adds the to the given client. - * - * @param client the client. - * @param response the response. - */ -var _readCookies = function(client, response) { - var cookies = response.getCookies(); - for(var i = 0; i < cookies.length; ++i) { - try { - client.setCookie(cookies[i]); - } catch(ex) { - // ignore failure to add other-domain, etc. cookies - } - } -}; - -/** - * Creates an http client that uses forge.net sockets as a backend and - * forge.tls for security. - * - * @param options: - * url: the url to connect to (scheme://host:port). - * socketPool: the flash socket pool to use. - * policyPort: the flash policy port to use (if other than the - * socket pool default), use 0 for flash default. - * policyUrl: the flash policy file URL to use (if provided will - * be used instead of a policy port). - * connections: number of connections to use to handle requests. - * caCerts: an array of certificates to trust for TLS, certs may - * be PEM-formatted or cert objects produced via forge.pki. - * cipherSuites: an optional array of cipher suites to use, - * see forge.tls.CipherSuites. - * virtualHost: the virtual server name to use in a TLS SNI - * extension, if not provided the url host will be used. - * verify: a custom TLS certificate verify callback to use. - * getCertificate: an optional callback used to get a client-side - * certificate (see forge.tls for details). - * getPrivateKey: an optional callback used to get a client-side - * private key (see forge.tls for details). - * getSignature: an optional callback used to get a client-side - * signature (see forge.tls for details). - * persistCookies: true to use persistent cookies via flash local - * storage, false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on - * their creation so that they will cache TLS sessions for reuse. - * - * @return the client. - */ -http.createClient = function(options) { - // create CA store to share with all TLS connections - var caStore = null; - if(options.caCerts) { - caStore = forge.pki.createCaStore(options.caCerts); - } - - // get scheme, host, and port from url - options.url = (options.url || - window.location.protocol + '//' + window.location.host); - var url = http.parseUrl(options.url); - if(!url) { - var error = new Error('Invalid url.'); - error.details = {url: options.url}; - throw error; - } - - // default to 1 connection - options.connections = options.connections || 1; - - // create client - var sp = options.socketPool; - var client = { - // url - url: url, - // socket pool - socketPool: sp, - // the policy port to use - policyPort: options.policyPort, - // policy url to use - policyUrl: options.policyUrl, - // queue of requests to service - requests: [], - // all sockets - sockets: [], - // idle sockets - idle: [], - // whether or not the connections are secure - secure: (url.scheme === 'https'), - // cookie jar (key'd off of name and then path, there is only 1 domain - // and one setting for secure per client so name+path is unique) - cookies: {}, - // default to flash storage of cookies - persistCookies: (typeof(options.persistCookies) === 'undefined') ? - true : options.persistCookies - }; - - // add client to debug storage - if(forge.debug) { - forge.debug.get('forge.http', 'clients').push(client); - } - - // load cookies from disk - _loadCookies(client); - - /** - * A default certificate verify function that checks a certificate common - * name against the client's URL host. - * - * @param c the TLS connection. - * @param verified true if cert is verified, otherwise alert number. - * @param depth the chain depth. - * @param certs the cert chain. - * - * @return true if verified and the common name matches the host, error - * otherwise. - */ - var _defaultCertificateVerify = function(c, verified, depth, certs) { - if(depth === 0 && verified === true) { - // compare common name to url host - var cn = certs[depth].subject.getField('CN'); - if(cn === null || client.url.host !== cn.value) { - verified = { - message: 'Certificate common name does not match url host.' - }; - } - } - return verified; - }; - - // determine if TLS is used - var tlsOptions = null; - if(client.secure) { - tlsOptions = { - caStore: caStore, - cipherSuites: options.cipherSuites || null, - virtualHost: options.virtualHost || url.host, - verify: options.verify || _defaultCertificateVerify, - getCertificate: options.getCertificate || null, - getPrivateKey: options.getPrivateKey || null, - getSignature: options.getSignature || null, - prime: options.primeTlsSockets || false - }; - - // if socket pool uses a flash api, then add deflate support to TLS - if(sp.flashApi !== null) { - tlsOptions.deflate = function(bytes) { - // strip 2 byte zlib header and 4 byte trailer - return forge.util.deflate(sp.flashApi, bytes, true); - }; - tlsOptions.inflate = function(bytes) { - return forge.util.inflate(sp.flashApi, bytes, true); - }; - } - } - - // create and initialize sockets - for(var i = 0; i < options.connections; ++i) { - _initSocket(client, sp.createSocket(), tlsOptions); - } - - /** - * Sends a request. A method 'abort' will be set on the request that - * can be called to attempt to abort the request. - * - * @param options: - * request: the request to send. - * connected: a callback for when the connection is open. - * closed: a callback for when the connection is closed. - * headerReady: a callback for when the response header arrives. - * bodyReady: a callback for when the response body arrives. - * error: a callback for if an error occurs. - */ - client.send = function(options) { - // add host header if not set - if(options.request.getField('Host') === null) { - options.request.setField('Host', client.url.fullHost); - } - - // set default dummy handlers - var opts = {}; - opts.request = options.request; - opts.connected = options.connected || function() {}; - opts.closed = options.close || function() {}; - opts.headerReady = function(e) { - // read cookies - _readCookies(client, e.response); - if(options.headerReady) { - options.headerReady(e); - } - }; - opts.bodyReady = options.bodyReady || function() {}; - opts.error = options.error || function() {}; - - // create response - opts.response = http.createResponse(); - opts.response.time = 0; - opts.response.flashApi = client.socketPool.flashApi; - opts.request.flashApi = client.socketPool.flashApi; - - // create abort function - opts.request.abort = function() { - // set aborted, clear handlers - opts.request.aborted = true; - opts.connected = function() {}; - opts.closed = function() {}; - opts.headerReady = function() {}; - opts.bodyReady = function() {}; - opts.error = function() {}; - }; - - // add cookies to request - _writeCookies(client, opts.request); - - // queue request options if there are no idle sockets - if(client.idle.length === 0) { - client.requests.push(opts); - } else { - // use an idle socket, prefer an idle *connected* socket first - var socket = null; - var len = client.idle.length; - for(var i = 0; socket === null && i < len; ++i) { - socket = client.idle[i]; - if(socket.isConnected()) { - client.idle.splice(i, 1); - } else { - socket = null; - } - } - // no connected socket available, get unconnected socket - if(socket === null) { - socket = client.idle.pop(); - } - socket.options = opts; - _doRequest(client, socket); - } - }; - - /** - * Destroys this client. - */ - client.destroy = function() { - // clear pending requests, close and destroy sockets - client.requests = []; - for(var i = 0; i < client.sockets.length; ++i) { - client.sockets[i].close(); - client.sockets[i].destroy(); - } - client.socketPool = null; - client.sockets = []; - client.idle = []; - }; - - /** - * Sets a cookie for use with all connections made by this client. Any - * cookie with the same name will be replaced. If the cookie's value - * is undefined, null, or the blank string, the cookie will be removed. - * - * If the cookie's domain doesn't match this client's url host or the - * cookie's secure flag doesn't match this client's url scheme, then - * setting the cookie will fail with an exception. - * - * @param cookie the cookie with parameters: - * name: the name of the cookie. - * value: the value of the cookie. - * comment: an optional comment string. - * maxAge: the age of the cookie in seconds relative to created time. - * secure: true if the cookie must be sent over a secure protocol. - * httpOnly: true to restrict access to the cookie from javascript - * (inaffective since the cookies are stored in javascript). - * path: the path for the cookie. - * domain: optional domain the cookie belongs to (must start with dot). - * version: optional version of the cookie. - * created: creation time, in UTC seconds, of the cookie. - */ - client.setCookie = function(cookie) { - var rval; - if(typeof(cookie.name) !== 'undefined') { - if(cookie.value === null || typeof(cookie.value) === 'undefined' || - cookie.value === '') { - // remove cookie - rval = client.removeCookie(cookie.name, cookie.path); - } else { - // set cookie defaults - cookie.comment = cookie.comment || ''; - cookie.maxAge = cookie.maxAge || 0; - cookie.secure = (typeof(cookie.secure) === 'undefined') ? - true : cookie.secure; - cookie.httpOnly = cookie.httpOnly || true; - cookie.path = cookie.path || '/'; - cookie.domain = cookie.domain || null; - cookie.version = cookie.version || null; - cookie.created = _getUtcTime(new Date()); - - // do secure check - if(cookie.secure !== client.secure) { - var error = new Error('Http client url scheme is incompatible ' + - 'with cookie secure flag.'); - error.url = client.url; - error.cookie = cookie; - throw error; - } - // make sure url host is within cookie.domain - if(!http.withinCookieDomain(client.url, cookie)) { - var error = new Error('Http client url scheme is incompatible ' + - 'with cookie secure flag.'); - error.url = client.url; - error.cookie = cookie; - throw error; - } - - // add new cookie - if(!(cookie.name in client.cookies)) { - client.cookies[cookie.name] = {}; - } - client.cookies[cookie.name][cookie.path] = cookie; - rval = true; - - // save cookies - _saveCookies(client); - } - } - - return rval; - }; - - /** - * Gets a cookie by its name. - * - * @param name the name of the cookie to retrieve. - * @param path an optional path for the cookie (if there are multiple - * cookies with the same name but different paths). - * - * @return the cookie or null if not found. - */ - client.getCookie = function(name, path) { - var rval = null; - if(name in client.cookies) { - var paths = client.cookies[name]; - - // get path-specific cookie - if(path) { - if(path in paths) { - rval = paths[path]; - } - } else { - // get first cookie - for(var p in paths) { - rval = paths[p]; - break; - } - } - } - return rval; - }; - - /** - * Removes a cookie. - * - * @param name the name of the cookie to remove. - * @param path an optional path for the cookie (if there are multiple - * cookies with the same name but different paths). - * - * @return true if a cookie was removed, false if not. - */ - client.removeCookie = function(name, path) { - var rval = false; - if(name in client.cookies) { - // delete the specific path - if(path) { - var paths = client.cookies[name]; - if(path in paths) { - rval = true; - delete client.cookies[name][path]; - // clean up entry if empty - var empty = true; - for(var i in client.cookies[name]) { - empty = false; - break; - } - if(empty) { - delete client.cookies[name]; - } - } - } else { - // delete all cookies with the given name - rval = true; - delete client.cookies[name]; - } - } - if(rval) { - // save cookies - _saveCookies(client); - } - return rval; - }; - - /** - * Clears all cookies stored in this client. - */ - client.clearCookies = function() { - client.cookies = {}; - _clearCookies(client); - }; - - if(forge.log) { - forge.log.debug('forge.http', 'created client', options); - } - - return client; -}; - -/** - * Trims the whitespace off of the beginning and end of a string. - * - * @param str the string to trim. - * - * @return the trimmed string. - */ -var _trimString = function(str) { - return str.replace(/^\s*/, '').replace(/\s*$/, ''); -}; - -/** - * Creates an http header object. - * - * @return the http header object. - */ -var _createHeader = function() { - var header = { - fields: {}, - setField: function(name, value) { - // normalize field name, trim value - header.fields[_normalize(name)] = [_trimString('' + value)]; - }, - appendField: function(name, value) { - name = _normalize(name); - if(!(name in header.fields)) { - header.fields[name] = []; - } - header.fields[name].push(_trimString('' + value)); - }, - getField: function(name, index) { - var rval = null; - name = _normalize(name); - if(name in header.fields) { - index = index || 0; - rval = header.fields[name][index]; - } - return rval; - } - }; - return header; -}; - -/** - * Gets the time in utc seconds given a date. - * - * @param d the date to use. - * - * @return the time in utc seconds. - */ -var _getUtcTime = function(d) { - var utc = +d + d.getTimezoneOffset() * 60000; - return Math.floor(+new Date() / 1000); -}; - -/** - * Creates an http request. - * - * @param options: - * version: the version. - * method: the method. - * path: the path. - * body: the body. - * headers: custom header fields to add, - * eg: [{'Content-Length': 0}]. - * - * @return the http request. - */ -http.createRequest = function(options) { - options = options || {}; - var request = _createHeader(); - request.version = options.version || 'HTTP/1.1'; - request.method = options.method || null; - request.path = options.path || null; - request.body = options.body || null; - request.bodyDeflated = false; - request.flashApi = null; - - // add custom headers - var headers = options.headers || []; - if(!forge.util.isArray(headers)) { - headers = [headers]; - } - for(var i = 0; i < headers.length; ++i) { - for(var name in headers[i]) { - request.appendField(name, headers[i][name]); - } - } - - /** - * Adds a cookie to the request 'Cookie' header. - * - * @param cookie a cookie to add. - */ - request.addCookie = function(cookie) { - var value = ''; - var field = request.getField('Cookie'); - if(field !== null) { - // separate cookies by semi-colons - value = field + '; '; - } - - // get current time in utc seconds - var now = _getUtcTime(new Date()); - - // output cookie name and value - value += cookie.name + '=' + cookie.value; - request.setField('Cookie', value); - }; - - /** - * Converts an http request into a string that can be sent as an - * HTTP request. Does not include any data. - * - * @return the string representation of the request. - */ - request.toString = function() { - /* Sample request header: - GET /some/path/?query HTTP/1.1 - Host: www.someurl.com - Connection: close - Accept-Encoding: deflate - Accept: image/gif, text/html - User-Agent: Mozilla 4.0 - */ - - // set default headers - if(request.getField('User-Agent') === null) { - request.setField('User-Agent', 'forge.http 1.0'); - } - if(request.getField('Accept') === null) { - request.setField('Accept', '*/*'); - } - if(request.getField('Connection') === null) { - request.setField('Connection', 'keep-alive'); - request.setField('Keep-Alive', '115'); - } - - // add Accept-Encoding if not specified - if(request.flashApi !== null && - request.getField('Accept-Encoding') === null) { - request.setField('Accept-Encoding', 'deflate'); - } - - // if the body isn't null, deflate it if its larger than 100 bytes - if(request.flashApi !== null && request.body !== null && - request.getField('Content-Encoding') === null && - !request.bodyDeflated && request.body.length > 100) { - // use flash to compress data - request.body = forge.util.deflate(request.flashApi, request.body); - request.bodyDeflated = true; - request.setField('Content-Encoding', 'deflate'); - request.setField('Content-Length', request.body.length); - } else if(request.body !== null) { - // set content length for body - request.setField('Content-Length', request.body.length); - } - - // build start line - var rval = - request.method.toUpperCase() + ' ' + request.path + ' ' + - request.version + '\r\n'; - - // add each header - for(var name in request.fields) { - var fields = request.fields[name]; - for(var i = 0; i < fields.length; ++i) { - rval += name + ': ' + fields[i] + '\r\n'; - } - } - // final terminating CRLF - rval += '\r\n'; - - return rval; - }; - - return request; -}; - -/** - * Creates an empty http response header. - * - * @return the empty http response header. - */ -http.createResponse = function() { - // private vars - var _first = true; - var _chunkSize = 0; - var _chunksFinished = false; - - // create response - var response = _createHeader(); - response.version = null; - response.code = 0; - response.message = null; - response.body = null; - response.headerReceived = false; - response.bodyReceived = false; - response.flashApi = null; - - /** - * Reads a line that ends in CRLF from a byte buffer. - * - * @param b the byte buffer. - * - * @return the line or null if none was found. - */ - var _readCrlf = function(b) { - var line = null; - var i = b.data.indexOf('\r\n', b.read); - if(i != -1) { - // read line, skip CRLF - line = b.getBytes(i - b.read); - b.getBytes(2); - } - return line; - }; - - /** - * Parses a header field and appends it to the response. - * - * @param line the header field line. - */ - var _parseHeader = function(line) { - var tmp = line.indexOf(':'); - var name = line.substring(0, tmp++); - response.appendField( - name, (tmp < line.length) ? line.substring(tmp) : ''); - }; - - /** - * Reads an http response header from a buffer of bytes. - * - * @param b the byte buffer to parse the header from. - * - * @return true if the whole header was read, false if not. - */ - response.readHeader = function(b) { - // read header lines (each ends in CRLF) - var line = ''; - while(!response.headerReceived && line !== null) { - line = _readCrlf(b); - if(line !== null) { - // parse first line - if(_first) { - _first = false; - var tmp = line.split(' '); - if(tmp.length >= 3) { - response.version = tmp[0]; - response.code = parseInt(tmp[1], 10); - response.message = tmp.slice(2).join(' '); - } else { - // invalid header - var error = new Error('Invalid http response header.'); - error.details = {'line': line}; - throw error; - } - } else if(line.length === 0) { - // handle final line, end of header - response.headerReceived = true; - } else { - _parseHeader(line); - } - } - } - - return response.headerReceived; - }; - - /** - * Reads some chunked http response entity-body from the given buffer of - * bytes. - * - * @param b the byte buffer to read from. - * - * @return true if the whole body was read, false if not. - */ - var _readChunkedBody = function(b) { - /* Chunked transfer-encoding sends data in a series of chunks, - followed by a set of 0-N http trailers. - The format is as follows: - - chunk-size (in hex) CRLF - chunk data (with "chunk-size" many bytes) CRLF - ... (N many chunks) - chunk-size (of 0 indicating the last chunk) CRLF - N many http trailers followed by CRLF - blank line + CRLF (terminates the trailers) - - If there are no http trailers, then after the chunk-size of 0, - there is still a single CRLF (indicating the blank line + CRLF - that terminates the trailers). In other words, you always terminate - the trailers with blank line + CRLF, regardless of 0-N trailers. */ - - /* From RFC-2616, section 3.6.1, here is the pseudo-code for - implementing chunked transfer-encoding: - - length := 0 - read chunk-size, chunk-extension (if any) and CRLF - while (chunk-size > 0) { - read chunk-data and CRLF - append chunk-data to entity-body - length := length + chunk-size - read chunk-size and CRLF - } - read entity-header - while (entity-header not empty) { - append entity-header to existing header fields - read entity-header - } - Content-Length := length - Remove "chunked" from Transfer-Encoding - */ - - var line = ''; - while(line !== null && b.length() > 0) { - // if in the process of reading a chunk - if(_chunkSize > 0) { - // if there are not enough bytes to read chunk and its - // trailing CRLF, we must wait for more data to be received - if(_chunkSize + 2 > b.length()) { - break; - } - - // read chunk data, skip CRLF - response.body += b.getBytes(_chunkSize); - b.getBytes(2); - _chunkSize = 0; - } else if(!_chunksFinished) { - // more chunks, read next chunk-size line - line = _readCrlf(b); - if(line !== null) { - // parse chunk-size (ignore any chunk extension) - _chunkSize = parseInt(line.split(';', 1)[0], 16); - _chunksFinished = (_chunkSize === 0); - } - } else { - // chunks finished, read next trailer - line = _readCrlf(b); - while(line !== null) { - if(line.length > 0) { - // parse trailer - _parseHeader(line); - // read next trailer - line = _readCrlf(b); - } else { - // body received - response.bodyReceived = true; - line = null; - } - } - } - } - - return response.bodyReceived; - }; - - /** - * Reads an http response body from a buffer of bytes. - * - * @param b the byte buffer to read from. - * - * @return true if the whole body was read, false if not. - */ - response.readBody = function(b) { - var contentLength = response.getField('Content-Length'); - var transferEncoding = response.getField('Transfer-Encoding'); - if(contentLength !== null) { - contentLength = parseInt(contentLength); - } - - // read specified length - if(contentLength !== null && contentLength >= 0) { - response.body = response.body || ''; - response.body += b.getBytes(contentLength); - response.bodyReceived = (response.body.length === contentLength); - } else if(transferEncoding !== null) { - // read chunked encoding - if(transferEncoding.indexOf('chunked') != -1) { - response.body = response.body || ''; - _readChunkedBody(b); - } else { - var error = new Error('Unknown Transfer-Encoding.'); - error.details = {'transferEncoding': transferEncoding}; - throw error; - } - } else if((contentLength !== null && contentLength < 0) || - (contentLength === null && - response.getField('Content-Type') !== null)) { - // read all data in the buffer - response.body = response.body || ''; - response.body += b.getBytes(); - response.readBodyUntilClose = true; - } else { - // no body - response.body = null; - response.bodyReceived = true; - } - - if(response.bodyReceived) { - response.time = +new Date() - response.time; - } - - if(response.flashApi !== null && - response.bodyReceived && response.body !== null && - response.getField('Content-Encoding') === 'deflate') { - // inflate using flash api - response.body = forge.util.inflate( - response.flashApi, response.body); - } - - return response.bodyReceived; - }; - - /** - * Parses an array of cookies from the 'Set-Cookie' field, if present. - * - * @return the array of cookies. - */ - response.getCookies = function() { - var rval = []; - - // get Set-Cookie field - if('Set-Cookie' in response.fields) { - var field = response.fields['Set-Cookie']; - - // get current local time in seconds - var now = +new Date() / 1000; - - // regex for parsing 'name1=value1; name2=value2; name3' - var regex = /\s*([^=]*)=?([^;]*)(;|$)/g; - - // examples: - // Set-Cookie: cookie1_name=cookie1_value; max-age=0; path=/ - // Set-Cookie: c2=v2; expires=Thu, 21-Aug-2008 23:47:25 GMT; path=/ - for(var i = 0; i < field.length; ++i) { - var fv = field[i]; - var m; - regex.lastIndex = 0; - var first = true; - var cookie = {}; - do { - m = regex.exec(fv); - if(m !== null) { - var name = _trimString(m[1]); - var value = _trimString(m[2]); - - // cookie_name=value - if(first) { - cookie.name = name; - cookie.value = value; - first = false; - } else { - // property_name=value - name = name.toLowerCase(); - switch(name) { - case 'expires': - // replace hyphens w/spaces so date will parse - value = value.replace(/-/g, ' '); - var secs = Date.parse(value) / 1000; - cookie.maxAge = Math.max(0, secs - now); - break; - case 'max-age': - cookie.maxAge = parseInt(value, 10); - break; - case 'secure': - cookie.secure = true; - break; - case 'httponly': - cookie.httpOnly = true; - break; - default: - if(name !== '') { - cookie[name] = value; - } - } - } - } - } while(m !== null && m[0] !== ''); - rval.push(cookie); - } - } - - return rval; - }; - - /** - * Converts an http response into a string that can be sent as an - * HTTP response. Does not include any data. - * - * @return the string representation of the response. - */ - response.toString = function() { - /* Sample response header: - HTTP/1.0 200 OK - Host: www.someurl.com - Connection: close - */ - - // build start line - var rval = - response.version + ' ' + response.code + ' ' + response.message + '\r\n'; - - // add each header - for(var name in response.fields) { - var fields = response.fields[name]; - for(var i = 0; i < fields.length; ++i) { - rval += name + ': ' + fields[i] + '\r\n'; - } - } - // final terminating CRLF - rval += '\r\n'; - - return rval; - }; - - return response; -}; - -/** - * Parses the scheme, host, and port from an http(s) url. - * - * @param str the url string. - * - * @return the parsed url object or null if the url is invalid. - */ -http.parseUrl = forge.util.parseUrl; - -/** - * Returns true if the given url is within the given cookie's domain. - * - * @param url the url to check. - * @param cookie the cookie or cookie domain to check. - */ -http.withinCookieDomain = function(url, cookie) { - var rval = false; - - // cookie may be null, a cookie object, or a domain string - var domain = (cookie === null || typeof cookie === 'string') ? - cookie : cookie.domain; - - // any domain will do - if(domain === null) { - rval = true; - } else if(domain.charAt(0) === '.') { - // ensure domain starts with a '.' - // parse URL as necessary - if(typeof url === 'string') { - url = http.parseUrl(url); - } - - // add '.' to front of URL host to match against domain - var host = '.' + url.host; - - // if the host ends with domain then it falls within it - var idx = host.lastIndexOf(domain); - if(idx !== -1 && (idx + domain.length === host.length)) { - rval = true; - } - } - - return rval; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/index.all.js b/reverse_engineering/node_modules/node-forge/lib/index.all.js deleted file mode 100644 index 22ba72b6..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/index.all.js +++ /dev/null @@ -1,16 +0,0 @@ -/** - * Node.js module for Forge with extra utils and networking. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = require('./forge'); -// require core forge -require('./index'); -// additional utils and networking support -require('./form'); -require('./socket'); -require('./tlssocket'); -require('./http'); -require('./xhr'); diff --git a/reverse_engineering/node_modules/node-forge/lib/index.js b/reverse_engineering/node_modules/node-forge/lib/index.js deleted file mode 100644 index ea8c14cf..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/index.js +++ /dev/null @@ -1,35 +0,0 @@ -/** - * Node.js module for Forge. - * - * @author Dave Longley - * - * Copyright 2011-2016 Digital Bazaar, Inc. - */ -module.exports = require('./forge'); -require('./aes'); -require('./aesCipherSuites'); -require('./asn1'); -require('./cipher'); -require('./debug'); -require('./des'); -require('./ed25519'); -require('./hmac'); -require('./kem'); -require('./log'); -require('./md.all'); -require('./mgf1'); -require('./pbkdf2'); -require('./pem'); -require('./pkcs1'); -require('./pkcs12'); -require('./pkcs7'); -require('./pki'); -require('./prime'); -require('./prng'); -require('./pss'); -require('./random'); -require('./rc2'); -require('./ssh'); -require('./task'); -require('./tls'); -require('./util'); diff --git a/reverse_engineering/node_modules/node-forge/lib/jsbn.js b/reverse_engineering/node_modules/node-forge/lib/jsbn.js deleted file mode 100644 index 11f965c5..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/jsbn.js +++ /dev/null @@ -1,1264 +0,0 @@ -// Copyright (c) 2005 Tom Wu -// All Rights Reserved. -// See "LICENSE" for details. - -// Basic JavaScript BN library - subset useful for RSA encryption. - -/* -Licensing (LICENSE) -------------------- - -This software is covered under the following copyright: -*/ -/* - * Copyright (c) 2003-2005 Tom Wu - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF - * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * In addition, the following condition applies: - * - * All redistributions must retain an intact copy of this copyright notice - * and disclaimer. - */ -/* -Address all questions regarding this license to: - - Tom Wu - tjw@cs.Stanford.EDU -*/ -var forge = require('./forge'); - -module.exports = forge.jsbn = forge.jsbn || {}; - -// Bits per digit -var dbits; - -// JavaScript engine analysis -var canary = 0xdeadbeefcafe; -var j_lm = ((canary&0xffffff)==0xefcafe); - -// (public) Constructor -function BigInteger(a,b,c) { - this.data = []; - if(a != null) - if("number" == typeof a) this.fromNumber(a,b,c); - else if(b == null && "string" != typeof a) this.fromString(a,256); - else this.fromString(a,b); -} -forge.jsbn.BigInteger = BigInteger; - -// return new, unset BigInteger -function nbi() { return new BigInteger(null); } - -// am: Compute w_j += (x*this_i), propagate carries, -// c is initial carry, returns final carry. -// c < 3*dvalue, x < 2*dvalue, this_i < dvalue -// We need to select the fastest one that works in this environment. - -// am1: use a single mult and divide to get the high bits, -// max digit bits should be 26 because -// max internal value = 2*dvalue^2-2*dvalue (< 2^53) -function am1(i,x,w,j,c,n) { - while(--n >= 0) { - var v = x*this.data[i++]+w.data[j]+c; - c = Math.floor(v/0x4000000); - w.data[j++] = v&0x3ffffff; - } - return c; -} -// am2 avoids a big mult-and-extract completely. -// Max digit bits should be <= 30 because we do bitwise ops -// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) -function am2(i,x,w,j,c,n) { - var xl = x&0x7fff, xh = x>>15; - while(--n >= 0) { - var l = this.data[i]&0x7fff; - var h = this.data[i++]>>15; - var m = xh*l+h*xl; - l = xl*l+((m&0x7fff)<<15)+w.data[j]+(c&0x3fffffff); - c = (l>>>30)+(m>>>15)+xh*h+(c>>>30); - w.data[j++] = l&0x3fffffff; - } - return c; -} -// Alternately, set max digit bits to 28 since some -// browsers slow down when dealing with 32-bit numbers. -function am3(i,x,w,j,c,n) { - var xl = x&0x3fff, xh = x>>14; - while(--n >= 0) { - var l = this.data[i]&0x3fff; - var h = this.data[i++]>>14; - var m = xh*l+h*xl; - l = xl*l+((m&0x3fff)<<14)+w.data[j]+c; - c = (l>>28)+(m>>14)+xh*h; - w.data[j++] = l&0xfffffff; - } - return c; -} - -// node.js (no browser) -if(typeof(navigator) === 'undefined') -{ - BigInteger.prototype.am = am3; - dbits = 28; -} else if(j_lm && (navigator.appName == "Microsoft Internet Explorer")) { - BigInteger.prototype.am = am2; - dbits = 30; -} else if(j_lm && (navigator.appName != "Netscape")) { - BigInteger.prototype.am = am1; - dbits = 26; -} else { // Mozilla/Netscape seems to prefer am3 - BigInteger.prototype.am = am3; - dbits = 28; -} - -BigInteger.prototype.DB = dbits; -BigInteger.prototype.DM = ((1<= 0; --i) r.data[i] = this.data[i]; - r.t = this.t; - r.s = this.s; -} - -// (protected) set from integer value x, -DV <= x < DV -function bnpFromInt(x) { - this.t = 1; - this.s = (x<0)?-1:0; - if(x > 0) this.data[0] = x; - else if(x < -1) this.data[0] = x+this.DV; - else this.t = 0; -} - -// return bigint initialized to value -function nbv(i) { var r = nbi(); r.fromInt(i); return r; } - -// (protected) set from string and radix -function bnpFromString(s,b) { - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 256) k = 8; // byte array - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else { this.fromRadix(s,b); return; } - this.t = 0; - this.s = 0; - var i = s.length, mi = false, sh = 0; - while(--i >= 0) { - var x = (k==8)?s[i]&0xff:intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-") mi = true; - continue; - } - mi = false; - if(sh == 0) - this.data[this.t++] = x; - else if(sh+k > this.DB) { - this.data[this.t-1] |= (x&((1<<(this.DB-sh))-1))<>(this.DB-sh)); - } else - this.data[this.t-1] |= x<= this.DB) sh -= this.DB; - } - if(k == 8 && (s[0]&0x80) != 0) { - this.s = -1; - if(sh > 0) this.data[this.t-1] |= ((1<<(this.DB-sh))-1)< 0 && this.data[this.t-1] == c) --this.t; -} - -// (public) return string representation in given radix -function bnToString(b) { - if(this.s < 0) return "-"+this.negate().toString(b); - var k; - if(b == 16) k = 4; - else if(b == 8) k = 3; - else if(b == 2) k = 1; - else if(b == 32) k = 5; - else if(b == 4) k = 2; - else return this.toRadix(b); - var km = (1< 0) { - if(p < this.DB && (d = this.data[i]>>p) > 0) { m = true; r = int2char(d); } - while(i >= 0) { - if(p < k) { - d = (this.data[i]&((1<>(p+=this.DB-k); - } else { - d = (this.data[i]>>(p-=k))&km; - if(p <= 0) { p += this.DB; --i; } - } - if(d > 0) m = true; - if(m) r += int2char(d); - } - } - return m?r:"0"; -} - -// (public) -this -function bnNegate() { var r = nbi(); BigInteger.ZERO.subTo(this,r); return r; } - -// (public) |this| -function bnAbs() { return (this.s<0)?this.negate():this; } - -// (public) return + if this > a, - if this < a, 0 if equal -function bnCompareTo(a) { - var r = this.s-a.s; - if(r != 0) return r; - var i = this.t; - r = i-a.t; - if(r != 0) return (this.s<0)?-r:r; - while(--i >= 0) if((r=this.data[i]-a.data[i]) != 0) return r; - return 0; -} - -// returns bit length of the integer x -function nbits(x) { - var r = 1, t; - if((t=x>>>16) != 0) { x = t; r += 16; } - if((t=x>>8) != 0) { x = t; r += 8; } - if((t=x>>4) != 0) { x = t; r += 4; } - if((t=x>>2) != 0) { x = t; r += 2; } - if((t=x>>1) != 0) { x = t; r += 1; } - return r; -} - -// (public) return the number of bits in "this" -function bnBitLength() { - if(this.t <= 0) return 0; - return this.DB*(this.t-1)+nbits(this.data[this.t-1]^(this.s&this.DM)); -} - -// (protected) r = this << n*DB -function bnpDLShiftTo(n,r) { - var i; - for(i = this.t-1; i >= 0; --i) r.data[i+n] = this.data[i]; - for(i = n-1; i >= 0; --i) r.data[i] = 0; - r.t = this.t+n; - r.s = this.s; -} - -// (protected) r = this >> n*DB -function bnpDRShiftTo(n,r) { - for(var i = n; i < this.t; ++i) r.data[i-n] = this.data[i]; - r.t = Math.max(this.t-n,0); - r.s = this.s; -} - -// (protected) r = this << n -function bnpLShiftTo(n,r) { - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<= 0; --i) { - r.data[i+ds+1] = (this.data[i]>>cbs)|c; - c = (this.data[i]&bm)<= 0; --i) r.data[i] = 0; - r.data[ds] = c; - r.t = this.t+ds+1; - r.s = this.s; - r.clamp(); -} - -// (protected) r = this >> n -function bnpRShiftTo(n,r) { - r.s = this.s; - var ds = Math.floor(n/this.DB); - if(ds >= this.t) { r.t = 0; return; } - var bs = n%this.DB; - var cbs = this.DB-bs; - var bm = (1<>bs; - for(var i = ds+1; i < this.t; ++i) { - r.data[i-ds-1] |= (this.data[i]&bm)<>bs; - } - if(bs > 0) r.data[this.t-ds-1] |= (this.s&bm)<>= this.DB; - } - if(a.t < this.t) { - c -= a.s; - while(i < this.t) { - c += this.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; - } else { - c += this.s; - while(i < a.t) { - c -= a.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c<0)?-1:0; - if(c < -1) r.data[i++] = this.DV+c; - else if(c > 0) r.data[i++] = c; - r.t = i; - r.clamp(); -} - -// (protected) r = this * a, r != this,a (HAC 14.12) -// "this" should be the larger one if appropriate. -function bnpMultiplyTo(a,r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i+y.t; - while(--i >= 0) r.data[i] = 0; - for(i = 0; i < y.t; ++i) r.data[i+x.t] = x.am(0,y.data[i],r,i,0,x.t); - r.s = 0; - r.clamp(); - if(this.s != a.s) BigInteger.ZERO.subTo(r,r); -} - -// (protected) r = this^2, r != this (HAC 14.16) -function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2*x.t; - while(--i >= 0) r.data[i] = 0; - for(i = 0; i < x.t-1; ++i) { - var c = x.am(i,x.data[i],r,2*i,0,1); - if((r.data[i+x.t]+=x.am(i+1,2*x.data[i],r,2*i+1,c,x.t-i-1)) >= x.DV) { - r.data[i+x.t] -= x.DV; - r.data[i+x.t+1] = 1; - } - } - if(r.t > 0) r.data[r.t-1] += x.am(i,x.data[i],r,2*i,0,1); - r.s = 0; - r.clamp(); -} - -// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) -// r != q, this != m. q or r may be null. -function bnpDivRemTo(m,q,r) { - var pm = m.abs(); - if(pm.t <= 0) return; - var pt = this.abs(); - if(pt.t < pm.t) { - if(q != null) q.fromInt(0); - if(r != null) this.copyTo(r); - return; - } - if(r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB-nbits(pm.data[pm.t-1]); // normalize modulus - if(nsh > 0) { pm.lShiftTo(nsh,y); pt.lShiftTo(nsh,r); } else { pm.copyTo(y); pt.copyTo(r); } - var ys = y.t; - var y0 = y.data[ys-1]; - if(y0 == 0) return; - var yt = y0*(1<1)?y.data[ys-2]>>this.F2:0); - var d1 = this.FV/yt, d2 = (1<= 0) { - r.data[r.t++] = 1; - r.subTo(t,r); - } - BigInteger.ONE.dlShiftTo(ys,t); - t.subTo(y,y); // "negative" y so we can replace sub with am later - while(y.t < ys) y.data[y.t++] = 0; - while(--j >= 0) { - // Estimate quotient digit - var qd = (r.data[--i]==y0)?this.DM:Math.floor(r.data[i]*d1+(r.data[i-1]+e)*d2); - if((r.data[i]+=y.am(0,qd,r,j,0,ys)) < qd) { // Try it out - y.dlShiftTo(j,t); - r.subTo(t,r); - while(r.data[i] < --qd) r.subTo(t,r); - } - } - if(q != null) { - r.drShiftTo(ys,q); - if(ts != ms) BigInteger.ZERO.subTo(q,q); - } - r.t = ys; - r.clamp(); - if(nsh > 0) r.rShiftTo(nsh,r); // Denormalize remainder - if(ts < 0) BigInteger.ZERO.subTo(r,r); -} - -// (public) this mod a -function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a,null,r); - if(this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r,r); - return r; -} - -// Modular reduction using "classic" algorithm -function Classic(m) { this.m = m; } -function cConvert(x) { - if(x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; -} -function cRevert(x) { return x; } -function cReduce(x) { x.divRemTo(this.m,null,x); } -function cMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } -function cSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -Classic.prototype.convert = cConvert; -Classic.prototype.revert = cRevert; -Classic.prototype.reduce = cReduce; -Classic.prototype.mulTo = cMulTo; -Classic.prototype.sqrTo = cSqrTo; - -// (protected) return "-1/this % 2^DB"; useful for Mont. reduction -// justification: -// xy == 1 (mod m) -// xy = 1+km -// xy(2-xy) = (1+km)(1-km) -// x[y(2-xy)] = 1-k^2m^2 -// x[y(2-xy)] == 1 (mod m^2) -// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 -// should reduce x and y(2-xy) by m^2 at each step to keep size bounded. -// JS multiply "overflows" differently from C/C++, so care is needed here. -function bnpInvDigit() { - if(this.t < 1) return 0; - var x = this.data[0]; - if((x&1) == 0) return 0; - var y = x&3; // y == 1/x mod 2^2 - y = (y*(2-(x&0xf)*y))&0xf; // y == 1/x mod 2^4 - y = (y*(2-(x&0xff)*y))&0xff; // y == 1/x mod 2^8 - y = (y*(2-(((x&0xffff)*y)&0xffff)))&0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y*(2-x*y%this.DV))%this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y>0)?this.DV-y:-y; -} - -// Montgomery reduction -function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp&0x7fff; - this.mph = this.mp>>15; - this.um = (1<<(m.DB-15))-1; - this.mt2 = 2*m.t; -} - -// xR mod m -function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t,r); - r.divRemTo(this.m,null,r); - if(x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r,r); - return r; -} - -// x/R mod m -function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; -} - -// x = x/R mod m (HAC 14.32) -function montReduce(x) { - while(x.t <= this.mt2) // pad x so am has enough room later - x.data[x.t++] = 0; - for(var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x.data[i]*mp mod DV - var j = x.data[i]&0x7fff; - var u0 = (j*this.mpl+(((j*this.mph+(x.data[i]>>15)*this.mpl)&this.um)<<15))&x.DM; - // use am to combine the multiply-shift-add into one call - j = i+this.m.t; - x.data[j] += this.m.am(0,u0,x,i,0,this.m.t); - // propagate carry - while(x.data[j] >= x.DV) { x.data[j] -= x.DV; x.data[++j]++; } - } - x.clamp(); - x.drShiftTo(this.m.t,x); - if(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} - -// r = "x^2/R mod m"; x != r -function montSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -// r = "xy/R mod m"; x,y != r -function montMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - -Montgomery.prototype.convert = montConvert; -Montgomery.prototype.revert = montRevert; -Montgomery.prototype.reduce = montReduce; -Montgomery.prototype.mulTo = montMulTo; -Montgomery.prototype.sqrTo = montSqrTo; - -// (protected) true iff this is even -function bnpIsEven() { return ((this.t>0)?(this.data[0]&1):this.s) == 0; } - -// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) -function bnpExp(e,z) { - if(e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e)-1; - g.copyTo(r); - while(--i >= 0) { - z.sqrTo(r,r2); - if((e&(1< 0) z.mulTo(r2,g,r); - else { var t = r; r = r2; r2 = t; } - } - return z.revert(r); -} - -// (public) this^e % m, 0 <= e < 2^32 -function bnModPowInt(e,m) { - var z; - if(e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e,z); -} - -// protected -BigInteger.prototype.copyTo = bnpCopyTo; -BigInteger.prototype.fromInt = bnpFromInt; -BigInteger.prototype.fromString = bnpFromString; -BigInteger.prototype.clamp = bnpClamp; -BigInteger.prototype.dlShiftTo = bnpDLShiftTo; -BigInteger.prototype.drShiftTo = bnpDRShiftTo; -BigInteger.prototype.lShiftTo = bnpLShiftTo; -BigInteger.prototype.rShiftTo = bnpRShiftTo; -BigInteger.prototype.subTo = bnpSubTo; -BigInteger.prototype.multiplyTo = bnpMultiplyTo; -BigInteger.prototype.squareTo = bnpSquareTo; -BigInteger.prototype.divRemTo = bnpDivRemTo; -BigInteger.prototype.invDigit = bnpInvDigit; -BigInteger.prototype.isEven = bnpIsEven; -BigInteger.prototype.exp = bnpExp; - -// public -BigInteger.prototype.toString = bnToString; -BigInteger.prototype.negate = bnNegate; -BigInteger.prototype.abs = bnAbs; -BigInteger.prototype.compareTo = bnCompareTo; -BigInteger.prototype.bitLength = bnBitLength; -BigInteger.prototype.mod = bnMod; -BigInteger.prototype.modPowInt = bnModPowInt; - -// "constants" -BigInteger.ZERO = nbv(0); -BigInteger.ONE = nbv(1); - -// jsbn2 lib - -//Copyright (c) 2005-2009 Tom Wu -//All Rights Reserved. -//See "LICENSE" for details (See jsbn.js for LICENSE). - -//Extended JavaScript BN functions, required for RSA private ops. - -//Version 1.1: new BigInteger("0", 10) returns "proper" zero - -//(public) -function bnClone() { var r = nbi(); this.copyTo(r); return r; } - -//(public) return value as integer -function bnIntValue() { -if(this.s < 0) { - if(this.t == 1) return this.data[0]-this.DV; - else if(this.t == 0) return -1; -} else if(this.t == 1) return this.data[0]; -else if(this.t == 0) return 0; -// assumes 16 < DB < 32 -return ((this.data[1]&((1<<(32-this.DB))-1))<>24; } - -//(public) return value as short (assumes DB>=16) -function bnShortValue() { return (this.t==0)?this.s:(this.data[0]<<16)>>16; } - -//(protected) return x s.t. r^x < DV -function bnpChunkSize(r) { return Math.floor(Math.LN2*this.DB/Math.log(r)); } - -//(public) 0 if this == 0, 1 if this > 0 -function bnSigNum() { -if(this.s < 0) return -1; -else if(this.t <= 0 || (this.t == 1 && this.data[0] <= 0)) return 0; -else return 1; -} - -//(protected) convert to radix string -function bnpToRadix(b) { -if(b == null) b = 10; -if(this.signum() == 0 || b < 2 || b > 36) return "0"; -var cs = this.chunkSize(b); -var a = Math.pow(b,cs); -var d = nbv(a), y = nbi(), z = nbi(), r = ""; -this.divRemTo(d,y,z); -while(y.signum() > 0) { - r = (a+z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d,y,z); -} -return z.intValue().toString(b) + r; -} - -//(protected) convert from radix string -function bnpFromRadix(s,b) { -this.fromInt(0); -if(b == null) b = 10; -var cs = this.chunkSize(b); -var d = Math.pow(b,cs), mi = false, j = 0, w = 0; -for(var i = 0; i < s.length; ++i) { - var x = intAt(s,i); - if(x < 0) { - if(s.charAt(i) == "-" && this.signum() == 0) mi = true; - continue; - } - w = b*w+x; - if(++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w,0); - j = 0; - w = 0; - } -} -if(j > 0) { - this.dMultiply(Math.pow(b,j)); - this.dAddOffset(w,0); -} -if(mi) BigInteger.ZERO.subTo(this,this); -} - -//(protected) alternate constructor -function bnpFromNumber(a,b,c) { -if("number" == typeof b) { - // new BigInteger(int,int,RNG) - if(a < 2) this.fromInt(1); - else { - this.fromNumber(a,c); - if(!this.testBit(a-1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a-1),op_or,this); - if(this.isEven()) this.dAddOffset(1,0); // force odd - while(!this.isProbablePrime(b)) { - this.dAddOffset(2,0); - if(this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a-1),this); - } - } -} else { - // new BigInteger(int,RNG) - var x = new Array(), t = a&7; - x.length = (a>>3)+1; - b.nextBytes(x); - if(t > 0) x[0] &= ((1< 0) { - if(p < this.DB && (d = this.data[i]>>p) != (this.s&this.DM)>>p) - r[k++] = d|(this.s<<(this.DB-p)); - while(i >= 0) { - if(p < 8) { - d = (this.data[i]&((1<>(p+=this.DB-8); - } else { - d = (this.data[i]>>(p-=8))&0xff; - if(p <= 0) { p += this.DB; --i; } - } - if((d&0x80) != 0) d |= -256; - if(k == 0 && (this.s&0x80) != (d&0x80)) ++k; - if(k > 0 || d != this.s) r[k++] = d; - } -} -return r; -} - -function bnEquals(a) { return(this.compareTo(a)==0); } -function bnMin(a) { return(this.compareTo(a)<0)?this:a; } -function bnMax(a) { return(this.compareTo(a)>0)?this:a; } - -//(protected) r = this op a (bitwise) -function bnpBitwiseTo(a,op,r) { -var i, f, m = Math.min(a.t,this.t); -for(i = 0; i < m; ++i) r.data[i] = op(this.data[i],a.data[i]); -if(a.t < this.t) { - f = a.s&this.DM; - for(i = m; i < this.t; ++i) r.data[i] = op(this.data[i],f); - r.t = this.t; -} else { - f = this.s&this.DM; - for(i = m; i < a.t; ++i) r.data[i] = op(f,a.data[i]); - r.t = a.t; -} -r.s = op(this.s,a.s); -r.clamp(); -} - -//(public) this & a -function op_and(x,y) { return x&y; } -function bnAnd(a) { var r = nbi(); this.bitwiseTo(a,op_and,r); return r; } - -//(public) this | a -function op_or(x,y) { return x|y; } -function bnOr(a) { var r = nbi(); this.bitwiseTo(a,op_or,r); return r; } - -//(public) this ^ a -function op_xor(x,y) { return x^y; } -function bnXor(a) { var r = nbi(); this.bitwiseTo(a,op_xor,r); return r; } - -//(public) this & ~a -function op_andnot(x,y) { return x&~y; } -function bnAndNot(a) { var r = nbi(); this.bitwiseTo(a,op_andnot,r); return r; } - -//(public) ~this -function bnNot() { -var r = nbi(); -for(var i = 0; i < this.t; ++i) r.data[i] = this.DM&~this.data[i]; -r.t = this.t; -r.s = ~this.s; -return r; -} - -//(public) this << n -function bnShiftLeft(n) { -var r = nbi(); -if(n < 0) this.rShiftTo(-n,r); else this.lShiftTo(n,r); -return r; -} - -//(public) this >> n -function bnShiftRight(n) { -var r = nbi(); -if(n < 0) this.lShiftTo(-n,r); else this.rShiftTo(n,r); -return r; -} - -//return index of lowest 1-bit in x, x < 2^31 -function lbit(x) { -if(x == 0) return -1; -var r = 0; -if((x&0xffff) == 0) { x >>= 16; r += 16; } -if((x&0xff) == 0) { x >>= 8; r += 8; } -if((x&0xf) == 0) { x >>= 4; r += 4; } -if((x&3) == 0) { x >>= 2; r += 2; } -if((x&1) == 0) ++r; -return r; -} - -//(public) returns index of lowest 1-bit (or -1 if none) -function bnGetLowestSetBit() { -for(var i = 0; i < this.t; ++i) - if(this.data[i] != 0) return i*this.DB+lbit(this.data[i]); -if(this.s < 0) return this.t*this.DB; -return -1; -} - -//return number of 1 bits in x -function cbit(x) { -var r = 0; -while(x != 0) { x &= x-1; ++r; } -return r; -} - -//(public) return number of set bits -function bnBitCount() { -var r = 0, x = this.s&this.DM; -for(var i = 0; i < this.t; ++i) r += cbit(this.data[i]^x); -return r; -} - -//(public) true iff nth bit is set -function bnTestBit(n) { -var j = Math.floor(n/this.DB); -if(j >= this.t) return(this.s!=0); -return((this.data[j]&(1<<(n%this.DB)))!=0); -} - -//(protected) this op (1<>= this.DB; -} -if(a.t < this.t) { - c += a.s; - while(i < this.t) { - c += this.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += this.s; -} else { - c += this.s; - while(i < a.t) { - c += a.data[i]; - r.data[i++] = c&this.DM; - c >>= this.DB; - } - c += a.s; -} -r.s = (c<0)?-1:0; -if(c > 0) r.data[i++] = c; -else if(c < -1) r.data[i++] = this.DV+c; -r.t = i; -r.clamp(); -} - -//(public) this + a -function bnAdd(a) { var r = nbi(); this.addTo(a,r); return r; } - -//(public) this - a -function bnSubtract(a) { var r = nbi(); this.subTo(a,r); return r; } - -//(public) this * a -function bnMultiply(a) { var r = nbi(); this.multiplyTo(a,r); return r; } - -//(public) this / a -function bnDivide(a) { var r = nbi(); this.divRemTo(a,r,null); return r; } - -//(public) this % a -function bnRemainder(a) { var r = nbi(); this.divRemTo(a,null,r); return r; } - -//(public) [this/a,this%a] -function bnDivideAndRemainder(a) { -var q = nbi(), r = nbi(); -this.divRemTo(a,q,r); -return new Array(q,r); -} - -//(protected) this *= n, this >= 0, 1 < n < DV -function bnpDMultiply(n) { -this.data[this.t] = this.am(0,n-1,this,0,0,this.t); -++this.t; -this.clamp(); -} - -//(protected) this += n << w words, this >= 0 -function bnpDAddOffset(n,w) { -if(n == 0) return; -while(this.t <= w) this.data[this.t++] = 0; -this.data[w] += n; -while(this.data[w] >= this.DV) { - this.data[w] -= this.DV; - if(++w >= this.t) this.data[this.t++] = 0; - ++this.data[w]; -} -} - -//A "null" reducer -function NullExp() {} -function nNop(x) { return x; } -function nMulTo(x,y,r) { x.multiplyTo(y,r); } -function nSqrTo(x,r) { x.squareTo(r); } - -NullExp.prototype.convert = nNop; -NullExp.prototype.revert = nNop; -NullExp.prototype.mulTo = nMulTo; -NullExp.prototype.sqrTo = nSqrTo; - -//(public) this^e -function bnPow(e) { return this.exp(e,new NullExp()); } - -//(protected) r = lower n words of "this * a", a.t <= n -//"this" should be the larger one if appropriate. -function bnpMultiplyLowerTo(a,n,r) { -var i = Math.min(this.t+a.t,n); -r.s = 0; // assumes a,this >= 0 -r.t = i; -while(i > 0) r.data[--i] = 0; -var j; -for(j = r.t-this.t; i < j; ++i) r.data[i+this.t] = this.am(0,a.data[i],r,i,0,this.t); -for(j = Math.min(a.t,n); i < j; ++i) this.am(0,a.data[i],r,i,0,n-i); -r.clamp(); -} - -//(protected) r = "this * a" without lower n words, n > 0 -//"this" should be the larger one if appropriate. -function bnpMultiplyUpperTo(a,n,r) { ---n; -var i = r.t = this.t+a.t-n; -r.s = 0; // assumes a,this >= 0 -while(--i >= 0) r.data[i] = 0; -for(i = Math.max(n-this.t,0); i < a.t; ++i) - r.data[this.t+i-n] = this.am(n-i,a.data[i],r,0,0,this.t+i-n); -r.clamp(); -r.drShiftTo(1,r); -} - -//Barrett modular reduction -function Barrett(m) { -// setup Barrett -this.r2 = nbi(); -this.q3 = nbi(); -BigInteger.ONE.dlShiftTo(2*m.t,this.r2); -this.mu = this.r2.divide(m); -this.m = m; -} - -function barrettConvert(x) { -if(x.s < 0 || x.t > 2*this.m.t) return x.mod(this.m); -else if(x.compareTo(this.m) < 0) return x; -else { var r = nbi(); x.copyTo(r); this.reduce(r); return r; } -} - -function barrettRevert(x) { return x; } - -//x = x mod m (HAC 14.42) -function barrettReduce(x) { -x.drShiftTo(this.m.t-1,this.r2); -if(x.t > this.m.t+1) { x.t = this.m.t+1; x.clamp(); } -this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3); -this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2); -while(x.compareTo(this.r2) < 0) x.dAddOffset(1,this.m.t+1); -x.subTo(this.r2,x); -while(x.compareTo(this.m) >= 0) x.subTo(this.m,x); -} - -//r = x^2 mod m; x != r -function barrettSqrTo(x,r) { x.squareTo(r); this.reduce(r); } - -//r = x*y mod m; x,y != r -function barrettMulTo(x,y,r) { x.multiplyTo(y,r); this.reduce(r); } - -Barrett.prototype.convert = barrettConvert; -Barrett.prototype.revert = barrettRevert; -Barrett.prototype.reduce = barrettReduce; -Barrett.prototype.mulTo = barrettMulTo; -Barrett.prototype.sqrTo = barrettSqrTo; - -//(public) this^e % m (HAC 14.85) -function bnModPow(e,m) { -var i = e.bitLength(), k, r = nbv(1), z; -if(i <= 0) return r; -else if(i < 18) k = 1; -else if(i < 48) k = 3; -else if(i < 144) k = 4; -else if(i < 768) k = 5; -else k = 6; -if(i < 8) - z = new Classic(m); -else if(m.isEven()) - z = new Barrett(m); -else - z = new Montgomery(m); - -// precomputation -var g = new Array(), n = 3, k1 = k-1, km = (1< 1) { - var g2 = nbi(); - z.sqrTo(g[1],g2); - while(n <= km) { - g[n] = nbi(); - z.mulTo(g2,g[n-2],g[n]); - n += 2; - } -} - -var j = e.t-1, w, is1 = true, r2 = nbi(), t; -i = nbits(e.data[j])-1; -while(j >= 0) { - if(i >= k1) w = (e.data[j]>>(i-k1))&km; - else { - w = (e.data[j]&((1<<(i+1))-1))<<(k1-i); - if(j > 0) w |= e.data[j-1]>>(this.DB+i-k1); - } - - n = k; - while((w&1) == 0) { w >>= 1; --n; } - if((i -= n) < 0) { i += this.DB; --j; } - if(is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } else { - while(n > 1) { z.sqrTo(r,r2); z.sqrTo(r2,r); n -= 2; } - if(n > 0) z.sqrTo(r,r2); else { t = r; r = r2; r2 = t; } - z.mulTo(r2,g[w],r); - } - - while(j >= 0 && (e.data[j]&(1< 0) { - x.rShiftTo(g,x); - y.rShiftTo(g,y); -} -while(x.signum() > 0) { - if((i = x.getLowestSetBit()) > 0) x.rShiftTo(i,x); - if((i = y.getLowestSetBit()) > 0) y.rShiftTo(i,y); - if(x.compareTo(y) >= 0) { - x.subTo(y,x); - x.rShiftTo(1,x); - } else { - y.subTo(x,y); - y.rShiftTo(1,y); - } -} -if(g > 0) y.lShiftTo(g,y); -return y; -} - -//(protected) this % n, n < 2^26 -function bnpModInt(n) { -if(n <= 0) return 0; -var d = this.DV%n, r = (this.s<0)?n-1:0; -if(this.t > 0) - if(d == 0) r = this.data[0]%n; - else for(var i = this.t-1; i >= 0; --i) r = (d*r+this.data[i])%n; -return r; -} - -//(public) 1/this % m (HAC 14.61) -function bnModInverse(m) { -var ac = m.isEven(); -if((this.isEven() && ac) || m.signum() == 0) return BigInteger.ZERO; -var u = m.clone(), v = this.clone(); -var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); -while(u.signum() != 0) { - while(u.isEven()) { - u.rShiftTo(1,u); - if(ac) { - if(!a.isEven() || !b.isEven()) { a.addTo(this,a); b.subTo(m,b); } - a.rShiftTo(1,a); - } else if(!b.isEven()) b.subTo(m,b); - b.rShiftTo(1,b); - } - while(v.isEven()) { - v.rShiftTo(1,v); - if(ac) { - if(!c.isEven() || !d.isEven()) { c.addTo(this,c); d.subTo(m,d); } - c.rShiftTo(1,c); - } else if(!d.isEven()) d.subTo(m,d); - d.rShiftTo(1,d); - } - if(u.compareTo(v) >= 0) { - u.subTo(v,u); - if(ac) a.subTo(c,a); - b.subTo(d,b); - } else { - v.subTo(u,v); - if(ac) c.subTo(a,c); - d.subTo(b,d); - } -} -if(v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; -if(d.compareTo(m) >= 0) return d.subtract(m); -if(d.signum() < 0) d.addTo(m,d); else return d; -if(d.signum() < 0) return d.add(m); else return d; -} - -var lowprimes = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509]; -var lplim = (1<<26)/lowprimes[lowprimes.length-1]; - -//(public) test primality with certainty >= 1-.5^t -function bnIsProbablePrime(t) { -var i, x = this.abs(); -if(x.t == 1 && x.data[0] <= lowprimes[lowprimes.length-1]) { - for(i = 0; i < lowprimes.length; ++i) - if(x.data[0] == lowprimes[i]) return true; - return false; -} -if(x.isEven()) return false; -i = 1; -while(i < lowprimes.length) { - var m = lowprimes[i], j = i+1; - while(j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while(i < j) if(m%lowprimes[i++] == 0) return false; -} -return x.millerRabin(t); -} - -//(protected) true if probably prime (HAC 4.24, Miller-Rabin) -function bnpMillerRabin(t) { -var n1 = this.subtract(BigInteger.ONE); -var k = n1.getLowestSetBit(); -if(k <= 0) return false; -var r = n1.shiftRight(k); -var prng = bnGetPrng(); -var a; -for(var i = 0; i < t; ++i) { - // select witness 'a' at random from between 1 and n1 - do { - a = new BigInteger(this.bitLength(), prng); - } - while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0); - var y = a.modPow(r,this); - if(y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while(j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2,this); - if(y.compareTo(BigInteger.ONE) == 0) return false; - } - if(y.compareTo(n1) != 0) return false; - } -} -return true; -} - -// get pseudo random number generator -function bnGetPrng() { - // create prng with api that matches BigInteger secure random - return { - // x is an array to fill with bytes - nextBytes: function(x) { - for(var i = 0; i < x.length; ++i) { - x[i] = Math.floor(Math.random() * 0x0100); - } - } - }; -} - -//protected -BigInteger.prototype.chunkSize = bnpChunkSize; -BigInteger.prototype.toRadix = bnpToRadix; -BigInteger.prototype.fromRadix = bnpFromRadix; -BigInteger.prototype.fromNumber = bnpFromNumber; -BigInteger.prototype.bitwiseTo = bnpBitwiseTo; -BigInteger.prototype.changeBit = bnpChangeBit; -BigInteger.prototype.addTo = bnpAddTo; -BigInteger.prototype.dMultiply = bnpDMultiply; -BigInteger.prototype.dAddOffset = bnpDAddOffset; -BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; -BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; -BigInteger.prototype.modInt = bnpModInt; -BigInteger.prototype.millerRabin = bnpMillerRabin; - -//public -BigInteger.prototype.clone = bnClone; -BigInteger.prototype.intValue = bnIntValue; -BigInteger.prototype.byteValue = bnByteValue; -BigInteger.prototype.shortValue = bnShortValue; -BigInteger.prototype.signum = bnSigNum; -BigInteger.prototype.toByteArray = bnToByteArray; -BigInteger.prototype.equals = bnEquals; -BigInteger.prototype.min = bnMin; -BigInteger.prototype.max = bnMax; -BigInteger.prototype.and = bnAnd; -BigInteger.prototype.or = bnOr; -BigInteger.prototype.xor = bnXor; -BigInteger.prototype.andNot = bnAndNot; -BigInteger.prototype.not = bnNot; -BigInteger.prototype.shiftLeft = bnShiftLeft; -BigInteger.prototype.shiftRight = bnShiftRight; -BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; -BigInteger.prototype.bitCount = bnBitCount; -BigInteger.prototype.testBit = bnTestBit; -BigInteger.prototype.setBit = bnSetBit; -BigInteger.prototype.clearBit = bnClearBit; -BigInteger.prototype.flipBit = bnFlipBit; -BigInteger.prototype.add = bnAdd; -BigInteger.prototype.subtract = bnSubtract; -BigInteger.prototype.multiply = bnMultiply; -BigInteger.prototype.divide = bnDivide; -BigInteger.prototype.remainder = bnRemainder; -BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; -BigInteger.prototype.modPow = bnModPow; -BigInteger.prototype.modInverse = bnModInverse; -BigInteger.prototype.pow = bnPow; -BigInteger.prototype.gcd = bnGCD; -BigInteger.prototype.isProbablePrime = bnIsProbablePrime; - -//BigInteger interfaces not implemented in jsbn: - -//BigInteger(int signum, byte[] magnitude) -//double doubleValue() -//float floatValue() -//int hashCode() -//long longValue() -//static BigInteger valueOf(long val) diff --git a/reverse_engineering/node_modules/node-forge/lib/kem.js b/reverse_engineering/node_modules/node-forge/lib/kem.js deleted file mode 100644 index 1967016d..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/kem.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * Javascript implementation of RSA-KEM. - * - * @author Lautaro Cozzani Rodriguez - * @author Dave Longley - * - * Copyright (c) 2014 Lautaro Cozzani - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./random'); -require('./jsbn'); - -module.exports = forge.kem = forge.kem || {}; - -var BigInteger = forge.jsbn.BigInteger; - -/** - * The API for the RSA Key Encapsulation Mechanism (RSA-KEM) from ISO 18033-2. - */ -forge.kem.rsa = {}; - -/** - * Creates an RSA KEM API object for generating a secret asymmetric key. - * - * The symmetric key may be generated via a call to 'encrypt', which will - * produce a ciphertext to be transmitted to the recipient and a key to be - * kept secret. The ciphertext is a parameter to be passed to 'decrypt' which - * will produce the same secret key for the recipient to use to decrypt a - * message that was encrypted with the secret key. - * - * @param kdf the KDF API to use (eg: new forge.kem.kdf1()). - * @param options the options to use. - * [prng] a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - */ -forge.kem.rsa.create = function(kdf, options) { - options = options || {}; - var prng = options.prng || forge.random; - - var kem = {}; - - /** - * Generates a secret key and its encapsulation. - * - * @param publicKey the RSA public key to encrypt with. - * @param keyLength the length, in bytes, of the secret key to generate. - * - * @return an object with: - * encapsulation: the ciphertext for generating the secret key, as a - * binary-encoded string of bytes. - * key: the secret key to use for encrypting a message. - */ - kem.encrypt = function(publicKey, keyLength) { - // generate a random r where 1 < r < n - var byteLength = Math.ceil(publicKey.n.bitLength() / 8); - var r; - do { - r = new BigInteger( - forge.util.bytesToHex(prng.getBytesSync(byteLength)), - 16).mod(publicKey.n); - } while(r.compareTo(BigInteger.ONE) <= 0); - - // prepend r with zeros - r = forge.util.hexToBytes(r.toString(16)); - var zeros = byteLength - r.length; - if(zeros > 0) { - r = forge.util.fillString(String.fromCharCode(0), zeros) + r; - } - - // encrypt the random - var encapsulation = publicKey.encrypt(r, 'NONE'); - - // generate the secret key - var key = kdf.generate(r, keyLength); - - return {encapsulation: encapsulation, key: key}; - }; - - /** - * Decrypts an encapsulated secret key. - * - * @param privateKey the RSA private key to decrypt with. - * @param encapsulation the ciphertext for generating the secret key, as - * a binary-encoded string of bytes. - * @param keyLength the length, in bytes, of the secret key to generate. - * - * @return the secret key as a binary-encoded string of bytes. - */ - kem.decrypt = function(privateKey, encapsulation, keyLength) { - // decrypt the encapsulation and generate the secret key - var r = privateKey.decrypt(encapsulation, 'NONE'); - return kdf.generate(r, keyLength); - }; - - return kem; -}; - -// TODO: add forge.kem.kdf.create('KDF1', {md: ..., ...}) API? - -/** - * Creates a key derivation API object that implements KDF1 per ISO 18033-2. - * - * @param md the hash API to use. - * @param [digestLength] an optional digest length that must be positive and - * less than or equal to md.digestLength. - * - * @return a KDF1 API object. - */ -forge.kem.kdf1 = function(md, digestLength) { - _createKDF(this, md, 0, digestLength || md.digestLength); -}; - -/** - * Creates a key derivation API object that implements KDF2 per ISO 18033-2. - * - * @param md the hash API to use. - * @param [digestLength] an optional digest length that must be positive and - * less than or equal to md.digestLength. - * - * @return a KDF2 API object. - */ -forge.kem.kdf2 = function(md, digestLength) { - _createKDF(this, md, 1, digestLength || md.digestLength); -}; - -/** - * Creates a KDF1 or KDF2 API object. - * - * @param md the hash API to use. - * @param counterStart the starting index for the counter. - * @param digestLength the digest length to use. - * - * @return the KDF API object. - */ -function _createKDF(kdf, md, counterStart, digestLength) { - /** - * Generate a key of the specified length. - * - * @param x the binary-encoded byte string to generate a key from. - * @param length the number of bytes to generate (the size of the key). - * - * @return the key as a binary-encoded string. - */ - kdf.generate = function(x, length) { - var key = new forge.util.ByteBuffer(); - - // run counter from counterStart to ceil(length / Hash.len) - var k = Math.ceil(length / digestLength) + counterStart; - - var c = new forge.util.ByteBuffer(); - for(var i = counterStart; i < k; ++i) { - // I2OSP(i, 4): convert counter to an octet string of 4 octets - c.putInt32(i); - - // digest 'x' and the counter and add the result to the key - md.start(); - md.update(x + c.getBytes()); - var hash = md.digest(); - key.putBytes(hash.getBytes(digestLength)); - } - - // truncate to the correct key length - key.truncate(key.length() - length); - return key.getBytes(); - }; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/log.js b/reverse_engineering/node_modules/node-forge/lib/log.js deleted file mode 100644 index 8d36f4a8..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/log.js +++ /dev/null @@ -1,317 +0,0 @@ -/** - * Cross-browser support for logging in a web application. - * - * @author David I. Lehn - * - * Copyright (c) 2008-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -/* LOG API */ -module.exports = forge.log = forge.log || {}; - -/** - * Application logging system. - * - * Each logger level available as it's own function of the form: - * forge.log.level(category, args...) - * The category is an arbitrary string, and the args are the same as - * Firebug's console.log API. By default the call will be output as: - * 'LEVEL [category] , args[1], ...' - * This enables proper % formatting via the first argument. - * Each category is enabled by default but can be enabled or disabled with - * the setCategoryEnabled() function. - */ -// list of known levels -forge.log.levels = [ - 'none', 'error', 'warning', 'info', 'debug', 'verbose', 'max']; -// info on the levels indexed by name: -// index: level index -// name: uppercased display name -var sLevelInfo = {}; -// list of loggers -var sLoggers = []; -/** - * Standard console logger. If no console support is enabled this will - * remain null. Check before using. - */ -var sConsoleLogger = null; - -// logger flags -/** - * Lock the level at the current value. Used in cases where user config may - * set the level such that only critical messages are seen but more verbose - * messages are needed for debugging or other purposes. - */ -forge.log.LEVEL_LOCKED = (1 << 1); -/** - * Always call log function. By default, the logging system will check the - * message level against logger.level before calling the log function. This - * flag allows the function to do its own check. - */ -forge.log.NO_LEVEL_CHECK = (1 << 2); -/** - * Perform message interpolation with the passed arguments. "%" style - * fields in log messages will be replaced by arguments as needed. Some - * loggers, such as Firebug, may do this automatically. The original log - * message will be available as 'message' and the interpolated version will - * be available as 'fullMessage'. - */ -forge.log.INTERPOLATE = (1 << 3); - -// setup each log level -for(var i = 0; i < forge.log.levels.length; ++i) { - var level = forge.log.levels[i]; - sLevelInfo[level] = { - index: i, - name: level.toUpperCase() - }; -} - -/** - * Message logger. Will dispatch a message to registered loggers as needed. - * - * @param message message object - */ -forge.log.logMessage = function(message) { - var messageLevelIndex = sLevelInfo[message.level].index; - for(var i = 0; i < sLoggers.length; ++i) { - var logger = sLoggers[i]; - if(logger.flags & forge.log.NO_LEVEL_CHECK) { - logger.f(message); - } else { - // get logger level - var loggerLevelIndex = sLevelInfo[logger.level].index; - // check level - if(messageLevelIndex <= loggerLevelIndex) { - // message critical enough, call logger - logger.f(logger, message); - } - } - } -}; - -/** - * Sets the 'standard' key on a message object to: - * "LEVEL [category] " + message - * - * @param message a message log object - */ -forge.log.prepareStandard = function(message) { - if(!('standard' in message)) { - message.standard = - sLevelInfo[message.level].name + - //' ' + +message.timestamp + - ' [' + message.category + '] ' + - message.message; - } -}; - -/** - * Sets the 'full' key on a message object to the original message - * interpolated via % formatting with the message arguments. - * - * @param message a message log object. - */ -forge.log.prepareFull = function(message) { - if(!('full' in message)) { - // copy args and insert message at the front - var args = [message.message]; - args = args.concat([] || message['arguments']); - // format the message - message.full = forge.util.format.apply(this, args); - } -}; - -/** - * Applies both preparseStandard() and prepareFull() to a message object and - * store result in 'standardFull'. - * - * @param message a message log object. - */ -forge.log.prepareStandardFull = function(message) { - if(!('standardFull' in message)) { - // FIXME implement 'standardFull' logging - forge.log.prepareStandard(message); - message.standardFull = message.standard; - } -}; - -// create log level functions -if(true) { - // levels for which we want functions - var levels = ['error', 'warning', 'info', 'debug', 'verbose']; - for(var i = 0; i < levels.length; ++i) { - // wrap in a function to ensure proper level var is passed - (function(level) { - // create function for this level - forge.log[level] = function(category, message/*, args...*/) { - // convert arguments to real array, remove category and message - var args = Array.prototype.slice.call(arguments).slice(2); - // create message object - // Note: interpolation and standard formatting is done lazily - var msg = { - timestamp: new Date(), - level: level, - category: category, - message: message, - 'arguments': args - /*standard*/ - /*full*/ - /*fullMessage*/ - }; - // process this message - forge.log.logMessage(msg); - }; - })(levels[i]); - } -} - -/** - * Creates a new logger with specified custom logging function. - * - * The logging function has a signature of: - * function(logger, message) - * logger: current logger - * message: object: - * level: level id - * category: category - * message: string message - * arguments: Array of extra arguments - * fullMessage: interpolated message and arguments if INTERPOLATE flag set - * - * @param logFunction a logging function which takes a log message object - * as a parameter. - * - * @return a logger object. - */ -forge.log.makeLogger = function(logFunction) { - var logger = { - flags: 0, - f: logFunction - }; - forge.log.setLevel(logger, 'none'); - return logger; -}; - -/** - * Sets the current log level on a logger. - * - * @param logger the target logger. - * @param level the new maximum log level as a string. - * - * @return true if set, false if not. - */ -forge.log.setLevel = function(logger, level) { - var rval = false; - if(logger && !(logger.flags & forge.log.LEVEL_LOCKED)) { - for(var i = 0; i < forge.log.levels.length; ++i) { - var aValidLevel = forge.log.levels[i]; - if(level == aValidLevel) { - // set level - logger.level = level; - rval = true; - break; - } - } - } - - return rval; -}; - -/** - * Locks the log level at its current value. - * - * @param logger the target logger. - * @param lock boolean lock value, default to true. - */ -forge.log.lock = function(logger, lock) { - if(typeof lock === 'undefined' || lock) { - logger.flags |= forge.log.LEVEL_LOCKED; - } else { - logger.flags &= ~forge.log.LEVEL_LOCKED; - } -}; - -/** - * Adds a logger. - * - * @param logger the logger object. - */ -forge.log.addLogger = function(logger) { - sLoggers.push(logger); -}; - -// setup the console logger if possible, else create fake console.log -if(typeof(console) !== 'undefined' && 'log' in console) { - var logger; - if(console.error && console.warn && console.info && console.debug) { - // looks like Firebug-style logging is available - // level handlers map - var levelHandlers = { - error: console.error, - warning: console.warn, - info: console.info, - debug: console.debug, - verbose: console.debug - }; - var f = function(logger, message) { - forge.log.prepareStandard(message); - var handler = levelHandlers[message.level]; - // prepend standard message and concat args - var args = [message.standard]; - args = args.concat(message['arguments'].slice()); - // apply to low-level console function - handler.apply(console, args); - }; - logger = forge.log.makeLogger(f); - } else { - // only appear to have basic console.log - var f = function(logger, message) { - forge.log.prepareStandardFull(message); - console.log(message.standardFull); - }; - logger = forge.log.makeLogger(f); - } - forge.log.setLevel(logger, 'debug'); - forge.log.addLogger(logger); - sConsoleLogger = logger; -} else { - // define fake console.log to avoid potential script errors on - // browsers that do not have console logging - console = { - log: function() {} - }; -} - -/* - * Check for logging control query vars. - * - * console.level= - * Set's the console log level by name. Useful to override defaults and - * allow more verbose logging before a user config is loaded. - * - * console.lock= - * Lock the console log level at whatever level it is set at. This is run - * after console.level is processed. Useful to force a level of verbosity - * that could otherwise be limited by a user config. - */ -if(sConsoleLogger !== null) { - var query = forge.util.getQueryVariables(); - if('console.level' in query) { - // set with last value - forge.log.setLevel( - sConsoleLogger, query['console.level'].slice(-1)[0]); - } - if('console.lock' in query) { - // set with last value - var lock = query['console.lock'].slice(-1)[0]; - if(lock == 'true') { - forge.log.lock(sConsoleLogger); - } - } -} - -// provide public access to console logger -forge.log.consoleLogger = sConsoleLogger; diff --git a/reverse_engineering/node_modules/node-forge/lib/md.all.js b/reverse_engineering/node_modules/node-forge/lib/md.all.js deleted file mode 100644 index 4e0974bd..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/md.all.js +++ /dev/null @@ -1,13 +0,0 @@ -/** - * Node.js module for all known Forge message digests. - * - * @author Dave Longley - * - * Copyright 2011-2017 Digital Bazaar, Inc. - */ -module.exports = require('./md'); - -require('./md5'); -require('./sha1'); -require('./sha256'); -require('./sha512'); diff --git a/reverse_engineering/node_modules/node-forge/lib/md.js b/reverse_engineering/node_modules/node-forge/lib/md.js deleted file mode 100644 index e4a280c5..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/md.js +++ /dev/null @@ -1,11 +0,0 @@ -/** - * Node.js module for Forge message digests. - * - * @author Dave Longley - * - * Copyright 2011-2017 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -module.exports = forge.md = forge.md || {}; -forge.md.algorithms = forge.md.algorithms || {}; diff --git a/reverse_engineering/node_modules/node-forge/lib/md5.js b/reverse_engineering/node_modules/node-forge/lib/md5.js deleted file mode 100644 index d0ba8f65..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/md5.js +++ /dev/null @@ -1,289 +0,0 @@ -/** - * Message Digest Algorithm 5 with 128-bit digest (MD5) implementation. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var md5 = module.exports = forge.md5 = forge.md5 || {}; -forge.md.md5 = forge.md.algorithms.md5 = md5; - -/** - * Creates an MD5 message digest object. - * - * @return a message digest object. - */ -md5.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // MD5 state contains four 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(16); - - // message digest object - var md = { - algorithm: 'md5', - blockLength: 64, - digestLength: 16, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x67452301, - h1: 0xEFCDAB89, - h2: 0x98BADCFE, - h3: 0x10325476 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = (len[1] / 0x100000000) >>> 0; - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate MD5 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in little-endian order; since length - // is stored in bytes we multiply by 8 and add carry - var bits, carry = 0; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - bits = md.fullMessageLength[i] * 8 + carry; - carry = (bits / 0x100000000) >>> 0; - finalBlock.putInt32Le(bits >>> 0); - } - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32Le(s2.h0); - rval.putInt32Le(s2.h1); - rval.putInt32Le(s2.h2); - rval.putInt32Le(s2.h3); - return rval; - }; - - return md; -}; - -// padding, constant tables for calculating md5 -var _padding = null; -var _g = null; -var _r = null; -var _k = null; -var _initialized = false; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // g values - _g = [ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, - 1, 6, 11, 0, 5, 10, 15, 4, 9, 14, 3, 8, 13, 2, 7, 12, - 5, 8, 11, 14, 1, 4, 7, 10, 13, 0, 3, 6, 9, 12, 15, 2, - 0, 7, 14, 5, 12, 3, 10, 1, 8, 15, 6, 13, 4, 11, 2, 9]; - - // rounds table - _r = [ - 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, 7, 12, 17, 22, - 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, 5, 9, 14, 20, - 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, 4, 11, 16, 23, - 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21, 6, 10, 15, 21]; - - // get the result of abs(sin(i + 1)) as a 32-bit integer - _k = new Array(64); - for(var i = 0; i < 64; ++i) { - _k[i] = Math.floor(Math.abs(Math.sin(i + 1)) * 0x100000000); - } - - // now initialized - _initialized = true; -} - -/** - * Updates an MD5 state with the given byte buffer. - * - * @param s the MD5 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t, a, b, c, d, f, r, i; - var len = bytes.length(); - while(len >= 64) { - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - - // round 1 - for(i = 0; i < 16; ++i) { - w[i] = bytes.getInt32Le(); - f = d ^ (b & (c ^ d)); - t = (a + f + _k[i] + w[i]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 2 - for(; i < 32; ++i) { - f = c ^ (d & (b ^ c)); - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 3 - for(; i < 48; ++i) { - f = b ^ c ^ d; - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - // round 4 - for(; i < 64; ++i) { - f = c ^ (b | ~d); - t = (a + f + _k[i] + w[_g[i]]); - r = _r[i]; - a = d; - d = c; - c = b; - b += (t << r) | (t >>> (32 - r)); - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - - len -= 64; - } -} diff --git a/reverse_engineering/node_modules/node-forge/lib/mgf.js b/reverse_engineering/node_modules/node-forge/lib/mgf.js deleted file mode 100644 index 0223bc36..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/mgf.js +++ /dev/null @@ -1,12 +0,0 @@ -/** - * Node.js module for Forge mask generation functions. - * - * @author Stefan Siegl - * - * Copyright 2012 Stefan Siegl - */ -var forge = require('./forge'); -require('./mgf1'); - -module.exports = forge.mgf = forge.mgf || {}; -forge.mgf.mgf1 = forge.mgf1; diff --git a/reverse_engineering/node_modules/node-forge/lib/mgf1.js b/reverse_engineering/node_modules/node-forge/lib/mgf1.js deleted file mode 100644 index 25ed1f7f..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/mgf1.js +++ /dev/null @@ -1,57 +0,0 @@ -/** - * Javascript implementation of mask generation function MGF1. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -forge.mgf = forge.mgf || {}; -var mgf1 = module.exports = forge.mgf.mgf1 = forge.mgf1 = forge.mgf1 || {}; - -/** - * Creates a MGF1 mask generation function object. - * - * @param md the message digest API to use (eg: forge.md.sha1.create()). - * - * @return a mask generation function object. - */ -mgf1.create = function(md) { - var mgf = { - /** - * Generate mask of specified length. - * - * @param {String} seed The seed for mask generation. - * @param maskLen Number of bytes to generate. - * @return {String} The generated mask. - */ - generate: function(seed, maskLen) { - /* 2. Let T be the empty octet string. */ - var t = new forge.util.ByteBuffer(); - - /* 3. For counter from 0 to ceil(maskLen / hLen), do the following: */ - var len = Math.ceil(maskLen / md.digestLength); - for(var i = 0; i < len; i++) { - /* a. Convert counter to an octet string C of length 4 octets */ - var c = new forge.util.ByteBuffer(); - c.putInt32(i); - - /* b. Concatenate the hash of the seed mgfSeed and C to the octet - * string T: */ - md.start(); - md.update(seed + c.getBytes()); - t.putBuffer(md.digest()); - } - - /* Output the leading maskLen octets of T as the octet string mask. */ - t.truncate(t.length() - maskLen); - return t.getBytes(); - } - }; - - return mgf; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/oids.js b/reverse_engineering/node_modules/node-forge/lib/oids.js deleted file mode 100644 index 6a937f57..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/oids.js +++ /dev/null @@ -1,170 +0,0 @@ -/** - * Object IDs for ASN.1. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); - -forge.pki = forge.pki || {}; -var oids = module.exports = forge.pki.oids = forge.oids = forge.oids || {}; - -// set id to name mapping and name to id mapping -function _IN(id, name) { - oids[id] = name; - oids[name] = id; -} -// set id to name mapping only -function _I_(id, name) { - oids[id] = name; -} - -// algorithm OIDs -_IN('1.2.840.113549.1.1.1', 'rsaEncryption'); -// Note: md2 & md4 not implemented -//_IN('1.2.840.113549.1.1.2', 'md2WithRSAEncryption'); -//_IN('1.2.840.113549.1.1.3', 'md4WithRSAEncryption'); -_IN('1.2.840.113549.1.1.4', 'md5WithRSAEncryption'); -_IN('1.2.840.113549.1.1.5', 'sha1WithRSAEncryption'); -_IN('1.2.840.113549.1.1.7', 'RSAES-OAEP'); -_IN('1.2.840.113549.1.1.8', 'mgf1'); -_IN('1.2.840.113549.1.1.9', 'pSpecified'); -_IN('1.2.840.113549.1.1.10', 'RSASSA-PSS'); -_IN('1.2.840.113549.1.1.11', 'sha256WithRSAEncryption'); -_IN('1.2.840.113549.1.1.12', 'sha384WithRSAEncryption'); -_IN('1.2.840.113549.1.1.13', 'sha512WithRSAEncryption'); -// Edwards-curve Digital Signature Algorithm (EdDSA) Ed25519 -_IN('1.3.101.112', 'EdDSA25519'); - -_IN('1.2.840.10040.4.3', 'dsa-with-sha1'); - -_IN('1.3.14.3.2.7', 'desCBC'); - -_IN('1.3.14.3.2.26', 'sha1'); -_IN('2.16.840.1.101.3.4.2.1', 'sha256'); -_IN('2.16.840.1.101.3.4.2.2', 'sha384'); -_IN('2.16.840.1.101.3.4.2.3', 'sha512'); -_IN('1.2.840.113549.2.5', 'md5'); - -// pkcs#7 content types -_IN('1.2.840.113549.1.7.1', 'data'); -_IN('1.2.840.113549.1.7.2', 'signedData'); -_IN('1.2.840.113549.1.7.3', 'envelopedData'); -_IN('1.2.840.113549.1.7.4', 'signedAndEnvelopedData'); -_IN('1.2.840.113549.1.7.5', 'digestedData'); -_IN('1.2.840.113549.1.7.6', 'encryptedData'); - -// pkcs#9 oids -_IN('1.2.840.113549.1.9.1', 'emailAddress'); -_IN('1.2.840.113549.1.9.2', 'unstructuredName'); -_IN('1.2.840.113549.1.9.3', 'contentType'); -_IN('1.2.840.113549.1.9.4', 'messageDigest'); -_IN('1.2.840.113549.1.9.5', 'signingTime'); -_IN('1.2.840.113549.1.9.6', 'counterSignature'); -_IN('1.2.840.113549.1.9.7', 'challengePassword'); -_IN('1.2.840.113549.1.9.8', 'unstructuredAddress'); -_IN('1.2.840.113549.1.9.14', 'extensionRequest'); - -_IN('1.2.840.113549.1.9.20', 'friendlyName'); -_IN('1.2.840.113549.1.9.21', 'localKeyId'); -_IN('1.2.840.113549.1.9.22.1', 'x509Certificate'); - -// pkcs#12 safe bags -_IN('1.2.840.113549.1.12.10.1.1', 'keyBag'); -_IN('1.2.840.113549.1.12.10.1.2', 'pkcs8ShroudedKeyBag'); -_IN('1.2.840.113549.1.12.10.1.3', 'certBag'); -_IN('1.2.840.113549.1.12.10.1.4', 'crlBag'); -_IN('1.2.840.113549.1.12.10.1.5', 'secretBag'); -_IN('1.2.840.113549.1.12.10.1.6', 'safeContentsBag'); - -// password-based-encryption for pkcs#12 -_IN('1.2.840.113549.1.5.13', 'pkcs5PBES2'); -_IN('1.2.840.113549.1.5.12', 'pkcs5PBKDF2'); - -_IN('1.2.840.113549.1.12.1.1', 'pbeWithSHAAnd128BitRC4'); -_IN('1.2.840.113549.1.12.1.2', 'pbeWithSHAAnd40BitRC4'); -_IN('1.2.840.113549.1.12.1.3', 'pbeWithSHAAnd3-KeyTripleDES-CBC'); -_IN('1.2.840.113549.1.12.1.4', 'pbeWithSHAAnd2-KeyTripleDES-CBC'); -_IN('1.2.840.113549.1.12.1.5', 'pbeWithSHAAnd128BitRC2-CBC'); -_IN('1.2.840.113549.1.12.1.6', 'pbewithSHAAnd40BitRC2-CBC'); - -// hmac OIDs -_IN('1.2.840.113549.2.7', 'hmacWithSHA1'); -_IN('1.2.840.113549.2.8', 'hmacWithSHA224'); -_IN('1.2.840.113549.2.9', 'hmacWithSHA256'); -_IN('1.2.840.113549.2.10', 'hmacWithSHA384'); -_IN('1.2.840.113549.2.11', 'hmacWithSHA512'); - -// symmetric key algorithm oids -_IN('1.2.840.113549.3.7', 'des-EDE3-CBC'); -_IN('2.16.840.1.101.3.4.1.2', 'aes128-CBC'); -_IN('2.16.840.1.101.3.4.1.22', 'aes192-CBC'); -_IN('2.16.840.1.101.3.4.1.42', 'aes256-CBC'); - -// certificate issuer/subject OIDs -_IN('2.5.4.3', 'commonName'); -_IN('2.5.4.5', 'serialName'); -_IN('2.5.4.6', 'countryName'); -_IN('2.5.4.7', 'localityName'); -_IN('2.5.4.8', 'stateOrProvinceName'); -_IN('2.5.4.9', 'streetAddress'); -_IN('2.5.4.10', 'organizationName'); -_IN('2.5.4.11', 'organizationalUnitName'); -_IN('2.5.4.13', 'description'); -_IN('2.5.4.15', 'businessCategory'); -_IN('2.5.4.17', 'postalCode'); -_IN('1.3.6.1.4.1.311.60.2.1.2', 'jurisdictionOfIncorporationStateOrProvinceName'); -_IN('1.3.6.1.4.1.311.60.2.1.3', 'jurisdictionOfIncorporationCountryName'); - -// X.509 extension OIDs -_IN('2.16.840.1.113730.1.1', 'nsCertType'); -_IN('2.16.840.1.113730.1.13', 'nsComment'); // deprecated in theory; still widely used -_I_('2.5.29.1', 'authorityKeyIdentifier'); // deprecated, use .35 -_I_('2.5.29.2', 'keyAttributes'); // obsolete use .37 or .15 -_I_('2.5.29.3', 'certificatePolicies'); // deprecated, use .32 -_I_('2.5.29.4', 'keyUsageRestriction'); // obsolete use .37 or .15 -_I_('2.5.29.5', 'policyMapping'); // deprecated use .33 -_I_('2.5.29.6', 'subtreesConstraint'); // obsolete use .30 -_I_('2.5.29.7', 'subjectAltName'); // deprecated use .17 -_I_('2.5.29.8', 'issuerAltName'); // deprecated use .18 -_I_('2.5.29.9', 'subjectDirectoryAttributes'); -_I_('2.5.29.10', 'basicConstraints'); // deprecated use .19 -_I_('2.5.29.11', 'nameConstraints'); // deprecated use .30 -_I_('2.5.29.12', 'policyConstraints'); // deprecated use .36 -_I_('2.5.29.13', 'basicConstraints'); // deprecated use .19 -_IN('2.5.29.14', 'subjectKeyIdentifier'); -_IN('2.5.29.15', 'keyUsage'); -_I_('2.5.29.16', 'privateKeyUsagePeriod'); -_IN('2.5.29.17', 'subjectAltName'); -_IN('2.5.29.18', 'issuerAltName'); -_IN('2.5.29.19', 'basicConstraints'); -_I_('2.5.29.20', 'cRLNumber'); -_I_('2.5.29.21', 'cRLReason'); -_I_('2.5.29.22', 'expirationDate'); -_I_('2.5.29.23', 'instructionCode'); -_I_('2.5.29.24', 'invalidityDate'); -_I_('2.5.29.25', 'cRLDistributionPoints'); // deprecated use .31 -_I_('2.5.29.26', 'issuingDistributionPoint'); // deprecated use .28 -_I_('2.5.29.27', 'deltaCRLIndicator'); -_I_('2.5.29.28', 'issuingDistributionPoint'); -_I_('2.5.29.29', 'certificateIssuer'); -_I_('2.5.29.30', 'nameConstraints'); -_IN('2.5.29.31', 'cRLDistributionPoints'); -_IN('2.5.29.32', 'certificatePolicies'); -_I_('2.5.29.33', 'policyMappings'); -_I_('2.5.29.34', 'policyConstraints'); // deprecated use .36 -_IN('2.5.29.35', 'authorityKeyIdentifier'); -_I_('2.5.29.36', 'policyConstraints'); -_IN('2.5.29.37', 'extKeyUsage'); -_I_('2.5.29.46', 'freshestCRL'); -_I_('2.5.29.54', 'inhibitAnyPolicy'); - -// extKeyUsage purposes -_IN('1.3.6.1.4.1.11129.2.4.2', 'timestampList'); -_IN('1.3.6.1.5.5.7.1.1', 'authorityInfoAccess'); -_IN('1.3.6.1.5.5.7.3.1', 'serverAuth'); -_IN('1.3.6.1.5.5.7.3.2', 'clientAuth'); -_IN('1.3.6.1.5.5.7.3.3', 'codeSigning'); -_IN('1.3.6.1.5.5.7.3.4', 'emailProtection'); -_IN('1.3.6.1.5.5.7.3.8', 'timeStamping'); diff --git a/reverse_engineering/node_modules/node-forge/lib/pbe.js b/reverse_engineering/node_modules/node-forge/lib/pbe.js deleted file mode 100644 index cf8456ba..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pbe.js +++ /dev/null @@ -1,1023 +0,0 @@ -/** - * Password-based encryption functions. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * An EncryptedPrivateKeyInfo: - * - * EncryptedPrivateKeyInfo ::= SEQUENCE { - * encryptionAlgorithm EncryptionAlgorithmIdentifier, - * encryptedData EncryptedData } - * - * EncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * EncryptedData ::= OCTET STRING - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./md'); -require('./oids'); -require('./pbkdf2'); -require('./pem'); -require('./random'); -require('./rc2'); -require('./rsa'); -require('./util'); - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Password-based encryption implementation. */ -var pki = forge.pki = forge.pki || {}; -module.exports = pki.pbe = forge.pbe = forge.pbe || {}; -var oids = pki.oids; - -// validator for an EncryptedPrivateKeyInfo structure -// Note: Currently only works w/algorithm params -var encryptedPrivateKeyValidator = { - name: 'EncryptedPrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedPrivateKeyInfo.encryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encryptionOid' - }, { - name: 'AlgorithmIdentifier.parameters', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'encryptionParams' - }] - }, { - // encryptedData - name: 'EncryptedPrivateKeyInfo.encryptedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encryptedData' - }] -}; - -// validator for a PBES2Algorithms structure -// Note: Currently only works w/PBKDF2 + AES encryption schemes -var PBES2AlgorithmsValidator = { - name: 'PBES2Algorithms', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.keyDerivationFunc', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.keyDerivationFunc.oid', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'kdfOid' - }, { - name: 'PBES2Algorithms.params', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.params.salt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'kdfSalt' - }, { - name: 'PBES2Algorithms.params.iterationCount', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'kdfIterationCount' - }, { - name: 'PBES2Algorithms.params.keyLength', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - optional: true, - capture: 'keyLength' - }, { - // prf - name: 'PBES2Algorithms.params.prf', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'PBES2Algorithms.params.prf.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'prfOid' - }] - }] - }] - }, { - name: 'PBES2Algorithms.encryptionScheme', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PBES2Algorithms.encryptionScheme.oid', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encOid' - }, { - name: 'PBES2Algorithms.encryptionScheme.iv', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encIv' - }] - }] -}; - -var pkcs12PbeParamsValidator = { - name: 'pkcs-12PbeParams', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'pkcs-12PbeParams.salt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'salt' - }, { - name: 'pkcs-12PbeParams.iterations', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'iterations' - }] -}; - -/** - * Encrypts a ASN.1 PrivateKeyInfo object, producing an EncryptedPrivateKeyInfo. - * - * PBES2Algorithms ALGORITHM-IDENTIFIER ::= - * { {PBES2-params IDENTIFIED BY id-PBES2}, ...} - * - * id-PBES2 OBJECT IDENTIFIER ::= {pkcs-5 13} - * - * PBES2-params ::= SEQUENCE { - * keyDerivationFunc AlgorithmIdentifier {{PBES2-KDFs}}, - * encryptionScheme AlgorithmIdentifier {{PBES2-Encs}} - * } - * - * PBES2-KDFs ALGORITHM-IDENTIFIER ::= - * { {PBKDF2-params IDENTIFIED BY id-PBKDF2}, ... } - * - * PBES2-Encs ALGORITHM-IDENTIFIER ::= { ... } - * - * PBKDF2-params ::= SEQUENCE { - * salt CHOICE { - * specified OCTET STRING, - * otherSource AlgorithmIdentifier {{PBKDF2-SaltSources}} - * }, - * iterationCount INTEGER (1..MAX), - * keyLength INTEGER (1..MAX) OPTIONAL, - * prf AlgorithmIdentifier {{PBKDF2-PRFs}} DEFAULT algid-hmacWithSHA1 - * } - * - * @param obj the ASN.1 PrivateKeyInfo object. - * @param password the password to encrypt with. - * @param options: - * algorithm the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. - * count the iteration count to use. - * saltSize the salt size to use. - * prfAlgorithm the PRF message digest algorithm to use - * ('sha1', 'sha224', 'sha256', 'sha384', 'sha512') - * - * @return the ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptPrivateKeyInfo = function(obj, password, options) { - // set default options - options = options || {}; - options.saltSize = options.saltSize || 8; - options.count = options.count || 2048; - options.algorithm = options.algorithm || 'aes128'; - options.prfAlgorithm = options.prfAlgorithm || 'sha1'; - - // generate PBE params - var salt = forge.random.getBytesSync(options.saltSize); - var count = options.count; - var countBytes = asn1.integerToDer(count); - var dkLen; - var encryptionAlgorithm; - var encryptedData; - if(options.algorithm.indexOf('aes') === 0 || options.algorithm === 'des') { - // do PBES2 - var ivLen, encOid, cipherFn; - switch(options.algorithm) { - case 'aes128': - dkLen = 16; - ivLen = 16; - encOid = oids['aes128-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes192': - dkLen = 24; - ivLen = 16; - encOid = oids['aes192-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes256': - dkLen = 32; - ivLen = 16; - encOid = oids['aes256-CBC']; - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'des': - dkLen = 8; - ivLen = 8; - encOid = oids['desCBC']; - cipherFn = forge.des.createEncryptionCipher; - break; - default: - var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); - error.algorithm = options.algorithm; - throw error; - } - - // get PRF message digest - var prfAlgorithm = 'hmacWith' + options.prfAlgorithm.toUpperCase(); - var md = prfAlgorithmToMessageDigest(prfAlgorithm); - - // encrypt private key using pbe SHA-1 and AES/DES - var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); - var iv = forge.random.getBytesSync(ivLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(asn1.toDer(obj)); - cipher.finish(); - encryptedData = cipher.output.getBytes(); - - // get PBKDF2-params - var params = createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm); - - encryptionAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pkcs5PBES2']).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // keyDerivationFunc - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pkcs5PBKDF2']).getBytes()), - // PBKDF2-params - params - ]), - // encryptionScheme - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(encOid).getBytes()), - // iv - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, iv) - ]) - ]) - ]); - } else if(options.algorithm === '3des') { - // Do PKCS12 PBE - dkLen = 24; - - var saltBytes = new forge.util.ByteBuffer(salt); - var dk = pki.pbe.generatePkcs12Key(password, saltBytes, 1, count, dkLen); - var iv = pki.pbe.generatePkcs12Key(password, saltBytes, 2, count, dkLen); - var cipher = forge.des.createEncryptionCipher(dk); - cipher.start(iv); - cipher.update(asn1.toDer(obj)); - cipher.finish(); - encryptedData = cipher.output.getBytes(); - - encryptionAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oids['pbeWithSHAAnd3-KeyTripleDES-CBC']).getBytes()), - // pkcs-12PbeParams - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // salt - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), - // iteration count - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - countBytes.getBytes()) - ]) - ]); - } else { - var error = new Error('Cannot encrypt private key. Unknown encryption algorithm.'); - error.algorithm = options.algorithm; - throw error; - } - - // EncryptedPrivateKeyInfo - var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // encryptionAlgorithm - encryptionAlgorithm, - // encryptedData - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, encryptedData) - ]); - return rval; -}; - -/** - * Decrypts a ASN.1 PrivateKeyInfo object. - * - * @param obj the ASN.1 EncryptedPrivateKeyInfo object. - * @param password the password to decrypt with. - * - * @return the ASN.1 PrivateKeyInfo on success, null on failure. - */ -pki.decryptPrivateKeyInfo = function(obj, password) { - var rval = null; - - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(obj, encryptedPrivateKeyValidator, capture, errors)) { - var error = new Error('Cannot read encrypted private key. ' + - 'ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - // get cipher - var oid = asn1.derToOid(capture.encryptionOid); - var cipher = pki.pbe.getCipher(oid, capture.encryptionParams, password); - - // get encrypted data - var encrypted = forge.util.createBuffer(capture.encryptedData); - - cipher.update(encrypted); - if(cipher.finish()) { - rval = asn1.fromDer(cipher.output); - } - - return rval; -}; - -/** - * Converts a EncryptedPrivateKeyInfo to PEM format. - * - * @param epki the EncryptedPrivateKeyInfo. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted encrypted private key. - */ -pki.encryptedPrivateKeyToPem = function(epki, maxline) { - // convert to DER, then PEM-encode - var msg = { - type: 'ENCRYPTED PRIVATE KEY', - body: asn1.toDer(epki).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts a PEM-encoded EncryptedPrivateKeyInfo to ASN.1 format. Decryption - * is not performed. - * - * @param pem the EncryptedPrivateKeyInfo in PEM-format. - * - * @return the ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptedPrivateKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'ENCRYPTED PRIVATE KEY') { - var error = new Error('Could not convert encrypted private key from PEM; ' + - 'PEM header type is "ENCRYPTED PRIVATE KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert encrypted private key from PEM; ' + - 'PEM is encrypted.'); - } - - // convert DER to ASN.1 object - return asn1.fromDer(msg.body); -}; - -/** - * Encrypts an RSA private key. By default, the key will be wrapped in - * a PrivateKeyInfo and encrypted to produce a PKCS#8 EncryptedPrivateKeyInfo. - * This is the standard, preferred way to encrypt a private key. - * - * To produce a non-standard PEM-encrypted private key that uses encapsulated - * headers to indicate the encryption algorithm (old-style non-PKCS#8 OpenSSL - * private key encryption), set the 'legacy' option to true. Note: Using this - * option will cause the iteration count to be forced to 1. - * - * Note: The 'des' algorithm is supported, but it is not considered to be - * secure because it only uses a single 56-bit key. If possible, it is highly - * recommended that a different algorithm be used. - * - * @param rsaKey the RSA key to encrypt. - * @param password the password to use. - * @param options: - * algorithm: the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des', 'des'). - * count: the iteration count to use. - * saltSize: the salt size to use. - * legacy: output an old non-PKCS#8 PEM-encrypted+encapsulated - * headers (DEK-Info) private key. - * - * @return the PEM-encoded ASN.1 EncryptedPrivateKeyInfo. - */ -pki.encryptRsaPrivateKey = function(rsaKey, password, options) { - // standard PKCS#8 - options = options || {}; - if(!options.legacy) { - // encrypt PrivateKeyInfo - var rval = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(rsaKey)); - rval = pki.encryptPrivateKeyInfo(rval, password, options); - return pki.encryptedPrivateKeyToPem(rval); - } - - // legacy non-PKCS#8 - var algorithm; - var iv; - var dkLen; - var cipherFn; - switch(options.algorithm) { - case 'aes128': - algorithm = 'AES-128-CBC'; - dkLen = 16; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes192': - algorithm = 'AES-192-CBC'; - dkLen = 24; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case 'aes256': - algorithm = 'AES-256-CBC'; - dkLen = 32; - iv = forge.random.getBytesSync(16); - cipherFn = forge.aes.createEncryptionCipher; - break; - case '3des': - algorithm = 'DES-EDE3-CBC'; - dkLen = 24; - iv = forge.random.getBytesSync(8); - cipherFn = forge.des.createEncryptionCipher; - break; - case 'des': - algorithm = 'DES-CBC'; - dkLen = 8; - iv = forge.random.getBytesSync(8); - cipherFn = forge.des.createEncryptionCipher; - break; - default: - var error = new Error('Could not encrypt RSA private key; unsupported ' + - 'encryption algorithm "' + options.algorithm + '".'); - error.algorithm = options.algorithm; - throw error; - } - - // encrypt private key using OpenSSL legacy key derivation - var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(asn1.toDer(pki.privateKeyToAsn1(rsaKey))); - cipher.finish(); - - var msg = { - type: 'RSA PRIVATE KEY', - procType: { - version: '4', - type: 'ENCRYPTED' - }, - dekInfo: { - algorithm: algorithm, - parameters: forge.util.bytesToHex(iv).toUpperCase() - }, - body: cipher.output.getBytes() - }; - return forge.pem.encode(msg); -}; - -/** - * Decrypts an RSA private key. - * - * @param pem the PEM-formatted EncryptedPrivateKeyInfo to decrypt. - * @param password the password to use. - * - * @return the RSA key on success, null on failure. - */ -pki.decryptRsaPrivateKey = function(pem, password) { - var rval = null; - - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'ENCRYPTED PRIVATE KEY' && - msg.type !== 'PRIVATE KEY' && - msg.type !== 'RSA PRIVATE KEY') { - var error = new Error('Could not convert private key from PEM; PEM header type ' + - 'is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'); - error.headerType = error; - throw error; - } - - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - var dkLen; - var cipherFn; - switch(msg.dekInfo.algorithm) { - case 'DES-CBC': - dkLen = 8; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'DES-EDE3-CBC': - dkLen = 24; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'AES-128-CBC': - dkLen = 16; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'AES-192-CBC': - dkLen = 24; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'AES-256-CBC': - dkLen = 32; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'RC2-40-CBC': - dkLen = 5; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 40); - }; - break; - case 'RC2-64-CBC': - dkLen = 8; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 64); - }; - break; - case 'RC2-128-CBC': - dkLen = 16; - cipherFn = function(key) { - return forge.rc2.createDecryptionCipher(key, 128); - }; - break; - default: - var error = new Error('Could not decrypt private key; unsupported ' + - 'encryption algorithm "' + msg.dekInfo.algorithm + '".'); - error.algorithm = msg.dekInfo.algorithm; - throw error; - } - - // use OpenSSL legacy key derivation - var iv = forge.util.hexToBytes(msg.dekInfo.parameters); - var dk = forge.pbe.opensslDeriveBytes(password, iv.substr(0, 8), dkLen); - var cipher = cipherFn(dk); - cipher.start(iv); - cipher.update(forge.util.createBuffer(msg.body)); - if(cipher.finish()) { - rval = cipher.output.getBytes(); - } else { - return rval; - } - } else { - rval = msg.body; - } - - if(msg.type === 'ENCRYPTED PRIVATE KEY') { - rval = pki.decryptPrivateKeyInfo(asn1.fromDer(rval), password); - } else { - // decryption already performed above - rval = asn1.fromDer(rval); - } - - if(rval !== null) { - rval = pki.privateKeyFromAsn1(rval); - } - - return rval; -}; - -/** - * Derives a PKCS#12 key. - * - * @param password the password to derive the key material from, null or - * undefined for none. - * @param salt the salt, as a ByteBuffer, to use. - * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). - * @param iter the iteration count. - * @param n the number of bytes to derive from the password. - * @param md the message digest to use, defaults to SHA-1. - * - * @return a ByteBuffer with the bytes derived from the password. - */ -pki.pbe.generatePkcs12Key = function(password, salt, id, iter, n, md) { - var j, l; - - if(typeof md === 'undefined' || md === null) { - if(!('sha1' in forge.md)) { - throw new Error('"sha1" hash algorithm unavailable.'); - } - md = forge.md.sha1.create(); - } - - var u = md.digestLength; - var v = md.blockLength; - var result = new forge.util.ByteBuffer(); - - /* Convert password to Unicode byte buffer + trailing 0-byte. */ - var passBuf = new forge.util.ByteBuffer(); - if(password !== null && password !== undefined) { - for(l = 0; l < password.length; l++) { - passBuf.putInt16(password.charCodeAt(l)); - } - passBuf.putInt16(0); - } - - /* Length of salt and password in BYTES. */ - var p = passBuf.length(); - var s = salt.length(); - - /* 1. Construct a string, D (the "diversifier"), by concatenating - v copies of ID. */ - var D = new forge.util.ByteBuffer(); - D.fillWithByte(id, v); - - /* 2. Concatenate copies of the salt together to create a string S of length - v * ceil(s / v) bytes (the final copy of the salt may be trunacted - to create S). - Note that if the salt is the empty string, then so is S. */ - var Slen = v * Math.ceil(s / v); - var S = new forge.util.ByteBuffer(); - for(l = 0; l < Slen; l++) { - S.putByte(salt.at(l % s)); - } - - /* 3. Concatenate copies of the password together to create a string P of - length v * ceil(p / v) bytes (the final copy of the password may be - truncated to create P). - Note that if the password is the empty string, then so is P. */ - var Plen = v * Math.ceil(p / v); - var P = new forge.util.ByteBuffer(); - for(l = 0; l < Plen; l++) { - P.putByte(passBuf.at(l % p)); - } - - /* 4. Set I=S||P to be the concatenation of S and P. */ - var I = S; - I.putBuffer(P); - - /* 5. Set c=ceil(n / u). */ - var c = Math.ceil(n / u); - - /* 6. For i=1, 2, ..., c, do the following: */ - for(var i = 1; i <= c; i++) { - /* a) Set Ai=H^r(D||I). (l.e. the rth hash of D||I, H(H(H(...H(D||I)))) */ - var buf = new forge.util.ByteBuffer(); - buf.putBytes(D.bytes()); - buf.putBytes(I.bytes()); - for(var round = 0; round < iter; round++) { - md.start(); - md.update(buf.getBytes()); - buf = md.digest(); - } - - /* b) Concatenate copies of Ai to create a string B of length v bytes (the - final copy of Ai may be truncated to create B). */ - var B = new forge.util.ByteBuffer(); - for(l = 0; l < v; l++) { - B.putByte(buf.at(l % u)); - } - - /* c) Treating I as a concatenation I0, I1, ..., Ik-1 of v-byte blocks, - where k=ceil(s / v) + ceil(p / v), modify I by setting - Ij=(Ij+B+1) mod 2v for each j. */ - var k = Math.ceil(s / v) + Math.ceil(p / v); - var Inew = new forge.util.ByteBuffer(); - for(j = 0; j < k; j++) { - var chunk = new forge.util.ByteBuffer(I.getBytes(v)); - var x = 0x1ff; - for(l = B.length() - 1; l >= 0; l--) { - x = x >> 8; - x += B.at(l) + chunk.at(l); - chunk.setAt(l, x & 0xff); - } - Inew.putBuffer(chunk); - } - I = Inew; - - /* Add Ai to A. */ - result.putBuffer(buf); - } - - result.truncate(result.length() - n); - return result; -}; - -/** - * Get new Forge cipher object instance. - * - * @param oid the OID (in string notation). - * @param params the ASN.1 params object. - * @param password the password to decrypt with. - * - * @return new cipher object instance. - */ -pki.pbe.getCipher = function(oid, params, password) { - switch(oid) { - case pki.oids['pkcs5PBES2']: - return pki.pbe.getCipherForPBES2(oid, params, password); - - case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: - case pki.oids['pbewithSHAAnd40BitRC2-CBC']: - return pki.pbe.getCipherForPKCS12PBE(oid, params, password); - - default: - var error = new Error('Cannot read encrypted PBE data block. Unsupported OID.'); - error.oid = oid; - error.supportedOids = [ - 'pkcs5PBES2', - 'pbeWithSHAAnd3-KeyTripleDES-CBC', - 'pbewithSHAAnd40BitRC2-CBC' - ]; - throw error; - } -}; - -/** - * Get new Forge cipher object instance according to PBES2 params block. - * - * The returned cipher instance is already started using the IV - * from PBES2 parameter block. - * - * @param oid the PKCS#5 PBKDF2 OID (in string notation). - * @param params the ASN.1 PBES2-params object. - * @param password the password to decrypt with. - * - * @return new cipher object instance. - */ -pki.pbe.getCipherForPBES2 = function(oid, params, password) { - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(params, PBES2AlgorithmsValidator, capture, errors)) { - var error = new Error('Cannot read password-based-encryption algorithm ' + - 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - // check oids - oid = asn1.derToOid(capture.kdfOid); - if(oid !== pki.oids['pkcs5PBKDF2']) { - var error = new Error('Cannot read encrypted private key. ' + - 'Unsupported key derivation function OID.'); - error.oid = oid; - error.supportedOids = ['pkcs5PBKDF2']; - throw error; - } - oid = asn1.derToOid(capture.encOid); - if(oid !== pki.oids['aes128-CBC'] && - oid !== pki.oids['aes192-CBC'] && - oid !== pki.oids['aes256-CBC'] && - oid !== pki.oids['des-EDE3-CBC'] && - oid !== pki.oids['desCBC']) { - var error = new Error('Cannot read encrypted private key. ' + - 'Unsupported encryption scheme OID.'); - error.oid = oid; - error.supportedOids = [ - 'aes128-CBC', 'aes192-CBC', 'aes256-CBC', 'des-EDE3-CBC', 'desCBC']; - throw error; - } - - // set PBE params - var salt = capture.kdfSalt; - var count = forge.util.createBuffer(capture.kdfIterationCount); - count = count.getInt(count.length() << 3); - var dkLen; - var cipherFn; - switch(pki.oids[oid]) { - case 'aes128-CBC': - dkLen = 16; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'aes192-CBC': - dkLen = 24; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'aes256-CBC': - dkLen = 32; - cipherFn = forge.aes.createDecryptionCipher; - break; - case 'des-EDE3-CBC': - dkLen = 24; - cipherFn = forge.des.createDecryptionCipher; - break; - case 'desCBC': - dkLen = 8; - cipherFn = forge.des.createDecryptionCipher; - break; - } - - // get PRF message digest - var md = prfOidToMessageDigest(capture.prfOid); - - // decrypt private key using pbe with chosen PRF and AES/DES - var dk = forge.pkcs5.pbkdf2(password, salt, count, dkLen, md); - var iv = capture.encIv; - var cipher = cipherFn(dk); - cipher.start(iv); - - return cipher; -}; - -/** - * Get new Forge cipher object instance for PKCS#12 PBE. - * - * The returned cipher instance is already started using the key & IV - * derived from the provided password and PKCS#12 PBE salt. - * - * @param oid The PKCS#12 PBE OID (in string notation). - * @param params The ASN.1 PKCS#12 PBE-params object. - * @param password The password to decrypt with. - * - * @return the new cipher object instance. - */ -pki.pbe.getCipherForPKCS12PBE = function(oid, params, password) { - // get PBE params - var capture = {}; - var errors = []; - if(!asn1.validate(params, pkcs12PbeParamsValidator, capture, errors)) { - var error = new Error('Cannot read password-based-encryption algorithm ' + - 'parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.'); - error.errors = errors; - throw error; - } - - var salt = forge.util.createBuffer(capture.salt); - var count = forge.util.createBuffer(capture.iterations); - count = count.getInt(count.length() << 3); - - var dkLen, dIvLen, cipherFn; - switch(oid) { - case pki.oids['pbeWithSHAAnd3-KeyTripleDES-CBC']: - dkLen = 24; - dIvLen = 8; - cipherFn = forge.des.startDecrypting; - break; - - case pki.oids['pbewithSHAAnd40BitRC2-CBC']: - dkLen = 5; - dIvLen = 8; - cipherFn = function(key, iv) { - var cipher = forge.rc2.createDecryptionCipher(key, 40); - cipher.start(iv, null); - return cipher; - }; - break; - - default: - var error = new Error('Cannot read PKCS #12 PBE data block. Unsupported OID.'); - error.oid = oid; - throw error; - } - - // get PRF message digest - var md = prfOidToMessageDigest(capture.prfOid); - var key = pki.pbe.generatePkcs12Key(password, salt, 1, count, dkLen, md); - md.start(); - var iv = pki.pbe.generatePkcs12Key(password, salt, 2, count, dIvLen, md); - - return cipherFn(key, iv); -}; - -/** - * OpenSSL's legacy key derivation function. - * - * See: http://www.openssl.org/docs/crypto/EVP_BytesToKey.html - * - * @param password the password to derive the key from. - * @param salt the salt to use, null for none. - * @param dkLen the number of bytes needed for the derived key. - * @param [options] the options to use: - * [md] an optional message digest object to use. - */ -pki.pbe.opensslDeriveBytes = function(password, salt, dkLen, md) { - if(typeof md === 'undefined' || md === null) { - if(!('md5' in forge.md)) { - throw new Error('"md5" hash algorithm unavailable.'); - } - md = forge.md.md5.create(); - } - if(salt === null) { - salt = ''; - } - var digests = [hash(md, password + salt)]; - for(var length = 16, i = 1; length < dkLen; ++i, length += 16) { - digests.push(hash(md, digests[i - 1] + password + salt)); - } - return digests.join('').substr(0, dkLen); -}; - -function hash(md, bytes) { - return md.start().update(bytes).digest().getBytes(); -} - -function prfOidToMessageDigest(prfOid) { - // get PRF algorithm, default to SHA-1 - var prfAlgorithm; - if(!prfOid) { - prfAlgorithm = 'hmacWithSHA1'; - } else { - prfAlgorithm = pki.oids[asn1.derToOid(prfOid)]; - if(!prfAlgorithm) { - var error = new Error('Unsupported PRF OID.'); - error.oid = prfOid; - error.supported = [ - 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', - 'hmacWithSHA512']; - throw error; - } - } - return prfAlgorithmToMessageDigest(prfAlgorithm); -} - -function prfAlgorithmToMessageDigest(prfAlgorithm) { - var factory = forge.md; - switch(prfAlgorithm) { - case 'hmacWithSHA224': - factory = forge.md.sha512; - case 'hmacWithSHA1': - case 'hmacWithSHA256': - case 'hmacWithSHA384': - case 'hmacWithSHA512': - prfAlgorithm = prfAlgorithm.substr(8).toLowerCase(); - break; - default: - var error = new Error('Unsupported PRF algorithm.'); - error.algorithm = prfAlgorithm; - error.supported = [ - 'hmacWithSHA1', 'hmacWithSHA224', 'hmacWithSHA256', 'hmacWithSHA384', - 'hmacWithSHA512']; - throw error; - } - if(!factory || !(prfAlgorithm in factory)) { - throw new Error('Unknown hash algorithm: ' + prfAlgorithm); - } - return factory[prfAlgorithm].create(); -} - -function createPbkdf2Params(salt, countBytes, dkLen, prfAlgorithm) { - var params = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // salt - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, salt), - // iteration count - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - countBytes.getBytes()) - ]); - // when PRF algorithm is not SHA-1 default, add key length and PRF algorithm - if(prfAlgorithm !== 'hmacWithSHA1') { - params.value.push( - // key length - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(dkLen.toString(16))), - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids[prfAlgorithm]).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - } - return params; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/pbkdf2.js b/reverse_engineering/node_modules/node-forge/lib/pbkdf2.js deleted file mode 100644 index 714560e3..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pbkdf2.js +++ /dev/null @@ -1,211 +0,0 @@ -/** - * Password-Based Key-Derivation Function #2 implementation. - * - * See RFC 2898 for details. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./hmac'); -require('./md'); -require('./util'); - -var pkcs5 = forge.pkcs5 = forge.pkcs5 || {}; - -var crypto; -if(forge.util.isNodejs && !forge.options.usePureJavaScript) { - crypto = require('crypto'); -} - -/** - * Derives a key from a password. - * - * @param p the password as a binary-encoded string of bytes. - * @param s the salt as a binary-encoded string of bytes. - * @param c the iteration count, a positive integer. - * @param dkLen the intended length, in bytes, of the derived key, - * (max: 2^32 - 1) * hash length of the PRF. - * @param [md] the message digest (or algorithm identifier as a string) to use - * in the PRF, defaults to SHA-1. - * @param [callback(err, key)] presence triggers asynchronous version, called - * once the operation completes. - * - * @return the derived key, as a binary-encoded string of bytes, for the - * synchronous version (if no callback is specified). - */ -module.exports = forge.pbkdf2 = pkcs5.pbkdf2 = function( - p, s, c, dkLen, md, callback) { - if(typeof md === 'function') { - callback = md; - md = null; - } - - // use native implementation if possible and not disabled, note that - // some node versions only support SHA-1, others allow digest to be changed - if(forge.util.isNodejs && !forge.options.usePureJavaScript && - crypto.pbkdf2 && (md === null || typeof md !== 'object') && - (crypto.pbkdf2Sync.length > 4 || (!md || md === 'sha1'))) { - if(typeof md !== 'string') { - // default prf to SHA-1 - md = 'sha1'; - } - p = Buffer.from(p, 'binary'); - s = Buffer.from(s, 'binary'); - if(!callback) { - if(crypto.pbkdf2Sync.length === 4) { - return crypto.pbkdf2Sync(p, s, c, dkLen).toString('binary'); - } - return crypto.pbkdf2Sync(p, s, c, dkLen, md).toString('binary'); - } - if(crypto.pbkdf2Sync.length === 4) { - return crypto.pbkdf2(p, s, c, dkLen, function(err, key) { - if(err) { - return callback(err); - } - callback(null, key.toString('binary')); - }); - } - return crypto.pbkdf2(p, s, c, dkLen, md, function(err, key) { - if(err) { - return callback(err); - } - callback(null, key.toString('binary')); - }); - } - - if(typeof md === 'undefined' || md === null) { - // default prf to SHA-1 - md = 'sha1'; - } - if(typeof md === 'string') { - if(!(md in forge.md.algorithms)) { - throw new Error('Unknown hash algorithm: ' + md); - } - md = forge.md[md].create(); - } - - var hLen = md.digestLength; - - /* 1. If dkLen > (2^32 - 1) * hLen, output "derived key too long" and - stop. */ - if(dkLen > (0xFFFFFFFF * hLen)) { - var err = new Error('Derived key is too long.'); - if(callback) { - return callback(err); - } - throw err; - } - - /* 2. Let len be the number of hLen-octet blocks in the derived key, - rounding up, and let r be the number of octets in the last - block: - - len = CEIL(dkLen / hLen), - r = dkLen - (len - 1) * hLen. */ - var len = Math.ceil(dkLen / hLen); - var r = dkLen - (len - 1) * hLen; - - /* 3. For each block of the derived key apply the function F defined - below to the password P, the salt S, the iteration count c, and - the block index to compute the block: - - T_1 = F(P, S, c, 1), - T_2 = F(P, S, c, 2), - ... - T_len = F(P, S, c, len), - - where the function F is defined as the exclusive-or sum of the - first c iterates of the underlying pseudorandom function PRF - applied to the password P and the concatenation of the salt S - and the block index i: - - F(P, S, c, i) = u_1 XOR u_2 XOR ... XOR u_c - - where - - u_1 = PRF(P, S || INT(i)), - u_2 = PRF(P, u_1), - ... - u_c = PRF(P, u_{c-1}). - - Here, INT(i) is a four-octet encoding of the integer i, most - significant octet first. */ - var prf = forge.hmac.create(); - prf.start(md, p); - var dk = ''; - var xor, u_c, u_c1; - - // sync version - if(!callback) { - for(var i = 1; i <= len; ++i) { - // PRF(P, S || INT(i)) (first iteration) - prf.start(null, null); - prf.update(s); - prf.update(forge.util.int32ToBytes(i)); - xor = u_c1 = prf.digest().getBytes(); - - // PRF(P, u_{c-1}) (other iterations) - for(var j = 2; j <= c; ++j) { - prf.start(null, null); - prf.update(u_c1); - u_c = prf.digest().getBytes(); - // F(p, s, c, i) - xor = forge.util.xorBytes(xor, u_c, hLen); - u_c1 = u_c; - } - - /* 4. Concatenate the blocks and extract the first dkLen octets to - produce a derived key DK: - - DK = T_1 || T_2 || ... || T_len<0..r-1> */ - dk += (i < len) ? xor : xor.substr(0, r); - } - /* 5. Output the derived key DK. */ - return dk; - } - - // async version - var i = 1, j; - function outer() { - if(i > len) { - // done - return callback(null, dk); - } - - // PRF(P, S || INT(i)) (first iteration) - prf.start(null, null); - prf.update(s); - prf.update(forge.util.int32ToBytes(i)); - xor = u_c1 = prf.digest().getBytes(); - - // PRF(P, u_{c-1}) (other iterations) - j = 2; - inner(); - } - - function inner() { - if(j <= c) { - prf.start(null, null); - prf.update(u_c1); - u_c = prf.digest().getBytes(); - // F(p, s, c, i) - xor = forge.util.xorBytes(xor, u_c, hLen); - u_c1 = u_c; - ++j; - return forge.util.setImmediate(inner); - } - - /* 4. Concatenate the blocks and extract the first dkLen octets to - produce a derived key DK: - - DK = T_1 || T_2 || ... || T_len<0..r-1> */ - dk += (i < len) ? xor : xor.substr(0, r); - - ++i; - outer(); - } - - outer(); -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/pem.js b/reverse_engineering/node_modules/node-forge/lib/pem.js deleted file mode 100644 index aed8bdf9..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pem.js +++ /dev/null @@ -1,230 +0,0 @@ -/** - * Javascript implementation of basic PEM (Privacy Enhanced Mail) algorithms. - * - * See: RFC 1421. - * - * @author Dave Longley - * - * Copyright (c) 2013-2014 Digital Bazaar, Inc. - * - * A Forge PEM object has the following fields: - * - * type: identifies the type of message (eg: "RSA PRIVATE KEY"). - * - * procType: identifies the type of processing performed on the message, - * it has two subfields: version and type, eg: 4,ENCRYPTED. - * - * contentDomain: identifies the type of content in the message, typically - * only uses the value: "RFC822". - * - * dekInfo: identifies the message encryption algorithm and mode and includes - * any parameters for the algorithm, it has two subfields: algorithm and - * parameters, eg: DES-CBC,F8143EDE5960C597. - * - * headers: contains all other PEM encapsulated headers -- where order is - * significant (for pairing data like recipient ID + key info). - * - * body: the binary-encoded body. - */ -var forge = require('./forge'); -require('./util'); - -// shortcut for pem API -var pem = module.exports = forge.pem = forge.pem || {}; - -/** - * Encodes (serializes) the given PEM object. - * - * @param msg the PEM message object to encode. - * @param options the options to use: - * maxline the maximum characters per line for the body, (default: 64). - * - * @return the PEM-formatted string. - */ -pem.encode = function(msg, options) { - options = options || {}; - var rval = '-----BEGIN ' + msg.type + '-----\r\n'; - - // encode special headers - var header; - if(msg.procType) { - header = { - name: 'Proc-Type', - values: [String(msg.procType.version), msg.procType.type] - }; - rval += foldHeader(header); - } - if(msg.contentDomain) { - header = {name: 'Content-Domain', values: [msg.contentDomain]}; - rval += foldHeader(header); - } - if(msg.dekInfo) { - header = {name: 'DEK-Info', values: [msg.dekInfo.algorithm]}; - if(msg.dekInfo.parameters) { - header.values.push(msg.dekInfo.parameters); - } - rval += foldHeader(header); - } - - if(msg.headers) { - // encode all other headers - for(var i = 0; i < msg.headers.length; ++i) { - rval += foldHeader(msg.headers[i]); - } - } - - // terminate header - if(msg.procType) { - rval += '\r\n'; - } - - // add body - rval += forge.util.encode64(msg.body, options.maxline || 64) + '\r\n'; - - rval += '-----END ' + msg.type + '-----\r\n'; - return rval; -}; - -/** - * Decodes (deserializes) all PEM messages found in the given string. - * - * @param str the PEM-formatted string to decode. - * - * @return the PEM message objects in an array. - */ -pem.decode = function(str) { - var rval = []; - - // split string into PEM messages (be lenient w/EOF on BEGIN line) - var rMessage = /\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g; - var rHeader = /([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/; - var rCRLF = /\r?\n/; - var match; - while(true) { - match = rMessage.exec(str); - if(!match) { - break; - } - - var msg = { - type: match[1], - procType: null, - contentDomain: null, - dekInfo: null, - headers: [], - body: forge.util.decode64(match[3]) - }; - rval.push(msg); - - // no headers - if(!match[2]) { - continue; - } - - // parse headers - var lines = match[2].split(rCRLF); - var li = 0; - while(match && li < lines.length) { - // get line, trim any rhs whitespace - var line = lines[li].replace(/\s+$/, ''); - - // RFC2822 unfold any following folded lines - for(var nl = li + 1; nl < lines.length; ++nl) { - var next = lines[nl]; - if(!/\s/.test(next[0])) { - break; - } - line += next; - li = nl; - } - - // parse header - match = line.match(rHeader); - if(match) { - var header = {name: match[1], values: []}; - var values = match[2].split(','); - for(var vi = 0; vi < values.length; ++vi) { - header.values.push(ltrim(values[vi])); - } - - // Proc-Type must be the first header - if(!msg.procType) { - if(header.name !== 'Proc-Type') { - throw new Error('Invalid PEM formatted message. The first ' + - 'encapsulated header must be "Proc-Type".'); - } else if(header.values.length !== 2) { - throw new Error('Invalid PEM formatted message. The "Proc-Type" ' + - 'header must have two subfields.'); - } - msg.procType = {version: values[0], type: values[1]}; - } else if(!msg.contentDomain && header.name === 'Content-Domain') { - // special-case Content-Domain - msg.contentDomain = values[0] || ''; - } else if(!msg.dekInfo && header.name === 'DEK-Info') { - // special-case DEK-Info - if(header.values.length === 0) { - throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + - 'header must have at least one subfield.'); - } - msg.dekInfo = {algorithm: values[0], parameters: values[1] || null}; - } else { - msg.headers.push(header); - } - } - - ++li; - } - - if(msg.procType === 'ENCRYPTED' && !msg.dekInfo) { - throw new Error('Invalid PEM formatted message. The "DEK-Info" ' + - 'header must be present if "Proc-Type" is "ENCRYPTED".'); - } - } - - if(rval.length === 0) { - throw new Error('Invalid PEM formatted message.'); - } - - return rval; -}; - -function foldHeader(header) { - var rval = header.name + ': '; - - // ensure values with CRLF are folded - var values = []; - var insertSpace = function(match, $1) { - return ' ' + $1; - }; - for(var i = 0; i < header.values.length; ++i) { - values.push(header.values[i].replace(/^(\S+\r\n)/, insertSpace)); - } - rval += values.join(',') + '\r\n'; - - // do folding - var length = 0; - var candidate = -1; - for(var i = 0; i < rval.length; ++i, ++length) { - if(length > 65 && candidate !== -1) { - var insert = rval[candidate]; - if(insert === ',') { - ++candidate; - rval = rval.substr(0, candidate) + '\r\n ' + rval.substr(candidate); - } else { - rval = rval.substr(0, candidate) + - '\r\n' + insert + rval.substr(candidate + 1); - } - length = (i - candidate - 1); - candidate = -1; - ++i; - } else if(rval[i] === ' ' || rval[i] === '\t' || rval[i] === ',') { - candidate = i; - } - } - - return rval; -} - -function ltrim(str) { - return str.replace(/^\s+/, ''); -} diff --git a/reverse_engineering/node_modules/node-forge/lib/pkcs1.js b/reverse_engineering/node_modules/node-forge/lib/pkcs1.js deleted file mode 100644 index a3af9242..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pkcs1.js +++ /dev/null @@ -1,276 +0,0 @@ -/** - * Partial implementation of PKCS#1 v2.2: RSA-OEAP - * - * Modified but based on the following MIT and BSD licensed code: - * - * https://github.com/kjur/jsjws/blob/master/rsa.js: - * - * The 'jsjws'(JSON Web Signature JavaScript Library) License - * - * Copyright (c) 2012 Kenji Urushima - * - * Permission is hereby granted, free of charge, to any person obtaining a copy - * of this software and associated documentation files (the "Software"), to deal - * in the Software without restriction, including without limitation the rights - * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - * copies of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included in - * all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - * THE SOFTWARE. - * - * http://webrsa.cvs.sourceforge.net/viewvc/webrsa/Client/RSAES-OAEP.js?content-type=text%2Fplain: - * - * RSAES-OAEP.js - * $Id: RSAES-OAEP.js,v 1.1.1.1 2003/03/19 15:37:20 ellispritchard Exp $ - * JavaScript Implementation of PKCS #1 v2.1 RSA CRYPTOGRAPHY STANDARD (RSA Laboratories, June 14, 2002) - * Copyright (C) Ellis Pritchard, Guardian Unlimited 2003. - * Contact: ellis@nukinetics.com - * Distributed under the BSD License. - * - * Official documentation: http://www.rsa.com/rsalabs/node.asp?id=2125 - * - * @author Evan Jones (http://evanjones.ca/) - * @author Dave Longley - * - * Copyright (c) 2013-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./random'); -require('./sha1'); - -// shortcut for PKCS#1 API -var pkcs1 = module.exports = forge.pkcs1 = forge.pkcs1 || {}; - -/** - * Encode the given RSAES-OAEP message (M) using key, with optional label (L) - * and seed. - * - * This method does not perform RSA encryption, it only encodes the message - * using RSAES-OAEP. - * - * @param key the RSA key to use. - * @param message the message to encode. - * @param options the options to use: - * label an optional label to use. - * seed the seed to use. - * md the message digest object to use, undefined for SHA-1. - * mgf1 optional mgf1 parameters: - * md the message digest object to use for MGF1. - * - * @return the encoded message bytes. - */ -pkcs1.encode_rsa_oaep = function(key, message, options) { - // parse arguments - var label; - var seed; - var md; - var mgf1Md; - // legacy args (label, seed, md) - if(typeof options === 'string') { - label = options; - seed = arguments[3] || undefined; - md = arguments[4] || undefined; - } else if(options) { - label = options.label || undefined; - seed = options.seed || undefined; - md = options.md || undefined; - if(options.mgf1 && options.mgf1.md) { - mgf1Md = options.mgf1.md; - } - } - - // default OAEP to SHA-1 message digest - if(!md) { - md = forge.md.sha1.create(); - } else { - md.start(); - } - - // default MGF-1 to same as OAEP - if(!mgf1Md) { - mgf1Md = md; - } - - // compute length in bytes and check output - var keyLength = Math.ceil(key.n.bitLength() / 8); - var maxLength = keyLength - 2 * md.digestLength - 2; - if(message.length > maxLength) { - var error = new Error('RSAES-OAEP input message length is too long.'); - error.length = message.length; - error.maxLength = maxLength; - throw error; - } - - if(!label) { - label = ''; - } - md.update(label, 'raw'); - var lHash = md.digest(); - - var PS = ''; - var PS_length = maxLength - message.length; - for(var i = 0; i < PS_length; i++) { - PS += '\x00'; - } - - var DB = lHash.getBytes() + PS + '\x01' + message; - - if(!seed) { - seed = forge.random.getBytes(md.digestLength); - } else if(seed.length !== md.digestLength) { - var error = new Error('Invalid RSAES-OAEP seed. The seed length must ' + - 'match the digest length.'); - error.seedLength = seed.length; - error.digestLength = md.digestLength; - throw error; - } - - var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); - var maskedDB = forge.util.xorBytes(DB, dbMask, DB.length); - - var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); - var maskedSeed = forge.util.xorBytes(seed, seedMask, seed.length); - - // return encoded message - return '\x00' + maskedSeed + maskedDB; -}; - -/** - * Decode the given RSAES-OAEP encoded message (EM) using key, with optional - * label (L). - * - * This method does not perform RSA decryption, it only decodes the message - * using RSAES-OAEP. - * - * @param key the RSA key to use. - * @param em the encoded message to decode. - * @param options the options to use: - * label an optional label to use. - * md the message digest object to use for OAEP, undefined for SHA-1. - * mgf1 optional mgf1 parameters: - * md the message digest object to use for MGF1. - * - * @return the decoded message bytes. - */ -pkcs1.decode_rsa_oaep = function(key, em, options) { - // parse args - var label; - var md; - var mgf1Md; - // legacy args - if(typeof options === 'string') { - label = options; - md = arguments[3] || undefined; - } else if(options) { - label = options.label || undefined; - md = options.md || undefined; - if(options.mgf1 && options.mgf1.md) { - mgf1Md = options.mgf1.md; - } - } - - // compute length in bytes - var keyLength = Math.ceil(key.n.bitLength() / 8); - - if(em.length !== keyLength) { - var error = new Error('RSAES-OAEP encoded message length is invalid.'); - error.length = em.length; - error.expectedLength = keyLength; - throw error; - } - - // default OAEP to SHA-1 message digest - if(md === undefined) { - md = forge.md.sha1.create(); - } else { - md.start(); - } - - // default MGF-1 to same as OAEP - if(!mgf1Md) { - mgf1Md = md; - } - - if(keyLength < 2 * md.digestLength + 2) { - throw new Error('RSAES-OAEP key is too short for the hash function.'); - } - - if(!label) { - label = ''; - } - md.update(label, 'raw'); - var lHash = md.digest().getBytes(); - - // split the message into its parts - var y = em.charAt(0); - var maskedSeed = em.substring(1, md.digestLength + 1); - var maskedDB = em.substring(1 + md.digestLength); - - var seedMask = rsa_mgf1(maskedDB, md.digestLength, mgf1Md); - var seed = forge.util.xorBytes(maskedSeed, seedMask, maskedSeed.length); - - var dbMask = rsa_mgf1(seed, keyLength - md.digestLength - 1, mgf1Md); - var db = forge.util.xorBytes(maskedDB, dbMask, maskedDB.length); - - var lHashPrime = db.substring(0, md.digestLength); - - // constant time check that all values match what is expected - var error = (y !== '\x00'); - - // constant time check lHash vs lHashPrime - for(var i = 0; i < md.digestLength; ++i) { - error |= (lHash.charAt(i) !== lHashPrime.charAt(i)); - } - - // "constant time" find the 0x1 byte separating the padding (zeros) from the - // message - // TODO: It must be possible to do this in a better/smarter way? - var in_ps = 1; - var index = md.digestLength; - for(var j = md.digestLength; j < db.length; j++) { - var code = db.charCodeAt(j); - - var is_0 = (code & 0x1) ^ 0x1; - - // non-zero if not 0 or 1 in the ps section - var error_mask = in_ps ? 0xfffe : 0x0000; - error |= (code & error_mask); - - // latch in_ps to zero after we find 0x1 - in_ps = in_ps & is_0; - index += in_ps; - } - - if(error || db.charCodeAt(index) !== 0x1) { - throw new Error('Invalid RSAES-OAEP padding.'); - } - - return db.substring(index + 1); -}; - -function rsa_mgf1(seed, maskLength, hash) { - // default to SHA-1 message digest - if(!hash) { - hash = forge.md.sha1.create(); - } - var t = ''; - var count = Math.ceil(maskLength / hash.digestLength); - for(var i = 0; i < count; ++i) { - var c = String.fromCharCode( - (i >> 24) & 0xFF, (i >> 16) & 0xFF, (i >> 8) & 0xFF, i & 0xFF); - hash.start(); - hash.update(seed + c); - t += hash.digest().getBytes(); - } - return t.substring(0, maskLength); -} diff --git a/reverse_engineering/node_modules/node-forge/lib/pkcs12.js b/reverse_engineering/node_modules/node-forge/lib/pkcs12.js deleted file mode 100644 index cd06c494..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pkcs12.js +++ /dev/null @@ -1,1074 +0,0 @@ -/** - * Javascript implementation of PKCS#12. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * The ASN.1 representation of PKCS#12 is as follows - * (see ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-12/pkcs-12-tc1.pdf for details) - * - * PFX ::= SEQUENCE { - * version INTEGER {v3(3)}(v3,...), - * authSafe ContentInfo, - * macData MacData OPTIONAL - * } - * - * MacData ::= SEQUENCE { - * mac DigestInfo, - * macSalt OCTET STRING, - * iterations INTEGER DEFAULT 1 - * } - * Note: The iterations default is for historical reasons and its use is - * deprecated. A higher value, like 1024, is recommended. - * - * DigestInfo is defined in PKCS#7 as follows: - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of SHA1 there is none. - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * Digest ::= OCTET STRING - * - * - * ContentInfo ::= SEQUENCE { - * contentType ContentType, - * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - * } - * - * ContentType ::= OBJECT IDENTIFIER - * - * AuthenticatedSafe ::= SEQUENCE OF ContentInfo - * -- Data if unencrypted - * -- EncryptedData if password-encrypted - * -- EnvelopedData if public key-encrypted - * - * - * SafeContents ::= SEQUENCE OF SafeBag - * - * SafeBag ::= SEQUENCE { - * bagId BAG-TYPE.&id ({PKCS12BagSet}) - * bagValue [0] EXPLICIT BAG-TYPE.&Type({PKCS12BagSet}{@bagId}), - * bagAttributes SET OF PKCS12Attribute OPTIONAL - * } - * - * PKCS12Attribute ::= SEQUENCE { - * attrId ATTRIBUTE.&id ({PKCS12AttrSet}), - * attrValues SET OF ATTRIBUTE.&Type ({PKCS12AttrSet}{@attrId}) - * } -- This type is compatible with the X.500 type 'Attribute' - * - * PKCS12AttrSet ATTRIBUTE ::= { - * friendlyName | -- from PKCS #9 - * localKeyId, -- from PKCS #9 - * ... -- Other attributes are allowed - * } - * - * CertBag ::= SEQUENCE { - * certId BAG-TYPE.&id ({CertTypes}), - * certValue [0] EXPLICIT BAG-TYPE.&Type ({CertTypes}{@certId}) - * } - * - * x509Certificate BAG-TYPE ::= {OCTET STRING IDENTIFIED BY {certTypes 1}} - * -- DER-encoded X.509 certificate stored in OCTET STRING - * - * sdsiCertificate BAG-TYPE ::= {IA5String IDENTIFIED BY {certTypes 2}} - * -- Base64-encoded SDSI certificate stored in IA5String - * - * CertTypes BAG-TYPE ::= { - * x509Certificate | - * sdsiCertificate, - * ... -- For future extensions - * } - */ -var forge = require('./forge'); -require('./asn1'); -require('./hmac'); -require('./oids'); -require('./pkcs7asn1'); -require('./pbe'); -require('./random'); -require('./rsa'); -require('./sha1'); -require('./util'); -require('./x509'); - -// shortcut for asn.1 & PKI API -var asn1 = forge.asn1; -var pki = forge.pki; - -// shortcut for PKCS#12 API -var p12 = module.exports = forge.pkcs12 = forge.pkcs12 || {}; - -var contentInfoValidator = { - name: 'ContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // a ContentInfo - constructed: true, - value: [{ - name: 'ContentInfo.contentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'ContentInfo.content', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - captureAsn1: 'content' - }] -}; - -var pfxValidator = { - name: 'PFX', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'PFX.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, - contentInfoValidator, { - name: 'PFX.macData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'mac', - value: [{ - name: 'PFX.macData.mac', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // DigestInfo - constructed: true, - value: [{ - name: 'PFX.macData.mac.digestAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, // DigestAlgorithmIdentifier - constructed: true, - value: [{ - name: 'PFX.macData.mac.digestAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'macAlgorithm' - }, { - name: 'PFX.macData.mac.digestAlgorithm.parameters', - tagClass: asn1.Class.UNIVERSAL, - captureAsn1: 'macAlgorithmParameters' - }] - }, { - name: 'PFX.macData.mac.digest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'macDigest' - }] - }, { - name: 'PFX.macData.macSalt', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'macSalt' - }, { - name: 'PFX.macData.iterations', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - optional: true, - capture: 'macIterations' - }] - }] -}; - -var safeBagValidator = { - name: 'SafeBag', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SafeBag.bagId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'bagId' - }, { - name: 'SafeBag.bagValue', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - captureAsn1: 'bagValue' - }, { - name: 'SafeBag.bagAttributes', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - optional: true, - capture: 'bagAttributes' - }] -}; - -var attributeValidator = { - name: 'Attribute', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Attribute.attrId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'oid' - }, { - name: 'Attribute.attrValues', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - capture: 'values' - }] -}; - -var certBagValidator = { - name: 'CertBag', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'CertBag.certId', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certId' - }, { - name: 'CertBag.certValue', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - constructed: true, - /* So far we only support X.509 certificates (which are wrapped in - an OCTET STRING, hence hard code that here). */ - value: [{ - name: 'CertBag.certValue[0]', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.OCTETSTRING, - constructed: false, - capture: 'cert' - }] - }] -}; - -/** - * Search SafeContents structure for bags with matching attributes. - * - * The search can optionally be narrowed by a certain bag type. - * - * @param safeContents the SafeContents structure to search in. - * @param attrName the name of the attribute to compare against. - * @param attrValue the attribute value to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of matching bags. - */ -function _getBagsByAttribute(safeContents, attrName, attrValue, bagType) { - var result = []; - - for(var i = 0; i < safeContents.length; i++) { - for(var j = 0; j < safeContents[i].safeBags.length; j++) { - var bag = safeContents[i].safeBags[j]; - if(bagType !== undefined && bag.type !== bagType) { - continue; - } - // only filter by bag type, no attribute specified - if(attrName === null) { - result.push(bag); - continue; - } - if(bag.attributes[attrName] !== undefined && - bag.attributes[attrName].indexOf(attrValue) >= 0) { - result.push(bag); - } - } - } - - return result; -} - -/** - * Converts a PKCS#12 PFX in ASN.1 notation into a PFX object. - * - * @param obj The PKCS#12 PFX in ASN.1 notation. - * @param strict true to use strict DER decoding, false not to (default: true). - * @param {String} password Password to decrypt with (optional). - * - * @return PKCS#12 PFX object. - */ -p12.pkcs12FromAsn1 = function(obj, strict, password) { - // handle args - if(typeof strict === 'string') { - password = strict; - strict = true; - } else if(strict === undefined) { - strict = true; - } - - // validate PFX and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, pfxValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 PFX. ' + - 'ASN.1 object is not an PKCS#12 PFX.'); - error.errors = error; - throw error; - } - - var pfx = { - version: capture.version.charCodeAt(0), - safeContents: [], - - /** - * Gets bags with matching attributes. - * - * @param filter the attributes to filter by: - * [localKeyId] the localKeyId to search for. - * [localKeyIdHex] the localKeyId in hex to search for. - * [friendlyName] the friendly name to search for. - * [bagType] bag type to narrow each attribute search by. - * - * @return a map of attribute type to an array of matching bags or, if no - * attribute was given but a bag type, the map key will be the - * bag type. - */ - getBags: function(filter) { - var rval = {}; - - var localKeyId; - if('localKeyId' in filter) { - localKeyId = filter.localKeyId; - } else if('localKeyIdHex' in filter) { - localKeyId = forge.util.hexToBytes(filter.localKeyIdHex); - } - - // filter on bagType only - if(localKeyId === undefined && !('friendlyName' in filter) && - 'bagType' in filter) { - rval[filter.bagType] = _getBagsByAttribute( - pfx.safeContents, null, null, filter.bagType); - } - - if(localKeyId !== undefined) { - rval.localKeyId = _getBagsByAttribute( - pfx.safeContents, 'localKeyId', - localKeyId, filter.bagType); - } - if('friendlyName' in filter) { - rval.friendlyName = _getBagsByAttribute( - pfx.safeContents, 'friendlyName', - filter.friendlyName, filter.bagType); - } - - return rval; - }, - - /** - * DEPRECATED: use getBags() instead. - * - * Get bags with matching friendlyName attribute. - * - * @param friendlyName the friendly name to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of bags with matching friendlyName attribute. - */ - getBagsByFriendlyName: function(friendlyName, bagType) { - return _getBagsByAttribute( - pfx.safeContents, 'friendlyName', friendlyName, bagType); - }, - - /** - * DEPRECATED: use getBags() instead. - * - * Get bags with matching localKeyId attribute. - * - * @param localKeyId the localKeyId to search for. - * @param [bagType] bag type to narrow search by. - * - * @return an array of bags with matching localKeyId attribute. - */ - getBagsByLocalKeyId: function(localKeyId, bagType) { - return _getBagsByAttribute( - pfx.safeContents, 'localKeyId', localKeyId, bagType); - } - }; - - if(capture.version.charCodeAt(0) !== 3) { - var error = new Error('PKCS#12 PFX of version other than 3 not supported.'); - error.version = capture.version.charCodeAt(0); - throw error; - } - - if(asn1.derToOid(capture.contentType) !== pki.oids.data) { - var error = new Error('Only PKCS#12 PFX in password integrity mode supported.'); - error.oid = asn1.derToOid(capture.contentType); - throw error; - } - - var data = capture.content.value[0]; - if(data.tagClass !== asn1.Class.UNIVERSAL || - data.type !== asn1.Type.OCTETSTRING) { - throw new Error('PKCS#12 authSafe content data is not an OCTET STRING.'); - } - data = _decodePkcs7Data(data); - - // check for MAC - if(capture.mac) { - var md = null; - var macKeyBytes = 0; - var macAlgorithm = asn1.derToOid(capture.macAlgorithm); - switch(macAlgorithm) { - case pki.oids.sha1: - md = forge.md.sha1.create(); - macKeyBytes = 20; - break; - case pki.oids.sha256: - md = forge.md.sha256.create(); - macKeyBytes = 32; - break; - case pki.oids.sha384: - md = forge.md.sha384.create(); - macKeyBytes = 48; - break; - case pki.oids.sha512: - md = forge.md.sha512.create(); - macKeyBytes = 64; - break; - case pki.oids.md5: - md = forge.md.md5.create(); - macKeyBytes = 16; - break; - } - if(md === null) { - throw new Error('PKCS#12 uses unsupported MAC algorithm: ' + macAlgorithm); - } - - // verify MAC (iterations default to 1) - var macSalt = new forge.util.ByteBuffer(capture.macSalt); - var macIterations = (('macIterations' in capture) ? - parseInt(forge.util.bytesToHex(capture.macIterations), 16) : 1); - var macKey = p12.generateKey( - password, macSalt, 3, macIterations, macKeyBytes, md); - var mac = forge.hmac.create(); - mac.start(md, macKey); - mac.update(data.value); - var macValue = mac.getMac(); - if(macValue.getBytes() !== capture.macDigest) { - throw new Error('PKCS#12 MAC could not be verified. Invalid password?'); - } - } - - _decodeAuthenticatedSafe(pfx, data.value, strict, password); - return pfx; -}; - -/** - * Decodes PKCS#7 Data. PKCS#7 (RFC 2315) defines "Data" as an OCTET STRING, - * but it is sometimes an OCTET STRING that is composed/constructed of chunks, - * each its own OCTET STRING. This is BER-encoding vs. DER-encoding. This - * function transforms this corner-case into the usual simple, - * non-composed/constructed OCTET STRING. - * - * This function may be moved to ASN.1 at some point to better deal with - * more BER-encoding issues, should they arise. - * - * @param data the ASN.1 Data object to transform. - */ -function _decodePkcs7Data(data) { - // handle special case of "chunked" data content: an octet string composed - // of other octet strings - if(data.composed || data.constructed) { - var value = forge.util.createBuffer(); - for(var i = 0; i < data.value.length; ++i) { - value.putBytes(data.value[i].value); - } - data.composed = data.constructed = false; - data.value = value.getBytes(); - } - return data; -} - -/** - * Decode PKCS#12 AuthenticatedSafe (BER encoded) into PFX object. - * - * The AuthenticatedSafe is a BER-encoded SEQUENCE OF ContentInfo. - * - * @param pfx The PKCS#12 PFX object to fill. - * @param {String} authSafe BER-encoded AuthenticatedSafe. - * @param strict true to use strict DER decoding, false not to. - * @param {String} password Password to decrypt with (optional). - */ -function _decodeAuthenticatedSafe(pfx, authSafe, strict, password) { - authSafe = asn1.fromDer(authSafe, strict); /* actually it's BER encoded */ - - if(authSafe.tagClass !== asn1.Class.UNIVERSAL || - authSafe.type !== asn1.Type.SEQUENCE || - authSafe.constructed !== true) { - throw new Error('PKCS#12 AuthenticatedSafe expected to be a ' + - 'SEQUENCE OF ContentInfo'); - } - - for(var i = 0; i < authSafe.value.length; i++) { - var contentInfo = authSafe.value[i]; - - // validate contentInfo and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(contentInfo, contentInfoValidator, capture, errors)) { - var error = new Error('Cannot read ContentInfo.'); - error.errors = errors; - throw error; - } - - var obj = { - encrypted: false - }; - var safeContents = null; - var data = capture.content.value[0]; - switch(asn1.derToOid(capture.contentType)) { - case pki.oids.data: - if(data.tagClass !== asn1.Class.UNIVERSAL || - data.type !== asn1.Type.OCTETSTRING) { - throw new Error('PKCS#12 SafeContents Data is not an OCTET STRING.'); - } - safeContents = _decodePkcs7Data(data).value; - break; - case pki.oids.encryptedData: - safeContents = _decryptSafeContents(data, password); - obj.encrypted = true; - break; - default: - var error = new Error('Unsupported PKCS#12 contentType.'); - error.contentType = asn1.derToOid(capture.contentType); - throw error; - } - - obj.safeBags = _decodeSafeContents(safeContents, strict, password); - pfx.safeContents.push(obj); - } -} - -/** - * Decrypt PKCS#7 EncryptedData structure. - * - * @param data ASN.1 encoded EncryptedContentInfo object. - * @param password The user-provided password. - * - * @return The decrypted SafeContents (ASN.1 object). - */ -function _decryptSafeContents(data, password) { - var capture = {}; - var errors = []; - if(!asn1.validate( - data, forge.pkcs7.asn1.encryptedDataValidator, capture, errors)) { - var error = new Error('Cannot read EncryptedContentInfo.'); - error.errors = errors; - throw error; - } - - var oid = asn1.derToOid(capture.contentType); - if(oid !== pki.oids.data) { - var error = new Error( - 'PKCS#12 EncryptedContentInfo ContentType is not Data.'); - error.oid = oid; - throw error; - } - - // get cipher - oid = asn1.derToOid(capture.encAlgorithm); - var cipher = pki.pbe.getCipher(oid, capture.encParameter, password); - - // get encrypted data - var encryptedContentAsn1 = _decodePkcs7Data(capture.encryptedContentAsn1); - var encrypted = forge.util.createBuffer(encryptedContentAsn1.value); - - cipher.update(encrypted); - if(!cipher.finish()) { - throw new Error('Failed to decrypt PKCS#12 SafeContents.'); - } - - return cipher.output.getBytes(); -} - -/** - * Decode PKCS#12 SafeContents (BER-encoded) into array of Bag objects. - * - * The safeContents is a BER-encoded SEQUENCE OF SafeBag. - * - * @param {String} safeContents BER-encoded safeContents. - * @param strict true to use strict DER decoding, false not to. - * @param {String} password Password to decrypt with (optional). - * - * @return {Array} Array of Bag objects. - */ -function _decodeSafeContents(safeContents, strict, password) { - // if strict and no safe contents, return empty safes - if(!strict && safeContents.length === 0) { - return []; - } - - // actually it's BER-encoded - safeContents = asn1.fromDer(safeContents, strict); - - if(safeContents.tagClass !== asn1.Class.UNIVERSAL || - safeContents.type !== asn1.Type.SEQUENCE || - safeContents.constructed !== true) { - throw new Error( - 'PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.'); - } - - var res = []; - for(var i = 0; i < safeContents.value.length; i++) { - var safeBag = safeContents.value[i]; - - // validate SafeBag and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(safeBag, safeBagValidator, capture, errors)) { - var error = new Error('Cannot read SafeBag.'); - error.errors = errors; - throw error; - } - - /* Create bag object and push to result array. */ - var bag = { - type: asn1.derToOid(capture.bagId), - attributes: _decodeBagAttributes(capture.bagAttributes) - }; - res.push(bag); - - var validator, decoder; - var bagAsn1 = capture.bagValue.value[0]; - switch(bag.type) { - case pki.oids.pkcs8ShroudedKeyBag: - /* bagAsn1 has a EncryptedPrivateKeyInfo, which we need to decrypt. - Afterwards we can handle it like a keyBag, - which is a PrivateKeyInfo. */ - bagAsn1 = pki.decryptPrivateKeyInfo(bagAsn1, password); - if(bagAsn1 === null) { - throw new Error( - 'Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?'); - } - - /* fall through */ - case pki.oids.keyBag: - /* A PKCS#12 keyBag is a simple PrivateKeyInfo as understood by our - PKI module, hence we don't have to do validation/capturing here, - just pass what we already got. */ - try { - bag.key = pki.privateKeyFromAsn1(bagAsn1); - } catch(e) { - // ignore unknown key type, pass asn1 value - bag.key = null; - bag.asn1 = bagAsn1; - } - continue; /* Nothing more to do. */ - - case pki.oids.certBag: - /* A PKCS#12 certBag can wrap both X.509 and sdsi certificates. - Therefore put the SafeBag content through another validator to - capture the fields. Afterwards check & store the results. */ - validator = certBagValidator; - decoder = function() { - if(asn1.derToOid(capture.certId) !== pki.oids.x509Certificate) { - var error = new Error( - 'Unsupported certificate type, only X.509 supported.'); - error.oid = asn1.derToOid(capture.certId); - throw error; - } - - // true=produce cert hash - var certAsn1 = asn1.fromDer(capture.cert, strict); - try { - bag.cert = pki.certificateFromAsn1(certAsn1, true); - } catch(e) { - // ignore unknown cert type, pass asn1 value - bag.cert = null; - bag.asn1 = certAsn1; - } - }; - break; - - default: - var error = new Error('Unsupported PKCS#12 SafeBag type.'); - error.oid = bag.type; - throw error; - } - - /* Validate SafeBag value (i.e. CertBag, etc.) and capture data if needed. */ - if(validator !== undefined && - !asn1.validate(bagAsn1, validator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 ' + validator.name); - error.errors = errors; - throw error; - } - - /* Call decoder function from above to store the results. */ - decoder(); - } - - return res; -} - -/** - * Decode PKCS#12 SET OF PKCS12Attribute into JavaScript object. - * - * @param attributes SET OF PKCS12Attribute (ASN.1 object). - * - * @return the decoded attributes. - */ -function _decodeBagAttributes(attributes) { - var decodedAttrs = {}; - - if(attributes !== undefined) { - for(var i = 0; i < attributes.length; ++i) { - var capture = {}; - var errors = []; - if(!asn1.validate(attributes[i], attributeValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#12 BagAttribute.'); - error.errors = errors; - throw error; - } - - var oid = asn1.derToOid(capture.oid); - if(pki.oids[oid] === undefined) { - // unsupported attribute type, ignore. - continue; - } - - decodedAttrs[pki.oids[oid]] = []; - for(var j = 0; j < capture.values.length; ++j) { - decodedAttrs[pki.oids[oid]].push(capture.values[j].value); - } - } - } - - return decodedAttrs; -} - -/** - * Wraps a private key and certificate in a PKCS#12 PFX wrapper. If a - * password is provided then the private key will be encrypted. - * - * An entire certificate chain may also be included. To do this, pass - * an array for the "cert" parameter where the first certificate is - * the one that is paired with the private key and each subsequent one - * verifies the previous one. The certificates may be in PEM format or - * have been already parsed by Forge. - * - * @todo implement password-based-encryption for the whole package - * - * @param key the private key. - * @param cert the certificate (may be an array of certificates in order - * to specify a certificate chain). - * @param password the password to use, null for none. - * @param options: - * algorithm the encryption algorithm to use - * ('aes128', 'aes192', 'aes256', '3des'), defaults to 'aes128'. - * count the iteration count to use. - * saltSize the salt size to use. - * useMac true to include a MAC, false not to, defaults to true. - * localKeyId the local key ID to use, in hex. - * friendlyName the friendly name to use. - * generateLocalKeyId true to generate a random local key ID, - * false not to, defaults to true. - * - * @return the PKCS#12 PFX ASN.1 object. - */ -p12.toPkcs12Asn1 = function(key, cert, password, options) { - // set default options - options = options || {}; - options.saltSize = options.saltSize || 8; - options.count = options.count || 2048; - options.algorithm = options.algorithm || options.encAlgorithm || 'aes128'; - if(!('useMac' in options)) { - options.useMac = true; - } - if(!('localKeyId' in options)) { - options.localKeyId = null; - } - if(!('generateLocalKeyId' in options)) { - options.generateLocalKeyId = true; - } - - var localKeyId = options.localKeyId; - var bagAttrs; - if(localKeyId !== null) { - localKeyId = forge.util.hexToBytes(localKeyId); - } else if(options.generateLocalKeyId) { - // use SHA-1 of paired cert, if available - if(cert) { - var pairedCert = forge.util.isArray(cert) ? cert[0] : cert; - if(typeof pairedCert === 'string') { - pairedCert = pki.certificateFromPem(pairedCert); - } - var sha1 = forge.md.sha1.create(); - sha1.update(asn1.toDer(pki.certificateToAsn1(pairedCert)).getBytes()); - localKeyId = sha1.digest().getBytes(); - } else { - // FIXME: consider using SHA-1 of public key (which can be generated - // from private key components), see: cert.generateSubjectKeyIdentifier - // generate random bytes - localKeyId = forge.random.getBytes(20); - } - } - - var attrs = []; - if(localKeyId !== null) { - attrs.push( - // localKeyID - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // attrId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.localKeyId).getBytes()), - // attrValues - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - localKeyId) - ]) - ])); - } - if('friendlyName' in options) { - attrs.push( - // friendlyName - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // attrId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.friendlyName).getBytes()), - // attrValues - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BMPSTRING, false, - options.friendlyName) - ]) - ])); - } - - if(attrs.length > 0) { - bagAttrs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, attrs); - } - - // collect contents for AuthenticatedSafe - var contents = []; - - // create safe bag(s) for certificate chain - var chain = []; - if(cert !== null) { - if(forge.util.isArray(cert)) { - chain = cert; - } else { - chain = [cert]; - } - } - - var certSafeBags = []; - for(var i = 0; i < chain.length; ++i) { - // convert cert from PEM as necessary - cert = chain[i]; - if(typeof cert === 'string') { - cert = pki.certificateFromPem(cert); - } - - // SafeBag - var certBagAttrs = (i === 0) ? bagAttrs : undefined; - var certAsn1 = pki.certificateToAsn1(cert); - var certSafeBag = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.certBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // CertBag - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // certId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.x509Certificate).getBytes()), - // certValue (x509Certificate) - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(certAsn1).getBytes()) - ])])]), - // bagAttributes (OPTIONAL) - certBagAttrs - ]); - certSafeBags.push(certSafeBag); - } - - if(certSafeBags.length > 0) { - // SafeContents - var certSafeContents = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, certSafeBags); - - // ContentInfo - var certCI = - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(certSafeContents).getBytes()) - ]) - ]); - contents.push(certCI); - } - - // create safe contents for private key - var keyBag = null; - if(key !== null) { - // SafeBag - var pkAsn1 = pki.wrapRsaPrivateKey(pki.privateKeyToAsn1(key)); - if(password === null) { - // no encryption - keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.keyBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // PrivateKeyInfo - pkAsn1 - ]), - // bagAttributes (OPTIONAL) - bagAttrs - ]); - } else { - // encrypted PrivateKeyInfo - keyBag = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // bagId - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.pkcs8ShroudedKeyBag).getBytes()), - // bagValue - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // EncryptedPrivateKeyInfo - pki.encryptPrivateKeyInfo(pkAsn1, password, options) - ]), - // bagAttributes (OPTIONAL) - bagAttrs - ]); - } - - // SafeContents - var keySafeContents = - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [keyBag]); - - // ContentInfo - var keyCI = - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(keySafeContents).getBytes()) - ]) - ]); - contents.push(keyCI); - } - - // create AuthenticatedSafe by stringing together the contents - var safe = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, contents); - - var macData; - if(options.useMac) { - // MacData - var sha1 = forge.md.sha1.create(); - var macSalt = new forge.util.ByteBuffer( - forge.random.getBytes(options.saltSize)); - var count = options.count; - // 160-bit key - var key = p12.generateKey(password, macSalt, 3, count, 20); - var mac = forge.hmac.create(); - mac.start(sha1, key); - mac.update(asn1.toDer(safe).getBytes()); - var macValue = mac.getMac(); - macData = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // mac DigestInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // digestAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm = SHA-1 - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.sha1).getBytes()), - // parameters = Null - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // digest - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, - false, macValue.getBytes()) - ]), - // macSalt OCTET STRING - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, macSalt.getBytes()), - // iterations INTEGER (XXX: Only support count < 65536) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(count).getBytes() - ) - ]); - } - - // PFX - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (3) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(3).getBytes()), - // PKCS#7 ContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // contentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - // OID for the content type is 'data' - asn1.oidToDer(pki.oids.data).getBytes()), - // content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(safe).getBytes()) - ]) - ]), - macData - ]); -}; - -/** - * Derives a PKCS#12 key. - * - * @param password the password to derive the key material from, null or - * undefined for none. - * @param salt the salt, as a ByteBuffer, to use. - * @param id the PKCS#12 ID byte (1 = key material, 2 = IV, 3 = MAC). - * @param iter the iteration count. - * @param n the number of bytes to derive from the password. - * @param md the message digest to use, defaults to SHA-1. - * - * @return a ByteBuffer with the bytes derived from the password. - */ -p12.generateKey = forge.pbe.generatePkcs12Key; diff --git a/reverse_engineering/node_modules/node-forge/lib/pkcs7.js b/reverse_engineering/node_modules/node-forge/lib/pkcs7.js deleted file mode 100644 index bb87de36..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pkcs7.js +++ /dev/null @@ -1,1257 +0,0 @@ -/** - * Javascript implementation of PKCS#7 v1.5. - * - * @author Stefan Siegl - * @author Dave Longley - * - * Copyright (c) 2012 Stefan Siegl - * Copyright (c) 2012-2015 Digital Bazaar, Inc. - * - * Currently this implementation only supports ContentType of EnvelopedData, - * EncryptedData, or SignedData at the root level. The top level elements may - * contain only a ContentInfo of ContentType Data, i.e. plain data. Further - * nesting is not (yet) supported. - * - * The Forge validators for PKCS #7's ASN.1 structures are available from - * a separate file pkcs7asn1.js, since those are referenced from other - * PKCS standards like PKCS #12. - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./oids'); -require('./pem'); -require('./pkcs7asn1'); -require('./random'); -require('./util'); -require('./x509'); - -// shortcut for ASN.1 API -var asn1 = forge.asn1; - -// shortcut for PKCS#7 API -var p7 = module.exports = forge.pkcs7 = forge.pkcs7 || {}; - -/** - * Converts a PKCS#7 message from PEM format. - * - * @param pem the PEM-formatted PKCS#7 message. - * - * @return the PKCS#7 message. - */ -p7.messageFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PKCS7') { - var error = new Error('Could not convert PKCS#7 message from PEM; PEM ' + - 'header type is not "PKCS#7".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert PKCS#7 message from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return p7.messageFromAsn1(obj); -}; - -/** - * Converts a PKCS#7 message to PEM format. - * - * @param msg The PKCS#7 message object - * @param maxline The maximum characters per line, defaults to 64. - * - * @return The PEM-formatted PKCS#7 message. - */ -p7.messageToPem = function(msg, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var pemObj = { - type: 'PKCS7', - body: asn1.toDer(msg.toAsn1()).getBytes() - }; - return forge.pem.encode(pemObj, {maxline: maxline}); -}; - -/** - * Converts a PKCS#7 message from an ASN.1 object. - * - * @param obj the ASN.1 representation of a ContentInfo. - * - * @return the PKCS#7 message. - */ -p7.messageFromAsn1 = function(obj) { - // validate root level ContentInfo and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.contentInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 message. ' + - 'ASN.1 object is not an PKCS#7 ContentInfo.'); - error.errors = errors; - throw error; - } - - var contentType = asn1.derToOid(capture.contentType); - var msg; - - switch(contentType) { - case forge.pki.oids.envelopedData: - msg = p7.createEnvelopedData(); - break; - - case forge.pki.oids.encryptedData: - msg = p7.createEncryptedData(); - break; - - case forge.pki.oids.signedData: - msg = p7.createSignedData(); - break; - - default: - throw new Error('Cannot read PKCS#7 message. ContentType with OID ' + - contentType + ' is not (yet) supported.'); - } - - msg.fromAsn1(capture.content.value[0]); - return msg; -}; - -p7.createSignedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.signedData, - version: 1, - certificates: [], - crls: [], - // TODO: add json-formatted signer stuff here? - signers: [], - // populated during sign() - digestAlgorithmIdentifiers: [], - contentInfo: null, - signerInfos: [], - - fromAsn1: function(obj) { - // validate SignedData content block and capture data. - _fromAsn1(msg, obj, p7.asn1.signedDataValidator); - msg.certificates = []; - msg.crls = []; - msg.digestAlgorithmIdentifiers = []; - msg.contentInfo = null; - msg.signerInfos = []; - - if(msg.rawCapture.certificates) { - var certs = msg.rawCapture.certificates.value; - for(var i = 0; i < certs.length; ++i) { - msg.certificates.push(forge.pki.certificateFromAsn1(certs[i])); - } - } - - // TODO: parse crls - }, - - toAsn1: function() { - // degenerate case with no content - if(!msg.contentInfo) { - msg.sign(); - } - - var certs = []; - for(var i = 0; i < msg.certificates.length; ++i) { - certs.push(forge.pki.certificateToAsn1(msg.certificates[i])); - } - - var crls = []; - // TODO: implement CRLs - - // [0] SignedData - var signedData = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(msg.version).getBytes()), - // DigestAlgorithmIdentifiers - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SET, true, - msg.digestAlgorithmIdentifiers), - // ContentInfo - msg.contentInfo - ]) - ]); - if(certs.length > 0) { - // [0] IMPLICIT ExtendedCertificatesAndCertificates OPTIONAL - signedData.value[0].value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, certs)); - } - if(crls.length > 0) { - // [1] IMPLICIT CertificateRevocationLists OPTIONAL - signedData.value[0].value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, crls)); - } - // SignerInfos - signedData.value[0].value.push( - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, - msg.signerInfos)); - - // ContentInfo - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(msg.type).getBytes()), - // [0] SignedData - signedData - ]); - }, - - /** - * Add (another) entity to list of signers. - * - * Note: If authenticatedAttributes are provided, then, per RFC 2315, - * they must include at least two attributes: content type and - * message digest. The message digest attribute value will be - * auto-calculated during signing and will be ignored if provided. - * - * Here's an example of providing these two attributes: - * - * forge.pkcs7.createSignedData(); - * p7.addSigner({ - * issuer: cert.issuer.attributes, - * serialNumber: cert.serialNumber, - * key: privateKey, - * digestAlgorithm: forge.pki.oids.sha1, - * authenticatedAttributes: [{ - * type: forge.pki.oids.contentType, - * value: forge.pki.oids.data - * }, { - * type: forge.pki.oids.messageDigest - * }] - * }); - * - * TODO: Support [subjectKeyIdentifier] as signer's ID. - * - * @param signer the signer information: - * key the signer's private key. - * [certificate] a certificate containing the public key - * associated with the signer's private key; use this option as - * an alternative to specifying signer.issuer and - * signer.serialNumber. - * [issuer] the issuer attributes (eg: cert.issuer.attributes). - * [serialNumber] the signer's certificate's serial number in - * hexadecimal (eg: cert.serialNumber). - * [digestAlgorithm] the message digest OID, as a string, to use - * (eg: forge.pki.oids.sha1). - * [authenticatedAttributes] an optional array of attributes - * to also sign along with the content. - */ - addSigner: function(signer) { - var issuer = signer.issuer; - var serialNumber = signer.serialNumber; - if(signer.certificate) { - var cert = signer.certificate; - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - issuer = cert.issuer.attributes; - serialNumber = cert.serialNumber; - } - var key = signer.key; - if(!key) { - throw new Error( - 'Could not add PKCS#7 signer; no private key specified.'); - } - if(typeof key === 'string') { - key = forge.pki.privateKeyFromPem(key); - } - - // ensure OID known for digest algorithm - var digestAlgorithm = signer.digestAlgorithm || forge.pki.oids.sha1; - switch(digestAlgorithm) { - case forge.pki.oids.sha1: - case forge.pki.oids.sha256: - case forge.pki.oids.sha384: - case forge.pki.oids.sha512: - case forge.pki.oids.md5: - break; - default: - throw new Error( - 'Could not add PKCS#7 signer; unknown message digest algorithm: ' + - digestAlgorithm); - } - - // if authenticatedAttributes is present, then the attributes - // must contain at least PKCS #9 content-type and message-digest - var authenticatedAttributes = signer.authenticatedAttributes || []; - if(authenticatedAttributes.length > 0) { - var contentType = false; - var messageDigest = false; - for(var i = 0; i < authenticatedAttributes.length; ++i) { - var attr = authenticatedAttributes[i]; - if(!contentType && attr.type === forge.pki.oids.contentType) { - contentType = true; - if(messageDigest) { - break; - } - continue; - } - if(!messageDigest && attr.type === forge.pki.oids.messageDigest) { - messageDigest = true; - if(contentType) { - break; - } - continue; - } - } - - if(!contentType || !messageDigest) { - throw new Error('Invalid signer.authenticatedAttributes. If ' + - 'signer.authenticatedAttributes is specified, then it must ' + - 'contain at least two attributes, PKCS #9 content-type and ' + - 'PKCS #9 message-digest.'); - } - } - - msg.signers.push({ - key: key, - version: 1, - issuer: issuer, - serialNumber: serialNumber, - digestAlgorithm: digestAlgorithm, - signatureAlgorithm: forge.pki.oids.rsaEncryption, - signature: null, - authenticatedAttributes: authenticatedAttributes, - unauthenticatedAttributes: [] - }); - }, - - /** - * Signs the content. - * @param options Options to apply when signing: - * [detached] boolean. If signing should be done in detached mode. Defaults to false. - */ - sign: function(options) { - options = options || {}; - // auto-generate content info - if(typeof msg.content !== 'object' || msg.contentInfo === null) { - // use Data ContentInfo - msg.contentInfo = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(forge.pki.oids.data).getBytes()) - ]); - - // add actual content, if present - if('content' in msg) { - var content; - if(msg.content instanceof forge.util.ByteBuffer) { - content = msg.content.bytes(); - } else if(typeof msg.content === 'string') { - content = forge.util.encodeUtf8(msg.content); - } - - if (options.detached) { - msg.detachedContent = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, content); - } else { - msg.contentInfo.value.push( - // [0] EXPLICIT content - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - content) - ])); - } - } - } - - // no signers, return early (degenerate case for certificate container) - if(msg.signers.length === 0) { - return; - } - - // generate digest algorithm identifiers - var mds = addDigestAlgorithmIds(); - - // generate signerInfos - addSignerInfos(mds); - }, - - verify: function() { - throw new Error('PKCS#7 signature verification not yet implemented.'); - }, - - /** - * Add a certificate. - * - * @param cert the certificate to add. - */ - addCertificate: function(cert) { - // convert from PEM - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - msg.certificates.push(cert); - }, - - /** - * Add a certificate revokation list. - * - * @param crl the certificate revokation list to add. - */ - addCertificateRevokationList: function(crl) { - throw new Error('PKCS#7 CRL support not yet implemented.'); - } - }; - return msg; - - function addDigestAlgorithmIds() { - var mds = {}; - - for(var i = 0; i < msg.signers.length; ++i) { - var signer = msg.signers[i]; - var oid = signer.digestAlgorithm; - if(!(oid in mds)) { - // content digest - mds[oid] = forge.md[forge.pki.oids[oid]].create(); - } - if(signer.authenticatedAttributes.length === 0) { - // no custom attributes to digest; use content message digest - signer.md = mds[oid]; - } else { - // custom attributes to be digested; use own message digest - // TODO: optimize to just copy message digest state if that - // feature is ever supported with message digests - signer.md = forge.md[forge.pki.oids[oid]].create(); - } - } - - // add unique digest algorithm identifiers - msg.digestAlgorithmIdentifiers = []; - for(var oid in mds) { - msg.digestAlgorithmIdentifiers.push( - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(oid).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - } - - return mds; - } - - function addSignerInfos(mds) { - var content; - - if (msg.detachedContent) { - // Signature has been made in detached mode. - content = msg.detachedContent; - } else { - // Note: ContentInfo is a SEQUENCE with 2 values, second value is - // the content field and is optional for a ContentInfo but required here - // since signers are present - // get ContentInfo content - content = msg.contentInfo.value[1]; - // skip [0] EXPLICIT content wrapper - content = content.value[0]; - } - - if(!content) { - throw new Error( - 'Could not sign PKCS#7 message; there is no content to sign.'); - } - - // get ContentInfo content type - var contentType = asn1.derToOid(msg.contentInfo.value[0].value); - - // serialize content - var bytes = asn1.toDer(content); - - // skip identifier and length per RFC 2315 9.3 - // skip identifier (1 byte) - bytes.getByte(); - // read and discard length bytes - asn1.getBerValueLength(bytes); - bytes = bytes.getBytes(); - - // digest content DER value bytes - for(var oid in mds) { - mds[oid].start().update(bytes); - } - - // sign content - var signingTime = new Date(); - for(var i = 0; i < msg.signers.length; ++i) { - var signer = msg.signers[i]; - - if(signer.authenticatedAttributes.length === 0) { - // if ContentInfo content type is not "Data", then - // authenticatedAttributes must be present per RFC 2315 - if(contentType !== forge.pki.oids.data) { - throw new Error( - 'Invalid signer; authenticatedAttributes must be present ' + - 'when the ContentInfo content type is not PKCS#7 Data.'); - } - } else { - // process authenticated attributes - // [0] IMPLICIT - signer.authenticatedAttributesAsn1 = asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - - // per RFC 2315, attributes are to be digested using a SET container - // not the above [0] IMPLICIT container - var attrsAsn1 = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SET, true, []); - - for(var ai = 0; ai < signer.authenticatedAttributes.length; ++ai) { - var attr = signer.authenticatedAttributes[ai]; - if(attr.type === forge.pki.oids.messageDigest) { - // use content message digest as value - attr.value = mds[signer.digestAlgorithm].digest(); - } else if(attr.type === forge.pki.oids.signingTime) { - // auto-populate signing time if not already set - if(!attr.value) { - attr.value = signingTime; - } - } - - // convert to ASN.1 and push onto Attributes SET (for signing) and - // onto authenticatedAttributesAsn1 to complete SignedData ASN.1 - // TODO: optimize away duplication - attrsAsn1.value.push(_attributeToAsn1(attr)); - signer.authenticatedAttributesAsn1.value.push(_attributeToAsn1(attr)); - } - - // DER-serialize and digest SET OF attributes only - bytes = asn1.toDer(attrsAsn1).getBytes(); - signer.md.start().update(bytes); - } - - // sign digest - signer.signature = signer.key.sign(signer.md, 'RSASSA-PKCS1-V1_5'); - } - - // add signer info - msg.signerInfos = _signersToAsn1(msg.signers); - } -}; - -/** - * Creates an empty PKCS#7 message of type EncryptedData. - * - * @return the message. - */ -p7.createEncryptedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.encryptedData, - version: 0, - encryptedContent: { - algorithm: forge.pki.oids['aes256-CBC'] - }, - - /** - * Reads an EncryptedData content block (in ASN.1 format) - * - * @param obj The ASN.1 representation of the EncryptedData content block - */ - fromAsn1: function(obj) { - // Validate EncryptedData content block and capture data. - _fromAsn1(msg, obj, p7.asn1.encryptedDataValidator); - }, - - /** - * Decrypt encrypted content - * - * @param key The (symmetric) key as a byte buffer - */ - decrypt: function(key) { - if(key !== undefined) { - msg.encryptedContent.key = key; - } - _decryptContent(msg); - } - }; - return msg; -}; - -/** - * Creates an empty PKCS#7 message of type EnvelopedData. - * - * @return the message. - */ -p7.createEnvelopedData = function() { - var msg = null; - msg = { - type: forge.pki.oids.envelopedData, - version: 0, - recipients: [], - encryptedContent: { - algorithm: forge.pki.oids['aes256-CBC'] - }, - - /** - * Reads an EnvelopedData content block (in ASN.1 format) - * - * @param obj the ASN.1 representation of the EnvelopedData content block. - */ - fromAsn1: function(obj) { - // validate EnvelopedData content block and capture data - var capture = _fromAsn1(msg, obj, p7.asn1.envelopedDataValidator); - msg.recipients = _recipientsFromAsn1(capture.recipientInfos.value); - }, - - toAsn1: function() { - // ContentInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // ContentType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(msg.type).getBytes()), - // [0] EnvelopedData - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(msg.version).getBytes()), - // RecipientInfos - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, - _recipientsToAsn1(msg.recipients)), - // EncryptedContentInfo - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, - _encryptedContentToAsn1(msg.encryptedContent)) - ]) - ]) - ]); - }, - - /** - * Find recipient by X.509 certificate's issuer. - * - * @param cert the certificate with the issuer to look for. - * - * @return the recipient object. - */ - findRecipient: function(cert) { - var sAttr = cert.issuer.attributes; - - for(var i = 0; i < msg.recipients.length; ++i) { - var r = msg.recipients[i]; - var rAttr = r.issuer; - - if(r.serialNumber !== cert.serialNumber) { - continue; - } - - if(rAttr.length !== sAttr.length) { - continue; - } - - var match = true; - for(var j = 0; j < sAttr.length; ++j) { - if(rAttr[j].type !== sAttr[j].type || - rAttr[j].value !== sAttr[j].value) { - match = false; - break; - } - } - - if(match) { - return r; - } - } - - return null; - }, - - /** - * Decrypt enveloped content - * - * @param recipient The recipient object related to the private key - * @param privKey The (RSA) private key object - */ - decrypt: function(recipient, privKey) { - if(msg.encryptedContent.key === undefined && recipient !== undefined && - privKey !== undefined) { - switch(recipient.encryptedContent.algorithm) { - case forge.pki.oids.rsaEncryption: - case forge.pki.oids.desCBC: - var key = privKey.decrypt(recipient.encryptedContent.content); - msg.encryptedContent.key = forge.util.createBuffer(key); - break; - - default: - throw new Error('Unsupported asymmetric cipher, ' + - 'OID ' + recipient.encryptedContent.algorithm); - } - } - - _decryptContent(msg); - }, - - /** - * Add (another) entity to list of recipients. - * - * @param cert The certificate of the entity to add. - */ - addRecipient: function(cert) { - msg.recipients.push({ - version: 0, - issuer: cert.issuer.attributes, - serialNumber: cert.serialNumber, - encryptedContent: { - // We simply assume rsaEncryption here, since forge.pki only - // supports RSA so far. If the PKI module supports other - // ciphers one day, we need to modify this one as well. - algorithm: forge.pki.oids.rsaEncryption, - key: cert.publicKey - } - }); - }, - - /** - * Encrypt enveloped content. - * - * This function supports two optional arguments, cipher and key, which - * can be used to influence symmetric encryption. Unless cipher is - * provided, the cipher specified in encryptedContent.algorithm is used - * (defaults to AES-256-CBC). If no key is provided, encryptedContent.key - * is (re-)used. If that one's not set, a random key will be generated - * automatically. - * - * @param [key] The key to be used for symmetric encryption. - * @param [cipher] The OID of the symmetric cipher to use. - */ - encrypt: function(key, cipher) { - // Part 1: Symmetric encryption - if(msg.encryptedContent.content === undefined) { - cipher = cipher || msg.encryptedContent.algorithm; - key = key || msg.encryptedContent.key; - - var keyLen, ivLen, ciphFn; - switch(cipher) { - case forge.pki.oids['aes128-CBC']: - keyLen = 16; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['aes192-CBC']: - keyLen = 24; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['aes256-CBC']: - keyLen = 32; - ivLen = 16; - ciphFn = forge.aes.createEncryptionCipher; - break; - - case forge.pki.oids['des-EDE3-CBC']: - keyLen = 24; - ivLen = 8; - ciphFn = forge.des.createEncryptionCipher; - break; - - default: - throw new Error('Unsupported symmetric cipher, OID ' + cipher); - } - - if(key === undefined) { - key = forge.util.createBuffer(forge.random.getBytes(keyLen)); - } else if(key.length() != keyLen) { - throw new Error('Symmetric key has wrong length; ' + - 'got ' + key.length() + ' bytes, expected ' + keyLen + '.'); - } - - // Keep a copy of the key & IV in the object, so the caller can - // use it for whatever reason. - msg.encryptedContent.algorithm = cipher; - msg.encryptedContent.key = key; - msg.encryptedContent.parameter = forge.util.createBuffer( - forge.random.getBytes(ivLen)); - - var ciph = ciphFn(key); - ciph.start(msg.encryptedContent.parameter.copy()); - ciph.update(msg.content); - - // The finish function does PKCS#7 padding by default, therefore - // no action required by us. - if(!ciph.finish()) { - throw new Error('Symmetric encryption failed.'); - } - - msg.encryptedContent.content = ciph.output; - } - - // Part 2: asymmetric encryption for each recipient - for(var i = 0; i < msg.recipients.length; ++i) { - var recipient = msg.recipients[i]; - - // Nothing to do, encryption already done. - if(recipient.encryptedContent.content !== undefined) { - continue; - } - - switch(recipient.encryptedContent.algorithm) { - case forge.pki.oids.rsaEncryption: - recipient.encryptedContent.content = - recipient.encryptedContent.key.encrypt( - msg.encryptedContent.key.data); - break; - - default: - throw new Error('Unsupported asymmetric cipher, OID ' + - recipient.encryptedContent.algorithm); - } - } - } - }; - return msg; -}; - -/** - * Converts a single recipient from an ASN.1 object. - * - * @param obj the ASN.1 RecipientInfo. - * - * @return the recipient object. - */ -function _recipientFromAsn1(obj) { - // validate EnvelopedData content block and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.recipientInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 RecipientInfo. ' + - 'ASN.1 object is not an PKCS#7 RecipientInfo.'); - error.errors = errors; - throw error; - } - - return { - version: capture.version.charCodeAt(0), - issuer: forge.pki.RDNAttributesAsArray(capture.issuer), - serialNumber: forge.util.createBuffer(capture.serial).toHex(), - encryptedContent: { - algorithm: asn1.derToOid(capture.encAlgorithm), - parameter: capture.encParameter.value, - content: capture.encKey - } - }; -} - -/** - * Converts a single recipient object to an ASN.1 object. - * - * @param obj the recipient object. - * - * @return the ASN.1 RecipientInfo. - */ -function _recipientToAsn1(obj) { - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(obj.version).getBytes()), - // IssuerAndSerialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Name - forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), - // Serial - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(obj.serialNumber)) - ]), - // KeyEncryptionAlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.encryptedContent.algorithm).getBytes()), - // Parameter, force NULL, only RSA supported for now. - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // EncryptedKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - obj.encryptedContent.content) - ]); -} - -/** - * Map a set of RecipientInfo ASN.1 objects to recipient objects. - * - * @param infos an array of ASN.1 representations RecipientInfo (i.e. SET OF). - * - * @return an array of recipient objects. - */ -function _recipientsFromAsn1(infos) { - var ret = []; - for(var i = 0; i < infos.length; ++i) { - ret.push(_recipientFromAsn1(infos[i])); - } - return ret; -} - -/** - * Map an array of recipient objects to ASN.1 RecipientInfo objects. - * - * @param recipients an array of recipientInfo objects. - * - * @return an array of ASN.1 RecipientInfos. - */ -function _recipientsToAsn1(recipients) { - var ret = []; - for(var i = 0; i < recipients.length; ++i) { - ret.push(_recipientToAsn1(recipients[i])); - } - return ret; -} - -/** - * Converts a single signer from an ASN.1 object. - * - * @param obj the ASN.1 representation of a SignerInfo. - * - * @return the signer object. - */ -function _signerFromAsn1(obj) { - // validate EnvelopedData content block and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, p7.asn1.signerInfoValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 SignerInfo. ' + - 'ASN.1 object is not an PKCS#7 SignerInfo.'); - error.errors = errors; - throw error; - } - - var rval = { - version: capture.version.charCodeAt(0), - issuer: forge.pki.RDNAttributesAsArray(capture.issuer), - serialNumber: forge.util.createBuffer(capture.serial).toHex(), - digestAlgorithm: asn1.derToOid(capture.digestAlgorithm), - signatureAlgorithm: asn1.derToOid(capture.signatureAlgorithm), - signature: capture.signature, - authenticatedAttributes: [], - unauthenticatedAttributes: [] - }; - - // TODO: convert attributes - var authenticatedAttributes = capture.authenticatedAttributes || []; - var unauthenticatedAttributes = capture.unauthenticatedAttributes || []; - - return rval; -} - -/** - * Converts a single signerInfo object to an ASN.1 object. - * - * @param obj the signerInfo object. - * - * @return the ASN.1 representation of a SignerInfo. - */ -function _signerToAsn1(obj) { - // SignerInfo - var rval = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(obj.version).getBytes()), - // issuerAndSerialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // name - forge.pki.distinguishedNameToAsn1({attributes: obj.issuer}), - // serial - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(obj.serialNumber)) - ]), - // digestAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.digestAlgorithm).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ]); - - // authenticatedAttributes (OPTIONAL) - if(obj.authenticatedAttributesAsn1) { - // add ASN.1 previously generated during signing - rval.value.push(obj.authenticatedAttributesAsn1); - } - - // digestEncryptionAlgorithm - rval.value.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(obj.signatureAlgorithm).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ])); - - // encryptedDigest - rval.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, obj.signature)); - - // unauthenticatedAttributes (OPTIONAL) - if(obj.unauthenticatedAttributes.length > 0) { - // [1] IMPLICIT - var attrsAsn1 = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, []); - for(var i = 0; i < obj.unauthenticatedAttributes.length; ++i) { - var attr = obj.unauthenticatedAttributes[i]; - attrsAsn1.values.push(_attributeToAsn1(attr)); - } - rval.value.push(attrsAsn1); - } - - return rval; -} - -/** - * Map a set of SignerInfo ASN.1 objects to an array of signer objects. - * - * @param signerInfoAsn1s an array of ASN.1 SignerInfos (i.e. SET OF). - * - * @return an array of signers objects. - */ -function _signersFromAsn1(signerInfoAsn1s) { - var ret = []; - for(var i = 0; i < signerInfoAsn1s.length; ++i) { - ret.push(_signerFromAsn1(signerInfoAsn1s[i])); - } - return ret; -} - -/** - * Map an array of signer objects to ASN.1 objects. - * - * @param signers an array of signer objects. - * - * @return an array of ASN.1 SignerInfos. - */ -function _signersToAsn1(signers) { - var ret = []; - for(var i = 0; i < signers.length; ++i) { - ret.push(_signerToAsn1(signers[i])); - } - return ret; -} - -/** - * Convert an attribute object to an ASN.1 Attribute. - * - * @param attr the attribute object. - * - * @return the ASN.1 Attribute. - */ -function _attributeToAsn1(attr) { - var value; - - // TODO: generalize to support more attributes - if(attr.type === forge.pki.oids.contentType) { - value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.value).getBytes()); - } else if(attr.type === forge.pki.oids.messageDigest) { - value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - attr.value.bytes()); - } else if(attr.type === forge.pki.oids.signingTime) { - /* Note per RFC 2985: Dates between 1 January 1950 and 31 December 2049 - (inclusive) MUST be encoded as UTCTime. Any dates with year values - before 1950 or after 2049 MUST be encoded as GeneralizedTime. [Further,] - UTCTime values MUST be expressed in Greenwich Mean Time (Zulu) and MUST - include seconds (i.e., times are YYMMDDHHMMSSZ), even where the - number of seconds is zero. Midnight (GMT) must be represented as - "YYMMDD000000Z". */ - // TODO: make these module-level constants - var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); - var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); - var date = attr.value; - if(typeof date === 'string') { - // try to parse date - var timestamp = Date.parse(date); - if(!isNaN(timestamp)) { - date = new Date(timestamp); - } else if(date.length === 13) { - // YYMMDDHHMMSSZ (13 chars for UTCTime) - date = asn1.utcTimeToDate(date); - } else { - // assume generalized time - date = asn1.generalizedTimeToDate(date); - } - } - - if(date >= jan_1_1950 && date < jan_1_2050) { - value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, - asn1.dateToUtcTime(date)); - } else { - value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, - asn1.dateToGeneralizedTime(date)); - } - } - - // TODO: expose as common API call - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - // AttributeValue - value - ]) - ]); -} - -/** - * Map messages encrypted content to ASN.1 objects. - * - * @param ec The encryptedContent object of the message. - * - * @return ASN.1 representation of the encryptedContent object (SEQUENCE). - */ -function _encryptedContentToAsn1(ec) { - return [ - // ContentType, always Data for the moment - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(forge.pki.oids.data).getBytes()), - // ContentEncryptionAlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // Algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(ec.algorithm).getBytes()), - // Parameters (IV) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - ec.parameter.getBytes()) - ]), - // [0] EncryptedContent - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - ec.content.getBytes()) - ]) - ]; -} - -/** - * Reads the "common part" of an PKCS#7 content block (in ASN.1 format) - * - * This function reads the "common part" of the PKCS#7 content blocks - * EncryptedData and EnvelopedData, i.e. version number and symmetrically - * encrypted content block. - * - * The result of the ASN.1 validate and capture process is returned - * to allow the caller to extract further data, e.g. the list of recipients - * in case of a EnvelopedData object. - * - * @param msg the PKCS#7 object to read the data to. - * @param obj the ASN.1 representation of the content block. - * @param validator the ASN.1 structure validator object to use. - * - * @return the value map captured by validator object. - */ -function _fromAsn1(msg, obj, validator) { - var capture = {}; - var errors = []; - if(!asn1.validate(obj, validator, capture, errors)) { - var error = new Error('Cannot read PKCS#7 message. ' + - 'ASN.1 object is not a supported PKCS#7 message.'); - error.errors = error; - throw error; - } - - // Check contentType, so far we only support (raw) Data. - var contentType = asn1.derToOid(capture.contentType); - if(contentType !== forge.pki.oids.data) { - throw new Error('Unsupported PKCS#7 message. ' + - 'Only wrapped ContentType Data supported.'); - } - - if(capture.encryptedContent) { - var content = ''; - if(forge.util.isArray(capture.encryptedContent)) { - for(var i = 0; i < capture.encryptedContent.length; ++i) { - if(capture.encryptedContent[i].type !== asn1.Type.OCTETSTRING) { - throw new Error('Malformed PKCS#7 message, expecting encrypted ' + - 'content constructed of only OCTET STRING objects.'); - } - content += capture.encryptedContent[i].value; - } - } else { - content = capture.encryptedContent; - } - msg.encryptedContent = { - algorithm: asn1.derToOid(capture.encAlgorithm), - parameter: forge.util.createBuffer(capture.encParameter.value), - content: forge.util.createBuffer(content) - }; - } - - if(capture.content) { - var content = ''; - if(forge.util.isArray(capture.content)) { - for(var i = 0; i < capture.content.length; ++i) { - if(capture.content[i].type !== asn1.Type.OCTETSTRING) { - throw new Error('Malformed PKCS#7 message, expecting ' + - 'content constructed of only OCTET STRING objects.'); - } - content += capture.content[i].value; - } - } else { - content = capture.content; - } - msg.content = forge.util.createBuffer(content); - } - - msg.version = capture.version.charCodeAt(0); - msg.rawCapture = capture; - - return capture; -} - -/** - * Decrypt the symmetrically encrypted content block of the PKCS#7 message. - * - * Decryption is skipped in case the PKCS#7 message object already has a - * (decrypted) content attribute. The algorithm, key and cipher parameters - * (probably the iv) are taken from the encryptedContent attribute of the - * message object. - * - * @param The PKCS#7 message object. - */ -function _decryptContent(msg) { - if(msg.encryptedContent.key === undefined) { - throw new Error('Symmetric key not available.'); - } - - if(msg.content === undefined) { - var ciph; - - switch(msg.encryptedContent.algorithm) { - case forge.pki.oids['aes128-CBC']: - case forge.pki.oids['aes192-CBC']: - case forge.pki.oids['aes256-CBC']: - ciph = forge.aes.createDecryptionCipher(msg.encryptedContent.key); - break; - - case forge.pki.oids['desCBC']: - case forge.pki.oids['des-EDE3-CBC']: - ciph = forge.des.createDecryptionCipher(msg.encryptedContent.key); - break; - - default: - throw new Error('Unsupported symmetric cipher, OID ' + - msg.encryptedContent.algorithm); - } - ciph.start(msg.encryptedContent.parameter); - ciph.update(msg.encryptedContent.content); - - if(!ciph.finish()) { - throw new Error('Symmetric decryption failed.'); - } - - msg.content = ciph.output; - } -} diff --git a/reverse_engineering/node_modules/node-forge/lib/pkcs7asn1.js b/reverse_engineering/node_modules/node-forge/lib/pkcs7asn1.js deleted file mode 100644 index a2ac01f8..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pkcs7asn1.js +++ /dev/null @@ -1,409 +0,0 @@ -/** - * Javascript implementation of ASN.1 validators for PKCS#7 v1.5. - * - * @author Dave Longley - * @author Stefan Siegl - * - * Copyright (c) 2012-2015 Digital Bazaar, Inc. - * Copyright (c) 2012 Stefan Siegl - * - * The ASN.1 representation of PKCS#7 is as follows - * (see RFC #2315 for details, http://www.ietf.org/rfc/rfc2315.txt): - * - * A PKCS#7 message consists of a ContentInfo on root level, which may - * contain any number of further ContentInfo nested into it. - * - * ContentInfo ::= SEQUENCE { - * contentType ContentType, - * content [0] EXPLICIT ANY DEFINED BY contentType OPTIONAL - * } - * - * ContentType ::= OBJECT IDENTIFIER - * - * EnvelopedData ::= SEQUENCE { - * version Version, - * recipientInfos RecipientInfos, - * encryptedContentInfo EncryptedContentInfo - * } - * - * EncryptedData ::= SEQUENCE { - * version Version, - * encryptedContentInfo EncryptedContentInfo - * } - * - * id-signedData OBJECT IDENTIFIER ::= { iso(1) member-body(2) - * us(840) rsadsi(113549) pkcs(1) pkcs7(7) 2 } - * - * SignedData ::= SEQUENCE { - * version INTEGER, - * digestAlgorithms DigestAlgorithmIdentifiers, - * contentInfo ContentInfo, - * certificates [0] IMPLICIT Certificates OPTIONAL, - * crls [1] IMPLICIT CertificateRevocationLists OPTIONAL, - * signerInfos SignerInfos - * } - * - * SignerInfos ::= SET OF SignerInfo - * - * SignerInfo ::= SEQUENCE { - * version Version, - * issuerAndSerialNumber IssuerAndSerialNumber, - * digestAlgorithm DigestAlgorithmIdentifier, - * authenticatedAttributes [0] IMPLICIT Attributes OPTIONAL, - * digestEncryptionAlgorithm DigestEncryptionAlgorithmIdentifier, - * encryptedDigest EncryptedDigest, - * unauthenticatedAttributes [1] IMPLICIT Attributes OPTIONAL - * } - * - * EncryptedDigest ::= OCTET STRING - * - * Attributes ::= SET OF Attribute - * - * Attribute ::= SEQUENCE { - * attrType OBJECT IDENTIFIER, - * attrValues SET OF AttributeValue - * } - * - * AttributeValue ::= ANY - * - * Version ::= INTEGER - * - * RecipientInfos ::= SET OF RecipientInfo - * - * EncryptedContentInfo ::= SEQUENCE { - * contentType ContentType, - * contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier, - * encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL - * } - * - * ContentEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of AES and DES3, there is only one, - * the IV. - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * EncryptedContent ::= OCTET STRING - * - * RecipientInfo ::= SEQUENCE { - * version Version, - * issuerAndSerialNumber IssuerAndSerialNumber, - * keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier, - * encryptedKey EncryptedKey - * } - * - * IssuerAndSerialNumber ::= SEQUENCE { - * issuer Name, - * serialNumber CertificateSerialNumber - * } - * - * CertificateSerialNumber ::= INTEGER - * - * KeyEncryptionAlgorithmIdentifier ::= AlgorithmIdentifier - * - * EncryptedKey ::= OCTET STRING - */ -var forge = require('./forge'); -require('./asn1'); -require('./util'); - -// shortcut for ASN.1 API -var asn1 = forge.asn1; - -// shortcut for PKCS#7 API -var p7v = module.exports = forge.pkcs7asn1 = forge.pkcs7asn1 || {}; -forge.pkcs7 = forge.pkcs7 || {}; -forge.pkcs7.asn1 = p7v; - -var contentInfoValidator = { - name: 'ContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'ContentInfo.ContentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'ContentInfo.content', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - captureAsn1: 'content' - }] -}; -p7v.contentInfoValidator = contentInfoValidator; - -var encryptedContentInfoValidator = { - name: 'EncryptedContentInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedContentInfo.contentType', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'contentType' - }, { - name: 'EncryptedContentInfo.contentEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedContentInfo.contentEncryptionAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encAlgorithm' - }, { - name: 'EncryptedContentInfo.contentEncryptionAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - captureAsn1: 'encParameter' - }] - }, { - name: 'EncryptedContentInfo.encryptedContent', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - /* The PKCS#7 structure output by OpenSSL somewhat differs from what - * other implementations do generate. - * - * OpenSSL generates a structure like this: - * SEQUENCE { - * ... - * [0] - * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 - * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 - * ... - * } - * - * Whereas other implementations (and this PKCS#7 module) generate: - * SEQUENCE { - * ... - * [0] { - * OCTET STRING - * 26 DA 67 D2 17 9C 45 3C B1 2A A8 59 2F 29 33 38 - * C3 C3 DF 86 71 74 7A 19 9F 40 D0 29 BE 85 90 45 - * ... - * } - * } - * - * In order to support both, we just capture the context specific - * field here. The OCTET STRING bit is removed below. - */ - capture: 'encryptedContent', - captureAsn1: 'encryptedContentAsn1' - }] -}; - -p7v.envelopedDataValidator = { - name: 'EnvelopedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EnvelopedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'EnvelopedData.RecipientInfos', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - captureAsn1: 'recipientInfos' - }].concat(encryptedContentInfoValidator) -}; - -p7v.encryptedDataValidator = { - name: 'EncryptedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'EncryptedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }].concat(encryptedContentInfoValidator) -}; - -var signerValidator = { - name: 'SignerInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false - }, { - name: 'SignerInfo.issuerAndSerialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.issuerAndSerialNumber.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'issuer' - }, { - name: 'SignerInfo.issuerAndSerialNumber.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'serial' - }] - }, { - name: 'SignerInfo.digestAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignerInfo.digestAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'digestAlgorithm' - }, { - name: 'SignerInfo.digestAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - constructed: false, - captureAsn1: 'digestParameter', - optional: true - }] - }, { - name: 'SignerInfo.authenticatedAttributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - capture: 'authenticatedAttributes' - }, { - name: 'SignerInfo.digestEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - capture: 'signatureAlgorithm' - }, { - name: 'SignerInfo.encryptedDigest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'signature' - }, { - name: 'SignerInfo.unauthenticatedAttributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - optional: true, - capture: 'unauthenticatedAttributes' - }] -}; - -p7v.signedDataValidator = { - name: 'SignedData', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'SignedData.Version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'SignedData.DigestAlgorithms', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true, - captureAsn1: 'digestAlgorithms' - }, - contentInfoValidator, - { - name: 'SignedData.Certificates', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - optional: true, - captureAsn1: 'certificates' - }, { - name: 'SignedData.CertificateRevocationLists', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - optional: true, - captureAsn1: 'crls' - }, { - name: 'SignedData.SignerInfos', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - capture: 'signerInfos', - optional: true, - value: [signerValidator] - }] -}; - -p7v.recipientInfoValidator = { - name: 'RecipientInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'version' - }, { - name: 'RecipientInfo.issuerAndSerial', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.issuerAndSerial.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'issuer' - }, { - name: 'RecipientInfo.issuerAndSerial.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'serial' - }] - }, { - name: 'RecipientInfo.keyEncryptionAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'RecipientInfo.keyEncryptionAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'encAlgorithm' - }, { - name: 'RecipientInfo.keyEncryptionAlgorithm.parameter', - tagClass: asn1.Class.UNIVERSAL, - constructed: false, - captureAsn1: 'encParameter' - }] - }, { - name: 'RecipientInfo.encryptedKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'encKey' - }] -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/pki.js b/reverse_engineering/node_modules/node-forge/lib/pki.js deleted file mode 100644 index ee82ff1c..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pki.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * Javascript implementation of a basic Public Key Infrastructure, including - * support for RSA public and private keys. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./asn1'); -require('./oids'); -require('./pbe'); -require('./pem'); -require('./pbkdf2'); -require('./pkcs12'); -require('./pss'); -require('./rsa'); -require('./util'); -require('./x509'); - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Public Key Infrastructure (PKI) implementation. */ -var pki = module.exports = forge.pki = forge.pki || {}; - -/** - * NOTE: THIS METHOD IS DEPRECATED. Use pem.decode() instead. - * - * Converts PEM-formatted data to DER. - * - * @param pem the PEM-formatted data. - * - * @return the DER-formatted data. - */ -pki.pemToDer = function(pem) { - var msg = forge.pem.decode(pem)[0]; - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert PEM to DER; PEM is encrypted.'); - } - return forge.util.createBuffer(msg.body); -}; - -/** - * Converts an RSA private key from PEM format. - * - * @param pem the PEM-formatted private key. - * - * @return the private key. - */ -pki.privateKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PRIVATE KEY' && msg.type !== 'RSA PRIVATE KEY') { - var error = new Error('Could not convert private key from PEM; PEM ' + - 'header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert private key from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return pki.privateKeyFromAsn1(obj); -}; - -/** - * Converts an RSA private key to PEM format. - * - * @param key the private key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted private key. - */ -pki.privateKeyToPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'RSA PRIVATE KEY', - body: asn1.toDer(pki.privateKeyToAsn1(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts a PrivateKeyInfo to PEM format. - * - * @param pki the PrivateKeyInfo. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted private key. - */ -pki.privateKeyInfoToPem = function(pki, maxline) { - // convert to DER, then PEM-encode - var msg = { - type: 'PRIVATE KEY', - body: asn1.toDer(pki).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/prime.js b/reverse_engineering/node_modules/node-forge/lib/prime.js deleted file mode 100644 index 3d51473f..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/prime.js +++ /dev/null @@ -1,297 +0,0 @@ -/** - * Prime number generation API. - * - * @author Dave Longley - * - * Copyright (c) 2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); -require('./jsbn'); -require('./random'); - -(function() { - -// forge.prime already defined -if(forge.prime) { - module.exports = forge.prime; - return; -} - -/* PRIME API */ -var prime = module.exports = forge.prime = forge.prime || {}; - -var BigInteger = forge.jsbn.BigInteger; - -// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; -var THIRTY = new BigInteger(null); -THIRTY.fromInt(30); -var op_or = function(x, y) {return x|y;}; - -/** - * Generates a random probable prime with the given number of bits. - * - * Alternative algorithms can be specified by name as a string or as an - * object with custom options like so: - * - * { - * name: 'PRIMEINC', - * options: { - * maxBlockTime: , - * millerRabinTests: , - * workerScript: , - * workers: . - * workLoad: the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * } - * } - * - * @param bits the number of bits for the prime number. - * @param options the options to use. - * [algorithm] the algorithm to use (default: 'PRIMEINC'). - * [prng] a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - * - * @return callback(err, num) called once the operation completes. - */ -prime.generateProbablePrime = function(bits, options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - - // default to PRIMEINC algorithm - var algorithm = options.algorithm || 'PRIMEINC'; - if(typeof algorithm === 'string') { - algorithm = {name: algorithm}; - } - algorithm.options = algorithm.options || {}; - - // create prng with api that matches BigInteger secure random - var prng = options.prng || forge.random; - var rng = { - // x is an array to fill with bytes - nextBytes: function(x) { - var b = prng.getBytesSync(x.length); - for(var i = 0; i < x.length; ++i) { - x[i] = b.charCodeAt(i); - } - } - }; - - if(algorithm.name === 'PRIMEINC') { - return primeincFindPrime(bits, rng, algorithm.options, callback); - } - - throw new Error('Invalid prime generation algorithm: ' + algorithm.name); -}; - -function primeincFindPrime(bits, rng, options, callback) { - if('workers' in options) { - return primeincFindPrimeWithWorkers(bits, rng, options, callback); - } - return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); -} - -function primeincFindPrimeWithoutWorkers(bits, rng, options, callback) { - // initialize random number - var num = generateRandom(bits, rng); - - /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The - number we are given is always aligned at 30k + 1. Each time the number is - determined not to be prime we add to get to the next 'i', eg: if the number - was at 30k + 1 we add 6. */ - var deltaIdx = 0; - - // get required number of MR tests - var mrTests = getMillerRabinTests(num.bitLength()); - if('millerRabinTests' in options) { - mrTests = options.millerRabinTests; - } - - // find prime nearest to 'num' for maxBlockTime ms - // 10 ms gives 5ms of leeway for other calculations before dropping - // below 60fps (1000/60 == 16.67), but in reality, the number will - // likely be higher due to an 'atomic' big int modPow - var maxBlockTime = 10; - if('maxBlockTime' in options) { - maxBlockTime = options.maxBlockTime; - } - - _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); -} - -function _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback) { - var start = +new Date(); - do { - // overflow, regenerate random number - if(num.bitLength() > bits) { - num = generateRandom(bits, rng); - } - // do primality test - if(num.isProbablePrime(mrTests)) { - return callback(null, num); - } - // get next potential prime - num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } while(maxBlockTime < 0 || (+new Date() - start < maxBlockTime)); - - // keep trying later - forge.util.setImmediate(function() { - _primeinc(num, bits, rng, deltaIdx, mrTests, maxBlockTime, callback); - }); -} - -// NOTE: This algorithm is indeterminate in nature because workers -// run in parallel looking at different segments of numbers. Even if this -// algorithm is run twice with the same input from a predictable RNG, it -// may produce different outputs. -function primeincFindPrimeWithWorkers(bits, rng, options, callback) { - // web workers unavailable - if(typeof Worker === 'undefined') { - return primeincFindPrimeWithoutWorkers(bits, rng, options, callback); - } - - // initialize random number - var num = generateRandom(bits, rng); - - // use web workers to generate keys - var numWorkers = options.workers; - var workLoad = options.workLoad || 100; - var range = workLoad * 30 / 8; - var workerScript = options.workerScript || 'forge/prime.worker.js'; - if(numWorkers === -1) { - return forge.util.estimateCores(function(err, cores) { - if(err) { - // default to 2 - cores = 2; - } - numWorkers = cores - 1; - generate(); - }); - } - generate(); - - function generate() { - // require at least 1 worker - numWorkers = Math.max(1, numWorkers); - - // TODO: consider optimizing by starting workers outside getPrime() ... - // note that in order to clean up they will have to be made internally - // asynchronous which may actually be slower - - // start workers immediately - var workers = []; - for(var i = 0; i < numWorkers; ++i) { - // FIXME: fix path or use blob URLs - workers[i] = new Worker(workerScript); - } - var running = numWorkers; - - // listen for requests from workers and assign ranges to find prime - for(var i = 0; i < numWorkers; ++i) { - workers[i].addEventListener('message', workerMessage); - } - - /* Note: The distribution of random numbers is unknown. Therefore, each - web worker is continuously allocated a range of numbers to check for a - random number until one is found. - - Every 30 numbers will be checked just 8 times, because prime numbers - have the form: - - 30k+i, for i < 30 and gcd(30, i)=1 (there are 8 values of i for this) - - Therefore, if we want a web worker to run N checks before asking for - a new range of numbers, each range must contain N*30/8 numbers. - - For 100 checks (workLoad), this is a range of 375. */ - - var found = false; - function workerMessage(e) { - // ignore message, prime already found - if(found) { - return; - } - - --running; - var data = e.data; - if(data.found) { - // terminate all workers - for(var i = 0; i < workers.length; ++i) { - workers[i].terminate(); - } - found = true; - return callback(null, new BigInteger(data.prime, 16)); - } - - // overflow, regenerate random number - if(num.bitLength() > bits) { - num = generateRandom(bits, rng); - } - - // assign new range to check - var hex = num.toString(16); - - // start prime search - e.target.postMessage({ - hex: hex, - workLoad: workLoad - }); - - num.dAddOffset(range, 0); - } - } -} - -/** - * Generates a random number using the given number of bits and RNG. - * - * @param bits the number of bits for the number. - * @param rng the random number generator to use. - * - * @return the random number. - */ -function generateRandom(bits, rng) { - var num = new BigInteger(bits, rng); - // force MSB set - var bits1 = bits - 1; - if(!num.testBit(bits1)) { - num.bitwiseTo(BigInteger.ONE.shiftLeft(bits1), op_or, num); - } - // align number on 30k+1 boundary - num.dAddOffset(31 - num.mod(THIRTY).byteValue(), 0); - return num; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} - -})(); diff --git a/reverse_engineering/node_modules/node-forge/lib/prime.worker.js b/reverse_engineering/node_modules/node-forge/lib/prime.worker.js deleted file mode 100644 index ce1355d9..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/prime.worker.js +++ /dev/null @@ -1,168 +0,0 @@ -/** - * RSA Key Generation Worker. - * - * @author Dave Longley - * - * Copyright (c) 2013 Digital Bazaar, Inc. - */ -// worker is built using CommonJS syntax to include all code in one worker file -//importScripts('jsbn.js'); -var forge = require('./forge'); -require('./jsbn'); - -// prime constants -var LOW_PRIMES = [2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997]; -var LP_LIMIT = (1 << 26) / LOW_PRIMES[LOW_PRIMES.length - 1]; - -var BigInteger = forge.jsbn.BigInteger; -var BIG_TWO = new BigInteger(null); -BIG_TWO.fromInt(2); - -self.addEventListener('message', function(e) { - var result = findPrime(e.data); - self.postMessage(result); -}); - -// start receiving ranges to check -self.postMessage({found: false}); - -// primes are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; - -function findPrime(data) { - // TODO: abstract based on data.algorithm (PRIMEINC vs. others) - - // create BigInteger from given random bytes - var num = new BigInteger(data.hex, 16); - - /* Note: All primes are of the form 30k+i for i < 30 and gcd(30, i)=1. The - number we are given is always aligned at 30k + 1. Each time the number is - determined not to be prime we add to get to the next 'i', eg: if the number - was at 30k + 1 we add 6. */ - var deltaIdx = 0; - - // find nearest prime - var workLoad = data.workLoad; - for(var i = 0; i < workLoad; ++i) { - // do primality test - if(isProbablePrime(num)) { - return {found: true, prime: num.toString(16)}; - } - // get next potential prime - num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } - - return {found: false}; -} - -function isProbablePrime(n) { - // divide by low primes, ignore even checks, etc (n alread aligned properly) - var i = 1; - while(i < LOW_PRIMES.length) { - var m = LOW_PRIMES[i]; - var j = i + 1; - while(j < LOW_PRIMES.length && m < LP_LIMIT) { - m *= LOW_PRIMES[j++]; - } - m = n.modInt(m); - while(i < j) { - if(m % LOW_PRIMES[i++] === 0) { - return false; - } - } - } - return runMillerRabin(n); -} - -// HAC 4.24, Miller-Rabin -function runMillerRabin(n) { - // n1 = n - 1 - var n1 = n.subtract(BigInteger.ONE); - - // get s and d such that n1 = 2^s * d - var s = n1.getLowestSetBit(); - if(s <= 0) { - return false; - } - var d = n1.shiftRight(s); - - var k = _getMillerRabinTests(n.bitLength()); - var prng = getPrng(); - var a; - for(var i = 0; i < k; ++i) { - // select witness 'a' at random from between 1 and n - 1 - do { - a = new BigInteger(n.bitLength(), prng); - } while(a.compareTo(BigInteger.ONE) <= 0 || a.compareTo(n1) >= 0); - - /* See if 'a' is a composite witness. */ - - // x = a^d mod n - var x = a.modPow(d, n); - - // probably prime - if(x.compareTo(BigInteger.ONE) === 0 || x.compareTo(n1) === 0) { - continue; - } - - var j = s; - while(--j) { - // x = x^2 mod a - x = x.modPowInt(2, n); - - // 'n' is composite because no previous x == -1 mod n - if(x.compareTo(BigInteger.ONE) === 0) { - return false; - } - // x == -1 mod n, so probably prime - if(x.compareTo(n1) === 0) { - break; - } - } - - // 'x' is first_x^(n1/2) and is not +/- 1, so 'n' is not prime - if(j === 0) { - return false; - } - } - - return true; -} - -// get pseudo random number generator -function getPrng() { - // create prng with api that matches BigInteger secure random - return { - // x is an array to fill with bytes - nextBytes: function(x) { - for(var i = 0; i < x.length; ++i) { - x[i] = Math.floor(Math.random() * 0xFF); - } - } - }; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function _getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} diff --git a/reverse_engineering/node_modules/node-forge/lib/prng.js b/reverse_engineering/node_modules/node-forge/lib/prng.js deleted file mode 100644 index c2f5f051..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/prng.js +++ /dev/null @@ -1,419 +0,0 @@ -/** - * A javascript implementation of a cryptographically-secure - * Pseudo Random Number Generator (PRNG). The Fortuna algorithm is followed - * here though the use of SHA-256 is not enforced; when generating an - * a PRNG context, the hashing algorithm and block cipher used for - * the generator are specified via a plugin. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -var _crypto = null; -if(forge.util.isNodejs && !forge.options.usePureJavaScript && - !process.versions['node-webkit']) { - _crypto = require('crypto'); -} - -/* PRNG API */ -var prng = module.exports = forge.prng = forge.prng || {}; - -/** - * Creates a new PRNG context. - * - * A PRNG plugin must be passed in that will provide: - * - * 1. A function that initializes the key and seed of a PRNG context. It - * will be given a 16 byte key and a 16 byte seed. Any key expansion - * or transformation of the seed from a byte string into an array of - * integers (or similar) should be performed. - * 2. The cryptographic function used by the generator. It takes a key and - * a seed. - * 3. A seed increment function. It takes the seed and returns seed + 1. - * 4. An api to create a message digest. - * - * For an example, see random.js. - * - * @param plugin the PRNG plugin to use. - */ -prng.create = function(plugin) { - var ctx = { - plugin: plugin, - key: null, - seed: null, - time: null, - // number of reseeds so far - reseeds: 0, - // amount of data generated so far - generated: 0, - // no initial key bytes - keyBytes: '' - }; - - // create 32 entropy pools (each is a message digest) - var md = plugin.md; - var pools = new Array(32); - for(var i = 0; i < 32; ++i) { - pools[i] = md.create(); - } - ctx.pools = pools; - - // entropy pools are written to cyclically, starting at index 0 - ctx.pool = 0; - - /** - * Generates random bytes. The bytes may be generated synchronously or - * asynchronously. Web workers must use the asynchronous interface or - * else the behavior is undefined. - * - * @param count the number of random bytes to generate. - * @param [callback(err, bytes)] called once the operation completes. - * - * @return count random bytes as a string. - */ - ctx.generate = function(count, callback) { - // do synchronously - if(!callback) { - return ctx.generateSync(count); - } - - // simple generator using counter-based CBC - var cipher = ctx.plugin.cipher; - var increment = ctx.plugin.increment; - var formatKey = ctx.plugin.formatKey; - var formatSeed = ctx.plugin.formatSeed; - var b = forge.util.createBuffer(); - - // paranoid deviation from Fortuna: - // reset key for every request to protect previously - // generated random bytes should the key be discovered; - // there is no 100ms based reseeding because of this - // forced reseed for every `generate` call - ctx.key = null; - - generate(); - - function generate(err) { - if(err) { - return callback(err); - } - - // sufficient bytes generated - if(b.length() >= count) { - return callback(null, b.getBytes(count)); - } - - // if amount of data generated is greater than 1 MiB, trigger reseed - if(ctx.generated > 0xfffff) { - ctx.key = null; - } - - if(ctx.key === null) { - // prevent stack overflow - return forge.util.nextTick(function() { - _reseed(generate); - }); - } - - // generate the random bytes - var bytes = cipher(ctx.key, ctx.seed); - ctx.generated += bytes.length; - b.putBytes(bytes); - - // generate bytes for a new key and seed - ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); - ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); - - forge.util.setImmediate(generate); - } - }; - - /** - * Generates random bytes synchronously. - * - * @param count the number of random bytes to generate. - * - * @return count random bytes as a string. - */ - ctx.generateSync = function(count) { - // simple generator using counter-based CBC - var cipher = ctx.plugin.cipher; - var increment = ctx.plugin.increment; - var formatKey = ctx.plugin.formatKey; - var formatSeed = ctx.plugin.formatSeed; - - // paranoid deviation from Fortuna: - // reset key for every request to protect previously - // generated random bytes should the key be discovered; - // there is no 100ms based reseeding because of this - // forced reseed for every `generateSync` call - ctx.key = null; - - var b = forge.util.createBuffer(); - while(b.length() < count) { - // if amount of data generated is greater than 1 MiB, trigger reseed - if(ctx.generated > 0xfffff) { - ctx.key = null; - } - - if(ctx.key === null) { - _reseedSync(); - } - - // generate the random bytes - var bytes = cipher(ctx.key, ctx.seed); - ctx.generated += bytes.length; - b.putBytes(bytes); - - // generate bytes for a new key and seed - ctx.key = formatKey(cipher(ctx.key, increment(ctx.seed))); - ctx.seed = formatSeed(cipher(ctx.key, ctx.seed)); - } - - return b.getBytes(count); - }; - - /** - * Private function that asynchronously reseeds a generator. - * - * @param callback(err) called once the operation completes. - */ - function _reseed(callback) { - if(ctx.pools[0].messageLength >= 32) { - _seed(); - return callback(); - } - // not enough seed data... - var needed = (32 - ctx.pools[0].messageLength) << 5; - ctx.seedFile(needed, function(err, bytes) { - if(err) { - return callback(err); - } - ctx.collect(bytes); - _seed(); - callback(); - }); - } - - /** - * Private function that synchronously reseeds a generator. - */ - function _reseedSync() { - if(ctx.pools[0].messageLength >= 32) { - return _seed(); - } - // not enough seed data... - var needed = (32 - ctx.pools[0].messageLength) << 5; - ctx.collect(ctx.seedFileSync(needed)); - _seed(); - } - - /** - * Private function that seeds a generator once enough bytes are available. - */ - function _seed() { - // update reseed count - ctx.reseeds = (ctx.reseeds === 0xffffffff) ? 0 : ctx.reseeds + 1; - - // goal is to update `key` via: - // key = hash(key + s) - // where 's' is all collected entropy from selected pools, then... - - // create a plugin-based message digest - var md = ctx.plugin.md.create(); - - // consume current key bytes - md.update(ctx.keyBytes); - - // digest the entropy of pools whose index k meet the - // condition 'n mod 2^k == 0' where n is the number of reseeds - var _2powK = 1; - for(var k = 0; k < 32; ++k) { - if(ctx.reseeds % _2powK === 0) { - md.update(ctx.pools[k].digest().getBytes()); - ctx.pools[k].start(); - } - _2powK = _2powK << 1; - } - - // get digest for key bytes - ctx.keyBytes = md.digest().getBytes(); - - // paranoid deviation from Fortuna: - // update `seed` via `seed = hash(key)` - // instead of initializing to zero once and only - // ever incrementing it - md.start(); - md.update(ctx.keyBytes); - var seedBytes = md.digest().getBytes(); - - // update state - ctx.key = ctx.plugin.formatKey(ctx.keyBytes); - ctx.seed = ctx.plugin.formatSeed(seedBytes); - ctx.generated = 0; - } - - /** - * The built-in default seedFile. This seedFile is used when entropy - * is needed immediately. - * - * @param needed the number of bytes that are needed. - * - * @return the random bytes. - */ - function defaultSeedFile(needed) { - // use window.crypto.getRandomValues strong source of entropy if available - var getRandomValues = null; - var globalScope = forge.util.globalScope; - var _crypto = globalScope.crypto || globalScope.msCrypto; - if(_crypto && _crypto.getRandomValues) { - getRandomValues = function(arr) { - return _crypto.getRandomValues(arr); - }; - } - - var b = forge.util.createBuffer(); - if(getRandomValues) { - while(b.length() < needed) { - // max byte length is 65536 before QuotaExceededError is thrown - // http://www.w3.org/TR/WebCryptoAPI/#RandomSource-method-getRandomValues - var count = Math.max(1, Math.min(needed - b.length(), 65536) / 4); - var entropy = new Uint32Array(Math.floor(count)); - try { - getRandomValues(entropy); - for(var i = 0; i < entropy.length; ++i) { - b.putInt32(entropy[i]); - } - } catch(e) { - /* only ignore QuotaExceededError */ - if(!(typeof QuotaExceededError !== 'undefined' && - e instanceof QuotaExceededError)) { - throw e; - } - } - } - } - - // be sad and add some weak random data - if(b.length() < needed) { - /* Draws from Park-Miller "minimal standard" 31 bit PRNG, - implemented with David G. Carta's optimization: with 32 bit math - and without division (Public Domain). */ - var hi, lo, next; - var seed = Math.floor(Math.random() * 0x010000); - while(b.length() < needed) { - lo = 16807 * (seed & 0xFFFF); - hi = 16807 * (seed >> 16); - lo += (hi & 0x7FFF) << 16; - lo += hi >> 15; - lo = (lo & 0x7FFFFFFF) + (lo >> 31); - seed = lo & 0xFFFFFFFF; - - // consume lower 3 bytes of seed - for(var i = 0; i < 3; ++i) { - // throw in more pseudo random - next = seed >>> (i << 3); - next ^= Math.floor(Math.random() * 0x0100); - b.putByte(String.fromCharCode(next & 0xFF)); - } - } - } - - return b.getBytes(needed); - } - // initialize seed file APIs - if(_crypto) { - // use nodejs async API - ctx.seedFile = function(needed, callback) { - _crypto.randomBytes(needed, function(err, bytes) { - if(err) { - return callback(err); - } - callback(null, bytes.toString()); - }); - }; - // use nodejs sync API - ctx.seedFileSync = function(needed) { - return _crypto.randomBytes(needed).toString(); - }; - } else { - ctx.seedFile = function(needed, callback) { - try { - callback(null, defaultSeedFile(needed)); - } catch(e) { - callback(e); - } - }; - ctx.seedFileSync = defaultSeedFile; - } - - /** - * Adds entropy to a prng ctx's accumulator. - * - * @param bytes the bytes of entropy as a string. - */ - ctx.collect = function(bytes) { - // iterate over pools distributing entropy cyclically - var count = bytes.length; - for(var i = 0; i < count; ++i) { - ctx.pools[ctx.pool].update(bytes.substr(i, 1)); - ctx.pool = (ctx.pool === 31) ? 0 : ctx.pool + 1; - } - }; - - /** - * Collects an integer of n bits. - * - * @param i the integer entropy. - * @param n the number of bits in the integer. - */ - ctx.collectInt = function(i, n) { - var bytes = ''; - for(var x = 0; x < n; x += 8) { - bytes += String.fromCharCode((i >> x) & 0xFF); - } - ctx.collect(bytes); - }; - - /** - * Registers a Web Worker to receive immediate entropy from the main thread. - * This method is required until Web Workers can access the native crypto - * API. This method should be called twice for each created worker, once in - * the main thread, and once in the worker itself. - * - * @param worker the worker to register. - */ - ctx.registerWorker = function(worker) { - // worker receives random bytes - if(worker === self) { - ctx.seedFile = function(needed, callback) { - function listener(e) { - var data = e.data; - if(data.forge && data.forge.prng) { - self.removeEventListener('message', listener); - callback(data.forge.prng.err, data.forge.prng.bytes); - } - } - self.addEventListener('message', listener); - self.postMessage({forge: {prng: {needed: needed}}}); - }; - } else { - // main thread sends random bytes upon request - var listener = function(e) { - var data = e.data; - if(data.forge && data.forge.prng) { - ctx.seedFile(data.forge.prng.needed, function(err, bytes) { - worker.postMessage({forge: {prng: {err: err, bytes: bytes}}}); - }); - } - }; - // TODO: do we need to remove the event listener when the worker dies? - worker.addEventListener('message', listener); - } - }; - - return ctx; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/pss.js b/reverse_engineering/node_modules/node-forge/lib/pss.js deleted file mode 100644 index 2596693c..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/pss.js +++ /dev/null @@ -1,241 +0,0 @@ -/** - * Javascript implementation of PKCS#1 PSS signature padding. - * - * @author Stefan Siegl - * - * Copyright (c) 2012 Stefan Siegl - */ -var forge = require('./forge'); -require('./random'); -require('./util'); - -// shortcut for PSS API -var pss = module.exports = forge.pss = forge.pss || {}; - -/** - * Creates a PSS signature scheme object. - * - * There are several ways to provide a salt for encoding: - * - * 1. Specify the saltLength only and the built-in PRNG will generate it. - * 2. Specify the saltLength and a custom PRNG with 'getBytesSync' defined that - * will be used. - * 3. Specify the salt itself as a forge.util.ByteBuffer. - * - * @param options the options to use: - * md the message digest object to use, a forge md instance. - * mgf the mask generation function to use, a forge mgf instance. - * [saltLength] the length of the salt in octets. - * [prng] the pseudo-random number generator to use to produce a salt. - * [salt] the salt to use when encoding. - * - * @return a signature scheme object. - */ -pss.create = function(options) { - // backwards compatibility w/legacy args: hash, mgf, sLen - if(arguments.length === 3) { - options = { - md: arguments[0], - mgf: arguments[1], - saltLength: arguments[2] - }; - } - - var hash = options.md; - var mgf = options.mgf; - var hLen = hash.digestLength; - - var salt_ = options.salt || null; - if(typeof salt_ === 'string') { - // assume binary-encoded string - salt_ = forge.util.createBuffer(salt_); - } - - var sLen; - if('saltLength' in options) { - sLen = options.saltLength; - } else if(salt_ !== null) { - sLen = salt_.length(); - } else { - throw new Error('Salt length not specified or specific salt not given.'); - } - - if(salt_ !== null && salt_.length() !== sLen) { - throw new Error('Given salt length does not match length of given salt.'); - } - - var prng = options.prng || forge.random; - - var pssobj = {}; - - /** - * Encodes a PSS signature. - * - * This function implements EMSA-PSS-ENCODE as per RFC 3447, section 9.1.1. - * - * @param md the message digest object with the hash to sign. - * @param modsBits the length of the RSA modulus in bits. - * - * @return the encoded message as a binary-encoded string of length - * ceil((modBits - 1) / 8). - */ - pssobj.encode = function(md, modBits) { - var i; - var emBits = modBits - 1; - var emLen = Math.ceil(emBits / 8); - - /* 2. Let mHash = Hash(M), an octet string of length hLen. */ - var mHash = md.digest().getBytes(); - - /* 3. If emLen < hLen + sLen + 2, output "encoding error" and stop. */ - if(emLen < hLen + sLen + 2) { - throw new Error('Message is too long to encrypt.'); - } - - /* 4. Generate a random octet string salt of length sLen; if sLen = 0, - * then salt is the empty string. */ - var salt; - if(salt_ === null) { - salt = prng.getBytesSync(sLen); - } else { - salt = salt_.bytes(); - } - - /* 5. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt; */ - var m_ = new forge.util.ByteBuffer(); - m_.fillWithByte(0, 8); - m_.putBytes(mHash); - m_.putBytes(salt); - - /* 6. Let H = Hash(M'), an octet string of length hLen. */ - hash.start(); - hash.update(m_.getBytes()); - var h = hash.digest().getBytes(); - - /* 7. Generate an octet string PS consisting of emLen - sLen - hLen - 2 - * zero octets. The length of PS may be 0. */ - var ps = new forge.util.ByteBuffer(); - ps.fillWithByte(0, emLen - sLen - hLen - 2); - - /* 8. Let DB = PS || 0x01 || salt; DB is an octet string of length - * emLen - hLen - 1. */ - ps.putByte(0x01); - ps.putBytes(salt); - var db = ps.getBytes(); - - /* 9. Let dbMask = MGF(H, emLen - hLen - 1). */ - var maskLen = emLen - hLen - 1; - var dbMask = mgf.generate(h, maskLen); - - /* 10. Let maskedDB = DB \xor dbMask. */ - var maskedDB = ''; - for(i = 0; i < maskLen; i++) { - maskedDB += String.fromCharCode(db.charCodeAt(i) ^ dbMask.charCodeAt(i)); - } - - /* 11. Set the leftmost 8emLen - emBits bits of the leftmost octet in - * maskedDB to zero. */ - var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; - maskedDB = String.fromCharCode(maskedDB.charCodeAt(0) & ~mask) + - maskedDB.substr(1); - - /* 12. Let EM = maskedDB || H || 0xbc. - * 13. Output EM. */ - return maskedDB + h + String.fromCharCode(0xbc); - }; - - /** - * Verifies a PSS signature. - * - * This function implements EMSA-PSS-VERIFY as per RFC 3447, section 9.1.2. - * - * @param mHash the message digest hash, as a binary-encoded string, to - * compare against the signature. - * @param em the encoded message, as a binary-encoded string - * (RSA decryption result). - * @param modsBits the length of the RSA modulus in bits. - * - * @return true if the signature was verified, false if not. - */ - pssobj.verify = function(mHash, em, modBits) { - var i; - var emBits = modBits - 1; - var emLen = Math.ceil(emBits / 8); - - /* c. Convert the message representative m to an encoded message EM - * of length emLen = ceil((modBits - 1) / 8) octets, where modBits - * is the length in bits of the RSA modulus n */ - em = em.substr(-emLen); - - /* 3. If emLen < hLen + sLen + 2, output "inconsistent" and stop. */ - if(emLen < hLen + sLen + 2) { - throw new Error('Inconsistent parameters to PSS signature verification.'); - } - - /* 4. If the rightmost octet of EM does not have hexadecimal value - * 0xbc, output "inconsistent" and stop. */ - if(em.charCodeAt(emLen - 1) !== 0xbc) { - throw new Error('Encoded message does not end in 0xBC.'); - } - - /* 5. Let maskedDB be the leftmost emLen - hLen - 1 octets of EM, and - * let H be the next hLen octets. */ - var maskLen = emLen - hLen - 1; - var maskedDB = em.substr(0, maskLen); - var h = em.substr(maskLen, hLen); - - /* 6. If the leftmost 8emLen - emBits bits of the leftmost octet in - * maskedDB are not all equal to zero, output "inconsistent" and stop. */ - var mask = (0xFF00 >> (8 * emLen - emBits)) & 0xFF; - if((maskedDB.charCodeAt(0) & mask) !== 0) { - throw new Error('Bits beyond keysize not zero as expected.'); - } - - /* 7. Let dbMask = MGF(H, emLen - hLen - 1). */ - var dbMask = mgf.generate(h, maskLen); - - /* 8. Let DB = maskedDB \xor dbMask. */ - var db = ''; - for(i = 0; i < maskLen; i++) { - db += String.fromCharCode(maskedDB.charCodeAt(i) ^ dbMask.charCodeAt(i)); - } - - /* 9. Set the leftmost 8emLen - emBits bits of the leftmost octet - * in DB to zero. */ - db = String.fromCharCode(db.charCodeAt(0) & ~mask) + db.substr(1); - - /* 10. If the emLen - hLen - sLen - 2 leftmost octets of DB are not zero - * or if the octet at position emLen - hLen - sLen - 1 (the leftmost - * position is "position 1") does not have hexadecimal value 0x01, - * output "inconsistent" and stop. */ - var checkLen = emLen - hLen - sLen - 2; - for(i = 0; i < checkLen; i++) { - if(db.charCodeAt(i) !== 0x00) { - throw new Error('Leftmost octets not zero as expected'); - } - } - - if(db.charCodeAt(checkLen) !== 0x01) { - throw new Error('Inconsistent PSS signature, 0x01 marker not found'); - } - - /* 11. Let salt be the last sLen octets of DB. */ - var salt = db.substr(-sLen); - - /* 12. Let M' = (0x)00 00 00 00 00 00 00 00 || mHash || salt */ - var m_ = new forge.util.ByteBuffer(); - m_.fillWithByte(0, 8); - m_.putBytes(mHash); - m_.putBytes(salt); - - /* 13. Let H' = Hash(M'), an octet string of length hLen. */ - hash.start(); - hash.update(m_.getBytes()); - var h_ = hash.digest().getBytes(); - - /* 14. If H = H', output "consistent." Otherwise, output "inconsistent." */ - return h === h_; - }; - - return pssobj; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/random.js b/reverse_engineering/node_modules/node-forge/lib/random.js deleted file mode 100644 index d4e4bea9..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/random.js +++ /dev/null @@ -1,191 +0,0 @@ -/** - * An API for getting cryptographically-secure random bytes. The bytes are - * generated using the Fortuna algorithm devised by Bruce Schneier and - * Niels Ferguson. - * - * Getting strong random bytes is not yet easy to do in javascript. The only - * truish random entropy that can be collected is from the mouse, keyboard, or - * from timing with respect to page loads, etc. This generator makes a poor - * attempt at providing random bytes when those sources haven't yet provided - * enough entropy to initially seed or to reseed the PRNG. - * - * @author Dave Longley - * - * Copyright (c) 2009-2014 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./aes'); -require('./sha256'); -require('./prng'); -require('./util'); - -(function() { - -// forge.random already defined -if(forge.random && forge.random.getBytes) { - module.exports = forge.random; - return; -} - -(function(jQuery) { - -// the default prng plugin, uses AES-128 -var prng_aes = {}; -var _prng_aes_output = new Array(4); -var _prng_aes_buffer = forge.util.createBuffer(); -prng_aes.formatKey = function(key) { - // convert the key into 32-bit integers - var tmp = forge.util.createBuffer(key); - key = new Array(4); - key[0] = tmp.getInt32(); - key[1] = tmp.getInt32(); - key[2] = tmp.getInt32(); - key[3] = tmp.getInt32(); - - // return the expanded key - return forge.aes._expandKey(key, false); -}; -prng_aes.formatSeed = function(seed) { - // convert seed into 32-bit integers - var tmp = forge.util.createBuffer(seed); - seed = new Array(4); - seed[0] = tmp.getInt32(); - seed[1] = tmp.getInt32(); - seed[2] = tmp.getInt32(); - seed[3] = tmp.getInt32(); - return seed; -}; -prng_aes.cipher = function(key, seed) { - forge.aes._updateBlock(key, seed, _prng_aes_output, false); - _prng_aes_buffer.putInt32(_prng_aes_output[0]); - _prng_aes_buffer.putInt32(_prng_aes_output[1]); - _prng_aes_buffer.putInt32(_prng_aes_output[2]); - _prng_aes_buffer.putInt32(_prng_aes_output[3]); - return _prng_aes_buffer.getBytes(); -}; -prng_aes.increment = function(seed) { - // FIXME: do we care about carry or signed issues? - ++seed[3]; - return seed; -}; -prng_aes.md = forge.md.sha256; - -/** - * Creates a new PRNG. - */ -function spawnPrng() { - var ctx = forge.prng.create(prng_aes); - - /** - * Gets random bytes. If a native secure crypto API is unavailable, this - * method tries to make the bytes more unpredictable by drawing from data that - * can be collected from the user of the browser, eg: mouse movement. - * - * If a callback is given, this method will be called asynchronously. - * - * @param count the number of random bytes to get. - * @param [callback(err, bytes)] called once the operation completes. - * - * @return the random bytes in a string. - */ - ctx.getBytes = function(count, callback) { - return ctx.generate(count, callback); - }; - - /** - * Gets random bytes asynchronously. If a native secure crypto API is - * unavailable, this method tries to make the bytes more unpredictable by - * drawing from data that can be collected from the user of the browser, - * eg: mouse movement. - * - * @param count the number of random bytes to get. - * - * @return the random bytes in a string. - */ - ctx.getBytesSync = function(count) { - return ctx.generate(count); - }; - - return ctx; -} - -// create default prng context -var _ctx = spawnPrng(); - -// add other sources of entropy only if window.crypto.getRandomValues is not -// available -- otherwise this source will be automatically used by the prng -var getRandomValues = null; -var globalScope = forge.util.globalScope; -var _crypto = globalScope.crypto || globalScope.msCrypto; -if(_crypto && _crypto.getRandomValues) { - getRandomValues = function(arr) { - return _crypto.getRandomValues(arr); - }; -} - -if(forge.options.usePureJavaScript || - (!forge.util.isNodejs && !getRandomValues)) { - // if this is a web worker, do not use weak entropy, instead register to - // receive strong entropy asynchronously from the main thread - if(typeof window === 'undefined' || window.document === undefined) { - // FIXME: - } - - // get load time entropy - _ctx.collectInt(+new Date(), 32); - - // add some entropy from navigator object - if(typeof(navigator) !== 'undefined') { - var _navBytes = ''; - for(var key in navigator) { - try { - if(typeof(navigator[key]) == 'string') { - _navBytes += navigator[key]; - } - } catch(e) { - /* Some navigator keys might not be accessible, e.g. the geolocation - attribute throws an exception if touched in Mozilla chrome:// - context. - - Silently ignore this and just don't use this as a source of - entropy. */ - } - } - _ctx.collect(_navBytes); - _navBytes = null; - } - - // add mouse and keyboard collectors if jquery is available - if(jQuery) { - // set up mouse entropy capture - jQuery().mousemove(function(e) { - // add mouse coords - _ctx.collectInt(e.clientX, 16); - _ctx.collectInt(e.clientY, 16); - }); - - // set up keyboard entropy capture - jQuery().keypress(function(e) { - _ctx.collectInt(e.charCode, 8); - }); - } -} - -/* Random API */ -if(!forge.random) { - forge.random = _ctx; -} else { - // extend forge.random with _ctx - for(var key in _ctx) { - forge.random[key] = _ctx[key]; - } -} - -// expose spawn PRNG -forge.random.createInstance = spawnPrng; - -module.exports = forge.random; - -})(typeof(jQuery) !== 'undefined' ? jQuery : null); - -})(); diff --git a/reverse_engineering/node_modules/node-forge/lib/rc2.js b/reverse_engineering/node_modules/node-forge/lib/rc2.js deleted file mode 100644 index e33f78a7..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/rc2.js +++ /dev/null @@ -1,410 +0,0 @@ -/** - * RC2 implementation. - * - * @author Stefan Siegl - * - * Copyright (c) 2012 Stefan Siegl - * - * Information on the RC2 cipher is available from RFC #2268, - * http://www.ietf.org/rfc/rfc2268.txt - */ -var forge = require('./forge'); -require('./util'); - -var piTable = [ - 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, - 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, 0x62, 0x4c, 0x64, 0x88, 0x44, 0x8b, 0xfb, 0xa2, - 0x17, 0x9a, 0x59, 0xf5, 0x87, 0xb3, 0x4f, 0x13, 0x61, 0x45, 0x6d, 0x8d, 0x09, 0x81, 0x7d, 0x32, - 0xbd, 0x8f, 0x40, 0xeb, 0x86, 0xb7, 0x7b, 0x0b, 0xf0, 0x95, 0x21, 0x22, 0x5c, 0x6b, 0x4e, 0x82, - 0x54, 0xd6, 0x65, 0x93, 0xce, 0x60, 0xb2, 0x1c, 0x73, 0x56, 0xc0, 0x14, 0xa7, 0x8c, 0xf1, 0xdc, - 0x12, 0x75, 0xca, 0x1f, 0x3b, 0xbe, 0xe4, 0xd1, 0x42, 0x3d, 0xd4, 0x30, 0xa3, 0x3c, 0xb6, 0x26, - 0x6f, 0xbf, 0x0e, 0xda, 0x46, 0x69, 0x07, 0x57, 0x27, 0xf2, 0x1d, 0x9b, 0xbc, 0x94, 0x43, 0x03, - 0xf8, 0x11, 0xc7, 0xf6, 0x90, 0xef, 0x3e, 0xe7, 0x06, 0xc3, 0xd5, 0x2f, 0xc8, 0x66, 0x1e, 0xd7, - 0x08, 0xe8, 0xea, 0xde, 0x80, 0x52, 0xee, 0xf7, 0x84, 0xaa, 0x72, 0xac, 0x35, 0x4d, 0x6a, 0x2a, - 0x96, 0x1a, 0xd2, 0x71, 0x5a, 0x15, 0x49, 0x74, 0x4b, 0x9f, 0xd0, 0x5e, 0x04, 0x18, 0xa4, 0xec, - 0xc2, 0xe0, 0x41, 0x6e, 0x0f, 0x51, 0xcb, 0xcc, 0x24, 0x91, 0xaf, 0x50, 0xa1, 0xf4, 0x70, 0x39, - 0x99, 0x7c, 0x3a, 0x85, 0x23, 0xb8, 0xb4, 0x7a, 0xfc, 0x02, 0x36, 0x5b, 0x25, 0x55, 0x97, 0x31, - 0x2d, 0x5d, 0xfa, 0x98, 0xe3, 0x8a, 0x92, 0xae, 0x05, 0xdf, 0x29, 0x10, 0x67, 0x6c, 0xba, 0xc9, - 0xd3, 0x00, 0xe6, 0xcf, 0xe1, 0x9e, 0xa8, 0x2c, 0x63, 0x16, 0x01, 0x3f, 0x58, 0xe2, 0x89, 0xa9, - 0x0d, 0x38, 0x34, 0x1b, 0xab, 0x33, 0xff, 0xb0, 0xbb, 0x48, 0x0c, 0x5f, 0xb9, 0xb1, 0xcd, 0x2e, - 0xc5, 0xf3, 0xdb, 0x47, 0xe5, 0xa5, 0x9c, 0x77, 0x0a, 0xa6, 0x20, 0x68, 0xfe, 0x7f, 0xc1, 0xad -]; - -var s = [1, 2, 3, 5]; - -/** - * Rotate a word left by given number of bits. - * - * Bits that are shifted out on the left are put back in on the right - * hand side. - * - * @param word The word to shift left. - * @param bits The number of bits to shift by. - * @return The rotated word. - */ -var rol = function(word, bits) { - return ((word << bits) & 0xffff) | ((word & 0xffff) >> (16 - bits)); -}; - -/** - * Rotate a word right by given number of bits. - * - * Bits that are shifted out on the right are put back in on the left - * hand side. - * - * @param word The word to shift right. - * @param bits The number of bits to shift by. - * @return The rotated word. - */ -var ror = function(word, bits) { - return ((word & 0xffff) >> bits) | ((word << (16 - bits)) & 0xffff); -}; - -/* RC2 API */ -module.exports = forge.rc2 = forge.rc2 || {}; - -/** - * Perform RC2 key expansion as per RFC #2268, section 2. - * - * @param key variable-length user key (between 1 and 128 bytes) - * @param effKeyBits number of effective key bits (default: 128) - * @return the expanded RC2 key (ByteBuffer of 128 bytes) - */ -forge.rc2.expandKey = function(key, effKeyBits) { - if(typeof key === 'string') { - key = forge.util.createBuffer(key); - } - effKeyBits = effKeyBits || 128; - - /* introduce variables that match the names used in RFC #2268 */ - var L = key; - var T = key.length(); - var T1 = effKeyBits; - var T8 = Math.ceil(T1 / 8); - var TM = 0xff >> (T1 & 0x07); - var i; - - for(i = T; i < 128; i++) { - L.putByte(piTable[(L.at(i - 1) + L.at(i - T)) & 0xff]); - } - - L.setAt(128 - T8, piTable[L.at(128 - T8) & TM]); - - for(i = 127 - T8; i >= 0; i--) { - L.setAt(i, piTable[L.at(i + 1) ^ L.at(i + T8)]); - } - - return L; -}; - -/** - * Creates a RC2 cipher object. - * - * @param key the symmetric key to use (as base for key generation). - * @param bits the number of effective key bits. - * @param encrypt false for decryption, true for encryption. - * - * @return the cipher. - */ -var createCipher = function(key, bits, encrypt) { - var _finish = false, _input = null, _output = null, _iv = null; - var mixRound, mashRound; - var i, j, K = []; - - /* Expand key and fill into K[] Array */ - key = forge.rc2.expandKey(key, bits); - for(i = 0; i < 64; i++) { - K.push(key.getInt16Le()); - } - - if(encrypt) { - /** - * Perform one mixing round "in place". - * - * @param R Array of four words to perform mixing on. - */ - mixRound = function(R) { - for(i = 0; i < 4; i++) { - R[i] += K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + - ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); - R[i] = rol(R[i], s[i]); - j++; - } - }; - - /** - * Perform one mashing round "in place". - * - * @param R Array of four words to perform mashing on. - */ - mashRound = function(R) { - for(i = 0; i < 4; i++) { - R[i] += K[R[(i + 3) % 4] & 63]; - } - }; - } else { - /** - * Perform one r-mixing round "in place". - * - * @param R Array of four words to perform mixing on. - */ - mixRound = function(R) { - for(i = 3; i >= 0; i--) { - R[i] = ror(R[i], s[i]); - R[i] -= K[j] + (R[(i + 3) % 4] & R[(i + 2) % 4]) + - ((~R[(i + 3) % 4]) & R[(i + 1) % 4]); - j--; - } - }; - - /** - * Perform one r-mashing round "in place". - * - * @param R Array of four words to perform mashing on. - */ - mashRound = function(R) { - for(i = 3; i >= 0; i--) { - R[i] -= K[R[(i + 3) % 4] & 63]; - } - }; - } - - /** - * Run the specified cipher execution plan. - * - * This function takes four words from the input buffer, applies the IV on - * it (if requested) and runs the provided execution plan. - * - * The plan must be put together in form of a array of arrays. Where the - * outer one is simply a list of steps to perform and the inner one needs - * to have two elements: the first one telling how many rounds to perform, - * the second one telling what to do (i.e. the function to call). - * - * @param {Array} plan The plan to execute. - */ - var runPlan = function(plan) { - var R = []; - - /* Get data from input buffer and fill the four words into R */ - for(i = 0; i < 4; i++) { - var val = _input.getInt16Le(); - - if(_iv !== null) { - if(encrypt) { - /* We're encrypting, apply the IV first. */ - val ^= _iv.getInt16Le(); - } else { - /* We're decryption, keep cipher text for next block. */ - _iv.putInt16Le(val); - } - } - - R.push(val & 0xffff); - } - - /* Reset global "j" variable as per spec. */ - j = encrypt ? 0 : 63; - - /* Run execution plan. */ - for(var ptr = 0; ptr < plan.length; ptr++) { - for(var ctr = 0; ctr < plan[ptr][0]; ctr++) { - plan[ptr][1](R); - } - } - - /* Write back result to output buffer. */ - for(i = 0; i < 4; i++) { - if(_iv !== null) { - if(encrypt) { - /* We're encrypting in CBC-mode, feed back encrypted bytes into - IV buffer to carry it forward to next block. */ - _iv.putInt16Le(R[i]); - } else { - R[i] ^= _iv.getInt16Le(); - } - } - - _output.putInt16Le(R[i]); - } - }; - - /* Create cipher object */ - var cipher = null; - cipher = { - /** - * Starts or restarts the encryption or decryption process, whichever - * was previously configured. - * - * To use the cipher in CBC mode, iv may be given either as a string - * of bytes, or as a byte buffer. For ECB mode, give null as iv. - * - * @param iv the initialization vector to use, null for ECB mode. - * @param output the output the buffer to write to, null to create one. - */ - start: function(iv, output) { - if(iv) { - /* CBC mode */ - if(typeof iv === 'string') { - iv = forge.util.createBuffer(iv); - } - } - - _finish = false; - _input = forge.util.createBuffer(); - _output = output || new forge.util.createBuffer(); - _iv = iv; - - cipher.output = _output; - }, - - /** - * Updates the next block. - * - * @param input the buffer to read from. - */ - update: function(input) { - if(!_finish) { - // not finishing, so fill the input buffer with more input - _input.putBuffer(input); - } - - while(_input.length() >= 8) { - runPlan([ - [ 5, mixRound ], - [ 1, mashRound ], - [ 6, mixRound ], - [ 1, mashRound ], - [ 5, mixRound ] - ]); - } - }, - - /** - * Finishes encrypting or decrypting. - * - * @param pad a padding function to use, null for PKCS#7 padding, - * signature(blockSize, buffer, decrypt). - * - * @return true if successful, false on error. - */ - finish: function(pad) { - var rval = true; - - if(encrypt) { - if(pad) { - rval = pad(8, _input, !encrypt); - } else { - // add PKCS#7 padding to block (each pad byte is the - // value of the number of pad bytes) - var padding = (_input.length() === 8) ? 8 : (8 - _input.length()); - _input.fillWithByte(padding, padding); - } - } - - if(rval) { - // do final update - _finish = true; - cipher.update(); - } - - if(!encrypt) { - // check for error: input data not a multiple of block size - rval = (_input.length() === 0); - if(rval) { - if(pad) { - rval = pad(8, _output, !encrypt); - } else { - // ensure padding byte count is valid - var len = _output.length(); - var count = _output.at(len - 1); - - if(count > len) { - rval = false; - } else { - // trim off padding bytes - _output.truncate(count); - } - } - } - } - - return rval; - } - }; - - return cipher; -}; - -/** - * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the - * given symmetric key. The output will be stored in the 'output' member - * of the returned cipher. - * - * The key and iv may be given as a string of bytes or a byte buffer. - * The cipher is initialized to use 128 effective key bits. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * - * @return the cipher. - */ -forge.rc2.startEncrypting = function(key, iv, output) { - var cipher = forge.rc2.createEncryptionCipher(key, 128); - cipher.start(iv, output); - return cipher; -}; - -/** - * Creates an RC2 cipher object to encrypt data in ECB or CBC mode using the - * given symmetric key. - * - * The key may be given as a string of bytes or a byte buffer. - * - * To start encrypting call start() on the cipher with an iv and optional - * output buffer. - * - * @param key the symmetric key to use. - * - * @return the cipher. - */ -forge.rc2.createEncryptionCipher = function(key, bits) { - return createCipher(key, bits, true); -}; - -/** - * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the - * given symmetric key. The output will be stored in the 'output' member - * of the returned cipher. - * - * The key and iv may be given as a string of bytes or a byte buffer. - * The cipher is initialized to use 128 effective key bits. - * - * @param key the symmetric key to use. - * @param iv the initialization vector to use. - * @param output the buffer to write to, null to create one. - * - * @return the cipher. - */ -forge.rc2.startDecrypting = function(key, iv, output) { - var cipher = forge.rc2.createDecryptionCipher(key, 128); - cipher.start(iv, output); - return cipher; -}; - -/** - * Creates an RC2 cipher object to decrypt data in ECB or CBC mode using the - * given symmetric key. - * - * The key may be given as a string of bytes or a byte buffer. - * - * To start decrypting call start() on the cipher with an iv and optional - * output buffer. - * - * @param key the symmetric key to use. - * - * @return the cipher. - */ -forge.rc2.createDecryptionCipher = function(key, bits) { - return createCipher(key, bits, false); -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/rsa.js b/reverse_engineering/node_modules/node-forge/lib/rsa.js deleted file mode 100644 index 7c67917c..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/rsa.js +++ /dev/null @@ -1,1858 +0,0 @@ -/** - * Javascript implementation of basic RSA algorithms. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * - * The only algorithm currently supported for PKI is RSA. - * - * An RSA key is often stored in ASN.1 DER format. The SubjectPublicKeyInfo - * ASN.1 structure is composed of an algorithm of type AlgorithmIdentifier - * and a subjectPublicKey of type bit string. - * - * The AlgorithmIdentifier contains an Object Identifier (OID) and parameters - * for the algorithm, if any. In the case of RSA, there aren't any. - * - * SubjectPublicKeyInfo ::= SEQUENCE { - * algorithm AlgorithmIdentifier, - * subjectPublicKey BIT STRING - * } - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * For an RSA public key, the subjectPublicKey is: - * - * RSAPublicKey ::= SEQUENCE { - * modulus INTEGER, -- n - * publicExponent INTEGER -- e - * } - * - * PrivateKeyInfo ::= SEQUENCE { - * version Version, - * privateKeyAlgorithm PrivateKeyAlgorithmIdentifier, - * privateKey PrivateKey, - * attributes [0] IMPLICIT Attributes OPTIONAL - * } - * - * Version ::= INTEGER - * PrivateKeyAlgorithmIdentifier ::= AlgorithmIdentifier - * PrivateKey ::= OCTET STRING - * Attributes ::= SET OF Attribute - * - * An RSA private key as the following structure: - * - * RSAPrivateKey ::= SEQUENCE { - * version Version, - * modulus INTEGER, -- n - * publicExponent INTEGER, -- e - * privateExponent INTEGER, -- d - * prime1 INTEGER, -- p - * prime2 INTEGER, -- q - * exponent1 INTEGER, -- d mod (p-1) - * exponent2 INTEGER, -- d mod (q-1) - * coefficient INTEGER -- (inverse of q) mod p - * } - * - * Version ::= INTEGER - * - * The OID for the RSA key algorithm is: 1.2.840.113549.1.1.1 - */ -var forge = require('./forge'); -require('./asn1'); -require('./jsbn'); -require('./oids'); -require('./pkcs1'); -require('./prime'); -require('./random'); -require('./util'); - -if(typeof BigInteger === 'undefined') { - var BigInteger = forge.jsbn.BigInteger; -} - -var _crypto = forge.util.isNodejs ? require('crypto') : null; - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -// shortcut for util API -var util = forge.util; - -/* - * RSA encryption and decryption, see RFC 2313. - */ -forge.pki = forge.pki || {}; -module.exports = forge.pki.rsa = forge.rsa = forge.rsa || {}; -var pki = forge.pki; - -// for finding primes, which are 30k+i for i = 1, 7, 11, 13, 17, 19, 23, 29 -var GCD_30_DELTA = [6, 4, 2, 4, 2, 4, 6, 2]; - -// validator for a PrivateKeyInfo structure -var privateKeyValidator = { - // PrivateKeyInfo - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'PrivateKeyInfo.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // privateKeyAlgorithm - name: 'PrivateKeyInfo.privateKeyAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'privateKeyOid' - }] - }, { - // PrivateKey - name: 'PrivateKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OCTETSTRING, - constructed: false, - capture: 'privateKey' - }] -}; - -// validator for an RSA private key -var rsaPrivateKeyValidator = { - // RSAPrivateKey - name: 'RSAPrivateKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // Version (INTEGER) - name: 'RSAPrivateKey.version', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyVersion' - }, { - // modulus (n) - name: 'RSAPrivateKey.modulus', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyModulus' - }, { - // publicExponent (e) - name: 'RSAPrivateKey.publicExponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPublicExponent' - }, { - // privateExponent (d) - name: 'RSAPrivateKey.privateExponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrivateExponent' - }, { - // prime1 (p) - name: 'RSAPrivateKey.prime1', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrime1' - }, { - // prime2 (q) - name: 'RSAPrivateKey.prime2', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyPrime2' - }, { - // exponent1 (d mod (p-1)) - name: 'RSAPrivateKey.exponent1', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyExponent1' - }, { - // exponent2 (d mod (q-1)) - name: 'RSAPrivateKey.exponent2', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyExponent2' - }, { - // coefficient ((inverse of q) mod p) - name: 'RSAPrivateKey.coefficient', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'privateKeyCoefficient' - }] -}; - -// validator for an RSA public key -var rsaPublicKeyValidator = { - // RSAPublicKey - name: 'RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // modulus (n) - name: 'RSAPublicKey.modulus', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'publicKeyModulus' - }, { - // publicExponent (e) - name: 'RSAPublicKey.exponent', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'publicKeyExponent' - }] -}; - -// validator for an SubjectPublicKeyInfo structure -// Note: Currently only works with an RSA public key -var publicKeyValidator = forge.pki.rsa.publicKeyValidator = { - name: 'SubjectPublicKeyInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'subjectPublicKeyInfo', - value: [{ - name: 'SubjectPublicKeyInfo.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'publicKeyOid' - }] - }, { - // subjectPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - value: [{ - // RSAPublicKey - name: 'SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - optional: true, - captureAsn1: 'rsaPublicKey' - }] - }] -}; - -/** - * Wrap digest in DigestInfo object. - * - * This function implements EMSA-PKCS1-v1_5-ENCODE as per RFC 3447. - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * Digest ::= OCTET STRING - * - * @param md the message digest object with the hash to sign. - * - * @return the encoded message (ready for RSA encrytion) - */ -var emsaPkcs1v15encode = function(md) { - // get the oid for the algorithm - var oid; - if(md.algorithm in pki.oids) { - oid = pki.oids[md.algorithm]; - } else { - var error = new Error('Unknown message digest algorithm.'); - error.algorithm = md.algorithm; - throw error; - } - var oidBytes = asn1.oidToDer(oid).getBytes(); - - // create the digest info - var digestInfo = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var digestAlgorithm = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - digestAlgorithm.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, oidBytes)); - digestAlgorithm.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '')); - var digest = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, - false, md.digest().getBytes()); - digestInfo.value.push(digestAlgorithm); - digestInfo.value.push(digest); - - // encode digest info - return asn1.toDer(digestInfo).getBytes(); -}; - -/** - * Performs x^c mod n (RSA encryption or decryption operation). - * - * @param x the number to raise and mod. - * @param key the key to use. - * @param pub true if the key is public, false if private. - * - * @return the result of x^c mod n. - */ -var _modPow = function(x, key, pub) { - if(pub) { - return x.modPow(key.e, key.n); - } - - if(!key.p || !key.q) { - // allow calculation without CRT params (slow) - return x.modPow(key.d, key.n); - } - - // pre-compute dP, dQ, and qInv if necessary - if(!key.dP) { - key.dP = key.d.mod(key.p.subtract(BigInteger.ONE)); - } - if(!key.dQ) { - key.dQ = key.d.mod(key.q.subtract(BigInteger.ONE)); - } - if(!key.qInv) { - key.qInv = key.q.modInverse(key.p); - } - - /* Chinese remainder theorem (CRT) states: - - Suppose n1, n2, ..., nk are positive integers which are pairwise - coprime (n1 and n2 have no common factors other than 1). For any - integers x1, x2, ..., xk there exists an integer x solving the - system of simultaneous congruences (where ~= means modularly - congruent so a ~= b mod n means a mod n = b mod n): - - x ~= x1 mod n1 - x ~= x2 mod n2 - ... - x ~= xk mod nk - - This system of congruences has a single simultaneous solution x - between 0 and n - 1. Furthermore, each xk solution and x itself - is congruent modulo the product n = n1*n2*...*nk. - So x1 mod n = x2 mod n = xk mod n = x mod n. - - The single simultaneous solution x can be solved with the following - equation: - - x = sum(xi*ri*si) mod n where ri = n/ni and si = ri^-1 mod ni. - - Where x is less than n, xi = x mod ni. - - For RSA we are only concerned with k = 2. The modulus n = pq, where - p and q are coprime. The RSA decryption algorithm is: - - y = x^d mod n - - Given the above: - - x1 = x^d mod p - r1 = n/p = q - s1 = q^-1 mod p - x2 = x^d mod q - r2 = n/q = p - s2 = p^-1 mod q - - So y = (x1r1s1 + x2r2s2) mod n - = ((x^d mod p)q(q^-1 mod p) + (x^d mod q)p(p^-1 mod q)) mod n - - According to Fermat's Little Theorem, if the modulus P is prime, - for any integer A not evenly divisible by P, A^(P-1) ~= 1 mod P. - Since A is not divisible by P it follows that if: - N ~= M mod (P - 1), then A^N mod P = A^M mod P. Therefore: - - A^N mod P = A^(M mod (P - 1)) mod P. (The latter takes less effort - to calculate). In order to calculate x^d mod p more quickly the - exponent d mod (p - 1) is stored in the RSA private key (the same - is done for x^d mod q). These values are referred to as dP and dQ - respectively. Therefore we now have: - - y = ((x^dP mod p)q(q^-1 mod p) + (x^dQ mod q)p(p^-1 mod q)) mod n - - Since we'll be reducing x^dP by modulo p (same for q) we can also - reduce x by p (and q respectively) before hand. Therefore, let - - xp = ((x mod p)^dP mod p), and - xq = ((x mod q)^dQ mod q), yielding: - - y = (xp*q*(q^-1 mod p) + xq*p*(p^-1 mod q)) mod n - - This can be further reduced to a simple algorithm that only - requires 1 inverse (the q inverse is used) to be used and stored. - The algorithm is called Garner's algorithm. If qInv is the - inverse of q, we simply calculate: - - y = (qInv*(xp - xq) mod p) * q + xq - - However, there are two further complications. First, we need to - ensure that xp > xq to prevent signed BigIntegers from being used - so we add p until this is true (since we will be mod'ing with - p anyway). Then, there is a known timing attack on algorithms - using the CRT. To mitigate this risk, "cryptographic blinding" - should be used. This requires simply generating a random number r - between 0 and n-1 and its inverse and multiplying x by r^e before - calculating y and then multiplying y by r^-1 afterwards. Note that - r must be coprime with n (gcd(r, n) === 1) in order to have an - inverse. - */ - - // cryptographic blinding - var r; - do { - r = new BigInteger( - forge.util.bytesToHex(forge.random.getBytes(key.n.bitLength() / 8)), - 16); - } while(r.compareTo(key.n) >= 0 || !r.gcd(key.n).equals(BigInteger.ONE)); - x = x.multiply(r.modPow(key.e, key.n)).mod(key.n); - - // calculate xp and xq - var xp = x.mod(key.p).modPow(key.dP, key.p); - var xq = x.mod(key.q).modPow(key.dQ, key.q); - - // xp must be larger than xq to avoid signed bit usage - while(xp.compareTo(xq) < 0) { - xp = xp.add(key.p); - } - - // do last step - var y = xp.subtract(xq) - .multiply(key.qInv).mod(key.p) - .multiply(key.q).add(xq); - - // remove effect of random for cryptographic blinding - y = y.multiply(r.modInverse(key.n)).mod(key.n); - - return y; -}; - -/** - * NOTE: THIS METHOD IS DEPRECATED, use 'sign' on a private key object or - * 'encrypt' on a public key object instead. - * - * Performs RSA encryption. - * - * The parameter bt controls whether to put padding bytes before the - * message passed in. Set bt to either true or false to disable padding - * completely (in order to handle e.g. EMSA-PSS encoding seperately before), - * signaling whether the encryption operation is a public key operation - * (i.e. encrypting data) or not, i.e. private key operation (data signing). - * - * For PKCS#1 v1.5 padding pass in the block type to use, i.e. either 0x01 - * (for signing) or 0x02 (for encryption). The key operation mode (private - * or public) is derived from this flag in that case). - * - * @param m the message to encrypt as a byte string. - * @param key the RSA key to use. - * @param bt for PKCS#1 v1.5 padding, the block type to use - * (0x01 for private key, 0x02 for public), - * to disable padding: true = public key, false = private key. - * - * @return the encrypted bytes as a string. - */ -pki.rsa.encrypt = function(m, key, bt) { - var pub = bt; - var eb; - - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - if(bt !== false && bt !== true) { - // legacy, default to PKCS#1 v1.5 padding - pub = (bt === 0x02); - eb = _encodePkcs1_v1_5(m, key, bt); - } else { - eb = forge.util.createBuffer(); - eb.putBytes(m); - } - - // load encryption block as big integer 'x' - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var x = new BigInteger(eb.toHex(), 16); - - // do RSA encryption - var y = _modPow(x, key, pub); - - // convert y into the encrypted data byte string, if y is shorter in - // bytes than k, then prepend zero bytes to fill up ed - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var yhex = y.toString(16); - var ed = forge.util.createBuffer(); - var zeros = k - Math.ceil(yhex.length / 2); - while(zeros > 0) { - ed.putByte(0x00); - --zeros; - } - ed.putBytes(forge.util.hexToBytes(yhex)); - return ed.getBytes(); -}; - -/** - * NOTE: THIS METHOD IS DEPRECATED, use 'decrypt' on a private key object or - * 'verify' on a public key object instead. - * - * Performs RSA decryption. - * - * The parameter ml controls whether to apply PKCS#1 v1.5 padding - * or not. Set ml = false to disable padding removal completely - * (in order to handle e.g. EMSA-PSS later on) and simply pass back - * the RSA encryption block. - * - * @param ed the encrypted data to decrypt in as a byte string. - * @param key the RSA key to use. - * @param pub true for a public key operation, false for private. - * @param ml the message length, if known, false to disable padding. - * - * @return the decrypted message as a byte string. - */ -pki.rsa.decrypt = function(ed, key, pub, ml) { - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - // error if the length of the encrypted data ED is not k - if(ed.length !== k) { - var error = new Error('Encrypted message length is invalid.'); - error.length = ed.length; - error.expected = k; - throw error; - } - - // convert encrypted data into a big integer - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var y = new BigInteger(forge.util.createBuffer(ed).toHex(), 16); - - // y must be less than the modulus or it wasn't the result of - // a previous mod operation (encryption) using that modulus - if(y.compareTo(key.n) >= 0) { - throw new Error('Encrypted message is invalid.'); - } - - // do RSA decryption - var x = _modPow(y, key, pub); - - // create the encryption block, if x is shorter in bytes than k, then - // prepend zero bytes to fill up eb - // FIXME: hex conversion inefficient, get BigInteger w/byte strings - var xhex = x.toString(16); - var eb = forge.util.createBuffer(); - var zeros = k - Math.ceil(xhex.length / 2); - while(zeros > 0) { - eb.putByte(0x00); - --zeros; - } - eb.putBytes(forge.util.hexToBytes(xhex)); - - if(ml !== false) { - // legacy, default to PKCS#1 v1.5 padding - return _decodePkcs1_v1_5(eb.getBytes(), key, pub); - } - - // return message - return eb.getBytes(); -}; - -/** - * Creates an RSA key-pair generation state object. It is used to allow - * key-generation to be performed in steps. It also allows for a UI to - * display progress updates. - * - * @param bits the size for the private key in bits, defaults to 2048. - * @param e the public exponent to use, defaults to 65537 (0x10001). - * @param [options] the options to use. - * prng a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". - * algorithm the algorithm to use (default: 'PRIMEINC'). - * - * @return the state object to use to generate the key-pair. - */ -pki.rsa.createKeyPairGenerationState = function(bits, e, options) { - // TODO: migrate step-based prime generation code to forge.prime - - // set default bits - if(typeof(bits) === 'string') { - bits = parseInt(bits, 10); - } - bits = bits || 2048; - - // create prng with api that matches BigInteger secure random - options = options || {}; - var prng = options.prng || forge.random; - var rng = { - // x is an array to fill with bytes - nextBytes: function(x) { - var b = prng.getBytesSync(x.length); - for(var i = 0; i < x.length; ++i) { - x[i] = b.charCodeAt(i); - } - } - }; - - var algorithm = options.algorithm || 'PRIMEINC'; - - // create PRIMEINC algorithm state - var rval; - if(algorithm === 'PRIMEINC') { - rval = { - algorithm: algorithm, - state: 0, - bits: bits, - rng: rng, - eInt: e || 65537, - e: new BigInteger(null), - p: null, - q: null, - qBits: bits >> 1, - pBits: bits - (bits >> 1), - pqState: 0, - num: null, - keys: null - }; - rval.e.fromInt(rval.eInt); - } else { - throw new Error('Invalid key generation algorithm: ' + algorithm); - } - - return rval; -}; - -/** - * Attempts to runs the key-generation algorithm for at most n seconds - * (approximately) using the given state. When key-generation has completed, - * the keys will be stored in state.keys. - * - * To use this function to update a UI while generating a key or to prevent - * causing browser lockups/warnings, set "n" to a value other than 0. A - * simple pattern for generating a key and showing a progress indicator is: - * - * var state = pki.rsa.createKeyPairGenerationState(2048); - * var step = function() { - * // step key-generation, run algorithm for 100 ms, repeat - * if(!forge.pki.rsa.stepKeyPairGenerationState(state, 100)) { - * setTimeout(step, 1); - * } else { - * // key-generation complete - * // TODO: turn off progress indicator here - * // TODO: use the generated key-pair in "state.keys" - * } - * }; - * // TODO: turn on progress indicator here - * setTimeout(step, 0); - * - * @param state the state to use. - * @param n the maximum number of milliseconds to run the algorithm for, 0 - * to run the algorithm to completion. - * - * @return true if the key-generation completed, false if not. - */ -pki.rsa.stepKeyPairGenerationState = function(state, n) { - // set default algorithm if not set - if(!('algorithm' in state)) { - state.algorithm = 'PRIMEINC'; - } - - // TODO: migrate step-based prime generation code to forge.prime - // TODO: abstract as PRIMEINC algorithm - - // do key generation (based on Tom Wu's rsa.js, see jsbn.js license) - // with some minor optimizations and designed to run in steps - - // local state vars - var THIRTY = new BigInteger(null); - THIRTY.fromInt(30); - var deltaIdx = 0; - var op_or = function(x, y) {return x | y;}; - - // keep stepping until time limit is reached or done - var t1 = +new Date(); - var t2; - var total = 0; - while(state.keys === null && (n <= 0 || total < n)) { - // generate p or q - if(state.state === 0) { - /* Note: All primes are of the form: - - 30k+i, for i < 30 and gcd(30, i)=1, where there are 8 values for i - - When we generate a random number, we always align it at 30k + 1. Each - time the number is determined not to be prime we add to get to the - next 'i', eg: if the number was at 30k + 1 we add 6. */ - var bits = (state.p === null) ? state.pBits : state.qBits; - var bits1 = bits - 1; - - // get a random number - if(state.pqState === 0) { - state.num = new BigInteger(bits, state.rng); - // force MSB set - if(!state.num.testBit(bits1)) { - state.num.bitwiseTo( - BigInteger.ONE.shiftLeft(bits1), op_or, state.num); - } - // align number on 30k+1 boundary - state.num.dAddOffset(31 - state.num.mod(THIRTY).byteValue(), 0); - deltaIdx = 0; - - ++state.pqState; - } else if(state.pqState === 1) { - // try to make the number a prime - if(state.num.bitLength() > bits) { - // overflow, try again - state.pqState = 0; - // do primality test - } else if(state.num.isProbablePrime( - _getMillerRabinTests(state.num.bitLength()))) { - ++state.pqState; - } else { - // get next potential prime - state.num.dAddOffset(GCD_30_DELTA[deltaIdx++ % 8], 0); - } - } else if(state.pqState === 2) { - // ensure number is coprime with e - state.pqState = - (state.num.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) === 0) ? 3 : 0; - } else if(state.pqState === 3) { - // store p or q - state.pqState = 0; - if(state.p === null) { - state.p = state.num; - } else { - state.q = state.num; - } - - // advance state if both p and q are ready - if(state.p !== null && state.q !== null) { - ++state.state; - } - state.num = null; - } - } else if(state.state === 1) { - // ensure p is larger than q (swap them if not) - if(state.p.compareTo(state.q) < 0) { - state.num = state.p; - state.p = state.q; - state.q = state.num; - } - ++state.state; - } else if(state.state === 2) { - // compute phi: (p - 1)(q - 1) (Euler's totient function) - state.p1 = state.p.subtract(BigInteger.ONE); - state.q1 = state.q.subtract(BigInteger.ONE); - state.phi = state.p1.multiply(state.q1); - ++state.state; - } else if(state.state === 3) { - // ensure e and phi are coprime - if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) === 0) { - // phi and e are coprime, advance - ++state.state; - } else { - // phi and e aren't coprime, so generate a new p and q - state.p = null; - state.q = null; - state.state = 0; - } - } else if(state.state === 4) { - // create n, ensure n is has the right number of bits - state.n = state.p.multiply(state.q); - - // ensure n is right number of bits - if(state.n.bitLength() === state.bits) { - // success, advance - ++state.state; - } else { - // failed, get new q - state.q = null; - state.state = 0; - } - } else if(state.state === 5) { - // set keys - var d = state.e.modInverse(state.phi); - state.keys = { - privateKey: pki.rsa.setPrivateKey( - state.n, state.e, d, state.p, state.q, - d.mod(state.p1), d.mod(state.q1), - state.q.modInverse(state.p)), - publicKey: pki.rsa.setPublicKey(state.n, state.e) - }; - } - - // update timing - t2 = +new Date(); - total += t2 - t1; - t1 = t2; - } - - return state.keys !== null; -}; - -/** - * Generates an RSA public-private key pair in a single call. - * - * To generate a key-pair in steps (to allow for progress updates and to - * prevent blocking or warnings in slow browsers) then use the key-pair - * generation state functions. - * - * To generate a key-pair asynchronously (either through web-workers, if - * available, or by breaking up the work on the main thread), pass a - * callback function. - * - * @param [bits] the size for the private key in bits, defaults to 2048. - * @param [e] the public exponent to use, defaults to 65537. - * @param [options] options for key-pair generation, if given then 'bits' - * and 'e' must *not* be given: - * bits the size for the private key in bits, (default: 2048). - * e the public exponent to use, (default: 65537 (0x10001)). - * workerScript the worker script URL. - * workers the number of web workers (if supported) to use, - * (default: 2). - * workLoad the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * prng a custom crypto-secure pseudo-random number generator to use, - * that must define "getBytesSync". Disables use of native APIs. - * algorithm the algorithm to use (default: 'PRIMEINC'). - * @param [callback(err, keypair)] called once the operation completes. - * - * @return an object with privateKey and publicKey properties. - */ -pki.rsa.generateKeyPair = function(bits, e, options, callback) { - // (bits), (options), (callback) - if(arguments.length === 1) { - if(typeof bits === 'object') { - options = bits; - bits = undefined; - } else if(typeof bits === 'function') { - callback = bits; - bits = undefined; - } - } else if(arguments.length === 2) { - // (bits, e), (bits, options), (bits, callback), (options, callback) - if(typeof bits === 'number') { - if(typeof e === 'function') { - callback = e; - e = undefined; - } else if(typeof e !== 'number') { - options = e; - e = undefined; - } - } else { - options = bits; - callback = e; - bits = undefined; - e = undefined; - } - } else if(arguments.length === 3) { - // (bits, e, options), (bits, e, callback), (bits, options, callback) - if(typeof e === 'number') { - if(typeof options === 'function') { - callback = options; - options = undefined; - } - } else { - callback = options; - options = e; - e = undefined; - } - } - options = options || {}; - if(bits === undefined) { - bits = options.bits || 2048; - } - if(e === undefined) { - e = options.e || 0x10001; - } - - // use native code if permitted, available, and parameters are acceptable - if(!forge.options.usePureJavaScript && !options.prng && - bits >= 256 && bits <= 16384 && (e === 0x10001 || e === 3)) { - if(callback) { - // try native async - if(_detectNodeCrypto('generateKeyPair')) { - return _crypto.generateKeyPair('rsa', { - modulusLength: bits, - publicExponent: e, - publicKeyEncoding: { - type: 'spki', - format: 'pem' - }, - privateKeyEncoding: { - type: 'pkcs8', - format: 'pem' - } - }, function(err, pub, priv) { - if(err) { - return callback(err); - } - callback(null, { - privateKey: pki.privateKeyFromPem(priv), - publicKey: pki.publicKeyFromPem(pub) - }); - }); - } - if(_detectSubtleCrypto('generateKey') && - _detectSubtleCrypto('exportKey')) { - // use standard native generateKey - return util.globalScope.crypto.subtle.generateKey({ - name: 'RSASSA-PKCS1-v1_5', - modulusLength: bits, - publicExponent: _intToUint8Array(e), - hash: {name: 'SHA-256'} - }, true /* key can be exported*/, ['sign', 'verify']) - .then(function(pair) { - return util.globalScope.crypto.subtle.exportKey( - 'pkcs8', pair.privateKey); - // avoiding catch(function(err) {...}) to support IE <= 8 - }).then(undefined, function(err) { - callback(err); - }).then(function(pkcs8) { - if(pkcs8) { - var privateKey = pki.privateKeyFromAsn1( - asn1.fromDer(forge.util.createBuffer(pkcs8))); - callback(null, { - privateKey: privateKey, - publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) - }); - } - }); - } - if(_detectSubtleMsCrypto('generateKey') && - _detectSubtleMsCrypto('exportKey')) { - var genOp = util.globalScope.msCrypto.subtle.generateKey({ - name: 'RSASSA-PKCS1-v1_5', - modulusLength: bits, - publicExponent: _intToUint8Array(e), - hash: {name: 'SHA-256'} - }, true /* key can be exported*/, ['sign', 'verify']); - genOp.oncomplete = function(e) { - var pair = e.target.result; - var exportOp = util.globalScope.msCrypto.subtle.exportKey( - 'pkcs8', pair.privateKey); - exportOp.oncomplete = function(e) { - var pkcs8 = e.target.result; - var privateKey = pki.privateKeyFromAsn1( - asn1.fromDer(forge.util.createBuffer(pkcs8))); - callback(null, { - privateKey: privateKey, - publicKey: pki.setRsaPublicKey(privateKey.n, privateKey.e) - }); - }; - exportOp.onerror = function(err) { - callback(err); - }; - }; - genOp.onerror = function(err) { - callback(err); - }; - return; - } - } else { - // try native sync - if(_detectNodeCrypto('generateKeyPairSync')) { - var keypair = _crypto.generateKeyPairSync('rsa', { - modulusLength: bits, - publicExponent: e, - publicKeyEncoding: { - type: 'spki', - format: 'pem' - }, - privateKeyEncoding: { - type: 'pkcs8', - format: 'pem' - } - }); - return { - privateKey: pki.privateKeyFromPem(keypair.privateKey), - publicKey: pki.publicKeyFromPem(keypair.publicKey) - }; - } - } - } - - // use JavaScript implementation - var state = pki.rsa.createKeyPairGenerationState(bits, e, options); - if(!callback) { - pki.rsa.stepKeyPairGenerationState(state, 0); - return state.keys; - } - _generateKeyPair(state, options, callback); -}; - -/** - * Sets an RSA public key from BigIntegers modulus and exponent. - * - * @param n the modulus. - * @param e the exponent. - * - * @return the public key. - */ -pki.setRsaPublicKey = pki.rsa.setPublicKey = function(n, e) { - var key = { - n: n, - e: e - }; - - /** - * Encrypts the given data with this public key. Newer applications - * should use the 'RSA-OAEP' decryption scheme, 'RSAES-PKCS1-V1_5' is for - * legacy applications. - * - * @param data the byte string to encrypt. - * @param scheme the encryption scheme to use: - * 'RSAES-PKCS1-V1_5' (default), - * 'RSA-OAEP', - * 'RAW', 'NONE', or null to perform raw RSA encryption, - * an object with an 'encode' property set to a function - * with the signature 'function(data, key)' that returns - * a binary-encoded string representing the encoded data. - * @param schemeOptions any scheme-specific options. - * - * @return the encrypted byte string. - */ - key.encrypt = function(data, scheme, schemeOptions) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSAES-PKCS1-V1_5'; - } - - if(scheme === 'RSAES-PKCS1-V1_5') { - scheme = { - encode: function(m, key, pub) { - return _encodePkcs1_v1_5(m, key, 0x02).getBytes(); - } - }; - } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { - scheme = { - encode: function(m, key) { - return forge.pkcs1.encode_rsa_oaep(key, m, schemeOptions); - } - }; - } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { - scheme = {encode: function(e) {return e;}}; - } else if(typeof scheme === 'string') { - throw new Error('Unsupported encryption scheme: "' + scheme + '".'); - } - - // do scheme-based encoding then rsa encryption - var e = scheme.encode(data, key, true); - return pki.rsa.encrypt(e, key, true); - }; - - /** - * Verifies the given signature against the given digest. - * - * PKCS#1 supports multiple (currently two) signature schemes: - * RSASSA-PKCS1-V1_5 and RSASSA-PSS. - * - * By default this implementation uses the "old scheme", i.e. - * RSASSA-PKCS1-V1_5, in which case once RSA-decrypted, the - * signature is an OCTET STRING that holds a DigestInfo. - * - * DigestInfo ::= SEQUENCE { - * digestAlgorithm DigestAlgorithmIdentifier, - * digest Digest - * } - * DigestAlgorithmIdentifier ::= AlgorithmIdentifier - * Digest ::= OCTET STRING - * - * To perform PSS signature verification, provide an instance - * of Forge PSS object as the scheme parameter. - * - * @param digest the message digest hash to compare against the signature, - * as a binary-encoded string. - * @param signature the signature to verify, as a binary-encoded string. - * @param scheme signature verification scheme to use: - * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, - * a Forge PSS object for RSASSA-PSS, - * 'NONE' or null for none, DigestInfo will not be expected, but - * PKCS#1 v1.5 padding will still be used. - * - * @return true if the signature was verified, false if not. - */ - key.verify = function(digest, signature, scheme) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSASSA-PKCS1-V1_5'; - } - - if(scheme === 'RSASSA-PKCS1-V1_5') { - scheme = { - verify: function(digest, d) { - // remove padding - d = _decodePkcs1_v1_5(d, key, true); - // d is ASN.1 BER-encoded DigestInfo - var obj = asn1.fromDer(d); - // compare the given digest to the decrypted one - return digest === obj.value[1].value; - } - }; - } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { - scheme = { - verify: function(digest, d) { - // remove padding - d = _decodePkcs1_v1_5(d, key, true); - return digest === d; - } - }; - } - - // do rsa decryption w/o any decoding, then verify -- which does decoding - var d = pki.rsa.decrypt(signature, key, true, false); - return scheme.verify(digest, d, key.n.bitLength()); - }; - - return key; -}; - -/** - * Sets an RSA private key from BigIntegers modulus, exponent, primes, - * prime exponents, and modular multiplicative inverse. - * - * @param n the modulus. - * @param e the public exponent. - * @param d the private exponent ((inverse of e) mod n). - * @param p the first prime. - * @param q the second prime. - * @param dP exponent1 (d mod (p-1)). - * @param dQ exponent2 (d mod (q-1)). - * @param qInv ((inverse of q) mod p) - * - * @return the private key. - */ -pki.setRsaPrivateKey = pki.rsa.setPrivateKey = function( - n, e, d, p, q, dP, dQ, qInv) { - var key = { - n: n, - e: e, - d: d, - p: p, - q: q, - dP: dP, - dQ: dQ, - qInv: qInv - }; - - /** - * Decrypts the given data with this private key. The decryption scheme - * must match the one used to encrypt the data. - * - * @param data the byte string to decrypt. - * @param scheme the decryption scheme to use: - * 'RSAES-PKCS1-V1_5' (default), - * 'RSA-OAEP', - * 'RAW', 'NONE', or null to perform raw RSA decryption. - * @param schemeOptions any scheme-specific options. - * - * @return the decrypted byte string. - */ - key.decrypt = function(data, scheme, schemeOptions) { - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } else if(scheme === undefined) { - scheme = 'RSAES-PKCS1-V1_5'; - } - - // do rsa decryption w/o any decoding - var d = pki.rsa.decrypt(data, key, false, false); - - if(scheme === 'RSAES-PKCS1-V1_5') { - scheme = {decode: _decodePkcs1_v1_5}; - } else if(scheme === 'RSA-OAEP' || scheme === 'RSAES-OAEP') { - scheme = { - decode: function(d, key) { - return forge.pkcs1.decode_rsa_oaep(key, d, schemeOptions); - } - }; - } else if(['RAW', 'NONE', 'NULL', null].indexOf(scheme) !== -1) { - scheme = {decode: function(d) {return d;}}; - } else { - throw new Error('Unsupported encryption scheme: "' + scheme + '".'); - } - - // decode according to scheme - return scheme.decode(d, key, false); - }; - - /** - * Signs the given digest, producing a signature. - * - * PKCS#1 supports multiple (currently two) signature schemes: - * RSASSA-PKCS1-V1_5 and RSASSA-PSS. - * - * By default this implementation uses the "old scheme", i.e. - * RSASSA-PKCS1-V1_5. In order to generate a PSS signature, provide - * an instance of Forge PSS object as the scheme parameter. - * - * @param md the message digest object with the hash to sign. - * @param scheme the signature scheme to use: - * 'RSASSA-PKCS1-V1_5' or undefined for RSASSA PKCS#1 v1.5, - * a Forge PSS object for RSASSA-PSS, - * 'NONE' or null for none, DigestInfo will not be used but - * PKCS#1 v1.5 padding will still be used. - * - * @return the signature as a byte string. - */ - key.sign = function(md, scheme) { - /* Note: The internal implementation of RSA operations is being - transitioned away from a PKCS#1 v1.5 hard-coded scheme. Some legacy - code like the use of an encoding block identifier 'bt' will eventually - be removed. */ - - // private key operation - var bt = false; - - if(typeof scheme === 'string') { - scheme = scheme.toUpperCase(); - } - - if(scheme === undefined || scheme === 'RSASSA-PKCS1-V1_5') { - scheme = {encode: emsaPkcs1v15encode}; - bt = 0x01; - } else if(scheme === 'NONE' || scheme === 'NULL' || scheme === null) { - scheme = {encode: function() {return md;}}; - bt = 0x01; - } - - // encode and then encrypt - var d = scheme.encode(md, key.n.bitLength()); - return pki.rsa.encrypt(d, key, bt); - }; - - return key; -}; - -/** - * Wraps an RSAPrivateKey ASN.1 object in an ASN.1 PrivateKeyInfo object. - * - * @param rsaKey the ASN.1 RSAPrivateKey. - * - * @return the ASN.1 PrivateKeyInfo. - */ -pki.wrapRsaPrivateKey = function(rsaKey) { - // PrivateKeyInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (0) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(0).getBytes()), - // privateKeyAlgorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // PrivateKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, - asn1.toDer(rsaKey).getBytes()) - ]); -}; - -/** - * Converts a private key from an ASN.1 object. - * - * @param obj the ASN.1 representation of a PrivateKeyInfo containing an - * RSAPrivateKey or an RSAPrivateKey. - * - * @return the private key. - */ -pki.privateKeyFromAsn1 = function(obj) { - // get PrivateKeyInfo - var capture = {}; - var errors = []; - if(asn1.validate(obj, privateKeyValidator, capture, errors)) { - obj = asn1.fromDer(forge.util.createBuffer(capture.privateKey)); - } - - // get RSAPrivateKey - capture = {}; - errors = []; - if(!asn1.validate(obj, rsaPrivateKeyValidator, capture, errors)) { - var error = new Error('Cannot read private key. ' + - 'ASN.1 object does not contain an RSAPrivateKey.'); - error.errors = errors; - throw error; - } - - // Note: Version is currently ignored. - // capture.privateKeyVersion - // FIXME: inefficient, get a BigInteger that uses byte strings - var n, e, d, p, q, dP, dQ, qInv; - n = forge.util.createBuffer(capture.privateKeyModulus).toHex(); - e = forge.util.createBuffer(capture.privateKeyPublicExponent).toHex(); - d = forge.util.createBuffer(capture.privateKeyPrivateExponent).toHex(); - p = forge.util.createBuffer(capture.privateKeyPrime1).toHex(); - q = forge.util.createBuffer(capture.privateKeyPrime2).toHex(); - dP = forge.util.createBuffer(capture.privateKeyExponent1).toHex(); - dQ = forge.util.createBuffer(capture.privateKeyExponent2).toHex(); - qInv = forge.util.createBuffer(capture.privateKeyCoefficient).toHex(); - - // set private key - return pki.setRsaPrivateKey( - new BigInteger(n, 16), - new BigInteger(e, 16), - new BigInteger(d, 16), - new BigInteger(p, 16), - new BigInteger(q, 16), - new BigInteger(dP, 16), - new BigInteger(dQ, 16), - new BigInteger(qInv, 16)); -}; - -/** - * Converts a private key to an ASN.1 RSAPrivateKey. - * - * @param key the private key. - * - * @return the ASN.1 representation of an RSAPrivateKey. - */ -pki.privateKeyToAsn1 = pki.privateKeyToRSAPrivateKey = function(key) { - // RSAPrivateKey - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version (0 = only 2 primes, 1 multiple primes) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(0).getBytes()), - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)), - // privateExponent (d) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.d)), - // privateKeyPrime1 (p) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.p)), - // privateKeyPrime2 (q) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.q)), - // privateKeyExponent1 (dP) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.dP)), - // privateKeyExponent2 (dQ) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.dQ)), - // coefficient (qInv) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.qInv)) - ]); -}; - -/** - * Converts a public key from an ASN.1 SubjectPublicKeyInfo or RSAPublicKey. - * - * @param obj the asn1 representation of a SubjectPublicKeyInfo or RSAPublicKey. - * - * @return the public key. - */ -pki.publicKeyFromAsn1 = function(obj) { - // get SubjectPublicKeyInfo - var capture = {}; - var errors = []; - if(asn1.validate(obj, publicKeyValidator, capture, errors)) { - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - var error = new Error('Cannot read public key. Unknown OID.'); - error.oid = oid; - throw error; - } - obj = capture.rsaPublicKey; - } - - // get RSA params - errors = []; - if(!asn1.validate(obj, rsaPublicKeyValidator, capture, errors)) { - var error = new Error('Cannot read public key. ' + - 'ASN.1 object does not contain an RSAPublicKey.'); - error.errors = errors; - throw error; - } - - // FIXME: inefficient, get a BigInteger that uses byte strings - var n = forge.util.createBuffer(capture.publicKeyModulus).toHex(); - var e = forge.util.createBuffer(capture.publicKeyExponent).toHex(); - - // set public key - return pki.setRsaPublicKey( - new BigInteger(n, 16), - new BigInteger(e, 16)); -}; - -/** - * Converts a public key to an ASN.1 SubjectPublicKeyInfo. - * - * @param key the public key. - * - * @return the asn1 representation of a SubjectPublicKeyInfo. - */ -pki.publicKeyToAsn1 = pki.publicKeyToSubjectPublicKeyInfo = function(key) { - // SubjectPublicKeyInfo - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AlgorithmIdentifier - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(pki.oids.rsaEncryption).getBytes()), - // parameters (null) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]), - // subjectPublicKey - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, [ - pki.publicKeyToRSAPublicKey(key) - ]) - ]); -}; - -/** - * Converts a public key to an ASN.1 RSAPublicKey. - * - * @param key the public key. - * - * @return the asn1 representation of a RSAPublicKey. - */ -pki.publicKeyToRSAPublicKey = function(key) { - // RSAPublicKey - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // modulus (n) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.n)), - // publicExponent (e) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - _bnToBytes(key.e)) - ]); -}; - -/** - * Encodes a message using PKCS#1 v1.5 padding. - * - * @param m the message to encode. - * @param key the RSA key to use. - * @param bt the block type to use, i.e. either 0x01 (for signing) or 0x02 - * (for encryption). - * - * @return the padded byte buffer. - */ -function _encodePkcs1_v1_5(m, key, bt) { - var eb = forge.util.createBuffer(); - - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - /* use PKCS#1 v1.5 padding */ - if(m.length > (k - 11)) { - var error = new Error('Message is too long for PKCS#1 v1.5 padding.'); - error.length = m.length; - error.max = k - 11; - throw error; - } - - /* A block type BT, a padding string PS, and the data D shall be - formatted into an octet string EB, the encryption block: - - EB = 00 || BT || PS || 00 || D - - The block type BT shall be a single octet indicating the structure of - the encryption block. For this version of the document it shall have - value 00, 01, or 02. For a private-key operation, the block type - shall be 00 or 01. For a public-key operation, it shall be 02. - - The padding string PS shall consist of k-3-||D|| octets. For block - type 00, the octets shall have value 00; for block type 01, they - shall have value FF; and for block type 02, they shall be - pseudorandomly generated and nonzero. This makes the length of the - encryption block EB equal to k. */ - - // build the encryption block - eb.putByte(0x00); - eb.putByte(bt); - - // create the padding - var padNum = k - 3 - m.length; - var padByte; - // private key op - if(bt === 0x00 || bt === 0x01) { - padByte = (bt === 0x00) ? 0x00 : 0xFF; - for(var i = 0; i < padNum; ++i) { - eb.putByte(padByte); - } - } else { - // public key op - // pad with random non-zero values - while(padNum > 0) { - var numZeros = 0; - var padBytes = forge.random.getBytes(padNum); - for(var i = 0; i < padNum; ++i) { - padByte = padBytes.charCodeAt(i); - if(padByte === 0) { - ++numZeros; - } else { - eb.putByte(padByte); - } - } - padNum = numZeros; - } - } - - // zero followed by message - eb.putByte(0x00); - eb.putBytes(m); - - return eb; -} - -/** - * Decodes a message using PKCS#1 v1.5 padding. - * - * @param em the message to decode. - * @param key the RSA key to use. - * @param pub true if the key is a public key, false if it is private. - * @param ml the message length, if specified. - * - * @return the decoded bytes. - */ -function _decodePkcs1_v1_5(em, key, pub, ml) { - // get the length of the modulus in bytes - var k = Math.ceil(key.n.bitLength() / 8); - - /* It is an error if any of the following conditions occurs: - - 1. The encryption block EB cannot be parsed unambiguously. - 2. The padding string PS consists of fewer than eight octets - or is inconsisent with the block type BT. - 3. The decryption process is a public-key operation and the block - type BT is not 00 or 01, or the decryption process is a - private-key operation and the block type is not 02. - */ - - // parse the encryption block - var eb = forge.util.createBuffer(em); - var first = eb.getByte(); - var bt = eb.getByte(); - if(first !== 0x00 || - (pub && bt !== 0x00 && bt !== 0x01) || - (!pub && bt != 0x02) || - (pub && bt === 0x00 && typeof(ml) === 'undefined')) { - throw new Error('Encryption block is invalid.'); - } - - var padNum = 0; - if(bt === 0x00) { - // check all padding bytes for 0x00 - padNum = k - 3 - ml; - for(var i = 0; i < padNum; ++i) { - if(eb.getByte() !== 0x00) { - throw new Error('Encryption block is invalid.'); - } - } - } else if(bt === 0x01) { - // find the first byte that isn't 0xFF, should be after all padding - padNum = 0; - while(eb.length() > 1) { - if(eb.getByte() !== 0xFF) { - --eb.read; - break; - } - ++padNum; - } - } else if(bt === 0x02) { - // look for 0x00 byte - padNum = 0; - while(eb.length() > 1) { - if(eb.getByte() === 0x00) { - --eb.read; - break; - } - ++padNum; - } - } - - // zero must be 0x00 and padNum must be (k - 3 - message length) - var zero = eb.getByte(); - if(zero !== 0x00 || padNum !== (k - 3 - eb.length())) { - throw new Error('Encryption block is invalid.'); - } - - return eb.getBytes(); -} - -/** - * Runs the key-generation algorithm asynchronously, either in the background - * via Web Workers, or using the main thread and setImmediate. - * - * @param state the key-pair generation state. - * @param [options] options for key-pair generation: - * workerScript the worker script URL. - * workers the number of web workers (if supported) to use, - * (default: 2, -1 to use estimated cores minus one). - * workLoad the size of the work load, ie: number of possible prime - * numbers for each web worker to check per work assignment, - * (default: 100). - * @param callback(err, keypair) called once the operation completes. - */ -function _generateKeyPair(state, options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - - var opts = { - algorithm: { - name: options.algorithm || 'PRIMEINC', - options: { - workers: options.workers || 2, - workLoad: options.workLoad || 100, - workerScript: options.workerScript - } - } - }; - if('prng' in options) { - opts.prng = options.prng; - } - - generate(); - - function generate() { - // find p and then q (done in series to simplify) - getPrime(state.pBits, function(err, num) { - if(err) { - return callback(err); - } - state.p = num; - if(state.q !== null) { - return finish(err, state.q); - } - getPrime(state.qBits, finish); - }); - } - - function getPrime(bits, callback) { - forge.prime.generateProbablePrime(bits, opts, callback); - } - - function finish(err, num) { - if(err) { - return callback(err); - } - - // set q - state.q = num; - - // ensure p is larger than q (swap them if not) - if(state.p.compareTo(state.q) < 0) { - var tmp = state.p; - state.p = state.q; - state.q = tmp; - } - - // ensure p is coprime with e - if(state.p.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) !== 0) { - state.p = null; - generate(); - return; - } - - // ensure q is coprime with e - if(state.q.subtract(BigInteger.ONE).gcd(state.e) - .compareTo(BigInteger.ONE) !== 0) { - state.q = null; - getPrime(state.qBits, finish); - return; - } - - // compute phi: (p - 1)(q - 1) (Euler's totient function) - state.p1 = state.p.subtract(BigInteger.ONE); - state.q1 = state.q.subtract(BigInteger.ONE); - state.phi = state.p1.multiply(state.q1); - - // ensure e and phi are coprime - if(state.phi.gcd(state.e).compareTo(BigInteger.ONE) !== 0) { - // phi and e aren't coprime, so generate a new p and q - state.p = state.q = null; - generate(); - return; - } - - // create n, ensure n is has the right number of bits - state.n = state.p.multiply(state.q); - if(state.n.bitLength() !== state.bits) { - // failed, get new q - state.q = null; - getPrime(state.qBits, finish); - return; - } - - // set keys - var d = state.e.modInverse(state.phi); - state.keys = { - privateKey: pki.rsa.setPrivateKey( - state.n, state.e, d, state.p, state.q, - d.mod(state.p1), d.mod(state.q1), - state.q.modInverse(state.p)), - publicKey: pki.rsa.setPublicKey(state.n, state.e) - }; - - callback(null, state.keys); - } -} - -/** - * Converts a positive BigInteger into 2's-complement big-endian bytes. - * - * @param b the big integer to convert. - * - * @return the bytes. - */ -function _bnToBytes(b) { - // prepend 0x00 if first byte >= 0x80 - var hex = b.toString(16); - if(hex[0] >= '8') { - hex = '00' + hex; - } - var bytes = forge.util.hexToBytes(hex); - - // ensure integer is minimally-encoded - if(bytes.length > 1 && - // leading 0x00 for positive integer - ((bytes.charCodeAt(0) === 0 && - (bytes.charCodeAt(1) & 0x80) === 0) || - // leading 0xFF for negative integer - (bytes.charCodeAt(0) === 0xFF && - (bytes.charCodeAt(1) & 0x80) === 0x80))) { - return bytes.substr(1); - } - return bytes; -} - -/** - * Returns the required number of Miller-Rabin tests to generate a - * prime with an error probability of (1/2)^80. - * - * See Handbook of Applied Cryptography Chapter 4, Table 4.4. - * - * @param bits the bit size. - * - * @return the required number of iterations. - */ -function _getMillerRabinTests(bits) { - if(bits <= 100) return 27; - if(bits <= 150) return 18; - if(bits <= 200) return 15; - if(bits <= 250) return 12; - if(bits <= 300) return 9; - if(bits <= 350) return 8; - if(bits <= 400) return 7; - if(bits <= 500) return 6; - if(bits <= 600) return 5; - if(bits <= 800) return 4; - if(bits <= 1250) return 3; - return 2; -} - -/** - * Performs feature detection on the Node crypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectNodeCrypto(fn) { - return forge.util.isNodejs && typeof _crypto[fn] === 'function'; -} - -/** - * Performs feature detection on the SubtleCrypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectSubtleCrypto(fn) { - return (typeof util.globalScope !== 'undefined' && - typeof util.globalScope.crypto === 'object' && - typeof util.globalScope.crypto.subtle === 'object' && - typeof util.globalScope.crypto.subtle[fn] === 'function'); -} - -/** - * Performs feature detection on the deprecated Microsoft Internet Explorer - * outdated SubtleCrypto interface. This function should only be used after - * checking for the modern, standard SubtleCrypto interface. - * - * @param fn the feature (function) to detect. - * - * @return true if detected, false if not. - */ -function _detectSubtleMsCrypto(fn) { - return (typeof util.globalScope !== 'undefined' && - typeof util.globalScope.msCrypto === 'object' && - typeof util.globalScope.msCrypto.subtle === 'object' && - typeof util.globalScope.msCrypto.subtle[fn] === 'function'); -} - -function _intToUint8Array(x) { - var bytes = forge.util.hexToBytes(x.toString(16)); - var buffer = new Uint8Array(bytes.length); - for(var i = 0; i < bytes.length; ++i) { - buffer[i] = bytes.charCodeAt(i); - } - return buffer; -} - -function _privateKeyFromJwk(jwk) { - if(jwk.kty !== 'RSA') { - throw new Error( - 'Unsupported key algorithm "' + jwk.kty + '"; algorithm must be "RSA".'); - } - return pki.setRsaPrivateKey( - _base64ToBigInt(jwk.n), - _base64ToBigInt(jwk.e), - _base64ToBigInt(jwk.d), - _base64ToBigInt(jwk.p), - _base64ToBigInt(jwk.q), - _base64ToBigInt(jwk.dp), - _base64ToBigInt(jwk.dq), - _base64ToBigInt(jwk.qi)); -} - -function _publicKeyFromJwk(jwk) { - if(jwk.kty !== 'RSA') { - throw new Error('Key algorithm must be "RSA".'); - } - return pki.setRsaPublicKey( - _base64ToBigInt(jwk.n), - _base64ToBigInt(jwk.e)); -} - -function _base64ToBigInt(b64) { - return new BigInteger(forge.util.bytesToHex(forge.util.decode64(b64)), 16); -} diff --git a/reverse_engineering/node_modules/node-forge/lib/sha1.js b/reverse_engineering/node_modules/node-forge/lib/sha1.js deleted file mode 100644 index 5f84eb66..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/sha1.js +++ /dev/null @@ -1,319 +0,0 @@ -/** - * Secure Hash Algorithm with 160-bit digest (SHA-1) implementation. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha1 = module.exports = forge.sha1 = forge.sha1 || {}; -forge.md.sha1 = forge.md.algorithms.sha1 = sha1; - -/** - * Creates a SHA-1 message digest object. - * - * @return a message digest object. - */ -sha1.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // SHA-1 state contains five 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(80); - - // message digest object - var md = { - algorithm: 'sha1', - blockLength: 64, - digestLength: 20, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x67452301, - h1: 0xEFCDAB89, - h2: 0x98BADCFE, - h3: 0x10325476, - h4: 0xC3D2E1F0 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-1 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3, - h4: _state.h4 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32(s2.h0); - rval.putInt32(s2.h1); - rval.putInt32(s2.h2); - rval.putInt32(s2.h3); - rval.putInt32(s2.h4); - return rval; - }; - - return md; -}; - -// sha-1 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-1 state with the given byte buffer. - * - * @param s the SHA-1 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t, a, b, c, d, e, f, i; - var len = bytes.length(); - while(len >= 64) { - // the w array will be populated with sixteen 32-bit big-endian words - // and then extended into 80 32-bit words according to SHA-1 algorithm - // and for 32-79 using Max Locktyukhin's optimization - - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - e = s.h4; - - // round 1 - for(i = 0; i < 16; ++i) { - t = bytes.getInt32(); - w[i] = t; - f = d ^ (b & (c ^ d)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - for(; i < 20; ++i) { - t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); - t = (t << 1) | (t >>> 31); - w[i] = t; - f = d ^ (b & (c ^ d)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x5A827999 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 2 - for(; i < 32; ++i) { - t = (w[i - 3] ^ w[i - 8] ^ w[i - 14] ^ w[i - 16]); - t = (t << 1) | (t >>> 31); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - for(; i < 40; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0x6ED9EBA1 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 3 - for(; i < 60; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = (b & c) | (d & (b ^ c)); - t = ((a << 5) | (a >>> 27)) + f + e + 0x8F1BBCDC + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - // round 4 - for(; i < 80; ++i) { - t = (w[i - 6] ^ w[i - 16] ^ w[i - 28] ^ w[i - 32]); - t = (t << 2) | (t >>> 30); - w[i] = t; - f = b ^ c ^ d; - t = ((a << 5) | (a >>> 27)) + f + e + 0xCA62C1D6 + t; - e = d; - d = c; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - c = ((b << 30) | (b >>> 2)) >>> 0; - b = a; - a = t; - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - s.h4 = (s.h4 + e) | 0; - - len -= 64; - } -} diff --git a/reverse_engineering/node_modules/node-forge/lib/sha256.js b/reverse_engineering/node_modules/node-forge/lib/sha256.js deleted file mode 100644 index 0659ad71..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/sha256.js +++ /dev/null @@ -1,327 +0,0 @@ -/** - * Secure Hash Algorithm with 256-bit digest (SHA-256) implementation. - * - * See FIPS 180-2 for details. - * - * @author Dave Longley - * - * Copyright (c) 2010-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha256 = module.exports = forge.sha256 = forge.sha256 || {}; -forge.md.sha256 = forge.md.algorithms.sha256 = sha256; - -/** - * Creates a SHA-256 message digest object. - * - * @return a message digest object. - */ -sha256.create = function() { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - // SHA-256 state contains eight 32-bit integers - var _state = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for word storage - var _w = new Array(64); - - // message digest object - var md = { - algorithm: 'sha256', - blockLength: 64, - digestLength: 32, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 8 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength64 for backwards-compatibility) - md.fullMessageLength = md.messageLength64 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _state = { - h0: 0x6A09E667, - h1: 0xBB67AE85, - h2: 0x3C6EF372, - h3: 0xA54FF53A, - h4: 0x510E527F, - h5: 0x9B05688C, - h6: 0x1F83D9AB, - h7: 0x5BE0CD19 - }; - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_state, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-256 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 448 mod 512. In other words, - the data to be digested must be a multiple of 512 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 8 bytes (64 - bits), that means that the last segment of the data must have 56 bytes - (448 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 448 mod 512 because - 512 - 128 = 448. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 448 mod 512, then 512 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var s2 = { - h0: _state.h0, - h1: _state.h1, - h2: _state.h2, - h3: _state.h3, - h4: _state.h4, - h5: _state.h5, - h6: _state.h6, - h7: _state.h7 - }; - _update(s2, _w, finalBlock); - var rval = forge.util.createBuffer(); - rval.putInt32(s2.h0); - rval.putInt32(s2.h1); - rval.putInt32(s2.h2); - rval.putInt32(s2.h3); - rval.putInt32(s2.h4); - rval.putInt32(s2.h5); - rval.putInt32(s2.h6); - rval.putInt32(s2.h7); - return rval; - }; - - return md; -}; - -// sha-256 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -// table of constants -var _k = null; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 64); - - // create K table for SHA-256 - _k = [ - 0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, - 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5, - 0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, - 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174, - 0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, - 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da, - 0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, - 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967, - 0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, - 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85, - 0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, - 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070, - 0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, - 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3, - 0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, - 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2]; - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-256 state with the given byte buffer. - * - * @param s the SHA-256 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (64 byte) chunks - var t1, t2, s0, s1, ch, maj, i, a, b, c, d, e, f, g, h; - var len = bytes.length(); - while(len >= 64) { - // the w array will be populated with sixteen 32-bit big-endian words - // and then extended into 64 32-bit words according to SHA-256 - for(i = 0; i < 16; ++i) { - w[i] = bytes.getInt32(); - } - for(; i < 64; ++i) { - // XOR word 2 words ago rot right 17, rot right 19, shft right 10 - t1 = w[i - 2]; - t1 = - ((t1 >>> 17) | (t1 << 15)) ^ - ((t1 >>> 19) | (t1 << 13)) ^ - (t1 >>> 10); - // XOR word 15 words ago rot right 7, rot right 18, shft right 3 - t2 = w[i - 15]; - t2 = - ((t2 >>> 7) | (t2 << 25)) ^ - ((t2 >>> 18) | (t2 << 14)) ^ - (t2 >>> 3); - // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^32 - w[i] = (t1 + w[i - 7] + t2 + w[i - 16]) | 0; - } - - // initialize hash value for this chunk - a = s.h0; - b = s.h1; - c = s.h2; - d = s.h3; - e = s.h4; - f = s.h5; - g = s.h6; - h = s.h7; - - // round function - for(i = 0; i < 64; ++i) { - // Sum1(e) - s1 = - ((e >>> 6) | (e << 26)) ^ - ((e >>> 11) | (e << 21)) ^ - ((e >>> 25) | (e << 7)); - // Ch(e, f, g) (optimized the same way as SHA-1) - ch = g ^ (e & (f ^ g)); - // Sum0(a) - s0 = - ((a >>> 2) | (a << 30)) ^ - ((a >>> 13) | (a << 19)) ^ - ((a >>> 22) | (a << 10)); - // Maj(a, b, c) (optimized the same way as SHA-1) - maj = (a & b) | (c & (a ^ b)); - - // main algorithm - t1 = h + s1 + ch + _k[i] + w[i]; - t2 = s0 + maj; - h = g; - g = f; - f = e; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - // can't truncate with `| 0` - e = (d + t1) >>> 0; - d = c; - c = b; - b = a; - // `>>> 0` necessary to avoid iOS/Safari 10 optimization bug - // can't truncate with `| 0` - a = (t1 + t2) >>> 0; - } - - // update hash state - s.h0 = (s.h0 + a) | 0; - s.h1 = (s.h1 + b) | 0; - s.h2 = (s.h2 + c) | 0; - s.h3 = (s.h3 + d) | 0; - s.h4 = (s.h4 + e) | 0; - s.h5 = (s.h5 + f) | 0; - s.h6 = (s.h6 + g) | 0; - s.h7 = (s.h7 + h) | 0; - len -= 64; - } -} diff --git a/reverse_engineering/node_modules/node-forge/lib/sha512.js b/reverse_engineering/node_modules/node-forge/lib/sha512.js deleted file mode 100644 index e09b442a..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/sha512.js +++ /dev/null @@ -1,561 +0,0 @@ -/** - * Secure Hash Algorithm with a 1024-bit block size implementation. - * - * This includes: SHA-512, SHA-384, SHA-512/224, and SHA-512/256. For - * SHA-256 (block size 512 bits), see sha256.js. - * - * See FIPS 180-4 for details. - * - * @author Dave Longley - * - * Copyright (c) 2014-2015 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./md'); -require('./util'); - -var sha512 = module.exports = forge.sha512 = forge.sha512 || {}; - -// SHA-512 -forge.md.sha512 = forge.md.algorithms.sha512 = sha512; - -// SHA-384 -var sha384 = forge.sha384 = forge.sha512.sha384 = forge.sha512.sha384 || {}; -sha384.create = function() { - return sha512.create('SHA-384'); -}; -forge.md.sha384 = forge.md.algorithms.sha384 = sha384; - -// SHA-512/256 -forge.sha512.sha256 = forge.sha512.sha256 || { - create: function() { - return sha512.create('SHA-512/256'); - } -}; -forge.md['sha512/256'] = forge.md.algorithms['sha512/256'] = - forge.sha512.sha256; - -// SHA-512/224 -forge.sha512.sha224 = forge.sha512.sha224 || { - create: function() { - return sha512.create('SHA-512/224'); - } -}; -forge.md['sha512/224'] = forge.md.algorithms['sha512/224'] = - forge.sha512.sha224; - -/** - * Creates a SHA-2 message digest object. - * - * @param algorithm the algorithm to use (SHA-512, SHA-384, SHA-512/224, - * SHA-512/256). - * - * @return a message digest object. - */ -sha512.create = function(algorithm) { - // do initialization as necessary - if(!_initialized) { - _init(); - } - - if(typeof algorithm === 'undefined') { - algorithm = 'SHA-512'; - } - - if(!(algorithm in _states)) { - throw new Error('Invalid SHA-512 algorithm: ' + algorithm); - } - - // SHA-512 state contains eight 64-bit integers (each as two 32-bit ints) - var _state = _states[algorithm]; - var _h = null; - - // input buffer - var _input = forge.util.createBuffer(); - - // used for 64-bit word storage - var _w = new Array(80); - for(var wi = 0; wi < 80; ++wi) { - _w[wi] = new Array(2); - } - - // determine digest length by algorithm name (default) - var digestLength = 64; - switch(algorithm) { - case 'SHA-384': - digestLength = 48; - break; - case 'SHA-512/256': - digestLength = 32; - break; - case 'SHA-512/224': - digestLength = 28; - break; - } - - // message digest object - var md = { - // SHA-512 => sha512 - algorithm: algorithm.replace('-', '').toLowerCase(), - blockLength: 128, - digestLength: digestLength, - // 56-bit length of message so far (does not including padding) - messageLength: 0, - // true message length - fullMessageLength: null, - // size of message length in bytes - messageLengthSize: 16 - }; - - /** - * Starts the digest. - * - * @return this digest object. - */ - md.start = function() { - // up to 56-bit message length for convenience - md.messageLength = 0; - - // full message length (set md.messageLength128 for backwards-compatibility) - md.fullMessageLength = md.messageLength128 = []; - var int32s = md.messageLengthSize / 4; - for(var i = 0; i < int32s; ++i) { - md.fullMessageLength.push(0); - } - _input = forge.util.createBuffer(); - _h = new Array(_state.length); - for(var i = 0; i < _state.length; ++i) { - _h[i] = _state[i].slice(0); - } - return md; - }; - // start digest automatically for first time - md.start(); - - /** - * Updates the digest with the given message input. The given input can - * treated as raw input (no encoding will be applied) or an encoding of - * 'utf8' maybe given to encode the input using UTF-8. - * - * @param msg the message input to update with. - * @param encoding the encoding to use (default: 'raw', other: 'utf8'). - * - * @return this digest object. - */ - md.update = function(msg, encoding) { - if(encoding === 'utf8') { - msg = forge.util.encodeUtf8(msg); - } - - // update message length - var len = msg.length; - md.messageLength += len; - len = [(len / 0x100000000) >>> 0, len >>> 0]; - for(var i = md.fullMessageLength.length - 1; i >= 0; --i) { - md.fullMessageLength[i] += len[1]; - len[1] = len[0] + ((md.fullMessageLength[i] / 0x100000000) >>> 0); - md.fullMessageLength[i] = md.fullMessageLength[i] >>> 0; - len[0] = ((len[1] / 0x100000000) >>> 0); - } - - // add bytes to input buffer - _input.putBytes(msg); - - // process bytes - _update(_h, _w, _input); - - // compact input buffer every 2K or if empty - if(_input.read > 2048 || _input.length() === 0) { - _input.compact(); - } - - return md; - }; - - /** - * Produces the digest. - * - * @return a byte buffer containing the digest value. - */ - md.digest = function() { - /* Note: Here we copy the remaining bytes in the input buffer and - add the appropriate SHA-512 padding. Then we do the final update - on a copy of the state so that if the user wants to get - intermediate digests they can do so. */ - - /* Determine the number of bytes that must be added to the message - to ensure its length is congruent to 896 mod 1024. In other words, - the data to be digested must be a multiple of 1024 bits (or 128 bytes). - This data includes the message, some padding, and the length of the - message. Since the length of the message will be encoded as 16 bytes (128 - bits), that means that the last segment of the data must have 112 bytes - (896 bits) of message and padding. Therefore, the length of the message - plus the padding must be congruent to 896 mod 1024 because - 1024 - 128 = 896. - - In order to fill up the message length it must be filled with - padding that begins with 1 bit followed by all 0 bits. Padding - must *always* be present, so if the message length is already - congruent to 896 mod 1024, then 1024 padding bits must be added. */ - - var finalBlock = forge.util.createBuffer(); - finalBlock.putBytes(_input.bytes()); - - // compute remaining size to be digested (include message length size) - var remaining = ( - md.fullMessageLength[md.fullMessageLength.length - 1] + - md.messageLengthSize); - - // add padding for overflow blockSize - overflow - // _padding starts with 1 byte with first bit is set (byte value 128), then - // there may be up to (blockSize - 1) other pad bytes - var overflow = remaining & (md.blockLength - 1); - finalBlock.putBytes(_padding.substr(0, md.blockLength - overflow)); - - // serialize message length in bits in big-endian order; since length - // is stored in bytes we multiply by 8 and add carry from next int - var next, carry; - var bits = md.fullMessageLength[0] * 8; - for(var i = 0; i < md.fullMessageLength.length - 1; ++i) { - next = md.fullMessageLength[i + 1] * 8; - carry = (next / 0x100000000) >>> 0; - bits += carry; - finalBlock.putInt32(bits >>> 0); - bits = next >>> 0; - } - finalBlock.putInt32(bits); - - var h = new Array(_h.length); - for(var i = 0; i < _h.length; ++i) { - h[i] = _h[i].slice(0); - } - _update(h, _w, finalBlock); - var rval = forge.util.createBuffer(); - var hlen; - if(algorithm === 'SHA-512') { - hlen = h.length; - } else if(algorithm === 'SHA-384') { - hlen = h.length - 2; - } else { - hlen = h.length - 4; - } - for(var i = 0; i < hlen; ++i) { - rval.putInt32(h[i][0]); - if(i !== hlen - 1 || algorithm !== 'SHA-512/224') { - rval.putInt32(h[i][1]); - } - } - return rval; - }; - - return md; -}; - -// sha-512 padding bytes not initialized yet -var _padding = null; -var _initialized = false; - -// table of constants -var _k = null; - -// initial hash states -var _states = null; - -/** - * Initializes the constant tables. - */ -function _init() { - // create padding - _padding = String.fromCharCode(128); - _padding += forge.util.fillString(String.fromCharCode(0x00), 128); - - // create K table for SHA-512 - _k = [ - [0x428a2f98, 0xd728ae22], [0x71374491, 0x23ef65cd], - [0xb5c0fbcf, 0xec4d3b2f], [0xe9b5dba5, 0x8189dbbc], - [0x3956c25b, 0xf348b538], [0x59f111f1, 0xb605d019], - [0x923f82a4, 0xaf194f9b], [0xab1c5ed5, 0xda6d8118], - [0xd807aa98, 0xa3030242], [0x12835b01, 0x45706fbe], - [0x243185be, 0x4ee4b28c], [0x550c7dc3, 0xd5ffb4e2], - [0x72be5d74, 0xf27b896f], [0x80deb1fe, 0x3b1696b1], - [0x9bdc06a7, 0x25c71235], [0xc19bf174, 0xcf692694], - [0xe49b69c1, 0x9ef14ad2], [0xefbe4786, 0x384f25e3], - [0x0fc19dc6, 0x8b8cd5b5], [0x240ca1cc, 0x77ac9c65], - [0x2de92c6f, 0x592b0275], [0x4a7484aa, 0x6ea6e483], - [0x5cb0a9dc, 0xbd41fbd4], [0x76f988da, 0x831153b5], - [0x983e5152, 0xee66dfab], [0xa831c66d, 0x2db43210], - [0xb00327c8, 0x98fb213f], [0xbf597fc7, 0xbeef0ee4], - [0xc6e00bf3, 0x3da88fc2], [0xd5a79147, 0x930aa725], - [0x06ca6351, 0xe003826f], [0x14292967, 0x0a0e6e70], - [0x27b70a85, 0x46d22ffc], [0x2e1b2138, 0x5c26c926], - [0x4d2c6dfc, 0x5ac42aed], [0x53380d13, 0x9d95b3df], - [0x650a7354, 0x8baf63de], [0x766a0abb, 0x3c77b2a8], - [0x81c2c92e, 0x47edaee6], [0x92722c85, 0x1482353b], - [0xa2bfe8a1, 0x4cf10364], [0xa81a664b, 0xbc423001], - [0xc24b8b70, 0xd0f89791], [0xc76c51a3, 0x0654be30], - [0xd192e819, 0xd6ef5218], [0xd6990624, 0x5565a910], - [0xf40e3585, 0x5771202a], [0x106aa070, 0x32bbd1b8], - [0x19a4c116, 0xb8d2d0c8], [0x1e376c08, 0x5141ab53], - [0x2748774c, 0xdf8eeb99], [0x34b0bcb5, 0xe19b48a8], - [0x391c0cb3, 0xc5c95a63], [0x4ed8aa4a, 0xe3418acb], - [0x5b9cca4f, 0x7763e373], [0x682e6ff3, 0xd6b2b8a3], - [0x748f82ee, 0x5defb2fc], [0x78a5636f, 0x43172f60], - [0x84c87814, 0xa1f0ab72], [0x8cc70208, 0x1a6439ec], - [0x90befffa, 0x23631e28], [0xa4506ceb, 0xde82bde9], - [0xbef9a3f7, 0xb2c67915], [0xc67178f2, 0xe372532b], - [0xca273ece, 0xea26619c], [0xd186b8c7, 0x21c0c207], - [0xeada7dd6, 0xcde0eb1e], [0xf57d4f7f, 0xee6ed178], - [0x06f067aa, 0x72176fba], [0x0a637dc5, 0xa2c898a6], - [0x113f9804, 0xbef90dae], [0x1b710b35, 0x131c471b], - [0x28db77f5, 0x23047d84], [0x32caab7b, 0x40c72493], - [0x3c9ebe0a, 0x15c9bebc], [0x431d67c4, 0x9c100d4c], - [0x4cc5d4be, 0xcb3e42b6], [0x597f299c, 0xfc657e2a], - [0x5fcb6fab, 0x3ad6faec], [0x6c44198c, 0x4a475817] - ]; - - // initial hash states - _states = {}; - _states['SHA-512'] = [ - [0x6a09e667, 0xf3bcc908], - [0xbb67ae85, 0x84caa73b], - [0x3c6ef372, 0xfe94f82b], - [0xa54ff53a, 0x5f1d36f1], - [0x510e527f, 0xade682d1], - [0x9b05688c, 0x2b3e6c1f], - [0x1f83d9ab, 0xfb41bd6b], - [0x5be0cd19, 0x137e2179] - ]; - _states['SHA-384'] = [ - [0xcbbb9d5d, 0xc1059ed8], - [0x629a292a, 0x367cd507], - [0x9159015a, 0x3070dd17], - [0x152fecd8, 0xf70e5939], - [0x67332667, 0xffc00b31], - [0x8eb44a87, 0x68581511], - [0xdb0c2e0d, 0x64f98fa7], - [0x47b5481d, 0xbefa4fa4] - ]; - _states['SHA-512/256'] = [ - [0x22312194, 0xFC2BF72C], - [0x9F555FA3, 0xC84C64C2], - [0x2393B86B, 0x6F53B151], - [0x96387719, 0x5940EABD], - [0x96283EE2, 0xA88EFFE3], - [0xBE5E1E25, 0x53863992], - [0x2B0199FC, 0x2C85B8AA], - [0x0EB72DDC, 0x81C52CA2] - ]; - _states['SHA-512/224'] = [ - [0x8C3D37C8, 0x19544DA2], - [0x73E19966, 0x89DCD4D6], - [0x1DFAB7AE, 0x32FF9C82], - [0x679DD514, 0x582F9FCF], - [0x0F6D2B69, 0x7BD44DA8], - [0x77E36F73, 0x04C48942], - [0x3F9D85A8, 0x6A1D36C8], - [0x1112E6AD, 0x91D692A1] - ]; - - // now initialized - _initialized = true; -} - -/** - * Updates a SHA-512 state with the given byte buffer. - * - * @param s the SHA-512 state to update. - * @param w the array to use to store words. - * @param bytes the byte buffer to update with. - */ -function _update(s, w, bytes) { - // consume 512 bit (128 byte) chunks - var t1_hi, t1_lo; - var t2_hi, t2_lo; - var s0_hi, s0_lo; - var s1_hi, s1_lo; - var ch_hi, ch_lo; - var maj_hi, maj_lo; - var a_hi, a_lo; - var b_hi, b_lo; - var c_hi, c_lo; - var d_hi, d_lo; - var e_hi, e_lo; - var f_hi, f_lo; - var g_hi, g_lo; - var h_hi, h_lo; - var i, hi, lo, w2, w7, w15, w16; - var len = bytes.length(); - while(len >= 128) { - // the w array will be populated with sixteen 64-bit big-endian words - // and then extended into 64 64-bit words according to SHA-512 - for(i = 0; i < 16; ++i) { - w[i][0] = bytes.getInt32() >>> 0; - w[i][1] = bytes.getInt32() >>> 0; - } - for(; i < 80; ++i) { - // for word 2 words ago: ROTR 19(x) ^ ROTR 61(x) ^ SHR 6(x) - w2 = w[i - 2]; - hi = w2[0]; - lo = w2[1]; - - // high bits - t1_hi = ( - ((hi >>> 19) | (lo << 13)) ^ // ROTR 19 - ((lo >>> 29) | (hi << 3)) ^ // ROTR 61/(swap + ROTR 29) - (hi >>> 6)) >>> 0; // SHR 6 - // low bits - t1_lo = ( - ((hi << 13) | (lo >>> 19)) ^ // ROTR 19 - ((lo << 3) | (hi >>> 29)) ^ // ROTR 61/(swap + ROTR 29) - ((hi << 26) | (lo >>> 6))) >>> 0; // SHR 6 - - // for word 15 words ago: ROTR 1(x) ^ ROTR 8(x) ^ SHR 7(x) - w15 = w[i - 15]; - hi = w15[0]; - lo = w15[1]; - - // high bits - t2_hi = ( - ((hi >>> 1) | (lo << 31)) ^ // ROTR 1 - ((hi >>> 8) | (lo << 24)) ^ // ROTR 8 - (hi >>> 7)) >>> 0; // SHR 7 - // low bits - t2_lo = ( - ((hi << 31) | (lo >>> 1)) ^ // ROTR 1 - ((hi << 24) | (lo >>> 8)) ^ // ROTR 8 - ((hi << 25) | (lo >>> 7))) >>> 0; // SHR 7 - - // sum(t1, word 7 ago, t2, word 16 ago) modulo 2^64 (carry lo overflow) - w7 = w[i - 7]; - w16 = w[i - 16]; - lo = (t1_lo + w7[1] + t2_lo + w16[1]); - w[i][0] = (t1_hi + w7[0] + t2_hi + w16[0] + - ((lo / 0x100000000) >>> 0)) >>> 0; - w[i][1] = lo >>> 0; - } - - // initialize hash value for this chunk - a_hi = s[0][0]; - a_lo = s[0][1]; - b_hi = s[1][0]; - b_lo = s[1][1]; - c_hi = s[2][0]; - c_lo = s[2][1]; - d_hi = s[3][0]; - d_lo = s[3][1]; - e_hi = s[4][0]; - e_lo = s[4][1]; - f_hi = s[5][0]; - f_lo = s[5][1]; - g_hi = s[6][0]; - g_lo = s[6][1]; - h_hi = s[7][0]; - h_lo = s[7][1]; - - // round function - for(i = 0; i < 80; ++i) { - // Sum1(e) = ROTR 14(e) ^ ROTR 18(e) ^ ROTR 41(e) - s1_hi = ( - ((e_hi >>> 14) | (e_lo << 18)) ^ // ROTR 14 - ((e_hi >>> 18) | (e_lo << 14)) ^ // ROTR 18 - ((e_lo >>> 9) | (e_hi << 23))) >>> 0; // ROTR 41/(swap + ROTR 9) - s1_lo = ( - ((e_hi << 18) | (e_lo >>> 14)) ^ // ROTR 14 - ((e_hi << 14) | (e_lo >>> 18)) ^ // ROTR 18 - ((e_lo << 23) | (e_hi >>> 9))) >>> 0; // ROTR 41/(swap + ROTR 9) - - // Ch(e, f, g) (optimized the same way as SHA-1) - ch_hi = (g_hi ^ (e_hi & (f_hi ^ g_hi))) >>> 0; - ch_lo = (g_lo ^ (e_lo & (f_lo ^ g_lo))) >>> 0; - - // Sum0(a) = ROTR 28(a) ^ ROTR 34(a) ^ ROTR 39(a) - s0_hi = ( - ((a_hi >>> 28) | (a_lo << 4)) ^ // ROTR 28 - ((a_lo >>> 2) | (a_hi << 30)) ^ // ROTR 34/(swap + ROTR 2) - ((a_lo >>> 7) | (a_hi << 25))) >>> 0; // ROTR 39/(swap + ROTR 7) - s0_lo = ( - ((a_hi << 4) | (a_lo >>> 28)) ^ // ROTR 28 - ((a_lo << 30) | (a_hi >>> 2)) ^ // ROTR 34/(swap + ROTR 2) - ((a_lo << 25) | (a_hi >>> 7))) >>> 0; // ROTR 39/(swap + ROTR 7) - - // Maj(a, b, c) (optimized the same way as SHA-1) - maj_hi = ((a_hi & b_hi) | (c_hi & (a_hi ^ b_hi))) >>> 0; - maj_lo = ((a_lo & b_lo) | (c_lo & (a_lo ^ b_lo))) >>> 0; - - // main algorithm - // t1 = (h + s1 + ch + _k[i] + _w[i]) modulo 2^64 (carry lo overflow) - lo = (h_lo + s1_lo + ch_lo + _k[i][1] + w[i][1]); - t1_hi = (h_hi + s1_hi + ch_hi + _k[i][0] + w[i][0] + - ((lo / 0x100000000) >>> 0)) >>> 0; - t1_lo = lo >>> 0; - - // t2 = s0 + maj modulo 2^64 (carry lo overflow) - lo = s0_lo + maj_lo; - t2_hi = (s0_hi + maj_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - t2_lo = lo >>> 0; - - h_hi = g_hi; - h_lo = g_lo; - - g_hi = f_hi; - g_lo = f_lo; - - f_hi = e_hi; - f_lo = e_lo; - - // e = (d + t1) modulo 2^64 (carry lo overflow) - lo = d_lo + t1_lo; - e_hi = (d_hi + t1_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - e_lo = lo >>> 0; - - d_hi = c_hi; - d_lo = c_lo; - - c_hi = b_hi; - c_lo = b_lo; - - b_hi = a_hi; - b_lo = a_lo; - - // a = (t1 + t2) modulo 2^64 (carry lo overflow) - lo = t1_lo + t2_lo; - a_hi = (t1_hi + t2_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - a_lo = lo >>> 0; - } - - // update hash state (additional modulo 2^64) - lo = s[0][1] + a_lo; - s[0][0] = (s[0][0] + a_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[0][1] = lo >>> 0; - - lo = s[1][1] + b_lo; - s[1][0] = (s[1][0] + b_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[1][1] = lo >>> 0; - - lo = s[2][1] + c_lo; - s[2][0] = (s[2][0] + c_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[2][1] = lo >>> 0; - - lo = s[3][1] + d_lo; - s[3][0] = (s[3][0] + d_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[3][1] = lo >>> 0; - - lo = s[4][1] + e_lo; - s[4][0] = (s[4][0] + e_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[4][1] = lo >>> 0; - - lo = s[5][1] + f_lo; - s[5][0] = (s[5][0] + f_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[5][1] = lo >>> 0; - - lo = s[6][1] + g_lo; - s[6][0] = (s[6][0] + g_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[6][1] = lo >>> 0; - - lo = s[7][1] + h_lo; - s[7][0] = (s[7][0] + h_hi + ((lo / 0x100000000) >>> 0)) >>> 0; - s[7][1] = lo >>> 0; - - len -= 128; - } -} diff --git a/reverse_engineering/node_modules/node-forge/lib/socket.js b/reverse_engineering/node_modules/node-forge/lib/socket.js deleted file mode 100644 index 3a1d7ff2..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/socket.js +++ /dev/null @@ -1,287 +0,0 @@ -/** - * Socket implementation that uses flash SocketPool class as a backend. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./util'); - -// define net namespace -var net = module.exports = forge.net = forge.net || {}; - -// map of flash ID to socket pool -net.socketPools = {}; - -/** - * Creates a flash socket pool. - * - * @param options: - * flashId: the dom ID for the flash object element. - * policyPort: the default policy port for sockets, 0 to use the - * flash default. - * policyUrl: the default policy file URL for sockets (if provided - * used instead of a policy port). - * msie: true if the browser is msie, false if not. - * - * @return the created socket pool. - */ -net.createSocketPool = function(options) { - // set default - options.msie = options.msie || false; - - // initialize the flash interface - var spId = options.flashId; - var api = document.getElementById(spId); - api.init({marshallExceptions: !options.msie}); - - // create socket pool entry - var sp = { - // ID of the socket pool - id: spId, - // flash interface - flashApi: api, - // map of socket ID to sockets - sockets: {}, - // default policy port - policyPort: options.policyPort || 0, - // default policy URL - policyUrl: options.policyUrl || null - }; - net.socketPools[spId] = sp; - - // create event handler, subscribe to flash events - if(options.msie === true) { - sp.handler = function(e) { - if(e.id in sp.sockets) { - // get handler function - var f; - switch(e.type) { - case 'connect': - f = 'connected'; - break; - case 'close': - f = 'closed'; - break; - case 'socketData': - f = 'data'; - break; - default: - f = 'error'; - break; - } - /* IE calls javascript on the thread of the external object - that triggered the event (in this case flash) ... which will - either run concurrently with other javascript or pre-empt any - running javascript in the middle of its execution (BAD!) ... - calling setTimeout() will schedule the javascript to run on - the javascript thread and solve this EVIL problem. */ - setTimeout(function() {sp.sockets[e.id][f](e);}, 0); - } - }; - } else { - sp.handler = function(e) { - if(e.id in sp.sockets) { - // get handler function - var f; - switch(e.type) { - case 'connect': - f = 'connected'; - break; - case 'close': - f = 'closed'; - break; - case 'socketData': - f = 'data'; - break; - default: - f = 'error'; - break; - } - sp.sockets[e.id][f](e); - } - }; - } - var handler = 'forge.net.socketPools[\'' + spId + '\'].handler'; - api.subscribe('connect', handler); - api.subscribe('close', handler); - api.subscribe('socketData', handler); - api.subscribe('ioError', handler); - api.subscribe('securityError', handler); - - /** - * Destroys a socket pool. The socket pool still needs to be cleaned - * up via net.cleanup(). - */ - sp.destroy = function() { - delete net.socketPools[options.flashId]; - for(var id in sp.sockets) { - sp.sockets[id].destroy(); - } - sp.sockets = {}; - api.cleanup(); - }; - - /** - * Creates a new socket. - * - * @param options: - * connected: function(event) called when the socket connects. - * closed: function(event) called when the socket closes. - * data: function(event) called when socket data has arrived, - * it can be read from the socket using receive(). - * error: function(event) called when a socket error occurs. - */ - sp.createSocket = function(options) { - // default to empty options - options = options || {}; - - // create flash socket - var id = api.create(); - - // create javascript socket wrapper - var socket = { - id: id, - // set handlers - connected: options.connected || function(e) {}, - closed: options.closed || function(e) {}, - data: options.data || function(e) {}, - error: options.error || function(e) {} - }; - - /** - * Destroys this socket. - */ - socket.destroy = function() { - api.destroy(id); - delete sp.sockets[id]; - }; - - /** - * Connects this socket. - * - * @param options: - * host: the host to connect to. - * port: the port to connect to. - * policyPort: the policy port to use (if non-default), 0 to - * use the flash default. - * policyUrl: the policy file URL to use (instead of port). - */ - socket.connect = function(options) { - // give precedence to policy URL over policy port - // if no policy URL and passed port isn't 0, use default port, - // otherwise use 0 for the port - var policyUrl = options.policyUrl || null; - var policyPort = 0; - if(policyUrl === null && options.policyPort !== 0) { - policyPort = options.policyPort || sp.policyPort; - } - api.connect(id, options.host, options.port, policyPort, policyUrl); - }; - - /** - * Closes this socket. - */ - socket.close = function() { - api.close(id); - socket.closed({ - id: socket.id, - type: 'close', - bytesAvailable: 0 - }); - }; - - /** - * Determines if the socket is connected or not. - * - * @return true if connected, false if not. - */ - socket.isConnected = function() { - return api.isConnected(id); - }; - - /** - * Writes bytes to this socket. - * - * @param bytes the bytes (as a string) to write. - * - * @return true on success, false on failure. - */ - socket.send = function(bytes) { - return api.send(id, forge.util.encode64(bytes)); - }; - - /** - * Reads bytes from this socket (non-blocking). Fewer than the number - * of bytes requested may be read if enough bytes are not available. - * - * This method should be called from the data handler if there are - * enough bytes available. To see how many bytes are available, check - * the 'bytesAvailable' property on the event in the data handler or - * call the bytesAvailable() function on the socket. If the browser is - * msie, then the bytesAvailable() function should be used to avoid - * race conditions. Otherwise, using the property on the data handler's - * event may be quicker. - * - * @param count the maximum number of bytes to read. - * - * @return the bytes read (as a string) or null on error. - */ - socket.receive = function(count) { - var rval = api.receive(id, count).rval; - return (rval === null) ? null : forge.util.decode64(rval); - }; - - /** - * Gets the number of bytes available for receiving on the socket. - * - * @return the number of bytes available for receiving. - */ - socket.bytesAvailable = function() { - return api.getBytesAvailable(id); - }; - - // store and return socket - sp.sockets[id] = socket; - return socket; - }; - - return sp; -}; - -/** - * Destroys a flash socket pool. - * - * @param options: - * flashId: the dom ID for the flash object element. - */ -net.destroySocketPool = function(options) { - if(options.flashId in net.socketPools) { - var sp = net.socketPools[options.flashId]; - sp.destroy(); - } -}; - -/** - * Creates a new socket. - * - * @param options: - * flashId: the dom ID for the flash object element. - * connected: function(event) called when the socket connects. - * closed: function(event) called when the socket closes. - * data: function(event) called when socket data has arrived, it - * can be read from the socket using receive(). - * error: function(event) called when a socket error occurs. - * - * @return the created socket. - */ -net.createSocket = function(options) { - var socket = null; - if(options.flashId in net.socketPools) { - // get related socket pool - var sp = net.socketPools[options.flashId]; - socket = sp.createSocket(options); - } - return socket; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/ssh.js b/reverse_engineering/node_modules/node-forge/lib/ssh.js deleted file mode 100644 index 6480203a..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/ssh.js +++ /dev/null @@ -1,236 +0,0 @@ -/** - * Functions to output keys in SSH-friendly formats. - * - * This is part of the Forge project which may be used under the terms of - * either the BSD License or the GNU General Public License (GPL) Version 2. - * - * See: https://github.com/digitalbazaar/forge/blob/cbebca3780658703d925b61b2caffb1d263a6c1d/LICENSE - * - * @author https://github.com/shellac - */ -var forge = require('./forge'); -require('./aes'); -require('./hmac'); -require('./md5'); -require('./sha1'); -require('./util'); - -var ssh = module.exports = forge.ssh = forge.ssh || {}; - -/** - * Encodes (and optionally encrypts) a private RSA key as a Putty PPK file. - * - * @param privateKey the key. - * @param passphrase a passphrase to protect the key (falsy for no encryption). - * @param comment a comment to include in the key file. - * - * @return the PPK file as a string. - */ -ssh.privateKeyToPutty = function(privateKey, passphrase, comment) { - comment = comment || ''; - passphrase = passphrase || ''; - var algorithm = 'ssh-rsa'; - var encryptionAlgorithm = (passphrase === '') ? 'none' : 'aes256-cbc'; - - var ppk = 'PuTTY-User-Key-File-2: ' + algorithm + '\r\n'; - ppk += 'Encryption: ' + encryptionAlgorithm + '\r\n'; - ppk += 'Comment: ' + comment + '\r\n'; - - // public key into buffer for ppk - var pubbuffer = forge.util.createBuffer(); - _addStringToBuffer(pubbuffer, algorithm); - _addBigIntegerToBuffer(pubbuffer, privateKey.e); - _addBigIntegerToBuffer(pubbuffer, privateKey.n); - - // write public key - var pub = forge.util.encode64(pubbuffer.bytes(), 64); - var length = Math.floor(pub.length / 66) + 1; // 66 = 64 + \r\n - ppk += 'Public-Lines: ' + length + '\r\n'; - ppk += pub; - - // private key into a buffer - var privbuffer = forge.util.createBuffer(); - _addBigIntegerToBuffer(privbuffer, privateKey.d); - _addBigIntegerToBuffer(privbuffer, privateKey.p); - _addBigIntegerToBuffer(privbuffer, privateKey.q); - _addBigIntegerToBuffer(privbuffer, privateKey.qInv); - - // optionally encrypt the private key - var priv; - if(!passphrase) { - // use the unencrypted buffer - priv = forge.util.encode64(privbuffer.bytes(), 64); - } else { - // encrypt RSA key using passphrase - var encLen = privbuffer.length() + 16 - 1; - encLen -= encLen % 16; - - // pad private key with sha1-d data -- needs to be a multiple of 16 - var padding = _sha1(privbuffer.bytes()); - - padding.truncate(padding.length() - encLen + privbuffer.length()); - privbuffer.putBuffer(padding); - - var aeskey = forge.util.createBuffer(); - aeskey.putBuffer(_sha1('\x00\x00\x00\x00', passphrase)); - aeskey.putBuffer(_sha1('\x00\x00\x00\x01', passphrase)); - - // encrypt some bytes using CBC mode - // key is 40 bytes, so truncate *by* 8 bytes - var cipher = forge.aes.createEncryptionCipher(aeskey.truncate(8), 'CBC'); - cipher.start(forge.util.createBuffer().fillWithByte(0, 16)); - cipher.update(privbuffer.copy()); - cipher.finish(); - var encrypted = cipher.output; - - // Note: this appears to differ from Putty -- is forge wrong, or putty? - // due to padding we finish as an exact multiple of 16 - encrypted.truncate(16); // all padding - - priv = forge.util.encode64(encrypted.bytes(), 64); - } - - // output private key - length = Math.floor(priv.length / 66) + 1; // 64 + \r\n - ppk += '\r\nPrivate-Lines: ' + length + '\r\n'; - ppk += priv; - - // MAC - var mackey = _sha1('putty-private-key-file-mac-key', passphrase); - - var macbuffer = forge.util.createBuffer(); - _addStringToBuffer(macbuffer, algorithm); - _addStringToBuffer(macbuffer, encryptionAlgorithm); - _addStringToBuffer(macbuffer, comment); - macbuffer.putInt32(pubbuffer.length()); - macbuffer.putBuffer(pubbuffer); - macbuffer.putInt32(privbuffer.length()); - macbuffer.putBuffer(privbuffer); - - var hmac = forge.hmac.create(); - hmac.start('sha1', mackey); - hmac.update(macbuffer.bytes()); - - ppk += '\r\nPrivate-MAC: ' + hmac.digest().toHex() + '\r\n'; - - return ppk; -}; - -/** - * Encodes a public RSA key as an OpenSSH file. - * - * @param key the key. - * @param comment a comment. - * - * @return the public key in OpenSSH format. - */ -ssh.publicKeyToOpenSSH = function(key, comment) { - var type = 'ssh-rsa'; - comment = comment || ''; - - var buffer = forge.util.createBuffer(); - _addStringToBuffer(buffer, type); - _addBigIntegerToBuffer(buffer, key.e); - _addBigIntegerToBuffer(buffer, key.n); - - return type + ' ' + forge.util.encode64(buffer.bytes()) + ' ' + comment; -}; - -/** - * Encodes a private RSA key as an OpenSSH file. - * - * @param key the key. - * @param passphrase a passphrase to protect the key (falsy for no encryption). - * - * @return the public key in OpenSSH format. - */ -ssh.privateKeyToOpenSSH = function(privateKey, passphrase) { - if(!passphrase) { - return forge.pki.privateKeyToPem(privateKey); - } - // OpenSSH private key is just a legacy format, it seems - return forge.pki.encryptRsaPrivateKey(privateKey, passphrase, - {legacy: true, algorithm: 'aes128'}); -}; - -/** - * Gets the SSH fingerprint for the given public key. - * - * @param options the options to use. - * [md] the message digest object to use (defaults to forge.md.md5). - * [encoding] an alternative output encoding, such as 'hex' - * (defaults to none, outputs a byte buffer). - * [delimiter] the delimiter to use between bytes for 'hex' encoded - * output, eg: ':' (defaults to none). - * - * @return the fingerprint as a byte buffer or other encoding based on options. - */ -ssh.getPublicKeyFingerprint = function(key, options) { - options = options || {}; - var md = options.md || forge.md.md5.create(); - - var type = 'ssh-rsa'; - var buffer = forge.util.createBuffer(); - _addStringToBuffer(buffer, type); - _addBigIntegerToBuffer(buffer, key.e); - _addBigIntegerToBuffer(buffer, key.n); - - // hash public key bytes - md.start(); - md.update(buffer.getBytes()); - var digest = md.digest(); - if(options.encoding === 'hex') { - var hex = digest.toHex(); - if(options.delimiter) { - return hex.match(/.{2}/g).join(options.delimiter); - } - return hex; - } else if(options.encoding === 'binary') { - return digest.getBytes(); - } else if(options.encoding) { - throw new Error('Unknown encoding "' + options.encoding + '".'); - } - return digest; -}; - -/** - * Adds len(val) then val to a buffer. - * - * @param buffer the buffer to add to. - * @param val a big integer. - */ -function _addBigIntegerToBuffer(buffer, val) { - var hexVal = val.toString(16); - // ensure 2s complement +ve - if(hexVal[0] >= '8') { - hexVal = '00' + hexVal; - } - var bytes = forge.util.hexToBytes(hexVal); - buffer.putInt32(bytes.length); - buffer.putBytes(bytes); -} - -/** - * Adds len(val) then val to a buffer. - * - * @param buffer the buffer to add to. - * @param val a string. - */ -function _addStringToBuffer(buffer, val) { - buffer.putInt32(val.length); - buffer.putString(val); -} - -/** - * Hashes the arguments into one value using SHA-1. - * - * @return the sha1 hash of the provided arguments. - */ -function _sha1() { - var sha = forge.md.sha1.create(); - var num = arguments.length; - for (var i = 0; i < num; ++i) { - sha.update(arguments[i]); - } - return sha.digest(); -} diff --git a/reverse_engineering/node_modules/node-forge/lib/task.js b/reverse_engineering/node_modules/node-forge/lib/task.js deleted file mode 100644 index df486600..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/task.js +++ /dev/null @@ -1,725 +0,0 @@ -/** - * Support for concurrent task management and synchronization in web - * applications. - * - * @author Dave Longley - * @author David I. Lehn - * - * Copyright (c) 2009-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./debug'); -require('./log'); -require('./util'); - -// logging category -var cat = 'forge.task'; - -// verbose level -// 0: off, 1: a little, 2: a whole lot -// Verbose debug logging is surrounded by a level check to avoid the -// performance issues with even calling the logging code regardless if it -// is actually logged. For performance reasons this should not be set to 2 -// for production use. -// ex: if(sVL >= 2) forge.log.verbose(....) -var sVL = 0; - -// track tasks for debugging -var sTasks = {}; -var sNextTaskId = 0; -// debug access -forge.debug.set(cat, 'tasks', sTasks); - -// a map of task type to task queue -var sTaskQueues = {}; -// debug access -forge.debug.set(cat, 'queues', sTaskQueues); - -// name for unnamed tasks -var sNoTaskName = '?'; - -// maximum number of doNext() recursions before a context swap occurs -// FIXME: might need to tweak this based on the browser -var sMaxRecursions = 30; - -// time slice for doing tasks before a context swap occurs -// FIXME: might need to tweak this based on the browser -var sTimeSlice = 20; - -/** - * Task states. - * - * READY: ready to start processing - * RUNNING: task or a subtask is running - * BLOCKED: task is waiting to acquire N permits to continue - * SLEEPING: task is sleeping for a period of time - * DONE: task is done - * ERROR: task has an error - */ -var READY = 'ready'; -var RUNNING = 'running'; -var BLOCKED = 'blocked'; -var SLEEPING = 'sleeping'; -var DONE = 'done'; -var ERROR = 'error'; - -/** - * Task actions. Used to control state transitions. - * - * STOP: stop processing - * START: start processing tasks - * BLOCK: block task from continuing until 1 or more permits are released - * UNBLOCK: release one or more permits - * SLEEP: sleep for a period of time - * WAKEUP: wakeup early from SLEEPING state - * CANCEL: cancel further tasks - * FAIL: a failure occured - */ -var STOP = 'stop'; -var START = 'start'; -var BLOCK = 'block'; -var UNBLOCK = 'unblock'; -var SLEEP = 'sleep'; -var WAKEUP = 'wakeup'; -var CANCEL = 'cancel'; -var FAIL = 'fail'; - -/** - * State transition table. - * - * nextState = sStateTable[currentState][action] - */ -var sStateTable = {}; - -sStateTable[READY] = {}; -sStateTable[READY][STOP] = READY; -sStateTable[READY][START] = RUNNING; -sStateTable[READY][CANCEL] = DONE; -sStateTable[READY][FAIL] = ERROR; - -sStateTable[RUNNING] = {}; -sStateTable[RUNNING][STOP] = READY; -sStateTable[RUNNING][START] = RUNNING; -sStateTable[RUNNING][BLOCK] = BLOCKED; -sStateTable[RUNNING][UNBLOCK] = RUNNING; -sStateTable[RUNNING][SLEEP] = SLEEPING; -sStateTable[RUNNING][WAKEUP] = RUNNING; -sStateTable[RUNNING][CANCEL] = DONE; -sStateTable[RUNNING][FAIL] = ERROR; - -sStateTable[BLOCKED] = {}; -sStateTable[BLOCKED][STOP] = BLOCKED; -sStateTable[BLOCKED][START] = BLOCKED; -sStateTable[BLOCKED][BLOCK] = BLOCKED; -sStateTable[BLOCKED][UNBLOCK] = BLOCKED; -sStateTable[BLOCKED][SLEEP] = BLOCKED; -sStateTable[BLOCKED][WAKEUP] = BLOCKED; -sStateTable[BLOCKED][CANCEL] = DONE; -sStateTable[BLOCKED][FAIL] = ERROR; - -sStateTable[SLEEPING] = {}; -sStateTable[SLEEPING][STOP] = SLEEPING; -sStateTable[SLEEPING][START] = SLEEPING; -sStateTable[SLEEPING][BLOCK] = SLEEPING; -sStateTable[SLEEPING][UNBLOCK] = SLEEPING; -sStateTable[SLEEPING][SLEEP] = SLEEPING; -sStateTable[SLEEPING][WAKEUP] = SLEEPING; -sStateTable[SLEEPING][CANCEL] = DONE; -sStateTable[SLEEPING][FAIL] = ERROR; - -sStateTable[DONE] = {}; -sStateTable[DONE][STOP] = DONE; -sStateTable[DONE][START] = DONE; -sStateTable[DONE][BLOCK] = DONE; -sStateTable[DONE][UNBLOCK] = DONE; -sStateTable[DONE][SLEEP] = DONE; -sStateTable[DONE][WAKEUP] = DONE; -sStateTable[DONE][CANCEL] = DONE; -sStateTable[DONE][FAIL] = ERROR; - -sStateTable[ERROR] = {}; -sStateTable[ERROR][STOP] = ERROR; -sStateTable[ERROR][START] = ERROR; -sStateTable[ERROR][BLOCK] = ERROR; -sStateTable[ERROR][UNBLOCK] = ERROR; -sStateTable[ERROR][SLEEP] = ERROR; -sStateTable[ERROR][WAKEUP] = ERROR; -sStateTable[ERROR][CANCEL] = ERROR; -sStateTable[ERROR][FAIL] = ERROR; - -/** - * Creates a new task. - * - * @param options options for this task - * run: the run function for the task (required) - * name: the run function for the task (optional) - * parent: parent of this task (optional) - * - * @return the empty task. - */ -var Task = function(options) { - // task id - this.id = -1; - - // task name - this.name = options.name || sNoTaskName; - - // task has no parent - this.parent = options.parent || null; - - // save run function - this.run = options.run; - - // create a queue of subtasks to run - this.subtasks = []; - - // error flag - this.error = false; - - // state of the task - this.state = READY; - - // number of times the task has been blocked (also the number - // of permits needed to be released to continue running) - this.blocks = 0; - - // timeout id when sleeping - this.timeoutId = null; - - // no swap time yet - this.swapTime = null; - - // no user data - this.userData = null; - - // initialize task - // FIXME: deal with overflow - this.id = sNextTaskId++; - sTasks[this.id] = this; - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] init', this.id, this.name, this); - } -}; - -/** - * Logs debug information on this task and the system state. - */ -Task.prototype.debug = function(msg) { - msg = msg || ''; - forge.log.debug(cat, msg, - '[%s][%s] task:', this.id, this.name, this, - 'subtasks:', this.subtasks.length, - 'queue:', sTaskQueues); -}; - -/** - * Adds a subtask to run after task.doNext() or task.fail() is called. - * - * @param name human readable name for this task (optional). - * @param subrun a function to run that takes the current task as - * its first parameter. - * - * @return the current task (useful for chaining next() calls). - */ -Task.prototype.next = function(name, subrun) { - // juggle parameters if it looks like no name is given - if(typeof(name) === 'function') { - subrun = name; - - // inherit parent's name - name = this.name; - } - // create subtask, set parent to this task, propagate callbacks - var subtask = new Task({ - run: subrun, - name: name, - parent: this - }); - // start subtasks running - subtask.state = RUNNING; - subtask.type = this.type; - subtask.successCallback = this.successCallback || null; - subtask.failureCallback = this.failureCallback || null; - - // queue a new subtask - this.subtasks.push(subtask); - - return this; -}; - -/** - * Adds subtasks to run in parallel after task.doNext() or task.fail() - * is called. - * - * @param name human readable name for this task (optional). - * @param subrun functions to run that take the current task as - * their first parameter. - * - * @return the current task (useful for chaining next() calls). - */ -Task.prototype.parallel = function(name, subrun) { - // juggle parameters if it looks like no name is given - if(forge.util.isArray(name)) { - subrun = name; - - // inherit parent's name - name = this.name; - } - // Wrap parallel tasks in a regular task so they are started at the - // proper time. - return this.next(name, function(task) { - // block waiting for subtasks - var ptask = task; - ptask.block(subrun.length); - - // we pass the iterator from the loop below as a parameter - // to a function because it is otherwise included in the - // closure and changes as the loop changes -- causing i - // to always be set to its highest value - var startParallelTask = function(pname, pi) { - forge.task.start({ - type: pname, - run: function(task) { - subrun[pi](task); - }, - success: function(task) { - ptask.unblock(); - }, - failure: function(task) { - ptask.unblock(); - } - }); - }; - - for(var i = 0; i < subrun.length; i++) { - // Type must be unique so task starts in parallel: - // name + private string + task id + sub-task index - // start tasks in parallel and unblock when the finish - var pname = name + '__parallel-' + task.id + '-' + i; - var pi = i; - startParallelTask(pname, pi); - } - }); -}; - -/** - * Stops a running task. - */ -Task.prototype.stop = function() { - this.state = sStateTable[this.state][STOP]; -}; - -/** - * Starts running a task. - */ -Task.prototype.start = function() { - this.error = false; - this.state = sStateTable[this.state][START]; - - // try to restart - if(this.state === RUNNING) { - this.start = new Date(); - this.run(this); - runNext(this, 0); - } -}; - -/** - * Blocks a task until it one or more permits have been released. The - * task will not resume until the requested number of permits have - * been released with call(s) to unblock(). - * - * @param n number of permits to wait for(default: 1). - */ -Task.prototype.block = function(n) { - n = typeof(n) === 'undefined' ? 1 : n; - this.blocks += n; - if(this.blocks > 0) { - this.state = sStateTable[this.state][BLOCK]; - } -}; - -/** - * Releases a permit to unblock a task. If a task was blocked by - * requesting N permits via block(), then it will only continue - * running once enough permits have been released via unblock() calls. - * - * If multiple processes need to synchronize with a single task then - * use a condition variable (see forge.task.createCondition). It is - * an error to unblock a task more times than it has been blocked. - * - * @param n number of permits to release (default: 1). - * - * @return the current block count (task is unblocked when count is 0) - */ -Task.prototype.unblock = function(n) { - n = typeof(n) === 'undefined' ? 1 : n; - this.blocks -= n; - if(this.blocks === 0 && this.state !== DONE) { - this.state = RUNNING; - runNext(this, 0); - } - return this.blocks; -}; - -/** - * Sleep for a period of time before resuming tasks. - * - * @param n number of milliseconds to sleep (default: 0). - */ -Task.prototype.sleep = function(n) { - n = typeof(n) === 'undefined' ? 0 : n; - this.state = sStateTable[this.state][SLEEP]; - var self = this; - this.timeoutId = setTimeout(function() { - self.timeoutId = null; - self.state = RUNNING; - runNext(self, 0); - }, n); -}; - -/** - * Waits on a condition variable until notified. The next task will - * not be scheduled until notification. A condition variable can be - * created with forge.task.createCondition(). - * - * Once cond.notify() is called, the task will continue. - * - * @param cond the condition variable to wait on. - */ -Task.prototype.wait = function(cond) { - cond.wait(this); -}; - -/** - * If sleeping, wakeup and continue running tasks. - */ -Task.prototype.wakeup = function() { - if(this.state === SLEEPING) { - cancelTimeout(this.timeoutId); - this.timeoutId = null; - this.state = RUNNING; - runNext(this, 0); - } -}; - -/** - * Cancel all remaining subtasks of this task. - */ -Task.prototype.cancel = function() { - this.state = sStateTable[this.state][CANCEL]; - // remove permits needed - this.permitsNeeded = 0; - // cancel timeouts - if(this.timeoutId !== null) { - cancelTimeout(this.timeoutId); - this.timeoutId = null; - } - // remove subtasks - this.subtasks = []; -}; - -/** - * Finishes this task with failure and sets error flag. The entire - * task will be aborted unless the next task that should execute - * is passed as a parameter. This allows levels of subtasks to be - * skipped. For instance, to abort only this tasks's subtasks, then - * call fail(task.parent). To abort this task's subtasks and its - * parent's subtasks, call fail(task.parent.parent). To abort - * all tasks and simply call the task callback, call fail() or - * fail(null). - * - * The task callback (success or failure) will always, eventually, be - * called. - * - * @param next the task to continue at, or null to abort entirely. - */ -Task.prototype.fail = function(next) { - // set error flag - this.error = true; - - // finish task - finish(this, true); - - if(next) { - // propagate task info - next.error = this.error; - next.swapTime = this.swapTime; - next.userData = this.userData; - - // do next task as specified - runNext(next, 0); - } else { - if(this.parent !== null) { - // finish root task (ensures it is removed from task queue) - var parent = this.parent; - while(parent.parent !== null) { - // propagate task info - parent.error = this.error; - parent.swapTime = this.swapTime; - parent.userData = this.userData; - parent = parent.parent; - } - finish(parent, true); - } - - // call failure callback if one exists - if(this.failureCallback) { - this.failureCallback(this); - } - } -}; - -/** - * Asynchronously start a task. - * - * @param task the task to start. - */ -var start = function(task) { - task.error = false; - task.state = sStateTable[task.state][START]; - setTimeout(function() { - if(task.state === RUNNING) { - task.swapTime = +new Date(); - task.run(task); - runNext(task, 0); - } - }, 0); -}; - -/** - * Run the next subtask or finish this task. - * - * @param task the task to process. - * @param recurse the recursion count. - */ -var runNext = function(task, recurse) { - // get time since last context swap (ms), if enough time has passed set - // swap to true to indicate that doNext was performed asynchronously - // also, if recurse is too high do asynchronously - var swap = - (recurse > sMaxRecursions) || - (+new Date() - task.swapTime) > sTimeSlice; - - var doNext = function(recurse) { - recurse++; - if(task.state === RUNNING) { - if(swap) { - // update swap time - task.swapTime = +new Date(); - } - - if(task.subtasks.length > 0) { - // run next subtask - var subtask = task.subtasks.shift(); - subtask.error = task.error; - subtask.swapTime = task.swapTime; - subtask.userData = task.userData; - subtask.run(subtask); - if(!subtask.error) { - runNext(subtask, recurse); - } - } else { - finish(task); - - if(!task.error) { - // chain back up and run parent - if(task.parent !== null) { - // propagate task info - task.parent.error = task.error; - task.parent.swapTime = task.swapTime; - task.parent.userData = task.userData; - - // no subtasks left, call run next subtask on parent - runNext(task.parent, recurse); - } - } - } - } - }; - - if(swap) { - // we're swapping, so run asynchronously - setTimeout(doNext, 0); - } else { - // not swapping, so run synchronously - doNext(recurse); - } -}; - -/** - * Finishes a task and looks for the next task in the queue to start. - * - * @param task the task to finish. - * @param suppressCallbacks true to suppress callbacks. - */ -var finish = function(task, suppressCallbacks) { - // subtask is now done - task.state = DONE; - - delete sTasks[task.id]; - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] finish', - task.id, task.name, task); - } - - // only do queue processing for root tasks - if(task.parent === null) { - // report error if queue is missing - if(!(task.type in sTaskQueues)) { - forge.log.error(cat, - '[%s][%s] task queue missing [%s]', - task.id, task.name, task.type); - } else if(sTaskQueues[task.type].length === 0) { - // report error if queue is empty - forge.log.error(cat, - '[%s][%s] task queue empty [%s]', - task.id, task.name, task.type); - } else if(sTaskQueues[task.type][0] !== task) { - // report error if this task isn't the first in the queue - forge.log.error(cat, - '[%s][%s] task not first in queue [%s]', - task.id, task.name, task.type); - } else { - // remove ourselves from the queue - sTaskQueues[task.type].shift(); - // clean up queue if it is empty - if(sTaskQueues[task.type].length === 0) { - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] delete queue [%s]', - task.id, task.name, task.type); - } - /* Note: Only a task can delete a queue of its own type. This - is used as a way to synchronize tasks. If a queue for a certain - task type exists, then a task of that type is running. - */ - delete sTaskQueues[task.type]; - } else { - // dequeue the next task and start it - if(sVL >= 1) { - forge.log.verbose(cat, - '[%s][%s] queue start next [%s] remain:%s', - task.id, task.name, task.type, - sTaskQueues[task.type].length); - } - sTaskQueues[task.type][0].start(); - } - } - - if(!suppressCallbacks) { - // call final callback if one exists - if(task.error && task.failureCallback) { - task.failureCallback(task); - } else if(!task.error && task.successCallback) { - task.successCallback(task); - } - } - } -}; - -/* Tasks API */ -module.exports = forge.task = forge.task || {}; - -/** - * Starts a new task that will run the passed function asynchronously. - * - * In order to finish the task, either task.doNext() or task.fail() - * *must* be called. - * - * The task must have a type (a string identifier) that can be used to - * synchronize it with other tasks of the same type. That type can also - * be used to cancel tasks that haven't started yet. - * - * To start a task, the following object must be provided as a parameter - * (each function takes a task object as its first parameter): - * - * { - * type: the type of task. - * run: the function to run to execute the task. - * success: a callback to call when the task succeeds (optional). - * failure: a callback to call when the task fails (optional). - * } - * - * @param options the object as described above. - */ -forge.task.start = function(options) { - // create a new task - var task = new Task({ - run: options.run, - name: options.name || sNoTaskName - }); - task.type = options.type; - task.successCallback = options.success || null; - task.failureCallback = options.failure || null; - - // append the task onto the appropriate queue - if(!(task.type in sTaskQueues)) { - if(sVL >= 1) { - forge.log.verbose(cat, '[%s][%s] create queue [%s]', - task.id, task.name, task.type); - } - // create the queue with the new task - sTaskQueues[task.type] = [task]; - start(task); - } else { - // push the task onto the queue, it will be run after a task - // with the same type completes - sTaskQueues[options.type].push(task); - } -}; - -/** - * Cancels all tasks of the given type that haven't started yet. - * - * @param type the type of task to cancel. - */ -forge.task.cancel = function(type) { - // find the task queue - if(type in sTaskQueues) { - // empty all but the current task from the queue - sTaskQueues[type] = [sTaskQueues[type][0]]; - } -}; - -/** - * Creates a condition variable to synchronize tasks. To make a task wait - * on the condition variable, call task.wait(condition). To notify all - * tasks that are waiting, call condition.notify(). - * - * @return the condition variable. - */ -forge.task.createCondition = function() { - var cond = { - // all tasks that are blocked - tasks: {} - }; - - /** - * Causes the given task to block until notify is called. If the task - * is already waiting on this condition then this is a no-op. - * - * @param task the task to cause to wait. - */ - cond.wait = function(task) { - // only block once - if(!(task.id in cond.tasks)) { - task.block(); - cond.tasks[task.id] = task; - } - }; - - /** - * Notifies all waiting tasks to wake up. - */ - cond.notify = function() { - // since unblock() will run the next task from here, make sure to - // clear the condition's blocked task list before unblocking - var tmp = cond.tasks; - cond.tasks = {}; - for(var id in tmp) { - tmp[id].unblock(); - } - }; - - return cond; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/tls.js b/reverse_engineering/node_modules/node-forge/lib/tls.js deleted file mode 100644 index fadfd646..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/tls.js +++ /dev/null @@ -1,4282 +0,0 @@ -/** - * A Javascript implementation of Transport Layer Security (TLS). - * - * @author Dave Longley - * - * Copyright (c) 2009-2014 Digital Bazaar, Inc. - * - * The TLS Handshake Protocol involves the following steps: - * - * - Exchange hello messages to agree on algorithms, exchange random values, - * and check for session resumption. - * - * - Exchange the necessary cryptographic parameters to allow the client and - * server to agree on a premaster secret. - * - * - Exchange certificates and cryptographic information to allow the client - * and server to authenticate themselves. - * - * - Generate a master secret from the premaster secret and exchanged random - * values. - * - * - Provide security parameters to the record layer. - * - * - Allow the client and server to verify that their peer has calculated the - * same security parameters and that the handshake occurred without tampering - * by an attacker. - * - * Up to 4 different messages may be sent during a key exchange. The server - * certificate, the server key exchange, the client certificate, and the - * client key exchange. - * - * A typical handshake (from the client's perspective). - * - * 1. Client sends ClientHello. - * 2. Client receives ServerHello. - * 3. Client receives optional Certificate. - * 4. Client receives optional ServerKeyExchange. - * 5. Client receives ServerHelloDone. - * 6. Client sends optional Certificate. - * 7. Client sends ClientKeyExchange. - * 8. Client sends optional CertificateVerify. - * 9. Client sends ChangeCipherSpec. - * 10. Client sends Finished. - * 11. Client receives ChangeCipherSpec. - * 12. Client receives Finished. - * 13. Client sends/receives application data. - * - * To reuse an existing session: - * - * 1. Client sends ClientHello with session ID for reuse. - * 2. Client receives ServerHello with same session ID if reusing. - * 3. Client receives ChangeCipherSpec message if reusing. - * 4. Client receives Finished. - * 5. Client sends ChangeCipherSpec. - * 6. Client sends Finished. - * - * Note: Client ignores HelloRequest if in the middle of a handshake. - * - * Record Layer: - * - * The record layer fragments information blocks into TLSPlaintext records - * carrying data in chunks of 2^14 bytes or less. Client message boundaries are - * not preserved in the record layer (i.e., multiple client messages of the - * same ContentType MAY be coalesced into a single TLSPlaintext record, or a - * single message MAY be fragmented across several records). - * - * struct { - * uint8 major; - * uint8 minor; - * } ProtocolVersion; - * - * struct { - * ContentType type; - * ProtocolVersion version; - * uint16 length; - * opaque fragment[TLSPlaintext.length]; - * } TLSPlaintext; - * - * type: - * The higher-level protocol used to process the enclosed fragment. - * - * version: - * The version of the protocol being employed. TLS Version 1.2 uses version - * {3, 3}. TLS Version 1.0 uses version {3, 1}. Note that a client that - * supports multiple versions of TLS may not know what version will be - * employed before it receives the ServerHello. - * - * length: - * The length (in bytes) of the following TLSPlaintext.fragment. The length - * MUST NOT exceed 2^14 = 16384 bytes. - * - * fragment: - * The application data. This data is transparent and treated as an - * independent block to be dealt with by the higher-level protocol specified - * by the type field. - * - * Implementations MUST NOT send zero-length fragments of Handshake, Alert, or - * ChangeCipherSpec content types. Zero-length fragments of Application data - * MAY be sent as they are potentially useful as a traffic analysis - * countermeasure. - * - * Note: Data of different TLS record layer content types MAY be interleaved. - * Application data is generally of lower precedence for transmission than - * other content types. However, records MUST be delivered to the network in - * the same order as they are protected by the record layer. Recipients MUST - * receive and process interleaved application layer traffic during handshakes - * subsequent to the first one on a connection. - * - * struct { - * ContentType type; // same as TLSPlaintext.type - * ProtocolVersion version;// same as TLSPlaintext.version - * uint16 length; - * opaque fragment[TLSCompressed.length]; - * } TLSCompressed; - * - * length: - * The length (in bytes) of the following TLSCompressed.fragment. - * The length MUST NOT exceed 2^14 + 1024. - * - * fragment: - * The compressed form of TLSPlaintext.fragment. - * - * Note: A CompressionMethod.null operation is an identity operation; no fields - * are altered. In this implementation, since no compression is supported, - * uncompressed records are always the same as compressed records. - * - * Encryption Information: - * - * The encryption and MAC functions translate a TLSCompressed structure into a - * TLSCiphertext. The decryption functions reverse the process. The MAC of the - * record also includes a sequence number so that missing, extra, or repeated - * messages are detectable. - * - * struct { - * ContentType type; - * ProtocolVersion version; - * uint16 length; - * select (SecurityParameters.cipher_type) { - * case stream: GenericStreamCipher; - * case block: GenericBlockCipher; - * case aead: GenericAEADCipher; - * } fragment; - * } TLSCiphertext; - * - * type: - * The type field is identical to TLSCompressed.type. - * - * version: - * The version field is identical to TLSCompressed.version. - * - * length: - * The length (in bytes) of the following TLSCiphertext.fragment. - * The length MUST NOT exceed 2^14 + 2048. - * - * fragment: - * The encrypted form of TLSCompressed.fragment, with the MAC. - * - * Note: Only CBC Block Ciphers are supported by this implementation. - * - * The TLSCompressed.fragment structures are converted to/from block - * TLSCiphertext.fragment structures. - * - * struct { - * opaque IV[SecurityParameters.record_iv_length]; - * block-ciphered struct { - * opaque content[TLSCompressed.length]; - * opaque MAC[SecurityParameters.mac_length]; - * uint8 padding[GenericBlockCipher.padding_length]; - * uint8 padding_length; - * }; - * } GenericBlockCipher; - * - * The MAC is generated as described in Section 6.2.3.1. - * - * IV: - * The Initialization Vector (IV) SHOULD be chosen at random, and MUST be - * unpredictable. Note that in versions of TLS prior to 1.1, there was no - * IV field, and the last ciphertext block of the previous record (the "CBC - * residue") was used as the IV. This was changed to prevent the attacks - * described in [CBCATT]. For block ciphers, the IV length is of length - * SecurityParameters.record_iv_length, which is equal to the - * SecurityParameters.block_size. - * - * padding: - * Padding that is added to force the length of the plaintext to be an - * integral multiple of the block cipher's block length. The padding MAY be - * any length up to 255 bytes, as long as it results in the - * TLSCiphertext.length being an integral multiple of the block length. - * Lengths longer than necessary might be desirable to frustrate attacks on - * a protocol that are based on analysis of the lengths of exchanged - * messages. Each uint8 in the padding data vector MUST be filled with the - * padding length value. The receiver MUST check this padding and MUST use - * the bad_record_mac alert to indicate padding errors. - * - * padding_length: - * The padding length MUST be such that the total size of the - * GenericBlockCipher structure is a multiple of the cipher's block length. - * Legal values range from zero to 255, inclusive. This length specifies the - * length of the padding field exclusive of the padding_length field itself. - * - * The encrypted data length (TLSCiphertext.length) is one more than the sum of - * SecurityParameters.block_length, TLSCompressed.length, - * SecurityParameters.mac_length, and padding_length. - * - * Example: If the block length is 8 bytes, the content length - * (TLSCompressed.length) is 61 bytes, and the MAC length is 20 bytes, then the - * length before padding is 82 bytes (this does not include the IV. Thus, the - * padding length modulo 8 must be equal to 6 in order to make the total length - * an even multiple of 8 bytes (the block length). The padding length can be - * 6, 14, 22, and so on, through 254. If the padding length were the minimum - * necessary, 6, the padding would be 6 bytes, each containing the value 6. - * Thus, the last 8 octets of the GenericBlockCipher before block encryption - * would be xx 06 06 06 06 06 06 06, where xx is the last octet of the MAC. - * - * Note: With block ciphers in CBC mode (Cipher Block Chaining), it is critical - * that the entire plaintext of the record be known before any ciphertext is - * transmitted. Otherwise, it is possible for the attacker to mount the attack - * described in [CBCATT]. - * - * Implementation note: Canvel et al. [CBCTIME] have demonstrated a timing - * attack on CBC padding based on the time required to compute the MAC. In - * order to defend against this attack, implementations MUST ensure that - * record processing time is essentially the same whether or not the padding - * is correct. In general, the best way to do this is to compute the MAC even - * if the padding is incorrect, and only then reject the packet. For instance, - * if the pad appears to be incorrect, the implementation might assume a - * zero-length pad and then compute the MAC. This leaves a small timing - * channel, since MAC performance depends, to some extent, on the size of the - * data fragment, but it is not believed to be large enough to be exploitable, - * due to the large block size of existing MACs and the small size of the - * timing signal. - */ -var forge = require('./forge'); -require('./asn1'); -require('./hmac'); -require('./md5'); -require('./pem'); -require('./pki'); -require('./random'); -require('./sha1'); -require('./util'); - -/** - * Generates pseudo random bytes by mixing the result of two hash functions, - * MD5 and SHA-1. - * - * prf_TLS1(secret, label, seed) = - * P_MD5(S1, label + seed) XOR P_SHA-1(S2, label + seed); - * - * Each P_hash function functions as follows: - * - * P_hash(secret, seed) = HMAC_hash(secret, A(1) + seed) + - * HMAC_hash(secret, A(2) + seed) + - * HMAC_hash(secret, A(3) + seed) + ... - * A() is defined as: - * A(0) = seed - * A(i) = HMAC_hash(secret, A(i-1)) - * - * The '+' operator denotes concatenation. - * - * As many iterations A(N) as are needed are performed to generate enough - * pseudo random byte output. If an iteration creates more data than is - * necessary, then it is truncated. - * - * Therefore: - * A(1) = HMAC_hash(secret, A(0)) - * = HMAC_hash(secret, seed) - * A(2) = HMAC_hash(secret, A(1)) - * = HMAC_hash(secret, HMAC_hash(secret, seed)) - * - * Therefore: - * P_hash(secret, seed) = - * HMAC_hash(secret, HMAC_hash(secret, A(0)) + seed) + - * HMAC_hash(secret, HMAC_hash(secret, A(1)) + seed) + - * ... - * - * Therefore: - * P_hash(secret, seed) = - * HMAC_hash(secret, HMAC_hash(secret, seed) + seed) + - * HMAC_hash(secret, HMAC_hash(secret, HMAC_hash(secret, seed)) + seed) + - * ... - * - * @param secret the secret to use. - * @param label the label to use. - * @param seed the seed value to use. - * @param length the number of bytes to generate. - * - * @return the pseudo random bytes in a byte buffer. - */ -var prf_TLS1 = function(secret, label, seed, length) { - var rval = forge.util.createBuffer(); - - /* For TLS 1.0, the secret is split in half, into two secrets of equal - length. If the secret has an odd length then the last byte of the first - half will be the same as the first byte of the second. The length of the - two secrets is half of the secret rounded up. */ - var idx = (secret.length >> 1); - var slen = idx + (secret.length & 1); - var s1 = secret.substr(0, slen); - var s2 = secret.substr(idx, slen); - var ai = forge.util.createBuffer(); - var hmac = forge.hmac.create(); - seed = label + seed; - - // determine the number of iterations that must be performed to generate - // enough output bytes, md5 creates 16 byte hashes, sha1 creates 20 - var md5itr = Math.ceil(length / 16); - var sha1itr = Math.ceil(length / 20); - - // do md5 iterations - hmac.start('MD5', s1); - var md5bytes = forge.util.createBuffer(); - ai.putBytes(seed); - for(var i = 0; i < md5itr; ++i) { - // HMAC_hash(secret, A(i-1)) - hmac.start(null, null); - hmac.update(ai.getBytes()); - ai.putBuffer(hmac.digest()); - - // HMAC_hash(secret, A(i) + seed) - hmac.start(null, null); - hmac.update(ai.bytes() + seed); - md5bytes.putBuffer(hmac.digest()); - } - - // do sha1 iterations - hmac.start('SHA1', s2); - var sha1bytes = forge.util.createBuffer(); - ai.clear(); - ai.putBytes(seed); - for(var i = 0; i < sha1itr; ++i) { - // HMAC_hash(secret, A(i-1)) - hmac.start(null, null); - hmac.update(ai.getBytes()); - ai.putBuffer(hmac.digest()); - - // HMAC_hash(secret, A(i) + seed) - hmac.start(null, null); - hmac.update(ai.bytes() + seed); - sha1bytes.putBuffer(hmac.digest()); - } - - // XOR the md5 bytes with the sha1 bytes - rval.putBytes(forge.util.xorBytes( - md5bytes.getBytes(), sha1bytes.getBytes(), length)); - - return rval; -}; - -/** - * Generates pseudo random bytes using a SHA256 algorithm. For TLS 1.2. - * - * @param secret the secret to use. - * @param label the label to use. - * @param seed the seed value to use. - * @param length the number of bytes to generate. - * - * @return the pseudo random bytes in a byte buffer. - */ -var prf_sha256 = function(secret, label, seed, length) { - // FIXME: implement me for TLS 1.2 -}; - -/** - * Gets a MAC for a record using the SHA-1 hash algorithm. - * - * @param key the mac key. - * @param state the sequence number (array of two 32-bit integers). - * @param record the record. - * - * @return the sha-1 hash (20 bytes) for the given record. - */ -var hmac_sha1 = function(key, seqNum, record) { - /* MAC is computed like so: - HMAC_hash( - key, seqNum + - TLSCompressed.type + - TLSCompressed.version + - TLSCompressed.length + - TLSCompressed.fragment) - */ - var hmac = forge.hmac.create(); - hmac.start('SHA1', key); - var b = forge.util.createBuffer(); - b.putInt32(seqNum[0]); - b.putInt32(seqNum[1]); - b.putByte(record.type); - b.putByte(record.version.major); - b.putByte(record.version.minor); - b.putInt16(record.length); - b.putBytes(record.fragment.bytes()); - hmac.update(b.getBytes()); - return hmac.digest().getBytes(); -}; - -/** - * Compresses the TLSPlaintext record into a TLSCompressed record using the - * deflate algorithm. - * - * @param c the TLS connection. - * @param record the TLSPlaintext record to compress. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -var deflate = function(c, record, s) { - var rval = false; - - try { - var bytes = c.deflate(record.fragment.getBytes()); - record.fragment = forge.util.createBuffer(bytes); - record.length = bytes.length; - rval = true; - } catch(ex) { - // deflate error, fail out - } - - return rval; -}; - -/** - * Decompresses the TLSCompressed record into a TLSPlaintext record using the - * deflate algorithm. - * - * @param c the TLS connection. - * @param record the TLSCompressed record to decompress. - * @param s the ConnectionState to use. - * - * @return true on success, false on failure. - */ -var inflate = function(c, record, s) { - var rval = false; - - try { - var bytes = c.inflate(record.fragment.getBytes()); - record.fragment = forge.util.createBuffer(bytes); - record.length = bytes.length; - rval = true; - } catch(ex) { - // inflate error, fail out - } - - return rval; -}; - -/** - * Reads a TLS variable-length vector from a byte buffer. - * - * Variable-length vectors are defined by specifying a subrange of legal - * lengths, inclusively, using the notation . When these are - * encoded, the actual length precedes the vector's contents in the byte - * stream. The length will be in the form of a number consuming as many bytes - * as required to hold the vector's specified maximum (ceiling) length. A - * variable-length vector with an actual length field of zero is referred to - * as an empty vector. - * - * @param b the byte buffer. - * @param lenBytes the number of bytes required to store the length. - * - * @return the resulting byte buffer. - */ -var readVector = function(b, lenBytes) { - var len = 0; - switch(lenBytes) { - case 1: - len = b.getByte(); - break; - case 2: - len = b.getInt16(); - break; - case 3: - len = b.getInt24(); - break; - case 4: - len = b.getInt32(); - break; - } - - // read vector bytes into a new buffer - return forge.util.createBuffer(b.getBytes(len)); -}; - -/** - * Writes a TLS variable-length vector to a byte buffer. - * - * @param b the byte buffer. - * @param lenBytes the number of bytes required to store the length. - * @param v the byte buffer vector. - */ -var writeVector = function(b, lenBytes, v) { - // encode length at the start of the vector, where the number of bytes for - // the length is the maximum number of bytes it would take to encode the - // vector's ceiling - b.putInt(v.length(), lenBytes << 3); - b.putBuffer(v); -}; - -/** - * The tls implementation. - */ -var tls = {}; - -/** - * Version: TLS 1.2 = 3.3, TLS 1.1 = 3.2, TLS 1.0 = 3.1. Both TLS 1.1 and - * TLS 1.2 were still too new (ie: openSSL didn't implement them) at the time - * of this implementation so TLS 1.0 was implemented instead. - */ -tls.Versions = { - TLS_1_0: {major: 3, minor: 1}, - TLS_1_1: {major: 3, minor: 2}, - TLS_1_2: {major: 3, minor: 3} -}; -tls.SupportedVersions = [ - tls.Versions.TLS_1_1, - tls.Versions.TLS_1_0 -]; -tls.Version = tls.SupportedVersions[0]; - -/** - * Maximum fragment size. True maximum is 16384, but we fragment before that - * to allow for unusual small increases during compression. - */ -tls.MaxFragment = 16384 - 1024; - -/** - * Whether this entity is considered the "client" or "server". - * enum { server, client } ConnectionEnd; - */ -tls.ConnectionEnd = { - server: 0, - client: 1 -}; - -/** - * Pseudo-random function algorithm used to generate keys from the master - * secret. - * enum { tls_prf_sha256 } PRFAlgorithm; - */ -tls.PRFAlgorithm = { - tls_prf_sha256: 0 -}; - -/** - * Bulk encryption algorithms. - * enum { null, rc4, des3, aes } BulkCipherAlgorithm; - */ -tls.BulkCipherAlgorithm = { - none: null, - rc4: 0, - des3: 1, - aes: 2 -}; - -/** - * Cipher types. - * enum { stream, block, aead } CipherType; - */ -tls.CipherType = { - stream: 0, - block: 1, - aead: 2 -}; - -/** - * MAC (Message Authentication Code) algorithms. - * enum { null, hmac_md5, hmac_sha1, hmac_sha256, - * hmac_sha384, hmac_sha512} MACAlgorithm; - */ -tls.MACAlgorithm = { - none: null, - hmac_md5: 0, - hmac_sha1: 1, - hmac_sha256: 2, - hmac_sha384: 3, - hmac_sha512: 4 -}; - -/** - * Compression algorithms. - * enum { null(0), deflate(1), (255) } CompressionMethod; - */ -tls.CompressionMethod = { - none: 0, - deflate: 1 -}; - -/** - * TLS record content types. - * enum { - * change_cipher_spec(20), alert(21), handshake(22), - * application_data(23), (255) - * } ContentType; - */ -tls.ContentType = { - change_cipher_spec: 20, - alert: 21, - handshake: 22, - application_data: 23, - heartbeat: 24 -}; - -/** - * TLS handshake types. - * enum { - * hello_request(0), client_hello(1), server_hello(2), - * certificate(11), server_key_exchange (12), - * certificate_request(13), server_hello_done(14), - * certificate_verify(15), client_key_exchange(16), - * finished(20), (255) - * } HandshakeType; - */ -tls.HandshakeType = { - hello_request: 0, - client_hello: 1, - server_hello: 2, - certificate: 11, - server_key_exchange: 12, - certificate_request: 13, - server_hello_done: 14, - certificate_verify: 15, - client_key_exchange: 16, - finished: 20 -}; - -/** - * TLS Alert Protocol. - * - * enum { warning(1), fatal(2), (255) } AlertLevel; - * - * enum { - * close_notify(0), - * unexpected_message(10), - * bad_record_mac(20), - * decryption_failed(21), - * record_overflow(22), - * decompression_failure(30), - * handshake_failure(40), - * bad_certificate(42), - * unsupported_certificate(43), - * certificate_revoked(44), - * certificate_expired(45), - * certificate_unknown(46), - * illegal_parameter(47), - * unknown_ca(48), - * access_denied(49), - * decode_error(50), - * decrypt_error(51), - * export_restriction(60), - * protocol_version(70), - * insufficient_security(71), - * internal_error(80), - * user_canceled(90), - * no_renegotiation(100), - * (255) - * } AlertDescription; - * - * struct { - * AlertLevel level; - * AlertDescription description; - * } Alert; - */ -tls.Alert = {}; -tls.Alert.Level = { - warning: 1, - fatal: 2 -}; -tls.Alert.Description = { - close_notify: 0, - unexpected_message: 10, - bad_record_mac: 20, - decryption_failed: 21, - record_overflow: 22, - decompression_failure: 30, - handshake_failure: 40, - bad_certificate: 42, - unsupported_certificate: 43, - certificate_revoked: 44, - certificate_expired: 45, - certificate_unknown: 46, - illegal_parameter: 47, - unknown_ca: 48, - access_denied: 49, - decode_error: 50, - decrypt_error: 51, - export_restriction: 60, - protocol_version: 70, - insufficient_security: 71, - internal_error: 80, - user_canceled: 90, - no_renegotiation: 100 -}; - -/** - * TLS Heartbeat Message types. - * enum { - * heartbeat_request(1), - * heartbeat_response(2), - * (255) - * } HeartbeatMessageType; - */ -tls.HeartbeatMessageType = { - heartbeat_request: 1, - heartbeat_response: 2 -}; - -/** - * Supported cipher suites. - */ -tls.CipherSuites = {}; - -/** - * Gets a supported cipher suite from its 2 byte ID. - * - * @param twoBytes two bytes in a string. - * - * @return the matching supported cipher suite or null. - */ -tls.getCipherSuite = function(twoBytes) { - var rval = null; - for(var key in tls.CipherSuites) { - var cs = tls.CipherSuites[key]; - if(cs.id[0] === twoBytes.charCodeAt(0) && - cs.id[1] === twoBytes.charCodeAt(1)) { - rval = cs; - break; - } - } - return rval; -}; - -/** - * Called when an unexpected record is encountered. - * - * @param c the connection. - * @param record the record. - */ -tls.handleUnexpected = function(c, record) { - // if connection is client and closed, ignore unexpected messages - var ignore = (!c.open && c.entity === tls.ConnectionEnd.client); - if(!ignore) { - c.error(c, { - message: 'Unexpected message. Received TLS record out of order.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unexpected_message - } - }); - } -}; - -/** - * Called when a client receives a HelloRequest record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleHelloRequest = function(c, record, length) { - // ignore renegotiation requests from the server during a handshake, but - // if handshaking, send a warning alert that renegotation is denied - if(!c.handshaking && c.handshakes > 0) { - // send alert warning - tls.queue(c, tls.createAlert(c, { - level: tls.Alert.Level.warning, - description: tls.Alert.Description.no_renegotiation - })); - tls.flush(c); - } - - // continue - c.process(); -}; - -/** - * Parses a hello message from a ClientHello or ServerHello record. - * - * @param record the record to parse. - * - * @return the parsed message. - */ -tls.parseHelloMessage = function(c, record, length) { - var msg = null; - - var client = (c.entity === tls.ConnectionEnd.client); - - // minimum of 38 bytes in message - if(length < 38) { - c.error(c, { - message: client ? - 'Invalid ServerHello message. Message too short.' : - 'Invalid ClientHello message. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } else { - // use 'remaining' to calculate # of remaining bytes in the message - var b = record.fragment; - var remaining = b.length(); - msg = { - version: { - major: b.getByte(), - minor: b.getByte() - }, - random: forge.util.createBuffer(b.getBytes(32)), - session_id: readVector(b, 1), - extensions: [] - }; - if(client) { - msg.cipher_suite = b.getBytes(2); - msg.compression_method = b.getByte(); - } else { - msg.cipher_suites = readVector(b, 2); - msg.compression_methods = readVector(b, 1); - } - - // read extensions if there are any bytes left in the message - remaining = length - (remaining - b.length()); - if(remaining > 0) { - // parse extensions - var exts = readVector(b, 2); - while(exts.length() > 0) { - msg.extensions.push({ - type: [exts.getByte(), exts.getByte()], - data: readVector(exts, 2) - }); - } - - // TODO: make extension support modular - if(!client) { - for(var i = 0; i < msg.extensions.length; ++i) { - var ext = msg.extensions[i]; - - // support SNI extension - if(ext.type[0] === 0x00 && ext.type[1] === 0x00) { - // get server name list - var snl = readVector(ext.data, 2); - while(snl.length() > 0) { - // read server name type - var snType = snl.getByte(); - - // only HostName type (0x00) is known, break out if - // another type is detected - if(snType !== 0x00) { - break; - } - - // add host name to server name list - c.session.extensions.server_name.serverNameList.push( - readVector(snl, 2).getBytes()); - } - } - } - } - } - - // version already set, do not allow version change - if(c.session.version) { - if(msg.version.major !== c.session.version.major || - msg.version.minor !== c.session.version.minor) { - return c.error(c, { - message: 'TLS version change is disallowed during renegotiation.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - } - - // get the chosen (ServerHello) cipher suite - if(client) { - // FIXME: should be checking configured acceptable cipher suites - c.session.cipherSuite = tls.getCipherSuite(msg.cipher_suite); - } else { - // get a supported preferred (ClientHello) cipher suite - // choose the first supported cipher suite - var tmp = forge.util.createBuffer(msg.cipher_suites.bytes()); - while(tmp.length() > 0) { - // FIXME: should be checking configured acceptable suites - // cipher suites take up 2 bytes - c.session.cipherSuite = tls.getCipherSuite(tmp.getBytes(2)); - if(c.session.cipherSuite !== null) { - break; - } - } - } - - // cipher suite not supported - if(c.session.cipherSuite === null) { - return c.error(c, { - message: 'No cipher suites in common.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.handshake_failure - }, - cipherSuite: forge.util.bytesToHex(msg.cipher_suite) - }); - } - - // TODO: handle compression methods - if(client) { - c.session.compressionMethod = msg.compression_method; - } else { - // no compression - c.session.compressionMethod = tls.CompressionMethod.none; - } - } - - return msg; -}; - -/** - * Creates security parameters for the given connection based on the given - * hello message. - * - * @param c the TLS connection. - * @param msg the hello message. - */ -tls.createSecurityParameters = function(c, msg) { - /* Note: security params are from TLS 1.2, some values like prf_algorithm - are ignored for TLS 1.0/1.1 and the builtin as specified in the spec is - used. */ - - // TODO: handle other options from server when more supported - - // get client and server randoms - var client = (c.entity === tls.ConnectionEnd.client); - var msgRandom = msg.random.bytes(); - var cRandom = client ? c.session.sp.client_random : msgRandom; - var sRandom = client ? msgRandom : tls.createRandom().getBytes(); - - // create new security parameters - c.session.sp = { - entity: c.entity, - prf_algorithm: tls.PRFAlgorithm.tls_prf_sha256, - bulk_cipher_algorithm: null, - cipher_type: null, - enc_key_length: null, - block_length: null, - fixed_iv_length: null, - record_iv_length: null, - mac_algorithm: null, - mac_length: null, - mac_key_length: null, - compression_algorithm: c.session.compressionMethod, - pre_master_secret: null, - master_secret: null, - client_random: cRandom, - server_random: sRandom - }; -}; - -/** - * Called when a client receives a ServerHello record. - * - * When a ServerHello message will be sent: - * The server will send this message in response to a client hello message - * when it was able to find an acceptable set of algorithms. If it cannot - * find such a match, it will respond with a handshake failure alert. - * - * uint24 length; - * struct { - * ProtocolVersion server_version; - * Random random; - * SessionID session_id; - * CipherSuite cipher_suite; - * CompressionMethod compression_method; - * select(extensions_present) { - * case false: - * struct {}; - * case true: - * Extension extensions<0..2^16-1>; - * }; - * } ServerHello; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerHello = function(c, record, length) { - var msg = tls.parseHelloMessage(c, record, length); - if(c.fail) { - return; - } - - // ensure server version is compatible - if(msg.version.minor <= c.version.minor) { - c.version.minor = msg.version.minor; - } else { - return c.error(c, { - message: 'Incompatible TLS version.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - - // indicate session version has been set - c.session.version = c.version; - - // get the session ID from the message - var sessionId = msg.session_id.bytes(); - - // if the session ID is not blank and matches the cached one, resume - // the session - if(sessionId.length > 0 && sessionId === c.session.id) { - // resuming session, expect a ChangeCipherSpec next - c.expect = SCC; - c.session.resuming = true; - - // get new server random - c.session.sp.server_random = msg.random.bytes(); - } else { - // not resuming, expect a server Certificate message next - c.expect = SCE; - c.session.resuming = false; - - // create new security parameters - tls.createSecurityParameters(c, msg); - } - - // set new session ID - c.session.id = sessionId; - - // continue - c.process(); -}; - -/** - * Called when a server receives a ClientHello record. - * - * When a ClientHello message will be sent: - * When a client first connects to a server it is required to send the - * client hello as its first message. The client can also send a client - * hello in response to a hello request or on its own initiative in order - * to renegotiate the security parameters in an existing connection. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleClientHello = function(c, record, length) { - var msg = tls.parseHelloMessage(c, record, length); - if(c.fail) { - return; - } - - // get the session ID from the message - var sessionId = msg.session_id.bytes(); - - // see if the given session ID is in the cache - var session = null; - if(c.sessionCache) { - session = c.sessionCache.getSession(sessionId); - if(session === null) { - // session ID not found - sessionId = ''; - } else if(session.version.major !== msg.version.major || - session.version.minor > msg.version.minor) { - // if session version is incompatible with client version, do not resume - session = null; - sessionId = ''; - } - } - - // no session found to resume, generate a new session ID - if(sessionId.length === 0) { - sessionId = forge.random.getBytes(32); - } - - // update session - c.session.id = sessionId; - c.session.clientHelloVersion = msg.version; - c.session.sp = {}; - if(session) { - // use version and security parameters from resumed session - c.version = c.session.version = session.version; - c.session.sp = session.sp; - } else { - // use highest compatible minor version - var version; - for(var i = 1; i < tls.SupportedVersions.length; ++i) { - version = tls.SupportedVersions[i]; - if(version.minor <= msg.version.minor) { - break; - } - } - c.version = {major: version.major, minor: version.minor}; - c.session.version = c.version; - } - - // if a session is set, resume it - if(session !== null) { - // resuming session, expect a ChangeCipherSpec next - c.expect = CCC; - c.session.resuming = true; - - // get new client random - c.session.sp.client_random = msg.random.bytes(); - } else { - // not resuming, expect a Certificate or ClientKeyExchange - c.expect = (c.verifyClient !== false) ? CCE : CKE; - c.session.resuming = false; - - // create new security parameters - tls.createSecurityParameters(c, msg); - } - - // connection now open - c.open = true; - - // queue server hello - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerHello(c) - })); - - if(c.session.resuming) { - // queue change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // create pending state - c.state.pending = tls.createConnectionState(c); - - // change current write state to pending write state - c.state.current.write = c.state.pending.write; - - // queue finished - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - } else { - // queue server certificate - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificate(c) - })); - - if(!c.fail) { - // queue server key exchange - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerKeyExchange(c) - })); - - // request client certificate if set - if(c.verifyClient !== false) { - // queue certificate request - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificateRequest(c) - })); - } - - // queue server hello done - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createServerHelloDone(c) - })); - } - } - - // send records - tls.flush(c); - - // continue - c.process(); -}; - -/** - * Called when a client receives a Certificate record. - * - * When this message will be sent: - * The server must send a certificate whenever the agreed-upon key exchange - * method is not an anonymous one. This message will always immediately - * follow the server hello message. - * - * Meaning of this message: - * The certificate type must be appropriate for the selected cipher suite's - * key exchange algorithm, and is generally an X.509v3 certificate. It must - * contain a key which matches the key exchange method, as follows. Unless - * otherwise specified, the signing algorithm for the certificate must be - * the same as the algorithm for the certificate key. Unless otherwise - * specified, the public key may be of any length. - * - * opaque ASN.1Cert<1..2^24-1>; - * struct { - * ASN.1Cert certificate_list<1..2^24-1>; - * } Certificate; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificate = function(c, record, length) { - // minimum of 3 bytes in message - if(length < 3) { - return c.error(c, { - message: 'Invalid Certificate message. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - var b = record.fragment; - var msg = { - certificate_list: readVector(b, 3) - }; - - /* The sender's certificate will be first in the list (chain), each - subsequent one that follows will certify the previous one, but root - certificates (self-signed) that specify the certificate authority may - be omitted under the assumption that clients must already possess it. */ - var cert, asn1; - var certs = []; - try { - while(msg.certificate_list.length() > 0) { - // each entry in msg.certificate_list is a vector with 3 len bytes - cert = readVector(msg.certificate_list, 3); - asn1 = forge.asn1.fromDer(cert); - cert = forge.pki.certificateFromAsn1(asn1, true); - certs.push(cert); - } - } catch(ex) { - return c.error(c, { - message: 'Could not parse certificate list.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - } - }); - } - - // ensure at least 1 certificate was provided if in client-mode - // or if verifyClient was set to true to require a certificate - // (as opposed to 'optional') - var client = (c.entity === tls.ConnectionEnd.client); - if((client || c.verifyClient === true) && certs.length === 0) { - // error, no certificate - c.error(c, { - message: client ? - 'No server certificate provided.' : - 'No client certificate provided.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } else if(certs.length === 0) { - // no certs to verify - // expect a ServerKeyExchange or ClientKeyExchange message next - c.expect = client ? SKE : CKE; - } else { - // save certificate in session - if(client) { - c.session.serverCertificate = certs[0]; - } else { - c.session.clientCertificate = certs[0]; - } - - if(tls.verifyCertificateChain(c, certs)) { - // expect a ServerKeyExchange or ClientKeyExchange message next - c.expect = client ? SKE : CKE; - } - } - - // continue - c.process(); -}; - -/** - * Called when a client receives a ServerKeyExchange record. - * - * When this message will be sent: - * This message will be sent immediately after the server certificate - * message (or the server hello message, if this is an anonymous - * negotiation). - * - * The server key exchange message is sent by the server only when the - * server certificate message (if sent) does not contain enough data to - * allow the client to exchange a premaster secret. - * - * Meaning of this message: - * This message conveys cryptographic information to allow the client to - * communicate the premaster secret: either an RSA public key to encrypt - * the premaster secret with, or a Diffie-Hellman public key with which the - * client can complete a key exchange (with the result being the premaster - * secret.) - * - * enum { - * dhe_dss, dhe_rsa, dh_anon, rsa, dh_dss, dh_rsa - * } KeyExchangeAlgorithm; - * - * struct { - * opaque dh_p<1..2^16-1>; - * opaque dh_g<1..2^16-1>; - * opaque dh_Ys<1..2^16-1>; - * } ServerDHParams; - * - * struct { - * select(KeyExchangeAlgorithm) { - * case dh_anon: - * ServerDHParams params; - * case dhe_dss: - * case dhe_rsa: - * ServerDHParams params; - * digitally-signed struct { - * opaque client_random[32]; - * opaque server_random[32]; - * ServerDHParams params; - * } signed_params; - * case rsa: - * case dh_dss: - * case dh_rsa: - * struct {}; - * }; - * } ServerKeyExchange; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerKeyExchange = function(c, record, length) { - // this implementation only supports RSA, no Diffie-Hellman support - // so any length > 0 is invalid - if(length > 0) { - return c.error(c, { - message: 'Invalid key parameters. Only RSA is supported.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unsupported_certificate - } - }); - } - - // expect an optional CertificateRequest message next - c.expect = SCR; - - // continue - c.process(); -}; - -/** - * Called when a client receives a ClientKeyExchange record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleClientKeyExchange = function(c, record, length) { - // this implementation only supports RSA, no Diffie-Hellman support - // so any length < 48 is invalid - if(length < 48) { - return c.error(c, { - message: 'Invalid key parameters. Only RSA is supported.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.unsupported_certificate - } - }); - } - - var b = record.fragment; - var msg = { - enc_pre_master_secret: readVector(b, 2).getBytes() - }; - - // do rsa decryption - var privateKey = null; - if(c.getPrivateKey) { - try { - privateKey = c.getPrivateKey(c, c.session.serverCertificate); - privateKey = forge.pki.privateKeyFromPem(privateKey); - } catch(ex) { - c.error(c, { - message: 'Could not get private key.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - } - - if(privateKey === null) { - return c.error(c, { - message: 'No private key set.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - - try { - // decrypt 48-byte pre-master secret - var sp = c.session.sp; - sp.pre_master_secret = privateKey.decrypt(msg.enc_pre_master_secret); - - // ensure client hello version matches first 2 bytes - var version = c.session.clientHelloVersion; - if(version.major !== sp.pre_master_secret.charCodeAt(0) || - version.minor !== sp.pre_master_secret.charCodeAt(1)) { - // error, do not send alert (see BLEI attack below) - throw new Error('TLS version rollback attack detected.'); - } - } catch(ex) { - /* Note: Daniel Bleichenbacher [BLEI] can be used to attack a - TLS server which is using PKCS#1 encoded RSA, so instead of - failing here, we generate 48 random bytes and use that as - the pre-master secret. */ - sp.pre_master_secret = forge.random.getBytes(48); - } - - // expect a CertificateVerify message if a Certificate was received that - // does not have fixed Diffie-Hellman params, otherwise expect - // ChangeCipherSpec - c.expect = CCC; - if(c.session.clientCertificate !== null) { - // only RSA support, so expect CertificateVerify - // TODO: support Diffie-Hellman - c.expect = CCV; - } - - // continue - c.process(); -}; - -/** - * Called when a client receives a CertificateRequest record. - * - * When this message will be sent: - * A non-anonymous server can optionally request a certificate from the - * client, if appropriate for the selected cipher suite. This message, if - * sent, will immediately follow the Server Key Exchange message (if it is - * sent; otherwise, the Server Certificate message). - * - * enum { - * rsa_sign(1), dss_sign(2), rsa_fixed_dh(3), dss_fixed_dh(4), - * rsa_ephemeral_dh_RESERVED(5), dss_ephemeral_dh_RESERVED(6), - * fortezza_dms_RESERVED(20), (255) - * } ClientCertificateType; - * - * opaque DistinguishedName<1..2^16-1>; - * - * struct { - * ClientCertificateType certificate_types<1..2^8-1>; - * SignatureAndHashAlgorithm supported_signature_algorithms<2^16-1>; - * DistinguishedName certificate_authorities<0..2^16-1>; - * } CertificateRequest; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificateRequest = function(c, record, length) { - // minimum of 3 bytes in message - if(length < 3) { - return c.error(c, { - message: 'Invalid CertificateRequest. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // TODO: TLS 1.2+ has different format including - // SignatureAndHashAlgorithm after cert types - var b = record.fragment; - var msg = { - certificate_types: readVector(b, 1), - certificate_authorities: readVector(b, 2) - }; - - // save certificate request in session - c.session.certificateRequest = msg; - - // expect a ServerHelloDone message next - c.expect = SHD; - - // continue - c.process(); -}; - -/** - * Called when a server receives a CertificateVerify record. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleCertificateVerify = function(c, record, length) { - if(length < 2) { - return c.error(c, { - message: 'Invalid CertificateVerify. Message too short.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // rewind to get full bytes for message so it can be manually - // digested below (special case for CertificateVerify messages because - // they must be digested *after* handling as opposed to all others) - var b = record.fragment; - b.read -= 4; - var msgBytes = b.bytes(); - b.read += 4; - - var msg = { - signature: readVector(b, 2).getBytes() - }; - - // TODO: add support for DSA - - // generate data to verify - var verify = forge.util.createBuffer(); - verify.putBuffer(c.session.md5.digest()); - verify.putBuffer(c.session.sha1.digest()); - verify = verify.getBytes(); - - try { - var cert = c.session.clientCertificate; - /*b = forge.pki.rsa.decrypt( - msg.signature, cert.publicKey, true, verify.length); - if(b !== verify) {*/ - if(!cert.publicKey.verify(verify, msg.signature, 'NONE')) { - throw new Error('CertificateVerify signature does not match.'); - } - - // digest message now that it has been handled - c.session.md5.update(msgBytes); - c.session.sha1.update(msgBytes); - } catch(ex) { - return c.error(c, { - message: 'Bad signature in CertificateVerify.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.handshake_failure - } - }); - } - - // expect ChangeCipherSpec - c.expect = CCC; - - // continue - c.process(); -}; - -/** - * Called when a client receives a ServerHelloDone record. - * - * When this message will be sent: - * The server hello done message is sent by the server to indicate the end - * of the server hello and associated messages. After sending this message - * the server will wait for a client response. - * - * Meaning of this message: - * This message means that the server is done sending messages to support - * the key exchange, and the client can proceed with its phase of the key - * exchange. - * - * Upon receipt of the server hello done message the client should verify - * that the server provided a valid certificate if required and check that - * the server hello parameters are acceptable. - * - * struct {} ServerHelloDone; - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleServerHelloDone = function(c, record, length) { - // len must be 0 bytes - if(length > 0) { - return c.error(c, { - message: 'Invalid ServerHelloDone message. Invalid length.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.record_overflow - } - }); - } - - if(c.serverCertificate === null) { - // no server certificate was provided - var error = { - message: 'No server certificate provided. Not enough security.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.insufficient_security - } - }; - - // call application callback - var depth = 0; - var ret = c.verify(c, error.alert.description, depth, []); - if(ret !== true) { - // check for custom alert info - if(ret || ret === 0) { - // set custom message and alert description - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - if(ret.message) { - error.message = ret.message; - } - if(ret.alert) { - error.alert.description = ret.alert; - } - } else if(typeof ret === 'number') { - // set custom alert description - error.alert.description = ret; - } - } - - // send error - return c.error(c, error); - } - } - - // create client certificate message if requested - if(c.session.certificateRequest !== null) { - record = tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificate(c) - }); - tls.queue(c, record); - } - - // create client key exchange message - record = tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createClientKeyExchange(c) - }); - tls.queue(c, record); - - // expect no messages until the following callback has been called - c.expect = SER; - - // create callback to handle client signature (for client-certs) - var callback = function(c, signature) { - if(c.session.certificateRequest !== null && - c.session.clientCertificate !== null) { - // create certificate verify message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createCertificateVerify(c, signature) - })); - } - - // create change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // create pending state - c.state.pending = tls.createConnectionState(c); - - // change current write state to pending write state - c.state.current.write = c.state.pending.write; - - // create finished message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - - // expect a server ChangeCipherSpec message next - c.expect = SCC; - - // send records - tls.flush(c); - - // continue - c.process(); - }; - - // if there is no certificate request or no client certificate, do - // callback immediately - if(c.session.certificateRequest === null || - c.session.clientCertificate === null) { - return callback(c, null); - } - - // otherwise get the client signature - tls.getClientSignature(c, callback); -}; - -/** - * Called when a ChangeCipherSpec record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleChangeCipherSpec = function(c, record) { - if(record.fragment.getByte() !== 0x01) { - return c.error(c, { - message: 'Invalid ChangeCipherSpec message received.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.illegal_parameter - } - }); - } - - // create pending state if: - // 1. Resuming session in client mode OR - // 2. NOT resuming session in server mode - var client = (c.entity === tls.ConnectionEnd.client); - if((c.session.resuming && client) || (!c.session.resuming && !client)) { - c.state.pending = tls.createConnectionState(c); - } - - // change current read state to pending read state - c.state.current.read = c.state.pending.read; - - // clear pending state if: - // 1. NOT resuming session in client mode OR - // 2. resuming a session in server mode - if((!c.session.resuming && client) || (c.session.resuming && !client)) { - c.state.pending = null; - } - - // expect a Finished record next - c.expect = client ? SFI : CFI; - - // continue - c.process(); -}; - -/** - * Called when a Finished record is received. - * - * When this message will be sent: - * A finished message is always sent immediately after a change - * cipher spec message to verify that the key exchange and - * authentication processes were successful. It is essential that a - * change cipher spec message be received between the other - * handshake messages and the Finished message. - * - * Meaning of this message: - * The finished message is the first protected with the just- - * negotiated algorithms, keys, and secrets. Recipients of finished - * messages must verify that the contents are correct. Once a side - * has sent its Finished message and received and validated the - * Finished message from its peer, it may begin to send and receive - * application data over the connection. - * - * struct { - * opaque verify_data[verify_data_length]; - * } Finished; - * - * verify_data - * PRF(master_secret, finished_label, Hash(handshake_messages)) - * [0..verify_data_length-1]; - * - * finished_label - * For Finished messages sent by the client, the string - * "client finished". For Finished messages sent by the server, the - * string "server finished". - * - * verify_data_length depends on the cipher suite. If it is not specified - * by the cipher suite, then it is 12. Versions of TLS < 1.2 always used - * 12 bytes. - * - * @param c the connection. - * @param record the record. - * @param length the length of the handshake message. - */ -tls.handleFinished = function(c, record, length) { - // rewind to get full bytes for message so it can be manually - // digested below (special case for Finished messages because they - // must be digested *after* handling as opposed to all others) - var b = record.fragment; - b.read -= 4; - var msgBytes = b.bytes(); - b.read += 4; - - // message contains only verify_data - var vd = record.fragment.getBytes(); - - // ensure verify data is correct - b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - - // set label based on entity type - var client = (c.entity === tls.ConnectionEnd.client); - var label = client ? 'server finished' : 'client finished'; - - // TODO: determine prf function and verify length for TLS 1.2 - var sp = c.session.sp; - var vdl = 12; - var prf = prf_TLS1; - b = prf(sp.master_secret, label, b.getBytes(), vdl); - if(b.getBytes() !== vd) { - return c.error(c, { - message: 'Invalid verify_data in Finished message.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.decrypt_error - } - }); - } - - // digest finished message now that it has been handled - c.session.md5.update(msgBytes); - c.session.sha1.update(msgBytes); - - // resuming session as client or NOT resuming session as server - if((c.session.resuming && client) || (!c.session.resuming && !client)) { - // create change cipher spec message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.change_cipher_spec, - data: tls.createChangeCipherSpec() - })); - - // change current write state to pending write state, clear pending - c.state.current.write = c.state.pending.write; - c.state.pending = null; - - // create finished message - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createFinished(c) - })); - } - - // expect application data next - c.expect = client ? SAD : CAD; - - // handshake complete - c.handshaking = false; - ++c.handshakes; - - // save access to peer certificate - c.peerCertificate = client ? - c.session.serverCertificate : c.session.clientCertificate; - - // send records - tls.flush(c); - - // now connected - c.isConnected = true; - c.connected(c); - - // continue - c.process(); -}; - -/** - * Called when an Alert record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleAlert = function(c, record) { - // read alert - var b = record.fragment; - var alert = { - level: b.getByte(), - description: b.getByte() - }; - - // TODO: consider using a table? - // get appropriate message - var msg; - switch(alert.description) { - case tls.Alert.Description.close_notify: - msg = 'Connection closed.'; - break; - case tls.Alert.Description.unexpected_message: - msg = 'Unexpected message.'; - break; - case tls.Alert.Description.bad_record_mac: - msg = 'Bad record MAC.'; - break; - case tls.Alert.Description.decryption_failed: - msg = 'Decryption failed.'; - break; - case tls.Alert.Description.record_overflow: - msg = 'Record overflow.'; - break; - case tls.Alert.Description.decompression_failure: - msg = 'Decompression failed.'; - break; - case tls.Alert.Description.handshake_failure: - msg = 'Handshake failure.'; - break; - case tls.Alert.Description.bad_certificate: - msg = 'Bad certificate.'; - break; - case tls.Alert.Description.unsupported_certificate: - msg = 'Unsupported certificate.'; - break; - case tls.Alert.Description.certificate_revoked: - msg = 'Certificate revoked.'; - break; - case tls.Alert.Description.certificate_expired: - msg = 'Certificate expired.'; - break; - case tls.Alert.Description.certificate_unknown: - msg = 'Certificate unknown.'; - break; - case tls.Alert.Description.illegal_parameter: - msg = 'Illegal parameter.'; - break; - case tls.Alert.Description.unknown_ca: - msg = 'Unknown certificate authority.'; - break; - case tls.Alert.Description.access_denied: - msg = 'Access denied.'; - break; - case tls.Alert.Description.decode_error: - msg = 'Decode error.'; - break; - case tls.Alert.Description.decrypt_error: - msg = 'Decrypt error.'; - break; - case tls.Alert.Description.export_restriction: - msg = 'Export restriction.'; - break; - case tls.Alert.Description.protocol_version: - msg = 'Unsupported protocol version.'; - break; - case tls.Alert.Description.insufficient_security: - msg = 'Insufficient security.'; - break; - case tls.Alert.Description.internal_error: - msg = 'Internal error.'; - break; - case tls.Alert.Description.user_canceled: - msg = 'User canceled.'; - break; - case tls.Alert.Description.no_renegotiation: - msg = 'Renegotiation not supported.'; - break; - default: - msg = 'Unknown error.'; - break; - } - - // close connection on close_notify, not an error - if(alert.description === tls.Alert.Description.close_notify) { - return c.close(); - } - - // call error handler - c.error(c, { - message: msg, - send: false, - // origin is the opposite end - origin: (c.entity === tls.ConnectionEnd.client) ? 'server' : 'client', - alert: alert - }); - - // continue - c.process(); -}; - -/** - * Called when a Handshake record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleHandshake = function(c, record) { - // get the handshake type and message length - var b = record.fragment; - var type = b.getByte(); - var length = b.getInt24(); - - // see if the record fragment doesn't yet contain the full message - if(length > b.length()) { - // cache the record, clear its fragment, and reset the buffer read - // pointer before the type and length were read - c.fragmented = record; - record.fragment = forge.util.createBuffer(); - b.read -= 4; - - // continue - return c.process(); - } - - // full message now available, clear cache, reset read pointer to - // before type and length - c.fragmented = null; - b.read -= 4; - - // save the handshake bytes for digestion after handler is found - // (include type and length of handshake msg) - var bytes = b.bytes(length + 4); - - // restore read pointer - b.read += 4; - - // handle expected message - if(type in hsTable[c.entity][c.expect]) { - // initialize server session - if(c.entity === tls.ConnectionEnd.server && !c.open && !c.fail) { - c.handshaking = true; - c.session = { - version: null, - extensions: { - server_name: { - serverNameList: [] - } - }, - cipherSuite: null, - compressionMethod: null, - serverCertificate: null, - clientCertificate: null, - md5: forge.md.md5.create(), - sha1: forge.md.sha1.create() - }; - } - - /* Update handshake messages digest. Finished and CertificateVerify - messages are not digested here. They can't be digested as part of - the verify_data that they contain. These messages are manually - digested in their handlers. HelloRequest messages are simply never - included in the handshake message digest according to spec. */ - if(type !== tls.HandshakeType.hello_request && - type !== tls.HandshakeType.certificate_verify && - type !== tls.HandshakeType.finished) { - c.session.md5.update(bytes); - c.session.sha1.update(bytes); - } - - // handle specific handshake type record - hsTable[c.entity][c.expect][type](c, record, length); - } else { - // unexpected record - tls.handleUnexpected(c, record); - } -}; - -/** - * Called when an ApplicationData record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleApplicationData = function(c, record) { - // buffer data, notify that its ready - c.data.putBuffer(record.fragment); - c.dataReady(c); - - // continue - c.process(); -}; - -/** - * Called when a Heartbeat record is received. - * - * @param c the connection. - * @param record the record. - */ -tls.handleHeartbeat = function(c, record) { - // get the heartbeat type and payload - var b = record.fragment; - var type = b.getByte(); - var length = b.getInt16(); - var payload = b.getBytes(length); - - if(type === tls.HeartbeatMessageType.heartbeat_request) { - // discard request during handshake or if length is too large - if(c.handshaking || length > payload.length) { - // continue - return c.process(); - } - // retransmit payload - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.heartbeat, - data: tls.createHeartbeat( - tls.HeartbeatMessageType.heartbeat_response, payload) - })); - tls.flush(c); - } else if(type === tls.HeartbeatMessageType.heartbeat_response) { - // check payload against expected payload, discard heartbeat if no match - if(payload !== c.expectedHeartbeatPayload) { - // continue - return c.process(); - } - - // notify that a valid heartbeat was received - if(c.heartbeatReceived) { - c.heartbeatReceived(c, forge.util.createBuffer(payload)); - } - } - - // continue - c.process(); -}; - -/** - * The transistional state tables for receiving TLS records. It maps the - * current TLS engine state and a received record to a function to handle the - * record and update the state. - * - * For instance, if the current state is SHE, then the TLS engine is expecting - * a ServerHello record. Once a record is received, the handler function is - * looked up using the state SHE and the record's content type. - * - * The resulting function will either be an error handler or a record handler. - * The function will take whatever action is appropriate and update the state - * for the next record. - * - * The states are all based on possible server record types. Note that the - * client will never specifically expect to receive a HelloRequest or an alert - * from the server so there is no state that reflects this. These messages may - * occur at any time. - * - * There are two tables for mapping states because there is a second tier of - * types for handshake messages. Once a record with a content type of handshake - * is received, the handshake record handler will look up the handshake type in - * the secondary map to get its appropriate handler. - * - * Valid message orders are as follows: - * - * =======================FULL HANDSHAKE====================== - * Client Server - * - * ClientHello --------> - * ServerHello - * Certificate* - * ServerKeyExchange* - * CertificateRequest* - * <-------- ServerHelloDone - * Certificate* - * ClientKeyExchange - * CertificateVerify* - * [ChangeCipherSpec] - * Finished --------> - * [ChangeCipherSpec] - * <-------- Finished - * Application Data <-------> Application Data - * - * =====================SESSION RESUMPTION===================== - * Client Server - * - * ClientHello --------> - * ServerHello - * [ChangeCipherSpec] - * <-------- Finished - * [ChangeCipherSpec] - * Finished --------> - * Application Data <-------> Application Data - */ -// client expect states (indicate which records are expected to be received) -var SHE = 0; // rcv server hello -var SCE = 1; // rcv server certificate -var SKE = 2; // rcv server key exchange -var SCR = 3; // rcv certificate request -var SHD = 4; // rcv server hello done -var SCC = 5; // rcv change cipher spec -var SFI = 6; // rcv finished -var SAD = 7; // rcv application data -var SER = 8; // not expecting any messages at this point - -// server expect states -var CHE = 0; // rcv client hello -var CCE = 1; // rcv client certificate -var CKE = 2; // rcv client key exchange -var CCV = 3; // rcv certificate verify -var CCC = 4; // rcv change cipher spec -var CFI = 5; // rcv finished -var CAD = 6; // rcv application data -var CER = 7; // not expecting any messages at this point - -// map client current expect state and content type to function -var __ = tls.handleUnexpected; -var R0 = tls.handleChangeCipherSpec; -var R1 = tls.handleAlert; -var R2 = tls.handleHandshake; -var R3 = tls.handleApplicationData; -var R4 = tls.handleHeartbeat; -var ctTable = []; -ctTable[tls.ConnectionEnd.client] = [ -// CC,AL,HS,AD,HB -/*SHE*/[__,R1,R2,__,R4], -/*SCE*/[__,R1,R2,__,R4], -/*SKE*/[__,R1,R2,__,R4], -/*SCR*/[__,R1,R2,__,R4], -/*SHD*/[__,R1,R2,__,R4], -/*SCC*/[R0,R1,__,__,R4], -/*SFI*/[__,R1,R2,__,R4], -/*SAD*/[__,R1,R2,R3,R4], -/*SER*/[__,R1,R2,__,R4] -]; - -// map server current expect state and content type to function -ctTable[tls.ConnectionEnd.server] = [ -// CC,AL,HS,AD -/*CHE*/[__,R1,R2,__,R4], -/*CCE*/[__,R1,R2,__,R4], -/*CKE*/[__,R1,R2,__,R4], -/*CCV*/[__,R1,R2,__,R4], -/*CCC*/[R0,R1,__,__,R4], -/*CFI*/[__,R1,R2,__,R4], -/*CAD*/[__,R1,R2,R3,R4], -/*CER*/[__,R1,R2,__,R4] -]; - -// map client current expect state and handshake type to function -var H0 = tls.handleHelloRequest; -var H1 = tls.handleServerHello; -var H2 = tls.handleCertificate; -var H3 = tls.handleServerKeyExchange; -var H4 = tls.handleCertificateRequest; -var H5 = tls.handleServerHelloDone; -var H6 = tls.handleFinished; -var hsTable = []; -hsTable[tls.ConnectionEnd.client] = [ -// HR,01,SH,03,04,05,06,07,08,09,10,SC,SK,CR,HD,15,CK,17,18,19,FI -/*SHE*/[__,__,H1,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SCE*/[H0,__,__,__,__,__,__,__,__,__,__,H2,H3,H4,H5,__,__,__,__,__,__], -/*SKE*/[H0,__,__,__,__,__,__,__,__,__,__,__,H3,H4,H5,__,__,__,__,__,__], -/*SCR*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,H4,H5,__,__,__,__,__,__], -/*SHD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,H5,__,__,__,__,__,__], -/*SCC*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SFI*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], -/*SAD*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*SER*/[H0,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] -]; - -// map server current expect state and handshake type to function -// Note: CAD[CH] does not map to FB because renegotation is prohibited -var H7 = tls.handleClientHello; -var H8 = tls.handleClientKeyExchange; -var H9 = tls.handleCertificateVerify; -hsTable[tls.ConnectionEnd.server] = [ -// 01,CH,02,03,04,05,06,07,08,09,10,CC,12,13,14,CV,CK,17,18,19,FI -/*CHE*/[__,H7,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CCE*/[__,__,__,__,__,__,__,__,__,__,__,H2,__,__,__,__,__,__,__,__,__], -/*CKE*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H8,__,__,__,__], -/*CCV*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H9,__,__,__,__,__], -/*CCC*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CFI*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,H6], -/*CAD*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__], -/*CER*/[__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__,__] -]; - -/** - * Generates the master_secret and keys using the given security parameters. - * - * The security parameters for a TLS connection state are defined as such: - * - * struct { - * ConnectionEnd entity; - * PRFAlgorithm prf_algorithm; - * BulkCipherAlgorithm bulk_cipher_algorithm; - * CipherType cipher_type; - * uint8 enc_key_length; - * uint8 block_length; - * uint8 fixed_iv_length; - * uint8 record_iv_length; - * MACAlgorithm mac_algorithm; - * uint8 mac_length; - * uint8 mac_key_length; - * CompressionMethod compression_algorithm; - * opaque master_secret[48]; - * opaque client_random[32]; - * opaque server_random[32]; - * } SecurityParameters; - * - * Note that this definition is from TLS 1.2. In TLS 1.0 some of these - * parameters are ignored because, for instance, the PRFAlgorithm is a - * builtin-fixed algorithm combining iterations of MD5 and SHA-1 in TLS 1.0. - * - * The Record Protocol requires an algorithm to generate keys required by the - * current connection state. - * - * The master secret is expanded into a sequence of secure bytes, which is then - * split to a client write MAC key, a server write MAC key, a client write - * encryption key, and a server write encryption key. In TLS 1.0 a client write - * IV and server write IV are also generated. Each of these is generated from - * the byte sequence in that order. Unused values are empty. In TLS 1.2, some - * AEAD ciphers may additionally require a client write IV and a server write - * IV (see Section 6.2.3.3). - * - * When keys, MAC keys, and IVs are generated, the master secret is used as an - * entropy source. - * - * To generate the key material, compute: - * - * master_secret = PRF(pre_master_secret, "master secret", - * ClientHello.random + ServerHello.random) - * - * key_block = PRF(SecurityParameters.master_secret, - * "key expansion", - * SecurityParameters.server_random + - * SecurityParameters.client_random); - * - * until enough output has been generated. Then, the key_block is - * partitioned as follows: - * - * client_write_MAC_key[SecurityParameters.mac_key_length] - * server_write_MAC_key[SecurityParameters.mac_key_length] - * client_write_key[SecurityParameters.enc_key_length] - * server_write_key[SecurityParameters.enc_key_length] - * client_write_IV[SecurityParameters.fixed_iv_length] - * server_write_IV[SecurityParameters.fixed_iv_length] - * - * In TLS 1.2, the client_write_IV and server_write_IV are only generated for - * implicit nonce techniques as described in Section 3.2.1 of [AEAD]. This - * implementation uses TLS 1.0 so IVs are generated. - * - * Implementation note: The currently defined cipher suite which requires the - * most material is AES_256_CBC_SHA256. It requires 2 x 32 byte keys and 2 x 32 - * byte MAC keys, for a total 128 bytes of key material. In TLS 1.0 it also - * requires 2 x 16 byte IVs, so it actually takes 160 bytes of key material. - * - * @param c the connection. - * @param sp the security parameters to use. - * - * @return the security keys. - */ -tls.generateKeys = function(c, sp) { - // TLS_RSA_WITH_AES_128_CBC_SHA (required to be compliant with TLS 1.2) & - // TLS_RSA_WITH_AES_256_CBC_SHA are the only cipher suites implemented - // at present - - // TLS_DHE_DSS_WITH_3DES_EDE_CBC_SHA is required to be compliant with - // TLS 1.0 but we don't care right now because AES is better and we have - // an implementation for it - - // TODO: TLS 1.2 implementation - /* - // determine the PRF - var prf; - switch(sp.prf_algorithm) { - case tls.PRFAlgorithm.tls_prf_sha256: - prf = prf_sha256; - break; - default: - // should never happen - throw new Error('Invalid PRF'); - } - */ - - // TLS 1.0/1.1 implementation - var prf = prf_TLS1; - - // concatenate server and client random - var random = sp.client_random + sp.server_random; - - // only create master secret if session is new - if(!c.session.resuming) { - // create master secret, clean up pre-master secret - sp.master_secret = prf( - sp.pre_master_secret, 'master secret', random, 48).bytes(); - sp.pre_master_secret = null; - } - - // generate the amount of key material needed - random = sp.server_random + sp.client_random; - var length = 2 * sp.mac_key_length + 2 * sp.enc_key_length; - - // include IV for TLS/1.0 - var tls10 = (c.version.major === tls.Versions.TLS_1_0.major && - c.version.minor === tls.Versions.TLS_1_0.minor); - if(tls10) { - length += 2 * sp.fixed_iv_length; - } - var km = prf(sp.master_secret, 'key expansion', random, length); - - // split the key material into the MAC and encryption keys - var rval = { - client_write_MAC_key: km.getBytes(sp.mac_key_length), - server_write_MAC_key: km.getBytes(sp.mac_key_length), - client_write_key: km.getBytes(sp.enc_key_length), - server_write_key: km.getBytes(sp.enc_key_length) - }; - - // include TLS 1.0 IVs - if(tls10) { - rval.client_write_IV = km.getBytes(sp.fixed_iv_length); - rval.server_write_IV = km.getBytes(sp.fixed_iv_length); - } - - return rval; -}; - -/** - * Creates a new initialized TLS connection state. A connection state has - * a read mode and a write mode. - * - * compression state: - * The current state of the compression algorithm. - * - * cipher state: - * The current state of the encryption algorithm. This will consist of the - * scheduled key for that connection. For stream ciphers, this will also - * contain whatever state information is necessary to allow the stream to - * continue to encrypt or decrypt data. - * - * MAC key: - * The MAC key for the connection. - * - * sequence number: - * Each connection state contains a sequence number, which is maintained - * separately for read and write states. The sequence number MUST be set to - * zero whenever a connection state is made the active state. Sequence - * numbers are of type uint64 and may not exceed 2^64-1. Sequence numbers do - * not wrap. If a TLS implementation would need to wrap a sequence number, - * it must renegotiate instead. A sequence number is incremented after each - * record: specifically, the first record transmitted under a particular - * connection state MUST use sequence number 0. - * - * @param c the connection. - * - * @return the new initialized TLS connection state. - */ -tls.createConnectionState = function(c) { - var client = (c.entity === tls.ConnectionEnd.client); - - var createMode = function() { - var mode = { - // two 32-bit numbers, first is most significant - sequenceNumber: [0, 0], - macKey: null, - macLength: 0, - macFunction: null, - cipherState: null, - cipherFunction: function(record) {return true;}, - compressionState: null, - compressFunction: function(record) {return true;}, - updateSequenceNumber: function() { - if(mode.sequenceNumber[1] === 0xFFFFFFFF) { - mode.sequenceNumber[1] = 0; - ++mode.sequenceNumber[0]; - } else { - ++mode.sequenceNumber[1]; - } - } - }; - return mode; - }; - var state = { - read: createMode(), - write: createMode() - }; - - // update function in read mode will decrypt then decompress a record - state.read.update = function(c, record) { - if(!state.read.cipherFunction(record, state.read)) { - c.error(c, { - message: 'Could not decrypt record or bad MAC.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - // doesn't matter if decryption failed or MAC was - // invalid, return the same error so as not to reveal - // which one occurred - description: tls.Alert.Description.bad_record_mac - } - }); - } else if(!state.read.compressFunction(c, record, state.read)) { - c.error(c, { - message: 'Could not decompress record.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.decompression_failure - } - }); - } - return !c.fail; - }; - - // update function in write mode will compress then encrypt a record - state.write.update = function(c, record) { - if(!state.write.compressFunction(c, record, state.write)) { - // error, but do not send alert since it would require - // compression as well - c.error(c, { - message: 'Could not compress record.', - send: false, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } else if(!state.write.cipherFunction(record, state.write)) { - // error, but do not send alert since it would require - // encryption as well - c.error(c, { - message: 'Could not encrypt record.', - send: false, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - return !c.fail; - }; - - // handle security parameters - if(c.session) { - var sp = c.session.sp; - c.session.cipherSuite.initSecurityParameters(sp); - - // generate keys - sp.keys = tls.generateKeys(c, sp); - state.read.macKey = client ? - sp.keys.server_write_MAC_key : sp.keys.client_write_MAC_key; - state.write.macKey = client ? - sp.keys.client_write_MAC_key : sp.keys.server_write_MAC_key; - - // cipher suite setup - c.session.cipherSuite.initConnectionState(state, c, sp); - - // compression setup - switch(sp.compression_algorithm) { - case tls.CompressionMethod.none: - break; - case tls.CompressionMethod.deflate: - state.read.compressFunction = inflate; - state.write.compressFunction = deflate; - break; - default: - throw new Error('Unsupported compression algorithm.'); - } - } - - return state; -}; - -/** - * Creates a Random structure. - * - * struct { - * uint32 gmt_unix_time; - * opaque random_bytes[28]; - * } Random; - * - * gmt_unix_time: - * The current time and date in standard UNIX 32-bit format (seconds since - * the midnight starting Jan 1, 1970, UTC, ignoring leap seconds) according - * to the sender's internal clock. Clocks are not required to be set - * correctly by the basic TLS protocol; higher-level or application - * protocols may define additional requirements. Note that, for historical - * reasons, the data element is named using GMT, the predecessor of the - * current worldwide time base, UTC. - * random_bytes: - * 28 bytes generated by a secure random number generator. - * - * @return the Random structure as a byte array. - */ -tls.createRandom = function() { - // get UTC milliseconds - var d = new Date(); - var utc = +d + d.getTimezoneOffset() * 60000; - var rval = forge.util.createBuffer(); - rval.putInt32(utc); - rval.putBytes(forge.random.getBytes(28)); - return rval; -}; - -/** - * Creates a TLS record with the given type and data. - * - * @param c the connection. - * @param options: - * type: the record type. - * data: the plain text data in a byte buffer. - * - * @return the created record. - */ -tls.createRecord = function(c, options) { - if(!options.data) { - return null; - } - var record = { - type: options.type, - version: { - major: c.version.major, - minor: c.version.minor - }, - length: options.data.length(), - fragment: options.data - }; - return record; -}; - -/** - * Creates a TLS alert record. - * - * @param c the connection. - * @param alert: - * level: the TLS alert level. - * description: the TLS alert description. - * - * @return the created alert record. - */ -tls.createAlert = function(c, alert) { - var b = forge.util.createBuffer(); - b.putByte(alert.level); - b.putByte(alert.description); - return tls.createRecord(c, { - type: tls.ContentType.alert, - data: b - }); -}; - -/* The structure of a TLS handshake message. - * - * struct { - * HandshakeType msg_type; // handshake type - * uint24 length; // bytes in message - * select(HandshakeType) { - * case hello_request: HelloRequest; - * case client_hello: ClientHello; - * case server_hello: ServerHello; - * case certificate: Certificate; - * case server_key_exchange: ServerKeyExchange; - * case certificate_request: CertificateRequest; - * case server_hello_done: ServerHelloDone; - * case certificate_verify: CertificateVerify; - * case client_key_exchange: ClientKeyExchange; - * case finished: Finished; - * } body; - * } Handshake; - */ - -/** - * Creates a ClientHello message. - * - * opaque SessionID<0..32>; - * enum { null(0), deflate(1), (255) } CompressionMethod; - * uint8 CipherSuite[2]; - * - * struct { - * ProtocolVersion client_version; - * Random random; - * SessionID session_id; - * CipherSuite cipher_suites<2..2^16-2>; - * CompressionMethod compression_methods<1..2^8-1>; - * select(extensions_present) { - * case false: - * struct {}; - * case true: - * Extension extensions<0..2^16-1>; - * }; - * } ClientHello; - * - * The extension format for extended client hellos and server hellos is: - * - * struct { - * ExtensionType extension_type; - * opaque extension_data<0..2^16-1>; - * } Extension; - * - * Here: - * - * - "extension_type" identifies the particular extension type. - * - "extension_data" contains information specific to the particular - * extension type. - * - * The extension types defined in this document are: - * - * enum { - * server_name(0), max_fragment_length(1), - * client_certificate_url(2), trusted_ca_keys(3), - * truncated_hmac(4), status_request(5), (65535) - * } ExtensionType; - * - * @param c the connection. - * - * @return the ClientHello byte buffer. - */ -tls.createClientHello = function(c) { - // save hello version - c.session.clientHelloVersion = { - major: c.version.major, - minor: c.version.minor - }; - - // create supported cipher suites - var cipherSuites = forge.util.createBuffer(); - for(var i = 0; i < c.cipherSuites.length; ++i) { - var cs = c.cipherSuites[i]; - cipherSuites.putByte(cs.id[0]); - cipherSuites.putByte(cs.id[1]); - } - var cSuites = cipherSuites.length(); - - // create supported compression methods, null always supported, but - // also support deflate if connection has inflate and deflate methods - var compressionMethods = forge.util.createBuffer(); - compressionMethods.putByte(tls.CompressionMethod.none); - // FIXME: deflate support disabled until issues with raw deflate data - // without zlib headers are resolved - /* - if(c.inflate !== null && c.deflate !== null) { - compressionMethods.putByte(tls.CompressionMethod.deflate); - } - */ - var cMethods = compressionMethods.length(); - - // create TLS SNI (server name indication) extension if virtual host - // has been specified, see RFC 3546 - var extensions = forge.util.createBuffer(); - if(c.virtualHost) { - // create extension struct - var ext = forge.util.createBuffer(); - ext.putByte(0x00); // type server_name (ExtensionType is 2 bytes) - ext.putByte(0x00); - - /* In order to provide the server name, clients MAY include an - * extension of type "server_name" in the (extended) client hello. - * The "extension_data" field of this extension SHALL contain - * "ServerNameList" where: - * - * struct { - * NameType name_type; - * select(name_type) { - * case host_name: HostName; - * } name; - * } ServerName; - * - * enum { - * host_name(0), (255) - * } NameType; - * - * opaque HostName<1..2^16-1>; - * - * struct { - * ServerName server_name_list<1..2^16-1> - * } ServerNameList; - */ - var serverName = forge.util.createBuffer(); - serverName.putByte(0x00); // type host_name - writeVector(serverName, 2, forge.util.createBuffer(c.virtualHost)); - - // ServerNameList is in extension_data - var snList = forge.util.createBuffer(); - writeVector(snList, 2, serverName); - writeVector(ext, 2, snList); - extensions.putBuffer(ext); - } - var extLength = extensions.length(); - if(extLength > 0) { - // add extension vector length - extLength += 2; - } - - // determine length of the handshake message - // cipher suites and compression methods size will need to be - // updated if more get added to the list - var sessionId = c.session.id; - var length = - sessionId.length + 1 + // session ID vector - 2 + // version (major + minor) - 4 + 28 + // random time and random bytes - 2 + cSuites + // cipher suites vector - 1 + cMethods + // compression methods vector - extLength; // extensions vector - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.client_hello); - rval.putInt24(length); // handshake length - rval.putByte(c.version.major); // major version - rval.putByte(c.version.minor); // minor version - rval.putBytes(c.session.sp.client_random); // random time + bytes - writeVector(rval, 1, forge.util.createBuffer(sessionId)); - writeVector(rval, 2, cipherSuites); - writeVector(rval, 1, compressionMethods); - if(extLength > 0) { - writeVector(rval, 2, extensions); - } - return rval; -}; - -/** - * Creates a ServerHello message. - * - * @param c the connection. - * - * @return the ServerHello byte buffer. - */ -tls.createServerHello = function(c) { - // determine length of the handshake message - var sessionId = c.session.id; - var length = - sessionId.length + 1 + // session ID vector - 2 + // version (major + minor) - 4 + 28 + // random time and random bytes - 2 + // chosen cipher suite - 1; // chosen compression method - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.server_hello); - rval.putInt24(length); // handshake length - rval.putByte(c.version.major); // major version - rval.putByte(c.version.minor); // minor version - rval.putBytes(c.session.sp.server_random); // random time + bytes - writeVector(rval, 1, forge.util.createBuffer(sessionId)); - rval.putByte(c.session.cipherSuite.id[0]); - rval.putByte(c.session.cipherSuite.id[1]); - rval.putByte(c.session.compressionMethod); - return rval; -}; - -/** - * Creates a Certificate message. - * - * When this message will be sent: - * This is the first message the client can send after receiving a server - * hello done message and the first message the server can send after - * sending a ServerHello. This client message is only sent if the server - * requests a certificate. If no suitable certificate is available, the - * client should send a certificate message containing no certificates. If - * client authentication is required by the server for the handshake to - * continue, it may respond with a fatal handshake failure alert. - * - * opaque ASN.1Cert<1..2^24-1>; - * - * struct { - * ASN.1Cert certificate_list<0..2^24-1>; - * } Certificate; - * - * @param c the connection. - * - * @return the Certificate byte buffer. - */ -tls.createCertificate = function(c) { - // TODO: check certificate request to ensure types are supported - - // get a certificate (a certificate as a PEM string) - var client = (c.entity === tls.ConnectionEnd.client); - var cert = null; - if(c.getCertificate) { - var hint; - if(client) { - hint = c.session.certificateRequest; - } else { - hint = c.session.extensions.server_name.serverNameList; - } - cert = c.getCertificate(c, hint); - } - - // buffer to hold certificate list - var certList = forge.util.createBuffer(); - if(cert !== null) { - try { - // normalize cert to a chain of certificates - if(!forge.util.isArray(cert)) { - cert = [cert]; - } - var asn1 = null; - for(var i = 0; i < cert.length; ++i) { - var msg = forge.pem.decode(cert[i])[0]; - if(msg.type !== 'CERTIFICATE' && - msg.type !== 'X509 CERTIFICATE' && - msg.type !== 'TRUSTED CERTIFICATE') { - var error = new Error('Could not convert certificate from PEM; PEM ' + - 'header type is not "CERTIFICATE", "X509 CERTIFICATE", or ' + - '"TRUSTED CERTIFICATE".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert certificate from PEM; PEM is encrypted.'); - } - - var der = forge.util.createBuffer(msg.body); - if(asn1 === null) { - asn1 = forge.asn1.fromDer(der.bytes(), false); - } - - // certificate entry is itself a vector with 3 length bytes - var certBuffer = forge.util.createBuffer(); - writeVector(certBuffer, 3, der); - - // add cert vector to cert list vector - certList.putBuffer(certBuffer); - } - - // save certificate - cert = forge.pki.certificateFromAsn1(asn1); - if(client) { - c.session.clientCertificate = cert; - } else { - c.session.serverCertificate = cert; - } - } catch(ex) { - return c.error(c, { - message: 'Could not send certificate list.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - } - }); - } - } - - // determine length of the handshake message - var length = 3 + certList.length(); // cert list vector - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate); - rval.putInt24(length); - writeVector(rval, 3, certList); - return rval; -}; - -/** - * Creates a ClientKeyExchange message. - * - * When this message will be sent: - * This message is always sent by the client. It will immediately follow the - * client certificate message, if it is sent. Otherwise it will be the first - * message sent by the client after it receives the server hello done - * message. - * - * Meaning of this message: - * With this message, the premaster secret is set, either though direct - * transmission of the RSA-encrypted secret, or by the transmission of - * Diffie-Hellman parameters which will allow each side to agree upon the - * same premaster secret. When the key exchange method is DH_RSA or DH_DSS, - * client certification has been requested, and the client was able to - * respond with a certificate which contained a Diffie-Hellman public key - * whose parameters (group and generator) matched those specified by the - * server in its certificate, this message will not contain any data. - * - * Meaning of this message: - * If RSA is being used for key agreement and authentication, the client - * generates a 48-byte premaster secret, encrypts it using the public key - * from the server's certificate or the temporary RSA key provided in a - * server key exchange message, and sends the result in an encrypted - * premaster secret message. This structure is a variant of the client - * key exchange message, not a message in itself. - * - * struct { - * select(KeyExchangeAlgorithm) { - * case rsa: EncryptedPreMasterSecret; - * case diffie_hellman: ClientDiffieHellmanPublic; - * } exchange_keys; - * } ClientKeyExchange; - * - * struct { - * ProtocolVersion client_version; - * opaque random[46]; - * } PreMasterSecret; - * - * struct { - * public-key-encrypted PreMasterSecret pre_master_secret; - * } EncryptedPreMasterSecret; - * - * A public-key-encrypted element is encoded as a vector <0..2^16-1>. - * - * @param c the connection. - * - * @return the ClientKeyExchange byte buffer. - */ -tls.createClientKeyExchange = function(c) { - // create buffer to encrypt - var b = forge.util.createBuffer(); - - // add highest client-supported protocol to help server avoid version - // rollback attacks - b.putByte(c.session.clientHelloVersion.major); - b.putByte(c.session.clientHelloVersion.minor); - - // generate and add 46 random bytes - b.putBytes(forge.random.getBytes(46)); - - // save pre-master secret - var sp = c.session.sp; - sp.pre_master_secret = b.getBytes(); - - // RSA-encrypt the pre-master secret - var key = c.session.serverCertificate.publicKey; - b = key.encrypt(sp.pre_master_secret); - - /* Note: The encrypted pre-master secret will be stored in a - public-key-encrypted opaque vector that has the length prefixed using - 2 bytes, so include those 2 bytes in the handshake message length. This - is done as a minor optimization instead of calling writeVector(). */ - - // determine length of the handshake message - var length = b.length + 2; - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.client_key_exchange); - rval.putInt24(length); - // add vector length bytes - rval.putInt16(b.length); - rval.putBytes(b); - return rval; -}; - -/** - * Creates a ServerKeyExchange message. - * - * @param c the connection. - * - * @return the ServerKeyExchange byte buffer. - */ -tls.createServerKeyExchange = function(c) { - // this implementation only supports RSA, no Diffie-Hellman support, - // so this record is empty - - // determine length of the handshake message - var length = 0; - - // build record fragment - var rval = forge.util.createBuffer(); - if(length > 0) { - rval.putByte(tls.HandshakeType.server_key_exchange); - rval.putInt24(length); - } - return rval; -}; - -/** - * Gets the signed data used to verify a client-side certificate. See - * tls.createCertificateVerify() for details. - * - * @param c the connection. - * @param callback the callback to call once the signed data is ready. - */ -tls.getClientSignature = function(c, callback) { - // generate data to RSA encrypt - var b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - b = b.getBytes(); - - // create default signing function as necessary - c.getSignature = c.getSignature || function(c, b, callback) { - // do rsa encryption, call callback - var privateKey = null; - if(c.getPrivateKey) { - try { - privateKey = c.getPrivateKey(c, c.session.clientCertificate); - privateKey = forge.pki.privateKeyFromPem(privateKey); - } catch(ex) { - c.error(c, { - message: 'Could not get private key.', - cause: ex, - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } - } - if(privateKey === null) { - c.error(c, { - message: 'No private key set.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.internal_error - } - }); - } else { - b = privateKey.sign(b, null); - } - callback(c, b); - }; - - // get client signature - c.getSignature(c, b, callback); -}; - -/** - * Creates a CertificateVerify message. - * - * Meaning of this message: - * This structure conveys the client's Diffie-Hellman public value - * (Yc) if it was not already included in the client's certificate. - * The encoding used for Yc is determined by the enumerated - * PublicValueEncoding. This structure is a variant of the client - * key exchange message, not a message in itself. - * - * When this message will be sent: - * This message is used to provide explicit verification of a client - * certificate. This message is only sent following a client - * certificate that has signing capability (i.e. all certificates - * except those containing fixed Diffie-Hellman parameters). When - * sent, it will immediately follow the client key exchange message. - * - * struct { - * Signature signature; - * } CertificateVerify; - * - * CertificateVerify.signature.md5_hash - * MD5(handshake_messages); - * - * Certificate.signature.sha_hash - * SHA(handshake_messages); - * - * Here handshake_messages refers to all handshake messages sent or - * received starting at client hello up to but not including this - * message, including the type and length fields of the handshake - * messages. - * - * select(SignatureAlgorithm) { - * case anonymous: struct { }; - * case rsa: - * digitally-signed struct { - * opaque md5_hash[16]; - * opaque sha_hash[20]; - * }; - * case dsa: - * digitally-signed struct { - * opaque sha_hash[20]; - * }; - * } Signature; - * - * In digital signing, one-way hash functions are used as input for a - * signing algorithm. A digitally-signed element is encoded as an opaque - * vector <0..2^16-1>, where the length is specified by the signing - * algorithm and key. - * - * In RSA signing, a 36-byte structure of two hashes (one SHA and one - * MD5) is signed (encrypted with the private key). It is encoded with - * PKCS #1 block type 0 or type 1 as described in [PKCS1]. - * - * In DSS, the 20 bytes of the SHA hash are run directly through the - * Digital Signing Algorithm with no additional hashing. - * - * @param c the connection. - * @param signature the signature to include in the message. - * - * @return the CertificateVerify byte buffer. - */ -tls.createCertificateVerify = function(c, signature) { - /* Note: The signature will be stored in a "digitally-signed" opaque - vector that has the length prefixed using 2 bytes, so include those - 2 bytes in the handshake message length. This is done as a minor - optimization instead of calling writeVector(). */ - - // determine length of the handshake message - var length = signature.length + 2; - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate_verify); - rval.putInt24(length); - // add vector length bytes - rval.putInt16(signature.length); - rval.putBytes(signature); - return rval; -}; - -/** - * Creates a CertificateRequest message. - * - * @param c the connection. - * - * @return the CertificateRequest byte buffer. - */ -tls.createCertificateRequest = function(c) { - // TODO: support other certificate types - var certTypes = forge.util.createBuffer(); - - // common RSA certificate type - certTypes.putByte(0x01); - - // add distinguished names from CA store - var cAs = forge.util.createBuffer(); - for(var key in c.caStore.certs) { - var cert = c.caStore.certs[key]; - var dn = forge.pki.distinguishedNameToAsn1(cert.subject); - var byteBuffer = forge.asn1.toDer(dn); - cAs.putInt16(byteBuffer.length()); - cAs.putBuffer(byteBuffer); - } - - // TODO: TLS 1.2+ has a different format - - // determine length of the handshake message - var length = - 1 + certTypes.length() + - 2 + cAs.length(); - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.certificate_request); - rval.putInt24(length); - writeVector(rval, 1, certTypes); - writeVector(rval, 2, cAs); - return rval; -}; - -/** - * Creates a ServerHelloDone message. - * - * @param c the connection. - * - * @return the ServerHelloDone byte buffer. - */ -tls.createServerHelloDone = function(c) { - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.server_hello_done); - rval.putInt24(0); - return rval; -}; - -/** - * Creates a ChangeCipherSpec message. - * - * The change cipher spec protocol exists to signal transitions in - * ciphering strategies. The protocol consists of a single message, - * which is encrypted and compressed under the current (not the pending) - * connection state. The message consists of a single byte of value 1. - * - * struct { - * enum { change_cipher_spec(1), (255) } type; - * } ChangeCipherSpec; - * - * @return the ChangeCipherSpec byte buffer. - */ -tls.createChangeCipherSpec = function() { - var rval = forge.util.createBuffer(); - rval.putByte(0x01); - return rval; -}; - -/** - * Creates a Finished message. - * - * struct { - * opaque verify_data[12]; - * } Finished; - * - * verify_data - * PRF(master_secret, finished_label, MD5(handshake_messages) + - * SHA-1(handshake_messages)) [0..11]; - * - * finished_label - * For Finished messages sent by the client, the string "client - * finished". For Finished messages sent by the server, the - * string "server finished". - * - * handshake_messages - * All of the data from all handshake messages up to but not - * including this message. This is only data visible at the - * handshake layer and does not include record layer headers. - * This is the concatenation of all the Handshake structures as - * defined in 7.4 exchanged thus far. - * - * @param c the connection. - * - * @return the Finished byte buffer. - */ -tls.createFinished = function(c) { - // generate verify_data - var b = forge.util.createBuffer(); - b.putBuffer(c.session.md5.digest()); - b.putBuffer(c.session.sha1.digest()); - - // TODO: determine prf function and verify length for TLS 1.2 - var client = (c.entity === tls.ConnectionEnd.client); - var sp = c.session.sp; - var vdl = 12; - var prf = prf_TLS1; - var label = client ? 'client finished' : 'server finished'; - b = prf(sp.master_secret, label, b.getBytes(), vdl); - - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(tls.HandshakeType.finished); - rval.putInt24(b.length()); - rval.putBuffer(b); - return rval; -}; - -/** - * Creates a HeartbeatMessage (See RFC 6520). - * - * struct { - * HeartbeatMessageType type; - * uint16 payload_length; - * opaque payload[HeartbeatMessage.payload_length]; - * opaque padding[padding_length]; - * } HeartbeatMessage; - * - * The total length of a HeartbeatMessage MUST NOT exceed 2^14 or - * max_fragment_length when negotiated as defined in [RFC6066]. - * - * type: The message type, either heartbeat_request or heartbeat_response. - * - * payload_length: The length of the payload. - * - * payload: The payload consists of arbitrary content. - * - * padding: The padding is random content that MUST be ignored by the - * receiver. The length of a HeartbeatMessage is TLSPlaintext.length - * for TLS and DTLSPlaintext.length for DTLS. Furthermore, the - * length of the type field is 1 byte, and the length of the - * payload_length is 2. Therefore, the padding_length is - * TLSPlaintext.length - payload_length - 3 for TLS and - * DTLSPlaintext.length - payload_length - 3 for DTLS. The - * padding_length MUST be at least 16. - * - * The sender of a HeartbeatMessage MUST use a random padding of at - * least 16 bytes. The padding of a received HeartbeatMessage message - * MUST be ignored. - * - * If the payload_length of a received HeartbeatMessage is too large, - * the received HeartbeatMessage MUST be discarded silently. - * - * @param c the connection. - * @param type the tls.HeartbeatMessageType. - * @param payload the heartbeat data to send as the payload. - * @param [payloadLength] the payload length to use, defaults to the - * actual payload length. - * - * @return the HeartbeatRequest byte buffer. - */ -tls.createHeartbeat = function(type, payload, payloadLength) { - if(typeof payloadLength === 'undefined') { - payloadLength = payload.length; - } - // build record fragment - var rval = forge.util.createBuffer(); - rval.putByte(type); // heartbeat message type - rval.putInt16(payloadLength); // payload length - rval.putBytes(payload); // payload - // padding - var plaintextLength = rval.length(); - var paddingLength = Math.max(16, plaintextLength - payloadLength - 3); - rval.putBytes(forge.random.getBytes(paddingLength)); - return rval; -}; - -/** - * Fragments, compresses, encrypts, and queues a record for delivery. - * - * @param c the connection. - * @param record the record to queue. - */ -tls.queue = function(c, record) { - // error during record creation - if(!record) { - return; - } - - if(record.fragment.length() === 0) { - if(record.type === tls.ContentType.handshake || - record.type === tls.ContentType.alert || - record.type === tls.ContentType.change_cipher_spec) { - // Empty handshake, alert of change cipher spec messages are not allowed per the TLS specification and should not be sent. - return; - } - } - - // if the record is a handshake record, update handshake hashes - if(record.type === tls.ContentType.handshake) { - var bytes = record.fragment.bytes(); - c.session.md5.update(bytes); - c.session.sha1.update(bytes); - bytes = null; - } - - // handle record fragmentation - var records; - if(record.fragment.length() <= tls.MaxFragment) { - records = [record]; - } else { - // fragment data as long as it is too long - records = []; - var data = record.fragment.bytes(); - while(data.length > tls.MaxFragment) { - records.push(tls.createRecord(c, { - type: record.type, - data: forge.util.createBuffer(data.slice(0, tls.MaxFragment)) - })); - data = data.slice(tls.MaxFragment); - } - // add last record - if(data.length > 0) { - records.push(tls.createRecord(c, { - type: record.type, - data: forge.util.createBuffer(data) - })); - } - } - - // compress and encrypt all fragmented records - for(var i = 0; i < records.length && !c.fail; ++i) { - // update the record using current write state - var rec = records[i]; - var s = c.state.current.write; - if(s.update(c, rec)) { - // store record - c.records.push(rec); - } - } -}; - -/** - * Flushes all queued records to the output buffer and calls the - * tlsDataReady() handler on the given connection. - * - * @param c the connection. - * - * @return true on success, false on failure. - */ -tls.flush = function(c) { - for(var i = 0; i < c.records.length; ++i) { - var record = c.records[i]; - - // add record header and fragment - c.tlsData.putByte(record.type); - c.tlsData.putByte(record.version.major); - c.tlsData.putByte(record.version.minor); - c.tlsData.putInt16(record.fragment.length()); - c.tlsData.putBuffer(c.records[i].fragment); - } - c.records = []; - return c.tlsDataReady(c); -}; - -/** - * Maps a pki.certificateError to a tls.Alert.Description. - * - * @param error the error to map. - * - * @return the alert description. - */ -var _certErrorToAlertDesc = function(error) { - switch(error) { - case true: - return true; - case forge.pki.certificateError.bad_certificate: - return tls.Alert.Description.bad_certificate; - case forge.pki.certificateError.unsupported_certificate: - return tls.Alert.Description.unsupported_certificate; - case forge.pki.certificateError.certificate_revoked: - return tls.Alert.Description.certificate_revoked; - case forge.pki.certificateError.certificate_expired: - return tls.Alert.Description.certificate_expired; - case forge.pki.certificateError.certificate_unknown: - return tls.Alert.Description.certificate_unknown; - case forge.pki.certificateError.unknown_ca: - return tls.Alert.Description.unknown_ca; - default: - return tls.Alert.Description.bad_certificate; - } -}; - -/** - * Maps a tls.Alert.Description to a pki.certificateError. - * - * @param desc the alert description. - * - * @return the certificate error. - */ -var _alertDescToCertError = function(desc) { - switch(desc) { - case true: - return true; - case tls.Alert.Description.bad_certificate: - return forge.pki.certificateError.bad_certificate; - case tls.Alert.Description.unsupported_certificate: - return forge.pki.certificateError.unsupported_certificate; - case tls.Alert.Description.certificate_revoked: - return forge.pki.certificateError.certificate_revoked; - case tls.Alert.Description.certificate_expired: - return forge.pki.certificateError.certificate_expired; - case tls.Alert.Description.certificate_unknown: - return forge.pki.certificateError.certificate_unknown; - case tls.Alert.Description.unknown_ca: - return forge.pki.certificateError.unknown_ca; - default: - return forge.pki.certificateError.bad_certificate; - } -}; - -/** - * Verifies a certificate chain against the given connection's - * Certificate Authority store. - * - * @param c the TLS connection. - * @param chain the certificate chain to verify, with the root or highest - * authority at the end. - * - * @return true if successful, false if not. - */ -tls.verifyCertificateChain = function(c, chain) { - try { - // Make a copy of c.verifyOptions so that we can modify options.verify - // without modifying c.verifyOptions. - var options = {}; - for (var key in c.verifyOptions) { - options[key] = c.verifyOptions[key]; - } - - options.verify = function(vfd, depth, chain) { - // convert pki.certificateError to tls alert description - var desc = _certErrorToAlertDesc(vfd); - - // call application callback - var ret = c.verify(c, vfd, depth, chain); - if(ret !== true) { - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - // throw custom error - var error = new Error('The application rejected the certificate.'); - error.send = true; - error.alert = { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.bad_certificate - }; - if(ret.message) { - error.message = ret.message; - } - if(ret.alert) { - error.alert.description = ret.alert; - } - throw error; - } - - // convert tls alert description to pki.certificateError - if(ret !== vfd) { - ret = _alertDescToCertError(ret); - } - } - - return ret; - }; - - // verify chain - forge.pki.verifyCertificateChain(c.caStore, chain, options); - } catch(ex) { - // build tls error if not already customized - var err = ex; - if(typeof err !== 'object' || forge.util.isArray(err)) { - err = { - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: _certErrorToAlertDesc(ex) - } - }; - } - if(!('send' in err)) { - err.send = true; - } - if(!('alert' in err)) { - err.alert = { - level: tls.Alert.Level.fatal, - description: _certErrorToAlertDesc(err.error) - }; - } - - // send error - c.error(c, err); - } - - return !c.fail; -}; - -/** - * Creates a new TLS session cache. - * - * @param cache optional map of session ID to cached session. - * @param capacity the maximum size for the cache (default: 100). - * - * @return the new TLS session cache. - */ -tls.createSessionCache = function(cache, capacity) { - var rval = null; - - // assume input is already a session cache object - if(cache && cache.getSession && cache.setSession && cache.order) { - rval = cache; - } else { - // create cache - rval = {}; - rval.cache = cache || {}; - rval.capacity = Math.max(capacity || 100, 1); - rval.order = []; - - // store order for sessions, delete session overflow - for(var key in cache) { - if(rval.order.length <= capacity) { - rval.order.push(key); - } else { - delete cache[key]; - } - } - - // get a session from a session ID (or get any session) - rval.getSession = function(sessionId) { - var session = null; - var key = null; - - // if session ID provided, use it - if(sessionId) { - key = forge.util.bytesToHex(sessionId); - } else if(rval.order.length > 0) { - // get first session from cache - key = rval.order[0]; - } - - if(key !== null && key in rval.cache) { - // get cached session and remove from cache - session = rval.cache[key]; - delete rval.cache[key]; - for(var i in rval.order) { - if(rval.order[i] === key) { - rval.order.splice(i, 1); - break; - } - } - } - - return session; - }; - - // set a session in the cache - rval.setSession = function(sessionId, session) { - // remove session from cache if at capacity - if(rval.order.length === rval.capacity) { - var key = rval.order.shift(); - delete rval.cache[key]; - } - // add session to cache - var key = forge.util.bytesToHex(sessionId); - rval.order.push(key); - rval.cache[key] = session; - }; - } - - return rval; -}; - -/** - * Creates a new TLS connection. - * - * See public createConnection() docs for more details. - * - * @param options the options for this connection. - * - * @return the new TLS connection. - */ -tls.createConnection = function(options) { - var caStore = null; - if(options.caStore) { - // if CA store is an array, convert it to a CA store object - if(forge.util.isArray(options.caStore)) { - caStore = forge.pki.createCaStore(options.caStore); - } else { - caStore = options.caStore; - } - } else { - // create empty CA store - caStore = forge.pki.createCaStore(); - } - - // setup default cipher suites - var cipherSuites = options.cipherSuites || null; - if(cipherSuites === null) { - cipherSuites = []; - for(var key in tls.CipherSuites) { - cipherSuites.push(tls.CipherSuites[key]); - } - } - - // set default entity - var entity = (options.server || false) ? - tls.ConnectionEnd.server : tls.ConnectionEnd.client; - - // create session cache if requested - var sessionCache = options.sessionCache ? - tls.createSessionCache(options.sessionCache) : null; - - // create TLS connection - var c = { - version: {major: tls.Version.major, minor: tls.Version.minor}, - entity: entity, - sessionId: options.sessionId, - caStore: caStore, - sessionCache: sessionCache, - cipherSuites: cipherSuites, - connected: options.connected, - virtualHost: options.virtualHost || null, - verifyClient: options.verifyClient || false, - verify: options.verify || function(cn, vfd, dpth, cts) {return vfd;}, - verifyOptions: options.verifyOptions || {}, - getCertificate: options.getCertificate || null, - getPrivateKey: options.getPrivateKey || null, - getSignature: options.getSignature || null, - input: forge.util.createBuffer(), - tlsData: forge.util.createBuffer(), - data: forge.util.createBuffer(), - tlsDataReady: options.tlsDataReady, - dataReady: options.dataReady, - heartbeatReceived: options.heartbeatReceived, - closed: options.closed, - error: function(c, ex) { - // set origin if not set - ex.origin = ex.origin || - ((c.entity === tls.ConnectionEnd.client) ? 'client' : 'server'); - - // send TLS alert - if(ex.send) { - tls.queue(c, tls.createAlert(c, ex.alert)); - tls.flush(c); - } - - // error is fatal by default - var fatal = (ex.fatal !== false); - if(fatal) { - // set fail flag - c.fail = true; - } - - // call error handler first - options.error(c, ex); - - if(fatal) { - // fatal error, close connection, do not clear fail - c.close(false); - } - }, - deflate: options.deflate || null, - inflate: options.inflate || null - }; - - /** - * Resets a closed TLS connection for reuse. Called in c.close(). - * - * @param clearFail true to clear the fail flag (default: true). - */ - c.reset = function(clearFail) { - c.version = {major: tls.Version.major, minor: tls.Version.minor}; - c.record = null; - c.session = null; - c.peerCertificate = null; - c.state = { - pending: null, - current: null - }; - c.expect = (c.entity === tls.ConnectionEnd.client) ? SHE : CHE; - c.fragmented = null; - c.records = []; - c.open = false; - c.handshakes = 0; - c.handshaking = false; - c.isConnected = false; - c.fail = !(clearFail || typeof(clearFail) === 'undefined'); - c.input.clear(); - c.tlsData.clear(); - c.data.clear(); - c.state.current = tls.createConnectionState(c); - }; - - // do initial reset of connection - c.reset(); - - /** - * Updates the current TLS engine state based on the given record. - * - * @param c the TLS connection. - * @param record the TLS record to act on. - */ - var _update = function(c, record) { - // get record handler (align type in table by subtracting lowest) - var aligned = record.type - tls.ContentType.change_cipher_spec; - var handlers = ctTable[c.entity][c.expect]; - if(aligned in handlers) { - handlers[aligned](c, record); - } else { - // unexpected record - tls.handleUnexpected(c, record); - } - }; - - /** - * Reads the record header and initializes the next record on the given - * connection. - * - * @param c the TLS connection with the next record. - * - * @return 0 if the input data could be processed, otherwise the - * number of bytes required for data to be processed. - */ - var _readRecordHeader = function(c) { - var rval = 0; - - // get input buffer and its length - var b = c.input; - var len = b.length(); - - // need at least 5 bytes to initialize a record - if(len < 5) { - rval = 5 - len; - } else { - // enough bytes for header - // initialize record - c.record = { - type: b.getByte(), - version: { - major: b.getByte(), - minor: b.getByte() - }, - length: b.getInt16(), - fragment: forge.util.createBuffer(), - ready: false - }; - - // check record version - var compatibleVersion = (c.record.version.major === c.version.major); - if(compatibleVersion && c.session && c.session.version) { - // session version already set, require same minor version - compatibleVersion = (c.record.version.minor === c.version.minor); - } - if(!compatibleVersion) { - c.error(c, { - message: 'Incompatible TLS version.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: tls.Alert.Description.protocol_version - } - }); - } - } - - return rval; - }; - - /** - * Reads the next record's contents and appends its message to any - * previously fragmented message. - * - * @param c the TLS connection with the next record. - * - * @return 0 if the input data could be processed, otherwise the - * number of bytes required for data to be processed. - */ - var _readRecord = function(c) { - var rval = 0; - - // ensure there is enough input data to get the entire record - var b = c.input; - var len = b.length(); - if(len < c.record.length) { - // not enough data yet, return how much is required - rval = c.record.length - len; - } else { - // there is enough data to parse the pending record - // fill record fragment and compact input buffer - c.record.fragment.putBytes(b.getBytes(c.record.length)); - b.compact(); - - // update record using current read state - var s = c.state.current.read; - if(s.update(c, c.record)) { - // see if there is a previously fragmented message that the - // new record's message fragment should be appended to - if(c.fragmented !== null) { - // if the record type matches a previously fragmented - // record, append the record fragment to it - if(c.fragmented.type === c.record.type) { - // concatenate record fragments - c.fragmented.fragment.putBuffer(c.record.fragment); - c.record = c.fragmented; - } else { - // error, invalid fragmented record - c.error(c, { - message: 'Invalid fragmented record.', - send: true, - alert: { - level: tls.Alert.Level.fatal, - description: - tls.Alert.Description.unexpected_message - } - }); - } - } - - // record is now ready - c.record.ready = true; - } - } - - return rval; - }; - - /** - * Performs a handshake using the TLS Handshake Protocol, as a client. - * - * This method should only be called if the connection is in client mode. - * - * @param sessionId the session ID to use, null to start a new one. - */ - c.handshake = function(sessionId) { - // error to call this in non-client mode - if(c.entity !== tls.ConnectionEnd.client) { - // not fatal error - c.error(c, { - message: 'Cannot initiate handshake as a server.', - fatal: false - }); - } else if(c.handshaking) { - // handshake is already in progress, fail but not fatal error - c.error(c, { - message: 'Handshake already in progress.', - fatal: false - }); - } else { - // clear fail flag on reuse - if(c.fail && !c.open && c.handshakes === 0) { - c.fail = false; - } - - // now handshaking - c.handshaking = true; - - // default to blank (new session) - sessionId = sessionId || ''; - - // if a session ID was specified, try to find it in the cache - var session = null; - if(sessionId.length > 0) { - if(c.sessionCache) { - session = c.sessionCache.getSession(sessionId); - } - - // matching session not found in cache, clear session ID - if(session === null) { - sessionId = ''; - } - } - - // no session given, grab a session from the cache, if available - if(sessionId.length === 0 && c.sessionCache) { - session = c.sessionCache.getSession(); - if(session !== null) { - sessionId = session.id; - } - } - - // set up session - c.session = { - id: sessionId, - version: null, - cipherSuite: null, - compressionMethod: null, - serverCertificate: null, - certificateRequest: null, - clientCertificate: null, - sp: {}, - md5: forge.md.md5.create(), - sha1: forge.md.sha1.create() - }; - - // use existing session information - if(session) { - // only update version on connection, session version not yet set - c.version = session.version; - c.session.sp = session.sp; - } - - // generate new client random - c.session.sp.client_random = tls.createRandom().getBytes(); - - // connection now open - c.open = true; - - // send hello - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.handshake, - data: tls.createClientHello(c) - })); - tls.flush(c); - } - }; - - /** - * Called when TLS protocol data has been received from somewhere and should - * be processed by the TLS engine. - * - * @param data the TLS protocol data, as a string, to process. - * - * @return 0 if the data could be processed, otherwise the number of bytes - * required for data to be processed. - */ - c.process = function(data) { - var rval = 0; - - // buffer input data - if(data) { - c.input.putBytes(data); - } - - // process next record if no failure, process will be called after - // each record is handled (since handling can be asynchronous) - if(!c.fail) { - // reset record if ready and now empty - if(c.record !== null && - c.record.ready && c.record.fragment.isEmpty()) { - c.record = null; - } - - // if there is no pending record, try to read record header - if(c.record === null) { - rval = _readRecordHeader(c); - } - - // read the next record (if record not yet ready) - if(!c.fail && c.record !== null && !c.record.ready) { - rval = _readRecord(c); - } - - // record ready to be handled, update engine state - if(!c.fail && c.record !== null && c.record.ready) { - _update(c, c.record); - } - } - - return rval; - }; - - /** - * Requests that application data be packaged into a TLS record. The - * tlsDataReady handler will be called when the TLS record(s) have been - * prepared. - * - * @param data the application data, as a raw 'binary' encoded string, to - * be sent; to send utf-16/utf-8 string data, use the return value - * of util.encodeUtf8(str). - * - * @return true on success, false on failure. - */ - c.prepare = function(data) { - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.application_data, - data: forge.util.createBuffer(data) - })); - return tls.flush(c); - }; - - /** - * Requests that a heartbeat request be packaged into a TLS record for - * transmission. The tlsDataReady handler will be called when TLS record(s) - * have been prepared. - * - * When a heartbeat response has been received, the heartbeatReceived - * handler will be called with the matching payload. This handler can - * be used to clear a retransmission timer, etc. - * - * @param payload the heartbeat data to send as the payload in the message. - * @param [payloadLength] the payload length to use, defaults to the - * actual payload length. - * - * @return true on success, false on failure. - */ - c.prepareHeartbeatRequest = function(payload, payloadLength) { - if(payload instanceof forge.util.ByteBuffer) { - payload = payload.bytes(); - } - if(typeof payloadLength === 'undefined') { - payloadLength = payload.length; - } - c.expectedHeartbeatPayload = payload; - tls.queue(c, tls.createRecord(c, { - type: tls.ContentType.heartbeat, - data: tls.createHeartbeat( - tls.HeartbeatMessageType.heartbeat_request, payload, payloadLength) - })); - return tls.flush(c); - }; - - /** - * Closes the connection (sends a close_notify alert). - * - * @param clearFail true to clear the fail flag (default: true). - */ - c.close = function(clearFail) { - // save session if connection didn't fail - if(!c.fail && c.sessionCache && c.session) { - // only need to preserve session ID, version, and security params - var session = { - id: c.session.id, - version: c.session.version, - sp: c.session.sp - }; - session.sp.keys = null; - c.sessionCache.setSession(session.id, session); - } - - if(c.open) { - // connection no longer open, clear input - c.open = false; - c.input.clear(); - - // if connected or handshaking, send an alert - if(c.isConnected || c.handshaking) { - c.isConnected = c.handshaking = false; - - // send close_notify alert - tls.queue(c, tls.createAlert(c, { - level: tls.Alert.Level.warning, - description: tls.Alert.Description.close_notify - })); - tls.flush(c); - } - - // call handler - c.closed(c); - } - - // reset TLS connection, do not clear fail flag - c.reset(clearFail); - }; - - return c; -}; - -/* TLS API */ -module.exports = forge.tls = forge.tls || {}; - -// expose non-functions -for(var key in tls) { - if(typeof tls[key] !== 'function') { - forge.tls[key] = tls[key]; - } -} - -// expose prf_tls1 for testing -forge.tls.prf_tls1 = prf_TLS1; - -// expose sha1 hmac method -forge.tls.hmac_sha1 = hmac_sha1; - -// expose session cache creation -forge.tls.createSessionCache = tls.createSessionCache; - -/** - * Creates a new TLS connection. This does not make any assumptions about the - * transport layer that TLS is working on top of, ie: it does not assume there - * is a TCP/IP connection or establish one. A TLS connection is totally - * abstracted away from the layer is runs on top of, it merely establishes a - * secure channel between a client" and a "server". - * - * A TLS connection contains 4 connection states: pending read and write, and - * current read and write. - * - * At initialization, the current read and write states will be null. Only once - * the security parameters have been set and the keys have been generated can - * the pending states be converted into current states. Current states will be - * updated for each record processed. - * - * A custom certificate verify callback may be provided to check information - * like the common name on the server's certificate. It will be called for - * every certificate in the chain. It has the following signature: - * - * variable func(c, certs, index, preVerify) - * Where: - * c The TLS connection - * verified Set to true if certificate was verified, otherwise the alert - * tls.Alert.Description for why the certificate failed. - * depth The current index in the chain, where 0 is the server's cert. - * certs The certificate chain, *NOTE* if the server was anonymous then - * the chain will be empty. - * - * The function returns true on success and on failure either the appropriate - * tls.Alert.Description or an object with 'alert' set to the appropriate - * tls.Alert.Description and 'message' set to a custom error message. If true - * is not returned then the connection will abort using, in order of - * availability, first the returned alert description, second the preVerify - * alert description, and lastly the default 'bad_certificate'. - * - * There are three callbacks that can be used to make use of client-side - * certificates where each takes the TLS connection as the first parameter: - * - * getCertificate(conn, hint) - * The second parameter is a hint as to which certificate should be - * returned. If the connection entity is a client, then the hint will be - * the CertificateRequest message from the server that is part of the - * TLS protocol. If the connection entity is a server, then it will be - * the servername list provided via an SNI extension the ClientHello, if - * one was provided (empty array if not). The hint can be examined to - * determine which certificate to use (advanced). Most implementations - * will just return a certificate. The return value must be a - * PEM-formatted certificate or an array of PEM-formatted certificates - * that constitute a certificate chain, with the first in the array/chain - * being the client's certificate. - * getPrivateKey(conn, certificate) - * The second parameter is an forge.pki X.509 certificate object that - * is associated with the requested private key. The return value must - * be a PEM-formatted private key. - * getSignature(conn, bytes, callback) - * This callback can be used instead of getPrivateKey if the private key - * is not directly accessible in javascript or should not be. For - * instance, a secure external web service could provide the signature - * in exchange for appropriate credentials. The second parameter is a - * string of bytes to be signed that are part of the TLS protocol. These - * bytes are used to verify that the private key for the previously - * provided client-side certificate is accessible to the client. The - * callback is a function that takes 2 parameters, the TLS connection - * and the RSA encrypted (signed) bytes as a string. This callback must - * be called once the signature is ready. - * - * @param options the options for this connection: - * server: true if the connection is server-side, false for client. - * sessionId: a session ID to reuse, null for a new connection. - * caStore: an array of certificates to trust. - * sessionCache: a session cache to use. - * cipherSuites: an optional array of cipher suites to use, - * see tls.CipherSuites. - * connected: function(conn) called when the first handshake completes. - * virtualHost: the virtual server name to use in a TLS SNI extension. - * verifyClient: true to require a client certificate in server mode, - * 'optional' to request one, false not to (default: false). - * verify: a handler used to custom verify certificates in the chain. - * verifyOptions: an object with options for the certificate chain validation. - * See documentation of pki.verifyCertificateChain for possible options. - * verifyOptions.verify is ignored. If you wish to specify a verify handler - * use the verify key. - * getCertificate: an optional callback used to get a certificate or - * a chain of certificates (as an array). - * getPrivateKey: an optional callback used to get a private key. - * getSignature: an optional callback used to get a signature. - * tlsDataReady: function(conn) called when TLS protocol data has been - * prepared and is ready to be used (typically sent over a socket - * connection to its destination), read from conn.tlsData buffer. - * dataReady: function(conn) called when application data has - * been parsed from a TLS record and should be consumed by the - * application, read from conn.data buffer. - * closed: function(conn) called when the connection has been closed. - * error: function(conn, error) called when there was an error. - * deflate: function(inBytes) if provided, will deflate TLS records using - * the deflate algorithm if the server supports it. - * inflate: function(inBytes) if provided, will inflate TLS records using - * the deflate algorithm if the server supports it. - * - * @return the new TLS connection. - */ -forge.tls.createConnection = tls.createConnection; diff --git a/reverse_engineering/node_modules/node-forge/lib/tlssocket.js b/reverse_engineering/node_modules/node-forge/lib/tlssocket.js deleted file mode 100644 index d09b6509..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/tlssocket.js +++ /dev/null @@ -1,249 +0,0 @@ -/** - * Socket wrapping functions for TLS. - * - * @author Dave Longley - * - * Copyright (c) 2009-2012 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./tls'); - -/** - * Wraps a forge.net socket with a TLS layer. - * - * @param options: - * sessionId: a session ID to reuse, null for a new connection if no session - * cache is provided or it is empty. - * caStore: an array of certificates to trust. - * sessionCache: a session cache to use. - * cipherSuites: an optional array of cipher suites to use, see - * tls.CipherSuites. - * socket: the socket to wrap. - * virtualHost: the virtual server name to use in a TLS SNI extension. - * verify: a handler used to custom verify certificates in the chain. - * getCertificate: an optional callback used to get a certificate. - * getPrivateKey: an optional callback used to get a private key. - * getSignature: an optional callback used to get a signature. - * deflate: function(inBytes) if provided, will deflate TLS records using - * the deflate algorithm if the server supports it. - * inflate: function(inBytes) if provided, will inflate TLS records using - * the deflate algorithm if the server supports it. - * - * @return the TLS-wrapped socket. - */ -forge.tls.wrapSocket = function(options) { - // get raw socket - var socket = options.socket; - - // create TLS socket - var tlsSocket = { - id: socket.id, - // set handlers - connected: socket.connected || function(e) {}, - closed: socket.closed || function(e) {}, - data: socket.data || function(e) {}, - error: socket.error || function(e) {} - }; - - // create TLS connection - var c = forge.tls.createConnection({ - server: false, - sessionId: options.sessionId || null, - caStore: options.caStore || [], - sessionCache: options.sessionCache || null, - cipherSuites: options.cipherSuites || null, - virtualHost: options.virtualHost, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature, - deflate: options.deflate, - inflate: options.inflate, - connected: function(c) { - // first handshake complete, call handler - if(c.handshakes === 1) { - tlsSocket.connected({ - id: socket.id, - type: 'connect', - bytesAvailable: c.data.length() - }); - } - }, - tlsDataReady: function(c) { - // send TLS data over socket - return socket.send(c.tlsData.getBytes()); - }, - dataReady: function(c) { - // indicate application data is ready - tlsSocket.data({ - id: socket.id, - type: 'socketData', - bytesAvailable: c.data.length() - }); - }, - closed: function(c) { - // close socket - socket.close(); - }, - error: function(c, e) { - // send error, close socket - tlsSocket.error({ - id: socket.id, - type: 'tlsError', - message: e.message, - bytesAvailable: 0, - error: e - }); - socket.close(); - } - }); - - // handle doing handshake after connecting - socket.connected = function(e) { - c.handshake(options.sessionId); - }; - - // handle closing TLS connection - socket.closed = function(e) { - if(c.open && c.handshaking) { - // error - tlsSocket.error({ - id: socket.id, - type: 'ioError', - message: 'Connection closed during handshake.', - bytesAvailable: 0 - }); - } - c.close(); - - // call socket handler - tlsSocket.closed({ - id: socket.id, - type: 'close', - bytesAvailable: 0 - }); - }; - - // handle error on socket - socket.error = function(e) { - // error - tlsSocket.error({ - id: socket.id, - type: e.type, - message: e.message, - bytesAvailable: 0 - }); - c.close(); - }; - - // handle receiving raw TLS data from socket - var _requiredBytes = 0; - socket.data = function(e) { - // drop data if connection not open - if(!c.open) { - socket.receive(e.bytesAvailable); - } else { - // only receive if there are enough bytes available to - // process a record - if(e.bytesAvailable >= _requiredBytes) { - var count = Math.max(e.bytesAvailable, _requiredBytes); - var data = socket.receive(count); - if(data !== null) { - _requiredBytes = c.process(data); - } - } - } - }; - - /** - * Destroys this socket. - */ - tlsSocket.destroy = function() { - socket.destroy(); - }; - - /** - * Sets this socket's TLS session cache. This should be called before - * the socket is connected or after it is closed. - * - * The cache is an object mapping session IDs to internal opaque state. - * An application might need to change the cache used by a particular - * tlsSocket between connections if it accesses multiple TLS hosts. - * - * @param cache the session cache to use. - */ - tlsSocket.setSessionCache = function(cache) { - c.sessionCache = tls.createSessionCache(cache); - }; - - /** - * Connects this socket. - * - * @param options: - * host: the host to connect to. - * port: the port to connect to. - * policyPort: the policy port to use (if non-default), 0 to - * use the flash default. - * policyUrl: the policy file URL to use (instead of port). - */ - tlsSocket.connect = function(options) { - socket.connect(options); - }; - - /** - * Closes this socket. - */ - tlsSocket.close = function() { - c.close(); - }; - - /** - * Determines if the socket is connected or not. - * - * @return true if connected, false if not. - */ - tlsSocket.isConnected = function() { - return c.isConnected && socket.isConnected(); - }; - - /** - * Writes bytes to this socket. - * - * @param bytes the bytes (as a string) to write. - * - * @return true on success, false on failure. - */ - tlsSocket.send = function(bytes) { - return c.prepare(bytes); - }; - - /** - * Reads bytes from this socket (non-blocking). Fewer than the number of - * bytes requested may be read if enough bytes are not available. - * - * This method should be called from the data handler if there are enough - * bytes available. To see how many bytes are available, check the - * 'bytesAvailable' property on the event in the data handler or call the - * bytesAvailable() function on the socket. If the browser is msie, then the - * bytesAvailable() function should be used to avoid race conditions. - * Otherwise, using the property on the data handler's event may be quicker. - * - * @param count the maximum number of bytes to read. - * - * @return the bytes read (as a string) or null on error. - */ - tlsSocket.receive = function(count) { - return c.data.getBytes(count); - }; - - /** - * Gets the number of bytes available for receiving on the socket. - * - * @return the number of bytes available for receiving. - */ - tlsSocket.bytesAvailable = function() { - return c.data.length(); - }; - - return tlsSocket; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/util.js b/reverse_engineering/node_modules/node-forge/lib/util.js deleted file mode 100644 index 98dfd342..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/util.js +++ /dev/null @@ -1,2907 +0,0 @@ -/** - * Utility functions for web applications. - * - * @author Dave Longley - * - * Copyright (c) 2010-2018 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -var baseN = require('./baseN'); - -/* Utilities API */ -var util = module.exports = forge.util = forge.util || {}; - -// define setImmediate and nextTick -(function() { - // use native nextTick (unless we're in webpack) - // webpack (or better node-libs-browser polyfill) sets process.browser. - // this way we can detect webpack properly - if(typeof process !== 'undefined' && process.nextTick && !process.browser) { - util.nextTick = process.nextTick; - if(typeof setImmediate === 'function') { - util.setImmediate = setImmediate; - } else { - // polyfill setImmediate with nextTick, older versions of node - // (those w/o setImmediate) won't totally starve IO - util.setImmediate = util.nextTick; - } - return; - } - - // polyfill nextTick with native setImmediate - if(typeof setImmediate === 'function') { - util.setImmediate = function() { return setImmediate.apply(undefined, arguments); }; - util.nextTick = function(callback) { - return setImmediate(callback); - }; - return; - } - - /* Note: A polyfill upgrade pattern is used here to allow combining - polyfills. For example, MutationObserver is fast, but blocks UI updates, - so it needs to allow UI updates periodically, so it falls back on - postMessage or setTimeout. */ - - // polyfill with setTimeout - util.setImmediate = function(callback) { - setTimeout(callback, 0); - }; - - // upgrade polyfill to use postMessage - if(typeof window !== 'undefined' && - typeof window.postMessage === 'function') { - var msg = 'forge.setImmediate'; - var callbacks = []; - util.setImmediate = function(callback) { - callbacks.push(callback); - // only send message when one hasn't been sent in - // the current turn of the event loop - if(callbacks.length === 1) { - window.postMessage(msg, '*'); - } - }; - function handler(event) { - if(event.source === window && event.data === msg) { - event.stopPropagation(); - var copy = callbacks.slice(); - callbacks.length = 0; - copy.forEach(function(callback) { - callback(); - }); - } - } - window.addEventListener('message', handler, true); - } - - // upgrade polyfill to use MutationObserver - if(typeof MutationObserver !== 'undefined') { - // polyfill with MutationObserver - var now = Date.now(); - var attr = true; - var div = document.createElement('div'); - var callbacks = []; - new MutationObserver(function() { - var copy = callbacks.slice(); - callbacks.length = 0; - copy.forEach(function(callback) { - callback(); - }); - }).observe(div, {attributes: true}); - var oldSetImmediate = util.setImmediate; - util.setImmediate = function(callback) { - if(Date.now() - now > 15) { - now = Date.now(); - oldSetImmediate(callback); - } else { - callbacks.push(callback); - // only trigger observer when it hasn't been triggered in - // the current turn of the event loop - if(callbacks.length === 1) { - div.setAttribute('a', attr = !attr); - } - } - }; - } - - util.nextTick = util.setImmediate; -})(); - -// check if running under Node.js -util.isNodejs = - typeof process !== 'undefined' && process.versions && process.versions.node; - - -// 'self' will also work in Web Workers (instance of WorkerGlobalScope) while -// it will point to `window` in the main thread. -// To remain compatible with older browsers, we fall back to 'window' if 'self' -// is not available. -util.globalScope = (function() { - if(util.isNodejs) { - return global; - } - - return typeof self === 'undefined' ? window : self; -})(); - -// define isArray -util.isArray = Array.isArray || function(x) { - return Object.prototype.toString.call(x) === '[object Array]'; -}; - -// define isArrayBuffer -util.isArrayBuffer = function(x) { - return typeof ArrayBuffer !== 'undefined' && x instanceof ArrayBuffer; -}; - -// define isArrayBufferView -util.isArrayBufferView = function(x) { - return x && util.isArrayBuffer(x.buffer) && x.byteLength !== undefined; -}; - -/** - * Ensure a bits param is 8, 16, 24, or 32. Used to validate input for - * algorithms where bit manipulation, JavaScript limitations, and/or algorithm - * design only allow for byte operations of a limited size. - * - * @param n number of bits. - * - * Throw Error if n invalid. - */ -function _checkBitsParam(n) { - if(!(n === 8 || n === 16 || n === 24 || n === 32)) { - throw new Error('Only 8, 16, 24, or 32 bits supported: ' + n); - } -} - -// TODO: set ByteBuffer to best available backing -util.ByteBuffer = ByteStringBuffer; - -/** Buffer w/BinaryString backing */ - -/** - * Constructor for a binary string backed byte buffer. - * - * @param [b] the bytes to wrap (either encoded as string, one byte per - * character, or as an ArrayBuffer or Typed Array). - */ -function ByteStringBuffer(b) { - // TODO: update to match DataBuffer API - - // the data in this buffer - this.data = ''; - // the pointer for reading from this buffer - this.read = 0; - - if(typeof b === 'string') { - this.data = b; - } else if(util.isArrayBuffer(b) || util.isArrayBufferView(b)) { - if(typeof Buffer !== 'undefined' && b instanceof Buffer) { - this.data = b.toString('binary'); - } else { - // convert native buffer to forge buffer - // FIXME: support native buffers internally instead - var arr = new Uint8Array(b); - try { - this.data = String.fromCharCode.apply(null, arr); - } catch(e) { - for(var i = 0; i < arr.length; ++i) { - this.putByte(arr[i]); - } - } - } - } else if(b instanceof ByteStringBuffer || - (typeof b === 'object' && typeof b.data === 'string' && - typeof b.read === 'number')) { - // copy existing buffer - this.data = b.data; - this.read = b.read; - } - - // used for v8 optimization - this._constructedStringLength = 0; -} -util.ByteStringBuffer = ByteStringBuffer; - -/* Note: This is an optimization for V8-based browsers. When V8 concatenates - a string, the strings are only joined logically using a "cons string" or - "constructed/concatenated string". These containers keep references to one - another and can result in very large memory usage. For example, if a 2MB - string is constructed by concatenating 4 bytes together at a time, the - memory usage will be ~44MB; so ~22x increase. The strings are only joined - together when an operation requiring their joining takes place, such as - substr(). This function is called when adding data to this buffer to ensure - these types of strings are periodically joined to reduce the memory - footprint. */ -var _MAX_CONSTRUCTED_STRING_LENGTH = 4096; -util.ByteStringBuffer.prototype._optimizeConstructedString = function(x) { - this._constructedStringLength += x; - if(this._constructedStringLength > _MAX_CONSTRUCTED_STRING_LENGTH) { - // this substr() should cause the constructed string to join - this.data.substr(0, 1); - this._constructedStringLength = 0; - } -}; - -/** - * Gets the number of bytes in this buffer. - * - * @return the number of bytes in this buffer. - */ -util.ByteStringBuffer.prototype.length = function() { - return this.data.length - this.read; -}; - -/** - * Gets whether or not this buffer is empty. - * - * @return true if this buffer is empty, false if not. - */ -util.ByteStringBuffer.prototype.isEmpty = function() { - return this.length() <= 0; -}; - -/** - * Puts a byte in this buffer. - * - * @param b the byte to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putByte = function(b) { - return this.putBytes(String.fromCharCode(b)); -}; - -/** - * Puts a byte in this buffer N times. - * - * @param b the byte to put. - * @param n the number of bytes of value b to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.fillWithByte = function(b, n) { - b = String.fromCharCode(b); - var d = this.data; - while(n > 0) { - if(n & 1) { - d += b; - } - n >>>= 1; - if(n > 0) { - b += b; - } - } - this.data = d; - this._optimizeConstructedString(n); - return this; -}; - -/** - * Puts bytes in this buffer. - * - * @param bytes the bytes (as a binary encoded string) to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putBytes = function(bytes) { - this.data += bytes; - this._optimizeConstructedString(bytes.length); - return this; -}; - -/** - * Puts a UTF-16 encoded string into this buffer. - * - * @param str the string to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putString = function(str) { - return this.putBytes(util.encodeUtf8(str)); -}; - -/** - * Puts a 16-bit integer in this buffer in big-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt16 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 24-bit integer in this buffer in big-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt24 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 32-bit integer in this buffer in big-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt32 = function(i) { - return this.putBytes( - String.fromCharCode(i >> 24 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -/** - * Puts a 16-bit integer in this buffer in little-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt16Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF)); -}; - -/** - * Puts a 24-bit integer in this buffer in little-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt24Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF)); -}; - -/** - * Puts a 32-bit integer in this buffer in little-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt32Le = function(i) { - return this.putBytes( - String.fromCharCode(i & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 24 & 0xFF)); -}; - -/** - * Puts an n-bit integer in this buffer in big-endian order. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putInt = function(i, n) { - _checkBitsParam(n); - var bytes = ''; - do { - n -= 8; - bytes += String.fromCharCode((i >> n) & 0xFF); - } while(n > 0); - return this.putBytes(bytes); -}; - -/** - * Puts a signed n-bit integer in this buffer in big-endian order. Two's - * complement representation is used. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putSignedInt = function(i, n) { - // putInt checks n - if(i < 0) { - i += 2 << (n - 1); - } - return this.putInt(i, n); -}; - -/** - * Puts the given buffer into this buffer. - * - * @param buffer the buffer to put into this one. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.putBuffer = function(buffer) { - return this.putBytes(buffer.getBytes()); -}; - -/** - * Gets a byte from this buffer and advances the read pointer by 1. - * - * @return the byte. - */ -util.ByteStringBuffer.prototype.getByte = function() { - return this.data.charCodeAt(this.read++); -}; - -/** - * Gets a uint16 from this buffer in big-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.ByteStringBuffer.prototype.getInt16 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 8 ^ - this.data.charCodeAt(this.read + 1)); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in big-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.ByteStringBuffer.prototype.getInt24 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 16 ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2)); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in big-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.ByteStringBuffer.prototype.getInt32 = function() { - var rval = ( - this.data.charCodeAt(this.read) << 24 ^ - this.data.charCodeAt(this.read + 1) << 16 ^ - this.data.charCodeAt(this.read + 2) << 8 ^ - this.data.charCodeAt(this.read + 3)); - this.read += 4; - return rval; -}; - -/** - * Gets a uint16 from this buffer in little-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.ByteStringBuffer.prototype.getInt16Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in little-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.ByteStringBuffer.prototype.getInt24Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2) << 16); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in little-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.ByteStringBuffer.prototype.getInt32Le = function() { - var rval = ( - this.data.charCodeAt(this.read) ^ - this.data.charCodeAt(this.read + 1) << 8 ^ - this.data.charCodeAt(this.read + 2) << 16 ^ - this.data.charCodeAt(this.read + 3) << 24); - this.read += 4; - return rval; -}; - -/** - * Gets an n-bit integer from this buffer in big-endian order and advances the - * read pointer by ceil(n/8). - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.ByteStringBuffer.prototype.getInt = function(n) { - _checkBitsParam(n); - var rval = 0; - do { - // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. - rval = (rval << 8) + this.data.charCodeAt(this.read++); - n -= 8; - } while(n > 0); - return rval; -}; - -/** - * Gets a signed n-bit integer from this buffer in big-endian order, using - * two's complement, and advances the read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.ByteStringBuffer.prototype.getSignedInt = function(n) { - // getInt checks n - var x = this.getInt(n); - var max = 2 << (n - 2); - if(x >= max) { - x -= max << 1; - } - return x; -}; - -/** - * Reads bytes out as a binary encoded string and clears them from the - * buffer. Note that the resulting string is binary encoded (in node.js this - * encoding is referred to as `binary`, it is *not* `utf8`). - * - * @param count the number of bytes to read, undefined or null for all. - * - * @return a binary encoded string of bytes. - */ -util.ByteStringBuffer.prototype.getBytes = function(count) { - var rval; - if(count) { - // read count bytes - count = Math.min(this.length(), count); - rval = this.data.slice(this.read, this.read + count); - this.read += count; - } else if(count === 0) { - rval = ''; - } else { - // read all bytes, optimize to only copy when needed - rval = (this.read === 0) ? this.data : this.data.slice(this.read); - this.clear(); - } - return rval; -}; - -/** - * Gets a binary encoded string of the bytes from this buffer without - * modifying the read pointer. - * - * @param count the number of bytes to get, omit to get all. - * - * @return a string full of binary encoded characters. - */ -util.ByteStringBuffer.prototype.bytes = function(count) { - return (typeof(count) === 'undefined' ? - this.data.slice(this.read) : - this.data.slice(this.read, this.read + count)); -}; - -/** - * Gets a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * - * @return the byte. - */ -util.ByteStringBuffer.prototype.at = function(i) { - return this.data.charCodeAt(this.read + i); -}; - -/** - * Puts a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * @param b the byte to put. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.setAt = function(i, b) { - this.data = this.data.substr(0, this.read + i) + - String.fromCharCode(b) + - this.data.substr(this.read + i + 1); - return this; -}; - -/** - * Gets the last byte without modifying the read pointer. - * - * @return the last byte. - */ -util.ByteStringBuffer.prototype.last = function() { - return this.data.charCodeAt(this.data.length - 1); -}; - -/** - * Creates a copy of this buffer. - * - * @return the copy. - */ -util.ByteStringBuffer.prototype.copy = function() { - var c = util.createBuffer(this.data); - c.read = this.read; - return c; -}; - -/** - * Compacts this buffer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.compact = function() { - if(this.read > 0) { - this.data = this.data.slice(this.read); - this.read = 0; - } - return this; -}; - -/** - * Clears this buffer. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.clear = function() { - this.data = ''; - this.read = 0; - return this; -}; - -/** - * Shortens this buffer by triming bytes off of the end of this buffer. - * - * @param count the number of bytes to trim off. - * - * @return this buffer. - */ -util.ByteStringBuffer.prototype.truncate = function(count) { - var len = Math.max(0, this.length() - count); - this.data = this.data.substr(this.read, len); - this.read = 0; - return this; -}; - -/** - * Converts this buffer to a hexadecimal string. - * - * @return a hexadecimal string. - */ -util.ByteStringBuffer.prototype.toHex = function() { - var rval = ''; - for(var i = this.read; i < this.data.length; ++i) { - var b = this.data.charCodeAt(i); - if(b < 16) { - rval += '0'; - } - rval += b.toString(16); - } - return rval; -}; - -/** - * Converts this buffer to a UTF-16 string (standard JavaScript string). - * - * @return a UTF-16 string. - */ -util.ByteStringBuffer.prototype.toString = function() { - return util.decodeUtf8(this.bytes()); -}; - -/** End Buffer w/BinaryString backing */ - -/** Buffer w/UInt8Array backing */ - -/** - * FIXME: Experimental. Do not use yet. - * - * Constructor for an ArrayBuffer-backed byte buffer. - * - * The buffer may be constructed from a string, an ArrayBuffer, DataView, or a - * TypedArray. - * - * If a string is given, its encoding should be provided as an option, - * otherwise it will default to 'binary'. A 'binary' string is encoded such - * that each character is one byte in length and size. - * - * If an ArrayBuffer, DataView, or TypedArray is given, it will be used - * *directly* without any copying. Note that, if a write to the buffer requires - * more space, the buffer will allocate a new backing ArrayBuffer to - * accommodate. The starting read and write offsets for the buffer may be - * given as options. - * - * @param [b] the initial bytes for this buffer. - * @param options the options to use: - * [readOffset] the starting read offset to use (default: 0). - * [writeOffset] the starting write offset to use (default: the - * length of the first parameter). - * [growSize] the minimum amount, in bytes, to grow the buffer by to - * accommodate writes (default: 1024). - * [encoding] the encoding ('binary', 'utf8', 'utf16', 'hex') for the - * first parameter, if it is a string (default: 'binary'). - */ -function DataBuffer(b, options) { - // default options - options = options || {}; - - // pointers for read from/write to buffer - this.read = options.readOffset || 0; - this.growSize = options.growSize || 1024; - - var isArrayBuffer = util.isArrayBuffer(b); - var isArrayBufferView = util.isArrayBufferView(b); - if(isArrayBuffer || isArrayBufferView) { - // use ArrayBuffer directly - if(isArrayBuffer) { - this.data = new DataView(b); - } else { - // TODO: adjust read/write offset based on the type of view - // or specify that this must be done in the options ... that the - // offsets are byte-based - this.data = new DataView(b.buffer, b.byteOffset, b.byteLength); - } - this.write = ('writeOffset' in options ? - options.writeOffset : this.data.byteLength); - return; - } - - // initialize to empty array buffer and add any given bytes using putBytes - this.data = new DataView(new ArrayBuffer(0)); - this.write = 0; - - if(b !== null && b !== undefined) { - this.putBytes(b); - } - - if('writeOffset' in options) { - this.write = options.writeOffset; - } -} -util.DataBuffer = DataBuffer; - -/** - * Gets the number of bytes in this buffer. - * - * @return the number of bytes in this buffer. - */ -util.DataBuffer.prototype.length = function() { - return this.write - this.read; -}; - -/** - * Gets whether or not this buffer is empty. - * - * @return true if this buffer is empty, false if not. - */ -util.DataBuffer.prototype.isEmpty = function() { - return this.length() <= 0; -}; - -/** - * Ensures this buffer has enough empty space to accommodate the given number - * of bytes. An optional parameter may be given that indicates a minimum - * amount to grow the buffer if necessary. If the parameter is not given, - * the buffer will be grown by some previously-specified default amount - * or heuristic. - * - * @param amount the number of bytes to accommodate. - * @param [growSize] the minimum amount, in bytes, to grow the buffer by if - * necessary. - */ -util.DataBuffer.prototype.accommodate = function(amount, growSize) { - if(this.length() >= amount) { - return this; - } - growSize = Math.max(growSize || this.growSize, amount); - - // grow buffer - var src = new Uint8Array( - this.data.buffer, this.data.byteOffset, this.data.byteLength); - var dst = new Uint8Array(this.length() + growSize); - dst.set(src); - this.data = new DataView(dst.buffer); - - return this; -}; - -/** - * Puts a byte in this buffer. - * - * @param b the byte to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putByte = function(b) { - this.accommodate(1); - this.data.setUint8(this.write++, b); - return this; -}; - -/** - * Puts a byte in this buffer N times. - * - * @param b the byte to put. - * @param n the number of bytes of value b to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.fillWithByte = function(b, n) { - this.accommodate(n); - for(var i = 0; i < n; ++i) { - this.data.setUint8(b); - } - return this; -}; - -/** - * Puts bytes in this buffer. The bytes may be given as a string, an - * ArrayBuffer, a DataView, or a TypedArray. - * - * @param bytes the bytes to put. - * @param [encoding] the encoding for the first parameter ('binary', 'utf8', - * 'utf16', 'hex'), if it is a string (default: 'binary'). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putBytes = function(bytes, encoding) { - if(util.isArrayBufferView(bytes)) { - var src = new Uint8Array(bytes.buffer, bytes.byteOffset, bytes.byteLength); - var len = src.byteLength - src.byteOffset; - this.accommodate(len); - var dst = new Uint8Array(this.data.buffer, this.write); - dst.set(src); - this.write += len; - return this; - } - - if(util.isArrayBuffer(bytes)) { - var src = new Uint8Array(bytes); - this.accommodate(src.byteLength); - var dst = new Uint8Array(this.data.buffer); - dst.set(src, this.write); - this.write += src.byteLength; - return this; - } - - // bytes is a util.DataBuffer or equivalent - if(bytes instanceof util.DataBuffer || - (typeof bytes === 'object' && - typeof bytes.read === 'number' && typeof bytes.write === 'number' && - util.isArrayBufferView(bytes.data))) { - var src = new Uint8Array(bytes.data.byteLength, bytes.read, bytes.length()); - this.accommodate(src.byteLength); - var dst = new Uint8Array(bytes.data.byteLength, this.write); - dst.set(src); - this.write += src.byteLength; - return this; - } - - if(bytes instanceof util.ByteStringBuffer) { - // copy binary string and process as the same as a string parameter below - bytes = bytes.data; - encoding = 'binary'; - } - - // string conversion - encoding = encoding || 'binary'; - if(typeof bytes === 'string') { - var view; - - // decode from string - if(encoding === 'hex') { - this.accommodate(Math.ceil(bytes.length / 2)); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.hex.decode(bytes, view, this.write); - return this; - } - if(encoding === 'base64') { - this.accommodate(Math.ceil(bytes.length / 4) * 3); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.base64.decode(bytes, view, this.write); - return this; - } - - // encode text as UTF-8 bytes - if(encoding === 'utf8') { - // encode as UTF-8 then decode string as raw binary - bytes = util.encodeUtf8(bytes); - encoding = 'binary'; - } - - // decode string as raw binary - if(encoding === 'binary' || encoding === 'raw') { - // one byte per character - this.accommodate(bytes.length); - view = new Uint8Array(this.data.buffer, this.write); - this.write += util.binary.raw.decode(view); - return this; - } - - // encode text as UTF-16 bytes - if(encoding === 'utf16') { - // two bytes per character - this.accommodate(bytes.length * 2); - view = new Uint16Array(this.data.buffer, this.write); - this.write += util.text.utf16.encode(view); - return this; - } - - throw new Error('Invalid encoding: ' + encoding); - } - - throw Error('Invalid parameter: ' + bytes); -}; - -/** - * Puts the given buffer into this buffer. - * - * @param buffer the buffer to put into this one. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putBuffer = function(buffer) { - this.putBytes(buffer); - buffer.clear(); - return this; -}; - -/** - * Puts a string into this buffer. - * - * @param str the string to put. - * @param [encoding] the encoding for the string (default: 'utf16'). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putString = function(str) { - return this.putBytes(str, 'utf16'); -}; - -/** - * Puts a 16-bit integer in this buffer in big-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt16 = function(i) { - this.accommodate(2); - this.data.setInt16(this.write, i); - this.write += 2; - return this; -}; - -/** - * Puts a 24-bit integer in this buffer in big-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt24 = function(i) { - this.accommodate(3); - this.data.setInt16(this.write, i >> 8 & 0xFFFF); - this.data.setInt8(this.write, i >> 16 & 0xFF); - this.write += 3; - return this; -}; - -/** - * Puts a 32-bit integer in this buffer in big-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt32 = function(i) { - this.accommodate(4); - this.data.setInt32(this.write, i); - this.write += 4; - return this; -}; - -/** - * Puts a 16-bit integer in this buffer in little-endian order. - * - * @param i the 16-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt16Le = function(i) { - this.accommodate(2); - this.data.setInt16(this.write, i, true); - this.write += 2; - return this; -}; - -/** - * Puts a 24-bit integer in this buffer in little-endian order. - * - * @param i the 24-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt24Le = function(i) { - this.accommodate(3); - this.data.setInt8(this.write, i >> 16 & 0xFF); - this.data.setInt16(this.write, i >> 8 & 0xFFFF, true); - this.write += 3; - return this; -}; - -/** - * Puts a 32-bit integer in this buffer in little-endian order. - * - * @param i the 32-bit integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt32Le = function(i) { - this.accommodate(4); - this.data.setInt32(this.write, i, true); - this.write += 4; - return this; -}; - -/** - * Puts an n-bit integer in this buffer in big-endian order. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return this buffer. - */ -util.DataBuffer.prototype.putInt = function(i, n) { - _checkBitsParam(n); - this.accommodate(n / 8); - do { - n -= 8; - this.data.setInt8(this.write++, (i >> n) & 0xFF); - } while(n > 0); - return this; -}; - -/** - * Puts a signed n-bit integer in this buffer in big-endian order. Two's - * complement representation is used. - * - * @param i the n-bit integer. - * @param n the number of bits in the integer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.putSignedInt = function(i, n) { - _checkBitsParam(n); - this.accommodate(n / 8); - if(i < 0) { - i += 2 << (n - 1); - } - return this.putInt(i, n); -}; - -/** - * Gets a byte from this buffer and advances the read pointer by 1. - * - * @return the byte. - */ -util.DataBuffer.prototype.getByte = function() { - return this.data.getInt8(this.read++); -}; - -/** - * Gets a uint16 from this buffer in big-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.DataBuffer.prototype.getInt16 = function() { - var rval = this.data.getInt16(this.read); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in big-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.DataBuffer.prototype.getInt24 = function() { - var rval = ( - this.data.getInt16(this.read) << 8 ^ - this.data.getInt8(this.read + 2)); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in big-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.DataBuffer.prototype.getInt32 = function() { - var rval = this.data.getInt32(this.read); - this.read += 4; - return rval; -}; - -/** - * Gets a uint16 from this buffer in little-endian order and advances the read - * pointer by 2. - * - * @return the uint16. - */ -util.DataBuffer.prototype.getInt16Le = function() { - var rval = this.data.getInt16(this.read, true); - this.read += 2; - return rval; -}; - -/** - * Gets a uint24 from this buffer in little-endian order and advances the read - * pointer by 3. - * - * @return the uint24. - */ -util.DataBuffer.prototype.getInt24Le = function() { - var rval = ( - this.data.getInt8(this.read) ^ - this.data.getInt16(this.read + 1, true) << 8); - this.read += 3; - return rval; -}; - -/** - * Gets a uint32 from this buffer in little-endian order and advances the read - * pointer by 4. - * - * @return the word. - */ -util.DataBuffer.prototype.getInt32Le = function() { - var rval = this.data.getInt32(this.read, true); - this.read += 4; - return rval; -}; - -/** - * Gets an n-bit integer from this buffer in big-endian order and advances the - * read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.DataBuffer.prototype.getInt = function(n) { - _checkBitsParam(n); - var rval = 0; - do { - // TODO: Use (rval * 0x100) if adding support for 33 to 53 bits. - rval = (rval << 8) + this.data.getInt8(this.read++); - n -= 8; - } while(n > 0); - return rval; -}; - -/** - * Gets a signed n-bit integer from this buffer in big-endian order, using - * two's complement, and advances the read pointer by n/8. - * - * @param n the number of bits in the integer (8, 16, 24, or 32). - * - * @return the integer. - */ -util.DataBuffer.prototype.getSignedInt = function(n) { - // getInt checks n - var x = this.getInt(n); - var max = 2 << (n - 2); - if(x >= max) { - x -= max << 1; - } - return x; -}; - -/** - * Reads bytes out as a binary encoded string and clears them from the - * buffer. - * - * @param count the number of bytes to read, undefined or null for all. - * - * @return a binary encoded string of bytes. - */ -util.DataBuffer.prototype.getBytes = function(count) { - // TODO: deprecate this method, it is poorly named and - // this.toString('binary') replaces it - // add a toTypedArray()/toArrayBuffer() function - var rval; - if(count) { - // read count bytes - count = Math.min(this.length(), count); - rval = this.data.slice(this.read, this.read + count); - this.read += count; - } else if(count === 0) { - rval = ''; - } else { - // read all bytes, optimize to only copy when needed - rval = (this.read === 0) ? this.data : this.data.slice(this.read); - this.clear(); - } - return rval; -}; - -/** - * Gets a binary encoded string of the bytes from this buffer without - * modifying the read pointer. - * - * @param count the number of bytes to get, omit to get all. - * - * @return a string full of binary encoded characters. - */ -util.DataBuffer.prototype.bytes = function(count) { - // TODO: deprecate this method, it is poorly named, add "getString()" - return (typeof(count) === 'undefined' ? - this.data.slice(this.read) : - this.data.slice(this.read, this.read + count)); -}; - -/** - * Gets a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * - * @return the byte. - */ -util.DataBuffer.prototype.at = function(i) { - return this.data.getUint8(this.read + i); -}; - -/** - * Puts a byte at the given index without modifying the read pointer. - * - * @param i the byte index. - * @param b the byte to put. - * - * @return this buffer. - */ -util.DataBuffer.prototype.setAt = function(i, b) { - this.data.setUint8(i, b); - return this; -}; - -/** - * Gets the last byte without modifying the read pointer. - * - * @return the last byte. - */ -util.DataBuffer.prototype.last = function() { - return this.data.getUint8(this.write - 1); -}; - -/** - * Creates a copy of this buffer. - * - * @return the copy. - */ -util.DataBuffer.prototype.copy = function() { - return new util.DataBuffer(this); -}; - -/** - * Compacts this buffer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.compact = function() { - if(this.read > 0) { - var src = new Uint8Array(this.data.buffer, this.read); - var dst = new Uint8Array(src.byteLength); - dst.set(src); - this.data = new DataView(dst); - this.write -= this.read; - this.read = 0; - } - return this; -}; - -/** - * Clears this buffer. - * - * @return this buffer. - */ -util.DataBuffer.prototype.clear = function() { - this.data = new DataView(new ArrayBuffer(0)); - this.read = this.write = 0; - return this; -}; - -/** - * Shortens this buffer by triming bytes off of the end of this buffer. - * - * @param count the number of bytes to trim off. - * - * @return this buffer. - */ -util.DataBuffer.prototype.truncate = function(count) { - this.write = Math.max(0, this.length() - count); - this.read = Math.min(this.read, this.write); - return this; -}; - -/** - * Converts this buffer to a hexadecimal string. - * - * @return a hexadecimal string. - */ -util.DataBuffer.prototype.toHex = function() { - var rval = ''; - for(var i = this.read; i < this.data.byteLength; ++i) { - var b = this.data.getUint8(i); - if(b < 16) { - rval += '0'; - } - rval += b.toString(16); - } - return rval; -}; - -/** - * Converts this buffer to a string, using the given encoding. If no - * encoding is given, 'utf8' (UTF-8) is used. - * - * @param [encoding] the encoding to use: 'binary', 'utf8', 'utf16', 'hex', - * 'base64' (default: 'utf8'). - * - * @return a string representation of the bytes in this buffer. - */ -util.DataBuffer.prototype.toString = function(encoding) { - var view = new Uint8Array(this.data, this.read, this.length()); - encoding = encoding || 'utf8'; - - // encode to string - if(encoding === 'binary' || encoding === 'raw') { - return util.binary.raw.encode(view); - } - if(encoding === 'hex') { - return util.binary.hex.encode(view); - } - if(encoding === 'base64') { - return util.binary.base64.encode(view); - } - - // decode to text - if(encoding === 'utf8') { - return util.text.utf8.decode(view); - } - if(encoding === 'utf16') { - return util.text.utf16.decode(view); - } - - throw new Error('Invalid encoding: ' + encoding); -}; - -/** End Buffer w/UInt8Array backing */ - -/** - * Creates a buffer that stores bytes. A value may be given to populate the - * buffer with data. This value can either be string of encoded bytes or a - * regular string of characters. When passing a string of binary encoded - * bytes, the encoding `raw` should be given. This is also the default. When - * passing a string of characters, the encoding `utf8` should be given. - * - * @param [input] a string with encoded bytes to store in the buffer. - * @param [encoding] (default: 'raw', other: 'utf8'). - */ -util.createBuffer = function(input, encoding) { - // TODO: deprecate, use new ByteBuffer() instead - encoding = encoding || 'raw'; - if(input !== undefined && encoding === 'utf8') { - input = util.encodeUtf8(input); - } - return new util.ByteBuffer(input); -}; - -/** - * Fills a string with a particular value. If you want the string to be a byte - * string, pass in String.fromCharCode(theByte). - * - * @param c the character to fill the string with, use String.fromCharCode - * to fill the string with a byte value. - * @param n the number of characters of value c to fill with. - * - * @return the filled string. - */ -util.fillString = function(c, n) { - var s = ''; - while(n > 0) { - if(n & 1) { - s += c; - } - n >>>= 1; - if(n > 0) { - c += c; - } - } - return s; -}; - -/** - * Performs a per byte XOR between two byte strings and returns the result as a - * string of bytes. - * - * @param s1 first string of bytes. - * @param s2 second string of bytes. - * @param n the number of bytes to XOR. - * - * @return the XOR'd result. - */ -util.xorBytes = function(s1, s2, n) { - var s3 = ''; - var b = ''; - var t = ''; - var i = 0; - var c = 0; - for(; n > 0; --n, ++i) { - b = s1.charCodeAt(i) ^ s2.charCodeAt(i); - if(c >= 10) { - s3 += t; - t = ''; - c = 0; - } - t += String.fromCharCode(b); - ++c; - } - s3 += t; - return s3; -}; - -/** - * Converts a hex string into a 'binary' encoded string of bytes. - * - * @param hex the hexadecimal string to convert. - * - * @return the binary-encoded string of bytes. - */ -util.hexToBytes = function(hex) { - // TODO: deprecate: "Deprecated. Use util.binary.hex.decode instead." - var rval = ''; - var i = 0; - if(hex.length & 1 == 1) { - // odd number of characters, convert first character alone - i = 1; - rval += String.fromCharCode(parseInt(hex[0], 16)); - } - // convert 2 characters (1 byte) at a time - for(; i < hex.length; i += 2) { - rval += String.fromCharCode(parseInt(hex.substr(i, 2), 16)); - } - return rval; -}; - -/** - * Converts a 'binary' encoded string of bytes to hex. - * - * @param bytes the byte string to convert. - * - * @return the string of hexadecimal characters. - */ -util.bytesToHex = function(bytes) { - // TODO: deprecate: "Deprecated. Use util.binary.hex.encode instead." - return util.createBuffer(bytes).toHex(); -}; - -/** - * Converts an 32-bit integer to 4-big-endian byte string. - * - * @param i the integer. - * - * @return the byte string. - */ -util.int32ToBytes = function(i) { - return ( - String.fromCharCode(i >> 24 & 0xFF) + - String.fromCharCode(i >> 16 & 0xFF) + - String.fromCharCode(i >> 8 & 0xFF) + - String.fromCharCode(i & 0xFF)); -}; - -// base64 characters, reverse mapping -var _base64 = - 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='; -var _base64Idx = [ -/*43 -43 = 0*/ -/*'+', 1, 2, 3,'/' */ - 62, -1, -1, -1, 63, - -/*'0','1','2','3','4','5','6','7','8','9' */ - 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, - -/*15, 16, 17,'=', 19, 20, 21 */ - -1, -1, -1, 64, -1, -1, -1, - -/*65 - 43 = 22*/ -/*'A','B','C','D','E','F','G','H','I','J','K','L','M', */ - 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, - -/*'N','O','P','Q','R','S','T','U','V','W','X','Y','Z' */ - 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, - -/*91 - 43 = 48 */ -/*48, 49, 50, 51, 52, 53 */ - -1, -1, -1, -1, -1, -1, - -/*97 - 43 = 54*/ -/*'a','b','c','d','e','f','g','h','i','j','k','l','m' */ - 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, - -/*'n','o','p','q','r','s','t','u','v','w','x','y','z' */ - 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51 -]; - -// base58 characters (Bitcoin alphabet) -var _base58 = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz'; - -/** - * Base64 encodes a 'binary' encoded string of bytes. - * - * @param input the binary encoded string of bytes to base64-encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the base64-encoded output. - */ -util.encode64 = function(input, maxline) { - // TODO: deprecate: "Deprecated. Use util.binary.base64.encode instead." - var line = ''; - var output = ''; - var chr1, chr2, chr3; - var i = 0; - while(i < input.length) { - chr1 = input.charCodeAt(i++); - chr2 = input.charCodeAt(i++); - chr3 = input.charCodeAt(i++); - - // encode 4 character group - line += _base64.charAt(chr1 >> 2); - line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); - if(isNaN(chr2)) { - line += '=='; - } else { - line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); - line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); - } - - if(maxline && line.length > maxline) { - output += line.substr(0, maxline) + '\r\n'; - line = line.substr(maxline); - } - } - output += line; - return output; -}; - -/** - * Base64 decodes a string into a 'binary' encoded string of bytes. - * - * @param input the base64-encoded input. - * - * @return the binary encoded string. - */ -util.decode64 = function(input) { - // TODO: deprecate: "Deprecated. Use util.binary.base64.decode instead." - - // remove all non-base64 characters - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); - - var output = ''; - var enc1, enc2, enc3, enc4; - var i = 0; - - while(i < input.length) { - enc1 = _base64Idx[input.charCodeAt(i++) - 43]; - enc2 = _base64Idx[input.charCodeAt(i++) - 43]; - enc3 = _base64Idx[input.charCodeAt(i++) - 43]; - enc4 = _base64Idx[input.charCodeAt(i++) - 43]; - - output += String.fromCharCode((enc1 << 2) | (enc2 >> 4)); - if(enc3 !== 64) { - // decoded at least 2 bytes - output += String.fromCharCode(((enc2 & 15) << 4) | (enc3 >> 2)); - if(enc4 !== 64) { - // decoded 3 bytes - output += String.fromCharCode(((enc3 & 3) << 6) | enc4); - } - } - } - - return output; -}; - -/** - * Encodes the given string of characters (a standard JavaScript - * string) as a binary encoded string where the bytes represent - * a UTF-8 encoded string of characters. Non-ASCII characters will be - * encoded as multiple bytes according to UTF-8. - * - * @param str a standard string of characters to encode. - * - * @return the binary encoded string. - */ -util.encodeUtf8 = function(str) { - return unescape(encodeURIComponent(str)); -}; - -/** - * Decodes a binary encoded string that contains bytes that - * represent a UTF-8 encoded string of characters -- into a - * string of characters (a standard JavaScript string). - * - * @param str the binary encoded string to decode. - * - * @return the resulting standard string of characters. - */ -util.decodeUtf8 = function(str) { - return decodeURIComponent(escape(str)); -}; - -// binary encoding/decoding tools -// FIXME: Experimental. Do not use yet. -util.binary = { - raw: {}, - hex: {}, - base64: {}, - base58: {}, - baseN : { - encode: baseN.encode, - decode: baseN.decode - } -}; - -/** - * Encodes a Uint8Array as a binary-encoded string. This encoding uses - * a value between 0 and 255 for each character. - * - * @param bytes the Uint8Array to encode. - * - * @return the binary-encoded string. - */ -util.binary.raw.encode = function(bytes) { - return String.fromCharCode.apply(null, bytes); -}; - -/** - * Decodes a binary-encoded string to a Uint8Array. This encoding uses - * a value between 0 and 255 for each character. - * - * @param str the binary-encoded string to decode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.raw.decode = function(str, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(str.length); - } - offset = offset || 0; - var j = offset; - for(var i = 0; i < str.length; ++i) { - out[j++] = str.charCodeAt(i); - } - return output ? (j - offset) : out; -}; - -/** - * Encodes a 'binary' string, ArrayBuffer, DataView, TypedArray, or - * ByteBuffer as a string of hexadecimal characters. - * - * @param bytes the bytes to convert. - * - * @return the string of hexadecimal characters. - */ -util.binary.hex.encode = util.bytesToHex; - -/** - * Decodes a hex-encoded string to a Uint8Array. - * - * @param hex the hexadecimal string to convert. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.hex.decode = function(hex, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(Math.ceil(hex.length / 2)); - } - offset = offset || 0; - var i = 0, j = offset; - if(hex.length & 1) { - // odd number of characters, convert first character alone - i = 1; - out[j++] = parseInt(hex[0], 16); - } - // convert 2 characters (1 byte) at a time - for(; i < hex.length; i += 2) { - out[j++] = parseInt(hex.substr(i, 2), 16); - } - return output ? (j - offset) : out; -}; - -/** - * Base64-encodes a Uint8Array. - * - * @param input the Uint8Array to encode. - * @param maxline the maximum number of encoded characters per line to use, - * defaults to none. - * - * @return the base64-encoded output string. - */ -util.binary.base64.encode = function(input, maxline) { - var line = ''; - var output = ''; - var chr1, chr2, chr3; - var i = 0; - while(i < input.byteLength) { - chr1 = input[i++]; - chr2 = input[i++]; - chr3 = input[i++]; - - // encode 4 character group - line += _base64.charAt(chr1 >> 2); - line += _base64.charAt(((chr1 & 3) << 4) | (chr2 >> 4)); - if(isNaN(chr2)) { - line += '=='; - } else { - line += _base64.charAt(((chr2 & 15) << 2) | (chr3 >> 6)); - line += isNaN(chr3) ? '=' : _base64.charAt(chr3 & 63); - } - - if(maxline && line.length > maxline) { - output += line.substr(0, maxline) + '\r\n'; - line = line.substr(maxline); - } - } - output += line; - return output; -}; - -/** - * Decodes a base64-encoded string to a Uint8Array. - * - * @param input the base64-encoded input string. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.binary.base64.decode = function(input, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(Math.ceil(input.length / 4) * 3); - } - - // remove all non-base64 characters - input = input.replace(/[^A-Za-z0-9\+\/\=]/g, ''); - - offset = offset || 0; - var enc1, enc2, enc3, enc4; - var i = 0, j = offset; - - while(i < input.length) { - enc1 = _base64Idx[input.charCodeAt(i++) - 43]; - enc2 = _base64Idx[input.charCodeAt(i++) - 43]; - enc3 = _base64Idx[input.charCodeAt(i++) - 43]; - enc4 = _base64Idx[input.charCodeAt(i++) - 43]; - - out[j++] = (enc1 << 2) | (enc2 >> 4); - if(enc3 !== 64) { - // decoded at least 2 bytes - out[j++] = ((enc2 & 15) << 4) | (enc3 >> 2); - if(enc4 !== 64) { - // decoded 3 bytes - out[j++] = ((enc3 & 3) << 6) | enc4; - } - } - } - - // make sure result is the exact decoded length - return output ? (j - offset) : out.subarray(0, j); -}; - -// add support for base58 encoding/decoding with Bitcoin alphabet -util.binary.base58.encode = function(input, maxline) { - return util.binary.baseN.encode(input, _base58, maxline); -}; -util.binary.base58.decode = function(input, maxline) { - return util.binary.baseN.decode(input, _base58, maxline); -}; - -// text encoding/decoding tools -// FIXME: Experimental. Do not use yet. -util.text = { - utf8: {}, - utf16: {} -}; - -/** - * Encodes the given string as UTF-8 in a Uint8Array. - * - * @param str the string to encode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.text.utf8.encode = function(str, output, offset) { - str = util.encodeUtf8(str); - var out = output; - if(!out) { - out = new Uint8Array(str.length); - } - offset = offset || 0; - var j = offset; - for(var i = 0; i < str.length; ++i) { - out[j++] = str.charCodeAt(i); - } - return output ? (j - offset) : out; -}; - -/** - * Decodes the UTF-8 contents from a Uint8Array. - * - * @param bytes the Uint8Array to decode. - * - * @return the resulting string. - */ -util.text.utf8.decode = function(bytes) { - return util.decodeUtf8(String.fromCharCode.apply(null, bytes)); -}; - -/** - * Encodes the given string as UTF-16 in a Uint8Array. - * - * @param str the string to encode. - * @param [output] an optional Uint8Array to write the output to; if it - * is too small, an exception will be thrown. - * @param [offset] the start offset for writing to the output (default: 0). - * - * @return the Uint8Array or the number of bytes written if output was given. - */ -util.text.utf16.encode = function(str, output, offset) { - var out = output; - if(!out) { - out = new Uint8Array(str.length * 2); - } - var view = new Uint16Array(out.buffer); - offset = offset || 0; - var j = offset; - var k = offset; - for(var i = 0; i < str.length; ++i) { - view[k++] = str.charCodeAt(i); - j += 2; - } - return output ? (j - offset) : out; -}; - -/** - * Decodes the UTF-16 contents from a Uint8Array. - * - * @param bytes the Uint8Array to decode. - * - * @return the resulting string. - */ -util.text.utf16.decode = function(bytes) { - return String.fromCharCode.apply(null, new Uint16Array(bytes.buffer)); -}; - -/** - * Deflates the given data using a flash interface. - * - * @param api the flash interface. - * @param bytes the data. - * @param raw true to return only raw deflate data, false to include zlib - * header and trailer. - * - * @return the deflated data as a string. - */ -util.deflate = function(api, bytes, raw) { - bytes = util.decode64(api.deflate(util.encode64(bytes)).rval); - - // strip zlib header and trailer if necessary - if(raw) { - // zlib header is 2 bytes (CMF,FLG) where FLG indicates that - // there is a 4-byte DICT (alder-32) block before the data if - // its 5th bit is set - var start = 2; - var flg = bytes.charCodeAt(1); - if(flg & 0x20) { - start = 6; - } - // zlib trailer is 4 bytes of adler-32 - bytes = bytes.substring(start, bytes.length - 4); - } - - return bytes; -}; - -/** - * Inflates the given data using a flash interface. - * - * @param api the flash interface. - * @param bytes the data. - * @param raw true if the incoming data has no zlib header or trailer and is - * raw DEFLATE data. - * - * @return the inflated data as a string, null on error. - */ -util.inflate = function(api, bytes, raw) { - // TODO: add zlib header and trailer if necessary/possible - var rval = api.inflate(util.encode64(bytes)).rval; - return (rval === null) ? null : util.decode64(rval); -}; - -/** - * Sets a storage object. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param obj the storage object, null to remove. - */ -var _setStorageObject = function(api, id, obj) { - if(!api) { - throw new Error('WebStorage not available.'); - } - - var rval; - if(obj === null) { - rval = api.removeItem(id); - } else { - // json-encode and base64-encode object - obj = util.encode64(JSON.stringify(obj)); - rval = api.setItem(id, obj); - } - - // handle potential flash error - if(typeof(rval) !== 'undefined' && rval.rval !== true) { - var error = new Error(rval.error.message); - error.id = rval.error.id; - error.name = rval.error.name; - throw error; - } -}; - -/** - * Gets a storage object. - * - * @param api the storage interface. - * @param id the storage ID to use. - * - * @return the storage object entry or null if none exists. - */ -var _getStorageObject = function(api, id) { - if(!api) { - throw new Error('WebStorage not available.'); - } - - // get the existing entry - var rval = api.getItem(id); - - /* Note: We check api.init because we can't do (api == localStorage) - on IE because of "Class doesn't support Automation" exception. Only - the flash api has an init method so this works too, but we need a - better solution in the future. */ - - // flash returns item wrapped in an object, handle special case - if(api.init) { - if(rval.rval === null) { - if(rval.error) { - var error = new Error(rval.error.message); - error.id = rval.error.id; - error.name = rval.error.name; - throw error; - } - // no error, but also no item - rval = null; - } else { - rval = rval.rval; - } - } - - // handle decoding - if(rval !== null) { - // base64-decode and json-decode data - rval = JSON.parse(util.decode64(rval)); - } - - return rval; -}; - -/** - * Stores an item in local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - * @param data the data for the item (any javascript object/primitive). - */ -var _setItem = function(api, id, key, data) { - // get storage object - var obj = _getStorageObject(api, id); - if(obj === null) { - // create a new storage object - obj = {}; - } - // update key - obj[key] = data; - - // set storage object - _setStorageObject(api, id, obj); -}; - -/** - * Gets an item from local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - * - * @return the item. - */ -var _getItem = function(api, id, key) { - // get storage object - var rval = _getStorageObject(api, id); - if(rval !== null) { - // return data at key - rval = (key in rval) ? rval[key] : null; - } - - return rval; -}; - -/** - * Removes an item from local storage. - * - * @param api the storage interface. - * @param id the storage ID to use. - * @param key the key for the item. - */ -var _removeItem = function(api, id, key) { - // get storage object - var obj = _getStorageObject(api, id); - if(obj !== null && key in obj) { - // remove key - delete obj[key]; - - // see if entry has no keys remaining - var empty = true; - for(var prop in obj) { - empty = false; - break; - } - if(empty) { - // remove entry entirely if no keys are left - obj = null; - } - - // set storage object - _setStorageObject(api, id, obj); - } -}; - -/** - * Clears the local disk storage identified by the given ID. - * - * @param api the storage interface. - * @param id the storage ID to use. - */ -var _clearItems = function(api, id) { - _setStorageObject(api, id, null); -}; - -/** - * Calls a storage function. - * - * @param func the function to call. - * @param args the arguments for the function. - * @param location the location argument. - * - * @return the return value from the function. - */ -var _callStorageFunction = function(func, args, location) { - var rval = null; - - // default storage types - if(typeof(location) === 'undefined') { - location = ['web', 'flash']; - } - - // apply storage types in order of preference - var type; - var done = false; - var exception = null; - for(var idx in location) { - type = location[idx]; - try { - if(type === 'flash' || type === 'both') { - if(args[0] === null) { - throw new Error('Flash local storage not available.'); - } - rval = func.apply(this, args); - done = (type === 'flash'); - } - if(type === 'web' || type === 'both') { - args[0] = localStorage; - rval = func.apply(this, args); - done = true; - } - } catch(ex) { - exception = ex; - } - if(done) { - break; - } - } - - if(!done) { - throw exception; - } - - return rval; -}; - -/** - * Stores an item on local disk. - * - * The available types of local storage include 'flash', 'web', and 'both'. - * - * The type 'flash' refers to flash local storage (SharedObject). In order - * to use flash local storage, the 'api' parameter must be valid. The type - * 'web' refers to WebStorage, if supported by the browser. The type 'both' - * refers to storing using both 'flash' and 'web', not just one or the - * other. - * - * The location array should list the storage types to use in order of - * preference: - * - * ['flash']: flash only storage - * ['web']: web only storage - * ['both']: try to store in both - * ['flash','web']: store in flash first, but if not available, 'web' - * ['web','flash']: store in web first, but if not available, 'flash' - * - * The location array defaults to: ['web', 'flash'] - * - * @param api the flash interface, null to use only WebStorage. - * @param id the storage ID to use. - * @param key the key for the item. - * @param data the data for the item (any javascript object/primitive). - * @param location an array with the preferred types of storage to use. - */ -util.setItem = function(api, id, key, data, location) { - _callStorageFunction(_setItem, arguments, location); -}; - -/** - * Gets an item on local disk. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface, null to use only WebStorage. - * @param id the storage ID to use. - * @param key the key for the item. - * @param location an array with the preferred types of storage to use. - * - * @return the item. - */ -util.getItem = function(api, id, key, location) { - return _callStorageFunction(_getItem, arguments, location); -}; - -/** - * Removes an item on local disk. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface. - * @param id the storage ID to use. - * @param key the key for the item. - * @param location an array with the preferred types of storage to use. - */ -util.removeItem = function(api, id, key, location) { - _callStorageFunction(_removeItem, arguments, location); -}; - -/** - * Clears the local disk storage identified by the given ID. - * - * Set setItem() for details on storage types. - * - * @param api the flash interface if flash is available. - * @param id the storage ID to use. - * @param location an array with the preferred types of storage to use. - */ -util.clearItems = function(api, id, location) { - _callStorageFunction(_clearItems, arguments, location); -}; - -/** - * Parses the scheme, host, and port from an http(s) url. - * - * @param str the url string. - * - * @return the parsed url object or null if the url is invalid. - */ -util.parseUrl = function(str) { - // FIXME: this regex looks a bit broken - var regex = /^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g; - regex.lastIndex = 0; - var m = regex.exec(str); - var url = (m === null) ? null : { - full: str, - scheme: m[1], - host: m[2], - port: m[3], - path: m[4] - }; - if(url) { - url.fullHost = url.host; - if(url.port) { - if(url.port !== 80 && url.scheme === 'http') { - url.fullHost += ':' + url.port; - } else if(url.port !== 443 && url.scheme === 'https') { - url.fullHost += ':' + url.port; - } - } else if(url.scheme === 'http') { - url.port = 80; - } else if(url.scheme === 'https') { - url.port = 443; - } - url.full = url.scheme + '://' + url.fullHost; - } - return url; -}; - -/* Storage for query variables */ -var _queryVariables = null; - -/** - * Returns the window location query variables. Query is parsed on the first - * call and the same object is returned on subsequent calls. The mapping - * is from keys to an array of values. Parameters without values will have - * an object key set but no value added to the value array. Values are - * unescaped. - * - * ...?k1=v1&k2=v2: - * { - * "k1": ["v1"], - * "k2": ["v2"] - * } - * - * ...?k1=v1&k1=v2: - * { - * "k1": ["v1", "v2"] - * } - * - * ...?k1=v1&k2: - * { - * "k1": ["v1"], - * "k2": [] - * } - * - * ...?k1=v1&k1: - * { - * "k1": ["v1"] - * } - * - * ...?k1&k1: - * { - * "k1": [] - * } - * - * @param query the query string to parse (optional, default to cached - * results from parsing window location search query). - * - * @return object mapping keys to variables. - */ -util.getQueryVariables = function(query) { - var parse = function(q) { - var rval = {}; - var kvpairs = q.split('&'); - for(var i = 0; i < kvpairs.length; i++) { - var pos = kvpairs[i].indexOf('='); - var key; - var val; - if(pos > 0) { - key = kvpairs[i].substring(0, pos); - val = kvpairs[i].substring(pos + 1); - } else { - key = kvpairs[i]; - val = null; - } - if(!(key in rval)) { - rval[key] = []; - } - // disallow overriding object prototype keys - if(!(key in Object.prototype) && val !== null) { - rval[key].push(unescape(val)); - } - } - return rval; - }; - - var rval; - if(typeof(query) === 'undefined') { - // set cached variables if needed - if(_queryVariables === null) { - if(typeof(window) !== 'undefined' && window.location && window.location.search) { - // parse window search query - _queryVariables = parse(window.location.search.substring(1)); - } else { - // no query variables available - _queryVariables = {}; - } - } - rval = _queryVariables; - } else { - // parse given query - rval = parse(query); - } - return rval; -}; - -/** - * Parses a fragment into a path and query. This method will take a URI - * fragment and break it up as if it were the main URI. For example: - * /bar/baz?a=1&b=2 - * results in: - * { - * path: ["bar", "baz"], - * query: {"k1": ["v1"], "k2": ["v2"]} - * } - * - * @return object with a path array and query object. - */ -util.parseFragment = function(fragment) { - // default to whole fragment - var fp = fragment; - var fq = ''; - // split into path and query if possible at the first '?' - var pos = fragment.indexOf('?'); - if(pos > 0) { - fp = fragment.substring(0, pos); - fq = fragment.substring(pos + 1); - } - // split path based on '/' and ignore first element if empty - var path = fp.split('/'); - if(path.length > 0 && path[0] === '') { - path.shift(); - } - // convert query into object - var query = (fq === '') ? {} : util.getQueryVariables(fq); - - return { - pathString: fp, - queryString: fq, - path: path, - query: query - }; -}; - -/** - * Makes a request out of a URI-like request string. This is intended to - * be used where a fragment id (after a URI '#') is parsed as a URI with - * path and query parts. The string should have a path beginning and - * delimited by '/' and optional query parameters following a '?'. The - * query should be a standard URL set of key value pairs delimited by - * '&'. For backwards compatibility the initial '/' on the path is not - * required. The request object has the following API, (fully described - * in the method code): - * { - * path: . - * query: , - * getPath(i): get part or all of the split path array, - * getQuery(k, i): get part or all of a query key array, - * getQueryLast(k, _default): get last element of a query key array. - * } - * - * @return object with request parameters. - */ -util.makeRequest = function(reqString) { - var frag = util.parseFragment(reqString); - var req = { - // full path string - path: frag.pathString, - // full query string - query: frag.queryString, - /** - * Get path or element in path. - * - * @param i optional path index. - * - * @return path or part of path if i provided. - */ - getPath: function(i) { - return (typeof(i) === 'undefined') ? frag.path : frag.path[i]; - }, - /** - * Get query, values for a key, or value for a key index. - * - * @param k optional query key. - * @param i optional query key index. - * - * @return query, values for a key, or value for a key index. - */ - getQuery: function(k, i) { - var rval; - if(typeof(k) === 'undefined') { - rval = frag.query; - } else { - rval = frag.query[k]; - if(rval && typeof(i) !== 'undefined') { - rval = rval[i]; - } - } - return rval; - }, - getQueryLast: function(k, _default) { - var rval; - var vals = req.getQuery(k); - if(vals) { - rval = vals[vals.length - 1]; - } else { - rval = _default; - } - return rval; - } - }; - return req; -}; - -/** - * Makes a URI out of a path, an object with query parameters, and a - * fragment. Uses jQuery.param() internally for query string creation. - * If the path is an array, it will be joined with '/'. - * - * @param path string path or array of strings. - * @param query object with query parameters. (optional) - * @param fragment fragment string. (optional) - * - * @return string object with request parameters. - */ -util.makeLink = function(path, query, fragment) { - // join path parts if needed - path = jQuery.isArray(path) ? path.join('/') : path; - - var qstr = jQuery.param(query || {}); - fragment = fragment || ''; - return path + - ((qstr.length > 0) ? ('?' + qstr) : '') + - ((fragment.length > 0) ? ('#' + fragment) : ''); -}; - -/** - * Check if an object is empty. - * - * Taken from: - * http://stackoverflow.com/questions/679915/how-do-i-test-for-an-empty-javascript-object-from-json/679937#679937 - * - * @param object the object to check. - */ -util.isEmpty = function(obj) { - for(var prop in obj) { - if(obj.hasOwnProperty(prop)) { - return false; - } - } - return true; -}; - -/** - * Format with simple printf-style interpolation. - * - * %%: literal '%' - * %s,%o: convert next argument into a string. - * - * @param format the string to format. - * @param ... arguments to interpolate into the format string. - */ -util.format = function(format) { - var re = /%./g; - // current match - var match; - // current part - var part; - // current arg index - var argi = 0; - // collected parts to recombine later - var parts = []; - // last index found - var last = 0; - // loop while matches remain - while((match = re.exec(format))) { - part = format.substring(last, re.lastIndex - 2); - // don't add empty strings (ie, parts between %s%s) - if(part.length > 0) { - parts.push(part); - } - last = re.lastIndex; - // switch on % code - var code = match[0][1]; - switch(code) { - case 's': - case 'o': - // check if enough arguments were given - if(argi < arguments.length) { - parts.push(arguments[argi++ + 1]); - } else { - parts.push(''); - } - break; - // FIXME: do proper formating for numbers, etc - //case 'f': - //case 'd': - case '%': - parts.push('%'); - break; - default: - parts.push('<%' + code + '?>'); - } - } - // add trailing part of format string - parts.push(format.substring(last)); - return parts.join(''); -}; - -/** - * Formats a number. - * - * http://snipplr.com/view/5945/javascript-numberformat--ported-from-php/ - */ -util.formatNumber = function(number, decimals, dec_point, thousands_sep) { - // http://kevin.vanzonneveld.net - // + original by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) - // + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net) - // + bugfix by: Michael White (http://crestidg.com) - // + bugfix by: Benjamin Lupton - // + bugfix by: Allan Jensen (http://www.winternet.no) - // + revised by: Jonas Raoni Soares Silva (http://www.jsfromhell.com) - // * example 1: number_format(1234.5678, 2, '.', ''); - // * returns 1: 1234.57 - - var n = number, c = isNaN(decimals = Math.abs(decimals)) ? 2 : decimals; - var d = dec_point === undefined ? ',' : dec_point; - var t = thousands_sep === undefined ? - '.' : thousands_sep, s = n < 0 ? '-' : ''; - var i = parseInt((n = Math.abs(+n || 0).toFixed(c)), 10) + ''; - var j = (i.length > 3) ? i.length % 3 : 0; - return s + (j ? i.substr(0, j) + t : '') + - i.substr(j).replace(/(\d{3})(?=\d)/g, '$1' + t) + - (c ? d + Math.abs(n - i).toFixed(c).slice(2) : ''); -}; - -/** - * Formats a byte size. - * - * http://snipplr.com/view/5949/format-humanize-file-byte-size-presentation-in-javascript/ - */ -util.formatSize = function(size) { - if(size >= 1073741824) { - size = util.formatNumber(size / 1073741824, 2, '.', '') + ' GiB'; - } else if(size >= 1048576) { - size = util.formatNumber(size / 1048576, 2, '.', '') + ' MiB'; - } else if(size >= 1024) { - size = util.formatNumber(size / 1024, 0) + ' KiB'; - } else { - size = util.formatNumber(size, 0) + ' bytes'; - } - return size; -}; - -/** - * Converts an IPv4 or IPv6 string representation into bytes (in network order). - * - * @param ip the IPv4 or IPv6 address to convert. - * - * @return the 4-byte IPv6 or 16-byte IPv6 address or null if the address can't - * be parsed. - */ -util.bytesFromIP = function(ip) { - if(ip.indexOf('.') !== -1) { - return util.bytesFromIPv4(ip); - } - if(ip.indexOf(':') !== -1) { - return util.bytesFromIPv6(ip); - } - return null; -}; - -/** - * Converts an IPv4 string representation into bytes (in network order). - * - * @param ip the IPv4 address to convert. - * - * @return the 4-byte address or null if the address can't be parsed. - */ -util.bytesFromIPv4 = function(ip) { - ip = ip.split('.'); - if(ip.length !== 4) { - return null; - } - var b = util.createBuffer(); - for(var i = 0; i < ip.length; ++i) { - var num = parseInt(ip[i], 10); - if(isNaN(num)) { - return null; - } - b.putByte(num); - } - return b.getBytes(); -}; - -/** - * Converts an IPv6 string representation into bytes (in network order). - * - * @param ip the IPv6 address to convert. - * - * @return the 16-byte address or null if the address can't be parsed. - */ -util.bytesFromIPv6 = function(ip) { - var blanks = 0; - ip = ip.split(':').filter(function(e) { - if(e.length === 0) ++blanks; - return true; - }); - var zeros = (8 - ip.length + blanks) * 2; - var b = util.createBuffer(); - for(var i = 0; i < 8; ++i) { - if(!ip[i] || ip[i].length === 0) { - b.fillWithByte(0, zeros); - zeros = 0; - continue; - } - var bytes = util.hexToBytes(ip[i]); - if(bytes.length < 2) { - b.putByte(0); - } - b.putBytes(bytes); - } - return b.getBytes(); -}; - -/** - * Converts 4-bytes into an IPv4 string representation or 16-bytes into - * an IPv6 string representation. The bytes must be in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv4 or IPv6 string representation if 4 or 16 bytes, - * respectively, are given, otherwise null. - */ -util.bytesToIP = function(bytes) { - if(bytes.length === 4) { - return util.bytesToIPv4(bytes); - } - if(bytes.length === 16) { - return util.bytesToIPv6(bytes); - } - return null; -}; - -/** - * Converts 4-bytes into an IPv4 string representation. The bytes must be - * in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv4 string representation or null for an invalid # of bytes. - */ -util.bytesToIPv4 = function(bytes) { - if(bytes.length !== 4) { - return null; - } - var ip = []; - for(var i = 0; i < bytes.length; ++i) { - ip.push(bytes.charCodeAt(i)); - } - return ip.join('.'); -}; - -/** - * Converts 16-bytes into an IPv16 string representation. The bytes must be - * in network order. - * - * @param bytes the bytes to convert. - * - * @return the IPv16 string representation or null for an invalid # of bytes. - */ -util.bytesToIPv6 = function(bytes) { - if(bytes.length !== 16) { - return null; - } - var ip = []; - var zeroGroups = []; - var zeroMaxGroup = 0; - for(var i = 0; i < bytes.length; i += 2) { - var hex = util.bytesToHex(bytes[i] + bytes[i + 1]); - // canonicalize zero representation - while(hex[0] === '0' && hex !== '0') { - hex = hex.substr(1); - } - if(hex === '0') { - var last = zeroGroups[zeroGroups.length - 1]; - var idx = ip.length; - if(!last || idx !== last.end + 1) { - zeroGroups.push({start: idx, end: idx}); - } else { - last.end = idx; - if((last.end - last.start) > - (zeroGroups[zeroMaxGroup].end - zeroGroups[zeroMaxGroup].start)) { - zeroMaxGroup = zeroGroups.length - 1; - } - } - } - ip.push(hex); - } - if(zeroGroups.length > 0) { - var group = zeroGroups[zeroMaxGroup]; - // only shorten group of length > 0 - if(group.end - group.start > 0) { - ip.splice(group.start, group.end - group.start + 1, ''); - if(group.start === 0) { - ip.unshift(''); - } - if(group.end === 7) { - ip.push(''); - } - } - } - return ip.join(':'); -}; - -/** - * Estimates the number of processes that can be run concurrently. If - * creating Web Workers, keep in mind that the main JavaScript process needs - * its own core. - * - * @param options the options to use: - * update true to force an update (not use the cached value). - * @param callback(err, max) called once the operation completes. - */ -util.estimateCores = function(options, callback) { - if(typeof options === 'function') { - callback = options; - options = {}; - } - options = options || {}; - if('cores' in util && !options.update) { - return callback(null, util.cores); - } - if(typeof navigator !== 'undefined' && - 'hardwareConcurrency' in navigator && - navigator.hardwareConcurrency > 0) { - util.cores = navigator.hardwareConcurrency; - return callback(null, util.cores); - } - if(typeof Worker === 'undefined') { - // workers not available - util.cores = 1; - return callback(null, util.cores); - } - if(typeof Blob === 'undefined') { - // can't estimate, default to 2 - util.cores = 2; - return callback(null, util.cores); - } - - // create worker concurrency estimation code as blob - var blobUrl = URL.createObjectURL(new Blob(['(', - function() { - self.addEventListener('message', function(e) { - // run worker for 4 ms - var st = Date.now(); - var et = st + 4; - while(Date.now() < et); - self.postMessage({st: st, et: et}); - }); - }.toString(), - ')()'], {type: 'application/javascript'})); - - // take 5 samples using 16 workers - sample([], 5, 16); - - function sample(max, samples, numWorkers) { - if(samples === 0) { - // get overlap average - var avg = Math.floor(max.reduce(function(avg, x) { - return avg + x; - }, 0) / max.length); - util.cores = Math.max(1, avg); - URL.revokeObjectURL(blobUrl); - return callback(null, util.cores); - } - map(numWorkers, function(err, results) { - max.push(reduce(numWorkers, results)); - sample(max, samples - 1, numWorkers); - }); - } - - function map(numWorkers, callback) { - var workers = []; - var results = []; - for(var i = 0; i < numWorkers; ++i) { - var worker = new Worker(blobUrl); - worker.addEventListener('message', function(e) { - results.push(e.data); - if(results.length === numWorkers) { - for(var i = 0; i < numWorkers; ++i) { - workers[i].terminate(); - } - callback(null, results); - } - }); - workers.push(worker); - } - for(var i = 0; i < numWorkers; ++i) { - workers[i].postMessage(i); - } - } - - function reduce(numWorkers, results) { - // find overlapping time windows - var overlaps = []; - for(var n = 0; n < numWorkers; ++n) { - var r1 = results[n]; - var overlap = overlaps[n] = []; - for(var i = 0; i < numWorkers; ++i) { - if(n === i) { - continue; - } - var r2 = results[i]; - if((r1.st > r2.st && r1.st < r2.et) || - (r2.st > r1.st && r2.st < r1.et)) { - overlap.push(i); - } - } - } - // get maximum overlaps ... don't include overlapping worker itself - // as the main JS process was also being scheduled during the work and - // would have to be subtracted from the estimate anyway - return overlaps.reduce(function(max, overlap) { - return Math.max(max, overlap.length); - }, 0); - } -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/x509.js b/reverse_engineering/node_modules/node-forge/lib/x509.js deleted file mode 100644 index 95dbc294..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/x509.js +++ /dev/null @@ -1,3333 +0,0 @@ -/** - * Javascript implementation of X.509 and related components (such as - * Certification Signing Requests) of a Public Key Infrastructure. - * - * @author Dave Longley - * - * Copyright (c) 2010-2014 Digital Bazaar, Inc. - * - * The ASN.1 representation of an X.509v3 certificate is as follows - * (see RFC 2459): - * - * Certificate ::= SEQUENCE { - * tbsCertificate TBSCertificate, - * signatureAlgorithm AlgorithmIdentifier, - * signatureValue BIT STRING - * } - * - * TBSCertificate ::= SEQUENCE { - * version [0] EXPLICIT Version DEFAULT v1, - * serialNumber CertificateSerialNumber, - * signature AlgorithmIdentifier, - * issuer Name, - * validity Validity, - * subject Name, - * subjectPublicKeyInfo SubjectPublicKeyInfo, - * issuerUniqueID [1] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - * subjectUniqueID [2] IMPLICIT UniqueIdentifier OPTIONAL, - * -- If present, version shall be v2 or v3 - * extensions [3] EXPLICIT Extensions OPTIONAL - * -- If present, version shall be v3 - * } - * - * Version ::= INTEGER { v1(0), v2(1), v3(2) } - * - * CertificateSerialNumber ::= INTEGER - * - * Name ::= CHOICE { - * // only one possible choice for now - * RDNSequence - * } - * - * RDNSequence ::= SEQUENCE OF RelativeDistinguishedName - * - * RelativeDistinguishedName ::= SET OF AttributeTypeAndValue - * - * AttributeTypeAndValue ::= SEQUENCE { - * type AttributeType, - * value AttributeValue - * } - * AttributeType ::= OBJECT IDENTIFIER - * AttributeValue ::= ANY DEFINED BY AttributeType - * - * Validity ::= SEQUENCE { - * notBefore Time, - * notAfter Time - * } - * - * Time ::= CHOICE { - * utcTime UTCTime, - * generalTime GeneralizedTime - * } - * - * UniqueIdentifier ::= BIT STRING - * - * SubjectPublicKeyInfo ::= SEQUENCE { - * algorithm AlgorithmIdentifier, - * subjectPublicKey BIT STRING - * } - * - * Extensions ::= SEQUENCE SIZE (1..MAX) OF Extension - * - * Extension ::= SEQUENCE { - * extnID OBJECT IDENTIFIER, - * critical BOOLEAN DEFAULT FALSE, - * extnValue OCTET STRING - * } - * - * The only key algorithm currently supported for PKI is RSA. - * - * RSASSA-PSS signatures are described in RFC 3447 and RFC 4055. - * - * PKCS#10 v1.7 describes certificate signing requests: - * - * CertificationRequestInfo: - * - * CertificationRequestInfo ::= SEQUENCE { - * version INTEGER { v1(0) } (v1,...), - * subject Name, - * subjectPKInfo SubjectPublicKeyInfo{{ PKInfoAlgorithms }}, - * attributes [0] Attributes{{ CRIAttributes }} - * } - * - * Attributes { ATTRIBUTE:IOSet } ::= SET OF Attribute{{ IOSet }} - * - * CRIAttributes ATTRIBUTE ::= { - * ... -- add any locally defined attributes here -- } - * - * Attribute { ATTRIBUTE:IOSet } ::= SEQUENCE { - * type ATTRIBUTE.&id({IOSet}), - * values SET SIZE(1..MAX) OF ATTRIBUTE.&Type({IOSet}{@type}) - * } - * - * CertificationRequest ::= SEQUENCE { - * certificationRequestInfo CertificationRequestInfo, - * signatureAlgorithm AlgorithmIdentifier{{ SignatureAlgorithms }}, - * signature BIT STRING - * } - */ -var forge = require('./forge'); -require('./aes'); -require('./asn1'); -require('./des'); -require('./md'); -require('./mgf'); -require('./oids'); -require('./pem'); -require('./pss'); -require('./rsa'); -require('./util'); - -// shortcut for asn.1 API -var asn1 = forge.asn1; - -/* Public Key Infrastructure (PKI) implementation. */ -var pki = module.exports = forge.pki = forge.pki || {}; -var oids = pki.oids; - -// short name OID mappings -var _shortNames = {}; -_shortNames['CN'] = oids['commonName']; -_shortNames['commonName'] = 'CN'; -_shortNames['C'] = oids['countryName']; -_shortNames['countryName'] = 'C'; -_shortNames['L'] = oids['localityName']; -_shortNames['localityName'] = 'L'; -_shortNames['ST'] = oids['stateOrProvinceName']; -_shortNames['stateOrProvinceName'] = 'ST'; -_shortNames['O'] = oids['organizationName']; -_shortNames['organizationName'] = 'O'; -_shortNames['OU'] = oids['organizationalUnitName']; -_shortNames['organizationalUnitName'] = 'OU'; -_shortNames['E'] = oids['emailAddress']; -_shortNames['emailAddress'] = 'E'; - -// validator for an SubjectPublicKeyInfo structure -// Note: Currently only works with an RSA public key -var publicKeyValidator = forge.pki.rsa.publicKeyValidator; - -// validator for an X.509v3 certificate -var x509CertificateValidator = { - name: 'Certificate', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Certificate.TBSCertificate', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'tbsCertificate', - value: [{ - name: 'Certificate.TBSCertificate.version', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.version.integer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certVersion' - }] - }, { - name: 'Certificate.TBSCertificate.serialNumber', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certSerialNumber' - }, { - name: 'Certificate.TBSCertificate.signature', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'Certificate.TBSCertificate.signature.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certinfoSignatureOid' - }, { - name: 'Certificate.TBSCertificate.signature.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'certinfoSignatureParams' - }] - }, { - name: 'Certificate.TBSCertificate.issuer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certIssuer' - }, { - name: 'Certificate.TBSCertificate.validity', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - // Note: UTC and generalized times may both appear so the capture - // names are based on their detected order, the names used below - // are only for the common case, which validity time really means - // "notBefore" and which means "notAfter" will be determined by order - value: [{ - // notBefore (Time) (UTC time case) - name: 'Certificate.TBSCertificate.validity.notBefore (utc)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.UTCTIME, - constructed: false, - optional: true, - capture: 'certValidity1UTCTime' - }, { - // notBefore (Time) (generalized time case) - name: 'Certificate.TBSCertificate.validity.notBefore (generalized)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.GENERALIZEDTIME, - constructed: false, - optional: true, - capture: 'certValidity2GeneralizedTime' - }, { - // notAfter (Time) (only UTC time is supported) - name: 'Certificate.TBSCertificate.validity.notAfter (utc)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.UTCTIME, - constructed: false, - optional: true, - capture: 'certValidity3UTCTime' - }, { - // notAfter (Time) (only UTC time is supported) - name: 'Certificate.TBSCertificate.validity.notAfter (generalized)', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.GENERALIZEDTIME, - constructed: false, - optional: true, - capture: 'certValidity4GeneralizedTime' - }] - }, { - // Name (subject) (RDNSequence) - name: 'Certificate.TBSCertificate.subject', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certSubject' - }, - // SubjectPublicKeyInfo - publicKeyValidator, - { - // issuerUniqueID (optional) - name: 'Certificate.TBSCertificate.issuerUniqueID', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.issuerUniqueID.id', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - // TODO: support arbitrary bit length ids - captureBitStringValue: 'certIssuerUniqueId' - }] - }, { - // subjectUniqueID (optional) - name: 'Certificate.TBSCertificate.subjectUniqueID', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 2, - constructed: true, - optional: true, - value: [{ - name: 'Certificate.TBSCertificate.subjectUniqueID.id', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - // TODO: support arbitrary bit length ids - captureBitStringValue: 'certSubjectUniqueId' - }] - }, { - // Extensions (optional) - name: 'Certificate.TBSCertificate.extensions', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 3, - constructed: true, - captureAsn1: 'certExtensions', - optional: true - }] - }, { - // AlgorithmIdentifier (signature algorithm) - name: 'Certificate.signatureAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // algorithm - name: 'Certificate.signatureAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'certSignatureOid' - }, { - name: 'Certificate.TBSCertificate.signature.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'certSignatureParams' - }] - }, { - // SignatureValue - name: 'Certificate.signatureValue', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - captureBitStringValue: 'certSignature' - }] -}; - -var rsassaPssParameterValidator = { - name: 'rsapss', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'rsapss.hashAlgorithm', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - value: [{ - name: 'rsapss.hashAlgorithm.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'hashOid' - /* parameter block omitted, for SHA1 NULL anyhow. */ - }] - }] - }, { - name: 'rsapss.maskGenAlgorithm', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 1, - constructed: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.SEQUENCE, - constructed: true, - optional: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'maskGenOid' - }, { - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'maskGenHashOid' - /* parameter block omitted, for SHA1 NULL anyhow. */ - }] - }] - }] - }, { - name: 'rsapss.saltLength', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 2, - optional: true, - value: [{ - name: 'rsapss.saltLength.saltLength', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.INTEGER, - constructed: false, - capture: 'saltLength' - }] - }, { - name: 'rsapss.trailerField', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 3, - optional: true, - value: [{ - name: 'rsapss.trailer.trailer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Class.INTEGER, - constructed: false, - capture: 'trailer' - }] - }] -}; - -// validator for a CertificationRequestInfo structure -var certificationRequestInfoValidator = { - name: 'CertificationRequestInfo', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certificationRequestInfo', - value: [{ - name: 'CertificationRequestInfo.integer', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.INTEGER, - constructed: false, - capture: 'certificationRequestInfoVersion' - }, { - // Name (subject) (RDNSequence) - name: 'CertificationRequestInfo.subject', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'certificationRequestInfoSubject' - }, - // SubjectPublicKeyInfo - publicKeyValidator, - { - name: 'CertificationRequestInfo.attributes', - tagClass: asn1.Class.CONTEXT_SPECIFIC, - type: 0, - constructed: true, - optional: true, - capture: 'certificationRequestInfoAttributes', - value: [{ - name: 'CertificationRequestInfo.attributes', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - name: 'CertificationRequestInfo.attributes.type', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false - }, { - name: 'CertificationRequestInfo.attributes.value', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SET, - constructed: true - }] - }] - }] -}; - -// validator for a CertificationRequest structure -var certificationRequestValidator = { - name: 'CertificationRequest', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - captureAsn1: 'csr', - value: [ - certificationRequestInfoValidator, { - // AlgorithmIdentifier (signature algorithm) - name: 'CertificationRequest.signatureAlgorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.SEQUENCE, - constructed: true, - value: [{ - // algorithm - name: 'CertificationRequest.signatureAlgorithm.algorithm', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.OID, - constructed: false, - capture: 'csrSignatureOid' - }, { - name: 'CertificationRequest.signatureAlgorithm.parameters', - tagClass: asn1.Class.UNIVERSAL, - optional: true, - captureAsn1: 'csrSignatureParams' - }] - }, { - // signature - name: 'CertificationRequest.signature', - tagClass: asn1.Class.UNIVERSAL, - type: asn1.Type.BITSTRING, - constructed: false, - captureBitStringValue: 'csrSignature' - } - ] -}; - -/** - * Converts an RDNSequence of ASN.1 DER-encoded RelativeDistinguishedName - * sets into an array with objects that have type and value properties. - * - * @param rdn the RDNSequence to convert. - * @param md a message digest to append type and value to if provided. - */ -pki.RDNAttributesAsArray = function(rdn, md) { - var rval = []; - - // each value in 'rdn' in is a SET of RelativeDistinguishedName - var set, attr, obj; - for(var si = 0; si < rdn.value.length; ++si) { - // get the RelativeDistinguishedName set - set = rdn.value[si]; - - // each value in the SET is an AttributeTypeAndValue sequence - // containing first a type (an OID) and second a value (defined by - // the OID) - for(var i = 0; i < set.value.length; ++i) { - obj = {}; - attr = set.value[i]; - obj.type = asn1.derToOid(attr.value[0].value); - obj.value = attr.value[1].value; - obj.valueTagClass = attr.value[1].type; - // if the OID is known, get its name and short name - if(obj.type in oids) { - obj.name = oids[obj.type]; - if(obj.name in _shortNames) { - obj.shortName = _shortNames[obj.name]; - } - } - if(md) { - md.update(obj.type); - md.update(obj.value); - } - rval.push(obj); - } - } - - return rval; -}; - -/** - * Converts ASN.1 CRIAttributes into an array with objects that have type and - * value properties. - * - * @param attributes the CRIAttributes to convert. - */ -pki.CRIAttributesAsArray = function(attributes) { - var rval = []; - - // each value in 'attributes' in is a SEQUENCE with an OID and a SET - for(var si = 0; si < attributes.length; ++si) { - // get the attribute sequence - var seq = attributes[si]; - - // each value in the SEQUENCE containing first a type (an OID) and - // second a set of values (defined by the OID) - var type = asn1.derToOid(seq.value[0].value); - var values = seq.value[1].value; - for(var vi = 0; vi < values.length; ++vi) { - var obj = {}; - obj.type = type; - obj.value = values[vi].value; - obj.valueTagClass = values[vi].type; - // if the OID is known, get its name and short name - if(obj.type in oids) { - obj.name = oids[obj.type]; - if(obj.name in _shortNames) { - obj.shortName = _shortNames[obj.name]; - } - } - // parse extensions - if(obj.type === oids.extensionRequest) { - obj.extensions = []; - for(var ei = 0; ei < obj.value.length; ++ei) { - obj.extensions.push(pki.certificateExtensionFromAsn1(obj.value[ei])); - } - } - rval.push(obj); - } - } - - return rval; -}; - -/** - * Gets an issuer or subject attribute from its name, type, or short name. - * - * @param obj the issuer or subject object. - * @param options a short name string or an object with: - * shortName the short name for the attribute. - * name the name for the attribute. - * type the type for the attribute. - * - * @return the attribute. - */ -function _getAttribute(obj, options) { - if(typeof options === 'string') { - options = {shortName: options}; - } - - var rval = null; - var attr; - for(var i = 0; rval === null && i < obj.attributes.length; ++i) { - attr = obj.attributes[i]; - if(options.type && options.type === attr.type) { - rval = attr; - } else if(options.name && options.name === attr.name) { - rval = attr; - } else if(options.shortName && options.shortName === attr.shortName) { - rval = attr; - } - } - return rval; -} - -/** - * Converts signature parameters from ASN.1 structure. - * - * Currently only RSASSA-PSS supported. The PKCS#1 v1.5 signature scheme had - * no parameters. - * - * RSASSA-PSS-params ::= SEQUENCE { - * hashAlgorithm [0] HashAlgorithm DEFAULT - * sha1Identifier, - * maskGenAlgorithm [1] MaskGenAlgorithm DEFAULT - * mgf1SHA1Identifier, - * saltLength [2] INTEGER DEFAULT 20, - * trailerField [3] INTEGER DEFAULT 1 - * } - * - * HashAlgorithm ::= AlgorithmIdentifier - * - * MaskGenAlgorithm ::= AlgorithmIdentifier - * - * AlgorithmIdentifer ::= SEQUENCE { - * algorithm OBJECT IDENTIFIER, - * parameters ANY DEFINED BY algorithm OPTIONAL - * } - * - * @param oid The OID specifying the signature algorithm - * @param obj The ASN.1 structure holding the parameters - * @param fillDefaults Whether to use return default values where omitted - * @return signature parameter object - */ -var _readSignatureParameters = function(oid, obj, fillDefaults) { - var params = {}; - - if(oid !== oids['RSASSA-PSS']) { - return params; - } - - if(fillDefaults) { - params = { - hash: { - algorithmOid: oids['sha1'] - }, - mgf: { - algorithmOid: oids['mgf1'], - hash: { - algorithmOid: oids['sha1'] - } - }, - saltLength: 20 - }; - } - - var capture = {}; - var errors = []; - if(!asn1.validate(obj, rsassaPssParameterValidator, capture, errors)) { - var error = new Error('Cannot read RSASSA-PSS parameter block.'); - error.errors = errors; - throw error; - } - - if(capture.hashOid !== undefined) { - params.hash = params.hash || {}; - params.hash.algorithmOid = asn1.derToOid(capture.hashOid); - } - - if(capture.maskGenOid !== undefined) { - params.mgf = params.mgf || {}; - params.mgf.algorithmOid = asn1.derToOid(capture.maskGenOid); - params.mgf.hash = params.mgf.hash || {}; - params.mgf.hash.algorithmOid = asn1.derToOid(capture.maskGenHashOid); - } - - if(capture.saltLength !== undefined) { - params.saltLength = capture.saltLength.charCodeAt(0); - } - - return params; -}; - -/** - * Converts an X.509 certificate from PEM format. - * - * Note: If the certificate is to be verified then compute hash should - * be set to true. This will scan the TBSCertificate part of the ASN.1 - * object while it is converted so it doesn't need to be converted back - * to ASN.1-DER-encoding later. - * - * @param pem the PEM-formatted certificate. - * @param computeHash true to compute the hash for verification. - * @param strict true to be strict when checking ASN.1 value lengths, false to - * allow truncated values (default: true). - * - * @return the certificate. - */ -pki.certificateFromPem = function(pem, computeHash, strict) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'CERTIFICATE' && - msg.type !== 'X509 CERTIFICATE' && - msg.type !== 'TRUSTED CERTIFICATE') { - var error = new Error( - 'Could not convert certificate from PEM; PEM header type ' + - 'is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error( - 'Could not convert certificate from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body, strict); - - return pki.certificateFromAsn1(obj, computeHash); -}; - -/** - * Converts an X.509 certificate to PEM format. - * - * @param cert the certificate. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted certificate. - */ -pki.certificateToPem = function(cert, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'CERTIFICATE', - body: asn1.toDer(pki.certificateToAsn1(cert)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts an RSA public key from PEM format. - * - * @param pem the PEM-formatted public key. - * - * @return the public key. - */ -pki.publicKeyFromPem = function(pem) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'PUBLIC KEY' && msg.type !== 'RSA PUBLIC KEY') { - var error = new Error('Could not convert public key from PEM; PEM header ' + - 'type is not "PUBLIC KEY" or "RSA PUBLIC KEY".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert public key from PEM; PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body); - - return pki.publicKeyFromAsn1(obj); -}; - -/** - * Converts an RSA public key to PEM format (using a SubjectPublicKeyInfo). - * - * @param key the public key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted public key. - */ -pki.publicKeyToPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'PUBLIC KEY', - body: asn1.toDer(pki.publicKeyToAsn1(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Converts an RSA public key to PEM format (using an RSAPublicKey). - * - * @param key the public key. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted public key. - */ -pki.publicKeyToRSAPublicKeyPem = function(key, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'RSA PUBLIC KEY', - body: asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Gets a fingerprint for the given public key. - * - * @param options the options to use. - * [md] the message digest object to use (defaults to forge.md.sha1). - * [type] the type of fingerprint, such as 'RSAPublicKey', - * 'SubjectPublicKeyInfo' (defaults to 'RSAPublicKey'). - * [encoding] an alternative output encoding, such as 'hex' - * (defaults to none, outputs a byte buffer). - * [delimiter] the delimiter to use between bytes for 'hex' encoded - * output, eg: ':' (defaults to none). - * - * @return the fingerprint as a byte buffer or other encoding based on options. - */ -pki.getPublicKeyFingerprint = function(key, options) { - options = options || {}; - var md = options.md || forge.md.sha1.create(); - var type = options.type || 'RSAPublicKey'; - - var bytes; - switch(type) { - case 'RSAPublicKey': - bytes = asn1.toDer(pki.publicKeyToRSAPublicKey(key)).getBytes(); - break; - case 'SubjectPublicKeyInfo': - bytes = asn1.toDer(pki.publicKeyToAsn1(key)).getBytes(); - break; - default: - throw new Error('Unknown fingerprint type "' + options.type + '".'); - } - - // hash public key bytes - md.start(); - md.update(bytes); - var digest = md.digest(); - if(options.encoding === 'hex') { - var hex = digest.toHex(); - if(options.delimiter) { - return hex.match(/.{2}/g).join(options.delimiter); - } - return hex; - } else if(options.encoding === 'binary') { - return digest.getBytes(); - } else if(options.encoding) { - throw new Error('Unknown encoding "' + options.encoding + '".'); - } - return digest; -}; - -/** - * Converts a PKCS#10 certification request (CSR) from PEM format. - * - * Note: If the certification request is to be verified then compute hash - * should be set to true. This will scan the CertificationRequestInfo part of - * the ASN.1 object while it is converted so it doesn't need to be converted - * back to ASN.1-DER-encoding later. - * - * @param pem the PEM-formatted certificate. - * @param computeHash true to compute the hash for verification. - * @param strict true to be strict when checking ASN.1 value lengths, false to - * allow truncated values (default: true). - * - * @return the certification request (CSR). - */ -pki.certificationRequestFromPem = function(pem, computeHash, strict) { - var msg = forge.pem.decode(pem)[0]; - - if(msg.type !== 'CERTIFICATE REQUEST') { - var error = new Error('Could not convert certification request from PEM; ' + - 'PEM header type is not "CERTIFICATE REQUEST".'); - error.headerType = msg.type; - throw error; - } - if(msg.procType && msg.procType.type === 'ENCRYPTED') { - throw new Error('Could not convert certification request from PEM; ' + - 'PEM is encrypted.'); - } - - // convert DER to ASN.1 object - var obj = asn1.fromDer(msg.body, strict); - - return pki.certificationRequestFromAsn1(obj, computeHash); -}; - -/** - * Converts a PKCS#10 certification request (CSR) to PEM format. - * - * @param csr the certification request. - * @param maxline the maximum characters per line, defaults to 64. - * - * @return the PEM-formatted certification request. - */ -pki.certificationRequestToPem = function(csr, maxline) { - // convert to ASN.1, then DER, then PEM-encode - var msg = { - type: 'CERTIFICATE REQUEST', - body: asn1.toDer(pki.certificationRequestToAsn1(csr)).getBytes() - }; - return forge.pem.encode(msg, {maxline: maxline}); -}; - -/** - * Creates an empty X.509v3 RSA certificate. - * - * @return the certificate. - */ -pki.createCertificate = function() { - var cert = {}; - cert.version = 0x02; - cert.serialNumber = '00'; - cert.signatureOid = null; - cert.signature = null; - cert.siginfo = {}; - cert.siginfo.algorithmOid = null; - cert.validity = {}; - cert.validity.notBefore = new Date(); - cert.validity.notAfter = new Date(); - - cert.issuer = {}; - cert.issuer.getField = function(sn) { - return _getAttribute(cert.issuer, sn); - }; - cert.issuer.addField = function(attr) { - _fillMissingFields([attr]); - cert.issuer.attributes.push(attr); - }; - cert.issuer.attributes = []; - cert.issuer.hash = null; - - cert.subject = {}; - cert.subject.getField = function(sn) { - return _getAttribute(cert.subject, sn); - }; - cert.subject.addField = function(attr) { - _fillMissingFields([attr]); - cert.subject.attributes.push(attr); - }; - cert.subject.attributes = []; - cert.subject.hash = null; - - cert.extensions = []; - cert.publicKey = null; - cert.md = null; - - /** - * Sets the subject of this certificate. - * - * @param attrs the array of subject attributes to use. - * @param uniqueId an optional a unique ID to use. - */ - cert.setSubject = function(attrs, uniqueId) { - // set new attributes, clear hash - _fillMissingFields(attrs); - cert.subject.attributes = attrs; - delete cert.subject.uniqueId; - if(uniqueId) { - // TODO: support arbitrary bit length ids - cert.subject.uniqueId = uniqueId; - } - cert.subject.hash = null; - }; - - /** - * Sets the issuer of this certificate. - * - * @param attrs the array of issuer attributes to use. - * @param uniqueId an optional a unique ID to use. - */ - cert.setIssuer = function(attrs, uniqueId) { - // set new attributes, clear hash - _fillMissingFields(attrs); - cert.issuer.attributes = attrs; - delete cert.issuer.uniqueId; - if(uniqueId) { - // TODO: support arbitrary bit length ids - cert.issuer.uniqueId = uniqueId; - } - cert.issuer.hash = null; - }; - - /** - * Sets the extensions of this certificate. - * - * @param exts the array of extensions to use. - */ - cert.setExtensions = function(exts) { - for(var i = 0; i < exts.length; ++i) { - _fillMissingExtensionFields(exts[i], {cert: cert}); - } - // set new extensions - cert.extensions = exts; - }; - - /** - * Gets an extension by its name or id. - * - * @param options the name to use or an object with: - * name the name to use. - * id the id to use. - * - * @return the extension or null if not found. - */ - cert.getExtension = function(options) { - if(typeof options === 'string') { - options = {name: options}; - } - - var rval = null; - var ext; - for(var i = 0; rval === null && i < cert.extensions.length; ++i) { - ext = cert.extensions[i]; - if(options.id && ext.id === options.id) { - rval = ext; - } else if(options.name && ext.name === options.name) { - rval = ext; - } - } - return rval; - }; - - /** - * Signs this certificate using the given private key. - * - * @param key the private key to sign with. - * @param md the message digest object to use (defaults to forge.md.sha1). - */ - cert.sign = function(key, md) { - // TODO: get signature OID from private key - cert.md = md || forge.md.sha1.create(); - var algorithmOid = oids[cert.md.algorithm + 'WithRSAEncryption']; - if(!algorithmOid) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown message digest algorithm OID.'); - error.algorithm = cert.md.algorithm; - throw error; - } - cert.signatureOid = cert.siginfo.algorithmOid = algorithmOid; - - // get TBSCertificate, convert to DER - cert.tbsCertificate = pki.getTBSCertificate(cert); - var bytes = asn1.toDer(cert.tbsCertificate); - - // digest and sign - cert.md.update(bytes.getBytes()); - cert.signature = key.sign(cert.md); - }; - - /** - * Attempts verify the signature on the passed certificate using this - * certificate's public key. - * - * @param child the certificate to verify. - * - * @return true if verified, false if not. - */ - cert.verify = function(child) { - var rval = false; - - if(!cert.issued(child)) { - var issuer = child.issuer; - var subject = cert.subject; - var error = new Error( - 'The parent certificate did not issue the given child ' + - 'certificate; the child certificate\'s issuer does not match the ' + - 'parent\'s subject.'); - error.expectedIssuer = issuer.attributes; - error.actualIssuer = subject.attributes; - throw error; - } - - var md = child.md; - if(md === null) { - // check signature OID for supported signature types - if(child.signatureOid in oids) { - var oid = oids[child.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - md = forge.md.sha256.create(); - break; - } - } - if(md === null) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown signature OID.'); - error.signatureOid = child.signatureOid; - throw error; - } - - // produce DER formatted TBSCertificate and digest it - var tbsCertificate = child.tbsCertificate || pki.getTBSCertificate(child); - var bytes = asn1.toDer(tbsCertificate); - md.update(bytes.getBytes()); - } - - if(md !== null) { - var scheme; - - switch(child.signatureOid) { - case oids.sha1WithRSAEncryption: - scheme = undefined; /* use PKCS#1 v1.5 padding scheme */ - break; - case oids['RSASSA-PSS']: - var hash, mgf; - - /* initialize mgf */ - hash = oids[child.signatureParameters.mgf.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported MGF hash function.'); - error.oid = child.signatureParameters.mgf.hash.algorithmOid; - error.name = hash; - throw error; - } - - mgf = oids[child.signatureParameters.mgf.algorithmOid]; - if(mgf === undefined || forge.mgf[mgf] === undefined) { - var error = new Error('Unsupported MGF function.'); - error.oid = child.signatureParameters.mgf.algorithmOid; - error.name = mgf; - throw error; - } - - mgf = forge.mgf[mgf].create(forge.md[hash].create()); - - /* initialize hash function */ - hash = oids[child.signatureParameters.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - throw { - message: 'Unsupported RSASSA-PSS hash function.', - oid: child.signatureParameters.hash.algorithmOid, - name: hash - }; - } - - scheme = forge.pss.create(forge.md[hash].create(), mgf, - child.signatureParameters.saltLength); - break; - } - - // verify signature on cert using public key - rval = cert.publicKey.verify( - md.digest().getBytes(), child.signature, scheme); - } - - return rval; - }; - - /** - * Returns true if this certificate's issuer matches the passed - * certificate's subject. Note that no signature check is performed. - * - * @param parent the certificate to check. - * - * @return true if this certificate's issuer matches the passed certificate's - * subject. - */ - cert.isIssuer = function(parent) { - var rval = false; - - var i = cert.issuer; - var s = parent.subject; - - // compare hashes if present - if(i.hash && s.hash) { - rval = (i.hash === s.hash); - } else if(i.attributes.length === s.attributes.length) { - // all attributes are the same so issuer matches subject - rval = true; - var iattr, sattr; - for(var n = 0; rval && n < i.attributes.length; ++n) { - iattr = i.attributes[n]; - sattr = s.attributes[n]; - if(iattr.type !== sattr.type || iattr.value !== sattr.value) { - // attribute mismatch - rval = false; - } - } - } - - return rval; - }; - - /** - * Returns true if this certificate's subject matches the issuer of the - * given certificate). Note that not signature check is performed. - * - * @param child the certificate to check. - * - * @return true if this certificate's subject matches the passed - * certificate's issuer. - */ - cert.issued = function(child) { - return child.isIssuer(cert); - }; - - /** - * Generates the subjectKeyIdentifier for this certificate as byte buffer. - * - * @return the subjectKeyIdentifier for this certificate as byte buffer. - */ - cert.generateSubjectKeyIdentifier = function() { - /* See: 4.2.1.2 section of the the RFC3280, keyIdentifier is either: - - (1) The keyIdentifier is composed of the 160-bit SHA-1 hash of the - value of the BIT STRING subjectPublicKey (excluding the tag, - length, and number of unused bits). - - (2) The keyIdentifier is composed of a four bit type field with - the value 0100 followed by the least significant 60 bits of the - SHA-1 hash of the value of the BIT STRING subjectPublicKey - (excluding the tag, length, and number of unused bit string bits). - */ - - // skipping the tag, length, and number of unused bits is the same - // as just using the RSAPublicKey (for RSA keys, which are the - // only ones supported) - return pki.getPublicKeyFingerprint(cert.publicKey, {type: 'RSAPublicKey'}); - }; - - /** - * Verifies the subjectKeyIdentifier extension value for this certificate - * against its public key. If no extension is found, false will be - * returned. - * - * @return true if verified, false if not. - */ - cert.verifySubjectKeyIdentifier = function() { - var oid = oids['subjectKeyIdentifier']; - for(var i = 0; i < cert.extensions.length; ++i) { - var ext = cert.extensions[i]; - if(ext.id === oid) { - var ski = cert.generateSubjectKeyIdentifier().getBytes(); - return (forge.util.hexToBytes(ext.subjectKeyIdentifier) === ski); - } - } - return false; - }; - - return cert; -}; - -/** - * Converts an X.509v3 RSA certificate from an ASN.1 object. - * - * Note: If the certificate is to be verified then compute hash should - * be set to true. There is currently no implementation for converting - * a certificate back to ASN.1 so the TBSCertificate part of the ASN.1 - * object needs to be scanned before the cert object is created. - * - * @param obj the asn1 representation of an X.509v3 RSA certificate. - * @param computeHash true to compute the hash for verification. - * - * @return the certificate. - */ -pki.certificateFromAsn1 = function(obj, computeHash) { - // validate certificate and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, x509CertificateValidator, capture, errors)) { - var error = new Error('Cannot read X.509 certificate. ' + - 'ASN.1 object is not an X509v3 Certificate.'); - error.errors = errors; - throw error; - } - - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - throw new Error('Cannot read public key. OID is not RSA.'); - } - - // create certificate - var cert = pki.createCertificate(); - cert.version = capture.certVersion ? - capture.certVersion.charCodeAt(0) : 0; - var serial = forge.util.createBuffer(capture.certSerialNumber); - cert.serialNumber = serial.toHex(); - cert.signatureOid = forge.asn1.derToOid(capture.certSignatureOid); - cert.signatureParameters = _readSignatureParameters( - cert.signatureOid, capture.certSignatureParams, true); - cert.siginfo.algorithmOid = forge.asn1.derToOid(capture.certinfoSignatureOid); - cert.siginfo.parameters = _readSignatureParameters(cert.siginfo.algorithmOid, - capture.certinfoSignatureParams, false); - cert.signature = capture.certSignature; - - var validity = []; - if(capture.certValidity1UTCTime !== undefined) { - validity.push(asn1.utcTimeToDate(capture.certValidity1UTCTime)); - } - if(capture.certValidity2GeneralizedTime !== undefined) { - validity.push(asn1.generalizedTimeToDate( - capture.certValidity2GeneralizedTime)); - } - if(capture.certValidity3UTCTime !== undefined) { - validity.push(asn1.utcTimeToDate(capture.certValidity3UTCTime)); - } - if(capture.certValidity4GeneralizedTime !== undefined) { - validity.push(asn1.generalizedTimeToDate( - capture.certValidity4GeneralizedTime)); - } - if(validity.length > 2) { - throw new Error('Cannot read notBefore/notAfter validity times; more ' + - 'than two times were provided in the certificate.'); - } - if(validity.length < 2) { - throw new Error('Cannot read notBefore/notAfter validity times; they ' + - 'were not provided as either UTCTime or GeneralizedTime.'); - } - cert.validity.notBefore = validity[0]; - cert.validity.notAfter = validity[1]; - - // keep TBSCertificate to preserve signature when exporting - cert.tbsCertificate = capture.tbsCertificate; - - if(computeHash) { - // check signature OID for supported signature types - cert.md = null; - if(cert.signatureOid in oids) { - var oid = oids[cert.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - cert.md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - cert.md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - cert.md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - cert.md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - cert.md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - cert.md = forge.md.sha256.create(); - break; - } - } - if(cert.md === null) { - var error = new Error('Could not compute certificate digest. ' + - 'Unknown signature OID.'); - error.signatureOid = cert.signatureOid; - throw error; - } - - // produce DER formatted TBSCertificate and digest it - var bytes = asn1.toDer(cert.tbsCertificate); - cert.md.update(bytes.getBytes()); - } - - // handle issuer, build issuer message digest - var imd = forge.md.sha1.create(); - cert.issuer.getField = function(sn) { - return _getAttribute(cert.issuer, sn); - }; - cert.issuer.addField = function(attr) { - _fillMissingFields([attr]); - cert.issuer.attributes.push(attr); - }; - cert.issuer.attributes = pki.RDNAttributesAsArray(capture.certIssuer, imd); - if(capture.certIssuerUniqueId) { - cert.issuer.uniqueId = capture.certIssuerUniqueId; - } - cert.issuer.hash = imd.digest().toHex(); - - // handle subject, build subject message digest - var smd = forge.md.sha1.create(); - cert.subject.getField = function(sn) { - return _getAttribute(cert.subject, sn); - }; - cert.subject.addField = function(attr) { - _fillMissingFields([attr]); - cert.subject.attributes.push(attr); - }; - cert.subject.attributes = pki.RDNAttributesAsArray(capture.certSubject, smd); - if(capture.certSubjectUniqueId) { - cert.subject.uniqueId = capture.certSubjectUniqueId; - } - cert.subject.hash = smd.digest().toHex(); - - // handle extensions - if(capture.certExtensions) { - cert.extensions = pki.certificateExtensionsFromAsn1(capture.certExtensions); - } else { - cert.extensions = []; - } - - // convert RSA public key from ASN.1 - cert.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); - - return cert; -}; - -/** - * Converts an ASN.1 extensions object (with extension sequences as its - * values) into an array of extension objects with types and values. - * - * Supported extensions: - * - * id-ce-keyUsage OBJECT IDENTIFIER ::= { id-ce 15 } - * KeyUsage ::= BIT STRING { - * digitalSignature (0), - * nonRepudiation (1), - * keyEncipherment (2), - * dataEncipherment (3), - * keyAgreement (4), - * keyCertSign (5), - * cRLSign (6), - * encipherOnly (7), - * decipherOnly (8) - * } - * - * id-ce-basicConstraints OBJECT IDENTIFIER ::= { id-ce 19 } - * BasicConstraints ::= SEQUENCE { - * cA BOOLEAN DEFAULT FALSE, - * pathLenConstraint INTEGER (0..MAX) OPTIONAL - * } - * - * subjectAltName EXTENSION ::= { - * SYNTAX GeneralNames - * IDENTIFIED BY id-ce-subjectAltName - * } - * - * GeneralNames ::= SEQUENCE SIZE (1..MAX) OF GeneralName - * - * GeneralName ::= CHOICE { - * otherName [0] INSTANCE OF OTHER-NAME, - * rfc822Name [1] IA5String, - * dNSName [2] IA5String, - * x400Address [3] ORAddress, - * directoryName [4] Name, - * ediPartyName [5] EDIPartyName, - * uniformResourceIdentifier [6] IA5String, - * IPAddress [7] OCTET STRING, - * registeredID [8] OBJECT IDENTIFIER - * } - * - * OTHER-NAME ::= TYPE-IDENTIFIER - * - * EDIPartyName ::= SEQUENCE { - * nameAssigner [0] DirectoryString {ub-name} OPTIONAL, - * partyName [1] DirectoryString {ub-name} - * } - * - * @param exts the extensions ASN.1 with extension sequences to parse. - * - * @return the array. - */ -pki.certificateExtensionsFromAsn1 = function(exts) { - var rval = []; - for(var i = 0; i < exts.value.length; ++i) { - // get extension sequence - var extseq = exts.value[i]; - for(var ei = 0; ei < extseq.value.length; ++ei) { - rval.push(pki.certificateExtensionFromAsn1(extseq.value[ei])); - } - } - - return rval; -}; - -/** - * Parses a single certificate extension from ASN.1. - * - * @param ext the extension in ASN.1 format. - * - * @return the parsed extension as an object. - */ -pki.certificateExtensionFromAsn1 = function(ext) { - // an extension has: - // [0] extnID OBJECT IDENTIFIER - // [1] critical BOOLEAN DEFAULT FALSE - // [2] extnValue OCTET STRING - var e = {}; - e.id = asn1.derToOid(ext.value[0].value); - e.critical = false; - if(ext.value[1].type === asn1.Type.BOOLEAN) { - e.critical = (ext.value[1].value.charCodeAt(0) !== 0x00); - e.value = ext.value[2].value; - } else { - e.value = ext.value[1].value; - } - // if the oid is known, get its name - if(e.id in oids) { - e.name = oids[e.id]; - - // handle key usage - if(e.name === 'keyUsage') { - // get value as BIT STRING - var ev = asn1.fromDer(e.value); - var b2 = 0x00; - var b3 = 0x00; - if(ev.value.length > 1) { - // skip first byte, just indicates unused bits which - // will be padded with 0s anyway - // get bytes with flag bits - b2 = ev.value.charCodeAt(1); - b3 = ev.value.length > 2 ? ev.value.charCodeAt(2) : 0; - } - // set flags - e.digitalSignature = (b2 & 0x80) === 0x80; - e.nonRepudiation = (b2 & 0x40) === 0x40; - e.keyEncipherment = (b2 & 0x20) === 0x20; - e.dataEncipherment = (b2 & 0x10) === 0x10; - e.keyAgreement = (b2 & 0x08) === 0x08; - e.keyCertSign = (b2 & 0x04) === 0x04; - e.cRLSign = (b2 & 0x02) === 0x02; - e.encipherOnly = (b2 & 0x01) === 0x01; - e.decipherOnly = (b3 & 0x80) === 0x80; - } else if(e.name === 'basicConstraints') { - // handle basic constraints - // get value as SEQUENCE - var ev = asn1.fromDer(e.value); - // get cA BOOLEAN flag (defaults to false) - if(ev.value.length > 0 && ev.value[0].type === asn1.Type.BOOLEAN) { - e.cA = (ev.value[0].value.charCodeAt(0) !== 0x00); - } else { - e.cA = false; - } - // get path length constraint - var value = null; - if(ev.value.length > 0 && ev.value[0].type === asn1.Type.INTEGER) { - value = ev.value[0].value; - } else if(ev.value.length > 1) { - value = ev.value[1].value; - } - if(value !== null) { - e.pathLenConstraint = asn1.derToInteger(value); - } - } else if(e.name === 'extKeyUsage') { - // handle extKeyUsage - // value is a SEQUENCE of OIDs - var ev = asn1.fromDer(e.value); - for(var vi = 0; vi < ev.value.length; ++vi) { - var oid = asn1.derToOid(ev.value[vi].value); - if(oid in oids) { - e[oids[oid]] = true; - } else { - e[oid] = true; - } - } - } else if(e.name === 'nsCertType') { - // handle nsCertType - // get value as BIT STRING - var ev = asn1.fromDer(e.value); - var b2 = 0x00; - if(ev.value.length > 1) { - // skip first byte, just indicates unused bits which - // will be padded with 0s anyway - // get bytes with flag bits - b2 = ev.value.charCodeAt(1); - } - // set flags - e.client = (b2 & 0x80) === 0x80; - e.server = (b2 & 0x40) === 0x40; - e.email = (b2 & 0x20) === 0x20; - e.objsign = (b2 & 0x10) === 0x10; - e.reserved = (b2 & 0x08) === 0x08; - e.sslCA = (b2 & 0x04) === 0x04; - e.emailCA = (b2 & 0x02) === 0x02; - e.objCA = (b2 & 0x01) === 0x01; - } else if( - e.name === 'subjectAltName' || - e.name === 'issuerAltName') { - // handle subjectAltName/issuerAltName - e.altNames = []; - - // ev is a SYNTAX SEQUENCE - var gn; - var ev = asn1.fromDer(e.value); - for(var n = 0; n < ev.value.length; ++n) { - // get GeneralName - gn = ev.value[n]; - - var altName = { - type: gn.type, - value: gn.value - }; - e.altNames.push(altName); - - // Note: Support for types 1,2,6,7,8 - switch(gn.type) { - // rfc822Name - case 1: - // dNSName - case 2: - // uniformResourceIdentifier (URI) - case 6: - break; - // IPAddress - case 7: - // convert to IPv4/IPv6 string representation - altName.ip = forge.util.bytesToIP(gn.value); - break; - // registeredID - case 8: - altName.oid = asn1.derToOid(gn.value); - break; - default: - // unsupported - } - } - } else if(e.name === 'subjectKeyIdentifier') { - // value is an OCTETSTRING w/the hash of the key-type specific - // public key structure (eg: RSAPublicKey) - var ev = asn1.fromDer(e.value); - e.subjectKeyIdentifier = forge.util.bytesToHex(ev.value); - } - } - return e; -}; - -/** - * Converts a PKCS#10 certification request (CSR) from an ASN.1 object. - * - * Note: If the certification request is to be verified then compute hash - * should be set to true. There is currently no implementation for converting - * a certificate back to ASN.1 so the CertificationRequestInfo part of the - * ASN.1 object needs to be scanned before the csr object is created. - * - * @param obj the asn1 representation of a PKCS#10 certification request (CSR). - * @param computeHash true to compute the hash for verification. - * - * @return the certification request (CSR). - */ -pki.certificationRequestFromAsn1 = function(obj, computeHash) { - // validate certification request and capture data - var capture = {}; - var errors = []; - if(!asn1.validate(obj, certificationRequestValidator, capture, errors)) { - var error = new Error('Cannot read PKCS#10 certificate request. ' + - 'ASN.1 object is not a PKCS#10 CertificationRequest.'); - error.errors = errors; - throw error; - } - - // get oid - var oid = asn1.derToOid(capture.publicKeyOid); - if(oid !== pki.oids.rsaEncryption) { - throw new Error('Cannot read public key. OID is not RSA.'); - } - - // create certification request - var csr = pki.createCertificationRequest(); - csr.version = capture.csrVersion ? capture.csrVersion.charCodeAt(0) : 0; - csr.signatureOid = forge.asn1.derToOid(capture.csrSignatureOid); - csr.signatureParameters = _readSignatureParameters( - csr.signatureOid, capture.csrSignatureParams, true); - csr.siginfo.algorithmOid = forge.asn1.derToOid(capture.csrSignatureOid); - csr.siginfo.parameters = _readSignatureParameters( - csr.siginfo.algorithmOid, capture.csrSignatureParams, false); - csr.signature = capture.csrSignature; - - // keep CertificationRequestInfo to preserve signature when exporting - csr.certificationRequestInfo = capture.certificationRequestInfo; - - if(computeHash) { - // check signature OID for supported signature types - csr.md = null; - if(csr.signatureOid in oids) { - var oid = oids[csr.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - csr.md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - csr.md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - csr.md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - csr.md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - csr.md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - csr.md = forge.md.sha256.create(); - break; - } - } - if(csr.md === null) { - var error = new Error('Could not compute certification request digest. ' + - 'Unknown signature OID.'); - error.signatureOid = csr.signatureOid; - throw error; - } - - // produce DER formatted CertificationRequestInfo and digest it - var bytes = asn1.toDer(csr.certificationRequestInfo); - csr.md.update(bytes.getBytes()); - } - - // handle subject, build subject message digest - var smd = forge.md.sha1.create(); - csr.subject.getField = function(sn) { - return _getAttribute(csr.subject, sn); - }; - csr.subject.addField = function(attr) { - _fillMissingFields([attr]); - csr.subject.attributes.push(attr); - }; - csr.subject.attributes = pki.RDNAttributesAsArray( - capture.certificationRequestInfoSubject, smd); - csr.subject.hash = smd.digest().toHex(); - - // convert RSA public key from ASN.1 - csr.publicKey = pki.publicKeyFromAsn1(capture.subjectPublicKeyInfo); - - // convert attributes from ASN.1 - csr.getAttribute = function(sn) { - return _getAttribute(csr, sn); - }; - csr.addAttribute = function(attr) { - _fillMissingFields([attr]); - csr.attributes.push(attr); - }; - csr.attributes = pki.CRIAttributesAsArray( - capture.certificationRequestInfoAttributes || []); - - return csr; -}; - -/** - * Creates an empty certification request (a CSR or certificate signing - * request). Once created, its public key and attributes can be set and then - * it can be signed. - * - * @return the empty certification request. - */ -pki.createCertificationRequest = function() { - var csr = {}; - csr.version = 0x00; - csr.signatureOid = null; - csr.signature = null; - csr.siginfo = {}; - csr.siginfo.algorithmOid = null; - - csr.subject = {}; - csr.subject.getField = function(sn) { - return _getAttribute(csr.subject, sn); - }; - csr.subject.addField = function(attr) { - _fillMissingFields([attr]); - csr.subject.attributes.push(attr); - }; - csr.subject.attributes = []; - csr.subject.hash = null; - - csr.publicKey = null; - csr.attributes = []; - csr.getAttribute = function(sn) { - return _getAttribute(csr, sn); - }; - csr.addAttribute = function(attr) { - _fillMissingFields([attr]); - csr.attributes.push(attr); - }; - csr.md = null; - - /** - * Sets the subject of this certification request. - * - * @param attrs the array of subject attributes to use. - */ - csr.setSubject = function(attrs) { - // set new attributes - _fillMissingFields(attrs); - csr.subject.attributes = attrs; - csr.subject.hash = null; - }; - - /** - * Sets the attributes of this certification request. - * - * @param attrs the array of attributes to use. - */ - csr.setAttributes = function(attrs) { - // set new attributes - _fillMissingFields(attrs); - csr.attributes = attrs; - }; - - /** - * Signs this certification request using the given private key. - * - * @param key the private key to sign with. - * @param md the message digest object to use (defaults to forge.md.sha1). - */ - csr.sign = function(key, md) { - // TODO: get signature OID from private key - csr.md = md || forge.md.sha1.create(); - var algorithmOid = oids[csr.md.algorithm + 'WithRSAEncryption']; - if(!algorithmOid) { - var error = new Error('Could not compute certification request digest. ' + - 'Unknown message digest algorithm OID.'); - error.algorithm = csr.md.algorithm; - throw error; - } - csr.signatureOid = csr.siginfo.algorithmOid = algorithmOid; - - // get CertificationRequestInfo, convert to DER - csr.certificationRequestInfo = pki.getCertificationRequestInfo(csr); - var bytes = asn1.toDer(csr.certificationRequestInfo); - - // digest and sign - csr.md.update(bytes.getBytes()); - csr.signature = key.sign(csr.md); - }; - - /** - * Attempts verify the signature on the passed certification request using - * its public key. - * - * A CSR that has been exported to a file in PEM format can be verified using - * OpenSSL using this command: - * - * openssl req -in -verify -noout -text - * - * @return true if verified, false if not. - */ - csr.verify = function() { - var rval = false; - - var md = csr.md; - if(md === null) { - // check signature OID for supported signature types - if(csr.signatureOid in oids) { - // TODO: create DRY `OID to md` function - var oid = oids[csr.signatureOid]; - switch(oid) { - case 'sha1WithRSAEncryption': - md = forge.md.sha1.create(); - break; - case 'md5WithRSAEncryption': - md = forge.md.md5.create(); - break; - case 'sha256WithRSAEncryption': - md = forge.md.sha256.create(); - break; - case 'sha384WithRSAEncryption': - md = forge.md.sha384.create(); - break; - case 'sha512WithRSAEncryption': - md = forge.md.sha512.create(); - break; - case 'RSASSA-PSS': - md = forge.md.sha256.create(); - break; - } - } - if(md === null) { - var error = new Error( - 'Could not compute certification request digest. ' + - 'Unknown signature OID.'); - error.signatureOid = csr.signatureOid; - throw error; - } - - // produce DER formatted CertificationRequestInfo and digest it - var cri = csr.certificationRequestInfo || - pki.getCertificationRequestInfo(csr); - var bytes = asn1.toDer(cri); - md.update(bytes.getBytes()); - } - - if(md !== null) { - var scheme; - - switch(csr.signatureOid) { - case oids.sha1WithRSAEncryption: - /* use PKCS#1 v1.5 padding scheme */ - break; - case oids['RSASSA-PSS']: - var hash, mgf; - - /* initialize mgf */ - hash = oids[csr.signatureParameters.mgf.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported MGF hash function.'); - error.oid = csr.signatureParameters.mgf.hash.algorithmOid; - error.name = hash; - throw error; - } - - mgf = oids[csr.signatureParameters.mgf.algorithmOid]; - if(mgf === undefined || forge.mgf[mgf] === undefined) { - var error = new Error('Unsupported MGF function.'); - error.oid = csr.signatureParameters.mgf.algorithmOid; - error.name = mgf; - throw error; - } - - mgf = forge.mgf[mgf].create(forge.md[hash].create()); - - /* initialize hash function */ - hash = oids[csr.signatureParameters.hash.algorithmOid]; - if(hash === undefined || forge.md[hash] === undefined) { - var error = new Error('Unsupported RSASSA-PSS hash function.'); - error.oid = csr.signatureParameters.hash.algorithmOid; - error.name = hash; - throw error; - } - - scheme = forge.pss.create(forge.md[hash].create(), mgf, - csr.signatureParameters.saltLength); - break; - } - - // verify signature on csr using its public key - rval = csr.publicKey.verify( - md.digest().getBytes(), csr.signature, scheme); - } - - return rval; - }; - - return csr; -}; - -/** - * Converts an X.509 subject or issuer to an ASN.1 RDNSequence. - * - * @param obj the subject or issuer (distinguished name). - * - * @return the ASN.1 RDNSequence. - */ -function _dnToAsn1(obj) { - // create an empty RDNSequence - var rval = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // iterate over attributes - var attr, set; - var attrs = obj.attributes; - for(var i = 0; i < attrs.length; ++i) { - attr = attrs[i]; - var value = attr.value; - - // reuse tag class for attribute value if available - var valueTagClass = asn1.Type.PRINTABLESTRING; - if('valueTagClass' in attr) { - valueTagClass = attr.valueTagClass; - - if(valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(value); - } - // FIXME: handle more encodings - } - - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - set = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - // AttributeValue - asn1.create(asn1.Class.UNIVERSAL, valueTagClass, false, value) - ]) - ]); - rval.value.push(set); - } - - return rval; -} - -/** - * Gets all printable attributes (typically of an issuer or subject) in a - * simplified JSON format for display. - * - * @param attrs the attributes. - * - * @return the JSON for display. - */ -function _getAttributesAsJson(attrs) { - var rval = {}; - for(var i = 0; i < attrs.length; ++i) { - var attr = attrs[i]; - if(attr.shortName && ( - attr.valueTagClass === asn1.Type.UTF8 || - attr.valueTagClass === asn1.Type.PRINTABLESTRING || - attr.valueTagClass === asn1.Type.IA5STRING)) { - var value = attr.value; - if(attr.valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(attr.value); - } - if(!(attr.shortName in rval)) { - rval[attr.shortName] = value; - } else if(forge.util.isArray(rval[attr.shortName])) { - rval[attr.shortName].push(value); - } else { - rval[attr.shortName] = [rval[attr.shortName], value]; - } - } - } - return rval; -} - -/** - * Fills in missing fields in attributes. - * - * @param attrs the attributes to fill missing fields in. - */ -function _fillMissingFields(attrs) { - var attr; - for(var i = 0; i < attrs.length; ++i) { - attr = attrs[i]; - - // populate missing name - if(typeof attr.name === 'undefined') { - if(attr.type && attr.type in pki.oids) { - attr.name = pki.oids[attr.type]; - } else if(attr.shortName && attr.shortName in _shortNames) { - attr.name = pki.oids[_shortNames[attr.shortName]]; - } - } - - // populate missing type (OID) - if(typeof attr.type === 'undefined') { - if(attr.name && attr.name in pki.oids) { - attr.type = pki.oids[attr.name]; - } else { - var error = new Error('Attribute type not specified.'); - error.attribute = attr; - throw error; - } - } - - // populate missing shortname - if(typeof attr.shortName === 'undefined') { - if(attr.name && attr.name in _shortNames) { - attr.shortName = _shortNames[attr.name]; - } - } - - // convert extensions to value - if(attr.type === oids.extensionRequest) { - attr.valueConstructed = true; - attr.valueTagClass = asn1.Type.SEQUENCE; - if(!attr.value && attr.extensions) { - attr.value = []; - for(var ei = 0; ei < attr.extensions.length; ++ei) { - attr.value.push(pki.certificateExtensionToAsn1( - _fillMissingExtensionFields(attr.extensions[ei]))); - } - } - } - - if(typeof attr.value === 'undefined') { - var error = new Error('Attribute value not specified.'); - error.attribute = attr; - throw error; - } - } -} - -/** - * Fills in missing fields in certificate extensions. - * - * @param e the extension. - * @param [options] the options to use. - * [cert] the certificate the extensions are for. - * - * @return the extension. - */ -function _fillMissingExtensionFields(e, options) { - options = options || {}; - - // populate missing name - if(typeof e.name === 'undefined') { - if(e.id && e.id in pki.oids) { - e.name = pki.oids[e.id]; - } - } - - // populate missing id - if(typeof e.id === 'undefined') { - if(e.name && e.name in pki.oids) { - e.id = pki.oids[e.name]; - } else { - var error = new Error('Extension ID not specified.'); - error.extension = e; - throw error; - } - } - - if(typeof e.value !== 'undefined') { - return e; - } - - // handle missing value: - - // value is a BIT STRING - if(e.name === 'keyUsage') { - // build flags - var unused = 0; - var b2 = 0x00; - var b3 = 0x00; - if(e.digitalSignature) { - b2 |= 0x80; - unused = 7; - } - if(e.nonRepudiation) { - b2 |= 0x40; - unused = 6; - } - if(e.keyEncipherment) { - b2 |= 0x20; - unused = 5; - } - if(e.dataEncipherment) { - b2 |= 0x10; - unused = 4; - } - if(e.keyAgreement) { - b2 |= 0x08; - unused = 3; - } - if(e.keyCertSign) { - b2 |= 0x04; - unused = 2; - } - if(e.cRLSign) { - b2 |= 0x02; - unused = 1; - } - if(e.encipherOnly) { - b2 |= 0x01; - unused = 0; - } - if(e.decipherOnly) { - b3 |= 0x80; - unused = 7; - } - - // create bit string - var value = String.fromCharCode(unused); - if(b3 !== 0) { - value += String.fromCharCode(b2) + String.fromCharCode(b3); - } else if(b2 !== 0) { - value += String.fromCharCode(b2); - } - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); - } else if(e.name === 'basicConstraints') { - // basicConstraints is a SEQUENCE - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - // cA BOOLEAN flag defaults to false - if(e.cA) { - e.value.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, - String.fromCharCode(0xFF))); - } - if('pathLenConstraint' in e) { - e.value.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(e.pathLenConstraint).getBytes())); - } - } else if(e.name === 'extKeyUsage') { - // extKeyUsage is a SEQUENCE of OIDs - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - for(var key in e) { - if(e[key] !== true) { - continue; - } - // key is name in OID map - if(key in oids) { - seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, - false, asn1.oidToDer(oids[key]).getBytes())); - } else if(key.indexOf('.') !== -1) { - // assume key is an OID - seq.push(asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, - false, asn1.oidToDer(key).getBytes())); - } - } - } else if(e.name === 'nsCertType') { - // nsCertType is a BIT STRING - // build flags - var unused = 0; - var b2 = 0x00; - - if(e.client) { - b2 |= 0x80; - unused = 7; - } - if(e.server) { - b2 |= 0x40; - unused = 6; - } - if(e.email) { - b2 |= 0x20; - unused = 5; - } - if(e.objsign) { - b2 |= 0x10; - unused = 4; - } - if(e.reserved) { - b2 |= 0x08; - unused = 3; - } - if(e.sslCA) { - b2 |= 0x04; - unused = 2; - } - if(e.emailCA) { - b2 |= 0x02; - unused = 1; - } - if(e.objCA) { - b2 |= 0x01; - unused = 0; - } - - // create bit string - var value = String.fromCharCode(unused); - if(b2 !== 0) { - value += String.fromCharCode(b2); - } - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, value); - } else if(e.name === 'subjectAltName' || e.name === 'issuerAltName') { - // SYNTAX SEQUENCE - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - var altName; - for(var n = 0; n < e.altNames.length; ++n) { - altName = e.altNames[n]; - var value = altName.value; - // handle IP - if(altName.type === 7 && altName.ip) { - value = forge.util.bytesFromIP(altName.ip); - if(value === null) { - var error = new Error( - 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); - error.extension = e; - throw error; - } - } else if(altName.type === 8) { - // handle OID - if(altName.oid) { - value = asn1.oidToDer(asn1.oidToDer(altName.oid)); - } else { - // deprecated ... convert value to OID - value = asn1.oidToDer(value); - } - } - e.value.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, altName.type, false, - value)); - } - } else if(e.name === 'nsComment' && options.cert) { - // sanity check value is ASCII (req'd) and not too big - if(!(/^[\x00-\x7F]*$/.test(e.comment)) || - (e.comment.length < 1) || (e.comment.length > 128)) { - throw new Error('Invalid "nsComment" content.'); - } - // IA5STRING opaque comment - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.IA5STRING, false, e.comment); - } else if(e.name === 'subjectKeyIdentifier' && options.cert) { - var ski = options.cert.generateSubjectKeyIdentifier(); - e.subjectKeyIdentifier = ski.toHex(); - // OCTETSTRING w/digest - e.value = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, ski.getBytes()); - } else if(e.name === 'authorityKeyIdentifier' && options.cert) { - // SYNTAX SEQUENCE - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - - if(e.keyIdentifier) { - var keyIdentifier = (e.keyIdentifier === true ? - options.cert.generateSubjectKeyIdentifier().getBytes() : - e.keyIdentifier); - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, false, keyIdentifier)); - } - - if(e.authorityCertIssuer) { - var authorityCertIssuer = [ - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 4, true, [ - _dnToAsn1(e.authorityCertIssuer === true ? - options.cert.issuer : e.authorityCertIssuer) - ]) - ]; - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, authorityCertIssuer)); - } - - if(e.serialNumber) { - var serialNumber = forge.util.hexToBytes(e.serialNumber === true ? - options.cert.serialNumber : e.serialNumber); - seq.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, false, serialNumber)); - } - } else if(e.name === 'cRLDistributionPoints') { - e.value = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - var seq = e.value.value; - - // Create sub SEQUENCE of DistributionPointName - var subSeq = asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // Create fullName CHOICE - var fullNameGeneralNames = asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - var altName; - for(var n = 0; n < e.altNames.length; ++n) { - altName = e.altNames[n]; - var value = altName.value; - // handle IP - if(altName.type === 7 && altName.ip) { - value = forge.util.bytesFromIP(altName.ip); - if(value === null) { - var error = new Error( - 'Extension "ip" value is not a valid IPv4 or IPv6 address.'); - error.extension = e; - throw error; - } - } else if(altName.type === 8) { - // handle OID - if(altName.oid) { - value = asn1.oidToDer(asn1.oidToDer(altName.oid)); - } else { - // deprecated ... convert value to OID - value = asn1.oidToDer(value); - } - } - fullNameGeneralNames.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, altName.type, false, - value)); - } - - // Add to the parent SEQUENCE - subSeq.value.push(asn1.create( - asn1.Class.CONTEXT_SPECIFIC, 0, true, [fullNameGeneralNames])); - seq.push(subSeq); - } - - // ensure value has been defined by now - if(typeof e.value === 'undefined') { - var error = new Error('Extension value not specified.'); - error.extension = e; - throw error; - } - - return e; -} - -/** - * Convert signature parameters object to ASN.1 - * - * @param {String} oid Signature algorithm OID - * @param params The signature parametrs object - * @return ASN.1 object representing signature parameters - */ -function _signatureParametersToAsn1(oid, params) { - switch(oid) { - case oids['RSASSA-PSS']: - var parts = []; - - if(params.hash.algorithmOid !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.hash.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ])); - } - - if(params.mgf.algorithmOid !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.mgf.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(params.mgf.hash.algorithmOid).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, '') - ]) - ]) - ])); - } - - if(params.saltLength !== undefined) { - parts.push(asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(params.saltLength).getBytes()) - ])); - } - - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, parts); - - default: - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.NULL, false, ''); - } -} - -/** - * Converts a certification request's attributes to an ASN.1 set of - * CRIAttributes. - * - * @param csr certification request. - * - * @return the ASN.1 set of CRIAttributes. - */ -function _CRIAttributesToAsn1(csr) { - // create an empty context-specific container - var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, []); - - // no attributes, return empty container - if(csr.attributes.length === 0) { - return rval; - } - - // each attribute has a sequence with a type and a set of values - var attrs = csr.attributes; - for(var i = 0; i < attrs.length; ++i) { - var attr = attrs[i]; - var value = attr.value; - - // reuse tag class for attribute value if available - var valueTagClass = asn1.Type.UTF8; - if('valueTagClass' in attr) { - valueTagClass = attr.valueTagClass; - } - if(valueTagClass === asn1.Type.UTF8) { - value = forge.util.encodeUtf8(value); - } - var valueConstructed = false; - if('valueConstructed' in attr) { - valueConstructed = attr.valueConstructed; - } - // FIXME: handle more encodings - - // create a RelativeDistinguishedName set - // each value in the set is an AttributeTypeAndValue first - // containing the type (an OID) and second the value - var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // AttributeType - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(attr.type).getBytes()), - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SET, true, [ - // AttributeValue - asn1.create( - asn1.Class.UNIVERSAL, valueTagClass, valueConstructed, value) - ]) - ]); - rval.value.push(seq); - } - - return rval; -} - -var jan_1_1950 = new Date('1950-01-01T00:00:00Z'); -var jan_1_2050 = new Date('2050-01-01T00:00:00Z'); - -/** - * Converts a Date object to ASN.1 - * Handles the different format before and after 1st January 2050 - * - * @param date date object. - * - * @return the ASN.1 object representing the date. - */ -function _dateToAsn1(date) { - if(date >= jan_1_1950 && date < jan_1_2050) { - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.UTCTIME, false, - asn1.dateToUtcTime(date)); - } else { - return asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.GENERALIZEDTIME, false, - asn1.dateToGeneralizedTime(date)); - } -} - -/** - * Gets the ASN.1 TBSCertificate part of an X.509v3 certificate. - * - * @param cert the certificate. - * - * @return the asn1 TBSCertificate. - */ -pki.getTBSCertificate = function(cert) { - // TBSCertificate - var notBefore = _dateToAsn1(cert.validity.notBefore); - var notAfter = _dateToAsn1(cert.validity.notAfter); - var tbs = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 0, true, [ - // integer - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(cert.version).getBytes()) - ]), - // serialNumber - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - forge.util.hexToBytes(cert.serialNumber)), - // signature - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(cert.siginfo.algorithmOid).getBytes()), - // parameters - _signatureParametersToAsn1( - cert.siginfo.algorithmOid, cert.siginfo.parameters) - ]), - // issuer - _dnToAsn1(cert.issuer), - // validity - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - notBefore, - notAfter - ]), - // subject - _dnToAsn1(cert.subject), - // SubjectPublicKeyInfo - pki.publicKeyToAsn1(cert.publicKey) - ]); - - if(cert.issuer.uniqueId) { - // issuerUniqueID (optional) - tbs.value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 1, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - // TODO: support arbitrary bit length ids - String.fromCharCode(0x00) + - cert.issuer.uniqueId - ) - ]) - ); - } - if(cert.subject.uniqueId) { - // subjectUniqueID (optional) - tbs.value.push( - asn1.create(asn1.Class.CONTEXT_SPECIFIC, 2, true, [ - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - // TODO: support arbitrary bit length ids - String.fromCharCode(0x00) + - cert.subject.uniqueId - ) - ]) - ); - } - - if(cert.extensions.length > 0) { - // extensions (optional) - tbs.value.push(pki.certificateExtensionsToAsn1(cert.extensions)); - } - - return tbs; -}; - -/** - * Gets the ASN.1 CertificationRequestInfo part of a - * PKCS#10 CertificationRequest. - * - * @param csr the certification request. - * - * @return the asn1 CertificationRequestInfo. - */ -pki.getCertificationRequestInfo = function(csr) { - // CertificationRequestInfo - var cri = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // version - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.INTEGER, false, - asn1.integerToDer(csr.version).getBytes()), - // subject - _dnToAsn1(csr.subject), - // SubjectPublicKeyInfo - pki.publicKeyToAsn1(csr.publicKey), - // attributes - _CRIAttributesToAsn1(csr) - ]); - - return cri; -}; - -/** - * Converts a DistinguishedName (subject or issuer) to an ASN.1 object. - * - * @param dn the DistinguishedName. - * - * @return the asn1 representation of a DistinguishedName. - */ -pki.distinguishedNameToAsn1 = function(dn) { - return _dnToAsn1(dn); -}; - -/** - * Converts an X.509v3 RSA certificate to an ASN.1 object. - * - * @param cert the certificate. - * - * @return the asn1 representation of an X.509v3 RSA certificate. - */ -pki.certificateToAsn1 = function(cert) { - // prefer cached TBSCertificate over generating one - var tbsCertificate = cert.tbsCertificate || pki.getTBSCertificate(cert); - - // Certificate - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // TBSCertificate - tbsCertificate, - // AlgorithmIdentifier (signature algorithm) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(cert.signatureOid).getBytes()), - // parameters - _signatureParametersToAsn1(cert.signatureOid, cert.signatureParameters) - ]), - // SignatureValue - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - String.fromCharCode(0x00) + cert.signature) - ]); -}; - -/** - * Converts X.509v3 certificate extensions to ASN.1. - * - * @param exts the extensions to convert. - * - * @return the extensions in ASN.1 format. - */ -pki.certificateExtensionsToAsn1 = function(exts) { - // create top-level extension container - var rval = asn1.create(asn1.Class.CONTEXT_SPECIFIC, 3, true, []); - - // create extension sequence (stores a sequence for each extension) - var seq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - rval.value.push(seq); - - for(var i = 0; i < exts.length; ++i) { - seq.value.push(pki.certificateExtensionToAsn1(exts[i])); - } - - return rval; -}; - -/** - * Converts a single certificate extension to ASN.1. - * - * @param ext the extension to convert. - * - * @return the extension in ASN.1 format. - */ -pki.certificateExtensionToAsn1 = function(ext) { - // create a sequence for each extension - var extseq = asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, []); - - // extnID (OID) - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(ext.id).getBytes())); - - // critical defaults to false - if(ext.critical) { - // critical BOOLEAN DEFAULT FALSE - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.BOOLEAN, false, - String.fromCharCode(0xFF))); - } - - var value = ext.value; - if(typeof ext.value !== 'string') { - // value is asn.1 - value = asn1.toDer(value).getBytes(); - } - - // extnValue (OCTET STRING) - extseq.value.push(asn1.create( - asn1.Class.UNIVERSAL, asn1.Type.OCTETSTRING, false, value)); - - return extseq; -}; - -/** - * Converts a PKCS#10 certification request to an ASN.1 object. - * - * @param csr the certification request. - * - * @return the asn1 representation of a certification request. - */ -pki.certificationRequestToAsn1 = function(csr) { - // prefer cached CertificationRequestInfo over generating one - var cri = csr.certificationRequestInfo || - pki.getCertificationRequestInfo(csr); - - // Certificate - return asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // CertificationRequestInfo - cri, - // AlgorithmIdentifier (signature algorithm) - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.SEQUENCE, true, [ - // algorithm - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.OID, false, - asn1.oidToDer(csr.signatureOid).getBytes()), - // parameters - _signatureParametersToAsn1(csr.signatureOid, csr.signatureParameters) - ]), - // signature - asn1.create(asn1.Class.UNIVERSAL, asn1.Type.BITSTRING, false, - String.fromCharCode(0x00) + csr.signature) - ]); -}; - -/** - * Creates a CA store. - * - * @param certs an optional array of certificate objects or PEM-formatted - * certificate strings to add to the CA store. - * - * @return the CA store. - */ -pki.createCaStore = function(certs) { - // create CA store - var caStore = { - // stored certificates - certs: {} - }; - - /** - * Gets the certificate that issued the passed certificate or its - * 'parent'. - * - * @param cert the certificate to get the parent for. - * - * @return the parent certificate or null if none was found. - */ - caStore.getIssuer = function(cert) { - var rval = getBySubject(cert.issuer); - - // see if there are multiple matches - /*if(forge.util.isArray(rval)) { - // TODO: resolve multiple matches by checking - // authorityKey/subjectKey/issuerUniqueID/other identifiers, etc. - // FIXME: or alternatively do authority key mapping - // if possible (X.509v1 certs can't work?) - throw new Error('Resolving multiple issuer matches not implemented yet.'); - }*/ - - return rval; - }; - - /** - * Adds a trusted certificate to the store. - * - * @param cert the certificate to add as a trusted certificate (either a - * pki.certificate object or a PEM-formatted certificate). - */ - caStore.addCertificate = function(cert) { - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - - ensureSubjectHasHash(cert.subject); - - if(!caStore.hasCertificate(cert)) { // avoid duplicate certificates in store - if(cert.subject.hash in caStore.certs) { - // subject hash already exists, append to array - var tmp = caStore.certs[cert.subject.hash]; - if(!forge.util.isArray(tmp)) { - tmp = [tmp]; - } - tmp.push(cert); - caStore.certs[cert.subject.hash] = tmp; - } else { - caStore.certs[cert.subject.hash] = cert; - } - } - }; - - /** - * Checks to see if the given certificate is in the store. - * - * @param cert the certificate to check (either a pki.certificate or a - * PEM-formatted certificate). - * - * @return true if the certificate is in the store, false if not. - */ - caStore.hasCertificate = function(cert) { - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - - var match = getBySubject(cert.subject); - if(!match) { - return false; - } - if(!forge.util.isArray(match)) { - match = [match]; - } - // compare DER-encoding of certificates - var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); - for(var i = 0; i < match.length; ++i) { - var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); - if(der1 === der2) { - return true; - } - } - return false; - }; - - /** - * Lists all of the certificates kept in the store. - * - * @return an array of all of the pki.certificate objects in the store. - */ - caStore.listAllCertificates = function() { - var certList = []; - - for(var hash in caStore.certs) { - if(caStore.certs.hasOwnProperty(hash)) { - var value = caStore.certs[hash]; - if(!forge.util.isArray(value)) { - certList.push(value); - } else { - for(var i = 0; i < value.length; ++i) { - certList.push(value[i]); - } - } - } - } - - return certList; - }; - - /** - * Removes a certificate from the store. - * - * @param cert the certificate to remove (either a pki.certificate or a - * PEM-formatted certificate). - * - * @return the certificate that was removed or null if the certificate - * wasn't in store. - */ - caStore.removeCertificate = function(cert) { - var result; - - // convert from pem if necessary - if(typeof cert === 'string') { - cert = forge.pki.certificateFromPem(cert); - } - ensureSubjectHasHash(cert.subject); - if(!caStore.hasCertificate(cert)) { - return null; - } - - var match = getBySubject(cert.subject); - - if(!forge.util.isArray(match)) { - result = caStore.certs[cert.subject.hash]; - delete caStore.certs[cert.subject.hash]; - return result; - } - - // compare DER-encoding of certificates - var der1 = asn1.toDer(pki.certificateToAsn1(cert)).getBytes(); - for(var i = 0; i < match.length; ++i) { - var der2 = asn1.toDer(pki.certificateToAsn1(match[i])).getBytes(); - if(der1 === der2) { - result = match[i]; - match.splice(i, 1); - } - } - if(match.length === 0) { - delete caStore.certs[cert.subject.hash]; - } - - return result; - }; - - function getBySubject(subject) { - ensureSubjectHasHash(subject); - return caStore.certs[subject.hash] || null; - } - - function ensureSubjectHasHash(subject) { - // produce subject hash if it doesn't exist - if(!subject.hash) { - var md = forge.md.sha1.create(); - subject.attributes = pki.RDNAttributesAsArray(_dnToAsn1(subject), md); - subject.hash = md.digest().toHex(); - } - } - - // auto-add passed in certs - if(certs) { - // parse PEM-formatted certificates as necessary - for(var i = 0; i < certs.length; ++i) { - var cert = certs[i]; - caStore.addCertificate(cert); - } - } - - return caStore; -}; - -/** - * Certificate verification errors, based on TLS. - */ -pki.certificateError = { - bad_certificate: 'forge.pki.BadCertificate', - unsupported_certificate: 'forge.pki.UnsupportedCertificate', - certificate_revoked: 'forge.pki.CertificateRevoked', - certificate_expired: 'forge.pki.CertificateExpired', - certificate_unknown: 'forge.pki.CertificateUnknown', - unknown_ca: 'forge.pki.UnknownCertificateAuthority' -}; - -/** - * Verifies a certificate chain against the given Certificate Authority store - * with an optional custom verify callback. - * - * @param caStore a certificate store to verify against. - * @param chain the certificate chain to verify, with the root or highest - * authority at the end (an array of certificates). - * @param options a callback to be called for every certificate in the chain or - * an object with: - * verify a callback to be called for every certificate in the - * chain - * validityCheckDate the date against which the certificate - * validity period should be checked. Pass null to not check - * the validity period. By default, the current date is used. - * - * The verify callback has the following signature: - * - * verified - Set to true if certificate was verified, otherwise the - * pki.certificateError for why the certificate failed. - * depth - The current index in the chain, where 0 is the end point's cert. - * certs - The certificate chain, *NOTE* an empty chain indicates an anonymous - * end point. - * - * The function returns true on success and on failure either the appropriate - * pki.certificateError or an object with 'error' set to the appropriate - * pki.certificateError and 'message' set to a custom error message. - * - * @return true if successful, error thrown if not. - */ -pki.verifyCertificateChain = function(caStore, chain, options) { - /* From: RFC3280 - Internet X.509 Public Key Infrastructure Certificate - Section 6: Certification Path Validation - See inline parentheticals related to this particular implementation. - - The primary goal of path validation is to verify the binding between - a subject distinguished name or a subject alternative name and subject - public key, as represented in the end entity certificate, based on the - public key of the trust anchor. This requires obtaining a sequence of - certificates that support that binding. That sequence should be provided - in the passed 'chain'. The trust anchor should be in the given CA - store. The 'end entity' certificate is the certificate provided by the - end point (typically a server) and is the first in the chain. - - To meet this goal, the path validation process verifies, among other - things, that a prospective certification path (a sequence of n - certificates or a 'chain') satisfies the following conditions: - - (a) for all x in {1, ..., n-1}, the subject of certificate x is - the issuer of certificate x+1; - - (b) certificate 1 is issued by the trust anchor; - - (c) certificate n is the certificate to be validated; and - - (d) for all x in {1, ..., n}, the certificate was valid at the - time in question. - - Note that here 'n' is index 0 in the chain and 1 is the last certificate - in the chain and it must be signed by a certificate in the connection's - CA store. - - The path validation process also determines the set of certificate - policies that are valid for this path, based on the certificate policies - extension, policy mapping extension, policy constraints extension, and - inhibit any-policy extension. - - Note: Policy mapping extension not supported (Not Required). - - Note: If the certificate has an unsupported critical extension, then it - must be rejected. - - Note: A certificate is self-issued if the DNs that appear in the subject - and issuer fields are identical and are not empty. - - The path validation algorithm assumes the following seven inputs are - provided to the path processing logic. What this specific implementation - will use is provided parenthetically: - - (a) a prospective certification path of length n (the 'chain') - (b) the current date/time: ('now'). - (c) user-initial-policy-set: A set of certificate policy identifiers - naming the policies that are acceptable to the certificate user. - The user-initial-policy-set contains the special value any-policy - if the user is not concerned about certificate policy - (Not implemented. Any policy is accepted). - (d) trust anchor information, describing a CA that serves as a trust - anchor for the certification path. The trust anchor information - includes: - - (1) the trusted issuer name, - (2) the trusted public key algorithm, - (3) the trusted public key, and - (4) optionally, the trusted public key parameters associated - with the public key. - - (Trust anchors are provided via certificates in the CA store). - - The trust anchor information may be provided to the path processing - procedure in the form of a self-signed certificate. The trusted anchor - information is trusted because it was delivered to the path processing - procedure by some trustworthy out-of-band procedure. If the trusted - public key algorithm requires parameters, then the parameters are - provided along with the trusted public key (No parameters used in this - implementation). - - (e) initial-policy-mapping-inhibit, which indicates if policy mapping is - allowed in the certification path. - (Not implemented, no policy checking) - - (f) initial-explicit-policy, which indicates if the path must be valid - for at least one of the certificate policies in the user-initial- - policy-set. - (Not implemented, no policy checking) - - (g) initial-any-policy-inhibit, which indicates whether the - anyPolicy OID should be processed if it is included in a - certificate. - (Not implemented, so any policy is valid provided that it is - not marked as critical) */ - - /* Basic Path Processing: - - For each certificate in the 'chain', the following is checked: - - 1. The certificate validity period includes the current time. - 2. The certificate was signed by its parent (where the parent is either - the next in the chain or from the CA store). Allow processing to - continue to the next step if no parent is found but the certificate is - in the CA store. - 3. TODO: The certificate has not been revoked. - 4. The certificate issuer name matches the parent's subject name. - 5. TODO: If the certificate is self-issued and not the final certificate - in the chain, skip this step, otherwise verify that the subject name - is within one of the permitted subtrees of X.500 distinguished names - and that each of the alternative names in the subjectAltName extension - (critical or non-critical) is within one of the permitted subtrees for - that name type. - 6. TODO: If the certificate is self-issued and not the final certificate - in the chain, skip this step, otherwise verify that the subject name - is not within one of the excluded subtrees for X.500 distinguished - names and none of the subjectAltName extension names are excluded for - that name type. - 7. The other steps in the algorithm for basic path processing involve - handling the policy extension which is not presently supported in this - implementation. Instead, if a critical policy extension is found, the - certificate is rejected as not supported. - 8. If the certificate is not the first or if its the only certificate in - the chain (having no parent from the CA store or is self-signed) and it - has a critical key usage extension, verify that the keyCertSign bit is - set. If the key usage extension exists, verify that the basic - constraints extension exists. If the basic constraints extension exists, - verify that the cA flag is set. If pathLenConstraint is set, ensure that - the number of certificates that precede in the chain (come earlier - in the chain as implemented below), excluding the very first in the - chain (typically the end-entity one), isn't greater than the - pathLenConstraint. This constraint limits the number of intermediate - CAs that may appear below a CA before only end-entity certificates - may be issued. */ - - // if a verify callback is passed as the third parameter, package it within - // the options object. This is to support a legacy function signature that - // expected the verify callback as the third parameter. - if(typeof options === 'function') { - options = {verify: options}; - } - options = options || {}; - - // copy cert chain references to another array to protect against changes - // in verify callback - chain = chain.slice(0); - var certs = chain.slice(0); - - var validityCheckDate = options.validityCheckDate; - // if no validityCheckDate is specified, default to the current date. Make - // sure to maintain the value null because it indicates that the validity - // period should not be checked. - if(typeof validityCheckDate === 'undefined') { - validityCheckDate = new Date(); - } - - // verify each cert in the chain using its parent, where the parent - // is either the next in the chain or from the CA store - var first = true; - var error = null; - var depth = 0; - do { - var cert = chain.shift(); - var parent = null; - var selfSigned = false; - - if(validityCheckDate) { - // 1. check valid time - if(validityCheckDate < cert.validity.notBefore || - validityCheckDate > cert.validity.notAfter) { - error = { - message: 'Certificate is not valid yet or has expired.', - error: pki.certificateError.certificate_expired, - notBefore: cert.validity.notBefore, - notAfter: cert.validity.notAfter, - // TODO: we might want to reconsider renaming 'now' to - // 'validityCheckDate' should this API be changed in the future. - now: validityCheckDate - }; - } - } - - // 2. verify with parent from chain or CA store - if(error === null) { - parent = chain[0] || caStore.getIssuer(cert); - if(parent === null) { - // check for self-signed cert - if(cert.isIssuer(cert)) { - selfSigned = true; - parent = cert; - } - } - - if(parent) { - // FIXME: current CA store implementation might have multiple - // certificates where the issuer can't be determined from the - // certificate (happens rarely with, eg: old certificates) so normalize - // by always putting parents into an array - // TODO: there's may be an extreme degenerate case currently uncovered - // where an old intermediate certificate seems to have a matching parent - // but none of the parents actually verify ... but the intermediate - // is in the CA and it should pass this check; needs investigation - var parents = parent; - if(!forge.util.isArray(parents)) { - parents = [parents]; - } - - // try to verify with each possible parent (typically only one) - var verified = false; - while(!verified && parents.length > 0) { - parent = parents.shift(); - try { - verified = parent.verify(cert); - } catch(ex) { - // failure to verify, don't care why, try next one - } - } - - if(!verified) { - error = { - message: 'Certificate signature is invalid.', - error: pki.certificateError.bad_certificate - }; - } - } - - if(error === null && (!parent || selfSigned) && - !caStore.hasCertificate(cert)) { - // no parent issuer and certificate itself is not trusted - error = { - message: 'Certificate is not trusted.', - error: pki.certificateError.unknown_ca - }; - } - } - - // TODO: 3. check revoked - - // 4. check for matching issuer/subject - if(error === null && parent && !cert.isIssuer(parent)) { - // parent is not issuer - error = { - message: 'Certificate issuer is invalid.', - error: pki.certificateError.bad_certificate - }; - } - - // 5. TODO: check names with permitted names tree - - // 6. TODO: check names against excluded names tree - - // 7. check for unsupported critical extensions - if(error === null) { - // supported extensions - var se = { - keyUsage: true, - basicConstraints: true - }; - for(var i = 0; error === null && i < cert.extensions.length; ++i) { - var ext = cert.extensions[i]; - if(ext.critical && !(ext.name in se)) { - error = { - message: - 'Certificate has an unsupported critical extension.', - error: pki.certificateError.unsupported_certificate - }; - } - } - } - - // 8. check for CA if cert is not first or is the only certificate - // remaining in chain with no parent or is self-signed - if(error === null && - (!first || (chain.length === 0 && (!parent || selfSigned)))) { - // first check keyUsage extension and then basic constraints - var bcExt = cert.getExtension('basicConstraints'); - var keyUsageExt = cert.getExtension('keyUsage'); - if(keyUsageExt !== null) { - // keyCertSign must be true and there must be a basic - // constraints extension - if(!keyUsageExt.keyCertSign || bcExt === null) { - // bad certificate - error = { - message: - 'Certificate keyUsage or basicConstraints conflict ' + - 'or indicate that the certificate is not a CA. ' + - 'If the certificate is the only one in the chain or ' + - 'isn\'t the first then the certificate must be a ' + - 'valid CA.', - error: pki.certificateError.bad_certificate - }; - } - } - // basic constraints cA flag must be set - if(error === null && bcExt !== null && !bcExt.cA) { - // bad certificate - error = { - message: - 'Certificate basicConstraints indicates the certificate ' + - 'is not a CA.', - error: pki.certificateError.bad_certificate - }; - } - // if error is not null and keyUsage is available, then we know it - // has keyCertSign and there is a basic constraints extension too, - // which means we can check pathLenConstraint (if it exists) - if(error === null && keyUsageExt !== null && - 'pathLenConstraint' in bcExt) { - // pathLen is the maximum # of intermediate CA certs that can be - // found between the current certificate and the end-entity (depth 0) - // certificate; this number does not include the end-entity (depth 0, - // last in the chain) even if it happens to be a CA certificate itself - var pathLen = depth - 1; - if(pathLen > bcExt.pathLenConstraint) { - // pathLenConstraint violated, bad certificate - error = { - message: - 'Certificate basicConstraints pathLenConstraint violated.', - error: pki.certificateError.bad_certificate - }; - } - } - } - - // call application callback - var vfd = (error === null) ? true : error.error; - var ret = options.verify ? options.verify(vfd, depth, certs) : vfd; - if(ret === true) { - // clear any set error - error = null; - } else { - // if passed basic tests, set default message and alert - if(vfd === true) { - error = { - message: 'The application rejected the certificate.', - error: pki.certificateError.bad_certificate - }; - } - - // check for custom error info - if(ret || ret === 0) { - // set custom message and error - if(typeof ret === 'object' && !forge.util.isArray(ret)) { - if(ret.message) { - error.message = ret.message; - } - if(ret.error) { - error.error = ret.error; - } - } else if(typeof ret === 'string') { - // set custom error - error.error = ret; - } - } - - // throw error - throw error; - } - - // no longer first cert in chain - first = false; - ++depth; - } while(chain.length > 0); - - return true; -}; diff --git a/reverse_engineering/node_modules/node-forge/lib/xhr.js b/reverse_engineering/node_modules/node-forge/lib/xhr.js deleted file mode 100644 index e493c3b6..00000000 --- a/reverse_engineering/node_modules/node-forge/lib/xhr.js +++ /dev/null @@ -1,736 +0,0 @@ -/** - * XmlHttpRequest implementation that uses TLS and flash SocketPool. - * - * @author Dave Longley - * - * Copyright (c) 2010-2013 Digital Bazaar, Inc. - */ -var forge = require('./forge'); -require('./socket'); -require('./http'); - -/* XHR API */ -var xhrApi = module.exports = forge.xhr = forge.xhr || {}; - -(function($) { - -// logging category -var cat = 'forge.xhr'; - -/* -XMLHttpRequest interface definition from: -http://www.w3.org/TR/XMLHttpRequest - -interface XMLHttpRequest { - // event handler - attribute EventListener onreadystatechange; - - // state - const unsigned short UNSENT = 0; - const unsigned short OPENED = 1; - const unsigned short HEADERS_RECEIVED = 2; - const unsigned short LOADING = 3; - const unsigned short DONE = 4; - readonly attribute unsigned short readyState; - - // request - void open(in DOMString method, in DOMString url); - void open(in DOMString method, in DOMString url, in boolean async); - void open(in DOMString method, in DOMString url, - in boolean async, in DOMString user); - void open(in DOMString method, in DOMString url, - in boolean async, in DOMString user, in DOMString password); - void setRequestHeader(in DOMString header, in DOMString value); - void send(); - void send(in DOMString data); - void send(in Document data); - void abort(); - - // response - DOMString getAllResponseHeaders(); - DOMString getResponseHeader(in DOMString header); - readonly attribute DOMString responseText; - readonly attribute Document responseXML; - readonly attribute unsigned short status; - readonly attribute DOMString statusText; -}; -*/ - -// readyStates -var UNSENT = 0; -var OPENED = 1; -var HEADERS_RECEIVED = 2; -var LOADING = 3; -var DONE = 4; - -// exceptions -var INVALID_STATE_ERR = 11; -var SYNTAX_ERR = 12; -var SECURITY_ERR = 18; -var NETWORK_ERR = 19; -var ABORT_ERR = 20; - -// private flash socket pool vars -var _sp = null; -var _policyPort = 0; -var _policyUrl = null; - -// default client (used if no special URL provided when creating an XHR) -var _client = null; - -// all clients including the default, key'd by full base url -// (multiple cross-domain http clients are permitted so there may be more -// than one client in this map) -// TODO: provide optional clean up API for non-default clients -var _clients = {}; - -// the default maximum number of concurrents connections per client -var _maxConnections = 10; - -var net = forge.net; -var http = forge.http; - -/** - * Initializes flash XHR support. - * - * @param options: - * url: the default base URL to connect to if xhr URLs are relative, - * ie: https://myserver.com. - * flashId: the dom ID of the flash SocketPool. - * policyPort: the port that provides the server's flash policy, 0 to use - * the flash default. - * policyUrl: the policy file URL to use instead of a policy port. - * msie: true if browser is internet explorer, false if not. - * connections: the maximum number of concurrent connections. - * caCerts: a list of PEM-formatted certificates to trust. - * cipherSuites: an optional array of cipher suites to use, - * see forge.tls.CipherSuites. - * verify: optional TLS certificate verify callback to use (see forge.tls - * for details). - * getCertificate: an optional callback used to get a client-side - * certificate (see forge.tls for details). - * getPrivateKey: an optional callback used to get a client-side private - * key (see forge.tls for details). - * getSignature: an optional callback used to get a client-side signature - * (see forge.tls for details). - * persistCookies: true to use persistent cookies via flash local storage, - * false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on their - * creation so that they will cache TLS sessions for reuse. - */ -xhrApi.init = function(options) { - forge.log.debug(cat, 'initializing', options); - - // update default policy port and max connections - _policyPort = options.policyPort || _policyPort; - _policyUrl = options.policyUrl || _policyUrl; - _maxConnections = options.connections || _maxConnections; - - // create the flash socket pool - _sp = net.createSocketPool({ - flashId: options.flashId, - policyPort: _policyPort, - policyUrl: _policyUrl, - msie: options.msie || false - }); - - // create default http client - _client = http.createClient({ - url: options.url || ( - window.location.protocol + '//' + window.location.host), - socketPool: _sp, - policyPort: _policyPort, - policyUrl: _policyUrl, - connections: options.connections || _maxConnections, - caCerts: options.caCerts, - cipherSuites: options.cipherSuites, - persistCookies: options.persistCookies || true, - primeTlsSockets: options.primeTlsSockets || false, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature - }); - _clients[_client.url.full] = _client; - - forge.log.debug(cat, 'ready'); -}; - -/** - * Called to clean up the clients and socket pool. - */ -xhrApi.cleanup = function() { - // destroy all clients - for(var key in _clients) { - _clients[key].destroy(); - } - _clients = {}; - _client = null; - - // destroy socket pool - _sp.destroy(); - _sp = null; -}; - -/** - * Sets a cookie. - * - * @param cookie the cookie with parameters: - * name: the name of the cookie. - * value: the value of the cookie. - * comment: an optional comment string. - * maxAge: the age of the cookie in seconds relative to created time. - * secure: true if the cookie must be sent over a secure protocol. - * httpOnly: true to restrict access to the cookie from javascript - * (inaffective since the cookies are stored in javascript). - * path: the path for the cookie. - * domain: optional domain the cookie belongs to (must start with dot). - * version: optional version of the cookie. - * created: creation time, in UTC seconds, of the cookie. - */ -xhrApi.setCookie = function(cookie) { - // default cookie expiration to never - cookie.maxAge = cookie.maxAge || -1; - - // if the cookie's domain is set, use the appropriate client - if(cookie.domain) { - // add the cookies to the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, cookie) && - client.secure === cookie.secure) { - client.setCookie(cookie); - } - } - } else { - // use the default domain - // FIXME: should a null domain cookie be added to all clients? should - // this be an option? - _client.setCookie(cookie); - } -}; - -/** - * Gets a cookie. - * - * @param name the name of the cookie. - * @param path an optional path for the cookie (if there are multiple cookies - * with the same name but different paths). - * @param domain an optional domain for the cookie (if not using the default - * domain). - * - * @return the cookie, cookies (if multiple matches), or null if not found. - */ -xhrApi.getCookie = function(name, path, domain) { - var rval = null; - - if(domain) { - // get the cookies from the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, domain)) { - var cookie = client.getCookie(name, path); - if(cookie !== null) { - if(rval === null) { - rval = cookie; - } else if(!forge.util.isArray(rval)) { - rval = [rval, cookie]; - } else { - rval.push(cookie); - } - } - } - } - } else { - // get cookie from default domain - rval = _client.getCookie(name, path); - } - - return rval; -}; - -/** - * Removes a cookie. - * - * @param name the name of the cookie. - * @param path an optional path for the cookie (if there are multiple cookies - * with the same name but different paths). - * @param domain an optional domain for the cookie (if not using the default - * domain). - * - * @return true if a cookie was removed, false if not. - */ -xhrApi.removeCookie = function(name, path, domain) { - var rval = false; - - if(domain) { - // remove the cookies from the applicable domains - for(var key in _clients) { - var client = _clients[key]; - if(http.withinCookieDomain(client.url, domain)) { - if(client.removeCookie(name, path)) { - rval = true; - } - } - } - } else { - // remove cookie from default domain - rval = _client.removeCookie(name, path); - } - - return rval; -}; - -/** - * Creates a new XmlHttpRequest. By default the base URL, flash policy port, - * etc, will be used. However, an XHR can be created to point at another - * cross-domain URL. - * - * @param options: - * logWarningOnError: If true and an HTTP error status code is received then - * log a warning, otherwise log a verbose message. - * verbose: If true be very verbose in the output including the response - * event and response body, otherwise only include status, timing, and - * data size. - * logError: a multi-var log function for warnings that takes the log - * category as the first var. - * logWarning: a multi-var log function for warnings that takes the log - * category as the first var. - * logDebug: a multi-var log function for warnings that takes the log - * category as the first var. - * logVerbose: a multi-var log function for warnings that takes the log - * category as the first var. - * url: the default base URL to connect to if xhr URLs are relative, - * eg: https://myserver.com, and note that the following options will be - * ignored if the URL is absent or the same as the default base URL. - * policyPort: the port that provides the server's flash policy, 0 to use - * the flash default. - * policyUrl: the policy file URL to use instead of a policy port. - * connections: the maximum number of concurrent connections. - * caCerts: a list of PEM-formatted certificates to trust. - * cipherSuites: an optional array of cipher suites to use, see - * forge.tls.CipherSuites. - * verify: optional TLS certificate verify callback to use (see forge.tls - * for details). - * getCertificate: an optional callback used to get a client-side - * certificate. - * getPrivateKey: an optional callback used to get a client-side private key. - * getSignature: an optional callback used to get a client-side signature. - * persistCookies: true to use persistent cookies via flash local storage, - * false to only keep cookies in javascript. - * primeTlsSockets: true to immediately connect TLS sockets on their - * creation so that they will cache TLS sessions for reuse. - * - * @return the XmlHttpRequest. - */ -xhrApi.create = function(options) { - // set option defaults - options = $.extend({ - logWarningOnError: true, - verbose: false, - logError: function() {}, - logWarning: function() {}, - logDebug: function() {}, - logVerbose: function() {}, - url: null - }, options || {}); - - // private xhr state - var _state = { - // the http client to use - client: null, - // request storage - request: null, - // response storage - response: null, - // asynchronous, true if doing asynchronous communication - asynchronous: true, - // sendFlag, true if send has been called - sendFlag: false, - // errorFlag, true if a network error occurred - errorFlag: false - }; - - // private log functions - var _log = { - error: options.logError || forge.log.error, - warning: options.logWarning || forge.log.warning, - debug: options.logDebug || forge.log.debug, - verbose: options.logVerbose || forge.log.verbose - }; - - // create public xhr interface - var xhr = { - // an EventListener - onreadystatechange: null, - // readonly, the current readyState - readyState: UNSENT, - // a string with the response entity-body - responseText: '', - // a Document for response entity-bodies that are XML - responseXML: null, - // readonly, returns the HTTP status code (i.e. 404) - status: 0, - // readonly, returns the HTTP status message (i.e. 'Not Found') - statusText: '' - }; - - // determine which http client to use - if(options.url === null) { - // use default - _state.client = _client; - } else { - var url = http.parseUrl(options.url); - if(!url) { - var error = new Error('Invalid url.'); - error.details = { - url: options.url - }; - } - - // find client - if(url.full in _clients) { - // client found - _state.client = _clients[url.full]; - } else { - // create client - _state.client = http.createClient({ - url: options.url, - socketPool: _sp, - policyPort: options.policyPort || _policyPort, - policyUrl: options.policyUrl || _policyUrl, - connections: options.connections || _maxConnections, - caCerts: options.caCerts, - cipherSuites: options.cipherSuites, - persistCookies: options.persistCookies || true, - primeTlsSockets: options.primeTlsSockets || false, - verify: options.verify, - getCertificate: options.getCertificate, - getPrivateKey: options.getPrivateKey, - getSignature: options.getSignature - }); - _clients[url.full] = _state.client; - } - } - - /** - * Opens the request. This method will create the HTTP request to send. - * - * @param method the HTTP method (i.e. 'GET'). - * @param url the relative url (the HTTP request path). - * @param async always true, ignored. - * @param user always null, ignored. - * @param password always null, ignored. - */ - xhr.open = function(method, url, async, user, password) { - // 1. validate Document if one is associated - // TODO: not implemented (not used yet) - - // 2. validate method token - // 3. change method to uppercase if it matches a known - // method (here we just require it to be uppercase, and - // we do not allow the standard methods) - // 4. disallow CONNECT, TRACE, or TRACK with a security error - switch(method) { - case 'DELETE': - case 'GET': - case 'HEAD': - case 'OPTIONS': - case 'PATCH': - case 'POST': - case 'PUT': - // valid method - break; - case 'CONNECT': - case 'TRACE': - case 'TRACK': - throw new Error('CONNECT, TRACE and TRACK methods are disallowed'); - default: - throw new Error('Invalid method: ' + method); - } - - // TODO: other validation steps in algorithm are not implemented - - // 19. set send flag to false - // set response body to null - // empty list of request headers - // set request method to given method - // set request URL - // set username, password - // set asychronous flag - _state.sendFlag = false; - xhr.responseText = ''; - xhr.responseXML = null; - - // custom: reset status and statusText - xhr.status = 0; - xhr.statusText = ''; - - // create the HTTP request - _state.request = http.createRequest({ - method: method, - path: url - }); - - // 20. set state to OPENED - xhr.readyState = OPENED; - - // 21. dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - - /** - * Adds an HTTP header field to the request. - * - * @param header the name of the header field. - * @param value the value of the header field. - */ - xhr.setRequestHeader = function(header, value) { - // 1. if state is not OPENED or send flag is true, raise exception - if(xhr.readyState != OPENED || _state.sendFlag) { - throw new Error('XHR not open or sending'); - } - - // TODO: other validation steps in spec aren't implemented - - // set header - _state.request.setField(header, value); - }; - - /** - * Sends the request and any associated data. - * - * @param data a string or Document object to send, null to send no data. - */ - xhr.send = function(data) { - // 1. if state is not OPENED or 2. send flag is true, raise - // an invalid state exception - if(xhr.readyState != OPENED || _state.sendFlag) { - throw new Error('XHR not open or sending'); - } - - // 3. ignore data if method is GET or HEAD - if(data && - _state.request.method !== 'GET' && - _state.request.method !== 'HEAD') { - // handle non-IE case - if(typeof(XMLSerializer) !== 'undefined') { - if(data instanceof Document) { - var xs = new XMLSerializer(); - _state.request.body = xs.serializeToString(data); - } else { - _state.request.body = data; - } - } else { - // poorly implemented IE case - if(typeof(data.xml) !== 'undefined') { - _state.request.body = data.xml; - } else { - _state.request.body = data; - } - } - } - - // 4. release storage mutex (not used) - - // 5. set error flag to false - _state.errorFlag = false; - - // 6. if asynchronous is true (must be in this implementation) - - // 6.1 set send flag to true - _state.sendFlag = true; - - // 6.2 dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - - // create send options - var options = {}; - options.request = _state.request; - options.headerReady = function(e) { - // make cookies available for ease of use/iteration - xhr.cookies = _state.client.cookies; - - // TODO: update document.cookie with any cookies where the - // script's domain matches - - // headers received - xhr.readyState = HEADERS_RECEIVED; - xhr.status = e.response.code; - xhr.statusText = e.response.message; - _state.response = e.response; - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - if(!_state.response.aborted) { - // now loading body - xhr.readyState = LOADING; - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - } - }; - options.bodyReady = function(e) { - xhr.readyState = DONE; - var ct = e.response.getField('Content-Type'); - // Note: this null/undefined check is done outside because IE - // dies otherwise on a "'null' is null" error - if(ct) { - if(ct.indexOf('text/xml') === 0 || - ct.indexOf('application/xml') === 0 || - ct.indexOf('+xml') !== -1) { - try { - var doc = new ActiveXObject('MicrosoftXMLDOM'); - doc.async = false; - doc.loadXML(e.response.body); - xhr.responseXML = doc; - } catch(ex) { - var parser = new DOMParser(); - xhr.responseXML = parser.parseFromString(ex.body, 'text/xml'); - } - } - } - - var length = 0; - if(e.response.body !== null) { - xhr.responseText = e.response.body; - length = e.response.body.length; - } - // build logging output - var req = _state.request; - var output = - req.method + ' ' + req.path + ' ' + - xhr.status + ' ' + xhr.statusText + ' ' + - length + 'B ' + - (e.request.connectTime + e.request.time + e.response.time) + - 'ms'; - var lFunc; - if(options.verbose) { - lFunc = (xhr.status >= 400 && options.logWarningOnError) ? - _log.warning : _log.verbose; - lFunc(cat, output, - e, e.response.body ? '\n' + e.response.body : '\nNo content'); - } else { - lFunc = (xhr.status >= 400 && options.logWarningOnError) ? - _log.warning : _log.debug; - lFunc(cat, output); - } - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - options.error = function(e) { - var req = _state.request; - _log.error(cat, req.method + ' ' + req.path, e); - - // 1. set response body to null - xhr.responseText = ''; - xhr.responseXML = null; - - // 2. set error flag to true (and reset status) - _state.errorFlag = true; - xhr.status = 0; - xhr.statusText = ''; - - // 3. set state to done - xhr.readyState = DONE; - - // 4. asyc flag is always true, so dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - }; - - // 7. send request - _state.client.send(options); - }; - - /** - * Aborts the request. - */ - xhr.abort = function() { - // 1. abort send - // 2. stop network activity - _state.request.abort(); - - // 3. set response to null - xhr.responseText = ''; - xhr.responseXML = null; - - // 4. set error flag to true (and reset status) - _state.errorFlag = true; - xhr.status = 0; - xhr.statusText = ''; - - // 5. clear user headers - _state.request = null; - _state.response = null; - - // 6. if state is DONE or UNSENT, or if OPENED and send flag is false - if(xhr.readyState === DONE || xhr.readyState === UNSENT || - (xhr.readyState === OPENED && !_state.sendFlag)) { - // 7. set ready state to unsent - xhr.readyState = UNSENT; - } else { - // 6.1 set state to DONE - xhr.readyState = DONE; - - // 6.2 set send flag to false - _state.sendFlag = false; - - // 6.3 dispatch onreadystatechange - if(xhr.onreadystatechange) { - xhr.onreadystatechange(); - } - - // 7. set state to UNSENT - xhr.readyState = UNSENT; - } - }; - - /** - * Gets all response headers as a string. - * - * @return the HTTP-encoded response header fields. - */ - xhr.getAllResponseHeaders = function() { - var rval = ''; - if(_state.response !== null) { - var fields = _state.response.fields; - $.each(fields, function(name, array) { - $.each(array, function(i, value) { - rval += name + ': ' + value + '\r\n'; - }); - }); - } - return rval; - }; - - /** - * Gets a single header field value or, if there are multiple - * fields with the same name, a comma-separated list of header - * values. - * - * @return the header field value(s) or null. - */ - xhr.getResponseHeader = function(header) { - var rval = null; - if(_state.response !== null) { - if(header in _state.response.fields) { - rval = _state.response.fields[header]; - if(forge.util.isArray(rval)) { - rval = rval.join(); - } - } - } - return rval; - }; - - return xhr; -}; - -})(jQuery); diff --git a/reverse_engineering/node_modules/node-forge/package.json b/reverse_engineering/node_modules/node-forge/package.json deleted file mode 100644 index 8e2c418f..00000000 --- a/reverse_engineering/node_modules/node-forge/package.json +++ /dev/null @@ -1,158 +0,0 @@ -{ - "_from": "node-forge@^0.10.0", - "_id": "node-forge@0.10.0", - "_inBundle": false, - "_integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "_location": "/node-forge", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-forge@^0.10.0", - "name": "node-forge", - "escapedName": "node-forge", - "rawSpec": "^0.10.0", - "saveSpec": null, - "fetchSpec": "^0.10.0" - }, - "_requiredBy": [ - "/jks-js" - ], - "_resolved": "https://registry.npmjs.org/node-forge/-/node-forge-0.10.0.tgz", - "_shasum": "32dea2afb3e9926f02ee5ce8794902691a676bf3", - "_spec": "node-forge@^0.10.0", - "_where": "/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/jks-js", - "author": { - "name": "Digital Bazaar, Inc.", - "email": "support@digitalbazaar.com", - "url": "http://digitalbazaar.com/" - }, - "browser": { - "buffer": false, - "crypto": false, - "process": false - }, - "bugs": { - "url": "https://github.com/digitalbazaar/forge/issues", - "email": "support@digitalbazaar.com" - }, - "bundleDependencies": false, - "contributors": [ - { - "name": "Dave Longley", - "email": "dlongley@digitalbazaar.com" - }, - { - "name": "David I. Lehn", - "email": "dlehn@digitalbazaar.com" - }, - { - "name": "Stefan Siegl", - "email": "stesie@brokenpipe.de" - }, - { - "name": "Christoph Dorn", - "email": "christoph@christophdorn.com" - } - ], - "deprecated": false, - "description": "JavaScript implementations of network transports, cryptography, ciphers, PKI, message digests, and various utilities.", - "devDependencies": { - "browserify": "^16.5.2", - "commander": "^2.20.0", - "cross-env": "^5.2.1", - "eslint": "^7.8.1", - "eslint-config-digitalbazaar": "^2.5.0", - "express": "^4.16.2", - "karma": "^4.4.1", - "karma-browserify": "^7.0.0", - "karma-chrome-launcher": "^3.1.0", - "karma-edge-launcher": "^0.4.2", - "karma-firefox-launcher": "^1.3.0", - "karma-ie-launcher": "^1.0.0", - "karma-mocha": "^1.3.0", - "karma-mocha-reporter": "^2.2.5", - "karma-safari-launcher": "^1.0.0", - "karma-sauce-launcher": "^2.0.2", - "karma-sourcemap-loader": "^0.3.8", - "karma-tap-reporter": "0.0.6", - "karma-webpack": "^4.0.2", - "mocha": "^5.2.0", - "mocha-lcov-reporter": "^1.2.0", - "nodejs-websocket": "^1.7.1", - "nyc": "^15.1.0", - "opts": "^1.2.7", - "webpack": "^4.44.1", - "webpack-cli": "^3.3.12", - "worker-loader": "^2.0.0" - }, - "engines": { - "node": ">= 6.0.0" - }, - "files": [ - "lib/*.js", - "flash/swf/*.swf", - "dist/*.min.js", - "dist/*.min.js.map" - ], - "homepage": "https://github.com/digitalbazaar/forge", - "jspm": { - "format": "amd" - }, - "keywords": [ - "aes", - "asn", - "asn.1", - "cbc", - "crypto", - "cryptography", - "csr", - "des", - "gcm", - "hmac", - "http", - "https", - "md5", - "network", - "pkcs", - "pki", - "prng", - "rc2", - "rsa", - "sha1", - "sha256", - "sha384", - "sha512", - "ssh", - "tls", - "x.509", - "x509" - ], - "license": "(BSD-3-Clause OR GPL-2.0)", - "main": "lib/index.js", - "name": "node-forge", - "nyc": { - "exclude": [ - "tests" - ] - }, - "repository": { - "type": "git", - "url": "git+https://github.com/digitalbazaar/forge.git" - }, - "scripts": { - "build": "webpack", - "coverage": "rm -rf coverage && nyc --reporter=lcov --reporter=text-summary npm test", - "coverage-report": "nyc report", - "lint": "eslint *.js lib/*.js tests/*.js tests/**/*.js examples/*.js flash/*.js", - "prepublish": "npm run build", - "test": "cross-env NODE_ENV=test mocha -t 30000 -R ${REPORTER:-spec} tests/unit/index.js", - "test-build": "webpack --config webpack-tests.config.js", - "test-karma": "karma start", - "test-karma-sauce": "karma start karma-sauce.conf", - "test-server": "node tests/server.js", - "test-server-webid": "node tests/websockets/server-webid.js", - "test-server-ws": "node tests/websockets/server-ws.js" - }, - "version": "0.10.0" -} diff --git a/reverse_engineering/node_modules/node-int64/.npmignore b/reverse_engineering/node_modules/node-int64/.npmignore deleted file mode 100644 index 825fc67c..00000000 --- a/reverse_engineering/node_modules/node-int64/.npmignore +++ /dev/null @@ -1,3 +0,0 @@ -node_modules -.DS_Store -npm-debug.log diff --git a/reverse_engineering/node_modules/node-int64/Int64.js b/reverse_engineering/node_modules/node-int64/Int64.js deleted file mode 100644 index f870a2a9..00000000 --- a/reverse_engineering/node_modules/node-int64/Int64.js +++ /dev/null @@ -1,268 +0,0 @@ -// Int64.js -// -// Copyright (c) 2012 Robert Kieffer -// MIT License - http://opensource.org/licenses/mit-license.php - -/** - * Support for handling 64-bit int numbers in Javascript (node.js) - * - * JS Numbers are IEEE-754 binary double-precision floats, which limits the - * range of values that can be represented with integer precision to: - * - * 2^^53 <= N <= 2^53 - * - * Int64 objects wrap a node Buffer that holds the 8-bytes of int64 data. These - * objects operate directly on the buffer which means that if they are created - * using an existing buffer then setting the value will modify the Buffer, and - * vice-versa. - * - * Internal Representation - * - * The internal buffer format is Big Endian. I.e. the most-significant byte is - * at buffer[0], the least-significant at buffer[7]. For the purposes of - * converting to/from JS native numbers, the value is assumed to be a signed - * integer stored in 2's complement form. - * - * For details about IEEE-754 see: - * http://en.wikipedia.org/wiki/Double_precision_floating-point_format - */ - -// Useful masks and values for bit twiddling -var MASK31 = 0x7fffffff, VAL31 = 0x80000000; -var MASK32 = 0xffffffff, VAL32 = 0x100000000; - -// Map for converting hex octets to strings -var _HEX = []; -for (var i = 0; i < 256; i++) { - _HEX[i] = (i > 0xF ? '' : '0') + i.toString(16); -} - -// -// Int64 -// - -/** - * Constructor accepts any of the following argument types: - * - * new Int64(buffer[, offset=0]) - Existing Buffer with byte offset - * new Int64(Uint8Array[, offset=0]) - Existing Uint8Array with a byte offset - * new Int64(string) - Hex string (throws if n is outside int64 range) - * new Int64(number) - Number (throws if n is outside int64 range) - * new Int64(hi, lo) - Raw bits as two 32-bit values - */ -var Int64 = module.exports = function(a1, a2) { - if (a1 instanceof Buffer) { - this.buffer = a1; - this.offset = a2 || 0; - } else if (Object.prototype.toString.call(a1) == '[object Uint8Array]') { - // Under Browserify, Buffers can extend Uint8Arrays rather than an - // instance of Buffer. We could assume the passed in Uint8Array is actually - // a buffer but that won't handle the case where a raw Uint8Array is passed - // in. We construct a new Buffer just in case. - this.buffer = new Buffer(a1); - this.offset = a2 || 0; - } else { - this.buffer = this.buffer || new Buffer(8); - this.offset = 0; - this.setValue.apply(this, arguments); - } -}; - - -// Max integer value that JS can accurately represent -Int64.MAX_INT = Math.pow(2, 53); - -// Min integer value that JS can accurately represent -Int64.MIN_INT = -Math.pow(2, 53); - -Int64.prototype = { - - constructor: Int64, - - /** - * Do in-place 2's compliment. See - * http://en.wikipedia.org/wiki/Two's_complement - */ - _2scomp: function() { - var b = this.buffer, o = this.offset, carry = 1; - for (var i = o + 7; i >= o; i--) { - var v = (b[i] ^ 0xff) + carry; - b[i] = v & 0xff; - carry = v >> 8; - } - }, - - /** - * Set the value. Takes any of the following arguments: - * - * setValue(string) - A hexidecimal string - * setValue(number) - Number (throws if n is outside int64 range) - * setValue(hi, lo) - Raw bits as two 32-bit values - */ - setValue: function(hi, lo) { - var negate = false; - if (arguments.length == 1) { - if (typeof(hi) == 'number') { - // Simplify bitfield retrieval by using abs() value. We restore sign - // later - negate = hi < 0; - hi = Math.abs(hi); - lo = hi % VAL32; - hi = hi / VAL32; - if (hi > VAL32) throw new RangeError(hi + ' is outside Int64 range'); - hi = hi | 0; - } else if (typeof(hi) == 'string') { - hi = (hi + '').replace(/^0x/, ''); - lo = hi.substr(-8); - hi = hi.length > 8 ? hi.substr(0, hi.length - 8) : ''; - hi = parseInt(hi, 16); - lo = parseInt(lo, 16); - } else { - throw new Error(hi + ' must be a Number or String'); - } - } - - // Technically we should throw if hi or lo is outside int32 range here, but - // it's not worth the effort. Anything past the 32'nd bit is ignored. - - // Copy bytes to buffer - var b = this.buffer, o = this.offset; - for (var i = 7; i >= 0; i--) { - b[o+i] = lo & 0xff; - lo = i == 4 ? hi : lo >>> 8; - } - - // Restore sign of passed argument - if (negate) this._2scomp(); - }, - - /** - * Convert to a native JS number. - * - * WARNING: Do not expect this value to be accurate to integer precision for - * large (positive or negative) numbers! - * - * @param allowImprecise If true, no check is performed to verify the - * returned value is accurate to integer precision. If false, imprecise - * numbers (very large positive or negative numbers) will be forced to +/- - * Infinity. - */ - toNumber: function(allowImprecise) { - var b = this.buffer, o = this.offset; - - // Running sum of octets, doing a 2's complement - var negate = b[o] & 0x80, x = 0, carry = 1; - for (var i = 7, m = 1; i >= 0; i--, m *= 256) { - var v = b[o+i]; - - // 2's complement for negative numbers - if (negate) { - v = (v ^ 0xff) + carry; - carry = v >> 8; - v = v & 0xff; - } - - x += v * m; - } - - // Return Infinity if we've lost integer precision - if (!allowImprecise && x >= Int64.MAX_INT) { - return negate ? -Infinity : Infinity; - } - - return negate ? -x : x; - }, - - /** - * Convert to a JS Number. Returns +/-Infinity for values that can't be - * represented to integer precision. - */ - valueOf: function() { - return this.toNumber(false); - }, - - /** - * Return string value - * - * @param radix Just like Number#toString()'s radix - */ - toString: function(radix) { - return this.valueOf().toString(radix || 10); - }, - - /** - * Return a string showing the buffer octets, with MSB on the left. - * - * @param sep separator string. default is '' (empty string) - */ - toOctetString: function(sep) { - var out = new Array(8); - var b = this.buffer, o = this.offset; - for (var i = 0; i < 8; i++) { - out[i] = _HEX[b[o+i]]; - } - return out.join(sep || ''); - }, - - /** - * Returns the int64's 8 bytes in a buffer. - * - * @param {bool} [rawBuffer=false] If no offset and this is true, return the internal buffer. Should only be used if - * you're discarding the Int64 afterwards, as it breaks encapsulation. - */ - toBuffer: function(rawBuffer) { - if (rawBuffer && this.offset === 0) return this.buffer; - - var out = new Buffer(8); - this.buffer.copy(out, 0, this.offset, this.offset + 8); - return out; - }, - - /** - * Copy 8 bytes of int64 into target buffer at target offset. - * - * @param {Buffer} targetBuffer Buffer to copy into. - * @param {number} [targetOffset=0] Offset into target buffer. - */ - copy: function(targetBuffer, targetOffset) { - this.buffer.copy(targetBuffer, targetOffset || 0, this.offset, this.offset + 8); - }, - - /** - * Returns a number indicating whether this comes before or after or is the - * same as the other in sort order. - * - * @param {Int64} other Other Int64 to compare. - */ - compare: function(other) { - - // If sign bits differ ... - if ((this.buffer[this.offset] & 0x80) != (other.buffer[other.offset] & 0x80)) { - return other.buffer[other.offset] - this.buffer[this.offset]; - } - - // otherwise, compare bytes lexicographically - for (var i = 0; i < 8; i++) { - if (this.buffer[this.offset+i] !== other.buffer[other.offset+i]) { - return this.buffer[this.offset+i] - other.buffer[other.offset+i]; - } - } - return 0; - }, - - /** - * Returns a boolean indicating if this integer is equal to other. - * - * @param {Int64} other Other Int64 to compare. - */ - equals: function(other) { - return this.compare(other) === 0; - }, - - /** - * Pretty output in console.log - */ - inspect: function() { - return '[Int64 value:' + this + ' octets:' + this.toOctetString(' ') + ']'; - } -}; diff --git a/reverse_engineering/node_modules/node-int64/LICENSE b/reverse_engineering/node_modules/node-int64/LICENSE deleted file mode 100644 index ddb6a905..00000000 --- a/reverse_engineering/node_modules/node-int64/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright (c) 2014 Robert Kieffer - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. diff --git a/reverse_engineering/node_modules/node-int64/README.md b/reverse_engineering/node_modules/node-int64/README.md deleted file mode 100644 index efef18a7..00000000 --- a/reverse_engineering/node_modules/node-int64/README.md +++ /dev/null @@ -1,78 +0,0 @@ -JavaScript Numbers are represented as [IEEE 754 double-precision floats](http://steve.hollasch.net/cgindex/coding/ieeefloat.html). Unfortunately, this means they lose integer precision for values beyond +/- 2^^53. For projects that need to accurately handle 64-bit ints, such as [node-thrift](https://github.com/wadey/node-thrift), a performant, Number-like class is needed. Int64 is that class. - -Int64 instances look and feel much like JS-native Numbers. By way of example ... -```js -// First, let's illustrate the problem ... -> (0x123456789).toString(16) -'123456789' // <- what we expect. -> (0x123456789abcdef0).toString(16) -'123456789abcdf00' // <- Ugh! JS doesn't do big ints. :( - -// So let's create a couple Int64s using the above values ... - -// Require, of course -> Int64 = require('node-int64') - -// x's value is what we expect (the decimal value of 0x123456789) -> x = new Int64(0x123456789) -[Int64 value:4886718345 octets:00 00 00 01 23 45 67 89] - -// y's value is Infinity because it's outside the range of integer -// precision. But that's okay - it's still useful because it's internal -// representation (octets) is what we passed in -> y = new Int64('123456789abcdef0') -[Int64 value:Infinity octets:12 34 56 78 9a bc de f0] - -// Let's do some math. Int64's behave like Numbers. (Sorry, Int64 isn't -// for doing 64-bit integer arithmetic (yet) - it's just for carrying -// around int64 values -> x + 1 -4886718346 -> y + 1 -Infinity - -// Int64 string operations ... -> 'value: ' + x -'value: 4886718345' -> 'value: ' + y -'value: Infinity' -> x.toString(2) -'100100011010001010110011110001001' -> y.toString(2) -'Infinity' - -// Use JS's isFinite() method to see if the Int64 value is in the -// integer-precise range of JS values -> isFinite(x) -true -> isFinite(y) -false - -// Get an octet string representation. (Yay, y is what we put in!) -> x.toOctetString() -'0000000123456789' -> y.toOctetString() -'123456789abcdef0' - -// Finally, some other ways to create Int64s ... - -// Pass hi/lo words -> new Int64(0x12345678, 0x9abcdef0) -[Int64 value:Infinity octets:12 34 56 78 9a bc de f0] - -// Pass a Buffer -> new Int64(new Buffer([0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0])) -[Int64 value:Infinity octets:12 34 56 78 9a bc de f0] - -// Pass a Buffer and offset -> new Int64(new Buffer([0,0,0,0,0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0]), 4) -[Int64 value:Infinity octets:12 34 56 78 9a bc de f0] - -// Pull out into a buffer -> new Int64(new Buffer([0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0])).toBuffer() - - -// Or copy into an existing one (at an offset) -> var buf = new Buffer(1024); -> new Int64(new Buffer([0x12, 0x34, 0x56, 0x78, 0x9a, 0xbc, 0xde, 0xf0])).copy(buf, 512); -``` diff --git a/reverse_engineering/node_modules/node-int64/package.json b/reverse_engineering/node_modules/node-int64/package.json deleted file mode 100644 index e0a34a5e..00000000 --- a/reverse_engineering/node_modules/node-int64/package.json +++ /dev/null @@ -1,59 +0,0 @@ -{ - "_from": "node-int64@^0.4.0", - "_id": "node-int64@0.4.0", - "_inBundle": false, - "_integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=", - "_location": "/node-int64", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-int64@^0.4.0", - "name": "node-int64", - "escapedName": "node-int64", - "rawSpec": "^0.4.0", - "saveSpec": null, - "fetchSpec": "^0.4.0" - }, - "_requiredBy": [ - "/jks-js" - ], - "_resolved": "https://registry.npmjs.org/node-int64/-/node-int64-0.4.0.tgz", - "_shasum": "87a9065cdb355d3182d8f94ce11188b825c68a3b", - "_spec": "node-int64@^0.4.0", - "_where": "/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/jks-js", - "author": { - "name": "Robert Kieffer", - "email": "robert@broofa.com" - }, - "bugs": { - "url": "https://github.com/broofa/node-int64/issues" - }, - "bundleDependencies": false, - "contributors": [], - "dependencies": {}, - "deprecated": false, - "description": "Support for representing 64-bit integers in JavaScript", - "devDependencies": { - "nodeunit": "^0.9.0" - }, - "homepage": "https://github.com/broofa/node-int64#readme", - "keywords": [ - "math", - "integer", - "int64" - ], - "lib": ".", - "license": "MIT", - "main": "./Int64.js", - "name": "node-int64", - "repository": { - "type": "git", - "url": "git+https://github.com/broofa/node-int64.git" - }, - "scripts": { - "test": "nodeunit test.js" - }, - "url": "http://github.com/broofa/node-int64", - "version": "0.4.0" -} diff --git a/reverse_engineering/node_modules/node-int64/test.js b/reverse_engineering/node_modules/node-int64/test.js deleted file mode 100644 index cdf4303d..00000000 --- a/reverse_engineering/node_modules/node-int64/test.js +++ /dev/null @@ -1,120 +0,0 @@ -var assert = require('assert'); -var Int64 = require('./Int64'); - -exports.setUp = function(done) { - done(); -}; - -exports.testBufferToString = function(test) { - var int = new Int64(0xfffaffff, 0xfffff700); - test.equal( - int.toBuffer().toString('hex'), - 'fffafffffffff700', - 'Buffer to string conversion' - ); - test.done(); -}; - -exports.testBufferCopy = function(test) { - var src = new Int64(0xfffaffff, 0xfffff700); - var dst = new Buffer(8); - - src.copy(dst); - - test.deepEqual( - dst, - new Buffer([0xff, 0xfa, 0xff, 0xff, 0xff, 0xff, 0xf7, 0x00]), - 'Copy to buffer' - ); - - test.done(); -}; - -exports.testValueRepresentation = function(test) { - var args = [ - [0], '0000000000000000', 0, - [1], '0000000000000001', 1, - [-1], 'ffffffffffffffff', -1, - [1e18], '0de0b6b3a7640000', 1e18, - ['0001234500654321'], '0001234500654321', 0x1234500654321, - ['0ff1234500654321'], '0ff1234500654321', 0xff1234500654300, // Imprecise! - [0xff12345, 0x654321], '0ff1234500654321', 0xff1234500654300, // Imprecise! - [0xfffaffff, 0xfffff700],'fffafffffffff700', -0x5000000000900, - [0xafffffff, 0xfffff700],'affffffffffff700', -0x5000000000000800, // Imprecise! - ['0x0000123450654321'], '0000123450654321', 0x123450654321, - ['0xFFFFFFFFFFFFFFFF'], 'ffffffffffffffff', -1 - ]; - - // Test constructor argments - - for (var i = 0; i < args.length; i += 3) { - var a = args[i], octets = args[i+1], number = args[i+2]; - - // Create instance - var x = new Int64(); - Int64.apply(x, a); - - test.equal(x.toOctetString(), octets, 'Constuctor with ' + args.join(', ')); - test.equal(x.toNumber(true), number); - } - - test.done(); -}; - -exports.testBufferOffsets = function(test) { - var sourceBuffer = new Buffer(16); - sourceBuffer.writeUInt32BE(0xfffaffff, 2); - sourceBuffer.writeUInt32BE(0xfffff700, 6); - - var int = new Int64(sourceBuffer, 2); - assert.equal( - int.toBuffer().toString('hex'), 'fffafffffffff700', - 'Construct from offset' - ); - - var targetBuffer = new Buffer(16); - int.copy(targetBuffer, 4); - assert.equal( - targetBuffer.slice(4, 12).toString('hex'), 'fffafffffffff700', - 'Copy to offset' - ); - - test.done(); -}; - -exports.testInstanceOf = function(test) { - var x = new Int64(); - assert(x instanceof Int64, 'Variable is not instance of Int64'); - var y = {}; - assert(!(y instanceof Int64), 'Object is an instance of Int64'); - test.done(); -}; - -exports.testCompare = function(test) { - var intMin = new Int64(2147483648, 0); - var intMinPlusOne = new Int64(2147483648, 1); - var zero = new Int64(0, 0); - var intMaxMinusOne = new Int64(2147483647, 4294967294); - var intMax = new Int64(2147483647, 4294967295); - assert(intMin.compare(intMinPlusOne) < 0, "INT64_MIN is not less than INT64_MIN+1"); - assert(intMin.compare(zero) < 0, "INT64_MIN is not less than 0"); - assert(intMin.compare(zero) < intMax, "INT64_MIN is not less than INT64_MAX"); - assert(intMax.compare(intMaxMinusOne) > 0, "INT64_MAX is not greater than INT64_MAX-1"); - assert(intMax.compare(zero) > 0, "INT64_MAX is not greater than 0"); - assert(intMax.compare(intMin) > 0, "INT64_MAX is not greater than INT_MIN"); - test.done(); -}; - -exports.testEquals = function(test) { - var intMin = new Int64(2147483648, 0); - var zero = new Int64(0, 0); - var intMax = new Int64(2147483647, 4294967295); - assert(intMin.equals(intMin), "INT64_MIN !== INT64_MIN"); - assert(intMax.equals(intMax), "INT64_MAX !== INT64_MAX"); - assert(zero.equals(zero), "0 !== 0"); - assert(!intMin.equals(zero), "INT64_MIN === 0"); - assert(!intMin.equals(intMax), "INT64_MIN === INT64_MAX"); - assert(!intMax.equals(zero), "INT64_MAX === 0"); - assert(!intMax.equals(intMin), "INT64_MAX === INT64_MIN"); - test.done(); -}; diff --git a/reverse_engineering/node_modules/node-rsa/README.md b/reverse_engineering/node_modules/node-rsa/README.md deleted file mode 100644 index bb666d27..00000000 --- a/reverse_engineering/node_modules/node-rsa/README.md +++ /dev/null @@ -1,377 +0,0 @@ -# Node-RSA - -Node.js RSA library
-Based on jsbn library from Tom Wu http://www-cs-students.stanford.edu/~tjw/jsbn/ - -* Pure JavaScript -* No needed OpenSSL -* Generating keys -* Supports long messages for encrypt/decrypt -* Signing and verifying - -## Example - -```javascript -const NodeRSA = require('node-rsa'); -const key = new NodeRSA({b: 512}); - -const text = 'Hello RSA!'; -const encrypted = key.encrypt(text, 'base64'); -console.log('encrypted: ', encrypted); -const decrypted = key.decrypt(encrypted, 'utf8'); -console.log('decrypted: ', decrypted); -``` - -## Installing - -```shell -npm install node-rsa -``` -> Requires nodejs >= 8.11.1 - -### Testing - -```shell -npm test -``` - -## Work environment - -This library developed and tested primary for Node.js, but it still can work in browsers with [browserify](http://browserify.org/). - -## Usage - -### Create instance -```javascript -const NodeRSA = require('node-rsa'); - -const key = new NodeRSA([keyData, [format]], [options]); -``` - -* keyData — `{string|buffer|object}` — parameters for generating key or the key in one of supported formats.
-* format — `{string}` — format for importing key. See more details about formats in [Export/Import](#importexport-keys) section.
-* options — `{object}` — additional settings. - -#### Options -You can specify some options by second/third constructor argument, or over `key.setOptions()` method. - -* environment — working environment (default autodetect): - * `'browser'` — will run pure js implementation of RSA algorithms. - * `'node'` for `nodejs >= 0.10.x or io.js >= 1.x` — provide some native methods like sign/verify and encrypt/decrypt. -* encryptionScheme — padding scheme for encrypt/decrypt. Can be `'pkcs1_oaep'` or `'pkcs1'`. Default `'pkcs1_oaep'`. -* signingScheme — scheme used for signing and verifying. Can be `'pkcs1'` or `'pss'` or 'scheme-hash' format string (eg `'pss-sha1'`). Default `'pkcs1-sha256'`, or, if chosen pss: `'pss-sha1'`. - -> *Notice:* This lib supporting next hash algorithms: `'md5'`, `'ripemd160'`, `'sha1'`, `'sha256'`, `'sha512'` in browser and node environment and additional `'md4'`, `'sha'`, `'sha224'`, `'sha384'` in node only. - -Some [advanced options info](https://github.com/rzcoder/node-rsa/wiki/Advanced-options) - -#### Creating "empty" key -```javascript -const key = new NodeRSA(); -``` - -#### Generate new 512bit-length key -```javascript -const key = new NodeRSA({b: 512}); -``` - -Also you can use next method: - -```javascript -key.generateKeyPair([bits], [exp]); -``` - -* bits — `{int}` — key size in bits. 2048 by default. -* exp — `{int}` — public exponent. 65537 by default. - -#### Load key from PEM string - -```javascript -const key = new NodeRSA('-----BEGIN RSA PRIVATE KEY-----\n'+ - 'MIIBOQIBAAJAVY6quuzCwyOWzymJ7C4zXjeV/232wt2ZgJZ1kHzjI73wnhQ3WQcL\n'+ - 'DFCSoi2lPUW8/zspk0qWvPdtp6Jg5Lu7hwIDAQABAkBEws9mQahZ6r1mq2zEm3D/\n'+ - 'VM9BpV//xtd6p/G+eRCYBT2qshGx42ucdgZCYJptFoW+HEx/jtzWe74yK6jGIkWJ\n'+ - 'AiEAoNAMsPqwWwTyjDZCo9iKvfIQvd3MWnmtFmjiHoPtjx0CIQCIMypAEEkZuQUi\n'+ - 'pMoreJrOlLJWdc0bfhzNAJjxsTv/8wIgQG0ZqI3GubBxu9rBOAM5EoA4VNjXVigJ\n'+ - 'QEEk1jTkp8ECIQCHhsoq90mWM/p9L5cQzLDWkTYoPI49Ji+Iemi2T5MRqwIgQl07\n'+ - 'Es+KCn25OKXR/FJ5fu6A6A+MptABL3r8SEjlpLc=\n'+ - '-----END RSA PRIVATE KEY-----'); -``` - -### Import/Export keys -```javascript -key.importKey(keyData, [format]); -key.exportKey([format]); -``` - -* keyData — `{string|buffer}` — may be: - * key in PEM string - * Buffer containing PEM string - * Buffer containing DER encoded data - * Object contains key components -* format — `{string}` — format id for export/import. - -#### Format string syntax -Format string composed of several parts: `scheme-[key_type]-[output_type]`
- -Scheme — NodeRSA supports multiple format schemes for import/export keys: - - * `'pkcs1'` — public key starts from `'-----BEGIN RSA PUBLIC KEY-----'` header and private key starts from `'-----BEGIN RSA PRIVATE KEY-----'` header - * `'pkcs8'` — public key starts from `'-----BEGIN PUBLIC KEY-----'` header and private key starts from `'-----BEGIN PRIVATE KEY-----'` header - * `'openssh'` — public key starts from `'ssh-rsa'` header and private key starts from `'-----BEGIN OPENSSH PRIVATE KEY-----'` header - * `'components'` — use it for import/export key from/to raw components (see example below). For private key, importing data should contain all private key components, for public key: only public exponent (`e`) and modulus (`n`). All components (except `e`) should be Buffer, `e` could be Buffer or just normal Number. - -Key type — can be `'private'` or `'public'`. Default `'private'`
-Output type — can be: - - * `'pem'` — Base64 encoded string with header and footer. Used by default. - * `'der'` — Binary encoded key data. - -> *Notice:* For import, if *keyData* is PEM string or buffer containing string, you can do not specify format, but if you provide *keyData* as DER you must specify it in format string. - -**Shortcuts and examples** - * `'private'` or `'pkcs1'` or `'pkcs1-private'` == `'pkcs1-private-pem'` — private key encoded in pcks1 scheme as pem string. - * `'public'` or `'pkcs8-public'` == `'pkcs8-public-pem'` — public key encoded in pcks8 scheme as pem string. - * `'pkcs8'` or `'pkcs8-private'` == `'pkcs8-private-pem'` — private key encoded in pcks8 scheme as pem string. - * `'pkcs1-der'` == `'pkcs1-private-der'` — private key encoded in pcks1 scheme as binary buffer. - * `'pkcs8-public-der'` — public key encoded in pcks8 scheme as binary buffer. - -**Code example** - -```javascript -const keyData = '-----BEGIN PUBLIC KEY----- ... -----END PUBLIC KEY-----'; -key.importKey(keyData, 'pkcs8'); -const publicDer = key.exportKey('pkcs8-public-der'); -const privateDer = key.exportKey('pkcs1-der'); -``` - -```javascript -key.importKey({ - n: Buffer.from('0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783', 'hex'), - e: 65537, - d: Buffer.from('5d2f0dd982596ef781affb1cab73a77c46985c6da2aafc252cea3f4546e80f40c0e247d7d9467750ea1321cc5aa638871b3ed96d19dcc124916b0bcb296f35e1', 'hex'), - p: Buffer.from('00c59419db615e56b9805cc45673a32d278917534804171edcf925ab1df203927f', 'hex'), - q: Buffer.from('00aee3f86b66087abc069b8b1736e38ad6af624f7ea80e70b95f4ff2bf77cd90fd', 'hex'), - dmp1: Buffer.from('008112f5a969fcb56f4e3a4c51a60dcdebec157ee4a7376b843487b53844e8ac85', 'hex'), - dmq1: Buffer.from('1a7370470e0f8a4095df40922a430fe498720e03e1f70d257c3ce34202249d21', 'hex'), - coeff: Buffer.from('00b399675e5e81506b729a777cc03026f0b2119853dfc5eb124610c0ab82999e45', 'hex') -}, 'components'); -const publicComponents = key.exportKey('components-public'); -console.log(publicComponents); - -/* -{ n: , - e: 65537 -} -*/ -``` - -If you want to only import the public key use `'components-public'` as an option: - -```javascript -key.importKey({ - n: Buffer.from('0086fa9ba066685845fc03833a9699c8baefb53cfbf19052a7f10f1eaa30488cec1ceb752bdff2df9fad6c64b3498956e7dbab4035b4823c99a44cc57088a23783', 'hex'), - e: 65537, -}, 'components-public'); -``` - -### Properties - -#### Key testing -```javascript -key.isPrivate(); -key.isPublic([strict]); -``` -strict — `{boolean}` — if true method will return false if key pair have private exponent. Default `false`. - -```javascript -key.isEmpty(); -``` -Return `true` if key pair doesn't have any data. - -#### Key info -```javascript -key.getKeySize(); -``` -Return key size in bits. - -```javascript -key.getMaxMessageSize(); -``` -Return max data size for encrypt in bytes. - -### Encrypting/decrypting - -```javascript -key.encrypt(buffer, [encoding], [source_encoding]); -key.encryptPrivate(buffer, [encoding], [source_encoding]); // use private key for encryption -``` -Return encrypted data.
- -* buffer — `{buffer}` — data for encrypting, may be string, Buffer, or any object/array. Arrays and objects will encoded to JSON string first.
-* encoding — `{string}` — encoding for output result, may be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`.
-* source_encoding — `{string}` — source encoding, works only with string buffer. Can take standard Node.js Buffer encodings (hex, utf8, base64, etc). `'utf8'` by default.
- -```javascript -key.decrypt(buffer, [encoding]); -key.decryptPublic(buffer, [encoding]); // use public key for decryption -``` -Return decrypted data.
- -* buffer — `{buffer}` — data for decrypting. Takes Buffer object or base64 encoded string.
-* encoding — `{string}` — encoding for result string. Can also take `'buffer'` for raw Buffer object, or `'json'` for automatic JSON.parse result. Default `'buffer'`. - -> *Notice:* `encryptPrivate` and `decryptPublic` using only pkcs1 padding type 1 (not random) - -### Signing/Verifying -```javascript -key.sign(buffer, [encoding], [source_encoding]); -``` -Return signature for buffer. All the arguments are the same as for `encrypt` method. - -```javascript -key.verify(buffer, signature, [source_encoding], [signature_encoding]) -``` -Return result of check, `true` or `false`.
- -* buffer — `{buffer}` — data for check, same as `encrypt` method.
-* signature — `{string}` — signature for check, result of `sign` method.
-* source_encoding — `{string}` — same as for `encrypt` method.
-* signature_encoding — `{string}` — encoding of given signature. May be `'buffer'`, `'binary'`, `'hex'` or `'base64'`. Default `'buffer'`. - -## Contributing - -Questions, comments, bug reports, and pull requests are all welcome. - -## Changelog - -### 1.1.0 - * Added OpenSSH key format support. - -### 1.0.2 - * Importing keys from PEM now is less dependent on non-key data in files. - -### 1.0.1 - * `importKey()` now returns `this` - -### 1.0.0 - * Using semver now 🎉 - * **Breaking change**: Drop support nodejs < 8.11.1 - * **Possible breaking change**: `new Buffer()` call as deprecated was replaced by `Buffer.from` & `Buffer.alloc`. - * **Possible breaking change**: Drop support for hash scheme `sha` (was removed in node ~10). `sha1`, `sha256` and others still works. - * **Possible breaking change**: Little change in environment detect algorithm. - -### 0.4.2 - * `no padding` scheme will padded data with zeros on all environments. - -### 0.4.1 - * `PKCS1 no padding` scheme support. - -### 0.4.0 - * License changed from BSD to MIT. - * Some changes in internal api. - -### 0.3.3 - * Fixed PSS encode/verify methods with max salt length. - -### 0.3.2 - * Fixed environment detection in web worker. - -### 0.3.0 - * Added import/export from/to raw key components. - * Removed lodash from dependencies. - -### 0.2.30 - * Fixed a issue when the key was generated by 1 bit smaller than specified. It may slow down the generation of large keys. - -### 0.2.24 - * Now used old hash APIs for webpack compatible. - -### 0.2.22 - * `encryptPrivate` and `decryptPublic` now using only pkcs1 (type 1) padding. - -### 0.2.20 - * Added `.encryptPrivate()` and `.decryptPublic()` methods. - * Encrypt/decrypt methods in nodejs 0.12.x and io.js using native implementation (> 40x speed boost). - * Fixed some regex issue causing catastrophic backtracking. - -### 0.2.10 - * **Methods `.exportPrivate()` and `.exportPublic()` was replaced by `.exportKey([format])`.** - * By default `.exportKey()` returns private key as `.exportPrivate()`, if you need public key from `.exportPublic()` you must specify format as `'public'` or `'pkcs8-public-pem'`. - * Method `.importKey(key, [format])` now has second argument. - -### 0.2.0 - * **`.getPublicPEM()` method was renamed to `.exportPublic()`** - * **`.getPrivatePEM()` method was renamed to `.exportPrivate()`** - * **`.loadFromPEM()` method was renamed to `.importKey()`** - * Added PKCS1_OAEP encrypting/decrypting support. - * **PKCS1_OAEP now default scheme, you need to specify 'encryptingScheme' option to 'pkcs1' for compatibility with 0.1.x version of NodeRSA.** - * Added PSS signing/verifying support. - * Signing now supports `'md5'`, `'ripemd160'`, `'sha1'`, `'sha256'`, `'sha512'` hash algorithms in both environments - and additional `'md4'`, `'sha'`, `'sha224'`, `'sha384'` for nodejs env. - * **`options.signingAlgorithm` was renamed to `options.signingScheme`** - * Added `encryptingScheme` option. - * Property `key.options` now mark as private. Added `key.setOptions(options)` method. - - -### 0.1.54 - * Added support for loading PEM key from Buffer (`fs.readFileSync()` output). - * Added `isEmpty()` method. - -### 0.1.52 - * Improve work with not properly trimming PEM strings. - -### 0.1.50 - * Implemented native js signing and verifying for browsers. - * `options.signingAlgorithm` now takes only hash-algorithm name. - * Added `.getKeySize()` and `.getMaxMessageSize()` methods. - * `.loadFromPublicPEM` and `.loadFromPrivatePEM` methods marked as private. - -### 0.1.40 - * Added signing/verifying. - -### 0.1.30 - * Added long message support. - - -## License - -Copyright (c) 2014 rzcoder
- -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -## Licensing for code used in rsa.js and jsbn.js - -Copyright (c) 2003-2005 Tom Wu
-All Rights Reserved. - -Permission is hereby granted, free of charge, to any person obtaining -a copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be -included in all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, -EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY -WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - -IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, -INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER -RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF -THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT -OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - -In addition, the following condition applies: - -All redistributions must retain an intact copy of this copyright notice -and disclaimer. - -[![Build Status](https://travis-ci.org/rzcoder/node-rsa.svg?branch=master)](https://travis-ci.org/rzcoder/node-rsa) diff --git a/reverse_engineering/node_modules/node-rsa/gruntfile.js b/reverse_engineering/node_modules/node-rsa/gruntfile.js deleted file mode 100644 index 4d00789c..00000000 --- a/reverse_engineering/node_modules/node-rsa/gruntfile.js +++ /dev/null @@ -1,33 +0,0 @@ -module.exports = function (grunt) { - grunt.initConfig({ - jshint: { - options: {}, - default: { - files: { - src: ['gruntfile.js', 'src/**/*.js', '!src/libs/jsbn.js'] - } - }, - libs: { - files: { - src: ['src/libs/**/*'] - } - } - }, - - simplemocha: { - options: { - reporter: 'list' - }, - all: {src: ['test/**/*.js']} - } - }); - - require('jit-grunt')(grunt, { - 'simplemocha': 'grunt-simple-mocha' - }); - - grunt.registerTask('lint', ['jshint:default']); - grunt.registerTask('test', ['simplemocha']); - - grunt.registerTask('default', ['lint', 'test']); -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/package.json b/reverse_engineering/node_modules/node-rsa/package.json deleted file mode 100644 index c08a6a58..00000000 --- a/reverse_engineering/node_modules/node-rsa/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "_from": "node-rsa@^1.0.7", - "_id": "node-rsa@1.1.1", - "_inBundle": false, - "_integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", - "_location": "/node-rsa", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "node-rsa@^1.0.7", - "name": "node-rsa", - "escapedName": "node-rsa", - "rawSpec": "^1.0.7", - "saveSpec": null, - "fetchSpec": "^1.0.7" - }, - "_requiredBy": [ - "/jks-js" - ], - "_resolved": "https://registry.npmjs.org/node-rsa/-/node-rsa-1.1.1.tgz", - "_shasum": "efd9ad382097782f506153398496f79e4464434d", - "_spec": "node-rsa@^1.0.7", - "_where": "/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/jks-js", - "author": { - "name": "rzcoder" - }, - "bugs": { - "url": "https://github.com/rzcoder/node-rsa/issues" - }, - "bundleDependencies": false, - "dependencies": { - "asn1": "^0.2.4" - }, - "deprecated": false, - "description": "Node.js RSA library", - "devDependencies": { - "chai": "^4.2.0", - "grunt": "^1.1.0", - "grunt-contrib-jshint": "^2.1.0", - "grunt-simple-mocha": "0.4.1", - "jit-grunt": "0.10.0", - "lodash": "^4.17.15", - "nyc": "^15.0.0" - }, - "homepage": "https://github.com/rzcoder/node-rsa", - "keywords": [ - "node", - "rsa", - "crypto", - "assymetric", - "encryption", - "decryption", - "sign", - "verify", - "pkcs1", - "oaep", - "pss" - ], - "license": "MIT", - "main": "src/NodeRSA.js", - "name": "node-rsa", - "repository": { - "type": "git", - "url": "git+https://github.com/rzcoder/node-rsa.git" - }, - "scripts": { - "test": "grunt test" - }, - "version": "1.1.1" -} diff --git a/reverse_engineering/node_modules/node-rsa/src/NodeRSA.js b/reverse_engineering/node_modules/node-rsa/src/NodeRSA.js deleted file mode 100644 index 190fd661..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/NodeRSA.js +++ /dev/null @@ -1,398 +0,0 @@ -/*! - * RSA library for Node.js - * - * Author: rzcoder - * License MIT - */ - -var constants = require('constants'); -var rsa = require('./libs/rsa.js'); -var crypt = require('crypto'); -var ber = require('asn1').Ber; -var _ = require('./utils')._; -var utils = require('./utils'); -var schemes = require('./schemes/schemes.js'); -var formats = require('./formats/formats.js'); - -if (typeof constants.RSA_NO_PADDING === "undefined") { - //patch for node v0.10.x, constants do not defined - constants.RSA_NO_PADDING = 3; -} - -module.exports = (function () { - var SUPPORTED_HASH_ALGORITHMS = { - node10: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'], - node: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'], - iojs: ['md4', 'md5', 'ripemd160', 'sha1', 'sha224', 'sha256', 'sha384', 'sha512'], - browser: ['md5', 'ripemd160', 'sha1', 'sha256', 'sha512'] - }; - - var DEFAULT_ENCRYPTION_SCHEME = 'pkcs1_oaep'; - var DEFAULT_SIGNING_SCHEME = 'pkcs1'; - - var DEFAULT_EXPORT_FORMAT = 'private'; - var EXPORT_FORMAT_ALIASES = { - 'private': 'pkcs1-private-pem', - 'private-der': 'pkcs1-private-der', - 'public': 'pkcs8-public-pem', - 'public-der': 'pkcs8-public-der', - }; - - /** - * @param key {string|buffer|object} Key in PEM format, or data for generate key {b: bits, e: exponent} - * @constructor - */ - function NodeRSA(key, format, options) { - if (!(this instanceof NodeRSA)) { - return new NodeRSA(key, format, options); - } - - if (_.isObject(format)) { - options = format; - format = undefined; - } - - this.$options = { - signingScheme: DEFAULT_SIGNING_SCHEME, - signingSchemeOptions: { - hash: 'sha256', - saltLength: null - }, - encryptionScheme: DEFAULT_ENCRYPTION_SCHEME, - encryptionSchemeOptions: { - hash: 'sha1', - label: null - }, - environment: utils.detectEnvironment(), - rsaUtils: this - }; - this.keyPair = new rsa.Key(); - this.$cache = {}; - - if (Buffer.isBuffer(key) || _.isString(key)) { - this.importKey(key, format); - } else if (_.isObject(key)) { - this.generateKeyPair(key.b, key.e); - } - - this.setOptions(options); - } - - /** - * Set and validate options for key instance - * @param options - */ - NodeRSA.prototype.setOptions = function (options) { - options = options || {}; - if (options.environment) { - this.$options.environment = options.environment; - } - - if (options.signingScheme) { - if (_.isString(options.signingScheme)) { - var signingScheme = options.signingScheme.toLowerCase().split('-'); - if (signingScheme.length == 1) { - if (SUPPORTED_HASH_ALGORITHMS.node.indexOf(signingScheme[0]) > -1) { - this.$options.signingSchemeOptions = { - hash: signingScheme[0] - }; - this.$options.signingScheme = DEFAULT_SIGNING_SCHEME; - } else { - this.$options.signingScheme = signingScheme[0]; - this.$options.signingSchemeOptions = { - hash: null - }; - } - } else { - this.$options.signingSchemeOptions = { - hash: signingScheme[1] - }; - this.$options.signingScheme = signingScheme[0]; - } - } else if (_.isObject(options.signingScheme)) { - this.$options.signingScheme = options.signingScheme.scheme || DEFAULT_SIGNING_SCHEME; - this.$options.signingSchemeOptions = _.omit(options.signingScheme, 'scheme'); - } - - if (!schemes.isSignature(this.$options.signingScheme)) { - throw Error('Unsupported signing scheme'); - } - - if (this.$options.signingSchemeOptions.hash && - SUPPORTED_HASH_ALGORITHMS[this.$options.environment].indexOf(this.$options.signingSchemeOptions.hash) === -1) { - throw Error('Unsupported hashing algorithm for ' + this.$options.environment + ' environment'); - } - } - - if (options.encryptionScheme) { - if (_.isString(options.encryptionScheme)) { - this.$options.encryptionScheme = options.encryptionScheme.toLowerCase(); - this.$options.encryptionSchemeOptions = {}; - } else if (_.isObject(options.encryptionScheme)) { - this.$options.encryptionScheme = options.encryptionScheme.scheme || DEFAULT_ENCRYPTION_SCHEME; - this.$options.encryptionSchemeOptions = _.omit(options.encryptionScheme, 'scheme'); - } - - if (!schemes.isEncryption(this.$options.encryptionScheme)) { - throw Error('Unsupported encryption scheme'); - } - - if (this.$options.encryptionSchemeOptions.hash && - SUPPORTED_HASH_ALGORITHMS[this.$options.environment].indexOf(this.$options.encryptionSchemeOptions.hash) === -1) { - throw Error('Unsupported hashing algorithm for ' + this.$options.environment + ' environment'); - } - } - - this.keyPair.setOptions(this.$options); - }; - - /** - * Generate private/public keys pair - * - * @param bits {int} length key in bits. Default 2048. - * @param exp {int} public exponent. Default 65537. - * @returns {NodeRSA} - */ - NodeRSA.prototype.generateKeyPair = function (bits, exp) { - bits = bits || 2048; - exp = exp || 65537; - - if (bits % 8 !== 0) { - throw Error('Key size must be a multiple of 8.'); - } - - this.keyPair.generate(bits, exp.toString(16)); - this.$cache = {}; - return this; - }; - - /** - * Importing key - * @param keyData {string|buffer|Object} - * @param format {string} - */ - NodeRSA.prototype.importKey = function (keyData, format) { - if (!keyData) { - throw Error("Empty key given"); - } - - if (format) { - format = EXPORT_FORMAT_ALIASES[format] || format; - } - - if (!formats.detectAndImport(this.keyPair, keyData, format) && format === undefined) { - throw Error("Key format must be specified"); - } - - this.$cache = {}; - - return this; - }; - - /** - * Exporting key - * @param [format] {string} - */ - NodeRSA.prototype.exportKey = function (format) { - format = format || DEFAULT_EXPORT_FORMAT; - format = EXPORT_FORMAT_ALIASES[format] || format; - - if (!this.$cache[format]) { - this.$cache[format] = formats.detectAndExport(this.keyPair, format); - } - - return this.$cache[format]; - }; - - /** - * Check if key pair contains private key - */ - NodeRSA.prototype.isPrivate = function () { - return this.keyPair.isPrivate(); - }; - - /** - * Check if key pair contains public key - * @param [strict] {boolean} - public key only, return false if have private exponent - */ - NodeRSA.prototype.isPublic = function (strict) { - return this.keyPair.isPublic(strict); - }; - - /** - * Check if key pair doesn't contains any data - */ - NodeRSA.prototype.isEmpty = function (strict) { - return !(this.keyPair.n || this.keyPair.e || this.keyPair.d); - }; - - /** - * Encrypting data method with public key - * - * @param buffer {string|number|object|array|Buffer} - data for encrypting. Object and array will convert to JSON string. - * @param encoding {string} - optional. Encoding for output result, may be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'. - * @param source_encoding {string} - optional. Encoding for given string. Default utf8. - * @returns {string|Buffer} - */ - NodeRSA.prototype.encrypt = function (buffer, encoding, source_encoding) { - return this.$$encryptKey(false, buffer, encoding, source_encoding); - }; - - /** - * Decrypting data method with private key - * - * @param buffer {Buffer} - buffer for decrypting - * @param encoding - encoding for result string, can also take 'json' or 'buffer' for the automatic conversion of this type - * @returns {Buffer|object|string} - */ - NodeRSA.prototype.decrypt = function (buffer, encoding) { - return this.$$decryptKey(false, buffer, encoding); - }; - - /** - * Encrypting data method with private key - * - * Parameters same as `encrypt` method - */ - NodeRSA.prototype.encryptPrivate = function (buffer, encoding, source_encoding) { - return this.$$encryptKey(true, buffer, encoding, source_encoding); - }; - - /** - * Decrypting data method with public key - * - * Parameters same as `decrypt` method - */ - NodeRSA.prototype.decryptPublic = function (buffer, encoding) { - return this.$$decryptKey(true, buffer, encoding); - }; - - /** - * Encrypting data method with custom key - */ - NodeRSA.prototype.$$encryptKey = function (usePrivate, buffer, encoding, source_encoding) { - try { - var res = this.keyPair.encrypt(this.$getDataForEncrypt(buffer, source_encoding), usePrivate); - - if (encoding == 'buffer' || !encoding) { - return res; - } else { - return res.toString(encoding); - } - } catch (e) { - throw Error('Error during encryption. Original error: ' + e); - } - }; - - /** - * Decrypting data method with custom key - */ - NodeRSA.prototype.$$decryptKey = function (usePublic, buffer, encoding) { - try { - buffer = _.isString(buffer) ? Buffer.from(buffer, 'base64') : buffer; - var res = this.keyPair.decrypt(buffer, usePublic); - - if (res === null) { - throw Error('Key decrypt method returns null.'); - } - - return this.$getDecryptedData(res, encoding); - } catch (e) { - throw Error('Error during decryption (probably incorrect key). Original error: ' + e); - } - }; - - /** - * Signing data - * - * @param buffer {string|number|object|array|Buffer} - data for signing. Object and array will convert to JSON string. - * @param encoding {string} - optional. Encoding for output result, may be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'. - * @param source_encoding {string} - optional. Encoding for given string. Default utf8. - * @returns {string|Buffer} - */ - NodeRSA.prototype.sign = function (buffer, encoding, source_encoding) { - if (!this.isPrivate()) { - throw Error("This is not private key"); - } - - var res = this.keyPair.sign(this.$getDataForEncrypt(buffer, source_encoding)); - - if (encoding && encoding != 'buffer') { - res = res.toString(encoding); - } - - return res; - }; - - /** - * Verifying signed data - * - * @param buffer - signed data - * @param signature - * @param source_encoding {string} - optional. Encoding for given string. Default utf8. - * @param signature_encoding - optional. Encoding of given signature. May be 'buffer', 'binary', 'hex' or 'base64'. Default 'buffer'. - * @returns {*} - */ - NodeRSA.prototype.verify = function (buffer, signature, source_encoding, signature_encoding) { - if (!this.isPublic()) { - throw Error("This is not public key"); - } - signature_encoding = (!signature_encoding || signature_encoding == 'buffer' ? null : signature_encoding); - return this.keyPair.verify(this.$getDataForEncrypt(buffer, source_encoding), signature, signature_encoding); - }; - - /** - * Returns key size in bits - * @returns {int} - */ - NodeRSA.prototype.getKeySize = function () { - return this.keyPair.keySize; - }; - - /** - * Returns max message length in bytes (for 1 chunk) depending on current encryption scheme - * @returns {int} - */ - NodeRSA.prototype.getMaxMessageSize = function () { - return this.keyPair.maxMessageLength; - }; - - /** - * Preparing given data for encrypting/signing. Just make new/return Buffer object. - * - * @param buffer {string|number|object|array|Buffer} - data for encrypting. Object and array will convert to JSON string. - * @param encoding {string} - optional. Encoding for given string. Default utf8. - * @returns {Buffer} - */ - NodeRSA.prototype.$getDataForEncrypt = function (buffer, encoding) { - if (_.isString(buffer) || _.isNumber(buffer)) { - return Buffer.from('' + buffer, encoding || 'utf8'); - } else if (Buffer.isBuffer(buffer)) { - return buffer; - } else if (_.isObject(buffer)) { - return Buffer.from(JSON.stringify(buffer)); - } else { - throw Error("Unexpected data type"); - } - }; - - /** - * - * @param buffer {Buffer} - decrypted data. - * @param encoding - optional. Encoding for result output. May be 'buffer', 'json' or any of Node.js Buffer supported encoding. - * @returns {*} - */ - NodeRSA.prototype.$getDecryptedData = function (buffer, encoding) { - encoding = encoding || 'buffer'; - - if (encoding == 'buffer') { - return buffer; - } else if (encoding == 'json') { - return JSON.parse(buffer.toString()); - } else { - return buffer.toString(encoding); - } - }; - - return NodeRSA; -})(); diff --git a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/encryptEngines.js b/reverse_engineering/node_modules/node-rsa/src/encryptEngines/encryptEngines.js deleted file mode 100644 index 2d7421ba..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/encryptEngines.js +++ /dev/null @@ -1,17 +0,0 @@ -var crypt = require('crypto'); - -module.exports = { - getEngine: function (keyPair, options) { - var engine = require('./js.js'); - if (options.environment === 'node') { - if (typeof crypt.publicEncrypt === 'function' && typeof crypt.privateDecrypt === 'function') { - if (typeof crypt.privateEncrypt === 'function' && typeof crypt.publicDecrypt === 'function') { - engine = require('./io.js'); - } else { - engine = require('./node12.js'); - } - } - } - return engine(keyPair, options); - } -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/io.js b/reverse_engineering/node_modules/node-rsa/src/encryptEngines/io.js deleted file mode 100644 index 799ae1d5..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/io.js +++ /dev/null @@ -1,72 +0,0 @@ -var crypto = require('crypto'); -var constants = require('constants'); -var schemes = require('../schemes/schemes.js'); - -module.exports = function (keyPair, options) { - var pkcs1Scheme = schemes.pkcs1.makeScheme(keyPair, options); - - return { - encrypt: function (buffer, usePrivate) { - var padding; - if (usePrivate) { - padding = constants.RSA_PKCS1_PADDING; - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - return crypto.privateEncrypt({ - key: options.rsaUtils.exportKey('private'), - padding: padding - }, buffer); - } else { - padding = constants.RSA_PKCS1_OAEP_PADDING; - if (options.encryptionScheme === 'pkcs1') { - padding = constants.RSA_PKCS1_PADDING; - } - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - - var data = buffer; - if (padding === constants.RSA_NO_PADDING) { - data = pkcs1Scheme.pkcs0pad(buffer); - } - - return crypto.publicEncrypt({ - key: options.rsaUtils.exportKey('public'), - padding: padding - }, data); - } - }, - - decrypt: function (buffer, usePublic) { - var padding; - if (usePublic) { - padding = constants.RSA_PKCS1_PADDING; - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - return crypto.publicDecrypt({ - key: options.rsaUtils.exportKey('public'), - padding: padding - }, buffer); - } else { - padding = constants.RSA_PKCS1_OAEP_PADDING; - if (options.encryptionScheme === 'pkcs1') { - padding = constants.RSA_PKCS1_PADDING; - } - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - var res = crypto.privateDecrypt({ - key: options.rsaUtils.exportKey('private'), - padding: padding - }, buffer); - - if (padding === constants.RSA_NO_PADDING) { - return pkcs1Scheme.pkcs0unpad(res); - } - return res; - } - } - }; -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/js.js b/reverse_engineering/node_modules/node-rsa/src/encryptEngines/js.js deleted file mode 100644 index 4df35319..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/js.js +++ /dev/null @@ -1,34 +0,0 @@ -var BigInteger = require('../libs/jsbn.js'); -var schemes = require('../schemes/schemes.js'); - -module.exports = function (keyPair, options) { - var pkcs1Scheme = schemes.pkcs1.makeScheme(keyPair, options); - - return { - encrypt: function (buffer, usePrivate) { - var m, c; - if (usePrivate) { - /* Type 1: zeros padding for private key encrypt */ - m = new BigInteger(pkcs1Scheme.encPad(buffer, {type: 1})); - c = keyPair.$doPrivate(m); - } else { - m = new BigInteger(keyPair.encryptionScheme.encPad(buffer)); - c = keyPair.$doPublic(m); - } - return c.toBuffer(keyPair.encryptedDataLength); - }, - - decrypt: function (buffer, usePublic) { - var m, c = new BigInteger(buffer); - - if (usePublic) { - m = keyPair.$doPublic(c); - /* Type 1: zeros padding for private key decrypt */ - return pkcs1Scheme.encUnPad(m.toBuffer(keyPair.encryptedDataLength), {type: 1}); - } else { - m = keyPair.$doPrivate(c); - return keyPair.encryptionScheme.encUnPad(m.toBuffer(keyPair.encryptedDataLength)); - } - } - }; -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/node12.js b/reverse_engineering/node_modules/node-rsa/src/encryptEngines/node12.js deleted file mode 100644 index 86e58361..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/encryptEngines/node12.js +++ /dev/null @@ -1,56 +0,0 @@ -var crypto = require('crypto'); -var constants = require('constants'); -var schemes = require('../schemes/schemes.js'); - -module.exports = function (keyPair, options) { - var jsEngine = require('./js.js')(keyPair, options); - var pkcs1Scheme = schemes.pkcs1.makeScheme(keyPair, options); - - return { - encrypt: function (buffer, usePrivate) { - if (usePrivate) { - return jsEngine.encrypt(buffer, usePrivate); - } - var padding = constants.RSA_PKCS1_OAEP_PADDING; - if (options.encryptionScheme === 'pkcs1') { - padding = constants.RSA_PKCS1_PADDING; - } - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - - var data = buffer; - if (padding === constants.RSA_NO_PADDING) { - data = pkcs1Scheme.pkcs0pad(buffer); - } - - return crypto.publicEncrypt({ - key: options.rsaUtils.exportKey('public'), - padding: padding - }, data); - }, - - decrypt: function (buffer, usePublic) { - if (usePublic) { - return jsEngine.decrypt(buffer, usePublic); - } - var padding = constants.RSA_PKCS1_OAEP_PADDING; - if (options.encryptionScheme === 'pkcs1') { - padding = constants.RSA_PKCS1_PADDING; - } - if (options.encryptionSchemeOptions && options.encryptionSchemeOptions.padding) { - padding = options.encryptionSchemeOptions.padding; - } - - var res = crypto.privateDecrypt({ - key: options.rsaUtils.exportKey('private'), - padding: padding - }, buffer); - - if (padding === constants.RSA_NO_PADDING) { - return pkcs1Scheme.pkcs0unpad(res); - } - return res; - } - }; -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/formats/components.js b/reverse_engineering/node_modules/node-rsa/src/formats/components.js deleted file mode 100644 index 56af95c2..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/formats/components.js +++ /dev/null @@ -1,71 +0,0 @@ -var _ = require('../utils')._; -var utils = require('../utils'); - -module.exports = { - privateExport: function (key, options) { - return { - n: key.n.toBuffer(), - e: key.e, - d: key.d.toBuffer(), - p: key.p.toBuffer(), - q: key.q.toBuffer(), - dmp1: key.dmp1.toBuffer(), - dmq1: key.dmq1.toBuffer(), - coeff: key.coeff.toBuffer() - }; - }, - - privateImport: function (key, data, options) { - if (data.n && data.e && data.d && data.p && data.q && data.dmp1 && data.dmq1 && data.coeff) { - key.setPrivate( - data.n, - data.e, - data.d, - data.p, - data.q, - data.dmp1, - data.dmq1, - data.coeff - ); - } else { - throw Error("Invalid key data"); - } - }, - - publicExport: function (key, options) { - return { - n: key.n.toBuffer(), - e: key.e - }; - }, - - publicImport: function (key, data, options) { - if (data.n && data.e) { - key.setPublic( - data.n, - data.e - ); - } else { - throw Error("Invalid key data"); - } - }, - - /** - * Trying autodetect and import key - * @param key - * @param data - */ - autoImport: function (key, data) { - if (data.n && data.e) { - if (data.d && data.p && data.q && data.dmp1 && data.dmq1 && data.coeff) { - module.exports.privateImport(key, data); - return true; - } else { - module.exports.publicImport(key, data); - return true; - } - } - - return false; - } -}; diff --git a/reverse_engineering/node_modules/node-rsa/src/formats/formats.js b/reverse_engineering/node_modules/node-rsa/src/formats/formats.js deleted file mode 100644 index e1fc3fbc..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/formats/formats.js +++ /dev/null @@ -1,97 +0,0 @@ -var _ = require('../utils')._; - -function formatParse(format) { - format = format.split('-'); - var keyType = 'private'; - var keyOpt = {type: 'default'}; - - for (var i = 1; i < format.length; i++) { - if (format[i]) { - switch (format[i]) { - case 'public': - keyType = format[i]; - break; - case 'private': - keyType = format[i]; - break; - case 'pem': - keyOpt.type = format[i]; - break; - case 'der': - keyOpt.type = format[i]; - break; - } - } - } - - return {scheme: format[0], keyType: keyType, keyOpt: keyOpt}; -} - -module.exports = { - pkcs1: require('./pkcs1'), - pkcs8: require('./pkcs8'), - components: require('./components'), - openssh: require('./openssh'), - - isPrivateExport: function (format) { - return module.exports[format] && typeof module.exports[format].privateExport === 'function'; - }, - - isPrivateImport: function (format) { - return module.exports[format] && typeof module.exports[format].privateImport === 'function'; - }, - - isPublicExport: function (format) { - return module.exports[format] && typeof module.exports[format].publicExport === 'function'; - }, - - isPublicImport: function (format) { - return module.exports[format] && typeof module.exports[format].publicImport === 'function'; - }, - - detectAndImport: function (key, data, format) { - if (format === undefined) { - for (var scheme in module.exports) { - if (typeof module.exports[scheme].autoImport === 'function' && module.exports[scheme].autoImport(key, data)) { - return true; - } - } - } else if (format) { - var fmt = formatParse(format); - - if (module.exports[fmt.scheme]) { - if (fmt.keyType === 'private') { - module.exports[fmt.scheme].privateImport(key, data, fmt.keyOpt); - } else { - module.exports[fmt.scheme].publicImport(key, data, fmt.keyOpt); - } - } else { - throw Error('Unsupported key format'); - } - } - - return false; - }, - - detectAndExport: function (key, format) { - if (format) { - var fmt = formatParse(format); - - if (module.exports[fmt.scheme]) { - if (fmt.keyType === 'private') { - if (!key.isPrivate()) { - throw Error("This is not private key"); - } - return module.exports[fmt.scheme].privateExport(key, fmt.keyOpt); - } else { - if (!key.isPublic()) { - throw Error("This is not public key"); - } - return module.exports[fmt.scheme].publicExport(key, fmt.keyOpt); - } - } else { - throw Error('Unsupported key format'); - } - } - } -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/formats/openssh.js b/reverse_engineering/node_modules/node-rsa/src/formats/openssh.js deleted file mode 100644 index 60aa1465..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/formats/openssh.js +++ /dev/null @@ -1,292 +0,0 @@ -var _ = require("../utils")._; -var utils = require("../utils"); -var BigInteger = require("../libs/jsbn"); - -const PRIVATE_OPENING_BOUNDARY = "-----BEGIN OPENSSH PRIVATE KEY-----"; -const PRIVATE_CLOSING_BOUNDARY = "-----END OPENSSH PRIVATE KEY-----"; - -module.exports = { - privateExport: function (key, options) { - const nbuf = key.n.toBuffer(); - - let ebuf = Buffer.alloc(4) - ebuf.writeUInt32BE(key.e, 0); - //Slice leading zeroes - while (ebuf[0] === 0) ebuf = ebuf.slice(1); - - const dbuf = key.d.toBuffer(); - const coeffbuf = key.coeff.toBuffer(); - const pbuf = key.p.toBuffer(); - const qbuf = key.q.toBuffer(); - let commentbuf; - if (typeof key.sshcomment !== "undefined") { - commentbuf = Buffer.from(key.sshcomment); - } else { - commentbuf = Buffer.from([]); - } - - const pubkeyLength = - 11 + // 32bit length, 'ssh-rsa' - 4 + ebuf.byteLength + - 4 + nbuf.byteLength; - - const privateKeyLength = - 8 + //64bit unused checksum - 11 + // 32bit length, 'ssh-rsa' - 4 + nbuf.byteLength + - 4 + ebuf.byteLength + - 4 + dbuf.byteLength + - 4 + coeffbuf.byteLength + - 4 + pbuf.byteLength + - 4 + qbuf.byteLength + - 4 + commentbuf.byteLength; - - let length = - 15 + //openssh-key-v1,0x00, - 16 + // 2*(32bit length, 'none') - 4 + // 32bit length, empty string - 4 + // 32bit number of keys - 4 + // 32bit pubkey length - pubkeyLength + - 4 + //32bit private+checksum+comment+padding length - privateKeyLength; - - const paddingLength = Math.ceil(privateKeyLength / 8) * 8 - privateKeyLength; - length += paddingLength; - - const buf = Buffer.alloc(length); - const writer = {buf: buf, off: 0}; - buf.write("openssh-key-v1", "utf8"); - buf.writeUInt8(0, 14); - writer.off += 15; - - writeOpenSSHKeyString(writer, Buffer.from("none")); - writeOpenSSHKeyString(writer, Buffer.from("none")); - writeOpenSSHKeyString(writer, Buffer.from("")); - - writer.off = writer.buf.writeUInt32BE(1, writer.off); - writer.off = writer.buf.writeUInt32BE(pubkeyLength, writer.off); - - writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa")); - writeOpenSSHKeyString(writer, ebuf); - writeOpenSSHKeyString(writer, nbuf); - - writer.off = writer.buf.writeUInt32BE( - length - 47 - pubkeyLength, - writer.off - ); - writer.off += 8; - - writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa")); - writeOpenSSHKeyString(writer, nbuf); - writeOpenSSHKeyString(writer, ebuf); - writeOpenSSHKeyString(writer, dbuf); - writeOpenSSHKeyString(writer, coeffbuf); - writeOpenSSHKeyString(writer, pbuf); - writeOpenSSHKeyString(writer, qbuf); - writeOpenSSHKeyString(writer, commentbuf); - - let pad = 0x01; - while (writer.off < length) { - writer.off = writer.buf.writeUInt8(pad++, writer.off); - } - - if (options.type === "der") { - return writer.buf - } else { - return PRIVATE_OPENING_BOUNDARY + "\n" + utils.linebrk(buf.toString("base64"), 70) + "\n" + PRIVATE_CLOSING_BOUNDARY + "\n"; - } - }, - - privateImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== "der") { - if (Buffer.isBuffer(data)) { - data = data.toString("utf8"); - } - - if (_.isString(data)) { - var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY) - .replace(/\s+|\n\r|\n|\r$/gm, ""); - buffer = Buffer.from(pem, "base64"); - } else { - throw Error("Unsupported key format"); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error("Unsupported key format"); - } - - const reader = {buf: buffer, off: 0}; - - if (buffer.slice(0, 14).toString("ascii") !== "openssh-key-v1") - throw "Invalid file format."; - - reader.off += 15; - - //ciphername - if (readOpenSSHKeyString(reader).toString("ascii") !== "none") - throw Error("Unsupported key type"); - //kdfname - if (readOpenSSHKeyString(reader).toString("ascii") !== "none") - throw Error("Unsupported key type"); - //kdf - if (readOpenSSHKeyString(reader).toString("ascii") !== "") - throw Error("Unsupported key type"); - //keynum - reader.off += 4; - - //sshpublength - reader.off += 4; - - //keytype - if (readOpenSSHKeyString(reader).toString("ascii") !== "ssh-rsa") - throw Error("Unsupported key type"); - readOpenSSHKeyString(reader); - readOpenSSHKeyString(reader); - - reader.off += 12; - if (readOpenSSHKeyString(reader).toString("ascii") !== "ssh-rsa") - throw Error("Unsupported key type"); - - const n = readOpenSSHKeyString(reader); - const e = readOpenSSHKeyString(reader); - const d = readOpenSSHKeyString(reader); - const coeff = readOpenSSHKeyString(reader); - const p = readOpenSSHKeyString(reader); - const q = readOpenSSHKeyString(reader); - - //Calculate missing values - const dint = new BigInteger(d); - const qint = new BigInteger(q); - const pint = new BigInteger(p); - const dp = dint.mod(pint.subtract(BigInteger.ONE)); - const dq = dint.mod(qint.subtract(BigInteger.ONE)); - - key.setPrivate( - n, // modulus - e, // publicExponent - d, // privateExponent - p, // prime1 - q, // prime2 - dp.toBuffer(), // exponent1 -- d mod (p1) - dq.toBuffer(), // exponent2 -- d mod (q-1) - coeff // coefficient -- (inverse of q) mod p - ); - - key.sshcomment = readOpenSSHKeyString(reader).toString("ascii"); - }, - - publicExport: function (key, options) { - let ebuf = Buffer.alloc(4) - ebuf.writeUInt32BE(key.e, 0); - //Slice leading zeroes - while (ebuf[0] === 0) ebuf = ebuf.slice(1); - const nbuf = key.n.toBuffer(); - const buf = Buffer.alloc( - ebuf.byteLength + 4 + - nbuf.byteLength + 4 + - "ssh-rsa".length + 4 - ); - - const writer = {buf: buf, off: 0}; - writeOpenSSHKeyString(writer, Buffer.from("ssh-rsa")); - writeOpenSSHKeyString(writer, ebuf); - writeOpenSSHKeyString(writer, nbuf); - - let comment = key.sshcomment || ""; - - if (options.type === "der") { - return writer.buf - } else { - return "ssh-rsa " + buf.toString("base64") + " " + comment + "\n"; - } - }, - - publicImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== "der") { - if (Buffer.isBuffer(data)) { - data = data.toString("utf8"); - } - - if (_.isString(data)) { - if (data.substring(0, 8) !== "ssh-rsa ") - throw Error("Unsupported key format"); - let pemEnd = data.indexOf(" ", 8); - - //Handle keys with no comment - if (pemEnd === -1) { - pemEnd = data.length; - } else { - key.sshcomment = data.substring(pemEnd + 1) - .replace(/\s+|\n\r|\n|\r$/gm, ""); - } - - const pem = data.substring(8, pemEnd) - .replace(/\s+|\n\r|\n|\r$/gm, ""); - buffer = Buffer.from(pem, "base64"); - } else { - throw Error("Unsupported key format"); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error("Unsupported key format"); - } - - const reader = {buf: buffer, off: 0}; - - const type = readOpenSSHKeyString(reader).toString("ascii"); - - if (type !== "ssh-rsa") - throw Error("Invalid key type: " + type); - - const e = readOpenSSHKeyString(reader); - const n = readOpenSSHKeyString(reader); - - key.setPublic( - n, - e - ); - }, - - /** - * Trying autodetect and import key - * @param key - * @param data - */ - autoImport: function (key, data) { - // [\S\s]* matches zero or more of any character - if (/^[\S\s]*-----BEGIN OPENSSH PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END OPENSSH PRIVATE KEY-----[\S\s]*$/g.test(data)) { - module.exports.privateImport(key, data); - return true; - } - - if (/^[\S\s]*ssh-rsa \s*(?=(([A-Za-z0-9+/=]+\s*)+))\1[\S\s]*$/g.test(data)) { - module.exports.publicImport(key, data); - return true; - } - - return false; - } -}; - -function readOpenSSHKeyString(reader) { - const len = reader.buf.readInt32BE(reader.off); - reader.off += 4; - const res = reader.buf.slice(reader.off, reader.off + len); - reader.off += len; - return res; -} - -function writeOpenSSHKeyString(writer, data) { - writer.buf.writeInt32BE(data.byteLength, writer.off); - writer.off += 4; - writer.off += data.copy(writer.buf, writer.off); -} \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/formats/pkcs1.js b/reverse_engineering/node_modules/node-rsa/src/formats/pkcs1.js deleted file mode 100644 index 5fba246d..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/formats/pkcs1.js +++ /dev/null @@ -1,148 +0,0 @@ -var ber = require('asn1').Ber; -var _ = require('../utils')._; -var utils = require('../utils'); - -const PRIVATE_OPENING_BOUNDARY = '-----BEGIN RSA PRIVATE KEY-----'; -const PRIVATE_CLOSING_BOUNDARY = '-----END RSA PRIVATE KEY-----'; - -const PUBLIC_OPENING_BOUNDARY = '-----BEGIN RSA PUBLIC KEY-----'; -const PUBLIC_CLOSING_BOUNDARY = '-----END RSA PUBLIC KEY-----'; - -module.exports = { - privateExport: function (key, options) { - options = options || {}; - - var n = key.n.toBuffer(); - var d = key.d.toBuffer(); - var p = key.p.toBuffer(); - var q = key.q.toBuffer(); - var dmp1 = key.dmp1.toBuffer(); - var dmq1 = key.dmq1.toBuffer(); - var coeff = key.coeff.toBuffer(); - - var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic - var writer = new ber.Writer({size: length}); - - writer.startSequence(); - writer.writeInt(0); - writer.writeBuffer(n, 2); - writer.writeInt(key.e); - writer.writeBuffer(d, 2); - writer.writeBuffer(p, 2); - writer.writeBuffer(q, 2); - writer.writeBuffer(dmp1, 2); - writer.writeBuffer(dmq1, 2); - writer.writeBuffer(coeff, 2); - writer.endSequence(); - - if (options.type === 'der') { - return writer.buffer; - } else { - return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY; - } - }, - - privateImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== 'der') { - if (Buffer.isBuffer(data)) { - data = data.toString('utf8'); - } - - if (_.isString(data)) { - var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY) - .replace(/\s+|\n\r|\n|\r$/gm, ''); - buffer = Buffer.from(pem, 'base64'); - } else { - throw Error('Unsupported key format'); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error('Unsupported key format'); - } - - var reader = new ber.Reader(buffer); - reader.readSequence(); - reader.readString(2, true); // just zero - key.setPrivate( - reader.readString(2, true), // modulus - reader.readString(2, true), // publicExponent - reader.readString(2, true), // privateExponent - reader.readString(2, true), // prime1 - reader.readString(2, true), // prime2 - reader.readString(2, true), // exponent1 -- d mod (p1) - reader.readString(2, true), // exponent2 -- d mod (q-1) - reader.readString(2, true) // coefficient -- (inverse of q) mod p - ); - }, - - publicExport: function (key, options) { - options = options || {}; - - var n = key.n.toBuffer(); - var length = n.length + 512; // magic - - var bodyWriter = new ber.Writer({size: length}); - bodyWriter.startSequence(); - bodyWriter.writeBuffer(n, 2); - bodyWriter.writeInt(key.e); - bodyWriter.endSequence(); - - if (options.type === 'der') { - return bodyWriter.buffer; - } else { - return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(bodyWriter.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY; - } - }, - - publicImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== 'der') { - if (Buffer.isBuffer(data)) { - data = data.toString('utf8'); - } - - if (_.isString(data)) { - var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY) - .replace(/\s+|\n\r|\n|\r$/gm, ''); - buffer = Buffer.from(pem, 'base64'); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error('Unsupported key format'); - } - - var body = new ber.Reader(buffer); - body.readSequence(); - key.setPublic( - body.readString(0x02, true), // modulus - body.readString(0x02, true) // publicExponent - ); - }, - - /** - * Trying autodetect and import key - * @param key - * @param data - */ - autoImport: function (key, data) { - // [\S\s]* matches zero or more of any character - if (/^[\S\s]*-----BEGIN RSA PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PRIVATE KEY-----[\S\s]*$/g.test(data)) { - module.exports.privateImport(key, data); - return true; - } - - if (/^[\S\s]*-----BEGIN RSA PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END RSA PUBLIC KEY-----[\S\s]*$/g.test(data)) { - module.exports.publicImport(key, data); - return true; - } - - return false; - } -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/formats/pkcs8.js b/reverse_engineering/node_modules/node-rsa/src/formats/pkcs8.js deleted file mode 100644 index 3dd1a3c3..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/formats/pkcs8.js +++ /dev/null @@ -1,187 +0,0 @@ -var ber = require('asn1').Ber; -var _ = require('../utils')._; -var PUBLIC_RSA_OID = '1.2.840.113549.1.1.1'; -var utils = require('../utils'); - -const PRIVATE_OPENING_BOUNDARY = '-----BEGIN PRIVATE KEY-----'; -const PRIVATE_CLOSING_BOUNDARY = '-----END PRIVATE KEY-----'; - -const PUBLIC_OPENING_BOUNDARY = '-----BEGIN PUBLIC KEY-----'; -const PUBLIC_CLOSING_BOUNDARY = '-----END PUBLIC KEY-----'; - -module.exports = { - privateExport: function (key, options) { - options = options || {}; - - var n = key.n.toBuffer(); - var d = key.d.toBuffer(); - var p = key.p.toBuffer(); - var q = key.q.toBuffer(); - var dmp1 = key.dmp1.toBuffer(); - var dmq1 = key.dmq1.toBuffer(); - var coeff = key.coeff.toBuffer(); - - var length = n.length + d.length + p.length + q.length + dmp1.length + dmq1.length + coeff.length + 512; // magic - var bodyWriter = new ber.Writer({size: length}); - - bodyWriter.startSequence(); - bodyWriter.writeInt(0); - bodyWriter.writeBuffer(n, 2); - bodyWriter.writeInt(key.e); - bodyWriter.writeBuffer(d, 2); - bodyWriter.writeBuffer(p, 2); - bodyWriter.writeBuffer(q, 2); - bodyWriter.writeBuffer(dmp1, 2); - bodyWriter.writeBuffer(dmq1, 2); - bodyWriter.writeBuffer(coeff, 2); - bodyWriter.endSequence(); - - var writer = new ber.Writer({size: length}); - writer.startSequence(); - writer.writeInt(0); - writer.startSequence(); - writer.writeOID(PUBLIC_RSA_OID); - writer.writeNull(); - writer.endSequence(); - writer.writeBuffer(bodyWriter.buffer, 4); - writer.endSequence(); - - if (options.type === 'der') { - return writer.buffer; - } else { - return PRIVATE_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PRIVATE_CLOSING_BOUNDARY; - } - }, - - privateImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== 'der') { - if (Buffer.isBuffer(data)) { - data = data.toString('utf8'); - } - - if (_.isString(data)) { - var pem = utils.trimSurroundingText(data, PRIVATE_OPENING_BOUNDARY, PRIVATE_CLOSING_BOUNDARY) - .replace('-----END PRIVATE KEY-----', '') - .replace(/\s+|\n\r|\n|\r$/gm, ''); - buffer = Buffer.from(pem, 'base64'); - } else { - throw Error('Unsupported key format'); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error('Unsupported key format'); - } - - var reader = new ber.Reader(buffer); - reader.readSequence(); - reader.readInt(0); - var header = new ber.Reader(reader.readString(0x30, true)); - - if (header.readOID(0x06, true) !== PUBLIC_RSA_OID) { - throw Error('Invalid Public key format'); - } - - var body = new ber.Reader(reader.readString(0x04, true)); - body.readSequence(); - body.readString(2, true); // just zero - key.setPrivate( - body.readString(2, true), // modulus - body.readString(2, true), // publicExponent - body.readString(2, true), // privateExponent - body.readString(2, true), // prime1 - body.readString(2, true), // prime2 - body.readString(2, true), // exponent1 -- d mod (p1) - body.readString(2, true), // exponent2 -- d mod (q-1) - body.readString(2, true) // coefficient -- (inverse of q) mod p - ); - }, - - publicExport: function (key, options) { - options = options || {}; - - var n = key.n.toBuffer(); - var length = n.length + 512; // magic - - var bodyWriter = new ber.Writer({size: length}); - bodyWriter.writeByte(0); - bodyWriter.startSequence(); - bodyWriter.writeBuffer(n, 2); - bodyWriter.writeInt(key.e); - bodyWriter.endSequence(); - - var writer = new ber.Writer({size: length}); - writer.startSequence(); - writer.startSequence(); - writer.writeOID(PUBLIC_RSA_OID); - writer.writeNull(); - writer.endSequence(); - writer.writeBuffer(bodyWriter.buffer, 3); - writer.endSequence(); - - if (options.type === 'der') { - return writer.buffer; - } else { - return PUBLIC_OPENING_BOUNDARY + '\n' + utils.linebrk(writer.buffer.toString('base64'), 64) + '\n' + PUBLIC_CLOSING_BOUNDARY; - } - }, - - publicImport: function (key, data, options) { - options = options || {}; - var buffer; - - if (options.type !== 'der') { - if (Buffer.isBuffer(data)) { - data = data.toString('utf8'); - } - - if (_.isString(data)) { - var pem = utils.trimSurroundingText(data, PUBLIC_OPENING_BOUNDARY, PUBLIC_CLOSING_BOUNDARY) - .replace(/\s+|\n\r|\n|\r$/gm, ''); - buffer = Buffer.from(pem, 'base64'); - } - } else if (Buffer.isBuffer(data)) { - buffer = data; - } else { - throw Error('Unsupported key format'); - } - - var reader = new ber.Reader(buffer); - reader.readSequence(); - var header = new ber.Reader(reader.readString(0x30, true)); - - if (header.readOID(0x06, true) !== PUBLIC_RSA_OID) { - throw Error('Invalid Public key format'); - } - - var body = new ber.Reader(reader.readString(0x03, true)); - body.readByte(); - body.readSequence(); - key.setPublic( - body.readString(0x02, true), // modulus - body.readString(0x02, true) // publicExponent - ); - }, - - /** - * Trying autodetect and import key - * @param key - * @param data - */ - autoImport: function (key, data) { - if (/^[\S\s]*-----BEGIN PRIVATE KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PRIVATE KEY-----[\S\s]*$/g.test(data)) { - module.exports.privateImport(key, data); - return true; - } - - if (/^[\S\s]*-----BEGIN PUBLIC KEY-----\s*(?=(([A-Za-z0-9+/=]+\s*)+))\1-----END PUBLIC KEY-----[\S\s]*$/g.test(data)) { - module.exports.publicImport(key, data); - return true; - } - - return false; - } -}; diff --git a/reverse_engineering/node_modules/node-rsa/src/libs/jsbn.js b/reverse_engineering/node_modules/node-rsa/src/libs/jsbn.js deleted file mode 100644 index 5464d7ca..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/libs/jsbn.js +++ /dev/null @@ -1,1540 +0,0 @@ -/* - * Basic JavaScript BN library - subset useful for RSA encryption. - * - * Copyright (c) 2003-2005 Tom Wu - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF - * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * In addition, the following condition applies: - * - * All redistributions must retain an intact copy of this copyright notice - * and disclaimer. - */ - -/* - * Added Node.js Buffers support - * 2014 rzcoder - */ - -var crypt = require('crypto'); -var _ = require('../utils')._; - -// Bits per digit -var dbits; - -// JavaScript engine analysis -var canary = 0xdeadbeefcafe; -var j_lm = ((canary & 0xffffff) == 0xefcafe); - -// (public) Constructor -function BigInteger(a, b) { - if (a != null) { - if ("number" == typeof a) { - this.fromNumber(a, b); - } else if (Buffer.isBuffer(a)) { - this.fromBuffer(a); - } else if (b == null && "string" != typeof a) { - this.fromByteArray(a); - } else { - this.fromString(a, b); - } - } -} - -// return new, unset BigInteger -function nbi() { - return new BigInteger(null); -} - -// am: Compute w_j += (x*this_i), propagate carries, -// c is initial carry, returns final carry. -// c < 3*dvalue, x < 2*dvalue, this_i < dvalue -// We need to select the fastest one that works in this environment. - -// am1: use a single mult and divide to get the high bits, -// max digit bits should be 26 because -// max internal value = 2*dvalue^2-2*dvalue (< 2^53) -function am1(i, x, w, j, c, n) { - while (--n >= 0) { - var v = x * this[i++] + w[j] + c; - c = Math.floor(v / 0x4000000); - w[j++] = v & 0x3ffffff; - } - return c; -} -// am2 avoids a big mult-and-extract completely. -// Max digit bits should be <= 30 because we do bitwise ops -// on values up to 2*hdvalue^2-hdvalue-1 (< 2^31) -function am2(i, x, w, j, c, n) { - var xl = x & 0x7fff, xh = x >> 15; - while (--n >= 0) { - var l = this[i] & 0x7fff; - var h = this[i++] >> 15; - var m = xh * l + h * xl; - l = xl * l + ((m & 0x7fff) << 15) + w[j] + (c & 0x3fffffff); - c = (l >>> 30) + (m >>> 15) + xh * h + (c >>> 30); - w[j++] = l & 0x3fffffff; - } - return c; -} -// Alternately, set max digit bits to 28 since some -// browsers slow down when dealing with 32-bit numbers. -function am3(i, x, w, j, c, n) { - var xl = x & 0x3fff, xh = x >> 14; - while (--n >= 0) { - var l = this[i] & 0x3fff; - var h = this[i++] >> 14; - var m = xh * l + h * xl; - l = xl * l + ((m & 0x3fff) << 14) + w[j] + c; - c = (l >> 28) + (m >> 14) + xh * h; - w[j++] = l & 0xfffffff; - } - return c; -} - -// We need to select the fastest one that works in this environment. -//if (j_lm && (navigator.appName == "Microsoft Internet Explorer")) { -// BigInteger.prototype.am = am2; -// dbits = 30; -//} else if (j_lm && (navigator.appName != "Netscape")) { -// BigInteger.prototype.am = am1; -// dbits = 26; -//} else { // Mozilla/Netscape seems to prefer am3 -// BigInteger.prototype.am = am3; -// dbits = 28; -//} - -// For node.js, we pick am3 with max dbits to 28. -BigInteger.prototype.am = am3; -dbits = 28; - -BigInteger.prototype.DB = dbits; -BigInteger.prototype.DM = ((1 << dbits) - 1); -BigInteger.prototype.DV = (1 << dbits); - -var BI_FP = 52; -BigInteger.prototype.FV = Math.pow(2, BI_FP); -BigInteger.prototype.F1 = BI_FP - dbits; -BigInteger.prototype.F2 = 2 * dbits - BI_FP; - -// Digit conversions -var BI_RM = "0123456789abcdefghijklmnopqrstuvwxyz"; -var BI_RC = new Array(); -var rr, vv; -rr = "0".charCodeAt(0); -for (vv = 0; vv <= 9; ++vv) BI_RC[rr++] = vv; -rr = "a".charCodeAt(0); -for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; -rr = "A".charCodeAt(0); -for (vv = 10; vv < 36; ++vv) BI_RC[rr++] = vv; - -function int2char(n) { - return BI_RM.charAt(n); -} -function intAt(s, i) { - var c = BI_RC[s.charCodeAt(i)]; - return (c == null) ? -1 : c; -} - -// (protected) copy this to r -function bnpCopyTo(r) { - for (var i = this.t - 1; i >= 0; --i) r[i] = this[i]; - r.t = this.t; - r.s = this.s; -} - -// (protected) set from integer value x, -DV <= x < DV -function bnpFromInt(x) { - this.t = 1; - this.s = (x < 0) ? -1 : 0; - if (x > 0) this[0] = x; - else if (x < -1) this[0] = x + DV; - else this.t = 0; -} - -// return bigint initialized to value -function nbv(i) { - var r = nbi(); - r.fromInt(i); - return r; -} - -// (protected) set from string and radix -function bnpFromString(data, radix, unsigned) { - var k; - switch (radix) { - case 2: - k = 1; - break; - case 4: - k = 2; - break; - case 8: - k = 3; - break; - case 16: - k = 4; - break; - case 32: - k = 5; - break; - case 256: - k = 8; - break; - default: - this.fromRadix(data, radix); - return; - } - - this.t = 0; - this.s = 0; - - var i = data.length; - var mi = false; - var sh = 0; - - while (--i >= 0) { - var x = (k == 8) ? data[i] & 0xff : intAt(data, i); - if (x < 0) { - if (data.charAt(i) == "-") mi = true; - continue; - } - mi = false; - if (sh === 0) - this[this.t++] = x; - else if (sh + k > this.DB) { - this[this.t - 1] |= (x & ((1 << (this.DB - sh)) - 1)) << sh; - this[this.t++] = (x >> (this.DB - sh)); - } - else - this[this.t - 1] |= x << sh; - sh += k; - if (sh >= this.DB) sh -= this.DB; - } - if ((!unsigned) && k == 8 && (data[0] & 0x80) != 0) { - this.s = -1; - if (sh > 0) this[this.t - 1] |= ((1 << (this.DB - sh)) - 1) << sh; - } - this.clamp(); - if (mi) BigInteger.ZERO.subTo(this, this); -} - -function bnpFromByteArray(a, unsigned) { - this.fromString(a, 256, unsigned) -} - -function bnpFromBuffer(a) { - this.fromString(a, 256, true) -} - -// (protected) clamp off excess high words -function bnpClamp() { - var c = this.s & this.DM; - while (this.t > 0 && this[this.t - 1] == c) --this.t; -} - -// (public) return string representation in given radix -function bnToString(b) { - if (this.s < 0) return "-" + this.negate().toString(b); - var k; - if (b == 16) k = 4; - else if (b == 8) k = 3; - else if (b == 2) k = 1; - else if (b == 32) k = 5; - else if (b == 4) k = 2; - else return this.toRadix(b); - var km = (1 << k) - 1, d, m = false, r = "", i = this.t; - var p = this.DB - (i * this.DB) % k; - if (i-- > 0) { - if (p < this.DB && (d = this[i] >> p) > 0) { - m = true; - r = int2char(d); - } - while (i >= 0) { - if (p < k) { - d = (this[i] & ((1 << p) - 1)) << (k - p); - d |= this[--i] >> (p += this.DB - k); - } - else { - d = (this[i] >> (p -= k)) & km; - if (p <= 0) { - p += this.DB; - --i; - } - } - if (d > 0) m = true; - if (m) r += int2char(d); - } - } - return m ? r : "0"; -} - -// (public) -this -function bnNegate() { - var r = nbi(); - BigInteger.ZERO.subTo(this, r); - return r; -} - -// (public) |this| -function bnAbs() { - return (this.s < 0) ? this.negate() : this; -} - -// (public) return + if this > a, - if this < a, 0 if equal -function bnCompareTo(a) { - var r = this.s - a.s; - if (r != 0) return r; - var i = this.t; - r = i - a.t; - if (r != 0) return (this.s < 0) ? -r : r; - while (--i >= 0) if ((r = this[i] - a[i]) != 0) return r; - return 0; -} - -// returns bit length of the integer x -function nbits(x) { - var r = 1, t; - if ((t = x >>> 16) != 0) { - x = t; - r += 16; - } - if ((t = x >> 8) != 0) { - x = t; - r += 8; - } - if ((t = x >> 4) != 0) { - x = t; - r += 4; - } - if ((t = x >> 2) != 0) { - x = t; - r += 2; - } - if ((t = x >> 1) != 0) { - x = t; - r += 1; - } - return r; -} - -// (public) return the number of bits in "this" -function bnBitLength() { - if (this.t <= 0) return 0; - return this.DB * (this.t - 1) + nbits(this[this.t - 1] ^ (this.s & this.DM)); -} - -// (protected) r = this << n*DB -function bnpDLShiftTo(n, r) { - var i; - for (i = this.t - 1; i >= 0; --i) r[i + n] = this[i]; - for (i = n - 1; i >= 0; --i) r[i] = 0; - r.t = this.t + n; - r.s = this.s; -} - -// (protected) r = this >> n*DB -function bnpDRShiftTo(n, r) { - for (var i = n; i < this.t; ++i) r[i - n] = this[i]; - r.t = Math.max(this.t - n, 0); - r.s = this.s; -} - -// (protected) r = this << n -function bnpLShiftTo(n, r) { - var bs = n % this.DB; - var cbs = this.DB - bs; - var bm = (1 << cbs) - 1; - var ds = Math.floor(n / this.DB), c = (this.s << bs) & this.DM, i; - for (i = this.t - 1; i >= 0; --i) { - r[i + ds + 1] = (this[i] >> cbs) | c; - c = (this[i] & bm) << bs; - } - for (i = ds - 1; i >= 0; --i) r[i] = 0; - r[ds] = c; - r.t = this.t + ds + 1; - r.s = this.s; - r.clamp(); -} - -// (protected) r = this >> n -function bnpRShiftTo(n, r) { - r.s = this.s; - var ds = Math.floor(n / this.DB); - if (ds >= this.t) { - r.t = 0; - return; - } - var bs = n % this.DB; - var cbs = this.DB - bs; - var bm = (1 << bs) - 1; - r[0] = this[ds] >> bs; - for (var i = ds + 1; i < this.t; ++i) { - r[i - ds - 1] |= (this[i] & bm) << cbs; - r[i - ds] = this[i] >> bs; - } - if (bs > 0) r[this.t - ds - 1] |= (this.s & bm) << cbs; - r.t = this.t - ds; - r.clamp(); -} - -// (protected) r = this - a -function bnpSubTo(a, r) { - var i = 0, c = 0, m = Math.min(a.t, this.t); - while (i < m) { - c += this[i] - a[i]; - r[i++] = c & this.DM; - c >>= this.DB; - } - if (a.t < this.t) { - c -= a.s; - while (i < this.t) { - c += this[i]; - r[i++] = c & this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while (i < a.t) { - c -= a[i]; - r[i++] = c & this.DM; - c >>= this.DB; - } - c -= a.s; - } - r.s = (c < 0) ? -1 : 0; - if (c < -1) r[i++] = this.DV + c; - else if (c > 0) r[i++] = c; - r.t = i; - r.clamp(); -} - -// (protected) r = this * a, r != this,a (HAC 14.12) -// "this" should be the larger one if appropriate. -function bnpMultiplyTo(a, r) { - var x = this.abs(), y = a.abs(); - var i = x.t; - r.t = i + y.t; - while (--i >= 0) r[i] = 0; - for (i = 0; i < y.t; ++i) r[i + x.t] = x.am(0, y[i], r, i, 0, x.t); - r.s = 0; - r.clamp(); - if (this.s != a.s) BigInteger.ZERO.subTo(r, r); -} - -// (protected) r = this^2, r != this (HAC 14.16) -function bnpSquareTo(r) { - var x = this.abs(); - var i = r.t = 2 * x.t; - while (--i >= 0) r[i] = 0; - for (i = 0; i < x.t - 1; ++i) { - var c = x.am(i, x[i], r, 2 * i, 0, 1); - if ((r[i + x.t] += x.am(i + 1, 2 * x[i], r, 2 * i + 1, c, x.t - i - 1)) >= x.DV) { - r[i + x.t] -= x.DV; - r[i + x.t + 1] = 1; - } - } - if (r.t > 0) r[r.t - 1] += x.am(i, x[i], r, 2 * i, 0, 1); - r.s = 0; - r.clamp(); -} - -// (protected) divide this by m, quotient and remainder to q, r (HAC 14.20) -// r != q, this != m. q or r may be null. -function bnpDivRemTo(m, q, r) { - var pm = m.abs(); - if (pm.t <= 0) return; - var pt = this.abs(); - if (pt.t < pm.t) { - if (q != null) q.fromInt(0); - if (r != null) this.copyTo(r); - return; - } - if (r == null) r = nbi(); - var y = nbi(), ts = this.s, ms = m.s; - var nsh = this.DB - nbits(pm[pm.t - 1]); // normalize modulus - if (nsh > 0) { - pm.lShiftTo(nsh, y); - pt.lShiftTo(nsh, r); - } - else { - pm.copyTo(y); - pt.copyTo(r); - } - var ys = y.t; - var y0 = y[ys - 1]; - if (y0 === 0) return; - var yt = y0 * (1 << this.F1) + ((ys > 1) ? y[ys - 2] >> this.F2 : 0); - var d1 = this.FV / yt, d2 = (1 << this.F1) / yt, e = 1 << this.F2; - var i = r.t, j = i - ys, t = (q == null) ? nbi() : q; - y.dlShiftTo(j, t); - if (r.compareTo(t) >= 0) { - r[r.t++] = 1; - r.subTo(t, r); - } - BigInteger.ONE.dlShiftTo(ys, t); - t.subTo(y, y); // "negative" y so we can replace sub with am later - while (y.t < ys) y[y.t++] = 0; - while (--j >= 0) { - // Estimate quotient digit - var qd = (r[--i] == y0) ? this.DM : Math.floor(r[i] * d1 + (r[i - 1] + e) * d2); - if ((r[i] += y.am(0, qd, r, j, 0, ys)) < qd) { // Try it out - y.dlShiftTo(j, t); - r.subTo(t, r); - while (r[i] < --qd) r.subTo(t, r); - } - } - if (q != null) { - r.drShiftTo(ys, q); - if (ts != ms) BigInteger.ZERO.subTo(q, q); - } - r.t = ys; - r.clamp(); - if (nsh > 0) r.rShiftTo(nsh, r); // Denormalize remainder - if (ts < 0) BigInteger.ZERO.subTo(r, r); -} - -// (public) this mod a -function bnMod(a) { - var r = nbi(); - this.abs().divRemTo(a, null, r); - if (this.s < 0 && r.compareTo(BigInteger.ZERO) > 0) a.subTo(r, r); - return r; -} - -// Modular reduction using "classic" algorithm -function Classic(m) { - this.m = m; -} -function cConvert(x) { - if (x.s < 0 || x.compareTo(this.m) >= 0) return x.mod(this.m); - else return x; -} -function cRevert(x) { - return x; -} -function cReduce(x) { - x.divRemTo(this.m, null, x); -} -function cMulTo(x, y, r) { - x.multiplyTo(y, r); - this.reduce(r); -} -function cSqrTo(x, r) { - x.squareTo(r); - this.reduce(r); -} - -Classic.prototype.convert = cConvert; -Classic.prototype.revert = cRevert; -Classic.prototype.reduce = cReduce; -Classic.prototype.mulTo = cMulTo; -Classic.prototype.sqrTo = cSqrTo; - -// (protected) return "-1/this % 2^DB"; useful for Mont. reduction -// justification: -// xy == 1 (mod m) -// xy = 1+km -// xy(2-xy) = (1+km)(1-km) -// x[y(2-xy)] = 1-k^2m^2 -// x[y(2-xy)] == 1 (mod m^2) -// if y is 1/x mod m, then y(2-xy) is 1/x mod m^2 -// should reduce x and y(2-xy) by m^2 at each step to keep size bounded. -// JS multiply "overflows" differently from C/C++, so care is needed here. -function bnpInvDigit() { - if (this.t < 1) return 0; - var x = this[0]; - if ((x & 1) === 0) return 0; - var y = x & 3; // y == 1/x mod 2^2 - y = (y * (2 - (x & 0xf) * y)) & 0xf; // y == 1/x mod 2^4 - y = (y * (2 - (x & 0xff) * y)) & 0xff; // y == 1/x mod 2^8 - y = (y * (2 - (((x & 0xffff) * y) & 0xffff))) & 0xffff; // y == 1/x mod 2^16 - // last step - calculate inverse mod DV directly; - // assumes 16 < DB <= 32 and assumes ability to handle 48-bit ints - y = (y * (2 - x * y % this.DV)) % this.DV; // y == 1/x mod 2^dbits - // we really want the negative inverse, and -DV < y < DV - return (y > 0) ? this.DV - y : -y; -} - -// Montgomery reduction -function Montgomery(m) { - this.m = m; - this.mp = m.invDigit(); - this.mpl = this.mp & 0x7fff; - this.mph = this.mp >> 15; - this.um = (1 << (m.DB - 15)) - 1; - this.mt2 = 2 * m.t; -} - -// xR mod m -function montConvert(x) { - var r = nbi(); - x.abs().dlShiftTo(this.m.t, r); - r.divRemTo(this.m, null, r); - if (x.s < 0 && r.compareTo(BigInteger.ZERO) > 0) this.m.subTo(r, r); - return r; -} - -// x/R mod m -function montRevert(x) { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; -} - -// x = x/R mod m (HAC 14.32) -function montReduce(x) { - while (x.t <= this.mt2) // pad x so am has enough room later - x[x.t++] = 0; - for (var i = 0; i < this.m.t; ++i) { - // faster way of calculating u0 = x[i]*mp mod DV - var j = x[i] & 0x7fff; - var u0 = (j * this.mpl + (((j * this.mph + (x[i] >> 15) * this.mpl) & this.um) << 15)) & x.DM; - // use am to combine the multiply-shift-add into one call - j = i + this.m.t; - x[j] += this.m.am(0, u0, x, i, 0, this.m.t); - // propagate carry - while (x[j] >= x.DV) { - x[j] -= x.DV; - x[++j]++; - } - } - x.clamp(); - x.drShiftTo(this.m.t, x); - if (x.compareTo(this.m) >= 0) x.subTo(this.m, x); -} - -// r = "x^2/R mod m"; x != r -function montSqrTo(x, r) { - x.squareTo(r); - this.reduce(r); -} - -// r = "xy/R mod m"; x,y != r -function montMulTo(x, y, r) { - x.multiplyTo(y, r); - this.reduce(r); -} - -Montgomery.prototype.convert = montConvert; -Montgomery.prototype.revert = montRevert; -Montgomery.prototype.reduce = montReduce; -Montgomery.prototype.mulTo = montMulTo; -Montgomery.prototype.sqrTo = montSqrTo; - -// (protected) true iff this is even -function bnpIsEven() { - return ((this.t > 0) ? (this[0] & 1) : this.s) === 0; -} - -// (protected) this^e, e < 2^32, doing sqr and mul with "r" (HAC 14.79) -function bnpExp(e, z) { - if (e > 0xffffffff || e < 1) return BigInteger.ONE; - var r = nbi(), r2 = nbi(), g = z.convert(this), i = nbits(e) - 1; - g.copyTo(r); - while (--i >= 0) { - z.sqrTo(r, r2); - if ((e & (1 << i)) > 0) z.mulTo(r2, g, r); - else { - var t = r; - r = r2; - r2 = t; - } - } - return z.revert(r); -} - -// (public) this^e % m, 0 <= e < 2^32 -function bnModPowInt(e, m) { - var z; - if (e < 256 || m.isEven()) z = new Classic(m); else z = new Montgomery(m); - return this.exp(e, z); -} - -// Copyright (c) 2005-2009 Tom Wu -// All Rights Reserved. -// See "LICENSE" for details. - -// Extended JavaScript BN functions, required for RSA private ops. - -// Version 1.1: new BigInteger("0", 10) returns "proper" zero -// Version 1.2: square() API, isProbablePrime fix - -//(public) -function bnClone() { - var r = nbi(); - this.copyTo(r); - return r; -} - -//(public) return value as integer -function bnIntValue() { - if (this.s < 0) { - if (this.t == 1) return this[0] - this.DV; - else if (this.t === 0) return -1; - } - else if (this.t == 1) return this[0]; - else if (this.t === 0) return 0; -// assumes 16 < DB < 32 - return ((this[1] & ((1 << (32 - this.DB)) - 1)) << this.DB) | this[0]; -} - -//(public) return value as byte -function bnByteValue() { - return (this.t == 0) ? this.s : (this[0] << 24) >> 24; -} - -//(public) return value as short (assumes DB>=16) -function bnShortValue() { - return (this.t == 0) ? this.s : (this[0] << 16) >> 16; -} - -//(protected) return x s.t. r^x < DV -function bnpChunkSize(r) { - return Math.floor(Math.LN2 * this.DB / Math.log(r)); -} - -//(public) 0 if this === 0, 1 if this > 0 -function bnSigNum() { - if (this.s < 0) return -1; - else if (this.t <= 0 || (this.t == 1 && this[0] <= 0)) return 0; - else return 1; -} - -//(protected) convert to radix string -function bnpToRadix(b) { - if (b == null) b = 10; - if (this.signum() === 0 || b < 2 || b > 36) return "0"; - var cs = this.chunkSize(b); - var a = Math.pow(b, cs); - var d = nbv(a), y = nbi(), z = nbi(), r = ""; - this.divRemTo(d, y, z); - while (y.signum() > 0) { - r = (a + z.intValue()).toString(b).substr(1) + r; - y.divRemTo(d, y, z); - } - return z.intValue().toString(b) + r; -} - -//(protected) convert from radix string -function bnpFromRadix(s, b) { - this.fromInt(0); - if (b == null) b = 10; - var cs = this.chunkSize(b); - var d = Math.pow(b, cs), mi = false, j = 0, w = 0; - for (var i = 0; i < s.length; ++i) { - var x = intAt(s, i); - if (x < 0) { - if (s.charAt(i) == "-" && this.signum() === 0) mi = true; - continue; - } - w = b * w + x; - if (++j >= cs) { - this.dMultiply(d); - this.dAddOffset(w, 0); - j = 0; - w = 0; - } - } - if (j > 0) { - this.dMultiply(Math.pow(b, j)); - this.dAddOffset(w, 0); - } - if (mi) BigInteger.ZERO.subTo(this, this); -} - -//(protected) alternate constructor -function bnpFromNumber(a, b) { - if ("number" == typeof b) { - // new BigInteger(int,int,RNG) - if (a < 2) this.fromInt(1); - else { - this.fromNumber(a); - if (!this.testBit(a - 1)) // force MSB set - this.bitwiseTo(BigInteger.ONE.shiftLeft(a - 1), op_or, this); - if (this.isEven()) this.dAddOffset(1, 0); // force odd - while (!this.isProbablePrime(b)) { - this.dAddOffset(2, 0); - if (this.bitLength() > a) this.subTo(BigInteger.ONE.shiftLeft(a - 1), this); - } - } - } else { - // new BigInteger(int,RNG) - var x = crypt.randomBytes((a >> 3) + 1) - var t = a & 7; - - if (t > 0) - x[0] &= ((1 << t) - 1); - else - x[0] = 0; - - this.fromByteArray(x); - } -} - -//(public) convert to bigendian byte array -function bnToByteArray() { - var i = this.t, r = new Array(); - r[0] = this.s; - var p = this.DB - (i * this.DB) % 8, d, k = 0; - if (i-- > 0) { - if (p < this.DB && (d = this[i] >> p) != (this.s & this.DM) >> p) - r[k++] = d | (this.s << (this.DB - p)); - while (i >= 0) { - if (p < 8) { - d = (this[i] & ((1 << p) - 1)) << (8 - p); - d |= this[--i] >> (p += this.DB - 8); - } - else { - d = (this[i] >> (p -= 8)) & 0xff; - if (p <= 0) { - p += this.DB; - --i; - } - } - if ((d & 0x80) != 0) d |= -256; - if (k === 0 && (this.s & 0x80) != (d & 0x80)) ++k; - if (k > 0 || d != this.s) r[k++] = d; - } - } - return r; -} - -/** - * return Buffer object - * @param trim {boolean} slice buffer if first element == 0 - * @returns {Buffer} - */ -function bnToBuffer(trimOrSize) { - var res = Buffer.from(this.toByteArray()); - if (trimOrSize === true && res[0] === 0) { - res = res.slice(1); - } else if (_.isNumber(trimOrSize)) { - if (res.length > trimOrSize) { - for (var i = 0; i < res.length - trimOrSize; i++) { - if (res[i] !== 0) { - return null; - } - } - return res.slice(res.length - trimOrSize); - } else if (res.length < trimOrSize) { - var padded = Buffer.alloc(trimOrSize); - padded.fill(0, 0, trimOrSize - res.length); - res.copy(padded, trimOrSize - res.length); - return padded; - } - } - return res; -} - -function bnEquals(a) { - return (this.compareTo(a) == 0); -} -function bnMin(a) { - return (this.compareTo(a) < 0) ? this : a; -} -function bnMax(a) { - return (this.compareTo(a) > 0) ? this : a; -} - -//(protected) r = this op a (bitwise) -function bnpBitwiseTo(a, op, r) { - var i, f, m = Math.min(a.t, this.t); - for (i = 0; i < m; ++i) r[i] = op(this[i], a[i]); - if (a.t < this.t) { - f = a.s & this.DM; - for (i = m; i < this.t; ++i) r[i] = op(this[i], f); - r.t = this.t; - } - else { - f = this.s & this.DM; - for (i = m; i < a.t; ++i) r[i] = op(f, a[i]); - r.t = a.t; - } - r.s = op(this.s, a.s); - r.clamp(); -} - -//(public) this & a -function op_and(x, y) { - return x & y; -} -function bnAnd(a) { - var r = nbi(); - this.bitwiseTo(a, op_and, r); - return r; -} - -//(public) this | a -function op_or(x, y) { - return x | y; -} -function bnOr(a) { - var r = nbi(); - this.bitwiseTo(a, op_or, r); - return r; -} - -//(public) this ^ a -function op_xor(x, y) { - return x ^ y; -} -function bnXor(a) { - var r = nbi(); - this.bitwiseTo(a, op_xor, r); - return r; -} - -//(public) this & ~a -function op_andnot(x, y) { - return x & ~y; -} -function bnAndNot(a) { - var r = nbi(); - this.bitwiseTo(a, op_andnot, r); - return r; -} - -//(public) ~this -function bnNot() { - var r = nbi(); - for (var i = 0; i < this.t; ++i) r[i] = this.DM & ~this[i]; - r.t = this.t; - r.s = ~this.s; - return r; -} - -//(public) this << n -function bnShiftLeft(n) { - var r = nbi(); - if (n < 0) this.rShiftTo(-n, r); else this.lShiftTo(n, r); - return r; -} - -//(public) this >> n -function bnShiftRight(n) { - var r = nbi(); - if (n < 0) this.lShiftTo(-n, r); else this.rShiftTo(n, r); - return r; -} - -//return index of lowest 1-bit in x, x < 2^31 -function lbit(x) { - if (x === 0) return -1; - var r = 0; - if ((x & 0xffff) === 0) { - x >>= 16; - r += 16; - } - if ((x & 0xff) === 0) { - x >>= 8; - r += 8; - } - if ((x & 0xf) === 0) { - x >>= 4; - r += 4; - } - if ((x & 3) === 0) { - x >>= 2; - r += 2; - } - if ((x & 1) === 0) ++r; - return r; -} - -//(public) returns index of lowest 1-bit (or -1 if none) -function bnGetLowestSetBit() { - for (var i = 0; i < this.t; ++i) - if (this[i] != 0) return i * this.DB + lbit(this[i]); - if (this.s < 0) return this.t * this.DB; - return -1; -} - -//return number of 1 bits in x -function cbit(x) { - var r = 0; - while (x != 0) { - x &= x - 1; - ++r; - } - return r; -} - -//(public) return number of set bits -function bnBitCount() { - var r = 0, x = this.s & this.DM; - for (var i = 0; i < this.t; ++i) r += cbit(this[i] ^ x); - return r; -} - -//(public) true iff nth bit is set -function bnTestBit(n) { - var j = Math.floor(n / this.DB); - if (j >= this.t) return (this.s != 0); - return ((this[j] & (1 << (n % this.DB))) != 0); -} - -//(protected) this op (1<>= this.DB; - } - if (a.t < this.t) { - c += a.s; - while (i < this.t) { - c += this[i]; - r[i++] = c & this.DM; - c >>= this.DB; - } - c += this.s; - } - else { - c += this.s; - while (i < a.t) { - c += a[i]; - r[i++] = c & this.DM; - c >>= this.DB; - } - c += a.s; - } - r.s = (c < 0) ? -1 : 0; - if (c > 0) r[i++] = c; - else if (c < -1) r[i++] = this.DV + c; - r.t = i; - r.clamp(); -} - -//(public) this + a -function bnAdd(a) { - var r = nbi(); - this.addTo(a, r); - return r; -} - -//(public) this - a -function bnSubtract(a) { - var r = nbi(); - this.subTo(a, r); - return r; -} - -//(public) this * a -function bnMultiply(a) { - var r = nbi(); - this.multiplyTo(a, r); - return r; -} - -// (public) this^2 -function bnSquare() { - var r = nbi(); - this.squareTo(r); - return r; -} - -//(public) this / a -function bnDivide(a) { - var r = nbi(); - this.divRemTo(a, r, null); - return r; -} - -//(public) this % a -function bnRemainder(a) { - var r = nbi(); - this.divRemTo(a, null, r); - return r; -} - -//(public) [this/a,this%a] -function bnDivideAndRemainder(a) { - var q = nbi(), r = nbi(); - this.divRemTo(a, q, r); - return new Array(q, r); -} - -//(protected) this *= n, this >= 0, 1 < n < DV -function bnpDMultiply(n) { - this[this.t] = this.am(0, n - 1, this, 0, 0, this.t); - ++this.t; - this.clamp(); -} - -//(protected) this += n << w words, this >= 0 -function bnpDAddOffset(n, w) { - if (n === 0) return; - while (this.t <= w) this[this.t++] = 0; - this[w] += n; - while (this[w] >= this.DV) { - this[w] -= this.DV; - if (++w >= this.t) this[this.t++] = 0; - ++this[w]; - } -} - -//A "null" reducer -function NullExp() { -} -function nNop(x) { - return x; -} -function nMulTo(x, y, r) { - x.multiplyTo(y, r); -} -function nSqrTo(x, r) { - x.squareTo(r); -} - -NullExp.prototype.convert = nNop; -NullExp.prototype.revert = nNop; -NullExp.prototype.mulTo = nMulTo; -NullExp.prototype.sqrTo = nSqrTo; - -//(public) this^e -function bnPow(e) { - return this.exp(e, new NullExp()); -} - -//(protected) r = lower n words of "this * a", a.t <= n -//"this" should be the larger one if appropriate. -function bnpMultiplyLowerTo(a, n, r) { - var i = Math.min(this.t + a.t, n); - r.s = 0; // assumes a,this >= 0 - r.t = i; - while (i > 0) r[--i] = 0; - var j; - for (j = r.t - this.t; i < j; ++i) r[i + this.t] = this.am(0, a[i], r, i, 0, this.t); - for (j = Math.min(a.t, n); i < j; ++i) this.am(0, a[i], r, i, 0, n - i); - r.clamp(); -} - -//(protected) r = "this * a" without lower n words, n > 0 -//"this" should be the larger one if appropriate. -function bnpMultiplyUpperTo(a, n, r) { - --n; - var i = r.t = this.t + a.t - n; - r.s = 0; // assumes a,this >= 0 - while (--i >= 0) r[i] = 0; - for (i = Math.max(n - this.t, 0); i < a.t; ++i) - r[this.t + i - n] = this.am(n - i, a[i], r, 0, 0, this.t + i - n); - r.clamp(); - r.drShiftTo(1, r); -} - -//Barrett modular reduction -function Barrett(m) { -// setup Barrett - this.r2 = nbi(); - this.q3 = nbi(); - BigInteger.ONE.dlShiftTo(2 * m.t, this.r2); - this.mu = this.r2.divide(m); - this.m = m; -} - -function barrettConvert(x) { - if (x.s < 0 || x.t > 2 * this.m.t) return x.mod(this.m); - else if (x.compareTo(this.m) < 0) return x; - else { - var r = nbi(); - x.copyTo(r); - this.reduce(r); - return r; - } -} - -function barrettRevert(x) { - return x; -} - -//x = x mod m (HAC 14.42) -function barrettReduce(x) { - x.drShiftTo(this.m.t - 1, this.r2); - if (x.t > this.m.t + 1) { - x.t = this.m.t + 1; - x.clamp(); - } - this.mu.multiplyUpperTo(this.r2, this.m.t + 1, this.q3); - this.m.multiplyLowerTo(this.q3, this.m.t + 1, this.r2); - while (x.compareTo(this.r2) < 0) x.dAddOffset(1, this.m.t + 1); - x.subTo(this.r2, x); - while (x.compareTo(this.m) >= 0) x.subTo(this.m, x); -} - -//r = x^2 mod m; x != r -function barrettSqrTo(x, r) { - x.squareTo(r); - this.reduce(r); -} - -//r = x*y mod m; x,y != r -function barrettMulTo(x, y, r) { - x.multiplyTo(y, r); - this.reduce(r); -} - -Barrett.prototype.convert = barrettConvert; -Barrett.prototype.revert = barrettRevert; -Barrett.prototype.reduce = barrettReduce; -Barrett.prototype.mulTo = barrettMulTo; -Barrett.prototype.sqrTo = barrettSqrTo; - -//(public) this^e % m (HAC 14.85) -function bnModPow(e, m) { - var i = e.bitLength(), k, r = nbv(1), z; - if (i <= 0) return r; - else if (i < 18) k = 1; - else if (i < 48) k = 3; - else if (i < 144) k = 4; - else if (i < 768) k = 5; - else k = 6; - if (i < 8) - z = new Classic(m); - else if (m.isEven()) - z = new Barrett(m); - else - z = new Montgomery(m); - -// precomputation - var g = new Array(), n = 3, k1 = k - 1, km = (1 << k) - 1; - g[1] = z.convert(this); - if (k > 1) { - var g2 = nbi(); - z.sqrTo(g[1], g2); - while (n <= km) { - g[n] = nbi(); - z.mulTo(g2, g[n - 2], g[n]); - n += 2; - } - } - - var j = e.t - 1, w, is1 = true, r2 = nbi(), t; - i = nbits(e[j]) - 1; - while (j >= 0) { - if (i >= k1) w = (e[j] >> (i - k1)) & km; - else { - w = (e[j] & ((1 << (i + 1)) - 1)) << (k1 - i); - if (j > 0) w |= e[j - 1] >> (this.DB + i - k1); - } - - n = k; - while ((w & 1) === 0) { - w >>= 1; - --n; - } - if ((i -= n) < 0) { - i += this.DB; - --j; - } - if (is1) { // ret == 1, don't bother squaring or multiplying it - g[w].copyTo(r); - is1 = false; - } - else { - while (n > 1) { - z.sqrTo(r, r2); - z.sqrTo(r2, r); - n -= 2; - } - if (n > 0) z.sqrTo(r, r2); else { - t = r; - r = r2; - r2 = t; - } - z.mulTo(r2, g[w], r); - } - - while (j >= 0 && (e[j] & (1 << i)) === 0) { - z.sqrTo(r, r2); - t = r; - r = r2; - r2 = t; - if (--i < 0) { - i = this.DB - 1; - --j; - } - } - } - return z.revert(r); -} - -//(public) gcd(this,a) (HAC 14.54) -function bnGCD(a) { - var x = (this.s < 0) ? this.negate() : this.clone(); - var y = (a.s < 0) ? a.negate() : a.clone(); - if (x.compareTo(y) < 0) { - var t = x; - x = y; - y = t; - } - var i = x.getLowestSetBit(), g = y.getLowestSetBit(); - if (g < 0) return x; - if (i < g) g = i; - if (g > 0) { - x.rShiftTo(g, x); - y.rShiftTo(g, y); - } - while (x.signum() > 0) { - if ((i = x.getLowestSetBit()) > 0) x.rShiftTo(i, x); - if ((i = y.getLowestSetBit()) > 0) y.rShiftTo(i, y); - if (x.compareTo(y) >= 0) { - x.subTo(y, x); - x.rShiftTo(1, x); - } - else { - y.subTo(x, y); - y.rShiftTo(1, y); - } - } - if (g > 0) y.lShiftTo(g, y); - return y; -} - -//(protected) this % n, n < 2^26 -function bnpModInt(n) { - if (n <= 0) return 0; - var d = this.DV % n, r = (this.s < 0) ? n - 1 : 0; - if (this.t > 0) - if (d === 0) r = this[0] % n; - else for (var i = this.t - 1; i >= 0; --i) r = (d * r + this[i]) % n; - return r; -} - -//(public) 1/this % m (HAC 14.61) -function bnModInverse(m) { - var ac = m.isEven(); - if ((this.isEven() && ac) || m.signum() === 0) return BigInteger.ZERO; - var u = m.clone(), v = this.clone(); - var a = nbv(1), b = nbv(0), c = nbv(0), d = nbv(1); - while (u.signum() != 0) { - while (u.isEven()) { - u.rShiftTo(1, u); - if (ac) { - if (!a.isEven() || !b.isEven()) { - a.addTo(this, a); - b.subTo(m, b); - } - a.rShiftTo(1, a); - } - else if (!b.isEven()) b.subTo(m, b); - b.rShiftTo(1, b); - } - while (v.isEven()) { - v.rShiftTo(1, v); - if (ac) { - if (!c.isEven() || !d.isEven()) { - c.addTo(this, c); - d.subTo(m, d); - } - c.rShiftTo(1, c); - } - else if (!d.isEven()) d.subTo(m, d); - d.rShiftTo(1, d); - } - if (u.compareTo(v) >= 0) { - u.subTo(v, u); - if (ac) a.subTo(c, a); - b.subTo(d, b); - } - else { - v.subTo(u, v); - if (ac) c.subTo(a, c); - d.subTo(b, d); - } - } - if (v.compareTo(BigInteger.ONE) != 0) return BigInteger.ZERO; - if (d.compareTo(m) >= 0) return d.subtract(m); - if (d.signum() < 0) d.addTo(m, d); else return d; - if (d.signum() < 0) return d.add(m); else return d; -} - -var lowprimes = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199, 211, 223, 227, 229, 233, 239, 241, 251, 257, 263, 269, 271, 277, 281, 283, 293, 307, 311, 313, 317, 331, 337, 347, 349, 353, 359, 367, 373, 379, 383, 389, 397, 401, 409, 419, 421, 431, 433, 439, 443, 449, 457, 461, 463, 467, 479, 487, 491, 499, 503, 509, 521, 523, 541, 547, 557, 563, 569, 571, 577, 587, 593, 599, 601, 607, 613, 617, 619, 631, 641, 643, 647, 653, 659, 661, 673, 677, 683, 691, 701, 709, 719, 727, 733, 739, 743, 751, 757, 761, 769, 773, 787, 797, 809, 811, 821, 823, 827, 829, 839, 853, 857, 859, 863, 877, 881, 883, 887, 907, 911, 919, 929, 937, 941, 947, 953, 967, 971, 977, 983, 991, 997]; -var lplim = (1 << 26) / lowprimes[lowprimes.length - 1]; - -//(public) test primality with certainty >= 1-.5^t -function bnIsProbablePrime(t) { - var i, x = this.abs(); - if (x.t == 1 && x[0] <= lowprimes[lowprimes.length - 1]) { - for (i = 0; i < lowprimes.length; ++i) - if (x[0] == lowprimes[i]) return true; - return false; - } - if (x.isEven()) return false; - i = 1; - while (i < lowprimes.length) { - var m = lowprimes[i], j = i + 1; - while (j < lowprimes.length && m < lplim) m *= lowprimes[j++]; - m = x.modInt(m); - while (i < j) if (m % lowprimes[i++] === 0) return false; - } - return x.millerRabin(t); -} - -//(protected) true if probably prime (HAC 4.24, Miller-Rabin) -function bnpMillerRabin(t) { - var n1 = this.subtract(BigInteger.ONE); - var k = n1.getLowestSetBit(); - if (k <= 0) return false; - var r = n1.shiftRight(k); - t = (t + 1) >> 1; - if (t > lowprimes.length) t = lowprimes.length; - var a = nbi(); - for (var i = 0; i < t; ++i) { - //Pick bases at random, instead of starting at 2 - a.fromInt(lowprimes[Math.floor(Math.random() * lowprimes.length)]); - var y = a.modPow(r, this); - if (y.compareTo(BigInteger.ONE) != 0 && y.compareTo(n1) != 0) { - var j = 1; - while (j++ < k && y.compareTo(n1) != 0) { - y = y.modPowInt(2, this); - if (y.compareTo(BigInteger.ONE) === 0) return false; - } - if (y.compareTo(n1) != 0) return false; - } - } - return true; -} - -// protected -BigInteger.prototype.copyTo = bnpCopyTo; -BigInteger.prototype.fromInt = bnpFromInt; -BigInteger.prototype.fromString = bnpFromString; -BigInteger.prototype.fromByteArray = bnpFromByteArray; -BigInteger.prototype.fromBuffer = bnpFromBuffer; -BigInteger.prototype.clamp = bnpClamp; -BigInteger.prototype.dlShiftTo = bnpDLShiftTo; -BigInteger.prototype.drShiftTo = bnpDRShiftTo; -BigInteger.prototype.lShiftTo = bnpLShiftTo; -BigInteger.prototype.rShiftTo = bnpRShiftTo; -BigInteger.prototype.subTo = bnpSubTo; -BigInteger.prototype.multiplyTo = bnpMultiplyTo; -BigInteger.prototype.squareTo = bnpSquareTo; -BigInteger.prototype.divRemTo = bnpDivRemTo; -BigInteger.prototype.invDigit = bnpInvDigit; -BigInteger.prototype.isEven = bnpIsEven; -BigInteger.prototype.exp = bnpExp; - -BigInteger.prototype.chunkSize = bnpChunkSize; -BigInteger.prototype.toRadix = bnpToRadix; -BigInteger.prototype.fromRadix = bnpFromRadix; -BigInteger.prototype.fromNumber = bnpFromNumber; -BigInteger.prototype.bitwiseTo = bnpBitwiseTo; -BigInteger.prototype.changeBit = bnpChangeBit; -BigInteger.prototype.addTo = bnpAddTo; -BigInteger.prototype.dMultiply = bnpDMultiply; -BigInteger.prototype.dAddOffset = bnpDAddOffset; -BigInteger.prototype.multiplyLowerTo = bnpMultiplyLowerTo; -BigInteger.prototype.multiplyUpperTo = bnpMultiplyUpperTo; -BigInteger.prototype.modInt = bnpModInt; -BigInteger.prototype.millerRabin = bnpMillerRabin; - - -// public -BigInteger.prototype.toString = bnToString; -BigInteger.prototype.negate = bnNegate; -BigInteger.prototype.abs = bnAbs; -BigInteger.prototype.compareTo = bnCompareTo; -BigInteger.prototype.bitLength = bnBitLength; -BigInteger.prototype.mod = bnMod; -BigInteger.prototype.modPowInt = bnModPowInt; - -BigInteger.prototype.clone = bnClone; -BigInteger.prototype.intValue = bnIntValue; -BigInteger.prototype.byteValue = bnByteValue; -BigInteger.prototype.shortValue = bnShortValue; -BigInteger.prototype.signum = bnSigNum; -BigInteger.prototype.toByteArray = bnToByteArray; -BigInteger.prototype.toBuffer = bnToBuffer; -BigInteger.prototype.equals = bnEquals; -BigInteger.prototype.min = bnMin; -BigInteger.prototype.max = bnMax; -BigInteger.prototype.and = bnAnd; -BigInteger.prototype.or = bnOr; -BigInteger.prototype.xor = bnXor; -BigInteger.prototype.andNot = bnAndNot; -BigInteger.prototype.not = bnNot; -BigInteger.prototype.shiftLeft = bnShiftLeft; -BigInteger.prototype.shiftRight = bnShiftRight; -BigInteger.prototype.getLowestSetBit = bnGetLowestSetBit; -BigInteger.prototype.bitCount = bnBitCount; -BigInteger.prototype.testBit = bnTestBit; -BigInteger.prototype.setBit = bnSetBit; -BigInteger.prototype.clearBit = bnClearBit; -BigInteger.prototype.flipBit = bnFlipBit; -BigInteger.prototype.add = bnAdd; -BigInteger.prototype.subtract = bnSubtract; -BigInteger.prototype.multiply = bnMultiply; -BigInteger.prototype.divide = bnDivide; -BigInteger.prototype.remainder = bnRemainder; -BigInteger.prototype.divideAndRemainder = bnDivideAndRemainder; -BigInteger.prototype.modPow = bnModPow; -BigInteger.prototype.modInverse = bnModInverse; -BigInteger.prototype.pow = bnPow; -BigInteger.prototype.gcd = bnGCD; -BigInteger.prototype.isProbablePrime = bnIsProbablePrime; -BigInteger.int2char = int2char; - -// "constants" -BigInteger.ZERO = nbv(0); -BigInteger.ONE = nbv(1); - -// JSBN-specific extension -BigInteger.prototype.square = bnSquare; - -//BigInteger interfaces not implemented in jsbn: - -//BigInteger(int signum, byte[] magnitude) -//double doubleValue() -//float floatValue() -//int hashCode() -//long longValue() -//static BigInteger valueOf(long val) - -module.exports = BigInteger; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/libs/rsa.js b/reverse_engineering/node_modules/node-rsa/src/libs/rsa.js deleted file mode 100644 index 158f7457..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/libs/rsa.js +++ /dev/null @@ -1,316 +0,0 @@ -/* - * RSA Encryption / Decryption with PKCS1 v2 Padding. - * - * Copyright (c) 2003-2005 Tom Wu - * All Rights Reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND, - * EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY - * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. - * - * IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL, - * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER - * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF - * THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT - * OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - * - * In addition, the following condition applies: - * - * All redistributions must retain an intact copy of this copyright notice - * and disclaimer. - */ - -/* - * Node.js adaptation - * long message support implementation - * signing/verifying - * - * 2014 rzcoder - */ - -var _ = require('../utils')._; -var crypt = require('crypto'); -var BigInteger = require('./jsbn.js'); -var utils = require('../utils.js'); -var schemes = require('../schemes/schemes.js'); -var encryptEngines = require('../encryptEngines/encryptEngines.js'); - -exports.BigInteger = BigInteger; -module.exports.Key = (function () { - /** - * RSA key constructor - * - * n - modulus - * e - publicExponent - * d - privateExponent - * p - prime1 - * q - prime2 - * dmp1 - exponent1 -- d mod (p1) - * dmq1 - exponent2 -- d mod (q-1) - * coeff - coefficient -- (inverse of q) mod p - */ - function RSAKey() { - this.n = null; - this.e = 0; - this.d = null; - this.p = null; - this.q = null; - this.dmp1 = null; - this.dmq1 = null; - this.coeff = null; - } - - RSAKey.prototype.setOptions = function (options) { - var signingSchemeProvider = schemes[options.signingScheme]; - var encryptionSchemeProvider = schemes[options.encryptionScheme]; - - if (signingSchemeProvider === encryptionSchemeProvider) { - this.signingScheme = this.encryptionScheme = encryptionSchemeProvider.makeScheme(this, options); - } else { - this.encryptionScheme = encryptionSchemeProvider.makeScheme(this, options); - this.signingScheme = signingSchemeProvider.makeScheme(this, options); - } - - this.encryptEngine = encryptEngines.getEngine(this, options); - }; - - /** - * Generate a new random private key B bits long, using public expt E - * @param B - * @param E - */ - RSAKey.prototype.generate = function (B, E) { - var qs = B >> 1; - this.e = parseInt(E, 16); - var ee = new BigInteger(E, 16); - while (true) { - while (true) { - this.p = new BigInteger(B - qs, 1); - if (this.p.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) === 0 && this.p.isProbablePrime(10)) - break; - } - while (true) { - this.q = new BigInteger(qs, 1); - if (this.q.subtract(BigInteger.ONE).gcd(ee).compareTo(BigInteger.ONE) === 0 && this.q.isProbablePrime(10)) - break; - } - if (this.p.compareTo(this.q) <= 0) { - var t = this.p; - this.p = this.q; - this.q = t; - } - var p1 = this.p.subtract(BigInteger.ONE); - var q1 = this.q.subtract(BigInteger.ONE); - var phi = p1.multiply(q1); - if (phi.gcd(ee).compareTo(BigInteger.ONE) === 0) { - this.n = this.p.multiply(this.q); - if (this.n.bitLength() < B) { - continue; - } - this.d = ee.modInverse(phi); - this.dmp1 = this.d.mod(p1); - this.dmq1 = this.d.mod(q1); - this.coeff = this.q.modInverse(this.p); - break; - } - } - this.$$recalculateCache(); - }; - - /** - * Set the private key fields N, e, d and CRT params from buffers - * - * @param N - * @param E - * @param D - * @param P - * @param Q - * @param DP - * @param DQ - * @param C - */ - RSAKey.prototype.setPrivate = function (N, E, D, P, Q, DP, DQ, C) { - if (N && E && D && N.length > 0 && (_.isNumber(E) || E.length > 0) && D.length > 0) { - this.n = new BigInteger(N); - this.e = _.isNumber(E) ? E : utils.get32IntFromBuffer(E, 0); - this.d = new BigInteger(D); - - if (P && Q && DP && DQ && C) { - this.p = new BigInteger(P); - this.q = new BigInteger(Q); - this.dmp1 = new BigInteger(DP); - this.dmq1 = new BigInteger(DQ); - this.coeff = new BigInteger(C); - } else { - // TODO: re-calculate any missing CRT params - } - this.$$recalculateCache(); - } else { - throw Error("Invalid RSA private key"); - } - }; - - /** - * Set the public key fields N and e from hex strings - * @param N - * @param E - */ - RSAKey.prototype.setPublic = function (N, E) { - if (N && E && N.length > 0 && (_.isNumber(E) || E.length > 0)) { - this.n = new BigInteger(N); - this.e = _.isNumber(E) ? E : utils.get32IntFromBuffer(E, 0); - this.$$recalculateCache(); - } else { - throw Error("Invalid RSA public key"); - } - }; - - /** - * private - * Perform raw private operation on "x": return x^d (mod n) - * - * @param x - * @returns {*} - */ - RSAKey.prototype.$doPrivate = function (x) { - if (this.p || this.q) { - return x.modPow(this.d, this.n); - } - - // TODO: re-calculate any missing CRT params - var xp = x.mod(this.p).modPow(this.dmp1, this.p); - var xq = x.mod(this.q).modPow(this.dmq1, this.q); - - while (xp.compareTo(xq) < 0) { - xp = xp.add(this.p); - } - return xp.subtract(xq).multiply(this.coeff).mod(this.p).multiply(this.q).add(xq); - }; - - /** - * private - * Perform raw public operation on "x": return x^e (mod n) - * - * @param x - * @returns {*} - */ - RSAKey.prototype.$doPublic = function (x) { - return x.modPowInt(this.e, this.n); - }; - - /** - * Return the PKCS#1 RSA encryption of buffer - * @param buffer {Buffer} - * @returns {Buffer} - */ - RSAKey.prototype.encrypt = function (buffer, usePrivate) { - var buffers = []; - var results = []; - var bufferSize = buffer.length; - var buffersCount = Math.ceil(bufferSize / this.maxMessageLength) || 1; // total buffers count for encrypt - var dividedSize = Math.ceil(bufferSize / buffersCount || 1); // each buffer size - - if (buffersCount == 1) { - buffers.push(buffer); - } else { - for (var bufNum = 0; bufNum < buffersCount; bufNum++) { - buffers.push(buffer.slice(bufNum * dividedSize, (bufNum + 1) * dividedSize)); - } - } - - for (var i = 0; i < buffers.length; i++) { - results.push(this.encryptEngine.encrypt(buffers[i], usePrivate)); - } - - return Buffer.concat(results); - }; - - /** - * Return the PKCS#1 RSA decryption of buffer - * @param buffer {Buffer} - * @returns {Buffer} - */ - RSAKey.prototype.decrypt = function (buffer, usePublic) { - if (buffer.length % this.encryptedDataLength > 0) { - throw Error('Incorrect data or key'); - } - - var result = []; - var offset = 0; - var length = 0; - var buffersCount = buffer.length / this.encryptedDataLength; - - for (var i = 0; i < buffersCount; i++) { - offset = i * this.encryptedDataLength; - length = offset + this.encryptedDataLength; - result.push(this.encryptEngine.decrypt(buffer.slice(offset, Math.min(length, buffer.length)), usePublic)); - } - - return Buffer.concat(result); - }; - - RSAKey.prototype.sign = function (buffer) { - return this.signingScheme.sign.apply(this.signingScheme, arguments); - }; - - RSAKey.prototype.verify = function (buffer, signature, signature_encoding) { - return this.signingScheme.verify.apply(this.signingScheme, arguments); - }; - - /** - * Check if key pair contains private key - */ - RSAKey.prototype.isPrivate = function () { - return this.n && this.e && this.d && true || false; - }; - - /** - * Check if key pair contains public key - * @param strict {boolean} - public key only, return false if have private exponent - */ - RSAKey.prototype.isPublic = function (strict) { - return this.n && this.e && !(strict && this.d) || false; - }; - - Object.defineProperty(RSAKey.prototype, 'keySize', { - get: function () { - return this.cache.keyBitLength; - } - }); - - Object.defineProperty(RSAKey.prototype, 'encryptedDataLength', { - get: function () { - return this.cache.keyByteLength; - } - }); - - Object.defineProperty(RSAKey.prototype, 'maxMessageLength', { - get: function () { - return this.encryptionScheme.maxMessageLength(); - } - }); - - /** - * Caching key data - */ - RSAKey.prototype.$$recalculateCache = function () { - this.cache = this.cache || {}; - // Bit & byte length - this.cache.keyBitLength = this.n.bitLength(); - this.cache.keyByteLength = (this.cache.keyBitLength + 6) >> 3; - }; - - return RSAKey; -})(); - diff --git a/reverse_engineering/node_modules/node-rsa/src/schemes/oaep.js b/reverse_engineering/node_modules/node-rsa/src/schemes/oaep.js deleted file mode 100644 index 30ef0c1e..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/schemes/oaep.js +++ /dev/null @@ -1,179 +0,0 @@ -/** - * PKCS_OAEP signature scheme - */ - -var BigInteger = require('../libs/jsbn'); -var crypt = require('crypto'); - -module.exports = { - isEncryption: true, - isSignature: false -}; - -module.exports.digestLength = { - md4: 16, - md5: 16, - ripemd160: 20, - rmd160: 20, - sha1: 20, - sha224: 28, - sha256: 32, - sha384: 48, - sha512: 64 -}; - -var DEFAULT_HASH_FUNCTION = 'sha1'; - -/* - * OAEP Mask Generation Function 1 - * Generates a buffer full of pseudorandom bytes given seed and maskLength. - * Giving the same seed, maskLength, and hashFunction will result in the same exact byte values in the buffer. - * - * https://tools.ietf.org/html/rfc3447#appendix-B.2.1 - * - * Parameters: - * seed [Buffer] The pseudo random seed for this function - * maskLength [int] The length of the output - * hashFunction [String] The hashing function to use. Will accept any valid crypto hash. Default "sha1" - * Supports "sha1" and "sha256". - * To add another algorythm the algorythem must be accepted by crypto.createHash, and then the length of the output of the hash function (the digest) must be added to the digestLength object below. - * Most RSA implementations will be expecting sha1 - */ -module.exports.eme_oaep_mgf1 = function (seed, maskLength, hashFunction) { - hashFunction = hashFunction || DEFAULT_HASH_FUNCTION; - var hLen = module.exports.digestLength[hashFunction]; - var count = Math.ceil(maskLength / hLen); - var T = Buffer.alloc(hLen * count); - var c = Buffer.alloc(4); - for (var i = 0; i < count; ++i) { - var hash = crypt.createHash(hashFunction); - hash.update(seed); - c.writeUInt32BE(i, 0); - hash.update(c); - hash.digest().copy(T, i * hLen); - } - return T.slice(0, maskLength); -}; - -module.exports.makeScheme = function (key, options) { - function Scheme(key, options) { - this.key = key; - this.options = options; - } - - Scheme.prototype.maxMessageLength = function () { - return this.key.encryptedDataLength - 2 * module.exports.digestLength[this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION] - 2; - }; - - /** - * Pad input - * alg: PKCS1_OAEP - * - * https://tools.ietf.org/html/rfc3447#section-7.1.1 - */ - Scheme.prototype.encPad = function (buffer) { - var hash = this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - var mgf = this.options.encryptionSchemeOptions.mgf || module.exports.eme_oaep_mgf1; - var label = this.options.encryptionSchemeOptions.label || Buffer.alloc(0); - var emLen = this.key.encryptedDataLength; - - var hLen = module.exports.digestLength[hash]; - - // Make sure we can put message into an encoded message of emLen bytes - if (buffer.length > emLen - 2 * hLen - 2) { - throw new Error("Message is too long to encode into an encoded message with a length of " + emLen + " bytes, increase" + - "emLen to fix this error (minimum value for given parameters and options: " + (emLen - 2 * hLen - 2) + ")"); - } - - var lHash = crypt.createHash(hash); - lHash.update(label); - lHash = lHash.digest(); - - var PS = Buffer.alloc(emLen - buffer.length - 2 * hLen - 1); // Padding "String" - PS.fill(0); // Fill the buffer with octets of 0 - PS[PS.length - 1] = 1; - - var DB = Buffer.concat([lHash, PS, buffer]); - var seed = crypt.randomBytes(hLen); - - // mask = dbMask - var mask = mgf(seed, DB.length, hash); - // XOR DB and dbMask together. - for (var i = 0; i < DB.length; i++) { - DB[i] ^= mask[i]; - } - // DB = maskedDB - - // mask = seedMask - mask = mgf(DB, hLen, hash); - // XOR seed and seedMask together. - for (i = 0; i < seed.length; i++) { - seed[i] ^= mask[i]; - } - // seed = maskedSeed - - var em = Buffer.alloc(1 + seed.length + DB.length); - em[0] = 0; - seed.copy(em, 1); - DB.copy(em, 1 + seed.length); - - return em; - }; - - /** - * Unpad input - * alg: PKCS1_OAEP - * - * Note: This method works within the buffer given and modifies the values. It also returns a slice of the EM as the return Message. - * If the implementation requires that the EM parameter be unmodified then the implementation should pass in a clone of the EM buffer. - * - * https://tools.ietf.org/html/rfc3447#section-7.1.2 - */ - Scheme.prototype.encUnPad = function (buffer) { - var hash = this.options.encryptionSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - var mgf = this.options.encryptionSchemeOptions.mgf || module.exports.eme_oaep_mgf1; - var label = this.options.encryptionSchemeOptions.label || Buffer.alloc(0); - - var hLen = module.exports.digestLength[hash]; - - // Check to see if buffer is a properly encoded OAEP message - if (buffer.length < 2 * hLen + 2) { - throw new Error("Error decoding message, the supplied message is not long enough to be a valid OAEP encoded message"); - } - - var seed = buffer.slice(1, hLen + 1); // seed = maskedSeed - var DB = buffer.slice(1 + hLen); // DB = maskedDB - - var mask = mgf(DB, hLen, hash); // seedMask - // XOR maskedSeed and seedMask together to get the original seed. - for (var i = 0; i < seed.length; i++) { - seed[i] ^= mask[i]; - } - - mask = mgf(seed, DB.length, hash); // dbMask - // XOR DB and dbMask together to get the original data block. - for (i = 0; i < DB.length; i++) { - DB[i] ^= mask[i]; - } - - var lHash = crypt.createHash(hash); - lHash.update(label); - lHash = lHash.digest(); - - var lHashEM = DB.slice(0, hLen); - if (lHashEM.toString("hex") != lHash.toString("hex")) { - throw new Error("Error decoding message, the lHash calculated from the label provided and the lHash in the encrypted data do not match."); - } - - // Filter out padding - i = hLen; - while (DB[i++] === 0 && i < DB.length); - if (DB[i - 1] != 1) { - throw new Error("Error decoding message, there is no padding message separator byte"); - } - - return DB.slice(i); // Message - }; - - return new Scheme(key, options); -}; diff --git a/reverse_engineering/node_modules/node-rsa/src/schemes/pkcs1.js b/reverse_engineering/node_modules/node-rsa/src/schemes/pkcs1.js deleted file mode 100644 index 86e55de5..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/schemes/pkcs1.js +++ /dev/null @@ -1,238 +0,0 @@ -/** - * PKCS1 padding and signature scheme - */ - -var BigInteger = require('../libs/jsbn'); -var crypt = require('crypto'); -var constants = require('constants'); -var SIGN_INFO_HEAD = { - md2: Buffer.from('3020300c06082a864886f70d020205000410', 'hex'), - md5: Buffer.from('3020300c06082a864886f70d020505000410', 'hex'), - sha1: Buffer.from('3021300906052b0e03021a05000414', 'hex'), - sha224: Buffer.from('302d300d06096086480165030402040500041c', 'hex'), - sha256: Buffer.from('3031300d060960864801650304020105000420', 'hex'), - sha384: Buffer.from('3041300d060960864801650304020205000430', 'hex'), - sha512: Buffer.from('3051300d060960864801650304020305000440', 'hex'), - ripemd160: Buffer.from('3021300906052b2403020105000414', 'hex'), - rmd160: Buffer.from('3021300906052b2403020105000414', 'hex') -}; - -var SIGN_ALG_TO_HASH_ALIASES = { - 'ripemd160': 'rmd160' -}; - -var DEFAULT_HASH_FUNCTION = 'sha256'; - -module.exports = { - isEncryption: true, - isSignature: true -}; - -module.exports.makeScheme = function (key, options) { - function Scheme(key, options) { - this.key = key; - this.options = options; - } - - Scheme.prototype.maxMessageLength = function () { - if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) { - return this.key.encryptedDataLength; - } - return this.key.encryptedDataLength - 11; - }; - - /** - * Pad input Buffer to encryptedDataLength bytes, and return Buffer.from - * alg: PKCS#1 - * @param buffer - * @returns {Buffer} - */ - Scheme.prototype.encPad = function (buffer, options) { - options = options || {}; - var filled; - if (buffer.length > this.key.maxMessageLength) { - throw new Error("Message too long for RSA (n=" + this.key.encryptedDataLength + ", l=" + buffer.length + ")"); - } - if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) { - //RSA_NO_PADDING treated like JAVA left pad with zero character - filled = Buffer.alloc(this.key.maxMessageLength - buffer.length); - filled.fill(0); - return Buffer.concat([filled, buffer]); - } - - /* Type 1: zeros padding for private key encrypt */ - if (options.type === 1) { - filled = Buffer.alloc(this.key.encryptedDataLength - buffer.length - 1); - filled.fill(0xff, 0, filled.length - 1); - filled[0] = 1; - filled[filled.length - 1] = 0; - - return Buffer.concat([filled, buffer]); - } else { - /* random padding for public key encrypt */ - filled = Buffer.alloc(this.key.encryptedDataLength - buffer.length); - filled[0] = 0; - filled[1] = 2; - var rand = crypt.randomBytes(filled.length - 3); - for (var i = 0; i < rand.length; i++) { - var r = rand[i]; - while (r === 0) { // non-zero only - r = crypt.randomBytes(1)[0]; - } - filled[i + 2] = r; - } - filled[filled.length - 1] = 0; - return Buffer.concat([filled, buffer]); - } - }; - - /** - * Unpad input Buffer and, if valid, return the Buffer object - * alg: PKCS#1 (type 2, random) - * @param buffer - * @returns {Buffer} - */ - Scheme.prototype.encUnPad = function (buffer, options) { - options = options || {}; - var i = 0; - - if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) { - //RSA_NO_PADDING treated like JAVA left pad with zero character - var unPad; - if (typeof buffer.lastIndexOf == "function") { //patch for old node version - unPad = buffer.slice(buffer.lastIndexOf('\0') + 1, buffer.length); - } else { - unPad = buffer.slice(String.prototype.lastIndexOf.call(buffer, '\0') + 1, buffer.length); - } - return unPad; - } - - if (buffer.length < 4) { - return null; - } - - /* Type 1: zeros padding for private key decrypt */ - if (options.type === 1) { - if (buffer[0] !== 0 || buffer[1] !== 1) { - return null; - } - i = 3; - while (buffer[i] !== 0) { - if (buffer[i] != 0xFF || ++i >= buffer.length) { - return null; - } - } - } else { - /* random padding for public key decrypt */ - if (buffer[0] !== 0 || buffer[1] !== 2) { - return null; - } - i = 3; - while (buffer[i] !== 0) { - if (++i >= buffer.length) { - return null; - } - } - } - return buffer.slice(i + 1, buffer.length); - }; - - Scheme.prototype.sign = function (buffer) { - var hashAlgorithm = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - if (this.options.environment === 'browser') { - hashAlgorithm = SIGN_ALG_TO_HASH_ALIASES[hashAlgorithm] || hashAlgorithm; - - var hasher = crypt.createHash(hashAlgorithm); - hasher.update(buffer); - var hash = this.pkcs1pad(hasher.digest(), hashAlgorithm); - var res = this.key.$doPrivate(new BigInteger(hash)).toBuffer(this.key.encryptedDataLength); - - return res; - } else { - var signer = crypt.createSign('RSA-' + hashAlgorithm.toUpperCase()); - signer.update(buffer); - return signer.sign(this.options.rsaUtils.exportKey('private')); - } - }; - - Scheme.prototype.verify = function (buffer, signature, signature_encoding) { - if (this.options.encryptionSchemeOptions && this.options.encryptionSchemeOptions.padding == constants.RSA_NO_PADDING) { - //RSA_NO_PADDING has no verify data - return false; - } - var hashAlgorithm = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - if (this.options.environment === 'browser') { - hashAlgorithm = SIGN_ALG_TO_HASH_ALIASES[hashAlgorithm] || hashAlgorithm; - - if (signature_encoding) { - signature = Buffer.from(signature, signature_encoding); - } - - var hasher = crypt.createHash(hashAlgorithm); - hasher.update(buffer); - var hash = this.pkcs1pad(hasher.digest(), hashAlgorithm); - var m = this.key.$doPublic(new BigInteger(signature)); - - return m.toBuffer().toString('hex') == hash.toString('hex'); - } else { - var verifier = crypt.createVerify('RSA-' + hashAlgorithm.toUpperCase()); - verifier.update(buffer); - return verifier.verify(this.options.rsaUtils.exportKey('public'), signature, signature_encoding); - } - }; - - /** - * PKCS#1 zero pad input buffer to max data length - * @param hashBuf - * @param hashAlgorithm - * @returns {*} - */ - Scheme.prototype.pkcs0pad = function (buffer) { - var filled = Buffer.alloc(this.key.maxMessageLength - buffer.length); - filled.fill(0); - return Buffer.concat([filled, buffer]); - }; - - Scheme.prototype.pkcs0unpad = function (buffer) { - var unPad; - if (typeof buffer.lastIndexOf == "function") { //patch for old node version - unPad = buffer.slice(buffer.lastIndexOf('\0') + 1, buffer.length); - } else { - unPad = buffer.slice(String.prototype.lastIndexOf.call(buffer, '\0') + 1, buffer.length); - } - - return unPad; - }; - - /** - * PKCS#1 pad input buffer to max data length - * @param hashBuf - * @param hashAlgorithm - * @returns {*} - */ - Scheme.prototype.pkcs1pad = function (hashBuf, hashAlgorithm) { - var digest = SIGN_INFO_HEAD[hashAlgorithm]; - if (!digest) { - throw Error('Unsupported hash algorithm'); - } - - var data = Buffer.concat([digest, hashBuf]); - - if (data.length + 10 > this.key.encryptedDataLength) { - throw Error('Key is too short for signing algorithm (' + hashAlgorithm + ')'); - } - - var filled = Buffer.alloc(this.key.encryptedDataLength - data.length - 1); - filled.fill(0xff, 0, filled.length - 1); - filled[0] = 1; - filled[filled.length - 1] = 0; - - var res = Buffer.concat([filled, data]); - - return res; - }; - - return new Scheme(key, options); -}; - - diff --git a/reverse_engineering/node_modules/node-rsa/src/schemes/pss.js b/reverse_engineering/node_modules/node-rsa/src/schemes/pss.js deleted file mode 100644 index d7f3b58c..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/schemes/pss.js +++ /dev/null @@ -1,183 +0,0 @@ -/** - * PSS signature scheme - */ - -var BigInteger = require('../libs/jsbn'); -var crypt = require('crypto'); - -module.exports = { - isEncryption: false, - isSignature: true -}; - -var DEFAULT_HASH_FUNCTION = 'sha1'; -var DEFAULT_SALT_LENGTH = 20; - -module.exports.makeScheme = function (key, options) { - var OAEP = require('./schemes').pkcs1_oaep; - - /** - * @param key - * @param options - * options [Object] An object that contains the following keys that specify certain options for encoding. - * └>signingSchemeOptions - * ├>hash [String] Hash function to use when encoding and generating masks. Must be a string accepted by node's crypto.createHash function. (default = "sha1") - * ├>mgf [function] The mask generation function to use when encoding. (default = mgf1SHA1) - * └>sLen [uint] The length of the salt to generate. (default = 20) - * @constructor - */ - function Scheme(key, options) { - this.key = key; - this.options = options; - } - - Scheme.prototype.sign = function (buffer) { - var mHash = crypt.createHash(this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION); - mHash.update(buffer); - - var encoded = this.emsa_pss_encode(mHash.digest(), this.key.keySize - 1); - return this.key.$doPrivate(new BigInteger(encoded)).toBuffer(this.key.encryptedDataLength); - }; - - Scheme.prototype.verify = function (buffer, signature, signature_encoding) { - if (signature_encoding) { - signature = Buffer.from(signature, signature_encoding); - } - signature = new BigInteger(signature); - - var emLen = Math.ceil((this.key.keySize - 1) / 8); - var m = this.key.$doPublic(signature).toBuffer(emLen); - - var mHash = crypt.createHash(this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION); - mHash.update(buffer); - - return this.emsa_pss_verify(mHash.digest(), m, this.key.keySize - 1); - }; - - /* - * https://tools.ietf.org/html/rfc3447#section-9.1.1 - * - * mHash [Buffer] Hashed message to encode - * emBits [uint] Maximum length of output in bits. Must be at least 8hLen + 8sLen + 9 (hLen = Hash digest length in bytes | sLen = length of salt in bytes) - * @returns {Buffer} The encoded message - */ - Scheme.prototype.emsa_pss_encode = function (mHash, emBits) { - var hash = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - var mgf = this.options.signingSchemeOptions.mgf || OAEP.eme_oaep_mgf1; - var sLen = this.options.signingSchemeOptions.saltLength || DEFAULT_SALT_LENGTH; - - var hLen = OAEP.digestLength[hash]; - var emLen = Math.ceil(emBits / 8); - - if (emLen < hLen + sLen + 2) { - throw new Error("Output length passed to emBits(" + emBits + ") is too small for the options " + - "specified(" + hash + ", " + sLen + "). To fix this issue increase the value of emBits. (minimum size: " + - (8 * hLen + 8 * sLen + 9) + ")" - ); - } - - var salt = crypt.randomBytes(sLen); - - var Mapostrophe = Buffer.alloc(8 + hLen + sLen); - Mapostrophe.fill(0, 0, 8); - mHash.copy(Mapostrophe, 8); - salt.copy(Mapostrophe, 8 + mHash.length); - - var H = crypt.createHash(hash); - H.update(Mapostrophe); - H = H.digest(); - - var PS = Buffer.alloc(emLen - salt.length - hLen - 2); - PS.fill(0); - - var DB = Buffer.alloc(PS.length + 1 + salt.length); - PS.copy(DB); - DB[PS.length] = 0x01; - salt.copy(DB, PS.length + 1); - - var dbMask = mgf(H, DB.length, hash); - - // XOR DB and dbMask together - var maskedDB = Buffer.alloc(DB.length); - for (var i = 0; i < dbMask.length; i++) { - maskedDB[i] = DB[i] ^ dbMask[i]; - } - - var bits = 8 * emLen - emBits; - var mask = 255 ^ (255 >> 8 - bits << 8 - bits); - maskedDB[0] = maskedDB[0] & mask; - - var EM = Buffer.alloc(maskedDB.length + H.length + 1); - maskedDB.copy(EM, 0); - H.copy(EM, maskedDB.length); - EM[EM.length - 1] = 0xbc; - - return EM; - }; - - /* - * https://tools.ietf.org/html/rfc3447#section-9.1.2 - * - * mHash [Buffer] Hashed message - * EM [Buffer] Signature - * emBits [uint] Length of EM in bits. Must be at least 8hLen + 8sLen + 9 to be a valid signature. (hLen = Hash digest length in bytes | sLen = length of salt in bytes) - * @returns {Boolean} True if signature(EM) matches message(M) - */ - Scheme.prototype.emsa_pss_verify = function (mHash, EM, emBits) { - var hash = this.options.signingSchemeOptions.hash || DEFAULT_HASH_FUNCTION; - var mgf = this.options.signingSchemeOptions.mgf || OAEP.eme_oaep_mgf1; - var sLen = this.options.signingSchemeOptions.saltLength || DEFAULT_SALT_LENGTH; - - var hLen = OAEP.digestLength[hash]; - var emLen = Math.ceil(emBits / 8); - - if (emLen < hLen + sLen + 2 || EM[EM.length - 1] != 0xbc) { - return false; - } - - var DB = Buffer.alloc(emLen - hLen - 1); - EM.copy(DB, 0, 0, emLen - hLen - 1); - - var mask = 0; - for (var i = 0, bits = 8 * emLen - emBits; i < bits; i++) { - mask |= 1 << (7 - i); - } - - if ((DB[0] & mask) !== 0) { - return false; - } - - var H = EM.slice(emLen - hLen - 1, emLen - 1); - var dbMask = mgf(H, DB.length, hash); - - // Unmask DB - for (i = 0; i < DB.length; i++) { - DB[i] ^= dbMask[i]; - } - - bits = 8 * emLen - emBits; - mask = 255 ^ (255 >> 8 - bits << 8 - bits); - DB[0] = DB[0] & mask; - - // Filter out padding - for (i = 0; DB[i] === 0 && i < DB.length; i++); - if (DB[i] != 1) { - return false; - } - - var salt = DB.slice(DB.length - sLen); - - var Mapostrophe = Buffer.alloc(8 + hLen + sLen); - Mapostrophe.fill(0, 0, 8); - mHash.copy(Mapostrophe, 8); - salt.copy(Mapostrophe, 8 + mHash.length); - - var Hapostrophe = crypt.createHash(hash); - Hapostrophe.update(Mapostrophe); - Hapostrophe = Hapostrophe.digest(); - - return H.toString("hex") === Hapostrophe.toString("hex"); - }; - - return new Scheme(key, options); -}; diff --git a/reverse_engineering/node_modules/node-rsa/src/schemes/schemes.js b/reverse_engineering/node_modules/node-rsa/src/schemes/schemes.js deleted file mode 100644 index 141827a3..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/schemes/schemes.js +++ /dev/null @@ -1,23 +0,0 @@ -module.exports = { - pkcs1: require('./pkcs1'), - pkcs1_oaep: require('./oaep'), - pss: require('./pss'), - - /** - * Check if scheme has padding methods - * @param scheme {string} - * @returns {Boolean} - */ - isEncryption: function (scheme) { - return module.exports[scheme] && module.exports[scheme].isEncryption; - }, - - /** - * Check if scheme has sign/verify methods - * @param scheme {string} - * @returns {Boolean} - */ - isSignature: function (scheme) { - return module.exports[scheme] && module.exports[scheme].isSignature; - } -}; \ No newline at end of file diff --git a/reverse_engineering/node_modules/node-rsa/src/utils.js b/reverse_engineering/node_modules/node-rsa/src/utils.js deleted file mode 100644 index eac573fd..00000000 --- a/reverse_engineering/node_modules/node-rsa/src/utils.js +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Utils functions - * - */ - -var crypt = require('crypto'); - -/** - * Break string str each maxLen symbols - * @param str - * @param maxLen - * @returns {string} - */ -module.exports.linebrk = function (str, maxLen) { - var res = ''; - var i = 0; - while (i + maxLen < str.length) { - res += str.substring(i, i + maxLen) + "\n"; - i += maxLen; - } - return res + str.substring(i, str.length); -}; - -module.exports.detectEnvironment = function () { - if (typeof(window) !== 'undefined' && window && !(process && process.title === 'node')) { - return 'browser'; - } - - return 'node'; -}; - -/** - * Trying get a 32-bit unsigned integer from the partial buffer - * @param buffer - * @param offset - * @returns {Number} - */ -module.exports.get32IntFromBuffer = function (buffer, offset) { - offset = offset || 0; - var size = 0; - if ((size = buffer.length - offset) > 0) { - if (size >= 4) { - return buffer.readUIntBE(offset, size); - } else { - var res = 0; - for (var i = offset + size, d = 0; i > offset; i--, d += 2) { - res += buffer[i - 1] * Math.pow(16, d); - } - return res; - } - } else { - return NaN; - } -}; - -module.exports._ = { - isObject: function (value) { - var type = typeof value; - return !!value && (type == 'object' || type == 'function'); - }, - - isString: function (value) { - return typeof value == 'string' || value instanceof String; - }, - - isNumber: function (value) { - return typeof value == 'number' || !isNaN(parseFloat(value)) && isFinite(value); - }, - - /** - * Returns copy of `obj` without `removeProp` field. - * @param obj - * @param removeProp - * @returns Object - */ - omit: function (obj, removeProp) { - var newObj = {}; - for (var prop in obj) { - if (!obj.hasOwnProperty(prop) || prop === removeProp) { - continue; - } - newObj[prop] = obj[prop]; - } - - return newObj; - } -}; - -/** - * Strips everything around the opening and closing lines, including the lines - * themselves. - */ -module.exports.trimSurroundingText = function (data, opening, closing) { - var trimStartIndex = 0; - var trimEndIndex = data.length; - - var openingBoundaryIndex = data.indexOf(opening); - if (openingBoundaryIndex >= 0) { - trimStartIndex = openingBoundaryIndex + opening.length; - } - - var closingBoundaryIndex = data.indexOf(closing, openingBoundaryIndex); - if (closingBoundaryIndex >= 0) { - trimEndIndex = closingBoundaryIndex; - } - - return data.substring(trimStartIndex, trimEndIndex); -} \ No newline at end of file diff --git a/reverse_engineering/node_modules/safer-buffer/LICENSE b/reverse_engineering/node_modules/safer-buffer/LICENSE deleted file mode 100644 index 4fe9e6f1..00000000 --- a/reverse_engineering/node_modules/safer-buffer/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Nikita Skovoroda - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/reverse_engineering/node_modules/safer-buffer/Porting-Buffer.md b/reverse_engineering/node_modules/safer-buffer/Porting-Buffer.md deleted file mode 100644 index 68d86bab..00000000 --- a/reverse_engineering/node_modules/safer-buffer/Porting-Buffer.md +++ /dev/null @@ -1,268 +0,0 @@ -# Porting to the Buffer.from/Buffer.alloc API - -
-## Overview - -- [Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x.](#variant-1) (*recommended*) -- [Variant 2: Use a polyfill](#variant-2) -- [Variant 3: manual detection, with safeguards](#variant-3) - -### Finding problematic bits of code using grep - -Just run `grep -nrE '[^a-zA-Z](Slow)?Buffer\s*\(' --exclude-dir node_modules`. - -It will find all the potentially unsafe places in your own code (with some considerably unlikely -exceptions). - -### Finding problematic bits of code using Node.js 8 - -If you’re using Node.js ≥ 8.0.0 (which is recommended), Node.js exposes multiple options that help with finding the relevant pieces of code: - -- `--trace-warnings` will make Node.js show a stack trace for this warning and other warnings that are printed by Node.js. -- `--trace-deprecation` does the same thing, but only for deprecation warnings. -- `--pending-deprecation` will show more types of deprecation warnings. In particular, it will show the `Buffer()` deprecation warning, even on Node.js 8. - -You can set these flags using an environment variable: - -```console -$ export NODE_OPTIONS='--trace-warnings --pending-deprecation' -$ cat example.js -'use strict'; -const foo = new Buffer('foo'); -$ node example.js -(node:7147) [DEP0005] DeprecationWarning: The Buffer() and new Buffer() constructors are not recommended for use due to security and usability concerns. Please use the new Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() construction methods instead. - at showFlaggedDeprecation (buffer.js:127:13) - at new Buffer (buffer.js:148:3) - at Object. (/path/to/example.js:2:13) - [... more stack trace lines ...] -``` - -### Finding problematic bits of code using linters - -Eslint rules [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -also find calls to deprecated `Buffer()` API. Those rules are included in some pre-sets. - -There is a drawback, though, that it doesn't always -[work correctly](https://github.com/chalker/safer-buffer#why-not-safe-buffer) when `Buffer` is -overriden e.g. with a polyfill, so recommended is a combination of this and some other method -described above. - - -## Variant 1: Drop support for Node.js ≤ 4.4.x and 5.0.0 — 5.9.x. - -This is the recommended solution nowadays that would imply only minimal overhead. - -The Node.js 5.x release line has been unsupported since July 2016, and the Node.js 4.x release line reaches its End of Life in April 2018 (→ [Schedule](https://github.com/nodejs/Release#release-schedule)). This means that these versions of Node.js will *not* receive any updates, even in case of security issues, so using these release lines should be avoided, if at all possible. - -What you would do in this case is to convert all `new Buffer()` or `Buffer()` calls to use `Buffer.alloc()` or `Buffer.from()`, in the following way: - -- For `new Buffer(number)`, replace it with `Buffer.alloc(number)`. -- For `new Buffer(string)` (or `new Buffer(string, encoding)`), replace it with `Buffer.from(string)` (or `Buffer.from(string, encoding)`). -- For all other combinations of arguments (these are much rarer), also replace `new Buffer(...arguments)` with `Buffer.from(...arguments)`. - -Note that `Buffer.alloc()` is also _faster_ on the current Node.js versions than -`new Buffer(size).fill(0)`, which is what you would otherwise need to ensure zero-filling. - -Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -is recommended to avoid accidential unsafe Buffer API usage. - -There is also a [JSCodeshift codemod](https://github.com/joyeecheung/node-dep-codemod#dep005) -for automatically migrating Buffer constructors to `Buffer.alloc()` or `Buffer.from()`. -Note that it currently only works with cases where the arguments are literals or where the -constructor is invoked with two arguments. - -_If you currently support those older Node.js versions and dropping them would be a semver-major change -for you, or if you support older branches of your packages, consider using [Variant 2](#variant-2) -or [Variant 3](#variant-3) on older branches, so people using those older branches will also receive -the fix. That way, you will eradicate potential issues caused by unguarded Buffer API usage and -your users will not observe a runtime deprecation warning when running your code on Node.js 10._ - - -## Variant 2: Use a polyfill - -Utilize [safer-buffer](https://www.npmjs.com/package/safer-buffer) as a polyfill to support older -Node.js versions. - -You would take exacly the same steps as in [Variant 1](#variant-1), but with a polyfill -`const Buffer = require('safer-buffer').Buffer` in all files where you use the new `Buffer` api. - -Make sure that you do not use old `new Buffer` API — in any files where the line above is added, -using old `new Buffer()` API will _throw_. It will be easy to notice that in CI, though. - -Alternatively, you could use [buffer-from](https://www.npmjs.com/package/buffer-from) and/or -[buffer-alloc](https://www.npmjs.com/package/buffer-alloc) [ponyfills](https://ponyfill.com/) — -those are great, the only downsides being 4 deps in the tree and slightly more code changes to -migrate off them (as you would be using e.g. `Buffer.from` under a different name). If you need only -`Buffer.from` polyfilled — `buffer-from` alone which comes with no extra dependencies. - -_Alternatively, you could use [safe-buffer](https://www.npmjs.com/package/safe-buffer) — it also -provides a polyfill, but takes a different approach which has -[it's drawbacks](https://github.com/chalker/safer-buffer#why-not-safe-buffer). It will allow you -to also use the older `new Buffer()` API in your code, though — but that's arguably a benefit, as -it is problematic, can cause issues in your code, and will start emitting runtime deprecation -warnings starting with Node.js 10._ - -Note that in either case, it is important that you also remove all calls to the old Buffer -API manually — just throwing in `safe-buffer` doesn't fix the problem by itself, it just provides -a polyfill for the new API. I have seen people doing that mistake. - -Enabling eslint rule [no-buffer-constructor](https://eslint.org/docs/rules/no-buffer-constructor) -or -[node/no-deprecated-api](https://github.com/mysticatea/eslint-plugin-node/blob/master/docs/rules/no-deprecated-api.md) -is recommended. - -_Don't forget to drop the polyfill usage once you drop support for Node.js < 4.5.0._ - - -## Variant 3 — manual detection, with safeguards - -This is useful if you create Buffer instances in only a few places (e.g. one), or you have your own -wrapper around them. - -### Buffer(0) - -This special case for creating empty buffers can be safely replaced with `Buffer.concat([])`, which -returns the same result all the way down to Node.js 0.8.x. - -### Buffer(notNumber) - -Before: - -```js -var buf = new Buffer(notNumber, encoding); -``` - -After: - -```js -var buf; -if (Buffer.from && Buffer.from !== Uint8Array.from) { - buf = Buffer.from(notNumber, encoding); -} else { - if (typeof notNumber === 'number') - throw new Error('The "size" argument must be of type number.'); - buf = new Buffer(notNumber, encoding); -} -``` - -`encoding` is optional. - -Note that the `typeof notNumber` before `new Buffer` is required (for cases when `notNumber` argument is not -hard-coded) and _is not caused by the deprecation of Buffer constructor_ — it's exactly _why_ the -Buffer constructor is deprecated. Ecosystem packages lacking this type-check caused numereous -security issues — situations when unsanitized user input could end up in the `Buffer(arg)` create -problems ranging from DoS to leaking sensitive information to the attacker from the process memory. - -When `notNumber` argument is hardcoded (e.g. literal `"abc"` or `[0,1,2]`), the `typeof` check can -be omitted. - -Also note that using TypeScript does not fix this problem for you — when libs written in -`TypeScript` are used from JS, or when user input ends up there — it behaves exactly as pure JS, as -all type checks are translation-time only and are not present in the actual JS code which TS -compiles to. - -### Buffer(number) - -For Node.js 0.10.x (and below) support: - -```js -var buf; -if (Buffer.alloc) { - buf = Buffer.alloc(number); -} else { - buf = new Buffer(number); - buf.fill(0); -} -``` - -Otherwise (Node.js ≥ 0.12.x): - -```js -const buf = Buffer.alloc ? Buffer.alloc(number) : new Buffer(number).fill(0); -``` - -## Regarding Buffer.allocUnsafe - -Be extra cautious when using `Buffer.allocUnsafe`: - * Don't use it if you don't have a good reason to - * e.g. you probably won't ever see a performance difference for small buffers, in fact, those - might be even faster with `Buffer.alloc()`, - * if your code is not in the hot code path — you also probably won't notice a difference, - * keep in mind that zero-filling minimizes the potential risks. - * If you use it, make sure that you never return the buffer in a partially-filled state, - * if you are writing to it sequentially — always truncate it to the actuall written length - -Errors in handling buffers allocated with `Buffer.allocUnsafe` could result in various issues, -ranged from undefined behaviour of your code to sensitive data (user input, passwords, certs) -leaking to the remote attacker. - -_Note that the same applies to `new Buffer` usage without zero-filling, depending on the Node.js -version (and lacking type checks also adds DoS to the list of potential problems)._ - - -## FAQ - - -### What is wrong with the `Buffer` constructor? - -The `Buffer` constructor could be used to create a buffer in many different ways: - -- `new Buffer(42)` creates a `Buffer` of 42 bytes. Before Node.js 8, this buffer contained - *arbitrary memory* for performance reasons, which could include anything ranging from - program source code to passwords and encryption keys. -- `new Buffer('abc')` creates a `Buffer` that contains the UTF-8-encoded version of - the string `'abc'`. A second argument could specify another encoding: For example, - `new Buffer(string, 'base64')` could be used to convert a Base64 string into the original - sequence of bytes that it represents. -- There are several other combinations of arguments. - -This meant that, in code like `var buffer = new Buffer(foo);`, *it is not possible to tell -what exactly the contents of the generated buffer are* without knowing the type of `foo`. - -Sometimes, the value of `foo` comes from an external source. For example, this function -could be exposed as a service on a web server, converting a UTF-8 string into its Base64 form: - -``` -function stringToBase64(req, res) { - // The request body should have the format of `{ string: 'foobar' }` - const rawBytes = new Buffer(req.body.string) - const encoded = rawBytes.toString('base64') - res.end({ encoded: encoded }) -} -``` - -Note that this code does *not* validate the type of `req.body.string`: - -- `req.body.string` is expected to be a string. If this is the case, all goes well. -- `req.body.string` is controlled by the client that sends the request. -- If `req.body.string` is the *number* `50`, the `rawBytes` would be 50 bytes: - - Before Node.js 8, the content would be uninitialized - - After Node.js 8, the content would be `50` bytes with the value `0` - -Because of the missing type check, an attacker could intentionally send a number -as part of the request. Using this, they can either: - -- Read uninitialized memory. This **will** leak passwords, encryption keys and other - kinds of sensitive information. (Information leak) -- Force the program to allocate a large amount of memory. For example, when specifying - `500000000` as the input value, each request will allocate 500MB of memory. - This can be used to either exhaust the memory available of a program completely - and make it crash, or slow it down significantly. (Denial of Service) - -Both of these scenarios are considered serious security issues in a real-world -web server context. - -when using `Buffer.from(req.body.string)` instead, passing a number will always -throw an exception instead, giving a controlled behaviour that can always be -handled by the program. - - -### The `Buffer()` constructor has been deprecated for a while. Is this really an issue? - -Surveys of code in the `npm` ecosystem have shown that the `Buffer()` constructor is still -widely used. This includes new code, and overall usage of such code has actually been -*increasing*. diff --git a/reverse_engineering/node_modules/safer-buffer/Readme.md b/reverse_engineering/node_modules/safer-buffer/Readme.md deleted file mode 100644 index 14b08229..00000000 --- a/reverse_engineering/node_modules/safer-buffer/Readme.md +++ /dev/null @@ -1,156 +0,0 @@ -# safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url] - -[travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master -[travis-url]: https://travis-ci.org/ChALkeR/safer-buffer -[npm-image]: https://img.shields.io/npm/v/safer-buffer.svg -[npm-url]: https://npmjs.org/package/safer-buffer -[standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg -[standard-url]: https://standardjs.com -[secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg -[secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md - -Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current. - -## How to use? - -First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API. - -Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use -`const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new -Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._ - -Also, see the -[porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide. - -## Do I need it? - -Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that -is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()` -though. - -See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) -for a better description. - -## Why not [safe-buffer](https://npmjs.com/safe-buffer)? - -_In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and -itself contains footguns._ - -`safe-buffer` could be used safely to get the new API while still keeping support for older -Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API -I found out that `safe-buffer` is itself causing problems in some cases. - -For example, consider the following snippet: - -```console -$ cat example.unsafe.js -console.log(Buffer(20)) -$ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js - -$ standard example.unsafe.js -standard: Use JavaScript Standard Style (https://standardjs.com) - /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead. -``` - -This is allocates and writes to console an uninitialized chunk of memory. -[standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people -to avoid using unsafe API. - -Let's now throw in `safe-buffer`! - -```console -$ cat example.safe-buffer.js -const Buffer = require('safe-buffer').Buffer -console.log(Buffer(20)) -$ standard example.safe-buffer.js -$ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js - -``` - -See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior -remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out -chunks of uninitialized memory. -_And this code will still emit runtime warnings on Node.js 10.x and above._ - -That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or -emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some -discussion, it was decided to move my approach into a separate package, and _this is that separate -package_. - -This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing, -«fixing» the lint warning by blindly including `safe-buffer` without any actual changes. - -Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request -can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go -unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even -pass CI. _I also observed that being done in popular packages._ - -Some examples: - * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31) - (a module with 548 759 downloads/month), - * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61) - (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)), - * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c) - (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)), - * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec) - (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)), - * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1) - (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)). - * And there are a lot more over the ecosystem. - -I filed a PR at -[mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to -partially fix that (for cases when that lint rule is used), but it is a semver-major change for -linter rules and presets, so it would take significant time for that to reach actual setups. -_It also hasn't been released yet (2018-03-20)._ - -Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake. -It still supports it with an explicit concern barier, by placing it under -`require('safer-buffer/dangereous')`. - -## But isn't throwing bad? - -Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like -unguarded `new Buffer()` calls that end up receiving user input can do. - -This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so -it is really simple to keep track of things and make sure that you don't mix old API usage with that. -Also, CI should hint anything that you might have missed. - -New commits, if tested, won't land new usage of unsafe Buffer API this way. -_Node.js 10.x also deals with that by printing a runtime depecation warning._ - -### Would it affect third-party modules? - -No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`. -Don't do that. - -### But I don't want throwing… - -That is also fine! - -Also, it could be better in some cases when you don't comprehensive enough test coverage. - -In that case — just don't override `Buffer` and use -`var SaferBuffer = require('safer-buffer').Buffer` instead. - -That way, everything using `Buffer` natively would still work, but there would be two drawbacks: - -* `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and - `SaferBuffer.alloc` instead. -* You are still open to accidentally using the insecure deprecated API — use a linter to catch that. - -Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly -recommended. `Buffer` is not overriden in this usecase, so linters won't get confused. - -## «Without footguns»? - -Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property -on older versions and duping things from there. You shouldn't do that in your code, probabably. - -The intention is to remove the most significant footguns that affect lots of packages in the -ecosystem, and to do it in the proper way. - -Also, this package doesn't protect against security issues affecting some Node.js versions, so for -usage in your own production code, it is still recommended to update to a Node.js version -[supported by upstream](https://github.com/nodejs/release#release-schedule). diff --git a/reverse_engineering/node_modules/safer-buffer/dangerous.js b/reverse_engineering/node_modules/safer-buffer/dangerous.js deleted file mode 100644 index ca41fdc5..00000000 --- a/reverse_engineering/node_modules/safer-buffer/dangerous.js +++ /dev/null @@ -1,58 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var buffer = require('buffer') -var Buffer = buffer.Buffer -var safer = require('./safer.js') -var Safer = safer.Buffer - -var dangerous = {} - -var key - -for (key in safer) { - if (!safer.hasOwnProperty(key)) continue - dangerous[key] = safer[key] -} - -var Dangereous = dangerous.Buffer = {} - -// Copy Safer API -for (key in Safer) { - if (!Safer.hasOwnProperty(key)) continue - Dangereous[key] = Safer[key] -} - -// Copy those missing unsafe methods, if they are present -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (Dangereous.hasOwnProperty(key)) continue - Dangereous[key] = Buffer[key] -} - -if (!Dangereous.allocUnsafe) { - Dangereous.allocUnsafe = function (size) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - return Buffer(size) - } -} - -if (!Dangereous.allocUnsafeSlow) { - Dangereous.allocUnsafeSlow = function (size) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - return buffer.SlowBuffer(size) - } -} - -module.exports = dangerous diff --git a/reverse_engineering/node_modules/safer-buffer/package.json b/reverse_engineering/node_modules/safer-buffer/package.json deleted file mode 100644 index 2e070c83..00000000 --- a/reverse_engineering/node_modules/safer-buffer/package.json +++ /dev/null @@ -1,60 +0,0 @@ -{ - "_from": "safer-buffer@~2.1.0", - "_id": "safer-buffer@2.1.2", - "_inBundle": false, - "_integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "_location": "/safer-buffer", - "_phantomChildren": {}, - "_requested": { - "type": "range", - "registry": true, - "raw": "safer-buffer@~2.1.0", - "name": "safer-buffer", - "escapedName": "safer-buffer", - "rawSpec": "~2.1.0", - "saveSpec": null, - "fetchSpec": "~2.1.0" - }, - "_requiredBy": [ - "/asn1" - ], - "_resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "_shasum": "44fa161b0187b9549dd84bb91802f9bd8385cd6a", - "_spec": "safer-buffer@~2.1.0", - "_where": "/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/asn1", - "author": { - "name": "Nikita Skovoroda", - "email": "chalkerx@gmail.com", - "url": "https://github.com/ChALkeR" - }, - "bugs": { - "url": "https://github.com/ChALkeR/safer-buffer/issues" - }, - "bundleDependencies": false, - "deprecated": false, - "description": "Modern Buffer API polyfill without footguns", - "devDependencies": { - "standard": "^11.0.1", - "tape": "^4.9.0" - }, - "files": [ - "Porting-Buffer.md", - "Readme.md", - "tests.js", - "dangerous.js", - "safer.js" - ], - "homepage": "https://github.com/ChALkeR/safer-buffer#readme", - "license": "MIT", - "main": "safer.js", - "name": "safer-buffer", - "repository": { - "type": "git", - "url": "git+https://github.com/ChALkeR/safer-buffer.git" - }, - "scripts": { - "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js", - "test": "standard && tape tests.js" - }, - "version": "2.1.2" -} diff --git a/reverse_engineering/node_modules/safer-buffer/safer.js b/reverse_engineering/node_modules/safer-buffer/safer.js deleted file mode 100644 index 37c7e1aa..00000000 --- a/reverse_engineering/node_modules/safer-buffer/safer.js +++ /dev/null @@ -1,77 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var buffer = require('buffer') -var Buffer = buffer.Buffer - -var safer = {} - -var key - -for (key in buffer) { - if (!buffer.hasOwnProperty(key)) continue - if (key === 'SlowBuffer' || key === 'Buffer') continue - safer[key] = buffer[key] -} - -var Safer = safer.Buffer = {} -for (key in Buffer) { - if (!Buffer.hasOwnProperty(key)) continue - if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue - Safer[key] = Buffer[key] -} - -safer.Buffer.prototype = Buffer.prototype - -if (!Safer.from || Safer.from === Uint8Array.from) { - Safer.from = function (value, encodingOrOffset, length) { - if (typeof value === 'number') { - throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value) - } - if (value && typeof value.length === 'undefined') { - throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value) - } - return Buffer(value, encodingOrOffset, length) - } -} - -if (!Safer.alloc) { - Safer.alloc = function (size, fill, encoding) { - if (typeof size !== 'number') { - throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size) - } - if (size < 0 || size >= 2 * (1 << 30)) { - throw new RangeError('The value "' + size + '" is invalid for option "size"') - } - var buf = Buffer(size) - if (!fill || fill.length === 0) { - buf.fill(0) - } else if (typeof encoding === 'string') { - buf.fill(fill, encoding) - } else { - buf.fill(fill) - } - return buf - } -} - -if (!safer.kStringMaxLength) { - try { - safer.kStringMaxLength = process.binding('buffer').kStringMaxLength - } catch (e) { - // we can't determine kStringMaxLength in environments where process.binding - // is unsupported, so let's not set it - } -} - -if (!safer.constants) { - safer.constants = { - MAX_LENGTH: safer.kMaxLength - } - if (safer.kStringMaxLength) { - safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength - } -} - -module.exports = safer diff --git a/reverse_engineering/node_modules/safer-buffer/tests.js b/reverse_engineering/node_modules/safer-buffer/tests.js deleted file mode 100644 index 7ed2777c..00000000 --- a/reverse_engineering/node_modules/safer-buffer/tests.js +++ /dev/null @@ -1,406 +0,0 @@ -/* eslint-disable node/no-deprecated-api */ - -'use strict' - -var test = require('tape') - -var buffer = require('buffer') - -var index = require('./') -var safer = require('./safer') -var dangerous = require('./dangerous') - -/* Inheritance tests */ - -test('Default is Safer', function (t) { - t.equal(index, safer) - t.notEqual(safer, dangerous) - t.notEqual(index, dangerous) - t.end() -}) - -test('Is not a function', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(typeof impl, 'object') - t.equal(typeof impl.Buffer, 'object') - }); - [buffer].forEach(function (impl) { - t.equal(typeof impl, 'object') - t.equal(typeof impl.Buffer, 'function') - }) - t.end() -}) - -test('Constructor throws', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.throws(function () { impl.Buffer() }) - t.throws(function () { impl.Buffer(0) }) - t.throws(function () { impl.Buffer('a') }) - t.throws(function () { impl.Buffer('a', 'utf-8') }) - t.throws(function () { return new impl.Buffer() }) - t.throws(function () { return new impl.Buffer(0) }) - t.throws(function () { return new impl.Buffer('a') }) - t.throws(function () { return new impl.Buffer('a', 'utf-8') }) - }) - t.end() -}) - -test('Safe methods exist', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(typeof impl.Buffer.alloc, 'function', 'alloc') - t.equal(typeof impl.Buffer.from, 'function', 'from') - }) - t.end() -}) - -test('Unsafe methods exist only in Dangerous', function (t) { - [index, safer].forEach(function (impl) { - t.equal(typeof impl.Buffer.allocUnsafe, 'undefined') - t.equal(typeof impl.Buffer.allocUnsafeSlow, 'undefined') - }); - [dangerous].forEach(function (impl) { - t.equal(typeof impl.Buffer.allocUnsafe, 'function') - t.equal(typeof impl.Buffer.allocUnsafeSlow, 'function') - }) - t.end() -}) - -test('Generic methods/properties are defined and equal', function (t) { - ['poolSize', 'isBuffer', 'concat', 'byteLength'].forEach(function (method) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], buffer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Built-in buffer static methods/properties are inherited', function (t) { - Object.keys(buffer).forEach(function (method) { - if (method === 'SlowBuffer' || method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], buffer[method], method) - t.notEqual(typeof impl[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Built-in Buffer static methods/properties are inherited', function (t) { - Object.keys(buffer.Buffer).forEach(function (method) { - if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], buffer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('.prototype property of Buffer is inherited', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.prototype, buffer.Buffer.prototype, 'prototype') - t.notEqual(typeof impl.Buffer.prototype, 'undefined', 'prototype') - }) - t.end() -}) - -test('All Safer methods are present in Dangerous', function (t) { - Object.keys(safer).forEach(function (method) { - if (method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], safer[method], method) - if (method !== 'kStringMaxLength') { - t.notEqual(typeof impl[method], 'undefined', method) - } - }) - }) - Object.keys(safer.Buffer).forEach(function (method) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], safer.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -test('Safe methods from Dangerous methods are present in Safer', function (t) { - Object.keys(dangerous).forEach(function (method) { - if (method === 'Buffer') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl[method], dangerous[method], method) - if (method !== 'kStringMaxLength') { - t.notEqual(typeof impl[method], 'undefined', method) - } - }) - }) - Object.keys(dangerous.Buffer).forEach(function (method) { - if (method === 'allocUnsafe' || method === 'allocUnsafeSlow') return; - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer[method], dangerous.Buffer[method], method) - t.notEqual(typeof impl.Buffer[method], 'undefined', method) - }) - }) - t.end() -}) - -/* Behaviour tests */ - -test('Methods return Buffers', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 10))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(0, 'a'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(10, 'x'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.alloc(9, 'ab'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(''))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('string', 'utf-8'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([0, 42, 3]))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from(new Uint8Array([0, 42, 3])))) - t.ok(buffer.Buffer.isBuffer(impl.Buffer.from([]))) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](0))) - t.ok(buffer.Buffer.isBuffer(dangerous.Buffer[method](10))) - }) - t.end() -}) - -test('Constructor is buffer.Buffer', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.alloc(0).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(0, 10).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(0, 'a').constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(10).constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(10, 'x').constructor, buffer.Buffer) - t.equal(impl.Buffer.alloc(9, 'ab').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('string').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('string', 'utf-8').constructor, buffer.Buffer) - t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').constructor, buffer.Buffer) - t.equal(impl.Buffer.from([0, 42, 3]).constructor, buffer.Buffer) - t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).constructor, buffer.Buffer) - t.equal(impl.Buffer.from([]).constructor, buffer.Buffer) - }); - [0, 10, 100].forEach(function (arg) { - t.equal(dangerous.Buffer.allocUnsafe(arg).constructor, buffer.Buffer) - t.equal(dangerous.Buffer.allocUnsafeSlow(arg).constructor, buffer.SlowBuffer(0).constructor) - }) - t.end() -}) - -test('Invalid calls throw', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.throws(function () { impl.Buffer.from(0) }) - t.throws(function () { impl.Buffer.from(10) }) - t.throws(function () { impl.Buffer.from(10, 'utf-8') }) - t.throws(function () { impl.Buffer.from('string', 'invalid encoding') }) - t.throws(function () { impl.Buffer.from(-10) }) - t.throws(function () { impl.Buffer.from(1e90) }) - t.throws(function () { impl.Buffer.from(Infinity) }) - t.throws(function () { impl.Buffer.from(-Infinity) }) - t.throws(function () { impl.Buffer.from(NaN) }) - t.throws(function () { impl.Buffer.from(null) }) - t.throws(function () { impl.Buffer.from(undefined) }) - t.throws(function () { impl.Buffer.from() }) - t.throws(function () { impl.Buffer.from({}) }) - t.throws(function () { impl.Buffer.alloc('') }) - t.throws(function () { impl.Buffer.alloc('string') }) - t.throws(function () { impl.Buffer.alloc('string', 'utf-8') }) - t.throws(function () { impl.Buffer.alloc('b25ldHdvdGhyZWU=', 'base64') }) - t.throws(function () { impl.Buffer.alloc(-10) }) - t.throws(function () { impl.Buffer.alloc(1e90) }) - t.throws(function () { impl.Buffer.alloc(2 * (1 << 30)) }) - t.throws(function () { impl.Buffer.alloc(Infinity) }) - t.throws(function () { impl.Buffer.alloc(-Infinity) }) - t.throws(function () { impl.Buffer.alloc(null) }) - t.throws(function () { impl.Buffer.alloc(undefined) }) - t.throws(function () { impl.Buffer.alloc() }) - t.throws(function () { impl.Buffer.alloc([]) }) - t.throws(function () { impl.Buffer.alloc([0, 42, 3]) }) - t.throws(function () { impl.Buffer.alloc({}) }) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.throws(function () { dangerous.Buffer[method]('') }) - t.throws(function () { dangerous.Buffer[method]('string') }) - t.throws(function () { dangerous.Buffer[method]('string', 'utf-8') }) - t.throws(function () { dangerous.Buffer[method](2 * (1 << 30)) }) - t.throws(function () { dangerous.Buffer[method](Infinity) }) - if (dangerous.Buffer[method] === buffer.Buffer.allocUnsafe) { - t.skip('Skipping, older impl of allocUnsafe coerced negative sizes to 0') - } else { - t.throws(function () { dangerous.Buffer[method](-10) }) - t.throws(function () { dangerous.Buffer[method](-1e90) }) - t.throws(function () { dangerous.Buffer[method](-Infinity) }) - } - t.throws(function () { dangerous.Buffer[method](null) }) - t.throws(function () { dangerous.Buffer[method](undefined) }) - t.throws(function () { dangerous.Buffer[method]() }) - t.throws(function () { dangerous.Buffer[method]([]) }) - t.throws(function () { dangerous.Buffer[method]([0, 42, 3]) }) - t.throws(function () { dangerous.Buffer[method]({}) }) - }) - t.end() -}) - -test('Buffers have appropriate lengths', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.equal(impl.Buffer.alloc(0).length, 0) - t.equal(impl.Buffer.alloc(10).length, 10) - t.equal(impl.Buffer.from('').length, 0) - t.equal(impl.Buffer.from('string').length, 6) - t.equal(impl.Buffer.from('string', 'utf-8').length, 6) - t.equal(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64').length, 11) - t.equal(impl.Buffer.from([0, 42, 3]).length, 3) - t.equal(impl.Buffer.from(new Uint8Array([0, 42, 3])).length, 3) - t.equal(impl.Buffer.from([]).length, 0) - }); - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - t.equal(dangerous.Buffer[method](0).length, 0) - t.equal(dangerous.Buffer[method](10).length, 10) - }) - t.end() -}) - -test('Buffers have appropriate lengths (2)', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true; - [ safer.Buffer.alloc, - dangerous.Buffer.allocUnsafe, - dangerous.Buffer.allocUnsafeSlow - ].forEach(function (method) { - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 1e5) - var buf = method(length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - } - }) - t.ok(ok) - t.end() -}) - -test('.alloc(size) is zero-filled and has correct length', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var buf = index.Buffer.alloc(length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - var j - for (j = 0; j < length; j++) { - if (buf[j] !== 0) ok = false - } - buf.fill(1) - for (j = 0; j < length; j++) { - if (buf[j] !== 1) ok = false - } - } - t.ok(ok) - t.end() -}) - -test('.allocUnsafe / .allocUnsafeSlow are fillable and have correct lengths', function (t) { - ['allocUnsafe', 'allocUnsafeSlow'].forEach(function (method) { - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var buf = dangerous.Buffer[method](length) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - buf.fill(0, 0, length) - var j - for (j = 0; j < length; j++) { - if (buf[j] !== 0) ok = false - } - buf.fill(1, 0, length) - for (j = 0; j < length; j++) { - if (buf[j] !== 1) ok = false - } - } - t.ok(ok, method) - }) - t.end() -}) - -test('.alloc(size, fill) is `fill`-filled', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var fill = Math.round(Math.random() * 255) - var buf = index.Buffer.alloc(length, fill) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - for (var j = 0; j < length; j++) { - if (buf[j] !== fill) ok = false - } - } - t.ok(ok) - t.end() -}) - -test('.alloc(size, fill) is `fill`-filled', function (t) { - t.equal(index.Buffer.alloc, safer.Buffer.alloc) - t.equal(index.Buffer.alloc, dangerous.Buffer.alloc) - var ok = true - for (var i = 0; i < 1e2; i++) { - var length = Math.round(Math.random() * 2e6) - var fill = Math.round(Math.random() * 255) - var buf = index.Buffer.alloc(length, fill) - if (!buffer.Buffer.isBuffer(buf)) ok = false - if (buf.length !== length) ok = false - for (var j = 0; j < length; j++) { - if (buf[j] !== fill) ok = false - } - } - t.ok(ok) - t.deepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 97)) - t.notDeepEqual(index.Buffer.alloc(9, 'a'), index.Buffer.alloc(9, 98)) - - var tmp = new buffer.Buffer(2) - tmp.fill('ok') - if (tmp[1] === tmp[0]) { - // Outdated Node.js - t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('ooooo')) - } else { - t.deepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('okoko')) - } - t.notDeepEqual(index.Buffer.alloc(5, 'ok'), index.Buffer.from('kokok')) - - t.end() -}) - -test('safer.Buffer.from returns results same as Buffer constructor', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.deepEqual(impl.Buffer.from(''), new buffer.Buffer('')) - t.deepEqual(impl.Buffer.from('string'), new buffer.Buffer('string')) - t.deepEqual(impl.Buffer.from('string', 'utf-8'), new buffer.Buffer('string', 'utf-8')) - t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), new buffer.Buffer('b25ldHdvdGhyZWU=', 'base64')) - t.deepEqual(impl.Buffer.from([0, 42, 3]), new buffer.Buffer([0, 42, 3])) - t.deepEqual(impl.Buffer.from(new Uint8Array([0, 42, 3])), new buffer.Buffer(new Uint8Array([0, 42, 3]))) - t.deepEqual(impl.Buffer.from([]), new buffer.Buffer([])) - }) - t.end() -}) - -test('safer.Buffer.from returns consistent results', function (t) { - [index, safer, dangerous].forEach(function (impl) { - t.deepEqual(impl.Buffer.from(''), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from([]), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from(new Uint8Array([])), impl.Buffer.alloc(0)) - t.deepEqual(impl.Buffer.from('string', 'utf-8'), impl.Buffer.from('string')) - t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from([115, 116, 114, 105, 110, 103])) - t.deepEqual(impl.Buffer.from('string'), impl.Buffer.from(impl.Buffer.from('string'))) - t.deepEqual(impl.Buffer.from('b25ldHdvdGhyZWU=', 'base64'), impl.Buffer.from('onetwothree')) - t.notDeepEqual(impl.Buffer.from('b25ldHdvdGhyZWU='), impl.Buffer.from('onetwothree')) - }) - t.end() -}) diff --git a/reverse_engineering/node_modules/ssh2/.eslintignore b/reverse_engineering/node_modules/ssh2/.eslintignore deleted file mode 100644 index 73ed104a..00000000 --- a/reverse_engineering/node_modules/ssh2/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules -lib/protocol/crypto/poly1305.js -.eslint-plugins -!.eslintrc.js diff --git a/reverse_engineering/node_modules/ssh2/.eslintrc.js b/reverse_engineering/node_modules/ssh2/.eslintrc.js deleted file mode 100644 index be9311d0..00000000 --- a/reverse_engineering/node_modules/ssh2/.eslintrc.js +++ /dev/null @@ -1,5 +0,0 @@ -'use strict'; - -module.exports = { - extends: '@mscdex/eslint-config', -}; diff --git a/reverse_engineering/node_modules/ssh2/.github/workflows/ci.yml b/reverse_engineering/node_modules/ssh2/.github/workflows/ci.yml deleted file mode 100644 index c6f610ad..00000000 --- a/reverse_engineering/node_modules/ssh2/.github/workflows/ci.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: CI - -on: - pull_request: - push: - branches: [ master ] - -jobs: - tests-linux: - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - node-version: [10.16.0, 10.x, 12.x, 14.x, 16.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install module - run: npm install - - name: Run tests - run: npm test - tests-windows: - runs-on: windows-latest - strategy: - fail-fast: false - matrix: - node-version: [16.x] - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - name: Install module - run: npm install - - name: Run tests - run: npm test diff --git a/reverse_engineering/node_modules/ssh2/.github/workflows/lint.yml b/reverse_engineering/node_modules/ssh2/.github/workflows/lint.yml deleted file mode 100644 index ec109fde..00000000 --- a/reverse_engineering/node_modules/ssh2/.github/workflows/lint.yml +++ /dev/null @@ -1,23 +0,0 @@ -name: lint - -on: - pull_request: - push: - branches: [ master ] - -env: - NODE_VERSION: 14.x - -jobs: - lint-js: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: Use Node.js ${{ env.NODE_VERSION }} - uses: actions/setup-node@v1 - with: - node-version: ${{ env.NODE_VERSION }} - - name: Install ESLint + ESLint configs/plugins - run: npm install --only=dev - - name: Lint files - run: npm run lint diff --git a/reverse_engineering/node_modules/ssh2/LICENSE b/reverse_engineering/node_modules/ssh2/LICENSE deleted file mode 100644 index 290762e9..00000000 --- a/reverse_engineering/node_modules/ssh2/LICENSE +++ /dev/null @@ -1,19 +0,0 @@ -Copyright Brian White. All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to -deal in the Software without restriction, including without limitation the -rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -sell copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -IN THE SOFTWARE. \ No newline at end of file diff --git a/reverse_engineering/node_modules/ssh2/README.md b/reverse_engineering/node_modules/ssh2/README.md deleted file mode 100644 index e39ec733..00000000 --- a/reverse_engineering/node_modules/ssh2/README.md +++ /dev/null @@ -1,1473 +0,0 @@ -# Description - -SSH2 client and server modules written in pure JavaScript for [node.js](http://nodejs.org/). - -Development/testing is done against OpenSSH (8.7 currently). - -Changes (breaking or otherwise) in v1.0.0 can be found [here](https://github.com/mscdex/ssh2/issues/935). - -# Table of Contents - -* [Requirements](#requirements) -* [Installation](#installation) -* [Client Examples](#client-examples) - * [Execute 'uptime' on a server](#execute-uptime-on-a-server) - * [Start an interactive shell session](#start-an-interactive-shell-session) - * [Send a raw HTTP request to port 80 on the server](#send-a-raw-http-request-to-port-80-on-the-server) - * [Forward local connections to port 8000 on the server to us](#forward-local-connections-to-port-8000-on-the-server-to-us) - * [Get a directory listing via SFTP](#get-a-directory-listing-via-sftp) - * [Connection hopping](#connection-hopping) - * [Forward remote X11 connections](#forward-remote-x11-connections) - * [Dynamic (1:1) port forwarding using a SOCKSv5 proxy (using `socksv5`)](#dynamic-11-port-forwarding-using-a-socksv5-proxy-using-socksv5) - * [Make HTTP(S) connections easily using a custom http(s).Agent](#make-https-connections-easily-using-a-custom-httpsagent) - * [Invoke an arbitrary subsystem (e.g. netconf)](#invoke-an-arbitrary-subsystem) -* [Server Examples](#server-examples) - * [Password and public key authentication and non-interactive (exec) command execution](#password-and-public-key-authentication-and-non-interactive-exec-command-execution) - * [SFTP-only server](#sftp-only-server) -* [API](#api) - * [Client](#client) - * [Client events](#client-events) - * [Client methods](#client-methods) - * [Server](#server) - * [Server events](#server-events) - * [Server methods](#server-methods) - * [Connection events](#connection-events) - * [Connection methods](#connection-methods) - * [Session events](#session-events) - * [Channel](#channel) - * [Pseudo-TTY settings](#pseudo-tty-settings) - * [Terminal modes](#terminal-modes) - * [HTTPAgent](#httpagent) - * [HTTPAgent methods](#httpagent-methods) - * [HTTPSAgent](#httpsagent) - * [HTTPSAgent methods](#httpsagent-methods) - * [Utilities](#utilities) - -## Requirements - -* [node.js](http://nodejs.org/) -- v10.16.0 or newer - * node v12.0.0 or newer for Ed25519 key support -* (Optional) [`cpu-features`](https://github.com/mscdex/cpu-features) is set as an optional package dependency (you do not need to install it explicitly/separately from `ssh2`) that will be automatically built and used if possible. See the project's documentation for its own requirements. - * This addon is currently used to help generate an optimal default cipher list - -## Installation - - npm install ssh2 - -## Client Examples - -### Execute 'uptime' on a server - -```js -const { readFileSync } = require('fs'); - -const { Client } = require('ssh2'); - -const conn = new Client(); -conn.on('ready', () => { - console.log('Client :: ready'); - conn.exec('uptime', (err, stream) => { - if (err) throw err; - stream.on('close', (code, signal) => { - console.log('Stream :: close :: code: ' + code + ', signal: ' + signal); - conn.end(); - }).on('data', (data) => { - console.log('STDOUT: ' + data); - }).stderr.on('data', (data) => { - console.log('STDERR: ' + data); - }); - }); -}).connect({ - host: '192.168.100.100', - port: 22, - username: 'frylock', - privateKey: readFileSync('/path/to/my/key') -}); - -// example output: -// Client :: ready -// STDOUT: 17:41:15 up 22 days, 18:09, 1 user, load average: 0.00, 0.01, 0.05 -// -// Stream :: exit :: code: 0, signal: undefined -// Stream :: close -``` - -### Start an interactive shell session - -```js -const { readFileSync } = require('fs'); - -const { Client } = require('ssh2'); - -const conn = new Client(); -conn.on('ready', () => { - console.log('Client :: ready'); - conn.shell((err, stream) => { - if (err) throw err; - stream.on('close', () => { - console.log('Stream :: close'); - conn.end(); - }).on('data', (data) => { - console.log('OUTPUT: ' + data); - }); - stream.end('ls -l\nexit\n'); - }); -}).connect({ - host: '192.168.100.100', - port: 22, - username: 'frylock', - privateKey: readFileSync('/path/to/my/key') -}); - -// example output: -// Client :: ready -// STDOUT: Last login: Sun Jun 15 09:37:21 2014 from 192.168.100.100 -// -// STDOUT: ls -l -// exit -// -// STDOUT: frylock@athf:~$ ls -l -// -// STDOUT: total 8 -// -// STDOUT: drwxr-xr-x 2 frylock frylock 4096 Nov 18 2012 mydir -// -// STDOUT: -rw-r--r-- 1 frylock frylock 25 Apr 11 2013 test.txt -// -// STDOUT: frylock@athf:~$ exit -// -// STDOUT: logout -// -// Stream :: close -``` - -### Send a raw HTTP request to port 80 on the server - -```js -const { Client } = require('ssh2'); - -const conn = new Client(); -conn.on('ready', () => { - console.log('Client :: ready'); - conn.forwardOut('192.168.100.102', 8000, '127.0.0.1', 80, (err, stream) => { - if (err) throw err; - stream.on('close', () => { - console.log('TCP :: CLOSED'); - conn.end(); - }).on('data', (data) => { - console.log('TCP :: DATA: ' + data); - }).end([ - 'HEAD / HTTP/1.1', - 'User-Agent: curl/7.27.0', - 'Host: 127.0.0.1', - 'Accept: */*', - 'Connection: close', - '', - '' - ].join('\r\n')); - }); -}).connect({ - host: '192.168.100.100', - port: 22, - username: 'frylock', - password: 'nodejsrules' -}); - -// example output: -// Client :: ready -// TCP :: DATA: HTTP/1.1 200 OK -// Date: Thu, 15 Nov 2012 13:52:58 GMT -// Server: Apache/2.2.22 (Ubuntu) -// X-Powered-By: PHP/5.4.6-1ubuntu1 -// Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT -// Content-Encoding: gzip -// Vary: Accept-Encoding -// Connection: close -// Content-Type: text/html; charset=UTF-8 -// -// -// TCP :: CLOSED -``` - -### Forward local connections to port 8000 on the server to us - -```js -const { Client } = require('ssh2'); - -const conn = new Client(); -conn.on('ready', () => { - console.log('Client :: ready'); - conn.forwardIn('127.0.0.1', 8000, (err) => { - if (err) throw err; - console.log('Listening for connections on server on port 8000!'); - }); -}).on('tcp connection', (info, accept, reject) => { - console.log('TCP :: INCOMING CONNECTION:'); - console.dir(info); - accept().on('close', () => { - console.log('TCP :: CLOSED'); - }).on('data', (data) => { - console.log('TCP :: DATA: ' + data); - }).end([ - 'HTTP/1.1 404 Not Found', - 'Date: Thu, 15 Nov 2012 02:07:58 GMT', - 'Server: ForwardedConnection', - 'Content-Length: 0', - 'Connection: close', - '', - '' - ].join('\r\n')); -}).connect({ - host: '192.168.100.100', - port: 22, - username: 'frylock', - password: 'nodejsrules' -}); - -// example output: -// Client :: ready -// Listening for connections on server on port 8000! -// (.... then from another terminal on the server: `curl -I http://127.0.0.1:8000`) -// TCP :: INCOMING CONNECTION: { destIP: '127.0.0.1', -// destPort: 8000, -// srcIP: '127.0.0.1', -// srcPort: 41969 } -// TCP DATA: HEAD / HTTP/1.1 -// User-Agent: curl/7.27.0 -// Host: 127.0.0.1:8000 -// Accept: */* -// -// -// TCP :: CLOSED -``` - -### Get a directory listing via SFTP - -```js -const { Client } = require('ssh2'); - -const conn = new Client(); -conn.on('ready', () => { - console.log('Client :: ready'); - conn.sftp((err, sftp) => { - if (err) throw err; - sftp.readdir('foo', (err, list) => { - if (err) throw err; - console.dir(list); - conn.end(); - }); - }); -}).connect({ - host: '192.168.100.100', - port: 22, - username: 'frylock', - password: 'nodejsrules' -}); - -// example output: -// Client :: ready -// [ { filename: 'test.txt', -// longname: '-rw-r--r-- 1 frylock frylock 12 Nov 18 11:05 test.txt', -// attrs: -// { size: 12, -// uid: 1000, -// gid: 1000, -// mode: 33188, -// atime: 1353254750, -// mtime: 1353254744 } }, -// { filename: 'mydir', -// longname: 'drwxr-xr-x 2 frylock frylock 4096 Nov 18 15:03 mydir', -// attrs: -// { size: 1048576, -// uid: 1000, -// gid: 1000, -// mode: 16877, -// atime: 1353269007, -// mtime: 1353269007 } } ] -``` - -### Connection hopping - -```js -const { Client } = require('ssh2'); - -const conn1 = new Client(); -const conn2 = new Client(); - -// Checks uptime on 10.1.1.40 via 192.168.1.1 - -conn1.on('ready', () => { - console.log('FIRST :: connection ready'); - // Alternatively, you could use something like netcat or socat with exec() - // instead of forwardOut(), depending on what the server allows - conn1.forwardOut('127.0.0.1', 12345, '10.1.1.40', 22, (err, stream) => { - if (err) { - console.log('FIRST :: forwardOut error: ' + err); - return conn1.end(); - } - conn2.connect({ - sock: stream, - username: 'user2', - password: 'password2', - }); - }); -}).connect({ - host: '192.168.1.1', - username: 'user1', - password: 'password1', -}); - -conn2.on('ready', () => { - // This connection is the one to 10.1.1.40 - - console.log('SECOND :: connection ready'); - conn2.exec('uptime', (err, stream) => { - if (err) { - console.log('SECOND :: exec error: ' + err); - return conn1.end(); - } - stream.on('close', () => { - conn1.end(); // close parent (and this) connection - }).on('data', (data) => { - console.log(data.toString()); - }); - }); -}); -``` - -### Forward remote X11 connections - -```js -const { Socket } = require('net'); - -const { Client } = require('ssh2'); - -const conn = new Client(); - -conn.on('x11', (info, accept, reject) => { - const xserversock = new net.Socket(); - xserversock.on('connect', () => { - const xclientsock = accept(); - xclientsock.pipe(xserversock).pipe(xclientsock); - }); - // connects to localhost:0.0 - xserversock.connect(6000, 'localhost'); -}); - -conn.on('ready', () => { - conn.exec('xeyes', { x11: true }, (err, stream) => { - if (err) throw err; - let code = 0; - stream.on('close', () => { - if (code !== 0) - console.log('Do you have X11 forwarding enabled on your SSH server?'); - conn.end(); - }).on('exit', (exitcode) => { - code = exitcode; - }); - }); -}).connect({ - host: '192.168.1.1', - username: 'foo', - password: 'bar' -}); -``` - -### Dynamic (1:1) port forwarding using a SOCKSv5 proxy (using [socksv5](https://github.com/mscdex/socksv5)) - -```js -const socks = require('socksv5'); -const { Client } = require('ssh2'); - -const sshConfig = { - host: '192.168.100.1', - port: 22, - username: 'nodejs', - password: 'rules' -}; - -socks.createServer((info, accept, deny) => { - // NOTE: you could just use one ssh2 client connection for all forwards, but - // you could run into server-imposed limits if you have too many forwards open - // at any given time - const conn = new Client(); - conn.on('ready', () => { - conn.forwardOut(info.srcAddr, - info.srcPort, - info.dstAddr, - info.dstPort, - (err, stream) => { - if (err) { - conn.end(); - return deny(); - } - - const clientSocket = accept(true); - if (clientSocket) { - stream.pipe(clientSocket).pipe(stream).on('close', () => { - conn.end(); - }); - } else { - conn.end(); - } - }); - }).on('error', (err) => { - deny(); - }).connect(sshConfig); -}).listen(1080, 'localhost', () => { - console.log('SOCKSv5 proxy server started on port 1080'); -}).useAuth(socks.auth.None()); - -// test with cURL: -// curl -i --socks5 localhost:1080 google.com -``` - -### Make HTTP(S) connections easily using a custom http(s).Agent - -```js -const http = require('http'); - -const { Client, HTTPAgent, HTTPSAgent } = require('ssh2'); - -const sshConfig = { - host: '192.168.100.1', - port: 22, - username: 'nodejs', - password: 'rules' -}; - -// Use `HTTPSAgent` instead for an HTTPS request -const agent = new HTTPAgent(sshConfig); -http.get({ - host: '192.168.200.1', - agent, - headers: { Connection: 'close' } -}, (res) => { - console.log(res.statusCode); - console.dir(res.headers); - res.resume(); -}); -``` - - -### Invoke an arbitrary subsystem - -```js -const { Client } = require('ssh2'); - -const xmlhello = ` - - - - urn:ietf:params:netconf:base:1.0 - - ]]>]]>`; - -const conn = new Client(); - -conn.on('ready', () => { - console.log('Client :: ready'); - conn.subsys('netconf', (err, stream) => { - if (err) throw err; - stream.on('data', (data) => { - console.log(data); - }).write(xmlhello); - }); -}).connect({ - host: '1.2.3.4', - port: 22, - username: 'blargh', - password: 'honk' -}); -``` - -## Server Examples - -### Password and public key authentication and non-interactive (exec) command execution - -```js -const { timingSafeEqual } = require('crypto'); -const { readFileSync } = require('fs'); -const { inspect } = require('util'); - -const { utils: { parseKey }, Server } = require('ssh2'); - -const allowedUser = Buffer.from('foo'); -const allowedPassword = Buffer.from('bar'); -const allowedPubKey = parseKey(readFileSync('foo.pub')); - -function checkValue(input, allowed) { - const autoReject = (input.length !== allowed.length); - if (autoReject) { - // Prevent leaking length information by always making a comparison with the - // same input when lengths don't match what we expect ... - allowed = input; - } - const isMatch = timingSafeEqual(input, allowed); - return (!autoReject && isMatch); -} - -new Server({ - hostKeys: [readFileSync('host.key')] -}, (client) => { - console.log('Client connected!'); - - client.on('authentication', (ctx) => { - let allowed = true; - if (!checkValue(Buffer.from(ctx.username), allowedUser)) - allowed = false; - - switch (ctx.method) { - case 'password': - if (!checkValue(Buffer.from(ctx.password), allowedPassword)) - return ctx.reject(); - break; - case 'publickey': - if (ctx.key.algo !== allowedPubKey.type - || !checkValue(ctx.key.data, allowedPubKey.getPublicSSH()) - || (ctx.signature && allowedPubKey.verify(ctx.blob, ctx.signature) !== true)) { - return ctx.reject(); - } - break; - default: - return ctx.reject(); - } - - if (allowed) - ctx.accept(); - else - ctx.reject(); - }).on('ready', () => { - console.log('Client authenticated!'); - - client.on('session', (accept, reject) => { - const session = accept(); - session.once('exec', (accept, reject, info) => { - console.log('Client wants to execute: ' + inspect(info.command)); - const stream = accept(); - stream.stderr.write('Oh no, the dreaded errors!\n'); - stream.write('Just kidding about the errors!\n'); - stream.exit(0); - stream.end(); - }); - }); - }).on('close', () => { - console.log('Client disconnected'); - }); -}).listen(0, '127.0.0.1', function() { - console.log('Listening on port ' + this.address().port); -}); -``` - -### SFTP-only server - -```js -const { timingSafeEqual } = require('crypto'); -const { readFileSync } = require('fs'); -const { inspect } = require('util'); - -const { - Server, - sftp: { - OPEN_MODE, - STATUS_CODE, - }, -} = require('ssh2'); - -const allowedUser = Buffer.from('foo'); -const allowedPassword = Buffer.from('bar'); - -function checkValue(input, allowed) { - const autoReject = (input.length !== allowed.length); - if (autoReject) { - // Prevent leaking length information by always making a comparison with the - // same input when lengths don't match what we expect ... - allowed = input; - } - const isMatch = timingSafeEqual(input, allowed); - return (!autoReject && isMatch); -} - -// This simple SFTP server implements file uploading where the contents get -// ignored ... - -new ssh2.Server({ - hostKeys: [readFileSync('host.key')] -}, (client) => { - console.log('Client connected!'); - - client.on('authentication', (ctx) => { - let allowed = true; - if (!checkValue(Buffer.from(ctx.username), allowedUser)) - allowed = false; - - switch (ctx.method) { - case 'password': - if (!checkValue(Buffer.from(ctx.password), allowedPassword)) - return ctx.reject(); - break; - default: - return ctx.reject(); - } - - if (allowed) - ctx.accept(); - else - ctx.reject(); - }).on('ready', () => { - console.log('Client authenticated!'); - - client.on('session', (accept, reject) => { - const session = accept(); - session.on('sftp', (accept, reject) => { - console.log('Client SFTP session'); - const openFiles = new Map(); - let handleCount = 0; - const sftp = accept(); - sftp.on('OPEN', (reqid, filename, flags, attrs) => { - // Only allow opening /tmp/foo.txt for writing - if (filename !== '/tmp/foo.txt' || !(flags & OPEN_MODE.WRITE)) - return sftp.status(reqid, STATUS_CODE.FAILURE); - - // Create a fake handle to return to the client, this could easily - // be a real file descriptor number for example if actually opening - // a file on disk - const handle = Buffer.alloc(4); - openFiles.set(handleCount, true); - handle.writeUInt32BE(handleCount++, 0); - - console.log('Opening file for write') - sftp.handle(reqid, handle); - }).on('WRITE', (reqid, handle, offset, data) => { - if (handle.length !== 4 - || !openFiles.has(handle.readUInt32BE(0))) { - return sftp.status(reqid, STATUS_CODE.FAILURE); - } - - // Fake the write operation - sftp.status(reqid, STATUS_CODE.OK); - - console.log('Write to file at offset ${offset}: ${inspect(data)}'); - }).on('CLOSE', (reqid, handle) => { - let fnum; - if (handle.length !== 4 - || !openFiles.has(fnum = handle.readUInt32BE(0))) { - return sftp.status(reqid, STATUS_CODE.FAILURE); - } - - console.log('Closing file'); - openFiles.delete(fnum); - - sftp.status(reqid, STATUS_CODE.OK); - }); - }); - }); - }).on('close', () => { - console.log('Client disconnected'); - }); -}).listen(0, '127.0.0.1', function() { - console.log('Listening on port ' + this.address().port); -}); -``` - -You can find more examples in the `examples` directory of this repository. - -## API - -`require('ssh2').Client` is the **_Client_** constructor. - -`require('ssh2').Server` is the **_Server_** constructor. - -`require('ssh2').utils` is an object containing some useful [utilities](#utilities). - -`require('ssh2').HTTPAgent` is an [`http.Agent`](https://nodejs.org/docs/latest/api/http.html#http_class_http_agent) constructor. - -`require('ssh2').HTTPSAgent` is an [`https.Agent`](https://nodejs.org/docs/latest/api/https.html#https_class_https_agent) constructor. Its API is the same as `HTTPAgent` except it's for HTTPS connections. - -### Agent-related - -`require('ssh2').AgentProtocol` is a Duplex stream [class](#agentprotocol) that aids in communicating over the OpenSSH agent protocol. - -`require('ssh2').BaseAgent` is a base [class](#baseagent) for creating custom authentication agents. - -`require('ssh2').createAgent` is a helper [function](#createagent) that creates a new agent instance using the same logic as the `agent` configuration option: if the platform is Windows and it's the value "pageant", it creates a `PageantAgent`, otherwise if it's not a path to a Windows pipe it creates a `CygwinAgent`. In all other cases, it creates an `OpenSSHAgent`. - -`require('ssh2').CygwinAgent` is an agent [class](#cygwinagent) implementation that communicates with agents in a Cygwin environment. - -`require('ssh2').OpenSSHAgent` is an agent [class](#opensshagent) implementation that communicates with OpenSSH agents over a UNIX socket. - -`require('ssh2').PageantAgent` is an agent [class](#pageantagent) implementation that communicates with Pageant agent processes. - -### Client - -#### Client events - -* **banner**(< _string_ >message, < _string_ >language) - A notice was sent by the server upon connection. - -* **change password**(< _string_ >prompt, < _function_ >done) - If using password-based user authentication, the server has requested that the user's password be changed. Call `done` with the new password. - -* **close**() - The socket was closed. - -* **end**() - The socket was disconnected. - -* **error**(< _Error_ >err) - An error occurred. A 'level' property indicates 'client-socket' for socket-level errors and 'client-ssh' for SSH disconnection messages. In the case of 'client-ssh' messages, there may be a 'description' property that provides more detail. - -* **handshake**(< _object_ >negotiated) - Emitted when a handshake has completed (either initial or rekey). `negotiated` contains the negotiated details of the handshake and is of the form: - -```js - // In this particular case `mac` is empty because there is no separate MAC - // because it's integrated into AES in GCM mode - { kex: 'ecdh-sha2-nistp256', - srvHostKey: 'rsa-sha2-512', - cs: { // Client to server algorithms - cipher: 'aes128-gcm', - mac: '', - compress: 'none', - lang: '' - }, - sc: { // Server to client algorithms - cipher: 'aes128-gcm', - mac: '', - compress: 'none', - lang: '' - } - } -``` - -* **hostkeys**(< _array_ >keys) - Emitted when the server announces its available host keys. `keys` is the list of parsed (using [`parseKey()`](#utilities)) host public keys. - -* **keyboard-interactive**(< _string_ >name, < _string_ >instructions, < _string_ >instructionsLang, < _array_ >prompts, < _function_ >finish) - The server is asking for replies to the given `prompts` for keyboard-interactive user authentication. `name` is generally what you'd use as a window title (for GUI apps). `prompts` is an array of `{ prompt: 'Password: ', echo: false }` style objects (here `echo` indicates whether user input should be displayed on the screen). The answers for all prompts must be provided as an array of strings and passed to `finish` when you are ready to continue. Note: It's possible for the server to come back and ask more questions. - -* **ready**() - Authentication was successful. - -* **rekey**() - Emitted when a rekeying operation has completed (either client or server-initiated). - -* **tcp connection**(< _object_ >details, < _function_ >accept, < _function_ >reject) - An incoming forwarded TCP connection is being requested. Calling `accept` accepts the connection and returns a `Channel` object. Calling `reject` rejects the connection and no further action is needed. `details` contains: - - * **destIP** - _string_ - The remote IP the connection was received on (given in earlier call to `forwardIn()`). - - * **destPort** - _integer_ - The remote port the connection was received on (given in earlier call to `forwardIn()`). - - * **srcIP** - _string_ - The originating IP of the connection. - - * **srcPort** - _integer_ - The originating port of the connection. - -* **unix connection**(< _object_ >details, < _function_ >accept, < _function_ >reject) - An incoming forwarded UNIX socket connection is being requested. Calling `accept` accepts the connection and returns a `Channel` object. Calling `reject` rejects the connection and no further action is needed. `details` contains: - - * **socketPath** - _string_ - The originating UNIX socket path of the connection. - -* **x11**(< _object_ >details, < _function_ >accept, < _function_ >reject) - An incoming X11 connection is being requested. Calling `accept` accepts the connection and returns a `Channel` object. Calling `reject` rejects the connection and no further action is needed. `details` contains: - - * **srcIP** - _string_ - The originating IP of the connection. - - * **srcPort** - _integer_ - The originating port of the connection. - -#### Client methods - -* **(constructor)**() - Creates and returns a new Client instance. - -* **connect**(< _object_ >config) - _(void)_ - Attempts a connection to a server using the information given in `config`: - - * **agent** - _string_ - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. **Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin "UNIX socket."** **Default:** (none) - - * **agentForward** - _boolean_ - Set to `true` to use OpenSSH agent forwarding (`auth-agent@openssh.com`) for the life of the connection. `agent` must also be set to use this feature. **Default:** `false` - - * **algorithms** - _object_ - This option allows you to explicitly override the default transport layer algorithms used for the connection. The value for each category must either be an array of valid algorithm names to set an exact list (with the most preferable first) or an object containing `append`, `prepend`, and/or `remove` properties that each contain an _array_ of algorithm names or RegExps to match to adjust default lists for each category. Valid keys: - - * **cipher** - _mixed_ - Ciphers. - * Default list (in order from most to least preferable): - * `chacha20-poly1305@openssh.com` (priority of chacha20-poly1305 may vary depending upon CPU and/or optional binding availability) - * `aes128-gcm` - * `aes128-gcm@openssh.com` - * `aes256-gcm` - * `aes256-gcm@openssh.com` - * `aes128-ctr` - * `aes192-ctr` - * `aes256-ctr` - * Other supported names: - * `3des-cbc` - * `aes256-cbc` - * `aes192-cbc` - * `aes128-cbc` - * `arcfour256` - * `arcfour128` - * `arcfour` - * `blowfish-cbc` - * `cast128-cbc` - - * **compress** - _mixed_ - Compression algorithms. - * Default list (in order from most to least preferable): - * `none` - * `zlib@openssh.com` - * `zlib` - * Other supported names: - - * **hmac** - _mixed_ - (H)MAC algorithms. - * Default list (in order from most to least preferable): - * `hmac-sha2-256-etm@openssh.com` - * `hmac-sha2-512-etm@openssh.com` - * `hmac-sha1-etm@openssh.com` - * `hmac-sha2-256` - * `hmac-sha2-512` - * `hmac-sha1` - * Other supported names: - * `hmac-md5` - * `hmac-sha2-256-96` - * `hmac-sha2-512-96` - * `hmac-ripemd160` - * `hmac-sha1-96` - * `hmac-md5-96` - - * **kex** - _mixed_ - Key exchange algorithms. - * Default list (in order from most to least preferable): - * `curve25519-sha256 (node v14.0.0+)` - * `curve25519-sha256@libssh.org (node v14.0.0+)` - * `ecdh-sha2-nistp256` - * `ecdh-sha2-nistp384` - * `ecdh-sha2-nistp521` - * `diffie-hellman-group-exchange-sha256` - * `diffie-hellman-group14-sha256` - * `diffie-hellman-group15-sha512` - * `diffie-hellman-group16-sha512` - * `diffie-hellman-group17-sha512` - * `diffie-hellman-group18-sha512` - * Other supported names: - * `diffie-hellman-group-exchange-sha1` - * `diffie-hellman-group14-sha1` - * `diffie-hellman-group1-sha1` - - * **serverHostKey** - _mixed_ - Server host key formats. - * Default list (in order from most to least preferable): - * `ssh-ed25519` (node v12.0.0+) - * `ecdsa-sha2-nistp256` - * `ecdsa-sha2-nistp384` - * `ecdsa-sha2-nistp521` - * `rsa-sha2-512` - * `rsa-sha2-256` - * `ssh-rsa` - * Other supported names: - * `ssh-dss` - - * **authHandler** - _mixed_ - Either an array of objects as described below or a function with parameters `(methodsLeft, partialSuccess, callback)` where `methodsLeft` and `partialSuccess` are `null` on the first authentication attempt, otherwise are an array and boolean respectively. Return or call `callback()` with either the name of the authentication method or an object containing the method name along with method-specific details to try next (return/pass `false` to signal no more methods to try). Valid method names are: `'none', 'password', 'publickey', 'agent', 'keyboard-interactive', 'hostbased'`. **Default:** function that follows a set method order: None -> Password -> Private Key -> Agent (-> keyboard-interactive if `tryKeyboard` is `true`) -> Hostbased - - * When returning or calling `callback()` with an object, it can take one of the following forms: - - ```js - { - type: 'none', - username: 'foo', - } - ``` - - ```js - { - type: 'password' - username: 'foo', - password: 'bar', - } - ``` - - ```js - { - type: 'publickey' - username: 'foo', - // Can be a string, Buffer, or parsed key containing a private key - key: ..., - // `passphrase` only required for encrypted keys - passphrase: ..., - } - ``` - - ```js - { - type: 'hostbased' - username: 'foo', - localHostname: 'baz', - localUsername: 'quux', - // Can be a string, Buffer, or parsed key containing a private key - key: ..., - // `passphrase` only required for encrypted keys - passphrase: ..., - } - ``` - - ```js - { - type: 'agent' - username: 'foo', - // Can be a string that is interpreted exactly like the `agent` - // connection config option or can be a custom agent - // object/instance that extends and implements `BaseAgent` - agent: ..., - } - ``` - - ```js - { - type: 'keyboard-interactive' - username: 'foo', - // This works exactly the same way as a 'keyboard-interactive' - // Client event handler - prompt: (name, instructions, instructionsLang, prompts, finish) => { - // ... - }, - } - ``` - - * **debug** - _function_ - Set this to a function that receives a single string argument to get detailed (local) debug information. **Default:** (none) - - * **forceIPv4** - _boolean_ - Only connect via resolved IPv4 address for `host`. **Default:** `false` - - * **forceIPv6** - _boolean_ - Only connect via resolved IPv6 address for `host`. **Default:** `false` - - * **host** - _string_ - Hostname or IP address of the server. **Default:** `'localhost'` - - * **hostHash** - _string_ - Any valid hash algorithm supported by node. The host's key is hashed using this algorithm and passed to the **hostVerifier** function as a hex string. **Default:** (none) - - * **hostVerifier** - _function_ - Function with parameters `(hashedKey[, callback])` where `hashedKey` is a string hex hash of the host's key for verification purposes. Return `true` to continue with the handshake or `false` to reject and disconnect, or call `callback()` with `true` or `false` if you need to perform asynchronous verification. **Default:** (auto-accept if `hostVerifier` is not set) - - * **keepaliveCountMax** - _integer_ - How many consecutive, unanswered SSH-level keepalive packets that can be sent to the server before disconnection (similar to OpenSSH's ServerAliveCountMax config option). **Default:** `3` - - * **keepaliveInterval** - _integer_ - How often (in milliseconds) to send SSH-level keepalive packets to the server (in a similar way as OpenSSH's ServerAliveInterval config option). Set to 0 to disable. **Default:** `0` - - * **localAddress** - _string_ - IP address of the network interface to use to connect to the server. **Default:** (none -- determined by OS) - - * **localHostname** - _string_ - Along with **localUsername** and **privateKey**, set this to a non-empty string for hostbased user authentication. **Default:** (none) - - * **localPort** - _string_ - The local port number to connect from. **Default:** (none -- determined by OS) - - * **localUsername** - _string_ - Along with **localHostname** and **privateKey**, set this to a non-empty string for hostbased user authentication. **Default:** (none) - - * **passphrase** - _string_ - For an encrypted `privateKey`, this is the passphrase used to decrypt it. **Default:** (none) - - * **password** - _string_ - Password for password-based user authentication. **Default:** (none) - - * **port** - _integer_ - Port number of the server. **Default:** `22` - - * **privateKey** - _mixed_ - _Buffer_ or _string_ that contains a private key for either key-based or hostbased user authentication (OpenSSH format). **Default:** (none) - - * **readyTimeout** - _integer_ - How long (in milliseconds) to wait for the SSH handshake to complete. **Default:** `20000` - - * **sock** - _ReadableStream_ - A _ReadableStream_ to use for communicating with the server instead of creating and using a new TCP connection (useful for connection hopping). - - * **strictVendor** - _boolean_ - Performs a strict server vendor check before sending vendor-specific requests, etc. (e.g. check for OpenSSH server when using `openssh_noMoreSessions()`) **Default:** `true` - - * **tryKeyboard** - _boolean_ - Try keyboard-interactive user authentication if primary user authentication method fails. If you set this to `true`, you need to handle the `keyboard-interactive` event. **Default:** `false` - - * **username** - _string_ - Username for authentication. **Default:** (none) - -* **end**() - _(void)_ - Disconnects the socket. - -* **exec**(< _string_ >command[, < _object_ >options], < _function_ >callback) - _(void)_ - Executes `command` on the server. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. Valid `options` properties are: - - * **env** - _object_ - An environment to use for the execution of the command. - - * **pty** - _mixed_ - Set to `true` to allocate a pseudo-tty with defaults, or an object containing specific pseudo-tty settings (see 'Pseudo-TTY settings'). Setting up a pseudo-tty can be useful when working with remote processes that expect input from an actual terminal (e.g. sudo's password prompt). - - * **x11** - _mixed_ - Set to `true` to use defaults below, set to a number to specify a specific screen number, or an object with the following valid properties: - - * **cookie** - _mixed_ - The authentication cookie. Can be a hex _string_ or a _Buffer_ containing the raw cookie value (which will be converted to a hex string). **Default:** (random 16 byte value) - - * **protocol** - _string_ - The authentication protocol name. **Default:** `'MIT-MAGIC-COOKIE-1'` - - * **screen** - _number_ - Screen number to use **Default:** `0` - - * **single** - _boolean_ - Allow just a single connection? **Default:** `false` - -* **forwardIn**(< _string_ >remoteAddr, < _integer_ >remotePort, < _function_ >callback) - _(void)_ - Bind to `remoteAddr` on `remotePort` on the server and forward incoming TCP connections. `callback` has 2 parameters: < _Error_ >err, < _integer_ >port (`port` is the assigned port number if `remotePort` was 0). Here are some special values for `remoteAddr` and their associated binding behaviors: - - * '' - Connections are to be accepted on all protocol families supported by the server. - - * '0.0.0.0' - Listen on all IPv4 addresses. - - * '::' - Listen on all IPv6 addresses. - - * 'localhost' - Listen on all protocol families supported by the server on loopback addresses only. - - * '127.0.0.1' and '::1' - Listen on the loopback interfaces for IPv4 and IPv6, respectively. - -* **forwardOut**(< _string_ >srcIP, < _integer_ >srcPort, < _string_ >dstIP, < _integer_ >dstPort, < _function_ >callback) - _(void)_ - Open a connection with `srcIP` and `srcPort` as the originating address and port and `dstIP` and `dstPort` as the remote destination address and port. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **openssh_forwardInStreamLocal**(< _string_ >socketPath, < _function_ >callback) - _(void)_ - OpenSSH extension that binds to a UNIX domain socket at `socketPath` on the server and forwards incoming connections. `callback` has 1 parameter: < _Error_ >err. - -* **openssh_forwardOutStreamLocal**(< _string_ >socketPath, < _function_ >callback) - _(void)_ - OpenSSH extension that opens a connection to a UNIX domain socket at `socketPath` on the server. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **openssh_noMoreSessions**(< _function_ >callback) - _(void)_ - OpenSSH extension that sends a request to reject any new sessions (e.g. exec, shell, sftp, subsys) for this connection. `callback` has 1 parameter: < _Error_ >err. - -* **openssh_unforwardInStreamLocal**(< _string_ >socketPath, < _function_ >callback) - _(void)_ - OpenSSH extension that unbinds from a UNIX domain socket at `socketPath` on the server and stops forwarding incoming connections. `callback` has 1 parameter: < _Error_ >err. - -* **rekey**([< _function_ >callback]) - _(void)_ - Initiates a rekey with the server. If `callback` is supplied, it is added as a one-time handler for the `rekey` event. - -* **sftp**(< _function_ >callback) - _(void)_ - Starts an SFTP session. `callback` has 2 parameters: < _Error_ >err, < _SFTP_ >sftp. For methods available on `sftp`, see the [`SFTP` client documentation](https://github.com/mscdex/ssh2/blob/master/SFTP.md). - -* **shell**([[< _mixed_ >window,] < _object_ >options]< _function_ >callback) - _(void)_ - Starts an interactive shell session on the server, with an optional `window` object containing pseudo-tty settings (see 'Pseudo-TTY settings'). If `window === false`, then no pseudo-tty is allocated. `options` supports the `x11` and `env` options as described in `exec()`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **subsys**(< _string_ >subsystem, < _function_ >callback) - _(void)_ - Invokes `subsystem` on the server. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **unforwardIn**(< _string_ >remoteAddr, < _integer_ >remotePort, < _function_ >callback) - _(void)_ - Unbind from `remoteAddr` on `remotePort` on the server and stop forwarding incoming TCP connections. Until `callback` is called, more connections may still come in. `callback` has 1 parameter: < _Error_ >err. - -### Server - -#### Server events - -* **connection**(< _Connection_ >client, < _object_ >info) - A new client has connected. `info` contains the following properties: - - * **family** - _string_ - The `remoteFamily` of the connection. - - * **header** - _object_ - Information about the client's header: - - * **identRaw** - _string_ - The raw client identification string. - - * **versions** - _object_ - Various version information: - - * **protocol** - _string_ - The SSH protocol version (always `1.99` or `2.0`). - - * **software** - _string_ - The software name and version of the client. - - * **comments** - _string_ - Any text that comes after the software name/version. - - Example: the identification string `SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2` would be parsed as: - -```js - { identRaw: 'SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2', - version: { - protocol: '2.0', - software: 'OpenSSH_6.6.1p1' - }, - comments: 'Ubuntu-2ubuntu2' } -``` - - * **ip** - _string_ - The `remoteAddress` of the connection. - - * **port** - _integer_ - The `remotePort` of the connection. - -#### Server methods - -* **(constructor)**(< _object_ >config[, < _function_ >connectionListener]) - Creates and returns a new Server instance. Server instances also have the same methods/properties/events as [`net.Server`](http://nodejs.org/docs/latest/api/net.html#net_class_net_server). `connectionListener` if supplied, is added as a `connection` listener. Valid `config` properties: - - * **algorithms** - _object_ - This option allows you to explicitly override the default transport layer algorithms used for incoming client connections. Each value must be an array of valid algorithms for that category. The order of the algorithms in the arrays are important, with the most favorable being first. For a list of valid and default algorithm names, please review the documentation for the version of `ssh2` used by this module. Valid keys: - - * **cipher** - _array_ - Ciphers. - - * **compress** - _array_ - Compression algorithms. - - * **hmac** - _array_ - (H)MAC algorithms. - - * **kex** - _array_ - Key exchange algorithms. - - * **serverHostKey** - _array_ - Server host key formats. - - * **banner** - _string_ - A message that is sent to clients once, right before authentication begins. **Default:** (none) - - * **debug** - _function_ - Set this to a function that receives a single string argument to get detailed (local) debug information. **Default:** (none) - - * **greeting** - _string_ - A message that is sent to clients immediately upon connection, before handshaking begins. **Note:** Most clients usually ignore this. **Default:** (none) - - * **highWaterMark** - _integer_ - This is the `highWaterMark` to use for the parser stream. **Default:** `32 * 1024` - - * **hostKeys** - _array_ - An array of either Buffers/strings that contain host private keys or objects in the format of `{ key: , passphrase: }` for encrypted private keys. (**Required**) **Default:** (none) - - * **ident** - _string_ - A custom server software name/version identifier. **Default:** `'ssh2js' + moduleVersion + 'srv'` - -* **injectSocket**(< _DuplexStream_ >socket) - Injects a bidirectional stream as though it were a TCP socket connection. Additionally, `socket` should include `net.Socket`-like properties to ensure the best compatibility (e.g. `socket.remoteAddress`, `socket.remotePort`, `socket.remoteFamily`). - -#### Connection events - -* **authentication**(< _AuthContext_ >ctx) - The client has requested authentication. `ctx.username` contains the client username, `ctx.method` contains the requested authentication method, and `ctx.accept()` and `ctx.reject([< Array >authMethodsLeft[, < Boolean >isPartialSuccess]])` are used to accept or reject the authentication request respectively. `abort` is emitted if the client aborts the authentication request. Other properties/methods available on `ctx` depends on the `ctx.method` of authentication the client has requested: - - * `hostbased`: - - * **blob** - _Buffer_ - This contains the data to be verified that is passed to (along with the signature) `key.verify()` where `key` is a public key parsed with [`parseKey()`](#utilities). - - * **key** - _object_ - Contains information about the public key sent by the client: - - * **algo** - _string_ - The name of the key algorithm (e.g. `ssh-rsa`). - - * **data** - _Buffer_ - The actual key data. - - * **localHostname** - _string_ - The local hostname provided by the client. - - * **localUsername** - _string_ - The local username provided by the client. - - * **signature** - _Buffer_ - This contains a signature to be verified that is passed to (along with the blob) `key.verify()` where `key` is a public key parsed with [`parseKey()`](#utilities). - - * `keyboard-interactive`: - - * **prompt**(< _array_ >prompts[, < _string_ >title[, < _string_ >instructions]], < _function_ >callback) - _(void)_ - Send prompts to the client. `prompts` is an array of `{ prompt: 'Prompt text', echo: true }` objects (`prompt` being the prompt text and `echo` indicating whether the client's response to the prompt should be echoed to their display). `callback` is called with `(responses)`, where `responses` is an array of string responses matching up to the `prompts`. - - * **submethods** - _array_ - A list of preferred authentication "sub-methods" sent by the client. This may be used to determine what (if any) prompts to send to the client. - - * `password`: - - * **password** - _string_ - This is the password sent by the client. - - * **requestChange**(< _string_ >prompt, < _function_ >callback) - _(void)_ - Sends a password change request to the client. `callback` is called with `(newPassword)`, where `newPassword` is the new password supplied by the client. You may accept, reject, or prompt for another password change after `callback` is called. - - * `publickey`: - - * **blob** - _mixed_ - If the value is `undefined`, the client is only checking the validity of the `key`. If the value is a _Buffer_, then this contains the data to be verified that is passed to (along with the signature) `key.verify()` where `key` is a public key parsed with [`parseKey()`](#utilities). - - * **key** - _object_ - Contains information about the public key sent by the client: - - * **algo** - _string_ - The name of the key algorithm (e.g. `ssh-rsa`). - - * **data** - _Buffer_ - The actual key data. - - * **signature** - _mixed_ - If the value is `undefined`, the client is only checking the validity of the `key`. If the value is a _Buffer_, then this contains a signature to be verified that is passed to (along with the blob) `key.verify()` where `key` is a public key parsed with [`parseKey()`](#utilities). - -* **close**() - The client socket was closed. - -* **end**() - The client socket disconnected. - -* **error**(< _Error_ >err) - An error occurred. - -* **handshake**(< _object_ >negotiated) - Emitted when a handshake has completed (either initial or rekey). `negotiated` contains the negotiated details of the handshake and is of the form: - -```js - // In this particular case `mac` is empty because there is no separate MAC - // because it's integrated into AES in GCM mode - { kex: 'ecdh-sha2-nistp256', - srvHostKey: 'rsa-sha2-512', - cs: { // Client to server algorithms - cipher: 'aes128-gcm', - mac: '', - compress: 'none', - lang: '' - }, - sc: { // Server to client algorithms - cipher: 'aes128-gcm', - mac: '', - compress: 'none', - lang: '' - } - } -``` - -* **openssh.streamlocal**(< _function_ >accept, < _function_ >reject, < _object_ >info) - Emitted when the client has requested a connection to a UNIX domain socket. `accept()` returns a new _Channel_ instance representing the connection. `info` contains: - - * **socketPath** - _string_ - Destination socket path of outgoing connection. - -* **ready**() - Emitted when the client has been successfully authenticated. - -* **rekey**() - Emitted when a rekeying operation has completed (either client or server-initiated). - -* **request**(< _mixed_ >accept, < _mixed_ >reject, < _string_ >name, < _object_ >info) - Emitted when the client has sent a global request for `name` (e.g. `tcpip-forward` or `cancel-tcpip-forward`). `accept` and `reject` are functions if the client requested a response. If `bindPort === 0`, you should pass the chosen port to `accept()` so that the client will know what port was bound. `info` contains additional details about the request: - - * `cancel-tcpip-forward` and `tcpip-forward`: - - * **bindAddr** - _string_ - The IP address to start/stop binding to. - - * **bindPort** - _integer_ - The port to start/stop binding to. - - * `cancel-streamlocal-forward@openssh.com` and `streamlocal-forward@openssh.com`: - - * **socketPath** - _string_ - The socket path to start/stop binding to. - -* **session**(< _function_ >accept, < _function_ >reject) - Emitted when the client has requested a new session. Sessions are used to start interactive shells, execute commands, request X11 forwarding, etc. `accept()` returns a new _Session_ instance. - -* **tcpip**(< _function_ >accept, < _function_ >reject, < _object_ >info) - Emitted when the client has requested an outbound (TCP) connection. `accept()` returns a new _Channel_ instance representing the connection. `info` contains: - - * **destIP** - _string_ - Destination IP address of outgoing connection. - - * **destPort** - _string_ - Destination port of outgoing connection. - - * **srcIP** - _string_ - Source IP address of outgoing connection. - - * **srcPort** - _string_ - Source port of outgoing connection. - -#### Connection methods - -* **end**() - _(void)_ - Closes the client connection. - -* **forwardOut**(< _string_ >boundAddr, < _integer_ >boundPort, < _string_ >remoteAddr, < _integer_ >remotePort, < _function_ >callback) - _(void)_ - Alert the client of an incoming TCP connection on `boundAddr` on port `boundPort` from `remoteAddr` on port `remotePort`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **openssh_forwardOutStreamLocal**(< _string_ >socketPath, < _function_ >callback) - _(void)_ - Alert the client of an incoming UNIX domain socket connection on `socketPath`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -* **rekey**([< _function_ >callback]) - _(void)_ - Initiates a rekey with the client. If `callback` is supplied, it is added as a one-time handler for the `rekey` event. - -* **x11**(< _string_ >originAddr, < _integer_ >originPort, < _function_ >callback) - _(void)_ - Alert the client of an incoming X11 client connection from `originAddr` on port `originPort`. `callback` has 2 parameters: < _Error_ >err, < _Channel_ >stream. - -#### Session events - -* **auth-agent**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested incoming ssh-agent requests be forwarded to them. `accept` and `reject` are functions if the client requested a response. - -* **close**() - The session was closed. - -* **env**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client requested an environment variable to be set for this session. `accept` and `reject` are functions if the client requested a response. `info` has these properties: - - * **key** - _string_ - The environment variable's name. - - * **value** - _string_ - The environment variable's value. - -* **exec**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client has requested execution of a command string. `accept` and `reject` are functions if the client requested a response. `accept()` returns a _Channel_ for the command execution. `info` has these properties: - - * **command** - _string_ - The command line to be executed. - -* **pty**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client requested allocation of a pseudo-TTY for this session. `accept` and `reject` are functions if the client requested a response. `info` has these properties: - - * **cols** - _integer_ - The number of columns for the pseudo-TTY. - - * **height** - _integer_ - The height of the pseudo-TTY in pixels. - - * **modes** - _object_ - Contains the requested terminal modes of the pseudo-TTY keyed on the mode name with the value being the mode argument. (See the table at the end for valid names). - - * **rows** - _integer_ - The number of rows for the pseudo-TTY. - - * **width** - _integer_ - The width of the pseudo-TTY in pixels. - -* **sftp**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested the SFTP subsystem. `accept` and `reject` are functions if the client requested a response. `accept()` returns an _SFTP_ instance in server mode (see the [`SFTP` documentation](https://github.com/mscdex/ssh2/blob/master/SFTP.md) for details). `info` has these properties: - -* **shell**(< _mixed_ >accept, < _mixed_ >reject) - The client has requested an interactive shell. `accept` and `reject` are functions if the client requested a response. `accept()` returns a _Channel_ for the interactive shell. - -* **signal**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client has sent a signal. `accept` and `reject` are functions if the client requested a response. `info` has these properties: - - * **name** - _string_ - The signal name (e.g. `SIGUSR1`). - -* **subsystem**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client has requested an arbitrary subsystem. `accept` and `reject` are functions if the client requested a response. `accept()` returns a _Channel_ for the subsystem. `info` has these properties: - - * **name** - _string_ - The name of the subsystem. - -* **window-change**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client reported a change in window dimensions during this session. `accept` and `reject` are functions if the client requested a response. `info` has these properties: - - * **cols** - _integer_ - The new number of columns for the client window. - - * **height** - _integer_ - The new height of the client window in pixels. - - * **rows** - _integer_ - The new number of rows for the client window. - - * **width** - _integer_ - The new width of the client window in pixels. - -* **x11**(< _mixed_ >accept, < _mixed_ >reject, < _object_ >info) - The client requested X11 forwarding. `accept` and `reject` are functions if the client requested a response. `info` has these properties: - - * **cookie** - _string_ - The X11 authentication cookie encoded in hexadecimal. - - * **protocol** - _string_ - The name of the X11 authentication method used (e.g. `MIT-MAGIC-COOKIE-1`). - - * **screen** - _integer_ - The screen number to forward X11 connections for. - - * **single** - _boolean_ - `true` if only a single connection should be forwarded. - -### Channel - -This is a normal **streams2** Duplex Stream (used both by clients and servers), with the following changes: - -* A boolean property `allowHalfOpen` exists and behaves similarly to the property of the same name for `net.Socket`. When the stream's end() is called, if `allowHalfOpen` is `true`, only EOF will be sent (the server can still send data if they have not already sent EOF). The default value for this property is `true`. - -* A `close` event is emitted once the channel is completely closed on both the client and server. - -* Client-specific: - - * For exec(): - - * An `exit` event *may* (the SSH2 spec says it is optional) be emitted when the process finishes. If the process finished normally, the process's return value is passed to the `exit` callback. If the process was interrupted by a signal, the following are passed to the `exit` callback: null, < _string_ >signalName, < _boolean_ >didCoreDump, < _string_ >description. - - * If there was an `exit` event, the `close` event will be passed the same arguments for convenience. - - * A `stderr` property contains a Readable stream that represents output from stderr. - - * For exec() and shell(): - - * The readable side represents stdout and the writable side represents stdin. - - * **setWindow**(< _integer_ >rows, < _integer_ >cols, < _integer_ >height, < _integer_ >width) - _(void)_ - Lets the server know that the local terminal window has been resized. The meaning of these arguments are described in the 'Pseudo-TTY settings' section. - - * **signal**(< _string_ >signalName) - _(void)_ - Sends a POSIX signal to the current process on the server. Valid signal names are: 'ABRT', 'ALRM', 'FPE', 'HUP', 'ILL', 'INT', 'KILL', 'PIPE', 'QUIT', 'SEGV', 'TERM', 'USR1', and 'USR2'. Some server implementations may ignore this request if they do not support signals. Note: If you are trying to send SIGINT and you find `signal()` doesn't work, try writing `'\x03'` to the Channel stream instead. - - -* Server-specific: - - * For exec-enabled channel instances there is an additional method available that may be called right before you close the channel. It has two different signatures: - - * **exit**(< _integer_ >exitCode) - _(void)_ - Sends an exit status code to the client. - - * **exit**(< _string_ >signalName[, < _boolean_ >coreDumped[, < _string_ >errorMsg]]) - _(void)_ - Sends an exit status code to the client. - - * For exec and shell-enabled channel instances, `channel.stderr` is a writable stream. - -### Pseudo-TTY settings - -* **cols** - < _integer_ > - Number of columns. **Default:** `80` - -* **height** - < _integer_ > - Height in pixels. **Default:** `480` - -* **modes** - < _object_ > - An object containing [Terminal Modes](#terminal-modes) as keys, with each value set to each mode argument. **Default:** `null` - -* **rows** - < _integer_ > - Number of rows. **Default:** `24` - -* **term** - < _string_ > - The value to use for $TERM. **Default:** `'vt100'` - -* **width** - < _integer_ > - Width in pixels. **Default:** `640` - -`rows` and `cols` override `width` and `height` when `rows` and `cols` are non-zero. - -Pixel dimensions refer to the drawable area of the window. - -Zero dimension parameters are ignored. - -### Terminal modes - -Name | Description --------------- | ------------ -CS7 | 7 bit mode. -CS8 | 8 bit mode. -ECHOCTL | Echo control characters as ^(Char). -ECHO | Enable echoing. -ECHOE | Visually erase chars. -ECHOKE | Visual erase for line kill. -ECHOK | Kill character discards current line. -ECHONL | Echo NL even if ECHO is off. -ICANON | Canonicalize input lines. -ICRNL | Map CR to NL on input. -IEXTEN | Enable extensions. -IGNCR | Ignore CR on input. -IGNPAR | The ignore parity flag. The parameter SHOULD be 0 if this flag is FALSE, and 1 if it is TRUE. -IMAXBEL | Ring bell on input queue full. -INLCR | Map NL into CR on input. -INPCK | Enable checking of parity errors. -ISIG | Enable signals INTR, QUIT, [D]SUSP. -ISTRIP | Strip 8th bit off characters. -IUCLC | Translate uppercase characters to lowercase. -IXANY | Any char will restart after stop. -IXOFF | Enable input flow control. -IXON | Enable output flow control. -NOFLSH | Don't flush after interrupt. -OCRNL | Translate carriage return to newline (output). -OLCUC | Convert lowercase to uppercase. -ONLCR | Map NL to CR-NL. -ONLRET | Newline performs a carriage return (output). -ONOCR | Translate newline to carriage return-newline (output). -OPOST | Enable output processing. -PARENB | Parity enable. -PARMRK | Mark parity and framing errors. -PARODD | Odd parity, else even. -PENDIN | Retype pending input. -TOSTOP | Stop background jobs from output. -TTY_OP_ISPEED | Specifies the input baud rate in bits per second. -TTY_OP_OSPEED | Specifies the output baud rate in bits per second. -VDISCARD | Toggles the flushing of terminal output. -VDSUSP | Another suspend character. -VEOF | End-of-file character (sends EOF from the terminal). -VEOL2 | Additional end-of-line character. -VEOL | End-of-line character in addition to carriage return and/or linefeed. -VERASE | Erase the character to left of the cursor. -VFLUSH | Character to flush output. -VINTR | Interrupt character; 255 if none. Similarly for the other characters. Not all of these characters are supported on all systems. -VKILL | Kill the current input line. -VLNEXT | Enter the next character typed literally, even if it is a special character -VQUIT | The quit character (sends SIGQUIT signal on POSIX systems). -VREPRINT | Reprints the current input line. -VSTART | Continues paused output (normally control-Q). -VSTATUS | Prints system status line (load, command, pid, etc). -VSTOP | Pauses output (normally control-S). -VSUSP | Suspends the current program. -VSWTCH | Switch to a different shell layer. -VWERASE | Erases a word left of cursor. -XCASE | Enable input and output of uppercase characters by preceding their lowercase equivalents with "\". - -### HTTPAgent - -#### HTTPAgent methods - -* **(constructor)**(< _object_ >sshConfig[, < _object_ >agentConfig]) - Creates and returns a new `http.Agent` instance used to tunnel an HTTP connection over SSH. `sshConfig` is what is passed to `client.connect()` and `agentOptions` is passed to the `http.Agent` constructor. - -### HTTPSAgent - -#### HTTPSAgent methods - -* **(constructor)**(< _object_ >sshConfig[, < _object_ >agentConfig]) - Creates and returns a new `https.Agent` instance used to tunnel an HTTP connection over SSH. `sshConfig` is what is passed to `client.connect()` and `agentOptions` is passed to the `https.Agent` constructor. - -### Utilities - -* **parseKey**(< _mixed_ >keyData[, < _string_ >passphrase]) - _mixed_ - Parses a private/public key in OpenSSH, RFC4716, or PPK format. For encrypted private keys, the key will be decrypted with the given `passphrase`. `keyData` can be a _Buffer_ or _string_ value containing the key contents. The returned value will be an array of objects (currently in the case of modern OpenSSH keys) or an object with these properties and methods: - - * **comment** - _string_ - The comment for the key - - * **equals**(< _mixed_ >otherKey) - _boolean_ - This returns `true` if `otherKey` (a parsed or parseable key) is the same as this key. This method does not compare the keys' comments - - * **getPrivatePEM**() - _string_ - This returns the PEM version of a private key - - * **getPublicPEM**() - _string_ - This returns the PEM version of a public key (for either public key or derived from a private key) - - * **getPublicSSH**() - _string_ - This returns the SSH version of a public key (for either public key or derived from a private key) - - * **isPrivateKey**() - _boolean_ - This returns `true` if the key is a private key or not - - * **sign**(< _mixed_ >data) - _mixed_ - This signs the given `data` using this key and returns a _Buffer_ containing the signature on success. On failure, an _Error_ will be returned. `data` can be anything accepted by node's [`sign.update()`](https://nodejs.org/docs/latest/api/crypto.html#crypto_sign_update_data_inputencoding). - - * **type** - _string_ - The full key type (e.g. `'ssh-rsa'`) - - * **verify**(< _mixed_ >data, < _Buffer_ >signature) - _mixed_ - This verifies a `signature` of the given `data` using this key and returns `true` if the signature could be verified. On failure, either `false` will be returned or an _Error_ will be returned upon a more critical failure. `data` can be anything accepted by node's [`verify.update()`](https://nodejs.org/docs/latest/api/crypto.html#crypto_verify_update_data_inputencoding). - -* **sftp.OPEN_MODE** - [`OPEN_MODE`](https://github.com/mscdex/ssh2/blob/master/SFTP.md#useful-standalone-data-structures) - -* **sftp.STATUS_CODE** - [`STATUS_CODE`](https://github.com/mscdex/ssh2/blob/master/SFTP.md#useful-standalone-data-structures) - -* **sftp.flagsToString** - [`flagsToString()`](https://github.com/mscdex/ssh2/blob/master/SFTP.md#useful-standalone-methods) - -* **sftp.stringToFlags** - [`stringToFlags()`](https://github.com/mscdex/ssh2/blob/master/SFTP.md#useful-standalone-methods) - -### AgentProtocol - -#### AgentProtocol events - -* **identities**(< _opaque_ >request) - **(Server mode only)** The client has requested a list of public keys stored in the agent. Use `failureReply()` or `getIdentitiesReply()` to reply appropriately. - -* **sign**(< _opaque_ >request, < _mixed_ >pubKey, < _Buffer_ >data, < _object_ >options) - **(Server mode only)** The client has requested `data` to be signed using the key identified by `pubKey`. Use `failureReply()` or `signReply()` to reply appropriately. `options` may contain any of: - - * **hash** - _string_ - The explicitly desired hash to use when computing the signature. Currently if set, this may be either `'sha256'` or `'sha512'` for RSA keys. - -#### AgentProtocol methods - -* **(constructor)**(< _boolean_ >isClient) - Creates and returns a new AgentProtocol instance. `isClient` determines whether the instance operates in client or server mode. - -* **failureReply**(< _opaque_ >request) - _(void)_ - **(Server mode only)** Replies to the given `request` with a failure response. - -* **getIdentities**(< _function_ >callback) - _(void)_ - **(Client mode only)** Requests a list of public keys from the agent. `callback` is passed `(err, keys)` where `keys` is a possible array of public keys for authentication. - -* **getIdentitiesReply**(< _opaque_ >request, < _array_ >keys) - _(void)_ - **(Server mode only)** Responds to a identities list `request` with the given array of keys in `keys`. - -* **sign**(< _mixed_ >pubKey, < _Buffer_ >data, < _object_ >options, < _function_ >callback) - _(void)_ - **(Client mode only)** Requests that the agent sign `data` using the key identified by `pubKey`. `pubKey` can be any parsed (using `utils.parseKey()`) or parseable key value. `callback` is passed `(err, signature)` where `signature` is a possible _Buffer_ containing the signature for the `data`. `options` may contain any of: - - * **hash** - _string_ - The explicitly desired hash to use when computing the signature. Currently if set, this may be either `'sha256'` or `'sha512'` for RSA keys. - -* **signReply**(< _opaque_ >request, < _Buffer_ >signature) - _(void)_ - **(Server mode only)** Responds to a sign `request` with the given signature in `signature`. - -### BaseAgent - -In order to create a custom agent, your class *must*: - - * Extend `BaseAgent` - * Call `super()` in its constructor - * Implement *at least* the following methods: - -* **getIdentities**(< _function_ >callback) - _(void)_ - Passes `(err, keys)` to `callback` where `keys` is a possible array of public keys for authentication. - -* **sign**(< _mixed_ >pubKey, < _Buffer_ >data, < _object_ >options, < _function_ >callback) - _(void)_ - Signs `data` using the key identified by `pubKey`. `pubKey` can be any parsed (using `utils.parseKey()`) or parseable key value. `callback` should be passed `(err, signature)` where `signature` is a possible _Buffer_ containing the signature for the `data`. `options` may contain any of: - - * **hash** - _string_ - The explicitly desired hash to use when computing the signature. Currently if set, this may be either `'sha256'` or `'sha512'` for RSA keys. - -Additionally your class may implement the following method in order to support agent forwarding on the client: - -* **getStream**(< _function_ >callback) - _(void)_ - Passes `(err, stream)` to `callback` where `stream` is a possible Duplex stream to be used to communicate with your agent. You will probably want to utilize `AgentProtocol` as agent forwarding is an OpenSSH feature, so the `stream` needs to be able to transmit/receive OpenSSH agent protocol packets. - -### createAgent - -* **createAgent**(< _string_ >agentValue) - _(Agent)_ - Creates and returns a new agent instance using the same logic as the `Client`'s `agent` configuration option: if the platform is Windows and it's the value "pageant", it creates a `PageantAgent`, otherwise if it's not a path to a Windows pipe it creates a `CygwinAgent`. In all other cases, it creates an `OpenSSHAgent`. - -### CygwinAgent - -#### CygwinAgent methods - -* **(constructor)**(< _string_ >socketPath) - Communicates with an agent listening at `socketPath` in a Cygwin environment. - -### OpenSSHAgent - -#### OpenSSHAgent methods - -* **(constructor)**(< _string_ >socketPath) - Communicates with an OpenSSH agent listening on the UNIX socket at `socketPath`. - -### PageantAgent - -#### PageantAgent methods - -* **(constructor)**() - Creates a new agent instance for communicating with a running Pageant agent process. diff --git a/reverse_engineering/node_modules/ssh2/SFTP.md b/reverse_engineering/node_modules/ssh2/SFTP.md deleted file mode 100644 index 60c33bae..00000000 --- a/reverse_engineering/node_modules/ssh2/SFTP.md +++ /dev/null @@ -1,403 +0,0 @@ -SFTP events ------------ - -**Client/Server events** - -* **ready**() - Emitted after initial protocol version check has passed. - -**Server-only events** - -_Responses to these client requests are sent using one of the methods listed further in this document under `Server-only methods`. The valid response(s) for each request are documented below._ - -* **OPEN**(< _integer_ >reqID, < _string_ >filename, < _integer_ >flags, < _ATTRS_ >attrs) - - `flags` is a bitfield containing any of the flags defined in `OPEN_MODE`. - Use the static method `flagsToString()` to convert the value to a mode - string to be used by `fs.open()` (e.g. `'r'`). - - Respond using one of the following: - - * `handle()` - This indicates a successful opening of the file and passes - the given handle back to the client to use to refer to this open file for - future operations (e.g. reading, writing, closing). - - * `status()` - Use this to indicate a failure to open the requested file. - -* **READ**(< _integer_ >reqID, < _Buffer_ >handle, < _integer_ >offset, < _integer_ >length) - - Respond using one of the following: - - * `data()` - Use this to send the requested chunk of data back to the client. - The amount of data sent is allowed to be less than the `length` requested, - for example if the file ends between `offset` and `offset + length`. - - * `status()` - Use this to indicate either end of file (`STATUS_CODE.EOF`) - has been reached (`offset` is past the end of the file) or if an error - occurred while reading the requested part of the file. - -* **WRITE**(< _integer_ >reqID, < _Buffer_ >handle, < _integer_ >offset, < _Buffer_ >data) - - Respond using: - - * `status()` - Use this to indicate success/failure of the write to the file. - -* **FSTAT**(< _integer_ >reqID, < _Buffer_ >handle) - - Respond using one of the following: - - * `attrs()` - Use this to send the attributes for the requested - file/directory back to the client. - - * `status()` - Use this to indicate an error occurred while accessing the - file/directory. - -* **FSETSTAT**(< _integer_ >reqID, < _Buffer_ >handle, < _ATTRS_ >attrs) - - Respond using: - - * `status()` - Use this to indicates success/failure of the setting of the - given file/directory attributes. - -* **CLOSE**(< _integer_ >reqID, < _Buffer_ >handle) - - Respond using: - - * `status()` - Use this to indicate success (`STATUS_CODE.OK`) or failure of - the closing of the file identified by `handle`. - -* **OPENDIR**(< _integer_ >reqID, < _string_ >path) - - Respond using one of the following: - - * `handle()` - This indicates a successful opening of the directory and - passes the given handle back to the client to use to refer to this open - directory for future operations (e.g. reading directory contents, closing). - - * `status()` - Use this to indicate a failure to open the requested - directory. - -* **READDIR**(< _integer_ >reqID, < _Buffer_ >handle) - - Respond using one of the following: - - * `name()` - Use this to send one or more directory listings for the open - directory back to the client. - - * `status()` - Use this to indicate either end of directory contents - (`STATUS_CODE.EOF`) or if an error occurred while reading the directory - contents. - -* **LSTAT**(< _integer_ >reqID, < _string_ >path) - - Respond using one of the following: - - * `attrs()` - Use this to send the attributes for the requested - file/directory back to the client. - - * `status()` - Use this to indicate an error occurred while accessing the - file/directory. - -* **STAT**(< _integer_ >reqID, < _string_ >path) - - Respond using one of the following: - - * `attrs()` - Use this to send the attributes for the requested - file/directory back to the client. - - * `status()` - Use this to indicate an error occurred while accessing the - file/directory. - -* **REMOVE**(< _integer_ >reqID, < _string_ >path) - - Respond using: - - * `status()` - Use this to indicate success/failure of the removal of the - file at `path`. - -* **RMDIR**(< _integer_ >reqID, < _string_ >path) - - Respond using: - - * `status()` - Use this to indicate success/failure of the removal of the - directory at `path`. - -* **REALPATH**(< _integer_ >reqID, < _string_ >path) - - Respond using one of the following: - - * `name()` - Use this to respond with a normalized version of `path`. - No file/directory attributes are required to be sent in this response. - - * `status()` - Use this to indicate a failure in normalizing `path`. - -* **READLINK**(< _integer_ >reqID, < _string_ >path) - - Respond using one of the following: - - * `name()` - Use this to respond with the target of the symlink at `path`. - No file/directory attributes are required to be sent in this response. - - * `status()` - Use this to indicate a failure in reading the symlink at - `path`. - -* **SETSTAT**(< _integer_ >reqID, < _string_ >path, < _ATTRS_ >attrs) - - Respond using: - - * `status()` - Use this to indicates success/failure of the setting of the - given file/directory attributes. - -* **MKDIR**(< _integer_ >reqID, < _string_ >path, < _ATTRS_ >attrs) - - Respond using: - - * `status()` - Use this to indicate success/failure of the creation of the - directory at `path`. - -* **RENAME**(< _integer_ >reqID, < _string_ >oldPath, < _string_ >newPath) - - Respond using: - - * `status()` - Use this to indicate success/failure of the renaming of the - file/directory at `oldPath` to `newPath`. - -* **SYMLINK**(< _integer_ >reqID, < _string_ >linkPath, < _string_ >targetPath) - - Respond using: - - * `status()` - Use this to indicate success/failure of the symlink creation. - - -Useful standalone data structures ---------------------------------- - -* **STATUS_CODE** - _object_ - Contains the various status codes (for use especially with `status()`): - - * `OK` - - * `EOF` - - * `NO_SUCH_FILE` - - * `PERMISSION_DENIED` - - * `FAILURE` - - * `BAD_MESSAGE` - - * `OP_UNSUPPORTED` - -* **OPEN_MODE** - _object_ - Contains the various open file flags: - - * `READ` - - * `WRITE` - - * `APPEND` - - * `CREAT` - - * `TRUNC` - - * `EXCL` - - -Useful standalone methods -------------------------- - -* **stringToFlags**(< _string_ >flagsStr) - _integer_ - Converts string flags (e.g. `'r'`, `'a+'`, etc.) to the appropriate `OPEN_MODE` flag mask. Returns `null` if conversion failed. - -* **flagsToString**(< _integer_ >flagsMask) - _string_ - Converts flag mask (e.g. number containing `OPEN_MODE` values) to the appropriate string value. Returns `null` if conversion failed. - - -SFTP methods ------------- - -* **(constructor)**(< _object_ >config[, < _string_ >remoteIdentRaw]) - Creates and returns a new SFTP instance. `remoteIdentRaw` can be the raw SSH identification string of the remote party. This is used to change internal behavior based on particular SFTP implementations. `config` can contain: - - * **server** - _boolean_ - Set to `true` to create an instance in server mode. **Default:** `false` - - * **debug** - _function_ - Set this to a function that receives a single string argument to get detailed (local) debug information. **Default:** (none) - - - -**Client-only methods** - -* **fastGet**(< _string_ >remotePath, < _string_ >localPath[, < _object_ >options], < _function_ >callback) - _(void)_ - Downloads a file at `remotePath` to `localPath` using parallel reads for faster throughput. `options` can have the following properties: - - * **concurrency** - _integer_ - Number of concurrent reads **Default:** `64` - - * **chunkSize** - _integer_ - Size of each read in bytes **Default:** `32768` - - * **step** - _function_(< _integer_ >total_transferred, < _integer_ >chunk, < _integer_ >total) - Called every time a part of a file was transferred - - `callback` has 1 parameter: < _Error_ >err. - -* **fastPut**(< _string_ >localPath, < _string_ >remotePath[, < _object_ >options], < _function_ >callback) - _(void)_ - Uploads a file from `localPath` to `remotePath` using parallel reads for faster throughput. `options` can have the following properties: - - * **concurrency** - _integer_ - Number of concurrent reads **Default:** `64` - - * **chunkSize** - _integer_ - Size of each read in bytes **Default:** `32768` - - * **step** - _function_(< _integer_ >total_transferred, < _integer_ >chunk, < _integer_ >total) - Called every time a part of a file was transferred - - * **mode** - _mixed_ - Integer or string representing the file mode to set for the uploaded file. - - `callback` has 1 parameter: < _Error_ >err. - -* **createReadStream**(< _string_ >path[, < _object_ >options]) - _ReadStream_ - Returns a new readable stream for `path`. `options` has the following defaults: - - ```javascript - { flags: 'r', - encoding: null, - handle: null, - mode: 0o666, - autoClose: true - } - ``` - - `options` can include `start` and `end` values to read a range of bytes from the file instead of the entire file. Both `start` and `end` are inclusive and start at 0. The `encoding` can be `'utf8'`, `'ascii'`, or `'base64'`. - - If `autoClose` is false, then the file handle won't be closed, even if there's an error. It is your responsibility to close it and make sure there's no file handle leak. If `autoClose` is set to true (default behavior), on `error` or `end` the file handle will be closed automatically. - - An example to read the last 10 bytes of a file which is 100 bytes long: - - ```javascript - sftp.createReadStream('sample.txt', {start: 90, end: 99}); - ``` - -* **createWriteStream**(< _string_ >path[, < _object_ >options]) - _WriteStream_ - Returns a new writable stream for `path`. `options` has the following defaults: - - ```javascript - { - flags: 'w', - encoding: null, - mode: 0o666, - autoClose: true - } - ``` - - `options` may also include a `start` option to allow writing data at some position past the beginning of the file. Modifying a file rather than replacing it may require a flags mode of 'r+' rather than the default mode 'w'. - - If 'autoClose' is set to false and you pipe to this stream, this stream will not automatically close after there is no more data upstream -- allowing future pipes and/or manual writes. - -* **open**(< _string_ >filename, < _string_ >flags, [< _mixed_ >attrs_mode, ]< _function_ >callback) - _(void)_ - Opens a file `filename` with `flags` with optional _ATTRS_ object or file mode `attrs_mode`. `flags` is any of the flags supported by `fs.open` (except sync flag). `callback` has 2 parameters: < _Error_ >err, < _Buffer_ >handle. - -* **close**(< _Buffer_ >handle, < _function_ >callback) - _(void)_ - Closes the resource associated with `handle` given by open() or opendir(). `callback` has 1 parameter: < _Error_ >err. - -* **read**(< _Buffer_ >handle, < _Buffer_ >buffer, < _integer_ >offset, < _integer_ >length, < _integer_ >position, < _function_ >callback) - _(void)_ - Reads `length` bytes from the resource associated with `handle` starting at `position` and stores the bytes in `buffer` starting at `offset`. `callback` has 4 parameters: < _Error_ >err, < _integer_ >bytesRead, < _Buffer_ >buffer (offset adjusted), < _integer_ >position. - -* **write**(< _Buffer_ >handle, < _Buffer_ >buffer, < _integer_ >offset, < _integer_ >length, < _integer_ >position, < _function_ >callback) - _(void)_ - Writes `length` bytes from `buffer` starting at `offset` to the resource associated with `handle` starting at `position`. `callback` has 1 parameter: < _Error_ >err. - -* **fstat**(< _Buffer_ >handle, < _function_ >callback) - _(void)_ - Retrieves attributes for the resource associated with `handle`. `callback` has 2 parameters: < _Error_ >err, < _Stats_ >stats. - -* **fsetstat**(< _Buffer_ >handle, < _ATTRS_ >attributes, < _function_ >callback) - _(void)_ - Sets the attributes defined in `attributes` for the resource associated with `handle`. `callback` has 1 parameter: < _Error_ >err. - -* **futimes**(< _Buffer_ >handle, < _mixed_ >atime, < _mixed_ >mtime, < _function_ >callback) - _(void)_ - Sets the access time and modified time for the resource associated with `handle`. `atime` and `mtime` can be Date instances or UNIX timestamps. `callback` has 1 parameter: < _Error_ >err. - -* **fchown**(< _Buffer_ >handle, < _integer_ >uid, < _integer_ >gid, < _function_ >callback) - _(void)_ - Sets the owner for the resource associated with `handle`. `callback` has 1 parameter: < _Error_ >err. - -* **fchmod**(< _Buffer_ >handle, < _mixed_ >mode, < _function_ >callback) - _(void)_ - Sets the mode for the resource associated with `handle`. `mode` can be an integer or a string containing an octal number. `callback` has 1 parameter: < _Error_ >err. - -* **opendir**(< _string_ >path, < _function_ >callback) - _(void)_ - Opens a directory `path`. `callback` has 2 parameters: < _Error_ >err, < _Buffer_ >handle. - -* **readdir**(< _mixed_ >location, < _function_ >callback) - _(void)_ - Retrieves a directory listing. `location` can either be a _Buffer_ containing a valid directory handle from opendir() or a _string_ containing the path to a directory. `callback` has 2 parameters: < _Error_ >err, < _mixed_ >list. `list` is an _Array_ of `{ filename: 'foo', longname: '....', attrs: {...} }` style objects (attrs is of type _ATTR_). If `location` is a directory handle, this function may need to be called multiple times until `list` is boolean false, which indicates that no more directory entries are available for that directory handle. - -* **unlink**(< _string_ >path, < _function_ >callback) - _(void)_ - Removes the file/symlink at `path`. `callback` has 1 parameter: < _Error_ >err. - -* **rename**(< _string_ >srcPath, < _string_ >destPath, < _function_ >callback) - _(void)_ - Renames/moves `srcPath` to `destPath`. `callback` has 1 parameter: < _Error_ >err. - -* **mkdir**(< _string_ >path, [< _ATTRS_ >attributes, ]< _function_ >callback) - _(void)_ - Creates a new directory `path`. `callback` has 1 parameter: < _Error_ >err. - -* **rmdir**(< _string_ >path, < _function_ >callback) - _(void)_ - Removes the directory at `path`. `callback` has 1 parameter: < _Error_ >err. - -* **stat**(< _string_ >path, < _function_ >callback) - _(void)_ - Retrieves attributes for `path`. `callback` has 2 parameter: < _Error_ >err, < _Stats_ >stats. - -* **lstat**(< _string_ >path, < _function_ >callback) - _(void)_ - Retrieves attributes for `path`. If `path` is a symlink, the link itself is stat'ed instead of the resource it refers to. `callback` has 2 parameters: < _Error_ >err, < _Stats_ >stats. - -* **setstat**(< _string_ >path, < _ATTRS_ >attributes, < _function_ >callback) - _(void)_ - Sets the attributes defined in `attributes` for `path`. `callback` has 1 parameter: < _Error_ >err. - -* **utimes**(< _string_ >path, < _mixed_ >atime, < _mixed_ >mtime, < _function_ >callback) - _(void)_ - Sets the access time and modified time for `path`. `atime` and `mtime` can be Date instances or UNIX timestamps. `callback` has 1 parameter: < _Error_ >err. - -* **chown**(< _string_ >path, < _integer_ >uid, < _integer_ >gid, < _function_ >callback) - _(void)_ - Sets the owner for `path`. `callback` has 1 parameter: < _Error_ >err. - -* **chmod**(< _string_ >path, < _mixed_ >mode, < _function_ >callback) - _(void)_ - Sets the mode for `path`. `mode` can be an integer or a string containing an octal number. `callback` has 1 parameter: < _Error_ >err. - -* **readlink**(< _string_ >path, < _function_ >callback) - _(void)_ - Retrieves the target for a symlink at `path`. `callback` has 2 parameters: < _Error_ >err, < _string_ >target. - -* **symlink**(< _string_ >targetPath, < _string_ >linkPath, < _function_ >callback) - _(void)_ - Creates a symlink at `linkPath` to `targetPath`. `callback` has 1 parameter: < _Error_ >err. - -* **realpath**(< _string_ >path, < _function_ >callback) - _(void)_ - Resolves `path` to an absolute path. `callback` has 2 parameters: < _Error_ >err, < _string_ >absPath. - -* **ext_openssh_rename**(< _string_ >srcPath, < _string_ >destPath, < _function_ >callback) - _(void)_ - **OpenSSH extension** Performs POSIX rename(3) from `srcPath` to `destPath`. `callback` has 1 parameter: < _Error_ >err. - -* **ext_openssh_statvfs**(< _string_ >path, < _function_ >callback) - _(void)_ - **OpenSSH extension** Performs POSIX statvfs(2) on `path`. `callback` has 2 parameters: < _Error_ >err, < _object_ >fsInfo. `fsInfo` contains the information as found in the [statvfs struct](http://linux.die.net/man/2/statvfs). - -* **ext_openssh_fstatvfs**(< _Buffer_ >handle, < _function_ >callback) - _(void)_ - **OpenSSH extension** Performs POSIX fstatvfs(2) on open handle `handle`. `callback` has 2 parameters: < _Error_ >err, < _object_ >fsInfo. `fsInfo` contains the information as found in the [statvfs struct](http://linux.die.net/man/2/statvfs). - -* **ext_openssh_hardlink**(< _string_ >targetPath, < _string_ >linkPath, < _function_ >callback) - _(void)_ - **OpenSSH extension** Performs POSIX link(2) to create a hard link to `targetPath` at `linkPath`. `callback` has 1 parameter: < _Error_ >err. - -* **ext_openssh_fsync**(< _Buffer_ >handle, < _function_ >callback) - _(void)_ - **OpenSSH extension** Performs POSIX fsync(3) on the open handle `handle`. `callback` has 1 parameter: < _Error_ >err. - - -**Server-only methods** - -* **status**(< _integer_ >reqID, < _integer_ >statusCode[, < _string_ >message]) - _(void)_ - Sends a status response for the request identified by `id`. - -* **handle**(< _integer_ >reqID, < _Buffer_ >handle) - _(void)_ - Sends a handle response for the request identified by `id`. `handle` must be less than 256 bytes and is an opaque value that could merely contain the value of a backing file descriptor or some other unique, custom value. - -* **data**(< _integer_ >reqID, < _mixed_ >data[, < _string_ >encoding]) - _(void)_ - Sends a data response for the request identified by `id`. `data` can be a _Buffer_ or _string_. If `data` is a string, `encoding` is the encoding of `data`. - -* **name**(< _integer_ >reqID, < _array_ >names) - _(void)_ - Sends a name response for the request identified by `id`. `names` must be an _array_ of _object_ where each _object_ can contain: - - * **filename** - _string_ - The entry's name. - - * **longname** - _string_ - This is the `ls -l`-style format for the entry (e.g. `-rwxr--r-- 1 bar bar 718 Dec 8 2009 foo`) - - * **attrs** - _ATTRS_ - This is an optional _ATTRS_ object that contains requested/available attributes for the entry. - -* **attrs**(< _integer_ >reqID, < _ATTRS_ >attrs) - _(void)_ - Sends an attrs response for the request identified by `id`. `attrs` contains the requested/available attributes. - - -ATTRS ------ - -An object with the following valid properties: - -* **mode** - _integer_ - Mode/permissions for the resource. - -* **uid** - _integer_ - User ID of the resource. - -* **gid** - _integer_ - Group ID of the resource. - -* **size** - _integer_ - Resource size in bytes. - -* **atime** - _integer_ - UNIX timestamp of the access time of the resource. - -* **mtime** - _integer_ - UNIX timestamp of the modified time of the resource. - -When supplying an ATTRS object to one of the SFTP methods: - -* `atime` and `mtime` can be either a Date instance or a UNIX timestamp. - -* `mode` can either be an integer or a string containing an octal number. - - -Stats ------ - -An object with the same attributes as an ATTRS object with the addition of the following methods: - -* `stats.isDirectory()` - -* `stats.isFile()` - -* `stats.isBlockDevice()` - -* `stats.isCharacterDevice()` - -* `stats.isSymbolicLink()` - -* `stats.isFIFO()` - -* `stats.isSocket()` diff --git a/reverse_engineering/node_modules/ssh2/examples/server-chat.js b/reverse_engineering/node_modules/ssh2/examples/server-chat.js deleted file mode 100644 index a82a9550..00000000 --- a/reverse_engineering/node_modules/ssh2/examples/server-chat.js +++ /dev/null @@ -1,238 +0,0 @@ -// **BEFORE RUNNING THIS SCRIPT:** -// 1. The server portion is best run on non-Windows systems because they have -// terminfo databases which are needed to properly work with different -// terminal types of client connections -// 2. Install `blessed`: `npm install blessed` -// 3. Create a server host key in this same directory and name it `host.key` -'use strict'; - -const { readFileSync } = require('fs'); - -const blessed = require('blessed'); -const { Server } = require('ssh2'); - -const RE_SPECIAL = -// eslint-disable-next-line no-control-regex - /[\x00-\x1F\x7F]+|(?:\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K])/g; -const MAX_MSG_LEN = 128; -const MAX_NAME_LEN = 10; -const PROMPT_NAME = `Enter a nickname to use (max ${MAX_NAME_LEN} chars): `; - -const users = []; - -function formatMessage(msg, output) { - output.parseTags = true; - msg = output._parseTags(msg); - output.parseTags = false; - return msg; -} - -function userBroadcast(msg, source) { - const sourceMsg = `> ${msg}`; - const name = `{cyan-fg}{bold}${source.name}{/}`; - msg = `: ${msg}`; - for (const user of users) { - const output = user.output; - if (source === user) - output.add(sourceMsg); - else - output.add(formatMessage(name, output) + msg); - } -} - -function localMessage(msg, source) { - const output = source.output; - output.add(formatMessage(msg, output)); -} - -function noop(v) {} - -new Server({ - hostKeys: [readFileSync('host.key')], -}, (client) => { - let stream; - let name; - - client.on('authentication', (ctx) => { - let nick = ctx.username; - let prompt = PROMPT_NAME; - let lowered; - - // Try to use username as nickname - if (nick.length > 0 && nick.length <= MAX_NAME_LEN) { - lowered = nick.toLowerCase(); - let ok = true; - for (const user of users) { - if (user.name.toLowerCase() === lowered) { - ok = false; - prompt = `That nickname is already in use.\n${PROMPT_NAME}`; - break; - } - } - if (ok) { - name = nick; - return ctx.accept(); - } - } else if (nick.length === 0) { - prompt = 'A nickname is required.\n' + PROMPT_NAME; - } else { - prompt = 'That nickname is too long.\n' + PROMPT_NAME; - } - - if (ctx.method !== 'keyboard-interactive') - return ctx.reject(['keyboard-interactive']); - - ctx.prompt(prompt, function retryPrompt(answers) { - if (answers.length === 0) - return ctx.reject(['keyboard-interactive']); - nick = answers[0]; - if (nick.length > MAX_NAME_LEN) { - return ctx.prompt(`That nickname is too long.\n${PROMPT_NAME}`, - retryPrompt); - } else if (nick.length === 0) { - return ctx.prompt(`A nickname is required.\n${PROMPT_NAME}`, - retryPrompt); - } - lowered = nick.toLowerCase(); - for (const user of users) { - if (user.name.toLowerCase() === lowered) { - return ctx.prompt(`That nickname is already in use.\n${PROMPT_NAME}`, - retryPrompt); - } - } - name = nick; - ctx.accept(); - }); - }).on('ready', () => { - let rows; - let cols; - let term; - client.once('session', (accept, reject) => { - accept().once('pty', (accept, reject, info) => { - rows = info.rows; - cols = info.cols; - term = info.term; - accept && accept(); - }).on('window-change', (accept, reject, info) => { - rows = info.rows; - cols = info.cols; - if (stream) { - stream.rows = rows; - stream.columns = cols; - stream.emit('resize'); - } - accept && accept(); - }).once('shell', (accept, reject) => { - stream = accept(); - users.push(stream); - - stream.name = name; - stream.rows = rows || 24; - stream.columns = cols || 80; - stream.isTTY = true; - stream.setRawMode = noop; - stream.on('error', noop); - - const screen = new blessed.screen({ - autoPadding: true, - smartCSR: true, - program: new blessed.program({ - input: stream, - output: stream - }), - terminal: term || 'ansi' - }); - - screen.title = 'SSH Chatting as ' + name; - // Disable local echo - screen.program.attr('invisible', true); - - const output = stream.output = new blessed.log({ - screen: screen, - top: 0, - left: 0, - width: '100%', - bottom: 2, - scrollOnInput: true - }); - screen.append(output); - - screen.append(new blessed.box({ - screen: screen, - height: 1, - bottom: 1, - left: 0, - width: '100%', - type: 'line', - ch: '=' - })); - - const input = new blessed.textbox({ - screen: screen, - bottom: 0, - height: 1, - width: '100%', - inputOnFocus: true - }); - screen.append(input); - - input.focus(); - - // Local greetings - localMessage('{blue-bg}{white-fg}{bold}Welcome to SSH Chat!{/}\n' - + 'There are {bold}' - + (users.length - 1) - + '{/} other user(s) connected.\n' - + 'Type /quit or /exit to exit the chat.', - stream); - - // Let everyone else know that this user just joined - for (const user of users) { - const output = user.output; - if (user === stream) - continue; - output.add(formatMessage('{green-fg}*** {bold}', output) - + name - + formatMessage('{/bold} has joined the chat{/}', output)); - } - - screen.render(); - // XXX This fake resize event is needed for some terminals in order to - // have everything display correctly - screen.program.emit('resize'); - - // Read a line of input from the user - input.on('submit', (line) => { - input.clearValue(); - screen.render(); - if (!input.focused) - input.focus(); - line = line.replace(RE_SPECIAL, '').trim(); - if (line.length > MAX_MSG_LEN) - line = line.substring(0, MAX_MSG_LEN); - if (line.length > 0) { - if (line === '/quit' || line === '/exit') - stream.end(); - else - userBroadcast(line, stream); - } - }); - }); - }); - }).on('close', () => { - if (stream !== undefined) { - users.splice(users.indexOf(stream), 1); - // Let everyone else know that this user just left - for (const user of users) { - const output = user.output; - output.add(formatMessage('{magenta-fg}*** {bold}', output) - + name - + formatMessage('{/bold} has left the chat{/}', output)); - } - } - }).on('error', (err) => { - // Ignore errors - }); -}).listen(0, function() { - console.log('Listening on port ' + this.address().port); -}); diff --git a/reverse_engineering/node_modules/ssh2/examples/sftp-server-download-only.js b/reverse_engineering/node_modules/ssh2/examples/sftp-server-download-only.js deleted file mode 100644 index d4ae4c58..00000000 --- a/reverse_engineering/node_modules/ssh2/examples/sftp-server-download-only.js +++ /dev/null @@ -1,134 +0,0 @@ -'use strict'; - -const { timingSafeEqual } = require('crypto'); -const { constants, readFileSync } = require('fs'); - -const { Server, sftp: { OPEN_MODE, STATUS_CODE } } = require('ssh2'); - -const allowedUser = Buffer.from('foo'); -const allowedPassword = Buffer.from('bar'); - -function checkValue(input, allowed) { - const autoReject = (input.length !== allowed.length); - if (autoReject) { - // Prevent leaking length information by always making a comparison with the - // same input when lengths don't match what we expect ... - allowed = input; - } - const isMatch = timingSafeEqual(input, allowed); - return (!autoReject && isMatch); -} - -new Server({ - hostKeys: [readFileSync('host.key')] -}, (client) => { - console.log('Client connected!'); - - client.on('authentication', (ctx) => { - let allowed = true; - if (!checkValue(Buffer.from(ctx.username), allowedUser)) - allowed = false; - - switch (ctx.method) { - case 'password': - if (!checkValue(Buffer.from(ctx.password), allowedPassword)) - return ctx.reject(); - break; - default: - return ctx.reject(); - } - - if (allowed) - ctx.accept(); - else - ctx.reject(); - }).on('ready', () => { - console.log('Client authenticated!'); - - client.on('session', (accept, reject) => { - const session = accept(); - session.on('sftp', (accept, reject) => { - console.log('Client SFTP session'); - - const openFiles = new Map(); - let handleCount = 0; - const sftp = accept(); - sftp.on('OPEN', (reqid, filename, flags, attrs) => { - // Only allow opening /tmp/foo.txt for writing - if (filename !== '/tmp/foo.txt' || !(flags & OPEN_MODE.READ)) - return sftp.status(reqid, STATUS_CODE.FAILURE); - - // Create a fake handle to return to the client, this could easily - // be a real file descriptor number for example if actually opening - // the file on the disk - const handle = Buffer.alloc(4); - openFiles.set(handleCount, { read: false }); - handle.writeUInt32BE(handleCount++, 0, true); - - console.log('Opening file for read'); - sftp.handle(reqid, handle); - }).on('READ', (reqid, handle, offset, length) => { - let fnum; - if (handle.length !== 4 - || !openFiles.has(fnum = handle.readUInt32BE(0, true))) { - return sftp.status(reqid, STATUS_CODE.FAILURE); - } - - // Fake the read - const state = openFiles.get(fnum); - if (state.read) { - sftp.status(reqid, STATUS_CODE.EOF); - } else { - state.read = true; - - console.log( - 'Read from file at offset %d, length %d', offset, length - ); - sftp.data(reqid, 'bar'); - } - }).on('CLOSE', (reqid, handle) => { - let fnum; - if (handle.length !== 4 - || !openFiles.has(fnum = handle.readUInt32BE(0))) { - return sftp.status(reqid, STATUS_CODE.FAILURE); - } - - openFiles.delete(fnum); - - console.log('Closing file'); - sftp.status(reqid, STATUS_CODE.OK); - }).on('REALPATH', function(reqid, path) { - const name = [{ - filename: '/tmp/foo.txt', - longname: '-rwxrwxrwx 1 foo foo 3 Dec 8 2009 foo.txt', - attrs: {} - }]; - sftp.name(reqid, name); - }).on('STAT', onSTAT) - .on('LSTAT', onSTAT); - - function onSTAT(reqid, path) { - if (path !== '/tmp/foo.txt') - return sftp.status(reqid, STATUS_CODE.FAILURE); - - let mode = constants.S_IFREG; // Regular file - mode |= constants.S_IRWXU; // Read, write, execute for user - mode |= constants.S_IRWXG; // Read, write, execute for group - mode |= constants.S_IRWXO; // Read, write, execute for other - sftp.attrs(reqid, { - mode: mode, - uid: 0, - gid: 0, - size: 3, - atime: Date.now(), - mtime: Date.now(), - }); - } - }); - }); - }).on('close', () => { - console.log('Client disconnected'); - }); -}).listen(0, '127.0.0.1', function() { - console.log(`Listening on port ${this.address().port}`); -}); diff --git a/reverse_engineering/node_modules/ssh2/install.js b/reverse_engineering/node_modules/ssh2/install.js deleted file mode 100644 index e5363669..00000000 --- a/reverse_engineering/node_modules/ssh2/install.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -const { spawnSync } = require('child_process'); - -// Attempt to build the bundled optional binding -const result = spawnSync('node-gyp', [ - `--target=${process.version}`, - 'rebuild' -], { - cwd: 'lib/protocol/crypto', - encoding: 'utf8', - shell: true, - stdio: 'inherit', - windowsHide: true, -}); -if (result.error || result.status !== 0) - console.log('Failed to build optional crypto binding'); -else - console.log('Succeeded in building optional crypto binding'); -process.exit(0); diff --git a/reverse_engineering/node_modules/ssh2/lib/Channel.js b/reverse_engineering/node_modules/ssh2/lib/Channel.js deleted file mode 100644 index 0bf55531..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/Channel.js +++ /dev/null @@ -1,294 +0,0 @@ -'use strict'; - -const { - Duplex: DuplexStream, - Readable: ReadableStream, - Writable: WritableStream, -} = require('stream'); - -const { - CHANNEL_EXTENDED_DATATYPE: { STDERR }, -} = require('./protocol/constants.js'); -const { bufferSlice } = require('./protocol/utils.js'); - -const PACKET_SIZE = 32 * 1024; -const MAX_WINDOW = 2 * 1024 * 1024; -const WINDOW_THRESHOLD = MAX_WINDOW / 2; - -class ClientStderr extends ReadableStream { - constructor(channel, streamOpts) { - super(streamOpts); - - this._channel = channel; - } - _read(n) { - if (this._channel._waitChanDrain) { - this._channel._waitChanDrain = false; - if (this._channel.incoming.window <= WINDOW_THRESHOLD) - windowAdjust(this._channel); - } - } -} - -class ServerStderr extends WritableStream { - constructor(channel) { - super({ highWaterMark: MAX_WINDOW }); - - this._channel = channel; - } - - _write(data, encoding, cb) { - const channel = this._channel; - const protocol = channel._client._protocol; - const outgoing = channel.outgoing; - const packetSize = outgoing.packetSize; - const id = outgoing.id; - let window = outgoing.window; - const len = data.length; - let p = 0; - - if (outgoing.state !== 'open') - return; - - while (len - p > 0 && window > 0) { - let sliceLen = len - p; - if (sliceLen > window) - sliceLen = window; - if (sliceLen > packetSize) - sliceLen = packetSize; - - if (p === 0 && sliceLen === len) - protocol.channelExtData(id, data, STDERR); - else - protocol.channelExtData(id, bufferSlice(data, p, p + sliceLen), STDERR); - - p += sliceLen; - window -= sliceLen; - } - - outgoing.window = window; - - if (len - p > 0) { - if (window === 0) - channel._waitWindow = true; - if (p > 0) - channel._chunkErr = bufferSlice(data, p, len); - else - channel._chunkErr = data; - channel._chunkcbErr = cb; - return; - } - - cb(); - } -} - -class Channel extends DuplexStream { - constructor(client, info, opts) { - const streamOpts = { - highWaterMark: MAX_WINDOW, - allowHalfOpen: (!opts || (opts && opts.allowHalfOpen !== false)), - emitClose: false, - }; - super(streamOpts); - this.allowHalfOpen = streamOpts.allowHalfOpen; - - const server = !!(opts && opts.server); - - this.server = server; - this.type = info.type; - this.subtype = undefined; - - /* - incoming and outgoing contain these properties: - { - id: undefined, - window: undefined, - packetSize: undefined, - state: 'closed' - } - */ - this.incoming = info.incoming; - this.outgoing = info.outgoing; - this._callbacks = []; - - this._client = client; - this._hasX11 = false; - this._exit = { - code: undefined, - signal: undefined, - dump: undefined, - desc: undefined, - }; - - this.stdin = this.stdout = this; - - if (server) - this.stderr = new ServerStderr(this); - else - this.stderr = new ClientStderr(this, streamOpts); - - // Outgoing data - this._waitWindow = false; // SSH-level backpressure - - // Incoming data - this._waitChanDrain = false; // Channel Readable side backpressure - - this._chunk = undefined; - this._chunkcb = undefined; - this._chunkErr = undefined; - this._chunkcbErr = undefined; - - this.on('finish', onFinish) - .on('prefinish', onFinish); // For node v0.11+ - - this.on('end', onEnd).on('close', onEnd); - } - - _read(n) { - if (this._waitChanDrain) { - this._waitChanDrain = false; - if (this.incoming.window <= WINDOW_THRESHOLD) - windowAdjust(this); - } - } - - _write(data, encoding, cb) { - const protocol = this._client._protocol; - const outgoing = this.outgoing; - const packetSize = outgoing.packetSize; - const id = outgoing.id; - let window = outgoing.window; - const len = data.length; - let p = 0; - - if (outgoing.state !== 'open') - return; - - while (len - p > 0 && window > 0) { - let sliceLen = len - p; - if (sliceLen > window) - sliceLen = window; - if (sliceLen > packetSize) - sliceLen = packetSize; - - if (p === 0 && sliceLen === len) - protocol.channelData(id, data); - else - protocol.channelData(id, bufferSlice(data, p, p + sliceLen)); - - p += sliceLen; - window -= sliceLen; - } - - outgoing.window = window; - - if (len - p > 0) { - if (window === 0) - this._waitWindow = true; - if (p > 0) - this._chunk = bufferSlice(data, p, len); - else - this._chunk = data; - this._chunkcb = cb; - return; - } - - cb(); - } - - eof() { - if (this.outgoing.state === 'open') { - this.outgoing.state = 'eof'; - this._client._protocol.channelEOF(this.outgoing.id); - } - } - - close() { - if (this.outgoing.state === 'open' || this.outgoing.state === 'eof') { - this.outgoing.state = 'closing'; - this._client._protocol.channelClose(this.outgoing.id); - } - } - - destroy() { - this.end(); - this.close(); - } - - // Session type-specific methods ============================================= - setWindow(rows, cols, height, width) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (this.type === 'session' - && (this.subtype === 'shell' || this.subtype === 'exec') - && this.writable - && this.outgoing.state === 'open') { - this._client._protocol.windowChange(this.outgoing.id, - rows, - cols, - height, - width); - } - } - - signal(signalName) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (this.type === 'session' - && this.writable - && this.outgoing.state === 'open') { - this._client._protocol.signal(this.outgoing.id, signalName); - } - } - - exit(statusOrSignal, coreDumped, msg) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - if (this.type === 'session' - && this.writable - && this.outgoing.state === 'open') { - if (typeof statusOrSignal === 'number') { - this._client._protocol.exitStatus(this.outgoing.id, statusOrSignal); - } else { - this._client._protocol.exitSignal(this.outgoing.id, - statusOrSignal, - coreDumped, - msg); - } - } - } - -} - -function onFinish() { - this.eof(); - if (this.server || !this.allowHalfOpen) - this.close(); - this.writable = false; -} - -function onEnd() { - this.readable = false; -} - -function windowAdjust(self) { - if (self.outgoing.state === 'closed') - return; - const amt = MAX_WINDOW - self.incoming.window; - if (amt <= 0) - return; - self.incoming.window += amt; - self._client._protocol.channelWindowAdjust(self.outgoing.id, amt); -} - -module.exports = { - Channel, - MAX_WINDOW, - PACKET_SIZE, - windowAdjust, - WINDOW_THRESHOLD, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/agent.js b/reverse_engineering/node_modules/ssh2/lib/agent.js deleted file mode 100644 index bb495d1b..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/agent.js +++ /dev/null @@ -1,1123 +0,0 @@ -'use strict'; - -const { Socket } = require('net'); -const { Duplex } = require('stream'); -const { resolve } = require('path'); -const { readFile } = require('fs'); -const { execFile, spawn } = require('child_process'); - -const { isParsedKey, parseKey } = require('./protocol/keyParser.js'); - -const { - makeBufferParser, - readUInt32BE, - writeUInt32BE, - writeUInt32LE, -} = require('./protocol/utils.js'); - -function once(cb) { - let called = false; - return (...args) => { - if (called) - return; - called = true; - cb(...args); - }; -} - -function concat(buf1, buf2) { - const combined = Buffer.allocUnsafe(buf1.length + buf2.length); - buf1.copy(combined, 0); - buf2.copy(combined, buf1.length); - return combined; -} - -function noop() {} - -const EMPTY_BUF = Buffer.alloc(0); - -const binaryParser = makeBufferParser(); - -class BaseAgent { - getIdentities(cb) { - cb(new Error('Missing getIdentities() implementation')); - } - sign(pubKey, data, options, cb) { - if (typeof options === 'function') - cb = options; - cb(new Error('Missing sign() implementation')); - } -} - -class OpenSSHAgent extends BaseAgent { - constructor(socketPath) { - super(); - this.socketPath = socketPath; - } - - getStream(cb) { - cb = once(cb); - const sock = new Socket(); - sock.on('connect', () => { - cb(null, sock); - }); - sock.on('close', onFail) - .on('end', onFail) - .on('error', onFail); - sock.connect(this.socketPath); - - function onFail() { - try { - sock.destroy(); - } catch {} - - cb(new Error('Failed to connect to agent')); - } - } - - getIdentities(cb) { - cb = once(cb); - this.getStream((err, stream) => { - function onFail(err) { - if (stream) { - try { - stream.destroy(); - } catch {} - } - if (!err) - err = new Error('Failed to retrieve identities from agent'); - cb(err); - } - - if (err) - return onFail(err); - - const protocol = new AgentProtocol(true); - protocol.on('error', onFail); - protocol.pipe(stream).pipe(protocol); - - stream.on('close', onFail) - .on('end', onFail) - .on('error', onFail); - - protocol.getIdentities((err, keys) => { - if (err) - return onFail(err); - try { - stream.destroy(); - } catch {} - cb(null, keys); - }); - }); - } - - sign(pubKey, data, options, cb) { - if (typeof options === 'function') { - cb = options; - options = undefined; - } else if (typeof options !== 'object' || options === null) { - options = undefined; - } - - cb = once(cb); - this.getStream((err, stream) => { - function onFail(err) { - if (stream) { - try { - stream.destroy(); - } catch {} - } - if (!err) - err = new Error('Failed to sign data with agent'); - cb(err); - } - - if (err) - return onFail(err); - - const protocol = new AgentProtocol(true); - protocol.on('error', onFail); - protocol.pipe(stream).pipe(protocol); - - stream.on('close', onFail) - .on('end', onFail) - .on('error', onFail); - - protocol.sign(pubKey, data, options, (err, sig) => { - if (err) - return onFail(err); - - try { - stream.destroy(); - } catch {} - - cb(null, sig); - }); - }); - } -} - -const PageantAgent = (() => { - const RET_ERR_BADARGS = 10; - const RET_ERR_UNAVAILABLE = 11; - const RET_ERR_NOMAP = 12; - const RET_ERR_BINSTDIN = 13; - const RET_ERR_BINSTDOUT = 14; - const RET_ERR_BADLEN = 15; - - const EXEPATH = resolve(__dirname, '..', 'util/pagent.exe'); - const ERROR = { - [RET_ERR_BADARGS]: new Error('Invalid pagent.exe arguments'), - [RET_ERR_UNAVAILABLE]: new Error('Pageant is not running'), - [RET_ERR_NOMAP]: new Error('pagent.exe could not create an mmap'), - [RET_ERR_BINSTDIN]: new Error('pagent.exe could not set mode for stdin'), - [RET_ERR_BINSTDOUT]: new Error('pagent.exe could not set mode for stdout'), - [RET_ERR_BADLEN]: - new Error('pagent.exe did not get expected input payload'), - }; - - function destroy(stream) { - stream.buffer = null; - if (stream.proc) { - stream.proc.kill(); - stream.proc = undefined; - } - } - - class PageantSocket extends Duplex { - constructor() { - super(); - this.proc = undefined; - this.buffer = null; - } - _read(n) {} - _write(data, encoding, cb) { - if (this.buffer === null) { - this.buffer = data; - } else { - const newBuffer = Buffer.allocUnsafe(this.buffer.length + data.length); - this.buffer.copy(newBuffer, 0); - data.copy(newBuffer, this.buffer.length); - this.buffer = newBuffer; - } - // Wait for at least all length bytes - if (this.buffer.length < 4) - return cb(); - - const len = readUInt32BE(this.buffer, 0); - // Make sure we have a full message before querying pageant - if ((this.buffer.length - 4) < len) - return cb(); - - data = this.buffer.slice(0, 4 + len); - if (this.buffer.length > (4 + len)) - return cb(new Error('Unexpected multiple agent requests')); - this.buffer = null; - - let error; - const proc = this.proc = spawn(EXEPATH, [ data.length ]); - proc.stdout.on('data', (data) => { - this.push(data); - }); - proc.on('error', (err) => { - error = err; - cb(error); - }); - proc.on('close', (code) => { - this.proc = undefined; - if (!error) { - if (error = ERROR[code]) - return cb(error); - cb(); - } - }); - proc.stdin.end(data); - } - _final(cb) { - destroy(this); - cb(); - } - _destroy(err, cb) { - destroy(this); - cb(); - } - } - - return class PageantAgent extends OpenSSHAgent { - getStream(cb) { - cb(null, new PageantSocket()); - } - }; -})(); - -const CygwinAgent = (() => { - const RE_CYGWIN_SOCK = /^!(\d+) s ([A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8}-[A-Z0-9]{8})/; - - return class CygwinAgent extends OpenSSHAgent { - getStream(cb) { - cb = once(cb); - - // The cygwin ssh-agent connection process looks like this: - // 1. Read the "socket" as a file to get the underlying TCP port and a - // special "secret" that must be sent to the TCP server. - // 2. Connect to the server listening on localhost at the TCP port. - // 3. Send the "secret" to the server. - // 4. The server sends back the same "secret". - // 5. Send three 32-bit integer values of zero. This is ordinarily the - // pid, uid, and gid of this process, but cygwin will actually - // send us the correct values as a response. - // 6. The server sends back the pid, uid, gid. - // 7. Disconnect. - // 8. Repeat steps 2-6, except send the received pid, uid, and gid in - // step 5 instead of zeroes. - // 9. Connection is ready to be used. - - let socketPath = this.socketPath; - let triedCygpath = false; - readFile(socketPath, function readCygsocket(err, data) { - if (err) { - if (triedCygpath) - return cb(new Error('Invalid cygwin unix socket path')); - - // Try using `cygpath` to convert a possible *nix-style path to the - // real Windows path before giving up ... - execFile('cygpath', ['-w', socketPath], (err, stdout, stderr) => { - if (err || stdout.length === 0) - return cb(new Error('Invalid cygwin unix socket path')); - - triedCygpath = true; - socketPath = stdout.toString().replace(/[\r\n]/g, ''); - readFile(socketPath, readCygsocket); - }); - return; - } - - const m = RE_CYGWIN_SOCK.exec(data.toString('ascii')); - if (!m) - return cb(new Error('Malformed cygwin unix socket file')); - - let state; - let bc = 0; - let isRetrying = false; - const inBuf = []; - let sock; - - // Use 0 for pid, uid, and gid to ensure we get an error and also - // a valid uid and gid from cygwin so that we don't have to figure it - // out ourselves - let credsBuf = Buffer.alloc(12); - - // Parse cygwin unix socket file contents - const port = parseInt(m[1], 10); - const secret = m[2].replace(/-/g, ''); - const secretBuf = Buffer.allocUnsafe(16); - for (let i = 0, j = 0; j < 32; ++i, j += 2) - secretBuf[i] = parseInt(secret.substring(j, j + 2), 16); - - // Convert to host order (always LE for Windows) - for (let i = 0; i < 16; i += 4) - writeUInt32LE(secretBuf, readUInt32BE(secretBuf, i), i); - - tryConnect(); - - function _onconnect() { - bc = 0; - state = 'secret'; - sock.write(secretBuf); - } - - function _ondata(data) { - bc += data.length; - - if (state === 'secret') { - // The secret we sent is echoed back to us by cygwin, not sure of - // the reason for that, but we ignore it nonetheless ... - if (bc === 16) { - bc = 0; - state = 'creds'; - sock.write(credsBuf); - } - return; - } - - if (state === 'creds') { - // If this is the first attempt, make sure to gather the valid - // uid and gid for our next attempt - if (!isRetrying) - inBuf.push(data); - - if (bc === 12) { - sock.removeListener('connect', _onconnect); - sock.removeListener('data', _ondata); - sock.removeListener('error', onFail); - sock.removeListener('end', onFail); - sock.removeListener('close', onFail); - - if (isRetrying) - return cb(null, sock); - - isRetrying = true; - credsBuf = Buffer.concat(inBuf); - writeUInt32LE(credsBuf, process.pid, 0); - sock.on('error', () => {}); - sock.destroy(); - - tryConnect(); - } - } - } - - function onFail() { - cb(new Error('Problem negotiating cygwin unix socket security')); - } - - function tryConnect() { - sock = new Socket(); - sock.on('connect', _onconnect); - sock.on('data', _ondata); - sock.on('error', onFail); - sock.on('end', onFail); - sock.on('close', onFail); - sock.connect(port); - } - }); - } - }; -})(); - -// Format of `//./pipe/ANYTHING`, with forward slashes and backward slashes -// being interchangeable -const WINDOWS_PIPE_REGEX = /^[/\\][/\\]\.[/\\]pipe[/\\].+/; -function createAgent(path) { - if (process.platform === 'win32' && !WINDOWS_PIPE_REGEX.test(path)) { - return (path === 'pageant' - ? new PageantAgent() - : new CygwinAgent(path)); - } - return new OpenSSHAgent(path); -} - -const AgentProtocol = (() => { - // Client->Server messages - const SSH_AGENTC_REQUEST_IDENTITIES = 11; - const SSH_AGENTC_SIGN_REQUEST = 13; - // const SSH_AGENTC_ADD_IDENTITY = 17; - // const SSH_AGENTC_REMOVE_IDENTITY = 18; - // const SSH_AGENTC_REMOVE_ALL_IDENTITIES = 19; - // const SSH_AGENTC_ADD_SMARTCARD_KEY = 20; - // const SSH_AGENTC_REMOVE_SMARTCARD_KEY = 21; - // const SSH_AGENTC_LOCK = 22; - // const SSH_AGENTC_UNLOCK = 23; - // const SSH_AGENTC_ADD_ID_CONSTRAINED = 25; - // const SSH_AGENTC_ADD_SMARTCARD_KEY_CONSTRAINED = 26; - // const SSH_AGENTC_EXTENSION = 27; - // Server->Client messages - const SSH_AGENT_FAILURE = 5; - // const SSH_AGENT_SUCCESS = 6; - const SSH_AGENT_IDENTITIES_ANSWER = 12; - const SSH_AGENT_SIGN_RESPONSE = 14; - // const SSH_AGENT_EXTENSION_FAILURE = 28; - - // const SSH_AGENT_CONSTRAIN_LIFETIME = 1; - // const SSH_AGENT_CONSTRAIN_CONFIRM = 2; - // const SSH_AGENT_CONSTRAIN_EXTENSION = 255; - - const SSH_AGENT_RSA_SHA2_256 = (1 << 1); - const SSH_AGENT_RSA_SHA2_512 = (1 << 2); - - const ROLE_CLIENT = 0; - const ROLE_SERVER = 1; - - // Ensures that responses get sent back in the same order the requests were - // received - function processResponses(protocol) { - let ret; - while (protocol[SYM_REQS].length) { - const nextResponse = protocol[SYM_REQS][0][SYM_RESP]; - if (nextResponse === undefined) - break; - - protocol[SYM_REQS].shift(); - ret = protocol.push(nextResponse); - } - return ret; - } - - const SYM_TYPE = Symbol('Inbound Request Type'); - const SYM_RESP = Symbol('Inbound Request Response'); - const SYM_CTX = Symbol('Inbound Request Context'); - class AgentInboundRequest { - constructor(type, ctx) { - this[SYM_TYPE] = type; - this[SYM_RESP] = undefined; - this[SYM_CTX] = ctx; - } - hasResponded() { - return (this[SYM_RESP] !== undefined); - } - getType() { - return this[SYM_TYPE]; - } - getContext() { - return this[SYM_CTX]; - } - } - function respond(protocol, req, data) { - req[SYM_RESP] = data; - return processResponses(protocol); - } - - function cleanup(protocol) { - protocol[SYM_BUFFER] = null; - if (protocol[SYM_MODE] === ROLE_CLIENT) { - const reqs = protocol[SYM_REQS]; - if (reqs && reqs.length) { - protocol[SYM_REQS] = []; - for (const req of reqs) - req.cb(new Error('No reply from server')); - } - } - - // Node streams hackery to make streams do the "right thing" - try { - protocol.end(); - } catch {} - setImmediate(() => { - if (!protocol[SYM_ENDED]) - protocol.emit('end'); - if (!protocol[SYM_CLOSED]) - protocol.emit('close'); - }); - } - - function onClose() { - this[SYM_CLOSED] = true; - } - - function onEnd() { - this[SYM_ENDED] = true; - } - - const SYM_REQS = Symbol('Requests'); - const SYM_MODE = Symbol('Agent Protocol Role'); - const SYM_BUFFER = Symbol('Agent Protocol Buffer'); - const SYM_MSGLEN = Symbol('Agent Protocol Current Message Length'); - const SYM_CLOSED = Symbol('Agent Protocol Closed'); - const SYM_ENDED = Symbol('Agent Protocol Ended'); - // Implementation based on: - // https://tools.ietf.org/html/draft-miller-ssh-agent-04 - return class AgentProtocol extends Duplex { - /* - Notes: - - `constraint` type consists of: - byte constraint_type - byte[] constraint_data - where `constraint_type` is one of: - * SSH_AGENT_CONSTRAIN_LIFETIME - - `constraint_data` consists of: - uint32 seconds - * SSH_AGENT_CONSTRAIN_CONFIRM - - `constraint_data` N/A - * SSH_AGENT_CONSTRAIN_EXTENSION - - `constraint_data` consists of: - string extension name - byte[] extension-specific details - */ - - constructor(isClient) { - super({ autoDestroy: true, emitClose: false }); - this[SYM_MODE] = (isClient ? ROLE_CLIENT : ROLE_SERVER); - this[SYM_REQS] = []; - this[SYM_BUFFER] = null; - this[SYM_MSGLEN] = -1; - this.once('end', onEnd); - this.once('close', onClose); - } - - _read(n) {} - - _write(data, encoding, cb) { - /* - Messages are of the format: - uint32 message length - byte message type - byte[message length - 1] message contents - */ - if (this[SYM_BUFFER] === null) - this[SYM_BUFFER] = data; - else - this[SYM_BUFFER] = concat(this[SYM_BUFFER], data); - - let buffer = this[SYM_BUFFER]; - let bufferLen = buffer.length; - - let p = 0; - while (p < bufferLen) { - // Wait for length + type - if (bufferLen < 5) - break; - - if (this[SYM_MSGLEN] === -1) - this[SYM_MSGLEN] = readUInt32BE(buffer, p); - - // Check if we have the entire message - if (bufferLen < (4 + this[SYM_MSGLEN])) - break; - - const msgType = buffer[p += 4]; - ++p; - - if (this[SYM_MODE] === ROLE_CLIENT) { - if (this[SYM_REQS].length === 0) - return cb(new Error('Received unexpected message from server')); - - const req = this[SYM_REQS].shift(); - - switch (msgType) { - case SSH_AGENT_FAILURE: - req.cb(new Error('Agent responded with failure')); - break; - case SSH_AGENT_IDENTITIES_ANSWER: { - if (req.type !== SSH_AGENTC_REQUEST_IDENTITIES) - return cb(new Error('Agent responded with wrong message type')); - - /* - byte SSH_AGENT_IDENTITIES_ANSWER - uint32 nkeys - - where `nkeys` is 0 or more of: - string key blob - string comment - */ - - binaryParser.init(buffer, p); - - const numKeys = binaryParser.readUInt32BE(); - - if (numKeys === undefined) { - binaryParser.clear(); - return cb(new Error('Malformed agent response')); - } - - const keys = []; - for (let i = 0; i < numKeys; ++i) { - let pubKey = binaryParser.readString(); - if (pubKey === undefined) { - binaryParser.clear(); - return cb(new Error('Malformed agent response')); - } - - const comment = binaryParser.readString(true); - if (comment === undefined) { - binaryParser.clear(); - return cb(new Error('Malformed agent response')); - } - - pubKey = parseKey(pubKey); - // We continue parsing the packet if we encounter an error - // in case the error is due to the key being an unsupported - // type - if (pubKey instanceof Error) - continue; - - pubKey.comment = pubKey.comment || comment; - - keys.push(pubKey); - } - p = binaryParser.pos(); - binaryParser.clear(); - - req.cb(null, keys); - break; - } - case SSH_AGENT_SIGN_RESPONSE: { - if (req.type !== SSH_AGENTC_SIGN_REQUEST) - return cb(new Error('Agent responded with wrong message type')); - - /* - byte SSH_AGENT_SIGN_RESPONSE - string signature - */ - - binaryParser.init(buffer, p); - let signature = binaryParser.readString(); - p = binaryParser.pos(); - binaryParser.clear(); - - if (signature === undefined) - return cb(new Error('Malformed agent response')); - - // We strip the algorithm from OpenSSH's output and assume it's - // using the algorithm we specified. This makes it easier on - // custom Agent implementations so they don't have to construct - // the correct binary format for a (OpenSSH-style) signature. - - // TODO: verify signature type based on key and options used - // during initial sign request - binaryParser.init(signature, 0); - binaryParser.readString(true); - signature = binaryParser.readString(); - binaryParser.clear(); - - if (signature === undefined) - return cb(new Error('Malformed OpenSSH signature format')); - - req.cb(null, signature); - break; - } - default: - return cb( - new Error('Agent responded with unsupported message type') - ); - } - } else { - switch (msgType) { - case SSH_AGENTC_REQUEST_IDENTITIES: { - const req = new AgentInboundRequest(msgType); - this[SYM_REQS].push(req); - /* - byte SSH_AGENTC_REQUEST_IDENTITIES - */ - this.emit('identities', req); - break; - } - case SSH_AGENTC_SIGN_REQUEST: { - /* - byte SSH_AGENTC_SIGN_REQUEST - string key_blob - string data - uint32 flags - */ - binaryParser.init(buffer, p); - let pubKey = binaryParser.readString(); - const data = binaryParser.readString(); - const flagsVal = binaryParser.readUInt32BE(); - p = binaryParser.pos(); - binaryParser.clear(); - if (flagsVal === undefined) { - const req = new AgentInboundRequest(msgType); - this[SYM_REQS].push(req); - return this.failureReply(req); - } - - pubKey = parseKey(pubKey); - if (pubKey instanceof Error) { - const req = new AgentInboundRequest(msgType); - this[SYM_REQS].push(req); - return this.failureReply(req); - } - - const flags = { - hash: undefined, - }; - let ctx; - if (pubKey.type === 'ssh-rsa') { - if (flagsVal & SSH_AGENT_RSA_SHA2_256) { - ctx = 'rsa-sha2-256'; - flags.hash = 'sha256'; - } else if (flagsVal & SSH_AGENT_RSA_SHA2_512) { - ctx = 'rsa-sha2-512'; - flags.hash = 'sha512'; - } - } - if (ctx === undefined) - ctx = pubKey.type; - - const req = new AgentInboundRequest(msgType, ctx); - this[SYM_REQS].push(req); - - this.emit('sign', req, pubKey, data, flags); - break; - } - default: { - const req = new AgentInboundRequest(msgType); - this[SYM_REQS].push(req); - this.failureReply(req); - } - } - } - - // Get ready for next message - this[SYM_MSGLEN] = -1; - if (p === bufferLen) { - // Nothing left to process for now - this[SYM_BUFFER] = null; - break; - } else { - this[SYM_BUFFER] = buffer = buffer.slice(p); - bufferLen = buffer.length; - p = 0; - } - } - - cb(); - } - - _destroy(err, cb) { - cleanup(this); - cb(); - } - - _final(cb) { - cleanup(this); - cb(); - } - - // Client->Server messages ================================================= - sign(pubKey, data, options, cb) { - if (this[SYM_MODE] !== ROLE_CLIENT) - throw new Error('Client-only method called with server role'); - - if (typeof options === 'function') { - cb = options; - options = undefined; - } else if (typeof options !== 'object' || options === null) { - options = undefined; - } - - let flags = 0; - - pubKey = parseKey(pubKey); - if (pubKey instanceof Error) - throw new Error('Invalid public key argument'); - - if (pubKey.type === 'ssh-rsa' && options) { - switch (options.hash) { - case 'sha256': - flags = SSH_AGENT_RSA_SHA2_256; - break; - case 'sha512': - flags = SSH_AGENT_RSA_SHA2_512; - break; - } - } - pubKey = pubKey.getPublicSSH(); - - /* - byte SSH_AGENTC_SIGN_REQUEST - string key_blob - string data - uint32 flags - */ - const type = SSH_AGENTC_SIGN_REQUEST; - const keyLen = pubKey.length; - const dataLen = data.length; - let p = 0; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + keyLen + 4 + dataLen + 4); - - writeUInt32BE(buf, buf.length - 4, p); - - buf[p += 4] = type; - - writeUInt32BE(buf, keyLen, ++p); - pubKey.copy(buf, p += 4); - - writeUInt32BE(buf, dataLen, p += keyLen); - data.copy(buf, p += 4); - - writeUInt32BE(buf, flags, p += dataLen); - - if (typeof cb !== 'function') - cb = noop; - - this[SYM_REQS].push({ type, cb }); - - return this.push(buf); - } - getIdentities(cb) { - if (this[SYM_MODE] !== ROLE_CLIENT) - throw new Error('Client-only method called with server role'); - - /* - byte SSH_AGENTC_REQUEST_IDENTITIES - */ - const type = SSH_AGENTC_REQUEST_IDENTITIES; - - let p = 0; - const buf = Buffer.allocUnsafe(4 + 1); - - writeUInt32BE(buf, buf.length - 4, p); - - buf[p += 4] = type; - - if (typeof cb !== 'function') - cb = noop; - - this[SYM_REQS].push({ type, cb }); - - return this.push(buf); - } - - // Server->Client messages ================================================= - failureReply(req) { - if (this[SYM_MODE] !== ROLE_SERVER) - throw new Error('Server-only method called with client role'); - - if (!(req instanceof AgentInboundRequest)) - throw new Error('Wrong request argument'); - - if (req.hasResponded()) - return true; - - let p = 0; - const buf = Buffer.allocUnsafe(4 + 1); - - writeUInt32BE(buf, buf.length - 4, p); - - buf[p += 4] = SSH_AGENT_FAILURE; - - return respond(this, req, buf); - } - getIdentitiesReply(req, keys) { - if (this[SYM_MODE] !== ROLE_SERVER) - throw new Error('Server-only method called with client role'); - - if (!(req instanceof AgentInboundRequest)) - throw new Error('Wrong request argument'); - - if (req.hasResponded()) - return true; - - /* - byte SSH_AGENT_IDENTITIES_ANSWER - uint32 nkeys - - where `nkeys` is 0 or more of: - string key blob - string comment - */ - - if (req.getType() !== SSH_AGENTC_REQUEST_IDENTITIES) - throw new Error('Invalid response to request'); - - if (!Array.isArray(keys)) - throw new Error('Keys argument must be an array'); - - let totalKeysLen = 4; // Include `nkeys` size - - const newKeys = []; - for (let i = 0; i < keys.length; ++i) { - const entry = keys[i]; - if (typeof entry !== 'object' || entry === null) - throw new Error(`Invalid key entry: ${entry}`); - - let pubKey; - let comment; - if (isParsedKey(entry)) { - pubKey = entry; - } else if (isParsedKey(entry.pubKey)) { - pubKey = entry.pubKey; - } else { - if (typeof entry.pubKey !== 'object' || entry.pubKey === null) - continue; - ({ pubKey, comment } = entry.pubKey); - pubKey = parseKey(pubKey); - if (pubKey instanceof Error) - continue; // TODO: add debug output - } - comment = pubKey.comment || comment; - pubKey = pubKey.getPublicSSH(); - - totalKeysLen += 4 + pubKey.length; - - if (comment && typeof comment === 'string') - comment = Buffer.from(comment); - else if (!Buffer.isBuffer(comment)) - comment = EMPTY_BUF; - - totalKeysLen += 4 + comment.length; - - newKeys.push({ pubKey, comment }); - } - - let p = 0; - const buf = Buffer.allocUnsafe(4 + 1 + totalKeysLen); - - writeUInt32BE(buf, buf.length - 4, p); - - buf[p += 4] = SSH_AGENT_IDENTITIES_ANSWER; - - writeUInt32BE(buf, newKeys.length, ++p); - p += 4; - for (let i = 0; i < newKeys.length; ++i) { - const { pubKey, comment } = newKeys[i]; - - writeUInt32BE(buf, pubKey.length, p); - pubKey.copy(buf, p += 4); - - writeUInt32BE(buf, comment.length, p += pubKey.length); - p += 4; - if (comment.length) { - comment.copy(buf, p); - p += comment.length; - } - } - - return respond(this, req, buf); - } - signReply(req, signature) { - if (this[SYM_MODE] !== ROLE_SERVER) - throw new Error('Server-only method called with client role'); - - if (!(req instanceof AgentInboundRequest)) - throw new Error('Wrong request argument'); - - if (req.hasResponded()) - return true; - - /* - byte SSH_AGENT_SIGN_RESPONSE - string signature - */ - - if (req.getType() !== SSH_AGENTC_SIGN_REQUEST) - throw new Error('Invalid response to request'); - - if (!Buffer.isBuffer(signature)) - throw new Error('Signature argument must be a Buffer'); - - if (signature.length === 0) - throw new Error('Signature argument must be non-empty'); - - /* - OpenSSH agent signatures are encoded as: - - string signature format identifier (as specified by the - public key/certificate format) - byte[n] signature blob in format specific encoding. - - This is actually a `string` for: rsa, dss, ecdsa, and ed25519 - types - */ - - let p = 0; - const sigFormat = req.getContext(); - const sigFormatLen = Buffer.byteLength(sigFormat); - const buf = Buffer.allocUnsafe( - 4 + 1 + 4 + 4 + sigFormatLen + 4 + signature.length - ); - - writeUInt32BE(buf, buf.length - 4, p); - - buf[p += 4] = SSH_AGENT_SIGN_RESPONSE; - - writeUInt32BE(buf, 4 + sigFormatLen + 4 + signature.length, ++p); - writeUInt32BE(buf, sigFormatLen, p += 4); - buf.utf8Write(sigFormat, p += 4, sigFormatLen); - writeUInt32BE(buf, signature.length, p += sigFormatLen); - signature.copy(buf, p += 4); - - return respond(this, req, buf); - } - }; -})(); - -const SYM_AGENT = Symbol('Agent'); -const SYM_AGENT_KEYS = Symbol('Agent Keys'); -const SYM_AGENT_KEYS_IDX = Symbol('Agent Keys Index'); -const SYM_AGENT_CBS = Symbol('Agent Init Callbacks'); -class AgentContext { - constructor(agent) { - if (typeof agent === 'string') - agent = createAgent(agent); - else if (!isAgent(agent)) - throw new Error('Invalid agent argument'); - this[SYM_AGENT] = agent; - this[SYM_AGENT_KEYS] = null; - this[SYM_AGENT_KEYS_IDX] = -1; - this[SYM_AGENT_CBS] = null; - } - init(cb) { - if (typeof cb !== 'function') - cb = noop; - - if (this[SYM_AGENT_KEYS] === null) { - if (this[SYM_AGENT_CBS] === null) { - this[SYM_AGENT_CBS] = [cb]; - - const doCbs = (...args) => { - process.nextTick(() => { - const cbs = this[SYM_AGENT_CBS]; - this[SYM_AGENT_CBS] = null; - for (const cb of cbs) - cb(...args); - }); - }; - - this[SYM_AGENT].getIdentities(once((err, keys) => { - if (err) - return doCbs(err); - - if (!Array.isArray(keys)) { - return doCbs(new Error( - 'Agent implementation failed to provide keys' - )); - } - - const newKeys = []; - for (let key of keys) { - key = parseKey(key); - if (key instanceof Error) { - // TODO: add debug output - continue; - } - newKeys.push(key); - } - - this[SYM_AGENT_KEYS] = newKeys; - this[SYM_AGENT_KEYS_IDX] = -1; - doCbs(); - })); - } else { - this[SYM_AGENT_CBS].push(cb); - } - } else { - process.nextTick(cb); - } - } - nextKey() { - if (this[SYM_AGENT_KEYS] === null - || ++this[SYM_AGENT_KEYS_IDX] >= this[SYM_AGENT_KEYS].length) { - return false; - } - - return this[SYM_AGENT_KEYS][this[SYM_AGENT_KEYS_IDX]]; - } - currentKey() { - if (this[SYM_AGENT_KEYS] === null - || this[SYM_AGENT_KEYS_IDX] >= this[SYM_AGENT_KEYS].length) { - return null; - } - - return this[SYM_AGENT_KEYS][this[SYM_AGENT_KEYS_IDX]]; - } - pos() { - if (this[SYM_AGENT_KEYS] === null - || this[SYM_AGENT_KEYS_IDX] >= this[SYM_AGENT_KEYS].length) { - return -1; - } - - return this[SYM_AGENT_KEYS_IDX]; - } - reset() { - this[SYM_AGENT_KEYS_IDX] = -1; - } - - sign(...args) { - this[SYM_AGENT].sign(...args); - } -} - -function isAgent(val) { - return (val instanceof BaseAgent); -} - -module.exports = { - AgentContext, - AgentProtocol, - BaseAgent, - createAgent, - CygwinAgent, - isAgent, - OpenSSHAgent, - PageantAgent, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/client.js b/reverse_engineering/node_modules/ssh2/lib/client.js deleted file mode 100644 index 7c16c7ba..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/client.js +++ /dev/null @@ -1,2013 +0,0 @@ -// TODO: -// * add `.connected` or similar property to allow immediate connection -// status checking -// * add/improve debug output during user authentication phase -'use strict'; - -const { - createHash, - getHashes, - randomFillSync, -} = require('crypto'); -const { Socket } = require('net'); -const { lookup: dnsLookup } = require('dns'); -const EventEmitter = require('events'); -const HASHES = getHashes(); - -const { - COMPAT, - CHANNEL_EXTENDED_DATATYPE: { STDERR }, - CHANNEL_OPEN_FAILURE, - DEFAULT_CIPHER, - DEFAULT_COMPRESSION, - DEFAULT_KEX, - DEFAULT_MAC, - DEFAULT_SERVER_HOST_KEY, - DISCONNECT_REASON, - DISCONNECT_REASON_BY_VALUE, - SUPPORTED_CIPHER, - SUPPORTED_COMPRESSION, - SUPPORTED_KEX, - SUPPORTED_MAC, - SUPPORTED_SERVER_HOST_KEY, -} = require('./protocol/constants.js'); -const { init: cryptoInit } = require('./protocol/crypto.js'); -const Protocol = require('./protocol/Protocol.js'); -const { parseKey } = require('./protocol/keyParser.js'); -const { SFTP } = require('./protocol/SFTP.js'); -const { - bufferCopy, - makeBufferParser, - makeError, - readUInt32BE, - sigSSHToASN1, - writeUInt32BE, -} = require('./protocol/utils.js'); - -const { AgentContext, createAgent, isAgent } = require('./agent.js'); -const { - Channel, - MAX_WINDOW, - PACKET_SIZE, - windowAdjust, - WINDOW_THRESHOLD, -} = require('./Channel.js'); -const { - ChannelManager, - generateAlgorithmList, - isWritable, - onChannelOpenFailure, - onCHANNEL_CLOSE, -} = require('./utils.js'); - -const bufferParser = makeBufferParser(); -const sigParser = makeBufferParser(); -const RE_OPENSSH = /^OpenSSH_(?:(?![0-4])\d)|(?:\d{2,})/; -const noop = (err) => {}; - -class Client extends EventEmitter { - constructor() { - super(); - - this.config = { - host: undefined, - port: undefined, - localAddress: undefined, - localPort: undefined, - forceIPv4: undefined, - forceIPv6: undefined, - keepaliveCountMax: undefined, - keepaliveInterval: undefined, - readyTimeout: undefined, - ident: undefined, - - username: undefined, - password: undefined, - privateKey: undefined, - tryKeyboard: undefined, - agent: undefined, - allowAgentFwd: undefined, - authHandler: undefined, - - hostHashAlgo: undefined, - hostHashCb: undefined, - strictVendor: undefined, - debug: undefined - }; - - this._agent = undefined; - this._readyTimeout = undefined; - this._chanMgr = undefined; - this._callbacks = undefined; - this._forwarding = undefined; - this._forwardingUnix = undefined; - this._acceptX11 = undefined; - this._agentFwdEnabled = undefined; - this._remoteVer = undefined; - - this._protocol = undefined; - this._sock = undefined; - this._resetKA = undefined; - } - - connect(cfg) { - if (this._sock && isWritable(this._sock)) { - this.once('close', () => { - this.connect(cfg); - }); - this.end(); - return this; - } - - this.config.host = cfg.hostname || cfg.host || 'localhost'; - this.config.port = cfg.port || 22; - this.config.localAddress = (typeof cfg.localAddress === 'string' - ? cfg.localAddress - : undefined); - this.config.localPort = (typeof cfg.localPort === 'string' - || typeof cfg.localPort === 'number' - ? cfg.localPort - : undefined); - this.config.forceIPv4 = cfg.forceIPv4 || false; - this.config.forceIPv6 = cfg.forceIPv6 || false; - this.config.keepaliveCountMax = (typeof cfg.keepaliveCountMax === 'number' - && cfg.keepaliveCountMax >= 0 - ? cfg.keepaliveCountMax - : 3); - this.config.keepaliveInterval = (typeof cfg.keepaliveInterval === 'number' - && cfg.keepaliveInterval > 0 - ? cfg.keepaliveInterval - : 0); - this.config.readyTimeout = (typeof cfg.readyTimeout === 'number' - && cfg.readyTimeout >= 0 - ? cfg.readyTimeout - : 20000); - this.config.ident = (typeof cfg.ident === 'string' - || Buffer.isBuffer(cfg.ident) - ? cfg.ident - : undefined); - - const algorithms = { - kex: undefined, - serverHostKey: undefined, - cs: { - cipher: undefined, - mac: undefined, - compress: undefined, - lang: [], - }, - sc: undefined, - }; - let allOfferDefaults = true; - if (typeof cfg.algorithms === 'object' && cfg.algorithms !== null) { - algorithms.kex = generateAlgorithmList(cfg.algorithms.kex, - DEFAULT_KEX, - SUPPORTED_KEX); - if (algorithms.kex !== DEFAULT_KEX) - allOfferDefaults = false; - - algorithms.serverHostKey = - generateAlgorithmList(cfg.algorithms.serverHostKey, - DEFAULT_SERVER_HOST_KEY, - SUPPORTED_SERVER_HOST_KEY); - if (algorithms.serverHostKey !== DEFAULT_SERVER_HOST_KEY) - allOfferDefaults = false; - - algorithms.cs.cipher = generateAlgorithmList(cfg.algorithms.cipher, - DEFAULT_CIPHER, - SUPPORTED_CIPHER); - if (algorithms.cs.cipher !== DEFAULT_CIPHER) - allOfferDefaults = false; - - algorithms.cs.mac = generateAlgorithmList(cfg.algorithms.hmac, - DEFAULT_MAC, - SUPPORTED_MAC); - if (algorithms.cs.mac !== DEFAULT_MAC) - allOfferDefaults = false; - - algorithms.cs.compress = generateAlgorithmList(cfg.algorithms.compress, - DEFAULT_COMPRESSION, - SUPPORTED_COMPRESSION); - if (algorithms.cs.compress !== DEFAULT_COMPRESSION) - allOfferDefaults = false; - - if (!allOfferDefaults) - algorithms.sc = algorithms.cs; - } - - if (typeof cfg.username === 'string') - this.config.username = cfg.username; - else if (typeof cfg.user === 'string') - this.config.username = cfg.user; - else - throw new Error('Invalid username'); - - this.config.password = (typeof cfg.password === 'string' - ? cfg.password - : undefined); - this.config.privateKey = (typeof cfg.privateKey === 'string' - || Buffer.isBuffer(cfg.privateKey) - ? cfg.privateKey - : undefined); - this.config.localHostname = (typeof cfg.localHostname === 'string' - ? cfg.localHostname - : undefined); - this.config.localUsername = (typeof cfg.localUsername === 'string' - ? cfg.localUsername - : undefined); - this.config.tryKeyboard = (cfg.tryKeyboard === true); - if (typeof cfg.agent === 'string' && cfg.agent.length) - this.config.agent = createAgent(cfg.agent); - else if (isAgent(cfg.agent)) - this.config.agent = cfg.agent; - else - this.config.agent = undefined; - this.config.allowAgentFwd = (cfg.agentForward === true - && this.config.agent !== undefined); - let authHandler = this.config.authHandler = ( - typeof cfg.authHandler === 'function' - || Array.isArray(cfg.authHandler) - ? cfg.authHandler - : undefined - ); - - this.config.strictVendor = (typeof cfg.strictVendor === 'boolean' - ? cfg.strictVendor - : true); - - const debug = this.config.debug = (typeof cfg.debug === 'function' - ? cfg.debug - : undefined); - - if (cfg.agentForward === true && !this.config.allowAgentFwd) { - throw new Error( - 'You must set a valid agent path to allow agent forwarding' - ); - } - - let callbacks = this._callbacks = []; - this._chanMgr = new ChannelManager(this); - this._forwarding = {}; - this._forwardingUnix = {}; - this._acceptX11 = 0; - this._agentFwdEnabled = false; - this._agent = (this.config.agent ? this.config.agent : undefined); - this._remoteVer = undefined; - let privateKey; - - if (this.config.privateKey) { - privateKey = parseKey(this.config.privateKey, cfg.passphrase); - if (privateKey instanceof Error) - throw new Error(`Cannot parse privateKey: ${privateKey.message}`); - if (Array.isArray(privateKey)) { - // OpenSSH's newer format only stores 1 key for now - privateKey = privateKey[0]; - } - if (privateKey.getPrivatePEM() === null) { - throw new Error( - 'privateKey value does not contain a (valid) private key' - ); - } - } - - let hostVerifier; - if (typeof cfg.hostVerifier === 'function') { - const hashCb = cfg.hostVerifier; - let hasher; - if (HASHES.indexOf(cfg.hostHash) !== -1) { - // Default to old behavior of hashing on user's behalf - hasher = createHash(cfg.hostHash); - } - hostVerifier = (key, verify) => { - if (hasher) { - hasher.update(key); - key = hasher.digest('hex'); - } - const ret = hashCb(key, verify); - if (ret !== undefined) - verify(ret); - }; - } - - const sock = this._sock = (cfg.sock || new Socket()); - let ready = false; - let sawHeader = false; - if (this._protocol) - this._protocol.cleanup(); - const DEBUG_HANDLER = (!debug ? undefined : (p, display, msg) => { - debug(`Debug output from server: ${JSON.stringify(msg)}`); - }); - const proto = this._protocol = new Protocol({ - ident: this.config.ident, - offer: (allOfferDefaults ? undefined : algorithms), - onWrite: (data) => { - if (isWritable(sock)) - sock.write(data); - }, - onError: (err) => { - if (err.level === 'handshake') - clearTimeout(this._readyTimeout); - if (!proto._destruct) - sock.removeAllListeners('data'); - this.emit('error', err); - try { - sock.end(); - } catch {} - }, - onHeader: (header) => { - sawHeader = true; - this._remoteVer = header.versions.software; - if (header.greeting) - this.emit('greeting', header.greeting); - }, - onHandshakeComplete: (negotiated) => { - this.emit('handshake', negotiated); - if (!ready) { - ready = true; - proto.service('ssh-userauth'); - } - }, - debug, - hostVerifier, - messageHandlers: { - DEBUG: DEBUG_HANDLER, - DISCONNECT: (p, reason, desc) => { - if (reason !== DISCONNECT_REASON.BY_APPLICATION) { - if (!desc) { - desc = DISCONNECT_REASON_BY_VALUE[reason]; - if (desc === undefined) - desc = `Unexpected disconnection reason: ${reason}`; - } - const err = new Error(desc); - err.code = reason; - this.emit('error', err); - } - sock.end(); - }, - SERVICE_ACCEPT: (p, name) => { - if (name === 'ssh-userauth') - tryNextAuth(); - }, - USERAUTH_BANNER: (p, msg) => { - this.emit('banner', msg); - }, - USERAUTH_SUCCESS: (p) => { - // Start keepalive mechanism - resetKA(); - - clearTimeout(this._readyTimeout); - - this.emit('ready'); - }, - USERAUTH_FAILURE: (p, authMethods, partialSuccess) => { - if (curAuth.type === 'agent') { - const pos = curAuth.agentCtx.pos(); - debug && debug(`Client: Agent key #${pos + 1} failed`); - return tryNextAgentKey(); - } - - debug && debug(`Client: ${curAuth.type} auth failed`); - - curPartial = partialSuccess; - curAuthsLeft = authMethods; - tryNextAuth(); - }, - USERAUTH_PASSWD_CHANGEREQ: (p, prompt) => { - if (curAuth.type === 'password') { - // TODO: support a `changePrompt()` on `curAuth` that defaults to - // emitting 'change password' as before - this.emit('change password', prompt, (newPassword) => { - proto.authPassword( - this.config.username, - this.config.password, - newPassword - ); - }); - } - }, - USERAUTH_PK_OK: (p) => { - if (curAuth.type === 'agent') { - const key = curAuth.agentCtx.currentKey(); - proto.authPK(curAuth.username, key, (buf, cb) => { - curAuth.agentCtx.sign(key, buf, {}, (err, signed) => { - if (err) { - err.level = 'agent'; - this.emit('error', err); - } else { - return cb(signed); - } - - tryNextAgentKey(); - }); - }); - } else if (curAuth.type === 'publickey') { - proto.authPK(curAuth.username, curAuth.key, (buf, cb) => { - const signature = curAuth.key.sign(buf); - if (signature instanceof Error) { - signature.message = - `Error signing data with key: ${signature.message}`; - signature.level = 'client-authentication'; - this.emit('error', signature); - return tryNextAuth(); - } - cb(signature); - }); - } - }, - USERAUTH_INFO_REQUEST: (p, name, instructions, prompts) => { - if (curAuth.type === 'keyboard-interactive') { - const nprompts = (Array.isArray(prompts) ? prompts.length : 0); - if (nprompts === 0) { - debug && debug( - 'Client: Sending automatic USERAUTH_INFO_RESPONSE' - ); - proto.authInfoRes(); - return; - } - // We sent a keyboard-interactive user authentication request and - // now the server is sending us the prompts we need to present to - // the user - curAuth.prompt( - name, - instructions, - '', - prompts, - (answers) => { - proto.authInfoRes(answers); - } - ); - } - }, - REQUEST_SUCCESS: (p, data) => { - if (callbacks.length) - callbacks.shift()(false, data); - }, - REQUEST_FAILURE: (p) => { - if (callbacks.length) - callbacks.shift()(true); - }, - GLOBAL_REQUEST: (p, name, wantReply, data) => { - switch (name) { - case 'hostkeys-00@openssh.com': - // Automatically verify keys before passing to end user - hostKeysProve(this, data, (err, keys) => { - if (err) - return; - this.emit('hostkeys', keys); - }); - if (wantReply) - proto.requestSuccess(); - break; - default: - // Auto-reject all other global requests, this can be especially - // useful if the server is sending us dummy keepalive global - // requests - if (wantReply) - proto.requestFailure(); - } - }, - CHANNEL_OPEN: (p, info) => { - // Handle incoming requests from server, typically a forwarded TCP or - // X11 connection - onCHANNEL_OPEN(this, info); - }, - CHANNEL_OPEN_CONFIRMATION: (p, info) => { - const channel = this._chanMgr.get(info.recipient); - if (typeof channel !== 'function') - return; - - const isSFTP = (channel.type === 'sftp'); - const type = (isSFTP ? 'session' : channel.type); - const chanInfo = { - type, - incoming: { - id: info.recipient, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - const instance = ( - isSFTP - ? new SFTP(this, chanInfo, { debug }) - : new Channel(this, chanInfo) - ); - this._chanMgr.update(info.recipient, instance); - channel(undefined, instance); - }, - CHANNEL_OPEN_FAILURE: (p, recipient, reason, description) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'function') - return; - - const info = { reason, description }; - onChannelOpenFailure(this, recipient, info, channel); - }, - CHANNEL_DATA: (p, recipient, data) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - // The remote party should not be sending us data if there is no - // window space available ... - // TODO: raise error on data with not enough window? - if (channel.incoming.window === 0) - return; - - channel.incoming.window -= data.length; - - if (channel.push(data) === false) { - channel._waitChanDrain = true; - return; - } - - if (channel.incoming.window <= WINDOW_THRESHOLD) - windowAdjust(channel); - }, - CHANNEL_EXTENDED_DATA: (p, recipient, data, type) => { - if (type !== STDERR) - return; - - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - // The remote party should not be sending us data if there is no - // window space available ... - // TODO: raise error on data with not enough window? - if (channel.incoming.window === 0) - return; - - channel.incoming.window -= data.length; - - if (!channel.stderr.push(data)) { - channel._waitChanDrain = true; - return; - } - - if (channel.incoming.window <= WINDOW_THRESHOLD) - windowAdjust(channel); - }, - CHANNEL_WINDOW_ADJUST: (p, recipient, amount) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - // The other side is allowing us to send `amount` more bytes of data - channel.outgoing.window += amount; - - if (channel._waitWindow) { - channel._waitWindow = false; - - if (channel._chunk) { - channel._write(channel._chunk, null, channel._chunkcb); - } else if (channel._chunkcb) { - channel._chunkcb(); - } else if (channel._chunkErr) { - channel.stderr._write(channel._chunkErr, - null, - channel._chunkcbErr); - } else if (channel._chunkcbErr) { - channel._chunkcbErr(); - } - } - }, - CHANNEL_SUCCESS: (p, recipient) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - this._resetKA(); - - if (channel._callbacks.length) - channel._callbacks.shift()(false); - }, - CHANNEL_FAILURE: (p, recipient) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - this._resetKA(); - - if (channel._callbacks.length) - channel._callbacks.shift()(true); - }, - CHANNEL_REQUEST: (p, recipient, type, wantReply, data) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - const exit = channel._exit; - if (exit.code !== undefined) - return; - switch (type) { - case 'exit-status': - channel.emit('exit', exit.code = data); - return; - case 'exit-signal': - channel.emit('exit', - exit.code = null, - exit.signal = `SIG${data.signal}`, - exit.dump = data.coreDumped, - exit.desc = data.errorMessage); - return; - } - - // Keepalive request? OpenSSH will send one as a channel request if - // there is a channel open - - if (wantReply) - p.channelFailure(channel.outgoing.id); - }, - CHANNEL_EOF: (p, recipient) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.incoming.state !== 'open') - return; - channel.incoming.state = 'eof'; - - if (channel.readable) - channel.push(null); - if (channel.stderr.readable) - channel.stderr.push(null); - }, - CHANNEL_CLOSE: (p, recipient) => { - onCHANNEL_CLOSE(this, recipient, this._chanMgr.get(recipient)); - }, - }, - }); - - sock.pause(); - - // TODO: check keepalive implementation - // Keepalive-related - const kainterval = this.config.keepaliveInterval; - const kacountmax = this.config.keepaliveCountMax; - let kacount = 0; - let katimer; - const sendKA = () => { - if (++kacount > kacountmax) { - clearInterval(katimer); - if (sock.readable) { - const err = new Error('Keepalive timeout'); - err.level = 'client-timeout'; - this.emit('error', err); - sock.destroy(); - } - return; - } - if (isWritable(sock)) { - // Append dummy callback to keep correct callback order - callbacks.push(resetKA); - proto.ping(); - } else { - clearInterval(katimer); - } - }; - function resetKA() { - if (kainterval > 0) { - kacount = 0; - clearInterval(katimer); - if (isWritable(sock)) - katimer = setInterval(sendKA, kainterval); - } - } - this._resetKA = resetKA; - - const onDone = (() => { - let called = false; - return () => { - if (called) - return; - called = true; - if (wasConnected && !sawHeader) { - const err = - makeError('Connection lost before handshake', 'protocol', true); - this.emit('error', err); - } - }; - })(); - const onConnect = (() => { - let called = false; - return () => { - if (called) - return; - called = true; - - wasConnected = true; - debug && debug('Socket connected'); - this.emit('connect'); - - cryptoInit.then(() => { - sock.on('data', (data) => { - try { - proto.parse(data, 0, data.length); - } catch (ex) { - this.emit('error', ex); - try { - if (isWritable(sock)) - sock.end(); - } catch {} - } - }); - - // Drain stderr if we are connection hopping using an exec stream - if (sock.stderr && typeof sock.stderr.resume === 'function') - sock.stderr.resume(); - - sock.resume(); - }).catch((err) => { - this.emit('error', err); - try { - if (isWritable(sock)) - sock.end(); - } catch {} - }); - }; - })(); - let wasConnected = false; - sock.on('connect', onConnect) - .on('timeout', () => { - this.emit('timeout'); - }).on('error', (err) => { - debug && debug(`Socket error: ${err.message}`); - clearTimeout(this._readyTimeout); - err.level = 'client-socket'; - this.emit('error', err); - }).on('end', () => { - debug && debug('Socket ended'); - onDone(); - proto.cleanup(); - clearTimeout(this._readyTimeout); - clearInterval(katimer); - this.emit('end'); - }).on('close', () => { - debug && debug('Socket closed'); - onDone(); - proto.cleanup(); - clearTimeout(this._readyTimeout); - clearInterval(katimer); - this.emit('close'); - - // Notify outstanding channel requests of disconnection ... - const callbacks_ = callbacks; - callbacks = this._callbacks = []; - const err = new Error('No response from server'); - for (let i = 0; i < callbacks_.length; ++i) - callbacks_[i](err); - - // Simulate error for any channels waiting to be opened - this._chanMgr.cleanup(err); - }); - - // Begin authentication handling =========================================== - let curAuth; - let curPartial = null; - let curAuthsLeft = null; - const authsAllowed = ['none']; - if (this.config.password !== undefined) - authsAllowed.push('password'); - if (privateKey !== undefined) - authsAllowed.push('publickey'); - if (this._agent !== undefined) - authsAllowed.push('agent'); - if (this.config.tryKeyboard) - authsAllowed.push('keyboard-interactive'); - if (privateKey !== undefined - && this.config.localHostname !== undefined - && this.config.localUsername !== undefined) { - authsAllowed.push('hostbased'); - } - - if (Array.isArray(authHandler)) - authHandler = makeSimpleAuthHandler(authHandler); - else if (typeof authHandler !== 'function') - authHandler = makeSimpleAuthHandler(authsAllowed); - - let hasSentAuth = false; - const doNextAuth = (nextAuth) => { - if (hasSentAuth) - return; - hasSentAuth = true; - - if (nextAuth === false) { - const err = new Error('All configured authentication methods failed'); - err.level = 'client-authentication'; - this.emit('error', err); - this.end(); - return; - } - - if (typeof nextAuth === 'string') { - // Remain backwards compatible with original `authHandler()` usage, - // which only supported passing names of next method to try using data - // from the `connect()` config object - - const type = nextAuth; - if (authsAllowed.indexOf(type) === -1) - return skipAuth(`Authentication method not allowed: ${type}`); - - const username = this.config.username; - switch (type) { - case 'password': - nextAuth = { type, username, password: this.config.password }; - break; - case 'publickey': - nextAuth = { type, username, key: privateKey }; - break; - case 'hostbased': - nextAuth = { - type, - username, - key: privateKey, - localHostname: this.config.localHostname, - localUsername: this.config.localUsername, - }; - break; - case 'agent': - nextAuth = { - type, - username, - agentCtx: new AgentContext(this._agent), - }; - break; - case 'keyboard-interactive': - nextAuth = { - type, - username, - prompt: (...args) => this.emit('keyboard-interactive', ...args), - }; - break; - case 'none': - nextAuth = { type, username }; - break; - default: - return skipAuth( - `Skipping unsupported authentication method: ${nextAuth}` - ); - } - } else if (typeof nextAuth !== 'object' || nextAuth === null) { - return skipAuth( - `Skipping invalid authentication attempt: ${nextAuth}` - ); - } else { - const username = nextAuth.username; - if (typeof username !== 'string') { - return skipAuth( - `Skipping invalid authentication attempt: ${nextAuth}` - ); - } - const type = nextAuth.type; - switch (type) { - case 'password': { - const { password } = nextAuth; - if (typeof password !== 'string' && !Buffer.isBuffer(password)) - return skipAuth('Skipping invalid password auth attempt'); - nextAuth = { type, username, password }; - break; - } - case 'publickey': { - const key = parseKey(nextAuth.key, nextAuth.passphrase); - if (key instanceof Error) - return skipAuth('Skipping invalid key auth attempt'); - if (!key.isPrivateKey()) - return skipAuth('Skipping non-private key'); - nextAuth = { type, username, key }; - break; - } - case 'hostbased': { - const { localHostname, localUsername } = nextAuth; - const key = parseKey(nextAuth.key, nextAuth.passphrase); - if (key instanceof Error - || typeof localHostname !== 'string' - || typeof localUsername !== 'string') { - return skipAuth('Skipping invalid hostbased auth attempt'); - } - if (!key.isPrivateKey()) - return skipAuth('Skipping non-private key'); - nextAuth = { type, username, key, localHostname, localUsername }; - break; - } - case 'agent': { - let agent = nextAuth.agent; - if (typeof agent === 'string' && agent.length) { - agent = createAgent(agent); - } else if (!isAgent(agent)) { - return skipAuth( - `Skipping invalid agent: ${nextAuth.agent}` - ); - } - nextAuth = { type, username, agentCtx: new AgentContext(agent) }; - break; - } - case 'keyboard-interactive': { - const { prompt } = nextAuth; - if (typeof prompt !== 'function') { - return skipAuth( - 'Skipping invalid keyboard-interactive auth attempt' - ); - } - nextAuth = { type, username, prompt }; - break; - } - case 'none': - nextAuth = { type, username }; - break; - default: - return skipAuth( - `Skipping unsupported authentication method: ${nextAuth}` - ); - } - } - curAuth = nextAuth; - - // Begin authentication method's process - try { - const username = curAuth.username; - switch (curAuth.type) { - case 'password': - proto.authPassword(username, curAuth.password); - break; - case 'publickey': - proto.authPK(username, curAuth.key); - break; - case 'hostbased': - proto.authHostbased(username, - curAuth.key, - curAuth.localHostname, - curAuth.localUsername, - (buf, cb) => { - const signature = curAuth.key.sign(buf); - if (signature instanceof Error) { - signature.message = - `Error while signing with key: ${signature.message}`; - signature.level = 'client-authentication'; - this.emit('error', signature); - return tryNextAuth(); - } - - cb(signature); - }); - break; - case 'agent': - curAuth.agentCtx.init((err) => { - if (err) { - err.level = 'agent'; - this.emit('error', err); - return tryNextAuth(); - } - tryNextAgentKey(); - }); - break; - case 'keyboard-interactive': - proto.authKeyboard(username); - break; - case 'none': - proto.authNone(username); - break; - } - } finally { - hasSentAuth = false; - } - }; - - function skipAuth(msg) { - debug && debug(msg); - process.nextTick(tryNextAuth); - } - - function tryNextAuth() { - hasSentAuth = false; - const auth = authHandler(curAuthsLeft, curPartial, doNextAuth); - if (hasSentAuth || auth === undefined) - return; - doNextAuth(auth); - } - - const tryNextAgentKey = () => { - if (curAuth.type === 'agent') { - const key = curAuth.agentCtx.nextKey(); - if (key === false) { - debug && debug('Agent: No more keys left to try'); - debug && debug('Client: agent auth failed'); - tryNextAuth(); - } else { - const pos = curAuth.agentCtx.pos(); - debug && debug(`Agent: Trying key #${pos + 1}`); - proto.authPK(curAuth.username, key); - } - } - }; - - const startTimeout = () => { - if (this.config.readyTimeout > 0) { - this._readyTimeout = setTimeout(() => { - const err = new Error('Timed out while waiting for handshake'); - err.level = 'client-timeout'; - this.emit('error', err); - sock.destroy(); - }, this.config.readyTimeout); - } - }; - - if (!cfg.sock) { - let host = this.config.host; - const forceIPv4 = this.config.forceIPv4; - const forceIPv6 = this.config.forceIPv6; - - debug && debug(`Client: Trying ${host} on port ${this.config.port} ...`); - - const doConnect = () => { - startTimeout(); - sock.connect({ - host, - port: this.config.port, - localAddress: this.config.localAddress, - localPort: this.config.localPort - }); - sock.setNoDelay(true); - sock.setMaxListeners(0); - sock.setTimeout(typeof cfg.timeout === 'number' ? cfg.timeout : 0); - }; - - if ((!forceIPv4 && !forceIPv6) || (forceIPv4 && forceIPv6)) { - doConnect(); - } else { - dnsLookup(host, (forceIPv4 ? 4 : 6), (err, address, family) => { - if (err) { - const type = (forceIPv4 ? 'IPv4' : 'IPv6'); - const error = new Error( - `Error while looking up ${type} address for '${host}': ${err}` - ); - clearTimeout(this._readyTimeout); - error.level = 'client-dns'; - this.emit('error', error); - this.emit('close'); - return; - } - host = address; - doConnect(); - }); - } - } else { - // Custom socket passed in - startTimeout(); - if (typeof sock.connecting === 'boolean') { - // net.Socket - - if (!sock.connecting) { - // Already connected - onConnect(); - } - } else { - // Assume socket/stream is already "connected" - onConnect(); - } - } - - return this; - } - - end() { - if (this._sock && isWritable(this._sock)) { - this._protocol.disconnect(DISCONNECT_REASON.BY_APPLICATION); - this._sock.end(); - } - return this; - } - - destroy() { - this._sock && isWritable(this._sock) && this._sock.destroy(); - return this; - } - - exec(cmd, opts, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - - const extraOpts = { allowHalfOpen: (opts.allowHalfOpen !== false) }; - - openChannel(this, 'session', extraOpts, (err, chan) => { - if (err) { - cb(err); - return; - } - - const todo = []; - - function reqCb(err) { - if (err) { - chan.close(); - cb(err); - return; - } - if (todo.length) - todo.shift()(); - } - - if (this.config.allowAgentFwd === true - || (opts - && opts.agentForward === true - && this._agent !== undefined)) { - todo.push(() => reqAgentFwd(chan, reqCb)); - } - - if (typeof opts === 'object' && opts !== null) { - if (typeof opts.env === 'object' && opts.env !== null) - reqEnv(chan, opts.env); - if ((typeof opts.pty === 'object' && opts.pty !== null) - || opts.pty === true) { - todo.push(() => reqPty(chan, opts.pty, reqCb)); - } - if ((typeof opts.x11 === 'object' && opts.x11 !== null) - || opts.x11 === 'number' - || opts.x11 === true) { - todo.push(() => reqX11(chan, opts.x11, reqCb)); - } - } - - todo.push(() => reqExec(chan, cmd, opts, cb)); - todo.shift()(); - }); - - return this; - } - - shell(wndopts, opts, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - if (typeof wndopts === 'function') { - cb = wndopts; - wndopts = opts = undefined; - } else if (typeof opts === 'function') { - cb = opts; - opts = undefined; - } - if (wndopts && (wndopts.x11 !== undefined || wndopts.env !== undefined)) { - opts = wndopts; - wndopts = undefined; - } - - openChannel(this, 'session', (err, chan) => { - if (err) { - cb(err); - return; - } - - const todo = []; - - function reqCb(err) { - if (err) { - chan.close(); - cb(err); - return; - } - if (todo.length) - todo.shift()(); - } - - if (this.config.allowAgentFwd === true - || (opts - && opts.agentForward === true - && this._agent !== undefined)) { - todo.push(() => reqAgentFwd(chan, reqCb)); - } - - if (wndopts !== false) - todo.push(() => reqPty(chan, wndopts, reqCb)); - - if (typeof opts === 'object' && opts !== null) { - if (typeof opts.env === 'object' && opts.env !== null) - reqEnv(chan, opts.env); - if ((typeof opts.x11 === 'object' && opts.x11 !== null) - || opts.x11 === 'number' - || opts.x11 === true) { - todo.push(() => reqX11(chan, opts.x11, reqCb)); - } - } - - todo.push(() => reqShell(chan, cb)); - todo.shift()(); - }); - - return this; - } - - subsys(name, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - openChannel(this, 'session', (err, chan) => { - if (err) { - cb(err); - return; - } - - reqSubsystem(chan, name, (err, stream) => { - if (err) { - cb(err); - return; - } - - cb(undefined, stream); - }); - }); - - return this; - } - - forwardIn(bindAddr, bindPort, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - // Send a request for the server to start forwarding TCP connections to us - // on a particular address and port - - const wantReply = (typeof cb === 'function'); - - if (wantReply) { - this._callbacks.push((had_err, data) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error(`Unable to bind to ${bindAddr}:${bindPort}`)); - return; - } - - let realPort = bindPort; - if (bindPort === 0 && data && data.length >= 4) { - realPort = readUInt32BE(data, 0); - if (!(this._protocol._compatFlags & COMPAT.DYN_RPORT_BUG)) - bindPort = realPort; - } - - this._forwarding[`${bindAddr}:${bindPort}`] = realPort; - - cb(undefined, realPort); - }); - } - - this._protocol.tcpipForward(bindAddr, bindPort, wantReply); - - return this; - } - - unforwardIn(bindAddr, bindPort, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - // Send a request to stop forwarding us new connections for a particular - // address and port - - const wantReply = (typeof cb === 'function'); - - if (wantReply) { - this._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error(`Unable to unbind from ${bindAddr}:${bindPort}`)); - return; - } - - delete this._forwarding[`${bindAddr}:${bindPort}`]; - - cb(); - }); - } - - this._protocol.cancelTcpipForward(bindAddr, bindPort, wantReply); - - return this; - } - - forwardOut(srcIP, srcPort, dstIP, dstPort, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - // Send a request to forward a TCP connection to the server - - const cfg = { - srcIP: srcIP, - srcPort: srcPort, - dstIP: dstIP, - dstPort: dstPort - }; - - if (typeof cb !== 'function') - cb = noop; - - openChannel(this, 'direct-tcpip', cfg, cb); - - return this; - } - - openssh_noMoreSessions(cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - const wantReply = (typeof cb === 'function'); - - if (!this.config.strictVendor - || (this.config.strictVendor && RE_OPENSSH.test(this._remoteVer))) { - if (wantReply) { - this._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error('Unable to disable future sessions')); - return; - } - - cb(); - }); - } - - this._protocol.openssh_noMoreSessions(wantReply); - return this; - } - - if (!wantReply) - return this; - - process.nextTick( - cb, - new Error( - 'strictVendor enabled and server is not OpenSSH or compatible version' - ) - ); - - return this; - } - - openssh_forwardInStreamLocal(socketPath, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - const wantReply = (typeof cb === 'function'); - - if (!this.config.strictVendor - || (this.config.strictVendor && RE_OPENSSH.test(this._remoteVer))) { - if (wantReply) { - this._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error(`Unable to bind to ${socketPath}`)); - return; - } - this._forwardingUnix[socketPath] = true; - cb(); - }); - } - - this._protocol.openssh_streamLocalForward(socketPath, wantReply); - return this; - } - - if (!wantReply) - return this; - - process.nextTick( - cb, - new Error( - 'strictVendor enabled and server is not OpenSSH or compatible version' - ) - ); - - return this; - } - - openssh_unforwardInStreamLocal(socketPath, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - const wantReply = (typeof cb === 'function'); - - if (!this.config.strictVendor - || (this.config.strictVendor && RE_OPENSSH.test(this._remoteVer))) { - if (wantReply) { - this._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error(`Unable to unbind from ${socketPath}`)); - return; - } - delete this._forwardingUnix[socketPath]; - cb(); - }); - } - - this._protocol.openssh_cancelStreamLocalForward(socketPath, wantReply); - return this; - } - - if (!wantReply) - return this; - - process.nextTick( - cb, - new Error( - 'strictVendor enabled and server is not OpenSSH or compatible version' - ) - ); - - return this; - } - - openssh_forwardOutStreamLocal(socketPath, cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - if (typeof cb !== 'function') - cb = noop; - - if (!this.config.strictVendor - || (this.config.strictVendor && RE_OPENSSH.test(this._remoteVer))) { - openChannel(this, 'direct-streamlocal@openssh.com', { socketPath }, cb); - return this; - } - process.nextTick( - cb, - new Error( - 'strictVendor enabled and server is not OpenSSH or compatible version' - ) - ); - - return this; - } - - sftp(cb) { - if (!this._sock || !isWritable(this._sock)) - throw new Error('Not connected'); - - openChannel(this, 'sftp', (err, sftp) => { - if (err) { - cb(err); - return; - } - - reqSubsystem(sftp, 'sftp', (err, sftp_) => { - if (err) { - cb(err); - return; - } - - function removeListeners() { - sftp.removeListener('ready', onReady); - sftp.removeListener('error', onError); - sftp.removeListener('exit', onExit); - sftp.removeListener('close', onExit); - } - - function onReady() { - // TODO: do not remove exit/close in case remote end closes the - // channel abruptly and we need to notify outstanding callbacks - removeListeners(); - cb(undefined, sftp); - } - - function onError(err) { - removeListeners(); - cb(err); - } - - function onExit(code, signal) { - removeListeners(); - let msg; - if (typeof code === 'number') - msg = `Received exit code ${code} while establishing SFTP session`; - else if (signal !== undefined) - msg = `Received signal ${signal} while establishing SFTP session`; - else - msg = 'Received unexpected SFTP session termination'; - const err = new Error(msg); - err.code = code; - err.signal = signal; - cb(err); - } - - sftp.on('ready', onReady) - .on('error', onError) - .on('exit', onExit) - .on('close', onExit); - - sftp._init(); - }); - }); - - return this; - } -} - -function openChannel(self, type, opts, cb) { - // Ask the server to open a channel for some purpose - // (e.g. session (sftp, exec, shell), or forwarding a TCP connection - const initWindow = MAX_WINDOW; - const maxPacket = PACKET_SIZE; - - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - - const wrapper = (err, stream) => { - cb(err, stream); - }; - wrapper.type = type; - - const localChan = self._chanMgr.add(wrapper); - - if (localChan === -1) { - cb(new Error('No free channels available')); - return; - } - - switch (type) { - case 'session': - case 'sftp': - self._protocol.session(localChan, initWindow, maxPacket); - break; - case 'direct-tcpip': - self._protocol.directTcpip(localChan, initWindow, maxPacket, opts); - break; - case 'direct-streamlocal@openssh.com': - self._protocol.openssh_directStreamLocal( - localChan, initWindow, maxPacket, opts - ); - break; - default: - throw new Error(`Unsupported channel type: ${type}`); - } -} - -function reqX11(chan, screen, cb) { - // Asks server to start sending us X11 connections - const cfg = { - single: false, - protocol: 'MIT-MAGIC-COOKIE-1', - cookie: undefined, - screen: 0 - }; - - if (typeof screen === 'function') { - cb = screen; - } else if (typeof screen === 'object' && screen !== null) { - if (typeof screen.single === 'boolean') - cfg.single = screen.single; - if (typeof screen.screen === 'number') - cfg.screen = screen.screen; - if (typeof screen.protocol === 'string') - cfg.protocol = screen.protocol; - if (typeof screen.cookie === 'string') - cfg.cookie = screen.cookie; - else if (Buffer.isBuffer(screen.cookie)) - cfg.cookie = screen.cookie.hexSlice(0, screen.cookie.length); - } - if (cfg.cookie === undefined) - cfg.cookie = randomCookie(); - - const wantReply = (typeof cb === 'function'); - - if (chan.outgoing.state !== 'open') { - if (wantReply) - cb(new Error('Channel is not open')); - return; - } - - if (wantReply) { - chan._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true ? had_err : new Error('Unable to request X11')); - return; - } - - chan._hasX11 = true; - ++chan._client._acceptX11; - chan.once('close', () => { - if (chan._client._acceptX11) - --chan._client._acceptX11; - }); - - cb(); - }); - } - - chan._client._protocol.x11Forward(chan.outgoing.id, cfg, wantReply); -} - -function reqPty(chan, opts, cb) { - let rows = 24; - let cols = 80; - let width = 640; - let height = 480; - let term = 'vt100'; - let modes = null; - - if (typeof opts === 'function') { - cb = opts; - } else if (typeof opts === 'object' && opts !== null) { - if (typeof opts.rows === 'number') - rows = opts.rows; - if (typeof opts.cols === 'number') - cols = opts.cols; - if (typeof opts.width === 'number') - width = opts.width; - if (typeof opts.height === 'number') - height = opts.height; - if (typeof opts.term === 'string') - term = opts.term; - if (typeof opts.modes === 'object') - modes = opts.modes; - } - - const wantReply = (typeof cb === 'function'); - - if (chan.outgoing.state !== 'open') { - if (wantReply) - cb(new Error('Channel is not open')); - return; - } - - if (wantReply) { - chan._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error('Unable to request a pseudo-terminal')); - return; - } - cb(); - }); - } - - chan._client._protocol.pty(chan.outgoing.id, - rows, - cols, - height, - width, - term, - modes, - wantReply); -} - -function reqAgentFwd(chan, cb) { - const wantReply = (typeof cb === 'function'); - - if (chan.outgoing.state !== 'open') { - wantReply && cb(new Error('Channel is not open')); - return; - } - if (chan._client._agentFwdEnabled) { - wantReply && cb(false); - return; - } - - chan._client._agentFwdEnabled = true; - - chan._callbacks.push((had_err) => { - if (had_err) { - chan._client._agentFwdEnabled = false; - if (wantReply) { - cb(had_err !== true - ? had_err - : new Error('Unable to request agent forwarding')); - } - return; - } - - if (wantReply) - cb(); - }); - - chan._client._protocol.openssh_agentForward(chan.outgoing.id, true); -} - -function reqShell(chan, cb) { - if (chan.outgoing.state !== 'open') { - cb(new Error('Channel is not open')); - return; - } - - chan._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true ? had_err : new Error('Unable to open shell')); - return; - } - chan.subtype = 'shell'; - cb(undefined, chan); - }); - - chan._client._protocol.shell(chan.outgoing.id, true); -} - -function reqExec(chan, cmd, opts, cb) { - if (chan.outgoing.state !== 'open') { - cb(new Error('Channel is not open')); - return; - } - - chan._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true ? had_err : new Error('Unable to exec')); - return; - } - chan.subtype = 'exec'; - chan.allowHalfOpen = (opts.allowHalfOpen !== false); - cb(undefined, chan); - }); - - chan._client._protocol.exec(chan.outgoing.id, cmd, true); -} - -function reqEnv(chan, env) { - if (chan.outgoing.state !== 'open') - return; - - const keys = Object.keys(env || {}); - - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - const val = env[key]; - chan._client._protocol.env(chan.outgoing.id, key, val, false); - } -} - -function reqSubsystem(chan, name, cb) { - if (chan.outgoing.state !== 'open') { - cb(new Error('Channel is not open')); - return; - } - - chan._callbacks.push((had_err) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error(`Unable to start subsystem: ${name}`)); - return; - } - chan.subtype = 'subsystem'; - cb(undefined, chan); - }); - - chan._client._protocol.subsystem(chan.outgoing.id, name, true); -} - -// TODO: inline implementation into single call site -function onCHANNEL_OPEN(self, info) { - // The server is trying to open a channel with us, this is usually when - // we asked the server to forward us connections on some port and now they - // are asking us to accept/deny an incoming connection on their side - - let localChan = -1; - let reason; - - const accept = () => { - const chanInfo = { - type: info.type, - incoming: { - id: localChan, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - const stream = new Channel(self, chanInfo); - self._chanMgr.update(localChan, stream); - - self._protocol.channelOpenConfirm(info.sender, - localChan, - MAX_WINDOW, - PACKET_SIZE); - return stream; - }; - const reject = () => { - if (reason === undefined) { - if (localChan === -1) - reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; - else - reason = CHANNEL_OPEN_FAILURE.CONNECT_FAILED; - } - - if (localChan !== -1) - self._chanMgr.remove(localChan); - - self._protocol.channelOpenFail(info.sender, reason, ''); - }; - const reserveChannel = () => { - localChan = self._chanMgr.add(); - - if (localChan === -1) { - reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; - if (self.config.debug) { - self.config.debug( - 'Client: Automatic rejection of incoming channel open: ' - + 'no channels available' - ); - } - } - - return (localChan !== -1); - }; - - const data = info.data; - switch (info.type) { - case 'forwarded-tcpip': { - const val = self._forwarding[`${data.destIP}:${data.destPort}`]; - if (val !== undefined && reserveChannel()) { - if (data.destPort === 0) - data.destPort = val; - self.emit('tcp connection', data, accept, reject); - return; - } - break; - } - case 'forwarded-streamlocal@openssh.com': - if (self._forwardingUnix[data.socketPath] !== undefined - && reserveChannel()) { - self.emit('unix connection', data, accept, reject); - return; - } - break; - case 'auth-agent@openssh.com': - if (self._agentFwdEnabled - && typeof self._agent.getStream === 'function' - && reserveChannel()) { - self._agent.getStream((err, stream) => { - if (err) - return reject(); - - const upstream = accept(); - upstream.pipe(stream).pipe(upstream); - }); - return; - } - break; - case 'x11': - if (self._acceptX11 !== 0 && reserveChannel()) { - self.emit('x11', data, accept, reject); - return; - } - break; - default: - // Automatically reject any unsupported channel open requests - reason = CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE; - if (self.config.debug) { - self.config.debug( - 'Client: Automatic rejection of unsupported incoming channel open ' - + `type: ${info.type}` - ); - } - } - - if (reason === undefined) { - reason = CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED; - if (self.config.debug) { - self.config.debug( - 'Client: Automatic rejection of unexpected incoming channel open for: ' - + info.type - ); - } - } - - reject(); -} - -const randomCookie = (() => { - const buffer = Buffer.allocUnsafe(16); - return () => { - randomFillSync(buffer, 0, 16); - return buffer.hexSlice(0, 16); - }; -})(); - -function makeSimpleAuthHandler(authList) { - if (!Array.isArray(authList)) - throw new Error('authList must be an array'); - - let a = 0; - return (authsLeft, partialSuccess, cb) => { - if (a === authList.length) - return false; - return authList[a++]; - }; -} - -function hostKeysProve(client, keys_, cb) { - if (!client._sock || !isWritable(client._sock)) - return; - - if (typeof cb !== 'function') - cb = noop; - - if (!Array.isArray(keys_)) - throw new TypeError('Invalid keys argument type'); - - const keys = []; - for (const key of keys_) { - const parsed = parseKey(key); - if (parsed instanceof Error) - throw parsed; - keys.push(parsed); - } - - if (!client.config.strictVendor - || (client.config.strictVendor && RE_OPENSSH.test(client._remoteVer))) { - client._callbacks.push((had_err, data) => { - if (had_err) { - cb(had_err !== true - ? had_err - : new Error('Server failed to prove supplied keys')); - return; - } - - // TODO: move all of this parsing/verifying logic out of the client? - const ret = []; - let keyIdx = 0; - bufferParser.init(data, 0); - while (bufferParser.avail()) { - if (keyIdx === keys.length) - break; - const key = keys[keyIdx++]; - const keyPublic = key.getPublicSSH(); - - const sigEntry = bufferParser.readString(); - sigParser.init(sigEntry, 0); - const type = sigParser.readString(true); - let value = sigParser.readString(); - - let algo; - if (type !== key.type) { - if (key.type === 'ssh-rsa') { - switch (type) { - case 'rsa-sha2-256': - algo = 'sha256'; - break; - case 'rsa-sha2-512': - algo = 'sha512'; - break; - default: - continue; - } - } else { - continue; - } - } - - const sessionID = client._protocol._kex.sessionID; - const verifyData = Buffer.allocUnsafe( - 4 + 29 + 4 + sessionID.length + 4 + keyPublic.length - ); - let p = 0; - writeUInt32BE(verifyData, 29, p); - verifyData.utf8Write('hostkeys-prove-00@openssh.com', p += 4, 29); - writeUInt32BE(verifyData, sessionID.length, p += 29); - bufferCopy(sessionID, verifyData, 0, sessionID.length, p += 4); - writeUInt32BE(verifyData, keyPublic.length, p += sessionID.length); - bufferCopy(keyPublic, verifyData, 0, keyPublic.length, p += 4); - - if (!(value = sigSSHToASN1(value, type))) - continue; - if (key.verify(verifyData, value, algo) === true) - ret.push(key); - } - sigParser.clear(); - bufferParser.clear(); - - cb(null, ret); - }); - - client._protocol.openssh_hostKeysProve(keys); - return; - } - - process.nextTick( - cb, - new Error( - 'strictVendor enabled and server is not OpenSSH or compatible version' - ) - ); -} - -module.exports = Client; diff --git a/reverse_engineering/node_modules/ssh2/lib/http-agents.js b/reverse_engineering/node_modules/ssh2/lib/http-agents.js deleted file mode 100644 index 770a0e63..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/http-agents.js +++ /dev/null @@ -1,84 +0,0 @@ -'use strict'; - -const { Agent: HttpAgent } = require('http'); -const { Agent: HttpsAgent } = require('https'); -const { connect: tlsConnect } = require('tls'); - -let Client; - -for (const ctor of [HttpAgent, HttpsAgent]) { - class SSHAgent extends ctor { - constructor(connectCfg, agentOptions) { - super(agentOptions); - - this._connectCfg = connectCfg; - this._defaultSrcIP = (agentOptions && agentOptions.srcIP) || 'localhost'; - } - - createConnection(options, cb) { - const srcIP = (options && options.localAddress) || this._defaultSrcIP; - const srcPort = (options && options.localPort) || 0; - const dstIP = options.host; - const dstPort = options.port; - - if (Client === undefined) - Client = require('./client.js'); - - const client = new Client(); - let triedForward = false; - client.on('ready', () => { - client.forwardOut(srcIP, srcPort, dstIP, dstPort, (err, stream) => { - triedForward = true; - if (err) { - client.end(); - return cb(err); - } - stream.once('close', () => client.end()); - cb(null, decorateStream(stream, ctor, options)); - }); - }).on('error', cb).on('close', () => { - if (!triedForward) - cb(new Error('Unexpected connection close')); - }).connect(this._connectCfg); - } - } - - exports[ctor === HttpAgent ? 'SSHTTPAgent' : 'SSHTTPSAgent'] = SSHAgent; -} - -function noop() {} - -function decorateStream(stream, ctor, options) { - if (ctor === HttpAgent) { - // HTTP - stream.setKeepAlive = noop; - stream.setNoDelay = noop; - stream.setTimeout = noop; - stream.ref = noop; - stream.unref = noop; - stream.destroySoon = stream.destroy; - return stream; - } - - // HTTPS - options.socket = stream; - const wrapped = tlsConnect(options); - - // This is a workaround for a regression in node v12.16.3+ - // https://github.com/nodejs/node/issues/35904 - const onClose = (() => { - let called = false; - return () => { - if (called) - return; - called = true; - if (stream.isPaused()) - stream.resume(); - }; - })(); - // 'end' listener is needed because 'close' is not emitted in some scenarios - // in node v12.x for some unknown reason - wrapped.on('end', onClose).on('close', onClose); - - return wrapped; -} diff --git a/reverse_engineering/node_modules/ssh2/lib/index.js b/reverse_engineering/node_modules/ssh2/lib/index.js deleted file mode 100644 index 459952ef..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -'use strict'; - -const { - AgentProtocol, - BaseAgent, - createAgent, - CygwinAgent, - OpenSSHAgent, - PageantAgent, -} = require('./agent.js'); -const { - SSHTTPAgent: HTTPAgent, - SSHTTPSAgent: HTTPSAgent, -} = require('./http-agents.js'); -const { parseKey } = require('./protocol/keyParser.js'); -const { - flagsToString, - OPEN_MODE, - STATUS_CODE, - stringToFlags, -} = require('./protocol/SFTP.js'); - -module.exports = { - AgentProtocol, - BaseAgent, - createAgent, - Client: require('./client.js'), - CygwinAgent, - HTTPAgent, - HTTPSAgent, - OpenSSHAgent, - PageantAgent, - Server: require('./server.js'), - utils: { - parseKey, - sftp: { - flagsToString, - OPEN_MODE, - STATUS_CODE, - stringToFlags, - }, - }, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/Protocol.js b/reverse_engineering/node_modules/ssh2/lib/protocol/Protocol.js deleted file mode 100644 index e00f1eb5..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/Protocol.js +++ /dev/null @@ -1,2076 +0,0 @@ -/* - TODO: - * Replace `buffer._pos` usage in keyParser.js and elsewhere - * Utilize optional "writev" support when writing packets from - cipher.encrypt() - * Built-in support for automatic re-keying, on by default - * Revisit receiving unexpected/unknown packets - * Error (fatal or otherwise) or ignore or pass on to user (in some or all - cases)? - * Including server/client check for single directional packet types? - * Check packets for validity or bail as early as possible? - * Automatic re-key every 2**31 packets after the last key exchange (sent or - received), as suggested by RFC4344. OpenSSH currently does this. - * Automatic re-key every so many blocks depending on cipher. RFC4344: - Because of a birthday property of block ciphers and some modes of - operation, implementations must be careful not to encrypt too many - blocks with the same encryption key. - - Let L be the block length (in bits) of an SSH encryption method's - block cipher (e.g., 128 for AES). If L is at least 128, then, after - rekeying, an SSH implementation SHOULD NOT encrypt more than 2**(L/4) - blocks before rekeying again. If L is at least 128, then SSH - implementations should also attempt to force a rekey before receiving - more than 2**(L/4) blocks. If L is less than 128 (which is the case - for older ciphers such as 3DES, Blowfish, CAST-128, and IDEA), then, - although it may be too expensive to rekey every 2**(L/4) blocks, it - is still advisable for SSH implementations to follow the original - recommendation in [RFC4253]: rekey at least once for every gigabyte - of transmitted data. - - Note that if L is less than or equal to 128, then the recommendation - in this subsection supersedes the recommendation in Section 3.1. If - an SSH implementation uses a block cipher with a larger block size - (e.g., Rijndael with 256-bit blocks), then the recommendations in - Section 3.1 may supersede the recommendations in this subsection - (depending on the lengths of the packets). -*/ - -'use strict'; - -const { inspect } = require('util'); - -const { bindingAvailable, NullCipher, NullDecipher } = require('./crypto.js'); -const { - COMPAT_CHECKS, - DISCONNECT_REASON, - MESSAGE, - SIGNALS, - TERMINAL_MODE, -} = require('./constants.js'); -const { - DEFAULT_KEXINIT, - KexInit, - kexinit, - onKEXPayload, -} = require('./kex.js'); -const { - parseKey, -} = require('./keyParser.js'); -const MESSAGE_HANDLERS = require('./handlers.js'); -const { - bufferCopy, - bufferFill, - bufferSlice, - convertSignature, - sendPacket, - writeUInt32BE, -} = require('./utils.js'); -const { - PacketReader, - PacketWriter, - ZlibPacketReader, - ZlibPacketWriter, -} = require('./zlib.js'); - -const MODULE_VER = require('../../package.json').version; - -const VALID_DISCONNECT_REASONS = new Map( - Object.values(DISCONNECT_REASON).map((n) => [n, 1]) -); -const IDENT_RAW = Buffer.from(`SSH-2.0-ssh2js${MODULE_VER}`); -const IDENT = Buffer.from(`${IDENT_RAW}\r\n`); -const MAX_LINE_LEN = 8192; -const MAX_LINES = 1024; -const PING_PAYLOAD = Buffer.from([ - MESSAGE.GLOBAL_REQUEST, - // "keepalive@openssh.com" - 0, 0, 0, 21, - 107, 101, 101, 112, 97, 108, 105, 118, 101, 64, 111, 112, 101, 110, 115, - 115, 104, 46, 99, 111, 109, - // Request a reply - 1, -]); -const NO_TERMINAL_MODES_BUFFER = Buffer.from([ TERMINAL_MODE.TTY_OP_END ]); - -function noop() {} - -/* - Inbound: - * kexinit payload (needed only until exchange hash is generated) - * raw ident - * rekey packet queue - * expected packet (implemented as separate _parse() function?) - Outbound: - * kexinit payload (needed only until exchange hash is generated) - * rekey packet queue - * kex secret (needed only until NEWKEYS) - * exchange hash (needed only until NEWKEYS) - * session ID (set to exchange hash from initial handshake) -*/ -class Protocol { - constructor(config) { - const onWrite = config.onWrite; - if (typeof onWrite !== 'function') - throw new Error('Missing onWrite function'); - this._onWrite = (data) => { onWrite(data); }; - - const onError = config.onError; - if (typeof onError !== 'function') - throw new Error('Missing onError function'); - this._onError = (err) => { onError(err); }; - - const debug = config.debug; - this._debug = (typeof debug === 'function' - ? (msg) => { debug(msg); } - : undefined); - - const onHeader = config.onHeader; - this._onHeader = (typeof onHeader === 'function' - ? (...args) => { onHeader(...args); } - : noop); - - const onPacket = config.onPacket; - this._onPacket = (typeof onPacket === 'function' - ? () => { onPacket(); } - : noop); - - let onHandshakeComplete = config.onHandshakeComplete; - if (typeof onHandshakeComplete !== 'function') - onHandshakeComplete = noop; - this._onHandshakeComplete = (...args) => { - this._debug && this._debug('Handshake completed'); - - // Process packets queued during a rekey where necessary - const oldQueue = this._queue; - if (oldQueue) { - this._queue = undefined; - this._debug && this._debug( - `Draining outbound queue (${oldQueue.length}) ...` - ); - for (let i = 0; i < oldQueue.length; ++i) { - const data = oldQueue[i]; - // data === payload only - - // XXX: hacky - let finalized = this._packetRW.write.finalize(data); - if (finalized === data) { - const packet = this._cipher.allocPacket(data.length); - packet.set(data, 5); - finalized = packet; - } - - sendPacket(this, finalized); - } - this._debug && this._debug('... finished draining outbound queue'); - } - - onHandshakeComplete(...args); - }; - this._queue = undefined; - - const messageHandlers = config.messageHandlers; - if (typeof messageHandlers === 'object' && messageHandlers !== null) - this._handlers = messageHandlers; - else - this._handlers = {}; - - this._onPayload = onPayload.bind(this); - - this._server = !!config.server; - this._banner = undefined; - let greeting; - if (this._server) { - if (typeof config.hostKeys !== 'object' || config.hostKeys === null) - throw new Error('Missing server host key(s)'); - this._hostKeys = config.hostKeys; - - // Greeting displayed before the ssh identification string is sent, this - // is usually ignored by most clients - if (typeof config.greeting === 'string' && config.greeting.length) { - greeting = (config.greeting.slice(-2) === '\r\n' - ? config.greeting - : `${config.greeting}\r\n`); - } - - // Banner shown after the handshake completes, but before user - // authentication begins - if (typeof config.banner === 'string' && config.banner.length) { - this._banner = (config.banner.slice(-2) === '\r\n' - ? config.banner - : `${config.banner}\r\n`); - } - } else { - this._hostKeys = undefined; - } - - let offer = config.offer; - if (typeof offer !== 'object' || offer === null) - offer = DEFAULT_KEXINIT; - else if (offer.constructor !== KexInit) - offer = new KexInit(offer); - this._kex = undefined; - this._kexinit = undefined; - this._offer = offer; - this._cipher = new NullCipher(0, this._onWrite); - this._decipher = undefined; - this._skipNextInboundPacket = false; - this._packetRW = { - read: new PacketReader(), - write: new PacketWriter(this), - }; - this._hostVerifier = (!this._server - && typeof config.hostVerifier === 'function' - ? config.hostVerifier - : undefined); - - this._parse = parseHeader; - this._buffer = undefined; - this._authsQueue = []; - this._authenticated = false; - this._remoteIdentRaw = undefined; - let sentIdent; - if (typeof config.ident === 'string') { - this._identRaw = Buffer.from(`SSH-2.0-${config.ident}`); - - sentIdent = Buffer.allocUnsafe(this._identRaw.length + 2); - sentIdent.set(this._identRaw, 0); - sentIdent[sentIdent.length - 2] = 13; // '\r' - sentIdent[sentIdent.length - 1] = 10; // '\n' - } else if (Buffer.isBuffer(config.ident)) { - const fullIdent = Buffer.allocUnsafe(8 + config.ident.length); - fullIdent.latin1Write('SSH-2.0-', 0, 8); - fullIdent.set(config.ident, 8); - this._identRaw = fullIdent; - - sentIdent = Buffer.allocUnsafe(fullIdent.length + 2); - sentIdent.set(fullIdent, 0); - sentIdent[sentIdent.length - 2] = 13; // '\r' - sentIdent[sentIdent.length - 1] = 10; // '\n' - } else { - this._identRaw = IDENT_RAW; - sentIdent = IDENT; - } - this._compatFlags = 0; - - if (this._debug) { - if (bindingAvailable) - this._debug('Custom crypto binding available'); - else - this._debug('Custom crypto binding not available'); - } - - process.nextTick(() => { - this._debug && this._debug( - `Local ident: ${inspect(this._identRaw.toString())}` - ); - if (greeting) - this._onWrite(greeting); - this._onWrite(sentIdent); - }); - } - _destruct(reason) { - this._packetRW.read.cleanup(); - this._packetRW.write.cleanup(); - this._cipher && this._cipher.free(); - this._decipher && this._decipher.free(); - if (typeof reason !== 'string' || reason.length === 0) - reason = 'fatal error'; - this.parse = () => { - throw new Error(`Instance unusable after ${reason}`); - }; - this._onWrite = () => { - throw new Error(`Instance unusable after ${reason}`); - }; - this._destruct = undefined; - } - cleanup() { - this._destruct && this._destruct(); - } - parse(chunk, i, len) { - while (i < len) - i = this._parse(chunk, i, len); - } - - // Protocol message API - - // =========================================================================== - // Common/Shared ============================================================= - // =========================================================================== - - // Global - // ------ - disconnect(reason) { - const pktLen = 1 + 4 + 4 + 4; - // We don't use _packetRW.write.* here because we need to make sure that - // we always get a full packet allocated because this message can be sent - // at any time -- even during a key exchange - let p = this._packetRW.write.allocStartKEX; - const packet = this._packetRW.write.alloc(pktLen, true); - const end = p + pktLen; - - if (!VALID_DISCONNECT_REASONS.has(reason)) - reason = DISCONNECT_REASON.PROTOCOL_ERROR; - - packet[p] = MESSAGE.DISCONNECT; - writeUInt32BE(packet, reason, ++p); - packet.fill(0, p += 4, end); - - this._debug && this._debug(`Outbound: Sending DISCONNECT (${reason})`); - sendPacket(this, this._packetRW.write.finalize(packet, true), true); - } - ping() { - const p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(PING_PAYLOAD.length); - - packet.set(PING_PAYLOAD, p); - - this._debug && this._debug( - 'Outbound: Sending ping (GLOBAL_REQUEST: keepalive@openssh.com)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - rekey() { - if (this._kexinit === undefined) { - this._debug && this._debug('Outbound: Initiated explicit rekey'); - this._queue = []; - kexinit(this); - } else { - this._debug && this._debug('Outbound: Ignoring rekey during handshake'); - } - } - - // 'ssh-connection' service-specific - // --------------------------------- - requestSuccess(data) { - let p = this._packetRW.write.allocStart; - let packet; - if (Buffer.isBuffer(data)) { - packet = this._packetRW.write.alloc(1 + data.length); - - packet[p] = MESSAGE.REQUEST_SUCCESS; - - packet.set(data, ++p); - } else { - packet = this._packetRW.write.alloc(1); - - packet[p] = MESSAGE.REQUEST_SUCCESS; - } - - this._debug && this._debug('Outbound: Sending REQUEST_SUCCESS'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - requestFailure() { - const p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1); - - packet[p] = MESSAGE.REQUEST_FAILURE; - - this._debug && this._debug('Outbound: Sending REQUEST_FAILURE'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelSuccess(chan) { - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4); - - packet[p] = MESSAGE.CHANNEL_SUCCESS; - - writeUInt32BE(packet, chan, ++p); - - this._debug && this._debug(`Outbound: Sending CHANNEL_SUCCESS (r:${chan})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelFailure(chan) { - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4); - - packet[p] = MESSAGE.CHANNEL_FAILURE; - - writeUInt32BE(packet, chan, ++p); - - this._debug && this._debug(`Outbound: Sending CHANNEL_FAILURE (r:${chan})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelEOF(chan) { - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4); - - packet[p] = MESSAGE.CHANNEL_EOF; - - writeUInt32BE(packet, chan, ++p); - - this._debug && this._debug(`Outbound: Sending CHANNEL_EOF (r:${chan})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelClose(chan) { - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4); - - packet[p] = MESSAGE.CHANNEL_CLOSE; - - writeUInt32BE(packet, chan, ++p); - - this._debug && this._debug(`Outbound: Sending CHANNEL_CLOSE (r:${chan})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelWindowAdjust(chan, amount) { - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4); - - packet[p] = MESSAGE.CHANNEL_WINDOW_ADJUST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, amount, p += 4); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_WINDOW_ADJUST (r:${chan}, ${amount})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelData(chan, data) { - const isBuffer = Buffer.isBuffer(data); - const dataLen = (isBuffer ? data.length : Buffer.byteLength(data)); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + dataLen); - - packet[p] = MESSAGE.CHANNEL_DATA; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, dataLen, p += 4); - - if (isBuffer) - packet.set(data, p += 4); - else - packet.utf8Write(data, p += 4, dataLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_DATA (r:${chan}, ${dataLen})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelExtData(chan, data, type) { - const isBuffer = Buffer.isBuffer(data); - const dataLen = (isBuffer ? data.length : Buffer.byteLength(data)); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 4 + dataLen); - - packet[p] = MESSAGE.CHANNEL_EXTENDED_DATA; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, type, p += 4); - - writeUInt32BE(packet, dataLen, p += 4); - - if (isBuffer) - packet.set(data, p += 4); - else - packet.utf8Write(data, p += 4, dataLen); - - this._debug - && this._debug(`Outbound: Sending CHANNEL_EXTENDED_DATA (r:${chan})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelOpenConfirm(remote, local, initWindow, maxPacket) { - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 4 + 4); - - packet[p] = MESSAGE.CHANNEL_OPEN_CONFIRMATION; - - writeUInt32BE(packet, remote, ++p); - - writeUInt32BE(packet, local, p += 4); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_OPEN_CONFIRMATION (r:${remote}, l:${local})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - channelOpenFail(remote, reason, desc) { - if (typeof desc !== 'string') - desc = ''; - - const descLen = Buffer.byteLength(desc); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 4 + descLen + 4); - - packet[p] = MESSAGE.CHANNEL_OPEN_FAILURE; - - writeUInt32BE(packet, remote, ++p); - - writeUInt32BE(packet, reason, p += 4); - - writeUInt32BE(packet, descLen, p += 4); - - p += 4; - if (descLen) { - packet.utf8Write(desc, p, descLen); - p += descLen; - } - - writeUInt32BE(packet, 0, p); // Empty language tag - - this._debug - && this._debug(`Outbound: Sending CHANNEL_OPEN_FAILURE (r:${remote})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - - // =========================================================================== - // Client-specific =========================================================== - // =========================================================================== - - // Global - // ------ - service(name) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const nameLen = Buffer.byteLength(name); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + nameLen); - - packet[p] = MESSAGE.SERVICE_REQUEST; - - writeUInt32BE(packet, nameLen, ++p); - packet.utf8Write(name, p += 4, nameLen); - - this._debug && this._debug(`Outbound: Sending SERVICE_REQUEST (${name})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - - // 'ssh-userauth' service-specific - // ------------------------------- - authPassword(username, password, newPassword) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const userLen = Buffer.byteLength(username); - const passLen = Buffer.byteLength(password); - const newPassLen = (newPassword ? Buffer.byteLength(newPassword) : 0); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + userLen + 4 + 14 + 4 + 8 + 1 + 4 + passLen - + (newPassword ? 4 + newPassLen : 0) - ); - - packet[p] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(packet, userLen, ++p); - packet.utf8Write(username, p += 4, userLen); - - writeUInt32BE(packet, 14, p += userLen); - packet.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(packet, 8, p += 14); - packet.utf8Write('password', p += 4, 8); - - packet[p += 8] = (newPassword ? 1 : 0); - - writeUInt32BE(packet, passLen, ++p); - if (Buffer.isBuffer(password)) - bufferCopy(password, packet, 0, passLen, p += 4); - else - packet.utf8Write(password, p += 4, passLen); - - if (newPassword) { - writeUInt32BE(packet, newPassLen, p += passLen); - if (Buffer.isBuffer(newPassword)) - bufferCopy(newPassword, packet, 0, newPassLen, p += 4); - else - packet.utf8Write(newPassword, p += 4, newPassLen); - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (changed password)' - ); - } else { - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (password)' - ); - } - - this._authsQueue.push('password'); - - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authPK(username, pubKey, cbSign) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - pubKey = parseKey(pubKey); - if (pubKey instanceof Error) - throw new Error('Invalid key'); - - const keyType = pubKey.type; - pubKey = pubKey.getPublicSSH(); - - const userLen = Buffer.byteLength(username); - const algoLen = Buffer.byteLength(keyType); - const pubKeyLen = pubKey.length; - const sessionID = this._kex.sessionID; - const sesLen = sessionID.length; - const payloadLen = - (cbSign ? 4 + sesLen : 0) - + 1 + 4 + userLen + 4 + 14 + 4 + 9 + 1 + 4 + algoLen + 4 + pubKeyLen; - let packet; - let p; - if (cbSign) { - packet = Buffer.allocUnsafe(payloadLen); - p = 0; - writeUInt32BE(packet, sesLen, p); - packet.set(sessionID, p += 4); - p += sesLen; - } else { - packet = this._packetRW.write.alloc(payloadLen); - p = this._packetRW.write.allocStart; - } - - packet[p] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(packet, userLen, ++p); - packet.utf8Write(username, p += 4, userLen); - - writeUInt32BE(packet, 14, p += userLen); - packet.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(packet, 9, p += 14); - packet.utf8Write('publickey', p += 4, 9); - - packet[p += 9] = (cbSign ? 1 : 0); - - writeUInt32BE(packet, algoLen, ++p); - packet.utf8Write(keyType, p += 4, algoLen); - - writeUInt32BE(packet, pubKeyLen, p += algoLen); - packet.set(pubKey, p += 4); - - if (!cbSign) { - this._authsQueue.push('publickey'); - - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (publickey -- check)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - return; - } - - cbSign(packet, (signature) => { - signature = convertSignature(signature, keyType); - if (signature === false) - throw new Error('Error while converting handshake signature'); - - const sigLen = signature.length; - p = this._packetRW.write.allocStart; - packet = this._packetRW.write.alloc( - 1 + 4 + userLen + 4 + 14 + 4 + 9 + 1 + 4 + algoLen + 4 + pubKeyLen + 4 - + 4 + algoLen + 4 + sigLen - ); - - // TODO: simply copy from original "packet" to new `packet` to avoid - // having to write each individual field a second time? - packet[p] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(packet, userLen, ++p); - packet.utf8Write(username, p += 4, userLen); - - writeUInt32BE(packet, 14, p += userLen); - packet.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(packet, 9, p += 14); - packet.utf8Write('publickey', p += 4, 9); - - packet[p += 9] = 1; - - writeUInt32BE(packet, algoLen, ++p); - packet.utf8Write(keyType, p += 4, algoLen); - - writeUInt32BE(packet, pubKeyLen, p += algoLen); - packet.set(pubKey, p += 4); - - writeUInt32BE(packet, 4 + algoLen + 4 + sigLen, p += pubKeyLen); - - writeUInt32BE(packet, algoLen, p += 4); - packet.utf8Write(keyType, p += 4, algoLen); - - writeUInt32BE(packet, sigLen, p += algoLen); - packet.set(signature, p += 4); - - // Servers shouldn't send packet type 60 in response to signed publickey - // attempts, but if they do, interpret as type 60. - this._authsQueue.push('publickey'); - - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (publickey)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - }); - } - authHostbased(username, pubKey, hostname, userlocal, cbSign) { - // TODO: Make DRY by sharing similar code with authPK() - if (this._server) - throw new Error('Client-only method called in server mode'); - - pubKey = parseKey(pubKey); - if (pubKey instanceof Error) - throw new Error('Invalid key'); - - const keyType = pubKey.type; - pubKey = pubKey.getPublicSSH(); - - const userLen = Buffer.byteLength(username); - const algoLen = Buffer.byteLength(keyType); - const pubKeyLen = pubKey.length; - const sessionID = this._kex.sessionID; - const sesLen = sessionID.length; - const hostnameLen = Buffer.byteLength(hostname); - const userlocalLen = Buffer.byteLength(userlocal); - const data = Buffer.allocUnsafe( - 4 + sesLen + 1 + 4 + userLen + 4 + 14 + 4 + 9 + 4 + algoLen - + 4 + pubKeyLen + 4 + hostnameLen + 4 + userlocalLen - ); - let p = 0; - - writeUInt32BE(data, sesLen, p); - data.set(sessionID, p += 4); - - data[p += sesLen] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(data, userLen, ++p); - data.utf8Write(username, p += 4, userLen); - - writeUInt32BE(data, 14, p += userLen); - data.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(data, 9, p += 14); - data.utf8Write('hostbased', p += 4, 9); - - writeUInt32BE(data, algoLen, p += 9); - data.utf8Write(keyType, p += 4, algoLen); - - writeUInt32BE(data, pubKeyLen, p += algoLen); - data.set(pubKey, p += 4); - - writeUInt32BE(data, hostnameLen, p += pubKeyLen); - data.utf8Write(hostname, p += 4, hostnameLen); - - writeUInt32BE(data, userlocalLen, p += hostnameLen); - data.utf8Write(userlocal, p += 4, userlocalLen); - - cbSign(data, (signature) => { - signature = convertSignature(signature, keyType); - if (!signature) - throw new Error('Error while converting handshake signature'); - - const sigLen = signature.length; - const reqDataLen = (data.length - sesLen - 4); - p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - reqDataLen + 4 + 4 + algoLen + 4 + sigLen - ); - - bufferCopy(data, packet, 4 + sesLen, data.length, p); - - writeUInt32BE(packet, 4 + algoLen + 4 + sigLen, p += reqDataLen); - writeUInt32BE(packet, algoLen, p += 4); - packet.utf8Write(keyType, p += 4, algoLen); - writeUInt32BE(packet, sigLen, p += algoLen); - packet.set(signature, p += 4); - - this._authsQueue.push('hostbased'); - - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (hostbased)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - }); - } - authKeyboard(username) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const userLen = Buffer.byteLength(username); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + userLen + 4 + 14 + 4 + 20 + 4 + 4 - ); - - packet[p] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(packet, userLen, ++p); - packet.utf8Write(username, p += 4, userLen); - - writeUInt32BE(packet, 14, p += userLen); - packet.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(packet, 20, p += 14); - packet.utf8Write('keyboard-interactive', p += 4, 20); - - writeUInt32BE(packet, 0, p += 20); - - writeUInt32BE(packet, 0, p += 4); - - this._authsQueue.push('keyboard-interactive'); - - this._debug && this._debug( - 'Outbound: Sending USERAUTH_REQUEST (keyboard-interactive)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authNone(username) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const userLen = Buffer.byteLength(username); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + userLen + 4 + 14 + 4 + 4); - - packet[p] = MESSAGE.USERAUTH_REQUEST; - - writeUInt32BE(packet, userLen, ++p); - packet.utf8Write(username, p += 4, userLen); - - writeUInt32BE(packet, 14, p += userLen); - packet.utf8Write('ssh-connection', p += 4, 14); - - writeUInt32BE(packet, 4, p += 14); - packet.utf8Write('none', p += 4, 4); - - this._authsQueue.push('none'); - - this._debug && this._debug('Outbound: Sending USERAUTH_REQUEST (none)'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authInfoRes(responses) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - let responsesTotalLen = 0; - let responseLens; - - if (responses) { - responseLens = new Array(responses.length); - for (let i = 0; i < responses.length; ++i) { - const len = Buffer.byteLength(responses[i]); - responseLens[i] = len; - responsesTotalLen += 4 + len; - } - } - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + responsesTotalLen); - - packet[p] = MESSAGE.USERAUTH_INFO_RESPONSE; - - if (responses) { - writeUInt32BE(packet, responses.length, ++p); - p += 4; - for (let i = 0; i < responses.length; ++i) { - const len = responseLens[i]; - writeUInt32BE(packet, len, p); - p += 4; - if (len) { - packet.utf8Write(responses[i], p, len); - p += len; - } - } - } else { - writeUInt32BE(packet, 0, ++p); - } - - this._debug && this._debug('Outbound: Sending USERAUTH_INFO_RESPONSE'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - - // 'ssh-connection' service-specific - // --------------------------------- - tcpipForward(bindAddr, bindPort, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const addrLen = Buffer.byteLength(bindAddr); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 13 + 1 + 4 + addrLen + 4); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 13, ++p); - packet.utf8Write('tcpip-forward', p += 4, 13); - - packet[p += 13] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, addrLen, ++p); - packet.utf8Write(bindAddr, p += 4, addrLen); - - writeUInt32BE(packet, bindPort, p += addrLen); - - this._debug - && this._debug('Outbound: Sending GLOBAL_REQUEST (tcpip-forward)'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - cancelTcpipForward(bindAddr, bindPort, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const addrLen = Buffer.byteLength(bindAddr); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 20 + 1 + 4 + addrLen + 4); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 20, ++p); - packet.utf8Write('cancel-tcpip-forward', p += 4, 20); - - packet[p += 20] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, addrLen, ++p); - packet.utf8Write(bindAddr, p += 4, addrLen); - - writeUInt32BE(packet, bindPort, p += addrLen); - - this._debug - && this._debug('Outbound: Sending GLOBAL_REQUEST (cancel-tcpip-forward)'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_streamLocalForward(socketPath, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const socketPathLen = Buffer.byteLength(socketPath); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 31 + 1 + 4 + socketPathLen - ); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 31, ++p); - packet.utf8Write('streamlocal-forward@openssh.com', p += 4, 31); - - packet[p += 31] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, socketPathLen, ++p); - packet.utf8Write(socketPath, p += 4, socketPathLen); - - this._debug && this._debug( - 'Outbound: Sending GLOBAL_REQUEST (streamlocal-forward@openssh.com)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_cancelStreamLocalForward(socketPath, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const socketPathLen = Buffer.byteLength(socketPath); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 38 + 1 + 4 + socketPathLen - ); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 38, ++p); - packet.utf8Write('cancel-streamlocal-forward@openssh.com', p += 4, 38); - - packet[p += 38] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, socketPathLen, ++p); - packet.utf8Write(socketPath, p += 4, socketPathLen); - - if (this._debug) { - this._debug( - 'Outbound: Sending GLOBAL_REQUEST ' - + '(cancel-streamlocal-forward@openssh.com)' - ); - } - sendPacket(this, this._packetRW.write.finalize(packet)); - } - directTcpip(chan, initWindow, maxPacket, cfg) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const srcLen = Buffer.byteLength(cfg.srcIP); - const dstLen = Buffer.byteLength(cfg.dstIP); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 12 + 4 + 4 + 4 + 4 + srcLen + 4 + 4 + dstLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 12, ++p); - packet.utf8Write('direct-tcpip', p += 4, 12); - - writeUInt32BE(packet, chan, p += 12); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - writeUInt32BE(packet, dstLen, p += 4); - packet.utf8Write(cfg.dstIP, p += 4, dstLen); - - writeUInt32BE(packet, cfg.dstPort, p += dstLen); - - writeUInt32BE(packet, srcLen, p += 4); - packet.utf8Write(cfg.srcIP, p += 4, srcLen); - - writeUInt32BE(packet, cfg.srcPort, p += srcLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_OPEN (r:${chan}, direct-tcpip)` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_directStreamLocal(chan, initWindow, maxPacket, cfg) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - const pathLen = Buffer.byteLength(cfg.socketPath); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 30 + 4 + 4 + 4 + 4 + pathLen + 4 + 4 - ); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 30, ++p); - packet.utf8Write('direct-streamlocal@openssh.com', p += 4, 30); - - writeUInt32BE(packet, chan, p += 30); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - writeUInt32BE(packet, pathLen, p += 4); - packet.utf8Write(cfg.socketPath, p += 4, pathLen); - - // zero-fill reserved fields (string and uint32) - bufferFill(packet, 0, p += pathLen, p + 8); - - if (this._debug) { - this._debug( - 'Outbound: Sending CHANNEL_OPEN ' - + `(r:${chan}, direct-streamlocal@openssh.com)` - ); - } - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_noMoreSessions(wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 28 + 1); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 28, ++p); - packet.utf8Write('no-more-sessions@openssh.com', p += 4, 28); - - packet[p += 28] = (wantReply === undefined || wantReply === true ? 1 : 0); - - this._debug && this._debug( - 'Outbound: Sending GLOBAL_REQUEST (no-more-sessions@openssh.com)' - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - session(chan, initWindow, maxPacket) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 7 + 4 + 4 + 4); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 7, ++p); - packet.utf8Write('session', p += 4, 7); - - writeUInt32BE(packet, chan, p += 7); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - this._debug - && this._debug(`Outbound: Sending CHANNEL_OPEN (r:${chan}, session)`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - windowChange(chan, rows, cols, height, width) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 13 + 1 + 4 + 4 + 4 + 4 - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 13, p += 4); - packet.utf8Write('window-change', p += 4, 13); - - packet[p += 13] = 0; - - writeUInt32BE(packet, cols, ++p); - - writeUInt32BE(packet, rows, p += 4); - - writeUInt32BE(packet, width, p += 4); - - writeUInt32BE(packet, height, p += 4); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, window-change)` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - pty(chan, rows, cols, height, width, term, modes, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - if (!term || !term.length) - term = 'vt100'; - if (modes - && !Buffer.isBuffer(modes) - && !Array.isArray(modes) - && typeof modes === 'object' - && modes !== null) { - modes = modesToBytes(modes); - } - if (!modes || !modes.length) - modes = NO_TERMINAL_MODES_BUFFER; - - const termLen = term.length; - const modesLen = modes.length; - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 7 + 1 + 4 + termLen + 4 + 4 + 4 + 4 + 4 + modesLen - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 7, p += 4); - packet.utf8Write('pty-req', p += 4, 7); - - packet[p += 7] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, termLen, ++p); - packet.utf8Write(term, p += 4, termLen); - - writeUInt32BE(packet, cols, p += termLen); - - writeUInt32BE(packet, rows, p += 4); - - writeUInt32BE(packet, width, p += 4); - - writeUInt32BE(packet, height, p += 4); - - writeUInt32BE(packet, modesLen, p += 4); - p += 4; - if (Array.isArray(modes)) { - for (let i = 0; i < modesLen; ++i) - packet[p++] = modes[i]; - } else if (Buffer.isBuffer(modes)) { - packet.set(modes, p); - } - - this._debug - && this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${chan}, pty-req)`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - shell(chan, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 5 + 1); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 5, p += 4); - packet.utf8Write('shell', p += 4, 5); - - packet[p += 5] = (wantReply === undefined || wantReply === true ? 1 : 0); - - this._debug - && this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${chan}, shell)`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - exec(chan, cmd, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - const isBuf = Buffer.isBuffer(cmd); - const cmdLen = (isBuf ? cmd.length : Buffer.byteLength(cmd)); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 4 + 1 + 4 + cmdLen); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 4, p += 4); - packet.utf8Write('exec', p += 4, 4); - - packet[p += 4] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, cmdLen, ++p); - if (isBuf) - packet.set(cmd, p += 4); - else - packet.utf8Write(cmd, p += 4, cmdLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, exec: ${cmd})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - signal(chan, signal) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - const origSignal = signal; - - signal = signal.toUpperCase(); - if (signal.slice(0, 3) === 'SIG') - signal = signal.slice(3); - - if (SIGNALS[signal] !== 1) - throw new Error(`Invalid signal: ${origSignal}`); - - const signalLen = signal.length; - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 6 + 1 + 4 + signalLen - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 6, p += 4); - packet.utf8Write('signal', p += 4, 6); - - packet[p += 6] = 0; - - writeUInt32BE(packet, signalLen, ++p); - packet.utf8Write(signal, p += 4, signalLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, signal: ${signal})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - env(chan, key, val, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - const keyLen = Buffer.byteLength(key); - const isBuf = Buffer.isBuffer(val); - const valLen = (isBuf ? val.length : Buffer.byteLength(val)); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 3 + 1 + 4 + keyLen + 4 + valLen - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 3, p += 4); - packet.utf8Write('env', p += 4, 3); - - packet[p += 3] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, keyLen, ++p); - packet.utf8Write(key, p += 4, keyLen); - - writeUInt32BE(packet, valLen, p += keyLen); - if (isBuf) - packet.set(val, p += 4); - else - packet.utf8Write(val, p += 4, valLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, env: ${key}=${val})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - x11Forward(chan, cfg, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - const protocol = cfg.protocol; - const cookie = cfg.cookie; - const isBufProto = Buffer.isBuffer(protocol); - const protoLen = (isBufProto - ? protocol.length - : Buffer.byteLength(protocol)); - const isBufCookie = Buffer.isBuffer(cookie); - const cookieLen = (isBufCookie - ? cookie.length - : Buffer.byteLength(cookie)); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 7 + 1 + 1 + 4 + protoLen + 4 + cookieLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 7, p += 4); - packet.utf8Write('x11-req', p += 4, 7); - - packet[p += 7] = (wantReply === undefined || wantReply === true ? 1 : 0); - - packet[++p] = (cfg.single ? 1 : 0); - - writeUInt32BE(packet, protoLen, ++p); - if (isBufProto) - packet.set(protocol, p += 4); - else - packet.utf8Write(protocol, p += 4, protoLen); - - writeUInt32BE(packet, cookieLen, p += protoLen); - if (isBufCookie) - packet.set(cookie, p += 4); - else - packet.latin1Write(cookie, p += 4, cookieLen); - - writeUInt32BE(packet, (cfg.screen || 0), p += cookieLen); - - this._debug - && this._debug(`Outbound: Sending CHANNEL_REQUEST (r:${chan}, x11-req)`); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - subsystem(chan, name, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - const nameLen = Buffer.byteLength(name); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 9 + 1 + 4 + nameLen); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 9, p += 4); - packet.utf8Write('subsystem', p += 4, 9); - - packet[p += 9] = (wantReply === undefined || wantReply === true ? 1 : 0); - - writeUInt32BE(packet, nameLen, ++p); - packet.utf8Write(name, p += 4, nameLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, subsystem: ${name})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_agentForward(chan, wantReply) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - // Does not consume window space - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 26 + 1); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 26, p += 4); - packet.utf8Write('auth-agent-req@openssh.com', p += 4, 26); - - packet[p += 26] = (wantReply === undefined || wantReply === true ? 1 : 0); - - if (this._debug) { - this._debug( - 'Outbound: Sending CHANNEL_REQUEST ' - + `(r:${chan}, auth-agent-req@openssh.com)` - ); - } - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_hostKeysProve(keys) { - if (this._server) - throw new Error('Client-only method called in server mode'); - - let keysTotal = 0; - const publicKeys = []; - for (const key of keys) { - const publicKey = key.getPublicSSH(); - keysTotal += 4 + publicKey.length; - publicKeys.push(publicKey); - } - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 29 + 1 + keysTotal); - - packet[p] = MESSAGE.GLOBAL_REQUEST; - - writeUInt32BE(packet, 29, ++p); - packet.utf8Write('hostkeys-prove-00@openssh.com', p += 4, 29); - - packet[p += 29] = 1; // want reply - - ++p; - for (const buf of publicKeys) { - writeUInt32BE(packet, buf.length, p); - bufferCopy(buf, packet, 0, buf.length, p += 4); - p += buf.length; - } - - if (this._debug) { - this._debug( - 'Outbound: Sending GLOBAL_REQUEST (hostkeys-prove-00@openssh.com)' - ); - } - sendPacket(this, this._packetRW.write.finalize(packet)); - } - - // =========================================================================== - // Server-specific =========================================================== - // =========================================================================== - - // Global - // ------ - serviceAccept(svcName) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - const svcNameLen = Buffer.byteLength(svcName); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + svcNameLen); - - packet[p] = MESSAGE.SERVICE_ACCEPT; - - writeUInt32BE(packet, svcNameLen, ++p); - packet.utf8Write(svcName, p += 4, svcNameLen); - - this._debug && this._debug(`Outbound: Sending SERVICE_ACCEPT (${svcName})`); - sendPacket(this, this._packetRW.write.finalize(packet)); - - if (this._server && this._banner && svcName === 'ssh-userauth') { - const banner = this._banner; - this._banner = undefined; // Prevent banner from being displayed again - const bannerLen = Buffer.byteLength(banner); - p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + bannerLen + 4); - - packet[p] = MESSAGE.USERAUTH_BANNER; - - writeUInt32BE(packet, bannerLen, ++p); - packet.utf8Write(banner, p += 4, bannerLen); - - writeUInt32BE(packet, 0, p += bannerLen); // Empty language tag - - this._debug && this._debug('Outbound: Sending USERAUTH_BANNER'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - } - // 'ssh-connection' service-specific - forwardedTcpip(chan, initWindow, maxPacket, cfg) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - const boundAddrLen = Buffer.byteLength(cfg.boundAddr); - const remoteAddrLen = Buffer.byteLength(cfg.remoteAddr); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 15 + 4 + 4 + 4 + 4 + boundAddrLen + 4 + 4 + remoteAddrLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 15, ++p); - packet.utf8Write('forwarded-tcpip', p += 4, 15); - - writeUInt32BE(packet, chan, p += 15); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - writeUInt32BE(packet, boundAddrLen, p += 4); - packet.utf8Write(cfg.boundAddr, p += 4, boundAddrLen); - - writeUInt32BE(packet, cfg.boundPort, p += boundAddrLen); - - writeUInt32BE(packet, remoteAddrLen, p += 4); - packet.utf8Write(cfg.remoteAddr, p += 4, remoteAddrLen); - - writeUInt32BE(packet, cfg.remotePort, p += remoteAddrLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_OPEN (r:${chan}, forwarded-tcpip)` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - x11(chan, initWindow, maxPacket, cfg) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - const addrLen = Buffer.byteLength(cfg.originAddr); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 3 + 4 + 4 + 4 + 4 + addrLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 3, ++p); - packet.utf8Write('x11', p += 4, 3); - - writeUInt32BE(packet, chan, p += 3); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - writeUInt32BE(packet, addrLen, p += 4); - packet.utf8Write(cfg.originAddr, p += 4, addrLen); - - writeUInt32BE(packet, cfg.originPort, p += addrLen); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_OPEN (r:${chan}, x11)` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_authAgent(chan, initWindow, maxPacket) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 22 + 4 + 4 + 4); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 22, ++p); - packet.utf8Write('auth-agent@openssh.com', p += 4, 22); - - writeUInt32BE(packet, chan, p += 22); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_OPEN (r:${chan}, auth-agent@openssh.com)` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - openssh_forwardedStreamLocal(chan, initWindow, maxPacket, cfg) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - const pathLen = Buffer.byteLength(cfg.socketPath); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 33 + 4 + 4 + 4 + 4 + pathLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_OPEN; - - writeUInt32BE(packet, 33, ++p); - packet.utf8Write('forwarded-streamlocal@openssh.com', p += 4, 33); - - writeUInt32BE(packet, chan, p += 33); - - writeUInt32BE(packet, initWindow, p += 4); - - writeUInt32BE(packet, maxPacket, p += 4); - - writeUInt32BE(packet, pathLen, p += 4); - packet.utf8Write(cfg.socketPath, p += 4, pathLen); - - writeUInt32BE(packet, 0, p += pathLen); - - if (this._debug) { - this._debug( - 'Outbound: Sending CHANNEL_OPEN ' - + `(r:${chan}, forwarded-streamlocal@openssh.com)` - ); - } - sendPacket(this, this._packetRW.write.finalize(packet)); - } - exitStatus(chan, status) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - // Does not consume window space - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + 4 + 11 + 1 + 4); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 11, p += 4); - packet.utf8Write('exit-status', p += 4, 11); - - packet[p += 11] = 0; - - writeUInt32BE(packet, status, ++p); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, exit-status: ${status})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - exitSignal(chan, name, coreDumped, msg) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - // Does not consume window space - - const origSignal = name; - - if (typeof origSignal !== 'string' || !origSignal) - throw new Error(`Invalid signal: ${origSignal}`); - - let signal = name.toUpperCase(); - if (signal.slice(0, 3) === 'SIG') - signal = signal.slice(3); - - if (SIGNALS[signal] !== 1) - throw new Error(`Invalid signal: ${origSignal}`); - - const nameLen = Buffer.byteLength(signal); - const msgLen = (msg ? Buffer.byteLength(msg) : 0); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + 4 + 11 + 1 + 4 + nameLen + 1 + 4 + msgLen + 4 - ); - - packet[p] = MESSAGE.CHANNEL_REQUEST; - - writeUInt32BE(packet, chan, ++p); - - writeUInt32BE(packet, 11, p += 4); - packet.utf8Write('exit-signal', p += 4, 11); - - packet[p += 11] = 0; - - writeUInt32BE(packet, nameLen, ++p); - packet.utf8Write(signal, p += 4, nameLen); - - packet[p += nameLen] = (coreDumped ? 1 : 0); - - writeUInt32BE(packet, msgLen, ++p); - - p += 4; - if (msgLen) { - packet.utf8Write(msg, p, msgLen); - p += msgLen; - } - - writeUInt32BE(packet, 0, p); - - this._debug && this._debug( - `Outbound: Sending CHANNEL_REQUEST (r:${chan}, exit-signal: ${name})` - ); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - // 'ssh-userauth' service-specific - authFailure(authMethods, isPartial) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - if (this._authsQueue.length === 0) - throw new Error('No auth in progress'); - - let methods; - - if (typeof authMethods === 'boolean') { - isPartial = authMethods; - authMethods = undefined; - } - - if (authMethods) { - methods = []; - for (let i = 0; i < authMethods.length; ++i) { - if (authMethods[i].toLowerCase() === 'none') - continue; - methods.push(authMethods[i]); - } - methods = methods.join(','); - } else { - methods = ''; - } - - const methodsLen = methods.length; - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + methodsLen + 1); - - packet[p] = MESSAGE.USERAUTH_FAILURE; - - writeUInt32BE(packet, methodsLen, ++p); - packet.utf8Write(methods, p += 4, methodsLen); - - packet[p += methodsLen] = (isPartial === true ? 1 : 0); - - this._authsQueue.shift(); - - this._debug && this._debug('Outbound: Sending USERAUTH_FAILURE'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authSuccess() { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - if (this._authsQueue.length === 0) - throw new Error('No auth in progress'); - - const p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1); - - packet[p] = MESSAGE.USERAUTH_SUCCESS; - - this._authsQueue.shift(); - this._authenticated = true; - - this._debug && this._debug('Outbound: Sending USERAUTH_SUCCESS'); - sendPacket(this, this._packetRW.write.finalize(packet)); - - if (this._kex.negotiated.cs.compress === 'zlib@openssh.com') - this._packetRW.read = new ZlibPacketReader(); - if (this._kex.negotiated.sc.compress === 'zlib@openssh.com') - this._packetRW.write = new ZlibPacketWriter(this); - } - authPKOK(keyAlgo, key) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - if (this._authsQueue.length === 0 || this._authsQueue[0] !== 'publickey') - throw new Error('"publickey" auth not in progress'); - - // TODO: support parsed key for `key` - - const keyAlgoLen = Buffer.byteLength(keyAlgo); - const keyLen = key.length; - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + keyAlgoLen + 4 + keyLen); - - packet[p] = MESSAGE.USERAUTH_PK_OK; - - writeUInt32BE(packet, keyAlgoLen, ++p); - packet.utf8Write(keyAlgo, p += 4, keyAlgoLen); - - writeUInt32BE(packet, keyLen, p += keyAlgoLen); - packet.set(key, p += 4); - - this._authsQueue.shift(); - - this._debug && this._debug('Outbound: Sending USERAUTH_PK_OK'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authPasswdChg(prompt) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - const promptLen = Buffer.byteLength(prompt); - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc(1 + 4 + promptLen + 4); - - packet[p] = MESSAGE.USERAUTH_PASSWD_CHANGEREQ; - - writeUInt32BE(packet, promptLen, ++p); - packet.utf8Write(prompt, p += 4, promptLen); - - writeUInt32BE(packet, 0, p += promptLen); // Empty language tag - - this._debug && this._debug('Outbound: Sending USERAUTH_PASSWD_CHANGEREQ'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } - authInfoReq(name, instructions, prompts) { - if (!this._server) - throw new Error('Server-only method called in client mode'); - - let promptsLen = 0; - const nameLen = name ? Buffer.byteLength(name) : 0; - const instrLen = instructions ? Buffer.byteLength(instructions) : 0; - - for (let i = 0; i < prompts.length; ++i) - promptsLen += 4 + Buffer.byteLength(prompts[i].prompt) + 1; - - let p = this._packetRW.write.allocStart; - const packet = this._packetRW.write.alloc( - 1 + 4 + nameLen + 4 + instrLen + 4 + 4 + promptsLen - ); - - packet[p] = MESSAGE.USERAUTH_INFO_REQUEST; - - writeUInt32BE(packet, nameLen, ++p); - p += 4; - if (name) { - packet.utf8Write(name, p, nameLen); - p += nameLen; - } - - writeUInt32BE(packet, instrLen, p); - p += 4; - if (instructions) { - packet.utf8Write(instructions, p, instrLen); - p += instrLen; - } - - writeUInt32BE(packet, 0, p); - - writeUInt32BE(packet, prompts.length, p += 4); - p += 4; - for (let i = 0; i < prompts.length; ++i) { - const prompt = prompts[i]; - const promptLen = Buffer.byteLength(prompt.prompt); - - writeUInt32BE(packet, promptLen, p); - p += 4; - if (promptLen) { - packet.utf8Write(prompt.prompt, p, promptLen); - p += promptLen; - } - packet[p++] = (prompt.echo ? 1 : 0); - } - - this._debug && this._debug('Outbound: Sending USERAUTH_INFO_REQUEST'); - sendPacket(this, this._packetRW.write.finalize(packet)); - } -} - -// SSH-protoversion-softwareversion (SP comments) CR LF -const RE_IDENT = /^SSH-(2\.0|1\.99)-([^ ]+)(?: (.*))?$/; - -// TODO: optimize this by starting n bytes from the end of this._buffer instead -// of the beginning -function parseHeader(chunk, p, len) { - let data; - let chunkOffset; - if (this._buffer) { - data = Buffer.allocUnsafe(this._buffer.length + (len - p)); - data.set(this._buffer, 0); - if (p === 0) { - data.set(chunk, this._buffer.length); - } else { - data.set(new Uint8Array(chunk.buffer, - chunk.byteOffset + p, - (len - p)), - this._buffer.length); - } - chunkOffset = this._buffer.length; - p = 0; - } else { - data = chunk; - chunkOffset = 0; - } - const op = p; - let start = p; - let end = p; - let needNL = false; - let lineLen = 0; - let lines = 0; - for (; p < data.length; ++p) { - const ch = data[p]; - - if (ch === 13 /* '\r' */) { - needNL = true; - continue; - } - - if (ch === 10 /* '\n' */) { - if (end > start - && end - start > 4 - && data[start] === 83 /* 'S' */ - && data[start + 1] === 83 /* 'S' */ - && data[start + 2] === 72 /* 'H' */ - && data[start + 3] === 45 /* '-' */) { - - const full = data.latin1Slice(op, end + 1); - const identRaw = (start === op ? full : full.slice(start - op)); - const m = RE_IDENT.exec(identRaw); - if (!m) - throw new Error('Invalid identification string'); - - const header = { - greeting: (start === op ? '' : full.slice(0, start - op)), - identRaw, - versions: { - protocol: m[1], - software: m[2], - }, - comments: m[3] - }; - - // Needed during handshake - this._remoteIdentRaw = Buffer.from(identRaw); - - this._debug && this._debug(`Remote ident: ${inspect(identRaw)}`); - this._compatFlags = getCompatFlags(header); - - this._buffer = undefined; - this._decipher = - new NullDecipher(0, onKEXPayload.bind(this, { firstPacket: true })); - this._parse = parsePacket; - - this._onHeader(header); - if (!this._destruct) { - // We disconnected inside _onHeader - return len; - } - - kexinit(this); - - return p + 1 - chunkOffset; - } - - // Only allow pre-ident greetings when we're a client - if (this._server) - throw new Error('Greetings from clients not permitted'); - - if (++lines > MAX_LINES) - throw new Error('Max greeting lines exceeded'); - - needNL = false; - start = p + 1; - lineLen = 0; - } else if (needNL) { - throw new Error('Invalid header: expected newline'); - } else if (++lineLen >= MAX_LINE_LEN) { - throw new Error('Header line too long'); - } - - end = p; - } - if (!this._buffer) - this._buffer = bufferSlice(data, op); - - return p - chunkOffset; -} - -function parsePacket(chunk, p, len) { - return this._decipher.decrypt(chunk, p, len); -} - -function onPayload(payload) { - // XXX: move this to the Decipher implementations? - - this._onPacket(); - - if (payload.length === 0) { - this._debug && this._debug('Inbound: Skipping empty packet payload'); - return; - } - - payload = this._packetRW.read.read(payload); - - const type = payload[0]; - if (type === MESSAGE.USERAUTH_SUCCESS - && !this._server - && !this._authenticated) { - this._authenticated = true; - if (this._kex.negotiated.cs.compress === 'zlib@openssh.com') - this._packetRW.write = new ZlibPacketWriter(this); - if (this._kex.negotiated.sc.compress === 'zlib@openssh.com') - this._packetRW.read = new ZlibPacketReader(); - } - const handler = MESSAGE_HANDLERS[type]; - if (handler === undefined) { - this._debug && this._debug(`Inbound: Unsupported message type: ${type}`); - return; - } - - return handler(this, payload); -} - -function getCompatFlags(header) { - const software = header.versions.software; - - let flags = 0; - - for (const rule of COMPAT_CHECKS) { - if (typeof rule[0] === 'string') { - if (software === rule[0]) - flags |= rule[1]; - } else if (rule[0].test(software)) { - flags |= rule[1]; - } - } - - return flags; -} - -function modesToBytes(modes) { - const keys = Object.keys(modes); - const bytes = Buffer.allocUnsafe((5 * keys.length) + 1); - let b = 0; - - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - if (key === 'TTY_OP_END') - continue; - - const opcode = TERMINAL_MODE[key]; - if (opcode === undefined) - continue; - - const val = modes[key]; - if (typeof val === 'number' && isFinite(val)) { - bytes[b++] = opcode; - bytes[b++] = val >>> 24; - bytes[b++] = val >>> 16; - bytes[b++] = val >>> 8; - bytes[b++] = val; - } - } - - bytes[b++] = TERMINAL_MODE.TTY_OP_END; - - if (b < bytes.length) - return bufferSlice(bytes, 0, b); - - return bytes; -} - -module.exports = Protocol; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/SFTP.js b/reverse_engineering/node_modules/ssh2/lib/protocol/SFTP.js deleted file mode 100644 index b10d9e53..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/SFTP.js +++ /dev/null @@ -1,3778 +0,0 @@ -'use strict'; - -const EventEmitter = require('events'); -const fs = require('fs'); -const { constants } = fs; -const { - Readable: ReadableStream, - Writable: WritableStream -} = require('stream'); -const { inherits, isDate } = require('util'); - -const FastBuffer = Buffer[Symbol.species]; - -const { - bufferCopy, - bufferSlice, - makeBufferParser, - writeUInt32BE, -} = require('./utils.js'); - -const ATTR = { - SIZE: 0x00000001, - UIDGID: 0x00000002, - PERMISSIONS: 0x00000004, - ACMODTIME: 0x00000008, - EXTENDED: 0x80000000, -}; - -// Large enough to store all possible attributes -const ATTRS_BUF = Buffer.alloc(28); - -const STATUS_CODE = { - OK: 0, - EOF: 1, - NO_SUCH_FILE: 2, - PERMISSION_DENIED: 3, - FAILURE: 4, - BAD_MESSAGE: 5, - NO_CONNECTION: 6, - CONNECTION_LOST: 7, - OP_UNSUPPORTED: 8 -}; - -const VALID_STATUS_CODES = new Map( - Object.values(STATUS_CODE).map((n) => [n, 1]) -); - -const STATUS_CODE_STR = { - [STATUS_CODE.OK]: 'No error', - [STATUS_CODE.EOF]: 'End of file', - [STATUS_CODE.NO_SUCH_FILE]: 'No such file or directory', - [STATUS_CODE.PERMISSION_DENIED]: 'Permission denied', - [STATUS_CODE.FAILURE]: 'Failure', - [STATUS_CODE.BAD_MESSAGE]: 'Bad message', - [STATUS_CODE.NO_CONNECTION]: 'No connection', - [STATUS_CODE.CONNECTION_LOST]: 'Connection lost', - [STATUS_CODE.OP_UNSUPPORTED]: 'Operation unsupported', -}; - -const REQUEST = { - INIT: 1, - OPEN: 3, - CLOSE: 4, - READ: 5, - WRITE: 6, - LSTAT: 7, - FSTAT: 8, - SETSTAT: 9, - FSETSTAT: 10, - OPENDIR: 11, - READDIR: 12, - REMOVE: 13, - MKDIR: 14, - RMDIR: 15, - REALPATH: 16, - STAT: 17, - RENAME: 18, - READLINK: 19, - SYMLINK: 20, - EXTENDED: 200 -}; - -const RESPONSE = { - VERSION: 2, - STATUS: 101, - HANDLE: 102, - DATA: 103, - NAME: 104, - ATTRS: 105, - EXTENDED: 201 -}; - -const OPEN_MODE = { - READ: 0x00000001, - WRITE: 0x00000002, - APPEND: 0x00000004, - CREAT: 0x00000008, - TRUNC: 0x00000010, - EXCL: 0x00000020 -}; - -const PKT_RW_OVERHEAD = 2 * 1024; -const MAX_REQID = 2 ** 32 - 1; -const CLIENT_VERSION_BUFFER = Buffer.from([ - 0, 0, 0, 5 /* length */, - REQUEST.INIT, - 0, 0, 0, 3 /* version */ -]); -const SERVER_VERSION_BUFFER = Buffer.from([ - 0, 0, 0, 5 /* length */, - RESPONSE.VERSION, - 0, 0, 0, 3 /* version */ -]); - -const RE_OPENSSH = /^SSH-2.0-(?:OpenSSH|dropbear)/; -const OPENSSH_MAX_PKT_LEN = 256 * 1024; - -const bufferParser = makeBufferParser(); - -const fakeStderr = { - readable: false, - writable: false, - push: (data) => {}, - once: () => {}, - on: () => {}, - emit: () => {}, - end: () => {}, -}; - -function noop() {} - -// Emulates enough of `Channel` to be able to be used as a drop-in replacement -// in order to process incoming data with as little overhead as possible -class SFTP extends EventEmitter { - constructor(client, chanInfo, cfg) { - super(); - - if (typeof cfg !== 'object' || !cfg) - cfg = {}; - - const remoteIdentRaw = client._protocol._remoteIdentRaw; - - this.server = !!cfg.server; - this._debug = (typeof cfg.debug === 'function' ? cfg.debug : undefined); - this._isOpenSSH = (remoteIdentRaw && RE_OPENSSH.test(remoteIdentRaw)); - - this._version = -1; - this._extensions = {}; - this._biOpt = cfg.biOpt; - this._pktLenBytes = 0; - this._pktLen = 0; - this._pktPos = 0; - this._pktType = 0; - this._pktData = undefined; - this._writeReqid = -1; - this._requests = {}; - this._maxInPktLen = OPENSSH_MAX_PKT_LEN; - this._maxOutPktLen = 34000; - this._maxReadLen = - (this._isOpenSSH ? OPENSSH_MAX_PKT_LEN : 34000) - PKT_RW_OVERHEAD; - this._maxWriteLen = - (this._isOpenSSH ? OPENSSH_MAX_PKT_LEN : 34000) - PKT_RW_OVERHEAD; - - this.maxOpenHandles = undefined; - - // Channel compatibility - this._client = client; - this._protocol = client._protocol; - this._callbacks = []; - this._hasX11 = false; - this._exit = { - code: undefined, - signal: undefined, - dump: undefined, - desc: undefined, - }; - this._waitWindow = false; // SSH-level backpressure - this._chunkcb = undefined; - this._buffer = []; - this.type = chanInfo.type; - this.subtype = undefined; - this.incoming = chanInfo.incoming; - this.outgoing = chanInfo.outgoing; - this.stderr = fakeStderr; - this.readable = true; - } - - // This handles incoming data to parse - push(data) { - if (data === null) { - cleanupRequests(this); - if (!this.readable) - return; - // No more incoming data from the remote side - this.readable = false; - this.emit('end'); - return; - } - /* - uint32 length - byte type - byte[length - 1] data payload - */ - let p = 0; - - while (p < data.length) { - if (this._pktLenBytes < 4) { - let nb = Math.min(4 - this._pktLenBytes, data.length - p); - this._pktLenBytes += nb; - - while (nb--) - this._pktLen = (this._pktLen << 8) + data[p++]; - - if (this._pktLenBytes < 4) - return; - if (this._pktLen === 0) - return doFatalSFTPError(this, 'Invalid packet length'); - if (this._pktLen > this._maxInPktLen) { - const max = this._maxInPktLen; - return doFatalSFTPError( - this, - `Packet length ${this._pktLen} exceeds max length of ${max}` - ); - } - if (p >= data.length) - return; - } - if (this._pktPos < this._pktLen) { - const nb = Math.min(this._pktLen - this._pktPos, data.length - p); - if (p !== 0 || nb !== data.length) { - if (nb === this._pktLen) { - this._pkt = new FastBuffer(data.buffer, data.byteOffset + p, nb); - } else { - if (!this._pkt) - this._pkt = Buffer.allocUnsafe(this._pktLen); - this._pkt.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._pktPos - ); - } - } else if (nb === this._pktLen) { - this._pkt = data; - } else { - if (!this._pkt) - this._pkt = Buffer.allocUnsafe(this._pktLen); - this._pkt.set(data, this._pktPos); - } - p += nb; - this._pktPos += nb; - if (this._pktPos < this._pktLen) - return; - } - - const type = this._pkt[0]; - const payload = this._pkt; - - // Prepare for next packet - this._pktLen = 0; - this._pktLenBytes = 0; - this._pkt = undefined; - this._pktPos = 0; - - const handler = (this.server - ? SERVER_HANDLERS[type] - : CLIENT_HANDLERS[type]); - if (!handler) - return doFatalSFTPError(this, `Unknown packet type ${type}`); - - if (this._version === -1) { - if (this.server) { - if (type !== REQUEST.INIT) - return doFatalSFTPError(this, `Expected INIT packet, got ${type}`); - } else if (type !== RESPONSE.VERSION) { - return doFatalSFTPError(this, `Expected VERSION packet, got ${type}`); - } - } - - if (handler(this, payload) === false) - return; - } - } - - end() { - this.destroy(); - } - destroy() { - if (this.outgoing.state === 'open' || this.outgoing.state === 'eof') { - this.outgoing.state = 'closing'; - this._protocol.channelClose(this.outgoing.id); - } - } - _init() { - this._init = noop; - if (!this.server) - sendOrBuffer(this, CLIENT_VERSION_BUFFER); - } - - // =========================================================================== - // Client-specific =========================================================== - // =========================================================================== - createReadStream(path, options) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - return new ReadStream(this, path, options); - } - createWriteStream(path, options) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - return new WriteStream(this, path, options); - } - open(path, flags_, attrs, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (typeof attrs === 'function') { - cb = attrs; - attrs = undefined; - } - - const flags = (typeof flags_ === 'number' ? flags_ : stringToFlags(flags_)); - if (flags === null) - throw new Error(`Unknown flags string: ${flags_}`); - - let attrsFlags = 0; - let attrsLen = 0; - if (typeof attrs === 'string' || typeof attrs === 'number') - attrs = { mode: attrs }; - if (typeof attrs === 'object' && attrs !== null) { - attrs = attrsToBytes(attrs); - attrsFlags = attrs.flags; - attrsLen = attrs.nb; - } - - /* - uint32 id - string filename - uint32 pflags - ATTRS attrs - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.OPEN; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - writeUInt32BE(buf, flags, p += pathLen); - writeUInt32BE(buf, attrsFlags, p += 4); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} OPEN` - ); - } - close(handle, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - /* - uint32 id - string handle - */ - const handleLen = handle.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.CLOSE; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, handleLen, p); - buf.set(handle, p += 4); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} CLOSE` - ); - } - read(handle, buf, off, len, position, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - if (!Buffer.isBuffer(buf)) - throw new Error('buffer is not a Buffer'); - if (off >= buf.length) - throw new Error('offset is out of bounds'); - if (off + len > buf.length) - throw new Error('length extends beyond buffer'); - if (position === null) - throw new Error('null position currently unsupported'); - - read_(this, handle, buf, off, len, position, cb); - } - readData(handle, buf, off, len, position, cb) { - // Backwards compatibility - this.read(handle, buf, off, len, position, cb); - } - write(handle, buf, off, len, position, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - if (!Buffer.isBuffer(buf)) - throw new Error('buffer is not a Buffer'); - if (off > buf.length) - throw new Error('offset is out of bounds'); - if (off + len > buf.length) - throw new Error('length extends beyond buffer'); - if (position === null) - throw new Error('null position currently unsupported'); - - if (!len) { - cb && process.nextTick(cb, undefined, 0); - return; - } - - const maxDataLen = this._maxWriteLen; - const overflow = Math.max(len - maxDataLen, 0); - const origPosition = position; - - if (overflow) - len = maxDataLen; - - /* - uint32 id - string handle - uint64 offset - string data - */ - const handleLen = handle.length; - let p = 9; - const out = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen + 8 + 4 + len); - - writeUInt32BE(out, out.length - 4, 0); - out[4] = REQUEST.WRITE; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(out, reqid, 5); - - writeUInt32BE(out, handleLen, p); - out.set(handle, p += 4); - p += handleLen; - for (let i = 7; i >= 0; --i) { - out[p + i] = position & 0xFF; - position /= 256; - } - writeUInt32BE(out, len, p += 8); - bufferCopy(buf, out, off, off + len, p += 4); - - this._requests[reqid] = { - cb: (err) => { - if (err) { - if (typeof cb === 'function') - cb(err); - } else if (overflow) { - this.write(handle, - buf, - off + len, - overflow, - origPosition + len, - cb); - } else if (typeof cb === 'function') { - cb(undefined, off + len); - } - } - }; - - const isSent = sendOrBuffer(this, out); - if (this._debug) { - const how = (isSent ? 'Sent' : 'Buffered'); - this._debug(`SFTP: Outbound: ${how} WRITE (id:${reqid})`); - } - } - writeData(handle, buf, off, len, position, cb) { - // Backwards compatibility - this.write(handle, buf, off, len, position, cb); - } - fastGet(remotePath, localPath, opts, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - fastXfer(this, fs, remotePath, localPath, opts, cb); - } - fastPut(localPath, remotePath, opts, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - fastXfer(fs, this, localPath, remotePath, opts, cb); - } - readFile(path, options, callback_) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - let callback; - if (typeof callback_ === 'function') { - callback = callback_; - } else if (typeof options === 'function') { - callback = options; - options = undefined; - } - - if (typeof options === 'string') - options = { encoding: options, flag: 'r' }; - else if (!options) - options = { encoding: null, flag: 'r' }; - else if (typeof options !== 'object') - throw new TypeError('Bad arguments'); - - const encoding = options.encoding; - if (encoding && !Buffer.isEncoding(encoding)) - throw new Error(`Unknown encoding: ${encoding}`); - - // First stat the file, so we know the size. - let size; - let buffer; // Single buffer with file data - let buffers; // List for when size is unknown - let pos = 0; - let handle; - - // SFTPv3 does not support using -1 for read position, so we have to track - // read position manually - let bytesRead = 0; - - const flag = options.flag || 'r'; - - const read = () => { - if (size === 0) { - buffer = Buffer.allocUnsafe(8192); - this.read(handle, buffer, 0, 8192, bytesRead, afterRead); - } else { - this.read(handle, buffer, pos, size - pos, bytesRead, afterRead); - } - }; - - const afterRead = (er, nbytes) => { - let eof; - if (er) { - eof = (er.code === STATUS_CODE.EOF); - if (!eof) { - return this.close(handle, () => { - return callback && callback(er); - }); - } - } else { - eof = false; - } - - if (eof || (size === 0 && nbytes === 0)) - return close(); - - bytesRead += nbytes; - pos += nbytes; - if (size !== 0) { - if (pos === size) - close(); - else - read(); - } else { - // Unknown size, just read until we don't get bytes. - buffers.push(bufferSlice(buffer, 0, nbytes)); - read(); - } - }; - afterRead._wantEOFError = true; - - const close = () => { - this.close(handle, (er) => { - if (size === 0) { - // Collect the data into the buffers list. - buffer = Buffer.concat(buffers, pos); - } else if (pos < size) { - buffer = bufferSlice(buffer, 0, pos); - } - - if (encoding) - buffer = buffer.toString(encoding); - return callback && callback(er, buffer); - }); - }; - - this.open(path, flag, 0o666, (er, handle_) => { - if (er) - return callback && callback(er); - handle = handle_; - - const tryStat = (er, st) => { - if (er) { - // Try stat() for sftp servers that may not support fstat() for - // whatever reason - this.stat(path, (er_, st_) => { - if (er_) { - return this.close(handle, () => { - callback && callback(er); - }); - } - tryStat(null, st_); - }); - return; - } - - size = st.size || 0; - if (size === 0) { - // The kernel lies about many files. - // Go ahead and try to read some bytes. - buffers = []; - return read(); - } - - buffer = Buffer.allocUnsafe(size); - read(); - }; - this.fstat(handle, tryStat); - }); - } - writeFile(path, data, options, callback_) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - let callback; - if (typeof callback_ === 'function') { - callback = callback_; - } else if (typeof options === 'function') { - callback = options; - options = undefined; - } - - if (typeof options === 'string') - options = { encoding: options, mode: 0o666, flag: 'w' }; - else if (!options) - options = { encoding: 'utf8', mode: 0o666, flag: 'w' }; - else if (typeof options !== 'object') - throw new TypeError('Bad arguments'); - - if (options.encoding && !Buffer.isEncoding(options.encoding)) - throw new Error(`Unknown encoding: ${options.encoding}`); - - const flag = options.flag || 'w'; - this.open(path, flag, options.mode, (openErr, handle) => { - if (openErr) { - callback && callback(openErr); - } else { - const buffer = (Buffer.isBuffer(data) - ? data - : Buffer.from('' + data, options.encoding || 'utf8')); - const position = (/a/.test(flag) ? null : 0); - - // SFTPv3 does not support the notion of 'current position' - // (null position), so we just attempt to append to the end of the file - // instead - if (position === null) { - const tryStat = (er, st) => { - if (er) { - // Try stat() for sftp servers that may not support fstat() for - // whatever reason - this.stat(path, (er_, st_) => { - if (er_) { - return this.close(handle, () => { - callback && callback(er); - }); - } - tryStat(null, st_); - }); - return; - } - writeAll(this, handle, buffer, 0, buffer.length, st.size, callback); - }; - this.fstat(handle, tryStat); - return; - } - writeAll(this, handle, buffer, 0, buffer.length, position, callback); - } - }); - } - appendFile(path, data, options, callback_) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - let callback; - if (typeof callback_ === 'function') { - callback = callback_; - } else if (typeof options === 'function') { - callback = options; - options = undefined; - } - - if (typeof options === 'string') - options = { encoding: options, mode: 0o666, flag: 'a' }; - else if (!options) - options = { encoding: 'utf8', mode: 0o666, flag: 'a' }; - else if (typeof options !== 'object') - throw new TypeError('Bad arguments'); - - if (!options.flag) - options = Object.assign({ flag: 'a' }, options); - this.writeFile(path, data, options, callback); - } - exists(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - this.stat(path, (err) => { - cb && cb(err ? false : true); - }); - } - unlink(filename, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string filename - */ - const fnameLen = Buffer.byteLength(filename); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + fnameLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.REMOVE; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, fnameLen, p); - buf.utf8Write(filename, p += 4, fnameLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} REMOVE` - ); - } - rename(oldPath, newPath, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string oldpath - string newpath - */ - const oldLen = Buffer.byteLength(oldPath); - const newLen = Buffer.byteLength(newPath); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + oldLen + 4 + newLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.RENAME; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, oldLen, p); - buf.utf8Write(oldPath, p += 4, oldLen); - writeUInt32BE(buf, newLen, p += oldLen); - buf.utf8Write(newPath, p += 4, newLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} RENAME` - ); - } - mkdir(path, attrs, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - let flags = 0; - let attrsLen = 0; - - if (typeof attrs === 'function') { - cb = attrs; - attrs = undefined; - } - if (typeof attrs === 'object' && attrs !== null) { - attrs = attrsToBytes(attrs); - flags = attrs.flags; - attrsLen = attrs.nb; - } - - /* - uint32 id - string path - ATTRS attrs - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.MKDIR; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - writeUInt32BE(buf, flags, p += pathLen); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} MKDIR` - ); - } - rmdir(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.RMDIR; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} RMDIR` - ); - } - readdir(where, opts, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - if (typeof opts !== 'object' || opts === null) - opts = {}; - - const doFilter = (opts && opts.full ? false : true); - - if (!Buffer.isBuffer(where) && typeof where !== 'string') - throw new Error('missing directory handle or path'); - - if (typeof where === 'string') { - const entries = []; - let e = 0; - - const reread = (err, handle) => { - if (err) - return cb(err); - - this.readdir(handle, opts, (err, list) => { - const eof = (err && err.code === STATUS_CODE.EOF); - - if (err && !eof) - return this.close(handle, () => cb(err)); - - if (eof) { - return this.close(handle, (err) => { - if (err) - return cb(err); - cb(undefined, entries); - }); - } - - for (let i = 0; i < list.length; ++i, ++e) - entries[e] = list[i]; - - reread(undefined, handle); - }); - }; - return this.opendir(where, reread); - } - - /* - uint32 id - string handle - */ - const handleLen = where.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.READDIR; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, handleLen, p); - buf.set(where, p += 4); - - this._requests[reqid] = { - cb: (doFilter - ? (err, list) => { - if (typeof cb !== 'function') - return; - if (err) - return cb(err); - - for (let i = list.length - 1; i >= 0; --i) { - if (list[i].filename === '.' || list[i].filename === '..') - list.splice(i, 1); - } - - cb(undefined, list); - } - : cb) - }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} READDIR` - ); - } - fstat(handle, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - /* - uint32 id - string handle - */ - const handleLen = handle.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.FSTAT; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, handleLen, p); - buf.set(handle, p += 4); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} FSTAT` - ); - } - stat(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.STAT; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} STAT` - ); - } - lstat(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.LSTAT; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} LSTAT` - ); - } - opendir(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.OPENDIR; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} OPENDIR` - ); - } - setstat(path, attrs, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - let flags = 0; - let attrsLen = 0; - - if (typeof attrs === 'object' && attrs !== null) { - attrs = attrsToBytes(attrs); - flags = attrs.flags; - attrsLen = attrs.nb; - } else if (typeof attrs === 'function') { - cb = attrs; - } - - /* - uint32 id - string path - ATTRS attrs - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.SETSTAT; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - writeUInt32BE(buf, flags, p += pathLen); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} SETSTAT` - ); - } - fsetstat(handle, attrs, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - let flags = 0; - let attrsLen = 0; - - if (typeof attrs === 'object' && attrs !== null) { - attrs = attrsToBytes(attrs); - flags = attrs.flags; - attrsLen = attrs.nb; - } else if (typeof attrs === 'function') { - cb = attrs; - } - - /* - uint32 id - string handle - ATTRS attrs - */ - const handleLen = handle.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.FSETSTAT; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, handleLen, p); - buf.set(handle, p += 4); - writeUInt32BE(buf, flags, p += handleLen); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} FSETSTAT` - ); - } - futimes(handle, atime, mtime, cb) { - return this.fsetstat(handle, { - atime: toUnixTimestamp(atime), - mtime: toUnixTimestamp(mtime) - }, cb); - } - utimes(path, atime, mtime, cb) { - return this.setstat(path, { - atime: toUnixTimestamp(atime), - mtime: toUnixTimestamp(mtime) - }, cb); - } - fchown(handle, uid, gid, cb) { - return this.fsetstat(handle, { - uid: uid, - gid: gid - }, cb); - } - chown(path, uid, gid, cb) { - return this.setstat(path, { - uid: uid, - gid: gid - }, cb); - } - fchmod(handle, mode, cb) { - return this.fsetstat(handle, { - mode: mode - }, cb); - } - chmod(path, mode, cb) { - return this.setstat(path, { - mode: mode - }, cb); - } - readlink(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.READLINK; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { - cb: (err, names) => { - if (typeof cb !== 'function') - return; - if (err) - return cb(err); - if (!names || !names.length) - return cb(new Error('Response missing link info')); - cb(undefined, names[0].filename); - } - }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} READLINK` - ); - } - symlink(targetPath, linkPath, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string linkpath - string targetpath - */ - const linkLen = Buffer.byteLength(linkPath); - const targetLen = Buffer.byteLength(targetPath); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + linkLen + 4 + targetLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.SYMLINK; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - if (this._isOpenSSH) { - // OpenSSH has linkpath and targetpath positions switched - writeUInt32BE(buf, targetLen, p); - buf.utf8Write(targetPath, p += 4, targetLen); - writeUInt32BE(buf, linkLen, p += targetLen); - buf.utf8Write(linkPath, p += 4, linkLen); - } else { - writeUInt32BE(buf, linkLen, p); - buf.utf8Write(linkPath, p += 4, linkLen); - writeUInt32BE(buf, targetLen, p += linkLen); - buf.utf8Write(targetPath, p += 4, targetLen); - } - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} SYMLINK` - ); - } - realpath(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - /* - uint32 id - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.REALPATH; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, pathLen, p); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { - cb: (err, names) => { - if (typeof cb !== 'function') - return; - if (err) - return cb(err); - if (!names || !names.length) - return cb(new Error('Response missing path info')); - cb(undefined, names[0].filename); - } - }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} REALPATH` - ); - } - // extended requests - ext_openssh_rename(oldPath, newPath, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['posix-rename@openssh.com']; - if (!ext || ext !== '1') - throw new Error('Server does not support this extended request'); - - /* - uint32 id - string "posix-rename@openssh.com" - string oldpath - string newpath - */ - const oldLen = Buffer.byteLength(oldPath); - const newLen = Buffer.byteLength(newPath); - let p = 9; - const buf = - Buffer.allocUnsafe(4 + 1 + 4 + 4 + 24 + 4 + oldLen + 4 + newLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 24, p); - buf.utf8Write('posix-rename@openssh.com', p += 4, 24); - writeUInt32BE(buf, oldLen, p += 24); - buf.utf8Write(oldPath, p += 4, oldLen); - writeUInt32BE(buf, newLen, p += oldLen); - buf.utf8Write(newPath, p += 4, newLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const which = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${which} posix-rename@openssh.com`); - } - } - ext_openssh_statvfs(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['statvfs@openssh.com']; - if (!ext || ext !== '2') - throw new Error('Server does not support this extended request'); - - /* - uint32 id - string "statvfs@openssh.com" - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 19 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 19, p); - buf.utf8Write('statvfs@openssh.com', p += 4, 19); - writeUInt32BE(buf, pathLen, p += 19); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { extended: 'statvfs@openssh.com', cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const which = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${which} statvfs@openssh.com`); - } - } - ext_openssh_fstatvfs(handle, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['fstatvfs@openssh.com']; - if (!ext || ext !== '2') - throw new Error('Server does not support this extended request'); - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - /* - uint32 id - string "fstatvfs@openssh.com" - string handle - */ - const handleLen = handle.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 20 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 20, p); - buf.utf8Write('fstatvfs@openssh.com', p += 4, 20); - writeUInt32BE(buf, handleLen, p += 20); - buf.set(handle, p += 4); - - this._requests[reqid] = { extended: 'fstatvfs@openssh.com', cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const which = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${which} fstatvfs@openssh.com`); - } - } - ext_openssh_hardlink(oldPath, newPath, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['hardlink@openssh.com']; - if (ext !== '1') - throw new Error('Server does not support this extended request'); - - /* - uint32 id - string "hardlink@openssh.com" - string oldpath - string newpath - */ - const oldLen = Buffer.byteLength(oldPath); - const newLen = Buffer.byteLength(newPath); - let p = 9; - const buf = - Buffer.allocUnsafe(4 + 1 + 4 + 4 + 20 + 4 + oldLen + 4 + newLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 20, p); - buf.utf8Write('hardlink@openssh.com', p += 4, 20); - writeUInt32BE(buf, oldLen, p += 20); - buf.utf8Write(oldPath, p += 4, oldLen); - writeUInt32BE(buf, newLen, p += oldLen); - buf.utf8Write(newPath, p += 4, newLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const which = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${which} hardlink@openssh.com`); - } - } - ext_openssh_fsync(handle, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['fsync@openssh.com']; - if (ext !== '1') - throw new Error('Server does not support this extended request'); - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - /* - uint32 id - string "fsync@openssh.com" - string handle - */ - const handleLen = handle.length; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 17 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 17, p); - buf.utf8Write('fsync@openssh.com', p += 4, 17); - writeUInt32BE(buf, handleLen, p += 17); - buf.set(handle, p += 4); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} fsync@openssh.com` - ); - } - ext_openssh_lsetstat(path, attrs, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['lsetstat@openssh.com']; - if (ext !== '1') - throw new Error('Server does not support this extended request'); - - let flags = 0; - let attrsLen = 0; - - if (typeof attrs === 'object' && attrs !== null) { - attrs = attrsToBytes(attrs); - flags = attrs.flags; - attrsLen = attrs.nb; - } else if (typeof attrs === 'function') { - cb = attrs; - } - - /* - uint32 id - string "lsetstat@openssh.com" - string path - ATTRS attrs - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = - Buffer.allocUnsafe(4 + 1 + 4 + 4 + 20 + 4 + pathLen + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 20, p); - buf.utf8Write('lsetstat@openssh.com', p += 4, 20); - - writeUInt32BE(buf, pathLen, p += 20); - buf.utf8Write(path, p += 4, pathLen); - - writeUInt32BE(buf, flags, p += pathLen); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const status = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${status} lsetstat@openssh.com`); - } - } - ext_openssh_expandPath(path, cb) { - if (this.server) - throw new Error('Client-only method called in server mode'); - - const ext = this._extensions['expand-path@openssh.com']; - if (ext !== '1') - throw new Error('Server does not support this extended request'); - - /* - uint32 id - string "expand-path@openssh.com" - string path - */ - const pathLen = Buffer.byteLength(path); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 23 + 4 + pathLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = this._writeReqid = (this._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 23, p); - buf.utf8Write('expand-path@openssh.com', p += 4, 23); - - writeUInt32BE(buf, pathLen, p += 20); - buf.utf8Write(path, p += 4, pathLen); - - this._requests[reqid] = { cb }; - - const isBuffered = sendOrBuffer(this, buf); - if (this._debug) { - const status = (isBuffered ? 'Buffered' : 'Sending'); - this._debug(`SFTP: Outbound: ${status} expand-path@openssh.com`); - } - } - // =========================================================================== - // Server-specific =========================================================== - // =========================================================================== - handle(reqid, handle) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - if (!Buffer.isBuffer(handle)) - throw new Error('handle is not a Buffer'); - - const handleLen = handle.length; - - if (handleLen > 256) - throw new Error('handle too large (> 256 bytes)'); - - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = RESPONSE.HANDLE; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, handleLen, p); - if (handleLen) - buf.set(handle, p += 4); - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} HANDLE` - ); - } - status(reqid, code, message) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - if (!VALID_STATUS_CODES.has(code)) - throw new Error(`Bad status code: ${code}`); - - message || (message = ''); - - const msgLen = Buffer.byteLength(message); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 4 + msgLen + 4); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = RESPONSE.STATUS; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, code, p); - - writeUInt32BE(buf, msgLen, p += 4); - p += 4; - if (msgLen) { - buf.utf8Write(message, p, msgLen); - p += msgLen; - } - - writeUInt32BE(buf, 0, p); // Empty language tag - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} STATUS` - ); - } - data(reqid, data, encoding) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - const isBuffer = Buffer.isBuffer(data); - - if (!isBuffer && typeof data !== 'string') - throw new Error('data is not a Buffer or string'); - - let isUTF8; - if (!isBuffer && !encoding) { - encoding = undefined; - isUTF8 = true; - } - - const dataLen = ( - isBuffer - ? data.length - : Buffer.byteLength(data, encoding) - ); - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + dataLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = RESPONSE.DATA; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, dataLen, p); - if (dataLen) { - if (isBuffer) - buf.set(data, p += 4); - else if (isUTF8) - buf.utf8Write(data, p += 4, dataLen); - else - buf.write(data, p += 4, dataLen, encoding); - } - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} DATA` - ); - } - name(reqid, names) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - if (!Array.isArray(names)) { - if (typeof names !== 'object' || names === null) - throw new Error('names is not an object or array'); - names = [ names ]; - } - - const count = names.length; - let namesLen = 0; - let nameAttrs; - const attrs = []; - - for (let i = 0; i < count; ++i) { - const name = names[i]; - const filename = ( - !name || !name.filename || typeof name.filename !== 'string' - ? '' - : name.filename - ); - namesLen += 4 + Buffer.byteLength(filename); - const longname = ( - !name || !name.longname || typeof name.longname !== 'string' - ? '' - : name.longname - ); - namesLen += 4 + Buffer.byteLength(longname); - - if (typeof name.attrs === 'object' && name.attrs !== null) { - nameAttrs = attrsToBytes(name.attrs); - namesLen += 4 + nameAttrs.nb; - - if (nameAttrs.nb) { - let bytes; - - if (nameAttrs.nb === ATTRS_BUF.length) { - bytes = new Uint8Array(ATTRS_BUF); - } else { - bytes = new Uint8Array(nameAttrs.nb); - bufferCopy(ATTRS_BUF, bytes, 0, nameAttrs.nb, 0); - } - - nameAttrs.bytes = bytes; - } - - attrs.push(nameAttrs); - } else { - namesLen += 4; - attrs.push(null); - } - } - - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + namesLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = RESPONSE.NAME; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, count, p); - - p += 4; - - for (let i = 0; i < count; ++i) { - const name = names[i]; - - { - const filename = ( - !name || !name.filename || typeof name.filename !== 'string' - ? '' - : name.filename - ); - const len = Buffer.byteLength(filename); - writeUInt32BE(buf, len, p); - p += 4; - if (len) { - buf.utf8Write(filename, p, len); - p += len; - } - } - - { - const longname = ( - !name || !name.longname || typeof name.longname !== 'string' - ? '' - : name.longname - ); - const len = Buffer.byteLength(longname); - writeUInt32BE(buf, len, p); - p += 4; - if (len) { - buf.utf8Write(longname, p, len); - p += len; - } - } - - const attr = attrs[i]; - if (attr) { - writeUInt32BE(buf, attr.flags, p); - p += 4; - if (attr.flags && attr.bytes) { - buf.set(attr.bytes, p); - p += attr.nb; - } - } else { - writeUInt32BE(buf, 0, p); - p += 4; - } - } - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} NAME` - ); - } - attrs(reqid, attrs) { - if (!this.server) - throw new Error('Server-only method called in client mode'); - - if (typeof attrs !== 'object' || attrs === null) - throw new Error('attrs is not an object'); - - attrs = attrsToBytes(attrs); - const flags = attrs.flags; - const attrsLen = attrs.nb; - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + attrsLen); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = RESPONSE.ATTRS; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, flags, p); - if (attrsLen) { - p += 4; - - if (attrsLen === ATTRS_BUF.length) - buf.set(ATTRS_BUF, p); - else - bufferCopy(ATTRS_BUF, buf, 0, attrsLen, p); - - p += attrsLen; - } - - const isBuffered = sendOrBuffer(this, buf); - this._debug && this._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} ATTRS` - ); - } -} - -function tryCreateBuffer(size) { - try { - return Buffer.allocUnsafe(size); - } catch (ex) { - return ex; - } -} - -function read_(self, handle, buf, off, len, position, cb, req_) { - const maxDataLen = self._maxReadLen; - const overflow = Math.max(len - maxDataLen, 0); - - if (overflow) - len = maxDataLen; - - /* - uint32 id - string handle - uint64 offset - uint32 len - */ - const handleLen = handle.length; - let p = 9; - let pos = position; - const out = Buffer.allocUnsafe(4 + 1 + 4 + 4 + handleLen + 8 + 4); - - writeUInt32BE(out, out.length - 4, 0); - out[4] = REQUEST.READ; - const reqid = self._writeReqid = (self._writeReqid + 1) & MAX_REQID; - writeUInt32BE(out, reqid, 5); - - writeUInt32BE(out, handleLen, p); - out.set(handle, p += 4); - p += handleLen; - for (let i = 7; i >= 0; --i) { - out[p + i] = pos & 0xFF; - pos /= 256; - } - writeUInt32BE(out, len, p += 8); - - if (typeof cb !== 'function') - cb = noop; - - const req = (req_ || { - nb: 0, - position, - off, - origOff: off, - len: undefined, - overflow: undefined, - cb: (err, data, nb) => { - const len = req.len; - const overflow = req.overflow; - - if (err) { - if (cb._wantEOFError || err.code !== STATUS_CODE.EOF) - return cb(err); - } else if (nb > len) { - return cb(new Error('Received more data than requested')); - } else if (nb === len && overflow) { - req.nb += nb; - req.position += nb; - req.off += nb; - read_(self, handle, buf, req.off, overflow, req.position, cb, req); - return; - } - - if (req.origOff === 0 && buf.length === req.nb) - data = buf; - else - data = bufferSlice(buf, req.origOff, req.origOff + req.nb); - cb(undefined, req.nb + (nb || 0), data, req.position); - }, - buffer: undefined, - }); - - req.len = len; - req.overflow = overflow; - - // TODO: avoid creating multiple buffer slices when we need to re-call read_() - // because of overflow - req.buffer = bufferSlice(buf, off, off + len); - - self._requests[reqid] = req; - - const isBuffered = sendOrBuffer(self, out); - self._debug && self._debug( - `SFTP: Outbound: ${isBuffered ? 'Buffered' : 'Sending'} READ` - ); -} - -function fastXfer(src, dst, srcPath, dstPath, opts, cb) { - let concurrency = 64; - let chunkSize = 32768; - let onstep; - let mode; - let fileSize; - - if (typeof opts === 'function') { - cb = opts; - } else if (typeof opts === 'object' && opts !== null) { - if (typeof opts.concurrency === 'number' - && opts.concurrency > 0 - && !isNaN(opts.concurrency)) { - concurrency = opts.concurrency; - } - if (typeof opts.chunkSize === 'number' - && opts.chunkSize > 0 - && !isNaN(opts.chunkSize)) { - chunkSize = opts.chunkSize; - } - if (typeof opts.fileSize === 'number' - && opts.fileSize > 0 - && !isNaN(opts.fileSize)) { - fileSize = opts.fileSize; - } - if (typeof opts.step === 'function') - onstep = opts.step; - - if (typeof opts.mode === 'string' || typeof opts.mode === 'number') - mode = modeNum(opts.mode); - } - - // Internal state variables - let fsize; - let pdst = 0; - let total = 0; - let hadError = false; - let srcHandle; - let dstHandle; - let readbuf; - let bufsize = chunkSize * concurrency; - - function onerror(err) { - if (hadError) - return; - - hadError = true; - - let left = 0; - let cbfinal; - - if (srcHandle || dstHandle) { - cbfinal = () => { - if (--left === 0) - cb(err); - }; - if (srcHandle && (src === fs || src.outgoing.state === 'open')) - ++left; - if (dstHandle && (dst === fs || dst.outgoing.state === 'open')) - ++left; - if (srcHandle && (src === fs || src.outgoing.state === 'open')) - src.close(srcHandle, cbfinal); - if (dstHandle && (dst === fs || dst.outgoing.state === 'open')) - dst.close(dstHandle, cbfinal); - } else { - cb(err); - } - } - - src.open(srcPath, 'r', (err, sourceHandle) => { - if (err) - return onerror(err); - - srcHandle = sourceHandle; - - if (fileSize === undefined) - src.fstat(srcHandle, tryStat); - else - tryStat(null, { size: fileSize }); - - function tryStat(err, attrs) { - if (err) { - if (src !== fs) { - // Try stat() for sftp servers that may not support fstat() for - // whatever reason - src.stat(srcPath, (err_, attrs_) => { - if (err_) - return onerror(err); - tryStat(null, attrs_); - }); - return; - } - return onerror(err); - } - fsize = attrs.size; - - dst.open(dstPath, 'w', (err, destHandle) => { - if (err) - return onerror(err); - - dstHandle = destHandle; - - if (fsize <= 0) - return onerror(); - - // Use less memory where possible - while (bufsize > fsize) { - if (concurrency === 1) { - bufsize = fsize; - break; - } - bufsize -= chunkSize; - --concurrency; - } - - readbuf = tryCreateBuffer(bufsize); - if (readbuf instanceof Error) - return onerror(readbuf); - - if (mode !== undefined) { - dst.fchmod(dstHandle, mode, function tryAgain(err) { - if (err) { - // Try chmod() for sftp servers that may not support fchmod() - // for whatever reason - dst.chmod(dstPath, mode, (err_) => tryAgain()); - return; - } - startReads(); - }); - } else { - startReads(); - } - - function onread(err, nb, data, dstpos, datapos, origChunkLen) { - if (err) - return onerror(err); - - datapos = datapos || 0; - - dst.write(dstHandle, readbuf, datapos, nb, dstpos, writeCb); - - function writeCb(err) { - if (err) - return onerror(err); - - total += nb; - onstep && onstep(total, nb, fsize); - - if (nb < origChunkLen) - return singleRead(datapos, dstpos + nb, origChunkLen - nb); - - if (total === fsize) { - dst.close(dstHandle, (err) => { - dstHandle = undefined; - if (err) - return onerror(err); - src.close(srcHandle, (err) => { - srcHandle = undefined; - if (err) - return onerror(err); - cb(); - }); - }); - return; - } - - if (pdst >= fsize) - return; - - const chunk = - (pdst + chunkSize > fsize ? fsize - pdst : chunkSize); - singleRead(datapos, pdst, chunk); - pdst += chunk; - } - } - - function makeCb(psrc, pdst, chunk) { - return (err, nb, data) => { - onread(err, nb, data, pdst, psrc, chunk); - }; - } - - function singleRead(psrc, pdst, chunk) { - src.read(srcHandle, - readbuf, - psrc, - chunk, - pdst, - makeCb(psrc, pdst, chunk)); - } - - function startReads() { - let reads = 0; - let psrc = 0; - while (pdst < fsize && reads < concurrency) { - const chunk = - (pdst + chunkSize > fsize ? fsize - pdst : chunkSize); - singleRead(psrc, pdst, chunk); - psrc += chunk; - pdst += chunk; - ++reads; - } - } - }); - } - }); -} - -function writeAll(sftp, handle, buffer, offset, length, position, callback_) { - const callback = (typeof callback_ === 'function' ? callback_ : undefined); - - sftp.write(handle, - buffer, - offset, - length, - position, - (writeErr, written) => { - if (writeErr) { - return sftp.close(handle, () => { - callback && callback(writeErr); - }); - } - if (written === length) { - sftp.close(handle, callback); - } else { - offset += written; - length -= written; - position += written; - writeAll(sftp, handle, buffer, offset, length, position, callback); - } - }); -} - -class Stats { - constructor(initial) { - this.mode = (initial && initial.mode); - this.uid = (initial && initial.uid); - this.gid = (initial && initial.gid); - this.size = (initial && initial.size); - this.atime = (initial && initial.atime); - this.mtime = (initial && initial.mtime); - this.extended = (initial && initial.extended); - } - isDirectory() { - return ((this.mode & constants.S_IFMT) === constants.S_IFDIR); - } - isFile() { - return ((this.mode & constants.S_IFMT) === constants.S_IFREG); - } - isBlockDevice() { - return ((this.mode & constants.S_IFMT) === constants.S_IFBLK); - } - isCharacterDevice() { - return ((this.mode & constants.S_IFMT) === constants.S_IFCHR); - } - isSymbolicLink() { - return ((this.mode & constants.S_IFMT) === constants.S_IFLNK); - } - isFIFO() { - return ((this.mode & constants.S_IFMT) === constants.S_IFIFO); - } - isSocket() { - return ((this.mode & constants.S_IFMT) === constants.S_IFSOCK); - } -} - -function attrsToBytes(attrs) { - let flags = 0; - let nb = 0; - - if (typeof attrs === 'object' && attrs !== null) { - if (typeof attrs.size === 'number') { - flags |= ATTR.SIZE; - const val = attrs.size; - // Big Endian - ATTRS_BUF[nb++] = val / 72057594037927940; // 2**56 - ATTRS_BUF[nb++] = val / 281474976710656; // 2**48 - ATTRS_BUF[nb++] = val / 1099511627776; // 2**40 - ATTRS_BUF[nb++] = val / 4294967296; // 2**32 - ATTRS_BUF[nb++] = val / 16777216; // 2**24 - ATTRS_BUF[nb++] = val / 65536; // 2**16 - ATTRS_BUF[nb++] = val / 256; // 2**8 - ATTRS_BUF[nb++] = val; - } - if (typeof attrs.uid === 'number' && typeof attrs.gid === 'number') { - flags |= ATTR.UIDGID; - const uid = attrs.uid; - const gid = attrs.gid; - // Big Endian - ATTRS_BUF[nb++] = uid >>> 24; - ATTRS_BUF[nb++] = uid >>> 16; - ATTRS_BUF[nb++] = uid >>> 8; - ATTRS_BUF[nb++] = uid; - ATTRS_BUF[nb++] = gid >>> 24; - ATTRS_BUF[nb++] = gid >>> 16; - ATTRS_BUF[nb++] = gid >>> 8; - ATTRS_BUF[nb++] = gid; - } - if (typeof attrs.mode === 'number' || typeof attrs.mode === 'string') { - const mode = modeNum(attrs.mode); - flags |= ATTR.PERMISSIONS; - // Big Endian - ATTRS_BUF[nb++] = mode >>> 24; - ATTRS_BUF[nb++] = mode >>> 16; - ATTRS_BUF[nb++] = mode >>> 8; - ATTRS_BUF[nb++] = mode; - } - if ((typeof attrs.atime === 'number' || isDate(attrs.atime)) - && (typeof attrs.mtime === 'number' || isDate(attrs.mtime))) { - const atime = toUnixTimestamp(attrs.atime); - const mtime = toUnixTimestamp(attrs.mtime); - - flags |= ATTR.ACMODTIME; - // Big Endian - ATTRS_BUF[nb++] = atime >>> 24; - ATTRS_BUF[nb++] = atime >>> 16; - ATTRS_BUF[nb++] = atime >>> 8; - ATTRS_BUF[nb++] = atime; - ATTRS_BUF[nb++] = mtime >>> 24; - ATTRS_BUF[nb++] = mtime >>> 16; - ATTRS_BUF[nb++] = mtime >>> 8; - ATTRS_BUF[nb++] = mtime; - } - // TODO: extended attributes - } - - return { flags, nb }; -} - -function toUnixTimestamp(time) { - // eslint-disable-next-line no-self-compare - if (typeof time === 'number' && time === time) // Valid, non-NaN number - return time; - if (isDate(time)) - return parseInt(time.getTime() / 1000, 10); - throw new Error(`Cannot parse time: ${time}`); -} - -function modeNum(mode) { - // eslint-disable-next-line no-self-compare - if (typeof mode === 'number' && mode === mode) // Valid, non-NaN number - return mode; - if (typeof mode === 'string') - return modeNum(parseInt(mode, 8)); - throw new Error(`Cannot parse mode: ${mode}`); -} - -const stringFlagMap = { - 'r': OPEN_MODE.READ, - 'r+': OPEN_MODE.READ | OPEN_MODE.WRITE, - 'w': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.WRITE, - 'wx': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.WRITE | OPEN_MODE.EXCL, - 'xw': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.WRITE | OPEN_MODE.EXCL, - 'w+': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE, - 'wx+': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE - | OPEN_MODE.EXCL, - 'xw+': OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE - | OPEN_MODE.EXCL, - 'a': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.WRITE, - 'ax': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.WRITE | OPEN_MODE.EXCL, - 'xa': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.WRITE | OPEN_MODE.EXCL, - 'a+': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE, - 'ax+': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE - | OPEN_MODE.EXCL, - 'xa+': OPEN_MODE.APPEND | OPEN_MODE.CREAT | OPEN_MODE.READ | OPEN_MODE.WRITE - | OPEN_MODE.EXCL -}; - -function stringToFlags(str) { - const flags = stringFlagMap[str]; - return (flags !== undefined ? flags : null); -} - -const flagsToString = (() => { - const stringFlagMapKeys = Object.keys(stringFlagMap); - return (flags) => { - for (let i = 0; i < stringFlagMapKeys.length; ++i) { - const key = stringFlagMapKeys[i]; - if (stringFlagMap[key] === flags) - return key; - } - return null; - }; -})(); - -function readAttrs(biOpt) { - /* - uint32 flags - uint64 size present only if flag SSH_FILEXFER_ATTR_SIZE - uint32 uid present only if flag SSH_FILEXFER_ATTR_UIDGID - uint32 gid present only if flag SSH_FILEXFER_ATTR_UIDGID - uint32 permissions present only if flag SSH_FILEXFER_ATTR_PERMISSIONS - uint32 atime present only if flag SSH_FILEXFER_ACMODTIME - uint32 mtime present only if flag SSH_FILEXFER_ACMODTIME - uint32 extended_count present only if flag SSH_FILEXFER_ATTR_EXTENDED - string extended_type - string extended_data - ... more extended data (extended_type - extended_data pairs), - so that number of pairs equals extended_count - */ - const flags = bufferParser.readUInt32BE(); - if (flags === undefined) - return; - - const attrs = new Stats(); - if (flags & ATTR.SIZE) { - const size = bufferParser.readUInt64BE(biOpt); - if (size === undefined) - return; - attrs.size = size; - } - - if (flags & ATTR.UIDGID) { - const uid = bufferParser.readUInt32BE(); - const gid = bufferParser.readUInt32BE(); - if (gid === undefined) - return; - attrs.uid = uid; - attrs.gid = gid; - } - - if (flags & ATTR.PERMISSIONS) { - const mode = bufferParser.readUInt32BE(); - if (mode === undefined) - return; - attrs.mode = mode; - } - - if (flags & ATTR.ACMODTIME) { - const atime = bufferParser.readUInt32BE(); - const mtime = bufferParser.readUInt32BE(); - if (mtime === undefined) - return; - attrs.atime = atime; - attrs.mtime = mtime; - } - - if (flags & ATTR.EXTENDED) { - const count = bufferParser.readUInt32BE(); - if (count === undefined) - return; - const extended = {}; - for (let i = 0; i < count; ++i) { - const type = bufferParser.readString(true); - const data = bufferParser.readString(); - if (data === undefined) - return; - extended[type] = data; - } - attrs.extended = extended; - } - - return attrs; -} - -function sendOrBuffer(sftp, payload) { - const ret = tryWritePayload(sftp, payload); - if (ret !== undefined) { - sftp._buffer.push(ret); - return false; - } - return true; -} - -function tryWritePayload(sftp, payload) { - const outgoing = sftp.outgoing; - if (outgoing.state !== 'open') - return; - - if (outgoing.window === 0) { - sftp._waitWindow = true; // XXX: Unnecessary? - return payload; - } - - let ret; - const len = payload.length; - let p = 0; - - while (len - p > 0 && outgoing.window > 0) { - const actualLen = Math.min(len - p, outgoing.window, outgoing.packetSize); - outgoing.window -= actualLen; - if (outgoing.window === 0) { - sftp._waitWindow = true; - sftp._chunkcb = drainBuffer; - } - - if (p === 0 && actualLen === len) { - sftp._protocol.channelData(sftp.outgoing.id, payload); - } else { - sftp._protocol.channelData(sftp.outgoing.id, - bufferSlice(payload, p, p + actualLen)); - } - - p += actualLen; - } - - if (len - p > 0) { - if (p > 0) - ret = bufferSlice(payload, p, len); - else - ret = payload; // XXX: should never get here? - } - - return ret; -} - -function drainBuffer() { - this._chunkcb = undefined; - const buffer = this._buffer; - let i = 0; - while (i < buffer.length) { - const payload = buffer[i]; - const ret = tryWritePayload(this, payload); - if (ret !== undefined) { - if (ret !== payload) - buffer[i] = ret; - if (i > 0) - this._buffer = buffer.slice(i); - return; - } - ++i; - } - if (i > 0) - this._buffer = []; -} - -function doFatalSFTPError(sftp, msg, noDebug) { - const err = new Error(msg); - err.level = 'sftp-protocol'; - if (!noDebug && sftp._debug) - sftp._debug(`SFTP: Inbound: ${msg}`); - sftp.emit('error', err); - sftp.destroy(); - cleanupRequests(sftp); - return false; -} - -function cleanupRequests(sftp) { - const keys = Object.keys(sftp._requests); - if (keys.length === 0) - return; - - const reqs = sftp._requests; - sftp._requests = {}; - const err = new Error('No response from server'); - for (let i = 0; i < keys.length; ++i) { - const req = reqs[keys[i]]; - if (typeof req.cb === 'function') - req.cb(err); - } -} - -function requestLimits(sftp, cb) { - /* - uint32 id - string "limits@openssh.com" - */ - let p = 9; - const buf = Buffer.allocUnsafe(4 + 1 + 4 + 4 + 18); - - writeUInt32BE(buf, buf.length - 4, 0); - buf[4] = REQUEST.EXTENDED; - const reqid = sftp._writeReqid = (sftp._writeReqid + 1) & MAX_REQID; - writeUInt32BE(buf, reqid, 5); - - writeUInt32BE(buf, 18, p); - buf.utf8Write('limits@openssh.com', p += 4, 18); - - sftp._requests[reqid] = { extended: 'limits@openssh.com', cb }; - - const isBuffered = sendOrBuffer(sftp, buf); - if (sftp._debug) { - const which = (isBuffered ? 'Buffered' : 'Sending'); - sftp._debug(`SFTP: Outbound: ${which} limits@openssh.com`); - } -} - -const CLIENT_HANDLERS = { - [RESPONSE.VERSION]: (sftp, payload) => { - if (sftp._version !== -1) - return doFatalSFTPError(sftp, 'Duplicate VERSION packet'); - - const extensions = {}; - - /* - uint32 version - - */ - bufferParser.init(payload, 1); - let version = bufferParser.readUInt32BE(); - while (bufferParser.avail()) { - const extName = bufferParser.readString(true); - const extData = bufferParser.readString(true); - if (extData === undefined) { - version = undefined; - break; - } - extensions[extName] = extData; - } - bufferParser.clear(); - - if (version === undefined) - return doFatalSFTPError(sftp, 'Malformed VERSION packet'); - - if (sftp._debug) { - const names = Object.keys(extensions); - if (names.length) { - sftp._debug( - `SFTP: Inbound: Received VERSION (v${version}, exts:${names})` - ); - } else { - sftp._debug(`SFTP: Inbound: Received VERSION (v${version})`); - } - } - - sftp._version = version; - sftp._extensions = extensions; - - if (extensions['limits@openssh.com'] === '1') { - return requestLimits(sftp, (err, limits) => { - if (!err) { - if (limits.maxPktLen > 0) - sftp._maxOutPktLen = limits.maxPktLen; - if (limits.maxReadLen > 0) - sftp._maxReadLen = limits.maxReadLen; - if (limits.maxWriteLen > 0) - sftp._maxWriteLen = limits.maxWriteLen; - sftp.maxOpenHandles = ( - limits.maxOpenHandles > 0 ? limits.maxOpenHandles : Infinity - ); - } - sftp.emit('ready'); - }); - } - - sftp.emit('ready'); - }, - [RESPONSE.STATUS]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - uint32 error/status code - string error message (ISO-10646 UTF-8) - string language tag - */ - const errorCode = bufferParser.readUInt32BE(); - const errorMsg = bufferParser.readString(true); - const lang = bufferParser.skipString(); - bufferParser.clear(); - - if (lang === undefined) { - if (reqID !== undefined) - delete sftp._requests[reqID]; - return doFatalSFTPError(sftp, 'Malformed STATUS packet'); - } - - if (sftp._debug) { - const jsonMsg = JSON.stringify(errorMsg); - sftp._debug( - `SFTP: Inbound: Received STATUS (id:${reqID}, ${errorCode}, ${jsonMsg})` - ); - } - const req = sftp._requests[reqID]; - delete sftp._requests[reqID]; - if (req && typeof req.cb === 'function') { - if (errorCode === STATUS_CODE.OK) { - req.cb(); - return; - } - const err = new Error(errorMsg - || STATUS_CODE_STR[errorCode] - || 'Unknown status'); - err.code = errorCode; - req.cb(err); - } - }, - [RESPONSE.HANDLE]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - */ - const handle = bufferParser.readString(); - bufferParser.clear(); - - if (handle === undefined) { - if (reqID !== undefined) - delete sftp._requests[reqID]; - return doFatalSFTPError(sftp, 'Malformed HANDLE packet'); - } - - sftp._debug && sftp._debug(`SFTP: Inbound: Received HANDLE (id:${reqID})`); - - const req = sftp._requests[reqID]; - delete sftp._requests[reqID]; - if (req && typeof req.cb === 'function') - req.cb(undefined, handle); - }, - [RESPONSE.DATA]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - let req; - if (reqID !== undefined) { - req = sftp._requests[reqID]; - delete sftp._requests[reqID]; - } - /* - string data - */ - if (req && typeof req.cb === 'function') { - if (req.buffer) { - // We have already pre-allocated space to store the data - - const nb = bufferParser.readString(req.buffer); - bufferParser.clear(); - - if (nb !== undefined) { - sftp._debug && sftp._debug( - `SFTP: Inbound: Received DATA (id:${reqID}, ${nb})` - ); - req.cb(undefined, req.buffer, nb); - return; - } - } else { - const data = bufferParser.readString(); - bufferParser.clear(); - - if (data !== undefined) { - sftp._debug && sftp._debug( - `SFTP: Inbound: Received DATA (id:${reqID}, ${data.length})` - ); - req.cb(undefined, data); - return; - } - } - } else { - const nb = bufferParser.skipString(); - bufferParser.clear(); - if (nb !== undefined) { - sftp._debug && sftp._debug( - `SFTP: Inbound: Received DATA (id:${reqID}, ${nb})` - ); - return; - } - } - - return doFatalSFTPError(sftp, 'Malformed DATA packet'); - }, - [RESPONSE.NAME]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - let req; - if (reqID !== undefined) { - req = sftp._requests[reqID]; - delete sftp._requests[reqID]; - } - /* - uint32 count - repeats count times: - string filename - string longname - ATTRS attrs - */ - const count = bufferParser.readUInt32BE(); - if (count !== undefined) { - let names = []; - for (let i = 0; i < count; ++i) { - // We are going to assume UTF-8 for filenames despite the SFTPv3 - // spec not specifying an encoding because the specs for newer - // versions of the protocol all explicitly specify UTF-8 for - // filenames - const filename = bufferParser.readString(true); - - // `longname` only exists in SFTPv3 and since it typically will - // contain the filename, we assume it is also UTF-8 - const longname = bufferParser.readString(true); - - const attrs = readAttrs(sftp._biOpt); - if (attrs === undefined) { - names = undefined; - break; - } - names.push({ filename, longname, attrs }); - } - if (names !== undefined) { - sftp._debug && sftp._debug( - `SFTP: Inbound: Received NAME (id:${reqID}, ${names.length})` - ); - bufferParser.clear(); - if (req && typeof req.cb === 'function') - req.cb(undefined, names); - return; - } - } - - bufferParser.clear(); - return doFatalSFTPError(sftp, 'Malformed NAME packet'); - }, - [RESPONSE.ATTRS]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - let req; - if (reqID !== undefined) { - req = sftp._requests[reqID]; - delete sftp._requests[reqID]; - } - /* - ATTRS attrs - */ - const attrs = readAttrs(sftp._biOpt); - bufferParser.clear(); - if (attrs !== undefined) { - sftp._debug && sftp._debug(`SFTP: Inbound: Received ATTRS (id:${reqID})`); - if (req && typeof req.cb === 'function') - req.cb(undefined, attrs); - return; - } - - return doFatalSFTPError(sftp, 'Malformed ATTRS packet'); - }, - [RESPONSE.EXTENDED]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - if (reqID !== undefined) { - const req = sftp._requests[reqID]; - if (req) { - delete sftp._requests[reqID]; - switch (req.extended) { - case 'statvfs@openssh.com': - case 'fstatvfs@openssh.com': { - /* - uint64 f_bsize // file system block size - uint64 f_frsize // fundamental fs block size - uint64 f_blocks // number of blocks (unit f_frsize) - uint64 f_bfree // free blocks in file system - uint64 f_bavail // free blocks for non-root - uint64 f_files // total file inodes - uint64 f_ffree // free file inodes - uint64 f_favail // free file inodes for to non-root - uint64 f_fsid // file system id - uint64 f_flag // bit mask of f_flag values - uint64 f_namemax // maximum filename length - */ - const biOpt = sftp._biOpt; - const stats = { - f_bsize: bufferParser.readUInt64BE(biOpt), - f_frsize: bufferParser.readUInt64BE(biOpt), - f_blocks: bufferParser.readUInt64BE(biOpt), - f_bfree: bufferParser.readUInt64BE(biOpt), - f_bavail: bufferParser.readUInt64BE(biOpt), - f_files: bufferParser.readUInt64BE(biOpt), - f_ffree: bufferParser.readUInt64BE(biOpt), - f_favail: bufferParser.readUInt64BE(biOpt), - f_sid: bufferParser.readUInt64BE(biOpt), - f_flag: bufferParser.readUInt64BE(biOpt), - f_namemax: bufferParser.readUInt64BE(biOpt), - }; - if (stats.f_namemax === undefined) - break; - if (sftp._debug) { - sftp._debug( - 'SFTP: Inbound: Received EXTENDED_REPLY ' - + `(id:${reqID}, ${req.extended})` - ); - } - bufferParser.clear(); - if (typeof req.cb === 'function') - req.cb(undefined, stats); - return; - } - case 'limits@openssh.com': { - /* - uint64 max-packet-length - uint64 max-read-length - uint64 max-write-length - uint64 max-open-handles - */ - const limits = { - maxPktLen: bufferParser.readUInt64BE(), - maxReadLen: bufferParser.readUInt64BE(), - maxWriteLen: bufferParser.readUInt64BE(), - maxOpenHandles: bufferParser.readUInt64BE(), - }; - if (limits.maxOpenHandles === undefined) - break; - if (sftp._debug) { - sftp._debug( - 'SFTP: Inbound: Received EXTENDED_REPLY ' - + `(id:${reqID}, ${req.extended})` - ); - } - bufferParser.clear(); - if (typeof req.cb === 'function') - req.cb(undefined, limits); - return; - } - default: - // Unknown extended request - sftp._debug && sftp._debug( - `SFTP: Inbound: Received EXTENDED_REPLY (id:${reqID}, ???)` - ); - bufferParser.clear(); - if (typeof req.cb === 'function') - req.cb(); - return; - } - } else { - sftp._debug && sftp._debug( - `SFTP: Inbound: Received EXTENDED_REPLY (id:${reqID}, ???)` - ); - bufferParser.clear(); - return; - } - } - - bufferParser.clear(); - return doFatalSFTPError(sftp, 'Malformed EXTENDED_REPLY packet'); - }, -}; -const SERVER_HANDLERS = { - [REQUEST.INIT]: (sftp, payload) => { - if (sftp._version !== -1) - return doFatalSFTPError(sftp, 'Duplicate INIT packet'); - - const extensions = {}; - - /* - uint32 version - - */ - bufferParser.init(payload, 1); - let version = bufferParser.readUInt32BE(); - while (bufferParser.avail()) { - const extName = bufferParser.readString(true); - const extData = bufferParser.readString(true); - if (extData === undefined) { - version = undefined; - break; - } - extensions[extName] = extData; - } - bufferParser.clear(); - - if (version === undefined) - return doFatalSFTPError(sftp, 'Malformed INIT packet'); - - if (sftp._debug) { - const names = Object.keys(extensions); - if (names.length) { - sftp._debug( - `SFTP: Inbound: Received INIT (v${version}, exts:${names})` - ); - } else { - sftp._debug(`SFTP: Inbound: Received INIT (v${version})`); - } - } - - sendOrBuffer(sftp, SERVER_VERSION_BUFFER); - - sftp._version = version; - sftp._extensions = extensions; - sftp.emit('ready'); - }, - [REQUEST.OPEN]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string filename - uint32 pflags - ATTRS attrs - */ - const filename = bufferParser.readString(true); - const pflags = bufferParser.readUInt32BE(); - const attrs = readAttrs(sftp._biOpt); - bufferParser.clear(); - - if (attrs === undefined) - return doFatalSFTPError(sftp, 'Malformed OPEN packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received OPEN (id:${reqID})`); - - if (!sftp.emit('OPEN', reqID, filename, pflags, attrs)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.CLOSE]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - */ - const handle = bufferParser.readString(); - bufferParser.clear(); - - if (handle === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed CLOSE packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received CLOSE (id:${reqID})`); - - if (!sftp.emit('CLOSE', reqID, handle)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.READ]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - uint64 offset - uint32 len - */ - const handle = bufferParser.readString(); - const offset = bufferParser.readUInt64BE(sftp._biOpt); - const len = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (len === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed READ packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received READ (id:${reqID})`); - - if (!sftp.emit('READ', reqID, handle, offset, len)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.WRITE]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - uint64 offset - string data - */ - const handle = bufferParser.readString(); - const offset = bufferParser.readUInt64BE(sftp._biOpt); - const data = bufferParser.readString(); - bufferParser.clear(); - - if (data === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed WRITE packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received WRITE (id:${reqID})`); - - if (!sftp.emit('WRITE', reqID, handle, offset, data)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.LSTAT]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed LSTAT packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received LSTAT (id:${reqID})`); - - if (!sftp.emit('LSTAT', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.FSTAT]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - */ - const handle = bufferParser.readString(); - bufferParser.clear(); - - if (handle === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed FSTAT packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received FSTAT (id:${reqID})`); - - if (!sftp.emit('FSTAT', reqID, handle)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.SETSTAT]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - ATTRS attrs - */ - const path = bufferParser.readString(true); - const attrs = readAttrs(sftp._biOpt); - bufferParser.clear(); - - if (attrs === undefined) - return doFatalSFTPError(sftp, 'Malformed SETSTAT packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received SETSTAT (id:${reqID})`); - - if (!sftp.emit('SETSTAT', reqID, path, attrs)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.FSETSTAT]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - ATTRS attrs - */ - const handle = bufferParser.readString(); - const attrs = readAttrs(sftp._biOpt); - bufferParser.clear(); - - if (attrs === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed FSETSTAT packet'); - - sftp._debug && sftp._debug( - `SFTP: Inbound: Received FSETSTAT (id:${reqID})` - ); - - if (!sftp.emit('FSETSTAT', reqID, handle, attrs)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.OPENDIR]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed OPENDIR packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received OPENDIR (id:${reqID})`); - - if (!sftp.emit('OPENDIR', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.READDIR]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string handle - */ - const handle = bufferParser.readString(); - bufferParser.clear(); - - if (handle === undefined || handle.length > 256) - return doFatalSFTPError(sftp, 'Malformed READDIR packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received READDIR (id:${reqID})`); - - if (!sftp.emit('READDIR', reqID, handle)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.REMOVE]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed REMOVE packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received REMOVE (id:${reqID})`); - - if (!sftp.emit('REMOVE', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.MKDIR]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - ATTRS attrs - */ - const path = bufferParser.readString(true); - const attrs = readAttrs(sftp._biOpt); - bufferParser.clear(); - - if (attrs === undefined) - return doFatalSFTPError(sftp, 'Malformed MKDIR packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received MKDIR (id:${reqID})`); - - if (!sftp.emit('MKDIR', reqID, path, attrs)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.RMDIR]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed RMDIR packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received RMDIR (id:${reqID})`); - - if (!sftp.emit('RMDIR', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.REALPATH]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed REALPATH packet'); - - sftp._debug && sftp._debug( - `SFTP: Inbound: Received REALPATH (id:${reqID})` - ); - - if (!sftp.emit('REALPATH', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.STAT]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed STAT packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received STAT (id:${reqID})`); - - if (!sftp.emit('STAT', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.RENAME]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string oldpath - string newpath - */ - const oldPath = bufferParser.readString(true); - const newPath = bufferParser.readString(true); - bufferParser.clear(); - - if (newPath === undefined) - return doFatalSFTPError(sftp, 'Malformed RENAME packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received RENAME (id:${reqID})`); - - if (!sftp.emit('RENAME', reqID, oldPath, newPath)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.READLINK]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string path - */ - const path = bufferParser.readString(true); - bufferParser.clear(); - - if (path === undefined) - return doFatalSFTPError(sftp, 'Malformed READLINK packet'); - - sftp._debug && sftp._debug( - `SFTP: Inbound: Received READLINK (id:${reqID})` - ); - - if (!sftp.emit('READLINK', reqID, path)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.SYMLINK]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string linkpath - string targetpath - */ - const linkPath = bufferParser.readString(true); - const targetPath = bufferParser.readString(true); - bufferParser.clear(); - - if (targetPath === undefined) - return doFatalSFTPError(sftp, 'Malformed SYMLINK packet'); - - sftp._debug && sftp._debug(`SFTP: Inbound: Received SYMLINK (id:${reqID})`); - - let handled; - if (sftp._isOpenSSH) { - // OpenSSH has linkpath and targetpath positions switched - handled = sftp.emit('SYMLINK', reqID, targetPath, linkPath); - } else { - handled = sftp.emit('SYMLINK', reqID, linkPath, targetPath); - } - if (!handled) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, - [REQUEST.EXTENDED]: (sftp, payload) => { - bufferParser.init(payload, 1); - const reqID = bufferParser.readUInt32BE(); - /* - string extended-request - ... any request-specific data ... - */ - const extName = bufferParser.readString(true); - if (extName === undefined) { - bufferParser.clear(); - return doFatalSFTPError(sftp, 'Malformed EXTENDED packet'); - } - - let extData; - if (bufferParser.avail()) - extData = bufferParser.readRaw(); - bufferParser.clear(); - - sftp._debug && sftp._debug( - `SFTP: Inbound: Received EXTENDED (id:${reqID})` - ); - - if (!sftp.emit('EXTENDED', reqID, extName, extData)) { - // Automatically reject request if no handler for request type - sftp.status(reqID, STATUS_CODE.OP_UNSUPPORTED); - } - }, -}; - -// ============================================================================= -// ReadStream/WriteStream-related ============================================== -// ============================================================================= -const { - ERR_INVALID_ARG_TYPE, - ERR_OUT_OF_RANGE, - validateNumber -} = require('./node-fs-compat'); - -const kMinPoolSpace = 128; - -let pool; -// It can happen that we expect to read a large chunk of data, and reserve -// a large chunk of the pool accordingly, but the read() call only filled -// a portion of it. If a concurrently executing read() then uses the same pool, -// the "reserved" portion cannot be used, so we allow it to be re-used as a -// new pool later. -const poolFragments = []; - -function allocNewPool(poolSize) { - if (poolFragments.length > 0) - pool = poolFragments.pop(); - else - pool = Buffer.allocUnsafe(poolSize); - pool.used = 0; -} - -// Check the `this.start` and `this.end` of stream. -function checkPosition(pos, name) { - if (!Number.isSafeInteger(pos)) { - validateNumber(pos, name); - if (!Number.isInteger(pos)) - throw new ERR_OUT_OF_RANGE(name, 'an integer', pos); - throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos); - } - if (pos < 0) - throw new ERR_OUT_OF_RANGE(name, '>= 0 and <= 2 ** 53 - 1', pos); -} - -function roundUpToMultipleOf8(n) { - return (n + 7) & ~7; // Align to 8 byte boundary. -} - -function ReadStream(sftp, path, options) { - if (options === undefined) - options = {}; - else if (typeof options === 'string') - options = { encoding: options }; - else if (options === null || typeof options !== 'object') - throw new TypeError('"options" argument must be a string or an object'); - else - options = Object.create(options); - - // A little bit bigger buffer and water marks by default - if (options.highWaterMark === undefined) - options.highWaterMark = 64 * 1024; - - // For backwards compat do not emit close on destroy. - options.emitClose = false; - options.autoDestroy = false; // Node 14 major change. - - ReadableStream.call(this, options); - - this.path = path; - this.flags = options.flags === undefined ? 'r' : options.flags; - this.mode = options.mode === undefined ? 0o666 : options.mode; - - this.start = options.start; - this.end = options.end; - this.autoClose = options.autoClose === undefined ? true : options.autoClose; - this.pos = 0; - this.bytesRead = 0; - this.closed = false; - - this.handle = options.handle === undefined ? null : options.handle; - this.sftp = sftp; - this._opening = false; - - if (this.start !== undefined) { - checkPosition(this.start, 'start'); - - this.pos = this.start; - } - - if (this.end === undefined) { - this.end = Infinity; - } else if (this.end !== Infinity) { - checkPosition(this.end, 'end'); - - if (this.start !== undefined && this.start > this.end) { - throw new ERR_OUT_OF_RANGE( - 'start', - `<= "end" (here: ${this.end})`, - this.start - ); - } - } - - this.on('end', function() { - if (this.autoClose) - this.destroy(); - }); - - if (!Buffer.isBuffer(this.handle)) - this.open(); -} -inherits(ReadStream, ReadableStream); - -ReadStream.prototype.open = function() { - if (this._opening) - return; - - this._opening = true; - - this.sftp.open(this.path, this.flags, this.mode, (er, handle) => { - this._opening = false; - - if (er) { - this.emit('error', er); - if (this.autoClose) - this.destroy(); - return; - } - - this.handle = handle; - this.emit('open', handle); - this.emit('ready'); - // Start the flow of data. - this.read(); - }); -}; - -ReadStream.prototype._read = function(n) { - if (!Buffer.isBuffer(this.handle)) - return this.once('open', () => this._read(n)); - - // XXX: safe to remove this? - if (this.destroyed) - return; - - if (!pool || pool.length - pool.used < kMinPoolSpace) { - // Discard the old pool. - allocNewPool(this.readableHighWaterMark - || this._readableState.highWaterMark); - } - - // Grab another reference to the pool in the case that while we're - // in the thread pool another read() finishes up the pool, and - // allocates a new one. - const thisPool = pool; - let toRead = Math.min(pool.length - pool.used, n); - const start = pool.used; - - if (this.end !== undefined) - toRead = Math.min(this.end - this.pos + 1, toRead); - - // Already read everything we were supposed to read! - // treat as EOF. - if (toRead <= 0) - return this.push(null); - - // the actual read. - this.sftp.read(this.handle, - pool, - pool.used, - toRead, - this.pos, - (er, bytesRead) => { - if (er) { - this.emit('error', er); - if (this.autoClose) - this.destroy(); - return; - } - let b = null; - - // Now that we know how much data we have actually read, re-wind the - // 'used' field if we can, and otherwise allow the remainder of our - // reservation to be used as a new pool later. - if (start + toRead === thisPool.used && thisPool === pool) { - thisPool.used = roundUpToMultipleOf8(thisPool.used + bytesRead - toRead); - } else { - // Round down to the next lowest multiple of 8 to ensure the new pool - // fragment start and end positions are aligned to an 8 byte boundary. - const alignedEnd = (start + toRead) & ~7; - const alignedStart = roundUpToMultipleOf8(start + bytesRead); - if (alignedEnd - alignedStart >= kMinPoolSpace) - poolFragments.push(thisPool.slice(alignedStart, alignedEnd)); - } - - if (bytesRead > 0) { - this.bytesRead += bytesRead; - b = thisPool.slice(start, start + bytesRead); - } - - // Move the pool positions, and internal position for reading. - this.pos += bytesRead; - - this.push(b); - }); - - pool.used = roundUpToMultipleOf8(pool.used + toRead); -}; - -ReadStream.prototype._destroy = function(err, cb) { - if (this._opening && !Buffer.isBuffer(this.handle)) { - this.once('open', closeStream.bind(null, this, cb, err)); - return; - } - - closeStream(this, cb, err); - this.handle = null; - this._opening = false; -}; - -function closeStream(stream, cb, err) { - if (!stream.handle) - return onclose(); - - stream.sftp.close(stream.handle, onclose); - - function onclose(er) { - er = er || err; - cb(er); - stream.closed = true; - if (!er) - stream.emit('close'); - } -} - -ReadStream.prototype.close = function(cb) { - this.destroy(null, cb); -}; - -Object.defineProperty(ReadStream.prototype, 'pending', { - get() { - return this.handle === null; - }, - configurable: true -}); - -// TODO: add `concurrency` setting to allow more than one in-flight WRITE -// request to server to improve throughput -function WriteStream(sftp, path, options) { - if (options === undefined) - options = {}; - else if (typeof options === 'string') - options = { encoding: options }; - else if (options === null || typeof options !== 'object') - throw new TypeError('"options" argument must be a string or an object'); - else - options = Object.create(options); - - // For backwards compat do not emit close on destroy. - options.emitClose = false; - options.autoDestroy = false; // Node 14 major change. - - WritableStream.call(this, options); - - this.path = path; - this.flags = options.flags === undefined ? 'w' : options.flags; - this.mode = options.mode === undefined ? 0o666 : options.mode; - - this.start = options.start; - this.autoClose = options.autoClose === undefined ? true : options.autoClose; - this.pos = 0; - this.bytesWritten = 0; - this.closed = false; - - this.handle = options.handle === undefined ? null : options.handle; - this.sftp = sftp; - this._opening = false; - - if (this.start !== undefined) { - checkPosition(this.start, 'start'); - - this.pos = this.start; - } - - if (options.encoding) - this.setDefaultEncoding(options.encoding); - - // Node v6.x only - this.on('finish', function() { - if (this._writableState.finalCalled) - return; - if (this.autoClose) - this.destroy(); - }); - - if (!Buffer.isBuffer(this.handle)) - this.open(); -} -inherits(WriteStream, WritableStream); - -WriteStream.prototype._final = function(cb) { - if (this.autoClose) - this.destroy(); - cb(); -}; - -WriteStream.prototype.open = function() { - if (this._opening) - return; - - this._opening = true; - - this.sftp.open(this.path, this.flags, this.mode, (er, handle) => { - this._opening = false; - - if (er) { - this.emit('error', er); - if (this.autoClose) - this.destroy(); - return; - } - - this.handle = handle; - - const tryAgain = (err) => { - if (err) { - // Try chmod() for sftp servers that may not support fchmod() for - // whatever reason - this.sftp.chmod(this.path, this.mode, (err_) => tryAgain()); - return; - } - - // SFTPv3 requires absolute offsets, no matter the open flag used - if (this.flags[0] === 'a') { - const tryStat = (err, st) => { - if (err) { - // Try stat() for sftp servers that may not support fstat() for - // whatever reason - this.sftp.stat(this.path, (err_, st_) => { - if (err_) { - this.destroy(); - this.emit('error', err); - return; - } - tryStat(null, st_); - }); - return; - } - - this.pos = st.size; - this.emit('open', handle); - this.emit('ready'); - }; - - this.sftp.fstat(handle, tryStat); - return; - } - - this.emit('open', handle); - this.emit('ready'); - }; - - this.sftp.fchmod(handle, this.mode, tryAgain); - }); -}; - -WriteStream.prototype._write = function(data, encoding, cb) { - if (!Buffer.isBuffer(data)) { - const err = new ERR_INVALID_ARG_TYPE('data', 'Buffer', data); - return this.emit('error', err); - } - - if (!Buffer.isBuffer(this.handle)) { - return this.once('open', function() { - this._write(data, encoding, cb); - }); - } - - this.sftp.write(this.handle, - data, - 0, - data.length, - this.pos, - (er, bytes) => { - if (er) { - if (this.autoClose) - this.destroy(); - return cb(er); - } - this.bytesWritten += bytes; - cb(); - }); - - this.pos += data.length; -}; - -WriteStream.prototype._writev = function(data, cb) { - if (!Buffer.isBuffer(this.handle)) { - return this.once('open', function() { - this._writev(data, cb); - }); - } - - const sftp = this.sftp; - const handle = this.handle; - let writesLeft = data.length; - - const onwrite = (er, bytes) => { - if (er) { - this.destroy(); - return cb(er); - } - this.bytesWritten += bytes; - if (--writesLeft === 0) - cb(); - }; - - // TODO: try to combine chunks to reduce number of requests to the server? - for (let i = 0; i < data.length; ++i) { - const chunk = data[i].chunk; - - sftp.write(handle, chunk, 0, chunk.length, this.pos, onwrite); - this.pos += chunk.length; - } -}; - -if (typeof WritableStream.prototype.destroy !== 'function') - WriteStream.prototype.destroy = ReadStream.prototype.destroy; - -WriteStream.prototype._destroy = ReadStream.prototype._destroy; -WriteStream.prototype.close = function(cb) { - if (cb) { - if (this.closed) { - process.nextTick(cb); - return; - } - this.on('close', cb); - } - - // If we are not autoClosing, we should call - // destroy on 'finish'. - if (!this.autoClose) - this.on('finish', this.destroy.bind(this)); - - this.end(); -}; - -// There is no shutdown() for files. -WriteStream.prototype.destroySoon = WriteStream.prototype.end; - -Object.defineProperty(WriteStream.prototype, 'pending', { - get() { - return this.handle === null; - }, - configurable: true -}); -// ============================================================================= - -module.exports = { - flagsToString, - OPEN_MODE, - SFTP, - Stats, - STATUS_CODE, - stringToFlags, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/constants.js b/reverse_engineering/node_modules/ssh2/lib/protocol/constants.js deleted file mode 100644 index 632b7aa2..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/constants.js +++ /dev/null @@ -1,344 +0,0 @@ -'use strict'; - -const crypto = require('crypto'); - -let cpuInfo; -try { - cpuInfo = require('cpu-features')(); -} catch {} - -const { bindingAvailable } = require('./crypto.js'); - -const eddsaSupported = (() => { - if (typeof crypto.sign === 'function' - && typeof crypto.verify === 'function') { - const key = - '-----BEGIN PRIVATE KEY-----\r\nMC4CAQAwBQYDK2VwBCIEIHKj+sVa9WcD' - + '/q2DJUJaf43Kptc8xYuUQA4bOFj9vC8T\r\n-----END PRIVATE KEY-----'; - const data = Buffer.from('a'); - let sig; - let verified; - try { - sig = crypto.sign(null, data, key); - verified = crypto.verify(null, data, key, sig); - } catch {} - return (Buffer.isBuffer(sig) && sig.length === 64 && verified === true); - } - - return false; -})(); - -const curve25519Supported = (typeof crypto.diffieHellman === 'function' - && typeof crypto.generateKeyPairSync === 'function' - && typeof crypto.createPublicKey === 'function'); - -const DEFAULT_KEX = [ - // https://tools.ietf.org/html/rfc5656#section-10.1 - 'ecdh-sha2-nistp256', - 'ecdh-sha2-nistp384', - 'ecdh-sha2-nistp521', - - // https://tools.ietf.org/html/rfc4419#section-4 - 'diffie-hellman-group-exchange-sha256', - - // https://tools.ietf.org/html/rfc8268 - 'diffie-hellman-group14-sha256', - 'diffie-hellman-group15-sha512', - 'diffie-hellman-group16-sha512', - 'diffie-hellman-group17-sha512', - 'diffie-hellman-group18-sha512', -]; -if (curve25519Supported) { - DEFAULT_KEX.unshift('curve25519-sha256'); - DEFAULT_KEX.unshift('curve25519-sha256@libssh.org'); -} -const SUPPORTED_KEX = DEFAULT_KEX.concat([ - // https://tools.ietf.org/html/rfc4419#section-4 - 'diffie-hellman-group-exchange-sha1', - - 'diffie-hellman-group14-sha1', // REQUIRED - 'diffie-hellman-group1-sha1', // REQUIRED -]); - - -const DEFAULT_SERVER_HOST_KEY = [ - 'ecdsa-sha2-nistp256', - 'ecdsa-sha2-nistp384', - 'ecdsa-sha2-nistp521', - 'rsa-sha2-512', // RFC 8332 - 'rsa-sha2-256', // RFC 8332 - 'ssh-rsa', -]; -if (eddsaSupported) - DEFAULT_SERVER_HOST_KEY.unshift('ssh-ed25519'); -const SUPPORTED_SERVER_HOST_KEY = DEFAULT_SERVER_HOST_KEY.concat([ - 'ssh-dss', -]); - - -const DEFAULT_CIPHER = [ - // http://tools.ietf.org/html/rfc5647 - 'aes128-gcm', - 'aes128-gcm@openssh.com', - 'aes256-gcm', - 'aes256-gcm@openssh.com', - - // http://tools.ietf.org/html/rfc4344#section-4 - 'aes128-ctr', - 'aes192-ctr', - 'aes256-ctr', -]; -if (cpuInfo && cpuInfo.flags && !cpuInfo.flags.aes) { - // We know for sure the CPU does not support AES acceleration - if (bindingAvailable) - DEFAULT_CIPHER.unshift('chacha20-poly1305@openssh.com'); - else - DEFAULT_CIPHER.push('chacha20-poly1305@openssh.com'); -} else if (bindingAvailable && cpuInfo && cpuInfo.arch === 'x86') { - // Places chacha20-poly1305 immediately after GCM ciphers since GCM ciphers - // seem to outperform it on x86, but it seems to be faster than CTR ciphers - DEFAULT_CIPHER.splice(4, 0, 'chacha20-poly1305@openssh.com'); -} else { - DEFAULT_CIPHER.push('chacha20-poly1305@openssh.com'); -} -const SUPPORTED_CIPHER = DEFAULT_CIPHER.concat([ - 'aes256-cbc', - 'aes192-cbc', - 'aes128-cbc', - 'blowfish-cbc', - '3des-cbc', - - // http://tools.ietf.org/html/rfc4345#section-4: - 'arcfour256', - 'arcfour128', - - 'cast128-cbc', - 'arcfour', -]); - - -const DEFAULT_MAC = [ - 'hmac-sha2-256-etm@openssh.com', - 'hmac-sha2-512-etm@openssh.com', - 'hmac-sha1-etm@openssh.com', - 'hmac-sha2-256', - 'hmac-sha2-512', - 'hmac-sha1', -]; -const SUPPORTED_MAC = DEFAULT_MAC.concat([ - 'hmac-md5', - 'hmac-sha2-256-96', // first 96 bits of HMAC-SHA256 - 'hmac-sha2-512-96', // first 96 bits of HMAC-SHA512 - 'hmac-ripemd160', - 'hmac-sha1-96', // first 96 bits of HMAC-SHA1 - 'hmac-md5-96', // first 96 bits of HMAC-MD5 -]); - -const DEFAULT_COMPRESSION = [ - 'none', - 'zlib@openssh.com', // ZLIB (LZ77) compression, except - // compression/decompression does not start until after - // successful user authentication - 'zlib', // ZLIB (LZ77) compression -]; -const SUPPORTED_COMPRESSION = DEFAULT_COMPRESSION.concat([ -]); - - -const COMPAT = { - BAD_DHGEX: 1 << 0, - OLD_EXIT: 1 << 1, - DYN_RPORT_BUG: 1 << 2, - BUG_DHGEX_LARGE: 1 << 3, -}; - -module.exports = { - MESSAGE: { - // Transport layer protocol -- generic (1-19) - DISCONNECT: 1, - IGNORE: 2, - UNIMPLEMENTED: 3, - DEBUG: 4, - SERVICE_REQUEST: 5, - SERVICE_ACCEPT: 6, - - // Transport layer protocol -- algorithm negotiation (20-29) - KEXINIT: 20, - NEWKEYS: 21, - - // Transport layer protocol -- key exchange method-specific (30-49) - KEXDH_INIT: 30, - KEXDH_REPLY: 31, - - KEXDH_GEX_GROUP: 31, - KEXDH_GEX_INIT: 32, - KEXDH_GEX_REPLY: 33, - KEXDH_GEX_REQUEST: 34, - - KEXECDH_INIT: 30, - KEXECDH_REPLY: 31, - - // User auth protocol -- generic (50-59) - USERAUTH_REQUEST: 50, - USERAUTH_FAILURE: 51, - USERAUTH_SUCCESS: 52, - USERAUTH_BANNER: 53, - - // User auth protocol -- user auth method-specific (60-79) - USERAUTH_PASSWD_CHANGEREQ: 60, - - USERAUTH_PK_OK: 60, - - USERAUTH_INFO_REQUEST: 60, - USERAUTH_INFO_RESPONSE: 61, - - // Connection protocol -- generic (80-89) - GLOBAL_REQUEST: 80, - REQUEST_SUCCESS: 81, - REQUEST_FAILURE: 82, - - // Connection protocol -- channel-related (90-127) - CHANNEL_OPEN: 90, - CHANNEL_OPEN_CONFIRMATION: 91, - CHANNEL_OPEN_FAILURE: 92, - CHANNEL_WINDOW_ADJUST: 93, - CHANNEL_DATA: 94, - CHANNEL_EXTENDED_DATA: 95, - CHANNEL_EOF: 96, - CHANNEL_CLOSE: 97, - CHANNEL_REQUEST: 98, - CHANNEL_SUCCESS: 99, - CHANNEL_FAILURE: 100 - - // Reserved for client protocols (128-191) - - // Local extensions (192-155) - }, - DISCONNECT_REASON: { - HOST_NOT_ALLOWED_TO_CONNECT: 1, - PROTOCOL_ERROR: 2, - KEY_EXCHANGE_FAILED: 3, - RESERVED: 4, - MAC_ERROR: 5, - COMPRESSION_ERROR: 6, - SERVICE_NOT_AVAILABLE: 7, - PROTOCOL_VERSION_NOT_SUPPORTED: 8, - HOST_KEY_NOT_VERIFIABLE: 9, - CONNECTION_LOST: 10, - BY_APPLICATION: 11, - TOO_MANY_CONNECTIONS: 12, - AUTH_CANCELED_BY_USER: 13, - NO_MORE_AUTH_METHODS_AVAILABLE: 14, - ILLEGAL_USER_NAME: 15, - }, - DISCONNECT_REASON_STR: undefined, - CHANNEL_OPEN_FAILURE: { - ADMINISTRATIVELY_PROHIBITED: 1, - CONNECT_FAILED: 2, - UNKNOWN_CHANNEL_TYPE: 3, - RESOURCE_SHORTAGE: 4 - }, - TERMINAL_MODE: { - TTY_OP_END: 0, // Indicates end of options. - VINTR: 1, // Interrupt character; 255 if none. Similarly for the - // other characters. Not all of these characters are - // supported on all systems. - VQUIT: 2, // The quit character (sends SIGQUIT signal on POSIX - // systems). - VERASE: 3, // Erase the character to left of the cursor. - VKILL: 4, // Kill the current input line. - VEOF: 5, // End-of-file character (sends EOF from the - // terminal). - VEOL: 6, // End-of-line character in addition to carriage - // return and/or linefeed. - VEOL2: 7, // Additional end-of-line character. - VSTART: 8, // Continues paused output (normally control-Q). - VSTOP: 9, // Pauses output (normally control-S). - VSUSP: 10, // Suspends the current program. - VDSUSP: 11, // Another suspend character. - VREPRINT: 12, // Reprints the current input line. - VWERASE: 13, // Erases a word left of cursor. - VLNEXT: 14, // Enter the next character typed literally, even if - // it is a special character - VFLUSH: 15, // Character to flush output. - VSWTCH: 16, // Switch to a different shell layer. - VSTATUS: 17, // Prints system status line (load, command, pid, - // etc). - VDISCARD: 18, // Toggles the flushing of terminal output. - IGNPAR: 30, // The ignore parity flag. The parameter SHOULD be 0 - // if this flag is FALSE, and 1 if it is TRUE. - PARMRK: 31, // Mark parity and framing errors. - INPCK: 32, // Enable checking of parity errors. - ISTRIP: 33, // Strip 8th bit off characters. - INLCR: 34, // Map NL into CR on input. - IGNCR: 35, // Ignore CR on input. - ICRNL: 36, // Map CR to NL on input. - IUCLC: 37, // Translate uppercase characters to lowercase. - IXON: 38, // Enable output flow control. - IXANY: 39, // Any char will restart after stop. - IXOFF: 40, // Enable input flow control. - IMAXBEL: 41, // Ring bell on input queue full. - ISIG: 50, // Enable signals INTR, QUIT, [D]SUSP. - ICANON: 51, // Canonicalize input lines. - XCASE: 52, // Enable input and output of uppercase characters by - // preceding their lowercase equivalents with "\". - ECHO: 53, // Enable echoing. - ECHOE: 54, // Visually erase chars. - ECHOK: 55, // Kill character discards current line. - ECHONL: 56, // Echo NL even if ECHO is off. - NOFLSH: 57, // Don't flush after interrupt. - TOSTOP: 58, // Stop background jobs from output. - IEXTEN: 59, // Enable extensions. - ECHOCTL: 60, // Echo control characters as ^(Char). - ECHOKE: 61, // Visual erase for line kill. - PENDIN: 62, // Retype pending input. - OPOST: 70, // Enable output processing. - OLCUC: 71, // Convert lowercase to uppercase. - ONLCR: 72, // Map NL to CR-NL. - OCRNL: 73, // Translate carriage return to newline (output). - ONOCR: 74, // Translate newline to carriage return-newline - // (output). - ONLRET: 75, // Newline performs a carriage return (output). - CS7: 90, // 7 bit mode. - CS8: 91, // 8 bit mode. - PARENB: 92, // Parity enable. - PARODD: 93, // Odd parity, else even. - TTY_OP_ISPEED: 128, // Specifies the input baud rate in bits per second. - TTY_OP_OSPEED: 129, // Specifies the output baud rate in bits per second. - }, - CHANNEL_EXTENDED_DATATYPE: { - STDERR: 1, - }, - - SIGNALS: [ - 'ABRT', 'ALRM', 'FPE', 'HUP', 'ILL', 'INT', 'QUIT', 'SEGV', 'TERM', 'USR1', - 'USR2', 'KILL', 'PIPE' - ].reduce((cur, val) => ({ ...cur, [val]: 1 }), {}), - - COMPAT, - COMPAT_CHECKS: [ - [ 'Cisco-1.25', COMPAT.BAD_DHGEX ], - [ /^Cisco-1\./, COMPAT.BUG_DHGEX_LARGE ], - [ /^[0-9.]+$/, COMPAT.OLD_EXIT ], // old SSH.com implementations - [ /^OpenSSH_5\.\d+/, COMPAT.DYN_RPORT_BUG ], - ], - - // KEX proposal-related - DEFAULT_KEX, - SUPPORTED_KEX, - DEFAULT_SERVER_HOST_KEY, - SUPPORTED_SERVER_HOST_KEY, - DEFAULT_CIPHER, - SUPPORTED_CIPHER, - DEFAULT_MAC, - SUPPORTED_MAC, - DEFAULT_COMPRESSION, - SUPPORTED_COMPRESSION, - - curve25519Supported, - eddsaSupported, -}; - -module.exports.DISCONNECT_REASON_BY_VALUE = - Array.from(Object.entries(module.exports.DISCONNECT_REASON)) - .reduce((obj, [key, value]) => ({ ...obj, [value]: key }), {}); diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto.js b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto.js deleted file mode 100644 index b4c3ecb1..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto.js +++ /dev/null @@ -1,1607 +0,0 @@ -// TODO: -// * make max packet size configurable -// * if decompression is enabled, use `._packet` in decipher instances as -// input to (sync) zlib inflater with appropriate offset and length to -// avoid an additional copy of payload data before inflation -// * factor decompression status into packet length checks -'use strict'; - -const { - createCipheriv, createDecipheriv, createHmac, randomFillSync, timingSafeEqual -} = require('crypto'); - -const { readUInt32BE, writeUInt32BE } = require('./utils.js'); - -const FastBuffer = Buffer[Symbol.species]; -const MAX_SEQNO = 2 ** 32 - 1; -const EMPTY_BUFFER = Buffer.alloc(0); -const BUF_INT = Buffer.alloc(4); -const DISCARD_CACHE = new Map(); -const MAX_PACKET_SIZE = 35000; - -let binding; -let AESGCMCipher; -let ChaChaPolyCipher; -let GenericCipher; -let AESGCMDecipher; -let ChaChaPolyDecipher; -let GenericDecipher; -try { - binding = require('./crypto/build/Release/sshcrypto.node'); - ({ AESGCMCipher, ChaChaPolyCipher, GenericCipher, - AESGCMDecipher, ChaChaPolyDecipher, GenericDecipher } = binding); -} catch {} - -const CIPHER_STREAM = 1 << 0; -const CIPHER_INFO = (() => { - function info(sslName, blockLen, keyLen, ivLen, authLen, discardLen, flags) { - return { - sslName, - blockLen, - keyLen, - ivLen: (ivLen !== 0 || (flags & CIPHER_STREAM) - ? ivLen - : blockLen), - authLen, - discardLen, - stream: !!(flags & CIPHER_STREAM), - }; - } - - return { - 'chacha20-poly1305@openssh.com': - info('chacha20', 8, 64, 0, 16, 0, CIPHER_STREAM), - - 'aes128-gcm': info('aes-128-gcm', 16, 16, 12, 16, 0, CIPHER_STREAM), - 'aes256-gcm': info('aes-256-gcm', 16, 32, 12, 16, 0, CIPHER_STREAM), - 'aes128-gcm@openssh.com': - info('aes-128-gcm', 16, 16, 12, 16, 0, CIPHER_STREAM), - 'aes256-gcm@openssh.com': - info('aes-256-gcm', 16, 32, 12, 16, 0, CIPHER_STREAM), - - 'aes128-cbc': info('aes-128-cbc', 16, 16, 0, 0, 0, 0), - 'aes192-cbc': info('aes-192-cbc', 16, 24, 0, 0, 0, 0), - 'aes256-cbc': info('aes-256-cbc', 16, 32, 0, 0, 0, 0), - 'rijndael-cbc@lysator.liu.se': info('aes-256-cbc', 16, 32, 0, 0, 0, 0), - '3des-cbc': info('des-ede3-cbc', 8, 24, 0, 0, 0, 0), - 'blowfish-cbc': info('bf-cbc', 8, 16, 0, 0, 0, 0), - 'idea-cbc': info('idea-cbc', 8, 16, 0, 0, 0, 0), - 'cast128-cbc': info('cast-cbc', 8, 16, 0, 0, 0, 0), - - 'aes128-ctr': info('aes-128-ctr', 16, 16, 16, 0, 0, CIPHER_STREAM), - 'aes192-ctr': info('aes-192-ctr', 16, 24, 16, 0, 0, CIPHER_STREAM), - 'aes256-ctr': info('aes-256-ctr', 16, 32, 16, 0, 0, CIPHER_STREAM), - '3des-ctr': info('des-ede3', 8, 24, 8, 0, 0, CIPHER_STREAM), - 'blowfish-ctr': info('bf-ecb', 8, 16, 8, 0, 0, CIPHER_STREAM), - 'cast128-ctr': info('cast5-ecb', 8, 16, 8, 0, 0, CIPHER_STREAM), - - /* The "arcfour128" algorithm is the RC4 cipher, as described in - [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream - generated by the cipher MUST be discarded, and the first byte of the - first encrypted packet MUST be encrypted using the 1537th byte of - keystream. - - -- http://tools.ietf.org/html/rfc4345#section-4 */ - 'arcfour': info('rc4', 8, 16, 0, 0, 1536, CIPHER_STREAM), - 'arcfour128': info('rc4', 8, 16, 0, 0, 1536, CIPHER_STREAM), - 'arcfour256': info('rc4', 8, 32, 0, 0, 1536, CIPHER_STREAM), - 'arcfour512': info('rc4', 8, 64, 0, 0, 1536, CIPHER_STREAM), - }; -})(); - -const MAC_INFO = (() => { - function info(sslName, len, actualLen, isETM) { - return { - sslName, - len, - actualLen, - isETM, - }; - } - - return { - 'hmac-md5': info('md5', 16, 16, false), - 'hmac-md5-96': info('md5', 16, 12, false), - 'hmac-ripemd160': info('ripemd160', 20, 20, false), - 'hmac-sha1': info('sha1', 20, 20, false), - 'hmac-sha1-etm@openssh.com': info('sha1', 20, 20, true), - 'hmac-sha1-96': info('sha1', 20, 12, false), - 'hmac-sha2-256': info('sha256', 32, 32, false), - 'hmac-sha2-256-etm@openssh.com': info('sha256', 32, 32, true), - 'hmac-sha2-256-96': info('sha256', 32, 12, false), - 'hmac-sha2-512': info('sha512', 64, 64, false), - 'hmac-sha2-512-etm@openssh.com': info('sha512', 64, 64, true), - 'hmac-sha2-512-96': info('sha512', 64, 12, false), - }; -})(); - - -// Should only_be used during the initial handshake -class NullCipher { - constructor(seqno, onWrite) { - this.outSeqno = seqno; - this._onWrite = onWrite; - this._dead = false; - } - free() { - this._dead = true; - } - allocPacket(payloadLen) { - let pktLen = 4 + 1 + payloadLen; - let padLen = 8 - (pktLen & (8 - 1)); - if (padLen < 4) - padLen += 8; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - this._onWrite(packet); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - - -const POLY1305_ZEROS = Buffer.alloc(32); -const POLY1305_OUT_COMPUTE = Buffer.alloc(16); -let POLY1305_WASM_MODULE; -let POLY1305_RESULT_MALLOC; -let poly1305_auth; -class ChaChaPolyCipherNative { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._encKeyMain = enc.cipherKey.slice(0, 32); - this._encKeyPktLen = enc.cipherKey.slice(32); - this._dead = false; - } - free() { - this._dead = true; - } - allocPacket(payloadLen) { - let pktLen = 4 + 1 + payloadLen; - let padLen = 8 - ((pktLen - 4) & (8 - 1)); - if (padLen < 4) - padLen += 8; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - // Generate Poly1305 key - POLY1305_OUT_COMPUTE[0] = 0; // Set counter to 0 (little endian) - writeUInt32BE(POLY1305_OUT_COMPUTE, this.outSeqno, 12); - const polyKey = - createCipheriv('chacha20', this._encKeyMain, POLY1305_OUT_COMPUTE) - .update(POLY1305_ZEROS); - - // Encrypt packet length - const pktLenEnc = - createCipheriv('chacha20', this._encKeyPktLen, POLY1305_OUT_COMPUTE) - .update(packet.slice(0, 4)); - this._onWrite(pktLenEnc); - - // Encrypt rest of packet - POLY1305_OUT_COMPUTE[0] = 1; // Set counter to 1 (little endian) - const payloadEnc = - createCipheriv('chacha20', this._encKeyMain, POLY1305_OUT_COMPUTE) - .update(packet.slice(4)); - this._onWrite(payloadEnc); - - // Calculate Poly1305 MAC - poly1305_auth(POLY1305_RESULT_MALLOC, - pktLenEnc, - pktLenEnc.length, - payloadEnc, - payloadEnc.length, - polyKey); - const mac = Buffer.allocUnsafe(16); - mac.set( - new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer, - POLY1305_RESULT_MALLOC, - 16), - 0 - ); - this._onWrite(mac); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - -class ChaChaPolyCipherBinding { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._instance = new ChaChaPolyCipher(enc.cipherKey); - this._dead = false; - } - free() { - this._dead = true; - this._instance.free(); - } - allocPacket(payloadLen) { - let pktLen = 4 + 1 + payloadLen; - let padLen = 8 - ((pktLen - 4) & (8 - 1)); - if (padLen < 4) - padLen += 8; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen + 16/* MAC */); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - // Encrypts in-place - this._instance.encrypt(packet, this.outSeqno); - - this._onWrite(packet); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - - -class AESGCMCipherNative { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._encSSLName = enc.cipherInfo.sslName; - this._encKey = enc.cipherKey; - this._encIV = enc.cipherIV; - this._dead = false; - } - free() { - this._dead = true; - } - allocPacket(payloadLen) { - let pktLen = 4 + 1 + payloadLen; - let padLen = 16 - ((pktLen - 4) & (16 - 1)); - if (padLen < 4) - padLen += 16; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - const cipher = createCipheriv(this._encSSLName, this._encKey, this._encIV); - cipher.setAutoPadding(false); - - const lenData = packet.slice(0, 4); - cipher.setAAD(lenData); - this._onWrite(lenData); - - // Encrypt pad length, payload, and padding - const encrypted = cipher.update(packet.slice(4)); - this._onWrite(encrypted); - const final = cipher.final(); - // XXX: final.length === 0 always? - if (final.length) - this._onWrite(final); - - // Generate MAC - const tag = cipher.getAuthTag(); - this._onWrite(tag); - - // Increment counter in IV by 1 for next packet - ivIncrement(this._encIV); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - -class AESGCMCipherBinding { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._instance = new AESGCMCipher(enc.cipherInfo.sslName, - enc.cipherKey, - enc.cipherIV); - this._dead = false; - } - free() { - this._dead = true; - this._instance.free(); - } - allocPacket(payloadLen) { - let pktLen = 4 + 1 + payloadLen; - let padLen = 16 - ((pktLen - 4) & (16 - 1)); - if (padLen < 4) - padLen += 16; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen + 16/* authTag */); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - // Encrypts in-place - this._instance.encrypt(packet); - - this._onWrite(packet); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - - -class GenericCipherNative { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._encBlockLen = enc.cipherInfo.blockLen; - this._cipherInstance = createCipheriv(enc.cipherInfo.sslName, - enc.cipherKey, - enc.cipherIV); - this._macSSLName = enc.macInfo.sslName; - this._macKey = enc.macKey; - this._macActualLen = enc.macInfo.actualLen; - this._macETM = enc.macInfo.isETM; - this._aadLen = (this._macETM ? 4 : 0); - this._dead = false; - - const discardLen = enc.cipherInfo.discardLen; - if (discardLen) { - let discard = DISCARD_CACHE.get(discardLen); - if (discard === undefined) { - discard = Buffer.alloc(discardLen); - DISCARD_CACHE.set(discardLen, discard); - } - this._cipherInstance.update(discard); - } - } - free() { - this._dead = true; - } - allocPacket(payloadLen) { - const blockLen = this._encBlockLen; - - let pktLen = 4 + 1 + payloadLen; - let padLen = blockLen - ((pktLen - this._aadLen) & (blockLen - 1)); - if (padLen < 4) - padLen += blockLen; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - let mac; - if (this._macETM) { - // Encrypt pad length, payload, and padding - const lenBytes = new Uint8Array(packet.buffer, packet.byteOffset, 4); - const encrypted = this._cipherInstance.update( - new Uint8Array(packet.buffer, - packet.byteOffset + 4, - packet.length - 4) - ); - - this._onWrite(lenBytes); - this._onWrite(encrypted); - - // TODO: look into storing seqno as 4-byte buffer and incrementing like we - // do for AES-GCM IVs to avoid having to (re)write all 4 bytes every time - mac = createHmac(this._macSSLName, this._macKey); - writeUInt32BE(BUF_INT, this.outSeqno, 0); - mac.update(BUF_INT); - mac.update(lenBytes); - mac.update(encrypted); - } else { - // Encrypt length field, pad length, payload, and padding - const encrypted = this._cipherInstance.update(packet); - this._onWrite(encrypted); - - // TODO: look into storing seqno as 4-byte buffer and incrementing like we - // do for AES-GCM IVs to avoid having to (re)write all 4 bytes every time - mac = createHmac(this._macSSLName, this._macKey); - writeUInt32BE(BUF_INT, this.outSeqno, 0); - mac.update(BUF_INT); - mac.update(packet); - } - - let digest = mac.digest(); - if (digest.length > this._macActualLen) - digest = digest.slice(0, this._macActualLen); - this._onWrite(digest); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - -class GenericCipherBinding { - constructor(config) { - const enc = config.outbound; - this.outSeqno = enc.seqno; - this._onWrite = enc.onWrite; - this._encBlockLen = enc.cipherInfo.blockLen; - this._macLen = enc.macInfo.len; - this._macActualLen = enc.macInfo.actualLen; - this._aadLen = (enc.macInfo.isETM ? 4 : 0); - this._instance = new GenericCipher(enc.cipherInfo.sslName, - enc.cipherKey, - enc.cipherIV, - enc.macInfo.sslName, - enc.macKey, - enc.macInfo.isETM); - this._dead = false; - } - free() { - this._dead = true; - this._instance.free(); - } - allocPacket(payloadLen) { - const blockLen = this._encBlockLen; - - let pktLen = 4 + 1 + payloadLen; - let padLen = blockLen - ((pktLen - this._aadLen) & (blockLen - 1)); - if (padLen < 4) - padLen += blockLen; - pktLen += padLen; - - const packet = Buffer.allocUnsafe(pktLen + this._macLen); - - writeUInt32BE(packet, pktLen - 4, 0); - packet[4] = padLen; - - randomFillSync(packet, 5 + payloadLen, padLen); - - return packet; - } - encrypt(packet) { - // `packet` === unencrypted packet - - if (this._dead) - return; - - // Encrypts in-place - this._instance.encrypt(packet, this.outSeqno); - - if (this._macActualLen < this._macLen) { - packet = new FastBuffer(packet.buffer, - packet.byteOffset, - (packet.length - - (this._macLen - this._macActualLen))); - } - this._onWrite(packet); - - this.outSeqno = (this.outSeqno + 1) >>> 0; - } -} - - -class NullDecipher { - constructor(seqno, onPayload) { - this.inSeqno = seqno; - this._onPayload = onPayload; - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._packetPos = 0; - } - free() {} - decrypt(data, p, dataLen) { - while (p < dataLen) { - // Read packet length - if (this._lenBytes < 4) { - let nb = Math.min(4 - this._lenBytes, dataLen - p); - - this._lenBytes += nb; - while (nb--) - this._len = (this._len << 8) + data[p++]; - - if (this._lenBytes < 4) - return; - - if (this._len > MAX_PACKET_SIZE - || this._len < 8 - || (4 + this._len & 7) !== 0) { - throw new Error('Bad packet length'); - } - if (p >= dataLen) - return; - } - - // Read padding length, payload, and padding - if (this._packetPos < this._len) { - const nb = Math.min(this._len - this._packetPos, dataLen - p); - if (p !== 0 || nb !== dataLen) { - if (nb === this._len) { - this._packet = new FastBuffer(data.buffer, data.byteOffset + p, nb); - } else { - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._packetPos - ); - } - } else if (nb === this._len) { - this._packet = data; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(data, this._packetPos); - } - p += nb; - this._packetPos += nb; - if (this._packetPos < this._len) - return; - } - - const payload = (!this._packet - ? EMPTY_BUFFER - : new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - - this._packet[0] - 1)); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._packetPos = 0; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -class ChaChaPolyDecipherNative { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._decKeyMain = dec.decipherKey.slice(0, 32); - this._decKeyPktLen = dec.decipherKey.slice(32); - this._len = 0; - this._lenBuf = Buffer.alloc(4); - this._lenPos = 0; - this._packet = null; - this._pktLen = 0; - this._mac = Buffer.allocUnsafe(16); - this._calcMac = Buffer.allocUnsafe(16); - this._macPos = 0; - } - free() {} - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read packet length - if (this._lenPos < 4) { - let nb = Math.min(4 - this._lenPos, dataLen - p); - while (nb--) - this._lenBuf[this._lenPos++] = data[p++]; - if (this._lenPos < 4) - return; - - POLY1305_OUT_COMPUTE[0] = 0; // Set counter to 0 (little endian) - writeUInt32BE(POLY1305_OUT_COMPUTE, this.inSeqno, 12); - - const decLenBytes = - createDecipheriv('chacha20', this._decKeyPktLen, POLY1305_OUT_COMPUTE) - .update(this._lenBuf); - this._len = readUInt32BE(decLenBytes, 0); - - if (this._len > MAX_PACKET_SIZE - || this._len < 8 - || (this._len & 7) !== 0) { - throw new Error('Bad packet length'); - } - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - if (p >= dataLen) - return; - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let encrypted; - if (p !== 0 || nb !== dataLen) - encrypted = new Uint8Array(data.buffer, data.byteOffset + p, nb); - else - encrypted = data; - if (nb === this._len) { - this._packet = encrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(encrypted, this._pktLen); - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read Poly1305 MAC - { - const nb = Math.min(16 - this._macPos, dataLen - p); - // TODO: avoid copying if entire MAC is in current chunk - if (p !== 0 || nb !== dataLen) { - this._mac.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._macPos - ); - } else { - this._mac.set(data, this._macPos); - } - p += nb; - this._macPos += nb; - if (this._macPos < 16) - return; - } - - // Generate Poly1305 key - POLY1305_OUT_COMPUTE[0] = 0; // Set counter to 0 (little endian) - writeUInt32BE(POLY1305_OUT_COMPUTE, this.inSeqno, 12); - const polyKey = - createCipheriv('chacha20', this._decKeyMain, POLY1305_OUT_COMPUTE) - .update(POLY1305_ZEROS); - - // Calculate and compare Poly1305 MACs - poly1305_auth(POLY1305_RESULT_MALLOC, - this._lenBuf, - 4, - this._packet, - this._packet.length, - polyKey); - - this._calcMac.set( - new Uint8Array(POLY1305_WASM_MODULE.HEAPU8.buffer, - POLY1305_RESULT_MALLOC, - 16), - 0 - ); - if (!timingSafeEqual(this._calcMac, this._mac)) - throw new Error('Invalid MAC'); - - // Decrypt packet - POLY1305_OUT_COMPUTE[0] = 1; // Set counter to 1 (little endian) - const packet = - createDecipheriv('chacha20', this._decKeyMain, POLY1305_OUT_COMPUTE) - .update(this._packet); - - const payload = new FastBuffer(packet.buffer, - packet.byteOffset + 1, - packet.length - packet[0] - 1); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._len = 0; - this._lenPos = 0; - this._packet = null; - this._pktLen = 0; - this._macPos = 0; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -class ChaChaPolyDecipherBinding { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._instance = new ChaChaPolyDecipher(dec.decipherKey); - this._len = 0; - this._lenBuf = Buffer.alloc(4); - this._lenPos = 0; - this._packet = null; - this._pktLen = 0; - this._mac = Buffer.allocUnsafe(16); - this._macPos = 0; - } - free() { - this._instance.free(); - } - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read packet length - if (this._lenPos < 4) { - let nb = Math.min(4 - this._lenPos, dataLen - p); - while (nb--) - this._lenBuf[this._lenPos++] = data[p++]; - if (this._lenPos < 4) - return; - - this._len = this._instance.decryptLen(this._lenBuf, this.inSeqno); - - if (this._len > MAX_PACKET_SIZE - || this._len < 8 - || (this._len & 7) !== 0) { - throw new Error('Bad packet length'); - } - - if (p >= dataLen) - return; - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let encrypted; - if (p !== 0 || nb !== dataLen) - encrypted = new Uint8Array(data.buffer, data.byteOffset + p, nb); - else - encrypted = data; - if (nb === this._len) { - this._packet = encrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(encrypted, this._pktLen); - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read Poly1305 MAC - { - const nb = Math.min(16 - this._macPos, dataLen - p); - // TODO: avoid copying if entire MAC is in current chunk - if (p !== 0 || nb !== dataLen) { - this._mac.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._macPos - ); - } else { - this._mac.set(data, this._macPos); - } - p += nb; - this._macPos += nb; - if (this._macPos < 16) - return; - } - - this._instance.decrypt(this._packet, this._mac, this.inSeqno); - - const payload = new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - this._packet[0] - 1); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._len = 0; - this._lenPos = 0; - this._packet = null; - this._pktLen = 0; - this._macPos = 0; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -class AESGCMDecipherNative { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._decipherInstance = null; - this._decipherSSLName = dec.decipherInfo.sslName; - this._decipherKey = dec.decipherKey; - this._decipherIV = dec.decipherIV; - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._packetPos = 0; - this._pktLen = 0; - this._tag = Buffer.allocUnsafe(16); - this._tagPos = 0; - } - free() {} - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read packet length (unencrypted, but AAD) - if (this._lenBytes < 4) { - let nb = Math.min(4 - this._lenBytes, dataLen - p); - this._lenBytes += nb; - while (nb--) - this._len = (this._len << 8) + data[p++]; - if (this._lenBytes < 4) - return; - - if ((this._len + 20) > MAX_PACKET_SIZE - || this._len < 16 - || (this._len & 15) !== 0) { - throw new Error('Bad packet length'); - } - - this._decipherInstance = createDecipheriv( - this._decipherSSLName, - this._decipherKey, - this._decipherIV - ); - this._decipherInstance.setAutoPadding(false); - this._decipherInstance.setAAD(intToBytes(this._len)); - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - if (p >= dataLen) - return; - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let decrypted; - if (p !== 0 || nb !== dataLen) { - decrypted = this._decipherInstance.update( - new Uint8Array(data.buffer, data.byteOffset + p, nb) - ); - } else { - decrypted = this._decipherInstance.update(data); - } - if (decrypted.length) { - if (nb === this._len) { - this._packet = decrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(decrypted, this._packetPos); - } - this._packetPos += decrypted.length; - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read authentication tag - { - const nb = Math.min(16 - this._tagPos, dataLen - p); - if (p !== 0 || nb !== dataLen) { - this._tag.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._tagPos - ); - } else { - this._tag.set(data, this._tagPos); - } - p += nb; - this._tagPos += nb; - if (this._tagPos < 16) - return; - } - - { - // Verify authentication tag - this._decipherInstance.setAuthTag(this._tag); - - const decrypted = this._decipherInstance.final(); - - // XXX: this should never output any data since stream ciphers always - // return data from .update() and block ciphers must end on a multiple - // of the block length, which would have caused an exception to be - // thrown if the total input was not... - if (decrypted.length) { - if (this._packet) - this._packet.set(decrypted, this._packetPos); - else - this._packet = decrypted; - } - } - - const payload = (!this._packet - ? EMPTY_BUFFER - : new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - - this._packet[0] - 1)); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - ivIncrement(this._decipherIV); - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._packetPos = 0; - this._pktLen = 0; - this._tagPos = 0; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -class AESGCMDecipherBinding { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._instance = new AESGCMDecipher(dec.decipherInfo.sslName, - dec.decipherKey, - dec.decipherIV); - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._pktLen = 0; - this._tag = Buffer.allocUnsafe(16); - this._tagPos = 0; - } - free() {} - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read packet length (unencrypted, but AAD) - if (this._lenBytes < 4) { - let nb = Math.min(4 - this._lenBytes, dataLen - p); - this._lenBytes += nb; - while (nb--) - this._len = (this._len << 8) + data[p++]; - if (this._lenBytes < 4) - return; - - if ((this._len + 20) > MAX_PACKET_SIZE - || this._len < 16 - || (this._len & 15) !== 0) { - throw new Error(`Bad packet length: ${this._len}`); - } - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - if (p >= dataLen) - return; - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let encrypted; - if (p !== 0 || nb !== dataLen) - encrypted = new Uint8Array(data.buffer, data.byteOffset + p, nb); - else - encrypted = data; - if (nb === this._len) { - this._packet = encrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(encrypted, this._pktLen); - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read authentication tag - { - const nb = Math.min(16 - this._tagPos, dataLen - p); - if (p !== 0 || nb !== dataLen) { - this._tag.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._tagPos - ); - } else { - this._tag.set(data, this._tagPos); - } - p += nb; - this._tagPos += nb; - if (this._tagPos < 16) - return; - } - - this._instance.decrypt(this._packet, this._len, this._tag); - - const payload = new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - this._packet[0] - 1); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._len = 0; - this._lenBytes = 0; - this._packet = null; - this._pktLen = 0; - this._tagPos = 0; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -// TODO: test incremental .update()s vs. copying to _packet and doing a single -// .update() after entire packet read -- a single .update() would allow -// verifying MAC before decrypting for ETM MACs -class GenericDecipherNative { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._decipherInstance = createDecipheriv(dec.decipherInfo.sslName, - dec.decipherKey, - dec.decipherIV); - this._decipherInstance.setAutoPadding(false); - this._block = Buffer.allocUnsafe( - dec.macInfo.isETM ? 4 : dec.decipherInfo.blockLen - ); - this._blockSize = dec.decipherInfo.blockLen; - this._blockPos = 0; - this._len = 0; - this._packet = null; - this._packetPos = 0; - this._pktLen = 0; - this._mac = Buffer.allocUnsafe(dec.macInfo.actualLen); - this._macPos = 0; - this._macSSLName = dec.macInfo.sslName; - this._macKey = dec.macKey; - this._macActualLen = dec.macInfo.actualLen; - this._macETM = dec.macInfo.isETM; - this._macInstance = null; - - const discardLen = dec.decipherInfo.discardLen; - if (discardLen) { - let discard = DISCARD_CACHE.get(discardLen); - if (discard === undefined) { - discard = Buffer.alloc(discardLen); - DISCARD_CACHE.set(discardLen, discard); - } - this._decipherInstance.update(discard); - } - } - free() {} - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read first encrypted block - if (this._blockPos < this._block.length) { - const nb = Math.min(this._block.length - this._blockPos, dataLen - p); - if (p !== 0 || nb !== dataLen || nb < data.length) { - this._block.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._blockPos - ); - } else { - this._block.set(data, this._blockPos); - } - - p += nb; - this._blockPos += nb; - if (this._blockPos < this._block.length) - return; - - let decrypted; - let need; - if (this._macETM) { - this._len = need = readUInt32BE(this._block, 0); - } else { - // Decrypt first block to get packet length - decrypted = this._decipherInstance.update(this._block); - this._len = readUInt32BE(decrypted, 0); - need = 4 + this._len - this._blockSize; - } - - if (this._len > MAX_PACKET_SIZE - || this._len < 5 - || (need & (this._blockSize - 1)) !== 0) { - throw new Error('Bad packet length'); - } - - // Create MAC up front to calculate in parallel with decryption - this._macInstance = createHmac(this._macSSLName, this._macKey); - - writeUInt32BE(BUF_INT, this.inSeqno, 0); - this._macInstance.update(BUF_INT); - if (this._macETM) { - this._macInstance.update(this._block); - } else { - this._macInstance.update(new Uint8Array(decrypted.buffer, - decrypted.byteOffset, - 4)); - this._pktLen = decrypted.length - 4; - this._packetPos = this._pktLen; - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set( - new Uint8Array(decrypted.buffer, - decrypted.byteOffset + 4, - this._packetPos), - 0 - ); - } - - if (p >= dataLen) - return; - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let encrypted; - if (p !== 0 || nb !== dataLen) - encrypted = new Uint8Array(data.buffer, data.byteOffset + p, nb); - else - encrypted = data; - if (this._macETM) - this._macInstance.update(encrypted); - const decrypted = this._decipherInstance.update(encrypted); - if (decrypted.length) { - if (nb === this._len) { - this._packet = decrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(decrypted, this._packetPos); - } - this._packetPos += decrypted.length; - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read MAC - { - const nb = Math.min(this._macActualLen - this._macPos, dataLen - p); - if (p !== 0 || nb !== dataLen) { - this._mac.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._macPos - ); - } else { - this._mac.set(data, this._macPos); - } - p += nb; - this._macPos += nb; - if (this._macPos < this._macActualLen) - return; - } - - // Verify MAC - if (!this._macETM) - this._macInstance.update(this._packet); - let calculated = this._macInstance.digest(); - if (this._macActualLen < calculated.length) { - calculated = new Uint8Array(calculated.buffer, - calculated.byteOffset, - this._macActualLen); - } - if (!timingSafeEquals(calculated, this._mac)) - throw new Error('Invalid MAC'); - - const payload = new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - this._packet[0] - 1); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._blockPos = 0; - this._len = 0; - this._packet = null; - this._packetPos = 0; - this._pktLen = 0; - this._macPos = 0; - this._macInstance = null; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -class GenericDecipherBinding { - constructor(config) { - const dec = config.inbound; - this.inSeqno = dec.seqno; - this._onPayload = dec.onPayload; - this._instance = new GenericDecipher(dec.decipherInfo.sslName, - dec.decipherKey, - dec.decipherIV, - dec.macInfo.sslName, - dec.macKey, - dec.macInfo.isETM, - dec.macInfo.actualLen); - this._block = Buffer.allocUnsafe( - dec.macInfo.isETM || dec.decipherInfo.stream - ? 4 - : dec.decipherInfo.blockLen - ); - this._blockPos = 0; - this._len = 0; - this._packet = null; - this._pktLen = 0; - this._mac = Buffer.allocUnsafe(dec.macInfo.actualLen); - this._macPos = 0; - this._macActualLen = dec.macInfo.actualLen; - this._macETM = dec.macInfo.isETM; - } - free() { - this._instance.free(); - } - decrypt(data, p, dataLen) { - // `data` === encrypted data - - while (p < dataLen) { - // Read first encrypted block - if (this._blockPos < this._block.length) { - const nb = Math.min(this._block.length - this._blockPos, dataLen - p); - if (p !== 0 || nb !== dataLen || nb < data.length) { - this._block.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._blockPos - ); - } else { - this._block.set(data, this._blockPos); - } - - p += nb; - this._blockPos += nb; - if (this._blockPos < this._block.length) - return; - - let need; - if (this._macETM) { - this._len = need = readUInt32BE(this._block, 0); - } else { - // Decrypt first block to get packet length - this._instance.decryptBlock(this._block); - this._len = readUInt32BE(this._block, 0); - need = 4 + this._len - this._block.length; - } - - if (this._len > MAX_PACKET_SIZE - || this._len < 5 - || (need & (this._block.length - 1)) !== 0) { - throw new Error('Bad packet length'); - } - - if (!this._macETM) { - this._pktLen = (this._block.length - 4); - if (this._pktLen) { - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set( - new Uint8Array(this._block.buffer, - this._block.byteOffset + 4, - this._pktLen), - 0 - ); - } - } - - if (p >= dataLen) - return; - } - - // Read padding length, payload, and padding - if (this._pktLen < this._len) { - const nb = Math.min(this._len - this._pktLen, dataLen - p); - let encrypted; - if (p !== 0 || nb !== dataLen) - encrypted = new Uint8Array(data.buffer, data.byteOffset + p, nb); - else - encrypted = data; - if (nb === this._len) { - this._packet = encrypted; - } else { - if (!this._packet) - this._packet = Buffer.allocUnsafe(this._len); - this._packet.set(encrypted, this._pktLen); - } - p += nb; - this._pktLen += nb; - if (this._pktLen < this._len || p >= dataLen) - return; - } - - // Read MAC - { - const nb = Math.min(this._macActualLen - this._macPos, dataLen - p); - if (p !== 0 || nb !== dataLen) { - this._mac.set( - new Uint8Array(data.buffer, data.byteOffset + p, nb), - this._macPos - ); - } else { - this._mac.set(data, this._macPos); - } - p += nb; - this._macPos += nb; - if (this._macPos < this._macActualLen) - return; - } - - // Decrypt and verify MAC - this._instance.decrypt(this._packet, - this.inSeqno, - this._block, - this._mac); - - const payload = new FastBuffer(this._packet.buffer, - this._packet.byteOffset + 1, - this._packet.length - this._packet[0] - 1); - - // Prepare for next packet - this.inSeqno = (this.inSeqno + 1) >>> 0; - this._blockPos = 0; - this._len = 0; - this._packet = null; - this._pktLen = 0; - this._macPos = 0; - this._macInstance = null; - - { - const ret = this._onPayload(payload); - if (ret !== undefined) - return (ret === false ? p : ret); - } - } - } -} - -// Increments unsigned, big endian counter (last 8 bytes) of AES-GCM IV -function ivIncrement(iv) { - // eslint-disable-next-line no-unused-expressions - ++iv[11] >>> 8 - && ++iv[10] >>> 8 - && ++iv[9] >>> 8 - && ++iv[8] >>> 8 - && ++iv[7] >>> 8 - && ++iv[6] >>> 8 - && ++iv[5] >>> 8 - && ++iv[4] >>> 8; -} - -const intToBytes = (() => { - const ret = Buffer.alloc(4); - return (n) => { - ret[0] = (n >>> 24); - ret[1] = (n >>> 16); - ret[2] = (n >>> 8); - ret[3] = n; - return ret; - }; -})(); - -function timingSafeEquals(a, b) { - if (a.length !== b.length) { - timingSafeEqual(a, a); - return false; - } - return timingSafeEqual(a, b); -} - -function createCipher(config) { - if (typeof config !== 'object' || config === null) - throw new Error('Invalid config'); - - if (typeof config.outbound !== 'object' || config.outbound === null) - throw new Error('Invalid outbound'); - - const outbound = config.outbound; - - if (typeof outbound.onWrite !== 'function') - throw new Error('Invalid outbound.onWrite'); - - if (typeof outbound.cipherInfo !== 'object' || outbound.cipherInfo === null) - throw new Error('Invalid outbound.cipherInfo'); - - if (!Buffer.isBuffer(outbound.cipherKey) - || outbound.cipherKey.length !== outbound.cipherInfo.keyLen) { - throw new Error('Invalid outbound.cipherKey'); - } - - if (outbound.cipherInfo.ivLen - && (!Buffer.isBuffer(outbound.cipherIV) - || outbound.cipherIV.length !== outbound.cipherInfo.ivLen)) { - throw new Error('Invalid outbound.cipherIV'); - } - - if (typeof outbound.seqno !== 'number' - || outbound.seqno < 0 - || outbound.seqno > MAX_SEQNO) { - throw new Error('Invalid outbound.seqno'); - } - - const forceNative = !!outbound.forceNative; - - switch (outbound.cipherInfo.sslName) { - case 'aes-128-gcm': - case 'aes-256-gcm': - return (AESGCMCipher && !forceNative - ? new AESGCMCipherBinding(config) - : new AESGCMCipherNative(config)); - case 'chacha20': - return (ChaChaPolyCipher && !forceNative - ? new ChaChaPolyCipherBinding(config) - : new ChaChaPolyCipherNative(config)); - default: { - if (typeof outbound.macInfo !== 'object' || outbound.macInfo === null) - throw new Error('Invalid outbound.macInfo'); - if (!Buffer.isBuffer(outbound.macKey) - || outbound.macKey.length !== outbound.macInfo.len) { - throw new Error('Invalid outbound.macKey'); - } - return (GenericCipher && !forceNative - ? new GenericCipherBinding(config) - : new GenericCipherNative(config)); - } - } -} - -function createDecipher(config) { - if (typeof config !== 'object' || config === null) - throw new Error('Invalid config'); - - if (typeof config.inbound !== 'object' || config.inbound === null) - throw new Error('Invalid inbound'); - - const inbound = config.inbound; - - if (typeof inbound.onPayload !== 'function') - throw new Error('Invalid inbound.onPayload'); - - if (typeof inbound.decipherInfo !== 'object' - || inbound.decipherInfo === null) { - throw new Error('Invalid inbound.decipherInfo'); - } - - if (!Buffer.isBuffer(inbound.decipherKey) - || inbound.decipherKey.length !== inbound.decipherInfo.keyLen) { - throw new Error('Invalid inbound.decipherKey'); - } - - if (inbound.decipherInfo.ivLen - && (!Buffer.isBuffer(inbound.decipherIV) - || inbound.decipherIV.length !== inbound.decipherInfo.ivLen)) { - throw new Error('Invalid inbound.decipherIV'); - } - - if (typeof inbound.seqno !== 'number' - || inbound.seqno < 0 - || inbound.seqno > MAX_SEQNO) { - throw new Error('Invalid inbound.seqno'); - } - - const forceNative = !!inbound.forceNative; - - switch (inbound.decipherInfo.sslName) { - case 'aes-128-gcm': - case 'aes-256-gcm': - return (AESGCMDecipher && !forceNative - ? new AESGCMDecipherBinding(config) - : new AESGCMDecipherNative(config)); - case 'chacha20': - return (ChaChaPolyDecipher && !forceNative - ? new ChaChaPolyDecipherBinding(config) - : new ChaChaPolyDecipherNative(config)); - default: { - if (typeof inbound.macInfo !== 'object' || inbound.macInfo === null) - throw new Error('Invalid inbound.macInfo'); - if (!Buffer.isBuffer(inbound.macKey) - || inbound.macKey.length !== inbound.macInfo.len) { - throw new Error('Invalid inbound.macKey'); - } - return (GenericDecipher && !forceNative - ? new GenericDecipherBinding(config) - : new GenericDecipherNative(config)); - } - } -} - -module.exports = { - CIPHER_INFO, - MAC_INFO, - bindingAvailable: !!binding, - init: (() => { - // eslint-disable-next-line no-async-promise-executor - return new Promise(async (resolve, reject) => { - try { - POLY1305_WASM_MODULE = await require('./crypto/poly1305.js')(); - POLY1305_RESULT_MALLOC = POLY1305_WASM_MODULE._malloc(16); - poly1305_auth = POLY1305_WASM_MODULE.cwrap( - 'poly1305_auth', - null, - ['number', 'array', 'number', 'array', 'number', 'array'] - ); - } catch (ex) { - return reject(ex); - } - resolve(); - }); - })(), - - NullCipher, - createCipher, - NullDecipher, - createDecipher, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/binding.gyp b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/binding.gyp deleted file mode 100644 index 29c32827..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/binding.gyp +++ /dev/null @@ -1,14 +0,0 @@ -{ - 'targets': [ - { - 'target_name': 'sshcrypto', - 'include_dirs': [ - "> $(depfile) -# Add extra rules as in (2). -# We remove slashes and replace spaces with new lines; -# remove blank lines; -# delete the first line and append a colon to the remaining lines. -sed -e 's|\\||' -e 'y| |\n|' $(depfile).raw |\ - grep -v '^$$' |\ - sed -e 1d -e 's|$$|:|' \ - >> $(depfile) -rm $(depfile).raw -endef - -# Command definitions: -# - cmd_foo is the actual command to run; -# - quiet_cmd_foo is the brief-output summary of the command. - -quiet_cmd_cc = CC($(TOOLSET)) $@ -cmd_cc = $(CC.$(TOOLSET)) -o $@ $< $(GYP_CFLAGS) $(DEPFLAGS) $(CFLAGS.$(TOOLSET)) -c - -quiet_cmd_cxx = CXX($(TOOLSET)) $@ -cmd_cxx = $(CXX.$(TOOLSET)) -o $@ $< $(GYP_CXXFLAGS) $(DEPFLAGS) $(CXXFLAGS.$(TOOLSET)) -c - -quiet_cmd_touch = TOUCH $@ -cmd_touch = touch $@ - -quiet_cmd_copy = COPY $@ -# send stderr to /dev/null to ignore messages when linking directories. -cmd_copy = ln -f "$<" "$@" 2>/dev/null || (rm -rf "$@" && cp -af "$<" "$@") - -quiet_cmd_alink = AR($(TOOLSET)) $@ -cmd_alink = rm -f $@ && $(AR.$(TOOLSET)) crs $@ $(filter %.o,$^) - -quiet_cmd_alink_thin = AR($(TOOLSET)) $@ -cmd_alink_thin = rm -f $@ && $(AR.$(TOOLSET)) crsT $@ $(filter %.o,$^) - -# Due to circular dependencies between libraries :(, we wrap the -# special "figure out circular dependencies" flags around the entire -# input list during linking. -quiet_cmd_link = LINK($(TOOLSET)) $@ -cmd_link = $(LINK.$(TOOLSET)) -o $@ $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,--start-group $(LD_INPUTS) $(LIBS) -Wl,--end-group - -# We support two kinds of shared objects (.so): -# 1) shared_library, which is just bundling together many dependent libraries -# into a link line. -# 2) loadable_module, which is generating a module intended for dlopen(). -# -# They differ only slightly: -# In the former case, we want to package all dependent code into the .so. -# In the latter case, we want to package just the API exposed by the -# outermost module. -# This means shared_library uses --whole-archive, while loadable_module doesn't. -# (Note that --whole-archive is incompatible with the --start-group used in -# normal linking.) - -# Other shared-object link notes: -# - Set SONAME to the library filename so our binaries don't reference -# the local, absolute paths used on the link command-line. -quiet_cmd_solink = SOLINK($(TOOLSET)) $@ -cmd_solink = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--whole-archive $(LD_INPUTS) -Wl,--no-whole-archive $(LIBS) - -quiet_cmd_solink_module = SOLINK_MODULE($(TOOLSET)) $@ -cmd_solink_module = $(LINK.$(TOOLSET)) -o $@ -shared $(GYP_LDFLAGS) $(LDFLAGS.$(TOOLSET)) -Wl,-soname=$(@F) -Wl,--start-group $(filter-out FORCE_DO_CMD, $^) -Wl,--end-group $(LIBS) - - -# Define an escape_quotes function to escape single quotes. -# This allows us to handle quotes properly as long as we always use -# use single quotes and escape_quotes. -escape_quotes = $(subst ','\'',$(1)) -# This comment is here just to include a ' to unconfuse syntax highlighting. -# Define an escape_vars function to escape '$' variable syntax. -# This allows us to read/write command lines with shell variables (e.g. -# $LD_LIBRARY_PATH), without triggering make substitution. -escape_vars = $(subst $$,$$$$,$(1)) -# Helper that expands to a shell command to echo a string exactly as it is in -# make. This uses printf instead of echo because printf's behaviour with respect -# to escape sequences is more portable than echo's across different shells -# (e.g., dash, bash). -exact_echo = printf '%s\n' '$(call escape_quotes,$(1))' - -# Helper to compare the command we're about to run against the command -# we logged the last time we ran the command. Produces an empty -# string (false) when the commands match. -# Tricky point: Make has no string-equality test function. -# The kernel uses the following, but it seems like it would have false -# positives, where one string reordered its arguments. -# arg_check = $(strip $(filter-out $(cmd_$(1)), $(cmd_$@)) \ -# $(filter-out $(cmd_$@), $(cmd_$(1)))) -# We instead substitute each for the empty string into the other, and -# say they're equal if both substitutions produce the empty string. -# .d files contain ? instead of spaces, take that into account. -command_changed = $(or $(subst $(cmd_$(1)),,$(cmd_$(call replace_spaces,$@))),\ - $(subst $(cmd_$(call replace_spaces,$@)),,$(cmd_$(1)))) - -# Helper that is non-empty when a prerequisite changes. -# Normally make does this implicitly, but we force rules to always run -# so we can check their command lines. -# $? -- new prerequisites -# $| -- order-only dependencies -prereq_changed = $(filter-out FORCE_DO_CMD,$(filter-out $|,$?)) - -# Helper that executes all postbuilds until one fails. -define do_postbuilds - @E=0;\ - for p in $(POSTBUILDS); do\ - eval $$p;\ - E=$$?;\ - if [ $$E -ne 0 ]; then\ - break;\ - fi;\ - done;\ - if [ $$E -ne 0 ]; then\ - rm -rf "$@";\ - exit $$E;\ - fi -endef - -# do_cmd: run a command via the above cmd_foo names, if necessary. -# Should always run for a given target to handle command-line changes. -# Second argument, if non-zero, makes it do asm/C/C++ dependency munging. -# Third argument, if non-zero, makes it do POSTBUILDS processing. -# Note: We intentionally do NOT call dirx for depfile, since it contains ? for -# spaces already and dirx strips the ? characters. -define do_cmd -$(if $(or $(command_changed),$(prereq_changed)), - @$(call exact_echo, $($(quiet)cmd_$(1))) - @mkdir -p "$(call dirx,$@)" "$(dir $(depfile))" - $(if $(findstring flock,$(word 1,$(cmd_$1))), - @$(cmd_$(1)) - @echo " $(quiet_cmd_$(1)): Finished", - @$(cmd_$(1)) - ) - @$(call exact_echo,$(call escape_vars,cmd_$(call replace_spaces,$@) := $(cmd_$(1)))) > $(depfile) - @$(if $(2),$(fixup_dep)) - $(if $(and $(3), $(POSTBUILDS)), - $(call do_postbuilds) - ) -) -endef - -# Declare the "all" target first so it is the default, -# even though we don't have the deps yet. -.PHONY: all -all: - -# make looks for ways to re-generate included makefiles, but in our case, we -# don't have a direct way. Explicitly telling make that it has nothing to do -# for them makes it go faster. -%.d: ; - -# Use FORCE_DO_CMD to force a target to run. Should be coupled with -# do_cmd. -.PHONY: FORCE_DO_CMD -FORCE_DO_CMD: - -TOOLSET := target -# Suffix rules, putting all outputs into $(obj). -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(srcdir)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -# Try building from generated source, too. -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj).$(TOOLSET)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - -$(obj).$(TOOLSET)/%.o: $(obj)/%.c FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cpp FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.cxx FORCE_DO_CMD - @$(call do_cmd,cxx,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.s FORCE_DO_CMD - @$(call do_cmd,cc,1) -$(obj).$(TOOLSET)/%.o: $(obj)/%.S FORCE_DO_CMD - @$(call do_cmd,cc,1) - - -ifeq ($(strip $(foreach prefix,$(NO_LOAD),\ - $(findstring $(join ^,$(prefix)),\ - $(join ^,sshcrypto.target.mk)))),) - include sshcrypto.target.mk -endif - -quiet_cmd_regen_makefile = ACTION Regenerating $@ -cmd_regen_makefile = cd $(srcdir); /home/volodymyr/.nvm/versions/node/v14.15.1/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/home/volodymyr/.cache/node-gyp/14.15.1" "-Dnode_gyp_dir=/home/volodymyr/.nvm/versions/node/v14.15.1/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/home/volodymyr/.cache/node-gyp/14.15.1/<(target_arch)/node.lib" "-Dmodule_root_dir=/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/ssh2/lib/protocol/crypto" "-Dnode_engine=v8" "--depth=." "-Goutput_dir=." "--generator-output=build" -I/home/volodymyr/projects/plugins/Cassandra/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/config.gypi -I/home/volodymyr/.nvm/versions/node/v14.15.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/home/volodymyr/.cache/node-gyp/14.15.1/include/node/common.gypi "--toplevel-dir=." binding.gyp -Makefile: $(srcdir)/binding.gyp $(srcdir)/../../../../../../../../../.nvm/versions/node/v14.15.1/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/../../../../../../../../../.cache/node-gyp/14.15.1/include/node/common.gypi - $(call do_cmd,regen_makefile) - -# "all" is a concatenation of the "all" targets from all the included -# sub-makefiles. This is just here to clarify. -all: - -# Add in dependency-tracking rules. $(all_deps) is the list of every single -# target in our tree. Only consider the ones with .d (dependency) info: -d_files := $(wildcard $(foreach f,$(all_deps),$(depsdir)/$(f).d)) -ifneq ($(d_files),) - include $(d_files) -endif diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d deleted file mode 100644 index cd5809ee..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/obj.target/sshcrypto.node := g++ -o Release/obj.target/sshcrypto.node -shared -pthread -rdynamic -m64 -Wl,-soname=sshcrypto.node -Wl,--start-group Release/obj.target/sshcrypto/src/binding.o -Wl,--end-group diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d deleted file mode 100644 index c48dbe8e..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d +++ /dev/null @@ -1,117 +0,0 @@ -cmd_Release/obj.target/sshcrypto/src/binding.o := g++ -o Release/obj.target/sshcrypto/src/binding.o ../src/binding.cc '-DNODE_GYP_MODULE_NAME=sshcrypto' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/home/volodymyr/.cache/node-gyp/14.15.1/include/node -I/home/volodymyr/.cache/node-gyp/14.15.1/src -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/config -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/openssl/include -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/uv/include -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/zlib -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/v8/include -I../../../../../nan -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++1y -MMD -MF ./Release/.deps/Release/obj.target/sshcrypto/src/binding.o.d.raw -c -Release/obj.target/sshcrypto/src/binding.o: ../src/binding.cc \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/cppgc/common.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8config.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-internal.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-version.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8config.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-platform.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_version.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_buffer.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node.h \ - ../../../../../nan/nan.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_version.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/errno.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/version.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/unix.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/threadpool.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/linux.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_object_wrap.h \ - ../../../../../nan/nan_callbacks.h \ - ../../../../../nan/nan_callbacks_12_inl.h \ - ../../../../../nan/nan_maybe_43_inl.h \ - ../../../../../nan/nan_converters.h \ - ../../../../../nan/nan_converters_43_inl.h ../../../../../nan/nan_new.h \ - ../../../../../nan/nan_implementation_12_inl.h \ - ../../../../../nan/nan_persistent_12_inl.h ../../../../../nan/nan_weak.h \ - ../../../../../nan/nan_object_wrap.h ../../../../../nan/nan_private.h \ - ../../../../../nan/nan_typedarray_contents.h \ - ../../../../../nan/nan_json.h ../../../../../nan/nan_scriptorigin.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/err.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/e_os2.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/opensslconf.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/./opensslconf_asm.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/././archs/linux-x86_64/asm/include/openssl/opensslconf.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/opensslv.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/ossl_typ.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bio.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/crypto.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/safestack.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/stack.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/cryptoerr.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/symhacks.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bioerr.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/lhash.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/evp.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/evperr.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/objects.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/obj_mac.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/asn1.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/asn1err.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bn.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bnerr.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/objectserr.h \ - /home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/hmac.h -../src/binding.cc: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/cppgc/common.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8config.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-internal.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-version.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8config.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/v8-platform.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_version.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_buffer.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node.h: -../../../../../nan/nan.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_version.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/errno.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/version.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/unix.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/threadpool.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/uv/linux.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/node_object_wrap.h: -../../../../../nan/nan_callbacks.h: -../../../../../nan/nan_callbacks_12_inl.h: -../../../../../nan/nan_maybe_43_inl.h: -../../../../../nan/nan_converters.h: -../../../../../nan/nan_converters_43_inl.h: -../../../../../nan/nan_new.h: -../../../../../nan/nan_implementation_12_inl.h: -../../../../../nan/nan_persistent_12_inl.h: -../../../../../nan/nan_weak.h: -../../../../../nan/nan_object_wrap.h: -../../../../../nan/nan_private.h: -../../../../../nan/nan_typedarray_contents.h: -../../../../../nan/nan_json.h: -../../../../../nan/nan_scriptorigin.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/err.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/e_os2.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/opensslconf.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/./opensslconf_asm.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/././archs/linux-x86_64/asm/include/openssl/opensslconf.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/opensslv.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/ossl_typ.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bio.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/crypto.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/safestack.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/stack.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/cryptoerr.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/symhacks.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bioerr.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/lhash.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/evp.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/evperr.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/objects.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/obj_mac.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/asn1.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/asn1err.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bn.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/bnerr.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/objectserr.h: -/home/volodymyr/.cache/node-gyp/14.15.1/include/node/openssl/hmac.h: diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d deleted file mode 100644 index 236a0f9a..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/.deps/Release/sshcrypto.node.d +++ /dev/null @@ -1 +0,0 @@ -cmd_Release/sshcrypto.node := ln -f "Release/obj.target/sshcrypto.node" "Release/sshcrypto.node" 2>/dev/null || (rm -rf "Release/sshcrypto.node" && cp -af "Release/obj.target/sshcrypto.node" "Release/sshcrypto.node") diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto.node deleted file mode 100755 index ea091ccce9a3476697c2223b47c3c937879d6852..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 93472 zcmeFa33wGn7B+m@1QkqF(6|yuR2&f#BnYEuVhG%f0i%F|f+2*k$dU+QQ&EsyZrIsq{hM&N7$NqYpbG66qg{I6C^tjAZ{nsTe^ti0O z_0<{I7$C<@>7e^hIn96Fs=<(RHDp5Mk$>(dffUzl!G=Q4H8^ga85g{^Gvk~q=ipD@ zFKUMUnfXf1xPFIdL4wyBBcF41<~s-DsF&aSW6T#i*UXpB4qMFx&ecpWx+D$yOs_uu zLr_m0yE=}``_=|#`?Yne&RYJ(>LuS@^~0c_$K7|*`wgdmkLD2F@M8R-zG>>CvO`B7 zy)m@^t*b*V>q0m5z)C2d-nj39)AyO)D08oE`_5{#cYbz@P8%z@HlYnS?)+@rOTC^d)quxn73r<@htrz`RVy zpPBeG3x8(g&o%fH!yo78THM4PAaI>y;OlUmk3S0xd=sw!z@Izt=T3uLXs*uXE^~9Y zgD}^7aJ?6Q{%PR*&6Sr$*8PLH|7y~ny%W_B|1^Bj(5;b2iYgDkwf~kwsz>GZ9J%JU z_dmY*m!emehd*Au{m~!3dHdPs*ByB7Pw(z|?2!L#YnGjJ{iTnpQ18O4S5IBmeC5N- ziWfii*UR?o{m*Tmw7YY1%jydbf9H;M&n^7CZIhADTu?JAFaPpacmKF#cYU9E)rUmK zthw#qb6#0LBd77mF9x=`xw5Ep^Y6Y6^`1N@@BHwPe|~Y=H9fy-@~@)GaF_CvJH9`# zW8qC7pL*MrQF-gC*WA|V%{@S$yPe)7#dkG=iDork;= z?sUeE8}rWJ|HWY&ChxUor==R-ZBa|aARk5p`@$Jh;m=Bge>@GHkJ9vKJWNG@NE-a2 z{ZjY;_`uZoO=;*1YLmME>uLHANP`~_=2P+ib{akOgj)ZSLeF`vQq#E<0U;Irf2YBR zGg9~eYZ^YsB2cBGe;k5nD*Ty;ghB_T;Qw<3#8myy0X|j#N7DGiJ!$N?V&ByCuT4W| zZ5sWr0W+!iYz)6j#pnHL^n6zu|7o43|9NTjwkb{jyfpe;js%m6|JG^z^JeHFm0T6z zCl#H>NMxz{pN~YAs{g@AZmIBBrSYp*4@%v?Ya07*O+)`j=phxKt<%scN~5>pGk zi8CsVU-g3$Qt4p`^p=XxXVTdHjx_WerHKzO?~{7oj%obiOT>p%{9K-9-EBz|PZp%n z&q-<4#k@3jAC|^mwQ20tEscJbr{RBe8al6}k?Zei?9wX@pLe98(;*F?m#10R$EKlw z6O5J0ukzBw=SFGh+?dAC_fBKSL(};4>uKoUnI;a;OXHuEDLX|TX`V*^6Vv$f8ENd^ zF-^SvTN=4qr{Qx^8vGS$@xV(QK2@W0p>Y0M>mJ|L0(}0g)xnoYw+LWDs*OP#BhVZqq*tN zf*(I`>Psl$@MGwd8vKI?heCIS4h@BRP=oq8h}Th=m;5XZ@bfzO6@C)z6$)K~b;zHk zX5Q%wG<+NUo&uhp#2SDDf7wPeb9;dGdU_El)d3$R*kLZg$ zix8h_^uXsq{?wUy*9GRyMm(gvSpj*^H~i1LL63K~5h@+M1^8@@_(uJ-59p^S{6Xw; zi>5OecI8jp=q+cXfT5A_WB!yu4w1|7&*w7!JdOB3{E)R8e$w>69`uOcY8;_nH;0}D zpX4XY>_<5M^9t<1{tIX8jxU@3M;rTw1N}QdF7}^(weHx<^e;tRCBFIrjc5yf@n;P3 zBk}Vd)v$v<745_?xnAQPKipyL@>;+y{n3s6gLYhH{C{Iy(=lodJ!a-zvQ*=rG=?8& z?3*31?|X*M^f`Vydl~(_X5@ABGa2!g{7g3w$frWT{CUvmziys}Kh&2{c^bRyGWHGX zv#YUh^-4`(v(e{e#*VWCe)WLiztreqhM6~n^+!IlU(<-&zz2Vd3_sZcKPfcpJu{%6 z{m`HOqXP4OVf0XUkEXlW(BEk2sDK^U8+mh#KErxgXqw?a=UR<0Y=!0gRQ{-h*+epP|1YK>t9~zdEY9Yta5zih*1-2D#!Qh zT{xy{TxGxVp<^m_Tk4jwiYet~!$*xPA2aGwbiAO?$$iSl<>r)Dj-Nm}<7$fgbehz) zYtM<}Dr!bmjVtQYH@B?QDSfKO6;@SGC2_B3zwzaxY9!>fw>=71|Q zgyv4?bE3f~!@s-0hBbrRt z-sPh!ITr|&PAcs=3G??YOELWu&#f#UcJ{b2Q~OqzS5)d*ilAw+LT+xjeB7`x zm3=F!sw;Cl6^^gONR28gg|1w(rx>anNq4UpT~;x2v}>l^P6b7MdlmLB992ECa(w5W z<0~ua2K3`jIgZ~t4kErlA22ewK4El_+tnw0Vb#QOH4wDuywbA5;?i)@xn+g@29%Aj zoKRU4L=MNqMl?h0*ma@#iJUJ-JuqxXSUP zD*miC!o3R$MMg&)zj|Fa^P?%ZALF=JP%4i=KwKdaz&S*c)<=&V@xEbWN+*ds<>nc& z9p!n`1Y2aDAkvvApgxa^U#&vJk8&yaywUL4CrJyM|31O_9CQ+YPD9tik>&Wmv}(-M zWKmNzij$U}RWz_n>`6cF-NSF+6r)^Wx_HxRhw?O%)Fett!n&k_BK@g_nwx^z{~96J zSV= z;~8Nm6pus599L0UBvG%Vs-k>MF_XA20NSIvlvIuzQ8V&)_wU@Jyrw*TZ@Qe3u7C9~ zg!m9yuCA&stEqCiMnHC=d~OahP~pV!<57FKDaMy83UehtI0Kxl-lcEN_)+6Vf5+0ZDwu;$MhD$j60qbqFwm`NN=0Qgi=1wPA3wfoJacxQqq8zI15&xj zFam0?WG{i_4(W+Jl#LTq1(UYvqH~@%M_$pd(%0P`5pz5D8#%sevdf^KEuSSJh)-G0 z`U9S2Pp5uWB2LlR>YAxqy}3z#dP>na@y0)zMp-0iX1W$n=#N}?vMBA-89ob~;tZh);8=#y;&G#3iYYeA@ilak@W-@WQ8Rvw^yx8bMCF8< zzDUYmd>mIfxomv-2vn?kGtBqaL}J*<`8|(Uptk5BkBl$zw%xTpzlW89H@b`B*G`7{jWfpm9N&gyeuG zSUBtk2926jHb&wT8HQgurBcSrnJt(#D)Wisxy6WVk z0nCuJO8$gq`lQNVxj9B+#N9un>9Lh#E2^g&J)A;eM0zD53L zZ0!ZKuKlWXzVXLxJD5Ql_BR>ENx_psWAR{HRY9#;&E3u)KdPoOMSiOoRXS>vtf}(K z31zvRx|WTo&})%!r@SsMY%N0sI%i1*)*9=IUvI50A2tm6POKU*#-CAHAlCgE5}ww( z6;C*`stPH1oX&GzOKvCApfe1Yy_24FS{Yx_*^OYsBv+US<~|)USP3w}Y?~xKf&5|S z1IpKt(~gYymRHnNjh`x;H@RJ$r{I2-W2^am zUQ{I9Ir|mq9+Re~f-DSi4DmZ6aBRMw4ow7h2Gc#w5!u}(Qf6DrE9 zxj$q*pVET1$=7ty($`;Hn`S%jyOiW;e|OSw_jtGYD@#WAIQJVWd1oS9K(vP~m_91!oqQ<#s%| zW4BPRlHxOgC_A}hXRAS@%Q^um9dMWH-FE7jr{4_y+TVCd>-*u$c0bO%uC%atAtfi* zy@BSHqe0l??R&5P@4X{8$v=(oZNUE*{%aDNf-@?39UscapQ*1uf;XIdg_amx&GFac zBuul=3Io6S$Y?08NoYM_{xrhrtcdCc1g(ErXkX-Hmud*);T#fhQh13UBTk zhZ1JI^PK@Ek)JyAT}768@9N;4?=7+e`01wqkidIF2c8$epJLAO-ygsi8+=zoAFpjg z=9R7Rm2cszHLLP>*upz!$JsC?4gUT#_zh|BEzEfY@?+EQng%~I4ZhT(@4QncpVQOe zm!!dOOoPv~=C$ePr@>dJ!H=})&m@E9r`p0-IY?YH&!A@XO1AMgTm3JV9{R6^7XB^^ zzvFa|j*VYu^xlir>UIKP@c${SFe>EDL{yh0nI|wHCg;g}=nYceU`dEPTF& zpKam87Jj^iFSYRI$epwfu<#M9{}2m5(ZY|k@a8C$v{qYqb7W2MQ!KnWk|Ox&7M|bz zI6t#3{DTe>*LfCxs)fJV!jHD_3oZO@7XE$ zw(z|ye5r*GTlfJMzSzPKvG9Ml@FOk!Sr)$9!k1Y1DHguBg`aNW`&jtd7XEAtKhMIK zTKJnS{5ckWp@l!!!ryP<`&#%V7QUZ_Uuxm|TlhK)f1ZV3XW`Gc@UL0;0TzCPg&%0) zH(K}$EWEPtgDm`33vadn_X<>}`qXUAT$BkGe27thXiZa$#;%Z%bU~!rY+VmYCtf zeCXVkxWt892wd*M+=$+mILC##0lh6z;KJN^-j>L9VQx5YOC06G+-TmG*x!Y@!MrWe z$b~Zm{_Yn?UcLZ>{4UH5X2|ct+*pSEF3b((ZHY%+m>bEE--Wq>4EbG{8^@5}g}Gr2 z`CXVB#oH3)F3b&L$nV137>4{V%#B~j@50>hh5Rnejb6y_!rb76{4UIm-EE2Q_Birq z3;c--A0_bXF3b&F$nU~O3;d`HbHf($yD&FuA-@ZAgBJ3;@NoiP;==6(E_Y#W#6o@- z<_0X}cVTY4LVg$KhAZTEVQ#cSei!BjE97_KlLY>5woAu)hm)LlpLRVQz#%ei!BjDCBoxZhS(17v_d1 z#ag$o6K)P=cW3He=^8n$kl%&5F$nv+FgFBY ze;4LPAmn#pZU91l7rs#7To>j>Amn#pZU91l7v{zvo)h zI4=O77=Vunz()k&HUYR*0B#n5_XOnqF#vA~z+VL54+HSq0r=$r{6YX;5rCfzzz+rB z`vUOo0eC?GjtAgK0G<|rCkEiL0k|>%4-UZn190yEToi!22jIK_d}07TCIBB1fZGJ% zRspzK0N%67@83TL;4K08ivav#0De0FzZ`&H2*4`>@RI@fp#Xee0KPo{F9^W#02~Rx z(*p3s06aDTR|eq00l0qv?j3-O0&w>LoELyk48X?(;3EQXn*iJ@05=Q3d%g_VKLBqD zz+VL54+HSq0r=$r{6YX;5rCfzzz+rB`vUOo0eC?GjtAgK0G<|rCkEiL0k|>%4-UZn z190yETx7%Hcz4d1$U(t_`$f19$D7^FOSc_0ZSZJx#i#nwXzzxN8EvN{TZLAeEBa5B z{(0khIsTV$bZhweZ_WrmzoSXG(c19qztpq_foX<7i-wKEC9gT-nct>&&%@Zz#1s05 zXLj%O32wvDFKSwbW8GJNffF2w9Ssd?7#>E}Hfx1`jRs?^J3q%KCZo~tL%2VN7o1nn zzo1{=aC8@*?s7_Erwj|nnjX_$XcukBtt*aQk=;8!E;}6S)sXRY{=U&wCuTRrub$q~ zC}Yl-KQk^F4^@;PL67?~F;ln#Rv@+V} zOFbd_IiDITiI1IL(61z3xllAU-E=-O~}t-1_zQM8}bIjC1w zHpT$3Rt&Yw!1IC{B%L>*XE+)eKqmf<0VOfHFF~&p(5oa08P=+eY>Be3Y6CUlmSmm* zh2D{djM}@}fpjeIjgM)9pVWAC5j)7}Rch!@4GkBE3YO6{MY(kshjQ1KM1Mxla6E52 zSz$c|zDfQmC_;;%E(Ce?6vm?4;-#U`GVs`t`v&d0aC<{T!36~ulKDtoMr{rl;LNjy z&`)Y1s0at_d;^$Q<3Ptqa1ZHTB=B~&e+FXk;Q8P_7l>7A71}7@-}K!1{<+(+yP0c?PqgM&KMm*@gM)Jo_`y$4c;sr|^*dVz(hKANfKA302& zXqdW>4e`9kpY|za?vEZ*6@I2_DMf&(dGvLSBU9%Xrj8eM_n{vm#6Q)%7K*LM19(ZS zdwXEi2`;ye!yH0mc@Fcl*bdrQt44ou8M^_R@TW+`cmjjt3$N~ zSrPGA@Q$T9`9FGryenOtwXsUoe;-(ySeUu%;a?YNC93Trwk*xVWGtdfy{ZF)>M;C; zo*kd`d15nAEErHQkc#5cd=gtU@UfEklS63NFNI!%`UT2ySLk<;PQ8SIvX<7WM(CuT z6&P8nUKQZhag6%}O@0*nmD z#PyBnt5nZzK?B63GZgy)xCqDMTn=F^9%!jb@eMJ^HI8j`_&x!gs9B)53?pcns~<=3 zka$`BT|>jbGRGuC!JUNWCuONsPy#&x))-On0LVNVG8=^9TD6zSe^MbdslzapiC(3g zdS8LXVDm5^LhADyoaj}BHb-Nhu`!wQ& zq#g(8vPl8ZpBPv#2uwj*&k#fKW5}Cs8_J9DyTx6z;7A_hwlKHL?ut2aU2R4+S3YzdLKgKM<|Bs^8` zzeKD0(=Al>+5s1YBil1-JA)Y};g^I=gZdma+{pMYBvp@rigp0CiB#_vSQgrGxWz)7 z_qMap_Cg0o%a^h-o;Upw-$EOvXBR_nz@o4g+CUCYvCzuFMIaI!Dco*S+o3eIzsF!t zGT6vta298ab#Lo3SV^W#27Ql>@w`nB`xspPHGAktaK4|xr5v1s!8%!0zDO_)jL-x7 zOH=orV8GNgN4KH%o4xfGt)W9_DHw5=7=1*YuAQ9sj0A19Z*X1p(~|RcZ|7D=f(Iy$ z8wpw-jJ5U?Wid-R5D7YnEWaKJZnlOa5-bAfvMD}$6FKnK;uP^eYEM0+<>&2Ceai*a z94tyCIQ<}SHxTqZ_Z>c3WJx*YRe1_D(|Z~`I!QX$?7p9R8-24c!Hp9 zlN~}G`WLTM-k+dn&}6MRlL9$^0DFhR>j25h`)Q$QSKgJ5oz|*bg=tt%E9z9tl4P=3 znPRfJulh{35hH^pd+E!xCMy?(1x>cum0x8#*3+Ck3b9m6{N)r?ZLl$=EAQ=J*p+vV z-(U%9H-*8zleOndXAjHdKdD*L)V=BzH=Q-zj}kZQ4veFj84%4?v)HbR410xbskj`M zzKX!&CZPPyxz+am093qm7RNNIJyEIC*1-W2@Dj=* zQM0i5k;pGA_Xd5-bk-I8NIE-?++72DUOId9pHxV_s`(s~nsk;)U75mmP}1zzP;K7q zCy3Jo3fsLPCU{oAaG@L`BBvCw9Ni$G*75^guCBgkM^VMvnM zSc=`=WAGuFO|O*w1#SC5gSe8<49Ut1bQko?-3N#IMDMJ?DD(xf*tTN zCN;6~Ka3qFHs&YIK8|YhX3r3}3B<;)*axxkQ*f&GfV98V-%Q^8)q?2%aZKi{2{Qf} zhp&|3l*uvNgECx{$S1P67)0bhQ*O2VdKroQAZy3Q4*Sv<@_J*}Mf<;Kb*&6=;?gSh z)JK8XXg%@cl?5OA3n9DuNHiq%TN5E6vGIOzt(xF3bQ`|V=k8lR^w(}H_R-PtZ6Va4 zwm^AqbleD8)pD?+T|jLm-Ngb+bj-mmqT^jJIMFeKbDFwnCL8f)X+-e z!zMZo<=_-c?P72dSZc=!x0_T0WLAd?LlPa&CWHHU49=C=^ji5I_kK_KM4Tx(IxYeM z#}gopM8~%|(-I+Jd&3<1fSRo6I2B^4w?NOS8#C{4>c*8H*mdJ;&3v)(QEE4Z z!InWO0fSAF$$wIP(4~_7W-%K zr#09VQCQGmjm6uSn6o}<%QC}{)1t&UbVt3#nBfAT+lnRC8L)Ah$m~G z=49O{4lg~wVb230sNs?CiD`crMLj4AI`P9*p-@4_Q$-=Zew&9^rX{hwbAVG1Vgl#~ zbFgf`Lo=pkiAPBoTrO-&7_8Q}=&Ra*TVaX+K9m|kE@P)Vui7L8-h&>+^=PF+O?(wb z4;7L2Qk{G=w=*-h^ky#bX5KE+fXlV&HVo^{9nPVgdCPnDYqsLswAS9;AX<}}?JRa% zi*6!iJ*C_sGdHM(GUs;N|=}_vL&>2W~Wqd{7 z1EfzNky!UZb(FLFG+g+8>KLq9^P*ARg2~bJm*+{L&E_?<;V-HJOeB6mI5F?>aaLd> z1&-w{Gc<<$;%X49Tb--Pe87p~ZSEB^+tuMD(*-@v`3H3yh+wu3LIhPx>^bz;E}v1` zk1t>J3j)lk!WM_P6?_G%@A>B7S2*H}L$xh41>Kz#s&x)JpB*@2AOuRjLj?RVVuocI6; zFjpJmk6MiWiB<@{nqP@eiFO_wWBY3^?D$0u(2o92M!s<9Ir`~`cE>&~5G9;;hwsjM zyy$mUiuTr4dvgRMXFTYO{eHk2a{R9sN>8U9)tk0I+8zF$@U?5bJ)zrW{!CdqS|1L7 z^R4#ltafMq8f*S%@p{dhU+2Vr*8C^neVElQcI#}>zuIbd^w(O`7yr5xFI=7RYS#vs z^Qkv!UnZ=K+6g;>`0*__)+UAm;o0{^^iRy!s2;HQa>9!}croGra6-So&Ij7j-%_+X z^Sk!9+B30MgYEsS_K2@t+o!YDzQu|Uj{aNgcCk;f6(1b^{D76=_}6J$ee;Wc-;$N1 zgnH+7kFJT|`?7Jro#8VWr#743M6`V#jzIeFYQaHw0st2d!JzxYcyc4a1xF_QeKjHi0-J9A_6 z(;C;D5$lPmuQ+6;Y836+qNefS)!|s1*Kueocm3eR^YCHJ^A+bAr{}ps&vPQ@=|r8x zTfNBUvAVfTH~)l-I#4%1$mTJ+IbS!|vH6GB=p)|wL36Sa-_3zfFqx@Vp~uX^7L6$L zgqthG9%NcA3nzubv{2 zPnPv;FrJ@Yf!He?YhDt|?j8BOW)kbV1`I%THYWm}ies(Yg=1&x!=KMPhd(DZA3kGe zX48pXOJYM0rh&64T$XzBRR#=z>MYQpsk1->Y>Is?hru+t+tn<_m*|?!E1-o>A^9^o zS_|J?Em{au3wMJgnpd+qS2w?^n_IAXCYn)?IQmH`&q;q;o-bZ;ILEJdD)H@Gf%hGTf||o$2SY0Gg2f z!_^4gSqB^A{DoSd>HOcCzgw#LKYz*0f0=*&rm5!Nq&xfOU#;a$H-ACD;^=PkVeJx} z7z-@u*6Ie(bR%dpRYMW6nqZBUG#-qUSOT2m|CT&6eB_KiTRZYBCLvd!jsr~8SaAS6 zBpgW+ek~uV8d*|8|BPaZ4}p{CJR_%@4=jEfrQ)adMWf%tQu6Z!=c+Gs_?h!q3Vtrp zBy@N+{Pa%8kFD>eJbdK_P!qwv|F^T^qoCof_*k?3F}bz`#uP`JwxiRvR@=+~nZKEO zliU~sk!>0%1C+ef<$kZG^QCA1l>Ah<{Okl}o1YnAKLtNS{rnWB;O9!~slU@GS zQxQ%EviQ5s;2r+DrRMKYKYzObI{bAt{GF1_pXKklIQiwV*Ph;Tkea^^WMY@KS0`XB zJi9$eafylU4pI|!bGB-!n+=bbb=C2CIGgJWIX?&GXl%A#B-9$P%|>xv|Drugm1x4E z>;ugrX%CT{dO)MRc%LGk-10E!y355dyry2{$yOIqKkiC(^38p^IZK_Uo1J`PIKPq2 z^@WD>%S1=5R4HB7RZTOQHz?2Lny^ov0g&;xZfVYQkox{?W}X*gO->RzCI1 zw-oa-Z+8SAl&>D}uh$EcO}${;^@|rozV=G=?b^g~*R{GiTMgER%m#h>o^jWw*_`CA zmuOcIql;2lFYEeZ5}Tr{6PIB-1Tv49?y2O1X`+(6DW>htr z9sjlC{X!hS@*G$s%u-FznZcpGx&@kKypSd7#)~ZV$r{}wTTM1SvLU5}UXgP@^(uQ{ zq^wJh6!+dwT@AGp@2t#M!2p}3YVk725;K7~b2D`vr85~MjENWtUk1*O*jBx3`?F*3 z)4}K;v$t8!Kd#2yh(_vKGLf{L-_gxkYOHQ{+}$kadNwC5=NZ~JM6CgP&tj8j?^j_x z=MiA@Wn%9l*j3$0y75*^*ld=-OS-uko2R2WmA%y>+ukB!mO2of#kgvbv6^d5QvrOp zO83Z8SDPLpre)WU*~76b@#0JSsheyMLL~ke45YAkotePc`z}gn?457y{ULCv?d^T9 zH{JZw`P zFf%_ojJ!!g6%qC*ihf?wZDU4cB<5GQQH%D6f*Fx)5DU*(Q-=}oJOB5B0e-iD7YG(P z4rEnb9rk=Q6JU*RhrU6xS_Cv?Qg`9H4E^vL3R@JHT#iZbUMcn*=8x9PyOg56z1JlJvdY2VQIDJIf%edP`FerFz<5RyaawlWv}g{XUtzoi}-6 zAf!^Cff{1Vz1VSbVoUX8P{H@TQ((n*ppWJVn;FJo@pE+ZVm3EJv%j8~??ufQwKKln zfg$z^<#(ctFV+gZRo*UdQrCbHuFyq*e`AGy+>|SHytP96)77~`$uC!EnIM|XoRZln zWA2>-_!i$FvyyMI`!z>!z``g2p<=U;pMWOemzfQsZdnfBs*hn+mK9fnh&ilN0`58Q zy`&di6^=e1em>DP{QOth;b?p-6fGFle)fVL1fEai6hzk)M_=U|yBw_$6HV?;X7*Lu zC>l{5iKwF^%Eih3etMQ}`fXkAdLI8=o$*wJGv{u{QewQoB_EgBk<$n~6(J`*X0PZD zs3g9EO+9Acce+6LvH$GI8Th+*bfa03_?9^GGW*HNK4$|CZrw)gN#nKKVs#R z12dHwh|3Uk#id#<{-vx+u|mxBAdpG?B*wrq>^dt9c1-PItFl z4&A_gYEPyO8INSBEahypQP1m0a>7a~(f7{wJPw($hQ4azBwyR=^%sbfFMulJSof_zF{0=Et=H~pvmM^T)m}vCsz&ls(6OBWSp!Ss)hqdoClrEqw|Jme%nH=eooIY zf-`hUnqe4cXlrIT*f+x^W`;)Y3={7_%%PRli4YwzhxePKtT)$+_3=UU=S8^9V=o;cIFr41}W^93$NyLU;BkSc+8-6}|_W;pj)|Zw|d{ zU3yJ3BL6`j^5W84E3V&2?HeF_9!ACVl8R4g${|AcyB_f&UnA|R51?C_|3q{|!WC({ zZJc;T@ysi7Lip59Gv0OPD_9{rwdl)mh9LAzKK@c;R_JKn8}|HhJy+YGb9e&<>sHG;ZkNv41l54fq?04`{L?(TX>@O zwjZB%ye%V=AS+R^yE+2eF#e!_AD7e6R2rmH;zEb0K19!w z_)p4*0o2$?~a|Ju&S5s``_$^P-Ya|-}g?9N6Fwf__jjQK1 z6DDY{dG1MQ(A08&g=p$@POpDO!kcKLIxmBK>R7sfKbS_TiWzHY7%P|}zWLJcG!SGQ zT?P}YQZlE7lQ_CbU4drR&G4A(7USq)7LRvAUUeuC^6M;gy(xZc?&*kvVCv1)plLj12PRaH1Lo|DarHdq7%p^J zVZr0Br$pWX5#$?D@(OVbxlgPFejehBG~8=76oXqQ-Z|~H(k^`ye}#1rVAkU;q!VD? z#w$m}pZ)OOQbj3!ywwA2Hl^uPx;c~07o%AzzXb3tkZ1J*slChYw~2*{zdmgZ z1E2<>BO?o#GUN#IeQF#>+HpzqX zDPW27A=_l*SHb8S0g)#k9ikEp)O_ek#y&0~_KNIhSap;{zf}7;Ew^y;*b4GbLa0TM z+|*`g(o4-iB=}QtWKa!VVknlQAttjFbnDqZBXS|QNnrm556Jm6tF6(&&=lk2dssUv z=TX>%-n}PU4I59)PCr1wjb_68+CmaNG9gG@p)~8PVUyhGBzY?P7M4MN_2^0812>&FQwqM*Sn z#|gmX_!C?`j<35|bNu3iF2|8R818uE_gHF*-NXarR79_B^!r?_|W)n2-J2%Dclv+55P8&v8zVPk6DIfqJIM=I+E zzkxp4qIV>+q{SDB#ba=Zs#;8RFYF@M)ts)% zHH7`@x|$r-M6A{eJM48ee<_Y#*`9$L&k239d3^l~^p&;$4}@v@J*7emYO~4LLzu`Shy-(dbsd|)guHccu6gP0@bWqMOy;Gd z!^;c0Ior%?cxjuGm-pZl4lkJZFJJ=mns+ra?}4hBCTw=@Hvw8nhvLTuf2GDE4=@qP zbBZK_P3m#!qF2|dGeDEM z=OpHy1Cpl9=ajoJn04#-xO%Jo87??P><{nvrag+&{s#yXEWVT5P3jitL-l}Ef$Z3w zZl3gn43tE2--&NzJhQ1C((`rg_7|H&{bj6yvp6@yshTVX@7!%r>bC zbmL>lvl^Ct6}6Hq?@gAmV8OON7ZIjX>U(9PCo5Q1Auo{eSevzR9tG7~rwF{6>LJ(? zfjk^5#Ys(g#l-Qd~whD|P6Hci>ChQF?UMlRqh?nkpL$DT?kjZ$ffov|(%^&LKi^|Y^9h%+q zRRzDjA2dVDW*%QskK*7nK%#Yg3oc!1Z zJp5PkqRyC)DZUS6Jz5uCG=o3oGh9()}Q>#HrE+z1mT5MbFvey# z6Y8AXN)>4rHX+E#k5|U5{MZ_60|pqt4A#J*HWi4>_41_o2or(e4jlH=vK|!(p(0Ph9=^vGd(<5Ia9UP6|3d zhSA3SxD|}~@?%@jbo1jj_VT6VY)<(B&I;_3ysTd}~HA6MMvO)L5FSs+Y)d|hrg zsi~M&wS!duH}j(@t_G7^`qmHBRFXYU*Uee#ZQUHO=Sgf%@~woneZaSl#-VCAKmK!e z3g4pq!pq2%yga6xvs7_PUhZLY5-)=-Uf^41UcYZeHDQw{zT z+SHbXm=)Ik0$0!49}U*le)Uer+Q^URf`XMFAIAtk!B5aZ{lgHP?;|+X5WK=A=;g-; z#8ZAHKW0f~Z}Q_H_^6#9v(+_}@wfA1A-W~y$2+Kl1eoI5bn|0-D%77J?<3=}HvgOz z$d7T@@^|IOHQ?LHdcU3@84sPFf&6$j7()UaFv!b~|2bdsW1E4kl-pjDrn%$q=`>;ZX%uaNhGtA{y8{bz*G`5dn<1y%84Zed`@|_CkKvT_F!xiJ( z1l9GfJkRwK?xv$hz?#q2drvWnCeR!p)zJ|0CPq$!E^*(uxx4MDNd|rT?HrLJNY+jCL zkNtGKzv_$@Da<}8pnh4}pz*kb6@ zN2p9Foh;OC{N4@UgLYwpfSZs$<%MC{Xi}d;SMtDE2;RuZ zAKFEo1u0GHkds_pAdUJ2B-NN3X$}cAcM&-VFau3LT>US#&s+da!EtM&O=+%r^*p*H zR)f-wR!{o4Lb-?{;9@Jrhd=+XL0Ce80$eiG-av5NNZn!#p$# z+H?0W0r&C4eBYNiKyWxWMwfH*6jc;TyeYFxr#G2Am6^Cm^Fu$h&xM8K;&`$Q#kJLV zs8KT09Lz9t1>G_`Bl0Xn$4RTMp^VyY@I;WwPjSp@CC#Zqhy#pty+HsSb8v_#OWrN1 zo(}C!Xo|_|V+X$cilU4YS=3QZr&eY>vM1Mq92Ekfd?&BcUSd&-7yJ?u8f^$w_y{#MjP|w& z?F$--b7|O9JQ`z2<2Xa3t&hfT!_3|mjrv`nu^(tG%cfI$htKqS?b+2ie0B&r(k0B{ zvwYPA3mMK7d7R?x`q^D4`uMH-Ts%QMH&KSM>K-tLwEip}#GI_3^LJ<`-hI?rNb8@I zsd%f~*=(}@{=rZ>j)TV(e; zMG62rps6)fw_dnox|wvVD~R>XC;np=lQcEHeRqYpKDpbSni`j=?uIkv zF)f2#kIY6lQ^I1&IPbsaaUFcCE|icD-q)&ZxG#0ro+KED?6cymqTR>I<^<#{j`KL# z6lB1IIV=87ashD|PFBz~L|>|LDVUCf zu%`GhMMP}`49%2d#yEMn4)Uo9n8(C{`=K9I0hj^hLR`IoQouEVgjp0P_xiap0kf(# z=(c&}@ZkBu?jXgyKaepolT-K}9Zu&=J3)&xeTS@J zCUp~Zsm_D}1L?Ve4mV>B7pE^hBhShjLB3SGv_nTeMl@67z=EH{e}HFozTxm}ABT&I zwJy4O97ZmJz7f1>A5~5Z2hYctc{A0~AWY5hEQ#7qL42BN$9X>nnwohRS5GtZjAovX zxtfW5376kI%d0c8)N1fb`sb7WjY;&^pjlmM=uh_1FERAXE&8)SKXEjLV;y3hPZXH% zcirb>I-py3P!XZTX7FIz-RI*;f`c98s|)yOZm1yoaz^bg*cf>qu|CT^EvEQ!Rb0M& zP%na4DSY`|#UCzw<8TtY@a+z2O3@1^Kw8KDiL3xD{*SBCy?zg;im&nX-jvx#ffMKa zjbqmdRhP?`>kk)&h*4UE_rn>b} zr3b?bn>nVhsB=*MK1Fw+z6)QNR6!#Okl#iV!LoB2+u@#@ga+ zL74h2#rfhvV1oU;^TpU>8KG+$i8bbE?^{qg`>k>5q2Jlb{W>ss$-d65ZqG&;bMk~! zd``!dI1)BUs*i5K1gwuv1w&@PCIn4z&M+&nV12|baJN1>n1HW7`W$??8|Ct8n_Hor zhR$f>7+tQoC7*tupmVp8`@smOkxf~z+%o5{ZT)lxuW~%V+2MaYSvNyK%WT&(+?dZi z63%BHDg?dItrtRb?0|niB_1cYSc&@k4t1jGG7VkaFFRTQPzRE@e$EP`lWGE(3vgGh zy#Q~4-?F~?VkX7X_0>pls)nI^qLT!p>F`zPz^8_{(F{{W9z|?W_k*Orns^7z>N=n~ zW7Id}Bl&v93Eqs67dU}AF2neV#Z7Z29s=Ile~|OV%e5ox^Ti#LW*)?u4>mJr_-5W= zWZij{BkRPoH_tZo)o0+xFU0;N^%Bq&Vhyfd+*)HuJ?xUos67=NtA~Iv#o{Wt-J~vN zRA>Ve1d7GKaXlm*7jyIZt%$B(zRpZM=D>O@MZ067POzvib$;%HMZ^5Oi@8XiAL%zm z(H-)A*{7&;)Gi2uoI9}(au;_qitw)>cH5B=IT^MVFU*9}SME=X#NxDqnrcQIu6+>B zr`AF?X3BPG*Yo`0%4h;uwcjQkjak$y^wfb`aeN}0Lu4^vzD+8?)!h=5LxLyGfL6Ie z-Vq0?SG0#Y1W|}KhR@9)nYbLOLi6eBx0BZAT3PpQ{YZgBi5H58f zNDo$v^*rQuBW72(0j9&;fUD;)3%b+8>(#XBj_+keZUz;{>+ci)&|W_scraVb=`cuQ zjjELna-TSWRw;yPkc;}A>ZPjJx}kr(``$pQT1=1TJT{wD^{8&%m(7)E{AgcrovL_)9pJDM!L)tXfD`V+Vwz@67zNNqFWj*w8vtI-J`ueCDP5o{@1i{cGk< zg#LdE-h9;>2OkXSdCfT9Z0QeReD}v2^2>g=OOq2*&(Ix9Vk7Zg_6y{JRXdD_g`9~? zeIy5e1C2zwf(5bKbES9%tV8yk+It!2y2VB#mr^1I+XQ1h39dPyBtfz6agRT&1g!N|_ z&f5TC#QLk;Zc=Y>ZB2s^fw;64bq3-RJ;3)6TT4B{E~VJ>#d31j2T<A^DO zNy=+fF-zv$hJzen!ssNrwqV&lpr}R(4-2Hb7%Y7A+NO=A_UQ;7pUY;aHKG*jUg=_$$7QleTv7%6MeNh(70aeI>^z9Y!`N$FA7}nT(7&FK;&lott ze4yH_Ntn|~FJqpSG${N)WrC<0jdoL~EF=>bisUb-zPK94hSXep1((q>x<=uSqN*qd+{_ zgZJ^lnF;Q?+xht)8dkTF6CHlcdR-4TRV~n5ub1QMt=Fc1!;BDZ_@%CBk<#5*{_elI zjszjWq*e>Y`$R|daO6=ZB+WOF^R+hfwe-z5ohbnGZJ+ARw-F>a-|Wz%weiXxxZL$C zv11%kmx2Ow>~#=Od?9)zbsQJhzd79P`I-ZXj=rKYr|F(Nn?n@-=?g9+e!$Od7drp# zFu6SO7aD5Mz&jgO9w3^Jv$xvE%y*ROfnSH(oa(VpK2PJx=Mqdqn~#FLU~tZ*8phrL zhOD6yGB6H|;A9t;8-I^yAJB#iv&6wroP7RCy+~EW+PpMGpX~Yus}Aq(>(%2B26H-# z*M9(-zE%4i1?qr#5>MjJ#6vC;vpC)Z$&6aQ5`wei5cK{KXx?%p3sH_NvR448Tfl)R zHiz6LFS6@MC$bb>vB>TPK#}xUADBxP*(^=MEV7Xh+g)Uf0pJK=M(w{rVCJsoHPh6N zDejUx5v@uArf+V5JsFBH?~0-j#_`B)q9F0k#3jJ%`pTBSjPi#; zPs=|Eck|R`-sDTbwHj?EukcNtVnD43Mv~6ahR$I=I-xu*L^F%d z8hBZv3z%7sAc9|RfrYJp1PP?%UpgZto1=4Ap=?4*Zh|8lstbssIim}jCp9HLZxHU$ zJPsFiux_s7Xmf78haQdJ;uKOlFuAk7+~3FLKcAke-ueXY01q@<`v0AJ>j-fAd+Mzp z!Sa8j-ipKMCc3WzNw40jK?9fBAP5QfU_o{id@)#WeF(e!-g>JM`uvA>a9C) z59>XLiy8=4yn5?{iD1YVzxM{?Y7Nj_BhTWx48Eh+$U7&445avHjY#9wTlWEB#Ck?< zH>sgqYOUxg{_|x2H|ni}C`2?(y|oka;8<3wdTS+AsOznMqLe_rbrMdN;sb}@S8sKq zsJ~rrT_~!PMBx@vDeA4y$uxdR$ zV5gMz)~#szKd!eTnAfhi@-VyF2$>l8y?Sd7*#JfzLw8F~1${2C>aAMaB$kls$i?-ue&||3x<HN~nt+xu{jF{6|yy@z#XEAx2dMg(se^0%2 zyyh}X)seg8MV2_vs<%3WX!0UE$Oy{ntC`vX$X#Tof@q-Lnq4J}g*k2ox~eIF=_}Q^ zdcHESqxQ`U#(BPJ*IQSKf_|mm$|c`P_13=La9X#cm$8L<2&}M5MhPLp-wNI|jjrhTu{kS%|;E8W@Z4A78=ceq7Y`W9Tqa z+10}v@Q-L@)XqmYH5CmE!sVB^9(63-fuBTTPo#!TU&6zB#4pcpR9w;E?z7Eog*lvk zwllz%%0M?WozCzXwP&D{I#{M=`O_o16Z+B{P0Uw&AR}rYG8h%coxP@S)hfEAs0WHa zQL6`memc6=N0$6(_7SmN5ROOc0Ak`&wBfQ8kh*8IE6oN>Up!-v?7u{=zylv=u5igi z`zyt6P--=lx|T{+6?#0DCga2ck>DFXpdJdAL11!TAoCouN=QA1F5LcczeVMa z*poQDih$c59pqO!OSOi=hK2_|n|L@t(~P+%Xcnx^J2jok!HauJC5k||ANaK6-$+|@ zv2@FlZX!GeWx9j#9`KRmLG3i{e7oC}GkMp8$y!%wuMi?YO>=7 zgnaYZN+mGDv8DC6eRnC-)^P0Ezz-e*AOz*(SG`SekUGgByjGJ45T0id290i-MqsPq zFipeMmwN!Mq&s4zt9*)b+emjEyoN><1I&Cg6W3+>!O5I!xnu;*qU+0LT+Ul%s6>ni z+PG>?q@iOgxWdAxuHbq@zFmrW9J8Lff-$FNxVi_(&1Lh{VI-oLEfx}K6qAjnhK=1I zY}i0O`17&Q7URuukCkU2jrsxz6TE(w+fC|jc#abP^gq8H#Q=%-c*rQ}_RCk%DcVj4 z;lNswgEabFYy~Cu@qHawRwY1FeLZ}9-(dLe=Mv4<{glK+nX(5o z8B3zK45FwSLvM_a-d%>?c^18D(mTeX7mgttdhZ+B3fGv&$kjfP=g6hsFeQG%ZjZN5 z+agitgEJG+0DP_w&Q7!n!0&J^bKe-Dd*(Oo6NL`!CI%~8IC``*Me)onS!yB#gl{s` zKL8D=N-ePXm+`v;xX{e&r{xfee)S;f2> zOxy%V!fPqYnD|cLGczP!{t0~$ZVR5n269OK4fY6QUpvBFl@XZ=g-S5K9=gY4nB*Ma zw)Y_zzz3*SNI>j~ZExl;v+XTe=buooJchl1dD#a$)SbYqIs$)j7ov7!6Z-H9rcrhO zP#{f?`hhHM!f@oMY$sY?2`aG#I!`~Dg(31{jYk%llavBOazw2!Ak3Dn4g&85(W3S^ z<`PDC+;%{Q_kNRz?5BSL78oxNfu14HoToIb_tR^r{O8D+{e1Te+4n!+U4}l`Prn?8 zRejHQ6;!J{-$^j{Ki`?yj$cg=cS`WDg69xcbqbT5Sfi)TQv1>Yl5*nPnvrab!60`F zeh#?Eh=gHRFFGPHb-Uq8|qnfZUwe0pkm1 zHtaL`ApGmIBaRA%{$A1anQ)`mPH)(#{d{z}8wnO-pt=w+jIa9Q>MfYlAQ=NdcNCR6 zDAWv*@yxqRg@k-V+Z*k);g2v^Vl|el+Sj9>Px`xr!dmq`t{(mS4E+zw9QqUQQ<*T? z<~!7SO_Q^78%g79{Dt4&!&fm$=Kn27Jgi|MQSmu91ql!aXeBC@bAMGTv-+F)loM$XR~<^(oZ)JXLAOcy;qmwpK0EAq$DdtIm5)KOJyVJ#sKAVYePx&cc2K-9~Q< zIC!NWfGhP=R)6ejn{|`Nby(TV!K<2SoD+Jw|C3m~^0_mo!5obGqMTxuKGLr|j z(X<&V-EQyU(K@izaJr_Q?{>p>z}?B+>LDsPmD0?4IW#)C+tz`c&DjoMji%zzo8yv; zFhcDfK!o!m2s>6lTH66}kT9`Y-Uny&Z5kBvzD1DitYxreaP)DibD8 zE`8p|h!ooar{*&y)Jx21HU~g*>67gcep-`20+4QIpJ9eY7^Tl&HH|>&(^Atg+X3GI zT1l^GS&~apu7y5L@OU1L>T=QV3#ta!Wexb@p(fb~8G1gAsJ85Qq87kWWlhDS+ zc_a-T+zwcTc^tEv?SK(#K9HM-;CqaHNyYbE(v5ul0E&Dr`5ITl2cAo|F%=@@y>p(& zi|hxy4FqK3Qu|77H>vC4I;y+O?fd;8vVHpN`vIMHy3bL5hfka(Eqre7OObti&wwQA zG{bjiAKx<%(tIE3@g3L?=mBn_qycdH)cXNDcaSG6K(ilkfN&C0FH&3|A3HI%dID(b z??GHW{k>-RxUs*hzu4Jstip=gQ1R@$cCW zs3bRfKj2nqK=lVK^*;Q|_+8_H!kL^g;Da5TR}M&#e{W*Ab@l`J?@_2tkPPvW4_;2N z>x)k6TZof-Kj3YSNUE$Gjc3`u= z64UlF`#af*O4F{NbrV+#x%`kinzH!(^c?6=wFH{>Y>MkL9dEGC#~!Hd`OUeaN9r_^ zwHx+)8GkwZ1(RW0>=)e6C3DVCaxZ%a&NIB(FW3k6lKlcEvy8}cXTM-5Y?E@oAOXI( zU(ma$4$9asV1hII1(KGI?Q8Z6+JI#SZtNE{22O1O!?ItHjlo#Y%(H3=k!HW33+??h ztY_~Ryb4KT3)-VEepvw%wST{0DI}1`3dSYOmaV=d0Zhw1gP82?bIX7q$zX87?4lgi zPiszf!1b8sp^Omzy$fz(%-qo|qxNgup}NVHoTJvCgE7&f&Peou9fuPj1jG8jU>xo^ z?6!9t8q<8eDVn|Ga4obD*m2mKti;;vgR_nQPkUD%9miGO$ChIp?8FKQU?%~_X{$_yhmb9=+rBow@J6`|i8%zWY9A z?#OlG@Eb5dooc=aIC1y~wD~ms=RI*)EUR8M_kgU@Gdm_FR;R)4IB|F!v){_QTjYtu zn;{aZ(S71@9Qq*aT%#}J*E<+v+WjgRk_MbSE}y$!^5AKA6rz@<-EZJVoH$&D6Nl#z z$WcCVnEOMV2D~_StOeQJuW%2`nfp0ld2~FzQjU(9U6e~Nz*|XmeoPa48!G20i|0T> zJ$N^CeYy`rb?)QkDrP`8cZ93B%T>i&AQw5XOsNW-H%x&E&KqtnbGVl{v@?e$7l)s+ zknbpQD4jQ~Dl_OL2FsX%=3;PZwG`o(U8=s$p==mU_!kq8$3-bVK#G3Mg&8*WISgNOILVI8?5aq{qmmtoX=-jK(zfpwGL zIsJX$`MhB>CZ@S-A@m=8-taU86^>!`OMd4KGvqNxe}{@O))$>#iCY{k{BlM4>|hf; zvc+fKX|wlRv=7-&QZ}C*tdiN+Q}z#J_QB=I?!=gam)2jTx?{mAw`Z@^y>@5Y~zA8R}O$QU}e?eP710B>l^&pX995PRS2;X&Ju-8zA; z?>KhHRNLX_=e|eE#D{YJYwi=MhdxqB#!J)6Q#6VmLTS0_LeJo&74h#V0Jl!p9k6m5 zpFE3`zvK;C0ycq5VzU%%#k-Nufi=IF{B2}^3$oB!8qtn(f7e01O)rv(50Sm4?MRp; zIzoy${B0VfuO}IQJ$D#{w_$QPMlBVd{+G9DO%&8jO1%p1h01+ZlzW~G{26pJnn`~H z;SMzA=6Ac^P#oUdcFcUHH+6{`~Ty(cuw$5 zsOI!)6qvgcIpXj2qJQuV>hWdYfrJZbK?4gKSkS=#6%7=vgq2F_Be_(+p3U`}Tej@# zyUk2mHx&~3En99f69=M+bh*nYGql7iurYGI?v<2Tu(KTGq22 z)trIEJ?qXG}n zWEO7a_6;Sn{b_Uk_V%o07P5(SOUg|5M{~o}4xI#CBPkqh5+yI3Jk4g(A<>24+iGUb zLMrKM=mq5K68J*!jSeO7FP=+}mswv}zDgCHsbVpe9o*2K9Z94yBKy+0D*A zpf$wip|vDZX|rFqa(XhC$)`=rOpojRX0kAzxAZ)Qt!Zgqu8iK3J&?_fW_2?wsRzJn zxL``o-ZDk=_F)j3dUiO|XBPbHRh+njSfP+B=ta}A&?dd9sae~THOKPsE|9pbvni_D z;;rm}IbPI~L+})dnsBN4gjFS!O4|1-3@aqakp&OH3iU_@>wV*vS@dtGTfa&IZ!0p1 zBpNJrtV$>yduaz!1^8Ck-QGMXDnP~xw3QfSJ$RYy%A48l?haj!Wj&k7$d2wxWVdYD zV+}NPTLtuz^V;LE_9oK9=Jx9<>O{9x;8G)6D73-(FPq42zz?1r>eaVy)7!gxjLxQg zaGV80Uqc>U^(ow-4nOD;Rp~L6O<8)75}j@Hwx9F-gypREy%o(6HY!x*WhZj{n2C&7 zPp3YRMqj8Vk*!OWm&a?qki(>e(MoMfVYt7?AmVDIDY&+;5xvAx7&6P-2)y3>?qjw6yURf^!>tg(YEI)AMgqsV;;3^y8&?BFysI{ z1vmlt;0SCFFg=RDg9O-tz49x7w~XU+ws?5B^*xXau;ab9od%?M;z__$e*yXE{vO+Y z0WkeRv;zkoSKo*2JK)xjK`y{sK4sev6aKTd{Vd>$FWUABoQRzId)wX$NPllU4fyO6 zw*4Sr#|-pG`LO%n18$v1d!e^0*zYZR&u(qeSoNZ-R=jT6B=mPJ@OW25YpA#FJosyu zR<~Tb>c*AJN0&`#@4Rx$^|jYtLq(~4Gky~{$nQuKjuPQ-!EX%sUMkNC2WOgv-wa;c zMe{_`@&6(GP60PSnAoM&_biTHvb5!B)#&RX(2nIoo`;dO3a>^#SfaV{lBK;w(6szU z0Io-Bo2sQo-vLdeL1=7e7km?Kqs$k=+5BN5S(cT$gCkhQ)(KwR1VqkbU>VMuTWb?;in8HSCrS zg-U#)N2~5yviQBk=|G*3$jk4p*XkM zGtis_O$WyC171EKEc1B*G$&t!hT2z+vE7WZ|2-!kYTxIneVrwpHh}Jhv!Lq*-ACX% z&eWHOK-U4EQjNay^!W*@8K$l2$T|VKI{2I)IOQXKJucfxZTKN*=0S5NUi8@I8ThLp zUc&yDKz{hLkAt=(SIPdX8Wxdo7y#>#-2vKV@N2iycvoY%{XFADA${gVD+(6znaw!aX>KT<{fTNM4Xpg#%!`8N1FU;dvG z^lgfM1su|&@Uv%2zZLWk!5=?Dj?AyUErLI}2hm>g^9`TGvyLEn7B5jp5GJyM=&o2@qd%(uaf-hz_;Na&z}Ak(2t$8 z?c4FB!&m-+rEEP?KSx1-@?UNH08J8p`h3|<{}||(&Dr*sonxj=*;^Y7u2UG$PBfV8 z^97P0>xe7g?%>}d>06F2jiEr~ZEQg#!qw=fRi1eb=!LYPfdvgLXkbAD3mRC^z=8%A zGyn}us|PO(C)E9db}py}XsJtSY_){y{sW%-kMccYGDP|`->=|%O>FWt?GnCkTrN2= znO1#+yuXU`X+2EoN(nTb^XZI;5}glFdg%`~PV%t-#9o^cwiqH!;!RpgSb~d0e^rzc zMKDo%i7TeP2_^B?9UyHxMQW7tFk5Ys_AE$r&P0i}RFv={w@CTT5-NNzKFCH%$yv=8 z%%)TyUbqtS&xR$v&G)Ka9Gi*!dp5}YSNUGGOJW!P|NpLmv8`(4xmz0Man;B$&ajtZ zp5X+;NrqDlPcWQjIKyz3;XFg_&t<*U40VQKhK&s440{>o8BQ>qWH`m}1jA{DGYn@L z&NI~T!4XQ;40VQKhK&s440{>o8BQ>qWH`m}1jA{DGYn@L&NI}yxqgN^!!W}}hH-|y z4D$>p7)~;rVt9h#G{YH&vkd1MYCT*(L!DumVI#vh!(N7Yh7$}Y8BQ@g!El=448vK5 z^9;2;Tt7pdVVGef!#KlUhIxh)3?~^*F+9O=n&Aw?S%&irHGFi6QZ+-JVVGef!#KlU zhIxh)3?-M!|9hkU<4aMhZcz7|R{PVp2jE+y(JlJgJ$-l~WLV!EsttwLM>Y+M+sONB z!l7{8brP*Acnw&kEz%xR6NH1VN?WYaxwJP`VOCS~qcg8cTcW9X(T%@IQ}d@Azf@E6 zkQ@IxP0e3!{4!0=gKqrAnwl@&c+Aeq-#9X=G(2bV#jnsNefqTutBfgMJXR+@>%=OA z6{z)yqgrUK8U|O{&sExGT8~dZS7~q1PG0Fpe|c$rm4`#O`6|4 zP=!^<(00Fiv8v&9jGNDD&ClMeu-cmT83$FGT9uW#P;E=J--r)#m9cmRgPXVZ zSvJ5-* z{@oHGo-N?=UBDCneIEV=;7QMVGZcuV^n4t6YS;XS1X}x^1lo6i_iNWP0r;N>;NOad z`0?2gfVY4rd8YqH3L>7l;qsdS^#2@yr{HelGjYGzC zgPz_YAbk9oj1^ifHu?C?(*Klx#aSId;!fcKMU9C)&mXFUG) zL;(HofcMk?r8qG0 zbpZaK0`SiPFYMpr|6dKDZ@|*cuijSRiO=jYDZlbF?`FJrei;kk^L5~Y0DPA3*<$0Q^NzvR`}O z47{KI-wq_nKXt@yKaBzOdzjwq-?9Ppe;t7TaR44$BVYNi03Jmu(hULlp#c0r;HkY~ z_Rnq1@uLdw8Ao3V;PVsU$q&qU{NZI#zMq`&0DKa7q5nftkf&IlhXUxI2cGJk_td-U za{qd-4Zybr;1dD(@c{hs0Q?icQ@bWUB^xB(nZo6YDf6cPs;-09Xeb-89;wEj)aI_e?ZcUcQA1|0K6Z6&G8DpvA?Sp z@hr8eOunP0wq-b*v{Jcjl;amEq7eZXvE4hnYDOAr!rpueWNh#1ju`bK(j^v)X-2^u zq@clqQGUDM*x#|q$mIHm)25azSVe1iU?7x496^cJ${5LXE{otH!|2Z$gXvsfB5m|r zxkAxM43B9lP^&-G5Z)N}Co%>Q6=Ea`g~Ygln8m_4VjK{%WAqPaGUF)XxHBkz#6@Zt zExVgKV@9m2*)Txd+O@}swK1}-c{f#A%o#FpP!m;Yf{SJ}-`v&I*&YQ&PiIsyXzkdw zqp8E#)zZ=(>oIzoc67wRc7Io-PR3lQ5Q*lR*a+}Fdm{}#5f{e($`X-?2r4ZMC!w9# zNGwv988;j#jlyY+mJ|XXMTIraAdk8hgndwVQl|&?C%W3vpZlrnH_A|_NTkagZ7Jk3 z6#W#7cXb<^+Kah#!ZKs=ok`qAYC#}rd&cu-EJY%q{N~tL(#(@-Z5DWna*Kh!UIcf- zgbc1hm=GH6qm4)yN}~W21fHBz6JmSgMzlTN7Taw^d-fSwbJVXVNb+-HD_f=%5UJ}K zD&$5>?R2-UtWS?HB7Ds#B9KX1fvdMjOzNmeI9>|HZ6|d$sDX%DB1X-oE)3aRemv2a zHp`Sfg+$6Kws+SUP%7J5R~k_4IPrf(RGrW z>^fNT#+spbeq3~6!Dw2c1Lpjou~#zml5bob5io?S-9%p@~; z(j6JDlr6Hc+q7Kqz_FCe{Cqoz;?dxdqy=}U2D1qZ!JfiUT(P3J5R_`<6a5stMKx7e zQoRTq7w)Xm&4szsSeSP5zvdWxW^yb+-c-c$H8!?(wC{)-HKCeNJ?p(@Z$qS^Rm=w% zB#0fyq=A@P;d~lW9O117VJw~zN^p%LVK7SIjXN;+n1#CLgq4W7%-A)Fi7r=MBjHxl ziVhc0u_c<CF@ZAmhR z>nxZs0wG#_XY6LosE8qyT{t+LDD-3QPn(IN+1MD}x36hOyAcW1mb-Ct6qyBbETWr? zM6qZVEQ2CbD>`1SNj9}4Xqp=rUe9l2$-&q%f+?-r2%6B~0!!l?9us$R+Ued1pVrkK zH826y7@JEYTn$*yT)l~n_nZciGCZfxRnFKoG1iOFZ}+s}o)keIiL{B28+0cT2rJll zJ%Uvb(|*P1l-;>|w_(!UYaoOeUIU@+1|W_uNg3gzIc}%(`Oac+`3}Q1mm(49wC#;z}c2B+^?wT#O(%K@M;)R@*v#_vHLP%8!WwU3Y9xAru zs~-vSQo$ZZI6l-ima@v?u-mItz34r3iq{095%($#viIz*bj>tzV`BCw9!PYvdsaHj z&LFQ`+ng%qb461+XLh|_0V6fhf{A8Ivkmat!n^H6Q8`LCw-G%j3ls!^tvs@z6T2Oj0sn?2myVAnqXL2+yKT~ou zb;8Xwk(+UQ8CruxHb?0rF>*b>!yHPCq~zK-QrDg8H)EKtl9pIB$H~WSj;iHFOqj02 zJFCX{dUKvFpk!VW)nY~D_BNX!2n^DK`=ezgNn3K8-SvhXDPqAzp3+a_fv&^h@qETr z4Md5iF&}hczvh<7u>otPZh#^15;mx4s8@@)M za>-cSjwgo6A)m_|R?f&I3I|00devQ;a%k}_SD(E2hR!PI99pWolvzt%-IRv;nEmmb zSiZGqUHXls;-XC19Yi8~Kv-KNj~K`(OPfZA#ZoQ-uTwdX-i4{T4EBsV zAUSycc6YN{!Zh#%?w(P|KX~R8KZm5IYK-$uL_TO1BK0@~6z7}SqL`!HtLxi@VbHET zQqv%IT?%mCalVvrb1rK@WVM8K$`*5n@K5U@=aIAm6u-s&(z3<-ic?^qTh>ZId+WEp)yI1Qm>2rYR5DBb&;HP->lyb5NKGEycv99&6#j zOfE|cVw|fOa+kwL%f6j=e)5vlss}eNn`ISy_USbdEcsl+Q7)myqXExi_I#|8rfIbT zs@&7mi7iEWLn9CV=-v?9c|6^+#+xjhhV%{Nq*nNeii3~yomn9oZIo+za$?0QKA?$l zuZ4=^87t8TXcZ(JQdilWWrhZ`!y);pGizK6l~8@dsdWGPRKF$&h7!dgE!01r1v3e) zg3Q6nsE8*mt{Ve+IGsyS0lvzoEiIIy)mjLbp}`zq6wRa-qJ5wi!oh3`)HxiBB(#t@ z#Lv)%`oT@zNgncHnk=ENsT5TT2139@CI!x@hw1}HFzqWAwGbZfWpKDEA7B2_|I-`t zcqJ0=UdyE7GZfSruK-?4bfpmPoaI#h>c&qX%Zbd;Azp3h1$`p4)vM*;+awyzAxNw$N@iGdEZ>lL`K=q7X zL3+KySzg7}D5&TZ3w5vHUwO)__!|Z3eQIY?JxWQ zz)?-)11PEYao2MBxTpQ9oTS#Y7jZ!*qROi{r?GXi;5?V7@k>dSSM9nVIA{GT9%?8g z3x15ti^7ibiqHRe%9rA%!m?nS5{wzBatba58Br>-UVd+=w^o+#<#Gz>>Vn}4kP$Cc zUd7!^bNL|;y{cECDb9*&3M&LdRsMPpUP>j)P!`=Q+jWx8bNw@TFOSk&@T? k4G$$dE=y^e0*{a;JPu6NuL$uvrf>Pieo5&KtMiusU-vRW=Kufz diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/obj.target/sshcrypto/src/binding.o deleted file mode 100644 index 40763c9af86b7189cd2f2db7fbff4b5737c2b093..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 145496 zcmeF434B!5`S%BcLPZ^{R?)T^5EZQ=VaEjt5SVB{l*Qc;LV##UFbje!n2cqN0j;9d zw(eGKZLO_Zw4x}=(oL5U+yQ9JNI{=`<&-I z=Q+>w+;h&ob74u@=#Cva6vXV-AvP@5!5v`#Y(dBHXt?<{JodZTQ-*ek9P2fQ%jXFD z{V3TFx8Fy|ex&_AO7A?KBrjhc-c>o z&#Ce`&0>>fe}a6b$frU+D%XkfIY~aJ%copEicOVIrF?4SGfO^-O_NWRe9n?jy?hj# zA)lG{`x&x7(|)g${cQWaN%nK>_j$5E$9_Lw_7~Xi^JTxles7U|(tf{K_TRMMFOhw# z{oW?~MfUq;vcKGZze4s`+V5A({@eEZHL}0fe*d2AuanR9^0`4iT92FMbBla#mCyI( zqu6cox!r#MvFz`%-+v{%}$v_0QtT#gmFBPDrFaN;JRL zx2$#Wv_xyC{dx;oB31Hi(el#P3kt`!)fOgN$E=V4e0bN?qlXlBip84W?-0LObufLw zhuu2GTU2#rsW%@|^{kbTT)oQd_4?A(W4V{l8EY-5##sveX+P zzjZ&J9^Yq_o}aN#=KRa(`ru>C^i-Uh#c~$3p#_pc*P`n>D|9Vp&_&4MtN7 zUQ_d-rdAg%H(aDDrKy#P)Jk)tReR5Td#IyaAUY|vYO%zx2xTIbJkbeJ)@r_&S*o(s zddI3PrL^uc$7XDDeZ1wyUc$O{pwWUWPTRp;{iwO*j9Bsg3Y8QsKOR?P}~cy^k&3nO0zEnIZz~`kf;SYQ&o4be9jx zQvXV%UdYJv3Y+?~@0$CI?2)c1W@!6Ho~|h!vuKSN{plaBU+;QSv}*=_)zmA0_b5KG z_$1MQ>6-WMZTvu4+r3jw4fd*(b z#G=^e-(SBz(b}fnA<=58CzZ3p(^pawbJ|$5ZJCU}JgM9@$yAZfxaNDqu4W66KBkaZ zfc5_tuu|K?gMeZWLY>&-OoK&TD&@>?H%`Ep)az*EX{UfepUd`S=kKXavYl}#Y;_aW zM6^&9(xvr#rqw+Wkk^O-=r!Wdw7(fmNXw}?C0d87U+W>%umKZe6Pg_v_oio@rbERC zm!~>F&(vU!=kbV{9eImmPjqhsKhBrYZSfh`T%>1<)|??G`C*vENLLga9`YZj zk4W|c7wJ>=$`emcB;Sp<3=mK+kaNR;I&=1 zqA&Pjq;Vg7Ibt0M;hUVs?e=Cn(>Ra0Ah({k%a%1+RwDPsXtImDZG|SQc)guX#-u7= z=G}LzG+1^x>$J1h_)|}8+oTv1*guzv?Ey|YU$zw_w%t@$U*N=(l`-WiYBMtg$Un6>TnjGkbIG2DYiJ~5Ma zH(3zOvVG&XyL=|T@e${JK9|1n-{KUECHp#T;2Zy}zT*q*8xQUpvHwl;jkx2NDGR;n zANkLX`$mtsBX?W2!~f1ZRs?0YyQ^i5X@4=iW9^qB*3lmCc;MgL=^ZzgH$Exp-In{t zFH|`DOQ)^SU~^w;XM^Q;rKPFIPds^S^7VMjD-w8I&SS^cbw==waHKVu25|Gl;Y>^G zAvz>n9KWw5rqgei$&_hXFtKVI?-eOS22$-&Fl%ir!$ILNp-ff@tsyib-MPID1EsCQ z+*DiW0!vrPSyiZ={S5^zO>N)4k^_0h>ImmlSF$m4xi5-NvpsG`osV&3M)FmeTDmE{ zx64wm<{4j>$@$gcWW8Q*8VvL;z_dG;M# zyk+8hVwu4NfhD|G8!KD7faifi8sBFl{MO3&)F$#gnd6TYtBXgd!esaCWlk`*>3);~2-DTF*ozHiD*N?K!=g3#IE^|J+ zUdDRTH)Nj==UklpALD$!^51+d!#^;-rRfdn@ew)e>SO5hwby<^l!XUopWew_oLA3F zMb8<2!PuNB&&nL6a=eE!5@DKUyqZIxjpMH*bE35pR{`(-#2libc9?S3N zc7#96=-c^C>rZEU{OO7Gr*R2FK{-LWS4mItmwUaO^_JJwopf?ofADYVn&u+oe$Dzg zU4PinSkYKrSvaSzdRk#^-L$I14m)=08C8{yC)8KWKJ2g)sw&PLSy59nwW9LO-j#K= z4UL6!hGfH~wbSd4h+a8t{{w?!Vu#MGn^kq_oVuF2Y4c{yt3R|)Wku!8szddHLuSmI zeQ42uK1Boj6dhV!TUpaIEjVG$me(0M%Fh--`pk^!?vP>iRnr^F3y(aqu&-qw?!xtc z6J;G_7g;UXrMPueuP({uO$V2@p4Y3J=4?Bg`j@U6)l0^=Wa({dr(U`ysdac4S(4bL z_|((ZznEx~`}kPwfqC-JC0cEn1zfV;wYt8ssiMZGut~KdV($ZEJ!V(cH&iz?R@FB4 zKCn+|L&>b!jq~#0s$hYGdJRLhY<)gSv|iXvmU*i9)$#krbZvgI^AQ~zk7^w)Rl8u% z=CvJCqq{VAJZ(jy)nr^nYfejR1zbI9^Vh?jp0(lAx=1*$7B;Gf zY0my99+b!WC)KLe^;U~7tE;T2IYPe$-DB8+g{Pcd-8i#wV&Rd6#U&HQj2t_%diKn! zdKFu@nH9CuYN`$yR$ALwRbN|CGrGE}X4=TQCbfq`ZRj2W1#Ba@(EfMzD>n9=Xzg6q zS~xcOkH$G-v8GazIWI~IacS#ry%Mb>g2la$xW&D5I!|BlLAOp#L&{pG?x7u^yIN59 zpabY(@J+fxcP-G`|BB2SS}CR|$hu|q@498KRkYvbX%%<6DF10et)JNndLC6(nWbrA zF55PJ8F!gwmt(4GtLm#Ovkfy)7xXnDG_H7y8WasoSKM#dz{Vt6Pu@d1n6aiPB zsnKn)feO(;#_BTvoPNG2@~C2r6UiiTT6;Hlzj=C7ui^|_naH-K`r4}U4H1Dn@_GGP zZ?%@t0rw7i(W;TXwQ}O0jqbwJh3<5rJv}7LKWq7VQQs_7wdV9~QmTw=?2*-Jcg^aw z_I}ysTgpQ>r*Ch4HX`tb-FJS;&ow#A$;PfPV+GJUq z6!8*LP?l%hx^|RFl{5Nc|7*Yfd`9ltVhR3QJg(|a!_LF%&cfo7RLrQRg5dT(-ZH!(+e7Ul z#~u&W)!gF8lV{1Zsb#Ha$X!@L>+EhaWw_`G!*gyI!(3-Vp9>0UO>|4Hi7)Oe^P-7X z`J3A%v0&8=a?TK%$9xM~$9GHqF249w1bhm4a?E2GM!Qk10rQ8x6&cygwcZ|jW*gX76UVU}3%*mAkT zPCsUz56&a6R4jRbur;i#5F(nJ4R&=h`}>7XpMK4rJC*rlGk3b!36$1H!Grq@QBL|x za*>^HRAr_AkePp+9)ELrS=*0v3^{(F8LF4vl;CK#*_F(f$Dc2g&kgeVi9QN#Bza)I z6oI*H1Dby#xSO>#$I>2VZ)L|df!vL!+siO%9W3KYUnhcMJb5FW^J=B(rbKF4Z>fnX zL>^(&@9Wy!_ETMjvjxlB%sVm?vUe+^!OJ#X^*c*kDsJnM@-bHM|*s^0ScPucIyyde7!ly z>C8%Z4e2_IvyqNgCX7nq7{t!IN#m=3(C+1yO$5U=SU#crZc%>nAYAH^#3Sh;iAP>7 zOr+Z0l7=(L+TIJ7ysrn3r27`99xF{f;n=D33cS-z`GpmOSgThGUErb4$WNyovuKSj zA72r_FR3LLy(?W){g3R1%Wh%v2tBwjsgjIZxa>$dDr;M&r$#Njb(lH2Rp}QdkCOjm zQ!m;cF7HC-MsU38OnU6tHXzNv8-t*f_d`Hy%KmB1EdFO=N|T!XpVx`ptmF9Vu? z!Q;A_W9Js^A{tp^5iX0-)fD};4eeu)Vph(hI6WIaku@Ka^^ygTsjXVStIIy@{8Mh6 zP``U)_~L=UHeeX01SjN%{BGk^Lz8UzgJS zdZlT7d7;8TN{ZI6GSwlJPNSPVwrv7shg^sd;N5w)z3JP@nvOtS6R8i_>y^E)UenTYl|n- zDoV<_d(pe-Rey7eZ>f{h&C8Tn zUXAlFVP?+2o0?;{K5#=mF5YsGRLx$F*A8F}aKss>R22&zTP>x+8H<0+7rvACJLhIA zXZ$djZ<>tPOMQ)u=5;zj{%f3qWb|#LUn@)fO|tq?sbqK2h@lg|(==9`f~sg#tHH~L zip72+Qfq@~cIedE*sHj0+*^u1pi%Q7{g>$QoZ}O3c~|Oi*;WslVdOIfIX!rS=0hq| zYE^oIh~na&a8pYoT!K}$(KqmDMUEL5`iC;gs&NO1K}IVVa* zTIVmb&l}qGL2~s*9F#llac@RCsO3h|y`qUw-uzb$eUtLv7G)95 ze>Kd6`EO@!mAv_{xp`lFQ6Pj#h>(O!19#CY!#w%u{B-gAOorXsW~fsuid#qbmL#`W zu3Z?sU**0fDuSfCBV>2rBMX;|lznmQM3($KUhT4@+6uS%B!k^97H_Ra3M$;XOX$~XT}9zQ22mmHD#%nGiR>R z!dsWA{K`mj9SNS9)92U=C4o3xmNaKhRLF@|Q%dpB(Y@ozQ$(8d`NCcEJ&*rt<1IHyApw_7OSqe~=@yu~d-(Wp+#$g{xO{6!m^|Io&FIt!D!xVan;tFy zOu1Q27POUZxKP0@w~Kh*qP|?NwcVw3=&E?jOVYH?e|xl%H3H=FPkVRgG@`F6G?%B(Hw@>? zvEBpZ=~}}?f(>-7edM%WnA5ekmlNn(EqV*weuqr9+<05y?y^pA zr~2EXp&!F8I+Sx})x3sS%%%NzT;BbhN;-q^FW^}^m7NaVg~T%mj1NBdICcO`6SKh#=@@74&@ z-Z7W(X`P^KDKayat^x$`sxiHd=2|Z_6CJ@+x|}X_rwi?AOr@8u8Z*SAm`WE^(=F+u zqGefodbkYuNoA6ENR@1JXtCNF+7RKi{--HRrd&H0XUg5xX{4J<5iAaRC?UeShqKIi z@2yAh5L4*NLp?jk^{CiSz#%j8?J~i2O_@C0(CDbsp_y1{Zspo{x6>n2Y#4l8v8JfV z9odm;<~es{&QE3Cm!lMt>%vk8jsts zfjw?cZ|JVda!BtYp~K`kTgtHMt~|GB>#n^_dc^uC(+P1yf!(TSFrKSS=fmDG#hN7G z7?UbkuhRT}H#;~5uLEfh2FGR`$#66Oq!@7$@&uq; zT`A7RczDUET~-t>4G)Hj#qkD1J-+`Uyv~PZ8wUBRFd>k$u zj4Cyf*q|uk5pmIYL=zx`xaj4LMA%7@ac(<(R;zC%EA?ciAs* z;fP;&%V(O${1X+4qB6&Bn81IVs54^rQjGWonn_=Jat+Zq75UOh2E=&-MN? zX6|a{O9`@`LEBcwJ6|{J8MOIh=?63X!}Sb7nPUEO{cb$JOs!p;U#I)p?ma?|>~N+` zsTw_*` zyElv2bakArg?mwKF0Z=}Le85;C!u)iZ=%GvIR6y^N zITcs}$S~=g5>7pRj{f~E-Q3B+=QBuBAW`* z-cj6e6`biufjh_vHGyODECNV%(&k!aE={ixNjDHzDqM$^!B5kZGqK-XzbPT5=`?XN zs%>+H%z^0lbqTH`Xg~ADo2?2qDOP=7Ep@?T+S{{Y)$qXfbRFC!5_;@9IL)QfH@Rb) zXZj}wm3W&Sw{{gcGoG8iShN@3A4(h=mwjybf7xIX*VN>~xTY$KrJpvX%vWo&ajjeW z^gtf9L$1S1v>C%Q-O!k}QHzOWi=>3+Wonj%@#KS2by?XqL{_#96-yL0!}Ba_dq_++ zXf7R+8!HTiu&*rI>Tag7GrarBsn(?SJ|)n}Ku!BhT{1*F+3O|RYF{wRZ0=nx*BBCc zD~*0PqW)bfCkCRu-YlXq1iD15RK=DmyXAgsx!h0Q4iQh@E|)5W#B$>dQf6whb%|;+ z5Jjmj(gG?2RUK}`jJG^3;u(tElx-6NeDWS;nQP$b?+QNsvVd{>?K__QnuwQvK$u}% z*VExQnAjz|3Xk;hu3_6(*;O(Sn%-G>++V0hnX}k$h+FKpXE0OT*Dm%O9=7Dqv^pQj z8?3_d*RX}``pI;;Tx;mv&7f!1p*yX!OnJsqqglfA>Uw#vOYrnd^qgi5X7l6+T{fN{ zO!!iEe$Y#fHefI;&F9X%*k*u}hLHarIz#~O`4xwR0t@xJucuoB<$lBvN2WU}VJ zHK;?L{6&4uCf%;~Ru<9Q)nI*t&0jKWnWDF=!CL-j@+TZpCG$u?IFsyI|Ec+a%_xH9 z{91T+f)Fm|S5f5DlwdbocE$5$p|VX@Y|_z^6oHz}vR_%*xmxOH8mwJ?z9lWqYA#l+o}6xCyiEXMH07u$+d5~PJ&dXJ-VfbWF2=;cZeMS(!8`$ z^kKYQ@!_N8slpkeqvo}p5|wWiANY8p!(Y?d%t2ht&MTk)z~On89U8qwmmNMToHQM> zBOH;m?G|^o^z*kH+H1y}J7H+MY2Mgw=HCU^RipK1@1x*2yFq;A1d%z(Y7Zf{9bgsaLPkGHH71-tyJ zUHMRNVUXTY$~N~uZh7b0raL!P$ES-#ejN{YXY=Z~r<`qF0u^WU*x6o4{i*`=5tGc~ zw5AlV2z zu6;?KDL$Ib*{7MKaAU=ccFeE4@%~|v_1p1{uit)80&jMHS7H(cL0 zY-R*GkMTuVI<0x&Vdm8xVFq)A5X&jOCP-((lrWgj2x2?xEoqi1EgUDZ>)WIHG0Pp? zW0gP4uNymEpzg>%W|MZ0*%(t3f7Nn>Xif>_cYxd4R9fk&!SgjC$@xMOK3UU64%**M zT4su*=JIqu#dicnZAq5%xQWrZPiXu|aExbUV$MkZ8O8%K0zdzDg<<_6e z+XLP=&j-rWM&aX)P2(iC=^aZ+N}e%zKc4JwgJSS7(JrRR+tkcWog_nQ`dVOvVtfYD zNZL!z2jy%@=Cm2JS>X_4c#TX7#9N**1{4f2;-P#AP)5}Bc@jzjIYa&S3-r0t^!soe z%uM#Ae9Xq?KcEW_R!r)zyg|!v4stnz@irT{to76ac$b`mvc?y!> zBQNrtTv5|hHSEBgC;MgLcMeuPC)TIWq5P|@s6A9Z@@85Is)a`!Sy(!5V)@wO6Xivh z_2q><^bNIc)wsMKv{2p;nkA~6iK(uwZY;z!jH!eE^NhEwm5}0@kFk%>|6BS;qP3e@ z(zoEz8-!J&^~;IWGtDm-B$_{wbZLYkIDY-~=5x9p75}F8r{)hN)cw-n*>{I61NBbQ zO^KYS@ho?MLc{C#%qbT`jtU6NT4&081Rhrz^e#q>RibA%*{w?UmHz_ENZB&IL5NzX z`N@SVM4-T)?4Z2Ns=KLUjlbHV^hr%OX5UseyhEb$gTw+cyY&~wzxj8Wh?0Yt2ot}! zlMu@DO|C3?JW9R_3$a@jKxU!i$yY=mXR7nG3ifRwSf&`-dmwR8o%YQqKj6X_s^uJk z?M7L@%dS*x)8_g0XS$9#Ede>ZHZqSbt;Z-H_N}AzfiP_^-*+W$FR+#zn z3EvW9nAlfAyzA^b5JsM#l~umM`yE2WekqBSt|~F>E3+Ob__|5uqz7wSc7CQYWU;VY z*)M2jWxqD4Te)I5Z{)^FYVBkU^bv2-5mtL?*jJrVOWaUfDjT{!o;+1_l-^yEvM_!G z<5JzycL<5(6Y4wCE6w-$B397GI`33$EID($L)LM(w9Z;EANg)@90;`q{WUpW!(G<> zph#!fO2yQA(|t_14f^Ajm-nKuT=#9KAANpWmPiOzwB{ihK@YU7F7R@xpq{m&v>DU? zc4Fuwjk_wG`mH&kl)4s5A^Guh?MC{-2_1%V#&2etMp|wUs1toie!*2V-KNwbmmZeF zz8+e7S!U(>`MPqwOp0-BF2yc7Cpea|5_^eZC4$Jxb?I)ImFp#$mFw>3=BV z?6*$ApRQBnIknJnRqxBOBVG=J2&@qD9}jdVE|lAI!fha!_Hsf>6Bq2wJqOLU*Qb}+w!e9 zyQR0~Tc+!5%eNx=#y+#2zeW@j^$O$n}pA)vO|3)v9$j@`Q>W) z?duJX=Z(~1pAC)Yeaj5dh2we6a%jf$^gT*;6ghmWV#}=tv`d`lnuCA{(?&X;_ZxF+ z*Vd!EHGd#0m`*o`9nB5Yb~i|sbPOl8G8|J}X=E5KV~TTiO!4PNhEDNC&zS4Z(G@3! z#w{xEle*~jD#Ld1#lQB;uppqbulp=8M=~xTPf0I$%*fD|{E7b3WZRFX$Zl2g2Kg_d z=}@%(xSH&4mz^nAZgkwpq5OzayhWcPFels{C2qU)6&ErF)aXu)YCCUuhtkUR;kaV+ zPEv*&S3F9@vYbqD!3a{kN!5B?ov6jWrpMYr3?ORmP92lkQ>}g$yWOh znRXLyvqh;ZZ*W=>x?qCSa(lzQQ&~Y-Nb3zyfY$G2XJTfck(WMi*reeYq?R zFoTRw%V|58rI-vWJ{jy@40dk?yO@rE9GL7D>_}s{x+f4qMu>D&#y!Dp zN0!{+hm44rXLQ}O+9jqfqr)r7=`uzYJ~S;1&C5)r`8StwhR4RoFV!43Z~QW>xf{Q{ zzf0I{LywW^HOq{V9llKan|&RMjI@|$J$#w^oW|)!h3m@0_08IC+c`fVwK3e_yqqWo zkG!U&hlsB8v=UK#^8=5nQRICtTNhGc9d+Pt+9h{V2bN?#WXdSS3TnQm`^XtLo*B+> zrcB9VDQ_EuD%SAD?wxnBFOJ{EYTx9VZvp-TX%H^hkFc1_ne6 zS8qm&(&pELF=H_*7aW7;@=v$@LMr8ri)U)Aa&hsiGUsBs8Q1K5-2p-rw5^$T%8rXJ z_$|?XmNLOEh>PhFPQM!e(;eT}y3dymq7#ei|I#{&t?Sjc+-?@iaAx{Q857=0{b7jm z(>DRxsnGP*Vn{L#r*%xf9eh_8lKzeS2&|4b7e6cm=2m$!j-S+66;I9+g@&WiGA3_g zPTpbuog@G$r3~|H{IbLRVbn3h{EthyN|QArFSA@NFPb@{Wg13}DqXw1<3y4mUg*5# zg~FwENf4*+)i`V>5_QR{wu!mkJcBYpj-<3ggA}Jqddo7VgpkYEgC)Y7oX))Y#>^l5 zQ$%o%PUjEq3y!z?{DE=i*)PCJ1ioEAo7(B>!jG5`Z{y<%W<5qQa zF$Z!S=1n2pY35Wo-tdOu9&tA z9_6PS8qnEsiE{%&6T|+u;}UyF<{#!?zv$vph+r7R#qp=N&bY)9(*WWwws>4(dlA${ z`@m9URA`P<>gJ3~?BRUh!$YL!8`H`=E>XO)r0<3XCAKfN0~hhdf3?*Vi_Q8$933B7 z>5}Hm;E3MonQ~2_dsKh@re(P<5QwFoijP{IY75hJ$CFyK+OIHOWzXC3mJ1EL;akB@yX)P;Z!kV`w%*jV-g~>miS%)D`{Kq* z+?Yjld_;p;Jo$@F9v>N-86VLAXU9jvuw=$Zz9JTwcYLH!E|z;MjkDHfb;WSJWsqxc zj*mPcHECVaTWIBF9vY}U<0I;q!toI;R>w$M&0K~Kk?2ETa&hs(lD^iYf@P5Vb&kbj z^7}bDWYhfqcJY?i47-=jjN`$Nz&7mSs}swEo+gBP^r; z2O}&DyJm!Cmz)t6+u^f^S;Zq5{QkV&&JM0ry76)s*z=9AOqH(M?jp90uSnDgv>i`I z$5##x$5(#%u6q95@s-~SZpT-KZvF9@B(;LVlHeLZbP#xrx-hbEQKhQcLs|9{H9=NWU?2_y>u{O|+dh zU$cm|^KVF`UNC(?A21A7kLyc9V-l@hT4B40-lR!O&J^|m(rUh!<<5HG?Va+~u`$mk z{Y6-tSFGEjL>A4xInU%o}Nj#bWlS2V>LgtEyu1gqu9zX3vbNs;#Q8uCzy) z3rE=zwU`W2>91zHeOXnlWe`$W7U8kIVubmDZg~o?p}z9asnxa9L@eY$_bur+=TmhZGHNGKWPM^y}NF z?|=gXI4DRmnwUO5BI5$FG2+T+b!6|I-GNStb_b0@>h54+~qRqYI@Dr z>^Z$ww?g^oS_0js>%WqnyItII-%9pu6hU1Pljo~Y+!`>y^oG)M2W{S+lA z?s~NDO1c_e=jnOb68g{aDsC<)4@eEK8}yuPWAqH|KbgSDA)k?# z7BqM2c&>6fTFO(pX_oG6(n&o#nu;d6Y9*BJ(oLW%6uNsX-FWgFA@UasBf*r{vzBHt zX|&9yKr&aR8iZ~eqAQg1y)E4WC3ZT~GV6mfl|~g%zf zo?3_VHj&pY8{uW_-_m?X_fD?R{tJe5P~oHl94x2bv9zbjJ$Fc3y0~Cbr?%}b-M+bV z!SaquJw~cx=zDdNFR~r3d&isfKQi2<_XqS7E&UID{EG^d|7b_wV(Ish(e1qauQ&7w zM}N;|(*MKK->Z%+pZuc@e{~P0zPnk6x6UU|$4;)P4gDxff3J)Z=H-8Pc6}Qy{dau& z+1v0hcJka}>1X=*?{3;Fl>hgeN#9B3knOCv{L81G>DycD3G_3-(x0h8A|L&`+4R#a z{ax%c31@E!F}ShDfR2$0t9@Q+>GwJS{6`1$qc7dQL@p@W$6Aoaug5ICinFmzMd%cJ z+bkB1(iX%9L?Lrr5F6yd2YYb6_s!i3VncI5K?-7rdGNzM_>mrbmpX|X;_28#_@F^aAst2Fu!KZuh86LdagP-BS zYdmV&`WA_NX9sp$DJu!7uXQ%^tkPgJ0~y7kcoN2fxIFU+TfzJh;hHbIujSF3Z6b zD2RQ_gJ0pnmw522Jowcf++?>o=L%xq$-xvT2=0_}&K1PImxBfL*L(0AJ@`!?{ALe+ zs|UZ$gWuu7e~^QpCP>Fv26r)Advu4`gCYI!@SE!AP8?;v7Q}v>Il#Aq*iUej`C1Uu zp9Id`3S#%Nbb(p!RuFqQ7Zju*w%mh1;=v#F;43`% zV;=l*55CfaukzsTESb2p0XBLk} z&igHXL4-cAsG$*5a%Y1KjZKN130fpKFa52dJ2FBYi<$e}*s$24ku%Sl<6*Jx5&SO} zkHE3N86Y<=eZ}CTqvWyI3^FDMf7{ZZ7&-HvIX*gq#$x|9NN(O(&_Pd3&!PX4!K-ud zxWS{X5{rGs;JNvUJ`WJflb`gk^t(q&IKbe!`N<&$pBtf$#q>31vDn$MJtAj@8ay`- zIm+O8fTBQI3V-&1dI2JoX{T{jKwa>>0gxw4|*#vskZc^ z2+DVT@tORVN(7C?nhYNFZk{~X;Fl6I-xpZCFmmRb7T5buZfyq7%}?~@A?iK8Mq>GX zjlpyClj|)WZLeDmzQl}mlGP6lepT!Mg7W=tiys@oe{T6i;Mg)tAFbC4i%03#SUj3R zKVk8cA{YF@;=?2O^9Ik&i(az$aS{4gEFRV8>lPmzq5rqV&y3(7SUj5ft~dC1Bh)f} z-ch0NFcgIIa`65Ey{sK&S-WO&=kbJoJ%Z7L2OqK9`#C& zPc-T{JQ_6}9`&jYk7g$hk7j`m-z)eM`CkzGY6NlgQE%n&uY2gD-oerDzgGaM)$LC-V{UIK_j|Y!tw~l{b4}Fmb zk7hrPPyZbH!Qzs7#)gEr^T-!_@IM$l6GdF+x`((hcds2XlP`yO@KO(cg5W)4M};h0 zq-^xiKVs-dg!Bpf?av z{B;lhiQqjkj{O^3lVS-8`Q)kc;OBVoMIL;m;5{)O?#k^dA*UzCy@UI%SnOEA^U0$R z9QDL__}Nze2Elt^{KV=1Vh{ay4Ssysj*ibghR@OvcYM}(=wCAU#E^cx{q~{Y`Q+~? zp|mH);ax`lRl$42GUGF@+#(PC(FQ*;EZ6a=FnsO_amT00Lw~8kPY&r9*l#x({L~!$ z0fV0&;@8-3PZ@kl4*sgar-t|{`)zwk9eN;Jb#m?_cs{)y;=zv;yk{(z|49a)mQ!wn z;5{(@=E}XqLw}3GXM}v5eZFe&GeX?Vx64s~Nqu_8YC`;J`|VhR*M+#Fzslfeg}9^t ziNP~>FJ|6csMZUfPd__KYLySyN$-4ky$8R+ga6cnKkC6>@ZbfK>gAJXqz9kl!CO4| z)gJsd5B`h?-%(P}d~){k;KKy(iFp>Yc0t-}p@;rP5B|6Z|GmwO2fUy^1{eksdrDc+XgiV;?hX zIOOOu5B*gh{D&U=ArJl=5B{PD|G%RKlQ9{fa4UXc{~o-r4VV=Se@W*oKZ!!4eIry^%e>4Z*RfbeG8Hu>~(muN_<)YMF^s66w8`ij}|g3XfSj~Ul*&X9h6qvuO&r`MH^n^06f z(EOrLNl8hpyuNBibwguSeR<~5fbx^e2A9vOo7PlQ73)(ra?n8Ye~|e<*!&-2{twmv zgZrBQMdp7$^S{6OKfwGq*BTN-VF=85!_J%y2$kBfHC&5=OUyMz=At5VRgobsGS?Lu z7DeWwA|qFkxwfCVwqH=5xvHPx(9c}k&s^2daOh{Q?Psp-XRhsUuI+EG?H>qhIP^F4 z{SAlyhC_dIRe!^wzqxjRp&Vdn1{j(FhT8zcXMo{3z|apc*A573Z>}9^Xa*YkfrfIR z;Wp548))bU8lD5qRRay5f#%vl=Bh!4a*(-dkl`?>U(A|IQQz@Z^$pt0wT-1}8bh3A zl&CfI8$3>IsBZSWim5eK8On+E71fOmr4#yKn_a%Nu#~Hs-)dwe?lg1MvbjL&jE| zS)~#PgYk35kDepGWkPu#q2`E@;$(2+G&74^2DyjP40T4Cbk zTpP?^#3-w0smP$fUi>XqdUjpE76D`%b=HdA)j8ZcU(BU9s0bM*Om5gI<; zNMm(SG$gC?BkSa;A!+cE$>YmMmX1%99A7?i;)xO!8mbzjpm~5TsG4Qge~49RaZUA% z+Nx>e>x`yUJ6WX!DlUpRgLc)VDBD47J`a6`wW*`4PPTeOGs}jxNwX1WUeQ`*7(}XT zSVS<#B-gF>HN9|J&GYMztENXH*ja#FczPqpK*qq5sK&sAY%a$`qWSk5VL(e1KFVqyOx-N+RdW3C<>HLWXI0dnsV!i- z%AgTV)2CO}tA}kUtreG9TUk}2k#AsGU1dd0G|A1rYLGlfJEL*tCesfXRnb`Cr&g1* zwVO11nz;Cwiafh+c6no6D7A>@ynIn#i9jQp>gy#N3qx&ItQc8j;)A=ugg0R@DEOhy zqM~tCXRC|V-|oyN9Dhuu#^C-!5YUcu)<&1xv#>gi^ z!EAj-S4;M#6%wUJLQ=bmGeO-c$sAbqnD3@EQ&b-Bs-0ys?V$GTSw?f(KPt^b{!{0f z*G@)iEgCm;HXyk}>nxnOk&CM5l-nPl54wm;wfaq{YRpcvN^2uY)_9k&YDX9nB>wUn z8Jfg){w2`qB*X`2(fF zjQgu?FiB^&3p~Tu&V#KGn7sQ)vzfET*wNZK-VO$8F6PqPtS9O)DHJl!LLVa~( zRi5}(Sv|hG+VrW4s)q8SenZM_9uh{U}*%j0D-5I7; zBaP7>l|_7Adst+&KD4x9L|vVP;MyS0WzH1!vnPTGqut(xry#7xda{@;!-L(STrNz)2U##zx7?0rFMHl^bQ%uSmi|Ru~BG=v~ei zr8miACSzvu7wN6iS@TzNkg2%@lf2^`_Ks3Lb~v1pTi-BJxlxHh(Q1@bXXzwtCN)Lj zovWifh1k(5Z|i3@e%ST{OxqW0+h;euN>nsd5;Vzyo7DP7RL!iIQynDHMFS>OPpc}C zyOPRAlUkR4ycv{OQlD~ZO4p4!^*8#kw*TJH8OTLu40zl<*?0=u>15< zG{`l#Gr#brBV*XP%F8MySEx)+$URpyczk_bV_l;R{^b-o#3B8qQrUGGV5+D6uE^*< zxb4#8a>G$(HX7#@H_H9T)F$cSqR%mt^QA3CMU|N*Dw$JKG+@@eazJunJ1@&`ctu5$ z@Q2NurMKKJ<+8b)+Jn?7Ahh`j19f26)HW+!;K6fDLAlMq zceiues(;GU132Z`A2{`Mh{bhxrhJ_IM}U4H%AE*23H(&x7Xz;b&i1MWPI=}59{@fV z04IG4xIP2uGSSat{SP^`_53=oXb{n8mdk zv*hFWj0HXQHWN7Y=HA7n{HeEA&{J<$0H@xrwYb*n64dKX;H|*#1|RBe1#tS4-vOsT z`3rD;kDSxPTHx%z?*V83)n94UEvo0efxjo`9e=kjRZr`)y$&A*NHOx<)xKKh)CZn|T?coI14^%8J>cG&4H z4V-rM25^@9F>va0dwC8;H$Ba`wmWe8$*%$@|3iS2{}I4huQ9+G*Nz9y_BstX+iRA^ zwI5YNKTV)#TuTCHT>Cz7#k51U>ENUEuU5`rMFi z+Fp!nUFEqR-4thg>2H|mra0yKDsb9iA#l=v133NjVBn-L1x|aY08V>r0#5n$`6k_> z@?Q#^{M|ZbrKi392=uhKrNG&~tAMk8|88-$w*>6%U!bSGZ7=JDbyIn0Z-ar;-bMhY zJjVg2Jd=S_|5Gil_QpJ+2K2PI6mZ778-X+4>GN5-X}xHl4+5uOdIUJ-{55de;Zwj# z|7YN|!@pZx+hsen%j=+Lp6~&1@^=e6qj^HyF8I{?Qf~(Vr`|>Yr`{$3r`}EjPQ6XD zxYlbC>NN-WV&E5n59@U$aQ2s*fwRB-7&zmp{=lzpst4NVYT&fb=Ydn6cY!lc&|lEe zP5CoVI1o7b91fiIIvP0ZH3>NDH3c~9btZ7uYaVdQ^G%CK{rqCk(|&FPPCoYoXTMkt zob~z(aOMgB1Wvos=jL=%J+s`8fm5Hm?O@0aJ^gks;Pl%E0w@2&fs_Byz*(g40( z{1EiCpKkJepKjWY^e5ecGf&tLINR$W;FM<|aN6Nvz)7#~HP%h#p?@y3_(6i}yMSE1 zCWD^-c`9)7ueNwJuFVBK^>YPq`sW`4r+(njUuXnI`G_LIldg^TeaO$lLIQ3QzoO+u9oO-LZxYkSGBk$~C zKJd$dUkX0d+jYR{PkscP{$wd|`u`Qc*?)froc;Hoz$uS=C5`HzaZR6B)lG56wf?}# zrvy0bH4!-LRSul>Is-WC)dZaNY6ebuF1L8pFI@wA+Rxp<$!7&{_KV*EXT4ql&bam_ zaN5;7z*+A0@_egqs(4zamKYi!09LZ11J9y;N(9MIO|mooN?_8;92bjob7d~ z#kC(Di~jN*&@-<65IE!7)4&0xVZD5u9rg!3?eKWuw8Jxi(+vdCo(hk20oOaj;IPGu{aN6OK7FWIL9Ilh+Sm0LxKLvbPuUWupSLXp| zyMGfn^SW;Vr=D*FPCefPobo&YocZd%fiqw2D9`olrg|oy-GH-R`vPaZ`T%FWh5~23 zMgeENjt5S8rdT|hZ_ETe?Por4^7$5U`k5PnvtIWBXTJInaN5-h;4JqKz^TvIfz$u| z7dZV-M|ppOZaM7*oc#9%&U*C$PX99$cvgD>XM3GuaqUO7=r3o0p8n??;PgK?0jK}@ z5pc@06gcHs2Aul;mBrP58sy{p`_rJO{iK1@pS%s6`RXUY*cy`2es3GlPQhxJMUXS;tJINSYZ z;Ebm~22MRM15Q0Z37qn*1OA@W&Gq-Vyaz@%)hF|Wy@8WYU*N3QQNUTRqk*$tlYp~c zQ-HHxwZJLQc@~fQ`4-UAe!dHwe0~g^er6eP*6Vk`nJ4@SIPK~M;4JrT;MC`r>#|9J>F z{m&ZUl;`)rDbI7jsh<}uuJ+R?AJ;G51U>Div%E)0H*FXClQ?kZ310)w_UZwg@*E7D zc31?Q^hW?^yc=n8)&IfJ|5(s7PdEuU`A@O9>ZeIQPCs>^r+zL0PXBxpaQf$afm5H$ zfU_Sx3Y>EO1~~QhJK&`M3vlW!4V?5J0cStjRo?HUTeP1Z0G#c9FmUo82AurI0%t!h z2hM(a25|O^dBE8(mRMZvWD4x$7SOYwE(Okhng-5(`VMf)Q(#|-u6m<9U4TVKs2t;kCeN zhqnT!Jof;nJof{qepXpr?U3VIPk^3w_)p-p!w-Pd4!hV_|3~9XH{i6xJuI$zy9#>y z2Jowa_XQu;YZ!30`)J^7_v3&wuR9eu^*jSO_1pxU@}z(>U%d%9^VJ^!C!eLjS+C{5 zS+8FKXT6>Q&U(EBob`GWIOX}T#iRMgc7@V_vT3{1es(WZG{DKHSD}FoJ^jqVz*(;& zfiqt%0ZzL*3;4HTKXWav_Qv(?7Xs&c_$$Cie+$Xw57&bJ9pUBh8!fK-xfb+ySX}k< z9pDcFr<^M+u5!};{{(u<^AhMO&svK|<#`KyC{KqTF|(-zXTu3`7G!u=L;5(%J~oQp`336r=0JDKi7YD=xNNv%qMdF=Ux_% zwtH{TQ_e#z-ci`GzYG8$%2^Ej$PSry91Wa)=5*ln!}EZX&t)F`b`QSVgRk}AUG@$1 zrut#Iy*+rsgU|Hf3qAPl9{dpx{;UUo+k?LgociCnSEjzye_!C#L$L=R4V?T>08ajA z0Vn?j9{h3-e!B->?ZMZ2@Gkph^gwxfd+>w@pXtFDdhpvl_-YTn)`NH1KfnAvJox^= z*M*Lv_S2jtg7Zx5dE;1wQxt_Q!|gI@)ldj2tR z>Uj-t>iIbj{+0*t&^x~#wg*mm_6AOQ1_9^u(N_H?KP3IpL9wxpvY#U#mv>DDem3ya zfX@X!)#9CG|32{k7S}xIKfp&=T+5vYd>n9=I|=wXpg-B-(Q+$5PyTw3rkj>a{*49= z@N?z6(}P~CTa^ENg9h~Ee<^VCzXJGq^4;_LJ2U~ir*ZIJQ z0H-`h0jE5pEFP7|E*~)Y$tU1%%`HcsBf#f9(A!}HL%%)pjT1oM8Mtdlm8T2vi$VV- z;NP;i>fr+UI6YqnoO-ww_=TYVfyJYGxEu83zYI9}KL&ihe0TD!v3QjKXQ`hBkmu9T z5BYB`{p=0BZHoO&0X^+UeVuNq{~cjJR~ato~y})T#4_G|f z?vH?;{C@+S{C^L8zI=D`JZJGJfA-&bec@^R%l|E%TGFI8K5 z#oq%x<=N$PAkS`A&SB3Ze6^N%6}&4DZkpJ zZc+Iu=boQqIoV#cXSNsZxqnbyQ(xNiNQ+1H#=L@h^V#$H;LmoaoV4@Lvz%=A&6V>Q z=z;cmibv1&pr@V}0H@zr0^Fx(_OJgd^0VI+Zl!)l`yUUz(f+3c?}2j91KtyOtHq=J zV$v-B2N;fT+{I%}7DL!95 zP9F8ux<&aje$g*&iC?AunKx4Z?mk`Rq5hLb%0N!)-?dlNFWm`x`lVk0r(b#kIOEF~ z$qrSAuH8QkJ0$;4!wwlQ{(rMW*7p$Uv#uS7!)|$B%yE)FpuY?BhXQ{ZcwgYI9ko9e z0oT5%o8tX|mjh?HHNZKZscS`aQ$7R0N7roVra0+!u35JzevQS|ziHi_er^Ok=hJ@* ze2{#1^j}d1vMK+;!1n__1o%O~hXOwoIORVKIO}^9aMF+Q;3olRy`}>{4Dy@>{BYoW zFCyptQ=q3jR|2Q}*8nH|jUN0ii|g*2@^SkAIp|rhUjgTM`^&%?e?I_DdAb%zVX{T- zts8LCclY4?TU?7-C?6+(AJ9|&1aQiK5^#>&PXYgC@UH>R_}&0~KIrFKTk96J`0@f#e9kO z`5({^2Os*kV&K{rbW?fQFHQqa|Ct0%|M>~<5%S&H3EzWCKT`&~rJp$tIQ`6I;M79} zaO#2nf%Lxjrp^Z++VkbW>1VzRoPOpO;MC_Gz!^vQUQ^n`JD{ih+rti7U-oy>``%yL z19qO0ws-AyAox=cgMc%Rlme&SP6keS_?}YAKg&bkLC6+_$R^t72x#GZvdx%{;F8%XW!0Df#08an>XW*>Y8^EcDe*-7|M;`o3ssPz^NB_Kw#Z`Xlp(k+q z=c9qM9UFmb+c`ad3pnlJDd3FbF9By9XTHifz7F)%1K;CKy?x}N_r1saEAaEw593jm z{{%hdX#`Gr<^d=D0uR2};#!S1`8Yi@pQN03fe-!UY7fr$V3YnMlzRcn?W~3)o61AK zw=?kha?Z)QtHpIkzq%Lb$$x*~W`DX*C9(?)j`Jg8sm)~l&nfLO&{nWz`!H53g zdEm5@J<;#z=MMxy9{d|Amlz$j->cRJ3{bN8+KBoa^eQSX;AD9Q6?Y;mw+x=bO zj2C>LJo{ZS@=wZH2AuUh4mjyg^58QpuI|JlG9zb*hiAN0-O z&-ir-=*j;o;N<^3;EazqdHCN3d{g2h*X_`6pDuOLP0f8g{JgFa)lKJ{3W48j(14!z z7ps8t{^GY5*LGYiAJ>l0fc`k}=eXAKz&`>#aqXMBsr(Z_e*o}_z-I%ef13}S{*B{Z z^lw*yp7VX*1_ozPWdmgxXSs7e4PAOgP!x7w*r3;^gji@8}z{OcKVq$pr^lL z-a`6kKu>%vaQY>V&(jZgLi}Ys+7US8(bs{q{~iRK@*Dx2^(qEVdXD1}Kf%&#^)7>+ z%fW~BWuC*l>s-*YzHS^(?U40d2zusSZvv;?z7L#s=0EZuv+1-MJ{2^0xq|Jl6sz{msBhe?M@_{{(Q#|5uAg``y1m&wked`2hRf z&cNC4x&xybkn~^QXX>&%6kHBK+IGfKLMM@+fUi&O`M<{xBKz{ee^dQNY>mCji$m zJy);OEv|N@b5ahk13jPn_%?9X_fZf27vRi){$X*|^A#xfE#S<%-UB`#^dEyi^SXl0 zLL^(1e;hdZ?+*M*xz6d~s}|RGA%EXE@aE=k4JxE;s(&5Jb>-e{(EnTc+X%@2|3m)v z4b+$U8{2VP{ucax>$dzY(8IR;EzrZ3BanA75BIGH+mv~H&O7LsiEf%ta{Ntwmu`wPpVxaI-4y42joPGciVsH~qGQ6k zDP9ab1)TTqKLE~gLN`vOe0cwIxF*!HDb8`ZV}Ns9Zai>~%S{5#`c47P`c?ra{VWfD zA#mQWx!=oH`FUUY9nf>!<7VL0+rz*)&cpe4%K3NDvtAsJBK=#SC+>bPTTkn=2JU`= z>&;l-Juu$Fah{&QSznG*vA+CWY>x9R0w2!5bW;V(raP|FJ^(oD#rb9Ghx5y%Kgz>r zti@G7`V6(x&m_=OKQ4dJ)3k?+L4Pv((cQo)&kEp_e>HH@^LLqvyKx?s{}RamGWbyb zE*MYX{dl1V9|HUo)N2xO@@W9h`}cD!u5z|O&WnNb{<;nLe9(Uj{CR(U4d}`LR^a4+ zCveWo@OPHU-*^8$LS)lT)x9bHpX-6?2c9)t0zUMsI!33P@@HJ=1wTxCP@k!r($lWg zx9g@j{lCr;>!vvU|3cvG*S7;_JbDs1<$oVI>F25;$fo5oU%C%CF;^w3}C!LPHp%E`F-eb7_R zM}SkFUjwH+PXQo}}mXEWaH$hK%w!=6x`F8_OdA|sKa}DI_ z4|>XTB5o{>kjMSbyW))RD?mRV^sB+2@%;(VlmGL; z$^UP_nLoVZ;s0sm56lOcKQO+;MCZC`|03QSIOFxPz!|US04M$TfRp|);Iy~rfYUx- z0?zz|>miw+a6JS4d8rzLY+7H+c@}WW`5bV{`48Zf)2&xj{-o!6MdIr%AKmdeyUvI^ z>_>cFkNE@dr`V2M55RKAfj{N<yG}d6gbvak+=HLv!M_EZdRq#ddRPIRdRPsd^iO*5zgk@N!1c5*gPwZm@+H+m zpa=S;{eZK5`vIpsM*^q(BY>0sXb*m(#Z`XhnNvVd`I|uBEY~>uTmYPT+Ct#-LEi@c z%mc3kJ^9}NocwPC&OGo=5C6M?Gr#>jXIy5!N_n={ z^LM-0yhw{r$;b7(J&`X_{vzP?GsgjE{`OfuU-Mna?|Z)H4#-J;{sK7dVL5Qp^Z7pF z&sciZ=l38F^H}PW>tmT$e~5CKS9e6d#Jt))C#a{HSM&KA<{OuT5Bm$}FWA4H0sU0; zyFHQrFdsV*IPD2_ak^*R7J`)R_1p9GxoYl_9S+y$`b8sLnZ4Z!DvelGYk zE?)?G@^1xB{@()5xO}yTzc2pkwYsTU)8F1^&|LgY;A|IN6RVr@Vf*SDZ`~9peK+77 z5BVzaY4Y9qVU3BpDW59frvRT0{9KD`dtE0V$LE{CuLr&e_zl3Xu(+1X_PP-`>-96> z)WcHXq+jmAe`|4-|3=934Cra+uK=h2{1p4|LJ=#O|uFpo9btVT|b?;wN{xgB6Kwk}< z&&3}P{HLJjJm7o487~;W7%z5IL1fb%s^u&J%oc-cK;EZdlfU{rlc@x^L z@444X#3{-@6FB9Z?ZGdwxSIP-(5G8JpyIM#w}TJk+9SYO?$f|2=d-{`&*wFWzhUWB z&YK}8=i?}6PsAhUQG8zG4A=?ZGjk?zK7YY};}hx~6vxi#Rk0yx(*JPUj>=sE6` zr3cW{{ySiN<^=HRVsY(Xe6D0q(DS*H;lO8s&ne);{@Vw(igJ7JuM^gDX+y)a&M3+%He=xLva0cSrt#o|#vc^2p? z&w0Qp{{rBoPkHdGEw26RR>*%n=qdmGz{&qH;FM<#aMC~J!C$br%ERZsUI9Jj>FgQ* z+1cXChtD_d1)TY958!(mQ<>$dV>Tim#(@pJ!?X@jG5A^eS$j^5{Jo+N#=Mzz{&qIFxHOR9qKM(AGTYets z;q#oIvmgEcoS(D*Zb^PlKHKv1!2X$^Q$O4C^FTk_^7B9spSS$Hz~;9)UeO2fU7z9A zP4U^l&jHT+wIp!f-(3Nm^xpx_@%HZn=Xm>lz&YOj7vLOk{||7M8`nf$Hmw)OhYtdN zgk0;!537Nb58wOB`f{F{eD3h@;ro=x=TXp~1$p?K1^NF8^c=^2)8aaAuqXH&jPYKM zOLM&<$EEomA=2LkKBRZ^t*U3zbG;ww`8*oOy?ZDF*>uNo?BT#U{>E`yj$_{ldX8g% zA2`Rc?*Y#7t7X7Be)Tl)9ieCU{DSKL>%iZ$^wD&}@8{|I=IQzwUz-iB%pCx??^u)gdoZ~rn0_XVo&w+FNoa++VU%38| zUh_}&)R?s}Viod4M$^wh&(;GAC@0i1d`8aVZEEO5@R z-2t5P{{lGcyBs*_S9|bhEUxvv9rgVy=vm+Qfpc862;;OYcO-DinE+1u@gDqii>sV> zK+fr)r<@Cblm8XKDG#5^ApH%XC;nrLt2{q|JokZ~^0@I^bvNX56UIv^&uzd-e;07Z z>j!`{UjG(2(6e4g z0B4*X37qAQ15P<704Mz^9=zJ(DyRPDtdsLB&{NJ9;N-s;IOVw#IO)IZ!GBo|*U+7_=r#v;lX;%w@cY+`I4RAj9{l3MuT+VxTife6ie~+Up@cDAywPQDntA03d zy9emWe_!C7S3L+g=YUxaR~7b1qU$R6dMFKLM#7BKnem` zwv3IeTDB2CjkFSrB`mL$^~y;61Q`fNCxPIELQKMsN(}L-2~|=90w*~>At$)}#SQ5x zaEMW9NNIacYg(FPLYnm6dH1fqdHbGsN2|W0*_r+HzWd#K=gph9Z)axld*Mp~$L|?e z0X_o$H+k%Dfcj`Z1vuL80{n5Xzr|yps)U8}-$=^{^lSVN#dirV!@WE{TlSy)JCEye zGJ}m!Q9GkjQGZ`p@x6l2G1c?+#{@sk!XJ_2Bw^tlg3q_`pNO3b3$Kv+3kB!)b1t;o zTLH)UwC{NExbtr`@{Xdy ze&RTPF5swJ12~TJ*8z^_P2YVV_6D`&Ic|99Onb^z6KmW zuYvkFe(nGq$Ip8I0`K?J!B4%e(rynAf*sV==PYqLPDUvKDPf(z;WIW z?~g!yJJiQ`?*$y=-3d6>AMxN%3eMdMKf_AQ{O2iv(wXz7PJafcogq1AwDHdjLm&MghnA zzWc0yD)rf)C%_+^4@7@(eh=;AebDGn4a|38{fhy|^B~>_jpLTjLwy{#d$(m z>OKQFj$68?Q}9&m{eBbR7}pTsXn)v)-!C}lc@Hhx4j+d4nCEu@-vIsgZvn^oz}YbG zg!6&R0ACMwE(5#=@U?*BeBiZ!Z-x5(fad_;1^61kp9Z`i@Yeyq0q}9a2LL}t#{0a# z1_56HIL<3x065MoUJN+y$7aCseA)>(&MRIo_&MYc&MV#o^>JSDIlyt8@I2r+PIv=w z948zWoON-0^1p!Ncy%_+KcMbufTM0T;HZ0v;H-<|lPjP;j!)8nV?MKhp9uT$R>Apr zxtta~UcL(TaeqAkI3A}D1CI3{_uzX4XWd<(`va(t$LTKs$MMYDfa7`mUjWDR`1^pP zpT7ef$Mf}Kz)|-iz|qfoz_I>n4}PWK?B|o< zXA0`0pE_bIUaDVf1(HfQ^DDvr@;l9tp8c6!-e+?FIxX>!P%eN!4CIbTo_0Hd9Ia}{wKK4s{pg#6X^6@eB@oLghKeaux?t{ctoPFWK=9;4(wjdCzB zelg$!fL{W*KDUAEF9%$o!@zh0;CfvvuFp$C+N)kK z${3#4g37IfTXLxmTIaH6-KAUEbWf@>mmbIkmDi?nsi3lB>((FyD%-AVTHKV%B&(X! z*{$7MbLmWORa5o0+S(QUna*5yZ>FKCCD~S8)6|=(@9i5*b@ZesYOc?wx^r7swN$q? zG&C%)ZrB!7W_wwI%`VCGUYkx0o9ateUy)92u21#!bfh{rH>_LDI>}`S zuF723yQ-y%%yAUS%G#+mm?VRmjPjj4s&`8_WU}e&8n%@ZNwjWJC$;)f^%t*;svk9M zQ@L1j>|LC!zNDdLW&P##-F;o@?2;APbeeZ7H>m0=Z9uxi!+p!UeCftiPk)+Pj3YBs zV$sfDnMN_o$t5P@<>}6HW5)eaw%Le}i&v&I>1=mr*}Em;VwqO0wiVqc(y$_WR;C?Q z3VN93RbdwtF|$;Xp?l0>Cm9XRRU^{ST{5<}4o@r!$8({`(N*p${Xk@$jLGgSeVZ`cl} zz+yo#b}LF&Q>)Al_T?_^=`|<$cxMCdyC+gL)z*1D5orTcClK+wAa6AdnJ_EyPmj@r zOrha|Tuh1WNE#x&=Hycl83jg99FsSC^g+U8>_$S5cJ`AoXL_vyH_JC1@zc>^EpAHR zP;NV&GP4D(bP6m}0wSG2LBo%mfnpg=R!OJ0CY||z$ZUD$OUdwL6^bRMM)ESbq(pY2 zqg_nKdc@XRFp2K)5OhJ(Uxcp5n?#68p|#&Q#*gefps(9M=*lfsR( zO)GS-&#IPXG$Yv5Qs1_U!Sh?XH)T?}{w&WS<&TYUzA$naZ_TB$x&A)ML3gG* z*Otm=Q-cD8^OSU)(&r6|Wc|j%2}?H4$FW^ASukMmRgCl^zDm)i?W^TDzxk?K-HorB z-4v{P;Vdy_X644KnhGWhlF82A45hrE_j<#&hUAhhgKYpQxeRKkYlRX+c9P6c)sgEM z%4M)a^=NyDAv`%^s2ORfF(fC&3l$5Fp%|)@;CA+I*+SoK1eKZIT)J{)(}r`Yd+6LO z?>A-oEBms&ed%mYyN7gF+jZI0mUK|LDceiENV(-o`tot6!$_TA`d#eL=>0Ra$k$r= zwU4jgG3j*>%;)Q2OXaVpx?GUY*E5vLZ)Y+UmpR;1@zY5VuK4Yco>-AK~KPLuXuaiLjq8NO>SAYxh zFN(o$b?_Tw@cEt-TYq&7exHNCHU|G@2cKgqb^i@J_*cf@|D}U}O$`2sgWn#5|Ad2| ziow_GYq0%v#^C?Np`VGtKPY@W{(EEaf92qBi@`r4e2o9b7<|3n2>HLK1ESRSH-j$( zp@RGcG4%EK3Xy+848H#EHS+nnI;Hx*#Nj_*>ryJe&cUAH_yZ39*JJR99Q=D@@P{3Iz80|5_;)z?e9dyHe7&9z z_y1R8@JAf__r&1q?{lI4mt*ip9r|B!@DtR>5UjVc)0Qdwg?~YXB4(}EK`YAFQgTk~ z6wo!_G)QG!F4E)i?-E)xo;mzaDtyf%*Obc-84Am9`Gz=0F;*x3v4}R==4AOv;)d}{ zym`wD&6Zp~n1}87?-V{>1Id-A34eEsm48+LjrAbd=izS`{;WLHY$#9Hv#8_XZ9D%X!hgl$+xh<# z@m=}vlK2xM#PM@3)PK$Y)uM05-*=u7UT^6uU;W?f@&BOki}}ybv3B`CywWJ3|EnGT z|H0$`NR@HCrHKDmkhm-V0e8$)erZK0jaEr9aL;f=6YCa9O{Z7F(Zx|Inr1E)AlX{*OKSeU}yLuXE`0bGlvn z+Vn(cfR9{<$9gX)*zW`mGNA^&b6Z9xPGWZdUnMJN~sE{ZWVhRb<7Ezu%)j zUZOt#j;1UBt(TkqkMUpQ(BJ9N?^|j@ejp#Y*|6ik*P|aa8U6jj=l%bATI~3r^XSiz z8&ZquKjqQi@6c~|=pXXvkBa^a#KB_6|At3@h$qXa92PRi-$9EV|FLwR3fHvHe?v8f zSWKTkIJowIpA4K(|5}Is0@1h6e~q<9U+@1l?DV#MD6XAs|&|DEd$aY*>Q|F5S-_2-Da zn?3r6FEABelX|+c^>6U#&slGTr-6PC8L{;r7JYmFAK(ugRJhN^qI@wMeCY8%@j1gP zmOuU-R9F5I8;kBO8rA=I;v*{mr6p=kJ({ zO#JdO(7d5n&6}?IcSw2L=2r=Sex7MIsCrnGzlfd##oKoL?ZVgRE($HM+Ydhn%N74_ zekc$XeeNN*-+o$DU-Q3R^lkq?x`f%$dlvb<`mO6XJ^ZRmxpojF!q2H~Q@Pr#@~`T*u5a`3TjhhJ z3}f?r)mQ!@;oHaW4&l!e|J8uK|M+=YuKo93#whHkJ4{+$l}TSVV(KR@Ha5|z1Tm4DT|>G~}X|FG~E=9y+g<5zy&3GVn4ou)pI zFR|G9zmWK@_`CRFAY7pT_%gj!ea-*M^suXaWkiSPRRm9{u2DqmSe7M~GWMD*2vTVLNVRDFv- zBKqx8k@cUXMg3O4uJY(tJZFf-^f!3)1GxaH-IxiFpHYYY?H>Ks67|36(QkL?f8U|M z+oL~RqW-r%`uiRFdmZ|(di2Li)c-q=e&Suz{@Y2D3-AA@X|ebJhaUa+O4R?rqd(-( zA9Ls@PBO>8-Tvq7qsml@wZBt|@9ICt9r_%S9e<wUfITX@~C zP5v7N=lt{a!?yl9;xlH)KO*{CU(DqB`u?6W`7f5q|2R!Bl;eM0nf#$L`9CU?|6!T@ zYU+r~$zM;I{9R@8-zk%S`e)4XZy)E{{)>J7J4^U_Jm~r*IezrLu65j@?`w#E9KEql zpTR-lC$yrh?c;H+=-d3m!hhWw*x3Bbi0>M|3`_rUn65A2!u`i9v?!m_9u|(r*5-d4 z_;L8}VC+n@K1i$orp4y-$3u}Y73Fp4U(LoXr$ylW_+3%@_~qme{F|JAC_XH9{{IiU CF#6X3 diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/Release/sshcrypto.node deleted file mode 100755 index ea091ccce9a3476697c2223b47c3c937879d6852..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 93472 zcmeFa33wGn7B+m@1QkqF(6|yuR2&f#BnYEuVhG%f0i%F|f+2*k$dU+QQ&EsyZrIsq{hM&N7$NqYpbG66qg{I6C^tjAZ{nsTe^ti0O z_0<{I7$C<@>7e^hIn96Fs=<(RHDp5Mk$>(dffUzl!G=Q4H8^ga85g{^Gvk~q=ipD@ zFKUMUnfXf1xPFIdL4wyBBcF41<~s-DsF&aSW6T#i*UXpB4qMFx&ecpWx+D$yOs_uu zLr_m0yE=}``_=|#`?Yne&RYJ(>LuS@^~0c_$K7|*`wgdmkLD2F@M8R-zG>>CvO`B7 zy)m@^t*b*V>q0m5z)C2d-nj39)AyO)D08oE`_5{#cYbz@P8%z@HlYnS?)+@rOTC^d)quxn73r<@htrz`RVy zpPBeG3x8(g&o%fH!yo78THM4PAaI>y;OlUmk3S0xd=sw!z@Izt=T3uLXs*uXE^~9Y zgD}^7aJ?6Q{%PR*&6Sr$*8PLH|7y~ny%W_B|1^Bj(5;b2iYgDkwf~kwsz>GZ9J%JU z_dmY*m!emehd*Au{m~!3dHdPs*ByB7Pw(z|?2!L#YnGjJ{iTnpQ18O4S5IBmeC5N- ziWfii*UR?o{m*Tmw7YY1%jydbf9H;M&n^7CZIhADTu?JAFaPpacmKF#cYU9E)rUmK zthw#qb6#0LBd77mF9x=`xw5Ep^Y6Y6^`1N@@BHwPe|~Y=H9fy-@~@)GaF_CvJH9`# zW8qC7pL*MrQF-gC*WA|V%{@S$yPe)7#dkG=iDork;= z?sUeE8}rWJ|HWY&ChxUor==R-ZBa|aARk5p`@$Jh;m=Bge>@GHkJ9vKJWNG@NE-a2 z{ZjY;_`uZoO=;*1YLmME>uLHANP`~_=2P+ib{akOgj)ZSLeF`vQq#E<0U;Irf2YBR zGg9~eYZ^YsB2cBGe;k5nD*Ty;ghB_T;Qw<3#8myy0X|j#N7DGiJ!$N?V&ByCuT4W| zZ5sWr0W+!iYz)6j#pnHL^n6zu|7o43|9NTjwkb{jyfpe;js%m6|JG^z^JeHFm0T6z zCl#H>NMxz{pN~YAs{g@AZmIBBrSYp*4@%v?Ya07*O+)`j=phxKt<%scN~5>pGk zi8CsVU-g3$Qt4p`^p=XxXVTdHjx_WerHKzO?~{7oj%obiOT>p%{9K-9-EBz|PZp%n z&q-<4#k@3jAC|^mwQ20tEscJbr{RBe8al6}k?Zei?9wX@pLe98(;*F?m#10R$EKlw z6O5J0ukzBw=SFGh+?dAC_fBKSL(};4>uKoUnI;a;OXHuEDLX|TX`V*^6Vv$f8ENd^ zF-^SvTN=4qr{Qx^8vGS$@xV(QK2@W0p>Y0M>mJ|L0(}0g)xnoYw+LWDs*OP#BhVZqq*tN zf*(I`>Psl$@MGwd8vKI?heCIS4h@BRP=oq8h}Th=m;5XZ@bfzO6@C)z6$)K~b;zHk zX5Q%wG<+NUo&uhp#2SDDf7wPeb9;dGdU_El)d3$R*kLZg$ zix8h_^uXsq{?wUy*9GRyMm(gvSpj*^H~i1LL63K~5h@+M1^8@@_(uJ-59p^S{6Xw; zi>5OecI8jp=q+cXfT5A_WB!yu4w1|7&*w7!JdOB3{E)R8e$w>69`uOcY8;_nH;0}D zpX4XY>_<5M^9t<1{tIX8jxU@3M;rTw1N}QdF7}^(weHx<^e;tRCBFIrjc5yf@n;P3 zBk}Vd)v$v<745_?xnAQPKipyL@>;+y{n3s6gLYhH{C{Iy(=lodJ!a-zvQ*=rG=?8& z?3*31?|X*M^f`Vydl~(_X5@ABGa2!g{7g3w$frWT{CUvmziys}Kh&2{c^bRyGWHGX zv#YUh^-4`(v(e{e#*VWCe)WLiztreqhM6~n^+!IlU(<-&zz2Vd3_sZcKPfcpJu{%6 z{m`HOqXP4OVf0XUkEXlW(BEk2sDK^U8+mh#KErxgXqw?a=UR<0Y=!0gRQ{-h*+epP|1YK>t9~zdEY9Yta5zih*1-2D#!Qh zT{xy{TxGxVp<^m_Tk4jwiYet~!$*xPA2aGwbiAO?$$iSl<>r)Dj-Nm}<7$fgbehz) zYtM<}Dr!bmjVtQYH@B?QDSfKO6;@SGC2_B3zwzaxY9!>fw>=71|Q zgyv4?bE3f~!@s-0hBbrRt z-sPh!ITr|&PAcs=3G??YOELWu&#f#UcJ{b2Q~OqzS5)d*ilAw+LT+xjeB7`x zm3=F!sw;Cl6^^gONR28gg|1w(rx>anNq4UpT~;x2v}>l^P6b7MdlmLB992ECa(w5W z<0~ua2K3`jIgZ~t4kErlA22ewK4El_+tnw0Vb#QOH4wDuywbA5;?i)@xn+g@29%Aj zoKRU4L=MNqMl?h0*ma@#iJUJ-JuqxXSUP zD*miC!o3R$MMg&)zj|Fa^P?%ZALF=JP%4i=KwKdaz&S*c)<=&V@xEbWN+*ds<>nc& z9p!n`1Y2aDAkvvApgxa^U#&vJk8&yaywUL4CrJyM|31O_9CQ+YPD9tik>&Wmv}(-M zWKmNzij$U}RWz_n>`6cF-NSF+6r)^Wx_HxRhw?O%)Fett!n&k_BK@g_nwx^z{~96J zSV= z;~8Nm6pus599L0UBvG%Vs-k>MF_XA20NSIvlvIuzQ8V&)_wU@Jyrw*TZ@Qe3u7C9~ zg!m9yuCA&stEqCiMnHC=d~OahP~pV!<57FKDaMy83UehtI0Kxl-lcEN_)+6Vf5+0ZDwu;$MhD$j60qbqFwm`NN=0Qgi=1wPA3wfoJacxQqq8zI15&xj zFam0?WG{i_4(W+Jl#LTq1(UYvqH~@%M_$pd(%0P`5pz5D8#%sevdf^KEuSSJh)-G0 z`U9S2Pp5uWB2LlR>YAxqy}3z#dP>na@y0)zMp-0iX1W$n=#N}?vMBA-89ob~;tZh);8=#y;&G#3iYYeA@ilak@W-@WQ8Rvw^yx8bMCF8< zzDUYmd>mIfxomv-2vn?kGtBqaL}J*<`8|(Uptk5BkBl$zw%xTpzlW89H@b`B*G`7{jWfpm9N&gyeuG zSUBtk2926jHb&wT8HQgurBcSrnJt(#D)Wisxy6WVk z0nCuJO8$gq`lQNVxj9B+#N9un>9Lh#E2^g&J)A;eM0zD53L zZ0!ZKuKlWXzVXLxJD5Ql_BR>ENx_psWAR{HRY9#;&E3u)KdPoOMSiOoRXS>vtf}(K z31zvRx|WTo&})%!r@SsMY%N0sI%i1*)*9=IUvI50A2tm6POKU*#-CAHAlCgE5}ww( z6;C*`stPH1oX&GzOKvCApfe1Yy_24FS{Yx_*^OYsBv+US<~|)USP3w}Y?~xKf&5|S z1IpKt(~gYymRHnNjh`x;H@RJ$r{I2-W2^am zUQ{I9Ir|mq9+Re~f-DSi4DmZ6aBRMw4ow7h2Gc#w5!u}(Qf6DrE9 zxj$q*pVET1$=7ty($`;Hn`S%jyOiW;e|OSw_jtGYD@#WAIQJVWd1oS9K(vP~m_91!oqQ<#s%| zW4BPRlHxOgC_A}hXRAS@%Q^um9dMWH-FE7jr{4_y+TVCd>-*u$c0bO%uC%atAtfi* zy@BSHqe0l??R&5P@4X{8$v=(oZNUE*{%aDNf-@?39UscapQ*1uf;XIdg_amx&GFac zBuul=3Io6S$Y?08NoYM_{xrhrtcdCc1g(ErXkX-Hmud*);T#fhQh13UBTk zhZ1JI^PK@Ek)JyAT}768@9N;4?=7+e`01wqkidIF2c8$epJLAO-ygsi8+=zoAFpjg z=9R7Rm2cszHLLP>*upz!$JsC?4gUT#_zh|BEzEfY@?+EQng%~I4ZhT(@4QncpVQOe zm!!dOOoPv~=C$ePr@>dJ!H=})&m@E9r`p0-IY?YH&!A@XO1AMgTm3JV9{R6^7XB^^ zzvFa|j*VYu^xlir>UIKP@c${SFe>EDL{yh0nI|wHCg;g}=nYceU`dEPTF& zpKam87Jj^iFSYRI$epwfu<#M9{}2m5(ZY|k@a8C$v{qYqb7W2MQ!KnWk|Ox&7M|bz zI6t#3{DTe>*LfCxs)fJV!jHD_3oZO@7XE$ zw(z|ye5r*GTlfJMzSzPKvG9Ml@FOk!Sr)$9!k1Y1DHguBg`aNW`&jtd7XEAtKhMIK zTKJnS{5ckWp@l!!!ryP<`&#%V7QUZ_Uuxm|TlhK)f1ZV3XW`Gc@UL0;0TzCPg&%0) zH(K}$EWEPtgDm`33vadn_X<>}`qXUAT$BkGe27thXiZa$#;%Z%bU~!rY+VmYCtf zeCXVkxWt892wd*M+=$+mILC##0lh6z;KJN^-j>L9VQx5YOC06G+-TmG*x!Y@!MrWe z$b~Zm{_Yn?UcLZ>{4UH5X2|ct+*pSEF3b((ZHY%+m>bEE--Wq>4EbG{8^@5}g}Gr2 z`CXVB#oH3)F3b&L$nV137>4{V%#B~j@50>hh5Rnejb6y_!rb76{4UIm-EE2Q_Birq z3;c--A0_bXF3b&F$nU~O3;d`HbHf($yD&FuA-@ZAgBJ3;@NoiP;==6(E_Y#W#6o@- z<_0X}cVTY4LVg$KhAZTEVQ#cSei!BjE97_KlLY>5woAu)hm)LlpLRVQz#%ei!BjDCBoxZhS(17v_d1 z#ag$o6K)P=cW3He=^8n$kl%&5F$nv+FgFBY ze;4LPAmn#pZU91l7rs#7To>j>Amn#pZU91l7v{zvo)h zI4=O77=Vunz()k&HUYR*0B#n5_XOnqF#vA~z+VL54+HSq0r=$r{6YX;5rCfzzz+rB z`vUOo0eC?GjtAgK0G<|rCkEiL0k|>%4-UZn190yEToi!22jIK_d}07TCIBB1fZGJ% zRspzK0N%67@83TL;4K08ivav#0De0FzZ`&H2*4`>@RI@fp#Xee0KPo{F9^W#02~Rx z(*p3s06aDTR|eq00l0qv?j3-O0&w>LoELyk48X?(;3EQXn*iJ@05=Q3d%g_VKLBqD zz+VL54+HSq0r=$r{6YX;5rCfzzz+rB`vUOo0eC?GjtAgK0G<|rCkEiL0k|>%4-UZn z190yETx7%Hcz4d1$U(t_`$f19$D7^FOSc_0ZSZJx#i#nwXzzxN8EvN{TZLAeEBa5B z{(0khIsTV$bZhweZ_WrmzoSXG(c19qztpq_foX<7i-wKEC9gT-nct>&&%@Zz#1s05 zXLj%O32wvDFKSwbW8GJNffF2w9Ssd?7#>E}Hfx1`jRs?^J3q%KCZo~tL%2VN7o1nn zzo1{=aC8@*?s7_Erwj|nnjX_$XcukBtt*aQk=;8!E;}6S)sXRY{=U&wCuTRrub$q~ zC}Yl-KQk^F4^@;PL67?~F;ln#Rv@+V} zOFbd_IiDITiI1IL(61z3xllAU-E=-O~}t-1_zQM8}bIjC1w zHpT$3Rt&Yw!1IC{B%L>*XE+)eKqmf<0VOfHFF~&p(5oa08P=+eY>Be3Y6CUlmSmm* zh2D{djM}@}fpjeIjgM)9pVWAC5j)7}Rch!@4GkBE3YO6{MY(kshjQ1KM1Mxla6E52 zSz$c|zDfQmC_;;%E(Ce?6vm?4;-#U`GVs`t`v&d0aC<{T!36~ulKDtoMr{rl;LNjy z&`)Y1s0at_d;^$Q<3Ptqa1ZHTB=B~&e+FXk;Q8P_7l>7A71}7@-}K!1{<+(+yP0c?PqgM&KMm*@gM)Jo_`y$4c;sr|^*dVz(hKANfKA302& zXqdW>4e`9kpY|za?vEZ*6@I2_DMf&(dGvLSBU9%Xrj8eM_n{vm#6Q)%7K*LM19(ZS zdwXEi2`;ye!yH0mc@Fcl*bdrQt44ou8M^_R@TW+`cmjjt3$N~ zSrPGA@Q$T9`9FGryenOtwXsUoe;-(ySeUu%;a?YNC93Trwk*xVWGtdfy{ZF)>M;C; zo*kd`d15nAEErHQkc#5cd=gtU@UfEklS63NFNI!%`UT2ySLk<;PQ8SIvX<7WM(CuT z6&P8nUKQZhag6%}O@0*nmD z#PyBnt5nZzK?B63GZgy)xCqDMTn=F^9%!jb@eMJ^HI8j`_&x!gs9B)53?pcns~<=3 zka$`BT|>jbGRGuC!JUNWCuONsPy#&x))-On0LVNVG8=^9TD6zSe^MbdslzapiC(3g zdS8LXVDm5^LhADyoaj}BHb-Nhu`!wQ& zq#g(8vPl8ZpBPv#2uwj*&k#fKW5}Cs8_J9DyTx6z;7A_hwlKHL?ut2aU2R4+S3YzdLKgKM<|Bs^8` zzeKD0(=Al>+5s1YBil1-JA)Y};g^I=gZdma+{pMYBvp@rigp0CiB#_vSQgrGxWz)7 z_qMap_Cg0o%a^h-o;Upw-$EOvXBR_nz@o4g+CUCYvCzuFMIaI!Dco*S+o3eIzsF!t zGT6vta298ab#Lo3SV^W#27Ql>@w`nB`xspPHGAktaK4|xr5v1s!8%!0zDO_)jL-x7 zOH=orV8GNgN4KH%o4xfGt)W9_DHw5=7=1*YuAQ9sj0A19Z*X1p(~|RcZ|7D=f(Iy$ z8wpw-jJ5U?Wid-R5D7YnEWaKJZnlOa5-bAfvMD}$6FKnK;uP^eYEM0+<>&2Ceai*a z94tyCIQ<}SHxTqZ_Z>c3WJx*YRe1_D(|Z~`I!QX$?7p9R8-24c!Hp9 zlN~}G`WLTM-k+dn&}6MRlL9$^0DFhR>j25h`)Q$QSKgJ5oz|*bg=tt%E9z9tl4P=3 znPRfJulh{35hH^pd+E!xCMy?(1x>cum0x8#*3+Ck3b9m6{N)r?ZLl$=EAQ=J*p+vV z-(U%9H-*8zleOndXAjHdKdD*L)V=BzH=Q-zj}kZQ4veFj84%4?v)HbR410xbskj`M zzKX!&CZPPyxz+am093qm7RNNIJyEIC*1-W2@Dj=* zQM0i5k;pGA_Xd5-bk-I8NIE-?++72DUOId9pHxV_s`(s~nsk;)U75mmP}1zzP;K7q zCy3Jo3fsLPCU{oAaG@L`BBvCw9Ni$G*75^guCBgkM^VMvnM zSc=`=WAGuFO|O*w1#SC5gSe8<49Ut1bQko?-3N#IMDMJ?DD(xf*tTN zCN;6~Ka3qFHs&YIK8|YhX3r3}3B<;)*axxkQ*f&GfV98V-%Q^8)q?2%aZKi{2{Qf} zhp&|3l*uvNgECx{$S1P67)0bhQ*O2VdKroQAZy3Q4*Sv<@_J*}Mf<;Kb*&6=;?gSh z)JK8XXg%@cl?5OA3n9DuNHiq%TN5E6vGIOzt(xF3bQ`|V=k8lR^w(}H_R-PtZ6Va4 zwm^AqbleD8)pD?+T|jLm-Ngb+bj-mmqT^jJIMFeKbDFwnCL8f)X+-e z!zMZo<=_-c?P72dSZc=!x0_T0WLAd?LlPa&CWHHU49=C=^ji5I_kK_KM4Tx(IxYeM z#}gopM8~%|(-I+Jd&3<1fSRo6I2B^4w?NOS8#C{4>c*8H*mdJ;&3v)(QEE4Z z!InWO0fSAF$$wIP(4~_7W-%K zr#09VQCQGmjm6uSn6o}<%QC}{)1t&UbVt3#nBfAT+lnRC8L)Ah$m~G z=49O{4lg~wVb230sNs?CiD`crMLj4AI`P9*p-@4_Q$-=Zew&9^rX{hwbAVG1Vgl#~ zbFgf`Lo=pkiAPBoTrO-&7_8Q}=&Ra*TVaX+K9m|kE@P)Vui7L8-h&>+^=PF+O?(wb z4;7L2Qk{G=w=*-h^ky#bX5KE+fXlV&HVo^{9nPVgdCPnDYqsLswAS9;AX<}}?JRa% zi*6!iJ*C_sGdHM(GUs;N|=}_vL&>2W~Wqd{7 z1EfzNky!UZb(FLFG+g+8>KLq9^P*ARg2~bJm*+{L&E_?<;V-HJOeB6mI5F?>aaLd> z1&-w{Gc<<$;%X49Tb--Pe87p~ZSEB^+tuMD(*-@v`3H3yh+wu3LIhPx>^bz;E}v1` zk1t>J3j)lk!WM_P6?_G%@A>B7S2*H}L$xh41>Kz#s&x)JpB*@2AOuRjLj?RVVuocI6; zFjpJmk6MiWiB<@{nqP@eiFO_wWBY3^?D$0u(2o92M!s<9Ir`~`cE>&~5G9;;hwsjM zyy$mUiuTr4dvgRMXFTYO{eHk2a{R9sN>8U9)tk0I+8zF$@U?5bJ)zrW{!CdqS|1L7 z^R4#ltafMq8f*S%@p{dhU+2Vr*8C^neVElQcI#}>zuIbd^w(O`7yr5xFI=7RYS#vs z^Qkv!UnZ=K+6g;>`0*__)+UAm;o0{^^iRy!s2;HQa>9!}croGra6-So&Ij7j-%_+X z^Sk!9+B30MgYEsS_K2@t+o!YDzQu|Uj{aNgcCk;f6(1b^{D76=_}6J$ee;Wc-;$N1 zgnH+7kFJT|`?7Jro#8VWr#743M6`V#jzIeFYQaHw0st2d!JzxYcyc4a1xF_QeKjHi0-J9A_6 z(;C;D5$lPmuQ+6;Y836+qNefS)!|s1*Kueocm3eR^YCHJ^A+bAr{}ps&vPQ@=|r8x zTfNBUvAVfTH~)l-I#4%1$mTJ+IbS!|vH6GB=p)|wL36Sa-_3zfFqx@Vp~uX^7L6$L zgqthG9%NcA3nzubv{2 zPnPv;FrJ@Yf!He?YhDt|?j8BOW)kbV1`I%THYWm}ies(Yg=1&x!=KMPhd(DZA3kGe zX48pXOJYM0rh&64T$XzBRR#=z>MYQpsk1->Y>Is?hru+t+tn<_m*|?!E1-o>A^9^o zS_|J?Em{au3wMJgnpd+qS2w?^n_IAXCYn)?IQmH`&q;q;o-bZ;ILEJdD)H@Gf%hGTf||o$2SY0Gg2f z!_^4gSqB^A{DoSd>HOcCzgw#LKYz*0f0=*&rm5!Nq&xfOU#;a$H-ACD;^=PkVeJx} z7z-@u*6Ie(bR%dpRYMW6nqZBUG#-qUSOT2m|CT&6eB_KiTRZYBCLvd!jsr~8SaAS6 zBpgW+ek~uV8d*|8|BPaZ4}p{CJR_%@4=jEfrQ)adMWf%tQu6Z!=c+Gs_?h!q3Vtrp zBy@N+{Pa%8kFD>eJbdK_P!qwv|F^T^qoCof_*k?3F}bz`#uP`JwxiRvR@=+~nZKEO zliU~sk!>0%1C+ef<$kZG^QCA1l>Ah<{Okl}o1YnAKLtNS{rnWB;O9!~slU@GS zQxQ%EviQ5s;2r+DrRMKYKYzObI{bAt{GF1_pXKklIQiwV*Ph;Tkea^^WMY@KS0`XB zJi9$eafylU4pI|!bGB-!n+=bbb=C2CIGgJWIX?&GXl%A#B-9$P%|>xv|Drugm1x4E z>;ugrX%CT{dO)MRc%LGk-10E!y355dyry2{$yOIqKkiC(^38p^IZK_Uo1J`PIKPq2 z^@WD>%S1=5R4HB7RZTOQHz?2Lny^ov0g&;xZfVYQkox{?W}X*gO->RzCI1 zw-oa-Z+8SAl&>D}uh$EcO}${;^@|rozV=G=?b^g~*R{GiTMgER%m#h>o^jWw*_`CA zmuOcIql;2lFYEeZ5}Tr{6PIB-1Tv49?y2O1X`+(6DW>htr z9sjlC{X!hS@*G$s%u-FznZcpGx&@kKypSd7#)~ZV$r{}wTTM1SvLU5}UXgP@^(uQ{ zq^wJh6!+dwT@AGp@2t#M!2p}3YVk725;K7~b2D`vr85~MjENWtUk1*O*jBx3`?F*3 z)4}K;v$t8!Kd#2yh(_vKGLf{L-_gxkYOHQ{+}$kadNwC5=NZ~JM6CgP&tj8j?^j_x z=MiA@Wn%9l*j3$0y75*^*ld=-OS-uko2R2WmA%y>+ukB!mO2of#kgvbv6^d5QvrOp zO83Z8SDPLpre)WU*~76b@#0JSsheyMLL~ke45YAkotePc`z}gn?457y{ULCv?d^T9 zH{JZw`P zFf%_ojJ!!g6%qC*ihf?wZDU4cB<5GQQH%D6f*Fx)5DU*(Q-=}oJOB5B0e-iD7YG(P z4rEnb9rk=Q6JU*RhrU6xS_Cv?Qg`9H4E^vL3R@JHT#iZbUMcn*=8x9PyOg56z1JlJvdY2VQIDJIf%edP`FerFz<5RyaawlWv}g{XUtzoi}-6 zAf!^Cff{1Vz1VSbVoUX8P{H@TQ((n*ppWJVn;FJo@pE+ZVm3EJv%j8~??ufQwKKln zfg$z^<#(ctFV+gZRo*UdQrCbHuFyq*e`AGy+>|SHytP96)77~`$uC!EnIM|XoRZln zWA2>-_!i$FvyyMI`!z>!z``g2p<=U;pMWOemzfQsZdnfBs*hn+mK9fnh&ilN0`58Q zy`&di6^=e1em>DP{QOth;b?p-6fGFle)fVL1fEai6hzk)M_=U|yBw_$6HV?;X7*Lu zC>l{5iKwF^%Eih3etMQ}`fXkAdLI8=o$*wJGv{u{QewQoB_EgBk<$n~6(J`*X0PZD zs3g9EO+9Acce+6LvH$GI8Th+*bfa03_?9^GGW*HNK4$|CZrw)gN#nKKVs#R z12dHwh|3Uk#id#<{-vx+u|mxBAdpG?B*wrq>^dt9c1-PItFl z4&A_gYEPyO8INSBEahypQP1m0a>7a~(f7{wJPw($hQ4azBwyR=^%sbfFMulJSof_zF{0=Et=H~pvmM^T)m}vCsz&ls(6OBWSp!Ss)hqdoClrEqw|Jme%nH=eooIY zf-`hUnqe4cXlrIT*f+x^W`;)Y3={7_%%PRli4YwzhxePKtT)$+_3=UU=S8^9V=o;cIFr41}W^93$NyLU;BkSc+8-6}|_W;pj)|Zw|d{ zU3yJ3BL6`j^5W84E3V&2?HeF_9!ACVl8R4g${|AcyB_f&UnA|R51?C_|3q{|!WC({ zZJc;T@ysi7Lip59Gv0OPD_9{rwdl)mh9LAzKK@c;R_JKn8}|HhJy+YGb9e&<>sHG;ZkNv41l54fq?04`{L?(TX>@O zwjZB%ye%V=AS+R^yE+2eF#e!_AD7e6R2rmH;zEb0K19!w z_)p4*0o2$?~a|Ju&S5s``_$^P-Ya|-}g?9N6Fwf__jjQK1 z6DDY{dG1MQ(A08&g=p$@POpDO!kcKLIxmBK>R7sfKbS_TiWzHY7%P|}zWLJcG!SGQ zT?P}YQZlE7lQ_CbU4drR&G4A(7USq)7LRvAUUeuC^6M;gy(xZc?&*kvVCv1)plLj12PRaH1Lo|DarHdq7%p^J zVZr0Br$pWX5#$?D@(OVbxlgPFejehBG~8=76oXqQ-Z|~H(k^`ye}#1rVAkU;q!VD? z#w$m}pZ)OOQbj3!ywwA2Hl^uPx;c~07o%AzzXb3tkZ1J*slChYw~2*{zdmgZ z1E2<>BO?o#GUN#IeQF#>+HpzqX zDPW27A=_l*SHb8S0g)#k9ikEp)O_ek#y&0~_KNIhSap;{zf}7;Ew^y;*b4GbLa0TM z+|*`g(o4-iB=}QtWKa!VVknlQAttjFbnDqZBXS|QNnrm556Jm6tF6(&&=lk2dssUv z=TX>%-n}PU4I59)PCr1wjb_68+CmaNG9gG@p)~8PVUyhGBzY?P7M4MN_2^0812>&FQwqM*Sn z#|gmX_!C?`j<35|bNu3iF2|8R818uE_gHF*-NXarR79_B^!r?_|W)n2-J2%Dclv+55P8&v8zVPk6DIfqJIM=I+E zzkxp4qIV>+q{SDB#ba=Zs#;8RFYF@M)ts)% zHH7`@x|$r-M6A{eJM48ee<_Y#*`9$L&k239d3^l~^p&;$4}@v@J*7emYO~4LLzu`Shy-(dbsd|)guHccu6gP0@bWqMOy;Gd z!^;c0Ior%?cxjuGm-pZl4lkJZFJJ=mns+ra?}4hBCTw=@Hvw8nhvLTuf2GDE4=@qP zbBZK_P3m#!qF2|dGeDEM z=OpHy1Cpl9=ajoJn04#-xO%Jo87??P><{nvrag+&{s#yXEWVT5P3jitL-l}Ef$Z3w zZl3gn43tE2--&NzJhQ1C((`rg_7|H&{bj6yvp6@yshTVX@7!%r>bC zbmL>lvl^Ct6}6Hq?@gAmV8OON7ZIjX>U(9PCo5Q1Auo{eSevzR9tG7~rwF{6>LJ(? zfjk^5#Ys(g#l-Qd~whD|P6Hci>ChQF?UMlRqh?nkpL$DT?kjZ$ffov|(%^&LKi^|Y^9h%+q zRRzDjA2dVDW*%QskK*7nK%#Yg3oc!1Z zJp5PkqRyC)DZUS6Jz5uCG=o3oGh9()}Q>#HrE+z1mT5MbFvey# z6Y8AXN)>4rHX+E#k5|U5{MZ_60|pqt4A#J*HWi4>_41_o2or(e4jlH=vK|!(p(0Ph9=^vGd(<5Ia9UP6|3d zhSA3SxD|}~@?%@jbo1jj_VT6VY)<(B&I;_3ysTd}~HA6MMvO)L5FSs+Y)d|hrg zsi~M&wS!duH}j(@t_G7^`qmHBRFXYU*Uee#ZQUHO=Sgf%@~woneZaSl#-VCAKmK!e z3g4pq!pq2%yga6xvs7_PUhZLY5-)=-Uf^41UcYZeHDQw{zT z+SHbXm=)Ik0$0!49}U*le)Uer+Q^URf`XMFAIAtk!B5aZ{lgHP?;|+X5WK=A=;g-; z#8ZAHKW0f~Z}Q_H_^6#9v(+_}@wfA1A-W~y$2+Kl1eoI5bn|0-D%77J?<3=}HvgOz z$d7T@@^|IOHQ?LHdcU3@84sPFf&6$j7()UaFv!b~|2bdsW1E4kl-pjDrn%$q=`>;ZX%uaNhGtA{y8{bz*G`5dn<1y%84Zed`@|_CkKvT_F!xiJ( z1l9GfJkRwK?xv$hz?#q2drvWnCeR!p)zJ|0CPq$!E^*(uxx4MDNd|rT?HrLJNY+jCL zkNtGKzv_$@Da<}8pnh4}pz*kb6@ zN2p9Foh;OC{N4@UgLYwpfSZs$<%MC{Xi}d;SMtDE2;RuZ zAKFEo1u0GHkds_pAdUJ2B-NN3X$}cAcM&-VFau3LT>US#&s+da!EtM&O=+%r^*p*H zR)f-wR!{o4Lb-?{;9@Jrhd=+XL0Ce80$eiG-av5NNZn!#p$# z+H?0W0r&C4eBYNiKyWxWMwfH*6jc;TyeYFxr#G2Am6^Cm^Fu$h&xM8K;&`$Q#kJLV zs8KT09Lz9t1>G_`Bl0Xn$4RTMp^VyY@I;WwPjSp@CC#Zqhy#pty+HsSb8v_#OWrN1 zo(}C!Xo|_|V+X$cilU4YS=3QZr&eY>vM1Mq92Ekfd?&BcUSd&-7yJ?u8f^$w_y{#MjP|w& z?F$--b7|O9JQ`z2<2Xa3t&hfT!_3|mjrv`nu^(tG%cfI$htKqS?b+2ie0B&r(k0B{ zvwYPA3mMK7d7R?x`q^D4`uMH-Ts%QMH&KSM>K-tLwEip}#GI_3^LJ<`-hI?rNb8@I zsd%f~*=(}@{=rZ>j)TV(e; zMG62rps6)fw_dnox|wvVD~R>XC;np=lQcEHeRqYpKDpbSni`j=?uIkv zF)f2#kIY6lQ^I1&IPbsaaUFcCE|icD-q)&ZxG#0ro+KED?6cymqTR>I<^<#{j`KL# z6lB1IIV=87ashD|PFBz~L|>|LDVUCf zu%`GhMMP}`49%2d#yEMn4)Uo9n8(C{`=K9I0hj^hLR`IoQouEVgjp0P_xiap0kf(# z=(c&}@ZkBu?jXgyKaepolT-K}9Zu&=J3)&xeTS@J zCUp~Zsm_D}1L?Ve4mV>B7pE^hBhShjLB3SGv_nTeMl@67z=EH{e}HFozTxm}ABT&I zwJy4O97ZmJz7f1>A5~5Z2hYctc{A0~AWY5hEQ#7qL42BN$9X>nnwohRS5GtZjAovX zxtfW5376kI%d0c8)N1fb`sb7WjY;&^pjlmM=uh_1FERAXE&8)SKXEjLV;y3hPZXH% zcirb>I-py3P!XZTX7FIz-RI*;f`c98s|)yOZm1yoaz^bg*cf>qu|CT^EvEQ!Rb0M& zP%na4DSY`|#UCzw<8TtY@a+z2O3@1^Kw8KDiL3xD{*SBCy?zg;im&nX-jvx#ffMKa zjbqmdRhP?`>kk)&h*4UE_rn>b} zr3b?bn>nVhsB=*MK1Fw+z6)QNR6!#Okl#iV!LoB2+u@#@ga+ zL74h2#rfhvV1oU;^TpU>8KG+$i8bbE?^{qg`>k>5q2Jlb{W>ss$-d65ZqG&;bMk~! zd``!dI1)BUs*i5K1gwuv1w&@PCIn4z&M+&nV12|baJN1>n1HW7`W$??8|Ct8n_Hor zhR$f>7+tQoC7*tupmVp8`@smOkxf~z+%o5{ZT)lxuW~%V+2MaYSvNyK%WT&(+?dZi z63%BHDg?dItrtRb?0|niB_1cYSc&@k4t1jGG7VkaFFRTQPzRE@e$EP`lWGE(3vgGh zy#Q~4-?F~?VkX7X_0>pls)nI^qLT!p>F`zPz^8_{(F{{W9z|?W_k*Orns^7z>N=n~ zW7Id}Bl&v93Eqs67dU}AF2neV#Z7Z29s=Ile~|OV%e5ox^Ti#LW*)?u4>mJr_-5W= zWZij{BkRPoH_tZo)o0+xFU0;N^%Bq&Vhyfd+*)HuJ?xUos67=NtA~Iv#o{Wt-J~vN zRA>Ve1d7GKaXlm*7jyIZt%$B(zRpZM=D>O@MZ067POzvib$;%HMZ^5Oi@8XiAL%zm z(H-)A*{7&;)Gi2uoI9}(au;_qitw)>cH5B=IT^MVFU*9}SME=X#NxDqnrcQIu6+>B zr`AF?X3BPG*Yo`0%4h;uwcjQkjak$y^wfb`aeN}0Lu4^vzD+8?)!h=5LxLyGfL6Ie z-Vq0?SG0#Y1W|}KhR@9)nYbLOLi6eBx0BZAT3PpQ{YZgBi5H58f zNDo$v^*rQuBW72(0j9&;fUD;)3%b+8>(#XBj_+keZUz;{>+ci)&|W_scraVb=`cuQ zjjELna-TSWRw;yPkc;}A>ZPjJx}kr(``$pQT1=1TJT{wD^{8&%m(7)E{AgcrovL_)9pJDM!L)tXfD`V+Vwz@67zNNqFWj*w8vtI-J`ueCDP5o{@1i{cGk< zg#LdE-h9;>2OkXSdCfT9Z0QeReD}v2^2>g=OOq2*&(Ix9Vk7Zg_6y{JRXdD_g`9~? zeIy5e1C2zwf(5bKbES9%tV8yk+It!2y2VB#mr^1I+XQ1h39dPyBtfz6agRT&1g!N|_ z&f5TC#QLk;Zc=Y>ZB2s^fw;64bq3-RJ;3)6TT4B{E~VJ>#d31j2T<A^DO zNy=+fF-zv$hJzen!ssNrwqV&lpr}R(4-2Hb7%Y7A+NO=A_UQ;7pUY;aHKG*jUg=_$$7QleTv7%6MeNh(70aeI>^z9Y!`N$FA7}nT(7&FK;&lott ze4yH_Ntn|~FJqpSG${N)WrC<0jdoL~EF=>bisUb-zPK94hSXep1((q>x<=uSqN*qd+{_ zgZJ^lnF;Q?+xht)8dkTF6CHlcdR-4TRV~n5ub1QMt=Fc1!;BDZ_@%CBk<#5*{_elI zjszjWq*e>Y`$R|daO6=ZB+WOF^R+hfwe-z5ohbnGZJ+ARw-F>a-|Wz%weiXxxZL$C zv11%kmx2Ow>~#=Od?9)zbsQJhzd79P`I-ZXj=rKYr|F(Nn?n@-=?g9+e!$Od7drp# zFu6SO7aD5Mz&jgO9w3^Jv$xvE%y*ROfnSH(oa(VpK2PJx=Mqdqn~#FLU~tZ*8phrL zhOD6yGB6H|;A9t;8-I^yAJB#iv&6wroP7RCy+~EW+PpMGpX~Yus}Aq(>(%2B26H-# z*M9(-zE%4i1?qr#5>MjJ#6vC;vpC)Z$&6aQ5`wei5cK{KXx?%p3sH_NvR448Tfl)R zHiz6LFS6@MC$bb>vB>TPK#}xUADBxP*(^=MEV7Xh+g)Uf0pJK=M(w{rVCJsoHPh6N zDejUx5v@uArf+V5JsFBH?~0-j#_`B)q9F0k#3jJ%`pTBSjPi#; zPs=|Eck|R`-sDTbwHj?EukcNtVnD43Mv~6ahR$I=I-xu*L^F%d z8hBZv3z%7sAc9|RfrYJp1PP?%UpgZto1=4Ap=?4*Zh|8lstbssIim}jCp9HLZxHU$ zJPsFiux_s7Xmf78haQdJ;uKOlFuAk7+~3FLKcAke-ueXY01q@<`v0AJ>j-fAd+Mzp z!Sa8j-ipKMCc3WzNw40jK?9fBAP5QfU_o{id@)#WeF(e!-g>JM`uvA>a9C) z59>XLiy8=4yn5?{iD1YVzxM{?Y7Nj_BhTWx48Eh+$U7&445avHjY#9wTlWEB#Ck?< zH>sgqYOUxg{_|x2H|ni}C`2?(y|oka;8<3wdTS+AsOznMqLe_rbrMdN;sb}@S8sKq zsJ~rrT_~!PMBx@vDeA4y$uxdR$ zV5gMz)~#szKd!eTnAfhi@-VyF2$>l8y?Sd7*#JfzLw8F~1${2C>aAMaB$kls$i?-ue&||3x<HN~nt+xu{jF{6|yy@z#XEAx2dMg(se^0%2 zyyh}X)seg8MV2_vs<%3WX!0UE$Oy{ntC`vX$X#Tof@q-Lnq4J}g*k2ox~eIF=_}Q^ zdcHESqxQ`U#(BPJ*IQSKf_|mm$|c`P_13=La9X#cm$8L<2&}M5MhPLp-wNI|jjrhTu{kS%|;E8W@Z4A78=ceq7Y`W9Tqa z+10}v@Q-L@)XqmYH5CmE!sVB^9(63-fuBTTPo#!TU&6zB#4pcpR9w;E?z7Eog*lvk zwllz%%0M?WozCzXwP&D{I#{M=`O_o16Z+B{P0Uw&AR}rYG8h%coxP@S)hfEAs0WHa zQL6`memc6=N0$6(_7SmN5ROOc0Ak`&wBfQ8kh*8IE6oN>Up!-v?7u{=zylv=u5igi z`zyt6P--=lx|T{+6?#0DCga2ck>DFXpdJdAL11!TAoCouN=QA1F5LcczeVMa z*poQDih$c59pqO!OSOi=hK2_|n|L@t(~P+%Xcnx^J2jok!HauJC5k||ANaK6-$+|@ zv2@FlZX!GeWx9j#9`KRmLG3i{e7oC}GkMp8$y!%wuMi?YO>=7 zgnaYZN+mGDv8DC6eRnC-)^P0Ezz-e*AOz*(SG`SekUGgByjGJ45T0id290i-MqsPq zFipeMmwN!Mq&s4zt9*)b+emjEyoN><1I&Cg6W3+>!O5I!xnu;*qU+0LT+Ul%s6>ni z+PG>?q@iOgxWdAxuHbq@zFmrW9J8Lff-$FNxVi_(&1Lh{VI-oLEfx}K6qAjnhK=1I zY}i0O`17&Q7URuukCkU2jrsxz6TE(w+fC|jc#abP^gq8H#Q=%-c*rQ}_RCk%DcVj4 z;lNswgEabFYy~Cu@qHawRwY1FeLZ}9-(dLe=Mv4<{glK+nX(5o z8B3zK45FwSLvM_a-d%>?c^18D(mTeX7mgttdhZ+B3fGv&$kjfP=g6hsFeQG%ZjZN5 z+agitgEJG+0DP_w&Q7!n!0&J^bKe-Dd*(Oo6NL`!CI%~8IC``*Me)onS!yB#gl{s` zKL8D=N-ePXm+`v;xX{e&r{xfee)S;f2> zOxy%V!fPqYnD|cLGczP!{t0~$ZVR5n269OK4fY6QUpvBFl@XZ=g-S5K9=gY4nB*Ma zw)Y_zzz3*SNI>j~ZExl;v+XTe=buooJchl1dD#a$)SbYqIs$)j7ov7!6Z-H9rcrhO zP#{f?`hhHM!f@oMY$sY?2`aG#I!`~Dg(31{jYk%llavBOazw2!Ak3Dn4g&85(W3S^ z<`PDC+;%{Q_kNRz?5BSL78oxNfu14HoToIb_tR^r{O8D+{e1Te+4n!+U4}l`Prn?8 zRejHQ6;!J{-$^j{Ki`?yj$cg=cS`WDg69xcbqbT5Sfi)TQv1>Yl5*nPnvrab!60`F zeh#?Eh=gHRFFGPHb-Uq8|qnfZUwe0pkm1 zHtaL`ApGmIBaRA%{$A1anQ)`mPH)(#{d{z}8wnO-pt=w+jIa9Q>MfYlAQ=NdcNCR6 zDAWv*@yxqRg@k-V+Z*k);g2v^Vl|el+Sj9>Px`xr!dmq`t{(mS4E+zw9QqUQQ<*T? z<~!7SO_Q^78%g79{Dt4&!&fm$=Kn27Jgi|MQSmu91ql!aXeBC@bAMGTv-+F)loM$XR~<^(oZ)JXLAOcy;qmwpK0EAq$DdtIm5)KOJyVJ#sKAVYePx&cc2K-9~Q< zIC!NWfGhP=R)6ejn{|`Nby(TV!K<2SoD+Jw|C3m~^0_mo!5obGqMTxuKGLr|j z(X<&V-EQyU(K@izaJr_Q?{>p>z}?B+>LDsPmD0?4IW#)C+tz`c&DjoMji%zzo8yv; zFhcDfK!o!m2s>6lTH66}kT9`Y-Uny&Z5kBvzD1DitYxreaP)DibD8 zE`8p|h!ooar{*&y)Jx21HU~g*>67gcep-`20+4QIpJ9eY7^Tl&HH|>&(^Atg+X3GI zT1l^GS&~apu7y5L@OU1L>T=QV3#ta!Wexb@p(fb~8G1gAsJ85Qq87kWWlhDS+ zc_a-T+zwcTc^tEv?SK(#K9HM-;CqaHNyYbE(v5ul0E&Dr`5ITl2cAo|F%=@@y>p(& zi|hxy4FqK3Qu|77H>vC4I;y+O?fd;8vVHpN`vIMHy3bL5hfka(Eqre7OObti&wwQA zG{bjiAKx<%(tIE3@g3L?=mBn_qycdH)cXNDcaSG6K(ilkfN&C0FH&3|A3HI%dID(b z??GHW{k>-RxUs*hzu4Jstip=gQ1R@$cCW zs3bRfKj2nqK=lVK^*;Q|_+8_H!kL^g;Da5TR}M&#e{W*Ab@l`J?@_2tkPPvW4_;2N z>x)k6TZof-Kj3YSNUE$Gjc3`u= z64UlF`#af*O4F{NbrV+#x%`kinzH!(^c?6=wFH{>Y>MkL9dEGC#~!Hd`OUeaN9r_^ zwHx+)8GkwZ1(RW0>=)e6C3DVCaxZ%a&NIB(FW3k6lKlcEvy8}cXTM-5Y?E@oAOXI( zU(ma$4$9asV1hII1(KGI?Q8Z6+JI#SZtNE{22O1O!?ItHjlo#Y%(H3=k!HW33+??h ztY_~Ryb4KT3)-VEepvw%wST{0DI}1`3dSYOmaV=d0Zhw1gP82?bIX7q$zX87?4lgi zPiszf!1b8sp^Omzy$fz(%-qo|qxNgup}NVHoTJvCgE7&f&Peou9fuPj1jG8jU>xo^ z?6!9t8q<8eDVn|Ga4obD*m2mKti;;vgR_nQPkUD%9miGO$ChIp?8FKQU?%~_X{$_yhmb9=+rBow@J6`|i8%zWY9A z?#OlG@Eb5dooc=aIC1y~wD~ms=RI*)EUR8M_kgU@Gdm_FR;R)4IB|F!v){_QTjYtu zn;{aZ(S71@9Qq*aT%#}J*E<+v+WjgRk_MbSE}y$!^5AKA6rz@<-EZJVoH$&D6Nl#z z$WcCVnEOMV2D~_StOeQJuW%2`nfp0ld2~FzQjU(9U6e~Nz*|XmeoPa48!G20i|0T> zJ$N^CeYy`rb?)QkDrP`8cZ93B%T>i&AQw5XOsNW-H%x&E&KqtnbGVl{v@?e$7l)s+ zknbpQD4jQ~Dl_OL2FsX%=3;PZwG`o(U8=s$p==mU_!kq8$3-bVK#G3Mg&8*WISgNOILVI8?5aq{qmmtoX=-jK(zfpwGL zIsJX$`MhB>CZ@S-A@m=8-taU86^>!`OMd4KGvqNxe}{@O))$>#iCY{k{BlM4>|hf; zvc+fKX|wlRv=7-&QZ}C*tdiN+Q}z#J_QB=I?!=gam)2jTx?{mAw`Z@^y>@5Y~zA8R}O$QU}e?eP710B>l^&pX995PRS2;X&Ju-8zA; z?>KhHRNLX_=e|eE#D{YJYwi=MhdxqB#!J)6Q#6VmLTS0_LeJo&74h#V0Jl!p9k6m5 zpFE3`zvK;C0ycq5VzU%%#k-Nufi=IF{B2}^3$oB!8qtn(f7e01O)rv(50Sm4?MRp; zIzoy${B0VfuO}IQJ$D#{w_$QPMlBVd{+G9DO%&8jO1%p1h01+ZlzW~G{26pJnn`~H z;SMzA=6Ac^P#oUdcFcUHH+6{`~Ty(cuw$5 zsOI!)6qvgcIpXj2qJQuV>hWdYfrJZbK?4gKSkS=#6%7=vgq2F_Be_(+p3U`}Tej@# zyUk2mHx&~3En99f69=M+bh*nYGql7iurYGI?v<2Tu(KTGq22 z)trIEJ?qXG}n zWEO7a_6;Sn{b_Uk_V%o07P5(SOUg|5M{~o}4xI#CBPkqh5+yI3Jk4g(A<>24+iGUb zLMrKM=mq5K68J*!jSeO7FP=+}mswv}zDgCHsbVpe9o*2K9Z94yBKy+0D*A zpf$wip|vDZX|rFqa(XhC$)`=rOpojRX0kAzxAZ)Qt!Zgqu8iK3J&?_fW_2?wsRzJn zxL``o-ZDk=_F)j3dUiO|XBPbHRh+njSfP+B=ta}A&?dd9sae~THOKPsE|9pbvni_D z;;rm}IbPI~L+})dnsBN4gjFS!O4|1-3@aqakp&OH3iU_@>wV*vS@dtGTfa&IZ!0p1 zBpNJrtV$>yduaz!1^8Ck-QGMXDnP~xw3QfSJ$RYy%A48l?haj!Wj&k7$d2wxWVdYD zV+}NPTLtuz^V;LE_9oK9=Jx9<>O{9x;8G)6D73-(FPq42zz?1r>eaVy)7!gxjLxQg zaGV80Uqc>U^(ow-4nOD;Rp~L6O<8)75}j@Hwx9F-gypREy%o(6HY!x*WhZj{n2C&7 zPp3YRMqj8Vk*!OWm&a?qki(>e(MoMfVYt7?AmVDIDY&+;5xvAx7&6P-2)y3>?qjw6yURf^!>tg(YEI)AMgqsV;;3^y8&?BFysI{ z1vmlt;0SCFFg=RDg9O-tz49x7w~XU+ws?5B^*xXau;ab9od%?M;z__$e*yXE{vO+Y z0WkeRv;zkoSKo*2JK)xjK`y{sK4sev6aKTd{Vd>$FWUABoQRzId)wX$NPllU4fyO6 zw*4Sr#|-pG`LO%n18$v1d!e^0*zYZR&u(qeSoNZ-R=jT6B=mPJ@OW25YpA#FJosyu zR<~Tb>c*AJN0&`#@4Rx$^|jYtLq(~4Gky~{$nQuKjuPQ-!EX%sUMkNC2WOgv-wa;c zMe{_`@&6(GP60PSnAoM&_biTHvb5!B)#&RX(2nIoo`;dO3a>^#SfaV{lBK;w(6szU z0Io-Bo2sQo-vLdeL1=7e7km?Kqs$k=+5BN5S(cT$gCkhQ)(KwR1VqkbU>VMuTWb?;in8HSCrS zg-U#)N2~5yviQBk=|G*3$jk4p*XkM zGtis_O$WyC171EKEc1B*G$&t!hT2z+vE7WZ|2-!kYTxIneVrwpHh}Jhv!Lq*-ACX% z&eWHOK-U4EQjNay^!W*@8K$l2$T|VKI{2I)IOQXKJucfxZTKN*=0S5NUi8@I8ThLp zUc&yDKz{hLkAt=(SIPdX8Wxdo7y#>#-2vKV@N2iycvoY%{XFADA${gVD+(6znaw!aX>KT<{fTNM4Xpg#%!`8N1FU;dvG z^lgfM1su|&@Uv%2zZLWk!5=?Dj?AyUErLI}2hm>g^9`TGvyLEn7B5jp5GJyM=&o2@qd%(uaf-hz_;Na&z}Ak(2t$8 z?c4FB!&m-+rEEP?KSx1-@?UNH08J8p`h3|<{}||(&Dr*sonxj=*;^Y7u2UG$PBfV8 z^97P0>xe7g?%>}d>06F2jiEr~ZEQg#!qw=fRi1eb=!LYPfdvgLXkbAD3mRC^z=8%A zGyn}us|PO(C)E9db}py}XsJtSY_){y{sW%-kMccYGDP|`->=|%O>FWt?GnCkTrN2= znO1#+yuXU`X+2EoN(nTb^XZI;5}glFdg%`~PV%t-#9o^cwiqH!;!RpgSb~d0e^rzc zMKDo%i7TeP2_^B?9UyHxMQW7tFk5Ys_AE$r&P0i}RFv={w@CTT5-NNzKFCH%$yv=8 z%%)TyUbqtS&xR$v&G)Ka9Gi*!dp5}YSNUGGOJW!P|NpLmv8`(4xmz0Man;B$&ajtZ zp5X+;NrqDlPcWQjIKyz3;XFg_&t<*U40VQKhK&s440{>o8BQ>qWH`m}1jA{DGYn@L z&NI~T!4XQ;40VQKhK&s440{>o8BQ>qWH`m}1jA{DGYn@L&NI}yxqgN^!!W}}hH-|y z4D$>p7)~;rVt9h#G{YH&vkd1MYCT*(L!DumVI#vh!(N7Yh7$}Y8BQ@g!El=448vK5 z^9;2;Tt7pdVVGef!#KlUhIxh)3?~^*F+9O=n&Aw?S%&irHGFi6QZ+-JVVGef!#KlU zhIxh)3?-M!|9hkU<4aMhZcz7|R{PVp2jE+y(JlJgJ$-l~WLV!EsttwLM>Y+M+sONB z!l7{8brP*Acnw&kEz%xR6NH1VN?WYaxwJP`VOCS~qcg8cTcW9X(T%@IQ}d@Azf@E6 zkQ@IxP0e3!{4!0=gKqrAnwl@&c+Aeq-#9X=G(2bV#jnsNefqTutBfgMJXR+@>%=OA z6{z)yqgrUK8U|O{&sExGT8~dZS7~q1PG0Fpe|c$rm4`#O`6|4 zP=!^<(00Fiv8v&9jGNDD&ClMeu-cmT83$FGT9uW#P;E=J--r)#m9cmRgPXVZ zSvJ5-* z{@oHGo-N?=UBDCneIEV=;7QMVGZcuV^n4t6YS;XS1X}x^1lo6i_iNWP0r;N>;NOad z`0?2gfVY4rd8YqH3L>7l;qsdS^#2@yr{HelGjYGzC zgPz_YAbk9oj1^ifHu?C?(*Klx#aSId;!fcKMU9C)&mXFUG) zL;(HofcMk?r8qG0 zbpZaK0`SiPFYMpr|6dKDZ@|*cuijSRiO=jYDZlbF?`FJrei;kk^L5~Y0DPA3*<$0Q^NzvR`}O z47{KI-wq_nKXt@yKaBzOdzjwq-?9Ppe;t7TaR44$BVYNi03Jmu(hULlp#c0r;HkY~ z_Rnq1@uLdw8Ao3V;PVsU$q&qU{NZI#zMq`&0DKa7q5nftkf&IlhXUxI2cGJk_td-U za{qd-4Zybr;1dD(@c{hs0Q?icQ@bWUB^xB(nZo6YDf6cPs;-09Xeb-89;wEj)aI_e?ZcUcQA1|0K6Z6&G8DpvA?Sp z@hr8eOunP0wq-b*v{Jcjl;amEq7eZXvE4hnYDOAr!rpueWNh#1ju`bK(j^v)X-2^u zq@clqQGUDM*x#|q$mIHm)25azSVe1iU?7x496^cJ${5LXE{otH!|2Z$gXvsfB5m|r zxkAxM43B9lP^&-G5Z)N}Co%>Q6=Ea`g~Ygln8m_4VjK{%WAqPaGUF)XxHBkz#6@Zt zExVgKV@9m2*)Txd+O@}swK1}-c{f#A%o#FpP!m;Yf{SJ}-`v&I*&YQ&PiIsyXzkdw zqp8E#)zZ=(>oIzoc67wRc7Io-PR3lQ5Q*lR*a+}Fdm{}#5f{e($`X-?2r4ZMC!w9# zNGwv988;j#jlyY+mJ|XXMTIraAdk8hgndwVQl|&?C%W3vpZlrnH_A|_NTkagZ7Jk3 z6#W#7cXb<^+Kah#!ZKs=ok`qAYC#}rd&cu-EJY%q{N~tL(#(@-Z5DWna*Kh!UIcf- zgbc1hm=GH6qm4)yN}~W21fHBz6JmSgMzlTN7Taw^d-fSwbJVXVNb+-HD_f=%5UJ}K zD&$5>?R2-UtWS?HB7Ds#B9KX1fvdMjOzNmeI9>|HZ6|d$sDX%DB1X-oE)3aRemv2a zHp`Sfg+$6Kws+SUP%7J5R~k_4IPrf(RGrW z>^fNT#+spbeq3~6!Dw2c1Lpjou~#zml5bob5io?S-9%p@~; z(j6JDlr6Hc+q7Kqz_FCe{Cqoz;?dxdqy=}U2D1qZ!JfiUT(P3J5R_`<6a5stMKx7e zQoRTq7w)Xm&4szsSeSP5zvdWxW^yb+-c-c$H8!?(wC{)-HKCeNJ?p(@Z$qS^Rm=w% zB#0fyq=A@P;d~lW9O117VJw~zN^p%LVK7SIjXN;+n1#CLgq4W7%-A)Fi7r=MBjHxl ziVhc0u_c<CF@ZAmhR z>nxZs0wG#_XY6LosE8qyT{t+LDD-3QPn(IN+1MD}x36hOyAcW1mb-Ct6qyBbETWr? zM6qZVEQ2CbD>`1SNj9}4Xqp=rUe9l2$-&q%f+?-r2%6B~0!!l?9us$R+Ued1pVrkK zH826y7@JEYTn$*yT)l~n_nZciGCZfxRnFKoG1iOFZ}+s}o)keIiL{B28+0cT2rJll zJ%Uvb(|*P1l-;>|w_(!UYaoOeUIU@+1|W_uNg3gzIc}%(`Oac+`3}Q1mm(49wC#;z}c2B+^?wT#O(%K@M;)R@*v#_vHLP%8!WwU3Y9xAru zs~-vSQo$ZZI6l-ima@v?u-mItz34r3iq{095%($#viIz*bj>tzV`BCw9!PYvdsaHj z&LFQ`+ng%qb461+XLh|_0V6fhf{A8Ivkmat!n^H6Q8`LCw-G%j3ls!^tvs@z6T2Oj0sn?2myVAnqXL2+yKT~ou zb;8Xwk(+UQ8CruxHb?0rF>*b>!yHPCq~zK-QrDg8H)EKtl9pIB$H~WSj;iHFOqj02 zJFCX{dUKvFpk!VW)nY~D_BNX!2n^DK`=ezgNn3K8-SvhXDPqAzp3+a_fv&^h@qETr z4Md5iF&}hczvh<7u>otPZh#^15;mx4s8@@)M za>-cSjwgo6A)m_|R?f&I3I|00devQ;a%k}_SD(E2hR!PI99pWolvzt%-IRv;nEmmb zSiZGqUHXls;-XC19Yi8~Kv-KNj~K`(OPfZA#ZoQ-uTwdX-i4{T4EBsV zAUSycc6YN{!Zh#%?w(P|KX~R8KZm5IYK-$uL_TO1BK0@~6z7}SqL`!HtLxi@VbHET zQqv%IT?%mCalVvrb1rK@WVM8K$`*5n@K5U@=aIAm6u-s&(z3<-ic?^qTh>ZId+WEp)yI1Qm>2rYR5DBb&;HP->lyb5NKGEycv99&6#j zOfE|cVw|fOa+kwL%f6j=e)5vlss}eNn`ISy_USbdEcsl+Q7)myqXExi_I#|8rfIbT zs@&7mi7iEWLn9CV=-v?9c|6^+#+xjhhV%{Nq*nNeii3~yomn9oZIo+za$?0QKA?$l zuZ4=^87t8TXcZ(JQdilWWrhZ`!y);pGizK6l~8@dsdWGPRKF$&h7!dgE!01r1v3e) zg3Q6nsE8*mt{Ve+IGsyS0lvzoEiIIy)mjLbp}`zq6wRa-qJ5wi!oh3`)HxiBB(#t@ z#Lv)%`oT@zNgncHnk=ENsT5TT2139@CI!x@hw1}HFzqWAwGbZfWpKDEA7B2_|I-`t zcqJ0=UdyE7GZfSruK-?4bfpmPoaI#h>c&qX%Zbd;Azp3h1$`p4)vM*;+awyzAxNw$N@iGdEZ>lL`K=q7X zL3+KySzg7}D5&TZ3w5vHUwO)__!|Z3eQIY?JxWQ zz)?-)11PEYao2MBxTpQ9oTS#Y7jZ!*qROi{r?GXi;5?V7@k>dSSM9nVIA{GT9%?8g z3x15ti^7ibiqHRe%9rA%!m?nS5{wzBatba58Br>-UVd+=w^o+#<#Gz>>Vn}4kP$Cc zUd7!^bNL|;y{cECDb9*&3M&LdRsMPpUP>j)P!`=Q+jWx8bNw@TFOSk&@T? k4G$$dE=y^e0*{a;JPu6NuL$uvrf>Pieo5&KtMiusU-vRW=Kufz diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/binding.Makefile b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/binding.Makefile deleted file mode 100644 index 64db4339..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/binding.Makefile +++ /dev/null @@ -1,6 +0,0 @@ -# This file is generated by gyp; do not edit. - -export builddir_name ?= ./build/. -.PHONY: all -all: - $(MAKE) sshcrypto diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/config.gypi b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/config.gypi deleted file mode 100644 index 47a76fda..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/config.gypi +++ /dev/null @@ -1,92 +0,0 @@ -# Do not edit. File was generated by node-gyp's "configure" step -{ - "target_defaults": { - "cflags": [], - "default_configuration": "Release", - "defines": [], - "include_dirs": [], - "libraries": [] - }, - "variables": { - "asan": 0, - "build_v8_with_gn": "false", - "coverage": "false", - "dcheck_always_on": 0, - "debug_nghttp2": "false", - "debug_node": "false", - "enable_lto": "false", - "enable_pgo_generate": "false", - "enable_pgo_use": "false", - "error_on_warn": "false", - "force_dynamic_crt": 0, - "gas_version": "2.30", - "host_arch": "x64", - "icu_data_in": "../../deps/icu-tmp/icudt67l.dat", - "icu_endianness": "l", - "icu_gyp_path": "tools/icu/icu-generic.gyp", - "icu_path": "deps/icu-small", - "icu_small": "false", - "icu_ver_major": "67", - "is_debug": 0, - "llvm_version": "0.0", - "napi_build_version": "7", - "node_byteorder": "little", - "node_debug_lib": "false", - "node_enable_d8": "false", - "node_install_npm": "true", - "node_module_version": 83, - "node_no_browser_globals": "false", - "node_prefix": "/", - "node_release_urlbase": "https://nodejs.org/download/release/", - "node_section_ordering_info": "", - "node_shared": "false", - "node_shared_brotli": "false", - "node_shared_cares": "false", - "node_shared_http_parser": "false", - "node_shared_libuv": "false", - "node_shared_nghttp2": "false", - "node_shared_openssl": "false", - "node_shared_zlib": "false", - "node_tag": "", - "node_target_type": "executable", - "node_use_bundled_v8": "true", - "node_use_dtrace": "false", - "node_use_etw": "false", - "node_use_node_code_cache": "true", - "node_use_node_snapshot": "true", - "node_use_openssl": "true", - "node_use_v8_platform": "true", - "node_with_ltcg": "false", - "node_without_node_options": "false", - "openssl_fips": "", - "openssl_is_fips": "false", - "ossfuzz": "false", - "shlib_suffix": "so.83", - "target_arch": "x64", - "v8_enable_31bit_smis_on_64bit_arch": 0, - "v8_enable_gdbjit": 0, - "v8_enable_i18n_support": 1, - "v8_enable_inspector": 1, - "v8_enable_lite_mode": 0, - "v8_enable_object_print": 1, - "v8_enable_pointer_compression": 0, - "v8_no_strict_aliasing": 1, - "v8_optimized_debug": 1, - "v8_promise_internal_field_count": 1, - "v8_random_seed": 0, - "v8_trace_maps": 0, - "v8_use_siphash": 1, - "want_separate_host_toolset": 0, - "nodedir": "/home/volodymyr/.cache/node-gyp/14.15.1", - "standalone_static_library": 1, - "target": "v14.15.1", - "user_agent": "npm/7.21.0 node/v14.15.1 linux x64 workspaces/false", - "userconfig": "/home/volodymyr/.npmrc", - "metrics_registry": "https://registry.npmjs.org/", - "prefix": "/home/volodymyr/.nvm/versions/node/v14.15.1", - "cache": "/home/volodymyr/.npm", - "node_gyp": "/home/volodymyr/.nvm/versions/node/v14.15.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js", - "globalconfig": "/home/volodymyr/.nvm/versions/node/v14.15.1/etc/npmrc", - "init_module": "/home/volodymyr/.npm-init.js" - } -} diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk deleted file mode 100644 index 095b21e2..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/build/sshcrypto.target.mk +++ /dev/null @@ -1,161 +0,0 @@ -# This file is generated by gyp; do not edit. - -TOOLSET := target -TARGET := sshcrypto -DEFS_Debug := \ - '-DNODE_GYP_MODULE_NAME=sshcrypto' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' \ - '-DDEBUG' \ - '-D_DEBUG' \ - '-DV8_ENABLE_CHECKS' - -# Flags passed to all source files. -CFLAGS_Debug := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -O3 \ - -g \ - -O0 - -# Flags passed to only C files. -CFLAGS_C_Debug := - -# Flags passed to only C++ files. -CFLAGS_CC_Debug := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++1y - -INCS_Debug := \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/include/node \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/src \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/config \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/openssl/include \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/uv/include \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/zlib \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/v8/include \ - -I$(srcdir)/../../../../nan - -DEFS_Release := \ - '-DNODE_GYP_MODULE_NAME=sshcrypto' \ - '-DUSING_UV_SHARED=1' \ - '-DUSING_V8_SHARED=1' \ - '-DV8_DEPRECATION_WARNINGS=1' \ - '-DV8_DEPRECATION_WARNINGS' \ - '-DV8_IMMINENT_DEPRECATION_WARNINGS' \ - '-D_LARGEFILE_SOURCE' \ - '-D_FILE_OFFSET_BITS=64' \ - '-D__STDC_FORMAT_MACROS' \ - '-DOPENSSL_NO_PINSHARED' \ - '-DOPENSSL_THREADS' \ - '-DBUILDING_NODE_EXTENSION' - -# Flags passed to all source files. -CFLAGS_Release := \ - -fPIC \ - -pthread \ - -Wall \ - -Wextra \ - -Wno-unused-parameter \ - -m64 \ - -O3 \ - -O3 \ - -fno-omit-frame-pointer - -# Flags passed to only C files. -CFLAGS_C_Release := - -# Flags passed to only C++ files. -CFLAGS_CC_Release := \ - -fno-rtti \ - -fno-exceptions \ - -std=gnu++1y - -INCS_Release := \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/include/node \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/src \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/config \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/openssl/openssl/include \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/uv/include \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/zlib \ - -I/home/volodymyr/.cache/node-gyp/14.15.1/deps/v8/include \ - -I$(srcdir)/../../../../nan - -OBJS := \ - $(obj).target/$(TARGET)/src/binding.o - -# Add to the list of files we specially track dependencies for. -all_deps += $(OBJS) - -# CFLAGS et al overrides must be target-local. -# See "Target-specific Variable Values" in the GNU Make manual. -$(OBJS): TOOLSET := $(TOOLSET) -$(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) -$(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) - -# Suffix rules, putting all outputs into $(obj). - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# Try building from generated source, too. - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -$(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD - @$(call do_cmd,cxx,1) - -# End of this set of suffix rules -### Rules for final target. -LDFLAGS_Debug := \ - -pthread \ - -rdynamic \ - -m64 - -LDFLAGS_Release := \ - -pthread \ - -rdynamic \ - -m64 - -LIBS := - -$(obj).target/sshcrypto.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE)) -$(obj).target/sshcrypto.node: LIBS := $(LIBS) -$(obj).target/sshcrypto.node: TOOLSET := $(TOOLSET) -$(obj).target/sshcrypto.node: $(OBJS) FORCE_DO_CMD - $(call do_cmd,solink_module) - -all_deps += $(obj).target/sshcrypto.node -# Add target alias -.PHONY: sshcrypto -sshcrypto: $(builddir)/sshcrypto.node - -# Copy this to the executable output path. -$(builddir)/sshcrypto.node: TOOLSET := $(TOOLSET) -$(builddir)/sshcrypto.node: $(obj).target/sshcrypto.node FORCE_DO_CMD - $(call do_cmd,copy) - -all_deps += $(builddir)/sshcrypto.node -# Short alias for building this executable. -.PHONY: sshcrypto.node -sshcrypto.node: $(obj).target/sshcrypto.node $(builddir)/sshcrypto.node - -# Add executable to "all" target. -.PHONY: all -all: $(builddir)/sshcrypto.node - diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/poly1305.js b/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/poly1305.js deleted file mode 100644 index a6953fec..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/crypto/poly1305.js +++ /dev/null @@ -1,43 +0,0 @@ - -var createPoly1305 = (function() { - var _scriptDir = typeof document !== 'undefined' && document.currentScript ? document.currentScript.src : undefined; - if (typeof __filename !== 'undefined') _scriptDir = _scriptDir || __filename; - return ( -function(createPoly1305) { - createPoly1305 = createPoly1305 || {}; - - -var b;b||(b=typeof createPoly1305 !== 'undefined' ? createPoly1305 : {});var q,r;b.ready=new Promise(function(a,c){q=a;r=c});var u={},w;for(w in b)b.hasOwnProperty(w)&&(u[w]=b[w]);var x="object"===typeof window,y="function"===typeof importScripts,z="object"===typeof process&&"object"===typeof process.versions&&"string"===typeof process.versions.node,B="",C,D,E,F,G; -if(z)B=y?require("path").dirname(B)+"/":__dirname+"/",C=function(a,c){var d=H(a);if(d)return c?d:d.toString();F||(F=require("fs"));G||(G=require("path"));a=G.normalize(a);return F.readFileSync(a,c?null:"utf8")},E=function(a){a=C(a,!0);a.buffer||(a=new Uint8Array(a));assert(a.buffer);return a},D=function(a,c,d){var e=H(a);e&&c(e);F||(F=require("fs"));G||(G=require("path"));a=G.normalize(a);F.readFile(a,function(f,l){f?d(f):c(l.buffer)})},1=m){var oa=g.charCodeAt(++v);m=65536+((m&1023)<<10)|oa&1023}if(127>=m){if(k>=n)break;h[k++]=m}else{if(2047>=m){if(k+1>=n)break;h[k++]=192|m>>6}else{if(65535>=m){if(k+2>=n)break;h[k++]=224|m>>12}else{if(k+3>=n)break;h[k++]=240|m>>18;h[k++]=128|m>>12&63}h[k++]=128|m>>6&63}h[k++]=128|m&63}}h[k]= -0}}return p},array:function(g){var p=O(g.length);Q.set(g,p);return p}},l=N(a),A=[];a=0;if(e)for(var t=0;t=n);)++k;if(16h?n+=String.fromCharCode(h):(h-=65536,n+=String.fromCharCode(55296|h>>10,56320|h&1023))}}else n+=String.fromCharCode(h)}g=n}}else g="";else g="boolean"===c?!!g:g;return g}(d);0!==a&&fa(a);return d}var ea="undefined"!==typeof TextDecoder?new TextDecoder("utf8"):void 0,ha,Q,P; -function ia(){var a=L.buffer;ha=a;b.HEAP8=Q=new Int8Array(a);b.HEAP16=new Int16Array(a);b.HEAP32=new Int32Array(a);b.HEAPU8=P=new Uint8Array(a);b.HEAPU16=new Uint16Array(a);b.HEAPU32=new Uint32Array(a);b.HEAPF32=new Float32Array(a);b.HEAPF64=new Float64Array(a)}var R,ja=[],ka=[],la=[];function ma(){var a=b.preRun.shift();ja.unshift(a)}var S=0,T=null,U=null;b.preloadedImages={};b.preloadedAudios={}; -function K(a){if(b.onAbort)b.onAbort(a);I(a);M=!0;a=new WebAssembly.RuntimeError("abort("+a+"). Build with -s ASSERTIONS=1 for more info.");r(a);throw a;}var V="data:application/octet-stream;base64,",W;W="data:application/octet-stream;base64,AGFzbQEAAAABIAZgAX8Bf2ADf39/AGABfwBgAABgAAF/YAZ/f39/f38AAgcBAWEBYQAAAwsKAAEDAQAAAgQFAgQFAXABAQEFBwEBgAKAgAIGCQF/AUGAjMACCwclCQFiAgABYwADAWQACQFlAAgBZgAHAWcABgFoAAUBaQAKAWoBAAqGTQpPAQJ/QYAIKAIAIgEgAEEDakF8cSICaiEAAkAgAkEAIAAgAU0bDQAgAD8AQRB0SwRAIAAQAEUNAQtBgAggADYCACABDwtBhAhBMDYCAEF/C4wFAg5+Cn8gACgCJCEUIAAoAiAhFSAAKAIcIREgACgCGCESIAAoAhQhEyACQRBPBEAgAC0ATEVBGHQhFyAAKAIEIhZBBWytIQ8gACgCCCIYQQVsrSENIAAoAgwiGUEFbK0hCyAAKAIQIhpBBWytIQkgADUCACEIIBqtIRAgGa0hDiAYrSEMIBatIQoDQCASIAEtAAMiEiABLQAEQQh0ciABLQAFQRB0ciABLQAGIhZBGHRyQQJ2Qf///x9xaq0iAyAOfiABLwAAIAEtAAJBEHRyIBNqIBJBGHRBgICAGHFqrSIEIBB+fCARIAEtAAdBCHQgFnIgAS0ACEEQdHIgAS0ACSIRQRh0ckEEdkH///8fcWqtIgUgDH58IAEtAApBCHQgEXIgAS0AC0EQdHIgAS0ADEEYdHJBBnYgFWqtIgYgCn58IBQgF2ogAS8ADSABLQAPQRB0cmqtIgcgCH58IAMgDH4gBCAOfnwgBSAKfnwgBiAIfnwgByAJfnwgAyAKfiAEIAx+fCAFIAh+fCAGIAl+fCAHIAt+fCADIAh+IAQgCn58IAUgCX58IAYgC358IAcgDX58IAMgCX4gBCAIfnwgBSALfnwgBiANfnwgByAPfnwiA0IaiEL/////D4N8IgRCGohC/////w+DfCIFQhqIQv////8Pg3wiBkIaiEL/////D4N8IgdCGoinQQVsIAOnQf///x9xaiITQRp2IASnQf///x9xaiESIAWnQf///x9xIREgBqdB////H3EhFSAHp0H///8fcSEUIBNB////H3EhEyABQRBqIQEgAkEQayICQQ9LDQALCyAAIBQ2AiQgACAVNgIgIAAgETYCHCAAIBI2AhggACATNgIUCwMAAQu2BAEGfwJAIAAoAjgiBARAIABBPGohBQJAIAJBECAEayIDIAIgA0kbIgZFDQAgBkEDcSEHAkAgBkEBa0EDSQRAQQAhAwwBCyAGQXxxIQhBACEDA0AgBSADIARqaiABIANqLQAAOgAAIAUgA0EBciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0ECciIEIAAoAjhqaiABIARqLQAAOgAAIAUgA0EDciIEIAAoAjhqaiABIARqLQAAOgAAIANBBGohAyAAKAI4IQQgCEEEayIIDQALCyAHRQ0AA0AgBSADIARqaiABIANqLQAAOgAAIANBAWohAyAAKAI4IQQgB0EBayIHDQALCyAAIAQgBmoiAzYCOCADQRBJDQEgACAFQRAQAiAAQQA2AjggAiAGayECIAEgBmohAQsgAkEQTwRAIAAgASACQXBxIgMQAiACQQ9xIQIgASADaiEBCyACRQ0AIAJBA3EhBCAAQTxqIQVBACEDIAJBAWtBA08EQCACQXxxIQcDQCAFIAAoAjggA2pqIAEgA2otAAA6AAAgBSADQQFyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQJyIgYgACgCOGpqIAEgBmotAAA6AAAgBSADQQNyIgYgACgCOGpqIAEgBmotAAA6AAAgA0EEaiEDIAdBBGsiBw0ACwsgBARAA0AgBSAAKAI4IANqaiABIANqLQAAOgAAIANBAWohAyAEQQFrIgQNAAsLIAAgACgCOCACajYCOAsLoS0BDH8jAEEQayIMJAACQAJAAkACQAJAAkACQAJAAkACQAJAAkAgAEH0AU0EQEGICCgCACIFQRAgAEELakF4cSAAQQtJGyIIQQN2IgJ2IgFBA3EEQCABQX9zQQFxIAJqIgNBA3QiAUG4CGooAgAiBEEIaiEAAkAgBCgCCCICIAFBsAhqIgFGBEBBiAggBUF+IAN3cTYCAAwBCyACIAE2AgwgASACNgIICyAEIANBA3QiAUEDcjYCBCABIARqIgEgASgCBEEBcjYCBAwNCyAIQZAIKAIAIgpNDQEgAQRAAkBBAiACdCIAQQAgAGtyIAEgAnRxIgBBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2aiIDQQN0IgBBuAhqKAIAIgQoAggiASAAQbAIaiIARgRAQYgIIAVBfiADd3EiBTYCAAwBCyABIAA2AgwgACABNgIICyAEQQhqIQAgBCAIQQNyNgIEIAQgCGoiAiADQQN0IgEgCGsiA0EBcjYCBCABIARqIAM2AgAgCgRAIApBA3YiAUEDdEGwCGohB0GcCCgCACEEAn8gBUEBIAF0IgFxRQRAQYgIIAEgBXI2AgAgBwwBCyAHKAIICyEBIAcgBDYCCCABIAQ2AgwgBCAHNgIMIAQgATYCCAtBnAggAjYCAEGQCCADNgIADA0LQYwIKAIAIgZFDQEgBkEAIAZrcUEBayIAIABBDHZBEHEiAnYiAUEFdkEIcSIAIAJyIAEgAHYiAUECdkEEcSIAciABIAB2IgFBAXZBAnEiAHIgASAAdiIBQQF2QQFxIgByIAEgAHZqQQJ0QbgKaigCACIBKAIEQXhxIAhrIQMgASECA0ACQCACKAIQIgBFBEAgAigCFCIARQ0BCyAAKAIEQXhxIAhrIgIgAyACIANJIgIbIQMgACABIAIbIQEgACECDAELCyABIAhqIgkgAU0NAiABKAIYIQsgASABKAIMIgRHBEAgASgCCCIAQZgIKAIASRogACAENgIMIAQgADYCCAwMCyABQRRqIgIoAgAiAEUEQCABKAIQIgBFDQQgAUEQaiECCwNAIAIhByAAIgRBFGoiAigCACIADQAgBEEQaiECIAQoAhAiAA0ACyAHQQA2AgAMCwtBfyEIIABBv39LDQAgAEELaiIAQXhxIQhBjAgoAgAiCUUNAEEAIAhrIQMCQAJAAkACf0EAIAhBgAJJDQAaQR8gCEH///8HSw0AGiAAQQh2IgAgAEGA/j9qQRB2QQhxIgJ0IgAgAEGA4B9qQRB2QQRxIgF0IgAgAEGAgA9qQRB2QQJxIgB0QQ92IAEgAnIgAHJrIgBBAXQgCCAAQRVqdkEBcXJBHGoLIgVBAnRBuApqKAIAIgJFBEBBACEADAELQQAhACAIQQBBGSAFQQF2ayAFQR9GG3QhAQNAAkAgAigCBEF4cSAIayIHIANPDQAgAiEEIAciAw0AQQAhAyACIQAMAwsgACACKAIUIgcgByACIAFBHXZBBHFqKAIQIgJGGyAAIAcbIQAgAUEBdCEBIAINAAsLIAAgBHJFBEBBACEEQQIgBXQiAEEAIABrciAJcSIARQ0DIABBACAAa3FBAWsiACAAQQx2QRBxIgJ2IgFBBXZBCHEiACACciABIAB2IgFBAnZBBHEiAHIgASAAdiIBQQF2QQJxIgByIAEgAHYiAUEBdkEBcSIAciABIAB2akECdEG4CmooAgAhAAsgAEUNAQsDQCAAKAIEQXhxIAhrIgEgA0khAiABIAMgAhshAyAAIAQgAhshBCAAKAIQIgEEfyABBSAAKAIUCyIADQALCyAERQ0AIANBkAgoAgAgCGtPDQAgBCAIaiIGIARNDQEgBCgCGCEFIAQgBCgCDCIBRwRAIAQoAggiAEGYCCgCAEkaIAAgATYCDCABIAA2AggMCgsgBEEUaiICKAIAIgBFBEAgBCgCECIARQ0EIARBEGohAgsDQCACIQcgACIBQRRqIgIoAgAiAA0AIAFBEGohAiABKAIQIgANAAsgB0EANgIADAkLIAhBkAgoAgAiAk0EQEGcCCgCACEDAkAgAiAIayIBQRBPBEBBkAggATYCAEGcCCADIAhqIgA2AgAgACABQQFyNgIEIAIgA2ogATYCACADIAhBA3I2AgQMAQtBnAhBADYCAEGQCEEANgIAIAMgAkEDcjYCBCACIANqIgAgACgCBEEBcjYCBAsgA0EIaiEADAsLIAhBlAgoAgAiBkkEQEGUCCAGIAhrIgE2AgBBoAhBoAgoAgAiAiAIaiIANgIAIAAgAUEBcjYCBCACIAhBA3I2AgQgAkEIaiEADAsLQQAhACAIQS9qIgkCf0HgCygCAARAQegLKAIADAELQewLQn83AgBB5AtCgKCAgICABDcCAEHgCyAMQQxqQXBxQdiq1aoFczYCAEH0C0EANgIAQcQLQQA2AgBBgCALIgFqIgVBACABayIHcSICIAhNDQpBwAsoAgAiBARAQbgLKAIAIgMgAmoiASADTQ0LIAEgBEsNCwtBxAstAABBBHENBQJAAkBBoAgoAgAiAwRAQcgLIQADQCADIAAoAgAiAU8EQCABIAAoAgRqIANLDQMLIAAoAggiAA0ACwtBABABIgFBf0YNBiACIQVB5AsoAgAiA0EBayIAIAFxBEAgAiABayAAIAFqQQAgA2txaiEFCyAFIAhNDQYgBUH+////B0sNBkHACygCACIEBEBBuAsoAgAiAyAFaiIAIANNDQcgACAESw0HCyAFEAEiACABRw0BDAgLIAUgBmsgB3EiBUH+////B0sNBSAFEAEiASAAKAIAIAAoAgRqRg0EIAEhAAsCQCAAQX9GDQAgCEEwaiAFTQ0AQegLKAIAIgEgCSAFa2pBACABa3EiAUH+////B0sEQCAAIQEMCAsgARABQX9HBEAgASAFaiEFIAAhAQwIC0EAIAVrEAEaDAULIAAiAUF/Rw0GDAQLAAtBACEEDAcLQQAhAQwFCyABQX9HDQILQcQLQcQLKAIAQQRyNgIACyACQf7///8HSw0BIAIQASEBQQAQASEAIAFBf0YNASAAQX9GDQEgACABTQ0BIAAgAWsiBSAIQShqTQ0BC0G4C0G4CygCACAFaiIANgIAQbwLKAIAIABJBEBBvAsgADYCAAsCQAJAAkBBoAgoAgAiBwRAQcgLIQADQCABIAAoAgAiAyAAKAIEIgJqRg0CIAAoAggiAA0ACwwCC0GYCCgCACIAQQAgACABTRtFBEBBmAggATYCAAtBACEAQcwLIAU2AgBByAsgATYCAEGoCEF/NgIAQawIQeALKAIANgIAQdQLQQA2AgADQCAAQQN0IgNBuAhqIANBsAhqIgI2AgAgA0G8CGogAjYCACAAQQFqIgBBIEcNAAtBlAggBUEoayIDQXggAWtBB3FBACABQQhqQQdxGyIAayICNgIAQaAIIAAgAWoiADYCACAAIAJBAXI2AgQgASADakEoNgIEQaQIQfALKAIANgIADAILIAAtAAxBCHENACADIAdLDQAgASAHTQ0AIAAgAiAFajYCBEGgCCAHQXggB2tBB3FBACAHQQhqQQdxGyIAaiICNgIAQZQIQZQIKAIAIAVqIgEgAGsiADYCACACIABBAXI2AgQgASAHakEoNgIEQaQIQfALKAIANgIADAELQZgIKAIAIAFLBEBBmAggATYCAAsgASAFaiECQcgLIQACQAJAAkACQAJAAkADQCACIAAoAgBHBEAgACgCCCIADQEMAgsLIAAtAAxBCHFFDQELQcgLIQADQCAHIAAoAgAiAk8EQCACIAAoAgRqIgQgB0sNAwsgACgCCCEADAALAAsgACABNgIAIAAgACgCBCAFajYCBCABQXggAWtBB3FBACABQQhqQQdxG2oiCSAIQQNyNgIEIAJBeCACa0EHcUEAIAJBCGpBB3EbaiIFIAggCWoiBmshAiAFIAdGBEBBoAggBjYCAEGUCEGUCCgCACACaiIANgIAIAYgAEEBcjYCBAwDCyAFQZwIKAIARgRAQZwIIAY2AgBBkAhBkAgoAgAgAmoiADYCACAGIABBAXI2AgQgACAGaiAANgIADAMLIAUoAgQiAEEDcUEBRgRAIABBeHEhBwJAIABB/wFNBEAgBSgCCCIDIABBA3YiAEEDdEGwCGpGGiADIAUoAgwiAUYEQEGICEGICCgCAEF+IAB3cTYCAAwCCyADIAE2AgwgASADNgIIDAELIAUoAhghCAJAIAUgBSgCDCIBRwRAIAUoAggiACABNgIMIAEgADYCCAwBCwJAIAVBFGoiACgCACIDDQAgBUEQaiIAKAIAIgMNAEEAIQEMAQsDQCAAIQQgAyIBQRRqIgAoAgAiAw0AIAFBEGohACABKAIQIgMNAAsgBEEANgIACyAIRQ0AAkAgBSAFKAIcIgNBAnRBuApqIgAoAgBGBEAgACABNgIAIAENAUGMCEGMCCgCAEF+IAN3cTYCAAwCCyAIQRBBFCAIKAIQIAVGG2ogATYCACABRQ0BCyABIAg2AhggBSgCECIABEAgASAANgIQIAAgATYCGAsgBSgCFCIARQ0AIAEgADYCFCAAIAE2AhgLIAUgB2ohBSACIAdqIQILIAUgBSgCBEF+cTYCBCAGIAJBAXI2AgQgAiAGaiACNgIAIAJB/wFNBEAgAkEDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwDC0EfIQAgAkH///8HTQRAIAJBCHYiACAAQYD+P2pBEHZBCHEiA3QiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASADciAAcmsiAEEBdCACIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQQCQEGMCCgCACIDQQEgAHQiAXFFBEBBjAggASADcjYCACAEIAY2AgAgBiAENgIYDAELIAJBAEEZIABBAXZrIABBH0YbdCEAIAQoAgAhAQNAIAEiAygCBEF4cSACRg0DIABBHXYhASAAQQF0IQAgAyABQQRxaiIEKAIQIgENAAsgBCAGNgIQIAYgAzYCGAsgBiAGNgIMIAYgBjYCCAwCC0GUCCAFQShrIgNBeCABa0EHcUEAIAFBCGpBB3EbIgBrIgI2AgBBoAggACABaiIANgIAIAAgAkEBcjYCBCABIANqQSg2AgRBpAhB8AsoAgA2AgAgByAEQScgBGtBB3FBACAEQSdrQQdxG2pBL2siACAAIAdBEGpJGyICQRs2AgQgAkHQCykCADcCECACQcgLKQIANwIIQdALIAJBCGo2AgBBzAsgBTYCAEHICyABNgIAQdQLQQA2AgAgAkEYaiEAA0AgAEEHNgIEIABBCGohASAAQQRqIQAgASAESQ0ACyACIAdGDQMgAiACKAIEQX5xNgIEIAcgAiAHayIEQQFyNgIEIAIgBDYCACAEQf8BTQRAIARBA3YiAEEDdEGwCGohAgJ/QYgIKAIAIgFBASAAdCIAcUUEQEGICCAAIAFyNgIAIAIMAQsgAigCCAshACACIAc2AgggACAHNgIMIAcgAjYCDCAHIAA2AggMBAtBHyEAIAdCADcCECAEQf///wdNBEAgBEEIdiIAIABBgP4/akEQdkEIcSICdCIAIABBgOAfakEQdkEEcSIBdCIAIABBgIAPakEQdkECcSIAdEEPdiABIAJyIAByayIAQQF0IAQgAEEVanZBAXFyQRxqIQALIAcgADYCHCAAQQJ0QbgKaiEDAkBBjAgoAgAiAkEBIAB0IgFxRQRAQYwIIAEgAnI2AgAgAyAHNgIAIAcgAzYCGAwBCyAEQQBBGSAAQQF2ayAAQR9GG3QhACADKAIAIQEDQCABIgIoAgRBeHEgBEYNBCAAQR12IQEgAEEBdCEAIAIgAUEEcWoiAygCECIBDQALIAMgBzYCECAHIAI2AhgLIAcgBzYCDCAHIAc2AggMAwsgAygCCCIAIAY2AgwgAyAGNgIIIAZBADYCGCAGIAM2AgwgBiAANgIICyAJQQhqIQAMBQsgAigCCCIAIAc2AgwgAiAHNgIIIAdBADYCGCAHIAI2AgwgByAANgIIC0GUCCgCACIAIAhNDQBBlAggACAIayIBNgIAQaAIQaAIKAIAIgIgCGoiADYCACAAIAFBAXI2AgQgAiAIQQNyNgIEIAJBCGohAAwDC0GECEEwNgIAQQAhAAwCCwJAIAVFDQACQCAEKAIcIgJBAnRBuApqIgAoAgAgBEYEQCAAIAE2AgAgAQ0BQYwIIAlBfiACd3EiCTYCAAwCCyAFQRBBFCAFKAIQIARGG2ogATYCACABRQ0BCyABIAU2AhggBCgCECIABEAgASAANgIQIAAgATYCGAsgBCgCFCIARQ0AIAEgADYCFCAAIAE2AhgLAkAgA0EPTQRAIAQgAyAIaiIAQQNyNgIEIAAgBGoiACAAKAIEQQFyNgIEDAELIAQgCEEDcjYCBCAGIANBAXI2AgQgAyAGaiADNgIAIANB/wFNBEAgA0EDdiIAQQN0QbAIaiECAn9BiAgoAgAiAUEBIAB0IgBxRQRAQYgIIAAgAXI2AgAgAgwBCyACKAIICyEAIAIgBjYCCCAAIAY2AgwgBiACNgIMIAYgADYCCAwBC0EfIQAgA0H///8HTQRAIANBCHYiACAAQYD+P2pBEHZBCHEiAnQiACAAQYDgH2pBEHZBBHEiAXQiACAAQYCAD2pBEHZBAnEiAHRBD3YgASACciAAcmsiAEEBdCADIABBFWp2QQFxckEcaiEACyAGIAA2AhwgBkIANwIQIABBAnRBuApqIQICQAJAIAlBASAAdCIBcUUEQEGMCCABIAlyNgIAIAIgBjYCACAGIAI2AhgMAQsgA0EAQRkgAEEBdmsgAEEfRht0IQAgAigCACEIA0AgCCIBKAIEQXhxIANGDQIgAEEddiECIABBAXQhACABIAJBBHFqIgIoAhAiCA0ACyACIAY2AhAgBiABNgIYCyAGIAY2AgwgBiAGNgIIDAELIAEoAggiACAGNgIMIAEgBjYCCCAGQQA2AhggBiABNgIMIAYgADYCCAsgBEEIaiEADAELAkAgC0UNAAJAIAEoAhwiAkECdEG4CmoiACgCACABRgRAIAAgBDYCACAEDQFBjAggBkF+IAJ3cTYCAAwCCyALQRBBFCALKAIQIAFGG2ogBDYCACAERQ0BCyAEIAs2AhggASgCECIABEAgBCAANgIQIAAgBDYCGAsgASgCFCIARQ0AIAQgADYCFCAAIAQ2AhgLAkAgA0EPTQRAIAEgAyAIaiIAQQNyNgIEIAAgAWoiACAAKAIEQQFyNgIEDAELIAEgCEEDcjYCBCAJIANBAXI2AgQgAyAJaiADNgIAIAoEQCAKQQN2IgBBA3RBsAhqIQRBnAgoAgAhAgJ/QQEgAHQiACAFcUUEQEGICCAAIAVyNgIAIAQMAQsgBCgCCAshACAEIAI2AgggACACNgIMIAIgBDYCDCACIAA2AggLQZwIIAk2AgBBkAggAzYCAAsgAUEIaiEACyAMQRBqJAAgAAsQACMAIABrQXBxIgAkACAACwYAIAAkAAsEACMAC4AJAgh/BH4jAEGQAWsiBiQAIAYgBS0AA0EYdEGAgIAYcSAFLwAAIAUtAAJBEHRycjYCACAGIAUoAANBAnZBg/7/H3E2AgQgBiAFKAAGQQR2Qf+B/x9xNgIIIAYgBSgACUEGdkH//8AfcTYCDCAFLwANIQggBS0ADyEJIAZCADcCFCAGQgA3AhwgBkEANgIkIAYgCCAJQRB0QYCAPHFyNgIQIAYgBSgAEDYCKCAGIAUoABQ2AiwgBiAFKAAYNgIwIAUoABwhBSAGQQA6AEwgBkEANgI4IAYgBTYCNCAGIAEgAhAEIAQEQCAGIAMgBBAECyAGKAI4IgEEQCAGQTxqIgIgAWpBAToAACABQQFqQQ9NBEAgASAGakE9aiEEAkBBDyABayIDRQ0AIAMgBGoiAUEBa0EAOgAAIARBADoAACADQQNJDQAgAUECa0EAOgAAIARBADoAASABQQNrQQA6AAAgBEEAOgACIANBB0kNACABQQRrQQA6AAAgBEEAOgADIANBCUkNACAEQQAgBGtBA3EiAWoiBEEANgIAIAQgAyABa0F8cSIBaiIDQQRrQQA2AgAgAUEJSQ0AIARBADYCCCAEQQA2AgQgA0EIa0EANgIAIANBDGtBADYCACABQRlJDQAgBEEANgIYIARBADYCFCAEQQA2AhAgBEEANgIMIANBEGtBADYCACADQRRrQQA2AgAgA0EYa0EANgIAIANBHGtBADYCACABIARBBHFBGHIiAWsiA0EgSQ0AIAEgBGohAQNAIAFCADcDGCABQgA3AxAgAUIANwMIIAFCADcDACABQSBqIQEgA0EgayIDQR9LDQALCwsgBkEBOgBMIAYgAkEQEAILIAY1AjQhECAGNQIwIREgBjUCLCEOIAAgBjUCKCAGKAIkIAYoAiAgBigCHCAGKAIYIgNBGnZqIgJBGnZqIgFBGnZqIgtBgICAYHIgAUH///8fcSINIAJB////H3EiCCAGKAIUIAtBGnZBBWxqIgFB////H3EiCUEFaiIFQRp2IANB////H3EgAUEadmoiA2oiAUEadmoiAkEadmoiBEEadmoiDEEfdSIHIANxIAEgDEEfdkEBayIDQf///x9xIgpxciIBQRp0IAUgCnEgByAJcXJyrXwiDzwAACAAIA9CGIg8AAMgACAPQhCIPAACIAAgD0IIiDwAASAAIA4gByAIcSACIApxciICQRR0IAFBBnZyrXwgD0IgiHwiDjwABCAAIA5CGIg8AAcgACAOQhCIPAAGIAAgDkIIiDwABSAAIBEgByANcSAEIApxciIBQQ50IAJBDHZyrXwgDkIgiHwiDjwACCAAIA5CGIg8AAsgACAOQhCIPAAKIAAgDkIIiDwACSAAIBAgAyAMcSAHIAtxckEIdCABQRJ2cq18IA5CIIh8Ig48AAwgACAOQhiIPAAPIAAgDkIQiDwADiAAIA5CCIg8AA0gBkIANwIwIAZCADcCKCAGQgA3AiAgBkIANwIYIAZCADcCECAGQgA3AgggBkIANwIAIAZBkAFqJAALpwwBB38CQCAARQ0AIABBCGsiAyAAQQRrKAIAIgFBeHEiAGohBQJAIAFBAXENACABQQNxRQ0BIAMgAygCACIBayIDQZgIKAIASQ0BIAAgAWohACADQZwIKAIARwRAIAFB/wFNBEAgAygCCCICIAFBA3YiBEEDdEGwCGpGGiACIAMoAgwiAUYEQEGICEGICCgCAEF+IAR3cTYCAAwDCyACIAE2AgwgASACNgIIDAILIAMoAhghBgJAIAMgAygCDCIBRwRAIAMoAggiAiABNgIMIAEgAjYCCAwBCwJAIANBFGoiAigCACIEDQAgA0EQaiICKAIAIgQNAEEAIQEMAQsDQCACIQcgBCIBQRRqIgIoAgAiBA0AIAFBEGohAiABKAIQIgQNAAsgB0EANgIACyAGRQ0BAkAgAyADKAIcIgJBAnRBuApqIgQoAgBGBEAgBCABNgIAIAENAUGMCEGMCCgCAEF+IAJ3cTYCAAwDCyAGQRBBFCAGKAIQIANGG2ogATYCACABRQ0CCyABIAY2AhggAygCECICBEAgASACNgIQIAIgATYCGAsgAygCFCICRQ0BIAEgAjYCFCACIAE2AhgMAQsgBSgCBCIBQQNxQQNHDQBBkAggADYCACAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAA8LIAMgBU8NACAFKAIEIgFBAXFFDQACQCABQQJxRQRAIAVBoAgoAgBGBEBBoAggAzYCAEGUCEGUCCgCACAAaiIANgIAIAMgAEEBcjYCBCADQZwIKAIARw0DQZAIQQA2AgBBnAhBADYCAA8LIAVBnAgoAgBGBEBBnAggAzYCAEGQCEGQCCgCACAAaiIANgIAIAMgAEEBcjYCBCAAIANqIAA2AgAPCyABQXhxIABqIQACQCABQf8BTQRAIAUoAggiAiABQQN2IgRBA3RBsAhqRhogAiAFKAIMIgFGBEBBiAhBiAgoAgBBfiAEd3E2AgAMAgsgAiABNgIMIAEgAjYCCAwBCyAFKAIYIQYCQCAFIAUoAgwiAUcEQCAFKAIIIgJBmAgoAgBJGiACIAE2AgwgASACNgIIDAELAkAgBUEUaiICKAIAIgQNACAFQRBqIgIoAgAiBA0AQQAhAQwBCwNAIAIhByAEIgFBFGoiAigCACIEDQAgAUEQaiECIAEoAhAiBA0ACyAHQQA2AgALIAZFDQACQCAFIAUoAhwiAkECdEG4CmoiBCgCAEYEQCAEIAE2AgAgAQ0BQYwIQYwIKAIAQX4gAndxNgIADAILIAZBEEEUIAYoAhAgBUYbaiABNgIAIAFFDQELIAEgBjYCGCAFKAIQIgIEQCABIAI2AhAgAiABNgIYCyAFKAIUIgJFDQAgASACNgIUIAIgATYCGAsgAyAAQQFyNgIEIAAgA2ogADYCACADQZwIKAIARw0BQZAIIAA2AgAPCyAFIAFBfnE2AgQgAyAAQQFyNgIEIAAgA2ogADYCAAsgAEH/AU0EQCAAQQN2IgFBA3RBsAhqIQACf0GICCgCACICQQEgAXQiAXFFBEBBiAggASACcjYCACAADAELIAAoAggLIQIgACADNgIIIAIgAzYCDCADIAA2AgwgAyACNgIIDwtBHyECIANCADcCECAAQf///wdNBEAgAEEIdiIBIAFBgP4/akEQdkEIcSIBdCICIAJBgOAfakEQdkEEcSICdCIEIARBgIAPakEQdkECcSIEdEEPdiABIAJyIARyayIBQQF0IAAgAUEVanZBAXFyQRxqIQILIAMgAjYCHCACQQJ0QbgKaiEBAkACQAJAQYwIKAIAIgRBASACdCIHcUUEQEGMCCAEIAdyNgIAIAEgAzYCACADIAE2AhgMAQsgAEEAQRkgAkEBdmsgAkEfRht0IQIgASgCACEBA0AgASIEKAIEQXhxIABGDQIgAkEddiEBIAJBAXQhAiAEIAFBBHFqIgdBEGooAgAiAQ0ACyAHIAM2AhAgAyAENgIYCyADIAM2AgwgAyADNgIIDAELIAQoAggiACADNgIMIAQgAzYCCCADQQA2AhggAyAENgIMIAMgADYCCAtBqAhBqAgoAgBBAWsiAEF/IAAbNgIACwsLCQEAQYEICwIGUA==";if(!W.startsWith(V)){var na=W;W=b.locateFile?b.locateFile(na,B):B+na}function pa(){var a=W;try{if(a==W&&J)return new Uint8Array(J);var c=H(a);if(c)return c;if(E)return E(a);throw"both async and sync fetching of the wasm failed";}catch(d){K(d)}} -function qa(){if(!J&&(x||y)){if("function"===typeof fetch&&!W.startsWith("file://"))return fetch(W,{credentials:"same-origin"}).then(function(a){if(!a.ok)throw"failed to load wasm binary file at '"+W+"'";return a.arrayBuffer()}).catch(function(){return pa()});if(D)return new Promise(function(a,c){D(W,function(d){a(new Uint8Array(d))},c)})}return Promise.resolve().then(function(){return pa()})} -function X(a){for(;0>4;f=(f&15)<<4|l>>2;var t=(l&3)<<6|A;c+=String.fromCharCode(e);64!==l&&(c+=String.fromCharCode(f));64!==A&&(c+=String.fromCharCode(t))}while(d>>=0;if(2147483648=d;d*=2){var e=c*(1+.2/d);e=Math.min(e,a+100663296);e=Math.max(a,e);0>>16);ia();var f=1;break a}catch(l){}f=void 0}if(f)return!0}return!1}}; -(function(){function a(f){b.asm=f.exports;L=b.asm.b;ia();R=b.asm.j;ka.unshift(b.asm.c);S--;b.monitorRunDependencies&&b.monitorRunDependencies(S);0==S&&(null!==T&&(clearInterval(T),T=null),U&&(f=U,U=null,f()))}function c(f){a(f.instance)}function d(f){return qa().then(function(l){return WebAssembly.instantiate(l,e)}).then(f,function(l){I("failed to asynchronously prepare wasm: "+l);K(l)})}var e={a:sa};S++;b.monitorRunDependencies&&b.monitorRunDependencies(S);if(b.instantiateWasm)try{return b.instantiateWasm(e, -a)}catch(f){return I("Module.instantiateWasm callback failed with error: "+f),!1}(function(){return J||"function"!==typeof WebAssembly.instantiateStreaming||W.startsWith(V)||W.startsWith("file://")||"function"!==typeof fetch?d(c):fetch(W,{credentials:"same-origin"}).then(function(f){return WebAssembly.instantiateStreaming(f,e).then(c,function(l){I("wasm streaming compile failed: "+l);I("falling back to ArrayBuffer instantiation");return d(c)})})})().catch(r);return{}})(); -b.___wasm_call_ctors=function(){return(b.___wasm_call_ctors=b.asm.c).apply(null,arguments)};b._poly1305_auth=function(){return(b._poly1305_auth=b.asm.d).apply(null,arguments)};var da=b.stackSave=function(){return(da=b.stackSave=b.asm.e).apply(null,arguments)},fa=b.stackRestore=function(){return(fa=b.stackRestore=b.asm.f).apply(null,arguments)},O=b.stackAlloc=function(){return(O=b.stackAlloc=b.asm.g).apply(null,arguments)};b._malloc=function(){return(b._malloc=b.asm.h).apply(null,arguments)}; -b._free=function(){return(b._free=b.asm.i).apply(null,arguments)};b.cwrap=function(a,c,d,e){d=d||[];var f=d.every(function(l){return"number"===l});return"string"!==c&&f&&!e?N(a):function(){return ca(a,c,d,arguments)}};var Y;U=function ta(){Y||Z();Y||(U=ta)}; -function Z(){function a(){if(!Y&&(Y=!0,b.calledRun=!0,!M)){X(ka);q(b);if(b.onRuntimeInitialized)b.onRuntimeInitialized();if(b.postRun)for("function"==typeof b.postRun&&(b.postRun=[b.postRun]);b.postRun.length;){var c=b.postRun.shift();la.unshift(c)}X(la)}}if(!(0 -#include -#include - -#include -#include -#include - -#include -#include -#include - -using namespace node; -using namespace v8; -using namespace std; - -struct MarkPopErrorOnReturn { - MarkPopErrorOnReturn() { ERR_set_mark(); } - ~MarkPopErrorOnReturn() { ERR_pop_to_mark(); } -}; - -enum ErrorType { - kErrNone, - kErrOpenSSL, - kErrBadIVLen, - kErrBadKeyLen, - kErrAADFailure, - kErrTagFailure, - kErrPartialEncrypt, - kErrBadCipherName, - kErrBadHMACName, - kErrBadHMACLen, - kErrBadInit, - kErrPartialDecrypt, - kErrInvalidMAC, - kErrBadBlockLen -}; - -#define MAX_MAC_LEN 64 - -#define POLY1305_KEYLEN 32 -#define POLY1305_TAGLEN 16 -class ChaChaPolyCipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("ChaChaPolyCipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "encrypt", Encrypt); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("ChaChaPolyCipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit ChaChaPolyCipher() - : ctx_main_(nullptr), - ctx_pktlen_(nullptr), - md_ctx_(nullptr), - polykey_(nullptr) {} - - ~ChaChaPolyCipher() { - clear(); - } - - void clear() { - if (ctx_pktlen_) { - EVP_CIPHER_CTX_cleanup(ctx_pktlen_); - EVP_CIPHER_CTX_free(ctx_pktlen_); - ctx_pktlen_ = nullptr; - } - if (ctx_main_) { - EVP_CIPHER_CTX_cleanup(ctx_main_); - EVP_CIPHER_CTX_free(ctx_main_); - ctx_main_ = nullptr; - } - if (polykey_) { - EVP_PKEY_free(polykey_); - polykey_ = nullptr; - } - if (md_ctx_) { - EVP_MD_CTX_free(md_ctx_); - md_ctx_ = nullptr; - } - // `polykey_ctx_` is not explicitly freed as it is freed implicitly when - // `md_ctx_` is freed - } - - ErrorType init(unsigned char* keys, size_t keys_len) { - ErrorType r = kErrNone; - const EVP_CIPHER* const cipher = EVP_get_cipherbyname("chacha20"); - - if (keys_len != 64) { - r = kErrBadKeyLen; - goto out; - } - - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if ((ctx_pktlen_ = EVP_CIPHER_CTX_new()) == nullptr - || (ctx_main_ = EVP_CIPHER_CTX_new()) == nullptr - || (md_ctx_ = EVP_MD_CTX_new()) == nullptr - || EVP_EncryptInit_ex(ctx_pktlen_, - cipher, - nullptr, - keys + 32, - nullptr) != 1 - || EVP_EncryptInit_ex(ctx_main_, - cipher, - nullptr, - keys, - nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_CIPHER_CTX_iv_length(ctx_pktlen_) != 16) { - r = kErrBadIVLen; - goto out; - } - -out: - return r; - } - - ErrorType encrypt(unsigned char* packet, - uint32_t packet_len, - uint32_t seqno) { - ErrorType r = kErrNone; - size_t sig_len = 16; - int outlen = 0; - - // `packet` layout: - // - uint32_t data_len = packet_len - POLY1305_TAGLEN; - - unsigned char polykey[POLY1305_KEYLEN] = {0}; - - uint8_t seqbuf[16] = {0}; - ((uint8_t*)(seqbuf))[12] = (seqno >> 24) & 0xff; - ((uint8_t*)(seqbuf))[13] = (seqno >> 16) & 0xff; - ((uint8_t*)(seqbuf))[14] = (seqno >> 8) & 0xff; - ((uint8_t*)(seqbuf))[15] = seqno & 0xff; - - // Generate Poly1305 key - if (EVP_EncryptInit_ex(ctx_main_, nullptr, nullptr, nullptr, seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_EncryptUpdate(ctx_main_, - polykey, - &outlen, - polykey, - sizeof(polykey)) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != sizeof(polykey)) { - r = kErrPartialEncrypt; - goto out; - } - - // Encrypt packet length - if (EVP_EncryptInit_ex(ctx_pktlen_, - nullptr, - nullptr, - nullptr, - seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_EncryptUpdate(ctx_pktlen_, packet, &outlen, packet, 4) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != 4) { - r = kErrPartialEncrypt; - goto out; - } - - // Encrypt rest of packet - seqbuf[0] = 1; - if (EVP_EncryptInit_ex(ctx_main_, nullptr, nullptr, nullptr, seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_EncryptUpdate(ctx_main_, - packet + 4, - &outlen, - packet + 4, - data_len - 4) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != data_len - 4) { - r = kErrPartialEncrypt; - goto out; - } - - // Poly1305 over ciphertext - if (polykey_) { - if (EVP_PKEY_CTX_ctrl(polykey_ctx_, - -1, - EVP_PKEY_OP_SIGNCTX, - EVP_PKEY_CTRL_SET_MAC_KEY, - sizeof(polykey), - (void*)polykey) <= 0) { - r = kErrOpenSSL; - goto out; - } - } else { - polykey_ = EVP_PKEY_new_raw_private_key(EVP_PKEY_POLY1305, - nullptr, - polykey, - sizeof(polykey)); - if (polykey_ == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if (!EVP_DigestSignInit(md_ctx_, - &polykey_ctx_, - nullptr, - nullptr, - polykey_)) { - r = kErrOpenSSL; - goto out; - } - } - - // Generate and write Poly1305 tag - if (EVP_DigestSign(md_ctx_, - packet + data_len, - &sig_len, - packet, - data_len) != 1) { - r = kErrOpenSSL; - goto out; - } - - out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid keys"); - - ChaChaPolyCipher* obj = new ChaChaPolyCipher(); - ErrorType r = obj->init( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]) - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid keys length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid IV length"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Encrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - ChaChaPolyCipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - if (!info[1]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid sequence number"); - - ErrorType r = obj->encrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]), - Nan::To(info[1]).FromJust() - ); - switch (r) { - case kErrNone: - return; - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown encrypt failure"); - } - } - - static NAN_METHOD(Free) { - ChaChaPolyCipher* obj = ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - EVP_CIPHER_CTX* ctx_main_; - EVP_CIPHER_CTX* ctx_pktlen_; - EVP_MD_CTX* md_ctx_; - EVP_PKEY* polykey_; - EVP_PKEY_CTX* polykey_ctx_; -}; - -class AESGCMCipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("AESGCMCipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "encrypt", Encrypt); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("AESGCMCipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit AESGCMCipher() : ctx_(nullptr) {} - - ~AESGCMCipher() { - clear(); - } - - void clear() { - if (ctx_) { - EVP_CIPHER_CTX_cleanup(ctx_); - EVP_CIPHER_CTX_free(ctx_); - ctx_ = nullptr; - } - } - - ErrorType init(const char* name, - unsigned char* key, - size_t key_len, - unsigned char* iv, - size_t iv_len) { - ErrorType r = kErrNone; - - const EVP_CIPHER* const cipher = EVP_get_cipherbyname(name); - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if (cipher != EVP_aes_128_gcm() && cipher != EVP_aes_256_gcm()) { - r = kErrBadCipherName; - goto out; - } - - if ((ctx_ = EVP_CIPHER_CTX_new()) == nullptr - || EVP_EncryptInit_ex(ctx_, cipher, nullptr, nullptr, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_IVLEN, iv_len, nullptr)) { - r = kErrOpenSSL; - goto out; - } - - //~ if (iv_len != static_cast(EVP_CIPHER_CTX_iv_length(ctx_))) { - //~ r = kErrBadIVLen; - //~ goto out; - //~ } - - if (key_len != static_cast(EVP_CIPHER_CTX_key_length(ctx_))) { - if (!EVP_CIPHER_CTX_set_key_length(ctx_, key_len)) { - r = kErrBadKeyLen; - goto out; - } - } - - // Set key and IV - if (EVP_EncryptInit_ex(ctx_, nullptr, nullptr, key, iv) != 1) { - r = kErrOpenSSL; - goto out; - } - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_SET_IV_FIXED, -1, iv)) { - r = kErrOpenSSL; - goto out; - } - - // Disable padding - EVP_CIPHER_CTX_set_padding(ctx_, 0); - -out: - return r; - } - - ErrorType encrypt(unsigned char* packet, uint32_t packet_len) { - ErrorType r = kErrNone; - - // `packet` layout: - // - uint32_t data_len = packet_len - 16; - - int outlen = 0; - - // Increment IV - unsigned char lastiv[1]; - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_IV_GEN, 1, lastiv)) { - r = kErrOpenSSL; - goto out; - } - - // Set AAD (the packet length) - if (!EVP_EncryptUpdate(ctx_, nullptr, &outlen, packet, 4)) { - r = kErrOpenSSL; - goto out; - } - if (outlen != 4) { - r = kErrAADFailure; - goto out; - } - - // Encrypt everything but the packet length - if (EVP_EncryptUpdate(ctx_, - packet + 4, - &outlen, - packet + 4, - data_len - 4) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != data_len - 4) { - r = kErrPartialEncrypt; - goto out; - } - - // Generate authentication tag - if (!EVP_EncryptFinal_ex(ctx_, nullptr, &outlen)) { - r = kErrOpenSSL; - goto out; - } - - // Write authentication tag - if (EVP_CIPHER_CTX_ctrl(ctx_, - EVP_CTRL_AEAD_GET_TAG, - 16, - packet + data_len) != 1) { - r = kErrOpenSSL; - goto out; - } - -out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!info[0]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid OpenSSL cipher name"); - - if (!Buffer::HasInstance(info[1])) - return Nan::ThrowTypeError("Missing/Invalid key"); - - if (!Buffer::HasInstance(info[2])) - return Nan::ThrowTypeError("Missing/Invalid iv"); - - const Nan::Utf8String cipher_name(info[0]); - - AESGCMCipher* obj = new AESGCMCipher(); - ErrorType r = obj->init( - *cipher_name, - reinterpret_cast(Buffer::Data(info[1])), - Buffer::Length(info[1]), - reinterpret_cast(Buffer::Data(info[2])), - Buffer::Length(info[2]) - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid keys length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid IV length"); - case kErrBadCipherName: - return Nan::ThrowError("Invalid AES GCM cipher name"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Encrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - AESGCMCipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - ErrorType r = obj->encrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]) - ); - switch (r) { - case kErrNone: - return; - case kErrAADFailure: - return Nan::ThrowError("Error setting AAD"); - case kErrPartialEncrypt: - return Nan::ThrowError("Failed to completely encrypt packet"); - case kErrTagFailure: - return Nan::ThrowError("Error generating authentication tag"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown encrypt failure"); - } - } - - static NAN_METHOD(Free) { - AESGCMCipher* obj = ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - EVP_CIPHER_CTX* ctx_; -}; - -class GenericCipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("GenericCipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "encrypt", Encrypt); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("GenericCipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit GenericCipher() - : ctx_(nullptr), - ctx_hmac_(nullptr), - hmac_len_(0), - is_etm_(0) {} - - ~GenericCipher() { - clear(); - } - - void clear() { - if (ctx_) { - EVP_CIPHER_CTX_cleanup(ctx_); - EVP_CIPHER_CTX_free(ctx_); - ctx_ = nullptr; - } - if (ctx_hmac_) { - HMAC_CTX_free(ctx_hmac_); - ctx_hmac_ = nullptr; - } - } - - ErrorType init(const char* name, - unsigned char* key, - size_t key_len, - unsigned char* iv, - size_t iv_len, - const char* hmac_name, - unsigned char* hmac_key, - size_t hmac_key_len, - int is_etm) { - ErrorType r = kErrNone; - - const EVP_MD* md; - const EVP_CIPHER* const cipher = EVP_get_cipherbyname(name); - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if ((ctx_ = EVP_CIPHER_CTX_new()) == nullptr - || EVP_EncryptInit_ex(ctx_, cipher, nullptr, nullptr, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (iv_len != static_cast(EVP_CIPHER_CTX_iv_length(ctx_))) { - r = kErrBadIVLen; - goto out; - } - - if (key_len != static_cast(EVP_CIPHER_CTX_key_length(ctx_))) { - if (!EVP_CIPHER_CTX_set_key_length(ctx_, key_len)) { - r = kErrBadKeyLen; - goto out; - } - } - - // Set key and IV - if (EVP_EncryptInit_ex(ctx_, nullptr, nullptr, key, iv) != 1) { - r = kErrOpenSSL; - goto out; - } - - // Disable padding - EVP_CIPHER_CTX_set_padding(ctx_, 0); - - if (cipher == EVP_rc4()) { - /* The "arcfour128" algorithm is the RC4 cipher, as described in - [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream - generated by the cipher MUST be discarded, and the first byte of the - first encrypted packet MUST be encrypted using the 1537th byte of - keystream. - - -- http://tools.ietf.org/html/rfc4345#section-4 */ - unsigned char zeros[1536] = {0}; - int outlen = sizeof(zeros); - if (EVP_EncryptUpdate(ctx_, - zeros, - &outlen, - zeros, - sizeof(zeros)) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != sizeof(zeros)) { - r = kErrBadInit; - goto out; - } - } - - md = EVP_get_digestbyname(hmac_name); - if (md == nullptr) { - r = kErrBadHMACName; - goto out; - } - - if ((ctx_hmac_ = HMAC_CTX_new()) == nullptr - || HMAC_Init_ex(ctx_hmac_, hmac_key, hmac_key_len, md, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - hmac_len_ = HMAC_size(ctx_hmac_); - is_etm_ = is_etm; - -out: - return r; - } - - ErrorType encrypt(unsigned char* packet, - uint32_t packet_len, - uint32_t seqno) { - ErrorType r = kErrNone; - - // `packet` layout: - // - uint32_t data_len = packet_len - hmac_len_; - - int outlen; - - uint8_t seqbuf[4] = {0}; - ((uint8_t*)(seqbuf))[0] = (seqno >> 24) & 0xff; - ((uint8_t*)(seqbuf))[1] = (seqno >> 16) & 0xff; - ((uint8_t*)(seqbuf))[2] = (seqno >> 8) & 0xff; - ((uint8_t*)(seqbuf))[3] = seqno & 0xff; - - if (is_etm_) { - // Encrypt everything but packet length - if (EVP_EncryptUpdate(ctx_, - packet + 4, - &outlen, - packet + 4, - data_len - 4) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != data_len - 4) { - r = kErrPartialEncrypt; - goto out; - } - - // HMAC over unencrypted packet length and ciphertext - { - unsigned int outlen = hmac_len_; - if (HMAC_Init_ex(ctx_hmac_, nullptr, 0, nullptr, nullptr) != 1 - || HMAC_Update(ctx_hmac_, seqbuf, sizeof(seqbuf)) != 1 - || HMAC_Update(ctx_hmac_, packet, data_len) != 1 - || HMAC_Final(ctx_hmac_, packet + data_len, &outlen) != 1) { - r = kErrOpenSSL; - goto out; - } - if (outlen != hmac_len_) { - r = kErrBadHMACLen; - goto out; - } - } - } else { - // HMAC over plaintext - { - unsigned int outlen = hmac_len_; - if (HMAC_Init_ex(ctx_hmac_, nullptr, 0, nullptr, nullptr) != 1 - || HMAC_Update(ctx_hmac_, seqbuf, sizeof(seqbuf)) != 1 - || HMAC_Update(ctx_hmac_, packet, data_len) != 1 - || HMAC_Final(ctx_hmac_, packet + data_len, &outlen) != 1) { - r = kErrOpenSSL; - goto out; - } - if (outlen != hmac_len_) { - r = kErrBadHMACLen; - goto out; - } - } - - // Encrypt packet - if (EVP_EncryptUpdate(ctx_, - packet, - &outlen, - packet, - data_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != data_len) { - - r = kErrPartialEncrypt; - goto out; - } - } - -out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!info[0]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid cipher name"); - - if (!Buffer::HasInstance(info[1])) - return Nan::ThrowTypeError("Missing/Invalid cipher key"); - - if (!Buffer::HasInstance(info[2])) - return Nan::ThrowTypeError("Missing/Invalid cipher IV"); - - if (!info[3]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid HMAC name"); - - if (!Buffer::HasInstance(info[4])) - return Nan::ThrowTypeError("Missing/Invalid HMAC key"); - - if (!info[5]->IsBoolean()) - return Nan::ThrowTypeError("Missing/Invalid HMAC ETM flag"); - - const Nan::Utf8String cipher_name(info[0]); - const Nan::Utf8String mac_name(info[3]); - int is_etm = (Nan::To(info[5]).FromJust() ? 1 : 0); - - GenericCipher* obj = new GenericCipher(); - ErrorType r = obj->init( - *cipher_name, - reinterpret_cast(Buffer::Data(info[1])), - Buffer::Length(info[1]), - reinterpret_cast(Buffer::Data(info[2])), - Buffer::Length(info[2]), - *mac_name, - reinterpret_cast(Buffer::Data(info[4])), - Buffer::Length(info[4]), - is_etm - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid keys length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid IV length"); - case kErrBadCipherName: - return Nan::ThrowError("Invalid cipher name"); - case kErrBadHMACName: - return Nan::ThrowError("Invalid MAC name"); - case kErrBadInit: - return Nan::ThrowError("Failed to properly initialize cipher"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Encrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - GenericCipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - if (!info[1]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid sequence number"); - - ErrorType r = obj->encrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]), - Nan::To(info[1]).FromJust() - ); - switch (r) { - case kErrNone: - return; - case kErrPartialEncrypt: - return Nan::ThrowError("Failed to completely encrypt packet"); - case kErrBadHMACLen: - return Nan::ThrowError("Unexpected HMAC length"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown encrypt failure"); - } - } - - static NAN_METHOD(Free) { - GenericCipher* obj = ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - EVP_CIPHER_CTX* ctx_; - HMAC_CTX* ctx_hmac_; - unsigned int hmac_len_; - int is_etm_; -}; - -// ============================================================================= - -class ChaChaPolyDecipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("ChaChaPolyDecipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "decrypt", Decrypt); - SetPrototypeMethod(tpl, "decryptLen", DecryptLen); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("ChaChaPolyDecipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit ChaChaPolyDecipher() - : ctx_main_(nullptr), - ctx_pktlen_(nullptr), - md_ctx_(nullptr), - polykey_(nullptr) {} - - ~ChaChaPolyDecipher() { - clear(); - } - - void clear() { - if (ctx_pktlen_) { - EVP_CIPHER_CTX_cleanup(ctx_pktlen_); - EVP_CIPHER_CTX_free(ctx_pktlen_); - ctx_pktlen_ = nullptr; - } - if (ctx_main_) { - EVP_CIPHER_CTX_cleanup(ctx_main_); - EVP_CIPHER_CTX_free(ctx_main_); - ctx_main_ = nullptr; - } - if (polykey_) { - EVP_PKEY_free(polykey_); - polykey_ = nullptr; - } - if (md_ctx_) { - EVP_MD_CTX_free(md_ctx_); - md_ctx_ = nullptr; - } - // `polykey_ctx_` is not explicitly freed as it is freed implicitly when - // `md_ctx_` is freed - } - - ErrorType init(unsigned char* keys, size_t keys_len) { - ErrorType r = kErrNone; - const EVP_CIPHER* const cipher = EVP_get_cipherbyname("chacha20"); - - if (keys_len != 64) { - r = kErrBadKeyLen; - goto out; - } - - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if ((ctx_pktlen_ = EVP_CIPHER_CTX_new()) == nullptr - || (ctx_main_ = EVP_CIPHER_CTX_new()) == nullptr - || (md_ctx_ = EVP_MD_CTX_new()) == nullptr - || EVP_DecryptInit_ex(ctx_pktlen_, - cipher, - nullptr, - keys + 32, - nullptr) != 1 - || EVP_DecryptInit_ex(ctx_main_, - cipher, - nullptr, - keys, - nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_CIPHER_CTX_iv_length(ctx_pktlen_) != 16) { - r = kErrBadIVLen; - goto out; - } - -out: - return r; - } - - ErrorType decrypt_length(unsigned char* data, - size_t data_len, - uint32_t seqno, - uint32_t* packet_length) { - ErrorType r = kErrNone; - int outlen; - - unsigned char dec_length_bytes[4]; - - uint8_t seqbuf[16] = {0}; - ((uint8_t*)(seqbuf))[12] = (seqno >> 24) & 0xff; - ((uint8_t*)(seqbuf))[13] = (seqno >> 16) & 0xff; - ((uint8_t*)(seqbuf))[14] = (seqno >> 8) & 0xff; - ((uint8_t*)(seqbuf))[15] = seqno & 0xff; - - if (EVP_DecryptInit_ex(ctx_pktlen_, - nullptr, - nullptr, - nullptr, - seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_DecryptUpdate(ctx_pktlen_, - dec_length_bytes, - &outlen, - data, - data_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != 4) { - r = kErrPartialDecrypt; - goto out; - } - - *packet_length = (uint32_t)dec_length_bytes[0] << 24 - | (uint32_t)dec_length_bytes[1] << 16 - | (uint32_t)dec_length_bytes[2] << 8 - | (uint32_t)dec_length_bytes[3]; - memcpy(length_bytes, data, data_len); -out: - return r; - } - - ErrorType decrypt(unsigned char* packet, - uint32_t packet_len, - unsigned char* mac, - uint32_t seqno) { - ErrorType r = kErrNone; - size_t sig_len = 16; - int outlen = 0; - - // `packet` layout: - // - - unsigned char polykey[POLY1305_KEYLEN] = {0}; - unsigned char calc_mac[POLY1305_TAGLEN] = {0}; - - uint8_t seqbuf[16] = {0}; - ((uint8_t*)(seqbuf))[12] = (seqno >> 24) & 0xff; - ((uint8_t*)(seqbuf))[13] = (seqno >> 16) & 0xff; - ((uint8_t*)(seqbuf))[14] = (seqno >> 8) & 0xff; - ((uint8_t*)(seqbuf))[15] = seqno & 0xff; - - // Generate Poly1305 key - if (EVP_EncryptInit_ex(ctx_main_, nullptr, nullptr, nullptr, seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_EncryptUpdate(ctx_main_, - polykey, - &outlen, - polykey, - sizeof(polykey)) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != sizeof(polykey)) { - r = kErrPartialEncrypt; - goto out; - } - - // Poly1305 over ciphertext - if (polykey_) { - if (EVP_PKEY_CTX_ctrl(polykey_ctx_, - -1, - EVP_PKEY_OP_SIGNCTX, - EVP_PKEY_CTRL_SET_MAC_KEY, - sizeof(polykey), - (void*)polykey) <= 0) { - r = kErrOpenSSL; - goto out; - } - } else { - polykey_ = EVP_PKEY_new_raw_private_key(EVP_PKEY_POLY1305, - nullptr, - polykey, - sizeof(polykey)); - if (polykey_ == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if (!EVP_DigestSignInit(md_ctx_, - &polykey_ctx_, - nullptr, - nullptr, - polykey_)) { - r = kErrOpenSSL; - goto out; - } - } - if (EVP_DigestSignUpdate(md_ctx_, - length_bytes, - sizeof(length_bytes)) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_DigestSignUpdate(md_ctx_, packet, packet_len) != 1) { - r = kErrOpenSSL; - goto out; - } - - // Generate Poly1305 MAC - if (EVP_DigestSignFinal(md_ctx_, calc_mac, &sig_len) != 1) { - r = kErrOpenSSL; - goto out; - } - - // Compare MACs - if (CRYPTO_memcmp(mac, calc_mac, sizeof(calc_mac))) { - r = kErrInvalidMAC; - goto out; - } - - // Decrypt packet - seqbuf[0] = 1; - if (EVP_DecryptInit_ex(ctx_main_, nullptr, nullptr, nullptr, seqbuf) != 1) { - r = kErrOpenSSL; - goto out; - } - if (EVP_DecryptUpdate(ctx_main_, - packet, - &outlen, - packet, - packet_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != packet_len) { - r = kErrPartialDecrypt; - goto out; - } - - out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid keys"); - - ChaChaPolyDecipher* obj = new ChaChaPolyDecipher(); - ErrorType r = obj->init( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]) - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid keys length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid IV length"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(DecryptLen) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - ChaChaPolyDecipher* obj = - ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0]) || Buffer::Length(info[0]) != 4) - return Nan::ThrowTypeError("Missing/Invalid length bytes"); - - if (!info[1]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid sequence number"); - - unsigned char* length_bytes = - reinterpret_cast(Buffer::Data(info[0])); - - uint32_t dec_packet_length; - ErrorType r = obj->decrypt_length( - length_bytes, - Buffer::Length(info[0]), - Nan::To(info[1]).FromJust(), - &dec_packet_length - ); - - switch (r) { - case kErrNone: - return info.GetReturnValue().Set(dec_packet_length); - case kErrPartialDecrypt: - return Nan::ThrowError("Failed to completely decrypt packet length"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown decrypt failure"); - } - } - - static NAN_METHOD(Decrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - ChaChaPolyDecipher* obj = - ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - if (!Buffer::HasInstance(info[1]) - || Buffer::Length(info[1]) != POLY1305_TAGLEN) { - return Nan::ThrowTypeError("Missing/Invalid mac"); - } - - if (!info[2]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid sequence number"); - - ErrorType r = obj->decrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]), - reinterpret_cast(Buffer::Data(info[1])), - Nan::To(info[2]).FromJust() - ); - - switch (r) { - case kErrNone: - return; - case kErrInvalidMAC: - return Nan::ThrowError("Invalid MAC"); - case kErrPartialDecrypt: - return Nan::ThrowError("Failed to completely decrypt packet length"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown decrypt failure"); - } - } - - static NAN_METHOD(Free) { - ChaChaPolyDecipher* obj = - ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - unsigned char length_bytes[4]; - EVP_CIPHER_CTX* ctx_main_; - EVP_CIPHER_CTX* ctx_pktlen_; - EVP_MD_CTX* md_ctx_; - EVP_PKEY* polykey_; - EVP_PKEY_CTX* polykey_ctx_; -}; - -class AESGCMDecipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("AESGCMDecipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "decrypt", Decrypt); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("AESGCMDecipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit AESGCMDecipher() : ctx_(nullptr) {} - - ~AESGCMDecipher() { - clear(); - } - - void clear() { - if (ctx_) { - EVP_CIPHER_CTX_cleanup(ctx_); - EVP_CIPHER_CTX_free(ctx_); - ctx_ = nullptr; - } - } - - ErrorType init(const char* name, - unsigned char* key, - size_t key_len, - unsigned char* iv, - size_t iv_len) { - ErrorType r = kErrNone; - - const EVP_CIPHER* const cipher = EVP_get_cipherbyname(name); - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if (cipher != EVP_aes_128_gcm() && cipher != EVP_aes_256_gcm()) { - r = kErrBadCipherName; - goto out; - } - - if ((ctx_ = EVP_CIPHER_CTX_new()) == nullptr - || EVP_DecryptInit_ex(ctx_, cipher, nullptr, nullptr, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_IVLEN, iv_len, nullptr)) { - r = kErrOpenSSL; - goto out; - } - - //~ if (iv_len != static_cast(EVP_CIPHER_CTX_iv_length(ctx_))) { - //~ r = kErrBadIVLen; - //~ goto out; - //~ } - - if (key_len != static_cast(EVP_CIPHER_CTX_key_length(ctx_))) { - if (!EVP_CIPHER_CTX_set_key_length(ctx_, key_len)) { - r = kErrBadKeyLen; - goto out; - } - } - - // Set key and IV - if (EVP_DecryptInit_ex(ctx_, nullptr, nullptr, key, iv) != 1) { - r = kErrOpenSSL; - goto out; - } - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_SET_IV_FIXED, -1, iv)) { - r = kErrOpenSSL; - goto out; - } - - // Disable padding - EVP_CIPHER_CTX_set_padding(ctx_, 0); - -out: - return r; - } - - ErrorType decrypt(unsigned char* packet, - uint32_t packet_len, - unsigned char* length_bytes, - unsigned char* tag) { - ErrorType r = kErrNone; - - // `packet` layout: - // - - int outlen; - - // Increment IV - unsigned char lastiv[1]; - if (!EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_GCM_IV_GEN, 1, lastiv)) { - r = kErrOpenSSL; - goto out; - } - - // Set AAD (the packet length) - if (!EVP_DecryptUpdate(ctx_, nullptr, &outlen, length_bytes, 4)) { - r = kErrOpenSSL; - goto out; - } - if (outlen != 4) { - r = kErrAADFailure; - goto out; - } - - // Decrypt everything but the packet length - if (EVP_DecryptUpdate(ctx_, packet, &outlen, packet, packet_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != packet_len) { - r = kErrPartialDecrypt; - goto out; - } - - // Set authentication tag - if (EVP_CIPHER_CTX_ctrl(ctx_, EVP_CTRL_AEAD_SET_TAG, 16, tag) != 1) { - r = kErrOpenSSL; - goto out; - } - - // Verify authentication tag - if (!EVP_DecryptFinal_ex(ctx_, nullptr, &outlen)) { - r = kErrOpenSSL; - goto out; - } - -out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!info[0]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid OpenSSL cipher name"); - - if (!Buffer::HasInstance(info[1])) - return Nan::ThrowTypeError("Missing/Invalid key"); - - if (!Buffer::HasInstance(info[2])) - return Nan::ThrowTypeError("Missing/Invalid iv"); - - const Nan::Utf8String cipher_name(info[0]); - - AESGCMDecipher* obj = new AESGCMDecipher(); - ErrorType r = obj->init( - *cipher_name, - reinterpret_cast(Buffer::Data(info[1])), - Buffer::Length(info[1]), - reinterpret_cast(Buffer::Data(info[2])), - Buffer::Length(info[2]) - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid keys length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid IV length"); - case kErrBadCipherName: - return Nan::ThrowError("Invalid AES GCM cipher name"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(Decrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - AESGCMDecipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - if (!info[1]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid length"); - - if (!Buffer::HasInstance(info[2]) || Buffer::Length(info[2]) != 16) - return Nan::ThrowTypeError("Missing/Invalid tag"); - - uint32_t length = Nan::To(info[1]).FromJust(); - unsigned char length_bytes[4]; - length_bytes[0] = (length >> 24) & 0xFF; - length_bytes[1] = (length >> 16) & 0xFF; - length_bytes[2] = (length >> 8) & 0xFF; - length_bytes[3] = length & 0xFF; - - ErrorType r = obj->decrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]), - length_bytes, - reinterpret_cast(Buffer::Data(info[2])) - ); - switch (r) { - case kErrNone: - return; - case kErrAADFailure: - return Nan::ThrowError("Error setting AAD"); - case kErrPartialDecrypt: - return Nan::ThrowError("Failed to completely decrypt packet"); - case kErrTagFailure: - return Nan::ThrowError("Error generating authentication tag"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown decrypt failure"); - } - } - - static NAN_METHOD(Free) { - AESGCMDecipher* obj = ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - EVP_CIPHER_CTX* ctx_; -}; - -class GenericDecipher : public ObjectWrap { - public: - static NAN_MODULE_INIT(Init) { - Local tpl = Nan::New(New); - tpl->SetClassName(Nan::New("GenericDecipher").ToLocalChecked()); - tpl->InstanceTemplate()->SetInternalFieldCount(1); - - SetPrototypeMethod(tpl, "decryptBlock", DecryptBlock); - SetPrototypeMethod(tpl, "decrypt", Decrypt); - SetPrototypeMethod(tpl, "free", Free); - - constructor().Reset(Nan::GetFunction(tpl).ToLocalChecked()); - - Nan::Set(target, - Nan::New("GenericDecipher").ToLocalChecked(), - Nan::GetFunction(tpl).ToLocalChecked()); - } - - private: - explicit GenericDecipher() - : ctx_(nullptr), - ctx_hmac_(nullptr), - hmac_len_(0), - is_etm_(0) {} - - ~GenericDecipher() { - clear(); - } - - void clear() { - if (ctx_) { - EVP_CIPHER_CTX_cleanup(ctx_); - EVP_CIPHER_CTX_free(ctx_); - ctx_ = nullptr; - } - if (ctx_hmac_) { - HMAC_CTX_free(ctx_hmac_); - ctx_hmac_ = nullptr; - } - } - - ErrorType init(const char* name, - unsigned char* key, - size_t key_len, - unsigned char* iv, - size_t iv_len, - const char* hmac_name, - unsigned char* hmac_key, - size_t hmac_key_len, - int is_etm, - size_t hmac_actual_len) { - ErrorType r = kErrNone; - - const EVP_MD* md; - const EVP_CIPHER* const cipher = EVP_get_cipherbyname(name); - if (cipher == nullptr) { - r = kErrOpenSSL; - goto out; - } - - if ((ctx_ = EVP_CIPHER_CTX_new()) == nullptr - || EVP_DecryptInit_ex(ctx_, cipher, nullptr, nullptr, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (iv_len != static_cast(EVP_CIPHER_CTX_iv_length(ctx_))) { - r = kErrBadIVLen; - goto out; - } - - if (key_len != static_cast(EVP_CIPHER_CTX_key_length(ctx_))) { - if (!EVP_CIPHER_CTX_set_key_length(ctx_, key_len)) { - r = kErrBadKeyLen; - goto out; - } - } - - // Set key and IV - if (EVP_DecryptInit_ex(ctx_, nullptr, nullptr, key, iv) != 1) { - r = kErrOpenSSL; - goto out; - } - - // Disable padding - EVP_CIPHER_CTX_set_padding(ctx_, 0); - - if (cipher == EVP_rc4()) { - /* The "arcfour128" algorithm is the RC4 cipher, as described in - [SCHNEIER], using a 128-bit key. The first 1536 bytes of keystream - generated by the cipher MUST be discarded, and the first byte of the - first encrypted packet MUST be encrypted using the 1537th byte of - keystream. - - -- http://tools.ietf.org/html/rfc4345#section-4 */ - unsigned char zeros[1536] = {0}; - int outlen = sizeof(zeros); - if (EVP_DecryptUpdate(ctx_, - zeros, - &outlen, - zeros, - sizeof(zeros)) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != sizeof(zeros)) { - r = kErrBadInit; - goto out; - } - } - - md = EVP_get_digestbyname(hmac_name); - if (md == nullptr) { - r = kErrBadHMACName; - goto out; - } - - if ((ctx_hmac_ = HMAC_CTX_new()) == nullptr - || HMAC_Init_ex(ctx_hmac_, hmac_key, hmac_key_len, md, nullptr) != 1) { - r = kErrOpenSSL; - goto out; - } - - hmac_len_ = HMAC_size(ctx_hmac_); - hmac_actual_len_ = hmac_actual_len; - is_etm_ = is_etm; - switch (EVP_CIPHER_CTX_mode(ctx_)) { - case EVP_CIPH_STREAM_CIPHER: - case EVP_CIPH_CTR_MODE: - is_stream_ = 1; - break; - default: - is_stream_ = 0; - } - block_size_ = EVP_CIPHER_CTX_block_size(ctx_); - -out: - return r; - } - - ErrorType decrypt_block(unsigned char* data, uint32_t data_len) { - ErrorType r = kErrNone; - - int outlen; - - if (!is_stream_ && data_len != block_size_) { - r = kErrBadBlockLen; - goto out; - } - - // Decrypt block - if (EVP_DecryptUpdate(ctx_, data, &outlen, data, data_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != data_len) { - r = kErrPartialDecrypt; - goto out; - } - -out: - return r; - } - - ErrorType decrypt(unsigned char* packet, - uint32_t packet_len, - uint32_t seqno, - unsigned char* first_block, - uint32_t first_block_len, - unsigned char* mac, - uint32_t mac_len) { - ErrorType r = kErrNone; - - int outlen; - unsigned char calc_mac[MAX_MAC_LEN] = {0}; - - uint8_t seqbuf[4] = {0}; - ((uint8_t*)(seqbuf))[0] = (seqno >> 24) & 0xff; - ((uint8_t*)(seqbuf))[1] = (seqno >> 16) & 0xff; - ((uint8_t*)(seqbuf))[2] = (seqno >> 8) & 0xff; - ((uint8_t*)(seqbuf))[3] = seqno & 0xff; - - if (is_etm_) { - // `first_block` for ETM should just be the unencrypted packet length - if (first_block_len != 4) { - r = kErrBadBlockLen; - goto out; - } - - // HMAC over unencrypted packet length and ciphertext - { - unsigned int outlen = hmac_len_; - if (HMAC_Init_ex(ctx_hmac_, nullptr, 0, nullptr, nullptr) != 1 - || HMAC_Update(ctx_hmac_, seqbuf, sizeof(seqbuf)) != 1 - || HMAC_Update(ctx_hmac_, first_block, 4) != 1 - || HMAC_Update(ctx_hmac_, packet, packet_len) != 1 - || HMAC_Final(ctx_hmac_, calc_mac, &outlen) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (outlen != hmac_len_ || mac_len != hmac_len_) { - r = kErrBadHMACLen; - goto out; - } - - // Compare MACs - if (CRYPTO_memcmp(mac, calc_mac, hmac_len_)) { - r = kErrInvalidMAC; - goto out; - } - } - - // Decrypt packet - if (EVP_DecryptUpdate(ctx_, packet, &outlen, packet, packet_len) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != packet_len) { - r = kErrPartialDecrypt; - goto out; - } - } else { - // `first_block` for non-ETM should be a completely decrypted first block - if (!is_stream_ && first_block_len != block_size_) { - r = kErrBadBlockLen; - goto out; - } - - const int offset = (is_stream_ ? 0 : block_size_ - 4); - // Decrypt the rest of the packet - if (EVP_DecryptUpdate(ctx_, - packet + offset, - &outlen, - packet + offset, - packet_len - offset) != 1) { - r = kErrOpenSSL; - goto out; - } - if (static_cast(outlen) != packet_len - offset) { - r = kErrPartialDecrypt; - goto out; - } - - // HMAC over plaintext - { - unsigned int outlen = hmac_len_; - if (HMAC_Init_ex(ctx_hmac_, nullptr, 0, nullptr, nullptr) != 1 - || HMAC_Update(ctx_hmac_, seqbuf, sizeof(seqbuf)) != 1 - || HMAC_Update(ctx_hmac_, first_block, 4) != 1 - || HMAC_Update(ctx_hmac_, packet, packet_len) != 1 - || HMAC_Final(ctx_hmac_, calc_mac, &outlen) != 1) { - r = kErrOpenSSL; - goto out; - } - - if (outlen != hmac_len_ || mac_len != hmac_actual_len_) { - r = kErrBadHMACLen; - goto out; - } - - // Compare MACs - if (CRYPTO_memcmp(mac, calc_mac, hmac_actual_len_)) { - r = kErrInvalidMAC; - goto out; - } - } - } - -out: - return r; - } - - static NAN_METHOD(New) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - if (!info[0]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid decipher name"); - - if (!Buffer::HasInstance(info[1])) - return Nan::ThrowTypeError("Missing/Invalid decipher key"); - - if (!Buffer::HasInstance(info[2])) - return Nan::ThrowTypeError("Missing/Invalid decipher IV"); - - if (!info[3]->IsString()) - return Nan::ThrowTypeError("Missing/Invalid HMAC name"); - - if (!Buffer::HasInstance(info[4])) - return Nan::ThrowTypeError("Missing/Invalid HMAC key"); - - if (!info[5]->IsBoolean()) - return Nan::ThrowTypeError("Missing/Invalid HMAC ETM flag"); - - if (!info[6]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid HMAC ETM flag"); - - const Nan::Utf8String cipher_name(info[0]); - const Nan::Utf8String mac_name(info[3]); - int is_etm = (Nan::To(info[5]).FromJust() ? 1 : 0); - - GenericDecipher* obj = new GenericDecipher(); - ErrorType r = obj->init( - *cipher_name, - reinterpret_cast(Buffer::Data(info[1])), - Buffer::Length(info[1]), - reinterpret_cast(Buffer::Data(info[2])), - Buffer::Length(info[2]), - *mac_name, - reinterpret_cast(Buffer::Data(info[4])), - Buffer::Length(info[4]), - is_etm, - Nan::To(info[6]).FromJust() - ); - if (r != kErrNone) { - if (r == kErrOpenSSL) { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - obj->clear(); - delete obj; - return Nan::ThrowError(msg_buf); - } - obj->clear(); - delete obj; - switch (r) { - case kErrBadKeyLen: - return Nan::ThrowError("Invalid decipher key length"); - case kErrBadIVLen: - return Nan::ThrowError("Invalid decipher IV length"); - case kErrBadCipherName: - return Nan::ThrowError("Invalid decipher name"); - case kErrBadHMACName: - return Nan::ThrowError("Invalid MAC name"); - case kErrBadInit: - return Nan::ThrowError("Failed to properly initialize decipher"); - default: - return Nan::ThrowError("Unknown init failure"); - } - } - - obj->Wrap(info.This()); - info.GetReturnValue().Set(info.This()); - } - - static NAN_METHOD(DecryptBlock) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - GenericDecipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid block"); - - ErrorType r = obj->decrypt_block( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]) - ); - switch (r) { - case kErrNone: - return; - case kErrBadBlockLen: - return Nan::ThrowError("Invalid block length"); - case kErrPartialDecrypt: - return Nan::ThrowError("Failed to completely decrypt packet"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown decrypt failure"); - } - } - - static NAN_METHOD(Decrypt) { - MarkPopErrorOnReturn mark_pop_error_on_return; - - GenericDecipher* obj = ObjectWrap::Unwrap(info.Holder()); - - if (!Buffer::HasInstance(info[0])) - return Nan::ThrowTypeError("Missing/Invalid packet"); - - if (!info[1]->IsUint32()) - return Nan::ThrowTypeError("Missing/Invalid sequence number"); - - if (!Buffer::HasInstance(info[2])) - return Nan::ThrowTypeError("Missing/Invalid first block"); - - if (!Buffer::HasInstance(info[3])) - return Nan::ThrowTypeError("Missing/Invalid MAC"); - - ErrorType r = obj->decrypt( - reinterpret_cast(Buffer::Data(info[0])), - Buffer::Length(info[0]), - Nan::To(info[1]).FromJust(), - reinterpret_cast(Buffer::Data(info[2])), - Buffer::Length(info[2]), - reinterpret_cast(Buffer::Data(info[3])), - Buffer::Length(info[3]) - ); - switch (r) { - case kErrNone: - return; - case kErrBadBlockLen: - return Nan::ThrowError("Invalid block length"); - case kErrPartialDecrypt: - return Nan::ThrowError("Failed to completely decrypt packet"); - case kErrBadHMACLen: - return Nan::ThrowError("Unexpected HMAC length"); - case kErrInvalidMAC: - return Nan::ThrowError("Invalid MAC"); - case kErrOpenSSL: { - char msg_buf[128] = {0}; - ERR_error_string_n(ERR_get_error(), msg_buf, sizeof(msg_buf)); - ERR_clear_error(); - return Nan::ThrowError(msg_buf); - } - default: - return Nan::ThrowError("Unknown decrypt failure"); - } - } - - static NAN_METHOD(Free) { - GenericDecipher* obj = ObjectWrap::Unwrap(info.Holder()); - obj->clear(); - } - - static inline Nan::Persistent & constructor() { - static Nan::Persistent my_constructor; - return my_constructor; - } - - EVP_CIPHER_CTX* ctx_; - HMAC_CTX* ctx_hmac_; - unsigned int hmac_len_; - unsigned int hmac_actual_len_; - uint8_t is_etm_; - uint8_t is_stream_; - uint32_t block_size_; -}; - - -NAN_MODULE_INIT(init) { - ChaChaPolyCipher::Init(target); - AESGCMCipher::Init(target); - GenericCipher::Init(target); - - ChaChaPolyDecipher::Init(target); - AESGCMDecipher::Init(target); - GenericDecipher::Init(target); -} - -NODE_MODULE(sshcrypto, init) diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.js b/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.js deleted file mode 100644 index 35fb9f28..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.js +++ /dev/null @@ -1,16 +0,0 @@ -'use strict'; - -const MESSAGE_HANDLERS = new Array(256); -[ - require('./kex.js').HANDLERS, - require('./handlers.misc.js'), -].forEach((handlers) => { - // eslint-disable-next-line prefer-const - for (let [type, handler] of Object.entries(handlers)) { - type = +type; - if (isFinite(type) && type >= 0 && type < MESSAGE_HANDLERS.length) - MESSAGE_HANDLERS[type] = handler; - } -}); - -module.exports = MESSAGE_HANDLERS; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.misc.js b/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.misc.js deleted file mode 100644 index 647564b3..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/handlers.misc.js +++ /dev/null @@ -1,1214 +0,0 @@ -'use strict'; - -const { - bufferSlice, - bufferParser, - doFatalError, - sigSSHToASN1, - writeUInt32BE, -} = require('./utils.js'); - -const { - CHANNEL_OPEN_FAILURE, - COMPAT, - MESSAGE, - TERMINAL_MODE, -} = require('./constants.js'); - -const { - parseKey, -} = require('./keyParser.js'); - -const TERMINAL_MODE_BY_VALUE = - Array.from(Object.entries(TERMINAL_MODE)) - .reduce((obj, [key, value]) => ({ ...obj, [key]: value }), {}); - -module.exports = { - // Transport layer protocol ================================================== - [MESSAGE.DISCONNECT]: (self, payload) => { - /* - byte SSH_MSG_DISCONNECT - uint32 reason code - string description in ISO-10646 UTF-8 encoding - string language tag - */ - bufferParser.init(payload, 1); - const reason = bufferParser.readUInt32BE(); - const desc = bufferParser.readString(true); - const lang = bufferParser.readString(); - bufferParser.clear(); - - if (lang === undefined) { - return doFatalError( - self, - 'Inbound: Malformed DISCONNECT packet' - ); - } - - self._debug && self._debug( - `Inbound: Received DISCONNECT (${reason}, "${desc}")` - ); - - const handler = self._handlers.DISCONNECT; - handler && handler(self, reason, desc); - }, - [MESSAGE.IGNORE]: (self, payload) => { - /* - byte SSH_MSG_IGNORE - string data - */ - self._debug && self._debug('Inbound: Received IGNORE'); - }, - [MESSAGE.UNIMPLEMENTED]: (self, payload) => { - /* - byte SSH_MSG_UNIMPLEMENTED - uint32 packet sequence number of rejected message - */ - bufferParser.init(payload, 1); - const seqno = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (seqno === undefined) { - return doFatalError( - self, - 'Inbound: Malformed UNIMPLEMENTED packet' - ); - } - - self._debug - && self._debug(`Inbound: Received UNIMPLEMENTED (seqno ${seqno})`); - }, - [MESSAGE.DEBUG]: (self, payload) => { - /* - byte SSH_MSG_DEBUG - boolean always_display - string message in ISO-10646 UTF-8 encoding [RFC3629] - string language tag [RFC3066] - */ - bufferParser.init(payload, 1); - const display = bufferParser.readBool(); - const msg = bufferParser.readString(true); - const lang = bufferParser.readString(); - bufferParser.clear(); - - if (lang === undefined) { - return doFatalError( - self, - 'Inbound: Malformed DEBUG packet' - ); - } - - self._debug && self._debug('Inbound: Received DEBUG'); - - const handler = self._handlers.DEBUG; - handler && handler(self, display, msg); - }, - [MESSAGE.SERVICE_REQUEST]: (self, payload) => { - /* - byte SSH_MSG_SERVICE_REQUEST - string service name - */ - bufferParser.init(payload, 1); - const name = bufferParser.readString(true); - bufferParser.clear(); - - if (name === undefined) { - return doFatalError( - self, - 'Inbound: Malformed SERVICE_REQUEST packet' - ); - } - - self._debug && self._debug(`Inbound: Received SERVICE_REQUEST (${name})`); - - const handler = self._handlers.SERVICE_REQUEST; - handler && handler(self, name); - }, - [MESSAGE.SERVICE_ACCEPT]: (self, payload) => { - // S->C - /* - byte SSH_MSG_SERVICE_ACCEPT - string service name - */ - bufferParser.init(payload, 1); - const name = bufferParser.readString(true); - bufferParser.clear(); - - if (name === undefined) { - return doFatalError( - self, - 'Inbound: Malformed SERVICE_ACCEPT packet' - ); - } - - self._debug && self._debug(`Inbound: Received SERVICE_ACCEPT (${name})`); - - const handler = self._handlers.SERVICE_ACCEPT; - handler && handler(self, name); - }, - - // User auth protocol -- generic ============================================= - [MESSAGE.USERAUTH_REQUEST]: (self, payload) => { - /* - byte SSH_MSG_USERAUTH_REQUEST - string user name in ISO-10646 UTF-8 encoding [RFC3629] - string service name in US-ASCII - string method name in US-ASCII - .... method specific fields - */ - bufferParser.init(payload, 1); - const user = bufferParser.readString(true); - const service = bufferParser.readString(true); - const method = bufferParser.readString(true); - let methodData; - let methodDesc; - switch (method) { - case 'none': - methodData = null; - break; - case 'password': { - /* - boolean - string plaintext password in ISO-10646 UTF-8 encoding [RFC3629] - [string new password] - */ - const isChange = bufferParser.readBool(); - if (isChange !== undefined) { - methodData = bufferParser.readString(true); - if (methodData !== undefined && isChange) { - const newPassword = bufferParser.readString(true); - if (newPassword !== undefined) - methodData = { oldPassword: methodData, newPassword }; - else - methodData = undefined; - } - } - break; - } - case 'publickey': { - /* - boolean - string public key algorithm name - string public key blob - [string signature] - */ - const hasSig = bufferParser.readBool(); - if (hasSig !== undefined) { - const keyAlgo = bufferParser.readString(true); - const key = bufferParser.readString(); - if (hasSig) { - const blobEnd = bufferParser.pos(); - let signature = bufferParser.readString(); - if (signature !== undefined) { - if (signature.length > (4 + keyAlgo.length + 4) - && signature.utf8Slice(4, 4 + keyAlgo.length) === keyAlgo) { - // Skip algoLen + algo + sigLen - signature = bufferSlice(signature, 4 + keyAlgo.length + 4); - } - - signature = sigSSHToASN1(signature, keyAlgo); - if (signature) { - const sessionID = self._kex.sessionID; - const blob = Buffer.allocUnsafe(4 + sessionID.length + blobEnd); - writeUInt32BE(blob, sessionID.length, 0); - blob.set(sessionID, 4); - blob.set( - new Uint8Array(payload.buffer, payload.byteOffset, blobEnd), - 4 + sessionID.length - ); - methodData = { - keyAlgo, - key, - signature, - blob, - }; - } - } - } else { - methodData = { keyAlgo, key }; - methodDesc = 'publickey -- check'; - } - } - break; - } - case 'hostbased': { - /* - string public key algorithm for host key - string public host key and certificates for client host - string client host name expressed as the FQDN in US-ASCII - string user name on the client host in ISO-10646 UTF-8 encoding - [RFC3629] - string signature - */ - const keyAlgo = bufferParser.readString(true); - const key = bufferParser.readString(); - const localHostname = bufferParser.readString(true); - const localUsername = bufferParser.readString(true); - - const blobEnd = bufferParser.pos(); - let signature = bufferParser.readString(); - if (signature !== undefined) { - if (signature.length > (4 + keyAlgo.length + 4) - && signature.utf8Slice(4, 4 + keyAlgo.length) === keyAlgo) { - // Skip algoLen + algo + sigLen - signature = bufferSlice(signature, 4 + keyAlgo.length + 4); - } - - signature = sigSSHToASN1(signature, keyAlgo); - if (signature !== undefined) { - const sessionID = self._kex.sessionID; - const blob = Buffer.allocUnsafe(4 + sessionID.length + blobEnd); - writeUInt32BE(blob, sessionID.length, 0); - blob.set(sessionID, 4); - blob.set( - new Uint8Array(payload.buffer, payload.byteOffset, blobEnd), - 4 + sessionID.length - ); - methodData = { - keyAlgo, - key, - signature, - blob, - localHostname, - localUsername, - }; - } - } - break; - } - case 'keyboard-interactive': - /* - string language tag (as defined in [RFC-3066]) - string submethods (ISO-10646 UTF-8) - */ - // Skip/ignore language field -- it's deprecated in RFC 4256 - bufferParser.skipString(); - - methodData = bufferParser.readList(); - break; - default: - if (method !== undefined) - methodData = bufferParser.readRaw(); - } - bufferParser.clear(); - - if (methodData === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_REQUEST packet' - ); - } - - if (methodDesc === undefined) - methodDesc = method; - - self._authsQueue.push(method); - - self._debug - && self._debug(`Inbound: Received USERAUTH_REQUEST (${methodDesc})`); - - const handler = self._handlers.USERAUTH_REQUEST; - handler && handler(self, user, service, method, methodData); - }, - [MESSAGE.USERAUTH_FAILURE]: (self, payload) => { - // S->C - /* - byte SSH_MSG_USERAUTH_FAILURE - name-list authentications that can continue - boolean partial success - */ - bufferParser.init(payload, 1); - const authMethods = bufferParser.readList(); - const partialSuccess = bufferParser.readBool(); - bufferParser.clear(); - - if (partialSuccess === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_FAILURE packet' - ); - } - - self._debug - && self._debug(`Inbound: Received USERAUTH_FAILURE (${authMethods})`); - - self._authsQueue.shift(); - const handler = self._handlers.USERAUTH_FAILURE; - handler && handler(self, authMethods, partialSuccess); - }, - [MESSAGE.USERAUTH_SUCCESS]: (self, payload) => { - // S->C - /* - byte SSH_MSG_USERAUTH_SUCCESS - */ - self._debug && self._debug('Inbound: Received USERAUTH_SUCCESS'); - - self._authsQueue.shift(); - const handler = self._handlers.USERAUTH_SUCCESS; - handler && handler(self); - }, - [MESSAGE.USERAUTH_BANNER]: (self, payload) => { - // S->C - /* - byte SSH_MSG_USERAUTH_BANNER - string message in ISO-10646 UTF-8 encoding [RFC3629] - string language tag [RFC3066] - */ - bufferParser.init(payload, 1); - const msg = bufferParser.readString(true); - const lang = bufferParser.readString(); - bufferParser.clear(); - - if (lang === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_BANNER packet' - ); - } - - self._debug && self._debug('Inbound: Received USERAUTH_BANNER'); - - const handler = self._handlers.USERAUTH_BANNER; - handler && handler(self, msg); - }, - - // User auth protocol -- method-specific ===================================== - 60: (self, payload) => { - if (!self._authsQueue.length) { - self._debug - && self._debug('Inbound: Received payload type 60 without auth'); - return; - } - - switch (self._authsQueue[0]) { - case 'password': { - // S->C - /* - byte SSH_MSG_USERAUTH_PASSWD_CHANGEREQ - string prompt in ISO-10646 UTF-8 encoding [RFC3629] - string language tag [RFC3066] - */ - bufferParser.init(payload, 1); - const prompt = bufferParser.readString(true); - const lang = bufferParser.readString(); - bufferParser.clear(); - - if (lang === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_PASSWD_CHANGEREQ packet' - ); - } - - self._debug - && self._debug('Inbound: Received USERAUTH_PASSWD_CHANGEREQ'); - - const handler = self._handlers.USERAUTH_PASSWD_CHANGEREQ; - handler && handler(self, prompt); - break; - } - case 'publickey': { - // S->C - /* - byte SSH_MSG_USERAUTH_PK_OK - string public key algorithm name from the request - string public key blob from the request - */ - bufferParser.init(payload, 1); - const keyAlgo = bufferParser.readString(true); - const key = bufferParser.readString(); - bufferParser.clear(); - - if (key === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_PK_OK packet' - ); - } - - self._debug && self._debug('Inbound: Received USERAUTH_PK_OK'); - - self._authsQueue.shift(); - const handler = self._handlers.USERAUTH_PK_OK; - handler && handler(self, keyAlgo, key); - break; - } - case 'keyboard-interactive': { - // S->C - /* - byte SSH_MSG_USERAUTH_INFO_REQUEST - string name (ISO-10646 UTF-8) - string instruction (ISO-10646 UTF-8) - string language tag (as defined in [RFC-3066]) - int num-prompts - string prompt[1] (ISO-10646 UTF-8) - boolean echo[1] - ... - string prompt[num-prompts] (ISO-10646 UTF-8) - boolean echo[num-prompts] - */ - bufferParser.init(payload, 1); - const name = bufferParser.readString(true); - const instructions = bufferParser.readString(true); - bufferParser.readString(); // skip lang - const numPrompts = bufferParser.readUInt32BE(); - let prompts; - if (numPrompts !== undefined) { - prompts = new Array(numPrompts); - let i; - for (i = 0; i < numPrompts; ++i) { - const prompt = bufferParser.readString(true); - const echo = bufferParser.readBool(); - if (echo === undefined) - break; - prompts[i] = { prompt, echo }; - } - if (i !== numPrompts) - prompts = undefined; - } - bufferParser.clear(); - - if (prompts === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_INFO_REQUEST packet' - ); - } - - self._debug && self._debug('Inbound: Received USERAUTH_INFO_REQUEST'); - - const handler = self._handlers.USERAUTH_INFO_REQUEST; - handler && handler(self, name, instructions, prompts); - break; - } - default: - self._debug - && self._debug('Inbound: Received unexpected payload type 60'); - } - }, - 61: (self, payload) => { - if (!self._authsQueue.length) { - self._debug - && self._debug('Inbound: Received payload type 61 without auth'); - return; - } - /* - byte SSH_MSG_USERAUTH_INFO_RESPONSE - int num-responses - string response[1] (ISO-10646 UTF-8) - ... - string response[num-responses] (ISO-10646 UTF-8) - */ - if (self._authsQueue[0] !== 'keyboard-interactive') { - return doFatalError( - self, - 'Inbound: Received unexpected payload type 61' - ); - } - bufferParser.init(payload, 1); - const numResponses = bufferParser.readUInt32BE(); - let responses; - if (numResponses !== undefined) { - responses = new Array(numResponses); - let i; - for (i = 0; i < numResponses; ++i) { - const response = bufferParser.readString(true); - if (response === undefined) - break; - responses[i] = response; - } - if (i !== numResponses) - responses = undefined; - } - bufferParser.clear(); - - if (responses === undefined) { - return doFatalError( - self, - 'Inbound: Malformed USERAUTH_INFO_RESPONSE packet' - ); - } - - self._debug && self._debug('Inbound: Received USERAUTH_INFO_RESPONSE'); - - const handler = self._handlers.USERAUTH_INFO_RESPONSE; - handler && handler(self, responses); - }, - - // Connection protocol -- generic ============================================ - [MESSAGE.GLOBAL_REQUEST]: (self, payload) => { - /* - byte SSH_MSG_GLOBAL_REQUEST - string request name in US-ASCII only - boolean want reply - .... request-specific data follows - */ - bufferParser.init(payload, 1); - const name = bufferParser.readString(true); - const wantReply = bufferParser.readBool(); - let data; - if (wantReply !== undefined) { - switch (name) { - case 'tcpip-forward': - case 'cancel-tcpip-forward': { - /* - string address to bind (e.g., "0.0.0.0") - uint32 port number to bind - */ - const bindAddr = bufferParser.readString(true); - const bindPort = bufferParser.readUInt32BE(); - if (bindPort !== undefined) - data = { bindAddr, bindPort }; - break; - } - case 'streamlocal-forward@openssh.com': - case 'cancel-streamlocal-forward@openssh.com': { - /* - string socket path - */ - const socketPath = bufferParser.readString(true); - if (socketPath !== undefined) - data = { socketPath }; - break; - } - case 'no-more-sessions@openssh.com': - data = null; - break; - case 'hostkeys-00@openssh.com': { - data = []; - while (bufferParser.avail() > 0) { - const keyRaw = bufferParser.readString(); - if (keyRaw === undefined) { - data = undefined; - break; - } - const key = parseKey(keyRaw); - if (!(key instanceof Error)) - data.push(key); - } - break; - } - default: - data = bufferParser.readRaw(); - } - } - bufferParser.clear(); - - if (data === undefined) { - return doFatalError( - self, - 'Inbound: Malformed GLOBAL_REQUEST packet' - ); - } - - self._debug && self._debug(`Inbound: GLOBAL_REQUEST (${name})`); - - const handler = self._handlers.GLOBAL_REQUEST; - if (handler) - handler(self, name, wantReply, data); - else - self.requestFailure(); // Auto reject - }, - [MESSAGE.REQUEST_SUCCESS]: (self, payload) => { - /* - byte SSH_MSG_REQUEST_SUCCESS - .... response specific data - */ - const data = (payload.length > 1 ? bufferSlice(payload, 1) : null); - - self._debug && self._debug('Inbound: REQUEST_SUCCESS'); - - const handler = self._handlers.REQUEST_SUCCESS; - handler && handler(self, data); - }, - [MESSAGE.REQUEST_FAILURE]: (self, payload) => { - /* - byte SSH_MSG_REQUEST_FAILURE - */ - self._debug && self._debug('Inbound: Received REQUEST_FAILURE'); - - const handler = self._handlers.REQUEST_FAILURE; - handler && handler(self); - }, - - // Connection protocol -- channel-related ==================================== - [MESSAGE.CHANNEL_OPEN]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_OPEN - string channel type in US-ASCII only - uint32 sender channel - uint32 initial window size - uint32 maximum packet size - .... channel type specific data follows - */ - bufferParser.init(payload, 1); - const type = bufferParser.readString(true); - const sender = bufferParser.readUInt32BE(); - const window = bufferParser.readUInt32BE(); - const packetSize = bufferParser.readUInt32BE(); - let channelInfo; - - switch (type) { - case 'forwarded-tcpip': // S->C - case 'direct-tcpip': { // C->S - /* - string address that was connected / host to connect - uint32 port that was connected / port to connect - string originator IP address - uint32 originator port - */ - const destIP = bufferParser.readString(true); - const destPort = bufferParser.readUInt32BE(); - const srcIP = bufferParser.readString(true); - const srcPort = bufferParser.readUInt32BE(); - if (srcPort !== undefined) { - channelInfo = { - type, - sender, - window, - packetSize, - data: { destIP, destPort, srcIP, srcPort } - }; - } - break; - } - case 'forwarded-streamlocal@openssh.com': // S->C - case 'direct-streamlocal@openssh.com': { // C->S - /* - string socket path - string reserved for future use - - (direct-streamlocal@openssh.com additionally has:) - uint32 reserved - */ - const socketPath = bufferParser.readString(true); - if (socketPath !== undefined) { - channelInfo = { - type, - sender, - window, - packetSize, - data: { socketPath } - }; - } - break; - } - case 'x11': { // S->C - /* - string originator address (e.g., "192.168.7.38") - uint32 originator port - */ - const srcIP = bufferParser.readString(true); - const srcPort = bufferParser.readUInt32BE(); - if (srcPort !== undefined) { - channelInfo = { - type, - sender, - window, - packetSize, - data: { srcIP, srcPort } - }; - } - break; - } - default: - // Includes: - // 'session' (C->S) - // 'auth-agent@openssh.com' (S->C) - channelInfo = { - type, - sender, - window, - packetSize, - data: {} - }; - } - bufferParser.clear(); - - if (channelInfo === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_OPEN packet' - ); - } - - self._debug && self._debug(`Inbound: CHANNEL_OPEN (s:${sender}, ${type})`); - - const handler = self._handlers.CHANNEL_OPEN; - if (handler) { - handler(self, channelInfo); - } else { - self.channelOpenFail( - channelInfo.sender, - CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED, - '', - '' - ); - } - }, - [MESSAGE.CHANNEL_OPEN_CONFIRMATION]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_OPEN_CONFIRMATION - uint32 recipient channel - uint32 sender channel - uint32 initial window size - uint32 maximum packet size - .... channel type specific data follows - */ - // "The 'recipient channel' is the channel number given in the - // original open request, and 'sender channel' is the channel number - // allocated by the other side." - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const sender = bufferParser.readUInt32BE(); - const window = bufferParser.readUInt32BE(); - const packetSize = bufferParser.readUInt32BE(); - const data = (bufferParser.avail() ? bufferParser.readRaw() : undefined); - bufferParser.clear(); - - if (packetSize === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_OPEN_CONFIRMATION packet' - ); - } - - self._debug && self._debug( - `Inbound: CHANNEL_OPEN_CONFIRMATION (r:${recipient}, s:${sender})` - ); - - const handler = self._handlers.CHANNEL_OPEN_CONFIRMATION; - if (handler) - handler(self, { recipient, sender, window, packetSize, data }); - }, - [MESSAGE.CHANNEL_OPEN_FAILURE]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_OPEN_FAILURE - uint32 recipient channel - uint32 reason code - string description in ISO-10646 UTF-8 encoding [RFC3629] - string language tag [RFC3066] - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const reason = bufferParser.readUInt32BE(); - const description = bufferParser.readString(true); - const lang = bufferParser.readString(); - bufferParser.clear(); - - if (lang === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_OPEN_FAILURE packet' - ); - } - - self._debug - && self._debug(`Inbound: CHANNEL_OPEN_FAILURE (r:${recipient})`); - - const handler = self._handlers.CHANNEL_OPEN_FAILURE; - handler && handler(self, recipient, reason, description); - }, - [MESSAGE.CHANNEL_WINDOW_ADJUST]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_WINDOW_ADJUST - uint32 recipient channel - uint32 bytes to add - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const bytesToAdd = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (bytesToAdd === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_WINDOW_ADJUST packet' - ); - } - - self._debug && self._debug( - `Inbound: CHANNEL_WINDOW_ADJUST (r:${recipient}, ${bytesToAdd})` - ); - - const handler = self._handlers.CHANNEL_WINDOW_ADJUST; - handler && handler(self, recipient, bytesToAdd); - }, - [MESSAGE.CHANNEL_DATA]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_DATA - uint32 recipient channel - string data - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const data = bufferParser.readString(); - bufferParser.clear(); - - if (data === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_DATA packet' - ); - } - - self._debug - && self._debug(`Inbound: CHANNEL_DATA (r:${recipient}, ${data.length})`); - - const handler = self._handlers.CHANNEL_DATA; - handler && handler(self, recipient, data); - }, - [MESSAGE.CHANNEL_EXTENDED_DATA]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_EXTENDED_DATA - uint32 recipient channel - uint32 data_type_code - string data - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const type = bufferParser.readUInt32BE(); - const data = bufferParser.readString(); - bufferParser.clear(); - - if (data === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_EXTENDED_DATA packet' - ); - } - - self._debug && self._debug( - `Inbound: CHANNEL_EXTENDED_DATA (r:${recipient}, ${data.length})` - ); - - const handler = self._handlers.CHANNEL_EXTENDED_DATA; - handler && handler(self, recipient, data, type); - }, - [MESSAGE.CHANNEL_EOF]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_EOF - uint32 recipient channel - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (recipient === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_EOF packet' - ); - } - - self._debug && self._debug(`Inbound: CHANNEL_EOF (r:${recipient})`); - - const handler = self._handlers.CHANNEL_EOF; - handler && handler(self, recipient); - }, - [MESSAGE.CHANNEL_CLOSE]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_CLOSE - uint32 recipient channel - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (recipient === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_CLOSE packet' - ); - } - - self._debug && self._debug(`Inbound: CHANNEL_CLOSE (r:${recipient})`); - - const handler = self._handlers.CHANNEL_CLOSE; - handler && handler(self, recipient); - }, - [MESSAGE.CHANNEL_REQUEST]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_REQUEST - uint32 recipient channel - string request type in US-ASCII characters only - boolean want reply - .... type-specific data follows - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - const type = bufferParser.readString(true); - const wantReply = bufferParser.readBool(); - let data; - if (wantReply !== undefined) { - switch (type) { - case 'exit-status': // S->C - /* - uint32 exit_status - */ - data = bufferParser.readUInt32BE(); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})` - ); - break; - case 'exit-signal': { // S->C - /* - string signal name (without the "SIG" prefix) - boolean core dumped - string error message in ISO-10646 UTF-8 encoding - string language tag - */ - let signal; - let coreDumped; - if (self._compatFlags & COMPAT.OLD_EXIT) { - /* - Instead of `signal name` and `core dumped`, we have just: - uint32 signal number - */ - const num = bufferParser.readUInt32BE(); - switch (num) { - case 1: - signal = 'HUP'; - break; - case 2: - signal = 'INT'; - break; - case 3: - signal = 'QUIT'; - break; - case 6: - signal = 'ABRT'; - break; - case 9: - signal = 'KILL'; - break; - case 14: - signal = 'ALRM'; - break; - case 15: - signal = 'TERM'; - break; - default: - if (num !== undefined) { - // Unknown or OS-specific - signal = `UNKNOWN (${num})`; - } - } - coreDumped = false; - } else { - signal = bufferParser.readString(true); - coreDumped = bufferParser.readBool(); - if (coreDumped === undefined) - signal = undefined; - } - const errorMessage = bufferParser.readString(true); - if (bufferParser.skipString() !== undefined) - data = { signal, coreDumped, errorMessage }; - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${signal})` - ); - break; - } - case 'pty-req': { // C->S - /* - string TERM environment variable value (e.g., vt100) - uint32 terminal width, characters (e.g., 80) - uint32 terminal height, rows (e.g., 24) - uint32 terminal width, pixels (e.g., 640) - uint32 terminal height, pixels (e.g., 480) - string encoded terminal modes - */ - const term = bufferParser.readString(true); - const cols = bufferParser.readUInt32BE(); - const rows = bufferParser.readUInt32BE(); - const width = bufferParser.readUInt32BE(); - const height = bufferParser.readUInt32BE(); - const modesBinary = bufferParser.readString(); - if (modesBinary !== undefined) { - bufferParser.init(modesBinary, 1); - let modes = {}; - while (bufferParser.avail()) { - const opcode = bufferParser.readByte(); - if (opcode === TERMINAL_MODE.TTY_OP_END) - break; - const name = TERMINAL_MODE_BY_VALUE[opcode]; - const value = bufferParser.readUInt32BE(); - if (opcode === undefined - || name === undefined - || value === undefined) { - modes = undefined; - break; - } - modes[name] = value; - } - if (modes !== undefined) - data = { term, cols, rows, width, height, modes }; - } - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - break; - } - case 'window-change': { // C->S - /* - uint32 terminal width, columns - uint32 terminal height, rows - uint32 terminal width, pixels - uint32 terminal height, pixels - */ - const cols = bufferParser.readUInt32BE(); - const rows = bufferParser.readUInt32BE(); - const width = bufferParser.readUInt32BE(); - const height = bufferParser.readUInt32BE(); - if (height !== undefined) - data = { cols, rows, width, height }; - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - break; - } - case 'x11-req': { // C->S - /* - boolean single connection - string x11 authentication protocol - string x11 authentication cookie - uint32 x11 screen number - */ - const single = bufferParser.readBool(); - const protocol = bufferParser.readString(true); - const cookie = bufferParser.readString(); - const screen = bufferParser.readUInt32BE(); - if (screen !== undefined) - data = { single, protocol, cookie, screen }; - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - break; - } - case 'env': { // C->S - /* - string variable name - string variable value - */ - const name = bufferParser.readString(true); - const value = bufferParser.readString(true); - if (value !== undefined) - data = { name, value }; - if (self._debug) { - self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ` - + `${name}=${value})` - ); - } - break; - } - case 'shell': // C->S - data = null; // No extra data - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - break; - case 'exec': // C->S - /* - string command - */ - data = bufferParser.readString(true); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})` - ); - break; - case 'subsystem': // C->S - /* - string subsystem name - */ - data = bufferParser.readString(true); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})` - ); - break; - case 'signal': // C->S - /* - string signal name (without the "SIG" prefix) - */ - data = bufferParser.readString(true); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})` - ); - break; - case 'xon-xoff': // C->S - /* - boolean client can do - */ - data = bufferParser.readBool(); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type}: ${data})` - ); - break; - case 'auth-agent-req@openssh.com': // C-S - data = null; // No extra data - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - break; - default: - data = (bufferParser.avail() ? bufferParser.readRaw() : null); - self._debug && self._debug( - `Inbound: CHANNEL_REQUEST (r:${recipient}, ${type})` - ); - } - } - bufferParser.clear(); - - if (data === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_REQUEST packet' - ); - } - - const handler = self._handlers.CHANNEL_REQUEST; - handler && handler(self, recipient, type, wantReply, data); - }, - [MESSAGE.CHANNEL_SUCCESS]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_SUCCESS - uint32 recipient channel - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (recipient === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_SUCCESS packet' - ); - } - - self._debug && self._debug(`Inbound: CHANNEL_SUCCESS (r:${recipient})`); - - const handler = self._handlers.CHANNEL_SUCCESS; - handler && handler(self, recipient); - }, - [MESSAGE.CHANNEL_FAILURE]: (self, payload) => { - /* - byte SSH_MSG_CHANNEL_FAILURE - uint32 recipient channel - */ - bufferParser.init(payload, 1); - const recipient = bufferParser.readUInt32BE(); - bufferParser.clear(); - - if (recipient === undefined) { - return doFatalError( - self, - 'Inbound: Malformed CHANNEL_FAILURE packet' - ); - } - - self._debug && self._debug(`Inbound: CHANNEL_FAILURE (r:${recipient})`); - - const handler = self._handlers.CHANNEL_FAILURE; - handler && handler(self, recipient); - }, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/kex.js b/reverse_engineering/node_modules/ssh2/lib/protocol/kex.js deleted file mode 100644 index 507c88af..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/kex.js +++ /dev/null @@ -1,1831 +0,0 @@ -'use strict'; - -const { - createDiffieHellman, - createDiffieHellmanGroup, - createECDH, - createHash, - createPublicKey, - diffieHellman, - generateKeyPairSync, - randomFillSync, -} = require('crypto'); - -const { Ber } = require('asn1'); - -const { - COMPAT, - curve25519Supported, - DEFAULT_KEX, - DEFAULT_SERVER_HOST_KEY, - DEFAULT_CIPHER, - DEFAULT_MAC, - DEFAULT_COMPRESSION, - DISCONNECT_REASON, - MESSAGE, -} = require('./constants.js'); -const { - CIPHER_INFO, - createCipher, - createDecipher, - MAC_INFO, -} = require('./crypto.js'); -const { parseDERKey } = require('./keyParser.js'); -const { - bufferFill, - bufferParser, - convertSignature, - doFatalError, - FastBuffer, - sigSSHToASN1, - writeUInt32BE, -} = require('./utils.js'); -const { - PacketReader, - PacketWriter, - ZlibPacketReader, - ZlibPacketWriter, -} = require('./zlib.js'); - -let MESSAGE_HANDLERS; - -const GEX_MIN_BITS = 2048; // RFC 8270 -const GEX_MAX_BITS = 8192; // RFC 8270 - -const EMPTY_BUFFER = Buffer.alloc(0); - -// Client/Server -function kexinit(self) { - /* - byte SSH_MSG_KEXINIT - byte[16] cookie (random bytes) - name-list kex_algorithms - name-list server_host_key_algorithms - name-list encryption_algorithms_client_to_server - name-list encryption_algorithms_server_to_client - name-list mac_algorithms_client_to_server - name-list mac_algorithms_server_to_client - name-list compression_algorithms_client_to_server - name-list compression_algorithms_server_to_client - name-list languages_client_to_server - name-list languages_server_to_client - boolean first_kex_packet_follows - uint32 0 (reserved for future extension) - */ - - let payload; - if (self._compatFlags & COMPAT.BAD_DHGEX) { - const entry = self._offer.lists.kex; - let kex = entry.array; - let found = false; - for (let i = 0; i < kex.length; ++i) { - if (kex[i].indexOf('group-exchange') !== -1) { - if (!found) { - found = true; - // Copy array lazily - kex = kex.slice(); - } - kex.splice(i--, 1); - } - } - if (found) { - let len = 1 + 16 + self._offer.totalSize + 1 + 4; - const newKexBuf = Buffer.from(kex.join(',')); - len -= (entry.buffer.length - newKexBuf.length); - - const all = self._offer.lists.all; - const rest = new Uint8Array( - all.buffer, - all.byteOffset + 4 + entry.buffer.length, - all.length - (4 + entry.buffer.length) - ); - - payload = Buffer.allocUnsafe(len); - writeUInt32BE(payload, newKexBuf.length, 0); - payload.set(newKexBuf, 4); - payload.set(rest, 4 + newKexBuf.length); - } - } - - if (payload === undefined) { - payload = Buffer.allocUnsafe(1 + 16 + self._offer.totalSize + 1 + 4); - self._offer.copyAllTo(payload, 17); - } - - self._debug && self._debug('Outbound: Sending KEXINIT'); - - payload[0] = MESSAGE.KEXINIT; - randomFillSync(payload, 1, 16); - - // Zero-fill first_kex_packet_follows and reserved bytes - bufferFill(payload, 0, payload.length - 5); - - self._kexinit = payload; - - // Needed to correct the starting position in allocated "packets" when packets - // will be buffered due to active key exchange - self._packetRW.write.allocStart = 0; - - // TODO: only create single buffer and set _kexinit as slice of packet instead - { - const p = self._packetRW.write.allocStartKEX; - const packet = self._packetRW.write.alloc(payload.length, true); - packet.set(payload, p); - self._cipher.encrypt(self._packetRW.write.finalize(packet, true)); - } -} - -function handleKexInit(self, payload) { - /* - byte SSH_MSG_KEXINIT - byte[16] cookie (random bytes) - name-list kex_algorithms - name-list server_host_key_algorithms - name-list encryption_algorithms_client_to_server - name-list encryption_algorithms_server_to_client - name-list mac_algorithms_client_to_server - name-list mac_algorithms_server_to_client - name-list compression_algorithms_client_to_server - name-list compression_algorithms_server_to_client - name-list languages_client_to_server - name-list languages_server_to_client - boolean first_kex_packet_follows - uint32 0 (reserved for future extension) - */ - const init = { - kex: undefined, - serverHostKey: undefined, - cs: { - cipher: undefined, - mac: undefined, - compress: undefined, - lang: undefined, - }, - sc: { - cipher: undefined, - mac: undefined, - compress: undefined, - lang: undefined, - }, - }; - - bufferParser.init(payload, 17); - - if ((init.kex = bufferParser.readList()) === undefined - || (init.serverHostKey = bufferParser.readList()) === undefined - || (init.cs.cipher = bufferParser.readList()) === undefined - || (init.sc.cipher = bufferParser.readList()) === undefined - || (init.cs.mac = bufferParser.readList()) === undefined - || (init.sc.mac = bufferParser.readList()) === undefined - || (init.cs.compress = bufferParser.readList()) === undefined - || (init.sc.compress = bufferParser.readList()) === undefined - || (init.cs.lang = bufferParser.readList()) === undefined - || (init.sc.lang = bufferParser.readList()) === undefined) { - bufferParser.clear(); - return doFatalError( - self, - 'Received malformed KEXINIT', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - const pos = bufferParser.pos(); - const firstFollows = (pos < payload.length && payload[pos] === 1); - bufferParser.clear(); - - const local = self._offer; - const remote = init; - - let localKex = local.lists.kex.array; - if (self._compatFlags & COMPAT.BAD_DHGEX) { - let found = false; - for (let i = 0; i < localKex.length; ++i) { - if (localKex[i].indexOf('group-exchange') !== -1) { - if (!found) { - found = true; - // Copy array lazily - localKex = localKex.slice(); - } - localKex.splice(i--, 1); - } - } - } - - let clientList; - let serverList; - let i; - const debug = self._debug; - - debug && debug('Inbound: Handshake in progress'); - - // Key exchange method ======================================================= - debug && debug(`Handshake: (local) KEX method: ${localKex}`); - debug && debug(`Handshake: (remote) KEX method: ${remote.kex}`); - if (self._server) { - serverList = localKex; - clientList = remote.kex; - } else { - serverList = remote.kex; - clientList = localKex; - } - // Check for agreeable key exchange algorithm - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching key exchange algorithm'); - return doFatalError( - self, - 'Handshake failed: no matching key exchange algorithm', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.kex = clientList[i]; - debug && debug(`Handshake: KEX algorithm: ${clientList[i]}`); - if (firstFollows && (!remote.kex.length || clientList[i] !== remote.kex[0])) { - // Ignore next inbound packet, it was a wrong first guess at KEX algorithm - self._skipNextInboundPacket = true; - } - - - // Server host key format ==================================================== - const localSrvHostKey = local.lists.serverHostKey.array; - debug && debug(`Handshake: (local) Host key format: ${localSrvHostKey}`); - debug && debug( - `Handshake: (remote) Host key format: ${remote.serverHostKey}` - ); - if (self._server) { - serverList = localSrvHostKey; - clientList = remote.serverHostKey; - } else { - serverList = remote.serverHostKey; - clientList = localSrvHostKey; - } - // Check for agreeable server host key format - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching host key format'); - return doFatalError( - self, - 'Handshake failed: no matching host key format', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.serverHostKey = clientList[i]; - debug && debug(`Handshake: Host key format: ${clientList[i]}`); - - - // Client->Server cipher ===================================================== - const localCSCipher = local.lists.cs.cipher.array; - debug && debug(`Handshake: (local) C->S cipher: ${localCSCipher}`); - debug && debug(`Handshake: (remote) C->S cipher: ${remote.cs.cipher}`); - if (self._server) { - serverList = localCSCipher; - clientList = remote.cs.cipher; - } else { - serverList = remote.cs.cipher; - clientList = localCSCipher; - } - // Check for agreeable client->server cipher - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching C->S cipher'); - return doFatalError( - self, - 'Handshake failed: no matching C->S cipher', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.cs.cipher = clientList[i]; - debug && debug(`Handshake: C->S Cipher: ${clientList[i]}`); - - - // Server->Client cipher ===================================================== - const localSCCipher = local.lists.sc.cipher.array; - debug && debug(`Handshake: (local) S->C cipher: ${localSCCipher}`); - debug && debug(`Handshake: (remote) S->C cipher: ${remote.sc.cipher}`); - if (self._server) { - serverList = localSCCipher; - clientList = remote.sc.cipher; - } else { - serverList = remote.sc.cipher; - clientList = localSCCipher; - } - // Check for agreeable server->client cipher - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching S->C cipher'); - return doFatalError( - self, - 'Handshake failed: no matching S->C cipher', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.sc.cipher = clientList[i]; - debug && debug(`Handshake: S->C cipher: ${clientList[i]}`); - - - // Client->Server MAC ======================================================== - const localCSMAC = local.lists.cs.mac.array; - debug && debug(`Handshake: (local) C->S MAC: ${localCSMAC}`); - debug && debug(`Handshake: (remote) C->S MAC: ${remote.cs.mac}`); - if (CIPHER_INFO[init.cs.cipher].authLen > 0) { - init.cs.mac = ''; - debug && debug('Handshake: C->S MAC: '); - } else { - if (self._server) { - serverList = localCSMAC; - clientList = remote.cs.mac; - } else { - serverList = remote.cs.mac; - clientList = localCSMAC; - } - // Check for agreeable client->server hmac algorithm - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching C->S MAC'); - return doFatalError( - self, - 'Handshake failed: no matching C->S MAC', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.cs.mac = clientList[i]; - debug && debug(`Handshake: C->S MAC: ${clientList[i]}`); - } - - - // Server->Client MAC ======================================================== - const localSCMAC = local.lists.sc.mac.array; - debug && debug(`Handshake: (local) S->C MAC: ${localSCMAC}`); - debug && debug(`Handshake: (remote) S->C MAC: ${remote.sc.mac}`); - if (CIPHER_INFO[init.sc.cipher].authLen > 0) { - init.sc.mac = ''; - debug && debug('Handshake: S->C MAC: '); - } else { - if (self._server) { - serverList = localSCMAC; - clientList = remote.sc.mac; - } else { - serverList = remote.sc.mac; - clientList = localSCMAC; - } - // Check for agreeable server->client hmac algorithm - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching S->C MAC'); - return doFatalError( - self, - 'Handshake failed: no matching S->C MAC', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.sc.mac = clientList[i]; - debug && debug(`Handshake: S->C MAC: ${clientList[i]}`); - } - - - // Client->Server compression ================================================ - const localCSCompress = local.lists.cs.compress.array; - debug && debug(`Handshake: (local) C->S compression: ${localCSCompress}`); - debug && debug(`Handshake: (remote) C->S compression: ${remote.cs.compress}`); - if (self._server) { - serverList = localCSCompress; - clientList = remote.cs.compress; - } else { - serverList = remote.cs.compress; - clientList = localCSCompress; - } - // Check for agreeable client->server compression algorithm - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching C->S compression'); - return doFatalError( - self, - 'Handshake failed: no matching C->S compression', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.cs.compress = clientList[i]; - debug && debug(`Handshake: C->S compression: ${clientList[i]}`); - - - // Server->Client compression ================================================ - const localSCCompress = local.lists.sc.compress.array; - debug && debug(`Handshake: (local) S->C compression: ${localSCCompress}`); - debug && debug(`Handshake: (remote) S->C compression: ${remote.sc.compress}`); - if (self._server) { - serverList = localSCCompress; - clientList = remote.sc.compress; - } else { - serverList = remote.sc.compress; - clientList = localSCCompress; - } - // Check for agreeable server->client compression algorithm - for (i = 0; - i < clientList.length && serverList.indexOf(clientList[i]) === -1; - ++i); - if (i === clientList.length) { - // No suitable match found! - debug && debug('Handshake: No matching S->C compression'); - return doFatalError( - self, - 'Handshake failed: no matching S->C compression', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - init.sc.compress = clientList[i]; - debug && debug(`Handshake: S->C compression: ${clientList[i]}`); - - init.cs.lang = ''; - init.sc.lang = ''; - - // XXX: hack -- find a better way to do this - if (self._kex) { - if (!self._kexinit) { - // We received a rekey request, but we haven't sent a KEXINIT in response - // yet - kexinit(self); - } - self._decipher._onPayload = onKEXPayload.bind(self, { firstPacket: false }); - } - - self._kex = createKeyExchange(init, self, payload); - self._kex.start(); -} - -const createKeyExchange = (() => { - function convertToMpint(buf) { - let idx = 0; - let length = buf.length; - while (buf[idx] === 0x00) { - ++idx; - --length; - } - let newBuf; - if (buf[idx] & 0x80) { - newBuf = Buffer.allocUnsafe(1 + length); - newBuf[0] = 0; - buf.copy(newBuf, 1, idx); - buf = newBuf; - } else if (length !== buf.length) { - newBuf = Buffer.allocUnsafe(length); - buf.copy(newBuf, 0, idx); - buf = newBuf; - } - return buf; - } - - class KeyExchange { - constructor(negotiated, protocol, remoteKexinit) { - this._protocol = protocol; - - this.sessionID = (protocol._kex ? protocol._kex.sessionID : undefined); - this.negotiated = negotiated; - this._step = 1; - this._public = null; - this._dh = null; - this._sentNEWKEYS = false; - this._receivedNEWKEYS = false; - this._finished = false; - this._hostVerified = false; - - // Data needed for initializing cipher/decipher/etc. - this._kexinit = protocol._kexinit; - this._remoteKexinit = remoteKexinit; - this._identRaw = protocol._identRaw; - this._remoteIdentRaw = protocol._remoteIdentRaw; - this._hostKey = undefined; - this._dhData = undefined; - this._sig = undefined; - } - finish() { - if (this._finished) - return false; - this._finished = true; - - const isServer = this._protocol._server; - const negotiated = this.negotiated; - - const pubKey = this.convertPublicKey(this._dhData); - let secret = this.computeSecret(this._dhData); - if (secret instanceof Error) { - secret.message = - `Error while computing DH secret (${this.type}): ${secret.message}`; - secret.level = 'handshake'; - return doFatalError( - this._protocol, - secret, - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - const hash = createHash(this.hashName); - // V_C - hashString(hash, (isServer ? this._remoteIdentRaw : this._identRaw)); - // "V_S" - hashString(hash, (isServer ? this._identRaw : this._remoteIdentRaw)); - // "I_C" - hashString(hash, (isServer ? this._remoteKexinit : this._kexinit)); - // "I_S" - hashString(hash, (isServer ? this._kexinit : this._remoteKexinit)); - // "K_S" - const serverPublicHostKey = (isServer - ? this._hostKey.getPublicSSH() - : this._hostKey); - hashString(hash, serverPublicHostKey); - - if (this.type === 'groupex') { - // Group exchange-specific - const params = this.getDHParams(); - const num = Buffer.allocUnsafe(4); - // min (uint32) - writeUInt32BE(num, this._minBits, 0); - hash.update(num); - // preferred (uint32) - writeUInt32BE(num, this._prefBits, 0); - hash.update(num); - // max (uint32) - writeUInt32BE(num, this._maxBits, 0); - hash.update(num); - // prime - hashString(hash, params.prime); - // generator - hashString(hash, params.generator); - } - - // method-specific data sent by client - hashString(hash, (isServer ? pubKey : this.getPublicKey())); - // method-specific data sent by server - const serverPublicKey = (isServer ? this.getPublicKey() : pubKey); - hashString(hash, serverPublicKey); - // shared secret ("K") - hashString(hash, secret); - - // "H" - const exchangeHash = hash.digest(); - - if (!isServer) { - bufferParser.init(this._sig, 0); - const sigType = bufferParser.readString(true); - - if (!sigType) { - return doFatalError( - this._protocol, - 'Malformed packet while reading signature', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - if (sigType !== negotiated.serverHostKey) { - return doFatalError( - this._protocol, - `Wrong signature type: ${sigType}, ` - + `expected: ${negotiated.serverHostKey}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - // "s" - let sigValue = bufferParser.readString(); - - bufferParser.clear(); - - if (sigValue === undefined) { - return doFatalError( - this._protocol, - 'Malformed packet while reading signature', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - if (!(sigValue = sigSSHToASN1(sigValue, sigType))) { - return doFatalError( - this._protocol, - 'Malformed signature', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - let parsedHostKey; - { - bufferParser.init(this._hostKey, 0); - const name = bufferParser.readString(true); - const hostKey = this._hostKey.slice(bufferParser.pos()); - bufferParser.clear(); - parsedHostKey = parseDERKey(hostKey, name); - if (parsedHostKey instanceof Error) { - parsedHostKey.level = 'handshake'; - return doFatalError( - this._protocol, - parsedHostKey, - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - } - - let hashAlgo; - // Check if we need to override the default hash algorithm - switch (this.negotiated.serverHostKey) { - case 'rsa-sha2-256': hashAlgo = 'sha256'; break; - case 'rsa-sha2-512': hashAlgo = 'sha512'; break; - } - - this._protocol._debug - && this._protocol._debug('Verifying signature ...'); - - const verified = parsedHostKey.verify(exchangeHash, sigValue, hashAlgo); - if (verified !== true) { - if (verified instanceof Error) { - this._protocol._debug && this._protocol._debug( - `Signature verification failed: ${verified.stack}` - ); - } else { - this._protocol._debug && this._protocol._debug( - 'Signature verification failed' - ); - } - return doFatalError( - this._protocol, - 'Handshake failed: signature verification failed', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug('Verified signature'); - } else { - // Server - - let hashAlgo; - // Check if we need to override the default hash algorithm - switch (this.negotiated.serverHostKey) { - case 'rsa-sha2-256': hashAlgo = 'sha256'; break; - case 'rsa-sha2-512': hashAlgo = 'sha512'; break; - } - - this._protocol._debug && this._protocol._debug( - 'Generating signature ...' - ); - - let signature = this._hostKey.sign(exchangeHash, hashAlgo); - if (signature instanceof Error) { - return doFatalError( - this._protocol, - 'Handshake failed: signature generation failed for ' - + `${this._hostKey.type} host key: ${signature.message}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - signature = convertSignature(signature, this._hostKey.type); - if (signature === false) { - return doFatalError( - this._protocol, - 'Handshake failed: signature conversion failed for ' - + `${this._hostKey.type} host key`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - // Send KEX reply - /* - byte SSH_MSG_KEXDH_REPLY - / SSH_MSG_KEX_DH_GEX_REPLY - / SSH_MSG_KEX_ECDH_REPLY - string server public host key and certificates (K_S) - string - string signature of H - */ - const sigType = this.negotiated.serverHostKey; - const sigTypeLen = Buffer.byteLength(sigType); - const sigLen = 4 + sigTypeLen + 4 + signature.length; - let p = this._protocol._packetRW.write.allocStartKEX; - const packet = this._protocol._packetRW.write.alloc( - 1 - + 4 + serverPublicHostKey.length - + 4 + serverPublicKey.length - + 4 + sigLen, - true - ); - - packet[p] = MESSAGE.KEXDH_REPLY; - - writeUInt32BE(packet, serverPublicHostKey.length, ++p); - packet.set(serverPublicHostKey, p += 4); - - writeUInt32BE(packet, - serverPublicKey.length, - p += serverPublicHostKey.length); - packet.set(serverPublicKey, p += 4); - - writeUInt32BE(packet, sigLen, p += serverPublicKey.length); - - writeUInt32BE(packet, sigTypeLen, p += 4); - packet.utf8Write(sigType, p += 4, sigTypeLen); - - writeUInt32BE(packet, signature.length, p += sigTypeLen); - packet.set(signature, p += 4); - - if (this._protocol._debug) { - let type; - switch (this.type) { - case 'group': - type = 'KEXDH_REPLY'; - break; - case 'groupex': - type = 'KEXDH_GEX_REPLY'; - break; - default: - type = 'KEXECDH_REPLY'; - } - this._protocol._debug(`Outbound: Sending ${type}`); - } - this._protocol._cipher.encrypt( - this._protocol._packetRW.write.finalize(packet, true) - ); - } - trySendNEWKEYS(this); - - const completeHandshake = () => { - if (!this.sessionID) - this.sessionID = exchangeHash; - - { - const newSecret = Buffer.allocUnsafe(4 + secret.length); - writeUInt32BE(newSecret, secret.length, 0); - newSecret.set(secret, 4); - secret = newSecret; - } - - // Initialize new ciphers, deciphers, etc. - - const csCipherInfo = CIPHER_INFO[negotiated.cs.cipher]; - const scCipherInfo = CIPHER_INFO[negotiated.sc.cipher]; - - const csIV = generateKEXVal(csCipherInfo.ivLen, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'A'); - const scIV = generateKEXVal(scCipherInfo.ivLen, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'B'); - const csKey = generateKEXVal(csCipherInfo.keyLen, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'C'); - const scKey = generateKEXVal(scCipherInfo.keyLen, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'D'); - let csMacInfo; - let csMacKey; - if (!csCipherInfo.authLen) { - csMacInfo = MAC_INFO[negotiated.cs.mac]; - csMacKey = generateKEXVal(csMacInfo.len, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'E'); - } - let scMacInfo; - let scMacKey; - if (!scCipherInfo.authLen) { - scMacInfo = MAC_INFO[negotiated.sc.mac]; - scMacKey = generateKEXVal(scMacInfo.len, - this.hashName, - secret, - exchangeHash, - this.sessionID, - 'F'); - } - - const config = { - inbound: { - onPayload: this._protocol._onPayload, - seqno: this._protocol._decipher.inSeqno, - decipherInfo: (!isServer ? scCipherInfo : csCipherInfo), - decipherIV: (!isServer ? scIV : csIV), - decipherKey: (!isServer ? scKey : csKey), - macInfo: (!isServer ? scMacInfo : csMacInfo), - macKey: (!isServer ? scMacKey : csMacKey), - }, - outbound: { - onWrite: this._protocol._onWrite, - seqno: this._protocol._cipher.outSeqno, - cipherInfo: (isServer ? scCipherInfo : csCipherInfo), - cipherIV: (isServer ? scIV : csIV), - cipherKey: (isServer ? scKey : csKey), - macInfo: (isServer ? scMacInfo : csMacInfo), - macKey: (isServer ? scMacKey : csMacKey), - }, - }; - this._protocol._cipher && this._protocol._cipher.free(); - this._protocol._decipher && this._protocol._decipher.free(); - this._protocol._cipher = createCipher(config); - this._protocol._decipher = createDecipher(config); - - const rw = { - read: undefined, - write: undefined, - }; - switch (negotiated.cs.compress) { - case 'zlib': // starts immediately - if (isServer) - rw.read = new ZlibPacketReader(); - else - rw.write = new ZlibPacketWriter(this._protocol); - break; - case 'zlib@openssh.com': - // Starts after successful user authentication - - if (this._protocol._authenticated) { - // If a rekey happens and this compression method is selected and - // we already authenticated successfully, we need to start - // immediately instead - if (isServer) - rw.read = new ZlibPacketReader(); - else - rw.write = new ZlibPacketWriter(this._protocol); - break; - } - // FALLTHROUGH - default: - // none -- never any compression/decompression - - if (isServer) - rw.read = new PacketReader(); - else - rw.write = new PacketWriter(this._protocol); - } - switch (negotiated.sc.compress) { - case 'zlib': // starts immediately - if (isServer) - rw.write = new ZlibPacketWriter(this._protocol); - else - rw.read = new ZlibPacketReader(); - break; - case 'zlib@openssh.com': - // Starts after successful user authentication - - if (this._protocol._authenticated) { - // If a rekey happens and this compression method is selected and - // we already authenticated successfully, we need to start - // immediately instead - if (isServer) - rw.write = new ZlibPacketWriter(this._protocol); - else - rw.read = new ZlibPacketReader(); - break; - } - // FALLTHROUGH - default: - // none -- never any compression/decompression - - if (isServer) - rw.write = new PacketWriter(this._protocol); - else - rw.read = new PacketReader(); - } - this._protocol._packetRW.read.cleanup(); - this._protocol._packetRW.write.cleanup(); - this._protocol._packetRW = rw; - - // Cleanup/reset various state - this._public = null; - this._dh = null; - this._kexinit = this._protocol._kexinit = undefined; - this._remoteKexinit = undefined; - this._identRaw = undefined; - this._remoteIdentRaw = undefined; - this._hostKey = undefined; - this._dhData = undefined; - this._sig = undefined; - - this._protocol._onHandshakeComplete(negotiated); - - return false; - }; - if (!isServer) - return completeHandshake(); - this.finish = completeHandshake; - } - - start() { - if (!this._protocol._server) { - if (this._protocol._debug) { - let type; - switch (this.type) { - case 'group': - type = 'KEXDH_INIT'; - break; - default: - type = 'KEXECDH_INIT'; - } - this._protocol._debug(`Outbound: Sending ${type}`); - } - - const pubKey = this.getPublicKey(); - - let p = this._protocol._packetRW.write.allocStartKEX; - const packet = this._protocol._packetRW.write.alloc( - 1 + 4 + pubKey.length, - true - ); - packet[p] = MESSAGE.KEXDH_INIT; - writeUInt32BE(packet, pubKey.length, ++p); - packet.set(pubKey, p += 4); - this._protocol._cipher.encrypt( - this._protocol._packetRW.write.finalize(packet, true) - ); - } - } - getPublicKey() { - this.generateKeys(); - - const key = this._public; - - if (key) - return this.convertPublicKey(key); - } - convertPublicKey(key) { - let newKey; - let idx = 0; - let len = key.length; - while (key[idx] === 0x00) { - ++idx; - --len; - } - - if (key[idx] & 0x80) { - newKey = Buffer.allocUnsafe(1 + len); - newKey[0] = 0; - key.copy(newKey, 1, idx); - return newKey; - } - - if (len !== key.length) { - newKey = Buffer.allocUnsafe(len); - key.copy(newKey, 0, idx); - key = newKey; - } - return key; - } - computeSecret(otherPublicKey) { - this.generateKeys(); - - try { - return convertToMpint(this._dh.computeSecret(otherPublicKey)); - } catch (ex) { - return ex; - } - } - parse(payload) { - const type = payload[0]; - switch (this._step) { - case 1: - if (this._protocol._server) { - // Server - if (type !== MESSAGE.KEXDH_INIT) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.KEXDH_INIT}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Received DH Init' - ); - /* - byte SSH_MSG_KEXDH_INIT - / SSH_MSG_KEX_ECDH_INIT - string - */ - bufferParser.init(payload, 1); - const dhData = bufferParser.readString(); - bufferParser.clear(); - if (dhData === undefined) { - return doFatalError( - this._protocol, - 'Received malformed KEX*_INIT', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - // Client public key - this._dhData = dhData; - - let hostKey = - this._protocol._hostKeys[this.negotiated.serverHostKey]; - if (Array.isArray(hostKey)) - hostKey = hostKey[0]; - this._hostKey = hostKey; - - this.finish(); - } else { - // Client - if (type !== MESSAGE.KEXDH_REPLY) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.KEXDH_REPLY}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Received DH Reply' - ); - /* - byte SSH_MSG_KEXDH_REPLY - / SSH_MSG_KEX_DH_GEX_REPLY - / SSH_MSG_KEX_ECDH_REPLY - string server public host key and certificates (K_S) - string - string signature of H - */ - bufferParser.init(payload, 1); - let hostPubKey; - let dhData; - let sig; - if ((hostPubKey = bufferParser.readString()) === undefined - || (dhData = bufferParser.readString()) === undefined - || (sig = bufferParser.readString()) === undefined) { - bufferParser.clear(); - return doFatalError( - this._protocol, - 'Received malformed KEX*_REPLY', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - bufferParser.clear(); - - // Check that the host public key type matches what was negotiated - // during KEXINIT swap - bufferParser.init(hostPubKey, 0); - const hostPubKeyType = bufferParser.readString(true); - bufferParser.clear(); - if (hostPubKeyType === undefined) { - return doFatalError( - this._protocol, - 'Received malformed host public key', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - if (hostPubKeyType !== this.negotiated.serverHostKey) { - // Check if we need to make an exception - switch (this.negotiated.serverHostKey) { - case 'rsa-sha2-256': - case 'rsa-sha2-512': - if (hostPubKeyType === 'ssh-rsa') - break; - // FALLTHROUGH - default: - return doFatalError( - this._protocol, - 'Host key does not match negotiated type', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - } - - this._hostKey = hostPubKey; - this._dhData = dhData; - this._sig = sig; - - let checked = false; - let ret; - if (this._protocol._hostVerifier === undefined) { - ret = true; - this._protocol._debug && this._protocol._debug( - 'Host accepted by default (no verification)' - ); - } else { - ret = this._protocol._hostVerifier(hostPubKey, (permitted) => { - if (checked) - return; - checked = true; - if (permitted === false) { - this._protocol._debug && this._protocol._debug( - 'Host denied (verification failed)' - ); - return doFatalError( - this._protocol, - 'Host denied (verification failed)', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Host accepted (verified)' - ); - this._hostVerified = true; - if (this._receivedNEWKEYS) - this.finish(); - else - trySendNEWKEYS(this); - }); - } - if (ret === undefined) { - // Async host verification - ++this._step; - return; - } - checked = true; - if (ret === false) { - this._protocol._debug && this._protocol._debug( - 'Host denied (verification failed)' - ); - return doFatalError( - this._protocol, - 'Host denied (verification failed)', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Host accepted (verified)' - ); - this._hostVerified = true; - trySendNEWKEYS(this); - } - ++this._step; - break; - case 2: - if (type !== MESSAGE.NEWKEYS) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.NEWKEYS}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Inbound: NEWKEYS' - ); - this._receivedNEWKEYS = true; - ++this._step; - if (this._protocol._server || this._hostVerified) - return this.finish(); - - // Signal to current decipher that we need to change to a new decipher - // for the next packet - return false; - default: - return doFatalError( - this._protocol, - `Received unexpected packet ${type} after NEWKEYS`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - } - } - - class Curve25519Exchange extends KeyExchange { - constructor(hashName, ...args) { - super(...args); - - this.type = '25519'; - this.hashName = hashName; - this._keys = null; - } - generateKeys() { - if (!this._keys) - this._keys = generateKeyPairSync('x25519'); - } - getPublicKey() { - this.generateKeys(); - - const key = this._keys.publicKey.export({ type: 'spki', format: 'der' }); - return key.slice(-32); // HACK: avoids parsing DER/BER header - } - convertPublicKey(key) { - let newKey; - let idx = 0; - let len = key.length; - while (key[idx] === 0x00) { - ++idx; - --len; - } - - if (key.length === 32) - return key; - - if (len !== key.length) { - newKey = Buffer.allocUnsafe(len); - key.copy(newKey, 0, idx); - key = newKey; - } - return key; - } - computeSecret(otherPublicKey) { - this.generateKeys(); - - try { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.3.101.110'); // id-X25519 - asnWriter.endSequence(); - - // PublicKey - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - // XXX: hack to write a raw buffer without a tag -- yuck - asnWriter._ensure(otherPublicKey.length); - otherPublicKey.copy(asnWriter._buf, - asnWriter._offset, - 0, - otherPublicKey.length); - asnWriter._offset += otherPublicKey.length; - asnWriter.endSequence(); - asnWriter.endSequence(); - - return convertToMpint(diffieHellman({ - privateKey: this._keys.privateKey, - publicKey: createPublicKey({ - key: asnWriter.buffer, - type: 'spki', - format: 'der', - }), - })); - } catch (ex) { - return ex; - } - } - } - - class ECDHExchange extends KeyExchange { - constructor(curveName, hashName, ...args) { - super(...args); - - this.type = 'ecdh'; - this.curveName = curveName; - this.hashName = hashName; - } - generateKeys() { - if (!this._dh) { - this._dh = createECDH(this.curveName); - this._public = this._dh.generateKeys(); - } - } - } - - class DHGroupExchange extends KeyExchange { - constructor(hashName, ...args) { - super(...args); - - this.type = 'groupex'; - this.hashName = hashName; - this._prime = null; - this._generator = null; - this._minBits = GEX_MIN_BITS; - this._prefBits = dhEstimate(this.negotiated); - if (this._protocol._compatFlags & COMPAT.BUG_DHGEX_LARGE) - this._prefBits = Math.min(this._prefBits, 4096); - this._maxBits = GEX_MAX_BITS; - } - start() { - if (this._protocol._server) - return; - this._protocol._debug && this._protocol._debug( - 'Outbound: Sending KEXDH_GEX_REQUEST' - ); - let p = this._protocol._packetRW.write.allocStartKEX; - const packet = this._protocol._packetRW.write.alloc( - 1 + 4 + 4 + 4, - true - ); - packet[p] = MESSAGE.KEXDH_GEX_REQUEST; - writeUInt32BE(packet, this._minBits, ++p); - writeUInt32BE(packet, this._prefBits, p += 4); - writeUInt32BE(packet, this._maxBits, p += 4); - this._protocol._cipher.encrypt( - this._protocol._packetRW.write.finalize(packet, true) - ); - } - generateKeys() { - if (!this._dh && this._prime && this._generator) { - this._dh = createDiffieHellman(this._prime, this._generator); - this._public = this._dh.generateKeys(); - } - } - setDHParams(prime, generator) { - if (!Buffer.isBuffer(prime)) - throw new Error('Invalid prime value'); - if (!Buffer.isBuffer(generator)) - throw new Error('Invalid generator value'); - this._prime = prime; - this._generator = generator; - } - getDHParams() { - if (this._dh) { - return { - prime: convertToMpint(this._dh.getPrime()), - generator: convertToMpint(this._dh.getGenerator()), - }; - } - } - parse(payload) { - const type = payload[0]; - switch (this._step) { - case 1: - if (this._protocol._server) { - if (type !== MESSAGE.KEXDH_GEX_REQUEST) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ` - + MESSAGE.KEXDH_GEX_REQUEST, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - // TODO: allow user implementation to provide safe prime and - // generator on demand to support group exchange on server side - return doFatalError( - this._protocol, - 'Group exchange not implemented for server', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - if (type !== MESSAGE.KEXDH_GEX_GROUP) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_GROUP}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - - this._protocol._debug && this._protocol._debug( - 'Received DH GEX Group' - ); - - /* - byte SSH_MSG_KEX_DH_GEX_GROUP - mpint p, safe prime - mpint g, generator for subgroup in GF(p) - */ - bufferParser.init(payload, 1); - let prime; - let gen; - if ((prime = bufferParser.readString()) === undefined - || (gen = bufferParser.readString()) === undefined) { - bufferParser.clear(); - return doFatalError( - this._protocol, - 'Received malformed KEXDH_GEX_GROUP', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - bufferParser.clear(); - - // TODO: validate prime - this.setDHParams(prime, gen); - this.generateKeys(); - const pubkey = this.getPublicKey(); - - this._protocol._debug && this._protocol._debug( - 'Outbound: Sending KEXDH_GEX_INIT' - ); - - let p = this._protocol._packetRW.write.allocStartKEX; - const packet = - this._protocol._packetRW.write.alloc(1 + 4 + pubkey.length, true); - packet[p] = MESSAGE.KEXDH_GEX_INIT; - writeUInt32BE(packet, pubkey.length, ++p); - packet.set(pubkey, p += 4); - this._protocol._cipher.encrypt( - this._protocol._packetRW.write.finalize(packet, true) - ); - - ++this._step; - break; - case 2: - if (this._protocol._server) { - if (type !== MESSAGE.KEXDH_GEX_INIT) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_INIT}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Received DH GEX Init' - ); - return doFatalError( - this._protocol, - 'Group exchange not implemented for server', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } else if (type !== MESSAGE.KEXDH_GEX_REPLY) { - return doFatalError( - this._protocol, - `Received packet ${type} instead of ${MESSAGE.KEXDH_GEX_REPLY}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - this._protocol._debug && this._protocol._debug( - 'Received DH GEX Reply' - ); - this._step = 1; - payload[0] = MESSAGE.KEXDH_REPLY; - this.parse = KeyExchange.prototype.parse; - this.parse(payload); - } - } - } - - class DHExchange extends KeyExchange { - constructor(groupName, hashName, ...args) { - super(...args); - - this.type = 'group'; - this.groupName = groupName; - this.hashName = hashName; - } - start() { - if (!this._protocol._server) { - this._protocol._debug && this._protocol._debug( - 'Outbound: Sending KEXDH_INIT' - ); - const pubKey = this.getPublicKey(); - let p = this._protocol._packetRW.write.allocStartKEX; - const packet = - this._protocol._packetRW.write.alloc(1 + 4 + pubKey.length, true); - packet[p] = MESSAGE.KEXDH_INIT; - writeUInt32BE(packet, pubKey.length, ++p); - packet.set(pubKey, p += 4); - this._protocol._cipher.encrypt( - this._protocol._packetRW.write.finalize(packet, true) - ); - } - } - generateKeys() { - if (!this._dh) { - this._dh = createDiffieHellmanGroup(this.groupName); - this._public = this._dh.generateKeys(); - } - } - getDHParams() { - if (this._dh) { - return { - prime: convertToMpint(this._dh.getPrime()), - generator: convertToMpint(this._dh.getGenerator()), - }; - } - } - } - - return (negotiated, ...args) => { - if (typeof negotiated !== 'object' || negotiated === null) - throw new Error('Invalid negotiated argument'); - const kexType = negotiated.kex; - if (typeof kexType === 'string') { - args = [negotiated, ...args]; - switch (kexType) { - case 'curve25519-sha256': - case 'curve25519-sha256@libssh.org': - if (!curve25519Supported) - break; - return new Curve25519Exchange('sha256', ...args); - - case 'ecdh-sha2-nistp256': - return new ECDHExchange('prime256v1', 'sha256', ...args); - case 'ecdh-sha2-nistp384': - return new ECDHExchange('secp384r1', 'sha384', ...args); - case 'ecdh-sha2-nistp521': - return new ECDHExchange('secp521r1', 'sha512', ...args); - - case 'diffie-hellman-group1-sha1': - return new DHExchange('modp2', 'sha1', ...args); - case 'diffie-hellman-group14-sha1': - return new DHExchange('modp14', 'sha1', ...args); - case 'diffie-hellman-group14-sha256': - return new DHExchange('modp14', 'sha256', ...args); - case 'diffie-hellman-group15-sha512': - return new DHExchange('modp15', 'sha512', ...args); - case 'diffie-hellman-group16-sha512': - return new DHExchange('modp16', 'sha512', ...args); - case 'diffie-hellman-group17-sha512': - return new DHExchange('modp17', 'sha512', ...args); - case 'diffie-hellman-group18-sha512': - return new DHExchange('modp18', 'sha512', ...args); - - case 'diffie-hellman-group-exchange-sha1': - return new DHGroupExchange('sha1', ...args); - case 'diffie-hellman-group-exchange-sha256': - return new DHGroupExchange('sha256', ...args); - } - throw new Error(`Unsupported key exchange algorithm: ${kexType}`); - } - throw new Error(`Invalid key exchange type: ${kexType}`); - }; -})(); - -const KexInit = (() => { - const KEX_PROPERTY_NAMES = [ - 'kex', - 'serverHostKey', - ['cs', 'cipher' ], - ['sc', 'cipher' ], - ['cs', 'mac' ], - ['sc', 'mac' ], - ['cs', 'compress' ], - ['sc', 'compress' ], - ['cs', 'lang' ], - ['sc', 'lang' ], - ]; - return class KexInit { - constructor(obj) { - if (typeof obj !== 'object' || obj === null) - throw new TypeError('Argument must be an object'); - - const lists = { - kex: undefined, - serverHostKey: undefined, - cs: { - cipher: undefined, - mac: undefined, - compress: undefined, - lang: undefined, - }, - sc: { - cipher: undefined, - mac: undefined, - compress: undefined, - lang: undefined, - }, - - all: undefined, - }; - let totalSize = 0; - for (const prop of KEX_PROPERTY_NAMES) { - let base; - let val; - let desc; - let key; - if (typeof prop === 'string') { - base = lists; - val = obj[prop]; - desc = key = prop; - } else { - const parent = prop[0]; - base = lists[parent]; - key = prop[1]; - val = obj[parent][key]; - desc = `${parent}.${key}`; - } - const entry = { array: undefined, buffer: undefined }; - if (Buffer.isBuffer(val)) { - entry.array = ('' + val).split(','); - entry.buffer = val; - totalSize += 4 + val.length; - } else { - if (typeof val === 'string') - val = val.split(','); - if (Array.isArray(val)) { - entry.array = val; - entry.buffer = Buffer.from(val.join(',')); - } else { - throw new TypeError(`Invalid \`${desc}\` type: ${typeof val}`); - } - totalSize += 4 + entry.buffer.length; - } - base[key] = entry; - } - - const all = Buffer.allocUnsafe(totalSize); - lists.all = all; - - let allPos = 0; - for (const prop of KEX_PROPERTY_NAMES) { - let data; - if (typeof prop === 'string') - data = lists[prop].buffer; - else - data = lists[prop[0]][prop[1]].buffer; - allPos = writeUInt32BE(all, data.length, allPos); - all.set(data, allPos); - allPos += data.length; - } - - this.totalSize = totalSize; - this.lists = lists; - } - copyAllTo(buf, offset) { - const src = this.lists.all; - if (typeof offset !== 'number') - throw new TypeError(`Invalid offset value: ${typeof offset}`); - if (buf.length - offset < src.length) - throw new Error('Insufficient space to copy list'); - buf.set(src, offset); - return src.length; - } - }; -})(); - -const hashString = (() => { - const LEN = Buffer.allocUnsafe(4); - return (hash, buf) => { - writeUInt32BE(LEN, buf.length, 0); - hash.update(LEN); - hash.update(buf); - }; -})(); - -function generateKEXVal(len, hashName, secret, exchangeHash, sessionID, char) { - let ret; - if (len) { - let digest = createHash(hashName) - .update(secret) - .update(exchangeHash) - .update(char) - .update(sessionID) - .digest(); - while (digest.length < len) { - const chunk = createHash(hashName) - .update(secret) - .update(exchangeHash) - .update(digest) - .digest(); - const extended = Buffer.allocUnsafe(digest.length + chunk.length); - extended.set(digest, 0); - extended.set(chunk, digest.length); - digest = extended; - } - if (digest.length === len) - ret = digest; - else - ret = new FastBuffer(digest.buffer, digest.byteOffset, len); - } else { - ret = EMPTY_BUFFER; - } - return ret; -} - -function onKEXPayload(state, payload) { - // XXX: move this to the Decipher implementations? - if (payload.length === 0) { - this._debug && this._debug('Inbound: Skipping empty packet payload'); - return; - } - - if (this._skipNextInboundPacket) { - this._skipNextInboundPacket = false; - return; - } - - payload = this._packetRW.read.read(payload); - - const type = payload[0]; - switch (type) { - case MESSAGE.DISCONNECT: - case MESSAGE.IGNORE: - case MESSAGE.UNIMPLEMENTED: - case MESSAGE.DEBUG: - if (!MESSAGE_HANDLERS) - MESSAGE_HANDLERS = require('./handlers.js'); - return MESSAGE_HANDLERS[type](this, payload); - case MESSAGE.KEXINIT: - if (!state.firstPacket) { - return doFatalError( - this, - 'Received extra KEXINIT during handshake', - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - state.firstPacket = false; - return handleKexInit(this, payload); - default: - if (type < 20 || type > 49) { - return doFatalError( - this, - `Received unexpected packet type ${type}`, - 'handshake', - DISCONNECT_REASON.KEY_EXCHANGE_FAILED - ); - } - } - - return this._kex.parse(payload); -} - -function dhEstimate(neg) { - const csCipher = CIPHER_INFO[neg.cs.cipher]; - const scCipher = CIPHER_INFO[neg.sc.cipher]; - // XXX: if OpenSSH's `umac-*` MACs are ever supported, their key lengths will - // also need to be considered when calculating `bits` - const bits = Math.max( - 0, - (csCipher.sslName === 'des-ede3-cbc' ? 14 : csCipher.keyLen), - csCipher.blockLen, - csCipher.ivLen, - (scCipher.sslName === 'des-ede3-cbc' ? 14 : scCipher.keyLen), - scCipher.blockLen, - scCipher.ivLen - ) * 8; - if (bits <= 112) - return 2048; - if (bits <= 128) - return 3072; - if (bits <= 192) - return 7680; - return 8192; -} - -function trySendNEWKEYS(kex) { - if (!kex._sentNEWKEYS) { - kex._protocol._debug && kex._protocol._debug( - 'Outbound: Sending NEWKEYS' - ); - const p = kex._protocol._packetRW.write.allocStartKEX; - const packet = kex._protocol._packetRW.write.alloc(1, true); - packet[p] = MESSAGE.NEWKEYS; - kex._protocol._cipher.encrypt( - kex._protocol._packetRW.write.finalize(packet, true) - ); - kex._sentNEWKEYS = true; - } -} - -module.exports = { - KexInit, - kexinit, - onKEXPayload, - DEFAULT_KEXINIT: new KexInit({ - kex: DEFAULT_KEX, - serverHostKey: DEFAULT_SERVER_HOST_KEY, - cs: { - cipher: DEFAULT_CIPHER, - mac: DEFAULT_MAC, - compress: DEFAULT_COMPRESSION, - lang: [], - }, - sc: { - cipher: DEFAULT_CIPHER, - mac: DEFAULT_MAC, - compress: DEFAULT_COMPRESSION, - lang: [], - }, - }), - HANDLERS: { - [MESSAGE.KEXINIT]: handleKexInit, - }, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/keyParser.js b/reverse_engineering/node_modules/ssh2/lib/protocol/keyParser.js deleted file mode 100644 index 9860e3f0..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/keyParser.js +++ /dev/null @@ -1,1481 +0,0 @@ -// TODO: -// * utilize `crypto.create(Private|Public)Key()` and `keyObject.export()` -// * handle multi-line header values (OpenSSH)? -// * more thorough validation? -'use strict'; - -const { - createDecipheriv, - createECDH, - createHash, - createHmac, - createSign, - createVerify, - getCiphers, - sign: sign_, - verify: verify_, -} = require('crypto'); -const supportedOpenSSLCiphers = getCiphers(); - -const { Ber } = require('asn1'); -const bcrypt_pbkdf = require('bcrypt-pbkdf').pbkdf; - -const { CIPHER_INFO } = require('./crypto.js'); -const { eddsaSupported, SUPPORTED_CIPHER } = require('./constants.js'); -const { - bufferSlice, - makeBufferParser, - readString, - readUInt32BE, - writeUInt32BE, -} = require('./utils.js'); - -const SYM_HASH_ALGO = Symbol('Hash Algorithm'); -const SYM_PRIV_PEM = Symbol('Private key PEM'); -const SYM_PUB_PEM = Symbol('Public key PEM'); -const SYM_PUB_SSH = Symbol('Public key SSH'); -const SYM_DECRYPTED = Symbol('Decrypted Key'); - -// Create OpenSSL cipher name -> SSH cipher name conversion table -const CIPHER_INFO_OPENSSL = Object.create(null); -{ - const keys = Object.keys(CIPHER_INFO); - for (let i = 0; i < keys.length; ++i) { - const cipherName = CIPHER_INFO[keys[i]].sslName; - if (!cipherName || CIPHER_INFO_OPENSSL[cipherName]) - continue; - CIPHER_INFO_OPENSSL[cipherName] = CIPHER_INFO[keys[i]]; - } -} - -const binaryKeyParser = makeBufferParser(); - -function makePEM(type, data) { - data = data.base64Slice(0, data.length); - let formatted = data.replace(/.{64}/g, '$&\n'); - if (data.length & 63) - formatted += '\n'; - return `-----BEGIN ${type} KEY-----\n${formatted}-----END ${type} KEY-----`; -} - -function combineBuffers(buf1, buf2) { - const result = Buffer.allocUnsafe(buf1.length + buf2.length); - result.set(buf1, 0); - result.set(buf2, buf1.length); - return result; -} - -function skipFields(buf, nfields) { - const bufLen = buf.length; - let pos = (buf._pos || 0); - for (let i = 0; i < nfields; ++i) { - const left = (bufLen - pos); - if (pos >= bufLen || left < 4) - return false; - const len = readUInt32BE(buf, pos); - if (left < 4 + len) - return false; - pos += 4 + len; - } - buf._pos = pos; - return true; -} - -function genOpenSSLRSAPub(n, e) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.2.840.113549.1.1.1'); // rsaEncryption - // algorithm parameters (RSA has none) - asnWriter.writeNull(); - asnWriter.endSequence(); - - // subjectPublicKey - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - asnWriter.startSequence(); - asnWriter.writeBuffer(n, Ber.Integer); - asnWriter.writeBuffer(e, Ber.Integer); - asnWriter.endSequence(); - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('PUBLIC', asnWriter.buffer); -} - -function genOpenSSHRSAPub(n, e) { - const publicKey = Buffer.allocUnsafe(4 + 7 + 4 + e.length + 4 + n.length); - - writeUInt32BE(publicKey, 7, 0); - publicKey.utf8Write('ssh-rsa', 4, 7); - - let i = 4 + 7; - writeUInt32BE(publicKey, e.length, i); - publicKey.set(e, i += 4); - - writeUInt32BE(publicKey, n.length, i += e.length); - publicKey.set(n, i + 4); - - return publicKey; -} - -const genOpenSSLRSAPriv = (() => { - function genRSAASN1Buf(n, e, d, p, q, dmp1, dmq1, iqmp) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - asnWriter.writeInt(0x00, Ber.Integer); - asnWriter.writeBuffer(n, Ber.Integer); - asnWriter.writeBuffer(e, Ber.Integer); - asnWriter.writeBuffer(d, Ber.Integer); - asnWriter.writeBuffer(p, Ber.Integer); - asnWriter.writeBuffer(q, Ber.Integer); - asnWriter.writeBuffer(dmp1, Ber.Integer); - asnWriter.writeBuffer(dmq1, Ber.Integer); - asnWriter.writeBuffer(iqmp, Ber.Integer); - asnWriter.endSequence(); - return asnWriter.buffer; - } - - function bigIntFromBuffer(buf) { - return BigInt(`0x${buf.hexSlice(0, buf.length)}`); - } - - function bigIntToBuffer(bn) { - let hex = bn.toString(16); - if ((hex.length & 1) !== 0) { - hex = `0${hex}`; - } else { - const sigbit = hex.charCodeAt(0); - // BER/DER integers require leading zero byte to denote a positive value - // when first byte >= 0x80 - if (sigbit === 56/* '8' */ - || sigbit === 57/* '9' */ - || (sigbit >= 97/* 'a' */ && sigbit <= 102/* 'f' */)) { - hex = `00${hex}`; - } - } - return Buffer.from(hex, 'hex'); - } - - return function genOpenSSLRSAPriv(n, e, d, iqmp, p, q) { - const bn_d = bigIntFromBuffer(d); - const dmp1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(p) - 1n)); - const dmq1 = bigIntToBuffer(bn_d % (bigIntFromBuffer(q) - 1n)); - return makePEM('RSA PRIVATE', - genRSAASN1Buf(n, e, d, p, q, dmp1, dmq1, iqmp)); - }; -})(); - -function genOpenSSLDSAPub(p, q, g, y) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.2.840.10040.4.1'); // id-dsa - // algorithm parameters - asnWriter.startSequence(); - asnWriter.writeBuffer(p, Ber.Integer); - asnWriter.writeBuffer(q, Ber.Integer); - asnWriter.writeBuffer(g, Ber.Integer); - asnWriter.endSequence(); - asnWriter.endSequence(); - - // subjectPublicKey - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - asnWriter.writeBuffer(y, Ber.Integer); - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('PUBLIC', asnWriter.buffer); -} - -function genOpenSSHDSAPub(p, q, g, y) { - const publicKey = Buffer.allocUnsafe( - 4 + 7 + 4 + p.length + 4 + q.length + 4 + g.length + 4 + y.length - ); - - writeUInt32BE(publicKey, 7, 0); - publicKey.utf8Write('ssh-dss', 4, 7); - - let i = 4 + 7; - writeUInt32BE(publicKey, p.length, i); - publicKey.set(p, i += 4); - - writeUInt32BE(publicKey, q.length, i += p.length); - publicKey.set(q, i += 4); - - writeUInt32BE(publicKey, g.length, i += q.length); - publicKey.set(g, i += 4); - - writeUInt32BE(publicKey, y.length, i += g.length); - publicKey.set(y, i + 4); - - return publicKey; -} - -function genOpenSSLDSAPriv(p, q, g, y, x) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - asnWriter.writeInt(0x00, Ber.Integer); - asnWriter.writeBuffer(p, Ber.Integer); - asnWriter.writeBuffer(q, Ber.Integer); - asnWriter.writeBuffer(g, Ber.Integer); - asnWriter.writeBuffer(y, Ber.Integer); - asnWriter.writeBuffer(x, Ber.Integer); - asnWriter.endSequence(); - return makePEM('DSA PRIVATE', asnWriter.buffer); -} - -function genOpenSSLEdPub(pub) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.3.101.112'); // id-Ed25519 - asnWriter.endSequence(); - - // PublicKey - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - // XXX: hack to write a raw buffer without a tag -- yuck - asnWriter._ensure(pub.length); - asnWriter._buf.set(pub, asnWriter._offset); - asnWriter._offset += pub.length; - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('PUBLIC', asnWriter.buffer); -} - -function genOpenSSHEdPub(pub) { - const publicKey = Buffer.allocUnsafe(4 + 11 + 4 + pub.length); - - writeUInt32BE(publicKey, 11, 0); - publicKey.utf8Write('ssh-ed25519', 4, 11); - - writeUInt32BE(publicKey, pub.length, 15); - publicKey.set(pub, 19); - - return publicKey; -} - -function genOpenSSLEdPriv(priv) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // version - asnWriter.writeInt(0x00, Ber.Integer); - - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.3.101.112'); // id-Ed25519 - asnWriter.endSequence(); - - // PrivateKey - asnWriter.startSequence(Ber.OctetString); - asnWriter.writeBuffer(priv, Ber.OctetString); - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('PRIVATE', asnWriter.buffer); -} - -function genOpenSSLECDSAPub(oid, Q) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // algorithm - asnWriter.startSequence(); - asnWriter.writeOID('1.2.840.10045.2.1'); // id-ecPublicKey - // algorithm parameters (namedCurve) - asnWriter.writeOID(oid); - asnWriter.endSequence(); - - // subjectPublicKey - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - // XXX: hack to write a raw buffer without a tag -- yuck - asnWriter._ensure(Q.length); - asnWriter._buf.set(Q, asnWriter._offset); - asnWriter._offset += Q.length; - // end hack - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('PUBLIC', asnWriter.buffer); -} - -function genOpenSSHECDSAPub(oid, Q) { - let curveName; - switch (oid) { - case '1.2.840.10045.3.1.7': - // prime256v1/secp256r1 - curveName = 'nistp256'; - break; - case '1.3.132.0.34': - // secp384r1 - curveName = 'nistp384'; - break; - case '1.3.132.0.35': - // secp521r1 - curveName = 'nistp521'; - break; - default: - return; - } - - const publicKey = Buffer.allocUnsafe(4 + 19 + 4 + 8 + 4 + Q.length); - - writeUInt32BE(publicKey, 19, 0); - publicKey.utf8Write(`ecdsa-sha2-${curveName}`, 4, 19); - - writeUInt32BE(publicKey, 8, 23); - publicKey.utf8Write(curveName, 27, 8); - - writeUInt32BE(publicKey, Q.length, 35); - publicKey.set(Q, 39); - - return publicKey; -} - -function genOpenSSLECDSAPriv(oid, pub, priv) { - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - // version - asnWriter.writeInt(0x01, Ber.Integer); - // privateKey - asnWriter.writeBuffer(priv, Ber.OctetString); - // parameters (optional) - asnWriter.startSequence(0xA0); - asnWriter.writeOID(oid); - asnWriter.endSequence(); - // publicKey (optional) - asnWriter.startSequence(0xA1); - asnWriter.startSequence(Ber.BitString); - asnWriter.writeByte(0x00); - // XXX: hack to write a raw buffer without a tag -- yuck - asnWriter._ensure(pub.length); - asnWriter._buf.set(pub, asnWriter._offset); - asnWriter._offset += pub.length; - // end hack - asnWriter.endSequence(); - asnWriter.endSequence(); - asnWriter.endSequence(); - return makePEM('EC PRIVATE', asnWriter.buffer); -} - -function genOpenSSLECDSAPubFromPriv(curveName, priv) { - const tempECDH = createECDH(curveName); - tempECDH.setPrivateKey(priv); - return tempECDH.getPublicKey(); -} - -const BaseKey = { - sign: (() => { - if (typeof sign_ === 'function') { - return function sign(data, algo) { - const pem = this[SYM_PRIV_PEM]; - if (pem === null) - return new Error('No private key available'); - if (!algo || typeof algo !== 'string') - algo = this[SYM_HASH_ALGO]; - try { - return sign_(algo, data, pem); - } catch (ex) { - return ex; - } - }; - } - return function sign(data, algo) { - const pem = this[SYM_PRIV_PEM]; - if (pem === null) - return new Error('No private key available'); - if (!algo || typeof algo !== 'string') - algo = this[SYM_HASH_ALGO]; - const signature = createSign(algo); - signature.update(data); - try { - return signature.sign(pem); - } catch (ex) { - return ex; - } - }; - })(), - verify: (() => { - if (typeof verify_ === 'function') { - return function verify(data, signature, algo) { - const pem = this[SYM_PUB_PEM]; - if (pem === null) - return new Error('No public key available'); - if (!algo || typeof algo !== 'string') - algo = this[SYM_HASH_ALGO]; - try { - return verify_(algo, data, pem, signature); - } catch (ex) { - return ex; - } - }; - } - return function verify(data, signature, algo) { - const pem = this[SYM_PUB_PEM]; - if (pem === null) - return new Error('No public key available'); - if (!algo || typeof algo !== 'string') - algo = this[SYM_HASH_ALGO]; - const verifier = createVerify(algo); - verifier.update(data); - try { - return verifier.verify(pem, signature); - } catch (ex) { - return ex; - } - }; - })(), - isPrivateKey: function isPrivateKey() { - return (this[SYM_PRIV_PEM] !== null); - }, - getPrivatePEM: function getPrivatePEM() { - return this[SYM_PRIV_PEM]; - }, - getPublicPEM: function getPublicPEM() { - return this[SYM_PUB_PEM]; - }, - getPublicSSH: function getPublicSSH() { - return this[SYM_PUB_SSH]; - }, - equals: function equals(key) { - const parsed = parseKey(key); - if (parsed instanceof Error) - return false; - return ( - this.type === parsed.type - && this[SYM_PRIV_PEM] === parsed[SYM_PRIV_PEM] - && this[SYM_PUB_PEM] === parsed[SYM_PUB_PEM] - && this[SYM_PUB_SSH] === parsed[SYM_PUB_SSH] - ); - }, -}; - - -function OpenSSH_Private(type, comment, privPEM, pubPEM, pubSSH, algo, - decrypted) { - this.type = type; - this.comment = comment; - this[SYM_PRIV_PEM] = privPEM; - this[SYM_PUB_PEM] = pubPEM; - this[SYM_PUB_SSH] = pubSSH; - this[SYM_HASH_ALGO] = algo; - this[SYM_DECRYPTED] = decrypted; -} -OpenSSH_Private.prototype = BaseKey; -{ - const regexp = /^-----BEGIN OPENSSH PRIVATE KEY-----(?:\r\n|\n)([\s\S]+)(?:\r\n|\n)-----END OPENSSH PRIVATE KEY-----$/; - OpenSSH_Private.parse = (str, passphrase) => { - const m = regexp.exec(str); - if (m === null) - return null; - let ret; - const data = Buffer.from(m[1], 'base64'); - if (data.length < 31) // magic (+ magic null term.) + minimum field lengths - return new Error('Malformed OpenSSH private key'); - const magic = data.utf8Slice(0, 15); - if (magic !== 'openssh-key-v1\0') - return new Error(`Unsupported OpenSSH key magic: ${magic}`); - - const cipherName = readString(data, 15, true); - if (cipherName === undefined) - return new Error('Malformed OpenSSH private key'); - if (cipherName !== 'none' && SUPPORTED_CIPHER.indexOf(cipherName) === -1) - return new Error(`Unsupported cipher for OpenSSH key: ${cipherName}`); - - const kdfName = readString(data, data._pos, true); - if (kdfName === undefined) - return new Error('Malformed OpenSSH private key'); - if (kdfName !== 'none') { - if (cipherName === 'none') - return new Error('Malformed OpenSSH private key'); - if (kdfName !== 'bcrypt') - return new Error(`Unsupported kdf name for OpenSSH key: ${kdfName}`); - if (!passphrase) { - return new Error( - 'Encrypted private OpenSSH key detected, but no passphrase given' - ); - } - } else if (cipherName !== 'none') { - return new Error('Malformed OpenSSH private key'); - } - - let encInfo; - let cipherKey; - let cipherIV; - if (cipherName !== 'none') - encInfo = CIPHER_INFO[cipherName]; - const kdfOptions = readString(data, data._pos); - if (kdfOptions === undefined) - return new Error('Malformed OpenSSH private key'); - if (kdfOptions.length) { - switch (kdfName) { - case 'none': - return new Error('Malformed OpenSSH private key'); - case 'bcrypt': - /* - string salt - uint32 rounds - */ - const salt = readString(kdfOptions, 0); - if (salt === undefined || kdfOptions._pos + 4 > kdfOptions.length) - return new Error('Malformed OpenSSH private key'); - const rounds = readUInt32BE(kdfOptions, kdfOptions._pos); - const gen = Buffer.allocUnsafe(encInfo.keyLen + encInfo.ivLen); - const r = bcrypt_pbkdf(passphrase, - passphrase.length, - salt, - salt.length, - gen, - gen.length, - rounds); - if (r !== 0) - return new Error('Failed to generate information to decrypt key'); - cipherKey = bufferSlice(gen, 0, encInfo.keyLen); - cipherIV = bufferSlice(gen, encInfo.keyLen, gen.length); - break; - } - } else if (kdfName !== 'none') { - return new Error('Malformed OpenSSH private key'); - } - - if (data._pos + 3 >= data.length) - return new Error('Malformed OpenSSH private key'); - const keyCount = readUInt32BE(data, data._pos); - data._pos += 4; - - if (keyCount > 0) { - // TODO: place sensible limit on max `keyCount` - - // Read public keys first - for (let i = 0; i < keyCount; ++i) { - const pubData = readString(data, data._pos); - if (pubData === undefined) - return new Error('Malformed OpenSSH private key'); - const type = readString(pubData, 0, true); - if (type === undefined) - return new Error('Malformed OpenSSH private key'); - } - - let privBlob = readString(data, data._pos); - if (privBlob === undefined) - return new Error('Malformed OpenSSH private key'); - - if (cipherKey !== undefined) { - // Encrypted private key(s) - if (privBlob.length < encInfo.blockLen - || (privBlob.length % encInfo.blockLen) !== 0) { - return new Error('Malformed OpenSSH private key'); - } - try { - const options = { authTagLength: encInfo.authLen }; - const decipher = createDecipheriv(encInfo.sslName, - cipherKey, - cipherIV, - options); - if (encInfo.authLen > 0) { - if (data.length - data._pos < encInfo.authLen) - return new Error('Malformed OpenSSH private key'); - decipher.setAuthTag( - bufferSlice(data, data._pos, data._pos += encInfo.authLen) - ); - } - privBlob = combineBuffers(decipher.update(privBlob), - decipher.final()); - } catch (ex) { - return ex; - } - } - // Nothing should we follow the private key(s), except a possible - // authentication tag for relevant ciphers - if (data._pos !== data.length) - return new Error('Malformed OpenSSH private key'); - - ret = parseOpenSSHPrivKeys(privBlob, keyCount, cipherKey !== undefined); - } else { - ret = []; - } - // This will need to change if/when OpenSSH ever starts storing multiple - // keys in their key files - return ret[0]; - }; - - function parseOpenSSHPrivKeys(data, nkeys, decrypted) { - const keys = []; - /* - uint32 checkint - uint32 checkint - string privatekey1 - string comment1 - string privatekey2 - string comment2 - ... - string privatekeyN - string commentN - char 1 - char 2 - char 3 - ... - char padlen % 255 - */ - if (data.length < 8) - return new Error('Malformed OpenSSH private key'); - const check1 = readUInt32BE(data, 0); - const check2 = readUInt32BE(data, 4); - if (check1 !== check2) { - if (decrypted) { - return new Error( - 'OpenSSH key integrity check failed -- bad passphrase?' - ); - } - return new Error('OpenSSH key integrity check failed'); - } - data._pos = 8; - let i; - let oid; - for (i = 0; i < nkeys; ++i) { - let algo; - let privPEM; - let pubPEM; - let pubSSH; - // The OpenSSH documentation for the key format actually lies, the - // entirety of the private key content is not contained with a string - // field, it's actually the literal contents of the private key, so to be - // able to find the end of the key data you need to know the layout/format - // of each key type ... - const type = readString(data, data._pos, true); - if (type === undefined) - return new Error('Malformed OpenSSH private key'); - - switch (type) { - case 'ssh-rsa': { - /* - string n -- public - string e -- public - string d -- private - string iqmp -- private - string p -- private - string q -- private - */ - const n = readString(data, data._pos); - if (n === undefined) - return new Error('Malformed OpenSSH private key'); - const e = readString(data, data._pos); - if (e === undefined) - return new Error('Malformed OpenSSH private key'); - const d = readString(data, data._pos); - if (d === undefined) - return new Error('Malformed OpenSSH private key'); - const iqmp = readString(data, data._pos); - if (iqmp === undefined) - return new Error('Malformed OpenSSH private key'); - const p = readString(data, data._pos); - if (p === undefined) - return new Error('Malformed OpenSSH private key'); - const q = readString(data, data._pos); - if (q === undefined) - return new Error('Malformed OpenSSH private key'); - - pubPEM = genOpenSSLRSAPub(n, e); - pubSSH = genOpenSSHRSAPub(n, e); - privPEM = genOpenSSLRSAPriv(n, e, d, iqmp, p, q); - algo = 'sha1'; - break; - } - case 'ssh-dss': { - /* - string p -- public - string q -- public - string g -- public - string y -- public - string x -- private - */ - const p = readString(data, data._pos); - if (p === undefined) - return new Error('Malformed OpenSSH private key'); - const q = readString(data, data._pos); - if (q === undefined) - return new Error('Malformed OpenSSH private key'); - const g = readString(data, data._pos); - if (g === undefined) - return new Error('Malformed OpenSSH private key'); - const y = readString(data, data._pos); - if (y === undefined) - return new Error('Malformed OpenSSH private key'); - const x = readString(data, data._pos); - if (x === undefined) - return new Error('Malformed OpenSSH private key'); - - pubPEM = genOpenSSLDSAPub(p, q, g, y); - pubSSH = genOpenSSHDSAPub(p, q, g, y); - privPEM = genOpenSSLDSAPriv(p, q, g, y, x); - algo = 'sha1'; - break; - } - case 'ssh-ed25519': { - if (!eddsaSupported) - return new Error(`Unsupported OpenSSH private key type: ${type}`); - /* - * string public key - * string private key + public key - */ - const edpub = readString(data, data._pos); - if (edpub === undefined || edpub.length !== 32) - return new Error('Malformed OpenSSH private key'); - const edpriv = readString(data, data._pos); - if (edpriv === undefined || edpriv.length !== 64) - return new Error('Malformed OpenSSH private key'); - - pubPEM = genOpenSSLEdPub(edpub); - pubSSH = genOpenSSHEdPub(edpub); - privPEM = genOpenSSLEdPriv(bufferSlice(edpriv, 0, 32)); - algo = null; - break; - } - case 'ecdsa-sha2-nistp256': - algo = 'sha256'; - oid = '1.2.840.10045.3.1.7'; - // FALLTHROUGH - case 'ecdsa-sha2-nistp384': - if (algo === undefined) { - algo = 'sha384'; - oid = '1.3.132.0.34'; - } - // FALLTHROUGH - case 'ecdsa-sha2-nistp521': { - if (algo === undefined) { - algo = 'sha512'; - oid = '1.3.132.0.35'; - } - /* - string curve name - string Q -- public - string d -- private - */ - // TODO: validate curve name against type - if (!skipFields(data, 1)) // Skip curve name - return new Error('Malformed OpenSSH private key'); - const ecpub = readString(data, data._pos); - if (ecpub === undefined) - return new Error('Malformed OpenSSH private key'); - const ecpriv = readString(data, data._pos); - if (ecpriv === undefined) - return new Error('Malformed OpenSSH private key'); - - pubPEM = genOpenSSLECDSAPub(oid, ecpub); - pubSSH = genOpenSSHECDSAPub(oid, ecpub); - privPEM = genOpenSSLECDSAPriv(oid, ecpub, ecpriv); - break; - } - default: - return new Error(`Unsupported OpenSSH private key type: ${type}`); - } - - const privComment = readString(data, data._pos, true); - if (privComment === undefined) - return new Error('Malformed OpenSSH private key'); - - keys.push( - new OpenSSH_Private(type, privComment, privPEM, pubPEM, pubSSH, algo, - decrypted) - ); - } - let cnt = 0; - for (i = data._pos; i < data.length; ++i) { - if (data[i] !== (++cnt % 255)) - return new Error('Malformed OpenSSH private key'); - } - - return keys; - } -} - - -function OpenSSH_Old_Private(type, comment, privPEM, pubPEM, pubSSH, algo, - decrypted) { - this.type = type; - this.comment = comment; - this[SYM_PRIV_PEM] = privPEM; - this[SYM_PUB_PEM] = pubPEM; - this[SYM_PUB_SSH] = pubSSH; - this[SYM_HASH_ALGO] = algo; - this[SYM_DECRYPTED] = decrypted; -} -OpenSSH_Old_Private.prototype = BaseKey; -{ - const regexp = /^-----BEGIN (RSA|DSA|EC) PRIVATE KEY-----(?:\r\n|\n)((?:[^:]+:\s*[\S].*(?:\r\n|\n))*)([\s\S]+)(?:\r\n|\n)-----END (RSA|DSA|EC) PRIVATE KEY-----$/; - OpenSSH_Old_Private.parse = (str, passphrase) => { - const m = regexp.exec(str); - if (m === null) - return null; - let privBlob = Buffer.from(m[3], 'base64'); - let headers = m[2]; - let decrypted = false; - if (headers !== undefined) { - // encrypted key - headers = headers.split(/\r\n|\n/g); - for (let i = 0; i < headers.length; ++i) { - const header = headers[i]; - let sepIdx = header.indexOf(':'); - if (header.slice(0, sepIdx) === 'DEK-Info') { - const val = header.slice(sepIdx + 2); - sepIdx = val.indexOf(','); - if (sepIdx === -1) - continue; - const cipherName = val.slice(0, sepIdx).toLowerCase(); - if (supportedOpenSSLCiphers.indexOf(cipherName) === -1) { - return new Error( - `Cipher (${cipherName}) not supported ` - + 'for encrypted OpenSSH private key' - ); - } - const encInfo = CIPHER_INFO_OPENSSL[cipherName]; - if (!encInfo) { - return new Error( - `Cipher (${cipherName}) not supported ` - + 'for encrypted OpenSSH private key' - ); - } - const cipherIV = Buffer.from(val.slice(sepIdx + 1), 'hex'); - if (cipherIV.length !== encInfo.ivLen) - return new Error('Malformed encrypted OpenSSH private key'); - if (!passphrase) { - return new Error( - 'Encrypted OpenSSH private key detected, but no passphrase given' - ); - } - const ivSlice = bufferSlice(cipherIV, 0, 8); - let cipherKey = createHash('md5') - .update(passphrase) - .update(ivSlice) - .digest(); - while (cipherKey.length < encInfo.keyLen) { - cipherKey = combineBuffers( - cipherKey, - createHash('md5') - .update(cipherKey) - .update(passphrase) - .update(ivSlice) - .digest() - ); - } - if (cipherKey.length > encInfo.keyLen) - cipherKey = bufferSlice(cipherKey, 0, encInfo.keyLen); - try { - const decipher = createDecipheriv(cipherName, cipherKey, cipherIV); - decipher.setAutoPadding(false); - privBlob = combineBuffers(decipher.update(privBlob), - decipher.final()); - decrypted = true; - } catch (ex) { - return ex; - } - } - } - } - - let type; - let privPEM; - let pubPEM; - let pubSSH; - let algo; - let reader; - let errMsg = 'Malformed OpenSSH private key'; - if (decrypted) - errMsg += '. Bad passphrase?'; - switch (m[1]) { - case 'RSA': - type = 'ssh-rsa'; - privPEM = makePEM('RSA PRIVATE', privBlob); - try { - reader = new Ber.Reader(privBlob); - reader.readSequence(); - reader.readInt(); // skip version - const n = reader.readString(Ber.Integer, true); - if (n === null) - return new Error(errMsg); - const e = reader.readString(Ber.Integer, true); - if (e === null) - return new Error(errMsg); - pubPEM = genOpenSSLRSAPub(n, e); - pubSSH = genOpenSSHRSAPub(n, e); - } catch { - return new Error(errMsg); - } - algo = 'sha1'; - break; - case 'DSA': - type = 'ssh-dss'; - privPEM = makePEM('DSA PRIVATE', privBlob); - try { - reader = new Ber.Reader(privBlob); - reader.readSequence(); - reader.readInt(); // skip version - const p = reader.readString(Ber.Integer, true); - if (p === null) - return new Error(errMsg); - const q = reader.readString(Ber.Integer, true); - if (q === null) - return new Error(errMsg); - const g = reader.readString(Ber.Integer, true); - if (g === null) - return new Error(errMsg); - const y = reader.readString(Ber.Integer, true); - if (y === null) - return new Error(errMsg); - pubPEM = genOpenSSLDSAPub(p, q, g, y); - pubSSH = genOpenSSHDSAPub(p, q, g, y); - } catch { - return new Error(errMsg); - } - algo = 'sha1'; - break; - case 'EC': - let ecSSLName; - let ecPriv; - let ecOID; - try { - reader = new Ber.Reader(privBlob); - reader.readSequence(); - reader.readInt(); // skip version - ecPriv = reader.readString(Ber.OctetString, true); - reader.readByte(); // Skip "complex" context type byte - const offset = reader.readLength(); // Skip context length - if (offset !== null) { - reader._offset = offset; - ecOID = reader.readOID(); - if (ecOID === null) - return new Error(errMsg); - switch (ecOID) { - case '1.2.840.10045.3.1.7': - // prime256v1/secp256r1 - ecSSLName = 'prime256v1'; - type = 'ecdsa-sha2-nistp256'; - algo = 'sha256'; - break; - case '1.3.132.0.34': - // secp384r1 - ecSSLName = 'secp384r1'; - type = 'ecdsa-sha2-nistp384'; - algo = 'sha384'; - break; - case '1.3.132.0.35': - // secp521r1 - ecSSLName = 'secp521r1'; - type = 'ecdsa-sha2-nistp521'; - algo = 'sha512'; - break; - default: - return new Error(`Unsupported private key EC OID: ${ecOID}`); - } - } else { - return new Error(errMsg); - } - } catch { - return new Error(errMsg); - } - privPEM = makePEM('EC PRIVATE', privBlob); - const pubBlob = genOpenSSLECDSAPubFromPriv(ecSSLName, ecPriv); - pubPEM = genOpenSSLECDSAPub(ecOID, pubBlob); - pubSSH = genOpenSSHECDSAPub(ecOID, pubBlob); - break; - } - - return new OpenSSH_Old_Private(type, '', privPEM, pubPEM, pubSSH, algo, - decrypted); - }; -} - - -function PPK_Private(type, comment, privPEM, pubPEM, pubSSH, algo, decrypted) { - this.type = type; - this.comment = comment; - this[SYM_PRIV_PEM] = privPEM; - this[SYM_PUB_PEM] = pubPEM; - this[SYM_PUB_SSH] = pubSSH; - this[SYM_HASH_ALGO] = algo; - this[SYM_DECRYPTED] = decrypted; -} -PPK_Private.prototype = BaseKey; -{ - const EMPTY_PASSPHRASE = Buffer.alloc(0); - const PPK_IV = Buffer.from([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]); - const PPK_PP1 = Buffer.from([0, 0, 0, 0]); - const PPK_PP2 = Buffer.from([0, 0, 0, 1]); - const regexp = /^PuTTY-User-Key-File-2: (ssh-(?:rsa|dss))\r?\nEncryption: (aes256-cbc|none)\r?\nComment: ([^\r\n]*)\r?\nPublic-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-Lines: \d+\r?\n([\s\S]+?)\r?\nPrivate-MAC: ([^\r\n]+)/; - PPK_Private.parse = (str, passphrase) => { - const m = regexp.exec(str); - if (m === null) - return null; - // m[1] = key type - // m[2] = encryption type - // m[3] = comment - // m[4] = base64-encoded public key data: - // for "ssh-rsa": - // string "ssh-rsa" - // mpint e (public exponent) - // mpint n (modulus) - // for "ssh-dss": - // string "ssh-dss" - // mpint p (modulus) - // mpint q (prime) - // mpint g (base number) - // mpint y (public key parameter: g^x mod p) - // m[5] = base64-encoded private key data: - // for "ssh-rsa": - // mpint d (private exponent) - // mpint p (prime 1) - // mpint q (prime 2) - // mpint iqmp ([inverse of q] mod p) - // for "ssh-dss": - // mpint x (private key parameter) - // m[6] = SHA1 HMAC over: - // string name of algorithm ("ssh-dss", "ssh-rsa") - // string encryption type - // string comment - // string public key data - // string private-plaintext (including the final padding) - const cipherName = m[2]; - const encrypted = (cipherName !== 'none'); - if (encrypted && !passphrase) { - return new Error( - 'Encrypted PPK private key detected, but no passphrase given' - ); - } - - let privBlob = Buffer.from(m[5], 'base64'); - - if (encrypted) { - const encInfo = CIPHER_INFO[cipherName]; - let cipherKey = combineBuffers( - createHash('sha1').update(PPK_PP1).update(passphrase).digest(), - createHash('sha1').update(PPK_PP2).update(passphrase).digest() - ); - if (cipherKey.length > encInfo.keyLen) - cipherKey = bufferSlice(cipherKey, 0, encInfo.keyLen); - try { - const decipher = createDecipheriv(encInfo.sslName, - cipherKey, - PPK_IV); - decipher.setAutoPadding(false); - privBlob = combineBuffers(decipher.update(privBlob), - decipher.final()); - } catch (ex) { - return ex; - } - } - - const type = m[1]; - const comment = m[3]; - const pubBlob = Buffer.from(m[4], 'base64'); - - const mac = m[6]; - const typeLen = type.length; - const cipherNameLen = cipherName.length; - const commentLen = Buffer.byteLength(comment); - const pubLen = pubBlob.length; - const privLen = privBlob.length; - const macData = Buffer.allocUnsafe(4 + typeLen - + 4 + cipherNameLen - + 4 + commentLen - + 4 + pubLen - + 4 + privLen); - let p = 0; - - writeUInt32BE(macData, typeLen, p); - macData.utf8Write(type, p += 4, typeLen); - writeUInt32BE(macData, cipherNameLen, p += typeLen); - macData.utf8Write(cipherName, p += 4, cipherNameLen); - writeUInt32BE(macData, commentLen, p += cipherNameLen); - macData.utf8Write(comment, p += 4, commentLen); - writeUInt32BE(macData, pubLen, p += commentLen); - macData.set(pubBlob, p += 4); - writeUInt32BE(macData, privLen, p += pubLen); - macData.set(privBlob, p + 4); - - if (!passphrase) - passphrase = EMPTY_PASSPHRASE; - - const calcMAC = createHmac( - 'sha1', - createHash('sha1') - .update('putty-private-key-file-mac-key') - .update(passphrase) - .digest() - ).update(macData).digest('hex'); - - if (calcMAC !== mac) { - if (encrypted) { - return new Error( - 'PPK private key integrity check failed -- bad passphrase?' - ); - } - return new Error('PPK private key integrity check failed'); - } - - let pubPEM; - let pubSSH; - let privPEM; - pubBlob._pos = 0; - skipFields(pubBlob, 1); // skip (duplicate) key type - switch (type) { - case 'ssh-rsa': { - const e = readString(pubBlob, pubBlob._pos); - if (e === undefined) - return new Error('Malformed PPK public key'); - const n = readString(pubBlob, pubBlob._pos); - if (n === undefined) - return new Error('Malformed PPK public key'); - const d = readString(privBlob, 0); - if (d === undefined) - return new Error('Malformed PPK private key'); - const p = readString(privBlob, privBlob._pos); - if (p === undefined) - return new Error('Malformed PPK private key'); - const q = readString(privBlob, privBlob._pos); - if (q === undefined) - return new Error('Malformed PPK private key'); - const iqmp = readString(privBlob, privBlob._pos); - if (iqmp === undefined) - return new Error('Malformed PPK private key'); - pubPEM = genOpenSSLRSAPub(n, e); - pubSSH = genOpenSSHRSAPub(n, e); - privPEM = genOpenSSLRSAPriv(n, e, d, iqmp, p, q); - break; - } - case 'ssh-dss': { - const p = readString(pubBlob, pubBlob._pos); - if (p === undefined) - return new Error('Malformed PPK public key'); - const q = readString(pubBlob, pubBlob._pos); - if (q === undefined) - return new Error('Malformed PPK public key'); - const g = readString(pubBlob, pubBlob._pos); - if (g === undefined) - return new Error('Malformed PPK public key'); - const y = readString(pubBlob, pubBlob._pos); - if (y === undefined) - return new Error('Malformed PPK public key'); - const x = readString(privBlob, 0); - if (x === undefined) - return new Error('Malformed PPK private key'); - - pubPEM = genOpenSSLDSAPub(p, q, g, y); - pubSSH = genOpenSSHDSAPub(p, q, g, y); - privPEM = genOpenSSLDSAPriv(p, q, g, y, x); - break; - } - } - - return new PPK_Private(type, comment, privPEM, pubPEM, pubSSH, 'sha1', - encrypted); - }; -} - - -function OpenSSH_Public(type, comment, pubPEM, pubSSH, algo) { - this.type = type; - this.comment = comment; - this[SYM_PRIV_PEM] = null; - this[SYM_PUB_PEM] = pubPEM; - this[SYM_PUB_SSH] = pubSSH; - this[SYM_HASH_ALGO] = algo; - this[SYM_DECRYPTED] = false; -} -OpenSSH_Public.prototype = BaseKey; -{ - let regexp; - if (eddsaSupported) - regexp = /^(((?:ssh-(?:rsa|dss|ed25519))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/; - else - regexp = /^(((?:ssh-(?:rsa|dss))|ecdsa-sha2-nistp(?:256|384|521))(?:-cert-v0[01]@openssh.com)?) ([A-Z0-9a-z/+=]+)(?:$|\s+([\S].*)?)$/; - OpenSSH_Public.parse = (str) => { - const m = regexp.exec(str); - if (m === null) - return null; - // m[1] = full type - // m[2] = base type - // m[3] = base64-encoded public key - // m[4] = comment - - const fullType = m[1]; - const baseType = m[2]; - const data = Buffer.from(m[3], 'base64'); - const comment = (m[4] || ''); - - const type = readString(data, data._pos, true); - if (type === undefined || type.indexOf(baseType) !== 0) - return new Error('Malformed OpenSSH public key'); - - return parseDER(data, baseType, comment, fullType); - }; -} - - -function RFC4716_Public(type, comment, pubPEM, pubSSH, algo) { - this.type = type; - this.comment = comment; - this[SYM_PRIV_PEM] = null; - this[SYM_PUB_PEM] = pubPEM; - this[SYM_PUB_SSH] = pubSSH; - this[SYM_HASH_ALGO] = algo; - this[SYM_DECRYPTED] = false; -} -RFC4716_Public.prototype = BaseKey; -{ - const regexp = /^---- BEGIN SSH2 PUBLIC KEY ----(?:\r?\n)((?:.{0,72}\r?\n)+)---- END SSH2 PUBLIC KEY ----$/; - const RE_DATA = /^[A-Z0-9a-z/+=\r\n]+$/; - const RE_HEADER = /^([\x21-\x39\x3B-\x7E]{1,64}): ((?:[^\\]*\\\r?\n)*[^\r\n]+)\r?\n/gm; - const RE_HEADER_ENDS = /\\\r?\n/g; - RFC4716_Public.parse = (str) => { - let m = regexp.exec(str); - if (m === null) - return null; - - const body = m[1]; - let dataStart = 0; - let comment = ''; - - while (m = RE_HEADER.exec(body)) { - const headerName = m[1]; - const headerValue = m[2].replace(RE_HEADER_ENDS, ''); - if (headerValue.length > 1024) { - RE_HEADER.lastIndex = 0; - return new Error('Malformed RFC4716 public key'); - } - - dataStart = RE_HEADER.lastIndex; - - if (headerName.toLowerCase() === 'comment') { - comment = headerValue; - if (comment.length > 1 - && comment.charCodeAt(0) === 34/* '"' */ - && comment.charCodeAt(comment.length - 1) === 34/* '"' */) { - comment = comment.slice(1, -1); - } - } - } - - let data = body.slice(dataStart); - if (!RE_DATA.test(data)) - return new Error('Malformed RFC4716 public key'); - - data = Buffer.from(data, 'base64'); - - const type = readString(data, 0, true); - if (type === undefined) - return new Error('Malformed RFC4716 public key'); - - let pubPEM = null; - let pubSSH = null; - switch (type) { - case 'ssh-rsa': { - const e = readString(data, data._pos); - if (e === undefined) - return new Error('Malformed RFC4716 public key'); - const n = readString(data, data._pos); - if (n === undefined) - return new Error('Malformed RFC4716 public key'); - pubPEM = genOpenSSLRSAPub(n, e); - pubSSH = genOpenSSHRSAPub(n, e); - break; - } - case 'ssh-dss': { - const p = readString(data, data._pos); - if (p === undefined) - return new Error('Malformed RFC4716 public key'); - const q = readString(data, data._pos); - if (q === undefined) - return new Error('Malformed RFC4716 public key'); - const g = readString(data, data._pos); - if (g === undefined) - return new Error('Malformed RFC4716 public key'); - const y = readString(data, data._pos); - if (y === undefined) - return new Error('Malformed RFC4716 public key'); - pubPEM = genOpenSSLDSAPub(p, q, g, y); - pubSSH = genOpenSSHDSAPub(p, q, g, y); - break; - } - default: - return new Error('Malformed RFC4716 public key'); - } - - return new RFC4716_Public(type, comment, pubPEM, pubSSH, 'sha1'); - }; -} - - -function parseDER(data, baseType, comment, fullType) { - if (!isSupportedKeyType(baseType)) - return new Error(`Unsupported OpenSSH public key type: ${baseType}`); - - let algo; - let oid; - let pubPEM = null; - let pubSSH = null; - - switch (baseType) { - case 'ssh-rsa': { - const e = readString(data, data._pos || 0); - if (e === undefined) - return new Error('Malformed OpenSSH public key'); - const n = readString(data, data._pos); - if (n === undefined) - return new Error('Malformed OpenSSH public key'); - pubPEM = genOpenSSLRSAPub(n, e); - pubSSH = genOpenSSHRSAPub(n, e); - algo = 'sha1'; - break; - } - case 'ssh-dss': { - const p = readString(data, data._pos || 0); - if (p === undefined) - return new Error('Malformed OpenSSH public key'); - const q = readString(data, data._pos); - if (q === undefined) - return new Error('Malformed OpenSSH public key'); - const g = readString(data, data._pos); - if (g === undefined) - return new Error('Malformed OpenSSH public key'); - const y = readString(data, data._pos); - if (y === undefined) - return new Error('Malformed OpenSSH public key'); - pubPEM = genOpenSSLDSAPub(p, q, g, y); - pubSSH = genOpenSSHDSAPub(p, q, g, y); - algo = 'sha1'; - break; - } - case 'ssh-ed25519': { - const edpub = readString(data, data._pos || 0); - if (edpub === undefined || edpub.length !== 32) - return new Error('Malformed OpenSSH public key'); - pubPEM = genOpenSSLEdPub(edpub); - pubSSH = genOpenSSHEdPub(edpub); - algo = null; - break; - } - case 'ecdsa-sha2-nistp256': - algo = 'sha256'; - oid = '1.2.840.10045.3.1.7'; - // FALLTHROUGH - case 'ecdsa-sha2-nistp384': - if (algo === undefined) { - algo = 'sha384'; - oid = '1.3.132.0.34'; - } - // FALLTHROUGH - case 'ecdsa-sha2-nistp521': { - if (algo === undefined) { - algo = 'sha512'; - oid = '1.3.132.0.35'; - } - // TODO: validate curve name against type - if (!skipFields(data, 1)) // Skip curve name - return new Error('Malformed OpenSSH public key'); - const ecpub = readString(data, data._pos || 0); - if (ecpub === undefined) - return new Error('Malformed OpenSSH public key'); - pubPEM = genOpenSSLECDSAPub(oid, ecpub); - pubSSH = genOpenSSHECDSAPub(oid, ecpub); - break; - } - default: - return new Error(`Unsupported OpenSSH public key type: ${baseType}`); - } - - return new OpenSSH_Public(fullType, comment, pubPEM, pubSSH, algo); -} - -function isSupportedKeyType(type) { - switch (type) { - case 'ssh-rsa': - case 'ssh-dss': - case 'ecdsa-sha2-nistp256': - case 'ecdsa-sha2-nistp384': - case 'ecdsa-sha2-nistp521': - return true; - case 'ssh-ed25519': - if (eddsaSupported) - return true; - // FALLTHROUGH - default: - return false; - } -} - -function isParsedKey(val) { - if (!val) - return false; - return (typeof val[SYM_DECRYPTED] === 'boolean'); -} - -function parseKey(data, passphrase) { - if (isParsedKey(data)) - return data; - - let origBuffer; - if (Buffer.isBuffer(data)) { - origBuffer = data; - data = data.utf8Slice(0, data.length).trim(); - } else if (typeof data === 'string') { - data = data.trim(); - } else { - return new Error('Key data must be a Buffer or string'); - } - - // eslint-disable-next-line eqeqeq - if (passphrase != undefined) { - if (typeof passphrase === 'string') - passphrase = Buffer.from(passphrase); - else if (!Buffer.isBuffer(passphrase)) - return new Error('Passphrase must be a string or Buffer when supplied'); - } - - let ret; - - // First try as printable string format (e.g. PEM) - - // Private keys - if ((ret = OpenSSH_Private.parse(data, passphrase)) !== null) - return ret; - if ((ret = OpenSSH_Old_Private.parse(data, passphrase)) !== null) - return ret; - if ((ret = PPK_Private.parse(data, passphrase)) !== null) - return ret; - - // Public keys - if ((ret = OpenSSH_Public.parse(data)) !== null) - return ret; - if ((ret = RFC4716_Public.parse(data)) !== null) - return ret; - - // Finally try as a binary format if we were originally passed binary data - if (origBuffer) { - binaryKeyParser.init(origBuffer, 0); - const type = binaryKeyParser.readString(true); - if (type !== undefined) { - data = binaryKeyParser.readRaw(); - if (data !== undefined) { - ret = parseDER(data, type, '', type); - // Ignore potentially useless errors in case the data was not actually - // in the binary format - if (ret instanceof Error) - ret = null; - } - } - binaryKeyParser.clear(); - } - - if (ret) - return ret; - - return new Error('Unsupported key format'); -} - -module.exports = { - isParsedKey, - isSupportedKeyType, - parseDERKey: (data, type) => parseDER(data, type, '', type), - parseKey, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/node-fs-compat.js b/reverse_engineering/node_modules/ssh2/lib/protocol/node-fs-compat.js deleted file mode 100644 index 80ed71fc..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/node-fs-compat.js +++ /dev/null @@ -1,115 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -// Only use this for integers! Decimal numbers do not work with this function. -function addNumericalSeparator(val) { - let res = ''; - let i = val.length; - const start = val[0] === '-' ? 1 : 0; - for (; i >= start + 4; i -= 3) - res = `_${val.slice(i - 3, i)}${res}`; - return `${val.slice(0, i)}${res}`; -} - -function oneOf(expected, thing) { - assert(typeof thing === 'string', '`thing` has to be of type string'); - if (Array.isArray(expected)) { - const len = expected.length; - assert(len > 0, 'At least one expected value needs to be specified'); - expected = expected.map((i) => String(i)); - if (len > 2) { - return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` - + expected[len - 1]; - } else if (len === 2) { - return `one of ${thing} ${expected[0]} or ${expected[1]}`; - } - return `of ${thing} ${expected[0]}`; - } - return `of ${thing} ${String(expected)}`; -} - - -exports.ERR_INTERNAL_ASSERTION = class ERR_INTERNAL_ASSERTION extends Error { - constructor(message) { - super(); - Error.captureStackTrace(this, ERR_INTERNAL_ASSERTION); - - const suffix = 'This is caused by either a bug in ssh2 ' - + 'or incorrect usage of ssh2 internals.\n' - + 'Please open an issue with this stack trace at ' - + 'https://github.com/mscdex/ssh2/issues\n'; - - this.message = (message === undefined ? suffix : `${message}\n${suffix}`); - } -}; - -const MAX_32BIT_INT = 2 ** 32; -const MAX_32BIT_BIGINT = (() => { - try { - return new Function('return 2n ** 32n')(); - } catch {} -})(); -exports.ERR_OUT_OF_RANGE = class ERR_OUT_OF_RANGE extends RangeError { - constructor(str, range, input, replaceDefaultBoolean) { - super(); - Error.captureStackTrace(this, ERR_OUT_OF_RANGE); - - assert(range, 'Missing "range" argument'); - let msg = (replaceDefaultBoolean - ? str - : `The value of "${str}" is out of range.`); - let received; - if (Number.isInteger(input) && Math.abs(input) > MAX_32BIT_INT) { - received = addNumericalSeparator(String(input)); - } else if (typeof input === 'bigint') { - received = String(input); - if (input > MAX_32BIT_BIGINT || input < -MAX_32BIT_BIGINT) - received = addNumericalSeparator(received); - received += 'n'; - } else { - received = inspect(input); - } - msg += ` It must be ${range}. Received ${received}`; - - this.message = msg; - } -}; - -class ERR_INVALID_ARG_TYPE extends TypeError { - constructor(name, expected, actual) { - super(); - Error.captureStackTrace(this, ERR_INVALID_ARG_TYPE); - - assert(typeof name === 'string', `'name' must be a string`); - - // determiner: 'must be' or 'must not be' - let determiner; - if (typeof expected === 'string' && expected.startsWith('not ')) { - determiner = 'must not be'; - expected = expected.replace(/^not /, ''); - } else { - determiner = 'must be'; - } - - let msg; - if (name.endsWith(' argument')) { - // For cases like 'first argument' - msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; - } else { - const type = (name.includes('.') ? 'property' : 'argument'); - msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; - } - - msg += `. Received type ${typeof actual}`; - - this.message = msg; - } -} -exports.ERR_INVALID_ARG_TYPE = ERR_INVALID_ARG_TYPE; - -exports.validateNumber = function validateNumber(value, name) { - if (typeof value !== 'number') - throw new ERR_INVALID_ARG_TYPE(name, 'number', value); -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/utils.js b/reverse_engineering/node_modules/ssh2/lib/protocol/utils.js deleted file mode 100644 index 0dab875e..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/utils.js +++ /dev/null @@ -1,356 +0,0 @@ -'use strict'; - -const Ber = require('asn1').Ber; - -let DISCONNECT_REASON; - -const FastBuffer = Buffer[Symbol.species]; -const TypedArrayFill = Object.getPrototypeOf(Uint8Array.prototype).fill; - -function readUInt32BE(buf, offset) { - return (buf[offset++] * 16777216) - + (buf[offset++] * 65536) - + (buf[offset++] * 256) - + buf[offset]; -} - -function bufferCopy(src, dest, srcStart, srcEnd, destStart) { - if (!destStart) - destStart = 0; - if (srcEnd > src.length) - srcEnd = src.length; - let nb = srcEnd - srcStart; - const destLeft = (dest.length - destStart); - if (nb > destLeft) - nb = destLeft; - dest.set(new Uint8Array(src.buffer, src.byteOffset + srcStart, nb), - destStart); - return nb; -} - -function bufferSlice(buf, start, end) { - if (end === undefined) - end = buf.length; - return new FastBuffer(buf.buffer, buf.byteOffset + start, end - start); -} - -function makeBufferParser() { - let pos = 0; - let buffer; - - const self = { - init: (buf, start) => { - buffer = buf; - pos = (typeof start === 'number' ? start : 0); - }, - pos: () => pos, - length: () => (buffer ? buffer.length : 0), - avail: () => (buffer && pos < buffer.length ? buffer.length - pos : 0), - clear: () => { - buffer = undefined; - }, - readUInt32BE: () => { - if (!buffer || pos + 3 >= buffer.length) - return; - return (buffer[pos++] * 16777216) - + (buffer[pos++] * 65536) - + (buffer[pos++] * 256) - + buffer[pos++]; - }, - readUInt64BE: (behavior) => { - if (!buffer || pos + 7 >= buffer.length) - return; - switch (behavior) { - case 'always': - return BigInt(`0x${buffer.hexSlice(pos, pos += 8)}`); - case 'maybe': - if (buffer[pos] > 0x1F) - return BigInt(`0x${buffer.hexSlice(pos, pos += 8)}`); - // FALLTHROUGH - default: - return (buffer[pos++] * 72057594037927940) - + (buffer[pos++] * 281474976710656) - + (buffer[pos++] * 1099511627776) - + (buffer[pos++] * 4294967296) - + (buffer[pos++] * 16777216) - + (buffer[pos++] * 65536) - + (buffer[pos++] * 256) - + buffer[pos++]; - } - }, - skip: (n) => { - if (buffer && n > 0) - pos += n; - }, - skipString: () => { - const len = self.readUInt32BE(); - if (len === undefined) - return; - pos += len; - return (pos <= buffer.length ? len : undefined); - }, - readByte: () => { - if (buffer && pos < buffer.length) - return buffer[pos++]; - }, - readBool: () => { - if (buffer && pos < buffer.length) - return !!buffer[pos++]; - }, - readList: () => { - const list = self.readString(true); - if (list === undefined) - return; - return (list ? list.split(',') : []); - }, - readString: (dest, maxLen) => { - if (typeof dest === 'number') { - maxLen = dest; - dest = undefined; - } - - const len = self.readUInt32BE(); - if (len === undefined) - return; - - if ((buffer.length - pos) < len - || (typeof maxLen === 'number' && len > maxLen)) { - return; - } - - if (dest) { - if (Buffer.isBuffer(dest)) - return bufferCopy(buffer, dest, pos, pos += len); - return buffer.utf8Slice(pos, pos += len); - } - return bufferSlice(buffer, pos, pos += len); - }, - readRaw: (len) => { - if (!buffer) - return; - if (typeof len !== 'number') - return bufferSlice(buffer, pos, pos += (buffer.length - pos)); - if ((buffer.length - pos) >= len) - return bufferSlice(buffer, pos, pos += len); - }, - }; - - return self; -} - -function makeError(msg, level, fatal) { - const err = new Error(msg); - if (typeof level === 'boolean') { - fatal = level; - err.level = 'protocol'; - } else { - err.level = level || 'protocol'; - } - err.fatal = !!fatal; - return err; -} - -function writeUInt32BE(buf, value, offset) { - buf[offset++] = (value >>> 24); - buf[offset++] = (value >>> 16); - buf[offset++] = (value >>> 8); - buf[offset++] = value; - return offset; -} - -const utilBufferParser = makeBufferParser(); - -module.exports = { - bufferCopy, - bufferSlice, - FastBuffer, - bufferFill: (buf, value, start, end) => { - return TypedArrayFill.call(buf, value, start, end); - }, - makeError, - doFatalError: (protocol, msg, level, reason) => { - let err; - if (DISCONNECT_REASON === undefined) - ({ DISCONNECT_REASON } = require('./utils.js')); - if (msg instanceof Error) { - // doFatalError(protocol, err[, reason]) - err = msg; - if (typeof level !== 'number') - reason = DISCONNECT_REASON.PROTOCOL_ERROR; - else - reason = level; - } else { - // doFatalError(protocol, msg[, level[, reason]]) - err = makeError(msg, level, true); - } - if (typeof reason !== 'number') - reason = DISCONNECT_REASON.PROTOCOL_ERROR; - protocol.disconnect(reason); - protocol._destruct(); - protocol._onError(err); - return Infinity; - }, - readUInt32BE, - writeUInt32BE, - writeUInt32LE: (buf, value, offset) => { - buf[offset++] = value; - buf[offset++] = (value >>> 8); - buf[offset++] = (value >>> 16); - buf[offset++] = (value >>> 24); - return offset; - }, - makeBufferParser, - bufferParser: makeBufferParser(), - readString: (buffer, start, dest, maxLen) => { - if (typeof dest === 'number') { - maxLen = dest; - dest = undefined; - } - - if (start === undefined) - start = 0; - - const left = (buffer.length - start); - if (start < 0 || start >= buffer.length || left < 4) - return; - - const len = readUInt32BE(buffer, start); - if (left < (4 + len) || (typeof maxLen === 'number' && len > maxLen)) - return; - - start += 4; - const end = start + len; - buffer._pos = end; - - if (dest) { - if (Buffer.isBuffer(dest)) - return bufferCopy(buffer, dest, start, end); - return buffer.utf8Slice(start, end); - } - return bufferSlice(buffer, start, end); - }, - sigSSHToASN1: (sig, type) => { - switch (type) { - case 'ssh-dss': { - if (sig.length > 40) - return sig; - // Change bare signature r and s values to ASN.1 BER values for OpenSSL - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - let r = sig.slice(0, 20); - let s = sig.slice(20); - if (r[0] & 0x80) { - const rNew = Buffer.allocUnsafe(21); - rNew[0] = 0x00; - r.copy(rNew, 1); - r = rNew; - } else if (r[0] === 0x00 && !(r[1] & 0x80)) { - r = r.slice(1); - } - if (s[0] & 0x80) { - const sNew = Buffer.allocUnsafe(21); - sNew[0] = 0x00; - s.copy(sNew, 1); - s = sNew; - } else if (s[0] === 0x00 && !(s[1] & 0x80)) { - s = s.slice(1); - } - asnWriter.writeBuffer(r, Ber.Integer); - asnWriter.writeBuffer(s, Ber.Integer); - asnWriter.endSequence(); - return asnWriter.buffer; - } - case 'ecdsa-sha2-nistp256': - case 'ecdsa-sha2-nistp384': - case 'ecdsa-sha2-nistp521': { - utilBufferParser.init(sig, 0); - const r = utilBufferParser.readString(); - const s = utilBufferParser.readString(); - utilBufferParser.clear(); - if (r === undefined || s === undefined) - return; - - const asnWriter = new Ber.Writer(); - asnWriter.startSequence(); - asnWriter.writeBuffer(r, Ber.Integer); - asnWriter.writeBuffer(s, Ber.Integer); - asnWriter.endSequence(); - return asnWriter.buffer; - } - default: - return sig; - } - }, - convertSignature: (signature, keyType) => { - switch (keyType) { - case 'ssh-dss': { - if (signature.length <= 40) - return signature; - // This is a quick and dirty way to get from BER encoded r and s that - // OpenSSL gives us, to just the bare values back to back (40 bytes - // total) like OpenSSH (and possibly others) are expecting - const asnReader = new Ber.Reader(signature); - asnReader.readSequence(); - let r = asnReader.readString(Ber.Integer, true); - let s = asnReader.readString(Ber.Integer, true); - let rOffset = 0; - let sOffset = 0; - if (r.length < 20) { - const rNew = Buffer.allocUnsafe(20); - rNew.set(r, 1); - r = rNew; - r[0] = 0; - } - if (s.length < 20) { - const sNew = Buffer.allocUnsafe(20); - sNew.set(s, 1); - s = sNew; - s[0] = 0; - } - if (r.length > 20 && r[0] === 0) - rOffset = 1; - if (s.length > 20 && s[0] === 0) - sOffset = 1; - const newSig = - Buffer.allocUnsafe((r.length - rOffset) + (s.length - sOffset)); - bufferCopy(r, newSig, rOffset, r.length, 0); - bufferCopy(s, newSig, sOffset, s.length, r.length - rOffset); - return newSig; - } - case 'ecdsa-sha2-nistp256': - case 'ecdsa-sha2-nistp384': - case 'ecdsa-sha2-nistp521': { - if (signature[0] === 0) - return signature; - // Convert SSH signature parameters to ASN.1 BER values for OpenSSL - const asnReader = new Ber.Reader(signature); - asnReader.readSequence(); - const r = asnReader.readString(Ber.Integer, true); - const s = asnReader.readString(Ber.Integer, true); - if (r === null || s === null) - return; - const newSig = Buffer.allocUnsafe(4 + r.length + 4 + s.length); - writeUInt32BE(newSig, r.length, 0); - newSig.set(r, 4); - writeUInt32BE(newSig, s.length, 4 + r.length); - newSig.set(s, 4 + 4 + r.length); - return newSig; - } - } - - return signature; - }, - sendPacket: (proto, packet, bypass) => { - if (!bypass && proto._kexinit !== undefined) { - // We're currently in the middle of a handshake - - if (proto._queue === undefined) - proto._queue = []; - proto._queue.push(packet); - proto._debug && proto._debug('Outbound: ... packet queued'); - return false; - } - proto._cipher.encrypt(packet); - return true; - }, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/protocol/zlib.js b/reverse_engineering/node_modules/ssh2/lib/protocol/zlib.js deleted file mode 100644 index f68319a1..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/protocol/zlib.js +++ /dev/null @@ -1,255 +0,0 @@ -'use strict'; - -const { kMaxLength } = require('buffer'); -const { - createInflate, - constants: { - DEFLATE, - INFLATE, - Z_DEFAULT_CHUNK, - Z_DEFAULT_COMPRESSION, - Z_DEFAULT_MEMLEVEL, - Z_DEFAULT_STRATEGY, - Z_DEFAULT_WINDOWBITS, - Z_PARTIAL_FLUSH, - } -} = require('zlib'); -const ZlibHandle = createInflate()._handle.constructor; - -function processCallback() { - throw new Error('Should not get here'); -} - -function zlibOnError(message, errno, code) { - const self = this._owner; - // There is no way to cleanly recover. - // Continuing only obscures problems. - - const error = new Error(message); - error.errno = errno; - error.code = code; - self._err = error; -} - -function _close(engine) { - // Caller may invoke .close after a zlib error (which will null _handle). - if (!engine._handle) - return; - - engine._handle.close(); - engine._handle = null; -} - -class Zlib { - constructor(mode) { - const windowBits = Z_DEFAULT_WINDOWBITS; - const level = Z_DEFAULT_COMPRESSION; - const memLevel = Z_DEFAULT_MEMLEVEL; - const strategy = Z_DEFAULT_STRATEGY; - const dictionary = undefined; - - this._err = undefined; - this._writeState = new Uint32Array(2); - this._chunkSize = Z_DEFAULT_CHUNK; - this._maxOutputLength = kMaxLength; - this._outBuffer = Buffer.allocUnsafe(this._chunkSize); - this._outOffset = 0; - - this._handle = new ZlibHandle(mode); - this._handle._owner = this; - this._handle.onerror = zlibOnError; - this._handle.init(windowBits, - level, - memLevel, - strategy, - this._writeState, - processCallback, - dictionary); - } - - writeSync(chunk, retChunks) { - const handle = this._handle; - if (!handle) - throw new Error('Invalid Zlib instance'); - - let availInBefore = chunk.length; - let availOutBefore = this._chunkSize - this._outOffset; - let inOff = 0; - let availOutAfter; - let availInAfter; - - let buffers; - let nread = 0; - const state = this._writeState; - let buffer = this._outBuffer; - let offset = this._outOffset; - const chunkSize = this._chunkSize; - - while (true) { - handle.writeSync(Z_PARTIAL_FLUSH, - chunk, // in - inOff, // in_off - availInBefore, // in_len - buffer, // out - offset, // out_off - availOutBefore); // out_len - if (this._err) - throw this._err; - - availOutAfter = state[0]; - availInAfter = state[1]; - - const inDelta = availInBefore - availInAfter; - const have = availOutBefore - availOutAfter; - - if (have > 0) { - const out = (offset === 0 && have === buffer.length - ? buffer - : buffer.slice(offset, offset + have)); - offset += have; - if (!buffers) - buffers = out; - else if (buffers.push === undefined) - buffers = [buffers, out]; - else - buffers.push(out); - nread += out.byteLength; - - if (nread > this._maxOutputLength) { - _close(this); - throw new Error( - `Output length exceeded maximum of ${this._maxOutputLength}` - ); - } - } else if (have !== 0) { - throw new Error('have should not go down'); - } - - // Exhausted the output buffer, or used all the input create a new one. - if (availOutAfter === 0 || offset >= chunkSize) { - availOutBefore = chunkSize; - offset = 0; - buffer = Buffer.allocUnsafe(chunkSize); - } - - if (availOutAfter === 0) { - // Not actually done. Need to reprocess. - // Also, update the availInBefore to the availInAfter value, - // so that if we have to hit it a third (fourth, etc.) time, - // it'll have the correct byte counts. - inOff += inDelta; - availInBefore = availInAfter; - } else { - break; - } - } - - this._outBuffer = buffer; - this._outOffset = offset; - - if (nread === 0) - buffers = Buffer.alloc(0); - - if (retChunks) { - buffers.totalLen = nread; - return buffers; - } - - if (buffers.push === undefined) - return buffers; - - const output = Buffer.allocUnsafe(nread); - for (let i = 0, p = 0; i < buffers.length; ++i) { - const buf = buffers[i]; - output.set(buf, p); - p += buf.length; - } - return output; - } -} - -class ZlibPacketWriter { - constructor(protocol) { - this.allocStart = 0; - this.allocStartKEX = 0; - this._protocol = protocol; - this._zlib = new Zlib(DEFLATE); - } - - cleanup() { - if (this._zlib) - _close(this._zlib); - } - - alloc(payloadSize, force) { - return Buffer.allocUnsafe(payloadSize); - } - - finalize(payload, force) { - if (this._protocol._kexinit === undefined || force) { - const output = this._zlib.writeSync(payload, true); - const packet = this._protocol._cipher.allocPacket(output.totalLen); - if (output.push === undefined) { - packet.set(output, 5); - } else { - for (let i = 0, p = 5; i < output.length; ++i) { - const chunk = output[i]; - packet.set(chunk, p); - p += chunk.length; - } - } - return packet; - } - return payload; - } -} - -class PacketWriter { - constructor(protocol) { - this.allocStart = 5; - this.allocStartKEX = 5; - this._protocol = protocol; - } - - cleanup() {} - - alloc(payloadSize, force) { - if (this._protocol._kexinit === undefined || force) - return this._protocol._cipher.allocPacket(payloadSize); - return Buffer.allocUnsafe(payloadSize); - } - - finalize(packet, force) { - return packet; - } -} - -class ZlibPacketReader { - constructor() { - this._zlib = new Zlib(INFLATE); - } - - cleanup() { - if (this._zlib) - _close(this._zlib); - } - - read(data) { - return this._zlib.writeSync(data, false); - } -} - -class PacketReader { - cleanup() {} - - read(data) { - return data; - } -} - -module.exports = { - PacketReader, - PacketWriter, - ZlibPacketReader, - ZlibPacketWriter, -}; diff --git a/reverse_engineering/node_modules/ssh2/lib/server.js b/reverse_engineering/node_modules/ssh2/lib/server.js deleted file mode 100644 index 11c15a19..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/server.js +++ /dev/null @@ -1,1363 +0,0 @@ -// TODO: -// * convert listenerCount() usage to emit() return value checking? -// * emit error when connection severed early (e.g. before handshake) -// * add '.connected' or similar property to connection objects to allow -// immediate connection status checking -'use strict'; - -const { Server: netServer } = require('net'); -const EventEmitter = require('events'); -const { listenerCount } = EventEmitter; - -const { - CHANNEL_OPEN_FAILURE, - DEFAULT_CIPHER, - DEFAULT_COMPRESSION, - DEFAULT_KEX, - DEFAULT_MAC, - DEFAULT_SERVER_HOST_KEY, - DISCONNECT_REASON, - DISCONNECT_REASON_BY_VALUE, - SUPPORTED_CIPHER, - SUPPORTED_COMPRESSION, - SUPPORTED_KEX, - SUPPORTED_MAC, - SUPPORTED_SERVER_HOST_KEY, -} = require('./protocol/constants.js'); -const { init: cryptoInit } = require('./protocol/crypto.js'); -const { KexInit } = require('./protocol/kex.js'); -const { parseKey } = require('./protocol/keyParser.js'); -const Protocol = require('./protocol/Protocol.js'); -const { SFTP } = require('./protocol/SFTP.js'); -const { writeUInt32BE } = require('./protocol/utils.js'); - -const { - Channel, - MAX_WINDOW, - PACKET_SIZE, - windowAdjust, - WINDOW_THRESHOLD, -} = require('./Channel.js'); - -const { - ChannelManager, - generateAlgorithmList, - isWritable, - onChannelOpenFailure, - onCHANNEL_CLOSE, -} = require('./utils.js'); - -const MAX_PENDING_AUTHS = 10; - -class AuthContext extends EventEmitter { - constructor(protocol, username, service, method, cb) { - super(); - - this.username = this.user = username; - this.service = service; - this.method = method; - this._initialResponse = false; - this._finalResponse = false; - this._multistep = false; - this._cbfinal = (allowed, methodsLeft, isPartial) => { - if (!this._finalResponse) { - this._finalResponse = true; - cb(this, allowed, methodsLeft, isPartial); - } - }; - this._protocol = protocol; - } - - accept() { - this._cleanup && this._cleanup(); - this._initialResponse = true; - this._cbfinal(true); - } - reject(methodsLeft, isPartial) { - this._cleanup && this._cleanup(); - this._initialResponse = true; - this._cbfinal(false, methodsLeft, isPartial); - } -} - - -class KeyboardAuthContext extends AuthContext { - constructor(protocol, username, service, method, submethods, cb) { - super(protocol, username, service, method, cb); - - this._multistep = true; - - this._cb = undefined; - this._onInfoResponse = (responses) => { - const callback = this._cb; - if (callback) { - this._cb = undefined; - callback(responses); - } - }; - this.submethods = submethods; - this.on('abort', () => { - this._cb && this._cb(new Error('Authentication request aborted')); - }); - } - - prompt(prompts, title, instructions, cb) { - if (!Array.isArray(prompts)) - prompts = [ prompts ]; - - if (typeof title === 'function') { - cb = title; - title = instructions = undefined; - } else if (typeof instructions === 'function') { - cb = instructions; - instructions = undefined; - } else if (typeof cb !== 'function') { - cb = undefined; - } - - for (let i = 0; i < prompts.length; ++i) { - if (typeof prompts[i] === 'string') { - prompts[i] = { - prompt: prompts[i], - echo: true - }; - } - } - - this._cb = cb; - this._initialResponse = true; - - this._protocol.authInfoReq(title, instructions, prompts); - } -} - -class PKAuthContext extends AuthContext { - constructor(protocol, username, service, method, pkInfo, cb) { - super(protocol, username, service, method, cb); - - this.key = { algo: pkInfo.keyAlgo, data: pkInfo.key }; - this.signature = pkInfo.signature; - this.blob = pkInfo.blob; - } - - accept() { - if (!this.signature) { - this._initialResponse = true; - this._protocol.authPKOK(this.key.algo, this.key.data); - } else { - AuthContext.prototype.accept.call(this); - } - } -} - -class HostbasedAuthContext extends AuthContext { - constructor(protocol, username, service, method, pkInfo, cb) { - super(protocol, username, service, method, cb); - - this.key = { algo: pkInfo.keyAlgo, data: pkInfo.key }; - this.signature = pkInfo.signature; - this.blob = pkInfo.blob; - this.localHostname = pkInfo.localHostname; - this.localUsername = pkInfo.localUsername; - } -} - -class PwdAuthContext extends AuthContext { - constructor(protocol, username, service, method, password, cb) { - super(protocol, username, service, method, cb); - - this.password = password; - this._changeCb = undefined; - } - - requestChange(prompt, cb) { - if (this._changeCb) - throw new Error('Change request already in progress'); - if (typeof prompt !== 'string') - throw new Error('prompt argument must be a string'); - if (typeof cb !== 'function') - throw new Error('Callback argument must be a function'); - this._changeCb = cb; - this._protocol.authPasswdChg(prompt); - } -} - - -class Session extends EventEmitter { - constructor(client, info, localChan) { - super(); - - this.type = 'session'; - this.subtype = undefined; - this._ending = false; - this._channel = undefined; - this._chanInfo = { - type: 'session', - incoming: { - id: localChan, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - } -} - - -class Server extends EventEmitter { - constructor(cfg, listener) { - super(); - - if (typeof cfg !== 'object' || cfg === null) - throw new Error('Missing configuration object'); - - const hostKeys = Object.create(null); - const hostKeyAlgoOrder = []; - - const hostKeys_ = cfg.hostKeys; - if (!Array.isArray(hostKeys_)) - throw new Error('hostKeys must be an array'); - - const cfgAlgos = ( - typeof cfg.algorithms === 'object' && cfg.algorithms !== null - ? cfg.algorithms - : {} - ); - - const hostKeyAlgos = generateAlgorithmList( - cfgAlgos.serverHostKey, - DEFAULT_SERVER_HOST_KEY, - SUPPORTED_SERVER_HOST_KEY - ); - for (let i = 0; i < hostKeys_.length; ++i) { - let privateKey; - if (Buffer.isBuffer(hostKeys_[i]) || typeof hostKeys_[i] === 'string') - privateKey = parseKey(hostKeys_[i]); - else - privateKey = parseKey(hostKeys_[i].key, hostKeys_[i].passphrase); - - if (privateKey instanceof Error) - throw new Error(`Cannot parse privateKey: ${privateKey.message}`); - - if (Array.isArray(privateKey)) { - // OpenSSH's newer format only stores 1 key for now - privateKey = privateKey[0]; - } - - if (privateKey.getPrivatePEM() === null) - throw new Error('privateKey value contains an invalid private key'); - - // Discard key if we already found a key of the same type - if (hostKeyAlgoOrder.includes(privateKey.type)) - continue; - - if (privateKey.type === 'ssh-rsa') { - // SSH supports multiple signature hashing algorithms for RSA, so we add - // the algorithms in the desired order - let sha1Pos = hostKeyAlgos.indexOf('ssh-rsa'); - const sha256Pos = hostKeyAlgos.indexOf('rsa-sha2-256'); - const sha512Pos = hostKeyAlgos.indexOf('rsa-sha2-512'); - if (sha1Pos === -1) { - // Fall back to giving SHA1 the lowest priority - sha1Pos = Infinity; - } - [sha1Pos, sha256Pos, sha512Pos].sort(compareNumbers).forEach((pos) => { - if (pos === -1) - return; - - let type; - switch (pos) { - case sha1Pos: type = 'ssh-rsa'; break; - case sha256Pos: type = 'rsa-sha2-256'; break; - case sha512Pos: type = 'rsa-sha2-512'; break; - default: return; - } - - // Store same RSA key under each hash algorithm name for convenience - hostKeys[type] = privateKey; - - hostKeyAlgoOrder.push(type); - }); - } else { - hostKeys[privateKey.type] = privateKey; - hostKeyAlgoOrder.push(privateKey.type); - } - } - - const algorithms = { - kex: generateAlgorithmList(cfgAlgos.kex, DEFAULT_KEX, SUPPORTED_KEX), - serverHostKey: hostKeyAlgoOrder, - cs: { - cipher: generateAlgorithmList( - cfgAlgos.cipher, - DEFAULT_CIPHER, - SUPPORTED_CIPHER - ), - mac: generateAlgorithmList(cfgAlgos.hmac, DEFAULT_MAC, SUPPORTED_MAC), - compress: generateAlgorithmList( - cfgAlgos.compress, - DEFAULT_COMPRESSION, - SUPPORTED_COMPRESSION - ), - lang: [], - }, - sc: undefined, - }; - algorithms.sc = algorithms.cs; - - if (typeof listener === 'function') - this.on('connection', listener); - - const origDebug = (typeof cfg.debug === 'function' ? cfg.debug : undefined); - const ident = (cfg.ident ? Buffer.from(cfg.ident) : undefined); - const offer = new KexInit(algorithms); - - this._srv = new netServer((socket) => { - if (this._connections >= this.maxConnections) { - socket.destroy(); - return; - } - ++this._connections; - socket.once('close', () => { - --this._connections; - }); - - let debug; - if (origDebug) { - // Prepend debug output with a unique identifier in case there are - // multiple clients connected at the same time - const debugPrefix = `[${process.hrtime().join('.')}] `; - debug = (msg) => { - origDebug(`${debugPrefix}${msg}`); - }; - } - - // eslint-disable-next-line no-use-before-define - new Client(socket, hostKeys, ident, offer, debug, this, cfg); - }).on('error', (err) => { - this.emit('error', err); - }).on('listening', () => { - this.emit('listening'); - }).on('close', () => { - this.emit('close'); - }); - this._connections = 0; - this.maxConnections = Infinity; - } - - injectSocket(socket) { - this._srv.emit('connection', socket); - } - - listen(...args) { - this._srv.listen(...args); - return this; - } - - address() { - return this._srv.address(); - } - - getConnections(cb) { - this._srv.getConnections(cb); - return this; - } - - close(cb) { - this._srv.close(cb); - return this; - } - - ref() { - this._srv.ref(); - return this; - } - - unref() { - this._srv.unref(); - return this; - } -} -Server.KEEPALIVE_CLIENT_INTERVAL = 15000; -Server.KEEPALIVE_CLIENT_COUNT_MAX = 3; - - -class Client extends EventEmitter { - constructor(socket, hostKeys, ident, offer, debug, server, srvCfg) { - super(); - - let exchanges = 0; - let acceptedAuthSvc = false; - let pendingAuths = []; - let authCtx; - let kaTimer; - let onPacket; - const unsentGlobalRequestsReplies = []; - this._sock = socket; - this._chanMgr = new ChannelManager(this); - this._debug = debug; - this.noMoreSessions = false; - this.authenticated = false; - - // Silence pre-header errors - function onClientPreHeaderError(err) {} - this.on('error', onClientPreHeaderError); - - const DEBUG_HANDLER = (!debug ? undefined : (p, display, msg) => { - debug(`Debug output from client: ${JSON.stringify(msg)}`); - }); - - const kaIntvl = ( - typeof srvCfg.keepaliveInterval === 'number' - && isFinite(srvCfg.keepaliveInterval) - && srvCfg.keepaliveInterval > 0 - ? srvCfg.keepaliveInterval - : ( - typeof Server.KEEPALIVE_CLIENT_INTERVAL === 'number' - && isFinite(Server.KEEPALIVE_CLIENT_INTERVAL) - && Server.KEEPALIVE_CLIENT_INTERVAL > 0 - ? Server.KEEPALIVE_CLIENT_INTERVAL - : -1 - ) - ); - const kaCountMax = ( - typeof srvCfg.keepaliveCountMax === 'number' - && isFinite(srvCfg.keepaliveCountMax) - && srvCfg.keepaliveCountMax >= 0 - ? srvCfg.keepaliveCountMax - : ( - typeof Server.KEEPALIVE_CLIENT_COUNT_MAX === 'number' - && isFinite(Server.KEEPALIVE_CLIENT_COUNT_MAX) - && Server.KEEPALIVE_CLIENT_COUNT_MAX >= 0 - ? Server.KEEPALIVE_CLIENT_COUNT_MAX - : -1 - ) - ); - let kaCurCount = 0; - if (kaIntvl !== -1 && kaCountMax !== -1) { - this.once('ready', () => { - const onClose = () => { - clearInterval(kaTimer); - }; - this.on('close', onClose).on('end', onClose); - kaTimer = setInterval(() => { - if (++kaCurCount > kaCountMax) { - clearInterval(kaTimer); - const err = new Error('Keepalive timeout'); - err.level = 'client-timeout'; - this.emit('error', err); - this.end(); - } else { - // XXX: if the server ever starts sending real global requests to - // the client, we will need to add a dummy callback here to - // keep the correct reply order - proto.ping(); - } - }, kaIntvl); - }); - // TODO: re-verify keepalive behavior with OpenSSH - onPacket = () => { - kaTimer && kaTimer.refresh(); - kaCurCount = 0; - }; - } - - const proto = this._protocol = new Protocol({ - server: true, - hostKeys, - ident, - offer, - onPacket, - greeting: srvCfg.greeting, - banner: srvCfg.banner, - onWrite: (data) => { - if (isWritable(socket)) - socket.write(data); - }, - onError: (err) => { - if (!proto._destruct) - socket.removeAllListeners('data'); - this.emit('error', err); - try { - socket.end(); - } catch {} - }, - onHeader: (header) => { - this.removeListener('error', onClientPreHeaderError); - - const info = { - ip: socket.remoteAddress, - family: socket.remoteFamily, - port: socket.remotePort, - header, - }; - if (!server.emit('connection', this, info)) { - // auto reject - proto.disconnect(DISCONNECT_REASON.BY_APPLICATION); - socket.end(); - return; - } - - if (header.greeting) - this.emit('greeting', header.greeting); - }, - onHandshakeComplete: (negotiated) => { - if (++exchanges > 1) - this.emit('rekey'); - this.emit('handshake', negotiated); - }, - debug, - messageHandlers: { - DEBUG: DEBUG_HANDLER, - DISCONNECT: (p, reason, desc) => { - if (reason !== DISCONNECT_REASON.BY_APPLICATION) { - if (!desc) { - desc = DISCONNECT_REASON_BY_VALUE[reason]; - if (desc === undefined) - desc = `Unexpected disconnection reason: ${reason}`; - } - const err = new Error(desc); - err.code = reason; - this.emit('error', err); - } - socket.end(); - }, - CHANNEL_OPEN: (p, info) => { - // Handle incoming requests from client - - // Do early reject in some cases to prevent wasteful channel - // allocation - if ((info.type === 'session' && this.noMoreSessions) - || !this.authenticated) { - const reasonCode = CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED; - return proto.channelOpenFail(info.sender, reasonCode); - } - - let localChan = -1; - let reason; - let replied = false; - - let accept; - const reject = () => { - if (replied) - return; - replied = true; - - if (reason === undefined) { - if (localChan === -1) - reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; - else - reason = CHANNEL_OPEN_FAILURE.CONNECT_FAILED; - } - - proto.channelOpenFail(info.sender, reason, ''); - }; - const reserveChannel = () => { - localChan = this._chanMgr.add(); - - if (localChan === -1) { - reason = CHANNEL_OPEN_FAILURE.RESOURCE_SHORTAGE; - if (debug) { - debug('Automatic rejection of incoming channel open: ' - + 'no channels available'); - } - } - - return (localChan !== -1); - }; - - const data = info.data; - switch (info.type) { - case 'session': - if (listenerCount(this, 'session') && reserveChannel()) { - accept = () => { - if (replied) - return; - replied = true; - - const instance = new Session(this, info, localChan); - this._chanMgr.update(localChan, instance); - - proto.channelOpenConfirm(info.sender, - localChan, - MAX_WINDOW, - PACKET_SIZE); - - return instance; - }; - - this.emit('session', accept, reject); - return; - } - break; - case 'direct-tcpip': - if (listenerCount(this, 'tcpip') && reserveChannel()) { - accept = () => { - if (replied) - return; - replied = true; - - const chanInfo = { - type: undefined, - incoming: { - id: localChan, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - - const stream = new Channel(this, chanInfo, { server: true }); - this._chanMgr.update(localChan, stream); - - proto.channelOpenConfirm(info.sender, - localChan, - MAX_WINDOW, - PACKET_SIZE); - - return stream; - }; - - this.emit('tcpip', accept, reject, data); - return; - } - break; - case 'direct-streamlocal@openssh.com': - if (listenerCount(this, 'openssh.streamlocal') - && reserveChannel()) { - accept = () => { - if (replied) - return; - replied = true; - - const chanInfo = { - type: undefined, - incoming: { - id: localChan, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - - const stream = new Channel(this, chanInfo, { server: true }); - this._chanMgr.update(localChan, stream); - - proto.channelOpenConfirm(info.sender, - localChan, - MAX_WINDOW, - PACKET_SIZE); - - return stream; - }; - - this.emit('openssh.streamlocal', accept, reject, data); - return; - } - break; - default: - // Automatically reject any unsupported channel open requests - reason = CHANNEL_OPEN_FAILURE.UNKNOWN_CHANNEL_TYPE; - if (debug) { - debug('Automatic rejection of unsupported incoming channel open' - + ` type: ${info.type}`); - } - } - - if (reason === undefined) { - reason = CHANNEL_OPEN_FAILURE.ADMINISTRATIVELY_PROHIBITED; - if (debug) { - debug('Automatic rejection of unexpected incoming channel open' - + ` for: ${info.type}`); - } - } - - reject(); - }, - CHANNEL_OPEN_CONFIRMATION: (p, info) => { - const channel = this._chanMgr.get(info.recipient); - if (typeof channel !== 'function') - return; - - const chanInfo = { - type: channel.type, - incoming: { - id: info.recipient, - window: MAX_WINDOW, - packetSize: PACKET_SIZE, - state: 'open' - }, - outgoing: { - id: info.sender, - window: info.window, - packetSize: info.packetSize, - state: 'open' - } - }; - - const instance = new Channel(this, chanInfo, { server: true }); - this._chanMgr.update(info.recipient, instance); - channel(undefined, instance); - }, - CHANNEL_OPEN_FAILURE: (p, recipient, reason, description) => { - const channel = this._chanMgr.get(recipient); - if (typeof channel !== 'function') - return; - - const info = { reason, description }; - onChannelOpenFailure(this, recipient, info, channel); - }, - CHANNEL_DATA: (p, recipient, data) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - channel = channel._channel; - if (!channel) - return; - } - - // The remote party should not be sending us data if there is no - // window space available ... - // TODO: raise error on data with not enough window? - if (channel.incoming.window === 0) - return; - - channel.incoming.window -= data.length; - - if (channel.push(data) === false) { - channel._waitChanDrain = true; - return; - } - - if (channel.incoming.window <= WINDOW_THRESHOLD) - windowAdjust(channel); - }, - CHANNEL_EXTENDED_DATA: (p, recipient, data, type) => { - // NOOP -- should not be sent by client - }, - CHANNEL_WINDOW_ADJUST: (p, recipient, amount) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - channel = channel._channel; - if (!channel) - return; - } - - // The other side is allowing us to send `amount` more bytes of data - channel.outgoing.window += amount; - - if (channel._waitWindow) { - channel._waitWindow = false; - - if (channel._chunk) { - channel._write(channel._chunk, null, channel._chunkcb); - } else if (channel._chunkcb) { - channel._chunkcb(); - } else if (channel._chunkErr) { - channel.stderr._write(channel._chunkErr, - null, - channel._chunkcbErr); - } else if (channel._chunkcbErr) { - channel._chunkcbErr(); - } - } - }, - CHANNEL_SUCCESS: (p, recipient) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - channel = channel._channel; - if (!channel) - return; - } - - if (channel._callbacks.length) - channel._callbacks.shift()(false); - }, - CHANNEL_FAILURE: (p, recipient) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - channel = channel._channel; - if (!channel) - return; - } - - if (channel._callbacks.length) - channel._callbacks.shift()(true); - }, - CHANNEL_REQUEST: (p, recipient, type, wantReply, data) => { - const session = this._chanMgr.get(recipient); - if (typeof session !== 'object' || session === null) - return; - - let replied = false; - let accept; - let reject; - - if (session.constructor !== Session) { - // normal Channel instance - if (wantReply) - proto.channelFailure(session.outgoing.id); - return; - } - - if (wantReply) { - // "real session" requests will have custom accept behaviors - if (type !== 'shell' - && type !== 'exec' - && type !== 'subsystem') { - accept = () => { - if (replied || session._ending || session._channel) - return; - replied = true; - - proto.channelSuccess(session._chanInfo.outgoing.id); - }; - } - - reject = () => { - if (replied || session._ending || session._channel) - return; - replied = true; - - proto.channelFailure(session._chanInfo.outgoing.id); - }; - } - - if (session._ending) { - reject && reject(); - return; - } - - switch (type) { - // "pre-real session start" requests - case 'env': - if (listenerCount(session, 'env')) { - session.emit('env', accept, reject, { - key: data.name, - val: data.value - }); - return; - } - break; - case 'pty-req': - if (listenerCount(session, 'pty')) { - session.emit('pty', accept, reject, data); - return; - } - break; - case 'window-change': - if (listenerCount(session, 'window-change')) - session.emit('window-change', accept, reject, data); - else - reject && reject(); - break; - case 'x11-req': - if (listenerCount(session, 'x11')) { - session.emit('x11', accept, reject, data); - return; - } - break; - // "post-real session start" requests - case 'signal': - if (listenerCount(session, 'signal')) { - session.emit('signal', accept, reject, { - name: data - }); - return; - } - break; - // XXX: is `auth-agent-req@openssh.com` really "post-real session - // start"? - case 'auth-agent-req@openssh.com': - if (listenerCount(session, 'auth-agent')) { - session.emit('auth-agent', accept, reject); - return; - } - break; - // "real session start" requests - case 'shell': - if (listenerCount(session, 'shell')) { - accept = () => { - if (replied || session._ending || session._channel) - return; - replied = true; - - if (wantReply) - proto.channelSuccess(session._chanInfo.outgoing.id); - - const channel = new Channel( - this, session._chanInfo, { server: true } - ); - - channel.subtype = session.subtype = type; - session._channel = channel; - - return channel; - }; - - session.emit('shell', accept, reject); - return; - } - break; - case 'exec': - if (listenerCount(session, 'exec')) { - accept = () => { - if (replied || session._ending || session._channel) - return; - replied = true; - - if (wantReply) - proto.channelSuccess(session._chanInfo.outgoing.id); - - const channel = new Channel( - this, session._chanInfo, { server: true } - ); - - channel.subtype = session.subtype = type; - session._channel = channel; - - return channel; - }; - - session.emit('exec', accept, reject, { - command: data - }); - return; - } - break; - case 'subsystem': { - let useSFTP = (data === 'sftp'); - accept = () => { - if (replied || session._ending || session._channel) - return; - replied = true; - - if (wantReply) - proto.channelSuccess(session._chanInfo.outgoing.id); - - let instance; - if (useSFTP) { - instance = new SFTP(this, session._chanInfo, { - server: true, - debug, - }); - } else { - instance = new Channel( - this, session._chanInfo, { server: true } - ); - instance.subtype = - session.subtype = `${type}:${data}`; - } - session._channel = instance; - - return instance; - }; - - if (data === 'sftp') { - if (listenerCount(session, 'sftp')) { - session.emit('sftp', accept, reject); - return; - } - useSFTP = false; - } - if (listenerCount(session, 'subsystem')) { - session.emit('subsystem', accept, reject, { - name: data - }); - return; - } - break; - } - } - debug && debug( - `Automatic rejection of incoming channel request: ${type}` - ); - reject && reject(); - }, - CHANNEL_EOF: (p, recipient) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - if (!channel._ending) { - channel._ending = true; - channel.emit('eof'); - channel.emit('end'); - } - channel = channel._channel; - if (!channel) - return; - } - - if (channel.incoming.state !== 'open') - return; - channel.incoming.state = 'eof'; - - if (channel.readable) - channel.push(null); - }, - CHANNEL_CLOSE: (p, recipient) => { - let channel = this._chanMgr.get(recipient); - if (typeof channel !== 'object' || channel === null) - return; - - if (channel.constructor === Session) { - channel._ending = true; - channel.emit('close'); - channel = channel._channel; - if (!channel) - return; - } - - onCHANNEL_CLOSE(this, recipient, channel); - }, - // Begin service/auth-related ========================================== - SERVICE_REQUEST: (p, service) => { - if (exchanges === 0 - || acceptedAuthSvc - || this.authenticated - || service !== 'ssh-userauth') { - proto.disconnect(DISCONNECT_REASON.SERVICE_NOT_AVAILABLE); - socket.end(); - return; - } - - acceptedAuthSvc = true; - proto.serviceAccept(service); - }, - USERAUTH_REQUEST: (p, username, service, method, methodData) => { - if (exchanges === 0 - || this.authenticated - || (authCtx - && (authCtx.username !== username - || authCtx.service !== service)) - // TODO: support hostbased auth - || (method !== 'password' - && method !== 'publickey' - && method !== 'hostbased' - && method !== 'keyboard-interactive' - && method !== 'none') - || pendingAuths.length === MAX_PENDING_AUTHS) { - proto.disconnect(DISCONNECT_REASON.PROTOCOL_ERROR); - socket.end(); - return; - } else if (service !== 'ssh-connection') { - proto.disconnect(DISCONNECT_REASON.SERVICE_NOT_AVAILABLE); - socket.end(); - return; - } - - let ctx; - switch (method) { - case 'keyboard-interactive': - ctx = new KeyboardAuthContext(proto, username, service, method, - methodData, onAuthDecide); - break; - case 'publickey': - ctx = new PKAuthContext(proto, username, service, method, - methodData, onAuthDecide); - break; - case 'hostbased': - ctx = new HostbasedAuthContext(proto, username, service, method, - methodData, onAuthDecide); - break; - case 'password': - if (authCtx - && authCtx instanceof PwdAuthContext - && authCtx._changeCb) { - const cb = authCtx._changeCb; - authCtx._changeCb = undefined; - cb(methodData.newPassword); - return; - } - ctx = new PwdAuthContext(proto, username, service, method, - methodData, onAuthDecide); - break; - case 'none': - ctx = new AuthContext(proto, username, service, method, - onAuthDecide); - break; - } - - if (authCtx) { - if (!authCtx._initialResponse) { - return pendingAuths.push(ctx); - } else if (authCtx._multistep && !authCtx._finalResponse) { - // RFC 4252 says to silently abort the current auth request if a - // new auth request comes in before the final response from an - // auth method that requires additional request/response exchanges - // -- this means keyboard-interactive for now ... - authCtx._cleanup && authCtx._cleanup(); - authCtx.emit('abort'); - } - } - - authCtx = ctx; - - if (listenerCount(this, 'authentication')) - this.emit('authentication', authCtx); - else - authCtx.reject(); - }, - USERAUTH_INFO_RESPONSE: (p, responses) => { - if (authCtx && authCtx instanceof KeyboardAuthContext) - authCtx._onInfoResponse(responses); - }, - // End service/auth-related ============================================ - GLOBAL_REQUEST: (p, name, wantReply, data) => { - const reply = { - type: null, - buf: null - }; - - function setReply(type, buf) { - reply.type = type; - reply.buf = buf; - sendReplies(); - } - - if (wantReply) - unsentGlobalRequestsReplies.push(reply); - - if ((name === 'tcpip-forward' - || name === 'cancel-tcpip-forward' - || name === 'no-more-sessions@openssh.com' - || name === 'streamlocal-forward@openssh.com' - || name === 'cancel-streamlocal-forward@openssh.com') - && listenerCount(this, 'request') - && this.authenticated) { - let accept; - let reject; - - if (wantReply) { - let replied = false; - accept = (chosenPort) => { - if (replied) - return; - replied = true; - let bufPort; - if (name === 'tcpip-forward' - && data.bindPort === 0 - && typeof chosenPort === 'number') { - bufPort = Buffer.allocUnsafe(4); - writeUInt32BE(bufPort, chosenPort, 0); - } - setReply('SUCCESS', bufPort); - }; - reject = () => { - if (replied) - return; - replied = true; - setReply('FAILURE'); - }; - } - - if (name === 'no-more-sessions@openssh.com') { - this.noMoreSessions = true; - accept && accept(); - return; - } - - this.emit('request', accept, reject, name, data); - } else if (wantReply) { - setReply('FAILURE'); - } - }, - }, - }); - - socket.pause(); - cryptoInit.then(() => { - socket.on('data', (data) => { - try { - proto.parse(data, 0, data.length); - } catch (ex) { - this.emit('error', ex); - try { - if (isWritable(socket)) - socket.end(); - } catch {} - } - }); - socket.resume(); - }).catch((err) => { - this.emit('error', err); - try { - if (isWritable(socket)) - socket.end(); - } catch {} - }); - socket.on('error', (err) => { - err.level = 'socket'; - this.emit('error', err); - }).once('end', () => { - debug && debug('Socket ended'); - proto.cleanup(); - this.emit('end'); - }).once('close', () => { - debug && debug('Socket closed'); - proto.cleanup(); - this.emit('close'); - - const err = new Error('No response from server'); - - // Simulate error for pending channels and close any open channels - this._chanMgr.cleanup(err); - }); - - const onAuthDecide = (ctx, allowed, methodsLeft, isPartial) => { - if (authCtx === ctx && !this.authenticated) { - if (allowed) { - authCtx = undefined; - this.authenticated = true; - proto.authSuccess(); - pendingAuths = []; - this.emit('ready'); - } else { - proto.authFailure(methodsLeft, isPartial); - if (pendingAuths.length) { - authCtx = pendingAuths.pop(); - if (listenerCount(this, 'authentication')) - this.emit('authentication', authCtx); - else - authCtx.reject(); - } - } - } - }; - - function sendReplies() { - while (unsentGlobalRequestsReplies.length > 0 - && unsentGlobalRequestsReplies[0].type) { - const reply = unsentGlobalRequestsReplies.shift(); - if (reply.type === 'SUCCESS') - proto.requestSuccess(reply.buf); - if (reply.type === 'FAILURE') - proto.requestFailure(); - } - } - } - - end() { - if (this._sock && isWritable(this._sock)) { - this._protocol.disconnect(DISCONNECT_REASON.BY_APPLICATION); - this._sock.end(); - } - return this; - } - - x11(originAddr, originPort, cb) { - const opts = { originAddr, originPort }; - openChannel(this, 'x11', opts, cb); - return this; - } - - forwardOut(boundAddr, boundPort, remoteAddr, remotePort, cb) { - const opts = { boundAddr, boundPort, remoteAddr, remotePort }; - openChannel(this, 'forwarded-tcpip', opts, cb); - return this; - } - - openssh_forwardOutStreamLocal(socketPath, cb) { - const opts = { socketPath }; - openChannel(this, 'forwarded-streamlocal@openssh.com', opts, cb); - return this; - } - - rekey(cb) { - let error; - - try { - this._protocol.rekey(); - } catch (ex) { - error = ex; - } - - // TODO: re-throw error if no callback? - - if (typeof cb === 'function') { - if (error) - process.nextTick(cb, error); - else - this.once('rekey', cb); - } - } -} - - -function openChannel(self, type, opts, cb) { - // Ask the client to open a channel for some purpose (e.g. a forwarded TCP - // connection) - const initWindow = MAX_WINDOW; - const maxPacket = PACKET_SIZE; - - if (typeof opts === 'function') { - cb = opts; - opts = {}; - } - - const wrapper = (err, stream) => { - cb(err, stream); - }; - wrapper.type = type; - - const localChan = self._chanMgr.add(wrapper); - - if (localChan === -1) { - cb(new Error('No free channels available')); - return; - } - - switch (type) { - case 'forwarded-tcpip': - self._protocol.forwardedTcpip(localChan, initWindow, maxPacket, opts); - break; - case 'x11': - self._protocol.x11(localChan, initWindow, maxPacket, opts); - break; - case 'forwarded-streamlocal@openssh.com': - self._protocol.openssh_forwardedStreamLocal( - localChan, initWindow, maxPacket, opts - ); - break; - default: - throw new Error(`Unsupported channel type: ${type}`); - } -} - -function compareNumbers(a, b) { - return a - b; -} - -module.exports = Server; -module.exports.IncomingClient = Client; diff --git a/reverse_engineering/node_modules/ssh2/lib/utils.js b/reverse_engineering/node_modules/ssh2/lib/utils.js deleted file mode 100644 index 04d4b96d..00000000 --- a/reverse_engineering/node_modules/ssh2/lib/utils.js +++ /dev/null @@ -1,332 +0,0 @@ -'use strict'; - -const { SFTP } = require('./protocol/SFTP.js'); - -const MAX_CHANNEL = 2 ** 32 - 1; - -function onChannelOpenFailure(self, recipient, info, cb) { - self._chanMgr.remove(recipient); - if (typeof cb !== 'function') - return; - - let err; - if (info instanceof Error) { - err = info; - } else if (typeof info === 'object' && info !== null) { - err = new Error(`(SSH) Channel open failure: ${info.description}`); - err.reason = info.reason; - } else { - err = new Error( - '(SSH) Channel open failure: server closed channel unexpectedly' - ); - err.reason = ''; - } - - cb(err); -} - -function onCHANNEL_CLOSE(self, recipient, channel, err, dead) { - if (typeof channel === 'function') { - // We got CHANNEL_CLOSE instead of CHANNEL_OPEN_FAILURE when - // requesting to open a channel - onChannelOpenFailure(self, recipient, err, channel); - return; - } - if (typeof channel !== 'object' - || channel === null - || channel.incoming.state === 'closed') { - return; - } - - channel.incoming.state = 'closed'; - - if (channel.readable) - channel.push(null); - if (channel.server) { - if (channel.stderr.writable) - channel.stderr.end(); - } else if (channel.stderr.readable) { - channel.stderr.push(null); - } - - if (channel.constructor !== SFTP - && (channel.outgoing.state === 'open' - || channel.outgoing.state === 'eof') - && !dead) { - channel.close(); - } - if (channel.outgoing.state === 'closing') - channel.outgoing.state = 'closed'; - - self._chanMgr.remove(recipient); - - const readState = channel._readableState; - const writeState = channel._writableState; - if (writeState && !writeState.ending && !writeState.finished && !dead) - channel.end(); - - // Take care of any outstanding channel requests - const chanCallbacks = channel._callbacks; - channel._callbacks = []; - for (let i = 0; i < chanCallbacks.length; ++i) - chanCallbacks[i](true); - - if (channel.server) { - if (!channel.readable - || channel.destroyed - || (readState && readState.endEmitted)) { - channel.emit('close'); - } else { - channel.once('end', () => channel.emit('close')); - } - } else { - let doClose; - switch (channel.type) { - case 'direct-streamlocal@openssh.com': - case 'direct-tcpip': - doClose = () => channel.emit('close'); - break; - default: { - // Align more with node child processes, where the close event gets - // the same arguments as the exit event - const exit = channel._exit; - doClose = () => { - if (exit.code === null) - channel.emit('close', exit.code, exit.signal, exit.dump, exit.desc); - else - channel.emit('close', exit.code); - }; - } - } - if (!channel.readable - || channel.destroyed - || (readState && readState.endEmitted)) { - doClose(); - } else { - channel.once('end', doClose); - } - - const errReadState = channel.stderr._readableState; - if (!channel.stderr.readable - || channel.stderr.destroyed - || (errReadState && errReadState.endEmitted)) { - channel.stderr.emit('close'); - } else { - channel.stderr.once('end', () => channel.stderr.emit('close')); - } - } -} - -class ChannelManager { - constructor(client) { - this._client = client; - this._channels = {}; - this._cur = -1; - this._count = 0; - } - add(val) { - // Attempt to reserve an id - - let id; - // Optimized paths - if (this._cur < MAX_CHANNEL) { - id = ++this._cur; - } else if (this._count === 0) { - // Revert and reset back to fast path once we no longer have any channels - // open - this._cur = 0; - id = 0; - } else { - // Slower lookup path - - // This path is triggered we have opened at least MAX_CHANNEL channels - // while having at least one channel open at any given time, so we have - // to search for a free id. - const channels = this._channels; - for (let i = 0; i < MAX_CHANNEL; ++i) { - if (channels[i] === undefined) { - id = i; - break; - } - } - } - - if (id === undefined) - return -1; - - this._channels[id] = (val || true); - ++this._count; - - return id; - } - update(id, val) { - if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id)) - throw new Error(`Invalid channel id: ${id}`); - - if (val && this._channels[id]) - this._channels[id] = val; - } - get(id) { - if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id)) - throw new Error(`Invalid channel id: ${id}`); - - return this._channels[id]; - } - remove(id) { - if (typeof id !== 'number' || id < 0 || id >= MAX_CHANNEL || !isFinite(id)) - throw new Error(`Invalid channel id: ${id}`); - - if (this._channels[id]) { - delete this._channels[id]; - if (this._count) - --this._count; - } - } - cleanup(err) { - const channels = this._channels; - this._channels = {}; - this._cur = -1; - this._count = 0; - - const chanIDs = Object.keys(channels); - const client = this._client; - for (let i = 0; i < chanIDs.length; ++i) { - const id = +chanIDs[i]; - const channel = channels[id]; - onCHANNEL_CLOSE(client, id, channel._channel || channel, err, true); - } - } -} - -const isRegExp = (() => { - const toString = Object.prototype.toString; - return (val) => toString.call(val) === '[object RegExp]'; -})(); - -function generateAlgorithmList(algoList, defaultList, supportedList) { - if (Array.isArray(algoList) && algoList.length > 0) { - // Exact list - for (let i = 0; i < algoList.length; ++i) { - if (supportedList.indexOf(algoList[i]) === -1) - throw new Error(`Unsupported algorithm: ${algoList[i]}`); - } - return algoList; - } - - if (typeof algoList === 'object' && algoList !== null) { - // Operations based on the default list - const keys = Object.keys(algoList); - let list = defaultList; - for (let i = 0; i < keys.length; ++i) { - const key = keys[i]; - let val = algoList[key]; - switch (key) { - case 'append': - if (!Array.isArray(val)) - val = [val]; - if (Array.isArray(val)) { - for (let j = 0; j < val.length; ++j) { - const append = val[j]; - if (typeof append === 'string') { - if (!append || list.indexOf(append) !== -1) - continue; - if (supportedList.indexOf(append) === -1) - throw new Error(`Unsupported algorithm: ${append}`); - if (list === defaultList) - list = list.slice(); - list.push(append); - } else if (isRegExp(append)) { - for (let k = 0; k < supportedList.length; ++k) { - const algo = supportedList[k]; - if (append.test(algo)) { - if (list.indexOf(algo) !== -1) - continue; - if (list === defaultList) - list = list.slice(); - list.push(algo); - } - } - } - } - } - break; - case 'prepend': - if (!Array.isArray(val)) - val = [val]; - if (Array.isArray(val)) { - for (let j = val.length; j >= 0; --j) { - const prepend = val[j]; - if (typeof prepend === 'string') { - if (!prepend || list.indexOf(prepend) !== -1) - continue; - if (supportedList.indexOf(prepend) === -1) - throw new Error(`Unsupported algorithm: ${prepend}`); - if (list === defaultList) - list = list.slice(); - list.unshift(prepend); - } else if (isRegExp(prepend)) { - for (let k = supportedList.length; k >= 0; --k) { - const algo = supportedList[k]; - if (prepend.test(algo)) { - if (list.indexOf(algo) !== -1) - continue; - if (list === defaultList) - list = list.slice(); - list.unshift(algo); - } - } - } - } - } - break; - case 'remove': - if (!Array.isArray(val)) - val = [val]; - if (Array.isArray(val)) { - for (let j = 0; j < val.length; ++j) { - const search = val[j]; - if (typeof search === 'string') { - if (!search) - continue; - const idx = list.indexOf(search); - if (idx === -1) - continue; - if (list === defaultList) - list = list.slice(); - list.splice(idx, 1); - } else if (isRegExp(search)) { - for (let k = 0; k < list.length; ++k) { - if (search.test(list[k])) { - if (list === defaultList) - list = list.slice(); - list.splice(k, 1); - --k; - } - } - } - } - } - break; - } - } - - return list; - } - - return defaultList; -} - -module.exports = { - ChannelManager, - generateAlgorithmList, - onChannelOpenFailure, - onCHANNEL_CLOSE, - isWritable: (stream) => { - // XXX: hack to workaround regression in node - // See: https://github.com/nodejs/node/issues/36029 - return (stream - && stream.writable - && stream._readableState - && stream._readableState.ended === false); - }, -}; diff --git a/reverse_engineering/node_modules/ssh2/package.json b/reverse_engineering/node_modules/ssh2/package.json deleted file mode 100644 index 1fd1f7ed..00000000 --- a/reverse_engineering/node_modules/ssh2/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "ssh2", - "version": "1.4.0", - "author": "Brian White ", - "description": "SSH2 client and server modules written in pure JavaScript for node.js", - "main": "./lib/index.js", - "engines": { - "node": ">=10.16.0" - }, - "dependencies": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2" - }, - "devDependencies": { - "@mscdex/eslint-config": "^1.0.0", - "eslint": "^7.0.0" - }, - "optionalDependencies": { - "cpu-features": "0.0.2", - "nan": "^2.15.0" - }, - "scripts": { - "install": "node install.js", - "rebuild": "node install.js", - "test": "node test/test.js", - "lint": "eslint --cache --report-unused-disable-directives --ext=.js .eslintrc.js examples lib test", - "lint:fix": "npm run lint -- --fix" - }, - "keywords": [ - "ssh", - "ssh2", - "sftp", - "secure", - "shell", - "exec", - "remote", - "client" - ], - "licenses": [ - { - "type": "MIT", - "url": "http://github.com/mscdex/ssh2/raw/master/LICENSE" - } - ], - "repository": { - "type": "git", - "url": "http://github.com/mscdex/ssh2.git" - } -} diff --git a/reverse_engineering/node_modules/ssh2/test/common.js b/reverse_engineering/node_modules/ssh2/test/common.js deleted file mode 100644 index a5319244..00000000 --- a/reverse_engineering/node_modules/ssh2/test/common.js +++ /dev/null @@ -1,316 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { readFileSync } = require('fs'); -const { join } = require('path'); -const { inspect } = require('util'); - -const Client = require('../lib/client.js'); -const Server = require('../lib/server.js'); -const { parseKey } = require('../lib/protocol/keyParser.js'); - -const mustCallChecks = []; - -const DEFAULT_TEST_TIMEOUT = 30 * 1000; - -function noop() {} - -function runCallChecks(exitCode) { - if (exitCode !== 0) return; - - const failed = mustCallChecks.filter((context) => { - if ('minimum' in context) { - context.messageSegment = `at least ${context.minimum}`; - return context.actual < context.minimum; - } - context.messageSegment = `exactly ${context.exact}`; - return context.actual !== context.exact; - }); - - failed.forEach((context) => { - console.error('Mismatched %s function calls. Expected %s, actual %d.', - context.name, - context.messageSegment, - context.actual); - console.error(context.stack.split('\n').slice(2).join('\n')); - }); - - if (failed.length) - process.exit(1); -} - -function mustCall(fn, exact) { - return _mustCallInner(fn, exact, 'exact'); -} - -function mustCallAtLeast(fn, minimum) { - return _mustCallInner(fn, minimum, 'minimum'); -} - -function _mustCallInner(fn, criteria = 1, field) { - if (process._exiting) - throw new Error('Cannot use common.mustCall*() in process exit handler'); - - if (typeof fn === 'number') { - criteria = fn; - fn = noop; - } else if (fn === undefined) { - fn = noop; - } - - if (typeof criteria !== 'number') - throw new TypeError(`Invalid ${field} value: ${criteria}`); - - const context = { - [field]: criteria, - actual: 0, - stack: inspect(new Error()), - name: fn.name || '' - }; - - // Add the exit listener only once to avoid listener leak warnings - if (mustCallChecks.length === 0) - process.on('exit', runCallChecks); - - mustCallChecks.push(context); - - function wrapped(...args) { - ++context.actual; - return fn.call(this, ...args); - } - // TODO: remove origFn? - wrapped.origFn = fn; - - return wrapped; -} - -function getCallSite(top) { - const originalStackFormatter = Error.prepareStackTrace; - Error.prepareStackTrace = (err, stack) => - `${stack[0].getFileName()}:${stack[0].getLineNumber()}`; - const err = new Error(); - Error.captureStackTrace(err, top); - // With the V8 Error API, the stack is not formatted until it is accessed - // eslint-disable-next-line no-unused-expressions - err.stack; - Error.prepareStackTrace = originalStackFormatter; - return err.stack; -} - -function mustNotCall(msg) { - const callSite = getCallSite(mustNotCall); - return function mustNotCall(...args) { - args = args.map(inspect).join(', '); - const argsInfo = (args.length > 0 - ? `\ncalled with arguments: ${args}` - : ''); - assert.fail( - `${msg || 'function should not have been called'} at ${callSite}` - + argsInfo); - }; -} - -function setup(title, configs) { - const { - client: clientCfg_, - server: serverCfg_, - allReady: allReady_, - timeout: timeout_, - debug, - noForceClientReady, - noForceServerReady, - noClientError, - noServerError, - } = configs; - - // Make shallow copies of client/server configs to avoid mutating them when - // multiple tests share the same config object reference - let clientCfg; - if (clientCfg_) - clientCfg = { ...clientCfg_ }; - let serverCfg; - if (serverCfg_) - serverCfg = { ...serverCfg_ }; - - let clientClose = false; - let clientReady = false; - let serverClose = false; - let serverReady = false; - const msg = (text) => { - return `${title}: ${text}`; - }; - - const timeout = (typeof timeout_ === 'number' - ? timeout_ - : DEFAULT_TEST_TIMEOUT); - - const allReady = (typeof allReady_ === 'function' ? allReady_ : undefined); - - if (debug) { - if (clientCfg) { - clientCfg.debug = (...args) => { - console.log(`[${title}][CLIENT]`, ...args); - }; - } - if (serverCfg) { - serverCfg.debug = (...args) => { - console.log(`[${title}][SERVER]`, ...args); - }; - } - } - - let timer; - let client; - let clientReadyFn; - let server; - let serverReadyFn; - if (clientCfg) { - client = new Client(); - if (!noClientError) - client.on('error', onError); - clientReadyFn = (noForceClientReady ? onReady : mustCall(onReady)); - client.on('ready', clientReadyFn) - .on('close', mustCall(onClose)); - } else { - clientReady = clientClose = true; - } - - if (serverCfg) { - server = new Server(serverCfg); - if (!noServerError) - server.on('error', onError); - serverReadyFn = (noForceServerReady ? onReady : mustCall(onReady)); - server.on('connection', mustCall((conn) => { - if (!noServerError) - conn.on('error', onError); - conn.on('ready', serverReadyFn); - server.close(); - })).on('close', mustCall(onClose)); - } else { - serverReady = serverClose = true; - } - - function onError(err) { - const which = (this === client ? 'client' : 'server'); - assert(false, msg(`Unexpected ${which} error: ${err.stack}\n`)); - } - - function onReady() { - if (this === client) { - assert(!clientReady, - msg('Received multiple ready events for client')); - clientReady = true; - } else { - assert(!serverReady, - msg('Received multiple ready events for server')); - serverReady = true; - } - clientReady && serverReady && allReady && allReady(); - } - - function onClose() { - if (this === client) { - assert(!clientClose, - msg('Received multiple close events for client')); - clientClose = true; - } else { - assert(!serverClose, - msg('Received multiple close events for server')); - serverClose = true; - } - if (clientClose && serverClose) - clearTimeout(timer); - } - - process.nextTick(mustCall(() => { - function connectClient() { - if (clientCfg.sock) { - clientCfg.sock.connect(server.address().port, 'localhost'); - } else { - clientCfg.host = 'localhost'; - clientCfg.port = server.address().port; - } - try { - client.connect(clientCfg); - } catch (ex) { - ex.message = msg(ex.message); - throw ex; - } - } - - if (server) { - server.listen(0, 'localhost', mustCall(() => { - if (timeout >= 0) { - timer = setTimeout(() => { - assert(false, msg('Test timed out')); - }, timeout); - } - if (client) - connectClient(); - })); - } - })); - - return { client, server }; -} - -const FIXTURES_DIR = join(__dirname, 'fixtures'); -const fixture = (() => { - const cache = new Map(); - return (file) => { - const existing = cache.get(file); - if (existing !== undefined) - return existing; - - const result = readFileSync(join(FIXTURES_DIR, file)); - cache.set(file, result); - return result; - }; -})(); -const fixtureKey = (() => { - const cache = new Map(); - return (file, passphrase, bypass) => { - if (typeof passphrase === 'boolean') { - bypass = passphrase; - passphrase = undefined; - } - if (typeof bypass !== 'boolean' || !bypass) { - const existing = cache.get(file); - if (existing !== undefined) - return existing; - } - const fullPath = join(FIXTURES_DIR, file); - const raw = fixture(file); - let key = parseKey(raw, passphrase); - if (Array.isArray(key)) - key = key[0]; - const result = { key, raw, fullPath }; - cache.set(file, result); - return result; - }; -})(); - -function setupSimple(debug, title) { - const { client, server } = setup(title, { - client: { username: 'Password User', password: '12345' }, - server: { hostKeys: [ fixtureKey('ssh_host_rsa_key').raw ] }, - debug, - }); - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })); - })); - return { client, server }; -} - -module.exports = { - fixture, - fixtureKey, - FIXTURES_DIR, - mustCall, - mustCallAtLeast, - mustNotCall, - setup, - setupSimple, -}; diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/bad_rsa_private_key b/reverse_engineering/node_modules/ssh2/test/fixtures/bad_rsa_private_key deleted file mode 100644 index 80fdc87a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/bad_rsa_private_key +++ /dev/null @@ -1,26 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpQIBAAKCAQEAz7MF4vhgw6HxNf3KtVf3VULTYgrRSlv+cCZdB1xxI1p/nGyu -/eekUn5C+mGeDS488DX5ulzicxVpL7pamc/tFNcp91MrR7PiIMK2l+bwbZJubbLj -DHhNcBklnFOSKxtmQRfuorGakpy/kXmIxF5of0xXGns6DlHRq9dGCJIXvrkqhcEb -k4n2y4aV4VOiMHdo6FrFQVPzA8DlbJP2SjIFZ/0VdK7O7eiyiqV1p1xlbTQQ5rAX -LdsshBn/GvoBOTCVupMXurn2582vgGh26Mmovj2QGzScMGUVttkMlnxUmKT/aQka -mC0vR54QOW7lyWPjAitOV0qgmtGm3/cl7W7NjwIDAQABAoIBAFxH0C+951BEXWV9 -s1jLEqshG8YNxFtjcDLn+KFSoznv9Y7MgxtwlgPI8X1Jbe2xQ4X+lUwGBN7Y/nkk -NSjtxwphZtXqb+pVs/yWRoZLJzunucSnnFVoBg/uPFWuk9zvOYlmVrKWcnT9i+fY -tbl5sLgOdQzg/zRpidztssIQFti3o2jnpyrEGcepPWLkfCgqPfGmNv78BAIt/6iT -zYDB4GMSq/LnPTIOFsIOvlkZg3RCcLWeAPRC+lvFQVY+M/uJL5WIbA5il1IMMKH7 -MULWpRO3lnb1JVrkZlBldK5uew6AN3tHDQOmg+C2JuIbOZ35J9dcnwsE+IptWWBj -XiFRJCECgYEA8BeuufkslureqOycaPLMkqchMTue1OxbLJFvPN+dh/cW6Lng3b8+ -xAyzZrc0vccH/jl9WVHhIZ7TcKXDzSmmrtnZ/3m1c4gANGqIPwO+emL1ZzzkIKGd -FrLeBZKP4TWry9kjg4cG1SKGpcB5ngJMPXUxMZNe74tC4Hk820PkFjcCgYEA3XXn -ngRCgH9N1eKSD2daxxlBhTTSnTgjU+dDaDFQzPIhJCcS8HwyQBQmNTOSXXK9sShC -fdXAsmiBby5WEBq/K5+cXeDG2ZlFLyPovEgTUrLgraw42PYs0+A8Ls7dFk7PuMez -3G2gUPkY039JiyXKfcog9/dIRfbWCwzQ6s7TV2kCgYEArsme81cahhgg1zvCNokk -M1Omz2/HFt2nFpAeOmPVDGnu7Kh9sxGKgTF53bpclBh0kjiKL99zFYXKCoUzQYYk -CcEhemLBnYUSGRbBb5arMfAfFfR3Y+YkNaUsC0SCqILpOfMvbo57g+ipu7ufDlA/ -7rIFiUDvaVap7j909W+8egsCgYEAsuc/0DBixMmSyHl7QwRcmkC15HVSu32RVIOb -ub01KAtmaH1EWJAMTCW64/mggOtjgI0kgeE/BSFVhsqo7eOdkhEj0db27OxbroRU -zF1xdrpYtRRO7D6a4iLgm3OzuQS72+tASo8pFqDUxG6sq8NAvLOgRJE4ioSoT07w -KvAgXRkCgYEAmWgcsX/BdNcKOteSDtPkys5NRtWCBz7Coxb+xXXoXz1FVegBolpY -wXVePvXTIbU8VJOLunMyH5wpmMUiJbTX9v2o/yfpsH0ci4GaAeVtqpA= ------END RSA PRIVATE KEY----- \ No newline at end of file diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/https_cert.pem b/reverse_engineering/node_modules/ssh2/test/fixtures/https_cert.pem deleted file mode 100644 index 49e1045a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/https_cert.pem +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIFuzCCA6OgAwIBAgIUPtNIRfp8v8RsObCr+9LVosWVD/QwDQYJKoZIhvcNAQEL -BQAwbTELMAkGA1UEBhMCVVMxEzARBgNVBAgMClNvbWUtU3RhdGUxEjAQBgNVBAcM -CVNvbWUtQ2l0eTEhMB8GA1UECgwYSW50ZXJuZXQgV2lkZ2l0cyBQdHkgTHRkMRIw -EAYDVQQDDAlsb2NhbGhvc3QwHhcNMjAxMjIwMDQwNTM1WhcNMzAxMjE4MDQwNTM1 -WjBtMQswCQYDVQQGEwJVUzETMBEGA1UECAwKU29tZS1TdGF0ZTESMBAGA1UEBwwJ -U29tZS1DaXR5MSEwHwYDVQQKDBhJbnRlcm5ldCBXaWRnaXRzIFB0eSBMdGQxEjAQ -BgNVBAMMCWxvY2FsaG9zdDCCAiIwDQYJKoZIhvcNAQEBBQADggIPADCCAgoCggIB -AJ/m96/mBMFoUWUOFSvvmJjHj/XxnO89ClCcCIFA6bJNCJMFZV3m853HAhP9g3kF -M3hL0c96GKS5IsRJiNUMrIUYrWCPh1yUJCNfczyGbBJNcEoRhfqCuuzjA5U7jAil -jqLWBP+ZI0tKRuQXX4bDHp51qDESscxNHZQp0+Lho86y4XjZPnT1OYd5rl3D6D82 -AElOrGOtsj7KmHl3eYhQoKNDlCGa5ZK+L05rsClU5m/LXyGmf5QtOIF00JqJ7KS4 -mX3ZF+XE/+3gkXLJyOCOYFDLjGY7WjsJXz3Wm6pktW8NGqhMaaRfIINqtCQkDgMk -gTjF3TtEA/M2DsGU2edL3qm/ibQ4z88dMVkLGZ6DWZg5oGwZR0W8jRAauhWO01Qq -JSLF3Rhvj4VasF4Hj6sI2HQcgGlDFqPNs/ErTA91mN/+yzXzCYIGBUeF5cSbIsLL -TNo6fCHKRIYqpHYCQjwBYQh/2R4/o/BHHkePVWDN0dg2VAyrp/YhV3YTfs3M4ond -yx2CoW1FJHPlhsmGH3A6PlWe2dRgu9f0ZejOX+eefqkkJtrVbmxfVCB9KET7TrV1 -lBX/V6bnFwmT0fygeBHd0aR+h8dvIs3E/wovLp4MZjtT97p+IMcGUcH9AmbFlXgi -VOnYx4/3WLuqGpyurDaCWwJDmtdCDoclZeZ3ef+IEi3/AgMBAAGjUzBRMB0GA1Ud -DgQWBBTQsY4pBOEhu4+hJb5KqaxKNBMPLTAfBgNVHSMEGDAWgBTQsY4pBOEhu4+h -Jb5KqaxKNBMPLTAPBgNVHRMBAf8EBTADAQH/MA0GCSqGSIb3DQEBCwUAA4ICAQBf -+YfOSlOw79aCdtU40OH51QFJxuK54ryxpzRcpBeDE57HfnuNHAM+z+5xVu8+qaRn -jo27ylmLLmzlWV946Yb+fyxIZb37KNXiIYehPTYyiG9MYmE3kEH/kLEvU8SQ6zO5 -6CVP3RN+HP1ZdgHi4Zq6DLsngr/ma8nAXuRUgsvLogB2yrtTJTlMB5631ahdD3U8 -kInPa1FlWYjq0QvllzMJ2q/uUG8kMLZRArqKMxb6j5hqHZuA2PAhb1h2K54doOWt -26HdGPVBxZcnE7HUUqKMAxAf++vmYicDTSv6rsEONxmG9cn0SQWzUnr3G6zZ4uxF -9wlvl5/VN6jT9XtS9rpZfwOVLigmuhMFkUCxTTN0eHOh0u76QSk2nphxumIj1vc+ -I9G/KNk0R3G+7AyjDK2WIxaqUTChpBfytQoiiQCOYEL+KlJboWhYL7mfeBT2flzH -H3/LfF61Y8V2H5pjX1x+e/FghA5OFiHsrgoJVegVYu6v0JyCzNwGaSvnpu8QZcOZ -lT6d4UKS8JmIuq2w7iru6cURBRzMfBZ4qaX3Gm/NSDfi6q/8aL/mogzQHg91lrFz -AXZUkb+WGikJ6TEgL9M4qBHwgssk7ayEejBhIuLxQD654Py8P8diEt/77iY0qsS9 -EEw/onPXr9nLLeIcigQEa2+14msAb2I7a2/RhlUW+Q== ------END CERTIFICATE----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/https_key.pem b/reverse_engineering/node_modules/ssh2/test/fixtures/https_key.pem deleted file mode 100644 index 3be6a970..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/https_key.pem +++ /dev/null @@ -1,52 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQCf5vev5gTBaFFl -DhUr75iYx4/18ZzvPQpQnAiBQOmyTQiTBWVd5vOdxwIT/YN5BTN4S9HPehikuSLE -SYjVDKyFGK1gj4dclCQjX3M8hmwSTXBKEYX6grrs4wOVO4wIpY6i1gT/mSNLSkbk -F1+Gwx6edagxErHMTR2UKdPi4aPOsuF42T509TmHea5dw+g/NgBJTqxjrbI+yph5 -d3mIUKCjQ5QhmuWSvi9Oa7ApVOZvy18hpn+ULTiBdNCaieykuJl92RflxP/t4JFy -ycjgjmBQy4xmO1o7CV891puqZLVvDRqoTGmkXyCDarQkJA4DJIE4xd07RAPzNg7B -lNnnS96pv4m0OM/PHTFZCxmeg1mYOaBsGUdFvI0QGroVjtNUKiUixd0Yb4+FWrBe -B4+rCNh0HIBpQxajzbPxK0wPdZjf/ss18wmCBgVHheXEmyLCy0zaOnwhykSGKqR2 -AkI8AWEIf9keP6PwRx5Hj1VgzdHYNlQMq6f2IVd2E37NzOKJ3csdgqFtRSRz5YbJ -hh9wOj5VntnUYLvX9GXozl/nnn6pJCba1W5sX1QgfShE+061dZQV/1em5xcJk9H8 -oHgR3dGkfofHbyLNxP8KLy6eDGY7U/e6fiDHBlHB/QJmxZV4IlTp2MeP91i7qhqc -rqw2glsCQ5rXQg6HJWXmd3n/iBIt/wIDAQABAoICAQCb0z8o4WVc/UXkzvZ+3Hy+ -1itKp+whkECPEZ+QJiwXn85tR+LiwYBDD37M8E7BDvp7jpemMvv0+p4Q3wBDbphp -FAVRhk2JQKx+9DOelfiXVXPKGo2P9Poog4ooUeFDQ+NeeGZil1+3rWisOsLS1y7t -iQcg23D9AWGD08cy4GT7t4LWfA7Ld3ZauY/cvF+FyiA5UDva35hGbLRuGqoK11fU -ArVGkmaKvF/pcjQ38w6lf3DzoAfP5MmeDrKDB0nftC2QYJFTTsmBjUjwrgfeHaFq -2xG1Rr3FrnpsDsmgIYhV8lU6EU0Z68IJj2CBn8kv8tEi/F99s+iNiO6UY3R+XIdd -Jng5zPxHwprzKjvdfl6e4KhwkV8YJbPW0SFDj6Y0Ie0CdSysdJ8BhT7dk7LvJH1Q -DhQSAFftSna4MW5fzAogyQVL+KF3JnQ9BvFZX1swlIqBDHc6DeM+sFg0U++7qFyl -nZellskBgfLXlGCjgGEC/W5pUOaZzBk1BGa8x8Zm3vA//uaoOw/BKizfa+p0VqoU -bC4E8HEK+Rqj9oB07wVliqU9mCqrc5offhjeft9YbUAqx6GPG+1kPiKW1F4++iT2 -Yils/euv+gtK9d9JbMUCCH6mp1wIy40a14XisA8/O8NONjF63VTZX3try7rjOKxd -D0W68FGzACIkRkmTTc2NsQKCAQEAzKq7Lk/6cf2bzSQc0oH0XWxuA497czTQYj7l -k4UkGcUeEu9qOp3qU66KjmqLXLJnF233tQ2ArpiwX7tHNmhXZmIufNxa0Gue2VGx -eyRO/aTCnD1FsSayX1KcaLrwvg5gvwOPQLNCacMc47RCyI6/05irXfNtRlqKKm+R -ZgnhHxcwMzX5lLX9Rr54AWp0yuLEK+i0lcKsNnypAMl/C9GTqk3dEpao0y6SGHiW -Ih8Q2Cy4LbRD48PWuf9rBvb3iZyiLe0xemD8wuNN0j7/Xt9tcL4OuzkmkzWCyslM -Qi3yNw6eRziFhzdpDdHpJjFjEnGI94jgt1AYJtesFvSf8Tz7jQKCAQEAyAH7JQKx -mYvaRioAaUKQHiLImPxypt5cEGiyrPdiBBrU+3fBTC/EZJn/VK7ApM+7YRqvO/vz -d9orkvsWfzxpQM1xhBZ3bwTWXXWRz7g5vzKwJk4pZkXaUk+QAUwp79OrZFTcQokJ -d/l1wj5sUQCrs0l5gD5M3O6ZXPWLoSv1gBI7ktBxXY3VBrQ0uAwE9mQHjyrO+Utc -fcdFEtOqwOxyQQmcsj0vjGm385FmtuIG/pSzhvPXGyo3VYrQjTXT7pYnghu3LBgg -JJuE8kOAlSVTL0ccSO9GLqvj2bTyLlrFcKPBReXHNLwl5kij2w7WBTPGQn61u+ye -+bmSunIkjE2muwKCAQEAr/k4OcjAgJRbCpY7RfBAyLb7HIqYzWSiq2aDBEUc1h97 -DTLXNpEislLHhU4sh0ZJh4agzgZPF0/njlg7EZfDVh+i8u6QEtYF3br1C/kbBdFN -FwND0d6AzZ79JrtdVTyNiI8p86pttvvw8gPCzCiY3PlOltg/o5cjZvtIm+BwtMe+ -RLnq3ydfHx2TlzwOMYeqvko2QvIAGlUzBp85YlMPUQXjyCDMBc/sA6hjBfGKDSTe -M0XkfYicLo5jWrir+6E2fKCNwzhy+6pu9g/+iHc45RA1IFsyRK5kx7EupVRWB2rF -Ql1hyfIlnKFYguNB2NDPwG3rMRJnwbX8nDw27TfO3QKCAQEAlHAb82DnbFzGF3LO -sVBMY4FPPXOGp9+5lhgOG57SKNe9IBDF7gQ5jqxYOoIjyW2+1JeYXD1meZn64u/k -x3OPbh/LUsvVwhhl/CDoobBJc2RsJVG3GgdXu+T+rGfZa/u9ZQ4yFlNcKqWCxzHK -8+c6hypNuWcDZqjSO5KlGW3lmzJs8k4vBM7hvkL6KWoKOM8OaSvNRmmu8E53LjzX -qq0RMsGugP42DtDbTDKqd6qSpFi6ULsh9zBCtwL6OwMrEhRwp/hn3prdKC4f4ilF -Aewcq6bsEBk9DiBWT1oir1KA3FM8euLJEJNe0WUx7r85Cc1eJDWkLR+08QPQKP3T -sCllRwKCAQBQgSFFI65dlLJf/iJrZPuP3sCzZNABe4y7lxZK2Gij4FXzf2KA1SAl -dyxuUU+Hv98l52pJIWmoNYWKEXOorsu+TuadgiK11DSx/ajQ9y8OEbscOVTJwrv3 -aVbaz4f0z2AKRLrBLsln2aVLQVPF5dsPNmsYIUWOrvBJ+DFFeXQG+QWimS2VbS+P -wrDdpVej8sEaUVfCqvCAx8gWtrFtE401BmfNla1xFGHiHhcLrsqKj3uxIojQ0Met -fFCrKqxES0OQ6pY/9VlrBmfihw/Bt1LWMPUo90atFArbwGaUxXLwi4FwRafkW5Di -k77w3OGObcFv4zxCOoFxcXXc3MCyw3r8 ------END PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/id_dsa b/reverse_engineering/node_modules/ssh2/test/fixtures/id_dsa deleted file mode 100644 index d9c9b5b3..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/id_dsa +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQC3/2VIGHgqHuxvhPa6rryqqLy6sQmjeSIwyrIW5F/o8W4sz/mE -0noDSW4PaoXjgPQv5egj1EByws6dMOUqLaZHNWNn+Lh/jkKlwKyhbSCAjqoWH3v3 -uI1j58GO/eZ2+REijfyA0XJxdm7kqEexxbg0UpFr1F/eLBUxpLIbhhS1cwIVAKcB -B9DnAObuPJGTwYTCaIIBQDy9AoGAJicW0pIFwgoTYsIeywmUQopJ3FQ4M3eDwQ0U -T33pzWvBZFN2OsUDTFg64PNm9ow09wk042qMg168eKCUTp2iR/Y9R4xTj8dls8iv -aMGMZ/B32eURIjUREGiXYTyG1pfuB2znSvr/5pavhuz5yG9M0AJCiYiexdaQKO3N -oJp6T3ACgYEAsep79p4WljnawrJc928zGq6dLYjs+5apYhqx4vf2l3Z2u26VqVNG -i5zZkUzhWQYV3/qtEOpO43dyZTHW+d9L8ni6HbXFWRVx60WE+5WKkzkimHJ6gox2 -kDvOqPudiS34KJOCEYYLEnJmK8aUZBZzWFORXkN8QgA/h9ts8AU785UCFAVXZMWq -CteWCH2HzcY2x/65dMwL ------END DSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/id_ecdsa b/reverse_engineering/node_modules/ssh2/test/fixtures/id_ecdsa deleted file mode 100644 index 036e3b65..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/id_ecdsa +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIPMZuWP7fMsZeyC1XXVUALVebJOX7PTwmsPql9qG25SeoAoGCCqGSM49 -AwEHoUQDQgAEB/B6mC5lrekKPWfGEkKpnCk08+dRnzFUg2jUHpaIrOTt4jGdvq6T -yAN57asB+PYmFyVIpi35NcmicF18qX3ayg== ------END EC PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa b/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa deleted file mode 100644 index 90a6f724..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXQIBAAKBgQDL0yFO4W4xbdrJk/i+CW3itPATvhRkS+x+gKmkdH739AqWYP6r -kTFAmFTw9gLJ/c2tN7ow0T0QUR9iUsv/3QzTuwsjBu0feo3CVxwMkaJTo5ks9XBo -OW0R3tyCcOLlAcQ1WjC7cv5Ifn4gXLLM+k8/y/m3u8ERtidNxbRqpQ/gPQIDAQAB -AoGABirSRC/ABNDdIOJQUXe5knWFGiPTPCGr+zvrZiV8PgZtV5WBvzE6e0jgsRXQ -icobMhWQla+PGHJL786vi4NlwuhwKcF7Pd908ofej1eeBOd1u/HQ/qsfxPdxI0zF -dcWPYgAOo9ydOMGcSx4v1zDIgFInELJzKbv64LJQD0/xhoUCQQD7KhJ7M8Nkwsr2 -iKCyWTFM2M8/VKltgaiSmsNKZETashk5tKOrM3EWX4RcB/DnvHe8VNyYpC6Sd1uQ -AHwPDfxDAkEAz7+7hDybH6Cfvmr8kUOlDXiJJWXp5lP37FLzMDU6a9wTKZFnh57F -e91zRmKlQTegFet93MXaFYljRkI+4lMpfwJBAPPLbNEF973Qjq4rBMDZbs9HDDRO -+35+AqD7dGC7X1Jg2bd3rf66GiU7ZgDm/GIUQK0gOlg31bT6AniO39zFGH0CQFBh -Yd9HR8nT7xrQ8EoQPzNYGNBUf0xz3rAcZCWZ4rHK48sojEMoBkbnputrzX7PU+xH -QlqCXuAIWVXc2dHd1WcCQQDIUJHPOsgeAfTLoRRRURp/m8zZ9IpbaPTyDstPVNYe -zARW3Oa/tzPqdO6NWaetCp17u7Kb6X9np7Vz17i/4KED ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa.ppk b/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa.ppk deleted file mode 100644 index 4504f18c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa.ppk +++ /dev/null @@ -1,26 +0,0 @@ -PuTTY-User-Key-File-2: ssh-rsa -Encryption: none -Comment: rsa-key-20150522 -Public-Lines: 6 -AAAAB3NzaC1yc2EAAAABJQAAAQB1quqP0rhl78NOLD4lj+1x5FGAqZ3aqo6GiEPz -KOaQmy86FuJMK0nHj3gUKTa/Kvaa+8PZyeu+uVseHg47YrynCOcJEEnpqvbArc8M -xMWuUnTUMrjvokGDOBBiQu4UAE4bybpgXkNHJfbrcDVgivmv3Ikn8PVIZ1rLBMLZ -6Lzn0rjPjFD0X4WqsAJW2SFiZnsjMZtVL2TWadNTyyfjjm2NCRBvd32VLohkSe9Q -BZBD6MW8YQyBKUnEF/7WNY0eehDVrfx1YqPOV1bDwFUhRaAYpLDLDR0KCAPvx7qb -8G5Cq0TIBsEr3H8ztNRcOTQoaKgn0T18M7cyS4ykoNLYW4Zx -Private-Lines: 14 -AAABACyF3DZraF3sBLXLjSL4MFSblHXfUHxAiPSiQzlpa/9dUCPRTrUJddzOgHZU -yJtcXU9mLm4VDRe7wZyxbSs6Hd5WZUGzIuLLEUH8k4hKdE/MLDSdkhV7qhX5iaij -tAeRaammRoVUGXTd7rnzGx2cXnnkvkZ22VmqkQ6MLg1DTmWNfOO9cdwFGdQawf/n -yUV0nTkWsHXy5Qrozq9wRFk8eyw+pFllxqavsNftZX8VDiQt27JLZPTU4LGkH660 -3gq1KhNS/l05TlXnMZGjlcPN8UEaBzmCWRezhJSttjs5Kgp1K3yDf4ozMR/HWOCj -Jq8fd3VIgli6ML8yjr/c0A0T9MUAAACBAL1/byxHiCvY/2C+/L5T+ZZq13jdZuYK -MmOFaNITgEdNGWSIFYRzhLKGXj7awQWOIW6chj470GNOfQjFL1TvXhbwfqW6esDa -kETOYQPYQHZijABcn7uurMUm/bu5x/z9gYkAfniOCI5vmvMvJ09JcZ0iUmFWDZZY -fAutBvrt+n/vAAAAgQCe9jrA51wn1/wzKmWF+2+OWFUG9usheIcEbHB8mxLguLfU -+x4i+2vLo0FtXEPAw+Bt7Tge4t0m6USiVZXtW/QKsh0kMj4mNVHFz+XXw4l1QOYv -n5TjnLepiP7majXv4GHI2eOcHkyly4sIkj4jNLYqvT86hMxW4IC+jtJEWhn/nwAA -AIEAlJ8cExu2WrWukTDJQHrVegtvdJUhNjol2wLucPuWwSxKuB8FHYwaPRYRkf3d -DkZ53hhjJZ0BVkAaQ28uqM09xKD+q1H4/r0nnbtlV4uHLl3cCD5mGrH8I/iDPJX4 -fFIqCa0+n1D6RzvDqs1QIu+PGSp0K6vHOOS5fP0ZpuT025E= -Private-MAC: 4ca26008c85b901f4d2766b0924c25e527678d7e diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa_enc deleted file mode 100644 index 75a1e956..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/id_rsa_enc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,CCE70744FB28F2EFB1D74377281A780C - -1WiGnqpSGXFIg+WYr7T2XN72C1YrNQ1jmRISb32TB/Rh2Zo47fjyQnv9impz8b6m -91R/qF7uCLI0fswvT5oqwn1L0vUAA0YtW/E2IQJEx5GPiaexoDJYYfu2yy036Kca -e9VtCajgrV+kycg1CknCxQKMcKXNq8Czvq66PM4Bzknek5hhdmxHxOl0QAE+8EXt -pnasOGz3szTUKkD6givwWgvDXY3BnVG46fXff99Xqgb6fx5IDbAkVKaxWIN/c81E -b0rcfyoLb7yjPgNYn9vUI6Z+24NMYUYARzb3dG5geaeX0BYb/VlCtJUsP0Rp2P2P -jl+cdvBKaeOvA9gPo/jAtSOFexQRs7AzKzoOLYU1fokd8HhqxOKAljn9ujmEqif7 -qcimk2s7ff6tSSlxtRzDP+Uq9d1u5tyaONRV2lwj+GdP1gRoOmdZL5chdvoAi0I8 -5eMf58hEuN2d4h4FryO6z7K+XQ9oo6/N/xHU0U/t2Pco9oY2L6oWMDxKwbfPhaD5 -CcoEElsK4XFArYDielEq9Y1sXaEuwR5I0ksDDsANp74r9Bhcqz60gJa6hVz0ouEU -QA67wV9+TRmulKRxwANvqxQwqPuxqcTPeJjXSUN/ZCaDwYmI+d1poxMx2fQzT82M -onlgOWq+3HbCotyoeFpCameymwDQzmrYdMBr7oWLgnOrxmJ89zDc6+jkHFgQJvnU -atyeVDqe866ZvvIGWS+r/EsDjV3cTW/cJvdsC+5BpnoXoVF4LqxE3LFbEbQBvqio -4enCZpspQSMOJra37vSofbD+DyI5Wd+y8SBmfDLjyDFhT0spW9aN99uFqSc3UElA -SAmnFmpYBFEQrRGpvpu5sC0c/YjZeRXr0/F1xPpIT1SWzpRsbcsWRBDzWjLOKWQx -8ytwc2QS7eKedfqkPWpYKW0Qtps+XgnGWA6PBX42IYhLsKANRfhFXQv5LPqLNNOn -3EsG9pd+0dBpfxFQfyyAKAUuvpJNgJ6kNx8VSj8Ppj8lyUdGa9YucgB02m7gHC9U -A4YyJsIcjo6IcrjM+ez1govRRS0nE8AUb8ups9tn8mdBwqcPCrgcJhV7JkOYNJYh -NAh0vgmneOq8LSVs2SRaL3uuLNbjh1LR9iViwbIY8kMQXkiXa2/V+PFwt5oqeX5f -2x3yzCeGBiQW10InyBBnKutbPD85R4YJhQ55bOMDSFfGGqwOU1QURiO1NUzf9n/2 -+E8VE7J/IQoO0TrJpC+EV0ROKME9W6+AvEFdmdIigbq3bkdEgSixyLnrhV8V8T4N -nbKlLoqfXt8DmT+h8XPzgsu0Fq/PNi6xBaiUsaN9tK6OP2ZVjr9ihbeLTI0rcKDr -XX2cWPvTcboRLt+S4wmqchMf7Kxa2PfX5Tf+KCcdZNQO4YqS23wQZgk61kuOQCsS -uOop+ICI7yWZkjqCOzGOeHLl/7FyFeprsFDIwD1g20y9bzibbJlbQPhwXSalqDQT -MWLH3rdFuvgLH7ujtjxSakES+VzkOhbnmb/Wypbl1D7P7GT2seau16EEGQDhDzcJ -Q4d/BjR2WqqxmC79MOAvUWAu6fZQjPD30/gYPGpMaEuiLrDlzDqvf+oi4A9+EtRL ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa deleted file mode 100644 index a8722abc..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa +++ /dev/null @@ -1,21 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABsgAAAAdzc2gtZH -NzAAAAgQDg+DsMAituSW/NJpWVy2w7xN6Uu/IfCqpy38CFBW+mBnOX7OzPulI+1uZxXRLy -UKiQDAegXCqSHMCo5ACZhw2BRwq74J4VA5fOFGdwcacTQo1zKDF64wvyVSgQE/E2PSFLKu -NHHtRFnjvq6WrgTQsL9aif2FBWS5q0MGahzXhNkQAAABUAn1ASRSRcIVsWqrrZubFQq4pU -OlMAAACBALcKIRLTtYG5+N/vzEULdsXSGToDRth6X5Yjb7c0UotAmy9VGrnmN5IO+//1em -2USHeSoO+5shRq92zdggdQwNaXXzU301huIETztfRwGHOfUGZbzJmIqdzLhdziFhneAzaN -zVeUFyIqvWL1Q89WgC2Uh3DY/lK/gIhRK7WD0cDAAAAAgC882WUEEig48DVyjbNi1xf8rG -svyypMHSs2rj6pja2Upfm+C5AKKU387x8Vj/Kz291ROIl7h/AhmKOlwdxwPZOG5ffDygaW -Tlo4/JagwP9HmTsK1Tyd1chuyMk9cNLdgWFsCGGHY2RcEwccq9panvvtKp57HqDaT1W7AS -g2spT9AAAB8G4oDW5uKA1uAAAAB3NzaC1kc3MAAACBAOD4OwwCK25Jb80mlZXLbDvE3pS7 -8h8KqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUDl8 -4UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZLmrQwZqHN -eE2RAAAAFQCfUBJFJFwhWxaqutm5sVCrilQ6UwAAAIEAtwohEtO1gbn43+/MRQt2xdIZOg -NG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2CB1DA1pdfNTfTWG4g -RPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVDz1aALZSHcNj+Ur+AiFErtY -PRwMAAAACALzzZZQQSKDjwNXKNs2LXF/ysay/LKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP -8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PKBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYW -wIYYdjZFwTBxyr2lqe++0qnnseoNpPVbsBKDaylP0AAAAVAIoWASGAfFqckLwvtPRNCzow -TTl1AAAAEm5ldyBvcGVuc3NoIGZvcm1hdAECAwQFBgc= ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub deleted file mode 100644 index d5b662dd..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAOD4OwwCK25Jb80mlZXLbDvE3pS78h8KqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUDl84UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZLmrQwZqHNeE2RAAAAFQCfUBJFJFwhWxaqutm5sVCrilQ6UwAAAIEAtwohEtO1gbn43+/MRQt2xdIZOgNG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2CB1DA1pdfNTfTWG4gRPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVDz1aALZSHcNj+Ur+AiFErtYPRwMAAAACALzzZZQQSKDjwNXKNs2LXF/ysay/LKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PKBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnseoNpPVbsBKDaylP0= new openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result deleted file mode 100644 index 7b8d66ea..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASwGByqGSM44BAEwggEfAoGBAOD4OwwCK25Jb80mlZXLbDvE3pS78h8K\nqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUD\nl84UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZL\nmrQwZqHNeE2RAhUAn1ASRSRcIVsWqrrZubFQq4pUOlMCgYEAtwohEtO1gbn43+/M\nRQt2xdIZOgNG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2C\nB1DA1pdfNTfTWG4gRPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVD\nz1aALZSHcNj+Ur+AiFErtYPRwMADgYQAAoGALzzZZQQSKDjwNXKNs2LXF/ysay/L\nKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PK\nBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnse\noNpPVbsBKDaylP0=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAOD4OwwCK25Jb80mlZXLbDvE3pS78h8KqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUDl84UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZLmrQwZqHNeE2RAAAAFQCfUBJFJFwhWxaqutm5sVCrilQ6UwAAAIEAtwohEtO1gbn43+/MRQt2xdIZOgNG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2CB1DA1pdfNTfTWG4gRPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVDz1aALZSHcNj+Ur+AiFErtYPRwMAAAACALzzZZQQSKDjwNXKNs2LXF/ysay/LKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PKBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnseoNpPVbsBKDaylP0=", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result deleted file mode 100644 index 0d93248a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASwGByqGSM44BAEwggEfAoGBAOD4OwwCK25Jb80mlZXLbDvE3pS78h8K\nqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUD\nl84UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZL\nmrQwZqHNeE2RAhUAn1ASRSRcIVsWqrrZubFQq4pUOlMCgYEAtwohEtO1gbn43+/M\nRQt2xdIZOgNG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2C\nB1DA1pdfNTfTWG4gRPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVD\nz1aALZSHcNj+Ur+AiFErtYPRwMADgYQAAoGALzzZZQQSKDjwNXKNs2LXF/ysay/L\nKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PK\nBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnse\noNpPVbsBKDaylP0=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAOD4OwwCK25Jb80mlZXLbDvE3pS78h8KqnLfwIUFb6YGc5fs7M+6Uj7W5nFdEvJQqJAMB6BcKpIcwKjkAJmHDYFHCrvgnhUDl84UZ3BxpxNCjXMoMXrjC/JVKBAT8TY9IUsq40ce1EWeO+rpauBNCwv1qJ/YUFZLmrQwZqHNeE2RAAAAFQCfUBJFJFwhWxaqutm5sVCrilQ6UwAAAIEAtwohEtO1gbn43+/MRQt2xdIZOgNG2HpfliNvtzRSi0CbL1UaueY3kg77//V6bZRId5Kg77myFGr3bN2CB1DA1pdfNTfTWG4gRPO19HAYc59QZlvMmYip3MuF3OIWGd4DNo3NV5QXIiq9YvVDz1aALZSHcNj+Ur+AiFErtYPRwMAAAACALzzZZQQSKDjwNXKNs2LXF/ysay/LKkwdKzauPqmNrZSl+b4LkAopTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PKBpZOWjj8lqDA/0eZOwrVPJ3VyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnseoNpPVbsBKDaylP0=", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBvAIBAAKBgQDg+DsMAituSW/NJpWVy2w7xN6Uu/IfCqpy38CFBW+mBnOX7OzP\nulI+1uZxXRLyUKiQDAegXCqSHMCo5ACZhw2BRwq74J4VA5fOFGdwcacTQo1zKDF6\n4wvyVSgQE/E2PSFLKuNHHtRFnjvq6WrgTQsL9aif2FBWS5q0MGahzXhNkQIVAJ9Q\nEkUkXCFbFqq62bmxUKuKVDpTAoGBALcKIRLTtYG5+N/vzEULdsXSGToDRth6X5Yj\nb7c0UotAmy9VGrnmN5IO+//1em2USHeSoO+5shRq92zdggdQwNaXXzU301huIETz\ntfRwGHOfUGZbzJmIqdzLhdziFhneAzaNzVeUFyIqvWL1Q89WgC2Uh3DY/lK/gIhR\nK7WD0cDAAoGALzzZZQQSKDjwNXKNs2LXF/ysay/LKkwdKzauPqmNrZSl+b4LkAop\nTfzvHxWP8rPb3VE4iXuH8CGYo6XB3HA9k4bl98PKBpZOWjj8lqDA/0eZOwrVPJ3V\nyG7IyT1w0t2BYWwIYYdjZFwTBxyr2lqe++0qnnseoNpPVbsBKDaylP0CFQCKFgEh\ngHxanJC8L7T0TQs6ME05dQ==\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc deleted file mode 100644 index 392f2143..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc +++ /dev/null @@ -1,22 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBgJ5gXYn -/2IFE2+CrAxYR8AAAAEAAAAAEAAAGxAAAAB3NzaC1kc3MAAACBAPKhVnFGWb0KLibdYnJz -0RwFy/mt98KMIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0 -w+ZYfVHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vy -k1bw7ske+ImLAAAAFQDnXsk6hdenasLyE8ylLHSE+0XR3QAAAIBsMerhmMT0/416hJV/pr -s7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/IjU62Sz6n -/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK6eRJfrZuaq0Yue -nUa9AuFwnjPAAAAIBwjDUjp9jaJu46eobNK8CWJL/Noi2fXTtFZFgUFRwkr/FXLLsOckQT -mYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuCx6dIgiOf2gRClQU5OlqhrnMW2BQXlR -hBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/C2XBGgEuRdgyqQAAAgDIGP0oYyi7sTk0HdU9 -uWZLaDhHpW4Z8xTzfgUDbxoTYQ2igO90O32vSqW/cC2QKWTFuPCFnsCerHAIGzX/eyxlCQ -VyNa7VrhbNjIKAHBF3XMcRVRbW2SdYq8tHSkeZHr5EuO5dRfJ7wsR8flkPb4O4viNlIbvF -Ake8dsZEOhcnVNiv+NMR9mTq8l91wR60tr3XiWzCMkEYrJiWOfQuZSvzYi7dUmFxQuEZfQ -vIPkZD3L6XdaAz/r6YAONFAbtUMAOaUxOGV9puSsunSosAvmi+NcJ9iUM2FpAu561gp+Tv -RRcgXHxLGuzTNASiMaTN3M+HenqUh3RWmWauL5wSR7DbrH7Vq47YTnVjtg8xcZnMCfOx2D -Wz775hD6uyLwbkxKMaNMf8p4sOcXsSpHNqKmfkUxQBpNRp6Vg5W+AVaAkyXQng2LRt6txJ -Xv5zBiSFdsobkrWko/ONfGKfG+zVP+LIVcghLpp71GZQX6Ci02vB55pvk8k0G91H3INn/c -t6Q5zY5pK9VZwxjZ29psm7V+FdeD1g8VQ1Rp9muq6zDXHKKyqkBK/oGCM9UhBHFjki0gBR -v6LY/iXsz/eG14svhLjM5zYFSX7jUOI9b/PnhhL7Mos4wguHN2EjfGWuC07PkkqDPoqSwn -cC91OKhub6yqZsqvBz9BcV+2FxVNPNKzRdzA== ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub deleted file mode 100644 index c2b1190f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAPKhVnFGWb0KLibdYnJz0RwFy/mt98KMIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0w+ZYfVHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vyk1bw7ske+ImLAAAAFQDnXsk6hdenasLyE8ylLHSE+0XR3QAAAIBsMerhmMT0/416hJV/prs7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/IjU62Sz6n/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK6eRJfrZuaq0YuenUa9AuFwnjPAAAAIBwjDUjp9jaJu46eobNK8CWJL/Noi2fXTtFZFgUFRwkr/FXLLsOckQTmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuCx6dIgiOf2gRClQU5OlqhrnMW2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/C2XBGgEuRdgyqQ== diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result deleted file mode 100644 index d15133a0..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBAPKhVnFGWb0KLibdYnJz0RwFy/mt98KM\nIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0w+ZYfV\nHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vy\nk1bw7ske+ImLAhUA517JOoXXp2rC8hPMpSx0hPtF0d0CgYBsMerhmMT0/416hJV/\nprs7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/I\njU62Sz6n/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK\n6eRJfrZuaq0YuenUa9AuFwnjPAOBhAACgYBwjDUjp9jaJu46eobNK8CWJL/Noi2f\nXTtFZFgUFRwkr/FXLLsOckQTmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuC\nx6dIgiOf2gRClQU5OlqhrnMW2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/\nC2XBGgEuRdgyqQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAPKhVnFGWb0KLibdYnJz0RwFy/mt98KMIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0w+ZYfVHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vyk1bw7ske+ImLAAAAFQDnXsk6hdenasLyE8ylLHSE+0XR3QAAAIBsMerhmMT0/416hJV/prs7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/IjU62Sz6n/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK6eRJfrZuaq0YuenUa9AuFwnjPAAAAIBwjDUjp9jaJu46eobNK8CWJL/Noi2fXTtFZFgUFRwkr/FXLLsOckQTmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuCx6dIgiOf2gRClQU5OlqhrnMW2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/C2XBGgEuRdgyqQ==", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result deleted file mode 100644 index 2271c47a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "new openssh format encrypted", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBAPKhVnFGWb0KLibdYnJz0RwFy/mt98KM\nIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0w+ZYfV\nHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vy\nk1bw7ske+ImLAhUA517JOoXXp2rC8hPMpSx0hPtF0d0CgYBsMerhmMT0/416hJV/\nprs7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/I\njU62Sz6n/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK\n6eRJfrZuaq0YuenUa9AuFwnjPAOBhAACgYBwjDUjp9jaJu46eobNK8CWJL/Noi2f\nXTtFZFgUFRwkr/FXLLsOckQTmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuC\nx6dIgiOf2gRClQU5OlqhrnMW2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/\nC2XBGgEuRdgyqQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAPKhVnFGWb0KLibdYnJz0RwFy/mt98KMIdByHKQWRm9UjoVJk1ypuQpnj+bqFnxCzCFSU9OUj0/Xe0Wuk+kF2BtMO0w+ZYfVHCqEaaIJ1D/iLqi8aBbYs552l9+P0DsFUlTE0D/AvKTQ2PsztFq7wHUTQVmnj4vyk1bw7ske+ImLAAAAFQDnXsk6hdenasLyE8ylLHSE+0XR3QAAAIBsMerhmMT0/416hJV/prs7crOX0e0gF8C7kar/ILj5WULX7k143+4lgluoogrPXbd5fXgOnqdQawow8a/IjU62Sz6n/qfHLJtQ2sJOK2Vkj5NF2UCcRHrewqJw9nDCS7yYh3c+gUfIBcIRkEJK6eRJfrZuaq0YuenUa9AuFwnjPAAAAIBwjDUjp9jaJu46eobNK8CWJL/Noi2fXTtFZFgUFRwkr/FXLLsOckQTmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuCx6dIgiOf2gRClQU5OlqhrnMW2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/C2XBGgEuRdgyqQ==", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBugIBAAKBgQDyoVZxRlm9Ci4m3WJyc9EcBcv5rffCjCHQchykFkZvVI6FSZNc\nqbkKZ4/m6hZ8QswhUlPTlI9P13tFrpPpBdgbTDtMPmWH1RwqhGmiCdQ/4i6ovGgW\n2LOedpffj9A7BVJUxNA/wLyk0Nj7M7Rau8B1E0FZp4+L8pNW8O7JHviJiwIVAOde\nyTqF16dqwvITzKUsdIT7RdHdAoGAbDHq4ZjE9P+NeoSVf6a7O3Kzl9HtIBfAu5Gq\n/yC4+VlC1+5NeN/uJYJbqKIKz123eX14Dp6nUGsKMPGvyI1Otks+p/6nxyybUNrC\nTitlZI+TRdlAnER63sKicPZwwku8mId3PoFHyAXCEZBCSunkSX62bmqtGLnp1GvQ\nLhcJ4zwCgYBwjDUjp9jaJu46eobNK8CWJL/Noi2fXTtFZFgUFRwkr/FXLLsOckQT\nmYxaWcxP4NwuvMyI25tOueM0RvAIR7J3Afc5pbuCx6dIgiOf2gRClQU5OlqhrnMW\n2BQXlRhBKBNMp5LjM5t46KTBkjh/30//s4Kimrp/C2XBGgEuRdgyqQIUSNLlRVPv\nMC3Q3P3ajY1DdZvi9z8=\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm deleted file mode 100644 index 38566b47..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm +++ /dev/null @@ -1,23 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAAFmFlczEyOC1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA -AAGAAAABD01pNY1+DTCAHuI6mcjB0YAAAAEAAAAAEAAAGyAAAAB3NzaC1kc3MAAACBAPLA -N0jFExSJiCvw7p2W2v5tqvXIG4YwCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJ -iP98Vz0XTHIW6DpkE9DcC5GGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79s -ZPOEg/bMExWJlB5AosJr7v5twVftAAAAFQC5AGsioHKAc2Cd2QwKLUZSmDZAVwAAAIBxYf -EThMIXPQkSer3snKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrL -OnIbqU1XApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/q -MsMu2RSKkK6f08J0vsESnKU4nmnwAAAIEAxH8NZyntzihIAHnx1Lbo7h1sPi4RhcpKK5pS -UiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3qhq/B3bspx1GWjL -qLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi7GdZG8Q0tuyfXxsAAAIA -PDupGK4wMtROtFZqo7vduzkHJuDrE/tAwGqiD2pKMova7WaKM0EUznwcl3gtmhHvFeY+NJ -3Uc9sQcX/9n3y6NAYsC+eZeqe7Sy2GWVyqxOUJHpZqfsKYJidG61TBgKgx+JXAeidYdz4L -4cEapwwocOptbY3ZRFmszekq5xPomnkP9DeSQG6l4eYSv7OpeAHlFj2KCmJMVEZDOl6RyJ -KCqOpfEJIIVoCmna/hQdd9ptLVFmbX/VShgLjvUwfBggJtZNPb5jx+PMy+I0ylywaCIG5K -JQAqust6dzFBx3mBoO4kZPBHlb8XwQ4HYLYph0Ur/lINsHrpLxgmtEw7zzs73Nshl6go2V -uvBtcZ5ywAMk+8CLP5ZgpiGBxlMtFGowp/5zuJxRpc9FgdfxnnVWDyzcQ/YvX9lwzb6cNz -bXeLPsKjOSLPV7G/RFIiuCAOa97ZCM8Ho4FhdNYOGilmjuxV7FJiTc7KP2r+Wh3oxsV7AB -Q6Thj06b2mX3iE4hqLaMKIVE1zs22nMlUtFJv8YY1ZWBihUVlnR9vWgIH7ODoZOwNWBlLd -Qfyfi8w3KgJWj5oVNAM7WniNFQjfNxEbrPklfYg93deVE/LhPghs9I7fsIeHY/p8GtsO/S -amTcjkYi6pUuT8m7IeFYQ8cWvGnbaYz6/9+ni+0aoUL93GKHQw1+mBUVuswVZXBF1WVCf+ -LMgZ ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub deleted file mode 100644 index d9eb1a5a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAPLAN0jFExSJiCvw7p2W2v5tqvXIG4YwCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJiP98Vz0XTHIW6DpkE9DcC5GGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79sZPOEg/bMExWJlB5AosJr7v5twVftAAAAFQC5AGsioHKAc2Cd2QwKLUZSmDZAVwAAAIBxYfEThMIXPQkSer3snKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrLOnIbqU1XApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/qMsMu2RSKkK6f08J0vsESnKU4nmnwAAAIEAxH8NZyntzihIAHnx1Lbo7h1sPi4RhcpKK5pSUiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3qhq/B3bspx1GWjLqLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi7GdZG8Q0tuyfXxs= diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result deleted file mode 100644 index 6a918a80..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASsGByqGSM44BAEwggEeAoGBAPLAN0jFExSJiCvw7p2W2v5tqvXIG4Yw\nCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJiP98Vz0XTHIW6DpkE9DcC5\nGGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79sZPOEg/bMExWJlB5A\nosJr7v5twVftAhUAuQBrIqBygHNgndkMCi1GUpg2QFcCgYBxYfEThMIXPQkSer3s\nnKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrLOnIbqU1X\nApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/qMs\nMu2RSKkK6f08J0vsESnKU4nmnwOBhQACgYEAxH8NZyntzihIAHnx1Lbo7h1sPi4R\nhcpKK5pSUiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3q\nhq/B3bspx1GWjLqLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi\n7GdZG8Q0tuyfXxs=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAPLAN0jFExSJiCvw7p2W2v5tqvXIG4YwCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJiP98Vz0XTHIW6DpkE9DcC5GGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79sZPOEg/bMExWJlB5AosJr7v5twVftAAAAFQC5AGsioHKAc2Cd2QwKLUZSmDZAVwAAAIBxYfEThMIXPQkSer3snKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrLOnIbqU1XApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/qMsMu2RSKkK6f08J0vsESnKU4nmnwAAAIEAxH8NZyntzihIAHnx1Lbo7h1sPi4RhcpKK5pSUiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3qhq/B3bspx1GWjLqLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi7GdZG8Q0tuyfXxs=", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result deleted file mode 100644 index 27ae40b3..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_dsa_enc_gcm.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "new openssh format encrypted gcm", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASsGByqGSM44BAEwggEeAoGBAPLAN0jFExSJiCvw7p2W2v5tqvXIG4Yw\nCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJiP98Vz0XTHIW6DpkE9DcC5\nGGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79sZPOEg/bMExWJlB5A\nosJr7v5twVftAhUAuQBrIqBygHNgndkMCi1GUpg2QFcCgYBxYfEThMIXPQkSer3s\nnKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrLOnIbqU1X\nApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/qMs\nMu2RSKkK6f08J0vsESnKU4nmnwOBhQACgYEAxH8NZyntzihIAHnx1Lbo7h1sPi4R\nhcpKK5pSUiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3q\nhq/B3bspx1GWjLqLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi\n7GdZG8Q0tuyfXxs=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAPLAN0jFExSJiCvw7p2W2v5tqvXIG4YwCglrl2wnGOMBGmfaeIcxZErzW00hOxq+NvDIlK43kJiP98Vz0XTHIW6DpkE9DcC5GGA6nDZn9L+BSrBL8NhuBlz2ekgWOTCqnDC7Il/iyUCMi79sZPOEg/bMExWJlB5AosJr7v5twVftAAAAFQC5AGsioHKAc2Cd2QwKLUZSmDZAVwAAAIBxYfEThMIXPQkSer3snKJfDz0uvc1y/6htsjXLk93TAAi3LSD2dGqYs5s0WfzO4RnFso0EovrLOnIbqU1XApr6CPKAVX2REsXFWWF3VixEHIEF1Q9gIvHdYgAxSxtwYvOPpAwDmaPxWeV5/qMsMu2RSKkK6f08J0vsESnKU4nmnwAAAIEAxH8NZyntzihIAHnx1Lbo7h1sPi4RhcpKK5pSUiaKoWxkjseqUsyWENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3qhq/B3bspx1GWjLqLfKbeVi4un8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi7GdZG8Q0tuyfXxs=", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBuwIBAAKBgQDywDdIxRMUiYgr8O6dltr+bar1yBuGMAoJa5dsJxjjARpn2niH\nMWRK81tNITsavjbwyJSuN5CYj/fFc9F0xyFug6ZBPQ3AuRhgOpw2Z/S/gUqwS/DY\nbgZc9npIFjkwqpwwuyJf4slAjIu/bGTzhIP2zBMViZQeQKLCa+7+bcFX7QIVALkA\nayKgcoBzYJ3ZDAotRlKYNkBXAoGAcWHxE4TCFz0JEnq97JyiXw89Lr3Ncv+obbI1\ny5Pd0wAIty0g9nRqmLObNFn8zuEZxbKNBKL6yzpyG6lNVwKa+gjygFV9kRLFxVlh\nd1YsRByBBdUPYCLx3WIAMUsbcGLzj6QMA5mj8Vnlef6jLDLtkUipCun9PCdL7BEp\nylOJ5p8CgYEAxH8NZyntzihIAHnx1Lbo7h1sPi4RhcpKK5pSUiaKoWxkjseqUsyW\nENt6DTByIdGhBNrOp9/vw2R5CSUkxuI0TlI8bj3qhq/B3bspx1GWjLqLfKbeVi4u\nn8CrooRRq2g8+nYLu2EWbF/56pEEzws6DptlDJQi7GdZG8Q0tuyfXxsCFG8ERflm\nOIBFUymTHP8ZeVOgNm/1\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa deleted file mode 100644 index 114e0787..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa +++ /dev/null @@ -1,9 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAaAAAABNlY2RzYS -1zaGEyLW5pc3RwMjU2AAAACG5pc3RwMjU2AAAAQQTjIb0On/AzYDLFRi+g3fGdAIF72KFG -iZBpP8oKZ8bsncH9ULtVV9517cNcRNuDETQtvLqoCdIn7TipYo8Jv/lKAAAAsA6ULqEOlC -6hAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOMhvQ6f8DNgMsVG -L6Dd8Z0AgXvYoUaJkGk/ygpnxuydwf1Qu1VX3nXtw1xE24MRNC28uqgJ0iftOKlijwm/+U -oAAAAfVd3jjve28r7FhY6Uo//cKIM1rBeWZG16b8bjyVyFswAAABJuZXcgb3BlbnNzaCBm -b3JtYXQBAgMEBQYH ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub deleted file mode 100644 index 8ebee0fe..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOMhvQ6f8DNgMsVGL6Dd8Z0AgXvYoUaJkGk/ygpnxuydwf1Qu1VX3nXtw1xE24MRNC28uqgJ0iftOKlijwm/+Uo= new openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result deleted file mode 100644 index b430d737..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4yG9Dp/wM2AyxUYvoN3xnQCBe9ih\nRomQaT/KCmfG7J3B/VC7VVfede3DXETbgxE0Lby6qAnSJ+04qWKPCb/5Sg==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOMhvQ6f8DNgMsVGL6Dd8Z0AgXvYoUaJkGk/ygpnxuydwf1Qu1VX3nXtw1xE24MRNC28uqgJ0iftOKlijwm/+Uo=", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result deleted file mode 100644 index 4affa3eb..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE4yG9Dp/wM2AyxUYvoN3xnQCBe9ih\nRomQaT/KCmfG7J3B/VC7VVfede3DXETbgxE0Lby6qAnSJ+04qWKPCb/5Sg==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBOMhvQ6f8DNgMsVGL6Dd8Z0AgXvYoUaJkGk/ygpnxuydwf1Qu1VX3nXtw1xE24MRNC28uqgJ0iftOKlijwm/+Uo=", - "private": "-----BEGIN EC PRIVATE KEY-----\nMHYCAQEEH1Xd4473tvK+xYWOlKP/3CiDNawXlmRtem/G48lchbOgCgYIKoZIzj0D\nAQehRANCAATjIb0On/AzYDLFRi+g3fGdAIF72KFGiZBpP8oKZ8bsncH9ULtVV951\n7cNcRNuDETQtvLqoCdIn7TipYo8Jv/lK\n-----END EC PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc deleted file mode 100644 index 08fe2d12..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABBqNbb13W -CKfO7B1vpwJDwbAAAAEAAAAAEAAABoAAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlz -dHAyNTYAAABBBJibjz7zvP/EhMZrW/JDdKvYgiEATNUKMfg2NOVxKlf++eTRypLFc1doTp -r+04Ebm1fkyp8RgpFsmvLXLt/dKU0AAADA86k3lHnP6pfD977mwEtKxHOJm44wx8NsdBwN -mNLqxlxUE520nsXjDgpgNU0MF9JDnc1kdhSy8PcdTAAH5+k6bpf3gotPrltPUBMFQdPqst -5kVS7zOgaxv1qZnlyhOqEdNR3Hee09gJByRrAojtcs+sPI7Nba879NPMb5c5K+gKhONHsa -wLAnz66eFQH5iLjd2MwrV4gJe0x6NGCSI2kyzNlxFsoIl7IcHlJHyyuaSlEOFWQJB8cbB4 -BVZB+/8yAx ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub deleted file mode 100644 index 3d87cb2c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJibjz7zvP/EhMZrW/JDdKvYgiEATNUKMfg2NOVxKlf++eTRypLFc1doTpr+04Ebm1fkyp8RgpFsmvLXLt/dKU0= diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result deleted file mode 100644 index dcca403f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmJuPPvO8/8SExmtb8kN0q9iCIQBM\n1Qox+DY05XEqV/755NHKksVzV2hOmv7TgRubV+TKnxGCkWya8tcu390pTQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJibjz7zvP/EhMZrW/JDdKvYgiEATNUKMfg2NOVxKlf++eTRypLFc1doTpr+04Ebm1fkyp8RgpFsmvLXLt/dKU0=", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result deleted file mode 100644 index 9fe2c73e..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "new openssh format encrypted", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEmJuPPvO8/8SExmtb8kN0q9iCIQBM\n1Qox+DY05XEqV/755NHKksVzV2hOmv7TgRubV+TKnxGCkWya8tcu390pTQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBJibjz7zvP/EhMZrW/JDdKvYgiEATNUKMfg2NOVxKlf++eTRypLFc1doTpr+04Ebm1fkyp8RgpFsmvLXLt/dKU0=", - "private": "-----BEGIN EC PRIVATE KEY-----\nMHgCAQEEIQDG2nALLBBmkBnw1QvdW4ClRfF3Zl3CcRHujsYz9CLvf6AKBggqhkjO\nPQMBB6FEA0IABJibjz7zvP/EhMZrW/JDdKvYgiEATNUKMfg2NOVxKlf++eTRypLF\nc1doTpr+04Ebm1fkyp8RgpFsmvLXLt/dKU0=\n-----END EC PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm deleted file mode 100644 index 84178baf..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm +++ /dev/null @@ -1,10 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAAFmFlczEyOC1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA -AAGAAAABAHURyWtYwqVbjholNpL6opAAAAEAAAAAEAAABoAAAAE2VjZHNhLXNoYTItbmlz -dHAyNTYAAAAIbmlzdHAyNTYAAABBBM+ppawNxvkdHbOaB3ygsRueTdIKiT+OQkAH/5LpDx -XcD6i5AR8T/vrCsZ9/y+8GxU8gmvg4Uszr6LDfaQBZnsUAAADAFqKM/ylVkJ/ZA40ZROrW -LNgrttf2+lpVkADwXWzhuESFPPzERKlbHVsVtbiiYmPkLnY1s5VM4zXIj7xyO9YNA9KcM5 -GHOKUL2/NmDaTyGgc9s3BGu/ibpjSeOd1rtGAB4cw1s9ifbXBQd3qDbqzaEmovs3MGaGHD -c3VagdxhsppjrPjZ+B40Pzs9QkSGutsSJDpH9wVIu4OLr89TquTU3PVACDRU03lPPENVbt -rh2IMJeEQyNINQHtfVwordj8LMOEsBjyQ1aqHNva/iKyTBiw== ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub deleted file mode 100644 index 61b0b990..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM+ppawNxvkdHbOaB3ygsRueTdIKiT+OQkAH/5LpDxXcD6i5AR8T/vrCsZ9/y+8GxU8gmvg4Uszr6LDfaQBZnsU= diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result deleted file mode 100644 index 10786485..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEz6mlrA3G+R0ds5oHfKCxG55N0gqJ\nP45CQAf/kukPFdwPqLkBHxP++sKxn3/L7wbFTyCa+DhSzOvosN9pAFmexQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM+ppawNxvkdHbOaB3ygsRueTdIKiT+OQkAH/5LpDxXcD6i5AR8T/vrCsZ9/y+8GxU8gmvg4Uszr6LDfaQBZnsU=", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result deleted file mode 100644 index 626aedff..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ecdsa_enc_gcm.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "new openssh format encrypted gcm", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEz6mlrA3G+R0ds5oHfKCxG55N0gqJ\nP45CQAf/kukPFdwPqLkBHxP++sKxn3/L7wbFTyCa+DhSzOvosN9pAFmexQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBM+ppawNxvkdHbOaB3ygsRueTdIKiT+OQkAH/5LpDxXcD6i5AR8T/vrCsZ9/y+8GxU8gmvg4Uszr6LDfaQBZnsU=", - "private": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIHQfJ+4ZNcwSBaCR5kwrR6HjUsTF//R1F983RSTR8vbJoAoGCCqGSM49\nAwEHoUQDQgAEz6mlrA3G+R0ds5oHfKCxG55N0gqJP45CQAf/kukPFdwPqLkBHxP+\n+sKxn3/L7wbFTyCa+DhSzOvosN9pAFmexQ==\n-----END EC PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 deleted file mode 100644 index 7ae3165b..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519 +++ /dev/null @@ -1,7 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW -QyNTUxOQAAACCyOMGts0WaAdug9NeXbGn2Jrt4wwiO64dumxV2a1IgKQAAAJBOfs+eTn7P -ngAAAAtzc2gtZWQyNTUxOQAAACCyOMGts0WaAdug9NeXbGn2Jrt4wwiO64dumxV2a1IgKQ -AAAEBgQKxJoToGE/Xi4UkYR+FXfin4jG8NTcZ13rJ4CDnCfLI4wa2zRZoB26D015dsafYm -u3jDCI7rh26bFXZrUiApAAAAB3Rlc3RpbmcBAgMEBQY= ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub deleted file mode 100644 index c85c7d1f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILI4wa2zRZoB26D015dsafYmu3jDCI7rh26bFXZrUiAp testing diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result deleted file mode 100644 index 3c9ca299..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-ed25519", - "comment": "testing", - "public": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAsjjBrbNFmgHboPTXl2xp9ia7eMMIjuuHbpsVdmtSICk=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAC3NzaC1lZDI1NTE5AAAAILI4wa2zRZoB26D015dsafYmu3jDCI7rh26bFXZrUiAp", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result deleted file mode 100644 index 705fa990..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_ed25519.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-ed25519", - "comment": "testing", - "public": "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEAsjjBrbNFmgHboPTXl2xp9ia7eMMIjuuHbpsVdmtSICk=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAC3NzaC1lZDI1NTE5AAAAILI4wa2zRZoB26D015dsafYmu3jDCI7rh26bFXZrUiAp", - "private": "-----BEGIN PRIVATE KEY-----\nMC4CAQAwBQYDK2VwBCIEIGBArEmhOgYT9eLhSRhH4Vd+KfiMbw1NxnXesngIOcJ8\n-----END PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa deleted file mode 100644 index ccded2a2..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn -NhAAAAAwEAAQAAAQEA4q6eZdx7LYh46PcZNcS3CnO7GuYsEJZeTj5LQSgp21IyTelaBPpr -ijnMwKa+pLQt5TEobpKFFNecPdT6oPoOKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHM -BNkoTFeGrursPkqYRJ0HL4CqYqRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKb -zibJc64JFM7tUoK6Vl64YiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs -8zjxsf6c6N2tKXkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38 -KvTx3wjNQwAAA8hLhVBxS4VQcQAAAAdzc2gtcnNhAAABAQDirp5l3HstiHjo9xk1xLcKc7 -sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+l -fQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg6 -4MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u -2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28 -uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1DAAAAAwEAAQAAAQAmShSbZBiyYkD6KPLr -MCUy8MWED6kVzDB1yvPvN5eKYmH44xe/i4UqvgSl7gR50a2G7zzDIKC2Go1brGQBWPuXRa -ZtOjQygeD4rMHBiH/b7zfy4pQyKDfITTHOFXWE8ERiyL00bAZt09icCy92rQaq8IY/+U56 -sPPJH9UAYG9nEev8opFjAWToFDu0U2+dC+lbqLlXDqDRo75NlnDFmgUoja3y2eFr9A0Cc+ -hjecrdxyJFsCJfEfaLWtBnZb886gqzzvfbHImSQtBAKERcSxuki7uxMoP67g3iQOXa65uz -8kFWRNmbQTGQttakoUaybh1t9eLpBqvVON/4Kg0THShRAAAAgFBTz2ajBK/R/crOSL9VK1 -f7oQv2iJTRVfnUs0r+qPGgf/a/5UwkGRj0KfEWBp3qYD+keShnPr6PDPFrm8UmIdUX8AY7 -3tWT2K/JQVlzJNuINsw+DNjn4M17Z25q0LPmReRWL0nRc2w6W/hmQ/Jmqz6w8Qc4+xpeqS -/HG5feliVnAAAAgQD90a+5Ky3o/2YtueqRf/3dKoiMgGB7JAOzye4dDKGABSlWuQ4N4xEI -CW5MSTp7i/uobTF/tyFO3tTSyb5b2Xwbn/kLO0vgvFCdUGR2BQfN3mcT92T0Gn3JDF3Wym -i2mgU6qnPf+eu+RKZQ9IiyNGny61ROUQa0R0z0pgiAfA89xwAAAIEA5KE9i6hHmigJwfD7 -/AGI4ujyWIVpNyrTdXG3HAPhsdoFuG5ggHggrPuuBF9wNcosrhL20VNOQGHg15gWZIVudu -0qxky4ivQs67Sk9XUjuvTnf+VubM51rIsmh4atKJFSSZo78DEcTRt8aXLrSNvGQ4WPRweM -2Z0YGfMMDM9KJKUAAAASbmV3IG9wZW5zc2ggZm9ybWF0AQ== ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub deleted file mode 100644 index 133afc9a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D new openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result deleted file mode 100644 index dd8a8b4b..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result deleted file mode 100644 index d1ada9c7..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "new openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEA4q6eZdx7LYh46PcZNcS3CnO7GuYsEJZeTj5LQSgp21IyTela\nBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoOKKMe6oH/pX0BNyAEB9KFZfZgh0v4\nJ4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYqRdINy1sgDU6jUIOuDD5XZzlpDXb1\nftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64YiPgxsNXOJYMTrelVJYebtsNrJFm\nh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKXkk9G4EDKKip4g0bzDmD/fREPQ9vL\ni59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjNQwIDAQABAoIBACZKFJtkGLJiQPoo\n8uswJTLwxYQPqRXMMHXK8+83l4piYfjjF7+LhSq+BKXuBHnRrYbvPMMgoLYajVus\nZAFY+5dFpm06NDKB4PiswcGIf9vvN/LilDIoN8hNMc4VdYTwRGLIvTRsBm3T2JwL\nL3atBqrwhj/5Tnqw88kf1QBgb2cR6/yikWMBZOgUO7RTb50L6VuouVcOoNGjvk2W\ncMWaBSiNrfLZ4Wv0DQJz6GN5yt3HIkWwIl8R9ota0GdlvzzqCrPO99sciZJC0EAo\nRFxLG6SLu7Eyg/ruDeJA5drrm7PyQVZE2ZtBMZC21qShRrJuHW314ukGq9U43/gq\nDRMdKFECgYEA/dGvuSst6P9mLbnqkX/93SqIjIBgeyQDs8nuHQyhgAUpVrkODeMR\nCAluTEk6e4v7qG0xf7chTt7U0sm+W9l8G5/5CztL4LxQnVBkdgUHzd5nE/dk9Bp9\nyQxd1spotpoFOqpz3/nrvkSmUPSIsjRp8utUTlEGtEdM9KYIgHwPPccCgYEA5KE9\ni6hHmigJwfD7/AGI4ujyWIVpNyrTdXG3HAPhsdoFuG5ggHggrPuuBF9wNcosrhL2\n0VNOQGHg15gWZIVudu0qxky4ivQs67Sk9XUjuvTnf+VubM51rIsmh4atKJFSSZo7\n8DEcTRt8aXLrSNvGQ4WPRweM2Z0YGfMMDM9KJKUCgYB7Yh0b1EOjCdQv0jqWtDNB\n+dUbB6Te92jdUwHvGR7AzsGDqL2OPp0e3QbDCq3lNO0GuN3hCbKlVmj6dpuUpqpP\n+3ni3dZKzwAZGOVdAaEDkGNnL1Hh36bZvqs3KHmymjiEhiuB60mP2mtG2zg/+H6w\nWXlIANdTd32PR87GNohqLQKBgA36ic/LJy2Wuxn/iPicg2kUQxUEey1jUfCBVmfB\nGQCNywG+xem07pKFBNvBlhPD27187VhZFpS7J0snQl89BUcCMzZSpIniagizT86u\nLdQVez4HohvG98zn6SAqLNYpJHXZl0aVShywzIeJ/jbDMTkZpmv6WzNG9p1HjfoO\nhoL9AoGAUFPPZqMEr9H9ys5Iv1UrV/uhC/aIlNFV+dSzSv6o8aB/9r/lTCQZGPQp\n8RYGnepgP6R5KGc+vo8M8WubxSYh1RfwBjve1ZPYr8lBWXMk24g2zD4M2OfgzXtn\nbmrQs+ZF5FYvSdFzbDpb+GZD8marPrDxBzj7Gl6pL8cbl96WJWc=\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc deleted file mode 100644 index 09aa65d9..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc +++ /dev/null @@ -1,28 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAACmFlczI1Ni1jdHIAAAAGYmNyeXB0AAAAGAAAABAS8H9Cyk -rueA/Ue6tOb1MOAAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQABAAABAQC8hCiCPnRs -0ucZeyn3pNYKN63dVoxbMB4Yzjs7gvo7XKDby/6GXoU/CFQ/Q9zXRxRZmFglMYh2pOD8iW -dwpLBdd+GmHb4a6xxKtoPpz1+yCPYvi6nXzKPO3B9Wbg8dtTpV23l8MZDxSRUQ9HIkYHQO -oOjJx/AaMdZyHZP+eYK7UqmX1+dtCzr5vvLyEABxrsoFxH/oW/iKO6cDmTxoMyFl9DfUhD -TS7cL1OVBulSBav3aJPxjsCEIs6OE94wLJfFtZAPe4GqWWcC7uG1uUL5Muy2N+SfXHOHLa -I5n1vozt7lIO5TqvykcqTxipKblMW4Y7Iwlhh0YKJxzH3KJ+Qkn7AAAD4GeinUMcN5H0RP -KnXzIsYGq4rG+pEYNL0WyXCOFnyHzr6cASFYa/ViRVRN5H2dDoc0i2tcQStvDt2AfBxP97 -xbTEmRhLkKW7Sxif+bRRpNt2sO1y7ThufOZ8ZSJdbUYf9nc++k5GMZZUTtkFGhFIyhdyl+ -ZReuQFrc1Fv0/JV0K72uLSMSSMvunFjnGchch98Z1t0jEuiym8AIAwFtlvRpbOOySJhHun -fClEOahNvgzkgpqvviged7Gl9Kh3Fpp57ke1087WUF4hdgG2wuLqRq3Jq2kNvTKVi6+PMv -Kz5cLl6beqAJpbkJCpujzrmffo5NHh94R/v8DbAWCyrkjB6NHjOPIVnKaDmXixkcJ489W3 -PQF0kZ9kLrNU2yP1hBLjikr1zollw6xXC5eEpUsIrNcAHrofTMCMsGKuZhlEgTNe0cEATp -ycxi4gHdA6kNSDnMPwOv9rLDZDkgqCqIzxjZCWabqRHwiyoN3CrdDsJNrk8jSqF5epuzXA -EjrPUvu+sgFHIWDJOij+HQCvCgmdO/W7NkL/xCEx6QagjoJhapGICnq6CXPO5vBQeK7AMV -KWUPB1jdxxlHdrSUYU9v11j0SPUM51AMpWA89GZmuQbe/tK14W35VjtL9aGKsz9Ubio029 -O23HJXMxM9Dd6EYXAR9xMLFDTcLT03kjRlL/4XFS4fJqbTGDtuQNqRO3QK/myVAYjgnXwz -X1s77WeIK3sOMwTIXaHReUiQ1Cw+WmkXOhefePT+HrkyDlJk3ikgPUy2s5QW5/d6Lmolwb -mcS9JUfaai0ysP3v1bew8go/IHiUD/X9AkjkKM2kfS1NcPSi18r2721e6RqZiIHxSoyKvq -yUmwiS1kUklSuhlTORBvbclbv4HTwp1iJfu/6zsMqVJc2E8H6WUw3kTeh9fhDMpTY5NArF -KD2aRIYHFvOKav+0vSbQ/KqmKeiTvyZaV7q6giRxVLxBddl4+ucD+FybPJZSebRQ+0QT1j -aUDSpp541zW0rX7sCiZ6sFUybCPVDM1uA5gTAP015OD/FS342gi+Y04K0jBSjlApuy6BQx -sMEQbR3weMmnodbhCtbcgDZDagSFNPlDud0GJl9IWV4hO/K1f9a+Ox3G27Jq4YC2PFgTDb -aYib4xAXPUHJpoWsstSjpMnfgKcS3AGRdJ/jxlKRWV/NXFf4DYIwpzITqFMF+4VqXCa2AS -JWOcSxOK92UqCcZEs8RED3x9dF9E2yBBwHeuwDvH3c9x/nsM/cjDY+EE9VcEUOxF6qMOhO -CiRtEihEAYM46XeFzcSOQrwWPcKu3WTv3IpnzTaofBxV065CUn ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub deleted file mode 100644 index 0e80f0fd..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hCiCPnRs0ucZeyn3pNYKN63dVoxbMB4Yzjs7gvo7XKDby/6GXoU/CFQ/Q9zXRxRZmFglMYh2pOD8iWdwpLBdd+GmHb4a6xxKtoPpz1+yCPYvi6nXzKPO3B9Wbg8dtTpV23l8MZDxSRUQ9HIkYHQOoOjJx/AaMdZyHZP+eYK7UqmX1+dtCzr5vvLyEABxrsoFxH/oW/iKO6cDmTxoMyFl9DfUhDTS7cL1OVBulSBav3aJPxjsCEIs6OE94wLJfFtZAPe4GqWWcC7uG1uUL5Muy2N+SfXHOHLaI5n1vozt7lIO5TqvykcqTxipKblMW4Y7Iwlhh0YKJxzH3KJ+Qkn7 diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result deleted file mode 100644 index ee0fd943..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIQogj50bNLnGXsp96TW\nCjet3VaMWzAeGM47O4L6O1yg28v+hl6FPwhUP0Pc10cUWZhYJTGIdqTg/IlncKSw\nXXfhph2+GuscSraD6c9fsgj2L4up18yjztwfVm4PHbU6Vdt5fDGQ8UkVEPRyJGB0\nDqDoycfwGjHWch2T/nmCu1Kpl9fnbQs6+b7y8hAAca7KBcR/6Fv4ijunA5k8aDMh\nZfQ31IQ00u3C9TlQbpUgWr92iT8Y7AhCLOjhPeMCyXxbWQD3uBqllnAu7htblC+T\nLstjfkn1xzhy2iOZ9b6M7e5SDuU6r8pHKk8YqSm5TFuGOyMJYYdGCiccx9yifkJJ\n+wIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hCiCPnRs0ucZeyn3pNYKN63dVoxbMB4Yzjs7gvo7XKDby/6GXoU/CFQ/Q9zXRxRZmFglMYh2pOD8iWdwpLBdd+GmHb4a6xxKtoPpz1+yCPYvi6nXzKPO3B9Wbg8dtTpV23l8MZDxSRUQ9HIkYHQOoOjJx/AaMdZyHZP+eYK7UqmX1+dtCzr5vvLyEABxrsoFxH/oW/iKO6cDmTxoMyFl9DfUhDTS7cL1OVBulSBav3aJPxjsCEIs6OE94wLJfFtZAPe4GqWWcC7uG1uUL5Muy2N+SfXHOHLaI5n1vozt7lIO5TqvykcqTxipKblMW4Y7Iwlhh0YKJxzH3KJ+Qkn7", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result deleted file mode 100644 index a0f0fedb..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "new openssh format encrypted", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAvIQogj50bNLnGXsp96TW\nCjet3VaMWzAeGM47O4L6O1yg28v+hl6FPwhUP0Pc10cUWZhYJTGIdqTg/IlncKSw\nXXfhph2+GuscSraD6c9fsgj2L4up18yjztwfVm4PHbU6Vdt5fDGQ8UkVEPRyJGB0\nDqDoycfwGjHWch2T/nmCu1Kpl9fnbQs6+b7y8hAAca7KBcR/6Fv4ijunA5k8aDMh\nZfQ31IQ00u3C9TlQbpUgWr92iT8Y7AhCLOjhPeMCyXxbWQD3uBqllnAu7htblC+T\nLstjfkn1xzhy2iOZ9b6M7e5SDuU6r8pHKk8YqSm5TFuGOyMJYYdGCiccx9yifkJJ\n+wIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQC8hCiCPnRs0ucZeyn3pNYKN63dVoxbMB4Yzjs7gvo7XKDby/6GXoU/CFQ/Q9zXRxRZmFglMYh2pOD8iWdwpLBdd+GmHb4a6xxKtoPpz1+yCPYvi6nXzKPO3B9Wbg8dtTpV23l8MZDxSRUQ9HIkYHQOoOjJx/AaMdZyHZP+eYK7UqmX1+dtCzr5vvLyEABxrsoFxH/oW/iKO6cDmTxoMyFl9DfUhDTS7cL1OVBulSBav3aJPxjsCEIs6OE94wLJfFtZAPe4GqWWcC7uG1uUL5Muy2N+SfXHOHLaI5n1vozt7lIO5TqvykcqTxipKblMW4Y7Iwlhh0YKJxzH3KJ+Qkn7", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAvIQogj50bNLnGXsp96TWCjet3VaMWzAeGM47O4L6O1yg28v+\nhl6FPwhUP0Pc10cUWZhYJTGIdqTg/IlncKSwXXfhph2+GuscSraD6c9fsgj2L4up\n18yjztwfVm4PHbU6Vdt5fDGQ8UkVEPRyJGB0DqDoycfwGjHWch2T/nmCu1Kpl9fn\nbQs6+b7y8hAAca7KBcR/6Fv4ijunA5k8aDMhZfQ31IQ00u3C9TlQbpUgWr92iT8Y\n7AhCLOjhPeMCyXxbWQD3uBqllnAu7htblC+TLstjfkn1xzhy2iOZ9b6M7e5SDuU6\nr8pHKk8YqSm5TFuGOyMJYYdGCiccx9yifkJJ+wIDAQABAoIBAD1UXX1p5iSVRHvk\nttWLOdsfHCA7DPSJpfD5/wkwZkozq112czqxu3WzNv1SDaG3zSYMyvhmsfevUka2\nSQG7gmkWHEIXwQYu4Qhpcmb5gS+BfN4g+MNtHwmoUUWkDqTilbTi7xX5ZicpWIIo\nlI3DF16++JzUwAc1mYeMmd4bF+3quh93xW7hhrcQ31+D9kzqt6nLG1d9+IVpMbhD\nnNB9zapkZHwnz6YYhb5waMOHr6U902TyGgKyjq3Z/PkMJ0zKg01roUtQs9oQOIZF\nvueF2hwyzHqeIgpqhWJl9HMpfdym6Lh2lwguK3KYwNIMFQg+gNBWruYlH6SGfylq\n0wB5xIECgYEA8FdyEDd4TbVBKIXzzmY6zYmN/Q9uiz0IjbeYYzuRxZ4a7stE/t8n\nM5UxxkqeD8rtRAQJyFDGPAhFeeOpIfzEVPG+5s72pI69+9aE/gCGA91+sOSnLoiJ\nPW1I7SouZfCeaaRQxSSIMjsCea2s6yraujGZJyPEWSkG5TijY8+vzDsCgYEAyMxX\nCYvqlRTaT5lAkRTFLqf0/NSpRoCnG7qSPUyJjxJsVfYFLv1FZCyyrA+SaIyufjoT\nKutKE31r7wre5bkjRRenIcTkR/tdNRdkWsB/ysZ9Cp43FIPTXS5gxTQxOaJyRGvJ\n9MW0m8N1pMvPIsagzoxxvzgU9ZOejs2NQ69qXUECgYBq7DxOgp7+0zhdsto4ZLqc\nXinQ/2CKiWiYw6kD3KiJZkFNIxla2iQyiplOQjv3gqvzqmg/uc+3PWbLR0EjYbRm\npfXr8P9BTk+vDky0Q79bUNrgD5lg1lVYApqDCFUD/Pw8u2FDk3EUB7SeNWnMZZBR\nbWdZRkw/7kSnDX+DFA59qQKBgG9v0AHxT4/LEdlJEOczYrcg6TqDfyosbhFaepxg\nZJstO0h9j6TjVGZi1AnfXn59TL2q10ZjbCni2krAerF9DNDkbpG0Joi4PKMhR0WC\nPam4fF6vLZxKCLxW58epzoPQ3p+QPnWEX1ZupFR/84W2PDpFAT+BDUi40y8nbnWY\n3WvBAoGADjh0hEkq3sy6oWt0m1NjGU1yxKV+geg48BFnu2LVSFv1rw1V7X8XFEYl\nP1B3sEpOOpPGuoz+r2E9PrsdMuYNOmVlRFRpe7pm7zyhzdFYBvLE2btJqv1PmxFu\ncEkrXJS/ETxkKdMaoUbYHcKiTIMi2pDrdJtg6oHcipm0yTBZkKs=\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm deleted file mode 100644 index 442a4f5f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm +++ /dev/null @@ -1,29 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAAFmFlczEyOC1nY21Ab3BlbnNzaC5jb20AAAAGYmNyeXB0AA -AAGAAAABBJL2YVn88iqv/H9bFiyW2PAAAAEAAAAAEAAAEXAAAAB3NzaC1yc2EAAAADAQAB -AAABAQDMemjkha1c+2s58qzx4968svvvpbxt6EiLlyRHuqXCouTdBZeXGtVRlxpkqnnOE0 -ETMSQSqm1d5k1EMa7VVcTeXFQaBIc2XF0S1uIoEvNV0JXpDjiIdPmjUFuUf9oGGLKKQQMf -zpymqoiHYQNhuarYd1mSb0+a+UwKxAxGeCPd95o/JfWjKO0JTr3nnEj1eTjtu0pofmchab -9HC9YbJ3JsvbdRq7Z2ZHp8uu16SflPpP2A9l+F4HN+gPOLcGxbVkVZHsLI07OpkWdxMPBU -rzPF9OnCntRWoBhQ4LFHYHllTtd+/E90QXXhe1pxj8FktJiaitiz09GU5h4IWi3isNr/AA -AD4Ktd9gUs9KHBmWTVFnDofcB6P1dZJsYHAapQgNXZtx5SjwgfBpP5aBLtSjN1iHFE+3XC -Cofc9UJ8fbytwT7LCEQIzo3KJaOhVzgJN+lrjtFouWsw0Y1q2JONHvvNJ5A9nGjIGbp3du -4TAMSgVAvxZBEYez4ajhb2NL7TE56AjOxW4n/M2ZDJLCo11F3ON3Eq6MirHZMgGKo/lbOc -SaBld7tzqknye+1fKVlnCLyu+v0KCbATBypRsMeX1+E/D8L5cMIgRSe97swqiWeG9yBhQi -xahbWDpmU34nz1cxc9H7KnL1rbbOxrr4OEdMOHNBQjbLlpJpnSJ3XvEGP74zjfd5zMocgx -rnqreMmY+eDEObkw33+XD5ROYJT+SW/zI+r3SeIjS3UPh0ucU5nipBvXfkUezek9i/FN1X -CY7xJnAZGGKU0JSqiVW3JWXp18v8lmo3ACvXeotJfUGkwvJOeO2N4Qb7RTIzivLV5Q5Plf -zHWqHE57UqDL/Ya7SrX1FaqqhOHOlS1mqPQ+/VdsOSP5fJcXN+oKoL7jPr2WlmtFjo8PKc -rpgKC3DhUzvRXnNYotG7trbPOGJbBRgoxTQ06rlChoaBp7kUKqNNBxXhFQCeN0sCb90fHV -c+X3Yy8oUsAIxxmCymuVV8gRzLD6OdqQRBthEUQktNJLhv4mSufwSfsLDluEc7YEOrsJhx -jk57TmkFFyLj++IAKi80FnSkRfSBQF3dTSrBZ4BIHWnek8V6goxhy6lRMaFoTow2foknvr -VHgiNGvimOM3ESYVcOwt3YQqbUG/7b4jRlY3nNBJcsbxGe54B8zaoLt5pQNRxUuHc3fR4R -haWHR6IWsfey7jAlRzrJAVVEEj4d6yvJ4bLqWGmoim5QlrePRuRFyV4FNb8N6hJ9gvWY9f -HUT9TwxArDIMzu4T1khwRoFU45XN0U6xHEPcT/pZ2C5jJSSQ5W/SyBudexjMMPRKf2EIeD -gjv8vIhdtkmxHv7bapaaYeYX5gtKYl+McRollDxVC8Kr48RmOVJnK4aFBQ99Wu7SXDbwas -vcvVHI+zUiRGjU01/CU/Tf4GTodAlmZIuqKmBTX/KvVj6ZiK0BsZuEl9qom+l4rlazaahY -FdL5M4u0qt7rVirWJWgWzmPXZ+MCK0Fs70ORvqRGxVMilhQcWsng3ZXnHaYiBRhk31KqF+ -BEPEh79OknD0okKed2YYfg8vdUR+noENybrsIleP1aKBBmQCNbKU04N/9Su+wxX8YfGhYU -kPST35Wg45zER9gZGsREnON4sQTng9LHB5CrJCo/MowcZG/ycqL1mxemApZ9nYUrjA8HJi -zDwRHHUtkkLNG8Cmyg== ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub deleted file mode 100644 index d5c7685f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDMemjkha1c+2s58qzx4968svvvpbxt6EiLlyRHuqXCouTdBZeXGtVRlxpkqnnOE0ETMSQSqm1d5k1EMa7VVcTeXFQaBIc2XF0S1uIoEvNV0JXpDjiIdPmjUFuUf9oGGLKKQQMfzpymqoiHYQNhuarYd1mSb0+a+UwKxAxGeCPd95o/JfWjKO0JTr3nnEj1eTjtu0pofmchab9HC9YbJ3JsvbdRq7Z2ZHp8uu16SflPpP2A9l+F4HN+gPOLcGxbVkVZHsLI07OpkWdxMPBUrzPF9OnCntRWoBhQ4LFHYHllTtd+/E90QXXhe1pxj8FktJiaitiz09GU5h4IWi3isNr/ diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result deleted file mode 100644 index 0f00545e..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzHpo5IWtXPtrOfKs8ePe\nvLL776W8behIi5ckR7qlwqLk3QWXlxrVUZcaZKp5zhNBEzEkEqptXeZNRDGu1VXE\n3lxUGgSHNlxdEtbiKBLzVdCV6Q44iHT5o1BblH/aBhiyikEDH86cpqqIh2EDYbmq\n2HdZkm9PmvlMCsQMRngj3feaPyX1oyjtCU6955xI9Xk47btKaH5nIWm/RwvWGydy\nbL23Uau2dmR6fLrtekn5T6T9gPZfheBzfoDzi3BsW1ZFWR7CyNOzqZFncTDwVK8z\nxfTpwp7UVqAYUOCxR2B5ZU7XfvxPdEF14XtacY/BZLSYmorYs9PRlOYeCFot4rDa\n/wIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDMemjkha1c+2s58qzx4968svvvpbxt6EiLlyRHuqXCouTdBZeXGtVRlxpkqnnOE0ETMSQSqm1d5k1EMa7VVcTeXFQaBIc2XF0S1uIoEvNV0JXpDjiIdPmjUFuUf9oGGLKKQQMfzpymqoiHYQNhuarYd1mSb0+a+UwKxAxGeCPd95o/JfWjKO0JTr3nnEj1eTjtu0pofmchab9HC9YbJ3JsvbdRq7Z2ZHp8uu16SflPpP2A9l+F4HN+gPOLcGxbVkVZHsLI07OpkWdxMPBUrzPF9OnCntRWoBhQ4LFHYHllTtd+/E90QXXhe1pxj8FktJiaitiz09GU5h4IWi3isNr/", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result deleted file mode 100644 index 127ce3df..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_new_rsa_enc_gcm.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "new openssh format encrypted gcm", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAzHpo5IWtXPtrOfKs8ePe\nvLL776W8behIi5ckR7qlwqLk3QWXlxrVUZcaZKp5zhNBEzEkEqptXeZNRDGu1VXE\n3lxUGgSHNlxdEtbiKBLzVdCV6Q44iHT5o1BblH/aBhiyikEDH86cpqqIh2EDYbmq\n2HdZkm9PmvlMCsQMRngj3feaPyX1oyjtCU6955xI9Xk47btKaH5nIWm/RwvWGydy\nbL23Uau2dmR6fLrtekn5T6T9gPZfheBzfoDzi3BsW1ZFWR7CyNOzqZFncTDwVK8z\nxfTpwp7UVqAYUOCxR2B5ZU7XfvxPdEF14XtacY/BZLSYmorYs9PRlOYeCFot4rDa\n/wIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDMemjkha1c+2s58qzx4968svvvpbxt6EiLlyRHuqXCouTdBZeXGtVRlxpkqnnOE0ETMSQSqm1d5k1EMa7VVcTeXFQaBIc2XF0S1uIoEvNV0JXpDjiIdPmjUFuUf9oGGLKKQQMfzpymqoiHYQNhuarYd1mSb0+a+UwKxAxGeCPd95o/JfWjKO0JTr3nnEj1eTjtu0pofmchab9HC9YbJ3JsvbdRq7Z2ZHp8uu16SflPpP2A9l+F4HN+gPOLcGxbVkVZHsLI07OpkWdxMPBUrzPF9OnCntRWoBhQ4LFHYHllTtd+/E90QXXhe1pxj8FktJiaitiz09GU5h4IWi3isNr/", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEAzHpo5IWtXPtrOfKs8ePevLL776W8behIi5ckR7qlwqLk3QWX\nlxrVUZcaZKp5zhNBEzEkEqptXeZNRDGu1VXE3lxUGgSHNlxdEtbiKBLzVdCV6Q44\niHT5o1BblH/aBhiyikEDH86cpqqIh2EDYbmq2HdZkm9PmvlMCsQMRngj3feaPyX1\noyjtCU6955xI9Xk47btKaH5nIWm/RwvWGydybL23Uau2dmR6fLrtekn5T6T9gPZf\nheBzfoDzi3BsW1ZFWR7CyNOzqZFncTDwVK8zxfTpwp7UVqAYUOCxR2B5ZU7XfvxP\ndEF14XtacY/BZLSYmorYs9PRlOYeCFot4rDa/wIDAQABAoIBAQCCb7uluxhh7gfy\niTmFfETDvrEzqFfRDJHqadm83/WJeXvg+gY/X+CgEXHGsXDN4j5qzbgjKBBoC9dS\nHxdWA0Z4ShFkH2tZZAYDVIwj4CLVpR9b8bRiZ6wvX71rtzsPFIYf52Tkz1nif3pk\nUaBkoJm5SDkdTmBLjafSXkkuUskeeAV7gx+fzWqSpcKmhTqjnQfdlmD8OSIq4jjD\nagiHmmfBhZ4NOvF/E9UBydqFV8GNyfSFC6kC2LYmiQD1hvqNhMdYVjh99V1L3ZPq\nHMSQVAOv5WgpLTLKY8MFNBbqqp0eKhatRNA8q9O23jADDp3fubKV0aUQSrRZz0y9\nPmmEJnTRAoGBAPZoL+p+AbI5yTg01LdsaQL2f3Ieb3CGudesmjAVnI3QEoC6gxGX\n4cbmBSCY+vBzh2RJNJcS+Rq6VmJZA930Tb0npHiQYOohB7BFOCbBJ2L18g/JdNpi\nVb3wqFs9NG1GFOOV6iGtV/6t4CRTKtAbd695YZAJ5S6DDvMrH9pTnAKrAoGBANRw\nVuLfBTFhSKvFz+0W0yy6Sn0koXjpp1ifC0BWLwHiA/IZjAY7qmsNQZxWdleWLP28\nRNaac3vMJO/HFD4IyL59Zli+kREGKazvZM1dvOs0mgdVMTPMsT57wcJr5OSxqCvJ\nD3NkcgFuA1e3jVC5p/wUJCi/lhyFPx3z1C5vRqj9AoGBANeyYmd5wFBcp1ktXhvm\nqZIvZ2blX5X4ScyTSjHXaUD2qIvJORz4gGqVRl2/rMM5zoYqUwAAWtFb1mynEWyF\nBFwVzLLBaCTrnwhdv4alRK4rL6dEKadVt0ra1PVxgWg6leSXgenTDRli6bfCmdKs\niLuxnIbzMozhqv+Qe4Sp9gKbAoGBALWBThsEpXEtR2PL3P0atU7P0/jcJUIjkCF9\nsaVEfWFEdE6TWTmyHMbeSqKClRX8b3BTPRWGXQj2wNBE7Zya8LkgdyN3noZHF7Bz\n0VJNtq3XAYsmVKWHTCCwqDmu6aAj0iWm4ZabyXRDRIPbhdfk6AvOQZ63IlA34Fd9\nDlqmJF8ZAoGAIJzfMDT2LvlMOHqpKgelS4ZTHEmqqJZM5rXdsZwYqcyekjz25COE\nTJwme3xIt3kSZEcOauGHCgUVeBcE6GwZbQ1WoNIvazhnUXeErOeoxQ+ZqdfC8iyT\nUn/P27yx/FcwDdubQhbgxZ5M+pu+0OQ1WPu02LQZQrX7x4a6isYtTDo=\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa deleted file mode 100644 index f2ae4d42..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBvQIBAAKBgQDs+n9ZKhwYNr1V2uGn0C/2MSTM4KB4puy4jR5ubRTT1yq5SbzK -RQlCjfplDN//Eqa6aiFmvGKA3RKUtPtBmD96EHW1mvr7O+Pc8z8L/4zg9tkVQR6V -WBKgBhVwZHDzzs5+Ag2j54BZfcaGMcNGhTE9DcZYeI/t6FhOxgpID3EA/QIVAMyI -czBU74xB48IMoamlEhc5Lh+3AoGBAMuy2h9K9+oQIPcTcsD/mtmhOYlw2ZPCJV2b -WFeZ3QxAujenBzEp0oqht8tdj+BE7Er+CWT2Ab/A92MrjYUaGaPjdF5+K6CSPMUX -rK8nBabSBJ+ELqTo/8vHJ2eVWIUJBwCzbw3ryitH7LD3gyEr2NuQQJE++wyWPBHK -M3SFOft6AoGBAOdrYUJ38yjc9tnrvLWsB1KlkYhc+UbTMSRKfA8Yo/Xs5QldFycz -bUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMnOzRVQXpUI7z2W3/Ie4/i2Lu/ -xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5ciuO0ltu90L9+2YvWAhUAr/vy -ahuEz4UFGhB8IIeLWQUO5FA= ------END DSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub deleted file mode 100644 index a7fd375a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAOz6f1kqHBg2vVXa4afQL/YxJMzgoHim7LiNHm5tFNPXKrlJvMpFCUKN+mUM3/8SprpqIWa8YoDdEpS0+0GYP3oQdbWa+vs749zzPwv/jOD22RVBHpVYEqAGFXBkcPPOzn4CDaPngFl9xoYxw0aFMT0Nxlh4j+3oWE7GCkgPcQD9AAAAFQDMiHMwVO+MQePCDKGppRIXOS4ftwAAAIEAy7LaH0r36hAg9xNywP+a2aE5iXDZk8IlXZtYV5ndDEC6N6cHMSnSiqG3y12P4ETsSv4JZPYBv8D3YyuNhRoZo+N0Xn4roJI8xResrycFptIEn4QupOj/y8cnZ5VYhQkHALNvDevKK0fssPeDISvY25BAkT77DJY8EcozdIU5+3oAAACBAOdrYUJ38yjc9tnrvLWsB1KlkYhc+UbTMSRKfA8Yo/Xs5QldFyczbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMnOzRVQXpUI7z2W3/Ie4/i2Lu/xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5ciuO0ltu90L9+2YvW old openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result deleted file mode 100644 index 05f81407..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "old openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBuDCCASwGByqGSM44BAEwggEfAoGBAOz6f1kqHBg2vVXa4afQL/YxJMzgoHim\n7LiNHm5tFNPXKrlJvMpFCUKN+mUM3/8SprpqIWa8YoDdEpS0+0GYP3oQdbWa+vs7\n49zzPwv/jOD22RVBHpVYEqAGFXBkcPPOzn4CDaPngFl9xoYxw0aFMT0Nxlh4j+3o\nWE7GCkgPcQD9AhUAzIhzMFTvjEHjwgyhqaUSFzkuH7cCgYEAy7LaH0r36hAg9xNy\nwP+a2aE5iXDZk8IlXZtYV5ndDEC6N6cHMSnSiqG3y12P4ETsSv4JZPYBv8D3YyuN\nhRoZo+N0Xn4roJI8xResrycFptIEn4QupOj/y8cnZ5VYhQkHALNvDevKK0fssPeD\nISvY25BAkT77DJY8EcozdIU5+3oDgYUAAoGBAOdrYUJ38yjc9tnrvLWsB1KlkYhc\n+UbTMSRKfA8Yo/Xs5QldFyczbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMn\nOzRVQXpUI7z2W3/Ie4/i2Lu/xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5c\niuO0ltu90L9+2YvW\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAOz6f1kqHBg2vVXa4afQL/YxJMzgoHim7LiNHm5tFNPXKrlJvMpFCUKN+mUM3/8SprpqIWa8YoDdEpS0+0GYP3oQdbWa+vs749zzPwv/jOD22RVBHpVYEqAGFXBkcPPOzn4CDaPngFl9xoYxw0aFMT0Nxlh4j+3oWE7GCkgPcQD9AAAAFQDMiHMwVO+MQePCDKGppRIXOS4ftwAAAIEAy7LaH0r36hAg9xNywP+a2aE5iXDZk8IlXZtYV5ndDEC6N6cHMSnSiqG3y12P4ETsSv4JZPYBv8D3YyuNhRoZo+N0Xn4roJI8xResrycFptIEn4QupOj/y8cnZ5VYhQkHALNvDevKK0fssPeDISvY25BAkT77DJY8EcozdIU5+3oAAACBAOdrYUJ38yjc9tnrvLWsB1KlkYhc+UbTMSRKfA8Yo/Xs5QldFyczbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMnOzRVQXpUI7z2W3/Ie4/i2Lu/xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5ciuO0ltu90L9+2YvW", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result deleted file mode 100644 index d21d1cbd..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBuDCCASwGByqGSM44BAEwggEfAoGBAOz6f1kqHBg2vVXa4afQL/YxJMzgoHim\n7LiNHm5tFNPXKrlJvMpFCUKN+mUM3/8SprpqIWa8YoDdEpS0+0GYP3oQdbWa+vs7\n49zzPwv/jOD22RVBHpVYEqAGFXBkcPPOzn4CDaPngFl9xoYxw0aFMT0Nxlh4j+3o\nWE7GCkgPcQD9AhUAzIhzMFTvjEHjwgyhqaUSFzkuH7cCgYEAy7LaH0r36hAg9xNy\nwP+a2aE5iXDZk8IlXZtYV5ndDEC6N6cHMSnSiqG3y12P4ETsSv4JZPYBv8D3YyuN\nhRoZo+N0Xn4roJI8xResrycFptIEn4QupOj/y8cnZ5VYhQkHALNvDevKK0fssPeD\nISvY25BAkT77DJY8EcozdIU5+3oDgYUAAoGBAOdrYUJ38yjc9tnrvLWsB1KlkYhc\n+UbTMSRKfA8Yo/Xs5QldFyczbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMn\nOzRVQXpUI7z2W3/Ie4/i2Lu/xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5c\niuO0ltu90L9+2YvW\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAOz6f1kqHBg2vVXa4afQL/YxJMzgoHim7LiNHm5tFNPXKrlJvMpFCUKN+mUM3/8SprpqIWa8YoDdEpS0+0GYP3oQdbWa+vs749zzPwv/jOD22RVBHpVYEqAGFXBkcPPOzn4CDaPngFl9xoYxw0aFMT0Nxlh4j+3oWE7GCkgPcQD9AAAAFQDMiHMwVO+MQePCDKGppRIXOS4ftwAAAIEAy7LaH0r36hAg9xNywP+a2aE5iXDZk8IlXZtYV5ndDEC6N6cHMSnSiqG3y12P4ETsSv4JZPYBv8D3YyuNhRoZo+N0Xn4roJI8xResrycFptIEn4QupOj/y8cnZ5VYhQkHALNvDevKK0fssPeDISvY25BAkT77DJY8EcozdIU5+3oAAACBAOdrYUJ38yjc9tnrvLWsB1KlkYhc+UbTMSRKfA8Yo/Xs5QldFyczbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMnOzRVQXpUI7z2W3/Ie4/i2Lu/xXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5ciuO0ltu90L9+2YvW", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBvQIBAAKBgQDs+n9ZKhwYNr1V2uGn0C/2MSTM4KB4puy4jR5ubRTT1yq5SbzK\nRQlCjfplDN//Eqa6aiFmvGKA3RKUtPtBmD96EHW1mvr7O+Pc8z8L/4zg9tkVQR6V\nWBKgBhVwZHDzzs5+Ag2j54BZfcaGMcNGhTE9DcZYeI/t6FhOxgpID3EA/QIVAMyI\nczBU74xB48IMoamlEhc5Lh+3AoGBAMuy2h9K9+oQIPcTcsD/mtmhOYlw2ZPCJV2b\nWFeZ3QxAujenBzEp0oqht8tdj+BE7Er+CWT2Ab/A92MrjYUaGaPjdF5+K6CSPMUX\nrK8nBabSBJ+ELqTo/8vHJ2eVWIUJBwCzbw3ryitH7LD3gyEr2NuQQJE++wyWPBHK\nM3SFOft6AoGBAOdrYUJ38yjc9tnrvLWsB1KlkYhc+UbTMSRKfA8Yo/Xs5QldFycz\nbUtsFGdLvqPol0pww2LqeKUQ8zVIF56Aw3SxmPMnOzRVQXpUI7z2W3/Ie4/i2Lu/\nxXos8ZHnIu+e7SLJRHe+RGNvISbsQhk+vnpNQP5ciuO0ltu90L9+2YvWAhUAr/vy\nahuEz4UFGhB8IIeLWQUO5FA=\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc deleted file mode 100644 index 57064cdf..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,3239878D1E2D496289CE9CD2CB639BE8 - -k8/4Ax6UcnImNvEuybHwa9OHZHeCpKmq3Cu/q29a9AkTnktAWVmU9rQFch5CweDH -TEuRN+ZHecHrrMPR0fTpjXzZTxmU3549BQ2DfMSAdikPNKtBvhJwpT2se0rJ9M98 -p2xJQNhpxXT6f4Hy8m6QvjP5iTmlnQrrVBjV05ih9TLLQb4Y4NlydC08OyEcEoJV -w43G69sv2ws/tUVr7XSUtv8l+51ywSm42Pw6YOVlMZ7y+XB/uWmFNMz5gLN17tkc -wikhgvNnMWGLqb/AruuKPp5FrGRIC19DKRzDSPF5WlzLBdd2TQKDltknDj08AQMJ -bDsImbePteqhU+D7GiN2pVAD2b5kCZlFzYG43/Q8R3+O2l0Lvq5VBIqNB7LyJfTy -DL8XX0gzHk7FgG5MfLYin/qp7upnDXeSnIm8A2tlBYh9YzG3q/a53c5V2NomWjX0 -zvS+C7+w5NDwDRT5t+kecMhmHWNBuE/Pbvy0DaZQ/nnsC6TlkcaROJ0fiY3Da8E6 -EYvM4uKaZudsOOapwx0ZXHu2GZgLnly0p2Cd0Yf9t2UX9uySfwdL2TNw8nLVNVkh -aBE/x9LkKPWqOBV8tg/9ITGys/qgZh0A1r+RGmj/tII= ------END DSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub deleted file mode 100644 index 18f58045..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-dss AAAAB3NzaC1kc3MAAACBAP25RC69mW4t09jpaine5ZRHmOtqNJa2nbsRrSsZkvGXxbJ7ojxsybWf4kAAI4GpsGMzlrFrlMEpHQfebJAn+zJwGS+loR7T+gNz8JoVIgPF9dabXVymcygl4FB/sNAmV4XK3OjvSW1NCKdSkwZZr/gz5JBo1qAiQDKMD/ikWqq/AAAAFQC/rPmzFozpCeLbFQykOaDGFZaqaQAAAIEAw1hJAYQzn/ZboF/xXDHzP49uRpIIoyaSfUz5W3+Lpi/CBkOIGaGOuitwcpTfzBSZIDZ9ORs9fq5oBh29JJcAdBNgVXfzThSiGvBgU4UIj41MlG4PG6St88VXCy0niEXWmjSkdcW3hZ0ai0SOlVxxEkYneg7RH9Seh+U3rRacrh4AAACAOX41OCxx8mTuxpON/uZn6GwvK/m0K9fr/UmIX8D4Mp8PgnPLC71AOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7pLtuULoQdCgiYt1agVrioFSP6bEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n/IO5uUbWoPK5iAo= diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result deleted file mode 100644 index ad142600..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASwGByqGSM44BAEwggEfAoGBAP25RC69mW4t09jpaine5ZRHmOtqNJa2\nnbsRrSsZkvGXxbJ7ojxsybWf4kAAI4GpsGMzlrFrlMEpHQfebJAn+zJwGS+loR7T\n+gNz8JoVIgPF9dabXVymcygl4FB/sNAmV4XK3OjvSW1NCKdSkwZZr/gz5JBo1qAi\nQDKMD/ikWqq/AhUAv6z5sxaM6Qni2xUMpDmgxhWWqmkCgYEAw1hJAYQzn/ZboF/x\nXDHzP49uRpIIoyaSfUz5W3+Lpi/CBkOIGaGOuitwcpTfzBSZIDZ9ORs9fq5oBh29\nJJcAdBNgVXfzThSiGvBgU4UIj41MlG4PG6St88VXCy0niEXWmjSkdcW3hZ0ai0SO\nlVxxEkYneg7RH9Seh+U3rRacrh4DgYQAAoGAOX41OCxx8mTuxpON/uZn6GwvK/m0\nK9fr/UmIX8D4Mp8PgnPLC71AOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7p\nLtuULoQdCgiYt1agVrioFSP6bEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n\n/IO5uUbWoPK5iAo=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAP25RC69mW4t09jpaine5ZRHmOtqNJa2nbsRrSsZkvGXxbJ7ojxsybWf4kAAI4GpsGMzlrFrlMEpHQfebJAn+zJwGS+loR7T+gNz8JoVIgPF9dabXVymcygl4FB/sNAmV4XK3OjvSW1NCKdSkwZZr/gz5JBo1qAiQDKMD/ikWqq/AAAAFQC/rPmzFozpCeLbFQykOaDGFZaqaQAAAIEAw1hJAYQzn/ZboF/xXDHzP49uRpIIoyaSfUz5W3+Lpi/CBkOIGaGOuitwcpTfzBSZIDZ9ORs9fq5oBh29JJcAdBNgVXfzThSiGvBgU4UIj41MlG4PG6St88VXCy0niEXWmjSkdcW3hZ0ai0SOlVxxEkYneg7RH9Seh+U3rRacrh4AAACAOX41OCxx8mTuxpON/uZn6GwvK/m0K9fr/UmIX8D4Mp8PgnPLC71AOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7pLtuULoQdCgiYt1agVrioFSP6bEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n/IO5uUbWoPK5iAo=", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result deleted file mode 100644 index 18c52716..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_dsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtzCCASwGByqGSM44BAEwggEfAoGBAP25RC69mW4t09jpaine5ZRHmOtqNJa2\nnbsRrSsZkvGXxbJ7ojxsybWf4kAAI4GpsGMzlrFrlMEpHQfebJAn+zJwGS+loR7T\n+gNz8JoVIgPF9dabXVymcygl4FB/sNAmV4XK3OjvSW1NCKdSkwZZr/gz5JBo1qAi\nQDKMD/ikWqq/AhUAv6z5sxaM6Qni2xUMpDmgxhWWqmkCgYEAw1hJAYQzn/ZboF/x\nXDHzP49uRpIIoyaSfUz5W3+Lpi/CBkOIGaGOuitwcpTfzBSZIDZ9ORs9fq5oBh29\nJJcAdBNgVXfzThSiGvBgU4UIj41MlG4PG6St88VXCy0niEXWmjSkdcW3hZ0ai0SO\nlVxxEkYneg7RH9Seh+U3rRacrh4DgYQAAoGAOX41OCxx8mTuxpON/uZn6GwvK/m0\nK9fr/UmIX8D4Mp8PgnPLC71AOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7p\nLtuULoQdCgiYt1agVrioFSP6bEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n\n/IO5uUbWoPK5iAo=\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAP25RC69mW4t09jpaine5ZRHmOtqNJa2nbsRrSsZkvGXxbJ7ojxsybWf4kAAI4GpsGMzlrFrlMEpHQfebJAn+zJwGS+loR7T+gNz8JoVIgPF9dabXVymcygl4FB/sNAmV4XK3OjvSW1NCKdSkwZZr/gz5JBo1qAiQDKMD/ikWqq/AAAAFQC/rPmzFozpCeLbFQykOaDGFZaqaQAAAIEAw1hJAYQzn/ZboF/xXDHzP49uRpIIoyaSfUz5W3+Lpi/CBkOIGaGOuitwcpTfzBSZIDZ9ORs9fq5oBh29JJcAdBNgVXfzThSiGvBgU4UIj41MlG4PG6St88VXCy0niEXWmjSkdcW3hZ0ai0SOlVxxEkYneg7RH9Seh+U3rRacrh4AAACAOX41OCxx8mTuxpON/uZn6GwvK/m0K9fr/UmIX8D4Mp8PgnPLC71AOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7pLtuULoQdCgiYt1agVrioFSP6bEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n/IO5uUbWoPK5iAo=", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBvAIBAAKBgQD9uUQuvZluLdPY6Wop3uWUR5jrajSWtp27Ea0rGZLxl8Wye6I8\nbMm1n+JAACOBqbBjM5axa5TBKR0H3myQJ/sycBkvpaEe0/oDc/CaFSIDxfXWm11c\npnMoJeBQf7DQJleFytzo70ltTQinUpMGWa/4M+SQaNagIkAyjA/4pFqqvwIVAL+s\n+bMWjOkJ4tsVDKQ5oMYVlqppAoGBAMNYSQGEM5/2W6Bf8Vwx8z+PbkaSCKMmkn1M\n+Vt/i6YvwgZDiBmhjrorcHKU38wUmSA2fTkbPX6uaAYdvSSXAHQTYFV3804Uohrw\nYFOFCI+NTJRuDxukrfPFVwstJ4hF1po0pHXFt4WdGotEjpVccRJGJ3oO0R/Unofl\nN60WnK4eAoGAOX41OCxx8mTuxpON/uZn6GwvK/m0K9fr/UmIX8D4Mp8PgnPLC71A\nOwLy1HrCVi3ohCqeSY2C1uf1VWUVlSqMH85Pxc7pLtuULoQdCgiYt1agVrioFSP6\nbEyFdV8vGxA4YGh6cUSkeFZBJBrdNM4VmYBeT+3n/IO5uUbWoPK5iAoCFQCdYU1l\nO1pCZ3Jhf/YDAAnfQHAtMxAQEBAQEBAQEBAQEBAQEBA=\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa deleted file mode 100644 index f4170ac1..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEIJx7zPcbJg1zUAsBhKbmN0eOjbr+/W2qGSZTCP/c0mz4oAoGCCqGSM49 -AwEHoUQDQgAELN85t86lbEONGsyPNDxD/P2f9D9/ePBT3ZpAeVYUdyrVO00jO4JE -FPfKlVc4htC9oZbDaNeW1ssAIbn4uzigMQ== ------END EC PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub deleted file mode 100644 index 8f39dd68..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCzfObfOpWxDjRrMjzQ8Q/z9n/Q/f3jwU92aQHlWFHcq1TtNIzuCRBT3ypVXOIbQvaGWw2jXltbLACG5+Ls4oDE= old openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result deleted file mode 100644 index 68f3c147..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "old openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELN85t86lbEONGsyPNDxD/P2f9D9/\nePBT3ZpAeVYUdyrVO00jO4JEFPfKlVc4htC9oZbDaNeW1ssAIbn4uzigMQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCzfObfOpWxDjRrMjzQ8Q/z9n/Q/f3jwU92aQHlWFHcq1TtNIzuCRBT3ypVXOIbQvaGWw2jXltbLACG5+Ls4oDE=", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result deleted file mode 100644 index cfabd13a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAELN85t86lbEONGsyPNDxD/P2f9D9/\nePBT3ZpAeVYUdyrVO00jO4JEFPfKlVc4htC9oZbDaNeW1ssAIbn4uzigMQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBCzfObfOpWxDjRrMjzQ8Q/z9n/Q/f3jwU92aQHlWFHcq1TtNIzuCRBT3ypVXOIbQvaGWw2jXltbLACG5+Ls4oDE=", - "private": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIJx7zPcbJg1zUAsBhKbmN0eOjbr+/W2qGSZTCP/c0mz4oAoGCCqGSM49\nAwEHoUQDQgAELN85t86lbEONGsyPNDxD/P2f9D9/ePBT3ZpAeVYUdyrVO00jO4JE\nFPfKlVc4htC9oZbDaNeW1ssAIbn4uzigMQ==\n-----END EC PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc deleted file mode 100644 index 7e118d8d..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc +++ /dev/null @@ -1,8 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,4BE217089AE8B7311672C159E0690AB4 - -AkqjOP53cDHrdkJFRVLHYS7fSPVcIa4BgKegLwqRUqJOvEOnn5j6RYCh2CMdPjwN -rdw26Gc0V++xeMISAbrX4TGAQPWyDyiuoCffTIAfbkNq8YQR/sNJjNmZEgtCs6+O -4iBQ8TMXO+7oWRC221FDbTIhB6k4lXXph/HzdW0/Y2A= ------END EC PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub deleted file mode 100644 index 8efc1fe3..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBA4KgjqWJj9PR55PeF7t7PTXdx7cvMDqNkq4UTMjoXA5WtQYdoC2sxJnI5Psqvtrfa13C31gY8TlFAZ1cClnoBk= diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result deleted file mode 100644 index 3b3064ff..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDgqCOpYmP09Hnk94Xu3s9Nd3Hty8\nwOo2SrhRMyOhcDla1Bh2gLazEmcjk+yq+2t9rXcLfWBjxOUUBnVwKWegGQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBA4KgjqWJj9PR55PeF7t7PTXdx7cvMDqNkq4UTMjoXA5WtQYdoC2sxJnI5Psqvtrfa13C31gY8TlFAZ1cClnoBk=", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result deleted file mode 100644 index 423f6e20..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_ecdsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ecdsa-sha2-nistp256", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAEDgqCOpYmP09Hnk94Xu3s9Nd3Hty8\nwOo2SrhRMyOhcDla1Bh2gLazEmcjk+yq+2t9rXcLfWBjxOUUBnVwKWegGQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBA4KgjqWJj9PR55PeF7t7PTXdx7cvMDqNkq4UTMjoXA5WtQYdoC2sxJnI5Psqvtrfa13C31gY8TlFAZ1cClnoBk=", - "private": "-----BEGIN EC PRIVATE KEY-----\nMHcCAQEEIA7fGKE3wZkXb6jMcMriZujktUQ6FTC0SoTAa6fKDXY8oAoGCCqGSM49\nAwEHoUQDQgAEDgqCOpYmP09Hnk94Xu3s9Nd3Hty8wOo2SrhRMyOhcDla1Bh2gLaz\nEmcjk+yq+2t9rXcLfWBjxOUUBnVwKWegGQcHBwcHBwc=\n-----END EC PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa deleted file mode 100644 index 2eadbb0b..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIIEpAIBAAKCAQEA8wISnx2xWoeZur8yn/8NPykUY2mYyxn1n0mE5WJSo+mclFFS -mnN08WCt856AO8PMPuAn9cw0j3qJe0SKTnoMYSp+4fBsq6YHOGJvlRATF9SJkSIx -wBCYsMT+cf78vzhKRJrXAfJ/LWzV7b5gThHxj+Jby+fE/yePi8+Mb39UwYWGEFf+ -uRxcQIeuDX/VjPNtNKQPuO+HRi67WNXPFoUNmFXv1Ymn61S5duvVCxL8XdHXHdnZ -gIJ87CTlLBGPV/U9HrGJfl0AQ/jvMsvAV4IhMZMlV5QS2QigK7rkfBVe7k0NIWQ7 -Vwk5iunUpmUNVhKARdznvb8CJJm0ZEx4F2n8cQIDAQABAoIBAQCtZR46cSp6qWU1 -DnamGYyvM7W7lb6TtYtAxGnSb0z+bpPudPSXBqk8DrswqTlg674SY0nAJpyegFYX -Ifn6MzYgIv10ZGR2OjrOrdZmq5ikGWCrsZWEMZNyFq5kUwivvQ+pUj72wbyjghRH -1t7K9hzCiUbtAQzc77KKlWbkrBujFSp5EPNT67j5vV29WnZFbkPdUmfkM/ca/CZc -CWwvyAx19aFGyw3BsFhWQP5C9waT+QI9QZrVOA+8wTT11OcR6PT0oKdEmSYCKgHJ -JuYDWZ2XX2R2d5YNoxiqIZbCqQ/ayJuLOjLgQ1mx17pUyMNP3PoZCQXOi4jZWHZZ -+3/jqvJNAoGBAPmoL03KPvLVtHByEdxzPPfnonpYjfjlD4FvXgSQjdAcrTy4O06t -bDf4hMgUHQmDCyUakO45wyYwP0ISapQSBWniryjR/7U7/G/dX45fKRUeNoMvpmSC -qSEMAbd31Inpzuu5k0Y8p3hvoexeYlhbRkBL1ryx1LgIvC0TkWR+e6EvAoGBAPku -pHcpi3t2wewmP6f1krxtOLyvVt5RKaRjZ/2gNtzLPXL6ulQR5hufYlLKgyyyf2gJ -HxVFhCkfRjwVHV8qdIJc+Q4mjnjOeNfvqnzWOlSfZFegyWvOPW7hTX0/jZYGOb4I -7fzYyUPHnlu73twmshJMTzE1Ju7RdJXyLtg8xpRfAoGBAKjlyELXTWjZfP4Jnd3H -NHr+gSRGHp5A0RGe9zsdVGNz0xteA/mBR9JB1grJ2K8jsXmDlIMmHskKIPGhJetQ -mcr9qcRy9Yx1rZ08ZbYa2N9JllV/+hDLeII77jlh3y8CN5Ov81u0ExReaWxQmjXu -YgODix4TLLboae4Q6+7Rxu/PAoGAOZ04N7kqX/ygb+qUE1Crgde7I51i93pKp5C4 -baMKrFhtt9UTGfcdfkuG31+lnsMSxEo/npp5KUzq319+cA+P6sh2aXguvu32cO8g -O0cJK6HDAKPTjpKcD7QWR5xXL1X3KeJErI6vUnWoPsuchsiHqcVtFhKVEujpDPZ3 -MFY1D/8CgYBvv5mBb2kBf2/2JHp3lP/Q6LepEBkZk9dvoEU6/5xLvA5gEXR0MUj8 -g97Z1duGdXD/uEVRuRuOJkk4p8YmSM7t34st3lF06wdJUGcKvmZpp2ee+CdLwESi -GDCwcP5pcii56TVr09uHITWei4jFm+3Ye3h092dvPyNoEiJOgk2lsg== ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub deleted file mode 100644 index 1eaa7e03..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDzAhKfHbFah5m6vzKf/w0/KRRjaZjLGfWfSYTlYlKj6ZyUUVKac3TxYK3znoA7w8w+4Cf1zDSPeol7RIpOegxhKn7h8Gyrpgc4Ym+VEBMX1ImRIjHAEJiwxP5x/vy/OEpEmtcB8n8tbNXtvmBOEfGP4lvL58T/J4+Lz4xvf1TBhYYQV/65HFxAh64Nf9WM8200pA+474dGLrtY1c8WhQ2YVe/ViafrVLl269ULEvxd0dcd2dmAgnzsJOUsEY9X9T0esYl+XQBD+O8yy8BXgiExkyVXlBLZCKAruuR8FV7uTQ0hZDtXCTmK6dSmZQ1WEoBF3Oe9vwIkmbRkTHgXafxx old openssh format diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result deleted file mode 100644 index 720438a0..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "old openssh format", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8wISnx2xWoeZur8yn/8N\nPykUY2mYyxn1n0mE5WJSo+mclFFSmnN08WCt856AO8PMPuAn9cw0j3qJe0SKTnoM\nYSp+4fBsq6YHOGJvlRATF9SJkSIxwBCYsMT+cf78vzhKRJrXAfJ/LWzV7b5gThHx\nj+Jby+fE/yePi8+Mb39UwYWGEFf+uRxcQIeuDX/VjPNtNKQPuO+HRi67WNXPFoUN\nmFXv1Ymn61S5duvVCxL8XdHXHdnZgIJ87CTlLBGPV/U9HrGJfl0AQ/jvMsvAV4Ih\nMZMlV5QS2QigK7rkfBVe7k0NIWQ7Vwk5iunUpmUNVhKARdznvb8CJJm0ZEx4F2n8\ncQIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDzAhKfHbFah5m6vzKf/w0/KRRjaZjLGfWfSYTlYlKj6ZyUUVKac3TxYK3znoA7w8w+4Cf1zDSPeol7RIpOegxhKn7h8Gyrpgc4Ym+VEBMX1ImRIjHAEJiwxP5x/vy/OEpEmtcB8n8tbNXtvmBOEfGP4lvL58T/J4+Lz4xvf1TBhYYQV/65HFxAh64Nf9WM8200pA+474dGLrtY1c8WhQ2YVe/ViafrVLl269ULEvxd0dcd2dmAgnzsJOUsEY9X9T0esYl+XQBD+O8yy8BXgiExkyVXlBLZCKAruuR8FV7uTQ0hZDtXCTmK6dSmZQ1WEoBF3Oe9vwIkmbRkTHgXafxx", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result deleted file mode 100644 index affc996c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA8wISnx2xWoeZur8yn/8N\nPykUY2mYyxn1n0mE5WJSo+mclFFSmnN08WCt856AO8PMPuAn9cw0j3qJe0SKTnoM\nYSp+4fBsq6YHOGJvlRATF9SJkSIxwBCYsMT+cf78vzhKRJrXAfJ/LWzV7b5gThHx\nj+Jby+fE/yePi8+Mb39UwYWGEFf+uRxcQIeuDX/VjPNtNKQPuO+HRi67WNXPFoUN\nmFXv1Ymn61S5duvVCxL8XdHXHdnZgIJ87CTlLBGPV/U9HrGJfl0AQ/jvMsvAV4Ih\nMZMlV5QS2QigK7rkfBVe7k0NIWQ7Vwk5iunUpmUNVhKARdznvb8CJJm0ZEx4F2n8\ncQIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDzAhKfHbFah5m6vzKf/w0/KRRjaZjLGfWfSYTlYlKj6ZyUUVKac3TxYK3znoA7w8w+4Cf1zDSPeol7RIpOegxhKn7h8Gyrpgc4Ym+VEBMX1ImRIjHAEJiwxP5x/vy/OEpEmtcB8n8tbNXtvmBOEfGP4lvL58T/J4+Lz4xvf1TBhYYQV/65HFxAh64Nf9WM8200pA+474dGLrtY1c8WhQ2YVe/ViafrVLl269ULEvxd0dcd2dmAgnzsJOUsEY9X9T0esYl+XQBD+O8yy8BXgiExkyVXlBLZCKAruuR8FV7uTQ0hZDtXCTmK6dSmZQ1WEoBF3Oe9vwIkmbRkTHgXafxx", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEpAIBAAKCAQEA8wISnx2xWoeZur8yn/8NPykUY2mYyxn1n0mE5WJSo+mclFFS\nmnN08WCt856AO8PMPuAn9cw0j3qJe0SKTnoMYSp+4fBsq6YHOGJvlRATF9SJkSIx\nwBCYsMT+cf78vzhKRJrXAfJ/LWzV7b5gThHxj+Jby+fE/yePi8+Mb39UwYWGEFf+\nuRxcQIeuDX/VjPNtNKQPuO+HRi67WNXPFoUNmFXv1Ymn61S5duvVCxL8XdHXHdnZ\ngIJ87CTlLBGPV/U9HrGJfl0AQ/jvMsvAV4IhMZMlV5QS2QigK7rkfBVe7k0NIWQ7\nVwk5iunUpmUNVhKARdznvb8CJJm0ZEx4F2n8cQIDAQABAoIBAQCtZR46cSp6qWU1\nDnamGYyvM7W7lb6TtYtAxGnSb0z+bpPudPSXBqk8DrswqTlg674SY0nAJpyegFYX\nIfn6MzYgIv10ZGR2OjrOrdZmq5ikGWCrsZWEMZNyFq5kUwivvQ+pUj72wbyjghRH\n1t7K9hzCiUbtAQzc77KKlWbkrBujFSp5EPNT67j5vV29WnZFbkPdUmfkM/ca/CZc\nCWwvyAx19aFGyw3BsFhWQP5C9waT+QI9QZrVOA+8wTT11OcR6PT0oKdEmSYCKgHJ\nJuYDWZ2XX2R2d5YNoxiqIZbCqQ/ayJuLOjLgQ1mx17pUyMNP3PoZCQXOi4jZWHZZ\n+3/jqvJNAoGBAPmoL03KPvLVtHByEdxzPPfnonpYjfjlD4FvXgSQjdAcrTy4O06t\nbDf4hMgUHQmDCyUakO45wyYwP0ISapQSBWniryjR/7U7/G/dX45fKRUeNoMvpmSC\nqSEMAbd31Inpzuu5k0Y8p3hvoexeYlhbRkBL1ryx1LgIvC0TkWR+e6EvAoGBAPku\npHcpi3t2wewmP6f1krxtOLyvVt5RKaRjZ/2gNtzLPXL6ulQR5hufYlLKgyyyf2gJ\nHxVFhCkfRjwVHV8qdIJc+Q4mjnjOeNfvqnzWOlSfZFegyWvOPW7hTX0/jZYGOb4I\n7fzYyUPHnlu73twmshJMTzE1Ju7RdJXyLtg8xpRfAoGBAKjlyELXTWjZfP4Jnd3H\nNHr+gSRGHp5A0RGe9zsdVGNz0xteA/mBR9JB1grJ2K8jsXmDlIMmHskKIPGhJetQ\nmcr9qcRy9Yx1rZ08ZbYa2N9JllV/+hDLeII77jlh3y8CN5Ov81u0ExReaWxQmjXu\nYgODix4TLLboae4Q6+7Rxu/PAoGAOZ04N7kqX/ygb+qUE1Crgde7I51i93pKp5C4\nbaMKrFhtt9UTGfcdfkuG31+lnsMSxEo/npp5KUzq319+cA+P6sh2aXguvu32cO8g\nO0cJK6HDAKPTjpKcD7QWR5xXL1X3KeJErI6vUnWoPsuchsiHqcVtFhKVEujpDPZ3\nMFY1D/8CgYBvv5mBb2kBf2/2JHp3lP/Q6LepEBkZk9dvoEU6/5xLvA5gEXR0MUj8\ng97Z1duGdXD/uEVRuRuOJkk4p8YmSM7t34st3lF06wdJUGcKvmZpp2ee+CdLwESi\nGDCwcP5pcii56TVr09uHITWei4jFm+3Ye3h092dvPyNoEiJOgk2lsg==\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc deleted file mode 100644 index e5b63986..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-128-CBC,1380F5ADA0E0B636860A6BF78D47D6B2 - -ICLCebZN4+91mTQwByj210FD3D7kCxFA6kZ5fZ1TG34RzGynOSgUSdxPaXBHO4hC -DjS7lv6vrtaXPxlz5MVAhb6n0+X1pZDu5Wh5xjtkOt9yt4YPNKkvDPazSFBTHDth -jURe/aCLwXa+N5g5v1G/asb5dufA96tiPD8jjsBPm6RPq/444jAnLkid6YwTRLCk -a+IZZ+sX8onOq2xJM5NhsJxCEp5yquQCdyjvBBEBk5PExvWDHz4BIkK0WDR86IX/ -j4baAbTREiwP+EmVw1uogijvS+9nWPv3dQrtWwNQQNdWE2jJnsuDv44VAh1QQD7A -Txz2Y2A6IyzQsDxr6fL4JidVZOeeOXagYOBceZMs4IdNVJ52LJ9fqWtH1Eavj0za -c9zLgFN547l/Uqc334BQTkWhA9zGNkYJo4GCl/zjL2C6ce9gp0l6aBwSRyBmfH21 -pxFYqO/LQOSTbupeGzkNOpeNm/XtdOHe2N+2fiMO8hqEr6tOR4dsEUVBLCWt3tpD -C4jT3TtXKvx4qPV5N0w/umgXDd01Npk02k+wiQRnPBczFYLfRpceV/7MGtttV86/ -Ldl2p00q+JB6TzkHfOa4dA8oZJAwz3RPwmGYt/riJS4JOIpQGCs9lU3zgi7NTt4L -T9YAlAP3fjG1n3vy1uktKfRa+AoSqgS/pTJgB2srs6vxw3kt/V825cVyzSfGdQM/ -2oinmrbMAs0tRpTiHyqc/FjVRTW/8+LoSv/o6ZpN2x4jxkW/7cBH0Pcytvw8svd2 -Q+h92cfHuiNWi5tuiUkeDfjWEXo6ssVFA2t1ebTOk5y2wwPVAURf/jVxhEpFm4iY -PCIqwCwNSs1S05zAaIQ39ltBETj4Y46715GuYKsqLDYhv2lAIAlWXWgQ/N0tYVS6 -Oi/Qp9XFSEeyym5vzX/2ck1SJePvHvHewiABJjYzq3wlvIdWE6V3tJ3MRXRhlKNf -4bG8caItSG1n/QIeguNZI+A2Pu8AIdKjjKsnVcn3mikuKfcCAICZwf6m3Bd+Al7G -lrsJxyPqhhbPN1/t0w30tu8QuTSV+uMx4ZCKoUc6yJMQRmoM0RJ626re51IT2ikk -gB4f3Ms1VbB176it2L/zbXUAaxeE7Cbdcp/5058ksbuE0yA7JB+a2vQHFqw8Xxsb -qdKc4m4jkCdvaA5oNnGoG4milYukp1WVCGJeLD7gspTHR5dDYsOQgHvkxu+Ukor+ -0+1yvf8R6pRJWMoV0VvNkuSBUqcx94A+xLaEYCkB78Koum8xlPA1OA7VVkMVjQSk -r6c/iANbNV20IVz1TBpg9J1rQOGisbE43yRkH+aMgHnAnhk+UgK584QOH6eJpGZT -yBwes57P1kgT5VubavoJbeZLL6B70Sn/sKoLzxxruzPKmsmufJNK9klB7lu5f4gj -lvKtuNaiWbux1+fQmU+05nM1WW7s5Nm9MVUCfS5RxUq8SRqC7W17ouHEssW6mJT1 -jHK1xhoxX05X/T0NfdPzbG7S7+DG18Q6jnyHb28LeKLXv33sEUrT5z7+Nx4JS4XM -ZeMzPdRgYJw9vLQSYdksj0cNBb8UpAiG410lICrbPGWJh9d2KzhNKlfk/vLHia1V ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub deleted file mode 100644 index 806ab915..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDHLfm98g0aHjbQJcjbamutwkWTMY426a4IdwGrpAOv806h6wBXNcOj2VJbgeQ2/XkQ0RY78fGrHSacaadGsT9E5sRGyvkr/WtDpBokXrgpP15OvhfTaSMVTcty6qknndpu7P5nmSipdn9fQR9TyNRyAajhn+UINuquGfxyLL30W4IBqSISOcXKc0pScTdMOIOmkxxY+vQFydQpWF0a3TopKKa4b3sQJgqc0MJkREllT6U+0U4+YufoW6zZyMNIS2gxWUlGUiA5XveWSaYIXCaPQmps4WoO9AlrM7z1sTcG5yXn0kEUvTmBYUOUlffiBgXzArt4Pmm8gVklR5UH98y5 diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result deleted file mode 100644 index b4aad7b8..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.pub.result +++ /dev/null @@ -1,8 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxy35vfINGh420CXI22pr\nrcJFkzGONumuCHcBq6QDr/NOoesAVzXDo9lSW4HkNv15ENEWO/Hxqx0mnGmnRrE/\nRObERsr5K/1rQ6QaJF64KT9eTr4X02kjFU3LcuqpJ53abuz+Z5koqXZ/X0EfU8jU\ncgGo4Z/lCDbqrhn8ciy99FuCAakiEjnFynNKUnE3TDiDppMcWPr0BcnUKVhdGt06\nKSimuG97ECYKnNDCZERJZU+lPtFOPmLn6Fus2cjDSEtoMVlJRlIgOV73lkmmCFwm\nj0JqbOFqDvQJazO89bE3Bucl59JBFL05gWFDlJX34gYF8wK7eD5pvIFZJUeVB/fM\nuQIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHLfm98g0aHjbQJcjbamutwkWTMY426a4IdwGrpAOv806h6wBXNcOj2VJbgeQ2/XkQ0RY78fGrHSacaadGsT9E5sRGyvkr/WtDpBokXrgpP15OvhfTaSMVTcty6qknndpu7P5nmSipdn9fQR9TyNRyAajhn+UINuquGfxyLL30W4IBqSISOcXKc0pScTdMOIOmkxxY+vQFydQpWF0a3TopKKa4b3sQJgqc0MJkREllT6U+0U4+YufoW6zZyMNIS2gxWUlGUiA5XveWSaYIXCaPQmps4WoO9AlrM7z1sTcG5yXn0kEUvTmBYUOUlffiBgXzArt4Pmm8gVklR5UH98y5", - "private": null -} - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result deleted file mode 100644 index fddff0f2..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAxy35vfINGh420CXI22pr\nrcJFkzGONumuCHcBq6QDr/NOoesAVzXDo9lSW4HkNv15ENEWO/Hxqx0mnGmnRrE/\nRObERsr5K/1rQ6QaJF64KT9eTr4X02kjFU3LcuqpJ53abuz+Z5koqXZ/X0EfU8jU\ncgGo4Z/lCDbqrhn8ciy99FuCAakiEjnFynNKUnE3TDiDppMcWPr0BcnUKVhdGt06\nKSimuG97ECYKnNDCZERJZU+lPtFOPmLn6Fus2cjDSEtoMVlJRlIgOV73lkmmCFwm\nj0JqbOFqDvQJazO89bE3Bucl59JBFL05gWFDlJX34gYF8wK7eD5pvIFZJUeVB/fM\nuQIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDHLfm98g0aHjbQJcjbamutwkWTMY426a4IdwGrpAOv806h6wBXNcOj2VJbgeQ2/XkQ0RY78fGrHSacaadGsT9E5sRGyvkr/WtDpBokXrgpP15OvhfTaSMVTcty6qknndpu7P5nmSipdn9fQR9TyNRyAajhn+UINuquGfxyLL30W4IBqSISOcXKc0pScTdMOIOmkxxY+vQFydQpWF0a3TopKKa4b3sQJgqc0MJkREllT6U+0U4+YufoW6zZyMNIS2gxWUlGUiA5XveWSaYIXCaPQmps4WoO9AlrM7z1sTcG5yXn0kEUvTmBYUOUlffiBgXzArt4Pmm8gVklR5UH98y5", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEogIBAAKCAQEAxy35vfINGh420CXI22prrcJFkzGONumuCHcBq6QDr/NOoesA\nVzXDo9lSW4HkNv15ENEWO/Hxqx0mnGmnRrE/RObERsr5K/1rQ6QaJF64KT9eTr4X\n02kjFU3LcuqpJ53abuz+Z5koqXZ/X0EfU8jUcgGo4Z/lCDbqrhn8ciy99FuCAaki\nEjnFynNKUnE3TDiDppMcWPr0BcnUKVhdGt06KSimuG97ECYKnNDCZERJZU+lPtFO\nPmLn6Fus2cjDSEtoMVlJRlIgOV73lkmmCFwmj0JqbOFqDvQJazO89bE3Bucl59JB\nFL05gWFDlJX34gYF8wK7eD5pvIFZJUeVB/fMuQIDAQABAoIBAGuSfhZDGyZm+Q2T\nypYONNekW7Uyh29K5640r9dGfqNRkb9LT2TKab4dSiiXz2yPmwolEpAPjIjw9oB1\nY11/rv8Eby8YwlgqxvrCL0hDS80jJ0j5y55nYwZHfMC00eTOkUFlh8Tl6BsWH5aP\ncl7q0So9kTtCAw1bs4WSDVCQr4q/x7fZRQWeWudi4IjnCv5vn1Pgot7XxDwdFNQG\nDrkUHvYXv0M2OCdl7YN0D/bHQon5ney0YU10mtqGbkcEmu0woykW1Bc539b9AoD3\nxI6LVyY6/OEwGu5ctKolIVJjsguwfLJ9WR7SenR5nTzjJyxMdSfXtXkKPX2NZxpO\nziNYnm0CgYEA/afEFBu5Ld/TjYatdf7ezZe9iDx6vBzWmMtwkhr3OHCzVP1OIaB0\nSTsCWrTdoLFTMOizUHjj71vX5v5G4aCgaMXQnSDf13mxrFzR36w5oyJOBLjkHhol\nf0ROO7QCXK1hjBAUvnKwLPQvx1CAkDB9z+cT/BJwRCarfeLhrd/sGEMCgYEAyQVN\nOGIdRVBs3Q/8dbtaz+7LOv6IBZm2y9TKHKmfBm1txAsgkqRl7cfVTyczgAZfS/RB\nzrAje5UA+phCSPtyb5B+K1i/eHw7xDZrw8wauAKY8ILSadS9ZA0mU+7XCqsWhNqN\nrvuB5dttsTDgyXnMxCbYqCWAcyKn8jBh1cDo5VMCgYBe3iMQnjnI9YCK2wb/LZ6o\n6Aqj7HK+7k44gUYN7vXtbwEzVTWmj/tN9DryL9kAI7IIhc+i1kPxnrkGFK3v7wJv\njSRzz/rH/SS9YU3BSQmZgNgLHhd7Rq4lhid4Xt/PR61HFDCd9gj8FyvTcMFUrD4x\nxqwLx92jL49OGs/rFueXPwKBgBi46jJQ/sCTj4/wc2AXVqfT+nKa8yedK/oNhX3Y\n7pHfy2wc4jimt1JzDSza6V6JahbxR1agGv0L6j7nkt9e7UgDQUEbfRDYVpFfEAnY\nhEC1MRIDRNV3MIOpilkwOoo5WF+mcV5f2C3ouqjcFgkxTZmiHWswkYeXb4g9owqi\n2wG5AoGAb6/btpj3Ql+qYXRUH/cWPlLeFbKiGaAJ+Kn5RwlEW8D//FjKuV7fL7BN\nhvaDJUpwP9klNRny3IK6FWuFI0KDup0nyrIbS07h2rOCl/+g2erDuS5sofpu2zWU\nZDArpSmpU9EF6S8CvbbZmYvWzYUhYD/sEqIR+KSowNM4PA7g7fwKCgoKCgoKCgoK\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 deleted file mode 100644 index ceed0702..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256 +++ /dev/null @@ -1,54 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: AES-256-CBC,5C3291414FA514EE9647898A2D5315FD - -PaIGvR7qnyhxjz7RI4YEeua59B0XJm6cTW6xv2tbSVIC/njwljgo+UzXJLPUH1gv -suhNs8X+U9n0aCME6vFQvSJcloo6B1NLhGL1DVNhMAiGu+byCSJtq4cTFR5+7YUQ -HGB0a5vGBtHhL86TBeaBcKYfgCE4jo6/FAvzfk/eyy3S/oHXjMMUfCqo3WrBcgLu -SwhOEGd2k7vRp4gZzsCZy9xMM4Gykrgxc/hLzyvGQF8isF5Nz6xtPLNlW9xPdD48 -Fq5CTfljR4+7mM/kruJRysnbXEoYAaA8oZhZsRD5cw2tMOartA4qUieR9sKfrMo0 -Ci7OXNkdDK83OWGZs3NUYT/BzMmIPf982Ws46RHZLQOad3qTHvFdCUeQKwPJtQZM -D40xdbw462KQi+yr8+dPs9q3yxS5lr1rG+SmCAe/s+5Ta6E6VMb30Jb9FBP+91Z8 -6XxrF9jl67xaOwz/8rqUfiYm0C31YHiSsGlewe7lmvr4W+f47kn+lxEVXJD6UG+M -l/iJMZR39nr305K4GHG29NVS/9h1XC63/FZbL+50YCfavBikvEEDZoBKSKzs3Rlh -LZOTt6netyFuJtW0Z2CsYnvyyBioztD2yVGStS1MX652uDutFuqcBgm5FCdC1XDD -c5y83mH6ZWAjJSai8ap80XATO+xImb86paJ7u96mSAq7t+ziTCjlFTl3Mmtfoyrr -yy4IWSFIZ7BGdk2yeOR+kW+UNij5tS0J8s+Ug8hIh0ax9pvIB9opB0HmCVRg8reY -KUZNUwPlBtP2Y9dU63fKf0LNkzzMZduiqN8iD/lC771TxEU/tvl9cwr0rP3Shqm7 -UYkhPG+l0iXmX9fJwfJ+sfnT6zRfUKqeuN58YpoJ1zliv+4g9wDZWDzPlcktW3RU -CcZ9nKxRzQ9WppZzPoN0OMr+POt+S9hKufGfKP0D4pvIJ3KOGvk0A31iyQ5Ua6mI -emC67kES+3djSaLBeYax0AOzxnuHc/9dcC4meGzPy3RWRknxYxt0KMlo4zR42ZTR -Qh3eA1h6POEtrwsCMUD+tI3W6QwcCCmaJW6gfwZPSqPqbLwI21NVfUS++0V8qB1X -ugRUwN7gvX9rf+2jp+IjTVXai6xPkN4LqIX8jULYihKdR+tMm/sKTEGfc+peMrN9 -iljwsPztLzAIEjr4UppaLyhJJCp4BHdveVg0/uhgBqQTuMHZtKX31IHdDjeJc2n+ -iITqdh20lwLl6fwKsAl1oBf1GaRSOsd+oi2IyXqpfMpoXlo2q/r7ExPAzDXXg0bb -tA5Awa6Fndu5BR4e4UUDDVnj3AU175D4Nz6ZyXmCBC9nB6rvXXAa/gdh8+/HL1nS -7gDU9rws6dDRP3BAE7xM8QQ4VNaPikPPlikKNTY9rom32kKMmGD64dEPuZHl/i1i -gNcQfQoLDdwQJzqYcn9ZtcsE3hPJgqwO+wvK4MhnKlYXsRnGIQVNgEt9ler98Wap -eFKgl+Jf9z+T4uJka7yFzni1HQ1kvanYpI0w5ili46te/yPE96uzhRGqn1bu+/QI -e1rC5IMHu8cYV1a/baX8r9iwIXislq6fia5ivj0fmFTYbBJZ/M4LlY3zVXlJnIQj -iykB31s5faMTUE8CDdj+fr1Dc5ERPWgiI4PxXTquPUHq7B6dhsJ6RbYkgIoBhuam -Ok39LZ/R4nTiJY9VaJwQPvdrNnQEZ9lmMnh7d8jcsja4SVNFObC2ONQ2MVbr+dXd -jTHIlOF3aqWM0ZP4dh/Zg0rIy4koL1G88/vOpKAoVPZVmftqww63TPao3uny9nTK -BjwqzalPZwt0KFSoAGr3e8psQpCXwHoP98/GyE9NVBhR4X/I2IST4Sk0x62Gz1pg -ZrGpz7VDEySYAd8GBvdOuAawjmE41YwEofRrBb7ZPbwIxrO3ei/G8f5LBABRCmjO -ikzAk9mADCnfY08nfQ8mjZAIiTth6MuFG92TeJSi1W56p+krikVh0SUxEfXeR1CR -XOyshItaWQNx7OojB3P7JG7nrY046144oQuUb7mVUi4oQE+TxKLRvc0jLkWyKmjf -Ii+BZFHuU3lQiAarQ+mZEA0pXCGCT+NDZK5Eo4LBCrYBfaviWcWB6LQoovAF2T42 -zzx5qZP4ANS7l4SUCd5qS7/h3/ftCkLHTEcV0KBJ2n3blF6wdP/7C3wQD6AcRHWQ -132dnFlD/agQ6VOFjTg4hnw7BrUtIHATKlmMg36CtXtqJYnb9DQEQDo24dBNVNjM -W1Tpgw8xkyVb9kICiZoy+kXnqqkGOnLHT12h+/pgkJqZO61kfvwUeNAK0USG/h/L -TRop17tZjsg2O6R9/aS0SnyANBJ8xgxRAneWuX6ry7t9IDYOH1Ybcn4riLe+tgCM -YPpxTOCUw49dqdkTU6/n2vEXXIRPXIefxBhIk1bKelX/owIwe+3kNSL96HzEDvI9 -GwaLRxNgMLi5diI3yJmevantJJWIKUFhz3ud2viaSWNWdAvfVmEcb7APs67cJAr9 -4oKnhF4TuD2oowFnH3nykczXRqAqHn+N/XynH0QJrQDJYwnYWH/+5YFWaYwHACSK -ppOnWNqQ28zjA7w5GLI//rHRT0NBbFbVF7s0TQlBu0Rukc042eW692BX/2qVSCpZ -8aVjhBFFbnt4YmRSYlj/X7ICnddWqHSiRNy5RMokdMlZD1ELxYf2XkkZionTlT/E -hHSsA2c4HgP5Ep9svM7EWtFO7Melk2vjgXZxyELbLPZUQuYImuK2ziKqL05YH/lc -/yfAdXOKLWjrUgVBk8r6QqoAWP0iCTZDOmB7IwVu9nLClpnJDfT3kRrai2GIpg/D -1+eBAcr6aoRfpLTduW3EAit7SNzLZSkcBvaLkkqJ3tCPTq9GR05DzOaTGCf+vyve -kRNdTMSX5E6IH3xomKTIPZrEgOMEJpdsJ4wBCt2ginYZvHOFsn+YiLL212+rLOTH -qqSKZb0O5lxgQNjl62PJ9bzDEJkiuUinz83OlLAe7fSZiT3wwKG2x8PsZugRSk6K -txDqENJGzcDsX/MLNYdy6y2MnAWRYKNsmp0luX5Exw7L8ls8jUAMnd0DS0RFB0gN -14UzNa+ZO35Xr4vj8n2URnX9O2vs+A9jcDQU7TOp1/ejq3ISATrIAjeyqUHNZ+Xq ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub deleted file mode 100644 index 0df674aa..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDOHBVYZ041e+MqbjY+oSRiNNO1nDK1l0P6blyAyi4gwWfEOGSkqBZr+vCGnSj3/BNWsCcECbsG2TBMkoxCmXLc32rgQRz76/vON0gRaAzm+oi4N1hSSN7S/xX3XEwkH5OM/g9WKJvzerGejIExT9C6jzCvznlRdSTnntJrgwuf8ubyOfffXht66X/klC5+XeDI8SORiIr/E7q8QUpjcYYjgRgJHTjjh47xDGQOkcL+ceZb1/ufbU+4r7m8Ume/+fQuOTXcD13yKd1Na7auXMHL8Orh8YHvgwbFCVPOFDDEyReNgLLEaGGHJOuWaf55N+7J4CSDRkRqjz1tFqdqqHwdRr0/pJP77mjEe89Cx4iu+BDrT72/SPKo5bwDoXBa2TxSdoVHT9idjsUPDfwshD4eHtwyhrZkEiNY8Qp+F57I9MSgRT62zdO/vZ5wzEYDJC3DBXPw3owvpGdJEjSOhTD0rOFctNs/dKlwAXnU6QUAE1qgd9P+O3GIhYiPkrw3XsbF39VeouroYIbljv4KyDb+wQMk2U2wzUE/ZV/AVjV0OK/3colr43uxEhl6D48pWejzpQ6DMFKuL5pcxzZzIlBVmwwNsNb3DoWQ+a1gepyimp1ocUlv28JPqMMiarm/Kka86KY+fzcHUUPQXpz8R4edOLA2hQSudYdTcNmcAOpwMw== diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result deleted file mode 100644 index 3f23304a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.pub.result +++ /dev/null @@ -1,6 +0,0 @@ -{ "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzhwVWGdONXvjKm42PqEk\nYjTTtZwytZdD+m5cgMouIMFnxDhkpKgWa/rwhp0o9/wTVrAnBAm7BtkwTJKMQply\n3N9q4EEc++v7zjdIEWgM5vqIuDdYUkje0v8V91xMJB+TjP4PViib83qxnoyBMU/Q\nuo8wr855UXUk557Sa4MLn/Lm8jn3314beul/5JQufl3gyPEjkYiK/xO6vEFKY3GG\nI4EYCR0444eO8QxkDpHC/nHmW9f7n21PuK+5vFJnv/n0Ljk13A9d8indTWu2rlzB\ny/Dq4fGB74MGxQlTzhQwxMkXjYCyxGhhhyTrlmn+eTfuyeAkg0ZEao89bRanaqh8\nHUa9P6ST++5oxHvPQseIrvgQ60+9v0jyqOW8A6FwWtk8UnaFR0/YnY7FDw38LIQ+\nHh7cMoa2ZBIjWPEKfheeyPTEoEU+ts3Tv72ecMxGAyQtwwVz8N6ML6RnSRI0joUw\n9KzhXLTbP3SpcAF51OkFABNaoHfT/jtxiIWIj5K8N17Gxd/VXqLq6GCG5Y7+Csg2\n/sEDJNlNsM1BP2VfwFY1dDiv93KJa+N7sRIZeg+PKVno86UOgzBSri+aXMc2cyJQ\nVZsMDbDW9w6FkPmtYHqcopqdaHFJb9vCT6jDImq5vypGvOimPn83B1FD0F6c/EeH\nnTiwNoUErnWHU3DZnADqcDMCAwEAAQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAACAQDOHBVYZ041e+MqbjY+oSRiNNO1nDK1l0P6blyAyi4gwWfEOGSkqBZr+vCGnSj3/BNWsCcECbsG2TBMkoxCmXLc32rgQRz76/vON0gRaAzm+oi4N1hSSN7S/xX3XEwkH5OM/g9WKJvzerGejIExT9C6jzCvznlRdSTnntJrgwuf8ubyOfffXht66X/klC5+XeDI8SORiIr/E7q8QUpjcYYjgRgJHTjjh47xDGQOkcL+ceZb1/ufbU+4r7m8Ume/+fQuOTXcD13yKd1Na7auXMHL8Orh8YHvgwbFCVPOFDDEyReNgLLEaGGHJOuWaf55N+7J4CSDRkRqjz1tFqdqqHwdRr0/pJP77mjEe89Cx4iu+BDrT72/SPKo5bwDoXBa2TxSdoVHT9idjsUPDfwshD4eHtwyhrZkEiNY8Qp+F57I9MSgRT62zdO/vZ5wzEYDJC3DBXPw3owvpGdJEjSOhTD0rOFctNs/dKlwAXnU6QUAE1qgd9P+O3GIhYiPkrw3XsbF39VeouroYIbljv4KyDb+wQMk2U2wzUE/ZV/AVjV0OK/3colr43uxEhl6D48pWejzpQ6DMFKuL5pcxzZzIlBVmwwNsNb3DoWQ+a1gepyimp1ocUlv28JPqMMiarm/Kka86KY+fzcHUUPQXpz8R4edOLA2hQSudYdTcNmcAOpwMw==", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result deleted file mode 100644 index 8cf3c91a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/openssh_old_rsa_enc_aes256.result +++ /dev/null @@ -1,6 +0,0 @@ -{ "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAzhwVWGdONXvjKm42PqEk\nYjTTtZwytZdD+m5cgMouIMFnxDhkpKgWa/rwhp0o9/wTVrAnBAm7BtkwTJKMQply\n3N9q4EEc++v7zjdIEWgM5vqIuDdYUkje0v8V91xMJB+TjP4PViib83qxnoyBMU/Q\nuo8wr855UXUk557Sa4MLn/Lm8jn3314beul/5JQufl3gyPEjkYiK/xO6vEFKY3GG\nI4EYCR0444eO8QxkDpHC/nHmW9f7n21PuK+5vFJnv/n0Ljk13A9d8indTWu2rlzB\ny/Dq4fGB74MGxQlTzhQwxMkXjYCyxGhhhyTrlmn+eTfuyeAkg0ZEao89bRanaqh8\nHUa9P6ST++5oxHvPQseIrvgQ60+9v0jyqOW8A6FwWtk8UnaFR0/YnY7FDw38LIQ+\nHh7cMoa2ZBIjWPEKfheeyPTEoEU+ts3Tv72ecMxGAyQtwwVz8N6ML6RnSRI0joUw\n9KzhXLTbP3SpcAF51OkFABNaoHfT/jtxiIWIj5K8N17Gxd/VXqLq6GCG5Y7+Csg2\n/sEDJNlNsM1BP2VfwFY1dDiv93KJa+N7sRIZeg+PKVno86UOgzBSri+aXMc2cyJQ\nVZsMDbDW9w6FkPmtYHqcopqdaHFJb9vCT6jDImq5vypGvOimPn83B1FD0F6c/EeH\nnTiwNoUErnWHU3DZnADqcDMCAwEAAQ==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAACAQDOHBVYZ041e+MqbjY+oSRiNNO1nDK1l0P6blyAyi4gwWfEOGSkqBZr+vCGnSj3/BNWsCcECbsG2TBMkoxCmXLc32rgQRz76/vON0gRaAzm+oi4N1hSSN7S/xX3XEwkH5OM/g9WKJvzerGejIExT9C6jzCvznlRdSTnntJrgwuf8ubyOfffXht66X/klC5+XeDI8SORiIr/E7q8QUpjcYYjgRgJHTjjh47xDGQOkcL+ceZb1/ufbU+4r7m8Ume/+fQuOTXcD13yKd1Na7auXMHL8Orh8YHvgwbFCVPOFDDEyReNgLLEaGGHJOuWaf55N+7J4CSDRkRqjz1tFqdqqHwdRr0/pJP77mjEe89Cx4iu+BDrT72/SPKo5bwDoXBa2TxSdoVHT9idjsUPDfwshD4eHtwyhrZkEiNY8Qp+F57I9MSgRT62zdO/vZ5wzEYDJC3DBXPw3owvpGdJEjSOhTD0rOFctNs/dKlwAXnU6QUAE1qgd9P+O3GIhYiPkrw3XsbF39VeouroYIbljv4KyDb+wQMk2U2wzUE/ZV/AVjV0OK/3colr43uxEhl6D48pWejzpQ6DMFKuL5pcxzZzIlBVmwwNsNb3DoWQ+a1gepyimp1ocUlv28JPqMMiarm/Kka86KY+fzcHUUPQXpz8R4edOLA2hQSudYdTcNmcAOpwMw==", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIJKgIBAAKCAgEAzhwVWGdONXvjKm42PqEkYjTTtZwytZdD+m5cgMouIMFnxDhk\npKgWa/rwhp0o9/wTVrAnBAm7BtkwTJKMQply3N9q4EEc++v7zjdIEWgM5vqIuDdY\nUkje0v8V91xMJB+TjP4PViib83qxnoyBMU/Quo8wr855UXUk557Sa4MLn/Lm8jn3\n314beul/5JQufl3gyPEjkYiK/xO6vEFKY3GGI4EYCR0444eO8QxkDpHC/nHmW9f7\nn21PuK+5vFJnv/n0Ljk13A9d8indTWu2rlzBy/Dq4fGB74MGxQlTzhQwxMkXjYCy\nxGhhhyTrlmn+eTfuyeAkg0ZEao89bRanaqh8HUa9P6ST++5oxHvPQseIrvgQ60+9\nv0jyqOW8A6FwWtk8UnaFR0/YnY7FDw38LIQ+Hh7cMoa2ZBIjWPEKfheeyPTEoEU+\nts3Tv72ecMxGAyQtwwVz8N6ML6RnSRI0joUw9KzhXLTbP3SpcAF51OkFABNaoHfT\n/jtxiIWIj5K8N17Gxd/VXqLq6GCG5Y7+Csg2/sEDJNlNsM1BP2VfwFY1dDiv93KJ\na+N7sRIZeg+PKVno86UOgzBSri+aXMc2cyJQVZsMDbDW9w6FkPmtYHqcopqdaHFJ\nb9vCT6jDImq5vypGvOimPn83B1FD0F6c/EeHnTiwNoUErnWHU3DZnADqcDMCAwEA\nAQKCAgEAtDuwmr6zkGeGbYs02i2VoF8rpssxOMRPCIZLU7/4+GHH+LmLoMTv3nrw\nq/ZwZfJDgvHFHG3Z45I2/y7DglWnMOgaEII/8zgX2OtUlQwVBEKfHeAf1sysNXwk\n3EsUth36rDdad/BI93AaNFgPfWybTRh77bCzO/0hSX4D6UoN90+0jqsMS4KCq0fW\ns660vYIgV/cuMExjp8y75XV+tFkIgLGZsBaisazP3ZAFSwxBpLk7RKMpAO/Y39qi\no8C3wxOzaFxU8dtqPqJHSDVh6TVproo9C1liU2yTleejJjlXsC1c8DtTmBbi+gfa\nD40enye/Iz9jDnx6xWf+wg8mVUmCRZGxRvjvS/CjIEwNB6EX5vSCe4oM8lOg2V7f\nFynGpRYlP3vkcelNly5qf7mlb/Wkd7F8PnJ8JTHdTcGSalMJ3DKn063jn5eYFUQm\na40NkVAlDYOdeQZumCY7+v9Vontx4+0IrXlZJWr9EYyAEm80LlwenJ2s/YoTRwqV\nTfpWPaEcrNlZUq/2A9JM0m91gLktQaRLRyNnBvFap9504aWnLrD8m7tCWkzFf4wJ\nA+v9yN+lCveJPmNi5nW3Pzd1Xy3n126BN+yH7VUWVARKs8ZOUdOUMAg6ZVM0GnKe\nOt7AEAG5jsmGA5UQywtbGYOMonKBQqsqoWNKWTbbqbNbe4FyEqkCggEBAOzuRMHh\nI58/iv/TjG/t32CLdWRDM6cVvycoZL37zqObpzXo1LJHr1iCqxrEZnSzX5DCW3e5\nMbr3dq2GL02RfDb9Nta16dy/V6VzwK9bdavk9+CzJFoIvMVDqEZ6mVtTwvGrd6Aa\nnrTJjZjDG0dwfNe9LuNLmLSVE8p7WSWjU0E5XB45y1m53pIoQbqsR6cJPkiUGO2S\nUaR+xzxHeHv82zTavpf3T5+O+6UX6SRG5lx5Tk4ucUPzzwrry0PVdRERyZhJTjC3\nlG449RSrr1UOdwGE3Kkz4zEL14L661nDWogf9Yc6xsatSHSzVVdN9UY63e1pb8DN\ndEaNu0qddORTsD0CggEBAN6yxtydA+YMJ02C70PJZId3BeTLOzyk5ZCHU8kEEIFl\nRK4jW1kTXpxito2sSwDLYWnjHExnQiLFaYsVAhaxEFhS9bXrm9SWCjk7pD8XwdQ5\nBsi8uNz62W9cTNCHszwLCZ0HWKfsoQjodEbbAs3XS+F60i/e1RKAMsDm38tmO6rU\nSE1+81fgPpLTdT3cnAtwF51rxlgVQWFiohLxrSFvWS0X5eEvnoXZhqLMwdwQgUob\nuKuFDhMMleP17wbmA0QGdSWmUEgshx8g0Fx++BLqAcvSveQCkRGSn4RAfLq6I38S\n8ERJbbW9c2LjBKU2YyiuqdLcw0hVUJf0bGrOqHIFuS8CggEBAN4Z4bSJk3YGAAwf\nSGfoady7/pi1cmcvuJhBgmah9SxjjlS35SMWleX33+Pgtlaxi2VM/Kd3oImuzr6N\nqiwhtHpr1gtiTk8Tw1qi7r6zktRHeKJX7DzGMgcNjGI9LSNymq0nWqVoLtw0kJri\nUuEeLrmia6DAze6CTSIjjQb+Wt4qohLnhJug5GbIfA080JJh1NP+mHukDQqRmb0F\nFonMF8UtRTt5p1dglr9FcdUC7ZFEWcZqPN1BYRXQwiPdprcQoJU0Kqr6fJbyp7Pv\n2RV30NFItf2bWV8xxZ3QD+1+dpBivSw+SfYWnHRhZB/KQaHLLx0OGKd5MYWt+SNS\nBTDAztUCggEAEGOJvPyVJ93nGo4zO4LbshhxR5gpQNpFxrAe22FAMbWZK1OQymph\ngRLGqoBueJ1/CsLa90h2Fob+sGyYXcEkGcvpJz0yl59/Gx0nhjkiW5Liy+0Pkbuo\nOsjJImOKLjYFvBepT5pbc4Nf40ME3s8kV3CpfTph5d2nXojfGWHprDW5KHLaR7JK\nCJYlP6s3lKPoKP6gdyUBTcBrewdsHVTLdEUY9syBVwpeHScCcUaJrUGDAqRlF8PK\nWB9mOtS8ksoC3wVxTQ5x1zmb++KgMQwlm7Fjph8GPAvVT29LfpZqPFTRd8ULnN9X\nWYSpd9sbywenmcwDVxRoPPaQ7/9LaDDBowKCAQEAsoY/cxW+RrzavJYUZW8Zcdq5\n1/JHEGzr08FMRR+3UbeH8kpFQkc4/e/pobz/6ZRQkCasYGYc+5wZquYanbVsyJME\nkWBVREJ22kr3vjyueqgk1KQqYmOToOYNLYYS4TB0io84+HZTqsUKWXzJETc1TI6b\nMqslgSqd/jpK/BMTUUT9IrbAP7oGQcdcQ48R95LbjWlx/Mqe5mwmsSCex6b6ZKyk\nMGQJ7BG2Fjljs1NiHB3rwc50/wvUBsZmqMNQm/1/t3Nc9LQzJkUVe4IUSlQ56eBZ\n8k0JExiCAooRJNwUPAb8+GU+adYN7b4oPDCmAEgICojoX2PNLjAj9T1v4xPPcAIC\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc deleted file mode 100644 index 915508bd..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc +++ /dev/null @@ -1,17 +0,0 @@ -PuTTY-User-Key-File-2: ssh-dss -Encryption: aes256-cbc -Comment: dsa-key-20141202 -Public-Lines: 10 -AAAAB3NzaC1kc3MAAACBAJn2I8YefRo3BsEeinQt8KQ4cEyArAs7Y/W733oRSYOI -zWF1Ju124ysKrmg2okv+05CYcjV3Yp4AzQeomYAlgmB/7xCEnWaEnxCwAxmrrJMm -PrkwNjHOIi7yM5QOE90IM/Q+IJA4EPBfSb+Xr8fYhrp53KNHVSnc2KkOqpo2FsIj -AAAAFQC4NlP50GqyUqq2B82Vh/w5j3TzwQAAAIAeSGom9LLNdzcwCHnGfxKNnEz3 -55KITADTxiIpBvnQW+eDHwQvIw6V2Oc73bKCu5ZirZmIMW5w6KjQVwkuQBoF9Koq -/2u6VeevtL9pD6TBzSLMVw5pV3PmE4/C/eLiaUxZLIHdbzpqPkAvAUBrXKkj0ijz -cNzCp1fuF8H0pvR8yQAAAIAmvV+kqWhUgDYwNNz1qDaoS8XdsOponutZ/0stRQ66 -mKAy8kNVNNQ6oUx1XFl1WUt4iyFY/2Rz2fZhLz5/TbZRK5ygo666WgnxB/Ud4GAx -/BPQTghOJJOL00vJk+8jVCGNDc942V6nFXznDMXwqxhRCW6dm+2lTh7ntrli8mCk -5g== -Private-Lines: 1 -BytvbK+jNyMjiVxCO5lcE4YbW7q293oC+LZjkZ8Ajlw= -Private-MAC: c3da536ea28851fc32d5d1ff01498c8fcebc1170 diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result deleted file mode 100644 index 68edda76..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_dsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-dss", - "comment": "dsa-key-20141202", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBtjCCASsGByqGSM44BAEwggEeAoGBAJn2I8YefRo3BsEeinQt8KQ4cEyArAs7\nY/W733oRSYOIzWF1Ju124ysKrmg2okv+05CYcjV3Yp4AzQeomYAlgmB/7xCEnWaE\nnxCwAxmrrJMmPrkwNjHOIi7yM5QOE90IM/Q+IJA4EPBfSb+Xr8fYhrp53KNHVSnc\n2KkOqpo2FsIjAhUAuDZT+dBqslKqtgfNlYf8OY9088ECgYAeSGom9LLNdzcwCHnG\nfxKNnEz355KITADTxiIpBvnQW+eDHwQvIw6V2Oc73bKCu5ZirZmIMW5w6KjQVwku\nQBoF9Koq/2u6VeevtL9pD6TBzSLMVw5pV3PmE4/C/eLiaUxZLIHdbzpqPkAvAUBr\nXKkj0ijzcNzCp1fuF8H0pvR8yQOBhAACgYAmvV+kqWhUgDYwNNz1qDaoS8XdsOpo\nnutZ/0stRQ66mKAy8kNVNNQ6oUx1XFl1WUt4iyFY/2Rz2fZhLz5/TbZRK5ygo666\nWgnxB/Ud4GAx/BPQTghOJJOL00vJk+8jVCGNDc942V6nFXznDMXwqxhRCW6dm+2l\nTh7ntrli8mCk5g==\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1kc3MAAACBAJn2I8YefRo3BsEeinQt8KQ4cEyArAs7Y/W733oRSYOIzWF1Ju124ysKrmg2okv+05CYcjV3Yp4AzQeomYAlgmB/7xCEnWaEnxCwAxmrrJMmPrkwNjHOIi7yM5QOE90IM/Q+IJA4EPBfSb+Xr8fYhrp53KNHVSnc2KkOqpo2FsIjAAAAFQC4NlP50GqyUqq2B82Vh/w5j3TzwQAAAIAeSGom9LLNdzcwCHnGfxKNnEz355KITADTxiIpBvnQW+eDHwQvIw6V2Oc73bKCu5ZirZmIMW5w6KjQVwkuQBoF9Koq/2u6VeevtL9pD6TBzSLMVw5pV3PmE4/C/eLiaUxZLIHdbzpqPkAvAUBrXKkj0ijzcNzCp1fuF8H0pvR8yQAAAIAmvV+kqWhUgDYwNNz1qDaoS8XdsOponutZ/0stRQ66mKAy8kNVNNQ6oUx1XFl1WUt4iyFY/2Rz2fZhLz5/TbZRK5ygo666WgnxB/Ud4GAx/BPQTghOJJOL00vJk+8jVCGNDc942V6nFXznDMXwqxhRCW6dm+2lTh7ntrli8mCk5g==", - "private": "-----BEGIN DSA PRIVATE KEY-----\nMIIBugIBAAKBgQCZ9iPGHn0aNwbBHop0LfCkOHBMgKwLO2P1u996EUmDiM1hdSbt\nduMrCq5oNqJL/tOQmHI1d2KeAM0HqJmAJYJgf+8QhJ1mhJ8QsAMZq6yTJj65MDYx\nziIu8jOUDhPdCDP0PiCQOBDwX0m/l6/H2Ia6edyjR1Up3NipDqqaNhbCIwIVALg2\nU/nQarJSqrYHzZWH/DmPdPPBAoGAHkhqJvSyzXc3MAh5xn8SjZxM9+eSiEwA08Yi\nKQb50Fvngx8ELyMOldjnO92ygruWYq2ZiDFucOio0FcJLkAaBfSqKv9rulXnr7S/\naQ+kwc0izFcOaVdz5hOPwv3i4mlMWSyB3W86aj5ALwFAa1ypI9Io83DcwqdX7hfB\n9Kb0fMkCgYAmvV+kqWhUgDYwNNz1qDaoS8XdsOponutZ/0stRQ66mKAy8kNVNNQ6\noUx1XFl1WUt4iyFY/2Rz2fZhLz5/TbZRK5ygo666WgnxB/Ud4GAx/BPQTghOJJOL\n00vJk+8jVCGNDc942V6nFXznDMXwqxhRCW6dm+2lTh7ntrli8mCk5gIUCJZKAMAz\nkyr2vl2Pe48adi8Vs9s=\n-----END DSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa deleted file mode 100644 index 4504f18c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa +++ /dev/null @@ -1,26 +0,0 @@ -PuTTY-User-Key-File-2: ssh-rsa -Encryption: none -Comment: rsa-key-20150522 -Public-Lines: 6 -AAAAB3NzaC1yc2EAAAABJQAAAQB1quqP0rhl78NOLD4lj+1x5FGAqZ3aqo6GiEPz -KOaQmy86FuJMK0nHj3gUKTa/Kvaa+8PZyeu+uVseHg47YrynCOcJEEnpqvbArc8M -xMWuUnTUMrjvokGDOBBiQu4UAE4bybpgXkNHJfbrcDVgivmv3Ikn8PVIZ1rLBMLZ -6Lzn0rjPjFD0X4WqsAJW2SFiZnsjMZtVL2TWadNTyyfjjm2NCRBvd32VLohkSe9Q -BZBD6MW8YQyBKUnEF/7WNY0eehDVrfx1YqPOV1bDwFUhRaAYpLDLDR0KCAPvx7qb -8G5Cq0TIBsEr3H8ztNRcOTQoaKgn0T18M7cyS4ykoNLYW4Zx -Private-Lines: 14 -AAABACyF3DZraF3sBLXLjSL4MFSblHXfUHxAiPSiQzlpa/9dUCPRTrUJddzOgHZU -yJtcXU9mLm4VDRe7wZyxbSs6Hd5WZUGzIuLLEUH8k4hKdE/MLDSdkhV7qhX5iaij -tAeRaammRoVUGXTd7rnzGx2cXnnkvkZ22VmqkQ6MLg1DTmWNfOO9cdwFGdQawf/n -yUV0nTkWsHXy5Qrozq9wRFk8eyw+pFllxqavsNftZX8VDiQt27JLZPTU4LGkH660 -3gq1KhNS/l05TlXnMZGjlcPN8UEaBzmCWRezhJSttjs5Kgp1K3yDf4ozMR/HWOCj -Jq8fd3VIgli6ML8yjr/c0A0T9MUAAACBAL1/byxHiCvY/2C+/L5T+ZZq13jdZuYK -MmOFaNITgEdNGWSIFYRzhLKGXj7awQWOIW6chj470GNOfQjFL1TvXhbwfqW6esDa -kETOYQPYQHZijABcn7uurMUm/bu5x/z9gYkAfniOCI5vmvMvJ09JcZ0iUmFWDZZY -fAutBvrt+n/vAAAAgQCe9jrA51wn1/wzKmWF+2+OWFUG9usheIcEbHB8mxLguLfU -+x4i+2vLo0FtXEPAw+Bt7Tge4t0m6USiVZXtW/QKsh0kMj4mNVHFz+XXw4l1QOYv -n5TjnLepiP7majXv4GHI2eOcHkyly4sIkj4jNLYqvT86hMxW4IC+jtJEWhn/nwAA -AIEAlJ8cExu2WrWukTDJQHrVegtvdJUhNjol2wLucPuWwSxKuB8FHYwaPRYRkf3d -DkZ53hhjJZ0BVkAaQ28uqM09xKD+q1H4/r0nnbtlV4uHLl3cCD5mGrH8I/iDPJX4 -fFIqCa0+n1D6RzvDqs1QIu+PGSp0K6vHOOS5fP0ZpuT025E= -Private-MAC: 4ca26008c85b901f4d2766b0924c25e527678d7e diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result deleted file mode 100644 index 9ac4d2fe..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "rsa-key-20150522", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBHzANBgkqhkiG9w0BAQEFAAOCAQwAMIIBBwKCAQB1quqP0rhl78NOLD4lj+1x\n5FGAqZ3aqo6GiEPzKOaQmy86FuJMK0nHj3gUKTa/Kvaa+8PZyeu+uVseHg47Yryn\nCOcJEEnpqvbArc8MxMWuUnTUMrjvokGDOBBiQu4UAE4bybpgXkNHJfbrcDVgivmv\n3Ikn8PVIZ1rLBMLZ6Lzn0rjPjFD0X4WqsAJW2SFiZnsjMZtVL2TWadNTyyfjjm2N\nCRBvd32VLohkSe9QBZBD6MW8YQyBKUnEF/7WNY0eehDVrfx1YqPOV1bDwFUhRaAY\npLDLDR0KCAPvx7qb8G5Cq0TIBsEr3H8ztNRcOTQoaKgn0T18M7cyS4ykoNLYW4Zx\nAgEl\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAABJQAAAQB1quqP0rhl78NOLD4lj+1x5FGAqZ3aqo6GiEPzKOaQmy86FuJMK0nHj3gUKTa/Kvaa+8PZyeu+uVseHg47YrynCOcJEEnpqvbArc8MxMWuUnTUMrjvokGDOBBiQu4UAE4bybpgXkNHJfbrcDVgivmv3Ikn8PVIZ1rLBMLZ6Lzn0rjPjFD0X4WqsAJW2SFiZnsjMZtVL2TWadNTyyfjjm2NCRBvd32VLohkSe9QBZBD6MW8YQyBKUnEF/7WNY0eehDVrfx1YqPOV1bDwFUhRaAYpLDLDR0KCAPvx7qb8G5Cq0TIBsEr3H8ztNRcOTQoaKgn0T18M7cyS4ykoNLYW4Zx", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIIEoAIBAAKCAQB1quqP0rhl78NOLD4lj+1x5FGAqZ3aqo6GiEPzKOaQmy86FuJM\nK0nHj3gUKTa/Kvaa+8PZyeu+uVseHg47YrynCOcJEEnpqvbArc8MxMWuUnTUMrjv\nokGDOBBiQu4UAE4bybpgXkNHJfbrcDVgivmv3Ikn8PVIZ1rLBMLZ6Lzn0rjPjFD0\nX4WqsAJW2SFiZnsjMZtVL2TWadNTyyfjjm2NCRBvd32VLohkSe9QBZBD6MW8YQyB\nKUnEF/7WNY0eehDVrfx1YqPOV1bDwFUhRaAYpLDLDR0KCAPvx7qb8G5Cq0TIBsEr\n3H8ztNRcOTQoaKgn0T18M7cyS4ykoNLYW4ZxAgElAoIBACyF3DZraF3sBLXLjSL4\nMFSblHXfUHxAiPSiQzlpa/9dUCPRTrUJddzOgHZUyJtcXU9mLm4VDRe7wZyxbSs6\nHd5WZUGzIuLLEUH8k4hKdE/MLDSdkhV7qhX5iaijtAeRaammRoVUGXTd7rnzGx2c\nXnnkvkZ22VmqkQ6MLg1DTmWNfOO9cdwFGdQawf/nyUV0nTkWsHXy5Qrozq9wRFk8\neyw+pFllxqavsNftZX8VDiQt27JLZPTU4LGkH6603gq1KhNS/l05TlXnMZGjlcPN\n8UEaBzmCWRezhJSttjs5Kgp1K3yDf4ozMR/HWOCjJq8fd3VIgli6ML8yjr/c0A0T\n9MUCgYEAvX9vLEeIK9j/YL78vlP5lmrXeN1m5goyY4Vo0hOAR00ZZIgVhHOEsoZe\nPtrBBY4hbpyGPjvQY059CMUvVO9eFvB+pbp6wNqQRM5hA9hAdmKMAFyfu66sxSb9\nu7nH/P2BiQB+eI4Ijm+a8y8nT0lxnSJSYVYNllh8C60G+u36f+8CgYEAnvY6wOdc\nJ9f8MyplhftvjlhVBvbrIXiHBGxwfJsS4Li31PseIvtry6NBbVxDwMPgbe04HuLd\nJulEolWV7Vv0CrIdJDI+JjVRxc/l18OJdUDmL5+U45y3qYj+5mo17+BhyNnjnB5M\npcuLCJI+IzS2Kr0/OoTMVuCAvo7SRFoZ/58CgYBM0sw0i7O+v8F6P5blYFBtaZWf\ns7QYEfjAkAfmdpvJ4Px03Tkn284DL439zk5AhbqGydWO2fqJH9HTH4HkKbCF1x6W\nNtfRpLcHIzwWUMAv/nAb0oXyJDg0QD1Z8V7qBehn+UgHXCz7eVp+Q4x6FtsIWgW4\nwgWCI99DAPT98cZrNwKBgBEvYEw0sAROs3snLZHxqzH7tipENRhgDpixxvi20ZvA\n8Ud1GAPIJ1RJACd/mJ83xTxQ/yXvAybNHC05r1fuQ+V7ChHAPhH37SokUDMAYeMp\nnFgs7YBj+C4A+PZQq+KUzE0Qovwe84eLoFP0ImSrwKqsrOO7VFxrTDBGyp+bCbrF\nAoGBAJSfHBMbtlq1rpEwyUB61XoLb3SVITY6JdsC7nD7lsEsSrgfBR2MGj0WEZH9\n3Q5Ged4YYyWdAVZAGkNvLqjNPcSg/qtR+P69J527ZVeLhy5d3Ag+Zhqx/CP4gzyV\n+HxSKgmtPp9Q+kc7w6rNUCLvjxkqdCurxzjkuXz9Gabk9NuR\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc deleted file mode 100644 index 6f2f7f77..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc +++ /dev/null @@ -1,18 +0,0 @@ -PuTTY-User-Key-File-2: ssh-rsa -Encryption: aes256-cbc -Comment: rsa-key-20141119 -Public-Lines: 4 -AAAAB3NzaC1yc2EAAAABJQAAAIBrBWETAVAyJmuNG53jwTNDlbIcH5lrEvcx6lx5 -bM6EKg0XmOIH96VqUjS7eRRTTD9lpBA8hYhkrOjOx93/JWB/pcVN8/B3DYHshT9O -BW1DCkrNwut2pbJ2oZOBirhhAr+xqWFr3551FqbzaCIXpOKubr4EcIwCipBl6PxL -USfHgw== -Private-Lines: 8 -8O3NrBePR4+4RHHys8wrRKCmgx3Gsdz1cKoRJJDgnnrQxuAxBTVUlVTC2vzSOXrP -jlKdRP9DbtrL5YF8g9HkMPpzzTdgpiEAGikpIc+L0sJhN+S9VvMoXRRKqyuB7o1C -xZhAeRaZ68izdUUbFd7ajUwBNpGoFppOznGXyf/3/Ao9FfoTKReZzeBd/e2/JFhc -nsYkSbtWfKQBVXF1Fhr10UwRWSMaVJSDkcSuk8ghICoKBBCgRBnZFap0SR77oIJh -DKgmNFktoKzEqh111vYPhQyEEyGNxpD0aEPaGUJEjPEd3C5a46n7mIiqrNX7QJoo -xxZtkueGdXWaoe5mBf1tFc+nCA1l72nUlghJZooQhnO9NPpieu6NNZ8X+tFQ1Rq/ -xvOZHzpDOOeOgWdV7oAmRDbDjYPh0H67z2OKCFaP0Z9kgmnwqV2IJvTDrexj1VwY -6kFaPldnK+ohXl37oVIlWA== -Private-MAC: 9d09a15a122e48955682ba969d33c75ba8e4be2c diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result deleted file mode 100644 index f9ff9587..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/ppk_rsa_enc.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "rsa-key-20141119", - "public": "-----BEGIN PUBLIC KEY-----\nMIGcMA0GCSqGSIb3DQEBAQUAA4GKADCBhgKBgGsFYRMBUDIma40bnePBM0OVshwf\nmWsS9zHqXHlszoQqDReY4gf3pWpSNLt5FFNMP2WkEDyFiGSs6M7H3f8lYH+lxU3z\n8HcNgeyFP04FbUMKSs3C63alsnahk4GKuGECv7GpYWvfnnUWpvNoIhek4q5uvgRw\njAKKkGXo/EtRJ8eDAgEl\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAABJQAAAIBrBWETAVAyJmuNG53jwTNDlbIcH5lrEvcx6lx5bM6EKg0XmOIH96VqUjS7eRRTTD9lpBA8hYhkrOjOx93/JWB/pcVN8/B3DYHshT9OBW1DCkrNwut2pbJ2oZOBirhhAr+xqWFr3551FqbzaCIXpOKubr4EcIwCipBl6PxLUSfHgw==", - "private": "-----BEGIN RSA PRIVATE KEY-----\nMIICWQIBAAKBgGsFYRMBUDIma40bnePBM0OVshwfmWsS9zHqXHlszoQqDReY4gf3\npWpSNLt5FFNMP2WkEDyFiGSs6M7H3f8lYH+lxU3z8HcNgeyFP04FbUMKSs3C63al\nsnahk4GKuGECv7GpYWvfnnUWpvNoIhek4q5uvgRwjAKKkGXo/EtRJ8eDAgElAoGA\nU+GfHLvXEozQ1mHA8MfcEmCShL7SMVQN2wPL8HfgImYl7+aHpWE8de1nmdtwy6p2\n4PY2PUYQ9PY57i3zL8NZd8WQ7Rg0RBHDlndaFeF4Ef0uLboqYd/xN0rzfy55z7hW\nOL+8VhoxTrBUvveOhZwBPkOeHfxmkVz3xbbrg3kNlo0CQQDJYPKtCs/l46KJmN3l\nUANdI4QIuWQ+Zllz7p94FfdotnkvqG++Bp1wOqJSCih6UViwLfvpNZtGMCtk46WN\nhc0zAkEAiAyN4WUs/0x4WovG956J1A+uSEKeWzuqfpGGbWgZ9XfnPnk+1Al8FOW1\ntu9WWrMPIavQnZW/dXxhkeNWTH78cQJBALkM+qzZgMVpZO0ksDqA4H8Zt5lQafQm\nsxCWFf+le5CnraFqWNghwRsFcpCTtn486bamy89hsUdqiL2S6ygaFoECQFDk3r1e\nwM8mjMA3b2LM+AGMyH3+GPf59qwfLVXPMgeTZubgTt7w4f6WbAvoQS8Crw0aDVbH\nvfLUVbCwr9p1BM0CQFSBjCa/fzeICVkPFBaKQUmXjQ3IcPTOr90mSAiPnAAppSwT\nj5SYSfE9rSVb+EhQ0hk2VKWIfocNHBD1MAN9zb4=\n-----END RSA PRIVATE KEY-----" -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub deleted file mode 100644 index 3bfd6e84..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub +++ /dev/null @@ -1,9 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Comment: "2048-bit RSA" -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result deleted file mode 100644 index fcc05534..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "2048-bit RSA", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub deleted file mode 100644 index e42f5c1c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub +++ /dev/null @@ -1,10 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Comment: 2048-bit RSA -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- - diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result deleted file mode 100644 index fcc05534..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa2.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "2048-bit RSA", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub deleted file mode 100644 index 24a107b0..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub +++ /dev/null @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Comment: this is a special \ -multi-line comment\ - how cool is that not? -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result deleted file mode 100644 index 25dae671..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa3.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "this is a special multi-line comment how cool is that not?", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub deleted file mode 100644 index 0454a858..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub +++ /dev/null @@ -1,11 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Comment: "this is a special \ -multi-line comment\ - how cool is that not?" -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result deleted file mode 100644 index 25dae671..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa4.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "this is a special multi-line comment how cool is that not?", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub deleted file mode 100644 index 14608c11..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub +++ /dev/null @@ -1,8 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result deleted file mode 100644 index a61d7792..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa5.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub deleted file mode 100644 index 24a22612..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub +++ /dev/null @@ -1,13 +0,0 @@ ----- BEGIN SSH2 PUBLIC KEY ---- -Subject: "nodejs" -x-foo: something\ -completely\ -different -Comment: "Foo bar baz" -AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKC -nbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCH -S/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1m -gJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW -61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc -9lK/C2jItA3fwq9PHfCM1D ----- END SSH2 PUBLIC KEY ---- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result b/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result deleted file mode 100644 index ed7a4f52..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/keyParser/rfc4716_rsa6.pub.result +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type": "ssh-rsa", - "comment": "Foo bar baz", - "public": "-----BEGIN PUBLIC KEY-----\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4q6eZdx7LYh46PcZNcS3\nCnO7GuYsEJZeTj5LQSgp21IyTelaBPprijnMwKa+pLQt5TEobpKFFNecPdT6oPoO\nKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHMBNkoTFeGrursPkqYRJ0HL4CqYq\nRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKbzibJc64JFM7tUoK6Vl64\nYiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs8zjxsf6c6N2tKX\nkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38KvTx3wjN\nQwIDAQAB\n-----END PUBLIC KEY-----", - "publicSSH": "AAAAB3NzaC1yc2EAAAADAQABAAABAQDirp5l3HstiHjo9xk1xLcKc7sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+lfQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg64MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1D", - "private": null -} diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/openssh_new_rsa b/reverse_engineering/node_modules/ssh2/test/fixtures/openssh_new_rsa deleted file mode 100644 index ccded2a2..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/openssh_new_rsa +++ /dev/null @@ -1,27 +0,0 @@ ------BEGIN OPENSSH PRIVATE KEY----- -b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAABFwAAAAdzc2gtcn -NhAAAAAwEAAQAAAQEA4q6eZdx7LYh46PcZNcS3CnO7GuYsEJZeTj5LQSgp21IyTelaBPpr -ijnMwKa+pLQt5TEobpKFFNecPdT6oPoOKKMe6oH/pX0BNyAEB9KFZfZgh0v4J4IOiO0KHM -BNkoTFeGrursPkqYRJ0HL4CqYqRdINy1sgDU6jUIOuDD5XZzlpDXb1ftZoCei9OHSWrMKb -zibJc64JFM7tUoK6Vl64YiPgxsNXOJYMTrelVJYebtsNrJFmh3XXQABDVutWMYb8I6IrNs -8zjxsf6c6N2tKXkk9G4EDKKip4g0bzDmD/fREPQ9vLi59N+ZsyjWCKKE3PZSvwtoyLQN38 -KvTx3wjNQwAAA8hLhVBxS4VQcQAAAAdzc2gtcnNhAAABAQDirp5l3HstiHjo9xk1xLcKc7 -sa5iwQll5OPktBKCnbUjJN6VoE+muKOczApr6ktC3lMShukoUU15w91Pqg+g4oox7qgf+l -fQE3IAQH0oVl9mCHS/gngg6I7QocwE2ShMV4au6uw+SphEnQcvgKpipF0g3LWyANTqNQg6 -4MPldnOWkNdvV+1mgJ6L04dJaswpvOJslzrgkUzu1SgrpWXrhiI+DGw1c4lgxOt6VUlh5u -2w2skWaHdddAAENW61Yxhvwjois2zzOPGx/pzo3a0peST0bgQMoqKniDRvMOYP99EQ9D28 -uLn035mzKNYIooTc9lK/C2jItA3fwq9PHfCM1DAAAAAwEAAQAAAQAmShSbZBiyYkD6KPLr -MCUy8MWED6kVzDB1yvPvN5eKYmH44xe/i4UqvgSl7gR50a2G7zzDIKC2Go1brGQBWPuXRa -ZtOjQygeD4rMHBiH/b7zfy4pQyKDfITTHOFXWE8ERiyL00bAZt09icCy92rQaq8IY/+U56 -sPPJH9UAYG9nEev8opFjAWToFDu0U2+dC+lbqLlXDqDRo75NlnDFmgUoja3y2eFr9A0Cc+ -hjecrdxyJFsCJfEfaLWtBnZb886gqzzvfbHImSQtBAKERcSxuki7uxMoP67g3iQOXa65uz -8kFWRNmbQTGQttakoUaybh1t9eLpBqvVON/4Kg0THShRAAAAgFBTz2ajBK/R/crOSL9VK1 -f7oQv2iJTRVfnUs0r+qPGgf/a/5UwkGRj0KfEWBp3qYD+keShnPr6PDPFrm8UmIdUX8AY7 -3tWT2K/JQVlzJNuINsw+DNjn4M17Z25q0LPmReRWL0nRc2w6W/hmQ/Jmqz6w8Qc4+xpeqS -/HG5feliVnAAAAgQD90a+5Ky3o/2YtueqRf/3dKoiMgGB7JAOzye4dDKGABSlWuQ4N4xEI -CW5MSTp7i/uobTF/tyFO3tTSyb5b2Xwbn/kLO0vgvFCdUGR2BQfN3mcT92T0Gn3JDF3Wym -i2mgU6qnPf+eu+RKZQ9IiyNGny61ROUQa0R0z0pgiAfA89xwAAAIEA5KE9i6hHmigJwfD7 -/AGI4ujyWIVpNyrTdXG3HAPhsdoFuG5ggHggrPuuBF9wNcosrhL20VNOQGHg15gWZIVudu -0qxky4ivQs67Sk9XUjuvTnf+VubM51rIsmh4atKJFSSZo78DEcTRt8aXLrSNvGQ4WPRweM -2Z0YGfMMDM9KJKUAAAASbmV3IG9wZW5zc2ggZm9ybWF0AQ== ------END OPENSSH PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_dsa_key b/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_dsa_key deleted file mode 100644 index 5448947f..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_dsa_key +++ /dev/null @@ -1,12 +0,0 @@ ------BEGIN DSA PRIVATE KEY----- -MIIBuwIBAAKBgQDEK+daQ7RuajwxkmBmogb0iUSi/w2RYKuvC2EiviBu3S2s9Bfq -gROKscAnURrxpTOa+iYeI7hRzfuX0qFmnFwXIjKJBjqBdg9r76UR5UNytnWQkJ5x -lxsZThMeAMw38SvmRMw15kkgxycKGqu4yvNLGyVwN02bPVjLcEVLWLCM1wIVAK50 -5JqF0nmGXFkcmNtxR24/mNXTAoGBAIc2p8C8b08OTQPmfZI+Wq8a+CuEr5R36bMW -TAs5etqmO2aVo5zvR0MnTjoS2ZDbuznDG9RiSuIB+ivr/daEwi+K+Ha8pZfYjXCG -ldzvmr5I4x8rkH3zyn7BADnc+/q3pa8AnZvTme5eNsxn1Pu/rmC/8KKnhmzRggqP -N8ORhoQQAoGAMCvoMcsDAui2d/WVpgHZZEFlxfbf4dPUPYb5zf2xOiMG9OK+Cbv3 -NaLZwk/Hd2g4L3nwTKDASxfmRcrbuaOg/d7aDjQ2mJz18Js4IjY34QpgLspGCNX/ -6rJSQ+ov1Z2Etr95N4Tzm3qpxW5BH9TTgaC/ntb9NRqIzNPCvAHXmlcCFBxgZpyb -4GUgmqhTOMtmBkJ7QpL9 ------END DSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key b/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key deleted file mode 100644 index 04764423..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_ecdsa_key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN EC PRIVATE KEY----- -MHcCAQEEICrdbIIYmW/XTK9hxaQZZ56IGwG0NhqD2eppYUJNZsECoAoGCCqGSM49 -AwEHoUQDQgAEa+MuLv++3ft5HPFIsM2hQnmHPF12q08/MaHoGud4yqp3evyomjZN -xbsSb39fv8t6XX1u1rm5oHQcBV5Mqomaeg== ------END EC PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_rsa_key b/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_rsa_key deleted file mode 100644 index 9c2cc6fa..00000000 --- a/reverse_engineering/node_modules/ssh2/test/fixtures/ssh_host_rsa_key +++ /dev/null @@ -1,15 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQC57UB/5H0M+t+mopksrltCCIXghryzofJjau+8tuMT9CG6ta3S -O9aKApJUUG/xtc88giVhB7HFABX/oob+jrkSthR8s/whULC8E+GhvOBjHydRUZIs -aPYOMBb42HcbOsgq3li/hwOcDk0vY00hZDKCum9BgvRAb7dPEkw2dmiCQQIDAQAB -AoGAMG+HOwoaLbR5aR64yrQNYBF6Vvii1iUdURr9o2r9kygpVUuZIcim5kMvPbnK -v+w+NaQt+q4XeJvCH1uG0W/69FwnphfaOVmCCUtsoJ6sU3fWr9x59MtKL2Llh8xR -50lz6R+eDXoYRDq245hG9BFn/bu0vtqQqx06mlZJcjaRocECQQDjdYFmr+DSww3x -VNx0G0DUkaQZZ+iqZiT3Zund2pcBB4aLiewOrqj0GFct4+YNzgxIXPejmS0eSokN -N2lC3NxZAkEA0UGjN5TG5/LEK3zcYtx2kpXryenrYORo1n2L/WPMZ0mjLQyd4LJr -ibfgVUfwX/kV3vgGYLwjpgcaTiMsecv4KQJAYMmMgZSPdz+WvD1e/WznXkyG5mSn -xXJngnrhQw0TulVodBIBR5IcxJli510VdIRcB6K/oXa5ky0mOmB8wv3WKQJBAKEF -PxE//KbzWhyUogm4180IbD4dMDCI0ltqlFRRfTJlqZi6wqnq4XFB+u/kwYU4aKoA -dPfvDgduI8HIsyqt17ECQDI/HC8PiYsDIOyVpQuQdIAsbGmoavK7X1MVEWR2nj9t -7BbUVFSnVKynL4TWIJZ6xP8WQwkDBQc5WjognHDaUTQ= ------END RSA PRIVATE KEY----- diff --git a/reverse_engineering/node_modules/ssh2/test/test-exec.js b/reverse_engineering/node_modules/ssh2/test/test-exec.js deleted file mode 100644 index 86b2e316..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-exec.js +++ /dev/null @@ -1,578 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const { - mustCall, - mustCallAtLeast, - setupSimple, -} = require('./common.js'); - -const DEBUG = false; - -const setup = setupSimple.bind(undefined, DEBUG); - -{ - const { client, server } = setup('Simple exec()'); - - const COMMAND = 'foo --bar'; - const STDOUT_DATA = 'stdout data!\n'; - const STDERR_DATA = 'stderr data!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === COMMAND, - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.stderr.write(STDERR_DATA); - stream.write(STDOUT_DATA); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let out = ''; - let outErr = ''; - const events = []; - const EXPECTED_EVENTS = [ 'exit', 'close' ]; - const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ]; - client.on('close', mustCall(() => { - assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`); - assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`); - assert.deepStrictEqual( - events, - EXPECTED_EVENTS, - `Wrong command event order: ${events}` - ); - })).exec(COMMAND, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.on('data', mustCallAtLeast((d) => { - out += d; - })).on('exit', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong exit args: ${inspect(args)}`); - events.push('exit'); - })).on('close', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong close args: ${inspect(args)}`); - events.push('close'); - })).stderr.on('data', mustCallAtLeast((d) => { - outErr += d; - })); - })); - })); -} - -{ - const { client, server } = setup('Simple exec() (exit signal)'); - - const COMMAND = 'foo --bar'; - const STDOUT_DATA = 'stdout data!\n'; - const STDERR_DATA = 'stderr data!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === COMMAND, - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.stderr.write(STDERR_DATA); - stream.write(STDOUT_DATA); - assert.throws(() => stream.exit('SIGFAKE')); - stream.exit('SIGKILL'); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let out = ''; - let outErr = ''; - const events = []; - const EXPECTED_EVENTS = [ 'exit', 'close' ]; - const EXPECTED_EXIT_CLOSE_ARGS = [ null, 'SIGKILL', false, '' ]; - client.on('close', mustCall(() => { - assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`); - assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`); - assert.deepStrictEqual( - events, - EXPECTED_EVENTS, - `Wrong command event order: ${events}` - ); - })).exec(COMMAND, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.on('data', mustCallAtLeast((d) => { - out += d; - })).on('exit', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong exit args: ${inspect(args)}`); - events.push('exit'); - })).on('close', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong close args: ${inspect(args)}`); - events.push('close'); - })).stderr.on('data', mustCallAtLeast((d) => { - outErr += d; - })); - })); - })); -} - -{ - const { client, server } = setup('Simple exec() (exit signal -- no "SIG")'); - - const COMMAND = 'foo --bar'; - const STDOUT_DATA = 'stdout data!\n'; - const STDERR_DATA = 'stderr data!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === COMMAND, - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.stderr.write(STDERR_DATA); - stream.write(STDOUT_DATA); - assert.throws(() => stream.exit('FAKE')); - stream.exit('KILL'); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let out = ''; - let outErr = ''; - const events = []; - const EXPECTED_EVENTS = [ 'exit', 'close' ]; - const EXPECTED_EXIT_CLOSE_ARGS = [ null, 'SIGKILL', false, '' ]; - client.on('close', mustCall(() => { - assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`); - assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`); - assert.deepStrictEqual( - events, - EXPECTED_EVENTS, - `Wrong command event order: ${events}` - ); - })).exec(COMMAND, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.on('data', mustCallAtLeast((d) => { - out += d; - })).on('exit', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong exit args: ${inspect(args)}`); - events.push('exit'); - })).on('close', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong close args: ${inspect(args)}`); - events.push('close'); - })).stderr.on('data', mustCallAtLeast((d) => { - outErr += d; - })); - })); - })); -} - -{ - const { client, server } = setup('Exec with signal()'); - - const COMMAND = 'foo --bar'; - const STDOUT_DATA = 'stdout data!\n'; - const STDERR_DATA = 'stderr data!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let stream; - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === COMMAND, - `Wrong exec command: ${info.command}`); - stream = accept(); - stream.stderr.write(STDERR_DATA); - stream.write(STDOUT_DATA); - })).on('signal', mustCall((accept, reject, info) => { - assert(info.name === 'INT', `Wrong client signal name: ${info.name}`); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let out = ''; - let outErr = ''; - const events = []; - const EXPECTED_EVENTS = [ 'exit', 'close' ]; - const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ]; - client.on('close', mustCall(() => { - assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`); - assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`); - assert.deepStrictEqual( - events, - EXPECTED_EVENTS, - `Wrong command event order: ${events}` - ); - })).exec(COMMAND, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - const sendSignal = (() => { - let sent = false; - return () => { - if (sent) - return; - sent = true; - assert.throws(() => stream.signal('FAKE')); - assert.throws(() => stream.signal('SIGFAKE')); - stream.signal('SIGINT'); - }; - })(); - stream.on('data', mustCallAtLeast((d) => { - out += d; - sendSignal(); - })).on('exit', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong exit args: ${inspect(args)}`); - events.push('exit'); - })).on('close', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong close args: ${inspect(args)}`); - events.push('close'); - })).stderr.on('data', mustCallAtLeast((d) => { - outErr += d; - })); - })); - })); -} - -{ - const { client, server } = setup('Exec with signal() -- no "SIG"'); - - const COMMAND = 'foo --bar'; - const STDOUT_DATA = 'stdout data!\n'; - const STDERR_DATA = 'stderr data!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let stream; - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === COMMAND, - `Wrong exec command: ${info.command}`); - stream = accept(); - stream.stderr.write(STDERR_DATA); - stream.write(STDOUT_DATA); - })).on('signal', mustCall((accept, reject, info) => { - assert(info.name === 'INT', `Wrong client signal name: ${info.name}`); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let out = ''; - let outErr = ''; - const events = []; - const EXPECTED_EVENTS = [ 'exit', 'close' ]; - const EXPECTED_EXIT_CLOSE_ARGS = [ 100 ]; - client.on('close', mustCall(() => { - assert(out === STDOUT_DATA, `Wrong stdout data: ${inspect(out)}`); - assert(outErr === STDERR_DATA, `Wrong stderr data: ${inspect(outErr)}`); - assert.deepStrictEqual( - events, - EXPECTED_EVENTS, - `Wrong command event order: ${events}` - ); - })).exec(COMMAND, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - const sendSignal = (() => { - let sent = false; - return () => { - if (sent) - return; - sent = true; - stream.signal('INT'); - }; - })(); - stream.on('data', mustCallAtLeast((d) => { - out += d; - sendSignal(); - })).on('exit', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong exit args: ${inspect(args)}`); - events.push('exit'); - })).on('close', mustCall((...args) => { - assert.deepStrictEqual(args, - EXPECTED_EXIT_CLOSE_ARGS, - `Wrong close args: ${inspect(args)}`); - events.push('close'); - })).stderr.on('data', mustCallAtLeast((d) => { - outErr += d; - })); - })); - })); -} - -{ - const { client, server } = setup('Exec with environment set'); - - const env = { SSH2NODETEST: 'foo' }; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('env', mustCall((accept, reject, info) => { - accept && accept(); - assert(info.key === Object.keys(env)[0], - 'Wrong env key'); - assert(info.val === Object.values(env)[0], - 'Wrong env value'); - })).on('exec', mustCall((accept, reject, info) => { - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo --bar', { env }, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} - -{ - const { client, server } = setup('Exec with setWindow()'); - - const dimensions = { - rows: 60, - cols: 115, - height: 480, - width: 640, - }; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('window-change', mustCall((accept, reject, info) => { - accept && accept(); - assert.deepStrictEqual(info, dimensions, 'Wrong dimensions'); - })).on('exec', mustCall((accept, reject, info) => { - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo --bar', mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.setWindow(...Object.values(dimensions)); - stream.resume(); - })); - })); -} - -{ - const { client, server } = setup('Exec with pty set'); - - const pty = { - rows: 2, - cols: 4, - width: 0, - height: 0, - term: 'vt220', - modes: {}, - }; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let sawPty = false; - accept().on('pty', mustCall((accept, reject, info) => { - assert.deepStrictEqual(info, pty, 'Wrong pty info'); - sawPty = true; - accept && accept(); - })).on('exec', mustCall((accept, reject, info) => { - assert(sawPty, 'Expected pty to be set up'); - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo --bar', { pty }, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} - -{ - const { client, server } = setup('Exec with X11 forwarding'); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let sawX11 = false; - accept().on('x11', mustCall((accept, reject, info) => { - assert.strictEqual(info.single, - false, - `Wrong x11 single: ${info.single}`); - assert.strictEqual(info.screen, - 0, - `Wrong x11 screen: ${info.screen}`); - assert.strictEqual(info.protocol, - 'MIT-MAGIC-COOKIE-1', - `Wrong x11 protocol: ${info.protocol}`); - assert(Buffer.isBuffer(info.cookie), 'Expected cookie Buffer'); - assert.strictEqual( - info.cookie.length, - 32, - `Invalid x11 cookie length: ${info.cookie.length}` - ); - sawX11 = true; - accept && accept(); - })).on('exec', mustCall((accept, reject, info) => { - assert(sawX11, 'Expected x11 before exec'); - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - conn.x11('127.0.0.1', 4321, mustCall((err, xstream) => { - assert(!err, `Unexpected x11() error: ${err}`); - xstream.resume(); - xstream.on('end', mustCall(() => { - stream.exit(100); - stream.end(); - conn.end(); - })).end(); - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.on('x11', mustCall((info, accept, reject) => { - assert.strictEqual(info.srcIP, - '127.0.0.1', - `Invalid x11 srcIP: ${info.srcIP}`); - assert.strictEqual(info.srcPort, - 4321, - `Invalid x11 srcPort: ${info.srcPort}`); - accept(); - })).exec('foo --bar', { x11: true }, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} - -{ - const { client, server } = setup( - 'Exec with X11 forwarding (custom X11 settings)' - ); - - const x11 = { - single: true, - screen: 1234, - protocol: 'YUMMY-MAGIC-COOKIE-1', - cookie: '00112233445566778899001122334455', - }; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let sawX11 = false; - accept().on('x11', mustCall((accept, reject, info) => { - assert.strictEqual(info.single, - x11.single, - `Wrong x11 single: ${info.single}`); - assert.strictEqual(info.screen, - x11.screen, - `Wrong x11 screen: ${info.screen}`); - assert.strictEqual(info.protocol, - x11.protocol, - `Wrong x11 protocol: ${info.protocol}`); - assert(Buffer.isBuffer(info.cookie), 'Expected cookie Buffer'); - assert.strictEqual(info.cookie.toString(), - x11.cookie, - `Wrong x11 cookie: ${info.cookie}`); - sawX11 = true; - accept && accept(); - })).on('exec', mustCall((accept, reject, info) => { - assert(sawX11, 'Expected x11 before exec'); - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - conn.x11('127.0.0.1', 4321, mustCall((err, xstream) => { - assert(!err, `Unexpected x11() error: ${err}`); - xstream.resume(); - xstream.on('end', mustCall(() => { - stream.exit(100); - stream.end(); - conn.end(); - })).end(); - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.on('x11', mustCall((info, accept, reject) => { - assert.strictEqual(info.srcIP, - '127.0.0.1', - `Invalid x11 srcIP: ${info.srcIP}`); - assert.strictEqual(info.srcPort, - 4321, - `Invalid x11 srcPort: ${info.srcPort}`); - accept(); - })).exec('foo --bar', { x11 }, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-integration-openssh.js b/reverse_engineering/node_modules/ssh2/test/test-integration-openssh.js deleted file mode 100644 index 2baf6828..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-integration-openssh.js +++ /dev/null @@ -1,481 +0,0 @@ -// TODO: add more rekey tests that at least include switching from no -// compression to compression and vice versa -'use strict'; - -const assert = require('assert'); -const { spawn, spawnSync } = require('child_process'); -const { chmodSync, readdirSync } = require('fs'); -const { join } = require('path'); -const readline = require('readline'); - -const Server = require('../lib/server.js'); - -const { - fixture, - fixtureKey, - FIXTURES_DIR, - mustCall, - mustCallAtLeast, -} = require('./common.js'); - -const SPAWN_OPTS = { windowsHide: true }; -const CLIENT_TIMEOUT = 5000; - -const debug = false; -const opensshPath = 'ssh'; -let opensshVer; - -// TODO: figure out why this test is failing on Windows -if (process.platform === 'win32') { - console.log('Skipping OpenSSH integration tests on Windows'); - process.exit(0); -} - -// Fix file modes to avoid OpenSSH client complaints about keys' permissions -for (const file of readdirSync(FIXTURES_DIR, { withFileTypes: true })) { - if (file.isFile()) - chmodSync(join(FIXTURES_DIR, file.name), 0o600); -} - -{ - // Get OpenSSH client version first - const { - error, stderr, stdout - } = spawnSync(opensshPath, ['-V'], SPAWN_OPTS); - - if (error) { - console.error('OpenSSH client is required for these tests'); - process.exitCode = 5; - return; - } - - const re = /^OpenSSH_([\d.]+)/; - let m = re.exec(stdout.toString()); - if (!m || !m[1]) { - m = re.exec(stderr.toString()); - if (!m || !m[1]) { - console.error('OpenSSH client is required for these tests'); - process.exitCode = 5; - return; - } - } - - opensshVer = m[1]; - console.log(`Testing with OpenSSH version: ${opensshVer}`); -} - - -// Key-based authentication -[ - { desc: 'RSA user key (old OpenSSH)', - clientKey: fixtureKey('id_rsa') }, - { desc: 'RSA user key (new OpenSSH)', - clientKey: fixtureKey('openssh_new_rsa') }, - { desc: 'DSA user key', - clientKey: fixtureKey('id_dsa') }, - { desc: 'ECDSA user key', - clientKey: fixtureKey('id_ecdsa') }, -].forEach((test) => { - const { desc, clientKey } = test; - const username = 'KeyUser'; - const { server } = setup( - desc, - { - client: { - username, - privateKeyPath: clientKey.fullPath, - }, - server: { hostKeys: [ fixture('ssh_host_rsa_key') ] }, - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCallAtLeast((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - case 3: - if (authAttempt === 3) - assert(ctx.signature, 'Missing publickey signature'); - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - default: - assert(false, 'Unexpected number of auth attempts'); - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - // We should not expect any further auth attempts after we verify a - // signature - authAttempt = Infinity; - } - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - })); - })); - })); -}); - - -// Different host key types -[ - { desc: 'RSA host key (old OpenSSH)', - hostKey: fixture('id_rsa') }, - { desc: 'RSA host key (new OpenSSH)', - hostKey: fixture('openssh_new_rsa') }, - { desc: 'DSA host key', - hostKey: fixture('ssh_host_dsa_key') }, - { desc: 'ECDSA host key', - hostKey: fixture('ssh_host_ecdsa_key') }, - { desc: 'PPK', - hostKey: fixture('id_rsa.ppk') }, -].forEach((test) => { - const { desc, hostKey } = test; - const clientKey = fixtureKey('openssh_new_rsa'); - const username = 'KeyUser'; - const { server } = setup( - desc, - { - client: { - username, - privateKeyPath: clientKey.fullPath, - }, - server: { hostKeys: [ hostKey ] }, - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCallAtLeast((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - case 3: - if (authAttempt === 3) - assert(ctx.signature, 'Missing publickey signature'); - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - default: - assert(false, 'Unexpected number of auth attempts'); - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - // We should not expect any further auth attempts after we verify a - // signature - authAttempt = Infinity; - } - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - })); - })); - })); -}); - - -// Various edge cases -{ - const clientKey = fixtureKey('openssh_new_rsa'); - const username = 'KeyUser'; - const { server } = setup( - 'Server closes stdin too early', - { - client: { - username, - privateKeyPath: clientKey.fullPath, - }, - server: { hostKeys: [ fixture('ssh_host_rsa_key') ] }, - debug, - } - ); - - server.on('_child', mustCall((childProc) => { - childProc.stderr.once('data', mustCall((data) => { - childProc.stdin.end(); - })); - childProc.stdin.write('ping'); - })).on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCallAtLeast((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - case 3: - if (authAttempt === 3) - assert(ctx.signature, 'Missing publickey signature'); - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - default: - assert(false, 'Unexpected number of auth attempts'); - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - // We should not expect any further auth attempts after we verify a - // signature - authAttempt = Infinity; - } - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject) => { - const stream = accept(); - stream.stdin.on('data', mustCallAtLeast((data) => { - stream.stdout.write('pong on stdout'); - stream.stderr.write('pong on stderr'); - })).on('end', mustCall(() => { - stream.stdout.write('pong on stdout'); - stream.stderr.write('pong on stderr'); - stream.exit(0); - stream.close(); - })); - })); - })); - })); - })); -} -{ - const clientKey = fixtureKey('openssh_new_rsa'); - const username = 'KeyUser'; - const { server } = setup( - 'Rekey', - { - client: { - username, - privateKeyPath: clientKey.fullPath, - }, - server: { hostKeys: [ fixture('ssh_host_rsa_key') ] }, - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCallAtLeast((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - case 3: - if (authAttempt === 3) - assert(ctx.signature, 'Missing publickey signature'); - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - default: - assert(false, 'Unexpected number of auth attempts'); - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - // We should not expect any further auth attempts after we verify a - // signature - authAttempt = Infinity; - } - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - const session = accept(); - conn.rekey(); - session.on('exec', mustCall((accept, reject) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - })); - })); - })); -} - - -function setup(title, configs) { - const { - client: clientCfg, - server: serverCfg, - allReady: allReady_, - timeout: timeout_, - debug, - noForceServerReady, - } = configs; - let clientClose = false; - let serverClose = false; - let serverReady = false; - let client; - const msg = (text) => { - return `${title}: ${text}`; - }; - - const timeout = (typeof timeout_ === 'number' - ? timeout_ - : CLIENT_TIMEOUT); - - const allReady = (typeof allReady_ === 'function' ? allReady_ : undefined); - - if (debug) { - serverCfg.debug = (...args) => { - console.log(`[${title}][SERVER]`, ...args); - }; - } - - const serverReadyFn = (noForceServerReady ? onReady : mustCall(onReady)); - const server = new Server(serverCfg); - - server.on('error', onError) - .on('connection', mustCall((conn) => { - conn.on('error', onError) - .on('ready', serverReadyFn); - server.close(); - })) - .on('close', mustCall(onClose)); - - function onError(err) { - const which = (arguments.length >= 3 ? 'client' : 'server'); - assert(false, msg(`Unexpected ${which} error: ${err}`)); - } - - function onReady() { - assert(!serverReady, msg('Received multiple ready events for server')); - serverReady = true; - allReady && allReady(); - } - - function onClose() { - if (arguments.length >= 3) { - assert(!clientClose, msg('Received multiple close events for client')); - clientClose = true; - } else { - assert(!serverClose, msg('Received multiple close events for server')); - serverClose = true; - } - } - - process.nextTick(mustCall(() => { - server.listen(0, 'localhost', mustCall(() => { - const args = [ - '-o', 'UserKnownHostsFile=/dev/null', - '-o', 'StrictHostKeyChecking=no', - '-o', 'CheckHostIP=no', - '-o', 'ConnectTimeout=3', - '-o', 'GlobalKnownHostsFile=/dev/null', - '-o', 'GSSAPIAuthentication=no', - '-o', 'IdentitiesOnly=yes', - '-o', 'BatchMode=yes', - '-o', 'VerifyHostKeyDNS=no', - - '-vvvvvv', - '-T', - '-o', 'KbdInteractiveAuthentication=no', - '-o', 'HostbasedAuthentication=no', - '-o', 'PasswordAuthentication=no', - '-o', 'PubkeyAuthentication=yes', - '-o', 'PreferredAuthentications=publickey' - ]; - - if (clientCfg.privateKeyPath) - args.push('-o', `IdentityFile=${clientCfg.privateKeyPath}`); - - if (!/^[0-6]\./.test(opensshVer)) { - // OpenSSH 7.0+ disables DSS/DSA host (and user) key support by - // default, so we explicitly enable it here - args.push('-o', 'HostKeyAlgorithms=+ssh-dss'); - args.push('-o', 'PubkeyAcceptedKeyTypes=+ssh-dss'); - } - - args.push('-p', server.address().port.toString(), - '-l', clientCfg.username, - 'localhost', - 'uptime'); - - client = spawn(opensshPath, args, SPAWN_OPTS); - server.emit('_child', client); - - if (debug) { - readline.createInterface({ - input: client.stdout - }).on('line', (line) => { - console.log(`[${title}][CLIENT][STDOUT]`, line); - }); - readline.createInterface({ - input: client.stderr - }).on('line', (line) => { - console.error(`[${title}][CLIENT][STDERR]`, line); - }); - } else { - client.stdout.resume(); - client.stderr.resume(); - } - - client.on('error', (err) => { - onError(err, null, null); - }).on('exit', (code) => { - clearTimeout(client.timer); - if (code !== 0) - return onError(new Error(`Non-zero exit code ${code}`), null, null); - onClose(null, null, null); - }); - - client.timer = setTimeout(() => { - assert(false, msg('Client timeout')); - }, timeout); - })); - })); - - return { server }; -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-misc-client-server.js b/reverse_engineering/node_modules/ssh2/test/test-misc-client-server.js deleted file mode 100644 index f875a7d8..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-misc-client-server.js +++ /dev/null @@ -1,1428 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { createHash } = require('crypto'); -const http = require('http'); -const https = require('https'); -const net = require('net'); -const { Transform } = require('stream'); -const { inspect } = require('util'); - -const Client = require('../lib/client.js'); -const { - SSHTTPAgent: HTTPAgent, - SSHTTPSAgent: HTTPSAgent, -} = require('../lib/http-agents.js'); -const Server = require('../lib/server.js'); -const { KexInit } = require('../lib/protocol/kex.js'); - -const { - fixture, - mustCall, - mustCallAtLeast, - mustNotCall, - setup: setup_, - setupSimple, -} = require('./common.js'); - -const KEY_RSA_BAD = fixture('bad_rsa_private_key'); -const HOST_RSA_MD5 = '64254520742d3d0792e918f3ce945a64'; -const clientCfg = { username: 'foo', password: 'bar' }; -const serverCfg = { hostKeys: [ fixture('ssh_host_rsa_key') ] }; - -const debug = false; - -const setup = setupSimple.bind(undefined, debug); - - -{ - const { server } = setup_( - 'Verify host fingerprint (sync success, hostHash set)', - { - client: { - ...clientCfg, - hostHash: 'md5', - hostVerifier: mustCall((hash) => { - assert(hash === HOST_RSA_MD5, 'Host fingerprint mismatch'); - return true; - }), - }, - server: serverCfg, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} - -{ - const { server } = setup_( - 'Verify host fingerprint (sync success, hostHash not set)', - { - client: { - ...clientCfg, - hostVerifier: mustCall((key) => { - assert(Buffer.isBuffer(key), 'Expected buffer'); - let hash = createHash('md5'); - hash.update(key); - hash = hash.digest('hex'); - assert(hash === HOST_RSA_MD5, 'Host fingerprint mismatch'); - return true; - }), - }, - server: serverCfg, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} - -{ - const { server } = setup_( - 'Verify host fingerprint (async success)', - { - client: { - ...clientCfg, - hostVerifier: mustCall((key, cb) => { - assert(Buffer.isBuffer(key), 'Expected buffer'); - let hash = createHash('md5'); - hash.update(key); - hash = hash.digest('hex'); - assert(hash === HOST_RSA_MD5, 'Host fingerprint mismatch'); - process.nextTick(cb, true); - }), - }, - server: serverCfg, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} - -{ - const { client, server } = setup_( - 'Verify host fingerprint (sync failure)', - { - client: { - ...clientCfg, - hostVerifier: mustCall((key) => { - return false; - }), - }, - server: serverCfg, - - noForceClientReady: true, - noForceServerReady: true, - }, - ); - - client.removeAllListeners('error'); - client.on('ready', mustNotCall()) - .on('error', mustCall((err) => { - assert(/verification failed/.test(err.message), - 'Wrong client error message'); - })); - - server.on('connection', mustCall((conn) => { - conn.removeAllListeners('error'); - - conn.on('authentication', mustNotCall()) - .on('ready', mustNotCall()) - .on('error', mustCall((err) => { - assert(/KEY_EXCHANGE_FAILED/.test(err.message), - 'Wrong server error message'); - })); - })); -} - -{ - // connect() on connected client - - const clientCfg_ = { ...clientCfg }; - const client = new Client(); - const server = new Server(serverCfg); - - server.listen(0, 'localhost', mustCall(() => { - clientCfg_.host = 'localhost'; - clientCfg_.port = server.address().port; - client.connect(clientCfg_); - })); - - let connections = 0; - server.on('connection', mustCall((conn) => { - if (++connections === 2) - server.close(); - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => {})); - }, 2)).on('close', mustCall(() => {})); - - let reconnect = false; - client.on('ready', mustCall(() => { - if (reconnect) { - client.end(); - } else { - reconnect = true; - client.connect(clientCfg_); - } - }, 2)).on('close', mustCall(() => {}, 2)); -} - -{ - // Throw when not connected - - const client = new Client({ - username: 'foo', - password: 'bar', - }); - - assert.throws(mustCall(() => { - client.exec('uptime', mustNotCall()); - })); -} - -{ - const { client, server } = setup( - 'Outstanding callbacks called on disconnect' - ); - - server.on('connection', mustCall((conn) => { - conn.on('session', mustCall(() => {}, 3)); - })); - - client.on('ready', mustCall(() => { - function callback(err, stream) { - assert(err, 'Expected error'); - assert(err.message === 'No response from server', - `Wrong error message: ${err.message}`); - } - client.exec('uptime', mustCall(callback)); - client.shell(mustCall(callback)); - client.sftp(mustCall(callback)); - client.end(); - })); -} - -{ - const { client, server } = setup('Pipelined requests'); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - }, 3)); - })); - })); - - client.on('ready', mustCall(() => { - let calledBack = 0; - function callback(err, stream) { - assert(!err, `Unexpected error: ${err}`); - stream.resume(); - if (++calledBack === 3) - client.end(); - } - client.exec('foo', mustCall(callback)); - client.exec('bar', mustCall(callback)); - client.exec('baz', mustCall(callback)); - })); -} - -{ - const { client, server } = setup( - 'Pipelined requests with intermediate rekeying' - ); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - const reqs = []; - conn.on('session', mustCall((accept, reject) => { - if (reqs.length === 0) { - conn.rekey(mustCall((err) => { - assert(!err, `Unexpected rekey error: ${err}`); - reqs.forEach((accept) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - }); - })); - } - reqs.push(accept); - }, 3)); - })); - })); - - client.on('ready', mustCall(() => { - let calledBack = 0; - function callback(err, stream) { - assert(!err, `Unexpected error: ${err}`); - stream.resume(); - if (++calledBack === 3) - client.end(); - } - client.exec('foo', mustCall(callback)); - client.exec('bar', mustCall(callback)); - client.exec('baz', mustCall(callback)); - })); -} - -{ - const { client, server } = setup('Ignore outgoing after stream close'); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo', mustCall((err, stream) => { - assert(!err, `Unexpected error: ${err}`); - stream.on('exit', mustCall((code, signal) => { - client.end(); - })); - })); - })); -} - -{ - const { client, server } = setup_( - 'Double pipe on unconnected, passed in net.Socket', - { - client: { - ...clientCfg, - sock: new net.Socket(), - }, - server: serverCfg, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => {})); - })); - client.on('ready', mustCall(() => { - client.end(); - })); -} - -{ - const { client, server } = setup( - 'Client auto-rejects inbound connections to unknown bound address' - ); - - const assignedPort = 31337; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('request', mustCall((accept, reject, name, info) => { - assert(name === 'tcpip-forward', 'Wrong request name'); - assert.deepStrictEqual( - info, - { bindAddr: 'good', bindPort: 0 }, - 'Wrong request info' - ); - accept(assignedPort); - conn.forwardOut(info.bindAddr, - assignedPort, - 'remote', - 12345, - mustCall((err, ch) => { - assert(!err, `Unexpected error: ${err}`); - conn.forwardOut('bad', - assignedPort, - 'remote', - 12345, - mustCall((err, ch) => { - assert(err, 'Should receive error'); - client.end(); - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - // request forwarding - client.forwardIn('good', 0, mustCall((err, port) => { - assert(!err, `Unexpected error: ${err}`); - assert(port === assignedPort, 'Wrong assigned port'); - })); - })).on('tcp connection', mustCall((details, accept, reject) => { - assert.deepStrictEqual( - details, - { destIP: 'good', - destPort: assignedPort, - srcIP: 'remote', - srcPort: 12345 - }, - 'Wrong connection details' - ); - accept(); - })); -} - -{ - const { client, server } = setup( - 'Client auto-rejects inbound connections to unknown bound port' - ); - - const assignedPort = 31337; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('request', mustCall((accept, reject, name, info) => { - assert(name === 'tcpip-forward', 'Wrong request name'); - assert.deepStrictEqual( - info, - { bindAddr: 'good', bindPort: 0 }, - 'Wrong request info' - ); - accept(assignedPort); - conn.forwardOut(info.bindAddr, - assignedPort, - 'remote', - 12345, - mustCall((err, ch) => { - assert(!err, `Unexpected error: ${err}`); - conn.forwardOut(info.bindAddr, - 99999, - 'remote', - 12345, - mustCall((err, ch) => { - assert(err, 'Should receive error'); - client.end(); - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - // request forwarding - client.forwardIn('good', 0, mustCall((err, port) => { - assert(!err, `Unexpected error: ${err}`); - assert(port === assignedPort, 'Wrong assigned port'); - })); - })).on('tcp connection', mustCall((details, accept, reject) => { - assert.deepStrictEqual( - details, - { destIP: 'good', - destPort: assignedPort, - srcIP: 'remote', - srcPort: 12345 - }, - 'Wrong connection details' - ); - accept(); - })); -} - -{ - const GREETING = 'Hello world!'; - - const { client, server } = setup_( - 'Server greeting', - { - client: { - ...clientCfg, - ident: 'node.js rules', - }, - server: { - ...serverCfg, - greeting: GREETING, - } - }, - ); - - let sawGreeting = false; - - server.on('connection', mustCall((conn, info) => { - assert.deepStrictEqual(info.header, { - identRaw: 'SSH-2.0-node.js rules', - greeting: '', - versions: { - protocol: '2.0', - software: 'node.js' - }, - comments: 'rules' - }); - conn.on('handshake', mustCall((details) => { - assert(sawGreeting, 'Client did not see greeting before handshake'); - })).on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); - - client.on('greeting', mustCall((greeting) => { - assert.strictEqual(greeting, `${GREETING}\r\n`); - sawGreeting = true; - })).on('banner', mustNotCall()); -} - -{ - const { client, server } = setup_( - 'Correct ident parsing', - { - client: { - ...clientCfg, - ident: 'node.js rules\n', - }, - server: serverCfg, - - noServerError: true, - noClientError: true, - noForceServerReady: true, - noForceClientReady: true, - }, - ); - - server.on('connection', mustCall((conn, info) => { - assert.deepStrictEqual(info.header, { - identRaw: 'SSH-2.0-node.js rules', - greeting: '', - versions: { - protocol: '2.0', - software: 'node.js' - }, - comments: 'rules' - }); - conn.once('error', mustCall((err) => { - assert(/bad packet length/i.test(err.message), 'Wrong error message'); - })); - conn.on('handshake', mustNotCall()) - .on('authentication', mustNotCall()) - .on('ready', mustNotCall()); - })); - - client.on('greeting', mustNotCall()) - .on('banner', mustNotCall()) - .on('ready', mustNotCall()); -} - -{ - const BANNER = 'Hello world!'; - - const { client, server } = setup_( - 'Server banner', - { - client: clientCfg, - server: { - ...serverCfg, - banner: BANNER, - } - }, - ); - - let sawBanner = false; - - server.on('connection', mustCall((conn) => { - conn.on('handshake', mustCall((details) => { - assert(!sawBanner, 'Client saw banner too early'); - })).on('authentication', mustCall((ctx) => { - assert(sawBanner, 'Client did not see banner before auth'); - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); - - client.on('greeting', mustNotCall()) - .on('banner', mustCall((message) => { - assert.strictEqual(message, 'Hello world!\r\n'); - sawBanner = true; - })); -} - -{ - const { client, server } = setup( - 'Server responds to global requests in the right order' - ); - - function sendAcceptLater(accept) { - if (fastRejectSent) - accept(); - else - setImmediate(sendAcceptLater, accept); - } - - let fastRejectSent = false; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('request', mustCall((accept, reject, name, info) => { - if (info.bindAddr === 'fastReject') { - // Will call reject on 'fastReject' soon ... - reject(); - fastRejectSent = true; - } else { - // ... but accept on 'slowAccept' later - sendAcceptLater(accept); - } - }, 2)); - })); - })); - - client.on('ready', mustCall(() => { - let replyCnt = 0; - - client.forwardIn('slowAccept', 0, mustCall((err) => { - assert(!err, `Unexpected error: ${err}`); - if (++replyCnt === 2) - client.end(); - })); - - client.forwardIn('fastReject', 0, mustCall((err) => { - assert(err, 'Expected error'); - if (++replyCnt === 2) - client.end(); - })); - })); -} - -{ - const { client, server } = setup( - 'Cleanup outstanding channel requests on channel close' - ); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - const session = accept(); - session.on('subsystem', mustCall((accept, reject, info) => { - assert(info.name === 'netconf', `Wrong subsystem name: ${info.name}`); - - // XXX: hack to prevent success reply from being sent - conn._protocol.channelSuccess = () => {}; - - accept().close(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.subsys('netconf', mustCall((err, stream) => { - assert(err, 'Expected error'); - client.end(); - })); - })); -} - -{ - const { client, server } = setup_( - 'Handshake errors are emitted', - { - client: { - ...clientCfg, - algorithms: { cipher: [ 'aes128-cbc' ] }, - }, - server: { - ...serverCfg, - algorithms: { cipher: [ 'aes128-ctr' ] }, - }, - - noForceClientReady: true, - noForceServerReady: true, - }, - ); - - client.removeAllListeners('error'); - - function onError(err) { - assert.strictEqual(err.level, 'handshake'); - assert(/handshake failed/i.test(err.message), 'Wrong error message'); - } - - server.on('connection', mustCall((conn) => { - conn.removeAllListeners('error'); - - conn.on('authentication', mustNotCall()) - .on('ready', mustNotCall()) - .on('handshake', mustNotCall()) - .on('error', mustCall(onError)) - .on('close', mustCall(() => {})); - })); - - client.on('ready', mustNotCall()) - .on('error', mustCall(onError)) - .on('close', mustCall(() => {})); -} - -{ - const { client, server } = setup_( - 'Client signing errors are caught and emitted', - { - client: { - username: 'foo', - privateKey: KEY_RSA_BAD, - }, - server: serverCfg, - - noForceClientReady: true, - noForceServerReady: true, - }, - ); - - client.removeAllListeners('error'); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(!ctx.signature, 'Unexpected signature'); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - ctx.accept(); - break; - } - }, 2)).on('ready', mustNotCall()).on('close', mustCall(() => {})); - })); - - let cliError; - client.on('ready', mustNotCall()).on('error', mustCall((err) => { - if (cliError) { - assert(/all configured/i.test(err.message), 'Wrong error message'); - } else { - cliError = err; - assert(/signing/i.test(err.message), 'Wrong error message'); - } - }, 2)).on('close', mustCall(() => {})); -} - -{ - const { client, server } = setup_( - 'Server signing errors are caught and emitted', - { - client: clientCfg, - server: { hostKeys: [KEY_RSA_BAD] }, - - noForceClientReady: true, - noForceServerReady: true, - }, - ); - - client.removeAllListeners('error'); - - server.on('connection', mustCall((conn) => { - conn.removeAllListeners('error'); - - conn.on('error', mustCall((err) => { - assert(/signature generation failed/i.test(err.message), - 'Wrong error message'); - })).on('authentication', mustNotCall()) - .on('ready', mustNotCall()) - .on('close', mustCall(() => {})); - })); - - client.on('ready', mustNotCall()).on('error', mustCall((err) => { - assert(/KEY_EXCHANGE_FAILED/.test(err.message), 'Wrong error message'); - })).on('close', mustCall(() => {})); -} - -{ - const { client, server } = setup_( - 'Rekeying with AES-GCM', - { - client: { - ...clientCfg, - algorithms: { cipher: [ 'aes128-gcm@openssh.com' ] }, - }, - server: { - ...serverCfg, - algorithms: { cipher: [ 'aes128-gcm@openssh.com' ] }, - }, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - const reqs = []; - conn.on('session', mustCall((accept, reject) => { - if (reqs.length === 0) { - conn.rekey(mustCall((err) => { - assert(!err, `Unexpected rekey error: ${err}`); - reqs.forEach((accept) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - }); - })); - } - reqs.push(accept); - }, 3)); - })); - })); - - client.on('ready', mustCall(() => { - let calledBack = 0; - function callback(err, stream) { - assert(!err, `Unexpected error: ${err}`); - stream.resume(); - if (++calledBack === 3) - client.end(); - } - client.exec('foo', mustCall(callback)); - client.exec('bar', mustCall(callback)); - client.exec('baz', mustCall(callback)); - })); -} - -{ - const { client, server } = setup_( - 'Switch from no compression to compression', - { - client: { - ...clientCfg, - algorithms: { compress: [ 'none' ] }, - }, - server: { - ...serverCfg, - algorithms: { compress: [ 'none', 'zlib@openssh.com' ] }, - }, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - const reqs = []; - conn.on('session', mustCall((accept, reject) => { - if (reqs.length === 0) { - // XXX: hack to change algorithms after initial handshake - client._protocol._offer = new KexInit({ - kex: [ 'ecdh-sha2-nistp256' ], - serverHostKey: [ 'rsa-sha2-256' ], - cs: { - cipher: [ 'aes128-gcm@openssh.com' ], - mac: [], - compress: [ 'zlib@openssh.com' ], - lang: [], - }, - sc: { - cipher: [ 'aes128-gcm@openssh.com' ], - mac: [], - compress: [ 'zlib@openssh.com' ], - lang: [], - }, - }); - - conn.rekey(mustCall((err) => { - assert(!err, `Unexpected rekey error: ${err}`); - reqs.forEach((accept) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - }); - })); - } - reqs.push(accept); - }, 3)); - })); - })); - - let handshakes = 0; - client.on('handshake', mustCall((info) => { - switch (++handshakes) { - case 1: - assert(info.cs.compress === 'none', 'wrong compress value'); - assert(info.sc.compress === 'none', 'wrong compress value'); - break; - case 2: - assert(info.cs.compress === 'zlib@openssh.com', - 'wrong compress value'); - assert(info.sc.compress === 'zlib@openssh.com', - 'wrong compress value'); - break; - } - }, 2)).on('ready', mustCall(() => { - let calledBack = 0; - function callback(err, stream) { - assert(!err, `Unexpected error: ${err}`); - stream.resume(); - if (++calledBack === 3) - client.end(); - } - client.exec('foo', mustCall(callback)); - client.exec('bar', mustCall(callback)); - client.exec('baz', mustCall(callback)); - })); -} - -{ - const { client, server } = setup_( - 'Switch from compression to no compression', - { - client: { - ...clientCfg, - algorithms: { compress: [ 'zlib' ] }, - }, - server: { - ...serverCfg, - algorithms: { compress: [ 'zlib', 'none' ] }, - } - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - const reqs = []; - conn.on('session', mustCall((accept, reject) => { - if (reqs.length === 0) { - // XXX: hack to change algorithms after initial handshake - client._protocol._offer = new KexInit({ - kex: [ 'ecdh-sha2-nistp256' ], - serverHostKey: [ 'rsa-sha2-256' ], - cs: { - cipher: [ 'aes128-gcm@openssh.com' ], - mac: [], - compress: [ 'none' ], - lang: [], - }, - sc: { - cipher: [ 'aes128-gcm@openssh.com' ], - mac: [], - compress: [ 'none' ], - lang: [], - }, - }); - - conn.rekey(mustCall((err) => { - assert(!err, `Unexpected rekey error: ${err}`); - reqs.forEach((accept) => { - const session = accept(); - session.on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - stream.exit(0); - stream.end(); - })); - }); - })); - } - reqs.push(accept); - }, 3)); - })); - })); - - let handshakes = 0; - client.on('handshake', mustCall((info) => { - switch (++handshakes) { - case 1: - assert(info.cs.compress === 'zlib', 'wrong compress value'); - assert(info.sc.compress === 'zlib', 'wrong compress value'); - break; - case 2: - assert(info.cs.compress === 'none', 'wrong compress value'); - assert(info.sc.compress === 'none', 'wrong compress value'); - break; - } - }, 2)).on('ready', mustCall(() => { - let calledBack = 0; - function callback(err, stream) { - assert(!err, `Unexpected error: ${err}`); - stream.resume(); - if (++calledBack === 3) - client.end(); - } - client.exec('foo', mustCall(callback)); - client.exec('bar', mustCall(callback)); - client.exec('baz', mustCall(callback)); - })); -} - -{ - const { client, server } = setup_( - 'Large data compression', - { - client: { - ...clientCfg, - algorithms: { compress: [ 'zlib' ] }, - }, - server: { - ...serverCfg, - algorithms: { compress: [ 'zlib' ] }, - } - }, - ); - - const chunk = Buffer.alloc(1024 * 1024, 'a'); - const chunkCount = 10; - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject, info) => { - const stream = accept(); - for (let i = 0; i < chunkCount; ++i) - stream.write(chunk); - stream.exit(0); - stream.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo', mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - let nb = 0; - stream.on('data', mustCallAtLeast((data) => { - nb += data.length; - })).on('end', mustCall(() => { - assert(nb === (chunkCount * chunk.length), - `Wrong stream byte count: ${nb}`); - client.end(); - })); - })); - })); -} - -{ - const { client, server } = setup_( - 'Debug output', - { - client: { - ...clientCfg, - debug: mustCallAtLeast((msg) => { - assert(typeof msg === 'string', - `Wrong debug argument type: ${typeof msg}`); - assert(msg.length > 0, 'Unexpected empty debug message'); - }), - }, - server: { - ...serverCfg, - debug: mustCallAtLeast((msg) => { - assert(typeof msg === 'string', - `Wrong debug argument type: ${typeof msg}`); - assert(msg.length > 0, 'Unexpected empty debug message'); - }), - }, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('exec', mustCall((accept, reject, info) => { - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo --bar', mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} - -{ - const { server } = setup_( - 'HTTP agent', - { - // No automatic client, the agent will create one - - server: serverCfg, - - debug, - }, - ); - - let httpServer; - server.on('listening', () => { - httpServer = http.createServer((req, res) => { - httpServer.close(); - res.end('hello world!'); - }); - httpServer.listen(0, 'localhost', () => { - const agent = new HTTPAgent({ - host: 'localhost', - port: server.address().port, - username: 'foo', - password: 'bar', - }); - http.get({ - host: 'localhost', - port: httpServer.address().port, - agent, - headers: { Connection: 'close' }, - }, (res) => { - assert(res.statusCode === 200, - `Wrong http status code: ${res.statusCode}`); - let buf = ''; - res.on('data', mustCallAtLeast((chunk) => { - buf += chunk; - })).on('end', mustCall(() => { - assert(buf === 'hello world!', - `Wrong http response body: ${inspect(buf)}`); - })); - }); - }); - }); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('tcpip', mustCall((accept, reject, info) => { - assert(info.destIP === 'localhost', `Wrong destIP: ${info.destIP}`); - assert(info.destPort === httpServer.address().port, - `Wrong destPort: ${info.destPort}`); - assert(info.srcIP === 'localhost', `Wrong srcIP: ${info.srcIP}`); - - const stream = accept(); - const tcp = new net.Socket(); - tcp.pipe(stream).pipe(tcp); - tcp.connect(httpServer.address().port, 'localhost'); - })); - })); - })); -} - -{ - const { server } = setup_( - 'HTTPS agent', - { - // No automatic client, the agent will create one - - server: serverCfg, - - debug, - }, - ); - - let httpsServer; - server.on('listening', () => { - httpsServer = https.createServer({ - key: fixture('https_key.pem'), - cert: fixture('https_cert.pem'), - }, (req, res) => { - httpsServer.close(); - res.end('hello world!'); - }); - httpsServer.listen(0, 'localhost', () => { - const agent = new HTTPSAgent({ - host: 'localhost', - port: server.address().port, - username: 'foo', - password: 'bar', - }); - https.get({ - host: 'localhost', - port: httpsServer.address().port, - agent, - headers: { Connection: 'close' }, - ca: fixture('https_cert.pem'), - }, (res) => { - assert(res.statusCode === 200, - `Wrong http status code: ${res.statusCode}`); - let buf = ''; - res.on('data', mustCallAtLeast((chunk) => { - buf += chunk; - })).on('end', mustCall(() => { - assert(buf === 'hello world!', - `Wrong http response body: ${inspect(buf)}`); - })); - }).on('error', (err) => { - // This workaround is necessary for some reason on node < v14.x - if (!/write after end/i.test(err.message)) - throw err; - }); - }); - }); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('tcpip', mustCall((accept, reject, info) => { - assert(info.destIP === 'localhost', `Wrong destIP: ${info.destIP}`); - assert(info.destPort === httpsServer.address().port, - `Wrong destPort: ${info.destPort}`); - assert(info.srcIP === 'localhost', `Wrong srcIP: ${info.srcIP}`); - - const stream = accept(); - const tcp = new net.Socket(); - tcp.pipe(stream).pipe(tcp); - tcp.connect(httpsServer.address().port, 'localhost'); - })); - })); - })); -} - -[ - { desc: 'remove/append/prepend (regexps)', - config: { - remove: /.*/, - append: /gcm/, - prepend: /ctr/, - }, - expected: [ - 'aes128-ctr', - 'aes192-ctr', - 'aes256-ctr', - 'aes128-gcm', - 'aes128-gcm@openssh.com', - 'aes256-gcm', - 'aes256-gcm@openssh.com', - ], - }, - { desc: 'remove/append/prepend (strings)', - config: { - remove: /.*/, - append: 'aes256-ctr', - prepend: [ 'aes256-gcm', 'aes128-gcm' ], - }, - expected: [ - 'aes256-gcm', - 'aes128-gcm', - 'aes256-ctr', - ], - }, -].forEach((info) => { - const { client, server } = setup_( - `Client algorithms option (${info.desc})`, - { - client: { - ...clientCfg, - algorithms: { cipher: info.config }, - }, - server: serverCfg, - - debug, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); - client.on('ready', mustCall(() => { - // XXX: hack to easily verify computed offer - const offer = client._protocol._offer.lists; - assert.deepStrictEqual( - offer.cs.cipher.array, - info.expected, - `Wrong algorithm list: ${offer.cs.cipher.array}` - ); - })); -}); - -{ - const { client } = setup_( - `Safely end() from Client 'error' event handler`, - { - client: clientCfg, - noClientError: true, - noForceClientReady: true, - }, - ); - - const badServer = net.createServer((s) => {}); - badServer.listen(0, 'localhost', mustCall(() => { - badServer.unref(); - - client.on('error', mustCallAtLeast((err) => { - client.end(); - })).on('ready', mustNotCall()).on('close', mustCall(() => {})); - client.connect({ - host: 'localhost', - port: badServer.address().port, - user: 'foo', - password: 'bar', - readyTimeout: 1, - }); - })); -} - -{ - const { client } = setup_( - 'Client error should be emitted on bad/nonexistent greeting', - { - client: clientCfg, - noClientError: true, - noForceClientReady: true, - }, - ); - - const badServer = net.createServer(mustCall((s) => { - badServer.close(); - s.end(); - })).listen(0, 'localhost', mustCall(() => { - client.on('error', mustCall((err) => { - client.end(); - })).on('ready', mustNotCall()).on('close', mustCall(() => {})); - client.connect({ - host: 'localhost', - port: badServer.address().port, - user: 'foo', - password: 'bar', - }); - })); -} - -{ - const { client } = setup_( - 'Only one client error on connection failure', - { - client: clientCfg, - noClientError: true, - noForceClientReady: true, - }, - ); - - client.on('error', mustCall((err) => { - assert.strictEqual(err.syscall, 'getaddrinfo'); - })); - client.connect({ - host: 'blerbblubblubblerb', - port: 9999, - user: 'foo', - password: 'bar' - }); -} - -{ - const { client, server } = setup( - 'Client should remove reserved channels on incoming channel rejection' - ); - - const assignedPort = 31337; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('request', mustCall((accept, reject, name, info) => { - assert(name === 'tcpip-forward', 'Wrong request name'); - assert.deepStrictEqual( - info, - { bindAddr: 'good', bindPort: 0 }, - 'Wrong request info' - ); - accept(assignedPort); - conn.forwardOut(info.bindAddr, - assignedPort, - 'remote', - 12345, - mustCall((err, ch) => { - assert(err, 'Should receive error'); - client.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - // request forwarding - client.forwardIn('good', 0, mustCall((err, port) => { - assert(!err, `Unexpected error: ${err}`); - assert(port === assignedPort, 'Wrong assigned port'); - })); - })).on('tcp connection', mustCall((details, accept, reject) => { - assert.deepStrictEqual( - details, - { destIP: 'good', - destPort: assignedPort, - srcIP: 'remote', - srcPort: 12345 - }, - 'Wrong connection details' - ); - assert.strictEqual(Object.keys(client._chanMgr._channels).length, 1); - assert.strictEqual(client._chanMgr._count, 1); - reject(); - assert.strictEqual(Object.keys(client._chanMgr._channels).length, 0); - assert.strictEqual(client._chanMgr._count, 0); - })); -} - -{ - // Allow injected sockets - - const socket = new Transform({ - emitClose: true, - autoDestroy: true, - transform: (chunk, encoding, cb) => { - cb(); - }, - }); - socket.remoteAddress = '127.0.0.1'; - socket.remotePort = '12345'; - socket.remoteFamily = 'IPv4'; - socket.push(Buffer.from('SSH-2.0-foo\r\n')); - - const server = new Server(serverCfg); - server.on('connection', mustCall((conn, info) => { - assert.strictEqual(info.header.versions.software, 'foo'); - assert.strictEqual(info.ip, '127.0.0.1'); - assert.strictEqual(info.port, '12345'); - assert.strictEqual(info.family, 'IPv4'); - conn.on('ready', mustNotCall()); - conn.on('close', mustCall()); - socket.end(); - })); - server.injectSocket(socket); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-openssh.js b/reverse_engineering/node_modules/ssh2/test/test-openssh.js deleted file mode 100644 index 67e1b860..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-openssh.js +++ /dev/null @@ -1,261 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const { - fixture, - mustCall, - mustCallAtLeast, - setup: setup_, -} = require('./common.js'); - -const debug = false; - -const clientCfg = { username: 'foo', password: 'bar' }; -const serverCfg = { hostKeys: [ fixture('ssh_host_rsa_key') ] }; - -{ - const { client, server } = setup_( - 'Exec with OpenSSH agent forwarding', - { - client: { - ...clientCfg, - agent: '/path/to/agent', - }, - server: serverCfg, - - debug, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let sawAuthAgent = false; - accept().on('auth-agent', mustCall((accept, reject) => { - sawAuthAgent = true; - accept && accept(); - })).on('exec', mustCall((accept, reject, info) => { - assert(sawAuthAgent, 'Expected auth-agent before exec'); - assert(info.command === 'foo --bar', - `Wrong exec command: ${info.command}`); - const stream = accept(); - stream.exit(100); - stream.end(); - conn.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.exec('foo --bar', { agentForward: true }, mustCall((err, stream) => { - assert(!err, `Unexpected exec error: ${err}`); - stream.resume(); - })); - })); -} - -{ - const { client, server } = setup_( - 'OpenSSH forwarded UNIX socket connection', - { - client: clientCfg, - server: { - ...serverCfg, - ident: 'OpenSSH_7.1', - }, - - debug, - }, - ); - - const socketPath = '/foo'; - const events = []; - const expected = [ - ['client', 'openssh_forwardInStreamLocal'], - ['server', 'streamlocal-forward@openssh.com', { socketPath }], - ['client', 'forward callback'], - ['client', 'unix connection', { socketPath }], - ['client', 'socket data', '1'], - ['server', 'socket data', '2'], - ['client', 'socket end'], - ['server', 'cancel-streamlocal-forward@openssh.com', { socketPath }], - ['client', 'cancel callback'] - ]; - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.once('request', mustCall((accept, reject, name, info) => { - events.push(['server', name, info]); - assert(name === 'streamlocal-forward@openssh.com', - `Wrong request name: ${name}`); - accept(); - conn.openssh_forwardOutStreamLocal(socketPath, - mustCall((err, ch) => { - assert(!err, `Unexpected error: ${err}`); - ch.write('1'); - ch.on('data', mustCallAtLeast((data) => { - events.push(['server', 'socket data', data.toString()]); - ch.close(); - })); - })); - - conn.on('request', mustCall((accept, reject, name, info) => { - events.push(['server', name, info]); - assert(name === 'cancel-streamlocal-forward@openssh.com', - `Wrong request name: ${name}`); - accept(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - // request forwarding - events.push(['client', 'openssh_forwardInStreamLocal']); - client.openssh_forwardInStreamLocal(socketPath, mustCall((err) => { - assert(!err, `Unexpected error: ${err}`); - events.push(['client', 'forward callback']); - })); - client.on('unix connection', mustCall((info, accept, reject) => { - events.push(['client', 'unix connection', info]); - const stream = accept(); - stream.on('data', mustCallAtLeast((data) => { - events.push(['client', 'socket data', data.toString()]); - stream.write('2'); - })).on('end', mustCall(() => { - events.push(['client', 'socket end']); - client.openssh_unforwardInStreamLocal(socketPath, - mustCall((err) => { - assert(!err, `Unexpected error: ${err}`); - events.push(['client', 'cancel callback']); - client.end(); - })); - })); - })); - })).on('close', mustCall(() => { - assert.deepStrictEqual( - events, - expected, - 'Events mismatch\n' - + `Actual:\n${inspect(events)}\n` - + `Expected:\n${inspect(expected)}` - ); - })); -} - -{ - const { client, server } = setup_( - 'OpenSSH UNIX socket connection', - { - client: clientCfg, - server: { - ...serverCfg, - ident: 'OpenSSH_8.0', - }, - - debug, - }, - ); - - const socketPath = '/foo/bar/baz'; - const response = 'Hello World'; - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('openssh.streamlocal', mustCall((accept, reject, info) => { - assert.deepStrictEqual( - info, - { socketPath }, - `Wrong info: ${inspect(info)}` - ); - - const stream = accept(); - stream.on('close', mustCall(() => { - client.end(); - })).end(response); - stream.resume(); - })); - })); - })); - - client.on('ready', mustCall(() => { - client.openssh_forwardOutStreamLocal(socketPath, mustCall((err, stream) => { - assert(!err, `Unexpected error: ${err}`); - let buf = ''; - stream.on('data', mustCallAtLeast((data) => { - buf += data; - })).on('close', mustCall(() => { - assert(buf === response, `Wrong response: ${inspect(buf)}`); - })); - })); - })); -} - -{ - const { client, server } = setup_( - 'OpenSSH 5.x workaround for binding on port 0', - { - client: clientCfg, - server: { - ...serverCfg, - ident: 'OpenSSH_5.3', - }, - - debug, - }, - ); - - const boundAddr = 'good'; - const boundPort = 1337; - const tcpInfo = { - destIP: boundAddr, - destPort: boundPort, - srcIP: 'remote', - srcPort: 12345, - }; - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('request', mustCall((accept, reject, name, info) => { - assert(name === 'tcpip-forward', `Unexpected request: ${name}`); - assert(info.bindAddr === boundAddr, `Wrong addr: ${info.bindAddr}`); - assert(info.bindPort === 0, `Wrong port: ${info.bindPort}`); - accept(boundPort); - conn.forwardOut(boundAddr, - 0, - tcpInfo.srcIP, - tcpInfo.srcPort, - mustCall((err, ch) => { - assert(!err, `Unexpected error: ${err}`); - client.end(); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - // request forwarding - client.forwardIn(boundAddr, 0, mustCall((err, port) => { - assert(!err, `Unexpected error: ${err}`); - assert(port === boundPort, `Bad bound port: ${port}`); - })); - })).on('tcp connection', mustCall((details, accept, reject) => { - assert.deepStrictEqual( - details, - tcpInfo, - `Wrong tcp details: ${inspect(details)}` - ); - accept(); - })); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-protocol-crypto.js b/reverse_engineering/node_modules/ssh2/test/test-protocol-crypto.js deleted file mode 100644 index 8cae94c0..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-protocol-crypto.js +++ /dev/null @@ -1,609 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { randomBytes } = require('crypto'); - -const { - CIPHER_INFO, - MAC_INFO, - bindingAvailable, - NullCipher, - createCipher, - NullDecipher, - createDecipher, - init: cryptoInit, -} = require('../lib/protocol/crypto.js'); - -(async () => { - await cryptoInit; - - console.log(`Crypto binding ${bindingAvailable ? '' : 'not '}available`); - { - const PAIRS = [ - // cipher, decipher - ['native', 'native'], - ['binding', 'native'], - ['native', 'binding'], - ['binding', 'binding'], - ].slice(0, bindingAvailable ? 4 : 1); - - [ - { cipher: null }, - { cipher: 'chacha20-poly1305@openssh.com' }, - { cipher: 'aes128-gcm@openssh.com' }, - { cipher: 'aes128-cbc', mac: 'hmac-sha1-etm@openssh.com' }, - { cipher: 'aes128-ctr', mac: 'hmac-sha1' }, - { cipher: 'arcfour', mac: 'hmac-sha2-256-96' }, - ].forEach((testConfig) => { - for (const pair of PAIRS) { - function onCipherData(data) { - ciphered = Buffer.concat([ciphered, data]); - } - - function onDecipherPayload(payload) { - deciphered.push(payload); - } - - function reset() { - ciphered = Buffer.alloc(0); - deciphered = []; - } - - function reinit() { - if (testConfig.cipher === null) { - cipher = new NullCipher(1, onCipherData); - decipher = new NullDecipher(1, onDecipherPayload); - } else { - cipher = createCipher(config); - decipher = createDecipher(config); - } - } - - let ciphered; - let deciphered; - let cipher; - let decipher; - let macSize; - let packet; - let payload; - let cipherInfo; - let config; - - console.log('Testing cipher: %s, mac: %s (%s encrypt, %s decrypt) ...', - testConfig.cipher, - testConfig.mac - || (testConfig.cipher === null ? '' : ''), - pair[0], - pair[1]); - - if (testConfig.cipher === null) { - cipher = new NullCipher(1, onCipherData); - decipher = new NullDecipher(1, onDecipherPayload); - macSize = 0; - } else { - cipherInfo = CIPHER_INFO[testConfig.cipher]; - let macInfo; - let macKey; - if (testConfig.mac) { - macInfo = MAC_INFO[testConfig.mac]; - macKey = randomBytes(macInfo.len); - macSize = macInfo.actualLen; - } else if (cipherInfo.authLen) { - macSize = cipherInfo.authLen; - } else { - throw new Error('Missing MAC for cipher'); - } - const key = randomBytes(cipherInfo.keyLen); - const iv = (cipherInfo.ivLen - ? randomBytes(cipherInfo.ivLen) - : Buffer.alloc(0)); - config = { - outbound: { - onWrite: onCipherData, - cipherInfo, - cipherKey: Buffer.from(key), - cipherIV: Buffer.from(iv), - seqno: 1, - macInfo, - macKey: (macKey && Buffer.from(macKey)), - forceNative: (pair[0] === 'native'), - }, - inbound: { - onPayload: onDecipherPayload, - decipherInfo: cipherInfo, - decipherKey: Buffer.from(key), - decipherIV: Buffer.from(iv), - seqno: 1, - macInfo, - macKey: (macKey && Buffer.from(macKey)), - forceNative: (pair[1] === 'native'), - }, - }; - cipher = createCipher(config); - decipher = createDecipher(config); - - if (pair[0] === 'binding') - assert(/binding/i.test(cipher.constructor.name)); - else - assert(/native/i.test(cipher.constructor.name)); - if (pair[1] === 'binding') - assert(/binding/i.test(decipher.constructor.name)); - else - assert(/native/i.test(decipher.constructor.name)); - } - - let expectedSeqno; - // Test zero-length payload ============================================ - payload = Buffer.alloc(0); - expectedSeqno = 2; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test single byte payload ============================================ - payload = Buffer.from([ 0xEF ]); - expectedSeqno = 3; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, 3); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test large payload ================================================== - payload = randomBytes(32 * 1024); - expectedSeqno = 4; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test sequnce number rollover ======================================== - payload = randomBytes(4); - expectedSeqno = 0; - cipher.outSeqno = decipher.inSeqno = (2 ** 32) - 1; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test chunked input -- split length bytes ============================ - payload = randomBytes(32 * 768); - expectedSeqno = 1; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, 2), undefined); - assert.strictEqual(decipher.decrypt(ciphered, 2, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test chunked input -- split length from payload ===================== - payload = randomBytes(32 * 768); - expectedSeqno = 2; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual(decipher.decrypt(ciphered, 0, 4), undefined); - assert.strictEqual(decipher.decrypt(ciphered, 4, ciphered.length), - undefined); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test chunked input -- split length and payload from MAC ============= - payload = randomBytes(32 * 768); - expectedSeqno = 3; - - reset(); - packet = cipher.allocPacket(payload.length); - payload.copy(packet, 5); - cipher.encrypt(packet); - assert.strictEqual( - decipher.decrypt(ciphered, 0, ciphered.length - macSize), - undefined - ); - assert.strictEqual( - decipher.decrypt(ciphered, - ciphered.length - macSize, - ciphered.length), - undefined - ); - - assert.strictEqual(cipher.outSeqno, expectedSeqno); - assert(ciphered.length >= 9 + macSize); - assert.strictEqual(decipher.inSeqno, cipher.outSeqno); - assert.strictEqual(deciphered.length, 1); - assert.deepStrictEqual(deciphered[0], payload); - - // Test packet length checks =========================================== - [0, 2 ** 32 - 1].forEach((n) => { - reset(); - packet = cipher.allocPacket(0); - packet.writeUInt32BE(n, 0); // Overwrite packet length field - cipher.encrypt(packet); - let threw = false; - try { - decipher.decrypt(ciphered, 0, ciphered.length); - } catch (ex) { - threw = true; - assert(ex instanceof Error); - assert(/packet length/i.test(ex.message)); - } - if (!threw) - throw new Error('Expected error'); - - // Recreate deciphers since errors leave them in an unusable state. - // We recreate the ciphers as well so that internal states of both - // ends match again. - reinit(); - }); - - // Test minimum padding length check =================================== - if (testConfig.cipher !== null) { - let payloadLen; - const blockLen = cipherInfo.blockLen; - if (/chacha|gcm/i.test(testConfig.cipher) - || /etm/i.test(testConfig.mac)) { - payloadLen = blockLen - 2; - } else { - payloadLen = blockLen - 6; - } - const minLen = 4 + 1 + payloadLen + (blockLen + 1); - // We don't do strict equality checks here since the length of the - // returned Buffer can vary due to implementation details. - assert(cipher.allocPacket(payloadLen).length >= minLen); - } - - // ===================================================================== - cipher.free(); - decipher.free(); - if (testConfig.cipher === null) - break; - } - }); - } - - // Test createCipher()/createDecipher() exceptions - { - [ - [ - [true, null], - /invalid config/i - ], - [ - [{}], - [/invalid outbound/i, /invalid inbound/i] - ], - [ - [{ outbound: {}, inbound: {} }], - [/invalid outbound\.onWrite/i, /invalid inbound\.onPayload/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: true - }, - inbound: { - onPayload: () => {}, - decipherInfo: true - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: null - }, - inbound: { - onPayload: () => {}, - decipherInfo: null - }, - }, - ], - [/invalid outbound\.cipherInfo/i, /invalid inbound\.decipherInfo/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: {}, - cipherKey: {}, - }, - inbound: { - onPayload: () => {}, - decipherInfo: {}, - decipherKey: {}, - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 32 }, - cipherKey: Buffer.alloc(8), - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 32 }, - decipherKey: Buffer.alloc(8), - }, - }, - ], - [/invalid outbound\.cipherKey/i, /invalid inbound\.decipherKey/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 12 }, - cipherKey: Buffer.alloc(1), - cipherIV: true - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 12 }, - decipherKey: Buffer.alloc(1), - cipherIV: true - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 12 }, - cipherKey: Buffer.alloc(1), - cipherIV: null - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 12 }, - decipherKey: Buffer.alloc(1), - cipherIV: null - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 12 }, - cipherKey: Buffer.alloc(1), - cipherIV: {} - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 12 }, - decipherKey: Buffer.alloc(1), - cipherIV: {} - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 12 }, - cipherKey: Buffer.alloc(1), - cipherIV: Buffer.alloc(1) - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 12 }, - decipherKey: Buffer.alloc(1), - cipherIV: Buffer.alloc(1) - }, - }, - ], - [/invalid outbound\.cipherIV/i, /invalid inbound\.decipherIV/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0 }, - cipherKey: Buffer.alloc(1), - seqno: true - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0 }, - decipherKey: Buffer.alloc(1), - seqno: true - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0 }, - cipherKey: Buffer.alloc(1), - seqno: -1 - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0 }, - decipherKey: Buffer.alloc(1), - seqno: -1 - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0 }, - cipherKey: Buffer.alloc(1), - seqno: 2 ** 32 - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0 }, - decipherKey: Buffer.alloc(1), - seqno: 2 ** 32 - }, - }, - ], - [/invalid outbound\.seqno/i, /invalid inbound\.seqno/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0 - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0 - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: true - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: true - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: null - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: null - }, - }, - ], - [/invalid outbound\.macInfo/i, /invalid inbound\.macInfo/i] - ], - [ - [ - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 } - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 } - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: true - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: true - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: null - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: null - }, - }, - { outbound: { - onWrite: () => {}, - cipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - cipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: Buffer.alloc(1) - }, - inbound: { - onPayload: () => {}, - decipherInfo: { keyLen: 1, ivLen: 0, sslName: 'foo' }, - decipherKey: Buffer.alloc(1), - seqno: 0, - macInfo: { keyLen: 16 }, - macKey: Buffer.alloc(1) - }, - }, - ], - [/invalid outbound\.macKey/i, /invalid inbound\.macKey/i] - ], - ].forEach((testCase) => { - let errorChecks = testCase[1]; - if (!Array.isArray(errorChecks)) - errorChecks = [errorChecks[0], errorChecks[0]]; - for (const input of testCase[0]) { - assert.throws(() => createCipher(input), errorChecks[0]); - assert.throws(() => createDecipher(input), errorChecks[1]); - } - }); - } -})(); diff --git a/reverse_engineering/node_modules/ssh2/test/test-protocol-keyparser.js b/reverse_engineering/node_modules/ssh2/test/test-protocol-keyparser.js deleted file mode 100644 index 850d4058..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-protocol-keyparser.js +++ /dev/null @@ -1,145 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { readdirSync, readFileSync } = require('fs'); -const { inspect } = require('util'); - -const { parseKey } = require('../lib/protocol/keyParser.js'); - -const { EDDSA_SUPPORTED } = require('../lib/protocol/constants.js'); - -const BASE_PATH = `${__dirname}/fixtures/keyParser`; - -function failMsg(name, message, exit) { - const msg = `[${name}] ${message}`; - if (!exit) - return msg; - console.error(msg); - process.exit(1); -} - -readdirSync(BASE_PATH).forEach((name) => { - if (/\.result$/i.test(name)) - return; - if (/ed25519/i.test(name) && !EDDSA_SUPPORTED) - return; - - const isPublic = /\.pub$/i.test(name); - const isEncrypted = /_enc/i.test(name); - const isPPK = /^ppk_/i.test(name); - const key = readFileSync(`${BASE_PATH}/${name}`); - let res; - if (isEncrypted) - res = parseKey(key, (isPPK ? 'node.js' : 'password')); - else - res = parseKey(key); - let expected = JSON.parse( - readFileSync(`${BASE_PATH}/${name}.result`, 'utf8') - ); - if (typeof expected === 'string') { - if (!(res instanceof Error)) - failMsg(name, `Expected error: ${expected}`, true); - assert.strictEqual( - expected, - res.message, - failMsg(name, - 'Error message mismatch.\n' - + `Expected: ${inspect(expected)}\n` - + `Received: ${inspect(res.message)}`) - ); - } else if (res instanceof Error) { - failMsg(name, `Unexpected error: ${res.stack}`, true); - } else { - if (Array.isArray(expected) && !Array.isArray(res)) - failMsg(name, 'Expected array but did not receive one', true); - if (!Array.isArray(expected) && Array.isArray(res)) - failMsg(name, 'Received array but did not expect one', true); - - if (!Array.isArray(res)) { - res = [res]; - expected = [expected]; - } else if (res.length !== expected.length) { - failMsg(name, - `Expected ${expected.length} keys, but received ${res.length}`, - true); - } - - res.forEach((curKey, i) => { - const details = { - type: curKey.type, - comment: curKey.comment, - public: curKey.getPublicPEM(), - publicSSH: curKey.getPublicSSH() - && curKey.getPublicSSH().toString('base64'), - private: curKey.getPrivatePEM() - }; - assert.deepStrictEqual( - details, - expected[i], - failMsg(name, - 'Parser output mismatch.\n' - + `Expected: ${inspect(expected[i])}\n\n` - + `Received: ${inspect(details)}`) - ); - }); - } - - if (isEncrypted && !isPublic) { - // Make sure parsing encrypted keys without a passhprase or incorrect - // passphrase results in an appropriate error - const err = parseKey(key); - if (!(err instanceof Error)) - failMsg(name, 'Expected error during parse without passphrase', true); - if (!/no passphrase/i.test(err.message)) { - failMsg(name, - `Error during parse without passphrase: ${err.message}`, - true); - } - } - - if (!isPublic) { - // Try signing and verifying to make sure the private/public key PEMs are - // correct - const data = Buffer.from('hello world'); - res.forEach((curKey) => { - let result = curKey.sign(data); - if (result instanceof Error) { - failMsg(name, - `Error while signing data with key: ${result.message}`, - true); - } - result = curKey.verify(data, result); - if (result instanceof Error) { - failMsg(name, - `Error while verifying signed data with key: ${result.message}`, - true); - } - if (!result) - failMsg(name, 'Failed to verify signed data with key', true); - }); - if (res.length === 1 && !isPPK) { - const pubFile = readFileSync(`${BASE_PATH}/${name}.pub`); - const pubParsed = parseKey(pubFile); - if (!(pubParsed instanceof Error)) { - let result = res[0].sign(data); - if (result instanceof Error) { - failMsg(name, - `Error while signing data with key: ${result.message}`, - true); - } - result = pubParsed.verify(data, result); - if (result instanceof Error) { - failMsg(name, - 'Error while verifying signed data with separate public key: ' - + result.message, - true); - } - if (!result) { - failMsg(name, - 'Failed to verify signed data with separate public key', - true); - } - } - } - } -}); diff --git a/reverse_engineering/node_modules/ssh2/test/test-server-hostkeys.js b/reverse_engineering/node_modules/ssh2/test/test-server-hostkeys.js deleted file mode 100644 index 30938640..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-server-hostkeys.js +++ /dev/null @@ -1,136 +0,0 @@ -'use strict'; - -const assert = require('assert'); - -const { - fixtureKey, - mustCall, - setup, -} = require('./common.js'); - -const debug = false; - -[ - { desc: 'RSA user key (old OpenSSH)', - hostKey: fixtureKey('id_rsa') }, - { desc: 'RSA user key (new OpenSSH)', - hostKey: fixtureKey('openssh_new_rsa') }, - { desc: 'DSA host key', - hostKey: fixtureKey('ssh_host_dsa_key') }, - { desc: 'ECDSA host key', - hostKey: fixtureKey('ssh_host_ecdsa_key') }, - { desc: 'PPK', - hostKey: fixtureKey('id_rsa.ppk') }, -].forEach((test) => { - const { desc, hostKey } = test; - const clientKey = fixtureKey('openssh_new_rsa'); - const username = 'KeyUser'; - const { server } = setup( - desc, - { - client: { - username, - privateKey: clientKey.raw, - algorithms: { - serverHostKey: [ hostKey.key.type ], - } - }, - server: { hostKeys: [ hostKey.raw ] }, - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.signature, 'Missing publickey signature'); - // FALLTHROUGH - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - conn.end(); - })); - })); -}); - - -{ - const RSA_KEY = fixtureKey('ssh_host_rsa_key'); - const ECDSA_KEY = fixtureKey('ssh_host_ecdsa_key'); - [ RSA_KEY, ECDSA_KEY ].forEach((key) => { - const selKeyType = key.key.type; - const clientKey = fixtureKey('openssh_new_rsa'); - const username = 'KeyUser'; - const { client, server } = setup( - `Multiple host key types (${key.type} selected)`, - { - client: { - username, - privateKey: clientKey.raw, - algorithms: { - serverHostKey: [ selKeyType ], - } - }, - server: { hostKeys: [ RSA_KEY.raw, ECDSA_KEY.raw ] }, - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.signature, 'Missing publickey signature'); - // FALLTHROUGH - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - conn.end(); - })); - })); - client.on('handshake', mustCall((info) => { - assert(info.serverHostKey === selKeyType, 'Wrong host key selected'); - })); - }); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-sftp.js b/reverse_engineering/node_modules/ssh2/test/test-sftp.js deleted file mode 100644 index 50e56f5d..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-sftp.js +++ /dev/null @@ -1,782 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { constants } = require('fs'); - -const { - fixture, - mustCall, - mustCallAtLeast, - mustNotCall, - setup: setup_, - setupSimple -} = require('./common.js'); - -const { OPEN_MODE, Stats, STATUS_CODE } = require('../lib/protocol/SFTP.js'); - -const DEBUG = false; - -setup('open', mustCall((client, server) => { - const path_ = '/tmp/foo.txt'; - const handle_ = Buffer.from('node.js'); - const pflags_ = (OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.WRITE); - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === pflags_, `Wrong flags: ${flagsToHuman(pflags)}`); - server.handle(id, handle_); - server.end(); - })); - client.open(path_, 'w', mustCall((err, handle) => { - assert(!err, `Unexpected open() error: ${err}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - })); -})); - -setup('close', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - server.on('CLOSE', mustCall((id, handle) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.close(handle_, mustCall((err) => { - assert(!err, `Unexpected close() error: ${err}`); - })); -})); - -setup('read', mustCall((client, server) => { - const expected = Buffer.from('node.jsnode.jsnode.jsnode.jsnode.jsnode.js'); - const handle_ = Buffer.from('node.js'); - const buf = Buffer.alloc(expected.length); - server.on('READ', mustCall((id, handle, offset, len) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert(offset === 5, `Wrong read offset: ${offset}`); - assert(len === buf.length, `Wrong read len: ${len}`); - server.data(id, expected); - server.end(); - })); - client.read(handle_, buf, 0, buf.length, 5, mustCall((err, nb) => { - assert(!err, `Unexpected read() error: ${err}`); - assert.deepStrictEqual(buf, expected, 'read data mismatch'); - })); -})); - -setup('read (overflow)', mustCall((client, server) => { - const maxChunk = client._maxReadLen; - const expected = Buffer.alloc(3 * maxChunk, 'Q'); - const handle_ = Buffer.from('node.js'); - const buf = Buffer.alloc(expected.length, 0); - let reqs = 0; - server.on('READ', mustCall((id, handle, offset, len) => { - ++reqs; - assert.strictEqual(id, reqs - 1, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert.strictEqual(offset, - (reqs - 1) * maxChunk, - `Wrong read offset: ${offset}`); - server.data(id, expected.slice(offset, offset + len)); - if (reqs === 3) - server.end(); - }, 3)); - client.read(handle_, buf, 0, buf.length, 0, mustCall((err, nb) => { - assert(!err, `Unexpected read() error: ${err}`); - assert.deepStrictEqual(buf, expected); - assert.strictEqual(nb, buf.length, 'read nb mismatch'); - })); -})); - -setup('write', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const buf = Buffer.from('node.jsnode.jsnode.jsnode.jsnode.jsnode.js'); - server.on('WRITE', mustCall((id, handle, offset, data) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert(offset === 5, `Wrong write offset: ${offset}`); - assert.deepStrictEqual(data, buf, 'write data mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.write(handle_, buf, 0, buf.length, 5, mustCall((err, nb) => { - assert(!err, `Unexpected write() error: ${err}`); - assert.strictEqual(nb, buf.length, 'wrong bytes written'); - })); -})); - -setup('write (overflow)', mustCall((client, server) => { - const maxChunk = client._maxWriteLen; - const handle_ = Buffer.from('node.js'); - const buf = Buffer.allocUnsafe(3 * maxChunk); - let reqs = 0; - server.on('WRITE', mustCall((id, handle, offset, data) => { - ++reqs; - assert.strictEqual(id, reqs - 1, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert.strictEqual(offset, - (reqs - 1) * maxChunk, - `Wrong write offset: ${offset}`); - assert((offset + data.length) <= buf.length, 'bad offset'); - assert.deepStrictEqual(data, - buf.slice(offset, offset + data.length), - 'write data mismatch'); - server.status(id, STATUS_CODE.OK); - if (reqs === 3) - server.end(); - }, 3)); - client.write(handle_, buf, 0, buf.length, 0, mustCall((err, nb) => { - assert(!err, `Unexpected write() error: ${err}`); - assert.strictEqual(nb, buf.length, 'wrote bytes written'); - })); -})); - -setup('lstat', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const attrs_ = new Stats({ - size: 10 * 1024, - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.on('LSTAT', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.attrs(id, attrs_); - server.end(); - })); - client.lstat(path_, mustCall((err, attrs) => { - assert(!err, `Unexpected lstat() error: ${err}`); - assert.deepStrictEqual(attrs, attrs_, 'attrs mismatch'); - })); -})); - -setup('fstat', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const attrs_ = new Stats({ - size: 10 * 1024, - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.on('FSTAT', mustCall((id, handle) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.attrs(id, attrs_); - server.end(); - })); - client.fstat(handle_, mustCall((err, attrs) => { - assert(!err, `Unexpected fstat() error: ${err}`); - assert.deepStrictEqual(attrs, attrs_, 'attrs mismatch'); - })); -})); - -setup('setstat', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const attrs_ = new Stats({ - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.on('SETSTAT', mustCall((id, path, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert.deepStrictEqual(attrs, attrs_, 'attrs mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.setstat(path_, attrs_, mustCall((err) => { - assert(!err, `Unexpected setstat() error: ${err}`); - })); -})); - -setup('fsetstat', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const attrs_ = new Stats({ - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.on('FSETSTAT', mustCall((id, handle, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert.deepStrictEqual(attrs, attrs_, 'attrs mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.fsetstat(handle_, attrs_, mustCall((err) => { - assert(!err, `Unexpected fsetstat() error: ${err}`); - })); -})); - -setup('opendir', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const path_ = '/tmp'; - server.on('OPENDIR', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.handle(id, handle_); - server.end(); - })); - client.opendir(path_, mustCall((err, handle) => { - assert(!err, `Unexpected opendir() error: ${err}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - })); -})); - -setup('readdir', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const list_ = [ - { filename: '.', - longname: 'drwxr-xr-x 56 nodejs nodejs 4096 Nov 10 01:05 .', - attrs: new Stats({ - mode: 0o755 | constants.S_IFDIR, - size: 4096, - uid: 9001, - gid: 8001, - atime: 1415599549, - mtime: 1415599590 - }) - }, - { filename: '..', - longname: 'drwxr-xr-x 4 root root 4096 May 16 2013 ..', - attrs: new Stats({ - mode: 0o755 | constants.S_IFDIR, - size: 4096, - uid: 0, - gid: 0, - atime: 1368729954, - mtime: 1368729999 - }) - }, - { filename: 'foo', - longname: 'drwxrwxrwx 2 nodejs nodejs 4096 Mar 8 2009 foo', - attrs: new Stats({ - mode: 0o777 | constants.S_IFDIR, - size: 4096, - uid: 9001, - gid: 8001, - atime: 1368729954, - mtime: 1368729999 - }) - }, - { filename: 'bar', - longname: '-rw-r--r-- 1 nodejs nodejs 513901992 Dec 4 2009 bar', - attrs: new Stats({ - mode: 0o644 | constants.S_IFREG, - size: 513901992, - uid: 9001, - gid: 8001, - atime: 1259972199, - mtime: 1259972199 - }) - } - ]; - server.on('READDIR', mustCall((id, handle) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.name(id, list_); - server.end(); - })); - client.readdir(handle_, mustCall((err, list) => { - assert(!err, `Unexpected readdir() error: ${err}`); - assert.deepStrictEqual(list, - list_.slice(2), - 'dir list mismatch'); - })); -})); - -setup('readdir (full)', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - const list_ = [ - { filename: '.', - longname: 'drwxr-xr-x 56 nodejs nodejs 4096 Nov 10 01:05 .', - attrs: new Stats({ - mode: 0o755 | constants.S_IFDIR, - size: 4096, - uid: 9001, - gid: 8001, - atime: 1415599549, - mtime: 1415599590 - }) - }, - { filename: '..', - longname: 'drwxr-xr-x 4 root root 4096 May 16 2013 ..', - attrs: new Stats({ - mode: 0o755 | constants.S_IFDIR, - size: 4096, - uid: 0, - gid: 0, - atime: 1368729954, - mtime: 1368729999 - }) - }, - { filename: 'foo', - longname: 'drwxrwxrwx 2 nodejs nodejs 4096 Mar 8 2009 foo', - attrs: new Stats({ - mode: 0o777 | constants.S_IFDIR, - size: 4096, - uid: 9001, - gid: 8001, - atime: 1368729954, - mtime: 1368729999 - }) - }, - { filename: 'bar', - longname: '-rw-r--r-- 1 nodejs nodejs 513901992 Dec 4 2009 bar', - attrs: new Stats({ - mode: 0o644 | constants.S_IFREG, - size: 513901992, - uid: 9001, - gid: 8001, - atime: 1259972199, - mtime: 1259972199 - }) - } - ]; - server.on('READDIR', mustCall((id, handle) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.name(id, list_); - server.end(); - })); - client.readdir(handle_, { full: true }, mustCall((err, list) => { - assert(!err, `Unexpected readdir() error: ${err}`); - assert.deepStrictEqual(list, list_, 'dir list mismatch'); - })); -})); - -setup('readdir (EOF)', mustCall((client, server) => { - const handle_ = Buffer.from('node.js'); - server.on('READDIR', mustCall((id, handle) => { - assert(id === 0, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.EOF); - server.end(); - })); - client.readdir(handle_, mustCall((err, list) => { - assert(err && err.code === STATUS_CODE.EOF, - `Expected EOF, got: ${err}`); - })); -})); - -setup('unlink', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - server.on('REMOVE', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.unlink(path_, mustCall((err) => { - assert(!err, `Unexpected unlink() error: ${err}`); - })); -})); - -setup('mkdir', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - server.on('MKDIR', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.mkdir(path_, mustCall((err) => { - assert(!err, `Unexpected mkdir() error: ${err}`); - })); -})); - -setup('rmdir', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - server.on('RMDIR', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.rmdir(path_, mustCall((err) => { - assert(!err, `Unexpected rmdir() error: ${err}`); - })); -})); - -setup('realpath', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const name_ = { filename: '/tmp/foo' }; - server.on('REALPATH', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.name(id, name_); - server.end(); - })); - client.realpath(path_, mustCall((err, name) => { - assert(!err, `Unexpected realpath() error: ${err}`); - assert.deepStrictEqual(name, name_.filename, 'name mismatch'); - })); -})); - -setup('stat', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const attrs_ = new Stats({ - mode: 0o644 | constants.S_IFREG, - size: 10 * 1024, - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.on('STAT', mustCall((id, path) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - server.attrs(id, attrs_); - server.end(); - })); - client.stat(path_, mustCall((err, attrs) => { - assert(!err, `Unexpected stat() error: ${err}`); - assert.deepStrictEqual(attrs, attrs_, 'attrs mismatch'); - const expectedTypes = { - isDirectory: false, - isFile: true, - isBlockDevice: false, - isCharacterDevice: false, - isSymbolicLink: false, - isFIFO: false, - isSocket: false - }; - for (const [fn, expect] of Object.entries(expectedTypes)) - assert(attrs[fn]() === expect, `attrs.${fn}() failed`); - })); -})); - -setup('rename', mustCall((client, server) => { - const oldPath_ = '/foo/bar/baz'; - const newPath_ = '/tmp/foo'; - server.on('RENAME', mustCall((id, oldPath, newPath) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(oldPath === oldPath_, `Wrong old path: ${oldPath}`); - assert(newPath === newPath_, `Wrong new path: ${newPath}`); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.rename(oldPath_, newPath_, mustCall((err) => { - assert(!err, `Unexpected rename() error: ${err}`); - })); -})); - -setup('readlink', mustCall((client, server) => { - const linkPath_ = '/foo/bar/baz'; - const name = { filename: '/tmp/foo' }; - server.on('READLINK', mustCall((id, linkPath) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(linkPath === linkPath_, `Wrong link path: ${linkPath}`); - server.name(id, name); - server.end(); - })); - client.readlink(linkPath_, mustCall((err, targetPath) => { - assert(!err, `Unexpected readlink() error: ${err}`); - assert(targetPath === name.filename, - `Wrong target path: ${targetPath}`); - })); -})); - -setup('symlink', mustCall((client, server) => { - const linkPath_ = '/foo/bar/baz'; - const targetPath_ = '/tmp/foo'; - server.on('SYMLINK', mustCall((id, linkPath, targetPath) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(linkPath === linkPath_, `Wrong link path: ${linkPath}`); - assert(targetPath === targetPath_, `Wrong target path: ${targetPath}`); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.symlink(targetPath_, linkPath_, mustCall((err) => { - assert(!err, `Unexpected symlink() error: ${err}`); - })); -})); - -setup('readFile', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const handle_ = Buffer.from('hi mom!'); - const data_ = Buffer.from('hello world'); - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === OPEN_MODE.READ, `Wrong flags: ${flagsToHuman(pflags)}`); - server.handle(id, handle_); - })).on('FSTAT', mustCall((id, handle) => { - assert(id === 1, `Wrong request id: ${id}`); - const attrs = new Stats({ - size: data_.length, - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.attrs(id, attrs); - })).on('READ', mustCall((id, handle, offset, len) => { - assert(id === 2, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert(offset === 0, `Wrong read offset: ${offset}`); - server.data(id, data_); - })).on('CLOSE', mustCall((id, handle) => { - assert(id === 3, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.readFile(path_, mustCall((err, buf) => { - assert(!err, `Unexpected error: ${err}`); - assert.deepStrictEqual(buf, data_, 'data mismatch'); - })); -})); - -setup('readFile (no size from fstat)', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const handle_ = Buffer.from('hi mom!'); - const data_ = Buffer.from('hello world'); - let reads = 0; - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === OPEN_MODE.READ, `Wrong flags: ${flagsToHuman(pflags)}`); - server.handle(id, handle_); - })).on('FSTAT', mustCall((id, handle) => { - assert(id === 1, `Wrong request id: ${id}`); - const attrs = new Stats({ - uid: 9001, - gid: 9001, - atime: (Date.now() / 1000) | 0, - mtime: (Date.now() / 1000) | 0 - }); - server.attrs(id, attrs); - })).on('READ', mustCall((id, handle, offset, len) => { - assert(++reads + 1 === id, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - switch (id) { - case 2: - assert(offset === 0, `Wrong read offset for first read: ${offset}`); - server.data(id, data_); - break; - case 3: - assert(offset === data_.length, - `Wrong read offset for second read: ${offset}`); - server.status(id, STATUS_CODE.EOF); - break; - } - }, 2)).on('CLOSE', mustCall((id, handle) => { - assert(id === 4, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - client.readFile(path_, mustCall((err, buf) => { - assert(!err, `Unexpected error: ${err}`); - assert.deepStrictEqual(buf, data_, 'data mismatch'); - })); -})); - -setup('ReadStream', mustCall((client, server) => { - let reads = 0; - const path_ = '/foo/bar/baz'; - const handle_ = Buffer.from('hi mom!'); - const data_ = Buffer.from('hello world'); - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === OPEN_MODE.READ, `Wrong flags: ${flagsToHuman(pflags)}`); - server.handle(id, handle_); - })).on('READ', mustCall((id, handle, offset, len) => { - assert(id === ++reads, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - if (reads === 1) { - assert(offset === 0, `Wrong read offset: ${offset}`); - server.data(id, data_); - } else { - server.status(id, STATUS_CODE.EOF); - } - }, 2)).on('CLOSE', mustCall((id, handle) => { - assert(id === 3, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - let buf = []; - client.createReadStream(path_).on('readable', mustCallAtLeast(function() { - let chunk; - while ((chunk = this.read()) !== null) - buf.push(chunk); - })).on('end', mustCall(() => { - buf = Buffer.concat(buf); - assert.deepStrictEqual(buf, data_, 'data mismatch'); - })); -})); - -setup('ReadStream (fewer bytes than requested)', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - const handle_ = Buffer.from('hi mom!'); - const data_ = Buffer.from('hello world'); - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - server.handle(id, handle_); - })).on('READ', mustCallAtLeast((id, handle, offset, len) => { - if (offset > data_.length) { - server.status(id, STATUS_CODE.EOF); - } else { - // Only read 4 bytes at a time - server.data(id, data_.slice(offset, offset + 4)); - } - })).on('CLOSE', mustCall((id, handle) => { - server.status(id, STATUS_CODE.OK); - server.end(); - })); - let buf = []; - client.createReadStream(path_).on('readable', mustCallAtLeast(function() { - let chunk; - while ((chunk = this.read()) !== null) - buf.push(chunk); - })).on('end', mustCall(() => { - buf = Buffer.concat(buf); - assert.deepStrictEqual(buf, data_, 'data mismatch'); - })); -})); - -setup('ReadStream (error)', mustCall((client, server) => { - const path_ = '/foo/bar/baz'; - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === OPEN_MODE.READ, `Wrong flags: ${flagsToHuman(pflags)}`); - server.status(id, STATUS_CODE.NO_SUCH_FILE); - server.end(); - })); - client.createReadStream(path_).on('error', mustCall((err) => { - assert(err.code === STATUS_CODE.NO_SUCH_FILE); - })); -})); - -setup('WriteStream', mustCall((client, server) => { - let writes = 0; - const path_ = '/foo/bar/baz'; - const handle_ = Buffer.from('hi mom!'); - const data_ = Buffer.from('hello world'); - const pflags_ = OPEN_MODE.TRUNC | OPEN_MODE.CREAT | OPEN_MODE.WRITE; - server.on('OPEN', mustCall((id, path, pflags, attrs) => { - assert(id === 0, `Wrong request id: ${id}`); - assert(path === path_, `Wrong path: ${path}`); - assert(pflags === pflags_, `Wrong flags: ${flagsToHuman(pflags)}`); - server.handle(id, handle_); - })).on('FSETSTAT', mustCall((id, handle, attrs) => { - assert(id === 1, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert.strictEqual(attrs.mode, 0o666, 'Wrong file mode'); - server.status(id, STATUS_CODE.OK); - })).on('WRITE', mustCall((id, handle, offset, data) => { - assert(id === ++writes + 1, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - assert(offset === ((writes - 1) * data_.length), - `Wrong write offset: ${offset}`); - assert.deepStrictEqual(data, data_, 'Wrong data'); - server.status(id, STATUS_CODE.OK); - }, 3)).on('CLOSE', mustCall((id, handle) => { - assert(id === 5, `Wrong request id: ${id}`); - assert.deepStrictEqual(handle, handle_, 'handle mismatch'); - server.status(id, STATUS_CODE.OK); - server.end(); - })); - - const writer = client.createWriteStream(path_); - writer.cork && writer.cork(); - writer.write(data_); - writer.write(data_); - writer.write(data_); - writer.uncork && writer.uncork(); - writer.end(); -})); - -{ - const { client, server } = setup_( - 'SFTP server aborts with exit-status', - { - client: { username: 'foo', password: 'bar' }, - server: { hostKeys: [ fixture('ssh_host_rsa_key') ] }, - }, - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - ctx.accept(); - })).on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('sftp', mustCall((accept, reject) => { - const sftp = accept(); - - // XXX: hack - sftp._protocol.exitStatus(sftp.outgoing.id, 127); - sftp._protocol.channelClose(sftp.outgoing.id); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - const timeout = setTimeout(mustNotCall(), 1000); - client.sftp(mustCall((err, sftp) => { - clearTimeout(timeout); - assert(err, 'Expected error'); - assert(err.code === 127, `Expected exit code 127, saw: ${err.code}`); - client.end(); - })); - })); -} - - -// ============================================================================= -function setup(title, cb) { - const { client, server } = setupSimple(DEBUG, title); - let clientSFTP; - let serverSFTP; - - const onSFTP = mustCall(() => { - if (clientSFTP && serverSFTP) - cb(clientSFTP, serverSFTP); - }, 2); - - client.on('ready', mustCall(() => { - client.sftp(mustCall((err, sftp) => { - assert(!err, `[${title}] Unexpected client sftp start error: ${err}`); - sftp.on('close', mustCall(() => { - client.end(); - })); - clientSFTP = sftp; - onSFTP(); - })); - })); - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - accept().on('sftp', mustCall((accept, reject) => { - const sftp = accept(); - sftp.on('close', mustCall(() => { - conn.end(); - })); - serverSFTP = sftp; - onSFTP(); - })); - })); - })); - })); -} - -function flagsToHuman(flags) { - const ret = []; - - for (const [name, value] of Object.entries(OPEN_MODE)) { - if (flags & value) - ret.push(name); - } - - return ret.join(' | '); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-shell.js b/reverse_engineering/node_modules/ssh2/test/test-shell.js deleted file mode 100644 index debba11c..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-shell.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const { - mustCall, - mustCallAtLeast, - setupSimple, -} = require('./common.js'); - -const DEBUG = false; - -const setup = setupSimple.bind(undefined, DEBUG); - -{ - const { client, server } = setup('Simple shell()'); - - const OUTPUT = 'shell output!\n'; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - const session = accept(); - session.on('pty', mustCall((accept, reject, info) => { - accept(); - session.on('shell', mustCall((accept, reject) => { - let input = ''; - const stream = accept(); - stream.write(OUTPUT); - stream.on('data', mustCallAtLeast((data) => { - input += data; - if (input === 'exit\n') { - stream.end(); - conn.end(); - } - })); - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let output = ''; - client.on('close', mustCall(() => { - assert(output === OUTPUT, `Wrong shell output: ${inspect(output)}`); - })).shell(mustCall((err, stream) => { - assert(!err, `Unexpected shell error: ${err}`); - stream.write('exit\n'); - stream.on('data', mustCallAtLeast((d) => { - output += d; - })).on('close', mustCall(() => {})); - })); - })); -} - -{ - const { client, server } = setup('Shell with environment set'); - - const OUTPUT = 'shell output!\n'; - const clientEnv = { SSH2NODETEST: 'foo' }; - - server.on('connection', mustCall((conn) => { - conn.on('ready', mustCall(() => { - conn.on('session', mustCall((accept, reject) => { - let pty = false; - let env = false; - accept().on('pty', mustCall((accept, reject, info) => { - accept(); - pty = true; - })).on('env', mustCall((accept, reject, info) => { - accept && accept(); - env = true; - assert(info.key === Object.keys(clientEnv)[0], - `Wrong env key: ${inspect(info.key)}`); - assert(info.val === Object.values(clientEnv)[0], - `Wrong env value: ${inspect(info.val)}`); - })).on('shell', mustCall((accept, reject) => { - assert(pty, 'Expected pty before shell'); - assert(env, 'Expected env before shell'); - let input = ''; - const stream = accept(); - stream.write(OUTPUT); - stream.on('data', mustCallAtLeast((data) => { - input += data; - if (input === 'exit\n') { - stream.end(); - conn.end(); - } - })); - })); - })); - })); - })); - - client.on('ready', mustCall(() => { - let output = ''; - client.on('close', mustCall(() => { - assert(output === OUTPUT, `Wrong shell output: ${inspect(output)}`); - })).shell({ env: clientEnv }, mustCall((err, stream) => { - assert(!err, `Unexpected shell error: ${err}`); - stream.write('exit\n'); - stream.on('data', mustCallAtLeast((d) => { - output += d; - })).on('close', mustCall(() => {})); - })); - })); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-userauth-agent-openssh.js b/reverse_engineering/node_modules/ssh2/test/test-userauth-agent-openssh.js deleted file mode 100644 index 55d1a25a..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-userauth-agent-openssh.js +++ /dev/null @@ -1,109 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { spawnSync } = require('child_process'); - -const debug = false; -const SPAWN_OPTS = { windowsHide: true }; - -// TODO: figure out why this test is failing on Windows -if (process.platform === 'win32') { - console.log('Skipping ssh-agent test on Windows'); - process.exit(0); -} - -if (process.argv[2] === 'child') { - const { - fixtureKey, - mustCall, - setup, - } = require('./common.js'); - - const serverCfg = { hostKeys: [ fixtureKey('ssh_host_rsa_key').raw ] }; - - const clientKey = fixtureKey('openssh_new_rsa'); - - // Add key to the agent first - { - const { - error, status - } = spawnSync('ssh-add', [ clientKey.fullPath ], SPAWN_OPTS); - if (error || status !== 0) { - console.error('Failed to add key to agent'); - process.exit(1); - } - } - - const username = 'Agent User'; - const { server } = setup( - 'Agent authentication', - { - client: { username, agent: process.env.SSH_AUTH_SOCK }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.signature, 'Missing publickey signature'); - // FALLTHROUGH - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - conn.end(); - })); - })); -} else { - { - const { - error, status - } = spawnSync('which', ['ssh-agent'], SPAWN_OPTS); - - if (error || status !== 0) { - console.log('No ssh-agent available, skipping agent test ...'); - process.exit(0); - } - } - - { - const { - error, status - } = spawnSync('which', ['ssh-add'], SPAWN_OPTS); - - if (error || status !== 0) { - console.log('No ssh-add available, skipping agent test ...'); - process.exit(0); - } - } - - const { - error, status - } = spawnSync('ssh-agent', - [ process.execPath, __filename, 'child' ], - { ...SPAWN_OPTS, stdio: 'inherit' }); - if (error || status !== 0) - throw new Error('Agent test failed'); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-userauth-agent.js b/reverse_engineering/node_modules/ssh2/test/test-userauth-agent.js deleted file mode 100644 index a28ad0bf..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-userauth-agent.js +++ /dev/null @@ -1,170 +0,0 @@ -'use strict'; - -const assert = require('assert'); - -const debug = false; - -const { - fixtureKey, - mustCall, - setup, -} = require('./common.js'); -const { - AgentProtocol, - BaseAgent, - utils: { parseKey }, -} = require('../lib/index.js'); - -const serverCfg = { hostKeys: [ fixtureKey('ssh_host_rsa_key').raw ] }; - -const clientKey = fixtureKey('openssh_new_rsa'); - -{ - let getIdentitiesCount = 0; - let signCount = 0; - class MyAgent extends BaseAgent { - getIdentities(cb) { - assert.strictEqual(++getIdentitiesCount, 1); - // Ensure that no private portion of the key is used by re-parsing the - // public version of the key - cb(null, [ parseKey(clientKey.key.getPublicSSH()) ]); - } - sign(pubKey, data, options, cb) { - assert.strictEqual(++signCount, 1); - assert.strictEqual(pubKey.getPublicPEM(), clientKey.key.getPublicPEM()); - const sig = clientKey.key.sign(data, options.hash); - cb(null, sig); - } - } - - const username = 'Agent User'; - const { server } = setup( - 'Custom agent authentication', - { - client: { username, agent: new MyAgent() }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.signature, 'Missing publickey signature'); - // FALLTHROUGH - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - assert.strictEqual(getIdentitiesCount, 1); - assert.strictEqual(signCount, 1); - conn.end(); - })); - })); -} -{ - const client = new AgentProtocol(true); - const server = new AgentProtocol(false); - - server.on('identities', mustCall((req) => { - setImmediate(() => server.failureReply(req)); - })); - client.getIdentities(mustCall((err, keys) => { - assert(err, 'Missing expected error'); - })); - - client.pipe(server).pipe(client); -} -{ - const client = new AgentProtocol(true); - const server = new AgentProtocol(false); - - server.on('identities', mustCall((req) => { - const keys = [ clientKey.key ]; - server.getIdentitiesReply(req, keys); - })); - client.getIdentities(mustCall((err, keys) => { - assert(!err, 'Unexpected error'); - assert.strictEqual(keys.length, 1); - assert.strictEqual(keys[0].isPrivateKey(), false); - assert.strictEqual(keys[0].getPublicPEM(), clientKey.key.getPublicPEM()); - })); - - client.pipe(server).pipe(client); -} -{ - const client = new AgentProtocol(true); - const server = new AgentProtocol(false); - const buf = Buffer.from('data to sign'); - - server.on('sign', mustCall((req, pubKey, data, options) => { - assert.strictEqual(pubKey.getPublicPEM(), clientKey.key.getPublicPEM()); - assert.deepStrictEqual(data, buf); - assert.strictEqual(options.hash, undefined); - server.failureReply(req); - })); - client.sign(clientKey.key.getPublicSSH(), - buf, - mustCall((err, signature) => { - assert(err, 'Missing expected error'); - })); - - client.pipe(server).pipe(client); -} -{ - const client = new AgentProtocol(true); - const server = new AgentProtocol(false); - const buf = Buffer.from('data to sign'); - - server.on('sign', mustCall((req, pubKey, data, options) => { - assert.strictEqual(pubKey.getPublicPEM(), clientKey.key.getPublicPEM()); - assert.deepStrictEqual(data, buf); - assert.strictEqual(options.hash, undefined); - server.signReply(req, clientKey.key.sign(data)); - })); - client.sign(clientKey.key.getPublicSSH(), - buf, - mustCall((err, signature) => { - assert(!err, 'Unexpected error'); - const pubKey = parseKey(clientKey.key.getPublicSSH()); - assert.strictEqual(pubKey.verify(buf, signature), true); - })); - - client.pipe(server).pipe(client); -} -{ - // Test that outstanding requests are handled upon unexpected closure of the - // protocol stream - - const client = new AgentProtocol(true); - const server = new AgentProtocol(false); - - server.on('identities', mustCall((req) => { - server.destroy(); - })); - client.getIdentities(mustCall((err) => { - assert(err, 'Missing expected error'); - })); - - client.pipe(server).pipe(client); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test-userauth.js b/reverse_engineering/node_modules/ssh2/test/test-userauth.js deleted file mode 100644 index fb2fe9e9..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test-userauth.js +++ /dev/null @@ -1,608 +0,0 @@ -'use strict'; - -const assert = require('assert'); -const { inspect } = require('util'); - -const { - fixtureKey, - mustCall, - mustNotCall, - setup, -} = require('./common.js'); - -const serverCfg = { hostKeys: [ fixtureKey('ssh_host_rsa_key').raw ] }; - -const debug = false; - -// Keys ======================================================================== -[ - { desc: 'RSA (old OpenSSH)', - clientKey: fixtureKey('id_rsa') }, - { desc: 'RSA (new OpenSSH)', - clientKey: fixtureKey('openssh_new_rsa') }, - { desc: 'RSA (encrypted)', - clientKey: fixtureKey('id_rsa_enc', 'foobarbaz'), - passphrase: 'foobarbaz' }, - { desc: 'DSA', - clientKey: fixtureKey('id_dsa') }, - { desc: 'ECDSA', - clientKey: fixtureKey('id_ecdsa') }, - { desc: 'PPK', - clientKey: fixtureKey('id_rsa.ppk') }, -].forEach((test) => { - const { desc, clientKey, passphrase } = test; - const username = 'Key User'; - const { server } = setup( - desc, - { - client: { username, privateKey: clientKey.raw, passphrase }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.signature, 'Missing publickey signature'); - // FALLTHROUGH - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - break; - } - if (ctx.signature) { - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify publickey signature'); - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - conn.end(); - })); - })); -}); - - -// Password ==================================================================== -{ - const username = 'Password User'; - const password = 'hi mom'; - const { server } = setup( - 'Password', - { - client: { username, password }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - if (++authAttempt === 1) { - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - } - assert(ctx.method === 'password', - `Wrong auth method: ${ctx.method}`); - assert(ctx.password === password, - `Wrong password: ${ctx.password}`); - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.end(); - })); - })); -} -{ - const username = ''; - const password = 'hi mom'; - const { server } = setup( - 'Password (empty username)', - { - client: { username, password }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - if (++authAttempt === 1) { - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - } - assert(ctx.method === 'password', - `Wrong auth method: ${ctx.method}`); - assert(ctx.password === password, - `Wrong password: ${ctx.password}`); - ctx.accept(); - }, 2)).on('ready', mustCall(() => { - conn.end(); - })); - })); -} -{ - const username = 'foo'; - const oldPassword = 'bar'; - const newPassword = 'baz'; - const changePrompt = 'Prithee changeth thy password'; - const { client, server } = setup( - 'Password (change requested)', - { - client: { username, password: oldPassword }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - if (++authAttempt === 1) { - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - } - assert(ctx.method === 'password', - `Wrong auth method: ${ctx.method}`); - assert(ctx.password === oldPassword, - `Wrong old password: ${ctx.password}`); - ctx.requestChange(changePrompt, mustCall((newPassword_) => { - assert(newPassword_ === newPassword, - `Wrong new password: ${newPassword_}`); - ctx.accept(); - })); - }, 2)).on('ready', mustCall(() => { - conn.end(); - })); - })); - - client.on('change password', mustCall((prompt, done) => { - assert(prompt === changePrompt, `Wrong password change prompt: ${prompt}`); - process.nextTick(done, newPassword); - })); -} - - -// Hostbased =================================================================== -{ - const localUsername = 'Local User Foo'; - const localHostname = 'Local Host Bar'; - const username = 'Hostbased User'; - const clientKey = fixtureKey('id_rsa'); - const { server } = setup( - 'Hostbased', - { - client: { - username, - privateKey: clientKey.raw, - localUsername, - localHostname, - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - switch (++authAttempt) { - case 1: - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 2: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - case 3: - assert(ctx.method === 'hostbased', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Wrong key algo: ${ctx.key.algo}`); - assert.deepStrictEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - assert(ctx.signature, 'Expected signature'); - assert(ctx.localHostname === localHostname, 'Wrong local hostname'); - assert(ctx.localUsername === localUsername, 'Wrong local username'); - assert(clientKey.key.verify(ctx.blob, ctx.signature) === true, - 'Could not verify hostbased signature'); - - break; - } - ctx.accept(); - }, 3)).on('ready', mustCall(() => { - conn.end(); - })); - })); -} - - -// keyboard-interactive ======================================================== -{ - const username = 'Keyboard-Interactive User'; - const request = { - name: 'SSH2 Authentication', - instructions: 'These are instructions', - prompts: [ - { prompt: 'Password: ', echo: false }, - { prompt: 'Is the cake a lie? ', echo: true }, - ], - }; - const responses = [ - 'foobarbaz', - 'yes', - ]; - const { client, server } = setup( - 'Password (empty username)', - { - client: { - username, - tryKeyboard: true, - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let authAttempt = 0; - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, - `Wrong username: ${ctx.username}`); - if (++authAttempt === 1) { - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - return ctx.reject(); - } - assert(ctx.method === 'keyboard-interactive', - `Wrong auth method: ${ctx.method}`); - ctx.prompt(request.prompts, - request.name, - request.instructions, - mustCall((responses_) => { - assert.deepStrictEqual(responses_, responses); - ctx.accept(); - })); - }, 2)).on('ready', mustCall(() => { - conn.end(); - })); - })); - - client.on('keyboard-interactive', - mustCall((name, instructions, lang, prompts, finish) => { - assert(name === request.name, `Wrong prompt name: ${name}`); - assert(instructions === request.instructions, - `Wrong prompt instructions: ${instructions}`); - assert.deepStrictEqual( - prompts, - request.prompts, - `Wrong prompts: ${inspect(prompts)}` - ); - process.nextTick(finish, responses); - })); -} - -// authHandler() tests ========================================================= -{ - const username = 'foo'; - const password = '1234'; - const clientKey = fixtureKey('id_rsa'); - const { server } = setup( - 'authHandler() (sync)', - { - client: { - username, - password, - privateKey: clientKey.raw, - - authHandler: mustCall((methodsLeft, partial, cb) => { - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - return 'none'; - }), - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, `Wrong username: ${ctx.username}`); - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const clientKey = fixtureKey('id_rsa'); - const { server } = setup( - 'authHandler() (async)', - { - client: { - username, - password, - privateKey: clientKey.raw, - - authHandler: mustCall((methodsLeft, partial, cb) => { - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - process.nextTick(mustCall(cb), 'none'); - }), - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, `Wrong username: ${ctx.username}`); - assert(ctx.method === 'none', `Wrong auth method: ${ctx.method}`); - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const clientKey = fixtureKey('id_rsa'); - const { client, server } = setup( - 'authHandler() (no methods left -- sync)', - { - client: { - username, - password, - privateKey: clientKey.raw, - - authHandler: mustCall((methodsLeft, partial, cb) => { - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - return false; - }), - }, - server: serverCfg, - - debug, - noForceClientReady: true, - noForceServerReady: true, - } - ); - - // Remove default client error handler added by `setup()` since we are - // expecting an error in this case - client.removeAllListeners('error'); - - client.on('error', mustCall((err) => { - assert.strictEqual(err.level, 'client-authentication'); - assert(/configured authentication methods failed/i.test(err.message), - 'Wrong error message'); - })); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustNotCall()) - .on('ready', mustNotCall()); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const clientKey = fixtureKey('id_rsa'); - const { client, server } = setup( - 'authHandler() (no methods left -- async)', - { - client: { - username, - password, - privateKey: clientKey.raw, - - authHandler: mustCall((methodsLeft, partial, cb) => { - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - process.nextTick(mustCall(cb), false); - }), - }, - server: serverCfg, - - debug, - noForceClientReady: true, - noForceServerReady: true, - } - ); - - // Remove default client error handler added by `setup()` since we are - // expecting an error in this case - client.removeAllListeners('error'); - - client.on('error', mustCall((err) => { - assert.strictEqual(err.level, 'client-authentication'); - assert(/configured authentication methods failed/i.test(err.message), - 'Wrong error message'); - })); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustNotCall()) - .on('ready', mustNotCall()); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const clientKey = fixtureKey('id_rsa'); - const events = []; - const expectedEvents = [ - 'client', 'server', 'client', 'server' - ]; - let clientCalls = 0; - const { client, server } = setup( - 'authHandler() (multi-step)', - { - client: { - username, - password, - privateKey: clientKey.raw, - - authHandler: mustCall((methodsLeft, partial, cb) => { - events.push('client'); - switch (++clientCalls) { - case 1: - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - return 'publickey'; - case 2: - assert.deepStrictEqual( - methodsLeft, - ['password'], - `expected 'password' method left, saw: ${methodsLeft}` - ); - assert(partial === true, 'expected partial success'); - return 'password'; - } - }, 2), - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - let attempts = 0; - conn.on('authentication', mustCall((ctx) => { - assert(++attempts === clientCalls, 'server<->client state mismatch'); - assert(ctx.username === username, - `Unexpected username: ${ctx.username}`); - events.push('server'); - switch (attempts) { - case 1: - assert(ctx.method === 'publickey', - `Wrong auth method: ${ctx.method}`); - assert(ctx.key.algo === clientKey.key.type, - `Unexpected key algo: ${ctx.key.algo}`); - assert.deepEqual(clientKey.key.getPublicSSH(), - ctx.key.data, - 'Public key mismatch'); - ctx.reject(['password'], true); - break; - case 2: - assert(ctx.method === 'password', - `Wrong auth method: ${ctx.method}`); - assert(ctx.password === password, - `Unexpected password: ${ctx.password}`); - ctx.accept(); - break; - } - }, 2)).on('ready', mustCall(() => { - conn.end(); - })); - })); - - client.on('close', mustCall(() => { - assert.deepStrictEqual(events, expectedEvents); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const { server } = setup( - 'authHandler() (custom auth configuration)', - { - client: { - username: 'bar', - password: '5678', - - authHandler: mustCall((methodsLeft, partial, cb) => { - assert(methodsLeft === null, 'expected null methodsLeft'); - assert(partial === null, 'expected null partial'); - return { - type: 'password', - username, - password, - }; - }), - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, `Wrong username: ${ctx.username}`); - assert(ctx.method === 'password', `Wrong auth method: ${ctx.method}`); - assert(ctx.password === password, `Unexpected password: ${ctx.password}`); - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} -{ - const username = 'foo'; - const password = '1234'; - const { server } = setup( - 'authHandler() (simple construction with custom auth configuration)', - { - client: { - username: 'bar', - password: '5678', - - authHandler: [{ - type: 'password', - username, - password, - }], - }, - server: serverCfg, - - debug, - } - ); - - server.on('connection', mustCall((conn) => { - conn.on('authentication', mustCall((ctx) => { - assert(ctx.username === username, `Wrong username: ${ctx.username}`); - assert(ctx.method === 'password', `Wrong auth method: ${ctx.method}`); - assert(ctx.password === password, `Unexpected password: ${ctx.password}`); - ctx.accept(); - })).on('ready', mustCall(() => { - conn.end(); - })); - })); -} diff --git a/reverse_engineering/node_modules/ssh2/test/test.js b/reverse_engineering/node_modules/ssh2/test/test.js deleted file mode 100644 index d0380f29..00000000 --- a/reverse_engineering/node_modules/ssh2/test/test.js +++ /dev/null @@ -1,20 +0,0 @@ -'use strict'; - -const { spawnSync } = require('child_process'); -const { readdirSync } = require('fs'); -const { join } = require('path'); - -const files = readdirSync(__dirname).sort(); -for (const filename of files) { - if (filename.startsWith('test-')) { - const path = join(__dirname, filename); - console.log(`> Running ${filename} ...`); - const result = spawnSync(`${process.argv0} ${path}`, { - shell: true, - stdio: 'inherit', - windowsHide: true - }); - if (result.status !== 0) - process.exitCode = 1; - } -} diff --git a/reverse_engineering/node_modules/ssh2/util/build_pagent.bat b/reverse_engineering/node_modules/ssh2/util/build_pagent.bat deleted file mode 100644 index 9f5aaf88..00000000 --- a/reverse_engineering/node_modules/ssh2/util/build_pagent.bat +++ /dev/null @@ -1,2 +0,0 @@ -@cl /Ox pagent.c User32.lib -@del /Q *.obj \ No newline at end of file diff --git a/reverse_engineering/node_modules/ssh2/util/pagent.c b/reverse_engineering/node_modules/ssh2/util/pagent.c deleted file mode 100644 index e900491c..00000000 --- a/reverse_engineering/node_modules/ssh2/util/pagent.c +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include -#include - -#define AGENT_COPYDATA_ID 0x804e50ba -#define AGENT_MAX_MSGLEN 8192 - -#define GET_32BIT_MSB_FIRST(cp) \ - (((unsigned long)(unsigned char)(cp)[0] << 24) | \ - ((unsigned long)(unsigned char)(cp)[1] << 16) | \ - ((unsigned long)(unsigned char)(cp)[2] << 8) | \ - ((unsigned long)(unsigned char)(cp)[3])) - -#define GET_32BIT(cp) GET_32BIT_MSB_FIRST(cp) - -#define RET_ERR_BADARGS 10 -#define RET_ERR_UNAVAILABLE 11 -#define RET_ERR_NOMAP 12 -#define RET_ERR_BINSTDIN 13 -#define RET_ERR_BINSTDOUT 14 -#define RET_ERR_BADLEN 15 - -#define RET_NORESPONSE 1 -#define RET_RESPONSE 0 - -int main (int argc, const char* argv[]) { - HWND hwnd; - char *mapname; - HANDLE filemap; - unsigned char *p, *ret; - int id, retlen, inlen, n, rmode, r = RET_NORESPONSE; - COPYDATASTRUCT cds; - void *in; - - if (argc < 2) - return RET_ERR_BADARGS; - - hwnd = FindWindow("Pageant", "Pageant"); - if (!hwnd) - return RET_ERR_UNAVAILABLE; - - rmode = _setmode(_fileno(stdin), _O_BINARY); - if (rmode == -1) - return RET_ERR_BINSTDIN; - - rmode = _setmode(_fileno(stdout), _O_BINARY); - if (rmode == -1) - return RET_ERR_BINSTDOUT; - - inlen = atoi(argv[1]); - in = malloc(inlen); - n = fread(in, 1, inlen, stdin); - if (n != inlen) { - free(in); - return RET_ERR_BADLEN; - } - - mapname = malloc(32); - n = sprintf(mapname, "PageantRequest%08x", (unsigned)GetCurrentThreadId()); - - filemap = CreateFileMapping(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, - 0, AGENT_MAX_MSGLEN, mapname); - if (filemap == NULL || filemap == INVALID_HANDLE_VALUE) { - free(in); - free(mapname); - return RET_ERR_NOMAP; - } - - p = MapViewOfFile(filemap, FILE_MAP_WRITE, 0, 0, 0); - memcpy(p, in, inlen); - cds.dwData = AGENT_COPYDATA_ID; - cds.cbData = 1 + n; - cds.lpData = mapname; - - id = SendMessage(hwnd, WM_COPYDATA, (WPARAM) NULL, (LPARAM) &cds); - if (id > 0) { - r = RET_RESPONSE; - retlen = 4 + GET_32BIT(p); - fwrite(p, 1, retlen, stdout); - } - - free(in); - free(mapname); - UnmapViewOfFile(p); - CloseHandle(filemap); - - return r; -} diff --git a/reverse_engineering/node_modules/ssh2/util/pagent.exe b/reverse_engineering/node_modules/ssh2/util/pagent.exe deleted file mode 100644 index 6e8a71ca581ecd0f3ad621efffc366f9f1edf9da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 50688 zcmeFaeSB0!mOp&^B}pggguk{jJ)UwrU@oNd;wqMz&KH}TJbU(hD;J5=04w3w>t@r zv(G+%JzYv*Pe`jfrRMED-jMP^q>3z-2BwjC+G6?yH4K8<6BSGaCh)z z0o_W}-<>m3TZoz6vwWJ6_2r;*su~Ty3y6|nMu-Eik1tCGO zP{gP!P?$Oi|7?P{fdf)L%FNwSha!cH{}hC|-1iTD`UGKi(mzNW7ya0C-x-VTf{<;Z zHV$gcd!=;yCJ8~u7W@!iA$&2s;p6{u(E2Ou*4`%FCJ5^;Mij~va`83d8~4wPs;@M` zgq~SQXvIfmK8tVMKQB_Qth@d0dwvLda3Y}(Upl@xF~Lj!yn=8&_xzuq|IhS*aw1#V zoSS3qu;&t0)hF-8{1B9b*=<3g)hh%Y_%SkFKl2J|ajqlWDktwv9R&yp0=qg{5d16w zzsf2wUz*zgh=IJmZw9?2(U2LG2pOfuZWUXQ&APmYjc>$VeDF$ zk(sgGEBJ#hG^v8UXC-K7MNr5Qgj%82j?X|FXQ8zK(^&W~Vq=tW`qmH|iIM?8|5=wC znNEUOmYaXGHWa923=IR;If%(ck&z|2IpqMn!FzK@ac=%A{-q(5J6m0qTL2W$li}7a z*NeMt`{?H+{rnaAXr2j5yPX}OPC~Z@YAuzl1%sqXxwDjm zt^j)kO{icG@`gAnjZ6oy0&;dj4h2-NT*G@I!0zIJx0`^7-b<5|r)kD=?Syi|SrMqz z>YZUjnyS>h1nGQD&Ik|4=d<5jAP618B!IKU@VZ;qtX_GjO)GPR4@sXXore3}!NEeG zYvYIFi}kL-5~maRsb#}zeZTf+$)S~GslFjSslzu!>qZzI`5KDSmO2|gbpTSjN-MF4 zTcw#|(~A^;*3(sI#ef^~uyHN>8HV|?Eq2R1^l9FoE%n3tO`htZx|>jSYJfcnq^dxV z^-BE^a!SeWceS=bc_{A;We>3R81^bZ`*kKCX3(Q_oA!>UW205;w3H3!eeCI|^K13} z`emALSlllJ{A?1)wW^9BFEf0@!2L!bA8y@B=mS|Hd`t{4FbqTUxqAOLVi?L&XO7m9 z*M>fjoxPvOV|@L(Uh51B|KSzb{>kXGfkN3SU05i)q-=Lnb zvZ!y_`-o{X0UrMo=%)d=5{W)DuvBO!aj~d@g?l zYK-{0{T;p@RI|0icj9`~#L}{`i#sh#Q2$UKD9P+b#)wj7YM9Et9BAmy412E zwR#w&d4W=&AxIhFL!is_v3C3xx#M&xXN3nO=O|rfY`9Q4Ye>$DTA`f%(^Z@j01zDm z*tiRXn-M46`o2-B?I)`3k5la*(fk;YRBY00k=XQC>i!tbdg_P8pZ)<6mBzJ1zVZ;; zcx8-!E%ifre@4e$RzIxO_w|MW<*DwkTcypxhd3?hgSNc(OfIW(}4%9vE3bReE(ocwP*IIl-d0m(JhV|S4yX+Ex zQ0&c0{jeZiq?HXBzM&=y5w?LT>gy+hz68Z1tGCgNap@;O^EpKGZvfmqpvpZ&@mGP~rOONDEcpsvx`@&PRQUTQ z=FGFEHu6c3beE;_mzG;{Mi#FGDE%=upF1!HcEV4;K;A^>D$MV4deXE`}mJ+%!6gIFi$Vq#tit4t(t|_fEgjV97 zQFV1&tt;py(s(fg6UOH(;t0(y;`m%qWTFGdj@bYQNM*4r02*7Uj!Z;nbQ-~kN z8e5(0pgRPf@VeGUy)@VCrBh}vX-VS#;(WW(ZIRxq zV2#&eD3sfW1uba+u@+AL6>K}Gx~d8kri-j)v_Pe-$A~YzG;UaW*@eKP4OmsME-K2T zJFKV}|4bI-Svhg1nvKASdR^6RduO(Kg|;2tC%i(SHe)q_(REg|CDGGfpQN?7P)aR0 zq;IIus+NPt`N}!1)*evjP#XL2oP>nh3s$VgM)We3t0(Lrc-3iDqB+U|d&B8x4|s*m zU)7GR21EfMDzyXX7|m{W%o*j&>CrC}HG2}R77kClggsfds#hcX^$n*VLx#<7uW`4o zZezd0E*>iK(qxem*a_fZ%%Qqi@)>lP+4um+lef>)S9ejvNE7Pbc!BnIUT5@lf)aI= zv%>{~(6H1=qhF<`DD61`BQqCMDZc)r_mrWG`bkQw%g=rZV315hsR@t%^ErtdGPA@c z2y*b2d!lvIi+F`u4YxXtt%i{oMMHT(n}2}ns@u%GGf`bUZ<&LNJe^TLF_woTS@!qf zZ_+=^!Ai8ysg=33dWRO(j@sHiBO4r^A@TmFz$G-CMze&vY^5j!dK9FIl>y~TQTamj zjI3TGC-hp-p1}?*QG%Qi?X@bO*_6|cy30;IW8^;iRJK>pI$ohfrPp5PRJv`pP9rz` z(iH5Txsjbn-VS#*xd#!~hc5$xi;p%ZHYGKeSeh1DnoF!GwrP=7X}2jIyznLvV-T4oB<}G+nUu*@oi1VNj#@;yZ}1i^}#n zR;+_5o8`}Wi`!>D)eG}K}YevF9&xKoIbDKl~EDC-60w*e*WWw8*A>&3o?~-h00rS2W=kgBcsE zudT{Ad=#3-L2e%hhZdlPu`&DFrhG#qE8ZW#zA!Ea%I*UWL-+(B=D_E|mxV6}pBo?g zIvahR4L1vJ7TgTD8E{>2U2vUnop2p+9dPY%?dOh-*+)xI-ZFe^@ol2A<6~1|Ll2A_ z3m!&m$BhHp1{gE$oUt>R$08@z7%SG8FD}O#gT4Ez%i=roeBx^`lWQ}Ax6-C^OFHoz zg>zbudj&Z)fMXKYlYC6@y=AuuLQNr~(u)>+Z)5x3!Oj=$AZmg$J5L)bL7n=?rhjOrq1jQc1O3EXWnUx}HE$rhN zaIqFAVH3C%-W@ZMvt<^3{KlLdIL4f8D$CPHOpOzqd!gJTC;Hh&K(k-sN54|@ozNUw zvRZcBU(UXojZ&~i-_A7OaeyoJJp#d36MQ{>Vp|*ddUj(Pb~V;K4=mrK*b4cWl+&^o zU{g*ThU#-_CC;j6?*}K|h@H^fZ|OWl`}9@l(r3L=8oQGxU4$vEe_r7}_N+ykq^`C< z>k=D(ia2elL+Kt-)726xOzHkc>9oQR2(bIl(Lqw4#oil2>soU>eUg)PaKG2nC#Qjn zWb;Af#AYQ0m_8p~@aJ@QcMs?3SsOV4s~VlEm37 z6^wG3(wT!=fwz92R)&4Rkftc7N2EzwROz0s9gUtzh;}F1?2i(sr6=t5zU~zUy!IR^ zqt;qcQO+JfA6}PjVZJDkDAzuWs6Cb%piAQgW=HbnH8h83u4& zvvPIp(6qM)hiulgKoE93+l~qQI#9&!L|ba5+fc)^{~MjZuYmvNrP<|PHW)l%%;eE z{Dw|r_JvMczbUsCK-LrS_51Z3#r;t~ zdxwY&!iwv(2-TT)*jDDkdBD>tKJW|*25h((@fChn0Z2?qP=wg{uw4)q8XOUQO0A{B z1oE@1#=-m;Fz!~rzcwLK)?Z$0iA1QNa=)>Q`XrXy$Sk1t_Js$;#v){>6(YQ~{s7^q zg{e`RfUYw#X9JLWJOyAHuUd-`wb-I+m}sYP7j=`kZ2+8xvX9y?h>dT75J$@d4&w@K z_w}cpQ}AzjMk>T2Zrh1~5vKADUV5*BlIB_@`&_Ghp}5EGKBSDGr=v=nRpH23)m_v+ zH9|GV0B<&U9BT#HRMmKRPm1BiR1YuI8pBh%tTt_hU*+lS=jQ-tb3CYhCN>b$6!QAS z`%mM<*y}*Lmfk$k#Ik9bI9p3si^YQ8Z$M4%LqwVdM4CGg4DBPD5mY`9V)$8FP&lO( zmVvgu1%!6kJ&?xP!x1`DCEom4ra0saT zKX1&jd8akQeg(!?=*D<8T(<7oK);n}_1s^7w+_0lnXUH=5l$V-$6(7^VRo zhjb~@lxJu{0Cy8}B3Z(HH6g!H+%wVkiS2C@e+BqoVA(~ZTAQ}AM$OWAvuy2_T~vhm zTcf&c?G5`VVuV_@_y1|j?!>(LZp&_?xbZDpL@m3KLz;7)&v62=;zUD-oZWU7kq(!pKSEyipJm(7VUWtx4eJVVnAt02vZbIVuw9wNwh zEBiQ%bVY5#>OwvRAxZo#)(vw@XD`F6=Iirg({mq!Rr=NO)rJ;xuOw=m3_}GM$aZ(D zp3Cm#`N1;@>^^vv94=>cY8;U~zErH#%7)jt-&)PKfpI!S0)o(gcm?(#z+*@JDU4P* z@(jQ<4z5!?HXD3OZcF>94TtvRc*84=I`&)1*dJ^Xw4jXHbQK_*D5SVIh zalsK)1A%>VfXzYwROwd**k%v~?NGB+~2laN&a(QBVmNGDPe<3k#&x8h9e7A_dTl zLhz$iRql7MSC`+(=B$G3f)LXgYjip!6jkQ*T*>}|g9-7bI92Tjfwu-~ zt?YG^LUGDkh1@7)1)SAp=NfaUYmLlhyj;mvZFEDFJ1U2zliZ6y=S^aF@Q-yM0FmtI z$bjFozqR)O4r~(_D5tNeI~ghci*kCxMl9GXAh5B&^(xY;+Y*YAuQt8P(>bN};;7Q< zsBUAwx{}UNa^l{cgI)o09!DG77LUp`qnu_v0rnZPL&s3AI@ta2R%w0gRk&(C<^dP; zjQ#{eSKxqa(5&K0HTCXXR|H>PH&kYvYOeMTyI=RKw=)Rlp-YO2s(BRyOS7}i!|4P$EA2}n()HINTP>?^e; z4`f7&AAlmMPZLPRbx6w4K4KY=c%f2DxOJ0v>mtoJq;;WI`R!1>AxODe;<+fikJBWf z5a1|W#|~21*Kf8C6SJRMs~7KN#w?U-mX=z6egV`=!CnvG17XU61+96Lu*BeNjgz*_mcd+ePP1F)QVh6nIta64@ zy3UG9EP9IOK*?S^CAP1wK42FH7C609qH-TpXt~B>`=(TFLX#ED_U=~Q3DJJJpWVq< zKrEtIDHGd_M3b`1vETG*AG2>T=LZ%!y)?eVQi`(GA;@;iH2ntl0aCDm=`+#DWAf`XpZt!+Xik*EKav%b~fBsbRiAhH2ST!?Yr@ zyD(tb*z#C5Dvlj#Upos1d*4nZ3sQ;}egPik)^*1>z)pQH9z}DVo(PL zytyGUd@p*%J>VG;8}ERx`F!^wbr)aickyL^*Gs^s>CtcS+xV{7SO|<3srzVMFXUk2 zwo4EdxxRbuijAVU|A4qZ=tPw7WX$s*CAM&6dkfxso|%P4@cmi9tQsdvEv~R zAS1NqqeCBoqweCJwTpM6xxeh9?Lyr}-PijFvY`%z$&;cwtDAx!Ds>qnEUz1PAYI&--^OKG#4Bde_(R-YtXzzj#u z9|g4!^2lB?6Vdp9-_@ET?tddv>^Nc)K<`)B>D67-vfe+#OT}JtZn2a`#kL|j)(5>W z!LRW>aD0Khl*f4~i>2kEGeN01bmnd;D|BX~7;Zqk*&YGD-Z}!Cf44koQ7jTF4s*DA zE0JXOj;r^^QGZVFeE6G_=3XmL3vIQ`ma`y1kL5)V#qv%8%v?8zxWj}a_fD~~m)v{A#!tzW#m0}x-6S?1C3l6`cnGe#i|9dlhQ=0~IL#}+xch*g zoxx5AX0JI+WLE`cZ-i!BgcBV5FU*(bq!YWNBK7V?1>BXlV3;KP?lwAF&(AYT>o(S2h0F+`3VDiy)8WI1IlN#j!j!aF(P zW$I)QjtS^OIpZjkFc2G`2dD1&L{8l?8*G6ZrbvzdcJMWa8qv!SE)3mHc0y?DeR+^W zU5c`)&5zNMa1#gY z;BXXaW;C(ty$Tg+w$W(-aj*xbQJ%M@*=F;Ig2mS$r=T`S8T?>6t`VdPk1Yg$CMGw3 zw7q_|&;yF;?L@RPv`&187!9%UIDVC(+r@3WdHfyXgR_a*8@f}vR~h=TG*cP6M-2ZP z(gye_g-o=8gdp7(8x6EwU#_`Fab~-5!Xs(abx;wS*>WUjjTWXQvqnvX7?gX}#IcU) zjZz2mHOFgKffW-+eVRdoQ6WUA{u-!iHm$<0v^jd;MnIkrI&+8oLzA2k7WB$OPFhRxiiA_m^FU^=s2Cv2>K#23Gs0hyiIrN;l;2?|-jU(EV)GpYoHGGbi zL6f9#M4=#z6<2A@DUHEaRfYD^6u$$OF2}|L6psPSze1i68w|7#)1HWjCJxk<{LNU)Y0;9ek6%6tL$EHkL>9{yIQ5a{zmJd-#16mERQp z08R(r!a)Q=?-IaZw2(mz-%KU9*$1LIQkK~r15t1|;%f_sbvwkAyTaff#~K%#1=}$uf7FI#tNU22@9Lf7=->i{uf2nO89J9H zw2ss^Iq^b{bVNR7ZY2g^Ofl7eP6_PDzCjHh8X%m<(bu8e1`rL2rEf@J5-o2RT}1rjsLb=^1b@}#WjdeQd+H^ zx8+lLd__7sq|f9_)!5WEmnuDJaR~D21TSF!X2O~^Df?cLmH`L9#yeKrljyHaB$;(2ydCBHZ-io-d2y2Ei>{ob zMJO64ok=DTN8%95hiQ)-)u$@_ux{uX1~1RVQaj9kLm+0Ggw0pR@PwX+5C1r9b8cj% ze~&FKB{<0%oF!!c-G$~n!{e$n&JZ>yHSrC*u@y4A$WwsUIDhOOXg<>0fiC(UF4tTw z>3qK0{nkph1QYa78xD3axxK>gul5R`<6CfzSBT(y4BsdC#MyNC57JbGeNpDESi9VZ zuqHnmZ6U)aEgCx)n?j^awiAbo7_VIcZ|@l*hZ5(rirDxKyw7^Y@R#ITrBqXW*4u@k z(rJO5%GBIJ5EaP92BRn7xT7W-8?uZIjsW}QIJ(o%?!azO(ls*v6dN_lOS+Q#;Q{l0 zzg!+*FA*g1Q%(4CsnP9spy)$_T2mD-Y+MS zp-B$7h%H&PE6bVG42P8doPZrhPUK1Voh^;l`AqIE>VTHG5tR)Bo9wl_#?(kOG?j4ktzkH^8f3s~tEBX@U!eHa67gFH!voes1~Qs!~|8BrO(nt+uH*R?4??p^v}(U zp?OS^>bNQL-A0)!R6im#rD|eip(Q2~X)jJsNRj-S*t{ft1_Apx@cbr+CVI^r1d1US z06HT@p20ycAyC+n!o)cv4hk?ZGz4}DtnVUajD+fbEym?E^wcZ0y0h30$pWV+Lx*YLgQ3q{s;&hh4XYa?WbieGrk@ z+SF>uUiv*CygDH4CAquQ%sctgc#@@CP?$i$Su)cDrJP~jTGtSc3Ya3 z)LdpXElEt!XLzdnaYNS<9 zXtn@(s6Bjr=mrZKDTa@r71V>BaBpl*Z9KFoabfQR2tao#?mnc8%8-5QL{wgvextZM z)f;-b09>jdvF3^5?l;8!Dg|Nlo5n6ULBx1Dvg-f5z|$$)ZC$!o69?oZLK76PuQ$&seAo+2nZWl7)F)`gwz0k3-S~rM!ccPU9_u$T+XM?;Niu=MoODL0gTI6V2&7}iC!2); z|2P3%Km;@yb6QHb43Q zy|u(!4*f_B-$I_-PYAuM;DJdvnN>iu)cGF}H_is^sAlQ&UURwbggdre??zXhqgi@2 z2DW1qj1|NCf3I2EOKUQ;byHfsumY81#oWS+nS@&OJryhkYvlLqo*sshaa8v-W328g z%yPa@_w)-SnYyQ&so2r&oGx*YPVP2nM+AuXK7vTBcG7BCB>x0Htz9qWYvCl^P^g;# zyKJoJ4mSBCUccUfDPgYGbO-=O9QF@@U7yY(RMJINszW=e|E_k@in!n$cVL{_l3aWE zUFlADYjbg~qp?+<)Nm$*BI?rPR*?z4Rj|gd)J`jB>~&WUeyn_Ilbm@+o07=fu-76F zXr0k+hb>Bu3(gy`lZ5e`lz8fS6r5theMNAnU=3XvvYTxV9*6AA$Xv&lZ7DPOCW6pV z+--&v&^+Tv%m;z8;#PZ?N(lP6;#!+16@t~hij4~5NJ0b8Eq{%^Y z*~2-g5a)vwjt@muvC2GHz0E}%g1Pu%I|yCC$jbtiLDwyaS#=F=*<~Ybe-3`Cv>{LX zdQnS4F;?S<(qZ?E)SXm{UZQ%|td^z($;W2KYQpG}xsH)ZvF=u=0CR$jCQH(n7+eRt zh`NB(qgbj76H37;ijBnRwG_kK>~sB^41rJ&9v)|L zUZmCNpfg5oh_z7O$K$akFT_+c3>_s!uz!vPc}c7nHB%-GvQTB-M|cq=@Fq`nw?et% zalXFk-@FimdzGO{bzjpUYWCMRBPv#J!--)OGEO>AlnFMP#AMo#`&gB_&yG4hXT`?5 z0a$BeOWZW-Ll&_y$&Bz&1c)w8DcX6!D3DY_XG?hj{)O=^{=2OCj9MS%S%o=&$z*)^_xCa5Dc7E>8+lkFyyl)1-wd@R3C)Q61DdEt@_V9d=_51xEF- zxORhuk5-oi%;oAfPA8NN2O7GL6DjLq7A$PAnSzlgO&T>HTSqSY4K$^(1HfW^#Z)IU`$gplcg5TV&Z*Yr>vYv|OX_b*J7Uks^fVO4J`4L|agwhs8b4rP@*DGrQyv_a9bz^YzIMpW0BV zlpneASE19B5xdc*^yVnhL!PpX^%nqdN1<=HZl;{zDI3B)w6ZKaUsEpDd|5X=>yUH! z3SxtPjJiu-sVyHCUtFGHI|{oAYJT&6klog2?edgoEpn04ZIzN6aE}WIjE%`?Xp77oo+Aki_SG?*lv`~==+@~W zLs~_O#!4&# z&B-|3OJxI5hn$KoYeJU+iz00hasaIZvJSf2HQTh_UxZt%p0k@DbRW}BQ4ze`NMmk5Y=gQJLrd);{oeKxdjpQ{3AF<& z^pwa#gUdf!|AsR8f;Xf!*L5o#-(qx|kWh_+A+Qe-^_zXVgMrH`e$4Cv7p%0iV8t#C)j|D0{hc~bEq|u11uh8f^ zk9P7q0uuA)*0svqd_&5Qua;Bu4oj}Zl4G$vv7)wLcU08=O}ACl4j7pNYSWSwXClrB zdM0c8Q~VIX4#TTv0R@;b#P(0DtLQ7-415u3N{+xD83hMibsMZD93D*Nm70IMn?oJ#icHp+zTbdoFD=;>xbp{>JgY$|2obDCTuyXQB`6e3vI%2Rmq-*vleQ>%N>^Kly~Y;_O_^+;2B+3_o1oT?(l1w=x* z)GxTwwiGzDfoSR-sKkd^I=02c)#9wq6JT+qfTL?b2fK!K&uXJR^R|?4q zE+%*Ldte9FtZq|sIUpvXeo`|kw5fziU_WJsjUp!hLXXex!wVAUelNxl5msbS@>7tc)-C%W^;rKr{P|1hyJ75EEf6}NjU$Ul||O~F->VF z&6ZZ(4=P?keMD1bnw-b`0&AJMV#?=NvL#VuWq%mWgpt)#)p>eSCA*rEzT5Lx0M|B@ zdKp%*vAGe5m@QN0;iTc6%gt->N$;UusEg>xI?$%NA(1eBpZZCGZvdLwWb2V>9QBK0oCrg<{ z7m|}+bP+j8xI_H7MNVLcA)o{|3!AB6(=sBfQWP35FTk3iX)y0hTtm#j(p9i5)1sAy zE(xMCXXNGWz#K0@eA5u+zUX>8l3<1dLQc~Bj_|wudd=SerJPBCiR7&g6z=Wq;Spd! zyWoMnT7|ayR(0vE(9P4eyf8_UYICc!EvuBZg%0Qooeig{{LO#S1Z~UOq6hI{j-1?4 zvQ|N)zNH9hX1IaEKQ8)NJlsg()kQy#hr<+JS`>+g@2Bv*qKD#PlB?=h7CjsfH&b|8 z(JpJOd}I{#^rDw24CTjKAR-tW*48?VcdOJbYhh!I29{G`^{p%UK8PE$MK9p|E}*aL z&c{hgn?qOFa2pBd1KKLNn0juJWLXqo-&}xc7LgJy&54lud{t{-RLQP@f`XP@wTLdT zVJSImmQbO)18hGsgyt1hMOIj(i*P%J8K*H*s#FqS%n#r+XPJqfr-P)t2ppB|R0xx+ z)8HtuNB3bJnnBnI%B4a_!c#yKgNy;H!pkRZ#vH1U-NT{COKJ$cCw{J+`9b_3T@DF+ zg}XJNCTV}wmODF0{wfsu98xj~41Er}IuT5CXx>FK?)!kJ|NTX{H&lWseXfy&N#ww6 zu)^Hg**p!W7=H;HxfI=i7ECmfNIC)=wK8XOqTzEkSxQg=s%tzZT|=)j$j^n&=HQ;y z*<|@wD9PS_y&=$X0L_F!5YT8&oSTE2G|6&eiGFIS{y9%Lf&>!i0YPvlgrLi?xQ{J# zAJVNQ3qtc&Nv8?hOGs%noj?BIjFdosaFJ}+`t&q+E0$P1dVv8)qbqwNy`I1DBZn zU@I|_khI)c(n}Xskv*y1Do~G623K!7BGHo7E74~*@K}Z={)Px1rXd!va4L}?D6lUh zE==h9kc0_MQ;&Z{ll}=z`WiZd4L4XAZ zO%V^h;~RE<&|+t)E>p2(Z2?9QH4ZWw(t~2B?5T*k{ZFN?Ygx zrphm4VxJ*K27Kc<)WPmN4aBrASPOo_<**xT3f&S^i&kj*<)N6{SE&^h04@*+R!MChmTdnJXKH4u329U>_D`G-&>H1wmIHY4*{I9Pp=4^lcX z14iZxR6p*i$y1CuJ$!h`SOyZ*IKWN{wy$p6LCgakM<&4<=ENu@1ea-)V(g&uC_Nn< z=1a(=r12Vht1vpXj$n`&hn4SwIcR!%{i$n`MN`gC4bZr`&k9!_m#A$2@!T=cs#5enSfUkA3X#{|a2(Uy}OYWxqdmSUMEV^Vlgv?dAW1N8!m8EtA)>Kfu*F*hK z$@~JSb zWR@Aa$PCRkLm6ght{F-+LtZm9w1?*_HbY;Tp;9w++zhQMqG6&+4pRiW>$lWPTza%6 zNDuy?39V=XdR=TVXv8G2WWOZfc%N6AqqK=KB92yWZOh%rdvPUOHvxm=DdL9O84ZT_ zE#!A9^C7mVWPhQwcp=k}E5J&qTvmR>Fo>M_@Rfq`#HhjVWOGfwQ8}L2=<%0iHXBO< zCRrQyMp85c4}uyijSqu+$!+PTf%`D{0uS){@L}+29^gazp;AN;kek!AXrXBUt$Yyy z;x!qih=2tCB1i5HnprKBvV&$rM*?M>e+#Wa1jX~36S5^XbIcda%xUO1J|sQtPBfOy zfPmkaL)o=CG>>71#;0lwS;H*PMAn>|Ehe(O4))L~ZX)+Xt%zoJP*_C-&D;5raik?a ztBd3Gd^x!G7(M5oOV0oYNlYPHo;8fVK8KdUXyFB&k6@aL`$);uW~GaGR7oc%vdxPt`e>v#M5+^&bdfy>W zjH~UXWIwwRd8+hx%$wVGeq1--v5DZhno!QSBu-imTOepUGlF|*Cf|S@%3*_RNV;R< zi)_~SCSr30_5oZ|<*Bu4@Ad8gHJl^D=#0Vr=O`TW!>b?VB8k49Lh!1P#jbQixXuZ+Tq(L0`@{&C zmZWJ=z)*mM97$LuxwIdaCc|{s8@G@!`dt`(p#E7625gjraMA5SCm9e)nT6FZ$yG2- zJ`Vt3ZxY;xYE)dYAbx|BQ6F1?afe|-;ff4-nhBIB?oJ0(LG>`n?1xO5y;na>U z(+>yH9bDvDkBnN=3kWKwEn8;bmh2ar1GUMRK}07>^8{9y~|}S4}mwf~moq z2z_|KtjCvxrn=cxJcBeskHAyv#?-> z5F+Coyo3gxlcN^vXDZRb^?m#Be3RtXJQnHd3RX^WAfw}acyRNaGZ}Py)vny$gTq1( z)XeMzYJk=Sm)_oiFNW3k++-~SQl>S5{RGW7WyWS4(gl8HjUI|zmWyX%axDFAnw!#7ES?iICwPnO%^$thxka9EFE>616>H`j8^r|8E#6{n+$7}G6 z0@u|om}`qR6!14|zQH42sc33VVQH55$N}xZIae0V{Gk2PxwcMm&w`AKfVk)0MEARu zxNAeNBTj+F3HNb5r|Xh2Dz=ZIcu%=rX`Klj3gah*bBZ%n&9x)JAyBq?7m{dL@GB=A zV;3NYZ~=1kwj*vrVhJapAau3@yPS8W9jn_iEK65V9Ii-Eil3*@l6{@#&5g3@gGWH) zvGsraok@OWvW>rH<9@e+Ui4|@EvLt9V&J3=AG>5}X1L;M46byM!tB!d3WH@`sbqs_ zXs_LlA>Vr*|Ft{FKY{$joojuZ^xQ_IB)ihjuKW|NPU4xgQk_RIXOhs@%2_%{`9Ee*g5Ax#`$fMyzHkvR_ zCtn!}Gl)t2#s)00J($CH9*_L6p@27dVb`|ZxA8w z?i6?1Je?aSz$RlZ#UYm0>yNm2&4?3F{T3}TLsmzC1?>0Ci;bCM#eSXwUpfDhW z`9U&fnEO}-;t>n3wsJJN5}7L4t5ay=6~_R;v5f)nTQ3~wUpY`N_1iWdRYU5n^w5&T zsjlX22~?~;fv$UJQdAB_p`fO1iPT|wQqvRMLv4LczuD}@j&Ki(`4td$AG(bDwMQu? z(wI(}Y)2xu z{9u}#!K@cRikSzoOMOUu>d+2;qjS+Z+{4&BF~|>1IqZ&4h|OqcR{*#T#}zAV z%FLB`V-U|vdFJqIpVwlNU4Wzi=*eZoJh=o|&wl`Z2LY*zf*OZLHh_*lchcgfKd8w) zsGyV4^2?_*b~lJZDrkFK@jA3rQ~SWYV=0xVbtI4%-GCGD3D6Ghu)f$9r_WVJzLn1# z55fSVA5%t#iIwQny!Np~{owfBS!*AYW#o(_R(h8eN1{r$7UKaEk^!~e;TeHNaT|LD z0|~2u9Y6*R!?wP+8;unkAh+`m43Yrf;Kop;$k%ifKviCvA?D5n9=v)1XU0v@iT+YM?XwHP{zebVo z!55LgX-;oEBsPKoU}aE(nR2N2IrzsFvk1kQ<_LEk%EvPYk>B>wAmPQZJiJYYNp_jI zdmdfBMVECqhmIrBQS6zD(kzQSLmR$=storHNH%!{183lEt#*e}-)%<;b-h{#aO+q| zk3Iu}!smJ<$yV zRQwjY)sc@*k1U+_@(4-`IUL@_@@Z|MolQWwC{?X+=r$F%$jvp&T&jLTOO^ibg>#5b z#PBi{49;uR`XptLPlSwM0Zjxa6dp=hx4{m9rzYd7l zNkfqXj+!O((7fovbF$nZh-DT;@hbdQh{QlpZudnta?KkxOir zOwdY#Mdm#5vseEe!0PH?g;qo}!}w^RWF1V}ze2Ww1e%=|G5jY4FhjP&?8=;i3+*ie zY!bAEjutz2oh=TycoYhRH>%Ps zC*Yb>KxXl98{U9+$SC@Kz$Z|VsAx=QPH50u-=y6j)M$+VUqcJ5KnHYGd=aJdltX*q zRp8}5R*7TOJw;78mq|hG0qQYCtS-!wZ_ys0E<@;igrLfs^$aH6Zpy_RP*^|#`2e+f z3?Ow3V9R6zFm_XU?9|hv85z8kvDM62jFP?D0|ybhf~GQF!T^Bwz?<-MMO|KppS{GR zjv$Iczu|?oBE)_HFOJgM1JwUTT{K!#3Lhh!2;Ig^thT!;iPZtHsw%Q&bZobpV>>}h z0`{pu0@AlK0xDcHjMoen*~g-(W+mR9 ztEH(RV4FtaYrW%kCH#Y``mM-Ff6yY{1KLjM4hc4Y*_- zIJYg>fV0^=ie7hjY#09YLn@%1{X24yXmvB}()bc!%pp;q(tbCdxIw@3_j}KogZlw3 z!(a*u?DGs9n-DGUtFp<6X3brL~7yd)|U>6P@Ll*HGC(y}Y6ChL&!`p!ncO& z$Qu1GFB=B&9^sgng49<}9zM#OpMXvW)TywHgOK zu+RlqaF8(r7ofy&EoFhF>|tr2YSCXdkH*T-KZ{{He|S!bjqAxhD?V@+Txv=IWZ`H^ z?@G!^Qb!UIjC+Xx=d^>8u^UJsKqukUR(U1{flkFv{561+S{EHK;r8Jn_qB-c)Y{3l z9n}}XzX~yACJ&gSy+@B7{px5}>LIy*@RZgED7-y^6xZMvwxf0F9>8sM)QKLzZb)95 zhlDB1ax>h=;B&y|9Q-3L#r{#y-q7CDKBjtBA8-jZ;y113FqYy*2J%+zfb!YaC`*!l z5FNeapM5-mS z*i|YID4&T^wsydMEc%sIa;TFdi|sc+vDIyp5}PJ3D3#BwT+ya=4IWe4TzRlHxmkM; zmi$PwEVw~F6V)jXO0wT558cwc9Ni6d#3ot}!Vr_O5=f~v?hIDHFU~UhG|wy*7A=Lt{+2j5PLAIi_3jdx88{R zoNcw%s=TOl5k3b#_~nJ{3>n#itLlQ{AcN#z%dn5{Clq(kkG|a4xJrA^d}TJW&Y>mh zS89jyLaO(_40ngX$Sr2llD_XchHZXvY(o|gMMPBV_>aG zUJowJ-3s;;<_jNUd<%WuauV!~mxJmH@qiX~gv-a*-G*W)W|o$=3EheJX0^1<@Yr~;u~C3MBzYOrjg4z7jOE=`xExgN&~RCRgje`066}>@z^aX> zor@Ms{o^=c$vC1eT8lp;(1gAjBZ8Ueg|Sg@nKc%qCv*61e%!LB`wOHBc^WR=Ul<1a z1cPt!{sthYjpUt;EVAReTAf_M3MV3_3*jnH*ZR`Ef&=_O*LwVs23wn_txkj}bC_+x zv4X^_@+5Hkh@Hn{gRxlYs;FW0M`rIecb^tsIoOjTu8{diO~ic>D0o{qGCl|2FHQAw z0Dr6|hrQoLrIT8ft73V64vc*=p*9Qe!NW)k5@On7_Y$36y$f?{GHC~BGJz?lb3Z+D zA0L8bY9%bo$^h8LhDhknmp_69(Q(UAycky+>qzB9?%1&qbEyJ^MJkX=6v_UGeU|QG zDMk6{YtS5%>x11-(d6j|4VtF~7l>agx*Or(`$z)MOlQ0^ga%hjfvXH2q=XhK#Q2E9 zJ9&8aX!sExE{KO)yzpVga0NG;B_dDDT*U35A6(%y2ip^s78RxutTZ1G#vJnEbu?Ty z0ar5%mJTxs8EJB)?09)CNtGe1hfN!z5(n_-VC3Y6GM6Ca2)cU*;o|Wz=`s|A^otDK zOF2P#cMw*T0&<`fhasQfiN+k>9*Tp^8vpkgayL(;Q64>+t?Q+e86N_E;s#Td1nC`? zj!c&J`}mIi+uvbHY3CxzG8e2jutw6e8h_G0tWmBLU=n`7dXwCbR(+XwRNP~!QSB)> zY}TM|+f6cVjG(v!$iV)9a^g3-{)1NvTPZwCmJz6gd9VwnP_Dw|PWil;kdUl6Ok^gq z5M|};LoP=~{}Xa>JgoW==n3LjS@rj^7o7!fq5U=Qq=`&=44F%TjDC@JGViajwNHfF zf~+H8o052wWV=z;$wHayJaDiG-v?sE5{81Hg>csTYt-T!MppE$MRbj7WhZ|-+LB(r z`_mo{0rHceAbTeskiX`7s}gKn=>w{b^JGXtyu`C?1^v7MMdWMIs* zD|jFdjg6Esb_)g`3nQ*V7ZF>uQG~I(7V5;DftF(ht_4>+qV*03$xYB?Zm8{N$LN?$ zCQ0Wt`y92_Cj1?k>eKDMGq|9i;y%<=J=E?yEi6DuxTLf$13Xm3H|#Gb^(o2$;j=!h zZ_2?O^nk0t*H7xCK2x2fXNY@z!x#IUA^KxBP_6VS(E5POi?PYXI57ZAw%8vV%E77vbgxm0=R^qxEnJ-ua7%e*1sYOS<5PQx+!BRp=&hY6Jxax(HckA z0r9^J;|;JMn$<(DIMTi0aDb84vx*hJIMybb#LSI|vA>P<`F{ZjH1`>sa!&kVGakmT zZ}9HoGz?8MaLHhONQ}|Z&*4q&(2Mb|f+7_JSk3de`2@R@*|<3nU`u}i$uC=*PJ;{b zzAphKK*&{+4N^(RaQ)UqK-Bu$gqxX3~Rl=_V?cD{eLNXe&B4lWiEQ zc``x3;x3KeV}nwbionJ|xU~h?QPj*&Z2?9+{rGK&OF-X8u>m&i2_(gK@#PLIMB^5n zR1{=R(ii`eCaLb`!z$aGtomnIU;3IIP0mDbBcGh7FccGDbjCgaYQaLC~2uxM>INhr^(i7Sa#5#kIsRQ^Ea=B=Bo?q_vq!81tdh7XQa!u+o;$ zZ)Pd|PA#V2IbQlLnv36>ZJ9ytq^;u4)B^4#%;wIFeC}K^3(gY{CEN-}^9e1>xNC1& z0T=Jqx2&Zwf8w+w;VEom^w{VQN^Dt%5bj0dHyICtb|fs}se-_H0rNf79b_3{zJ+SO zJlgUYfS@b;9az39^a{7q4L0%S7o&+v5djF8K^FEP!33%7a~>Fttth5;Z8=@C40eXl zeVB{ar3pecj+S^=^Y8V6*I>oT&`O8hoh%2E0_X!>nt$fanm_kumVr@F4m$o$9Y{(} zoV1qvq4+w2N@DMSn%vGoe*|lo`LZXVW|D4`w3>!=9sZKyEJI54;1Bd|xB^;D&G~y3 zs~)K}H~$`b&GSvYX7TSGY%!|V$g>6>eGeVsV^4&}6r1kWwHn$5dE9+=!U0=dxl_B@ zSy=9n6S%6gt)l!7>p(VoYRp3`ta_tEU1(SDaxO3Tuc)f7S_uuNaU?c{xUA+pJOS8H z@FxgRN%-S`7`;6<2gWgU%d^buH}7qkjzhop#^Qo3TygXq#-Zjx7tqLOB6y1e4gbN=5-iS)>5U445 z?iCi3kbPJ87gqO6FW~9Pe)Hj3x^|1&h_UQO-7r4>85qh6699AGX?#d#H*Kb=)XP+5 zxXcB!PhSp2zJNT1z9I3U78CL8@frCm3tBxc9c;ON9P-x^@}B6%Ni3Z(ANHJ;f*nbO zxzgd#FYvR?KmRWBcwo%xh7dxU4{IP)(Z}&O(ZgDNQAI^zb&hPWsL&H3J2qsP)(lmm zV{=Vm2U<|cvWT5WJ|@BgAxTx__8yuQWy9{bSni)kc}Z?4!I!#pYzBrr6RKM(DOPUQ zsI0@!{+k4N2Xnt~bt^9)qZLjloC>nXQ$h9^732^V&|f|zE@qSpvWW^n0?={mTer+@ zF#6~%o7v;X{!K6*-yQoRqSexXMAVvBAq$^QdAL;BF~f%H1Wbgu8w=kGsp*wcK67 zuH^12b_sWHWz)F3mQCVrkfn3?ZkEX1b!;R;EtJ>*cQ>)Gxx1Nt0hdtN9l}gvT@<^! zk-TqlZxeYBaPKzq?%`gNIkFeH_Yv~$;NHi``!C%41bH>?eTuvx?tPlPGWR}9-dgVE z68tsX+e)#^xc4A=7jthXdFOF2Cab{Q@N$$%2G3^j1X2yK3%Iw7ydw7=C$F7*yUBZc z8#S+oykB!KBk$+jdxE@O+{=aZZ*gxQ#U9|^e)8_&-XZe7z`eud-NC)Y__KfEUb5R1{w zm;z5iYb@qIGiI(Q;b1K04l~Bk*1(S1Nvs#%s)2+az~V{4T1ya8JuhU74?jhtV>%oN;_cv@9D@h2KnwC*&3c_hz7m-( zx$ZWLJR=1cW~0n?-2$sT8IcpNyUixMptZrDRZQu@K@#Vmw(V0|k9I4qmbSqIphW!f z%4REYK`~zf0c1Kpc)&{WPuFNjpz_~FY&(_zI?CS%0f^od$LN38KF#0_bK-CG@rIp@ zl%Rj9Wn+iI0Q0nAH0b_>e+R!YKLWAUK#0~{3tkc%vC7#4-eSA~hoN)$b7Cf|5@3}`{d=?Is&?2V(={(=C3^^?UPVVhQuPtZxPn7; zc6=7`F$2jdtddA0M__Z|ju}c4lIOg|lph1j90g;0e+B9H|KhKFJVnij8%)yQ_=F)7 znU2z#6Mx^c4aNLpTgU~d&$NXcqGHDSm%oQ7O~Ye?7tnt0_^Dwu)Hnyvl4J@8c03r5 z=MB;5_`t?ovL|)q;TEN6i%vO|8m;R6w-4w~%fw=n;<1g0r7WO_%0LC=6RC%!GEg=| zZhIE|{+8W2ME94Z^fV_)mx7uu1|{I_r0c${OT6y$jaKUy*LA?x24DMi-56}VsdUtR z=(=tx`DHB3MxAx=V=cOp{*vOG#*A)^@BjJt|IZ#M{jDJU%YO;N)A)AdYsYsS-(T@r zUlfFNd>7!m2Hy?%R^h9|w*}uL_@2hM8{fP5`taFz3PJ|HTzm!imf*Vu-#UDo@jZy| z*Z6kgYsL2=K8DW)Jf`8x$F~CCt@t+Mdl=sf_}cNki?18s*Z79;{a@`}3wRXO**>`- zsp4=!E!xm>nc3`R?z2_55QHk$ z3tp(=Z){OPK~N$h#TpA!O<^v^u_9bVZxrYhgQEm^X<||M zHXwq}B>F%+R)UN1;Kye4C}5=38(cRTWgF3(I6{7WQjI27i{7>(B>);Rm^eNwlb|Xfs#7`6# zQ8a4=krRe4Z0HU3(&V}csc|DtC1-*+llKJLrQVYUdAP#b|*J?MoICutB*ltNZO^7I3}B^5S!Bo7a ztkn+R)y|Raim3F|H_^7_T>|^8Mx69QvNv-~36rddztLZdU1auy>*|NalO?w!^&pTT zZ#xsZ>XWwp#;7p+L!;|RG;D^=k={)dKMr3(_b^%I&zD>b(r3s>)&XP zMiPzDf2TcXS9?*|q^bK^pcMnnB;*%@)OwE`Yb(A#Lh}^a%)g%R`84|>{(94Cf|O~NqnbxNt@Owl0MA}3CyQ7k2WHOR-Rh)#*(c$Gm~U29hr2vH2w779*C-GgJc)9X4C3z zQnu)J>!<&8{pdvl)x(_K z%{pXV-LfFtq8;(zTksw|{PvsiED3%ie7f_n!Ow@kd8wD3Na^rTqICEtQ~FK#PjmRw z;Nx{$mIwcI_)Bl}vhTt#gg+Gi?q7M?_b44cekO+PSmFhzpa*{#{FcSIr-NS&zZJd! z|6=$<;nQhb0epJb@zC{N+<(y6p!Jc)OufdUHfMzr_G4T&%#>u=WWna$RRuz| zs7cbMRv7wd-d~Nz8ZsJj1#%4D4^`WbGioz-2Ew_i@QrEVYY`@Wko#p?_`0<4qO|b!Y2n3b;TzJz^iwky&4<#$ zblO5X2R-8{{JE?QlADOn3fvRgA(v8wDv*o&^H97zrt9Qa>523Fp`;N$CoNnY3PtLu z>^NK!WY>gGx)UT9NL?c#iOSSPGhTpEN^9z3M$Q-`eTGIdfFsoZj5x5szN^9*QS>$hNaN>qxFj11cd3n&kEE0NUqqh54w*d9?6dC zFzY}r$S2Dp3$$!&0>ZTOuu@EZEgl)}%xTWXd-(=GM4Nc9+BW@gsvY9QY};zrYLm)Q zJ4A<8Ct4|K-ZXhHM=Y2YuLieNBA%93gZ2ZUK=-v)&1#fNk5@vjbhmBMtwMg!IJHeY zQG2vsp>`NEX;Yl&5${BYc%}OEcTQ4MlSDft*aqB4TP2*00|_&d}3r)S9nrgB0|YkdNg4r7AG5$aWFO^88T>0NQMnX7Dr=2Lx=uYouNOy zHkS0q%rgG45kxx-^cm<9O$J&-2MDuDe=7qG_%T+l*Rl!zFst$>lCc0X;L2k`BUIg( zjKx!FHF_Ydry|u!GgKJ~8@W}EwErxAtV`F1p-oTb< zv^g5>v0udiPVH4|g5f}u=DEwb_PCae#kkh|A^o;MFX&d(a9}GY1>>n16_|cC?jv76NKe^z-i+(zNhQGEhpw~Av27fj))D(_He;$h` zlCzpyS}(q2_MA&EVb|nG`gd9Nd-wj!rhL%|pq2`7SuIkmJDiWNBYhc{S-yY0?Jkwiy2ECOzLCjT+uV7V zUorp6s}@{+%`X;S`^)PVUBCE-CBM4yrlmLE^6O={-gf))6)W#pwffFAYkzas-Rti8 z?Y;Ni|G@eOAA0za4ZnNzv5k-a?-T7${{9b}o_hM3&0C&*ZtJ$^x9@o2#ho25?Rt6l zD|`O9_tihW*7^FM_w9e<&A0H#@-GM8eeeAbKK$t5p^rcL>*2rs{U4wH^Rv&{S6v|b zUI6;FKz!T%|F+xz%JToB1-kEiV}bs*`#K%{O3>YnZF~We%X+o`CHTSUp>>yJ_N{F^fT*E8qqU9y*}0Z z%9FFMbanB}be_B1}Iu5eDz{LFq1_VvuqQ?O@#X8S=r zA0yXS{dc21^V8eEH-Wz}1jt$SGxfD>R?qxQ{)V*t>-?K9?U|n`pR=y@vKhYx11Wb6 z!udGp@ZDpj;5p-Zgz4bo2=3_fRO~|`pCdg_ZO*RJ!-3T9tQi00%*wIvGdFF;Y-&~6 zlp_1+KnPppDXb(EiRET3mBMJn@V>Hes3z{H+2!scPpd#o&+ z&|@XBU?N!O4^?3=N}E$A=2YnZS$ePZD~;A7O-*3BA{f?-*-nERj;zx5u#BBGpavuj zR@sRIYJvg1q|qO%j#MT?iQw4QgwAd;DTU*akY3`$^Y65HWh8*Jgq@H`qamC?SxX&` z9>5v;4t5z^or@Ox&dwPhFV$<44GntC7t`Yq4SNSYtpi*JesXW#VYU7&vcZi0TQ5;53wyoT)|-j0;Pp31Eb#ZzaX&rlcz z&2!St6a#B!>}iS_rv5(U0bS$Nbfz8{AFhk()D&ZJ>Ia>$q(;YI(#ydtta58|CMWe+ zt51&^$1~wN-H;!w=LYIkb+B$`O7c(kwiFD*RztF_aU7ae2b=WbxFK_dSUqt-G0Pm; zaC5|zM2rzp!)mh1L&$*G9=F>Y&PIFN${y=d6-6x|f+b!qcU4GS8)8(JYNLFrLB z6(yK=Oidx)VUB#*8vgXMY|6y43TtLN!jkc=CQ;}8P<)0zMgKVt3lnE?0zDvs>%>>0 zE#KUs8BuzXrI({;J6XL_yAvp%aMT@@z?YSPWmn{%3Rt#8dmRer0`zPU$J2P4X}oV` zJZHk2RK|0ryp&JRo(2K*B#!dv*_f3_bg3@+Cjdm3%$(9r1WrnU(uV<*?gS`aoQjvE z;+SlVI#W{VRVg2nghBs&_|!H%7a%%KfDMQO^b8XVy1_sFG86IB1`yA4Q~o^o)R)Tv z%D)02I=E#u-aNZ46<-0L_*(@~dusqH_Xt3JdLE$smjTKj455&G2qYKFHD2#!(}4eU z_eE!1*%>Y;W=HuMVtbWI{QY9_ls%XV6zpwPZ^1p0(i;m@6^}kJ@eIJ^AQyhN%?eu8^sXLuMO~Cf`^Y#t4 z@E>jp^y7+I*|~YEaAPoIUhBMJDbd~eni*KJ+Vtn%-bt_eFz=;phQAi&pS)ww9X2z& z*XP{N%p`Bhf2g13i&NzvM)~b4_pdyiy|MD`l^66)|I!skjmfx?nY`zxdu(j_o}cZp z_b$J4_n$id#u$I8$r+uSm7vtnVHz-%A^ga9fZ04@ZofpLHrZ~%qCaKHu>01P;E8{YlO z?cOgOKzu*27w7=C0-J!1z&c z9l%E5K429<<(I-=2+Rf=foVV~zyXDT4HyLMUxxYsxvy)jq@UnScV9J5d}i{x;Q8)0 z7OjK~)<6bpy^MZPl76m{K;uZfrhg!Qm#pfhNpb5Om%`+1`1dw5WPXl@M`!~tp+9~x zE=##9P(F(CeS!K$eOe5DvO%BvPVHpM07?Jd4y)RJNZ`AijXRrrmpjN6@Gd^eZ{>IL z=NHvGLXJxvm9Bwqms@e4>wd!BC_F2?AvB9~#GAxB#r5J7;&ySD_=fnQ_?h^9$svuE zY9zmOmGr2zMS4;CL^@0UiM&u=CEqQtmp8~8<#zf1e3X=tCecww58hP z+Oyir+CJ@l?PG1A=LFB`9>1sF6ZPEXx!3csXQKz5vzhy=5j@A=%pc}|ZGX&ucTq>t zD95jzNmrSBmV2RloBM$KYT+?qpK!dyNwV})=^k*OC%-L!B!4ce;B&H4qbyPGQ+6tE zD#KJwU95(*gtkyyqkX1{o?_2=Xcuj9^bR6pRR@WNWHdlx1J=e!BoBQ|fm)vi;M+@bGPnaphg;wDz^n0`Ls_;MJkHuzjwYXJ$ zMSM*Z6pu1pnXmjpc}V%YlBJ%iUZggl*LSI#p@E^=XzfDnGHt%LR(nj_sU6hHJz>u^ zo;y7|J@iE;FAX&AI8Nlw;TpIoH=A3}ZR9p{S^Tm5sr(q;$Dhx)@z?T;`Q`j}eiz@# zf5d;sewzIZyVrh>eTF?@zu11c{YLwv_P^UF7KMvuJLWo`bG+af?kaN4bR}I6yPkAC z=i2Lf%e6+>AhZil3(pBJ2&z~jP8Y8dcY^=-#DijiG(?i5VyRN9lBP?#6qXXw9O-K5 zI_W0qR_Qm=z0yYMX=$spOFAqaFBi#ixmCVH{*8RE{1kMPqs)O--lhCmc}FQyMRk%| ztzM|sszEiP&QfQqSE#>G7pY6t73w|e1L`B{E*%#;bvilutvCFctm(ocm~?ugPG_Z z;h^wOArE@L2)5fQx5-z^JC#?Iead9DMyp|NGs zDruecAS`whEVe`1EA5vKNQb0PrCfQCTp$mXhs&tE9N)Qww}4;BcZj>i!IB_NgVnc4 zOQj8{*(ovECVS->kkmqXt^A<8L;gS>q~t3cX5lC-VG-uI9m)qvzRKDeqhEskTsQyx?{U`A|LHYuB7l{;XUyJ4A~%6{c-IwtPWLe>Tp=@NR?9^SV5MmYt;>yt9D}~=4pepe62tmjIn6LXe`u5 zVmvxDp=%xSX$vryFVdD^MOmgT*H&R(Tc>T%HfrtKCT+8}RokI;XuGw&S|@4hs5>fw SqY^kOfuj;QDuMrK3H(1XaR1u? diff --git a/reverse_engineering/node_modules/tunnel-ssh/.eslintignore b/reverse_engineering/node_modules/tunnel-ssh/.eslintignore deleted file mode 100644 index 1616ee78..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/.eslintignore +++ /dev/null @@ -1,4 +0,0 @@ -node_modules/** -.idea/** -build/** -examples diff --git a/reverse_engineering/node_modules/tunnel-ssh/.travis.yml b/reverse_engineering/node_modules/tunnel-ssh/.travis.yml deleted file mode 100644 index fbbe7375..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/.travis.yml +++ /dev/null @@ -1,4 +0,0 @@ -language: node_js - -node_js: - - node diff --git a/reverse_engineering/node_modules/tunnel-ssh/LICENSE b/reverse_engineering/node_modules/tunnel-ssh/LICENSE deleted file mode 100644 index f731172f..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2018 Christoph Hagenbrock (agebrock.com) - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/reverse_engineering/node_modules/tunnel-ssh/README.md b/reverse_engineering/node_modules/tunnel-ssh/README.md deleted file mode 100644 index 1ad850dd..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/README.md +++ /dev/null @@ -1,139 +0,0 @@ -Tunnel-SSH -========== - -One to connect them all ! - -![Tunnel-SSH Logo](http://i.imgur.com/I5PRnDD.jpg) - -Tunnel-ssh is based on the fantastic [ssh2](https://github.com/mscdex/ssh2) library by Brian White. -Trouble ? Please study the ssh2 configuration. - -### Latest Relese 4.1.3 - -## Release notes -* Closing sshconnections correctly thx @actionshrimp -* Improved readme -* Updated modules - -Special thanks to -@vweevers and @dickeyxxx - - -### Related projects -* [If you don't want to wrap a tunnel around your code: inject-tunnel-ssh](https://github.com/agebrock/inject-tunnel-ssh) -* [If you need it the other way around: reverse-tunnel-ssh](https://github.com/agebrock/reverse-tunnel-ssh) - -### Integration -By default tunnel-ssh will close the tunnel after a client disconnects, so your cli tools should work in the same way, they do if you connect directly. -If you need the tunnel to stay open, use the "keepAlive:true" option within -the configuration. - - -```js - - var config = { - ... - keepAlive:true - }; - - var tnl = tunnel(config, function(error, tnl){ - yourClient.connect(); - yourClient.disconnect(); - setTimeout(function(){ - // you only need to close the tunnel by yourself if you set the - // keepAlive:true option in the configuration ! - tnl.close(); - },2000); - }); - - // you can also close the tunnel from here... - setTimeout(function(){ - tnl.close(); - },2000); - -``` - - -## Understanding the configuration - -1. A local server listening for connections to forward via ssh -Description: This is where you bind your interface. -Properties: -** localHost (default is '127.0.0.1') -** localPort (default is dstPort) - - -2. The ssh configuration -Description: The host you want to use as ssh-tunnel server. -Properties: -** host -** port (22) -** username -** ... - - -3. The destination host configuration (based on the ssh host) -Imagine you just connected to The host you want to connect to. (via host:port) -now that server connects requires a target to tunnel to. -Properties: -** dstHost (localhost) -** dstPort - - -### Config example - -```js - - var config = { - username:'root', - password:'secret', - host:sshServer, - port:22, - dstHost:destinationServer, - dstPort:27017, - localHost:'127.0.0.1', - localPort: 27000 - }; - - var tunnel = require('tunnel-ssh'); - tunnel(config, function (error, server) { - //.... - }); -``` -#### Sugar configuration - -tunnel-ssh assumes that you want to map the same port on a remote machine to your localhost using the ssh-server on the remote machine. - - -```js - - var config = { - username:'root', - dstHost:'remotehost.with.sshserver.com', - dstPort:27017, - privateKey:require(fs).readFileSync('/path/to/key'), - passphrase:'secret' - }; - -``` - -#### More configuration options -tunnel-ssh pipes the configuration direct into the ssh2 library so every config option provided by ssh2 still works. -[ssh2 configuration](https://github.com/mscdex/ssh2#client-methods) - - -#### catching errors: -```js - var tunnel = require('tunnel-ssh'); - //map port from remote 3306 to localhost 3306 - var server = tunnel({host: '172.16.0.8', dstPort: 3306}, function (error, server) { - if(error){ - //catch configuration and startup errors here. - } - }); - - // Use a listener to handle errors outside the callback - server.on('error', function(err){ - console.error('Something bad happened:', err); - }); -``` diff --git a/reverse_engineering/node_modules/tunnel-ssh/examples/default.js b/reverse_engineering/node_modules/tunnel-ssh/examples/default.js deleted file mode 100644 index c54e4e32..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/examples/default.js +++ /dev/null @@ -1,26 +0,0 @@ -var tunnel = require('../'); -var helper = require('./server'); - - -/** -make sure you can connect to your own machine with the current user without password. -Example: ssh $USER@127.0.0.1 - -Remember to add your privateKey to your ssh-agent (ssh-add) -**/ - -var config = { - host: '127.0.0.1', username: process.env.USER, dstPort: 8000, localPort: 7000 -}; - -var fakeServer = helper.createServer(config.dstPort, '127.0.0.1', function () { - tunnel(config, function () { - console.log('Tunnel open'); - helper.createClient(7000, '127.0.0.1', console.log); - helper.createClient(7000, '127.0.0.1', console.log); - }).on('error', function (e) { - console.log('error', e); - }); -}); - -fakeServer.unref(); diff --git a/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive.js b/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive.js deleted file mode 100644 index dbc4fe7b..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive.js +++ /dev/null @@ -1,35 +0,0 @@ -var tunnel = require('../'); -var helper = require('./server'); - -// Keep alive example -// this example demonstrates the keepAlive option. -// keepAlive will reuse the connections -// note the "tunnelKeepAlive.close();" at the end. -// this step is required to finish execution nicely - -var configA = { - host: '127.0.0.1', username: process.env.USER, dstPort: 8000, localPort: 7000, // Use keepAlive:true to keep the tunnel open. - keepAlive: true -}; - -var fakeServer = helper.createServer(configA.dstPort, '127.0.0.1', function () { - var tunnelKeepAlive = tunnel(configA, function () { - console.log('Tunnel open'); - helper.createClient(7000, '127.0.0.1', console.log); - helper.createClient(7000, '127.0.0.1', console.log); - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - setTimeout(function () { - // Call tunnel.close() to shutdown the server. - console.log('TRYING TO CLOSE'); - tunnelKeepAlive.close(); - }, 2000); - }); - }); - }); - }).on('error', function (e) { - console.log('error', e); - }); -}); -fakeServer.unref(); diff --git a/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive_error.js b/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive_error.js deleted file mode 100644 index 329551e3..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/examples/keepAlive_error.js +++ /dev/null @@ -1,35 +0,0 @@ -var tunnel = require('../'); -var helper = require('./server'); - -// Keep alive example -// this example demonstrates the keepAlive option. -// keepAlive will reuse the connections -// note the "tunnelKeepAlive.close();" at the end. -// this step is required to finish execution nicely - -var configA = { - host: '127.0.0.1', - username: process.env.USER, - dstPort: 8000, - localPort: 7000, // Use keepAlive:true to keep the tunnel open. - keepAlive: true -}; -var tunnelKeepAlive = tunnel(configA, function () { - console.log('Tunnel open'); - helper.createClient(7000, '127.0.0.1', console.log); - helper.createClient(7000, '127.0.0.1', console.log); - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function () { - setTimeout(function () { - // Call tunnel.close() to shutdown the server. - console.log('TRYING TO CLOSE'); - tunnelKeepAlive.close(); - }, 2000); - }); - }); - }); -}).on('error', function (e) { - console.log('error', e); -}); - diff --git a/reverse_engineering/node_modules/tunnel-ssh/examples/server/index.js b/reverse_engineering/node_modules/tunnel-ssh/examples/server/index.js deleted file mode 100644 index 6b444576..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/examples/server/index.js +++ /dev/null @@ -1,36 +0,0 @@ -var net = require('net'); -var debug = require('debug')('tunnel-ssh:test-server-client'); - -function createServer(port, addr, callback) { - var handleConnection = function (socket) { - socket.on('data', function (data) { - debug('server::data', data); - }); - debug('server::write'); - socket.write('Echo server\r\n'); - }; - - return net.createServer(handleConnection).listen(port, addr, callback); -} - -function createClient(port, addr, callback) { - var client = new net.Socket(); - - client.on('error', function (e) { - console.log('errortest', e); - }); - - client.connect(port, addr, function () { - debug('client::write'); - client.write('alive !'); - setTimeout(function () { - client.end(); - debug('client::end'); - callback(null, true); - }, 300); - }); - return client; -} - -exports.createServer = createServer; -exports.createClient = createClient; diff --git a/reverse_engineering/node_modules/tunnel-ssh/index.js b/reverse_engineering/node_modules/tunnel-ssh/index.js deleted file mode 100644 index 5f260805..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/index.js +++ /dev/null @@ -1,112 +0,0 @@ -var net = require('net'); -var debug = require('debug')('tunnel-ssh'); -var Connection = require('ssh2').Client; -var createConfig = require('./lib/config'); -var events = require('events'); -var noop = function () { -}; - -function bindSSHConnection(config, netConnection) { - var sshConnection = new Connection(); - netConnection.on('close', sshConnection.end.bind(sshConnection)); - - sshConnection.on('ready', function () { - debug('sshConnection:ready'); - netConnection.emit('sshConnection', sshConnection, netConnection); - sshConnection.forwardOut(config.srcHost, config.srcPort, config.dstHost, config.dstPort, function (err, sshStream) { - if (err) { - // Bubble up the error => netConnection => server - netConnection.emit('error', err); - debug('Destination port:', err); - return; - } - - debug('sshStream:create'); - netConnection.emit('sshStream', sshStream); - netConnection.pipe(sshStream).pipe(netConnection); - }); - }); - return sshConnection; -} - -function omit(obj, keys) { - return keys.reduce(function (copyObj, key) { - delete copyObj[key]; - return copyObj; - }, Object.assign({}, obj)); -} - -function createServer(config) { - var server; - var connections = []; - var connectionCount = 0; - - server = net.createServer(function (netConnection) { - var sshConnection; - connectionCount++; - netConnection.on('error', server.emit.bind(server, 'error')); - netConnection.on('close', function () { - connectionCount--; - if (connectionCount === 0) { - if (!config.keepAlive) { - setTimeout(function () { - if (connectionCount === 0) { - server.close(); - } - }, 2); - } - } - }); - - server.emit('netConnection', netConnection, server); - sshConnection = bindSSHConnection(config, netConnection); - sshConnection.on('error', server.emit.bind(server, 'error')); - - netConnection.on('sshStream', function (sshStream) { - sshStream.on('error', function () { - server.close(); - }); - }); - - connections.push(sshConnection, netConnection); - try { - sshConnection.connect(omit(config, ['localPort', 'localHost'])); - } catch (error) { - server.emit('error', error); - } - }); - - server.on('close', function () { - connections.forEach(function (connection) { - connection.end(); - }); - }); - - return server; -} - -function tunnel(configArgs, callback) { - var server; - var config; - - if (!callback) { - callback = noop; - } - try { - config = createConfig(configArgs); - server = createServer(config); - - server.listen(config.localPort, config.localHost, function (error) { - callback(error, server); - }); - } catch (e) { - server = new events.EventEmitter(); - setImmediate(function () { - callback(e); - server.emit('error', e); - }); - } - return server; -} - -module.exports = tunnel; diff --git a/reverse_engineering/node_modules/tunnel-ssh/lib/config.js b/reverse_engineering/node_modules/tunnel-ssh/lib/config.js deleted file mode 100644 index 99b19966..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/lib/config.js +++ /dev/null @@ -1,53 +0,0 @@ -var util = require('util'); -var defaults = require('lodash.defaults'); -var debug = require('debug')('tunnel-ssh-config'); - -var ConfigError = function (message, extra) { - Error.captureStackTrace(this, this.constructor); - this.name = this.constructor.name; - this.message = message; - this.extra = extra; -}; - -util.inherits(ConfigError, Error); - -function createConfig(config) { - var env = process.env; - - defaults(config || {}, { - username: env.TUNNELSSH_USER || env.USER || env.USERNAME || 'root', - port: 22, - host: null, - srcPort: 0, - srcHost: '127.0.0.1', - dstPort: null, - dstHost: '127.0.0.1', - localHost: '127.0.0.1', - localPort: config.dstPort, - agent: process.env.SSH_AUTH_SOCK - }); - - if (!config.host) { - throw new ConfigError('host not set'); - } - - if (!config.dstPort) { - throw new ConfigError('dstPort not set'); - } - debug('ssh-config', (function () { - var hiddenValues = ['password', 'privateKey']; - - return Object.keys(config).reduce(function (obj, key) { - if (hiddenValues.indexOf(key) === -1) { - obj[key] = config[key]; - } else { - obj[key] = '***HIDDEN***'; - } - return obj; - }, {}); - })()); - - return config; -} - -module.exports = createConfig; diff --git a/reverse_engineering/node_modules/tunnel-ssh/package.json b/reverse_engineering/node_modules/tunnel-ssh/package.json deleted file mode 100644 index 11a41347..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/package.json +++ /dev/null @@ -1,48 +0,0 @@ -{ - "name": "tunnel-ssh", - "version": "4.1.5", - "description": "Easy extendable SSH tunnel", - "main": "index.js", - "scripts": { - "test": "mocha && eslint ." - }, - "repository": { - "type": "git", - "url": "https://github.com/agebrock/tunnel-ssh" - }, - "keywords": [ - "tunnel", - "ssh", - "mysql", - "develop", - "net" - ], - "author": { - "name": "Christoph Hagenbrock", - "email": "christoph.hagenbrock@googlemail.com" - }, - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "lodash.defaults": "^4.1.0", - "ssh2": "1.4.0" - }, - "devDependencies": { - "chai": "3.5.0", - "eslint": "^3.2.2", - "eslint-config-xo": "^0.17.0", - "mocha": "^3.5.3" - }, - "eslintConfig": { - "extends": "xo", - "env": { - "mocha": true - }, - "rules": { - "indent": [ - "error", - 4 - ] - } - } -} diff --git a/reverse_engineering/node_modules/tunnel-ssh/test/config-spec.js b/reverse_engineering/node_modules/tunnel-ssh/test/config-spec.js deleted file mode 100644 index 24229daf..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/test/config-spec.js +++ /dev/null @@ -1,56 +0,0 @@ -var chai = require('chai'); -var expect = chai.expect; -var createConfig = require('../lib/config'); - -describe('config', function () { - it('use dstPort as localPort', function () { - var config = { - host: 'test.host', dstPort: 8000 - }; - expect(createConfig(config).localPort).to.be.equal(8000); - }); - - it('should emit an error', function () { - var config = { - host: 'remoteHost' - }; - expect(createConfig.bind(null, config)).to.throw('dstPort not set'); - }); - - it('throws an error if host is missing', function () { - var config = { - dstPort: 8000 - }; - expect(createConfig.bind(null, config)).to.throw('host not set'); - }); -}); - -/* - // Keep alive - var configA = { - host: '127.0.0.1', - username: process.env.USER, - dstPort: 8000, - localPort: 7000, - // Use keepAlive:true to keep the tunnel open. - keepAlive: true - }; - var tunnelKeepAlive = tunnel(configA, function() { - console.log('Tunnel open'); - helper.createClient(7000, '127.0.0.1', console.log).on('close', function() { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function() { - helper.createClient(7000, '127.0.0.1', console.log).on('close', function() { - setTimeout(function() { - // Call tunnel.close() to shutdown the server. - console.log('TRYING TO CLOSE'); - tunnelKeepAlive.close(); - }, 2000); - }); - }); - }); - }).on('error', function(e) { - console.log('error', e); - }); - }); - - */ diff --git a/reverse_engineering/node_modules/tunnel-ssh/test/main-spec.js b/reverse_engineering/node_modules/tunnel-ssh/test/main-spec.js deleted file mode 100644 index c95d2fa8..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/test/main-spec.js +++ /dev/null @@ -1,37 +0,0 @@ -var tunnel = require('../'); -var helper = require('./server'); -var chai = require('chai'); -var expect = chai.expect; - -describe('tunnel-ssh', function () { - it('should emit an error', function (done) { - var config = { - host: '127.0.0.1', username: process.env.USER, dstPort: 8000, localPort: 7000 - }; - - tunnel(config, function () { - helper.createClient(7000, '127.0.0.1', done); - }).on('error', function (e) { - expect(e).to.be.instanceOf(Error); - done(null); - }); - }); - - it('brokenConfig, should callback an error', function (done) { - var brokenConfig = {}; - - tunnel(brokenConfig, function (e) { - expect(e).to.be.instanceOf(Error); - done(); - }); - }); - - it('brokenConfig, should emit an error', function (done) { - var brokenConfig = {}; - - tunnel(brokenConfig).on('error', function (e) { - expect(e).to.be.instanceOf(Error); - done(null); - }); - }); -}); diff --git a/reverse_engineering/node_modules/tunnel-ssh/test/server/index.js b/reverse_engineering/node_modules/tunnel-ssh/test/server/index.js deleted file mode 100644 index 29882888..00000000 --- a/reverse_engineering/node_modules/tunnel-ssh/test/server/index.js +++ /dev/null @@ -1,36 +0,0 @@ -var net = require('net'); -var debug = require('debug')('tunnel-ssh:test-server-client'); - -function createServer(port, addr, callback) { - var handleConnection = function (socket) { - socket.on('data', function (data) { - debug('server::data', data); - }); - debug('server::write'); - socket.write('Echo server\r\n'); - }; - - return net.createServer(handleConnection).listen(port, addr, callback); -} - -function createClient(port, addr, callback) { - var client = new net.Socket(); - - client.on('error', function (e) { - debug('clientError', e); - }); - - client.connect(port, addr, function () { - debug('client::write'); - client.write('alive !'); - setTimeout(function () { - client.end(); - debug('client::end'); - callback(null, true); - }, 300); - }); - return client; -} - -exports.createServer = createServer; -exports.createClient = createClient; diff --git a/reverse_engineering/node_modules/tweetnacl/.npmignore b/reverse_engineering/node_modules/tweetnacl/.npmignore deleted file mode 100644 index 7d98dcbd..00000000 --- a/reverse_engineering/node_modules/tweetnacl/.npmignore +++ /dev/null @@ -1,4 +0,0 @@ -.eslintrc -.travis.yml -bower.json -test diff --git a/reverse_engineering/node_modules/tweetnacl/AUTHORS.md b/reverse_engineering/node_modules/tweetnacl/AUTHORS.md deleted file mode 100644 index 6d74d406..00000000 --- a/reverse_engineering/node_modules/tweetnacl/AUTHORS.md +++ /dev/null @@ -1,28 +0,0 @@ -List of TweetNaCl.js authors -============================ - - Alphabetical order by first name. - Format: Name (GitHub username or URL) - -* AndSDev (@AndSDev) -* Devi Mandiri (@devi) -* Dmitry Chestnykh (@dchest) - -List of authors of third-party public domain code from which TweetNaCl.js code was derived -========================================================================================== - -[TweetNaCl](http://tweetnacl.cr.yp.to/) --------------------------------------- - -* Bernard van Gastel -* Daniel J. Bernstein -* Peter Schwabe -* Sjaak Smetsers -* Tanja Lange -* Wesley Janssen - - -[Poly1305-donna](https://github.com/floodyberry/poly1305-donna) --------------------------------------------------------------- - -* Andrew Moon (@floodyberry) diff --git a/reverse_engineering/node_modules/tweetnacl/CHANGELOG.md b/reverse_engineering/node_modules/tweetnacl/CHANGELOG.md deleted file mode 100644 index 92a4fdc5..00000000 --- a/reverse_engineering/node_modules/tweetnacl/CHANGELOG.md +++ /dev/null @@ -1,221 +0,0 @@ -TweetNaCl.js Changelog -====================== - - -v0.14.5 -------- - -* Fixed incomplete return types in TypeScript typings. -* Replaced COPYING.txt with LICENSE file, which now has public domain dedication - text from The Unlicense. License fields in package.json and bower.json have - been set to "Unlicense". The project was and will be in the public domain -- - this change just makes it easier for automated tools to know about this fact by - using the widely recognized and SPDX-compatible template for public domain - dedication. - - -v0.14.4 -------- - -* Added TypeScript type definitions (contributed by @AndSDev). -* Improved benchmarking code. - - -v0.14.3 -------- - -Fixed a bug in the fast version of Poly1305 and brought it back. - -Thanks to @floodyberry for promptly responding and fixing the original C code: - -> "The issue was not properly detecting if st->h was >= 2^130 - 5, coupled with -> [testing mistake] not catching the failure. The chance of the bug affecting -> anything in the real world is essentially zero luckily, but it's good to have -> it fixed." - -https://github.com/floodyberry/poly1305-donna/issues/2#issuecomment-202698577 - - -v0.14.2 -------- - -Switched Poly1305 fast version back to original (slow) version due to a bug. - - -v0.14.1 -------- - -No code changes, just tweaked packaging and added COPYING.txt. - - -v0.14.0 -------- - -* **Breaking change!** All functions from `nacl.util` have been removed. These - functions are no longer available: - - nacl.util.decodeUTF8 - nacl.util.encodeUTF8 - nacl.util.decodeBase64 - nacl.util.encodeBase64 - - If want to continue using them, you can include - package: - - - - - or - - var nacl = require('tweetnacl'); - nacl.util = require('tweetnacl-util'); - - However it is recommended to use better packages that have wider - compatibility and better performance. Functions from `nacl.util` were never - intended to be robust solution for string conversion and were included for - convenience: cryptography library is not the right place for them. - - Currently calling these functions will throw error pointing to - `tweetnacl-util-js` (in the next version this error message will be removed). - -* Improved detection of available random number generators, making it possible - to use `nacl.randomBytes` and related functions in Web Workers without - changes. - -* Changes to testing (see README). - - -v0.13.3 -------- - -No code changes. - -* Reverted license field in package.json to "Public domain". - -* Fixed typo in README. - - -v0.13.2 -------- - -* Fixed undefined variable bug in fast version of Poly1305. No worries, this - bug was *never* triggered. - -* Specified CC0 public domain dedication. - -* Updated development dependencies. - - -v0.13.1 -------- - -* Exclude `crypto` and `buffer` modules from browserify builds. - - -v0.13.0 -------- - -* Made `nacl-fast` the default version in NPM package. Now - `require("tweetnacl")` will use fast version; to get the original version, - use `require("tweetnacl/nacl.js")`. - -* Cleanup temporary array after generating random bytes. - - -v0.12.2 -------- - -* Improved performance of curve operations, making `nacl.scalarMult`, `nacl.box`, - `nacl.sign` and related functions up to 3x faster in `nacl-fast` version. - - -v0.12.1 -------- - -* Significantly improved performance of Salsa20 (~1.5x faster) and - Poly1305 (~3.5x faster) in `nacl-fast` version. - - -v0.12.0 -------- - -* Instead of using the given secret key directly, TweetNaCl.js now copies it to - a new array in `nacl.box.keyPair.fromSecretKey` and - `nacl.sign.keyPair.fromSecretKey`. - - -v0.11.2 -------- - -* Added new constant: `nacl.sign.seedLength`. - - -v0.11.1 -------- - -* Even faster hash for both short and long inputs (in `nacl-fast`). - - -v0.11.0 -------- - -* Implement `nacl.sign.keyPair.fromSeed` to enable creation of sign key pairs - deterministically from a 32-byte seed. (It behaves like - [libsodium's](http://doc.libsodium.org/public-key_cryptography/public-key_signatures.html) - `crypto_sign_seed_keypair`: the seed becomes a secret part of the secret key.) - -* Fast version now has an improved hash implementation that is 2x-5x faster. - -* Fixed benchmarks, which may have produced incorrect measurements. - - -v0.10.1 -------- - -* Exported undocumented `nacl.lowlevel.crypto_core_hsalsa20`. - - -v0.10.0 -------- - -* **Signature API breaking change!** `nacl.sign` and `nacl.sign.open` now deal - with signed messages, and new `nacl.sign.detached` and - `nacl.sign.detached.verify` are available. - - Previously, `nacl.sign` returned a signature, and `nacl.sign.open` accepted a - message and "detached" signature. This was unlike NaCl's API, which dealt with - signed messages (concatenation of signature and message). - - The new API is: - - nacl.sign(message, secretKey) -> signedMessage - nacl.sign.open(signedMessage, publicKey) -> message | null - - Since detached signatures are common, two new API functions were introduced: - - nacl.sign.detached(message, secretKey) -> signature - nacl.sign.detached.verify(message, signature, publicKey) -> true | false - - (Note that it's `verify`, not `open`, and it returns a boolean value, unlike - `open`, which returns an "unsigned" message.) - -* NPM package now comes without `test` directory to keep it small. - - -v0.9.2 ------- - -* Improved documentation. -* Fast version: increased theoretical message size limit from 2^32-1 to 2^52 - bytes in Poly1305 (and thus, secretbox and box). However this has no impact - in practice since JavaScript arrays or ArrayBuffers are limited to 32-bit - indexes, and most implementations won't allocate more than a gigabyte or so. - (Obviously, there are no tests for the correctness of implementation.) Also, - it's not recommended to use messages that large without splitting them into - smaller packets anyway. - - -v0.9.1 ------- - -* Initial release diff --git a/reverse_engineering/node_modules/tweetnacl/LICENSE b/reverse_engineering/node_modules/tweetnacl/LICENSE deleted file mode 100644 index cf1ab25d..00000000 --- a/reverse_engineering/node_modules/tweetnacl/LICENSE +++ /dev/null @@ -1,24 +0,0 @@ -This is free and unencumbered software released into the public domain. - -Anyone is free to copy, modify, publish, use, compile, sell, or -distribute this software, either in source code form or as a compiled -binary, for any purpose, commercial or non-commercial, and by any -means. - -In jurisdictions that recognize copyright laws, the author or authors -of this software dedicate any and all copyright interest in the -software to the public domain. We make this dedication for the benefit -of the public at large and to the detriment of our heirs and -successors. We intend this dedication to be an overt act of -relinquishment in perpetuity of all present and future rights to this -software under copyright law. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -For more information, please refer to diff --git a/reverse_engineering/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md b/reverse_engineering/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md deleted file mode 100644 index a8eb4a9a..00000000 --- a/reverse_engineering/node_modules/tweetnacl/PULL_REQUEST_TEMPLATE.md +++ /dev/null @@ -1,20 +0,0 @@ -# Important! - -If your contribution is not trivial (not a typo fix, etc.), we can only accept -it if you dedicate your copyright for the contribution to the public domain. -Make sure you understand what it means (see http://unlicense.org/)! If you -agree, please add yourself to AUTHORS.md file, and include the following text -to your pull request description or a comment in it: - ------------------------------------------------------------------------------- - - I dedicate any and all copyright interest in this software to the - public domain. I make this dedication for the benefit of the public at - large and to the detriment of my heirs and successors. I intend this - dedication to be an overt act of relinquishment in perpetuity of all - present and future rights to this software under copyright law. - - Anyone is free to copy, modify, publish, use, compile, sell, or - distribute this software, either in source code form or as a compiled - binary, for any purpose, commercial or non-commercial, and by any - means. diff --git a/reverse_engineering/node_modules/tweetnacl/README.md b/reverse_engineering/node_modules/tweetnacl/README.md deleted file mode 100644 index ffb6871d..00000000 --- a/reverse_engineering/node_modules/tweetnacl/README.md +++ /dev/null @@ -1,459 +0,0 @@ -TweetNaCl.js -============ - -Port of [TweetNaCl](http://tweetnacl.cr.yp.to) / [NaCl](http://nacl.cr.yp.to/) -to JavaScript for modern browsers and Node.js. Public domain. - -[![Build Status](https://travis-ci.org/dchest/tweetnacl-js.svg?branch=master) -](https://travis-ci.org/dchest/tweetnacl-js) - -Demo: - -**:warning: The library is stable and API is frozen, however it has not been -independently reviewed. If you can help reviewing it, please [contact -me](mailto:dmitry@codingrobots.com).** - -Documentation -============= - -* [Overview](#overview) -* [Installation](#installation) -* [Usage](#usage) - * [Public-key authenticated encryption (box)](#public-key-authenticated-encryption-box) - * [Secret-key authenticated encryption (secretbox)](#secret-key-authenticated-encryption-secretbox) - * [Scalar multiplication](#scalar-multiplication) - * [Signatures](#signatures) - * [Hashing](#hashing) - * [Random bytes generation](#random-bytes-generation) - * [Constant-time comparison](#constant-time-comparison) -* [System requirements](#system-requirements) -* [Development and testing](#development-and-testing) -* [Benchmarks](#benchmarks) -* [Contributors](#contributors) -* [Who uses it](#who-uses-it) - - -Overview --------- - -The primary goal of this project is to produce a translation of TweetNaCl to -JavaScript which is as close as possible to the original C implementation, plus -a thin layer of idiomatic high-level API on top of it. - -There are two versions, you can use either of them: - -* `nacl.js` is the port of TweetNaCl with minimum differences from the - original + high-level API. - -* `nacl-fast.js` is like `nacl.js`, but with some functions replaced with - faster versions. - - -Installation ------------- - -You can install TweetNaCl.js via a package manager: - -[Bower](http://bower.io): - - $ bower install tweetnacl - -[NPM](https://www.npmjs.org/): - - $ npm install tweetnacl - -or [download source code](https://github.com/dchest/tweetnacl-js/releases). - - -Usage ------ - -All API functions accept and return bytes as `Uint8Array`s. If you need to -encode or decode strings, use functions from - or one of the more robust codec -packages. - -In Node.js v4 and later `Buffer` objects are backed by `Uint8Array`s, so you -can freely pass them to TweetNaCl.js functions as arguments. The returned -objects are still `Uint8Array`s, so if you need `Buffer`s, you'll have to -convert them manually; make sure to convert using copying: `new Buffer(array)`, -instead of sharing: `new Buffer(array.buffer)`, because some functions return -subarrays of their buffers. - - -### Public-key authenticated encryption (box) - -Implements *curve25519-xsalsa20-poly1305*. - -#### nacl.box.keyPair() - -Generates a new random key pair for box and returns it as an object with -`publicKey` and `secretKey` members: - - { - publicKey: ..., // Uint8Array with 32-byte public key - secretKey: ... // Uint8Array with 32-byte secret key - } - - -#### nacl.box.keyPair.fromSecretKey(secretKey) - -Returns a key pair for box with public key corresponding to the given secret -key. - -#### nacl.box(message, nonce, theirPublicKey, mySecretKey) - -Encrypt and authenticates message using peer's public key, our secret key, and -the given nonce, which must be unique for each distinct message for a key pair. - -Returns an encrypted and authenticated message, which is -`nacl.box.overheadLength` longer than the original message. - -#### nacl.box.open(box, nonce, theirPublicKey, mySecretKey) - -Authenticates and decrypts the given box with peer's public key, our secret -key, and the given nonce. - -Returns the original message, or `false` if authentication fails. - -#### nacl.box.before(theirPublicKey, mySecretKey) - -Returns a precomputed shared key which can be used in `nacl.box.after` and -`nacl.box.open.after`. - -#### nacl.box.after(message, nonce, sharedKey) - -Same as `nacl.box`, but uses a shared key precomputed with `nacl.box.before`. - -#### nacl.box.open.after(box, nonce, sharedKey) - -Same as `nacl.box.open`, but uses a shared key precomputed with `nacl.box.before`. - -#### nacl.box.publicKeyLength = 32 - -Length of public key in bytes. - -#### nacl.box.secretKeyLength = 32 - -Length of secret key in bytes. - -#### nacl.box.sharedKeyLength = 32 - -Length of precomputed shared key in bytes. - -#### nacl.box.nonceLength = 24 - -Length of nonce in bytes. - -#### nacl.box.overheadLength = 16 - -Length of overhead added to box compared to original message. - - -### Secret-key authenticated encryption (secretbox) - -Implements *xsalsa20-poly1305*. - -#### nacl.secretbox(message, nonce, key) - -Encrypt and authenticates message using the key and the nonce. The nonce must -be unique for each distinct message for this key. - -Returns an encrypted and authenticated message, which is -`nacl.secretbox.overheadLength` longer than the original message. - -#### nacl.secretbox.open(box, nonce, key) - -Authenticates and decrypts the given secret box using the key and the nonce. - -Returns the original message, or `false` if authentication fails. - -#### nacl.secretbox.keyLength = 32 - -Length of key in bytes. - -#### nacl.secretbox.nonceLength = 24 - -Length of nonce in bytes. - -#### nacl.secretbox.overheadLength = 16 - -Length of overhead added to secret box compared to original message. - - -### Scalar multiplication - -Implements *curve25519*. - -#### nacl.scalarMult(n, p) - -Multiplies an integer `n` by a group element `p` and returns the resulting -group element. - -#### nacl.scalarMult.base(n) - -Multiplies an integer `n` by a standard group element and returns the resulting -group element. - -#### nacl.scalarMult.scalarLength = 32 - -Length of scalar in bytes. - -#### nacl.scalarMult.groupElementLength = 32 - -Length of group element in bytes. - - -### Signatures - -Implements [ed25519](http://ed25519.cr.yp.to). - -#### nacl.sign.keyPair() - -Generates new random key pair for signing and returns it as an object with -`publicKey` and `secretKey` members: - - { - publicKey: ..., // Uint8Array with 32-byte public key - secretKey: ... // Uint8Array with 64-byte secret key - } - -#### nacl.sign.keyPair.fromSecretKey(secretKey) - -Returns a signing key pair with public key corresponding to the given -64-byte secret key. The secret key must have been generated by -`nacl.sign.keyPair` or `nacl.sign.keyPair.fromSeed`. - -#### nacl.sign.keyPair.fromSeed(seed) - -Returns a new signing key pair generated deterministically from a 32-byte seed. -The seed must contain enough entropy to be secure. This method is not -recommended for general use: instead, use `nacl.sign.keyPair` to generate a new -key pair from a random seed. - -#### nacl.sign(message, secretKey) - -Signs the message using the secret key and returns a signed message. - -#### nacl.sign.open(signedMessage, publicKey) - -Verifies the signed message and returns the message without signature. - -Returns `null` if verification failed. - -#### nacl.sign.detached(message, secretKey) - -Signs the message using the secret key and returns a signature. - -#### nacl.sign.detached.verify(message, signature, publicKey) - -Verifies the signature for the message and returns `true` if verification -succeeded or `false` if it failed. - -#### nacl.sign.publicKeyLength = 32 - -Length of signing public key in bytes. - -#### nacl.sign.secretKeyLength = 64 - -Length of signing secret key in bytes. - -#### nacl.sign.seedLength = 32 - -Length of seed for `nacl.sign.keyPair.fromSeed` in bytes. - -#### nacl.sign.signatureLength = 64 - -Length of signature in bytes. - - -### Hashing - -Implements *SHA-512*. - -#### nacl.hash(message) - -Returns SHA-512 hash of the message. - -#### nacl.hash.hashLength = 64 - -Length of hash in bytes. - - -### Random bytes generation - -#### nacl.randomBytes(length) - -Returns a `Uint8Array` of the given length containing random bytes of -cryptographic quality. - -**Implementation note** - -TweetNaCl.js uses the following methods to generate random bytes, -depending on the platform it runs on: - -* `window.crypto.getRandomValues` (WebCrypto standard) -* `window.msCrypto.getRandomValues` (Internet Explorer 11) -* `crypto.randomBytes` (Node.js) - -If the platform doesn't provide a suitable PRNG, the following functions, -which require random numbers, will throw exception: - -* `nacl.randomBytes` -* `nacl.box.keyPair` -* `nacl.sign.keyPair` - -Other functions are deterministic and will continue working. - -If a platform you are targeting doesn't implement secure random number -generator, but you somehow have a cryptographically-strong source of entropy -(not `Math.random`!), and you know what you are doing, you can plug it into -TweetNaCl.js like this: - - nacl.setPRNG(function(x, n) { - // ... copy n random bytes into x ... - }); - -Note that `nacl.setPRNG` *completely replaces* internal random byte generator -with the one provided. - - -### Constant-time comparison - -#### nacl.verify(x, y) - -Compares `x` and `y` in constant time and returns `true` if their lengths are -non-zero and equal, and their contents are equal. - -Returns `false` if either of the arguments has zero length, or arguments have -different lengths, or their contents differ. - - -System requirements -------------------- - -TweetNaCl.js supports modern browsers that have a cryptographically secure -pseudorandom number generator and typed arrays, including the latest versions -of: - -* Chrome -* Firefox -* Safari (Mac, iOS) -* Internet Explorer 11 - -Other systems: - -* Node.js - - -Development and testing ------------------------- - -Install NPM modules needed for development: - - $ npm install - -To build minified versions: - - $ npm run build - -Tests use minified version, so make sure to rebuild it every time you change -`nacl.js` or `nacl-fast.js`. - -### Testing - -To run tests in Node.js: - - $ npm run test-node - -By default all tests described here work on `nacl.min.js`. To test other -versions, set environment variable `NACL_SRC` to the file name you want to test. -For example, the following command will test fast minified version: - - $ NACL_SRC=nacl-fast.min.js npm run test-node - -To run full suite of tests in Node.js, including comparing outputs of -JavaScript port to outputs of the original C version: - - $ npm run test-node-all - -To prepare tests for browsers: - - $ npm run build-test-browser - -and then open `test/browser/test.html` (or `test/browser/test-fast.html`) to -run them. - -To run headless browser tests with `tape-run` (powered by Electron): - - $ npm run test-browser - -(If you get `Error: spawn ENOENT`, install *xvfb*: `sudo apt-get install xvfb`.) - -To run tests in both Node and Electron: - - $ npm test - -### Benchmarking - -To run benchmarks in Node.js: - - $ npm run bench - $ NACL_SRC=nacl-fast.min.js npm run bench - -To run benchmarks in a browser, open `test/benchmark/bench.html` (or -`test/benchmark/bench-fast.html`). - - -Benchmarks ----------- - -For reference, here are benchmarks from MacBook Pro (Retina, 13-inch, Mid 2014) -laptop with 2.6 GHz Intel Core i5 CPU (Intel) in Chrome 53/OS X and Xiaomi Redmi -Note 3 smartphone with 1.8 GHz Qualcomm Snapdragon 650 64-bit CPU (ARM) in -Chrome 52/Android: - -| | nacl.js Intel | nacl-fast.js Intel | nacl.js ARM | nacl-fast.js ARM | -| ------------- |:-------------:|:-------------------:|:-------------:|:-----------------:| -| salsa20 | 1.3 MB/s | 128 MB/s | 0.4 MB/s | 43 MB/s | -| poly1305 | 13 MB/s | 171 MB/s | 4 MB/s | 52 MB/s | -| hash | 4 MB/s | 34 MB/s | 0.9 MB/s | 12 MB/s | -| secretbox 1K | 1113 op/s | 57583 op/s | 334 op/s | 14227 op/s | -| box 1K | 145 op/s | 718 op/s | 37 op/s | 368 op/s | -| scalarMult | 171 op/s | 733 op/s | 56 op/s | 380 op/s | -| sign | 77 op/s | 200 op/s | 20 op/s | 61 op/s | -| sign.open | 39 op/s | 102 op/s | 11 op/s | 31 op/s | - -(You can run benchmarks on your devices by clicking on the links at the bottom -of the [home page](https://tweetnacl.js.org)). - -In short, with *nacl-fast.js* and 1024-byte messages you can expect to encrypt and -authenticate more than 57000 messages per second on a typical laptop or more than -14000 messages per second on a $170 smartphone, sign about 200 and verify 100 -messages per second on a laptop or 60 and 30 messages per second on a smartphone, -per CPU core (with Web Workers you can do these operations in parallel), -which is good enough for most applications. - - -Contributors ------------- - -See AUTHORS.md file. - - -Third-party libraries based on TweetNaCl.js -------------------------------------------- - -* [forward-secrecy](https://github.com/alax/forward-secrecy) — Axolotl ratchet implementation -* [nacl-stream](https://github.com/dchest/nacl-stream-js) - streaming encryption -* [tweetnacl-auth-js](https://github.com/dchest/tweetnacl-auth-js) — implementation of [`crypto_auth`](http://nacl.cr.yp.to/auth.html) -* [chloride](https://github.com/dominictarr/chloride) - unified API for various NaCl modules - - -Who uses it ------------ - -Some notable users of TweetNaCl.js: - -* [miniLock](http://minilock.io/) -* [Stellar](https://www.stellar.org/) diff --git a/reverse_engineering/node_modules/tweetnacl/nacl-fast.js b/reverse_engineering/node_modules/tweetnacl/nacl-fast.js deleted file mode 100644 index 5e4562fe..00000000 --- a/reverse_engineering/node_modules/tweetnacl/nacl-fast.js +++ /dev/null @@ -1,2388 +0,0 @@ -(function(nacl) { -'use strict'; - -// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -// -// Implementation derived from TweetNaCl version 20140427. -// See for details: http://tweetnacl.cr.yp.to/ - -var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; -}; - -// Pluggable, initialized in high-level API below. -var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - -var _0 = new Uint8Array(16); -var _9 = new Uint8Array(32); _9[0] = 9; - -var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -function ts64(x, i, h, l) { - x[i] = (h >> 24) & 0xff; - x[i+1] = (h >> 16) & 0xff; - x[i+2] = (h >> 8) & 0xff; - x[i+3] = h & 0xff; - x[i+4] = (l >> 24) & 0xff; - x[i+5] = (l >> 16) & 0xff; - x[i+6] = (l >> 8) & 0xff; - x[i+7] = l & 0xff; -} - -function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; -} - -function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); -} - -function core_salsa20(o, p, k, c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - x0 = x0 + j0 | 0; - x1 = x1 + j1 | 0; - x2 = x2 + j2 | 0; - x3 = x3 + j3 | 0; - x4 = x4 + j4 | 0; - x5 = x5 + j5 | 0; - x6 = x6 + j6 | 0; - x7 = x7 + j7 | 0; - x8 = x8 + j8 | 0; - x9 = x9 + j9 | 0; - x10 = x10 + j10 | 0; - x11 = x11 + j11 | 0; - x12 = x12 + j12 | 0; - x13 = x13 + j13 | 0; - x14 = x14 + j14 | 0; - x15 = x15 + j15 | 0; - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x1 >>> 0 & 0xff; - o[ 5] = x1 >>> 8 & 0xff; - o[ 6] = x1 >>> 16 & 0xff; - o[ 7] = x1 >>> 24 & 0xff; - - o[ 8] = x2 >>> 0 & 0xff; - o[ 9] = x2 >>> 8 & 0xff; - o[10] = x2 >>> 16 & 0xff; - o[11] = x2 >>> 24 & 0xff; - - o[12] = x3 >>> 0 & 0xff; - o[13] = x3 >>> 8 & 0xff; - o[14] = x3 >>> 16 & 0xff; - o[15] = x3 >>> 24 & 0xff; - - o[16] = x4 >>> 0 & 0xff; - o[17] = x4 >>> 8 & 0xff; - o[18] = x4 >>> 16 & 0xff; - o[19] = x4 >>> 24 & 0xff; - - o[20] = x5 >>> 0 & 0xff; - o[21] = x5 >>> 8 & 0xff; - o[22] = x5 >>> 16 & 0xff; - o[23] = x5 >>> 24 & 0xff; - - o[24] = x6 >>> 0 & 0xff; - o[25] = x6 >>> 8 & 0xff; - o[26] = x6 >>> 16 & 0xff; - o[27] = x6 >>> 24 & 0xff; - - o[28] = x7 >>> 0 & 0xff; - o[29] = x7 >>> 8 & 0xff; - o[30] = x7 >>> 16 & 0xff; - o[31] = x7 >>> 24 & 0xff; - - o[32] = x8 >>> 0 & 0xff; - o[33] = x8 >>> 8 & 0xff; - o[34] = x8 >>> 16 & 0xff; - o[35] = x8 >>> 24 & 0xff; - - o[36] = x9 >>> 0 & 0xff; - o[37] = x9 >>> 8 & 0xff; - o[38] = x9 >>> 16 & 0xff; - o[39] = x9 >>> 24 & 0xff; - - o[40] = x10 >>> 0 & 0xff; - o[41] = x10 >>> 8 & 0xff; - o[42] = x10 >>> 16 & 0xff; - o[43] = x10 >>> 24 & 0xff; - - o[44] = x11 >>> 0 & 0xff; - o[45] = x11 >>> 8 & 0xff; - o[46] = x11 >>> 16 & 0xff; - o[47] = x11 >>> 24 & 0xff; - - o[48] = x12 >>> 0 & 0xff; - o[49] = x12 >>> 8 & 0xff; - o[50] = x12 >>> 16 & 0xff; - o[51] = x12 >>> 24 & 0xff; - - o[52] = x13 >>> 0 & 0xff; - o[53] = x13 >>> 8 & 0xff; - o[54] = x13 >>> 16 & 0xff; - o[55] = x13 >>> 24 & 0xff; - - o[56] = x14 >>> 0 & 0xff; - o[57] = x14 >>> 8 & 0xff; - o[58] = x14 >>> 16 & 0xff; - o[59] = x14 >>> 24 & 0xff; - - o[60] = x15 >>> 0 & 0xff; - o[61] = x15 >>> 8 & 0xff; - o[62] = x15 >>> 16 & 0xff; - o[63] = x15 >>> 24 & 0xff; -} - -function core_hsalsa20(o,p,k,c) { - var j0 = c[ 0] & 0xff | (c[ 1] & 0xff)<<8 | (c[ 2] & 0xff)<<16 | (c[ 3] & 0xff)<<24, - j1 = k[ 0] & 0xff | (k[ 1] & 0xff)<<8 | (k[ 2] & 0xff)<<16 | (k[ 3] & 0xff)<<24, - j2 = k[ 4] & 0xff | (k[ 5] & 0xff)<<8 | (k[ 6] & 0xff)<<16 | (k[ 7] & 0xff)<<24, - j3 = k[ 8] & 0xff | (k[ 9] & 0xff)<<8 | (k[10] & 0xff)<<16 | (k[11] & 0xff)<<24, - j4 = k[12] & 0xff | (k[13] & 0xff)<<8 | (k[14] & 0xff)<<16 | (k[15] & 0xff)<<24, - j5 = c[ 4] & 0xff | (c[ 5] & 0xff)<<8 | (c[ 6] & 0xff)<<16 | (c[ 7] & 0xff)<<24, - j6 = p[ 0] & 0xff | (p[ 1] & 0xff)<<8 | (p[ 2] & 0xff)<<16 | (p[ 3] & 0xff)<<24, - j7 = p[ 4] & 0xff | (p[ 5] & 0xff)<<8 | (p[ 6] & 0xff)<<16 | (p[ 7] & 0xff)<<24, - j8 = p[ 8] & 0xff | (p[ 9] & 0xff)<<8 | (p[10] & 0xff)<<16 | (p[11] & 0xff)<<24, - j9 = p[12] & 0xff | (p[13] & 0xff)<<8 | (p[14] & 0xff)<<16 | (p[15] & 0xff)<<24, - j10 = c[ 8] & 0xff | (c[ 9] & 0xff)<<8 | (c[10] & 0xff)<<16 | (c[11] & 0xff)<<24, - j11 = k[16] & 0xff | (k[17] & 0xff)<<8 | (k[18] & 0xff)<<16 | (k[19] & 0xff)<<24, - j12 = k[20] & 0xff | (k[21] & 0xff)<<8 | (k[22] & 0xff)<<16 | (k[23] & 0xff)<<24, - j13 = k[24] & 0xff | (k[25] & 0xff)<<8 | (k[26] & 0xff)<<16 | (k[27] & 0xff)<<24, - j14 = k[28] & 0xff | (k[29] & 0xff)<<8 | (k[30] & 0xff)<<16 | (k[31] & 0xff)<<24, - j15 = c[12] & 0xff | (c[13] & 0xff)<<8 | (c[14] & 0xff)<<16 | (c[15] & 0xff)<<24; - - var x0 = j0, x1 = j1, x2 = j2, x3 = j3, x4 = j4, x5 = j5, x6 = j6, x7 = j7, - x8 = j8, x9 = j9, x10 = j10, x11 = j11, x12 = j12, x13 = j13, x14 = j14, - x15 = j15, u; - - for (var i = 0; i < 20; i += 2) { - u = x0 + x12 | 0; - x4 ^= u<<7 | u>>>(32-7); - u = x4 + x0 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x4 | 0; - x12 ^= u<<13 | u>>>(32-13); - u = x12 + x8 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x1 | 0; - x9 ^= u<<7 | u>>>(32-7); - u = x9 + x5 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x9 | 0; - x1 ^= u<<13 | u>>>(32-13); - u = x1 + x13 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x6 | 0; - x14 ^= u<<7 | u>>>(32-7); - u = x14 + x10 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x14 | 0; - x6 ^= u<<13 | u>>>(32-13); - u = x6 + x2 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x11 | 0; - x3 ^= u<<7 | u>>>(32-7); - u = x3 + x15 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x3 | 0; - x11 ^= u<<13 | u>>>(32-13); - u = x11 + x7 | 0; - x15 ^= u<<18 | u>>>(32-18); - - u = x0 + x3 | 0; - x1 ^= u<<7 | u>>>(32-7); - u = x1 + x0 | 0; - x2 ^= u<<9 | u>>>(32-9); - u = x2 + x1 | 0; - x3 ^= u<<13 | u>>>(32-13); - u = x3 + x2 | 0; - x0 ^= u<<18 | u>>>(32-18); - - u = x5 + x4 | 0; - x6 ^= u<<7 | u>>>(32-7); - u = x6 + x5 | 0; - x7 ^= u<<9 | u>>>(32-9); - u = x7 + x6 | 0; - x4 ^= u<<13 | u>>>(32-13); - u = x4 + x7 | 0; - x5 ^= u<<18 | u>>>(32-18); - - u = x10 + x9 | 0; - x11 ^= u<<7 | u>>>(32-7); - u = x11 + x10 | 0; - x8 ^= u<<9 | u>>>(32-9); - u = x8 + x11 | 0; - x9 ^= u<<13 | u>>>(32-13); - u = x9 + x8 | 0; - x10 ^= u<<18 | u>>>(32-18); - - u = x15 + x14 | 0; - x12 ^= u<<7 | u>>>(32-7); - u = x12 + x15 | 0; - x13 ^= u<<9 | u>>>(32-9); - u = x13 + x12 | 0; - x14 ^= u<<13 | u>>>(32-13); - u = x14 + x13 | 0; - x15 ^= u<<18 | u>>>(32-18); - } - - o[ 0] = x0 >>> 0 & 0xff; - o[ 1] = x0 >>> 8 & 0xff; - o[ 2] = x0 >>> 16 & 0xff; - o[ 3] = x0 >>> 24 & 0xff; - - o[ 4] = x5 >>> 0 & 0xff; - o[ 5] = x5 >>> 8 & 0xff; - o[ 6] = x5 >>> 16 & 0xff; - o[ 7] = x5 >>> 24 & 0xff; - - o[ 8] = x10 >>> 0 & 0xff; - o[ 9] = x10 >>> 8 & 0xff; - o[10] = x10 >>> 16 & 0xff; - o[11] = x10 >>> 24 & 0xff; - - o[12] = x15 >>> 0 & 0xff; - o[13] = x15 >>> 8 & 0xff; - o[14] = x15 >>> 16 & 0xff; - o[15] = x15 >>> 24 & 0xff; - - o[16] = x6 >>> 0 & 0xff; - o[17] = x6 >>> 8 & 0xff; - o[18] = x6 >>> 16 & 0xff; - o[19] = x6 >>> 24 & 0xff; - - o[20] = x7 >>> 0 & 0xff; - o[21] = x7 >>> 8 & 0xff; - o[22] = x7 >>> 16 & 0xff; - o[23] = x7 >>> 24 & 0xff; - - o[24] = x8 >>> 0 & 0xff; - o[25] = x8 >>> 8 & 0xff; - o[26] = x8 >>> 16 & 0xff; - o[27] = x8 >>> 24 & 0xff; - - o[28] = x9 >>> 0 & 0xff; - o[29] = x9 >>> 8 & 0xff; - o[30] = x9 >>> 16 & 0xff; - o[31] = x9 >>> 24 & 0xff; -} - -function crypto_core_salsa20(out,inp,k,c) { - core_salsa20(out,inp,k,c); -} - -function crypto_core_hsalsa20(out,inp,k,c) { - core_hsalsa20(out,inp,k,c); -} - -var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" - -function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = m[mpos+i] ^ x[i]; - } - return 0; -} - -function crypto_stream_salsa20(c,cpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = x[i]; - } - return 0; -} - -function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20(c,cpos,d,sn,s); -} - -function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - var sn = new Uint8Array(8); - for (var i = 0; i < 8; i++) sn[i] = n[i+16]; - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,sn,s); -} - -/* -* Port of Andrew Moon's Poly1305-donna-16. Public domain. -* https://github.com/floodyberry/poly1305-donna -*/ - -var poly1305 = function(key) { - this.buffer = new Uint8Array(16); - this.r = new Uint16Array(10); - this.h = new Uint16Array(10); - this.pad = new Uint16Array(8); - this.leftover = 0; - this.fin = 0; - - var t0, t1, t2, t3, t4, t5, t6, t7; - - t0 = key[ 0] & 0xff | (key[ 1] & 0xff) << 8; this.r[0] = ( t0 ) & 0x1fff; - t1 = key[ 2] & 0xff | (key[ 3] & 0xff) << 8; this.r[1] = ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = key[ 4] & 0xff | (key[ 5] & 0xff) << 8; this.r[2] = ((t1 >>> 10) | (t2 << 6)) & 0x1f03; - t3 = key[ 6] & 0xff | (key[ 7] & 0xff) << 8; this.r[3] = ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = key[ 8] & 0xff | (key[ 9] & 0xff) << 8; this.r[4] = ((t3 >>> 4) | (t4 << 12)) & 0x00ff; - this.r[5] = ((t4 >>> 1)) & 0x1ffe; - t5 = key[10] & 0xff | (key[11] & 0xff) << 8; this.r[6] = ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = key[12] & 0xff | (key[13] & 0xff) << 8; this.r[7] = ((t5 >>> 11) | (t6 << 5)) & 0x1f81; - t7 = key[14] & 0xff | (key[15] & 0xff) << 8; this.r[8] = ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - this.r[9] = ((t7 >>> 5)) & 0x007f; - - this.pad[0] = key[16] & 0xff | (key[17] & 0xff) << 8; - this.pad[1] = key[18] & 0xff | (key[19] & 0xff) << 8; - this.pad[2] = key[20] & 0xff | (key[21] & 0xff) << 8; - this.pad[3] = key[22] & 0xff | (key[23] & 0xff) << 8; - this.pad[4] = key[24] & 0xff | (key[25] & 0xff) << 8; - this.pad[5] = key[26] & 0xff | (key[27] & 0xff) << 8; - this.pad[6] = key[28] & 0xff | (key[29] & 0xff) << 8; - this.pad[7] = key[30] & 0xff | (key[31] & 0xff) << 8; -}; - -poly1305.prototype.blocks = function(m, mpos, bytes) { - var hibit = this.fin ? 0 : (1 << 11); - var t0, t1, t2, t3, t4, t5, t6, t7, c; - var d0, d1, d2, d3, d4, d5, d6, d7, d8, d9; - - var h0 = this.h[0], - h1 = this.h[1], - h2 = this.h[2], - h3 = this.h[3], - h4 = this.h[4], - h5 = this.h[5], - h6 = this.h[6], - h7 = this.h[7], - h8 = this.h[8], - h9 = this.h[9]; - - var r0 = this.r[0], - r1 = this.r[1], - r2 = this.r[2], - r3 = this.r[3], - r4 = this.r[4], - r5 = this.r[5], - r6 = this.r[6], - r7 = this.r[7], - r8 = this.r[8], - r9 = this.r[9]; - - while (bytes >= 16) { - t0 = m[mpos+ 0] & 0xff | (m[mpos+ 1] & 0xff) << 8; h0 += ( t0 ) & 0x1fff; - t1 = m[mpos+ 2] & 0xff | (m[mpos+ 3] & 0xff) << 8; h1 += ((t0 >>> 13) | (t1 << 3)) & 0x1fff; - t2 = m[mpos+ 4] & 0xff | (m[mpos+ 5] & 0xff) << 8; h2 += ((t1 >>> 10) | (t2 << 6)) & 0x1fff; - t3 = m[mpos+ 6] & 0xff | (m[mpos+ 7] & 0xff) << 8; h3 += ((t2 >>> 7) | (t3 << 9)) & 0x1fff; - t4 = m[mpos+ 8] & 0xff | (m[mpos+ 9] & 0xff) << 8; h4 += ((t3 >>> 4) | (t4 << 12)) & 0x1fff; - h5 += ((t4 >>> 1)) & 0x1fff; - t5 = m[mpos+10] & 0xff | (m[mpos+11] & 0xff) << 8; h6 += ((t4 >>> 14) | (t5 << 2)) & 0x1fff; - t6 = m[mpos+12] & 0xff | (m[mpos+13] & 0xff) << 8; h7 += ((t5 >>> 11) | (t6 << 5)) & 0x1fff; - t7 = m[mpos+14] & 0xff | (m[mpos+15] & 0xff) << 8; h8 += ((t6 >>> 8) | (t7 << 8)) & 0x1fff; - h9 += ((t7 >>> 5)) | hibit; - - c = 0; - - d0 = c; - d0 += h0 * r0; - d0 += h1 * (5 * r9); - d0 += h2 * (5 * r8); - d0 += h3 * (5 * r7); - d0 += h4 * (5 * r6); - c = (d0 >>> 13); d0 &= 0x1fff; - d0 += h5 * (5 * r5); - d0 += h6 * (5 * r4); - d0 += h7 * (5 * r3); - d0 += h8 * (5 * r2); - d0 += h9 * (5 * r1); - c += (d0 >>> 13); d0 &= 0x1fff; - - d1 = c; - d1 += h0 * r1; - d1 += h1 * r0; - d1 += h2 * (5 * r9); - d1 += h3 * (5 * r8); - d1 += h4 * (5 * r7); - c = (d1 >>> 13); d1 &= 0x1fff; - d1 += h5 * (5 * r6); - d1 += h6 * (5 * r5); - d1 += h7 * (5 * r4); - d1 += h8 * (5 * r3); - d1 += h9 * (5 * r2); - c += (d1 >>> 13); d1 &= 0x1fff; - - d2 = c; - d2 += h0 * r2; - d2 += h1 * r1; - d2 += h2 * r0; - d2 += h3 * (5 * r9); - d2 += h4 * (5 * r8); - c = (d2 >>> 13); d2 &= 0x1fff; - d2 += h5 * (5 * r7); - d2 += h6 * (5 * r6); - d2 += h7 * (5 * r5); - d2 += h8 * (5 * r4); - d2 += h9 * (5 * r3); - c += (d2 >>> 13); d2 &= 0x1fff; - - d3 = c; - d3 += h0 * r3; - d3 += h1 * r2; - d3 += h2 * r1; - d3 += h3 * r0; - d3 += h4 * (5 * r9); - c = (d3 >>> 13); d3 &= 0x1fff; - d3 += h5 * (5 * r8); - d3 += h6 * (5 * r7); - d3 += h7 * (5 * r6); - d3 += h8 * (5 * r5); - d3 += h9 * (5 * r4); - c += (d3 >>> 13); d3 &= 0x1fff; - - d4 = c; - d4 += h0 * r4; - d4 += h1 * r3; - d4 += h2 * r2; - d4 += h3 * r1; - d4 += h4 * r0; - c = (d4 >>> 13); d4 &= 0x1fff; - d4 += h5 * (5 * r9); - d4 += h6 * (5 * r8); - d4 += h7 * (5 * r7); - d4 += h8 * (5 * r6); - d4 += h9 * (5 * r5); - c += (d4 >>> 13); d4 &= 0x1fff; - - d5 = c; - d5 += h0 * r5; - d5 += h1 * r4; - d5 += h2 * r3; - d5 += h3 * r2; - d5 += h4 * r1; - c = (d5 >>> 13); d5 &= 0x1fff; - d5 += h5 * r0; - d5 += h6 * (5 * r9); - d5 += h7 * (5 * r8); - d5 += h8 * (5 * r7); - d5 += h9 * (5 * r6); - c += (d5 >>> 13); d5 &= 0x1fff; - - d6 = c; - d6 += h0 * r6; - d6 += h1 * r5; - d6 += h2 * r4; - d6 += h3 * r3; - d6 += h4 * r2; - c = (d6 >>> 13); d6 &= 0x1fff; - d6 += h5 * r1; - d6 += h6 * r0; - d6 += h7 * (5 * r9); - d6 += h8 * (5 * r8); - d6 += h9 * (5 * r7); - c += (d6 >>> 13); d6 &= 0x1fff; - - d7 = c; - d7 += h0 * r7; - d7 += h1 * r6; - d7 += h2 * r5; - d7 += h3 * r4; - d7 += h4 * r3; - c = (d7 >>> 13); d7 &= 0x1fff; - d7 += h5 * r2; - d7 += h6 * r1; - d7 += h7 * r0; - d7 += h8 * (5 * r9); - d7 += h9 * (5 * r8); - c += (d7 >>> 13); d7 &= 0x1fff; - - d8 = c; - d8 += h0 * r8; - d8 += h1 * r7; - d8 += h2 * r6; - d8 += h3 * r5; - d8 += h4 * r4; - c = (d8 >>> 13); d8 &= 0x1fff; - d8 += h5 * r3; - d8 += h6 * r2; - d8 += h7 * r1; - d8 += h8 * r0; - d8 += h9 * (5 * r9); - c += (d8 >>> 13); d8 &= 0x1fff; - - d9 = c; - d9 += h0 * r9; - d9 += h1 * r8; - d9 += h2 * r7; - d9 += h3 * r6; - d9 += h4 * r5; - c = (d9 >>> 13); d9 &= 0x1fff; - d9 += h5 * r4; - d9 += h6 * r3; - d9 += h7 * r2; - d9 += h8 * r1; - d9 += h9 * r0; - c += (d9 >>> 13); d9 &= 0x1fff; - - c = (((c << 2) + c)) | 0; - c = (c + d0) | 0; - d0 = c & 0x1fff; - c = (c >>> 13); - d1 += c; - - h0 = d0; - h1 = d1; - h2 = d2; - h3 = d3; - h4 = d4; - h5 = d5; - h6 = d6; - h7 = d7; - h8 = d8; - h9 = d9; - - mpos += 16; - bytes -= 16; - } - this.h[0] = h0; - this.h[1] = h1; - this.h[2] = h2; - this.h[3] = h3; - this.h[4] = h4; - this.h[5] = h5; - this.h[6] = h6; - this.h[7] = h7; - this.h[8] = h8; - this.h[9] = h9; -}; - -poly1305.prototype.finish = function(mac, macpos) { - var g = new Uint16Array(10); - var c, mask, f, i; - - if (this.leftover) { - i = this.leftover; - this.buffer[i++] = 1; - for (; i < 16; i++) this.buffer[i] = 0; - this.fin = 1; - this.blocks(this.buffer, 0, 16); - } - - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - for (i = 2; i < 10; i++) { - this.h[i] += c; - c = this.h[i] >>> 13; - this.h[i] &= 0x1fff; - } - this.h[0] += (c * 5); - c = this.h[0] >>> 13; - this.h[0] &= 0x1fff; - this.h[1] += c; - c = this.h[1] >>> 13; - this.h[1] &= 0x1fff; - this.h[2] += c; - - g[0] = this.h[0] + 5; - c = g[0] >>> 13; - g[0] &= 0x1fff; - for (i = 1; i < 10; i++) { - g[i] = this.h[i] + c; - c = g[i] >>> 13; - g[i] &= 0x1fff; - } - g[9] -= (1 << 13); - - mask = (c ^ 1) - 1; - for (i = 0; i < 10; i++) g[i] &= mask; - mask = ~mask; - for (i = 0; i < 10; i++) this.h[i] = (this.h[i] & mask) | g[i]; - - this.h[0] = ((this.h[0] ) | (this.h[1] << 13) ) & 0xffff; - this.h[1] = ((this.h[1] >>> 3) | (this.h[2] << 10) ) & 0xffff; - this.h[2] = ((this.h[2] >>> 6) | (this.h[3] << 7) ) & 0xffff; - this.h[3] = ((this.h[3] >>> 9) | (this.h[4] << 4) ) & 0xffff; - this.h[4] = ((this.h[4] >>> 12) | (this.h[5] << 1) | (this.h[6] << 14)) & 0xffff; - this.h[5] = ((this.h[6] >>> 2) | (this.h[7] << 11) ) & 0xffff; - this.h[6] = ((this.h[7] >>> 5) | (this.h[8] << 8) ) & 0xffff; - this.h[7] = ((this.h[8] >>> 8) | (this.h[9] << 5) ) & 0xffff; - - f = this.h[0] + this.pad[0]; - this.h[0] = f & 0xffff; - for (i = 1; i < 8; i++) { - f = (((this.h[i] + this.pad[i]) | 0) + (f >>> 16)) | 0; - this.h[i] = f & 0xffff; - } - - mac[macpos+ 0] = (this.h[0] >>> 0) & 0xff; - mac[macpos+ 1] = (this.h[0] >>> 8) & 0xff; - mac[macpos+ 2] = (this.h[1] >>> 0) & 0xff; - mac[macpos+ 3] = (this.h[1] >>> 8) & 0xff; - mac[macpos+ 4] = (this.h[2] >>> 0) & 0xff; - mac[macpos+ 5] = (this.h[2] >>> 8) & 0xff; - mac[macpos+ 6] = (this.h[3] >>> 0) & 0xff; - mac[macpos+ 7] = (this.h[3] >>> 8) & 0xff; - mac[macpos+ 8] = (this.h[4] >>> 0) & 0xff; - mac[macpos+ 9] = (this.h[4] >>> 8) & 0xff; - mac[macpos+10] = (this.h[5] >>> 0) & 0xff; - mac[macpos+11] = (this.h[5] >>> 8) & 0xff; - mac[macpos+12] = (this.h[6] >>> 0) & 0xff; - mac[macpos+13] = (this.h[6] >>> 8) & 0xff; - mac[macpos+14] = (this.h[7] >>> 0) & 0xff; - mac[macpos+15] = (this.h[7] >>> 8) & 0xff; -}; - -poly1305.prototype.update = function(m, mpos, bytes) { - var i, want; - - if (this.leftover) { - want = (16 - this.leftover); - if (want > bytes) - want = bytes; - for (i = 0; i < want; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - bytes -= want; - mpos += want; - this.leftover += want; - if (this.leftover < 16) - return; - this.blocks(this.buffer, 0, 16); - this.leftover = 0; - } - - if (bytes >= 16) { - want = bytes - (bytes % 16); - this.blocks(m, mpos, want); - mpos += want; - bytes -= want; - } - - if (bytes) { - for (i = 0; i < bytes; i++) - this.buffer[this.leftover + i] = m[mpos+i]; - this.leftover += bytes; - } -}; - -function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s = new poly1305(k); - s.update(m, mpos, n); - s.finish(out, outpos); - return 0; -} - -function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); -} - -function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; -} - -function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; -} - -function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; -} - -function car25519(o) { - var i, v, c = 1; - for (i = 0; i < 16; i++) { - v = o[i] + c + 65535; - c = Math.floor(v / 65536); - o[i] = v - c * 65536; - } - o[0] += c-1 + 37 * (c-1); -} - -function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } -} - -function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; -} - -function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; -} - -function A(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] + b[i]; -} - -function Z(o, a, b) { - for (var i = 0; i < 16; i++) o[i] = a[i] - b[i]; -} - -function M(o, a, b) { - var v, c, - t0 = 0, t1 = 0, t2 = 0, t3 = 0, t4 = 0, t5 = 0, t6 = 0, t7 = 0, - t8 = 0, t9 = 0, t10 = 0, t11 = 0, t12 = 0, t13 = 0, t14 = 0, t15 = 0, - t16 = 0, t17 = 0, t18 = 0, t19 = 0, t20 = 0, t21 = 0, t22 = 0, t23 = 0, - t24 = 0, t25 = 0, t26 = 0, t27 = 0, t28 = 0, t29 = 0, t30 = 0, - b0 = b[0], - b1 = b[1], - b2 = b[2], - b3 = b[3], - b4 = b[4], - b5 = b[5], - b6 = b[6], - b7 = b[7], - b8 = b[8], - b9 = b[9], - b10 = b[10], - b11 = b[11], - b12 = b[12], - b13 = b[13], - b14 = b[14], - b15 = b[15]; - - v = a[0]; - t0 += v * b0; - t1 += v * b1; - t2 += v * b2; - t3 += v * b3; - t4 += v * b4; - t5 += v * b5; - t6 += v * b6; - t7 += v * b7; - t8 += v * b8; - t9 += v * b9; - t10 += v * b10; - t11 += v * b11; - t12 += v * b12; - t13 += v * b13; - t14 += v * b14; - t15 += v * b15; - v = a[1]; - t1 += v * b0; - t2 += v * b1; - t3 += v * b2; - t4 += v * b3; - t5 += v * b4; - t6 += v * b5; - t7 += v * b6; - t8 += v * b7; - t9 += v * b8; - t10 += v * b9; - t11 += v * b10; - t12 += v * b11; - t13 += v * b12; - t14 += v * b13; - t15 += v * b14; - t16 += v * b15; - v = a[2]; - t2 += v * b0; - t3 += v * b1; - t4 += v * b2; - t5 += v * b3; - t6 += v * b4; - t7 += v * b5; - t8 += v * b6; - t9 += v * b7; - t10 += v * b8; - t11 += v * b9; - t12 += v * b10; - t13 += v * b11; - t14 += v * b12; - t15 += v * b13; - t16 += v * b14; - t17 += v * b15; - v = a[3]; - t3 += v * b0; - t4 += v * b1; - t5 += v * b2; - t6 += v * b3; - t7 += v * b4; - t8 += v * b5; - t9 += v * b6; - t10 += v * b7; - t11 += v * b8; - t12 += v * b9; - t13 += v * b10; - t14 += v * b11; - t15 += v * b12; - t16 += v * b13; - t17 += v * b14; - t18 += v * b15; - v = a[4]; - t4 += v * b0; - t5 += v * b1; - t6 += v * b2; - t7 += v * b3; - t8 += v * b4; - t9 += v * b5; - t10 += v * b6; - t11 += v * b7; - t12 += v * b8; - t13 += v * b9; - t14 += v * b10; - t15 += v * b11; - t16 += v * b12; - t17 += v * b13; - t18 += v * b14; - t19 += v * b15; - v = a[5]; - t5 += v * b0; - t6 += v * b1; - t7 += v * b2; - t8 += v * b3; - t9 += v * b4; - t10 += v * b5; - t11 += v * b6; - t12 += v * b7; - t13 += v * b8; - t14 += v * b9; - t15 += v * b10; - t16 += v * b11; - t17 += v * b12; - t18 += v * b13; - t19 += v * b14; - t20 += v * b15; - v = a[6]; - t6 += v * b0; - t7 += v * b1; - t8 += v * b2; - t9 += v * b3; - t10 += v * b4; - t11 += v * b5; - t12 += v * b6; - t13 += v * b7; - t14 += v * b8; - t15 += v * b9; - t16 += v * b10; - t17 += v * b11; - t18 += v * b12; - t19 += v * b13; - t20 += v * b14; - t21 += v * b15; - v = a[7]; - t7 += v * b0; - t8 += v * b1; - t9 += v * b2; - t10 += v * b3; - t11 += v * b4; - t12 += v * b5; - t13 += v * b6; - t14 += v * b7; - t15 += v * b8; - t16 += v * b9; - t17 += v * b10; - t18 += v * b11; - t19 += v * b12; - t20 += v * b13; - t21 += v * b14; - t22 += v * b15; - v = a[8]; - t8 += v * b0; - t9 += v * b1; - t10 += v * b2; - t11 += v * b3; - t12 += v * b4; - t13 += v * b5; - t14 += v * b6; - t15 += v * b7; - t16 += v * b8; - t17 += v * b9; - t18 += v * b10; - t19 += v * b11; - t20 += v * b12; - t21 += v * b13; - t22 += v * b14; - t23 += v * b15; - v = a[9]; - t9 += v * b0; - t10 += v * b1; - t11 += v * b2; - t12 += v * b3; - t13 += v * b4; - t14 += v * b5; - t15 += v * b6; - t16 += v * b7; - t17 += v * b8; - t18 += v * b9; - t19 += v * b10; - t20 += v * b11; - t21 += v * b12; - t22 += v * b13; - t23 += v * b14; - t24 += v * b15; - v = a[10]; - t10 += v * b0; - t11 += v * b1; - t12 += v * b2; - t13 += v * b3; - t14 += v * b4; - t15 += v * b5; - t16 += v * b6; - t17 += v * b7; - t18 += v * b8; - t19 += v * b9; - t20 += v * b10; - t21 += v * b11; - t22 += v * b12; - t23 += v * b13; - t24 += v * b14; - t25 += v * b15; - v = a[11]; - t11 += v * b0; - t12 += v * b1; - t13 += v * b2; - t14 += v * b3; - t15 += v * b4; - t16 += v * b5; - t17 += v * b6; - t18 += v * b7; - t19 += v * b8; - t20 += v * b9; - t21 += v * b10; - t22 += v * b11; - t23 += v * b12; - t24 += v * b13; - t25 += v * b14; - t26 += v * b15; - v = a[12]; - t12 += v * b0; - t13 += v * b1; - t14 += v * b2; - t15 += v * b3; - t16 += v * b4; - t17 += v * b5; - t18 += v * b6; - t19 += v * b7; - t20 += v * b8; - t21 += v * b9; - t22 += v * b10; - t23 += v * b11; - t24 += v * b12; - t25 += v * b13; - t26 += v * b14; - t27 += v * b15; - v = a[13]; - t13 += v * b0; - t14 += v * b1; - t15 += v * b2; - t16 += v * b3; - t17 += v * b4; - t18 += v * b5; - t19 += v * b6; - t20 += v * b7; - t21 += v * b8; - t22 += v * b9; - t23 += v * b10; - t24 += v * b11; - t25 += v * b12; - t26 += v * b13; - t27 += v * b14; - t28 += v * b15; - v = a[14]; - t14 += v * b0; - t15 += v * b1; - t16 += v * b2; - t17 += v * b3; - t18 += v * b4; - t19 += v * b5; - t20 += v * b6; - t21 += v * b7; - t22 += v * b8; - t23 += v * b9; - t24 += v * b10; - t25 += v * b11; - t26 += v * b12; - t27 += v * b13; - t28 += v * b14; - t29 += v * b15; - v = a[15]; - t15 += v * b0; - t16 += v * b1; - t17 += v * b2; - t18 += v * b3; - t19 += v * b4; - t20 += v * b5; - t21 += v * b6; - t22 += v * b7; - t23 += v * b8; - t24 += v * b9; - t25 += v * b10; - t26 += v * b11; - t27 += v * b12; - t28 += v * b13; - t29 += v * b14; - t30 += v * b15; - - t0 += 38 * t16; - t1 += 38 * t17; - t2 += 38 * t18; - t3 += 38 * t19; - t4 += 38 * t20; - t5 += 38 * t21; - t6 += 38 * t22; - t7 += 38 * t23; - t8 += 38 * t24; - t9 += 38 * t25; - t10 += 38 * t26; - t11 += 38 * t27; - t12 += 38 * t28; - t13 += 38 * t29; - t14 += 38 * t30; - // t15 left as is - - // first car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - // second car - c = 1; - v = t0 + c + 65535; c = Math.floor(v / 65536); t0 = v - c * 65536; - v = t1 + c + 65535; c = Math.floor(v / 65536); t1 = v - c * 65536; - v = t2 + c + 65535; c = Math.floor(v / 65536); t2 = v - c * 65536; - v = t3 + c + 65535; c = Math.floor(v / 65536); t3 = v - c * 65536; - v = t4 + c + 65535; c = Math.floor(v / 65536); t4 = v - c * 65536; - v = t5 + c + 65535; c = Math.floor(v / 65536); t5 = v - c * 65536; - v = t6 + c + 65535; c = Math.floor(v / 65536); t6 = v - c * 65536; - v = t7 + c + 65535; c = Math.floor(v / 65536); t7 = v - c * 65536; - v = t8 + c + 65535; c = Math.floor(v / 65536); t8 = v - c * 65536; - v = t9 + c + 65535; c = Math.floor(v / 65536); t9 = v - c * 65536; - v = t10 + c + 65535; c = Math.floor(v / 65536); t10 = v - c * 65536; - v = t11 + c + 65535; c = Math.floor(v / 65536); t11 = v - c * 65536; - v = t12 + c + 65535; c = Math.floor(v / 65536); t12 = v - c * 65536; - v = t13 + c + 65535; c = Math.floor(v / 65536); t13 = v - c * 65536; - v = t14 + c + 65535; c = Math.floor(v / 65536); t14 = v - c * 65536; - v = t15 + c + 65535; c = Math.floor(v / 65536); t15 = v - c * 65536; - t0 += c-1 + 37 * (c-1); - - o[ 0] = t0; - o[ 1] = t1; - o[ 2] = t2; - o[ 3] = t3; - o[ 4] = t4; - o[ 5] = t5; - o[ 6] = t6; - o[ 7] = t7; - o[ 8] = t8; - o[ 9] = t9; - o[10] = t10; - o[11] = t11; - o[12] = t12; - o[13] = t13; - o[14] = t14; - o[15] = t15; -} - -function S(o, a) { - M(o, a, a); -} - -function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; - } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); - } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; -} - -function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); -} - -function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); -} - -function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); -} - -var crypto_box_afternm = crypto_secretbox; -var crypto_box_open_afternm = crypto_secretbox_open; - -function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); -} - -function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); -} - -var K = [ - 0x428a2f98, 0xd728ae22, 0x71374491, 0x23ef65cd, - 0xb5c0fbcf, 0xec4d3b2f, 0xe9b5dba5, 0x8189dbbc, - 0x3956c25b, 0xf348b538, 0x59f111f1, 0xb605d019, - 0x923f82a4, 0xaf194f9b, 0xab1c5ed5, 0xda6d8118, - 0xd807aa98, 0xa3030242, 0x12835b01, 0x45706fbe, - 0x243185be, 0x4ee4b28c, 0x550c7dc3, 0xd5ffb4e2, - 0x72be5d74, 0xf27b896f, 0x80deb1fe, 0x3b1696b1, - 0x9bdc06a7, 0x25c71235, 0xc19bf174, 0xcf692694, - 0xe49b69c1, 0x9ef14ad2, 0xefbe4786, 0x384f25e3, - 0x0fc19dc6, 0x8b8cd5b5, 0x240ca1cc, 0x77ac9c65, - 0x2de92c6f, 0x592b0275, 0x4a7484aa, 0x6ea6e483, - 0x5cb0a9dc, 0xbd41fbd4, 0x76f988da, 0x831153b5, - 0x983e5152, 0xee66dfab, 0xa831c66d, 0x2db43210, - 0xb00327c8, 0x98fb213f, 0xbf597fc7, 0xbeef0ee4, - 0xc6e00bf3, 0x3da88fc2, 0xd5a79147, 0x930aa725, - 0x06ca6351, 0xe003826f, 0x14292967, 0x0a0e6e70, - 0x27b70a85, 0x46d22ffc, 0x2e1b2138, 0x5c26c926, - 0x4d2c6dfc, 0x5ac42aed, 0x53380d13, 0x9d95b3df, - 0x650a7354, 0x8baf63de, 0x766a0abb, 0x3c77b2a8, - 0x81c2c92e, 0x47edaee6, 0x92722c85, 0x1482353b, - 0xa2bfe8a1, 0x4cf10364, 0xa81a664b, 0xbc423001, - 0xc24b8b70, 0xd0f89791, 0xc76c51a3, 0x0654be30, - 0xd192e819, 0xd6ef5218, 0xd6990624, 0x5565a910, - 0xf40e3585, 0x5771202a, 0x106aa070, 0x32bbd1b8, - 0x19a4c116, 0xb8d2d0c8, 0x1e376c08, 0x5141ab53, - 0x2748774c, 0xdf8eeb99, 0x34b0bcb5, 0xe19b48a8, - 0x391c0cb3, 0xc5c95a63, 0x4ed8aa4a, 0xe3418acb, - 0x5b9cca4f, 0x7763e373, 0x682e6ff3, 0xd6b2b8a3, - 0x748f82ee, 0x5defb2fc, 0x78a5636f, 0x43172f60, - 0x84c87814, 0xa1f0ab72, 0x8cc70208, 0x1a6439ec, - 0x90befffa, 0x23631e28, 0xa4506ceb, 0xde82bde9, - 0xbef9a3f7, 0xb2c67915, 0xc67178f2, 0xe372532b, - 0xca273ece, 0xea26619c, 0xd186b8c7, 0x21c0c207, - 0xeada7dd6, 0xcde0eb1e, 0xf57d4f7f, 0xee6ed178, - 0x06f067aa, 0x72176fba, 0x0a637dc5, 0xa2c898a6, - 0x113f9804, 0xbef90dae, 0x1b710b35, 0x131c471b, - 0x28db77f5, 0x23047d84, 0x32caab7b, 0x40c72493, - 0x3c9ebe0a, 0x15c9bebc, 0x431d67c4, 0x9c100d4c, - 0x4cc5d4be, 0xcb3e42b6, 0x597f299c, 0xfc657e2a, - 0x5fcb6fab, 0x3ad6faec, 0x6c44198c, 0x4a475817 -]; - -function crypto_hashblocks_hl(hh, hl, m, n) { - var wh = new Int32Array(16), wl = new Int32Array(16), - bh0, bh1, bh2, bh3, bh4, bh5, bh6, bh7, - bl0, bl1, bl2, bl3, bl4, bl5, bl6, bl7, - th, tl, i, j, h, l, a, b, c, d; - - var ah0 = hh[0], - ah1 = hh[1], - ah2 = hh[2], - ah3 = hh[3], - ah4 = hh[4], - ah5 = hh[5], - ah6 = hh[6], - ah7 = hh[7], - - al0 = hl[0], - al1 = hl[1], - al2 = hl[2], - al3 = hl[3], - al4 = hl[4], - al5 = hl[5], - al6 = hl[6], - al7 = hl[7]; - - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) { - j = 8 * i + pos; - wh[i] = (m[j+0] << 24) | (m[j+1] << 16) | (m[j+2] << 8) | m[j+3]; - wl[i] = (m[j+4] << 24) | (m[j+5] << 16) | (m[j+6] << 8) | m[j+7]; - } - for (i = 0; i < 80; i++) { - bh0 = ah0; - bh1 = ah1; - bh2 = ah2; - bh3 = ah3; - bh4 = ah4; - bh5 = ah5; - bh6 = ah6; - bh7 = ah7; - - bl0 = al0; - bl1 = al1; - bl2 = al2; - bl3 = al3; - bl4 = al4; - bl5 = al5; - bl6 = al6; - bl7 = al7; - - // add - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma1 - h = ((ah4 >>> 14) | (al4 << (32-14))) ^ ((ah4 >>> 18) | (al4 << (32-18))) ^ ((al4 >>> (41-32)) | (ah4 << (32-(41-32)))); - l = ((al4 >>> 14) | (ah4 << (32-14))) ^ ((al4 >>> 18) | (ah4 << (32-18))) ^ ((ah4 >>> (41-32)) | (al4 << (32-(41-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Ch - h = (ah4 & ah5) ^ (~ah4 & ah6); - l = (al4 & al5) ^ (~al4 & al6); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // K - h = K[i*2]; - l = K[i*2+1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // w - h = wh[i%16]; - l = wl[i%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - th = c & 0xffff | d << 16; - tl = a & 0xffff | b << 16; - - // add - h = th; - l = tl; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - // Sigma0 - h = ((ah0 >>> 28) | (al0 << (32-28))) ^ ((al0 >>> (34-32)) | (ah0 << (32-(34-32)))) ^ ((al0 >>> (39-32)) | (ah0 << (32-(39-32)))); - l = ((al0 >>> 28) | (ah0 << (32-28))) ^ ((ah0 >>> (34-32)) | (al0 << (32-(34-32)))) ^ ((ah0 >>> (39-32)) | (al0 << (32-(39-32)))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // Maj - h = (ah0 & ah1) ^ (ah0 & ah2) ^ (ah1 & ah2); - l = (al0 & al1) ^ (al0 & al2) ^ (al1 & al2); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh7 = (c & 0xffff) | (d << 16); - bl7 = (a & 0xffff) | (b << 16); - - // add - h = bh3; - l = bl3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = th; - l = tl; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - bh3 = (c & 0xffff) | (d << 16); - bl3 = (a & 0xffff) | (b << 16); - - ah1 = bh0; - ah2 = bh1; - ah3 = bh2; - ah4 = bh3; - ah5 = bh4; - ah6 = bh5; - ah7 = bh6; - ah0 = bh7; - - al1 = bl0; - al2 = bl1; - al3 = bl2; - al4 = bl3; - al5 = bl4; - al6 = bl5; - al7 = bl6; - al0 = bl7; - - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - // add - h = wh[j]; - l = wl[j]; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = wh[(j+9)%16]; - l = wl[(j+9)%16]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma0 - th = wh[(j+1)%16]; - tl = wl[(j+1)%16]; - h = ((th >>> 1) | (tl << (32-1))) ^ ((th >>> 8) | (tl << (32-8))) ^ (th >>> 7); - l = ((tl >>> 1) | (th << (32-1))) ^ ((tl >>> 8) | (th << (32-8))) ^ ((tl >>> 7) | (th << (32-7))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - // sigma1 - th = wh[(j+14)%16]; - tl = wl[(j+14)%16]; - h = ((th >>> 19) | (tl << (32-19))) ^ ((tl >>> (61-32)) | (th << (32-(61-32)))) ^ (th >>> 6); - l = ((tl >>> 19) | (th << (32-19))) ^ ((th >>> (61-32)) | (tl << (32-(61-32)))) ^ ((tl >>> 6) | (th << (32-6))); - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - wh[j] = (c & 0xffff) | (d << 16); - wl[j] = (a & 0xffff) | (b << 16); - } - } - } - - // add - h = ah0; - l = al0; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[0]; - l = hl[0]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[0] = ah0 = (c & 0xffff) | (d << 16); - hl[0] = al0 = (a & 0xffff) | (b << 16); - - h = ah1; - l = al1; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[1]; - l = hl[1]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[1] = ah1 = (c & 0xffff) | (d << 16); - hl[1] = al1 = (a & 0xffff) | (b << 16); - - h = ah2; - l = al2; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[2]; - l = hl[2]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[2] = ah2 = (c & 0xffff) | (d << 16); - hl[2] = al2 = (a & 0xffff) | (b << 16); - - h = ah3; - l = al3; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[3]; - l = hl[3]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[3] = ah3 = (c & 0xffff) | (d << 16); - hl[3] = al3 = (a & 0xffff) | (b << 16); - - h = ah4; - l = al4; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[4]; - l = hl[4]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[4] = ah4 = (c & 0xffff) | (d << 16); - hl[4] = al4 = (a & 0xffff) | (b << 16); - - h = ah5; - l = al5; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[5]; - l = hl[5]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[5] = ah5 = (c & 0xffff) | (d << 16); - hl[5] = al5 = (a & 0xffff) | (b << 16); - - h = ah6; - l = al6; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[6]; - l = hl[6]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[6] = ah6 = (c & 0xffff) | (d << 16); - hl[6] = al6 = (a & 0xffff) | (b << 16); - - h = ah7; - l = al7; - - a = l & 0xffff; b = l >>> 16; - c = h & 0xffff; d = h >>> 16; - - h = hh[7]; - l = hl[7]; - - a += l & 0xffff; b += l >>> 16; - c += h & 0xffff; d += h >>> 16; - - b += a >>> 16; - c += b >>> 16; - d += c >>> 16; - - hh[7] = ah7 = (c & 0xffff) | (d << 16); - hl[7] = al7 = (a & 0xffff) | (b << 16); - - pos += 128; - n -= 128; - } - - return n; -} - -function crypto_hash(out, m, n) { - var hh = new Int32Array(8), - hl = new Int32Array(8), - x = new Uint8Array(256), - i, b = n; - - hh[0] = 0x6a09e667; - hh[1] = 0xbb67ae85; - hh[2] = 0x3c6ef372; - hh[3] = 0xa54ff53a; - hh[4] = 0x510e527f; - hh[5] = 0x9b05688c; - hh[6] = 0x1f83d9ab; - hh[7] = 0x5be0cd19; - - hl[0] = 0xf3bcc908; - hl[1] = 0x84caa73b; - hl[2] = 0xfe94f82b; - hl[3] = 0x5f1d36f1; - hl[4] = 0xade682d1; - hl[5] = 0x2b3e6c1f; - hl[6] = 0xfb41bd6b; - hl[7] = 0x137e2179; - - crypto_hashblocks_hl(hh, hl, m, n); - n %= 128; - - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; - - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, (b / 0x20000000) | 0, b << 3); - crypto_hashblocks_hl(hh, hl, x, n); - - for (i = 0; i < 8; i++) ts64(out, 8*i, hh[i], hl[i]); - - return 0; -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; -} - -var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); - -function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; - - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; - - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); - - M(r[3], r[0], r[1]); - return 0; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if (n < 64) return -1; - - if (unpackneg(q, pk)) return -1; - - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } - - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; -} - -var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; - -nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, - - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES -}; - -/* High-level API */ - -function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); -} - -function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); -} - -function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } -} - -function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; -} - -// TODO: Completely remove this in v0.15. -if (!nacl.util) { - nacl.util = {}; - nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { - throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); - }; -} - -nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; -}; - -nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); -}; - -nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); -}; - -nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; -nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; -nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - -nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; -}; - -nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; -}; - -nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; -nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - -nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); -}; - -nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; -}; - -nacl.box.after = nacl.secretbox; - -nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); -}; - -nacl.box.open.after = nacl.secretbox.open; - -nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; -nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; -nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; -nacl.box.nonceLength = crypto_box_NONCEBYTES; -nacl.box.overheadLength = nacl.secretbox.overheadLength; - -nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; -}; - -nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; -}; - -nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; -}; - -nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; -nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; -nacl.sign.seedLength = crypto_sign_SEEDBYTES; -nacl.sign.signatureLength = crypto_sign_BYTES; - -nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; -}; - -nacl.hash.hashLength = crypto_hash_BYTES; - -nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; -}; - -nacl.setPRNG = function(fn) { - randombytes = fn; -}; - -(function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; - if (crypto && crypto.getRandomValues) { - // Browsers. - var QUOTA = 65536; - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - for (i = 0; i < n; i += QUOTA) { - crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); - } - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } else if (typeof require !== 'undefined') { - // Node.js. - crypto = require('crypto'); - if (crypto && crypto.randomBytes) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } -})(); - -})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); diff --git a/reverse_engineering/node_modules/tweetnacl/nacl-fast.min.js b/reverse_engineering/node_modules/tweetnacl/nacl-fast.min.js deleted file mode 100644 index 8bc47daa..00000000 --- a/reverse_engineering/node_modules/tweetnacl/nacl-fast.min.js +++ /dev/null @@ -1,2 +0,0 @@ -!function(r){"use strict";function t(r,t,n,e){r[t]=n>>24&255,r[t+1]=n>>16&255,r[t+2]=n>>8&255,r[t+3]=255&n,r[t+4]=e>>24&255,r[t+5]=e>>16&255,r[t+6]=e>>8&255,r[t+7]=255&e}function n(r,t,n,e,o){var i,h=0;for(i=0;i>>8)-1}function e(r,t,e,o){return n(r,t,e,o,16)}function o(r,t,e,o){return n(r,t,e,o,32)}function i(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,_=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,d=i,U=h,E=a,x=f,M=s,m=c,B=u,S=y,K=l,T=w,Y=p,k=v,L=b,z=g,R=_,P=A,O=0;O<20;O+=2)o=d+L|0,M^=o<<7|o>>>25,o=M+d|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,d^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,z^=o<<9|o>>>23,o=z+T|0,U^=o<<13|o>>>19,o=U+z|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=P+k|0,x^=o<<7|o>>>25,o=x+P|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,P^=o<<18|o>>>14,o=d+x|0,U^=o<<7|o>>>25,o=U+d|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,d^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=P+R|0,L^=o<<7|o>>>25,o=L+P|0,z^=o<<9|o>>>23,o=z+L|0,R^=o<<13|o>>>19,o=R+z|0,P^=o<<18|o>>>14;d=d+i|0,U=U+h|0,E=E+a|0,x=x+f|0,M=M+s|0,m=m+c|0,B=B+u|0,S=S+y|0,K=K+l|0,T=T+w|0,Y=Y+p|0,k=k+v|0,L=L+b|0,z=z+g|0,R=R+_|0,P=P+A|0,r[0]=d>>>0&255,r[1]=d>>>8&255,r[2]=d>>>16&255,r[3]=d>>>24&255,r[4]=U>>>0&255,r[5]=U>>>8&255,r[6]=U>>>16&255,r[7]=U>>>24&255,r[8]=E>>>0&255,r[9]=E>>>8&255,r[10]=E>>>16&255,r[11]=E>>>24&255,r[12]=x>>>0&255,r[13]=x>>>8&255,r[14]=x>>>16&255,r[15]=x>>>24&255,r[16]=M>>>0&255,r[17]=M>>>8&255,r[18]=M>>>16&255,r[19]=M>>>24&255,r[20]=m>>>0&255,r[21]=m>>>8&255,r[22]=m>>>16&255,r[23]=m>>>24&255,r[24]=B>>>0&255,r[25]=B>>>8&255,r[26]=B>>>16&255,r[27]=B>>>24&255,r[28]=S>>>0&255,r[29]=S>>>8&255,r[30]=S>>>16&255,r[31]=S>>>24&255,r[32]=K>>>0&255,r[33]=K>>>8&255,r[34]=K>>>16&255,r[35]=K>>>24&255,r[36]=T>>>0&255,r[37]=T>>>8&255,r[38]=T>>>16&255,r[39]=T>>>24&255,r[40]=Y>>>0&255,r[41]=Y>>>8&255,r[42]=Y>>>16&255,r[43]=Y>>>24&255,r[44]=k>>>0&255,r[45]=k>>>8&255,r[46]=k>>>16&255,r[47]=k>>>24&255,r[48]=L>>>0&255,r[49]=L>>>8&255,r[50]=L>>>16&255,r[51]=L>>>24&255,r[52]=z>>>0&255,r[53]=z>>>8&255,r[54]=z>>>16&255,r[55]=z>>>24&255,r[56]=R>>>0&255,r[57]=R>>>8&255,r[58]=R>>>16&255,r[59]=R>>>24&255,r[60]=P>>>0&255,r[61]=P>>>8&255,r[62]=P>>>16&255,r[63]=P>>>24&255}function h(r,t,n,e){for(var o,i=255&e[0]|(255&e[1])<<8|(255&e[2])<<16|(255&e[3])<<24,h=255&n[0]|(255&n[1])<<8|(255&n[2])<<16|(255&n[3])<<24,a=255&n[4]|(255&n[5])<<8|(255&n[6])<<16|(255&n[7])<<24,f=255&n[8]|(255&n[9])<<8|(255&n[10])<<16|(255&n[11])<<24,s=255&n[12]|(255&n[13])<<8|(255&n[14])<<16|(255&n[15])<<24,c=255&e[4]|(255&e[5])<<8|(255&e[6])<<16|(255&e[7])<<24,u=255&t[0]|(255&t[1])<<8|(255&t[2])<<16|(255&t[3])<<24,y=255&t[4]|(255&t[5])<<8|(255&t[6])<<16|(255&t[7])<<24,l=255&t[8]|(255&t[9])<<8|(255&t[10])<<16|(255&t[11])<<24,w=255&t[12]|(255&t[13])<<8|(255&t[14])<<16|(255&t[15])<<24,p=255&e[8]|(255&e[9])<<8|(255&e[10])<<16|(255&e[11])<<24,v=255&n[16]|(255&n[17])<<8|(255&n[18])<<16|(255&n[19])<<24,b=255&n[20]|(255&n[21])<<8|(255&n[22])<<16|(255&n[23])<<24,g=255&n[24]|(255&n[25])<<8|(255&n[26])<<16|(255&n[27])<<24,_=255&n[28]|(255&n[29])<<8|(255&n[30])<<16|(255&n[31])<<24,A=255&e[12]|(255&e[13])<<8|(255&e[14])<<16|(255&e[15])<<24,d=i,U=h,E=a,x=f,M=s,m=c,B=u,S=y,K=l,T=w,Y=p,k=v,L=b,z=g,R=_,P=A,O=0;O<20;O+=2)o=d+L|0,M^=o<<7|o>>>25,o=M+d|0,K^=o<<9|o>>>23,o=K+M|0,L^=o<<13|o>>>19,o=L+K|0,d^=o<<18|o>>>14,o=m+U|0,T^=o<<7|o>>>25,o=T+m|0,z^=o<<9|o>>>23,o=z+T|0,U^=o<<13|o>>>19,o=U+z|0,m^=o<<18|o>>>14,o=Y+B|0,R^=o<<7|o>>>25,o=R+Y|0,E^=o<<9|o>>>23,o=E+R|0,B^=o<<13|o>>>19,o=B+E|0,Y^=o<<18|o>>>14,o=P+k|0,x^=o<<7|o>>>25,o=x+P|0,S^=o<<9|o>>>23,o=S+x|0,k^=o<<13|o>>>19,o=k+S|0,P^=o<<18|o>>>14,o=d+x|0,U^=o<<7|o>>>25,o=U+d|0,E^=o<<9|o>>>23,o=E+U|0,x^=o<<13|o>>>19,o=x+E|0,d^=o<<18|o>>>14,o=m+M|0,B^=o<<7|o>>>25,o=B+m|0,S^=o<<9|o>>>23,o=S+B|0,M^=o<<13|o>>>19,o=M+S|0,m^=o<<18|o>>>14,o=Y+T|0,k^=o<<7|o>>>25,o=k+Y|0,K^=o<<9|o>>>23,o=K+k|0,T^=o<<13|o>>>19,o=T+K|0,Y^=o<<18|o>>>14,o=P+R|0,L^=o<<7|o>>>25,o=L+P|0,z^=o<<9|o>>>23,o=z+L|0,R^=o<<13|o>>>19,o=R+z|0,P^=o<<18|o>>>14;r[0]=d>>>0&255,r[1]=d>>>8&255,r[2]=d>>>16&255,r[3]=d>>>24&255,r[4]=m>>>0&255,r[5]=m>>>8&255,r[6]=m>>>16&255,r[7]=m>>>24&255,r[8]=Y>>>0&255,r[9]=Y>>>8&255,r[10]=Y>>>16&255,r[11]=Y>>>24&255,r[12]=P>>>0&255,r[13]=P>>>8&255,r[14]=P>>>16&255,r[15]=P>>>24&255,r[16]=B>>>0&255,r[17]=B>>>8&255,r[18]=B>>>16&255,r[19]=B>>>24&255,r[20]=S>>>0&255,r[21]=S>>>8&255,r[22]=S>>>16&255,r[23]=S>>>24&255,r[24]=K>>>0&255,r[25]=K>>>8&255,r[26]=K>>>16&255,r[27]=K>>>24&255,r[28]=T>>>0&255,r[29]=T>>>8&255,r[30]=T>>>16&255,r[31]=T>>>24&255}function a(r,t,n,e){i(r,t,n,e)}function f(r,t,n,e){h(r,t,n,e)}function s(r,t,n,e,o,i,h){var f,s,c=new Uint8Array(16),u=new Uint8Array(64);for(s=0;s<16;s++)c[s]=0;for(s=0;s<8;s++)c[s]=i[s];for(;o>=64;){for(a(u,c,h,ur),s=0;s<64;s++)r[t+s]=n[e+s]^u[s];for(f=1,s=8;s<16;s++)f=f+(255&c[s])|0,c[s]=255&f,f>>>=8;o-=64,t+=64,e+=64}if(o>0)for(a(u,c,h,ur),s=0;s=64;){for(a(s,f,o,ur),h=0;h<64;h++)r[t+h]=s[h];for(i=1,h=8;h<16;h++)i=i+(255&f[h])|0,f[h]=255&i,i>>>=8;n-=64,t+=64}if(n>0)for(a(s,f,o,ur),h=0;h>16&1),i[n-1]&=65535;i[15]=h[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,_(h,i,1-o)}for(n=0;n<16;n++)r[2*n]=255&h[n],r[2*n+1]=h[n]>>8}function d(r,t){var n=new Uint8Array(32),e=new Uint8Array(32);return A(n,r),A(e,t),o(n,0,e,0)}function U(r){var t=new Uint8Array(32);return A(t,r),1&t[0]}function E(r,t){var n;for(n=0;n<16;n++)r[n]=t[2*n]+(t[2*n+1]<<8);r[15]&=32767}function x(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]+n[e]}function M(r,t,n){for(var e=0;e<16;e++)r[e]=t[e]-n[e]}function m(r,t,n){var e,o,i=0,h=0,a=0,f=0,s=0,c=0,u=0,y=0,l=0,w=0,p=0,v=0,b=0,g=0,_=0,A=0,d=0,U=0,E=0,x=0,M=0,m=0,B=0,S=0,K=0,T=0,Y=0,k=0,L=0,z=0,R=0,P=n[0],O=n[1],N=n[2],C=n[3],F=n[4],I=n[5],G=n[6],Z=n[7],j=n[8],q=n[9],V=n[10],X=n[11],D=n[12],H=n[13],J=n[14],Q=n[15];e=t[0],i+=e*P,h+=e*O,a+=e*N,f+=e*C,s+=e*F,c+=e*I,u+=e*G,y+=e*Z,l+=e*j,w+=e*q,p+=e*V,v+=e*X,b+=e*D,g+=e*H,_+=e*J,A+=e*Q,e=t[1],h+=e*P,a+=e*O,f+=e*N,s+=e*C,c+=e*F,u+=e*I,y+=e*G,l+=e*Z,w+=e*j,p+=e*q,v+=e*V,b+=e*X,g+=e*D,_+=e*H,A+=e*J,d+=e*Q,e=t[2],a+=e*P,f+=e*O,s+=e*N,c+=e*C,u+=e*F,y+=e*I,l+=e*G,w+=e*Z,p+=e*j,v+=e*q,b+=e*V,g+=e*X,_+=e*D,A+=e*H,d+=e*J,U+=e*Q,e=t[3],f+=e*P,s+=e*O,c+=e*N,u+=e*C,y+=e*F,l+=e*I,w+=e*G,p+=e*Z,v+=e*j,b+=e*q,g+=e*V,_+=e*X,A+=e*D,d+=e*H,U+=e*J,E+=e*Q,e=t[4],s+=e*P,c+=e*O,u+=e*N,y+=e*C,l+=e*F,w+=e*I,p+=e*G,v+=e*Z,b+=e*j,g+=e*q,_+=e*V,A+=e*X,d+=e*D,U+=e*H,E+=e*J,x+=e*Q,e=t[5],c+=e*P,u+=e*O,y+=e*N,l+=e*C,w+=e*F,p+=e*I,v+=e*G,b+=e*Z,g+=e*j,_+=e*q,A+=e*V,d+=e*X,U+=e*D,E+=e*H,x+=e*J,M+=e*Q,e=t[6],u+=e*P,y+=e*O,l+=e*N,w+=e*C,p+=e*F,v+=e*I,b+=e*G,g+=e*Z,_+=e*j,A+=e*q,d+=e*V,U+=e*X,E+=e*D,x+=e*H,M+=e*J,m+=e*Q,e=t[7],y+=e*P,l+=e*O,w+=e*N,p+=e*C,v+=e*F,b+=e*I,g+=e*G,_+=e*Z,A+=e*j,d+=e*q,U+=e*V,E+=e*X,x+=e*D,M+=e*H,m+=e*J,B+=e*Q,e=t[8],l+=e*P,w+=e*O,p+=e*N,v+=e*C,b+=e*F,g+=e*I,_+=e*G,A+=e*Z,d+=e*j,U+=e*q,E+=e*V,x+=e*X,M+=e*D,m+=e*H,B+=e*J,S+=e*Q,e=t[9],w+=e*P,p+=e*O,v+=e*N,b+=e*C,g+=e*F,_+=e*I,A+=e*G,d+=e*Z,U+=e*j,E+=e*q,x+=e*V,M+=e*X,m+=e*D,B+=e*H,S+=e*J,K+=e*Q,e=t[10],p+=e*P,v+=e*O,b+=e*N,g+=e*C,_+=e*F,A+=e*I,d+=e*G,U+=e*Z,E+=e*j,x+=e*q,M+=e*V,m+=e*X,B+=e*D,S+=e*H,K+=e*J,T+=e*Q,e=t[11],v+=e*P,b+=e*O,g+=e*N,_+=e*C,A+=e*F,d+=e*I,U+=e*G,E+=e*Z,x+=e*j,M+=e*q,m+=e*V,B+=e*X;S+=e*D;K+=e*H,T+=e*J,Y+=e*Q,e=t[12],b+=e*P,g+=e*O,_+=e*N,A+=e*C,d+=e*F,U+=e*I,E+=e*G,x+=e*Z,M+=e*j,m+=e*q,B+=e*V,S+=e*X,K+=e*D,T+=e*H,Y+=e*J,k+=e*Q,e=t[13],g+=e*P,_+=e*O,A+=e*N,d+=e*C,U+=e*F,E+=e*I,x+=e*G,M+=e*Z,m+=e*j,B+=e*q,S+=e*V,K+=e*X,T+=e*D,Y+=e*H,k+=e*J,L+=e*Q,e=t[14],_+=e*P,A+=e*O,d+=e*N,U+=e*C,E+=e*F,x+=e*I,M+=e*G,m+=e*Z,B+=e*j,S+=e*q,K+=e*V,T+=e*X,Y+=e*D,k+=e*H,L+=e*J,z+=e*Q,e=t[15],A+=e*P,d+=e*O,U+=e*N,E+=e*C,x+=e*F,M+=e*I,m+=e*G,B+=e*Z,S+=e*j,K+=e*q,T+=e*V,Y+=e*X,k+=e*D,L+=e*H,z+=e*J,R+=e*Q,i+=38*d,h+=38*U,a+=38*E,f+=38*x,s+=38*M,c+=38*m,u+=38*B,y+=38*S,l+=38*K,w+=38*T,p+=38*Y,v+=38*k,b+=38*L,g+=38*z,_+=38*R,o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=_+o+65535,o=Math.floor(e/65536),_=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),o=1,e=i+o+65535,o=Math.floor(e/65536),i=e-65536*o,e=h+o+65535,o=Math.floor(e/65536),h=e-65536*o,e=a+o+65535,o=Math.floor(e/65536),a=e-65536*o,e=f+o+65535,o=Math.floor(e/65536),f=e-65536*o,e=s+o+65535,o=Math.floor(e/65536),s=e-65536*o,e=c+o+65535,o=Math.floor(e/65536),c=e-65536*o,e=u+o+65535,o=Math.floor(e/65536),u=e-65536*o,e=y+o+65535,o=Math.floor(e/65536),y=e-65536*o,e=l+o+65535,o=Math.floor(e/65536),l=e-65536*o,e=w+o+65535,o=Math.floor(e/65536),w=e-65536*o,e=p+o+65535,o=Math.floor(e/65536),p=e-65536*o,e=v+o+65535,o=Math.floor(e/65536),v=e-65536*o,e=b+o+65535,o=Math.floor(e/65536),b=e-65536*o,e=g+o+65535,o=Math.floor(e/65536),g=e-65536*o,e=_+o+65535,o=Math.floor(e/65536),_=e-65536*o,e=A+o+65535,o=Math.floor(e/65536),A=e-65536*o,i+=o-1+37*(o-1),r[0]=i,r[1]=h,r[2]=a,r[3]=f,r[4]=s,r[5]=c,r[6]=u,r[7]=y,r[8]=l,r[9]=w,r[10]=p,r[11]=v,r[12]=b,r[13]=g;r[14]=_;r[15]=A}function B(r,t){m(r,t,t)}function S(r,t){var n,e=$();for(n=0;n<16;n++)e[n]=t[n];for(n=253;n>=0;n--)B(e,e),2!==n&&4!==n&&m(e,e,t);for(n=0;n<16;n++)r[n]=e[n]}function K(r,t){var n,e=$();for(n=0;n<16;n++)e[n]=t[n];for(n=250;n>=0;n--)B(e,e),1!==n&&m(e,e,t);for(n=0;n<16;n++)r[n]=e[n]}function T(r,t,n){var e,o,i=new Uint8Array(32),h=new Float64Array(80),a=$(),f=$(),s=$(),c=$(),u=$(),y=$();for(o=0;o<31;o++)i[o]=t[o];for(i[31]=127&t[31]|64,i[0]&=248,E(h,n),o=0;o<16;o++)f[o]=h[o],c[o]=a[o]=s[o]=0;for(a[0]=c[0]=1,o=254;o>=0;--o)e=i[o>>>3]>>>(7&o)&1,_(a,f,e),_(s,c,e),x(u,a,s),M(a,a,s),x(s,f,c),M(f,f,c),B(c,u),B(y,a),m(a,s,a),m(s,f,u),x(u,a,s),M(a,a,s),B(f,a),M(s,c,y),m(a,s,ir),x(a,a,c),m(s,s,a),m(a,c,y),m(c,f,h),B(f,u),_(a,f,e),_(s,c,e);for(o=0;o<16;o++)h[o+16]=a[o],h[o+32]=s[o],h[o+48]=f[o],h[o+64]=c[o];var l=h.subarray(32),w=h.subarray(16);return S(l,l),m(w,w,l),A(r,w),0}function Y(r,t){return T(r,t,nr)}function k(r,t){return rr(t,32),Y(r,t)}function L(r,t,n){var e=new Uint8Array(32);return T(e,n,t),f(r,tr,e,ur)}function z(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),lr(r,t,n,e,h)}function R(r,t,n,e,o,i){var h=new Uint8Array(32);return L(h,o,i),wr(r,t,n,e,h)}function P(r,t,n,e){for(var o,i,h,a,f,s,c,u,y,l,w,p,v,b,g,_,A,d,U,E,x,M,m,B,S,K,T=new Int32Array(16),Y=new Int32Array(16),k=r[0],L=r[1],z=r[2],R=r[3],P=r[4],O=r[5],N=r[6],C=r[7],F=t[0],I=t[1],G=t[2],Z=t[3],j=t[4],q=t[5],V=t[6],X=t[7],D=0;e>=128;){for(U=0;U<16;U++)E=8*U+D,T[U]=n[E+0]<<24|n[E+1]<<16|n[E+2]<<8|n[E+3],Y[U]=n[E+4]<<24|n[E+5]<<16|n[E+6]<<8|n[E+7];for(U=0;U<80;U++)if(o=k,i=L,h=z,a=R,f=P,s=O,c=N,u=C,y=F,l=I,w=G,p=Z,v=j,b=q,g=V,_=X,x=C,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(P>>>14|j<<18)^(P>>>18|j<<14)^(j>>>9|P<<23),M=(j>>>14|P<<18)^(j>>>18|P<<14)^(P>>>9|j<<23),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=P&O^~P&N,M=j&q^~j&V,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=pr[2*U],M=pr[2*U+1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=T[U%16],M=Y[U%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,A=65535&S|K<<16,d=65535&m|B<<16,x=A,M=d,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=(k>>>28|F<<4)^(F>>>2|k<<30)^(F>>>7|k<<25),M=(F>>>28|k<<4)^(k>>>2|F<<30)^(k>>>7|F<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,x=k&L^k&z^L&z,M=F&I^F&G^I&G,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,u=65535&S|K<<16,_=65535&m|B<<16,x=a,M=p,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=A,M=d,m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,a=65535&S|K<<16,p=65535&m|B<<16,L=o,z=i,R=h,P=a,O=f,N=s,C=c,k=u,I=y,G=l,Z=w,j=p,q=v,V=b,X=g,F=_,U%16===15)for(E=0;E<16;E++)x=T[E],M=Y[E],m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=T[(E+9)%16],M=Y[(E+9)%16],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+1)%16],d=Y[(E+1)%16],x=(A>>>1|d<<31)^(A>>>8|d<<24)^A>>>7,M=(d>>>1|A<<31)^(d>>>8|A<<24)^(d>>>7|A<<25),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,A=T[(E+14)%16],d=Y[(E+14)%16],x=(A>>>19|d<<13)^(d>>>29|A<<3)^A>>>6,M=(d>>>19|A<<13)^(A>>>29|d<<3)^(d>>>6|A<<26),m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,T[E]=65535&S|K<<16,Y[E]=65535&m|B<<16;x=k,M=F,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[0],M=t[0],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[0]=k=65535&S|K<<16,t[0]=F=65535&m|B<<16,x=L,M=I,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[1],M=t[1],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[1]=L=65535&S|K<<16,t[1]=I=65535&m|B<<16,x=z,M=G,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[2],M=t[2],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[2]=z=65535&S|K<<16,t[2]=G=65535&m|B<<16,x=R,M=Z,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[3],M=t[3],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[3]=R=65535&S|K<<16,t[3]=Z=65535&m|B<<16,x=P,M=j,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[4],M=t[4],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[4]=P=65535&S|K<<16,t[4]=j=65535&m|B<<16,x=O,M=q,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[5],M=t[5],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[5]=O=65535&S|K<<16,t[5]=q=65535&m|B<<16,x=N,M=V,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[6],M=t[6],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[6]=N=65535&S|K<<16,t[6]=V=65535&m|B<<16,x=C,M=X,m=65535&M,B=M>>>16,S=65535&x,K=x>>>16,x=r[7],M=t[7],m+=65535&M,B+=M>>>16,S+=65535&x,K+=x>>>16,B+=m>>>16,S+=B>>>16,K+=S>>>16,r[7]=C=65535&S|K<<16,t[7]=X=65535&m|B<<16,D+=128,e-=128}return e}function O(r,n,e){var o,i=new Int32Array(8),h=new Int32Array(8),a=new Uint8Array(256),f=e;for(i[0]=1779033703,i[1]=3144134277,i[2]=1013904242,i[3]=2773480762,i[4]=1359893119,i[5]=2600822924,i[6]=528734635,i[7]=1541459225,h[0]=4089235720,h[1]=2227873595,h[2]=4271175723,h[3]=1595750129,h[4]=2917565137,h[5]=725511199,h[6]=4215389547,h[7]=327033209,P(i,h,n,e),e%=128,o=0;o=0;--o)e=n[o/8|0]>>(7&o)&1,C(r,t,e),N(t,r),N(r,r),C(r,t,e)}function G(r,t){var n=[$(),$(),$(),$()];b(n[0],fr),b(n[1],sr),b(n[2],or),m(n[3],fr,sr),I(r,n,t)}function Z(r,t,n){var e,o=new Uint8Array(64),i=[$(),$(),$(),$()];for(n||rr(t,32),O(o,t,32),o[0]&=248,o[31]&=127,o[31]|=64,G(i,o),F(r,i),e=0;e<32;e++)t[e+32]=r[e];return 0}function j(r,t){var n,e,o,i;for(e=63;e>=32;--e){for(n=0,o=e-32,i=e-12;o>8,t[o]-=256*n;t[o]+=n,t[e]=0}for(n=0,o=0;o<32;o++)t[o]+=n-(t[31]>>4)*vr[o],n=t[o]>>8,t[o]&=255;for(o=0;o<32;o++)t[o]-=n*vr[o];for(e=0;e<32;e++)t[e+1]+=t[e]>>8,r[e]=255&t[e]}function q(r){var t,n=new Float64Array(64);for(t=0;t<64;t++)n[t]=r[t];for(t=0;t<64;t++)r[t]=0;j(r,n)}function V(r,t,n,e){var o,i,h=new Uint8Array(64),a=new Uint8Array(64),f=new Uint8Array(64),s=new Float64Array(64),c=[$(),$(),$(),$()];O(h,e,32),h[0]&=248,h[31]&=127,h[31]|=64;var u=n+64;for(o=0;o>7&&M(r[0],er,r[0]),m(r[3],r[0],r[1]),0)}function D(r,t,n,e){var i,h,a=new Uint8Array(32),f=new Uint8Array(64),s=[$(),$(),$(),$()],c=[$(),$(),$(),$()];if(h=-1,n<64)return-1;if(X(c,e))return-1;for(i=0;i>>13|n<<3),e=255&r[4]|(255&r[5])<<8,this.r[2]=7939&(n>>>10|e<<6),o=255&r[6]|(255&r[7])<<8,this.r[3]=8191&(e>>>7|o<<9),i=255&r[8]|(255&r[9])<<8,this.r[4]=255&(o>>>4|i<<12),this.r[5]=i>>>1&8190,h=255&r[10]|(255&r[11])<<8,this.r[6]=8191&(i>>>14|h<<2),a=255&r[12]|(255&r[13])<<8,this.r[7]=8065&(h>>>11|a<<5),f=255&r[14]|(255&r[15])<<8,this.r[8]=8191&(a>>>8|f<<8),this.r[9]=f>>>5&127,this.pad[0]=255&r[16]|(255&r[17])<<8,this.pad[1]=255&r[18]|(255&r[19])<<8,this.pad[2]=255&r[20]|(255&r[21])<<8,this.pad[3]=255&r[22]|(255&r[23])<<8,this.pad[4]=255&r[24]|(255&r[25])<<8,this.pad[5]=255&r[26]|(255&r[27])<<8,this.pad[6]=255&r[28]|(255&r[29])<<8,this.pad[7]=255&r[30]|(255&r[31])<<8};yr.prototype.blocks=function(r,t,n){for(var e,o,i,h,a,f,s,c,u,y,l,w,p,v,b,g,_,A,d,U=this.fin?0:2048,E=this.h[0],x=this.h[1],M=this.h[2],m=this.h[3],B=this.h[4],S=this.h[5],K=this.h[6],T=this.h[7],Y=this.h[8],k=this.h[9],L=this.r[0],z=this.r[1],R=this.r[2],P=this.r[3],O=this.r[4],N=this.r[5],C=this.r[6],F=this.r[7],I=this.r[8],G=this.r[9];n>=16;)e=255&r[t+0]|(255&r[t+1])<<8,E+=8191&e,o=255&r[t+2]|(255&r[t+3])<<8,x+=8191&(e>>>13|o<<3),i=255&r[t+4]|(255&r[t+5])<<8,M+=8191&(o>>>10|i<<6),h=255&r[t+6]|(255&r[t+7])<<8,m+=8191&(i>>>7|h<<9),a=255&r[t+8]|(255&r[t+9])<<8,B+=8191&(h>>>4|a<<12),S+=a>>>1&8191,f=255&r[t+10]|(255&r[t+11])<<8,K+=8191&(a>>>14|f<<2),s=255&r[t+12]|(255&r[t+13])<<8,T+=8191&(f>>>11|s<<5),c=255&r[t+14]|(255&r[t+15])<<8,Y+=8191&(s>>>8|c<<8),k+=c>>>5|U,u=0,y=u,y+=E*L,y+=x*(5*G),y+=M*(5*I),y+=m*(5*F),y+=B*(5*C),u=y>>>13,y&=8191,y+=S*(5*N),y+=K*(5*O),y+=T*(5*P),y+=Y*(5*R),y+=k*(5*z),u+=y>>>13,y&=8191,l=u,l+=E*z,l+=x*L,l+=M*(5*G),l+=m*(5*I),l+=B*(5*F),u=l>>>13,l&=8191,l+=S*(5*C),l+=K*(5*N),l+=T*(5*O),l+=Y*(5*P),l+=k*(5*R),u+=l>>>13,l&=8191,w=u,w+=E*R,w+=x*z,w+=M*L,w+=m*(5*G),w+=B*(5*I),u=w>>>13,w&=8191,w+=S*(5*F),w+=K*(5*C),w+=T*(5*N),w+=Y*(5*O),w+=k*(5*P),u+=w>>>13,w&=8191,p=u,p+=E*P,p+=x*R,p+=M*z,p+=m*L,p+=B*(5*G),u=p>>>13,p&=8191,p+=S*(5*I),p+=K*(5*F),p+=T*(5*C),p+=Y*(5*N),p+=k*(5*O),u+=p>>>13,p&=8191,v=u,v+=E*O,v+=x*P,v+=M*R,v+=m*z,v+=B*L,u=v>>>13,v&=8191,v+=S*(5*G),v+=K*(5*I),v+=T*(5*F),v+=Y*(5*C),v+=k*(5*N),u+=v>>>13,v&=8191,b=u,b+=E*N,b+=x*O,b+=M*P,b+=m*R,b+=B*z,u=b>>>13,b&=8191,b+=S*L,b+=K*(5*G),b+=T*(5*I),b+=Y*(5*F),b+=k*(5*C),u+=b>>>13,b&=8191,g=u,g+=E*C,g+=x*N,g+=M*O,g+=m*P,g+=B*R,u=g>>>13,g&=8191,g+=S*z,g+=K*L,g+=T*(5*G),g+=Y*(5*I),g+=k*(5*F),u+=g>>>13,g&=8191,_=u,_+=E*F,_+=x*C,_+=M*N,_+=m*O,_+=B*P,u=_>>>13,_&=8191,_+=S*R,_+=K*z,_+=T*L,_+=Y*(5*G),_+=k*(5*I),u+=_>>>13,_&=8191,A=u,A+=E*I,A+=x*F,A+=M*C,A+=m*N,A+=B*O,u=A>>>13,A&=8191,A+=S*P,A+=K*R,A+=T*z,A+=Y*L,A+=k*(5*G),u+=A>>>13,A&=8191,d=u,d+=E*G,d+=x*I,d+=M*F,d+=m*C,d+=B*N,u=d>>>13,d&=8191,d+=S*O,d+=K*P,d+=T*R,d+=Y*z,d+=k*L,u+=d>>>13,d&=8191,u=(u<<2)+u|0,u=u+y|0,y=8191&u,u>>>=13,l+=u,E=y,x=l,M=w,m=p,B=v,S=b,K=g,T=_,Y=A,k=d,t+=16,n-=16;this.h[0]=E,this.h[1]=x,this.h[2]=M,this.h[3]=m,this.h[4]=B,this.h[5]=S,this.h[6]=K,this.h[7]=T,this.h[8]=Y,this.h[9]=k},yr.prototype.finish=function(r,t){var n,e,o,i,h=new Uint16Array(10);if(this.leftover){for(i=this.leftover,this.buffer[i++]=1;i<16;i++)this.buffer[i]=0;this.fin=1,this.blocks(this.buffer,0,16)}for(n=this.h[1]>>>13,this.h[1]&=8191,i=2;i<10;i++)this.h[i]+=n,n=this.h[i]>>>13,this.h[i]&=8191;for(this.h[0]+=5*n,n=this.h[0]>>>13,this.h[0]&=8191,this.h[1]+=n,n=this.h[1]>>>13,this.h[1]&=8191,this.h[2]+=n,h[0]=this.h[0]+5,n=h[0]>>>13,h[0]&=8191,i=1;i<10;i++)h[i]=this.h[i]+n,n=h[i]>>>13,h[i]&=8191;for(h[9]-=8192,e=(1^n)-1,i=0;i<10;i++)h[i]&=e;for(e=~e,i=0;i<10;i++)this.h[i]=this.h[i]&e|h[i];for(this.h[0]=65535&(this.h[0]|this.h[1]<<13),this.h[1]=65535&(this.h[1]>>>3|this.h[2]<<10),this.h[2]=65535&(this.h[2]>>>6|this.h[3]<<7),this.h[3]=65535&(this.h[3]>>>9|this.h[4]<<4),this.h[4]=65535&(this.h[4]>>>12|this.h[5]<<1|this.h[6]<<14),this.h[5]=65535&(this.h[6]>>>2|this.h[7]<<11),this.h[6]=65535&(this.h[7]>>>5|this.h[8]<<8),this.h[7]=65535&(this.h[8]>>>8|this.h[9]<<5),o=this.h[0]+this.pad[0],this.h[0]=65535&o,i=1;i<8;i++)o=(this.h[i]+this.pad[i]|0)+(o>>>16)|0,this.h[i]=65535&o;r[t+0]=this.h[0]>>>0&255,r[t+1]=this.h[0]>>>8&255,r[t+2]=this.h[1]>>>0&255,r[t+3]=this.h[1]>>>8&255,r[t+4]=this.h[2]>>>0&255,r[t+5]=this.h[2]>>>8&255,r[t+6]=this.h[3]>>>0&255,r[t+7]=this.h[3]>>>8&255,r[t+8]=this.h[4]>>>0&255,r[t+9]=this.h[4]>>>8&255,r[t+10]=this.h[5]>>>0&255,r[t+11]=this.h[5]>>>8&255,r[t+12]=this.h[6]>>>0&255,r[t+13]=this.h[6]>>>8&255,r[t+14]=this.h[7]>>>0&255,r[t+15]=this.h[7]>>>8&255},yr.prototype.update=function(r,t,n){var e,o;if(this.leftover){for(o=16-this.leftover,o>n&&(o=n),e=0;e=16&&(o=n-n%16,this.blocks(r,t,o),t+=o,n-=o),n){for(e=0;e=0},r.sign.keyPair=function(){var r=new Uint8Array(Tr),t=new Uint8Array(Yr);return Z(r,t),{publicKey:r,secretKey:t}},r.sign.keyPair.fromSecretKey=function(r){if(Q(r),r.length!==Yr)throw new Error("bad secret key size");for(var t=new Uint8Array(Tr),n=0;n void): void; -} diff --git a/reverse_engineering/node_modules/tweetnacl/nacl.js b/reverse_engineering/node_modules/tweetnacl/nacl.js deleted file mode 100644 index f72dd78d..00000000 --- a/reverse_engineering/node_modules/tweetnacl/nacl.js +++ /dev/null @@ -1,1175 +0,0 @@ -(function(nacl) { -'use strict'; - -// Ported in 2014 by Dmitry Chestnykh and Devi Mandiri. -// Public domain. -// -// Implementation derived from TweetNaCl version 20140427. -// See for details: http://tweetnacl.cr.yp.to/ - -var u64 = function(h, l) { this.hi = h|0 >>> 0; this.lo = l|0 >>> 0; }; -var gf = function(init) { - var i, r = new Float64Array(16); - if (init) for (i = 0; i < init.length; i++) r[i] = init[i]; - return r; -}; - -// Pluggable, initialized in high-level API below. -var randombytes = function(/* x, n */) { throw new Error('no PRNG'); }; - -var _0 = new Uint8Array(16); -var _9 = new Uint8Array(32); _9[0] = 9; - -var gf0 = gf(), - gf1 = gf([1]), - _121665 = gf([0xdb41, 1]), - D = gf([0x78a3, 0x1359, 0x4dca, 0x75eb, 0xd8ab, 0x4141, 0x0a4d, 0x0070, 0xe898, 0x7779, 0x4079, 0x8cc7, 0xfe73, 0x2b6f, 0x6cee, 0x5203]), - D2 = gf([0xf159, 0x26b2, 0x9b94, 0xebd6, 0xb156, 0x8283, 0x149a, 0x00e0, 0xd130, 0xeef3, 0x80f2, 0x198e, 0xfce7, 0x56df, 0xd9dc, 0x2406]), - X = gf([0xd51a, 0x8f25, 0x2d60, 0xc956, 0xa7b2, 0x9525, 0xc760, 0x692c, 0xdc5c, 0xfdd6, 0xe231, 0xc0a4, 0x53fe, 0xcd6e, 0x36d3, 0x2169]), - Y = gf([0x6658, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666, 0x6666]), - I = gf([0xa0b0, 0x4a0e, 0x1b27, 0xc4ee, 0xe478, 0xad2f, 0x1806, 0x2f43, 0xd7a7, 0x3dfb, 0x0099, 0x2b4d, 0xdf0b, 0x4fc1, 0x2480, 0x2b83]); - -function L32(x, c) { return (x << c) | (x >>> (32 - c)); } - -function ld32(x, i) { - var u = x[i+3] & 0xff; - u = (u<<8)|(x[i+2] & 0xff); - u = (u<<8)|(x[i+1] & 0xff); - return (u<<8)|(x[i+0] & 0xff); -} - -function dl64(x, i) { - var h = (x[i] << 24) | (x[i+1] << 16) | (x[i+2] << 8) | x[i+3]; - var l = (x[i+4] << 24) | (x[i+5] << 16) | (x[i+6] << 8) | x[i+7]; - return new u64(h, l); -} - -function st32(x, j, u) { - var i; - for (i = 0; i < 4; i++) { x[j+i] = u & 255; u >>>= 8; } -} - -function ts64(x, i, u) { - x[i] = (u.hi >> 24) & 0xff; - x[i+1] = (u.hi >> 16) & 0xff; - x[i+2] = (u.hi >> 8) & 0xff; - x[i+3] = u.hi & 0xff; - x[i+4] = (u.lo >> 24) & 0xff; - x[i+5] = (u.lo >> 16) & 0xff; - x[i+6] = (u.lo >> 8) & 0xff; - x[i+7] = u.lo & 0xff; -} - -function vn(x, xi, y, yi, n) { - var i,d = 0; - for (i = 0; i < n; i++) d |= x[xi+i]^y[yi+i]; - return (1 & ((d - 1) >>> 8)) - 1; -} - -function crypto_verify_16(x, xi, y, yi) { - return vn(x,xi,y,yi,16); -} - -function crypto_verify_32(x, xi, y, yi) { - return vn(x,xi,y,yi,32); -} - -function core(out,inp,k,c,h) { - var w = new Uint32Array(16), x = new Uint32Array(16), - y = new Uint32Array(16), t = new Uint32Array(4); - var i, j, m; - - for (i = 0; i < 4; i++) { - x[5*i] = ld32(c, 4*i); - x[1+i] = ld32(k, 4*i); - x[6+i] = ld32(inp, 4*i); - x[11+i] = ld32(k, 16+4*i); - } - - for (i = 0; i < 16; i++) y[i] = x[i]; - - for (i = 0; i < 20; i++) { - for (j = 0; j < 4; j++) { - for (m = 0; m < 4; m++) t[m] = x[(5*j+4*m)%16]; - t[1] ^= L32((t[0]+t[3])|0, 7); - t[2] ^= L32((t[1]+t[0])|0, 9); - t[3] ^= L32((t[2]+t[1])|0,13); - t[0] ^= L32((t[3]+t[2])|0,18); - for (m = 0; m < 4; m++) w[4*j+(j+m)%4] = t[m]; - } - for (m = 0; m < 16; m++) x[m] = w[m]; - } - - if (h) { - for (i = 0; i < 16; i++) x[i] = (x[i] + y[i]) | 0; - for (i = 0; i < 4; i++) { - x[5*i] = (x[5*i] - ld32(c, 4*i)) | 0; - x[6+i] = (x[6+i] - ld32(inp, 4*i)) | 0; - } - for (i = 0; i < 4; i++) { - st32(out,4*i,x[5*i]); - st32(out,16+4*i,x[6+i]); - } - } else { - for (i = 0; i < 16; i++) st32(out, 4 * i, (x[i] + y[i]) | 0); - } -} - -function crypto_core_salsa20(out,inp,k,c) { - core(out,inp,k,c,false); - return 0; -} - -function crypto_core_hsalsa20(out,inp,k,c) { - core(out,inp,k,c,true); - return 0; -} - -var sigma = new Uint8Array([101, 120, 112, 97, 110, 100, 32, 51, 50, 45, 98, 121, 116, 101, 32, 107]); - // "expand 32-byte k" - -function crypto_stream_salsa20_xor(c,cpos,m,mpos,b,n,k) { - var z = new Uint8Array(16), x = new Uint8Array(64); - var u, i; - if (!b) return 0; - for (i = 0; i < 16; i++) z[i] = 0; - for (i = 0; i < 8; i++) z[i] = n[i]; - while (b >= 64) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < 64; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; - u = 1; - for (i = 8; i < 16; i++) { - u = u + (z[i] & 0xff) | 0; - z[i] = u & 0xff; - u >>>= 8; - } - b -= 64; - cpos += 64; - if (m) mpos += 64; - } - if (b > 0) { - crypto_core_salsa20(x,z,k,sigma); - for (i = 0; i < b; i++) c[cpos+i] = (m?m[mpos+i]:0) ^ x[i]; - } - return 0; -} - -function crypto_stream_salsa20(c,cpos,d,n,k) { - return crypto_stream_salsa20_xor(c,cpos,null,0,d,n,k); -} - -function crypto_stream(c,cpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - return crypto_stream_salsa20(c,cpos,d,n.subarray(16),s); -} - -function crypto_stream_xor(c,cpos,m,mpos,d,n,k) { - var s = new Uint8Array(32); - crypto_core_hsalsa20(s,n,k,sigma); - return crypto_stream_salsa20_xor(c,cpos,m,mpos,d,n.subarray(16),s); -} - -function add1305(h, c) { - var j, u = 0; - for (j = 0; j < 17; j++) { - u = (u + ((h[j] + c[j]) | 0)) | 0; - h[j] = u & 255; - u >>>= 8; - } -} - -var minusp = new Uint32Array([ - 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 252 -]); - -function crypto_onetimeauth(out, outpos, m, mpos, n, k) { - var s, i, j, u; - var x = new Uint32Array(17), r = new Uint32Array(17), - h = new Uint32Array(17), c = new Uint32Array(17), - g = new Uint32Array(17); - for (j = 0; j < 17; j++) r[j]=h[j]=0; - for (j = 0; j < 16; j++) r[j]=k[j]; - r[3]&=15; - r[4]&=252; - r[7]&=15; - r[8]&=252; - r[11]&=15; - r[12]&=252; - r[15]&=15; - - while (n > 0) { - for (j = 0; j < 17; j++) c[j] = 0; - for (j = 0; (j < 16) && (j < n); ++j) c[j] = m[mpos+j]; - c[j] = 1; - mpos += j; n -= j; - add1305(h,c); - for (i = 0; i < 17; i++) { - x[i] = 0; - for (j = 0; j < 17; j++) x[i] = (x[i] + (h[j] * ((j <= i) ? r[i - j] : ((320 * r[i + 17 - j])|0))) | 0) | 0; - } - for (i = 0; i < 17; i++) h[i] = x[i]; - u = 0; - for (j = 0; j < 16; j++) { - u = (u + h[j]) | 0; - h[j] = u & 255; - u >>>= 8; - } - u = (u + h[16]) | 0; h[16] = u & 3; - u = (5 * (u >>> 2)) | 0; - for (j = 0; j < 16; j++) { - u = (u + h[j]) | 0; - h[j] = u & 255; - u >>>= 8; - } - u = (u + h[16]) | 0; h[16] = u; - } - - for (j = 0; j < 17; j++) g[j] = h[j]; - add1305(h,minusp); - s = (-(h[16] >>> 7) | 0); - for (j = 0; j < 17; j++) h[j] ^= s & (g[j] ^ h[j]); - - for (j = 0; j < 16; j++) c[j] = k[j + 16]; - c[16] = 0; - add1305(h,c); - for (j = 0; j < 16; j++) out[outpos+j] = h[j]; - return 0; -} - -function crypto_onetimeauth_verify(h, hpos, m, mpos, n, k) { - var x = new Uint8Array(16); - crypto_onetimeauth(x,0,m,mpos,n,k); - return crypto_verify_16(h,hpos,x,0); -} - -function crypto_secretbox(c,m,d,n,k) { - var i; - if (d < 32) return -1; - crypto_stream_xor(c,0,m,0,d,n,k); - crypto_onetimeauth(c, 16, c, 32, d - 32, c); - for (i = 0; i < 16; i++) c[i] = 0; - return 0; -} - -function crypto_secretbox_open(m,c,d,n,k) { - var i; - var x = new Uint8Array(32); - if (d < 32) return -1; - crypto_stream(x,0,32,n,k); - if (crypto_onetimeauth_verify(c, 16,c, 32,d - 32,x) !== 0) return -1; - crypto_stream_xor(m,0,c,0,d,n,k); - for (i = 0; i < 32; i++) m[i] = 0; - return 0; -} - -function set25519(r, a) { - var i; - for (i = 0; i < 16; i++) r[i] = a[i]|0; -} - -function car25519(o) { - var c; - var i; - for (i = 0; i < 16; i++) { - o[i] += 65536; - c = Math.floor(o[i] / 65536); - o[(i+1)*(i<15?1:0)] += c - 1 + 37 * (c-1) * (i===15?1:0); - o[i] -= (c * 65536); - } -} - -function sel25519(p, q, b) { - var t, c = ~(b-1); - for (var i = 0; i < 16; i++) { - t = c & (p[i] ^ q[i]); - p[i] ^= t; - q[i] ^= t; - } -} - -function pack25519(o, n) { - var i, j, b; - var m = gf(), t = gf(); - for (i = 0; i < 16; i++) t[i] = n[i]; - car25519(t); - car25519(t); - car25519(t); - for (j = 0; j < 2; j++) { - m[0] = t[0] - 0xffed; - for (i = 1; i < 15; i++) { - m[i] = t[i] - 0xffff - ((m[i-1]>>16) & 1); - m[i-1] &= 0xffff; - } - m[15] = t[15] - 0x7fff - ((m[14]>>16) & 1); - b = (m[15]>>16) & 1; - m[14] &= 0xffff; - sel25519(t, m, 1-b); - } - for (i = 0; i < 16; i++) { - o[2*i] = t[i] & 0xff; - o[2*i+1] = t[i]>>8; - } -} - -function neq25519(a, b) { - var c = new Uint8Array(32), d = new Uint8Array(32); - pack25519(c, a); - pack25519(d, b); - return crypto_verify_32(c, 0, d, 0); -} - -function par25519(a) { - var d = new Uint8Array(32); - pack25519(d, a); - return d[0] & 1; -} - -function unpack25519(o, n) { - var i; - for (i = 0; i < 16; i++) o[i] = n[2*i] + (n[2*i+1] << 8); - o[15] &= 0x7fff; -} - -function A(o, a, b) { - var i; - for (i = 0; i < 16; i++) o[i] = (a[i] + b[i])|0; -} - -function Z(o, a, b) { - var i; - for (i = 0; i < 16; i++) o[i] = (a[i] - b[i])|0; -} - -function M(o, a, b) { - var i, j, t = new Float64Array(31); - for (i = 0; i < 31; i++) t[i] = 0; - for (i = 0; i < 16; i++) { - for (j = 0; j < 16; j++) { - t[i+j] += a[i] * b[j]; - } - } - for (i = 0; i < 15; i++) { - t[i] += 38 * t[i+16]; - } - for (i = 0; i < 16; i++) o[i] = t[i]; - car25519(o); - car25519(o); -} - -function S(o, a) { - M(o, a, a); -} - -function inv25519(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 253; a >= 0; a--) { - S(c, c); - if(a !== 2 && a !== 4) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function pow2523(o, i) { - var c = gf(); - var a; - for (a = 0; a < 16; a++) c[a] = i[a]; - for (a = 250; a >= 0; a--) { - S(c, c); - if(a !== 1) M(c, c, i); - } - for (a = 0; a < 16; a++) o[a] = c[a]; -} - -function crypto_scalarmult(q, n, p) { - var z = new Uint8Array(32); - var x = new Float64Array(80), r, i; - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(); - for (i = 0; i < 31; i++) z[i] = n[i]; - z[31]=(n[31]&127)|64; - z[0]&=248; - unpack25519(x,p); - for (i = 0; i < 16; i++) { - b[i]=x[i]; - d[i]=a[i]=c[i]=0; - } - a[0]=d[0]=1; - for (i=254; i>=0; --i) { - r=(z[i>>>3]>>>(i&7))&1; - sel25519(a,b,r); - sel25519(c,d,r); - A(e,a,c); - Z(a,a,c); - A(c,b,d); - Z(b,b,d); - S(d,e); - S(f,a); - M(a,c,a); - M(c,b,e); - A(e,a,c); - Z(a,a,c); - S(b,a); - Z(c,d,f); - M(a,c,_121665); - A(a,a,d); - M(c,c,a); - M(a,d,f); - M(d,b,x); - S(b,e); - sel25519(a,b,r); - sel25519(c,d,r); - } - for (i = 0; i < 16; i++) { - x[i+16]=a[i]; - x[i+32]=c[i]; - x[i+48]=b[i]; - x[i+64]=d[i]; - } - var x32 = x.subarray(32); - var x16 = x.subarray(16); - inv25519(x32,x32); - M(x16,x16,x32); - pack25519(q,x16); - return 0; -} - -function crypto_scalarmult_base(q, n) { - return crypto_scalarmult(q, n, _9); -} - -function crypto_box_keypair(y, x) { - randombytes(x, 32); - return crypto_scalarmult_base(y, x); -} - -function crypto_box_beforenm(k, y, x) { - var s = new Uint8Array(32); - crypto_scalarmult(s, x, y); - return crypto_core_hsalsa20(k, _0, s, sigma); -} - -var crypto_box_afternm = crypto_secretbox; -var crypto_box_open_afternm = crypto_secretbox_open; - -function crypto_box(c, m, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_afternm(c, m, d, n, k); -} - -function crypto_box_open(m, c, d, n, y, x) { - var k = new Uint8Array(32); - crypto_box_beforenm(k, y, x); - return crypto_box_open_afternm(m, c, d, n, k); -} - -function add64() { - var a = 0, b = 0, c = 0, d = 0, m16 = 65535, l, h, i; - for (i = 0; i < arguments.length; i++) { - l = arguments[i].lo; - h = arguments[i].hi; - a += (l & m16); b += (l >>> 16); - c += (h & m16); d += (h >>> 16); - } - - b += (a >>> 16); - c += (b >>> 16); - d += (c >>> 16); - - return new u64((c & m16) | (d << 16), (a & m16) | (b << 16)); -} - -function shr64(x, c) { - return new u64((x.hi >>> c), (x.lo >>> c) | (x.hi << (32 - c))); -} - -function xor64() { - var l = 0, h = 0, i; - for (i = 0; i < arguments.length; i++) { - l ^= arguments[i].lo; - h ^= arguments[i].hi; - } - return new u64(h, l); -} - -function R(x, c) { - var h, l, c1 = 32 - c; - if (c < 32) { - h = (x.hi >>> c) | (x.lo << c1); - l = (x.lo >>> c) | (x.hi << c1); - } else if (c < 64) { - h = (x.lo >>> c) | (x.hi << c1); - l = (x.hi >>> c) | (x.lo << c1); - } - return new u64(h, l); -} - -function Ch(x, y, z) { - var h = (x.hi & y.hi) ^ (~x.hi & z.hi), - l = (x.lo & y.lo) ^ (~x.lo & z.lo); - return new u64(h, l); -} - -function Maj(x, y, z) { - var h = (x.hi & y.hi) ^ (x.hi & z.hi) ^ (y.hi & z.hi), - l = (x.lo & y.lo) ^ (x.lo & z.lo) ^ (y.lo & z.lo); - return new u64(h, l); -} - -function Sigma0(x) { return xor64(R(x,28), R(x,34), R(x,39)); } -function Sigma1(x) { return xor64(R(x,14), R(x,18), R(x,41)); } -function sigma0(x) { return xor64(R(x, 1), R(x, 8), shr64(x,7)); } -function sigma1(x) { return xor64(R(x,19), R(x,61), shr64(x,6)); } - -var K = [ - new u64(0x428a2f98, 0xd728ae22), new u64(0x71374491, 0x23ef65cd), - new u64(0xb5c0fbcf, 0xec4d3b2f), new u64(0xe9b5dba5, 0x8189dbbc), - new u64(0x3956c25b, 0xf348b538), new u64(0x59f111f1, 0xb605d019), - new u64(0x923f82a4, 0xaf194f9b), new u64(0xab1c5ed5, 0xda6d8118), - new u64(0xd807aa98, 0xa3030242), new u64(0x12835b01, 0x45706fbe), - new u64(0x243185be, 0x4ee4b28c), new u64(0x550c7dc3, 0xd5ffb4e2), - new u64(0x72be5d74, 0xf27b896f), new u64(0x80deb1fe, 0x3b1696b1), - new u64(0x9bdc06a7, 0x25c71235), new u64(0xc19bf174, 0xcf692694), - new u64(0xe49b69c1, 0x9ef14ad2), new u64(0xefbe4786, 0x384f25e3), - new u64(0x0fc19dc6, 0x8b8cd5b5), new u64(0x240ca1cc, 0x77ac9c65), - new u64(0x2de92c6f, 0x592b0275), new u64(0x4a7484aa, 0x6ea6e483), - new u64(0x5cb0a9dc, 0xbd41fbd4), new u64(0x76f988da, 0x831153b5), - new u64(0x983e5152, 0xee66dfab), new u64(0xa831c66d, 0x2db43210), - new u64(0xb00327c8, 0x98fb213f), new u64(0xbf597fc7, 0xbeef0ee4), - new u64(0xc6e00bf3, 0x3da88fc2), new u64(0xd5a79147, 0x930aa725), - new u64(0x06ca6351, 0xe003826f), new u64(0x14292967, 0x0a0e6e70), - new u64(0x27b70a85, 0x46d22ffc), new u64(0x2e1b2138, 0x5c26c926), - new u64(0x4d2c6dfc, 0x5ac42aed), new u64(0x53380d13, 0x9d95b3df), - new u64(0x650a7354, 0x8baf63de), new u64(0x766a0abb, 0x3c77b2a8), - new u64(0x81c2c92e, 0x47edaee6), new u64(0x92722c85, 0x1482353b), - new u64(0xa2bfe8a1, 0x4cf10364), new u64(0xa81a664b, 0xbc423001), - new u64(0xc24b8b70, 0xd0f89791), new u64(0xc76c51a3, 0x0654be30), - new u64(0xd192e819, 0xd6ef5218), new u64(0xd6990624, 0x5565a910), - new u64(0xf40e3585, 0x5771202a), new u64(0x106aa070, 0x32bbd1b8), - new u64(0x19a4c116, 0xb8d2d0c8), new u64(0x1e376c08, 0x5141ab53), - new u64(0x2748774c, 0xdf8eeb99), new u64(0x34b0bcb5, 0xe19b48a8), - new u64(0x391c0cb3, 0xc5c95a63), new u64(0x4ed8aa4a, 0xe3418acb), - new u64(0x5b9cca4f, 0x7763e373), new u64(0x682e6ff3, 0xd6b2b8a3), - new u64(0x748f82ee, 0x5defb2fc), new u64(0x78a5636f, 0x43172f60), - new u64(0x84c87814, 0xa1f0ab72), new u64(0x8cc70208, 0x1a6439ec), - new u64(0x90befffa, 0x23631e28), new u64(0xa4506ceb, 0xde82bde9), - new u64(0xbef9a3f7, 0xb2c67915), new u64(0xc67178f2, 0xe372532b), - new u64(0xca273ece, 0xea26619c), new u64(0xd186b8c7, 0x21c0c207), - new u64(0xeada7dd6, 0xcde0eb1e), new u64(0xf57d4f7f, 0xee6ed178), - new u64(0x06f067aa, 0x72176fba), new u64(0x0a637dc5, 0xa2c898a6), - new u64(0x113f9804, 0xbef90dae), new u64(0x1b710b35, 0x131c471b), - new u64(0x28db77f5, 0x23047d84), new u64(0x32caab7b, 0x40c72493), - new u64(0x3c9ebe0a, 0x15c9bebc), new u64(0x431d67c4, 0x9c100d4c), - new u64(0x4cc5d4be, 0xcb3e42b6), new u64(0x597f299c, 0xfc657e2a), - new u64(0x5fcb6fab, 0x3ad6faec), new u64(0x6c44198c, 0x4a475817) -]; - -function crypto_hashblocks(x, m, n) { - var z = [], b = [], a = [], w = [], t, i, j; - - for (i = 0; i < 8; i++) z[i] = a[i] = dl64(x, 8*i); - - var pos = 0; - while (n >= 128) { - for (i = 0; i < 16; i++) w[i] = dl64(m, 8*i+pos); - for (i = 0; i < 80; i++) { - for (j = 0; j < 8; j++) b[j] = a[j]; - t = add64(a[7], Sigma1(a[4]), Ch(a[4], a[5], a[6]), K[i], w[i%16]); - b[7] = add64(t, Sigma0(a[0]), Maj(a[0], a[1], a[2])); - b[3] = add64(b[3], t); - for (j = 0; j < 8; j++) a[(j+1)%8] = b[j]; - if (i%16 === 15) { - for (j = 0; j < 16; j++) { - w[j] = add64(w[j], w[(j+9)%16], sigma0(w[(j+1)%16]), sigma1(w[(j+14)%16])); - } - } - } - - for (i = 0; i < 8; i++) { - a[i] = add64(a[i], z[i]); - z[i] = a[i]; - } - - pos += 128; - n -= 128; - } - - for (i = 0; i < 8; i++) ts64(x, 8*i, z[i]); - return n; -} - -var iv = new Uint8Array([ - 0x6a,0x09,0xe6,0x67,0xf3,0xbc,0xc9,0x08, - 0xbb,0x67,0xae,0x85,0x84,0xca,0xa7,0x3b, - 0x3c,0x6e,0xf3,0x72,0xfe,0x94,0xf8,0x2b, - 0xa5,0x4f,0xf5,0x3a,0x5f,0x1d,0x36,0xf1, - 0x51,0x0e,0x52,0x7f,0xad,0xe6,0x82,0xd1, - 0x9b,0x05,0x68,0x8c,0x2b,0x3e,0x6c,0x1f, - 0x1f,0x83,0xd9,0xab,0xfb,0x41,0xbd,0x6b, - 0x5b,0xe0,0xcd,0x19,0x13,0x7e,0x21,0x79 -]); - -function crypto_hash(out, m, n) { - var h = new Uint8Array(64), x = new Uint8Array(256); - var i, b = n; - - for (i = 0; i < 64; i++) h[i] = iv[i]; - - crypto_hashblocks(h, m, n); - n %= 128; - - for (i = 0; i < 256; i++) x[i] = 0; - for (i = 0; i < n; i++) x[i] = m[b-n+i]; - x[n] = 128; - - n = 256-128*(n<112?1:0); - x[n-9] = 0; - ts64(x, n-8, new u64((b / 0x20000000) | 0, b << 3)); - crypto_hashblocks(h, x, n); - - for (i = 0; i < 64; i++) out[i] = h[i]; - - return 0; -} - -function add(p, q) { - var a = gf(), b = gf(), c = gf(), - d = gf(), e = gf(), f = gf(), - g = gf(), h = gf(), t = gf(); - - Z(a, p[1], p[0]); - Z(t, q[1], q[0]); - M(a, a, t); - A(b, p[0], p[1]); - A(t, q[0], q[1]); - M(b, b, t); - M(c, p[3], q[3]); - M(c, c, D2); - M(d, p[2], q[2]); - A(d, d, d); - Z(e, b, a); - Z(f, d, c); - A(g, d, c); - A(h, b, a); - - M(p[0], e, f); - M(p[1], h, g); - M(p[2], g, f); - M(p[3], e, h); -} - -function cswap(p, q, b) { - var i; - for (i = 0; i < 4; i++) { - sel25519(p[i], q[i], b); - } -} - -function pack(r, p) { - var tx = gf(), ty = gf(), zi = gf(); - inv25519(zi, p[2]); - M(tx, p[0], zi); - M(ty, p[1], zi); - pack25519(r, ty); - r[31] ^= par25519(tx) << 7; -} - -function scalarmult(p, q, s) { - var b, i; - set25519(p[0], gf0); - set25519(p[1], gf1); - set25519(p[2], gf1); - set25519(p[3], gf0); - for (i = 255; i >= 0; --i) { - b = (s[(i/8)|0] >> (i&7)) & 1; - cswap(p, q, b); - add(q, p); - add(p, p); - cswap(p, q, b); - } -} - -function scalarbase(p, s) { - var q = [gf(), gf(), gf(), gf()]; - set25519(q[0], X); - set25519(q[1], Y); - set25519(q[2], gf1); - M(q[3], X, Y); - scalarmult(p, q, s); -} - -function crypto_sign_keypair(pk, sk, seeded) { - var d = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()]; - var i; - - if (!seeded) randombytes(sk, 32); - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - scalarbase(p, d); - pack(pk, p); - - for (i = 0; i < 32; i++) sk[i+32] = pk[i]; - return 0; -} - -var L = new Float64Array([0xed, 0xd3, 0xf5, 0x5c, 0x1a, 0x63, 0x12, 0x58, 0xd6, 0x9c, 0xf7, 0xa2, 0xde, 0xf9, 0xde, 0x14, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x10]); - -function modL(r, x) { - var carry, i, j, k; - for (i = 63; i >= 32; --i) { - carry = 0; - for (j = i - 32, k = i - 12; j < k; ++j) { - x[j] += carry - 16 * x[i] * L[j - (i - 32)]; - carry = (x[j] + 128) >> 8; - x[j] -= carry * 256; - } - x[j] += carry; - x[i] = 0; - } - carry = 0; - for (j = 0; j < 32; j++) { - x[j] += carry - (x[31] >> 4) * L[j]; - carry = x[j] >> 8; - x[j] &= 255; - } - for (j = 0; j < 32; j++) x[j] -= carry * L[j]; - for (i = 0; i < 32; i++) { - x[i+1] += x[i] >> 8; - r[i] = x[i] & 255; - } -} - -function reduce(r) { - var x = new Float64Array(64), i; - for (i = 0; i < 64; i++) x[i] = r[i]; - for (i = 0; i < 64; i++) r[i] = 0; - modL(r, x); -} - -// Note: difference from C - smlen returned, not passed as argument. -function crypto_sign(sm, m, n, sk) { - var d = new Uint8Array(64), h = new Uint8Array(64), r = new Uint8Array(64); - var i, j, x = new Float64Array(64); - var p = [gf(), gf(), gf(), gf()]; - - crypto_hash(d, sk, 32); - d[0] &= 248; - d[31] &= 127; - d[31] |= 64; - - var smlen = n + 64; - for (i = 0; i < n; i++) sm[64 + i] = m[i]; - for (i = 0; i < 32; i++) sm[32 + i] = d[32 + i]; - - crypto_hash(r, sm.subarray(32), n+32); - reduce(r); - scalarbase(p, r); - pack(sm, p); - - for (i = 32; i < 64; i++) sm[i] = sk[i]; - crypto_hash(h, sm, n + 64); - reduce(h); - - for (i = 0; i < 64; i++) x[i] = 0; - for (i = 0; i < 32; i++) x[i] = r[i]; - for (i = 0; i < 32; i++) { - for (j = 0; j < 32; j++) { - x[i+j] += h[i] * d[j]; - } - } - - modL(sm.subarray(32), x); - return smlen; -} - -function unpackneg(r, p) { - var t = gf(), chk = gf(), num = gf(), - den = gf(), den2 = gf(), den4 = gf(), - den6 = gf(); - - set25519(r[2], gf1); - unpack25519(r[1], p); - S(num, r[1]); - M(den, num, D); - Z(num, num, r[2]); - A(den, r[2], den); - - S(den2, den); - S(den4, den2); - M(den6, den4, den2); - M(t, den6, num); - M(t, t, den); - - pow2523(t, t); - M(t, t, num); - M(t, t, den); - M(t, t, den); - M(r[0], t, den); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) M(r[0], r[0], I); - - S(chk, r[0]); - M(chk, chk, den); - if (neq25519(chk, num)) return -1; - - if (par25519(r[0]) === (p[31]>>7)) Z(r[0], gf0, r[0]); - - M(r[3], r[0], r[1]); - return 0; -} - -function crypto_sign_open(m, sm, n, pk) { - var i, mlen; - var t = new Uint8Array(32), h = new Uint8Array(64); - var p = [gf(), gf(), gf(), gf()], - q = [gf(), gf(), gf(), gf()]; - - mlen = -1; - if (n < 64) return -1; - - if (unpackneg(q, pk)) return -1; - - for (i = 0; i < n; i++) m[i] = sm[i]; - for (i = 0; i < 32; i++) m[i+32] = pk[i]; - crypto_hash(h, m, n); - reduce(h); - scalarmult(p, q, h); - - scalarbase(q, sm.subarray(32)); - add(p, q); - pack(t, p); - - n -= 64; - if (crypto_verify_32(sm, 0, t, 0)) { - for (i = 0; i < n; i++) m[i] = 0; - return -1; - } - - for (i = 0; i < n; i++) m[i] = sm[i + 64]; - mlen = n; - return mlen; -} - -var crypto_secretbox_KEYBYTES = 32, - crypto_secretbox_NONCEBYTES = 24, - crypto_secretbox_ZEROBYTES = 32, - crypto_secretbox_BOXZEROBYTES = 16, - crypto_scalarmult_BYTES = 32, - crypto_scalarmult_SCALARBYTES = 32, - crypto_box_PUBLICKEYBYTES = 32, - crypto_box_SECRETKEYBYTES = 32, - crypto_box_BEFORENMBYTES = 32, - crypto_box_NONCEBYTES = crypto_secretbox_NONCEBYTES, - crypto_box_ZEROBYTES = crypto_secretbox_ZEROBYTES, - crypto_box_BOXZEROBYTES = crypto_secretbox_BOXZEROBYTES, - crypto_sign_BYTES = 64, - crypto_sign_PUBLICKEYBYTES = 32, - crypto_sign_SECRETKEYBYTES = 64, - crypto_sign_SEEDBYTES = 32, - crypto_hash_BYTES = 64; - -nacl.lowlevel = { - crypto_core_hsalsa20: crypto_core_hsalsa20, - crypto_stream_xor: crypto_stream_xor, - crypto_stream: crypto_stream, - crypto_stream_salsa20_xor: crypto_stream_salsa20_xor, - crypto_stream_salsa20: crypto_stream_salsa20, - crypto_onetimeauth: crypto_onetimeauth, - crypto_onetimeauth_verify: crypto_onetimeauth_verify, - crypto_verify_16: crypto_verify_16, - crypto_verify_32: crypto_verify_32, - crypto_secretbox: crypto_secretbox, - crypto_secretbox_open: crypto_secretbox_open, - crypto_scalarmult: crypto_scalarmult, - crypto_scalarmult_base: crypto_scalarmult_base, - crypto_box_beforenm: crypto_box_beforenm, - crypto_box_afternm: crypto_box_afternm, - crypto_box: crypto_box, - crypto_box_open: crypto_box_open, - crypto_box_keypair: crypto_box_keypair, - crypto_hash: crypto_hash, - crypto_sign: crypto_sign, - crypto_sign_keypair: crypto_sign_keypair, - crypto_sign_open: crypto_sign_open, - - crypto_secretbox_KEYBYTES: crypto_secretbox_KEYBYTES, - crypto_secretbox_NONCEBYTES: crypto_secretbox_NONCEBYTES, - crypto_secretbox_ZEROBYTES: crypto_secretbox_ZEROBYTES, - crypto_secretbox_BOXZEROBYTES: crypto_secretbox_BOXZEROBYTES, - crypto_scalarmult_BYTES: crypto_scalarmult_BYTES, - crypto_scalarmult_SCALARBYTES: crypto_scalarmult_SCALARBYTES, - crypto_box_PUBLICKEYBYTES: crypto_box_PUBLICKEYBYTES, - crypto_box_SECRETKEYBYTES: crypto_box_SECRETKEYBYTES, - crypto_box_BEFORENMBYTES: crypto_box_BEFORENMBYTES, - crypto_box_NONCEBYTES: crypto_box_NONCEBYTES, - crypto_box_ZEROBYTES: crypto_box_ZEROBYTES, - crypto_box_BOXZEROBYTES: crypto_box_BOXZEROBYTES, - crypto_sign_BYTES: crypto_sign_BYTES, - crypto_sign_PUBLICKEYBYTES: crypto_sign_PUBLICKEYBYTES, - crypto_sign_SECRETKEYBYTES: crypto_sign_SECRETKEYBYTES, - crypto_sign_SEEDBYTES: crypto_sign_SEEDBYTES, - crypto_hash_BYTES: crypto_hash_BYTES -}; - -/* High-level API */ - -function checkLengths(k, n) { - if (k.length !== crypto_secretbox_KEYBYTES) throw new Error('bad key size'); - if (n.length !== crypto_secretbox_NONCEBYTES) throw new Error('bad nonce size'); -} - -function checkBoxLengths(pk, sk) { - if (pk.length !== crypto_box_PUBLICKEYBYTES) throw new Error('bad public key size'); - if (sk.length !== crypto_box_SECRETKEYBYTES) throw new Error('bad secret key size'); -} - -function checkArrayTypes() { - var t, i; - for (i = 0; i < arguments.length; i++) { - if ((t = Object.prototype.toString.call(arguments[i])) !== '[object Uint8Array]') - throw new TypeError('unexpected type ' + t + ', use Uint8Array'); - } -} - -function cleanup(arr) { - for (var i = 0; i < arr.length; i++) arr[i] = 0; -} - -// TODO: Completely remove this in v0.15. -if (!nacl.util) { - nacl.util = {}; - nacl.util.decodeUTF8 = nacl.util.encodeUTF8 = nacl.util.encodeBase64 = nacl.util.decodeBase64 = function() { - throw new Error('nacl.util moved into separate package: https://github.com/dchest/tweetnacl-util-js'); - }; -} - -nacl.randomBytes = function(n) { - var b = new Uint8Array(n); - randombytes(b, n); - return b; -}; - -nacl.secretbox = function(msg, nonce, key) { - checkArrayTypes(msg, nonce, key); - checkLengths(key, nonce); - var m = new Uint8Array(crypto_secretbox_ZEROBYTES + msg.length); - var c = new Uint8Array(m.length); - for (var i = 0; i < msg.length; i++) m[i+crypto_secretbox_ZEROBYTES] = msg[i]; - crypto_secretbox(c, m, m.length, nonce, key); - return c.subarray(crypto_secretbox_BOXZEROBYTES); -}; - -nacl.secretbox.open = function(box, nonce, key) { - checkArrayTypes(box, nonce, key); - checkLengths(key, nonce); - var c = new Uint8Array(crypto_secretbox_BOXZEROBYTES + box.length); - var m = new Uint8Array(c.length); - for (var i = 0; i < box.length; i++) c[i+crypto_secretbox_BOXZEROBYTES] = box[i]; - if (c.length < 32) return false; - if (crypto_secretbox_open(m, c, c.length, nonce, key) !== 0) return false; - return m.subarray(crypto_secretbox_ZEROBYTES); -}; - -nacl.secretbox.keyLength = crypto_secretbox_KEYBYTES; -nacl.secretbox.nonceLength = crypto_secretbox_NONCEBYTES; -nacl.secretbox.overheadLength = crypto_secretbox_BOXZEROBYTES; - -nacl.scalarMult = function(n, p) { - checkArrayTypes(n, p); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - if (p.length !== crypto_scalarmult_BYTES) throw new Error('bad p size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult(q, n, p); - return q; -}; - -nacl.scalarMult.base = function(n) { - checkArrayTypes(n); - if (n.length !== crypto_scalarmult_SCALARBYTES) throw new Error('bad n size'); - var q = new Uint8Array(crypto_scalarmult_BYTES); - crypto_scalarmult_base(q, n); - return q; -}; - -nacl.scalarMult.scalarLength = crypto_scalarmult_SCALARBYTES; -nacl.scalarMult.groupElementLength = crypto_scalarmult_BYTES; - -nacl.box = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox(msg, nonce, k); -}; - -nacl.box.before = function(publicKey, secretKey) { - checkArrayTypes(publicKey, secretKey); - checkBoxLengths(publicKey, secretKey); - var k = new Uint8Array(crypto_box_BEFORENMBYTES); - crypto_box_beforenm(k, publicKey, secretKey); - return k; -}; - -nacl.box.after = nacl.secretbox; - -nacl.box.open = function(msg, nonce, publicKey, secretKey) { - var k = nacl.box.before(publicKey, secretKey); - return nacl.secretbox.open(msg, nonce, k); -}; - -nacl.box.open.after = nacl.secretbox.open; - -nacl.box.keyPair = function() { - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_box_SECRETKEYBYTES); - crypto_box_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.box.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_box_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_box_PUBLICKEYBYTES); - crypto_scalarmult_base(pk, secretKey); - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.box.publicKeyLength = crypto_box_PUBLICKEYBYTES; -nacl.box.secretKeyLength = crypto_box_SECRETKEYBYTES; -nacl.box.sharedKeyLength = crypto_box_BEFORENMBYTES; -nacl.box.nonceLength = crypto_box_NONCEBYTES; -nacl.box.overheadLength = nacl.secretbox.overheadLength; - -nacl.sign = function(msg, secretKey) { - checkArrayTypes(msg, secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var signedMsg = new Uint8Array(crypto_sign_BYTES+msg.length); - crypto_sign(signedMsg, msg, msg.length, secretKey); - return signedMsg; -}; - -nacl.sign.open = function(signedMsg, publicKey) { - if (arguments.length !== 2) - throw new Error('nacl.sign.open accepts 2 arguments; did you mean to use nacl.sign.detached.verify?'); - checkArrayTypes(signedMsg, publicKey); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var tmp = new Uint8Array(signedMsg.length); - var mlen = crypto_sign_open(tmp, signedMsg, signedMsg.length, publicKey); - if (mlen < 0) return null; - var m = new Uint8Array(mlen); - for (var i = 0; i < m.length; i++) m[i] = tmp[i]; - return m; -}; - -nacl.sign.detached = function(msg, secretKey) { - var signedMsg = nacl.sign(msg, secretKey); - var sig = new Uint8Array(crypto_sign_BYTES); - for (var i = 0; i < sig.length; i++) sig[i] = signedMsg[i]; - return sig; -}; - -nacl.sign.detached.verify = function(msg, sig, publicKey) { - checkArrayTypes(msg, sig, publicKey); - if (sig.length !== crypto_sign_BYTES) - throw new Error('bad signature size'); - if (publicKey.length !== crypto_sign_PUBLICKEYBYTES) - throw new Error('bad public key size'); - var sm = new Uint8Array(crypto_sign_BYTES + msg.length); - var m = new Uint8Array(crypto_sign_BYTES + msg.length); - var i; - for (i = 0; i < crypto_sign_BYTES; i++) sm[i] = sig[i]; - for (i = 0; i < msg.length; i++) sm[i+crypto_sign_BYTES] = msg[i]; - return (crypto_sign_open(m, sm, sm.length, publicKey) >= 0); -}; - -nacl.sign.keyPair = function() { - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - crypto_sign_keypair(pk, sk); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.keyPair.fromSecretKey = function(secretKey) { - checkArrayTypes(secretKey); - if (secretKey.length !== crypto_sign_SECRETKEYBYTES) - throw new Error('bad secret key size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - for (var i = 0; i < pk.length; i++) pk[i] = secretKey[32+i]; - return {publicKey: pk, secretKey: new Uint8Array(secretKey)}; -}; - -nacl.sign.keyPair.fromSeed = function(seed) { - checkArrayTypes(seed); - if (seed.length !== crypto_sign_SEEDBYTES) - throw new Error('bad seed size'); - var pk = new Uint8Array(crypto_sign_PUBLICKEYBYTES); - var sk = new Uint8Array(crypto_sign_SECRETKEYBYTES); - for (var i = 0; i < 32; i++) sk[i] = seed[i]; - crypto_sign_keypair(pk, sk, true); - return {publicKey: pk, secretKey: sk}; -}; - -nacl.sign.publicKeyLength = crypto_sign_PUBLICKEYBYTES; -nacl.sign.secretKeyLength = crypto_sign_SECRETKEYBYTES; -nacl.sign.seedLength = crypto_sign_SEEDBYTES; -nacl.sign.signatureLength = crypto_sign_BYTES; - -nacl.hash = function(msg) { - checkArrayTypes(msg); - var h = new Uint8Array(crypto_hash_BYTES); - crypto_hash(h, msg, msg.length); - return h; -}; - -nacl.hash.hashLength = crypto_hash_BYTES; - -nacl.verify = function(x, y) { - checkArrayTypes(x, y); - // Zero length arguments are considered not equal. - if (x.length === 0 || y.length === 0) return false; - if (x.length !== y.length) return false; - return (vn(x, 0, y, 0, x.length) === 0) ? true : false; -}; - -nacl.setPRNG = function(fn) { - randombytes = fn; -}; - -(function() { - // Initialize PRNG if environment provides CSPRNG. - // If not, methods calling randombytes will throw. - var crypto = typeof self !== 'undefined' ? (self.crypto || self.msCrypto) : null; - if (crypto && crypto.getRandomValues) { - // Browsers. - var QUOTA = 65536; - nacl.setPRNG(function(x, n) { - var i, v = new Uint8Array(n); - for (i = 0; i < n; i += QUOTA) { - crypto.getRandomValues(v.subarray(i, i + Math.min(n - i, QUOTA))); - } - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } else if (typeof require !== 'undefined') { - // Node.js. - crypto = require('crypto'); - if (crypto && crypto.randomBytes) { - nacl.setPRNG(function(x, n) { - var i, v = crypto.randomBytes(n); - for (i = 0; i < n; i++) x[i] = v[i]; - cleanup(v); - }); - } - } -})(); - -})(typeof module !== 'undefined' && module.exports ? module.exports : (self.nacl = self.nacl || {})); diff --git a/reverse_engineering/node_modules/tweetnacl/nacl.min.js b/reverse_engineering/node_modules/tweetnacl/nacl.min.js deleted file mode 100644 index 4484974e..00000000 --- a/reverse_engineering/node_modules/tweetnacl/nacl.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(r){"use strict";function n(r,n){return r<>>32-n}function e(r,n){var e=255&r[n+3];return e=e<<8|255&r[n+2],e=e<<8|255&r[n+1],e<<8|255&r[n+0]}function t(r,n){var e=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],t=r[n+4]<<24|r[n+5]<<16|r[n+6]<<8|r[n+7];return new sr(e,t)}function o(r,n,e){var t;for(t=0;t<4;t++)r[n+t]=255&e,e>>>=8}function i(r,n,e){r[n]=e.hi>>24&255,r[n+1]=e.hi>>16&255,r[n+2]=e.hi>>8&255,r[n+3]=255&e.hi,r[n+4]=e.lo>>24&255,r[n+5]=e.lo>>16&255,r[n+6]=e.lo>>8&255,r[n+7]=255&e.lo}function a(r,n,e,t,o){var i,a=0;for(i=0;i>>8)-1}function f(r,n,e,t){return a(r,n,e,t,16)}function u(r,n,e,t){return a(r,n,e,t,32)}function c(r,t,i,a,f){var u,c,w,y=new Uint32Array(16),l=new Uint32Array(16),s=new Uint32Array(16),h=new Uint32Array(4);for(u=0;u<4;u++)l[5*u]=e(a,4*u),l[1+u]=e(i,4*u),l[6+u]=e(t,4*u),l[11+u]=e(i,16+4*u);for(u=0;u<16;u++)s[u]=l[u];for(u=0;u<20;u++){for(c=0;c<4;c++){for(w=0;w<4;w++)h[w]=l[(5*c+4*w)%16];for(h[1]^=n(h[0]+h[3]|0,7),h[2]^=n(h[1]+h[0]|0,9),h[3]^=n(h[2]+h[1]|0,13),h[0]^=n(h[3]+h[2]|0,18),w=0;w<4;w++)y[4*c+(c+w)%4]=h[w]}for(w=0;w<16;w++)l[w]=y[w]}if(f){for(u=0;u<16;u++)l[u]=l[u]+s[u]|0;for(u=0;u<4;u++)l[5*u]=l[5*u]-e(a,4*u)|0,l[6+u]=l[6+u]-e(t,4*u)|0;for(u=0;u<4;u++)o(r,4*u,l[5*u]),o(r,16+4*u,l[6+u])}else for(u=0;u<16;u++)o(r,4*u,l[u]+s[u]|0)}function w(r,n,e,t){return c(r,n,e,t,!1),0}function y(r,n,e,t){return c(r,n,e,t,!0),0}function l(r,n,e,t,o,i,a){var f,u,c=new Uint8Array(16),y=new Uint8Array(64);if(!o)return 0;for(u=0;u<16;u++)c[u]=0;for(u=0;u<8;u++)c[u]=i[u];for(;o>=64;){for(w(y,c,a,Br),u=0;u<64;u++)r[n+u]=(e?e[t+u]:0)^y[u];for(f=1,u=8;u<16;u++)f=f+(255&c[u])|0,c[u]=255&f,f>>>=8;o-=64,n+=64,e&&(t+=64)}if(o>0)for(w(y,c,a,Br),u=0;u>>=8}function b(r,n,e,t,o,i){var a,f,u,c,w=new Uint32Array(17),y=new Uint32Array(17),l=new Uint32Array(17),s=new Uint32Array(17),h=new Uint32Array(17);for(u=0;u<17;u++)y[u]=l[u]=0;for(u=0;u<16;u++)y[u]=i[u];for(y[3]&=15,y[4]&=252,y[7]&=15,y[8]&=252,y[11]&=15,y[12]&=252,y[15]&=15;o>0;){for(u=0;u<17;u++)s[u]=0;for(u=0;u<16&&u>>=8;for(c=c+l[16]|0,l[16]=3&c,c=5*(c>>>2)|0,u=0;u<16;u++)c=c+l[u]|0,l[u]=255&c,c>>>=8;c=c+l[16]|0,l[16]=c}for(u=0;u<17;u++)h[u]=l[u];for(v(l,Sr),a=0|-(l[16]>>>7),u=0;u<17;u++)l[u]^=a&(h[u]^l[u]);for(u=0;u<16;u++)s[u]=i[u+16];for(s[16]=0,v(l,s),u=0;u<16;u++)r[n+u]=l[u];return 0}function p(r,n,e,t,o,i){var a=new Uint8Array(16);return b(a,0,e,t,o,i),f(r,n,a,0)}function _(r,n,e,t,o){var i;if(e<32)return-1;for(g(r,0,n,0,e,t,o),b(r,16,r,32,e-32,r),i=0;i<16;i++)r[i]=0;return 0}function A(r,n,e,t,o){var i,a=new Uint8Array(32);if(e<32)return-1;if(h(a,0,32,t,o),0!==p(n,16,n,32,e-32,a))return-1;for(g(r,0,n,0,e,t,o),i=0;i<32;i++)r[i]=0;return 0}function U(r,n){var e;for(e=0;e<16;e++)r[e]=0|n[e]}function E(r){var n,e;for(e=0;e<16;e++)r[e]+=65536,n=Math.floor(r[e]/65536),r[(e+1)*(e<15?1:0)]+=n-1+37*(n-1)*(15===e?1:0),r[e]-=65536*n}function d(r,n,e){for(var t,o=~(e-1),i=0;i<16;i++)t=o&(r[i]^n[i]),r[i]^=t,n[i]^=t}function x(r,n){var e,t,o,i=hr(),a=hr();for(e=0;e<16;e++)a[e]=n[e];for(E(a),E(a),E(a),t=0;t<2;t++){for(i[0]=a[0]-65517,e=1;e<15;e++)i[e]=a[e]-65535-(i[e-1]>>16&1),i[e-1]&=65535;i[15]=a[15]-32767-(i[14]>>16&1),o=i[15]>>16&1,i[14]&=65535,d(a,i,1-o)}for(e=0;e<16;e++)r[2*e]=255&a[e],r[2*e+1]=a[e]>>8}function m(r,n){var e=new Uint8Array(32),t=new Uint8Array(32);return x(e,r),x(t,n),u(e,0,t,0)}function B(r){var n=new Uint8Array(32);return x(n,r),1&n[0]}function S(r,n){var e;for(e=0;e<16;e++)r[e]=n[2*e]+(n[2*e+1]<<8);r[15]&=32767}function K(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]+e[t]|0}function T(r,n,e){var t;for(t=0;t<16;t++)r[t]=n[t]-e[t]|0}function Y(r,n,e){var t,o,i=new Float64Array(31);for(t=0;t<31;t++)i[t]=0;for(t=0;t<16;t++)for(o=0;o<16;o++)i[t+o]+=n[t]*e[o];for(t=0;t<15;t++)i[t]+=38*i[t+16];for(t=0;t<16;t++)r[t]=i[t];E(r),E(r)}function L(r,n){Y(r,n,n)}function k(r,n){var e,t=hr();for(e=0;e<16;e++)t[e]=n[e];for(e=253;e>=0;e--)L(t,t),2!==e&&4!==e&&Y(t,t,n);for(e=0;e<16;e++)r[e]=t[e]}function z(r,n){var e,t=hr();for(e=0;e<16;e++)t[e]=n[e];for(e=250;e>=0;e--)L(t,t),1!==e&&Y(t,t,n);for(e=0;e<16;e++)r[e]=t[e]}function R(r,n,e){var t,o,i=new Uint8Array(32),a=new Float64Array(80),f=hr(),u=hr(),c=hr(),w=hr(),y=hr(),l=hr();for(o=0;o<31;o++)i[o]=n[o];for(i[31]=127&n[31]|64,i[0]&=248,S(a,e),o=0;o<16;o++)u[o]=a[o],w[o]=f[o]=c[o]=0;for(f[0]=w[0]=1,o=254;o>=0;--o)t=i[o>>>3]>>>(7&o)&1,d(f,u,t),d(c,w,t),K(y,f,c),T(f,f,c),K(c,u,w),T(u,u,w),L(w,y),L(l,f),Y(f,c,f),Y(c,u,y),K(y,f,c),T(f,f,c),L(u,f),T(c,w,l),Y(f,c,Ar),K(f,f,w),Y(c,c,f),Y(f,w,l),Y(w,u,a),L(u,y),d(f,u,t),d(c,w,t);for(o=0;o<16;o++)a[o+16]=f[o],a[o+32]=c[o],a[o+48]=u[o],a[o+64]=w[o];var s=a.subarray(32),h=a.subarray(16);return k(s,s),Y(h,h,s),x(r,h),0}function P(r,n){return R(r,n,br)}function O(r,n){return gr(n,32),P(r,n)}function F(r,n,e){var t=new Uint8Array(32);return R(t,e,n),y(r,vr,t,Br)}function N(r,n,e,t,o,i){var a=new Uint8Array(32);return F(a,o,i),Kr(r,n,e,t,a)}function C(r,n,e,t,o,i){var a=new Uint8Array(32);return F(a,o,i),Tr(r,n,e,t,a)}function M(){var r,n,e,t=0,o=0,i=0,a=0,f=65535;for(e=0;e>>16,i+=n&f,a+=n>>>16;return o+=t>>>16,i+=o>>>16,a+=i>>>16,new sr(i&f|a<<16,t&f|o<<16)}function G(r,n){return new sr(r.hi>>>n,r.lo>>>n|r.hi<<32-n)}function Z(){var r,n=0,e=0;for(r=0;r>>n|r.lo<>>n|r.hi<>>n|r.hi<>>n|r.lo<=128;){for(a=0;a<16;a++)y[a]=t(n,8*a+l);for(a=0;a<80;a++){for(f=0;f<8;f++)c[f]=w[f];for(o=M(w[7],X(w[4]),q(w[4],w[5],w[6]),Yr[a],y[a%16]),c[7]=M(o,V(w[0]),I(w[0],w[1],w[2])),c[3]=M(c[3],o),f=0;f<8;f++)w[(f+1)%8]=c[f];if(a%16===15)for(f=0;f<16;f++)y[f]=M(y[f],y[(f+9)%16],D(y[(f+1)%16]),H(y[(f+14)%16]))}for(a=0;a<8;a++)w[a]=M(w[a],u[a]),u[a]=w[a];l+=128,e-=128}for(a=0;a<8;a++)i(r,8*a,u[a]);return e}function Q(r,n,e){var t,o=new Uint8Array(64),a=new Uint8Array(256),f=e;for(t=0;t<64;t++)o[t]=Lr[t];for(J(o,n,e),e%=128,t=0;t<256;t++)a[t]=0;for(t=0;t=0;--o)t=e[o/8|0]>>(7&o)&1,$(r,n,t),W(n,r),W(r,r),$(r,n,t)}function er(r,n){var e=[hr(),hr(),hr(),hr()];U(e[0],dr),U(e[1],xr),U(e[2],_r),Y(e[3],dr,xr),nr(r,e,n)}function tr(r,n,e){var t,o=new Uint8Array(64),i=[hr(),hr(),hr(),hr()];for(e||gr(n,32),Q(o,n,32),o[0]&=248,o[31]&=127,o[31]|=64,er(i,o),rr(r,i),t=0;t<32;t++)n[t+32]=r[t];return 0}function or(r,n){var e,t,o,i;for(t=63;t>=32;--t){for(e=0,o=t-32,i=t-12;o>8,n[o]-=256*e;n[o]+=e,n[t]=0}for(e=0,o=0;o<32;o++)n[o]+=e-(n[31]>>4)*kr[o],e=n[o]>>8,n[o]&=255;for(o=0;o<32;o++)n[o]-=e*kr[o];for(t=0;t<32;t++)n[t+1]+=n[t]>>8,r[t]=255&n[t]}function ir(r){var n,e=new Float64Array(64);for(n=0;n<64;n++)e[n]=r[n];for(n=0;n<64;n++)r[n]=0;or(r,e)}function ar(r,n,e,t){var o,i,a=new Uint8Array(64),f=new Uint8Array(64),u=new Uint8Array(64),c=new Float64Array(64),w=[hr(),hr(),hr(),hr()];Q(a,t,32),a[0]&=248,a[31]&=127,a[31]|=64;var y=e+64;for(o=0;o>7&&T(r[0],pr,r[0]),Y(r[3],r[0],r[1]),0)}function ur(r,n,e,t){var o,i,a=new Uint8Array(32),f=new Uint8Array(64),c=[hr(),hr(),hr(),hr()],w=[hr(),hr(),hr(),hr()];if(i=-1,e<64)return-1;if(fr(w,t))return-1;for(o=0;o=0},r.sign.keyPair=function(){var r=new Uint8Array(Vr),n=new Uint8Array(Xr);return tr(r,n),{publicKey:r,secretKey:n}},r.sign.keyPair.fromSecretKey=function(r){if(yr(r),r.length!==Xr)throw new Error("bad secret key size");for(var n=new Uint8Array(Vr),e=0;e/dev/null && browserify test/browser/init.js test/*.quick.js | uglifyjs -c -m -o test/browser/_bundle-quick.js 2>/dev/null", - "test": "npm run test-node-all && npm run test-browser", - "bench": "node test/benchmark/bench.js", - "lint": "eslint nacl.js nacl-fast.js test/*.js test/benchmark/*.js" - }, - "repository": { - "type": "git", - "url": "https://github.com/dchest/tweetnacl-js.git" - }, - "keywords": [ - "crypto", - "cryptography", - "curve25519", - "ed25519", - "encrypt", - "hash", - "key", - "nacl", - "poly1305", - "public", - "salsa20", - "signatures" - ], - "author": "TweetNaCl-js contributors", - "license": "Unlicense", - "bugs": { - "url": "https://github.com/dchest/tweetnacl-js/issues" - }, - "homepage": "https://tweetnacl.js.org", - "devDependencies": { - "browserify": "^13.0.0", - "eslint": "^2.2.0", - "faucet": "^0.0.1", - "tap-browser-color": "^0.1.2", - "tape": "^4.4.0", - "tape-run": "^2.1.3", - "tweetnacl-util": "^0.13.3", - "uglify-js": "^2.6.1" - }, - "browser": { - "buffer": false, - "crypto": false - } -} diff --git a/reverse_engineering/node_modules/undici-types/README.md b/reverse_engineering/node_modules/undici-types/README.md deleted file mode 100644 index 20a721c4..00000000 --- a/reverse_engineering/node_modules/undici-types/README.md +++ /dev/null @@ -1,6 +0,0 @@ -# undici-types - -This package is a dual-publish of the [undici](https://www.npmjs.com/package/undici) library types. The `undici` package **still contains types**. This package is for users who _only_ need undici types (such as for `@types/node`). It is published alongside every release of `undici`, so you can always use the same version. - -- [GitHub nodejs/undici](https://github.com/nodejs/undici) -- [Undici Documentation](https://undici.nodejs.org/#/) diff --git a/reverse_engineering/node_modules/undici-types/agent.d.ts b/reverse_engineering/node_modules/undici-types/agent.d.ts deleted file mode 100644 index 58081ce9..00000000 --- a/reverse_engineering/node_modules/undici-types/agent.d.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { URL } from 'url' -import Pool from './pool' -import Dispatcher from "./dispatcher"; - -export default Agent - -declare class Agent extends Dispatcher{ - constructor(opts?: Agent.Options) - /** `true` after `dispatcher.close()` has been called. */ - closed: boolean; - /** `true` after `dispatcher.destroyed()` has been called or `dispatcher.close()` has been called and the dispatcher shutdown has completed. */ - destroyed: boolean; - /** Dispatches a request. */ - dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; -} - -declare namespace Agent { - export interface Options extends Pool.Options { - /** Default: `(origin, opts) => new Pool(origin, opts)`. */ - factory?(origin: string | URL, opts: Object): Dispatcher; - /** Integer. Default: `0` */ - maxRedirections?: number; - - interceptors?: { Agent?: readonly Dispatcher.DispatchInterceptor[] } & Pool.Options["interceptors"] - } - - export interface DispatchOptions extends Dispatcher.DispatchOptions { - /** Integer. */ - maxRedirections?: number; - } -} diff --git a/reverse_engineering/node_modules/undici-types/api.d.ts b/reverse_engineering/node_modules/undici-types/api.d.ts deleted file mode 100644 index 400341dd..00000000 --- a/reverse_engineering/node_modules/undici-types/api.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { URL, UrlObject } from 'url' -import { Duplex } from 'stream' -import Dispatcher from './dispatcher' - -export { - request, - stream, - pipeline, - connect, - upgrade, -} - -/** Performs an HTTP request. */ -declare function request( - url: string | URL | UrlObject, - options?: { dispatcher?: Dispatcher } & Omit & Partial>, -): Promise; - -/** A faster version of `request`. */ -declare function stream( - url: string | URL | UrlObject, - options: { dispatcher?: Dispatcher } & Omit, - factory: Dispatcher.StreamFactory -): Promise; - -/** For easy use with `stream.pipeline`. */ -declare function pipeline( - url: string | URL | UrlObject, - options: { dispatcher?: Dispatcher } & Omit, - handler: Dispatcher.PipelineHandler -): Duplex; - -/** Starts two-way communications with the requested resource. */ -declare function connect( - url: string | URL | UrlObject, - options?: { dispatcher?: Dispatcher } & Omit -): Promise; - -/** Upgrade to a different protocol. */ -declare function upgrade( - url: string | URL | UrlObject, - options?: { dispatcher?: Dispatcher } & Omit -): Promise; diff --git a/reverse_engineering/node_modules/undici-types/balanced-pool.d.ts b/reverse_engineering/node_modules/undici-types/balanced-pool.d.ts deleted file mode 100644 index d1e93758..00000000 --- a/reverse_engineering/node_modules/undici-types/balanced-pool.d.ts +++ /dev/null @@ -1,18 +0,0 @@ -import Pool from './pool' -import Dispatcher from './dispatcher' -import { URL } from 'url' - -export default BalancedPool - -declare class BalancedPool extends Dispatcher { - constructor(url: string | string[] | URL | URL[], options?: Pool.Options); - - addUpstream(upstream: string | URL): BalancedPool; - removeUpstream(upstream: string | URL): BalancedPool; - upstreams: Array; - - /** `true` after `pool.close()` has been called. */ - closed: boolean; - /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */ - destroyed: boolean; -} diff --git a/reverse_engineering/node_modules/undici-types/cache.d.ts b/reverse_engineering/node_modules/undici-types/cache.d.ts deleted file mode 100644 index 4c333357..00000000 --- a/reverse_engineering/node_modules/undici-types/cache.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -import type { RequestInfo, Response, Request } from './fetch' - -export interface CacheStorage { - match (request: RequestInfo, options?: MultiCacheQueryOptions): Promise, - has (cacheName: string): Promise, - open (cacheName: string): Promise, - delete (cacheName: string): Promise, - keys (): Promise -} - -declare const CacheStorage: { - prototype: CacheStorage - new(): CacheStorage -} - -export interface Cache { - match (request: RequestInfo, options?: CacheQueryOptions): Promise, - matchAll (request?: RequestInfo, options?: CacheQueryOptions): Promise, - add (request: RequestInfo): Promise, - addAll (requests: RequestInfo[]): Promise, - put (request: RequestInfo, response: Response): Promise, - delete (request: RequestInfo, options?: CacheQueryOptions): Promise, - keys (request?: RequestInfo, options?: CacheQueryOptions): Promise -} - -export interface CacheQueryOptions { - ignoreSearch?: boolean, - ignoreMethod?: boolean, - ignoreVary?: boolean -} - -export interface MultiCacheQueryOptions extends CacheQueryOptions { - cacheName?: string -} - -export declare const caches: CacheStorage diff --git a/reverse_engineering/node_modules/undici-types/client.d.ts b/reverse_engineering/node_modules/undici-types/client.d.ts deleted file mode 100644 index 74948b15..00000000 --- a/reverse_engineering/node_modules/undici-types/client.d.ts +++ /dev/null @@ -1,97 +0,0 @@ -import { URL } from 'url' -import { TlsOptions } from 'tls' -import Dispatcher from './dispatcher' -import buildConnector from "./connector"; - -/** - * A basic HTTP/1.1 client, mapped on top a single TCP/TLS connection. Pipelining is disabled by default. - */ -export class Client extends Dispatcher { - constructor(url: string | URL, options?: Client.Options); - /** Property to get and set the pipelining factor. */ - pipelining: number; - /** `true` after `client.close()` has been called. */ - closed: boolean; - /** `true` after `client.destroyed()` has been called or `client.close()` has been called and the client shutdown has completed. */ - destroyed: boolean; -} - -export declare namespace Client { - export interface OptionsInterceptors { - Client: readonly Dispatcher.DispatchInterceptor[]; - } - export interface Options { - /** TODO */ - interceptors?: OptionsInterceptors; - /** The maximum length of request headers in bytes. Default: Node.js' `--max-http-header-size` or `16384` (16KiB). */ - maxHeaderSize?: number; - /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers (Node 14 and above only). Default: `300e3` milliseconds (300s). */ - headersTimeout?: number; - /** @deprecated unsupported socketTimeout, use headersTimeout & bodyTimeout instead */ - socketTimeout?: never; - /** @deprecated unsupported requestTimeout, use headersTimeout & bodyTimeout instead */ - requestTimeout?: never; - /** TODO */ - connectTimeout?: number; - /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use `0` to disable it entirely. Default: `300e3` milliseconds (300s). */ - bodyTimeout?: number; - /** @deprecated unsupported idleTimeout, use keepAliveTimeout instead */ - idleTimeout?: never; - /** @deprecated unsupported keepAlive, use pipelining=0 instead */ - keepAlive?: never; - /** the timeout, in milliseconds, after which a socket without active requests will time out. Monitors time between activity on a connected socket. This value may be overridden by *keep-alive* hints from the server. Default: `4e3` milliseconds (4s). */ - keepAliveTimeout?: number; - /** @deprecated unsupported maxKeepAliveTimeout, use keepAliveMaxTimeout instead */ - maxKeepAliveTimeout?: never; - /** the maximum allowed `idleTimeout`, in milliseconds, when overridden by *keep-alive* hints from the server. Default: `600e3` milliseconds (10min). */ - keepAliveMaxTimeout?: number; - /** A number of milliseconds subtracted from server *keep-alive* hints when overriding `idleTimeout` to account for timing inaccuracies caused by e.g. transport latency. Default: `1e3` milliseconds (1s). */ - keepAliveTimeoutThreshold?: number; - /** TODO */ - socketPath?: string; - /** The amount of concurrent requests to be sent over the single TCP/TLS connection according to [RFC7230](https://tools.ietf.org/html/rfc7230#section-6.3.2). Default: `1`. */ - pipelining?: number; - /** @deprecated use the connect option instead */ - tls?: never; - /** If `true`, an error is thrown when the request content-length header doesn't match the length of the request body. Default: `true`. */ - strictContentLength?: boolean; - /** TODO */ - maxCachedSessions?: number; - /** TODO */ - maxRedirections?: number; - /** TODO */ - connect?: buildConnector.BuildOptions | buildConnector.connector; - /** TODO */ - maxRequestsPerClient?: number; - /** TODO */ - localAddress?: string; - /** Max response body size in bytes, -1 is disabled */ - maxResponseSize?: number; - /** Enables a family autodetection algorithm that loosely implements section 5 of RFC 8305. */ - autoSelectFamily?: boolean; - /** The amount of time in milliseconds to wait for a connection attempt to finish before trying the next address when using the `autoSelectFamily` option. */ - autoSelectFamilyAttemptTimeout?: number; - /** - * @description Enables support for H2 if the server has assigned bigger priority to it through ALPN negotiation. - * @default false - */ - allowH2?: boolean; - /** - * @description Dictates the maximum number of concurrent streams for a single H2 session. It can be overriden by a SETTINGS remote frame. - * @default 100 - */ - maxConcurrentStreams?: number - } - export interface SocketInfo { - localAddress?: string - localPort?: number - remoteAddress?: string - remotePort?: number - remoteFamily?: string - timeout?: number - bytesWritten?: number - bytesRead?: number - } -} - -export default Client; diff --git a/reverse_engineering/node_modules/undici-types/connector.d.ts b/reverse_engineering/node_modules/undici-types/connector.d.ts deleted file mode 100644 index bd924339..00000000 --- a/reverse_engineering/node_modules/undici-types/connector.d.ts +++ /dev/null @@ -1,34 +0,0 @@ -import { TLSSocket, ConnectionOptions } from 'tls' -import { IpcNetConnectOpts, Socket, TcpNetConnectOpts } from 'net' - -export default buildConnector -declare function buildConnector (options?: buildConnector.BuildOptions): buildConnector.connector - -declare namespace buildConnector { - export type BuildOptions = (ConnectionOptions | TcpNetConnectOpts | IpcNetConnectOpts) & { - allowH2?: boolean; - maxCachedSessions?: number | null; - socketPath?: string | null; - timeout?: number | null; - port?: number; - keepAlive?: boolean | null; - keepAliveInitialDelay?: number | null; - } - - export interface Options { - hostname: string - host?: string - protocol: string - port: string - servername?: string - localAddress?: string | null - httpSocket?: Socket - } - - export type Callback = (...args: CallbackArgs) => void - type CallbackArgs = [null, Socket | TLSSocket] | [Error, null] - - export interface connector { - (options: buildConnector.Options, callback: buildConnector.Callback): void - } -} diff --git a/reverse_engineering/node_modules/undici-types/content-type.d.ts b/reverse_engineering/node_modules/undici-types/content-type.d.ts deleted file mode 100644 index f2a87f1b..00000000 --- a/reverse_engineering/node_modules/undici-types/content-type.d.ts +++ /dev/null @@ -1,21 +0,0 @@ -/// - -interface MIMEType { - type: string - subtype: string - parameters: Map - essence: string -} - -/** - * Parse a string to a {@link MIMEType} object. Returns `failure` if the string - * couldn't be parsed. - * @see https://mimesniff.spec.whatwg.org/#parse-a-mime-type - */ -export function parseMIMEType (input: string): 'failure' | MIMEType - -/** - * Convert a MIMEType object to a string. - * @see https://mimesniff.spec.whatwg.org/#serialize-a-mime-type - */ -export function serializeAMimeType (mimeType: MIMEType): string diff --git a/reverse_engineering/node_modules/undici-types/cookies.d.ts b/reverse_engineering/node_modules/undici-types/cookies.d.ts deleted file mode 100644 index aa38cae4..00000000 --- a/reverse_engineering/node_modules/undici-types/cookies.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -/// - -import type { Headers } from './fetch' - -export interface Cookie { - name: string - value: string - expires?: Date | number - maxAge?: number - domain?: string - path?: string - secure?: boolean - httpOnly?: boolean - sameSite?: 'Strict' | 'Lax' | 'None' - unparsed?: string[] -} - -export function deleteCookie ( - headers: Headers, - name: string, - attributes?: { name?: string, domain?: string } -): void - -export function getCookies (headers: Headers): Record - -export function getSetCookies (headers: Headers): Cookie[] - -export function setCookie (headers: Headers, cookie: Cookie): void diff --git a/reverse_engineering/node_modules/undici-types/diagnostics-channel.d.ts b/reverse_engineering/node_modules/undici-types/diagnostics-channel.d.ts deleted file mode 100644 index 85d44823..00000000 --- a/reverse_engineering/node_modules/undici-types/diagnostics-channel.d.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { Socket } from "net"; -import { URL } from "url"; -import Connector from "./connector"; -import Dispatcher from "./dispatcher"; - -declare namespace DiagnosticsChannel { - interface Request { - origin?: string | URL; - completed: boolean; - method?: Dispatcher.HttpMethod; - path: string; - headers: string; - addHeader(key: string, value: string): Request; - } - interface Response { - statusCode: number; - statusText: string; - headers: Array; - } - type Error = unknown; - interface ConnectParams { - host: URL["host"]; - hostname: URL["hostname"]; - protocol: URL["protocol"]; - port: URL["port"]; - servername: string | null; - } - type Connector = Connector.connector; - export interface RequestCreateMessage { - request: Request; - } - export interface RequestBodySentMessage { - request: Request; - } - export interface RequestHeadersMessage { - request: Request; - response: Response; - } - export interface RequestTrailersMessage { - request: Request; - trailers: Array; - } - export interface RequestErrorMessage { - request: Request; - error: Error; - } - export interface ClientSendHeadersMessage { - request: Request; - headers: string; - socket: Socket; - } - export interface ClientBeforeConnectMessage { - connectParams: ConnectParams; - connector: Connector; - } - export interface ClientConnectedMessage { - socket: Socket; - connectParams: ConnectParams; - connector: Connector; - } - export interface ClientConnectErrorMessage { - error: Error; - socket: Socket; - connectParams: ConnectParams; - connector: Connector; - } -} diff --git a/reverse_engineering/node_modules/undici-types/dispatcher.d.ts b/reverse_engineering/node_modules/undici-types/dispatcher.d.ts deleted file mode 100644 index 816db19d..00000000 --- a/reverse_engineering/node_modules/undici-types/dispatcher.d.ts +++ /dev/null @@ -1,241 +0,0 @@ -import { URL } from 'url' -import { Duplex, Readable, Writable } from 'stream' -import { EventEmitter } from 'events' -import { Blob } from 'buffer' -import { IncomingHttpHeaders } from './header' -import BodyReadable from './readable' -import { FormData } from './formdata' -import Errors from './errors' - -type AbortSignal = unknown; - -export default Dispatcher - -/** Dispatcher is the core API used to dispatch requests. */ -declare class Dispatcher extends EventEmitter { - /** Dispatches a request. This API is expected to evolve through semver-major versions and is less stable than the preceding higher level APIs. It is primarily intended for library developers who implement higher level APIs on top of this. */ - dispatch(options: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; - /** Starts two-way communications with the requested resource. */ - connect(options: Dispatcher.ConnectOptions): Promise; - connect(options: Dispatcher.ConnectOptions, callback: (err: Error | null, data: Dispatcher.ConnectData) => void): void; - /** Performs an HTTP request. */ - request(options: Dispatcher.RequestOptions): Promise; - request(options: Dispatcher.RequestOptions, callback: (err: Error | null, data: Dispatcher.ResponseData) => void): void; - /** For easy use with `stream.pipeline`. */ - pipeline(options: Dispatcher.PipelineOptions, handler: Dispatcher.PipelineHandler): Duplex; - /** A faster version of `Dispatcher.request`. */ - stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory): Promise; - stream(options: Dispatcher.RequestOptions, factory: Dispatcher.StreamFactory, callback: (err: Error | null, data: Dispatcher.StreamData) => void): void; - /** Upgrade to a different protocol. */ - upgrade(options: Dispatcher.UpgradeOptions): Promise; - upgrade(options: Dispatcher.UpgradeOptions, callback: (err: Error | null, data: Dispatcher.UpgradeData) => void): void; - /** Closes the client and gracefully waits for enqueued requests to complete before invoking the callback (or returning a promise if no callback is provided). */ - close(): Promise; - close(callback: () => void): void; - /** Destroy the client abruptly with the given err. All the pending and running requests will be asynchronously aborted and error. Waits until socket is closed before invoking the callback (or returning a promise if no callback is provided). Since this operation is asynchronously dispatched there might still be some progress on dispatched requests. */ - destroy(): Promise; - destroy(err: Error | null): Promise; - destroy(callback: () => void): void; - destroy(err: Error | null, callback: () => void): void; - - on(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - on(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - on(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - on(eventName: 'drain', callback: (origin: URL) => void): this; - - - once(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - once(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - once(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - once(eventName: 'drain', callback: (origin: URL) => void): this; - - - off(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - off(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - off(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - off(eventName: 'drain', callback: (origin: URL) => void): this; - - - addListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - addListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - addListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - addListener(eventName: 'drain', callback: (origin: URL) => void): this; - - removeListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - removeListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - removeListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - removeListener(eventName: 'drain', callback: (origin: URL) => void): this; - - prependListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - prependListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - prependListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - prependListener(eventName: 'drain', callback: (origin: URL) => void): this; - - prependOnceListener(eventName: 'connect', callback: (origin: URL, targets: readonly Dispatcher[]) => void): this; - prependOnceListener(eventName: 'disconnect', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - prependOnceListener(eventName: 'connectionError', callback: (origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void): this; - prependOnceListener(eventName: 'drain', callback: (origin: URL) => void): this; - - listeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[] - listeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; - listeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; - listeners(eventName: 'drain'): ((origin: URL) => void)[]; - - rawListeners(eventName: 'connect'): ((origin: URL, targets: readonly Dispatcher[]) => void)[] - rawListeners(eventName: 'disconnect'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; - rawListeners(eventName: 'connectionError'): ((origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError) => void)[]; - rawListeners(eventName: 'drain'): ((origin: URL) => void)[]; - - emit(eventName: 'connect', origin: URL, targets: readonly Dispatcher[]): boolean; - emit(eventName: 'disconnect', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean; - emit(eventName: 'connectionError', origin: URL, targets: readonly Dispatcher[], error: Errors.UndiciError): boolean; - emit(eventName: 'drain', origin: URL): boolean; -} - -declare namespace Dispatcher { - export interface DispatchOptions { - origin?: string | URL; - path: string; - method: HttpMethod; - /** Default: `null` */ - body?: string | Buffer | Uint8Array | Readable | null | FormData; - /** Default: `null` */ - headers?: IncomingHttpHeaders | string[] | null; - /** Query string params to be embedded in the request URL. Default: `null` */ - query?: Record; - /** Whether the requests can be safely retried or not. If `false` the request won't be sent until all preceding requests in the pipeline have completed. Default: `true` if `method` is `HEAD` or `GET`. */ - idempotent?: boolean; - /** Whether the response is expected to take a long time and would end up blocking the pipeline. When this is set to `true` further pipelining will be avoided on the same connection until headers have been received. */ - blocking?: boolean; - /** Upgrade the request. Should be used to specify the kind of upgrade i.e. `'Websocket'`. Default: `method === 'CONNECT' || null`. */ - upgrade?: boolean | string | null; - /** The amount of time, in milliseconds, the parser will wait to receive the complete HTTP headers. Defaults to 300 seconds. */ - headersTimeout?: number | null; - /** The timeout after which a request will time out, in milliseconds. Monitors time between receiving body data. Use 0 to disable it entirely. Defaults to 300 seconds. */ - bodyTimeout?: number | null; - /** Whether the request should stablish a keep-alive or not. Default `false` */ - reset?: boolean; - /** Whether Undici should throw an error upon receiving a 4xx or 5xx response from the server. Defaults to false */ - throwOnError?: boolean; - /** For H2, it appends the expect: 100-continue header, and halts the request body until a 100-continue is received from the remote server*/ - expectContinue?: boolean; - } - export interface ConnectOptions { - path: string; - /** Default: `null` */ - headers?: IncomingHttpHeaders | string[] | null; - /** Default: `null` */ - signal?: AbortSignal | EventEmitter | null; - /** This argument parameter is passed through to `ConnectData` */ - opaque?: unknown; - /** Default: 0 */ - maxRedirections?: number; - /** Default: `null` */ - responseHeader?: 'raw' | null; - } - export interface RequestOptions extends DispatchOptions { - /** Default: `null` */ - opaque?: unknown; - /** Default: `null` */ - signal?: AbortSignal | EventEmitter | null; - /** Default: 0 */ - maxRedirections?: number; - /** Default: `null` */ - onInfo?: (info: { statusCode: number, headers: Record }) => void; - /** Default: `null` */ - responseHeader?: 'raw' | null; - /** Default: `64 KiB` */ - highWaterMark?: number; - } - export interface PipelineOptions extends RequestOptions { - /** `true` if the `handler` will return an object stream. Default: `false` */ - objectMode?: boolean; - } - export interface UpgradeOptions { - path: string; - /** Default: `'GET'` */ - method?: string; - /** Default: `null` */ - headers?: IncomingHttpHeaders | string[] | null; - /** A string of comma separated protocols, in descending preference order. Default: `'Websocket'` */ - protocol?: string; - /** Default: `null` */ - signal?: AbortSignal | EventEmitter | null; - /** Default: 0 */ - maxRedirections?: number; - /** Default: `null` */ - responseHeader?: 'raw' | null; - } - export interface ConnectData { - statusCode: number; - headers: IncomingHttpHeaders; - socket: Duplex; - opaque: unknown; - } - export interface ResponseData { - statusCode: number; - headers: IncomingHttpHeaders; - body: BodyReadable & BodyMixin; - trailers: Record; - opaque: unknown; - context: object; - } - export interface PipelineHandlerData { - statusCode: number; - headers: IncomingHttpHeaders; - opaque: unknown; - body: BodyReadable; - context: object; - } - export interface StreamData { - opaque: unknown; - trailers: Record; - } - export interface UpgradeData { - headers: IncomingHttpHeaders; - socket: Duplex; - opaque: unknown; - } - export interface StreamFactoryData { - statusCode: number; - headers: IncomingHttpHeaders; - opaque: unknown; - context: object; - } - export type StreamFactory = (data: StreamFactoryData) => Writable; - export interface DispatchHandlers { - /** Invoked before request is dispatched on socket. May be invoked multiple times when a request is retried when the request at the head of the pipeline fails. */ - onConnect?(abort: () => void): void; - /** Invoked when an error has occurred. */ - onError?(err: Error): void; - /** Invoked when request is upgraded either due to a `Upgrade` header or `CONNECT` method. */ - onUpgrade?(statusCode: number, headers: Buffer[] | string[] | null, socket: Duplex): void; - /** Invoked when statusCode and headers have been received. May be invoked multiple times due to 1xx informational headers. */ - onHeaders?(statusCode: number, headers: Buffer[] | string[] | null, resume: () => void): boolean; - /** Invoked when response payload data is received. */ - onData?(chunk: Buffer): boolean; - /** Invoked when response payload and trailers have been received and the request has completed. */ - onComplete?(trailers: string[] | null): void; - /** Invoked when a body chunk is sent to the server. May be invoked multiple times for chunked requests */ - onBodySent?(chunkSize: number, totalBytesSent: number): void; - } - export type PipelineHandler = (data: PipelineHandlerData) => Readable; - export type HttpMethod = 'GET' | 'HEAD' | 'POST' | 'PUT' | 'DELETE' | 'CONNECT' | 'OPTIONS' | 'TRACE' | 'PATCH'; - - /** - * @link https://fetch.spec.whatwg.org/#body-mixin - */ - interface BodyMixin { - readonly body?: never; // throws on node v16.6.0 - readonly bodyUsed: boolean; - arrayBuffer(): Promise; - blob(): Promise; - formData(): Promise; - json(): Promise; - text(): Promise; - } - - export interface DispatchInterceptor { - (dispatch: Dispatcher['dispatch']): Dispatcher['dispatch'] - } -} diff --git a/reverse_engineering/node_modules/undici-types/errors.d.ts b/reverse_engineering/node_modules/undici-types/errors.d.ts deleted file mode 100644 index 7923ddd9..00000000 --- a/reverse_engineering/node_modules/undici-types/errors.d.ts +++ /dev/null @@ -1,128 +0,0 @@ -import { IncomingHttpHeaders } from "./header"; -import Client from './client' - -export default Errors - -declare namespace Errors { - export class UndiciError extends Error { - name: string; - code: string; - } - - /** Connect timeout error. */ - export class ConnectTimeoutError extends UndiciError { - name: 'ConnectTimeoutError'; - code: 'UND_ERR_CONNECT_TIMEOUT'; - } - - /** A header exceeds the `headersTimeout` option. */ - export class HeadersTimeoutError extends UndiciError { - name: 'HeadersTimeoutError'; - code: 'UND_ERR_HEADERS_TIMEOUT'; - } - - /** Headers overflow error. */ - export class HeadersOverflowError extends UndiciError { - name: 'HeadersOverflowError' - code: 'UND_ERR_HEADERS_OVERFLOW' - } - - /** A body exceeds the `bodyTimeout` option. */ - export class BodyTimeoutError extends UndiciError { - name: 'BodyTimeoutError'; - code: 'UND_ERR_BODY_TIMEOUT'; - } - - export class ResponseStatusCodeError extends UndiciError { - constructor ( - message?: string, - statusCode?: number, - headers?: IncomingHttpHeaders | string[] | null, - body?: null | Record | string - ); - name: 'ResponseStatusCodeError'; - code: 'UND_ERR_RESPONSE_STATUS_CODE'; - body: null | Record | string - status: number - statusCode: number - headers: IncomingHttpHeaders | string[] | null; - } - - /** Passed an invalid argument. */ - export class InvalidArgumentError extends UndiciError { - name: 'InvalidArgumentError'; - code: 'UND_ERR_INVALID_ARG'; - } - - /** Returned an invalid value. */ - export class InvalidReturnValueError extends UndiciError { - name: 'InvalidReturnValueError'; - code: 'UND_ERR_INVALID_RETURN_VALUE'; - } - - /** The request has been aborted by the user. */ - export class RequestAbortedError extends UndiciError { - name: 'AbortError'; - code: 'UND_ERR_ABORTED'; - } - - /** Expected error with reason. */ - export class InformationalError extends UndiciError { - name: 'InformationalError'; - code: 'UND_ERR_INFO'; - } - - /** Request body length does not match content-length header. */ - export class RequestContentLengthMismatchError extends UndiciError { - name: 'RequestContentLengthMismatchError'; - code: 'UND_ERR_REQ_CONTENT_LENGTH_MISMATCH'; - } - - /** Response body length does not match content-length header. */ - export class ResponseContentLengthMismatchError extends UndiciError { - name: 'ResponseContentLengthMismatchError'; - code: 'UND_ERR_RES_CONTENT_LENGTH_MISMATCH'; - } - - /** Trying to use a destroyed client. */ - export class ClientDestroyedError extends UndiciError { - name: 'ClientDestroyedError'; - code: 'UND_ERR_DESTROYED'; - } - - /** Trying to use a closed client. */ - export class ClientClosedError extends UndiciError { - name: 'ClientClosedError'; - code: 'UND_ERR_CLOSED'; - } - - /** There is an error with the socket. */ - export class SocketError extends UndiciError { - name: 'SocketError'; - code: 'UND_ERR_SOCKET'; - socket: Client.SocketInfo | null - } - - /** Encountered unsupported functionality. */ - export class NotSupportedError extends UndiciError { - name: 'NotSupportedError'; - code: 'UND_ERR_NOT_SUPPORTED'; - } - - /** No upstream has been added to the BalancedPool. */ - export class BalancedPoolMissingUpstreamError extends UndiciError { - name: 'MissingUpstreamError'; - code: 'UND_ERR_BPL_MISSING_UPSTREAM'; - } - - export class HTTPParserError extends UndiciError { - name: 'HTTPParserError'; - code: string; - } - - /** The response exceed the length allowed. */ - export class ResponseExceededMaxSizeError extends UndiciError { - name: 'ResponseExceededMaxSizeError'; - code: 'UND_ERR_RES_EXCEEDED_MAX_SIZE'; - } -} diff --git a/reverse_engineering/node_modules/undici-types/fetch.d.ts b/reverse_engineering/node_modules/undici-types/fetch.d.ts deleted file mode 100644 index fa4619c9..00000000 --- a/reverse_engineering/node_modules/undici-types/fetch.d.ts +++ /dev/null @@ -1,209 +0,0 @@ -// based on https://github.com/Ethan-Arrowood/undici-fetch/blob/249269714db874351589d2d364a0645d5160ae71/index.d.ts (MIT license) -// and https://github.com/node-fetch/node-fetch/blob/914ce6be5ec67a8bab63d68510aabf07cb818b6d/index.d.ts (MIT license) -/// - -import { Blob } from 'buffer' -import { URL, URLSearchParams } from 'url' -import { ReadableStream } from 'stream/web' -import { FormData } from './formdata' - -import Dispatcher from './dispatcher' - -export type RequestInfo = string | URL | Request - -export declare function fetch ( - input: RequestInfo, - init?: RequestInit -): Promise - -export type BodyInit = - | ArrayBuffer - | AsyncIterable - | Blob - | FormData - | Iterable - | NodeJS.ArrayBufferView - | URLSearchParams - | null - | string - -export interface BodyMixin { - readonly body: ReadableStream | null - readonly bodyUsed: boolean - - readonly arrayBuffer: () => Promise - readonly blob: () => Promise - readonly formData: () => Promise - readonly json: () => Promise - readonly text: () => Promise -} - -export interface SpecIterator { - next(...args: [] | [TNext]): IteratorResult; -} - -export interface SpecIterableIterator extends SpecIterator { - [Symbol.iterator](): SpecIterableIterator; -} - -export interface SpecIterable { - [Symbol.iterator](): SpecIterator; -} - -export type HeadersInit = string[][] | Record> | Headers - -export declare class Headers implements SpecIterable<[string, string]> { - constructor (init?: HeadersInit) - readonly append: (name: string, value: string) => void - readonly delete: (name: string) => void - readonly get: (name: string) => string | null - readonly has: (name: string) => boolean - readonly set: (name: string, value: string) => void - readonly getSetCookie: () => string[] - readonly forEach: ( - callbackfn: (value: string, key: string, iterable: Headers) => void, - thisArg?: unknown - ) => void - - readonly keys: () => SpecIterableIterator - readonly values: () => SpecIterableIterator - readonly entries: () => SpecIterableIterator<[string, string]> - readonly [Symbol.iterator]: () => SpecIterator<[string, string]> -} - -export type RequestCache = - | 'default' - | 'force-cache' - | 'no-cache' - | 'no-store' - | 'only-if-cached' - | 'reload' - -export type RequestCredentials = 'omit' | 'include' | 'same-origin' - -type RequestDestination = - | '' - | 'audio' - | 'audioworklet' - | 'document' - | 'embed' - | 'font' - | 'image' - | 'manifest' - | 'object' - | 'paintworklet' - | 'report' - | 'script' - | 'sharedworker' - | 'style' - | 'track' - | 'video' - | 'worker' - | 'xslt' - -export interface RequestInit { - method?: string - keepalive?: boolean - headers?: HeadersInit - body?: BodyInit - redirect?: RequestRedirect - integrity?: string - signal?: AbortSignal - credentials?: RequestCredentials - mode?: RequestMode - referrer?: string - referrerPolicy?: ReferrerPolicy - window?: null - dispatcher?: Dispatcher - duplex?: RequestDuplex -} - -export type ReferrerPolicy = - | '' - | 'no-referrer' - | 'no-referrer-when-downgrade' - | 'origin' - | 'origin-when-cross-origin' - | 'same-origin' - | 'strict-origin' - | 'strict-origin-when-cross-origin' - | 'unsafe-url'; - -export type RequestMode = 'cors' | 'navigate' | 'no-cors' | 'same-origin' - -export type RequestRedirect = 'error' | 'follow' | 'manual' - -export type RequestDuplex = 'half' - -export declare class Request implements BodyMixin { - constructor (input: RequestInfo, init?: RequestInit) - - readonly cache: RequestCache - readonly credentials: RequestCredentials - readonly destination: RequestDestination - readonly headers: Headers - readonly integrity: string - readonly method: string - readonly mode: RequestMode - readonly redirect: RequestRedirect - readonly referrerPolicy: string - readonly url: string - - readonly keepalive: boolean - readonly signal: AbortSignal - readonly duplex: RequestDuplex - - readonly body: ReadableStream | null - readonly bodyUsed: boolean - - readonly arrayBuffer: () => Promise - readonly blob: () => Promise - readonly formData: () => Promise - readonly json: () => Promise - readonly text: () => Promise - - readonly clone: () => Request -} - -export interface ResponseInit { - readonly status?: number - readonly statusText?: string - readonly headers?: HeadersInit -} - -export type ResponseType = - | 'basic' - | 'cors' - | 'default' - | 'error' - | 'opaque' - | 'opaqueredirect' - -export type ResponseRedirectStatus = 301 | 302 | 303 | 307 | 308 - -export declare class Response implements BodyMixin { - constructor (body?: BodyInit, init?: ResponseInit) - - readonly headers: Headers - readonly ok: boolean - readonly status: number - readonly statusText: string - readonly type: ResponseType - readonly url: string - readonly redirected: boolean - - readonly body: ReadableStream | null - readonly bodyUsed: boolean - - readonly arrayBuffer: () => Promise - readonly blob: () => Promise - readonly formData: () => Promise - readonly json: () => Promise - readonly text: () => Promise - - readonly clone: () => Response - - static error (): Response - static json(data: any, init?: ResponseInit): Response - static redirect (url: string | URL, status: ResponseRedirectStatus): Response -} diff --git a/reverse_engineering/node_modules/undici-types/file.d.ts b/reverse_engineering/node_modules/undici-types/file.d.ts deleted file mode 100644 index c695b7ab..00000000 --- a/reverse_engineering/node_modules/undici-types/file.d.ts +++ /dev/null @@ -1,39 +0,0 @@ -// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/File.ts (MIT) -/// - -import { Blob } from 'buffer' - -export interface BlobPropertyBag { - type?: string - endings?: 'native' | 'transparent' -} - -export interface FilePropertyBag extends BlobPropertyBag { - /** - * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. - */ - lastModified?: number -} - -export declare class File extends Blob { - /** - * Creates a new File instance. - * - * @param fileBits An `Array` strings, or [`ArrayBuffer`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer), [`ArrayBufferView`](https://developer.mozilla.org/en-US/docs/Web/API/ArrayBufferView), [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) objects, or a mix of any of such objects, that will be put inside the [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). - * @param fileName The name of the file. - * @param options An options object containing optional attributes for the file. - */ - constructor(fileBits: ReadonlyArray, fileName: string, options?: FilePropertyBag) - - /** - * Name of the file referenced by the File object. - */ - readonly name: string - - /** - * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight). Files without a known last modified date return the current date. - */ - readonly lastModified: number - - readonly [Symbol.toStringTag]: string -} diff --git a/reverse_engineering/node_modules/undici-types/filereader.d.ts b/reverse_engineering/node_modules/undici-types/filereader.d.ts deleted file mode 100644 index f05d231b..00000000 --- a/reverse_engineering/node_modules/undici-types/filereader.d.ts +++ /dev/null @@ -1,54 +0,0 @@ -/// - -import { Blob } from 'buffer' -import { DOMException, Event, EventInit, EventTarget } from './patch' - -export declare class FileReader { - __proto__: EventTarget & FileReader - - constructor () - - readAsArrayBuffer (blob: Blob): void - readAsBinaryString (blob: Blob): void - readAsText (blob: Blob, encoding?: string): void - readAsDataURL (blob: Blob): void - - abort (): void - - static readonly EMPTY = 0 - static readonly LOADING = 1 - static readonly DONE = 2 - - readonly EMPTY = 0 - readonly LOADING = 1 - readonly DONE = 2 - - readonly readyState: number - - readonly result: string | ArrayBuffer | null - - readonly error: DOMException | null - - onloadstart: null | ((this: FileReader, event: ProgressEvent) => void) - onprogress: null | ((this: FileReader, event: ProgressEvent) => void) - onload: null | ((this: FileReader, event: ProgressEvent) => void) - onabort: null | ((this: FileReader, event: ProgressEvent) => void) - onerror: null | ((this: FileReader, event: ProgressEvent) => void) - onloadend: null | ((this: FileReader, event: ProgressEvent) => void) -} - -export interface ProgressEventInit extends EventInit { - lengthComputable?: boolean - loaded?: number - total?: number -} - -export declare class ProgressEvent { - __proto__: Event & ProgressEvent - - constructor (type: string, eventInitDict?: ProgressEventInit) - - readonly lengthComputable: boolean - readonly loaded: number - readonly total: number -} diff --git a/reverse_engineering/node_modules/undici-types/formdata.d.ts b/reverse_engineering/node_modules/undici-types/formdata.d.ts deleted file mode 100644 index df29a572..00000000 --- a/reverse_engineering/node_modules/undici-types/formdata.d.ts +++ /dev/null @@ -1,108 +0,0 @@ -// Based on https://github.com/octet-stream/form-data/blob/2d0f0dc371517444ce1f22cdde13f51995d0953a/lib/FormData.ts (MIT) -/// - -import { File } from './file' -import { SpecIterator, SpecIterableIterator } from './fetch' - -/** - * A `string` or `File` that represents a single value from a set of `FormData` key-value pairs. - */ -declare type FormDataEntryValue = string | File - -/** - * Provides a way to easily construct a set of key/value pairs representing form fields and their values, which can then be easily sent using fetch(). - */ -export declare class FormData { - /** - * Appends a new value onto an existing key inside a FormData object, - * or adds the key if it does not already exist. - * - * The difference between `set()` and `append()` is that if the specified key already exists, `set()` will overwrite all existing values with the new one, whereas `append()` will append the new value onto the end of the existing set of values. - * - * @param name The name of the field whose data is contained in `value`. - * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string. - * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. - */ - append(name: string, value: unknown, fileName?: string): void - - /** - * Set a new value for an existing key inside FormData, - * or add the new field if it does not already exist. - * - * @param name The name of the field whose data is contained in `value`. - * @param value The field's value. This can be [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) - or [`File`](https://developer.mozilla.org/en-US/docs/Web/API/File). If none of these are specified the value is converted to a string. - * @param fileName The filename reported to the server, when a Blob or File is passed as the second parameter. The default filename for Blob objects is "blob". The default filename for File objects is the file's filename. - * - */ - set(name: string, value: unknown, fileName?: string): void - - /** - * Returns the first value associated with a given key from within a `FormData` object. - * If you expect multiple values and want all of them, use the `getAll()` method instead. - * - * @param {string} name A name of the value you want to retrieve. - * - * @returns A `FormDataEntryValue` containing the value. If the key doesn't exist, the method returns null. - */ - get(name: string): FormDataEntryValue | null - - /** - * Returns all the values associated with a given key from within a `FormData` object. - * - * @param {string} name A name of the value you want to retrieve. - * - * @returns An array of `FormDataEntryValue` whose key matches the value passed in the `name` parameter. If the key doesn't exist, the method returns an empty list. - */ - getAll(name: string): FormDataEntryValue[] - - /** - * Returns a boolean stating whether a `FormData` object contains a certain key. - * - * @param name A string representing the name of the key you want to test for. - * - * @return A boolean value. - */ - has(name: string): boolean - - /** - * Deletes a key and its value(s) from a `FormData` object. - * - * @param name The name of the key you want to delete. - */ - delete(name: string): void - - /** - * Executes given callback function for each field of the FormData instance - */ - forEach: ( - callbackfn: (value: FormDataEntryValue, key: string, iterable: FormData) => void, - thisArg?: unknown - ) => void - - /** - * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all keys contained in this `FormData` object. - * Each key is a `string`. - */ - keys: () => SpecIterableIterator - - /** - * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through all values contained in this object `FormData` object. - * Each value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue). - */ - values: () => SpecIterableIterator - - /** - * Returns an [`iterator`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols) allowing to go through the `FormData` key/value pairs. - * The key of each pair is a string; the value is a [`FormDataValue`](https://developer.mozilla.org/en-US/docs/Web/API/FormDataEntryValue). - */ - entries: () => SpecIterableIterator<[string, FormDataEntryValue]> - - /** - * An alias for FormData#entries() - */ - [Symbol.iterator]: () => SpecIterableIterator<[string, FormDataEntryValue]> - - readonly [Symbol.toStringTag]: string -} diff --git a/reverse_engineering/node_modules/undici-types/global-dispatcher.d.ts b/reverse_engineering/node_modules/undici-types/global-dispatcher.d.ts deleted file mode 100644 index 728f95ce..00000000 --- a/reverse_engineering/node_modules/undici-types/global-dispatcher.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Dispatcher from "./dispatcher"; - -export { - getGlobalDispatcher, - setGlobalDispatcher -} - -declare function setGlobalDispatcher(dispatcher: DispatcherImplementation): void; -declare function getGlobalDispatcher(): Dispatcher; diff --git a/reverse_engineering/node_modules/undici-types/global-origin.d.ts b/reverse_engineering/node_modules/undici-types/global-origin.d.ts deleted file mode 100644 index 322542d6..00000000 --- a/reverse_engineering/node_modules/undici-types/global-origin.d.ts +++ /dev/null @@ -1,7 +0,0 @@ -export { - setGlobalOrigin, - getGlobalOrigin -} - -declare function setGlobalOrigin(origin: string | URL | undefined): void; -declare function getGlobalOrigin(): URL | undefined; \ No newline at end of file diff --git a/reverse_engineering/node_modules/undici-types/handlers.d.ts b/reverse_engineering/node_modules/undici-types/handlers.d.ts deleted file mode 100644 index eb4f5a9e..00000000 --- a/reverse_engineering/node_modules/undici-types/handlers.d.ts +++ /dev/null @@ -1,9 +0,0 @@ -import Dispatcher from "./dispatcher"; - -export declare class RedirectHandler implements Dispatcher.DispatchHandlers{ - constructor (dispatch: Dispatcher, maxRedirections: number, opts: Dispatcher.DispatchOptions, handler: Dispatcher.DispatchHandlers) -} - -export declare class DecoratorHandler implements Dispatcher.DispatchHandlers{ - constructor (handler: Dispatcher.DispatchHandlers) -} diff --git a/reverse_engineering/node_modules/undici-types/header.d.ts b/reverse_engineering/node_modules/undici-types/header.d.ts deleted file mode 100644 index bfdb3296..00000000 --- a/reverse_engineering/node_modules/undici-types/header.d.ts +++ /dev/null @@ -1,4 +0,0 @@ -/** - * The header type declaration of `undici`. - */ -export type IncomingHttpHeaders = Record; diff --git a/reverse_engineering/node_modules/undici-types/index.d.ts b/reverse_engineering/node_modules/undici-types/index.d.ts deleted file mode 100644 index 4589845b..00000000 --- a/reverse_engineering/node_modules/undici-types/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -import Dispatcher from'./dispatcher' -import { setGlobalDispatcher, getGlobalDispatcher } from './global-dispatcher' -import { setGlobalOrigin, getGlobalOrigin } from './global-origin' -import Pool from'./pool' -import { RedirectHandler, DecoratorHandler } from './handlers' - -import BalancedPool from './balanced-pool' -import Client from'./client' -import buildConnector from'./connector' -import errors from'./errors' -import Agent from'./agent' -import MockClient from'./mock-client' -import MockPool from'./mock-pool' -import MockAgent from'./mock-agent' -import mockErrors from'./mock-errors' -import ProxyAgent from'./proxy-agent' -import { request, pipeline, stream, connect, upgrade } from './api' - -export * from './cookies' -export * from './fetch' -export * from './file' -export * from './filereader' -export * from './formdata' -export * from './diagnostics-channel' -export * from './websocket' -export * from './content-type' -export * from './cache' -export { Interceptable } from './mock-interceptor' - -export { Dispatcher, BalancedPool, Pool, Client, buildConnector, errors, Agent, request, stream, pipeline, connect, upgrade, setGlobalDispatcher, getGlobalDispatcher, setGlobalOrigin, getGlobalOrigin, MockClient, MockPool, MockAgent, mockErrors, ProxyAgent, RedirectHandler, DecoratorHandler } -export default Undici - -declare namespace Undici { - var Dispatcher: typeof import('./dispatcher').default - var Pool: typeof import('./pool').default; - var RedirectHandler: typeof import ('./handlers').RedirectHandler - var DecoratorHandler: typeof import ('./handlers').DecoratorHandler - var createRedirectInterceptor: typeof import ('./interceptors').createRedirectInterceptor - var BalancedPool: typeof import('./balanced-pool').default; - var Client: typeof import('./client').default; - var buildConnector: typeof import('./connector').default; - var errors: typeof import('./errors').default; - var Agent: typeof import('./agent').default; - var setGlobalDispatcher: typeof import('./global-dispatcher').setGlobalDispatcher; - var getGlobalDispatcher: typeof import('./global-dispatcher').getGlobalDispatcher; - var request: typeof import('./api').request; - var stream: typeof import('./api').stream; - var pipeline: typeof import('./api').pipeline; - var connect: typeof import('./api').connect; - var upgrade: typeof import('./api').upgrade; - var MockClient: typeof import('./mock-client').default; - var MockPool: typeof import('./mock-pool').default; - var MockAgent: typeof import('./mock-agent').default; - var mockErrors: typeof import('./mock-errors').default; - var fetch: typeof import('./fetch').fetch; - var Headers: typeof import('./fetch').Headers; - var Response: typeof import('./fetch').Response; - var Request: typeof import('./fetch').Request; - var FormData: typeof import('./formdata').FormData; - var File: typeof import('./file').File; - var FileReader: typeof import('./filereader').FileReader; - var caches: typeof import('./cache').caches; -} diff --git a/reverse_engineering/node_modules/undici-types/interceptors.d.ts b/reverse_engineering/node_modules/undici-types/interceptors.d.ts deleted file mode 100644 index 047ac175..00000000 --- a/reverse_engineering/node_modules/undici-types/interceptors.d.ts +++ /dev/null @@ -1,5 +0,0 @@ -import Dispatcher from "./dispatcher"; - -type RedirectInterceptorOpts = { maxRedirections?: number } - -export declare function createRedirectInterceptor (opts: RedirectInterceptorOpts): Dispatcher.DispatchInterceptor diff --git a/reverse_engineering/node_modules/undici-types/mock-agent.d.ts b/reverse_engineering/node_modules/undici-types/mock-agent.d.ts deleted file mode 100644 index 98cd645b..00000000 --- a/reverse_engineering/node_modules/undici-types/mock-agent.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -import Agent from './agent' -import Dispatcher from './dispatcher' -import { Interceptable, MockInterceptor } from './mock-interceptor' -import MockDispatch = MockInterceptor.MockDispatch; - -export default MockAgent - -interface PendingInterceptor extends MockDispatch { - origin: string; -} - -/** A mocked Agent class that implements the Agent API. It allows one to intercept HTTP requests made through undici and return mocked responses instead. */ -declare class MockAgent extends Dispatcher { - constructor(options?: MockAgent.Options) - /** Creates and retrieves mock Dispatcher instances which can then be used to intercept HTTP requests. If the number of connections on the mock agent is set to 1, a MockClient instance is returned. Otherwise a MockPool instance is returned. */ - get(origin: string): TInterceptable; - get(origin: RegExp): TInterceptable; - get(origin: ((origin: string) => boolean)): TInterceptable; - /** Dispatches a mocked request. */ - dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; - /** Closes the mock agent and waits for registered mock pools and clients to also close before resolving. */ - close(): Promise; - /** Disables mocking in MockAgent. */ - deactivate(): void; - /** Enables mocking in a MockAgent instance. When instantiated, a MockAgent is automatically activated. Therefore, this method is only effective after `MockAgent.deactivate` has been called. */ - activate(): void; - /** Define host matchers so only matching requests that aren't intercepted by the mock dispatchers will be attempted. */ - enableNetConnect(): void; - enableNetConnect(host: string): void; - enableNetConnect(host: RegExp): void; - enableNetConnect(host: ((host: string) => boolean)): void; - /** Causes all requests to throw when requests are not matched in a MockAgent intercept. */ - disableNetConnect(): void; - pendingInterceptors(): PendingInterceptor[]; - assertNoPendingInterceptors(options?: { - pendingInterceptorsFormatter?: PendingInterceptorsFormatter; - }): void; -} - -interface PendingInterceptorsFormatter { - format(pendingInterceptors: readonly PendingInterceptor[]): string; -} - -declare namespace MockAgent { - /** MockAgent options. */ - export interface Options extends Agent.Options { - /** A custom agent to be encapsulated by the MockAgent. */ - agent?: Agent; - } -} diff --git a/reverse_engineering/node_modules/undici-types/mock-client.d.ts b/reverse_engineering/node_modules/undici-types/mock-client.d.ts deleted file mode 100644 index 51d008cc..00000000 --- a/reverse_engineering/node_modules/undici-types/mock-client.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Client from './client' -import Dispatcher from './dispatcher' -import MockAgent from './mock-agent' -import { MockInterceptor, Interceptable } from './mock-interceptor' - -export default MockClient - -/** MockClient extends the Client API and allows one to mock requests. */ -declare class MockClient extends Client implements Interceptable { - constructor(origin: string, options: MockClient.Options); - /** Intercepts any matching requests that use the same origin as this mock client. */ - intercept(options: MockInterceptor.Options): MockInterceptor; - /** Dispatches a mocked request. */ - dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean; - /** Closes the mock client and gracefully waits for enqueued requests to complete. */ - close(): Promise; -} - -declare namespace MockClient { - /** MockClient options. */ - export interface Options extends Client.Options { - /** The agent to associate this MockClient with. */ - agent: MockAgent; - } -} diff --git a/reverse_engineering/node_modules/undici-types/mock-errors.d.ts b/reverse_engineering/node_modules/undici-types/mock-errors.d.ts deleted file mode 100644 index 3d9e727d..00000000 --- a/reverse_engineering/node_modules/undici-types/mock-errors.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import Errors from './errors' - -export default MockErrors - -declare namespace MockErrors { - /** The request does not match any registered mock dispatches. */ - export class MockNotMatchedError extends Errors.UndiciError { - constructor(message?: string); - name: 'MockNotMatchedError'; - code: 'UND_MOCK_ERR_MOCK_NOT_MATCHED'; - } -} diff --git a/reverse_engineering/node_modules/undici-types/mock-interceptor.d.ts b/reverse_engineering/node_modules/undici-types/mock-interceptor.d.ts deleted file mode 100644 index 6b3961c0..00000000 --- a/reverse_engineering/node_modules/undici-types/mock-interceptor.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { IncomingHttpHeaders } from './header' -import Dispatcher from './dispatcher'; -import { BodyInit, Headers } from './fetch' - -export { - Interceptable, - MockInterceptor, - MockScope -} - -/** The scope associated with a mock dispatch. */ -declare class MockScope { - constructor(mockDispatch: MockInterceptor.MockDispatch); - /** Delay a reply by a set amount of time in ms. */ - delay(waitInMs: number): MockScope; - /** Persist the defined mock data for the associated reply. It will return the defined mock data indefinitely. */ - persist(): MockScope; - /** Define a reply for a set amount of matching requests. */ - times(repeatTimes: number): MockScope; -} - -/** The interceptor for a Mock. */ -declare class MockInterceptor { - constructor(options: MockInterceptor.Options, mockDispatches: MockInterceptor.MockDispatch[]); - /** Mock an undici request with the defined reply. */ - reply(replyOptionsCallback: MockInterceptor.MockReplyOptionsCallback): MockScope; - reply( - statusCode: number, - data?: TData | Buffer | string | MockInterceptor.MockResponseDataHandler, - responseOptions?: MockInterceptor.MockResponseOptions - ): MockScope; - /** Mock an undici request by throwing the defined reply error. */ - replyWithError(error: TError): MockScope; - /** Set default reply headers on the interceptor for subsequent mocked replies. */ - defaultReplyHeaders(headers: IncomingHttpHeaders): MockInterceptor; - /** Set default reply trailers on the interceptor for subsequent mocked replies. */ - defaultReplyTrailers(trailers: Record): MockInterceptor; - /** Set automatically calculated content-length header on subsequent mocked replies. */ - replyContentLength(): MockInterceptor; -} - -declare namespace MockInterceptor { - /** MockInterceptor options. */ - export interface Options { - /** Path to intercept on. */ - path: string | RegExp | ((path: string) => boolean); - /** Method to intercept on. Defaults to GET. */ - method?: string | RegExp | ((method: string) => boolean); - /** Body to intercept on. */ - body?: string | RegExp | ((body: string) => boolean); - /** Headers to intercept on. */ - headers?: Record boolean)> | ((headers: Record) => boolean); - /** Query params to intercept on */ - query?: Record; - } - export interface MockDispatch extends Options { - times: number | null; - persist: boolean; - consumed: boolean; - data: MockDispatchData; - } - export interface MockDispatchData extends MockResponseOptions { - error: TError | null; - statusCode?: number; - data?: TData | string; - } - export interface MockResponseOptions { - headers?: IncomingHttpHeaders; - trailers?: Record; - } - - export interface MockResponseCallbackOptions { - path: string; - origin: string; - method: string; - body?: BodyInit | Dispatcher.DispatchOptions['body']; - headers: Headers | Record; - maxRedirections: number; - } - - export type MockResponseDataHandler = ( - opts: MockResponseCallbackOptions - ) => TData | Buffer | string; - - export type MockReplyOptionsCallback = ( - opts: MockResponseCallbackOptions - ) => { statusCode: number, data?: TData | Buffer | string, responseOptions?: MockResponseOptions } -} - -interface Interceptable extends Dispatcher { - /** Intercepts any matching requests that use the same origin as this mock client. */ - intercept(options: MockInterceptor.Options): MockInterceptor; -} diff --git a/reverse_engineering/node_modules/undici-types/mock-pool.d.ts b/reverse_engineering/node_modules/undici-types/mock-pool.d.ts deleted file mode 100644 index 39e709aa..00000000 --- a/reverse_engineering/node_modules/undici-types/mock-pool.d.ts +++ /dev/null @@ -1,25 +0,0 @@ -import Pool from './pool' -import MockAgent from './mock-agent' -import { Interceptable, MockInterceptor } from './mock-interceptor' -import Dispatcher from './dispatcher' - -export default MockPool - -/** MockPool extends the Pool API and allows one to mock requests. */ -declare class MockPool extends Pool implements Interceptable { - constructor(origin: string, options: MockPool.Options); - /** Intercepts any matching requests that use the same origin as this mock pool. */ - intercept(options: MockInterceptor.Options): MockInterceptor; - /** Dispatches a mocked request. */ - dispatch(options: Dispatcher.DispatchOptions, handlers: Dispatcher.DispatchHandlers): boolean; - /** Closes the mock pool and gracefully waits for enqueued requests to complete. */ - close(): Promise; -} - -declare namespace MockPool { - /** MockPool options. */ - export interface Options extends Pool.Options { - /** The agent to associate this MockPool with. */ - agent: MockAgent; - } -} diff --git a/reverse_engineering/node_modules/undici-types/package.json b/reverse_engineering/node_modules/undici-types/package.json deleted file mode 100644 index be7aa4cd..00000000 --- a/reverse_engineering/node_modules/undici-types/package.json +++ /dev/null @@ -1,55 +0,0 @@ -{ - "name": "undici-types", - "version": "5.26.5", - "description": "A stand-alone types package for Undici", - "homepage": "https://undici.nodejs.org", - "bugs": { - "url": "https://github.com/nodejs/undici/issues" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/nodejs/undici.git" - }, - "license": "MIT", - "types": "index.d.ts", - "files": [ - "*.d.ts" - ], - "contributors": [ - { - "name": "Daniele Belardi", - "url": "https://github.com/dnlup", - "author": true - }, - { - "name": "Ethan Arrowood", - "url": "https://github.com/ethan-arrowood", - "author": true - }, - { - "name": "Matteo Collina", - "url": "https://github.com/mcollina", - "author": true - }, - { - "name": "Matthew Aitken", - "url": "https://github.com/KhafraDev", - "author": true - }, - { - "name": "Robert Nagy", - "url": "https://github.com/ronag", - "author": true - }, - { - "name": "Szymon Marczak", - "url": "https://github.com/szmarczak", - "author": true - }, - { - "name": "Tomas Della Vedova", - "url": "https://github.com/delvedor", - "author": true - } - ] -} \ No newline at end of file diff --git a/reverse_engineering/node_modules/undici-types/patch.d.ts b/reverse_engineering/node_modules/undici-types/patch.d.ts deleted file mode 100644 index 3871acfe..00000000 --- a/reverse_engineering/node_modules/undici-types/patch.d.ts +++ /dev/null @@ -1,71 +0,0 @@ -/// - -// See https://github.com/nodejs/undici/issues/1740 - -export type DOMException = typeof globalThis extends { DOMException: infer T } - ? T - : any - -export type EventTarget = typeof globalThis extends { EventTarget: infer T } - ? T - : { - addEventListener( - type: string, - listener: any, - options?: any, - ): void - dispatchEvent(event: Event): boolean - removeEventListener( - type: string, - listener: any, - options?: any | boolean, - ): void - } - -export type Event = typeof globalThis extends { Event: infer T } - ? T - : { - readonly bubbles: boolean - cancelBubble: () => void - readonly cancelable: boolean - readonly composed: boolean - composedPath(): [EventTarget?] - readonly currentTarget: EventTarget | null - readonly defaultPrevented: boolean - readonly eventPhase: 0 | 2 - readonly isTrusted: boolean - preventDefault(): void - returnValue: boolean - readonly srcElement: EventTarget | null - stopImmediatePropagation(): void - stopPropagation(): void - readonly target: EventTarget | null - readonly timeStamp: number - readonly type: string - } - -export interface EventInit { - bubbles?: boolean - cancelable?: boolean - composed?: boolean -} - -export interface EventListenerOptions { - capture?: boolean -} - -export interface AddEventListenerOptions extends EventListenerOptions { - once?: boolean - passive?: boolean - signal?: AbortSignal -} - -export type EventListenerOrEventListenerObject = EventListener | EventListenerObject - -export interface EventListenerObject { - handleEvent (object: Event): void -} - -export interface EventListener { - (evt: Event): void -} diff --git a/reverse_engineering/node_modules/undici-types/pool-stats.d.ts b/reverse_engineering/node_modules/undici-types/pool-stats.d.ts deleted file mode 100644 index 8b6d2bff..00000000 --- a/reverse_engineering/node_modules/undici-types/pool-stats.d.ts +++ /dev/null @@ -1,19 +0,0 @@ -import Pool from "./pool" - -export default PoolStats - -declare class PoolStats { - constructor(pool: Pool); - /** Number of open socket connections in this pool. */ - connected: number; - /** Number of open socket connections in this pool that do not have an active request. */ - free: number; - /** Number of pending requests across all clients in this pool. */ - pending: number; - /** Number of queued requests across all clients in this pool. */ - queued: number; - /** Number of currently active requests across all clients in this pool. */ - running: number; - /** Number of active, pending, or queued requests across all clients in this pool. */ - size: number; -} diff --git a/reverse_engineering/node_modules/undici-types/pool.d.ts b/reverse_engineering/node_modules/undici-types/pool.d.ts deleted file mode 100644 index 7747d482..00000000 --- a/reverse_engineering/node_modules/undici-types/pool.d.ts +++ /dev/null @@ -1,28 +0,0 @@ -import Client from './client' -import TPoolStats from './pool-stats' -import { URL } from 'url' -import Dispatcher from "./dispatcher"; - -export default Pool - -declare class Pool extends Dispatcher { - constructor(url: string | URL, options?: Pool.Options) - /** `true` after `pool.close()` has been called. */ - closed: boolean; - /** `true` after `pool.destroyed()` has been called or `pool.close()` has been called and the pool shutdown has completed. */ - destroyed: boolean; - /** Aggregate stats for a Pool. */ - readonly stats: TPoolStats; -} - -declare namespace Pool { - export type PoolStats = TPoolStats; - export interface Options extends Client.Options { - /** Default: `(origin, opts) => new Client(origin, opts)`. */ - factory?(origin: URL, opts: object): Dispatcher; - /** The max number of clients to create. `null` if no limit. Default `null`. */ - connections?: number | null; - - interceptors?: { Pool?: readonly Dispatcher.DispatchInterceptor[] } & Client.Options["interceptors"] - } -} diff --git a/reverse_engineering/node_modules/undici-types/proxy-agent.d.ts b/reverse_engineering/node_modules/undici-types/proxy-agent.d.ts deleted file mode 100644 index 96b26381..00000000 --- a/reverse_engineering/node_modules/undici-types/proxy-agent.d.ts +++ /dev/null @@ -1,30 +0,0 @@ -import Agent from './agent' -import buildConnector from './connector'; -import Client from './client' -import Dispatcher from './dispatcher' -import { IncomingHttpHeaders } from './header' -import Pool from './pool' - -export default ProxyAgent - -declare class ProxyAgent extends Dispatcher { - constructor(options: ProxyAgent.Options | string) - - dispatch(options: Agent.DispatchOptions, handler: Dispatcher.DispatchHandlers): boolean; - close(): Promise; -} - -declare namespace ProxyAgent { - export interface Options extends Agent.Options { - uri: string; - /** - * @deprecated use opts.token - */ - auth?: string; - token?: string; - headers?: IncomingHttpHeaders; - requestTls?: buildConnector.BuildOptions; - proxyTls?: buildConnector.BuildOptions; - clientFactory?(origin: URL, opts: object): Dispatcher; - } -} diff --git a/reverse_engineering/node_modules/undici-types/readable.d.ts b/reverse_engineering/node_modules/undici-types/readable.d.ts deleted file mode 100644 index 4549a8c8..00000000 --- a/reverse_engineering/node_modules/undici-types/readable.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -import { Readable } from "stream"; -import { Blob } from 'buffer' - -export default BodyReadable - -declare class BodyReadable extends Readable { - constructor( - resume?: (this: Readable, size: number) => void | null, - abort?: () => void | null, - contentType?: string - ) - - /** Consumes and returns the body as a string - * https://fetch.spec.whatwg.org/#dom-body-text - */ - text(): Promise - - /** Consumes and returns the body as a JavaScript Object - * https://fetch.spec.whatwg.org/#dom-body-json - */ - json(): Promise - - /** Consumes and returns the body as a Blob - * https://fetch.spec.whatwg.org/#dom-body-blob - */ - blob(): Promise - - /** Consumes and returns the body as an ArrayBuffer - * https://fetch.spec.whatwg.org/#dom-body-arraybuffer - */ - arrayBuffer(): Promise - - /** Not implemented - * - * https://fetch.spec.whatwg.org/#dom-body-formdata - */ - formData(): Promise - - /** Returns true if the body is not null and the body has been consumed - * - * Otherwise, returns false - * - * https://fetch.spec.whatwg.org/#dom-body-bodyused - */ - readonly bodyUsed: boolean - - /** Throws on node 16.6.0 - * - * If body is null, it should return null as the body - * - * If body is not null, should return the body as a ReadableStream - * - * https://fetch.spec.whatwg.org/#dom-body-body - */ - readonly body: never | undefined - - /** Dumps the response body by reading `limit` number of bytes. - * @param opts.limit Number of bytes to read (optional) - Default: 262144 - */ - dump(opts?: { limit: number }): Promise -} diff --git a/reverse_engineering/node_modules/undici-types/webidl.d.ts b/reverse_engineering/node_modules/undici-types/webidl.d.ts deleted file mode 100644 index 40cfe064..00000000 --- a/reverse_engineering/node_modules/undici-types/webidl.d.ts +++ /dev/null @@ -1,220 +0,0 @@ -// These types are not exported, and are only used internally - -/** - * Take in an unknown value and return one that is of type T - */ -type Converter = (object: unknown) => T - -type SequenceConverter = (object: unknown) => T[] - -type RecordConverter = (object: unknown) => Record - -interface ConvertToIntOpts { - clamp?: boolean - enforceRange?: boolean -} - -interface WebidlErrors { - exception (opts: { header: string, message: string }): TypeError - /** - * @description Throw an error when conversion from one type to another has failed - */ - conversionFailed (opts: { - prefix: string - argument: string - types: string[] - }): TypeError - /** - * @description Throw an error when an invalid argument is provided - */ - invalidArgument (opts: { - prefix: string - value: string - type: string - }): TypeError -} - -interface WebidlUtil { - /** - * @see https://tc39.es/ecma262/#sec-ecmascript-data-types-and-values - */ - Type (object: unknown): - | 'Undefined' - | 'Boolean' - | 'String' - | 'Symbol' - | 'Number' - | 'BigInt' - | 'Null' - | 'Object' - - /** - * @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint - */ - ConvertToInt ( - V: unknown, - bitLength: number, - signedness: 'signed' | 'unsigned', - opts?: ConvertToIntOpts - ): number - - /** - * @see https://webidl.spec.whatwg.org/#abstract-opdef-converttoint - */ - IntegerPart (N: number): number -} - -interface WebidlConverters { - /** - * @see https://webidl.spec.whatwg.org/#es-DOMString - */ - DOMString (V: unknown, opts?: { - legacyNullToEmptyString: boolean - }): string - - /** - * @see https://webidl.spec.whatwg.org/#es-ByteString - */ - ByteString (V: unknown): string - - /** - * @see https://webidl.spec.whatwg.org/#es-USVString - */ - USVString (V: unknown): string - - /** - * @see https://webidl.spec.whatwg.org/#es-boolean - */ - boolean (V: unknown): boolean - - /** - * @see https://webidl.spec.whatwg.org/#es-any - */ - any (V: Value): Value - - /** - * @see https://webidl.spec.whatwg.org/#es-long-long - */ - ['long long'] (V: unknown): number - - /** - * @see https://webidl.spec.whatwg.org/#es-unsigned-long-long - */ - ['unsigned long long'] (V: unknown): number - - /** - * @see https://webidl.spec.whatwg.org/#es-unsigned-long - */ - ['unsigned long'] (V: unknown): number - - /** - * @see https://webidl.spec.whatwg.org/#es-unsigned-short - */ - ['unsigned short'] (V: unknown, opts?: ConvertToIntOpts): number - - /** - * @see https://webidl.spec.whatwg.org/#idl-ArrayBuffer - */ - ArrayBuffer (V: unknown): ArrayBufferLike - ArrayBuffer (V: unknown, opts: { allowShared: false }): ArrayBuffer - - /** - * @see https://webidl.spec.whatwg.org/#es-buffer-source-types - */ - TypedArray ( - V: unknown, - TypedArray: NodeJS.TypedArray | ArrayBufferLike - ): NodeJS.TypedArray | ArrayBufferLike - TypedArray ( - V: unknown, - TypedArray: NodeJS.TypedArray | ArrayBufferLike, - opts?: { allowShared: false } - ): NodeJS.TypedArray | ArrayBuffer - - /** - * @see https://webidl.spec.whatwg.org/#es-buffer-source-types - */ - DataView (V: unknown, opts?: { allowShared: boolean }): DataView - - /** - * @see https://webidl.spec.whatwg.org/#BufferSource - */ - BufferSource ( - V: unknown, - opts?: { allowShared: boolean } - ): NodeJS.TypedArray | ArrayBufferLike | DataView - - ['sequence']: SequenceConverter - - ['sequence>']: SequenceConverter - - ['record']: RecordConverter - - [Key: string]: (...args: any[]) => unknown -} - -export interface Webidl { - errors: WebidlErrors - util: WebidlUtil - converters: WebidlConverters - - /** - * @description Performs a brand-check on {@param V} to ensure it is a - * {@param cls} object. - */ - brandCheck (V: unknown, cls: Interface, opts?: { strict?: boolean }): asserts V is Interface - - /** - * @see https://webidl.spec.whatwg.org/#es-sequence - * @description Convert a value, V, to a WebIDL sequence type. - */ - sequenceConverter (C: Converter): SequenceConverter - - illegalConstructor (): never - - /** - * @see https://webidl.spec.whatwg.org/#es-to-record - * @description Convert a value, V, to a WebIDL record type. - */ - recordConverter ( - keyConverter: Converter, - valueConverter: Converter - ): RecordConverter - - /** - * Similar to {@link Webidl.brandCheck} but allows skipping the check if third party - * interfaces are allowed. - */ - interfaceConverter (cls: Interface): ( - V: unknown, - opts?: { strict: boolean } - ) => asserts V is typeof cls - - // TODO(@KhafraDev): a type could likely be implemented that can infer the return type - // from the converters given? - /** - * Converts a value, V, to a WebIDL dictionary types. Allows limiting which keys are - * allowed, values allowed, optional and required keys. Auto converts the value to - * a type given a converter. - */ - dictionaryConverter (converters: { - key: string, - defaultValue?: unknown, - required?: boolean, - converter: (...args: unknown[]) => unknown, - allowedValues?: unknown[] - }[]): (V: unknown) => Record - - /** - * @see https://webidl.spec.whatwg.org/#idl-nullable-type - * @description allows a type, V, to be null - */ - nullableConverter ( - converter: Converter - ): (V: unknown) => ReturnType | null - - argumentLengthCheck (args: { length: number }, min: number, context: { - header: string - message?: string - }): void -} diff --git a/reverse_engineering/node_modules/undici-types/websocket.d.ts b/reverse_engineering/node_modules/undici-types/websocket.d.ts deleted file mode 100644 index 15a357d3..00000000 --- a/reverse_engineering/node_modules/undici-types/websocket.d.ts +++ /dev/null @@ -1,131 +0,0 @@ -/// - -import type { Blob } from 'buffer' -import type { MessagePort } from 'worker_threads' -import { - EventTarget, - Event, - EventInit, - EventListenerOptions, - AddEventListenerOptions, - EventListenerOrEventListenerObject -} from './patch' -import Dispatcher from './dispatcher' -import { HeadersInit } from './fetch' - -export type BinaryType = 'blob' | 'arraybuffer' - -interface WebSocketEventMap { - close: CloseEvent - error: Event - message: MessageEvent - open: Event -} - -interface WebSocket extends EventTarget { - binaryType: BinaryType - - readonly bufferedAmount: number - readonly extensions: string - - onclose: ((this: WebSocket, ev: WebSocketEventMap['close']) => any) | null - onerror: ((this: WebSocket, ev: WebSocketEventMap['error']) => any) | null - onmessage: ((this: WebSocket, ev: WebSocketEventMap['message']) => any) | null - onopen: ((this: WebSocket, ev: WebSocketEventMap['open']) => any) | null - - readonly protocol: string - readonly readyState: number - readonly url: string - - close(code?: number, reason?: string): void - send(data: string | ArrayBufferLike | Blob | ArrayBufferView): void - - readonly CLOSED: number - readonly CLOSING: number - readonly CONNECTING: number - readonly OPEN: number - - addEventListener( - type: K, - listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, - options?: boolean | AddEventListenerOptions - ): void - addEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | AddEventListenerOptions - ): void - removeEventListener( - type: K, - listener: (this: WebSocket, ev: WebSocketEventMap[K]) => any, - options?: boolean | EventListenerOptions - ): void - removeEventListener( - type: string, - listener: EventListenerOrEventListenerObject, - options?: boolean | EventListenerOptions - ): void -} - -export declare const WebSocket: { - prototype: WebSocket - new (url: string | URL, protocols?: string | string[] | WebSocketInit): WebSocket - readonly CLOSED: number - readonly CLOSING: number - readonly CONNECTING: number - readonly OPEN: number -} - -interface CloseEventInit extends EventInit { - code?: number - reason?: string - wasClean?: boolean -} - -interface CloseEvent extends Event { - readonly code: number - readonly reason: string - readonly wasClean: boolean -} - -export declare const CloseEvent: { - prototype: CloseEvent - new (type: string, eventInitDict?: CloseEventInit): CloseEvent -} - -interface MessageEventInit extends EventInit { - data?: T - lastEventId?: string - origin?: string - ports?: (typeof MessagePort)[] - source?: typeof MessagePort | null -} - -interface MessageEvent extends Event { - readonly data: T - readonly lastEventId: string - readonly origin: string - readonly ports: ReadonlyArray - readonly source: typeof MessagePort | null - initMessageEvent( - type: string, - bubbles?: boolean, - cancelable?: boolean, - data?: any, - origin?: string, - lastEventId?: string, - source?: typeof MessagePort | null, - ports?: (typeof MessagePort)[] - ): void; -} - -export declare const MessageEvent: { - prototype: MessageEvent - new(type: string, eventInitDict?: MessageEventInit): MessageEvent -} - -interface WebSocketInit { - protocols?: string | string[], - dispatcher?: Dispatcher, - headers?: HeadersInit -} diff --git a/reverse_engineering/package-lock.json b/reverse_engineering/package-lock.json deleted file mode 100644 index 9a275f31..00000000 --- a/reverse_engineering/package-lock.json +++ /dev/null @@ -1,311 +0,0 @@ -{ - "name": "Datastax", - "version": "1.0.0", - "lockfileVersion": 2, - "requires": true, - "packages": { - "": { - "name": "Datastax", - "version": "1.0.0", - "dependencies": { - "antlr4": "^4.8.0", - "cassandra-driver": "^4.7.2", - "fast-xml-parser": "^3.19.0", - "jks-js": "^1.0.0", - "tunnel-ssh": "github:hackolade/tunnel-ssh" - } - }, - "node_modules/@types/long": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-5.0.0.tgz", - "integrity": "sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA==", - "deprecated": "This is a stub types definition. long provides its own type definitions, so you do not need this installed.", - "dependencies": { - "long": "*" - } - }, - "node_modules/@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "dependencies": { - "undici-types": "~5.26.4" - } - }, - "node_modules/adm-zip": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", - "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==", - "engines": { - "node": ">=6.0" - } - }, - "node_modules/antlr4": { - "version": "4.8.0", - "integrity": "sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg==" - }, - "node_modules/asn1": { - "version": "0.2.4", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "dependencies": { - "safer-buffer": "~2.1.0" - } - }, - "node_modules/bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "dependencies": { - "tweetnacl": "^0.14.3" - } - }, - "node_modules/cassandra-driver": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/cassandra-driver/-/cassandra-driver-4.7.2.tgz", - "integrity": "sha512-gwl1DeYvL8Wy3i1GDMzFtpUg5G473fU7EnHFZj7BUtdLB7loAfgZgB3zBhROc9fbaDSUDs6YwOPPojS5E1kbSA==", - "dependencies": { - "@types/long": "~5.0.0", - "@types/node": ">=8", - "adm-zip": "~0.5.10", - "long": "~5.2.3" - }, - "engines": { - "node": ">=16" - } - }, - "node_modules/debug": { - "version": "2.6.9", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dependencies": { - "ms": "2.0.0" - } - }, - "node_modules/fast-xml-parser": { - "version": "3.19.0", - "integrity": "sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==", - "bin": { - "xml2js": "cli.js" - }, - "funding": { - "type": "paypal", - "url": "https://paypal.me/naturalintelligence" - } - }, - "node_modules/jks-js": { - "version": "1.0.0", - "integrity": "sha512-0ocOpotBAJNz3ajlflj39DG9Cs96SCx3qtNPHJyUTXD5pk8/cQRfR5BSyPhcTHGKe2sxfT18WGiINtLqi/W64g==", - "dependencies": { - "node-forge": "^0.10.0", - "node-int64": "^0.4.0", - "node-rsa": "^1.0.7" - } - }, - "node_modules/lodash.defaults": { - "version": "4.2.0", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "node_modules/ms": { - "version": "2.0.0", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node_modules/node-forge": { - "version": "0.10.0", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==", - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/node-int64": { - "version": "0.4.0", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" - }, - "node_modules/node-rsa": { - "version": "1.1.1", - "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", - "dependencies": { - "asn1": "^0.2.4" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "node_modules/ssh2": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.4.0.tgz", - "integrity": "sha512-XvXwcXKvS452DyQvCa6Ct+chpucwc/UyxgliYz+rWXJ3jDHdtBb9xgmxJdMmnIn5bpgGAEV3KaEsH98ZGPHqwg==", - "hasInstallScript": true, - "dependencies": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2" - }, - "engines": { - "node": ">=10.16.0" - }, - "optionalDependencies": { - "cpu-features": "0.0.2", - "nan": "^2.15.0" - } - }, - "node_modules/tunnel-ssh": { - "version": "4.1.5", - "resolved": "git+ssh://git@github.com/hackolade/tunnel-ssh.git#e3dec106b0a3347f015f1fca4755ec0eaf880e21", - "license": "MIT", - "dependencies": { - "debug": "2.6.9", - "lodash.defaults": "^4.1.0", - "ssh2": "1.4.0" - } - }, - "node_modules/tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "node_modules/undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - } - }, - "dependencies": { - "@types/long": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/@types/long/-/long-5.0.0.tgz", - "integrity": "sha512-eQs9RsucA/LNjnMoJvWG/nXa7Pot/RbBzilF/QRIU/xRl+0ApxrSUFsV5lmf01SvSlqMzJ7Zwxe440wmz2SJGA==", - "requires": { - "long": "*" - } - }, - "@types/node": { - "version": "20.10.5", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.5.tgz", - "integrity": "sha512-nNPsNE65wjMxEKI93yOP+NPGGBJz/PoN3kZsVLee0XMiJolxSekEVD8wRwBUBqkwc7UWop0edW50yrCQW4CyRw==", - "requires": { - "undici-types": "~5.26.4" - } - }, - "adm-zip": { - "version": "0.5.10", - "resolved": "https://registry.npmjs.org/adm-zip/-/adm-zip-0.5.10.tgz", - "integrity": "sha512-x0HvcHqVJNTPk/Bw8JbLWlWoo6Wwnsug0fnYYro1HBrjxZ3G7/AZk7Ahv8JwDe1uIcz8eBqvu86FuF1POiG7vQ==" - }, - "antlr4": { - "version": "4.8.0", - "integrity": "sha512-en/MxQ4OkPgGJQ3wD/muzj1uDnFSzdFIhc2+c6bHZokWkuBb6RRvFjpWhPxWLbgQvaEzldJZ0GSQpfSAaE3hqg==" - }, - "asn1": { - "version": "0.2.4", - "integrity": "sha512-jxwzQpLQjSmWXgwaCZE9Nz+glAG01yF1QnWgbhGwHI5A6FRIEY6IVqtHhIepHqI7/kyEyQEagBC5mBEFlIYvdg==", - "requires": { - "safer-buffer": "~2.1.0" - } - }, - "bcrypt-pbkdf": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/bcrypt-pbkdf/-/bcrypt-pbkdf-1.0.2.tgz", - "integrity": "sha1-pDAdOJtqQ/m2f/PKEaP2Y342Dp4=", - "requires": { - "tweetnacl": "^0.14.3" - } - }, - "cassandra-driver": { - "version": "4.7.2", - "resolved": "https://registry.npmjs.org/cassandra-driver/-/cassandra-driver-4.7.2.tgz", - "integrity": "sha512-gwl1DeYvL8Wy3i1GDMzFtpUg5G473fU7EnHFZj7BUtdLB7loAfgZgB3zBhROc9fbaDSUDs6YwOPPojS5E1kbSA==", - "requires": { - "@types/long": "~5.0.0", - "@types/node": ">=8", - "adm-zip": "~0.5.10", - "long": "~5.2.3" - } - }, - "debug": { - "version": "2.6.9", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "requires": { - "ms": "2.0.0" - } - }, - "fast-xml-parser": { - "version": "3.19.0", - "integrity": "sha512-4pXwmBplsCPv8FOY1WRakF970TjNGnGnfbOnLqjlYvMiF1SR3yOHyxMR/YCXpPTOspNF5gwudqktIP4VsWkvBg==" - }, - "jks-js": { - "version": "1.0.0", - "integrity": "sha512-0ocOpotBAJNz3ajlflj39DG9Cs96SCx3qtNPHJyUTXD5pk8/cQRfR5BSyPhcTHGKe2sxfT18WGiINtLqi/W64g==", - "requires": { - "node-forge": "^0.10.0", - "node-int64": "^0.4.0", - "node-rsa": "^1.0.7" - } - }, - "lodash.defaults": { - "version": "4.2.0", - "integrity": "sha1-0JF4cW/+pN3p5ft7N/bwgCJ0WAw=" - }, - "long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==" - }, - "ms": { - "version": "2.0.0", - "integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g=" - }, - "node-forge": { - "version": "0.10.0", - "integrity": "sha512-PPmu8eEeG9saEUvI97fm4OYxXVB6bFvyNTyiUOBichBpFG8A1Ljw3bY62+5oOjDEMHRnd0Y7HQ+x7uzxOzC6JA==" - }, - "node-int64": { - "version": "0.4.0", - "integrity": "sha1-h6kGXNs1XTGC2PlM4RGIuCXGijs=" - }, - "node-rsa": { - "version": "1.1.1", - "integrity": "sha512-Jd4cvbJMryN21r5HgxQOpMEqv+ooke/korixNNK3mGqfGJmy0M77WDDzo/05969+OkMy3XW1UuZsSmW9KQm7Fw==", - "requires": { - "asn1": "^0.2.4" - } - }, - "safer-buffer": { - "version": "2.1.2", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==" - }, - "ssh2": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/ssh2/-/ssh2-1.4.0.tgz", - "integrity": "sha512-XvXwcXKvS452DyQvCa6Ct+chpucwc/UyxgliYz+rWXJ3jDHdtBb9xgmxJdMmnIn5bpgGAEV3KaEsH98ZGPHqwg==", - "requires": { - "asn1": "^0.2.4", - "bcrypt-pbkdf": "^1.0.2", - "cpu-features": "0.0.2", - "nan": "^2.15.0" - } - }, - "tunnel-ssh": { - "version": "git+ssh://git@github.com/hackolade/tunnel-ssh.git#e3dec106b0a3347f015f1fca4755ec0eaf880e21", - "from": "tunnel-ssh@github:hackolade/tunnel-ssh", - "requires": { - "debug": "2.6.9", - "lodash.defaults": "^4.1.0", - "ssh2": "1.4.0" - } - }, - "tweetnacl": { - "version": "0.14.5", - "resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz", - "integrity": "sha1-WuaBd/GS1EViadEIr6k/+HQ/T2Q=" - }, - "undici-types": { - "version": "5.26.5", - "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-5.26.5.tgz", - "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" - } - } -} diff --git a/reverse_engineering/package.json b/reverse_engineering/package.json index 16a24cc8..1bfc679c 100644 --- a/reverse_engineering/package.json +++ b/reverse_engineering/package.json @@ -1,15 +1,6 @@ { "name": "Datastax", - "version": "1.0.0", - "description": "", - "author": "Hackolade", - "dependencies": { - "antlr4": "^4.8.0", - "cassandra-driver": "^4.7.2", - "fast-xml-parser": "^3.19.0", - "jks-js": "^1.0.0", - "tunnel-ssh": "github:hackolade/tunnel-ssh" - }, + "description": "custom attributes to drive application behavior", "systemKeyspaces": [ "cfs", "cfs_archive", diff --git a/reverse_engineering/parser/CqlLexer.interp b/reverse_engineering/parser/CqlLexer.interp deleted file mode 100644 index 3325a946..00000000 --- a/reverse_engineering/parser/CqlLexer.interp +++ /dev/null @@ -1,734 +0,0 @@ -token literal names: -null -'(' -')' -'{' -'}' -'[' -']' -',' -';' -':' -null -null -null -null -'.' -'*' -'/' -'%' -'+' -'--' -'-' -'"' -'\'' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -LR_BRACKET -RR_BRACKET -LC_BRACKET -RC_BRACKET -LS_BRACKET -RS_BRACKET -COMMA -SEMI -COLON -SPACE -SPEC_MYSQL_COMMENT -COMMENT_INPUT -LINE_COMMENT -DOT -STAR -DIVIDE -MODULE -PLUS -MINUSMINUS -MINUS -DQUOTE -SQUOTE -K_ADD -K_AGGREGATE -K_ALL -K_ALLOW -K_ALTER -K_AND -K_ANY -K_APPLY -K_AS -K_ASC -K_AUTHORIZE -K_BATCH -K_BEGIN -K_BY -K_CALLED -K_CLUSTERING -K_COLUMNFAMILY -K_COMPACT -K_CONSISTENCY -K_CONTAINS -K_CREATE -K_CUSTOM -K_SEARCH -K_DELETE -K_DESC -K_DESCRIBE -K_DISTINCT -K_DROP -K_DURABLE_WRITES -K_EACH_QUORUM -K_ENTRIES -K_EXECUTE -K_EXISTS -K_FALSE -K_FILTERING -K_FINALFUNC -K_FROM -K_FULL -K_FUNCTION -K_FUNCTIONS -K_GRANT -K_IF -K_IN -K_INDEX -K_INFINITY -K_INITCOND -K_INPUT -K_INSERT -K_INTO -K_IS -K_JSON -K_KEY -K_KEYS -K_KEYSPACE -K_KEYSPACES -K_LANGUAGE -K_LEVEL -K_LIMIT -K_LOCAL_ONE -K_LOCAL_QUORUM -K_LOGGED -K_LOGIN -K_MATERIALIZED -K_MODIFY -K_NAN -K_NORECURSIVE -K_NOSUPERUSER -K_NOT -K_NULL -K_OF -K_ON -K_ONE -K_OPTIONS -K_OR -K_ORDER -K_PARTITION -K_PASSWORD -K_PER -K_PERMISSION -K_PERMISSIONS -K_PRIMARY -K_QUORUM -K_RENAME -K_REPLACE -K_REPLICATION -K_RETURNS -K_REVOKE -K_ROLE -K_ROLES -K_INTERNAL -K_LDAP -K_SCHEME -K_SCHEMA -K_SELECT -K_SET -K_SFUNC -K_STATIC -K_STORAGE -K_STYPE -K_SUPERUSER -K_TABLE -K_THREE -K_TIMESTAMP -K_TO -K_TOKEN -K_TRIGGER -K_TRUE -K_TRUNCATE -K_TTL -K_TWO -K_TYPE -K_UNLOGGED -K_UPDATE -K_USE -K_USER -K_USING -K_UUID -K_VALUES -K_VIEW -K_WHERE -K_WITH -K_WRITETIME -K_ASCII -K_CASE_SENITIVE -K_NORMALIZE -K_SIMILARITY_FUNCTION -K_ANALYZED -K_IS_LITERAL -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB -K_TOKENIZATION_ENABLE_STEMMING -K_TOKENIZATION_SKIP_STOP_WORDS -K_TOKENIZATION_LOCALE -K_TOKENIZATION_NORMALIZE_LOWERCASE -K_TOKENIZATION_NORMALIZE_UPPERCASE -K_NORMALIZE_LOWERCASE -K_NORMALIZE_UPPERCASE -K_MODE -K_ANALYZER_CLASS -K_STORAGE_ATTACHED_INDEX -K_SASI_INDEX -K_SOLR_INDEX -K_SPACE_SAVING_NO_JOIN -K_SPACE_SAVING_ALL -K_SPACE_SAVING_SLOW_TRIE_PRECISION -K_SPACE_SAVING_NO_TEXT_FIELD -K_DOC_VALUES -K_COPY_FIELD -K_EXCLUDED -K_INDEXED -K_LOWERCASE -K_COLUMNS -K_PROFILES -K_CONFIG -K_AUTOCOMMIT_TIME -K_DEFAULT_QUERY_FIELD -K_DIRECTORY_FACTORY -K_FILTER_CACHE_LOW_WATERMARK -K_FILTER_CACHE_HIGH_WATERMARK -K_DIRECTORY_FACTORY_CLASS -K_MERGE_MAX_THREAD_COUNT -K_MERGE_MAX_MERGE_COUNT -K_RAM_BUFFER_SIZE -K_REALTIME -K_RECOVERY -K_REINDEX -K_LENIENT -K_STANDARD -K_ENCRYPTED -K_BIGINT -K_BLOB -K_BOOLEAN -K_COUNTER -K_DATE -K_DECIMAL -K_DOUBLE -K_FLOAT -K_FROZEN -K_INET -K_INT -K_LIST -K_MAP -K_SMALLINT -K_TEXT -K_TIMEUUID -K_TIME -K_TINYINT -K_TUPLE -K_VARCHAR -K_VARINT -CODE_BLOCK -STRING_LITERAL -DECIMAL_LITERAL -FLOAT_LITERAL -HEXADECIMAL_LITERAL -REAL_LITERAL -OBJECT_NAME -UUID -OPERATOR_EQ -OPERATOR_LT -OPERATOR_GT -OPERATOR_LTE -OPERATOR_GTE -K_USERS -K_VECTOR - -rule names: -LR_BRACKET -RR_BRACKET -LC_BRACKET -RC_BRACKET -LS_BRACKET -RS_BRACKET -COMMA -SEMI -COLON -SPACE -SPEC_MYSQL_COMMENT -COMMENT_INPUT -LINE_COMMENT -DOT -STAR -DIVIDE -MODULE -PLUS -MINUSMINUS -MINUS -DQUOTE -SQUOTE -K_ADD -K_AGGREGATE -K_ALL -K_ALLOW -K_ALTER -K_AND -K_ANY -K_APPLY -K_AS -K_ASC -K_AUTHORIZE -K_BATCH -K_BEGIN -K_BY -K_CALLED -K_CLUSTERING -K_COLUMNFAMILY -K_COMPACT -K_CONSISTENCY -K_CONTAINS -K_CREATE -K_CUSTOM -K_SEARCH -K_DELETE -K_DESC -K_DESCRIBE -K_DISTINCT -K_DROP -K_DURABLE_WRITES -K_EACH_QUORUM -K_ENTRIES -K_EXECUTE -K_EXISTS -K_FALSE -K_FILTERING -K_FINALFUNC -K_FROM -K_FULL -K_FUNCTION -K_FUNCTIONS -K_GRANT -K_IF -K_IN -K_INDEX -K_INFINITY -K_INITCOND -K_INPUT -K_INSERT -K_INTO -K_IS -K_JSON -K_KEY -K_KEYS -K_KEYSPACE -K_KEYSPACES -K_LANGUAGE -K_LEVEL -K_LIMIT -K_LOCAL_ONE -K_LOCAL_QUORUM -K_LOGGED -K_LOGIN -K_MATERIALIZED -K_MODIFY -K_NAN -K_NORECURSIVE -K_NOSUPERUSER -K_NOT -K_NULL -K_OF -K_ON -K_ONE -K_OPTIONS -K_OR -K_ORDER -K_PARTITION -K_PASSWORD -K_PER -K_PERMISSION -K_PERMISSIONS -K_PRIMARY -K_QUORUM -K_RENAME -K_REPLACE -K_REPLICATION -K_RETURNS -K_REVOKE -K_ROLE -K_ROLES -K_INTERNAL -K_LDAP -K_SCHEME -K_SCHEMA -K_SELECT -K_SET -K_SFUNC -K_STATIC -K_STORAGE -K_STYPE -K_SUPERUSER -K_TABLE -K_THREE -K_TIMESTAMP -K_TO -K_TOKEN -K_TRIGGER -K_TRUE -K_TRUNCATE -K_TTL -K_TWO -K_TYPE -K_UNLOGGED -K_UPDATE -K_USE -K_USER -K_USING -K_UUID -K_VALUES -K_VIEW -K_WHERE -K_WITH -K_WRITETIME -K_ASCII -K_CASE_SENITIVE -K_NORMALIZE -K_SIMILARITY_FUNCTION -K_ANALYZED -K_IS_LITERAL -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB -K_TOKENIZATION_ENABLE_STEMMING -K_TOKENIZATION_SKIP_STOP_WORDS -K_TOKENIZATION_LOCALE -K_TOKENIZATION_NORMALIZE_LOWERCASE -K_TOKENIZATION_NORMALIZE_UPPERCASE -K_NORMALIZE_LOWERCASE -K_NORMALIZE_UPPERCASE -K_MODE -K_ANALYZER_CLASS -K_STORAGE_ATTACHED_INDEX -K_SASI_INDEX -K_SOLR_INDEX -K_SPACE_SAVING_NO_JOIN -K_SPACE_SAVING_ALL -K_SPACE_SAVING_SLOW_TRIE_PRECISION -K_SPACE_SAVING_NO_TEXT_FIELD -K_DOC_VALUES -K_COPY_FIELD -K_EXCLUDED -K_INDEXED -K_LOWERCASE -K_COLUMNS -K_PROFILES -K_CONFIG -K_AUTOCOMMIT_TIME -K_DEFAULT_QUERY_FIELD -K_DIRECTORY_FACTORY -K_FILTER_CACHE_LOW_WATERMARK -K_FILTER_CACHE_HIGH_WATERMARK -K_DIRECTORY_FACTORY_CLASS -K_MERGE_MAX_THREAD_COUNT -K_MERGE_MAX_MERGE_COUNT -K_RAM_BUFFER_SIZE -K_REALTIME -K_RECOVERY -K_REINDEX -K_LENIENT -K_STANDARD -K_ENCRYPTED -K_BIGINT -K_BLOB -K_BOOLEAN -K_COUNTER -K_DATE -K_DECIMAL -K_DOUBLE -K_FLOAT -K_FROZEN -K_INET -K_INT -K_LIST -K_MAP -K_SMALLINT -K_TEXT -K_TIMEUUID -K_TIME -K_TINYINT -K_TUPLE -K_VARCHAR -K_VARINT -A -B -C -D -E -F -G -H -I -J -K -L -M -N -O -P -Q -R -S -T -U -V -W -X -Y -Z -CODE_BLOCK_DELIMITER -CODE_BLOCK_FRAG -HEX_4DIGIT -OBJECT_NAME_FRAG -SQUOTA_STRING -CODE_BLOCK -STRING_LITERAL -DECIMAL_LITERAL -FLOAT_LITERAL -HEXADECIMAL_LITERAL -REAL_LITERAL -OBJECT_NAME -UUID -HEX_DIGIT -DEC_DIGIT -EXPONENT_NUM_PART -OPERATOR_EQ_FRAG -OPERATOR_LT_FRAG -OPERATOR_GT_FRAG -OPERATOR_GTE_FRAG -OPERATOR_LTE_FRAG -OPERATOR_EQ -OPERATOR_LT -OPERATOR_GT -OPERATOR_LTE -OPERATOR_GTE -K_USERS -K_VECTOR - -channel names: -DEFAULT_TOKEN_CHANNEL -HIDDEN - -mode names: -DEFAULT_MODE - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 2, 228, 3769, 8, 1, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101, 4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106, 9, 106, 4, 107, 9, 107, 4, 108, 9, 108, 4, 109, 9, 109, 4, 110, 9, 110, 4, 111, 9, 111, 4, 112, 9, 112, 4, 113, 9, 113, 4, 114, 9, 114, 4, 115, 9, 115, 4, 116, 9, 116, 4, 117, 9, 117, 4, 118, 9, 118, 4, 119, 9, 119, 4, 120, 9, 120, 4, 121, 9, 121, 4, 122, 9, 122, 4, 123, 9, 123, 4, 124, 9, 124, 4, 125, 9, 125, 4, 126, 9, 126, 4, 127, 9, 127, 4, 128, 9, 128, 4, 129, 9, 129, 4, 130, 9, 130, 4, 131, 9, 131, 4, 132, 9, 132, 4, 133, 9, 133, 4, 134, 9, 134, 4, 135, 9, 135, 4, 136, 9, 136, 4, 137, 9, 137, 4, 138, 9, 138, 4, 139, 9, 139, 4, 140, 9, 140, 4, 141, 9, 141, 4, 142, 9, 142, 4, 143, 9, 143, 4, 144, 9, 144, 4, 145, 9, 145, 4, 146, 9, 146, 4, 147, 9, 147, 4, 148, 9, 148, 4, 149, 9, 149, 4, 150, 9, 150, 4, 151, 9, 151, 4, 152, 9, 152, 4, 153, 9, 153, 4, 154, 9, 154, 4, 155, 9, 155, 4, 156, 9, 156, 4, 157, 9, 157, 4, 158, 9, 158, 4, 159, 9, 159, 4, 160, 9, 160, 4, 161, 9, 161, 4, 162, 9, 162, 4, 163, 9, 163, 4, 164, 9, 164, 4, 165, 9, 165, 4, 166, 9, 166, 4, 167, 9, 167, 4, 168, 9, 168, 4, 169, 9, 169, 4, 170, 9, 170, 4, 171, 9, 171, 4, 172, 9, 172, 4, 173, 9, 173, 4, 174, 9, 174, 4, 175, 9, 175, 4, 176, 9, 176, 4, 177, 9, 177, 4, 178, 9, 178, 4, 179, 9, 179, 4, 180, 9, 180, 4, 181, 9, 181, 4, 182, 9, 182, 4, 183, 9, 183, 4, 184, 9, 184, 4, 185, 9, 185, 4, 186, 9, 186, 4, 187, 9, 187, 4, 188, 9, 188, 4, 189, 9, 189, 4, 190, 9, 190, 4, 191, 9, 191, 4, 192, 9, 192, 4, 193, 9, 193, 4, 194, 9, 194, 4, 195, 9, 195, 4, 196, 9, 196, 4, 197, 9, 197, 4, 198, 9, 198, 4, 199, 9, 199, 4, 200, 9, 200, 4, 201, 9, 201, 4, 202, 9, 202, 4, 203, 9, 203, 4, 204, 9, 204, 4, 205, 9, 205, 4, 206, 9, 206, 4, 207, 9, 207, 4, 208, 9, 208, 4, 209, 9, 209, 4, 210, 9, 210, 4, 211, 9, 211, 4, 212, 9, 212, 4, 213, 9, 213, 4, 214, 9, 214, 4, 215, 9, 215, 4, 216, 9, 216, 4, 217, 9, 217, 4, 218, 9, 218, 4, 219, 9, 219, 4, 220, 9, 220, 4, 221, 9, 221, 4, 222, 9, 222, 4, 223, 9, 223, 4, 224, 9, 224, 4, 225, 9, 225, 4, 226, 9, 226, 4, 227, 9, 227, 4, 228, 9, 228, 4, 229, 9, 229, 4, 230, 9, 230, 4, 231, 9, 231, 4, 232, 9, 232, 4, 233, 9, 233, 4, 234, 9, 234, 4, 235, 9, 235, 4, 236, 9, 236, 4, 237, 9, 237, 4, 238, 9, 238, 4, 239, 9, 239, 4, 240, 9, 240, 4, 241, 9, 241, 4, 242, 9, 242, 4, 243, 9, 243, 4, 244, 9, 244, 4, 245, 9, 245, 4, 246, 9, 246, 4, 247, 9, 247, 4, 248, 9, 248, 4, 249, 9, 249, 4, 250, 9, 250, 4, 251, 9, 251, 4, 252, 9, 252, 4, 253, 9, 253, 4, 254, 9, 254, 4, 255, 9, 255, 4, 256, 9, 256, 4, 257, 9, 257, 4, 258, 9, 258, 4, 259, 9, 259, 4, 260, 9, 260, 4, 261, 9, 261, 4, 262, 9, 262, 4, 263, 9, 263, 4, 264, 9, 264, 4, 265, 9, 265, 4, 266, 9, 266, 3, 2, 3, 2, 3, 3, 3, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 7, 3, 7, 3, 8, 3, 8, 3, 9, 3, 9, 3, 10, 3, 10, 3, 11, 6, 11, 553, 10, 11, 13, 11, 14, 11, 554, 3, 11, 3, 11, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 6, 12, 564, 10, 12, 13, 12, 14, 12, 565, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 13, 3, 13, 3, 13, 3, 13, 7, 13, 577, 10, 13, 12, 13, 14, 13, 580, 11, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 593, 10, 14, 3, 14, 7, 14, 596, 10, 14, 12, 14, 14, 14, 599, 11, 14, 3, 14, 5, 14, 602, 10, 14, 3, 14, 3, 14, 5, 14, 606, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 612, 10, 14, 3, 14, 3, 14, 5, 14, 616, 10, 14, 5, 14, 618, 10, 14, 3, 14, 3, 14, 3, 15, 3, 15, 3, 16, 3, 16, 3, 17, 3, 17, 3, 18, 3, 18, 3, 19, 3, 19, 3, 20, 3, 20, 3, 20, 3, 21, 3, 21, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 648, 10, 24, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 5, 25, 669, 10, 25, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 3, 26, 5, 26, 678, 10, 26, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 3, 27, 5, 27, 691, 10, 27, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 28, 5, 28, 704, 10, 28, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 5, 29, 713, 10, 29, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 3, 30, 5, 30, 722, 10, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 5, 31, 735, 10, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 32, 5, 32, 742, 10, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 5, 33, 751, 10, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 5, 34, 772, 10, 34, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 3, 35, 5, 35, 785, 10, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, 36, 798, 10, 36, 3, 37, 3, 37, 3, 37, 3, 37, 3, 37, 5, 37, 805, 10, 37, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 3, 38, 5, 38, 820, 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 5, 39, 843, 10, 39, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 3, 40, 5, 40, 870, 10, 40, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 3, 41, 5, 41, 887, 10, 41, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 3, 42, 5, 42, 912, 10, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 3, 43, 5, 43, 931, 10, 43, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 3, 44, 5, 44, 946, 10, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 5, 45, 961, 10, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 5, 46, 976, 10, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 5, 47, 991, 10, 47, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 3, 48, 5, 48, 1002, 10, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 5, 49, 1021, 10, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 3, 50, 5, 50, 1040, 10, 50, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 3, 51, 5, 51, 1051, 10, 51, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 3, 52, 5, 52, 1082, 10, 52, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 3, 53, 5, 53, 1107, 10, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 5, 54, 1124, 10, 54, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 3, 55, 5, 55, 1141, 10, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 5, 56, 1156, 10, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 5, 57, 1177, 10, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 5, 58, 1198, 10, 58, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 3, 59, 5, 59, 1219, 10, 59, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 3, 60, 5, 60, 1230, 10, 60, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61, 1241, 10, 61, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 3, 62, 5, 62, 1260, 10, 62, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 3, 63, 5, 63, 1281, 10, 63, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 5, 64, 1294, 10, 64, 3, 65, 3, 65, 3, 65, 3, 65, 3, 65, 5, 65, 1301, 10, 65, 3, 66, 3, 66, 3, 66, 3, 66, 3, 66, 5, 66, 1308, 10, 66, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 3, 67, 5, 67, 1321, 10, 67, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 3, 68, 5, 68, 1340, 10, 68, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 5, 69, 1359, 10, 69, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 3, 70, 5, 70, 1372, 10, 70, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 3, 71, 5, 71, 1387, 10, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 5, 72, 1398, 10, 72, 3, 73, 3, 73, 3, 73, 3, 73, 3, 73, 5, 73, 1405, 10, 73, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 5, 74, 1416, 10, 74, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 3, 75, 5, 75, 1425, 10, 75, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 3, 76, 5, 76, 1436, 10, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 5, 77, 1455, 10, 77, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 3, 78, 5, 78, 1476, 10, 78, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 3, 79, 5, 79, 1495, 10, 79, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 3, 80, 5, 80, 1508, 10, 80, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 3, 81, 5, 81, 1521, 10, 81, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 3, 82, 5, 82, 1542, 10, 82, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 3, 83, 5, 83, 1569, 10, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 5, 84, 1584, 10, 84, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 3, 85, 5, 85, 1597, 10, 85, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 3, 86, 5, 86, 1624, 10, 86, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 3, 87, 5, 87, 1639, 10, 87, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 5, 88, 1648, 10, 88, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 3, 89, 5, 89, 1673, 10, 89, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 3, 90, 5, 90, 1698, 10, 90, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 3, 91, 5, 91, 1707, 10, 91, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 3, 92, 5, 92, 1718, 10, 92, 3, 93, 3, 93, 3, 93, 3, 93, 3, 93, 5, 93, 1725, 10, 93, 3, 94, 3, 94, 3, 94, 3, 94, 3, 94, 5, 94, 1732, 10, 94, 3, 95, 3, 95, 3, 95, 3, 95, 3, 95, 3, 95, 3, 95, 5, 95, 1741, 10, 95, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 5, 96, 1758, 10, 96, 3, 97, 3, 97, 3, 97, 3, 97, 3, 97, 5, 97, 1765, 10, 97, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 5, 98, 1778, 10, 98, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 3, 99, 5, 99, 1799, 10, 99, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 3, 100, 5, 100, 1818, 10, 100, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 3, 101, 5, 101, 1827, 10, 101, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 5, 102, 1850, 10, 102, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1875, 10, 103, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 5, 104, 1892, 10, 104, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1907, 10, 105, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 3, 106, 5, 106, 1922, 10, 106, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 5, 107, 1939, 10, 107, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 3, 108, 5, 108, 1964, 10, 108, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 3, 109, 5, 109, 1981, 10, 109, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 3, 110, 5, 110, 1996, 10, 110, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2007, 10, 111, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 3, 112, 5, 112, 2020, 10, 112, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 5, 113, 2039, 10, 113, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 5, 114, 2050, 10, 114, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 5, 115, 2064, 10, 115, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 5, 116, 2079, 10, 116, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 5, 117, 2094, 10, 117, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 3, 118, 5, 118, 2103, 10, 118, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 3, 119, 5, 119, 2116, 10, 119, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 5, 120, 2131, 10, 120, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 5, 121, 2148, 10, 121, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 3, 122, 5, 122, 2161, 10, 122, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 3, 123, 5, 123, 2182, 10, 123, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 3, 124, 5, 124, 2195, 10, 124, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 3, 125, 5, 125, 2208, 10, 125, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 5, 126, 2229, 10, 126, 3, 127, 3, 127, 3, 127, 3, 127, 3, 127, 5, 127, 2236, 10, 127, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 5, 128, 2249, 10, 128, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 5, 129, 2266, 10, 129, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 5, 130, 2284, 10, 130, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 5, 131, 2303, 10, 131, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 5, 132, 2312, 10, 132, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 5, 133, 2321, 10, 133, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 3, 134, 5, 134, 2332, 10, 134, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 3, 135, 5, 135, 2351, 10, 135, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 3, 136, 5, 136, 2366, 10, 136, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 3, 137, 5, 137, 2375, 10, 137, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 3, 138, 5, 138, 2386, 10, 138, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 5, 139, 2399, 10, 139, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 3, 140, 5, 140, 2410, 10, 140, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 3, 141, 5, 141, 2425, 10, 141, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 3, 142, 5, 142, 2436, 10, 142, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 5, 143, 2449, 10, 143, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 3, 144, 5, 144, 2460, 10, 144, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 3, 145, 5, 145, 2481, 10, 145, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 3, 146, 5, 146, 2497, 10, 146, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 147, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 3, 149, 5, 149, 2570, 10, 149, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 150, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 151, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 152, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 153, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 155, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 157, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 160, 3, 160, 3, 160, 3, 160, 3, 160, 3, 160, 3, 160, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 162, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 163, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 164, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 165, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 166, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 170, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 172, 3, 172, 3, 172, 3, 172, 3, 172, 3, 172, 3, 172, 3, 172, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 173, 3, 174, 3, 174, 3, 174, 3, 174, 3, 174, 3, 174, 3, 174, 3, 174, 3, 175, 3, 175, 3, 175, 3, 175, 3, 175, 3, 175, 3, 175, 3, 175, 3, 175, 3, 176, 3, 176, 3, 176, 3, 176, 3, 176, 3, 176, 3, 176, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 177, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 178, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 179, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 180, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 181, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 182, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 183, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 184, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 185, 3, 186, 3, 186, 3, 186, 3, 186, 3, 186, 3, 186, 3, 186, 3, 186, 3, 186, 3, 187, 3, 187, 3, 187, 3, 187, 3, 187, 3, 187, 3, 187, 3, 187, 3, 187, 3, 188, 3, 188, 3, 188, 3, 188, 3, 188, 3, 188, 3, 188, 3, 188, 3, 189, 3, 189, 3, 189, 3, 189, 3, 189, 3, 189, 3, 189, 3, 189, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 190, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 191, 3, 192, 3, 192, 3, 192, 3, 192, 3, 192, 3, 192, 3, 192, 3, 193, 3, 193, 3, 193, 3, 193, 3, 193, 3, 194, 3, 194, 3, 194, 3, 194, 3, 194, 3, 194, 3, 194, 3, 194, 3, 195, 3, 195, 3, 195, 3, 195, 3, 195, 3, 195, 3, 195, 3, 195, 3, 196, 3, 196, 3, 196, 3, 196, 3, 196, 3, 197, 3, 197, 3, 197, 3, 197, 3, 197, 3, 197, 3, 197, 3, 197, 3, 198, 3, 198, 3, 198, 3, 198, 3, 198, 3, 198, 3, 198, 3, 199, 3, 199, 3, 199, 3, 199, 3, 199, 3, 199, 3, 200, 3, 200, 3, 200, 3, 200, 3, 200, 3, 200, 3, 200, 3, 201, 3, 201, 3, 201, 3, 201, 3, 201, 3, 202, 3, 202, 3, 202, 3, 202, 3, 203, 3, 203, 3, 203, 3, 203, 3, 203, 3, 204, 3, 204, 3, 204, 3, 204, 3, 205, 3, 205, 3, 205, 3, 205, 3, 205, 3, 205, 3, 205, 3, 205, 3, 205, 3, 206, 3, 206, 3, 206, 3, 206, 3, 206, 3, 207, 3, 207, 3, 207, 3, 207, 3, 207, 3, 207, 3, 207, 3, 207, 3, 207, 3, 208, 3, 208, 3, 208, 3, 208, 3, 208, 3, 209, 3, 209, 3, 209, 3, 209, 3, 209, 3, 209, 3, 209, 3, 209, 3, 210, 3, 210, 3, 210, 3, 210, 3, 210, 3, 210, 3, 211, 3, 211, 3, 211, 3, 211, 3, 211, 3, 211, 3, 211, 3, 211, 3, 212, 3, 212, 3, 212, 3, 212, 3, 212, 3, 212, 3, 212, 3, 213, 3, 213, 3, 214, 3, 214, 3, 215, 3, 215, 3, 216, 3, 216, 3, 217, 3, 217, 3, 218, 3, 218, 3, 219, 3, 219, 3, 220, 3, 220, 3, 221, 3, 221, 3, 222, 3, 222, 3, 223, 3, 223, 3, 224, 3, 224, 3, 225, 3, 225, 3, 226, 3, 226, 3, 227, 3, 227, 3, 228, 3, 228, 3, 229, 3, 229, 3, 230, 3, 230, 3, 231, 3, 231, 3, 232, 3, 232, 3, 233, 3, 233, 3, 234, 3, 234, 3, 235, 3, 235, 3, 236, 3, 236, 3, 237, 3, 237, 3, 238, 3, 238, 3, 239, 3, 239, 3, 239, 3, 240, 3, 240, 3, 240, 3, 240, 3, 240, 3, 240, 7, 240, 3559, 10, 240, 12, 240, 14, 240, 3562, 11, 240, 3, 240, 3, 240, 3, 240, 3, 241, 3, 241, 3, 241, 3, 241, 3, 241, 3, 242, 3, 242, 7, 242, 3574, 10, 242, 12, 242, 14, 242, 3577, 11, 242, 3, 242, 3, 242, 6, 242, 3581, 10, 242, 13, 242, 14, 242, 3582, 3, 242, 5, 242, 3586, 10, 242, 3, 243, 3, 243, 3, 243, 3, 243, 3, 243, 3, 243, 7, 243, 3594, 10, 243, 12, 243, 14, 243, 3597, 11, 243, 3, 243, 3, 243, 3, 244, 3, 244, 3, 245, 3, 245, 3, 246, 6, 246, 3606, 10, 246, 13, 246, 14, 246, 3607, 3, 247, 5, 247, 3611, 10, 247, 3, 247, 6, 247, 3614, 10, 247, 13, 247, 14, 247, 3615, 3, 247, 3, 247, 6, 247, 3620, 10, 247, 13, 247, 14, 247, 3621, 5, 247, 3624, 10, 247, 3, 248, 3, 248, 3, 248, 3, 248, 3, 248, 6, 248, 3631, 10, 248, 13, 248, 14, 248, 3632, 3, 248, 3, 248, 3, 248, 3, 248, 3, 248, 3, 248, 6, 248, 3641, 10, 248, 13, 248, 14, 248, 3642, 5, 248, 3645, 10, 248, 3, 249, 6, 249, 3648, 10, 249, 13, 249, 14, 249, 3649, 5, 249, 3652, 10, 249, 3, 249, 3, 249, 6, 249, 3656, 10, 249, 13, 249, 14, 249, 3657, 3, 249, 6, 249, 3661, 10, 249, 13, 249, 14, 249, 3662, 3, 249, 3, 249, 3, 249, 3, 249, 6, 249, 3669, 10, 249, 13, 249, 14, 249, 3670, 5, 249, 3673, 10, 249, 3, 249, 3, 249, 6, 249, 3677, 10, 249, 13, 249, 14, 249, 3678, 3, 249, 3, 249, 3, 249, 6, 249, 3684, 10, 249, 13, 249, 14, 249, 3685, 3, 249, 3, 249, 5, 249, 3690, 10, 249, 3, 250, 3, 250, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 251, 3, 252, 3, 252, 3, 253, 3, 253, 3, 254, 3, 254, 5, 254, 3713, 10, 254, 3, 254, 6, 254, 3716, 10, 254, 13, 254, 14, 254, 3717, 3, 255, 3, 255, 3, 256, 3, 256, 3, 257, 3, 257, 3, 258, 3, 258, 3, 258, 3, 259, 3, 259, 3, 259, 3, 260, 3, 260, 3, 261, 3, 261, 3, 262, 3, 262, 3, 263, 3, 263, 3, 264, 3, 264, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 3, 265, 5, 265, 3753, 10, 265, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 3, 266, 5, 266, 3768, 10, 266, 4, 565, 578, 2, 267, 3, 3, 5, 4, 7, 5, 9, 6, 11, 7, 13, 8, 15, 9, 17, 10, 19, 11, 21, 12, 23, 13, 25, 14, 27, 15, 29, 16, 31, 17, 33, 18, 35, 19, 37, 20, 39, 21, 41, 22, 43, 23, 45, 24, 47, 25, 49, 26, 51, 27, 53, 28, 55, 29, 57, 30, 59, 31, 61, 32, 63, 33, 65, 34, 67, 35, 69, 36, 71, 37, 73, 38, 75, 39, 77, 40, 79, 41, 81, 42, 83, 43, 85, 44, 87, 45, 89, 46, 91, 47, 93, 48, 95, 49, 97, 50, 99, 51, 101, 52, 103, 53, 105, 54, 107, 55, 109, 56, 111, 57, 113, 58, 115, 59, 117, 60, 119, 61, 121, 62, 123, 63, 125, 64, 127, 65, 129, 66, 131, 67, 133, 68, 135, 69, 137, 70, 139, 71, 141, 72, 143, 73, 145, 74, 147, 75, 149, 76, 151, 77, 153, 78, 155, 79, 157, 80, 159, 81, 161, 82, 163, 83, 165, 84, 167, 85, 169, 86, 171, 87, 173, 88, 175, 89, 177, 90, 179, 91, 181, 92, 183, 93, 185, 94, 187, 95, 189, 96, 191, 97, 193, 98, 195, 99, 197, 100, 199, 101, 201, 102, 203, 103, 205, 104, 207, 105, 209, 106, 211, 107, 213, 108, 215, 109, 217, 110, 219, 111, 221, 112, 223, 113, 225, 114, 227, 115, 229, 116, 231, 117, 233, 118, 235, 119, 237, 120, 239, 121, 241, 122, 243, 123, 245, 124, 247, 125, 249, 126, 251, 127, 253, 128, 255, 129, 257, 130, 259, 131, 261, 132, 263, 133, 265, 134, 267, 135, 269, 136, 271, 137, 273, 138, 275, 139, 277, 140, 279, 141, 281, 142, 283, 143, 285, 144, 287, 145, 289, 146, 291, 147, 293, 148, 295, 149, 297, 150, 299, 151, 301, 152, 303, 153, 305, 154, 307, 155, 309, 156, 311, 157, 313, 158, 315, 159, 317, 160, 319, 161, 321, 162, 323, 163, 325, 164, 327, 165, 329, 166, 331, 167, 333, 168, 335, 169, 337, 170, 339, 171, 341, 172, 343, 173, 345, 174, 347, 175, 349, 176, 351, 177, 353, 178, 355, 179, 357, 180, 359, 181, 361, 182, 363, 183, 365, 184, 367, 185, 369, 186, 371, 187, 373, 188, 375, 189, 377, 190, 379, 191, 381, 192, 383, 193, 385, 194, 387, 195, 389, 196, 391, 197, 393, 198, 395, 199, 397, 200, 399, 201, 401, 202, 403, 203, 405, 204, 407, 205, 409, 206, 411, 207, 413, 208, 415, 209, 417, 210, 419, 211, 421, 212, 423, 213, 425, 2, 427, 2, 429, 2, 431, 2, 433, 2, 435, 2, 437, 2, 439, 2, 441, 2, 443, 2, 445, 2, 447, 2, 449, 2, 451, 2, 453, 2, 455, 2, 457, 2, 459, 2, 461, 2, 463, 2, 465, 2, 467, 2, 469, 2, 471, 2, 473, 2, 475, 2, 477, 2, 479, 2, 481, 2, 483, 2, 485, 2, 487, 214, 489, 215, 491, 216, 493, 217, 495, 218, 497, 219, 499, 220, 501, 221, 503, 2, 505, 2, 507, 2, 509, 2, 511, 2, 513, 2, 515, 2, 517, 2, 519, 222, 521, 223, 523, 224, 525, 225, 527, 226, 529, 227, 531, 228, 3, 2, 38, 5, 2, 11, 12, 15, 15, 34, 34, 4, 2, 12, 12, 15, 15, 4, 2, 67, 67, 99, 99, 4, 2, 68, 68, 100, 100, 4, 2, 69, 69, 101, 101, 4, 2, 70, 70, 102, 102, 4, 2, 71, 71, 103, 103, 4, 2, 72, 72, 104, 104, 4, 2, 73, 73, 105, 105, 4, 2, 74, 74, 106, 106, 4, 2, 75, 75, 107, 107, 4, 2, 76, 76, 108, 108, 4, 2, 77, 77, 109, 109, 4, 2, 78, 78, 110, 110, 4, 2, 79, 79, 111, 111, 4, 2, 80, 80, 112, 112, 4, 2, 81, 81, 113, 113, 4, 2, 82, 82, 114, 114, 4, 2, 83, 83, 115, 115, 4, 2, 84, 84, 116, 116, 4, 2, 85, 85, 117, 117, 4, 2, 86, 86, 118, 118, 4, 2, 87, 87, 119, 119, 4, 2, 88, 88, 120, 120, 4, 2, 89, 89, 121, 121, 4, 2, 90, 90, 122, 122, 4, 2, 91, 91, 123, 123, 4, 2, 92, 92, 124, 124, 3, 2, 38, 38, 5, 2, 50, 59, 67, 72, 99, 104, 4, 2, 67, 92, 99, 124, 7, 2, 38, 38, 50, 59, 67, 92, 97, 97, 99, 124, 3, 2, 36, 36, 4, 2, 41, 41, 94, 94, 3, 2, 50, 59, 4, 2, 50, 59, 67, 72, 2, 3897, 2, 3, 3, 2, 2, 2, 2, 5, 3, 2, 2, 2, 2, 7, 3, 2, 2, 2, 2, 9, 3, 2, 2, 2, 2, 11, 3, 2, 2, 2, 2, 13, 3, 2, 2, 2, 2, 15, 3, 2, 2, 2, 2, 17, 3, 2, 2, 2, 2, 19, 3, 2, 2, 2, 2, 21, 3, 2, 2, 2, 2, 23, 3, 2, 2, 2, 2, 25, 3, 2, 2, 2, 2, 27, 3, 2, 2, 2, 2, 29, 3, 2, 2, 2, 2, 31, 3, 2, 2, 2, 2, 33, 3, 2, 2, 2, 2, 35, 3, 2, 2, 2, 2, 37, 3, 2, 2, 2, 2, 39, 3, 2, 2, 2, 2, 41, 3, 2, 2, 2, 2, 43, 3, 2, 2, 2, 2, 45, 3, 2, 2, 2, 2, 47, 3, 2, 2, 2, 2, 49, 3, 2, 2, 2, 2, 51, 3, 2, 2, 2, 2, 53, 3, 2, 2, 2, 2, 55, 3, 2, 2, 2, 2, 57, 3, 2, 2, 2, 2, 59, 3, 2, 2, 2, 2, 61, 3, 2, 2, 2, 2, 63, 3, 2, 2, 2, 2, 65, 3, 2, 2, 2, 2, 67, 3, 2, 2, 2, 2, 69, 3, 2, 2, 2, 2, 71, 3, 2, 2, 2, 2, 73, 3, 2, 2, 2, 2, 75, 3, 2, 2, 2, 2, 77, 3, 2, 2, 2, 2, 79, 3, 2, 2, 2, 2, 81, 3, 2, 2, 2, 2, 83, 3, 2, 2, 2, 2, 85, 3, 2, 2, 2, 2, 87, 3, 2, 2, 2, 2, 89, 3, 2, 2, 2, 2, 91, 3, 2, 2, 2, 2, 93, 3, 2, 2, 2, 2, 95, 3, 2, 2, 2, 2, 97, 3, 2, 2, 2, 2, 99, 3, 2, 2, 2, 2, 101, 3, 2, 2, 2, 2, 103, 3, 2, 2, 2, 2, 105, 3, 2, 2, 2, 2, 107, 3, 2, 2, 2, 2, 109, 3, 2, 2, 2, 2, 111, 3, 2, 2, 2, 2, 113, 3, 2, 2, 2, 2, 115, 3, 2, 2, 2, 2, 117, 3, 2, 2, 2, 2, 119, 3, 2, 2, 2, 2, 121, 3, 2, 2, 2, 2, 123, 3, 2, 2, 2, 2, 125, 3, 2, 2, 2, 2, 127, 3, 2, 2, 2, 2, 129, 3, 2, 2, 2, 2, 131, 3, 2, 2, 2, 2, 133, 3, 2, 2, 2, 2, 135, 3, 2, 2, 2, 2, 137, 3, 2, 2, 2, 2, 139, 3, 2, 2, 2, 2, 141, 3, 2, 2, 2, 2, 143, 3, 2, 2, 2, 2, 145, 3, 2, 2, 2, 2, 147, 3, 2, 2, 2, 2, 149, 3, 2, 2, 2, 2, 151, 3, 2, 2, 2, 2, 153, 3, 2, 2, 2, 2, 155, 3, 2, 2, 2, 2, 157, 3, 2, 2, 2, 2, 159, 3, 2, 2, 2, 2, 161, 3, 2, 2, 2, 2, 163, 3, 2, 2, 2, 2, 165, 3, 2, 2, 2, 2, 167, 3, 2, 2, 2, 2, 169, 3, 2, 2, 2, 2, 171, 3, 2, 2, 2, 2, 173, 3, 2, 2, 2, 2, 175, 3, 2, 2, 2, 2, 177, 3, 2, 2, 2, 2, 179, 3, 2, 2, 2, 2, 181, 3, 2, 2, 2, 2, 183, 3, 2, 2, 2, 2, 185, 3, 2, 2, 2, 2, 187, 3, 2, 2, 2, 2, 189, 3, 2, 2, 2, 2, 191, 3, 2, 2, 2, 2, 193, 3, 2, 2, 2, 2, 195, 3, 2, 2, 2, 2, 197, 3, 2, 2, 2, 2, 199, 3, 2, 2, 2, 2, 201, 3, 2, 2, 2, 2, 203, 3, 2, 2, 2, 2, 205, 3, 2, 2, 2, 2, 207, 3, 2, 2, 2, 2, 209, 3, 2, 2, 2, 2, 211, 3, 2, 2, 2, 2, 213, 3, 2, 2, 2, 2, 215, 3, 2, 2, 2, 2, 217, 3, 2, 2, 2, 2, 219, 3, 2, 2, 2, 2, 221, 3, 2, 2, 2, 2, 223, 3, 2, 2, 2, 2, 225, 3, 2, 2, 2, 2, 227, 3, 2, 2, 2, 2, 229, 3, 2, 2, 2, 2, 231, 3, 2, 2, 2, 2, 233, 3, 2, 2, 2, 2, 235, 3, 2, 2, 2, 2, 237, 3, 2, 2, 2, 2, 239, 3, 2, 2, 2, 2, 241, 3, 2, 2, 2, 2, 243, 3, 2, 2, 2, 2, 245, 3, 2, 2, 2, 2, 247, 3, 2, 2, 2, 2, 249, 3, 2, 2, 2, 2, 251, 3, 2, 2, 2, 2, 253, 3, 2, 2, 2, 2, 255, 3, 2, 2, 2, 2, 257, 3, 2, 2, 2, 2, 259, 3, 2, 2, 2, 2, 261, 3, 2, 2, 2, 2, 263, 3, 2, 2, 2, 2, 265, 3, 2, 2, 2, 2, 267, 3, 2, 2, 2, 2, 269, 3, 2, 2, 2, 2, 271, 3, 2, 2, 2, 2, 273, 3, 2, 2, 2, 2, 275, 3, 2, 2, 2, 2, 277, 3, 2, 2, 2, 2, 279, 3, 2, 2, 2, 2, 281, 3, 2, 2, 2, 2, 283, 3, 2, 2, 2, 2, 285, 3, 2, 2, 2, 2, 287, 3, 2, 2, 2, 2, 289, 3, 2, 2, 2, 2, 291, 3, 2, 2, 2, 2, 293, 3, 2, 2, 2, 2, 295, 3, 2, 2, 2, 2, 297, 3, 2, 2, 2, 2, 299, 3, 2, 2, 2, 2, 301, 3, 2, 2, 2, 2, 303, 3, 2, 2, 2, 2, 305, 3, 2, 2, 2, 2, 307, 3, 2, 2, 2, 2, 309, 3, 2, 2, 2, 2, 311, 3, 2, 2, 2, 2, 313, 3, 2, 2, 2, 2, 315, 3, 2, 2, 2, 2, 317, 3, 2, 2, 2, 2, 319, 3, 2, 2, 2, 2, 321, 3, 2, 2, 2, 2, 323, 3, 2, 2, 2, 2, 325, 3, 2, 2, 2, 2, 327, 3, 2, 2, 2, 2, 329, 3, 2, 2, 2, 2, 331, 3, 2, 2, 2, 2, 333, 3, 2, 2, 2, 2, 335, 3, 2, 2, 2, 2, 337, 3, 2, 2, 2, 2, 339, 3, 2, 2, 2, 2, 341, 3, 2, 2, 2, 2, 343, 3, 2, 2, 2, 2, 345, 3, 2, 2, 2, 2, 347, 3, 2, 2, 2, 2, 349, 3, 2, 2, 2, 2, 351, 3, 2, 2, 2, 2, 353, 3, 2, 2, 2, 2, 355, 3, 2, 2, 2, 2, 357, 3, 2, 2, 2, 2, 359, 3, 2, 2, 2, 2, 361, 3, 2, 2, 2, 2, 363, 3, 2, 2, 2, 2, 365, 3, 2, 2, 2, 2, 367, 3, 2, 2, 2, 2, 369, 3, 2, 2, 2, 2, 371, 3, 2, 2, 2, 2, 373, 3, 2, 2, 2, 2, 375, 3, 2, 2, 2, 2, 377, 3, 2, 2, 2, 2, 379, 3, 2, 2, 2, 2, 381, 3, 2, 2, 2, 2, 383, 3, 2, 2, 2, 2, 385, 3, 2, 2, 2, 2, 387, 3, 2, 2, 2, 2, 389, 3, 2, 2, 2, 2, 391, 3, 2, 2, 2, 2, 393, 3, 2, 2, 2, 2, 395, 3, 2, 2, 2, 2, 397, 3, 2, 2, 2, 2, 399, 3, 2, 2, 2, 2, 401, 3, 2, 2, 2, 2, 403, 3, 2, 2, 2, 2, 405, 3, 2, 2, 2, 2, 407, 3, 2, 2, 2, 2, 409, 3, 2, 2, 2, 2, 411, 3, 2, 2, 2, 2, 413, 3, 2, 2, 2, 2, 415, 3, 2, 2, 2, 2, 417, 3, 2, 2, 2, 2, 419, 3, 2, 2, 2, 2, 421, 3, 2, 2, 2, 2, 423, 3, 2, 2, 2, 2, 487, 3, 2, 2, 2, 2, 489, 3, 2, 2, 2, 2, 491, 3, 2, 2, 2, 2, 493, 3, 2, 2, 2, 2, 495, 3, 2, 2, 2, 2, 497, 3, 2, 2, 2, 2, 499, 3, 2, 2, 2, 2, 501, 3, 2, 2, 2, 2, 519, 3, 2, 2, 2, 2, 521, 3, 2, 2, 2, 2, 523, 3, 2, 2, 2, 2, 525, 3, 2, 2, 2, 2, 527, 3, 2, 2, 2, 2, 529, 3, 2, 2, 2, 2, 531, 3, 2, 2, 2, 3, 533, 3, 2, 2, 2, 5, 535, 3, 2, 2, 2, 7, 537, 3, 2, 2, 2, 9, 539, 3, 2, 2, 2, 11, 541, 3, 2, 2, 2, 13, 543, 3, 2, 2, 2, 15, 545, 3, 2, 2, 2, 17, 547, 3, 2, 2, 2, 19, 549, 3, 2, 2, 2, 21, 552, 3, 2, 2, 2, 23, 558, 3, 2, 2, 2, 25, 572, 3, 2, 2, 2, 27, 617, 3, 2, 2, 2, 29, 621, 3, 2, 2, 2, 31, 623, 3, 2, 2, 2, 33, 625, 3, 2, 2, 2, 35, 627, 3, 2, 2, 2, 37, 629, 3, 2, 2, 2, 39, 631, 3, 2, 2, 2, 41, 634, 3, 2, 2, 2, 43, 636, 3, 2, 2, 2, 45, 638, 3, 2, 2, 2, 47, 647, 3, 2, 2, 2, 49, 668, 3, 2, 2, 2, 51, 677, 3, 2, 2, 2, 53, 690, 3, 2, 2, 2, 55, 703, 3, 2, 2, 2, 57, 712, 3, 2, 2, 2, 59, 721, 3, 2, 2, 2, 61, 734, 3, 2, 2, 2, 63, 741, 3, 2, 2, 2, 65, 750, 3, 2, 2, 2, 67, 771, 3, 2, 2, 2, 69, 784, 3, 2, 2, 2, 71, 797, 3, 2, 2, 2, 73, 804, 3, 2, 2, 2, 75, 819, 3, 2, 2, 2, 77, 842, 3, 2, 2, 2, 79, 869, 3, 2, 2, 2, 81, 886, 3, 2, 2, 2, 83, 911, 3, 2, 2, 2, 85, 930, 3, 2, 2, 2, 87, 945, 3, 2, 2, 2, 89, 960, 3, 2, 2, 2, 91, 975, 3, 2, 2, 2, 93, 990, 3, 2, 2, 2, 95, 1001, 3, 2, 2, 2, 97, 1020, 3, 2, 2, 2, 99, 1039, 3, 2, 2, 2, 101, 1050, 3, 2, 2, 2, 103, 1081, 3, 2, 2, 2, 105, 1106, 3, 2, 2, 2, 107, 1123, 3, 2, 2, 2, 109, 1140, 3, 2, 2, 2, 111, 1155, 3, 2, 2, 2, 113, 1176, 3, 2, 2, 2, 115, 1197, 3, 2, 2, 2, 117, 1218, 3, 2, 2, 2, 119, 1229, 3, 2, 2, 2, 121, 1240, 3, 2, 2, 2, 123, 1259, 3, 2, 2, 2, 125, 1280, 3, 2, 2, 2, 127, 1293, 3, 2, 2, 2, 129, 1300, 3, 2, 2, 2, 131, 1307, 3, 2, 2, 2, 133, 1320, 3, 2, 2, 2, 135, 1339, 3, 2, 2, 2, 137, 1358, 3, 2, 2, 2, 139, 1371, 3, 2, 2, 2, 141, 1386, 3, 2, 2, 2, 143, 1397, 3, 2, 2, 2, 145, 1404, 3, 2, 2, 2, 147, 1415, 3, 2, 2, 2, 149, 1424, 3, 2, 2, 2, 151, 1435, 3, 2, 2, 2, 153, 1454, 3, 2, 2, 2, 155, 1475, 3, 2, 2, 2, 157, 1494, 3, 2, 2, 2, 159, 1507, 3, 2, 2, 2, 161, 1520, 3, 2, 2, 2, 163, 1541, 3, 2, 2, 2, 165, 1568, 3, 2, 2, 2, 167, 1583, 3, 2, 2, 2, 169, 1596, 3, 2, 2, 2, 171, 1623, 3, 2, 2, 2, 173, 1638, 3, 2, 2, 2, 175, 1647, 3, 2, 2, 2, 177, 1672, 3, 2, 2, 2, 179, 1697, 3, 2, 2, 2, 181, 1706, 3, 2, 2, 2, 183, 1717, 3, 2, 2, 2, 185, 1724, 3, 2, 2, 2, 187, 1731, 3, 2, 2, 2, 189, 1740, 3, 2, 2, 2, 191, 1757, 3, 2, 2, 2, 193, 1764, 3, 2, 2, 2, 195, 1777, 3, 2, 2, 2, 197, 1798, 3, 2, 2, 2, 199, 1817, 3, 2, 2, 2, 201, 1826, 3, 2, 2, 2, 203, 1849, 3, 2, 2, 2, 205, 1874, 3, 2, 2, 2, 207, 1891, 3, 2, 2, 2, 209, 1906, 3, 2, 2, 2, 211, 1921, 3, 2, 2, 2, 213, 1938, 3, 2, 2, 2, 215, 1963, 3, 2, 2, 2, 217, 1980, 3, 2, 2, 2, 219, 1995, 3, 2, 2, 2, 221, 2006, 3, 2, 2, 2, 223, 2019, 3, 2, 2, 2, 225, 2038, 3, 2, 2, 2, 227, 2049, 3, 2, 2, 2, 229, 2063, 3, 2, 2, 2, 231, 2078, 3, 2, 2, 2, 233, 2093, 3, 2, 2, 2, 235, 2102, 3, 2, 2, 2, 237, 2115, 3, 2, 2, 2, 239, 2130, 3, 2, 2, 2, 241, 2147, 3, 2, 2, 2, 243, 2160, 3, 2, 2, 2, 245, 2181, 3, 2, 2, 2, 247, 2194, 3, 2, 2, 2, 249, 2207, 3, 2, 2, 2, 251, 2228, 3, 2, 2, 2, 253, 2235, 3, 2, 2, 2, 255, 2248, 3, 2, 2, 2, 257, 2265, 3, 2, 2, 2, 259, 2283, 3, 2, 2, 2, 261, 2302, 3, 2, 2, 2, 263, 2311, 3, 2, 2, 2, 265, 2320, 3, 2, 2, 2, 267, 2331, 3, 2, 2, 2, 269, 2350, 3, 2, 2, 2, 271, 2365, 3, 2, 2, 2, 273, 2374, 3, 2, 2, 2, 275, 2385, 3, 2, 2, 2, 277, 2398, 3, 2, 2, 2, 279, 2409, 3, 2, 2, 2, 281, 2424, 3, 2, 2, 2, 283, 2435, 3, 2, 2, 2, 285, 2448, 3, 2, 2, 2, 287, 2459, 3, 2, 2, 2, 289, 2480, 3, 2, 2, 2, 291, 2496, 3, 2, 2, 2, 293, 2498, 3, 2, 2, 2, 295, 2515, 3, 2, 2, 2, 297, 2569, 3, 2, 2, 2, 299, 2571, 3, 2, 2, 2, 301, 2582, 3, 2, 2, 2, 303, 2595, 3, 2, 2, 2, 305, 2631, 3, 2, 2, 2, 307, 2662, 3, 2, 2, 2, 309, 2693, 3, 2, 2, 2, 311, 2715, 3, 2, 2, 2, 313, 2750, 3, 2, 2, 2, 315, 2785, 3, 2, 2, 2, 317, 2807, 3, 2, 2, 2, 319, 2829, 3, 2, 2, 2, 321, 2836, 3, 2, 2, 2, 323, 2853, 3, 2, 2, 2, 325, 2876, 3, 2, 2, 2, 327, 2920, 3, 2, 2, 2, 329, 2974, 3, 2, 2, 2, 331, 2992, 3, 2, 2, 2, 333, 3007, 3, 2, 2, 2, 335, 3036, 3, 2, 2, 2, 337, 3059, 3, 2, 2, 2, 339, 3069, 3, 2, 2, 2, 341, 3079, 3, 2, 2, 2, 343, 3088, 3, 2, 2, 2, 345, 3096, 3, 2, 2, 2, 347, 3106, 3, 2, 2, 2, 349, 3114, 3, 2, 2, 2, 351, 3123, 3, 2, 2, 2, 353, 3130, 3, 2, 2, 2, 355, 3145, 3, 2, 2, 2, 357, 3163, 3, 2, 2, 2, 359, 3180, 3, 2, 2, 2, 361, 3204, 3, 2, 2, 2, 363, 3229, 3, 2, 2, 2, 365, 3251, 3, 2, 2, 2, 367, 3271, 3, 2, 2, 2, 369, 3290, 3, 2, 2, 2, 371, 3304, 3, 2, 2, 2, 373, 3313, 3, 2, 2, 2, 375, 3322, 3, 2, 2, 2, 377, 3330, 3, 2, 2, 2, 379, 3338, 3, 2, 2, 2, 381, 3349, 3, 2, 2, 2, 383, 3361, 3, 2, 2, 2, 385, 3368, 3, 2, 2, 2, 387, 3373, 3, 2, 2, 2, 389, 3381, 3, 2, 2, 2, 391, 3389, 3, 2, 2, 2, 393, 3394, 3, 2, 2, 2, 395, 3402, 3, 2, 2, 2, 397, 3409, 3, 2, 2, 2, 399, 3415, 3, 2, 2, 2, 401, 3422, 3, 2, 2, 2, 403, 3427, 3, 2, 2, 2, 405, 3431, 3, 2, 2, 2, 407, 3436, 3, 2, 2, 2, 409, 3440, 3, 2, 2, 2, 411, 3449, 3, 2, 2, 2, 413, 3454, 3, 2, 2, 2, 415, 3463, 3, 2, 2, 2, 417, 3468, 3, 2, 2, 2, 419, 3476, 3, 2, 2, 2, 421, 3482, 3, 2, 2, 2, 423, 3490, 3, 2, 2, 2, 425, 3497, 3, 2, 2, 2, 427, 3499, 3, 2, 2, 2, 429, 3501, 3, 2, 2, 2, 431, 3503, 3, 2, 2, 2, 433, 3505, 3, 2, 2, 2, 435, 3507, 3, 2, 2, 2, 437, 3509, 3, 2, 2, 2, 439, 3511, 3, 2, 2, 2, 441, 3513, 3, 2, 2, 2, 443, 3515, 3, 2, 2, 2, 445, 3517, 3, 2, 2, 2, 447, 3519, 3, 2, 2, 2, 449, 3521, 3, 2, 2, 2, 451, 3523, 3, 2, 2, 2, 453, 3525, 3, 2, 2, 2, 455, 3527, 3, 2, 2, 2, 457, 3529, 3, 2, 2, 2, 459, 3531, 3, 2, 2, 2, 461, 3533, 3, 2, 2, 2, 463, 3535, 3, 2, 2, 2, 465, 3537, 3, 2, 2, 2, 467, 3539, 3, 2, 2, 2, 469, 3541, 3, 2, 2, 2, 471, 3543, 3, 2, 2, 2, 473, 3545, 3, 2, 2, 2, 475, 3547, 3, 2, 2, 2, 477, 3549, 3, 2, 2, 2, 479, 3552, 3, 2, 2, 2, 481, 3566, 3, 2, 2, 2, 483, 3585, 3, 2, 2, 2, 485, 3587, 3, 2, 2, 2, 487, 3600, 3, 2, 2, 2, 489, 3602, 3, 2, 2, 2, 491, 3605, 3, 2, 2, 2, 493, 3610, 3, 2, 2, 2, 495, 3644, 3, 2, 2, 2, 497, 3689, 3, 2, 2, 2, 499, 3691, 3, 2, 2, 2, 501, 3693, 3, 2, 2, 2, 503, 3706, 3, 2, 2, 2, 505, 3708, 3, 2, 2, 2, 507, 3710, 3, 2, 2, 2, 509, 3719, 3, 2, 2, 2, 511, 3721, 3, 2, 2, 2, 513, 3723, 3, 2, 2, 2, 515, 3725, 3, 2, 2, 2, 517, 3728, 3, 2, 2, 2, 519, 3731, 3, 2, 2, 2, 521, 3733, 3, 2, 2, 2, 523, 3735, 3, 2, 2, 2, 525, 3737, 3, 2, 2, 2, 527, 3739, 3, 2, 2, 2, 529, 3752, 3, 2, 2, 2, 531, 3767, 3, 2, 2, 2, 533, 534, 7, 42, 2, 2, 534, 4, 3, 2, 2, 2, 535, 536, 7, 43, 2, 2, 536, 6, 3, 2, 2, 2, 537, 538, 7, 125, 2, 2, 538, 8, 3, 2, 2, 2, 539, 540, 7, 127, 2, 2, 540, 10, 3, 2, 2, 2, 541, 542, 7, 93, 2, 2, 542, 12, 3, 2, 2, 2, 543, 544, 7, 95, 2, 2, 544, 14, 3, 2, 2, 2, 545, 546, 7, 46, 2, 2, 546, 16, 3, 2, 2, 2, 547, 548, 7, 61, 2, 2, 548, 18, 3, 2, 2, 2, 549, 550, 7, 60, 2, 2, 550, 20, 3, 2, 2, 2, 551, 553, 9, 2, 2, 2, 552, 551, 3, 2, 2, 2, 553, 554, 3, 2, 2, 2, 554, 552, 3, 2, 2, 2, 554, 555, 3, 2, 2, 2, 555, 556, 3, 2, 2, 2, 556, 557, 8, 11, 2, 2, 557, 22, 3, 2, 2, 2, 558, 559, 7, 49, 2, 2, 559, 560, 7, 44, 2, 2, 560, 561, 7, 35, 2, 2, 561, 563, 3, 2, 2, 2, 562, 564, 11, 2, 2, 2, 563, 562, 3, 2, 2, 2, 564, 565, 3, 2, 2, 2, 565, 566, 3, 2, 2, 2, 565, 563, 3, 2, 2, 2, 566, 567, 3, 2, 2, 2, 567, 568, 7, 44, 2, 2, 568, 569, 7, 49, 2, 2, 569, 570, 3, 2, 2, 2, 570, 571, 8, 12, 2, 2, 571, 24, 3, 2, 2, 2, 572, 573, 7, 49, 2, 2, 573, 574, 7, 44, 2, 2, 574, 578, 3, 2, 2, 2, 575, 577, 11, 2, 2, 2, 576, 575, 3, 2, 2, 2, 577, 580, 3, 2, 2, 2, 578, 579, 3, 2, 2, 2, 578, 576, 3, 2, 2, 2, 579, 581, 3, 2, 2, 2, 580, 578, 3, 2, 2, 2, 581, 582, 7, 44, 2, 2, 582, 583, 7, 49, 2, 2, 583, 584, 3, 2, 2, 2, 584, 585, 8, 13, 2, 2, 585, 26, 3, 2, 2, 2, 586, 587, 7, 47, 2, 2, 587, 588, 7, 47, 2, 2, 588, 593, 7, 34, 2, 2, 589, 593, 7, 37, 2, 2, 590, 591, 7, 49, 2, 2, 591, 593, 7, 49, 2, 2, 592, 586, 3, 2, 2, 2, 592, 589, 3, 2, 2, 2, 592, 590, 3, 2, 2, 2, 593, 597, 3, 2, 2, 2, 594, 596, 10, 3, 2, 2, 595, 594, 3, 2, 2, 2, 596, 599, 3, 2, 2, 2, 597, 595, 3, 2, 2, 2, 597, 598, 3, 2, 2, 2, 598, 605, 3, 2, 2, 2, 599, 597, 3, 2, 2, 2, 600, 602, 7, 15, 2, 2, 601, 600, 3, 2, 2, 2, 601, 602, 3, 2, 2, 2, 602, 603, 3, 2, 2, 2, 603, 606, 7, 12, 2, 2, 604, 606, 7, 2, 2, 3, 605, 601, 3, 2, 2, 2, 605, 604, 3, 2, 2, 2, 606, 618, 3, 2, 2, 2, 607, 608, 7, 47, 2, 2, 608, 609, 7, 47, 2, 2, 609, 615, 3, 2, 2, 2, 610, 612, 7, 15, 2, 2, 611, 610, 3, 2, 2, 2, 611, 612, 3, 2, 2, 2, 612, 613, 3, 2, 2, 2, 613, 616, 7, 12, 2, 2, 614, 616, 7, 2, 2, 3, 615, 611, 3, 2, 2, 2, 615, 614, 3, 2, 2, 2, 616, 618, 3, 2, 2, 2, 617, 592, 3, 2, 2, 2, 617, 607, 3, 2, 2, 2, 618, 619, 3, 2, 2, 2, 619, 620, 8, 14, 2, 2, 620, 28, 3, 2, 2, 2, 621, 622, 7, 48, 2, 2, 622, 30, 3, 2, 2, 2, 623, 624, 7, 44, 2, 2, 624, 32, 3, 2, 2, 2, 625, 626, 7, 49, 2, 2, 626, 34, 3, 2, 2, 2, 627, 628, 7, 39, 2, 2, 628, 36, 3, 2, 2, 2, 629, 630, 7, 45, 2, 2, 630, 38, 3, 2, 2, 2, 631, 632, 7, 47, 2, 2, 632, 633, 7, 47, 2, 2, 633, 40, 3, 2, 2, 2, 634, 635, 7, 47, 2, 2, 635, 42, 3, 2, 2, 2, 636, 637, 7, 36, 2, 2, 637, 44, 3, 2, 2, 2, 638, 639, 7, 41, 2, 2, 639, 46, 3, 2, 2, 2, 640, 641, 5, 425, 213, 2, 641, 642, 5, 431, 216, 2, 642, 643, 5, 431, 216, 2, 643, 648, 3, 2, 2, 2, 644, 645, 7, 67, 2, 2, 645, 646, 7, 70, 2, 2, 646, 648, 7, 70, 2, 2, 647, 640, 3, 2, 2, 2, 647, 644, 3, 2, 2, 2, 648, 48, 3, 2, 2, 2, 649, 650, 5, 425, 213, 2, 650, 651, 5, 437, 219, 2, 651, 652, 5, 437, 219, 2, 652, 653, 5, 459, 230, 2, 653, 654, 5, 433, 217, 2, 654, 655, 5, 437, 219, 2, 655, 656, 5, 425, 213, 2, 656, 657, 5, 463, 232, 2, 657, 658, 5, 433, 217, 2, 658, 669, 3, 2, 2, 2, 659, 660, 7, 67, 2, 2, 660, 661, 7, 73, 2, 2, 661, 662, 7, 73, 2, 2, 662, 663, 7, 84, 2, 2, 663, 664, 7, 71, 2, 2, 664, 665, 7, 73, 2, 2, 665, 666, 7, 67, 2, 2, 666, 667, 7, 86, 2, 2, 667, 669, 7, 71, 2, 2, 668, 649, 3, 2, 2, 2, 668, 659, 3, 2, 2, 2, 669, 50, 3, 2, 2, 2, 670, 671, 5, 425, 213, 2, 671, 672, 5, 447, 224, 2, 672, 673, 5, 447, 224, 2, 673, 678, 3, 2, 2, 2, 674, 675, 7, 67, 2, 2, 675, 676, 7, 78, 2, 2, 676, 678, 7, 78, 2, 2, 677, 670, 3, 2, 2, 2, 677, 674, 3, 2, 2, 2, 678, 52, 3, 2, 2, 2, 679, 680, 5, 425, 213, 2, 680, 681, 5, 447, 224, 2, 681, 682, 5, 447, 224, 2, 682, 683, 5, 453, 227, 2, 683, 684, 5, 469, 235, 2, 684, 691, 3, 2, 2, 2, 685, 686, 7, 67, 2, 2, 686, 687, 7, 78, 2, 2, 687, 688, 7, 78, 2, 2, 688, 689, 7, 81, 2, 2, 689, 691, 7, 89, 2, 2, 690, 679, 3, 2, 2, 2, 690, 685, 3, 2, 2, 2, 691, 54, 3, 2, 2, 2, 692, 693, 5, 425, 213, 2, 693, 694, 5, 447, 224, 2, 694, 695, 5, 463, 232, 2, 695, 696, 5, 433, 217, 2, 696, 697, 5, 459, 230, 2, 697, 704, 3, 2, 2, 2, 698, 699, 7, 67, 2, 2, 699, 700, 7, 78, 2, 2, 700, 701, 7, 86, 2, 2, 701, 702, 7, 71, 2, 2, 702, 704, 7, 84, 2, 2, 703, 692, 3, 2, 2, 2, 703, 698, 3, 2, 2, 2, 704, 56, 3, 2, 2, 2, 705, 706, 5, 425, 213, 2, 706, 707, 5, 451, 226, 2, 707, 708, 5, 431, 216, 2, 708, 713, 3, 2, 2, 2, 709, 710, 7, 67, 2, 2, 710, 711, 7, 80, 2, 2, 711, 713, 7, 70, 2, 2, 712, 705, 3, 2, 2, 2, 712, 709, 3, 2, 2, 2, 713, 58, 3, 2, 2, 2, 714, 715, 5, 425, 213, 2, 715, 716, 5, 451, 226, 2, 716, 717, 5, 473, 237, 2, 717, 722, 3, 2, 2, 2, 718, 719, 7, 67, 2, 2, 719, 720, 7, 80, 2, 2, 720, 722, 7, 91, 2, 2, 721, 714, 3, 2, 2, 2, 721, 718, 3, 2, 2, 2, 722, 60, 3, 2, 2, 2, 723, 724, 5, 425, 213, 2, 724, 725, 5, 455, 228, 2, 725, 726, 5, 455, 228, 2, 726, 727, 5, 447, 224, 2, 727, 728, 5, 473, 237, 2, 728, 735, 3, 2, 2, 2, 729, 730, 7, 67, 2, 2, 730, 731, 7, 82, 2, 2, 731, 732, 7, 82, 2, 2, 732, 733, 7, 78, 2, 2, 733, 735, 7, 91, 2, 2, 734, 723, 3, 2, 2, 2, 734, 729, 3, 2, 2, 2, 735, 62, 3, 2, 2, 2, 736, 737, 5, 425, 213, 2, 737, 738, 5, 461, 231, 2, 738, 742, 3, 2, 2, 2, 739, 740, 7, 67, 2, 2, 740, 742, 7, 85, 2, 2, 741, 736, 3, 2, 2, 2, 741, 739, 3, 2, 2, 2, 742, 64, 3, 2, 2, 2, 743, 744, 5, 425, 213, 2, 744, 745, 5, 461, 231, 2, 745, 746, 5, 429, 215, 2, 746, 751, 3, 2, 2, 2, 747, 748, 7, 67, 2, 2, 748, 749, 7, 85, 2, 2, 749, 751, 7, 69, 2, 2, 750, 743, 3, 2, 2, 2, 750, 747, 3, 2, 2, 2, 751, 66, 3, 2, 2, 2, 752, 753, 5, 425, 213, 2, 753, 754, 5, 465, 233, 2, 754, 755, 5, 463, 232, 2, 755, 756, 5, 439, 220, 2, 756, 757, 5, 453, 227, 2, 757, 758, 5, 459, 230, 2, 758, 759, 5, 441, 221, 2, 759, 760, 5, 475, 238, 2, 760, 761, 5, 433, 217, 2, 761, 772, 3, 2, 2, 2, 762, 763, 7, 67, 2, 2, 763, 764, 7, 87, 2, 2, 764, 765, 7, 86, 2, 2, 765, 766, 7, 74, 2, 2, 766, 767, 7, 81, 2, 2, 767, 768, 7, 84, 2, 2, 768, 769, 7, 75, 2, 2, 769, 770, 7, 92, 2, 2, 770, 772, 7, 71, 2, 2, 771, 752, 3, 2, 2, 2, 771, 762, 3, 2, 2, 2, 772, 68, 3, 2, 2, 2, 773, 774, 5, 427, 214, 2, 774, 775, 5, 425, 213, 2, 775, 776, 5, 463, 232, 2, 776, 777, 5, 429, 215, 2, 777, 778, 5, 439, 220, 2, 778, 785, 3, 2, 2, 2, 779, 780, 7, 68, 2, 2, 780, 781, 7, 67, 2, 2, 781, 782, 7, 86, 2, 2, 782, 783, 7, 69, 2, 2, 783, 785, 7, 74, 2, 2, 784, 773, 3, 2, 2, 2, 784, 779, 3, 2, 2, 2, 785, 70, 3, 2, 2, 2, 786, 787, 5, 427, 214, 2, 787, 788, 5, 433, 217, 2, 788, 789, 5, 437, 219, 2, 789, 790, 5, 441, 221, 2, 790, 791, 5, 451, 226, 2, 791, 798, 3, 2, 2, 2, 792, 793, 7, 68, 2, 2, 793, 794, 7, 71, 2, 2, 794, 795, 7, 73, 2, 2, 795, 796, 7, 75, 2, 2, 796, 798, 7, 80, 2, 2, 797, 786, 3, 2, 2, 2, 797, 792, 3, 2, 2, 2, 798, 72, 3, 2, 2, 2, 799, 800, 5, 427, 214, 2, 800, 801, 5, 473, 237, 2, 801, 805, 3, 2, 2, 2, 802, 803, 7, 68, 2, 2, 803, 805, 7, 91, 2, 2, 804, 799, 3, 2, 2, 2, 804, 802, 3, 2, 2, 2, 805, 74, 3, 2, 2, 2, 806, 807, 5, 429, 215, 2, 807, 808, 5, 425, 213, 2, 808, 809, 5, 447, 224, 2, 809, 810, 5, 447, 224, 2, 810, 811, 5, 433, 217, 2, 811, 812, 5, 431, 216, 2, 812, 820, 3, 2, 2, 2, 813, 814, 7, 69, 2, 2, 814, 815, 7, 67, 2, 2, 815, 816, 7, 78, 2, 2, 816, 817, 7, 78, 2, 2, 817, 818, 7, 71, 2, 2, 818, 820, 7, 70, 2, 2, 819, 806, 3, 2, 2, 2, 819, 813, 3, 2, 2, 2, 820, 76, 3, 2, 2, 2, 821, 822, 5, 429, 215, 2, 822, 823, 5, 447, 224, 2, 823, 824, 5, 465, 233, 2, 824, 825, 5, 461, 231, 2, 825, 826, 5, 463, 232, 2, 826, 827, 5, 433, 217, 2, 827, 828, 5, 459, 230, 2, 828, 829, 5, 441, 221, 2, 829, 830, 5, 451, 226, 2, 830, 831, 5, 437, 219, 2, 831, 843, 3, 2, 2, 2, 832, 833, 7, 69, 2, 2, 833, 834, 7, 78, 2, 2, 834, 835, 7, 87, 2, 2, 835, 836, 7, 85, 2, 2, 836, 837, 7, 86, 2, 2, 837, 838, 7, 71, 2, 2, 838, 839, 7, 84, 2, 2, 839, 840, 7, 75, 2, 2, 840, 841, 7, 80, 2, 2, 841, 843, 7, 73, 2, 2, 842, 821, 3, 2, 2, 2, 842, 832, 3, 2, 2, 2, 843, 78, 3, 2, 2, 2, 844, 845, 5, 429, 215, 2, 845, 846, 5, 453, 227, 2, 846, 847, 5, 447, 224, 2, 847, 848, 5, 465, 233, 2, 848, 849, 5, 449, 225, 2, 849, 850, 5, 451, 226, 2, 850, 851, 5, 435, 218, 2, 851, 852, 5, 425, 213, 2, 852, 853, 5, 449, 225, 2, 853, 854, 5, 441, 221, 2, 854, 855, 5, 447, 224, 2, 855, 856, 5, 473, 237, 2, 856, 870, 3, 2, 2, 2, 857, 858, 7, 69, 2, 2, 858, 859, 7, 81, 2, 2, 859, 860, 7, 78, 2, 2, 860, 861, 7, 87, 2, 2, 861, 862, 7, 79, 2, 2, 862, 863, 7, 80, 2, 2, 863, 864, 7, 72, 2, 2, 864, 865, 7, 67, 2, 2, 865, 866, 7, 79, 2, 2, 866, 867, 7, 75, 2, 2, 867, 868, 7, 78, 2, 2, 868, 870, 7, 91, 2, 2, 869, 844, 3, 2, 2, 2, 869, 857, 3, 2, 2, 2, 870, 80, 3, 2, 2, 2, 871, 872, 5, 429, 215, 2, 872, 873, 5, 453, 227, 2, 873, 874, 5, 449, 225, 2, 874, 875, 5, 455, 228, 2, 875, 876, 5, 425, 213, 2, 876, 877, 5, 429, 215, 2, 877, 878, 5, 463, 232, 2, 878, 887, 3, 2, 2, 2, 879, 880, 7, 69, 2, 2, 880, 881, 7, 81, 2, 2, 881, 882, 7, 79, 2, 2, 882, 883, 7, 82, 2, 2, 883, 884, 7, 67, 2, 2, 884, 885, 7, 69, 2, 2, 885, 887, 7, 86, 2, 2, 886, 871, 3, 2, 2, 2, 886, 879, 3, 2, 2, 2, 887, 82, 3, 2, 2, 2, 888, 889, 5, 429, 215, 2, 889, 890, 5, 453, 227, 2, 890, 891, 5, 451, 226, 2, 891, 892, 5, 461, 231, 2, 892, 893, 5, 441, 221, 2, 893, 894, 5, 461, 231, 2, 894, 895, 5, 463, 232, 2, 895, 896, 5, 433, 217, 2, 896, 897, 5, 451, 226, 2, 897, 898, 5, 429, 215, 2, 898, 899, 5, 473, 237, 2, 899, 912, 3, 2, 2, 2, 900, 901, 7, 69, 2, 2, 901, 902, 7, 81, 2, 2, 902, 903, 7, 80, 2, 2, 903, 904, 7, 85, 2, 2, 904, 905, 7, 75, 2, 2, 905, 906, 7, 85, 2, 2, 906, 907, 7, 86, 2, 2, 907, 908, 7, 71, 2, 2, 908, 909, 7, 80, 2, 2, 909, 910, 7, 69, 2, 2, 910, 912, 7, 91, 2, 2, 911, 888, 3, 2, 2, 2, 911, 900, 3, 2, 2, 2, 912, 84, 3, 2, 2, 2, 913, 914, 5, 429, 215, 2, 914, 915, 5, 453, 227, 2, 915, 916, 5, 451, 226, 2, 916, 917, 5, 463, 232, 2, 917, 918, 5, 425, 213, 2, 918, 919, 5, 441, 221, 2, 919, 920, 5, 451, 226, 2, 920, 921, 5, 461, 231, 2, 921, 931, 3, 2, 2, 2, 922, 923, 7, 69, 2, 2, 923, 924, 7, 81, 2, 2, 924, 925, 7, 80, 2, 2, 925, 926, 7, 86, 2, 2, 926, 927, 7, 67, 2, 2, 927, 928, 7, 75, 2, 2, 928, 929, 7, 80, 2, 2, 929, 931, 7, 85, 2, 2, 930, 913, 3, 2, 2, 2, 930, 922, 3, 2, 2, 2, 931, 86, 3, 2, 2, 2, 932, 933, 5, 429, 215, 2, 933, 934, 5, 459, 230, 2, 934, 935, 5, 433, 217, 2, 935, 936, 5, 425, 213, 2, 936, 937, 5, 463, 232, 2, 937, 938, 5, 433, 217, 2, 938, 946, 3, 2, 2, 2, 939, 940, 7, 69, 2, 2, 940, 941, 7, 84, 2, 2, 941, 942, 7, 71, 2, 2, 942, 943, 7, 67, 2, 2, 943, 944, 7, 86, 2, 2, 944, 946, 7, 71, 2, 2, 945, 932, 3, 2, 2, 2, 945, 939, 3, 2, 2, 2, 946, 88, 3, 2, 2, 2, 947, 948, 5, 429, 215, 2, 948, 949, 5, 465, 233, 2, 949, 950, 5, 461, 231, 2, 950, 951, 5, 463, 232, 2, 951, 952, 5, 453, 227, 2, 952, 953, 5, 449, 225, 2, 953, 961, 3, 2, 2, 2, 954, 955, 7, 69, 2, 2, 955, 956, 7, 87, 2, 2, 956, 957, 7, 85, 2, 2, 957, 958, 7, 86, 2, 2, 958, 959, 7, 81, 2, 2, 959, 961, 7, 79, 2, 2, 960, 947, 3, 2, 2, 2, 960, 954, 3, 2, 2, 2, 961, 90, 3, 2, 2, 2, 962, 963, 5, 461, 231, 2, 963, 964, 5, 433, 217, 2, 964, 965, 5, 425, 213, 2, 965, 966, 5, 459, 230, 2, 966, 967, 5, 429, 215, 2, 967, 968, 5, 439, 220, 2, 968, 976, 3, 2, 2, 2, 969, 970, 7, 85, 2, 2, 970, 971, 7, 71, 2, 2, 971, 972, 7, 67, 2, 2, 972, 973, 7, 84, 2, 2, 973, 974, 7, 69, 2, 2, 974, 976, 7, 74, 2, 2, 975, 962, 3, 2, 2, 2, 975, 969, 3, 2, 2, 2, 976, 92, 3, 2, 2, 2, 977, 978, 5, 431, 216, 2, 978, 979, 5, 433, 217, 2, 979, 980, 5, 447, 224, 2, 980, 981, 5, 433, 217, 2, 981, 982, 5, 463, 232, 2, 982, 983, 5, 433, 217, 2, 983, 991, 3, 2, 2, 2, 984, 985, 7, 70, 2, 2, 985, 986, 7, 71, 2, 2, 986, 987, 7, 78, 2, 2, 987, 988, 7, 71, 2, 2, 988, 989, 7, 86, 2, 2, 989, 991, 7, 71, 2, 2, 990, 977, 3, 2, 2, 2, 990, 984, 3, 2, 2, 2, 991, 94, 3, 2, 2, 2, 992, 993, 5, 431, 216, 2, 993, 994, 5, 433, 217, 2, 994, 995, 5, 461, 231, 2, 995, 996, 5, 429, 215, 2, 996, 1002, 3, 2, 2, 2, 997, 998, 7, 70, 2, 2, 998, 999, 7, 71, 2, 2, 999, 1000, 7, 85, 2, 2, 1000, 1002, 7, 69, 2, 2, 1001, 992, 3, 2, 2, 2, 1001, 997, 3, 2, 2, 2, 1002, 96, 3, 2, 2, 2, 1003, 1004, 5, 431, 216, 2, 1004, 1005, 5, 433, 217, 2, 1005, 1006, 5, 461, 231, 2, 1006, 1007, 5, 429, 215, 2, 1007, 1008, 5, 459, 230, 2, 1008, 1009, 5, 441, 221, 2, 1009, 1010, 5, 427, 214, 2, 1010, 1011, 5, 433, 217, 2, 1011, 1021, 3, 2, 2, 2, 1012, 1013, 7, 70, 2, 2, 1013, 1014, 7, 71, 2, 2, 1014, 1015, 7, 85, 2, 2, 1015, 1016, 7, 69, 2, 2, 1016, 1017, 7, 84, 2, 2, 1017, 1018, 7, 75, 2, 2, 1018, 1019, 7, 68, 2, 2, 1019, 1021, 7, 71, 2, 2, 1020, 1003, 3, 2, 2, 2, 1020, 1012, 3, 2, 2, 2, 1021, 98, 3, 2, 2, 2, 1022, 1023, 5, 431, 216, 2, 1023, 1024, 5, 441, 221, 2, 1024, 1025, 5, 461, 231, 2, 1025, 1026, 5, 463, 232, 2, 1026, 1027, 5, 441, 221, 2, 1027, 1028, 5, 451, 226, 2, 1028, 1029, 5, 429, 215, 2, 1029, 1030, 5, 463, 232, 2, 1030, 1040, 3, 2, 2, 2, 1031, 1032, 7, 70, 2, 2, 1032, 1033, 7, 75, 2, 2, 1033, 1034, 7, 85, 2, 2, 1034, 1035, 7, 86, 2, 2, 1035, 1036, 7, 75, 2, 2, 1036, 1037, 7, 80, 2, 2, 1037, 1038, 7, 69, 2, 2, 1038, 1040, 7, 86, 2, 2, 1039, 1022, 3, 2, 2, 2, 1039, 1031, 3, 2, 2, 2, 1040, 100, 3, 2, 2, 2, 1041, 1042, 5, 431, 216, 2, 1042, 1043, 5, 459, 230, 2, 1043, 1044, 5, 453, 227, 2, 1044, 1045, 5, 455, 228, 2, 1045, 1051, 3, 2, 2, 2, 1046, 1047, 7, 70, 2, 2, 1047, 1048, 7, 84, 2, 2, 1048, 1049, 7, 81, 2, 2, 1049, 1051, 7, 82, 2, 2, 1050, 1041, 3, 2, 2, 2, 1050, 1046, 3, 2, 2, 2, 1051, 102, 3, 2, 2, 2, 1052, 1053, 5, 431, 216, 2, 1053, 1054, 5, 465, 233, 2, 1054, 1055, 5, 459, 230, 2, 1055, 1056, 5, 425, 213, 2, 1056, 1057, 5, 427, 214, 2, 1057, 1058, 5, 447, 224, 2, 1058, 1059, 5, 433, 217, 2, 1059, 1060, 7, 97, 2, 2, 1060, 1061, 5, 469, 235, 2, 1061, 1062, 5, 459, 230, 2, 1062, 1063, 5, 441, 221, 2, 1063, 1064, 5, 463, 232, 2, 1064, 1065, 5, 433, 217, 2, 1065, 1066, 5, 461, 231, 2, 1066, 1082, 3, 2, 2, 2, 1067, 1068, 7, 70, 2, 2, 1068, 1069, 7, 87, 2, 2, 1069, 1070, 7, 84, 2, 2, 1070, 1071, 7, 67, 2, 2, 1071, 1072, 7, 68, 2, 2, 1072, 1073, 7, 78, 2, 2, 1073, 1074, 7, 71, 2, 2, 1074, 1075, 7, 97, 2, 2, 1075, 1076, 7, 89, 2, 2, 1076, 1077, 7, 84, 2, 2, 1077, 1078, 7, 75, 2, 2, 1078, 1079, 7, 86, 2, 2, 1079, 1080, 7, 71, 2, 2, 1080, 1082, 7, 85, 2, 2, 1081, 1052, 3, 2, 2, 2, 1081, 1067, 3, 2, 2, 2, 1082, 104, 3, 2, 2, 2, 1083, 1084, 5, 433, 217, 2, 1084, 1085, 5, 425, 213, 2, 1085, 1086, 5, 429, 215, 2, 1086, 1087, 5, 439, 220, 2, 1087, 1088, 7, 97, 2, 2, 1088, 1089, 5, 457, 229, 2, 1089, 1090, 5, 465, 233, 2, 1090, 1091, 5, 453, 227, 2, 1091, 1092, 5, 459, 230, 2, 1092, 1093, 5, 465, 233, 2, 1093, 1094, 5, 449, 225, 2, 1094, 1107, 3, 2, 2, 2, 1095, 1096, 7, 71, 2, 2, 1096, 1097, 7, 67, 2, 2, 1097, 1098, 7, 69, 2, 2, 1098, 1099, 7, 74, 2, 2, 1099, 1100, 7, 97, 2, 2, 1100, 1101, 7, 83, 2, 2, 1101, 1102, 7, 87, 2, 2, 1102, 1103, 7, 81, 2, 2, 1103, 1104, 7, 84, 2, 2, 1104, 1105, 7, 87, 2, 2, 1105, 1107, 7, 79, 2, 2, 1106, 1083, 3, 2, 2, 2, 1106, 1095, 3, 2, 2, 2, 1107, 106, 3, 2, 2, 2, 1108, 1109, 5, 433, 217, 2, 1109, 1110, 5, 451, 226, 2, 1110, 1111, 5, 463, 232, 2, 1111, 1112, 5, 459, 230, 2, 1112, 1113, 5, 441, 221, 2, 1113, 1114, 5, 433, 217, 2, 1114, 1115, 5, 461, 231, 2, 1115, 1124, 3, 2, 2, 2, 1116, 1117, 7, 71, 2, 2, 1117, 1118, 7, 80, 2, 2, 1118, 1119, 7, 86, 2, 2, 1119, 1120, 7, 84, 2, 2, 1120, 1121, 7, 75, 2, 2, 1121, 1122, 7, 71, 2, 2, 1122, 1124, 7, 85, 2, 2, 1123, 1108, 3, 2, 2, 2, 1123, 1116, 3, 2, 2, 2, 1124, 108, 3, 2, 2, 2, 1125, 1126, 5, 433, 217, 2, 1126, 1127, 5, 471, 236, 2, 1127, 1128, 5, 433, 217, 2, 1128, 1129, 5, 429, 215, 2, 1129, 1130, 5, 465, 233, 2, 1130, 1131, 5, 463, 232, 2, 1131, 1132, 5, 433, 217, 2, 1132, 1141, 3, 2, 2, 2, 1133, 1134, 7, 71, 2, 2, 1134, 1135, 7, 90, 2, 2, 1135, 1136, 7, 71, 2, 2, 1136, 1137, 7, 69, 2, 2, 1137, 1138, 7, 87, 2, 2, 1138, 1139, 7, 86, 2, 2, 1139, 1141, 7, 71, 2, 2, 1140, 1125, 3, 2, 2, 2, 1140, 1133, 3, 2, 2, 2, 1141, 110, 3, 2, 2, 2, 1142, 1143, 5, 433, 217, 2, 1143, 1144, 5, 471, 236, 2, 1144, 1145, 5, 441, 221, 2, 1145, 1146, 5, 461, 231, 2, 1146, 1147, 5, 463, 232, 2, 1147, 1148, 5, 461, 231, 2, 1148, 1156, 3, 2, 2, 2, 1149, 1150, 7, 71, 2, 2, 1150, 1151, 7, 90, 2, 2, 1151, 1152, 7, 75, 2, 2, 1152, 1153, 7, 85, 2, 2, 1153, 1154, 7, 86, 2, 2, 1154, 1156, 7, 85, 2, 2, 1155, 1142, 3, 2, 2, 2, 1155, 1149, 3, 2, 2, 2, 1156, 112, 3, 2, 2, 2, 1157, 1158, 5, 435, 218, 2, 1158, 1159, 5, 425, 213, 2, 1159, 1160, 5, 447, 224, 2, 1160, 1161, 5, 461, 231, 2, 1161, 1162, 5, 433, 217, 2, 1162, 1177, 3, 2, 2, 2, 1163, 1164, 7, 72, 2, 2, 1164, 1165, 7, 67, 2, 2, 1165, 1166, 7, 78, 2, 2, 1166, 1167, 7, 85, 2, 2, 1167, 1177, 7, 71, 2, 2, 1168, 1169, 5, 45, 23, 2, 1169, 1170, 5, 435, 218, 2, 1170, 1171, 5, 425, 213, 2, 1171, 1172, 5, 447, 224, 2, 1172, 1173, 5, 461, 231, 2, 1173, 1174, 5, 433, 217, 2, 1174, 1175, 5, 45, 23, 2, 1175, 1177, 3, 2, 2, 2, 1176, 1157, 3, 2, 2, 2, 1176, 1163, 3, 2, 2, 2, 1176, 1168, 3, 2, 2, 2, 1177, 114, 3, 2, 2, 2, 1178, 1179, 5, 435, 218, 2, 1179, 1180, 5, 441, 221, 2, 1180, 1181, 5, 447, 224, 2, 1181, 1182, 5, 463, 232, 2, 1182, 1183, 5, 433, 217, 2, 1183, 1184, 5, 459, 230, 2, 1184, 1185, 5, 441, 221, 2, 1185, 1186, 5, 451, 226, 2, 1186, 1187, 5, 437, 219, 2, 1187, 1198, 3, 2, 2, 2, 1188, 1189, 7, 72, 2, 2, 1189, 1190, 7, 75, 2, 2, 1190, 1191, 7, 78, 2, 2, 1191, 1192, 7, 86, 2, 2, 1192, 1193, 7, 71, 2, 2, 1193, 1194, 7, 84, 2, 2, 1194, 1195, 7, 75, 2, 2, 1195, 1196, 7, 80, 2, 2, 1196, 1198, 7, 73, 2, 2, 1197, 1178, 3, 2, 2, 2, 1197, 1188, 3, 2, 2, 2, 1198, 116, 3, 2, 2, 2, 1199, 1200, 5, 435, 218, 2, 1200, 1201, 5, 441, 221, 2, 1201, 1202, 5, 451, 226, 2, 1202, 1203, 5, 425, 213, 2, 1203, 1204, 5, 447, 224, 2, 1204, 1205, 5, 435, 218, 2, 1205, 1206, 5, 465, 233, 2, 1206, 1207, 5, 451, 226, 2, 1207, 1208, 5, 429, 215, 2, 1208, 1219, 3, 2, 2, 2, 1209, 1210, 7, 72, 2, 2, 1210, 1211, 7, 75, 2, 2, 1211, 1212, 7, 80, 2, 2, 1212, 1213, 7, 67, 2, 2, 1213, 1214, 7, 78, 2, 2, 1214, 1215, 7, 72, 2, 2, 1215, 1216, 7, 87, 2, 2, 1216, 1217, 7, 80, 2, 2, 1217, 1219, 7, 69, 2, 2, 1218, 1199, 3, 2, 2, 2, 1218, 1209, 3, 2, 2, 2, 1219, 118, 3, 2, 2, 2, 1220, 1221, 5, 435, 218, 2, 1221, 1222, 5, 459, 230, 2, 1222, 1223, 5, 453, 227, 2, 1223, 1224, 5, 449, 225, 2, 1224, 1230, 3, 2, 2, 2, 1225, 1226, 7, 72, 2, 2, 1226, 1227, 7, 84, 2, 2, 1227, 1228, 7, 81, 2, 2, 1228, 1230, 7, 79, 2, 2, 1229, 1220, 3, 2, 2, 2, 1229, 1225, 3, 2, 2, 2, 1230, 120, 3, 2, 2, 2, 1231, 1232, 5, 435, 218, 2, 1232, 1233, 5, 465, 233, 2, 1233, 1234, 5, 447, 224, 2, 1234, 1235, 5, 447, 224, 2, 1235, 1241, 3, 2, 2, 2, 1236, 1237, 7, 72, 2, 2, 1237, 1238, 7, 87, 2, 2, 1238, 1239, 7, 78, 2, 2, 1239, 1241, 7, 78, 2, 2, 1240, 1231, 3, 2, 2, 2, 1240, 1236, 3, 2, 2, 2, 1241, 122, 3, 2, 2, 2, 1242, 1243, 5, 435, 218, 2, 1243, 1244, 5, 465, 233, 2, 1244, 1245, 5, 451, 226, 2, 1245, 1246, 5, 429, 215, 2, 1246, 1247, 5, 463, 232, 2, 1247, 1248, 5, 441, 221, 2, 1248, 1249, 5, 453, 227, 2, 1249, 1250, 5, 451, 226, 2, 1250, 1260, 3, 2, 2, 2, 1251, 1252, 7, 72, 2, 2, 1252, 1253, 7, 87, 2, 2, 1253, 1254, 7, 80, 2, 2, 1254, 1255, 7, 69, 2, 2, 1255, 1256, 7, 86, 2, 2, 1256, 1257, 7, 75, 2, 2, 1257, 1258, 7, 81, 2, 2, 1258, 1260, 7, 80, 2, 2, 1259, 1242, 3, 2, 2, 2, 1259, 1251, 3, 2, 2, 2, 1260, 124, 3, 2, 2, 2, 1261, 1262, 5, 435, 218, 2, 1262, 1263, 5, 465, 233, 2, 1263, 1264, 5, 451, 226, 2, 1264, 1265, 5, 429, 215, 2, 1265, 1266, 5, 463, 232, 2, 1266, 1267, 5, 441, 221, 2, 1267, 1268, 5, 453, 227, 2, 1268, 1269, 5, 451, 226, 2, 1269, 1270, 5, 461, 231, 2, 1270, 1281, 3, 2, 2, 2, 1271, 1272, 7, 72, 2, 2, 1272, 1273, 7, 87, 2, 2, 1273, 1274, 7, 80, 2, 2, 1274, 1275, 7, 69, 2, 2, 1275, 1276, 7, 86, 2, 2, 1276, 1277, 7, 75, 2, 2, 1277, 1278, 7, 81, 2, 2, 1278, 1279, 7, 80, 2, 2, 1279, 1281, 7, 85, 2, 2, 1280, 1261, 3, 2, 2, 2, 1280, 1271, 3, 2, 2, 2, 1281, 126, 3, 2, 2, 2, 1282, 1283, 5, 437, 219, 2, 1283, 1284, 5, 459, 230, 2, 1284, 1285, 5, 425, 213, 2, 1285, 1286, 5, 451, 226, 2, 1286, 1287, 5, 463, 232, 2, 1287, 1294, 3, 2, 2, 2, 1288, 1289, 7, 73, 2, 2, 1289, 1290, 7, 84, 2, 2, 1290, 1291, 7, 67, 2, 2, 1291, 1292, 7, 80, 2, 2, 1292, 1294, 7, 86, 2, 2, 1293, 1282, 3, 2, 2, 2, 1293, 1288, 3, 2, 2, 2, 1294, 128, 3, 2, 2, 2, 1295, 1296, 5, 441, 221, 2, 1296, 1297, 5, 435, 218, 2, 1297, 1301, 3, 2, 2, 2, 1298, 1299, 7, 75, 2, 2, 1299, 1301, 7, 72, 2, 2, 1300, 1295, 3, 2, 2, 2, 1300, 1298, 3, 2, 2, 2, 1301, 130, 3, 2, 2, 2, 1302, 1303, 5, 441, 221, 2, 1303, 1304, 5, 451, 226, 2, 1304, 1308, 3, 2, 2, 2, 1305, 1306, 7, 75, 2, 2, 1306, 1308, 7, 80, 2, 2, 1307, 1302, 3, 2, 2, 2, 1307, 1305, 3, 2, 2, 2, 1308, 132, 3, 2, 2, 2, 1309, 1310, 5, 441, 221, 2, 1310, 1311, 5, 451, 226, 2, 1311, 1312, 5, 431, 216, 2, 1312, 1313, 5, 433, 217, 2, 1313, 1314, 5, 471, 236, 2, 1314, 1321, 3, 2, 2, 2, 1315, 1316, 7, 75, 2, 2, 1316, 1317, 7, 80, 2, 2, 1317, 1318, 7, 70, 2, 2, 1318, 1319, 7, 71, 2, 2, 1319, 1321, 7, 90, 2, 2, 1320, 1309, 3, 2, 2, 2, 1320, 1315, 3, 2, 2, 2, 1321, 134, 3, 2, 2, 2, 1322, 1323, 5, 441, 221, 2, 1323, 1324, 5, 451, 226, 2, 1324, 1325, 5, 435, 218, 2, 1325, 1326, 5, 441, 221, 2, 1326, 1327, 5, 451, 226, 2, 1327, 1328, 5, 441, 221, 2, 1328, 1329, 5, 463, 232, 2, 1329, 1330, 5, 473, 237, 2, 1330, 1340, 3, 2, 2, 2, 1331, 1332, 7, 75, 2, 2, 1332, 1333, 7, 80, 2, 2, 1333, 1334, 7, 72, 2, 2, 1334, 1335, 7, 75, 2, 2, 1335, 1336, 7, 80, 2, 2, 1336, 1337, 7, 75, 2, 2, 1337, 1338, 7, 86, 2, 2, 1338, 1340, 7, 91, 2, 2, 1339, 1322, 3, 2, 2, 2, 1339, 1331, 3, 2, 2, 2, 1340, 136, 3, 2, 2, 2, 1341, 1342, 5, 441, 221, 2, 1342, 1343, 5, 451, 226, 2, 1343, 1344, 5, 441, 221, 2, 1344, 1345, 5, 463, 232, 2, 1345, 1346, 5, 429, 215, 2, 1346, 1347, 5, 453, 227, 2, 1347, 1348, 5, 451, 226, 2, 1348, 1349, 5, 431, 216, 2, 1349, 1359, 3, 2, 2, 2, 1350, 1351, 7, 75, 2, 2, 1351, 1352, 7, 80, 2, 2, 1352, 1353, 7, 75, 2, 2, 1353, 1354, 7, 86, 2, 2, 1354, 1355, 7, 69, 2, 2, 1355, 1356, 7, 81, 2, 2, 1356, 1357, 7, 80, 2, 2, 1357, 1359, 7, 70, 2, 2, 1358, 1341, 3, 2, 2, 2, 1358, 1350, 3, 2, 2, 2, 1359, 138, 3, 2, 2, 2, 1360, 1361, 5, 441, 221, 2, 1361, 1362, 5, 451, 226, 2, 1362, 1363, 5, 455, 228, 2, 1363, 1364, 5, 465, 233, 2, 1364, 1365, 5, 463, 232, 2, 1365, 1372, 3, 2, 2, 2, 1366, 1367, 7, 75, 2, 2, 1367, 1368, 7, 80, 2, 2, 1368, 1369, 7, 82, 2, 2, 1369, 1370, 7, 87, 2, 2, 1370, 1372, 7, 86, 2, 2, 1371, 1360, 3, 2, 2, 2, 1371, 1366, 3, 2, 2, 2, 1372, 140, 3, 2, 2, 2, 1373, 1374, 5, 441, 221, 2, 1374, 1375, 5, 451, 226, 2, 1375, 1376, 5, 461, 231, 2, 1376, 1377, 5, 433, 217, 2, 1377, 1378, 5, 459, 230, 2, 1378, 1379, 5, 463, 232, 2, 1379, 1387, 3, 2, 2, 2, 1380, 1381, 7, 75, 2, 2, 1381, 1382, 7, 80, 2, 2, 1382, 1383, 7, 85, 2, 2, 1383, 1384, 7, 71, 2, 2, 1384, 1385, 7, 84, 2, 2, 1385, 1387, 7, 86, 2, 2, 1386, 1373, 3, 2, 2, 2, 1386, 1380, 3, 2, 2, 2, 1387, 142, 3, 2, 2, 2, 1388, 1389, 5, 441, 221, 2, 1389, 1390, 5, 451, 226, 2, 1390, 1391, 5, 463, 232, 2, 1391, 1392, 5, 453, 227, 2, 1392, 1398, 3, 2, 2, 2, 1393, 1394, 7, 75, 2, 2, 1394, 1395, 7, 80, 2, 2, 1395, 1396, 7, 86, 2, 2, 1396, 1398, 7, 81, 2, 2, 1397, 1388, 3, 2, 2, 2, 1397, 1393, 3, 2, 2, 2, 1398, 144, 3, 2, 2, 2, 1399, 1400, 5, 441, 221, 2, 1400, 1401, 5, 461, 231, 2, 1401, 1405, 3, 2, 2, 2, 1402, 1403, 7, 75, 2, 2, 1403, 1405, 7, 85, 2, 2, 1404, 1399, 3, 2, 2, 2, 1404, 1402, 3, 2, 2, 2, 1405, 146, 3, 2, 2, 2, 1406, 1407, 5, 443, 222, 2, 1407, 1408, 5, 461, 231, 2, 1408, 1409, 5, 453, 227, 2, 1409, 1410, 5, 451, 226, 2, 1410, 1416, 3, 2, 2, 2, 1411, 1412, 7, 76, 2, 2, 1412, 1413, 7, 85, 2, 2, 1413, 1414, 7, 81, 2, 2, 1414, 1416, 7, 80, 2, 2, 1415, 1406, 3, 2, 2, 2, 1415, 1411, 3, 2, 2, 2, 1416, 148, 3, 2, 2, 2, 1417, 1418, 5, 445, 223, 2, 1418, 1419, 5, 433, 217, 2, 1419, 1420, 5, 473, 237, 2, 1420, 1425, 3, 2, 2, 2, 1421, 1422, 7, 77, 2, 2, 1422, 1423, 7, 71, 2, 2, 1423, 1425, 7, 91, 2, 2, 1424, 1417, 3, 2, 2, 2, 1424, 1421, 3, 2, 2, 2, 1425, 150, 3, 2, 2, 2, 1426, 1427, 5, 445, 223, 2, 1427, 1428, 5, 433, 217, 2, 1428, 1429, 5, 473, 237, 2, 1429, 1430, 5, 461, 231, 2, 1430, 1436, 3, 2, 2, 2, 1431, 1432, 7, 77, 2, 2, 1432, 1433, 7, 71, 2, 2, 1433, 1434, 7, 91, 2, 2, 1434, 1436, 7, 85, 2, 2, 1435, 1426, 3, 2, 2, 2, 1435, 1431, 3, 2, 2, 2, 1436, 152, 3, 2, 2, 2, 1437, 1438, 5, 445, 223, 2, 1438, 1439, 5, 433, 217, 2, 1439, 1440, 5, 473, 237, 2, 1440, 1441, 5, 461, 231, 2, 1441, 1442, 5, 455, 228, 2, 1442, 1443, 5, 425, 213, 2, 1443, 1444, 5, 429, 215, 2, 1444, 1445, 5, 433, 217, 2, 1445, 1455, 3, 2, 2, 2, 1446, 1447, 7, 77, 2, 2, 1447, 1448, 7, 71, 2, 2, 1448, 1449, 7, 91, 2, 2, 1449, 1450, 7, 85, 2, 2, 1450, 1451, 7, 82, 2, 2, 1451, 1452, 7, 67, 2, 2, 1452, 1453, 7, 69, 2, 2, 1453, 1455, 7, 71, 2, 2, 1454, 1437, 3, 2, 2, 2, 1454, 1446, 3, 2, 2, 2, 1455, 154, 3, 2, 2, 2, 1456, 1457, 5, 445, 223, 2, 1457, 1458, 5, 433, 217, 2, 1458, 1459, 5, 473, 237, 2, 1459, 1460, 5, 461, 231, 2, 1460, 1461, 5, 455, 228, 2, 1461, 1462, 5, 425, 213, 2, 1462, 1463, 5, 429, 215, 2, 1463, 1464, 5, 433, 217, 2, 1464, 1465, 5, 461, 231, 2, 1465, 1476, 3, 2, 2, 2, 1466, 1467, 7, 77, 2, 2, 1467, 1468, 7, 71, 2, 2, 1468, 1469, 7, 91, 2, 2, 1469, 1470, 7, 85, 2, 2, 1470, 1471, 7, 82, 2, 2, 1471, 1472, 7, 67, 2, 2, 1472, 1473, 7, 69, 2, 2, 1473, 1474, 7, 71, 2, 2, 1474, 1476, 7, 85, 2, 2, 1475, 1456, 3, 2, 2, 2, 1475, 1466, 3, 2, 2, 2, 1476, 156, 3, 2, 2, 2, 1477, 1478, 5, 447, 224, 2, 1478, 1479, 5, 425, 213, 2, 1479, 1480, 5, 451, 226, 2, 1480, 1481, 5, 437, 219, 2, 1481, 1482, 5, 465, 233, 2, 1482, 1483, 5, 425, 213, 2, 1483, 1484, 5, 437, 219, 2, 1484, 1485, 5, 433, 217, 2, 1485, 1495, 3, 2, 2, 2, 1486, 1487, 7, 78, 2, 2, 1487, 1488, 7, 67, 2, 2, 1488, 1489, 7, 80, 2, 2, 1489, 1490, 7, 73, 2, 2, 1490, 1491, 7, 87, 2, 2, 1491, 1492, 7, 67, 2, 2, 1492, 1493, 7, 73, 2, 2, 1493, 1495, 7, 71, 2, 2, 1494, 1477, 3, 2, 2, 2, 1494, 1486, 3, 2, 2, 2, 1495, 158, 3, 2, 2, 2, 1496, 1497, 5, 447, 224, 2, 1497, 1498, 5, 433, 217, 2, 1498, 1499, 5, 467, 234, 2, 1499, 1500, 5, 433, 217, 2, 1500, 1501, 5, 447, 224, 2, 1501, 1508, 3, 2, 2, 2, 1502, 1503, 7, 78, 2, 2, 1503, 1504, 7, 71, 2, 2, 1504, 1505, 7, 88, 2, 2, 1505, 1506, 7, 71, 2, 2, 1506, 1508, 7, 78, 2, 2, 1507, 1496, 3, 2, 2, 2, 1507, 1502, 3, 2, 2, 2, 1508, 160, 3, 2, 2, 2, 1509, 1510, 5, 447, 224, 2, 1510, 1511, 5, 441, 221, 2, 1511, 1512, 5, 449, 225, 2, 1512, 1513, 5, 441, 221, 2, 1513, 1514, 5, 463, 232, 2, 1514, 1521, 3, 2, 2, 2, 1515, 1516, 7, 78, 2, 2, 1516, 1517, 7, 75, 2, 2, 1517, 1518, 7, 79, 2, 2, 1518, 1519, 7, 75, 2, 2, 1519, 1521, 7, 86, 2, 2, 1520, 1509, 3, 2, 2, 2, 1520, 1515, 3, 2, 2, 2, 1521, 162, 3, 2, 2, 2, 1522, 1523, 5, 447, 224, 2, 1523, 1524, 5, 453, 227, 2, 1524, 1525, 5, 429, 215, 2, 1525, 1526, 5, 425, 213, 2, 1526, 1527, 5, 447, 224, 2, 1527, 1528, 7, 97, 2, 2, 1528, 1529, 5, 453, 227, 2, 1529, 1530, 5, 451, 226, 2, 1530, 1531, 5, 433, 217, 2, 1531, 1542, 3, 2, 2, 2, 1532, 1533, 7, 78, 2, 2, 1533, 1534, 7, 81, 2, 2, 1534, 1535, 7, 69, 2, 2, 1535, 1536, 7, 67, 2, 2, 1536, 1537, 7, 78, 2, 2, 1537, 1538, 7, 97, 2, 2, 1538, 1539, 7, 81, 2, 2, 1539, 1540, 7, 80, 2, 2, 1540, 1542, 7, 71, 2, 2, 1541, 1522, 3, 2, 2, 2, 1541, 1532, 3, 2, 2, 2, 1542, 164, 3, 2, 2, 2, 1543, 1544, 5, 447, 224, 2, 1544, 1545, 5, 453, 227, 2, 1545, 1546, 5, 429, 215, 2, 1546, 1547, 5, 425, 213, 2, 1547, 1548, 5, 447, 224, 2, 1548, 1549, 7, 97, 2, 2, 1549, 1550, 5, 457, 229, 2, 1550, 1551, 5, 465, 233, 2, 1551, 1552, 5, 453, 227, 2, 1552, 1553, 5, 459, 230, 2, 1553, 1554, 5, 465, 233, 2, 1554, 1555, 5, 449, 225, 2, 1555, 1569, 3, 2, 2, 2, 1556, 1557, 7, 78, 2, 2, 1557, 1558, 7, 81, 2, 2, 1558, 1559, 7, 69, 2, 2, 1559, 1560, 7, 67, 2, 2, 1560, 1561, 7, 78, 2, 2, 1561, 1562, 7, 97, 2, 2, 1562, 1563, 7, 83, 2, 2, 1563, 1564, 7, 87, 2, 2, 1564, 1565, 7, 81, 2, 2, 1565, 1566, 7, 84, 2, 2, 1566, 1567, 7, 87, 2, 2, 1567, 1569, 7, 79, 2, 2, 1568, 1543, 3, 2, 2, 2, 1568, 1556, 3, 2, 2, 2, 1569, 166, 3, 2, 2, 2, 1570, 1571, 5, 447, 224, 2, 1571, 1572, 5, 453, 227, 2, 1572, 1573, 5, 437, 219, 2, 1573, 1574, 5, 437, 219, 2, 1574, 1575, 5, 433, 217, 2, 1575, 1576, 5, 431, 216, 2, 1576, 1584, 3, 2, 2, 2, 1577, 1578, 7, 78, 2, 2, 1578, 1579, 7, 81, 2, 2, 1579, 1580, 7, 73, 2, 2, 1580, 1581, 7, 73, 2, 2, 1581, 1582, 7, 71, 2, 2, 1582, 1584, 7, 70, 2, 2, 1583, 1570, 3, 2, 2, 2, 1583, 1577, 3, 2, 2, 2, 1584, 168, 3, 2, 2, 2, 1585, 1586, 5, 447, 224, 2, 1586, 1587, 5, 453, 227, 2, 1587, 1588, 5, 437, 219, 2, 1588, 1589, 5, 441, 221, 2, 1589, 1590, 5, 451, 226, 2, 1590, 1597, 3, 2, 2, 2, 1591, 1592, 7, 78, 2, 2, 1592, 1593, 7, 81, 2, 2, 1593, 1594, 7, 73, 2, 2, 1594, 1595, 7, 75, 2, 2, 1595, 1597, 7, 80, 2, 2, 1596, 1585, 3, 2, 2, 2, 1596, 1591, 3, 2, 2, 2, 1597, 170, 3, 2, 2, 2, 1598, 1599, 5, 449, 225, 2, 1599, 1600, 5, 425, 213, 2, 1600, 1601, 5, 463, 232, 2, 1601, 1602, 5, 433, 217, 2, 1602, 1603, 5, 459, 230, 2, 1603, 1604, 5, 441, 221, 2, 1604, 1605, 5, 425, 213, 2, 1605, 1606, 5, 447, 224, 2, 1606, 1607, 5, 441, 221, 2, 1607, 1608, 5, 475, 238, 2, 1608, 1609, 5, 433, 217, 2, 1609, 1610, 5, 431, 216, 2, 1610, 1624, 3, 2, 2, 2, 1611, 1612, 7, 79, 2, 2, 1612, 1613, 7, 67, 2, 2, 1613, 1614, 7, 86, 2, 2, 1614, 1615, 7, 71, 2, 2, 1615, 1616, 7, 84, 2, 2, 1616, 1617, 7, 75, 2, 2, 1617, 1618, 7, 67, 2, 2, 1618, 1619, 7, 78, 2, 2, 1619, 1620, 7, 75, 2, 2, 1620, 1621, 7, 92, 2, 2, 1621, 1622, 7, 71, 2, 2, 1622, 1624, 7, 70, 2, 2, 1623, 1598, 3, 2, 2, 2, 1623, 1611, 3, 2, 2, 2, 1624, 172, 3, 2, 2, 2, 1625, 1626, 5, 449, 225, 2, 1626, 1627, 5, 453, 227, 2, 1627, 1628, 5, 431, 216, 2, 1628, 1629, 5, 441, 221, 2, 1629, 1630, 5, 435, 218, 2, 1630, 1631, 5, 473, 237, 2, 1631, 1639, 3, 2, 2, 2, 1632, 1633, 7, 79, 2, 2, 1633, 1634, 7, 81, 2, 2, 1634, 1635, 7, 70, 2, 2, 1635, 1636, 7, 75, 2, 2, 1636, 1637, 7, 72, 2, 2, 1637, 1639, 7, 91, 2, 2, 1638, 1625, 3, 2, 2, 2, 1638, 1632, 3, 2, 2, 2, 1639, 174, 3, 2, 2, 2, 1640, 1641, 5, 451, 226, 2, 1641, 1642, 5, 425, 213, 2, 1642, 1643, 5, 451, 226, 2, 1643, 1648, 3, 2, 2, 2, 1644, 1645, 7, 80, 2, 2, 1645, 1646, 7, 67, 2, 2, 1646, 1648, 7, 80, 2, 2, 1647, 1640, 3, 2, 2, 2, 1647, 1644, 3, 2, 2, 2, 1648, 176, 3, 2, 2, 2, 1649, 1650, 5, 451, 226, 2, 1650, 1651, 5, 453, 227, 2, 1651, 1652, 5, 459, 230, 2, 1652, 1653, 5, 433, 217, 2, 1653, 1654, 5, 429, 215, 2, 1654, 1655, 5, 465, 233, 2, 1655, 1656, 5, 459, 230, 2, 1656, 1657, 5, 461, 231, 2, 1657, 1658, 5, 441, 221, 2, 1658, 1659, 5, 467, 234, 2, 1659, 1660, 5, 433, 217, 2, 1660, 1673, 3, 2, 2, 2, 1661, 1662, 7, 80, 2, 2, 1662, 1663, 7, 81, 2, 2, 1663, 1664, 7, 84, 2, 2, 1664, 1665, 7, 71, 2, 2, 1665, 1666, 7, 69, 2, 2, 1666, 1667, 7, 87, 2, 2, 1667, 1668, 7, 84, 2, 2, 1668, 1669, 7, 85, 2, 2, 1669, 1670, 7, 75, 2, 2, 1670, 1671, 7, 88, 2, 2, 1671, 1673, 7, 71, 2, 2, 1672, 1649, 3, 2, 2, 2, 1672, 1661, 3, 2, 2, 2, 1673, 178, 3, 2, 2, 2, 1674, 1675, 5, 451, 226, 2, 1675, 1676, 5, 453, 227, 2, 1676, 1677, 5, 461, 231, 2, 1677, 1678, 5, 465, 233, 2, 1678, 1679, 5, 455, 228, 2, 1679, 1680, 5, 433, 217, 2, 1680, 1681, 5, 459, 230, 2, 1681, 1682, 5, 465, 233, 2, 1682, 1683, 5, 461, 231, 2, 1683, 1684, 5, 433, 217, 2, 1684, 1685, 5, 459, 230, 2, 1685, 1698, 3, 2, 2, 2, 1686, 1687, 7, 80, 2, 2, 1687, 1688, 7, 81, 2, 2, 1688, 1689, 7, 85, 2, 2, 1689, 1690, 7, 87, 2, 2, 1690, 1691, 7, 82, 2, 2, 1691, 1692, 7, 71, 2, 2, 1692, 1693, 7, 84, 2, 2, 1693, 1694, 7, 87, 2, 2, 1694, 1695, 7, 85, 2, 2, 1695, 1696, 7, 71, 2, 2, 1696, 1698, 7, 84, 2, 2, 1697, 1674, 3, 2, 2, 2, 1697, 1686, 3, 2, 2, 2, 1698, 180, 3, 2, 2, 2, 1699, 1700, 5, 451, 226, 2, 1700, 1701, 5, 453, 227, 2, 1701, 1702, 5, 463, 232, 2, 1702, 1707, 3, 2, 2, 2, 1703, 1704, 7, 80, 2, 2, 1704, 1705, 7, 81, 2, 2, 1705, 1707, 7, 86, 2, 2, 1706, 1699, 3, 2, 2, 2, 1706, 1703, 3, 2, 2, 2, 1707, 182, 3, 2, 2, 2, 1708, 1709, 5, 451, 226, 2, 1709, 1710, 5, 465, 233, 2, 1710, 1711, 5, 447, 224, 2, 1711, 1712, 5, 447, 224, 2, 1712, 1718, 3, 2, 2, 2, 1713, 1714, 7, 80, 2, 2, 1714, 1715, 7, 87, 2, 2, 1715, 1716, 7, 78, 2, 2, 1716, 1718, 7, 78, 2, 2, 1717, 1708, 3, 2, 2, 2, 1717, 1713, 3, 2, 2, 2, 1718, 184, 3, 2, 2, 2, 1719, 1720, 5, 453, 227, 2, 1720, 1721, 5, 435, 218, 2, 1721, 1725, 3, 2, 2, 2, 1722, 1723, 7, 81, 2, 2, 1723, 1725, 7, 72, 2, 2, 1724, 1719, 3, 2, 2, 2, 1724, 1722, 3, 2, 2, 2, 1725, 186, 3, 2, 2, 2, 1726, 1727, 5, 453, 227, 2, 1727, 1728, 5, 451, 226, 2, 1728, 1732, 3, 2, 2, 2, 1729, 1730, 7, 81, 2, 2, 1730, 1732, 7, 80, 2, 2, 1731, 1726, 3, 2, 2, 2, 1731, 1729, 3, 2, 2, 2, 1732, 188, 3, 2, 2, 2, 1733, 1734, 5, 453, 227, 2, 1734, 1735, 5, 451, 226, 2, 1735, 1736, 5, 433, 217, 2, 1736, 1741, 3, 2, 2, 2, 1737, 1738, 7, 81, 2, 2, 1738, 1739, 7, 80, 2, 2, 1739, 1741, 7, 71, 2, 2, 1740, 1733, 3, 2, 2, 2, 1740, 1737, 3, 2, 2, 2, 1741, 190, 3, 2, 2, 2, 1742, 1743, 5, 453, 227, 2, 1743, 1744, 5, 455, 228, 2, 1744, 1745, 5, 463, 232, 2, 1745, 1746, 5, 441, 221, 2, 1746, 1747, 5, 453, 227, 2, 1747, 1748, 5, 451, 226, 2, 1748, 1749, 5, 461, 231, 2, 1749, 1758, 3, 2, 2, 2, 1750, 1751, 7, 81, 2, 2, 1751, 1752, 7, 82, 2, 2, 1752, 1753, 7, 86, 2, 2, 1753, 1754, 7, 75, 2, 2, 1754, 1755, 7, 81, 2, 2, 1755, 1756, 7, 80, 2, 2, 1756, 1758, 7, 85, 2, 2, 1757, 1742, 3, 2, 2, 2, 1757, 1750, 3, 2, 2, 2, 1758, 192, 3, 2, 2, 2, 1759, 1760, 5, 453, 227, 2, 1760, 1761, 5, 459, 230, 2, 1761, 1765, 3, 2, 2, 2, 1762, 1763, 7, 81, 2, 2, 1763, 1765, 7, 84, 2, 2, 1764, 1759, 3, 2, 2, 2, 1764, 1762, 3, 2, 2, 2, 1765, 194, 3, 2, 2, 2, 1766, 1767, 5, 453, 227, 2, 1767, 1768, 5, 459, 230, 2, 1768, 1769, 5, 431, 216, 2, 1769, 1770, 5, 433, 217, 2, 1770, 1771, 5, 459, 230, 2, 1771, 1778, 3, 2, 2, 2, 1772, 1773, 7, 81, 2, 2, 1773, 1774, 7, 84, 2, 2, 1774, 1775, 7, 70, 2, 2, 1775, 1776, 7, 71, 2, 2, 1776, 1778, 7, 84, 2, 2, 1777, 1766, 3, 2, 2, 2, 1777, 1772, 3, 2, 2, 2, 1778, 196, 3, 2, 2, 2, 1779, 1780, 5, 455, 228, 2, 1780, 1781, 5, 425, 213, 2, 1781, 1782, 5, 459, 230, 2, 1782, 1783, 5, 463, 232, 2, 1783, 1784, 5, 441, 221, 2, 1784, 1785, 5, 463, 232, 2, 1785, 1786, 5, 441, 221, 2, 1786, 1787, 5, 453, 227, 2, 1787, 1788, 5, 451, 226, 2, 1788, 1799, 3, 2, 2, 2, 1789, 1790, 7, 82, 2, 2, 1790, 1791, 7, 67, 2, 2, 1791, 1792, 7, 84, 2, 2, 1792, 1793, 7, 86, 2, 2, 1793, 1794, 7, 75, 2, 2, 1794, 1795, 7, 86, 2, 2, 1795, 1796, 7, 75, 2, 2, 1796, 1797, 7, 81, 2, 2, 1797, 1799, 7, 80, 2, 2, 1798, 1779, 3, 2, 2, 2, 1798, 1789, 3, 2, 2, 2, 1799, 198, 3, 2, 2, 2, 1800, 1801, 5, 455, 228, 2, 1801, 1802, 5, 425, 213, 2, 1802, 1803, 5, 461, 231, 2, 1803, 1804, 5, 461, 231, 2, 1804, 1805, 5, 469, 235, 2, 1805, 1806, 5, 453, 227, 2, 1806, 1807, 5, 459, 230, 2, 1807, 1808, 5, 431, 216, 2, 1808, 1818, 3, 2, 2, 2, 1809, 1810, 7, 82, 2, 2, 1810, 1811, 7, 67, 2, 2, 1811, 1812, 7, 85, 2, 2, 1812, 1813, 7, 85, 2, 2, 1813, 1814, 7, 89, 2, 2, 1814, 1815, 7, 81, 2, 2, 1815, 1816, 7, 84, 2, 2, 1816, 1818, 7, 70, 2, 2, 1817, 1800, 3, 2, 2, 2, 1817, 1809, 3, 2, 2, 2, 1818, 200, 3, 2, 2, 2, 1819, 1820, 5, 455, 228, 2, 1820, 1821, 5, 433, 217, 2, 1821, 1822, 5, 459, 230, 2, 1822, 1827, 3, 2, 2, 2, 1823, 1824, 7, 82, 2, 2, 1824, 1825, 7, 71, 2, 2, 1825, 1827, 7, 84, 2, 2, 1826, 1819, 3, 2, 2, 2, 1826, 1823, 3, 2, 2, 2, 1827, 202, 3, 2, 2, 2, 1828, 1829, 5, 455, 228, 2, 1829, 1830, 5, 433, 217, 2, 1830, 1831, 5, 459, 230, 2, 1831, 1832, 5, 449, 225, 2, 1832, 1833, 5, 441, 221, 2, 1833, 1834, 5, 461, 231, 2, 1834, 1835, 5, 461, 231, 2, 1835, 1836, 5, 441, 221, 2, 1836, 1837, 5, 453, 227, 2, 1837, 1838, 5, 451, 226, 2, 1838, 1850, 3, 2, 2, 2, 1839, 1840, 7, 82, 2, 2, 1840, 1841, 7, 71, 2, 2, 1841, 1842, 7, 84, 2, 2, 1842, 1843, 7, 79, 2, 2, 1843, 1844, 7, 75, 2, 2, 1844, 1845, 7, 85, 2, 2, 1845, 1846, 7, 85, 2, 2, 1846, 1847, 7, 75, 2, 2, 1847, 1848, 7, 81, 2, 2, 1848, 1850, 7, 80, 2, 2, 1849, 1828, 3, 2, 2, 2, 1849, 1839, 3, 2, 2, 2, 1850, 204, 3, 2, 2, 2, 1851, 1852, 5, 455, 228, 2, 1852, 1853, 5, 433, 217, 2, 1853, 1854, 5, 459, 230, 2, 1854, 1855, 5, 449, 225, 2, 1855, 1856, 5, 441, 221, 2, 1856, 1857, 5, 461, 231, 2, 1857, 1858, 5, 461, 231, 2, 1858, 1859, 5, 441, 221, 2, 1859, 1860, 5, 453, 227, 2, 1860, 1861, 5, 451, 226, 2, 1861, 1862, 5, 461, 231, 2, 1862, 1875, 3, 2, 2, 2, 1863, 1864, 7, 82, 2, 2, 1864, 1865, 7, 71, 2, 2, 1865, 1866, 7, 84, 2, 2, 1866, 1867, 7, 79, 2, 2, 1867, 1868, 7, 75, 2, 2, 1868, 1869, 7, 85, 2, 2, 1869, 1870, 7, 85, 2, 2, 1870, 1871, 7, 75, 2, 2, 1871, 1872, 7, 81, 2, 2, 1872, 1873, 7, 80, 2, 2, 1873, 1875, 7, 85, 2, 2, 1874, 1851, 3, 2, 2, 2, 1874, 1863, 3, 2, 2, 2, 1875, 206, 3, 2, 2, 2, 1876, 1877, 5, 455, 228, 2, 1877, 1878, 5, 459, 230, 2, 1878, 1879, 5, 441, 221, 2, 1879, 1880, 5, 449, 225, 2, 1880, 1881, 5, 425, 213, 2, 1881, 1882, 5, 459, 230, 2, 1882, 1883, 5, 473, 237, 2, 1883, 1892, 3, 2, 2, 2, 1884, 1885, 7, 82, 2, 2, 1885, 1886, 7, 84, 2, 2, 1886, 1887, 7, 75, 2, 2, 1887, 1888, 7, 79, 2, 2, 1888, 1889, 7, 67, 2, 2, 1889, 1890, 7, 84, 2, 2, 1890, 1892, 7, 91, 2, 2, 1891, 1876, 3, 2, 2, 2, 1891, 1884, 3, 2, 2, 2, 1892, 208, 3, 2, 2, 2, 1893, 1894, 5, 457, 229, 2, 1894, 1895, 5, 465, 233, 2, 1895, 1896, 5, 453, 227, 2, 1896, 1897, 5, 459, 230, 2, 1897, 1898, 5, 465, 233, 2, 1898, 1899, 5, 449, 225, 2, 1899, 1907, 3, 2, 2, 2, 1900, 1901, 7, 83, 2, 2, 1901, 1902, 7, 87, 2, 2, 1902, 1903, 7, 81, 2, 2, 1903, 1904, 7, 84, 2, 2, 1904, 1905, 7, 87, 2, 2, 1905, 1907, 7, 79, 2, 2, 1906, 1893, 3, 2, 2, 2, 1906, 1900, 3, 2, 2, 2, 1907, 210, 3, 2, 2, 2, 1908, 1909, 5, 459, 230, 2, 1909, 1910, 5, 433, 217, 2, 1910, 1911, 5, 451, 226, 2, 1911, 1912, 5, 425, 213, 2, 1912, 1913, 5, 449, 225, 2, 1913, 1914, 5, 433, 217, 2, 1914, 1922, 3, 2, 2, 2, 1915, 1916, 7, 84, 2, 2, 1916, 1917, 7, 71, 2, 2, 1917, 1918, 7, 80, 2, 2, 1918, 1919, 7, 67, 2, 2, 1919, 1920, 7, 79, 2, 2, 1920, 1922, 7, 71, 2, 2, 1921, 1908, 3, 2, 2, 2, 1921, 1915, 3, 2, 2, 2, 1922, 212, 3, 2, 2, 2, 1923, 1924, 5, 459, 230, 2, 1924, 1925, 5, 433, 217, 2, 1925, 1926, 5, 455, 228, 2, 1926, 1927, 5, 447, 224, 2, 1927, 1928, 5, 425, 213, 2, 1928, 1929, 5, 429, 215, 2, 1929, 1930, 5, 433, 217, 2, 1930, 1939, 3, 2, 2, 2, 1931, 1932, 7, 84, 2, 2, 1932, 1933, 7, 71, 2, 2, 1933, 1934, 7, 82, 2, 2, 1934, 1935, 7, 78, 2, 2, 1935, 1936, 7, 67, 2, 2, 1936, 1937, 7, 69, 2, 2, 1937, 1939, 7, 71, 2, 2, 1938, 1923, 3, 2, 2, 2, 1938, 1931, 3, 2, 2, 2, 1939, 214, 3, 2, 2, 2, 1940, 1941, 5, 459, 230, 2, 1941, 1942, 5, 433, 217, 2, 1942, 1943, 5, 455, 228, 2, 1943, 1944, 5, 447, 224, 2, 1944, 1945, 5, 441, 221, 2, 1945, 1946, 5, 429, 215, 2, 1946, 1947, 5, 425, 213, 2, 1947, 1948, 5, 463, 232, 2, 1948, 1949, 5, 441, 221, 2, 1949, 1950, 5, 453, 227, 2, 1950, 1951, 5, 451, 226, 2, 1951, 1964, 3, 2, 2, 2, 1952, 1953, 7, 84, 2, 2, 1953, 1954, 7, 71, 2, 2, 1954, 1955, 7, 82, 2, 2, 1955, 1956, 7, 78, 2, 2, 1956, 1957, 7, 75, 2, 2, 1957, 1958, 7, 69, 2, 2, 1958, 1959, 7, 67, 2, 2, 1959, 1960, 7, 86, 2, 2, 1960, 1961, 7, 75, 2, 2, 1961, 1962, 7, 81, 2, 2, 1962, 1964, 7, 80, 2, 2, 1963, 1940, 3, 2, 2, 2, 1963, 1952, 3, 2, 2, 2, 1964, 216, 3, 2, 2, 2, 1965, 1966, 5, 459, 230, 2, 1966, 1967, 5, 433, 217, 2, 1967, 1968, 5, 463, 232, 2, 1968, 1969, 5, 465, 233, 2, 1969, 1970, 5, 459, 230, 2, 1970, 1971, 5, 451, 226, 2, 1971, 1972, 5, 461, 231, 2, 1972, 1981, 3, 2, 2, 2, 1973, 1974, 7, 84, 2, 2, 1974, 1975, 7, 71, 2, 2, 1975, 1976, 7, 86, 2, 2, 1976, 1977, 7, 87, 2, 2, 1977, 1978, 7, 84, 2, 2, 1978, 1979, 7, 80, 2, 2, 1979, 1981, 7, 85, 2, 2, 1980, 1965, 3, 2, 2, 2, 1980, 1973, 3, 2, 2, 2, 1981, 218, 3, 2, 2, 2, 1982, 1983, 5, 459, 230, 2, 1983, 1984, 5, 433, 217, 2, 1984, 1985, 5, 467, 234, 2, 1985, 1986, 5, 453, 227, 2, 1986, 1987, 5, 445, 223, 2, 1987, 1988, 5, 433, 217, 2, 1988, 1996, 3, 2, 2, 2, 1989, 1990, 7, 84, 2, 2, 1990, 1991, 7, 71, 2, 2, 1991, 1992, 7, 88, 2, 2, 1992, 1993, 7, 81, 2, 2, 1993, 1994, 7, 77, 2, 2, 1994, 1996, 7, 71, 2, 2, 1995, 1982, 3, 2, 2, 2, 1995, 1989, 3, 2, 2, 2, 1996, 220, 3, 2, 2, 2, 1997, 1998, 5, 459, 230, 2, 1998, 1999, 5, 453, 227, 2, 1999, 2000, 5, 447, 224, 2, 2000, 2001, 5, 433, 217, 2, 2001, 2007, 3, 2, 2, 2, 2002, 2003, 7, 84, 2, 2, 2003, 2004, 7, 81, 2, 2, 2004, 2005, 7, 78, 2, 2, 2005, 2007, 7, 71, 2, 2, 2006, 1997, 3, 2, 2, 2, 2006, 2002, 3, 2, 2, 2, 2007, 222, 3, 2, 2, 2, 2008, 2009, 5, 459, 230, 2, 2009, 2010, 5, 453, 227, 2, 2010, 2011, 5, 447, 224, 2, 2011, 2012, 5, 433, 217, 2, 2012, 2013, 5, 461, 231, 2, 2013, 2020, 3, 2, 2, 2, 2014, 2015, 7, 84, 2, 2, 2015, 2016, 7, 81, 2, 2, 2016, 2017, 7, 78, 2, 2, 2017, 2018, 7, 71, 2, 2, 2018, 2020, 7, 85, 2, 2, 2019, 2008, 3, 2, 2, 2, 2019, 2014, 3, 2, 2, 2, 2020, 224, 3, 2, 2, 2, 2021, 2022, 5, 441, 221, 2, 2022, 2023, 5, 451, 226, 2, 2023, 2024, 5, 463, 232, 2, 2024, 2025, 5, 433, 217, 2, 2025, 2026, 5, 459, 230, 2, 2026, 2027, 5, 451, 226, 2, 2027, 2028, 5, 425, 213, 2, 2028, 2029, 5, 447, 224, 2, 2029, 2039, 3, 2, 2, 2, 2030, 2031, 7, 75, 2, 2, 2031, 2032, 7, 80, 2, 2, 2032, 2033, 7, 86, 2, 2, 2033, 2034, 7, 71, 2, 2, 2034, 2035, 7, 84, 2, 2, 2035, 2036, 7, 80, 2, 2, 2036, 2037, 7, 67, 2, 2, 2037, 2039, 7, 78, 2, 2, 2038, 2021, 3, 2, 2, 2, 2038, 2030, 3, 2, 2, 2, 2039, 226, 3, 2, 2, 2, 2040, 2041, 5, 447, 224, 2, 2041, 2042, 5, 431, 216, 2, 2042, 2043, 5, 425, 213, 2, 2043, 2044, 5, 455, 228, 2, 2044, 2050, 3, 2, 2, 2, 2045, 2046, 7, 78, 2, 2, 2046, 2047, 7, 70, 2, 2, 2047, 2048, 7, 67, 2, 2, 2048, 2050, 7, 82, 2, 2, 2049, 2040, 3, 2, 2, 2, 2049, 2045, 3, 2, 2, 2, 2050, 228, 3, 2, 2, 2, 2051, 2052, 5, 461, 231, 2, 2052, 2053, 5, 429, 215, 2, 2053, 2054, 5, 433, 217, 2, 2054, 2055, 5, 449, 225, 2, 2055, 2056, 5, 433, 217, 2, 2056, 2064, 3, 2, 2, 2, 2057, 2058, 7, 85, 2, 2, 2058, 2059, 7, 69, 2, 2, 2059, 2060, 7, 74, 2, 2, 2060, 2061, 7, 71, 2, 2, 2061, 2062, 7, 79, 2, 2, 2062, 2064, 7, 71, 2, 2, 2063, 2051, 3, 2, 2, 2, 2063, 2057, 3, 2, 2, 2, 2064, 230, 3, 2, 2, 2, 2065, 2066, 5, 461, 231, 2, 2066, 2067, 5, 429, 215, 2, 2067, 2068, 5, 439, 220, 2, 2068, 2069, 5, 433, 217, 2, 2069, 2070, 5, 449, 225, 2, 2070, 2071, 5, 425, 213, 2, 2071, 2079, 3, 2, 2, 2, 2072, 2073, 7, 85, 2, 2, 2073, 2074, 7, 69, 2, 2, 2074, 2075, 7, 74, 2, 2, 2075, 2076, 7, 71, 2, 2, 2076, 2077, 7, 79, 2, 2, 2077, 2079, 7, 67, 2, 2, 2078, 2065, 3, 2, 2, 2, 2078, 2072, 3, 2, 2, 2, 2079, 232, 3, 2, 2, 2, 2080, 2081, 5, 461, 231, 2, 2081, 2082, 5, 433, 217, 2, 2082, 2083, 5, 447, 224, 2, 2083, 2084, 5, 433, 217, 2, 2084, 2085, 5, 429, 215, 2, 2085, 2086, 5, 463, 232, 2, 2086, 2094, 3, 2, 2, 2, 2087, 2088, 7, 85, 2, 2, 2088, 2089, 7, 71, 2, 2, 2089, 2090, 7, 78, 2, 2, 2090, 2091, 7, 71, 2, 2, 2091, 2092, 7, 69, 2, 2, 2092, 2094, 7, 86, 2, 2, 2093, 2080, 3, 2, 2, 2, 2093, 2087, 3, 2, 2, 2, 2094, 234, 3, 2, 2, 2, 2095, 2096, 5, 461, 231, 2, 2096, 2097, 5, 433, 217, 2, 2097, 2098, 5, 463, 232, 2, 2098, 2103, 3, 2, 2, 2, 2099, 2100, 7, 85, 2, 2, 2100, 2101, 7, 71, 2, 2, 2101, 2103, 7, 86, 2, 2, 2102, 2095, 3, 2, 2, 2, 2102, 2099, 3, 2, 2, 2, 2103, 236, 3, 2, 2, 2, 2104, 2105, 5, 461, 231, 2, 2105, 2106, 5, 435, 218, 2, 2106, 2107, 5, 465, 233, 2, 2107, 2108, 5, 451, 226, 2, 2108, 2109, 5, 429, 215, 2, 2109, 2116, 3, 2, 2, 2, 2110, 2111, 7, 85, 2, 2, 2111, 2112, 7, 72, 2, 2, 2112, 2113, 7, 87, 2, 2, 2113, 2114, 7, 80, 2, 2, 2114, 2116, 7, 69, 2, 2, 2115, 2104, 3, 2, 2, 2, 2115, 2110, 3, 2, 2, 2, 2116, 238, 3, 2, 2, 2, 2117, 2118, 5, 461, 231, 2, 2118, 2119, 5, 463, 232, 2, 2119, 2120, 5, 425, 213, 2, 2120, 2121, 5, 463, 232, 2, 2121, 2122, 5, 441, 221, 2, 2122, 2123, 5, 429, 215, 2, 2123, 2131, 3, 2, 2, 2, 2124, 2125, 7, 85, 2, 2, 2125, 2126, 7, 86, 2, 2, 2126, 2127, 7, 67, 2, 2, 2127, 2128, 7, 86, 2, 2, 2128, 2129, 7, 75, 2, 2, 2129, 2131, 7, 69, 2, 2, 2130, 2117, 3, 2, 2, 2, 2130, 2124, 3, 2, 2, 2, 2131, 240, 3, 2, 2, 2, 2132, 2133, 5, 461, 231, 2, 2133, 2134, 5, 463, 232, 2, 2134, 2135, 5, 453, 227, 2, 2135, 2136, 5, 459, 230, 2, 2136, 2137, 5, 425, 213, 2, 2137, 2138, 5, 437, 219, 2, 2138, 2139, 5, 433, 217, 2, 2139, 2148, 3, 2, 2, 2, 2140, 2141, 7, 85, 2, 2, 2141, 2142, 7, 86, 2, 2, 2142, 2143, 7, 81, 2, 2, 2143, 2144, 7, 84, 2, 2, 2144, 2145, 7, 67, 2, 2, 2145, 2146, 7, 73, 2, 2, 2146, 2148, 7, 71, 2, 2, 2147, 2132, 3, 2, 2, 2, 2147, 2140, 3, 2, 2, 2, 2148, 242, 3, 2, 2, 2, 2149, 2150, 5, 461, 231, 2, 2150, 2151, 5, 463, 232, 2, 2151, 2152, 5, 473, 237, 2, 2152, 2153, 5, 455, 228, 2, 2153, 2154, 5, 433, 217, 2, 2154, 2161, 3, 2, 2, 2, 2155, 2156, 7, 85, 2, 2, 2156, 2157, 7, 86, 2, 2, 2157, 2158, 7, 91, 2, 2, 2158, 2159, 7, 82, 2, 2, 2159, 2161, 7, 71, 2, 2, 2160, 2149, 3, 2, 2, 2, 2160, 2155, 3, 2, 2, 2, 2161, 244, 3, 2, 2, 2, 2162, 2163, 5, 461, 231, 2, 2163, 2164, 5, 465, 233, 2, 2164, 2165, 5, 455, 228, 2, 2165, 2166, 5, 433, 217, 2, 2166, 2167, 5, 459, 230, 2, 2167, 2168, 5, 465, 233, 2, 2168, 2169, 5, 461, 231, 2, 2169, 2170, 5, 433, 217, 2, 2170, 2171, 5, 459, 230, 2, 2171, 2182, 3, 2, 2, 2, 2172, 2173, 7, 85, 2, 2, 2173, 2174, 7, 87, 2, 2, 2174, 2175, 7, 82, 2, 2, 2175, 2176, 7, 71, 2, 2, 2176, 2177, 7, 84, 2, 2, 2177, 2178, 7, 87, 2, 2, 2178, 2179, 7, 85, 2, 2, 2179, 2180, 7, 71, 2, 2, 2180, 2182, 7, 84, 2, 2, 2181, 2162, 3, 2, 2, 2, 2181, 2172, 3, 2, 2, 2, 2182, 246, 3, 2, 2, 2, 2183, 2184, 5, 463, 232, 2, 2184, 2185, 5, 425, 213, 2, 2185, 2186, 5, 427, 214, 2, 2186, 2187, 5, 447, 224, 2, 2187, 2188, 5, 433, 217, 2, 2188, 2195, 3, 2, 2, 2, 2189, 2190, 7, 86, 2, 2, 2190, 2191, 7, 67, 2, 2, 2191, 2192, 7, 68, 2, 2, 2192, 2193, 7, 78, 2, 2, 2193, 2195, 7, 71, 2, 2, 2194, 2183, 3, 2, 2, 2, 2194, 2189, 3, 2, 2, 2, 2195, 248, 3, 2, 2, 2, 2196, 2197, 5, 463, 232, 2, 2197, 2198, 5, 439, 220, 2, 2198, 2199, 5, 459, 230, 2, 2199, 2200, 5, 433, 217, 2, 2200, 2201, 5, 433, 217, 2, 2201, 2208, 3, 2, 2, 2, 2202, 2203, 7, 86, 2, 2, 2203, 2204, 7, 74, 2, 2, 2204, 2205, 7, 84, 2, 2, 2205, 2206, 7, 71, 2, 2, 2206, 2208, 7, 71, 2, 2, 2207, 2196, 3, 2, 2, 2, 2207, 2202, 3, 2, 2, 2, 2208, 250, 3, 2, 2, 2, 2209, 2210, 5, 463, 232, 2, 2210, 2211, 5, 441, 221, 2, 2211, 2212, 5, 449, 225, 2, 2212, 2213, 5, 433, 217, 2, 2213, 2214, 5, 461, 231, 2, 2214, 2215, 5, 463, 232, 2, 2215, 2216, 5, 425, 213, 2, 2216, 2217, 5, 449, 225, 2, 2217, 2218, 5, 455, 228, 2, 2218, 2229, 3, 2, 2, 2, 2219, 2220, 7, 86, 2, 2, 2220, 2221, 7, 75, 2, 2, 2221, 2222, 7, 79, 2, 2, 2222, 2223, 7, 71, 2, 2, 2223, 2224, 7, 85, 2, 2, 2224, 2225, 7, 86, 2, 2, 2225, 2226, 7, 67, 2, 2, 2226, 2227, 7, 79, 2, 2, 2227, 2229, 7, 82, 2, 2, 2228, 2209, 3, 2, 2, 2, 2228, 2219, 3, 2, 2, 2, 2229, 252, 3, 2, 2, 2, 2230, 2231, 5, 463, 232, 2, 2231, 2232, 5, 453, 227, 2, 2232, 2236, 3, 2, 2, 2, 2233, 2234, 7, 86, 2, 2, 2234, 2236, 7, 81, 2, 2, 2235, 2230, 3, 2, 2, 2, 2235, 2233, 3, 2, 2, 2, 2236, 254, 3, 2, 2, 2, 2237, 2238, 5, 463, 232, 2, 2238, 2239, 5, 453, 227, 2, 2239, 2240, 5, 445, 223, 2, 2240, 2241, 5, 433, 217, 2, 2241, 2242, 5, 451, 226, 2, 2242, 2249, 3, 2, 2, 2, 2243, 2244, 7, 86, 2, 2, 2244, 2245, 7, 81, 2, 2, 2245, 2246, 7, 77, 2, 2, 2246, 2247, 7, 71, 2, 2, 2247, 2249, 7, 80, 2, 2, 2248, 2237, 3, 2, 2, 2, 2248, 2243, 3, 2, 2, 2, 2249, 256, 3, 2, 2, 2, 2250, 2251, 5, 463, 232, 2, 2251, 2252, 5, 459, 230, 2, 2252, 2253, 5, 441, 221, 2, 2253, 2254, 5, 437, 219, 2, 2254, 2255, 5, 437, 219, 2, 2255, 2256, 5, 433, 217, 2, 2256, 2257, 5, 459, 230, 2, 2257, 2266, 3, 2, 2, 2, 2258, 2259, 7, 86, 2, 2, 2259, 2260, 7, 84, 2, 2, 2260, 2261, 7, 75, 2, 2, 2261, 2262, 7, 73, 2, 2, 2262, 2263, 7, 73, 2, 2, 2263, 2264, 7, 71, 2, 2, 2264, 2266, 7, 84, 2, 2, 2265, 2250, 3, 2, 2, 2, 2265, 2258, 3, 2, 2, 2, 2266, 258, 3, 2, 2, 2, 2267, 2268, 5, 463, 232, 2, 2268, 2269, 5, 459, 230, 2, 2269, 2270, 5, 465, 233, 2, 2270, 2271, 5, 433, 217, 2, 2271, 2284, 3, 2, 2, 2, 2272, 2273, 7, 86, 2, 2, 2273, 2274, 7, 84, 2, 2, 2274, 2275, 7, 87, 2, 2, 2275, 2284, 7, 71, 2, 2, 2276, 2277, 5, 45, 23, 2, 2277, 2278, 5, 463, 232, 2, 2278, 2279, 5, 459, 230, 2, 2279, 2280, 5, 465, 233, 2, 2280, 2281, 5, 433, 217, 2, 2281, 2282, 5, 45, 23, 2, 2282, 2284, 3, 2, 2, 2, 2283, 2267, 3, 2, 2, 2, 2283, 2272, 3, 2, 2, 2, 2283, 2276, 3, 2, 2, 2, 2284, 260, 3, 2, 2, 2, 2285, 2286, 5, 463, 232, 2, 2286, 2287, 5, 459, 230, 2, 2287, 2288, 5, 465, 233, 2, 2288, 2289, 5, 451, 226, 2, 2289, 2290, 5, 429, 215, 2, 2290, 2291, 5, 425, 213, 2, 2291, 2292, 5, 463, 232, 2, 2292, 2293, 5, 433, 217, 2, 2293, 2303, 3, 2, 2, 2, 2294, 2295, 7, 86, 2, 2, 2295, 2296, 7, 84, 2, 2, 2296, 2297, 7, 87, 2, 2, 2297, 2298, 7, 80, 2, 2, 2298, 2299, 7, 69, 2, 2, 2299, 2300, 7, 67, 2, 2, 2300, 2301, 7, 86, 2, 2, 2301, 2303, 7, 71, 2, 2, 2302, 2285, 3, 2, 2, 2, 2302, 2294, 3, 2, 2, 2, 2303, 262, 3, 2, 2, 2, 2304, 2305, 5, 463, 232, 2, 2305, 2306, 5, 463, 232, 2, 2306, 2307, 5, 447, 224, 2, 2307, 2312, 3, 2, 2, 2, 2308, 2309, 7, 86, 2, 2, 2309, 2310, 7, 86, 2, 2, 2310, 2312, 7, 78, 2, 2, 2311, 2304, 3, 2, 2, 2, 2311, 2308, 3, 2, 2, 2, 2312, 264, 3, 2, 2, 2, 2313, 2314, 5, 463, 232, 2, 2314, 2315, 5, 469, 235, 2, 2315, 2316, 5, 453, 227, 2, 2316, 2321, 3, 2, 2, 2, 2317, 2318, 7, 86, 2, 2, 2318, 2319, 7, 89, 2, 2, 2319, 2321, 7, 81, 2, 2, 2320, 2313, 3, 2, 2, 2, 2320, 2317, 3, 2, 2, 2, 2321, 266, 3, 2, 2, 2, 2322, 2323, 5, 463, 232, 2, 2323, 2324, 5, 473, 237, 2, 2324, 2325, 5, 455, 228, 2, 2325, 2326, 5, 433, 217, 2, 2326, 2332, 3, 2, 2, 2, 2327, 2328, 7, 86, 2, 2, 2328, 2329, 7, 91, 2, 2, 2329, 2330, 7, 82, 2, 2, 2330, 2332, 7, 71, 2, 2, 2331, 2322, 3, 2, 2, 2, 2331, 2327, 3, 2, 2, 2, 2332, 268, 3, 2, 2, 2, 2333, 2334, 5, 465, 233, 2, 2334, 2335, 5, 451, 226, 2, 2335, 2336, 5, 447, 224, 2, 2336, 2337, 5, 453, 227, 2, 2337, 2338, 5, 437, 219, 2, 2338, 2339, 5, 437, 219, 2, 2339, 2340, 5, 433, 217, 2, 2340, 2341, 5, 431, 216, 2, 2341, 2351, 3, 2, 2, 2, 2342, 2343, 7, 87, 2, 2, 2343, 2344, 7, 80, 2, 2, 2344, 2345, 7, 78, 2, 2, 2345, 2346, 7, 81, 2, 2, 2346, 2347, 7, 73, 2, 2, 2347, 2348, 7, 73, 2, 2, 2348, 2349, 7, 71, 2, 2, 2349, 2351, 7, 70, 2, 2, 2350, 2333, 3, 2, 2, 2, 2350, 2342, 3, 2, 2, 2, 2351, 270, 3, 2, 2, 2, 2352, 2353, 5, 465, 233, 2, 2353, 2354, 5, 455, 228, 2, 2354, 2355, 5, 431, 216, 2, 2355, 2356, 5, 425, 213, 2, 2356, 2357, 5, 463, 232, 2, 2357, 2358, 5, 433, 217, 2, 2358, 2366, 3, 2, 2, 2, 2359, 2360, 7, 87, 2, 2, 2360, 2361, 7, 82, 2, 2, 2361, 2362, 7, 70, 2, 2, 2362, 2363, 7, 67, 2, 2, 2363, 2364, 7, 86, 2, 2, 2364, 2366, 7, 71, 2, 2, 2365, 2352, 3, 2, 2, 2, 2365, 2359, 3, 2, 2, 2, 2366, 272, 3, 2, 2, 2, 2367, 2368, 5, 465, 233, 2, 2368, 2369, 5, 461, 231, 2, 2369, 2370, 5, 433, 217, 2, 2370, 2375, 3, 2, 2, 2, 2371, 2372, 7, 87, 2, 2, 2372, 2373, 7, 85, 2, 2, 2373, 2375, 7, 71, 2, 2, 2374, 2367, 3, 2, 2, 2, 2374, 2371, 3, 2, 2, 2, 2375, 274, 3, 2, 2, 2, 2376, 2377, 5, 465, 233, 2, 2377, 2378, 5, 461, 231, 2, 2378, 2379, 5, 433, 217, 2, 2379, 2380, 5, 459, 230, 2, 2380, 2386, 3, 2, 2, 2, 2381, 2382, 7, 87, 2, 2, 2382, 2383, 7, 85, 2, 2, 2383, 2384, 7, 71, 2, 2, 2384, 2386, 7, 84, 2, 2, 2385, 2376, 3, 2, 2, 2, 2385, 2381, 3, 2, 2, 2, 2386, 276, 3, 2, 2, 2, 2387, 2388, 5, 465, 233, 2, 2388, 2389, 5, 461, 231, 2, 2389, 2390, 5, 441, 221, 2, 2390, 2391, 5, 451, 226, 2, 2391, 2392, 5, 437, 219, 2, 2392, 2399, 3, 2, 2, 2, 2393, 2394, 7, 87, 2, 2, 2394, 2395, 7, 85, 2, 2, 2395, 2396, 7, 75, 2, 2, 2396, 2397, 7, 80, 2, 2, 2397, 2399, 7, 73, 2, 2, 2398, 2387, 3, 2, 2, 2, 2398, 2393, 3, 2, 2, 2, 2399, 278, 3, 2, 2, 2, 2400, 2401, 5, 465, 233, 2, 2401, 2402, 5, 465, 233, 2, 2402, 2403, 5, 441, 221, 2, 2403, 2404, 5, 431, 216, 2, 2404, 2410, 3, 2, 2, 2, 2405, 2406, 7, 87, 2, 2, 2406, 2407, 7, 87, 2, 2, 2407, 2408, 7, 75, 2, 2, 2408, 2410, 7, 70, 2, 2, 2409, 2400, 3, 2, 2, 2, 2409, 2405, 3, 2, 2, 2, 2410, 280, 3, 2, 2, 2, 2411, 2412, 5, 467, 234, 2, 2412, 2413, 5, 425, 213, 2, 2413, 2414, 5, 447, 224, 2, 2414, 2415, 5, 465, 233, 2, 2415, 2416, 5, 433, 217, 2, 2416, 2417, 5, 461, 231, 2, 2417, 2425, 3, 2, 2, 2, 2418, 2419, 7, 88, 2, 2, 2419, 2420, 7, 67, 2, 2, 2420, 2421, 7, 78, 2, 2, 2421, 2422, 7, 87, 2, 2, 2422, 2423, 7, 71, 2, 2, 2423, 2425, 7, 85, 2, 2, 2424, 2411, 3, 2, 2, 2, 2424, 2418, 3, 2, 2, 2, 2425, 282, 3, 2, 2, 2, 2426, 2427, 5, 467, 234, 2, 2427, 2428, 5, 441, 221, 2, 2428, 2429, 5, 433, 217, 2, 2429, 2430, 5, 469, 235, 2, 2430, 2436, 3, 2, 2, 2, 2431, 2432, 7, 88, 2, 2, 2432, 2433, 7, 75, 2, 2, 2433, 2434, 7, 71, 2, 2, 2434, 2436, 7, 89, 2, 2, 2435, 2426, 3, 2, 2, 2, 2435, 2431, 3, 2, 2, 2, 2436, 284, 3, 2, 2, 2, 2437, 2438, 5, 469, 235, 2, 2438, 2439, 5, 439, 220, 2, 2439, 2440, 5, 433, 217, 2, 2440, 2441, 5, 459, 230, 2, 2441, 2442, 5, 433, 217, 2, 2442, 2449, 3, 2, 2, 2, 2443, 2444, 7, 89, 2, 2, 2444, 2445, 7, 74, 2, 2, 2445, 2446, 7, 71, 2, 2, 2446, 2447, 7, 84, 2, 2, 2447, 2449, 7, 71, 2, 2, 2448, 2437, 3, 2, 2, 2, 2448, 2443, 3, 2, 2, 2, 2449, 286, 3, 2, 2, 2, 2450, 2451, 5, 469, 235, 2, 2451, 2452, 5, 441, 221, 2, 2452, 2453, 5, 463, 232, 2, 2453, 2454, 5, 439, 220, 2, 2454, 2460, 3, 2, 2, 2, 2455, 2456, 7, 89, 2, 2, 2456, 2457, 7, 75, 2, 2, 2457, 2458, 7, 86, 2, 2, 2458, 2460, 7, 74, 2, 2, 2459, 2450, 3, 2, 2, 2, 2459, 2455, 3, 2, 2, 2, 2460, 288, 3, 2, 2, 2, 2461, 2462, 5, 469, 235, 2, 2462, 2463, 5, 459, 230, 2, 2463, 2464, 5, 441, 221, 2, 2464, 2465, 5, 463, 232, 2, 2465, 2466, 5, 433, 217, 2, 2466, 2467, 5, 463, 232, 2, 2467, 2468, 5, 441, 221, 2, 2468, 2469, 5, 449, 225, 2, 2469, 2470, 5, 433, 217, 2, 2470, 2481, 3, 2, 2, 2, 2471, 2472, 7, 89, 2, 2, 2472, 2473, 7, 84, 2, 2, 2473, 2474, 7, 75, 2, 2, 2474, 2475, 7, 86, 2, 2, 2475, 2476, 7, 71, 2, 2, 2476, 2477, 7, 86, 2, 2, 2477, 2478, 7, 75, 2, 2, 2478, 2479, 7, 79, 2, 2, 2479, 2481, 7, 71, 2, 2, 2480, 2461, 3, 2, 2, 2, 2480, 2471, 3, 2, 2, 2, 2481, 290, 3, 2, 2, 2, 2482, 2483, 5, 425, 213, 2, 2483, 2484, 5, 461, 231, 2, 2484, 2485, 5, 429, 215, 2, 2485, 2486, 5, 441, 221, 2, 2486, 2487, 5, 441, 221, 2, 2487, 2497, 3, 2, 2, 2, 2488, 2489, 5, 45, 23, 2, 2489, 2490, 5, 425, 213, 2, 2490, 2491, 5, 461, 231, 2, 2491, 2492, 5, 429, 215, 2, 2492, 2493, 5, 441, 221, 2, 2493, 2494, 5, 441, 221, 2, 2494, 2495, 5, 45, 23, 2, 2495, 2497, 3, 2, 2, 2, 2496, 2482, 3, 2, 2, 2, 2496, 2488, 3, 2, 2, 2, 2497, 292, 3, 2, 2, 2, 2498, 2499, 5, 45, 23, 2, 2499, 2500, 5, 429, 215, 2, 2500, 2501, 5, 425, 213, 2, 2501, 2502, 5, 461, 231, 2, 2502, 2503, 5, 433, 217, 2, 2503, 2504, 7, 97, 2, 2, 2504, 2505, 5, 461, 231, 2, 2505, 2506, 5, 433, 217, 2, 2506, 2507, 5, 451, 226, 2, 2507, 2508, 5, 461, 231, 2, 2508, 2509, 5, 441, 221, 2, 2509, 2510, 5, 463, 232, 2, 2510, 2511, 5, 441, 221, 2, 2511, 2512, 5, 467, 234, 2, 2512, 2513, 5, 433, 217, 2, 2513, 2514, 5, 45, 23, 2, 2514, 294, 3, 2, 2, 2, 2515, 2516, 5, 45, 23, 2, 2516, 2517, 5, 451, 226, 2, 2517, 2518, 5, 453, 227, 2, 2518, 2519, 5, 459, 230, 2, 2519, 2520, 5, 449, 225, 2, 2520, 2521, 5, 425, 213, 2, 2521, 2522, 5, 447, 224, 2, 2522, 2523, 5, 441, 221, 2, 2523, 2524, 5, 475, 238, 2, 2524, 2525, 5, 433, 217, 2, 2525, 2526, 5, 45, 23, 2, 2526, 296, 3, 2, 2, 2, 2527, 2528, 5, 461, 231, 2, 2528, 2529, 5, 441, 221, 2, 2529, 2530, 5, 449, 225, 2, 2530, 2531, 5, 441, 221, 2, 2531, 2532, 5, 447, 224, 2, 2532, 2533, 5, 425, 213, 2, 2533, 2534, 5, 459, 230, 2, 2534, 2535, 5, 441, 221, 2, 2535, 2536, 5, 463, 232, 2, 2536, 2537, 5, 473, 237, 2, 2537, 2538, 7, 97, 2, 2, 2538, 2539, 5, 435, 218, 2, 2539, 2540, 5, 465, 233, 2, 2540, 2541, 5, 451, 226, 2, 2541, 2542, 5, 429, 215, 2, 2542, 2543, 5, 463, 232, 2, 2543, 2544, 5, 441, 221, 2, 2544, 2545, 5, 453, 227, 2, 2545, 2546, 5, 451, 226, 2, 2546, 2570, 3, 2, 2, 2, 2547, 2548, 5, 45, 23, 2, 2548, 2549, 5, 461, 231, 2, 2549, 2550, 5, 441, 221, 2, 2550, 2551, 5, 449, 225, 2, 2551, 2552, 5, 441, 221, 2, 2552, 2553, 5, 447, 224, 2, 2553, 2554, 5, 425, 213, 2, 2554, 2555, 5, 459, 230, 2, 2555, 2556, 5, 441, 221, 2, 2556, 2557, 5, 463, 232, 2, 2557, 2558, 5, 473, 237, 2, 2558, 2559, 7, 97, 2, 2, 2559, 2560, 5, 435, 218, 2, 2560, 2561, 5, 465, 233, 2, 2561, 2562, 5, 451, 226, 2, 2562, 2563, 5, 429, 215, 2, 2563, 2564, 5, 463, 232, 2, 2564, 2565, 5, 441, 221, 2, 2565, 2566, 5, 453, 227, 2, 2566, 2567, 5, 451, 226, 2, 2567, 2568, 5, 45, 23, 2, 2568, 2570, 3, 2, 2, 2, 2569, 2527, 3, 2, 2, 2, 2569, 2547, 3, 2, 2, 2, 2570, 298, 3, 2, 2, 2, 2571, 2572, 5, 45, 23, 2, 2572, 2573, 5, 425, 213, 2, 2573, 2574, 5, 451, 226, 2, 2574, 2575, 5, 425, 213, 2, 2575, 2576, 5, 447, 224, 2, 2576, 2577, 5, 473, 237, 2, 2577, 2578, 5, 475, 238, 2, 2578, 2579, 5, 433, 217, 2, 2579, 2580, 5, 431, 216, 2, 2580, 2581, 5, 45, 23, 2, 2581, 300, 3, 2, 2, 2, 2582, 2583, 5, 45, 23, 2, 2583, 2584, 5, 441, 221, 2, 2584, 2585, 5, 461, 231, 2, 2585, 2586, 7, 97, 2, 2, 2586, 2587, 5, 447, 224, 2, 2587, 2588, 5, 441, 221, 2, 2588, 2589, 5, 463, 232, 2, 2589, 2590, 5, 433, 217, 2, 2590, 2591, 5, 459, 230, 2, 2591, 2592, 5, 425, 213, 2, 2592, 2593, 5, 447, 224, 2, 2593, 2594, 5, 45, 23, 2, 2594, 302, 3, 2, 2, 2, 2595, 2596, 5, 45, 23, 2, 2596, 2597, 5, 449, 225, 2, 2597, 2598, 5, 425, 213, 2, 2598, 2599, 5, 471, 236, 2, 2599, 2600, 7, 97, 2, 2, 2600, 2601, 5, 429, 215, 2, 2601, 2602, 5, 453, 227, 2, 2602, 2603, 5, 449, 225, 2, 2603, 2604, 5, 455, 228, 2, 2604, 2605, 5, 425, 213, 2, 2605, 2606, 5, 429, 215, 2, 2606, 2607, 5, 463, 232, 2, 2607, 2608, 5, 441, 221, 2, 2608, 2609, 5, 453, 227, 2, 2609, 2610, 5, 451, 226, 2, 2610, 2611, 7, 97, 2, 2, 2611, 2612, 5, 435, 218, 2, 2612, 2613, 5, 447, 224, 2, 2613, 2614, 5, 465, 233, 2, 2614, 2615, 5, 461, 231, 2, 2615, 2616, 5, 439, 220, 2, 2616, 2617, 7, 97, 2, 2, 2617, 2618, 5, 449, 225, 2, 2618, 2619, 5, 433, 217, 2, 2619, 2620, 5, 449, 225, 2, 2620, 2621, 5, 453, 227, 2, 2621, 2622, 5, 459, 230, 2, 2622, 2623, 5, 473, 237, 2, 2623, 2624, 7, 97, 2, 2, 2624, 2625, 5, 441, 221, 2, 2625, 2626, 5, 451, 226, 2, 2626, 2627, 7, 97, 2, 2, 2627, 2628, 5, 449, 225, 2, 2628, 2629, 5, 427, 214, 2, 2629, 2630, 5, 45, 23, 2, 2630, 304, 3, 2, 2, 2, 2631, 2632, 5, 45, 23, 2, 2632, 2633, 5, 463, 232, 2, 2633, 2634, 5, 453, 227, 2, 2634, 2635, 5, 445, 223, 2, 2635, 2636, 5, 433, 217, 2, 2636, 2637, 5, 451, 226, 2, 2637, 2638, 5, 441, 221, 2, 2638, 2639, 5, 475, 238, 2, 2639, 2640, 5, 425, 213, 2, 2640, 2641, 5, 463, 232, 2, 2641, 2642, 5, 441, 221, 2, 2642, 2643, 5, 453, 227, 2, 2643, 2644, 5, 451, 226, 2, 2644, 2645, 7, 97, 2, 2, 2645, 2646, 5, 433, 217, 2, 2646, 2647, 5, 451, 226, 2, 2647, 2648, 5, 425, 213, 2, 2648, 2649, 5, 427, 214, 2, 2649, 2650, 5, 447, 224, 2, 2650, 2651, 5, 433, 217, 2, 2651, 2652, 7, 97, 2, 2, 2652, 2653, 5, 461, 231, 2, 2653, 2654, 5, 463, 232, 2, 2654, 2655, 5, 433, 217, 2, 2655, 2656, 5, 449, 225, 2, 2656, 2657, 5, 449, 225, 2, 2657, 2658, 5, 441, 221, 2, 2658, 2659, 5, 451, 226, 2, 2659, 2660, 5, 437, 219, 2, 2660, 2661, 5, 45, 23, 2, 2661, 306, 3, 2, 2, 2, 2662, 2663, 5, 45, 23, 2, 2663, 2664, 5, 463, 232, 2, 2664, 2665, 5, 453, 227, 2, 2665, 2666, 5, 445, 223, 2, 2666, 2667, 5, 433, 217, 2, 2667, 2668, 5, 451, 226, 2, 2668, 2669, 5, 441, 221, 2, 2669, 2670, 5, 475, 238, 2, 2670, 2671, 5, 425, 213, 2, 2671, 2672, 5, 463, 232, 2, 2672, 2673, 5, 441, 221, 2, 2673, 2674, 5, 453, 227, 2, 2674, 2675, 5, 451, 226, 2, 2675, 2676, 7, 97, 2, 2, 2676, 2677, 5, 461, 231, 2, 2677, 2678, 5, 445, 223, 2, 2678, 2679, 5, 441, 221, 2, 2679, 2680, 5, 455, 228, 2, 2680, 2681, 7, 97, 2, 2, 2681, 2682, 5, 461, 231, 2, 2682, 2683, 5, 463, 232, 2, 2683, 2684, 5, 453, 227, 2, 2684, 2685, 5, 455, 228, 2, 2685, 2686, 7, 97, 2, 2, 2686, 2687, 5, 469, 235, 2, 2687, 2688, 5, 453, 227, 2, 2688, 2689, 5, 459, 230, 2, 2689, 2690, 5, 431, 216, 2, 2690, 2691, 5, 461, 231, 2, 2691, 2692, 5, 45, 23, 2, 2692, 308, 3, 2, 2, 2, 2693, 2694, 5, 45, 23, 2, 2694, 2695, 5, 463, 232, 2, 2695, 2696, 5, 453, 227, 2, 2696, 2697, 5, 445, 223, 2, 2697, 2698, 5, 433, 217, 2, 2698, 2699, 5, 451, 226, 2, 2699, 2700, 5, 441, 221, 2, 2700, 2701, 5, 475, 238, 2, 2701, 2702, 5, 425, 213, 2, 2702, 2703, 5, 463, 232, 2, 2703, 2704, 5, 441, 221, 2, 2704, 2705, 5, 453, 227, 2, 2705, 2706, 5, 451, 226, 2, 2706, 2707, 7, 97, 2, 2, 2707, 2708, 5, 447, 224, 2, 2708, 2709, 5, 453, 227, 2, 2709, 2710, 5, 429, 215, 2, 2710, 2711, 5, 425, 213, 2, 2711, 2712, 5, 447, 224, 2, 2712, 2713, 5, 433, 217, 2, 2713, 2714, 5, 45, 23, 2, 2714, 310, 3, 2, 2, 2, 2715, 2716, 5, 45, 23, 2, 2716, 2717, 5, 463, 232, 2, 2717, 2718, 5, 453, 227, 2, 2718, 2719, 5, 445, 223, 2, 2719, 2720, 5, 433, 217, 2, 2720, 2721, 5, 451, 226, 2, 2721, 2722, 5, 441, 221, 2, 2722, 2723, 5, 475, 238, 2, 2723, 2724, 5, 425, 213, 2, 2724, 2725, 5, 463, 232, 2, 2725, 2726, 5, 441, 221, 2, 2726, 2727, 5, 453, 227, 2, 2727, 2728, 5, 451, 226, 2, 2728, 2729, 7, 97, 2, 2, 2729, 2730, 5, 451, 226, 2, 2730, 2731, 5, 453, 227, 2, 2731, 2732, 5, 459, 230, 2, 2732, 2733, 5, 449, 225, 2, 2733, 2734, 5, 425, 213, 2, 2734, 2735, 5, 447, 224, 2, 2735, 2736, 5, 441, 221, 2, 2736, 2737, 5, 475, 238, 2, 2737, 2738, 5, 433, 217, 2, 2738, 2739, 7, 97, 2, 2, 2739, 2740, 5, 447, 224, 2, 2740, 2741, 5, 453, 227, 2, 2741, 2742, 5, 469, 235, 2, 2742, 2743, 5, 433, 217, 2, 2743, 2744, 5, 459, 230, 2, 2744, 2745, 5, 429, 215, 2, 2745, 2746, 5, 425, 213, 2, 2746, 2747, 5, 461, 231, 2, 2747, 2748, 5, 433, 217, 2, 2748, 2749, 5, 45, 23, 2, 2749, 312, 3, 2, 2, 2, 2750, 2751, 5, 45, 23, 2, 2751, 2752, 5, 463, 232, 2, 2752, 2753, 5, 453, 227, 2, 2753, 2754, 5, 445, 223, 2, 2754, 2755, 5, 433, 217, 2, 2755, 2756, 5, 451, 226, 2, 2756, 2757, 5, 441, 221, 2, 2757, 2758, 5, 475, 238, 2, 2758, 2759, 5, 425, 213, 2, 2759, 2760, 5, 463, 232, 2, 2760, 2761, 5, 441, 221, 2, 2761, 2762, 5, 453, 227, 2, 2762, 2763, 5, 451, 226, 2, 2763, 2764, 7, 97, 2, 2, 2764, 2765, 5, 451, 226, 2, 2765, 2766, 5, 453, 227, 2, 2766, 2767, 5, 459, 230, 2, 2767, 2768, 5, 449, 225, 2, 2768, 2769, 5, 425, 213, 2, 2769, 2770, 5, 447, 224, 2, 2770, 2771, 5, 441, 221, 2, 2771, 2772, 5, 475, 238, 2, 2772, 2773, 5, 433, 217, 2, 2773, 2774, 7, 97, 2, 2, 2774, 2775, 5, 465, 233, 2, 2775, 2776, 5, 455, 228, 2, 2776, 2777, 5, 455, 228, 2, 2777, 2778, 5, 433, 217, 2, 2778, 2779, 5, 459, 230, 2, 2779, 2780, 5, 429, 215, 2, 2780, 2781, 5, 425, 213, 2, 2781, 2782, 5, 461, 231, 2, 2782, 2783, 5, 433, 217, 2, 2783, 2784, 5, 45, 23, 2, 2784, 314, 3, 2, 2, 2, 2785, 2786, 5, 45, 23, 2, 2786, 2787, 5, 451, 226, 2, 2787, 2788, 5, 453, 227, 2, 2788, 2789, 5, 459, 230, 2, 2789, 2790, 5, 449, 225, 2, 2790, 2791, 5, 425, 213, 2, 2791, 2792, 5, 447, 224, 2, 2792, 2793, 5, 441, 221, 2, 2793, 2794, 5, 475, 238, 2, 2794, 2795, 5, 433, 217, 2, 2795, 2796, 7, 97, 2, 2, 2796, 2797, 5, 447, 224, 2, 2797, 2798, 5, 453, 227, 2, 2798, 2799, 5, 469, 235, 2, 2799, 2800, 5, 433, 217, 2, 2800, 2801, 5, 459, 230, 2, 2801, 2802, 5, 429, 215, 2, 2802, 2803, 5, 425, 213, 2, 2803, 2804, 5, 461, 231, 2, 2804, 2805, 5, 433, 217, 2, 2805, 2806, 5, 45, 23, 2, 2806, 316, 3, 2, 2, 2, 2807, 2808, 5, 45, 23, 2, 2808, 2809, 5, 451, 226, 2, 2809, 2810, 5, 453, 227, 2, 2810, 2811, 5, 459, 230, 2, 2811, 2812, 5, 449, 225, 2, 2812, 2813, 5, 425, 213, 2, 2813, 2814, 5, 447, 224, 2, 2814, 2815, 5, 441, 221, 2, 2815, 2816, 5, 475, 238, 2, 2816, 2817, 5, 433, 217, 2, 2817, 2818, 7, 97, 2, 2, 2818, 2819, 5, 465, 233, 2, 2819, 2820, 5, 455, 228, 2, 2820, 2821, 5, 455, 228, 2, 2821, 2822, 5, 433, 217, 2, 2822, 2823, 5, 459, 230, 2, 2823, 2824, 5, 429, 215, 2, 2824, 2825, 5, 425, 213, 2, 2825, 2826, 5, 461, 231, 2, 2826, 2827, 5, 433, 217, 2, 2827, 2828, 5, 45, 23, 2, 2828, 318, 3, 2, 2, 2, 2829, 2830, 5, 45, 23, 2, 2830, 2831, 5, 449, 225, 2, 2831, 2832, 5, 453, 227, 2, 2832, 2833, 5, 431, 216, 2, 2833, 2834, 5, 433, 217, 2, 2834, 2835, 5, 45, 23, 2, 2835, 320, 3, 2, 2, 2, 2836, 2837, 5, 45, 23, 2, 2837, 2838, 5, 425, 213, 2, 2838, 2839, 5, 451, 226, 2, 2839, 2840, 5, 425, 213, 2, 2840, 2841, 5, 447, 224, 2, 2841, 2842, 5, 473, 237, 2, 2842, 2843, 5, 475, 238, 2, 2843, 2844, 5, 433, 217, 2, 2844, 2845, 5, 459, 230, 2, 2845, 2846, 7, 97, 2, 2, 2846, 2847, 5, 429, 215, 2, 2847, 2848, 5, 447, 224, 2, 2848, 2849, 5, 425, 213, 2, 2849, 2850, 5, 461, 231, 2, 2850, 2851, 5, 461, 231, 2, 2851, 2852, 5, 45, 23, 2, 2852, 322, 3, 2, 2, 2, 2853, 2854, 5, 45, 23, 2, 2854, 2855, 5, 461, 231, 2, 2855, 2856, 5, 463, 232, 2, 2856, 2857, 5, 453, 227, 2, 2857, 2858, 5, 459, 230, 2, 2858, 2859, 5, 425, 213, 2, 2859, 2860, 5, 437, 219, 2, 2860, 2861, 5, 433, 217, 2, 2861, 2862, 5, 425, 213, 2, 2862, 2863, 5, 463, 232, 2, 2863, 2864, 5, 463, 232, 2, 2864, 2865, 5, 425, 213, 2, 2865, 2866, 5, 429, 215, 2, 2866, 2867, 5, 439, 220, 2, 2867, 2868, 5, 433, 217, 2, 2868, 2869, 5, 431, 216, 2, 2869, 2870, 5, 441, 221, 2, 2870, 2871, 5, 451, 226, 2, 2871, 2872, 5, 431, 216, 2, 2872, 2873, 5, 433, 217, 2, 2873, 2874, 5, 471, 236, 2, 2874, 2875, 5, 45, 23, 2, 2875, 324, 3, 2, 2, 2, 2876, 2877, 5, 45, 23, 2, 2877, 2878, 5, 453, 227, 2, 2878, 2879, 5, 459, 230, 2, 2879, 2880, 5, 437, 219, 2, 2880, 2881, 5, 29, 15, 2, 2881, 2882, 5, 425, 213, 2, 2882, 2883, 5, 455, 228, 2, 2883, 2884, 5, 425, 213, 2, 2884, 2885, 5, 429, 215, 2, 2885, 2886, 5, 439, 220, 2, 2886, 2887, 5, 433, 217, 2, 2887, 2888, 5, 29, 15, 2, 2888, 2889, 5, 429, 215, 2, 2889, 2890, 5, 425, 213, 2, 2890, 2891, 5, 461, 231, 2, 2891, 2892, 5, 461, 231, 2, 2892, 2893, 5, 425, 213, 2, 2893, 2894, 5, 451, 226, 2, 2894, 2895, 5, 431, 216, 2, 2895, 2896, 5, 459, 230, 2, 2896, 2897, 5, 425, 213, 2, 2897, 2898, 5, 29, 15, 2, 2898, 2899, 5, 441, 221, 2, 2899, 2900, 5, 451, 226, 2, 2900, 2901, 5, 431, 216, 2, 2901, 2902, 5, 433, 217, 2, 2902, 2903, 5, 471, 236, 2, 2903, 2904, 5, 29, 15, 2, 2904, 2905, 5, 461, 231, 2, 2905, 2906, 5, 425, 213, 2, 2906, 2907, 5, 461, 231, 2, 2907, 2908, 5, 441, 221, 2, 2908, 2909, 5, 29, 15, 2, 2909, 2910, 5, 461, 231, 2, 2910, 2911, 5, 425, 213, 2, 2911, 2912, 5, 461, 231, 2, 2912, 2913, 5, 441, 221, 2, 2913, 2914, 5, 441, 221, 2, 2914, 2915, 5, 451, 226, 2, 2915, 2916, 5, 431, 216, 2, 2916, 2917, 5, 433, 217, 2, 2917, 2918, 5, 471, 236, 2, 2918, 2919, 5, 45, 23, 2, 2919, 326, 3, 2, 2, 2, 2920, 2921, 5, 45, 23, 2, 2921, 2922, 5, 429, 215, 2, 2922, 2923, 5, 453, 227, 2, 2923, 2924, 5, 449, 225, 2, 2924, 2925, 5, 29, 15, 2, 2925, 2926, 5, 431, 216, 2, 2926, 2927, 5, 425, 213, 2, 2927, 2928, 5, 463, 232, 2, 2928, 2929, 5, 425, 213, 2, 2929, 2930, 5, 461, 231, 2, 2930, 2931, 5, 463, 232, 2, 2931, 2932, 5, 425, 213, 2, 2932, 2933, 5, 471, 236, 2, 2933, 2934, 5, 29, 15, 2, 2934, 2935, 5, 427, 214, 2, 2935, 2936, 5, 431, 216, 2, 2936, 2937, 5, 455, 228, 2, 2937, 2938, 5, 29, 15, 2, 2938, 2939, 5, 461, 231, 2, 2939, 2940, 5, 433, 217, 2, 2940, 2941, 5, 425, 213, 2, 2941, 2942, 5, 459, 230, 2, 2942, 2943, 5, 429, 215, 2, 2943, 2944, 5, 439, 220, 2, 2944, 2945, 5, 29, 15, 2, 2945, 2946, 5, 461, 231, 2, 2946, 2947, 5, 453, 227, 2, 2947, 2948, 5, 447, 224, 2, 2948, 2949, 5, 459, 230, 2, 2949, 2950, 5, 29, 15, 2, 2950, 2951, 5, 429, 215, 2, 2951, 2952, 5, 457, 229, 2, 2952, 2953, 5, 447, 224, 2, 2953, 2954, 7, 53, 2, 2, 2954, 2955, 5, 461, 231, 2, 2955, 2956, 5, 453, 227, 2, 2956, 2957, 5, 447, 224, 2, 2957, 2958, 5, 459, 230, 2, 2958, 2959, 5, 461, 231, 2, 2959, 2960, 5, 433, 217, 2, 2960, 2961, 5, 429, 215, 2, 2961, 2962, 5, 453, 227, 2, 2962, 2963, 5, 451, 226, 2, 2963, 2964, 5, 431, 216, 2, 2964, 2965, 5, 425, 213, 2, 2965, 2966, 5, 459, 230, 2, 2966, 2967, 5, 473, 237, 2, 2967, 2968, 5, 441, 221, 2, 2968, 2969, 5, 451, 226, 2, 2969, 2970, 5, 431, 216, 2, 2970, 2971, 5, 433, 217, 2, 2971, 2972, 5, 471, 236, 2, 2972, 2973, 5, 45, 23, 2, 2973, 328, 3, 2, 2, 2, 2974, 2975, 5, 461, 231, 2, 2975, 2976, 5, 455, 228, 2, 2976, 2977, 5, 425, 213, 2, 2977, 2978, 5, 429, 215, 2, 2978, 2979, 5, 433, 217, 2, 2979, 2980, 5, 461, 231, 2, 2980, 2981, 5, 425, 213, 2, 2981, 2982, 5, 467, 234, 2, 2982, 2983, 5, 441, 221, 2, 2983, 2984, 5, 451, 226, 2, 2984, 2985, 5, 437, 219, 2, 2985, 2986, 5, 451, 226, 2, 2986, 2987, 5, 453, 227, 2, 2987, 2988, 5, 443, 222, 2, 2988, 2989, 5, 453, 227, 2, 2989, 2990, 5, 441, 221, 2, 2990, 2991, 5, 451, 226, 2, 2991, 330, 3, 2, 2, 2, 2992, 2993, 5, 461, 231, 2, 2993, 2994, 5, 455, 228, 2, 2994, 2995, 5, 425, 213, 2, 2995, 2996, 5, 429, 215, 2, 2996, 2997, 5, 433, 217, 2, 2997, 2998, 5, 461, 231, 2, 2998, 2999, 5, 425, 213, 2, 2999, 3000, 5, 467, 234, 2, 3000, 3001, 5, 441, 221, 2, 3001, 3002, 5, 451, 226, 2, 3002, 3003, 5, 437, 219, 2, 3003, 3004, 5, 425, 213, 2, 3004, 3005, 5, 447, 224, 2, 3005, 3006, 5, 447, 224, 2, 3006, 332, 3, 2, 2, 2, 3007, 3008, 5, 461, 231, 2, 3008, 3009, 5, 455, 228, 2, 3009, 3010, 5, 425, 213, 2, 3010, 3011, 5, 429, 215, 2, 3011, 3012, 5, 433, 217, 2, 3012, 3013, 5, 461, 231, 2, 3013, 3014, 5, 425, 213, 2, 3014, 3015, 5, 467, 234, 2, 3015, 3016, 5, 441, 221, 2, 3016, 3017, 5, 451, 226, 2, 3017, 3018, 5, 437, 219, 2, 3018, 3019, 5, 461, 231, 2, 3019, 3020, 5, 447, 224, 2, 3020, 3021, 5, 453, 227, 2, 3021, 3022, 5, 469, 235, 2, 3022, 3023, 5, 463, 232, 2, 3023, 3024, 5, 459, 230, 2, 3024, 3025, 5, 441, 221, 2, 3025, 3026, 5, 433, 217, 2, 3026, 3027, 5, 455, 228, 2, 3027, 3028, 5, 459, 230, 2, 3028, 3029, 5, 433, 217, 2, 3029, 3030, 5, 429, 215, 2, 3030, 3031, 5, 441, 221, 2, 3031, 3032, 5, 461, 231, 2, 3032, 3033, 5, 441, 221, 2, 3033, 3034, 5, 453, 227, 2, 3034, 3035, 5, 451, 226, 2, 3035, 334, 3, 2, 2, 2, 3036, 3037, 5, 461, 231, 2, 3037, 3038, 5, 455, 228, 2, 3038, 3039, 5, 425, 213, 2, 3039, 3040, 5, 429, 215, 2, 3040, 3041, 5, 433, 217, 2, 3041, 3042, 5, 461, 231, 2, 3042, 3043, 5, 425, 213, 2, 3043, 3044, 5, 467, 234, 2, 3044, 3045, 5, 441, 221, 2, 3045, 3046, 5, 451, 226, 2, 3046, 3047, 5, 437, 219, 2, 3047, 3048, 5, 451, 226, 2, 3048, 3049, 5, 453, 227, 2, 3049, 3050, 5, 463, 232, 2, 3050, 3051, 5, 433, 217, 2, 3051, 3052, 5, 471, 236, 2, 3052, 3053, 5, 463, 232, 2, 3053, 3054, 5, 435, 218, 2, 3054, 3055, 5, 441, 221, 2, 3055, 3056, 5, 433, 217, 2, 3056, 3057, 5, 447, 224, 2, 3057, 3058, 5, 431, 216, 2, 3058, 336, 3, 2, 2, 2, 3059, 3060, 5, 431, 216, 2, 3060, 3061, 5, 453, 227, 2, 3061, 3062, 5, 429, 215, 2, 3062, 3063, 5, 467, 234, 2, 3063, 3064, 5, 425, 213, 2, 3064, 3065, 5, 447, 224, 2, 3065, 3066, 5, 465, 233, 2, 3066, 3067, 5, 433, 217, 2, 3067, 3068, 5, 461, 231, 2, 3068, 338, 3, 2, 2, 2, 3069, 3070, 5, 429, 215, 2, 3070, 3071, 5, 453, 227, 2, 3071, 3072, 5, 455, 228, 2, 3072, 3073, 5, 473, 237, 2, 3073, 3074, 5, 435, 218, 2, 3074, 3075, 5, 441, 221, 2, 3075, 3076, 5, 433, 217, 2, 3076, 3077, 5, 447, 224, 2, 3077, 3078, 5, 431, 216, 2, 3078, 340, 3, 2, 2, 2, 3079, 3080, 5, 433, 217, 2, 3080, 3081, 5, 471, 236, 2, 3081, 3082, 5, 429, 215, 2, 3082, 3083, 5, 447, 224, 2, 3083, 3084, 5, 465, 233, 2, 3084, 3085, 5, 431, 216, 2, 3085, 3086, 5, 433, 217, 2, 3086, 3087, 5, 431, 216, 2, 3087, 342, 3, 2, 2, 2, 3088, 3089, 5, 441, 221, 2, 3089, 3090, 5, 451, 226, 2, 3090, 3091, 5, 431, 216, 2, 3091, 3092, 5, 433, 217, 2, 3092, 3093, 5, 471, 236, 2, 3093, 3094, 5, 433, 217, 2, 3094, 3095, 5, 431, 216, 2, 3095, 344, 3, 2, 2, 2, 3096, 3097, 5, 447, 224, 2, 3097, 3098, 5, 453, 227, 2, 3098, 3099, 5, 469, 235, 2, 3099, 3100, 5, 433, 217, 2, 3100, 3101, 5, 459, 230, 2, 3101, 3102, 5, 429, 215, 2, 3102, 3103, 5, 425, 213, 2, 3103, 3104, 5, 461, 231, 2, 3104, 3105, 5, 433, 217, 2, 3105, 346, 3, 2, 2, 2, 3106, 3107, 5, 429, 215, 2, 3107, 3108, 5, 453, 227, 2, 3108, 3109, 5, 447, 224, 2, 3109, 3110, 5, 465, 233, 2, 3110, 3111, 5, 449, 225, 2, 3111, 3112, 5, 451, 226, 2, 3112, 3113, 5, 461, 231, 2, 3113, 348, 3, 2, 2, 2, 3114, 3115, 5, 455, 228, 2, 3115, 3116, 5, 459, 230, 2, 3116, 3117, 5, 453, 227, 2, 3117, 3118, 5, 435, 218, 2, 3118, 3119, 5, 441, 221, 2, 3119, 3120, 5, 447, 224, 2, 3120, 3121, 5, 433, 217, 2, 3121, 3122, 5, 461, 231, 2, 3122, 350, 3, 2, 2, 2, 3123, 3124, 5, 429, 215, 2, 3124, 3125, 5, 453, 227, 2, 3125, 3126, 5, 451, 226, 2, 3126, 3127, 5, 435, 218, 2, 3127, 3128, 5, 441, 221, 2, 3128, 3129, 5, 437, 219, 2, 3129, 352, 3, 2, 2, 2, 3130, 3131, 5, 425, 213, 2, 3131, 3132, 5, 465, 233, 2, 3132, 3133, 5, 463, 232, 2, 3133, 3134, 5, 453, 227, 2, 3134, 3135, 5, 429, 215, 2, 3135, 3136, 5, 453, 227, 2, 3136, 3137, 5, 449, 225, 2, 3137, 3138, 5, 449, 225, 2, 3138, 3139, 5, 441, 221, 2, 3139, 3140, 5, 463, 232, 2, 3140, 3141, 5, 463, 232, 2, 3141, 3142, 5, 441, 221, 2, 3142, 3143, 5, 449, 225, 2, 3143, 3144, 5, 433, 217, 2, 3144, 354, 3, 2, 2, 2, 3145, 3146, 5, 431, 216, 2, 3146, 3147, 5, 433, 217, 2, 3147, 3148, 5, 435, 218, 2, 3148, 3149, 5, 425, 213, 2, 3149, 3150, 5, 465, 233, 2, 3150, 3151, 5, 447, 224, 2, 3151, 3152, 5, 463, 232, 2, 3152, 3153, 5, 457, 229, 2, 3153, 3154, 5, 465, 233, 2, 3154, 3155, 5, 433, 217, 2, 3155, 3156, 5, 459, 230, 2, 3156, 3157, 5, 473, 237, 2, 3157, 3158, 5, 435, 218, 2, 3158, 3159, 5, 441, 221, 2, 3159, 3160, 5, 433, 217, 2, 3160, 3161, 5, 447, 224, 2, 3161, 3162, 5, 431, 216, 2, 3162, 356, 3, 2, 2, 2, 3163, 3164, 5, 431, 216, 2, 3164, 3165, 5, 441, 221, 2, 3165, 3166, 5, 459, 230, 2, 3166, 3167, 5, 433, 217, 2, 3167, 3168, 5, 429, 215, 2, 3168, 3169, 5, 463, 232, 2, 3169, 3170, 5, 453, 227, 2, 3170, 3171, 5, 459, 230, 2, 3171, 3172, 5, 473, 237, 2, 3172, 3173, 5, 435, 218, 2, 3173, 3174, 5, 425, 213, 2, 3174, 3175, 5, 429, 215, 2, 3175, 3176, 5, 463, 232, 2, 3176, 3177, 5, 453, 227, 2, 3177, 3178, 5, 459, 230, 2, 3178, 3179, 5, 473, 237, 2, 3179, 358, 3, 2, 2, 2, 3180, 3181, 5, 435, 218, 2, 3181, 3182, 5, 441, 221, 2, 3182, 3183, 5, 447, 224, 2, 3183, 3184, 5, 463, 232, 2, 3184, 3185, 5, 433, 217, 2, 3185, 3186, 5, 459, 230, 2, 3186, 3187, 5, 429, 215, 2, 3187, 3188, 5, 425, 213, 2, 3188, 3189, 5, 429, 215, 2, 3189, 3190, 5, 439, 220, 2, 3190, 3191, 5, 433, 217, 2, 3191, 3192, 5, 447, 224, 2, 3192, 3193, 5, 453, 227, 2, 3193, 3194, 5, 469, 235, 2, 3194, 3195, 5, 469, 235, 2, 3195, 3196, 5, 425, 213, 2, 3196, 3197, 5, 463, 232, 2, 3197, 3198, 5, 433, 217, 2, 3198, 3199, 5, 459, 230, 2, 3199, 3200, 5, 449, 225, 2, 3200, 3201, 5, 425, 213, 2, 3201, 3202, 5, 459, 230, 2, 3202, 3203, 5, 445, 223, 2, 3203, 360, 3, 2, 2, 2, 3204, 3205, 5, 435, 218, 2, 3205, 3206, 5, 441, 221, 2, 3206, 3207, 5, 447, 224, 2, 3207, 3208, 5, 463, 232, 2, 3208, 3209, 5, 433, 217, 2, 3209, 3210, 5, 459, 230, 2, 3210, 3211, 5, 429, 215, 2, 3211, 3212, 5, 425, 213, 2, 3212, 3213, 5, 429, 215, 2, 3213, 3214, 5, 439, 220, 2, 3214, 3215, 5, 433, 217, 2, 3215, 3216, 5, 439, 220, 2, 3216, 3217, 5, 441, 221, 2, 3217, 3218, 5, 437, 219, 2, 3218, 3219, 5, 439, 220, 2, 3219, 3220, 5, 469, 235, 2, 3220, 3221, 5, 425, 213, 2, 3221, 3222, 5, 463, 232, 2, 3222, 3223, 5, 433, 217, 2, 3223, 3224, 5, 459, 230, 2, 3224, 3225, 5, 449, 225, 2, 3225, 3226, 5, 425, 213, 2, 3226, 3227, 5, 459, 230, 2, 3227, 3228, 5, 445, 223, 2, 3228, 362, 3, 2, 2, 2, 3229, 3230, 5, 431, 216, 2, 3230, 3231, 5, 441, 221, 2, 3231, 3232, 5, 459, 230, 2, 3232, 3233, 5, 433, 217, 2, 3233, 3234, 5, 429, 215, 2, 3234, 3235, 5, 463, 232, 2, 3235, 3236, 5, 453, 227, 2, 3236, 3237, 5, 459, 230, 2, 3237, 3238, 5, 473, 237, 2, 3238, 3239, 5, 435, 218, 2, 3239, 3240, 5, 425, 213, 2, 3240, 3241, 5, 429, 215, 2, 3241, 3242, 5, 463, 232, 2, 3242, 3243, 5, 453, 227, 2, 3243, 3244, 5, 459, 230, 2, 3244, 3245, 5, 473, 237, 2, 3245, 3246, 5, 429, 215, 2, 3246, 3247, 5, 447, 224, 2, 3247, 3248, 5, 425, 213, 2, 3248, 3249, 5, 461, 231, 2, 3249, 3250, 5, 461, 231, 2, 3250, 364, 3, 2, 2, 2, 3251, 3252, 5, 449, 225, 2, 3252, 3253, 5, 433, 217, 2, 3253, 3254, 5, 459, 230, 2, 3254, 3255, 5, 437, 219, 2, 3255, 3256, 5, 433, 217, 2, 3256, 3257, 5, 449, 225, 2, 3257, 3258, 5, 425, 213, 2, 3258, 3259, 5, 471, 236, 2, 3259, 3260, 5, 463, 232, 2, 3260, 3261, 5, 439, 220, 2, 3261, 3262, 5, 459, 230, 2, 3262, 3263, 5, 433, 217, 2, 3263, 3264, 5, 425, 213, 2, 3264, 3265, 5, 431, 216, 2, 3265, 3266, 5, 429, 215, 2, 3266, 3267, 5, 453, 227, 2, 3267, 3268, 5, 465, 233, 2, 3268, 3269, 5, 451, 226, 2, 3269, 3270, 5, 463, 232, 2, 3270, 366, 3, 2, 2, 2, 3271, 3272, 5, 449, 225, 2, 3272, 3273, 5, 433, 217, 2, 3273, 3274, 5, 459, 230, 2, 3274, 3275, 5, 437, 219, 2, 3275, 3276, 5, 433, 217, 2, 3276, 3277, 5, 449, 225, 2, 3277, 3278, 5, 425, 213, 2, 3278, 3279, 5, 471, 236, 2, 3279, 3280, 5, 449, 225, 2, 3280, 3281, 5, 433, 217, 2, 3281, 3282, 5, 459, 230, 2, 3282, 3283, 5, 437, 219, 2, 3283, 3284, 5, 433, 217, 2, 3284, 3285, 5, 429, 215, 2, 3285, 3286, 5, 453, 227, 2, 3286, 3287, 5, 465, 233, 2, 3287, 3288, 5, 451, 226, 2, 3288, 3289, 5, 463, 232, 2, 3289, 368, 3, 2, 2, 2, 3290, 3291, 5, 459, 230, 2, 3291, 3292, 5, 425, 213, 2, 3292, 3293, 5, 449, 225, 2, 3293, 3294, 5, 427, 214, 2, 3294, 3295, 5, 465, 233, 2, 3295, 3296, 5, 435, 218, 2, 3296, 3297, 5, 435, 218, 2, 3297, 3298, 5, 433, 217, 2, 3298, 3299, 5, 459, 230, 2, 3299, 3300, 5, 461, 231, 2, 3300, 3301, 5, 441, 221, 2, 3301, 3302, 5, 475, 238, 2, 3302, 3303, 5, 433, 217, 2, 3303, 370, 3, 2, 2, 2, 3304, 3305, 5, 459, 230, 2, 3305, 3306, 5, 433, 217, 2, 3306, 3307, 5, 425, 213, 2, 3307, 3308, 5, 447, 224, 2, 3308, 3309, 5, 463, 232, 2, 3309, 3310, 5, 441, 221, 2, 3310, 3311, 5, 449, 225, 2, 3311, 3312, 5, 433, 217, 2, 3312, 372, 3, 2, 2, 2, 3313, 3314, 5, 459, 230, 2, 3314, 3315, 5, 433, 217, 2, 3315, 3316, 5, 429, 215, 2, 3316, 3317, 5, 453, 227, 2, 3317, 3318, 5, 467, 234, 2, 3318, 3319, 5, 433, 217, 2, 3319, 3320, 5, 459, 230, 2, 3320, 3321, 5, 473, 237, 2, 3321, 374, 3, 2, 2, 2, 3322, 3323, 5, 459, 230, 2, 3323, 3324, 5, 433, 217, 2, 3324, 3325, 5, 441, 221, 2, 3325, 3326, 5, 451, 226, 2, 3326, 3327, 5, 431, 216, 2, 3327, 3328, 5, 433, 217, 2, 3328, 3329, 5, 471, 236, 2, 3329, 376, 3, 2, 2, 2, 3330, 3331, 5, 447, 224, 2, 3331, 3332, 5, 433, 217, 2, 3332, 3333, 5, 451, 226, 2, 3333, 3334, 5, 441, 221, 2, 3334, 3335, 5, 433, 217, 2, 3335, 3336, 5, 451, 226, 2, 3336, 3337, 5, 463, 232, 2, 3337, 378, 3, 2, 2, 2, 3338, 3339, 5, 45, 23, 2, 3339, 3340, 5, 461, 231, 2, 3340, 3341, 5, 463, 232, 2, 3341, 3342, 5, 425, 213, 2, 3342, 3343, 5, 451, 226, 2, 3343, 3344, 5, 431, 216, 2, 3344, 3345, 5, 425, 213, 2, 3345, 3346, 5, 459, 230, 2, 3346, 3347, 5, 431, 216, 2, 3347, 3348, 5, 45, 23, 2, 3348, 380, 3, 2, 2, 2, 3349, 3350, 5, 45, 23, 2, 3350, 3351, 5, 433, 217, 2, 3351, 3352, 5, 451, 226, 2, 3352, 3353, 5, 429, 215, 2, 3353, 3354, 5, 459, 230, 2, 3354, 3355, 5, 473, 237, 2, 3355, 3356, 5, 455, 228, 2, 3356, 3357, 5, 463, 232, 2, 3357, 3358, 5, 433, 217, 2, 3358, 3359, 5, 431, 216, 2, 3359, 3360, 5, 45, 23, 2, 3360, 382, 3, 2, 2, 2, 3361, 3362, 5, 427, 214, 2, 3362, 3363, 5, 441, 221, 2, 3363, 3364, 5, 437, 219, 2, 3364, 3365, 5, 441, 221, 2, 3365, 3366, 5, 451, 226, 2, 3366, 3367, 5, 463, 232, 2, 3367, 384, 3, 2, 2, 2, 3368, 3369, 5, 427, 214, 2, 3369, 3370, 5, 447, 224, 2, 3370, 3371, 5, 453, 227, 2, 3371, 3372, 5, 427, 214, 2, 3372, 386, 3, 2, 2, 2, 3373, 3374, 5, 427, 214, 2, 3374, 3375, 5, 453, 227, 2, 3375, 3376, 5, 453, 227, 2, 3376, 3377, 5, 447, 224, 2, 3377, 3378, 5, 433, 217, 2, 3378, 3379, 5, 425, 213, 2, 3379, 3380, 5, 451, 226, 2, 3380, 388, 3, 2, 2, 2, 3381, 3382, 5, 429, 215, 2, 3382, 3383, 5, 453, 227, 2, 3383, 3384, 5, 465, 233, 2, 3384, 3385, 5, 451, 226, 2, 3385, 3386, 5, 463, 232, 2, 3386, 3387, 5, 433, 217, 2, 3387, 3388, 5, 459, 230, 2, 3388, 390, 3, 2, 2, 2, 3389, 3390, 5, 431, 216, 2, 3390, 3391, 5, 425, 213, 2, 3391, 3392, 5, 463, 232, 2, 3392, 3393, 5, 433, 217, 2, 3393, 392, 3, 2, 2, 2, 3394, 3395, 5, 431, 216, 2, 3395, 3396, 5, 433, 217, 2, 3396, 3397, 5, 429, 215, 2, 3397, 3398, 5, 441, 221, 2, 3398, 3399, 5, 449, 225, 2, 3399, 3400, 5, 425, 213, 2, 3400, 3401, 5, 447, 224, 2, 3401, 394, 3, 2, 2, 2, 3402, 3403, 5, 431, 216, 2, 3403, 3404, 5, 453, 227, 2, 3404, 3405, 5, 465, 233, 2, 3405, 3406, 5, 427, 214, 2, 3406, 3407, 5, 447, 224, 2, 3407, 3408, 5, 433, 217, 2, 3408, 396, 3, 2, 2, 2, 3409, 3410, 5, 435, 218, 2, 3410, 3411, 5, 447, 224, 2, 3411, 3412, 5, 453, 227, 2, 3412, 3413, 5, 425, 213, 2, 3413, 3414, 5, 463, 232, 2, 3414, 398, 3, 2, 2, 2, 3415, 3416, 5, 435, 218, 2, 3416, 3417, 5, 459, 230, 2, 3417, 3418, 5, 453, 227, 2, 3418, 3419, 5, 475, 238, 2, 3419, 3420, 5, 433, 217, 2, 3420, 3421, 5, 451, 226, 2, 3421, 400, 3, 2, 2, 2, 3422, 3423, 5, 441, 221, 2, 3423, 3424, 5, 451, 226, 2, 3424, 3425, 5, 433, 217, 2, 3425, 3426, 5, 463, 232, 2, 3426, 402, 3, 2, 2, 2, 3427, 3428, 5, 441, 221, 2, 3428, 3429, 5, 451, 226, 2, 3429, 3430, 5, 463, 232, 2, 3430, 404, 3, 2, 2, 2, 3431, 3432, 5, 447, 224, 2, 3432, 3433, 5, 441, 221, 2, 3433, 3434, 5, 461, 231, 2, 3434, 3435, 5, 463, 232, 2, 3435, 406, 3, 2, 2, 2, 3436, 3437, 5, 449, 225, 2, 3437, 3438, 5, 425, 213, 2, 3438, 3439, 5, 455, 228, 2, 3439, 408, 3, 2, 2, 2, 3440, 3441, 5, 461, 231, 2, 3441, 3442, 5, 449, 225, 2, 3442, 3443, 5, 425, 213, 2, 3443, 3444, 5, 447, 224, 2, 3444, 3445, 5, 447, 224, 2, 3445, 3446, 5, 441, 221, 2, 3446, 3447, 5, 451, 226, 2, 3447, 3448, 5, 463, 232, 2, 3448, 410, 3, 2, 2, 2, 3449, 3450, 5, 463, 232, 2, 3450, 3451, 5, 433, 217, 2, 3451, 3452, 5, 471, 236, 2, 3452, 3453, 5, 463, 232, 2, 3453, 412, 3, 2, 2, 2, 3454, 3455, 5, 463, 232, 2, 3455, 3456, 5, 441, 221, 2, 3456, 3457, 5, 449, 225, 2, 3457, 3458, 5, 433, 217, 2, 3458, 3459, 5, 465, 233, 2, 3459, 3460, 5, 465, 233, 2, 3460, 3461, 5, 441, 221, 2, 3461, 3462, 5, 431, 216, 2, 3462, 414, 3, 2, 2, 2, 3463, 3464, 5, 463, 232, 2, 3464, 3465, 5, 441, 221, 2, 3465, 3466, 5, 449, 225, 2, 3466, 3467, 5, 433, 217, 2, 3467, 416, 3, 2, 2, 2, 3468, 3469, 5, 463, 232, 2, 3469, 3470, 5, 441, 221, 2, 3470, 3471, 5, 451, 226, 2, 3471, 3472, 5, 473, 237, 2, 3472, 3473, 5, 441, 221, 2, 3473, 3474, 5, 451, 226, 2, 3474, 3475, 5, 463, 232, 2, 3475, 418, 3, 2, 2, 2, 3476, 3477, 5, 463, 232, 2, 3477, 3478, 5, 465, 233, 2, 3478, 3479, 5, 455, 228, 2, 3479, 3480, 5, 447, 224, 2, 3480, 3481, 5, 433, 217, 2, 3481, 420, 3, 2, 2, 2, 3482, 3483, 5, 467, 234, 2, 3483, 3484, 5, 425, 213, 2, 3484, 3485, 5, 459, 230, 2, 3485, 3486, 5, 429, 215, 2, 3486, 3487, 5, 439, 220, 2, 3487, 3488, 5, 425, 213, 2, 3488, 3489, 5, 459, 230, 2, 3489, 422, 3, 2, 2, 2, 3490, 3491, 5, 467, 234, 2, 3491, 3492, 5, 425, 213, 2, 3492, 3493, 5, 459, 230, 2, 3493, 3494, 5, 441, 221, 2, 3494, 3495, 5, 451, 226, 2, 3495, 3496, 5, 463, 232, 2, 3496, 424, 3, 2, 2, 2, 3497, 3498, 9, 4, 2, 2, 3498, 426, 3, 2, 2, 2, 3499, 3500, 9, 5, 2, 2, 3500, 428, 3, 2, 2, 2, 3501, 3502, 9, 6, 2, 2, 3502, 430, 3, 2, 2, 2, 3503, 3504, 9, 7, 2, 2, 3504, 432, 3, 2, 2, 2, 3505, 3506, 9, 8, 2, 2, 3506, 434, 3, 2, 2, 2, 3507, 3508, 9, 9, 2, 2, 3508, 436, 3, 2, 2, 2, 3509, 3510, 9, 10, 2, 2, 3510, 438, 3, 2, 2, 2, 3511, 3512, 9, 11, 2, 2, 3512, 440, 3, 2, 2, 2, 3513, 3514, 9, 12, 2, 2, 3514, 442, 3, 2, 2, 2, 3515, 3516, 9, 13, 2, 2, 3516, 444, 3, 2, 2, 2, 3517, 3518, 9, 14, 2, 2, 3518, 446, 3, 2, 2, 2, 3519, 3520, 9, 15, 2, 2, 3520, 448, 3, 2, 2, 2, 3521, 3522, 9, 16, 2, 2, 3522, 450, 3, 2, 2, 2, 3523, 3524, 9, 17, 2, 2, 3524, 452, 3, 2, 2, 2, 3525, 3526, 9, 18, 2, 2, 3526, 454, 3, 2, 2, 2, 3527, 3528, 9, 19, 2, 2, 3528, 456, 3, 2, 2, 2, 3529, 3530, 9, 20, 2, 2, 3530, 458, 3, 2, 2, 2, 3531, 3532, 9, 21, 2, 2, 3532, 460, 3, 2, 2, 2, 3533, 3534, 9, 22, 2, 2, 3534, 462, 3, 2, 2, 2, 3535, 3536, 9, 23, 2, 2, 3536, 464, 3, 2, 2, 2, 3537, 3538, 9, 24, 2, 2, 3538, 466, 3, 2, 2, 2, 3539, 3540, 9, 25, 2, 2, 3540, 468, 3, 2, 2, 2, 3541, 3542, 9, 26, 2, 2, 3542, 470, 3, 2, 2, 2, 3543, 3544, 9, 27, 2, 2, 3544, 472, 3, 2, 2, 2, 3545, 3546, 9, 28, 2, 2, 3546, 474, 3, 2, 2, 2, 3547, 3548, 9, 29, 2, 2, 3548, 476, 3, 2, 2, 2, 3549, 3550, 7, 38, 2, 2, 3550, 3551, 7, 38, 2, 2, 3551, 478, 3, 2, 2, 2, 3552, 3553, 7, 38, 2, 2, 3553, 3554, 7, 38, 2, 2, 3554, 3560, 3, 2, 2, 2, 3555, 3559, 10, 30, 2, 2, 3556, 3557, 7, 38, 2, 2, 3557, 3559, 10, 30, 2, 2, 3558, 3555, 3, 2, 2, 2, 3558, 3556, 3, 2, 2, 2, 3559, 3562, 3, 2, 2, 2, 3560, 3558, 3, 2, 2, 2, 3560, 3561, 3, 2, 2, 2, 3561, 3563, 3, 2, 2, 2, 3562, 3560, 3, 2, 2, 2, 3563, 3564, 7, 38, 2, 2, 3564, 3565, 7, 38, 2, 2, 3565, 480, 3, 2, 2, 2, 3566, 3567, 9, 31, 2, 2, 3567, 3568, 9, 31, 2, 2, 3568, 3569, 9, 31, 2, 2, 3569, 3570, 9, 31, 2, 2, 3570, 482, 3, 2, 2, 2, 3571, 3575, 9, 32, 2, 2, 3572, 3574, 9, 33, 2, 2, 3573, 3572, 3, 2, 2, 2, 3574, 3577, 3, 2, 2, 2, 3575, 3573, 3, 2, 2, 2, 3575, 3576, 3, 2, 2, 2, 3576, 3586, 3, 2, 2, 2, 3577, 3575, 3, 2, 2, 2, 3578, 3580, 7, 36, 2, 2, 3579, 3581, 10, 34, 2, 2, 3580, 3579, 3, 2, 2, 2, 3581, 3582, 3, 2, 2, 2, 3582, 3580, 3, 2, 2, 2, 3582, 3583, 3, 2, 2, 2, 3583, 3584, 3, 2, 2, 2, 3584, 3586, 7, 36, 2, 2, 3585, 3571, 3, 2, 2, 2, 3585, 3578, 3, 2, 2, 2, 3586, 484, 3, 2, 2, 2, 3587, 3595, 7, 41, 2, 2, 3588, 3589, 7, 94, 2, 2, 3589, 3594, 11, 2, 2, 2, 3590, 3591, 7, 41, 2, 2, 3591, 3594, 7, 41, 2, 2, 3592, 3594, 10, 35, 2, 2, 3593, 3588, 3, 2, 2, 2, 3593, 3590, 3, 2, 2, 2, 3593, 3592, 3, 2, 2, 2, 3594, 3597, 3, 2, 2, 2, 3595, 3593, 3, 2, 2, 2, 3595, 3596, 3, 2, 2, 2, 3596, 3598, 3, 2, 2, 2, 3597, 3595, 3, 2, 2, 2, 3598, 3599, 7, 41, 2, 2, 3599, 486, 3, 2, 2, 2, 3600, 3601, 5, 479, 240, 2, 3601, 488, 3, 2, 2, 2, 3602, 3603, 5, 485, 243, 2, 3603, 490, 3, 2, 2, 2, 3604, 3606, 5, 505, 253, 2, 3605, 3604, 3, 2, 2, 2, 3606, 3607, 3, 2, 2, 2, 3607, 3605, 3, 2, 2, 2, 3607, 3608, 3, 2, 2, 2, 3608, 492, 3, 2, 2, 2, 3609, 3611, 5, 41, 21, 2, 3610, 3609, 3, 2, 2, 2, 3610, 3611, 3, 2, 2, 2, 3611, 3613, 3, 2, 2, 2, 3612, 3614, 9, 36, 2, 2, 3613, 3612, 3, 2, 2, 2, 3614, 3615, 3, 2, 2, 2, 3615, 3613, 3, 2, 2, 2, 3615, 3616, 3, 2, 2, 2, 3616, 3623, 3, 2, 2, 2, 3617, 3619, 5, 29, 15, 2, 3618, 3620, 9, 36, 2, 2, 3619, 3618, 3, 2, 2, 2, 3620, 3621, 3, 2, 2, 2, 3621, 3619, 3, 2, 2, 2, 3621, 3622, 3, 2, 2, 2, 3622, 3624, 3, 2, 2, 2, 3623, 3617, 3, 2, 2, 2, 3623, 3624, 3, 2, 2, 2, 3624, 494, 3, 2, 2, 2, 3625, 3626, 7, 90, 2, 2, 3626, 3630, 7, 41, 2, 2, 3627, 3628, 5, 503, 252, 2, 3628, 3629, 5, 503, 252, 2, 3629, 3631, 3, 2, 2, 2, 3630, 3627, 3, 2, 2, 2, 3631, 3632, 3, 2, 2, 2, 3632, 3630, 3, 2, 2, 2, 3632, 3633, 3, 2, 2, 2, 3633, 3634, 3, 2, 2, 2, 3634, 3635, 7, 41, 2, 2, 3635, 3645, 3, 2, 2, 2, 3636, 3637, 7, 50, 2, 2, 3637, 3638, 7, 90, 2, 2, 3638, 3640, 3, 2, 2, 2, 3639, 3641, 5, 503, 252, 2, 3640, 3639, 3, 2, 2, 2, 3641, 3642, 3, 2, 2, 2, 3642, 3640, 3, 2, 2, 2, 3642, 3643, 3, 2, 2, 2, 3643, 3645, 3, 2, 2, 2, 3644, 3625, 3, 2, 2, 2, 3644, 3636, 3, 2, 2, 2, 3645, 496, 3, 2, 2, 2, 3646, 3648, 5, 505, 253, 2, 3647, 3646, 3, 2, 2, 2, 3648, 3649, 3, 2, 2, 2, 3649, 3647, 3, 2, 2, 2, 3649, 3650, 3, 2, 2, 2, 3650, 3652, 3, 2, 2, 2, 3651, 3647, 3, 2, 2, 2, 3651, 3652, 3, 2, 2, 2, 3652, 3653, 3, 2, 2, 2, 3653, 3655, 7, 48, 2, 2, 3654, 3656, 5, 505, 253, 2, 3655, 3654, 3, 2, 2, 2, 3656, 3657, 3, 2, 2, 2, 3657, 3655, 3, 2, 2, 2, 3657, 3658, 3, 2, 2, 2, 3658, 3690, 3, 2, 2, 2, 3659, 3661, 5, 505, 253, 2, 3660, 3659, 3, 2, 2, 2, 3661, 3662, 3, 2, 2, 2, 3662, 3660, 3, 2, 2, 2, 3662, 3663, 3, 2, 2, 2, 3663, 3664, 3, 2, 2, 2, 3664, 3665, 7, 48, 2, 2, 3665, 3666, 5, 507, 254, 2, 3666, 3690, 3, 2, 2, 2, 3667, 3669, 5, 505, 253, 2, 3668, 3667, 3, 2, 2, 2, 3669, 3670, 3, 2, 2, 2, 3670, 3668, 3, 2, 2, 2, 3670, 3671, 3, 2, 2, 2, 3671, 3673, 3, 2, 2, 2, 3672, 3668, 3, 2, 2, 2, 3672, 3673, 3, 2, 2, 2, 3673, 3674, 3, 2, 2, 2, 3674, 3676, 7, 48, 2, 2, 3675, 3677, 5, 505, 253, 2, 3676, 3675, 3, 2, 2, 2, 3677, 3678, 3, 2, 2, 2, 3678, 3676, 3, 2, 2, 2, 3678, 3679, 3, 2, 2, 2, 3679, 3680, 3, 2, 2, 2, 3680, 3681, 5, 507, 254, 2, 3681, 3690, 3, 2, 2, 2, 3682, 3684, 5, 505, 253, 2, 3683, 3682, 3, 2, 2, 2, 3684, 3685, 3, 2, 2, 2, 3685, 3683, 3, 2, 2, 2, 3685, 3686, 3, 2, 2, 2, 3686, 3687, 3, 2, 2, 2, 3687, 3688, 5, 507, 254, 2, 3688, 3690, 3, 2, 2, 2, 3689, 3651, 3, 2, 2, 2, 3689, 3660, 3, 2, 2, 2, 3689, 3672, 3, 2, 2, 2, 3689, 3683, 3, 2, 2, 2, 3690, 498, 3, 2, 2, 2, 3691, 3692, 5, 483, 242, 2, 3692, 500, 3, 2, 2, 2, 3693, 3694, 5, 481, 241, 2, 3694, 3695, 5, 481, 241, 2, 3695, 3696, 7, 47, 2, 2, 3696, 3697, 5, 481, 241, 2, 3697, 3698, 7, 47, 2, 2, 3698, 3699, 5, 481, 241, 2, 3699, 3700, 7, 47, 2, 2, 3700, 3701, 5, 481, 241, 2, 3701, 3702, 7, 47, 2, 2, 3702, 3703, 5, 481, 241, 2, 3703, 3704, 5, 481, 241, 2, 3704, 3705, 5, 481, 241, 2, 3705, 502, 3, 2, 2, 2, 3706, 3707, 9, 37, 2, 2, 3707, 504, 3, 2, 2, 2, 3708, 3709, 9, 36, 2, 2, 3709, 506, 3, 2, 2, 2, 3710, 3712, 7, 71, 2, 2, 3711, 3713, 7, 47, 2, 2, 3712, 3711, 3, 2, 2, 2, 3712, 3713, 3, 2, 2, 2, 3713, 3715, 3, 2, 2, 2, 3714, 3716, 5, 505, 253, 2, 3715, 3714, 3, 2, 2, 2, 3716, 3717, 3, 2, 2, 2, 3717, 3715, 3, 2, 2, 2, 3717, 3718, 3, 2, 2, 2, 3718, 508, 3, 2, 2, 2, 3719, 3720, 7, 63, 2, 2, 3720, 510, 3, 2, 2, 2, 3721, 3722, 7, 62, 2, 2, 3722, 512, 3, 2, 2, 2, 3723, 3724, 7, 64, 2, 2, 3724, 514, 3, 2, 2, 2, 3725, 3726, 7, 64, 2, 2, 3726, 3727, 7, 63, 2, 2, 3727, 516, 3, 2, 2, 2, 3728, 3729, 7, 62, 2, 2, 3729, 3730, 7, 63, 2, 2, 3730, 518, 3, 2, 2, 2, 3731, 3732, 5, 509, 255, 2, 3732, 520, 3, 2, 2, 2, 3733, 3734, 5, 511, 256, 2, 3734, 522, 3, 2, 2, 2, 3735, 3736, 5, 513, 257, 2, 3736, 524, 3, 2, 2, 2, 3737, 3738, 5, 517, 259, 2, 3738, 526, 3, 2, 2, 2, 3739, 3740, 5, 515, 258, 2, 3740, 528, 3, 2, 2, 2, 3741, 3742, 5, 465, 233, 2, 3742, 3743, 5, 461, 231, 2, 3743, 3744, 5, 433, 217, 2, 3744, 3745, 5, 459, 230, 2, 3745, 3746, 5, 461, 231, 2, 3746, 3753, 3, 2, 2, 2, 3747, 3748, 7, 87, 2, 2, 3748, 3749, 7, 85, 2, 2, 3749, 3750, 7, 71, 2, 2, 3750, 3751, 7, 84, 2, 2, 3751, 3753, 7, 85, 2, 2, 3752, 3741, 3, 2, 2, 2, 3752, 3747, 3, 2, 2, 2, 3753, 530, 3, 2, 2, 2, 3754, 3755, 5, 467, 234, 2, 3755, 3756, 5, 433, 217, 2, 3756, 3757, 5, 429, 215, 2, 3757, 3758, 5, 463, 232, 2, 3758, 3759, 5, 453, 227, 2, 3759, 3760, 5, 459, 230, 2, 3760, 3768, 3, 2, 2, 2, 3761, 3762, 7, 88, 2, 2, 3762, 3763, 7, 71, 2, 2, 3763, 3764, 7, 69, 2, 2, 3764, 3765, 7, 86, 2, 2, 3765, 3766, 7, 81, 2, 2, 3766, 3768, 7, 84, 2, 2, 3767, 3754, 3, 2, 2, 2, 3767, 3761, 3, 2, 2, 2, 3768, 532, 3, 2, 2, 2, 165, 2, 554, 565, 578, 592, 597, 601, 605, 611, 615, 617, 647, 668, 677, 690, 703, 712, 721, 734, 741, 750, 771, 784, 797, 804, 819, 842, 869, 886, 911, 930, 945, 960, 975, 990, 1001, 1020, 1039, 1050, 1081, 1106, 1123, 1140, 1155, 1176, 1197, 1218, 1229, 1240, 1259, 1280, 1293, 1300, 1307, 1320, 1339, 1358, 1371, 1386, 1397, 1404, 1415, 1424, 1435, 1454, 1475, 1494, 1507, 1520, 1541, 1568, 1583, 1596, 1623, 1638, 1647, 1672, 1697, 1706, 1717, 1724, 1731, 1740, 1757, 1764, 1777, 1798, 1817, 1826, 1849, 1874, 1891, 1906, 1921, 1938, 1963, 1980, 1995, 2006, 2019, 2038, 2049, 2063, 2078, 2093, 2102, 2115, 2130, 2147, 2160, 2181, 2194, 2207, 2228, 2235, 2248, 2265, 2283, 2302, 2311, 2320, 2331, 2350, 2365, 2374, 2385, 2398, 2409, 2424, 2435, 2448, 2459, 2480, 2496, 2569, 3558, 3560, 3575, 3582, 3585, 3593, 3595, 3607, 3610, 3615, 3621, 3623, 3632, 3642, 3644, 3649, 3651, 3657, 3662, 3670, 3672, 3678, 3685, 3689, 3712, 3717, 3752, 3767, 3, 2, 3, 2] \ No newline at end of file diff --git a/reverse_engineering/parser/CqlLexer.js b/reverse_engineering/parser/CqlLexer.js deleted file mode 100644 index db1d5325..00000000 --- a/reverse_engineering/parser/CqlLexer.js +++ /dev/null @@ -1,3261 +0,0 @@ -// Generated from grammars/CqlLexer.g4 by ANTLR 4.9.2 -// jshint ignore: start -var antlr4 = require("antlr4/index"); - -const serializedATN = [ - "\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786", - "\u5964\u0002\u00e4\u0eb9\b\u0001\u0004\u0002\t\u0002\u0004\u0003\t\u0003", - "\u0004\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007", - "\t\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004", - "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010", - "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013", - "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017", - "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a", - "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e", - '\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004"\t"\u0004#', - "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004'\t'\u0004(\t(\u0004)\t)\u0004", - "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004", - "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004", - "8\t8\u00049\t9\u0004:\t:\u0004;\t;\u0004<\t<\u0004=\t=\u0004>\t>\u0004", - "?\t?\u0004@\t@\u0004A\tA\u0004B\tB\u0004C\tC\u0004D\tD\u0004E\tE\u0004", - "F\tF\u0004G\tG\u0004H\tH\u0004I\tI\u0004J\tJ\u0004K\tK\u0004L\tL\u0004", - "M\tM\u0004N\tN\u0004O\tO\u0004P\tP\u0004Q\tQ\u0004R\tR\u0004S\tS\u0004", - "T\tT\u0004U\tU\u0004V\tV\u0004W\tW\u0004X\tX\u0004Y\tY\u0004Z\tZ\u0004", - "[\t[\u0004\\\t\\\u0004]\t]\u0004^\t^\u0004_\t_\u0004`\t`\u0004a\ta\u0004", - "b\tb\u0004c\tc\u0004d\td\u0004e\te\u0004f\tf\u0004g\tg\u0004h\th\u0004", - "i\ti\u0004j\tj\u0004k\tk\u0004l\tl\u0004m\tm\u0004n\tn\u0004o\to\u0004", - "p\tp\u0004q\tq\u0004r\tr\u0004s\ts\u0004t\tt\u0004u\tu\u0004v\tv\u0004", - "w\tw\u0004x\tx\u0004y\ty\u0004z\tz\u0004{\t{\u0004|\t|\u0004}\t}\u0004", - "~\t~\u0004\u007f\t\u007f\u0004\u0080\t\u0080\u0004\u0081\t\u0081\u0004", - "\u0082\t\u0082\u0004\u0083\t\u0083\u0004\u0084\t\u0084\u0004\u0085\t", - "\u0085\u0004\u0086\t\u0086\u0004\u0087\t\u0087\u0004\u0088\t\u0088\u0004", - "\u0089\t\u0089\u0004\u008a\t\u008a\u0004\u008b\t\u008b\u0004\u008c\t", - "\u008c\u0004\u008d\t\u008d\u0004\u008e\t\u008e\u0004\u008f\t\u008f\u0004", - "\u0090\t\u0090\u0004\u0091\t\u0091\u0004\u0092\t\u0092\u0004\u0093\t", - "\u0093\u0004\u0094\t\u0094\u0004\u0095\t\u0095\u0004\u0096\t\u0096\u0004", - "\u0097\t\u0097\u0004\u0098\t\u0098\u0004\u0099\t\u0099\u0004\u009a\t", - "\u009a\u0004\u009b\t\u009b\u0004\u009c\t\u009c\u0004\u009d\t\u009d\u0004", - "\u009e\t\u009e\u0004\u009f\t\u009f\u0004\u00a0\t\u00a0\u0004\u00a1\t", - "\u00a1\u0004\u00a2\t\u00a2\u0004\u00a3\t\u00a3\u0004\u00a4\t\u00a4\u0004", - "\u00a5\t\u00a5\u0004\u00a6\t\u00a6\u0004\u00a7\t\u00a7\u0004\u00a8\t", - "\u00a8\u0004\u00a9\t\u00a9\u0004\u00aa\t\u00aa\u0004\u00ab\t\u00ab\u0004", - "\u00ac\t\u00ac\u0004\u00ad\t\u00ad\u0004\u00ae\t\u00ae\u0004\u00af\t", - "\u00af\u0004\u00b0\t\u00b0\u0004\u00b1\t\u00b1\u0004\u00b2\t\u00b2\u0004", - "\u00b3\t\u00b3\u0004\u00b4\t\u00b4\u0004\u00b5\t\u00b5\u0004\u00b6\t", - "\u00b6\u0004\u00b7\t\u00b7\u0004\u00b8\t\u00b8\u0004\u00b9\t\u00b9\u0004", - "\u00ba\t\u00ba\u0004\u00bb\t\u00bb\u0004\u00bc\t\u00bc\u0004\u00bd\t", - "\u00bd\u0004\u00be\t\u00be\u0004\u00bf\t\u00bf\u0004\u00c0\t\u00c0\u0004", - "\u00c1\t\u00c1\u0004\u00c2\t\u00c2\u0004\u00c3\t\u00c3\u0004\u00c4\t", - "\u00c4\u0004\u00c5\t\u00c5\u0004\u00c6\t\u00c6\u0004\u00c7\t\u00c7\u0004", - "\u00c8\t\u00c8\u0004\u00c9\t\u00c9\u0004\u00ca\t\u00ca\u0004\u00cb\t", - "\u00cb\u0004\u00cc\t\u00cc\u0004\u00cd\t\u00cd\u0004\u00ce\t\u00ce\u0004", - "\u00cf\t\u00cf\u0004\u00d0\t\u00d0\u0004\u00d1\t\u00d1\u0004\u00d2\t", - "\u00d2\u0004\u00d3\t\u00d3\u0004\u00d4\t\u00d4\u0004\u00d5\t\u00d5\u0004", - "\u00d6\t\u00d6\u0004\u00d7\t\u00d7\u0004\u00d8\t\u00d8\u0004\u00d9\t", - "\u00d9\u0004\u00da\t\u00da\u0004\u00db\t\u00db\u0004\u00dc\t\u00dc\u0004", - "\u00dd\t\u00dd\u0004\u00de\t\u00de\u0004\u00df\t\u00df\u0004\u00e0\t", - "\u00e0\u0004\u00e1\t\u00e1\u0004\u00e2\t\u00e2\u0004\u00e3\t\u00e3\u0004", - "\u00e4\t\u00e4\u0004\u00e5\t\u00e5\u0004\u00e6\t\u00e6\u0004\u00e7\t", - "\u00e7\u0004\u00e8\t\u00e8\u0004\u00e9\t\u00e9\u0004\u00ea\t\u00ea\u0004", - "\u00eb\t\u00eb\u0004\u00ec\t\u00ec\u0004\u00ed\t\u00ed\u0004\u00ee\t", - "\u00ee\u0004\u00ef\t\u00ef\u0004\u00f0\t\u00f0\u0004\u00f1\t\u00f1\u0004", - "\u00f2\t\u00f2\u0004\u00f3\t\u00f3\u0004\u00f4\t\u00f4\u0004\u00f5\t", - "\u00f5\u0004\u00f6\t\u00f6\u0004\u00f7\t\u00f7\u0004\u00f8\t\u00f8\u0004", - "\u00f9\t\u00f9\u0004\u00fa\t\u00fa\u0004\u00fb\t\u00fb\u0004\u00fc\t", - "\u00fc\u0004\u00fd\t\u00fd\u0004\u00fe\t\u00fe\u0004\u00ff\t\u00ff\u0004", - "\u0100\t\u0100\u0004\u0101\t\u0101\u0004\u0102\t\u0102\u0004\u0103\t", - "\u0103\u0004\u0104\t\u0104\u0004\u0105\t\u0105\u0004\u0106\t\u0106\u0004", - "\u0107\t\u0107\u0004\u0108\t\u0108\u0004\u0109\t\u0109\u0004\u010a\t", - "\u010a\u0003\u0002\u0003\u0002\u0003\u0003\u0003\u0003\u0003\u0004\u0003", - "\u0004\u0003\u0005\u0003\u0005\u0003\u0006\u0003\u0006\u0003\u0007\u0003", - "\u0007\u0003\b\u0003\b\u0003\t\u0003\t\u0003\n\u0003\n\u0003\u000b\u0006", - "\u000b\u0229\n\u000b\r\u000b\u000e\u000b\u022a\u0003\u000b\u0003\u000b", - "\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0006\f\u0234\n\f\r\f\u000e", - "\f\u0235\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\r\u0003\r\u0003", - "\r\u0003\r\u0007\r\u0241\n\r\f\r\u000e\r\u0244\u000b\r\u0003\r\u0003", - "\r\u0003\r\u0003\r\u0003\r\u0003\u000e\u0003\u000e\u0003\u000e\u0003", - "\u000e\u0003\u000e\u0003\u000e\u0005\u000e\u0251\n\u000e\u0003\u000e", - "\u0007\u000e\u0254\n\u000e\f\u000e\u000e\u000e\u0257\u000b\u000e\u0003", - "\u000e\u0005\u000e\u025a\n\u000e\u0003\u000e\u0003\u000e\u0005\u000e", - "\u025e\n\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0005", - "\u000e\u0264\n\u000e\u0003\u000e\u0003\u000e\u0005\u000e\u0268\n\u000e", - "\u0005\u000e\u026a\n\u000e\u0003\u000e\u0003\u000e\u0003\u000f\u0003", - "\u000f\u0003\u0010\u0003\u0010\u0003\u0011\u0003\u0011\u0003\u0012\u0003", - "\u0012\u0003\u0013\u0003\u0013\u0003\u0014\u0003\u0014\u0003\u0014\u0003", - "\u0015\u0003\u0015\u0003\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003", - "\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003", - "\u0018\u0005\u0018\u0288\n\u0018\u0003\u0019\u0003\u0019\u0003\u0019", - "\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019", - "\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019", - "\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0005\u0019\u029d\n", - "\u0019\u0003\u001a\u0003\u001a\u0003\u001a\u0003\u001a\u0003\u001a\u0003", - "\u001a\u0003\u001a\u0005\u001a\u02a6\n\u001a\u0003\u001b\u0003\u001b", - "\u0003\u001b\u0003\u001b\u0003\u001b\u0003\u001b\u0003\u001b\u0003\u001b", - "\u0003\u001b\u0003\u001b\u0003\u001b\u0005\u001b\u02b3\n\u001b\u0003", - "\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0003", - "\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0005\u001c\u02c0", - "\n\u001c\u0003\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003\u001d", - "\u0003\u001d\u0003\u001d\u0005\u001d\u02c9\n\u001d\u0003\u001e\u0003", - "\u001e\u0003\u001e\u0003\u001e\u0003\u001e\u0003\u001e\u0003\u001e\u0005", - "\u001e\u02d2\n\u001e\u0003\u001f\u0003\u001f\u0003\u001f\u0003\u001f", - "\u0003\u001f\u0003\u001f\u0003\u001f\u0003\u001f\u0003\u001f\u0003\u001f", - "\u0003\u001f\u0005\u001f\u02df\n\u001f\u0003 \u0003 \u0003 \u0003 \u0003", - " \u0005 \u02e6\n \u0003!\u0003!\u0003!\u0003!\u0003!\u0003!\u0003!\u0005", - '!\u02ef\n!\u0003"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003', - '"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003"\u0003', - '"\u0003"\u0003"\u0005"\u0304\n"\u0003#\u0003#\u0003#\u0003#\u0003', - "#\u0003#\u0003#\u0003#\u0003#\u0003#\u0003#\u0005#\u0311\n#\u0003$\u0003", - "$\u0003$\u0003$\u0003$\u0003$\u0003$\u0003$\u0003$\u0003$\u0003$\u0005", - "$\u031e\n$\u0003%\u0003%\u0003%\u0003%\u0003%\u0005%\u0325\n%\u0003", - "&\u0003&\u0003&\u0003&\u0003&\u0003&\u0003&\u0003&\u0003&\u0003&\u0003", - "&\u0003&\u0003&\u0005&\u0334\n&\u0003'\u0003'\u0003'\u0003'\u0003", - "'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003", - "'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003'\u0003'\u0005'\u034b", - "\n'\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(", - "\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003", - "(\u0003(\u0003(\u0003(\u0003(\u0003(\u0003(\u0005(\u0366\n(\u0003)\u0003", - ")\u0003)\u0003)\u0003)\u0003)\u0003)\u0003)\u0003)\u0003)\u0003)\u0003", - ")\u0003)\u0003)\u0003)\u0005)\u0377\n)\u0003*\u0003*\u0003*\u0003*\u0003", - "*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003", - "*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0003*\u0005*\u0390", - "\n*\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003", - "+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0003+\u0005+\u03a3\n+\u0003", - ",\u0003,\u0003,\u0003,\u0003,\u0003,\u0003,\u0003,\u0003,\u0003,\u0003", - ",\u0003,\u0003,\u0005,\u03b2\n,\u0003-\u0003-\u0003-\u0003-\u0003-\u0003", - "-\u0003-\u0003-\u0003-\u0003-\u0003-\u0003-\u0003-\u0005-\u03c1\n-\u0003", - ".\u0003.\u0003.\u0003.\u0003.\u0003.\u0003.\u0003.\u0003.\u0003.\u0003", - ".\u0003.\u0003.\u0005.\u03d0\n.\u0003/\u0003/\u0003/\u0003/\u0003/\u0003", - "/\u0003/\u0003/\u0003/\u0003/\u0003/\u0003/\u0003/\u0005/\u03df\n/\u0003", - "0\u00030\u00030\u00030\u00030\u00030\u00030\u00030\u00030\u00050\u03ea", - "\n0\u00031\u00031\u00031\u00031\u00031\u00031\u00031\u00031\u00031\u0003", - "1\u00031\u00031\u00031\u00031\u00031\u00031\u00031\u00051\u03fd\n1\u0003", - "2\u00032\u00032\u00032\u00032\u00032\u00032\u00032\u00032\u00032\u0003", - "2\u00032\u00032\u00032\u00032\u00032\u00032\u00052\u0410\n2\u00033\u0003", - "3\u00033\u00033\u00033\u00033\u00033\u00033\u00033\u00053\u041b\n3\u0003", - "4\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u0003", - "4\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u0003", - "4\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00034\u00054\u043a", - "\n4\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u0003", - "5\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u00035\u0003", - "5\u00035\u00035\u00035\u00055\u0453\n5\u00036\u00036\u00036\u00036\u0003", - "6\u00036\u00036\u00036\u00036\u00036\u00036\u00036\u00036\u00036\u0003", - "6\u00056\u0464\n6\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u0003", - "7\u00037\u00037\u00037\u00037\u00037\u00037\u00037\u00057\u0475\n7\u0003", - "8\u00038\u00038\u00038\u00038\u00038\u00038\u00038\u00038\u00038\u0003", - "8\u00038\u00038\u00058\u0484\n8\u00039\u00039\u00039\u00039\u00039\u0003", - "9\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u0003", - "9\u00039\u00039\u00039\u00059\u0499\n9\u0003:\u0003:\u0003:\u0003:\u0003", - ":\u0003:\u0003:\u0003:\u0003:\u0003:\u0003:\u0003:\u0003:\u0003:\u0003", - ":\u0003:\u0003:\u0003:\u0003:\u0005:\u04ae\n:\u0003;\u0003;\u0003;\u0003", - ";\u0003;\u0003;\u0003;\u0003;\u0003;\u0003;\u0003;\u0003;\u0003;\u0003", - ";\u0003;\u0003;\u0003;\u0003;\u0003;\u0005;\u04c3\n;\u0003<\u0003<\u0003", - "<\u0003<\u0003<\u0003<\u0003<\u0003<\u0003<\u0005<\u04ce\n<\u0003=\u0003", - "=\u0003=\u0003=\u0003=\u0003=\u0003=\u0003=\u0003=\u0005=\u04d9\n=\u0003", - ">\u0003>\u0003>\u0003>\u0003>\u0003>\u0003>\u0003>\u0003>\u0003>\u0003", - ">\u0003>\u0003>\u0003>\u0003>\u0003>\u0003>\u0005>\u04ec\n>\u0003?\u0003", - "?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003", - "?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0003?\u0005?\u0501\n?\u0003", - "@\u0003@\u0003@\u0003@\u0003@\u0003@\u0003@\u0003@\u0003@\u0003@\u0003", - "@\u0005@\u050e\n@\u0003A\u0003A\u0003A\u0003A\u0003A\u0005A\u0515\n", - "A\u0003B\u0003B\u0003B\u0003B\u0003B\u0005B\u051c\nB\u0003C\u0003C\u0003", - "C\u0003C\u0003C\u0003C\u0003C\u0003C\u0003C\u0003C\u0003C\u0005C\u0529", - "\nC\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003", - "D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0003D\u0005D\u053c\nD\u0003", - "E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003", - "E\u0003E\u0003E\u0003E\u0003E\u0003E\u0003E\u0005E\u054f\nE\u0003F\u0003", - "F\u0003F\u0003F\u0003F\u0003F\u0003F\u0003F\u0003F\u0003F\u0003F\u0005", - "F\u055c\nF\u0003G\u0003G\u0003G\u0003G\u0003G\u0003G\u0003G\u0003G\u0003", - "G\u0003G\u0003G\u0003G\u0003G\u0005G\u056b\nG\u0003H\u0003H\u0003H\u0003", - "H\u0003H\u0003H\u0003H\u0003H\u0003H\u0005H\u0576\nH\u0003I\u0003I\u0003", - "I\u0003I\u0003I\u0005I\u057d\nI\u0003J\u0003J\u0003J\u0003J\u0003J\u0003", - "J\u0003J\u0003J\u0003J\u0005J\u0588\nJ\u0003K\u0003K\u0003K\u0003K\u0003", - "K\u0003K\u0003K\u0005K\u0591\nK\u0003L\u0003L\u0003L\u0003L\u0003L\u0003", - "L\u0003L\u0003L\u0003L\u0005L\u059c\nL\u0003M\u0003M\u0003M\u0003M\u0003", - "M\u0003M\u0003M\u0003M\u0003M\u0003M\u0003M\u0003M\u0003M\u0003M\u0003", - "M\u0003M\u0003M\u0005M\u05af\nM\u0003N\u0003N\u0003N\u0003N\u0003N\u0003", - "N\u0003N\u0003N\u0003N\u0003N\u0003N\u0003N\u0003N\u0003N\u0003N\u0003", - "N\u0003N\u0003N\u0003N\u0005N\u05c4\nN\u0003O\u0003O\u0003O\u0003O\u0003", - "O\u0003O\u0003O\u0003O\u0003O\u0003O\u0003O\u0003O\u0003O\u0003O\u0003", - "O\u0003O\u0003O\u0005O\u05d7\nO\u0003P\u0003P\u0003P\u0003P\u0003P\u0003", - "P\u0003P\u0003P\u0003P\u0003P\u0003P\u0005P\u05e4\nP\u0003Q\u0003Q\u0003", - "Q\u0003Q\u0003Q\u0003Q\u0003Q\u0003Q\u0003Q\u0003Q\u0003Q\u0005Q\u05f1", - "\nQ\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003", - "R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0003R\u0005", - "R\u0606\nR\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003", - "S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003", - "S\u0003S\u0003S\u0003S\u0003S\u0003S\u0003S\u0005S\u0621\nS\u0003T\u0003", - "T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003", - "T\u0003T\u0005T\u0630\nT\u0003U\u0003U\u0003U\u0003U\u0003U\u0003U\u0003", - "U\u0003U\u0003U\u0003U\u0003U\u0005U\u063d\nU\u0003V\u0003V\u0003V\u0003", - "V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003", - "V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003V\u0003", - "V\u0003V\u0005V\u0658\nV\u0003W\u0003W\u0003W\u0003W\u0003W\u0003W\u0003", - "W\u0003W\u0003W\u0003W\u0003W\u0003W\u0003W\u0005W\u0667\nW\u0003X\u0003", - "X\u0003X\u0003X\u0003X\u0003X\u0003X\u0005X\u0670\nX\u0003Y\u0003Y\u0003", - "Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003", - "Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003Y\u0003", - "Y\u0005Y\u0689\nY\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003", - "Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003", - "Z\u0003Z\u0003Z\u0003Z\u0003Z\u0003Z\u0005Z\u06a2\nZ\u0003[\u0003[\u0003", - "[\u0003[\u0003[\u0003[\u0003[\u0005[\u06ab\n[\u0003\\\u0003\\\u0003", - "\\\u0003\\\u0003\\\u0003\\\u0003\\\u0003\\\u0003\\\u0005\\\u06b6\n\\", - "\u0003]\u0003]\u0003]\u0003]\u0003]\u0005]\u06bd\n]\u0003^\u0003^\u0003", - "^\u0003^\u0003^\u0005^\u06c4\n^\u0003_\u0003_\u0003_\u0003_\u0003_\u0003", - "_\u0003_\u0005_\u06cd\n_\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003", - "`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0005`\u06de", - "\n`\u0003a\u0003a\u0003a\u0003a\u0003a\u0005a\u06e5\na\u0003b\u0003", - "b\u0003b\u0003b\u0003b\u0003b\u0003b\u0003b\u0003b\u0003b\u0003b\u0005", - "b\u06f2\nb\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003", - "c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003c\u0003", - "c\u0005c\u0707\nc\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003", - "d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0003d\u0005", - "d\u071a\nd\u0003e\u0003e\u0003e\u0003e\u0003e\u0003e\u0003e\u0005e\u0723", - "\ne\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003", - "f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003f\u0003", - "f\u0003f\u0005f\u073a\nf\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003", - "g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003", - "g\u0003g\u0003g\u0003g\u0003g\u0003g\u0003g\u0005g\u0753\ng\u0003h\u0003", - "h\u0003h\u0003h\u0003h\u0003h\u0003h\u0003h\u0003h\u0003h\u0003h\u0003", - "h\u0003h\u0003h\u0003h\u0005h\u0764\nh\u0003i\u0003i\u0003i\u0003i\u0003", - "i\u0003i\u0003i\u0003i\u0003i\u0003i\u0003i\u0003i\u0003i\u0005i\u0773", - "\ni\u0003j\u0003j\u0003j\u0003j\u0003j\u0003j\u0003j\u0003j\u0003j\u0003", - "j\u0003j\u0003j\u0003j\u0005j\u0782\nj\u0003k\u0003k\u0003k\u0003k\u0003", - "k\u0003k\u0003k\u0003k\u0003k\u0003k\u0003k\u0003k\u0003k\u0003k\u0003", - "k\u0005k\u0793\nk\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003", - "l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003l\u0003", - "l\u0003l\u0003l\u0003l\u0003l\u0003l\u0005l\u07ac\nl\u0003m\u0003m\u0003", - "m\u0003m\u0003m\u0003m\u0003m\u0003m\u0003m\u0003m\u0003m\u0003m\u0003", - "m\u0003m\u0003m\u0005m\u07bd\nm\u0003n\u0003n\u0003n\u0003n\u0003n\u0003", - "n\u0003n\u0003n\u0003n\u0003n\u0003n\u0003n\u0003n\u0005n\u07cc\nn\u0003", - "o\u0003o\u0003o\u0003o\u0003o\u0003o\u0003o\u0003o\u0003o\u0005o\u07d7", - "\no\u0003p\u0003p\u0003p\u0003p\u0003p\u0003p\u0003p\u0003p\u0003p\u0003", - "p\u0003p\u0005p\u07e4\np\u0003q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003", - "q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003q\u0003", - "q\u0005q\u07f7\nq\u0003r\u0003r\u0003r\u0003r\u0003r\u0003r\u0003r\u0003", - "r\u0003r\u0005r\u0802\nr\u0003s\u0003s\u0003s\u0003s\u0003s\u0003s\u0003", - "s\u0003s\u0003s\u0003s\u0003s\u0003s\u0005s\u0810\ns\u0003t\u0003t\u0003", - "t\u0003t\u0003t\u0003t\u0003t\u0003t\u0003t\u0003t\u0003t\u0003t\u0003", - "t\u0005t\u081f\nt\u0003u\u0003u\u0003u\u0003u\u0003u\u0003u\u0003u\u0003", - "u\u0003u\u0003u\u0003u\u0003u\u0003u\u0005u\u082e\nu\u0003v\u0003v\u0003", - "v\u0003v\u0003v\u0003v\u0003v\u0005v\u0837\nv\u0003w\u0003w\u0003w\u0003", - "w\u0003w\u0003w\u0003w\u0003w\u0003w\u0003w\u0003w\u0005w\u0844\nw\u0003", - "x\u0003x\u0003x\u0003x\u0003x\u0003x\u0003x\u0003x\u0003x\u0003x\u0003", - "x\u0003x\u0003x\u0005x\u0853\nx\u0003y\u0003y\u0003y\u0003y\u0003y\u0003", - "y\u0003y\u0003y\u0003y\u0003y\u0003y\u0003y\u0003y\u0003y\u0003y\u0005", - "y\u0864\ny\u0003z\u0003z\u0003z\u0003z\u0003z\u0003z\u0003z\u0003z\u0003", - "z\u0003z\u0003z\u0005z\u0871\nz\u0003{\u0003{\u0003{\u0003{\u0003{\u0003", - "{\u0003{\u0003{\u0003{\u0003{\u0003{\u0003{\u0003{\u0003{\u0003{\u0003", - "{\u0003{\u0003{\u0003{\u0005{\u0886\n{\u0003|\u0003|\u0003|\u0003|\u0003", - "|\u0003|\u0003|\u0003|\u0003|\u0003|\u0003|\u0005|\u0893\n|\u0003}\u0003", - "}\u0003}\u0003}\u0003}\u0003}\u0003}\u0003}\u0003}\u0003}\u0003}\u0005", - "}\u08a0\n}\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0005~\u08b5\n~\u0003\u007f\u0003\u007f\u0003\u007f\u0003\u007f\u0003", - "\u007f\u0005\u007f\u08bc\n\u007f\u0003\u0080\u0003\u0080\u0003\u0080", - "\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080", - "\u0003\u0080\u0003\u0080\u0005\u0080\u08c9\n\u0080\u0003\u0081\u0003", - "\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003", - "\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003", - "\u0081\u0003\u0081\u0005\u0081\u08da\n\u0081\u0003\u0082\u0003\u0082", - "\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082", - "\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082", - "\u0003\u0082\u0003\u0082\u0005\u0082\u08ec\n\u0082\u0003\u0083\u0003", - "\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003", - "\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0003", - "\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0005\u0083\u08ff\n\u0083", - "\u0003\u0084\u0003\u0084\u0003\u0084\u0003\u0084\u0003\u0084\u0003\u0084", - "\u0003\u0084\u0005\u0084\u0908\n\u0084\u0003\u0085\u0003\u0085\u0003", - "\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0005\u0085\u0911", - "\n\u0085\u0003\u0086\u0003\u0086\u0003\u0086\u0003\u0086\u0003\u0086", - "\u0003\u0086\u0003\u0086\u0003\u0086\u0003\u0086\u0005\u0086\u091c\n", - "\u0086\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003", - "\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003", - "\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0003\u0087\u0005", - "\u0087\u092f\n\u0087\u0003\u0088\u0003\u0088\u0003\u0088\u0003\u0088", - "\u0003\u0088\u0003\u0088\u0003\u0088\u0003\u0088\u0003\u0088\u0003\u0088", - "\u0003\u0088\u0003\u0088\u0003\u0088\u0005\u0088\u093e\n\u0088\u0003", - "\u0089\u0003\u0089\u0003\u0089\u0003\u0089\u0003\u0089\u0003\u0089\u0003", - "\u0089\u0005\u0089\u0947\n\u0089\u0003\u008a\u0003\u008a\u0003\u008a", - "\u0003\u008a\u0003\u008a\u0003\u008a\u0003\u008a\u0003\u008a\u0003\u008a", - "\u0005\u008a\u0952\n\u008a\u0003\u008b\u0003\u008b\u0003\u008b\u0003", - "\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003", - "\u008b\u0003\u008b\u0005\u008b\u095f\n\u008b\u0003\u008c\u0003\u008c", - "\u0003\u008c\u0003\u008c\u0003\u008c\u0003\u008c\u0003\u008c\u0003\u008c", - "\u0003\u008c\u0005\u008c\u096a\n\u008c\u0003\u008d\u0003\u008d\u0003", - "\u008d\u0003\u008d\u0003\u008d\u0003\u008d\u0003\u008d\u0003\u008d\u0003", - "\u008d\u0003\u008d\u0003\u008d\u0003\u008d\u0003\u008d\u0005\u008d\u0979", - "\n\u008d\u0003\u008e\u0003\u008e\u0003\u008e\u0003\u008e\u0003\u008e", - "\u0003\u008e\u0003\u008e\u0003\u008e\u0003\u008e\u0005\u008e\u0984\n", - "\u008e\u0003\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0003", - "\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0005", - "\u008f\u0991\n\u008f\u0003\u0090\u0003\u0090\u0003\u0090\u0003\u0090", - "\u0003\u0090\u0003\u0090\u0003\u0090\u0003\u0090\u0003\u0090\u0005\u0090", - "\u099c\n\u0090\u0003\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003", - "\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003", - "\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003\u0091\u0003", - "\u0091\u0003\u0091\u0003\u0091\u0005\u0091\u09b1\n\u0091\u0003\u0092", - "\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092", - "\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0092", - "\u0003\u0092\u0005\u0092\u09c1\n\u0092\u0003\u0093\u0003\u0093\u0003", - "\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003", - "\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003\u0093\u0003", - "\u0093\u0003\u0093\u0003\u0093\u0003\u0094\u0003\u0094\u0003\u0094\u0003", - "\u0094\u0003\u0094\u0003\u0094\u0003\u0094\u0003\u0094\u0003\u0094\u0003", - "\u0094\u0003\u0094\u0003\u0094\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0095\u0005\u0095\u0a0a\n\u0095\u0003\u0096", - "\u0003\u0096\u0003\u0096\u0003\u0096\u0003\u0096\u0003\u0096\u0003\u0096", - "\u0003\u0096\u0003\u0096\u0003\u0096\u0003\u0096\u0003\u0097\u0003\u0097", - "\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0097", - "\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098", - "\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0098\u0003\u0099", - "\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099", - "\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099", - "\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099", - "\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099", - "\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099\u0003\u0099", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b", - "\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b", - "\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b", - "\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009b\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009e\u0003\u009e\u0003\u009e", - "\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e", - "\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e", - "\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e", - "\u0003\u009e\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f", - "\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f", - "\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f", - "\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u00a0", - "\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0003\u00a0", - "\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1", - "\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1", - "\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a2", - "\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2", - "\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2", - "\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2", - "\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a2\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3\u0003\u00a3", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4\u0003\u00a4", - "\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5", - "\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5", - "\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5\u0003\u00a5", - "\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6", - "\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a6", - "\u0003\u00a6\u0003\u00a6\u0003\u00a6\u0003\u00a7\u0003\u00a7\u0003\u00a7", - "\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7", - "\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7", - "\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7", - "\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7\u0003\u00a7", - "\u0003\u00a7\u0003\u00a7\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8", - "\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8", - "\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8", - "\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8", - "\u0003\u00a8\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9", - "\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00aa", - "\u0003\u00aa\u0003\u00aa\u0003\u00aa\u0003\u00aa\u0003\u00aa\u0003\u00aa", - "\u0003\u00aa\u0003\u00aa\u0003\u00aa\u0003\u00ab\u0003\u00ab\u0003\u00ab", - "\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab", - "\u0003\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ac", - "\u0003\u00ac\u0003\u00ac\u0003\u00ad\u0003\u00ad\u0003\u00ad\u0003\u00ad", - "\u0003\u00ad\u0003\u00ad\u0003\u00ad\u0003\u00ad\u0003\u00ad\u0003\u00ad", - "\u0003\u00ae\u0003\u00ae\u0003\u00ae\u0003\u00ae\u0003\u00ae\u0003\u00ae", - "\u0003\u00ae\u0003\u00ae\u0003\u00af\u0003\u00af\u0003\u00af\u0003\u00af", - "\u0003\u00af\u0003\u00af\u0003\u00af\u0003\u00af\u0003\u00af\u0003\u00b0", - "\u0003\u00b0\u0003\u00b0\u0003\u00b0\u0003\u00b0\u0003\u00b0\u0003\u00b0", - "\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1", - "\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b1", - "\u0003\u00b1\u0003\u00b1\u0003\u00b1\u0003\u00b2\u0003\u00b2\u0003\u00b2", - "\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2", - "\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b2", - "\u0003\u00b2\u0003\u00b2\u0003\u00b2\u0003\u00b3\u0003\u00b3\u0003\u00b3", - "\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3", - "\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3\u0003\u00b3", - "\u0003\u00b3\u0003\u00b3\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4", - "\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4", - "\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4", - "\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4\u0003\u00b4", - "\u0003\u00b4\u0003\u00b4\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5", - "\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5", - "\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5", - "\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b5", - "\u0003\u00b5\u0003\u00b5\u0003\u00b5\u0003\u00b6\u0003\u00b6\u0003\u00b6", - "\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6", - "\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6", - "\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6\u0003\u00b6", - "\u0003\u00b6\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7", - "\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7", - "\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b7", - "\u0003\u00b7\u0003\u00b7\u0003\u00b7\u0003\u00b8\u0003\u00b8\u0003\u00b8", - "\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8", - "\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8", - "\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b8\u0003\u00b9\u0003\u00b9", - "\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9", - "\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00b9", - "\u0003\u00ba\u0003\u00ba\u0003\u00ba\u0003\u00ba\u0003\u00ba\u0003\u00ba", - "\u0003\u00ba\u0003\u00ba\u0003\u00ba\u0003\u00bb\u0003\u00bb\u0003\u00bb", - "\u0003\u00bb\u0003\u00bb\u0003\u00bb\u0003\u00bb\u0003\u00bb\u0003\u00bb", - "\u0003\u00bc\u0003\u00bc\u0003\u00bc\u0003\u00bc\u0003\u00bc\u0003\u00bc", - "\u0003\u00bc\u0003\u00bc\u0003\u00bd\u0003\u00bd\u0003\u00bd\u0003\u00bd", - "\u0003\u00bd\u0003\u00bd\u0003\u00bd\u0003\u00bd\u0003\u00be\u0003\u00be", - "\u0003\u00be\u0003\u00be\u0003\u00be\u0003\u00be\u0003\u00be\u0003\u00be", - "\u0003\u00be\u0003\u00be\u0003\u00be\u0003\u00bf\u0003\u00bf\u0003\u00bf", - "\u0003\u00bf\u0003\u00bf\u0003\u00bf\u0003\u00bf\u0003\u00bf\u0003\u00bf", - "\u0003\u00bf\u0003\u00bf\u0003\u00bf\u0003\u00c0\u0003\u00c0\u0003\u00c0", - "\u0003\u00c0\u0003\u00c0\u0003\u00c0\u0003\u00c0\u0003\u00c1\u0003\u00c1", - "\u0003\u00c1\u0003\u00c1\u0003\u00c1\u0003\u00c2\u0003\u00c2\u0003\u00c2", - "\u0003\u00c2\u0003\u00c2\u0003\u00c2\u0003\u00c2\u0003\u00c2\u0003\u00c3", - "\u0003\u00c3\u0003\u00c3\u0003\u00c3\u0003\u00c3\u0003\u00c3\u0003\u00c3", - "\u0003\u00c3\u0003\u00c4\u0003\u00c4\u0003\u00c4\u0003\u00c4\u0003\u00c4", - "\u0003\u00c5\u0003\u00c5\u0003\u00c5\u0003\u00c5\u0003\u00c5\u0003\u00c5", - "\u0003\u00c5\u0003\u00c5\u0003\u00c6\u0003\u00c6\u0003\u00c6\u0003\u00c6", - "\u0003\u00c6\u0003\u00c6\u0003\u00c6\u0003\u00c7\u0003\u00c7\u0003\u00c7", - "\u0003\u00c7\u0003\u00c7\u0003\u00c7\u0003\u00c8\u0003\u00c8\u0003\u00c8", - "\u0003\u00c8\u0003\u00c8\u0003\u00c8\u0003\u00c8\u0003\u00c9\u0003\u00c9", - "\u0003\u00c9\u0003\u00c9\u0003\u00c9\u0003\u00ca\u0003\u00ca\u0003\u00ca", - "\u0003\u00ca\u0003\u00cb\u0003\u00cb\u0003\u00cb\u0003\u00cb\u0003\u00cb", - "\u0003\u00cc\u0003\u00cc\u0003\u00cc\u0003\u00cc\u0003\u00cd\u0003\u00cd", - "\u0003\u00cd\u0003\u00cd\u0003\u00cd\u0003\u00cd\u0003\u00cd\u0003\u00cd", - "\u0003\u00cd\u0003\u00ce\u0003\u00ce\u0003\u00ce\u0003\u00ce\u0003\u00ce", - "\u0003\u00cf\u0003\u00cf\u0003\u00cf\u0003\u00cf\u0003\u00cf\u0003\u00cf", - "\u0003\u00cf\u0003\u00cf\u0003\u00cf\u0003\u00d0\u0003\u00d0\u0003\u00d0", - "\u0003\u00d0\u0003\u00d0\u0003\u00d1\u0003\u00d1\u0003\u00d1\u0003\u00d1", - "\u0003\u00d1\u0003\u00d1\u0003\u00d1\u0003\u00d1\u0003\u00d2\u0003\u00d2", - "\u0003\u00d2\u0003\u00d2\u0003\u00d2\u0003\u00d2\u0003\u00d3\u0003\u00d3", - "\u0003\u00d3\u0003\u00d3\u0003\u00d3\u0003\u00d3\u0003\u00d3\u0003\u00d3", - "\u0003\u00d4\u0003\u00d4\u0003\u00d4\u0003\u00d4\u0003\u00d4\u0003\u00d4", - "\u0003\u00d4\u0003\u00d5\u0003\u00d5\u0003\u00d6\u0003\u00d6\u0003\u00d7", - "\u0003\u00d7\u0003\u00d8\u0003\u00d8\u0003\u00d9\u0003\u00d9\u0003\u00da", - "\u0003\u00da\u0003\u00db\u0003\u00db\u0003\u00dc\u0003\u00dc\u0003\u00dd", - "\u0003\u00dd\u0003\u00de\u0003\u00de\u0003\u00df\u0003\u00df\u0003\u00e0", - "\u0003\u00e0\u0003\u00e1\u0003\u00e1\u0003\u00e2\u0003\u00e2\u0003\u00e3", - "\u0003\u00e3\u0003\u00e4\u0003\u00e4\u0003\u00e5\u0003\u00e5\u0003\u00e6", - "\u0003\u00e6\u0003\u00e7\u0003\u00e7\u0003\u00e8\u0003\u00e8\u0003\u00e9", - "\u0003\u00e9\u0003\u00ea\u0003\u00ea\u0003\u00eb\u0003\u00eb\u0003\u00ec", - "\u0003\u00ec\u0003\u00ed\u0003\u00ed\u0003\u00ee\u0003\u00ee\u0003\u00ef", - "\u0003\u00ef\u0003\u00ef\u0003\u00f0\u0003\u00f0\u0003\u00f0\u0003\u00f0", - "\u0003\u00f0\u0003\u00f0\u0007\u00f0\u0de7\n\u00f0\f\u00f0\u000e\u00f0", - "\u0dea\u000b\u00f0\u0003\u00f0\u0003\u00f0\u0003\u00f0\u0003\u00f1\u0003", - "\u00f1\u0003\u00f1\u0003\u00f1\u0003\u00f1\u0003\u00f2\u0003\u00f2\u0007", - "\u00f2\u0df6\n\u00f2\f\u00f2\u000e\u00f2\u0df9\u000b\u00f2\u0003\u00f2", - "\u0003\u00f2\u0006\u00f2\u0dfd\n\u00f2\r\u00f2\u000e\u00f2\u0dfe\u0003", - "\u00f2\u0005\u00f2\u0e02\n\u00f2\u0003\u00f3\u0003\u00f3\u0003\u00f3", - "\u0003\u00f3\u0003\u00f3\u0003\u00f3\u0007\u00f3\u0e0a\n\u00f3\f\u00f3", - "\u000e\u00f3\u0e0d\u000b\u00f3\u0003\u00f3\u0003\u00f3\u0003\u00f4\u0003", - "\u00f4\u0003\u00f5\u0003\u00f5\u0003\u00f6\u0006\u00f6\u0e16\n\u00f6", - "\r\u00f6\u000e\u00f6\u0e17\u0003\u00f7\u0005\u00f7\u0e1b\n\u00f7\u0003", - "\u00f7\u0006\u00f7\u0e1e\n\u00f7\r\u00f7\u000e\u00f7\u0e1f\u0003\u00f7", - "\u0003\u00f7\u0006\u00f7\u0e24\n\u00f7\r\u00f7\u000e\u00f7\u0e25\u0005", - "\u00f7\u0e28\n\u00f7\u0003\u00f8\u0003\u00f8\u0003\u00f8\u0003\u00f8", - "\u0003\u00f8\u0006\u00f8\u0e2f\n\u00f8\r\u00f8\u000e\u00f8\u0e30\u0003", - "\u00f8\u0003\u00f8\u0003\u00f8\u0003\u00f8\u0003\u00f8\u0003\u00f8\u0006", - "\u00f8\u0e39\n\u00f8\r\u00f8\u000e\u00f8\u0e3a\u0005\u00f8\u0e3d\n\u00f8", - "\u0003\u00f9\u0006\u00f9\u0e40\n\u00f9\r\u00f9\u000e\u00f9\u0e41\u0005", - "\u00f9\u0e44\n\u00f9\u0003\u00f9\u0003\u00f9\u0006\u00f9\u0e48\n\u00f9", - "\r\u00f9\u000e\u00f9\u0e49\u0003\u00f9\u0006\u00f9\u0e4d\n\u00f9\r\u00f9", - "\u000e\u00f9\u0e4e\u0003\u00f9\u0003\u00f9\u0003\u00f9\u0003\u00f9\u0006", - "\u00f9\u0e55\n\u00f9\r\u00f9\u000e\u00f9\u0e56\u0005\u00f9\u0e59\n\u00f9", - "\u0003\u00f9\u0003\u00f9\u0006\u00f9\u0e5d\n\u00f9\r\u00f9\u000e\u00f9", - "\u0e5e\u0003\u00f9\u0003\u00f9\u0003\u00f9\u0006\u00f9\u0e64\n\u00f9", - "\r\u00f9\u000e\u00f9\u0e65\u0003\u00f9\u0003\u00f9\u0005\u00f9\u0e6a", - "\n\u00f9\u0003\u00fa\u0003\u00fa\u0003\u00fb\u0003\u00fb\u0003\u00fb", - "\u0003\u00fb\u0003\u00fb\u0003\u00fb\u0003\u00fb\u0003\u00fb\u0003\u00fb", - "\u0003\u00fb\u0003\u00fb\u0003\u00fb\u0003\u00fb\u0003\u00fc\u0003\u00fc", - "\u0003\u00fd\u0003\u00fd\u0003\u00fe\u0003\u00fe\u0005\u00fe\u0e81\n", - "\u00fe\u0003\u00fe\u0006\u00fe\u0e84\n\u00fe\r\u00fe\u000e\u00fe\u0e85", - "\u0003\u00ff\u0003\u00ff\u0003\u0100\u0003\u0100\u0003\u0101\u0003\u0101", - "\u0003\u0102\u0003\u0102\u0003\u0102\u0003\u0103\u0003\u0103\u0003\u0103", - "\u0003\u0104\u0003\u0104\u0003\u0105\u0003\u0105\u0003\u0106\u0003\u0106", - "\u0003\u0107\u0003\u0107\u0003\u0108\u0003\u0108\u0003\u0109\u0003\u0109", - "\u0003\u0109\u0003\u0109\u0003\u0109\u0003\u0109\u0003\u0109\u0003\u0109", - "\u0003\u0109\u0003\u0109\u0003\u0109\u0005\u0109\u0ea9\n\u0109\u0003", - "\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003", - "\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003\u010a\u0003", - "\u010a\u0005\u010a\u0eb8\n\u010a\u0004\u0235\u0242\u0002\u010b\u0003", - "\u0003\u0005\u0004\u0007\u0005\t\u0006\u000b\u0007\r\b\u000f\t\u0011", - "\n\u0013\u000b\u0015\f\u0017\r\u0019\u000e\u001b\u000f\u001d\u0010\u001f", - "\u0011!\u0012#\u0013%\u0014'\u0015)\u0016+\u0017-\u0018/\u00191\u001a", - "3\u001b5\u001c7\u001d9\u001e;\u001f= ?!A\"C#E$G%I&K'M(O)Q*S+U,W-Y.", - "[/]0_1a2c3e4g5i6k7m8o9q:s;u{?}@\u007fA\u0081B\u0083C\u0085D\u0087", - "E\u0089F\u008bG\u008dH\u008fI\u0091J\u0093K\u0095L\u0097M\u0099N\u009b", - "O\u009dP\u009fQ\u00a1R\u00a3S\u00a5T\u00a7U\u00a9V\u00abW\u00adX\u00af", - "Y\u00b1Z\u00b3[\u00b5\\\u00b7]\u00b9^\u00bb_\u00bd`\u00bfa\u00c1b\u00c3", - "c\u00c5d\u00c7e\u00c9f\u00cbg\u00cdh\u00cfi\u00d1j\u00d3k\u00d5l\u00d7", - "m\u00d9n\u00dbo\u00ddp\u00dfq\u00e1r\u00e3s\u00e5t\u00e7u\u00e9v\u00eb", - "w\u00edx\u00efy\u00f1z\u00f3{\u00f5|\u00f7}\u00f9~\u00fb\u007f\u00fd", - "\u0080\u00ff\u0081\u0101\u0082\u0103\u0083\u0105\u0084\u0107\u0085\u0109", - "\u0086\u010b\u0087\u010d\u0088\u010f\u0089\u0111\u008a\u0113\u008b\u0115", - "\u008c\u0117\u008d\u0119\u008e\u011b\u008f\u011d\u0090\u011f\u0091\u0121", - "\u0092\u0123\u0093\u0125\u0094\u0127\u0095\u0129\u0096\u012b\u0097\u012d", - "\u0098\u012f\u0099\u0131\u009a\u0133\u009b\u0135\u009c\u0137\u009d\u0139", - "\u009e\u013b\u009f\u013d\u00a0\u013f\u00a1\u0141\u00a2\u0143\u00a3\u0145", - "\u00a4\u0147\u00a5\u0149\u00a6\u014b\u00a7\u014d\u00a8\u014f\u00a9\u0151", - "\u00aa\u0153\u00ab\u0155\u00ac\u0157\u00ad\u0159\u00ae\u015b\u00af\u015d", - "\u00b0\u015f\u00b1\u0161\u00b2\u0163\u00b3\u0165\u00b4\u0167\u00b5\u0169", - "\u00b6\u016b\u00b7\u016d\u00b8\u016f\u00b9\u0171\u00ba\u0173\u00bb\u0175", - "\u00bc\u0177\u00bd\u0179\u00be\u017b\u00bf\u017d\u00c0\u017f\u00c1\u0181", - "\u00c2\u0183\u00c3\u0185\u00c4\u0187\u00c5\u0189\u00c6\u018b\u00c7\u018d", - "\u00c8\u018f\u00c9\u0191\u00ca\u0193\u00cb\u0195\u00cc\u0197\u00cd\u0199", - "\u00ce\u019b\u00cf\u019d\u00d0\u019f\u00d1\u01a1\u00d2\u01a3\u00d3\u01a5", - "\u00d4\u01a7\u00d5\u01a9\u0002\u01ab\u0002\u01ad\u0002\u01af\u0002\u01b1", - "\u0002\u01b3\u0002\u01b5\u0002\u01b7\u0002\u01b9\u0002\u01bb\u0002\u01bd", - "\u0002\u01bf\u0002\u01c1\u0002\u01c3\u0002\u01c5\u0002\u01c7\u0002\u01c9", - "\u0002\u01cb\u0002\u01cd\u0002\u01cf\u0002\u01d1\u0002\u01d3\u0002\u01d5", - "\u0002\u01d7\u0002\u01d9\u0002\u01db\u0002\u01dd\u0002\u01df\u0002\u01e1", - "\u0002\u01e3\u0002\u01e5\u0002\u01e7\u00d6\u01e9\u00d7\u01eb\u00d8\u01ed", - "\u00d9\u01ef\u00da\u01f1\u00db\u01f3\u00dc\u01f5\u00dd\u01f7\u0002\u01f9", - "\u0002\u01fb\u0002\u01fd\u0002\u01ff\u0002\u0201\u0002\u0203\u0002\u0205", - "\u0002\u0207\u00de\u0209\u00df\u020b\u00e0\u020d\u00e1\u020f\u00e2\u0211", - '\u00e3\u0213\u00e4\u0003\u0002&\u0005\u0002\u000b\f\u000f\u000f""', - "\u0004\u0002\f\f\u000f\u000f\u0004\u0002CCcc\u0004\u0002DDdd\u0004\u0002", - "EEee\u0004\u0002FFff\u0004\u0002GGgg\u0004\u0002HHhh\u0004\u0002IIi", - "i\u0004\u0002JJjj\u0004\u0002KKkk\u0004\u0002LLll\u0004\u0002MMmm\u0004", - "\u0002NNnn\u0004\u0002OOoo\u0004\u0002PPpp\u0004\u0002QQqq\u0004\u0002", - "RRrr\u0004\u0002SSss\u0004\u0002TTtt\u0004\u0002UUuu\u0004\u0002VVv", - "v\u0004\u0002WWww\u0004\u0002XXxx\u0004\u0002YYyy\u0004\u0002ZZzz\u0004", - "\u0002[[{{\u0004\u0002\\\\||\u0003\u0002&&\u0005\u00022;CHch\u0004\u0002", - "C\\c|\u0007\u0002&&2;C\\aac|\u0003\u0002$$\u0004\u0002))^^\u0003\u0002", - "2;\u0004\u00022;CH\u0002\u0f39\u0002\u0003\u0003\u0002\u0002\u0002\u0002", - "\u0005\u0003\u0002\u0002\u0002\u0002\u0007\u0003\u0002\u0002\u0002\u0002", - "\t\u0003\u0002\u0002\u0002\u0002\u000b\u0003\u0002\u0002\u0002\u0002", - "\r\u0003\u0002\u0002\u0002\u0002\u000f\u0003\u0002\u0002\u0002\u0002", - "\u0011\u0003\u0002\u0002\u0002\u0002\u0013\u0003\u0002\u0002\u0002\u0002", - "\u0015\u0003\u0002\u0002\u0002\u0002\u0017\u0003\u0002\u0002\u0002\u0002", - "\u0019\u0003\u0002\u0002\u0002\u0002\u001b\u0003\u0002\u0002\u0002\u0002", - "\u001d\u0003\u0002\u0002\u0002\u0002\u001f\u0003\u0002\u0002\u0002\u0002", - "!\u0003\u0002\u0002\u0002\u0002#\u0003\u0002\u0002\u0002\u0002%\u0003", - "\u0002\u0002\u0002\u0002'\u0003\u0002\u0002\u0002\u0002)\u0003\u0002", - "\u0002\u0002\u0002+\u0003\u0002\u0002\u0002\u0002-\u0003\u0002\u0002", - "\u0002\u0002/\u0003\u0002\u0002\u0002\u00021\u0003\u0002\u0002\u0002", - "\u00023\u0003\u0002\u0002\u0002\u00025\u0003\u0002\u0002\u0002\u0002", - "7\u0003\u0002\u0002\u0002\u00029\u0003\u0002\u0002\u0002\u0002;\u0003", - "\u0002\u0002\u0002\u0002=\u0003\u0002\u0002\u0002\u0002?\u0003\u0002", - "\u0002\u0002\u0002A\u0003\u0002\u0002\u0002\u0002C\u0003\u0002\u0002", - "\u0002\u0002E\u0003\u0002\u0002\u0002\u0002G\u0003\u0002\u0002\u0002", - "\u0002I\u0003\u0002\u0002\u0002\u0002K\u0003\u0002\u0002\u0002\u0002", - "M\u0003\u0002\u0002\u0002\u0002O\u0003\u0002\u0002\u0002\u0002Q\u0003", - "\u0002\u0002\u0002\u0002S\u0003\u0002\u0002\u0002\u0002U\u0003\u0002", - "\u0002\u0002\u0002W\u0003\u0002\u0002\u0002\u0002Y\u0003\u0002\u0002", - "\u0002\u0002[\u0003\u0002\u0002\u0002\u0002]\u0003\u0002\u0002\u0002", - "\u0002_\u0003\u0002\u0002\u0002\u0002a\u0003\u0002\u0002\u0002\u0002", - "c\u0003\u0002\u0002\u0002\u0002e\u0003\u0002\u0002\u0002\u0002g\u0003", - "\u0002\u0002\u0002\u0002i\u0003\u0002\u0002\u0002\u0002k\u0003\u0002", - "\u0002\u0002\u0002m\u0003\u0002\u0002\u0002\u0002o\u0003\u0002\u0002", - "\u0002\u0002q\u0003\u0002\u0002\u0002\u0002s\u0003\u0002\u0002\u0002", - "\u0002u\u0003\u0002\u0002\u0002\u0002w\u0003\u0002\u0002\u0002\u0002", - "y\u0003\u0002\u0002\u0002\u0002{\u0003\u0002\u0002\u0002\u0002}\u0003", - "\u0002\u0002\u0002\u0002\u007f\u0003\u0002\u0002\u0002\u0002\u0081\u0003", - "\u0002\u0002\u0002\u0002\u0083\u0003\u0002\u0002\u0002\u0002\u0085\u0003", - "\u0002\u0002\u0002\u0002\u0087\u0003\u0002\u0002\u0002\u0002\u0089\u0003", - "\u0002\u0002\u0002\u0002\u008b\u0003\u0002\u0002\u0002\u0002\u008d\u0003", - "\u0002\u0002\u0002\u0002\u008f\u0003\u0002\u0002\u0002\u0002\u0091\u0003", - "\u0002\u0002\u0002\u0002\u0093\u0003\u0002\u0002\u0002\u0002\u0095\u0003", - "\u0002\u0002\u0002\u0002\u0097\u0003\u0002\u0002\u0002\u0002\u0099\u0003", - "\u0002\u0002\u0002\u0002\u009b\u0003\u0002\u0002\u0002\u0002\u009d\u0003", - "\u0002\u0002\u0002\u0002\u009f\u0003\u0002\u0002\u0002\u0002\u00a1\u0003", - "\u0002\u0002\u0002\u0002\u00a3\u0003\u0002\u0002\u0002\u0002\u00a5\u0003", - "\u0002\u0002\u0002\u0002\u00a7\u0003\u0002\u0002\u0002\u0002\u00a9\u0003", - "\u0002\u0002\u0002\u0002\u00ab\u0003\u0002\u0002\u0002\u0002\u00ad\u0003", - "\u0002\u0002\u0002\u0002\u00af\u0003\u0002\u0002\u0002\u0002\u00b1\u0003", - "\u0002\u0002\u0002\u0002\u00b3\u0003\u0002\u0002\u0002\u0002\u00b5\u0003", - "\u0002\u0002\u0002\u0002\u00b7\u0003\u0002\u0002\u0002\u0002\u00b9\u0003", - "\u0002\u0002\u0002\u0002\u00bb\u0003\u0002\u0002\u0002\u0002\u00bd\u0003", - "\u0002\u0002\u0002\u0002\u00bf\u0003\u0002\u0002\u0002\u0002\u00c1\u0003", - "\u0002\u0002\u0002\u0002\u00c3\u0003\u0002\u0002\u0002\u0002\u00c5\u0003", - "\u0002\u0002\u0002\u0002\u00c7\u0003\u0002\u0002\u0002\u0002\u00c9\u0003", - "\u0002\u0002\u0002\u0002\u00cb\u0003\u0002\u0002\u0002\u0002\u00cd\u0003", - "\u0002\u0002\u0002\u0002\u00cf\u0003\u0002\u0002\u0002\u0002\u00d1\u0003", - "\u0002\u0002\u0002\u0002\u00d3\u0003\u0002\u0002\u0002\u0002\u00d5\u0003", - "\u0002\u0002\u0002\u0002\u00d7\u0003\u0002\u0002\u0002\u0002\u00d9\u0003", - "\u0002\u0002\u0002\u0002\u00db\u0003\u0002\u0002\u0002\u0002\u00dd\u0003", - "\u0002\u0002\u0002\u0002\u00df\u0003\u0002\u0002\u0002\u0002\u00e1\u0003", - "\u0002\u0002\u0002\u0002\u00e3\u0003\u0002\u0002\u0002\u0002\u00e5\u0003", - "\u0002\u0002\u0002\u0002\u00e7\u0003\u0002\u0002\u0002\u0002\u00e9\u0003", - "\u0002\u0002\u0002\u0002\u00eb\u0003\u0002\u0002\u0002\u0002\u00ed\u0003", - "\u0002\u0002\u0002\u0002\u00ef\u0003\u0002\u0002\u0002\u0002\u00f1\u0003", - "\u0002\u0002\u0002\u0002\u00f3\u0003\u0002\u0002\u0002\u0002\u00f5\u0003", - "\u0002\u0002\u0002\u0002\u00f7\u0003\u0002\u0002\u0002\u0002\u00f9\u0003", - "\u0002\u0002\u0002\u0002\u00fb\u0003\u0002\u0002\u0002\u0002\u00fd\u0003", - "\u0002\u0002\u0002\u0002\u00ff\u0003\u0002\u0002\u0002\u0002\u0101\u0003", - "\u0002\u0002\u0002\u0002\u0103\u0003\u0002\u0002\u0002\u0002\u0105\u0003", - "\u0002\u0002\u0002\u0002\u0107\u0003\u0002\u0002\u0002\u0002\u0109\u0003", - "\u0002\u0002\u0002\u0002\u010b\u0003\u0002\u0002\u0002\u0002\u010d\u0003", - "\u0002\u0002\u0002\u0002\u010f\u0003\u0002\u0002\u0002\u0002\u0111\u0003", - "\u0002\u0002\u0002\u0002\u0113\u0003\u0002\u0002\u0002\u0002\u0115\u0003", - "\u0002\u0002\u0002\u0002\u0117\u0003\u0002\u0002\u0002\u0002\u0119\u0003", - "\u0002\u0002\u0002\u0002\u011b\u0003\u0002\u0002\u0002\u0002\u011d\u0003", - "\u0002\u0002\u0002\u0002\u011f\u0003\u0002\u0002\u0002\u0002\u0121\u0003", - "\u0002\u0002\u0002\u0002\u0123\u0003\u0002\u0002\u0002\u0002\u0125\u0003", - "\u0002\u0002\u0002\u0002\u0127\u0003\u0002\u0002\u0002\u0002\u0129\u0003", - "\u0002\u0002\u0002\u0002\u012b\u0003\u0002\u0002\u0002\u0002\u012d\u0003", - "\u0002\u0002\u0002\u0002\u012f\u0003\u0002\u0002\u0002\u0002\u0131\u0003", - "\u0002\u0002\u0002\u0002\u0133\u0003\u0002\u0002\u0002\u0002\u0135\u0003", - "\u0002\u0002\u0002\u0002\u0137\u0003\u0002\u0002\u0002\u0002\u0139\u0003", - "\u0002\u0002\u0002\u0002\u013b\u0003\u0002\u0002\u0002\u0002\u013d\u0003", - "\u0002\u0002\u0002\u0002\u013f\u0003\u0002\u0002\u0002\u0002\u0141\u0003", - "\u0002\u0002\u0002\u0002\u0143\u0003\u0002\u0002\u0002\u0002\u0145\u0003", - "\u0002\u0002\u0002\u0002\u0147\u0003\u0002\u0002\u0002\u0002\u0149\u0003", - "\u0002\u0002\u0002\u0002\u014b\u0003\u0002\u0002\u0002\u0002\u014d\u0003", - "\u0002\u0002\u0002\u0002\u014f\u0003\u0002\u0002\u0002\u0002\u0151\u0003", - "\u0002\u0002\u0002\u0002\u0153\u0003\u0002\u0002\u0002\u0002\u0155\u0003", - "\u0002\u0002\u0002\u0002\u0157\u0003\u0002\u0002\u0002\u0002\u0159\u0003", - "\u0002\u0002\u0002\u0002\u015b\u0003\u0002\u0002\u0002\u0002\u015d\u0003", - "\u0002\u0002\u0002\u0002\u015f\u0003\u0002\u0002\u0002\u0002\u0161\u0003", - "\u0002\u0002\u0002\u0002\u0163\u0003\u0002\u0002\u0002\u0002\u0165\u0003", - "\u0002\u0002\u0002\u0002\u0167\u0003\u0002\u0002\u0002\u0002\u0169\u0003", - "\u0002\u0002\u0002\u0002\u016b\u0003\u0002\u0002\u0002\u0002\u016d\u0003", - "\u0002\u0002\u0002\u0002\u016f\u0003\u0002\u0002\u0002\u0002\u0171\u0003", - "\u0002\u0002\u0002\u0002\u0173\u0003\u0002\u0002\u0002\u0002\u0175\u0003", - "\u0002\u0002\u0002\u0002\u0177\u0003\u0002\u0002\u0002\u0002\u0179\u0003", - "\u0002\u0002\u0002\u0002\u017b\u0003\u0002\u0002\u0002\u0002\u017d\u0003", - "\u0002\u0002\u0002\u0002\u017f\u0003\u0002\u0002\u0002\u0002\u0181\u0003", - "\u0002\u0002\u0002\u0002\u0183\u0003\u0002\u0002\u0002\u0002\u0185\u0003", - "\u0002\u0002\u0002\u0002\u0187\u0003\u0002\u0002\u0002\u0002\u0189\u0003", - "\u0002\u0002\u0002\u0002\u018b\u0003\u0002\u0002\u0002\u0002\u018d\u0003", - "\u0002\u0002\u0002\u0002\u018f\u0003\u0002\u0002\u0002\u0002\u0191\u0003", - "\u0002\u0002\u0002\u0002\u0193\u0003\u0002\u0002\u0002\u0002\u0195\u0003", - "\u0002\u0002\u0002\u0002\u0197\u0003\u0002\u0002\u0002\u0002\u0199\u0003", - "\u0002\u0002\u0002\u0002\u019b\u0003\u0002\u0002\u0002\u0002\u019d\u0003", - "\u0002\u0002\u0002\u0002\u019f\u0003\u0002\u0002\u0002\u0002\u01a1\u0003", - "\u0002\u0002\u0002\u0002\u01a3\u0003\u0002\u0002\u0002\u0002\u01a5\u0003", - "\u0002\u0002\u0002\u0002\u01a7\u0003\u0002\u0002\u0002\u0002\u01e7\u0003", - "\u0002\u0002\u0002\u0002\u01e9\u0003\u0002\u0002\u0002\u0002\u01eb\u0003", - "\u0002\u0002\u0002\u0002\u01ed\u0003\u0002\u0002\u0002\u0002\u01ef\u0003", - "\u0002\u0002\u0002\u0002\u01f1\u0003\u0002\u0002\u0002\u0002\u01f3\u0003", - "\u0002\u0002\u0002\u0002\u01f5\u0003\u0002\u0002\u0002\u0002\u0207\u0003", - "\u0002\u0002\u0002\u0002\u0209\u0003\u0002\u0002\u0002\u0002\u020b\u0003", - "\u0002\u0002\u0002\u0002\u020d\u0003\u0002\u0002\u0002\u0002\u020f\u0003", - "\u0002\u0002\u0002\u0002\u0211\u0003\u0002\u0002\u0002\u0002\u0213\u0003", - "\u0002\u0002\u0002\u0003\u0215\u0003\u0002\u0002\u0002\u0005\u0217\u0003", - "\u0002\u0002\u0002\u0007\u0219\u0003\u0002\u0002\u0002\t\u021b\u0003", - "\u0002\u0002\u0002\u000b\u021d\u0003\u0002\u0002\u0002\r\u021f\u0003", - "\u0002\u0002\u0002\u000f\u0221\u0003\u0002\u0002\u0002\u0011\u0223\u0003", - "\u0002\u0002\u0002\u0013\u0225\u0003\u0002\u0002\u0002\u0015\u0228\u0003", - "\u0002\u0002\u0002\u0017\u022e\u0003\u0002\u0002\u0002\u0019\u023c\u0003", - "\u0002\u0002\u0002\u001b\u0269\u0003\u0002\u0002\u0002\u001d\u026d\u0003", - "\u0002\u0002\u0002\u001f\u026f\u0003\u0002\u0002\u0002!\u0271\u0003", - "\u0002\u0002\u0002#\u0273\u0003\u0002\u0002\u0002%\u0275\u0003\u0002", - "\u0002\u0002'\u0277\u0003\u0002\u0002\u0002)\u027a\u0003\u0002\u0002", - "\u0002+\u027c\u0003\u0002\u0002\u0002-\u027e\u0003\u0002\u0002\u0002", - "/\u0287\u0003\u0002\u0002\u00021\u029c\u0003\u0002\u0002\u00023\u02a5", - "\u0003\u0002\u0002\u00025\u02b2\u0003\u0002\u0002\u00027\u02bf\u0003", - "\u0002\u0002\u00029\u02c8\u0003\u0002\u0002\u0002;\u02d1\u0003\u0002", - "\u0002\u0002=\u02de\u0003\u0002\u0002\u0002?\u02e5\u0003\u0002\u0002", - "\u0002A\u02ee\u0003\u0002\u0002\u0002C\u0303\u0003\u0002\u0002\u0002", - "E\u0310\u0003\u0002\u0002\u0002G\u031d\u0003\u0002\u0002\u0002I\u0324", - "\u0003\u0002\u0002\u0002K\u0333\u0003\u0002\u0002\u0002M\u034a\u0003", - "\u0002\u0002\u0002O\u0365\u0003\u0002\u0002\u0002Q\u0376\u0003\u0002", - "\u0002\u0002S\u038f\u0003\u0002\u0002\u0002U\u03a2\u0003\u0002\u0002", - "\u0002W\u03b1\u0003\u0002\u0002\u0002Y\u03c0\u0003\u0002\u0002\u0002", - "[\u03cf\u0003\u0002\u0002\u0002]\u03de\u0003\u0002\u0002\u0002_\u03e9", - "\u0003\u0002\u0002\u0002a\u03fc\u0003\u0002\u0002\u0002c\u040f\u0003", - "\u0002\u0002\u0002e\u041a\u0003\u0002\u0002\u0002g\u0439\u0003\u0002", - "\u0002\u0002i\u0452\u0003\u0002\u0002\u0002k\u0463\u0003\u0002\u0002", - "\u0002m\u0474\u0003\u0002\u0002\u0002o\u0483\u0003\u0002\u0002\u0002", - "q\u0498\u0003\u0002\u0002\u0002s\u04ad\u0003\u0002\u0002\u0002u\u04c2", - "\u0003\u0002\u0002\u0002w\u04cd\u0003\u0002\u0002\u0002y\u04d8\u0003", - "\u0002\u0002\u0002{\u04eb\u0003\u0002\u0002\u0002}\u0500\u0003\u0002", - "\u0002\u0002\u007f\u050d\u0003\u0002\u0002\u0002\u0081\u0514\u0003\u0002", - "\u0002\u0002\u0083\u051b\u0003\u0002\u0002\u0002\u0085\u0528\u0003\u0002", - "\u0002\u0002\u0087\u053b\u0003\u0002\u0002\u0002\u0089\u054e\u0003\u0002", - "\u0002\u0002\u008b\u055b\u0003\u0002\u0002\u0002\u008d\u056a\u0003\u0002", - "\u0002\u0002\u008f\u0575\u0003\u0002\u0002\u0002\u0091\u057c\u0003\u0002", - "\u0002\u0002\u0093\u0587\u0003\u0002\u0002\u0002\u0095\u0590\u0003\u0002", - "\u0002\u0002\u0097\u059b\u0003\u0002\u0002\u0002\u0099\u05ae\u0003\u0002", - "\u0002\u0002\u009b\u05c3\u0003\u0002\u0002\u0002\u009d\u05d6\u0003\u0002", - "\u0002\u0002\u009f\u05e3\u0003\u0002\u0002\u0002\u00a1\u05f0\u0003\u0002", - "\u0002\u0002\u00a3\u0605\u0003\u0002\u0002\u0002\u00a5\u0620\u0003\u0002", - "\u0002\u0002\u00a7\u062f\u0003\u0002\u0002\u0002\u00a9\u063c\u0003\u0002", - "\u0002\u0002\u00ab\u0657\u0003\u0002\u0002\u0002\u00ad\u0666\u0003\u0002", - "\u0002\u0002\u00af\u066f\u0003\u0002\u0002\u0002\u00b1\u0688\u0003\u0002", - "\u0002\u0002\u00b3\u06a1\u0003\u0002\u0002\u0002\u00b5\u06aa\u0003\u0002", - "\u0002\u0002\u00b7\u06b5\u0003\u0002\u0002\u0002\u00b9\u06bc\u0003\u0002", - "\u0002\u0002\u00bb\u06c3\u0003\u0002\u0002\u0002\u00bd\u06cc\u0003\u0002", - "\u0002\u0002\u00bf\u06dd\u0003\u0002\u0002\u0002\u00c1\u06e4\u0003\u0002", - "\u0002\u0002\u00c3\u06f1\u0003\u0002\u0002\u0002\u00c5\u0706\u0003\u0002", - "\u0002\u0002\u00c7\u0719\u0003\u0002\u0002\u0002\u00c9\u0722\u0003\u0002", - "\u0002\u0002\u00cb\u0739\u0003\u0002\u0002\u0002\u00cd\u0752\u0003\u0002", - "\u0002\u0002\u00cf\u0763\u0003\u0002\u0002\u0002\u00d1\u0772\u0003\u0002", - "\u0002\u0002\u00d3\u0781\u0003\u0002\u0002\u0002\u00d5\u0792\u0003\u0002", - "\u0002\u0002\u00d7\u07ab\u0003\u0002\u0002\u0002\u00d9\u07bc\u0003\u0002", - "\u0002\u0002\u00db\u07cb\u0003\u0002\u0002\u0002\u00dd\u07d6\u0003\u0002", - "\u0002\u0002\u00df\u07e3\u0003\u0002\u0002\u0002\u00e1\u07f6\u0003\u0002", - "\u0002\u0002\u00e3\u0801\u0003\u0002\u0002\u0002\u00e5\u080f\u0003\u0002", - "\u0002\u0002\u00e7\u081e\u0003\u0002\u0002\u0002\u00e9\u082d\u0003\u0002", - "\u0002\u0002\u00eb\u0836\u0003\u0002\u0002\u0002\u00ed\u0843\u0003\u0002", - "\u0002\u0002\u00ef\u0852\u0003\u0002\u0002\u0002\u00f1\u0863\u0003\u0002", - "\u0002\u0002\u00f3\u0870\u0003\u0002\u0002\u0002\u00f5\u0885\u0003\u0002", - "\u0002\u0002\u00f7\u0892\u0003\u0002\u0002\u0002\u00f9\u089f\u0003\u0002", - "\u0002\u0002\u00fb\u08b4\u0003\u0002\u0002\u0002\u00fd\u08bb\u0003\u0002", - "\u0002\u0002\u00ff\u08c8\u0003\u0002\u0002\u0002\u0101\u08d9\u0003\u0002", - "\u0002\u0002\u0103\u08eb\u0003\u0002\u0002\u0002\u0105\u08fe\u0003\u0002", - "\u0002\u0002\u0107\u0907\u0003\u0002\u0002\u0002\u0109\u0910\u0003\u0002", - "\u0002\u0002\u010b\u091b\u0003\u0002\u0002\u0002\u010d\u092e\u0003\u0002", - "\u0002\u0002\u010f\u093d\u0003\u0002\u0002\u0002\u0111\u0946\u0003\u0002", - "\u0002\u0002\u0113\u0951\u0003\u0002\u0002\u0002\u0115\u095e\u0003\u0002", - "\u0002\u0002\u0117\u0969\u0003\u0002\u0002\u0002\u0119\u0978\u0003\u0002", - "\u0002\u0002\u011b\u0983\u0003\u0002\u0002\u0002\u011d\u0990\u0003\u0002", - "\u0002\u0002\u011f\u099b\u0003\u0002\u0002\u0002\u0121\u09b0\u0003\u0002", - "\u0002\u0002\u0123\u09c0\u0003\u0002\u0002\u0002\u0125\u09c2\u0003\u0002", - "\u0002\u0002\u0127\u09d3\u0003\u0002\u0002\u0002\u0129\u0a09\u0003\u0002", - "\u0002\u0002\u012b\u0a0b\u0003\u0002\u0002\u0002\u012d\u0a16\u0003\u0002", - "\u0002\u0002\u012f\u0a23\u0003\u0002\u0002\u0002\u0131\u0a47\u0003\u0002", - "\u0002\u0002\u0133\u0a66\u0003\u0002\u0002\u0002\u0135\u0a85\u0003\u0002", - "\u0002\u0002\u0137\u0a9b\u0003\u0002\u0002\u0002\u0139\u0abe\u0003\u0002", - "\u0002\u0002\u013b\u0ae1\u0003\u0002\u0002\u0002\u013d\u0af7\u0003\u0002", - "\u0002\u0002\u013f\u0b0d\u0003\u0002\u0002\u0002\u0141\u0b14\u0003\u0002", - "\u0002\u0002\u0143\u0b25\u0003\u0002\u0002\u0002\u0145\u0b3c\u0003\u0002", - "\u0002\u0002\u0147\u0b68\u0003\u0002\u0002\u0002\u0149\u0b9e\u0003\u0002", - "\u0002\u0002\u014b\u0bb0\u0003\u0002\u0002\u0002\u014d\u0bbf\u0003\u0002", - "\u0002\u0002\u014f\u0bdc\u0003\u0002\u0002\u0002\u0151\u0bf3\u0003\u0002", - "\u0002\u0002\u0153\u0bfd\u0003\u0002\u0002\u0002\u0155\u0c07\u0003\u0002", - "\u0002\u0002\u0157\u0c10\u0003\u0002\u0002\u0002\u0159\u0c18\u0003\u0002", - "\u0002\u0002\u015b\u0c22\u0003\u0002\u0002\u0002\u015d\u0c2a\u0003\u0002", - "\u0002\u0002\u015f\u0c33\u0003\u0002\u0002\u0002\u0161\u0c3a\u0003\u0002", - "\u0002\u0002\u0163\u0c49\u0003\u0002\u0002\u0002\u0165\u0c5b\u0003\u0002", - "\u0002\u0002\u0167\u0c6c\u0003\u0002\u0002\u0002\u0169\u0c84\u0003\u0002", - "\u0002\u0002\u016b\u0c9d\u0003\u0002\u0002\u0002\u016d\u0cb3\u0003\u0002", - "\u0002\u0002\u016f\u0cc7\u0003\u0002\u0002\u0002\u0171\u0cda\u0003\u0002", - "\u0002\u0002\u0173\u0ce8\u0003\u0002\u0002\u0002\u0175\u0cf1\u0003\u0002", - "\u0002\u0002\u0177\u0cfa\u0003\u0002\u0002\u0002\u0179\u0d02\u0003\u0002", - "\u0002\u0002\u017b\u0d0a\u0003\u0002\u0002\u0002\u017d\u0d15\u0003\u0002", - "\u0002\u0002\u017f\u0d21\u0003\u0002\u0002\u0002\u0181\u0d28\u0003\u0002", - "\u0002\u0002\u0183\u0d2d\u0003\u0002\u0002\u0002\u0185\u0d35\u0003\u0002", - "\u0002\u0002\u0187\u0d3d\u0003\u0002\u0002\u0002\u0189\u0d42\u0003\u0002", - "\u0002\u0002\u018b\u0d4a\u0003\u0002\u0002\u0002\u018d\u0d51\u0003\u0002", - "\u0002\u0002\u018f\u0d57\u0003\u0002\u0002\u0002\u0191\u0d5e\u0003\u0002", - "\u0002\u0002\u0193\u0d63\u0003\u0002\u0002\u0002\u0195\u0d67\u0003\u0002", - "\u0002\u0002\u0197\u0d6c\u0003\u0002\u0002\u0002\u0199\u0d70\u0003\u0002", - "\u0002\u0002\u019b\u0d79\u0003\u0002\u0002\u0002\u019d\u0d7e\u0003\u0002", - "\u0002\u0002\u019f\u0d87\u0003\u0002\u0002\u0002\u01a1\u0d8c\u0003\u0002", - "\u0002\u0002\u01a3\u0d94\u0003\u0002\u0002\u0002\u01a5\u0d9a\u0003\u0002", - "\u0002\u0002\u01a7\u0da2\u0003\u0002\u0002\u0002\u01a9\u0da9\u0003\u0002", - "\u0002\u0002\u01ab\u0dab\u0003\u0002\u0002\u0002\u01ad\u0dad\u0003\u0002", - "\u0002\u0002\u01af\u0daf\u0003\u0002\u0002\u0002\u01b1\u0db1\u0003\u0002", - "\u0002\u0002\u01b3\u0db3\u0003\u0002\u0002\u0002\u01b5\u0db5\u0003\u0002", - "\u0002\u0002\u01b7\u0db7\u0003\u0002\u0002\u0002\u01b9\u0db9\u0003\u0002", - "\u0002\u0002\u01bb\u0dbb\u0003\u0002\u0002\u0002\u01bd\u0dbd\u0003\u0002", - "\u0002\u0002\u01bf\u0dbf\u0003\u0002\u0002\u0002\u01c1\u0dc1\u0003\u0002", - "\u0002\u0002\u01c3\u0dc3\u0003\u0002\u0002\u0002\u01c5\u0dc5\u0003\u0002", - "\u0002\u0002\u01c7\u0dc7\u0003\u0002\u0002\u0002\u01c9\u0dc9\u0003\u0002", - "\u0002\u0002\u01cb\u0dcb\u0003\u0002\u0002\u0002\u01cd\u0dcd\u0003\u0002", - "\u0002\u0002\u01cf\u0dcf\u0003\u0002\u0002\u0002\u01d1\u0dd1\u0003\u0002", - "\u0002\u0002\u01d3\u0dd3\u0003\u0002\u0002\u0002\u01d5\u0dd5\u0003\u0002", - "\u0002\u0002\u01d7\u0dd7\u0003\u0002\u0002\u0002\u01d9\u0dd9\u0003\u0002", - "\u0002\u0002\u01db\u0ddb\u0003\u0002\u0002\u0002\u01dd\u0ddd\u0003\u0002", - "\u0002\u0002\u01df\u0de0\u0003\u0002\u0002\u0002\u01e1\u0dee\u0003\u0002", - "\u0002\u0002\u01e3\u0e01\u0003\u0002\u0002\u0002\u01e5\u0e03\u0003\u0002", - "\u0002\u0002\u01e7\u0e10\u0003\u0002\u0002\u0002\u01e9\u0e12\u0003\u0002", - "\u0002\u0002\u01eb\u0e15\u0003\u0002\u0002\u0002\u01ed\u0e1a\u0003\u0002", - "\u0002\u0002\u01ef\u0e3c\u0003\u0002\u0002\u0002\u01f1\u0e69\u0003\u0002", - "\u0002\u0002\u01f3\u0e6b\u0003\u0002\u0002\u0002\u01f5\u0e6d\u0003\u0002", - "\u0002\u0002\u01f7\u0e7a\u0003\u0002\u0002\u0002\u01f9\u0e7c\u0003\u0002", - "\u0002\u0002\u01fb\u0e7e\u0003\u0002\u0002\u0002\u01fd\u0e87\u0003\u0002", - "\u0002\u0002\u01ff\u0e89\u0003\u0002\u0002\u0002\u0201\u0e8b\u0003\u0002", - "\u0002\u0002\u0203\u0e8d\u0003\u0002\u0002\u0002\u0205\u0e90\u0003\u0002", - "\u0002\u0002\u0207\u0e93\u0003\u0002\u0002\u0002\u0209\u0e95\u0003\u0002", - "\u0002\u0002\u020b\u0e97\u0003\u0002\u0002\u0002\u020d\u0e99\u0003\u0002", - "\u0002\u0002\u020f\u0e9b\u0003\u0002\u0002\u0002\u0211\u0ea8\u0003\u0002", - "\u0002\u0002\u0213\u0eb7\u0003\u0002\u0002\u0002\u0215\u0216\u0007*", - "\u0002\u0002\u0216\u0004\u0003\u0002\u0002\u0002\u0217\u0218\u0007+", - "\u0002\u0002\u0218\u0006\u0003\u0002\u0002\u0002\u0219\u021a\u0007}", - "\u0002\u0002\u021a\b\u0003\u0002\u0002\u0002\u021b\u021c\u0007\u007f", - "\u0002\u0002\u021c\n\u0003\u0002\u0002\u0002\u021d\u021e\u0007]\u0002", - "\u0002\u021e\f\u0003\u0002\u0002\u0002\u021f\u0220\u0007_\u0002\u0002", - "\u0220\u000e\u0003\u0002\u0002\u0002\u0221\u0222\u0007.\u0002\u0002", - "\u0222\u0010\u0003\u0002\u0002\u0002\u0223\u0224\u0007=\u0002\u0002", - "\u0224\u0012\u0003\u0002\u0002\u0002\u0225\u0226\u0007<\u0002\u0002", - "\u0226\u0014\u0003\u0002\u0002\u0002\u0227\u0229\t\u0002\u0002\u0002", - "\u0228\u0227\u0003\u0002\u0002\u0002\u0229\u022a\u0003\u0002\u0002\u0002", - "\u022a\u0228\u0003\u0002\u0002\u0002\u022a\u022b\u0003\u0002\u0002\u0002", - "\u022b\u022c\u0003\u0002\u0002\u0002\u022c\u022d\b\u000b\u0002\u0002", - "\u022d\u0016\u0003\u0002\u0002\u0002\u022e\u022f\u00071\u0002\u0002", - "\u022f\u0230\u0007,\u0002\u0002\u0230\u0231\u0007#\u0002\u0002\u0231", - "\u0233\u0003\u0002\u0002\u0002\u0232\u0234\u000b\u0002\u0002\u0002\u0233", - "\u0232\u0003\u0002\u0002\u0002\u0234\u0235\u0003\u0002\u0002\u0002\u0235", - "\u0236\u0003\u0002\u0002\u0002\u0235\u0233\u0003\u0002\u0002\u0002\u0236", - "\u0237\u0003\u0002\u0002\u0002\u0237\u0238\u0007,\u0002\u0002\u0238", - "\u0239\u00071\u0002\u0002\u0239\u023a\u0003\u0002\u0002\u0002\u023a", - "\u023b\b\f\u0002\u0002\u023b\u0018\u0003\u0002\u0002\u0002\u023c\u023d", - "\u00071\u0002\u0002\u023d\u023e\u0007,\u0002\u0002\u023e\u0242\u0003", - "\u0002\u0002\u0002\u023f\u0241\u000b\u0002\u0002\u0002\u0240\u023f\u0003", - "\u0002\u0002\u0002\u0241\u0244\u0003\u0002\u0002\u0002\u0242\u0243\u0003", - "\u0002\u0002\u0002\u0242\u0240\u0003\u0002\u0002\u0002\u0243\u0245\u0003", - "\u0002\u0002\u0002\u0244\u0242\u0003\u0002\u0002\u0002\u0245\u0246\u0007", - ",\u0002\u0002\u0246\u0247\u00071\u0002\u0002\u0247\u0248\u0003\u0002", - "\u0002\u0002\u0248\u0249\b\r\u0002\u0002\u0249\u001a\u0003\u0002\u0002", - "\u0002\u024a\u024b\u0007/\u0002\u0002\u024b\u024c\u0007/\u0002\u0002", - '\u024c\u0251\u0007"\u0002\u0002\u024d\u0251\u0007%\u0002\u0002\u024e', - "\u024f\u00071\u0002\u0002\u024f\u0251\u00071\u0002\u0002\u0250\u024a", - "\u0003\u0002\u0002\u0002\u0250\u024d\u0003\u0002\u0002\u0002\u0250\u024e", - "\u0003\u0002\u0002\u0002\u0251\u0255\u0003\u0002\u0002\u0002\u0252\u0254", - "\n\u0003\u0002\u0002\u0253\u0252\u0003\u0002\u0002\u0002\u0254\u0257", - "\u0003\u0002\u0002\u0002\u0255\u0253\u0003\u0002\u0002\u0002\u0255\u0256", - "\u0003\u0002\u0002\u0002\u0256\u025d\u0003\u0002\u0002\u0002\u0257\u0255", - "\u0003\u0002\u0002\u0002\u0258\u025a\u0007\u000f\u0002\u0002\u0259\u0258", - "\u0003\u0002\u0002\u0002\u0259\u025a\u0003\u0002\u0002\u0002\u025a\u025b", - "\u0003\u0002\u0002\u0002\u025b\u025e\u0007\f\u0002\u0002\u025c\u025e", - "\u0007\u0002\u0002\u0003\u025d\u0259\u0003\u0002\u0002\u0002\u025d\u025c", - "\u0003\u0002\u0002\u0002\u025e\u026a\u0003\u0002\u0002\u0002\u025f\u0260", - "\u0007/\u0002\u0002\u0260\u0261\u0007/\u0002\u0002\u0261\u0267\u0003", - "\u0002\u0002\u0002\u0262\u0264\u0007\u000f\u0002\u0002\u0263\u0262\u0003", - "\u0002\u0002\u0002\u0263\u0264\u0003\u0002\u0002\u0002\u0264\u0265\u0003", - "\u0002\u0002\u0002\u0265\u0268\u0007\f\u0002\u0002\u0266\u0268\u0007", - "\u0002\u0002\u0003\u0267\u0263\u0003\u0002\u0002\u0002\u0267\u0266\u0003", - "\u0002\u0002\u0002\u0268\u026a\u0003\u0002\u0002\u0002\u0269\u0250\u0003", - "\u0002\u0002\u0002\u0269\u025f\u0003\u0002\u0002\u0002\u026a\u026b\u0003", - "\u0002\u0002\u0002\u026b\u026c\b\u000e\u0002\u0002\u026c\u001c\u0003", - "\u0002\u0002\u0002\u026d\u026e\u00070\u0002\u0002\u026e\u001e\u0003", - "\u0002\u0002\u0002\u026f\u0270\u0007,\u0002\u0002\u0270 \u0003\u0002", - '\u0002\u0002\u0271\u0272\u00071\u0002\u0002\u0272"\u0003\u0002\u0002', - "\u0002\u0273\u0274\u0007'\u0002\u0002\u0274$\u0003\u0002\u0002\u0002", - "\u0275\u0276\u0007-\u0002\u0002\u0276&\u0003\u0002\u0002\u0002\u0277", - "\u0278\u0007/\u0002\u0002\u0278\u0279\u0007/\u0002\u0002\u0279(\u0003", - "\u0002\u0002\u0002\u027a\u027b\u0007/\u0002\u0002\u027b*\u0003\u0002", - "\u0002\u0002\u027c\u027d\u0007$\u0002\u0002\u027d,\u0003\u0002\u0002", - "\u0002\u027e\u027f\u0007)\u0002\u0002\u027f.\u0003\u0002\u0002\u0002", - "\u0280\u0281\u0005\u01a9\u00d5\u0002\u0281\u0282\u0005\u01af\u00d8\u0002", - "\u0282\u0283\u0005\u01af\u00d8\u0002\u0283\u0288\u0003\u0002\u0002\u0002", - "\u0284\u0285\u0007C\u0002\u0002\u0285\u0286\u0007F\u0002\u0002\u0286", - "\u0288\u0007F\u0002\u0002\u0287\u0280\u0003\u0002\u0002\u0002\u0287", - "\u0284\u0003\u0002\u0002\u0002\u02880\u0003\u0002\u0002\u0002\u0289", - "\u028a\u0005\u01a9\u00d5\u0002\u028a\u028b\u0005\u01b5\u00db\u0002\u028b", - "\u028c\u0005\u01b5\u00db\u0002\u028c\u028d\u0005\u01cb\u00e6\u0002\u028d", - "\u028e\u0005\u01b1\u00d9\u0002\u028e\u028f\u0005\u01b5\u00db\u0002\u028f", - "\u0290\u0005\u01a9\u00d5\u0002\u0290\u0291\u0005\u01cf\u00e8\u0002\u0291", - "\u0292\u0005\u01b1\u00d9\u0002\u0292\u029d\u0003\u0002\u0002\u0002\u0293", - "\u0294\u0007C\u0002\u0002\u0294\u0295\u0007I\u0002\u0002\u0295\u0296", - "\u0007I\u0002\u0002\u0296\u0297\u0007T\u0002\u0002\u0297\u0298\u0007", - "G\u0002\u0002\u0298\u0299\u0007I\u0002\u0002\u0299\u029a\u0007C\u0002", - "\u0002\u029a\u029b\u0007V\u0002\u0002\u029b\u029d\u0007G\u0002\u0002", - "\u029c\u0289\u0003\u0002\u0002\u0002\u029c\u0293\u0003\u0002\u0002\u0002", - "\u029d2\u0003\u0002\u0002\u0002\u029e\u029f\u0005\u01a9\u00d5\u0002", - "\u029f\u02a0\u0005\u01bf\u00e0\u0002\u02a0\u02a1\u0005\u01bf\u00e0\u0002", - "\u02a1\u02a6\u0003\u0002\u0002\u0002\u02a2\u02a3\u0007C\u0002\u0002", - "\u02a3\u02a4\u0007N\u0002\u0002\u02a4\u02a6\u0007N\u0002\u0002\u02a5", - "\u029e\u0003\u0002\u0002\u0002\u02a5\u02a2\u0003\u0002\u0002\u0002\u02a6", - "4\u0003\u0002\u0002\u0002\u02a7\u02a8\u0005\u01a9\u00d5\u0002\u02a8", - "\u02a9\u0005\u01bf\u00e0\u0002\u02a9\u02aa\u0005\u01bf\u00e0\u0002\u02aa", - "\u02ab\u0005\u01c5\u00e3\u0002\u02ab\u02ac\u0005\u01d5\u00eb\u0002\u02ac", - "\u02b3\u0003\u0002\u0002\u0002\u02ad\u02ae\u0007C\u0002\u0002\u02ae", - "\u02af\u0007N\u0002\u0002\u02af\u02b0\u0007N\u0002\u0002\u02b0\u02b1", - "\u0007Q\u0002\u0002\u02b1\u02b3\u0007Y\u0002\u0002\u02b2\u02a7\u0003", - "\u0002\u0002\u0002\u02b2\u02ad\u0003\u0002\u0002\u0002\u02b36\u0003", - "\u0002\u0002\u0002\u02b4\u02b5\u0005\u01a9\u00d5\u0002\u02b5\u02b6\u0005", - "\u01bf\u00e0\u0002\u02b6\u02b7\u0005\u01cf\u00e8\u0002\u02b7\u02b8\u0005", - "\u01b1\u00d9\u0002\u02b8\u02b9\u0005\u01cb\u00e6\u0002\u02b9\u02c0\u0003", - "\u0002\u0002\u0002\u02ba\u02bb\u0007C\u0002\u0002\u02bb\u02bc\u0007", - "N\u0002\u0002\u02bc\u02bd\u0007V\u0002\u0002\u02bd\u02be\u0007G\u0002", - "\u0002\u02be\u02c0\u0007T\u0002\u0002\u02bf\u02b4\u0003\u0002\u0002", - "\u0002\u02bf\u02ba\u0003\u0002\u0002\u0002\u02c08\u0003\u0002\u0002", - "\u0002\u02c1\u02c2\u0005\u01a9\u00d5\u0002\u02c2\u02c3\u0005\u01c3\u00e2", - "\u0002\u02c3\u02c4\u0005\u01af\u00d8\u0002\u02c4\u02c9\u0003\u0002\u0002", - "\u0002\u02c5\u02c6\u0007C\u0002\u0002\u02c6\u02c7\u0007P\u0002\u0002", - "\u02c7\u02c9\u0007F\u0002\u0002\u02c8\u02c1\u0003\u0002\u0002\u0002", - "\u02c8\u02c5\u0003\u0002\u0002\u0002\u02c9:\u0003\u0002\u0002\u0002", - "\u02ca\u02cb\u0005\u01a9\u00d5\u0002\u02cb\u02cc\u0005\u01c3\u00e2\u0002", - "\u02cc\u02cd\u0005\u01d9\u00ed\u0002\u02cd\u02d2\u0003\u0002\u0002\u0002", - "\u02ce\u02cf\u0007C\u0002\u0002\u02cf\u02d0\u0007P\u0002\u0002\u02d0", - "\u02d2\u0007[\u0002\u0002\u02d1\u02ca\u0003\u0002\u0002\u0002\u02d1", - "\u02ce\u0003\u0002\u0002\u0002\u02d2<\u0003\u0002\u0002\u0002\u02d3", - "\u02d4\u0005\u01a9\u00d5\u0002\u02d4\u02d5\u0005\u01c7\u00e4\u0002\u02d5", - "\u02d6\u0005\u01c7\u00e4\u0002\u02d6\u02d7\u0005\u01bf\u00e0\u0002\u02d7", - "\u02d8\u0005\u01d9\u00ed\u0002\u02d8\u02df\u0003\u0002\u0002\u0002\u02d9", - "\u02da\u0007C\u0002\u0002\u02da\u02db\u0007R\u0002\u0002\u02db\u02dc", - "\u0007R\u0002\u0002\u02dc\u02dd\u0007N\u0002\u0002\u02dd\u02df\u0007", - "[\u0002\u0002\u02de\u02d3\u0003\u0002\u0002\u0002\u02de\u02d9\u0003", - "\u0002\u0002\u0002\u02df>\u0003\u0002\u0002\u0002\u02e0\u02e1\u0005", - "\u01a9\u00d5\u0002\u02e1\u02e2\u0005\u01cd\u00e7\u0002\u02e2\u02e6\u0003", - "\u0002\u0002\u0002\u02e3\u02e4\u0007C\u0002\u0002\u02e4\u02e6\u0007", - "U\u0002\u0002\u02e5\u02e0\u0003\u0002\u0002\u0002\u02e5\u02e3\u0003", - "\u0002\u0002\u0002\u02e6@\u0003\u0002\u0002\u0002\u02e7\u02e8\u0005", - "\u01a9\u00d5\u0002\u02e8\u02e9\u0005\u01cd\u00e7\u0002\u02e9\u02ea\u0005", - "\u01ad\u00d7\u0002\u02ea\u02ef\u0003\u0002\u0002\u0002\u02eb\u02ec\u0007", - "C\u0002\u0002\u02ec\u02ed\u0007U\u0002\u0002\u02ed\u02ef\u0007E\u0002", - "\u0002\u02ee\u02e7\u0003\u0002\u0002\u0002\u02ee\u02eb\u0003\u0002\u0002", - "\u0002\u02efB\u0003\u0002\u0002\u0002\u02f0\u02f1\u0005\u01a9\u00d5", - "\u0002\u02f1\u02f2\u0005\u01d1\u00e9\u0002\u02f2\u02f3\u0005\u01cf\u00e8", - "\u0002\u02f3\u02f4\u0005\u01b7\u00dc\u0002\u02f4\u02f5\u0005\u01c5\u00e3", - "\u0002\u02f5\u02f6\u0005\u01cb\u00e6\u0002\u02f6\u02f7\u0005\u01b9\u00dd", - "\u0002\u02f7\u02f8\u0005\u01db\u00ee\u0002\u02f8\u02f9\u0005\u01b1\u00d9", - "\u0002\u02f9\u0304\u0003\u0002\u0002\u0002\u02fa\u02fb\u0007C\u0002", - "\u0002\u02fb\u02fc\u0007W\u0002\u0002\u02fc\u02fd\u0007V\u0002\u0002", - "\u02fd\u02fe\u0007J\u0002\u0002\u02fe\u02ff\u0007Q\u0002\u0002\u02ff", - "\u0300\u0007T\u0002\u0002\u0300\u0301\u0007K\u0002\u0002\u0301\u0302", - "\u0007\\\u0002\u0002\u0302\u0304\u0007G\u0002\u0002\u0303\u02f0\u0003", - "\u0002\u0002\u0002\u0303\u02fa\u0003\u0002\u0002\u0002\u0304D\u0003", - "\u0002\u0002\u0002\u0305\u0306\u0005\u01ab\u00d6\u0002\u0306\u0307\u0005", - "\u01a9\u00d5\u0002\u0307\u0308\u0005\u01cf\u00e8\u0002\u0308\u0309\u0005", - "\u01ad\u00d7\u0002\u0309\u030a\u0005\u01b7\u00dc\u0002\u030a\u0311\u0003", - "\u0002\u0002\u0002\u030b\u030c\u0007D\u0002\u0002\u030c\u030d\u0007", - "C\u0002\u0002\u030d\u030e\u0007V\u0002\u0002\u030e\u030f\u0007E\u0002", - "\u0002\u030f\u0311\u0007J\u0002\u0002\u0310\u0305\u0003\u0002\u0002", - "\u0002\u0310\u030b\u0003\u0002\u0002\u0002\u0311F\u0003\u0002\u0002", - "\u0002\u0312\u0313\u0005\u01ab\u00d6\u0002\u0313\u0314\u0005\u01b1\u00d9", - "\u0002\u0314\u0315\u0005\u01b5\u00db\u0002\u0315\u0316\u0005\u01b9\u00dd", - "\u0002\u0316\u0317\u0005\u01c3\u00e2\u0002\u0317\u031e\u0003\u0002\u0002", - "\u0002\u0318\u0319\u0007D\u0002\u0002\u0319\u031a\u0007G\u0002\u0002", - "\u031a\u031b\u0007I\u0002\u0002\u031b\u031c\u0007K\u0002\u0002\u031c", - "\u031e\u0007P\u0002\u0002\u031d\u0312\u0003\u0002\u0002\u0002\u031d", - "\u0318\u0003\u0002\u0002\u0002\u031eH\u0003\u0002\u0002\u0002\u031f", - "\u0320\u0005\u01ab\u00d6\u0002\u0320\u0321\u0005\u01d9\u00ed\u0002\u0321", - "\u0325\u0003\u0002\u0002\u0002\u0322\u0323\u0007D\u0002\u0002\u0323", - "\u0325\u0007[\u0002\u0002\u0324\u031f\u0003\u0002\u0002\u0002\u0324", - "\u0322\u0003\u0002\u0002\u0002\u0325J\u0003\u0002\u0002\u0002\u0326", - "\u0327\u0005\u01ad\u00d7\u0002\u0327\u0328\u0005\u01a9\u00d5\u0002\u0328", - "\u0329\u0005\u01bf\u00e0\u0002\u0329\u032a\u0005\u01bf\u00e0\u0002\u032a", - "\u032b\u0005\u01b1\u00d9\u0002\u032b\u032c\u0005\u01af\u00d8\u0002\u032c", - "\u0334\u0003\u0002\u0002\u0002\u032d\u032e\u0007E\u0002\u0002\u032e", - "\u032f\u0007C\u0002\u0002\u032f\u0330\u0007N\u0002\u0002\u0330\u0331", - "\u0007N\u0002\u0002\u0331\u0332\u0007G\u0002\u0002\u0332\u0334\u0007", - "F\u0002\u0002\u0333\u0326\u0003\u0002\u0002\u0002\u0333\u032d\u0003", - "\u0002\u0002\u0002\u0334L\u0003\u0002\u0002\u0002\u0335\u0336\u0005", - "\u01ad\u00d7\u0002\u0336\u0337\u0005\u01bf\u00e0\u0002\u0337\u0338\u0005", - "\u01d1\u00e9\u0002\u0338\u0339\u0005\u01cd\u00e7\u0002\u0339\u033a\u0005", - "\u01cf\u00e8\u0002\u033a\u033b\u0005\u01b1\u00d9\u0002\u033b\u033c\u0005", - "\u01cb\u00e6\u0002\u033c\u033d\u0005\u01b9\u00dd\u0002\u033d\u033e\u0005", - "\u01c3\u00e2\u0002\u033e\u033f\u0005\u01b5\u00db\u0002\u033f\u034b\u0003", - "\u0002\u0002\u0002\u0340\u0341\u0007E\u0002\u0002\u0341\u0342\u0007", - "N\u0002\u0002\u0342\u0343\u0007W\u0002\u0002\u0343\u0344\u0007U\u0002", - "\u0002\u0344\u0345\u0007V\u0002\u0002\u0345\u0346\u0007G\u0002\u0002", - "\u0346\u0347\u0007T\u0002\u0002\u0347\u0348\u0007K\u0002\u0002\u0348", - "\u0349\u0007P\u0002\u0002\u0349\u034b\u0007I\u0002\u0002\u034a\u0335", - "\u0003\u0002\u0002\u0002\u034a\u0340\u0003\u0002\u0002\u0002\u034bN", - "\u0003\u0002\u0002\u0002\u034c\u034d\u0005\u01ad\u00d7\u0002\u034d\u034e", - "\u0005\u01c5\u00e3\u0002\u034e\u034f\u0005\u01bf\u00e0\u0002\u034f\u0350", - "\u0005\u01d1\u00e9\u0002\u0350\u0351\u0005\u01c1\u00e1\u0002\u0351\u0352", - "\u0005\u01c3\u00e2\u0002\u0352\u0353\u0005\u01b3\u00da\u0002\u0353\u0354", - "\u0005\u01a9\u00d5\u0002\u0354\u0355\u0005\u01c1\u00e1\u0002\u0355\u0356", - "\u0005\u01b9\u00dd\u0002\u0356\u0357\u0005\u01bf\u00e0\u0002\u0357\u0358", - "\u0005\u01d9\u00ed\u0002\u0358\u0366\u0003\u0002\u0002\u0002\u0359\u035a", - "\u0007E\u0002\u0002\u035a\u035b\u0007Q\u0002\u0002\u035b\u035c\u0007", - "N\u0002\u0002\u035c\u035d\u0007W\u0002\u0002\u035d\u035e\u0007O\u0002", - "\u0002\u035e\u035f\u0007P\u0002\u0002\u035f\u0360\u0007H\u0002\u0002", - "\u0360\u0361\u0007C\u0002\u0002\u0361\u0362\u0007O\u0002\u0002\u0362", - "\u0363\u0007K\u0002\u0002\u0363\u0364\u0007N\u0002\u0002\u0364\u0366", - "\u0007[\u0002\u0002\u0365\u034c\u0003\u0002\u0002\u0002\u0365\u0359", - "\u0003\u0002\u0002\u0002\u0366P\u0003\u0002\u0002\u0002\u0367\u0368", - "\u0005\u01ad\u00d7\u0002\u0368\u0369\u0005\u01c5\u00e3\u0002\u0369\u036a", - "\u0005\u01c1\u00e1\u0002\u036a\u036b\u0005\u01c7\u00e4\u0002\u036b\u036c", - "\u0005\u01a9\u00d5\u0002\u036c\u036d\u0005\u01ad\u00d7\u0002\u036d\u036e", - "\u0005\u01cf\u00e8\u0002\u036e\u0377\u0003\u0002\u0002\u0002\u036f\u0370", - "\u0007E\u0002\u0002\u0370\u0371\u0007Q\u0002\u0002\u0371\u0372\u0007", - "O\u0002\u0002\u0372\u0373\u0007R\u0002\u0002\u0373\u0374\u0007C\u0002", - "\u0002\u0374\u0375\u0007E\u0002\u0002\u0375\u0377\u0007V\u0002\u0002", - "\u0376\u0367\u0003\u0002\u0002\u0002\u0376\u036f\u0003\u0002\u0002\u0002", - "\u0377R\u0003\u0002\u0002\u0002\u0378\u0379\u0005\u01ad\u00d7\u0002", - "\u0379\u037a\u0005\u01c5\u00e3\u0002\u037a\u037b\u0005\u01c3\u00e2\u0002", - "\u037b\u037c\u0005\u01cd\u00e7\u0002\u037c\u037d\u0005\u01b9\u00dd\u0002", - "\u037d\u037e\u0005\u01cd\u00e7\u0002\u037e\u037f\u0005\u01cf\u00e8\u0002", - "\u037f\u0380\u0005\u01b1\u00d9\u0002\u0380\u0381\u0005\u01c3\u00e2\u0002", - "\u0381\u0382\u0005\u01ad\u00d7\u0002\u0382\u0383\u0005\u01d9\u00ed\u0002", - "\u0383\u0390\u0003\u0002\u0002\u0002\u0384\u0385\u0007E\u0002\u0002", - "\u0385\u0386\u0007Q\u0002\u0002\u0386\u0387\u0007P\u0002\u0002\u0387", - "\u0388\u0007U\u0002\u0002\u0388\u0389\u0007K\u0002\u0002\u0389\u038a", - "\u0007U\u0002\u0002\u038a\u038b\u0007V\u0002\u0002\u038b\u038c\u0007", - "G\u0002\u0002\u038c\u038d\u0007P\u0002\u0002\u038d\u038e\u0007E\u0002", - "\u0002\u038e\u0390\u0007[\u0002\u0002\u038f\u0378\u0003\u0002\u0002", - "\u0002\u038f\u0384\u0003\u0002\u0002\u0002\u0390T\u0003\u0002\u0002", - "\u0002\u0391\u0392\u0005\u01ad\u00d7\u0002\u0392\u0393\u0005\u01c5\u00e3", - "\u0002\u0393\u0394\u0005\u01c3\u00e2\u0002\u0394\u0395\u0005\u01cf\u00e8", - "\u0002\u0395\u0396\u0005\u01a9\u00d5\u0002\u0396\u0397\u0005\u01b9\u00dd", - "\u0002\u0397\u0398\u0005\u01c3\u00e2\u0002\u0398\u0399\u0005\u01cd\u00e7", - "\u0002\u0399\u03a3\u0003\u0002\u0002\u0002\u039a\u039b\u0007E\u0002", - "\u0002\u039b\u039c\u0007Q\u0002\u0002\u039c\u039d\u0007P\u0002\u0002", - "\u039d\u039e\u0007V\u0002\u0002\u039e\u039f\u0007C\u0002\u0002\u039f", - "\u03a0\u0007K\u0002\u0002\u03a0\u03a1\u0007P\u0002\u0002\u03a1\u03a3", - "\u0007U\u0002\u0002\u03a2\u0391\u0003\u0002\u0002\u0002\u03a2\u039a", - "\u0003\u0002\u0002\u0002\u03a3V\u0003\u0002\u0002\u0002\u03a4\u03a5", - "\u0005\u01ad\u00d7\u0002\u03a5\u03a6\u0005\u01cb\u00e6\u0002\u03a6\u03a7", - "\u0005\u01b1\u00d9\u0002\u03a7\u03a8\u0005\u01a9\u00d5\u0002\u03a8\u03a9", - "\u0005\u01cf\u00e8\u0002\u03a9\u03aa\u0005\u01b1\u00d9\u0002\u03aa\u03b2", - "\u0003\u0002\u0002\u0002\u03ab\u03ac\u0007E\u0002\u0002\u03ac\u03ad", - "\u0007T\u0002\u0002\u03ad\u03ae\u0007G\u0002\u0002\u03ae\u03af\u0007", - "C\u0002\u0002\u03af\u03b0\u0007V\u0002\u0002\u03b0\u03b2\u0007G\u0002", - "\u0002\u03b1\u03a4\u0003\u0002\u0002\u0002\u03b1\u03ab\u0003\u0002\u0002", - "\u0002\u03b2X\u0003\u0002\u0002\u0002\u03b3\u03b4\u0005\u01ad\u00d7", - "\u0002\u03b4\u03b5\u0005\u01d1\u00e9\u0002\u03b5\u03b6\u0005\u01cd\u00e7", - "\u0002\u03b6\u03b7\u0005\u01cf\u00e8\u0002\u03b7\u03b8\u0005\u01c5\u00e3", - "\u0002\u03b8\u03b9\u0005\u01c1\u00e1\u0002\u03b9\u03c1\u0003\u0002\u0002", - "\u0002\u03ba\u03bb\u0007E\u0002\u0002\u03bb\u03bc\u0007W\u0002\u0002", - "\u03bc\u03bd\u0007U\u0002\u0002\u03bd\u03be\u0007V\u0002\u0002\u03be", - "\u03bf\u0007Q\u0002\u0002\u03bf\u03c1\u0007O\u0002\u0002\u03c0\u03b3", - "\u0003\u0002\u0002\u0002\u03c0\u03ba\u0003\u0002\u0002\u0002\u03c1Z", - "\u0003\u0002\u0002\u0002\u03c2\u03c3\u0005\u01cd\u00e7\u0002\u03c3\u03c4", - "\u0005\u01b1\u00d9\u0002\u03c4\u03c5\u0005\u01a9\u00d5\u0002\u03c5\u03c6", - "\u0005\u01cb\u00e6\u0002\u03c6\u03c7\u0005\u01ad\u00d7\u0002\u03c7\u03c8", - "\u0005\u01b7\u00dc\u0002\u03c8\u03d0\u0003\u0002\u0002\u0002\u03c9\u03ca", - "\u0007U\u0002\u0002\u03ca\u03cb\u0007G\u0002\u0002\u03cb\u03cc\u0007", - "C\u0002\u0002\u03cc\u03cd\u0007T\u0002\u0002\u03cd\u03ce\u0007E\u0002", - "\u0002\u03ce\u03d0\u0007J\u0002\u0002\u03cf\u03c2\u0003\u0002\u0002", - "\u0002\u03cf\u03c9\u0003\u0002\u0002\u0002\u03d0\\\u0003\u0002\u0002", - "\u0002\u03d1\u03d2\u0005\u01af\u00d8\u0002\u03d2\u03d3\u0005\u01b1\u00d9", - "\u0002\u03d3\u03d4\u0005\u01bf\u00e0\u0002\u03d4\u03d5\u0005\u01b1\u00d9", - "\u0002\u03d5\u03d6\u0005\u01cf\u00e8\u0002\u03d6\u03d7\u0005\u01b1\u00d9", - "\u0002\u03d7\u03df\u0003\u0002\u0002\u0002\u03d8\u03d9\u0007F\u0002", - "\u0002\u03d9\u03da\u0007G\u0002\u0002\u03da\u03db\u0007N\u0002\u0002", - "\u03db\u03dc\u0007G\u0002\u0002\u03dc\u03dd\u0007V\u0002\u0002\u03dd", - "\u03df\u0007G\u0002\u0002\u03de\u03d1\u0003\u0002\u0002\u0002\u03de", - "\u03d8\u0003\u0002\u0002\u0002\u03df^\u0003\u0002\u0002\u0002\u03e0", - "\u03e1\u0005\u01af\u00d8\u0002\u03e1\u03e2\u0005\u01b1\u00d9\u0002\u03e2", - "\u03e3\u0005\u01cd\u00e7\u0002\u03e3\u03e4\u0005\u01ad\u00d7\u0002\u03e4", - "\u03ea\u0003\u0002\u0002\u0002\u03e5\u03e6\u0007F\u0002\u0002\u03e6", - "\u03e7\u0007G\u0002\u0002\u03e7\u03e8\u0007U\u0002\u0002\u03e8\u03ea", - "\u0007E\u0002\u0002\u03e9\u03e0\u0003\u0002\u0002\u0002\u03e9\u03e5", - "\u0003\u0002\u0002\u0002\u03ea`\u0003\u0002\u0002\u0002\u03eb\u03ec", - "\u0005\u01af\u00d8\u0002\u03ec\u03ed\u0005\u01b1\u00d9\u0002\u03ed\u03ee", - "\u0005\u01cd\u00e7\u0002\u03ee\u03ef\u0005\u01ad\u00d7\u0002\u03ef\u03f0", - "\u0005\u01cb\u00e6\u0002\u03f0\u03f1\u0005\u01b9\u00dd\u0002\u03f1\u03f2", - "\u0005\u01ab\u00d6\u0002\u03f2\u03f3\u0005\u01b1\u00d9\u0002\u03f3\u03fd", - "\u0003\u0002\u0002\u0002\u03f4\u03f5\u0007F\u0002\u0002\u03f5\u03f6", - "\u0007G\u0002\u0002\u03f6\u03f7\u0007U\u0002\u0002\u03f7\u03f8\u0007", - "E\u0002\u0002\u03f8\u03f9\u0007T\u0002\u0002\u03f9\u03fa\u0007K\u0002", - "\u0002\u03fa\u03fb\u0007D\u0002\u0002\u03fb\u03fd\u0007G\u0002\u0002", - "\u03fc\u03eb\u0003\u0002\u0002\u0002\u03fc\u03f4\u0003\u0002\u0002\u0002", - "\u03fdb\u0003\u0002\u0002\u0002\u03fe\u03ff\u0005\u01af\u00d8\u0002", - "\u03ff\u0400\u0005\u01b9\u00dd\u0002\u0400\u0401\u0005\u01cd\u00e7\u0002", - "\u0401\u0402\u0005\u01cf\u00e8\u0002\u0402\u0403\u0005\u01b9\u00dd\u0002", - "\u0403\u0404\u0005\u01c3\u00e2\u0002\u0404\u0405\u0005\u01ad\u00d7\u0002", - "\u0405\u0406\u0005\u01cf\u00e8\u0002\u0406\u0410\u0003\u0002\u0002\u0002", - "\u0407\u0408\u0007F\u0002\u0002\u0408\u0409\u0007K\u0002\u0002\u0409", - "\u040a\u0007U\u0002\u0002\u040a\u040b\u0007V\u0002\u0002\u040b\u040c", - "\u0007K\u0002\u0002\u040c\u040d\u0007P\u0002\u0002\u040d\u040e\u0007", - "E\u0002\u0002\u040e\u0410\u0007V\u0002\u0002\u040f\u03fe\u0003\u0002", - "\u0002\u0002\u040f\u0407\u0003\u0002\u0002\u0002\u0410d\u0003\u0002", - "\u0002\u0002\u0411\u0412\u0005\u01af\u00d8\u0002\u0412\u0413\u0005\u01cb", - "\u00e6\u0002\u0413\u0414\u0005\u01c5\u00e3\u0002\u0414\u0415\u0005\u01c7", - "\u00e4\u0002\u0415\u041b\u0003\u0002\u0002\u0002\u0416\u0417\u0007F", - "\u0002\u0002\u0417\u0418\u0007T\u0002\u0002\u0418\u0419\u0007Q\u0002", - "\u0002\u0419\u041b\u0007R\u0002\u0002\u041a\u0411\u0003\u0002\u0002", - "\u0002\u041a\u0416\u0003\u0002\u0002\u0002\u041bf\u0003\u0002\u0002", - "\u0002\u041c\u041d\u0005\u01af\u00d8\u0002\u041d\u041e\u0005\u01d1\u00e9", - "\u0002\u041e\u041f\u0005\u01cb\u00e6\u0002\u041f\u0420\u0005\u01a9\u00d5", - "\u0002\u0420\u0421\u0005\u01ab\u00d6\u0002\u0421\u0422\u0005\u01bf\u00e0", - "\u0002\u0422\u0423\u0005\u01b1\u00d9\u0002\u0423\u0424\u0007a\u0002", - "\u0002\u0424\u0425\u0005\u01d5\u00eb\u0002\u0425\u0426\u0005\u01cb\u00e6", - "\u0002\u0426\u0427\u0005\u01b9\u00dd\u0002\u0427\u0428\u0005\u01cf\u00e8", - "\u0002\u0428\u0429\u0005\u01b1\u00d9\u0002\u0429\u042a\u0005\u01cd\u00e7", - "\u0002\u042a\u043a\u0003\u0002\u0002\u0002\u042b\u042c\u0007F\u0002", - "\u0002\u042c\u042d\u0007W\u0002\u0002\u042d\u042e\u0007T\u0002\u0002", - "\u042e\u042f\u0007C\u0002\u0002\u042f\u0430\u0007D\u0002\u0002\u0430", - "\u0431\u0007N\u0002\u0002\u0431\u0432\u0007G\u0002\u0002\u0432\u0433", - "\u0007a\u0002\u0002\u0433\u0434\u0007Y\u0002\u0002\u0434\u0435\u0007", - "T\u0002\u0002\u0435\u0436\u0007K\u0002\u0002\u0436\u0437\u0007V\u0002", - "\u0002\u0437\u0438\u0007G\u0002\u0002\u0438\u043a\u0007U\u0002\u0002", - "\u0439\u041c\u0003\u0002\u0002\u0002\u0439\u042b\u0003\u0002\u0002\u0002", - "\u043ah\u0003\u0002\u0002\u0002\u043b\u043c\u0005\u01b1\u00d9\u0002", - "\u043c\u043d\u0005\u01a9\u00d5\u0002\u043d\u043e\u0005\u01ad\u00d7\u0002", - "\u043e\u043f\u0005\u01b7\u00dc\u0002\u043f\u0440\u0007a\u0002\u0002", - "\u0440\u0441\u0005\u01c9\u00e5\u0002\u0441\u0442\u0005\u01d1\u00e9\u0002", - "\u0442\u0443\u0005\u01c5\u00e3\u0002\u0443\u0444\u0005\u01cb\u00e6\u0002", - "\u0444\u0445\u0005\u01d1\u00e9\u0002\u0445\u0446\u0005\u01c1\u00e1\u0002", - "\u0446\u0453\u0003\u0002\u0002\u0002\u0447\u0448\u0007G\u0002\u0002", - "\u0448\u0449\u0007C\u0002\u0002\u0449\u044a\u0007E\u0002\u0002\u044a", - "\u044b\u0007J\u0002\u0002\u044b\u044c\u0007a\u0002\u0002\u044c\u044d", - "\u0007S\u0002\u0002\u044d\u044e\u0007W\u0002\u0002\u044e\u044f\u0007", - "Q\u0002\u0002\u044f\u0450\u0007T\u0002\u0002\u0450\u0451\u0007W\u0002", - "\u0002\u0451\u0453\u0007O\u0002\u0002\u0452\u043b\u0003\u0002\u0002", - "\u0002\u0452\u0447\u0003\u0002\u0002\u0002\u0453j\u0003\u0002\u0002", - "\u0002\u0454\u0455\u0005\u01b1\u00d9\u0002\u0455\u0456\u0005\u01c3\u00e2", - "\u0002\u0456\u0457\u0005\u01cf\u00e8\u0002\u0457\u0458\u0005\u01cb\u00e6", - "\u0002\u0458\u0459\u0005\u01b9\u00dd\u0002\u0459\u045a\u0005\u01b1\u00d9", - "\u0002\u045a\u045b\u0005\u01cd\u00e7\u0002\u045b\u0464\u0003\u0002\u0002", - "\u0002\u045c\u045d\u0007G\u0002\u0002\u045d\u045e\u0007P\u0002\u0002", - "\u045e\u045f\u0007V\u0002\u0002\u045f\u0460\u0007T\u0002\u0002\u0460", - "\u0461\u0007K\u0002\u0002\u0461\u0462\u0007G\u0002\u0002\u0462\u0464", - "\u0007U\u0002\u0002\u0463\u0454\u0003\u0002\u0002\u0002\u0463\u045c", - "\u0003\u0002\u0002\u0002\u0464l\u0003\u0002\u0002\u0002\u0465\u0466", - "\u0005\u01b1\u00d9\u0002\u0466\u0467\u0005\u01d7\u00ec\u0002\u0467\u0468", - "\u0005\u01b1\u00d9\u0002\u0468\u0469\u0005\u01ad\u00d7\u0002\u0469\u046a", - "\u0005\u01d1\u00e9\u0002\u046a\u046b\u0005\u01cf\u00e8\u0002\u046b\u046c", - "\u0005\u01b1\u00d9\u0002\u046c\u0475\u0003\u0002\u0002\u0002\u046d\u046e", - "\u0007G\u0002\u0002\u046e\u046f\u0007Z\u0002\u0002\u046f\u0470\u0007", - "G\u0002\u0002\u0470\u0471\u0007E\u0002\u0002\u0471\u0472\u0007W\u0002", - "\u0002\u0472\u0473\u0007V\u0002\u0002\u0473\u0475\u0007G\u0002\u0002", - "\u0474\u0465\u0003\u0002\u0002\u0002\u0474\u046d\u0003\u0002\u0002\u0002", - "\u0475n\u0003\u0002\u0002\u0002\u0476\u0477\u0005\u01b1\u00d9\u0002", - "\u0477\u0478\u0005\u01d7\u00ec\u0002\u0478\u0479\u0005\u01b9\u00dd\u0002", - "\u0479\u047a\u0005\u01cd\u00e7\u0002\u047a\u047b\u0005\u01cf\u00e8\u0002", - "\u047b\u047c\u0005\u01cd\u00e7\u0002\u047c\u0484\u0003\u0002\u0002\u0002", - "\u047d\u047e\u0007G\u0002\u0002\u047e\u047f\u0007Z\u0002\u0002\u047f", - "\u0480\u0007K\u0002\u0002\u0480\u0481\u0007U\u0002\u0002\u0481\u0482", - "\u0007V\u0002\u0002\u0482\u0484\u0007U\u0002\u0002\u0483\u0476\u0003", - "\u0002\u0002\u0002\u0483\u047d\u0003\u0002\u0002\u0002\u0484p\u0003", - "\u0002\u0002\u0002\u0485\u0486\u0005\u01b3\u00da\u0002\u0486\u0487\u0005", - "\u01a9\u00d5\u0002\u0487\u0488\u0005\u01bf\u00e0\u0002\u0488\u0489\u0005", - "\u01cd\u00e7\u0002\u0489\u048a\u0005\u01b1\u00d9\u0002\u048a\u0499\u0003", - "\u0002\u0002\u0002\u048b\u048c\u0007H\u0002\u0002\u048c\u048d\u0007", - "C\u0002\u0002\u048d\u048e\u0007N\u0002\u0002\u048e\u048f\u0007U\u0002", - "\u0002\u048f\u0499\u0007G\u0002\u0002\u0490\u0491\u0005-\u0017\u0002", - "\u0491\u0492\u0005\u01b3\u00da\u0002\u0492\u0493\u0005\u01a9\u00d5\u0002", - "\u0493\u0494\u0005\u01bf\u00e0\u0002\u0494\u0495\u0005\u01cd\u00e7\u0002", - "\u0495\u0496\u0005\u01b1\u00d9\u0002\u0496\u0497\u0005-\u0017\u0002", - "\u0497\u0499\u0003\u0002\u0002\u0002\u0498\u0485\u0003\u0002\u0002\u0002", - "\u0498\u048b\u0003\u0002\u0002\u0002\u0498\u0490\u0003\u0002\u0002\u0002", - "\u0499r\u0003\u0002\u0002\u0002\u049a\u049b\u0005\u01b3\u00da\u0002", - "\u049b\u049c\u0005\u01b9\u00dd\u0002\u049c\u049d\u0005\u01bf\u00e0\u0002", - "\u049d\u049e\u0005\u01cf\u00e8\u0002\u049e\u049f\u0005\u01b1\u00d9\u0002", - "\u049f\u04a0\u0005\u01cb\u00e6\u0002\u04a0\u04a1\u0005\u01b9\u00dd\u0002", - "\u04a1\u04a2\u0005\u01c3\u00e2\u0002\u04a2\u04a3\u0005\u01b5\u00db\u0002", - "\u04a3\u04ae\u0003\u0002\u0002\u0002\u04a4\u04a5\u0007H\u0002\u0002", - "\u04a5\u04a6\u0007K\u0002\u0002\u04a6\u04a7\u0007N\u0002\u0002\u04a7", - "\u04a8\u0007V\u0002\u0002\u04a8\u04a9\u0007G\u0002\u0002\u04a9\u04aa", - "\u0007T\u0002\u0002\u04aa\u04ab\u0007K\u0002\u0002\u04ab\u04ac\u0007", - "P\u0002\u0002\u04ac\u04ae\u0007I\u0002\u0002\u04ad\u049a\u0003\u0002", - "\u0002\u0002\u04ad\u04a4\u0003\u0002\u0002\u0002\u04aet\u0003\u0002", - "\u0002\u0002\u04af\u04b0\u0005\u01b3\u00da\u0002\u04b0\u04b1\u0005\u01b9", - "\u00dd\u0002\u04b1\u04b2\u0005\u01c3\u00e2\u0002\u04b2\u04b3\u0005\u01a9", - "\u00d5\u0002\u04b3\u04b4\u0005\u01bf\u00e0\u0002\u04b4\u04b5\u0005\u01b3", - "\u00da\u0002\u04b5\u04b6\u0005\u01d1\u00e9\u0002\u04b6\u04b7\u0005\u01c3", - "\u00e2\u0002\u04b7\u04b8\u0005\u01ad\u00d7\u0002\u04b8\u04c3\u0003\u0002", - "\u0002\u0002\u04b9\u04ba\u0007H\u0002\u0002\u04ba\u04bb\u0007K\u0002", - "\u0002\u04bb\u04bc\u0007P\u0002\u0002\u04bc\u04bd\u0007C\u0002\u0002", - "\u04bd\u04be\u0007N\u0002\u0002\u04be\u04bf\u0007H\u0002\u0002\u04bf", - "\u04c0\u0007W\u0002\u0002\u04c0\u04c1\u0007P\u0002\u0002\u04c1\u04c3", - "\u0007E\u0002\u0002\u04c2\u04af\u0003\u0002\u0002\u0002\u04c2\u04b9", - "\u0003\u0002\u0002\u0002\u04c3v\u0003\u0002\u0002\u0002\u04c4\u04c5", - "\u0005\u01b3\u00da\u0002\u04c5\u04c6\u0005\u01cb\u00e6\u0002\u04c6\u04c7", - "\u0005\u01c5\u00e3\u0002\u04c7\u04c8\u0005\u01c1\u00e1\u0002\u04c8\u04ce", - "\u0003\u0002\u0002\u0002\u04c9\u04ca\u0007H\u0002\u0002\u04ca\u04cb", - "\u0007T\u0002\u0002\u04cb\u04cc\u0007Q\u0002\u0002\u04cc\u04ce\u0007", - "O\u0002\u0002\u04cd\u04c4\u0003\u0002\u0002\u0002\u04cd\u04c9\u0003", - "\u0002\u0002\u0002\u04cex\u0003\u0002\u0002\u0002\u04cf\u04d0\u0005", - "\u01b3\u00da\u0002\u04d0\u04d1\u0005\u01d1\u00e9\u0002\u04d1\u04d2\u0005", - "\u01bf\u00e0\u0002\u04d2\u04d3\u0005\u01bf\u00e0\u0002\u04d3\u04d9\u0003", - "\u0002\u0002\u0002\u04d4\u04d5\u0007H\u0002\u0002\u04d5\u04d6\u0007", - "W\u0002\u0002\u04d6\u04d7\u0007N\u0002\u0002\u04d7\u04d9\u0007N\u0002", - "\u0002\u04d8\u04cf\u0003\u0002\u0002\u0002\u04d8\u04d4\u0003\u0002\u0002", - "\u0002\u04d9z\u0003\u0002\u0002\u0002\u04da\u04db\u0005\u01b3\u00da", - "\u0002\u04db\u04dc\u0005\u01d1\u00e9\u0002\u04dc\u04dd\u0005\u01c3\u00e2", - "\u0002\u04dd\u04de\u0005\u01ad\u00d7\u0002\u04de\u04df\u0005\u01cf\u00e8", - "\u0002\u04df\u04e0\u0005\u01b9\u00dd\u0002\u04e0\u04e1\u0005\u01c5\u00e3", - "\u0002\u04e1\u04e2\u0005\u01c3\u00e2\u0002\u04e2\u04ec\u0003\u0002\u0002", - "\u0002\u04e3\u04e4\u0007H\u0002\u0002\u04e4\u04e5\u0007W\u0002\u0002", - "\u04e5\u04e6\u0007P\u0002\u0002\u04e6\u04e7\u0007E\u0002\u0002\u04e7", - "\u04e8\u0007V\u0002\u0002\u04e8\u04e9\u0007K\u0002\u0002\u04e9\u04ea", - "\u0007Q\u0002\u0002\u04ea\u04ec\u0007P\u0002\u0002\u04eb\u04da\u0003", - "\u0002\u0002\u0002\u04eb\u04e3\u0003\u0002\u0002\u0002\u04ec|\u0003", - "\u0002\u0002\u0002\u04ed\u04ee\u0005\u01b3\u00da\u0002\u04ee\u04ef\u0005", - "\u01d1\u00e9\u0002\u04ef\u04f0\u0005\u01c3\u00e2\u0002\u04f0\u04f1\u0005", - "\u01ad\u00d7\u0002\u04f1\u04f2\u0005\u01cf\u00e8\u0002\u04f2\u04f3\u0005", - "\u01b9\u00dd\u0002\u04f3\u04f4\u0005\u01c5\u00e3\u0002\u04f4\u04f5\u0005", - "\u01c3\u00e2\u0002\u04f5\u04f6\u0005\u01cd\u00e7\u0002\u04f6\u0501\u0003", - "\u0002\u0002\u0002\u04f7\u04f8\u0007H\u0002\u0002\u04f8\u04f9\u0007", - "W\u0002\u0002\u04f9\u04fa\u0007P\u0002\u0002\u04fa\u04fb\u0007E\u0002", - "\u0002\u04fb\u04fc\u0007V\u0002\u0002\u04fc\u04fd\u0007K\u0002\u0002", - "\u04fd\u04fe\u0007Q\u0002\u0002\u04fe\u04ff\u0007P\u0002\u0002\u04ff", - "\u0501\u0007U\u0002\u0002\u0500\u04ed\u0003\u0002\u0002\u0002\u0500", - "\u04f7\u0003\u0002\u0002\u0002\u0501~\u0003\u0002\u0002\u0002\u0502", - "\u0503\u0005\u01b5\u00db\u0002\u0503\u0504\u0005\u01cb\u00e6\u0002\u0504", - "\u0505\u0005\u01a9\u00d5\u0002\u0505\u0506\u0005\u01c3\u00e2\u0002\u0506", - "\u0507\u0005\u01cf\u00e8\u0002\u0507\u050e\u0003\u0002\u0002\u0002\u0508", - "\u0509\u0007I\u0002\u0002\u0509\u050a\u0007T\u0002\u0002\u050a\u050b", - "\u0007C\u0002\u0002\u050b\u050c\u0007P\u0002\u0002\u050c\u050e\u0007", - "V\u0002\u0002\u050d\u0502\u0003\u0002\u0002\u0002\u050d\u0508\u0003", - "\u0002\u0002\u0002\u050e\u0080\u0003\u0002\u0002\u0002\u050f\u0510\u0005", - "\u01b9\u00dd\u0002\u0510\u0511\u0005\u01b3\u00da\u0002\u0511\u0515\u0003", - "\u0002\u0002\u0002\u0512\u0513\u0007K\u0002\u0002\u0513\u0515\u0007", - "H\u0002\u0002\u0514\u050f\u0003\u0002\u0002\u0002\u0514\u0512\u0003", - "\u0002\u0002\u0002\u0515\u0082\u0003\u0002\u0002\u0002\u0516\u0517\u0005", - "\u01b9\u00dd\u0002\u0517\u0518\u0005\u01c3\u00e2\u0002\u0518\u051c\u0003", - "\u0002\u0002\u0002\u0519\u051a\u0007K\u0002\u0002\u051a\u051c\u0007", - "P\u0002\u0002\u051b\u0516\u0003\u0002\u0002\u0002\u051b\u0519\u0003", - "\u0002\u0002\u0002\u051c\u0084\u0003\u0002\u0002\u0002\u051d\u051e\u0005", - "\u01b9\u00dd\u0002\u051e\u051f\u0005\u01c3\u00e2\u0002\u051f\u0520\u0005", - "\u01af\u00d8\u0002\u0520\u0521\u0005\u01b1\u00d9\u0002\u0521\u0522\u0005", - "\u01d7\u00ec\u0002\u0522\u0529\u0003\u0002\u0002\u0002\u0523\u0524\u0007", - "K\u0002\u0002\u0524\u0525\u0007P\u0002\u0002\u0525\u0526\u0007F\u0002", - "\u0002\u0526\u0527\u0007G\u0002\u0002\u0527\u0529\u0007Z\u0002\u0002", - "\u0528\u051d\u0003\u0002\u0002\u0002\u0528\u0523\u0003\u0002\u0002\u0002", - "\u0529\u0086\u0003\u0002\u0002\u0002\u052a\u052b\u0005\u01b9\u00dd\u0002", - "\u052b\u052c\u0005\u01c3\u00e2\u0002\u052c\u052d\u0005\u01b3\u00da\u0002", - "\u052d\u052e\u0005\u01b9\u00dd\u0002\u052e\u052f\u0005\u01c3\u00e2\u0002", - "\u052f\u0530\u0005\u01b9\u00dd\u0002\u0530\u0531\u0005\u01cf\u00e8\u0002", - "\u0531\u0532\u0005\u01d9\u00ed\u0002\u0532\u053c\u0003\u0002\u0002\u0002", - "\u0533\u0534\u0007K\u0002\u0002\u0534\u0535\u0007P\u0002\u0002\u0535", - "\u0536\u0007H\u0002\u0002\u0536\u0537\u0007K\u0002\u0002\u0537\u0538", - "\u0007P\u0002\u0002\u0538\u0539\u0007K\u0002\u0002\u0539\u053a\u0007", - "V\u0002\u0002\u053a\u053c\u0007[\u0002\u0002\u053b\u052a\u0003\u0002", - "\u0002\u0002\u053b\u0533\u0003\u0002\u0002\u0002\u053c\u0088\u0003\u0002", - "\u0002\u0002\u053d\u053e\u0005\u01b9\u00dd\u0002\u053e\u053f\u0005\u01c3", - "\u00e2\u0002\u053f\u0540\u0005\u01b9\u00dd\u0002\u0540\u0541\u0005\u01cf", - "\u00e8\u0002\u0541\u0542\u0005\u01ad\u00d7\u0002\u0542\u0543\u0005\u01c5", - "\u00e3\u0002\u0543\u0544\u0005\u01c3\u00e2\u0002\u0544\u0545\u0005\u01af", - "\u00d8\u0002\u0545\u054f\u0003\u0002\u0002\u0002\u0546\u0547\u0007K", - "\u0002\u0002\u0547\u0548\u0007P\u0002\u0002\u0548\u0549\u0007K\u0002", - "\u0002\u0549\u054a\u0007V\u0002\u0002\u054a\u054b\u0007E\u0002\u0002", - "\u054b\u054c\u0007Q\u0002\u0002\u054c\u054d\u0007P\u0002\u0002\u054d", - "\u054f\u0007F\u0002\u0002\u054e\u053d\u0003\u0002\u0002\u0002\u054e", - "\u0546\u0003\u0002\u0002\u0002\u054f\u008a\u0003\u0002\u0002\u0002\u0550", - "\u0551\u0005\u01b9\u00dd\u0002\u0551\u0552\u0005\u01c3\u00e2\u0002\u0552", - "\u0553\u0005\u01c7\u00e4\u0002\u0553\u0554\u0005\u01d1\u00e9\u0002\u0554", - "\u0555\u0005\u01cf\u00e8\u0002\u0555\u055c\u0003\u0002\u0002\u0002\u0556", - "\u0557\u0007K\u0002\u0002\u0557\u0558\u0007P\u0002\u0002\u0558\u0559", - "\u0007R\u0002\u0002\u0559\u055a\u0007W\u0002\u0002\u055a\u055c\u0007", - "V\u0002\u0002\u055b\u0550\u0003\u0002\u0002\u0002\u055b\u0556\u0003", - "\u0002\u0002\u0002\u055c\u008c\u0003\u0002\u0002\u0002\u055d\u055e\u0005", - "\u01b9\u00dd\u0002\u055e\u055f\u0005\u01c3\u00e2\u0002\u055f\u0560\u0005", - "\u01cd\u00e7\u0002\u0560\u0561\u0005\u01b1\u00d9\u0002\u0561\u0562\u0005", - "\u01cb\u00e6\u0002\u0562\u0563\u0005\u01cf\u00e8\u0002\u0563\u056b\u0003", - "\u0002\u0002\u0002\u0564\u0565\u0007K\u0002\u0002\u0565\u0566\u0007", - "P\u0002\u0002\u0566\u0567\u0007U\u0002\u0002\u0567\u0568\u0007G\u0002", - "\u0002\u0568\u0569\u0007T\u0002\u0002\u0569\u056b\u0007V\u0002\u0002", - "\u056a\u055d\u0003\u0002\u0002\u0002\u056a\u0564\u0003\u0002\u0002\u0002", - "\u056b\u008e\u0003\u0002\u0002\u0002\u056c\u056d\u0005\u01b9\u00dd\u0002", - "\u056d\u056e\u0005\u01c3\u00e2\u0002\u056e\u056f\u0005\u01cf\u00e8\u0002", - "\u056f\u0570\u0005\u01c5\u00e3\u0002\u0570\u0576\u0003\u0002\u0002\u0002", - "\u0571\u0572\u0007K\u0002\u0002\u0572\u0573\u0007P\u0002\u0002\u0573", - "\u0574\u0007V\u0002\u0002\u0574\u0576\u0007Q\u0002\u0002\u0575\u056c", - "\u0003\u0002\u0002\u0002\u0575\u0571\u0003\u0002\u0002\u0002\u0576\u0090", - "\u0003\u0002\u0002\u0002\u0577\u0578\u0005\u01b9\u00dd\u0002\u0578\u0579", - "\u0005\u01cd\u00e7\u0002\u0579\u057d\u0003\u0002\u0002\u0002\u057a\u057b", - "\u0007K\u0002\u0002\u057b\u057d\u0007U\u0002\u0002\u057c\u0577\u0003", - "\u0002\u0002\u0002\u057c\u057a\u0003\u0002\u0002\u0002\u057d\u0092\u0003", - "\u0002\u0002\u0002\u057e\u057f\u0005\u01bb\u00de\u0002\u057f\u0580\u0005", - "\u01cd\u00e7\u0002\u0580\u0581\u0005\u01c5\u00e3\u0002\u0581\u0582\u0005", - "\u01c3\u00e2\u0002\u0582\u0588\u0003\u0002\u0002\u0002\u0583\u0584\u0007", - "L\u0002\u0002\u0584\u0585\u0007U\u0002\u0002\u0585\u0586\u0007Q\u0002", - "\u0002\u0586\u0588\u0007P\u0002\u0002\u0587\u057e\u0003\u0002\u0002", - "\u0002\u0587\u0583\u0003\u0002\u0002\u0002\u0588\u0094\u0003\u0002\u0002", - "\u0002\u0589\u058a\u0005\u01bd\u00df\u0002\u058a\u058b\u0005\u01b1\u00d9", - "\u0002\u058b\u058c\u0005\u01d9\u00ed\u0002\u058c\u0591\u0003\u0002\u0002", - "\u0002\u058d\u058e\u0007M\u0002\u0002\u058e\u058f\u0007G\u0002\u0002", - "\u058f\u0591\u0007[\u0002\u0002\u0590\u0589\u0003\u0002\u0002\u0002", - "\u0590\u058d\u0003\u0002\u0002\u0002\u0591\u0096\u0003\u0002\u0002\u0002", - "\u0592\u0593\u0005\u01bd\u00df\u0002\u0593\u0594\u0005\u01b1\u00d9\u0002", - "\u0594\u0595\u0005\u01d9\u00ed\u0002\u0595\u0596\u0005\u01cd\u00e7\u0002", - "\u0596\u059c\u0003\u0002\u0002\u0002\u0597\u0598\u0007M\u0002\u0002", - "\u0598\u0599\u0007G\u0002\u0002\u0599\u059a\u0007[\u0002\u0002\u059a", - "\u059c\u0007U\u0002\u0002\u059b\u0592\u0003\u0002\u0002\u0002\u059b", - "\u0597\u0003\u0002\u0002\u0002\u059c\u0098\u0003\u0002\u0002\u0002\u059d", - "\u059e\u0005\u01bd\u00df\u0002\u059e\u059f\u0005\u01b1\u00d9\u0002\u059f", - "\u05a0\u0005\u01d9\u00ed\u0002\u05a0\u05a1\u0005\u01cd\u00e7\u0002\u05a1", - "\u05a2\u0005\u01c7\u00e4\u0002\u05a2\u05a3\u0005\u01a9\u00d5\u0002\u05a3", - "\u05a4\u0005\u01ad\u00d7\u0002\u05a4\u05a5\u0005\u01b1\u00d9\u0002\u05a5", - "\u05af\u0003\u0002\u0002\u0002\u05a6\u05a7\u0007M\u0002\u0002\u05a7", - "\u05a8\u0007G\u0002\u0002\u05a8\u05a9\u0007[\u0002\u0002\u05a9\u05aa", - "\u0007U\u0002\u0002\u05aa\u05ab\u0007R\u0002\u0002\u05ab\u05ac\u0007", - "C\u0002\u0002\u05ac\u05ad\u0007E\u0002\u0002\u05ad\u05af\u0007G\u0002", - "\u0002\u05ae\u059d\u0003\u0002\u0002\u0002\u05ae\u05a6\u0003\u0002\u0002", - "\u0002\u05af\u009a\u0003\u0002\u0002\u0002\u05b0\u05b1\u0005\u01bd\u00df", - "\u0002\u05b1\u05b2\u0005\u01b1\u00d9\u0002\u05b2\u05b3\u0005\u01d9\u00ed", - "\u0002\u05b3\u05b4\u0005\u01cd\u00e7\u0002\u05b4\u05b5\u0005\u01c7\u00e4", - "\u0002\u05b5\u05b6\u0005\u01a9\u00d5\u0002\u05b6\u05b7\u0005\u01ad\u00d7", - "\u0002\u05b7\u05b8\u0005\u01b1\u00d9\u0002\u05b8\u05b9\u0005\u01cd\u00e7", - "\u0002\u05b9\u05c4\u0003\u0002\u0002\u0002\u05ba\u05bb\u0007M\u0002", - "\u0002\u05bb\u05bc\u0007G\u0002\u0002\u05bc\u05bd\u0007[\u0002\u0002", - "\u05bd\u05be\u0007U\u0002\u0002\u05be\u05bf\u0007R\u0002\u0002\u05bf", - "\u05c0\u0007C\u0002\u0002\u05c0\u05c1\u0007E\u0002\u0002\u05c1\u05c2", - "\u0007G\u0002\u0002\u05c2\u05c4\u0007U\u0002\u0002\u05c3\u05b0\u0003", - "\u0002\u0002\u0002\u05c3\u05ba\u0003\u0002\u0002\u0002\u05c4\u009c\u0003", - "\u0002\u0002\u0002\u05c5\u05c6\u0005\u01bf\u00e0\u0002\u05c6\u05c7\u0005", - "\u01a9\u00d5\u0002\u05c7\u05c8\u0005\u01c3\u00e2\u0002\u05c8\u05c9\u0005", - "\u01b5\u00db\u0002\u05c9\u05ca\u0005\u01d1\u00e9\u0002\u05ca\u05cb\u0005", - "\u01a9\u00d5\u0002\u05cb\u05cc\u0005\u01b5\u00db\u0002\u05cc\u05cd\u0005", - "\u01b1\u00d9\u0002\u05cd\u05d7\u0003\u0002\u0002\u0002\u05ce\u05cf\u0007", - "N\u0002\u0002\u05cf\u05d0\u0007C\u0002\u0002\u05d0\u05d1\u0007P\u0002", - "\u0002\u05d1\u05d2\u0007I\u0002\u0002\u05d2\u05d3\u0007W\u0002\u0002", - "\u05d3\u05d4\u0007C\u0002\u0002\u05d4\u05d5\u0007I\u0002\u0002\u05d5", - "\u05d7\u0007G\u0002\u0002\u05d6\u05c5\u0003\u0002\u0002\u0002\u05d6", - "\u05ce\u0003\u0002\u0002\u0002\u05d7\u009e\u0003\u0002\u0002\u0002\u05d8", - "\u05d9\u0005\u01bf\u00e0\u0002\u05d9\u05da\u0005\u01b1\u00d9\u0002\u05da", - "\u05db\u0005\u01d3\u00ea\u0002\u05db\u05dc\u0005\u01b1\u00d9\u0002\u05dc", - "\u05dd\u0005\u01bf\u00e0\u0002\u05dd\u05e4\u0003\u0002\u0002\u0002\u05de", - "\u05df\u0007N\u0002\u0002\u05df\u05e0\u0007G\u0002\u0002\u05e0\u05e1", - "\u0007X\u0002\u0002\u05e1\u05e2\u0007G\u0002\u0002\u05e2\u05e4\u0007", - "N\u0002\u0002\u05e3\u05d8\u0003\u0002\u0002\u0002\u05e3\u05de\u0003", - "\u0002\u0002\u0002\u05e4\u00a0\u0003\u0002\u0002\u0002\u05e5\u05e6\u0005", - "\u01bf\u00e0\u0002\u05e6\u05e7\u0005\u01b9\u00dd\u0002\u05e7\u05e8\u0005", - "\u01c1\u00e1\u0002\u05e8\u05e9\u0005\u01b9\u00dd\u0002\u05e9\u05ea\u0005", - "\u01cf\u00e8\u0002\u05ea\u05f1\u0003\u0002\u0002\u0002\u05eb\u05ec\u0007", - "N\u0002\u0002\u05ec\u05ed\u0007K\u0002\u0002\u05ed\u05ee\u0007O\u0002", - "\u0002\u05ee\u05ef\u0007K\u0002\u0002\u05ef\u05f1\u0007V\u0002\u0002", - "\u05f0\u05e5\u0003\u0002\u0002\u0002\u05f0\u05eb\u0003\u0002\u0002\u0002", - "\u05f1\u00a2\u0003\u0002\u0002\u0002\u05f2\u05f3\u0005\u01bf\u00e0\u0002", - "\u05f3\u05f4\u0005\u01c5\u00e3\u0002\u05f4\u05f5\u0005\u01ad\u00d7\u0002", - "\u05f5\u05f6\u0005\u01a9\u00d5\u0002\u05f6\u05f7\u0005\u01bf\u00e0\u0002", - "\u05f7\u05f8\u0007a\u0002\u0002\u05f8\u05f9\u0005\u01c5\u00e3\u0002", - "\u05f9\u05fa\u0005\u01c3\u00e2\u0002\u05fa\u05fb\u0005\u01b1\u00d9\u0002", - "\u05fb\u0606\u0003\u0002\u0002\u0002\u05fc\u05fd\u0007N\u0002\u0002", - "\u05fd\u05fe\u0007Q\u0002\u0002\u05fe\u05ff\u0007E\u0002\u0002\u05ff", - "\u0600\u0007C\u0002\u0002\u0600\u0601\u0007N\u0002\u0002\u0601\u0602", - "\u0007a\u0002\u0002\u0602\u0603\u0007Q\u0002\u0002\u0603\u0604\u0007", - "P\u0002\u0002\u0604\u0606\u0007G\u0002\u0002\u0605\u05f2\u0003\u0002", - "\u0002\u0002\u0605\u05fc\u0003\u0002\u0002\u0002\u0606\u00a4\u0003\u0002", - "\u0002\u0002\u0607\u0608\u0005\u01bf\u00e0\u0002\u0608\u0609\u0005\u01c5", - "\u00e3\u0002\u0609\u060a\u0005\u01ad\u00d7\u0002\u060a\u060b\u0005\u01a9", - "\u00d5\u0002\u060b\u060c\u0005\u01bf\u00e0\u0002\u060c\u060d\u0007a", - "\u0002\u0002\u060d\u060e\u0005\u01c9\u00e5\u0002\u060e\u060f\u0005\u01d1", - "\u00e9\u0002\u060f\u0610\u0005\u01c5\u00e3\u0002\u0610\u0611\u0005\u01cb", - "\u00e6\u0002\u0611\u0612\u0005\u01d1\u00e9\u0002\u0612\u0613\u0005\u01c1", - "\u00e1\u0002\u0613\u0621\u0003\u0002\u0002\u0002\u0614\u0615\u0007N", - "\u0002\u0002\u0615\u0616\u0007Q\u0002\u0002\u0616\u0617\u0007E\u0002", - "\u0002\u0617\u0618\u0007C\u0002\u0002\u0618\u0619\u0007N\u0002\u0002", - "\u0619\u061a\u0007a\u0002\u0002\u061a\u061b\u0007S\u0002\u0002\u061b", - "\u061c\u0007W\u0002\u0002\u061c\u061d\u0007Q\u0002\u0002\u061d\u061e", - "\u0007T\u0002\u0002\u061e\u061f\u0007W\u0002\u0002\u061f\u0621\u0007", - "O\u0002\u0002\u0620\u0607\u0003\u0002\u0002\u0002\u0620\u0614\u0003", - "\u0002\u0002\u0002\u0621\u00a6\u0003\u0002\u0002\u0002\u0622\u0623\u0005", - "\u01bf\u00e0\u0002\u0623\u0624\u0005\u01c5\u00e3\u0002\u0624\u0625\u0005", - "\u01b5\u00db\u0002\u0625\u0626\u0005\u01b5\u00db\u0002\u0626\u0627\u0005", - "\u01b1\u00d9\u0002\u0627\u0628\u0005\u01af\u00d8\u0002\u0628\u0630\u0003", - "\u0002\u0002\u0002\u0629\u062a\u0007N\u0002\u0002\u062a\u062b\u0007", - "Q\u0002\u0002\u062b\u062c\u0007I\u0002\u0002\u062c\u062d\u0007I\u0002", - "\u0002\u062d\u062e\u0007G\u0002\u0002\u062e\u0630\u0007F\u0002\u0002", - "\u062f\u0622\u0003\u0002\u0002\u0002\u062f\u0629\u0003\u0002\u0002\u0002", - "\u0630\u00a8\u0003\u0002\u0002\u0002\u0631\u0632\u0005\u01bf\u00e0\u0002", - "\u0632\u0633\u0005\u01c5\u00e3\u0002\u0633\u0634\u0005\u01b5\u00db\u0002", - "\u0634\u0635\u0005\u01b9\u00dd\u0002\u0635\u0636\u0005\u01c3\u00e2\u0002", - "\u0636\u063d\u0003\u0002\u0002\u0002\u0637\u0638\u0007N\u0002\u0002", - "\u0638\u0639\u0007Q\u0002\u0002\u0639\u063a\u0007I\u0002\u0002\u063a", - "\u063b\u0007K\u0002\u0002\u063b\u063d\u0007P\u0002\u0002\u063c\u0631", - "\u0003\u0002\u0002\u0002\u063c\u0637\u0003\u0002\u0002\u0002\u063d\u00aa", - "\u0003\u0002\u0002\u0002\u063e\u063f\u0005\u01c1\u00e1\u0002\u063f\u0640", - "\u0005\u01a9\u00d5\u0002\u0640\u0641\u0005\u01cf\u00e8\u0002\u0641\u0642", - "\u0005\u01b1\u00d9\u0002\u0642\u0643\u0005\u01cb\u00e6\u0002\u0643\u0644", - "\u0005\u01b9\u00dd\u0002\u0644\u0645\u0005\u01a9\u00d5\u0002\u0645\u0646", - "\u0005\u01bf\u00e0\u0002\u0646\u0647\u0005\u01b9\u00dd\u0002\u0647\u0648", - "\u0005\u01db\u00ee\u0002\u0648\u0649\u0005\u01b1\u00d9\u0002\u0649\u064a", - "\u0005\u01af\u00d8\u0002\u064a\u0658\u0003\u0002\u0002\u0002\u064b\u064c", - "\u0007O\u0002\u0002\u064c\u064d\u0007C\u0002\u0002\u064d\u064e\u0007", - "V\u0002\u0002\u064e\u064f\u0007G\u0002\u0002\u064f\u0650\u0007T\u0002", - "\u0002\u0650\u0651\u0007K\u0002\u0002\u0651\u0652\u0007C\u0002\u0002", - "\u0652\u0653\u0007N\u0002\u0002\u0653\u0654\u0007K\u0002\u0002\u0654", - "\u0655\u0007\\\u0002\u0002\u0655\u0656\u0007G\u0002\u0002\u0656\u0658", - "\u0007F\u0002\u0002\u0657\u063e\u0003\u0002\u0002\u0002\u0657\u064b", - "\u0003\u0002\u0002\u0002\u0658\u00ac\u0003\u0002\u0002\u0002\u0659\u065a", - "\u0005\u01c1\u00e1\u0002\u065a\u065b\u0005\u01c5\u00e3\u0002\u065b\u065c", - "\u0005\u01af\u00d8\u0002\u065c\u065d\u0005\u01b9\u00dd\u0002\u065d\u065e", - "\u0005\u01b3\u00da\u0002\u065e\u065f\u0005\u01d9\u00ed\u0002\u065f\u0667", - "\u0003\u0002\u0002\u0002\u0660\u0661\u0007O\u0002\u0002\u0661\u0662", - "\u0007Q\u0002\u0002\u0662\u0663\u0007F\u0002\u0002\u0663\u0664\u0007", - "K\u0002\u0002\u0664\u0665\u0007H\u0002\u0002\u0665\u0667\u0007[\u0002", - "\u0002\u0666\u0659\u0003\u0002\u0002\u0002\u0666\u0660\u0003\u0002\u0002", - "\u0002\u0667\u00ae\u0003\u0002\u0002\u0002\u0668\u0669\u0005\u01c3\u00e2", - "\u0002\u0669\u066a\u0005\u01a9\u00d5\u0002\u066a\u066b\u0005\u01c3\u00e2", - "\u0002\u066b\u0670\u0003\u0002\u0002\u0002\u066c\u066d\u0007P\u0002", - "\u0002\u066d\u066e\u0007C\u0002\u0002\u066e\u0670\u0007P\u0002\u0002", - "\u066f\u0668\u0003\u0002\u0002\u0002\u066f\u066c\u0003\u0002\u0002\u0002", - "\u0670\u00b0\u0003\u0002\u0002\u0002\u0671\u0672\u0005\u01c3\u00e2\u0002", - "\u0672\u0673\u0005\u01c5\u00e3\u0002\u0673\u0674\u0005\u01cb\u00e6\u0002", - "\u0674\u0675\u0005\u01b1\u00d9\u0002\u0675\u0676\u0005\u01ad\u00d7\u0002", - "\u0676\u0677\u0005\u01d1\u00e9\u0002\u0677\u0678\u0005\u01cb\u00e6\u0002", - "\u0678\u0679\u0005\u01cd\u00e7\u0002\u0679\u067a\u0005\u01b9\u00dd\u0002", - "\u067a\u067b\u0005\u01d3\u00ea\u0002\u067b\u067c\u0005\u01b1\u00d9\u0002", - "\u067c\u0689\u0003\u0002\u0002\u0002\u067d\u067e\u0007P\u0002\u0002", - "\u067e\u067f\u0007Q\u0002\u0002\u067f\u0680\u0007T\u0002\u0002\u0680", - "\u0681\u0007G\u0002\u0002\u0681\u0682\u0007E\u0002\u0002\u0682\u0683", - "\u0007W\u0002\u0002\u0683\u0684\u0007T\u0002\u0002\u0684\u0685\u0007", - "U\u0002\u0002\u0685\u0686\u0007K\u0002\u0002\u0686\u0687\u0007X\u0002", - "\u0002\u0687\u0689\u0007G\u0002\u0002\u0688\u0671\u0003\u0002\u0002", - "\u0002\u0688\u067d\u0003\u0002\u0002\u0002\u0689\u00b2\u0003\u0002\u0002", - "\u0002\u068a\u068b\u0005\u01c3\u00e2\u0002\u068b\u068c\u0005\u01c5\u00e3", - "\u0002\u068c\u068d\u0005\u01cd\u00e7\u0002\u068d\u068e\u0005\u01d1\u00e9", - "\u0002\u068e\u068f\u0005\u01c7\u00e4\u0002\u068f\u0690\u0005\u01b1\u00d9", - "\u0002\u0690\u0691\u0005\u01cb\u00e6\u0002\u0691\u0692\u0005\u01d1\u00e9", - "\u0002\u0692\u0693\u0005\u01cd\u00e7\u0002\u0693\u0694\u0005\u01b1\u00d9", - "\u0002\u0694\u0695\u0005\u01cb\u00e6\u0002\u0695\u06a2\u0003\u0002\u0002", - "\u0002\u0696\u0697\u0007P\u0002\u0002\u0697\u0698\u0007Q\u0002\u0002", - "\u0698\u0699\u0007U\u0002\u0002\u0699\u069a\u0007W\u0002\u0002\u069a", - "\u069b\u0007R\u0002\u0002\u069b\u069c\u0007G\u0002\u0002\u069c\u069d", - "\u0007T\u0002\u0002\u069d\u069e\u0007W\u0002\u0002\u069e\u069f\u0007", - "U\u0002\u0002\u069f\u06a0\u0007G\u0002\u0002\u06a0\u06a2\u0007T\u0002", - "\u0002\u06a1\u068a\u0003\u0002\u0002\u0002\u06a1\u0696\u0003\u0002\u0002", - "\u0002\u06a2\u00b4\u0003\u0002\u0002\u0002\u06a3\u06a4\u0005\u01c3\u00e2", - "\u0002\u06a4\u06a5\u0005\u01c5\u00e3\u0002\u06a5\u06a6\u0005\u01cf\u00e8", - "\u0002\u06a6\u06ab\u0003\u0002\u0002\u0002\u06a7\u06a8\u0007P\u0002", - "\u0002\u06a8\u06a9\u0007Q\u0002\u0002\u06a9\u06ab\u0007V\u0002\u0002", - "\u06aa\u06a3\u0003\u0002\u0002\u0002\u06aa\u06a7\u0003\u0002\u0002\u0002", - "\u06ab\u00b6\u0003\u0002\u0002\u0002\u06ac\u06ad\u0005\u01c3\u00e2\u0002", - "\u06ad\u06ae\u0005\u01d1\u00e9\u0002\u06ae\u06af\u0005\u01bf\u00e0\u0002", - "\u06af\u06b0\u0005\u01bf\u00e0\u0002\u06b0\u06b6\u0003\u0002\u0002\u0002", - "\u06b1\u06b2\u0007P\u0002\u0002\u06b2\u06b3\u0007W\u0002\u0002\u06b3", - "\u06b4\u0007N\u0002\u0002\u06b4\u06b6\u0007N\u0002\u0002\u06b5\u06ac", - "\u0003\u0002\u0002\u0002\u06b5\u06b1\u0003\u0002\u0002\u0002\u06b6\u00b8", - "\u0003\u0002\u0002\u0002\u06b7\u06b8\u0005\u01c5\u00e3\u0002\u06b8\u06b9", - "\u0005\u01b3\u00da\u0002\u06b9\u06bd\u0003\u0002\u0002\u0002\u06ba\u06bb", - "\u0007Q\u0002\u0002\u06bb\u06bd\u0007H\u0002\u0002\u06bc\u06b7\u0003", - "\u0002\u0002\u0002\u06bc\u06ba\u0003\u0002\u0002\u0002\u06bd\u00ba\u0003", - "\u0002\u0002\u0002\u06be\u06bf\u0005\u01c5\u00e3\u0002\u06bf\u06c0\u0005", - "\u01c3\u00e2\u0002\u06c0\u06c4\u0003\u0002\u0002\u0002\u06c1\u06c2\u0007", - "Q\u0002\u0002\u06c2\u06c4\u0007P\u0002\u0002\u06c3\u06be\u0003\u0002", - "\u0002\u0002\u06c3\u06c1\u0003\u0002\u0002\u0002\u06c4\u00bc\u0003\u0002", - "\u0002\u0002\u06c5\u06c6\u0005\u01c5\u00e3\u0002\u06c6\u06c7\u0005\u01c3", - "\u00e2\u0002\u06c7\u06c8\u0005\u01b1\u00d9\u0002\u06c8\u06cd\u0003\u0002", - "\u0002\u0002\u06c9\u06ca\u0007Q\u0002\u0002\u06ca\u06cb\u0007P\u0002", - "\u0002\u06cb\u06cd\u0007G\u0002\u0002\u06cc\u06c5\u0003\u0002\u0002", - "\u0002\u06cc\u06c9\u0003\u0002\u0002\u0002\u06cd\u00be\u0003\u0002\u0002", - "\u0002\u06ce\u06cf\u0005\u01c5\u00e3\u0002\u06cf\u06d0\u0005\u01c7\u00e4", - "\u0002\u06d0\u06d1\u0005\u01cf\u00e8\u0002\u06d1\u06d2\u0005\u01b9\u00dd", - "\u0002\u06d2\u06d3\u0005\u01c5\u00e3\u0002\u06d3\u06d4\u0005\u01c3\u00e2", - "\u0002\u06d4\u06d5\u0005\u01cd\u00e7\u0002\u06d5\u06de\u0003\u0002\u0002", - "\u0002\u06d6\u06d7\u0007Q\u0002\u0002\u06d7\u06d8\u0007R\u0002\u0002", - "\u06d8\u06d9\u0007V\u0002\u0002\u06d9\u06da\u0007K\u0002\u0002\u06da", - "\u06db\u0007Q\u0002\u0002\u06db\u06dc\u0007P\u0002\u0002\u06dc\u06de", - "\u0007U\u0002\u0002\u06dd\u06ce\u0003\u0002\u0002\u0002\u06dd\u06d6", - "\u0003\u0002\u0002\u0002\u06de\u00c0\u0003\u0002\u0002\u0002\u06df\u06e0", - "\u0005\u01c5\u00e3\u0002\u06e0\u06e1\u0005\u01cb\u00e6\u0002\u06e1\u06e5", - "\u0003\u0002\u0002\u0002\u06e2\u06e3\u0007Q\u0002\u0002\u06e3\u06e5", - "\u0007T\u0002\u0002\u06e4\u06df\u0003\u0002\u0002\u0002\u06e4\u06e2", - "\u0003\u0002\u0002\u0002\u06e5\u00c2\u0003\u0002\u0002\u0002\u06e6\u06e7", - "\u0005\u01c5\u00e3\u0002\u06e7\u06e8\u0005\u01cb\u00e6\u0002\u06e8\u06e9", - "\u0005\u01af\u00d8\u0002\u06e9\u06ea\u0005\u01b1\u00d9\u0002\u06ea\u06eb", - "\u0005\u01cb\u00e6\u0002\u06eb\u06f2\u0003\u0002\u0002\u0002\u06ec\u06ed", - "\u0007Q\u0002\u0002\u06ed\u06ee\u0007T\u0002\u0002\u06ee\u06ef\u0007", - "F\u0002\u0002\u06ef\u06f0\u0007G\u0002\u0002\u06f0\u06f2\u0007T\u0002", - "\u0002\u06f1\u06e6\u0003\u0002\u0002\u0002\u06f1\u06ec\u0003\u0002\u0002", - "\u0002\u06f2\u00c4\u0003\u0002\u0002\u0002\u06f3\u06f4\u0005\u01c7\u00e4", - "\u0002\u06f4\u06f5\u0005\u01a9\u00d5\u0002\u06f5\u06f6\u0005\u01cb\u00e6", - "\u0002\u06f6\u06f7\u0005\u01cf\u00e8\u0002\u06f7\u06f8\u0005\u01b9\u00dd", - "\u0002\u06f8\u06f9\u0005\u01cf\u00e8\u0002\u06f9\u06fa\u0005\u01b9\u00dd", - "\u0002\u06fa\u06fb\u0005\u01c5\u00e3\u0002\u06fb\u06fc\u0005\u01c3\u00e2", - "\u0002\u06fc\u0707\u0003\u0002\u0002\u0002\u06fd\u06fe\u0007R\u0002", - "\u0002\u06fe\u06ff\u0007C\u0002\u0002\u06ff\u0700\u0007T\u0002\u0002", - "\u0700\u0701\u0007V\u0002\u0002\u0701\u0702\u0007K\u0002\u0002\u0702", - "\u0703\u0007V\u0002\u0002\u0703\u0704\u0007K\u0002\u0002\u0704\u0705", - "\u0007Q\u0002\u0002\u0705\u0707\u0007P\u0002\u0002\u0706\u06f3\u0003", - "\u0002\u0002\u0002\u0706\u06fd\u0003\u0002\u0002\u0002\u0707\u00c6\u0003", - "\u0002\u0002\u0002\u0708\u0709\u0005\u01c7\u00e4\u0002\u0709\u070a\u0005", - "\u01a9\u00d5\u0002\u070a\u070b\u0005\u01cd\u00e7\u0002\u070b\u070c\u0005", - "\u01cd\u00e7\u0002\u070c\u070d\u0005\u01d5\u00eb\u0002\u070d\u070e\u0005", - "\u01c5\u00e3\u0002\u070e\u070f\u0005\u01cb\u00e6\u0002\u070f\u0710\u0005", - "\u01af\u00d8\u0002\u0710\u071a\u0003\u0002\u0002\u0002\u0711\u0712\u0007", - "R\u0002\u0002\u0712\u0713\u0007C\u0002\u0002\u0713\u0714\u0007U\u0002", - "\u0002\u0714\u0715\u0007U\u0002\u0002\u0715\u0716\u0007Y\u0002\u0002", - "\u0716\u0717\u0007Q\u0002\u0002\u0717\u0718\u0007T\u0002\u0002\u0718", - "\u071a\u0007F\u0002\u0002\u0719\u0708\u0003\u0002\u0002\u0002\u0719", - "\u0711\u0003\u0002\u0002\u0002\u071a\u00c8\u0003\u0002\u0002\u0002\u071b", - "\u071c\u0005\u01c7\u00e4\u0002\u071c\u071d\u0005\u01b1\u00d9\u0002\u071d", - "\u071e\u0005\u01cb\u00e6\u0002\u071e\u0723\u0003\u0002\u0002\u0002\u071f", - "\u0720\u0007R\u0002\u0002\u0720\u0721\u0007G\u0002\u0002\u0721\u0723", - "\u0007T\u0002\u0002\u0722\u071b\u0003\u0002\u0002\u0002\u0722\u071f", - "\u0003\u0002\u0002\u0002\u0723\u00ca\u0003\u0002\u0002\u0002\u0724\u0725", - "\u0005\u01c7\u00e4\u0002\u0725\u0726\u0005\u01b1\u00d9\u0002\u0726\u0727", - "\u0005\u01cb\u00e6\u0002\u0727\u0728\u0005\u01c1\u00e1\u0002\u0728\u0729", - "\u0005\u01b9\u00dd\u0002\u0729\u072a\u0005\u01cd\u00e7\u0002\u072a\u072b", - "\u0005\u01cd\u00e7\u0002\u072b\u072c\u0005\u01b9\u00dd\u0002\u072c\u072d", - "\u0005\u01c5\u00e3\u0002\u072d\u072e\u0005\u01c3\u00e2\u0002\u072e\u073a", - "\u0003\u0002\u0002\u0002\u072f\u0730\u0007R\u0002\u0002\u0730\u0731", - "\u0007G\u0002\u0002\u0731\u0732\u0007T\u0002\u0002\u0732\u0733\u0007", - "O\u0002\u0002\u0733\u0734\u0007K\u0002\u0002\u0734\u0735\u0007U\u0002", - "\u0002\u0735\u0736\u0007U\u0002\u0002\u0736\u0737\u0007K\u0002\u0002", - "\u0737\u0738\u0007Q\u0002\u0002\u0738\u073a\u0007P\u0002\u0002\u0739", - "\u0724\u0003\u0002\u0002\u0002\u0739\u072f\u0003\u0002\u0002\u0002\u073a", - "\u00cc\u0003\u0002\u0002\u0002\u073b\u073c\u0005\u01c7\u00e4\u0002\u073c", - "\u073d\u0005\u01b1\u00d9\u0002\u073d\u073e\u0005\u01cb\u00e6\u0002\u073e", - "\u073f\u0005\u01c1\u00e1\u0002\u073f\u0740\u0005\u01b9\u00dd\u0002\u0740", - "\u0741\u0005\u01cd\u00e7\u0002\u0741\u0742\u0005\u01cd\u00e7\u0002\u0742", - "\u0743\u0005\u01b9\u00dd\u0002\u0743\u0744\u0005\u01c5\u00e3\u0002\u0744", - "\u0745\u0005\u01c3\u00e2\u0002\u0745\u0746\u0005\u01cd\u00e7\u0002\u0746", - "\u0753\u0003\u0002\u0002\u0002\u0747\u0748\u0007R\u0002\u0002\u0748", - "\u0749\u0007G\u0002\u0002\u0749\u074a\u0007T\u0002\u0002\u074a\u074b", - "\u0007O\u0002\u0002\u074b\u074c\u0007K\u0002\u0002\u074c\u074d\u0007", - "U\u0002\u0002\u074d\u074e\u0007U\u0002\u0002\u074e\u074f\u0007K\u0002", - "\u0002\u074f\u0750\u0007Q\u0002\u0002\u0750\u0751\u0007P\u0002\u0002", - "\u0751\u0753\u0007U\u0002\u0002\u0752\u073b\u0003\u0002\u0002\u0002", - "\u0752\u0747\u0003\u0002\u0002\u0002\u0753\u00ce\u0003\u0002\u0002\u0002", - "\u0754\u0755\u0005\u01c7\u00e4\u0002\u0755\u0756\u0005\u01cb\u00e6\u0002", - "\u0756\u0757\u0005\u01b9\u00dd\u0002\u0757\u0758\u0005\u01c1\u00e1\u0002", - "\u0758\u0759\u0005\u01a9\u00d5\u0002\u0759\u075a\u0005\u01cb\u00e6\u0002", - "\u075a\u075b\u0005\u01d9\u00ed\u0002\u075b\u0764\u0003\u0002\u0002\u0002", - "\u075c\u075d\u0007R\u0002\u0002\u075d\u075e\u0007T\u0002\u0002\u075e", - "\u075f\u0007K\u0002\u0002\u075f\u0760\u0007O\u0002\u0002\u0760\u0761", - "\u0007C\u0002\u0002\u0761\u0762\u0007T\u0002\u0002\u0762\u0764\u0007", - "[\u0002\u0002\u0763\u0754\u0003\u0002\u0002\u0002\u0763\u075c\u0003", - "\u0002\u0002\u0002\u0764\u00d0\u0003\u0002\u0002\u0002\u0765\u0766\u0005", - "\u01c9\u00e5\u0002\u0766\u0767\u0005\u01d1\u00e9\u0002\u0767\u0768\u0005", - "\u01c5\u00e3\u0002\u0768\u0769\u0005\u01cb\u00e6\u0002\u0769\u076a\u0005", - "\u01d1\u00e9\u0002\u076a\u076b\u0005\u01c1\u00e1\u0002\u076b\u0773\u0003", - "\u0002\u0002\u0002\u076c\u076d\u0007S\u0002\u0002\u076d\u076e\u0007", - "W\u0002\u0002\u076e\u076f\u0007Q\u0002\u0002\u076f\u0770\u0007T\u0002", - "\u0002\u0770\u0771\u0007W\u0002\u0002\u0771\u0773\u0007O\u0002\u0002", - "\u0772\u0765\u0003\u0002\u0002\u0002\u0772\u076c\u0003\u0002\u0002\u0002", - "\u0773\u00d2\u0003\u0002\u0002\u0002\u0774\u0775\u0005\u01cb\u00e6\u0002", - "\u0775\u0776\u0005\u01b1\u00d9\u0002\u0776\u0777\u0005\u01c3\u00e2\u0002", - "\u0777\u0778\u0005\u01a9\u00d5\u0002\u0778\u0779\u0005\u01c1\u00e1\u0002", - "\u0779\u077a\u0005\u01b1\u00d9\u0002\u077a\u0782\u0003\u0002\u0002\u0002", - "\u077b\u077c\u0007T\u0002\u0002\u077c\u077d\u0007G\u0002\u0002\u077d", - "\u077e\u0007P\u0002\u0002\u077e\u077f\u0007C\u0002\u0002\u077f\u0780", - "\u0007O\u0002\u0002\u0780\u0782\u0007G\u0002\u0002\u0781\u0774\u0003", - "\u0002\u0002\u0002\u0781\u077b\u0003\u0002\u0002\u0002\u0782\u00d4\u0003", - "\u0002\u0002\u0002\u0783\u0784\u0005\u01cb\u00e6\u0002\u0784\u0785\u0005", - "\u01b1\u00d9\u0002\u0785\u0786\u0005\u01c7\u00e4\u0002\u0786\u0787\u0005", - "\u01bf\u00e0\u0002\u0787\u0788\u0005\u01a9\u00d5\u0002\u0788\u0789\u0005", - "\u01ad\u00d7\u0002\u0789\u078a\u0005\u01b1\u00d9\u0002\u078a\u0793\u0003", - "\u0002\u0002\u0002\u078b\u078c\u0007T\u0002\u0002\u078c\u078d\u0007", - "G\u0002\u0002\u078d\u078e\u0007R\u0002\u0002\u078e\u078f\u0007N\u0002", - "\u0002\u078f\u0790\u0007C\u0002\u0002\u0790\u0791\u0007E\u0002\u0002", - "\u0791\u0793\u0007G\u0002\u0002\u0792\u0783\u0003\u0002\u0002\u0002", - "\u0792\u078b\u0003\u0002\u0002\u0002\u0793\u00d6\u0003\u0002\u0002\u0002", - "\u0794\u0795\u0005\u01cb\u00e6\u0002\u0795\u0796\u0005\u01b1\u00d9\u0002", - "\u0796\u0797\u0005\u01c7\u00e4\u0002\u0797\u0798\u0005\u01bf\u00e0\u0002", - "\u0798\u0799\u0005\u01b9\u00dd\u0002\u0799\u079a\u0005\u01ad\u00d7\u0002", - "\u079a\u079b\u0005\u01a9\u00d5\u0002\u079b\u079c\u0005\u01cf\u00e8\u0002", - "\u079c\u079d\u0005\u01b9\u00dd\u0002\u079d\u079e\u0005\u01c5\u00e3\u0002", - "\u079e\u079f\u0005\u01c3\u00e2\u0002\u079f\u07ac\u0003\u0002\u0002\u0002", - "\u07a0\u07a1\u0007T\u0002\u0002\u07a1\u07a2\u0007G\u0002\u0002\u07a2", - "\u07a3\u0007R\u0002\u0002\u07a3\u07a4\u0007N\u0002\u0002\u07a4\u07a5", - "\u0007K\u0002\u0002\u07a5\u07a6\u0007E\u0002\u0002\u07a6\u07a7\u0007", - "C\u0002\u0002\u07a7\u07a8\u0007V\u0002\u0002\u07a8\u07a9\u0007K\u0002", - "\u0002\u07a9\u07aa\u0007Q\u0002\u0002\u07aa\u07ac\u0007P\u0002\u0002", - "\u07ab\u0794\u0003\u0002\u0002\u0002\u07ab\u07a0\u0003\u0002\u0002\u0002", - "\u07ac\u00d8\u0003\u0002\u0002\u0002\u07ad\u07ae\u0005\u01cb\u00e6\u0002", - "\u07ae\u07af\u0005\u01b1\u00d9\u0002\u07af\u07b0\u0005\u01cf\u00e8\u0002", - "\u07b0\u07b1\u0005\u01d1\u00e9\u0002\u07b1\u07b2\u0005\u01cb\u00e6\u0002", - "\u07b2\u07b3\u0005\u01c3\u00e2\u0002\u07b3\u07b4\u0005\u01cd\u00e7\u0002", - "\u07b4\u07bd\u0003\u0002\u0002\u0002\u07b5\u07b6\u0007T\u0002\u0002", - "\u07b6\u07b7\u0007G\u0002\u0002\u07b7\u07b8\u0007V\u0002\u0002\u07b8", - "\u07b9\u0007W\u0002\u0002\u07b9\u07ba\u0007T\u0002\u0002\u07ba\u07bb", - "\u0007P\u0002\u0002\u07bb\u07bd\u0007U\u0002\u0002\u07bc\u07ad\u0003", - "\u0002\u0002\u0002\u07bc\u07b5\u0003\u0002\u0002\u0002\u07bd\u00da\u0003", - "\u0002\u0002\u0002\u07be\u07bf\u0005\u01cb\u00e6\u0002\u07bf\u07c0\u0005", - "\u01b1\u00d9\u0002\u07c0\u07c1\u0005\u01d3\u00ea\u0002\u07c1\u07c2\u0005", - "\u01c5\u00e3\u0002\u07c2\u07c3\u0005\u01bd\u00df\u0002\u07c3\u07c4\u0005", - "\u01b1\u00d9\u0002\u07c4\u07cc\u0003\u0002\u0002\u0002\u07c5\u07c6\u0007", - "T\u0002\u0002\u07c6\u07c7\u0007G\u0002\u0002\u07c7\u07c8\u0007X\u0002", - "\u0002\u07c8\u07c9\u0007Q\u0002\u0002\u07c9\u07ca\u0007M\u0002\u0002", - "\u07ca\u07cc\u0007G\u0002\u0002\u07cb\u07be\u0003\u0002\u0002\u0002", - "\u07cb\u07c5\u0003\u0002\u0002\u0002\u07cc\u00dc\u0003\u0002\u0002\u0002", - "\u07cd\u07ce\u0005\u01cb\u00e6\u0002\u07ce\u07cf\u0005\u01c5\u00e3\u0002", - "\u07cf\u07d0\u0005\u01bf\u00e0\u0002\u07d0\u07d1\u0005\u01b1\u00d9\u0002", - "\u07d1\u07d7\u0003\u0002\u0002\u0002\u07d2\u07d3\u0007T\u0002\u0002", - "\u07d3\u07d4\u0007Q\u0002\u0002\u07d4\u07d5\u0007N\u0002\u0002\u07d5", - "\u07d7\u0007G\u0002\u0002\u07d6\u07cd\u0003\u0002\u0002\u0002\u07d6", - "\u07d2\u0003\u0002\u0002\u0002\u07d7\u00de\u0003\u0002\u0002\u0002\u07d8", - "\u07d9\u0005\u01cb\u00e6\u0002\u07d9\u07da\u0005\u01c5\u00e3\u0002\u07da", - "\u07db\u0005\u01bf\u00e0\u0002\u07db\u07dc\u0005\u01b1\u00d9\u0002\u07dc", - "\u07dd\u0005\u01cd\u00e7\u0002\u07dd\u07e4\u0003\u0002\u0002\u0002\u07de", - "\u07df\u0007T\u0002\u0002\u07df\u07e0\u0007Q\u0002\u0002\u07e0\u07e1", - "\u0007N\u0002\u0002\u07e1\u07e2\u0007G\u0002\u0002\u07e2\u07e4\u0007", - "U\u0002\u0002\u07e3\u07d8\u0003\u0002\u0002\u0002\u07e3\u07de\u0003", - "\u0002\u0002\u0002\u07e4\u00e0\u0003\u0002\u0002\u0002\u07e5\u07e6\u0005", - "\u01b9\u00dd\u0002\u07e6\u07e7\u0005\u01c3\u00e2\u0002\u07e7\u07e8\u0005", - "\u01cf\u00e8\u0002\u07e8\u07e9\u0005\u01b1\u00d9\u0002\u07e9\u07ea\u0005", - "\u01cb\u00e6\u0002\u07ea\u07eb\u0005\u01c3\u00e2\u0002\u07eb\u07ec\u0005", - "\u01a9\u00d5\u0002\u07ec\u07ed\u0005\u01bf\u00e0\u0002\u07ed\u07f7\u0003", - "\u0002\u0002\u0002\u07ee\u07ef\u0007K\u0002\u0002\u07ef\u07f0\u0007", - "P\u0002\u0002\u07f0\u07f1\u0007V\u0002\u0002\u07f1\u07f2\u0007G\u0002", - "\u0002\u07f2\u07f3\u0007T\u0002\u0002\u07f3\u07f4\u0007P\u0002\u0002", - "\u07f4\u07f5\u0007C\u0002\u0002\u07f5\u07f7\u0007N\u0002\u0002\u07f6", - "\u07e5\u0003\u0002\u0002\u0002\u07f6\u07ee\u0003\u0002\u0002\u0002\u07f7", - "\u00e2\u0003\u0002\u0002\u0002\u07f8\u07f9\u0005\u01bf\u00e0\u0002\u07f9", - "\u07fa\u0005\u01af\u00d8\u0002\u07fa\u07fb\u0005\u01a9\u00d5\u0002\u07fb", - "\u07fc\u0005\u01c7\u00e4\u0002\u07fc\u0802\u0003\u0002\u0002\u0002\u07fd", - "\u07fe\u0007N\u0002\u0002\u07fe\u07ff\u0007F\u0002\u0002\u07ff\u0800", - "\u0007C\u0002\u0002\u0800\u0802\u0007R\u0002\u0002\u0801\u07f8\u0003", - "\u0002\u0002\u0002\u0801\u07fd\u0003\u0002\u0002\u0002\u0802\u00e4\u0003", - "\u0002\u0002\u0002\u0803\u0804\u0005\u01cd\u00e7\u0002\u0804\u0805\u0005", - "\u01ad\u00d7\u0002\u0805\u0806\u0005\u01b1\u00d9\u0002\u0806\u0807\u0005", - "\u01c1\u00e1\u0002\u0807\u0808\u0005\u01b1\u00d9\u0002\u0808\u0810\u0003", - "\u0002\u0002\u0002\u0809\u080a\u0007U\u0002\u0002\u080a\u080b\u0007", - "E\u0002\u0002\u080b\u080c\u0007J\u0002\u0002\u080c\u080d\u0007G\u0002", - "\u0002\u080d\u080e\u0007O\u0002\u0002\u080e\u0810\u0007G\u0002\u0002", - "\u080f\u0803\u0003\u0002\u0002\u0002\u080f\u0809\u0003\u0002\u0002\u0002", - "\u0810\u00e6\u0003\u0002\u0002\u0002\u0811\u0812\u0005\u01cd\u00e7\u0002", - "\u0812\u0813\u0005\u01ad\u00d7\u0002\u0813\u0814\u0005\u01b7\u00dc\u0002", - "\u0814\u0815\u0005\u01b1\u00d9\u0002\u0815\u0816\u0005\u01c1\u00e1\u0002", - "\u0816\u0817\u0005\u01a9\u00d5\u0002\u0817\u081f\u0003\u0002\u0002\u0002", - "\u0818\u0819\u0007U\u0002\u0002\u0819\u081a\u0007E\u0002\u0002\u081a", - "\u081b\u0007J\u0002\u0002\u081b\u081c\u0007G\u0002\u0002\u081c\u081d", - "\u0007O\u0002\u0002\u081d\u081f\u0007C\u0002\u0002\u081e\u0811\u0003", - "\u0002\u0002\u0002\u081e\u0818\u0003\u0002\u0002\u0002\u081f\u00e8\u0003", - "\u0002\u0002\u0002\u0820\u0821\u0005\u01cd\u00e7\u0002\u0821\u0822\u0005", - "\u01b1\u00d9\u0002\u0822\u0823\u0005\u01bf\u00e0\u0002\u0823\u0824\u0005", - "\u01b1\u00d9\u0002\u0824\u0825\u0005\u01ad\u00d7\u0002\u0825\u0826\u0005", - "\u01cf\u00e8\u0002\u0826\u082e\u0003\u0002\u0002\u0002\u0827\u0828\u0007", - "U\u0002\u0002\u0828\u0829\u0007G\u0002\u0002\u0829\u082a\u0007N\u0002", - "\u0002\u082a\u082b\u0007G\u0002\u0002\u082b\u082c\u0007E\u0002\u0002", - "\u082c\u082e\u0007V\u0002\u0002\u082d\u0820\u0003\u0002\u0002\u0002", - "\u082d\u0827\u0003\u0002\u0002\u0002\u082e\u00ea\u0003\u0002\u0002\u0002", - "\u082f\u0830\u0005\u01cd\u00e7\u0002\u0830\u0831\u0005\u01b1\u00d9\u0002", - "\u0831\u0832\u0005\u01cf\u00e8\u0002\u0832\u0837\u0003\u0002\u0002\u0002", - "\u0833\u0834\u0007U\u0002\u0002\u0834\u0835\u0007G\u0002\u0002\u0835", - "\u0837\u0007V\u0002\u0002\u0836\u082f\u0003\u0002\u0002\u0002\u0836", - "\u0833\u0003\u0002\u0002\u0002\u0837\u00ec\u0003\u0002\u0002\u0002\u0838", - "\u0839\u0005\u01cd\u00e7\u0002\u0839\u083a\u0005\u01b3\u00da\u0002\u083a", - "\u083b\u0005\u01d1\u00e9\u0002\u083b\u083c\u0005\u01c3\u00e2\u0002\u083c", - "\u083d\u0005\u01ad\u00d7\u0002\u083d\u0844\u0003\u0002\u0002\u0002\u083e", - "\u083f\u0007U\u0002\u0002\u083f\u0840\u0007H\u0002\u0002\u0840\u0841", - "\u0007W\u0002\u0002\u0841\u0842\u0007P\u0002\u0002\u0842\u0844\u0007", - "E\u0002\u0002\u0843\u0838\u0003\u0002\u0002\u0002\u0843\u083e\u0003", - "\u0002\u0002\u0002\u0844\u00ee\u0003\u0002\u0002\u0002\u0845\u0846\u0005", - "\u01cd\u00e7\u0002\u0846\u0847\u0005\u01cf\u00e8\u0002\u0847\u0848\u0005", - "\u01a9\u00d5\u0002\u0848\u0849\u0005\u01cf\u00e8\u0002\u0849\u084a\u0005", - "\u01b9\u00dd\u0002\u084a\u084b\u0005\u01ad\u00d7\u0002\u084b\u0853\u0003", - "\u0002\u0002\u0002\u084c\u084d\u0007U\u0002\u0002\u084d\u084e\u0007", - "V\u0002\u0002\u084e\u084f\u0007C\u0002\u0002\u084f\u0850\u0007V\u0002", - "\u0002\u0850\u0851\u0007K\u0002\u0002\u0851\u0853\u0007E\u0002\u0002", - "\u0852\u0845\u0003\u0002\u0002\u0002\u0852\u084c\u0003\u0002\u0002\u0002", - "\u0853\u00f0\u0003\u0002\u0002\u0002\u0854\u0855\u0005\u01cd\u00e7\u0002", - "\u0855\u0856\u0005\u01cf\u00e8\u0002\u0856\u0857\u0005\u01c5\u00e3\u0002", - "\u0857\u0858\u0005\u01cb\u00e6\u0002\u0858\u0859\u0005\u01a9\u00d5\u0002", - "\u0859\u085a\u0005\u01b5\u00db\u0002\u085a\u085b\u0005\u01b1\u00d9\u0002", - "\u085b\u0864\u0003\u0002\u0002\u0002\u085c\u085d\u0007U\u0002\u0002", - "\u085d\u085e\u0007V\u0002\u0002\u085e\u085f\u0007Q\u0002\u0002\u085f", - "\u0860\u0007T\u0002\u0002\u0860\u0861\u0007C\u0002\u0002\u0861\u0862", - "\u0007I\u0002\u0002\u0862\u0864\u0007G\u0002\u0002\u0863\u0854\u0003", - "\u0002\u0002\u0002\u0863\u085c\u0003\u0002\u0002\u0002\u0864\u00f2\u0003", - "\u0002\u0002\u0002\u0865\u0866\u0005\u01cd\u00e7\u0002\u0866\u0867\u0005", - "\u01cf\u00e8\u0002\u0867\u0868\u0005\u01d9\u00ed\u0002\u0868\u0869\u0005", - "\u01c7\u00e4\u0002\u0869\u086a\u0005\u01b1\u00d9\u0002\u086a\u0871\u0003", - "\u0002\u0002\u0002\u086b\u086c\u0007U\u0002\u0002\u086c\u086d\u0007", - "V\u0002\u0002\u086d\u086e\u0007[\u0002\u0002\u086e\u086f\u0007R\u0002", - "\u0002\u086f\u0871\u0007G\u0002\u0002\u0870\u0865\u0003\u0002\u0002", - "\u0002\u0870\u086b\u0003\u0002\u0002\u0002\u0871\u00f4\u0003\u0002\u0002", - "\u0002\u0872\u0873\u0005\u01cd\u00e7\u0002\u0873\u0874\u0005\u01d1\u00e9", - "\u0002\u0874\u0875\u0005\u01c7\u00e4\u0002\u0875\u0876\u0005\u01b1\u00d9", - "\u0002\u0876\u0877\u0005\u01cb\u00e6\u0002\u0877\u0878\u0005\u01d1\u00e9", - "\u0002\u0878\u0879\u0005\u01cd\u00e7\u0002\u0879\u087a\u0005\u01b1\u00d9", - "\u0002\u087a\u087b\u0005\u01cb\u00e6\u0002\u087b\u0886\u0003\u0002\u0002", - "\u0002\u087c\u087d\u0007U\u0002\u0002\u087d\u087e\u0007W\u0002\u0002", - "\u087e\u087f\u0007R\u0002\u0002\u087f\u0880\u0007G\u0002\u0002\u0880", - "\u0881\u0007T\u0002\u0002\u0881\u0882\u0007W\u0002\u0002\u0882\u0883", - "\u0007U\u0002\u0002\u0883\u0884\u0007G\u0002\u0002\u0884\u0886\u0007", - "T\u0002\u0002\u0885\u0872\u0003\u0002\u0002\u0002\u0885\u087c\u0003", - "\u0002\u0002\u0002\u0886\u00f6\u0003\u0002\u0002\u0002\u0887\u0888\u0005", - "\u01cf\u00e8\u0002\u0888\u0889\u0005\u01a9\u00d5\u0002\u0889\u088a\u0005", - "\u01ab\u00d6\u0002\u088a\u088b\u0005\u01bf\u00e0\u0002\u088b\u088c\u0005", - "\u01b1\u00d9\u0002\u088c\u0893\u0003\u0002\u0002\u0002\u088d\u088e\u0007", - "V\u0002\u0002\u088e\u088f\u0007C\u0002\u0002\u088f\u0890\u0007D\u0002", - "\u0002\u0890\u0891\u0007N\u0002\u0002\u0891\u0893\u0007G\u0002\u0002", - "\u0892\u0887\u0003\u0002\u0002\u0002\u0892\u088d\u0003\u0002\u0002\u0002", - "\u0893\u00f8\u0003\u0002\u0002\u0002\u0894\u0895\u0005\u01cf\u00e8\u0002", - "\u0895\u0896\u0005\u01b7\u00dc\u0002\u0896\u0897\u0005\u01cb\u00e6\u0002", - "\u0897\u0898\u0005\u01b1\u00d9\u0002\u0898\u0899\u0005\u01b1\u00d9\u0002", - "\u0899\u08a0\u0003\u0002\u0002\u0002\u089a\u089b\u0007V\u0002\u0002", - "\u089b\u089c\u0007J\u0002\u0002\u089c\u089d\u0007T\u0002\u0002\u089d", - "\u089e\u0007G\u0002\u0002\u089e\u08a0\u0007G\u0002\u0002\u089f\u0894", - "\u0003\u0002\u0002\u0002\u089f\u089a\u0003\u0002\u0002\u0002\u08a0\u00fa", - "\u0003\u0002\u0002\u0002\u08a1\u08a2\u0005\u01cf\u00e8\u0002\u08a2\u08a3", - "\u0005\u01b9\u00dd\u0002\u08a3\u08a4\u0005\u01c1\u00e1\u0002\u08a4\u08a5", - "\u0005\u01b1\u00d9\u0002\u08a5\u08a6\u0005\u01cd\u00e7\u0002\u08a6\u08a7", - "\u0005\u01cf\u00e8\u0002\u08a7\u08a8\u0005\u01a9\u00d5\u0002\u08a8\u08a9", - "\u0005\u01c1\u00e1\u0002\u08a9\u08aa\u0005\u01c7\u00e4\u0002\u08aa\u08b5", - "\u0003\u0002\u0002\u0002\u08ab\u08ac\u0007V\u0002\u0002\u08ac\u08ad", - "\u0007K\u0002\u0002\u08ad\u08ae\u0007O\u0002\u0002\u08ae\u08af\u0007", - "G\u0002\u0002\u08af\u08b0\u0007U\u0002\u0002\u08b0\u08b1\u0007V\u0002", - "\u0002\u08b1\u08b2\u0007C\u0002\u0002\u08b2\u08b3\u0007O\u0002\u0002", - "\u08b3\u08b5\u0007R\u0002\u0002\u08b4\u08a1\u0003\u0002\u0002\u0002", - "\u08b4\u08ab\u0003\u0002\u0002\u0002\u08b5\u00fc\u0003\u0002\u0002\u0002", - "\u08b6\u08b7\u0005\u01cf\u00e8\u0002\u08b7\u08b8\u0005\u01c5\u00e3\u0002", - "\u08b8\u08bc\u0003\u0002\u0002\u0002\u08b9\u08ba\u0007V\u0002\u0002", - "\u08ba\u08bc\u0007Q\u0002\u0002\u08bb\u08b6\u0003\u0002\u0002\u0002", - "\u08bb\u08b9\u0003\u0002\u0002\u0002\u08bc\u00fe\u0003\u0002\u0002\u0002", - "\u08bd\u08be\u0005\u01cf\u00e8\u0002\u08be\u08bf\u0005\u01c5\u00e3\u0002", - "\u08bf\u08c0\u0005\u01bd\u00df\u0002\u08c0\u08c1\u0005\u01b1\u00d9\u0002", - "\u08c1\u08c2\u0005\u01c3\u00e2\u0002\u08c2\u08c9\u0003\u0002\u0002\u0002", - "\u08c3\u08c4\u0007V\u0002\u0002\u08c4\u08c5\u0007Q\u0002\u0002\u08c5", - "\u08c6\u0007M\u0002\u0002\u08c6\u08c7\u0007G\u0002\u0002\u08c7\u08c9", - "\u0007P\u0002\u0002\u08c8\u08bd\u0003\u0002\u0002\u0002\u08c8\u08c3", - "\u0003\u0002\u0002\u0002\u08c9\u0100\u0003\u0002\u0002\u0002\u08ca\u08cb", - "\u0005\u01cf\u00e8\u0002\u08cb\u08cc\u0005\u01cb\u00e6\u0002\u08cc\u08cd", - "\u0005\u01b9\u00dd\u0002\u08cd\u08ce\u0005\u01b5\u00db\u0002\u08ce\u08cf", - "\u0005\u01b5\u00db\u0002\u08cf\u08d0\u0005\u01b1\u00d9\u0002\u08d0\u08d1", - "\u0005\u01cb\u00e6\u0002\u08d1\u08da\u0003\u0002\u0002\u0002\u08d2\u08d3", - "\u0007V\u0002\u0002\u08d3\u08d4\u0007T\u0002\u0002\u08d4\u08d5\u0007", - "K\u0002\u0002\u08d5\u08d6\u0007I\u0002\u0002\u08d6\u08d7\u0007I\u0002", - "\u0002\u08d7\u08d8\u0007G\u0002\u0002\u08d8\u08da\u0007T\u0002\u0002", - "\u08d9\u08ca\u0003\u0002\u0002\u0002\u08d9\u08d2\u0003\u0002\u0002\u0002", - "\u08da\u0102\u0003\u0002\u0002\u0002\u08db\u08dc\u0005\u01cf\u00e8\u0002", - "\u08dc\u08dd\u0005\u01cb\u00e6\u0002\u08dd\u08de\u0005\u01d1\u00e9\u0002", - "\u08de\u08df\u0005\u01b1\u00d9\u0002\u08df\u08ec\u0003\u0002\u0002\u0002", - "\u08e0\u08e1\u0007V\u0002\u0002\u08e1\u08e2\u0007T\u0002\u0002\u08e2", - "\u08e3\u0007W\u0002\u0002\u08e3\u08ec\u0007G\u0002\u0002\u08e4\u08e5", - "\u0005-\u0017\u0002\u08e5\u08e6\u0005\u01cf\u00e8\u0002\u08e6\u08e7", - "\u0005\u01cb\u00e6\u0002\u08e7\u08e8\u0005\u01d1\u00e9\u0002\u08e8\u08e9", - "\u0005\u01b1\u00d9\u0002\u08e9\u08ea\u0005-\u0017\u0002\u08ea\u08ec", - "\u0003\u0002\u0002\u0002\u08eb\u08db\u0003\u0002\u0002\u0002\u08eb\u08e0", - "\u0003\u0002\u0002\u0002\u08eb\u08e4\u0003\u0002\u0002\u0002\u08ec\u0104", - "\u0003\u0002\u0002\u0002\u08ed\u08ee\u0005\u01cf\u00e8\u0002\u08ee\u08ef", - "\u0005\u01cb\u00e6\u0002\u08ef\u08f0\u0005\u01d1\u00e9\u0002\u08f0\u08f1", - "\u0005\u01c3\u00e2\u0002\u08f1\u08f2\u0005\u01ad\u00d7\u0002\u08f2\u08f3", - "\u0005\u01a9\u00d5\u0002\u08f3\u08f4\u0005\u01cf\u00e8\u0002\u08f4\u08f5", - "\u0005\u01b1\u00d9\u0002\u08f5\u08ff\u0003\u0002\u0002\u0002\u08f6\u08f7", - "\u0007V\u0002\u0002\u08f7\u08f8\u0007T\u0002\u0002\u08f8\u08f9\u0007", - "W\u0002\u0002\u08f9\u08fa\u0007P\u0002\u0002\u08fa\u08fb\u0007E\u0002", - "\u0002\u08fb\u08fc\u0007C\u0002\u0002\u08fc\u08fd\u0007V\u0002\u0002", - "\u08fd\u08ff\u0007G\u0002\u0002\u08fe\u08ed\u0003\u0002\u0002\u0002", - "\u08fe\u08f6\u0003\u0002\u0002\u0002\u08ff\u0106\u0003\u0002\u0002\u0002", - "\u0900\u0901\u0005\u01cf\u00e8\u0002\u0901\u0902\u0005\u01cf\u00e8\u0002", - "\u0902\u0903\u0005\u01bf\u00e0\u0002\u0903\u0908\u0003\u0002\u0002\u0002", - "\u0904\u0905\u0007V\u0002\u0002\u0905\u0906\u0007V\u0002\u0002\u0906", - "\u0908\u0007N\u0002\u0002\u0907\u0900\u0003\u0002\u0002\u0002\u0907", - "\u0904\u0003\u0002\u0002\u0002\u0908\u0108\u0003\u0002\u0002\u0002\u0909", - "\u090a\u0005\u01cf\u00e8\u0002\u090a\u090b\u0005\u01d5\u00eb\u0002\u090b", - "\u090c\u0005\u01c5\u00e3\u0002\u090c\u0911\u0003\u0002\u0002\u0002\u090d", - "\u090e\u0007V\u0002\u0002\u090e\u090f\u0007Y\u0002\u0002\u090f\u0911", - "\u0007Q\u0002\u0002\u0910\u0909\u0003\u0002\u0002\u0002\u0910\u090d", - "\u0003\u0002\u0002\u0002\u0911\u010a\u0003\u0002\u0002\u0002\u0912\u0913", - "\u0005\u01cf\u00e8\u0002\u0913\u0914\u0005\u01d9\u00ed\u0002\u0914\u0915", - "\u0005\u01c7\u00e4\u0002\u0915\u0916\u0005\u01b1\u00d9\u0002\u0916\u091c", - "\u0003\u0002\u0002\u0002\u0917\u0918\u0007V\u0002\u0002\u0918\u0919", - "\u0007[\u0002\u0002\u0919\u091a\u0007R\u0002\u0002\u091a\u091c\u0007", - "G\u0002\u0002\u091b\u0912\u0003\u0002\u0002\u0002\u091b\u0917\u0003", - "\u0002\u0002\u0002\u091c\u010c\u0003\u0002\u0002\u0002\u091d\u091e\u0005", - "\u01d1\u00e9\u0002\u091e\u091f\u0005\u01c3\u00e2\u0002\u091f\u0920\u0005", - "\u01bf\u00e0\u0002\u0920\u0921\u0005\u01c5\u00e3\u0002\u0921\u0922\u0005", - "\u01b5\u00db\u0002\u0922\u0923\u0005\u01b5\u00db\u0002\u0923\u0924\u0005", - "\u01b1\u00d9\u0002\u0924\u0925\u0005\u01af\u00d8\u0002\u0925\u092f\u0003", - "\u0002\u0002\u0002\u0926\u0927\u0007W\u0002\u0002\u0927\u0928\u0007", - "P\u0002\u0002\u0928\u0929\u0007N\u0002\u0002\u0929\u092a\u0007Q\u0002", - "\u0002\u092a\u092b\u0007I\u0002\u0002\u092b\u092c\u0007I\u0002\u0002", - "\u092c\u092d\u0007G\u0002\u0002\u092d\u092f\u0007F\u0002\u0002\u092e", - "\u091d\u0003\u0002\u0002\u0002\u092e\u0926\u0003\u0002\u0002\u0002\u092f", - "\u010e\u0003\u0002\u0002\u0002\u0930\u0931\u0005\u01d1\u00e9\u0002\u0931", - "\u0932\u0005\u01c7\u00e4\u0002\u0932\u0933\u0005\u01af\u00d8\u0002\u0933", - "\u0934\u0005\u01a9\u00d5\u0002\u0934\u0935\u0005\u01cf\u00e8\u0002\u0935", - "\u0936\u0005\u01b1\u00d9\u0002\u0936\u093e\u0003\u0002\u0002\u0002\u0937", - "\u0938\u0007W\u0002\u0002\u0938\u0939\u0007R\u0002\u0002\u0939\u093a", - "\u0007F\u0002\u0002\u093a\u093b\u0007C\u0002\u0002\u093b\u093c\u0007", - "V\u0002\u0002\u093c\u093e\u0007G\u0002\u0002\u093d\u0930\u0003\u0002", - "\u0002\u0002\u093d\u0937\u0003\u0002\u0002\u0002\u093e\u0110\u0003\u0002", - "\u0002\u0002\u093f\u0940\u0005\u01d1\u00e9\u0002\u0940\u0941\u0005\u01cd", - "\u00e7\u0002\u0941\u0942\u0005\u01b1\u00d9\u0002\u0942\u0947\u0003\u0002", - "\u0002\u0002\u0943\u0944\u0007W\u0002\u0002\u0944\u0945\u0007U\u0002", - "\u0002\u0945\u0947\u0007G\u0002\u0002\u0946\u093f\u0003\u0002\u0002", - "\u0002\u0946\u0943\u0003\u0002\u0002\u0002\u0947\u0112\u0003\u0002\u0002", - "\u0002\u0948\u0949\u0005\u01d1\u00e9\u0002\u0949\u094a\u0005\u01cd\u00e7", - "\u0002\u094a\u094b\u0005\u01b1\u00d9\u0002\u094b\u094c\u0005\u01cb\u00e6", - "\u0002\u094c\u0952\u0003\u0002\u0002\u0002\u094d\u094e\u0007W\u0002", - "\u0002\u094e\u094f\u0007U\u0002\u0002\u094f\u0950\u0007G\u0002\u0002", - "\u0950\u0952\u0007T\u0002\u0002\u0951\u0948\u0003\u0002\u0002\u0002", - "\u0951\u094d\u0003\u0002\u0002\u0002\u0952\u0114\u0003\u0002\u0002\u0002", - "\u0953\u0954\u0005\u01d1\u00e9\u0002\u0954\u0955\u0005\u01cd\u00e7\u0002", - "\u0955\u0956\u0005\u01b9\u00dd\u0002\u0956\u0957\u0005\u01c3\u00e2\u0002", - "\u0957\u0958\u0005\u01b5\u00db\u0002\u0958\u095f\u0003\u0002\u0002\u0002", - "\u0959\u095a\u0007W\u0002\u0002\u095a\u095b\u0007U\u0002\u0002\u095b", - "\u095c\u0007K\u0002\u0002\u095c\u095d\u0007P\u0002\u0002\u095d\u095f", - "\u0007I\u0002\u0002\u095e\u0953\u0003\u0002\u0002\u0002\u095e\u0959", - "\u0003\u0002\u0002\u0002\u095f\u0116\u0003\u0002\u0002\u0002\u0960\u0961", - "\u0005\u01d1\u00e9\u0002\u0961\u0962\u0005\u01d1\u00e9\u0002\u0962\u0963", - "\u0005\u01b9\u00dd\u0002\u0963\u0964\u0005\u01af\u00d8\u0002\u0964\u096a", - "\u0003\u0002\u0002\u0002\u0965\u0966\u0007W\u0002\u0002\u0966\u0967", - "\u0007W\u0002\u0002\u0967\u0968\u0007K\u0002\u0002\u0968\u096a\u0007", - "F\u0002\u0002\u0969\u0960\u0003\u0002\u0002\u0002\u0969\u0965\u0003", - "\u0002\u0002\u0002\u096a\u0118\u0003\u0002\u0002\u0002\u096b\u096c\u0005", - "\u01d3\u00ea\u0002\u096c\u096d\u0005\u01a9\u00d5\u0002\u096d\u096e\u0005", - "\u01bf\u00e0\u0002\u096e\u096f\u0005\u01d1\u00e9\u0002\u096f\u0970\u0005", - "\u01b1\u00d9\u0002\u0970\u0971\u0005\u01cd\u00e7\u0002\u0971\u0979\u0003", - "\u0002\u0002\u0002\u0972\u0973\u0007X\u0002\u0002\u0973\u0974\u0007", - "C\u0002\u0002\u0974\u0975\u0007N\u0002\u0002\u0975\u0976\u0007W\u0002", - "\u0002\u0976\u0977\u0007G\u0002\u0002\u0977\u0979\u0007U\u0002\u0002", - "\u0978\u096b\u0003\u0002\u0002\u0002\u0978\u0972\u0003\u0002\u0002\u0002", - "\u0979\u011a\u0003\u0002\u0002\u0002\u097a\u097b\u0005\u01d3\u00ea\u0002", - "\u097b\u097c\u0005\u01b9\u00dd\u0002\u097c\u097d\u0005\u01b1\u00d9\u0002", - "\u097d\u097e\u0005\u01d5\u00eb\u0002\u097e\u0984\u0003\u0002\u0002\u0002", - "\u097f\u0980\u0007X\u0002\u0002\u0980\u0981\u0007K\u0002\u0002\u0981", - "\u0982\u0007G\u0002\u0002\u0982\u0984\u0007Y\u0002\u0002\u0983\u097a", - "\u0003\u0002\u0002\u0002\u0983\u097f\u0003\u0002\u0002\u0002\u0984\u011c", - "\u0003\u0002\u0002\u0002\u0985\u0986\u0005\u01d5\u00eb\u0002\u0986\u0987", - "\u0005\u01b7\u00dc\u0002\u0987\u0988\u0005\u01b1\u00d9\u0002\u0988\u0989", - "\u0005\u01cb\u00e6\u0002\u0989\u098a\u0005\u01b1\u00d9\u0002\u098a\u0991", - "\u0003\u0002\u0002\u0002\u098b\u098c\u0007Y\u0002\u0002\u098c\u098d", - "\u0007J\u0002\u0002\u098d\u098e\u0007G\u0002\u0002\u098e\u098f\u0007", - "T\u0002\u0002\u098f\u0991\u0007G\u0002\u0002\u0990\u0985\u0003\u0002", - "\u0002\u0002\u0990\u098b\u0003\u0002\u0002\u0002\u0991\u011e\u0003\u0002", - "\u0002\u0002\u0992\u0993\u0005\u01d5\u00eb\u0002\u0993\u0994\u0005\u01b9", - "\u00dd\u0002\u0994\u0995\u0005\u01cf\u00e8\u0002\u0995\u0996\u0005\u01b7", - "\u00dc\u0002\u0996\u099c\u0003\u0002\u0002\u0002\u0997\u0998\u0007Y", - "\u0002\u0002\u0998\u0999\u0007K\u0002\u0002\u0999\u099a\u0007V\u0002", - "\u0002\u099a\u099c\u0007J\u0002\u0002\u099b\u0992\u0003\u0002\u0002", - "\u0002\u099b\u0997\u0003\u0002\u0002\u0002\u099c\u0120\u0003\u0002\u0002", - "\u0002\u099d\u099e\u0005\u01d5\u00eb\u0002\u099e\u099f\u0005\u01cb\u00e6", - "\u0002\u099f\u09a0\u0005\u01b9\u00dd\u0002\u09a0\u09a1\u0005\u01cf\u00e8", - "\u0002\u09a1\u09a2\u0005\u01b1\u00d9\u0002\u09a2\u09a3\u0005\u01cf\u00e8", - "\u0002\u09a3\u09a4\u0005\u01b9\u00dd\u0002\u09a4\u09a5\u0005\u01c1\u00e1", - "\u0002\u09a5\u09a6\u0005\u01b1\u00d9\u0002\u09a6\u09b1\u0003\u0002\u0002", - "\u0002\u09a7\u09a8\u0007Y\u0002\u0002\u09a8\u09a9\u0007T\u0002\u0002", - "\u09a9\u09aa\u0007K\u0002\u0002\u09aa\u09ab\u0007V\u0002\u0002\u09ab", - "\u09ac\u0007G\u0002\u0002\u09ac\u09ad\u0007V\u0002\u0002\u09ad\u09ae", - "\u0007K\u0002\u0002\u09ae\u09af\u0007O\u0002\u0002\u09af\u09b1\u0007", - "G\u0002\u0002\u09b0\u099d\u0003\u0002\u0002\u0002\u09b0\u09a7\u0003", - "\u0002\u0002\u0002\u09b1\u0122\u0003\u0002\u0002\u0002\u09b2\u09b3\u0005", - "\u01a9\u00d5\u0002\u09b3\u09b4\u0005\u01cd\u00e7\u0002\u09b4\u09b5\u0005", - "\u01ad\u00d7\u0002\u09b5\u09b6\u0005\u01b9\u00dd\u0002\u09b6\u09b7\u0005", - "\u01b9\u00dd\u0002\u09b7\u09c1\u0003\u0002\u0002\u0002\u09b8\u09b9\u0005", - "-\u0017\u0002\u09b9\u09ba\u0005\u01a9\u00d5\u0002\u09ba\u09bb\u0005", - "\u01cd\u00e7\u0002\u09bb\u09bc\u0005\u01ad\u00d7\u0002\u09bc\u09bd\u0005", - "\u01b9\u00dd\u0002\u09bd\u09be\u0005\u01b9\u00dd\u0002\u09be\u09bf\u0005", - "-\u0017\u0002\u09bf\u09c1\u0003\u0002\u0002\u0002\u09c0\u09b2\u0003", - "\u0002\u0002\u0002\u09c0\u09b8\u0003\u0002\u0002\u0002\u09c1\u0124\u0003", - "\u0002\u0002\u0002\u09c2\u09c3\u0005-\u0017\u0002\u09c3\u09c4\u0005", - "\u01ad\u00d7\u0002\u09c4\u09c5\u0005\u01a9\u00d5\u0002\u09c5\u09c6\u0005", - "\u01cd\u00e7\u0002\u09c6\u09c7\u0005\u01b1\u00d9\u0002\u09c7\u09c8\u0007", - "a\u0002\u0002\u09c8\u09c9\u0005\u01cd\u00e7\u0002\u09c9\u09ca\u0005", - "\u01b1\u00d9\u0002\u09ca\u09cb\u0005\u01c3\u00e2\u0002\u09cb\u09cc\u0005", - "\u01cd\u00e7\u0002\u09cc\u09cd\u0005\u01b9\u00dd\u0002\u09cd\u09ce\u0005", - "\u01cf\u00e8\u0002\u09ce\u09cf\u0005\u01b9\u00dd\u0002\u09cf\u09d0\u0005", - "\u01d3\u00ea\u0002\u09d0\u09d1\u0005\u01b1\u00d9\u0002\u09d1\u09d2\u0005", - "-\u0017\u0002\u09d2\u0126\u0003\u0002\u0002\u0002\u09d3\u09d4\u0005", - "-\u0017\u0002\u09d4\u09d5\u0005\u01c3\u00e2\u0002\u09d5\u09d6\u0005", - "\u01c5\u00e3\u0002\u09d6\u09d7\u0005\u01cb\u00e6\u0002\u09d7\u09d8\u0005", - "\u01c1\u00e1\u0002\u09d8\u09d9\u0005\u01a9\u00d5\u0002\u09d9\u09da\u0005", - "\u01bf\u00e0\u0002\u09da\u09db\u0005\u01b9\u00dd\u0002\u09db\u09dc\u0005", - "\u01db\u00ee\u0002\u09dc\u09dd\u0005\u01b1\u00d9\u0002\u09dd\u09de\u0005", - "-\u0017\u0002\u09de\u0128\u0003\u0002\u0002\u0002\u09df\u09e0\u0005", - "\u01cd\u00e7\u0002\u09e0\u09e1\u0005\u01b9\u00dd\u0002\u09e1\u09e2\u0005", - "\u01c1\u00e1\u0002\u09e2\u09e3\u0005\u01b9\u00dd\u0002\u09e3\u09e4\u0005", - "\u01bf\u00e0\u0002\u09e4\u09e5\u0005\u01a9\u00d5\u0002\u09e5\u09e6\u0005", - "\u01cb\u00e6\u0002\u09e6\u09e7\u0005\u01b9\u00dd\u0002\u09e7\u09e8\u0005", - "\u01cf\u00e8\u0002\u09e8\u09e9\u0005\u01d9\u00ed\u0002\u09e9\u09ea\u0007", - "a\u0002\u0002\u09ea\u09eb\u0005\u01b3\u00da\u0002\u09eb\u09ec\u0005", - "\u01d1\u00e9\u0002\u09ec\u09ed\u0005\u01c3\u00e2\u0002\u09ed\u09ee\u0005", - "\u01ad\u00d7\u0002\u09ee\u09ef\u0005\u01cf\u00e8\u0002\u09ef\u09f0\u0005", - "\u01b9\u00dd\u0002\u09f0\u09f1\u0005\u01c5\u00e3\u0002\u09f1\u09f2\u0005", - "\u01c3\u00e2\u0002\u09f2\u0a0a\u0003\u0002\u0002\u0002\u09f3\u09f4\u0005", - "-\u0017\u0002\u09f4\u09f5\u0005\u01cd\u00e7\u0002\u09f5\u09f6\u0005", - "\u01b9\u00dd\u0002\u09f6\u09f7\u0005\u01c1\u00e1\u0002\u09f7\u09f8\u0005", - "\u01b9\u00dd\u0002\u09f8\u09f9\u0005\u01bf\u00e0\u0002\u09f9\u09fa\u0005", - "\u01a9\u00d5\u0002\u09fa\u09fb\u0005\u01cb\u00e6\u0002\u09fb\u09fc\u0005", - "\u01b9\u00dd\u0002\u09fc\u09fd\u0005\u01cf\u00e8\u0002\u09fd\u09fe\u0005", - "\u01d9\u00ed\u0002\u09fe\u09ff\u0007a\u0002\u0002\u09ff\u0a00\u0005", - "\u01b3\u00da\u0002\u0a00\u0a01\u0005\u01d1\u00e9\u0002\u0a01\u0a02\u0005", - "\u01c3\u00e2\u0002\u0a02\u0a03\u0005\u01ad\u00d7\u0002\u0a03\u0a04\u0005", - "\u01cf\u00e8\u0002\u0a04\u0a05\u0005\u01b9\u00dd\u0002\u0a05\u0a06\u0005", - "\u01c5\u00e3\u0002\u0a06\u0a07\u0005\u01c3\u00e2\u0002\u0a07\u0a08\u0005", - "-\u0017\u0002\u0a08\u0a0a\u0003\u0002\u0002\u0002\u0a09\u09df\u0003", - "\u0002\u0002\u0002\u0a09\u09f3\u0003\u0002\u0002\u0002\u0a0a\u012a\u0003", - "\u0002\u0002\u0002\u0a0b\u0a0c\u0005-\u0017\u0002\u0a0c\u0a0d\u0005", - "\u01a9\u00d5\u0002\u0a0d\u0a0e\u0005\u01c3\u00e2\u0002\u0a0e\u0a0f\u0005", - "\u01a9\u00d5\u0002\u0a0f\u0a10\u0005\u01bf\u00e0\u0002\u0a10\u0a11\u0005", - "\u01d9\u00ed\u0002\u0a11\u0a12\u0005\u01db\u00ee\u0002\u0a12\u0a13\u0005", - "\u01b1\u00d9\u0002\u0a13\u0a14\u0005\u01af\u00d8\u0002\u0a14\u0a15\u0005", - "-\u0017\u0002\u0a15\u012c\u0003\u0002\u0002\u0002\u0a16\u0a17\u0005", - "-\u0017\u0002\u0a17\u0a18\u0005\u01b9\u00dd\u0002\u0a18\u0a19\u0005", - "\u01cd\u00e7\u0002\u0a19\u0a1a\u0007a\u0002\u0002\u0a1a\u0a1b\u0005", - "\u01bf\u00e0\u0002\u0a1b\u0a1c\u0005\u01b9\u00dd\u0002\u0a1c\u0a1d\u0005", - "\u01cf\u00e8\u0002\u0a1d\u0a1e\u0005\u01b1\u00d9\u0002\u0a1e\u0a1f\u0005", - "\u01cb\u00e6\u0002\u0a1f\u0a20\u0005\u01a9\u00d5\u0002\u0a20\u0a21\u0005", - "\u01bf\u00e0\u0002\u0a21\u0a22\u0005-\u0017\u0002\u0a22\u012e\u0003", - "\u0002\u0002\u0002\u0a23\u0a24\u0005-\u0017\u0002\u0a24\u0a25\u0005", - "\u01c1\u00e1\u0002\u0a25\u0a26\u0005\u01a9\u00d5\u0002\u0a26\u0a27\u0005", - "\u01d7\u00ec\u0002\u0a27\u0a28\u0007a\u0002\u0002\u0a28\u0a29\u0005", - "\u01ad\u00d7\u0002\u0a29\u0a2a\u0005\u01c5\u00e3\u0002\u0a2a\u0a2b\u0005", - "\u01c1\u00e1\u0002\u0a2b\u0a2c\u0005\u01c7\u00e4\u0002\u0a2c\u0a2d\u0005", - "\u01a9\u00d5\u0002\u0a2d\u0a2e\u0005\u01ad\u00d7\u0002\u0a2e\u0a2f\u0005", - "\u01cf\u00e8\u0002\u0a2f\u0a30\u0005\u01b9\u00dd\u0002\u0a30\u0a31\u0005", - "\u01c5\u00e3\u0002\u0a31\u0a32\u0005\u01c3\u00e2\u0002\u0a32\u0a33\u0007", - "a\u0002\u0002\u0a33\u0a34\u0005\u01b3\u00da\u0002\u0a34\u0a35\u0005", - "\u01bf\u00e0\u0002\u0a35\u0a36\u0005\u01d1\u00e9\u0002\u0a36\u0a37\u0005", - "\u01cd\u00e7\u0002\u0a37\u0a38\u0005\u01b7\u00dc\u0002\u0a38\u0a39\u0007", - "a\u0002\u0002\u0a39\u0a3a\u0005\u01c1\u00e1\u0002\u0a3a\u0a3b\u0005", - "\u01b1\u00d9\u0002\u0a3b\u0a3c\u0005\u01c1\u00e1\u0002\u0a3c\u0a3d\u0005", - "\u01c5\u00e3\u0002\u0a3d\u0a3e\u0005\u01cb\u00e6\u0002\u0a3e\u0a3f\u0005", - "\u01d9\u00ed\u0002\u0a3f\u0a40\u0007a\u0002\u0002\u0a40\u0a41\u0005", - "\u01b9\u00dd\u0002\u0a41\u0a42\u0005\u01c3\u00e2\u0002\u0a42\u0a43\u0007", - "a\u0002\u0002\u0a43\u0a44\u0005\u01c1\u00e1\u0002\u0a44\u0a45\u0005", - "\u01ab\u00d6\u0002\u0a45\u0a46\u0005-\u0017\u0002\u0a46\u0130\u0003", - "\u0002\u0002\u0002\u0a47\u0a48\u0005-\u0017\u0002\u0a48\u0a49\u0005", - "\u01cf\u00e8\u0002\u0a49\u0a4a\u0005\u01c5\u00e3\u0002\u0a4a\u0a4b\u0005", - "\u01bd\u00df\u0002\u0a4b\u0a4c\u0005\u01b1\u00d9\u0002\u0a4c\u0a4d\u0005", - "\u01c3\u00e2\u0002\u0a4d\u0a4e\u0005\u01b9\u00dd\u0002\u0a4e\u0a4f\u0005", - "\u01db\u00ee\u0002\u0a4f\u0a50\u0005\u01a9\u00d5\u0002\u0a50\u0a51\u0005", - "\u01cf\u00e8\u0002\u0a51\u0a52\u0005\u01b9\u00dd\u0002\u0a52\u0a53\u0005", - "\u01c5\u00e3\u0002\u0a53\u0a54\u0005\u01c3\u00e2\u0002\u0a54\u0a55\u0007", - "a\u0002\u0002\u0a55\u0a56\u0005\u01b1\u00d9\u0002\u0a56\u0a57\u0005", - "\u01c3\u00e2\u0002\u0a57\u0a58\u0005\u01a9\u00d5\u0002\u0a58\u0a59\u0005", - "\u01ab\u00d6\u0002\u0a59\u0a5a\u0005\u01bf\u00e0\u0002\u0a5a\u0a5b\u0005", - "\u01b1\u00d9\u0002\u0a5b\u0a5c\u0007a\u0002\u0002\u0a5c\u0a5d\u0005", - "\u01cd\u00e7\u0002\u0a5d\u0a5e\u0005\u01cf\u00e8\u0002\u0a5e\u0a5f\u0005", - "\u01b1\u00d9\u0002\u0a5f\u0a60\u0005\u01c1\u00e1\u0002\u0a60\u0a61\u0005", - "\u01c1\u00e1\u0002\u0a61\u0a62\u0005\u01b9\u00dd\u0002\u0a62\u0a63\u0005", - "\u01c3\u00e2\u0002\u0a63\u0a64\u0005\u01b5\u00db\u0002\u0a64\u0a65\u0005", - "-\u0017\u0002\u0a65\u0132\u0003\u0002\u0002\u0002\u0a66\u0a67\u0005", - "-\u0017\u0002\u0a67\u0a68\u0005\u01cf\u00e8\u0002\u0a68\u0a69\u0005", - "\u01c5\u00e3\u0002\u0a69\u0a6a\u0005\u01bd\u00df\u0002\u0a6a\u0a6b\u0005", - "\u01b1\u00d9\u0002\u0a6b\u0a6c\u0005\u01c3\u00e2\u0002\u0a6c\u0a6d\u0005", - "\u01b9\u00dd\u0002\u0a6d\u0a6e\u0005\u01db\u00ee\u0002\u0a6e\u0a6f\u0005", - "\u01a9\u00d5\u0002\u0a6f\u0a70\u0005\u01cf\u00e8\u0002\u0a70\u0a71\u0005", - "\u01b9\u00dd\u0002\u0a71\u0a72\u0005\u01c5\u00e3\u0002\u0a72\u0a73\u0005", - "\u01c3\u00e2\u0002\u0a73\u0a74\u0007a\u0002\u0002\u0a74\u0a75\u0005", - "\u01cd\u00e7\u0002\u0a75\u0a76\u0005\u01bd\u00df\u0002\u0a76\u0a77\u0005", - "\u01b9\u00dd\u0002\u0a77\u0a78\u0005\u01c7\u00e4\u0002\u0a78\u0a79\u0007", - "a\u0002\u0002\u0a79\u0a7a\u0005\u01cd\u00e7\u0002\u0a7a\u0a7b\u0005", - "\u01cf\u00e8\u0002\u0a7b\u0a7c\u0005\u01c5\u00e3\u0002\u0a7c\u0a7d\u0005", - "\u01c7\u00e4\u0002\u0a7d\u0a7e\u0007a\u0002\u0002\u0a7e\u0a7f\u0005", - "\u01d5\u00eb\u0002\u0a7f\u0a80\u0005\u01c5\u00e3\u0002\u0a80\u0a81\u0005", - "\u01cb\u00e6\u0002\u0a81\u0a82\u0005\u01af\u00d8\u0002\u0a82\u0a83\u0005", - "\u01cd\u00e7\u0002\u0a83\u0a84\u0005-\u0017\u0002\u0a84\u0134\u0003", - "\u0002\u0002\u0002\u0a85\u0a86\u0005-\u0017\u0002\u0a86\u0a87\u0005", - "\u01cf\u00e8\u0002\u0a87\u0a88\u0005\u01c5\u00e3\u0002\u0a88\u0a89\u0005", - "\u01bd\u00df\u0002\u0a89\u0a8a\u0005\u01b1\u00d9\u0002\u0a8a\u0a8b\u0005", - "\u01c3\u00e2\u0002\u0a8b\u0a8c\u0005\u01b9\u00dd\u0002\u0a8c\u0a8d\u0005", - "\u01db\u00ee\u0002\u0a8d\u0a8e\u0005\u01a9\u00d5\u0002\u0a8e\u0a8f\u0005", - "\u01cf\u00e8\u0002\u0a8f\u0a90\u0005\u01b9\u00dd\u0002\u0a90\u0a91\u0005", - "\u01c5\u00e3\u0002\u0a91\u0a92\u0005\u01c3\u00e2\u0002\u0a92\u0a93\u0007", - "a\u0002\u0002\u0a93\u0a94\u0005\u01bf\u00e0\u0002\u0a94\u0a95\u0005", - "\u01c5\u00e3\u0002\u0a95\u0a96\u0005\u01ad\u00d7\u0002\u0a96\u0a97\u0005", - "\u01a9\u00d5\u0002\u0a97\u0a98\u0005\u01bf\u00e0\u0002\u0a98\u0a99\u0005", - "\u01b1\u00d9\u0002\u0a99\u0a9a\u0005-\u0017\u0002\u0a9a\u0136\u0003", - "\u0002\u0002\u0002\u0a9b\u0a9c\u0005-\u0017\u0002\u0a9c\u0a9d\u0005", - "\u01cf\u00e8\u0002\u0a9d\u0a9e\u0005\u01c5\u00e3\u0002\u0a9e\u0a9f\u0005", - "\u01bd\u00df\u0002\u0a9f\u0aa0\u0005\u01b1\u00d9\u0002\u0aa0\u0aa1\u0005", - "\u01c3\u00e2\u0002\u0aa1\u0aa2\u0005\u01b9\u00dd\u0002\u0aa2\u0aa3\u0005", - "\u01db\u00ee\u0002\u0aa3\u0aa4\u0005\u01a9\u00d5\u0002\u0aa4\u0aa5\u0005", - "\u01cf\u00e8\u0002\u0aa5\u0aa6\u0005\u01b9\u00dd\u0002\u0aa6\u0aa7\u0005", - "\u01c5\u00e3\u0002\u0aa7\u0aa8\u0005\u01c3\u00e2\u0002\u0aa8\u0aa9\u0007", - "a\u0002\u0002\u0aa9\u0aaa\u0005\u01c3\u00e2\u0002\u0aaa\u0aab\u0005", - "\u01c5\u00e3\u0002\u0aab\u0aac\u0005\u01cb\u00e6\u0002\u0aac\u0aad\u0005", - "\u01c1\u00e1\u0002\u0aad\u0aae\u0005\u01a9\u00d5\u0002\u0aae\u0aaf\u0005", - "\u01bf\u00e0\u0002\u0aaf\u0ab0\u0005\u01b9\u00dd\u0002\u0ab0\u0ab1\u0005", - "\u01db\u00ee\u0002\u0ab1\u0ab2\u0005\u01b1\u00d9\u0002\u0ab2\u0ab3\u0007", - "a\u0002\u0002\u0ab3\u0ab4\u0005\u01bf\u00e0\u0002\u0ab4\u0ab5\u0005", - "\u01c5\u00e3\u0002\u0ab5\u0ab6\u0005\u01d5\u00eb\u0002\u0ab6\u0ab7\u0005", - "\u01b1\u00d9\u0002\u0ab7\u0ab8\u0005\u01cb\u00e6\u0002\u0ab8\u0ab9\u0005", - "\u01ad\u00d7\u0002\u0ab9\u0aba\u0005\u01a9\u00d5\u0002\u0aba\u0abb\u0005", - "\u01cd\u00e7\u0002\u0abb\u0abc\u0005\u01b1\u00d9\u0002\u0abc\u0abd\u0005", - "-\u0017\u0002\u0abd\u0138\u0003\u0002\u0002\u0002\u0abe\u0abf\u0005", - "-\u0017\u0002\u0abf\u0ac0\u0005\u01cf\u00e8\u0002\u0ac0\u0ac1\u0005", - "\u01c5\u00e3\u0002\u0ac1\u0ac2\u0005\u01bd\u00df\u0002\u0ac2\u0ac3\u0005", - "\u01b1\u00d9\u0002\u0ac3\u0ac4\u0005\u01c3\u00e2\u0002\u0ac4\u0ac5\u0005", - "\u01b9\u00dd\u0002\u0ac5\u0ac6\u0005\u01db\u00ee\u0002\u0ac6\u0ac7\u0005", - "\u01a9\u00d5\u0002\u0ac7\u0ac8\u0005\u01cf\u00e8\u0002\u0ac8\u0ac9\u0005", - "\u01b9\u00dd\u0002\u0ac9\u0aca\u0005\u01c5\u00e3\u0002\u0aca\u0acb\u0005", - "\u01c3\u00e2\u0002\u0acb\u0acc\u0007a\u0002\u0002\u0acc\u0acd\u0005", - "\u01c3\u00e2\u0002\u0acd\u0ace\u0005\u01c5\u00e3\u0002\u0ace\u0acf\u0005", - "\u01cb\u00e6\u0002\u0acf\u0ad0\u0005\u01c1\u00e1\u0002\u0ad0\u0ad1\u0005", - "\u01a9\u00d5\u0002\u0ad1\u0ad2\u0005\u01bf\u00e0\u0002\u0ad2\u0ad3\u0005", - "\u01b9\u00dd\u0002\u0ad3\u0ad4\u0005\u01db\u00ee\u0002\u0ad4\u0ad5\u0005", - "\u01b1\u00d9\u0002\u0ad5\u0ad6\u0007a\u0002\u0002\u0ad6\u0ad7\u0005", - "\u01d1\u00e9\u0002\u0ad7\u0ad8\u0005\u01c7\u00e4\u0002\u0ad8\u0ad9\u0005", - "\u01c7\u00e4\u0002\u0ad9\u0ada\u0005\u01b1\u00d9\u0002\u0ada\u0adb\u0005", - "\u01cb\u00e6\u0002\u0adb\u0adc\u0005\u01ad\u00d7\u0002\u0adc\u0add\u0005", - "\u01a9\u00d5\u0002\u0add\u0ade\u0005\u01cd\u00e7\u0002\u0ade\u0adf\u0005", - "\u01b1\u00d9\u0002\u0adf\u0ae0\u0005-\u0017\u0002\u0ae0\u013a\u0003", - "\u0002\u0002\u0002\u0ae1\u0ae2\u0005-\u0017\u0002\u0ae2\u0ae3\u0005", - "\u01c3\u00e2\u0002\u0ae3\u0ae4\u0005\u01c5\u00e3\u0002\u0ae4\u0ae5\u0005", - "\u01cb\u00e6\u0002\u0ae5\u0ae6\u0005\u01c1\u00e1\u0002\u0ae6\u0ae7\u0005", - "\u01a9\u00d5\u0002\u0ae7\u0ae8\u0005\u01bf\u00e0\u0002\u0ae8\u0ae9\u0005", - "\u01b9\u00dd\u0002\u0ae9\u0aea\u0005\u01db\u00ee\u0002\u0aea\u0aeb\u0005", - "\u01b1\u00d9\u0002\u0aeb\u0aec\u0007a\u0002\u0002\u0aec\u0aed\u0005", - "\u01bf\u00e0\u0002\u0aed\u0aee\u0005\u01c5\u00e3\u0002\u0aee\u0aef\u0005", - "\u01d5\u00eb\u0002\u0aef\u0af0\u0005\u01b1\u00d9\u0002\u0af0\u0af1\u0005", - "\u01cb\u00e6\u0002\u0af1\u0af2\u0005\u01ad\u00d7\u0002\u0af2\u0af3\u0005", - "\u01a9\u00d5\u0002\u0af3\u0af4\u0005\u01cd\u00e7\u0002\u0af4\u0af5\u0005", - "\u01b1\u00d9\u0002\u0af5\u0af6\u0005-\u0017\u0002\u0af6\u013c\u0003", - "\u0002\u0002\u0002\u0af7\u0af8\u0005-\u0017\u0002\u0af8\u0af9\u0005", - "\u01c3\u00e2\u0002\u0af9\u0afa\u0005\u01c5\u00e3\u0002\u0afa\u0afb\u0005", - "\u01cb\u00e6\u0002\u0afb\u0afc\u0005\u01c1\u00e1\u0002\u0afc\u0afd\u0005", - "\u01a9\u00d5\u0002\u0afd\u0afe\u0005\u01bf\u00e0\u0002\u0afe\u0aff\u0005", - "\u01b9\u00dd\u0002\u0aff\u0b00\u0005\u01db\u00ee\u0002\u0b00\u0b01\u0005", - "\u01b1\u00d9\u0002\u0b01\u0b02\u0007a\u0002\u0002\u0b02\u0b03\u0005", - "\u01d1\u00e9\u0002\u0b03\u0b04\u0005\u01c7\u00e4\u0002\u0b04\u0b05\u0005", - "\u01c7\u00e4\u0002\u0b05\u0b06\u0005\u01b1\u00d9\u0002\u0b06\u0b07\u0005", - "\u01cb\u00e6\u0002\u0b07\u0b08\u0005\u01ad\u00d7\u0002\u0b08\u0b09\u0005", - "\u01a9\u00d5\u0002\u0b09\u0b0a\u0005\u01cd\u00e7\u0002\u0b0a\u0b0b\u0005", - "\u01b1\u00d9\u0002\u0b0b\u0b0c\u0005-\u0017\u0002\u0b0c\u013e\u0003", - "\u0002\u0002\u0002\u0b0d\u0b0e\u0005-\u0017\u0002\u0b0e\u0b0f\u0005", - "\u01c1\u00e1\u0002\u0b0f\u0b10\u0005\u01c5\u00e3\u0002\u0b10\u0b11\u0005", - "\u01af\u00d8\u0002\u0b11\u0b12\u0005\u01b1\u00d9\u0002\u0b12\u0b13\u0005", - "-\u0017\u0002\u0b13\u0140\u0003\u0002\u0002\u0002\u0b14\u0b15\u0005", - "-\u0017\u0002\u0b15\u0b16\u0005\u01a9\u00d5\u0002\u0b16\u0b17\u0005", - "\u01c3\u00e2\u0002\u0b17\u0b18\u0005\u01a9\u00d5\u0002\u0b18\u0b19\u0005", - "\u01bf\u00e0\u0002\u0b19\u0b1a\u0005\u01d9\u00ed\u0002\u0b1a\u0b1b\u0005", - "\u01db\u00ee\u0002\u0b1b\u0b1c\u0005\u01b1\u00d9\u0002\u0b1c\u0b1d\u0005", - "\u01cb\u00e6\u0002\u0b1d\u0b1e\u0007a\u0002\u0002\u0b1e\u0b1f\u0005", - "\u01ad\u00d7\u0002\u0b1f\u0b20\u0005\u01bf\u00e0\u0002\u0b20\u0b21\u0005", - "\u01a9\u00d5\u0002\u0b21\u0b22\u0005\u01cd\u00e7\u0002\u0b22\u0b23\u0005", - "\u01cd\u00e7\u0002\u0b23\u0b24\u0005-\u0017\u0002\u0b24\u0142\u0003", - "\u0002\u0002\u0002\u0b25\u0b26\u0005-\u0017\u0002\u0b26\u0b27\u0005", - "\u01cd\u00e7\u0002\u0b27\u0b28\u0005\u01cf\u00e8\u0002\u0b28\u0b29\u0005", - "\u01c5\u00e3\u0002\u0b29\u0b2a\u0005\u01cb\u00e6\u0002\u0b2a\u0b2b\u0005", - "\u01a9\u00d5\u0002\u0b2b\u0b2c\u0005\u01b5\u00db\u0002\u0b2c\u0b2d\u0005", - "\u01b1\u00d9\u0002\u0b2d\u0b2e\u0005\u01a9\u00d5\u0002\u0b2e\u0b2f\u0005", - "\u01cf\u00e8\u0002\u0b2f\u0b30\u0005\u01cf\u00e8\u0002\u0b30\u0b31\u0005", - "\u01a9\u00d5\u0002\u0b31\u0b32\u0005\u01ad\u00d7\u0002\u0b32\u0b33\u0005", - "\u01b7\u00dc\u0002\u0b33\u0b34\u0005\u01b1\u00d9\u0002\u0b34\u0b35\u0005", - "\u01af\u00d8\u0002\u0b35\u0b36\u0005\u01b9\u00dd\u0002\u0b36\u0b37\u0005", - "\u01c3\u00e2\u0002\u0b37\u0b38\u0005\u01af\u00d8\u0002\u0b38\u0b39\u0005", - "\u01b1\u00d9\u0002\u0b39\u0b3a\u0005\u01d7\u00ec\u0002\u0b3a\u0b3b\u0005", - "-\u0017\u0002\u0b3b\u0144\u0003\u0002\u0002\u0002\u0b3c\u0b3d\u0005", - "-\u0017\u0002\u0b3d\u0b3e\u0005\u01c5\u00e3\u0002\u0b3e\u0b3f\u0005", - "\u01cb\u00e6\u0002\u0b3f\u0b40\u0005\u01b5\u00db\u0002\u0b40\u0b41\u0005", - "\u001d\u000f\u0002\u0b41\u0b42\u0005\u01a9\u00d5\u0002\u0b42\u0b43\u0005", - "\u01c7\u00e4\u0002\u0b43\u0b44\u0005\u01a9\u00d5\u0002\u0b44\u0b45\u0005", - "\u01ad\u00d7\u0002\u0b45\u0b46\u0005\u01b7\u00dc\u0002\u0b46\u0b47\u0005", - "\u01b1\u00d9\u0002\u0b47\u0b48\u0005\u001d\u000f\u0002\u0b48\u0b49\u0005", - "\u01ad\u00d7\u0002\u0b49\u0b4a\u0005\u01a9\u00d5\u0002\u0b4a\u0b4b\u0005", - "\u01cd\u00e7\u0002\u0b4b\u0b4c\u0005\u01cd\u00e7\u0002\u0b4c\u0b4d\u0005", - "\u01a9\u00d5\u0002\u0b4d\u0b4e\u0005\u01c3\u00e2\u0002\u0b4e\u0b4f\u0005", - "\u01af\u00d8\u0002\u0b4f\u0b50\u0005\u01cb\u00e6\u0002\u0b50\u0b51\u0005", - "\u01a9\u00d5\u0002\u0b51\u0b52\u0005\u001d\u000f\u0002\u0b52\u0b53\u0005", - "\u01b9\u00dd\u0002\u0b53\u0b54\u0005\u01c3\u00e2\u0002\u0b54\u0b55\u0005", - "\u01af\u00d8\u0002\u0b55\u0b56\u0005\u01b1\u00d9\u0002\u0b56\u0b57\u0005", - "\u01d7\u00ec\u0002\u0b57\u0b58\u0005\u001d\u000f\u0002\u0b58\u0b59\u0005", - "\u01cd\u00e7\u0002\u0b59\u0b5a\u0005\u01a9\u00d5\u0002\u0b5a\u0b5b\u0005", - "\u01cd\u00e7\u0002\u0b5b\u0b5c\u0005\u01b9\u00dd\u0002\u0b5c\u0b5d\u0005", - "\u001d\u000f\u0002\u0b5d\u0b5e\u0005\u01cd\u00e7\u0002\u0b5e\u0b5f\u0005", - "\u01a9\u00d5\u0002\u0b5f\u0b60\u0005\u01cd\u00e7\u0002\u0b60\u0b61\u0005", - "\u01b9\u00dd\u0002\u0b61\u0b62\u0005\u01b9\u00dd\u0002\u0b62\u0b63\u0005", - "\u01c3\u00e2\u0002\u0b63\u0b64\u0005\u01af\u00d8\u0002\u0b64\u0b65\u0005", - "\u01b1\u00d9\u0002\u0b65\u0b66\u0005\u01d7\u00ec\u0002\u0b66\u0b67\u0005", - "-\u0017\u0002\u0b67\u0146\u0003\u0002\u0002\u0002\u0b68\u0b69\u0005", - "-\u0017\u0002\u0b69\u0b6a\u0005\u01ad\u00d7\u0002\u0b6a\u0b6b\u0005", - "\u01c5\u00e3\u0002\u0b6b\u0b6c\u0005\u01c1\u00e1\u0002\u0b6c\u0b6d\u0005", - "\u001d\u000f\u0002\u0b6d\u0b6e\u0005\u01af\u00d8\u0002\u0b6e\u0b6f\u0005", - "\u01a9\u00d5\u0002\u0b6f\u0b70\u0005\u01cf\u00e8\u0002\u0b70\u0b71\u0005", - "\u01a9\u00d5\u0002\u0b71\u0b72\u0005\u01cd\u00e7\u0002\u0b72\u0b73\u0005", - "\u01cf\u00e8\u0002\u0b73\u0b74\u0005\u01a9\u00d5\u0002\u0b74\u0b75\u0005", - "\u01d7\u00ec\u0002\u0b75\u0b76\u0005\u001d\u000f\u0002\u0b76\u0b77\u0005", - "\u01ab\u00d6\u0002\u0b77\u0b78\u0005\u01af\u00d8\u0002\u0b78\u0b79\u0005", - "\u01c7\u00e4\u0002\u0b79\u0b7a\u0005\u001d\u000f\u0002\u0b7a\u0b7b\u0005", - "\u01cd\u00e7\u0002\u0b7b\u0b7c\u0005\u01b1\u00d9\u0002\u0b7c\u0b7d\u0005", - "\u01a9\u00d5\u0002\u0b7d\u0b7e\u0005\u01cb\u00e6\u0002\u0b7e\u0b7f\u0005", - "\u01ad\u00d7\u0002\u0b7f\u0b80\u0005\u01b7\u00dc\u0002\u0b80\u0b81\u0005", - "\u001d\u000f\u0002\u0b81\u0b82\u0005\u01cd\u00e7\u0002\u0b82\u0b83\u0005", - "\u01c5\u00e3\u0002\u0b83\u0b84\u0005\u01bf\u00e0\u0002\u0b84\u0b85\u0005", - "\u01cb\u00e6\u0002\u0b85\u0b86\u0005\u001d\u000f\u0002\u0b86\u0b87\u0005", - "\u01ad\u00d7\u0002\u0b87\u0b88\u0005\u01c9\u00e5\u0002\u0b88\u0b89\u0005", - "\u01bf\u00e0\u0002\u0b89\u0b8a\u00075\u0002\u0002\u0b8a\u0b8b\u0005", - "\u01cd\u00e7\u0002\u0b8b\u0b8c\u0005\u01c5\u00e3\u0002\u0b8c\u0b8d\u0005", - "\u01bf\u00e0\u0002\u0b8d\u0b8e\u0005\u01cb\u00e6\u0002\u0b8e\u0b8f\u0005", - "\u01cd\u00e7\u0002\u0b8f\u0b90\u0005\u01b1\u00d9\u0002\u0b90\u0b91\u0005", - "\u01ad\u00d7\u0002\u0b91\u0b92\u0005\u01c5\u00e3\u0002\u0b92\u0b93\u0005", - "\u01c3\u00e2\u0002\u0b93\u0b94\u0005\u01af\u00d8\u0002\u0b94\u0b95\u0005", - "\u01a9\u00d5\u0002\u0b95\u0b96\u0005\u01cb\u00e6\u0002\u0b96\u0b97\u0005", - "\u01d9\u00ed\u0002\u0b97\u0b98\u0005\u01b9\u00dd\u0002\u0b98\u0b99\u0005", - "\u01c3\u00e2\u0002\u0b99\u0b9a\u0005\u01af\u00d8\u0002\u0b9a\u0b9b\u0005", - "\u01b1\u00d9\u0002\u0b9b\u0b9c\u0005\u01d7\u00ec\u0002\u0b9c\u0b9d\u0005", - "-\u0017\u0002\u0b9d\u0148\u0003\u0002\u0002\u0002\u0b9e\u0b9f\u0005", - "\u01cd\u00e7\u0002\u0b9f\u0ba0\u0005\u01c7\u00e4\u0002\u0ba0\u0ba1\u0005", - "\u01a9\u00d5\u0002\u0ba1\u0ba2\u0005\u01ad\u00d7\u0002\u0ba2\u0ba3\u0005", - "\u01b1\u00d9\u0002\u0ba3\u0ba4\u0005\u01cd\u00e7\u0002\u0ba4\u0ba5\u0005", - "\u01a9\u00d5\u0002\u0ba5\u0ba6\u0005\u01d3\u00ea\u0002\u0ba6\u0ba7\u0005", - "\u01b9\u00dd\u0002\u0ba7\u0ba8\u0005\u01c3\u00e2\u0002\u0ba8\u0ba9\u0005", - "\u01b5\u00db\u0002\u0ba9\u0baa\u0005\u01c3\u00e2\u0002\u0baa\u0bab\u0005", - "\u01c5\u00e3\u0002\u0bab\u0bac\u0005\u01bb\u00de\u0002\u0bac\u0bad\u0005", - "\u01c5\u00e3\u0002\u0bad\u0bae\u0005\u01b9\u00dd\u0002\u0bae\u0baf\u0005", - "\u01c3\u00e2\u0002\u0baf\u014a\u0003\u0002\u0002\u0002\u0bb0\u0bb1\u0005", - "\u01cd\u00e7\u0002\u0bb1\u0bb2\u0005\u01c7\u00e4\u0002\u0bb2\u0bb3\u0005", - "\u01a9\u00d5\u0002\u0bb3\u0bb4\u0005\u01ad\u00d7\u0002\u0bb4\u0bb5\u0005", - "\u01b1\u00d9\u0002\u0bb5\u0bb6\u0005\u01cd\u00e7\u0002\u0bb6\u0bb7\u0005", - "\u01a9\u00d5\u0002\u0bb7\u0bb8\u0005\u01d3\u00ea\u0002\u0bb8\u0bb9\u0005", - "\u01b9\u00dd\u0002\u0bb9\u0bba\u0005\u01c3\u00e2\u0002\u0bba\u0bbb\u0005", - "\u01b5\u00db\u0002\u0bbb\u0bbc\u0005\u01a9\u00d5\u0002\u0bbc\u0bbd\u0005", - "\u01bf\u00e0\u0002\u0bbd\u0bbe\u0005\u01bf\u00e0\u0002\u0bbe\u014c\u0003", - "\u0002\u0002\u0002\u0bbf\u0bc0\u0005\u01cd\u00e7\u0002\u0bc0\u0bc1\u0005", - "\u01c7\u00e4\u0002\u0bc1\u0bc2\u0005\u01a9\u00d5\u0002\u0bc2\u0bc3\u0005", - "\u01ad\u00d7\u0002\u0bc3\u0bc4\u0005\u01b1\u00d9\u0002\u0bc4\u0bc5\u0005", - "\u01cd\u00e7\u0002\u0bc5\u0bc6\u0005\u01a9\u00d5\u0002\u0bc6\u0bc7\u0005", - "\u01d3\u00ea\u0002\u0bc7\u0bc8\u0005\u01b9\u00dd\u0002\u0bc8\u0bc9\u0005", - "\u01c3\u00e2\u0002\u0bc9\u0bca\u0005\u01b5\u00db\u0002\u0bca\u0bcb\u0005", - "\u01cd\u00e7\u0002\u0bcb\u0bcc\u0005\u01bf\u00e0\u0002\u0bcc\u0bcd\u0005", - "\u01c5\u00e3\u0002\u0bcd\u0bce\u0005\u01d5\u00eb\u0002\u0bce\u0bcf\u0005", - "\u01cf\u00e8\u0002\u0bcf\u0bd0\u0005\u01cb\u00e6\u0002\u0bd0\u0bd1\u0005", - "\u01b9\u00dd\u0002\u0bd1\u0bd2\u0005\u01b1\u00d9\u0002\u0bd2\u0bd3\u0005", - "\u01c7\u00e4\u0002\u0bd3\u0bd4\u0005\u01cb\u00e6\u0002\u0bd4\u0bd5\u0005", - "\u01b1\u00d9\u0002\u0bd5\u0bd6\u0005\u01ad\u00d7\u0002\u0bd6\u0bd7\u0005", - "\u01b9\u00dd\u0002\u0bd7\u0bd8\u0005\u01cd\u00e7\u0002\u0bd8\u0bd9\u0005", - "\u01b9\u00dd\u0002\u0bd9\u0bda\u0005\u01c5\u00e3\u0002\u0bda\u0bdb\u0005", - "\u01c3\u00e2\u0002\u0bdb\u014e\u0003\u0002\u0002\u0002\u0bdc\u0bdd\u0005", - "\u01cd\u00e7\u0002\u0bdd\u0bde\u0005\u01c7\u00e4\u0002\u0bde\u0bdf\u0005", - "\u01a9\u00d5\u0002\u0bdf\u0be0\u0005\u01ad\u00d7\u0002\u0be0\u0be1\u0005", - "\u01b1\u00d9\u0002\u0be1\u0be2\u0005\u01cd\u00e7\u0002\u0be2\u0be3\u0005", - "\u01a9\u00d5\u0002\u0be3\u0be4\u0005\u01d3\u00ea\u0002\u0be4\u0be5\u0005", - "\u01b9\u00dd\u0002\u0be5\u0be6\u0005\u01c3\u00e2\u0002\u0be6\u0be7\u0005", - "\u01b5\u00db\u0002\u0be7\u0be8\u0005\u01c3\u00e2\u0002\u0be8\u0be9\u0005", - "\u01c5\u00e3\u0002\u0be9\u0bea\u0005\u01cf\u00e8\u0002\u0bea\u0beb\u0005", - "\u01b1\u00d9\u0002\u0beb\u0bec\u0005\u01d7\u00ec\u0002\u0bec\u0bed\u0005", - "\u01cf\u00e8\u0002\u0bed\u0bee\u0005\u01b3\u00da\u0002\u0bee\u0bef\u0005", - "\u01b9\u00dd\u0002\u0bef\u0bf0\u0005\u01b1\u00d9\u0002\u0bf0\u0bf1\u0005", - "\u01bf\u00e0\u0002\u0bf1\u0bf2\u0005\u01af\u00d8\u0002\u0bf2\u0150\u0003", - "\u0002\u0002\u0002\u0bf3\u0bf4\u0005\u01af\u00d8\u0002\u0bf4\u0bf5\u0005", - "\u01c5\u00e3\u0002\u0bf5\u0bf6\u0005\u01ad\u00d7\u0002\u0bf6\u0bf7\u0005", - "\u01d3\u00ea\u0002\u0bf7\u0bf8\u0005\u01a9\u00d5\u0002\u0bf8\u0bf9\u0005", - "\u01bf\u00e0\u0002\u0bf9\u0bfa\u0005\u01d1\u00e9\u0002\u0bfa\u0bfb\u0005", - "\u01b1\u00d9\u0002\u0bfb\u0bfc\u0005\u01cd\u00e7\u0002\u0bfc\u0152\u0003", - "\u0002\u0002\u0002\u0bfd\u0bfe\u0005\u01ad\u00d7\u0002\u0bfe\u0bff\u0005", - "\u01c5\u00e3\u0002\u0bff\u0c00\u0005\u01c7\u00e4\u0002\u0c00\u0c01\u0005", - "\u01d9\u00ed\u0002\u0c01\u0c02\u0005\u01b3\u00da\u0002\u0c02\u0c03\u0005", - "\u01b9\u00dd\u0002\u0c03\u0c04\u0005\u01b1\u00d9\u0002\u0c04\u0c05\u0005", - "\u01bf\u00e0\u0002\u0c05\u0c06\u0005\u01af\u00d8\u0002\u0c06\u0154\u0003", - "\u0002\u0002\u0002\u0c07\u0c08\u0005\u01b1\u00d9\u0002\u0c08\u0c09\u0005", - "\u01d7\u00ec\u0002\u0c09\u0c0a\u0005\u01ad\u00d7\u0002\u0c0a\u0c0b\u0005", - "\u01bf\u00e0\u0002\u0c0b\u0c0c\u0005\u01d1\u00e9\u0002\u0c0c\u0c0d\u0005", - "\u01af\u00d8\u0002\u0c0d\u0c0e\u0005\u01b1\u00d9\u0002\u0c0e\u0c0f\u0005", - "\u01af\u00d8\u0002\u0c0f\u0156\u0003\u0002\u0002\u0002\u0c10\u0c11\u0005", - "\u01b9\u00dd\u0002\u0c11\u0c12\u0005\u01c3\u00e2\u0002\u0c12\u0c13\u0005", - "\u01af\u00d8\u0002\u0c13\u0c14\u0005\u01b1\u00d9\u0002\u0c14\u0c15\u0005", - "\u01d7\u00ec\u0002\u0c15\u0c16\u0005\u01b1\u00d9\u0002\u0c16\u0c17\u0005", - "\u01af\u00d8\u0002\u0c17\u0158\u0003\u0002\u0002\u0002\u0c18\u0c19\u0005", - "\u01bf\u00e0\u0002\u0c19\u0c1a\u0005\u01c5\u00e3\u0002\u0c1a\u0c1b\u0005", - "\u01d5\u00eb\u0002\u0c1b\u0c1c\u0005\u01b1\u00d9\u0002\u0c1c\u0c1d\u0005", - "\u01cb\u00e6\u0002\u0c1d\u0c1e\u0005\u01ad\u00d7\u0002\u0c1e\u0c1f\u0005", - "\u01a9\u00d5\u0002\u0c1f\u0c20\u0005\u01cd\u00e7\u0002\u0c20\u0c21\u0005", - "\u01b1\u00d9\u0002\u0c21\u015a\u0003\u0002\u0002\u0002\u0c22\u0c23\u0005", - "\u01ad\u00d7\u0002\u0c23\u0c24\u0005\u01c5\u00e3\u0002\u0c24\u0c25\u0005", - "\u01bf\u00e0\u0002\u0c25\u0c26\u0005\u01d1\u00e9\u0002\u0c26\u0c27\u0005", - "\u01c1\u00e1\u0002\u0c27\u0c28\u0005\u01c3\u00e2\u0002\u0c28\u0c29\u0005", - "\u01cd\u00e7\u0002\u0c29\u015c\u0003\u0002\u0002\u0002\u0c2a\u0c2b\u0005", - "\u01c7\u00e4\u0002\u0c2b\u0c2c\u0005\u01cb\u00e6\u0002\u0c2c\u0c2d\u0005", - "\u01c5\u00e3\u0002\u0c2d\u0c2e\u0005\u01b3\u00da\u0002\u0c2e\u0c2f\u0005", - "\u01b9\u00dd\u0002\u0c2f\u0c30\u0005\u01bf\u00e0\u0002\u0c30\u0c31\u0005", - "\u01b1\u00d9\u0002\u0c31\u0c32\u0005\u01cd\u00e7\u0002\u0c32\u015e\u0003", - "\u0002\u0002\u0002\u0c33\u0c34\u0005\u01ad\u00d7\u0002\u0c34\u0c35\u0005", - "\u01c5\u00e3\u0002\u0c35\u0c36\u0005\u01c3\u00e2\u0002\u0c36\u0c37\u0005", - "\u01b3\u00da\u0002\u0c37\u0c38\u0005\u01b9\u00dd\u0002\u0c38\u0c39\u0005", - "\u01b5\u00db\u0002\u0c39\u0160\u0003\u0002\u0002\u0002\u0c3a\u0c3b\u0005", - "\u01a9\u00d5\u0002\u0c3b\u0c3c\u0005\u01d1\u00e9\u0002\u0c3c\u0c3d\u0005", - "\u01cf\u00e8\u0002\u0c3d\u0c3e\u0005\u01c5\u00e3\u0002\u0c3e\u0c3f\u0005", - "\u01ad\u00d7\u0002\u0c3f\u0c40\u0005\u01c5\u00e3\u0002\u0c40\u0c41\u0005", - "\u01c1\u00e1\u0002\u0c41\u0c42\u0005\u01c1\u00e1\u0002\u0c42\u0c43\u0005", - "\u01b9\u00dd\u0002\u0c43\u0c44\u0005\u01cf\u00e8\u0002\u0c44\u0c45\u0005", - "\u01cf\u00e8\u0002\u0c45\u0c46\u0005\u01b9\u00dd\u0002\u0c46\u0c47\u0005", - "\u01c1\u00e1\u0002\u0c47\u0c48\u0005\u01b1\u00d9\u0002\u0c48\u0162\u0003", - "\u0002\u0002\u0002\u0c49\u0c4a\u0005\u01af\u00d8\u0002\u0c4a\u0c4b\u0005", - "\u01b1\u00d9\u0002\u0c4b\u0c4c\u0005\u01b3\u00da\u0002\u0c4c\u0c4d\u0005", - "\u01a9\u00d5\u0002\u0c4d\u0c4e\u0005\u01d1\u00e9\u0002\u0c4e\u0c4f\u0005", - "\u01bf\u00e0\u0002\u0c4f\u0c50\u0005\u01cf\u00e8\u0002\u0c50\u0c51\u0005", - "\u01c9\u00e5\u0002\u0c51\u0c52\u0005\u01d1\u00e9\u0002\u0c52\u0c53\u0005", - "\u01b1\u00d9\u0002\u0c53\u0c54\u0005\u01cb\u00e6\u0002\u0c54\u0c55\u0005", - "\u01d9\u00ed\u0002\u0c55\u0c56\u0005\u01b3\u00da\u0002\u0c56\u0c57\u0005", - "\u01b9\u00dd\u0002\u0c57\u0c58\u0005\u01b1\u00d9\u0002\u0c58\u0c59\u0005", - "\u01bf\u00e0\u0002\u0c59\u0c5a\u0005\u01af\u00d8\u0002\u0c5a\u0164\u0003", - "\u0002\u0002\u0002\u0c5b\u0c5c\u0005\u01af\u00d8\u0002\u0c5c\u0c5d\u0005", - "\u01b9\u00dd\u0002\u0c5d\u0c5e\u0005\u01cb\u00e6\u0002\u0c5e\u0c5f\u0005", - "\u01b1\u00d9\u0002\u0c5f\u0c60\u0005\u01ad\u00d7\u0002\u0c60\u0c61\u0005", - "\u01cf\u00e8\u0002\u0c61\u0c62\u0005\u01c5\u00e3\u0002\u0c62\u0c63\u0005", - "\u01cb\u00e6\u0002\u0c63\u0c64\u0005\u01d9\u00ed\u0002\u0c64\u0c65\u0005", - "\u01b3\u00da\u0002\u0c65\u0c66\u0005\u01a9\u00d5\u0002\u0c66\u0c67\u0005", - "\u01ad\u00d7\u0002\u0c67\u0c68\u0005\u01cf\u00e8\u0002\u0c68\u0c69\u0005", - "\u01c5\u00e3\u0002\u0c69\u0c6a\u0005\u01cb\u00e6\u0002\u0c6a\u0c6b\u0005", - "\u01d9\u00ed\u0002\u0c6b\u0166\u0003\u0002\u0002\u0002\u0c6c\u0c6d\u0005", - "\u01b3\u00da\u0002\u0c6d\u0c6e\u0005\u01b9\u00dd\u0002\u0c6e\u0c6f\u0005", - "\u01bf\u00e0\u0002\u0c6f\u0c70\u0005\u01cf\u00e8\u0002\u0c70\u0c71\u0005", - "\u01b1\u00d9\u0002\u0c71\u0c72\u0005\u01cb\u00e6\u0002\u0c72\u0c73\u0005", - "\u01ad\u00d7\u0002\u0c73\u0c74\u0005\u01a9\u00d5\u0002\u0c74\u0c75\u0005", - "\u01ad\u00d7\u0002\u0c75\u0c76\u0005\u01b7\u00dc\u0002\u0c76\u0c77\u0005", - "\u01b1\u00d9\u0002\u0c77\u0c78\u0005\u01bf\u00e0\u0002\u0c78\u0c79\u0005", - "\u01c5\u00e3\u0002\u0c79\u0c7a\u0005\u01d5\u00eb\u0002\u0c7a\u0c7b\u0005", - "\u01d5\u00eb\u0002\u0c7b\u0c7c\u0005\u01a9\u00d5\u0002\u0c7c\u0c7d\u0005", - "\u01cf\u00e8\u0002\u0c7d\u0c7e\u0005\u01b1\u00d9\u0002\u0c7e\u0c7f\u0005", - "\u01cb\u00e6\u0002\u0c7f\u0c80\u0005\u01c1\u00e1\u0002\u0c80\u0c81\u0005", - "\u01a9\u00d5\u0002\u0c81\u0c82\u0005\u01cb\u00e6\u0002\u0c82\u0c83\u0005", - "\u01bd\u00df\u0002\u0c83\u0168\u0003\u0002\u0002\u0002\u0c84\u0c85\u0005", - "\u01b3\u00da\u0002\u0c85\u0c86\u0005\u01b9\u00dd\u0002\u0c86\u0c87\u0005", - "\u01bf\u00e0\u0002\u0c87\u0c88\u0005\u01cf\u00e8\u0002\u0c88\u0c89\u0005", - "\u01b1\u00d9\u0002\u0c89\u0c8a\u0005\u01cb\u00e6\u0002\u0c8a\u0c8b\u0005", - "\u01ad\u00d7\u0002\u0c8b\u0c8c\u0005\u01a9\u00d5\u0002\u0c8c\u0c8d\u0005", - "\u01ad\u00d7\u0002\u0c8d\u0c8e\u0005\u01b7\u00dc\u0002\u0c8e\u0c8f\u0005", - "\u01b1\u00d9\u0002\u0c8f\u0c90\u0005\u01b7\u00dc\u0002\u0c90\u0c91\u0005", - "\u01b9\u00dd\u0002\u0c91\u0c92\u0005\u01b5\u00db\u0002\u0c92\u0c93\u0005", - "\u01b7\u00dc\u0002\u0c93\u0c94\u0005\u01d5\u00eb\u0002\u0c94\u0c95\u0005", - "\u01a9\u00d5\u0002\u0c95\u0c96\u0005\u01cf\u00e8\u0002\u0c96\u0c97\u0005", - "\u01b1\u00d9\u0002\u0c97\u0c98\u0005\u01cb\u00e6\u0002\u0c98\u0c99\u0005", - "\u01c1\u00e1\u0002\u0c99\u0c9a\u0005\u01a9\u00d5\u0002\u0c9a\u0c9b\u0005", - "\u01cb\u00e6\u0002\u0c9b\u0c9c\u0005\u01bd\u00df\u0002\u0c9c\u016a\u0003", - "\u0002\u0002\u0002\u0c9d\u0c9e\u0005\u01af\u00d8\u0002\u0c9e\u0c9f\u0005", - "\u01b9\u00dd\u0002\u0c9f\u0ca0\u0005\u01cb\u00e6\u0002\u0ca0\u0ca1\u0005", - "\u01b1\u00d9\u0002\u0ca1\u0ca2\u0005\u01ad\u00d7\u0002\u0ca2\u0ca3\u0005", - "\u01cf\u00e8\u0002\u0ca3\u0ca4\u0005\u01c5\u00e3\u0002\u0ca4\u0ca5\u0005", - "\u01cb\u00e6\u0002\u0ca5\u0ca6\u0005\u01d9\u00ed\u0002\u0ca6\u0ca7\u0005", - "\u01b3\u00da\u0002\u0ca7\u0ca8\u0005\u01a9\u00d5\u0002\u0ca8\u0ca9\u0005", - "\u01ad\u00d7\u0002\u0ca9\u0caa\u0005\u01cf\u00e8\u0002\u0caa\u0cab\u0005", - "\u01c5\u00e3\u0002\u0cab\u0cac\u0005\u01cb\u00e6\u0002\u0cac\u0cad\u0005", - "\u01d9\u00ed\u0002\u0cad\u0cae\u0005\u01ad\u00d7\u0002\u0cae\u0caf\u0005", - "\u01bf\u00e0\u0002\u0caf\u0cb0\u0005\u01a9\u00d5\u0002\u0cb0\u0cb1\u0005", - "\u01cd\u00e7\u0002\u0cb1\u0cb2\u0005\u01cd\u00e7\u0002\u0cb2\u016c\u0003", - "\u0002\u0002\u0002\u0cb3\u0cb4\u0005\u01c1\u00e1\u0002\u0cb4\u0cb5\u0005", - "\u01b1\u00d9\u0002\u0cb5\u0cb6\u0005\u01cb\u00e6\u0002\u0cb6\u0cb7\u0005", - "\u01b5\u00db\u0002\u0cb7\u0cb8\u0005\u01b1\u00d9\u0002\u0cb8\u0cb9\u0005", - "\u01c1\u00e1\u0002\u0cb9\u0cba\u0005\u01a9\u00d5\u0002\u0cba\u0cbb\u0005", - "\u01d7\u00ec\u0002\u0cbb\u0cbc\u0005\u01cf\u00e8\u0002\u0cbc\u0cbd\u0005", - "\u01b7\u00dc\u0002\u0cbd\u0cbe\u0005\u01cb\u00e6\u0002\u0cbe\u0cbf\u0005", - "\u01b1\u00d9\u0002\u0cbf\u0cc0\u0005\u01a9\u00d5\u0002\u0cc0\u0cc1\u0005", - "\u01af\u00d8\u0002\u0cc1\u0cc2\u0005\u01ad\u00d7\u0002\u0cc2\u0cc3\u0005", - "\u01c5\u00e3\u0002\u0cc3\u0cc4\u0005\u01d1\u00e9\u0002\u0cc4\u0cc5\u0005", - "\u01c3\u00e2\u0002\u0cc5\u0cc6\u0005\u01cf\u00e8\u0002\u0cc6\u016e\u0003", - "\u0002\u0002\u0002\u0cc7\u0cc8\u0005\u01c1\u00e1\u0002\u0cc8\u0cc9\u0005", - "\u01b1\u00d9\u0002\u0cc9\u0cca\u0005\u01cb\u00e6\u0002\u0cca\u0ccb\u0005", - "\u01b5\u00db\u0002\u0ccb\u0ccc\u0005\u01b1\u00d9\u0002\u0ccc\u0ccd\u0005", - "\u01c1\u00e1\u0002\u0ccd\u0cce\u0005\u01a9\u00d5\u0002\u0cce\u0ccf\u0005", - "\u01d7\u00ec\u0002\u0ccf\u0cd0\u0005\u01c1\u00e1\u0002\u0cd0\u0cd1\u0005", - "\u01b1\u00d9\u0002\u0cd1\u0cd2\u0005\u01cb\u00e6\u0002\u0cd2\u0cd3\u0005", - "\u01b5\u00db\u0002\u0cd3\u0cd4\u0005\u01b1\u00d9\u0002\u0cd4\u0cd5\u0005", - "\u01ad\u00d7\u0002\u0cd5\u0cd6\u0005\u01c5\u00e3\u0002\u0cd6\u0cd7\u0005", - "\u01d1\u00e9\u0002\u0cd7\u0cd8\u0005\u01c3\u00e2\u0002\u0cd8\u0cd9\u0005", - "\u01cf\u00e8\u0002\u0cd9\u0170\u0003\u0002\u0002\u0002\u0cda\u0cdb\u0005", - "\u01cb\u00e6\u0002\u0cdb\u0cdc\u0005\u01a9\u00d5\u0002\u0cdc\u0cdd\u0005", - "\u01c1\u00e1\u0002\u0cdd\u0cde\u0005\u01ab\u00d6\u0002\u0cde\u0cdf\u0005", - "\u01d1\u00e9\u0002\u0cdf\u0ce0\u0005\u01b3\u00da\u0002\u0ce0\u0ce1\u0005", - "\u01b3\u00da\u0002\u0ce1\u0ce2\u0005\u01b1\u00d9\u0002\u0ce2\u0ce3\u0005", - "\u01cb\u00e6\u0002\u0ce3\u0ce4\u0005\u01cd\u00e7\u0002\u0ce4\u0ce5\u0005", - "\u01b9\u00dd\u0002\u0ce5\u0ce6\u0005\u01db\u00ee\u0002\u0ce6\u0ce7\u0005", - "\u01b1\u00d9\u0002\u0ce7\u0172\u0003\u0002\u0002\u0002\u0ce8\u0ce9\u0005", - "\u01cb\u00e6\u0002\u0ce9\u0cea\u0005\u01b1\u00d9\u0002\u0cea\u0ceb\u0005", - "\u01a9\u00d5\u0002\u0ceb\u0cec\u0005\u01bf\u00e0\u0002\u0cec\u0ced\u0005", - "\u01cf\u00e8\u0002\u0ced\u0cee\u0005\u01b9\u00dd\u0002\u0cee\u0cef\u0005", - "\u01c1\u00e1\u0002\u0cef\u0cf0\u0005\u01b1\u00d9\u0002\u0cf0\u0174\u0003", - "\u0002\u0002\u0002\u0cf1\u0cf2\u0005\u01cb\u00e6\u0002\u0cf2\u0cf3\u0005", - "\u01b1\u00d9\u0002\u0cf3\u0cf4\u0005\u01ad\u00d7\u0002\u0cf4\u0cf5\u0005", - "\u01c5\u00e3\u0002\u0cf5\u0cf6\u0005\u01d3\u00ea\u0002\u0cf6\u0cf7\u0005", - "\u01b1\u00d9\u0002\u0cf7\u0cf8\u0005\u01cb\u00e6\u0002\u0cf8\u0cf9\u0005", - "\u01d9\u00ed\u0002\u0cf9\u0176\u0003\u0002\u0002\u0002\u0cfa\u0cfb\u0005", - "\u01cb\u00e6\u0002\u0cfb\u0cfc\u0005\u01b1\u00d9\u0002\u0cfc\u0cfd\u0005", - "\u01b9\u00dd\u0002\u0cfd\u0cfe\u0005\u01c3\u00e2\u0002\u0cfe\u0cff\u0005", - "\u01af\u00d8\u0002\u0cff\u0d00\u0005\u01b1\u00d9\u0002\u0d00\u0d01\u0005", - "\u01d7\u00ec\u0002\u0d01\u0178\u0003\u0002\u0002\u0002\u0d02\u0d03\u0005", - "\u01bf\u00e0\u0002\u0d03\u0d04\u0005\u01b1\u00d9\u0002\u0d04\u0d05\u0005", - "\u01c3\u00e2\u0002\u0d05\u0d06\u0005\u01b9\u00dd\u0002\u0d06\u0d07\u0005", - "\u01b1\u00d9\u0002\u0d07\u0d08\u0005\u01c3\u00e2\u0002\u0d08\u0d09\u0005", - "\u01cf\u00e8\u0002\u0d09\u017a\u0003\u0002\u0002\u0002\u0d0a\u0d0b\u0005", - "-\u0017\u0002\u0d0b\u0d0c\u0005\u01cd\u00e7\u0002\u0d0c\u0d0d\u0005", - "\u01cf\u00e8\u0002\u0d0d\u0d0e\u0005\u01a9\u00d5\u0002\u0d0e\u0d0f\u0005", - "\u01c3\u00e2\u0002\u0d0f\u0d10\u0005\u01af\u00d8\u0002\u0d10\u0d11\u0005", - "\u01a9\u00d5\u0002\u0d11\u0d12\u0005\u01cb\u00e6\u0002\u0d12\u0d13\u0005", - "\u01af\u00d8\u0002\u0d13\u0d14\u0005-\u0017\u0002\u0d14\u017c\u0003", - "\u0002\u0002\u0002\u0d15\u0d16\u0005-\u0017\u0002\u0d16\u0d17\u0005", - "\u01b1\u00d9\u0002\u0d17\u0d18\u0005\u01c3\u00e2\u0002\u0d18\u0d19\u0005", - "\u01ad\u00d7\u0002\u0d19\u0d1a\u0005\u01cb\u00e6\u0002\u0d1a\u0d1b\u0005", - "\u01d9\u00ed\u0002\u0d1b\u0d1c\u0005\u01c7\u00e4\u0002\u0d1c\u0d1d\u0005", - "\u01cf\u00e8\u0002\u0d1d\u0d1e\u0005\u01b1\u00d9\u0002\u0d1e\u0d1f\u0005", - "\u01af\u00d8\u0002\u0d1f\u0d20\u0005-\u0017\u0002\u0d20\u017e\u0003", - "\u0002\u0002\u0002\u0d21\u0d22\u0005\u01ab\u00d6\u0002\u0d22\u0d23\u0005", - "\u01b9\u00dd\u0002\u0d23\u0d24\u0005\u01b5\u00db\u0002\u0d24\u0d25\u0005", - "\u01b9\u00dd\u0002\u0d25\u0d26\u0005\u01c3\u00e2\u0002\u0d26\u0d27\u0005", - "\u01cf\u00e8\u0002\u0d27\u0180\u0003\u0002\u0002\u0002\u0d28\u0d29\u0005", - "\u01ab\u00d6\u0002\u0d29\u0d2a\u0005\u01bf\u00e0\u0002\u0d2a\u0d2b\u0005", - "\u01c5\u00e3\u0002\u0d2b\u0d2c\u0005\u01ab\u00d6\u0002\u0d2c\u0182\u0003", - "\u0002\u0002\u0002\u0d2d\u0d2e\u0005\u01ab\u00d6\u0002\u0d2e\u0d2f\u0005", - "\u01c5\u00e3\u0002\u0d2f\u0d30\u0005\u01c5\u00e3\u0002\u0d30\u0d31\u0005", - "\u01bf\u00e0\u0002\u0d31\u0d32\u0005\u01b1\u00d9\u0002\u0d32\u0d33\u0005", - "\u01a9\u00d5\u0002\u0d33\u0d34\u0005\u01c3\u00e2\u0002\u0d34\u0184\u0003", - "\u0002\u0002\u0002\u0d35\u0d36\u0005\u01ad\u00d7\u0002\u0d36\u0d37\u0005", - "\u01c5\u00e3\u0002\u0d37\u0d38\u0005\u01d1\u00e9\u0002\u0d38\u0d39\u0005", - "\u01c3\u00e2\u0002\u0d39\u0d3a\u0005\u01cf\u00e8\u0002\u0d3a\u0d3b\u0005", - "\u01b1\u00d9\u0002\u0d3b\u0d3c\u0005\u01cb\u00e6\u0002\u0d3c\u0186\u0003", - "\u0002\u0002\u0002\u0d3d\u0d3e\u0005\u01af\u00d8\u0002\u0d3e\u0d3f\u0005", - "\u01a9\u00d5\u0002\u0d3f\u0d40\u0005\u01cf\u00e8\u0002\u0d40\u0d41\u0005", - "\u01b1\u00d9\u0002\u0d41\u0188\u0003\u0002\u0002\u0002\u0d42\u0d43\u0005", - "\u01af\u00d8\u0002\u0d43\u0d44\u0005\u01b1\u00d9\u0002\u0d44\u0d45\u0005", - "\u01ad\u00d7\u0002\u0d45\u0d46\u0005\u01b9\u00dd\u0002\u0d46\u0d47\u0005", - "\u01c1\u00e1\u0002\u0d47\u0d48\u0005\u01a9\u00d5\u0002\u0d48\u0d49\u0005", - "\u01bf\u00e0\u0002\u0d49\u018a\u0003\u0002\u0002\u0002\u0d4a\u0d4b\u0005", - "\u01af\u00d8\u0002\u0d4b\u0d4c\u0005\u01c5\u00e3\u0002\u0d4c\u0d4d\u0005", - "\u01d1\u00e9\u0002\u0d4d\u0d4e\u0005\u01ab\u00d6\u0002\u0d4e\u0d4f\u0005", - "\u01bf\u00e0\u0002\u0d4f\u0d50\u0005\u01b1\u00d9\u0002\u0d50\u018c\u0003", - "\u0002\u0002\u0002\u0d51\u0d52\u0005\u01b3\u00da\u0002\u0d52\u0d53\u0005", - "\u01bf\u00e0\u0002\u0d53\u0d54\u0005\u01c5\u00e3\u0002\u0d54\u0d55\u0005", - "\u01a9\u00d5\u0002\u0d55\u0d56\u0005\u01cf\u00e8\u0002\u0d56\u018e\u0003", - "\u0002\u0002\u0002\u0d57\u0d58\u0005\u01b3\u00da\u0002\u0d58\u0d59\u0005", - "\u01cb\u00e6\u0002\u0d59\u0d5a\u0005\u01c5\u00e3\u0002\u0d5a\u0d5b\u0005", - "\u01db\u00ee\u0002\u0d5b\u0d5c\u0005\u01b1\u00d9\u0002\u0d5c\u0d5d\u0005", - "\u01c3\u00e2\u0002\u0d5d\u0190\u0003\u0002\u0002\u0002\u0d5e\u0d5f\u0005", - "\u01b9\u00dd\u0002\u0d5f\u0d60\u0005\u01c3\u00e2\u0002\u0d60\u0d61\u0005", - "\u01b1\u00d9\u0002\u0d61\u0d62\u0005\u01cf\u00e8\u0002\u0d62\u0192\u0003", - "\u0002\u0002\u0002\u0d63\u0d64\u0005\u01b9\u00dd\u0002\u0d64\u0d65\u0005", - "\u01c3\u00e2\u0002\u0d65\u0d66\u0005\u01cf\u00e8\u0002\u0d66\u0194\u0003", - "\u0002\u0002\u0002\u0d67\u0d68\u0005\u01bf\u00e0\u0002\u0d68\u0d69\u0005", - "\u01b9\u00dd\u0002\u0d69\u0d6a\u0005\u01cd\u00e7\u0002\u0d6a\u0d6b\u0005", - "\u01cf\u00e8\u0002\u0d6b\u0196\u0003\u0002\u0002\u0002\u0d6c\u0d6d\u0005", - "\u01c1\u00e1\u0002\u0d6d\u0d6e\u0005\u01a9\u00d5\u0002\u0d6e\u0d6f\u0005", - "\u01c7\u00e4\u0002\u0d6f\u0198\u0003\u0002\u0002\u0002\u0d70\u0d71\u0005", - "\u01cd\u00e7\u0002\u0d71\u0d72\u0005\u01c1\u00e1\u0002\u0d72\u0d73\u0005", - "\u01a9\u00d5\u0002\u0d73\u0d74\u0005\u01bf\u00e0\u0002\u0d74\u0d75\u0005", - "\u01bf\u00e0\u0002\u0d75\u0d76\u0005\u01b9\u00dd\u0002\u0d76\u0d77\u0005", - "\u01c3\u00e2\u0002\u0d77\u0d78\u0005\u01cf\u00e8\u0002\u0d78\u019a\u0003", - "\u0002\u0002\u0002\u0d79\u0d7a\u0005\u01cf\u00e8\u0002\u0d7a\u0d7b\u0005", - "\u01b1\u00d9\u0002\u0d7b\u0d7c\u0005\u01d7\u00ec\u0002\u0d7c\u0d7d\u0005", - "\u01cf\u00e8\u0002\u0d7d\u019c\u0003\u0002\u0002\u0002\u0d7e\u0d7f\u0005", - "\u01cf\u00e8\u0002\u0d7f\u0d80\u0005\u01b9\u00dd\u0002\u0d80\u0d81\u0005", - "\u01c1\u00e1\u0002\u0d81\u0d82\u0005\u01b1\u00d9\u0002\u0d82\u0d83\u0005", - "\u01d1\u00e9\u0002\u0d83\u0d84\u0005\u01d1\u00e9\u0002\u0d84\u0d85\u0005", - "\u01b9\u00dd\u0002\u0d85\u0d86\u0005\u01af\u00d8\u0002\u0d86\u019e\u0003", - "\u0002\u0002\u0002\u0d87\u0d88\u0005\u01cf\u00e8\u0002\u0d88\u0d89\u0005", - "\u01b9\u00dd\u0002\u0d89\u0d8a\u0005\u01c1\u00e1\u0002\u0d8a\u0d8b\u0005", - "\u01b1\u00d9\u0002\u0d8b\u01a0\u0003\u0002\u0002\u0002\u0d8c\u0d8d\u0005", - "\u01cf\u00e8\u0002\u0d8d\u0d8e\u0005\u01b9\u00dd\u0002\u0d8e\u0d8f\u0005", - "\u01c3\u00e2\u0002\u0d8f\u0d90\u0005\u01d9\u00ed\u0002\u0d90\u0d91\u0005", - "\u01b9\u00dd\u0002\u0d91\u0d92\u0005\u01c3\u00e2\u0002\u0d92\u0d93\u0005", - "\u01cf\u00e8\u0002\u0d93\u01a2\u0003\u0002\u0002\u0002\u0d94\u0d95\u0005", - "\u01cf\u00e8\u0002\u0d95\u0d96\u0005\u01d1\u00e9\u0002\u0d96\u0d97\u0005", - "\u01c7\u00e4\u0002\u0d97\u0d98\u0005\u01bf\u00e0\u0002\u0d98\u0d99\u0005", - "\u01b1\u00d9\u0002\u0d99\u01a4\u0003\u0002\u0002\u0002\u0d9a\u0d9b\u0005", - "\u01d3\u00ea\u0002\u0d9b\u0d9c\u0005\u01a9\u00d5\u0002\u0d9c\u0d9d\u0005", - "\u01cb\u00e6\u0002\u0d9d\u0d9e\u0005\u01ad\u00d7\u0002\u0d9e\u0d9f\u0005", - "\u01b7\u00dc\u0002\u0d9f\u0da0\u0005\u01a9\u00d5\u0002\u0da0\u0da1\u0005", - "\u01cb\u00e6\u0002\u0da1\u01a6\u0003\u0002\u0002\u0002\u0da2\u0da3\u0005", - "\u01d3\u00ea\u0002\u0da3\u0da4\u0005\u01a9\u00d5\u0002\u0da4\u0da5\u0005", - "\u01cb\u00e6\u0002\u0da5\u0da6\u0005\u01b9\u00dd\u0002\u0da6\u0da7\u0005", - "\u01c3\u00e2\u0002\u0da7\u0da8\u0005\u01cf\u00e8\u0002\u0da8\u01a8\u0003", - "\u0002\u0002\u0002\u0da9\u0daa\t\u0004\u0002\u0002\u0daa\u01aa\u0003", - "\u0002\u0002\u0002\u0dab\u0dac\t\u0005\u0002\u0002\u0dac\u01ac\u0003", - "\u0002\u0002\u0002\u0dad\u0dae\t\u0006\u0002\u0002\u0dae\u01ae\u0003", - "\u0002\u0002\u0002\u0daf\u0db0\t\u0007\u0002\u0002\u0db0\u01b0\u0003", - "\u0002\u0002\u0002\u0db1\u0db2\t\b\u0002\u0002\u0db2\u01b2\u0003\u0002", - "\u0002\u0002\u0db3\u0db4\t\t\u0002\u0002\u0db4\u01b4\u0003\u0002\u0002", - "\u0002\u0db5\u0db6\t\n\u0002\u0002\u0db6\u01b6\u0003\u0002\u0002\u0002", - "\u0db7\u0db8\t\u000b\u0002\u0002\u0db8\u01b8\u0003\u0002\u0002\u0002", - "\u0db9\u0dba\t\f\u0002\u0002\u0dba\u01ba\u0003\u0002\u0002\u0002\u0dbb", - "\u0dbc\t\r\u0002\u0002\u0dbc\u01bc\u0003\u0002\u0002\u0002\u0dbd\u0dbe", - "\t\u000e\u0002\u0002\u0dbe\u01be\u0003\u0002\u0002\u0002\u0dbf\u0dc0", - "\t\u000f\u0002\u0002\u0dc0\u01c0\u0003\u0002\u0002\u0002\u0dc1\u0dc2", - "\t\u0010\u0002\u0002\u0dc2\u01c2\u0003\u0002\u0002\u0002\u0dc3\u0dc4", - "\t\u0011\u0002\u0002\u0dc4\u01c4\u0003\u0002\u0002\u0002\u0dc5\u0dc6", - "\t\u0012\u0002\u0002\u0dc6\u01c6\u0003\u0002\u0002\u0002\u0dc7\u0dc8", - "\t\u0013\u0002\u0002\u0dc8\u01c8\u0003\u0002\u0002\u0002\u0dc9\u0dca", - "\t\u0014\u0002\u0002\u0dca\u01ca\u0003\u0002\u0002\u0002\u0dcb\u0dcc", - "\t\u0015\u0002\u0002\u0dcc\u01cc\u0003\u0002\u0002\u0002\u0dcd\u0dce", - "\t\u0016\u0002\u0002\u0dce\u01ce\u0003\u0002\u0002\u0002\u0dcf\u0dd0", - "\t\u0017\u0002\u0002\u0dd0\u01d0\u0003\u0002\u0002\u0002\u0dd1\u0dd2", - "\t\u0018\u0002\u0002\u0dd2\u01d2\u0003\u0002\u0002\u0002\u0dd3\u0dd4", - "\t\u0019\u0002\u0002\u0dd4\u01d4\u0003\u0002\u0002\u0002\u0dd5\u0dd6", - "\t\u001a\u0002\u0002\u0dd6\u01d6\u0003\u0002\u0002\u0002\u0dd7\u0dd8", - "\t\u001b\u0002\u0002\u0dd8\u01d8\u0003\u0002\u0002\u0002\u0dd9\u0dda", - "\t\u001c\u0002\u0002\u0dda\u01da\u0003\u0002\u0002\u0002\u0ddb\u0ddc", - "\t\u001d\u0002\u0002\u0ddc\u01dc\u0003\u0002\u0002\u0002\u0ddd\u0dde", - "\u0007&\u0002\u0002\u0dde\u0ddf\u0007&\u0002\u0002\u0ddf\u01de\u0003", - "\u0002\u0002\u0002\u0de0\u0de1\u0007&\u0002\u0002\u0de1\u0de2\u0007", - "&\u0002\u0002\u0de2\u0de8\u0003\u0002\u0002\u0002\u0de3\u0de7\n\u001e", - "\u0002\u0002\u0de4\u0de5\u0007&\u0002\u0002\u0de5\u0de7\n\u001e\u0002", - "\u0002\u0de6\u0de3\u0003\u0002\u0002\u0002\u0de6\u0de4\u0003\u0002\u0002", - "\u0002\u0de7\u0dea\u0003\u0002\u0002\u0002\u0de8\u0de6\u0003\u0002\u0002", - "\u0002\u0de8\u0de9\u0003\u0002\u0002\u0002\u0de9\u0deb\u0003\u0002\u0002", - "\u0002\u0dea\u0de8\u0003\u0002\u0002\u0002\u0deb\u0dec\u0007&\u0002", - "\u0002\u0dec\u0ded\u0007&\u0002\u0002\u0ded\u01e0\u0003\u0002\u0002", - "\u0002\u0dee\u0def\t\u001f\u0002\u0002\u0def\u0df0\t\u001f\u0002\u0002", - "\u0df0\u0df1\t\u001f\u0002\u0002\u0df1\u0df2\t\u001f\u0002\u0002\u0df2", - "\u01e2\u0003\u0002\u0002\u0002\u0df3\u0df7\t \u0002\u0002\u0df4\u0df6", - "\t!\u0002\u0002\u0df5\u0df4\u0003\u0002\u0002\u0002\u0df6\u0df9\u0003", - "\u0002\u0002\u0002\u0df7\u0df5\u0003\u0002\u0002\u0002\u0df7\u0df8\u0003", - "\u0002\u0002\u0002\u0df8\u0e02\u0003\u0002\u0002\u0002\u0df9\u0df7\u0003", - '\u0002\u0002\u0002\u0dfa\u0dfc\u0007$\u0002\u0002\u0dfb\u0dfd\n"\u0002', - "\u0002\u0dfc\u0dfb\u0003\u0002\u0002\u0002\u0dfd\u0dfe\u0003\u0002\u0002", - "\u0002\u0dfe\u0dfc\u0003\u0002\u0002\u0002\u0dfe\u0dff\u0003\u0002\u0002", - "\u0002\u0dff\u0e00\u0003\u0002\u0002\u0002\u0e00\u0e02\u0007$\u0002", - "\u0002\u0e01\u0df3\u0003\u0002\u0002\u0002\u0e01\u0dfa\u0003\u0002\u0002", - "\u0002\u0e02\u01e4\u0003\u0002\u0002\u0002\u0e03\u0e0b\u0007)\u0002", - "\u0002\u0e04\u0e05\u0007^\u0002\u0002\u0e05\u0e0a\u000b\u0002\u0002", - "\u0002\u0e06\u0e07\u0007)\u0002\u0002\u0e07\u0e0a\u0007)\u0002\u0002", - "\u0e08\u0e0a\n#\u0002\u0002\u0e09\u0e04\u0003\u0002\u0002\u0002\u0e09", - "\u0e06\u0003\u0002\u0002\u0002\u0e09\u0e08\u0003\u0002\u0002\u0002\u0e0a", - "\u0e0d\u0003\u0002\u0002\u0002\u0e0b\u0e09\u0003\u0002\u0002\u0002\u0e0b", - "\u0e0c\u0003\u0002\u0002\u0002\u0e0c\u0e0e\u0003\u0002\u0002\u0002\u0e0d", - "\u0e0b\u0003\u0002\u0002\u0002\u0e0e\u0e0f\u0007)\u0002\u0002\u0e0f", - "\u01e6\u0003\u0002\u0002\u0002\u0e10\u0e11\u0005\u01df\u00f0\u0002\u0e11", - "\u01e8\u0003\u0002\u0002\u0002\u0e12\u0e13\u0005\u01e5\u00f3\u0002\u0e13", - "\u01ea\u0003\u0002\u0002\u0002\u0e14\u0e16\u0005\u01f9\u00fd\u0002\u0e15", - "\u0e14\u0003\u0002\u0002\u0002\u0e16\u0e17\u0003\u0002\u0002\u0002\u0e17", - "\u0e15\u0003\u0002\u0002\u0002\u0e17\u0e18\u0003\u0002\u0002\u0002\u0e18", - "\u01ec\u0003\u0002\u0002\u0002\u0e19\u0e1b\u0005)\u0015\u0002\u0e1a", - "\u0e19\u0003\u0002\u0002\u0002\u0e1a\u0e1b\u0003\u0002\u0002\u0002\u0e1b", - "\u0e1d\u0003\u0002\u0002\u0002\u0e1c\u0e1e\t$\u0002\u0002\u0e1d\u0e1c", - "\u0003\u0002\u0002\u0002\u0e1e\u0e1f\u0003\u0002\u0002\u0002\u0e1f\u0e1d", - "\u0003\u0002\u0002\u0002\u0e1f\u0e20\u0003\u0002\u0002\u0002\u0e20\u0e27", - "\u0003\u0002\u0002\u0002\u0e21\u0e23\u0005\u001d\u000f\u0002\u0e22\u0e24", - "\t$\u0002\u0002\u0e23\u0e22\u0003\u0002\u0002\u0002\u0e24\u0e25\u0003", - "\u0002\u0002\u0002\u0e25\u0e23\u0003\u0002\u0002\u0002\u0e25\u0e26\u0003", - "\u0002\u0002\u0002\u0e26\u0e28\u0003\u0002\u0002\u0002\u0e27\u0e21\u0003", - "\u0002\u0002\u0002\u0e27\u0e28\u0003\u0002\u0002\u0002\u0e28\u01ee\u0003", - "\u0002\u0002\u0002\u0e29\u0e2a\u0007Z\u0002\u0002\u0e2a\u0e2e\u0007", - ")\u0002\u0002\u0e2b\u0e2c\u0005\u01f7\u00fc\u0002\u0e2c\u0e2d\u0005", - "\u01f7\u00fc\u0002\u0e2d\u0e2f\u0003\u0002\u0002\u0002\u0e2e\u0e2b\u0003", - "\u0002\u0002\u0002\u0e2f\u0e30\u0003\u0002\u0002\u0002\u0e30\u0e2e\u0003", - "\u0002\u0002\u0002\u0e30\u0e31\u0003\u0002\u0002\u0002\u0e31\u0e32\u0003", - "\u0002\u0002\u0002\u0e32\u0e33\u0007)\u0002\u0002\u0e33\u0e3d\u0003", - "\u0002\u0002\u0002\u0e34\u0e35\u00072\u0002\u0002\u0e35\u0e36\u0007", - "Z\u0002\u0002\u0e36\u0e38\u0003\u0002\u0002\u0002\u0e37\u0e39\u0005", - "\u01f7\u00fc\u0002\u0e38\u0e37\u0003\u0002\u0002\u0002\u0e39\u0e3a\u0003", - "\u0002\u0002\u0002\u0e3a\u0e38\u0003\u0002\u0002\u0002\u0e3a\u0e3b\u0003", - "\u0002\u0002\u0002\u0e3b\u0e3d\u0003\u0002\u0002\u0002\u0e3c\u0e29\u0003", - "\u0002\u0002\u0002\u0e3c\u0e34\u0003\u0002\u0002\u0002\u0e3d\u01f0\u0003", - "\u0002\u0002\u0002\u0e3e\u0e40\u0005\u01f9\u00fd\u0002\u0e3f\u0e3e\u0003", - "\u0002\u0002\u0002\u0e40\u0e41\u0003\u0002\u0002\u0002\u0e41\u0e3f\u0003", - "\u0002\u0002\u0002\u0e41\u0e42\u0003\u0002\u0002\u0002\u0e42\u0e44\u0003", - "\u0002\u0002\u0002\u0e43\u0e3f\u0003\u0002\u0002\u0002\u0e43\u0e44\u0003", - "\u0002\u0002\u0002\u0e44\u0e45\u0003\u0002\u0002\u0002\u0e45\u0e47\u0007", - "0\u0002\u0002\u0e46\u0e48\u0005\u01f9\u00fd\u0002\u0e47\u0e46\u0003", - "\u0002\u0002\u0002\u0e48\u0e49\u0003\u0002\u0002\u0002\u0e49\u0e47\u0003", - "\u0002\u0002\u0002\u0e49\u0e4a\u0003\u0002\u0002\u0002\u0e4a\u0e6a\u0003", - "\u0002\u0002\u0002\u0e4b\u0e4d\u0005\u01f9\u00fd\u0002\u0e4c\u0e4b\u0003", - "\u0002\u0002\u0002\u0e4d\u0e4e\u0003\u0002\u0002\u0002\u0e4e\u0e4c\u0003", - "\u0002\u0002\u0002\u0e4e\u0e4f\u0003\u0002\u0002\u0002\u0e4f\u0e50\u0003", - "\u0002\u0002\u0002\u0e50\u0e51\u00070\u0002\u0002\u0e51\u0e52\u0005", - "\u01fb\u00fe\u0002\u0e52\u0e6a\u0003\u0002\u0002\u0002\u0e53\u0e55\u0005", - "\u01f9\u00fd\u0002\u0e54\u0e53\u0003\u0002\u0002\u0002\u0e55\u0e56\u0003", - "\u0002\u0002\u0002\u0e56\u0e54\u0003\u0002\u0002\u0002\u0e56\u0e57\u0003", - "\u0002\u0002\u0002\u0e57\u0e59\u0003\u0002\u0002\u0002\u0e58\u0e54\u0003", - "\u0002\u0002\u0002\u0e58\u0e59\u0003\u0002\u0002\u0002\u0e59\u0e5a\u0003", - "\u0002\u0002\u0002\u0e5a\u0e5c\u00070\u0002\u0002\u0e5b\u0e5d\u0005", - "\u01f9\u00fd\u0002\u0e5c\u0e5b\u0003\u0002\u0002\u0002\u0e5d\u0e5e\u0003", - "\u0002\u0002\u0002\u0e5e\u0e5c\u0003\u0002\u0002\u0002\u0e5e\u0e5f\u0003", - "\u0002\u0002\u0002\u0e5f\u0e60\u0003\u0002\u0002\u0002\u0e60\u0e61\u0005", - "\u01fb\u00fe\u0002\u0e61\u0e6a\u0003\u0002\u0002\u0002\u0e62\u0e64\u0005", - "\u01f9\u00fd\u0002\u0e63\u0e62\u0003\u0002\u0002\u0002\u0e64\u0e65\u0003", - "\u0002\u0002\u0002\u0e65\u0e63\u0003\u0002\u0002\u0002\u0e65\u0e66\u0003", - "\u0002\u0002\u0002\u0e66\u0e67\u0003\u0002\u0002\u0002\u0e67\u0e68\u0005", - "\u01fb\u00fe\u0002\u0e68\u0e6a\u0003\u0002\u0002\u0002\u0e69\u0e43\u0003", - "\u0002\u0002\u0002\u0e69\u0e4c\u0003\u0002\u0002\u0002\u0e69\u0e58\u0003", - "\u0002\u0002\u0002\u0e69\u0e63\u0003\u0002\u0002\u0002\u0e6a\u01f2\u0003", - "\u0002\u0002\u0002\u0e6b\u0e6c\u0005\u01e3\u00f2\u0002\u0e6c\u01f4\u0003", - "\u0002\u0002\u0002\u0e6d\u0e6e\u0005\u01e1\u00f1\u0002\u0e6e\u0e6f\u0005", - "\u01e1\u00f1\u0002\u0e6f\u0e70\u0007/\u0002\u0002\u0e70\u0e71\u0005", - "\u01e1\u00f1\u0002\u0e71\u0e72\u0007/\u0002\u0002\u0e72\u0e73\u0005", - "\u01e1\u00f1\u0002\u0e73\u0e74\u0007/\u0002\u0002\u0e74\u0e75\u0005", - "\u01e1\u00f1\u0002\u0e75\u0e76\u0007/\u0002\u0002\u0e76\u0e77\u0005", - "\u01e1\u00f1\u0002\u0e77\u0e78\u0005\u01e1\u00f1\u0002\u0e78\u0e79\u0005", - "\u01e1\u00f1\u0002\u0e79\u01f6\u0003\u0002\u0002\u0002\u0e7a\u0e7b\t", - "%\u0002\u0002\u0e7b\u01f8\u0003\u0002\u0002\u0002\u0e7c\u0e7d\t$\u0002", - "\u0002\u0e7d\u01fa\u0003\u0002\u0002\u0002\u0e7e\u0e80\u0007G\u0002", - "\u0002\u0e7f\u0e81\u0007/\u0002\u0002\u0e80\u0e7f\u0003\u0002\u0002", - "\u0002\u0e80\u0e81\u0003\u0002\u0002\u0002\u0e81\u0e83\u0003\u0002\u0002", - "\u0002\u0e82\u0e84\u0005\u01f9\u00fd\u0002\u0e83\u0e82\u0003\u0002\u0002", - "\u0002\u0e84\u0e85\u0003\u0002\u0002\u0002\u0e85\u0e83\u0003\u0002\u0002", - "\u0002\u0e85\u0e86\u0003\u0002\u0002\u0002\u0e86\u01fc\u0003\u0002\u0002", - "\u0002\u0e87\u0e88\u0007?\u0002\u0002\u0e88\u01fe\u0003\u0002\u0002", - "\u0002\u0e89\u0e8a\u0007>\u0002\u0002\u0e8a\u0200\u0003\u0002\u0002", - "\u0002\u0e8b\u0e8c\u0007@\u0002\u0002\u0e8c\u0202\u0003\u0002\u0002", - "\u0002\u0e8d\u0e8e\u0007@\u0002\u0002\u0e8e\u0e8f\u0007?\u0002\u0002", - "\u0e8f\u0204\u0003\u0002\u0002\u0002\u0e90\u0e91\u0007>\u0002\u0002", - "\u0e91\u0e92\u0007?\u0002\u0002\u0e92\u0206\u0003\u0002\u0002\u0002", - "\u0e93\u0e94\u0005\u01fd\u00ff\u0002\u0e94\u0208\u0003\u0002\u0002\u0002", - "\u0e95\u0e96\u0005\u01ff\u0100\u0002\u0e96\u020a\u0003\u0002\u0002\u0002", - "\u0e97\u0e98\u0005\u0201\u0101\u0002\u0e98\u020c\u0003\u0002\u0002\u0002", - "\u0e99\u0e9a\u0005\u0205\u0103\u0002\u0e9a\u020e\u0003\u0002\u0002\u0002", - "\u0e9b\u0e9c\u0005\u0203\u0102\u0002\u0e9c\u0210\u0003\u0002\u0002\u0002", - "\u0e9d\u0e9e\u0005\u01d1\u00e9\u0002\u0e9e\u0e9f\u0005\u01cd\u00e7\u0002", - "\u0e9f\u0ea0\u0005\u01b1\u00d9\u0002\u0ea0\u0ea1\u0005\u01cb\u00e6\u0002", - "\u0ea1\u0ea2\u0005\u01cd\u00e7\u0002\u0ea2\u0ea9\u0003\u0002\u0002\u0002", - "\u0ea3\u0ea4\u0007W\u0002\u0002\u0ea4\u0ea5\u0007U\u0002\u0002\u0ea5", - "\u0ea6\u0007G\u0002\u0002\u0ea6\u0ea7\u0007T\u0002\u0002\u0ea7\u0ea9", - "\u0007U\u0002\u0002\u0ea8\u0e9d\u0003\u0002\u0002\u0002\u0ea8\u0ea3", - "\u0003\u0002\u0002\u0002\u0ea9\u0212\u0003\u0002\u0002\u0002\u0eaa\u0eab", - "\u0005\u01d3\u00ea\u0002\u0eab\u0eac\u0005\u01b1\u00d9\u0002\u0eac\u0ead", - "\u0005\u01ad\u00d7\u0002\u0ead\u0eae\u0005\u01cf\u00e8\u0002\u0eae\u0eaf", - "\u0005\u01c5\u00e3\u0002\u0eaf\u0eb0\u0005\u01cb\u00e6\u0002\u0eb0\u0eb8", - "\u0003\u0002\u0002\u0002\u0eb1\u0eb2\u0007X\u0002\u0002\u0eb2\u0eb3", - "\u0007G\u0002\u0002\u0eb3\u0eb4\u0007E\u0002\u0002\u0eb4\u0eb5\u0007", - "V\u0002\u0002\u0eb5\u0eb6\u0007Q\u0002\u0002\u0eb6\u0eb8\u0007T\u0002", - "\u0002\u0eb7\u0eaa\u0003\u0002\u0002\u0002\u0eb7\u0eb1\u0003\u0002\u0002", - "\u0002\u0eb8\u0214\u0003\u0002\u0002\u0002\u00a5\u0002\u022a\u0235\u0242", - "\u0250\u0255\u0259\u025d\u0263\u0267\u0269\u0287\u029c\u02a5\u02b2\u02bf", - "\u02c8\u02d1\u02de\u02e5\u02ee\u0303\u0310\u031d\u0324\u0333\u034a\u0365", - "\u0376\u038f\u03a2\u03b1\u03c0\u03cf\u03de\u03e9\u03fc\u040f\u041a\u0439", - "\u0452\u0463\u0474\u0483\u0498\u04ad\u04c2\u04cd\u04d8\u04eb\u0500\u050d", - "\u0514\u051b\u0528\u053b\u054e\u055b\u056a\u0575\u057c\u0587\u0590\u059b", - "\u05ae\u05c3\u05d6\u05e3\u05f0\u0605\u0620\u062f\u063c\u0657\u0666\u066f", - "\u0688\u06a1\u06aa\u06b5\u06bc\u06c3\u06cc\u06dd\u06e4\u06f1\u0706\u0719", - "\u0722\u0739\u0752\u0763\u0772\u0781\u0792\u07ab\u07bc\u07cb\u07d6\u07e3", - "\u07f6\u0801\u080f\u081e\u082d\u0836\u0843\u0852\u0863\u0870\u0885\u0892", - "\u089f\u08b4\u08bb\u08c8\u08d9\u08eb\u08fe\u0907\u0910\u091b\u092e\u093d", - "\u0946\u0951\u095e\u0969\u0978\u0983\u0990\u099b\u09b0\u09c0\u0a09\u0de6", - "\u0de8\u0df7\u0dfe\u0e01\u0e09\u0e0b\u0e17\u0e1a\u0e1f\u0e25\u0e27\u0e30", - "\u0e3a\u0e3c\u0e41\u0e43\u0e49\u0e4e\u0e56\u0e58\u0e5e\u0e65\u0e69\u0e80", - "\u0e85\u0ea8\u0eb7\u0003\u0002\u0003\u0002", -].join(""); - -const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); - -const decisionsToDFA = atn.decisionToState.map( - (ds, index) => new antlr4.dfa.DFA(ds, index), -); - -class CqlLexer extends antlr4.Lexer { - static grammarFileName = "CqlLexer.g4"; - static channelNames = ["DEFAULT_TOKEN_CHANNEL", "HIDDEN"]; - static modeNames = ["DEFAULT_MODE"]; - static literalNames = [ - null, - "'('", - "')'", - "'{'", - "'}'", - "'['", - "']'", - "','", - "';'", - "':'", - null, - null, - null, - null, - "'.'", - "'*'", - "'/'", - "'%'", - "'+'", - "'--'", - "'-'", - "'\"'", - "'''", - ]; - static symbolicNames = [ - null, - "LR_BRACKET", - "RR_BRACKET", - "LC_BRACKET", - "RC_BRACKET", - "LS_BRACKET", - "RS_BRACKET", - "COMMA", - "SEMI", - "COLON", - "SPACE", - "SPEC_MYSQL_COMMENT", - "COMMENT_INPUT", - "LINE_COMMENT", - "DOT", - "STAR", - "DIVIDE", - "MODULE", - "PLUS", - "MINUSMINUS", - "MINUS", - "DQUOTE", - "SQUOTE", - "K_ADD", - "K_AGGREGATE", - "K_ALL", - "K_ALLOW", - "K_ALTER", - "K_AND", - "K_ANY", - "K_APPLY", - "K_AS", - "K_ASC", - "K_AUTHORIZE", - "K_BATCH", - "K_BEGIN", - "K_BY", - "K_CALLED", - "K_CLUSTERING", - "K_COLUMNFAMILY", - "K_COMPACT", - "K_CONSISTENCY", - "K_CONTAINS", - "K_CREATE", - "K_CUSTOM", - "K_SEARCH", - "K_DELETE", - "K_DESC", - "K_DESCRIBE", - "K_DISTINCT", - "K_DROP", - "K_DURABLE_WRITES", - "K_EACH_QUORUM", - "K_ENTRIES", - "K_EXECUTE", - "K_EXISTS", - "K_FALSE", - "K_FILTERING", - "K_FINALFUNC", - "K_FROM", - "K_FULL", - "K_FUNCTION", - "K_FUNCTIONS", - "K_GRANT", - "K_IF", - "K_IN", - "K_INDEX", - "K_INFINITY", - "K_INITCOND", - "K_INPUT", - "K_INSERT", - "K_INTO", - "K_IS", - "K_JSON", - "K_KEY", - "K_KEYS", - "K_KEYSPACE", - "K_KEYSPACES", - "K_LANGUAGE", - "K_LEVEL", - "K_LIMIT", - "K_LOCAL_ONE", - "K_LOCAL_QUORUM", - "K_LOGGED", - "K_LOGIN", - "K_MATERIALIZED", - "K_MODIFY", - "K_NAN", - "K_NORECURSIVE", - "K_NOSUPERUSER", - "K_NOT", - "K_NULL", - "K_OF", - "K_ON", - "K_ONE", - "K_OPTIONS", - "K_OR", - "K_ORDER", - "K_PARTITION", - "K_PASSWORD", - "K_PER", - "K_PERMISSION", - "K_PERMISSIONS", - "K_PRIMARY", - "K_QUORUM", - "K_RENAME", - "K_REPLACE", - "K_REPLICATION", - "K_RETURNS", - "K_REVOKE", - "K_ROLE", - "K_ROLES", - "K_INTERNAL", - "K_LDAP", - "K_SCHEME", - "K_SCHEMA", - "K_SELECT", - "K_SET", - "K_SFUNC", - "K_STATIC", - "K_STORAGE", - "K_STYPE", - "K_SUPERUSER", - "K_TABLE", - "K_THREE", - "K_TIMESTAMP", - "K_TO", - "K_TOKEN", - "K_TRIGGER", - "K_TRUE", - "K_TRUNCATE", - "K_TTL", - "K_TWO", - "K_TYPE", - "K_UNLOGGED", - "K_UPDATE", - "K_USE", - "K_USER", - "K_USING", - "K_UUID", - "K_VALUES", - "K_VIEW", - "K_WHERE", - "K_WITH", - "K_WRITETIME", - "K_ASCII", - "K_CASE_SENITIVE", - "K_NORMALIZE", - "K_SIMILARITY_FUNCTION", - "K_ANALYZED", - "K_IS_LITERAL", - "K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB", - "K_TOKENIZATION_ENABLE_STEMMING", - "K_TOKENIZATION_SKIP_STOP_WORDS", - "K_TOKENIZATION_LOCALE", - "K_TOKENIZATION_NORMALIZE_LOWERCASE", - "K_TOKENIZATION_NORMALIZE_UPPERCASE", - "K_NORMALIZE_LOWERCASE", - "K_NORMALIZE_UPPERCASE", - "K_MODE", - "K_ANALYZER_CLASS", - "K_STORAGE_ATTACHED_INDEX", - "K_SASI_INDEX", - "K_SOLR_INDEX", - "K_SPACE_SAVING_NO_JOIN", - "K_SPACE_SAVING_ALL", - "K_SPACE_SAVING_SLOW_TRIE_PRECISION", - "K_SPACE_SAVING_NO_TEXT_FIELD", - "K_DOC_VALUES", - "K_COPY_FIELD", - "K_EXCLUDED", - "K_INDEXED", - "K_LOWERCASE", - "K_COLUMNS", - "K_PROFILES", - "K_CONFIG", - "K_AUTOCOMMIT_TIME", - "K_DEFAULT_QUERY_FIELD", - "K_DIRECTORY_FACTORY", - "K_FILTER_CACHE_LOW_WATERMARK", - "K_FILTER_CACHE_HIGH_WATERMARK", - "K_DIRECTORY_FACTORY_CLASS", - "K_MERGE_MAX_THREAD_COUNT", - "K_MERGE_MAX_MERGE_COUNT", - "K_RAM_BUFFER_SIZE", - "K_REALTIME", - "K_RECOVERY", - "K_REINDEX", - "K_LENIENT", - "K_STANDARD", - "K_ENCRYPTED", - "K_BIGINT", - "K_BLOB", - "K_BOOLEAN", - "K_COUNTER", - "K_DATE", - "K_DECIMAL", - "K_DOUBLE", - "K_FLOAT", - "K_FROZEN", - "K_INET", - "K_INT", - "K_LIST", - "K_MAP", - "K_SMALLINT", - "K_TEXT", - "K_TIMEUUID", - "K_TIME", - "K_TINYINT", - "K_TUPLE", - "K_VARCHAR", - "K_VARINT", - "CODE_BLOCK", - "STRING_LITERAL", - "DECIMAL_LITERAL", - "FLOAT_LITERAL", - "HEXADECIMAL_LITERAL", - "REAL_LITERAL", - "OBJECT_NAME", - "UUID", - "OPERATOR_EQ", - "OPERATOR_LT", - "OPERATOR_GT", - "OPERATOR_LTE", - "OPERATOR_GTE", - "K_USERS", - "K_VECTOR", - ]; - static ruleNames = [ - "LR_BRACKET", - "RR_BRACKET", - "LC_BRACKET", - "RC_BRACKET", - "LS_BRACKET", - "RS_BRACKET", - "COMMA", - "SEMI", - "COLON", - "SPACE", - "SPEC_MYSQL_COMMENT", - "COMMENT_INPUT", - "LINE_COMMENT", - "DOT", - "STAR", - "DIVIDE", - "MODULE", - "PLUS", - "MINUSMINUS", - "MINUS", - "DQUOTE", - "SQUOTE", - "K_ADD", - "K_AGGREGATE", - "K_ALL", - "K_ALLOW", - "K_ALTER", - "K_AND", - "K_ANY", - "K_APPLY", - "K_AS", - "K_ASC", - "K_AUTHORIZE", - "K_BATCH", - "K_BEGIN", - "K_BY", - "K_CALLED", - "K_CLUSTERING", - "K_COLUMNFAMILY", - "K_COMPACT", - "K_CONSISTENCY", - "K_CONTAINS", - "K_CREATE", - "K_CUSTOM", - "K_SEARCH", - "K_DELETE", - "K_DESC", - "K_DESCRIBE", - "K_DISTINCT", - "K_DROP", - "K_DURABLE_WRITES", - "K_EACH_QUORUM", - "K_ENTRIES", - "K_EXECUTE", - "K_EXISTS", - "K_FALSE", - "K_FILTERING", - "K_FINALFUNC", - "K_FROM", - "K_FULL", - "K_FUNCTION", - "K_FUNCTIONS", - "K_GRANT", - "K_IF", - "K_IN", - "K_INDEX", - "K_INFINITY", - "K_INITCOND", - "K_INPUT", - "K_INSERT", - "K_INTO", - "K_IS", - "K_JSON", - "K_KEY", - "K_KEYS", - "K_KEYSPACE", - "K_KEYSPACES", - "K_LANGUAGE", - "K_LEVEL", - "K_LIMIT", - "K_LOCAL_ONE", - "K_LOCAL_QUORUM", - "K_LOGGED", - "K_LOGIN", - "K_MATERIALIZED", - "K_MODIFY", - "K_NAN", - "K_NORECURSIVE", - "K_NOSUPERUSER", - "K_NOT", - "K_NULL", - "K_OF", - "K_ON", - "K_ONE", - "K_OPTIONS", - "K_OR", - "K_ORDER", - "K_PARTITION", - "K_PASSWORD", - "K_PER", - "K_PERMISSION", - "K_PERMISSIONS", - "K_PRIMARY", - "K_QUORUM", - "K_RENAME", - "K_REPLACE", - "K_REPLICATION", - "K_RETURNS", - "K_REVOKE", - "K_ROLE", - "K_ROLES", - "K_INTERNAL", - "K_LDAP", - "K_SCHEME", - "K_SCHEMA", - "K_SELECT", - "K_SET", - "K_SFUNC", - "K_STATIC", - "K_STORAGE", - "K_STYPE", - "K_SUPERUSER", - "K_TABLE", - "K_THREE", - "K_TIMESTAMP", - "K_TO", - "K_TOKEN", - "K_TRIGGER", - "K_TRUE", - "K_TRUNCATE", - "K_TTL", - "K_TWO", - "K_TYPE", - "K_UNLOGGED", - "K_UPDATE", - "K_USE", - "K_USER", - "K_USING", - "K_UUID", - "K_VALUES", - "K_VIEW", - "K_WHERE", - "K_WITH", - "K_WRITETIME", - "K_ASCII", - "K_CASE_SENITIVE", - "K_NORMALIZE", - "K_SIMILARITY_FUNCTION", - "K_ANALYZED", - "K_IS_LITERAL", - "K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB", - "K_TOKENIZATION_ENABLE_STEMMING", - "K_TOKENIZATION_SKIP_STOP_WORDS", - "K_TOKENIZATION_LOCALE", - "K_TOKENIZATION_NORMALIZE_LOWERCASE", - "K_TOKENIZATION_NORMALIZE_UPPERCASE", - "K_NORMALIZE_LOWERCASE", - "K_NORMALIZE_UPPERCASE", - "K_MODE", - "K_ANALYZER_CLASS", - "K_STORAGE_ATTACHED_INDEX", - "K_SASI_INDEX", - "K_SOLR_INDEX", - "K_SPACE_SAVING_NO_JOIN", - "K_SPACE_SAVING_ALL", - "K_SPACE_SAVING_SLOW_TRIE_PRECISION", - "K_SPACE_SAVING_NO_TEXT_FIELD", - "K_DOC_VALUES", - "K_COPY_FIELD", - "K_EXCLUDED", - "K_INDEXED", - "K_LOWERCASE", - "K_COLUMNS", - "K_PROFILES", - "K_CONFIG", - "K_AUTOCOMMIT_TIME", - "K_DEFAULT_QUERY_FIELD", - "K_DIRECTORY_FACTORY", - "K_FILTER_CACHE_LOW_WATERMARK", - "K_FILTER_CACHE_HIGH_WATERMARK", - "K_DIRECTORY_FACTORY_CLASS", - "K_MERGE_MAX_THREAD_COUNT", - "K_MERGE_MAX_MERGE_COUNT", - "K_RAM_BUFFER_SIZE", - "K_REALTIME", - "K_RECOVERY", - "K_REINDEX", - "K_LENIENT", - "K_STANDARD", - "K_ENCRYPTED", - "K_BIGINT", - "K_BLOB", - "K_BOOLEAN", - "K_COUNTER", - "K_DATE", - "K_DECIMAL", - "K_DOUBLE", - "K_FLOAT", - "K_FROZEN", - "K_INET", - "K_INT", - "K_LIST", - "K_MAP", - "K_SMALLINT", - "K_TEXT", - "K_TIMEUUID", - "K_TIME", - "K_TINYINT", - "K_TUPLE", - "K_VARCHAR", - "K_VARINT", - "A", - "B", - "C", - "D", - "E", - "F", - "G", - "H", - "I", - "J", - "K", - "L", - "M", - "N", - "O", - "P", - "Q", - "R", - "S", - "T", - "U", - "V", - "W", - "X", - "Y", - "Z", - "CODE_BLOCK_DELIMITER", - "CODE_BLOCK_FRAG", - "HEX_4DIGIT", - "OBJECT_NAME_FRAG", - "SQUOTA_STRING", - "CODE_BLOCK", - "STRING_LITERAL", - "DECIMAL_LITERAL", - "FLOAT_LITERAL", - "HEXADECIMAL_LITERAL", - "REAL_LITERAL", - "OBJECT_NAME", - "UUID", - "HEX_DIGIT", - "DEC_DIGIT", - "EXPONENT_NUM_PART", - "OPERATOR_EQ_FRAG", - "OPERATOR_LT_FRAG", - "OPERATOR_GT_FRAG", - "OPERATOR_GTE_FRAG", - "OPERATOR_LTE_FRAG", - "OPERATOR_EQ", - "OPERATOR_LT", - "OPERATOR_GT", - "OPERATOR_LTE", - "OPERATOR_GTE", - "K_USERS", - "K_VECTOR", - ]; - - constructor(input) { - super(input); - this._interp = new antlr4.atn.LexerATNSimulator( - this, - atn, - decisionsToDFA, - new antlr4.PredictionContextCache(), - ); - } - - get atn() { - return atn; - } -} - -CqlLexer.EOF = antlr4.Token.EOF; -CqlLexer.LR_BRACKET = 1; -CqlLexer.RR_BRACKET = 2; -CqlLexer.LC_BRACKET = 3; -CqlLexer.RC_BRACKET = 4; -CqlLexer.LS_BRACKET = 5; -CqlLexer.RS_BRACKET = 6; -CqlLexer.COMMA = 7; -CqlLexer.SEMI = 8; -CqlLexer.COLON = 9; -CqlLexer.SPACE = 10; -CqlLexer.SPEC_MYSQL_COMMENT = 11; -CqlLexer.COMMENT_INPUT = 12; -CqlLexer.LINE_COMMENT = 13; -CqlLexer.DOT = 14; -CqlLexer.STAR = 15; -CqlLexer.DIVIDE = 16; -CqlLexer.MODULE = 17; -CqlLexer.PLUS = 18; -CqlLexer.MINUSMINUS = 19; -CqlLexer.MINUS = 20; -CqlLexer.DQUOTE = 21; -CqlLexer.SQUOTE = 22; -CqlLexer.K_ADD = 23; -CqlLexer.K_AGGREGATE = 24; -CqlLexer.K_ALL = 25; -CqlLexer.K_ALLOW = 26; -CqlLexer.K_ALTER = 27; -CqlLexer.K_AND = 28; -CqlLexer.K_ANY = 29; -CqlLexer.K_APPLY = 30; -CqlLexer.K_AS = 31; -CqlLexer.K_ASC = 32; -CqlLexer.K_AUTHORIZE = 33; -CqlLexer.K_BATCH = 34; -CqlLexer.K_BEGIN = 35; -CqlLexer.K_BY = 36; -CqlLexer.K_CALLED = 37; -CqlLexer.K_CLUSTERING = 38; -CqlLexer.K_COLUMNFAMILY = 39; -CqlLexer.K_COMPACT = 40; -CqlLexer.K_CONSISTENCY = 41; -CqlLexer.K_CONTAINS = 42; -CqlLexer.K_CREATE = 43; -CqlLexer.K_CUSTOM = 44; -CqlLexer.K_SEARCH = 45; -CqlLexer.K_DELETE = 46; -CqlLexer.K_DESC = 47; -CqlLexer.K_DESCRIBE = 48; -CqlLexer.K_DISTINCT = 49; -CqlLexer.K_DROP = 50; -CqlLexer.K_DURABLE_WRITES = 51; -CqlLexer.K_EACH_QUORUM = 52; -CqlLexer.K_ENTRIES = 53; -CqlLexer.K_EXECUTE = 54; -CqlLexer.K_EXISTS = 55; -CqlLexer.K_FALSE = 56; -CqlLexer.K_FILTERING = 57; -CqlLexer.K_FINALFUNC = 58; -CqlLexer.K_FROM = 59; -CqlLexer.K_FULL = 60; -CqlLexer.K_FUNCTION = 61; -CqlLexer.K_FUNCTIONS = 62; -CqlLexer.K_GRANT = 63; -CqlLexer.K_IF = 64; -CqlLexer.K_IN = 65; -CqlLexer.K_INDEX = 66; -CqlLexer.K_INFINITY = 67; -CqlLexer.K_INITCOND = 68; -CqlLexer.K_INPUT = 69; -CqlLexer.K_INSERT = 70; -CqlLexer.K_INTO = 71; -CqlLexer.K_IS = 72; -CqlLexer.K_JSON = 73; -CqlLexer.K_KEY = 74; -CqlLexer.K_KEYS = 75; -CqlLexer.K_KEYSPACE = 76; -CqlLexer.K_KEYSPACES = 77; -CqlLexer.K_LANGUAGE = 78; -CqlLexer.K_LEVEL = 79; -CqlLexer.K_LIMIT = 80; -CqlLexer.K_LOCAL_ONE = 81; -CqlLexer.K_LOCAL_QUORUM = 82; -CqlLexer.K_LOGGED = 83; -CqlLexer.K_LOGIN = 84; -CqlLexer.K_MATERIALIZED = 85; -CqlLexer.K_MODIFY = 86; -CqlLexer.K_NAN = 87; -CqlLexer.K_NORECURSIVE = 88; -CqlLexer.K_NOSUPERUSER = 89; -CqlLexer.K_NOT = 90; -CqlLexer.K_NULL = 91; -CqlLexer.K_OF = 92; -CqlLexer.K_ON = 93; -CqlLexer.K_ONE = 94; -CqlLexer.K_OPTIONS = 95; -CqlLexer.K_OR = 96; -CqlLexer.K_ORDER = 97; -CqlLexer.K_PARTITION = 98; -CqlLexer.K_PASSWORD = 99; -CqlLexer.K_PER = 100; -CqlLexer.K_PERMISSION = 101; -CqlLexer.K_PERMISSIONS = 102; -CqlLexer.K_PRIMARY = 103; -CqlLexer.K_QUORUM = 104; -CqlLexer.K_RENAME = 105; -CqlLexer.K_REPLACE = 106; -CqlLexer.K_REPLICATION = 107; -CqlLexer.K_RETURNS = 108; -CqlLexer.K_REVOKE = 109; -CqlLexer.K_ROLE = 110; -CqlLexer.K_ROLES = 111; -CqlLexer.K_INTERNAL = 112; -CqlLexer.K_LDAP = 113; -CqlLexer.K_SCHEME = 114; -CqlLexer.K_SCHEMA = 115; -CqlLexer.K_SELECT = 116; -CqlLexer.K_SET = 117; -CqlLexer.K_SFUNC = 118; -CqlLexer.K_STATIC = 119; -CqlLexer.K_STORAGE = 120; -CqlLexer.K_STYPE = 121; -CqlLexer.K_SUPERUSER = 122; -CqlLexer.K_TABLE = 123; -CqlLexer.K_THREE = 124; -CqlLexer.K_TIMESTAMP = 125; -CqlLexer.K_TO = 126; -CqlLexer.K_TOKEN = 127; -CqlLexer.K_TRIGGER = 128; -CqlLexer.K_TRUE = 129; -CqlLexer.K_TRUNCATE = 130; -CqlLexer.K_TTL = 131; -CqlLexer.K_TWO = 132; -CqlLexer.K_TYPE = 133; -CqlLexer.K_UNLOGGED = 134; -CqlLexer.K_UPDATE = 135; -CqlLexer.K_USE = 136; -CqlLexer.K_USER = 137; -CqlLexer.K_USING = 138; -CqlLexer.K_UUID = 139; -CqlLexer.K_VALUES = 140; -CqlLexer.K_VIEW = 141; -CqlLexer.K_WHERE = 142; -CqlLexer.K_WITH = 143; -CqlLexer.K_WRITETIME = 144; -CqlLexer.K_ASCII = 145; -CqlLexer.K_CASE_SENITIVE = 146; -CqlLexer.K_NORMALIZE = 147; -CqlLexer.K_SIMILARITY_FUNCTION = 148; -CqlLexer.K_ANALYZED = 149; -CqlLexer.K_IS_LITERAL = 150; -CqlLexer.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB = 151; -CqlLexer.K_TOKENIZATION_ENABLE_STEMMING = 152; -CqlLexer.K_TOKENIZATION_SKIP_STOP_WORDS = 153; -CqlLexer.K_TOKENIZATION_LOCALE = 154; -CqlLexer.K_TOKENIZATION_NORMALIZE_LOWERCASE = 155; -CqlLexer.K_TOKENIZATION_NORMALIZE_UPPERCASE = 156; -CqlLexer.K_NORMALIZE_LOWERCASE = 157; -CqlLexer.K_NORMALIZE_UPPERCASE = 158; -CqlLexer.K_MODE = 159; -CqlLexer.K_ANALYZER_CLASS = 160; -CqlLexer.K_STORAGE_ATTACHED_INDEX = 161; -CqlLexer.K_SASI_INDEX = 162; -CqlLexer.K_SOLR_INDEX = 163; -CqlLexer.K_SPACE_SAVING_NO_JOIN = 164; -CqlLexer.K_SPACE_SAVING_ALL = 165; -CqlLexer.K_SPACE_SAVING_SLOW_TRIE_PRECISION = 166; -CqlLexer.K_SPACE_SAVING_NO_TEXT_FIELD = 167; -CqlLexer.K_DOC_VALUES = 168; -CqlLexer.K_COPY_FIELD = 169; -CqlLexer.K_EXCLUDED = 170; -CqlLexer.K_INDEXED = 171; -CqlLexer.K_LOWERCASE = 172; -CqlLexer.K_COLUMNS = 173; -CqlLexer.K_PROFILES = 174; -CqlLexer.K_CONFIG = 175; -CqlLexer.K_AUTOCOMMIT_TIME = 176; -CqlLexer.K_DEFAULT_QUERY_FIELD = 177; -CqlLexer.K_DIRECTORY_FACTORY = 178; -CqlLexer.K_FILTER_CACHE_LOW_WATERMARK = 179; -CqlLexer.K_FILTER_CACHE_HIGH_WATERMARK = 180; -CqlLexer.K_DIRECTORY_FACTORY_CLASS = 181; -CqlLexer.K_MERGE_MAX_THREAD_COUNT = 182; -CqlLexer.K_MERGE_MAX_MERGE_COUNT = 183; -CqlLexer.K_RAM_BUFFER_SIZE = 184; -CqlLexer.K_REALTIME = 185; -CqlLexer.K_RECOVERY = 186; -CqlLexer.K_REINDEX = 187; -CqlLexer.K_LENIENT = 188; -CqlLexer.K_STANDARD = 189; -CqlLexer.K_ENCRYPTED = 190; -CqlLexer.K_BIGINT = 191; -CqlLexer.K_BLOB = 192; -CqlLexer.K_BOOLEAN = 193; -CqlLexer.K_COUNTER = 194; -CqlLexer.K_DATE = 195; -CqlLexer.K_DECIMAL = 196; -CqlLexer.K_DOUBLE = 197; -CqlLexer.K_FLOAT = 198; -CqlLexer.K_FROZEN = 199; -CqlLexer.K_INET = 200; -CqlLexer.K_INT = 201; -CqlLexer.K_LIST = 202; -CqlLexer.K_MAP = 203; -CqlLexer.K_SMALLINT = 204; -CqlLexer.K_TEXT = 205; -CqlLexer.K_TIMEUUID = 206; -CqlLexer.K_TIME = 207; -CqlLexer.K_TINYINT = 208; -CqlLexer.K_TUPLE = 209; -CqlLexer.K_VARCHAR = 210; -CqlLexer.K_VARINT = 211; -CqlLexer.CODE_BLOCK = 212; -CqlLexer.STRING_LITERAL = 213; -CqlLexer.DECIMAL_LITERAL = 214; -CqlLexer.FLOAT_LITERAL = 215; -CqlLexer.HEXADECIMAL_LITERAL = 216; -CqlLexer.REAL_LITERAL = 217; -CqlLexer.OBJECT_NAME = 218; -CqlLexer.UUID = 219; -CqlLexer.OPERATOR_EQ = 220; -CqlLexer.OPERATOR_LT = 221; -CqlLexer.OPERATOR_GT = 222; -CqlLexer.OPERATOR_LTE = 223; -CqlLexer.OPERATOR_GTE = 224; -CqlLexer.K_USERS = 225; -CqlLexer.K_VECTOR = 226; - -exports.CqlLexer = CqlLexer; diff --git a/reverse_engineering/parser/CqlLexer.tokens b/reverse_engineering/parser/CqlLexer.tokens deleted file mode 100644 index 45c11a9f..00000000 --- a/reverse_engineering/parser/CqlLexer.tokens +++ /dev/null @@ -1,244 +0,0 @@ -LR_BRACKET=1 -RR_BRACKET=2 -LC_BRACKET=3 -RC_BRACKET=4 -LS_BRACKET=5 -RS_BRACKET=6 -COMMA=7 -SEMI=8 -COLON=9 -SPACE=10 -SPEC_MYSQL_COMMENT=11 -COMMENT_INPUT=12 -LINE_COMMENT=13 -DOT=14 -STAR=15 -DIVIDE=16 -MODULE=17 -PLUS=18 -MINUSMINUS=19 -MINUS=20 -DQUOTE=21 -SQUOTE=22 -K_ADD=23 -K_AGGREGATE=24 -K_ALL=25 -K_ALLOW=26 -K_ALTER=27 -K_AND=28 -K_ANY=29 -K_APPLY=30 -K_AS=31 -K_ASC=32 -K_AUTHORIZE=33 -K_BATCH=34 -K_BEGIN=35 -K_BY=36 -K_CALLED=37 -K_CLUSTERING=38 -K_COLUMNFAMILY=39 -K_COMPACT=40 -K_CONSISTENCY=41 -K_CONTAINS=42 -K_CREATE=43 -K_CUSTOM=44 -K_SEARCH=45 -K_DELETE=46 -K_DESC=47 -K_DESCRIBE=48 -K_DISTINCT=49 -K_DROP=50 -K_DURABLE_WRITES=51 -K_EACH_QUORUM=52 -K_ENTRIES=53 -K_EXECUTE=54 -K_EXISTS=55 -K_FALSE=56 -K_FILTERING=57 -K_FINALFUNC=58 -K_FROM=59 -K_FULL=60 -K_FUNCTION=61 -K_FUNCTIONS=62 -K_GRANT=63 -K_IF=64 -K_IN=65 -K_INDEX=66 -K_INFINITY=67 -K_INITCOND=68 -K_INPUT=69 -K_INSERT=70 -K_INTO=71 -K_IS=72 -K_JSON=73 -K_KEY=74 -K_KEYS=75 -K_KEYSPACE=76 -K_KEYSPACES=77 -K_LANGUAGE=78 -K_LEVEL=79 -K_LIMIT=80 -K_LOCAL_ONE=81 -K_LOCAL_QUORUM=82 -K_LOGGED=83 -K_LOGIN=84 -K_MATERIALIZED=85 -K_MODIFY=86 -K_NAN=87 -K_NORECURSIVE=88 -K_NOSUPERUSER=89 -K_NOT=90 -K_NULL=91 -K_OF=92 -K_ON=93 -K_ONE=94 -K_OPTIONS=95 -K_OR=96 -K_ORDER=97 -K_PARTITION=98 -K_PASSWORD=99 -K_PER=100 -K_PERMISSION=101 -K_PERMISSIONS=102 -K_PRIMARY=103 -K_QUORUM=104 -K_RENAME=105 -K_REPLACE=106 -K_REPLICATION=107 -K_RETURNS=108 -K_REVOKE=109 -K_ROLE=110 -K_ROLES=111 -K_INTERNAL=112 -K_LDAP=113 -K_SCHEME=114 -K_SCHEMA=115 -K_SELECT=116 -K_SET=117 -K_SFUNC=118 -K_STATIC=119 -K_STORAGE=120 -K_STYPE=121 -K_SUPERUSER=122 -K_TABLE=123 -K_THREE=124 -K_TIMESTAMP=125 -K_TO=126 -K_TOKEN=127 -K_TRIGGER=128 -K_TRUE=129 -K_TRUNCATE=130 -K_TTL=131 -K_TWO=132 -K_TYPE=133 -K_UNLOGGED=134 -K_UPDATE=135 -K_USE=136 -K_USER=137 -K_USING=138 -K_UUID=139 -K_VALUES=140 -K_VIEW=141 -K_WHERE=142 -K_WITH=143 -K_WRITETIME=144 -K_ASCII=145 -K_CASE_SENITIVE=146 -K_NORMALIZE=147 -K_SIMILARITY_FUNCTION=148 -K_ANALYZED=149 -K_IS_LITERAL=150 -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB=151 -K_TOKENIZATION_ENABLE_STEMMING=152 -K_TOKENIZATION_SKIP_STOP_WORDS=153 -K_TOKENIZATION_LOCALE=154 -K_TOKENIZATION_NORMALIZE_LOWERCASE=155 -K_TOKENIZATION_NORMALIZE_UPPERCASE=156 -K_NORMALIZE_LOWERCASE=157 -K_NORMALIZE_UPPERCASE=158 -K_MODE=159 -K_ANALYZER_CLASS=160 -K_STORAGE_ATTACHED_INDEX=161 -K_SASI_INDEX=162 -K_SOLR_INDEX=163 -K_SPACE_SAVING_NO_JOIN=164 -K_SPACE_SAVING_ALL=165 -K_SPACE_SAVING_SLOW_TRIE_PRECISION=166 -K_SPACE_SAVING_NO_TEXT_FIELD=167 -K_DOC_VALUES=168 -K_COPY_FIELD=169 -K_EXCLUDED=170 -K_INDEXED=171 -K_LOWERCASE=172 -K_COLUMNS=173 -K_PROFILES=174 -K_CONFIG=175 -K_AUTOCOMMIT_TIME=176 -K_DEFAULT_QUERY_FIELD=177 -K_DIRECTORY_FACTORY=178 -K_FILTER_CACHE_LOW_WATERMARK=179 -K_FILTER_CACHE_HIGH_WATERMARK=180 -K_DIRECTORY_FACTORY_CLASS=181 -K_MERGE_MAX_THREAD_COUNT=182 -K_MERGE_MAX_MERGE_COUNT=183 -K_RAM_BUFFER_SIZE=184 -K_REALTIME=185 -K_RECOVERY=186 -K_REINDEX=187 -K_LENIENT=188 -K_STANDARD=189 -K_ENCRYPTED=190 -K_BIGINT=191 -K_BLOB=192 -K_BOOLEAN=193 -K_COUNTER=194 -K_DATE=195 -K_DECIMAL=196 -K_DOUBLE=197 -K_FLOAT=198 -K_FROZEN=199 -K_INET=200 -K_INT=201 -K_LIST=202 -K_MAP=203 -K_SMALLINT=204 -K_TEXT=205 -K_TIMEUUID=206 -K_TIME=207 -K_TINYINT=208 -K_TUPLE=209 -K_VARCHAR=210 -K_VARINT=211 -CODE_BLOCK=212 -STRING_LITERAL=213 -DECIMAL_LITERAL=214 -FLOAT_LITERAL=215 -HEXADECIMAL_LITERAL=216 -REAL_LITERAL=217 -OBJECT_NAME=218 -UUID=219 -OPERATOR_EQ=220 -OPERATOR_LT=221 -OPERATOR_GT=222 -OPERATOR_LTE=223 -OPERATOR_GTE=224 -K_USERS=225 -K_VECTOR=226 -'('=1 -')'=2 -'{'=3 -'}'=4 -'['=5 -']'=6 -','=7 -';'=8 -':'=9 -'.'=14 -'*'=15 -'/'=16 -'%'=17 -'+'=18 -'--'=19 -'-'=20 -'"'=21 -'\''=22 diff --git a/reverse_engineering/parser/CqlParser.interp b/reverse_engineering/parser/CqlParser.interp deleted file mode 100644 index 7ee6f4a6..00000000 --- a/reverse_engineering/parser/CqlParser.interp +++ /dev/null @@ -1,807 +0,0 @@ -token literal names: -null -'(' -')' -'{' -'}' -'[' -']' -',' -';' -':' -null -null -null -null -'.' -'*' -'/' -'%' -'+' -'--' -'-' -'"' -'\'' -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null -null - -token symbolic names: -null -LR_BRACKET -RR_BRACKET -LC_BRACKET -RC_BRACKET -LS_BRACKET -RS_BRACKET -COMMA -SEMI -COLON -SPACE -SPEC_MYSQL_COMMENT -COMMENT_INPUT -LINE_COMMENT -DOT -STAR -DIVIDE -MODULE -PLUS -MINUSMINUS -MINUS -DQUOTE -SQUOTE -K_ADD -K_AGGREGATE -K_ALL -K_ALLOW -K_ALTER -K_AND -K_ANY -K_APPLY -K_AS -K_ASC -K_AUTHORIZE -K_BATCH -K_BEGIN -K_BY -K_CALLED -K_CLUSTERING -K_COLUMNFAMILY -K_COMPACT -K_CONSISTENCY -K_CONTAINS -K_CREATE -K_CUSTOM -K_SEARCH -K_DELETE -K_DESC -K_DESCRIBE -K_DISTINCT -K_DROP -K_DURABLE_WRITES -K_EACH_QUORUM -K_ENTRIES -K_EXECUTE -K_EXISTS -K_FALSE -K_FILTERING -K_FINALFUNC -K_FROM -K_FULL -K_FUNCTION -K_FUNCTIONS -K_GRANT -K_IF -K_IN -K_INDEX -K_INFINITY -K_INITCOND -K_INPUT -K_INSERT -K_INTO -K_IS -K_JSON -K_KEY -K_KEYS -K_KEYSPACE -K_KEYSPACES -K_LANGUAGE -K_LEVEL -K_LIMIT -K_LOCAL_ONE -K_LOCAL_QUORUM -K_LOGGED -K_LOGIN -K_MATERIALIZED -K_MODIFY -K_NAN -K_NORECURSIVE -K_NOSUPERUSER -K_NOT -K_NULL -K_OF -K_ON -K_ONE -K_OPTIONS -K_OR -K_ORDER -K_PARTITION -K_PASSWORD -K_PER -K_PERMISSION -K_PERMISSIONS -K_PRIMARY -K_QUORUM -K_RENAME -K_REPLACE -K_REPLICATION -K_RETURNS -K_REVOKE -K_ROLE -K_ROLES -K_INTERNAL -K_LDAP -K_SCHEME -K_SCHEMA -K_SELECT -K_SET -K_SFUNC -K_STATIC -K_STORAGE -K_STYPE -K_SUPERUSER -K_TABLE -K_THREE -K_TIMESTAMP -K_TO -K_TOKEN -K_TRIGGER -K_TRUE -K_TRUNCATE -K_TTL -K_TWO -K_TYPE -K_UNLOGGED -K_UPDATE -K_USE -K_USER -K_USING -K_UUID -K_VALUES -K_VIEW -K_WHERE -K_WITH -K_WRITETIME -K_ASCII -K_CASE_SENITIVE -K_NORMALIZE -K_SIMILARITY_FUNCTION -K_ANALYZED -K_IS_LITERAL -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB -K_TOKENIZATION_ENABLE_STEMMING -K_TOKENIZATION_SKIP_STOP_WORDS -K_TOKENIZATION_LOCALE -K_TOKENIZATION_NORMALIZE_LOWERCASE -K_TOKENIZATION_NORMALIZE_UPPERCASE -K_NORMALIZE_LOWERCASE -K_NORMALIZE_UPPERCASE -K_MODE -K_ANALYZER_CLASS -K_STORAGE_ATTACHED_INDEX -K_SASI_INDEX -K_SOLR_INDEX -K_SPACE_SAVING_NO_JOIN -K_SPACE_SAVING_ALL -K_SPACE_SAVING_SLOW_TRIE_PRECISION -K_SPACE_SAVING_NO_TEXT_FIELD -K_DOC_VALUES -K_COPY_FIELD -K_EXCLUDED -K_INDEXED -K_LOWERCASE -K_COLUMNS -K_PROFILES -K_CONFIG -K_AUTOCOMMIT_TIME -K_DEFAULT_QUERY_FIELD -K_DIRECTORY_FACTORY -K_FILTER_CACHE_LOW_WATERMARK -K_FILTER_CACHE_HIGH_WATERMARK -K_DIRECTORY_FACTORY_CLASS -K_MERGE_MAX_THREAD_COUNT -K_MERGE_MAX_MERGE_COUNT -K_RAM_BUFFER_SIZE -K_REALTIME -K_RECOVERY -K_REINDEX -K_LENIENT -K_STANDARD -K_ENCRYPTED -K_BIGINT -K_BLOB -K_BOOLEAN -K_COUNTER -K_DATE -K_DECIMAL -K_DOUBLE -K_FLOAT -K_FROZEN -K_INET -K_INT -K_LIST -K_MAP -K_SMALLINT -K_TEXT -K_TIMEUUID -K_TIME -K_TINYINT -K_TUPLE -K_VARCHAR -K_VARINT -CODE_BLOCK -STRING_LITERAL -DECIMAL_LITERAL -FLOAT_LITERAL -HEXADECIMAL_LITERAL -REAL_LITERAL -OBJECT_NAME -UUID -OPERATOR_EQ -OPERATOR_LT -OPERATOR_GT -OPERATOR_LTE -OPERATOR_GTE -K_USERS -K_VECTOR - -rule names: -root -cqls -statementSeparator -empty -cql -revoke -listUsers -listRoles -listPermissions -grant -priviledge -resource -createUser -createRole -createType -typeMemberColumnList -createTrigger -createMaterializedView -materializedViewWhere -columnNotNullList -columnNotNull -materializedViewOptions -createKeyspace -createFunction -codeBlock -paramList -returnMode -createAggregate -initCondDefinition -initCondHash -initCondHashItem -initCondListNested -initCondList -orReplace -alterUser -userPassword -userSuperUser -alterType -alterTypeOperation -alterTypeRename -alterTypeRenameList -alterTypeRenameItem -alterTypeAdd -alterTypeAlterType -alterTable -alterTableOperation -alterTableWith -alterTableRename -alterTableDropCompactStorage -alterTableDropColumns -alterTableDropColumnList -alterTableAdd -alterTableColumnDefinition -alterRole -roleWith -roleWithOptions -alterMaterializedView -dropUser -dropType -dropMaterializedView -dropAggregate -dropFunction -dropTrigger -dropRole -dropTable -dropKeyspace -dropIndex -createTable -withElement -clusteringOrderColumns -clusteringOrder -tableOptions -tableOptionItem -tableOptionName -tableOptionValue -optionHash -optionHashItem -optionHashKey -optionHashValue -columnDefinitionList -columnDefinition -primaryKeyColumn -primaryKeyElement -primaryKeyDefinition -singlePrimaryKey -compoundKey -compositeKey -partitionKeyList -clusteringKeyList -partitionKey -clusteringKey -applyBatch -beginBatch -batchType -alterKeyspace -replicationList -replicationListItem -durableWrites -use -truncate -createIndex -customIndexOption -createSearchIndex -searchIndexConfigs -directoryFactory -searchIndexOptions -searchIndexProfile -searchIndexProfiles -searchIndexColumnList -searchIndexColumn -indexName -indexColumnSpec -indexKeysSpec -indexEntriesSSpec -indexFullSpec -indexValuesSpec -deleteStatement -deleteColumnList -deleteColumnItem -update -ifSpec -ifConditionList -ifCondition -assignments -assignmentElement -assignmentSet -assignmentMap -assignmentMapExpression -assignmentList -assignmentTuple -insert -usingTtlTimestamp -timestamp -ttl -usingTimestampSpec -ifNotExist -ifExist -insertValuesSpec -insertColumnSpec -columnList -expressionList -expression -select -allowFilteringSpec -limitSpec -fromSpec -fromSpecElement -orderSpec -orderSpecElement -whereSpec -distinctSpec -selectElements -selectElement -relationElements -relationElement -relalationContains -relalationContainsKey -functionCall -functionArgs -constant -decimalLiteral -floatLiteral -stringLiteral -booleanLiteral -hexadecimalLiteral -keyspace -table -column -dataType -dataTypeName -dataTypeDefinition -orderDirection -role -trigger -triggerClass -materializedView -type -aggregate -functionStatement -language -user -password -hashKey -param -paramName -kwAdd -kwAggregate -kwAll -kwAllPermissions -kwAllow -kwAlter -kwAnd -kwApply -kwAs -kwAsc -kwAuthorize -kwBatch -kwBegin -kwBy -kwCalled -kwClustering -kwCompact -kwContains -kwCreate -kwDelete -kwDesc -kwDescibe -kwDistinct -kwDrop -kwDurableWrites -kwEntries -kwExecute -kwExists -kwFiltering -kwFinalfunc -kwFrom -kwFull -kwFunction -kwFunctions -kwGrant -kwIf -kwIn -kwIndex -kwCustom -kwSearch -kwAscii -kwNormalize -kwAnalyzed -kwIsLiteral -kwMaxCompactionFlushMemoryInMb -kwTokenizationEnableStemming -kwTokenizationSkipStopWords -kwTokenizationLocale -kwTokenizationNormalizeLowercase -kwTokenizationNormalizeUppercase -kwNormalizeLowercase -kwNormalizeUppercase -kwMode -kwAnalyzerClass -kwStorageAttachedIndex -kwSolrIndex -kwSASIIndex -kwSpaceSavingNoJoin -kwSpaceSavingAll -kwSpaceSavingSlowTriePrecision -kwSpaceSavingNoTextField -kwCopyField -kwDocValues -kwExcluded -kwIndexed -kwLowerCase -kwColumns -kwProfiles -kwConfig -kwAutoCommitTime -kwDefaultQueryField -kwDirectoryFactory -kwFilterCacheLowWaterMark -kwFilterCacheHighWaterMark -kwDirectoryFactoryClass -kwMergeMaxThreadCount -kwMergeMaxMergeCount -kwRamBufferSize -kwRealtime -kwRecovery -kwReindex -kwLenient -kwStandard -kwEncrypted -kwCaseSensitive -kwSimilarityFunction -kwInitcond -kwInput -kwInsert -kwInto -kwIs -kwJson -kwKey -kwKeys -kwKeyspace -kwKeyspaces -kwLanguage -kwLimit -kwList -kwLogged -kwLogin -kwMaterialized -kwModify -kwNosuperuser -kwNorecursive -kwNot -kwNull -kwOf -kwOn -kwOptions -kwOr -kwOrder -kwPassword -kwPrimary -kwRename -kwReplace -kwReplication -kwReturns -kwRole -kwInternal -kwLdap -kwScheme -kwRoles -kwSelect -kwSet -kwSfunc -kwStorage -kwStype -kwSuperuser -kwTable -kwTimestamp -kwTo -kwTrigger -kwTruncate -kwTtl -kwType -kwUnlogged -kwUpdate -kwUse -kwUser -kwUsers -kwUsing -kwValues -kwView -kwWhere -kwWith -kwRevoke -eof -syntaxBracketLr -syntaxBracketRr -syntaxBracketLc -syntaxBracketRc -syntaxBracketLa -syntaxBracketRa -syntaxBracketLs -syntaxBracketRs -syntaxComma -syntaxColon -id - - -atn: -[3, 24715, 42794, 33075, 47597, 16764, 15335, 30598, 22884, 3, 228, 3203, 4, 2, 9, 2, 4, 3, 9, 3, 4, 4, 9, 4, 4, 5, 9, 5, 4, 6, 9, 6, 4, 7, 9, 7, 4, 8, 9, 8, 4, 9, 9, 9, 4, 10, 9, 10, 4, 11, 9, 11, 4, 12, 9, 12, 4, 13, 9, 13, 4, 14, 9, 14, 4, 15, 9, 15, 4, 16, 9, 16, 4, 17, 9, 17, 4, 18, 9, 18, 4, 19, 9, 19, 4, 20, 9, 20, 4, 21, 9, 21, 4, 22, 9, 22, 4, 23, 9, 23, 4, 24, 9, 24, 4, 25, 9, 25, 4, 26, 9, 26, 4, 27, 9, 27, 4, 28, 9, 28, 4, 29, 9, 29, 4, 30, 9, 30, 4, 31, 9, 31, 4, 32, 9, 32, 4, 33, 9, 33, 4, 34, 9, 34, 4, 35, 9, 35, 4, 36, 9, 36, 4, 37, 9, 37, 4, 38, 9, 38, 4, 39, 9, 39, 4, 40, 9, 40, 4, 41, 9, 41, 4, 42, 9, 42, 4, 43, 9, 43, 4, 44, 9, 44, 4, 45, 9, 45, 4, 46, 9, 46, 4, 47, 9, 47, 4, 48, 9, 48, 4, 49, 9, 49, 4, 50, 9, 50, 4, 51, 9, 51, 4, 52, 9, 52, 4, 53, 9, 53, 4, 54, 9, 54, 4, 55, 9, 55, 4, 56, 9, 56, 4, 57, 9, 57, 4, 58, 9, 58, 4, 59, 9, 59, 4, 60, 9, 60, 4, 61, 9, 61, 4, 62, 9, 62, 4, 63, 9, 63, 4, 64, 9, 64, 4, 65, 9, 65, 4, 66, 9, 66, 4, 67, 9, 67, 4, 68, 9, 68, 4, 69, 9, 69, 4, 70, 9, 70, 4, 71, 9, 71, 4, 72, 9, 72, 4, 73, 9, 73, 4, 74, 9, 74, 4, 75, 9, 75, 4, 76, 9, 76, 4, 77, 9, 77, 4, 78, 9, 78, 4, 79, 9, 79, 4, 80, 9, 80, 4, 81, 9, 81, 4, 82, 9, 82, 4, 83, 9, 83, 4, 84, 9, 84, 4, 85, 9, 85, 4, 86, 9, 86, 4, 87, 9, 87, 4, 88, 9, 88, 4, 89, 9, 89, 4, 90, 9, 90, 4, 91, 9, 91, 4, 92, 9, 92, 4, 93, 9, 93, 4, 94, 9, 94, 4, 95, 9, 95, 4, 96, 9, 96, 4, 97, 9, 97, 4, 98, 9, 98, 4, 99, 9, 99, 4, 100, 9, 100, 4, 101, 9, 101, 4, 102, 9, 102, 4, 103, 9, 103, 4, 104, 9, 104, 4, 105, 9, 105, 4, 106, 9, 106, 4, 107, 9, 107, 4, 108, 9, 108, 4, 109, 9, 109, 4, 110, 9, 110, 4, 111, 9, 111, 4, 112, 9, 112, 4, 113, 9, 113, 4, 114, 9, 114, 4, 115, 9, 115, 4, 116, 9, 116, 4, 117, 9, 117, 4, 118, 9, 118, 4, 119, 9, 119, 4, 120, 9, 120, 4, 121, 9, 121, 4, 122, 9, 122, 4, 123, 9, 123, 4, 124, 9, 124, 4, 125, 9, 125, 4, 126, 9, 126, 4, 127, 9, 127, 4, 128, 9, 128, 4, 129, 9, 129, 4, 130, 9, 130, 4, 131, 9, 131, 4, 132, 9, 132, 4, 133, 9, 133, 4, 134, 9, 134, 4, 135, 9, 135, 4, 136, 9, 136, 4, 137, 9, 137, 4, 138, 9, 138, 4, 139, 9, 139, 4, 140, 9, 140, 4, 141, 9, 141, 4, 142, 9, 142, 4, 143, 9, 143, 4, 144, 9, 144, 4, 145, 9, 145, 4, 146, 9, 146, 4, 147, 9, 147, 4, 148, 9, 148, 4, 149, 9, 149, 4, 150, 9, 150, 4, 151, 9, 151, 4, 152, 9, 152, 4, 153, 9, 153, 4, 154, 9, 154, 4, 155, 9, 155, 4, 156, 9, 156, 4, 157, 9, 157, 4, 158, 9, 158, 4, 159, 9, 159, 4, 160, 9, 160, 4, 161, 9, 161, 4, 162, 9, 162, 4, 163, 9, 163, 4, 164, 9, 164, 4, 165, 9, 165, 4, 166, 9, 166, 4, 167, 9, 167, 4, 168, 9, 168, 4, 169, 9, 169, 4, 170, 9, 170, 4, 171, 9, 171, 4, 172, 9, 172, 4, 173, 9, 173, 4, 174, 9, 174, 4, 175, 9, 175, 4, 176, 9, 176, 4, 177, 9, 177, 4, 178, 9, 178, 4, 179, 9, 179, 4, 180, 9, 180, 4, 181, 9, 181, 4, 182, 9, 182, 4, 183, 9, 183, 4, 184, 9, 184, 4, 185, 9, 185, 4, 186, 9, 186, 4, 187, 9, 187, 4, 188, 9, 188, 4, 189, 9, 189, 4, 190, 9, 190, 4, 191, 9, 191, 4, 192, 9, 192, 4, 193, 9, 193, 4, 194, 9, 194, 4, 195, 9, 195, 4, 196, 9, 196, 4, 197, 9, 197, 4, 198, 9, 198, 4, 199, 9, 199, 4, 200, 9, 200, 4, 201, 9, 201, 4, 202, 9, 202, 4, 203, 9, 203, 4, 204, 9, 204, 4, 205, 9, 205, 4, 206, 9, 206, 4, 207, 9, 207, 4, 208, 9, 208, 4, 209, 9, 209, 4, 210, 9, 210, 4, 211, 9, 211, 4, 212, 9, 212, 4, 213, 9, 213, 4, 214, 9, 214, 4, 215, 9, 215, 4, 216, 9, 216, 4, 217, 9, 217, 4, 218, 9, 218, 4, 219, 9, 219, 4, 220, 9, 220, 4, 221, 9, 221, 4, 222, 9, 222, 4, 223, 9, 223, 4, 224, 9, 224, 4, 225, 9, 225, 4, 226, 9, 226, 4, 227, 9, 227, 4, 228, 9, 228, 4, 229, 9, 229, 4, 230, 9, 230, 4, 231, 9, 231, 4, 232, 9, 232, 4, 233, 9, 233, 4, 234, 9, 234, 4, 235, 9, 235, 4, 236, 9, 236, 4, 237, 9, 237, 4, 238, 9, 238, 4, 239, 9, 239, 4, 240, 9, 240, 4, 241, 9, 241, 4, 242, 9, 242, 4, 243, 9, 243, 4, 244, 9, 244, 4, 245, 9, 245, 4, 246, 9, 246, 4, 247, 9, 247, 4, 248, 9, 248, 4, 249, 9, 249, 4, 250, 9, 250, 4, 251, 9, 251, 4, 252, 9, 252, 4, 253, 9, 253, 4, 254, 9, 254, 4, 255, 9, 255, 4, 256, 9, 256, 4, 257, 9, 257, 4, 258, 9, 258, 4, 259, 9, 259, 4, 260, 9, 260, 4, 261, 9, 261, 4, 262, 9, 262, 4, 263, 9, 263, 4, 264, 9, 264, 4, 265, 9, 265, 4, 266, 9, 266, 4, 267, 9, 267, 4, 268, 9, 268, 4, 269, 9, 269, 4, 270, 9, 270, 4, 271, 9, 271, 4, 272, 9, 272, 4, 273, 9, 273, 4, 274, 9, 274, 4, 275, 9, 275, 4, 276, 9, 276, 4, 277, 9, 277, 4, 278, 9, 278, 4, 279, 9, 279, 4, 280, 9, 280, 4, 281, 9, 281, 4, 282, 9, 282, 4, 283, 9, 283, 4, 284, 9, 284, 4, 285, 9, 285, 4, 286, 9, 286, 4, 287, 9, 287, 4, 288, 9, 288, 4, 289, 9, 289, 4, 290, 9, 290, 4, 291, 9, 291, 4, 292, 9, 292, 4, 293, 9, 293, 4, 294, 9, 294, 4, 295, 9, 295, 4, 296, 9, 296, 4, 297, 9, 297, 4, 298, 9, 298, 4, 299, 9, 299, 4, 300, 9, 300, 4, 301, 9, 301, 4, 302, 9, 302, 4, 303, 9, 303, 4, 304, 9, 304, 4, 305, 9, 305, 4, 306, 9, 306, 4, 307, 9, 307, 4, 308, 9, 308, 4, 309, 9, 309, 4, 310, 9, 310, 4, 311, 9, 311, 4, 312, 9, 312, 4, 313, 9, 313, 4, 314, 9, 314, 4, 315, 9, 315, 4, 316, 9, 316, 4, 317, 9, 317, 4, 318, 9, 318, 4, 319, 9, 319, 4, 320, 9, 320, 4, 321, 9, 321, 4, 322, 9, 322, 4, 323, 9, 323, 4, 324, 9, 324, 4, 325, 9, 325, 4, 326, 9, 326, 4, 327, 9, 327, 4, 328, 9, 328, 4, 329, 9, 329, 4, 330, 9, 330, 4, 331, 9, 331, 4, 332, 9, 332, 4, 333, 9, 333, 4, 334, 9, 334, 4, 335, 9, 335, 4, 336, 9, 336, 4, 337, 9, 337, 4, 338, 9, 338, 4, 339, 9, 339, 4, 340, 9, 340, 4, 341, 9, 341, 4, 342, 9, 342, 4, 343, 9, 343, 4, 344, 9, 344, 4, 345, 9, 345, 3, 2, 5, 2, 692, 10, 2, 3, 2, 5, 2, 695, 10, 2, 3, 2, 3, 2, 3, 3, 3, 3, 5, 3, 701, 10, 3, 3, 3, 3, 3, 3, 3, 7, 3, 706, 10, 3, 12, 3, 14, 3, 709, 11, 3, 3, 3, 3, 3, 5, 3, 713, 10, 3, 3, 3, 5, 3, 716, 10, 3, 3, 3, 5, 3, 719, 10, 3, 3, 4, 3, 4, 3, 5, 3, 5, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 3, 6, 5, 6, 763, 10, 6, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 7, 3, 8, 3, 8, 3, 8, 3, 9, 3, 9, 3, 9, 3, 9, 3, 9, 5, 9, 780, 10, 9, 3, 9, 5, 9, 783, 10, 9, 3, 10, 3, 10, 3, 10, 3, 10, 3, 10, 5, 10, 790, 10, 10, 3, 10, 3, 10, 3, 10, 5, 10, 795, 10, 10, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 11, 3, 12, 3, 12, 5, 12, 806, 10, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 3, 12, 5, 12, 816, 10, 12, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 831, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 842, 10, 13, 3, 13, 3, 13, 3, 13, 5, 13, 847, 10, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 3, 13, 5, 13, 858, 10, 13, 3, 13, 3, 13, 5, 13, 862, 10, 13, 3, 14, 3, 14, 3, 14, 5, 14, 867, 10, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 3, 14, 5, 14, 875, 10, 14, 3, 15, 3, 15, 3, 15, 5, 15, 880, 10, 15, 3, 15, 3, 15, 5, 15, 884, 10, 15, 3, 16, 3, 16, 3, 16, 5, 16, 889, 10, 16, 3, 16, 3, 16, 3, 16, 5, 16, 894, 10, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 16, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 3, 17, 7, 17, 907, 10, 17, 12, 17, 14, 17, 910, 11, 17, 3, 18, 3, 18, 3, 18, 5, 18, 915, 10, 18, 3, 18, 3, 18, 3, 18, 5, 18, 920, 10, 18, 3, 18, 3, 18, 3, 18, 3, 18, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 930, 10, 19, 3, 19, 3, 19, 3, 19, 5, 19, 935, 10, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 3, 19, 5, 19, 945, 10, 19, 3, 19, 3, 19, 3, 19, 5, 19, 950, 10, 19, 3, 19, 3, 19, 3, 19, 5, 19, 955, 10, 19, 3, 20, 3, 20, 3, 20, 3, 20, 3, 20, 5, 20, 962, 10, 20, 3, 21, 3, 21, 3, 21, 3, 21, 7, 21, 968, 10, 21, 12, 21, 14, 21, 971, 11, 21, 3, 22, 3, 22, 3, 22, 3, 22, 3, 22, 3, 23, 3, 23, 3, 24, 3, 24, 3, 24, 5, 24, 983, 10, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 3, 24, 5, 24, 995, 10, 24, 3, 25, 3, 25, 5, 25, 999, 10, 25, 3, 25, 3, 25, 5, 25, 1003, 10, 25, 3, 25, 3, 25, 3, 25, 5, 25, 1008, 10, 25, 3, 25, 3, 25, 3, 25, 5, 25, 1013, 10, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 25, 3, 26, 3, 26, 3, 27, 3, 27, 3, 27, 3, 27, 7, 27, 1030, 10, 27, 12, 27, 14, 27, 1033, 11, 27, 3, 28, 3, 28, 3, 28, 3, 28, 5, 28, 1039, 10, 28, 3, 28, 3, 28, 3, 28, 3, 28, 3, 29, 3, 29, 5, 29, 1047, 10, 29, 3, 29, 3, 29, 5, 29, 1051, 10, 29, 3, 29, 3, 29, 3, 29, 5, 29, 1056, 10, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 29, 3, 30, 3, 30, 3, 30, 3, 30, 5, 30, 1075, 10, 30, 3, 31, 3, 31, 3, 31, 3, 31, 3, 31, 7, 31, 1082, 10, 31, 12, 31, 14, 31, 1085, 11, 31, 3, 31, 3, 31, 3, 32, 3, 32, 3, 32, 3, 32, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 3, 33, 7, 33, 1099, 10, 33, 12, 33, 14, 33, 1102, 11, 33, 3, 33, 3, 33, 3, 34, 3, 34, 3, 34, 3, 34, 3, 34, 7, 34, 1111, 10, 34, 12, 34, 14, 34, 1114, 11, 34, 3, 34, 3, 34, 3, 35, 3, 35, 3, 35, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 3, 36, 5, 36, 1127, 10, 36, 3, 37, 3, 37, 3, 37, 3, 38, 3, 38, 5, 38, 1134, 10, 38, 3, 39, 3, 39, 3, 39, 3, 39, 3, 39, 5, 39, 1141, 10, 39, 3, 39, 3, 39, 3, 39, 3, 40, 3, 40, 3, 40, 5, 40, 1149, 10, 40, 3, 41, 3, 41, 3, 41, 3, 42, 3, 42, 3, 42, 3, 42, 7, 42, 1158, 10, 42, 12, 42, 14, 42, 1161, 11, 42, 3, 43, 3, 43, 3, 43, 3, 43, 3, 44, 3, 44, 3, 44, 3, 45, 3, 45, 3, 45, 3, 45, 3, 45, 3, 46, 3, 46, 3, 46, 3, 46, 3, 46, 5, 46, 1180, 10, 46, 3, 46, 3, 46, 3, 46, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 3, 47, 5, 47, 1191, 10, 47, 3, 48, 3, 48, 3, 48, 3, 49, 3, 49, 3, 49, 3, 49, 3, 49, 3, 50, 3, 50, 3, 50, 3, 50, 3, 51, 3, 51, 3, 51, 3, 52, 3, 52, 3, 52, 3, 52, 7, 52, 1212, 10, 52, 12, 52, 14, 52, 1215, 11, 52, 3, 53, 3, 53, 3, 53, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 3, 54, 7, 54, 1226, 10, 54, 12, 54, 14, 54, 1229, 11, 54, 3, 55, 3, 55, 3, 55, 3, 55, 5, 55, 1235, 10, 55, 3, 56, 3, 56, 3, 56, 3, 56, 3, 56, 7, 56, 1242, 10, 56, 12, 56, 14, 56, 1245, 11, 56, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 3, 57, 5, 57, 1263, 10, 57, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 3, 58, 5, 58, 1271, 10, 58, 3, 58, 3, 58, 3, 58, 3, 58, 5, 58, 1277, 10, 58, 3, 59, 3, 59, 3, 59, 5, 59, 1282, 10, 59, 3, 59, 3, 59, 3, 60, 3, 60, 3, 60, 5, 60, 1289, 10, 60, 3, 60, 3, 60, 3, 60, 5, 60, 1294, 10, 60, 3, 60, 3, 60, 3, 61, 3, 61, 3, 61, 3, 61, 5, 61, 1302, 10, 61, 3, 61, 3, 61, 3, 61, 5, 61, 1307, 10, 61, 3, 61, 3, 61, 3, 62, 3, 62, 3, 62, 5, 62, 1314, 10, 62, 3, 62, 3, 62, 3, 62, 5, 62, 1319, 10, 62, 3, 62, 3, 62, 3, 63, 3, 63, 3, 63, 5, 63, 1326, 10, 63, 3, 63, 3, 63, 3, 63, 5, 63, 1331, 10, 63, 3, 63, 3, 63, 3, 64, 3, 64, 3, 64, 5, 64, 1338, 10, 64, 3, 64, 3, 64, 3, 64, 3, 64, 3, 64, 5, 64, 1345, 10, 64, 3, 64, 3, 64, 3, 65, 3, 65, 3, 65, 5, 65, 1352, 10, 65, 3, 65, 3, 65, 3, 66, 3, 66, 3, 66, 5, 66, 1359, 10, 66, 3, 66, 3, 66, 3, 66, 5, 66, 1364, 10, 66, 3, 66, 3, 66, 3, 67, 3, 67, 3, 67, 5, 67, 1371, 10, 67, 3, 67, 3, 67, 3, 68, 3, 68, 3, 68, 5, 68, 1378, 10, 68, 3, 68, 3, 68, 3, 68, 5, 68, 1383, 10, 68, 3, 68, 3, 68, 3, 69, 3, 69, 3, 69, 5, 69, 1390, 10, 69, 3, 69, 3, 69, 3, 69, 5, 69, 1395, 10, 69, 3, 69, 3, 69, 3, 69, 3, 69, 3, 69, 5, 69, 1402, 10, 69, 3, 70, 3, 70, 5, 70, 1406, 10, 70, 3, 71, 3, 71, 5, 71, 1410, 10, 71, 3, 71, 3, 71, 3, 71, 5, 71, 1415, 10, 71, 7, 71, 1417, 10, 71, 12, 71, 14, 71, 1420, 11, 71, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 72, 3, 73, 3, 73, 3, 73, 3, 73, 7, 73, 1433, 10, 73, 12, 73, 14, 73, 1436, 11, 73, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 3, 74, 5, 74, 1447, 10, 74, 3, 75, 3, 75, 3, 76, 3, 76, 3, 76, 5, 76, 1454, 10, 76, 3, 77, 3, 77, 3, 77, 3, 77, 3, 77, 7, 77, 1461, 10, 77, 12, 77, 14, 77, 1464, 11, 77, 3, 77, 3, 77, 3, 78, 3, 78, 3, 78, 3, 78, 3, 79, 3, 79, 3, 80, 3, 80, 3, 80, 5, 80, 1477, 10, 80, 3, 81, 3, 81, 3, 81, 3, 81, 7, 81, 1483, 10, 81, 12, 81, 14, 81, 1486, 11, 81, 3, 81, 3, 81, 3, 81, 5, 81, 1491, 10, 81, 3, 82, 3, 82, 3, 82, 5, 82, 1496, 10, 82, 3, 83, 3, 83, 3, 83, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 84, 3, 85, 3, 85, 3, 85, 5, 85, 1510, 10, 85, 3, 86, 3, 86, 3, 87, 3, 87, 3, 87, 3, 87, 5, 87, 1518, 10, 87, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 3, 88, 5, 88, 1526, 10, 88, 3, 89, 3, 89, 3, 89, 3, 89, 7, 89, 1532, 10, 89, 12, 89, 14, 89, 1535, 11, 89, 3, 90, 3, 90, 3, 90, 3, 90, 7, 90, 1541, 10, 90, 12, 90, 14, 90, 1544, 11, 90, 3, 91, 3, 91, 3, 92, 3, 92, 3, 93, 3, 93, 3, 93, 3, 94, 3, 94, 5, 94, 1555, 10, 94, 3, 94, 3, 94, 5, 94, 1559, 10, 94, 3, 95, 3, 95, 5, 95, 1563, 10, 95, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 3, 96, 5, 96, 1577, 10, 96, 3, 97, 3, 97, 3, 97, 3, 97, 7, 97, 1583, 10, 97, 12, 97, 14, 97, 1586, 11, 97, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 3, 98, 5, 98, 1594, 10, 98, 3, 99, 3, 99, 3, 99, 3, 99, 3, 100, 3, 100, 3, 100, 3, 101, 3, 101, 5, 101, 1605, 10, 101, 3, 101, 3, 101, 3, 101, 5, 101, 1610, 10, 101, 3, 101, 3, 101, 3, 102, 3, 102, 3, 102, 5, 102, 1617, 10, 102, 3, 102, 5, 102, 1620, 10, 102, 3, 102, 3, 102, 3, 102, 3, 102, 5, 102, 1626, 10, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 5, 102, 1637, 10, 102, 3, 102, 5, 102, 1640, 10, 102, 3, 102, 3, 102, 3, 102, 3, 102, 5, 102, 1646, 10, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 5, 102, 1656, 10, 102, 3, 102, 3, 102, 3, 102, 3, 102, 3, 102, 6, 102, 1663, 10, 102, 13, 102, 14, 102, 1664, 3, 102, 3, 102, 5, 102, 1669, 10, 102, 5, 102, 1671, 10, 102, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1677, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1683, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1689, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1695, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1701, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1707, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1713, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1719, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1725, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1731, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1737, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1743, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1749, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1755, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1761, 10, 103, 3, 103, 3, 103, 3, 103, 3, 103, 5, 103, 1767, 10, 103, 5, 103, 1769, 10, 103, 3, 104, 3, 104, 3, 104, 3, 104, 5, 104, 1775, 10, 104, 3, 104, 3, 104, 3, 104, 3, 104, 5, 104, 1781, 10, 104, 3, 104, 3, 104, 3, 104, 3, 104, 3, 104, 5, 104, 1788, 10, 104, 3, 104, 5, 104, 1791, 10, 104, 3, 104, 3, 104, 3, 104, 5, 104, 1796, 10, 104, 3, 104, 5, 104, 1799, 10, 104, 3, 104, 5, 104, 1802, 10, 104, 3, 104, 5, 104, 1805, 10, 104, 3, 104, 5, 104, 1808, 10, 104, 5, 104, 1810, 10, 104, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1818, 10, 105, 3, 105, 5, 105, 1821, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1827, 10, 105, 3, 105, 5, 105, 1830, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1836, 10, 105, 3, 105, 5, 105, 1839, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1845, 10, 105, 3, 105, 5, 105, 1848, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1854, 10, 105, 3, 105, 5, 105, 1857, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1863, 10, 105, 3, 105, 5, 105, 1866, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1872, 10, 105, 3, 105, 5, 105, 1875, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1881, 10, 105, 3, 105, 5, 105, 1884, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1890, 10, 105, 3, 105, 5, 105, 1893, 10, 105, 3, 105, 3, 105, 3, 105, 3, 105, 5, 105, 1899, 10, 105, 3, 105, 3, 105, 3, 106, 3, 106, 5, 106, 1905, 10, 106, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 3, 107, 5, 107, 1913, 10, 107, 3, 107, 5, 107, 1916, 10, 107, 3, 107, 3, 107, 3, 107, 3, 107, 5, 107, 1922, 10, 107, 3, 107, 5, 107, 1925, 10, 107, 3, 107, 3, 107, 3, 107, 3, 107, 5, 107, 1931, 10, 107, 3, 107, 3, 107, 3, 108, 3, 108, 3, 108, 3, 108, 5, 108, 1939, 10, 108, 3, 109, 3, 109, 3, 109, 3, 109, 7, 109, 1945, 10, 109, 12, 109, 14, 109, 1948, 11, 109, 3, 110, 3, 110, 3, 110, 3, 110, 7, 110, 1954, 10, 110, 12, 110, 14, 110, 1957, 11, 110, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 1965, 10, 111, 3, 111, 5, 111, 1968, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 1974, 10, 111, 3, 111, 5, 111, 1977, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 1983, 10, 111, 3, 111, 5, 111, 1986, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 1992, 10, 111, 3, 111, 5, 111, 1995, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2001, 10, 111, 3, 111, 5, 111, 2004, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2012, 10, 111, 3, 111, 5, 111, 2015, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2021, 10, 111, 3, 111, 5, 111, 2024, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2030, 10, 111, 3, 111, 5, 111, 2033, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2039, 10, 111, 3, 111, 5, 111, 2042, 10, 111, 3, 111, 3, 111, 3, 111, 3, 111, 5, 111, 2048, 10, 111, 3, 111, 5, 111, 2051, 10, 111, 5, 111, 2053, 10, 111, 3, 112, 3, 112, 5, 112, 2057, 10, 112, 3, 113, 3, 113, 3, 113, 3, 113, 3, 113, 5, 113, 2064, 10, 113, 3, 114, 3, 114, 3, 114, 3, 114, 3, 114, 3, 115, 3, 115, 3, 115, 3, 115, 3, 115, 3, 116, 3, 116, 3, 116, 3, 116, 3, 116, 3, 117, 3, 117, 3, 117, 3, 117, 3, 117, 3, 118, 5, 118, 2087, 10, 118, 3, 118, 3, 118, 5, 118, 2091, 10, 118, 3, 118, 3, 118, 5, 118, 2095, 10, 118, 3, 118, 3, 118, 3, 118, 5, 118, 2100, 10, 118, 3, 119, 3, 119, 3, 119, 3, 119, 7, 119, 2106, 10, 119, 12, 119, 14, 119, 2109, 11, 119, 3, 120, 3, 120, 3, 120, 3, 120, 3, 120, 5, 120, 2116, 10, 120, 3, 120, 3, 120, 5, 120, 2120, 10, 120, 3, 121, 5, 121, 2123, 10, 121, 3, 121, 3, 121, 3, 121, 3, 121, 5, 121, 2129, 10, 121, 3, 121, 3, 121, 5, 121, 2133, 10, 121, 3, 121, 3, 121, 3, 121, 3, 121, 3, 121, 5, 121, 2140, 10, 121, 3, 122, 3, 122, 3, 122, 3, 123, 3, 123, 3, 123, 3, 123, 7, 123, 2149, 10, 123, 12, 123, 14, 123, 2152, 11, 123, 3, 124, 3, 124, 3, 124, 3, 124, 3, 125, 3, 125, 3, 125, 3, 125, 7, 125, 2162, 10, 125, 12, 125, 14, 125, 2165, 11, 125, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 5, 126, 2173, 10, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 3, 126, 5, 126, 2224, 10, 126, 3, 127, 3, 127, 3, 127, 3, 127, 3, 127, 7, 127, 2231, 10, 127, 12, 127, 14, 127, 2234, 11, 127, 5, 127, 2236, 10, 127, 3, 127, 3, 127, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 3, 128, 7, 128, 2250, 10, 128, 12, 128, 14, 128, 2253, 11, 128, 3, 128, 3, 128, 3, 129, 3, 129, 3, 129, 3, 129, 3, 129, 7, 129, 2262, 10, 129, 12, 129, 14, 129, 2265, 11, 129, 3, 129, 3, 129, 3, 130, 3, 130, 3, 130, 3, 130, 3, 130, 7, 130, 2274, 10, 130, 12, 130, 14, 130, 2277, 11, 130, 3, 130, 3, 130, 3, 131, 3, 131, 3, 131, 3, 131, 3, 131, 7, 131, 2286, 10, 131, 12, 131, 14, 131, 2289, 11, 131, 3, 131, 3, 131, 3, 131, 7, 131, 2294, 10, 131, 12, 131, 14, 131, 2297, 11, 131, 5, 131, 2299, 10, 131, 3, 131, 3, 131, 3, 131, 3, 131, 7, 131, 2305, 10, 131, 12, 131, 14, 131, 2308, 11, 131, 5, 131, 2310, 10, 131, 3, 131, 3, 131, 3, 132, 5, 132, 2315, 10, 132, 3, 132, 3, 132, 3, 132, 3, 132, 3, 132, 5, 132, 2322, 10, 132, 3, 132, 3, 132, 5, 132, 2326, 10, 132, 3, 132, 3, 132, 5, 132, 2330, 10, 132, 3, 132, 5, 132, 2333, 10, 132, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 3, 133, 5, 133, 2351, 10, 133, 3, 134, 3, 134, 3, 134, 3, 135, 3, 135, 3, 135, 3, 136, 3, 136, 3, 136, 3, 137, 3, 137, 3, 137, 3, 137, 3, 138, 3, 138, 3, 138, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 3, 139, 5, 139, 2377, 10, 139, 3, 140, 3, 140, 3, 140, 3, 140, 3, 141, 3, 141, 3, 141, 3, 141, 7, 141, 2387, 10, 141, 12, 141, 14, 141, 2390, 11, 141, 3, 142, 3, 142, 3, 142, 3, 142, 7, 142, 2396, 10, 142, 12, 142, 14, 142, 2399, 11, 142, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 3, 143, 5, 143, 2407, 10, 143, 3, 144, 3, 144, 5, 144, 2411, 10, 144, 3, 144, 5, 144, 2414, 10, 144, 3, 144, 3, 144, 3, 144, 5, 144, 2419, 10, 144, 3, 144, 5, 144, 2422, 10, 144, 3, 144, 5, 144, 2425, 10, 144, 3, 144, 5, 144, 2428, 10, 144, 3, 145, 3, 145, 3, 145, 3, 146, 3, 146, 3, 146, 3, 147, 3, 147, 3, 147, 3, 148, 3, 148, 3, 148, 3, 148, 3, 148, 5, 148, 2444, 10, 148, 3, 149, 3, 149, 3, 149, 3, 149, 3, 150, 3, 150, 3, 150, 5, 150, 2453, 10, 150, 3, 151, 3, 151, 3, 151, 3, 152, 3, 152, 3, 153, 3, 153, 5, 153, 2462, 10, 153, 3, 153, 3, 153, 3, 153, 7, 153, 2467, 10, 153, 12, 153, 14, 153, 2470, 11, 153, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 3, 154, 5, 154, 2480, 10, 154, 3, 154, 3, 154, 3, 154, 3, 154, 5, 154, 2486, 10, 154, 5, 154, 2488, 10, 154, 3, 155, 3, 155, 3, 155, 3, 155, 7, 155, 2494, 10, 155, 12, 155, 14, 155, 2497, 11, 155, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 5, 156, 2521, 10, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 7, 156, 2530, 10, 156, 12, 156, 14, 156, 2533, 11, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 7, 156, 2542, 10, 156, 12, 156, 14, 156, 2545, 11, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 7, 156, 2554, 10, 156, 12, 156, 14, 156, 2557, 11, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 3, 156, 7, 156, 2565, 10, 156, 12, 156, 14, 156, 2568, 11, 156, 3, 156, 3, 156, 5, 156, 2572, 10, 156, 3, 157, 3, 157, 3, 157, 3, 157, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 158, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 3, 159, 5, 159, 2592, 10, 159, 3, 159, 3, 159, 5, 159, 2596, 10, 159, 3, 160, 3, 160, 3, 160, 5, 160, 2601, 10, 160, 3, 160, 3, 160, 3, 160, 3, 160, 5, 160, 2607, 10, 160, 7, 160, 2609, 10, 160, 12, 160, 14, 160, 2612, 11, 160, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 3, 161, 5, 161, 2623, 10, 161, 3, 162, 3, 162, 3, 163, 3, 163, 3, 164, 3, 164, 3, 165, 3, 165, 3, 166, 3, 166, 3, 167, 3, 167, 3, 167, 3, 167, 3, 167, 5, 167, 2640, 10, 167, 3, 168, 3, 168, 3, 168, 3, 168, 3, 168, 5, 168, 2647, 10, 168, 3, 169, 3, 169, 3, 169, 3, 169, 3, 169, 5, 169, 2654, 10, 169, 3, 170, 3, 170, 5, 170, 2658, 10, 170, 3, 171, 3, 171, 3, 171, 5, 171, 2663, 10, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 3, 171, 5, 171, 2694, 10, 171, 3, 172, 3, 172, 3, 172, 3, 172, 3, 172, 5, 172, 2701, 10, 172, 7, 172, 2703, 10, 172, 12, 172, 14, 172, 2706, 11, 172, 3, 172, 3, 172, 3, 173, 3, 173, 5, 173, 2712, 10, 173, 3, 174, 3, 174, 3, 175, 3, 175, 3, 176, 3, 176, 3, 177, 3, 177, 3, 178, 3, 178, 3, 179, 3, 179, 3, 180, 3, 180, 3, 181, 3, 181, 3, 182, 3, 182, 3, 183, 3, 183, 3, 184, 3, 184, 3, 185, 3, 185, 3, 185, 3, 186, 3, 186, 3, 187, 3, 187, 3, 188, 3, 188, 3, 189, 3, 189, 3, 190, 3, 190, 3, 190, 3, 191, 3, 191, 3, 192, 3, 192, 3, 193, 3, 193, 3, 194, 3, 194, 3, 195, 3, 195, 3, 196, 3, 196, 3, 197, 3, 197, 3, 198, 3, 198, 3, 199, 3, 199, 3, 200, 3, 200, 3, 201, 3, 201, 3, 202, 3, 202, 3, 203, 3, 203, 3, 204, 3, 204, 3, 205, 3, 205, 3, 206, 3, 206, 3, 207, 3, 207, 3, 208, 3, 208, 3, 209, 3, 209, 3, 210, 3, 210, 3, 211, 3, 211, 3, 212, 3, 212, 3, 213, 3, 213, 3, 214, 3, 214, 3, 215, 3, 215, 3, 216, 3, 216, 3, 217, 3, 217, 3, 218, 3, 218, 3, 219, 3, 219, 3, 220, 3, 220, 3, 221, 3, 221, 3, 222, 3, 222, 3, 223, 3, 223, 3, 224, 3, 224, 3, 225, 3, 225, 3, 226, 3, 226, 3, 227, 3, 227, 3, 228, 3, 228, 3, 229, 3, 229, 3, 230, 3, 230, 3, 231, 3, 231, 3, 232, 3, 232, 3, 233, 3, 233, 3, 234, 3, 234, 3, 235, 3, 235, 3, 236, 3, 236, 3, 237, 3, 237, 3, 238, 3, 238, 3, 239, 3, 239, 3, 240, 3, 240, 3, 241, 3, 241, 3, 242, 3, 242, 3, 243, 3, 243, 3, 244, 3, 244, 3, 245, 3, 245, 3, 246, 3, 246, 3, 247, 3, 247, 3, 248, 3, 248, 3, 249, 3, 249, 3, 250, 3, 250, 3, 251, 3, 251, 3, 252, 3, 252, 3, 253, 3, 253, 3, 254, 3, 254, 3, 255, 3, 255, 3, 256, 3, 256, 3, 257, 3, 257, 3, 258, 3, 258, 3, 259, 3, 259, 3, 260, 3, 260, 3, 261, 3, 261, 3, 262, 3, 262, 3, 263, 3, 263, 3, 264, 3, 264, 3, 265, 3, 265, 3, 266, 3, 266, 3, 267, 3, 267, 3, 268, 3, 268, 3, 269, 3, 269, 3, 270, 3, 270, 3, 271, 3, 271, 3, 272, 3, 272, 3, 273, 3, 273, 3, 274, 3, 274, 3, 275, 3, 275, 3, 276, 3, 276, 3, 277, 3, 277, 3, 278, 3, 278, 3, 279, 3, 279, 3, 280, 3, 280, 3, 281, 3, 281, 3, 282, 3, 282, 3, 283, 3, 283, 3, 284, 3, 284, 3, 285, 3, 285, 3, 286, 3, 286, 3, 287, 3, 287, 3, 288, 3, 288, 3, 289, 3, 289, 3, 290, 3, 290, 3, 291, 3, 291, 3, 292, 3, 292, 3, 293, 3, 293, 3, 294, 3, 294, 3, 295, 3, 295, 3, 296, 3, 296, 3, 297, 3, 297, 3, 298, 3, 298, 3, 299, 3, 299, 3, 300, 3, 300, 3, 301, 3, 301, 3, 302, 3, 302, 3, 303, 3, 303, 3, 304, 3, 304, 3, 305, 3, 305, 3, 306, 3, 306, 3, 307, 3, 307, 3, 308, 3, 308, 3, 309, 3, 309, 3, 310, 3, 310, 3, 311, 3, 311, 3, 312, 3, 312, 3, 313, 3, 313, 3, 314, 3, 314, 3, 315, 3, 315, 3, 316, 3, 316, 3, 317, 3, 317, 3, 318, 3, 318, 3, 319, 3, 319, 3, 320, 3, 320, 3, 321, 3, 321, 3, 322, 3, 322, 3, 323, 3, 323, 3, 324, 3, 324, 3, 325, 3, 325, 3, 326, 3, 326, 3, 327, 3, 327, 3, 328, 3, 328, 3, 329, 3, 329, 3, 330, 3, 330, 3, 331, 3, 331, 3, 332, 3, 332, 3, 333, 3, 333, 3, 334, 3, 334, 3, 335, 3, 335, 3, 336, 3, 336, 3, 337, 3, 337, 3, 338, 3, 338, 3, 339, 3, 339, 3, 340, 3, 340, 3, 341, 3, 341, 3, 342, 3, 342, 3, 343, 3, 343, 3, 344, 3, 344, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 3, 345, 5, 345, 3201, 10, 345, 3, 345, 2, 2, 346, 2, 4, 6, 8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42, 44, 46, 48, 50, 52, 54, 56, 58, 60, 62, 64, 66, 68, 70, 72, 74, 76, 78, 80, 82, 84, 86, 88, 90, 92, 94, 96, 98, 100, 102, 104, 106, 108, 110, 112, 114, 116, 118, 120, 122, 124, 126, 128, 130, 132, 134, 136, 138, 140, 142, 144, 146, 148, 150, 152, 154, 156, 158, 160, 162, 164, 166, 168, 170, 172, 174, 176, 178, 180, 182, 184, 186, 188, 190, 192, 194, 196, 198, 200, 202, 204, 206, 208, 210, 212, 214, 216, 218, 220, 222, 224, 226, 228, 230, 232, 234, 236, 238, 240, 242, 244, 246, 248, 250, 252, 254, 256, 258, 260, 262, 264, 266, 268, 270, 272, 274, 276, 278, 280, 282, 284, 286, 288, 290, 292, 294, 296, 298, 300, 302, 304, 306, 308, 310, 312, 314, 316, 318, 320, 322, 324, 326, 328, 330, 332, 334, 336, 338, 340, 342, 344, 346, 348, 350, 352, 354, 356, 358, 360, 362, 364, 366, 368, 370, 372, 374, 376, 378, 380, 382, 384, 386, 388, 390, 392, 394, 396, 398, 400, 402, 404, 406, 408, 410, 412, 414, 416, 418, 420, 422, 424, 426, 428, 430, 432, 434, 436, 438, 440, 442, 444, 446, 448, 450, 452, 454, 456, 458, 460, 462, 464, 466, 468, 470, 472, 474, 476, 478, 480, 482, 484, 486, 488, 490, 492, 494, 496, 498, 500, 502, 504, 506, 508, 510, 512, 514, 516, 518, 520, 522, 524, 526, 528, 530, 532, 534, 536, 538, 540, 542, 544, 546, 548, 550, 552, 554, 556, 558, 560, 562, 564, 566, 568, 570, 572, 574, 576, 578, 580, 582, 584, 586, 588, 590, 592, 594, 596, 598, 600, 602, 604, 606, 608, 610, 612, 614, 616, 618, 620, 622, 624, 626, 628, 630, 632, 634, 636, 638, 640, 642, 644, 646, 648, 650, 652, 654, 656, 658, 660, 662, 664, 666, 668, 670, 672, 674, 676, 678, 680, 682, 684, 686, 688, 2, 7, 3, 2, 214, 215, 4, 2, 20, 20, 22, 22, 3, 2, 222, 226, 3, 2, 216, 217, 4, 2, 58, 58, 131, 131, 2, 3414, 2, 691, 3, 2, 2, 2, 4, 707, 3, 2, 2, 2, 6, 720, 3, 2, 2, 2, 8, 722, 3, 2, 2, 2, 10, 762, 3, 2, 2, 2, 12, 764, 3, 2, 2, 2, 14, 771, 3, 2, 2, 2, 16, 774, 3, 2, 2, 2, 18, 784, 3, 2, 2, 2, 20, 796, 3, 2, 2, 2, 22, 815, 3, 2, 2, 2, 24, 861, 3, 2, 2, 2, 26, 863, 3, 2, 2, 2, 28, 876, 3, 2, 2, 2, 30, 885, 3, 2, 2, 2, 32, 900, 3, 2, 2, 2, 34, 911, 3, 2, 2, 2, 36, 925, 3, 2, 2, 2, 38, 956, 3, 2, 2, 2, 40, 963, 3, 2, 2, 2, 42, 972, 3, 2, 2, 2, 44, 977, 3, 2, 2, 2, 46, 979, 3, 2, 2, 2, 48, 996, 3, 2, 2, 2, 50, 1023, 3, 2, 2, 2, 52, 1025, 3, 2, 2, 2, 54, 1038, 3, 2, 2, 2, 56, 1044, 3, 2, 2, 2, 58, 1074, 3, 2, 2, 2, 60, 1076, 3, 2, 2, 2, 62, 1088, 3, 2, 2, 2, 64, 1092, 3, 2, 2, 2, 66, 1105, 3, 2, 2, 2, 68, 1117, 3, 2, 2, 2, 70, 1120, 3, 2, 2, 2, 72, 1128, 3, 2, 2, 2, 74, 1133, 3, 2, 2, 2, 76, 1135, 3, 2, 2, 2, 78, 1148, 3, 2, 2, 2, 80, 1150, 3, 2, 2, 2, 82, 1153, 3, 2, 2, 2, 84, 1162, 3, 2, 2, 2, 86, 1166, 3, 2, 2, 2, 88, 1169, 3, 2, 2, 2, 90, 1174, 3, 2, 2, 2, 92, 1190, 3, 2, 2, 2, 94, 1192, 3, 2, 2, 2, 96, 1195, 3, 2, 2, 2, 98, 1200, 3, 2, 2, 2, 100, 1204, 3, 2, 2, 2, 102, 1207, 3, 2, 2, 2, 104, 1216, 3, 2, 2, 2, 106, 1219, 3, 2, 2, 2, 108, 1230, 3, 2, 2, 2, 110, 1236, 3, 2, 2, 2, 112, 1262, 3, 2, 2, 2, 114, 1264, 3, 2, 2, 2, 116, 1278, 3, 2, 2, 2, 118, 1285, 3, 2, 2, 2, 120, 1297, 3, 2, 2, 2, 122, 1310, 3, 2, 2, 2, 124, 1322, 3, 2, 2, 2, 126, 1334, 3, 2, 2, 2, 128, 1348, 3, 2, 2, 2, 130, 1355, 3, 2, 2, 2, 132, 1367, 3, 2, 2, 2, 134, 1374, 3, 2, 2, 2, 136, 1386, 3, 2, 2, 2, 138, 1403, 3, 2, 2, 2, 140, 1407, 3, 2, 2, 2, 142, 1421, 3, 2, 2, 2, 144, 1428, 3, 2, 2, 2, 146, 1446, 3, 2, 2, 2, 148, 1448, 3, 2, 2, 2, 150, 1453, 3, 2, 2, 2, 152, 1455, 3, 2, 2, 2, 154, 1467, 3, 2, 2, 2, 156, 1471, 3, 2, 2, 2, 158, 1476, 3, 2, 2, 2, 160, 1478, 3, 2, 2, 2, 162, 1492, 3, 2, 2, 2, 164, 1497, 3, 2, 2, 2, 166, 1500, 3, 2, 2, 2, 168, 1509, 3, 2, 2, 2, 170, 1511, 3, 2, 2, 2, 172, 1513, 3, 2, 2, 2, 174, 1519, 3, 2, 2, 2, 176, 1527, 3, 2, 2, 2, 178, 1536, 3, 2, 2, 2, 180, 1545, 3, 2, 2, 2, 182, 1547, 3, 2, 2, 2, 184, 1549, 3, 2, 2, 2, 186, 1552, 3, 2, 2, 2, 188, 1562, 3, 2, 2, 2, 190, 1564, 3, 2, 2, 2, 192, 1578, 3, 2, 2, 2, 194, 1593, 3, 2, 2, 2, 196, 1595, 3, 2, 2, 2, 198, 1599, 3, 2, 2, 2, 200, 1602, 3, 2, 2, 2, 202, 1670, 3, 2, 2, 2, 204, 1768, 3, 2, 2, 2, 206, 1770, 3, 2, 2, 2, 208, 1811, 3, 2, 2, 2, 210, 1904, 3, 2, 2, 2, 212, 1906, 3, 2, 2, 2, 214, 1938, 3, 2, 2, 2, 216, 1940, 3, 2, 2, 2, 218, 1949, 3, 2, 2, 2, 220, 2052, 3, 2, 2, 2, 222, 2056, 3, 2, 2, 2, 224, 2063, 3, 2, 2, 2, 226, 2065, 3, 2, 2, 2, 228, 2070, 3, 2, 2, 2, 230, 2075, 3, 2, 2, 2, 232, 2080, 3, 2, 2, 2, 234, 2086, 3, 2, 2, 2, 236, 2101, 3, 2, 2, 2, 238, 2119, 3, 2, 2, 2, 240, 2122, 3, 2, 2, 2, 242, 2141, 3, 2, 2, 2, 244, 2144, 3, 2, 2, 2, 246, 2153, 3, 2, 2, 2, 248, 2157, 3, 2, 2, 2, 250, 2223, 3, 2, 2, 2, 252, 2225, 3, 2, 2, 2, 254, 2239, 3, 2, 2, 2, 256, 2256, 3, 2, 2, 2, 258, 2268, 3, 2, 2, 2, 260, 2280, 3, 2, 2, 2, 262, 2314, 3, 2, 2, 2, 264, 2350, 3, 2, 2, 2, 266, 2352, 3, 2, 2, 2, 268, 2355, 3, 2, 2, 2, 270, 2358, 3, 2, 2, 2, 272, 2361, 3, 2, 2, 2, 274, 2365, 3, 2, 2, 2, 276, 2376, 3, 2, 2, 2, 278, 2378, 3, 2, 2, 2, 280, 2382, 3, 2, 2, 2, 282, 2391, 3, 2, 2, 2, 284, 2406, 3, 2, 2, 2, 286, 2408, 3, 2, 2, 2, 288, 2429, 3, 2, 2, 2, 290, 2432, 3, 2, 2, 2, 292, 2435, 3, 2, 2, 2, 294, 2443, 3, 2, 2, 2, 296, 2445, 3, 2, 2, 2, 298, 2449, 3, 2, 2, 2, 300, 2454, 3, 2, 2, 2, 302, 2457, 3, 2, 2, 2, 304, 2461, 3, 2, 2, 2, 306, 2487, 3, 2, 2, 2, 308, 2489, 3, 2, 2, 2, 310, 2571, 3, 2, 2, 2, 312, 2573, 3, 2, 2, 2, 314, 2577, 3, 2, 2, 2, 316, 2595, 3, 2, 2, 2, 318, 2600, 3, 2, 2, 2, 320, 2622, 3, 2, 2, 2, 322, 2624, 3, 2, 2, 2, 324, 2626, 3, 2, 2, 2, 326, 2628, 3, 2, 2, 2, 328, 2630, 3, 2, 2, 2, 330, 2632, 3, 2, 2, 2, 332, 2639, 3, 2, 2, 2, 334, 2646, 3, 2, 2, 2, 336, 2653, 3, 2, 2, 2, 338, 2655, 3, 2, 2, 2, 340, 2693, 3, 2, 2, 2, 342, 2695, 3, 2, 2, 2, 344, 2711, 3, 2, 2, 2, 346, 2713, 3, 2, 2, 2, 348, 2715, 3, 2, 2, 2, 350, 2717, 3, 2, 2, 2, 352, 2719, 3, 2, 2, 2, 354, 2721, 3, 2, 2, 2, 356, 2723, 3, 2, 2, 2, 358, 2725, 3, 2, 2, 2, 360, 2727, 3, 2, 2, 2, 362, 2729, 3, 2, 2, 2, 364, 2731, 3, 2, 2, 2, 366, 2733, 3, 2, 2, 2, 368, 2735, 3, 2, 2, 2, 370, 2738, 3, 2, 2, 2, 372, 2740, 3, 2, 2, 2, 374, 2742, 3, 2, 2, 2, 376, 2744, 3, 2, 2, 2, 378, 2746, 3, 2, 2, 2, 380, 2749, 3, 2, 2, 2, 382, 2751, 3, 2, 2, 2, 384, 2753, 3, 2, 2, 2, 386, 2755, 3, 2, 2, 2, 388, 2757, 3, 2, 2, 2, 390, 2759, 3, 2, 2, 2, 392, 2761, 3, 2, 2, 2, 394, 2763, 3, 2, 2, 2, 396, 2765, 3, 2, 2, 2, 398, 2767, 3, 2, 2, 2, 400, 2769, 3, 2, 2, 2, 402, 2771, 3, 2, 2, 2, 404, 2773, 3, 2, 2, 2, 406, 2775, 3, 2, 2, 2, 408, 2777, 3, 2, 2, 2, 410, 2779, 3, 2, 2, 2, 412, 2781, 3, 2, 2, 2, 414, 2783, 3, 2, 2, 2, 416, 2785, 3, 2, 2, 2, 418, 2787, 3, 2, 2, 2, 420, 2789, 3, 2, 2, 2, 422, 2791, 3, 2, 2, 2, 424, 2793, 3, 2, 2, 2, 426, 2795, 3, 2, 2, 2, 428, 2797, 3, 2, 2, 2, 430, 2799, 3, 2, 2, 2, 432, 2801, 3, 2, 2, 2, 434, 2803, 3, 2, 2, 2, 436, 2805, 3, 2, 2, 2, 438, 2807, 3, 2, 2, 2, 440, 2809, 3, 2, 2, 2, 442, 2811, 3, 2, 2, 2, 444, 2813, 3, 2, 2, 2, 446, 2815, 3, 2, 2, 2, 448, 2817, 3, 2, 2, 2, 450, 2819, 3, 2, 2, 2, 452, 2821, 3, 2, 2, 2, 454, 2823, 3, 2, 2, 2, 456, 2825, 3, 2, 2, 2, 458, 2827, 3, 2, 2, 2, 460, 2829, 3, 2, 2, 2, 462, 2831, 3, 2, 2, 2, 464, 2833, 3, 2, 2, 2, 466, 2835, 3, 2, 2, 2, 468, 2837, 3, 2, 2, 2, 470, 2839, 3, 2, 2, 2, 472, 2841, 3, 2, 2, 2, 474, 2843, 3, 2, 2, 2, 476, 2845, 3, 2, 2, 2, 478, 2847, 3, 2, 2, 2, 480, 2849, 3, 2, 2, 2, 482, 2851, 3, 2, 2, 2, 484, 2853, 3, 2, 2, 2, 486, 2855, 3, 2, 2, 2, 488, 2857, 3, 2, 2, 2, 490, 2859, 3, 2, 2, 2, 492, 2861, 3, 2, 2, 2, 494, 2863, 3, 2, 2, 2, 496, 2865, 3, 2, 2, 2, 498, 2867, 3, 2, 2, 2, 500, 2869, 3, 2, 2, 2, 502, 2871, 3, 2, 2, 2, 504, 2873, 3, 2, 2, 2, 506, 2875, 3, 2, 2, 2, 508, 2877, 3, 2, 2, 2, 510, 2879, 3, 2, 2, 2, 512, 2881, 3, 2, 2, 2, 514, 2883, 3, 2, 2, 2, 516, 2885, 3, 2, 2, 2, 518, 2887, 3, 2, 2, 2, 520, 2889, 3, 2, 2, 2, 522, 2891, 3, 2, 2, 2, 524, 2893, 3, 2, 2, 2, 526, 2895, 3, 2, 2, 2, 528, 2897, 3, 2, 2, 2, 530, 2899, 3, 2, 2, 2, 532, 2901, 3, 2, 2, 2, 534, 2903, 3, 2, 2, 2, 536, 2905, 3, 2, 2, 2, 538, 2907, 3, 2, 2, 2, 540, 2909, 3, 2, 2, 2, 542, 2911, 3, 2, 2, 2, 544, 2913, 3, 2, 2, 2, 546, 2915, 3, 2, 2, 2, 548, 2917, 3, 2, 2, 2, 550, 2919, 3, 2, 2, 2, 552, 2921, 3, 2, 2, 2, 554, 2923, 3, 2, 2, 2, 556, 2925, 3, 2, 2, 2, 558, 2927, 3, 2, 2, 2, 560, 2929, 3, 2, 2, 2, 562, 2931, 3, 2, 2, 2, 564, 2933, 3, 2, 2, 2, 566, 2935, 3, 2, 2, 2, 568, 2937, 3, 2, 2, 2, 570, 2939, 3, 2, 2, 2, 572, 2941, 3, 2, 2, 2, 574, 2943, 3, 2, 2, 2, 576, 2945, 3, 2, 2, 2, 578, 2947, 3, 2, 2, 2, 580, 2949, 3, 2, 2, 2, 582, 2951, 3, 2, 2, 2, 584, 2953, 3, 2, 2, 2, 586, 2955, 3, 2, 2, 2, 588, 2957, 3, 2, 2, 2, 590, 2959, 3, 2, 2, 2, 592, 2961, 3, 2, 2, 2, 594, 2963, 3, 2, 2, 2, 596, 2965, 3, 2, 2, 2, 598, 2967, 3, 2, 2, 2, 600, 2969, 3, 2, 2, 2, 602, 2971, 3, 2, 2, 2, 604, 2973, 3, 2, 2, 2, 606, 2975, 3, 2, 2, 2, 608, 2977, 3, 2, 2, 2, 610, 2979, 3, 2, 2, 2, 612, 2981, 3, 2, 2, 2, 614, 2983, 3, 2, 2, 2, 616, 2985, 3, 2, 2, 2, 618, 2987, 3, 2, 2, 2, 620, 2989, 3, 2, 2, 2, 622, 2991, 3, 2, 2, 2, 624, 2993, 3, 2, 2, 2, 626, 2995, 3, 2, 2, 2, 628, 2997, 3, 2, 2, 2, 630, 2999, 3, 2, 2, 2, 632, 3001, 3, 2, 2, 2, 634, 3003, 3, 2, 2, 2, 636, 3005, 3, 2, 2, 2, 638, 3007, 3, 2, 2, 2, 640, 3009, 3, 2, 2, 2, 642, 3011, 3, 2, 2, 2, 644, 3013, 3, 2, 2, 2, 646, 3015, 3, 2, 2, 2, 648, 3017, 3, 2, 2, 2, 650, 3019, 3, 2, 2, 2, 652, 3021, 3, 2, 2, 2, 654, 3023, 3, 2, 2, 2, 656, 3025, 3, 2, 2, 2, 658, 3027, 3, 2, 2, 2, 660, 3029, 3, 2, 2, 2, 662, 3031, 3, 2, 2, 2, 664, 3033, 3, 2, 2, 2, 666, 3035, 3, 2, 2, 2, 668, 3037, 3, 2, 2, 2, 670, 3039, 3, 2, 2, 2, 672, 3041, 3, 2, 2, 2, 674, 3043, 3, 2, 2, 2, 676, 3045, 3, 2, 2, 2, 678, 3047, 3, 2, 2, 2, 680, 3049, 3, 2, 2, 2, 682, 3051, 3, 2, 2, 2, 684, 3053, 3, 2, 2, 2, 686, 3055, 3, 2, 2, 2, 688, 3200, 3, 2, 2, 2, 690, 692, 5, 4, 3, 2, 691, 690, 3, 2, 2, 2, 691, 692, 3, 2, 2, 2, 692, 694, 3, 2, 2, 2, 693, 695, 7, 21, 2, 2, 694, 693, 3, 2, 2, 2, 694, 695, 3, 2, 2, 2, 695, 696, 3, 2, 2, 2, 696, 697, 5, 666, 334, 2, 697, 3, 3, 2, 2, 2, 698, 700, 5, 10, 6, 2, 699, 701, 7, 21, 2, 2, 700, 699, 3, 2, 2, 2, 700, 701, 3, 2, 2, 2, 701, 702, 3, 2, 2, 2, 702, 703, 5, 6, 4, 2, 703, 706, 3, 2, 2, 2, 704, 706, 5, 8, 5, 2, 705, 698, 3, 2, 2, 2, 705, 704, 3, 2, 2, 2, 706, 709, 3, 2, 2, 2, 707, 705, 3, 2, 2, 2, 707, 708, 3, 2, 2, 2, 708, 718, 3, 2, 2, 2, 709, 707, 3, 2, 2, 2, 710, 715, 5, 10, 6, 2, 711, 713, 7, 21, 2, 2, 712, 711, 3, 2, 2, 2, 712, 713, 3, 2, 2, 2, 713, 714, 3, 2, 2, 2, 714, 716, 5, 6, 4, 2, 715, 712, 3, 2, 2, 2, 715, 716, 3, 2, 2, 2, 716, 719, 3, 2, 2, 2, 717, 719, 5, 8, 5, 2, 718, 710, 3, 2, 2, 2, 718, 717, 3, 2, 2, 2, 719, 5, 3, 2, 2, 2, 720, 721, 7, 10, 2, 2, 721, 7, 3, 2, 2, 2, 722, 723, 5, 6, 4, 2, 723, 9, 3, 2, 2, 2, 724, 763, 5, 190, 96, 2, 725, 763, 5, 114, 58, 2, 726, 763, 5, 108, 55, 2, 727, 763, 5, 90, 46, 2, 728, 763, 5, 76, 39, 2, 729, 763, 5, 70, 36, 2, 730, 763, 5, 184, 93, 2, 731, 763, 5, 56, 29, 2, 732, 763, 5, 48, 25, 2, 733, 763, 5, 202, 102, 2, 734, 763, 5, 206, 104, 2, 735, 763, 5, 46, 24, 2, 736, 763, 5, 36, 19, 2, 737, 763, 5, 28, 15, 2, 738, 763, 5, 136, 69, 2, 739, 763, 5, 34, 18, 2, 740, 763, 5, 30, 16, 2, 741, 763, 5, 26, 14, 2, 742, 763, 5, 234, 118, 2, 743, 763, 5, 122, 62, 2, 744, 763, 5, 124, 63, 2, 745, 763, 5, 134, 68, 2, 746, 763, 5, 132, 67, 2, 747, 763, 5, 120, 61, 2, 748, 763, 5, 128, 65, 2, 749, 763, 5, 130, 66, 2, 750, 763, 5, 126, 64, 2, 751, 763, 5, 118, 60, 2, 752, 763, 5, 116, 59, 2, 753, 763, 5, 20, 11, 2, 754, 763, 5, 262, 132, 2, 755, 763, 5, 18, 10, 2, 756, 763, 5, 16, 9, 2, 757, 763, 5, 12, 7, 2, 758, 763, 5, 286, 144, 2, 759, 763, 5, 200, 101, 2, 760, 763, 5, 240, 121, 2, 761, 763, 5, 198, 100, 2, 762, 724, 3, 2, 2, 2, 762, 725, 3, 2, 2, 2, 762, 726, 3, 2, 2, 2, 762, 727, 3, 2, 2, 2, 762, 728, 3, 2, 2, 2, 762, 729, 3, 2, 2, 2, 762, 730, 3, 2, 2, 2, 762, 731, 3, 2, 2, 2, 762, 732, 3, 2, 2, 2, 762, 733, 3, 2, 2, 2, 762, 734, 3, 2, 2, 2, 762, 735, 3, 2, 2, 2, 762, 736, 3, 2, 2, 2, 762, 737, 3, 2, 2, 2, 762, 738, 3, 2, 2, 2, 762, 739, 3, 2, 2, 2, 762, 740, 3, 2, 2, 2, 762, 741, 3, 2, 2, 2, 762, 742, 3, 2, 2, 2, 762, 743, 3, 2, 2, 2, 762, 744, 3, 2, 2, 2, 762, 745, 3, 2, 2, 2, 762, 746, 3, 2, 2, 2, 762, 747, 3, 2, 2, 2, 762, 748, 3, 2, 2, 2, 762, 749, 3, 2, 2, 2, 762, 750, 3, 2, 2, 2, 762, 751, 3, 2, 2, 2, 762, 752, 3, 2, 2, 2, 762, 753, 3, 2, 2, 2, 762, 754, 3, 2, 2, 2, 762, 755, 3, 2, 2, 2, 762, 756, 3, 2, 2, 2, 762, 757, 3, 2, 2, 2, 762, 758, 3, 2, 2, 2, 762, 759, 3, 2, 2, 2, 762, 760, 3, 2, 2, 2, 762, 761, 3, 2, 2, 2, 763, 11, 3, 2, 2, 2, 764, 765, 5, 664, 333, 2, 765, 766, 5, 22, 12, 2, 766, 767, 5, 588, 295, 2, 767, 768, 5, 24, 13, 2, 768, 769, 5, 432, 217, 2, 769, 770, 5, 346, 174, 2, 770, 13, 3, 2, 2, 2, 771, 772, 5, 568, 285, 2, 772, 773, 5, 652, 327, 2, 773, 15, 3, 2, 2, 2, 774, 775, 5, 568, 285, 2, 775, 779, 5, 616, 309, 2, 776, 777, 5, 586, 294, 2, 777, 778, 5, 346, 174, 2, 778, 780, 3, 2, 2, 2, 779, 776, 3, 2, 2, 2, 779, 780, 3, 2, 2, 2, 780, 782, 3, 2, 2, 2, 781, 783, 5, 580, 291, 2, 782, 781, 3, 2, 2, 2, 782, 783, 3, 2, 2, 2, 783, 17, 3, 2, 2, 2, 784, 785, 5, 568, 285, 2, 785, 789, 5, 22, 12, 2, 786, 787, 5, 588, 295, 2, 787, 788, 5, 24, 13, 2, 788, 790, 3, 2, 2, 2, 789, 786, 3, 2, 2, 2, 789, 790, 3, 2, 2, 2, 790, 794, 3, 2, 2, 2, 791, 792, 5, 586, 294, 2, 792, 793, 5, 346, 174, 2, 793, 795, 3, 2, 2, 2, 794, 791, 3, 2, 2, 2, 794, 795, 3, 2, 2, 2, 795, 19, 3, 2, 2, 2, 796, 797, 5, 440, 221, 2, 797, 798, 5, 22, 12, 2, 798, 799, 5, 588, 295, 2, 799, 800, 5, 24, 13, 2, 800, 801, 5, 634, 318, 2, 801, 802, 5, 346, 174, 2, 802, 21, 3, 2, 2, 2, 803, 806, 5, 376, 189, 2, 804, 806, 5, 378, 190, 2, 805, 803, 3, 2, 2, 2, 805, 804, 3, 2, 2, 2, 806, 816, 3, 2, 2, 2, 807, 816, 5, 382, 192, 2, 808, 816, 5, 392, 197, 2, 809, 816, 5, 414, 208, 2, 810, 816, 5, 424, 213, 2, 811, 816, 5, 408, 205, 2, 812, 816, 5, 418, 210, 2, 813, 816, 5, 576, 289, 2, 814, 816, 5, 618, 310, 2, 815, 805, 3, 2, 2, 2, 815, 807, 3, 2, 2, 2, 815, 808, 3, 2, 2, 2, 815, 809, 3, 2, 2, 2, 815, 810, 3, 2, 2, 2, 815, 811, 3, 2, 2, 2, 815, 812, 3, 2, 2, 2, 815, 813, 3, 2, 2, 2, 815, 814, 3, 2, 2, 2, 816, 23, 3, 2, 2, 2, 817, 818, 5, 376, 189, 2, 818, 819, 5, 438, 220, 2, 819, 862, 3, 2, 2, 2, 820, 821, 5, 376, 189, 2, 821, 822, 5, 438, 220, 2, 822, 823, 5, 444, 223, 2, 823, 824, 5, 560, 281, 2, 824, 825, 5, 332, 167, 2, 825, 862, 3, 2, 2, 2, 826, 830, 5, 436, 219, 2, 827, 828, 5, 332, 167, 2, 828, 829, 7, 16, 2, 2, 829, 831, 3, 2, 2, 2, 830, 827, 3, 2, 2, 2, 830, 831, 3, 2, 2, 2, 831, 832, 3, 2, 2, 2, 832, 833, 5, 358, 180, 2, 833, 862, 3, 2, 2, 2, 834, 835, 5, 376, 189, 2, 835, 836, 5, 562, 282, 2, 836, 862, 3, 2, 2, 2, 837, 838, 5, 560, 281, 2, 838, 839, 5, 332, 167, 2, 839, 862, 3, 2, 2, 2, 840, 842, 5, 630, 316, 2, 841, 840, 3, 2, 2, 2, 841, 842, 3, 2, 2, 2, 842, 846, 3, 2, 2, 2, 843, 844, 5, 332, 167, 2, 844, 845, 7, 16, 2, 2, 845, 847, 3, 2, 2, 2, 846, 843, 3, 2, 2, 2, 846, 847, 3, 2, 2, 2, 847, 848, 3, 2, 2, 2, 848, 862, 5, 334, 168, 2, 849, 850, 5, 376, 189, 2, 850, 851, 5, 616, 309, 2, 851, 862, 3, 2, 2, 2, 852, 853, 5, 608, 305, 2, 853, 854, 5, 346, 174, 2, 854, 862, 3, 2, 2, 2, 855, 858, 5, 610, 306, 2, 856, 858, 5, 612, 307, 2, 857, 855, 3, 2, 2, 2, 857, 856, 3, 2, 2, 2, 858, 859, 3, 2, 2, 2, 859, 860, 5, 614, 308, 2, 860, 862, 3, 2, 2, 2, 861, 817, 3, 2, 2, 2, 861, 820, 3, 2, 2, 2, 861, 826, 3, 2, 2, 2, 861, 834, 3, 2, 2, 2, 861, 837, 3, 2, 2, 2, 861, 841, 3, 2, 2, 2, 861, 849, 3, 2, 2, 2, 861, 852, 3, 2, 2, 2, 861, 857, 3, 2, 2, 2, 862, 25, 3, 2, 2, 2, 863, 864, 5, 408, 205, 2, 864, 866, 5, 650, 326, 2, 865, 867, 5, 272, 137, 2, 866, 865, 3, 2, 2, 2, 866, 867, 3, 2, 2, 2, 867, 868, 3, 2, 2, 2, 868, 869, 5, 362, 182, 2, 869, 870, 5, 662, 332, 2, 870, 871, 5, 596, 299, 2, 871, 874, 5, 326, 164, 2, 872, 875, 5, 628, 315, 2, 873, 875, 5, 578, 290, 2, 874, 872, 3, 2, 2, 2, 874, 873, 3, 2, 2, 2, 874, 875, 3, 2, 2, 2, 875, 27, 3, 2, 2, 2, 876, 877, 5, 408, 205, 2, 877, 879, 5, 608, 305, 2, 878, 880, 5, 272, 137, 2, 879, 878, 3, 2, 2, 2, 879, 880, 3, 2, 2, 2, 880, 881, 3, 2, 2, 2, 881, 883, 5, 346, 174, 2, 882, 884, 5, 110, 56, 2, 883, 882, 3, 2, 2, 2, 883, 884, 3, 2, 2, 2, 884, 29, 3, 2, 2, 2, 885, 886, 5, 408, 205, 2, 886, 888, 5, 642, 322, 2, 887, 889, 5, 272, 137, 2, 888, 887, 3, 2, 2, 2, 888, 889, 3, 2, 2, 2, 889, 893, 3, 2, 2, 2, 890, 891, 5, 332, 167, 2, 891, 892, 7, 16, 2, 2, 892, 894, 3, 2, 2, 2, 893, 890, 3, 2, 2, 2, 893, 894, 3, 2, 2, 2, 894, 895, 3, 2, 2, 2, 895, 896, 5, 354, 178, 2, 896, 897, 5, 668, 335, 2, 897, 898, 5, 32, 17, 2, 898, 899, 5, 670, 336, 2, 899, 31, 3, 2, 2, 2, 900, 901, 5, 336, 169, 2, 901, 908, 5, 338, 170, 2, 902, 903, 5, 684, 343, 2, 903, 904, 5, 336, 169, 2, 904, 905, 5, 338, 170, 2, 905, 907, 3, 2, 2, 2, 906, 902, 3, 2, 2, 2, 907, 910, 3, 2, 2, 2, 908, 906, 3, 2, 2, 2, 908, 909, 3, 2, 2, 2, 909, 33, 3, 2, 2, 2, 910, 908, 3, 2, 2, 2, 911, 912, 5, 408, 205, 2, 912, 914, 5, 636, 319, 2, 913, 915, 5, 272, 137, 2, 914, 913, 3, 2, 2, 2, 914, 915, 3, 2, 2, 2, 915, 919, 3, 2, 2, 2, 916, 917, 5, 332, 167, 2, 917, 918, 7, 16, 2, 2, 918, 920, 3, 2, 2, 2, 919, 916, 3, 2, 2, 2, 919, 920, 3, 2, 2, 2, 920, 921, 3, 2, 2, 2, 921, 922, 5, 348, 175, 2, 922, 923, 5, 654, 328, 2, 923, 924, 5, 350, 176, 2, 924, 35, 3, 2, 2, 2, 925, 926, 5, 408, 205, 2, 926, 927, 5, 574, 288, 2, 927, 929, 5, 658, 330, 2, 928, 930, 5, 272, 137, 2, 929, 928, 3, 2, 2, 2, 929, 930, 3, 2, 2, 2, 930, 934, 3, 2, 2, 2, 931, 932, 5, 332, 167, 2, 932, 933, 7, 16, 2, 2, 933, 935, 3, 2, 2, 2, 934, 931, 3, 2, 2, 2, 934, 935, 3, 2, 2, 2, 935, 936, 3, 2, 2, 2, 936, 937, 5, 352, 177, 2, 937, 938, 5, 388, 195, 2, 938, 939, 5, 618, 310, 2, 939, 940, 5, 280, 141, 2, 940, 944, 5, 432, 217, 2, 941, 942, 5, 332, 167, 2, 942, 943, 7, 16, 2, 2, 943, 945, 3, 2, 2, 2, 944, 941, 3, 2, 2, 2, 944, 945, 3, 2, 2, 2, 945, 946, 3, 2, 2, 2, 946, 947, 5, 334, 168, 2, 947, 949, 5, 38, 20, 2, 948, 950, 5, 166, 84, 2, 949, 948, 3, 2, 2, 2, 949, 950, 3, 2, 2, 2, 950, 954, 3, 2, 2, 2, 951, 952, 5, 662, 332, 2, 952, 953, 5, 44, 23, 2, 953, 955, 3, 2, 2, 2, 954, 951, 3, 2, 2, 2, 954, 955, 3, 2, 2, 2, 955, 37, 3, 2, 2, 2, 956, 957, 5, 660, 331, 2, 957, 961, 5, 40, 21, 2, 958, 959, 5, 384, 193, 2, 959, 960, 5, 308, 155, 2, 960, 962, 3, 2, 2, 2, 961, 958, 3, 2, 2, 2, 961, 962, 3, 2, 2, 2, 962, 39, 3, 2, 2, 2, 963, 969, 5, 42, 22, 2, 964, 965, 5, 384, 193, 2, 965, 966, 5, 42, 22, 2, 966, 968, 3, 2, 2, 2, 967, 964, 3, 2, 2, 2, 968, 971, 3, 2, 2, 2, 969, 967, 3, 2, 2, 2, 969, 970, 3, 2, 2, 2, 970, 41, 3, 2, 2, 2, 971, 969, 3, 2, 2, 2, 972, 973, 5, 336, 169, 2, 973, 974, 5, 552, 277, 2, 974, 975, 5, 582, 292, 2, 975, 976, 5, 584, 293, 2, 976, 43, 3, 2, 2, 2, 977, 978, 5, 144, 73, 2, 978, 45, 3, 2, 2, 2, 979, 980, 5, 408, 205, 2, 980, 982, 5, 560, 281, 2, 981, 983, 5, 272, 137, 2, 982, 981, 3, 2, 2, 2, 982, 983, 3, 2, 2, 2, 983, 984, 3, 2, 2, 2, 984, 985, 5, 332, 167, 2, 985, 986, 5, 662, 332, 2, 986, 987, 5, 604, 303, 2, 987, 988, 7, 222, 2, 2, 988, 989, 5, 672, 337, 2, 989, 990, 5, 192, 97, 2, 990, 994, 5, 674, 338, 2, 991, 992, 5, 384, 193, 2, 992, 993, 5, 196, 99, 2, 993, 995, 3, 2, 2, 2, 994, 991, 3, 2, 2, 2, 994, 995, 3, 2, 2, 2, 995, 47, 3, 2, 2, 2, 996, 998, 5, 408, 205, 2, 997, 999, 5, 68, 35, 2, 998, 997, 3, 2, 2, 2, 998, 999, 3, 2, 2, 2, 999, 1000, 3, 2, 2, 2, 1000, 1002, 5, 436, 219, 2, 1001, 1003, 5, 272, 137, 2, 1002, 1001, 3, 2, 2, 2, 1002, 1003, 3, 2, 2, 2, 1003, 1007, 3, 2, 2, 2, 1004, 1005, 5, 332, 167, 2, 1005, 1006, 7, 16, 2, 2, 1006, 1008, 3, 2, 2, 2, 1007, 1004, 3, 2, 2, 2, 1007, 1008, 3, 2, 2, 2, 1008, 1009, 3, 2, 2, 2, 1009, 1010, 5, 358, 180, 2, 1010, 1012, 5, 668, 335, 2, 1011, 1013, 5, 52, 27, 2, 1012, 1011, 3, 2, 2, 2, 1012, 1013, 3, 2, 2, 2, 1013, 1014, 3, 2, 2, 2, 1014, 1015, 5, 670, 336, 2, 1015, 1016, 5, 54, 28, 2, 1016, 1017, 5, 606, 304, 2, 1017, 1018, 5, 338, 170, 2, 1018, 1019, 5, 564, 283, 2, 1019, 1020, 5, 360, 181, 2, 1020, 1021, 5, 388, 195, 2, 1021, 1022, 5, 50, 26, 2, 1022, 49, 3, 2, 2, 2, 1023, 1024, 9, 2, 2, 2, 1024, 51, 3, 2, 2, 2, 1025, 1031, 5, 368, 185, 2, 1026, 1027, 5, 684, 343, 2, 1027, 1028, 5, 368, 185, 2, 1028, 1030, 3, 2, 2, 2, 1029, 1026, 3, 2, 2, 2, 1030, 1033, 3, 2, 2, 2, 1031, 1029, 3, 2, 2, 2, 1031, 1032, 3, 2, 2, 2, 1032, 53, 3, 2, 2, 2, 1033, 1031, 3, 2, 2, 2, 1034, 1039, 5, 400, 201, 2, 1035, 1036, 5, 606, 304, 2, 1036, 1037, 5, 584, 293, 2, 1037, 1039, 3, 2, 2, 2, 1038, 1034, 3, 2, 2, 2, 1038, 1035, 3, 2, 2, 2, 1039, 1040, 3, 2, 2, 2, 1040, 1041, 5, 588, 295, 2, 1041, 1042, 5, 584, 293, 2, 1042, 1043, 5, 546, 274, 2, 1043, 55, 3, 2, 2, 2, 1044, 1046, 5, 408, 205, 2, 1045, 1047, 5, 68, 35, 2, 1046, 1045, 3, 2, 2, 2, 1046, 1047, 3, 2, 2, 2, 1047, 1048, 3, 2, 2, 2, 1048, 1050, 5, 374, 188, 2, 1049, 1051, 5, 272, 137, 2, 1050, 1049, 3, 2, 2, 2, 1050, 1051, 3, 2, 2, 2, 1051, 1055, 3, 2, 2, 2, 1052, 1053, 5, 332, 167, 2, 1053, 1054, 7, 16, 2, 2, 1054, 1056, 3, 2, 2, 2, 1055, 1052, 3, 2, 2, 2, 1055, 1056, 3, 2, 2, 2, 1056, 1057, 3, 2, 2, 2, 1057, 1058, 5, 356, 179, 2, 1058, 1059, 5, 668, 335, 2, 1059, 1060, 5, 338, 170, 2, 1060, 1061, 5, 670, 336, 2, 1061, 1062, 5, 622, 312, 2, 1062, 1063, 5, 358, 180, 2, 1063, 1064, 5, 626, 314, 2, 1064, 1065, 5, 338, 170, 2, 1065, 1066, 5, 430, 216, 2, 1066, 1067, 5, 358, 180, 2, 1067, 1068, 5, 544, 273, 2, 1068, 1069, 5, 58, 30, 2, 1069, 57, 3, 2, 2, 2, 1070, 1075, 5, 320, 161, 2, 1071, 1075, 5, 66, 34, 2, 1072, 1075, 5, 64, 33, 2, 1073, 1075, 5, 60, 31, 2, 1074, 1070, 3, 2, 2, 2, 1074, 1071, 3, 2, 2, 2, 1074, 1072, 3, 2, 2, 2, 1074, 1073, 3, 2, 2, 2, 1075, 59, 3, 2, 2, 2, 1076, 1077, 5, 672, 337, 2, 1077, 1083, 5, 62, 32, 2, 1078, 1079, 5, 684, 343, 2, 1079, 1080, 5, 62, 32, 2, 1080, 1082, 3, 2, 2, 2, 1081, 1078, 3, 2, 2, 2, 1082, 1085, 3, 2, 2, 2, 1083, 1081, 3, 2, 2, 2, 1083, 1084, 3, 2, 2, 2, 1084, 1086, 3, 2, 2, 2, 1085, 1083, 3, 2, 2, 2, 1086, 1087, 5, 674, 338, 2, 1087, 61, 3, 2, 2, 2, 1088, 1089, 5, 366, 184, 2, 1089, 1090, 7, 11, 2, 2, 1090, 1091, 5, 58, 30, 2, 1091, 63, 3, 2, 2, 2, 1092, 1093, 5, 668, 335, 2, 1093, 1100, 5, 66, 34, 2, 1094, 1095, 5, 684, 343, 2, 1095, 1096, 5, 320, 161, 2, 1096, 1099, 3, 2, 2, 2, 1097, 1099, 5, 66, 34, 2, 1098, 1094, 3, 2, 2, 2, 1098, 1097, 3, 2, 2, 2, 1099, 1102, 3, 2, 2, 2, 1100, 1098, 3, 2, 2, 2, 1100, 1101, 3, 2, 2, 2, 1101, 1103, 3, 2, 2, 2, 1102, 1100, 3, 2, 2, 2, 1103, 1104, 5, 670, 336, 2, 1104, 65, 3, 2, 2, 2, 1105, 1106, 5, 668, 335, 2, 1106, 1112, 5, 320, 161, 2, 1107, 1108, 5, 684, 343, 2, 1108, 1109, 5, 320, 161, 2, 1109, 1111, 3, 2, 2, 2, 1110, 1107, 3, 2, 2, 2, 1111, 1114, 3, 2, 2, 2, 1112, 1110, 3, 2, 2, 2, 1112, 1113, 3, 2, 2, 2, 1113, 1115, 3, 2, 2, 2, 1114, 1112, 3, 2, 2, 2, 1115, 1116, 5, 670, 336, 2, 1116, 67, 3, 2, 2, 2, 1117, 1118, 5, 592, 297, 2, 1118, 1119, 5, 602, 302, 2, 1119, 69, 3, 2, 2, 2, 1120, 1121, 5, 382, 192, 2, 1121, 1122, 5, 650, 326, 2, 1122, 1123, 5, 362, 182, 2, 1123, 1124, 5, 662, 332, 2, 1124, 1126, 5, 72, 37, 2, 1125, 1127, 5, 74, 38, 2, 1126, 1125, 3, 2, 2, 2, 1126, 1127, 3, 2, 2, 2, 1127, 71, 3, 2, 2, 2, 1128, 1129, 5, 596, 299, 2, 1129, 1130, 5, 326, 164, 2, 1130, 73, 3, 2, 2, 2, 1131, 1134, 5, 628, 315, 2, 1132, 1134, 5, 578, 290, 2, 1133, 1131, 3, 2, 2, 2, 1133, 1132, 3, 2, 2, 2, 1134, 75, 3, 2, 2, 2, 1135, 1136, 5, 382, 192, 2, 1136, 1140, 5, 642, 322, 2, 1137, 1138, 5, 332, 167, 2, 1138, 1139, 7, 16, 2, 2, 1139, 1141, 3, 2, 2, 2, 1140, 1137, 3, 2, 2, 2, 1140, 1141, 3, 2, 2, 2, 1141, 1142, 3, 2, 2, 2, 1142, 1143, 5, 354, 178, 2, 1143, 1144, 5, 78, 40, 2, 1144, 77, 3, 2, 2, 2, 1145, 1149, 5, 88, 45, 2, 1146, 1149, 5, 86, 44, 2, 1147, 1149, 5, 80, 41, 2, 1148, 1145, 3, 2, 2, 2, 1148, 1146, 3, 2, 2, 2, 1148, 1147, 3, 2, 2, 2, 1149, 79, 3, 2, 2, 2, 1150, 1151, 5, 600, 301, 2, 1151, 1152, 5, 82, 42, 2, 1152, 81, 3, 2, 2, 2, 1153, 1159, 5, 84, 43, 2, 1154, 1155, 5, 384, 193, 2, 1155, 1156, 5, 84, 43, 2, 1156, 1158, 3, 2, 2, 2, 1157, 1154, 3, 2, 2, 2, 1158, 1161, 3, 2, 2, 2, 1159, 1157, 3, 2, 2, 2, 1159, 1160, 3, 2, 2, 2, 1160, 83, 3, 2, 2, 2, 1161, 1159, 3, 2, 2, 2, 1162, 1163, 5, 336, 169, 2, 1163, 1164, 5, 634, 318, 2, 1164, 1165, 5, 336, 169, 2, 1165, 85, 3, 2, 2, 2, 1166, 1167, 5, 372, 187, 2, 1167, 1168, 5, 32, 17, 2, 1168, 87, 3, 2, 2, 2, 1169, 1170, 5, 382, 192, 2, 1170, 1171, 5, 336, 169, 2, 1171, 1172, 5, 642, 322, 2, 1172, 1173, 5, 338, 170, 2, 1173, 89, 3, 2, 2, 2, 1174, 1175, 5, 382, 192, 2, 1175, 1179, 5, 630, 316, 2, 1176, 1177, 5, 332, 167, 2, 1177, 1178, 7, 16, 2, 2, 1178, 1180, 3, 2, 2, 2, 1179, 1176, 3, 2, 2, 2, 1179, 1180, 3, 2, 2, 2, 1180, 1181, 3, 2, 2, 2, 1181, 1182, 5, 334, 168, 2, 1182, 1183, 5, 92, 47, 2, 1183, 91, 3, 2, 2, 2, 1184, 1191, 5, 104, 53, 2, 1185, 1191, 5, 100, 51, 2, 1186, 1191, 5, 100, 51, 2, 1187, 1191, 5, 98, 50, 2, 1188, 1191, 5, 96, 49, 2, 1189, 1191, 5, 94, 48, 2, 1190, 1184, 3, 2, 2, 2, 1190, 1185, 3, 2, 2, 2, 1190, 1186, 3, 2, 2, 2, 1190, 1187, 3, 2, 2, 2, 1190, 1188, 3, 2, 2, 2, 1190, 1189, 3, 2, 2, 2, 1191, 93, 3, 2, 2, 2, 1192, 1193, 5, 662, 332, 2, 1193, 1194, 5, 144, 73, 2, 1194, 95, 3, 2, 2, 2, 1195, 1196, 5, 600, 301, 2, 1196, 1197, 5, 336, 169, 2, 1197, 1198, 5, 634, 318, 2, 1198, 1199, 5, 336, 169, 2, 1199, 97, 3, 2, 2, 2, 1200, 1201, 5, 418, 210, 2, 1201, 1202, 5, 404, 203, 2, 1202, 1203, 5, 624, 313, 2, 1203, 99, 3, 2, 2, 2, 1204, 1205, 5, 418, 210, 2, 1205, 1206, 5, 102, 52, 2, 1206, 101, 3, 2, 2, 2, 1207, 1213, 5, 336, 169, 2, 1208, 1209, 5, 684, 343, 2, 1209, 1210, 5, 336, 169, 2, 1210, 1212, 3, 2, 2, 2, 1211, 1208, 3, 2, 2, 2, 1212, 1215, 3, 2, 2, 2, 1213, 1211, 3, 2, 2, 2, 1213, 1214, 3, 2, 2, 2, 1214, 103, 3, 2, 2, 2, 1215, 1213, 3, 2, 2, 2, 1216, 1217, 5, 372, 187, 2, 1217, 1218, 5, 106, 54, 2, 1218, 105, 3, 2, 2, 2, 1219, 1220, 5, 336, 169, 2, 1220, 1227, 5, 338, 170, 2, 1221, 1222, 5, 684, 343, 2, 1222, 1223, 5, 336, 169, 2, 1223, 1224, 5, 338, 170, 2, 1224, 1226, 3, 2, 2, 2, 1225, 1221, 3, 2, 2, 2, 1226, 1229, 3, 2, 2, 2, 1227, 1225, 3, 2, 2, 2, 1227, 1228, 3, 2, 2, 2, 1228, 107, 3, 2, 2, 2, 1229, 1227, 3, 2, 2, 2, 1230, 1231, 5, 382, 192, 2, 1231, 1232, 5, 608, 305, 2, 1232, 1234, 5, 346, 174, 2, 1233, 1235, 5, 110, 56, 2, 1234, 1233, 3, 2, 2, 2, 1234, 1235, 3, 2, 2, 2, 1235, 109, 3, 2, 2, 2, 1236, 1237, 5, 662, 332, 2, 1237, 1243, 5, 112, 57, 2, 1238, 1239, 5, 384, 193, 2, 1239, 1240, 5, 112, 57, 2, 1240, 1242, 3, 2, 2, 2, 1241, 1238, 3, 2, 2, 2, 1242, 1245, 3, 2, 2, 2, 1243, 1241, 3, 2, 2, 2, 1243, 1244, 3, 2, 2, 2, 1244, 111, 3, 2, 2, 2, 1245, 1243, 3, 2, 2, 2, 1246, 1247, 5, 596, 299, 2, 1247, 1248, 7, 222, 2, 2, 1248, 1249, 5, 326, 164, 2, 1249, 1263, 3, 2, 2, 2, 1250, 1251, 5, 572, 287, 2, 1251, 1252, 7, 222, 2, 2, 1252, 1253, 5, 328, 165, 2, 1253, 1263, 3, 2, 2, 2, 1254, 1255, 5, 628, 315, 2, 1255, 1256, 7, 222, 2, 2, 1256, 1257, 5, 328, 165, 2, 1257, 1263, 3, 2, 2, 2, 1258, 1259, 5, 590, 296, 2, 1259, 1260, 7, 222, 2, 2, 1260, 1261, 5, 152, 77, 2, 1261, 1263, 3, 2, 2, 2, 1262, 1246, 3, 2, 2, 2, 1262, 1250, 3, 2, 2, 2, 1262, 1254, 3, 2, 2, 2, 1262, 1258, 3, 2, 2, 2, 1263, 113, 3, 2, 2, 2, 1264, 1265, 5, 382, 192, 2, 1265, 1266, 5, 574, 288, 2, 1266, 1270, 5, 658, 330, 2, 1267, 1268, 5, 332, 167, 2, 1268, 1269, 7, 16, 2, 2, 1269, 1271, 3, 2, 2, 2, 1270, 1267, 3, 2, 2, 2, 1270, 1271, 3, 2, 2, 2, 1271, 1272, 3, 2, 2, 2, 1272, 1276, 5, 352, 177, 2, 1273, 1274, 5, 662, 332, 2, 1274, 1275, 5, 144, 73, 2, 1275, 1277, 3, 2, 2, 2, 1276, 1273, 3, 2, 2, 2, 1276, 1277, 3, 2, 2, 2, 1277, 115, 3, 2, 2, 2, 1278, 1279, 5, 418, 210, 2, 1279, 1281, 5, 650, 326, 2, 1280, 1282, 5, 274, 138, 2, 1281, 1280, 3, 2, 2, 2, 1281, 1282, 3, 2, 2, 2, 1282, 1283, 3, 2, 2, 2, 1283, 1284, 5, 362, 182, 2, 1284, 117, 3, 2, 2, 2, 1285, 1286, 5, 418, 210, 2, 1286, 1288, 5, 642, 322, 2, 1287, 1289, 5, 274, 138, 2, 1288, 1287, 3, 2, 2, 2, 1288, 1289, 3, 2, 2, 2, 1289, 1293, 3, 2, 2, 2, 1290, 1291, 5, 332, 167, 2, 1291, 1292, 7, 16, 2, 2, 1292, 1294, 3, 2, 2, 2, 1293, 1290, 3, 2, 2, 2, 1293, 1294, 3, 2, 2, 2, 1294, 1295, 3, 2, 2, 2, 1295, 1296, 5, 354, 178, 2, 1296, 119, 3, 2, 2, 2, 1297, 1298, 5, 418, 210, 2, 1298, 1299, 5, 574, 288, 2, 1299, 1301, 5, 658, 330, 2, 1300, 1302, 5, 274, 138, 2, 1301, 1300, 3, 2, 2, 2, 1301, 1302, 3, 2, 2, 2, 1302, 1306, 3, 2, 2, 2, 1303, 1304, 5, 332, 167, 2, 1304, 1305, 7, 16, 2, 2, 1305, 1307, 3, 2, 2, 2, 1306, 1303, 3, 2, 2, 2, 1306, 1307, 3, 2, 2, 2, 1307, 1308, 3, 2, 2, 2, 1308, 1309, 5, 352, 177, 2, 1309, 121, 3, 2, 2, 2, 1310, 1311, 5, 418, 210, 2, 1311, 1313, 5, 374, 188, 2, 1312, 1314, 5, 274, 138, 2, 1313, 1312, 3, 2, 2, 2, 1313, 1314, 3, 2, 2, 2, 1314, 1318, 3, 2, 2, 2, 1315, 1316, 5, 332, 167, 2, 1316, 1317, 7, 16, 2, 2, 1317, 1319, 3, 2, 2, 2, 1318, 1315, 3, 2, 2, 2, 1318, 1319, 3, 2, 2, 2, 1319, 1320, 3, 2, 2, 2, 1320, 1321, 5, 356, 179, 2, 1321, 123, 3, 2, 2, 2, 1322, 1323, 5, 418, 210, 2, 1323, 1325, 5, 436, 219, 2, 1324, 1326, 5, 274, 138, 2, 1325, 1324, 3, 2, 2, 2, 1325, 1326, 3, 2, 2, 2, 1326, 1330, 3, 2, 2, 2, 1327, 1328, 5, 332, 167, 2, 1328, 1329, 7, 16, 2, 2, 1329, 1331, 3, 2, 2, 2, 1330, 1327, 3, 2, 2, 2, 1330, 1331, 3, 2, 2, 2, 1331, 1332, 3, 2, 2, 2, 1332, 1333, 5, 358, 180, 2, 1333, 125, 3, 2, 2, 2, 1334, 1335, 5, 418, 210, 2, 1335, 1337, 5, 636, 319, 2, 1336, 1338, 5, 274, 138, 2, 1337, 1336, 3, 2, 2, 2, 1337, 1338, 3, 2, 2, 2, 1338, 1339, 3, 2, 2, 2, 1339, 1340, 5, 348, 175, 2, 1340, 1344, 5, 588, 295, 2, 1341, 1342, 5, 332, 167, 2, 1342, 1343, 7, 16, 2, 2, 1343, 1345, 3, 2, 2, 2, 1344, 1341, 3, 2, 2, 2, 1344, 1345, 3, 2, 2, 2, 1345, 1346, 3, 2, 2, 2, 1346, 1347, 5, 334, 168, 2, 1347, 127, 3, 2, 2, 2, 1348, 1349, 5, 418, 210, 2, 1349, 1351, 5, 608, 305, 2, 1350, 1352, 5, 274, 138, 2, 1351, 1350, 3, 2, 2, 2, 1351, 1352, 3, 2, 2, 2, 1352, 1353, 3, 2, 2, 2, 1353, 1354, 5, 346, 174, 2, 1354, 129, 3, 2, 2, 2, 1355, 1356, 5, 418, 210, 2, 1356, 1358, 5, 630, 316, 2, 1357, 1359, 5, 274, 138, 2, 1358, 1357, 3, 2, 2, 2, 1358, 1359, 3, 2, 2, 2, 1359, 1363, 3, 2, 2, 2, 1360, 1361, 5, 332, 167, 2, 1361, 1362, 7, 16, 2, 2, 1362, 1364, 3, 2, 2, 2, 1363, 1360, 3, 2, 2, 2, 1363, 1364, 3, 2, 2, 2, 1364, 1365, 3, 2, 2, 2, 1365, 1366, 5, 334, 168, 2, 1366, 131, 3, 2, 2, 2, 1367, 1368, 5, 418, 210, 2, 1368, 1370, 5, 560, 281, 2, 1369, 1371, 5, 274, 138, 2, 1370, 1369, 3, 2, 2, 2, 1370, 1371, 3, 2, 2, 2, 1371, 1372, 3, 2, 2, 2, 1372, 1373, 5, 332, 167, 2, 1373, 133, 3, 2, 2, 2, 1374, 1375, 5, 418, 210, 2, 1375, 1377, 5, 446, 224, 2, 1376, 1378, 5, 274, 138, 2, 1377, 1376, 3, 2, 2, 2, 1377, 1378, 3, 2, 2, 2, 1378, 1382, 3, 2, 2, 2, 1379, 1380, 5, 332, 167, 2, 1380, 1381, 7, 16, 2, 2, 1381, 1383, 3, 2, 2, 2, 1382, 1379, 3, 2, 2, 2, 1382, 1383, 3, 2, 2, 2, 1383, 1384, 3, 2, 2, 2, 1384, 1385, 5, 222, 112, 2, 1385, 135, 3, 2, 2, 2, 1386, 1387, 5, 408, 205, 2, 1387, 1389, 5, 630, 316, 2, 1388, 1390, 5, 272, 137, 2, 1389, 1388, 3, 2, 2, 2, 1389, 1390, 3, 2, 2, 2, 1390, 1394, 3, 2, 2, 2, 1391, 1392, 5, 332, 167, 2, 1392, 1393, 7, 16, 2, 2, 1393, 1395, 3, 2, 2, 2, 1394, 1391, 3, 2, 2, 2, 1394, 1395, 3, 2, 2, 2, 1395, 1396, 3, 2, 2, 2, 1396, 1397, 5, 334, 168, 2, 1397, 1398, 5, 668, 335, 2, 1398, 1399, 5, 160, 81, 2, 1399, 1401, 5, 670, 336, 2, 1400, 1402, 5, 138, 70, 2, 1401, 1400, 3, 2, 2, 2, 1401, 1402, 3, 2, 2, 2, 1402, 137, 3, 2, 2, 2, 1403, 1405, 5, 662, 332, 2, 1404, 1406, 5, 144, 73, 2, 1405, 1404, 3, 2, 2, 2, 1405, 1406, 3, 2, 2, 2, 1406, 139, 3, 2, 2, 2, 1407, 1409, 5, 336, 169, 2, 1408, 1410, 5, 344, 173, 2, 1409, 1408, 3, 2, 2, 2, 1409, 1410, 3, 2, 2, 2, 1410, 1418, 3, 2, 2, 2, 1411, 1412, 5, 684, 343, 2, 1412, 1414, 5, 336, 169, 2, 1413, 1415, 5, 344, 173, 2, 1414, 1413, 3, 2, 2, 2, 1414, 1415, 3, 2, 2, 2, 1415, 1417, 3, 2, 2, 2, 1416, 1411, 3, 2, 2, 2, 1417, 1420, 3, 2, 2, 2, 1418, 1416, 3, 2, 2, 2, 1418, 1419, 3, 2, 2, 2, 1419, 141, 3, 2, 2, 2, 1420, 1418, 3, 2, 2, 2, 1421, 1422, 5, 402, 202, 2, 1422, 1423, 5, 594, 298, 2, 1423, 1424, 5, 398, 200, 2, 1424, 1425, 5, 668, 335, 2, 1425, 1426, 5, 140, 71, 2, 1426, 1427, 5, 670, 336, 2, 1427, 143, 3, 2, 2, 2, 1428, 1434, 5, 146, 74, 2, 1429, 1430, 5, 384, 193, 2, 1430, 1431, 5, 146, 74, 2, 1431, 1433, 3, 2, 2, 2, 1432, 1429, 3, 2, 2, 2, 1433, 1436, 3, 2, 2, 2, 1434, 1432, 3, 2, 2, 2, 1434, 1435, 3, 2, 2, 2, 1435, 145, 3, 2, 2, 2, 1436, 1434, 3, 2, 2, 2, 1437, 1438, 5, 148, 75, 2, 1438, 1439, 7, 222, 2, 2, 1439, 1440, 5, 150, 76, 2, 1440, 1447, 3, 2, 2, 2, 1441, 1442, 5, 148, 75, 2, 1442, 1443, 7, 222, 2, 2, 1443, 1444, 5, 152, 77, 2, 1444, 1447, 3, 2, 2, 2, 1445, 1447, 5, 142, 72, 2, 1446, 1437, 3, 2, 2, 2, 1446, 1441, 3, 2, 2, 2, 1446, 1445, 3, 2, 2, 2, 1447, 147, 3, 2, 2, 2, 1448, 1449, 5, 688, 345, 2, 1449, 149, 3, 2, 2, 2, 1450, 1454, 5, 326, 164, 2, 1451, 1454, 5, 324, 163, 2, 1452, 1454, 5, 688, 345, 2, 1453, 1450, 3, 2, 2, 2, 1453, 1451, 3, 2, 2, 2, 1453, 1452, 3, 2, 2, 2, 1454, 151, 3, 2, 2, 2, 1455, 1456, 5, 672, 337, 2, 1456, 1462, 5, 154, 78, 2, 1457, 1458, 5, 684, 343, 2, 1458, 1459, 5, 154, 78, 2, 1459, 1461, 3, 2, 2, 2, 1460, 1457, 3, 2, 2, 2, 1461, 1464, 3, 2, 2, 2, 1462, 1460, 3, 2, 2, 2, 1462, 1463, 3, 2, 2, 2, 1463, 1465, 3, 2, 2, 2, 1464, 1462, 3, 2, 2, 2, 1465, 1466, 5, 674, 338, 2, 1466, 153, 3, 2, 2, 2, 1467, 1468, 5, 156, 79, 2, 1468, 1469, 7, 11, 2, 2, 1469, 1470, 5, 158, 80, 2, 1470, 155, 3, 2, 2, 2, 1471, 1472, 5, 326, 164, 2, 1472, 157, 3, 2, 2, 2, 1473, 1477, 5, 326, 164, 2, 1474, 1477, 5, 328, 165, 2, 1475, 1477, 5, 324, 163, 2, 1476, 1473, 3, 2, 2, 2, 1476, 1474, 3, 2, 2, 2, 1476, 1475, 3, 2, 2, 2, 1477, 159, 3, 2, 2, 2, 1478, 1484, 5, 162, 82, 2, 1479, 1480, 5, 684, 343, 2, 1480, 1481, 5, 162, 82, 2, 1481, 1483, 3, 2, 2, 2, 1482, 1479, 3, 2, 2, 2, 1483, 1486, 3, 2, 2, 2, 1484, 1482, 3, 2, 2, 2, 1484, 1485, 3, 2, 2, 2, 1485, 1490, 3, 2, 2, 2, 1486, 1484, 3, 2, 2, 2, 1487, 1488, 5, 684, 343, 2, 1488, 1489, 5, 166, 84, 2, 1489, 1491, 3, 2, 2, 2, 1490, 1487, 3, 2, 2, 2, 1490, 1491, 3, 2, 2, 2, 1491, 161, 3, 2, 2, 2, 1492, 1493, 5, 336, 169, 2, 1493, 1495, 5, 338, 170, 2, 1494, 1496, 5, 164, 83, 2, 1495, 1494, 3, 2, 2, 2, 1495, 1496, 3, 2, 2, 2, 1496, 163, 3, 2, 2, 2, 1497, 1498, 5, 598, 300, 2, 1498, 1499, 5, 556, 279, 2, 1499, 165, 3, 2, 2, 2, 1500, 1501, 5, 598, 300, 2, 1501, 1502, 5, 556, 279, 2, 1502, 1503, 5, 668, 335, 2, 1503, 1504, 5, 168, 85, 2, 1504, 1505, 5, 670, 336, 2, 1505, 167, 3, 2, 2, 2, 1506, 1510, 5, 170, 86, 2, 1507, 1510, 5, 172, 87, 2, 1508, 1510, 5, 174, 88, 2, 1509, 1506, 3, 2, 2, 2, 1509, 1507, 3, 2, 2, 2, 1509, 1508, 3, 2, 2, 2, 1510, 169, 3, 2, 2, 2, 1511, 1512, 5, 336, 169, 2, 1512, 171, 3, 2, 2, 2, 1513, 1517, 5, 180, 91, 2, 1514, 1515, 5, 684, 343, 2, 1515, 1516, 5, 178, 90, 2, 1516, 1518, 3, 2, 2, 2, 1517, 1514, 3, 2, 2, 2, 1517, 1518, 3, 2, 2, 2, 1518, 173, 3, 2, 2, 2, 1519, 1520, 5, 668, 335, 2, 1520, 1521, 5, 176, 89, 2, 1521, 1525, 5, 670, 336, 2, 1522, 1523, 5, 684, 343, 2, 1523, 1524, 5, 178, 90, 2, 1524, 1526, 3, 2, 2, 2, 1525, 1522, 3, 2, 2, 2, 1525, 1526, 3, 2, 2, 2, 1526, 175, 3, 2, 2, 2, 1527, 1533, 5, 180, 91, 2, 1528, 1529, 5, 684, 343, 2, 1529, 1530, 5, 180, 91, 2, 1530, 1532, 3, 2, 2, 2, 1531, 1528, 3, 2, 2, 2, 1532, 1535, 3, 2, 2, 2, 1533, 1531, 3, 2, 2, 2, 1533, 1534, 3, 2, 2, 2, 1534, 177, 3, 2, 2, 2, 1535, 1533, 3, 2, 2, 2, 1536, 1542, 5, 182, 92, 2, 1537, 1538, 5, 684, 343, 2, 1538, 1539, 5, 182, 92, 2, 1539, 1541, 3, 2, 2, 2, 1540, 1537, 3, 2, 2, 2, 1541, 1544, 3, 2, 2, 2, 1542, 1540, 3, 2, 2, 2, 1542, 1543, 3, 2, 2, 2, 1543, 179, 3, 2, 2, 2, 1544, 1542, 3, 2, 2, 2, 1545, 1546, 5, 336, 169, 2, 1546, 181, 3, 2, 2, 2, 1547, 1548, 5, 336, 169, 2, 1548, 183, 3, 2, 2, 2, 1549, 1550, 5, 386, 194, 2, 1550, 1551, 5, 394, 198, 2, 1551, 185, 3, 2, 2, 2, 1552, 1554, 5, 396, 199, 2, 1553, 1555, 5, 188, 95, 2, 1554, 1553, 3, 2, 2, 2, 1554, 1555, 3, 2, 2, 2, 1555, 1556, 3, 2, 2, 2, 1556, 1558, 5, 394, 198, 2, 1557, 1559, 5, 270, 136, 2, 1558, 1557, 3, 2, 2, 2, 1558, 1559, 3, 2, 2, 2, 1559, 187, 3, 2, 2, 2, 1560, 1563, 5, 570, 286, 2, 1561, 1563, 5, 644, 323, 2, 1562, 1560, 3, 2, 2, 2, 1562, 1561, 3, 2, 2, 2, 1563, 189, 3, 2, 2, 2, 1564, 1565, 5, 382, 192, 2, 1565, 1566, 5, 560, 281, 2, 1566, 1567, 5, 332, 167, 2, 1567, 1568, 5, 662, 332, 2, 1568, 1569, 5, 604, 303, 2, 1569, 1570, 7, 222, 2, 2, 1570, 1571, 5, 672, 337, 2, 1571, 1572, 5, 192, 97, 2, 1572, 1576, 5, 674, 338, 2, 1573, 1574, 5, 384, 193, 2, 1574, 1575, 5, 196, 99, 2, 1575, 1577, 3, 2, 2, 2, 1576, 1573, 3, 2, 2, 2, 1576, 1577, 3, 2, 2, 2, 1577, 191, 3, 2, 2, 2, 1578, 1584, 5, 194, 98, 2, 1579, 1580, 5, 684, 343, 2, 1580, 1581, 5, 194, 98, 2, 1581, 1583, 3, 2, 2, 2, 1582, 1579, 3, 2, 2, 2, 1583, 1586, 3, 2, 2, 2, 1584, 1582, 3, 2, 2, 2, 1584, 1585, 3, 2, 2, 2, 1585, 193, 3, 2, 2, 2, 1586, 1584, 3, 2, 2, 2, 1587, 1588, 7, 215, 2, 2, 1588, 1589, 7, 11, 2, 2, 1589, 1594, 7, 215, 2, 2, 1590, 1591, 7, 215, 2, 2, 1591, 1592, 7, 11, 2, 2, 1592, 1594, 7, 216, 2, 2, 1593, 1587, 3, 2, 2, 2, 1593, 1590, 3, 2, 2, 2, 1594, 195, 3, 2, 2, 2, 1595, 1596, 5, 420, 211, 2, 1596, 1597, 7, 222, 2, 2, 1597, 1598, 5, 328, 165, 2, 1598, 197, 3, 2, 2, 2, 1599, 1600, 5, 648, 325, 2, 1600, 1601, 5, 332, 167, 2, 1601, 199, 3, 2, 2, 2, 1602, 1604, 5, 638, 320, 2, 1603, 1605, 5, 630, 316, 2, 1604, 1603, 3, 2, 2, 2, 1604, 1605, 3, 2, 2, 2, 1605, 1609, 3, 2, 2, 2, 1606, 1607, 5, 332, 167, 2, 1607, 1608, 7, 16, 2, 2, 1608, 1610, 3, 2, 2, 2, 1609, 1606, 3, 2, 2, 2, 1609, 1610, 3, 2, 2, 2, 1610, 1611, 3, 2, 2, 2, 1611, 1612, 5, 334, 168, 2, 1612, 201, 3, 2, 2, 2, 1613, 1614, 5, 408, 205, 2, 1614, 1616, 5, 446, 224, 2, 1615, 1617, 5, 272, 137, 2, 1616, 1615, 3, 2, 2, 2, 1616, 1617, 3, 2, 2, 2, 1617, 1619, 3, 2, 2, 2, 1618, 1620, 5, 222, 112, 2, 1619, 1618, 3, 2, 2, 2, 1619, 1620, 3, 2, 2, 2, 1620, 1621, 3, 2, 2, 2, 1621, 1625, 5, 588, 295, 2, 1622, 1623, 5, 332, 167, 2, 1623, 1624, 7, 16, 2, 2, 1624, 1626, 3, 2, 2, 2, 1625, 1622, 3, 2, 2, 2, 1625, 1626, 3, 2, 2, 2, 1626, 1627, 3, 2, 2, 2, 1627, 1628, 5, 334, 168, 2, 1628, 1629, 5, 668, 335, 2, 1629, 1630, 5, 224, 113, 2, 1630, 1631, 5, 670, 336, 2, 1631, 1671, 3, 2, 2, 2, 1632, 1633, 5, 408, 205, 2, 1633, 1634, 5, 448, 225, 2, 1634, 1636, 5, 446, 224, 2, 1635, 1637, 5, 272, 137, 2, 1636, 1635, 3, 2, 2, 2, 1636, 1637, 3, 2, 2, 2, 1637, 1639, 3, 2, 2, 2, 1638, 1640, 5, 222, 112, 2, 1639, 1638, 3, 2, 2, 2, 1639, 1640, 3, 2, 2, 2, 1640, 1641, 3, 2, 2, 2, 1641, 1645, 5, 588, 295, 2, 1642, 1643, 5, 332, 167, 2, 1643, 1644, 7, 16, 2, 2, 1644, 1646, 3, 2, 2, 2, 1645, 1642, 3, 2, 2, 2, 1645, 1646, 3, 2, 2, 2, 1646, 1647, 3, 2, 2, 2, 1647, 1648, 5, 334, 168, 2, 1648, 1649, 5, 668, 335, 2, 1649, 1650, 5, 224, 113, 2, 1650, 1651, 5, 670, 336, 2, 1651, 1655, 5, 654, 328, 2, 1652, 1656, 5, 480, 241, 2, 1653, 1656, 5, 484, 243, 2, 1654, 1656, 5, 482, 242, 2, 1655, 1652, 3, 2, 2, 2, 1655, 1653, 3, 2, 2, 2, 1655, 1654, 3, 2, 2, 2, 1656, 1668, 3, 2, 2, 2, 1657, 1658, 5, 662, 332, 2, 1658, 1659, 5, 590, 296, 2, 1659, 1660, 7, 222, 2, 2, 1660, 1662, 7, 5, 2, 2, 1661, 1663, 5, 204, 103, 2, 1662, 1661, 3, 2, 2, 2, 1663, 1664, 3, 2, 2, 2, 1664, 1662, 3, 2, 2, 2, 1664, 1665, 3, 2, 2, 2, 1665, 1666, 3, 2, 2, 2, 1666, 1667, 7, 6, 2, 2, 1667, 1669, 3, 2, 2, 2, 1668, 1657, 3, 2, 2, 2, 1668, 1669, 3, 2, 2, 2, 1669, 1671, 3, 2, 2, 2, 1670, 1613, 3, 2, 2, 2, 1670, 1632, 3, 2, 2, 2, 1671, 203, 3, 2, 2, 2, 1672, 1673, 5, 540, 271, 2, 1673, 1674, 7, 11, 2, 2, 1674, 1676, 5, 328, 165, 2, 1675, 1677, 7, 9, 2, 2, 1676, 1675, 3, 2, 2, 2, 1676, 1677, 3, 2, 2, 2, 1677, 1769, 3, 2, 2, 2, 1678, 1679, 5, 454, 228, 2, 1679, 1680, 7, 11, 2, 2, 1680, 1682, 5, 328, 165, 2, 1681, 1683, 7, 9, 2, 2, 1682, 1681, 3, 2, 2, 2, 1682, 1683, 3, 2, 2, 2, 1683, 1769, 3, 2, 2, 2, 1684, 1685, 5, 452, 227, 2, 1685, 1686, 7, 11, 2, 2, 1686, 1688, 5, 328, 165, 2, 1687, 1689, 7, 9, 2, 2, 1688, 1687, 3, 2, 2, 2, 1688, 1689, 3, 2, 2, 2, 1689, 1769, 3, 2, 2, 2, 1690, 1691, 5, 456, 229, 2, 1691, 1692, 7, 11, 2, 2, 1692, 1694, 5, 328, 165, 2, 1693, 1695, 7, 9, 2, 2, 1694, 1693, 3, 2, 2, 2, 1694, 1695, 3, 2, 2, 2, 1695, 1769, 3, 2, 2, 2, 1696, 1697, 5, 458, 230, 2, 1697, 1698, 7, 11, 2, 2, 1698, 1700, 5, 328, 165, 2, 1699, 1701, 7, 9, 2, 2, 1700, 1699, 3, 2, 2, 2, 1700, 1701, 3, 2, 2, 2, 1701, 1769, 3, 2, 2, 2, 1702, 1703, 5, 462, 232, 2, 1703, 1704, 7, 11, 2, 2, 1704, 1706, 5, 328, 165, 2, 1705, 1707, 7, 9, 2, 2, 1706, 1705, 3, 2, 2, 2, 1706, 1707, 3, 2, 2, 2, 1707, 1769, 3, 2, 2, 2, 1708, 1709, 5, 468, 235, 2, 1709, 1710, 7, 11, 2, 2, 1710, 1712, 5, 328, 165, 2, 1711, 1713, 7, 9, 2, 2, 1712, 1711, 3, 2, 2, 2, 1712, 1713, 3, 2, 2, 2, 1713, 1769, 3, 2, 2, 2, 1714, 1715, 5, 470, 236, 2, 1715, 1716, 7, 11, 2, 2, 1716, 1718, 5, 328, 165, 2, 1717, 1719, 7, 9, 2, 2, 1718, 1717, 3, 2, 2, 2, 1718, 1719, 3, 2, 2, 2, 1719, 1769, 3, 2, 2, 2, 1720, 1721, 5, 474, 238, 2, 1721, 1722, 7, 11, 2, 2, 1722, 1724, 5, 328, 165, 2, 1723, 1725, 7, 9, 2, 2, 1724, 1723, 3, 2, 2, 2, 1724, 1725, 3, 2, 2, 2, 1725, 1769, 3, 2, 2, 2, 1726, 1727, 5, 472, 237, 2, 1727, 1728, 7, 11, 2, 2, 1728, 1730, 5, 328, 165, 2, 1729, 1731, 7, 9, 2, 2, 1730, 1729, 3, 2, 2, 2, 1730, 1731, 3, 2, 2, 2, 1731, 1769, 3, 2, 2, 2, 1732, 1733, 5, 460, 231, 2, 1733, 1734, 7, 11, 2, 2, 1734, 1736, 5, 326, 164, 2, 1735, 1737, 7, 9, 2, 2, 1736, 1735, 3, 2, 2, 2, 1736, 1737, 3, 2, 2, 2, 1737, 1769, 3, 2, 2, 2, 1738, 1739, 5, 476, 239, 2, 1739, 1740, 7, 11, 2, 2, 1740, 1742, 5, 326, 164, 2, 1741, 1743, 7, 9, 2, 2, 1742, 1741, 3, 2, 2, 2, 1742, 1743, 3, 2, 2, 2, 1743, 1769, 3, 2, 2, 2, 1744, 1745, 5, 478, 240, 2, 1745, 1746, 7, 11, 2, 2, 1746, 1748, 5, 326, 164, 2, 1747, 1749, 7, 9, 2, 2, 1748, 1747, 3, 2, 2, 2, 1748, 1749, 3, 2, 2, 2, 1749, 1769, 3, 2, 2, 2, 1750, 1751, 5, 466, 234, 2, 1751, 1752, 7, 11, 2, 2, 1752, 1754, 5, 326, 164, 2, 1753, 1755, 7, 9, 2, 2, 1754, 1753, 3, 2, 2, 2, 1754, 1755, 3, 2, 2, 2, 1755, 1769, 3, 2, 2, 2, 1756, 1757, 5, 464, 233, 2, 1757, 1758, 7, 11, 2, 2, 1758, 1760, 5, 326, 164, 2, 1759, 1761, 7, 9, 2, 2, 1760, 1759, 3, 2, 2, 2, 1760, 1761, 3, 2, 2, 2, 1761, 1769, 3, 2, 2, 2, 1762, 1763, 5, 542, 272, 2, 1763, 1764, 7, 11, 2, 2, 1764, 1766, 5, 326, 164, 2, 1765, 1767, 7, 9, 2, 2, 1766, 1765, 3, 2, 2, 2, 1766, 1767, 3, 2, 2, 2, 1767, 1769, 3, 2, 2, 2, 1768, 1672, 3, 2, 2, 2, 1768, 1678, 3, 2, 2, 2, 1768, 1684, 3, 2, 2, 2, 1768, 1690, 3, 2, 2, 2, 1768, 1696, 3, 2, 2, 2, 1768, 1702, 3, 2, 2, 2, 1768, 1708, 3, 2, 2, 2, 1768, 1714, 3, 2, 2, 2, 1768, 1720, 3, 2, 2, 2, 1768, 1726, 3, 2, 2, 2, 1768, 1732, 3, 2, 2, 2, 1768, 1738, 3, 2, 2, 2, 1768, 1744, 3, 2, 2, 2, 1768, 1750, 3, 2, 2, 2, 1768, 1756, 3, 2, 2, 2, 1768, 1762, 3, 2, 2, 2, 1769, 205, 3, 2, 2, 2, 1770, 1771, 5, 408, 205, 2, 1771, 1772, 5, 450, 226, 2, 1772, 1774, 5, 446, 224, 2, 1773, 1775, 5, 272, 137, 2, 1774, 1773, 3, 2, 2, 2, 1774, 1775, 3, 2, 2, 2, 1775, 1776, 3, 2, 2, 2, 1776, 1780, 5, 588, 295, 2, 1777, 1778, 5, 332, 167, 2, 1778, 1779, 7, 16, 2, 2, 1779, 1781, 3, 2, 2, 2, 1780, 1777, 3, 2, 2, 2, 1780, 1781, 3, 2, 2, 2, 1781, 1782, 3, 2, 2, 2, 1782, 1809, 5, 334, 168, 2, 1783, 1787, 7, 145, 2, 2, 1784, 1785, 5, 504, 253, 2, 1785, 1786, 5, 218, 110, 2, 1786, 1788, 3, 2, 2, 2, 1787, 1784, 3, 2, 2, 2, 1787, 1788, 3, 2, 2, 2, 1788, 1795, 3, 2, 2, 2, 1789, 1791, 5, 384, 193, 2, 1790, 1789, 3, 2, 2, 2, 1790, 1791, 3, 2, 2, 2, 1791, 1792, 3, 2, 2, 2, 1792, 1793, 5, 506, 254, 2, 1793, 1794, 5, 216, 109, 2, 1794, 1796, 3, 2, 2, 2, 1795, 1790, 3, 2, 2, 2, 1795, 1796, 3, 2, 2, 2, 1796, 1801, 3, 2, 2, 2, 1797, 1799, 5, 384, 193, 2, 1798, 1797, 3, 2, 2, 2, 1798, 1799, 3, 2, 2, 2, 1799, 1800, 3, 2, 2, 2, 1800, 1802, 5, 208, 105, 2, 1801, 1798, 3, 2, 2, 2, 1801, 1802, 3, 2, 2, 2, 1802, 1807, 3, 2, 2, 2, 1803, 1805, 5, 384, 193, 2, 1804, 1803, 3, 2, 2, 2, 1804, 1805, 3, 2, 2, 2, 1805, 1806, 3, 2, 2, 2, 1806, 1808, 5, 212, 107, 2, 1807, 1804, 3, 2, 2, 2, 1807, 1808, 3, 2, 2, 2, 1808, 1810, 3, 2, 2, 2, 1809, 1783, 3, 2, 2, 2, 1809, 1810, 3, 2, 2, 2, 1810, 207, 3, 2, 2, 2, 1811, 1812, 5, 508, 255, 2, 1812, 1817, 7, 5, 2, 2, 1813, 1814, 5, 510, 256, 2, 1814, 1815, 7, 11, 2, 2, 1815, 1816, 5, 322, 162, 2, 1816, 1818, 3, 2, 2, 2, 1817, 1813, 3, 2, 2, 2, 1817, 1818, 3, 2, 2, 2, 1818, 1826, 3, 2, 2, 2, 1819, 1821, 5, 684, 343, 2, 1820, 1819, 3, 2, 2, 2, 1820, 1821, 3, 2, 2, 2, 1821, 1822, 3, 2, 2, 2, 1822, 1823, 5, 512, 257, 2, 1823, 1824, 7, 11, 2, 2, 1824, 1825, 5, 326, 164, 2, 1825, 1827, 3, 2, 2, 2, 1826, 1820, 3, 2, 2, 2, 1826, 1827, 3, 2, 2, 2, 1827, 1835, 3, 2, 2, 2, 1828, 1830, 5, 684, 343, 2, 1829, 1828, 3, 2, 2, 2, 1829, 1830, 3, 2, 2, 2, 1830, 1831, 3, 2, 2, 2, 1831, 1832, 5, 514, 258, 2, 1832, 1833, 7, 11, 2, 2, 1833, 1834, 5, 210, 106, 2, 1834, 1836, 3, 2, 2, 2, 1835, 1829, 3, 2, 2, 2, 1835, 1836, 3, 2, 2, 2, 1836, 1844, 3, 2, 2, 2, 1837, 1839, 5, 684, 343, 2, 1838, 1837, 3, 2, 2, 2, 1838, 1839, 3, 2, 2, 2, 1839, 1840, 3, 2, 2, 2, 1840, 1841, 5, 516, 259, 2, 1841, 1842, 7, 11, 2, 2, 1842, 1843, 5, 322, 162, 2, 1843, 1845, 3, 2, 2, 2, 1844, 1838, 3, 2, 2, 2, 1844, 1845, 3, 2, 2, 2, 1845, 1853, 3, 2, 2, 2, 1846, 1848, 5, 684, 343, 2, 1847, 1846, 3, 2, 2, 2, 1847, 1848, 3, 2, 2, 2, 1848, 1849, 3, 2, 2, 2, 1849, 1850, 5, 518, 260, 2, 1850, 1851, 7, 11, 2, 2, 1851, 1852, 5, 322, 162, 2, 1852, 1854, 3, 2, 2, 2, 1853, 1847, 3, 2, 2, 2, 1853, 1854, 3, 2, 2, 2, 1854, 1862, 3, 2, 2, 2, 1855, 1857, 5, 684, 343, 2, 1856, 1855, 3, 2, 2, 2, 1856, 1857, 3, 2, 2, 2, 1857, 1858, 3, 2, 2, 2, 1858, 1859, 5, 520, 261, 2, 1859, 1860, 7, 11, 2, 2, 1860, 1861, 5, 326, 164, 2, 1861, 1863, 3, 2, 2, 2, 1862, 1856, 3, 2, 2, 2, 1862, 1863, 3, 2, 2, 2, 1863, 1871, 3, 2, 2, 2, 1864, 1866, 5, 684, 343, 2, 1865, 1864, 3, 2, 2, 2, 1865, 1866, 3, 2, 2, 2, 1866, 1867, 3, 2, 2, 2, 1867, 1868, 5, 522, 262, 2, 1868, 1869, 7, 11, 2, 2, 1869, 1870, 5, 322, 162, 2, 1870, 1872, 3, 2, 2, 2, 1871, 1865, 3, 2, 2, 2, 1871, 1872, 3, 2, 2, 2, 1872, 1880, 3, 2, 2, 2, 1873, 1875, 5, 684, 343, 2, 1874, 1873, 3, 2, 2, 2, 1874, 1875, 3, 2, 2, 2, 1875, 1876, 3, 2, 2, 2, 1876, 1877, 5, 524, 263, 2, 1877, 1878, 7, 11, 2, 2, 1878, 1879, 5, 322, 162, 2, 1879, 1881, 3, 2, 2, 2, 1880, 1874, 3, 2, 2, 2, 1880, 1881, 3, 2, 2, 2, 1881, 1889, 3, 2, 2, 2, 1882, 1884, 5, 684, 343, 2, 1883, 1882, 3, 2, 2, 2, 1883, 1884, 3, 2, 2, 2, 1884, 1885, 3, 2, 2, 2, 1885, 1886, 5, 526, 264, 2, 1886, 1887, 7, 11, 2, 2, 1887, 1888, 5, 322, 162, 2, 1888, 1890, 3, 2, 2, 2, 1889, 1883, 3, 2, 2, 2, 1889, 1890, 3, 2, 2, 2, 1890, 1898, 3, 2, 2, 2, 1891, 1893, 5, 684, 343, 2, 1892, 1891, 3, 2, 2, 2, 1892, 1893, 3, 2, 2, 2, 1893, 1894, 3, 2, 2, 2, 1894, 1895, 5, 528, 265, 2, 1895, 1896, 7, 11, 2, 2, 1896, 1897, 5, 328, 165, 2, 1897, 1899, 3, 2, 2, 2, 1898, 1892, 3, 2, 2, 2, 1898, 1899, 3, 2, 2, 2, 1899, 1900, 3, 2, 2, 2, 1900, 1901, 7, 6, 2, 2, 1901, 209, 3, 2, 2, 2, 1902, 1905, 5, 536, 269, 2, 1903, 1905, 5, 538, 270, 2, 1904, 1902, 3, 2, 2, 2, 1904, 1903, 3, 2, 2, 2, 1905, 211, 3, 2, 2, 2, 1906, 1907, 5, 590, 296, 2, 1907, 1912, 7, 5, 2, 2, 1908, 1909, 5, 530, 266, 2, 1909, 1910, 7, 11, 2, 2, 1910, 1911, 5, 328, 165, 2, 1911, 1913, 3, 2, 2, 2, 1912, 1908, 3, 2, 2, 2, 1912, 1913, 3, 2, 2, 2, 1913, 1921, 3, 2, 2, 2, 1914, 1916, 5, 684, 343, 2, 1915, 1914, 3, 2, 2, 2, 1915, 1916, 3, 2, 2, 2, 1916, 1917, 3, 2, 2, 2, 1917, 1918, 5, 532, 267, 2, 1918, 1919, 7, 11, 2, 2, 1919, 1920, 5, 328, 165, 2, 1920, 1922, 3, 2, 2, 2, 1921, 1915, 3, 2, 2, 2, 1921, 1922, 3, 2, 2, 2, 1922, 1930, 3, 2, 2, 2, 1923, 1925, 5, 684, 343, 2, 1924, 1923, 3, 2, 2, 2, 1924, 1925, 3, 2, 2, 2, 1925, 1926, 3, 2, 2, 2, 1926, 1927, 5, 534, 268, 2, 1927, 1928, 7, 11, 2, 2, 1928, 1929, 5, 328, 165, 2, 1929, 1931, 3, 2, 2, 2, 1930, 1924, 3, 2, 2, 2, 1930, 1931, 3, 2, 2, 2, 1931, 1932, 3, 2, 2, 2, 1932, 1933, 7, 6, 2, 2, 1933, 213, 3, 2, 2, 2, 1934, 1939, 5, 488, 245, 2, 1935, 1939, 5, 486, 244, 2, 1936, 1939, 5, 490, 246, 2, 1937, 1939, 5, 492, 247, 2, 1938, 1934, 3, 2, 2, 2, 1938, 1935, 3, 2, 2, 2, 1938, 1936, 3, 2, 2, 2, 1938, 1937, 3, 2, 2, 2, 1939, 215, 3, 2, 2, 2, 1940, 1946, 5, 214, 108, 2, 1941, 1942, 5, 684, 343, 2, 1942, 1943, 5, 214, 108, 2, 1943, 1945, 3, 2, 2, 2, 1944, 1941, 3, 2, 2, 2, 1945, 1948, 3, 2, 2, 2, 1946, 1944, 3, 2, 2, 2, 1946, 1947, 3, 2, 2, 2, 1947, 217, 3, 2, 2, 2, 1948, 1946, 3, 2, 2, 2, 1949, 1955, 5, 220, 111, 2, 1950, 1951, 5, 684, 343, 2, 1951, 1952, 5, 220, 111, 2, 1952, 1954, 3, 2, 2, 2, 1953, 1950, 3, 2, 2, 2, 1954, 1957, 3, 2, 2, 2, 1955, 1953, 3, 2, 2, 2, 1955, 1956, 3, 2, 2, 2, 1956, 219, 3, 2, 2, 2, 1957, 1955, 3, 2, 2, 2, 1958, 2003, 5, 336, 169, 2, 1959, 1964, 7, 5, 2, 2, 1960, 1961, 5, 494, 248, 2, 1961, 1962, 7, 11, 2, 2, 1962, 1963, 5, 328, 165, 2, 1963, 1965, 3, 2, 2, 2, 1964, 1960, 3, 2, 2, 2, 1964, 1965, 3, 2, 2, 2, 1965, 1973, 3, 2, 2, 2, 1966, 1968, 5, 684, 343, 2, 1967, 1966, 3, 2, 2, 2, 1967, 1968, 3, 2, 2, 2, 1968, 1969, 3, 2, 2, 2, 1969, 1970, 5, 496, 249, 2, 1970, 1971, 7, 11, 2, 2, 1971, 1972, 5, 328, 165, 2, 1972, 1974, 3, 2, 2, 2, 1973, 1967, 3, 2, 2, 2, 1973, 1974, 3, 2, 2, 2, 1974, 1982, 3, 2, 2, 2, 1975, 1977, 5, 684, 343, 2, 1976, 1975, 3, 2, 2, 2, 1976, 1977, 3, 2, 2, 2, 1977, 1978, 3, 2, 2, 2, 1978, 1979, 5, 498, 250, 2, 1979, 1980, 7, 11, 2, 2, 1980, 1981, 5, 328, 165, 2, 1981, 1983, 3, 2, 2, 2, 1982, 1976, 3, 2, 2, 2, 1982, 1983, 3, 2, 2, 2, 1983, 1991, 3, 2, 2, 2, 1984, 1986, 5, 684, 343, 2, 1985, 1984, 3, 2, 2, 2, 1985, 1986, 3, 2, 2, 2, 1986, 1987, 3, 2, 2, 2, 1987, 1988, 5, 500, 251, 2, 1988, 1989, 7, 11, 2, 2, 1989, 1990, 5, 328, 165, 2, 1990, 1992, 3, 2, 2, 2, 1991, 1985, 3, 2, 2, 2, 1991, 1992, 3, 2, 2, 2, 1992, 2000, 3, 2, 2, 2, 1993, 1995, 5, 684, 343, 2, 1994, 1993, 3, 2, 2, 2, 1994, 1995, 3, 2, 2, 2, 1995, 1996, 3, 2, 2, 2, 1996, 1997, 5, 502, 252, 2, 1997, 1998, 7, 11, 2, 2, 1998, 1999, 5, 328, 165, 2, 1999, 2001, 3, 2, 2, 2, 2000, 1994, 3, 2, 2, 2, 2000, 2001, 3, 2, 2, 2, 2001, 2002, 3, 2, 2, 2, 2002, 2004, 7, 6, 2, 2, 2003, 1959, 3, 2, 2, 2, 2003, 2004, 3, 2, 2, 2, 2004, 2053, 3, 2, 2, 2, 2005, 2050, 7, 17, 2, 2, 2006, 2011, 7, 5, 2, 2, 2007, 2008, 5, 494, 248, 2, 2008, 2009, 7, 11, 2, 2, 2009, 2010, 5, 328, 165, 2, 2010, 2012, 3, 2, 2, 2, 2011, 2007, 3, 2, 2, 2, 2011, 2012, 3, 2, 2, 2, 2012, 2020, 3, 2, 2, 2, 2013, 2015, 5, 684, 343, 2, 2014, 2013, 3, 2, 2, 2, 2014, 2015, 3, 2, 2, 2, 2015, 2016, 3, 2, 2, 2, 2016, 2017, 5, 496, 249, 2, 2017, 2018, 7, 11, 2, 2, 2018, 2019, 5, 328, 165, 2, 2019, 2021, 3, 2, 2, 2, 2020, 2014, 3, 2, 2, 2, 2020, 2021, 3, 2, 2, 2, 2021, 2029, 3, 2, 2, 2, 2022, 2024, 5, 684, 343, 2, 2023, 2022, 3, 2, 2, 2, 2023, 2024, 3, 2, 2, 2, 2024, 2025, 3, 2, 2, 2, 2025, 2026, 5, 498, 250, 2, 2026, 2027, 7, 11, 2, 2, 2027, 2028, 5, 328, 165, 2, 2028, 2030, 3, 2, 2, 2, 2029, 2023, 3, 2, 2, 2, 2029, 2030, 3, 2, 2, 2, 2030, 2038, 3, 2, 2, 2, 2031, 2033, 5, 684, 343, 2, 2032, 2031, 3, 2, 2, 2, 2032, 2033, 3, 2, 2, 2, 2033, 2034, 3, 2, 2, 2, 2034, 2035, 5, 500, 251, 2, 2035, 2036, 7, 11, 2, 2, 2036, 2037, 5, 328, 165, 2, 2037, 2039, 3, 2, 2, 2, 2038, 2032, 3, 2, 2, 2, 2038, 2039, 3, 2, 2, 2, 2039, 2047, 3, 2, 2, 2, 2040, 2042, 5, 684, 343, 2, 2041, 2040, 3, 2, 2, 2, 2041, 2042, 3, 2, 2, 2, 2042, 2043, 3, 2, 2, 2, 2043, 2044, 5, 502, 252, 2, 2044, 2045, 7, 11, 2, 2, 2045, 2046, 5, 328, 165, 2, 2046, 2048, 3, 2, 2, 2, 2047, 2041, 3, 2, 2, 2, 2047, 2048, 3, 2, 2, 2, 2048, 2049, 3, 2, 2, 2, 2049, 2051, 7, 6, 2, 2, 2050, 2006, 3, 2, 2, 2, 2050, 2051, 3, 2, 2, 2, 2051, 2053, 3, 2, 2, 2, 2052, 1958, 3, 2, 2, 2, 2052, 2005, 3, 2, 2, 2, 2053, 221, 3, 2, 2, 2, 2054, 2057, 5, 688, 345, 2, 2055, 2057, 5, 326, 164, 2, 2056, 2054, 3, 2, 2, 2, 2056, 2055, 3, 2, 2, 2, 2057, 223, 3, 2, 2, 2, 2058, 2064, 5, 336, 169, 2, 2059, 2064, 5, 226, 114, 2, 2060, 2064, 5, 228, 115, 2, 2061, 2064, 5, 230, 116, 2, 2062, 2064, 5, 232, 117, 2, 2063, 2058, 3, 2, 2, 2, 2063, 2059, 3, 2, 2, 2, 2063, 2060, 3, 2, 2, 2, 2063, 2061, 3, 2, 2, 2, 2063, 2062, 3, 2, 2, 2, 2064, 225, 3, 2, 2, 2, 2065, 2066, 5, 558, 280, 2, 2066, 2067, 5, 668, 335, 2, 2067, 2068, 5, 336, 169, 2, 2068, 2069, 5, 670, 336, 2, 2069, 227, 3, 2, 2, 2, 2070, 2071, 5, 422, 212, 2, 2071, 2072, 5, 668, 335, 2, 2072, 2073, 5, 336, 169, 2, 2073, 2074, 5, 670, 336, 2, 2074, 229, 3, 2, 2, 2, 2075, 2076, 5, 434, 218, 2, 2076, 2077, 5, 668, 335, 2, 2077, 2078, 5, 336, 169, 2, 2078, 2079, 5, 670, 336, 2, 2079, 231, 3, 2, 2, 2, 2080, 2081, 5, 656, 329, 2, 2081, 2082, 5, 668, 335, 2, 2082, 2083, 5, 336, 169, 2, 2083, 2084, 5, 670, 336, 2, 2084, 233, 3, 2, 2, 2, 2085, 2087, 5, 186, 94, 2, 2086, 2085, 3, 2, 2, 2, 2086, 2087, 3, 2, 2, 2, 2087, 2088, 3, 2, 2, 2, 2088, 2090, 5, 410, 206, 2, 2089, 2091, 5, 236, 119, 2, 2090, 2089, 3, 2, 2, 2, 2090, 2091, 3, 2, 2, 2, 2091, 2092, 3, 2, 2, 2, 2092, 2094, 5, 292, 147, 2, 2093, 2095, 5, 270, 136, 2, 2094, 2093, 3, 2, 2, 2, 2094, 2095, 3, 2, 2, 2, 2095, 2096, 3, 2, 2, 2, 2096, 2099, 5, 300, 151, 2, 2097, 2100, 5, 274, 138, 2, 2098, 2100, 5, 242, 122, 2, 2099, 2097, 3, 2, 2, 2, 2099, 2098, 3, 2, 2, 2, 2099, 2100, 3, 2, 2, 2, 2100, 235, 3, 2, 2, 2, 2101, 2107, 5, 238, 120, 2, 2102, 2103, 5, 684, 343, 2, 2103, 2104, 5, 238, 120, 2, 2104, 2106, 3, 2, 2, 2, 2105, 2102, 3, 2, 2, 2, 2106, 2109, 3, 2, 2, 2, 2107, 2105, 3, 2, 2, 2, 2107, 2108, 3, 2, 2, 2, 2108, 237, 3, 2, 2, 2, 2109, 2107, 3, 2, 2, 2, 2110, 2120, 5, 688, 345, 2, 2111, 2112, 5, 688, 345, 2, 2112, 2115, 7, 7, 2, 2, 2113, 2116, 5, 326, 164, 2, 2114, 2116, 5, 322, 162, 2, 2115, 2113, 3, 2, 2, 2, 2115, 2114, 3, 2, 2, 2, 2116, 2117, 3, 2, 2, 2, 2117, 2118, 7, 8, 2, 2, 2118, 2120, 3, 2, 2, 2, 2119, 2110, 3, 2, 2, 2, 2119, 2111, 3, 2, 2, 2, 2120, 239, 3, 2, 2, 2, 2121, 2123, 5, 186, 94, 2, 2122, 2121, 3, 2, 2, 2, 2122, 2123, 3, 2, 2, 2, 2123, 2124, 3, 2, 2, 2, 2124, 2128, 5, 646, 324, 2, 2125, 2126, 5, 332, 167, 2, 2126, 2127, 7, 16, 2, 2, 2127, 2129, 3, 2, 2, 2, 2128, 2125, 3, 2, 2, 2, 2128, 2129, 3, 2, 2, 2, 2129, 2130, 3, 2, 2, 2, 2130, 2132, 5, 334, 168, 2, 2131, 2133, 5, 264, 133, 2, 2132, 2131, 3, 2, 2, 2, 2132, 2133, 3, 2, 2, 2, 2133, 2134, 3, 2, 2, 2, 2134, 2135, 5, 620, 311, 2, 2135, 2136, 5, 248, 125, 2, 2136, 2139, 5, 300, 151, 2, 2137, 2140, 5, 274, 138, 2, 2138, 2140, 5, 242, 122, 2, 2139, 2137, 3, 2, 2, 2, 2139, 2138, 3, 2, 2, 2, 2139, 2140, 3, 2, 2, 2, 2140, 241, 3, 2, 2, 2, 2141, 2142, 5, 442, 222, 2, 2142, 2143, 5, 244, 123, 2, 2143, 243, 3, 2, 2, 2, 2144, 2150, 5, 246, 124, 2, 2145, 2146, 5, 384, 193, 2, 2146, 2147, 5, 246, 124, 2, 2147, 2149, 3, 2, 2, 2, 2148, 2145, 3, 2, 2, 2, 2149, 2152, 3, 2, 2, 2, 2150, 2148, 3, 2, 2, 2, 2150, 2151, 3, 2, 2, 2, 2151, 245, 3, 2, 2, 2, 2152, 2150, 3, 2, 2, 2, 2153, 2154, 5, 688, 345, 2, 2154, 2155, 7, 222, 2, 2, 2155, 2156, 5, 320, 161, 2, 2156, 247, 3, 2, 2, 2, 2157, 2163, 5, 250, 126, 2, 2158, 2159, 5, 684, 343, 2, 2159, 2160, 5, 250, 126, 2, 2160, 2162, 3, 2, 2, 2, 2161, 2158, 3, 2, 2, 2, 2162, 2165, 3, 2, 2, 2, 2163, 2161, 3, 2, 2, 2, 2163, 2164, 3, 2, 2, 2, 2164, 249, 3, 2, 2, 2, 2165, 2163, 3, 2, 2, 2, 2166, 2167, 5, 688, 345, 2, 2167, 2172, 7, 222, 2, 2, 2168, 2173, 5, 320, 161, 2, 2169, 2173, 5, 254, 128, 2, 2170, 2173, 5, 252, 127, 2, 2171, 2173, 5, 258, 130, 2, 2172, 2168, 3, 2, 2, 2, 2172, 2169, 3, 2, 2, 2, 2172, 2170, 3, 2, 2, 2, 2172, 2171, 3, 2, 2, 2, 2173, 2224, 3, 2, 2, 2, 2174, 2175, 5, 688, 345, 2, 2175, 2176, 7, 222, 2, 2, 2176, 2177, 5, 688, 345, 2, 2177, 2178, 9, 3, 2, 2, 2178, 2179, 5, 322, 162, 2, 2179, 2224, 3, 2, 2, 2, 2180, 2181, 5, 688, 345, 2, 2181, 2182, 7, 222, 2, 2, 2182, 2183, 5, 688, 345, 2, 2183, 2184, 9, 3, 2, 2, 2184, 2185, 5, 252, 127, 2, 2185, 2224, 3, 2, 2, 2, 2186, 2187, 5, 688, 345, 2, 2187, 2188, 7, 222, 2, 2, 2188, 2189, 5, 252, 127, 2, 2189, 2190, 9, 3, 2, 2, 2190, 2191, 5, 688, 345, 2, 2191, 2224, 3, 2, 2, 2, 2192, 2193, 5, 688, 345, 2, 2193, 2194, 7, 222, 2, 2, 2194, 2195, 5, 688, 345, 2, 2195, 2196, 9, 3, 2, 2, 2196, 2197, 5, 254, 128, 2, 2197, 2224, 3, 2, 2, 2, 2198, 2199, 5, 688, 345, 2, 2199, 2200, 7, 222, 2, 2, 2200, 2201, 5, 254, 128, 2, 2201, 2202, 9, 3, 2, 2, 2202, 2203, 5, 688, 345, 2, 2203, 2224, 3, 2, 2, 2, 2204, 2205, 5, 688, 345, 2, 2205, 2206, 7, 222, 2, 2, 2206, 2207, 5, 688, 345, 2, 2207, 2208, 9, 3, 2, 2, 2208, 2209, 5, 258, 130, 2, 2209, 2224, 3, 2, 2, 2, 2210, 2211, 5, 688, 345, 2, 2211, 2212, 7, 222, 2, 2, 2212, 2213, 5, 258, 130, 2, 2213, 2214, 9, 3, 2, 2, 2214, 2215, 5, 688, 345, 2, 2215, 2224, 3, 2, 2, 2, 2216, 2217, 5, 688, 345, 2, 2217, 2218, 5, 680, 341, 2, 2218, 2219, 5, 322, 162, 2, 2219, 2220, 5, 682, 342, 2, 2220, 2221, 7, 222, 2, 2, 2221, 2222, 5, 320, 161, 2, 2222, 2224, 3, 2, 2, 2, 2223, 2166, 3, 2, 2, 2, 2223, 2174, 3, 2, 2, 2, 2223, 2180, 3, 2, 2, 2, 2223, 2186, 3, 2, 2, 2, 2223, 2192, 3, 2, 2, 2, 2223, 2198, 3, 2, 2, 2, 2223, 2204, 3, 2, 2, 2, 2223, 2210, 3, 2, 2, 2, 2223, 2216, 3, 2, 2, 2, 2224, 251, 3, 2, 2, 2, 2225, 2235, 5, 672, 337, 2, 2226, 2232, 5, 320, 161, 2, 2227, 2228, 5, 684, 343, 2, 2228, 2229, 5, 284, 143, 2, 2229, 2231, 3, 2, 2, 2, 2230, 2227, 3, 2, 2, 2, 2231, 2234, 3, 2, 2, 2, 2232, 2230, 3, 2, 2, 2, 2232, 2233, 3, 2, 2, 2, 2233, 2236, 3, 2, 2, 2, 2234, 2232, 3, 2, 2, 2, 2235, 2226, 3, 2, 2, 2, 2235, 2236, 3, 2, 2, 2, 2236, 2237, 3, 2, 2, 2, 2237, 2238, 5, 674, 338, 2, 2238, 253, 3, 2, 2, 2, 2239, 2240, 5, 672, 337, 2, 2240, 2241, 5, 320, 161, 2, 2241, 2242, 5, 686, 344, 2, 2242, 2243, 5, 284, 143, 2, 2243, 2251, 3, 2, 2, 2, 2244, 2245, 5, 684, 343, 2, 2245, 2246, 5, 320, 161, 2, 2246, 2247, 5, 686, 344, 2, 2247, 2248, 5, 284, 143, 2, 2248, 2250, 3, 2, 2, 2, 2249, 2244, 3, 2, 2, 2, 2250, 2253, 3, 2, 2, 2, 2251, 2249, 3, 2, 2, 2, 2251, 2252, 3, 2, 2, 2, 2252, 2254, 3, 2, 2, 2, 2253, 2251, 3, 2, 2, 2, 2254, 2255, 5, 674, 338, 2, 2255, 255, 3, 2, 2, 2, 2256, 2257, 5, 672, 337, 2, 2257, 2263, 5, 284, 143, 2, 2258, 2259, 5, 684, 343, 2, 2259, 2260, 5, 284, 143, 2, 2260, 2262, 3, 2, 2, 2, 2261, 2258, 3, 2, 2, 2, 2262, 2265, 3, 2, 2, 2, 2263, 2261, 3, 2, 2, 2, 2263, 2264, 3, 2, 2, 2, 2264, 2266, 3, 2, 2, 2, 2265, 2263, 3, 2, 2, 2, 2266, 2267, 5, 674, 338, 2, 2267, 257, 3, 2, 2, 2, 2268, 2269, 5, 680, 341, 2, 2269, 2275, 5, 320, 161, 2, 2270, 2271, 5, 684, 343, 2, 2271, 2272, 5, 284, 143, 2, 2272, 2274, 3, 2, 2, 2, 2273, 2270, 3, 2, 2, 2, 2274, 2277, 3, 2, 2, 2, 2275, 2273, 3, 2, 2, 2, 2275, 2276, 3, 2, 2, 2, 2276, 2278, 3, 2, 2, 2, 2277, 2275, 3, 2, 2, 2, 2278, 2279, 5, 682, 342, 2, 2279, 259, 3, 2, 2, 2, 2280, 2309, 5, 668, 335, 2, 2281, 2298, 5, 284, 143, 2, 2282, 2283, 5, 684, 343, 2, 2283, 2284, 5, 284, 143, 2, 2284, 2286, 3, 2, 2, 2, 2285, 2282, 3, 2, 2, 2, 2286, 2289, 3, 2, 2, 2, 2287, 2285, 3, 2, 2, 2, 2287, 2288, 3, 2, 2, 2, 2288, 2299, 3, 2, 2, 2, 2289, 2287, 3, 2, 2, 2, 2290, 2291, 5, 684, 343, 2, 2291, 2292, 5, 260, 131, 2, 2292, 2294, 3, 2, 2, 2, 2293, 2290, 3, 2, 2, 2, 2294, 2297, 3, 2, 2, 2, 2295, 2293, 3, 2, 2, 2, 2295, 2296, 3, 2, 2, 2, 2296, 2299, 3, 2, 2, 2, 2297, 2295, 3, 2, 2, 2, 2298, 2287, 3, 2, 2, 2, 2298, 2295, 3, 2, 2, 2, 2299, 2310, 3, 2, 2, 2, 2300, 2306, 5, 260, 131, 2, 2301, 2302, 5, 684, 343, 2, 2302, 2303, 5, 260, 131, 2, 2303, 2305, 3, 2, 2, 2, 2304, 2301, 3, 2, 2, 2, 2305, 2308, 3, 2, 2, 2, 2306, 2304, 3, 2, 2, 2, 2306, 2307, 3, 2, 2, 2, 2307, 2310, 3, 2, 2, 2, 2308, 2306, 3, 2, 2, 2, 2309, 2281, 3, 2, 2, 2, 2309, 2300, 3, 2, 2, 2, 2310, 2311, 3, 2, 2, 2, 2311, 2312, 5, 670, 336, 2, 2312, 261, 3, 2, 2, 2, 2313, 2315, 5, 186, 94, 2, 2314, 2313, 3, 2, 2, 2, 2314, 2315, 3, 2, 2, 2, 2315, 2316, 3, 2, 2, 2, 2316, 2317, 5, 548, 275, 2, 2317, 2321, 5, 550, 276, 2, 2318, 2319, 5, 332, 167, 2, 2319, 2320, 7, 16, 2, 2, 2320, 2322, 3, 2, 2, 2, 2321, 2318, 3, 2, 2, 2, 2321, 2322, 3, 2, 2, 2, 2322, 2323, 3, 2, 2, 2, 2323, 2325, 5, 334, 168, 2, 2324, 2326, 5, 278, 140, 2, 2325, 2324, 3, 2, 2, 2, 2325, 2326, 3, 2, 2, 2, 2326, 2327, 3, 2, 2, 2, 2327, 2329, 5, 276, 139, 2, 2328, 2330, 5, 272, 137, 2, 2329, 2328, 3, 2, 2, 2, 2329, 2330, 3, 2, 2, 2, 2330, 2332, 3, 2, 2, 2, 2331, 2333, 5, 264, 133, 2, 2332, 2331, 3, 2, 2, 2, 2332, 2333, 3, 2, 2, 2, 2333, 263, 3, 2, 2, 2, 2334, 2335, 5, 654, 328, 2, 2335, 2336, 5, 268, 135, 2, 2336, 2351, 3, 2, 2, 2, 2337, 2338, 5, 654, 328, 2, 2338, 2339, 5, 268, 135, 2, 2339, 2340, 5, 384, 193, 2, 2340, 2341, 5, 266, 134, 2, 2341, 2351, 3, 2, 2, 2, 2342, 2343, 5, 654, 328, 2, 2343, 2344, 5, 266, 134, 2, 2344, 2351, 3, 2, 2, 2, 2345, 2346, 5, 654, 328, 2, 2346, 2347, 5, 266, 134, 2, 2347, 2348, 5, 384, 193, 2, 2348, 2349, 5, 268, 135, 2, 2349, 2351, 3, 2, 2, 2, 2350, 2334, 3, 2, 2, 2, 2350, 2337, 3, 2, 2, 2, 2350, 2342, 3, 2, 2, 2, 2350, 2345, 3, 2, 2, 2, 2351, 265, 3, 2, 2, 2, 2352, 2353, 5, 632, 317, 2, 2353, 2354, 5, 322, 162, 2, 2354, 267, 3, 2, 2, 2, 2355, 2356, 5, 640, 321, 2, 2356, 2357, 5, 322, 162, 2, 2357, 269, 3, 2, 2, 2, 2358, 2359, 5, 654, 328, 2, 2359, 2360, 5, 266, 134, 2, 2360, 271, 3, 2, 2, 2, 2361, 2362, 5, 442, 222, 2, 2362, 2363, 5, 582, 292, 2, 2363, 2364, 5, 426, 214, 2, 2364, 273, 3, 2, 2, 2, 2365, 2366, 5, 442, 222, 2, 2366, 2367, 5, 426, 214, 2, 2367, 275, 3, 2, 2, 2, 2368, 2369, 5, 656, 329, 2, 2369, 2370, 7, 3, 2, 2, 2370, 2371, 5, 282, 142, 2, 2371, 2372, 7, 4, 2, 2, 2372, 2377, 3, 2, 2, 2, 2373, 2374, 5, 554, 278, 2, 2374, 2375, 5, 320, 161, 2, 2375, 2377, 3, 2, 2, 2, 2376, 2368, 3, 2, 2, 2, 2376, 2373, 3, 2, 2, 2, 2377, 277, 3, 2, 2, 2, 2378, 2379, 7, 3, 2, 2, 2379, 2380, 5, 280, 141, 2, 2380, 2381, 7, 4, 2, 2, 2381, 279, 3, 2, 2, 2, 2382, 2388, 5, 336, 169, 2, 2383, 2384, 5, 684, 343, 2, 2384, 2385, 5, 336, 169, 2, 2385, 2387, 3, 2, 2, 2, 2386, 2383, 3, 2, 2, 2, 2387, 2390, 3, 2, 2, 2, 2388, 2386, 3, 2, 2, 2, 2388, 2389, 3, 2, 2, 2, 2389, 281, 3, 2, 2, 2, 2390, 2388, 3, 2, 2, 2, 2391, 2397, 5, 284, 143, 2, 2392, 2393, 5, 684, 343, 2, 2393, 2394, 5, 284, 143, 2, 2394, 2396, 3, 2, 2, 2, 2395, 2392, 3, 2, 2, 2, 2396, 2399, 3, 2, 2, 2, 2397, 2395, 3, 2, 2, 2, 2397, 2398, 3, 2, 2, 2, 2398, 283, 3, 2, 2, 2, 2399, 2397, 3, 2, 2, 2, 2400, 2407, 5, 320, 161, 2, 2401, 2407, 5, 254, 128, 2, 2402, 2407, 5, 252, 127, 2, 2403, 2407, 5, 258, 130, 2, 2404, 2407, 5, 260, 131, 2, 2405, 2407, 5, 256, 129, 2, 2406, 2400, 3, 2, 2, 2, 2406, 2401, 3, 2, 2, 2, 2406, 2402, 3, 2, 2, 2, 2406, 2403, 3, 2, 2, 2, 2406, 2404, 3, 2, 2, 2, 2406, 2405, 3, 2, 2, 2, 2407, 285, 3, 2, 2, 2, 2408, 2410, 5, 618, 310, 2, 2409, 2411, 5, 302, 152, 2, 2410, 2409, 3, 2, 2, 2, 2410, 2411, 3, 2, 2, 2, 2411, 2413, 3, 2, 2, 2, 2412, 2414, 5, 554, 278, 2, 2413, 2412, 3, 2, 2, 2, 2413, 2414, 3, 2, 2, 2, 2414, 2415, 3, 2, 2, 2, 2415, 2416, 5, 304, 153, 2, 2416, 2418, 5, 292, 147, 2, 2417, 2419, 5, 300, 151, 2, 2418, 2417, 3, 2, 2, 2, 2418, 2419, 3, 2, 2, 2, 2419, 2421, 3, 2, 2, 2, 2420, 2422, 5, 296, 149, 2, 2421, 2420, 3, 2, 2, 2, 2421, 2422, 3, 2, 2, 2, 2422, 2424, 3, 2, 2, 2, 2423, 2425, 5, 290, 146, 2, 2424, 2423, 3, 2, 2, 2, 2424, 2425, 3, 2, 2, 2, 2425, 2427, 3, 2, 2, 2, 2426, 2428, 5, 288, 145, 2, 2427, 2426, 3, 2, 2, 2, 2427, 2428, 3, 2, 2, 2, 2428, 287, 3, 2, 2, 2, 2429, 2430, 5, 380, 191, 2, 2430, 2431, 5, 428, 215, 2, 2431, 289, 3, 2, 2, 2, 2432, 2433, 5, 566, 284, 2, 2433, 2434, 5, 322, 162, 2, 2434, 291, 3, 2, 2, 2, 2435, 2436, 5, 432, 217, 2, 2436, 2437, 5, 294, 148, 2, 2437, 293, 3, 2, 2, 2, 2438, 2444, 5, 688, 345, 2, 2439, 2440, 5, 688, 345, 2, 2440, 2441, 7, 16, 2, 2, 2441, 2442, 5, 688, 345, 2, 2442, 2444, 3, 2, 2, 2, 2443, 2438, 3, 2, 2, 2, 2443, 2439, 3, 2, 2, 2, 2444, 295, 3, 2, 2, 2, 2445, 2446, 5, 594, 298, 2, 2446, 2447, 5, 398, 200, 2, 2447, 2448, 5, 298, 150, 2, 2448, 297, 3, 2, 2, 2, 2449, 2452, 5, 688, 345, 2, 2450, 2453, 5, 390, 196, 2, 2451, 2453, 5, 412, 207, 2, 2452, 2450, 3, 2, 2, 2, 2452, 2451, 3, 2, 2, 2, 2452, 2453, 3, 2, 2, 2, 2453, 299, 3, 2, 2, 2, 2454, 2455, 5, 660, 331, 2, 2455, 2456, 5, 308, 155, 2, 2456, 301, 3, 2, 2, 2, 2457, 2458, 5, 416, 209, 2, 2458, 303, 3, 2, 2, 2, 2459, 2462, 7, 17, 2, 2, 2460, 2462, 5, 306, 154, 2, 2461, 2459, 3, 2, 2, 2, 2461, 2460, 3, 2, 2, 2, 2462, 2468, 3, 2, 2, 2, 2463, 2464, 5, 684, 343, 2, 2464, 2465, 5, 306, 154, 2, 2465, 2467, 3, 2, 2, 2, 2466, 2463, 3, 2, 2, 2, 2467, 2470, 3, 2, 2, 2, 2468, 2466, 3, 2, 2, 2, 2468, 2469, 3, 2, 2, 2, 2469, 305, 3, 2, 2, 2, 2470, 2468, 3, 2, 2, 2, 2471, 2472, 5, 688, 345, 2, 2472, 2473, 7, 16, 2, 2, 2473, 2474, 7, 17, 2, 2, 2474, 2488, 3, 2, 2, 2, 2475, 2479, 5, 688, 345, 2, 2476, 2477, 5, 388, 195, 2, 2477, 2478, 5, 688, 345, 2, 2478, 2480, 3, 2, 2, 2, 2479, 2476, 3, 2, 2, 2, 2479, 2480, 3, 2, 2, 2, 2480, 2488, 3, 2, 2, 2, 2481, 2485, 5, 316, 159, 2, 2482, 2483, 5, 388, 195, 2, 2483, 2484, 5, 688, 345, 2, 2484, 2486, 3, 2, 2, 2, 2485, 2482, 3, 2, 2, 2, 2485, 2486, 3, 2, 2, 2, 2486, 2488, 3, 2, 2, 2, 2487, 2471, 3, 2, 2, 2, 2487, 2475, 3, 2, 2, 2, 2487, 2481, 3, 2, 2, 2, 2488, 307, 3, 2, 2, 2, 2489, 2495, 5, 310, 156, 2, 2490, 2491, 5, 384, 193, 2, 2491, 2492, 5, 310, 156, 2, 2492, 2494, 3, 2, 2, 2, 2493, 2490, 3, 2, 2, 2, 2494, 2497, 3, 2, 2, 2, 2495, 2493, 3, 2, 2, 2, 2495, 2496, 3, 2, 2, 2, 2496, 309, 3, 2, 2, 2, 2497, 2495, 3, 2, 2, 2, 2498, 2499, 5, 688, 345, 2, 2499, 2500, 9, 4, 2, 2, 2500, 2501, 5, 320, 161, 2, 2501, 2572, 3, 2, 2, 2, 2502, 2503, 5, 688, 345, 2, 2503, 2504, 7, 16, 2, 2, 2504, 2505, 5, 688, 345, 2, 2505, 2506, 9, 4, 2, 2, 2506, 2507, 5, 320, 161, 2, 2507, 2572, 3, 2, 2, 2, 2508, 2509, 5, 316, 159, 2, 2509, 2510, 9, 4, 2, 2, 2510, 2511, 5, 320, 161, 2, 2511, 2572, 3, 2, 2, 2, 2512, 2513, 5, 316, 159, 2, 2513, 2514, 9, 4, 2, 2, 2514, 2515, 5, 316, 159, 2, 2515, 2572, 3, 2, 2, 2, 2516, 2517, 5, 688, 345, 2, 2517, 2518, 5, 444, 223, 2, 2518, 2520, 7, 3, 2, 2, 2519, 2521, 5, 318, 160, 2, 2520, 2519, 3, 2, 2, 2, 2520, 2521, 3, 2, 2, 2, 2521, 2522, 3, 2, 2, 2, 2522, 2523, 7, 4, 2, 2, 2523, 2572, 3, 2, 2, 2, 2524, 2525, 7, 3, 2, 2, 2525, 2531, 5, 688, 345, 2, 2526, 2527, 5, 684, 343, 2, 2527, 2528, 5, 688, 345, 2, 2528, 2530, 3, 2, 2, 2, 2529, 2526, 3, 2, 2, 2, 2530, 2533, 3, 2, 2, 2, 2531, 2529, 3, 2, 2, 2, 2531, 2532, 3, 2, 2, 2, 2532, 2534, 3, 2, 2, 2, 2533, 2531, 3, 2, 2, 2, 2534, 2535, 7, 4, 2, 2, 2535, 2536, 5, 444, 223, 2, 2536, 2537, 7, 3, 2, 2, 2537, 2543, 5, 260, 131, 2, 2538, 2539, 5, 684, 343, 2, 2539, 2540, 5, 260, 131, 2, 2540, 2542, 3, 2, 2, 2, 2541, 2538, 3, 2, 2, 2, 2542, 2545, 3, 2, 2, 2, 2543, 2541, 3, 2, 2, 2, 2543, 2544, 3, 2, 2, 2, 2544, 2546, 3, 2, 2, 2, 2545, 2543, 3, 2, 2, 2, 2546, 2547, 7, 4, 2, 2, 2547, 2572, 3, 2, 2, 2, 2548, 2549, 7, 3, 2, 2, 2549, 2555, 5, 688, 345, 2, 2550, 2551, 5, 684, 343, 2, 2551, 2552, 5, 688, 345, 2, 2552, 2554, 3, 2, 2, 2, 2553, 2550, 3, 2, 2, 2, 2554, 2557, 3, 2, 2, 2, 2555, 2553, 3, 2, 2, 2, 2555, 2556, 3, 2, 2, 2, 2556, 2558, 3, 2, 2, 2, 2557, 2555, 3, 2, 2, 2, 2558, 2559, 7, 4, 2, 2, 2559, 2560, 9, 4, 2, 2, 2560, 2566, 5, 260, 131, 2, 2561, 2562, 5, 684, 343, 2, 2562, 2563, 5, 260, 131, 2, 2563, 2565, 3, 2, 2, 2, 2564, 2561, 3, 2, 2, 2, 2565, 2568, 3, 2, 2, 2, 2566, 2564, 3, 2, 2, 2, 2566, 2567, 3, 2, 2, 2, 2567, 2572, 3, 2, 2, 2, 2568, 2566, 3, 2, 2, 2, 2569, 2572, 5, 314, 158, 2, 2570, 2572, 5, 312, 157, 2, 2571, 2498, 3, 2, 2, 2, 2571, 2502, 3, 2, 2, 2, 2571, 2508, 3, 2, 2, 2, 2571, 2512, 3, 2, 2, 2, 2571, 2516, 3, 2, 2, 2, 2571, 2524, 3, 2, 2, 2, 2571, 2548, 3, 2, 2, 2, 2571, 2569, 3, 2, 2, 2, 2571, 2570, 3, 2, 2, 2, 2572, 311, 3, 2, 2, 2, 2573, 2574, 5, 688, 345, 2, 2574, 2575, 5, 406, 204, 2, 2575, 2576, 5, 320, 161, 2, 2576, 313, 3, 2, 2, 2, 2577, 2578, 5, 688, 345, 2, 2578, 2579, 5, 406, 204, 2, 2579, 2580, 5, 556, 279, 2, 2580, 2581, 3, 2, 2, 2, 2581, 2582, 5, 320, 161, 2, 2582, 315, 3, 2, 2, 2, 2583, 2584, 5, 688, 345, 2, 2584, 2585, 7, 3, 2, 2, 2585, 2586, 7, 17, 2, 2, 2586, 2587, 7, 4, 2, 2, 2587, 2596, 3, 2, 2, 2, 2588, 2589, 5, 688, 345, 2, 2589, 2591, 7, 3, 2, 2, 2590, 2592, 5, 318, 160, 2, 2591, 2590, 3, 2, 2, 2, 2591, 2592, 3, 2, 2, 2, 2592, 2593, 3, 2, 2, 2, 2593, 2594, 7, 4, 2, 2, 2594, 2596, 3, 2, 2, 2, 2595, 2583, 3, 2, 2, 2, 2595, 2588, 3, 2, 2, 2, 2596, 317, 3, 2, 2, 2, 2597, 2601, 5, 320, 161, 2, 2598, 2601, 5, 688, 345, 2, 2599, 2601, 5, 316, 159, 2, 2600, 2597, 3, 2, 2, 2, 2600, 2598, 3, 2, 2, 2, 2600, 2599, 3, 2, 2, 2, 2601, 2610, 3, 2, 2, 2, 2602, 2606, 5, 684, 343, 2, 2603, 2607, 5, 320, 161, 2, 2604, 2607, 5, 688, 345, 2, 2605, 2607, 5, 316, 159, 2, 2606, 2603, 3, 2, 2, 2, 2606, 2604, 3, 2, 2, 2, 2606, 2605, 3, 2, 2, 2, 2607, 2609, 3, 2, 2, 2, 2608, 2602, 3, 2, 2, 2, 2609, 2612, 3, 2, 2, 2, 2610, 2608, 3, 2, 2, 2, 2610, 2611, 3, 2, 2, 2, 2611, 319, 3, 2, 2, 2, 2612, 2610, 3, 2, 2, 2, 2613, 2623, 7, 221, 2, 2, 2614, 2623, 5, 326, 164, 2, 2615, 2623, 5, 322, 162, 2, 2616, 2623, 5, 324, 163, 2, 2617, 2623, 5, 330, 166, 2, 2618, 2623, 5, 328, 165, 2, 2619, 2623, 5, 50, 26, 2, 2620, 2623, 5, 584, 293, 2, 2621, 2623, 5, 688, 345, 2, 2622, 2613, 3, 2, 2, 2, 2622, 2614, 3, 2, 2, 2, 2622, 2615, 3, 2, 2, 2, 2622, 2616, 3, 2, 2, 2, 2622, 2617, 3, 2, 2, 2, 2622, 2618, 3, 2, 2, 2, 2622, 2619, 3, 2, 2, 2, 2622, 2620, 3, 2, 2, 2, 2622, 2621, 3, 2, 2, 2, 2623, 321, 3, 2, 2, 2, 2624, 2625, 7, 216, 2, 2, 2625, 323, 3, 2, 2, 2, 2626, 2627, 9, 5, 2, 2, 2627, 325, 3, 2, 2, 2, 2628, 2629, 7, 215, 2, 2, 2629, 327, 3, 2, 2, 2, 2630, 2631, 9, 6, 2, 2, 2631, 329, 3, 2, 2, 2, 2632, 2633, 7, 218, 2, 2, 2633, 331, 3, 2, 2, 2, 2634, 2640, 5, 688, 345, 2, 2635, 2636, 7, 23, 2, 2, 2636, 2637, 5, 688, 345, 2, 2637, 2638, 7, 23, 2, 2, 2638, 2640, 3, 2, 2, 2, 2639, 2634, 3, 2, 2, 2, 2639, 2635, 3, 2, 2, 2, 2640, 333, 3, 2, 2, 2, 2641, 2647, 5, 688, 345, 2, 2642, 2643, 7, 23, 2, 2, 2643, 2644, 5, 688, 345, 2, 2644, 2645, 7, 23, 2, 2, 2645, 2647, 3, 2, 2, 2, 2646, 2641, 3, 2, 2, 2, 2646, 2642, 3, 2, 2, 2, 2647, 335, 3, 2, 2, 2, 2648, 2654, 5, 688, 345, 2, 2649, 2650, 7, 23, 2, 2, 2650, 2651, 5, 688, 345, 2, 2651, 2652, 7, 23, 2, 2, 2652, 2654, 3, 2, 2, 2, 2653, 2648, 3, 2, 2, 2, 2653, 2649, 3, 2, 2, 2, 2654, 337, 3, 2, 2, 2, 2655, 2657, 5, 340, 171, 2, 2656, 2658, 5, 342, 172, 2, 2657, 2656, 3, 2, 2, 2, 2657, 2658, 3, 2, 2, 2, 2658, 339, 3, 2, 2, 2, 2659, 2660, 5, 332, 167, 2, 2660, 2661, 7, 16, 2, 2, 2661, 2663, 3, 2, 2, 2, 2662, 2659, 3, 2, 2, 2, 2662, 2663, 3, 2, 2, 2, 2663, 2664, 3, 2, 2, 2, 2664, 2694, 5, 354, 178, 2, 2665, 2694, 7, 215, 2, 2, 2666, 2694, 7, 127, 2, 2, 2667, 2694, 7, 119, 2, 2, 2668, 2694, 7, 147, 2, 2, 2669, 2694, 7, 193, 2, 2, 2670, 2694, 7, 194, 2, 2, 2671, 2694, 7, 195, 2, 2, 2672, 2694, 7, 196, 2, 2, 2673, 2694, 7, 197, 2, 2, 2674, 2694, 7, 198, 2, 2, 2675, 2694, 7, 199, 2, 2, 2676, 2694, 7, 200, 2, 2, 2677, 2694, 7, 201, 2, 2, 2678, 2694, 7, 202, 2, 2, 2679, 2694, 7, 203, 2, 2, 2680, 2694, 7, 204, 2, 2, 2681, 2694, 7, 205, 2, 2, 2682, 2694, 7, 206, 2, 2, 2683, 2694, 7, 207, 2, 2, 2684, 2694, 7, 209, 2, 2, 2685, 2694, 7, 208, 2, 2, 2686, 2694, 7, 210, 2, 2, 2687, 2694, 7, 211, 2, 2, 2688, 2694, 7, 212, 2, 2, 2689, 2694, 7, 213, 2, 2, 2690, 2694, 7, 127, 2, 2, 2691, 2694, 7, 141, 2, 2, 2692, 2694, 7, 228, 2, 2, 2693, 2662, 3, 2, 2, 2, 2693, 2665, 3, 2, 2, 2, 2693, 2666, 3, 2, 2, 2, 2693, 2667, 3, 2, 2, 2, 2693, 2668, 3, 2, 2, 2, 2693, 2669, 3, 2, 2, 2, 2693, 2670, 3, 2, 2, 2, 2693, 2671, 3, 2, 2, 2, 2693, 2672, 3, 2, 2, 2, 2693, 2673, 3, 2, 2, 2, 2693, 2674, 3, 2, 2, 2, 2693, 2675, 3, 2, 2, 2, 2693, 2676, 3, 2, 2, 2, 2693, 2677, 3, 2, 2, 2, 2693, 2678, 3, 2, 2, 2, 2693, 2679, 3, 2, 2, 2, 2693, 2680, 3, 2, 2, 2, 2693, 2681, 3, 2, 2, 2, 2693, 2682, 3, 2, 2, 2, 2693, 2683, 3, 2, 2, 2, 2693, 2684, 3, 2, 2, 2, 2693, 2685, 3, 2, 2, 2, 2693, 2686, 3, 2, 2, 2, 2693, 2687, 3, 2, 2, 2, 2693, 2688, 3, 2, 2, 2, 2693, 2689, 3, 2, 2, 2, 2693, 2690, 3, 2, 2, 2, 2693, 2691, 3, 2, 2, 2, 2693, 2692, 3, 2, 2, 2, 2694, 341, 3, 2, 2, 2, 2695, 2696, 5, 676, 339, 2, 2696, 2704, 5, 338, 170, 2, 2697, 2700, 5, 684, 343, 2, 2698, 2701, 5, 338, 170, 2, 2699, 2701, 5, 322, 162, 2, 2700, 2698, 3, 2, 2, 2, 2700, 2699, 3, 2, 2, 2, 2701, 2703, 3, 2, 2, 2, 2702, 2697, 3, 2, 2, 2, 2703, 2706, 3, 2, 2, 2, 2704, 2702, 3, 2, 2, 2, 2704, 2705, 3, 2, 2, 2, 2705, 2707, 3, 2, 2, 2, 2706, 2704, 3, 2, 2, 2, 2707, 2708, 5, 678, 340, 2, 2708, 343, 3, 2, 2, 2, 2709, 2712, 5, 390, 196, 2, 2710, 2712, 5, 412, 207, 2, 2711, 2709, 3, 2, 2, 2, 2711, 2710, 3, 2, 2, 2, 2712, 345, 3, 2, 2, 2, 2713, 2714, 5, 688, 345, 2, 2714, 347, 3, 2, 2, 2, 2715, 2716, 5, 688, 345, 2, 2716, 349, 3, 2, 2, 2, 2717, 2718, 5, 326, 164, 2, 2718, 351, 3, 2, 2, 2, 2719, 2720, 5, 688, 345, 2, 2720, 353, 3, 2, 2, 2, 2721, 2722, 5, 688, 345, 2, 2722, 355, 3, 2, 2, 2, 2723, 2724, 5, 688, 345, 2, 2724, 357, 3, 2, 2, 2, 2725, 2726, 5, 688, 345, 2, 2726, 359, 3, 2, 2, 2, 2727, 2728, 5, 688, 345, 2, 2728, 361, 3, 2, 2, 2, 2729, 2730, 5, 688, 345, 2, 2730, 363, 3, 2, 2, 2, 2731, 2732, 5, 326, 164, 2, 2732, 365, 3, 2, 2, 2, 2733, 2734, 5, 688, 345, 2, 2734, 367, 3, 2, 2, 2, 2735, 2736, 5, 370, 186, 2, 2736, 2737, 5, 338, 170, 2, 2737, 369, 3, 2, 2, 2, 2738, 2739, 5, 688, 345, 2, 2739, 371, 3, 2, 2, 2, 2740, 2741, 7, 25, 2, 2, 2741, 373, 3, 2, 2, 2, 2742, 2743, 7, 26, 2, 2, 2743, 375, 3, 2, 2, 2, 2744, 2745, 7, 27, 2, 2, 2745, 377, 3, 2, 2, 2, 2746, 2747, 7, 27, 2, 2, 2747, 2748, 7, 104, 2, 2, 2748, 379, 3, 2, 2, 2, 2749, 2750, 7, 28, 2, 2, 2750, 381, 3, 2, 2, 2, 2751, 2752, 7, 29, 2, 2, 2752, 383, 3, 2, 2, 2, 2753, 2754, 7, 30, 2, 2, 2754, 385, 3, 2, 2, 2, 2755, 2756, 7, 32, 2, 2, 2756, 387, 3, 2, 2, 2, 2757, 2758, 7, 33, 2, 2, 2758, 389, 3, 2, 2, 2, 2759, 2760, 7, 34, 2, 2, 2760, 391, 3, 2, 2, 2, 2761, 2762, 7, 35, 2, 2, 2762, 393, 3, 2, 2, 2, 2763, 2764, 7, 36, 2, 2, 2764, 395, 3, 2, 2, 2, 2765, 2766, 7, 37, 2, 2, 2766, 397, 3, 2, 2, 2, 2767, 2768, 7, 38, 2, 2, 2768, 399, 3, 2, 2, 2, 2769, 2770, 7, 39, 2, 2, 2770, 401, 3, 2, 2, 2, 2771, 2772, 7, 40, 2, 2, 2772, 403, 3, 2, 2, 2, 2773, 2774, 7, 42, 2, 2, 2774, 405, 3, 2, 2, 2, 2775, 2776, 7, 44, 2, 2, 2776, 407, 3, 2, 2, 2, 2777, 2778, 7, 45, 2, 2, 2778, 409, 3, 2, 2, 2, 2779, 2780, 7, 48, 2, 2, 2780, 411, 3, 2, 2, 2, 2781, 2782, 7, 49, 2, 2, 2782, 413, 3, 2, 2, 2, 2783, 2784, 7, 50, 2, 2, 2784, 415, 3, 2, 2, 2, 2785, 2786, 7, 51, 2, 2, 2786, 417, 3, 2, 2, 2, 2787, 2788, 7, 52, 2, 2, 2788, 419, 3, 2, 2, 2, 2789, 2790, 7, 53, 2, 2, 2790, 421, 3, 2, 2, 2, 2791, 2792, 7, 55, 2, 2, 2792, 423, 3, 2, 2, 2, 2793, 2794, 7, 56, 2, 2, 2794, 425, 3, 2, 2, 2, 2795, 2796, 7, 57, 2, 2, 2796, 427, 3, 2, 2, 2, 2797, 2798, 7, 59, 2, 2, 2798, 429, 3, 2, 2, 2, 2799, 2800, 7, 60, 2, 2, 2800, 431, 3, 2, 2, 2, 2801, 2802, 7, 61, 2, 2, 2802, 433, 3, 2, 2, 2, 2803, 2804, 7, 62, 2, 2, 2804, 435, 3, 2, 2, 2, 2805, 2806, 7, 63, 2, 2, 2806, 437, 3, 2, 2, 2, 2807, 2808, 7, 64, 2, 2, 2808, 439, 3, 2, 2, 2, 2809, 2810, 7, 65, 2, 2, 2810, 441, 3, 2, 2, 2, 2811, 2812, 7, 66, 2, 2, 2812, 443, 3, 2, 2, 2, 2813, 2814, 7, 67, 2, 2, 2814, 445, 3, 2, 2, 2, 2815, 2816, 7, 68, 2, 2, 2816, 447, 3, 2, 2, 2, 2817, 2818, 7, 46, 2, 2, 2818, 449, 3, 2, 2, 2, 2819, 2820, 7, 47, 2, 2, 2820, 451, 3, 2, 2, 2, 2821, 2822, 7, 147, 2, 2, 2822, 453, 3, 2, 2, 2, 2823, 2824, 7, 149, 2, 2, 2824, 455, 3, 2, 2, 2, 2825, 2826, 7, 151, 2, 2, 2826, 457, 3, 2, 2, 2, 2827, 2828, 7, 152, 2, 2, 2828, 459, 3, 2, 2, 2, 2829, 2830, 7, 153, 2, 2, 2830, 461, 3, 2, 2, 2, 2831, 2832, 7, 154, 2, 2, 2832, 463, 3, 2, 2, 2, 2833, 2834, 7, 155, 2, 2, 2834, 465, 3, 2, 2, 2, 2835, 2836, 7, 156, 2, 2, 2836, 467, 3, 2, 2, 2, 2837, 2838, 7, 157, 2, 2, 2838, 469, 3, 2, 2, 2, 2839, 2840, 7, 158, 2, 2, 2840, 471, 3, 2, 2, 2, 2841, 2842, 7, 159, 2, 2, 2842, 473, 3, 2, 2, 2, 2843, 2844, 7, 160, 2, 2, 2844, 475, 3, 2, 2, 2, 2845, 2846, 7, 161, 2, 2, 2846, 477, 3, 2, 2, 2, 2847, 2848, 7, 162, 2, 2, 2848, 479, 3, 2, 2, 2, 2849, 2850, 7, 163, 2, 2, 2850, 481, 3, 2, 2, 2, 2851, 2852, 7, 165, 2, 2, 2852, 483, 3, 2, 2, 2, 2853, 2854, 7, 164, 2, 2, 2854, 485, 3, 2, 2, 2, 2855, 2856, 7, 166, 2, 2, 2856, 487, 3, 2, 2, 2, 2857, 2858, 7, 167, 2, 2, 2858, 489, 3, 2, 2, 2, 2859, 2860, 7, 168, 2, 2, 2860, 491, 3, 2, 2, 2, 2861, 2862, 7, 169, 2, 2, 2862, 493, 3, 2, 2, 2, 2863, 2864, 7, 171, 2, 2, 2864, 495, 3, 2, 2, 2, 2865, 2866, 7, 170, 2, 2, 2866, 497, 3, 2, 2, 2, 2867, 2868, 7, 172, 2, 2, 2868, 499, 3, 2, 2, 2, 2869, 2870, 7, 173, 2, 2, 2870, 501, 3, 2, 2, 2, 2871, 2872, 7, 174, 2, 2, 2872, 503, 3, 2, 2, 2, 2873, 2874, 7, 175, 2, 2, 2874, 505, 3, 2, 2, 2, 2875, 2876, 7, 176, 2, 2, 2876, 507, 3, 2, 2, 2, 2877, 2878, 7, 177, 2, 2, 2878, 509, 3, 2, 2, 2, 2879, 2880, 7, 178, 2, 2, 2880, 511, 3, 2, 2, 2, 2881, 2882, 7, 179, 2, 2, 2882, 513, 3, 2, 2, 2, 2883, 2884, 7, 180, 2, 2, 2884, 515, 3, 2, 2, 2, 2885, 2886, 7, 181, 2, 2, 2886, 517, 3, 2, 2, 2, 2887, 2888, 7, 182, 2, 2, 2888, 519, 3, 2, 2, 2, 2889, 2890, 7, 183, 2, 2, 2890, 521, 3, 2, 2, 2, 2891, 2892, 7, 184, 2, 2, 2892, 523, 3, 2, 2, 2, 2893, 2894, 7, 185, 2, 2, 2894, 525, 3, 2, 2, 2, 2895, 2896, 7, 186, 2, 2, 2896, 527, 3, 2, 2, 2, 2897, 2898, 7, 187, 2, 2, 2898, 529, 3, 2, 2, 2, 2899, 2900, 7, 188, 2, 2, 2900, 531, 3, 2, 2, 2, 2901, 2902, 7, 189, 2, 2, 2902, 533, 3, 2, 2, 2, 2903, 2904, 7, 190, 2, 2, 2904, 535, 3, 2, 2, 2, 2905, 2906, 7, 191, 2, 2, 2906, 537, 3, 2, 2, 2, 2907, 2908, 7, 192, 2, 2, 2908, 539, 3, 2, 2, 2, 2909, 2910, 7, 148, 2, 2, 2910, 541, 3, 2, 2, 2, 2911, 2912, 7, 150, 2, 2, 2912, 543, 3, 2, 2, 2, 2913, 2914, 7, 70, 2, 2, 2914, 545, 3, 2, 2, 2, 2915, 2916, 7, 71, 2, 2, 2916, 547, 3, 2, 2, 2, 2917, 2918, 7, 72, 2, 2, 2918, 549, 3, 2, 2, 2, 2919, 2920, 7, 73, 2, 2, 2920, 551, 3, 2, 2, 2, 2921, 2922, 7, 74, 2, 2, 2922, 553, 3, 2, 2, 2, 2923, 2924, 7, 75, 2, 2, 2924, 555, 3, 2, 2, 2, 2925, 2926, 7, 76, 2, 2, 2926, 557, 3, 2, 2, 2, 2927, 2928, 7, 77, 2, 2, 2928, 559, 3, 2, 2, 2, 2929, 2930, 7, 78, 2, 2, 2930, 561, 3, 2, 2, 2, 2931, 2932, 7, 79, 2, 2, 2932, 563, 3, 2, 2, 2, 2933, 2934, 7, 80, 2, 2, 2934, 565, 3, 2, 2, 2, 2935, 2936, 7, 82, 2, 2, 2936, 567, 3, 2, 2, 2, 2937, 2938, 7, 204, 2, 2, 2938, 569, 3, 2, 2, 2, 2939, 2940, 7, 85, 2, 2, 2940, 571, 3, 2, 2, 2, 2941, 2942, 7, 86, 2, 2, 2942, 573, 3, 2, 2, 2, 2943, 2944, 7, 87, 2, 2, 2944, 575, 3, 2, 2, 2, 2945, 2946, 7, 88, 2, 2, 2946, 577, 3, 2, 2, 2, 2947, 2948, 7, 91, 2, 2, 2948, 579, 3, 2, 2, 2, 2949, 2950, 7, 90, 2, 2, 2950, 581, 3, 2, 2, 2, 2951, 2952, 7, 92, 2, 2, 2952, 583, 3, 2, 2, 2, 2953, 2954, 7, 93, 2, 2, 2954, 585, 3, 2, 2, 2, 2955, 2956, 7, 94, 2, 2, 2956, 587, 3, 2, 2, 2, 2957, 2958, 7, 95, 2, 2, 2958, 589, 3, 2, 2, 2, 2959, 2960, 7, 97, 2, 2, 2960, 591, 3, 2, 2, 2, 2961, 2962, 7, 98, 2, 2, 2962, 593, 3, 2, 2, 2, 2963, 2964, 7, 99, 2, 2, 2964, 595, 3, 2, 2, 2, 2965, 2966, 7, 101, 2, 2, 2966, 597, 3, 2, 2, 2, 2967, 2968, 7, 105, 2, 2, 2968, 599, 3, 2, 2, 2, 2969, 2970, 7, 107, 2, 2, 2970, 601, 3, 2, 2, 2, 2971, 2972, 7, 108, 2, 2, 2972, 603, 3, 2, 2, 2, 2973, 2974, 7, 109, 2, 2, 2974, 605, 3, 2, 2, 2, 2975, 2976, 7, 110, 2, 2, 2976, 607, 3, 2, 2, 2, 2977, 2978, 7, 112, 2, 2, 2978, 609, 3, 2, 2, 2, 2979, 2980, 7, 114, 2, 2, 2980, 611, 3, 2, 2, 2, 2981, 2982, 7, 115, 2, 2, 2982, 613, 3, 2, 2, 2, 2983, 2984, 7, 116, 2, 2, 2984, 615, 3, 2, 2, 2, 2985, 2986, 7, 113, 2, 2, 2986, 617, 3, 2, 2, 2, 2987, 2988, 7, 118, 2, 2, 2988, 619, 3, 2, 2, 2, 2989, 2990, 7, 119, 2, 2, 2990, 621, 3, 2, 2, 2, 2991, 2992, 7, 120, 2, 2, 2992, 623, 3, 2, 2, 2, 2993, 2994, 7, 122, 2, 2, 2994, 625, 3, 2, 2, 2, 2995, 2996, 7, 123, 2, 2, 2996, 627, 3, 2, 2, 2, 2997, 2998, 7, 124, 2, 2, 2998, 629, 3, 2, 2, 2, 2999, 3000, 7, 125, 2, 2, 3000, 631, 3, 2, 2, 2, 3001, 3002, 7, 127, 2, 2, 3002, 633, 3, 2, 2, 2, 3003, 3004, 7, 128, 2, 2, 3004, 635, 3, 2, 2, 2, 3005, 3006, 7, 130, 2, 2, 3006, 637, 3, 2, 2, 2, 3007, 3008, 7, 132, 2, 2, 3008, 639, 3, 2, 2, 2, 3009, 3010, 7, 133, 2, 2, 3010, 641, 3, 2, 2, 2, 3011, 3012, 7, 135, 2, 2, 3012, 643, 3, 2, 2, 2, 3013, 3014, 7, 136, 2, 2, 3014, 645, 3, 2, 2, 2, 3015, 3016, 7, 137, 2, 2, 3016, 647, 3, 2, 2, 2, 3017, 3018, 7, 138, 2, 2, 3018, 649, 3, 2, 2, 2, 3019, 3020, 7, 139, 2, 2, 3020, 651, 3, 2, 2, 2, 3021, 3022, 7, 227, 2, 2, 3022, 653, 3, 2, 2, 2, 3023, 3024, 7, 140, 2, 2, 3024, 655, 3, 2, 2, 2, 3025, 3026, 7, 142, 2, 2, 3026, 657, 3, 2, 2, 2, 3027, 3028, 7, 143, 2, 2, 3028, 659, 3, 2, 2, 2, 3029, 3030, 7, 144, 2, 2, 3030, 661, 3, 2, 2, 2, 3031, 3032, 7, 145, 2, 2, 3032, 663, 3, 2, 2, 2, 3033, 3034, 7, 111, 2, 2, 3034, 665, 3, 2, 2, 2, 3035, 3036, 7, 2, 2, 3, 3036, 667, 3, 2, 2, 2, 3037, 3038, 7, 3, 2, 2, 3038, 669, 3, 2, 2, 2, 3039, 3040, 7, 4, 2, 2, 3040, 671, 3, 2, 2, 2, 3041, 3042, 7, 5, 2, 2, 3042, 673, 3, 2, 2, 2, 3043, 3044, 7, 6, 2, 2, 3044, 675, 3, 2, 2, 2, 3045, 3046, 7, 223, 2, 2, 3046, 677, 3, 2, 2, 2, 3047, 3048, 7, 224, 2, 2, 3048, 679, 3, 2, 2, 2, 3049, 3050, 7, 7, 2, 2, 3050, 681, 3, 2, 2, 2, 3051, 3052, 7, 8, 2, 2, 3052, 683, 3, 2, 2, 2, 3053, 3054, 7, 9, 2, 2, 3054, 685, 3, 2, 2, 2, 3055, 3056, 7, 11, 2, 2, 3056, 687, 3, 2, 2, 2, 3057, 3201, 7, 220, 2, 2, 3058, 3059, 7, 25, 2, 2, 3059, 3201, 7, 26, 2, 2, 3060, 3201, 7, 27, 2, 2, 3061, 3201, 7, 28, 2, 2, 3062, 3201, 7, 29, 2, 2, 3063, 3201, 7, 30, 2, 2, 3064, 3201, 7, 31, 2, 2, 3065, 3201, 7, 32, 2, 2, 3066, 3201, 7, 33, 2, 2, 3067, 3201, 7, 34, 2, 2, 3068, 3201, 7, 35, 2, 2, 3069, 3201, 7, 36, 2, 2, 3070, 3201, 7, 37, 2, 2, 3071, 3201, 7, 38, 2, 2, 3072, 3201, 7, 39, 2, 2, 3073, 3201, 7, 40, 2, 2, 3074, 3201, 7, 41, 2, 2, 3075, 3201, 7, 42, 2, 2, 3076, 3201, 7, 43, 2, 2, 3077, 3201, 7, 44, 2, 2, 3078, 3201, 7, 45, 2, 2, 3079, 3201, 7, 46, 2, 2, 3080, 3201, 7, 48, 2, 2, 3081, 3201, 7, 49, 2, 2, 3082, 3201, 7, 50, 2, 2, 3083, 3201, 7, 51, 2, 2, 3084, 3201, 7, 52, 2, 2, 3085, 3201, 7, 53, 2, 2, 3086, 3201, 7, 54, 2, 2, 3087, 3201, 7, 55, 2, 2, 3088, 3201, 7, 56, 2, 2, 3089, 3201, 7, 57, 2, 2, 3090, 3201, 7, 58, 2, 2, 3091, 3201, 7, 59, 2, 2, 3092, 3201, 7, 60, 2, 2, 3093, 3201, 7, 61, 2, 2, 3094, 3201, 7, 62, 2, 2, 3095, 3201, 7, 63, 2, 2, 3096, 3201, 7, 64, 2, 2, 3097, 3201, 7, 65, 2, 2, 3098, 3201, 7, 66, 2, 2, 3099, 3201, 7, 67, 2, 2, 3100, 3201, 7, 68, 2, 2, 3101, 3201, 7, 69, 2, 2, 3102, 3201, 7, 70, 2, 2, 3103, 3201, 7, 71, 2, 2, 3104, 3201, 7, 72, 2, 2, 3105, 3201, 7, 73, 2, 2, 3106, 3201, 7, 74, 2, 2, 3107, 3201, 7, 75, 2, 2, 3108, 3201, 7, 76, 2, 2, 3109, 3201, 7, 77, 2, 2, 3110, 3201, 7, 78, 2, 2, 3111, 3201, 7, 79, 2, 2, 3112, 3201, 7, 80, 2, 2, 3113, 3201, 7, 81, 2, 2, 3114, 3201, 7, 82, 2, 2, 3115, 3201, 7, 83, 2, 2, 3116, 3201, 7, 84, 2, 2, 3117, 3201, 7, 85, 2, 2, 3118, 3201, 7, 86, 2, 2, 3119, 3201, 7, 87, 2, 2, 3120, 3201, 7, 88, 2, 2, 3121, 3201, 7, 89, 2, 2, 3122, 3201, 7, 90, 2, 2, 3123, 3201, 7, 91, 2, 2, 3124, 3201, 7, 92, 2, 2, 3125, 3201, 7, 93, 2, 2, 3126, 3201, 7, 94, 2, 2, 3127, 3201, 7, 95, 2, 2, 3128, 3201, 7, 96, 2, 2, 3129, 3201, 7, 97, 2, 2, 3130, 3201, 7, 98, 2, 2, 3131, 3201, 7, 99, 2, 2, 3132, 3201, 7, 100, 2, 2, 3133, 3201, 7, 101, 2, 2, 3134, 3201, 7, 102, 2, 2, 3135, 3201, 7, 103, 2, 2, 3136, 3201, 7, 104, 2, 2, 3137, 3201, 7, 105, 2, 2, 3138, 3201, 7, 106, 2, 2, 3139, 3201, 7, 107, 2, 2, 3140, 3201, 7, 108, 2, 2, 3141, 3201, 7, 109, 2, 2, 3142, 3201, 7, 110, 2, 2, 3143, 3201, 7, 111, 2, 2, 3144, 3201, 7, 112, 2, 2, 3145, 3201, 7, 113, 2, 2, 3146, 3201, 7, 117, 2, 2, 3147, 3201, 7, 118, 2, 2, 3148, 3201, 7, 119, 2, 2, 3149, 3201, 7, 120, 2, 2, 3150, 3201, 7, 121, 2, 2, 3151, 3201, 7, 122, 2, 2, 3152, 3201, 7, 123, 2, 2, 3153, 3201, 7, 124, 2, 2, 3154, 3201, 7, 125, 2, 2, 3155, 3201, 7, 126, 2, 2, 3156, 3201, 7, 127, 2, 2, 3157, 3201, 7, 128, 2, 2, 3158, 3201, 7, 129, 2, 2, 3159, 3201, 7, 130, 2, 2, 3160, 3201, 7, 131, 2, 2, 3161, 3201, 7, 132, 2, 2, 3162, 3201, 7, 133, 2, 2, 3163, 3201, 7, 134, 2, 2, 3164, 3201, 7, 135, 2, 2, 3165, 3201, 7, 136, 2, 2, 3166, 3201, 7, 137, 2, 2, 3167, 3201, 7, 138, 2, 2, 3168, 3201, 7, 139, 2, 2, 3169, 3201, 7, 140, 2, 2, 3170, 3201, 7, 141, 2, 2, 3171, 3201, 7, 142, 2, 2, 3172, 3201, 7, 143, 2, 2, 3173, 3201, 7, 144, 2, 2, 3174, 3201, 7, 145, 2, 2, 3175, 3201, 7, 146, 2, 2, 3176, 3201, 7, 147, 2, 2, 3177, 3201, 7, 193, 2, 2, 3178, 3201, 7, 194, 2, 2, 3179, 3201, 7, 195, 2, 2, 3180, 3201, 7, 196, 2, 2, 3181, 3201, 7, 197, 2, 2, 3182, 3201, 7, 198, 2, 2, 3183, 3201, 7, 199, 2, 2, 3184, 3201, 7, 200, 2, 2, 3185, 3201, 7, 201, 2, 2, 3186, 3201, 7, 202, 2, 2, 3187, 3201, 7, 203, 2, 2, 3188, 3201, 7, 204, 2, 2, 3189, 3201, 7, 205, 2, 2, 3190, 3201, 7, 206, 2, 2, 3191, 3201, 7, 207, 2, 2, 3192, 3201, 7, 208, 2, 2, 3193, 3201, 7, 209, 2, 2, 3194, 3201, 7, 210, 2, 2, 3195, 3201, 7, 211, 2, 2, 3196, 3201, 7, 212, 2, 2, 3197, 3201, 7, 213, 2, 2, 3198, 3201, 7, 227, 2, 2, 3199, 3201, 7, 228, 2, 2, 3200, 3057, 3, 2, 2, 2, 3200, 3058, 3, 2, 2, 2, 3200, 3060, 3, 2, 2, 2, 3200, 3061, 3, 2, 2, 2, 3200, 3062, 3, 2, 2, 2, 3200, 3063, 3, 2, 2, 2, 3200, 3064, 3, 2, 2, 2, 3200, 3065, 3, 2, 2, 2, 3200, 3066, 3, 2, 2, 2, 3200, 3067, 3, 2, 2, 2, 3200, 3068, 3, 2, 2, 2, 3200, 3069, 3, 2, 2, 2, 3200, 3070, 3, 2, 2, 2, 3200, 3071, 3, 2, 2, 2, 3200, 3072, 3, 2, 2, 2, 3200, 3073, 3, 2, 2, 2, 3200, 3074, 3, 2, 2, 2, 3200, 3075, 3, 2, 2, 2, 3200, 3076, 3, 2, 2, 2, 3200, 3077, 3, 2, 2, 2, 3200, 3078, 3, 2, 2, 2, 3200, 3079, 3, 2, 2, 2, 3200, 3080, 3, 2, 2, 2, 3200, 3081, 3, 2, 2, 2, 3200, 3082, 3, 2, 2, 2, 3200, 3083, 3, 2, 2, 2, 3200, 3084, 3, 2, 2, 2, 3200, 3085, 3, 2, 2, 2, 3200, 3086, 3, 2, 2, 2, 3200, 3087, 3, 2, 2, 2, 3200, 3088, 3, 2, 2, 2, 3200, 3089, 3, 2, 2, 2, 3200, 3090, 3, 2, 2, 2, 3200, 3091, 3, 2, 2, 2, 3200, 3092, 3, 2, 2, 2, 3200, 3093, 3, 2, 2, 2, 3200, 3094, 3, 2, 2, 2, 3200, 3095, 3, 2, 2, 2, 3200, 3096, 3, 2, 2, 2, 3200, 3097, 3, 2, 2, 2, 3200, 3098, 3, 2, 2, 2, 3200, 3099, 3, 2, 2, 2, 3200, 3100, 3, 2, 2, 2, 3200, 3101, 3, 2, 2, 2, 3200, 3102, 3, 2, 2, 2, 3200, 3103, 3, 2, 2, 2, 3200, 3104, 3, 2, 2, 2, 3200, 3105, 3, 2, 2, 2, 3200, 3106, 3, 2, 2, 2, 3200, 3107, 3, 2, 2, 2, 3200, 3108, 3, 2, 2, 2, 3200, 3109, 3, 2, 2, 2, 3200, 3110, 3, 2, 2, 2, 3200, 3111, 3, 2, 2, 2, 3200, 3112, 3, 2, 2, 2, 3200, 3113, 3, 2, 2, 2, 3200, 3114, 3, 2, 2, 2, 3200, 3115, 3, 2, 2, 2, 3200, 3116, 3, 2, 2, 2, 3200, 3117, 3, 2, 2, 2, 3200, 3118, 3, 2, 2, 2, 3200, 3119, 3, 2, 2, 2, 3200, 3120, 3, 2, 2, 2, 3200, 3121, 3, 2, 2, 2, 3200, 3122, 3, 2, 2, 2, 3200, 3123, 3, 2, 2, 2, 3200, 3124, 3, 2, 2, 2, 3200, 3125, 3, 2, 2, 2, 3200, 3126, 3, 2, 2, 2, 3200, 3127, 3, 2, 2, 2, 3200, 3128, 3, 2, 2, 2, 3200, 3129, 3, 2, 2, 2, 3200, 3130, 3, 2, 2, 2, 3200, 3131, 3, 2, 2, 2, 3200, 3132, 3, 2, 2, 2, 3200, 3133, 3, 2, 2, 2, 3200, 3134, 3, 2, 2, 2, 3200, 3135, 3, 2, 2, 2, 3200, 3136, 3, 2, 2, 2, 3200, 3137, 3, 2, 2, 2, 3200, 3138, 3, 2, 2, 2, 3200, 3139, 3, 2, 2, 2, 3200, 3140, 3, 2, 2, 2, 3200, 3141, 3, 2, 2, 2, 3200, 3142, 3, 2, 2, 2, 3200, 3143, 3, 2, 2, 2, 3200, 3144, 3, 2, 2, 2, 3200, 3145, 3, 2, 2, 2, 3200, 3146, 3, 2, 2, 2, 3200, 3147, 3, 2, 2, 2, 3200, 3148, 3, 2, 2, 2, 3200, 3149, 3, 2, 2, 2, 3200, 3150, 3, 2, 2, 2, 3200, 3151, 3, 2, 2, 2, 3200, 3152, 3, 2, 2, 2, 3200, 3153, 3, 2, 2, 2, 3200, 3154, 3, 2, 2, 2, 3200, 3155, 3, 2, 2, 2, 3200, 3156, 3, 2, 2, 2, 3200, 3157, 3, 2, 2, 2, 3200, 3158, 3, 2, 2, 2, 3200, 3159, 3, 2, 2, 2, 3200, 3160, 3, 2, 2, 2, 3200, 3161, 3, 2, 2, 2, 3200, 3162, 3, 2, 2, 2, 3200, 3163, 3, 2, 2, 2, 3200, 3164, 3, 2, 2, 2, 3200, 3165, 3, 2, 2, 2, 3200, 3166, 3, 2, 2, 2, 3200, 3167, 3, 2, 2, 2, 3200, 3168, 3, 2, 2, 2, 3200, 3169, 3, 2, 2, 2, 3200, 3170, 3, 2, 2, 2, 3200, 3171, 3, 2, 2, 2, 3200, 3172, 3, 2, 2, 2, 3200, 3173, 3, 2, 2, 2, 3200, 3174, 3, 2, 2, 2, 3200, 3175, 3, 2, 2, 2, 3200, 3176, 3, 2, 2, 2, 3200, 3177, 3, 2, 2, 2, 3200, 3178, 3, 2, 2, 2, 3200, 3179, 3, 2, 2, 2, 3200, 3180, 3, 2, 2, 2, 3200, 3181, 3, 2, 2, 2, 3200, 3182, 3, 2, 2, 2, 3200, 3183, 3, 2, 2, 2, 3200, 3184, 3, 2, 2, 2, 3200, 3185, 3, 2, 2, 2, 3200, 3186, 3, 2, 2, 2, 3200, 3187, 3, 2, 2, 2, 3200, 3188, 3, 2, 2, 2, 3200, 3189, 3, 2, 2, 2, 3200, 3190, 3, 2, 2, 2, 3200, 3191, 3, 2, 2, 2, 3200, 3192, 3, 2, 2, 2, 3200, 3193, 3, 2, 2, 2, 3200, 3194, 3, 2, 2, 2, 3200, 3195, 3, 2, 2, 2, 3200, 3196, 3, 2, 2, 2, 3200, 3197, 3, 2, 2, 2, 3200, 3198, 3, 2, 2, 2, 3200, 3199, 3, 2, 2, 2, 3201, 689, 3, 2, 2, 2, 272, 691, 694, 700, 705, 707, 712, 715, 718, 762, 779, 782, 789, 794, 805, 815, 830, 841, 846, 857, 861, 866, 874, 879, 883, 888, 893, 908, 914, 919, 929, 934, 944, 949, 954, 961, 969, 982, 994, 998, 1002, 1007, 1012, 1031, 1038, 1046, 1050, 1055, 1074, 1083, 1098, 1100, 1112, 1126, 1133, 1140, 1148, 1159, 1179, 1190, 1213, 1227, 1234, 1243, 1262, 1270, 1276, 1281, 1288, 1293, 1301, 1306, 1313, 1318, 1325, 1330, 1337, 1344, 1351, 1358, 1363, 1370, 1377, 1382, 1389, 1394, 1401, 1405, 1409, 1414, 1418, 1434, 1446, 1453, 1462, 1476, 1484, 1490, 1495, 1509, 1517, 1525, 1533, 1542, 1554, 1558, 1562, 1576, 1584, 1593, 1604, 1609, 1616, 1619, 1625, 1636, 1639, 1645, 1655, 1664, 1668, 1670, 1676, 1682, 1688, 1694, 1700, 1706, 1712, 1718, 1724, 1730, 1736, 1742, 1748, 1754, 1760, 1766, 1768, 1774, 1780, 1787, 1790, 1795, 1798, 1801, 1804, 1807, 1809, 1817, 1820, 1826, 1829, 1835, 1838, 1844, 1847, 1853, 1856, 1862, 1865, 1871, 1874, 1880, 1883, 1889, 1892, 1898, 1904, 1912, 1915, 1921, 1924, 1930, 1938, 1946, 1955, 1964, 1967, 1973, 1976, 1982, 1985, 1991, 1994, 2000, 2003, 2011, 2014, 2020, 2023, 2029, 2032, 2038, 2041, 2047, 2050, 2052, 2056, 2063, 2086, 2090, 2094, 2099, 2107, 2115, 2119, 2122, 2128, 2132, 2139, 2150, 2163, 2172, 2223, 2232, 2235, 2251, 2263, 2275, 2287, 2295, 2298, 2306, 2309, 2314, 2321, 2325, 2329, 2332, 2350, 2376, 2388, 2397, 2406, 2410, 2413, 2418, 2421, 2424, 2427, 2443, 2452, 2461, 2468, 2479, 2485, 2487, 2495, 2520, 2531, 2543, 2555, 2566, 2571, 2591, 2595, 2600, 2606, 2610, 2622, 2639, 2646, 2653, 2657, 2662, 2693, 2700, 2704, 2711, 3200] \ No newline at end of file diff --git a/reverse_engineering/parser/CqlParser.js b/reverse_engineering/parser/CqlParser.js deleted file mode 100644 index f595b6a5..00000000 --- a/reverse_engineering/parser/CqlParser.js +++ /dev/null @@ -1,31520 +0,0 @@ -// Generated from grammars/CqlParser.g4 by ANTLR 4.9.2 -// jshint ignore: start -var antlr4 = require('antlr4/index'); -var CqlParserListener = require('./CqlParserListener').CqlParserListener; -var CqlParserVisitor = require('./CqlParserVisitor').CqlParserVisitor; - -const serializedATN = [ - "\u0003\u608b\ua72a\u8133\ub9ed\u417c\u3be7\u7786", - "\u5964\u0003\u00e4\u0c83\u0004\u0002\t\u0002\u0004\u0003\t\u0003\u0004", - "\u0004\t\u0004\u0004\u0005\t\u0005\u0004\u0006\t\u0006\u0004\u0007\t", - "\u0007\u0004\b\t\b\u0004\t\t\t\u0004\n\t\n\u0004\u000b\t\u000b\u0004", - "\f\t\f\u0004\r\t\r\u0004\u000e\t\u000e\u0004\u000f\t\u000f\u0004\u0010", - "\t\u0010\u0004\u0011\t\u0011\u0004\u0012\t\u0012\u0004\u0013\t\u0013", - "\u0004\u0014\t\u0014\u0004\u0015\t\u0015\u0004\u0016\t\u0016\u0004\u0017", - "\t\u0017\u0004\u0018\t\u0018\u0004\u0019\t\u0019\u0004\u001a\t\u001a", - "\u0004\u001b\t\u001b\u0004\u001c\t\u001c\u0004\u001d\t\u001d\u0004\u001e", - '\t\u001e\u0004\u001f\t\u001f\u0004 \t \u0004!\t!\u0004"\t"\u0004#', - "\t#\u0004$\t$\u0004%\t%\u0004&\t&\u0004'\t'\u0004(\t(\u0004)\t)\u0004", - "*\t*\u0004+\t+\u0004,\t,\u0004-\t-\u0004.\t.\u0004/\t/\u00040\t0\u0004", - "1\t1\u00042\t2\u00043\t3\u00044\t4\u00045\t5\u00046\t6\u00047\t7\u0004", - "8\t8\u00049\t9\u0004:\t:\u0004;\t;\u0004<\t<\u0004=\t=\u0004>\t>\u0004", - "?\t?\u0004@\t@\u0004A\tA\u0004B\tB\u0004C\tC\u0004D\tD\u0004E\tE\u0004", - "F\tF\u0004G\tG\u0004H\tH\u0004I\tI\u0004J\tJ\u0004K\tK\u0004L\tL\u0004", - "M\tM\u0004N\tN\u0004O\tO\u0004P\tP\u0004Q\tQ\u0004R\tR\u0004S\tS\u0004", - "T\tT\u0004U\tU\u0004V\tV\u0004W\tW\u0004X\tX\u0004Y\tY\u0004Z\tZ\u0004", - "[\t[\u0004\\\t\\\u0004]\t]\u0004^\t^\u0004_\t_\u0004`\t`\u0004a\ta\u0004", - "b\tb\u0004c\tc\u0004d\td\u0004e\te\u0004f\tf\u0004g\tg\u0004h\th\u0004", - "i\ti\u0004j\tj\u0004k\tk\u0004l\tl\u0004m\tm\u0004n\tn\u0004o\to\u0004", - "p\tp\u0004q\tq\u0004r\tr\u0004s\ts\u0004t\tt\u0004u\tu\u0004v\tv\u0004", - "w\tw\u0004x\tx\u0004y\ty\u0004z\tz\u0004{\t{\u0004|\t|\u0004}\t}\u0004", - "~\t~\u0004\u007f\t\u007f\u0004\u0080\t\u0080\u0004\u0081\t\u0081\u0004", - "\u0082\t\u0082\u0004\u0083\t\u0083\u0004\u0084\t\u0084\u0004\u0085\t", - "\u0085\u0004\u0086\t\u0086\u0004\u0087\t\u0087\u0004\u0088\t\u0088\u0004", - "\u0089\t\u0089\u0004\u008a\t\u008a\u0004\u008b\t\u008b\u0004\u008c\t", - "\u008c\u0004\u008d\t\u008d\u0004\u008e\t\u008e\u0004\u008f\t\u008f\u0004", - "\u0090\t\u0090\u0004\u0091\t\u0091\u0004\u0092\t\u0092\u0004\u0093\t", - "\u0093\u0004\u0094\t\u0094\u0004\u0095\t\u0095\u0004\u0096\t\u0096\u0004", - "\u0097\t\u0097\u0004\u0098\t\u0098\u0004\u0099\t\u0099\u0004\u009a\t", - "\u009a\u0004\u009b\t\u009b\u0004\u009c\t\u009c\u0004\u009d\t\u009d\u0004", - "\u009e\t\u009e\u0004\u009f\t\u009f\u0004\u00a0\t\u00a0\u0004\u00a1\t", - "\u00a1\u0004\u00a2\t\u00a2\u0004\u00a3\t\u00a3\u0004\u00a4\t\u00a4\u0004", - "\u00a5\t\u00a5\u0004\u00a6\t\u00a6\u0004\u00a7\t\u00a7\u0004\u00a8\t", - "\u00a8\u0004\u00a9\t\u00a9\u0004\u00aa\t\u00aa\u0004\u00ab\t\u00ab\u0004", - "\u00ac\t\u00ac\u0004\u00ad\t\u00ad\u0004\u00ae\t\u00ae\u0004\u00af\t", - "\u00af\u0004\u00b0\t\u00b0\u0004\u00b1\t\u00b1\u0004\u00b2\t\u00b2\u0004", - "\u00b3\t\u00b3\u0004\u00b4\t\u00b4\u0004\u00b5\t\u00b5\u0004\u00b6\t", - "\u00b6\u0004\u00b7\t\u00b7\u0004\u00b8\t\u00b8\u0004\u00b9\t\u00b9\u0004", - "\u00ba\t\u00ba\u0004\u00bb\t\u00bb\u0004\u00bc\t\u00bc\u0004\u00bd\t", - "\u00bd\u0004\u00be\t\u00be\u0004\u00bf\t\u00bf\u0004\u00c0\t\u00c0\u0004", - "\u00c1\t\u00c1\u0004\u00c2\t\u00c2\u0004\u00c3\t\u00c3\u0004\u00c4\t", - "\u00c4\u0004\u00c5\t\u00c5\u0004\u00c6\t\u00c6\u0004\u00c7\t\u00c7\u0004", - "\u00c8\t\u00c8\u0004\u00c9\t\u00c9\u0004\u00ca\t\u00ca\u0004\u00cb\t", - "\u00cb\u0004\u00cc\t\u00cc\u0004\u00cd\t\u00cd\u0004\u00ce\t\u00ce\u0004", - "\u00cf\t\u00cf\u0004\u00d0\t\u00d0\u0004\u00d1\t\u00d1\u0004\u00d2\t", - "\u00d2\u0004\u00d3\t\u00d3\u0004\u00d4\t\u00d4\u0004\u00d5\t\u00d5\u0004", - "\u00d6\t\u00d6\u0004\u00d7\t\u00d7\u0004\u00d8\t\u00d8\u0004\u00d9\t", - "\u00d9\u0004\u00da\t\u00da\u0004\u00db\t\u00db\u0004\u00dc\t\u00dc\u0004", - "\u00dd\t\u00dd\u0004\u00de\t\u00de\u0004\u00df\t\u00df\u0004\u00e0\t", - "\u00e0\u0004\u00e1\t\u00e1\u0004\u00e2\t\u00e2\u0004\u00e3\t\u00e3\u0004", - "\u00e4\t\u00e4\u0004\u00e5\t\u00e5\u0004\u00e6\t\u00e6\u0004\u00e7\t", - "\u00e7\u0004\u00e8\t\u00e8\u0004\u00e9\t\u00e9\u0004\u00ea\t\u00ea\u0004", - "\u00eb\t\u00eb\u0004\u00ec\t\u00ec\u0004\u00ed\t\u00ed\u0004\u00ee\t", - "\u00ee\u0004\u00ef\t\u00ef\u0004\u00f0\t\u00f0\u0004\u00f1\t\u00f1\u0004", - "\u00f2\t\u00f2\u0004\u00f3\t\u00f3\u0004\u00f4\t\u00f4\u0004\u00f5\t", - "\u00f5\u0004\u00f6\t\u00f6\u0004\u00f7\t\u00f7\u0004\u00f8\t\u00f8\u0004", - "\u00f9\t\u00f9\u0004\u00fa\t\u00fa\u0004\u00fb\t\u00fb\u0004\u00fc\t", - "\u00fc\u0004\u00fd\t\u00fd\u0004\u00fe\t\u00fe\u0004\u00ff\t\u00ff\u0004", - "\u0100\t\u0100\u0004\u0101\t\u0101\u0004\u0102\t\u0102\u0004\u0103\t", - "\u0103\u0004\u0104\t\u0104\u0004\u0105\t\u0105\u0004\u0106\t\u0106\u0004", - "\u0107\t\u0107\u0004\u0108\t\u0108\u0004\u0109\t\u0109\u0004\u010a\t", - "\u010a\u0004\u010b\t\u010b\u0004\u010c\t\u010c\u0004\u010d\t\u010d\u0004", - "\u010e\t\u010e\u0004\u010f\t\u010f\u0004\u0110\t\u0110\u0004\u0111\t", - "\u0111\u0004\u0112\t\u0112\u0004\u0113\t\u0113\u0004\u0114\t\u0114\u0004", - "\u0115\t\u0115\u0004\u0116\t\u0116\u0004\u0117\t\u0117\u0004\u0118\t", - "\u0118\u0004\u0119\t\u0119\u0004\u011a\t\u011a\u0004\u011b\t\u011b\u0004", - "\u011c\t\u011c\u0004\u011d\t\u011d\u0004\u011e\t\u011e\u0004\u011f\t", - "\u011f\u0004\u0120\t\u0120\u0004\u0121\t\u0121\u0004\u0122\t\u0122\u0004", - "\u0123\t\u0123\u0004\u0124\t\u0124\u0004\u0125\t\u0125\u0004\u0126\t", - "\u0126\u0004\u0127\t\u0127\u0004\u0128\t\u0128\u0004\u0129\t\u0129\u0004", - "\u012a\t\u012a\u0004\u012b\t\u012b\u0004\u012c\t\u012c\u0004\u012d\t", - "\u012d\u0004\u012e\t\u012e\u0004\u012f\t\u012f\u0004\u0130\t\u0130\u0004", - "\u0131\t\u0131\u0004\u0132\t\u0132\u0004\u0133\t\u0133\u0004\u0134\t", - "\u0134\u0004\u0135\t\u0135\u0004\u0136\t\u0136\u0004\u0137\t\u0137\u0004", - "\u0138\t\u0138\u0004\u0139\t\u0139\u0004\u013a\t\u013a\u0004\u013b\t", - "\u013b\u0004\u013c\t\u013c\u0004\u013d\t\u013d\u0004\u013e\t\u013e\u0004", - "\u013f\t\u013f\u0004\u0140\t\u0140\u0004\u0141\t\u0141\u0004\u0142\t", - "\u0142\u0004\u0143\t\u0143\u0004\u0144\t\u0144\u0004\u0145\t\u0145\u0004", - "\u0146\t\u0146\u0004\u0147\t\u0147\u0004\u0148\t\u0148\u0004\u0149\t", - "\u0149\u0004\u014a\t\u014a\u0004\u014b\t\u014b\u0004\u014c\t\u014c\u0004", - "\u014d\t\u014d\u0004\u014e\t\u014e\u0004\u014f\t\u014f\u0004\u0150\t", - "\u0150\u0004\u0151\t\u0151\u0004\u0152\t\u0152\u0004\u0153\t\u0153\u0004", - "\u0154\t\u0154\u0004\u0155\t\u0155\u0004\u0156\t\u0156\u0004\u0157\t", - "\u0157\u0004\u0158\t\u0158\u0004\u0159\t\u0159\u0003\u0002\u0005\u0002", - "\u02b4\n\u0002\u0003\u0002\u0005\u0002\u02b7\n\u0002\u0003\u0002\u0003", - "\u0002\u0003\u0003\u0003\u0003\u0005\u0003\u02bd\n\u0003\u0003\u0003", - "\u0003\u0003\u0003\u0003\u0007\u0003\u02c2\n\u0003\f\u0003\u000e\u0003", - "\u02c5\u000b\u0003\u0003\u0003\u0003\u0003\u0005\u0003\u02c9\n\u0003", - "\u0003\u0003\u0005\u0003\u02cc\n\u0003\u0003\u0003\u0005\u0003\u02cf", - "\n\u0003\u0003\u0004\u0003\u0004\u0003\u0005\u0003\u0005\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006\u0003\u0006", - "\u0003\u0006\u0005\u0006\u02fb\n\u0006\u0003\u0007\u0003\u0007\u0003", - "\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\u0007\u0003\b\u0003", - "\b\u0003\b\u0003\t\u0003\t\u0003\t\u0003\t\u0003\t\u0005\t\u030c\n\t", - "\u0003\t\u0005\t\u030f\n\t\u0003\n\u0003\n\u0003\n\u0003\n\u0003\n\u0005", - "\n\u0316\n\n\u0003\n\u0003\n\u0003\n\u0005\n\u031b\n\n\u0003\u000b\u0003", - "\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003\u000b\u0003", - "\f\u0003\f\u0005\f\u0326\n\f\u0003\f\u0003\f\u0003\f\u0003\f\u0003\f", - "\u0003\f\u0003\f\u0003\f\u0005\f\u0330\n\f\u0003\r\u0003\r\u0003\r\u0003", - "\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003", - "\r\u0005\r\u033f\n\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r", - "\u0003\r\u0003\r\u0003\r\u0005\r\u034a\n\r\u0003\r\u0003\r\u0003\r\u0005", - "\r\u034f\n\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r\u0003\r", - "\u0003\r\u0003\r\u0005\r\u035a\n\r\u0003\r\u0003\r\u0005\r\u035e\n\r", - "\u0003\u000e\u0003\u000e\u0003\u000e\u0005\u000e\u0363\n\u000e\u0003", - "\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0003\u000e\u0005", - "\u000e\u036b\n\u000e\u0003\u000f\u0003\u000f\u0003\u000f\u0005\u000f", - "\u0370\n\u000f\u0003\u000f\u0003\u000f\u0005\u000f\u0374\n\u000f\u0003", - "\u0010\u0003\u0010\u0003\u0010\u0005\u0010\u0379\n\u0010\u0003\u0010", - "\u0003\u0010\u0003\u0010\u0005\u0010\u037e\n\u0010\u0003\u0010\u0003", - "\u0010\u0003\u0010\u0003\u0010\u0003\u0010\u0003\u0011\u0003\u0011\u0003", - "\u0011\u0003\u0011\u0003\u0011\u0003\u0011\u0007\u0011\u038b\n\u0011", - "\f\u0011\u000e\u0011\u038e\u000b\u0011\u0003\u0012\u0003\u0012\u0003", - "\u0012\u0005\u0012\u0393\n\u0012\u0003\u0012\u0003\u0012\u0003\u0012", - "\u0005\u0012\u0398\n\u0012\u0003\u0012\u0003\u0012\u0003\u0012\u0003", - "\u0012\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0013\u0005\u0013\u03a2", - "\n\u0013\u0003\u0013\u0003\u0013\u0003\u0013\u0005\u0013\u03a7\n\u0013", - "\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0013\u0003\u0013", - "\u0003\u0013\u0003\u0013\u0005\u0013\u03b1\n\u0013\u0003\u0013\u0003", - "\u0013\u0003\u0013\u0005\u0013\u03b6\n\u0013\u0003\u0013\u0003\u0013", - "\u0003\u0013\u0005\u0013\u03bb\n\u0013\u0003\u0014\u0003\u0014\u0003", - "\u0014\u0003\u0014\u0003\u0014\u0005\u0014\u03c2\n\u0014\u0003\u0015", - "\u0003\u0015\u0003\u0015\u0003\u0015\u0007\u0015\u03c8\n\u0015\f\u0015", - "\u000e\u0015\u03cb\u000b\u0015\u0003\u0016\u0003\u0016\u0003\u0016\u0003", - "\u0016\u0003\u0016\u0003\u0017\u0003\u0017\u0003\u0018\u0003\u0018\u0003", - "\u0018\u0005\u0018\u03d7\n\u0018\u0003\u0018\u0003\u0018\u0003\u0018", - "\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018\u0003\u0018", - "\u0003\u0018\u0005\u0018\u03e3\n\u0018\u0003\u0019\u0003\u0019\u0005", - "\u0019\u03e7\n\u0019\u0003\u0019\u0003\u0019\u0005\u0019\u03eb\n\u0019", - "\u0003\u0019\u0003\u0019\u0003\u0019\u0005\u0019\u03f0\n\u0019\u0003", - "\u0019\u0003\u0019\u0003\u0019\u0005\u0019\u03f5\n\u0019\u0003\u0019", - "\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019\u0003\u0019", - "\u0003\u0019\u0003\u0019\u0003\u001a\u0003\u001a\u0003\u001b\u0003\u001b", - "\u0003\u001b\u0003\u001b\u0007\u001b\u0406\n\u001b\f\u001b\u000e\u001b", - "\u0409\u000b\u001b\u0003\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0005", - "\u001c\u040f\n\u001c\u0003\u001c\u0003\u001c\u0003\u001c\u0003\u001c", - "\u0003\u001d\u0003\u001d\u0005\u001d\u0417\n\u001d\u0003\u001d\u0003", - "\u001d\u0005\u001d\u041b\n\u001d\u0003\u001d\u0003\u001d\u0003\u001d", - "\u0005\u001d\u0420\n\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003", - "\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003", - "\u001d\u0003\u001d\u0003\u001d\u0003\u001d\u0003\u001e\u0003\u001e\u0003", - "\u001e\u0003\u001e\u0005\u001e\u0433\n\u001e\u0003\u001f\u0003\u001f", - "\u0003\u001f\u0003\u001f\u0003\u001f\u0007\u001f\u043a\n\u001f\f\u001f", - "\u000e\u001f\u043d\u000b\u001f\u0003\u001f\u0003\u001f\u0003 \u0003", - " \u0003 \u0003 \u0003!\u0003!\u0003!\u0003!\u0003!\u0003!\u0007!\u044b", - '\n!\f!\u000e!\u044e\u000b!\u0003!\u0003!\u0003"\u0003"\u0003"\u0003', - '"\u0003"\u0007"\u0457\n"\f"\u000e"\u045a\u000b"\u0003"\u0003', - '"\u0003#\u0003#\u0003#\u0003$\u0003$\u0003$\u0003$\u0003$\u0003$\u0005', - "$\u0467\n$\u0003%\u0003%\u0003%\u0003&\u0003&\u0005&\u046e\n&\u0003", - "'\u0003'\u0003'\u0003'\u0003'\u0005'\u0475\n'\u0003'\u0003'", - "\u0003'\u0003(\u0003(\u0003(\u0005(\u047d\n(\u0003)\u0003)\u0003)\u0003", - "*\u0003*\u0003*\u0003*\u0007*\u0486\n*\f*\u000e*\u0489\u000b*\u0003", - "+\u0003+\u0003+\u0003+\u0003,\u0003,\u0003,\u0003-\u0003-\u0003-\u0003", - "-\u0003-\u0003.\u0003.\u0003.\u0003.\u0003.\u0005.\u049c\n.\u0003.\u0003", - ".\u0003.\u0003/\u0003/\u0003/\u0003/\u0003/\u0003/\u0005/\u04a7\n/\u0003", - "0\u00030\u00030\u00031\u00031\u00031\u00031\u00031\u00032\u00032\u0003", - "2\u00032\u00033\u00033\u00033\u00034\u00034\u00034\u00034\u00074\u04bc", - "\n4\f4\u000e4\u04bf\u000b4\u00035\u00035\u00035\u00036\u00036\u0003", - "6\u00036\u00036\u00036\u00076\u04ca\n6\f6\u000e6\u04cd\u000b6\u0003", - "7\u00037\u00037\u00037\u00057\u04d3\n7\u00038\u00038\u00038\u00038\u0003", - "8\u00078\u04da\n8\f8\u000e8\u04dd\u000b8\u00039\u00039\u00039\u0003", - "9\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u00039\u0003", - "9\u00039\u00039\u00059\u04ef\n9\u0003:\u0003:\u0003:\u0003:\u0003:\u0003", - ":\u0005:\u04f7\n:\u0003:\u0003:\u0003:\u0003:\u0005:\u04fd\n:\u0003", - ";\u0003;\u0003;\u0005;\u0502\n;\u0003;\u0003;\u0003<\u0003<\u0003<\u0005", - "<\u0509\n<\u0003<\u0003<\u0003<\u0005<\u050e\n<\u0003<\u0003<\u0003", - "=\u0003=\u0003=\u0003=\u0005=\u0516\n=\u0003=\u0003=\u0003=\u0005=\u051b", - "\n=\u0003=\u0003=\u0003>\u0003>\u0003>\u0005>\u0522\n>\u0003>\u0003", - ">\u0003>\u0005>\u0527\n>\u0003>\u0003>\u0003?\u0003?\u0003?\u0005?\u052e", - "\n?\u0003?\u0003?\u0003?\u0005?\u0533\n?\u0003?\u0003?\u0003@\u0003", - "@\u0003@\u0005@\u053a\n@\u0003@\u0003@\u0003@\u0003@\u0003@\u0005@\u0541", - "\n@\u0003@\u0003@\u0003A\u0003A\u0003A\u0005A\u0548\nA\u0003A\u0003", - "A\u0003B\u0003B\u0003B\u0005B\u054f\nB\u0003B\u0003B\u0003B\u0005B\u0554", - "\nB\u0003B\u0003B\u0003C\u0003C\u0003C\u0005C\u055b\nC\u0003C\u0003", - "C\u0003D\u0003D\u0003D\u0005D\u0562\nD\u0003D\u0003D\u0003D\u0005D\u0567", - "\nD\u0003D\u0003D\u0003E\u0003E\u0003E\u0005E\u056e\nE\u0003E\u0003", - "E\u0003E\u0005E\u0573\nE\u0003E\u0003E\u0003E\u0003E\u0003E\u0005E\u057a", - "\nE\u0003F\u0003F\u0005F\u057e\nF\u0003G\u0003G\u0005G\u0582\nG\u0003", - "G\u0003G\u0003G\u0005G\u0587\nG\u0007G\u0589\nG\fG\u000eG\u058c\u000b", - "G\u0003H\u0003H\u0003H\u0003H\u0003H\u0003H\u0003H\u0003I\u0003I\u0003", - "I\u0003I\u0007I\u0599\nI\fI\u000eI\u059c\u000bI\u0003J\u0003J\u0003", - "J\u0003J\u0003J\u0003J\u0003J\u0003J\u0003J\u0005J\u05a7\nJ\u0003K\u0003", - "K\u0003L\u0003L\u0003L\u0005L\u05ae\nL\u0003M\u0003M\u0003M\u0003M\u0003", - "M\u0007M\u05b5\nM\fM\u000eM\u05b8\u000bM\u0003M\u0003M\u0003N\u0003", - "N\u0003N\u0003N\u0003O\u0003O\u0003P\u0003P\u0003P\u0005P\u05c5\nP\u0003", - "Q\u0003Q\u0003Q\u0003Q\u0007Q\u05cb\nQ\fQ\u000eQ\u05ce\u000bQ\u0003", - "Q\u0003Q\u0003Q\u0005Q\u05d3\nQ\u0003R\u0003R\u0003R\u0005R\u05d8\n", - "R\u0003S\u0003S\u0003S\u0003T\u0003T\u0003T\u0003T\u0003T\u0003T\u0003", - "U\u0003U\u0003U\u0005U\u05e6\nU\u0003V\u0003V\u0003W\u0003W\u0003W\u0003", - "W\u0005W\u05ee\nW\u0003X\u0003X\u0003X\u0003X\u0003X\u0003X\u0005X\u05f6", - "\nX\u0003Y\u0003Y\u0003Y\u0003Y\u0007Y\u05fc\nY\fY\u000eY\u05ff\u000b", - "Y\u0003Z\u0003Z\u0003Z\u0003Z\u0007Z\u0605\nZ\fZ\u000eZ\u0608\u000b", - "Z\u0003[\u0003[\u0003\\\u0003\\\u0003]\u0003]\u0003]\u0003^\u0003^\u0005", - "^\u0613\n^\u0003^\u0003^\u0005^\u0617\n^\u0003_\u0003_\u0005_\u061b", - "\n_\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003`\u0003", - "`\u0003`\u0003`\u0005`\u0629\n`\u0003a\u0003a\u0003a\u0003a\u0007a\u062f", - "\na\fa\u000ea\u0632\u000ba\u0003b\u0003b\u0003b\u0003b\u0003b\u0003", - "b\u0005b\u063a\nb\u0003c\u0003c\u0003c\u0003c\u0003d\u0003d\u0003d\u0003", - "e\u0003e\u0005e\u0645\ne\u0003e\u0003e\u0003e\u0005e\u064a\ne\u0003", - "e\u0003e\u0003f\u0003f\u0003f\u0005f\u0651\nf\u0003f\u0005f\u0654\n", - "f\u0003f\u0003f\u0003f\u0003f\u0005f\u065a\nf\u0003f\u0003f\u0003f\u0003", - "f\u0003f\u0003f\u0003f\u0003f\u0003f\u0005f\u0665\nf\u0003f\u0005f\u0668", - "\nf\u0003f\u0003f\u0003f\u0003f\u0005f\u066e\nf\u0003f\u0003f\u0003", - "f\u0003f\u0003f\u0003f\u0003f\u0003f\u0005f\u0678\nf\u0003f\u0003f\u0003", - "f\u0003f\u0003f\u0006f\u067f\nf\rf\u000ef\u0680\u0003f\u0003f\u0005", - "f\u0685\nf\u0005f\u0687\nf\u0003g\u0003g\u0003g\u0003g\u0005g\u068d", - "\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u0693\ng\u0003g\u0003g\u0003", - "g\u0003g\u0005g\u0699\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u069f\n", - "g\u0003g\u0003g\u0003g\u0003g\u0005g\u06a5\ng\u0003g\u0003g\u0003g\u0003", - "g\u0005g\u06ab\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u06b1\ng\u0003", - "g\u0003g\u0003g\u0003g\u0005g\u06b7\ng\u0003g\u0003g\u0003g\u0003g\u0005", - "g\u06bd\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u06c3\ng\u0003g\u0003", - "g\u0003g\u0003g\u0005g\u06c9\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u06cf", - "\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u06d5\ng\u0003g\u0003g\u0003", - "g\u0003g\u0005g\u06db\ng\u0003g\u0003g\u0003g\u0003g\u0005g\u06e1\n", - "g\u0003g\u0003g\u0003g\u0003g\u0005g\u06e7\ng\u0005g\u06e9\ng\u0003", - "h\u0003h\u0003h\u0003h\u0005h\u06ef\nh\u0003h\u0003h\u0003h\u0003h\u0005", - "h\u06f5\nh\u0003h\u0003h\u0003h\u0003h\u0003h\u0005h\u06fc\nh\u0003", - "h\u0005h\u06ff\nh\u0003h\u0003h\u0003h\u0005h\u0704\nh\u0003h\u0005", - "h\u0707\nh\u0003h\u0005h\u070a\nh\u0003h\u0005h\u070d\nh\u0003h\u0005", - "h\u0710\nh\u0005h\u0712\nh\u0003i\u0003i\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u071a\ni\u0003i\u0005i\u071d\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0723\ni\u0003i\u0005i\u0726\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u072c\ni\u0003i\u0005i\u072f\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0735\ni\u0003i\u0005i\u0738\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u073e\ni\u0003i\u0005i\u0741\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0747\ni\u0003i\u0005i\u074a\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0750\ni\u0003i\u0005i\u0753\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0759\ni\u0003i\u0005i\u075c\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u0762\ni\u0003i\u0005i\u0765\ni\u0003i\u0003i\u0003i\u0003", - "i\u0005i\u076b\ni\u0003i\u0003i\u0003j\u0003j\u0005j\u0771\nj\u0003", - "k\u0003k\u0003k\u0003k\u0003k\u0003k\u0005k\u0779\nk\u0003k\u0005k\u077c", - "\nk\u0003k\u0003k\u0003k\u0003k\u0005k\u0782\nk\u0003k\u0005k\u0785", - "\nk\u0003k\u0003k\u0003k\u0003k\u0005k\u078b\nk\u0003k\u0003k\u0003", - "l\u0003l\u0003l\u0003l\u0005l\u0793\nl\u0003m\u0003m\u0003m\u0003m\u0007", - "m\u0799\nm\fm\u000em\u079c\u000bm\u0003n\u0003n\u0003n\u0003n\u0007", - "n\u07a2\nn\fn\u000en\u07a5\u000bn\u0003o\u0003o\u0003o\u0003o\u0003", - "o\u0003o\u0005o\u07ad\no\u0003o\u0005o\u07b0\no\u0003o\u0003o\u0003", - "o\u0003o\u0005o\u07b6\no\u0003o\u0005o\u07b9\no\u0003o\u0003o\u0003", - "o\u0003o\u0005o\u07bf\no\u0003o\u0005o\u07c2\no\u0003o\u0003o\u0003", - "o\u0003o\u0005o\u07c8\no\u0003o\u0005o\u07cb\no\u0003o\u0003o\u0003", - "o\u0003o\u0005o\u07d1\no\u0003o\u0005o\u07d4\no\u0003o\u0003o\u0003", - "o\u0003o\u0003o\u0003o\u0005o\u07dc\no\u0003o\u0005o\u07df\no\u0003", - "o\u0003o\u0003o\u0003o\u0005o\u07e5\no\u0003o\u0005o\u07e8\no\u0003", - "o\u0003o\u0003o\u0003o\u0005o\u07ee\no\u0003o\u0005o\u07f1\no\u0003", - "o\u0003o\u0003o\u0003o\u0005o\u07f7\no\u0003o\u0005o\u07fa\no\u0003", - "o\u0003o\u0003o\u0003o\u0005o\u0800\no\u0003o\u0005o\u0803\no\u0005", - "o\u0805\no\u0003p\u0003p\u0005p\u0809\np\u0003q\u0003q\u0003q\u0003", - "q\u0003q\u0005q\u0810\nq\u0003r\u0003r\u0003r\u0003r\u0003r\u0003s\u0003", - "s\u0003s\u0003s\u0003s\u0003t\u0003t\u0003t\u0003t\u0003t\u0003u\u0003", - "u\u0003u\u0003u\u0003u\u0003v\u0005v\u0827\nv\u0003v\u0003v\u0005v\u082b", - "\nv\u0003v\u0003v\u0005v\u082f\nv\u0003v\u0003v\u0003v\u0005v\u0834", - "\nv\u0003w\u0003w\u0003w\u0003w\u0007w\u083a\nw\fw\u000ew\u083d\u000b", - "w\u0003x\u0003x\u0003x\u0003x\u0003x\u0005x\u0844\nx\u0003x\u0003x\u0005", - "x\u0848\nx\u0003y\u0005y\u084b\ny\u0003y\u0003y\u0003y\u0003y\u0005", - "y\u0851\ny\u0003y\u0003y\u0005y\u0855\ny\u0003y\u0003y\u0003y\u0003", - "y\u0003y\u0005y\u085c\ny\u0003z\u0003z\u0003z\u0003{\u0003{\u0003{\u0003", - "{\u0007{\u0865\n{\f{\u000e{\u0868\u000b{\u0003|\u0003|\u0003|\u0003", - "|\u0003}\u0003}\u0003}\u0003}\u0007}\u0872\n}\f}\u000e}\u0875\u000b", - "}\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0005~\u087d\n~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003", - "~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0003~\u0005~\u08b0\n~\u0003", - "\u007f\u0003\u007f\u0003\u007f\u0003\u007f\u0003\u007f\u0007\u007f\u08b7", - "\n\u007f\f\u007f\u000e\u007f\u08ba\u000b\u007f\u0005\u007f\u08bc\n\u007f", - "\u0003\u007f\u0003\u007f\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080", - "\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080\u0003\u0080", - "\u0007\u0080\u08ca\n\u0080\f\u0080\u000e\u0080\u08cd\u000b\u0080\u0003", - "\u0080\u0003\u0080\u0003\u0081\u0003\u0081\u0003\u0081\u0003\u0081\u0003", - "\u0081\u0007\u0081\u08d6\n\u0081\f\u0081\u000e\u0081\u08d9\u000b\u0081", - "\u0003\u0081\u0003\u0081\u0003\u0082\u0003\u0082\u0003\u0082\u0003\u0082", - "\u0003\u0082\u0007\u0082\u08e2\n\u0082\f\u0082\u000e\u0082\u08e5\u000b", - "\u0082\u0003\u0082\u0003\u0082\u0003\u0083\u0003\u0083\u0003\u0083\u0003", - "\u0083\u0003\u0083\u0007\u0083\u08ee\n\u0083\f\u0083\u000e\u0083\u08f1", - "\u000b\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0007\u0083\u08f6\n", - "\u0083\f\u0083\u000e\u0083\u08f9\u000b\u0083\u0005\u0083\u08fb\n\u0083", - "\u0003\u0083\u0003\u0083\u0003\u0083\u0003\u0083\u0007\u0083\u0901\n", - "\u0083\f\u0083\u000e\u0083\u0904\u000b\u0083\u0005\u0083\u0906\n\u0083", - "\u0003\u0083\u0003\u0083\u0003\u0084\u0005\u0084\u090b\n\u0084\u0003", - "\u0084\u0003\u0084\u0003\u0084\u0003\u0084\u0003\u0084\u0005\u0084\u0912", - "\n\u0084\u0003\u0084\u0003\u0084\u0005\u0084\u0916\n\u0084\u0003\u0084", - "\u0003\u0084\u0005\u0084\u091a\n\u0084\u0003\u0084\u0005\u0084\u091d", - "\n\u0084\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085", - "\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085", - "\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0003\u0085\u0005\u0085", - "\u092f\n\u0085\u0003\u0086\u0003\u0086\u0003\u0086\u0003\u0087\u0003", - "\u0087\u0003\u0087\u0003\u0088\u0003\u0088\u0003\u0088\u0003\u0089\u0003", - "\u0089\u0003\u0089\u0003\u0089\u0003\u008a\u0003\u008a\u0003\u008a\u0003", - "\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003\u008b\u0003", - "\u008b\u0003\u008b\u0005\u008b\u0949\n\u008b\u0003\u008c\u0003\u008c", - "\u0003\u008c\u0003\u008c\u0003\u008d\u0003\u008d\u0003\u008d\u0003\u008d", - "\u0007\u008d\u0953\n\u008d\f\u008d\u000e\u008d\u0956\u000b\u008d\u0003", - "\u008e\u0003\u008e\u0003\u008e\u0003\u008e\u0007\u008e\u095c\n\u008e", - "\f\u008e\u000e\u008e\u095f\u000b\u008e\u0003\u008f\u0003\u008f\u0003", - "\u008f\u0003\u008f\u0003\u008f\u0003\u008f\u0005\u008f\u0967\n\u008f", - "\u0003\u0090\u0003\u0090\u0005\u0090\u096b\n\u0090\u0003\u0090\u0005", - "\u0090\u096e\n\u0090\u0003\u0090\u0003\u0090\u0003\u0090\u0005\u0090", - "\u0973\n\u0090\u0003\u0090\u0005\u0090\u0976\n\u0090\u0003\u0090\u0005", - "\u0090\u0979\n\u0090\u0003\u0090\u0005\u0090\u097c\n\u0090\u0003\u0091", - "\u0003\u0091\u0003\u0091\u0003\u0092\u0003\u0092\u0003\u0092\u0003\u0093", - "\u0003\u0093\u0003\u0093\u0003\u0094\u0003\u0094\u0003\u0094\u0003\u0094", - "\u0003\u0094\u0005\u0094\u098c\n\u0094\u0003\u0095\u0003\u0095\u0003", - "\u0095\u0003\u0095\u0003\u0096\u0003\u0096\u0003\u0096\u0005\u0096\u0995", - "\n\u0096\u0003\u0097\u0003\u0097\u0003\u0097\u0003\u0098\u0003\u0098", - "\u0003\u0099\u0003\u0099\u0005\u0099\u099e\n\u0099\u0003\u0099\u0003", - "\u0099\u0003\u0099\u0007\u0099\u09a3\n\u0099\f\u0099\u000e\u0099\u09a6", - "\u000b\u0099\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0003\u009a", - "\u0003\u009a\u0003\u009a\u0003\u009a\u0005\u009a\u09b0\n\u009a\u0003", - "\u009a\u0003\u009a\u0003\u009a\u0003\u009a\u0005\u009a\u09b6\n\u009a", - "\u0005\u009a\u09b8\n\u009a\u0003\u009b\u0003\u009b\u0003\u009b\u0003", - "\u009b\u0007\u009b\u09be\n\u009b\f\u009b\u000e\u009b\u09c1\u000b\u009b", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0005\u009c\u09d9\n", - "\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003", - "\u009c\u0003\u009c\u0007\u009c\u09e2\n\u009c\f\u009c\u000e\u009c\u09e5", - "\u000b\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0007\u009c\u09ee\n\u009c\f\u009c\u000e\u009c", - "\u09f1\u000b\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003", - "\u009c\u0003\u009c\u0003\u009c\u0007\u009c\u09fa\n\u009c\f\u009c\u000e", - "\u009c\u09fd\u000b\u009c\u0003\u009c\u0003\u009c\u0003\u009c\u0003\u009c", - "\u0003\u009c\u0003\u009c\u0007\u009c\u0a05\n\u009c\f\u009c\u000e\u009c", - "\u0a08\u000b\u009c\u0003\u009c\u0003\u009c\u0005\u009c\u0a0c\n\u009c", - "\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009d\u0003\u009e\u0003\u009e", - "\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009e\u0003\u009f\u0003\u009f", - "\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f\u0003\u009f", - "\u0005\u009f\u0a20\n\u009f\u0003\u009f\u0003\u009f\u0005\u009f\u0a24", - "\n\u009f\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0005\u00a0\u0a29\n\u00a0", - "\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0003\u00a0\u0005\u00a0\u0a2f\n", - "\u00a0\u0007\u00a0\u0a31\n\u00a0\f\u00a0\u000e\u00a0\u0a34\u000b\u00a0", - "\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0003\u00a1", - "\u0003\u00a1\u0003\u00a1\u0003\u00a1\u0005\u00a1\u0a3f\n\u00a1\u0003", - "\u00a2\u0003\u00a2\u0003\u00a3\u0003\u00a3\u0003\u00a4\u0003\u00a4\u0003", - "\u00a5\u0003\u00a5\u0003\u00a6\u0003\u00a6\u0003\u00a7\u0003\u00a7\u0003", - "\u00a7\u0003\u00a7\u0003\u00a7\u0005\u00a7\u0a50\n\u00a7\u0003\u00a8", - "\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0003\u00a8\u0005\u00a8\u0a57\n", - "\u00a8\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0003\u00a9\u0005", - "\u00a9\u0a5e\n\u00a9\u0003\u00aa\u0003\u00aa\u0005\u00aa\u0a62\n\u00aa", - "\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0005\u00ab\u0a67\n\u00ab\u0003", - "\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003", - "\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003", - "\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003", - "\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003", - "\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0003\u00ab\u0005\u00ab\u0a86", - "\n\u00ab\u0003\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ac", - "\u0005\u00ac\u0a8d\n\u00ac\u0007\u00ac\u0a8f\n\u00ac\f\u00ac\u000e\u00ac", - "\u0a92\u000b\u00ac\u0003\u00ac\u0003\u00ac\u0003\u00ad\u0003\u00ad\u0005", - "\u00ad\u0a98\n\u00ad\u0003\u00ae\u0003\u00ae\u0003\u00af\u0003\u00af", - "\u0003\u00b0\u0003\u00b0\u0003\u00b1\u0003\u00b1\u0003\u00b2\u0003\u00b2", - "\u0003\u00b3\u0003\u00b3\u0003\u00b4\u0003\u00b4\u0003\u00b5\u0003\u00b5", - "\u0003\u00b6\u0003\u00b6\u0003\u00b7\u0003\u00b7\u0003\u00b8\u0003\u00b8", - "\u0003\u00b9\u0003\u00b9\u0003\u00b9\u0003\u00ba\u0003\u00ba\u0003\u00bb", - "\u0003\u00bb\u0003\u00bc\u0003\u00bc\u0003\u00bd\u0003\u00bd\u0003\u00be", - "\u0003\u00be\u0003\u00be\u0003\u00bf\u0003\u00bf\u0003\u00c0\u0003\u00c0", - "\u0003\u00c1\u0003\u00c1\u0003\u00c2\u0003\u00c2\u0003\u00c3\u0003\u00c3", - "\u0003\u00c4\u0003\u00c4\u0003\u00c5\u0003\u00c5\u0003\u00c6\u0003\u00c6", - "\u0003\u00c7\u0003\u00c7\u0003\u00c8\u0003\u00c8\u0003\u00c9\u0003\u00c9", - "\u0003\u00ca\u0003\u00ca\u0003\u00cb\u0003\u00cb\u0003\u00cc\u0003\u00cc", - "\u0003\u00cd\u0003\u00cd\u0003\u00ce\u0003\u00ce\u0003\u00cf\u0003\u00cf", - "\u0003\u00d0\u0003\u00d0\u0003\u00d1\u0003\u00d1\u0003\u00d2\u0003\u00d2", - "\u0003\u00d3\u0003\u00d3\u0003\u00d4\u0003\u00d4\u0003\u00d5\u0003\u00d5", - "\u0003\u00d6\u0003\u00d6\u0003\u00d7\u0003\u00d7\u0003\u00d8\u0003\u00d8", - "\u0003\u00d9\u0003\u00d9\u0003\u00da\u0003\u00da\u0003\u00db\u0003\u00db", - "\u0003\u00dc\u0003\u00dc\u0003\u00dd\u0003\u00dd\u0003\u00de\u0003\u00de", - "\u0003\u00df\u0003\u00df\u0003\u00e0\u0003\u00e0\u0003\u00e1\u0003\u00e1", - "\u0003\u00e2\u0003\u00e2\u0003\u00e3\u0003\u00e3\u0003\u00e4\u0003\u00e4", - "\u0003\u00e5\u0003\u00e5\u0003\u00e6\u0003\u00e6\u0003\u00e7\u0003\u00e7", - "\u0003\u00e8\u0003\u00e8\u0003\u00e9\u0003\u00e9\u0003\u00ea\u0003\u00ea", - "\u0003\u00eb\u0003\u00eb\u0003\u00ec\u0003\u00ec\u0003\u00ed\u0003\u00ed", - "\u0003\u00ee\u0003\u00ee\u0003\u00ef\u0003\u00ef\u0003\u00f0\u0003\u00f0", - "\u0003\u00f1\u0003\u00f1\u0003\u00f2\u0003\u00f2\u0003\u00f3\u0003\u00f3", - "\u0003\u00f4\u0003\u00f4\u0003\u00f5\u0003\u00f5\u0003\u00f6\u0003\u00f6", - "\u0003\u00f7\u0003\u00f7\u0003\u00f8\u0003\u00f8\u0003\u00f9\u0003\u00f9", - "\u0003\u00fa\u0003\u00fa\u0003\u00fb\u0003\u00fb\u0003\u00fc\u0003\u00fc", - "\u0003\u00fd\u0003\u00fd\u0003\u00fe\u0003\u00fe\u0003\u00ff\u0003\u00ff", - "\u0003\u0100\u0003\u0100\u0003\u0101\u0003\u0101\u0003\u0102\u0003\u0102", - "\u0003\u0103\u0003\u0103\u0003\u0104\u0003\u0104\u0003\u0105\u0003\u0105", - "\u0003\u0106\u0003\u0106\u0003\u0107\u0003\u0107\u0003\u0108\u0003\u0108", - "\u0003\u0109\u0003\u0109\u0003\u010a\u0003\u010a\u0003\u010b\u0003\u010b", - "\u0003\u010c\u0003\u010c\u0003\u010d\u0003\u010d\u0003\u010e\u0003\u010e", - "\u0003\u010f\u0003\u010f\u0003\u0110\u0003\u0110\u0003\u0111\u0003\u0111", - "\u0003\u0112\u0003\u0112\u0003\u0113\u0003\u0113\u0003\u0114\u0003\u0114", - "\u0003\u0115\u0003\u0115\u0003\u0116\u0003\u0116\u0003\u0117\u0003\u0117", - "\u0003\u0118\u0003\u0118\u0003\u0119\u0003\u0119\u0003\u011a\u0003\u011a", - "\u0003\u011b\u0003\u011b\u0003\u011c\u0003\u011c\u0003\u011d\u0003\u011d", - "\u0003\u011e\u0003\u011e\u0003\u011f\u0003\u011f\u0003\u0120\u0003\u0120", - "\u0003\u0121\u0003\u0121\u0003\u0122\u0003\u0122\u0003\u0123\u0003\u0123", - "\u0003\u0124\u0003\u0124\u0003\u0125\u0003\u0125\u0003\u0126\u0003\u0126", - "\u0003\u0127\u0003\u0127\u0003\u0128\u0003\u0128\u0003\u0129\u0003\u0129", - "\u0003\u012a\u0003\u012a\u0003\u012b\u0003\u012b\u0003\u012c\u0003\u012c", - "\u0003\u012d\u0003\u012d\u0003\u012e\u0003\u012e\u0003\u012f\u0003\u012f", - "\u0003\u0130\u0003\u0130\u0003\u0131\u0003\u0131\u0003\u0132\u0003\u0132", - "\u0003\u0133\u0003\u0133\u0003\u0134\u0003\u0134\u0003\u0135\u0003\u0135", - "\u0003\u0136\u0003\u0136\u0003\u0137\u0003\u0137\u0003\u0138\u0003\u0138", - "\u0003\u0139\u0003\u0139\u0003\u013a\u0003\u013a\u0003\u013b\u0003\u013b", - "\u0003\u013c\u0003\u013c\u0003\u013d\u0003\u013d\u0003\u013e\u0003\u013e", - "\u0003\u013f\u0003\u013f\u0003\u0140\u0003\u0140\u0003\u0141\u0003\u0141", - "\u0003\u0142\u0003\u0142\u0003\u0143\u0003\u0143\u0003\u0144\u0003\u0144", - "\u0003\u0145\u0003\u0145\u0003\u0146\u0003\u0146\u0003\u0147\u0003\u0147", - "\u0003\u0148\u0003\u0148\u0003\u0149\u0003\u0149\u0003\u014a\u0003\u014a", - "\u0003\u014b\u0003\u014b\u0003\u014c\u0003\u014c\u0003\u014d\u0003\u014d", - "\u0003\u014e\u0003\u014e\u0003\u014f\u0003\u014f\u0003\u0150\u0003\u0150", - "\u0003\u0151\u0003\u0151\u0003\u0152\u0003\u0152\u0003\u0153\u0003\u0153", - "\u0003\u0154\u0003\u0154\u0003\u0155\u0003\u0155\u0003\u0156\u0003\u0156", - "\u0003\u0157\u0003\u0157\u0003\u0158\u0003\u0158\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159\u0003\u0159", - "\u0003\u0159\u0003\u0159\u0003\u0159\u0005\u0159\u0c81\n\u0159\u0003", - "\u0159\u0002\u0002\u015a\u0002\u0004\u0006\b\n\f\u000e\u0010\u0012\u0014", - '\u0016\u0018\u001a\u001c\u001e "$&(*,.02468:<>@BDFHJLNPRTVXZ\\^`bd', - "fhjlnprtvxz|~\u0080\u0082\u0084\u0086\u0088\u008a\u008c\u008e\u0090", - "\u0092\u0094\u0096\u0098\u009a\u009c\u009e\u00a0\u00a2\u00a4\u00a6\u00a8", - "\u00aa\u00ac\u00ae\u00b0\u00b2\u00b4\u00b6\u00b8\u00ba\u00bc\u00be\u00c0", - "\u00c2\u00c4\u00c6\u00c8\u00ca\u00cc\u00ce\u00d0\u00d2\u00d4\u00d6\u00d8", - "\u00da\u00dc\u00de\u00e0\u00e2\u00e4\u00e6\u00e8\u00ea\u00ec\u00ee\u00f0", - "\u00f2\u00f4\u00f6\u00f8\u00fa\u00fc\u00fe\u0100\u0102\u0104\u0106\u0108", - "\u010a\u010c\u010e\u0110\u0112\u0114\u0116\u0118\u011a\u011c\u011e\u0120", - "\u0122\u0124\u0126\u0128\u012a\u012c\u012e\u0130\u0132\u0134\u0136\u0138", - "\u013a\u013c\u013e\u0140\u0142\u0144\u0146\u0148\u014a\u014c\u014e\u0150", - "\u0152\u0154\u0156\u0158\u015a\u015c\u015e\u0160\u0162\u0164\u0166\u0168", - "\u016a\u016c\u016e\u0170\u0172\u0174\u0176\u0178\u017a\u017c\u017e\u0180", - "\u0182\u0184\u0186\u0188\u018a\u018c\u018e\u0190\u0192\u0194\u0196\u0198", - "\u019a\u019c\u019e\u01a0\u01a2\u01a4\u01a6\u01a8\u01aa\u01ac\u01ae\u01b0", - "\u01b2\u01b4\u01b6\u01b8\u01ba\u01bc\u01be\u01c0\u01c2\u01c4\u01c6\u01c8", - "\u01ca\u01cc\u01ce\u01d0\u01d2\u01d4\u01d6\u01d8\u01da\u01dc\u01de\u01e0", - "\u01e2\u01e4\u01e6\u01e8\u01ea\u01ec\u01ee\u01f0\u01f2\u01f4\u01f6\u01f8", - "\u01fa\u01fc\u01fe\u0200\u0202\u0204\u0206\u0208\u020a\u020c\u020e\u0210", - "\u0212\u0214\u0216\u0218\u021a\u021c\u021e\u0220\u0222\u0224\u0226\u0228", - "\u022a\u022c\u022e\u0230\u0232\u0234\u0236\u0238\u023a\u023c\u023e\u0240", - "\u0242\u0244\u0246\u0248\u024a\u024c\u024e\u0250\u0252\u0254\u0256\u0258", - "\u025a\u025c\u025e\u0260\u0262\u0264\u0266\u0268\u026a\u026c\u026e\u0270", - "\u0272\u0274\u0276\u0278\u027a\u027c\u027e\u0280\u0282\u0284\u0286\u0288", - "\u028a\u028c\u028e\u0290\u0292\u0294\u0296\u0298\u029a\u029c\u029e\u02a0", - "\u02a2\u02a4\u02a6\u02a8\u02aa\u02ac\u02ae\u02b0\u0002\u0007\u0003\u0002", - "\u00d6\u00d7\u0004\u0002\u0014\u0014\u0016\u0016\u0003\u0002\u00de\u00e2", - "\u0003\u0002\u00d8\u00d9\u0004\u0002::\u0083\u0083\u0002\u0d56\u0002", - "\u02b3\u0003\u0002\u0002\u0002\u0004\u02c3\u0003\u0002\u0002\u0002\u0006", - "\u02d0\u0003\u0002\u0002\u0002\b\u02d2\u0003\u0002\u0002\u0002\n\u02fa", - "\u0003\u0002\u0002\u0002\f\u02fc\u0003\u0002\u0002\u0002\u000e\u0303", - "\u0003\u0002\u0002\u0002\u0010\u0306\u0003\u0002\u0002\u0002\u0012\u0310", - "\u0003\u0002\u0002\u0002\u0014\u031c\u0003\u0002\u0002\u0002\u0016\u032f", - "\u0003\u0002\u0002\u0002\u0018\u035d\u0003\u0002\u0002\u0002\u001a\u035f", - "\u0003\u0002\u0002\u0002\u001c\u036c\u0003\u0002\u0002\u0002\u001e\u0375", - '\u0003\u0002\u0002\u0002 \u0384\u0003\u0002\u0002\u0002"\u038f\u0003', - "\u0002\u0002\u0002$\u039d\u0003\u0002\u0002\u0002&\u03bc\u0003\u0002", - "\u0002\u0002(\u03c3\u0003\u0002\u0002\u0002*\u03cc\u0003\u0002\u0002", - "\u0002,\u03d1\u0003\u0002\u0002\u0002.\u03d3\u0003\u0002\u0002\u0002", - "0\u03e4\u0003\u0002\u0002\u00022\u03ff\u0003\u0002\u0002\u00024\u0401", - "\u0003\u0002\u0002\u00026\u040e\u0003\u0002\u0002\u00028\u0414\u0003", - "\u0002\u0002\u0002:\u0432\u0003\u0002\u0002\u0002<\u0434\u0003\u0002", - "\u0002\u0002>\u0440\u0003\u0002\u0002\u0002@\u0444\u0003\u0002\u0002", - "\u0002B\u0451\u0003\u0002\u0002\u0002D\u045d\u0003\u0002\u0002\u0002", - "F\u0460\u0003\u0002\u0002\u0002H\u0468\u0003\u0002\u0002\u0002J\u046d", - "\u0003\u0002\u0002\u0002L\u046f\u0003\u0002\u0002\u0002N\u047c\u0003", - "\u0002\u0002\u0002P\u047e\u0003\u0002\u0002\u0002R\u0481\u0003\u0002", - "\u0002\u0002T\u048a\u0003\u0002\u0002\u0002V\u048e\u0003\u0002\u0002", - "\u0002X\u0491\u0003\u0002\u0002\u0002Z\u0496\u0003\u0002\u0002\u0002", - "\\\u04a6\u0003\u0002\u0002\u0002^\u04a8\u0003\u0002\u0002\u0002`\u04ab", - "\u0003\u0002\u0002\u0002b\u04b0\u0003\u0002\u0002\u0002d\u04b4\u0003", - "\u0002\u0002\u0002f\u04b7\u0003\u0002\u0002\u0002h\u04c0\u0003\u0002", - "\u0002\u0002j\u04c3\u0003\u0002\u0002\u0002l\u04ce\u0003\u0002\u0002", - "\u0002n\u04d4\u0003\u0002\u0002\u0002p\u04ee\u0003\u0002\u0002\u0002", - "r\u04f0\u0003\u0002\u0002\u0002t\u04fe\u0003\u0002\u0002\u0002v\u0505", - "\u0003\u0002\u0002\u0002x\u0511\u0003\u0002\u0002\u0002z\u051e\u0003", - "\u0002\u0002\u0002|\u052a\u0003\u0002\u0002\u0002~\u0536\u0003\u0002", - "\u0002\u0002\u0080\u0544\u0003\u0002\u0002\u0002\u0082\u054b\u0003\u0002", - "\u0002\u0002\u0084\u0557\u0003\u0002\u0002\u0002\u0086\u055e\u0003\u0002", - "\u0002\u0002\u0088\u056a\u0003\u0002\u0002\u0002\u008a\u057b\u0003\u0002", - "\u0002\u0002\u008c\u057f\u0003\u0002\u0002\u0002\u008e\u058d\u0003\u0002", - "\u0002\u0002\u0090\u0594\u0003\u0002\u0002\u0002\u0092\u05a6\u0003\u0002", - "\u0002\u0002\u0094\u05a8\u0003\u0002\u0002\u0002\u0096\u05ad\u0003\u0002", - "\u0002\u0002\u0098\u05af\u0003\u0002\u0002\u0002\u009a\u05bb\u0003\u0002", - "\u0002\u0002\u009c\u05bf\u0003\u0002\u0002\u0002\u009e\u05c4\u0003\u0002", - "\u0002\u0002\u00a0\u05c6\u0003\u0002\u0002\u0002\u00a2\u05d4\u0003\u0002", - "\u0002\u0002\u00a4\u05d9\u0003\u0002\u0002\u0002\u00a6\u05dc\u0003\u0002", - "\u0002\u0002\u00a8\u05e5\u0003\u0002\u0002\u0002\u00aa\u05e7\u0003\u0002", - "\u0002\u0002\u00ac\u05e9\u0003\u0002\u0002\u0002\u00ae\u05ef\u0003\u0002", - "\u0002\u0002\u00b0\u05f7\u0003\u0002\u0002\u0002\u00b2\u0600\u0003\u0002", - "\u0002\u0002\u00b4\u0609\u0003\u0002\u0002\u0002\u00b6\u060b\u0003\u0002", - "\u0002\u0002\u00b8\u060d\u0003\u0002\u0002\u0002\u00ba\u0610\u0003\u0002", - "\u0002\u0002\u00bc\u061a\u0003\u0002\u0002\u0002\u00be\u061c\u0003\u0002", - "\u0002\u0002\u00c0\u062a\u0003\u0002\u0002\u0002\u00c2\u0639\u0003\u0002", - "\u0002\u0002\u00c4\u063b\u0003\u0002\u0002\u0002\u00c6\u063f\u0003\u0002", - "\u0002\u0002\u00c8\u0642\u0003\u0002\u0002\u0002\u00ca\u0686\u0003\u0002", - "\u0002\u0002\u00cc\u06e8\u0003\u0002\u0002\u0002\u00ce\u06ea\u0003\u0002", - "\u0002\u0002\u00d0\u0713\u0003\u0002\u0002\u0002\u00d2\u0770\u0003\u0002", - "\u0002\u0002\u00d4\u0772\u0003\u0002\u0002\u0002\u00d6\u0792\u0003\u0002", - "\u0002\u0002\u00d8\u0794\u0003\u0002\u0002\u0002\u00da\u079d\u0003\u0002", - "\u0002\u0002\u00dc\u0804\u0003\u0002\u0002\u0002\u00de\u0808\u0003\u0002", - "\u0002\u0002\u00e0\u080f\u0003\u0002\u0002\u0002\u00e2\u0811\u0003\u0002", - "\u0002\u0002\u00e4\u0816\u0003\u0002\u0002\u0002\u00e6\u081b\u0003\u0002", - "\u0002\u0002\u00e8\u0820\u0003\u0002\u0002\u0002\u00ea\u0826\u0003\u0002", - "\u0002\u0002\u00ec\u0835\u0003\u0002\u0002\u0002\u00ee\u0847\u0003\u0002", - "\u0002\u0002\u00f0\u084a\u0003\u0002\u0002\u0002\u00f2\u085d\u0003\u0002", - "\u0002\u0002\u00f4\u0860\u0003\u0002\u0002\u0002\u00f6\u0869\u0003\u0002", - "\u0002\u0002\u00f8\u086d\u0003\u0002\u0002\u0002\u00fa\u08af\u0003\u0002", - "\u0002\u0002\u00fc\u08b1\u0003\u0002\u0002\u0002\u00fe\u08bf\u0003\u0002", - "\u0002\u0002\u0100\u08d0\u0003\u0002\u0002\u0002\u0102\u08dc\u0003\u0002", - "\u0002\u0002\u0104\u08e8\u0003\u0002\u0002\u0002\u0106\u090a\u0003\u0002", - "\u0002\u0002\u0108\u092e\u0003\u0002\u0002\u0002\u010a\u0930\u0003\u0002", - "\u0002\u0002\u010c\u0933\u0003\u0002\u0002\u0002\u010e\u0936\u0003\u0002", - "\u0002\u0002\u0110\u0939\u0003\u0002\u0002\u0002\u0112\u093d\u0003\u0002", - "\u0002\u0002\u0114\u0948\u0003\u0002\u0002\u0002\u0116\u094a\u0003\u0002", - "\u0002\u0002\u0118\u094e\u0003\u0002\u0002\u0002\u011a\u0957\u0003\u0002", - "\u0002\u0002\u011c\u0966\u0003\u0002\u0002\u0002\u011e\u0968\u0003\u0002", - "\u0002\u0002\u0120\u097d\u0003\u0002\u0002\u0002\u0122\u0980\u0003\u0002", - "\u0002\u0002\u0124\u0983\u0003\u0002\u0002\u0002\u0126\u098b\u0003\u0002", - "\u0002\u0002\u0128\u098d\u0003\u0002\u0002\u0002\u012a\u0991\u0003\u0002", - "\u0002\u0002\u012c\u0996\u0003\u0002\u0002\u0002\u012e\u0999\u0003\u0002", - "\u0002\u0002\u0130\u099d\u0003\u0002\u0002\u0002\u0132\u09b7\u0003\u0002", - "\u0002\u0002\u0134\u09b9\u0003\u0002\u0002\u0002\u0136\u0a0b\u0003\u0002", - "\u0002\u0002\u0138\u0a0d\u0003\u0002\u0002\u0002\u013a\u0a11\u0003\u0002", - "\u0002\u0002\u013c\u0a23\u0003\u0002\u0002\u0002\u013e\u0a28\u0003\u0002", - "\u0002\u0002\u0140\u0a3e\u0003\u0002\u0002\u0002\u0142\u0a40\u0003\u0002", - "\u0002\u0002\u0144\u0a42\u0003\u0002\u0002\u0002\u0146\u0a44\u0003\u0002", - "\u0002\u0002\u0148\u0a46\u0003\u0002\u0002\u0002\u014a\u0a48\u0003\u0002", - "\u0002\u0002\u014c\u0a4f\u0003\u0002\u0002\u0002\u014e\u0a56\u0003\u0002", - "\u0002\u0002\u0150\u0a5d\u0003\u0002\u0002\u0002\u0152\u0a5f\u0003\u0002", - "\u0002\u0002\u0154\u0a85\u0003\u0002\u0002\u0002\u0156\u0a87\u0003\u0002", - "\u0002\u0002\u0158\u0a97\u0003\u0002\u0002\u0002\u015a\u0a99\u0003\u0002", - "\u0002\u0002\u015c\u0a9b\u0003\u0002\u0002\u0002\u015e\u0a9d\u0003\u0002", - "\u0002\u0002\u0160\u0a9f\u0003\u0002\u0002\u0002\u0162\u0aa1\u0003\u0002", - "\u0002\u0002\u0164\u0aa3\u0003\u0002\u0002\u0002\u0166\u0aa5\u0003\u0002", - "\u0002\u0002\u0168\u0aa7\u0003\u0002\u0002\u0002\u016a\u0aa9\u0003\u0002", - "\u0002\u0002\u016c\u0aab\u0003\u0002\u0002\u0002\u016e\u0aad\u0003\u0002", - "\u0002\u0002\u0170\u0aaf\u0003\u0002\u0002\u0002\u0172\u0ab2\u0003\u0002", - "\u0002\u0002\u0174\u0ab4\u0003\u0002\u0002\u0002\u0176\u0ab6\u0003\u0002", - "\u0002\u0002\u0178\u0ab8\u0003\u0002\u0002\u0002\u017a\u0aba\u0003\u0002", - "\u0002\u0002\u017c\u0abd\u0003\u0002\u0002\u0002\u017e\u0abf\u0003\u0002", - "\u0002\u0002\u0180\u0ac1\u0003\u0002\u0002\u0002\u0182\u0ac3\u0003\u0002", - "\u0002\u0002\u0184\u0ac5\u0003\u0002\u0002\u0002\u0186\u0ac7\u0003\u0002", - "\u0002\u0002\u0188\u0ac9\u0003\u0002\u0002\u0002\u018a\u0acb\u0003\u0002", - "\u0002\u0002\u018c\u0acd\u0003\u0002\u0002\u0002\u018e\u0acf\u0003\u0002", - "\u0002\u0002\u0190\u0ad1\u0003\u0002\u0002\u0002\u0192\u0ad3\u0003\u0002", - "\u0002\u0002\u0194\u0ad5\u0003\u0002\u0002\u0002\u0196\u0ad7\u0003\u0002", - "\u0002\u0002\u0198\u0ad9\u0003\u0002\u0002\u0002\u019a\u0adb\u0003\u0002", - "\u0002\u0002\u019c\u0add\u0003\u0002\u0002\u0002\u019e\u0adf\u0003\u0002", - "\u0002\u0002\u01a0\u0ae1\u0003\u0002\u0002\u0002\u01a2\u0ae3\u0003\u0002", - "\u0002\u0002\u01a4\u0ae5\u0003\u0002\u0002\u0002\u01a6\u0ae7\u0003\u0002", - "\u0002\u0002\u01a8\u0ae9\u0003\u0002\u0002\u0002\u01aa\u0aeb\u0003\u0002", - "\u0002\u0002\u01ac\u0aed\u0003\u0002\u0002\u0002\u01ae\u0aef\u0003\u0002", - "\u0002\u0002\u01b0\u0af1\u0003\u0002\u0002\u0002\u01b2\u0af3\u0003\u0002", - "\u0002\u0002\u01b4\u0af5\u0003\u0002\u0002\u0002\u01b6\u0af7\u0003\u0002", - "\u0002\u0002\u01b8\u0af9\u0003\u0002\u0002\u0002\u01ba\u0afb\u0003\u0002", - "\u0002\u0002\u01bc\u0afd\u0003\u0002\u0002\u0002\u01be\u0aff\u0003\u0002", - "\u0002\u0002\u01c0\u0b01\u0003\u0002\u0002\u0002\u01c2\u0b03\u0003\u0002", - "\u0002\u0002\u01c4\u0b05\u0003\u0002\u0002\u0002\u01c6\u0b07\u0003\u0002", - "\u0002\u0002\u01c8\u0b09\u0003\u0002\u0002\u0002\u01ca\u0b0b\u0003\u0002", - "\u0002\u0002\u01cc\u0b0d\u0003\u0002\u0002\u0002\u01ce\u0b0f\u0003\u0002", - "\u0002\u0002\u01d0\u0b11\u0003\u0002\u0002\u0002\u01d2\u0b13\u0003\u0002", - "\u0002\u0002\u01d4\u0b15\u0003\u0002\u0002\u0002\u01d6\u0b17\u0003\u0002", - "\u0002\u0002\u01d8\u0b19\u0003\u0002\u0002\u0002\u01da\u0b1b\u0003\u0002", - "\u0002\u0002\u01dc\u0b1d\u0003\u0002\u0002\u0002\u01de\u0b1f\u0003\u0002", - "\u0002\u0002\u01e0\u0b21\u0003\u0002\u0002\u0002\u01e2\u0b23\u0003\u0002", - "\u0002\u0002\u01e4\u0b25\u0003\u0002\u0002\u0002\u01e6\u0b27\u0003\u0002", - "\u0002\u0002\u01e8\u0b29\u0003\u0002\u0002\u0002\u01ea\u0b2b\u0003\u0002", - "\u0002\u0002\u01ec\u0b2d\u0003\u0002\u0002\u0002\u01ee\u0b2f\u0003\u0002", - "\u0002\u0002\u01f0\u0b31\u0003\u0002\u0002\u0002\u01f2\u0b33\u0003\u0002", - "\u0002\u0002\u01f4\u0b35\u0003\u0002\u0002\u0002\u01f6\u0b37\u0003\u0002", - "\u0002\u0002\u01f8\u0b39\u0003\u0002\u0002\u0002\u01fa\u0b3b\u0003\u0002", - "\u0002\u0002\u01fc\u0b3d\u0003\u0002\u0002\u0002\u01fe\u0b3f\u0003\u0002", - "\u0002\u0002\u0200\u0b41\u0003\u0002\u0002\u0002\u0202\u0b43\u0003\u0002", - "\u0002\u0002\u0204\u0b45\u0003\u0002\u0002\u0002\u0206\u0b47\u0003\u0002", - "\u0002\u0002\u0208\u0b49\u0003\u0002\u0002\u0002\u020a\u0b4b\u0003\u0002", - "\u0002\u0002\u020c\u0b4d\u0003\u0002\u0002\u0002\u020e\u0b4f\u0003\u0002", - "\u0002\u0002\u0210\u0b51\u0003\u0002\u0002\u0002\u0212\u0b53\u0003\u0002", - "\u0002\u0002\u0214\u0b55\u0003\u0002\u0002\u0002\u0216\u0b57\u0003\u0002", - "\u0002\u0002\u0218\u0b59\u0003\u0002\u0002\u0002\u021a\u0b5b\u0003\u0002", - "\u0002\u0002\u021c\u0b5d\u0003\u0002\u0002\u0002\u021e\u0b5f\u0003\u0002", - "\u0002\u0002\u0220\u0b61\u0003\u0002\u0002\u0002\u0222\u0b63\u0003\u0002", - "\u0002\u0002\u0224\u0b65\u0003\u0002\u0002\u0002\u0226\u0b67\u0003\u0002", - "\u0002\u0002\u0228\u0b69\u0003\u0002\u0002\u0002\u022a\u0b6b\u0003\u0002", - "\u0002\u0002\u022c\u0b6d\u0003\u0002\u0002\u0002\u022e\u0b6f\u0003\u0002", - "\u0002\u0002\u0230\u0b71\u0003\u0002\u0002\u0002\u0232\u0b73\u0003\u0002", - "\u0002\u0002\u0234\u0b75\u0003\u0002\u0002\u0002\u0236\u0b77\u0003\u0002", - "\u0002\u0002\u0238\u0b79\u0003\u0002\u0002\u0002\u023a\u0b7b\u0003\u0002", - "\u0002\u0002\u023c\u0b7d\u0003\u0002\u0002\u0002\u023e\u0b7f\u0003\u0002", - "\u0002\u0002\u0240\u0b81\u0003\u0002\u0002\u0002\u0242\u0b83\u0003\u0002", - "\u0002\u0002\u0244\u0b85\u0003\u0002\u0002\u0002\u0246\u0b87\u0003\u0002", - "\u0002\u0002\u0248\u0b89\u0003\u0002\u0002\u0002\u024a\u0b8b\u0003\u0002", - "\u0002\u0002\u024c\u0b8d\u0003\u0002\u0002\u0002\u024e\u0b8f\u0003\u0002", - "\u0002\u0002\u0250\u0b91\u0003\u0002\u0002\u0002\u0252\u0b93\u0003\u0002", - "\u0002\u0002\u0254\u0b95\u0003\u0002\u0002\u0002\u0256\u0b97\u0003\u0002", - "\u0002\u0002\u0258\u0b99\u0003\u0002\u0002\u0002\u025a\u0b9b\u0003\u0002", - "\u0002\u0002\u025c\u0b9d\u0003\u0002\u0002\u0002\u025e\u0b9f\u0003\u0002", - "\u0002\u0002\u0260\u0ba1\u0003\u0002\u0002\u0002\u0262\u0ba3\u0003\u0002", - "\u0002\u0002\u0264\u0ba5\u0003\u0002\u0002\u0002\u0266\u0ba7\u0003\u0002", - "\u0002\u0002\u0268\u0ba9\u0003\u0002\u0002\u0002\u026a\u0bab\u0003\u0002", - "\u0002\u0002\u026c\u0bad\u0003\u0002\u0002\u0002\u026e\u0baf\u0003\u0002", - "\u0002\u0002\u0270\u0bb1\u0003\u0002\u0002\u0002\u0272\u0bb3\u0003\u0002", - "\u0002\u0002\u0274\u0bb5\u0003\u0002\u0002\u0002\u0276\u0bb7\u0003\u0002", - "\u0002\u0002\u0278\u0bb9\u0003\u0002\u0002\u0002\u027a\u0bbb\u0003\u0002", - "\u0002\u0002\u027c\u0bbd\u0003\u0002\u0002\u0002\u027e\u0bbf\u0003\u0002", - "\u0002\u0002\u0280\u0bc1\u0003\u0002\u0002\u0002\u0282\u0bc3\u0003\u0002", - "\u0002\u0002\u0284\u0bc5\u0003\u0002\u0002\u0002\u0286\u0bc7\u0003\u0002", - "\u0002\u0002\u0288\u0bc9\u0003\u0002\u0002\u0002\u028a\u0bcb\u0003\u0002", - "\u0002\u0002\u028c\u0bcd\u0003\u0002\u0002\u0002\u028e\u0bcf\u0003\u0002", - "\u0002\u0002\u0290\u0bd1\u0003\u0002\u0002\u0002\u0292\u0bd3\u0003\u0002", - "\u0002\u0002\u0294\u0bd5\u0003\u0002\u0002\u0002\u0296\u0bd7\u0003\u0002", - "\u0002\u0002\u0298\u0bd9\u0003\u0002\u0002\u0002\u029a\u0bdb\u0003\u0002", - "\u0002\u0002\u029c\u0bdd\u0003\u0002\u0002\u0002\u029e\u0bdf\u0003\u0002", - "\u0002\u0002\u02a0\u0be1\u0003\u0002\u0002\u0002\u02a2\u0be3\u0003\u0002", - "\u0002\u0002\u02a4\u0be5\u0003\u0002\u0002\u0002\u02a6\u0be7\u0003\u0002", - "\u0002\u0002\u02a8\u0be9\u0003\u0002\u0002\u0002\u02aa\u0beb\u0003\u0002", - "\u0002\u0002\u02ac\u0bed\u0003\u0002\u0002\u0002\u02ae\u0bef\u0003\u0002", - "\u0002\u0002\u02b0\u0c80\u0003\u0002\u0002\u0002\u02b2\u02b4\u0005\u0004", - "\u0003\u0002\u02b3\u02b2\u0003\u0002\u0002\u0002\u02b3\u02b4\u0003\u0002", - "\u0002\u0002\u02b4\u02b6\u0003\u0002\u0002\u0002\u02b5\u02b7\u0007\u0015", - "\u0002\u0002\u02b6\u02b5\u0003\u0002\u0002\u0002\u02b6\u02b7\u0003\u0002", - "\u0002\u0002\u02b7\u02b8\u0003\u0002\u0002\u0002\u02b8\u02b9\u0005\u029a", - "\u014e\u0002\u02b9\u0003\u0003\u0002\u0002\u0002\u02ba\u02bc\u0005\n", - "\u0006\u0002\u02bb\u02bd\u0007\u0015\u0002\u0002\u02bc\u02bb\u0003\u0002", - "\u0002\u0002\u02bc\u02bd\u0003\u0002\u0002\u0002\u02bd\u02be\u0003\u0002", - "\u0002\u0002\u02be\u02bf\u0005\u0006\u0004\u0002\u02bf\u02c2\u0003\u0002", - "\u0002\u0002\u02c0\u02c2\u0005\b\u0005\u0002\u02c1\u02ba\u0003\u0002", - "\u0002\u0002\u02c1\u02c0\u0003\u0002\u0002\u0002\u02c2\u02c5\u0003\u0002", - "\u0002\u0002\u02c3\u02c1\u0003\u0002\u0002\u0002\u02c3\u02c4\u0003\u0002", - "\u0002\u0002\u02c4\u02ce\u0003\u0002\u0002\u0002\u02c5\u02c3\u0003\u0002", - "\u0002\u0002\u02c6\u02cb\u0005\n\u0006\u0002\u02c7\u02c9\u0007\u0015", - "\u0002\u0002\u02c8\u02c7\u0003\u0002\u0002\u0002\u02c8\u02c9\u0003\u0002", - "\u0002\u0002\u02c9\u02ca\u0003\u0002\u0002\u0002\u02ca\u02cc\u0005\u0006", - "\u0004\u0002\u02cb\u02c8\u0003\u0002\u0002\u0002\u02cb\u02cc\u0003\u0002", - "\u0002\u0002\u02cc\u02cf\u0003\u0002\u0002\u0002\u02cd\u02cf\u0005\b", - "\u0005\u0002\u02ce\u02c6\u0003\u0002\u0002\u0002\u02ce\u02cd\u0003\u0002", - "\u0002\u0002\u02cf\u0005\u0003\u0002\u0002\u0002\u02d0\u02d1\u0007\n", - "\u0002\u0002\u02d1\u0007\u0003\u0002\u0002\u0002\u02d2\u02d3\u0005\u0006", - "\u0004\u0002\u02d3\t\u0003\u0002\u0002\u0002\u02d4\u02fb\u0005\u00be", - "`\u0002\u02d5\u02fb\u0005r:\u0002\u02d6\u02fb\u0005l7\u0002\u02d7\u02fb", - "\u0005Z.\u0002\u02d8\u02fb\u0005L'\u0002\u02d9\u02fb\u0005F$\u0002", - "\u02da\u02fb\u0005\u00b8]\u0002\u02db\u02fb\u00058\u001d\u0002\u02dc", - "\u02fb\u00050\u0019\u0002\u02dd\u02fb\u0005\u00caf\u0002\u02de\u02fb", - "\u0005\u00ceh\u0002\u02df\u02fb\u0005.\u0018\u0002\u02e0\u02fb\u0005", - "$\u0013\u0002\u02e1\u02fb\u0005\u001c\u000f\u0002\u02e2\u02fb\u0005", - '\u0088E\u0002\u02e3\u02fb\u0005"\u0012\u0002\u02e4\u02fb\u0005\u001e', - "\u0010\u0002\u02e5\u02fb\u0005\u001a\u000e\u0002\u02e6\u02fb\u0005\u00ea", - "v\u0002\u02e7\u02fb\u0005z>\u0002\u02e8\u02fb\u0005|?\u0002\u02e9\u02fb", - "\u0005\u0086D\u0002\u02ea\u02fb\u0005\u0084C\u0002\u02eb\u02fb\u0005", - "x=\u0002\u02ec\u02fb\u0005\u0080A\u0002\u02ed\u02fb\u0005\u0082B\u0002", - "\u02ee\u02fb\u0005~@\u0002\u02ef\u02fb\u0005v<\u0002\u02f0\u02fb\u0005", - "t;\u0002\u02f1\u02fb\u0005\u0014\u000b\u0002\u02f2\u02fb\u0005\u0106", - "\u0084\u0002\u02f3\u02fb\u0005\u0012\n\u0002\u02f4\u02fb\u0005\u0010", - "\t\u0002\u02f5\u02fb\u0005\f\u0007\u0002\u02f6\u02fb\u0005\u011e\u0090", - "\u0002\u02f7\u02fb\u0005\u00c8e\u0002\u02f8\u02fb\u0005\u00f0y\u0002", - "\u02f9\u02fb\u0005\u00c6d\u0002\u02fa\u02d4\u0003\u0002\u0002\u0002", - "\u02fa\u02d5\u0003\u0002\u0002\u0002\u02fa\u02d6\u0003\u0002\u0002\u0002", - "\u02fa\u02d7\u0003\u0002\u0002\u0002\u02fa\u02d8\u0003\u0002\u0002\u0002", - "\u02fa\u02d9\u0003\u0002\u0002\u0002\u02fa\u02da\u0003\u0002\u0002\u0002", - "\u02fa\u02db\u0003\u0002\u0002\u0002\u02fa\u02dc\u0003\u0002\u0002\u0002", - "\u02fa\u02dd\u0003\u0002\u0002\u0002\u02fa\u02de\u0003\u0002\u0002\u0002", - "\u02fa\u02df\u0003\u0002\u0002\u0002\u02fa\u02e0\u0003\u0002\u0002\u0002", - "\u02fa\u02e1\u0003\u0002\u0002\u0002\u02fa\u02e2\u0003\u0002\u0002\u0002", - "\u02fa\u02e3\u0003\u0002\u0002\u0002\u02fa\u02e4\u0003\u0002\u0002\u0002", - "\u02fa\u02e5\u0003\u0002\u0002\u0002\u02fa\u02e6\u0003\u0002\u0002\u0002", - "\u02fa\u02e7\u0003\u0002\u0002\u0002\u02fa\u02e8\u0003\u0002\u0002\u0002", - "\u02fa\u02e9\u0003\u0002\u0002\u0002\u02fa\u02ea\u0003\u0002\u0002\u0002", - "\u02fa\u02eb\u0003\u0002\u0002\u0002\u02fa\u02ec\u0003\u0002\u0002\u0002", - "\u02fa\u02ed\u0003\u0002\u0002\u0002\u02fa\u02ee\u0003\u0002\u0002\u0002", - "\u02fa\u02ef\u0003\u0002\u0002\u0002\u02fa\u02f0\u0003\u0002\u0002\u0002", - "\u02fa\u02f1\u0003\u0002\u0002\u0002\u02fa\u02f2\u0003\u0002\u0002\u0002", - "\u02fa\u02f3\u0003\u0002\u0002\u0002\u02fa\u02f4\u0003\u0002\u0002\u0002", - "\u02fa\u02f5\u0003\u0002\u0002\u0002\u02fa\u02f6\u0003\u0002\u0002\u0002", - "\u02fa\u02f7\u0003\u0002\u0002\u0002\u02fa\u02f8\u0003\u0002\u0002\u0002", - "\u02fa\u02f9\u0003\u0002\u0002\u0002\u02fb\u000b\u0003\u0002\u0002\u0002", - "\u02fc\u02fd\u0005\u0298\u014d\u0002\u02fd\u02fe\u0005\u0016\f\u0002", - "\u02fe\u02ff\u0005\u024c\u0127\u0002\u02ff\u0300\u0005\u0018\r\u0002", - "\u0300\u0301\u0005\u01b0\u00d9\u0002\u0301\u0302\u0005\u015a\u00ae\u0002", - "\u0302\r\u0003\u0002\u0002\u0002\u0303\u0304\u0005\u0238\u011d\u0002", - "\u0304\u0305\u0005\u028c\u0147\u0002\u0305\u000f\u0003\u0002\u0002\u0002", - "\u0306\u0307\u0005\u0238\u011d\u0002\u0307\u030b\u0005\u0268\u0135\u0002", - "\u0308\u0309\u0005\u024a\u0126\u0002\u0309\u030a\u0005\u015a\u00ae\u0002", - "\u030a\u030c\u0003\u0002\u0002\u0002\u030b\u0308\u0003\u0002\u0002\u0002", - "\u030b\u030c\u0003\u0002\u0002\u0002\u030c\u030e\u0003\u0002\u0002\u0002", - "\u030d\u030f\u0005\u0244\u0123\u0002\u030e\u030d\u0003\u0002\u0002\u0002", - "\u030e\u030f\u0003\u0002\u0002\u0002\u030f\u0011\u0003\u0002\u0002\u0002", - "\u0310\u0311\u0005\u0238\u011d\u0002\u0311\u0315\u0005\u0016\f\u0002", - "\u0312\u0313\u0005\u024c\u0127\u0002\u0313\u0314\u0005\u0018\r\u0002", - "\u0314\u0316\u0003\u0002\u0002\u0002\u0315\u0312\u0003\u0002\u0002\u0002", - "\u0315\u0316\u0003\u0002\u0002\u0002\u0316\u031a\u0003\u0002\u0002\u0002", - "\u0317\u0318\u0005\u024a\u0126\u0002\u0318\u0319\u0005\u015a\u00ae\u0002", - "\u0319\u031b\u0003\u0002\u0002\u0002\u031a\u0317\u0003\u0002\u0002\u0002", - "\u031a\u031b\u0003\u0002\u0002\u0002\u031b\u0013\u0003\u0002\u0002\u0002", - "\u031c\u031d\u0005\u01b8\u00dd\u0002\u031d\u031e\u0005\u0016\f\u0002", - "\u031e\u031f\u0005\u024c\u0127\u0002\u031f\u0320\u0005\u0018\r\u0002", - "\u0320\u0321\u0005\u027a\u013e\u0002\u0321\u0322\u0005\u015a\u00ae\u0002", - "\u0322\u0015\u0003\u0002\u0002\u0002\u0323\u0326\u0005\u0178\u00bd\u0002", - "\u0324\u0326\u0005\u017a\u00be\u0002\u0325\u0323\u0003\u0002\u0002\u0002", - "\u0325\u0324\u0003\u0002\u0002\u0002\u0326\u0330\u0003\u0002\u0002\u0002", - "\u0327\u0330\u0005\u017e\u00c0\u0002\u0328\u0330\u0005\u0188\u00c5\u0002", - "\u0329\u0330\u0005\u019e\u00d0\u0002\u032a\u0330\u0005\u01a8\u00d5\u0002", - "\u032b\u0330\u0005\u0198\u00cd\u0002\u032c\u0330\u0005\u01a2\u00d2\u0002", - "\u032d\u0330\u0005\u0240\u0121\u0002\u032e\u0330\u0005\u026a\u0136\u0002", - "\u032f\u0325\u0003\u0002\u0002\u0002\u032f\u0327\u0003\u0002\u0002\u0002", - "\u032f\u0328\u0003\u0002\u0002\u0002\u032f\u0329\u0003\u0002\u0002\u0002", - "\u032f\u032a\u0003\u0002\u0002\u0002\u032f\u032b\u0003\u0002\u0002\u0002", - "\u032f\u032c\u0003\u0002\u0002\u0002\u032f\u032d\u0003\u0002\u0002\u0002", - "\u032f\u032e\u0003\u0002\u0002\u0002\u0330\u0017\u0003\u0002\u0002\u0002", - "\u0331\u0332\u0005\u0178\u00bd\u0002\u0332\u0333\u0005\u01b6\u00dc\u0002", - "\u0333\u035e\u0003\u0002\u0002\u0002\u0334\u0335\u0005\u0178\u00bd\u0002", - "\u0335\u0336\u0005\u01b6\u00dc\u0002\u0336\u0337\u0005\u01bc\u00df\u0002", - "\u0337\u0338\u0005\u0230\u0119\u0002\u0338\u0339\u0005\u014c\u00a7\u0002", - "\u0339\u035e\u0003\u0002\u0002\u0002\u033a\u033e\u0005\u01b4\u00db\u0002", - "\u033b\u033c\u0005\u014c\u00a7\u0002\u033c\u033d\u0007\u0010\u0002\u0002", - "\u033d\u033f\u0003\u0002\u0002\u0002\u033e\u033b\u0003\u0002\u0002\u0002", - "\u033e\u033f\u0003\u0002\u0002\u0002\u033f\u0340\u0003\u0002\u0002\u0002", - "\u0340\u0341\u0005\u0166\u00b4\u0002\u0341\u035e\u0003\u0002\u0002\u0002", - "\u0342\u0343\u0005\u0178\u00bd\u0002\u0343\u0344\u0005\u0232\u011a\u0002", - "\u0344\u035e\u0003\u0002\u0002\u0002\u0345\u0346\u0005\u0230\u0119\u0002", - "\u0346\u0347\u0005\u014c\u00a7\u0002\u0347\u035e\u0003\u0002\u0002\u0002", - "\u0348\u034a\u0005\u0276\u013c\u0002\u0349\u0348\u0003\u0002\u0002\u0002", - "\u0349\u034a\u0003\u0002\u0002\u0002\u034a\u034e\u0003\u0002\u0002\u0002", - "\u034b\u034c\u0005\u014c\u00a7\u0002\u034c\u034d\u0007\u0010\u0002\u0002", - "\u034d\u034f\u0003\u0002\u0002\u0002\u034e\u034b\u0003\u0002\u0002\u0002", - "\u034e\u034f\u0003\u0002\u0002\u0002\u034f\u0350\u0003\u0002\u0002\u0002", - "\u0350\u035e\u0005\u014e\u00a8\u0002\u0351\u0352\u0005\u0178\u00bd\u0002", - "\u0352\u0353\u0005\u0268\u0135\u0002\u0353\u035e\u0003\u0002\u0002\u0002", - "\u0354\u0355\u0005\u0260\u0131\u0002\u0355\u0356\u0005\u015a\u00ae\u0002", - "\u0356\u035e\u0003\u0002\u0002\u0002\u0357\u035a\u0005\u0262\u0132\u0002", - "\u0358\u035a\u0005\u0264\u0133\u0002\u0359\u0357\u0003\u0002\u0002\u0002", - "\u0359\u0358\u0003\u0002\u0002\u0002\u035a\u035b\u0003\u0002\u0002\u0002", - "\u035b\u035c\u0005\u0266\u0134\u0002\u035c\u035e\u0003\u0002\u0002\u0002", - "\u035d\u0331\u0003\u0002\u0002\u0002\u035d\u0334\u0003\u0002\u0002\u0002", - "\u035d\u033a\u0003\u0002\u0002\u0002\u035d\u0342\u0003\u0002\u0002\u0002", - "\u035d\u0345\u0003\u0002\u0002\u0002\u035d\u0349\u0003\u0002\u0002\u0002", - "\u035d\u0351\u0003\u0002\u0002\u0002\u035d\u0354\u0003\u0002\u0002\u0002", - "\u035d\u0359\u0003\u0002\u0002\u0002\u035e\u0019\u0003\u0002\u0002\u0002", - "\u035f\u0360\u0005\u0198\u00cd\u0002\u0360\u0362\u0005\u028a\u0146\u0002", - "\u0361\u0363\u0005\u0110\u0089\u0002\u0362\u0361\u0003\u0002\u0002\u0002", - "\u0362\u0363\u0003\u0002\u0002\u0002\u0363\u0364\u0003\u0002\u0002\u0002", - "\u0364\u0365\u0005\u016a\u00b6\u0002\u0365\u0366\u0005\u0296\u014c\u0002", - "\u0366\u0367\u0005\u0254\u012b\u0002\u0367\u036a\u0005\u0146\u00a4\u0002", - "\u0368\u036b\u0005\u0274\u013b\u0002\u0369\u036b\u0005\u0242\u0122\u0002", - "\u036a\u0368\u0003\u0002\u0002\u0002\u036a\u0369\u0003\u0002\u0002\u0002", - "\u036a\u036b\u0003\u0002\u0002\u0002\u036b\u001b\u0003\u0002\u0002\u0002", - "\u036c\u036d\u0005\u0198\u00cd\u0002\u036d\u036f\u0005\u0260\u0131\u0002", - "\u036e\u0370\u0005\u0110\u0089\u0002\u036f\u036e\u0003\u0002\u0002\u0002", - "\u036f\u0370\u0003\u0002\u0002\u0002\u0370\u0371\u0003\u0002\u0002\u0002", - "\u0371\u0373\u0005\u015a\u00ae\u0002\u0372\u0374\u0005n8\u0002\u0373", - "\u0372\u0003\u0002\u0002\u0002\u0373\u0374\u0003\u0002\u0002\u0002\u0374", - "\u001d\u0003\u0002\u0002\u0002\u0375\u0376\u0005\u0198\u00cd\u0002\u0376", - "\u0378\u0005\u0282\u0142\u0002\u0377\u0379\u0005\u0110\u0089\u0002\u0378", - "\u0377\u0003\u0002\u0002\u0002\u0378\u0379\u0003\u0002\u0002\u0002\u0379", - "\u037d\u0003\u0002\u0002\u0002\u037a\u037b\u0005\u014c\u00a7\u0002\u037b", - "\u037c\u0007\u0010\u0002\u0002\u037c\u037e\u0003\u0002\u0002\u0002\u037d", - "\u037a\u0003\u0002\u0002\u0002\u037d\u037e\u0003\u0002\u0002\u0002\u037e", - "\u037f\u0003\u0002\u0002\u0002\u037f\u0380\u0005\u0162\u00b2\u0002\u0380", - "\u0381\u0005\u029c\u014f\u0002\u0381\u0382\u0005 \u0011\u0002\u0382", - "\u0383\u0005\u029e\u0150\u0002\u0383\u001f\u0003\u0002\u0002\u0002\u0384", - "\u0385\u0005\u0150\u00a9\u0002\u0385\u038c\u0005\u0152\u00aa\u0002\u0386", - "\u0387\u0005\u02ac\u0157\u0002\u0387\u0388\u0005\u0150\u00a9\u0002\u0388", - "\u0389\u0005\u0152\u00aa\u0002\u0389\u038b\u0003\u0002\u0002\u0002\u038a", - "\u0386\u0003\u0002\u0002\u0002\u038b\u038e\u0003\u0002\u0002\u0002\u038c", - "\u038a\u0003\u0002\u0002\u0002\u038c\u038d\u0003\u0002\u0002\u0002\u038d", - "!\u0003\u0002\u0002\u0002\u038e\u038c\u0003\u0002\u0002\u0002\u038f", - "\u0390\u0005\u0198\u00cd\u0002\u0390\u0392\u0005\u027c\u013f\u0002\u0391", - "\u0393\u0005\u0110\u0089\u0002\u0392\u0391\u0003\u0002\u0002\u0002\u0392", - "\u0393\u0003\u0002\u0002\u0002\u0393\u0397\u0003\u0002\u0002\u0002\u0394", - "\u0395\u0005\u014c\u00a7\u0002\u0395\u0396\u0007\u0010\u0002\u0002\u0396", - "\u0398\u0003\u0002\u0002\u0002\u0397\u0394\u0003\u0002\u0002\u0002\u0397", - "\u0398\u0003\u0002\u0002\u0002\u0398\u0399\u0003\u0002\u0002\u0002\u0399", - "\u039a\u0005\u015c\u00af\u0002\u039a\u039b\u0005\u028e\u0148\u0002\u039b", - "\u039c\u0005\u015e\u00b0\u0002\u039c#\u0003\u0002\u0002\u0002\u039d", - "\u039e\u0005\u0198\u00cd\u0002\u039e\u039f\u0005\u023e\u0120\u0002\u039f", - "\u03a1\u0005\u0292\u014a\u0002\u03a0\u03a2\u0005\u0110\u0089\u0002\u03a1", - "\u03a0\u0003\u0002\u0002\u0002\u03a1\u03a2\u0003\u0002\u0002\u0002\u03a2", - "\u03a6\u0003\u0002\u0002\u0002\u03a3\u03a4\u0005\u014c\u00a7\u0002\u03a4", - "\u03a5\u0007\u0010\u0002\u0002\u03a5\u03a7\u0003\u0002\u0002\u0002\u03a6", - "\u03a3\u0003\u0002\u0002\u0002\u03a6\u03a7\u0003\u0002\u0002\u0002\u03a7", - "\u03a8\u0003\u0002\u0002\u0002\u03a8\u03a9\u0005\u0160\u00b1\u0002\u03a9", - "\u03aa\u0005\u0184\u00c3\u0002\u03aa\u03ab\u0005\u026a\u0136\u0002\u03ab", - "\u03ac\u0005\u0118\u008d\u0002\u03ac\u03b0\u0005\u01b0\u00d9\u0002\u03ad", - "\u03ae\u0005\u014c\u00a7\u0002\u03ae\u03af\u0007\u0010\u0002\u0002\u03af", - "\u03b1\u0003\u0002\u0002\u0002\u03b0\u03ad\u0003\u0002\u0002\u0002\u03b0", - "\u03b1\u0003\u0002\u0002\u0002\u03b1\u03b2\u0003\u0002\u0002\u0002\u03b2", - "\u03b3\u0005\u014e\u00a8\u0002\u03b3\u03b5\u0005&\u0014\u0002\u03b4", - "\u03b6\u0005\u00a6T\u0002\u03b5\u03b4\u0003\u0002\u0002\u0002\u03b5", - "\u03b6\u0003\u0002\u0002\u0002\u03b6\u03ba\u0003\u0002\u0002\u0002\u03b7", - "\u03b8\u0005\u0296\u014c\u0002\u03b8\u03b9\u0005,\u0017\u0002\u03b9", - "\u03bb\u0003\u0002\u0002\u0002\u03ba\u03b7\u0003\u0002\u0002\u0002\u03ba", - "\u03bb\u0003\u0002\u0002\u0002\u03bb%\u0003\u0002\u0002\u0002\u03bc", - "\u03bd\u0005\u0294\u014b\u0002\u03bd\u03c1\u0005(\u0015\u0002\u03be", - "\u03bf\u0005\u0180\u00c1\u0002\u03bf\u03c0\u0005\u0134\u009b\u0002\u03c0", - "\u03c2\u0003\u0002\u0002\u0002\u03c1\u03be\u0003\u0002\u0002\u0002\u03c1", - "\u03c2\u0003\u0002\u0002\u0002\u03c2'\u0003\u0002\u0002\u0002\u03c3", - "\u03c9\u0005*\u0016\u0002\u03c4\u03c5\u0005\u0180\u00c1\u0002\u03c5", - "\u03c6\u0005*\u0016\u0002\u03c6\u03c8\u0003\u0002\u0002\u0002\u03c7", - "\u03c4\u0003\u0002\u0002\u0002\u03c8\u03cb\u0003\u0002\u0002\u0002\u03c9", - "\u03c7\u0003\u0002\u0002\u0002\u03c9\u03ca\u0003\u0002\u0002\u0002\u03ca", - ")\u0003\u0002\u0002\u0002\u03cb\u03c9\u0003\u0002\u0002\u0002\u03cc", - "\u03cd\u0005\u0150\u00a9\u0002\u03cd\u03ce\u0005\u0228\u0115\u0002\u03ce", - "\u03cf\u0005\u0246\u0124\u0002\u03cf\u03d0\u0005\u0248\u0125\u0002\u03d0", - "+\u0003\u0002\u0002\u0002\u03d1\u03d2\u0005\u0090I\u0002\u03d2-\u0003", - "\u0002\u0002\u0002\u03d3\u03d4\u0005\u0198\u00cd\u0002\u03d4\u03d6\u0005", - "\u0230\u0119\u0002\u03d5\u03d7\u0005\u0110\u0089\u0002\u03d6\u03d5\u0003", - "\u0002\u0002\u0002\u03d6\u03d7\u0003\u0002\u0002\u0002\u03d7\u03d8\u0003", - "\u0002\u0002\u0002\u03d8\u03d9\u0005\u014c\u00a7\u0002\u03d9\u03da\u0005", - "\u0296\u014c\u0002\u03da\u03db\u0005\u025c\u012f\u0002\u03db\u03dc\u0007", - "\u00de\u0002\u0002\u03dc\u03dd\u0005\u02a0\u0151\u0002\u03dd\u03de\u0005", - "\u00c0a\u0002\u03de\u03e2\u0005\u02a2\u0152\u0002\u03df\u03e0\u0005", - "\u0180\u00c1\u0002\u03e0\u03e1\u0005\u00c4c\u0002\u03e1\u03e3\u0003", - "\u0002\u0002\u0002\u03e2\u03df\u0003\u0002\u0002\u0002\u03e2\u03e3\u0003", - "\u0002\u0002\u0002\u03e3/\u0003\u0002\u0002\u0002\u03e4\u03e6\u0005", - "\u0198\u00cd\u0002\u03e5\u03e7\u0005D#\u0002\u03e6\u03e5\u0003\u0002", - "\u0002\u0002\u03e6\u03e7\u0003\u0002\u0002\u0002\u03e7\u03e8\u0003\u0002", - "\u0002\u0002\u03e8\u03ea\u0005\u01b4\u00db\u0002\u03e9\u03eb\u0005\u0110", - "\u0089\u0002\u03ea\u03e9\u0003\u0002\u0002\u0002\u03ea\u03eb\u0003\u0002", - "\u0002\u0002\u03eb\u03ef\u0003\u0002\u0002\u0002\u03ec\u03ed\u0005\u014c", - "\u00a7\u0002\u03ed\u03ee\u0007\u0010\u0002\u0002\u03ee\u03f0\u0003\u0002", - "\u0002\u0002\u03ef\u03ec\u0003\u0002\u0002\u0002\u03ef\u03f0\u0003\u0002", - "\u0002\u0002\u03f0\u03f1\u0003\u0002\u0002\u0002\u03f1\u03f2\u0005\u0166", - "\u00b4\u0002\u03f2\u03f4\u0005\u029c\u014f\u0002\u03f3\u03f5\u00054", - "\u001b\u0002\u03f4\u03f3\u0003\u0002\u0002\u0002\u03f4\u03f5\u0003\u0002", - "\u0002\u0002\u03f5\u03f6\u0003\u0002\u0002\u0002\u03f6\u03f7\u0005\u029e", - "\u0150\u0002\u03f7\u03f8\u00056\u001c\u0002\u03f8\u03f9\u0005\u025e", - "\u0130\u0002\u03f9\u03fa\u0005\u0152\u00aa\u0002\u03fa\u03fb\u0005\u0234", - "\u011b\u0002\u03fb\u03fc\u0005\u0168\u00b5\u0002\u03fc\u03fd\u0005\u0184", - "\u00c3\u0002\u03fd\u03fe\u00052\u001a\u0002\u03fe1\u0003\u0002\u0002", - "\u0002\u03ff\u0400\t\u0002\u0002\u0002\u04003\u0003\u0002\u0002\u0002", - "\u0401\u0407\u0005\u0170\u00b9\u0002\u0402\u0403\u0005\u02ac\u0157\u0002", - "\u0403\u0404\u0005\u0170\u00b9\u0002\u0404\u0406\u0003\u0002\u0002\u0002", - "\u0405\u0402\u0003\u0002\u0002\u0002\u0406\u0409\u0003\u0002\u0002\u0002", - "\u0407\u0405\u0003\u0002\u0002\u0002\u0407\u0408\u0003\u0002\u0002\u0002", - "\u04085\u0003\u0002\u0002\u0002\u0409\u0407\u0003\u0002\u0002\u0002", - "\u040a\u040f\u0005\u0190\u00c9\u0002\u040b\u040c\u0005\u025e\u0130\u0002", - "\u040c\u040d\u0005\u0248\u0125\u0002\u040d\u040f\u0003\u0002\u0002\u0002", - "\u040e\u040a\u0003\u0002\u0002\u0002\u040e\u040b\u0003\u0002\u0002\u0002", - "\u040f\u0410\u0003\u0002\u0002\u0002\u0410\u0411\u0005\u024c\u0127\u0002", - "\u0411\u0412\u0005\u0248\u0125\u0002\u0412\u0413\u0005\u0222\u0112\u0002", - "\u04137\u0003\u0002\u0002\u0002\u0414\u0416\u0005\u0198\u00cd\u0002", - "\u0415\u0417\u0005D#\u0002\u0416\u0415\u0003\u0002\u0002\u0002\u0416", - "\u0417\u0003\u0002\u0002\u0002\u0417\u0418\u0003\u0002\u0002\u0002\u0418", - "\u041a\u0005\u0176\u00bc\u0002\u0419\u041b\u0005\u0110\u0089\u0002\u041a", - "\u0419\u0003\u0002\u0002\u0002\u041a\u041b\u0003\u0002\u0002\u0002\u041b", - "\u041f\u0003\u0002\u0002\u0002\u041c\u041d\u0005\u014c\u00a7\u0002\u041d", - "\u041e\u0007\u0010\u0002\u0002\u041e\u0420\u0003\u0002\u0002\u0002\u041f", - "\u041c\u0003\u0002\u0002\u0002\u041f\u0420\u0003\u0002\u0002\u0002\u0420", - "\u0421\u0003\u0002\u0002\u0002\u0421\u0422\u0005\u0164\u00b3\u0002\u0422", - "\u0423\u0005\u029c\u014f\u0002\u0423\u0424\u0005\u0152\u00aa\u0002\u0424", - "\u0425\u0005\u029e\u0150\u0002\u0425\u0426\u0005\u026e\u0138\u0002\u0426", - "\u0427\u0005\u0166\u00b4\u0002\u0427\u0428\u0005\u0272\u013a\u0002\u0428", - "\u0429\u0005\u0152\u00aa\u0002\u0429\u042a\u0005\u01ae\u00d8\u0002\u042a", - "\u042b\u0005\u0166\u00b4\u0002\u042b\u042c\u0005\u0220\u0111\u0002\u042c", - "\u042d\u0005:\u001e\u0002\u042d9\u0003\u0002\u0002\u0002\u042e\u0433", - '\u0005\u0140\u00a1\u0002\u042f\u0433\u0005B"\u0002\u0430\u0433\u0005', - "@!\u0002\u0431\u0433\u0005<\u001f\u0002\u0432\u042e\u0003\u0002\u0002", - "\u0002\u0432\u042f\u0003\u0002\u0002\u0002\u0432\u0430\u0003\u0002\u0002", - "\u0002\u0432\u0431\u0003\u0002\u0002\u0002\u0433;\u0003\u0002\u0002", - "\u0002\u0434\u0435\u0005\u02a0\u0151\u0002\u0435\u043b\u0005> \u0002", - "\u0436\u0437\u0005\u02ac\u0157\u0002\u0437\u0438\u0005> \u0002\u0438", - "\u043a\u0003\u0002\u0002\u0002\u0439\u0436\u0003\u0002\u0002\u0002\u043a", - "\u043d\u0003\u0002\u0002\u0002\u043b\u0439\u0003\u0002\u0002\u0002\u043b", - "\u043c\u0003\u0002\u0002\u0002\u043c\u043e\u0003\u0002\u0002\u0002\u043d", - "\u043b\u0003\u0002\u0002\u0002\u043e\u043f\u0005\u02a2\u0152\u0002\u043f", - "=\u0003\u0002\u0002\u0002\u0440\u0441\u0005\u016e\u00b8\u0002\u0441", - "\u0442\u0007\u000b\u0002\u0002\u0442\u0443\u0005:\u001e\u0002\u0443", - "?\u0003\u0002\u0002\u0002\u0444\u0445\u0005\u029c\u014f\u0002\u0445", - '\u044c\u0005B"\u0002\u0446\u0447\u0005\u02ac\u0157\u0002\u0447\u0448', - "\u0005\u0140\u00a1\u0002\u0448\u044b\u0003\u0002\u0002\u0002\u0449\u044b", - '\u0005B"\u0002\u044a\u0446\u0003\u0002\u0002\u0002\u044a\u0449\u0003', - "\u0002\u0002\u0002\u044b\u044e\u0003\u0002\u0002\u0002\u044c\u044a\u0003", - "\u0002\u0002\u0002\u044c\u044d\u0003\u0002\u0002\u0002\u044d\u044f\u0003", - "\u0002\u0002\u0002\u044e\u044c\u0003\u0002\u0002\u0002\u044f\u0450\u0005", - "\u029e\u0150\u0002\u0450A\u0003\u0002\u0002\u0002\u0451\u0452\u0005", - "\u029c\u014f\u0002\u0452\u0458\u0005\u0140\u00a1\u0002\u0453\u0454\u0005", - "\u02ac\u0157\u0002\u0454\u0455\u0005\u0140\u00a1\u0002\u0455\u0457\u0003", - "\u0002\u0002\u0002\u0456\u0453\u0003\u0002\u0002\u0002\u0457\u045a\u0003", - "\u0002\u0002\u0002\u0458\u0456\u0003\u0002\u0002\u0002\u0458\u0459\u0003", - "\u0002\u0002\u0002\u0459\u045b\u0003\u0002\u0002\u0002\u045a\u0458\u0003", - "\u0002\u0002\u0002\u045b\u045c\u0005\u029e\u0150\u0002\u045cC\u0003", - "\u0002\u0002\u0002\u045d\u045e\u0005\u0250\u0129\u0002\u045e\u045f\u0005", - "\u025a\u012e\u0002\u045fE\u0003\u0002\u0002\u0002\u0460\u0461\u0005", - "\u017e\u00c0\u0002\u0461\u0462\u0005\u028a\u0146\u0002\u0462\u0463\u0005", - "\u016a\u00b6\u0002\u0463\u0464\u0005\u0296\u014c\u0002\u0464\u0466\u0005", - "H%\u0002\u0465\u0467\u0005J&\u0002\u0466\u0465\u0003\u0002\u0002\u0002", - "\u0466\u0467\u0003\u0002\u0002\u0002\u0467G\u0003\u0002\u0002\u0002", - "\u0468\u0469\u0005\u0254\u012b\u0002\u0469\u046a\u0005\u0146\u00a4\u0002", - "\u046aI\u0003\u0002\u0002\u0002\u046b\u046e\u0005\u0274\u013b\u0002", - "\u046c\u046e\u0005\u0242\u0122\u0002\u046d\u046b\u0003\u0002\u0002\u0002", - "\u046d\u046c\u0003\u0002\u0002\u0002\u046eK\u0003\u0002\u0002\u0002", - "\u046f\u0470\u0005\u017e\u00c0\u0002\u0470\u0474\u0005\u0282\u0142\u0002", - "\u0471\u0472\u0005\u014c\u00a7\u0002\u0472\u0473\u0007\u0010\u0002\u0002", - "\u0473\u0475\u0003\u0002\u0002\u0002\u0474\u0471\u0003\u0002\u0002\u0002", - "\u0474\u0475\u0003\u0002\u0002\u0002\u0475\u0476\u0003\u0002\u0002\u0002", - "\u0476\u0477\u0005\u0162\u00b2\u0002\u0477\u0478\u0005N(\u0002\u0478", - "M\u0003\u0002\u0002\u0002\u0479\u047d\u0005X-\u0002\u047a\u047d\u0005", - "V,\u0002\u047b\u047d\u0005P)\u0002\u047c\u0479\u0003\u0002\u0002\u0002", - "\u047c\u047a\u0003\u0002\u0002\u0002\u047c\u047b\u0003\u0002\u0002\u0002", - "\u047dO\u0003\u0002\u0002\u0002\u047e\u047f\u0005\u0258\u012d\u0002", - "\u047f\u0480\u0005R*\u0002\u0480Q\u0003\u0002\u0002\u0002\u0481\u0487", - "\u0005T+\u0002\u0482\u0483\u0005\u0180\u00c1\u0002\u0483\u0484\u0005", - "T+\u0002\u0484\u0486\u0003\u0002\u0002\u0002\u0485\u0482\u0003\u0002", - "\u0002\u0002\u0486\u0489\u0003\u0002\u0002\u0002\u0487\u0485\u0003\u0002", - "\u0002\u0002\u0487\u0488\u0003\u0002\u0002\u0002\u0488S\u0003\u0002", - "\u0002\u0002\u0489\u0487\u0003\u0002\u0002\u0002\u048a\u048b\u0005\u0150", - "\u00a9\u0002\u048b\u048c\u0005\u027a\u013e\u0002\u048c\u048d\u0005\u0150", - "\u00a9\u0002\u048dU\u0003\u0002\u0002\u0002\u048e\u048f\u0005\u0174", - "\u00bb\u0002\u048f\u0490\u0005 \u0011\u0002\u0490W\u0003\u0002\u0002", - "\u0002\u0491\u0492\u0005\u017e\u00c0\u0002\u0492\u0493\u0005\u0150\u00a9", - "\u0002\u0493\u0494\u0005\u0282\u0142\u0002\u0494\u0495\u0005\u0152\u00aa", - "\u0002\u0495Y\u0003\u0002\u0002\u0002\u0496\u0497\u0005\u017e\u00c0", - "\u0002\u0497\u049b\u0005\u0276\u013c\u0002\u0498\u0499\u0005\u014c\u00a7", - "\u0002\u0499\u049a\u0007\u0010\u0002\u0002\u049a\u049c\u0003\u0002\u0002", - "\u0002\u049b\u0498\u0003\u0002\u0002\u0002\u049b\u049c\u0003\u0002\u0002", - "\u0002\u049c\u049d\u0003\u0002\u0002\u0002\u049d\u049e\u0005\u014e\u00a8", - "\u0002\u049e\u049f\u0005\\/\u0002\u049f[\u0003\u0002\u0002\u0002\u04a0", - "\u04a7\u0005h5\u0002\u04a1\u04a7\u0005d3\u0002\u04a2\u04a7\u0005d3\u0002", - "\u04a3\u04a7\u0005b2\u0002\u04a4\u04a7\u0005`1\u0002\u04a5\u04a7\u0005", - "^0\u0002\u04a6\u04a0\u0003\u0002\u0002\u0002\u04a6\u04a1\u0003\u0002", - "\u0002\u0002\u04a6\u04a2\u0003\u0002\u0002\u0002\u04a6\u04a3\u0003\u0002", - "\u0002\u0002\u04a6\u04a4\u0003\u0002\u0002\u0002\u04a6\u04a5\u0003\u0002", - "\u0002\u0002\u04a7]\u0003\u0002\u0002\u0002\u04a8\u04a9\u0005\u0296", - "\u014c\u0002\u04a9\u04aa\u0005\u0090I\u0002\u04aa_\u0003\u0002\u0002", - "\u0002\u04ab\u04ac\u0005\u0258\u012d\u0002\u04ac\u04ad\u0005\u0150\u00a9", - "\u0002\u04ad\u04ae\u0005\u027a\u013e\u0002\u04ae\u04af\u0005\u0150\u00a9", - "\u0002\u04afa\u0003\u0002\u0002\u0002\u04b0\u04b1\u0005\u01a2\u00d2", - "\u0002\u04b1\u04b2\u0005\u0194\u00cb\u0002\u04b2\u04b3\u0005\u0270\u0139", - "\u0002\u04b3c\u0003\u0002\u0002\u0002\u04b4\u04b5\u0005\u01a2\u00d2", - "\u0002\u04b5\u04b6\u0005f4\u0002\u04b6e\u0003\u0002\u0002\u0002\u04b7", - "\u04bd\u0005\u0150\u00a9\u0002\u04b8\u04b9\u0005\u02ac\u0157\u0002\u04b9", - "\u04ba\u0005\u0150\u00a9\u0002\u04ba\u04bc\u0003\u0002\u0002\u0002\u04bb", - "\u04b8\u0003\u0002\u0002\u0002\u04bc\u04bf\u0003\u0002\u0002\u0002\u04bd", - "\u04bb\u0003\u0002\u0002\u0002\u04bd\u04be\u0003\u0002\u0002\u0002\u04be", - "g\u0003\u0002\u0002\u0002\u04bf\u04bd\u0003\u0002\u0002\u0002\u04c0", - "\u04c1\u0005\u0174\u00bb\u0002\u04c1\u04c2\u0005j6\u0002\u04c2i\u0003", - "\u0002\u0002\u0002\u04c3\u04c4\u0005\u0150\u00a9\u0002\u04c4\u04cb\u0005", - "\u0152\u00aa\u0002\u04c5\u04c6\u0005\u02ac\u0157\u0002\u04c6\u04c7\u0005", - "\u0150\u00a9\u0002\u04c7\u04c8\u0005\u0152\u00aa\u0002\u04c8\u04ca\u0003", - "\u0002\u0002\u0002\u04c9\u04c5\u0003\u0002\u0002\u0002\u04ca\u04cd\u0003", - "\u0002\u0002\u0002\u04cb\u04c9\u0003\u0002\u0002\u0002\u04cb\u04cc\u0003", - "\u0002\u0002\u0002\u04cck\u0003\u0002\u0002\u0002\u04cd\u04cb\u0003", - "\u0002\u0002\u0002\u04ce\u04cf\u0005\u017e\u00c0\u0002\u04cf\u04d0\u0005", - "\u0260\u0131\u0002\u04d0\u04d2\u0005\u015a\u00ae\u0002\u04d1\u04d3\u0005", - "n8\u0002\u04d2\u04d1\u0003\u0002\u0002\u0002\u04d2\u04d3\u0003\u0002", - "\u0002\u0002\u04d3m\u0003\u0002\u0002\u0002\u04d4\u04d5\u0005\u0296", - "\u014c\u0002\u04d5\u04db\u0005p9\u0002\u04d6\u04d7\u0005\u0180\u00c1", - "\u0002\u04d7\u04d8\u0005p9\u0002\u04d8\u04da\u0003\u0002\u0002\u0002", - "\u04d9\u04d6\u0003\u0002\u0002\u0002\u04da\u04dd\u0003\u0002\u0002\u0002", - "\u04db\u04d9\u0003\u0002\u0002\u0002\u04db\u04dc\u0003\u0002\u0002\u0002", - "\u04dco\u0003\u0002\u0002\u0002\u04dd\u04db\u0003\u0002\u0002\u0002", - "\u04de\u04df\u0005\u0254\u012b\u0002\u04df\u04e0\u0007\u00de\u0002\u0002", - "\u04e0\u04e1\u0005\u0146\u00a4\u0002\u04e1\u04ef\u0003\u0002\u0002\u0002", - "\u04e2\u04e3\u0005\u023c\u011f\u0002\u04e3\u04e4\u0007\u00de\u0002\u0002", - "\u04e4\u04e5\u0005\u0148\u00a5\u0002\u04e5\u04ef\u0003\u0002\u0002\u0002", - "\u04e6\u04e7\u0005\u0274\u013b\u0002\u04e7\u04e8\u0007\u00de\u0002\u0002", - "\u04e8\u04e9\u0005\u0148\u00a5\u0002\u04e9\u04ef\u0003\u0002\u0002\u0002", - "\u04ea\u04eb\u0005\u024e\u0128\u0002\u04eb\u04ec\u0007\u00de\u0002\u0002", - "\u04ec\u04ed\u0005\u0098M\u0002\u04ed\u04ef\u0003\u0002\u0002\u0002", - "\u04ee\u04de\u0003\u0002\u0002\u0002\u04ee\u04e2\u0003\u0002\u0002\u0002", - "\u04ee\u04e6\u0003\u0002\u0002\u0002\u04ee\u04ea\u0003\u0002\u0002\u0002", - "\u04efq\u0003\u0002\u0002\u0002\u04f0\u04f1\u0005\u017e\u00c0\u0002", - "\u04f1\u04f2\u0005\u023e\u0120\u0002\u04f2\u04f6\u0005\u0292\u014a\u0002", - "\u04f3\u04f4\u0005\u014c\u00a7\u0002\u04f4\u04f5\u0007\u0010\u0002\u0002", - "\u04f5\u04f7\u0003\u0002\u0002\u0002\u04f6\u04f3\u0003\u0002\u0002\u0002", - "\u04f6\u04f7\u0003\u0002\u0002\u0002\u04f7\u04f8\u0003\u0002\u0002\u0002", - "\u04f8\u04fc\u0005\u0160\u00b1\u0002\u04f9\u04fa\u0005\u0296\u014c\u0002", - "\u04fa\u04fb\u0005\u0090I\u0002\u04fb\u04fd\u0003\u0002\u0002\u0002", - "\u04fc\u04f9\u0003\u0002\u0002\u0002\u04fc\u04fd\u0003\u0002\u0002\u0002", - "\u04fds\u0003\u0002\u0002\u0002\u04fe\u04ff\u0005\u01a2\u00d2\u0002", - "\u04ff\u0501\u0005\u028a\u0146\u0002\u0500\u0502\u0005\u0112\u008a\u0002", - "\u0501\u0500\u0003\u0002\u0002\u0002\u0501\u0502\u0003\u0002\u0002\u0002", - "\u0502\u0503\u0003\u0002\u0002\u0002\u0503\u0504\u0005\u016a\u00b6\u0002", - "\u0504u\u0003\u0002\u0002\u0002\u0505\u0506\u0005\u01a2\u00d2\u0002", - "\u0506\u0508\u0005\u0282\u0142\u0002\u0507\u0509\u0005\u0112\u008a\u0002", - "\u0508\u0507\u0003\u0002\u0002\u0002\u0508\u0509\u0003\u0002\u0002\u0002", - "\u0509\u050d\u0003\u0002\u0002\u0002\u050a\u050b\u0005\u014c\u00a7\u0002", - "\u050b\u050c\u0007\u0010\u0002\u0002\u050c\u050e\u0003\u0002\u0002\u0002", - "\u050d\u050a\u0003\u0002\u0002\u0002\u050d\u050e\u0003\u0002\u0002\u0002", - "\u050e\u050f\u0003\u0002\u0002\u0002\u050f\u0510\u0005\u0162\u00b2\u0002", - "\u0510w\u0003\u0002\u0002\u0002\u0511\u0512\u0005\u01a2\u00d2\u0002", - "\u0512\u0513\u0005\u023e\u0120\u0002\u0513\u0515\u0005\u0292\u014a\u0002", - "\u0514\u0516\u0005\u0112\u008a\u0002\u0515\u0514\u0003\u0002\u0002\u0002", - "\u0515\u0516\u0003\u0002\u0002\u0002\u0516\u051a\u0003\u0002\u0002\u0002", - "\u0517\u0518\u0005\u014c\u00a7\u0002\u0518\u0519\u0007\u0010\u0002\u0002", - "\u0519\u051b\u0003\u0002\u0002\u0002\u051a\u0517\u0003\u0002\u0002\u0002", - "\u051a\u051b\u0003\u0002\u0002\u0002\u051b\u051c\u0003\u0002\u0002\u0002", - "\u051c\u051d\u0005\u0160\u00b1\u0002\u051dy\u0003\u0002\u0002\u0002", - "\u051e\u051f\u0005\u01a2\u00d2\u0002\u051f\u0521\u0005\u0176\u00bc\u0002", - "\u0520\u0522\u0005\u0112\u008a\u0002\u0521\u0520\u0003\u0002\u0002\u0002", - "\u0521\u0522\u0003\u0002\u0002\u0002\u0522\u0526\u0003\u0002\u0002\u0002", - "\u0523\u0524\u0005\u014c\u00a7\u0002\u0524\u0525\u0007\u0010\u0002\u0002", - "\u0525\u0527\u0003\u0002\u0002\u0002\u0526\u0523\u0003\u0002\u0002\u0002", - "\u0526\u0527\u0003\u0002\u0002\u0002\u0527\u0528\u0003\u0002\u0002\u0002", - "\u0528\u0529\u0005\u0164\u00b3\u0002\u0529{\u0003\u0002\u0002\u0002", - "\u052a\u052b\u0005\u01a2\u00d2\u0002\u052b\u052d\u0005\u01b4\u00db\u0002", - "\u052c\u052e\u0005\u0112\u008a\u0002\u052d\u052c\u0003\u0002\u0002\u0002", - "\u052d\u052e\u0003\u0002\u0002\u0002\u052e\u0532\u0003\u0002\u0002\u0002", - "\u052f\u0530\u0005\u014c\u00a7\u0002\u0530\u0531\u0007\u0010\u0002\u0002", - "\u0531\u0533\u0003\u0002\u0002\u0002\u0532\u052f\u0003\u0002\u0002\u0002", - "\u0532\u0533\u0003\u0002\u0002\u0002\u0533\u0534\u0003\u0002\u0002\u0002", - "\u0534\u0535\u0005\u0166\u00b4\u0002\u0535}\u0003\u0002\u0002\u0002", - "\u0536\u0537\u0005\u01a2\u00d2\u0002\u0537\u0539\u0005\u027c\u013f\u0002", - "\u0538\u053a\u0005\u0112\u008a\u0002\u0539\u0538\u0003\u0002\u0002\u0002", - "\u0539\u053a\u0003\u0002\u0002\u0002\u053a\u053b\u0003\u0002\u0002\u0002", - "\u053b\u053c\u0005\u015c\u00af\u0002\u053c\u0540\u0005\u024c\u0127\u0002", - "\u053d\u053e\u0005\u014c\u00a7\u0002\u053e\u053f\u0007\u0010\u0002\u0002", - "\u053f\u0541\u0003\u0002\u0002\u0002\u0540\u053d\u0003\u0002\u0002\u0002", - "\u0540\u0541\u0003\u0002\u0002\u0002\u0541\u0542\u0003\u0002\u0002\u0002", - "\u0542\u0543\u0005\u014e\u00a8\u0002\u0543\u007f\u0003\u0002\u0002\u0002", - "\u0544\u0545\u0005\u01a2\u00d2\u0002\u0545\u0547\u0005\u0260\u0131\u0002", - "\u0546\u0548\u0005\u0112\u008a\u0002\u0547\u0546\u0003\u0002\u0002\u0002", - "\u0547\u0548\u0003\u0002\u0002\u0002\u0548\u0549\u0003\u0002\u0002\u0002", - "\u0549\u054a\u0005\u015a\u00ae\u0002\u054a\u0081\u0003\u0002\u0002\u0002", - "\u054b\u054c\u0005\u01a2\u00d2\u0002\u054c\u054e\u0005\u0276\u013c\u0002", - "\u054d\u054f\u0005\u0112\u008a\u0002\u054e\u054d\u0003\u0002\u0002\u0002", - "\u054e\u054f\u0003\u0002\u0002\u0002\u054f\u0553\u0003\u0002\u0002\u0002", - "\u0550\u0551\u0005\u014c\u00a7\u0002\u0551\u0552\u0007\u0010\u0002\u0002", - "\u0552\u0554\u0003\u0002\u0002\u0002\u0553\u0550\u0003\u0002\u0002\u0002", - "\u0553\u0554\u0003\u0002\u0002\u0002\u0554\u0555\u0003\u0002\u0002\u0002", - "\u0555\u0556\u0005\u014e\u00a8\u0002\u0556\u0083\u0003\u0002\u0002\u0002", - "\u0557\u0558\u0005\u01a2\u00d2\u0002\u0558\u055a\u0005\u0230\u0119\u0002", - "\u0559\u055b\u0005\u0112\u008a\u0002\u055a\u0559\u0003\u0002\u0002\u0002", - "\u055a\u055b\u0003\u0002\u0002\u0002\u055b\u055c\u0003\u0002\u0002\u0002", - "\u055c\u055d\u0005\u014c\u00a7\u0002\u055d\u0085\u0003\u0002\u0002\u0002", - "\u055e\u055f\u0005\u01a2\u00d2\u0002\u055f\u0561\u0005\u01be\u00e0\u0002", - "\u0560\u0562\u0005\u0112\u008a\u0002\u0561\u0560\u0003\u0002\u0002\u0002", - "\u0561\u0562\u0003\u0002\u0002\u0002\u0562\u0566\u0003\u0002\u0002\u0002", - "\u0563\u0564\u0005\u014c\u00a7\u0002\u0564\u0565\u0007\u0010\u0002\u0002", - "\u0565\u0567\u0003\u0002\u0002\u0002\u0566\u0563\u0003\u0002\u0002\u0002", - "\u0566\u0567\u0003\u0002\u0002\u0002\u0567\u0568\u0003\u0002\u0002\u0002", - "\u0568\u0569\u0005\u00dep\u0002\u0569\u0087\u0003\u0002\u0002\u0002", - "\u056a\u056b\u0005\u0198\u00cd\u0002\u056b\u056d\u0005\u0276\u013c\u0002", - "\u056c\u056e\u0005\u0110\u0089\u0002\u056d\u056c\u0003\u0002\u0002\u0002", - "\u056d\u056e\u0003\u0002\u0002\u0002\u056e\u0572\u0003\u0002\u0002\u0002", - "\u056f\u0570\u0005\u014c\u00a7\u0002\u0570\u0571\u0007\u0010\u0002\u0002", - "\u0571\u0573\u0003\u0002\u0002\u0002\u0572\u056f\u0003\u0002\u0002\u0002", - "\u0572\u0573\u0003\u0002\u0002\u0002\u0573\u0574\u0003\u0002\u0002\u0002", - "\u0574\u0575\u0005\u014e\u00a8\u0002\u0575\u0576\u0005\u029c\u014f\u0002", - "\u0576\u0577\u0005\u00a0Q\u0002\u0577\u0579\u0005\u029e\u0150\u0002", - "\u0578\u057a\u0005\u008aF\u0002\u0579\u0578\u0003\u0002\u0002\u0002", - "\u0579\u057a\u0003\u0002\u0002\u0002\u057a\u0089\u0003\u0002\u0002\u0002", - "\u057b\u057d\u0005\u0296\u014c\u0002\u057c\u057e\u0005\u0090I\u0002", - "\u057d\u057c\u0003\u0002\u0002\u0002\u057d\u057e\u0003\u0002\u0002\u0002", - "\u057e\u008b\u0003\u0002\u0002\u0002\u057f\u0581\u0005\u0150\u00a9\u0002", - "\u0580\u0582\u0005\u0158\u00ad\u0002\u0581\u0580\u0003\u0002\u0002\u0002", - "\u0581\u0582\u0003\u0002\u0002\u0002\u0582\u058a\u0003\u0002\u0002\u0002", - "\u0583\u0584\u0005\u02ac\u0157\u0002\u0584\u0586\u0005\u0150\u00a9\u0002", - "\u0585\u0587\u0005\u0158\u00ad\u0002\u0586\u0585\u0003\u0002\u0002\u0002", - "\u0586\u0587\u0003\u0002\u0002\u0002\u0587\u0589\u0003\u0002\u0002\u0002", - "\u0588\u0583\u0003\u0002\u0002\u0002\u0589\u058c\u0003\u0002\u0002\u0002", - "\u058a\u0588\u0003\u0002\u0002\u0002\u058a\u058b\u0003\u0002\u0002\u0002", - "\u058b\u008d\u0003\u0002\u0002\u0002\u058c\u058a\u0003\u0002\u0002\u0002", - "\u058d\u058e\u0005\u0192\u00ca\u0002\u058e\u058f\u0005\u0252\u012a\u0002", - "\u058f\u0590\u0005\u018e\u00c8\u0002\u0590\u0591\u0005\u029c\u014f\u0002", - "\u0591\u0592\u0005\u008cG\u0002\u0592\u0593\u0005\u029e\u0150\u0002", - "\u0593\u008f\u0003\u0002\u0002\u0002\u0594\u059a\u0005\u0092J\u0002", - "\u0595\u0596\u0005\u0180\u00c1\u0002\u0596\u0597\u0005\u0092J\u0002", - "\u0597\u0599\u0003\u0002\u0002\u0002\u0598\u0595\u0003\u0002\u0002\u0002", - "\u0599\u059c\u0003\u0002\u0002\u0002\u059a\u0598\u0003\u0002\u0002\u0002", - "\u059a\u059b\u0003\u0002\u0002\u0002\u059b\u0091\u0003\u0002\u0002\u0002", - "\u059c\u059a\u0003\u0002\u0002\u0002\u059d\u059e\u0005\u0094K\u0002", - "\u059e\u059f\u0007\u00de\u0002\u0002\u059f\u05a0\u0005\u0096L\u0002", - "\u05a0\u05a7\u0003\u0002\u0002\u0002\u05a1\u05a2\u0005\u0094K\u0002", - "\u05a2\u05a3\u0007\u00de\u0002\u0002\u05a3\u05a4\u0005\u0098M\u0002", - "\u05a4\u05a7\u0003\u0002\u0002\u0002\u05a5\u05a7\u0005\u008eH\u0002", - "\u05a6\u059d\u0003\u0002\u0002\u0002\u05a6\u05a1\u0003\u0002\u0002\u0002", - "\u05a6\u05a5\u0003\u0002\u0002\u0002\u05a7\u0093\u0003\u0002\u0002\u0002", - "\u05a8\u05a9\u0005\u02b0\u0159\u0002\u05a9\u0095\u0003\u0002\u0002\u0002", - "\u05aa\u05ae\u0005\u0146\u00a4\u0002\u05ab\u05ae\u0005\u0144\u00a3\u0002", - "\u05ac\u05ae\u0005\u02b0\u0159\u0002\u05ad\u05aa\u0003\u0002\u0002\u0002", - "\u05ad\u05ab\u0003\u0002\u0002\u0002\u05ad\u05ac\u0003\u0002\u0002\u0002", - "\u05ae\u0097\u0003\u0002\u0002\u0002\u05af\u05b0\u0005\u02a0\u0151\u0002", - "\u05b0\u05b6\u0005\u009aN\u0002\u05b1\u05b2\u0005\u02ac\u0157\u0002", - "\u05b2\u05b3\u0005\u009aN\u0002\u05b3\u05b5\u0003\u0002\u0002\u0002", - "\u05b4\u05b1\u0003\u0002\u0002\u0002\u05b5\u05b8\u0003\u0002\u0002\u0002", - "\u05b6\u05b4\u0003\u0002\u0002\u0002\u05b6\u05b7\u0003\u0002\u0002\u0002", - "\u05b7\u05b9\u0003\u0002\u0002\u0002\u05b8\u05b6\u0003\u0002\u0002\u0002", - "\u05b9\u05ba\u0005\u02a2\u0152\u0002\u05ba\u0099\u0003\u0002\u0002\u0002", - "\u05bb\u05bc\u0005\u009cO\u0002\u05bc\u05bd\u0007\u000b\u0002\u0002", - "\u05bd\u05be\u0005\u009eP\u0002\u05be\u009b\u0003\u0002\u0002\u0002", - "\u05bf\u05c0\u0005\u0146\u00a4\u0002\u05c0\u009d\u0003\u0002\u0002\u0002", - "\u05c1\u05c5\u0005\u0146\u00a4\u0002\u05c2\u05c5\u0005\u0148\u00a5\u0002", - "\u05c3\u05c5\u0005\u0144\u00a3\u0002\u05c4\u05c1\u0003\u0002\u0002\u0002", - "\u05c4\u05c2\u0003\u0002\u0002\u0002\u05c4\u05c3\u0003\u0002\u0002\u0002", - "\u05c5\u009f\u0003\u0002\u0002\u0002\u05c6\u05cc\u0005\u00a2R\u0002", - "\u05c7\u05c8\u0005\u02ac\u0157\u0002\u05c8\u05c9\u0005\u00a2R\u0002", - "\u05c9\u05cb\u0003\u0002\u0002\u0002\u05ca\u05c7\u0003\u0002\u0002\u0002", - "\u05cb\u05ce\u0003\u0002\u0002\u0002\u05cc\u05ca\u0003\u0002\u0002\u0002", - "\u05cc\u05cd\u0003\u0002\u0002\u0002\u05cd\u05d2\u0003\u0002\u0002\u0002", - "\u05ce\u05cc\u0003\u0002\u0002\u0002\u05cf\u05d0\u0005\u02ac\u0157\u0002", - "\u05d0\u05d1\u0005\u00a6T\u0002\u05d1\u05d3\u0003\u0002\u0002\u0002", - "\u05d2\u05cf\u0003\u0002\u0002\u0002\u05d2\u05d3\u0003\u0002\u0002\u0002", - "\u05d3\u00a1\u0003\u0002\u0002\u0002\u05d4\u05d5\u0005\u0150\u00a9\u0002", - "\u05d5\u05d7\u0005\u0152\u00aa\u0002\u05d6\u05d8\u0005\u00a4S\u0002", - "\u05d7\u05d6\u0003\u0002\u0002\u0002\u05d7\u05d8\u0003\u0002\u0002\u0002", - "\u05d8\u00a3\u0003\u0002\u0002\u0002\u05d9\u05da\u0005\u0256\u012c\u0002", - "\u05da\u05db\u0005\u022c\u0117\u0002\u05db\u00a5\u0003\u0002\u0002\u0002", - "\u05dc\u05dd\u0005\u0256\u012c\u0002\u05dd\u05de\u0005\u022c\u0117\u0002", - "\u05de\u05df\u0005\u029c\u014f\u0002\u05df\u05e0\u0005\u00a8U\u0002", - "\u05e0\u05e1\u0005\u029e\u0150\u0002\u05e1\u00a7\u0003\u0002\u0002\u0002", - "\u05e2\u05e6\u0005\u00aaV\u0002\u05e3\u05e6\u0005\u00acW\u0002\u05e4", - "\u05e6\u0005\u00aeX\u0002\u05e5\u05e2\u0003\u0002\u0002\u0002\u05e5", - "\u05e3\u0003\u0002\u0002\u0002\u05e5\u05e4\u0003\u0002\u0002\u0002\u05e6", - "\u00a9\u0003\u0002\u0002\u0002\u05e7\u05e8\u0005\u0150\u00a9\u0002\u05e8", - "\u00ab\u0003\u0002\u0002\u0002\u05e9\u05ed\u0005\u00b4[\u0002\u05ea", - "\u05eb\u0005\u02ac\u0157\u0002\u05eb\u05ec\u0005\u00b2Z\u0002\u05ec", - "\u05ee\u0003\u0002\u0002\u0002\u05ed\u05ea\u0003\u0002\u0002\u0002\u05ed", - "\u05ee\u0003\u0002\u0002\u0002\u05ee\u00ad\u0003\u0002\u0002\u0002\u05ef", - "\u05f0\u0005\u029c\u014f\u0002\u05f0\u05f1\u0005\u00b0Y\u0002\u05f1", - "\u05f5\u0005\u029e\u0150\u0002\u05f2\u05f3\u0005\u02ac\u0157\u0002\u05f3", - "\u05f4\u0005\u00b2Z\u0002\u05f4\u05f6\u0003\u0002\u0002\u0002\u05f5", - "\u05f2\u0003\u0002\u0002\u0002\u05f5\u05f6\u0003\u0002\u0002\u0002\u05f6", - "\u00af\u0003\u0002\u0002\u0002\u05f7\u05fd\u0005\u00b4[\u0002\u05f8", - "\u05f9\u0005\u02ac\u0157\u0002\u05f9\u05fa\u0005\u00b4[\u0002\u05fa", - "\u05fc\u0003\u0002\u0002\u0002\u05fb\u05f8\u0003\u0002\u0002\u0002\u05fc", - "\u05ff\u0003\u0002\u0002\u0002\u05fd\u05fb\u0003\u0002\u0002\u0002\u05fd", - "\u05fe\u0003\u0002\u0002\u0002\u05fe\u00b1\u0003\u0002\u0002\u0002\u05ff", - "\u05fd\u0003\u0002\u0002\u0002\u0600\u0606\u0005\u00b6\\\u0002\u0601", - "\u0602\u0005\u02ac\u0157\u0002\u0602\u0603\u0005\u00b6\\\u0002\u0603", - "\u0605\u0003\u0002\u0002\u0002\u0604\u0601\u0003\u0002\u0002\u0002\u0605", - "\u0608\u0003\u0002\u0002\u0002\u0606\u0604\u0003\u0002\u0002\u0002\u0606", - "\u0607\u0003\u0002\u0002\u0002\u0607\u00b3\u0003\u0002\u0002\u0002\u0608", - "\u0606\u0003\u0002\u0002\u0002\u0609\u060a\u0005\u0150\u00a9\u0002\u060a", - "\u00b5\u0003\u0002\u0002\u0002\u060b\u060c\u0005\u0150\u00a9\u0002\u060c", - "\u00b7\u0003\u0002\u0002\u0002\u060d\u060e\u0005\u0182\u00c2\u0002\u060e", - "\u060f\u0005\u018a\u00c6\u0002\u060f\u00b9\u0003\u0002\u0002\u0002\u0610", - "\u0612\u0005\u018c\u00c7\u0002\u0611\u0613\u0005\u00bc_\u0002\u0612", - "\u0611\u0003\u0002\u0002\u0002\u0612\u0613\u0003\u0002\u0002\u0002\u0613", - "\u0614\u0003\u0002\u0002\u0002\u0614\u0616\u0005\u018a\u00c6\u0002\u0615", - "\u0617\u0005\u010e\u0088\u0002\u0616\u0615\u0003\u0002\u0002\u0002\u0616", - "\u0617\u0003\u0002\u0002\u0002\u0617\u00bb\u0003\u0002\u0002\u0002\u0618", - "\u061b\u0005\u023a\u011e\u0002\u0619\u061b\u0005\u0284\u0143\u0002\u061a", - "\u0618\u0003\u0002\u0002\u0002\u061a\u0619\u0003\u0002\u0002\u0002\u061b", - "\u00bd\u0003\u0002\u0002\u0002\u061c\u061d\u0005\u017e\u00c0\u0002\u061d", - "\u061e\u0005\u0230\u0119\u0002\u061e\u061f\u0005\u014c\u00a7\u0002\u061f", - "\u0620\u0005\u0296\u014c\u0002\u0620\u0621\u0005\u025c\u012f\u0002\u0621", - "\u0622\u0007\u00de\u0002\u0002\u0622\u0623\u0005\u02a0\u0151\u0002\u0623", - "\u0624\u0005\u00c0a\u0002\u0624\u0628\u0005\u02a2\u0152\u0002\u0625", - "\u0626\u0005\u0180\u00c1\u0002\u0626\u0627\u0005\u00c4c\u0002\u0627", - "\u0629\u0003\u0002\u0002\u0002\u0628\u0625\u0003\u0002\u0002\u0002\u0628", - "\u0629\u0003\u0002\u0002\u0002\u0629\u00bf\u0003\u0002\u0002\u0002\u062a", - "\u0630\u0005\u00c2b\u0002\u062b\u062c\u0005\u02ac\u0157\u0002\u062c", - "\u062d\u0005\u00c2b\u0002\u062d\u062f\u0003\u0002\u0002\u0002\u062e", - "\u062b\u0003\u0002\u0002\u0002\u062f\u0632\u0003\u0002\u0002\u0002\u0630", - "\u062e\u0003\u0002\u0002\u0002\u0630\u0631\u0003\u0002\u0002\u0002\u0631", - "\u00c1\u0003\u0002\u0002\u0002\u0632\u0630\u0003\u0002\u0002\u0002\u0633", - "\u0634\u0007\u00d7\u0002\u0002\u0634\u0635\u0007\u000b\u0002\u0002\u0635", - "\u063a\u0007\u00d7\u0002\u0002\u0636\u0637\u0007\u00d7\u0002\u0002\u0637", - "\u0638\u0007\u000b\u0002\u0002\u0638\u063a\u0007\u00d8\u0002\u0002\u0639", - "\u0633\u0003\u0002\u0002\u0002\u0639\u0636\u0003\u0002\u0002\u0002\u063a", - "\u00c3\u0003\u0002\u0002\u0002\u063b\u063c\u0005\u01a4\u00d3\u0002\u063c", - "\u063d\u0007\u00de\u0002\u0002\u063d\u063e\u0005\u0148\u00a5\u0002\u063e", - "\u00c5\u0003\u0002\u0002\u0002\u063f\u0640\u0005\u0288\u0145\u0002\u0640", - "\u0641\u0005\u014c\u00a7\u0002\u0641\u00c7\u0003\u0002\u0002\u0002\u0642", - "\u0644\u0005\u027e\u0140\u0002\u0643\u0645\u0005\u0276\u013c\u0002\u0644", - "\u0643\u0003\u0002\u0002\u0002\u0644\u0645\u0003\u0002\u0002\u0002\u0645", - "\u0649\u0003\u0002\u0002\u0002\u0646\u0647\u0005\u014c\u00a7\u0002\u0647", - "\u0648\u0007\u0010\u0002\u0002\u0648\u064a\u0003\u0002\u0002\u0002\u0649", - "\u0646\u0003\u0002\u0002\u0002\u0649\u064a\u0003\u0002\u0002\u0002\u064a", - "\u064b\u0003\u0002\u0002\u0002\u064b\u064c\u0005\u014e\u00a8\u0002\u064c", - "\u00c9\u0003\u0002\u0002\u0002\u064d\u064e\u0005\u0198\u00cd\u0002\u064e", - "\u0650\u0005\u01be\u00e0\u0002\u064f\u0651\u0005\u0110\u0089\u0002\u0650", - "\u064f\u0003\u0002\u0002\u0002\u0650\u0651\u0003\u0002\u0002\u0002\u0651", - "\u0653\u0003\u0002\u0002\u0002\u0652\u0654\u0005\u00dep\u0002\u0653", - "\u0652\u0003\u0002\u0002\u0002\u0653\u0654\u0003\u0002\u0002\u0002\u0654", - "\u0655\u0003\u0002\u0002\u0002\u0655\u0659\u0005\u024c\u0127\u0002\u0656", - "\u0657\u0005\u014c\u00a7\u0002\u0657\u0658\u0007\u0010\u0002\u0002\u0658", - "\u065a\u0003\u0002\u0002\u0002\u0659\u0656\u0003\u0002\u0002\u0002\u0659", - "\u065a\u0003\u0002\u0002\u0002\u065a\u065b\u0003\u0002\u0002\u0002\u065b", - "\u065c\u0005\u014e\u00a8\u0002\u065c\u065d\u0005\u029c\u014f\u0002\u065d", - "\u065e\u0005\u00e0q\u0002\u065e\u065f\u0005\u029e\u0150\u0002\u065f", - "\u0687\u0003\u0002\u0002\u0002\u0660\u0661\u0005\u0198\u00cd\u0002\u0661", - "\u0662\u0005\u01c0\u00e1\u0002\u0662\u0664\u0005\u01be\u00e0\u0002\u0663", - "\u0665\u0005\u0110\u0089\u0002\u0664\u0663\u0003\u0002\u0002\u0002\u0664", - "\u0665\u0003\u0002\u0002\u0002\u0665\u0667\u0003\u0002\u0002\u0002\u0666", - "\u0668\u0005\u00dep\u0002\u0667\u0666\u0003\u0002\u0002\u0002\u0667", - "\u0668\u0003\u0002\u0002\u0002\u0668\u0669\u0003\u0002\u0002\u0002\u0669", - "\u066d\u0005\u024c\u0127\u0002\u066a\u066b\u0005\u014c\u00a7\u0002\u066b", - "\u066c\u0007\u0010\u0002\u0002\u066c\u066e\u0003\u0002\u0002\u0002\u066d", - "\u066a\u0003\u0002\u0002\u0002\u066d\u066e\u0003\u0002\u0002\u0002\u066e", - "\u066f\u0003\u0002\u0002\u0002\u066f\u0670\u0005\u014e\u00a8\u0002\u0670", - "\u0671\u0005\u029c\u014f\u0002\u0671\u0672\u0005\u00e0q\u0002\u0672", - "\u0673\u0005\u029e\u0150\u0002\u0673\u0677\u0005\u028e\u0148\u0002\u0674", - "\u0678\u0005\u01e0\u00f1\u0002\u0675\u0678\u0005\u01e4\u00f3\u0002\u0676", - "\u0678\u0005\u01e2\u00f2\u0002\u0677\u0674\u0003\u0002\u0002\u0002\u0677", - "\u0675\u0003\u0002\u0002\u0002\u0677\u0676\u0003\u0002\u0002\u0002\u0678", - "\u0684\u0003\u0002\u0002\u0002\u0679\u067a\u0005\u0296\u014c\u0002\u067a", - "\u067b\u0005\u024e\u0128\u0002\u067b\u067c\u0007\u00de\u0002\u0002\u067c", - "\u067e\u0007\u0005\u0002\u0002\u067d\u067f\u0005\u00ccg\u0002\u067e", - "\u067d\u0003\u0002\u0002\u0002\u067f\u0680\u0003\u0002\u0002\u0002\u0680", - "\u067e\u0003\u0002\u0002\u0002\u0680\u0681\u0003\u0002\u0002\u0002\u0681", - "\u0682\u0003\u0002\u0002\u0002\u0682\u0683\u0007\u0006\u0002\u0002\u0683", - "\u0685\u0003\u0002\u0002\u0002\u0684\u0679\u0003\u0002\u0002\u0002\u0684", - "\u0685\u0003\u0002\u0002\u0002\u0685\u0687\u0003\u0002\u0002\u0002\u0686", - "\u064d\u0003\u0002\u0002\u0002\u0686\u0660\u0003\u0002\u0002\u0002\u0687", - "\u00cb\u0003\u0002\u0002\u0002\u0688\u0689\u0005\u021c\u010f\u0002\u0689", - "\u068a\u0007\u000b\u0002\u0002\u068a\u068c\u0005\u0148\u00a5\u0002\u068b", - "\u068d\u0007\t\u0002\u0002\u068c\u068b\u0003\u0002\u0002\u0002\u068c", - "\u068d\u0003\u0002\u0002\u0002\u068d\u06e9\u0003\u0002\u0002\u0002\u068e", - "\u068f\u0005\u01c6\u00e4\u0002\u068f\u0690\u0007\u000b\u0002\u0002\u0690", - "\u0692\u0005\u0148\u00a5\u0002\u0691\u0693\u0007\t\u0002\u0002\u0692", - "\u0691\u0003\u0002\u0002\u0002\u0692\u0693\u0003\u0002\u0002\u0002\u0693", - "\u06e9\u0003\u0002\u0002\u0002\u0694\u0695\u0005\u01c4\u00e3\u0002\u0695", - "\u0696\u0007\u000b\u0002\u0002\u0696\u0698\u0005\u0148\u00a5\u0002\u0697", - "\u0699\u0007\t\u0002\u0002\u0698\u0697\u0003\u0002\u0002\u0002\u0698", - "\u0699\u0003\u0002\u0002\u0002\u0699\u06e9\u0003\u0002\u0002\u0002\u069a", - "\u069b\u0005\u01c8\u00e5\u0002\u069b\u069c\u0007\u000b\u0002\u0002\u069c", - "\u069e\u0005\u0148\u00a5\u0002\u069d\u069f\u0007\t\u0002\u0002\u069e", - "\u069d\u0003\u0002\u0002\u0002\u069e\u069f\u0003\u0002\u0002\u0002\u069f", - "\u06e9\u0003\u0002\u0002\u0002\u06a0\u06a1\u0005\u01ca\u00e6\u0002\u06a1", - "\u06a2\u0007\u000b\u0002\u0002\u06a2\u06a4\u0005\u0148\u00a5\u0002\u06a3", - "\u06a5\u0007\t\u0002\u0002\u06a4\u06a3\u0003\u0002\u0002\u0002\u06a4", - "\u06a5\u0003\u0002\u0002\u0002\u06a5\u06e9\u0003\u0002\u0002\u0002\u06a6", - "\u06a7\u0005\u01ce\u00e8\u0002\u06a7\u06a8\u0007\u000b\u0002\u0002\u06a8", - "\u06aa\u0005\u0148\u00a5\u0002\u06a9\u06ab\u0007\t\u0002\u0002\u06aa", - "\u06a9\u0003\u0002\u0002\u0002\u06aa\u06ab\u0003\u0002\u0002\u0002\u06ab", - "\u06e9\u0003\u0002\u0002\u0002\u06ac\u06ad\u0005\u01d4\u00eb\u0002\u06ad", - "\u06ae\u0007\u000b\u0002\u0002\u06ae\u06b0\u0005\u0148\u00a5\u0002\u06af", - "\u06b1\u0007\t\u0002\u0002\u06b0\u06af\u0003\u0002\u0002\u0002\u06b0", - "\u06b1\u0003\u0002\u0002\u0002\u06b1\u06e9\u0003\u0002\u0002\u0002\u06b2", - "\u06b3\u0005\u01d6\u00ec\u0002\u06b3\u06b4\u0007\u000b\u0002\u0002\u06b4", - "\u06b6\u0005\u0148\u00a5\u0002\u06b5\u06b7\u0007\t\u0002\u0002\u06b6", - "\u06b5\u0003\u0002\u0002\u0002\u06b6\u06b7\u0003\u0002\u0002\u0002\u06b7", - "\u06e9\u0003\u0002\u0002\u0002\u06b8\u06b9\u0005\u01da\u00ee\u0002\u06b9", - "\u06ba\u0007\u000b\u0002\u0002\u06ba\u06bc\u0005\u0148\u00a5\u0002\u06bb", - "\u06bd\u0007\t\u0002\u0002\u06bc\u06bb\u0003\u0002\u0002\u0002\u06bc", - "\u06bd\u0003\u0002\u0002\u0002\u06bd\u06e9\u0003\u0002\u0002\u0002\u06be", - "\u06bf\u0005\u01d8\u00ed\u0002\u06bf\u06c0\u0007\u000b\u0002\u0002\u06c0", - "\u06c2\u0005\u0148\u00a5\u0002\u06c1\u06c3\u0007\t\u0002\u0002\u06c2", - "\u06c1\u0003\u0002\u0002\u0002\u06c2\u06c3\u0003\u0002\u0002\u0002\u06c3", - "\u06e9\u0003\u0002\u0002\u0002\u06c4\u06c5\u0005\u01cc\u00e7\u0002\u06c5", - "\u06c6\u0007\u000b\u0002\u0002\u06c6\u06c8\u0005\u0146\u00a4\u0002\u06c7", - "\u06c9\u0007\t\u0002\u0002\u06c8\u06c7\u0003\u0002\u0002\u0002\u06c8", - "\u06c9\u0003\u0002\u0002\u0002\u06c9\u06e9\u0003\u0002\u0002\u0002\u06ca", - "\u06cb\u0005\u01dc\u00ef\u0002\u06cb\u06cc\u0007\u000b\u0002\u0002\u06cc", - "\u06ce\u0005\u0146\u00a4\u0002\u06cd\u06cf\u0007\t\u0002\u0002\u06ce", - "\u06cd\u0003\u0002\u0002\u0002\u06ce\u06cf\u0003\u0002\u0002\u0002\u06cf", - "\u06e9\u0003\u0002\u0002\u0002\u06d0\u06d1\u0005\u01de\u00f0\u0002\u06d1", - "\u06d2\u0007\u000b\u0002\u0002\u06d2\u06d4\u0005\u0146\u00a4\u0002\u06d3", - "\u06d5\u0007\t\u0002\u0002\u06d4\u06d3\u0003\u0002\u0002\u0002\u06d4", - "\u06d5\u0003\u0002\u0002\u0002\u06d5\u06e9\u0003\u0002\u0002\u0002\u06d6", - "\u06d7\u0005\u01d2\u00ea\u0002\u06d7\u06d8\u0007\u000b\u0002\u0002\u06d8", - "\u06da\u0005\u0146\u00a4\u0002\u06d9\u06db\u0007\t\u0002\u0002\u06da", - "\u06d9\u0003\u0002\u0002\u0002\u06da\u06db\u0003\u0002\u0002\u0002\u06db", - "\u06e9\u0003\u0002\u0002\u0002\u06dc\u06dd\u0005\u01d0\u00e9\u0002\u06dd", - "\u06de\u0007\u000b\u0002\u0002\u06de\u06e0\u0005\u0146\u00a4\u0002\u06df", - "\u06e1\u0007\t\u0002\u0002\u06e0\u06df\u0003\u0002\u0002\u0002\u06e0", - "\u06e1\u0003\u0002\u0002\u0002\u06e1\u06e9\u0003\u0002\u0002\u0002\u06e2", - "\u06e3\u0005\u021e\u0110\u0002\u06e3\u06e4\u0007\u000b\u0002\u0002\u06e4", - "\u06e6\u0005\u0146\u00a4\u0002\u06e5\u06e7\u0007\t\u0002\u0002\u06e6", - "\u06e5\u0003\u0002\u0002\u0002\u06e6\u06e7\u0003\u0002\u0002\u0002\u06e7", - "\u06e9\u0003\u0002\u0002\u0002\u06e8\u0688\u0003\u0002\u0002\u0002\u06e8", - "\u068e\u0003\u0002\u0002\u0002\u06e8\u0694\u0003\u0002\u0002\u0002\u06e8", - "\u069a\u0003\u0002\u0002\u0002\u06e8\u06a0\u0003\u0002\u0002\u0002\u06e8", - "\u06a6\u0003\u0002\u0002\u0002\u06e8\u06ac\u0003\u0002\u0002\u0002\u06e8", - "\u06b2\u0003\u0002\u0002\u0002\u06e8\u06b8\u0003\u0002\u0002\u0002\u06e8", - "\u06be\u0003\u0002\u0002\u0002\u06e8\u06c4\u0003\u0002\u0002\u0002\u06e8", - "\u06ca\u0003\u0002\u0002\u0002\u06e8\u06d0\u0003\u0002\u0002\u0002\u06e8", - "\u06d6\u0003\u0002\u0002\u0002\u06e8\u06dc\u0003\u0002\u0002\u0002\u06e8", - "\u06e2\u0003\u0002\u0002\u0002\u06e9\u00cd\u0003\u0002\u0002\u0002\u06ea", - "\u06eb\u0005\u0198\u00cd\u0002\u06eb\u06ec\u0005\u01c2\u00e2\u0002\u06ec", - "\u06ee\u0005\u01be\u00e0\u0002\u06ed\u06ef\u0005\u0110\u0089\u0002\u06ee", - "\u06ed\u0003\u0002\u0002\u0002\u06ee\u06ef\u0003\u0002\u0002\u0002\u06ef", - "\u06f0\u0003\u0002\u0002\u0002\u06f0\u06f4\u0005\u024c\u0127\u0002\u06f1", - "\u06f2\u0005\u014c\u00a7\u0002\u06f2\u06f3\u0007\u0010\u0002\u0002\u06f3", - "\u06f5\u0003\u0002\u0002\u0002\u06f4\u06f1\u0003\u0002\u0002\u0002\u06f4", - "\u06f5\u0003\u0002\u0002\u0002\u06f5\u06f6\u0003\u0002\u0002\u0002\u06f6", - "\u0711\u0005\u014e\u00a8\u0002\u06f7\u06fb\u0007\u0091\u0002\u0002\u06f8", - "\u06f9\u0005\u01f8\u00fd\u0002\u06f9\u06fa\u0005\u00dan\u0002\u06fa", - "\u06fc\u0003\u0002\u0002\u0002\u06fb\u06f8\u0003\u0002\u0002\u0002\u06fb", - "\u06fc\u0003\u0002\u0002\u0002\u06fc\u0703\u0003\u0002\u0002\u0002\u06fd", - "\u06ff\u0005\u0180\u00c1\u0002\u06fe\u06fd\u0003\u0002\u0002\u0002\u06fe", - "\u06ff\u0003\u0002\u0002\u0002\u06ff\u0700\u0003\u0002\u0002\u0002\u0700", - "\u0701\u0005\u01fa\u00fe\u0002\u0701\u0702\u0005\u00d8m\u0002\u0702", - "\u0704\u0003\u0002\u0002\u0002\u0703\u06fe\u0003\u0002\u0002\u0002\u0703", - "\u0704\u0003\u0002\u0002\u0002\u0704\u0709\u0003\u0002\u0002\u0002\u0705", - "\u0707\u0005\u0180\u00c1\u0002\u0706\u0705\u0003\u0002\u0002\u0002\u0706", - "\u0707\u0003\u0002\u0002\u0002\u0707\u0708\u0003\u0002\u0002\u0002\u0708", - "\u070a\u0005\u00d0i\u0002\u0709\u0706\u0003\u0002\u0002\u0002\u0709", - "\u070a\u0003\u0002\u0002\u0002\u070a\u070f\u0003\u0002\u0002\u0002\u070b", - "\u070d\u0005\u0180\u00c1\u0002\u070c\u070b\u0003\u0002\u0002\u0002\u070c", - "\u070d\u0003\u0002\u0002\u0002\u070d\u070e\u0003\u0002\u0002\u0002\u070e", - "\u0710\u0005\u00d4k\u0002\u070f\u070c\u0003\u0002\u0002\u0002\u070f", - "\u0710\u0003\u0002\u0002\u0002\u0710\u0712\u0003\u0002\u0002\u0002\u0711", - "\u06f7\u0003\u0002\u0002\u0002\u0711\u0712\u0003\u0002\u0002\u0002\u0712", - "\u00cf\u0003\u0002\u0002\u0002\u0713\u0714\u0005\u01fc\u00ff\u0002\u0714", - "\u0719\u0007\u0005\u0002\u0002\u0715\u0716\u0005\u01fe\u0100\u0002\u0716", - "\u0717\u0007\u000b\u0002\u0002\u0717\u0718\u0005\u0142\u00a2\u0002\u0718", - "\u071a\u0003\u0002\u0002\u0002\u0719\u0715\u0003\u0002\u0002\u0002\u0719", - "\u071a\u0003\u0002\u0002\u0002\u071a\u0722\u0003\u0002\u0002\u0002\u071b", - "\u071d\u0005\u02ac\u0157\u0002\u071c\u071b\u0003\u0002\u0002\u0002\u071c", - "\u071d\u0003\u0002\u0002\u0002\u071d\u071e\u0003\u0002\u0002\u0002\u071e", - "\u071f\u0005\u0200\u0101\u0002\u071f\u0720\u0007\u000b\u0002\u0002\u0720", - "\u0721\u0005\u0146\u00a4\u0002\u0721\u0723\u0003\u0002\u0002\u0002\u0722", - "\u071c\u0003\u0002\u0002\u0002\u0722\u0723\u0003\u0002\u0002\u0002\u0723", - "\u072b\u0003\u0002\u0002\u0002\u0724\u0726\u0005\u02ac\u0157\u0002\u0725", - "\u0724\u0003\u0002\u0002\u0002\u0725\u0726\u0003\u0002\u0002\u0002\u0726", - "\u0727\u0003\u0002\u0002\u0002\u0727\u0728\u0005\u0202\u0102\u0002\u0728", - "\u0729\u0007\u000b\u0002\u0002\u0729\u072a\u0005\u00d2j\u0002\u072a", - "\u072c\u0003\u0002\u0002\u0002\u072b\u0725\u0003\u0002\u0002\u0002\u072b", - "\u072c\u0003\u0002\u0002\u0002\u072c\u0734\u0003\u0002\u0002\u0002\u072d", - "\u072f\u0005\u02ac\u0157\u0002\u072e\u072d\u0003\u0002\u0002\u0002\u072e", - "\u072f\u0003\u0002\u0002\u0002\u072f\u0730\u0003\u0002\u0002\u0002\u0730", - "\u0731\u0005\u0204\u0103\u0002\u0731\u0732\u0007\u000b\u0002\u0002\u0732", - "\u0733\u0005\u0142\u00a2\u0002\u0733\u0735\u0003\u0002\u0002\u0002\u0734", - "\u072e\u0003\u0002\u0002\u0002\u0734\u0735\u0003\u0002\u0002\u0002\u0735", - "\u073d\u0003\u0002\u0002\u0002\u0736\u0738\u0005\u02ac\u0157\u0002\u0737", - "\u0736\u0003\u0002\u0002\u0002\u0737\u0738\u0003\u0002\u0002\u0002\u0738", - "\u0739\u0003\u0002\u0002\u0002\u0739\u073a\u0005\u0206\u0104\u0002\u073a", - "\u073b\u0007\u000b\u0002\u0002\u073b\u073c\u0005\u0142\u00a2\u0002\u073c", - "\u073e\u0003\u0002\u0002\u0002\u073d\u0737\u0003\u0002\u0002\u0002\u073d", - "\u073e\u0003\u0002\u0002\u0002\u073e\u0746\u0003\u0002\u0002\u0002\u073f", - "\u0741\u0005\u02ac\u0157\u0002\u0740\u073f\u0003\u0002\u0002\u0002\u0740", - "\u0741\u0003\u0002\u0002\u0002\u0741\u0742\u0003\u0002\u0002\u0002\u0742", - "\u0743\u0005\u0208\u0105\u0002\u0743\u0744\u0007\u000b\u0002\u0002\u0744", - "\u0745\u0005\u0146\u00a4\u0002\u0745\u0747\u0003\u0002\u0002\u0002\u0746", - "\u0740\u0003\u0002\u0002\u0002\u0746\u0747\u0003\u0002\u0002\u0002\u0747", - "\u074f\u0003\u0002\u0002\u0002\u0748\u074a\u0005\u02ac\u0157\u0002\u0749", - "\u0748\u0003\u0002\u0002\u0002\u0749\u074a\u0003\u0002\u0002\u0002\u074a", - "\u074b\u0003\u0002\u0002\u0002\u074b\u074c\u0005\u020a\u0106\u0002\u074c", - "\u074d\u0007\u000b\u0002\u0002\u074d\u074e\u0005\u0142\u00a2\u0002\u074e", - "\u0750\u0003\u0002\u0002\u0002\u074f\u0749\u0003\u0002\u0002\u0002\u074f", - "\u0750\u0003\u0002\u0002\u0002\u0750\u0758\u0003\u0002\u0002\u0002\u0751", - "\u0753\u0005\u02ac\u0157\u0002\u0752\u0751\u0003\u0002\u0002\u0002\u0752", - "\u0753\u0003\u0002\u0002\u0002\u0753\u0754\u0003\u0002\u0002\u0002\u0754", - "\u0755\u0005\u020c\u0107\u0002\u0755\u0756\u0007\u000b\u0002\u0002\u0756", - "\u0757\u0005\u0142\u00a2\u0002\u0757\u0759\u0003\u0002\u0002\u0002\u0758", - "\u0752\u0003\u0002\u0002\u0002\u0758\u0759\u0003\u0002\u0002\u0002\u0759", - "\u0761\u0003\u0002\u0002\u0002\u075a\u075c\u0005\u02ac\u0157\u0002\u075b", - "\u075a\u0003\u0002\u0002\u0002\u075b\u075c\u0003\u0002\u0002\u0002\u075c", - "\u075d\u0003\u0002\u0002\u0002\u075d\u075e\u0005\u020e\u0108\u0002\u075e", - "\u075f\u0007\u000b\u0002\u0002\u075f\u0760\u0005\u0142\u00a2\u0002\u0760", - "\u0762\u0003\u0002\u0002\u0002\u0761\u075b\u0003\u0002\u0002\u0002\u0761", - "\u0762\u0003\u0002\u0002\u0002\u0762\u076a\u0003\u0002\u0002\u0002\u0763", - "\u0765\u0005\u02ac\u0157\u0002\u0764\u0763\u0003\u0002\u0002\u0002\u0764", - "\u0765\u0003\u0002\u0002\u0002\u0765\u0766\u0003\u0002\u0002\u0002\u0766", - "\u0767\u0005\u0210\u0109\u0002\u0767\u0768\u0007\u000b\u0002\u0002\u0768", - "\u0769\u0005\u0148\u00a5\u0002\u0769\u076b\u0003\u0002\u0002\u0002\u076a", - "\u0764\u0003\u0002\u0002\u0002\u076a\u076b\u0003\u0002\u0002\u0002\u076b", - "\u076c\u0003\u0002\u0002\u0002\u076c\u076d\u0007\u0006\u0002\u0002\u076d", - "\u00d1\u0003\u0002\u0002\u0002\u076e\u0771\u0005\u0218\u010d\u0002\u076f", - "\u0771\u0005\u021a\u010e\u0002\u0770\u076e\u0003\u0002\u0002\u0002\u0770", - "\u076f\u0003\u0002\u0002\u0002\u0771\u00d3\u0003\u0002\u0002\u0002\u0772", - "\u0773\u0005\u024e\u0128\u0002\u0773\u0778\u0007\u0005\u0002\u0002\u0774", - "\u0775\u0005\u0212\u010a\u0002\u0775\u0776\u0007\u000b\u0002\u0002\u0776", - "\u0777\u0005\u0148\u00a5\u0002\u0777\u0779\u0003\u0002\u0002\u0002\u0778", - "\u0774\u0003\u0002\u0002\u0002\u0778\u0779\u0003\u0002\u0002\u0002\u0779", - "\u0781\u0003\u0002\u0002\u0002\u077a\u077c\u0005\u02ac\u0157\u0002\u077b", - "\u077a\u0003\u0002\u0002\u0002\u077b\u077c\u0003\u0002\u0002\u0002\u077c", - "\u077d\u0003\u0002\u0002\u0002\u077d\u077e\u0005\u0214\u010b\u0002\u077e", - "\u077f\u0007\u000b\u0002\u0002\u077f\u0780\u0005\u0148\u00a5\u0002\u0780", - "\u0782\u0003\u0002\u0002\u0002\u0781\u077b\u0003\u0002\u0002\u0002\u0781", - "\u0782\u0003\u0002\u0002\u0002\u0782\u078a\u0003\u0002\u0002\u0002\u0783", - "\u0785\u0005\u02ac\u0157\u0002\u0784\u0783\u0003\u0002\u0002\u0002\u0784", - "\u0785\u0003\u0002\u0002\u0002\u0785\u0786\u0003\u0002\u0002\u0002\u0786", - "\u0787\u0005\u0216\u010c\u0002\u0787\u0788\u0007\u000b\u0002\u0002\u0788", - "\u0789\u0005\u0148\u00a5\u0002\u0789\u078b\u0003\u0002\u0002\u0002\u078a", - "\u0784\u0003\u0002\u0002\u0002\u078a\u078b\u0003\u0002\u0002\u0002\u078b", - "\u078c\u0003\u0002\u0002\u0002\u078c\u078d\u0007\u0006\u0002\u0002\u078d", - "\u00d5\u0003\u0002\u0002\u0002\u078e\u0793\u0005\u01e8\u00f5\u0002\u078f", - "\u0793\u0005\u01e6\u00f4\u0002\u0790\u0793\u0005\u01ea\u00f6\u0002\u0791", - "\u0793\u0005\u01ec\u00f7\u0002\u0792\u078e\u0003\u0002\u0002\u0002\u0792", - "\u078f\u0003\u0002\u0002\u0002\u0792\u0790\u0003\u0002\u0002\u0002\u0792", - "\u0791\u0003\u0002\u0002\u0002\u0793\u00d7\u0003\u0002\u0002\u0002\u0794", - "\u079a\u0005\u00d6l\u0002\u0795\u0796\u0005\u02ac\u0157\u0002\u0796", - "\u0797\u0005\u00d6l\u0002\u0797\u0799\u0003\u0002\u0002\u0002\u0798", - "\u0795\u0003\u0002\u0002\u0002\u0799\u079c\u0003\u0002\u0002\u0002\u079a", - "\u0798\u0003\u0002\u0002\u0002\u079a\u079b\u0003\u0002\u0002\u0002\u079b", - "\u00d9\u0003\u0002\u0002\u0002\u079c\u079a\u0003\u0002\u0002\u0002\u079d", - "\u07a3\u0005\u00dco\u0002\u079e\u079f\u0005\u02ac\u0157\u0002\u079f", - "\u07a0\u0005\u00dco\u0002\u07a0\u07a2\u0003\u0002\u0002\u0002\u07a1", - "\u079e\u0003\u0002\u0002\u0002\u07a2\u07a5\u0003\u0002\u0002\u0002\u07a3", - "\u07a1\u0003\u0002\u0002\u0002\u07a3\u07a4\u0003\u0002\u0002\u0002\u07a4", - "\u00db\u0003\u0002\u0002\u0002\u07a5\u07a3\u0003\u0002\u0002\u0002\u07a6", - "\u07d3\u0005\u0150\u00a9\u0002\u07a7\u07ac\u0007\u0005\u0002\u0002\u07a8", - "\u07a9\u0005\u01ee\u00f8\u0002\u07a9\u07aa\u0007\u000b\u0002\u0002\u07aa", - "\u07ab\u0005\u0148\u00a5\u0002\u07ab\u07ad\u0003\u0002\u0002\u0002\u07ac", - "\u07a8\u0003\u0002\u0002\u0002\u07ac\u07ad\u0003\u0002\u0002\u0002\u07ad", - "\u07b5\u0003\u0002\u0002\u0002\u07ae\u07b0\u0005\u02ac\u0157\u0002\u07af", - "\u07ae\u0003\u0002\u0002\u0002\u07af\u07b0\u0003\u0002\u0002\u0002\u07b0", - "\u07b1\u0003\u0002\u0002\u0002\u07b1\u07b2\u0005\u01f0\u00f9\u0002\u07b2", - "\u07b3\u0007\u000b\u0002\u0002\u07b3\u07b4\u0005\u0148\u00a5\u0002\u07b4", - "\u07b6\u0003\u0002\u0002\u0002\u07b5\u07af\u0003\u0002\u0002\u0002\u07b5", - "\u07b6\u0003\u0002\u0002\u0002\u07b6\u07be\u0003\u0002\u0002\u0002\u07b7", - "\u07b9\u0005\u02ac\u0157\u0002\u07b8\u07b7\u0003\u0002\u0002\u0002\u07b8", - "\u07b9\u0003\u0002\u0002\u0002\u07b9\u07ba\u0003\u0002\u0002\u0002\u07ba", - "\u07bb\u0005\u01f2\u00fa\u0002\u07bb\u07bc\u0007\u000b\u0002\u0002\u07bc", - "\u07bd\u0005\u0148\u00a5\u0002\u07bd\u07bf\u0003\u0002\u0002\u0002\u07be", - "\u07b8\u0003\u0002\u0002\u0002\u07be\u07bf\u0003\u0002\u0002\u0002\u07bf", - "\u07c7\u0003\u0002\u0002\u0002\u07c0\u07c2\u0005\u02ac\u0157\u0002\u07c1", - "\u07c0\u0003\u0002\u0002\u0002\u07c1\u07c2\u0003\u0002\u0002\u0002\u07c2", - "\u07c3\u0003\u0002\u0002\u0002\u07c3\u07c4\u0005\u01f4\u00fb\u0002\u07c4", - "\u07c5\u0007\u000b\u0002\u0002\u07c5\u07c6\u0005\u0148\u00a5\u0002\u07c6", - "\u07c8\u0003\u0002\u0002\u0002\u07c7\u07c1\u0003\u0002\u0002\u0002\u07c7", - "\u07c8\u0003\u0002\u0002\u0002\u07c8\u07d0\u0003\u0002\u0002\u0002\u07c9", - "\u07cb\u0005\u02ac\u0157\u0002\u07ca\u07c9\u0003\u0002\u0002\u0002\u07ca", - "\u07cb\u0003\u0002\u0002\u0002\u07cb\u07cc\u0003\u0002\u0002\u0002\u07cc", - "\u07cd\u0005\u01f6\u00fc\u0002\u07cd\u07ce\u0007\u000b\u0002\u0002\u07ce", - "\u07cf\u0005\u0148\u00a5\u0002\u07cf\u07d1\u0003\u0002\u0002\u0002\u07d0", - "\u07ca\u0003\u0002\u0002\u0002\u07d0\u07d1\u0003\u0002\u0002\u0002\u07d1", - "\u07d2\u0003\u0002\u0002\u0002\u07d2\u07d4\u0007\u0006\u0002\u0002\u07d3", - "\u07a7\u0003\u0002\u0002\u0002\u07d3\u07d4\u0003\u0002\u0002\u0002\u07d4", - "\u0805\u0003\u0002\u0002\u0002\u07d5\u0802\u0007\u0011\u0002\u0002\u07d6", - "\u07db\u0007\u0005\u0002\u0002\u07d7\u07d8\u0005\u01ee\u00f8\u0002\u07d8", - "\u07d9\u0007\u000b\u0002\u0002\u07d9\u07da\u0005\u0148\u00a5\u0002\u07da", - "\u07dc\u0003\u0002\u0002\u0002\u07db\u07d7\u0003\u0002\u0002\u0002\u07db", - "\u07dc\u0003\u0002\u0002\u0002\u07dc\u07e4\u0003\u0002\u0002\u0002\u07dd", - "\u07df\u0005\u02ac\u0157\u0002\u07de\u07dd\u0003\u0002\u0002\u0002\u07de", - "\u07df\u0003\u0002\u0002\u0002\u07df\u07e0\u0003\u0002\u0002\u0002\u07e0", - "\u07e1\u0005\u01f0\u00f9\u0002\u07e1\u07e2\u0007\u000b\u0002\u0002\u07e2", - "\u07e3\u0005\u0148\u00a5\u0002\u07e3\u07e5\u0003\u0002\u0002\u0002\u07e4", - "\u07de\u0003\u0002\u0002\u0002\u07e4\u07e5\u0003\u0002\u0002\u0002\u07e5", - "\u07ed\u0003\u0002\u0002\u0002\u07e6\u07e8\u0005\u02ac\u0157\u0002\u07e7", - "\u07e6\u0003\u0002\u0002\u0002\u07e7\u07e8\u0003\u0002\u0002\u0002\u07e8", - "\u07e9\u0003\u0002\u0002\u0002\u07e9\u07ea\u0005\u01f2\u00fa\u0002\u07ea", - "\u07eb\u0007\u000b\u0002\u0002\u07eb\u07ec\u0005\u0148\u00a5\u0002\u07ec", - "\u07ee\u0003\u0002\u0002\u0002\u07ed\u07e7\u0003\u0002\u0002\u0002\u07ed", - "\u07ee\u0003\u0002\u0002\u0002\u07ee\u07f6\u0003\u0002\u0002\u0002\u07ef", - "\u07f1\u0005\u02ac\u0157\u0002\u07f0\u07ef\u0003\u0002\u0002\u0002\u07f0", - "\u07f1\u0003\u0002\u0002\u0002\u07f1\u07f2\u0003\u0002\u0002\u0002\u07f2", - "\u07f3\u0005\u01f4\u00fb\u0002\u07f3\u07f4\u0007\u000b\u0002\u0002\u07f4", - "\u07f5\u0005\u0148\u00a5\u0002\u07f5\u07f7\u0003\u0002\u0002\u0002\u07f6", - "\u07f0\u0003\u0002\u0002\u0002\u07f6\u07f7\u0003\u0002\u0002\u0002\u07f7", - "\u07ff\u0003\u0002\u0002\u0002\u07f8\u07fa\u0005\u02ac\u0157\u0002\u07f9", - "\u07f8\u0003\u0002\u0002\u0002\u07f9\u07fa\u0003\u0002\u0002\u0002\u07fa", - "\u07fb\u0003\u0002\u0002\u0002\u07fb\u07fc\u0005\u01f6\u00fc\u0002\u07fc", - "\u07fd\u0007\u000b\u0002\u0002\u07fd\u07fe\u0005\u0148\u00a5\u0002\u07fe", - "\u0800\u0003\u0002\u0002\u0002\u07ff\u07f9\u0003\u0002\u0002\u0002\u07ff", - "\u0800\u0003\u0002\u0002\u0002\u0800\u0801\u0003\u0002\u0002\u0002\u0801", - "\u0803\u0007\u0006\u0002\u0002\u0802\u07d6\u0003\u0002\u0002\u0002\u0802", - "\u0803\u0003\u0002\u0002\u0002\u0803\u0805\u0003\u0002\u0002\u0002\u0804", - "\u07a6\u0003\u0002\u0002\u0002\u0804\u07d5\u0003\u0002\u0002\u0002\u0805", - "\u00dd\u0003\u0002\u0002\u0002\u0806\u0809\u0005\u02b0\u0159\u0002\u0807", - "\u0809\u0005\u0146\u00a4\u0002\u0808\u0806\u0003\u0002\u0002\u0002\u0808", - "\u0807\u0003\u0002\u0002\u0002\u0809\u00df\u0003\u0002\u0002\u0002\u080a", - "\u0810\u0005\u0150\u00a9\u0002\u080b\u0810\u0005\u00e2r\u0002\u080c", - "\u0810\u0005\u00e4s\u0002\u080d\u0810\u0005\u00e6t\u0002\u080e\u0810", - "\u0005\u00e8u\u0002\u080f\u080a\u0003\u0002\u0002\u0002\u080f\u080b", - "\u0003\u0002\u0002\u0002\u080f\u080c\u0003\u0002\u0002\u0002\u080f\u080d", - "\u0003\u0002\u0002\u0002\u080f\u080e\u0003\u0002\u0002\u0002\u0810\u00e1", - "\u0003\u0002\u0002\u0002\u0811\u0812\u0005\u022e\u0118\u0002\u0812\u0813", - "\u0005\u029c\u014f\u0002\u0813\u0814\u0005\u0150\u00a9\u0002\u0814\u0815", - "\u0005\u029e\u0150\u0002\u0815\u00e3\u0003\u0002\u0002\u0002\u0816\u0817", - "\u0005\u01a6\u00d4\u0002\u0817\u0818\u0005\u029c\u014f\u0002\u0818\u0819", - "\u0005\u0150\u00a9\u0002\u0819\u081a\u0005\u029e\u0150\u0002\u081a\u00e5", - "\u0003\u0002\u0002\u0002\u081b\u081c\u0005\u01b2\u00da\u0002\u081c\u081d", - "\u0005\u029c\u014f\u0002\u081d\u081e\u0005\u0150\u00a9\u0002\u081e\u081f", - "\u0005\u029e\u0150\u0002\u081f\u00e7\u0003\u0002\u0002\u0002\u0820\u0821", - "\u0005\u0290\u0149\u0002\u0821\u0822\u0005\u029c\u014f\u0002\u0822\u0823", - "\u0005\u0150\u00a9\u0002\u0823\u0824\u0005\u029e\u0150\u0002\u0824\u00e9", - "\u0003\u0002\u0002\u0002\u0825\u0827\u0005\u00ba^\u0002\u0826\u0825", - "\u0003\u0002\u0002\u0002\u0826\u0827\u0003\u0002\u0002\u0002\u0827\u0828", - "\u0003\u0002\u0002\u0002\u0828\u082a\u0005\u019a\u00ce\u0002\u0829\u082b", - "\u0005\u00ecw\u0002\u082a\u0829\u0003\u0002\u0002\u0002\u082a\u082b", - "\u0003\u0002\u0002\u0002\u082b\u082c\u0003\u0002\u0002\u0002\u082c\u082e", - "\u0005\u0124\u0093\u0002\u082d\u082f\u0005\u010e\u0088\u0002\u082e\u082d", - "\u0003\u0002\u0002\u0002\u082e\u082f\u0003\u0002\u0002\u0002\u082f\u0830", - "\u0003\u0002\u0002\u0002\u0830\u0833\u0005\u012c\u0097\u0002\u0831\u0834", - "\u0005\u0112\u008a\u0002\u0832\u0834\u0005\u00f2z\u0002\u0833\u0831", - "\u0003\u0002\u0002\u0002\u0833\u0832\u0003\u0002\u0002\u0002\u0833\u0834", - "\u0003\u0002\u0002\u0002\u0834\u00eb\u0003\u0002\u0002\u0002\u0835\u083b", - "\u0005\u00eex\u0002\u0836\u0837\u0005\u02ac\u0157\u0002\u0837\u0838", - "\u0005\u00eex\u0002\u0838\u083a\u0003\u0002\u0002\u0002\u0839\u0836", - "\u0003\u0002\u0002\u0002\u083a\u083d\u0003\u0002\u0002\u0002\u083b\u0839", - "\u0003\u0002\u0002\u0002\u083b\u083c\u0003\u0002\u0002\u0002\u083c\u00ed", - "\u0003\u0002\u0002\u0002\u083d\u083b\u0003\u0002\u0002\u0002\u083e\u0848", - "\u0005\u02b0\u0159\u0002\u083f\u0840\u0005\u02b0\u0159\u0002\u0840\u0843", - "\u0007\u0007\u0002\u0002\u0841\u0844\u0005\u0146\u00a4\u0002\u0842\u0844", - "\u0005\u0142\u00a2\u0002\u0843\u0841\u0003\u0002\u0002\u0002\u0843\u0842", - "\u0003\u0002\u0002\u0002\u0844\u0845\u0003\u0002\u0002\u0002\u0845\u0846", - "\u0007\b\u0002\u0002\u0846\u0848\u0003\u0002\u0002\u0002\u0847\u083e", - "\u0003\u0002\u0002\u0002\u0847\u083f\u0003\u0002\u0002\u0002\u0848\u00ef", - "\u0003\u0002\u0002\u0002\u0849\u084b\u0005\u00ba^\u0002\u084a\u0849", - "\u0003\u0002\u0002\u0002\u084a\u084b\u0003\u0002\u0002\u0002\u084b\u084c", - "\u0003\u0002\u0002\u0002\u084c\u0850\u0005\u0286\u0144\u0002\u084d\u084e", - "\u0005\u014c\u00a7\u0002\u084e\u084f\u0007\u0010\u0002\u0002\u084f\u0851", - "\u0003\u0002\u0002\u0002\u0850\u084d\u0003\u0002\u0002\u0002\u0850\u0851", - "\u0003\u0002\u0002\u0002\u0851\u0852\u0003\u0002\u0002\u0002\u0852\u0854", - "\u0005\u014e\u00a8\u0002\u0853\u0855\u0005\u0108\u0085\u0002\u0854\u0853", - "\u0003\u0002\u0002\u0002\u0854\u0855\u0003\u0002\u0002\u0002\u0855\u0856", - "\u0003\u0002\u0002\u0002\u0856\u0857\u0005\u026c\u0137\u0002\u0857\u0858", - "\u0005\u00f8}\u0002\u0858\u085b\u0005\u012c\u0097\u0002\u0859\u085c", - "\u0005\u0112\u008a\u0002\u085a\u085c\u0005\u00f2z\u0002\u085b\u0859", - "\u0003\u0002\u0002\u0002\u085b\u085a\u0003\u0002\u0002\u0002\u085b\u085c", - "\u0003\u0002\u0002\u0002\u085c\u00f1\u0003\u0002\u0002\u0002\u085d\u085e", - "\u0005\u01ba\u00de\u0002\u085e\u085f\u0005\u00f4{\u0002\u085f\u00f3", - "\u0003\u0002\u0002\u0002\u0860\u0866\u0005\u00f6|\u0002\u0861\u0862", - "\u0005\u0180\u00c1\u0002\u0862\u0863\u0005\u00f6|\u0002\u0863\u0865", - "\u0003\u0002\u0002\u0002\u0864\u0861\u0003\u0002\u0002\u0002\u0865\u0868", - "\u0003\u0002\u0002\u0002\u0866\u0864\u0003\u0002\u0002\u0002\u0866\u0867", - "\u0003\u0002\u0002\u0002\u0867\u00f5\u0003\u0002\u0002\u0002\u0868\u0866", - "\u0003\u0002\u0002\u0002\u0869\u086a\u0005\u02b0\u0159\u0002\u086a\u086b", - "\u0007\u00de\u0002\u0002\u086b\u086c\u0005\u0140\u00a1\u0002\u086c\u00f7", - "\u0003\u0002\u0002\u0002\u086d\u0873\u0005\u00fa~\u0002\u086e\u086f", - "\u0005\u02ac\u0157\u0002\u086f\u0870\u0005\u00fa~\u0002\u0870\u0872", - "\u0003\u0002\u0002\u0002\u0871\u086e\u0003\u0002\u0002\u0002\u0872\u0875", - "\u0003\u0002\u0002\u0002\u0873\u0871\u0003\u0002\u0002\u0002\u0873\u0874", - "\u0003\u0002\u0002\u0002\u0874\u00f9\u0003\u0002\u0002\u0002\u0875\u0873", - "\u0003\u0002\u0002\u0002\u0876\u0877\u0005\u02b0\u0159\u0002\u0877\u087c", - "\u0007\u00de\u0002\u0002\u0878\u087d\u0005\u0140\u00a1\u0002\u0879\u087d", - "\u0005\u00fe\u0080\u0002\u087a\u087d\u0005\u00fc\u007f\u0002\u087b\u087d", - "\u0005\u0102\u0082\u0002\u087c\u0878\u0003\u0002\u0002\u0002\u087c\u0879", - "\u0003\u0002\u0002\u0002\u087c\u087a\u0003\u0002\u0002\u0002\u087c\u087b", - "\u0003\u0002\u0002\u0002\u087d\u08b0\u0003\u0002\u0002\u0002\u087e\u087f", - "\u0005\u02b0\u0159\u0002\u087f\u0880\u0007\u00de\u0002\u0002\u0880\u0881", - "\u0005\u02b0\u0159\u0002\u0881\u0882\t\u0003\u0002\u0002\u0882\u0883", - "\u0005\u0142\u00a2\u0002\u0883\u08b0\u0003\u0002\u0002\u0002\u0884\u0885", - "\u0005\u02b0\u0159\u0002\u0885\u0886\u0007\u00de\u0002\u0002\u0886\u0887", - "\u0005\u02b0\u0159\u0002\u0887\u0888\t\u0003\u0002\u0002\u0888\u0889", - "\u0005\u00fc\u007f\u0002\u0889\u08b0\u0003\u0002\u0002\u0002\u088a\u088b", - "\u0005\u02b0\u0159\u0002\u088b\u088c\u0007\u00de\u0002\u0002\u088c\u088d", - "\u0005\u00fc\u007f\u0002\u088d\u088e\t\u0003\u0002\u0002\u088e\u088f", - "\u0005\u02b0\u0159\u0002\u088f\u08b0\u0003\u0002\u0002\u0002\u0890\u0891", - "\u0005\u02b0\u0159\u0002\u0891\u0892\u0007\u00de\u0002\u0002\u0892\u0893", - "\u0005\u02b0\u0159\u0002\u0893\u0894\t\u0003\u0002\u0002\u0894\u0895", - "\u0005\u00fe\u0080\u0002\u0895\u08b0\u0003\u0002\u0002\u0002\u0896\u0897", - "\u0005\u02b0\u0159\u0002\u0897\u0898\u0007\u00de\u0002\u0002\u0898\u0899", - "\u0005\u00fe\u0080\u0002\u0899\u089a\t\u0003\u0002\u0002\u089a\u089b", - "\u0005\u02b0\u0159\u0002\u089b\u08b0\u0003\u0002\u0002\u0002\u089c\u089d", - "\u0005\u02b0\u0159\u0002\u089d\u089e\u0007\u00de\u0002\u0002\u089e\u089f", - "\u0005\u02b0\u0159\u0002\u089f\u08a0\t\u0003\u0002\u0002\u08a0\u08a1", - "\u0005\u0102\u0082\u0002\u08a1\u08b0\u0003\u0002\u0002\u0002\u08a2\u08a3", - "\u0005\u02b0\u0159\u0002\u08a3\u08a4\u0007\u00de\u0002\u0002\u08a4\u08a5", - "\u0005\u0102\u0082\u0002\u08a5\u08a6\t\u0003\u0002\u0002\u08a6\u08a7", - "\u0005\u02b0\u0159\u0002\u08a7\u08b0\u0003\u0002\u0002\u0002\u08a8\u08a9", - "\u0005\u02b0\u0159\u0002\u08a9\u08aa\u0005\u02a8\u0155\u0002\u08aa\u08ab", - "\u0005\u0142\u00a2\u0002\u08ab\u08ac\u0005\u02aa\u0156\u0002\u08ac\u08ad", - "\u0007\u00de\u0002\u0002\u08ad\u08ae\u0005\u0140\u00a1\u0002\u08ae\u08b0", - "\u0003\u0002\u0002\u0002\u08af\u0876\u0003\u0002\u0002\u0002\u08af\u087e", - "\u0003\u0002\u0002\u0002\u08af\u0884\u0003\u0002\u0002\u0002\u08af\u088a", - "\u0003\u0002\u0002\u0002\u08af\u0890\u0003\u0002\u0002\u0002\u08af\u0896", - "\u0003\u0002\u0002\u0002\u08af\u089c\u0003\u0002\u0002\u0002\u08af\u08a2", - "\u0003\u0002\u0002\u0002\u08af\u08a8\u0003\u0002\u0002\u0002\u08b0\u00fb", - "\u0003\u0002\u0002\u0002\u08b1\u08bb\u0005\u02a0\u0151\u0002\u08b2\u08b8", - "\u0005\u0140\u00a1\u0002\u08b3\u08b4\u0005\u02ac\u0157\u0002\u08b4\u08b5", - "\u0005\u011c\u008f\u0002\u08b5\u08b7\u0003\u0002\u0002\u0002\u08b6\u08b3", - "\u0003\u0002\u0002\u0002\u08b7\u08ba\u0003\u0002\u0002\u0002\u08b8\u08b6", - "\u0003\u0002\u0002\u0002\u08b8\u08b9\u0003\u0002\u0002\u0002\u08b9\u08bc", - "\u0003\u0002\u0002\u0002\u08ba\u08b8\u0003\u0002\u0002\u0002\u08bb\u08b2", - "\u0003\u0002\u0002\u0002\u08bb\u08bc\u0003\u0002\u0002\u0002\u08bc\u08bd", - "\u0003\u0002\u0002\u0002\u08bd\u08be\u0005\u02a2\u0152\u0002\u08be\u00fd", - "\u0003\u0002\u0002\u0002\u08bf\u08c0\u0005\u02a0\u0151\u0002\u08c0\u08c1", - "\u0005\u0140\u00a1\u0002\u08c1\u08c2\u0005\u02ae\u0158\u0002\u08c2\u08c3", - "\u0005\u011c\u008f\u0002\u08c3\u08cb\u0003\u0002\u0002\u0002\u08c4\u08c5", - "\u0005\u02ac\u0157\u0002\u08c5\u08c6\u0005\u0140\u00a1\u0002\u08c6\u08c7", - "\u0005\u02ae\u0158\u0002\u08c7\u08c8\u0005\u011c\u008f\u0002\u08c8\u08ca", - "\u0003\u0002\u0002\u0002\u08c9\u08c4\u0003\u0002\u0002\u0002\u08ca\u08cd", - "\u0003\u0002\u0002\u0002\u08cb\u08c9\u0003\u0002\u0002\u0002\u08cb\u08cc", - "\u0003\u0002\u0002\u0002\u08cc\u08ce\u0003\u0002\u0002\u0002\u08cd\u08cb", - "\u0003\u0002\u0002\u0002\u08ce\u08cf\u0005\u02a2\u0152\u0002\u08cf\u00ff", - "\u0003\u0002\u0002\u0002\u08d0\u08d1\u0005\u02a0\u0151\u0002\u08d1\u08d7", - "\u0005\u011c\u008f\u0002\u08d2\u08d3\u0005\u02ac\u0157\u0002\u08d3\u08d4", - "\u0005\u011c\u008f\u0002\u08d4\u08d6\u0003\u0002\u0002\u0002\u08d5\u08d2", - "\u0003\u0002\u0002\u0002\u08d6\u08d9\u0003\u0002\u0002\u0002\u08d7\u08d5", - "\u0003\u0002\u0002\u0002\u08d7\u08d8\u0003\u0002\u0002\u0002\u08d8\u08da", - "\u0003\u0002\u0002\u0002\u08d9\u08d7\u0003\u0002\u0002\u0002\u08da\u08db", - "\u0005\u02a2\u0152\u0002\u08db\u0101\u0003\u0002\u0002\u0002\u08dc\u08dd", - "\u0005\u02a8\u0155\u0002\u08dd\u08e3\u0005\u0140\u00a1\u0002\u08de\u08df", - "\u0005\u02ac\u0157\u0002\u08df\u08e0\u0005\u011c\u008f\u0002\u08e0\u08e2", - "\u0003\u0002\u0002\u0002\u08e1\u08de\u0003\u0002\u0002\u0002\u08e2\u08e5", - "\u0003\u0002\u0002\u0002\u08e3\u08e1\u0003\u0002\u0002\u0002\u08e3\u08e4", - "\u0003\u0002\u0002\u0002\u08e4\u08e6\u0003\u0002\u0002\u0002\u08e5\u08e3", - "\u0003\u0002\u0002\u0002\u08e6\u08e7\u0005\u02aa\u0156\u0002\u08e7\u0103", - "\u0003\u0002\u0002\u0002\u08e8\u0905\u0005\u029c\u014f\u0002\u08e9\u08fa", - "\u0005\u011c\u008f\u0002\u08ea\u08eb\u0005\u02ac\u0157\u0002\u08eb\u08ec", - "\u0005\u011c\u008f\u0002\u08ec\u08ee\u0003\u0002\u0002\u0002\u08ed\u08ea", - "\u0003\u0002\u0002\u0002\u08ee\u08f1\u0003\u0002\u0002\u0002\u08ef\u08ed", - "\u0003\u0002\u0002\u0002\u08ef\u08f0\u0003\u0002\u0002\u0002\u08f0\u08fb", - "\u0003\u0002\u0002\u0002\u08f1\u08ef\u0003\u0002\u0002\u0002\u08f2\u08f3", - "\u0005\u02ac\u0157\u0002\u08f3\u08f4\u0005\u0104\u0083\u0002\u08f4\u08f6", - "\u0003\u0002\u0002\u0002\u08f5\u08f2\u0003\u0002\u0002\u0002\u08f6\u08f9", - "\u0003\u0002\u0002\u0002\u08f7\u08f5\u0003\u0002\u0002\u0002\u08f7\u08f8", - "\u0003\u0002\u0002\u0002\u08f8\u08fb\u0003\u0002\u0002\u0002\u08f9\u08f7", - "\u0003\u0002\u0002\u0002\u08fa\u08ef\u0003\u0002\u0002\u0002\u08fa\u08f7", - "\u0003\u0002\u0002\u0002\u08fb\u0906\u0003\u0002\u0002\u0002\u08fc\u0902", - "\u0005\u0104\u0083\u0002\u08fd\u08fe\u0005\u02ac\u0157\u0002\u08fe\u08ff", - "\u0005\u0104\u0083\u0002\u08ff\u0901\u0003\u0002\u0002\u0002\u0900\u08fd", - "\u0003\u0002\u0002\u0002\u0901\u0904\u0003\u0002\u0002\u0002\u0902\u0900", - "\u0003\u0002\u0002\u0002\u0902\u0903\u0003\u0002\u0002\u0002\u0903\u0906", - "\u0003\u0002\u0002\u0002\u0904\u0902\u0003\u0002\u0002\u0002\u0905\u08e9", - "\u0003\u0002\u0002\u0002\u0905\u08fc\u0003\u0002\u0002\u0002\u0906\u0907", - "\u0003\u0002\u0002\u0002\u0907\u0908\u0005\u029e\u0150\u0002\u0908\u0105", - "\u0003\u0002\u0002\u0002\u0909\u090b\u0005\u00ba^\u0002\u090a\u0909", - "\u0003\u0002\u0002\u0002\u090a\u090b\u0003\u0002\u0002\u0002\u090b\u090c", - "\u0003\u0002\u0002\u0002\u090c\u090d\u0005\u0224\u0113\u0002\u090d\u0911", - "\u0005\u0226\u0114\u0002\u090e\u090f\u0005\u014c\u00a7\u0002\u090f\u0910", - "\u0007\u0010\u0002\u0002\u0910\u0912\u0003\u0002\u0002\u0002\u0911\u090e", - "\u0003\u0002\u0002\u0002\u0911\u0912\u0003\u0002\u0002\u0002\u0912\u0913", - "\u0003\u0002\u0002\u0002\u0913\u0915\u0005\u014e\u00a8\u0002\u0914\u0916", - "\u0005\u0116\u008c\u0002\u0915\u0914\u0003\u0002\u0002\u0002\u0915\u0916", - "\u0003\u0002\u0002\u0002\u0916\u0917\u0003\u0002\u0002\u0002\u0917\u0919", - "\u0005\u0114\u008b\u0002\u0918\u091a\u0005\u0110\u0089\u0002\u0919\u0918", - "\u0003\u0002\u0002\u0002\u0919\u091a\u0003\u0002\u0002\u0002\u091a\u091c", - "\u0003\u0002\u0002\u0002\u091b\u091d\u0005\u0108\u0085\u0002\u091c\u091b", - "\u0003\u0002\u0002\u0002\u091c\u091d\u0003\u0002\u0002\u0002\u091d\u0107", - "\u0003\u0002\u0002\u0002\u091e\u091f\u0005\u028e\u0148\u0002\u091f\u0920", - "\u0005\u010c\u0087\u0002\u0920\u092f\u0003\u0002\u0002\u0002\u0921\u0922", - "\u0005\u028e\u0148\u0002\u0922\u0923\u0005\u010c\u0087\u0002\u0923\u0924", - "\u0005\u0180\u00c1\u0002\u0924\u0925\u0005\u010a\u0086\u0002\u0925\u092f", - "\u0003\u0002\u0002\u0002\u0926\u0927\u0005\u028e\u0148\u0002\u0927\u0928", - "\u0005\u010a\u0086\u0002\u0928\u092f\u0003\u0002\u0002\u0002\u0929\u092a", - "\u0005\u028e\u0148\u0002\u092a\u092b\u0005\u010a\u0086\u0002\u092b\u092c", - "\u0005\u0180\u00c1\u0002\u092c\u092d\u0005\u010c\u0087\u0002\u092d\u092f", - "\u0003\u0002\u0002\u0002\u092e\u091e\u0003\u0002\u0002\u0002\u092e\u0921", - "\u0003\u0002\u0002\u0002\u092e\u0926\u0003\u0002\u0002\u0002\u092e\u0929", - "\u0003\u0002\u0002\u0002\u092f\u0109\u0003\u0002\u0002\u0002\u0930\u0931", - "\u0005\u0278\u013d\u0002\u0931\u0932\u0005\u0142\u00a2\u0002\u0932\u010b", - "\u0003\u0002\u0002\u0002\u0933\u0934\u0005\u0280\u0141\u0002\u0934\u0935", - "\u0005\u0142\u00a2\u0002\u0935\u010d\u0003\u0002\u0002\u0002\u0936\u0937", - "\u0005\u028e\u0148\u0002\u0937\u0938\u0005\u010a\u0086\u0002\u0938\u010f", - "\u0003\u0002\u0002\u0002\u0939\u093a\u0005\u01ba\u00de\u0002\u093a\u093b", - "\u0005\u0246\u0124\u0002\u093b\u093c\u0005\u01aa\u00d6\u0002\u093c\u0111", - "\u0003\u0002\u0002\u0002\u093d\u093e\u0005\u01ba\u00de\u0002\u093e\u093f", - "\u0005\u01aa\u00d6\u0002\u093f\u0113\u0003\u0002\u0002\u0002\u0940\u0941", - "\u0005\u0290\u0149\u0002\u0941\u0942\u0007\u0003\u0002\u0002\u0942\u0943", - "\u0005\u011a\u008e\u0002\u0943\u0944\u0007\u0004\u0002\u0002\u0944\u0949", - "\u0003\u0002\u0002\u0002\u0945\u0946\u0005\u022a\u0116\u0002\u0946\u0947", - "\u0005\u0140\u00a1\u0002\u0947\u0949\u0003\u0002\u0002\u0002\u0948\u0940", - "\u0003\u0002\u0002\u0002\u0948\u0945\u0003\u0002\u0002\u0002\u0949\u0115", - "\u0003\u0002\u0002\u0002\u094a\u094b\u0007\u0003\u0002\u0002\u094b\u094c", - "\u0005\u0118\u008d\u0002\u094c\u094d\u0007\u0004\u0002\u0002\u094d\u0117", - "\u0003\u0002\u0002\u0002\u094e\u0954\u0005\u0150\u00a9\u0002\u094f\u0950", - "\u0005\u02ac\u0157\u0002\u0950\u0951\u0005\u0150\u00a9\u0002\u0951\u0953", - "\u0003\u0002\u0002\u0002\u0952\u094f\u0003\u0002\u0002\u0002\u0953\u0956", - "\u0003\u0002\u0002\u0002\u0954\u0952\u0003\u0002\u0002\u0002\u0954\u0955", - "\u0003\u0002\u0002\u0002\u0955\u0119\u0003\u0002\u0002\u0002\u0956\u0954", - "\u0003\u0002\u0002\u0002\u0957\u095d\u0005\u011c\u008f\u0002\u0958\u0959", - "\u0005\u02ac\u0157\u0002\u0959\u095a\u0005\u011c\u008f\u0002\u095a\u095c", - "\u0003\u0002\u0002\u0002\u095b\u0958\u0003\u0002\u0002\u0002\u095c\u095f", - "\u0003\u0002\u0002\u0002\u095d\u095b\u0003\u0002\u0002\u0002\u095d\u095e", - "\u0003\u0002\u0002\u0002\u095e\u011b\u0003\u0002\u0002\u0002\u095f\u095d", - "\u0003\u0002\u0002\u0002\u0960\u0967\u0005\u0140\u00a1\u0002\u0961\u0967", - "\u0005\u00fe\u0080\u0002\u0962\u0967\u0005\u00fc\u007f\u0002\u0963\u0967", - "\u0005\u0102\u0082\u0002\u0964\u0967\u0005\u0104\u0083\u0002\u0965\u0967", - "\u0005\u0100\u0081\u0002\u0966\u0960\u0003\u0002\u0002\u0002\u0966\u0961", - "\u0003\u0002\u0002\u0002\u0966\u0962\u0003\u0002\u0002\u0002\u0966\u0963", - "\u0003\u0002\u0002\u0002\u0966\u0964\u0003\u0002\u0002\u0002\u0966\u0965", - "\u0003\u0002\u0002\u0002\u0967\u011d\u0003\u0002\u0002\u0002\u0968\u096a", - "\u0005\u026a\u0136\u0002\u0969\u096b\u0005\u012e\u0098\u0002\u096a\u0969", - "\u0003\u0002\u0002\u0002\u096a\u096b\u0003\u0002\u0002\u0002\u096b\u096d", - "\u0003\u0002\u0002\u0002\u096c\u096e\u0005\u022a\u0116\u0002\u096d\u096c", - "\u0003\u0002\u0002\u0002\u096d\u096e\u0003\u0002\u0002\u0002\u096e\u096f", - "\u0003\u0002\u0002\u0002\u096f\u0970\u0005\u0130\u0099\u0002\u0970\u0972", - "\u0005\u0124\u0093\u0002\u0971\u0973\u0005\u012c\u0097\u0002\u0972\u0971", - "\u0003\u0002\u0002\u0002\u0972\u0973\u0003\u0002\u0002\u0002\u0973\u0975", - "\u0003\u0002\u0002\u0002\u0974\u0976\u0005\u0128\u0095\u0002\u0975\u0974", - "\u0003\u0002\u0002\u0002\u0975\u0976\u0003\u0002\u0002\u0002\u0976\u0978", - "\u0003\u0002\u0002\u0002\u0977\u0979\u0005\u0122\u0092\u0002\u0978\u0977", - "\u0003\u0002\u0002\u0002\u0978\u0979\u0003\u0002\u0002\u0002\u0979\u097b", - "\u0003\u0002\u0002\u0002\u097a\u097c\u0005\u0120\u0091\u0002\u097b\u097a", - "\u0003\u0002\u0002\u0002\u097b\u097c\u0003\u0002\u0002\u0002\u097c\u011f", - "\u0003\u0002\u0002\u0002\u097d\u097e\u0005\u017c\u00bf\u0002\u097e\u097f", - "\u0005\u01ac\u00d7\u0002\u097f\u0121\u0003\u0002\u0002\u0002\u0980\u0981", - "\u0005\u0236\u011c\u0002\u0981\u0982\u0005\u0142\u00a2\u0002\u0982\u0123", - "\u0003\u0002\u0002\u0002\u0983\u0984\u0005\u01b0\u00d9\u0002\u0984\u0985", - "\u0005\u0126\u0094\u0002\u0985\u0125\u0003\u0002\u0002\u0002\u0986\u098c", - "\u0005\u02b0\u0159\u0002\u0987\u0988\u0005\u02b0\u0159\u0002\u0988\u0989", - "\u0007\u0010\u0002\u0002\u0989\u098a\u0005\u02b0\u0159\u0002\u098a\u098c", - "\u0003\u0002\u0002\u0002\u098b\u0986\u0003\u0002\u0002\u0002\u098b\u0987", - "\u0003\u0002\u0002\u0002\u098c\u0127\u0003\u0002\u0002\u0002\u098d\u098e", - "\u0005\u0252\u012a\u0002\u098e\u098f\u0005\u018e\u00c8\u0002\u098f\u0990", - "\u0005\u012a\u0096\u0002\u0990\u0129\u0003\u0002\u0002\u0002\u0991\u0994", - "\u0005\u02b0\u0159\u0002\u0992\u0995\u0005\u0186\u00c4\u0002\u0993\u0995", - "\u0005\u019c\u00cf\u0002\u0994\u0992\u0003\u0002\u0002\u0002\u0994\u0993", - "\u0003\u0002\u0002\u0002\u0994\u0995\u0003\u0002\u0002\u0002\u0995\u012b", - "\u0003\u0002\u0002\u0002\u0996\u0997\u0005\u0294\u014b\u0002\u0997\u0998", - "\u0005\u0134\u009b\u0002\u0998\u012d\u0003\u0002\u0002\u0002\u0999\u099a", - "\u0005\u01a0\u00d1\u0002\u099a\u012f\u0003\u0002\u0002\u0002\u099b\u099e", - "\u0007\u0011\u0002\u0002\u099c\u099e\u0005\u0132\u009a\u0002\u099d\u099b", - "\u0003\u0002\u0002\u0002\u099d\u099c\u0003\u0002\u0002\u0002\u099e\u09a4", - "\u0003\u0002\u0002\u0002\u099f\u09a0\u0005\u02ac\u0157\u0002\u09a0\u09a1", - "\u0005\u0132\u009a\u0002\u09a1\u09a3\u0003\u0002\u0002\u0002\u09a2\u099f", - "\u0003\u0002\u0002\u0002\u09a3\u09a6\u0003\u0002\u0002\u0002\u09a4\u09a2", - "\u0003\u0002\u0002\u0002\u09a4\u09a5\u0003\u0002\u0002\u0002\u09a5\u0131", - "\u0003\u0002\u0002\u0002\u09a6\u09a4\u0003\u0002\u0002\u0002\u09a7\u09a8", - "\u0005\u02b0\u0159\u0002\u09a8\u09a9\u0007\u0010\u0002\u0002\u09a9\u09aa", - "\u0007\u0011\u0002\u0002\u09aa\u09b8\u0003\u0002\u0002\u0002\u09ab\u09af", - "\u0005\u02b0\u0159\u0002\u09ac\u09ad\u0005\u0184\u00c3\u0002\u09ad\u09ae", - "\u0005\u02b0\u0159\u0002\u09ae\u09b0\u0003\u0002\u0002\u0002\u09af\u09ac", - "\u0003\u0002\u0002\u0002\u09af\u09b0\u0003\u0002\u0002\u0002\u09b0\u09b8", - "\u0003\u0002\u0002\u0002\u09b1\u09b5\u0005\u013c\u009f\u0002\u09b2\u09b3", - "\u0005\u0184\u00c3\u0002\u09b3\u09b4\u0005\u02b0\u0159\u0002\u09b4\u09b6", - "\u0003\u0002\u0002\u0002\u09b5\u09b2\u0003\u0002\u0002\u0002\u09b5\u09b6", - "\u0003\u0002\u0002\u0002\u09b6\u09b8\u0003\u0002\u0002\u0002\u09b7\u09a7", - "\u0003\u0002\u0002\u0002\u09b7\u09ab\u0003\u0002\u0002\u0002\u09b7\u09b1", - "\u0003\u0002\u0002\u0002\u09b8\u0133\u0003\u0002\u0002\u0002\u09b9\u09bf", - "\u0005\u0136\u009c\u0002\u09ba\u09bb\u0005\u0180\u00c1\u0002\u09bb\u09bc", - "\u0005\u0136\u009c\u0002\u09bc\u09be\u0003\u0002\u0002\u0002\u09bd\u09ba", - "\u0003\u0002\u0002\u0002\u09be\u09c1\u0003\u0002\u0002\u0002\u09bf\u09bd", - "\u0003\u0002\u0002\u0002\u09bf\u09c0\u0003\u0002\u0002\u0002\u09c0\u0135", - "\u0003\u0002\u0002\u0002\u09c1\u09bf\u0003\u0002\u0002\u0002\u09c2\u09c3", - "\u0005\u02b0\u0159\u0002\u09c3\u09c4\t\u0004\u0002\u0002\u09c4\u09c5", - "\u0005\u0140\u00a1\u0002\u09c5\u0a0c\u0003\u0002\u0002\u0002\u09c6\u09c7", - "\u0005\u02b0\u0159\u0002\u09c7\u09c8\u0007\u0010\u0002\u0002\u09c8\u09c9", - "\u0005\u02b0\u0159\u0002\u09c9\u09ca\t\u0004\u0002\u0002\u09ca\u09cb", - "\u0005\u0140\u00a1\u0002\u09cb\u0a0c\u0003\u0002\u0002\u0002\u09cc\u09cd", - "\u0005\u013c\u009f\u0002\u09cd\u09ce\t\u0004\u0002\u0002\u09ce\u09cf", - "\u0005\u0140\u00a1\u0002\u09cf\u0a0c\u0003\u0002\u0002\u0002\u09d0\u09d1", - "\u0005\u013c\u009f\u0002\u09d1\u09d2\t\u0004\u0002\u0002\u09d2\u09d3", - "\u0005\u013c\u009f\u0002\u09d3\u0a0c\u0003\u0002\u0002\u0002\u09d4\u09d5", - "\u0005\u02b0\u0159\u0002\u09d5\u09d6\u0005\u01bc\u00df\u0002\u09d6\u09d8", - "\u0007\u0003\u0002\u0002\u09d7\u09d9\u0005\u013e\u00a0\u0002\u09d8\u09d7", - "\u0003\u0002\u0002\u0002\u09d8\u09d9\u0003\u0002\u0002\u0002\u09d9\u09da", - "\u0003\u0002\u0002\u0002\u09da\u09db\u0007\u0004\u0002\u0002\u09db\u0a0c", - "\u0003\u0002\u0002\u0002\u09dc\u09dd\u0007\u0003\u0002\u0002\u09dd\u09e3", - "\u0005\u02b0\u0159\u0002\u09de\u09df\u0005\u02ac\u0157\u0002\u09df\u09e0", - "\u0005\u02b0\u0159\u0002\u09e0\u09e2\u0003\u0002\u0002\u0002\u09e1\u09de", - "\u0003\u0002\u0002\u0002\u09e2\u09e5\u0003\u0002\u0002\u0002\u09e3\u09e1", - "\u0003\u0002\u0002\u0002\u09e3\u09e4\u0003\u0002\u0002\u0002\u09e4\u09e6", - "\u0003\u0002\u0002\u0002\u09e5\u09e3\u0003\u0002\u0002\u0002\u09e6\u09e7", - "\u0007\u0004\u0002\u0002\u09e7\u09e8\u0005\u01bc\u00df\u0002\u09e8\u09e9", - "\u0007\u0003\u0002\u0002\u09e9\u09ef\u0005\u0104\u0083\u0002\u09ea\u09eb", - "\u0005\u02ac\u0157\u0002\u09eb\u09ec\u0005\u0104\u0083\u0002\u09ec\u09ee", - "\u0003\u0002\u0002\u0002\u09ed\u09ea\u0003\u0002\u0002\u0002\u09ee\u09f1", - "\u0003\u0002\u0002\u0002\u09ef\u09ed\u0003\u0002\u0002\u0002\u09ef\u09f0", - "\u0003\u0002\u0002\u0002\u09f0\u09f2\u0003\u0002\u0002\u0002\u09f1\u09ef", - "\u0003\u0002\u0002\u0002\u09f2\u09f3\u0007\u0004\u0002\u0002\u09f3\u0a0c", - "\u0003\u0002\u0002\u0002\u09f4\u09f5\u0007\u0003\u0002\u0002\u09f5\u09fb", - "\u0005\u02b0\u0159\u0002\u09f6\u09f7\u0005\u02ac\u0157\u0002\u09f7\u09f8", - "\u0005\u02b0\u0159\u0002\u09f8\u09fa\u0003\u0002\u0002\u0002\u09f9\u09f6", - "\u0003\u0002\u0002\u0002\u09fa\u09fd\u0003\u0002\u0002\u0002\u09fb\u09f9", - "\u0003\u0002\u0002\u0002\u09fb\u09fc\u0003\u0002\u0002\u0002\u09fc\u09fe", - "\u0003\u0002\u0002\u0002\u09fd\u09fb\u0003\u0002\u0002\u0002\u09fe\u09ff", - "\u0007\u0004\u0002\u0002\u09ff\u0a00\t\u0004\u0002\u0002\u0a00\u0a06", - "\u0005\u0104\u0083\u0002\u0a01\u0a02\u0005\u02ac\u0157\u0002\u0a02\u0a03", - "\u0005\u0104\u0083\u0002\u0a03\u0a05\u0003\u0002\u0002\u0002\u0a04\u0a01", - "\u0003\u0002\u0002\u0002\u0a05\u0a08\u0003\u0002\u0002\u0002\u0a06\u0a04", - "\u0003\u0002\u0002\u0002\u0a06\u0a07\u0003\u0002\u0002\u0002\u0a07\u0a0c", - "\u0003\u0002\u0002\u0002\u0a08\u0a06\u0003\u0002\u0002\u0002\u0a09\u0a0c", - "\u0005\u013a\u009e\u0002\u0a0a\u0a0c\u0005\u0138\u009d\u0002\u0a0b\u09c2", - "\u0003\u0002\u0002\u0002\u0a0b\u09c6\u0003\u0002\u0002\u0002\u0a0b\u09cc", - "\u0003\u0002\u0002\u0002\u0a0b\u09d0\u0003\u0002\u0002\u0002\u0a0b\u09d4", - "\u0003\u0002\u0002\u0002\u0a0b\u09dc\u0003\u0002\u0002\u0002\u0a0b\u09f4", - "\u0003\u0002\u0002\u0002\u0a0b\u0a09\u0003\u0002\u0002\u0002\u0a0b\u0a0a", - "\u0003\u0002\u0002\u0002\u0a0c\u0137\u0003\u0002\u0002\u0002\u0a0d\u0a0e", - "\u0005\u02b0\u0159\u0002\u0a0e\u0a0f\u0005\u0196\u00cc\u0002\u0a0f\u0a10", - "\u0005\u0140\u00a1\u0002\u0a10\u0139\u0003\u0002\u0002\u0002\u0a11\u0a12", - "\u0005\u02b0\u0159\u0002\u0a12\u0a13\u0005\u0196\u00cc\u0002\u0a13\u0a14", - "\u0005\u022c\u0117\u0002\u0a14\u0a15\u0003\u0002\u0002\u0002\u0a15\u0a16", - "\u0005\u0140\u00a1\u0002\u0a16\u013b\u0003\u0002\u0002\u0002\u0a17\u0a18", - "\u0005\u02b0\u0159\u0002\u0a18\u0a19\u0007\u0003\u0002\u0002\u0a19\u0a1a", - "\u0007\u0011\u0002\u0002\u0a1a\u0a1b\u0007\u0004\u0002\u0002\u0a1b\u0a24", - "\u0003\u0002\u0002\u0002\u0a1c\u0a1d\u0005\u02b0\u0159\u0002\u0a1d\u0a1f", - "\u0007\u0003\u0002\u0002\u0a1e\u0a20\u0005\u013e\u00a0\u0002\u0a1f\u0a1e", - "\u0003\u0002\u0002\u0002\u0a1f\u0a20\u0003\u0002\u0002\u0002\u0a20\u0a21", - "\u0003\u0002\u0002\u0002\u0a21\u0a22\u0007\u0004\u0002\u0002\u0a22\u0a24", - "\u0003\u0002\u0002\u0002\u0a23\u0a17\u0003\u0002\u0002\u0002\u0a23\u0a1c", - "\u0003\u0002\u0002\u0002\u0a24\u013d\u0003\u0002\u0002\u0002\u0a25\u0a29", - "\u0005\u0140\u00a1\u0002\u0a26\u0a29\u0005\u02b0\u0159\u0002\u0a27\u0a29", - "\u0005\u013c\u009f\u0002\u0a28\u0a25\u0003\u0002\u0002\u0002\u0a28\u0a26", - "\u0003\u0002\u0002\u0002\u0a28\u0a27\u0003\u0002\u0002\u0002\u0a29\u0a32", - "\u0003\u0002\u0002\u0002\u0a2a\u0a2e\u0005\u02ac\u0157\u0002\u0a2b\u0a2f", - "\u0005\u0140\u00a1\u0002\u0a2c\u0a2f\u0005\u02b0\u0159\u0002\u0a2d\u0a2f", - "\u0005\u013c\u009f\u0002\u0a2e\u0a2b\u0003\u0002\u0002\u0002\u0a2e\u0a2c", - "\u0003\u0002\u0002\u0002\u0a2e\u0a2d\u0003\u0002\u0002\u0002\u0a2f\u0a31", - "\u0003\u0002\u0002\u0002\u0a30\u0a2a\u0003\u0002\u0002\u0002\u0a31\u0a34", - "\u0003\u0002\u0002\u0002\u0a32\u0a30\u0003\u0002\u0002\u0002\u0a32\u0a33", - "\u0003\u0002\u0002\u0002\u0a33\u013f\u0003\u0002\u0002\u0002\u0a34\u0a32", - "\u0003\u0002\u0002\u0002\u0a35\u0a3f\u0007\u00dd\u0002\u0002\u0a36\u0a3f", - "\u0005\u0146\u00a4\u0002\u0a37\u0a3f\u0005\u0142\u00a2\u0002\u0a38\u0a3f", - "\u0005\u0144\u00a3\u0002\u0a39\u0a3f\u0005\u014a\u00a6\u0002\u0a3a\u0a3f", - "\u0005\u0148\u00a5\u0002\u0a3b\u0a3f\u00052\u001a\u0002\u0a3c\u0a3f", - "\u0005\u0248\u0125\u0002\u0a3d\u0a3f\u0005\u02b0\u0159\u0002\u0a3e\u0a35", - "\u0003\u0002\u0002\u0002\u0a3e\u0a36\u0003\u0002\u0002\u0002\u0a3e\u0a37", - "\u0003\u0002\u0002\u0002\u0a3e\u0a38\u0003\u0002\u0002\u0002\u0a3e\u0a39", - "\u0003\u0002\u0002\u0002\u0a3e\u0a3a\u0003\u0002\u0002\u0002\u0a3e\u0a3b", - "\u0003\u0002\u0002\u0002\u0a3e\u0a3c\u0003\u0002\u0002\u0002\u0a3e\u0a3d", - "\u0003\u0002\u0002\u0002\u0a3f\u0141\u0003\u0002\u0002\u0002\u0a40\u0a41", - "\u0007\u00d8\u0002\u0002\u0a41\u0143\u0003\u0002\u0002\u0002\u0a42\u0a43", - "\t\u0005\u0002\u0002\u0a43\u0145\u0003\u0002\u0002\u0002\u0a44\u0a45", - "\u0007\u00d7\u0002\u0002\u0a45\u0147\u0003\u0002\u0002\u0002\u0a46\u0a47", - "\t\u0006\u0002\u0002\u0a47\u0149\u0003\u0002\u0002\u0002\u0a48\u0a49", - "\u0007\u00da\u0002\u0002\u0a49\u014b\u0003\u0002\u0002\u0002\u0a4a\u0a50", - "\u0005\u02b0\u0159\u0002\u0a4b\u0a4c\u0007\u0017\u0002\u0002\u0a4c\u0a4d", - "\u0005\u02b0\u0159\u0002\u0a4d\u0a4e\u0007\u0017\u0002\u0002\u0a4e\u0a50", - "\u0003\u0002\u0002\u0002\u0a4f\u0a4a\u0003\u0002\u0002\u0002\u0a4f\u0a4b", - "\u0003\u0002\u0002\u0002\u0a50\u014d\u0003\u0002\u0002\u0002\u0a51\u0a57", - "\u0005\u02b0\u0159\u0002\u0a52\u0a53\u0007\u0017\u0002\u0002\u0a53\u0a54", - "\u0005\u02b0\u0159\u0002\u0a54\u0a55\u0007\u0017\u0002\u0002\u0a55\u0a57", - "\u0003\u0002\u0002\u0002\u0a56\u0a51\u0003\u0002\u0002\u0002\u0a56\u0a52", - "\u0003\u0002\u0002\u0002\u0a57\u014f\u0003\u0002\u0002\u0002\u0a58\u0a5e", - "\u0005\u02b0\u0159\u0002\u0a59\u0a5a\u0007\u0017\u0002\u0002\u0a5a\u0a5b", - "\u0005\u02b0\u0159\u0002\u0a5b\u0a5c\u0007\u0017\u0002\u0002\u0a5c\u0a5e", - "\u0003\u0002\u0002\u0002\u0a5d\u0a58\u0003\u0002\u0002\u0002\u0a5d\u0a59", - "\u0003\u0002\u0002\u0002\u0a5e\u0151\u0003\u0002\u0002\u0002\u0a5f\u0a61", - "\u0005\u0154\u00ab\u0002\u0a60\u0a62\u0005\u0156\u00ac\u0002\u0a61\u0a60", - "\u0003\u0002\u0002\u0002\u0a61\u0a62\u0003\u0002\u0002\u0002\u0a62\u0153", - "\u0003\u0002\u0002\u0002\u0a63\u0a64\u0005\u014c\u00a7\u0002\u0a64\u0a65", - "\u0007\u0010\u0002\u0002\u0a65\u0a67\u0003\u0002\u0002\u0002\u0a66\u0a63", - "\u0003\u0002\u0002\u0002\u0a66\u0a67\u0003\u0002\u0002\u0002\u0a67\u0a68", - "\u0003\u0002\u0002\u0002\u0a68\u0a86\u0005\u0162\u00b2\u0002\u0a69\u0a86", - "\u0007\u00d7\u0002\u0002\u0a6a\u0a86\u0007\u007f\u0002\u0002\u0a6b\u0a86", - "\u0007w\u0002\u0002\u0a6c\u0a86\u0007\u0093\u0002\u0002\u0a6d\u0a86", - "\u0007\u00c1\u0002\u0002\u0a6e\u0a86\u0007\u00c2\u0002\u0002\u0a6f\u0a86", - "\u0007\u00c3\u0002\u0002\u0a70\u0a86\u0007\u00c4\u0002\u0002\u0a71\u0a86", - "\u0007\u00c5\u0002\u0002\u0a72\u0a86\u0007\u00c6\u0002\u0002\u0a73\u0a86", - "\u0007\u00c7\u0002\u0002\u0a74\u0a86\u0007\u00c8\u0002\u0002\u0a75\u0a86", - "\u0007\u00c9\u0002\u0002\u0a76\u0a86\u0007\u00ca\u0002\u0002\u0a77\u0a86", - "\u0007\u00cb\u0002\u0002\u0a78\u0a86\u0007\u00cc\u0002\u0002\u0a79\u0a86", - "\u0007\u00cd\u0002\u0002\u0a7a\u0a86\u0007\u00ce\u0002\u0002\u0a7b\u0a86", - "\u0007\u00cf\u0002\u0002\u0a7c\u0a86\u0007\u00d1\u0002\u0002\u0a7d\u0a86", - "\u0007\u00d0\u0002\u0002\u0a7e\u0a86\u0007\u00d2\u0002\u0002\u0a7f\u0a86", - "\u0007\u00d3\u0002\u0002\u0a80\u0a86\u0007\u00d4\u0002\u0002\u0a81\u0a86", - "\u0007\u00d5\u0002\u0002\u0a82\u0a86\u0007\u007f\u0002\u0002\u0a83\u0a86", - "\u0007\u008d\u0002\u0002\u0a84\u0a86\u0007\u00e4\u0002\u0002\u0a85\u0a66", - "\u0003\u0002\u0002\u0002\u0a85\u0a69\u0003\u0002\u0002\u0002\u0a85\u0a6a", - "\u0003\u0002\u0002\u0002\u0a85\u0a6b\u0003\u0002\u0002\u0002\u0a85\u0a6c", - "\u0003\u0002\u0002\u0002\u0a85\u0a6d\u0003\u0002\u0002\u0002\u0a85\u0a6e", - "\u0003\u0002\u0002\u0002\u0a85\u0a6f\u0003\u0002\u0002\u0002\u0a85\u0a70", - "\u0003\u0002\u0002\u0002\u0a85\u0a71\u0003\u0002\u0002\u0002\u0a85\u0a72", - "\u0003\u0002\u0002\u0002\u0a85\u0a73\u0003\u0002\u0002\u0002\u0a85\u0a74", - "\u0003\u0002\u0002\u0002\u0a85\u0a75\u0003\u0002\u0002\u0002\u0a85\u0a76", - "\u0003\u0002\u0002\u0002\u0a85\u0a77\u0003\u0002\u0002\u0002\u0a85\u0a78", - "\u0003\u0002\u0002\u0002\u0a85\u0a79\u0003\u0002\u0002\u0002\u0a85\u0a7a", - "\u0003\u0002\u0002\u0002\u0a85\u0a7b\u0003\u0002\u0002\u0002\u0a85\u0a7c", - "\u0003\u0002\u0002\u0002\u0a85\u0a7d\u0003\u0002\u0002\u0002\u0a85\u0a7e", - "\u0003\u0002\u0002\u0002\u0a85\u0a7f\u0003\u0002\u0002\u0002\u0a85\u0a80", - "\u0003\u0002\u0002\u0002\u0a85\u0a81\u0003\u0002\u0002\u0002\u0a85\u0a82", - "\u0003\u0002\u0002\u0002\u0a85\u0a83\u0003\u0002\u0002\u0002\u0a85\u0a84", - "\u0003\u0002\u0002\u0002\u0a86\u0155\u0003\u0002\u0002\u0002\u0a87\u0a88", - "\u0005\u02a4\u0153\u0002\u0a88\u0a90\u0005\u0152\u00aa\u0002\u0a89\u0a8c", - "\u0005\u02ac\u0157\u0002\u0a8a\u0a8d\u0005\u0152\u00aa\u0002\u0a8b\u0a8d", - "\u0005\u0142\u00a2\u0002\u0a8c\u0a8a\u0003\u0002\u0002\u0002\u0a8c\u0a8b", - "\u0003\u0002\u0002\u0002\u0a8d\u0a8f\u0003\u0002\u0002\u0002\u0a8e\u0a89", - "\u0003\u0002\u0002\u0002\u0a8f\u0a92\u0003\u0002\u0002\u0002\u0a90\u0a8e", - "\u0003\u0002\u0002\u0002\u0a90\u0a91\u0003\u0002\u0002\u0002\u0a91\u0a93", - "\u0003\u0002\u0002\u0002\u0a92\u0a90\u0003\u0002\u0002\u0002\u0a93\u0a94", - "\u0005\u02a6\u0154\u0002\u0a94\u0157\u0003\u0002\u0002\u0002\u0a95\u0a98", - "\u0005\u0186\u00c4\u0002\u0a96\u0a98\u0005\u019c\u00cf\u0002\u0a97\u0a95", - "\u0003\u0002\u0002\u0002\u0a97\u0a96\u0003\u0002\u0002\u0002\u0a98\u0159", - "\u0003\u0002\u0002\u0002\u0a99\u0a9a\u0005\u02b0\u0159\u0002\u0a9a\u015b", - "\u0003\u0002\u0002\u0002\u0a9b\u0a9c\u0005\u02b0\u0159\u0002\u0a9c\u015d", - "\u0003\u0002\u0002\u0002\u0a9d\u0a9e\u0005\u0146\u00a4\u0002\u0a9e\u015f", - "\u0003\u0002\u0002\u0002\u0a9f\u0aa0\u0005\u02b0\u0159\u0002\u0aa0\u0161", - "\u0003\u0002\u0002\u0002\u0aa1\u0aa2\u0005\u02b0\u0159\u0002\u0aa2\u0163", - "\u0003\u0002\u0002\u0002\u0aa3\u0aa4\u0005\u02b0\u0159\u0002\u0aa4\u0165", - "\u0003\u0002\u0002\u0002\u0aa5\u0aa6\u0005\u02b0\u0159\u0002\u0aa6\u0167", - "\u0003\u0002\u0002\u0002\u0aa7\u0aa8\u0005\u02b0\u0159\u0002\u0aa8\u0169", - "\u0003\u0002\u0002\u0002\u0aa9\u0aaa\u0005\u02b0\u0159\u0002\u0aaa\u016b", - "\u0003\u0002\u0002\u0002\u0aab\u0aac\u0005\u0146\u00a4\u0002\u0aac\u016d", - "\u0003\u0002\u0002\u0002\u0aad\u0aae\u0005\u02b0\u0159\u0002\u0aae\u016f", - "\u0003\u0002\u0002\u0002\u0aaf\u0ab0\u0005\u0172\u00ba\u0002\u0ab0\u0ab1", - "\u0005\u0152\u00aa\u0002\u0ab1\u0171\u0003\u0002\u0002\u0002\u0ab2\u0ab3", - "\u0005\u02b0\u0159\u0002\u0ab3\u0173\u0003\u0002\u0002\u0002\u0ab4\u0ab5", - "\u0007\u0019\u0002\u0002\u0ab5\u0175\u0003\u0002\u0002\u0002\u0ab6\u0ab7", - "\u0007\u001a\u0002\u0002\u0ab7\u0177\u0003\u0002\u0002\u0002\u0ab8\u0ab9", - "\u0007\u001b\u0002\u0002\u0ab9\u0179\u0003\u0002\u0002\u0002\u0aba\u0abb", - "\u0007\u001b\u0002\u0002\u0abb\u0abc\u0007h\u0002\u0002\u0abc\u017b", - "\u0003\u0002\u0002\u0002\u0abd\u0abe\u0007\u001c\u0002\u0002\u0abe\u017d", - "\u0003\u0002\u0002\u0002\u0abf\u0ac0\u0007\u001d\u0002\u0002\u0ac0\u017f", - "\u0003\u0002\u0002\u0002\u0ac1\u0ac2\u0007\u001e\u0002\u0002\u0ac2\u0181", - "\u0003\u0002\u0002\u0002\u0ac3\u0ac4\u0007 \u0002\u0002\u0ac4\u0183", - "\u0003\u0002\u0002\u0002\u0ac5\u0ac6\u0007!\u0002\u0002\u0ac6\u0185", - '\u0003\u0002\u0002\u0002\u0ac7\u0ac8\u0007"\u0002\u0002\u0ac8\u0187', - "\u0003\u0002\u0002\u0002\u0ac9\u0aca\u0007#\u0002\u0002\u0aca\u0189", - "\u0003\u0002\u0002\u0002\u0acb\u0acc\u0007$\u0002\u0002\u0acc\u018b", - "\u0003\u0002\u0002\u0002\u0acd\u0ace\u0007%\u0002\u0002\u0ace\u018d", - "\u0003\u0002\u0002\u0002\u0acf\u0ad0\u0007&\u0002\u0002\u0ad0\u018f", - "\u0003\u0002\u0002\u0002\u0ad1\u0ad2\u0007'\u0002\u0002\u0ad2\u0191", - "\u0003\u0002\u0002\u0002\u0ad3\u0ad4\u0007(\u0002\u0002\u0ad4\u0193", - "\u0003\u0002\u0002\u0002\u0ad5\u0ad6\u0007*\u0002\u0002\u0ad6\u0195", - "\u0003\u0002\u0002\u0002\u0ad7\u0ad8\u0007,\u0002\u0002\u0ad8\u0197", - "\u0003\u0002\u0002\u0002\u0ad9\u0ada\u0007-\u0002\u0002\u0ada\u0199", - "\u0003\u0002\u0002\u0002\u0adb\u0adc\u00070\u0002\u0002\u0adc\u019b", - "\u0003\u0002\u0002\u0002\u0add\u0ade\u00071\u0002\u0002\u0ade\u019d", - "\u0003\u0002\u0002\u0002\u0adf\u0ae0\u00072\u0002\u0002\u0ae0\u019f", - "\u0003\u0002\u0002\u0002\u0ae1\u0ae2\u00073\u0002\u0002\u0ae2\u01a1", - "\u0003\u0002\u0002\u0002\u0ae3\u0ae4\u00074\u0002\u0002\u0ae4\u01a3", - "\u0003\u0002\u0002\u0002\u0ae5\u0ae6\u00075\u0002\u0002\u0ae6\u01a5", - "\u0003\u0002\u0002\u0002\u0ae7\u0ae8\u00077\u0002\u0002\u0ae8\u01a7", - "\u0003\u0002\u0002\u0002\u0ae9\u0aea\u00078\u0002\u0002\u0aea\u01a9", - "\u0003\u0002\u0002\u0002\u0aeb\u0aec\u00079\u0002\u0002\u0aec\u01ab", - "\u0003\u0002\u0002\u0002\u0aed\u0aee\u0007;\u0002\u0002\u0aee\u01ad", - "\u0003\u0002\u0002\u0002\u0aef\u0af0\u0007<\u0002\u0002\u0af0\u01af", - "\u0003\u0002\u0002\u0002\u0af1\u0af2\u0007=\u0002\u0002\u0af2\u01b1", - "\u0003\u0002\u0002\u0002\u0af3\u0af4\u0007>\u0002\u0002\u0af4\u01b3", - "\u0003\u0002\u0002\u0002\u0af5\u0af6\u0007?\u0002\u0002\u0af6\u01b5", - "\u0003\u0002\u0002\u0002\u0af7\u0af8\u0007@\u0002\u0002\u0af8\u01b7", - "\u0003\u0002\u0002\u0002\u0af9\u0afa\u0007A\u0002\u0002\u0afa\u01b9", - "\u0003\u0002\u0002\u0002\u0afb\u0afc\u0007B\u0002\u0002\u0afc\u01bb", - "\u0003\u0002\u0002\u0002\u0afd\u0afe\u0007C\u0002\u0002\u0afe\u01bd", - "\u0003\u0002\u0002\u0002\u0aff\u0b00\u0007D\u0002\u0002\u0b00\u01bf", - "\u0003\u0002\u0002\u0002\u0b01\u0b02\u0007.\u0002\u0002\u0b02\u01c1", - "\u0003\u0002\u0002\u0002\u0b03\u0b04\u0007/\u0002\u0002\u0b04\u01c3", - "\u0003\u0002\u0002\u0002\u0b05\u0b06\u0007\u0093\u0002\u0002\u0b06\u01c5", - "\u0003\u0002\u0002\u0002\u0b07\u0b08\u0007\u0095\u0002\u0002\u0b08\u01c7", - "\u0003\u0002\u0002\u0002\u0b09\u0b0a\u0007\u0097\u0002\u0002\u0b0a\u01c9", - "\u0003\u0002\u0002\u0002\u0b0b\u0b0c\u0007\u0098\u0002\u0002\u0b0c\u01cb", - "\u0003\u0002\u0002\u0002\u0b0d\u0b0e\u0007\u0099\u0002\u0002\u0b0e\u01cd", - "\u0003\u0002\u0002\u0002\u0b0f\u0b10\u0007\u009a\u0002\u0002\u0b10\u01cf", - "\u0003\u0002\u0002\u0002\u0b11\u0b12\u0007\u009b\u0002\u0002\u0b12\u01d1", - "\u0003\u0002\u0002\u0002\u0b13\u0b14\u0007\u009c\u0002\u0002\u0b14\u01d3", - "\u0003\u0002\u0002\u0002\u0b15\u0b16\u0007\u009d\u0002\u0002\u0b16\u01d5", - "\u0003\u0002\u0002\u0002\u0b17\u0b18\u0007\u009e\u0002\u0002\u0b18\u01d7", - "\u0003\u0002\u0002\u0002\u0b19\u0b1a\u0007\u009f\u0002\u0002\u0b1a\u01d9", - "\u0003\u0002\u0002\u0002\u0b1b\u0b1c\u0007\u00a0\u0002\u0002\u0b1c\u01db", - "\u0003\u0002\u0002\u0002\u0b1d\u0b1e\u0007\u00a1\u0002\u0002\u0b1e\u01dd", - "\u0003\u0002\u0002\u0002\u0b1f\u0b20\u0007\u00a2\u0002\u0002\u0b20\u01df", - "\u0003\u0002\u0002\u0002\u0b21\u0b22\u0007\u00a3\u0002\u0002\u0b22\u01e1", - "\u0003\u0002\u0002\u0002\u0b23\u0b24\u0007\u00a5\u0002\u0002\u0b24\u01e3", - "\u0003\u0002\u0002\u0002\u0b25\u0b26\u0007\u00a4\u0002\u0002\u0b26\u01e5", - "\u0003\u0002\u0002\u0002\u0b27\u0b28\u0007\u00a6\u0002\u0002\u0b28\u01e7", - "\u0003\u0002\u0002\u0002\u0b29\u0b2a\u0007\u00a7\u0002\u0002\u0b2a\u01e9", - "\u0003\u0002\u0002\u0002\u0b2b\u0b2c\u0007\u00a8\u0002\u0002\u0b2c\u01eb", - "\u0003\u0002\u0002\u0002\u0b2d\u0b2e\u0007\u00a9\u0002\u0002\u0b2e\u01ed", - "\u0003\u0002\u0002\u0002\u0b2f\u0b30\u0007\u00ab\u0002\u0002\u0b30\u01ef", - "\u0003\u0002\u0002\u0002\u0b31\u0b32\u0007\u00aa\u0002\u0002\u0b32\u01f1", - "\u0003\u0002\u0002\u0002\u0b33\u0b34\u0007\u00ac\u0002\u0002\u0b34\u01f3", - "\u0003\u0002\u0002\u0002\u0b35\u0b36\u0007\u00ad\u0002\u0002\u0b36\u01f5", - "\u0003\u0002\u0002\u0002\u0b37\u0b38\u0007\u00ae\u0002\u0002\u0b38\u01f7", - "\u0003\u0002\u0002\u0002\u0b39\u0b3a\u0007\u00af\u0002\u0002\u0b3a\u01f9", - "\u0003\u0002\u0002\u0002\u0b3b\u0b3c\u0007\u00b0\u0002\u0002\u0b3c\u01fb", - "\u0003\u0002\u0002\u0002\u0b3d\u0b3e\u0007\u00b1\u0002\u0002\u0b3e\u01fd", - "\u0003\u0002\u0002\u0002\u0b3f\u0b40\u0007\u00b2\u0002\u0002\u0b40\u01ff", - "\u0003\u0002\u0002\u0002\u0b41\u0b42\u0007\u00b3\u0002\u0002\u0b42\u0201", - "\u0003\u0002\u0002\u0002\u0b43\u0b44\u0007\u00b4\u0002\u0002\u0b44\u0203", - "\u0003\u0002\u0002\u0002\u0b45\u0b46\u0007\u00b5\u0002\u0002\u0b46\u0205", - "\u0003\u0002\u0002\u0002\u0b47\u0b48\u0007\u00b6\u0002\u0002\u0b48\u0207", - "\u0003\u0002\u0002\u0002\u0b49\u0b4a\u0007\u00b7\u0002\u0002\u0b4a\u0209", - "\u0003\u0002\u0002\u0002\u0b4b\u0b4c\u0007\u00b8\u0002\u0002\u0b4c\u020b", - "\u0003\u0002\u0002\u0002\u0b4d\u0b4e\u0007\u00b9\u0002\u0002\u0b4e\u020d", - "\u0003\u0002\u0002\u0002\u0b4f\u0b50\u0007\u00ba\u0002\u0002\u0b50\u020f", - "\u0003\u0002\u0002\u0002\u0b51\u0b52\u0007\u00bb\u0002\u0002\u0b52\u0211", - "\u0003\u0002\u0002\u0002\u0b53\u0b54\u0007\u00bc\u0002\u0002\u0b54\u0213", - "\u0003\u0002\u0002\u0002\u0b55\u0b56\u0007\u00bd\u0002\u0002\u0b56\u0215", - "\u0003\u0002\u0002\u0002\u0b57\u0b58\u0007\u00be\u0002\u0002\u0b58\u0217", - "\u0003\u0002\u0002\u0002\u0b59\u0b5a\u0007\u00bf\u0002\u0002\u0b5a\u0219", - "\u0003\u0002\u0002\u0002\u0b5b\u0b5c\u0007\u00c0\u0002\u0002\u0b5c\u021b", - "\u0003\u0002\u0002\u0002\u0b5d\u0b5e\u0007\u0094\u0002\u0002\u0b5e\u021d", - "\u0003\u0002\u0002\u0002\u0b5f\u0b60\u0007\u0096\u0002\u0002\u0b60\u021f", - "\u0003\u0002\u0002\u0002\u0b61\u0b62\u0007F\u0002\u0002\u0b62\u0221", - "\u0003\u0002\u0002\u0002\u0b63\u0b64\u0007G\u0002\u0002\u0b64\u0223", - "\u0003\u0002\u0002\u0002\u0b65\u0b66\u0007H\u0002\u0002\u0b66\u0225", - "\u0003\u0002\u0002\u0002\u0b67\u0b68\u0007I\u0002\u0002\u0b68\u0227", - "\u0003\u0002\u0002\u0002\u0b69\u0b6a\u0007J\u0002\u0002\u0b6a\u0229", - "\u0003\u0002\u0002\u0002\u0b6b\u0b6c\u0007K\u0002\u0002\u0b6c\u022b", - "\u0003\u0002\u0002\u0002\u0b6d\u0b6e\u0007L\u0002\u0002\u0b6e\u022d", - "\u0003\u0002\u0002\u0002\u0b6f\u0b70\u0007M\u0002\u0002\u0b70\u022f", - "\u0003\u0002\u0002\u0002\u0b71\u0b72\u0007N\u0002\u0002\u0b72\u0231", - "\u0003\u0002\u0002\u0002\u0b73\u0b74\u0007O\u0002\u0002\u0b74\u0233", - "\u0003\u0002\u0002\u0002\u0b75\u0b76\u0007P\u0002\u0002\u0b76\u0235", - "\u0003\u0002\u0002\u0002\u0b77\u0b78\u0007R\u0002\u0002\u0b78\u0237", - "\u0003\u0002\u0002\u0002\u0b79\u0b7a\u0007\u00cc\u0002\u0002\u0b7a\u0239", - "\u0003\u0002\u0002\u0002\u0b7b\u0b7c\u0007U\u0002\u0002\u0b7c\u023b", - "\u0003\u0002\u0002\u0002\u0b7d\u0b7e\u0007V\u0002\u0002\u0b7e\u023d", - "\u0003\u0002\u0002\u0002\u0b7f\u0b80\u0007W\u0002\u0002\u0b80\u023f", - "\u0003\u0002\u0002\u0002\u0b81\u0b82\u0007X\u0002\u0002\u0b82\u0241", - "\u0003\u0002\u0002\u0002\u0b83\u0b84\u0007[\u0002\u0002\u0b84\u0243", - "\u0003\u0002\u0002\u0002\u0b85\u0b86\u0007Z\u0002\u0002\u0b86\u0245", - "\u0003\u0002\u0002\u0002\u0b87\u0b88\u0007\\\u0002\u0002\u0b88\u0247", - "\u0003\u0002\u0002\u0002\u0b89\u0b8a\u0007]\u0002\u0002\u0b8a\u0249", - "\u0003\u0002\u0002\u0002\u0b8b\u0b8c\u0007^\u0002\u0002\u0b8c\u024b", - "\u0003\u0002\u0002\u0002\u0b8d\u0b8e\u0007_\u0002\u0002\u0b8e\u024d", - "\u0003\u0002\u0002\u0002\u0b8f\u0b90\u0007a\u0002\u0002\u0b90\u024f", - "\u0003\u0002\u0002\u0002\u0b91\u0b92\u0007b\u0002\u0002\u0b92\u0251", - "\u0003\u0002\u0002\u0002\u0b93\u0b94\u0007c\u0002\u0002\u0b94\u0253", - "\u0003\u0002\u0002\u0002\u0b95\u0b96\u0007e\u0002\u0002\u0b96\u0255", - "\u0003\u0002\u0002\u0002\u0b97\u0b98\u0007i\u0002\u0002\u0b98\u0257", - "\u0003\u0002\u0002\u0002\u0b99\u0b9a\u0007k\u0002\u0002\u0b9a\u0259", - "\u0003\u0002\u0002\u0002\u0b9b\u0b9c\u0007l\u0002\u0002\u0b9c\u025b", - "\u0003\u0002\u0002\u0002\u0b9d\u0b9e\u0007m\u0002\u0002\u0b9e\u025d", - "\u0003\u0002\u0002\u0002\u0b9f\u0ba0\u0007n\u0002\u0002\u0ba0\u025f", - "\u0003\u0002\u0002\u0002\u0ba1\u0ba2\u0007p\u0002\u0002\u0ba2\u0261", - "\u0003\u0002\u0002\u0002\u0ba3\u0ba4\u0007r\u0002\u0002\u0ba4\u0263", - "\u0003\u0002\u0002\u0002\u0ba5\u0ba6\u0007s\u0002\u0002\u0ba6\u0265", - "\u0003\u0002\u0002\u0002\u0ba7\u0ba8\u0007t\u0002\u0002\u0ba8\u0267", - "\u0003\u0002\u0002\u0002\u0ba9\u0baa\u0007q\u0002\u0002\u0baa\u0269", - "\u0003\u0002\u0002\u0002\u0bab\u0bac\u0007v\u0002\u0002\u0bac\u026b", - "\u0003\u0002\u0002\u0002\u0bad\u0bae\u0007w\u0002\u0002\u0bae\u026d", - "\u0003\u0002\u0002\u0002\u0baf\u0bb0\u0007x\u0002\u0002\u0bb0\u026f", - "\u0003\u0002\u0002\u0002\u0bb1\u0bb2\u0007z\u0002\u0002\u0bb2\u0271", - "\u0003\u0002\u0002\u0002\u0bb3\u0bb4\u0007{\u0002\u0002\u0bb4\u0273", - "\u0003\u0002\u0002\u0002\u0bb5\u0bb6\u0007|\u0002\u0002\u0bb6\u0275", - "\u0003\u0002\u0002\u0002\u0bb7\u0bb8\u0007}\u0002\u0002\u0bb8\u0277", - "\u0003\u0002\u0002\u0002\u0bb9\u0bba\u0007\u007f\u0002\u0002\u0bba\u0279", - "\u0003\u0002\u0002\u0002\u0bbb\u0bbc\u0007\u0080\u0002\u0002\u0bbc\u027b", - "\u0003\u0002\u0002\u0002\u0bbd\u0bbe\u0007\u0082\u0002\u0002\u0bbe\u027d", - "\u0003\u0002\u0002\u0002\u0bbf\u0bc0\u0007\u0084\u0002\u0002\u0bc0\u027f", - "\u0003\u0002\u0002\u0002\u0bc1\u0bc2\u0007\u0085\u0002\u0002\u0bc2\u0281", - "\u0003\u0002\u0002\u0002\u0bc3\u0bc4\u0007\u0087\u0002\u0002\u0bc4\u0283", - "\u0003\u0002\u0002\u0002\u0bc5\u0bc6\u0007\u0088\u0002\u0002\u0bc6\u0285", - "\u0003\u0002\u0002\u0002\u0bc7\u0bc8\u0007\u0089\u0002\u0002\u0bc8\u0287", - "\u0003\u0002\u0002\u0002\u0bc9\u0bca\u0007\u008a\u0002\u0002\u0bca\u0289", - "\u0003\u0002\u0002\u0002\u0bcb\u0bcc\u0007\u008b\u0002\u0002\u0bcc\u028b", - "\u0003\u0002\u0002\u0002\u0bcd\u0bce\u0007\u00e3\u0002\u0002\u0bce\u028d", - "\u0003\u0002\u0002\u0002\u0bcf\u0bd0\u0007\u008c\u0002\u0002\u0bd0\u028f", - "\u0003\u0002\u0002\u0002\u0bd1\u0bd2\u0007\u008e\u0002\u0002\u0bd2\u0291", - "\u0003\u0002\u0002\u0002\u0bd3\u0bd4\u0007\u008f\u0002\u0002\u0bd4\u0293", - "\u0003\u0002\u0002\u0002\u0bd5\u0bd6\u0007\u0090\u0002\u0002\u0bd6\u0295", - "\u0003\u0002\u0002\u0002\u0bd7\u0bd8\u0007\u0091\u0002\u0002\u0bd8\u0297", - "\u0003\u0002\u0002\u0002\u0bd9\u0bda\u0007o\u0002\u0002\u0bda\u0299", - "\u0003\u0002\u0002\u0002\u0bdb\u0bdc\u0007\u0002\u0002\u0003\u0bdc\u029b", - "\u0003\u0002\u0002\u0002\u0bdd\u0bde\u0007\u0003\u0002\u0002\u0bde\u029d", - "\u0003\u0002\u0002\u0002\u0bdf\u0be0\u0007\u0004\u0002\u0002\u0be0\u029f", - "\u0003\u0002\u0002\u0002\u0be1\u0be2\u0007\u0005\u0002\u0002\u0be2\u02a1", - "\u0003\u0002\u0002\u0002\u0be3\u0be4\u0007\u0006\u0002\u0002\u0be4\u02a3", - "\u0003\u0002\u0002\u0002\u0be5\u0be6\u0007\u00df\u0002\u0002\u0be6\u02a5", - "\u0003\u0002\u0002\u0002\u0be7\u0be8\u0007\u00e0\u0002\u0002\u0be8\u02a7", - "\u0003\u0002\u0002\u0002\u0be9\u0bea\u0007\u0007\u0002\u0002\u0bea\u02a9", - "\u0003\u0002\u0002\u0002\u0beb\u0bec\u0007\b\u0002\u0002\u0bec\u02ab", - "\u0003\u0002\u0002\u0002\u0bed\u0bee\u0007\t\u0002\u0002\u0bee\u02ad", - "\u0003\u0002\u0002\u0002\u0bef\u0bf0\u0007\u000b\u0002\u0002\u0bf0\u02af", - "\u0003\u0002\u0002\u0002\u0bf1\u0c81\u0007\u00dc\u0002\u0002\u0bf2\u0bf3", - "\u0007\u0019\u0002\u0002\u0bf3\u0c81\u0007\u001a\u0002\u0002\u0bf4\u0c81", - "\u0007\u001b\u0002\u0002\u0bf5\u0c81\u0007\u001c\u0002\u0002\u0bf6\u0c81", - "\u0007\u001d\u0002\u0002\u0bf7\u0c81\u0007\u001e\u0002\u0002\u0bf8\u0c81", - "\u0007\u001f\u0002\u0002\u0bf9\u0c81\u0007 \u0002\u0002\u0bfa\u0c81", - '\u0007!\u0002\u0002\u0bfb\u0c81\u0007"\u0002\u0002\u0bfc\u0c81\u0007', - "#\u0002\u0002\u0bfd\u0c81\u0007$\u0002\u0002\u0bfe\u0c81\u0007%\u0002", - "\u0002\u0bff\u0c81\u0007&\u0002\u0002\u0c00\u0c81\u0007'\u0002\u0002", - "\u0c01\u0c81\u0007(\u0002\u0002\u0c02\u0c81\u0007)\u0002\u0002\u0c03", - "\u0c81\u0007*\u0002\u0002\u0c04\u0c81\u0007+\u0002\u0002\u0c05\u0c81", - "\u0007,\u0002\u0002\u0c06\u0c81\u0007-\u0002\u0002\u0c07\u0c81\u0007", - ".\u0002\u0002\u0c08\u0c81\u00070\u0002\u0002\u0c09\u0c81\u00071\u0002", - "\u0002\u0c0a\u0c81\u00072\u0002\u0002\u0c0b\u0c81\u00073\u0002\u0002", - "\u0c0c\u0c81\u00074\u0002\u0002\u0c0d\u0c81\u00075\u0002\u0002\u0c0e", - "\u0c81\u00076\u0002\u0002\u0c0f\u0c81\u00077\u0002\u0002\u0c10\u0c81", - "\u00078\u0002\u0002\u0c11\u0c81\u00079\u0002\u0002\u0c12\u0c81\u0007", - ":\u0002\u0002\u0c13\u0c81\u0007;\u0002\u0002\u0c14\u0c81\u0007<\u0002", - "\u0002\u0c15\u0c81\u0007=\u0002\u0002\u0c16\u0c81\u0007>\u0002\u0002", - "\u0c17\u0c81\u0007?\u0002\u0002\u0c18\u0c81\u0007@\u0002\u0002\u0c19", - "\u0c81\u0007A\u0002\u0002\u0c1a\u0c81\u0007B\u0002\u0002\u0c1b\u0c81", - "\u0007C\u0002\u0002\u0c1c\u0c81\u0007D\u0002\u0002\u0c1d\u0c81\u0007", - "E\u0002\u0002\u0c1e\u0c81\u0007F\u0002\u0002\u0c1f\u0c81\u0007G\u0002", - "\u0002\u0c20\u0c81\u0007H\u0002\u0002\u0c21\u0c81\u0007I\u0002\u0002", - "\u0c22\u0c81\u0007J\u0002\u0002\u0c23\u0c81\u0007K\u0002\u0002\u0c24", - "\u0c81\u0007L\u0002\u0002\u0c25\u0c81\u0007M\u0002\u0002\u0c26\u0c81", - "\u0007N\u0002\u0002\u0c27\u0c81\u0007O\u0002\u0002\u0c28\u0c81\u0007", - "P\u0002\u0002\u0c29\u0c81\u0007Q\u0002\u0002\u0c2a\u0c81\u0007R\u0002", - "\u0002\u0c2b\u0c81\u0007S\u0002\u0002\u0c2c\u0c81\u0007T\u0002\u0002", - "\u0c2d\u0c81\u0007U\u0002\u0002\u0c2e\u0c81\u0007V\u0002\u0002\u0c2f", - "\u0c81\u0007W\u0002\u0002\u0c30\u0c81\u0007X\u0002\u0002\u0c31\u0c81", - "\u0007Y\u0002\u0002\u0c32\u0c81\u0007Z\u0002\u0002\u0c33\u0c81\u0007", - "[\u0002\u0002\u0c34\u0c81\u0007\\\u0002\u0002\u0c35\u0c81\u0007]\u0002", - "\u0002\u0c36\u0c81\u0007^\u0002\u0002\u0c37\u0c81\u0007_\u0002\u0002", - "\u0c38\u0c81\u0007`\u0002\u0002\u0c39\u0c81\u0007a\u0002\u0002\u0c3a", - "\u0c81\u0007b\u0002\u0002\u0c3b\u0c81\u0007c\u0002\u0002\u0c3c\u0c81", - "\u0007d\u0002\u0002\u0c3d\u0c81\u0007e\u0002\u0002\u0c3e\u0c81\u0007", - "f\u0002\u0002\u0c3f\u0c81\u0007g\u0002\u0002\u0c40\u0c81\u0007h\u0002", - "\u0002\u0c41\u0c81\u0007i\u0002\u0002\u0c42\u0c81\u0007j\u0002\u0002", - "\u0c43\u0c81\u0007k\u0002\u0002\u0c44\u0c81\u0007l\u0002\u0002\u0c45", - "\u0c81\u0007m\u0002\u0002\u0c46\u0c81\u0007n\u0002\u0002\u0c47\u0c81", - "\u0007o\u0002\u0002\u0c48\u0c81\u0007p\u0002\u0002\u0c49\u0c81\u0007", - "q\u0002\u0002\u0c4a\u0c81\u0007u\u0002\u0002\u0c4b\u0c81\u0007v\u0002", - "\u0002\u0c4c\u0c81\u0007w\u0002\u0002\u0c4d\u0c81\u0007x\u0002\u0002", - "\u0c4e\u0c81\u0007y\u0002\u0002\u0c4f\u0c81\u0007z\u0002\u0002\u0c50", - "\u0c81\u0007{\u0002\u0002\u0c51\u0c81\u0007|\u0002\u0002\u0c52\u0c81", - "\u0007}\u0002\u0002\u0c53\u0c81\u0007~\u0002\u0002\u0c54\u0c81\u0007", - "\u007f\u0002\u0002\u0c55\u0c81\u0007\u0080\u0002\u0002\u0c56\u0c81\u0007", - "\u0081\u0002\u0002\u0c57\u0c81\u0007\u0082\u0002\u0002\u0c58\u0c81\u0007", - "\u0083\u0002\u0002\u0c59\u0c81\u0007\u0084\u0002\u0002\u0c5a\u0c81\u0007", - "\u0085\u0002\u0002\u0c5b\u0c81\u0007\u0086\u0002\u0002\u0c5c\u0c81\u0007", - "\u0087\u0002\u0002\u0c5d\u0c81\u0007\u0088\u0002\u0002\u0c5e\u0c81\u0007", - "\u0089\u0002\u0002\u0c5f\u0c81\u0007\u008a\u0002\u0002\u0c60\u0c81\u0007", - "\u008b\u0002\u0002\u0c61\u0c81\u0007\u008c\u0002\u0002\u0c62\u0c81\u0007", - "\u008d\u0002\u0002\u0c63\u0c81\u0007\u008e\u0002\u0002\u0c64\u0c81\u0007", - "\u008f\u0002\u0002\u0c65\u0c81\u0007\u0090\u0002\u0002\u0c66\u0c81\u0007", - "\u0091\u0002\u0002\u0c67\u0c81\u0007\u0092\u0002\u0002\u0c68\u0c81\u0007", - "\u0093\u0002\u0002\u0c69\u0c81\u0007\u00c1\u0002\u0002\u0c6a\u0c81\u0007", - "\u00c2\u0002\u0002\u0c6b\u0c81\u0007\u00c3\u0002\u0002\u0c6c\u0c81\u0007", - "\u00c4\u0002\u0002\u0c6d\u0c81\u0007\u00c5\u0002\u0002\u0c6e\u0c81\u0007", - "\u00c6\u0002\u0002\u0c6f\u0c81\u0007\u00c7\u0002\u0002\u0c70\u0c81\u0007", - "\u00c8\u0002\u0002\u0c71\u0c81\u0007\u00c9\u0002\u0002\u0c72\u0c81\u0007", - "\u00ca\u0002\u0002\u0c73\u0c81\u0007\u00cb\u0002\u0002\u0c74\u0c81\u0007", - "\u00cc\u0002\u0002\u0c75\u0c81\u0007\u00cd\u0002\u0002\u0c76\u0c81\u0007", - "\u00ce\u0002\u0002\u0c77\u0c81\u0007\u00cf\u0002\u0002\u0c78\u0c81\u0007", - "\u00d0\u0002\u0002\u0c79\u0c81\u0007\u00d1\u0002\u0002\u0c7a\u0c81\u0007", - "\u00d2\u0002\u0002\u0c7b\u0c81\u0007\u00d3\u0002\u0002\u0c7c\u0c81\u0007", - "\u00d4\u0002\u0002\u0c7d\u0c81\u0007\u00d5\u0002\u0002\u0c7e\u0c81\u0007", - "\u00e3\u0002\u0002\u0c7f\u0c81\u0007\u00e4\u0002\u0002\u0c80\u0bf1\u0003", - "\u0002\u0002\u0002\u0c80\u0bf2\u0003\u0002\u0002\u0002\u0c80\u0bf4\u0003", - "\u0002\u0002\u0002\u0c80\u0bf5\u0003\u0002\u0002\u0002\u0c80\u0bf6\u0003", - "\u0002\u0002\u0002\u0c80\u0bf7\u0003\u0002\u0002\u0002\u0c80\u0bf8\u0003", - "\u0002\u0002\u0002\u0c80\u0bf9\u0003\u0002\u0002\u0002\u0c80\u0bfa\u0003", - "\u0002\u0002\u0002\u0c80\u0bfb\u0003\u0002\u0002\u0002\u0c80\u0bfc\u0003", - "\u0002\u0002\u0002\u0c80\u0bfd\u0003\u0002\u0002\u0002\u0c80\u0bfe\u0003", - "\u0002\u0002\u0002\u0c80\u0bff\u0003\u0002\u0002\u0002\u0c80\u0c00\u0003", - "\u0002\u0002\u0002\u0c80\u0c01\u0003\u0002\u0002\u0002\u0c80\u0c02\u0003", - "\u0002\u0002\u0002\u0c80\u0c03\u0003\u0002\u0002\u0002\u0c80\u0c04\u0003", - "\u0002\u0002\u0002\u0c80\u0c05\u0003\u0002\u0002\u0002\u0c80\u0c06\u0003", - "\u0002\u0002\u0002\u0c80\u0c07\u0003\u0002\u0002\u0002\u0c80\u0c08\u0003", - "\u0002\u0002\u0002\u0c80\u0c09\u0003\u0002\u0002\u0002\u0c80\u0c0a\u0003", - "\u0002\u0002\u0002\u0c80\u0c0b\u0003\u0002\u0002\u0002\u0c80\u0c0c\u0003", - "\u0002\u0002\u0002\u0c80\u0c0d\u0003\u0002\u0002\u0002\u0c80\u0c0e\u0003", - "\u0002\u0002\u0002\u0c80\u0c0f\u0003\u0002\u0002\u0002\u0c80\u0c10\u0003", - "\u0002\u0002\u0002\u0c80\u0c11\u0003\u0002\u0002\u0002\u0c80\u0c12\u0003", - "\u0002\u0002\u0002\u0c80\u0c13\u0003\u0002\u0002\u0002\u0c80\u0c14\u0003", - "\u0002\u0002\u0002\u0c80\u0c15\u0003\u0002\u0002\u0002\u0c80\u0c16\u0003", - "\u0002\u0002\u0002\u0c80\u0c17\u0003\u0002\u0002\u0002\u0c80\u0c18\u0003", - "\u0002\u0002\u0002\u0c80\u0c19\u0003\u0002\u0002\u0002\u0c80\u0c1a\u0003", - "\u0002\u0002\u0002\u0c80\u0c1b\u0003\u0002\u0002\u0002\u0c80\u0c1c\u0003", - "\u0002\u0002\u0002\u0c80\u0c1d\u0003\u0002\u0002\u0002\u0c80\u0c1e\u0003", - "\u0002\u0002\u0002\u0c80\u0c1f\u0003\u0002\u0002\u0002\u0c80\u0c20\u0003", - "\u0002\u0002\u0002\u0c80\u0c21\u0003\u0002\u0002\u0002\u0c80\u0c22\u0003", - "\u0002\u0002\u0002\u0c80\u0c23\u0003\u0002\u0002\u0002\u0c80\u0c24\u0003", - "\u0002\u0002\u0002\u0c80\u0c25\u0003\u0002\u0002\u0002\u0c80\u0c26\u0003", - "\u0002\u0002\u0002\u0c80\u0c27\u0003\u0002\u0002\u0002\u0c80\u0c28\u0003", - "\u0002\u0002\u0002\u0c80\u0c29\u0003\u0002\u0002\u0002\u0c80\u0c2a\u0003", - "\u0002\u0002\u0002\u0c80\u0c2b\u0003\u0002\u0002\u0002\u0c80\u0c2c\u0003", - "\u0002\u0002\u0002\u0c80\u0c2d\u0003\u0002\u0002\u0002\u0c80\u0c2e\u0003", - "\u0002\u0002\u0002\u0c80\u0c2f\u0003\u0002\u0002\u0002\u0c80\u0c30\u0003", - "\u0002\u0002\u0002\u0c80\u0c31\u0003\u0002\u0002\u0002\u0c80\u0c32\u0003", - "\u0002\u0002\u0002\u0c80\u0c33\u0003\u0002\u0002\u0002\u0c80\u0c34\u0003", - "\u0002\u0002\u0002\u0c80\u0c35\u0003\u0002\u0002\u0002\u0c80\u0c36\u0003", - "\u0002\u0002\u0002\u0c80\u0c37\u0003\u0002\u0002\u0002\u0c80\u0c38\u0003", - "\u0002\u0002\u0002\u0c80\u0c39\u0003\u0002\u0002\u0002\u0c80\u0c3a\u0003", - "\u0002\u0002\u0002\u0c80\u0c3b\u0003\u0002\u0002\u0002\u0c80\u0c3c\u0003", - "\u0002\u0002\u0002\u0c80\u0c3d\u0003\u0002\u0002\u0002\u0c80\u0c3e\u0003", - "\u0002\u0002\u0002\u0c80\u0c3f\u0003\u0002\u0002\u0002\u0c80\u0c40\u0003", - "\u0002\u0002\u0002\u0c80\u0c41\u0003\u0002\u0002\u0002\u0c80\u0c42\u0003", - "\u0002\u0002\u0002\u0c80\u0c43\u0003\u0002\u0002\u0002\u0c80\u0c44\u0003", - "\u0002\u0002\u0002\u0c80\u0c45\u0003\u0002\u0002\u0002\u0c80\u0c46\u0003", - "\u0002\u0002\u0002\u0c80\u0c47\u0003\u0002\u0002\u0002\u0c80\u0c48\u0003", - "\u0002\u0002\u0002\u0c80\u0c49\u0003\u0002\u0002\u0002\u0c80\u0c4a\u0003", - "\u0002\u0002\u0002\u0c80\u0c4b\u0003\u0002\u0002\u0002\u0c80\u0c4c\u0003", - "\u0002\u0002\u0002\u0c80\u0c4d\u0003\u0002\u0002\u0002\u0c80\u0c4e\u0003", - "\u0002\u0002\u0002\u0c80\u0c4f\u0003\u0002\u0002\u0002\u0c80\u0c50\u0003", - "\u0002\u0002\u0002\u0c80\u0c51\u0003\u0002\u0002\u0002\u0c80\u0c52\u0003", - "\u0002\u0002\u0002\u0c80\u0c53\u0003\u0002\u0002\u0002\u0c80\u0c54\u0003", - "\u0002\u0002\u0002\u0c80\u0c55\u0003\u0002\u0002\u0002\u0c80\u0c56\u0003", - "\u0002\u0002\u0002\u0c80\u0c57\u0003\u0002\u0002\u0002\u0c80\u0c58\u0003", - "\u0002\u0002\u0002\u0c80\u0c59\u0003\u0002\u0002\u0002\u0c80\u0c5a\u0003", - "\u0002\u0002\u0002\u0c80\u0c5b\u0003\u0002\u0002\u0002\u0c80\u0c5c\u0003", - "\u0002\u0002\u0002\u0c80\u0c5d\u0003\u0002\u0002\u0002\u0c80\u0c5e\u0003", - "\u0002\u0002\u0002\u0c80\u0c5f\u0003\u0002\u0002\u0002\u0c80\u0c60\u0003", - "\u0002\u0002\u0002\u0c80\u0c61\u0003\u0002\u0002\u0002\u0c80\u0c62\u0003", - "\u0002\u0002\u0002\u0c80\u0c63\u0003\u0002\u0002\u0002\u0c80\u0c64\u0003", - "\u0002\u0002\u0002\u0c80\u0c65\u0003\u0002\u0002\u0002\u0c80\u0c66\u0003", - "\u0002\u0002\u0002\u0c80\u0c67\u0003\u0002\u0002\u0002\u0c80\u0c68\u0003", - "\u0002\u0002\u0002\u0c80\u0c69\u0003\u0002\u0002\u0002\u0c80\u0c6a\u0003", - "\u0002\u0002\u0002\u0c80\u0c6b\u0003\u0002\u0002\u0002\u0c80\u0c6c\u0003", - "\u0002\u0002\u0002\u0c80\u0c6d\u0003\u0002\u0002\u0002\u0c80\u0c6e\u0003", - "\u0002\u0002\u0002\u0c80\u0c6f\u0003\u0002\u0002\u0002\u0c80\u0c70\u0003", - "\u0002\u0002\u0002\u0c80\u0c71\u0003\u0002\u0002\u0002\u0c80\u0c72\u0003", - "\u0002\u0002\u0002\u0c80\u0c73\u0003\u0002\u0002\u0002\u0c80\u0c74\u0003", - "\u0002\u0002\u0002\u0c80\u0c75\u0003\u0002\u0002\u0002\u0c80\u0c76\u0003", - "\u0002\u0002\u0002\u0c80\u0c77\u0003\u0002\u0002\u0002\u0c80\u0c78\u0003", - "\u0002\u0002\u0002\u0c80\u0c79\u0003\u0002\u0002\u0002\u0c80\u0c7a\u0003", - "\u0002\u0002\u0002\u0c80\u0c7b\u0003\u0002\u0002\u0002\u0c80\u0c7c\u0003", - "\u0002\u0002\u0002\u0c80\u0c7d\u0003\u0002\u0002\u0002\u0c80\u0c7e\u0003", - "\u0002\u0002\u0002\u0c80\u0c7f\u0003\u0002\u0002\u0002\u0c81\u02b1\u0003", - "\u0002\u0002\u0002\u0110\u02b3\u02b6\u02bc\u02c1\u02c3\u02c8\u02cb\u02ce", - "\u02fa\u030b\u030e\u0315\u031a\u0325\u032f\u033e\u0349\u034e\u0359\u035d", - "\u0362\u036a\u036f\u0373\u0378\u037d\u038c\u0392\u0397\u03a1\u03a6\u03b0", - "\u03b5\u03ba\u03c1\u03c9\u03d6\u03e2\u03e6\u03ea\u03ef\u03f4\u0407\u040e", - "\u0416\u041a\u041f\u0432\u043b\u044a\u044c\u0458\u0466\u046d\u0474\u047c", - "\u0487\u049b\u04a6\u04bd\u04cb\u04d2\u04db\u04ee\u04f6\u04fc\u0501\u0508", - "\u050d\u0515\u051a\u0521\u0526\u052d\u0532\u0539\u0540\u0547\u054e\u0553", - "\u055a\u0561\u0566\u056d\u0572\u0579\u057d\u0581\u0586\u058a\u059a\u05a6", - "\u05ad\u05b6\u05c4\u05cc\u05d2\u05d7\u05e5\u05ed\u05f5\u05fd\u0606\u0612", - "\u0616\u061a\u0628\u0630\u0639\u0644\u0649\u0650\u0653\u0659\u0664\u0667", - "\u066d\u0677\u0680\u0684\u0686\u068c\u0692\u0698\u069e\u06a4\u06aa\u06b0", - "\u06b6\u06bc\u06c2\u06c8\u06ce\u06d4\u06da\u06e0\u06e6\u06e8\u06ee\u06f4", - "\u06fb\u06fe\u0703\u0706\u0709\u070c\u070f\u0711\u0719\u071c\u0722\u0725", - "\u072b\u072e\u0734\u0737\u073d\u0740\u0746\u0749\u074f\u0752\u0758\u075b", - "\u0761\u0764\u076a\u0770\u0778\u077b\u0781\u0784\u078a\u0792\u079a\u07a3", - "\u07ac\u07af\u07b5\u07b8\u07be\u07c1\u07c7\u07ca\u07d0\u07d3\u07db\u07de", - "\u07e4\u07e7\u07ed\u07f0\u07f6\u07f9\u07ff\u0802\u0804\u0808\u080f\u0826", - "\u082a\u082e\u0833\u083b\u0843\u0847\u084a\u0850\u0854\u085b\u0866\u0873", - "\u087c\u08af\u08b8\u08bb\u08cb\u08d7\u08e3\u08ef\u08f7\u08fa\u0902\u0905", - "\u090a\u0911\u0915\u0919\u091c\u092e\u0948\u0954\u095d\u0966\u096a\u096d", - "\u0972\u0975\u0978\u097b\u098b\u0994\u099d\u09a4\u09af\u09b5\u09b7\u09bf", - "\u09d8\u09e3\u09ef\u09fb\u0a06\u0a0b\u0a1f\u0a23\u0a28\u0a2e\u0a32\u0a3e", - "\u0a4f\u0a56\u0a5d\u0a61\u0a66\u0a85\u0a8c\u0a90\u0a97\u0c80", -].join(""); - -const atn = new antlr4.atn.ATNDeserializer().deserialize(serializedATN); - -const decisionsToDFA = atn.decisionToState.map( - (ds, index) => new antlr4.dfa.DFA(ds, index), -); - -const sharedContextCache = new antlr4.PredictionContextCache(); - -class CqlParser extends antlr4.Parser { - static grammarFileName = "CqlParser.g4"; - static literalNames = [ - null, - "'('", - "')'", - "'{'", - "'}'", - "'['", - "']'", - "','", - "';'", - "':'", - null, - null, - null, - null, - "'.'", - "'*'", - "'/'", - "'%'", - "'+'", - "'--'", - "'-'", - "'\"'", - "'''", - ]; - static symbolicNames = [ - null, - "LR_BRACKET", - "RR_BRACKET", - "LC_BRACKET", - "RC_BRACKET", - "LS_BRACKET", - "RS_BRACKET", - "COMMA", - "SEMI", - "COLON", - "SPACE", - "SPEC_MYSQL_COMMENT", - "COMMENT_INPUT", - "LINE_COMMENT", - "DOT", - "STAR", - "DIVIDE", - "MODULE", - "PLUS", - "MINUSMINUS", - "MINUS", - "DQUOTE", - "SQUOTE", - "K_ADD", - "K_AGGREGATE", - "K_ALL", - "K_ALLOW", - "K_ALTER", - "K_AND", - "K_ANY", - "K_APPLY", - "K_AS", - "K_ASC", - "K_AUTHORIZE", - "K_BATCH", - "K_BEGIN", - "K_BY", - "K_CALLED", - "K_CLUSTERING", - "K_COLUMNFAMILY", - "K_COMPACT", - "K_CONSISTENCY", - "K_CONTAINS", - "K_CREATE", - "K_CUSTOM", - "K_SEARCH", - "K_DELETE", - "K_DESC", - "K_DESCRIBE", - "K_DISTINCT", - "K_DROP", - "K_DURABLE_WRITES", - "K_EACH_QUORUM", - "K_ENTRIES", - "K_EXECUTE", - "K_EXISTS", - "K_FALSE", - "K_FILTERING", - "K_FINALFUNC", - "K_FROM", - "K_FULL", - "K_FUNCTION", - "K_FUNCTIONS", - "K_GRANT", - "K_IF", - "K_IN", - "K_INDEX", - "K_INFINITY", - "K_INITCOND", - "K_INPUT", - "K_INSERT", - "K_INTO", - "K_IS", - "K_JSON", - "K_KEY", - "K_KEYS", - "K_KEYSPACE", - "K_KEYSPACES", - "K_LANGUAGE", - "K_LEVEL", - "K_LIMIT", - "K_LOCAL_ONE", - "K_LOCAL_QUORUM", - "K_LOGGED", - "K_LOGIN", - "K_MATERIALIZED", - "K_MODIFY", - "K_NAN", - "K_NORECURSIVE", - "K_NOSUPERUSER", - "K_NOT", - "K_NULL", - "K_OF", - "K_ON", - "K_ONE", - "K_OPTIONS", - "K_OR", - "K_ORDER", - "K_PARTITION", - "K_PASSWORD", - "K_PER", - "K_PERMISSION", - "K_PERMISSIONS", - "K_PRIMARY", - "K_QUORUM", - "K_RENAME", - "K_REPLACE", - "K_REPLICATION", - "K_RETURNS", - "K_REVOKE", - "K_ROLE", - "K_ROLES", - "K_INTERNAL", - "K_LDAP", - "K_SCHEME", - "K_SCHEMA", - "K_SELECT", - "K_SET", - "K_SFUNC", - "K_STATIC", - "K_STORAGE", - "K_STYPE", - "K_SUPERUSER", - "K_TABLE", - "K_THREE", - "K_TIMESTAMP", - "K_TO", - "K_TOKEN", - "K_TRIGGER", - "K_TRUE", - "K_TRUNCATE", - "K_TTL", - "K_TWO", - "K_TYPE", - "K_UNLOGGED", - "K_UPDATE", - "K_USE", - "K_USER", - "K_USING", - "K_UUID", - "K_VALUES", - "K_VIEW", - "K_WHERE", - "K_WITH", - "K_WRITETIME", - "K_ASCII", - "K_CASE_SENITIVE", - "K_NORMALIZE", - "K_SIMILARITY_FUNCTION", - "K_ANALYZED", - "K_IS_LITERAL", - "K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB", - "K_TOKENIZATION_ENABLE_STEMMING", - "K_TOKENIZATION_SKIP_STOP_WORDS", - "K_TOKENIZATION_LOCALE", - "K_TOKENIZATION_NORMALIZE_LOWERCASE", - "K_TOKENIZATION_NORMALIZE_UPPERCASE", - "K_NORMALIZE_LOWERCASE", - "K_NORMALIZE_UPPERCASE", - "K_MODE", - "K_ANALYZER_CLASS", - "K_STORAGE_ATTACHED_INDEX", - "K_SASI_INDEX", - "K_SOLR_INDEX", - "K_SPACE_SAVING_NO_JOIN", - "K_SPACE_SAVING_ALL", - "K_SPACE_SAVING_SLOW_TRIE_PRECISION", - "K_SPACE_SAVING_NO_TEXT_FIELD", - "K_DOC_VALUES", - "K_COPY_FIELD", - "K_EXCLUDED", - "K_INDEXED", - "K_LOWERCASE", - "K_COLUMNS", - "K_PROFILES", - "K_CONFIG", - "K_AUTOCOMMIT_TIME", - "K_DEFAULT_QUERY_FIELD", - "K_DIRECTORY_FACTORY", - "K_FILTER_CACHE_LOW_WATERMARK", - "K_FILTER_CACHE_HIGH_WATERMARK", - "K_DIRECTORY_FACTORY_CLASS", - "K_MERGE_MAX_THREAD_COUNT", - "K_MERGE_MAX_MERGE_COUNT", - "K_RAM_BUFFER_SIZE", - "K_REALTIME", - "K_RECOVERY", - "K_REINDEX", - "K_LENIENT", - "K_STANDARD", - "K_ENCRYPTED", - "K_BIGINT", - "K_BLOB", - "K_BOOLEAN", - "K_COUNTER", - "K_DATE", - "K_DECIMAL", - "K_DOUBLE", - "K_FLOAT", - "K_FROZEN", - "K_INET", - "K_INT", - "K_LIST", - "K_MAP", - "K_SMALLINT", - "K_TEXT", - "K_TIMEUUID", - "K_TIME", - "K_TINYINT", - "K_TUPLE", - "K_VARCHAR", - "K_VARINT", - "CODE_BLOCK", - "STRING_LITERAL", - "DECIMAL_LITERAL", - "FLOAT_LITERAL", - "HEXADECIMAL_LITERAL", - "REAL_LITERAL", - "OBJECT_NAME", - "UUID", - "OPERATOR_EQ", - "OPERATOR_LT", - "OPERATOR_GT", - "OPERATOR_LTE", - "OPERATOR_GTE", - "K_USERS", - "K_VECTOR", - ]; - static ruleNames = [ - "root", - "cqls", - "statementSeparator", - "empty", - "cql", - "revoke", - "listUsers", - "listRoles", - "listPermissions", - "grant", - "priviledge", - "resource", - "createUser", - "createRole", - "createType", - "typeMemberColumnList", - "createTrigger", - "createMaterializedView", - "materializedViewWhere", - "columnNotNullList", - "columnNotNull", - "materializedViewOptions", - "createKeyspace", - "createFunction", - "codeBlock", - "paramList", - "returnMode", - "createAggregate", - "initCondDefinition", - "initCondHash", - "initCondHashItem", - "initCondListNested", - "initCondList", - "orReplace", - "alterUser", - "userPassword", - "userSuperUser", - "alterType", - "alterTypeOperation", - "alterTypeRename", - "alterTypeRenameList", - "alterTypeRenameItem", - "alterTypeAdd", - "alterTypeAlterType", - "alterTable", - "alterTableOperation", - "alterTableWith", - "alterTableRename", - "alterTableDropCompactStorage", - "alterTableDropColumns", - "alterTableDropColumnList", - "alterTableAdd", - "alterTableColumnDefinition", - "alterRole", - "roleWith", - "roleWithOptions", - "alterMaterializedView", - "dropUser", - "dropType", - "dropMaterializedView", - "dropAggregate", - "dropFunction", - "dropTrigger", - "dropRole", - "dropTable", - "dropKeyspace", - "dropIndex", - "createTable", - "withElement", - "clusteringOrderColumns", - "clusteringOrder", - "tableOptions", - "tableOptionItem", - "tableOptionName", - "tableOptionValue", - "optionHash", - "optionHashItem", - "optionHashKey", - "optionHashValue", - "columnDefinitionList", - "columnDefinition", - "primaryKeyColumn", - "primaryKeyElement", - "primaryKeyDefinition", - "singlePrimaryKey", - "compoundKey", - "compositeKey", - "partitionKeyList", - "clusteringKeyList", - "partitionKey", - "clusteringKey", - "applyBatch", - "beginBatch", - "batchType", - "alterKeyspace", - "replicationList", - "replicationListItem", - "durableWrites", - "use", - "truncate", - "createIndex", - "customIndexOption", - "createSearchIndex", - "searchIndexConfigs", - "directoryFactory", - "searchIndexOptions", - "searchIndexProfile", - "searchIndexProfiles", - "searchIndexColumnList", - "searchIndexColumn", - "indexName", - "indexColumnSpec", - "indexKeysSpec", - "indexEntriesSSpec", - "indexFullSpec", - "indexValuesSpec", - "deleteStatement", - "deleteColumnList", - "deleteColumnItem", - "update", - "ifSpec", - "ifConditionList", - "ifCondition", - "assignments", - "assignmentElement", - "assignmentSet", - "assignmentMap", - "assignmentMapExpression", - "assignmentList", - "assignmentTuple", - "insert", - "usingTtlTimestamp", - "timestamp", - "ttl", - "usingTimestampSpec", - "ifNotExist", - "ifExist", - "insertValuesSpec", - "insertColumnSpec", - "columnList", - "expressionList", - "expression", - "select", - "allowFilteringSpec", - "limitSpec", - "fromSpec", - "fromSpecElement", - "orderSpec", - "orderSpecElement", - "whereSpec", - "distinctSpec", - "selectElements", - "selectElement", - "relationElements", - "relationElement", - "relalationContains", - "relalationContainsKey", - "functionCall", - "functionArgs", - "constant", - "decimalLiteral", - "floatLiteral", - "stringLiteral", - "booleanLiteral", - "hexadecimalLiteral", - "keyspace", - "table", - "column", - "dataType", - "dataTypeName", - "dataTypeDefinition", - "orderDirection", - "role", - "trigger", - "triggerClass", - "materializedView", - "type", - "aggregate", - "functionStatement", - "language", - "user", - "password", - "hashKey", - "param", - "paramName", - "kwAdd", - "kwAggregate", - "kwAll", - "kwAllPermissions", - "kwAllow", - "kwAlter", - "kwAnd", - "kwApply", - "kwAs", - "kwAsc", - "kwAuthorize", - "kwBatch", - "kwBegin", - "kwBy", - "kwCalled", - "kwClustering", - "kwCompact", - "kwContains", - "kwCreate", - "kwDelete", - "kwDesc", - "kwDescibe", - "kwDistinct", - "kwDrop", - "kwDurableWrites", - "kwEntries", - "kwExecute", - "kwExists", - "kwFiltering", - "kwFinalfunc", - "kwFrom", - "kwFull", - "kwFunction", - "kwFunctions", - "kwGrant", - "kwIf", - "kwIn", - "kwIndex", - "kwCustom", - "kwSearch", - "kwAscii", - "kwNormalize", - "kwAnalyzed", - "kwIsLiteral", - "kwMaxCompactionFlushMemoryInMb", - "kwTokenizationEnableStemming", - "kwTokenizationSkipStopWords", - "kwTokenizationLocale", - "kwTokenizationNormalizeLowercase", - "kwTokenizationNormalizeUppercase", - "kwNormalizeLowercase", - "kwNormalizeUppercase", - "kwMode", - "kwAnalyzerClass", - "kwStorageAttachedIndex", - "kwSolrIndex", - "kwSASIIndex", - "kwSpaceSavingNoJoin", - "kwSpaceSavingAll", - "kwSpaceSavingSlowTriePrecision", - "kwSpaceSavingNoTextField", - "kwCopyField", - "kwDocValues", - "kwExcluded", - "kwIndexed", - "kwLowerCase", - "kwColumns", - "kwProfiles", - "kwConfig", - "kwAutoCommitTime", - "kwDefaultQueryField", - "kwDirectoryFactory", - "kwFilterCacheLowWaterMark", - "kwFilterCacheHighWaterMark", - "kwDirectoryFactoryClass", - "kwMergeMaxThreadCount", - "kwMergeMaxMergeCount", - "kwRamBufferSize", - "kwRealtime", - "kwRecovery", - "kwReindex", - "kwLenient", - "kwStandard", - "kwEncrypted", - "kwCaseSensitive", - "kwSimilarityFunction", - "kwInitcond", - "kwInput", - "kwInsert", - "kwInto", - "kwIs", - "kwJson", - "kwKey", - "kwKeys", - "kwKeyspace", - "kwKeyspaces", - "kwLanguage", - "kwLimit", - "kwList", - "kwLogged", - "kwLogin", - "kwMaterialized", - "kwModify", - "kwNosuperuser", - "kwNorecursive", - "kwNot", - "kwNull", - "kwOf", - "kwOn", - "kwOptions", - "kwOr", - "kwOrder", - "kwPassword", - "kwPrimary", - "kwRename", - "kwReplace", - "kwReplication", - "kwReturns", - "kwRole", - "kwInternal", - "kwLdap", - "kwScheme", - "kwRoles", - "kwSelect", - "kwSet", - "kwSfunc", - "kwStorage", - "kwStype", - "kwSuperuser", - "kwTable", - "kwTimestamp", - "kwTo", - "kwTrigger", - "kwTruncate", - "kwTtl", - "kwType", - "kwUnlogged", - "kwUpdate", - "kwUse", - "kwUser", - "kwUsers", - "kwUsing", - "kwValues", - "kwView", - "kwWhere", - "kwWith", - "kwRevoke", - "eof", - "syntaxBracketLr", - "syntaxBracketRr", - "syntaxBracketLc", - "syntaxBracketRc", - "syntaxBracketLa", - "syntaxBracketRa", - "syntaxBracketLs", - "syntaxBracketRs", - "syntaxComma", - "syntaxColon", - "id", - ]; - - constructor(input) { - super(input); - this._interp = new antlr4.atn.ParserATNSimulator( - this, - atn, - decisionsToDFA, - sharedContextCache, - ); - this.ruleNames = CqlParser.ruleNames; - this.literalNames = CqlParser.literalNames; - this.symbolicNames = CqlParser.symbolicNames; - } - - get atn() { - return atn; - } - - root() { - let localctx = new RootContext(this, this._ctx, this.state); - this.enterRule(localctx, 0, CqlParser.RULE_root); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 689; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 8) & ~0x1f) == 0 && - ((1 << (_la - 8)) & - ((1 << (CqlParser.SEMI - 8)) | - (1 << (CqlParser.K_ALTER - 8)) | - (1 << (CqlParser.K_APPLY - 8)) | - (1 << (CqlParser.K_BEGIN - 8)))) !== - 0) || - (((_la - 43) & ~0x1f) == 0 && - ((1 << (_la - 43)) & - ((1 << (CqlParser.K_CREATE - 43)) | - (1 << (CqlParser.K_DELETE - 43)) | - (1 << (CqlParser.K_DROP - 43)) | - (1 << (CqlParser.K_GRANT - 43)) | - (1 << (CqlParser.K_INSERT - 43)))) !== - 0) || - (((_la - 109) & ~0x1f) == 0 && - ((1 << (_la - 109)) & - ((1 << (CqlParser.K_REVOKE - 109)) | - (1 << (CqlParser.K_SELECT - 109)) | - (1 << (CqlParser.K_TRUNCATE - 109)) | - (1 << (CqlParser.K_UPDATE - 109)) | - (1 << (CqlParser.K_USE - 109)))) !== - 0) || - _la === CqlParser.K_LIST - ) { - this.state = 688; - this.cqls(); - } - - this.state = 692; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.MINUSMINUS) { - this.state = 691; - this.match(CqlParser.MINUSMINUS); - } - - this.state = 694; - this.eof(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - cqls() { - let localctx = new CqlsContext(this, this._ctx, this.state); - this.enterRule(localctx, 2, CqlParser.RULE_cqls); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 705; - this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input, 4, this._ctx); - while (_alt != 2 && _alt != antlr4.atn.ATN.INVALID_ALT_NUMBER) { - if (_alt === 1) { - this.state = 703; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ALTER: - case CqlParser.K_APPLY: - case CqlParser.K_BEGIN: - case CqlParser.K_CREATE: - case CqlParser.K_DELETE: - case CqlParser.K_DROP: - case CqlParser.K_GRANT: - case CqlParser.K_INSERT: - case CqlParser.K_REVOKE: - case CqlParser.K_SELECT: - case CqlParser.K_TRUNCATE: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_LIST: - this.state = 696; - this.cql(); - this.state = 698; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.MINUSMINUS) { - this.state = 697; - this.match(CqlParser.MINUSMINUS); - } - - this.state = 700; - this.statementSeparator(); - break; - case CqlParser.SEMI: - this.state = 702; - this.empty(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } - this.state = 707; - this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 4, this._ctx); - } - - this.state = 716; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ALTER: - case CqlParser.K_APPLY: - case CqlParser.K_BEGIN: - case CqlParser.K_CREATE: - case CqlParser.K_DELETE: - case CqlParser.K_DROP: - case CqlParser.K_GRANT: - case CqlParser.K_INSERT: - case CqlParser.K_REVOKE: - case CqlParser.K_SELECT: - case CqlParser.K_TRUNCATE: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_LIST: - this.state = 708; - this.cql(); - this.state = 713; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 6, this._ctx); - if (la_ === 1) { - this.state = 710; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.MINUSMINUS) { - this.state = 709; - this.match(CqlParser.MINUSMINUS); - } - - this.state = 712; - this.statementSeparator(); - } - break; - case CqlParser.SEMI: - this.state = 715; - this.empty(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - statementSeparator() { - let localctx = new StatementSeparatorContext(this, this._ctx, this.state); - this.enterRule(localctx, 4, CqlParser.RULE_statementSeparator); - try { - this.enterOuterAlt(localctx, 1); - this.state = 718; - this.match(CqlParser.SEMI); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - empty() { - let localctx = new EmptyContext(this, this._ctx, this.state); - this.enterRule(localctx, 6, CqlParser.RULE_empty); - try { - this.enterOuterAlt(localctx, 1); - this.state = 720; - this.statementSeparator(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - cql() { - let localctx = new CqlContext(this, this._ctx, this.state); - this.enterRule(localctx, 8, CqlParser.RULE_cql); - try { - this.state = 760; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 8, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 722; - this.alterKeyspace(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 723; - this.alterMaterializedView(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 724; - this.alterRole(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 725; - this.alterTable(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 726; - this.alterType(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 727; - this.alterUser(); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 728; - this.applyBatch(); - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 729; - this.createAggregate(); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 730; - this.createFunction(); - break; - - case 10: - this.enterOuterAlt(localctx, 10); - this.state = 731; - this.createIndex(); - break; - - case 11: - this.enterOuterAlt(localctx, 11); - this.state = 732; - this.createSearchIndex(); - break; - - case 12: - this.enterOuterAlt(localctx, 12); - this.state = 733; - this.createKeyspace(); - break; - - case 13: - this.enterOuterAlt(localctx, 13); - this.state = 734; - this.createMaterializedView(); - break; - - case 14: - this.enterOuterAlt(localctx, 14); - this.state = 735; - this.createRole(); - break; - - case 15: - this.enterOuterAlt(localctx, 15); - this.state = 736; - this.createTable(); - break; - - case 16: - this.enterOuterAlt(localctx, 16); - this.state = 737; - this.createTrigger(); - break; - - case 17: - this.enterOuterAlt(localctx, 17); - this.state = 738; - this.createType(); - break; - - case 18: - this.enterOuterAlt(localctx, 18); - this.state = 739; - this.createUser(); - break; - - case 19: - this.enterOuterAlt(localctx, 19); - this.state = 740; - this.deleteStatement(); - break; - - case 20: - this.enterOuterAlt(localctx, 20); - this.state = 741; - this.dropAggregate(); - break; - - case 21: - this.enterOuterAlt(localctx, 21); - this.state = 742; - this.dropFunction(); - break; - - case 22: - this.enterOuterAlt(localctx, 22); - this.state = 743; - this.dropIndex(); - break; - - case 23: - this.enterOuterAlt(localctx, 23); - this.state = 744; - this.dropKeyspace(); - break; - - case 24: - this.enterOuterAlt(localctx, 24); - this.state = 745; - this.dropMaterializedView(); - break; - - case 25: - this.enterOuterAlt(localctx, 25); - this.state = 746; - this.dropRole(); - break; - - case 26: - this.enterOuterAlt(localctx, 26); - this.state = 747; - this.dropTable(); - break; - - case 27: - this.enterOuterAlt(localctx, 27); - this.state = 748; - this.dropTrigger(); - break; - - case 28: - this.enterOuterAlt(localctx, 28); - this.state = 749; - this.dropType(); - break; - - case 29: - this.enterOuterAlt(localctx, 29); - this.state = 750; - this.dropUser(); - break; - - case 30: - this.enterOuterAlt(localctx, 30); - this.state = 751; - this.grant(); - break; - - case 31: - this.enterOuterAlt(localctx, 31); - this.state = 752; - this.insert(); - break; - - case 32: - this.enterOuterAlt(localctx, 32); - this.state = 753; - this.listPermissions(); - break; - - case 33: - this.enterOuterAlt(localctx, 33); - this.state = 754; - this.listRoles(); - break; - - case 34: - this.enterOuterAlt(localctx, 34); - this.state = 755; - this.revoke(); - break; - - case 35: - this.enterOuterAlt(localctx, 35); - this.state = 756; - this.select(); - break; - - case 36: - this.enterOuterAlt(localctx, 36); - this.state = 757; - this.truncate(); - break; - - case 37: - this.enterOuterAlt(localctx, 37); - this.state = 758; - this.update(); - break; - - case 38: - this.enterOuterAlt(localctx, 38); - this.state = 759; - this.use(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - revoke() { - let localctx = new RevokeContext(this, this._ctx, this.state); - this.enterRule(localctx, 10, CqlParser.RULE_revoke); - try { - this.enterOuterAlt(localctx, 1); - this.state = 762; - this.kwRevoke(); - this.state = 763; - this.priviledge(); - this.state = 764; - this.kwOn(); - this.state = 765; - this.resource(); - this.state = 766; - this.kwFrom(); - this.state = 767; - this.role(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - listUsers() { - let localctx = new ListUsersContext(this, this._ctx, this.state); - this.enterRule(localctx, 12, CqlParser.RULE_listUsers); - try { - this.enterOuterAlt(localctx, 1); - this.state = 769; - this.kwList(); - this.state = 770; - this.kwUsers(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - listRoles() { - let localctx = new ListRolesContext(this, this._ctx, this.state); - this.enterRule(localctx, 14, CqlParser.RULE_listRoles); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 772; - this.kwList(); - this.state = 773; - this.kwRoles(); - this.state = 777; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_OF) { - this.state = 774; - this.kwOf(); - this.state = 775; - this.role(); - } - - this.state = 780; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_NORECURSIVE) { - this.state = 779; - this.kwNorecursive(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - listPermissions() { - let localctx = new ListPermissionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 16, CqlParser.RULE_listPermissions); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 782; - this.kwList(); - this.state = 783; - this.priviledge(); - this.state = 787; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_ON) { - this.state = 784; - this.kwOn(); - this.state = 785; - this.resource(); - } - - this.state = 792; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_OF) { - this.state = 789; - this.kwOf(); - this.state = 790; - this.role(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - grant() { - let localctx = new GrantContext(this, this._ctx, this.state); - this.enterRule(localctx, 18, CqlParser.RULE_grant); - try { - this.enterOuterAlt(localctx, 1); - this.state = 794; - this.kwGrant(); - this.state = 795; - this.priviledge(); - this.state = 796; - this.kwOn(); - this.state = 797; - this.resource(); - this.state = 798; - this.kwTo(); - this.state = 799; - this.role(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - priviledge() { - let localctx = new PriviledgeContext(this, this._ctx, this.state); - this.enterRule(localctx, 20, CqlParser.RULE_priviledge); - try { - this.state = 813; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ALL: - this.enterOuterAlt(localctx, 1); - this.state = 803; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 13, this._ctx); - switch (la_) { - case 1: - this.state = 801; - this.kwAll(); - break; - - case 2: - this.state = 802; - this.kwAllPermissions(); - break; - } - break; - case CqlParser.K_ALTER: - this.enterOuterAlt(localctx, 2); - this.state = 805; - this.kwAlter(); - break; - case CqlParser.K_AUTHORIZE: - this.enterOuterAlt(localctx, 3); - this.state = 806; - this.kwAuthorize(); - break; - case CqlParser.K_DESCRIBE: - this.enterOuterAlt(localctx, 4); - this.state = 807; - this.kwDescibe(); - break; - case CqlParser.K_EXECUTE: - this.enterOuterAlt(localctx, 5); - this.state = 808; - this.kwExecute(); - break; - case CqlParser.K_CREATE: - this.enterOuterAlt(localctx, 6); - this.state = 809; - this.kwCreate(); - break; - case CqlParser.K_DROP: - this.enterOuterAlt(localctx, 7); - this.state = 810; - this.kwDrop(); - break; - case CqlParser.K_MODIFY: - this.enterOuterAlt(localctx, 8); - this.state = 811; - this.kwModify(); - break; - case CqlParser.K_SELECT: - this.enterOuterAlt(localctx, 9); - this.state = 812; - this.kwSelect(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - resource() { - let localctx = new ResourceContext(this, this._ctx, this.state); - this.enterRule(localctx, 22, CqlParser.RULE_resource); - try { - this.state = 859; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 19, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 815; - this.kwAll(); - this.state = 816; - this.kwFunctions(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 818; - this.kwAll(); - this.state = 819; - this.kwFunctions(); - this.state = 820; - this.kwIn(); - this.state = 821; - this.kwKeyspace(); - this.state = 822; - this.keyspace(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 824; - this.kwFunction(); - this.state = 828; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 15, this._ctx); - if (la_ === 1) { - this.state = 825; - this.keyspace(); - this.state = 826; - this.match(CqlParser.DOT); - } - this.state = 830; - this.functionStatement(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 832; - this.kwAll(); - this.state = 833; - this.kwKeyspaces(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 835; - this.kwKeyspace(); - this.state = 836; - this.keyspace(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 839; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 16, this._ctx); - if (la_ === 1) { - this.state = 838; - this.kwTable(); - } - this.state = 844; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 17, this._ctx); - if (la_ === 1) { - this.state = 841; - this.keyspace(); - this.state = 842; - this.match(CqlParser.DOT); - } - this.state = 846; - this.table(); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 847; - this.kwAll(); - this.state = 848; - this.kwRoles(); - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 850; - this.kwRole(); - this.state = 851; - this.role(); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 855; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_INTERNAL: - this.state = 853; - this.kwInternal(); - break; - case CqlParser.K_LDAP: - this.state = 854; - this.kwLdap(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 857; - this.kwScheme(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createUser() { - let localctx = new CreateUserContext(this, this._ctx, this.state); - this.enterRule(localctx, 24, CqlParser.RULE_createUser); - try { - this.enterOuterAlt(localctx, 1); - this.state = 861; - this.kwCreate(); - this.state = 862; - this.kwUser(); - this.state = 864; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 20, this._ctx); - if (la_ === 1) { - this.state = 863; - this.ifNotExist(); - } - this.state = 866; - this.user(); - this.state = 867; - this.kwWith(); - this.state = 868; - this.kwPassword(); - this.state = 869; - this.stringLiteral(); - this.state = 872; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_SUPERUSER: - this.state = 870; - this.kwSuperuser(); - break; - case CqlParser.K_NOSUPERUSER: - this.state = 871; - this.kwNosuperuser(); - break; - case CqlParser.EOF: - case CqlParser.SEMI: - case CqlParser.MINUSMINUS: - break; - default: - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createRole() { - let localctx = new CreateRoleContext(this, this._ctx, this.state); - this.enterRule(localctx, 26, CqlParser.RULE_createRole); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 874; - this.kwCreate(); - this.state = 875; - this.kwRole(); - this.state = 877; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 22, this._ctx); - if (la_ === 1) { - this.state = 876; - this.ifNotExist(); - } - this.state = 879; - this.role(); - this.state = 881; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 880; - this.roleWith(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createType() { - let localctx = new CreateTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 28, CqlParser.RULE_createType); - try { - this.enterOuterAlt(localctx, 1); - this.state = 883; - this.kwCreate(); - this.state = 884; - this.kwType(); - this.state = 886; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 24, this._ctx); - if (la_ === 1) { - this.state = 885; - this.ifNotExist(); - } - this.state = 891; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 25, this._ctx); - if (la_ === 1) { - this.state = 888; - this.keyspace(); - this.state = 889; - this.match(CqlParser.DOT); - } - this.state = 893; - this.type(); - this.state = 894; - this.syntaxBracketLr(); - this.state = 895; - this.typeMemberColumnList(); - this.state = 896; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - typeMemberColumnList() { - let localctx = new TypeMemberColumnListContext(this, this._ctx, this.state); - this.enterRule(localctx, 30, CqlParser.RULE_typeMemberColumnList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 898; - this.column(); - this.state = 899; - this.dataType(); - this.state = 906; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 900; - this.syntaxComma(); - this.state = 901; - this.column(); - this.state = 902; - this.dataType(); - this.state = 908; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createTrigger() { - let localctx = new CreateTriggerContext(this, this._ctx, this.state); - this.enterRule(localctx, 32, CqlParser.RULE_createTrigger); - try { - this.enterOuterAlt(localctx, 1); - this.state = 909; - this.kwCreate(); - this.state = 910; - this.kwTrigger(); - this.state = 912; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 27, this._ctx); - if (la_ === 1) { - this.state = 911; - this.ifNotExist(); - } - this.state = 917; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 28, this._ctx); - if (la_ === 1) { - this.state = 914; - this.keyspace(); - this.state = 915; - this.match(CqlParser.DOT); - } - this.state = 919; - this.trigger(); - this.state = 920; - this.kwUsing(); - this.state = 921; - this.triggerClass(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createMaterializedView() { - let localctx = new CreateMaterializedViewContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 34, CqlParser.RULE_createMaterializedView); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 923; - this.kwCreate(); - this.state = 924; - this.kwMaterialized(); - this.state = 925; - this.kwView(); - this.state = 927; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 29, this._ctx); - if (la_ === 1) { - this.state = 926; - this.ifNotExist(); - } - this.state = 932; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 30, this._ctx); - if (la_ === 1) { - this.state = 929; - this.keyspace(); - this.state = 930; - this.match(CqlParser.DOT); - } - this.state = 934; - this.materializedView(); - this.state = 935; - this.kwAs(); - this.state = 936; - this.kwSelect(); - this.state = 937; - this.columnList(); - this.state = 938; - this.kwFrom(); - this.state = 942; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 31, this._ctx); - if (la_ === 1) { - this.state = 939; - this.keyspace(); - this.state = 940; - this.match(CqlParser.DOT); - } - this.state = 944; - this.table(); - this.state = 945; - this.materializedViewWhere(); - this.state = 947; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_PRIMARY) { - this.state = 946; - this.primaryKeyElement(); - } - - this.state = 952; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 949; - this.kwWith(); - this.state = 950; - this.materializedViewOptions(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - materializedViewWhere() { - let localctx = new MaterializedViewWhereContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 36, CqlParser.RULE_materializedViewWhere); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 954; - this.kwWhere(); - this.state = 955; - this.columnNotNullList(); - this.state = 959; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 956; - this.kwAnd(); - this.state = 957; - this.relationElements(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - columnNotNullList() { - let localctx = new ColumnNotNullListContext(this, this._ctx, this.state); - this.enterRule(localctx, 38, CqlParser.RULE_columnNotNullList); - try { - this.enterOuterAlt(localctx, 1); - this.state = 961; - this.columnNotNull(); - this.state = 967; - this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); - while (_alt != 2 && _alt != antlr4.atn.ATN.INVALID_ALT_NUMBER) { - if (_alt === 1) { - this.state = 962; - this.kwAnd(); - this.state = 963; - this.columnNotNull(); - } - this.state = 969; - this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 35, this._ctx); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - columnNotNull() { - let localctx = new ColumnNotNullContext(this, this._ctx, this.state); - this.enterRule(localctx, 40, CqlParser.RULE_columnNotNull); - try { - this.enterOuterAlt(localctx, 1); - this.state = 970; - this.column(); - this.state = 971; - this.kwIs(); - this.state = 972; - this.kwNot(); - this.state = 973; - this.kwNull(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - materializedViewOptions() { - let localctx = new MaterializedViewOptionsContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 42, CqlParser.RULE_materializedViewOptions); - try { - this.enterOuterAlt(localctx, 1); - this.state = 975; - this.tableOptions(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createKeyspace() { - let localctx = new CreateKeyspaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 44, CqlParser.RULE_createKeyspace); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 977; - this.kwCreate(); - this.state = 978; - this.kwKeyspace(); - this.state = 980; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 36, this._ctx); - if (la_ === 1) { - this.state = 979; - this.ifNotExist(); - } - this.state = 982; - this.keyspace(); - this.state = 983; - this.kwWith(); - this.state = 984; - this.kwReplication(); - this.state = 985; - this.match(CqlParser.OPERATOR_EQ); - this.state = 986; - this.syntaxBracketLc(); - this.state = 987; - this.replicationList(); - this.state = 988; - this.syntaxBracketRc(); - this.state = 992; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 989; - this.kwAnd(); - this.state = 990; - this.durableWrites(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createFunction() { - let localctx = new CreateFunctionContext(this, this._ctx, this.state); - this.enterRule(localctx, 46, CqlParser.RULE_createFunction); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 994; - this.kwCreate(); - this.state = 996; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_OR) { - this.state = 995; - this.orReplace(); - } - - this.state = 998; - this.kwFunction(); - this.state = 1000; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 39, this._ctx); - if (la_ === 1) { - this.state = 999; - this.ifNotExist(); - } - this.state = 1005; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 40, this._ctx); - if (la_ === 1) { - this.state = 1002; - this.keyspace(); - this.state = 1003; - this.match(CqlParser.DOT); - } - this.state = 1007; - this.functionStatement(); - this.state = 1008; - this.syntaxBracketLr(); - this.state = 1010; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 23) & ~0x1f) == 0 && - ((1 << (_la - 23)) & - ((1 << (CqlParser.K_ADD - 23)) | - (1 << (CqlParser.K_ALL - 23)) | - (1 << (CqlParser.K_ALLOW - 23)) | - (1 << (CqlParser.K_ALTER - 23)) | - (1 << (CqlParser.K_AND - 23)) | - (1 << (CqlParser.K_ANY - 23)) | - (1 << (CqlParser.K_APPLY - 23)) | - (1 << (CqlParser.K_AS - 23)) | - (1 << (CqlParser.K_ASC - 23)) | - (1 << (CqlParser.K_AUTHORIZE - 23)) | - (1 << (CqlParser.K_BATCH - 23)) | - (1 << (CqlParser.K_BEGIN - 23)) | - (1 << (CqlParser.K_BY - 23)) | - (1 << (CqlParser.K_CALLED - 23)) | - (1 << (CqlParser.K_CLUSTERING - 23)) | - (1 << (CqlParser.K_COLUMNFAMILY - 23)) | - (1 << (CqlParser.K_COMPACT - 23)) | - (1 << (CqlParser.K_CONSISTENCY - 23)) | - (1 << (CqlParser.K_CONTAINS - 23)) | - (1 << (CqlParser.K_CREATE - 23)) | - (1 << (CqlParser.K_CUSTOM - 23)) | - (1 << (CqlParser.K_DELETE - 23)) | - (1 << (CqlParser.K_DESC - 23)) | - (1 << (CqlParser.K_DESCRIBE - 23)) | - (1 << (CqlParser.K_DISTINCT - 23)) | - (1 << (CqlParser.K_DROP - 23)) | - (1 << (CqlParser.K_DURABLE_WRITES - 23)) | - (1 << (CqlParser.K_EACH_QUORUM - 23)) | - (1 << (CqlParser.K_ENTRIES - 23)) | - (1 << (CqlParser.K_EXECUTE - 23)))) !== - 0) || - (((_la - 55) & ~0x1f) == 0 && - ((1 << (_la - 55)) & - ((1 << (CqlParser.K_EXISTS - 55)) | - (1 << (CqlParser.K_FALSE - 55)) | - (1 << (CqlParser.K_FILTERING - 55)) | - (1 << (CqlParser.K_FINALFUNC - 55)) | - (1 << (CqlParser.K_FROM - 55)) | - (1 << (CqlParser.K_FULL - 55)) | - (1 << (CqlParser.K_FUNCTION - 55)) | - (1 << (CqlParser.K_FUNCTIONS - 55)) | - (1 << (CqlParser.K_GRANT - 55)) | - (1 << (CqlParser.K_IF - 55)) | - (1 << (CqlParser.K_IN - 55)) | - (1 << (CqlParser.K_INDEX - 55)) | - (1 << (CqlParser.K_INFINITY - 55)) | - (1 << (CqlParser.K_INITCOND - 55)) | - (1 << (CqlParser.K_INPUT - 55)) | - (1 << (CqlParser.K_INSERT - 55)) | - (1 << (CqlParser.K_INTO - 55)) | - (1 << (CqlParser.K_IS - 55)) | - (1 << (CqlParser.K_JSON - 55)) | - (1 << (CqlParser.K_KEY - 55)) | - (1 << (CqlParser.K_KEYS - 55)) | - (1 << (CqlParser.K_KEYSPACE - 55)) | - (1 << (CqlParser.K_KEYSPACES - 55)) | - (1 << (CqlParser.K_LANGUAGE - 55)) | - (1 << (CqlParser.K_LEVEL - 55)) | - (1 << (CqlParser.K_LIMIT - 55)) | - (1 << (CqlParser.K_LOCAL_ONE - 55)) | - (1 << (CqlParser.K_LOCAL_QUORUM - 55)) | - (1 << (CqlParser.K_LOGGED - 55)) | - (1 << (CqlParser.K_LOGIN - 55)) | - (1 << (CqlParser.K_MATERIALIZED - 55)) | - (1 << (CqlParser.K_MODIFY - 55)))) !== - 0) || - (((_la - 87) & ~0x1f) == 0 && - ((1 << (_la - 87)) & - ((1 << (CqlParser.K_NAN - 87)) | - (1 << (CqlParser.K_NORECURSIVE - 87)) | - (1 << (CqlParser.K_NOSUPERUSER - 87)) | - (1 << (CqlParser.K_NOT - 87)) | - (1 << (CqlParser.K_NULL - 87)) | - (1 << (CqlParser.K_OF - 87)) | - (1 << (CqlParser.K_ON - 87)) | - (1 << (CqlParser.K_ONE - 87)) | - (1 << (CqlParser.K_OPTIONS - 87)) | - (1 << (CqlParser.K_OR - 87)) | - (1 << (CqlParser.K_ORDER - 87)) | - (1 << (CqlParser.K_PARTITION - 87)) | - (1 << (CqlParser.K_PASSWORD - 87)) | - (1 << (CqlParser.K_PER - 87)) | - (1 << (CqlParser.K_PERMISSION - 87)) | - (1 << (CqlParser.K_PERMISSIONS - 87)) | - (1 << (CqlParser.K_PRIMARY - 87)) | - (1 << (CqlParser.K_QUORUM - 87)) | - (1 << (CqlParser.K_RENAME - 87)) | - (1 << (CqlParser.K_REPLACE - 87)) | - (1 << (CqlParser.K_REPLICATION - 87)) | - (1 << (CqlParser.K_RETURNS - 87)) | - (1 << (CqlParser.K_REVOKE - 87)) | - (1 << (CqlParser.K_ROLE - 87)) | - (1 << (CqlParser.K_ROLES - 87)) | - (1 << (CqlParser.K_SCHEMA - 87)) | - (1 << (CqlParser.K_SELECT - 87)) | - (1 << (CqlParser.K_SET - 87)) | - (1 << (CqlParser.K_SFUNC - 87)))) !== - 0) || - (((_la - 119) & ~0x1f) == 0 && - ((1 << (_la - 119)) & - ((1 << (CqlParser.K_STATIC - 119)) | - (1 << (CqlParser.K_STORAGE - 119)) | - (1 << (CqlParser.K_STYPE - 119)) | - (1 << (CqlParser.K_SUPERUSER - 119)) | - (1 << (CqlParser.K_TABLE - 119)) | - (1 << (CqlParser.K_THREE - 119)) | - (1 << (CqlParser.K_TIMESTAMP - 119)) | - (1 << (CqlParser.K_TO - 119)) | - (1 << (CqlParser.K_TOKEN - 119)) | - (1 << (CqlParser.K_TRIGGER - 119)) | - (1 << (CqlParser.K_TRUE - 119)) | - (1 << (CqlParser.K_TRUNCATE - 119)) | - (1 << (CqlParser.K_TTL - 119)) | - (1 << (CqlParser.K_TWO - 119)) | - (1 << (CqlParser.K_TYPE - 119)) | - (1 << (CqlParser.K_UNLOGGED - 119)) | - (1 << (CqlParser.K_UPDATE - 119)) | - (1 << (CqlParser.K_USE - 119)) | - (1 << (CqlParser.K_USER - 119)) | - (1 << (CqlParser.K_USING - 119)) | - (1 << (CqlParser.K_UUID - 119)) | - (1 << (CqlParser.K_VALUES - 119)) | - (1 << (CqlParser.K_VIEW - 119)) | - (1 << (CqlParser.K_WHERE - 119)) | - (1 << (CqlParser.K_WITH - 119)) | - (1 << (CqlParser.K_WRITETIME - 119)) | - (1 << (CqlParser.K_ASCII - 119)))) !== - 0) || - (((_la - 191) & ~0x1f) == 0 && - ((1 << (_la - 191)) & - ((1 << (CqlParser.K_BIGINT - 191)) | - (1 << (CqlParser.K_BLOB - 191)) | - (1 << (CqlParser.K_BOOLEAN - 191)) | - (1 << (CqlParser.K_COUNTER - 191)) | - (1 << (CqlParser.K_DATE - 191)) | - (1 << (CqlParser.K_DECIMAL - 191)) | - (1 << (CqlParser.K_DOUBLE - 191)) | - (1 << (CqlParser.K_FLOAT - 191)) | - (1 << (CqlParser.K_FROZEN - 191)) | - (1 << (CqlParser.K_INET - 191)) | - (1 << (CqlParser.K_INT - 191)) | - (1 << (CqlParser.K_LIST - 191)) | - (1 << (CqlParser.K_MAP - 191)) | - (1 << (CqlParser.K_SMALLINT - 191)) | - (1 << (CqlParser.K_TEXT - 191)) | - (1 << (CqlParser.K_TIMEUUID - 191)) | - (1 << (CqlParser.K_TIME - 191)) | - (1 << (CqlParser.K_TINYINT - 191)) | - (1 << (CqlParser.K_TUPLE - 191)) | - (1 << (CqlParser.K_VARCHAR - 191)) | - (1 << (CqlParser.K_VARINT - 191)) | - (1 << (CqlParser.OBJECT_NAME - 191)))) !== - 0) || - _la === CqlParser.K_USERS || - _la === CqlParser.K_VECTOR - ) { - this.state = 1009; - this.paramList(); - } - - this.state = 1012; - this.syntaxBracketRr(); - this.state = 1013; - this.returnMode(); - this.state = 1014; - this.kwReturns(); - this.state = 1015; - this.dataType(); - this.state = 1016; - this.kwLanguage(); - this.state = 1017; - this.language(); - this.state = 1018; - this.kwAs(); - this.state = 1019; - this.codeBlock(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - codeBlock() { - let localctx = new CodeBlockContext(this, this._ctx, this.state); - this.enterRule(localctx, 48, CqlParser.RULE_codeBlock); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1021; - _la = this._input.LA(1); - if (!(_la === CqlParser.CODE_BLOCK || _la === CqlParser.STRING_LITERAL)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - paramList() { - let localctx = new ParamListContext(this, this._ctx, this.state); - this.enterRule(localctx, 50, CqlParser.RULE_paramList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1023; - this.param(); - this.state = 1029; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1024; - this.syntaxComma(); - this.state = 1025; - this.param(); - this.state = 1031; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - returnMode() { - let localctx = new ReturnModeContext(this, this._ctx, this.state); - this.enterRule(localctx, 52, CqlParser.RULE_returnMode); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1036; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_CALLED: - this.state = 1032; - this.kwCalled(); - break; - case CqlParser.K_RETURNS: - this.state = 1033; - this.kwReturns(); - this.state = 1034; - this.kwNull(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 1038; - this.kwOn(); - this.state = 1039; - this.kwNull(); - this.state = 1040; - this.kwInput(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createAggregate() { - let localctx = new CreateAggregateContext(this, this._ctx, this.state); - this.enterRule(localctx, 54, CqlParser.RULE_createAggregate); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1042; - this.kwCreate(); - this.state = 1044; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_OR) { - this.state = 1043; - this.orReplace(); - } - - this.state = 1046; - this.kwAggregate(); - this.state = 1048; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 45, this._ctx); - if (la_ === 1) { - this.state = 1047; - this.ifNotExist(); - } - this.state = 1053; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 46, this._ctx); - if (la_ === 1) { - this.state = 1050; - this.keyspace(); - this.state = 1051; - this.match(CqlParser.DOT); - } - this.state = 1055; - this.aggregate(); - this.state = 1056; - this.syntaxBracketLr(); - this.state = 1057; - this.dataType(); - this.state = 1058; - this.syntaxBracketRr(); - this.state = 1059; - this.kwSfunc(); - this.state = 1060; - this.functionStatement(); - this.state = 1061; - this.kwStype(); - this.state = 1062; - this.dataType(); - this.state = 1063; - this.kwFinalfunc(); - this.state = 1064; - this.functionStatement(); - this.state = 1065; - this.kwInitcond(); - this.state = 1066; - this.initCondDefinition(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - initCondDefinition() { - let localctx = new InitCondDefinitionContext(this, this._ctx, this.state); - this.enterRule(localctx, 56, CqlParser.RULE_initCondDefinition); - try { - this.state = 1072; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 47, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 1068; - this.constant(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 1069; - this.initCondList(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 1070; - this.initCondListNested(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 1071; - this.initCondHash(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - initCondHash() { - let localctx = new InitCondHashContext(this, this._ctx, this.state); - this.enterRule(localctx, 58, CqlParser.RULE_initCondHash); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1074; - this.syntaxBracketLc(); - this.state = 1075; - this.initCondHashItem(); - this.state = 1081; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1076; - this.syntaxComma(); - this.state = 1077; - this.initCondHashItem(); - this.state = 1083; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 1084; - this.syntaxBracketRc(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - initCondHashItem() { - let localctx = new InitCondHashItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 60, CqlParser.RULE_initCondHashItem); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1086; - this.hashKey(); - this.state = 1087; - this.match(CqlParser.COLON); - this.state = 1088; - this.initCondDefinition(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - initCondListNested() { - let localctx = new InitCondListNestedContext(this, this._ctx, this.state); - this.enterRule(localctx, 62, CqlParser.RULE_initCondListNested); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1090; - this.syntaxBracketLr(); - this.state = 1091; - this.initCondList(); - this.state = 1098; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.LR_BRACKET || _la === CqlParser.COMMA) { - this.state = 1096; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.COMMA: - this.state = 1092; - this.syntaxComma(); - this.state = 1093; - this.constant(); - break; - case CqlParser.LR_BRACKET: - this.state = 1095; - this.initCondList(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 1100; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 1101; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - initCondList() { - let localctx = new InitCondListContext(this, this._ctx, this.state); - this.enterRule(localctx, 64, CqlParser.RULE_initCondList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1103; - this.syntaxBracketLr(); - this.state = 1104; - this.constant(); - this.state = 1110; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1105; - this.syntaxComma(); - this.state = 1106; - this.constant(); - this.state = 1112; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 1113; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - orReplace() { - let localctx = new OrReplaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 66, CqlParser.RULE_orReplace); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1115; - this.kwOr(); - this.state = 1116; - this.kwReplace(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterUser() { - let localctx = new AlterUserContext(this, this._ctx, this.state); - this.enterRule(localctx, 68, CqlParser.RULE_alterUser); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1118; - this.kwAlter(); - this.state = 1119; - this.kwUser(); - this.state = 1120; - this.user(); - this.state = 1121; - this.kwWith(); - this.state = 1122; - this.userPassword(); - this.state = 1124; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_NOSUPERUSER || _la === CqlParser.K_SUPERUSER) { - this.state = 1123; - this.userSuperUser(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - userPassword() { - let localctx = new UserPasswordContext(this, this._ctx, this.state); - this.enterRule(localctx, 70, CqlParser.RULE_userPassword); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1126; - this.kwPassword(); - this.state = 1127; - this.stringLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - userSuperUser() { - let localctx = new UserSuperUserContext(this, this._ctx, this.state); - this.enterRule(localctx, 72, CqlParser.RULE_userSuperUser); - try { - this.state = 1131; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_SUPERUSER: - this.enterOuterAlt(localctx, 1); - this.state = 1129; - this.kwSuperuser(); - break; - case CqlParser.K_NOSUPERUSER: - this.enterOuterAlt(localctx, 2); - this.state = 1130; - this.kwNosuperuser(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterType() { - let localctx = new AlterTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 74, CqlParser.RULE_alterType); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1133; - this.kwAlter(); - this.state = 1134; - this.kwType(); - this.state = 1138; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 54, this._ctx); - if (la_ === 1) { - this.state = 1135; - this.keyspace(); - this.state = 1136; - this.match(CqlParser.DOT); - } - this.state = 1140; - this.type(); - this.state = 1141; - this.alterTypeOperation(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeOperation() { - let localctx = new AlterTypeOperationContext(this, this._ctx, this.state); - this.enterRule(localctx, 76, CqlParser.RULE_alterTypeOperation); - try { - this.state = 1146; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ALTER: - this.enterOuterAlt(localctx, 1); - this.state = 1143; - this.alterTypeAlterType(); - break; - case CqlParser.K_ADD: - this.enterOuterAlt(localctx, 2); - this.state = 1144; - this.alterTypeAdd(); - break; - case CqlParser.K_RENAME: - this.enterOuterAlt(localctx, 3); - this.state = 1145; - this.alterTypeRename(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeRename() { - let localctx = new AlterTypeRenameContext(this, this._ctx, this.state); - this.enterRule(localctx, 78, CqlParser.RULE_alterTypeRename); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1148; - this.kwRename(); - this.state = 1149; - this.alterTypeRenameList(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeRenameList() { - let localctx = new AlterTypeRenameListContext(this, this._ctx, this.state); - this.enterRule(localctx, 80, CqlParser.RULE_alterTypeRenameList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1151; - this.alterTypeRenameItem(); - this.state = 1157; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.K_AND) { - this.state = 1152; - this.kwAnd(); - this.state = 1153; - this.alterTypeRenameItem(); - this.state = 1159; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeRenameItem() { - let localctx = new AlterTypeRenameItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 82, CqlParser.RULE_alterTypeRenameItem); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1160; - this.column(); - this.state = 1161; - this.kwTo(); - this.state = 1162; - this.column(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeAdd() { - let localctx = new AlterTypeAddContext(this, this._ctx, this.state); - this.enterRule(localctx, 84, CqlParser.RULE_alterTypeAdd); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1164; - this.kwAdd(); - this.state = 1165; - this.typeMemberColumnList(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTypeAlterType() { - let localctx = new AlterTypeAlterTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 86, CqlParser.RULE_alterTypeAlterType); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1167; - this.kwAlter(); - this.state = 1168; - this.column(); - this.state = 1169; - this.kwType(); - this.state = 1170; - this.dataType(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTable() { - let localctx = new AlterTableContext(this, this._ctx, this.state); - this.enterRule(localctx, 88, CqlParser.RULE_alterTable); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1172; - this.kwAlter(); - this.state = 1173; - this.kwTable(); - this.state = 1177; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 57, this._ctx); - if (la_ === 1) { - this.state = 1174; - this.keyspace(); - this.state = 1175; - this.match(CqlParser.DOT); - } - this.state = 1179; - this.table(); - this.state = 1180; - this.alterTableOperation(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableOperation() { - let localctx = new AlterTableOperationContext(this, this._ctx, this.state); - this.enterRule(localctx, 90, CqlParser.RULE_alterTableOperation); - try { - this.state = 1188; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 58, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 1182; - this.alterTableAdd(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 1183; - this.alterTableDropColumns(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 1184; - this.alterTableDropColumns(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 1185; - this.alterTableDropCompactStorage(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 1186; - this.alterTableRename(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 1187; - this.alterTableWith(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableWith() { - let localctx = new AlterTableWithContext(this, this._ctx, this.state); - this.enterRule(localctx, 92, CqlParser.RULE_alterTableWith); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1190; - this.kwWith(); - this.state = 1191; - this.tableOptions(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableRename() { - let localctx = new AlterTableRenameContext(this, this._ctx, this.state); - this.enterRule(localctx, 94, CqlParser.RULE_alterTableRename); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1193; - this.kwRename(); - this.state = 1194; - this.column(); - this.state = 1195; - this.kwTo(); - this.state = 1196; - this.column(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableDropCompactStorage() { - let localctx = new AlterTableDropCompactStorageContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 96, CqlParser.RULE_alterTableDropCompactStorage); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1198; - this.kwDrop(); - this.state = 1199; - this.kwCompact(); - this.state = 1200; - this.kwStorage(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableDropColumns() { - let localctx = new AlterTableDropColumnsContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 98, CqlParser.RULE_alterTableDropColumns); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1202; - this.kwDrop(); - this.state = 1203; - this.alterTableDropColumnList(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableDropColumnList() { - let localctx = new AlterTableDropColumnListContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 100, CqlParser.RULE_alterTableDropColumnList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1205; - this.column(); - this.state = 1211; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1206; - this.syntaxComma(); - this.state = 1207; - this.column(); - this.state = 1213; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableAdd() { - let localctx = new AlterTableAddContext(this, this._ctx, this.state); - this.enterRule(localctx, 102, CqlParser.RULE_alterTableAdd); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1214; - this.kwAdd(); - this.state = 1215; - this.alterTableColumnDefinition(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterTableColumnDefinition() { - let localctx = new AlterTableColumnDefinitionContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 104, CqlParser.RULE_alterTableColumnDefinition); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1217; - this.column(); - this.state = 1218; - this.dataType(); - this.state = 1225; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1219; - this.syntaxComma(); - this.state = 1220; - this.column(); - this.state = 1221; - this.dataType(); - this.state = 1227; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterRole() { - let localctx = new AlterRoleContext(this, this._ctx, this.state); - this.enterRule(localctx, 106, CqlParser.RULE_alterRole); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1228; - this.kwAlter(); - this.state = 1229; - this.kwRole(); - this.state = 1230; - this.role(); - this.state = 1232; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 1231; - this.roleWith(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - roleWith() { - let localctx = new RoleWithContext(this, this._ctx, this.state); - this.enterRule(localctx, 108, CqlParser.RULE_roleWith); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1234; - this.kwWith(); - - this.state = 1235; - this.roleWithOptions(); - this.state = 1241; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.K_AND) { - this.state = 1236; - this.kwAnd(); - this.state = 1237; - this.roleWithOptions(); - this.state = 1243; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - roleWithOptions() { - let localctx = new RoleWithOptionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 110, CqlParser.RULE_roleWithOptions); - try { - this.state = 1260; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_PASSWORD: - this.enterOuterAlt(localctx, 1); - this.state = 1244; - this.kwPassword(); - this.state = 1245; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1246; - this.stringLiteral(); - break; - case CqlParser.K_LOGIN: - this.enterOuterAlt(localctx, 2); - this.state = 1248; - this.kwLogin(); - this.state = 1249; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1250; - this.booleanLiteral(); - break; - case CqlParser.K_SUPERUSER: - this.enterOuterAlt(localctx, 3); - this.state = 1252; - this.kwSuperuser(); - this.state = 1253; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1254; - this.booleanLiteral(); - break; - case CqlParser.K_OPTIONS: - this.enterOuterAlt(localctx, 4); - this.state = 1256; - this.kwOptions(); - this.state = 1257; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1258; - this.optionHash(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterMaterializedView() { - let localctx = new AlterMaterializedViewContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 112, CqlParser.RULE_alterMaterializedView); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1262; - this.kwAlter(); - this.state = 1263; - this.kwMaterialized(); - this.state = 1264; - this.kwView(); - this.state = 1268; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 64, this._ctx); - if (la_ === 1) { - this.state = 1265; - this.keyspace(); - this.state = 1266; - this.match(CqlParser.DOT); - } - this.state = 1270; - this.materializedView(); - this.state = 1274; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 1271; - this.kwWith(); - this.state = 1272; - this.tableOptions(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropUser() { - let localctx = new DropUserContext(this, this._ctx, this.state); - this.enterRule(localctx, 114, CqlParser.RULE_dropUser); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1276; - this.kwDrop(); - this.state = 1277; - this.kwUser(); - this.state = 1279; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 66, this._ctx); - if (la_ === 1) { - this.state = 1278; - this.ifExist(); - } - this.state = 1281; - this.user(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropType() { - let localctx = new DropTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 116, CqlParser.RULE_dropType); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1283; - this.kwDrop(); - this.state = 1284; - this.kwType(); - this.state = 1286; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 67, this._ctx); - if (la_ === 1) { - this.state = 1285; - this.ifExist(); - } - this.state = 1291; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 68, this._ctx); - if (la_ === 1) { - this.state = 1288; - this.keyspace(); - this.state = 1289; - this.match(CqlParser.DOT); - } - this.state = 1293; - this.type(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropMaterializedView() { - let localctx = new DropMaterializedViewContext(this, this._ctx, this.state); - this.enterRule(localctx, 118, CqlParser.RULE_dropMaterializedView); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1295; - this.kwDrop(); - this.state = 1296; - this.kwMaterialized(); - this.state = 1297; - this.kwView(); - this.state = 1299; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 69, this._ctx); - if (la_ === 1) { - this.state = 1298; - this.ifExist(); - } - this.state = 1304; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 70, this._ctx); - if (la_ === 1) { - this.state = 1301; - this.keyspace(); - this.state = 1302; - this.match(CqlParser.DOT); - } - this.state = 1306; - this.materializedView(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropAggregate() { - let localctx = new DropAggregateContext(this, this._ctx, this.state); - this.enterRule(localctx, 120, CqlParser.RULE_dropAggregate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1308; - this.kwDrop(); - this.state = 1309; - this.kwAggregate(); - this.state = 1311; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 71, this._ctx); - if (la_ === 1) { - this.state = 1310; - this.ifExist(); - } - this.state = 1316; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 72, this._ctx); - if (la_ === 1) { - this.state = 1313; - this.keyspace(); - this.state = 1314; - this.match(CqlParser.DOT); - } - this.state = 1318; - this.aggregate(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropFunction() { - let localctx = new DropFunctionContext(this, this._ctx, this.state); - this.enterRule(localctx, 122, CqlParser.RULE_dropFunction); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1320; - this.kwDrop(); - this.state = 1321; - this.kwFunction(); - this.state = 1323; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 73, this._ctx); - if (la_ === 1) { - this.state = 1322; - this.ifExist(); - } - this.state = 1328; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 74, this._ctx); - if (la_ === 1) { - this.state = 1325; - this.keyspace(); - this.state = 1326; - this.match(CqlParser.DOT); - } - this.state = 1330; - this.functionStatement(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropTrigger() { - let localctx = new DropTriggerContext(this, this._ctx, this.state); - this.enterRule(localctx, 124, CqlParser.RULE_dropTrigger); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1332; - this.kwDrop(); - this.state = 1333; - this.kwTrigger(); - this.state = 1335; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 75, this._ctx); - if (la_ === 1) { - this.state = 1334; - this.ifExist(); - } - this.state = 1337; - this.trigger(); - this.state = 1338; - this.kwOn(); - this.state = 1342; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 76, this._ctx); - if (la_ === 1) { - this.state = 1339; - this.keyspace(); - this.state = 1340; - this.match(CqlParser.DOT); - } - this.state = 1344; - this.table(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropRole() { - let localctx = new DropRoleContext(this, this._ctx, this.state); - this.enterRule(localctx, 126, CqlParser.RULE_dropRole); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1346; - this.kwDrop(); - this.state = 1347; - this.kwRole(); - this.state = 1349; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 77, this._ctx); - if (la_ === 1) { - this.state = 1348; - this.ifExist(); - } - this.state = 1351; - this.role(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropTable() { - let localctx = new DropTableContext(this, this._ctx, this.state); - this.enterRule(localctx, 128, CqlParser.RULE_dropTable); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1353; - this.kwDrop(); - this.state = 1354; - this.kwTable(); - this.state = 1356; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 78, this._ctx); - if (la_ === 1) { - this.state = 1355; - this.ifExist(); - } - this.state = 1361; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 79, this._ctx); - if (la_ === 1) { - this.state = 1358; - this.keyspace(); - this.state = 1359; - this.match(CqlParser.DOT); - } - this.state = 1363; - this.table(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropKeyspace() { - let localctx = new DropKeyspaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 130, CqlParser.RULE_dropKeyspace); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1365; - this.kwDrop(); - this.state = 1366; - this.kwKeyspace(); - this.state = 1368; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 80, this._ctx); - if (la_ === 1) { - this.state = 1367; - this.ifExist(); - } - this.state = 1370; - this.keyspace(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dropIndex() { - let localctx = new DropIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 132, CqlParser.RULE_dropIndex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1372; - this.kwDrop(); - this.state = 1373; - this.kwIndex(); - this.state = 1375; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 81, this._ctx); - if (la_ === 1) { - this.state = 1374; - this.ifExist(); - } - this.state = 1380; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 82, this._ctx); - if (la_ === 1) { - this.state = 1377; - this.keyspace(); - this.state = 1378; - this.match(CqlParser.DOT); - } - this.state = 1382; - this.indexName(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createTable() { - let localctx = new CreateTableContext(this, this._ctx, this.state); - this.enterRule(localctx, 134, CqlParser.RULE_createTable); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1384; - this.kwCreate(); - this.state = 1385; - this.kwTable(); - this.state = 1387; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 83, this._ctx); - if (la_ === 1) { - this.state = 1386; - this.ifNotExist(); - } - this.state = 1392; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 84, this._ctx); - if (la_ === 1) { - this.state = 1389; - this.keyspace(); - this.state = 1390; - this.match(CqlParser.DOT); - } - this.state = 1394; - this.table(); - this.state = 1395; - this.syntaxBracketLr(); - this.state = 1396; - this.columnDefinitionList(); - this.state = 1397; - this.syntaxBracketRr(); - this.state = 1399; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 1398; - this.withElement(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - withElement() { - let localctx = new WithElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 136, CqlParser.RULE_withElement); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1401; - this.kwWith(); - this.state = 1403; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 23) & ~0x1f) == 0 && - ((1 << (_la - 23)) & - ((1 << (CqlParser.K_ADD - 23)) | - (1 << (CqlParser.K_ALL - 23)) | - (1 << (CqlParser.K_ALLOW - 23)) | - (1 << (CqlParser.K_ALTER - 23)) | - (1 << (CqlParser.K_AND - 23)) | - (1 << (CqlParser.K_ANY - 23)) | - (1 << (CqlParser.K_APPLY - 23)) | - (1 << (CqlParser.K_AS - 23)) | - (1 << (CqlParser.K_ASC - 23)) | - (1 << (CqlParser.K_AUTHORIZE - 23)) | - (1 << (CqlParser.K_BATCH - 23)) | - (1 << (CqlParser.K_BEGIN - 23)) | - (1 << (CqlParser.K_BY - 23)) | - (1 << (CqlParser.K_CALLED - 23)) | - (1 << (CqlParser.K_CLUSTERING - 23)) | - (1 << (CqlParser.K_COLUMNFAMILY - 23)) | - (1 << (CqlParser.K_COMPACT - 23)) | - (1 << (CqlParser.K_CONSISTENCY - 23)) | - (1 << (CqlParser.K_CONTAINS - 23)) | - (1 << (CqlParser.K_CREATE - 23)) | - (1 << (CqlParser.K_CUSTOM - 23)) | - (1 << (CqlParser.K_DELETE - 23)) | - (1 << (CqlParser.K_DESC - 23)) | - (1 << (CqlParser.K_DESCRIBE - 23)) | - (1 << (CqlParser.K_DISTINCT - 23)) | - (1 << (CqlParser.K_DROP - 23)) | - (1 << (CqlParser.K_DURABLE_WRITES - 23)) | - (1 << (CqlParser.K_EACH_QUORUM - 23)) | - (1 << (CqlParser.K_ENTRIES - 23)) | - (1 << (CqlParser.K_EXECUTE - 23)))) !== - 0) || - (((_la - 55) & ~0x1f) == 0 && - ((1 << (_la - 55)) & - ((1 << (CqlParser.K_EXISTS - 55)) | - (1 << (CqlParser.K_FALSE - 55)) | - (1 << (CqlParser.K_FILTERING - 55)) | - (1 << (CqlParser.K_FINALFUNC - 55)) | - (1 << (CqlParser.K_FROM - 55)) | - (1 << (CqlParser.K_FULL - 55)) | - (1 << (CqlParser.K_FUNCTION - 55)) | - (1 << (CqlParser.K_FUNCTIONS - 55)) | - (1 << (CqlParser.K_GRANT - 55)) | - (1 << (CqlParser.K_IF - 55)) | - (1 << (CqlParser.K_IN - 55)) | - (1 << (CqlParser.K_INDEX - 55)) | - (1 << (CqlParser.K_INFINITY - 55)) | - (1 << (CqlParser.K_INITCOND - 55)) | - (1 << (CqlParser.K_INPUT - 55)) | - (1 << (CqlParser.K_INSERT - 55)) | - (1 << (CqlParser.K_INTO - 55)) | - (1 << (CqlParser.K_IS - 55)) | - (1 << (CqlParser.K_JSON - 55)) | - (1 << (CqlParser.K_KEY - 55)) | - (1 << (CqlParser.K_KEYS - 55)) | - (1 << (CqlParser.K_KEYSPACE - 55)) | - (1 << (CqlParser.K_KEYSPACES - 55)) | - (1 << (CqlParser.K_LANGUAGE - 55)) | - (1 << (CqlParser.K_LEVEL - 55)) | - (1 << (CqlParser.K_LIMIT - 55)) | - (1 << (CqlParser.K_LOCAL_ONE - 55)) | - (1 << (CqlParser.K_LOCAL_QUORUM - 55)) | - (1 << (CqlParser.K_LOGGED - 55)) | - (1 << (CqlParser.K_LOGIN - 55)) | - (1 << (CqlParser.K_MATERIALIZED - 55)) | - (1 << (CqlParser.K_MODIFY - 55)))) !== - 0) || - (((_la - 87) & ~0x1f) == 0 && - ((1 << (_la - 87)) & - ((1 << (CqlParser.K_NAN - 87)) | - (1 << (CqlParser.K_NORECURSIVE - 87)) | - (1 << (CqlParser.K_NOSUPERUSER - 87)) | - (1 << (CqlParser.K_NOT - 87)) | - (1 << (CqlParser.K_NULL - 87)) | - (1 << (CqlParser.K_OF - 87)) | - (1 << (CqlParser.K_ON - 87)) | - (1 << (CqlParser.K_ONE - 87)) | - (1 << (CqlParser.K_OPTIONS - 87)) | - (1 << (CqlParser.K_OR - 87)) | - (1 << (CqlParser.K_ORDER - 87)) | - (1 << (CqlParser.K_PARTITION - 87)) | - (1 << (CqlParser.K_PASSWORD - 87)) | - (1 << (CqlParser.K_PER - 87)) | - (1 << (CqlParser.K_PERMISSION - 87)) | - (1 << (CqlParser.K_PERMISSIONS - 87)) | - (1 << (CqlParser.K_PRIMARY - 87)) | - (1 << (CqlParser.K_QUORUM - 87)) | - (1 << (CqlParser.K_RENAME - 87)) | - (1 << (CqlParser.K_REPLACE - 87)) | - (1 << (CqlParser.K_REPLICATION - 87)) | - (1 << (CqlParser.K_RETURNS - 87)) | - (1 << (CqlParser.K_REVOKE - 87)) | - (1 << (CqlParser.K_ROLE - 87)) | - (1 << (CqlParser.K_ROLES - 87)) | - (1 << (CqlParser.K_SCHEMA - 87)) | - (1 << (CqlParser.K_SELECT - 87)) | - (1 << (CqlParser.K_SET - 87)) | - (1 << (CqlParser.K_SFUNC - 87)))) !== - 0) || - (((_la - 119) & ~0x1f) == 0 && - ((1 << (_la - 119)) & - ((1 << (CqlParser.K_STATIC - 119)) | - (1 << (CqlParser.K_STORAGE - 119)) | - (1 << (CqlParser.K_STYPE - 119)) | - (1 << (CqlParser.K_SUPERUSER - 119)) | - (1 << (CqlParser.K_TABLE - 119)) | - (1 << (CqlParser.K_THREE - 119)) | - (1 << (CqlParser.K_TIMESTAMP - 119)) | - (1 << (CqlParser.K_TO - 119)) | - (1 << (CqlParser.K_TOKEN - 119)) | - (1 << (CqlParser.K_TRIGGER - 119)) | - (1 << (CqlParser.K_TRUE - 119)) | - (1 << (CqlParser.K_TRUNCATE - 119)) | - (1 << (CqlParser.K_TTL - 119)) | - (1 << (CqlParser.K_TWO - 119)) | - (1 << (CqlParser.K_TYPE - 119)) | - (1 << (CqlParser.K_UNLOGGED - 119)) | - (1 << (CqlParser.K_UPDATE - 119)) | - (1 << (CqlParser.K_USE - 119)) | - (1 << (CqlParser.K_USER - 119)) | - (1 << (CqlParser.K_USING - 119)) | - (1 << (CqlParser.K_UUID - 119)) | - (1 << (CqlParser.K_VALUES - 119)) | - (1 << (CqlParser.K_VIEW - 119)) | - (1 << (CqlParser.K_WHERE - 119)) | - (1 << (CqlParser.K_WITH - 119)) | - (1 << (CqlParser.K_WRITETIME - 119)) | - (1 << (CqlParser.K_ASCII - 119)))) !== - 0) || - (((_la - 191) & ~0x1f) == 0 && - ((1 << (_la - 191)) & - ((1 << (CqlParser.K_BIGINT - 191)) | - (1 << (CqlParser.K_BLOB - 191)) | - (1 << (CqlParser.K_BOOLEAN - 191)) | - (1 << (CqlParser.K_COUNTER - 191)) | - (1 << (CqlParser.K_DATE - 191)) | - (1 << (CqlParser.K_DECIMAL - 191)) | - (1 << (CqlParser.K_DOUBLE - 191)) | - (1 << (CqlParser.K_FLOAT - 191)) | - (1 << (CqlParser.K_FROZEN - 191)) | - (1 << (CqlParser.K_INET - 191)) | - (1 << (CqlParser.K_INT - 191)) | - (1 << (CqlParser.K_LIST - 191)) | - (1 << (CqlParser.K_MAP - 191)) | - (1 << (CqlParser.K_SMALLINT - 191)) | - (1 << (CqlParser.K_TEXT - 191)) | - (1 << (CqlParser.K_TIMEUUID - 191)) | - (1 << (CqlParser.K_TIME - 191)) | - (1 << (CqlParser.K_TINYINT - 191)) | - (1 << (CqlParser.K_TUPLE - 191)) | - (1 << (CqlParser.K_VARCHAR - 191)) | - (1 << (CqlParser.K_VARINT - 191)) | - (1 << (CqlParser.OBJECT_NAME - 191)))) !== - 0) || - _la === CqlParser.K_USERS || - _la === CqlParser.K_VECTOR - ) { - this.state = 1402; - this.tableOptions(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - clusteringOrderColumns() { - let localctx = new ClusteringOrderColumnsContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 138, CqlParser.RULE_clusteringOrderColumns); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1405; - this.column(); - this.state = 1407; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_ASC || _la === CqlParser.K_DESC) { - this.state = 1406; - this.orderDirection(); - } - - this.state = 1416; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1409; - this.syntaxComma(); - this.state = 1410; - this.column(); - this.state = 1412; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_ASC || _la === CqlParser.K_DESC) { - this.state = 1411; - this.orderDirection(); - } - - this.state = 1418; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - clusteringOrder() { - let localctx = new ClusteringOrderContext(this, this._ctx, this.state); - this.enterRule(localctx, 140, CqlParser.RULE_clusteringOrder); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1419; - this.kwClustering(); - this.state = 1420; - this.kwOrder(); - this.state = 1421; - this.kwBy(); - this.state = 1422; - this.syntaxBracketLr(); - this.state = 1423; - this.clusteringOrderColumns(); - this.state = 1424; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - tableOptions() { - let localctx = new TableOptionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 142, CqlParser.RULE_tableOptions); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1426; - this.tableOptionItem(); - this.state = 1432; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.K_AND) { - this.state = 1427; - this.kwAnd(); - this.state = 1428; - this.tableOptionItem(); - this.state = 1434; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - tableOptionItem() { - let localctx = new TableOptionItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 144, CqlParser.RULE_tableOptionItem); - try { - this.state = 1444; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 91, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 1435; - this.tableOptionName(); - this.state = 1436; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1437; - this.tableOptionValue(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 1439; - this.tableOptionName(); - this.state = 1440; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1441; - this.optionHash(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 1443; - this.clusteringOrder(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - tableOptionName() { - let localctx = new TableOptionNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 146, CqlParser.RULE_tableOptionName); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1446; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - tableOptionValue() { - let localctx = new TableOptionValueContext(this, this._ctx, this.state); - this.enterRule(localctx, 148, CqlParser.RULE_tableOptionValue); - try { - this.state = 1451; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.STRING_LITERAL: - this.enterOuterAlt(localctx, 1); - this.state = 1448; - this.stringLiteral(); - break; - case CqlParser.DECIMAL_LITERAL: - case CqlParser.FLOAT_LITERAL: - this.enterOuterAlt(localctx, 2); - this.state = 1449; - this.floatLiteral(); - break; - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 3); - this.state = 1450; - this.id(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - optionHash() { - let localctx = new OptionHashContext(this, this._ctx, this.state); - this.enterRule(localctx, 150, CqlParser.RULE_optionHash); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1453; - this.syntaxBracketLc(); - this.state = 1454; - this.optionHashItem(); - this.state = 1460; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1455; - this.syntaxComma(); - this.state = 1456; - this.optionHashItem(); - this.state = 1462; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 1463; - this.syntaxBracketRc(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - optionHashItem() { - let localctx = new OptionHashItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 152, CqlParser.RULE_optionHashItem); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1465; - this.optionHashKey(); - this.state = 1466; - this.match(CqlParser.COLON); - this.state = 1467; - this.optionHashValue(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - optionHashKey() { - let localctx = new OptionHashKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 154, CqlParser.RULE_optionHashKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1469; - this.stringLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - optionHashValue() { - let localctx = new OptionHashValueContext(this, this._ctx, this.state); - this.enterRule(localctx, 156, CqlParser.RULE_optionHashValue); - try { - this.state = 1474; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.STRING_LITERAL: - this.enterOuterAlt(localctx, 1); - this.state = 1471; - this.stringLiteral(); - break; - case CqlParser.K_FALSE: - case CqlParser.K_TRUE: - this.enterOuterAlt(localctx, 2); - this.state = 1472; - this.booleanLiteral(); - break; - case CqlParser.DECIMAL_LITERAL: - case CqlParser.FLOAT_LITERAL: - this.enterOuterAlt(localctx, 3); - this.state = 1473; - this.floatLiteral(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - columnDefinitionList() { - let localctx = new ColumnDefinitionListContext(this, this._ctx, this.state); - this.enterRule(localctx, 158, CqlParser.RULE_columnDefinitionList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1476; - this.columnDefinition(); - this.state = 1482; - this._errHandler.sync(this); - var _alt = this._interp.adaptivePredict(this._input, 95, this._ctx); - while (_alt != 2 && _alt != antlr4.atn.ATN.INVALID_ALT_NUMBER) { - if (_alt === 1) { - this.state = 1477; - this.syntaxComma(); - this.state = 1478; - this.columnDefinition(); - } - this.state = 1484; - this._errHandler.sync(this); - _alt = this._interp.adaptivePredict(this._input, 95, this._ctx); - } - - this.state = 1488; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1485; - this.syntaxComma(); - this.state = 1486; - this.primaryKeyElement(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - columnDefinition() { - let localctx = new ColumnDefinitionContext(this, this._ctx, this.state); - this.enterRule(localctx, 160, CqlParser.RULE_columnDefinition); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1490; - this.column(); - this.state = 1491; - this.dataType(); - this.state = 1493; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_PRIMARY) { - this.state = 1492; - this.primaryKeyColumn(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - primaryKeyColumn() { - let localctx = new PrimaryKeyColumnContext(this, this._ctx, this.state); - this.enterRule(localctx, 162, CqlParser.RULE_primaryKeyColumn); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1495; - this.kwPrimary(); - this.state = 1496; - this.kwKey(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - primaryKeyElement() { - let localctx = new PrimaryKeyElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 164, CqlParser.RULE_primaryKeyElement); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1498; - this.kwPrimary(); - this.state = 1499; - this.kwKey(); - this.state = 1500; - this.syntaxBracketLr(); - this.state = 1501; - this.primaryKeyDefinition(); - this.state = 1502; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - primaryKeyDefinition() { - let localctx = new PrimaryKeyDefinitionContext(this, this._ctx, this.state); - this.enterRule(localctx, 166, CqlParser.RULE_primaryKeyDefinition); - try { - this.state = 1507; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 98, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 1504; - this.singlePrimaryKey(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 1505; - this.compoundKey(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 1506; - this.compositeKey(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - singlePrimaryKey() { - let localctx = new SinglePrimaryKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 168, CqlParser.RULE_singlePrimaryKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1509; - this.column(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - compoundKey() { - let localctx = new CompoundKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 170, CqlParser.RULE_compoundKey); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1511; - this.partitionKey(); - this.state = 1515; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1512; - this.syntaxComma(); - this.state = 1513; - this.clusteringKeyList(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - compositeKey() { - let localctx = new CompositeKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 172, CqlParser.RULE_compositeKey); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1517; - this.syntaxBracketLr(); - this.state = 1518; - this.partitionKeyList(); - this.state = 1519; - this.syntaxBracketRr(); - this.state = 1523; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1520; - this.syntaxComma(); - this.state = 1521; - this.clusteringKeyList(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - partitionKeyList() { - let localctx = new PartitionKeyListContext(this, this._ctx, this.state); - this.enterRule(localctx, 174, CqlParser.RULE_partitionKeyList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1525; - this.partitionKey(); - this.state = 1531; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1526; - this.syntaxComma(); - this.state = 1527; - this.partitionKey(); - this.state = 1533; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - clusteringKeyList() { - let localctx = new ClusteringKeyListContext(this, this._ctx, this.state); - this.enterRule(localctx, 176, CqlParser.RULE_clusteringKeyList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1534; - this.clusteringKey(); - this.state = 1540; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1535; - this.syntaxComma(); - this.state = 1536; - this.clusteringKey(); - this.state = 1542; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - partitionKey() { - let localctx = new PartitionKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 178, CqlParser.RULE_partitionKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1543; - this.column(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - clusteringKey() { - let localctx = new ClusteringKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 180, CqlParser.RULE_clusteringKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1545; - this.column(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - applyBatch() { - let localctx = new ApplyBatchContext(this, this._ctx, this.state); - this.enterRule(localctx, 182, CqlParser.RULE_applyBatch); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1547; - this.kwApply(); - this.state = 1548; - this.kwBatch(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - beginBatch() { - let localctx = new BeginBatchContext(this, this._ctx, this.state); - this.enterRule(localctx, 184, CqlParser.RULE_beginBatch); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1550; - this.kwBegin(); - this.state = 1552; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_LOGGED || _la === CqlParser.K_UNLOGGED) { - this.state = 1551; - this.batchType(); - } - - this.state = 1554; - this.kwBatch(); - this.state = 1556; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_USING) { - this.state = 1555; - this.usingTimestampSpec(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - batchType() { - let localctx = new BatchTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 186, CqlParser.RULE_batchType); - try { - this.state = 1560; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_LOGGED: - this.enterOuterAlt(localctx, 1); - this.state = 1558; - this.kwLogged(); - break; - case CqlParser.K_UNLOGGED: - this.enterOuterAlt(localctx, 2); - this.state = 1559; - this.kwUnlogged(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - alterKeyspace() { - let localctx = new AlterKeyspaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 188, CqlParser.RULE_alterKeyspace); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1562; - this.kwAlter(); - this.state = 1563; - this.kwKeyspace(); - this.state = 1564; - this.keyspace(); - this.state = 1565; - this.kwWith(); - this.state = 1566; - this.kwReplication(); - this.state = 1567; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1568; - this.syntaxBracketLc(); - this.state = 1569; - this.replicationList(); - this.state = 1570; - this.syntaxBracketRc(); - this.state = 1574; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 1571; - this.kwAnd(); - this.state = 1572; - this.durableWrites(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - replicationList() { - let localctx = new ReplicationListContext(this, this._ctx, this.state); - this.enterRule(localctx, 190, CqlParser.RULE_replicationList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1576; - this.replicationListItem(); - this.state = 1582; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1577; - this.syntaxComma(); - this.state = 1578; - this.replicationListItem(); - this.state = 1584; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - replicationListItem() { - let localctx = new ReplicationListItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 192, CqlParser.RULE_replicationListItem); - try { - this.state = 1591; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 108, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 1585; - this.match(CqlParser.STRING_LITERAL); - this.state = 1586; - this.match(CqlParser.COLON); - this.state = 1587; - this.match(CqlParser.STRING_LITERAL); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 1588; - this.match(CqlParser.STRING_LITERAL); - this.state = 1589; - this.match(CqlParser.COLON); - this.state = 1590; - this.match(CqlParser.DECIMAL_LITERAL); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - durableWrites() { - let localctx = new DurableWritesContext(this, this._ctx, this.state); - this.enterRule(localctx, 194, CqlParser.RULE_durableWrites); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1593; - this.kwDurableWrites(); - this.state = 1594; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1595; - this.booleanLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - use() { - let localctx = new UseContext(this, this._ctx, this.state); - this.enterRule(localctx, 196, CqlParser.RULE_use); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1597; - this.kwUse(); - this.state = 1598; - this.keyspace(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - truncate() { - let localctx = new TruncateContext(this, this._ctx, this.state); - this.enterRule(localctx, 198, CqlParser.RULE_truncate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 1600; - this.kwTruncate(); - this.state = 1602; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 109, this._ctx); - if (la_ === 1) { - this.state = 1601; - this.kwTable(); - } - this.state = 1607; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 110, this._ctx); - if (la_ === 1) { - this.state = 1604; - this.keyspace(); - this.state = 1605; - this.match(CqlParser.DOT); - } - this.state = 1609; - this.table(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createIndex() { - let localctx = new CreateIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 200, CqlParser.RULE_createIndex); - var _la = 0; // Token type - try { - this.state = 1668; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 120, this._ctx); - switch (la_) { - case 1: - localctx = new SecondaryIndexContext(this, localctx); - this.enterOuterAlt(localctx, 1); - this.state = 1611; - this.kwCreate(); - this.state = 1612; - this.kwIndex(); - this.state = 1614; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 111, this._ctx); - if (la_ === 1) { - this.state = 1613; - this.ifNotExist(); - } - this.state = 1617; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 112, this._ctx); - if (la_ === 1) { - this.state = 1616; - this.indexName(); - } - this.state = 1619; - this.kwOn(); - this.state = 1623; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 113, this._ctx); - if (la_ === 1) { - this.state = 1620; - this.keyspace(); - this.state = 1621; - this.match(CqlParser.DOT); - } - this.state = 1625; - this.table(); - this.state = 1626; - this.syntaxBracketLr(); - this.state = 1627; - this.indexColumnSpec(); - this.state = 1628; - this.syntaxBracketRr(); - break; - - case 2: - localctx = new CustomIndexContext(this, localctx); - this.enterOuterAlt(localctx, 2); - this.state = 1630; - this.kwCreate(); - this.state = 1631; - this.kwCustom(); - this.state = 1632; - this.kwIndex(); - this.state = 1634; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 114, this._ctx); - if (la_ === 1) { - this.state = 1633; - this.ifNotExist(); - } - this.state = 1637; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 115, this._ctx); - if (la_ === 1) { - this.state = 1636; - this.indexName(); - } - this.state = 1639; - this.kwOn(); - this.state = 1643; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 116, this._ctx); - if (la_ === 1) { - this.state = 1640; - this.keyspace(); - this.state = 1641; - this.match(CqlParser.DOT); - } - this.state = 1645; - this.table(); - this.state = 1646; - this.syntaxBracketLr(); - this.state = 1647; - this.indexColumnSpec(); - this.state = 1648; - this.syntaxBracketRr(); - this.state = 1649; - this.kwUsing(); - this.state = 1653; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_STORAGE_ATTACHED_INDEX: - this.state = 1650; - this.kwStorageAttachedIndex(); - break; - case CqlParser.K_SASI_INDEX: - this.state = 1651; - this.kwSASIIndex(); - break; - case CqlParser.K_SOLR_INDEX: - this.state = 1652; - this.kwSolrIndex(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 1666; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 1655; - this.kwWith(); - this.state = 1656; - this.kwOptions(); - this.state = 1657; - this.match(CqlParser.OPERATOR_EQ); - this.state = 1658; - this.match(CqlParser.LC_BRACKET); - this.state = 1660; - this._errHandler.sync(this); - _la = this._input.LA(1); - do { - this.state = 1659; - this.customIndexOption(); - this.state = 1662; - this._errHandler.sync(this); - _la = this._input.LA(1); - } while ( - ((_la - 145) & ~0x1f) == 0 && - ((1 << (_la - 145)) & - ((1 << (CqlParser.K_ASCII - 145)) | - (1 << (CqlParser.K_CASE_SENITIVE - 145)) | - (1 << (CqlParser.K_NORMALIZE - 145)) | - (1 << (CqlParser.K_SIMILARITY_FUNCTION - 145)) | - (1 << (CqlParser.K_ANALYZED - 145)) | - (1 << (CqlParser.K_IS_LITERAL - 145)) | - (1 << (CqlParser.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB - 145)) | - (1 << (CqlParser.K_TOKENIZATION_ENABLE_STEMMING - 145)) | - (1 << (CqlParser.K_TOKENIZATION_SKIP_STOP_WORDS - 145)) | - (1 << (CqlParser.K_TOKENIZATION_LOCALE - 145)) | - (1 << (CqlParser.K_TOKENIZATION_NORMALIZE_LOWERCASE - 145)) | - (1 << (CqlParser.K_TOKENIZATION_NORMALIZE_UPPERCASE - 145)) | - (1 << (CqlParser.K_NORMALIZE_LOWERCASE - 145)) | - (1 << (CqlParser.K_NORMALIZE_UPPERCASE - 145)) | - (1 << (CqlParser.K_MODE - 145)) | - (1 << (CqlParser.K_ANALYZER_CLASS - 145)))) !== - 0 - ); - this.state = 1664; - this.match(CqlParser.RC_BRACKET); - } - - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - customIndexOption() { - let localctx = new CustomIndexOptionContext(this, this._ctx, this.state); - this.enterRule(localctx, 202, CqlParser.RULE_customIndexOption); - var _la = 0; // Token type - try { - this.state = 1766; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_CASE_SENITIVE: - this.enterOuterAlt(localctx, 1); - this.state = 1670; - this.kwCaseSensitive(); - this.state = 1671; - this.match(CqlParser.COLON); - this.state = 1672; - localctx.caseSensitiveOption = this.booleanLiteral(); - this.state = 1674; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1673; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_NORMALIZE: - this.enterOuterAlt(localctx, 2); - this.state = 1676; - this.kwNormalize(); - this.state = 1677; - this.match(CqlParser.COLON); - this.state = 1678; - localctx.normalizeOption = this.booleanLiteral(); - this.state = 1680; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1679; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_ASCII: - this.enterOuterAlt(localctx, 3); - this.state = 1682; - this.kwAscii(); - this.state = 1683; - this.match(CqlParser.COLON); - this.state = 1684; - localctx.asciiOption = this.booleanLiteral(); - this.state = 1686; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1685; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_ANALYZED: - this.enterOuterAlt(localctx, 4); - this.state = 1688; - this.kwAnalyzed(); - this.state = 1689; - this.match(CqlParser.COLON); - this.state = 1690; - localctx.analyzedOption = this.booleanLiteral(); - this.state = 1692; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1691; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_IS_LITERAL: - this.enterOuterAlt(localctx, 5); - this.state = 1694; - this.kwIsLiteral(); - this.state = 1695; - this.match(CqlParser.COLON); - this.state = 1696; - localctx.isLiteralOption = this.booleanLiteral(); - this.state = 1698; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1697; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_TOKENIZATION_ENABLE_STEMMING: - this.enterOuterAlt(localctx, 6); - this.state = 1700; - this.kwTokenizationEnableStemming(); - this.state = 1701; - this.match(CqlParser.COLON); - this.state = 1702; - localctx.tokenizationEnableStemmingOption = this.booleanLiteral(); - this.state = 1704; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1703; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_TOKENIZATION_NORMALIZE_LOWERCASE: - this.enterOuterAlt(localctx, 7); - this.state = 1706; - this.kwTokenizationNormalizeLowercase(); - this.state = 1707; - this.match(CqlParser.COLON); - this.state = 1708; - localctx.tokenizationNormalizeLowercaseOption = this.booleanLiteral(); - this.state = 1710; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1709; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_TOKENIZATION_NORMALIZE_UPPERCASE: - this.enterOuterAlt(localctx, 8); - this.state = 1712; - this.kwTokenizationNormalizeUppercase(); - this.state = 1713; - this.match(CqlParser.COLON); - this.state = 1714; - localctx.tokenizationNormalizeUppercaseOption = this.booleanLiteral(); - this.state = 1716; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1715; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_NORMALIZE_UPPERCASE: - this.enterOuterAlt(localctx, 9); - this.state = 1718; - this.kwNormalizeUppercase(); - this.state = 1719; - this.match(CqlParser.COLON); - this.state = 1720; - localctx.normalizeUppercaseOption = this.booleanLiteral(); - this.state = 1722; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1721; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_NORMALIZE_LOWERCASE: - this.enterOuterAlt(localctx, 10); - this.state = 1724; - this.kwNormalizeLowercase(); - this.state = 1725; - this.match(CqlParser.COLON); - this.state = 1726; - localctx.normalizeLowercaseOption = this.booleanLiteral(); - this.state = 1728; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1727; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB: - this.enterOuterAlt(localctx, 11); - this.state = 1730; - this.kwMaxCompactionFlushMemoryInMb(); - this.state = 1731; - this.match(CqlParser.COLON); - this.state = 1732; - localctx.maxCompactionFlushMemoryInMbOption = this.stringLiteral(); - this.state = 1734; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1733; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_MODE: - this.enterOuterAlt(localctx, 12); - this.state = 1736; - this.kwMode(); - this.state = 1737; - this.match(CqlParser.COLON); - this.state = 1738; - localctx.modeOption = this.stringLiteral(); - this.state = 1740; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1739; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_ANALYZER_CLASS: - this.enterOuterAlt(localctx, 13); - this.state = 1742; - this.kwAnalyzerClass(); - this.state = 1743; - this.match(CqlParser.COLON); - this.state = 1744; - localctx.analyzerClassOption = this.stringLiteral(); - this.state = 1746; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1745; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_TOKENIZATION_LOCALE: - this.enterOuterAlt(localctx, 14); - this.state = 1748; - this.kwTokenizationLocale(); - this.state = 1749; - this.match(CqlParser.COLON); - this.state = 1750; - localctx.tokenizationLocaleOption = this.stringLiteral(); - this.state = 1752; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1751; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_TOKENIZATION_SKIP_STOP_WORDS: - this.enterOuterAlt(localctx, 15); - this.state = 1754; - this.kwTokenizationSkipStopWords(); - this.state = 1755; - this.match(CqlParser.COLON); - this.state = 1756; - localctx.tokenizationSkipStopWordsOption = this.stringLiteral(); - this.state = 1758; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1757; - this.match(CqlParser.COMMA); - } - - break; - case CqlParser.K_SIMILARITY_FUNCTION: - this.enterOuterAlt(localctx, 16); - this.state = 1760; - this.kwSimilarityFunction(); - this.state = 1761; - this.match(CqlParser.COLON); - this.state = 1762; - localctx.similarityFunctionOption = this.stringLiteral(); - this.state = 1764; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1763; - this.match(CqlParser.COMMA); - } - - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - createSearchIndex() { - let localctx = new CreateSearchIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 204, CqlParser.RULE_createSearchIndex); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1768; - this.kwCreate(); - this.state = 1769; - this.kwSearch(); - this.state = 1770; - this.kwIndex(); - this.state = 1772; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_IF) { - this.state = 1771; - this.ifNotExist(); - } - - this.state = 1774; - this.kwOn(); - this.state = 1778; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 139, this._ctx); - if (la_ === 1) { - this.state = 1775; - this.keyspace(); - this.state = 1776; - this.match(CqlParser.DOT); - } - this.state = 1780; - this.table(); - this.state = 1807; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WITH) { - this.state = 1781; - this.match(CqlParser.K_WITH); - this.state = 1785; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_COLUMNS) { - this.state = 1782; - this.kwColumns(); - this.state = 1783; - this.searchIndexColumnList(); - } - - this.state = 1793; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 142, this._ctx); - if (la_ === 1) { - this.state = 1788; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 1787; - this.kwAnd(); - } - - this.state = 1790; - this.kwProfiles(); - this.state = 1791; - this.searchIndexProfiles(); - } - this.state = 1799; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 144, this._ctx); - if (la_ === 1) { - this.state = 1796; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 1795; - this.kwAnd(); - } - - this.state = 1798; - this.searchIndexConfigs(); - } - this.state = 1805; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND || _la === CqlParser.K_OPTIONS) { - this.state = 1802; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AND) { - this.state = 1801; - this.kwAnd(); - } - - this.state = 1804; - this.searchIndexOptions(); - } - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexConfigs() { - let localctx = new SearchIndexConfigsContext(this, this._ctx, this.state); - this.enterRule(localctx, 206, CqlParser.RULE_searchIndexConfigs); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1809; - this.kwConfig(); - this.state = 1810; - this.match(CqlParser.LC_BRACKET); - this.state = 1815; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AUTOCOMMIT_TIME) { - this.state = 1811; - this.kwAutoCommitTime(); - this.state = 1812; - this.match(CqlParser.COLON); - this.state = 1813; - localctx.autoCommitTimeConfig = this.decimalLiteral(); - } - - this.state = 1824; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 150, this._ctx); - if (la_ === 1) { - this.state = 1818; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1817; - this.syntaxComma(); - } - - this.state = 1820; - this.kwDefaultQueryField(); - this.state = 1821; - this.match(CqlParser.COLON); - this.state = 1822; - localctx.defaultQueryFieldConfig = this.stringLiteral(); - } - this.state = 1833; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 152, this._ctx); - if (la_ === 1) { - this.state = 1827; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1826; - this.syntaxComma(); - } - - this.state = 1829; - this.kwDirectoryFactory(); - this.state = 1830; - this.match(CqlParser.COLON); - this.state = 1831; - localctx.directoryFactoryConfig = this.directoryFactory(); - } - this.state = 1842; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 154, this._ctx); - if (la_ === 1) { - this.state = 1836; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1835; - this.syntaxComma(); - } - - this.state = 1838; - this.kwFilterCacheLowWaterMark(); - this.state = 1839; - this.match(CqlParser.COLON); - this.state = 1840; - localctx.filterCacheLowWaterMarkConfig = this.decimalLiteral(); - } - this.state = 1851; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 156, this._ctx); - if (la_ === 1) { - this.state = 1845; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1844; - this.syntaxComma(); - } - - this.state = 1847; - this.kwFilterCacheHighWaterMark(); - this.state = 1848; - this.match(CqlParser.COLON); - this.state = 1849; - localctx.filterCacheHighWaterMarkConfig = this.decimalLiteral(); - } - this.state = 1860; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 158, this._ctx); - if (la_ === 1) { - this.state = 1854; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1853; - this.syntaxComma(); - } - - this.state = 1856; - this.kwDirectoryFactoryClass(); - this.state = 1857; - this.match(CqlParser.COLON); - this.state = 1858; - localctx.directoryFactoryClassConfig = this.stringLiteral(); - } - this.state = 1869; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 160, this._ctx); - if (la_ === 1) { - this.state = 1863; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1862; - this.syntaxComma(); - } - - this.state = 1865; - this.kwMergeMaxThreadCount(); - this.state = 1866; - this.match(CqlParser.COLON); - this.state = 1867; - localctx.mergeMaxThreadCountConfig = this.decimalLiteral(); - } - this.state = 1878; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 162, this._ctx); - if (la_ === 1) { - this.state = 1872; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1871; - this.syntaxComma(); - } - - this.state = 1874; - this.kwMergeMaxMergeCount(); - this.state = 1875; - this.match(CqlParser.COLON); - this.state = 1876; - localctx.mergeMaxMergeCountConfig = this.decimalLiteral(); - } - this.state = 1887; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 164, this._ctx); - if (la_ === 1) { - this.state = 1881; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1880; - this.syntaxComma(); - } - - this.state = 1883; - this.kwRamBufferSize(); - this.state = 1884; - this.match(CqlParser.COLON); - this.state = 1885; - localctx.ramBufferSizeConfig = this.decimalLiteral(); - } - this.state = 1896; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA || _la === CqlParser.K_REALTIME) { - this.state = 1890; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1889; - this.syntaxComma(); - } - - this.state = 1892; - this.kwRealtime(); - this.state = 1893; - this.match(CqlParser.COLON); - this.state = 1894; - localctx.realtimeConfig = this.booleanLiteral(); - } - - this.state = 1898; - this.match(CqlParser.RC_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - directoryFactory() { - let localctx = new DirectoryFactoryContext(this, this._ctx, this.state); - this.enterRule(localctx, 208, CqlParser.RULE_directoryFactory); - try { - this.state = 1902; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_STANDARD: - this.enterOuterAlt(localctx, 1); - this.state = 1900; - this.kwStandard(); - break; - case CqlParser.K_ENCRYPTED: - this.enterOuterAlt(localctx, 2); - this.state = 1901; - this.kwEncrypted(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexOptions() { - let localctx = new SearchIndexOptionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 210, CqlParser.RULE_searchIndexOptions); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1904; - this.kwOptions(); - this.state = 1905; - this.match(CqlParser.LC_BRACKET); - this.state = 1910; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_RECOVERY) { - this.state = 1906; - this.kwRecovery(); - this.state = 1907; - this.match(CqlParser.COLON); - this.state = 1908; - localctx.recoveryOption = this.booleanLiteral(); - } - - this.state = 1919; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 170, this._ctx); - if (la_ === 1) { - this.state = 1913; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1912; - this.syntaxComma(); - } - - this.state = 1915; - this.kwReindex(); - this.state = 1916; - this.match(CqlParser.COLON); - this.state = 1917; - localctx.reindexOption = this.booleanLiteral(); - } - this.state = 1928; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA || _la === CqlParser.K_LENIENT) { - this.state = 1922; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1921; - this.syntaxComma(); - } - - this.state = 1924; - this.kwLenient(); - this.state = 1925; - this.match(CqlParser.COLON); - this.state = 1926; - localctx.lenientOption = this.booleanLiteral(); - } - - this.state = 1930; - this.match(CqlParser.RC_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexProfile() { - let localctx = new SearchIndexProfileContext(this, this._ctx, this.state); - this.enterRule(localctx, 212, CqlParser.RULE_searchIndexProfile); - try { - this.state = 1936; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_SPACE_SAVING_ALL: - this.enterOuterAlt(localctx, 1); - this.state = 1932; - this.kwSpaceSavingAll(); - break; - case CqlParser.K_SPACE_SAVING_NO_JOIN: - this.enterOuterAlt(localctx, 2); - this.state = 1933; - this.kwSpaceSavingNoJoin(); - break; - case CqlParser.K_SPACE_SAVING_SLOW_TRIE_PRECISION: - this.enterOuterAlt(localctx, 3); - this.state = 1934; - this.kwSpaceSavingSlowTriePrecision(); - break; - case CqlParser.K_SPACE_SAVING_NO_TEXT_FIELD: - this.enterOuterAlt(localctx, 4); - this.state = 1935; - this.kwSpaceSavingNoTextField(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexProfiles() { - let localctx = new SearchIndexProfilesContext(this, this._ctx, this.state); - this.enterRule(localctx, 214, CqlParser.RULE_searchIndexProfiles); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1938; - this.searchIndexProfile(); - this.state = 1944; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1939; - this.syntaxComma(); - this.state = 1940; - this.searchIndexProfile(); - this.state = 1946; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexColumnList() { - let localctx = new SearchIndexColumnListContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 216, CqlParser.RULE_searchIndexColumnList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 1947; - this.searchIndexColumn(); - this.state = 1953; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 1948; - this.syntaxComma(); - this.state = 1949; - this.searchIndexColumn(); - this.state = 1955; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - searchIndexColumn() { - let localctx = new SearchIndexColumnContext(this, this._ctx, this.state); - this.enterRule(localctx, 218, CqlParser.RULE_searchIndexColumn); - var _la = 0; // Token type - try { - this.state = 2050; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.DQUOTE: - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 1); - this.state = 1956; - this.column(); - this.state = 2001; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.LC_BRACKET) { - this.state = 1957; - this.match(CqlParser.LC_BRACKET); - this.state = 1962; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_COPY_FIELD) { - this.state = 1958; - this.kwCopyField(); - this.state = 1959; - this.match(CqlParser.COLON); - this.state = 1960; - localctx.copyFieldOption = this.booleanLiteral(); - } - - this.state = 1971; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 178, this._ctx); - if (la_ === 1) { - this.state = 1965; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1964; - this.syntaxComma(); - } - - this.state = 1967; - this.kwDocValues(); - this.state = 1968; - this.match(CqlParser.COLON); - this.state = 1969; - localctx.docValuesOption = this.booleanLiteral(); - } - this.state = 1980; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 180, this._ctx); - if (la_ === 1) { - this.state = 1974; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1973; - this.syntaxComma(); - } - - this.state = 1976; - this.kwExcluded(); - this.state = 1977; - this.match(CqlParser.COLON); - this.state = 1978; - localctx.excludedOption = this.booleanLiteral(); - } - this.state = 1989; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 182, this._ctx); - if (la_ === 1) { - this.state = 1983; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1982; - this.syntaxComma(); - } - - this.state = 1985; - this.kwIndexed(); - this.state = 1986; - this.match(CqlParser.COLON); - this.state = 1987; - localctx.indexedOption = this.booleanLiteral(); - } - this.state = 1998; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA || _la === CqlParser.K_LOWERCASE) { - this.state = 1992; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 1991; - this.syntaxComma(); - } - - this.state = 1994; - this.kwLowerCase(); - this.state = 1995; - this.match(CqlParser.COLON); - this.state = 1996; - localctx.lowerCase = this.booleanLiteral(); - } - - this.state = 2000; - this.match(CqlParser.RC_BRACKET); - } - - break; - case CqlParser.STAR: - this.enterOuterAlt(localctx, 2); - this.state = 2003; - localctx.star = this.match(CqlParser.STAR); - this.state = 2048; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.LC_BRACKET) { - this.state = 2004; - this.match(CqlParser.LC_BRACKET); - this.state = 2009; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_COPY_FIELD) { - this.state = 2005; - this.kwCopyField(); - this.state = 2006; - this.match(CqlParser.COLON); - this.state = 2007; - localctx.copyFieldOption = this.booleanLiteral(); - } - - this.state = 2018; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 188, this._ctx); - if (la_ === 1) { - this.state = 2012; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 2011; - this.syntaxComma(); - } - - this.state = 2014; - this.kwDocValues(); - this.state = 2015; - this.match(CqlParser.COLON); - this.state = 2016; - localctx.docValuesOption = this.booleanLiteral(); - } - this.state = 2027; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 190, this._ctx); - if (la_ === 1) { - this.state = 2021; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 2020; - this.syntaxComma(); - } - - this.state = 2023; - this.kwExcluded(); - this.state = 2024; - this.match(CqlParser.COLON); - this.state = 2025; - localctx.excludedOption = this.booleanLiteral(); - } - this.state = 2036; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 192, this._ctx); - if (la_ === 1) { - this.state = 2030; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 2029; - this.syntaxComma(); - } - - this.state = 2032; - this.kwIndexed(); - this.state = 2033; - this.match(CqlParser.COLON); - this.state = 2034; - localctx.indexedOption = this.booleanLiteral(); - } - this.state = 2045; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA || _la === CqlParser.K_LOWERCASE) { - this.state = 2039; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.COMMA) { - this.state = 2038; - this.syntaxComma(); - } - - this.state = 2041; - this.kwLowerCase(); - this.state = 2042; - this.match(CqlParser.COLON); - this.state = 2043; - localctx.lowerCase = this.booleanLiteral(); - } - - this.state = 2047; - this.match(CqlParser.RC_BRACKET); - } - - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexName() { - let localctx = new IndexNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 220, CqlParser.RULE_indexName); - try { - this.state = 2054; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 1); - this.state = 2052; - this.id(); - break; - case CqlParser.STRING_LITERAL: - this.enterOuterAlt(localctx, 2); - this.state = 2053; - this.stringLiteral(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexColumnSpec() { - let localctx = new IndexColumnSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 222, CqlParser.RULE_indexColumnSpec); - try { - this.state = 2061; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 198, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2056; - this.column(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2057; - this.indexKeysSpec(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2058; - this.indexEntriesSSpec(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2059; - this.indexFullSpec(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2060; - this.indexValuesSpec(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexKeysSpec() { - let localctx = new IndexKeysSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 224, CqlParser.RULE_indexKeysSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2063; - this.kwKeys(); - this.state = 2064; - this.syntaxBracketLr(); - this.state = 2065; - this.column(); - this.state = 2066; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexEntriesSSpec() { - let localctx = new IndexEntriesSSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 226, CqlParser.RULE_indexEntriesSSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2068; - this.kwEntries(); - this.state = 2069; - this.syntaxBracketLr(); - this.state = 2070; - this.column(); - this.state = 2071; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexFullSpec() { - let localctx = new IndexFullSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 228, CqlParser.RULE_indexFullSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2073; - this.kwFull(); - this.state = 2074; - this.syntaxBracketLr(); - this.state = 2075; - this.column(); - this.state = 2076; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - indexValuesSpec() { - let localctx = new IndexValuesSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 230, CqlParser.RULE_indexValuesSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2078; - this.kwValues(); - this.state = 2079; - this.syntaxBracketLr(); - this.state = 2080; - this.column(); - this.state = 2081; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - deleteStatement() { - let localctx = new DeleteStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 232, CqlParser.RULE_deleteStatement); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2084; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_BEGIN) { - this.state = 2083; - this.beginBatch(); - } - - this.state = 2086; - this.kwDelete(); - this.state = 2088; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 200, this._ctx); - if (la_ === 1) { - this.state = 2087; - this.deleteColumnList(); - } - this.state = 2090; - this.fromSpec(); - this.state = 2092; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_USING) { - this.state = 2091; - this.usingTimestampSpec(); - } - - this.state = 2094; - this.whereSpec(); - this.state = 2097; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 202, this._ctx); - if (la_ === 1) { - this.state = 2095; - this.ifExist(); - } else if (la_ === 2) { - this.state = 2096; - this.ifSpec(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - deleteColumnList() { - let localctx = new DeleteColumnListContext(this, this._ctx, this.state); - this.enterRule(localctx, 234, CqlParser.RULE_deleteColumnList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2099; - this.deleteColumnItem(); - this.state = 2105; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2100; - this.syntaxComma(); - this.state = 2101; - this.deleteColumnItem(); - this.state = 2107; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - deleteColumnItem() { - let localctx = new DeleteColumnItemContext(this, this._ctx, this.state); - this.enterRule(localctx, 236, CqlParser.RULE_deleteColumnItem); - try { - this.state = 2117; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 205, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2108; - this.id(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2109; - this.id(); - this.state = 2110; - this.match(CqlParser.LS_BRACKET); - this.state = 2113; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.STRING_LITERAL: - this.state = 2111; - this.stringLiteral(); - break; - case CqlParser.DECIMAL_LITERAL: - this.state = 2112; - this.decimalLiteral(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 2115; - this.match(CqlParser.RS_BRACKET); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - update() { - let localctx = new UpdateContext(this, this._ctx, this.state); - this.enterRule(localctx, 238, CqlParser.RULE_update); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2120; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_BEGIN) { - this.state = 2119; - this.beginBatch(); - } - - this.state = 2122; - this.kwUpdate(); - this.state = 2126; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 207, this._ctx); - if (la_ === 1) { - this.state = 2123; - this.keyspace(); - this.state = 2124; - this.match(CqlParser.DOT); - } - this.state = 2128; - this.table(); - this.state = 2130; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_USING) { - this.state = 2129; - this.usingTtlTimestamp(); - } - - this.state = 2132; - this.kwSet(); - this.state = 2133; - this.assignments(); - this.state = 2134; - this.whereSpec(); - this.state = 2137; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 209, this._ctx); - if (la_ === 1) { - this.state = 2135; - this.ifExist(); - } else if (la_ === 2) { - this.state = 2136; - this.ifSpec(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ifSpec() { - let localctx = new IfSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 240, CqlParser.RULE_ifSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2139; - this.kwIf(); - this.state = 2140; - this.ifConditionList(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ifConditionList() { - let localctx = new IfConditionListContext(this, this._ctx, this.state); - this.enterRule(localctx, 242, CqlParser.RULE_ifConditionList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2142; - this.ifCondition(); - this.state = 2148; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.K_AND) { - this.state = 2143; - this.kwAnd(); - this.state = 2144; - this.ifCondition(); - this.state = 2150; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ifCondition() { - let localctx = new IfConditionContext(this, this._ctx, this.state); - this.enterRule(localctx, 244, CqlParser.RULE_ifCondition); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2151; - this.id(); - this.state = 2152; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2153; - this.constant(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignments() { - let localctx = new AssignmentsContext(this, this._ctx, this.state); - this.enterRule(localctx, 246, CqlParser.RULE_assignments); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2155; - this.assignmentElement(); - this.state = 2161; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2156; - this.syntaxComma(); - this.state = 2157; - this.assignmentElement(); - this.state = 2163; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentElement() { - let localctx = new AssignmentElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 248, CqlParser.RULE_assignmentElement); - var _la = 0; // Token type - try { - this.state = 2221; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 213, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2164; - this.id(); - this.state = 2165; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2170; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 212, this._ctx); - switch (la_) { - case 1: - this.state = 2166; - this.constant(); - break; - - case 2: - this.state = 2167; - this.assignmentMap(); - break; - - case 3: - this.state = 2168; - this.assignmentSet(); - break; - - case 4: - this.state = 2169; - this.assignmentList(); - break; - } - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2172; - this.id(); - this.state = 2173; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2174; - this.id(); - this.state = 2175; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2176; - this.decimalLiteral(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2178; - this.id(); - this.state = 2179; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2180; - this.id(); - this.state = 2181; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2182; - this.assignmentSet(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2184; - this.id(); - this.state = 2185; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2186; - this.assignmentSet(); - this.state = 2187; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2188; - this.id(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2190; - this.id(); - this.state = 2191; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2192; - this.id(); - this.state = 2193; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2194; - this.assignmentMap(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 2196; - this.id(); - this.state = 2197; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2198; - this.assignmentMap(); - this.state = 2199; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2200; - this.id(); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 2202; - this.id(); - this.state = 2203; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2204; - this.id(); - this.state = 2205; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2206; - this.assignmentList(); - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 2208; - this.id(); - this.state = 2209; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2210; - this.assignmentList(); - this.state = 2211; - _la = this._input.LA(1); - if (!(_la === CqlParser.PLUS || _la === CqlParser.MINUS)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2212; - this.id(); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 2214; - this.id(); - this.state = 2215; - this.syntaxBracketLs(); - this.state = 2216; - this.decimalLiteral(); - this.state = 2217; - this.syntaxBracketRs(); - this.state = 2218; - this.match(CqlParser.OPERATOR_EQ); - this.state = 2219; - this.constant(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentSet() { - let localctx = new AssignmentSetContext(this, this._ctx, this.state); - this.enterRule(localctx, 250, CqlParser.RULE_assignmentSet); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2223; - this.syntaxBracketLc(); - this.state = 2233; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 23) & ~0x1f) == 0 && - ((1 << (_la - 23)) & - ((1 << (CqlParser.K_ADD - 23)) | - (1 << (CqlParser.K_ALL - 23)) | - (1 << (CqlParser.K_ALLOW - 23)) | - (1 << (CqlParser.K_ALTER - 23)) | - (1 << (CqlParser.K_AND - 23)) | - (1 << (CqlParser.K_ANY - 23)) | - (1 << (CqlParser.K_APPLY - 23)) | - (1 << (CqlParser.K_AS - 23)) | - (1 << (CqlParser.K_ASC - 23)) | - (1 << (CqlParser.K_AUTHORIZE - 23)) | - (1 << (CqlParser.K_BATCH - 23)) | - (1 << (CqlParser.K_BEGIN - 23)) | - (1 << (CqlParser.K_BY - 23)) | - (1 << (CqlParser.K_CALLED - 23)) | - (1 << (CqlParser.K_CLUSTERING - 23)) | - (1 << (CqlParser.K_COLUMNFAMILY - 23)) | - (1 << (CqlParser.K_COMPACT - 23)) | - (1 << (CqlParser.K_CONSISTENCY - 23)) | - (1 << (CqlParser.K_CONTAINS - 23)) | - (1 << (CqlParser.K_CREATE - 23)) | - (1 << (CqlParser.K_CUSTOM - 23)) | - (1 << (CqlParser.K_DELETE - 23)) | - (1 << (CqlParser.K_DESC - 23)) | - (1 << (CqlParser.K_DESCRIBE - 23)) | - (1 << (CqlParser.K_DISTINCT - 23)) | - (1 << (CqlParser.K_DROP - 23)) | - (1 << (CqlParser.K_DURABLE_WRITES - 23)) | - (1 << (CqlParser.K_EACH_QUORUM - 23)) | - (1 << (CqlParser.K_ENTRIES - 23)) | - (1 << (CqlParser.K_EXECUTE - 23)))) !== - 0) || - (((_la - 55) & ~0x1f) == 0 && - ((1 << (_la - 55)) & - ((1 << (CqlParser.K_EXISTS - 55)) | - (1 << (CqlParser.K_FALSE - 55)) | - (1 << (CqlParser.K_FILTERING - 55)) | - (1 << (CqlParser.K_FINALFUNC - 55)) | - (1 << (CqlParser.K_FROM - 55)) | - (1 << (CqlParser.K_FULL - 55)) | - (1 << (CqlParser.K_FUNCTION - 55)) | - (1 << (CqlParser.K_FUNCTIONS - 55)) | - (1 << (CqlParser.K_GRANT - 55)) | - (1 << (CqlParser.K_IF - 55)) | - (1 << (CqlParser.K_IN - 55)) | - (1 << (CqlParser.K_INDEX - 55)) | - (1 << (CqlParser.K_INFINITY - 55)) | - (1 << (CqlParser.K_INITCOND - 55)) | - (1 << (CqlParser.K_INPUT - 55)) | - (1 << (CqlParser.K_INSERT - 55)) | - (1 << (CqlParser.K_INTO - 55)) | - (1 << (CqlParser.K_IS - 55)) | - (1 << (CqlParser.K_JSON - 55)) | - (1 << (CqlParser.K_KEY - 55)) | - (1 << (CqlParser.K_KEYS - 55)) | - (1 << (CqlParser.K_KEYSPACE - 55)) | - (1 << (CqlParser.K_KEYSPACES - 55)) | - (1 << (CqlParser.K_LANGUAGE - 55)) | - (1 << (CqlParser.K_LEVEL - 55)) | - (1 << (CqlParser.K_LIMIT - 55)) | - (1 << (CqlParser.K_LOCAL_ONE - 55)) | - (1 << (CqlParser.K_LOCAL_QUORUM - 55)) | - (1 << (CqlParser.K_LOGGED - 55)) | - (1 << (CqlParser.K_LOGIN - 55)) | - (1 << (CqlParser.K_MATERIALIZED - 55)) | - (1 << (CqlParser.K_MODIFY - 55)))) !== - 0) || - (((_la - 87) & ~0x1f) == 0 && - ((1 << (_la - 87)) & - ((1 << (CqlParser.K_NAN - 87)) | - (1 << (CqlParser.K_NORECURSIVE - 87)) | - (1 << (CqlParser.K_NOSUPERUSER - 87)) | - (1 << (CqlParser.K_NOT - 87)) | - (1 << (CqlParser.K_NULL - 87)) | - (1 << (CqlParser.K_OF - 87)) | - (1 << (CqlParser.K_ON - 87)) | - (1 << (CqlParser.K_ONE - 87)) | - (1 << (CqlParser.K_OPTIONS - 87)) | - (1 << (CqlParser.K_OR - 87)) | - (1 << (CqlParser.K_ORDER - 87)) | - (1 << (CqlParser.K_PARTITION - 87)) | - (1 << (CqlParser.K_PASSWORD - 87)) | - (1 << (CqlParser.K_PER - 87)) | - (1 << (CqlParser.K_PERMISSION - 87)) | - (1 << (CqlParser.K_PERMISSIONS - 87)) | - (1 << (CqlParser.K_PRIMARY - 87)) | - (1 << (CqlParser.K_QUORUM - 87)) | - (1 << (CqlParser.K_RENAME - 87)) | - (1 << (CqlParser.K_REPLACE - 87)) | - (1 << (CqlParser.K_REPLICATION - 87)) | - (1 << (CqlParser.K_RETURNS - 87)) | - (1 << (CqlParser.K_REVOKE - 87)) | - (1 << (CqlParser.K_ROLE - 87)) | - (1 << (CqlParser.K_ROLES - 87)) | - (1 << (CqlParser.K_SCHEMA - 87)) | - (1 << (CqlParser.K_SELECT - 87)) | - (1 << (CqlParser.K_SET - 87)) | - (1 << (CqlParser.K_SFUNC - 87)))) !== - 0) || - (((_la - 119) & ~0x1f) == 0 && - ((1 << (_la - 119)) & - ((1 << (CqlParser.K_STATIC - 119)) | - (1 << (CqlParser.K_STORAGE - 119)) | - (1 << (CqlParser.K_STYPE - 119)) | - (1 << (CqlParser.K_SUPERUSER - 119)) | - (1 << (CqlParser.K_TABLE - 119)) | - (1 << (CqlParser.K_THREE - 119)) | - (1 << (CqlParser.K_TIMESTAMP - 119)) | - (1 << (CqlParser.K_TO - 119)) | - (1 << (CqlParser.K_TOKEN - 119)) | - (1 << (CqlParser.K_TRIGGER - 119)) | - (1 << (CqlParser.K_TRUE - 119)) | - (1 << (CqlParser.K_TRUNCATE - 119)) | - (1 << (CqlParser.K_TTL - 119)) | - (1 << (CqlParser.K_TWO - 119)) | - (1 << (CqlParser.K_TYPE - 119)) | - (1 << (CqlParser.K_UNLOGGED - 119)) | - (1 << (CqlParser.K_UPDATE - 119)) | - (1 << (CqlParser.K_USE - 119)) | - (1 << (CqlParser.K_USER - 119)) | - (1 << (CqlParser.K_USING - 119)) | - (1 << (CqlParser.K_UUID - 119)) | - (1 << (CqlParser.K_VALUES - 119)) | - (1 << (CqlParser.K_VIEW - 119)) | - (1 << (CqlParser.K_WHERE - 119)) | - (1 << (CqlParser.K_WITH - 119)) | - (1 << (CqlParser.K_WRITETIME - 119)) | - (1 << (CqlParser.K_ASCII - 119)))) !== - 0) || - (((_la - 191) & ~0x1f) == 0 && - ((1 << (_la - 191)) & - ((1 << (CqlParser.K_BIGINT - 191)) | - (1 << (CqlParser.K_BLOB - 191)) | - (1 << (CqlParser.K_BOOLEAN - 191)) | - (1 << (CqlParser.K_COUNTER - 191)) | - (1 << (CqlParser.K_DATE - 191)) | - (1 << (CqlParser.K_DECIMAL - 191)) | - (1 << (CqlParser.K_DOUBLE - 191)) | - (1 << (CqlParser.K_FLOAT - 191)) | - (1 << (CqlParser.K_FROZEN - 191)) | - (1 << (CqlParser.K_INET - 191)) | - (1 << (CqlParser.K_INT - 191)) | - (1 << (CqlParser.K_LIST - 191)) | - (1 << (CqlParser.K_MAP - 191)) | - (1 << (CqlParser.K_SMALLINT - 191)) | - (1 << (CqlParser.K_TEXT - 191)) | - (1 << (CqlParser.K_TIMEUUID - 191)) | - (1 << (CqlParser.K_TIME - 191)) | - (1 << (CqlParser.K_TINYINT - 191)) | - (1 << (CqlParser.K_TUPLE - 191)) | - (1 << (CqlParser.K_VARCHAR - 191)) | - (1 << (CqlParser.K_VARINT - 191)) | - (1 << (CqlParser.CODE_BLOCK - 191)) | - (1 << (CqlParser.STRING_LITERAL - 191)) | - (1 << (CqlParser.DECIMAL_LITERAL - 191)) | - (1 << (CqlParser.FLOAT_LITERAL - 191)) | - (1 << (CqlParser.HEXADECIMAL_LITERAL - 191)) | - (1 << (CqlParser.OBJECT_NAME - 191)) | - (1 << (CqlParser.UUID - 191)))) !== - 0) || - _la === CqlParser.K_USERS || - _la === CqlParser.K_VECTOR - ) { - this.state = 2224; - this.constant(); - this.state = 2230; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2225; - this.syntaxComma(); - this.state = 2226; - this.expression(); - this.state = 2232; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } - - this.state = 2235; - this.syntaxBracketRc(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentMap() { - let localctx = new AssignmentMapContext(this, this._ctx, this.state); - this.enterRule(localctx, 252, CqlParser.RULE_assignmentMap); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2237; - this.syntaxBracketLc(); - - this.state = 2238; - this.constant(); - this.state = 2239; - this.syntaxColon(); - this.state = 2240; - this.expression(); - this.state = 2249; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2242; - this.syntaxComma(); - this.state = 2243; - this.constant(); - this.state = 2244; - this.syntaxColon(); - this.state = 2245; - this.expression(); - this.state = 2251; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2252; - this.syntaxBracketRc(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentMapExpression() { - let localctx = new AssignmentMapExpressionContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 254, CqlParser.RULE_assignmentMapExpression); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2254; - this.syntaxBracketLc(); - this.state = 2255; - this.expression(); - this.state = 2261; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2256; - this.syntaxComma(); - this.state = 2257; - this.expression(); - this.state = 2263; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2264; - this.syntaxBracketRc(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentList() { - let localctx = new AssignmentListContext(this, this._ctx, this.state); - this.enterRule(localctx, 256, CqlParser.RULE_assignmentList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2266; - this.syntaxBracketLs(); - this.state = 2267; - this.constant(); - this.state = 2273; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2268; - this.syntaxComma(); - this.state = 2269; - this.expression(); - this.state = 2275; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2276; - this.syntaxBracketRs(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - assignmentTuple() { - let localctx = new AssignmentTupleContext(this, this._ctx, this.state); - this.enterRule(localctx, 258, CqlParser.RULE_assignmentTuple); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2278; - this.syntaxBracketLr(); - this.state = 2307; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 223, this._ctx); - switch (la_) { - case 1: - this.state = 2279; - this.expression(); - this.state = 2296; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 221, this._ctx); - switch (la_) { - case 1: - this.state = 2285; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2280; - this.syntaxComma(); - this.state = 2281; - this.expression(); - this.state = 2287; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - break; - - case 2: - this.state = 2293; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2288; - this.syntaxComma(); - this.state = 2289; - this.assignmentTuple(); - this.state = 2295; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - break; - } - break; - - case 2: - this.state = 2298; - this.assignmentTuple(); - this.state = 2304; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2299; - this.syntaxComma(); - this.state = 2300; - this.assignmentTuple(); - this.state = 2306; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - break; - } - this.state = 2309; - this.syntaxBracketRr(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - insert() { - let localctx = new InsertContext(this, this._ctx, this.state); - this.enterRule(localctx, 260, CqlParser.RULE_insert); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2312; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_BEGIN) { - this.state = 2311; - this.beginBatch(); - } - - this.state = 2314; - this.kwInsert(); - this.state = 2315; - this.kwInto(); - this.state = 2319; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 225, this._ctx); - if (la_ === 1) { - this.state = 2316; - this.keyspace(); - this.state = 2317; - this.match(CqlParser.DOT); - } - this.state = 2321; - this.table(); - this.state = 2323; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.LR_BRACKET) { - this.state = 2322; - this.insertColumnSpec(); - } - - this.state = 2325; - this.insertValuesSpec(); - this.state = 2327; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_IF) { - this.state = 2326; - this.ifNotExist(); - } - - this.state = 2330; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_USING) { - this.state = 2329; - this.usingTtlTimestamp(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - usingTtlTimestamp() { - let localctx = new UsingTtlTimestampContext(this, this._ctx, this.state); - this.enterRule(localctx, 262, CqlParser.RULE_usingTtlTimestamp); - try { - this.state = 2348; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 229, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2332; - this.kwUsing(); - this.state = 2333; - this.ttl(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2335; - this.kwUsing(); - this.state = 2336; - this.ttl(); - this.state = 2337; - this.kwAnd(); - this.state = 2338; - this.timestamp(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2340; - this.kwUsing(); - this.state = 2341; - this.timestamp(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2343; - this.kwUsing(); - this.state = 2344; - this.timestamp(); - this.state = 2345; - this.kwAnd(); - this.state = 2346; - this.ttl(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - timestamp() { - let localctx = new TimestampContext(this, this._ctx, this.state); - this.enterRule(localctx, 264, CqlParser.RULE_timestamp); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2350; - this.kwTimestamp(); - this.state = 2351; - this.decimalLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ttl() { - let localctx = new TtlContext(this, this._ctx, this.state); - this.enterRule(localctx, 266, CqlParser.RULE_ttl); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2353; - this.kwTtl(); - this.state = 2354; - this.decimalLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - usingTimestampSpec() { - let localctx = new UsingTimestampSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 268, CqlParser.RULE_usingTimestampSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2356; - this.kwUsing(); - this.state = 2357; - this.timestamp(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ifNotExist() { - let localctx = new IfNotExistContext(this, this._ctx, this.state); - this.enterRule(localctx, 270, CqlParser.RULE_ifNotExist); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2359; - this.kwIf(); - this.state = 2360; - this.kwNot(); - this.state = 2361; - this.kwExists(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - ifExist() { - let localctx = new IfExistContext(this, this._ctx, this.state); - this.enterRule(localctx, 272, CqlParser.RULE_ifExist); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2363; - this.kwIf(); - this.state = 2364; - this.kwExists(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - insertValuesSpec() { - let localctx = new InsertValuesSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 274, CqlParser.RULE_insertValuesSpec); - try { - this.state = 2374; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_VALUES: - this.enterOuterAlt(localctx, 1); - this.state = 2366; - this.kwValues(); - this.state = 2367; - this.match(CqlParser.LR_BRACKET); - this.state = 2368; - this.expressionList(); - this.state = 2369; - this.match(CqlParser.RR_BRACKET); - break; - case CqlParser.K_JSON: - this.enterOuterAlt(localctx, 2); - this.state = 2371; - this.kwJson(); - this.state = 2372; - this.constant(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - insertColumnSpec() { - let localctx = new InsertColumnSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 276, CqlParser.RULE_insertColumnSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2376; - this.match(CqlParser.LR_BRACKET); - this.state = 2377; - this.columnList(); - this.state = 2378; - this.match(CqlParser.RR_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - columnList() { - let localctx = new ColumnListContext(this, this._ctx, this.state); - this.enterRule(localctx, 278, CqlParser.RULE_columnList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2380; - this.column(); - this.state = 2386; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2381; - this.syntaxComma(); - this.state = 2382; - this.column(); - this.state = 2388; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - expressionList() { - let localctx = new ExpressionListContext(this, this._ctx, this.state); - this.enterRule(localctx, 280, CqlParser.RULE_expressionList); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2389; - this.expression(); - this.state = 2395; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2390; - this.syntaxComma(); - this.state = 2391; - this.expression(); - this.state = 2397; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - expression() { - let localctx = new ExpressionContext(this, this._ctx, this.state); - this.enterRule(localctx, 282, CqlParser.RULE_expression); - try { - this.state = 2404; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 233, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2398; - this.constant(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2399; - this.assignmentMap(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2400; - this.assignmentSet(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2401; - this.assignmentList(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2402; - this.assignmentTuple(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 2403; - this.assignmentMapExpression(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - select() { - let localctx = new SelectContext(this, this._ctx, this.state); - this.enterRule(localctx, 284, CqlParser.RULE_select); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2406; - this.kwSelect(); - this.state = 2408; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 234, this._ctx); - if (la_ === 1) { - this.state = 2407; - this.distinctSpec(); - } - this.state = 2411; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 235, this._ctx); - if (la_ === 1) { - this.state = 2410; - this.kwJson(); - } - this.state = 2413; - this.selectElements(); - this.state = 2414; - this.fromSpec(); - this.state = 2416; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_WHERE) { - this.state = 2415; - this.whereSpec(); - } - - this.state = 2419; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_ORDER) { - this.state = 2418; - this.orderSpec(); - } - - this.state = 2422; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_LIMIT) { - this.state = 2421; - this.limitSpec(); - } - - this.state = 2425; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_ALLOW) { - this.state = 2424; - this.allowFilteringSpec(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - allowFilteringSpec() { - let localctx = new AllowFilteringSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 286, CqlParser.RULE_allowFilteringSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2427; - this.kwAllow(); - this.state = 2428; - this.kwFiltering(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - limitSpec() { - let localctx = new LimitSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 288, CqlParser.RULE_limitSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2430; - this.kwLimit(); - this.state = 2431; - this.decimalLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - fromSpec() { - let localctx = new FromSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 290, CqlParser.RULE_fromSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2433; - this.kwFrom(); - this.state = 2434; - this.fromSpecElement(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - fromSpecElement() { - let localctx = new FromSpecElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 292, CqlParser.RULE_fromSpecElement); - try { - this.state = 2441; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 240, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2436; - this.id(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2437; - this.id(); - this.state = 2438; - this.match(CqlParser.DOT); - this.state = 2439; - this.id(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - orderSpec() { - let localctx = new OrderSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 294, CqlParser.RULE_orderSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2443; - this.kwOrder(); - this.state = 2444; - this.kwBy(); - this.state = 2445; - this.orderSpecElement(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - orderSpecElement() { - let localctx = new OrderSpecElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 296, CqlParser.RULE_orderSpecElement); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2447; - this.id(); - this.state = 2450; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ASC: - this.state = 2448; - this.kwAsc(); - break; - case CqlParser.K_DESC: - this.state = 2449; - this.kwDesc(); - break; - case CqlParser.EOF: - case CqlParser.SEMI: - case CqlParser.MINUSMINUS: - case CqlParser.K_ALLOW: - case CqlParser.K_LIMIT: - break; - default: - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - whereSpec() { - let localctx = new WhereSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 298, CqlParser.RULE_whereSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2452; - this.kwWhere(); - this.state = 2453; - this.relationElements(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - distinctSpec() { - let localctx = new DistinctSpecContext(this, this._ctx, this.state); - this.enterRule(localctx, 300, CqlParser.RULE_distinctSpec); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2455; - this.kwDistinct(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - selectElements() { - let localctx = new SelectElementsContext(this, this._ctx, this.state); - this.enterRule(localctx, 302, CqlParser.RULE_selectElements); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2459; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.STAR: - this.state = 2457; - localctx.star = this.match(CqlParser.STAR); - break; - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.state = 2458; - this.selectElement(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 2466; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2461; - this.syntaxComma(); - this.state = 2462; - this.selectElement(); - this.state = 2468; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - selectElement() { - let localctx = new SelectElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 304, CqlParser.RULE_selectElement); - var _la = 0; // Token type - try { - this.state = 2485; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 246, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2469; - this.id(); - this.state = 2470; - this.match(CqlParser.DOT); - this.state = 2471; - this.match(CqlParser.STAR); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2473; - this.id(); - this.state = 2477; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AS) { - this.state = 2474; - this.kwAs(); - this.state = 2475; - this.id(); - } - - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2479; - this.functionCall(); - this.state = 2483; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.K_AS) { - this.state = 2480; - this.kwAs(); - this.state = 2481; - this.id(); - } - - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - relationElements() { - let localctx = new RelationElementsContext(this, this._ctx, this.state); - this.enterRule(localctx, 306, CqlParser.RULE_relationElements); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2487; - this.relationElement(); - this.state = 2493; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.K_AND) { - this.state = 2488; - this.kwAnd(); - this.state = 2489; - this.relationElement(); - this.state = 2495; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - relationElement() { - let localctx = new RelationElementContext(this, this._ctx, this.state); - this.enterRule(localctx, 308, CqlParser.RULE_relationElement); - var _la = 0; // Token type - try { - this.state = 2569; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 253, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2496; - this.id(); - this.state = 2497; - _la = this._input.LA(1); - if ( - !( - ((_la - 220) & ~0x1f) == 0 && - ((1 << (_la - 220)) & - ((1 << (CqlParser.OPERATOR_EQ - 220)) | - (1 << (CqlParser.OPERATOR_LT - 220)) | - (1 << (CqlParser.OPERATOR_GT - 220)) | - (1 << (CqlParser.OPERATOR_LTE - 220)) | - (1 << (CqlParser.OPERATOR_GTE - 220)))) !== - 0 - ) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2498; - this.constant(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2500; - this.id(); - this.state = 2501; - this.match(CqlParser.DOT); - this.state = 2502; - this.id(); - this.state = 2503; - _la = this._input.LA(1); - if ( - !( - ((_la - 220) & ~0x1f) == 0 && - ((1 << (_la - 220)) & - ((1 << (CqlParser.OPERATOR_EQ - 220)) | - (1 << (CqlParser.OPERATOR_LT - 220)) | - (1 << (CqlParser.OPERATOR_GT - 220)) | - (1 << (CqlParser.OPERATOR_LTE - 220)) | - (1 << (CqlParser.OPERATOR_GTE - 220)))) !== - 0 - ) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2504; - this.constant(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2506; - this.functionCall(); - this.state = 2507; - _la = this._input.LA(1); - if ( - !( - ((_la - 220) & ~0x1f) == 0 && - ((1 << (_la - 220)) & - ((1 << (CqlParser.OPERATOR_EQ - 220)) | - (1 << (CqlParser.OPERATOR_LT - 220)) | - (1 << (CqlParser.OPERATOR_GT - 220)) | - (1 << (CqlParser.OPERATOR_LTE - 220)) | - (1 << (CqlParser.OPERATOR_GTE - 220)))) !== - 0 - ) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2508; - this.constant(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2510; - this.functionCall(); - this.state = 2511; - _la = this._input.LA(1); - if ( - !( - ((_la - 220) & ~0x1f) == 0 && - ((1 << (_la - 220)) & - ((1 << (CqlParser.OPERATOR_EQ - 220)) | - (1 << (CqlParser.OPERATOR_LT - 220)) | - (1 << (CqlParser.OPERATOR_GT - 220)) | - (1 << (CqlParser.OPERATOR_LTE - 220)) | - (1 << (CqlParser.OPERATOR_GTE - 220)))) !== - 0 - ) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - this.state = 2512; - this.functionCall(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2514; - this.id(); - this.state = 2515; - this.kwIn(); - this.state = 2516; - this.match(CqlParser.LR_BRACKET); - this.state = 2518; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 23) & ~0x1f) == 0 && - ((1 << (_la - 23)) & - ((1 << (CqlParser.K_ADD - 23)) | - (1 << (CqlParser.K_ALL - 23)) | - (1 << (CqlParser.K_ALLOW - 23)) | - (1 << (CqlParser.K_ALTER - 23)) | - (1 << (CqlParser.K_AND - 23)) | - (1 << (CqlParser.K_ANY - 23)) | - (1 << (CqlParser.K_APPLY - 23)) | - (1 << (CqlParser.K_AS - 23)) | - (1 << (CqlParser.K_ASC - 23)) | - (1 << (CqlParser.K_AUTHORIZE - 23)) | - (1 << (CqlParser.K_BATCH - 23)) | - (1 << (CqlParser.K_BEGIN - 23)) | - (1 << (CqlParser.K_BY - 23)) | - (1 << (CqlParser.K_CALLED - 23)) | - (1 << (CqlParser.K_CLUSTERING - 23)) | - (1 << (CqlParser.K_COLUMNFAMILY - 23)) | - (1 << (CqlParser.K_COMPACT - 23)) | - (1 << (CqlParser.K_CONSISTENCY - 23)) | - (1 << (CqlParser.K_CONTAINS - 23)) | - (1 << (CqlParser.K_CREATE - 23)) | - (1 << (CqlParser.K_CUSTOM - 23)) | - (1 << (CqlParser.K_DELETE - 23)) | - (1 << (CqlParser.K_DESC - 23)) | - (1 << (CqlParser.K_DESCRIBE - 23)) | - (1 << (CqlParser.K_DISTINCT - 23)) | - (1 << (CqlParser.K_DROP - 23)) | - (1 << (CqlParser.K_DURABLE_WRITES - 23)) | - (1 << (CqlParser.K_EACH_QUORUM - 23)) | - (1 << (CqlParser.K_ENTRIES - 23)) | - (1 << (CqlParser.K_EXECUTE - 23)))) !== - 0) || - (((_la - 55) & ~0x1f) == 0 && - ((1 << (_la - 55)) & - ((1 << (CqlParser.K_EXISTS - 55)) | - (1 << (CqlParser.K_FALSE - 55)) | - (1 << (CqlParser.K_FILTERING - 55)) | - (1 << (CqlParser.K_FINALFUNC - 55)) | - (1 << (CqlParser.K_FROM - 55)) | - (1 << (CqlParser.K_FULL - 55)) | - (1 << (CqlParser.K_FUNCTION - 55)) | - (1 << (CqlParser.K_FUNCTIONS - 55)) | - (1 << (CqlParser.K_GRANT - 55)) | - (1 << (CqlParser.K_IF - 55)) | - (1 << (CqlParser.K_IN - 55)) | - (1 << (CqlParser.K_INDEX - 55)) | - (1 << (CqlParser.K_INFINITY - 55)) | - (1 << (CqlParser.K_INITCOND - 55)) | - (1 << (CqlParser.K_INPUT - 55)) | - (1 << (CqlParser.K_INSERT - 55)) | - (1 << (CqlParser.K_INTO - 55)) | - (1 << (CqlParser.K_IS - 55)) | - (1 << (CqlParser.K_JSON - 55)) | - (1 << (CqlParser.K_KEY - 55)) | - (1 << (CqlParser.K_KEYS - 55)) | - (1 << (CqlParser.K_KEYSPACE - 55)) | - (1 << (CqlParser.K_KEYSPACES - 55)) | - (1 << (CqlParser.K_LANGUAGE - 55)) | - (1 << (CqlParser.K_LEVEL - 55)) | - (1 << (CqlParser.K_LIMIT - 55)) | - (1 << (CqlParser.K_LOCAL_ONE - 55)) | - (1 << (CqlParser.K_LOCAL_QUORUM - 55)) | - (1 << (CqlParser.K_LOGGED - 55)) | - (1 << (CqlParser.K_LOGIN - 55)) | - (1 << (CqlParser.K_MATERIALIZED - 55)) | - (1 << (CqlParser.K_MODIFY - 55)))) !== - 0) || - (((_la - 87) & ~0x1f) == 0 && - ((1 << (_la - 87)) & - ((1 << (CqlParser.K_NAN - 87)) | - (1 << (CqlParser.K_NORECURSIVE - 87)) | - (1 << (CqlParser.K_NOSUPERUSER - 87)) | - (1 << (CqlParser.K_NOT - 87)) | - (1 << (CqlParser.K_NULL - 87)) | - (1 << (CqlParser.K_OF - 87)) | - (1 << (CqlParser.K_ON - 87)) | - (1 << (CqlParser.K_ONE - 87)) | - (1 << (CqlParser.K_OPTIONS - 87)) | - (1 << (CqlParser.K_OR - 87)) | - (1 << (CqlParser.K_ORDER - 87)) | - (1 << (CqlParser.K_PARTITION - 87)) | - (1 << (CqlParser.K_PASSWORD - 87)) | - (1 << (CqlParser.K_PER - 87)) | - (1 << (CqlParser.K_PERMISSION - 87)) | - (1 << (CqlParser.K_PERMISSIONS - 87)) | - (1 << (CqlParser.K_PRIMARY - 87)) | - (1 << (CqlParser.K_QUORUM - 87)) | - (1 << (CqlParser.K_RENAME - 87)) | - (1 << (CqlParser.K_REPLACE - 87)) | - (1 << (CqlParser.K_REPLICATION - 87)) | - (1 << (CqlParser.K_RETURNS - 87)) | - (1 << (CqlParser.K_REVOKE - 87)) | - (1 << (CqlParser.K_ROLE - 87)) | - (1 << (CqlParser.K_ROLES - 87)) | - (1 << (CqlParser.K_SCHEMA - 87)) | - (1 << (CqlParser.K_SELECT - 87)) | - (1 << (CqlParser.K_SET - 87)) | - (1 << (CqlParser.K_SFUNC - 87)))) !== - 0) || - (((_la - 119) & ~0x1f) == 0 && - ((1 << (_la - 119)) & - ((1 << (CqlParser.K_STATIC - 119)) | - (1 << (CqlParser.K_STORAGE - 119)) | - (1 << (CqlParser.K_STYPE - 119)) | - (1 << (CqlParser.K_SUPERUSER - 119)) | - (1 << (CqlParser.K_TABLE - 119)) | - (1 << (CqlParser.K_THREE - 119)) | - (1 << (CqlParser.K_TIMESTAMP - 119)) | - (1 << (CqlParser.K_TO - 119)) | - (1 << (CqlParser.K_TOKEN - 119)) | - (1 << (CqlParser.K_TRIGGER - 119)) | - (1 << (CqlParser.K_TRUE - 119)) | - (1 << (CqlParser.K_TRUNCATE - 119)) | - (1 << (CqlParser.K_TTL - 119)) | - (1 << (CqlParser.K_TWO - 119)) | - (1 << (CqlParser.K_TYPE - 119)) | - (1 << (CqlParser.K_UNLOGGED - 119)) | - (1 << (CqlParser.K_UPDATE - 119)) | - (1 << (CqlParser.K_USE - 119)) | - (1 << (CqlParser.K_USER - 119)) | - (1 << (CqlParser.K_USING - 119)) | - (1 << (CqlParser.K_UUID - 119)) | - (1 << (CqlParser.K_VALUES - 119)) | - (1 << (CqlParser.K_VIEW - 119)) | - (1 << (CqlParser.K_WHERE - 119)) | - (1 << (CqlParser.K_WITH - 119)) | - (1 << (CqlParser.K_WRITETIME - 119)) | - (1 << (CqlParser.K_ASCII - 119)))) !== - 0) || - (((_la - 191) & ~0x1f) == 0 && - ((1 << (_la - 191)) & - ((1 << (CqlParser.K_BIGINT - 191)) | - (1 << (CqlParser.K_BLOB - 191)) | - (1 << (CqlParser.K_BOOLEAN - 191)) | - (1 << (CqlParser.K_COUNTER - 191)) | - (1 << (CqlParser.K_DATE - 191)) | - (1 << (CqlParser.K_DECIMAL - 191)) | - (1 << (CqlParser.K_DOUBLE - 191)) | - (1 << (CqlParser.K_FLOAT - 191)) | - (1 << (CqlParser.K_FROZEN - 191)) | - (1 << (CqlParser.K_INET - 191)) | - (1 << (CqlParser.K_INT - 191)) | - (1 << (CqlParser.K_LIST - 191)) | - (1 << (CqlParser.K_MAP - 191)) | - (1 << (CqlParser.K_SMALLINT - 191)) | - (1 << (CqlParser.K_TEXT - 191)) | - (1 << (CqlParser.K_TIMEUUID - 191)) | - (1 << (CqlParser.K_TIME - 191)) | - (1 << (CqlParser.K_TINYINT - 191)) | - (1 << (CqlParser.K_TUPLE - 191)) | - (1 << (CqlParser.K_VARCHAR - 191)) | - (1 << (CqlParser.K_VARINT - 191)) | - (1 << (CqlParser.CODE_BLOCK - 191)) | - (1 << (CqlParser.STRING_LITERAL - 191)) | - (1 << (CqlParser.DECIMAL_LITERAL - 191)) | - (1 << (CqlParser.FLOAT_LITERAL - 191)) | - (1 << (CqlParser.HEXADECIMAL_LITERAL - 191)) | - (1 << (CqlParser.OBJECT_NAME - 191)) | - (1 << (CqlParser.UUID - 191)))) !== - 0) || - _la === CqlParser.K_USERS || - _la === CqlParser.K_VECTOR - ) { - this.state = 2517; - this.functionArgs(); - } - - this.state = 2520; - this.match(CqlParser.RR_BRACKET); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 2522; - this.match(CqlParser.LR_BRACKET); - this.state = 2523; - this.id(); - this.state = 2529; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2524; - this.syntaxComma(); - this.state = 2525; - this.id(); - this.state = 2531; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2532; - this.match(CqlParser.RR_BRACKET); - this.state = 2533; - this.kwIn(); - this.state = 2534; - this.match(CqlParser.LR_BRACKET); - this.state = 2535; - this.assignmentTuple(); - this.state = 2541; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2536; - this.syntaxComma(); - this.state = 2537; - this.assignmentTuple(); - this.state = 2543; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2544; - this.match(CqlParser.RR_BRACKET); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 2546; - this.match(CqlParser.LR_BRACKET); - this.state = 2547; - this.id(); - this.state = 2553; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2548; - this.syntaxComma(); - this.state = 2549; - this.id(); - this.state = 2555; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2556; - this.match(CqlParser.RR_BRACKET); - this.state = 2557; - _la = this._input.LA(1); - if ( - !( - ((_la - 220) & ~0x1f) == 0 && - ((1 << (_la - 220)) & - ((1 << (CqlParser.OPERATOR_EQ - 220)) | - (1 << (CqlParser.OPERATOR_LT - 220)) | - (1 << (CqlParser.OPERATOR_GT - 220)) | - (1 << (CqlParser.OPERATOR_LTE - 220)) | - (1 << (CqlParser.OPERATOR_GTE - 220)))) !== - 0 - ) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - - this.state = 2558; - this.assignmentTuple(); - this.state = 2564; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2559; - this.syntaxComma(); - this.state = 2560; - this.assignmentTuple(); - this.state = 2566; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 2567; - this.relalationContainsKey(); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 2568; - this.relalationContains(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - relalationContains() { - let localctx = new RelalationContainsContext(this, this._ctx, this.state); - this.enterRule(localctx, 310, CqlParser.RULE_relalationContains); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2571; - this.id(); - this.state = 2572; - this.kwContains(); - this.state = 2573; - this.constant(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - relalationContainsKey() { - let localctx = new RelalationContainsKeyContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 312, CqlParser.RULE_relalationContainsKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2575; - this.id(); - - this.state = 2576; - this.kwContains(); - this.state = 2577; - this.kwKey(); - this.state = 2579; - this.constant(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - functionCall() { - let localctx = new FunctionCallContext(this, this._ctx, this.state); - this.enterRule(localctx, 314, CqlParser.RULE_functionCall); - var _la = 0; // Token type - try { - this.state = 2593; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 255, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2581; - this.id(); - this.state = 2582; - this.match(CqlParser.LR_BRACKET); - this.state = 2583; - this.match(CqlParser.STAR); - this.state = 2584; - this.match(CqlParser.RR_BRACKET); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2586; - this.id(); - this.state = 2587; - this.match(CqlParser.LR_BRACKET); - this.state = 2589; - this._errHandler.sync(this); - _la = this._input.LA(1); - if ( - (((_la - 23) & ~0x1f) == 0 && - ((1 << (_la - 23)) & - ((1 << (CqlParser.K_ADD - 23)) | - (1 << (CqlParser.K_ALL - 23)) | - (1 << (CqlParser.K_ALLOW - 23)) | - (1 << (CqlParser.K_ALTER - 23)) | - (1 << (CqlParser.K_AND - 23)) | - (1 << (CqlParser.K_ANY - 23)) | - (1 << (CqlParser.K_APPLY - 23)) | - (1 << (CqlParser.K_AS - 23)) | - (1 << (CqlParser.K_ASC - 23)) | - (1 << (CqlParser.K_AUTHORIZE - 23)) | - (1 << (CqlParser.K_BATCH - 23)) | - (1 << (CqlParser.K_BEGIN - 23)) | - (1 << (CqlParser.K_BY - 23)) | - (1 << (CqlParser.K_CALLED - 23)) | - (1 << (CqlParser.K_CLUSTERING - 23)) | - (1 << (CqlParser.K_COLUMNFAMILY - 23)) | - (1 << (CqlParser.K_COMPACT - 23)) | - (1 << (CqlParser.K_CONSISTENCY - 23)) | - (1 << (CqlParser.K_CONTAINS - 23)) | - (1 << (CqlParser.K_CREATE - 23)) | - (1 << (CqlParser.K_CUSTOM - 23)) | - (1 << (CqlParser.K_DELETE - 23)) | - (1 << (CqlParser.K_DESC - 23)) | - (1 << (CqlParser.K_DESCRIBE - 23)) | - (1 << (CqlParser.K_DISTINCT - 23)) | - (1 << (CqlParser.K_DROP - 23)) | - (1 << (CqlParser.K_DURABLE_WRITES - 23)) | - (1 << (CqlParser.K_EACH_QUORUM - 23)) | - (1 << (CqlParser.K_ENTRIES - 23)) | - (1 << (CqlParser.K_EXECUTE - 23)))) !== - 0) || - (((_la - 55) & ~0x1f) == 0 && - ((1 << (_la - 55)) & - ((1 << (CqlParser.K_EXISTS - 55)) | - (1 << (CqlParser.K_FALSE - 55)) | - (1 << (CqlParser.K_FILTERING - 55)) | - (1 << (CqlParser.K_FINALFUNC - 55)) | - (1 << (CqlParser.K_FROM - 55)) | - (1 << (CqlParser.K_FULL - 55)) | - (1 << (CqlParser.K_FUNCTION - 55)) | - (1 << (CqlParser.K_FUNCTIONS - 55)) | - (1 << (CqlParser.K_GRANT - 55)) | - (1 << (CqlParser.K_IF - 55)) | - (1 << (CqlParser.K_IN - 55)) | - (1 << (CqlParser.K_INDEX - 55)) | - (1 << (CqlParser.K_INFINITY - 55)) | - (1 << (CqlParser.K_INITCOND - 55)) | - (1 << (CqlParser.K_INPUT - 55)) | - (1 << (CqlParser.K_INSERT - 55)) | - (1 << (CqlParser.K_INTO - 55)) | - (1 << (CqlParser.K_IS - 55)) | - (1 << (CqlParser.K_JSON - 55)) | - (1 << (CqlParser.K_KEY - 55)) | - (1 << (CqlParser.K_KEYS - 55)) | - (1 << (CqlParser.K_KEYSPACE - 55)) | - (1 << (CqlParser.K_KEYSPACES - 55)) | - (1 << (CqlParser.K_LANGUAGE - 55)) | - (1 << (CqlParser.K_LEVEL - 55)) | - (1 << (CqlParser.K_LIMIT - 55)) | - (1 << (CqlParser.K_LOCAL_ONE - 55)) | - (1 << (CqlParser.K_LOCAL_QUORUM - 55)) | - (1 << (CqlParser.K_LOGGED - 55)) | - (1 << (CqlParser.K_LOGIN - 55)) | - (1 << (CqlParser.K_MATERIALIZED - 55)) | - (1 << (CqlParser.K_MODIFY - 55)))) !== - 0) || - (((_la - 87) & ~0x1f) == 0 && - ((1 << (_la - 87)) & - ((1 << (CqlParser.K_NAN - 87)) | - (1 << (CqlParser.K_NORECURSIVE - 87)) | - (1 << (CqlParser.K_NOSUPERUSER - 87)) | - (1 << (CqlParser.K_NOT - 87)) | - (1 << (CqlParser.K_NULL - 87)) | - (1 << (CqlParser.K_OF - 87)) | - (1 << (CqlParser.K_ON - 87)) | - (1 << (CqlParser.K_ONE - 87)) | - (1 << (CqlParser.K_OPTIONS - 87)) | - (1 << (CqlParser.K_OR - 87)) | - (1 << (CqlParser.K_ORDER - 87)) | - (1 << (CqlParser.K_PARTITION - 87)) | - (1 << (CqlParser.K_PASSWORD - 87)) | - (1 << (CqlParser.K_PER - 87)) | - (1 << (CqlParser.K_PERMISSION - 87)) | - (1 << (CqlParser.K_PERMISSIONS - 87)) | - (1 << (CqlParser.K_PRIMARY - 87)) | - (1 << (CqlParser.K_QUORUM - 87)) | - (1 << (CqlParser.K_RENAME - 87)) | - (1 << (CqlParser.K_REPLACE - 87)) | - (1 << (CqlParser.K_REPLICATION - 87)) | - (1 << (CqlParser.K_RETURNS - 87)) | - (1 << (CqlParser.K_REVOKE - 87)) | - (1 << (CqlParser.K_ROLE - 87)) | - (1 << (CqlParser.K_ROLES - 87)) | - (1 << (CqlParser.K_SCHEMA - 87)) | - (1 << (CqlParser.K_SELECT - 87)) | - (1 << (CqlParser.K_SET - 87)) | - (1 << (CqlParser.K_SFUNC - 87)))) !== - 0) || - (((_la - 119) & ~0x1f) == 0 && - ((1 << (_la - 119)) & - ((1 << (CqlParser.K_STATIC - 119)) | - (1 << (CqlParser.K_STORAGE - 119)) | - (1 << (CqlParser.K_STYPE - 119)) | - (1 << (CqlParser.K_SUPERUSER - 119)) | - (1 << (CqlParser.K_TABLE - 119)) | - (1 << (CqlParser.K_THREE - 119)) | - (1 << (CqlParser.K_TIMESTAMP - 119)) | - (1 << (CqlParser.K_TO - 119)) | - (1 << (CqlParser.K_TOKEN - 119)) | - (1 << (CqlParser.K_TRIGGER - 119)) | - (1 << (CqlParser.K_TRUE - 119)) | - (1 << (CqlParser.K_TRUNCATE - 119)) | - (1 << (CqlParser.K_TTL - 119)) | - (1 << (CqlParser.K_TWO - 119)) | - (1 << (CqlParser.K_TYPE - 119)) | - (1 << (CqlParser.K_UNLOGGED - 119)) | - (1 << (CqlParser.K_UPDATE - 119)) | - (1 << (CqlParser.K_USE - 119)) | - (1 << (CqlParser.K_USER - 119)) | - (1 << (CqlParser.K_USING - 119)) | - (1 << (CqlParser.K_UUID - 119)) | - (1 << (CqlParser.K_VALUES - 119)) | - (1 << (CqlParser.K_VIEW - 119)) | - (1 << (CqlParser.K_WHERE - 119)) | - (1 << (CqlParser.K_WITH - 119)) | - (1 << (CqlParser.K_WRITETIME - 119)) | - (1 << (CqlParser.K_ASCII - 119)))) !== - 0) || - (((_la - 191) & ~0x1f) == 0 && - ((1 << (_la - 191)) & - ((1 << (CqlParser.K_BIGINT - 191)) | - (1 << (CqlParser.K_BLOB - 191)) | - (1 << (CqlParser.K_BOOLEAN - 191)) | - (1 << (CqlParser.K_COUNTER - 191)) | - (1 << (CqlParser.K_DATE - 191)) | - (1 << (CqlParser.K_DECIMAL - 191)) | - (1 << (CqlParser.K_DOUBLE - 191)) | - (1 << (CqlParser.K_FLOAT - 191)) | - (1 << (CqlParser.K_FROZEN - 191)) | - (1 << (CqlParser.K_INET - 191)) | - (1 << (CqlParser.K_INT - 191)) | - (1 << (CqlParser.K_LIST - 191)) | - (1 << (CqlParser.K_MAP - 191)) | - (1 << (CqlParser.K_SMALLINT - 191)) | - (1 << (CqlParser.K_TEXT - 191)) | - (1 << (CqlParser.K_TIMEUUID - 191)) | - (1 << (CqlParser.K_TIME - 191)) | - (1 << (CqlParser.K_TINYINT - 191)) | - (1 << (CqlParser.K_TUPLE - 191)) | - (1 << (CqlParser.K_VARCHAR - 191)) | - (1 << (CqlParser.K_VARINT - 191)) | - (1 << (CqlParser.CODE_BLOCK - 191)) | - (1 << (CqlParser.STRING_LITERAL - 191)) | - (1 << (CqlParser.DECIMAL_LITERAL - 191)) | - (1 << (CqlParser.FLOAT_LITERAL - 191)) | - (1 << (CqlParser.HEXADECIMAL_LITERAL - 191)) | - (1 << (CqlParser.OBJECT_NAME - 191)) | - (1 << (CqlParser.UUID - 191)))) !== - 0) || - _la === CqlParser.K_USERS || - _la === CqlParser.K_VECTOR - ) { - this.state = 2588; - this.functionArgs(); - } - - this.state = 2591; - this.match(CqlParser.RR_BRACKET); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - functionArgs() { - let localctx = new FunctionArgsContext(this, this._ctx, this.state); - this.enterRule(localctx, 316, CqlParser.RULE_functionArgs); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2598; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 256, this._ctx); - switch (la_) { - case 1: - this.state = 2595; - this.constant(); - break; - - case 2: - this.state = 2596; - this.id(); - break; - - case 3: - this.state = 2597; - this.functionCall(); - break; - } - this.state = 2608; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2600; - this.syntaxComma(); - this.state = 2604; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 257, this._ctx); - switch (la_) { - case 1: - this.state = 2601; - this.constant(); - break; - - case 2: - this.state = 2602; - this.id(); - break; - - case 3: - this.state = 2603; - this.functionCall(); - break; - } - this.state = 2610; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - constant() { - let localctx = new ConstantContext(this, this._ctx, this.state); - this.enterRule(localctx, 318, CqlParser.RULE_constant); - try { - this.state = 2620; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 259, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2611; - this.match(CqlParser.UUID); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2612; - this.stringLiteral(); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2613; - this.decimalLiteral(); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2614; - this.floatLiteral(); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2615; - this.hexadecimalLiteral(); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 2616; - this.booleanLiteral(); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 2617; - this.codeBlock(); - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 2618; - this.kwNull(); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 2619; - this.id(); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - decimalLiteral() { - let localctx = new DecimalLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 320, CqlParser.RULE_decimalLiteral); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2622; - this.match(CqlParser.DECIMAL_LITERAL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - floatLiteral() { - let localctx = new FloatLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 322, CqlParser.RULE_floatLiteral); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2624; - _la = this._input.LA(1); - if ( - !(_la === CqlParser.DECIMAL_LITERAL || _la === CqlParser.FLOAT_LITERAL) - ) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - stringLiteral() { - let localctx = new StringLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 324, CqlParser.RULE_stringLiteral); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2626; - this.match(CqlParser.STRING_LITERAL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - booleanLiteral() { - let localctx = new BooleanLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 326, CqlParser.RULE_booleanLiteral); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2628; - _la = this._input.LA(1); - if (!(_la === CqlParser.K_FALSE || _la === CqlParser.K_TRUE)) { - this._errHandler.recoverInline(this); - } else { - this._errHandler.reportMatch(this); - this.consume(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - hexadecimalLiteral() { - let localctx = new HexadecimalLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 328, CqlParser.RULE_hexadecimalLiteral); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2630; - this.match(CqlParser.HEXADECIMAL_LITERAL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - keyspace() { - let localctx = new KeyspaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 330, CqlParser.RULE_keyspace); - try { - this.state = 2637; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 1); - this.state = 2632; - this.id(); - break; - case CqlParser.DQUOTE: - this.enterOuterAlt(localctx, 2); - this.state = 2633; - this.match(CqlParser.DQUOTE); - this.state = 2634; - this.id(); - this.state = 2635; - this.match(CqlParser.DQUOTE); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - table() { - let localctx = new TableContext(this, this._ctx, this.state); - this.enterRule(localctx, 332, CqlParser.RULE_table); - try { - this.state = 2644; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 1); - this.state = 2639; - this.id(); - break; - case CqlParser.DQUOTE: - this.enterOuterAlt(localctx, 2); - this.state = 2640; - this.match(CqlParser.DQUOTE); - this.state = 2641; - this.id(); - this.state = 2642; - this.match(CqlParser.DQUOTE); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - column() { - let localctx = new ColumnContext(this, this._ctx, this.state); - this.enterRule(localctx, 334, CqlParser.RULE_column); - try { - this.state = 2651; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 1); - this.state = 2646; - this.id(); - break; - case CqlParser.DQUOTE: - this.enterOuterAlt(localctx, 2); - this.state = 2647; - this.match(CqlParser.DQUOTE); - this.state = 2648; - this.id(); - this.state = 2649; - this.match(CqlParser.DQUOTE); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dataType() { - let localctx = new DataTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 336, CqlParser.RULE_dataType); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2653; - this.dataTypeName(); - this.state = 2655; - this._errHandler.sync(this); - _la = this._input.LA(1); - if (_la === CqlParser.OPERATOR_LT) { - this.state = 2654; - this.dataTypeDefinition(); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dataTypeName() { - let localctx = new DataTypeNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 338, CqlParser.RULE_dataTypeName); - try { - this.state = 2691; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 265, this._ctx); - switch (la_) { - case 1: - this.enterOuterAlt(localctx, 1); - this.state = 2660; - this._errHandler.sync(this); - var la_ = this._interp.adaptivePredict(this._input, 264, this._ctx); - if (la_ === 1) { - this.state = 2657; - this.keyspace(); - this.state = 2658; - this.match(CqlParser.DOT); - } - this.state = 2662; - this.type(); - break; - - case 2: - this.enterOuterAlt(localctx, 2); - this.state = 2663; - this.match(CqlParser.STRING_LITERAL); - break; - - case 3: - this.enterOuterAlt(localctx, 3); - this.state = 2664; - this.match(CqlParser.K_TIMESTAMP); - break; - - case 4: - this.enterOuterAlt(localctx, 4); - this.state = 2665; - this.match(CqlParser.K_SET); - break; - - case 5: - this.enterOuterAlt(localctx, 5); - this.state = 2666; - this.match(CqlParser.K_ASCII); - break; - - case 6: - this.enterOuterAlt(localctx, 6); - this.state = 2667; - this.match(CqlParser.K_BIGINT); - break; - - case 7: - this.enterOuterAlt(localctx, 7); - this.state = 2668; - this.match(CqlParser.K_BLOB); - break; - - case 8: - this.enterOuterAlt(localctx, 8); - this.state = 2669; - this.match(CqlParser.K_BOOLEAN); - break; - - case 9: - this.enterOuterAlt(localctx, 9); - this.state = 2670; - this.match(CqlParser.K_COUNTER); - break; - - case 10: - this.enterOuterAlt(localctx, 10); - this.state = 2671; - this.match(CqlParser.K_DATE); - break; - - case 11: - this.enterOuterAlt(localctx, 11); - this.state = 2672; - this.match(CqlParser.K_DECIMAL); - break; - - case 12: - this.enterOuterAlt(localctx, 12); - this.state = 2673; - this.match(CqlParser.K_DOUBLE); - break; - - case 13: - this.enterOuterAlt(localctx, 13); - this.state = 2674; - this.match(CqlParser.K_FLOAT); - break; - - case 14: - this.enterOuterAlt(localctx, 14); - this.state = 2675; - this.match(CqlParser.K_FROZEN); - break; - - case 15: - this.enterOuterAlt(localctx, 15); - this.state = 2676; - this.match(CqlParser.K_INET); - break; - - case 16: - this.enterOuterAlt(localctx, 16); - this.state = 2677; - this.match(CqlParser.K_INT); - break; - - case 17: - this.enterOuterAlt(localctx, 17); - this.state = 2678; - this.match(CqlParser.K_LIST); - break; - - case 18: - this.enterOuterAlt(localctx, 18); - this.state = 2679; - this.match(CqlParser.K_MAP); - break; - - case 19: - this.enterOuterAlt(localctx, 19); - this.state = 2680; - this.match(CqlParser.K_SMALLINT); - break; - - case 20: - this.enterOuterAlt(localctx, 20); - this.state = 2681; - this.match(CqlParser.K_TEXT); - break; - - case 21: - this.enterOuterAlt(localctx, 21); - this.state = 2682; - this.match(CqlParser.K_TIME); - break; - - case 22: - this.enterOuterAlt(localctx, 22); - this.state = 2683; - this.match(CqlParser.K_TIMEUUID); - break; - - case 23: - this.enterOuterAlt(localctx, 23); - this.state = 2684; - this.match(CqlParser.K_TINYINT); - break; - - case 24: - this.enterOuterAlt(localctx, 24); - this.state = 2685; - this.match(CqlParser.K_TUPLE); - break; - - case 25: - this.enterOuterAlt(localctx, 25); - this.state = 2686; - this.match(CqlParser.K_VARCHAR); - break; - - case 26: - this.enterOuterAlt(localctx, 26); - this.state = 2687; - this.match(CqlParser.K_VARINT); - break; - - case 27: - this.enterOuterAlt(localctx, 27); - this.state = 2688; - this.match(CqlParser.K_TIMESTAMP); - break; - - case 28: - this.enterOuterAlt(localctx, 28); - this.state = 2689; - this.match(CqlParser.K_UUID); - break; - - case 29: - this.enterOuterAlt(localctx, 29); - this.state = 2690; - this.match(CqlParser.K_VECTOR); - break; - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - dataTypeDefinition() { - let localctx = new DataTypeDefinitionContext(this, this._ctx, this.state); - this.enterRule(localctx, 340, CqlParser.RULE_dataTypeDefinition); - var _la = 0; // Token type - try { - this.enterOuterAlt(localctx, 1); - this.state = 2693; - this.syntaxBracketLa(); - this.state = 2694; - this.dataType(); - this.state = 2702; - this._errHandler.sync(this); - _la = this._input.LA(1); - while (_la === CqlParser.COMMA) { - this.state = 2695; - this.syntaxComma(); - this.state = 2698; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.DQUOTE: - case CqlParser.K_ADD: - case CqlParser.K_ALL: - case CqlParser.K_ALLOW: - case CqlParser.K_ALTER: - case CqlParser.K_AND: - case CqlParser.K_ANY: - case CqlParser.K_APPLY: - case CqlParser.K_AS: - case CqlParser.K_ASC: - case CqlParser.K_AUTHORIZE: - case CqlParser.K_BATCH: - case CqlParser.K_BEGIN: - case CqlParser.K_BY: - case CqlParser.K_CALLED: - case CqlParser.K_CLUSTERING: - case CqlParser.K_COLUMNFAMILY: - case CqlParser.K_COMPACT: - case CqlParser.K_CONSISTENCY: - case CqlParser.K_CONTAINS: - case CqlParser.K_CREATE: - case CqlParser.K_CUSTOM: - case CqlParser.K_DELETE: - case CqlParser.K_DESC: - case CqlParser.K_DESCRIBE: - case CqlParser.K_DISTINCT: - case CqlParser.K_DROP: - case CqlParser.K_DURABLE_WRITES: - case CqlParser.K_EACH_QUORUM: - case CqlParser.K_ENTRIES: - case CqlParser.K_EXECUTE: - case CqlParser.K_EXISTS: - case CqlParser.K_FALSE: - case CqlParser.K_FILTERING: - case CqlParser.K_FINALFUNC: - case CqlParser.K_FROM: - case CqlParser.K_FULL: - case CqlParser.K_FUNCTION: - case CqlParser.K_FUNCTIONS: - case CqlParser.K_GRANT: - case CqlParser.K_IF: - case CqlParser.K_IN: - case CqlParser.K_INDEX: - case CqlParser.K_INFINITY: - case CqlParser.K_INITCOND: - case CqlParser.K_INPUT: - case CqlParser.K_INSERT: - case CqlParser.K_INTO: - case CqlParser.K_IS: - case CqlParser.K_JSON: - case CqlParser.K_KEY: - case CqlParser.K_KEYS: - case CqlParser.K_KEYSPACE: - case CqlParser.K_KEYSPACES: - case CqlParser.K_LANGUAGE: - case CqlParser.K_LEVEL: - case CqlParser.K_LIMIT: - case CqlParser.K_LOCAL_ONE: - case CqlParser.K_LOCAL_QUORUM: - case CqlParser.K_LOGGED: - case CqlParser.K_LOGIN: - case CqlParser.K_MATERIALIZED: - case CqlParser.K_MODIFY: - case CqlParser.K_NAN: - case CqlParser.K_NORECURSIVE: - case CqlParser.K_NOSUPERUSER: - case CqlParser.K_NOT: - case CqlParser.K_NULL: - case CqlParser.K_OF: - case CqlParser.K_ON: - case CqlParser.K_ONE: - case CqlParser.K_OPTIONS: - case CqlParser.K_OR: - case CqlParser.K_ORDER: - case CqlParser.K_PARTITION: - case CqlParser.K_PASSWORD: - case CqlParser.K_PER: - case CqlParser.K_PERMISSION: - case CqlParser.K_PERMISSIONS: - case CqlParser.K_PRIMARY: - case CqlParser.K_QUORUM: - case CqlParser.K_RENAME: - case CqlParser.K_REPLACE: - case CqlParser.K_REPLICATION: - case CqlParser.K_RETURNS: - case CqlParser.K_REVOKE: - case CqlParser.K_ROLE: - case CqlParser.K_ROLES: - case CqlParser.K_SCHEMA: - case CqlParser.K_SELECT: - case CqlParser.K_SET: - case CqlParser.K_SFUNC: - case CqlParser.K_STATIC: - case CqlParser.K_STORAGE: - case CqlParser.K_STYPE: - case CqlParser.K_SUPERUSER: - case CqlParser.K_TABLE: - case CqlParser.K_THREE: - case CqlParser.K_TIMESTAMP: - case CqlParser.K_TO: - case CqlParser.K_TOKEN: - case CqlParser.K_TRIGGER: - case CqlParser.K_TRUE: - case CqlParser.K_TRUNCATE: - case CqlParser.K_TTL: - case CqlParser.K_TWO: - case CqlParser.K_TYPE: - case CqlParser.K_UNLOGGED: - case CqlParser.K_UPDATE: - case CqlParser.K_USE: - case CqlParser.K_USER: - case CqlParser.K_USING: - case CqlParser.K_UUID: - case CqlParser.K_VALUES: - case CqlParser.K_VIEW: - case CqlParser.K_WHERE: - case CqlParser.K_WITH: - case CqlParser.K_WRITETIME: - case CqlParser.K_ASCII: - case CqlParser.K_BIGINT: - case CqlParser.K_BLOB: - case CqlParser.K_BOOLEAN: - case CqlParser.K_COUNTER: - case CqlParser.K_DATE: - case CqlParser.K_DECIMAL: - case CqlParser.K_DOUBLE: - case CqlParser.K_FLOAT: - case CqlParser.K_FROZEN: - case CqlParser.K_INET: - case CqlParser.K_INT: - case CqlParser.K_LIST: - case CqlParser.K_MAP: - case CqlParser.K_SMALLINT: - case CqlParser.K_TEXT: - case CqlParser.K_TIMEUUID: - case CqlParser.K_TIME: - case CqlParser.K_TINYINT: - case CqlParser.K_TUPLE: - case CqlParser.K_VARCHAR: - case CqlParser.K_VARINT: - case CqlParser.STRING_LITERAL: - case CqlParser.OBJECT_NAME: - case CqlParser.K_USERS: - case CqlParser.K_VECTOR: - this.state = 2696; - this.dataType(); - break; - case CqlParser.DECIMAL_LITERAL: - this.state = 2697; - this.decimalLiteral(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - this.state = 2704; - this._errHandler.sync(this); - _la = this._input.LA(1); - } - this.state = 2705; - this.syntaxBracketRa(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - orderDirection() { - let localctx = new OrderDirectionContext(this, this._ctx, this.state); - this.enterRule(localctx, 342, CqlParser.RULE_orderDirection); - try { - this.state = 2709; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.K_ASC: - this.enterOuterAlt(localctx, 1); - this.state = 2707; - this.kwAsc(); - break; - case CqlParser.K_DESC: - this.enterOuterAlt(localctx, 2); - this.state = 2708; - this.kwDesc(); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - role() { - let localctx = new RoleContext(this, this._ctx, this.state); - this.enterRule(localctx, 344, CqlParser.RULE_role); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2711; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - trigger() { - let localctx = new TriggerContext(this, this._ctx, this.state); - this.enterRule(localctx, 346, CqlParser.RULE_trigger); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2713; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - triggerClass() { - let localctx = new TriggerClassContext(this, this._ctx, this.state); - this.enterRule(localctx, 348, CqlParser.RULE_triggerClass); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2715; - this.stringLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - materializedView() { - let localctx = new MaterializedViewContext(this, this._ctx, this.state); - this.enterRule(localctx, 350, CqlParser.RULE_materializedView); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2717; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - type() { - let localctx = new TypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 352, CqlParser.RULE_type); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2719; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - aggregate() { - let localctx = new AggregateContext(this, this._ctx, this.state); - this.enterRule(localctx, 354, CqlParser.RULE_aggregate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2721; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - functionStatement() { - let localctx = new FunctionStatementContext(this, this._ctx, this.state); - this.enterRule(localctx, 356, CqlParser.RULE_functionStatement); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2723; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - language() { - let localctx = new LanguageContext(this, this._ctx, this.state); - this.enterRule(localctx, 358, CqlParser.RULE_language); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2725; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - user() { - let localctx = new UserContext(this, this._ctx, this.state); - this.enterRule(localctx, 360, CqlParser.RULE_user); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2727; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - password() { - let localctx = new PasswordContext(this, this._ctx, this.state); - this.enterRule(localctx, 362, CqlParser.RULE_password); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2729; - this.stringLiteral(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - hashKey() { - let localctx = new HashKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 364, CqlParser.RULE_hashKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2731; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - param() { - let localctx = new ParamContext(this, this._ctx, this.state); - this.enterRule(localctx, 366, CqlParser.RULE_param); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2733; - this.paramName(); - this.state = 2734; - this.dataType(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - paramName() { - let localctx = new ParamNameContext(this, this._ctx, this.state); - this.enterRule(localctx, 368, CqlParser.RULE_paramName); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2736; - this.id(); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAdd() { - let localctx = new KwAddContext(this, this._ctx, this.state); - this.enterRule(localctx, 370, CqlParser.RULE_kwAdd); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2738; - this.match(CqlParser.K_ADD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAggregate() { - let localctx = new KwAggregateContext(this, this._ctx, this.state); - this.enterRule(localctx, 372, CqlParser.RULE_kwAggregate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2740; - this.match(CqlParser.K_AGGREGATE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAll() { - let localctx = new KwAllContext(this, this._ctx, this.state); - this.enterRule(localctx, 374, CqlParser.RULE_kwAll); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2742; - this.match(CqlParser.K_ALL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAllPermissions() { - let localctx = new KwAllPermissionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 376, CqlParser.RULE_kwAllPermissions); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2744; - this.match(CqlParser.K_ALL); - this.state = 2745; - this.match(CqlParser.K_PERMISSIONS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAllow() { - let localctx = new KwAllowContext(this, this._ctx, this.state); - this.enterRule(localctx, 378, CqlParser.RULE_kwAllow); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2747; - this.match(CqlParser.K_ALLOW); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAlter() { - let localctx = new KwAlterContext(this, this._ctx, this.state); - this.enterRule(localctx, 380, CqlParser.RULE_kwAlter); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2749; - this.match(CqlParser.K_ALTER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAnd() { - let localctx = new KwAndContext(this, this._ctx, this.state); - this.enterRule(localctx, 382, CqlParser.RULE_kwAnd); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2751; - this.match(CqlParser.K_AND); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwApply() { - let localctx = new KwApplyContext(this, this._ctx, this.state); - this.enterRule(localctx, 384, CqlParser.RULE_kwApply); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2753; - this.match(CqlParser.K_APPLY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAs() { - let localctx = new KwAsContext(this, this._ctx, this.state); - this.enterRule(localctx, 386, CqlParser.RULE_kwAs); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2755; - this.match(CqlParser.K_AS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAsc() { - let localctx = new KwAscContext(this, this._ctx, this.state); - this.enterRule(localctx, 388, CqlParser.RULE_kwAsc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2757; - this.match(CqlParser.K_ASC); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAuthorize() { - let localctx = new KwAuthorizeContext(this, this._ctx, this.state); - this.enterRule(localctx, 390, CqlParser.RULE_kwAuthorize); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2759; - this.match(CqlParser.K_AUTHORIZE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwBatch() { - let localctx = new KwBatchContext(this, this._ctx, this.state); - this.enterRule(localctx, 392, CqlParser.RULE_kwBatch); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2761; - this.match(CqlParser.K_BATCH); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwBegin() { - let localctx = new KwBeginContext(this, this._ctx, this.state); - this.enterRule(localctx, 394, CqlParser.RULE_kwBegin); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2763; - this.match(CqlParser.K_BEGIN); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwBy() { - let localctx = new KwByContext(this, this._ctx, this.state); - this.enterRule(localctx, 396, CqlParser.RULE_kwBy); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2765; - this.match(CqlParser.K_BY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCalled() { - let localctx = new KwCalledContext(this, this._ctx, this.state); - this.enterRule(localctx, 398, CqlParser.RULE_kwCalled); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2767; - this.match(CqlParser.K_CALLED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwClustering() { - let localctx = new KwClusteringContext(this, this._ctx, this.state); - this.enterRule(localctx, 400, CqlParser.RULE_kwClustering); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2769; - this.match(CqlParser.K_CLUSTERING); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCompact() { - let localctx = new KwCompactContext(this, this._ctx, this.state); - this.enterRule(localctx, 402, CqlParser.RULE_kwCompact); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2771; - this.match(CqlParser.K_COMPACT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwContains() { - let localctx = new KwContainsContext(this, this._ctx, this.state); - this.enterRule(localctx, 404, CqlParser.RULE_kwContains); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2773; - this.match(CqlParser.K_CONTAINS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCreate() { - let localctx = new KwCreateContext(this, this._ctx, this.state); - this.enterRule(localctx, 406, CqlParser.RULE_kwCreate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2775; - this.match(CqlParser.K_CREATE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDelete() { - let localctx = new KwDeleteContext(this, this._ctx, this.state); - this.enterRule(localctx, 408, CqlParser.RULE_kwDelete); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2777; - this.match(CqlParser.K_DELETE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDesc() { - let localctx = new KwDescContext(this, this._ctx, this.state); - this.enterRule(localctx, 410, CqlParser.RULE_kwDesc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2779; - this.match(CqlParser.K_DESC); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDescibe() { - let localctx = new KwDescibeContext(this, this._ctx, this.state); - this.enterRule(localctx, 412, CqlParser.RULE_kwDescibe); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2781; - this.match(CqlParser.K_DESCRIBE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDistinct() { - let localctx = new KwDistinctContext(this, this._ctx, this.state); - this.enterRule(localctx, 414, CqlParser.RULE_kwDistinct); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2783; - this.match(CqlParser.K_DISTINCT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDrop() { - let localctx = new KwDropContext(this, this._ctx, this.state); - this.enterRule(localctx, 416, CqlParser.RULE_kwDrop); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2785; - this.match(CqlParser.K_DROP); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDurableWrites() { - let localctx = new KwDurableWritesContext(this, this._ctx, this.state); - this.enterRule(localctx, 418, CqlParser.RULE_kwDurableWrites); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2787; - this.match(CqlParser.K_DURABLE_WRITES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwEntries() { - let localctx = new KwEntriesContext(this, this._ctx, this.state); - this.enterRule(localctx, 420, CqlParser.RULE_kwEntries); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2789; - this.match(CqlParser.K_ENTRIES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwExecute() { - let localctx = new KwExecuteContext(this, this._ctx, this.state); - this.enterRule(localctx, 422, CqlParser.RULE_kwExecute); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2791; - this.match(CqlParser.K_EXECUTE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwExists() { - let localctx = new KwExistsContext(this, this._ctx, this.state); - this.enterRule(localctx, 424, CqlParser.RULE_kwExists); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2793; - this.match(CqlParser.K_EXISTS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFiltering() { - let localctx = new KwFilteringContext(this, this._ctx, this.state); - this.enterRule(localctx, 426, CqlParser.RULE_kwFiltering); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2795; - this.match(CqlParser.K_FILTERING); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFinalfunc() { - let localctx = new KwFinalfuncContext(this, this._ctx, this.state); - this.enterRule(localctx, 428, CqlParser.RULE_kwFinalfunc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2797; - this.match(CqlParser.K_FINALFUNC); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFrom() { - let localctx = new KwFromContext(this, this._ctx, this.state); - this.enterRule(localctx, 430, CqlParser.RULE_kwFrom); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2799; - this.match(CqlParser.K_FROM); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFull() { - let localctx = new KwFullContext(this, this._ctx, this.state); - this.enterRule(localctx, 432, CqlParser.RULE_kwFull); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2801; - this.match(CqlParser.K_FULL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFunction() { - let localctx = new KwFunctionContext(this, this._ctx, this.state); - this.enterRule(localctx, 434, CqlParser.RULE_kwFunction); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2803; - this.match(CqlParser.K_FUNCTION); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFunctions() { - let localctx = new KwFunctionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 436, CqlParser.RULE_kwFunctions); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2805; - this.match(CqlParser.K_FUNCTIONS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwGrant() { - let localctx = new KwGrantContext(this, this._ctx, this.state); - this.enterRule(localctx, 438, CqlParser.RULE_kwGrant); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2807; - this.match(CqlParser.K_GRANT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIf() { - let localctx = new KwIfContext(this, this._ctx, this.state); - this.enterRule(localctx, 440, CqlParser.RULE_kwIf); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2809; - this.match(CqlParser.K_IF); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIn() { - let localctx = new KwInContext(this, this._ctx, this.state); - this.enterRule(localctx, 442, CqlParser.RULE_kwIn); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2811; - this.match(CqlParser.K_IN); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIndex() { - let localctx = new KwIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 444, CqlParser.RULE_kwIndex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2813; - this.match(CqlParser.K_INDEX); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCustom() { - let localctx = new KwCustomContext(this, this._ctx, this.state); - this.enterRule(localctx, 446, CqlParser.RULE_kwCustom); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2815; - this.match(CqlParser.K_CUSTOM); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSearch() { - let localctx = new KwSearchContext(this, this._ctx, this.state); - this.enterRule(localctx, 448, CqlParser.RULE_kwSearch); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2817; - this.match(CqlParser.K_SEARCH); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAscii() { - let localctx = new KwAsciiContext(this, this._ctx, this.state); - this.enterRule(localctx, 450, CqlParser.RULE_kwAscii); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2819; - this.match(CqlParser.K_ASCII); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNormalize() { - let localctx = new KwNormalizeContext(this, this._ctx, this.state); - this.enterRule(localctx, 452, CqlParser.RULE_kwNormalize); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2821; - this.match(CqlParser.K_NORMALIZE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAnalyzed() { - let localctx = new KwAnalyzedContext(this, this._ctx, this.state); - this.enterRule(localctx, 454, CqlParser.RULE_kwAnalyzed); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2823; - this.match(CqlParser.K_ANALYZED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIsLiteral() { - let localctx = new KwIsLiteralContext(this, this._ctx, this.state); - this.enterRule(localctx, 456, CqlParser.RULE_kwIsLiteral); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2825; - this.match(CqlParser.K_IS_LITERAL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwMaxCompactionFlushMemoryInMb() { - let localctx = new KwMaxCompactionFlushMemoryInMbContext( - this, - this._ctx, - this.state, - ); - this.enterRule( - localctx, - 458, - CqlParser.RULE_kwMaxCompactionFlushMemoryInMb, - ); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2827; - this.match(CqlParser.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTokenizationEnableStemming() { - let localctx = new KwTokenizationEnableStemmingContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 460, CqlParser.RULE_kwTokenizationEnableStemming); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2829; - this.match(CqlParser.K_TOKENIZATION_ENABLE_STEMMING); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTokenizationSkipStopWords() { - let localctx = new KwTokenizationSkipStopWordsContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 462, CqlParser.RULE_kwTokenizationSkipStopWords); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2831; - this.match(CqlParser.K_TOKENIZATION_SKIP_STOP_WORDS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTokenizationLocale() { - let localctx = new KwTokenizationLocaleContext(this, this._ctx, this.state); - this.enterRule(localctx, 464, CqlParser.RULE_kwTokenizationLocale); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2833; - this.match(CqlParser.K_TOKENIZATION_LOCALE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTokenizationNormalizeLowercase() { - let localctx = new KwTokenizationNormalizeLowercaseContext( - this, - this._ctx, - this.state, - ); - this.enterRule( - localctx, - 466, - CqlParser.RULE_kwTokenizationNormalizeLowercase, - ); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2835; - this.match(CqlParser.K_TOKENIZATION_NORMALIZE_LOWERCASE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTokenizationNormalizeUppercase() { - let localctx = new KwTokenizationNormalizeUppercaseContext( - this, - this._ctx, - this.state, - ); - this.enterRule( - localctx, - 468, - CqlParser.RULE_kwTokenizationNormalizeUppercase, - ); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2837; - this.match(CqlParser.K_TOKENIZATION_NORMALIZE_UPPERCASE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNormalizeLowercase() { - let localctx = new KwNormalizeLowercaseContext(this, this._ctx, this.state); - this.enterRule(localctx, 470, CqlParser.RULE_kwNormalizeLowercase); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2839; - this.match(CqlParser.K_NORMALIZE_LOWERCASE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNormalizeUppercase() { - let localctx = new KwNormalizeUppercaseContext(this, this._ctx, this.state); - this.enterRule(localctx, 472, CqlParser.RULE_kwNormalizeUppercase); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2841; - this.match(CqlParser.K_NORMALIZE_UPPERCASE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwMode() { - let localctx = new KwModeContext(this, this._ctx, this.state); - this.enterRule(localctx, 474, CqlParser.RULE_kwMode); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2843; - this.match(CqlParser.K_MODE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAnalyzerClass() { - let localctx = new KwAnalyzerClassContext(this, this._ctx, this.state); - this.enterRule(localctx, 476, CqlParser.RULE_kwAnalyzerClass); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2845; - this.match(CqlParser.K_ANALYZER_CLASS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwStorageAttachedIndex() { - let localctx = new KwStorageAttachedIndexContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 478, CqlParser.RULE_kwStorageAttachedIndex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2847; - this.match(CqlParser.K_STORAGE_ATTACHED_INDEX); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSolrIndex() { - let localctx = new KwSolrIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 480, CqlParser.RULE_kwSolrIndex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2849; - this.match(CqlParser.K_SOLR_INDEX); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSASIIndex() { - let localctx = new KwSASIIndexContext(this, this._ctx, this.state); - this.enterRule(localctx, 482, CqlParser.RULE_kwSASIIndex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2851; - this.match(CqlParser.K_SASI_INDEX); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSpaceSavingNoJoin() { - let localctx = new KwSpaceSavingNoJoinContext(this, this._ctx, this.state); - this.enterRule(localctx, 484, CqlParser.RULE_kwSpaceSavingNoJoin); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2853; - this.match(CqlParser.K_SPACE_SAVING_NO_JOIN); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSpaceSavingAll() { - let localctx = new KwSpaceSavingAllContext(this, this._ctx, this.state); - this.enterRule(localctx, 486, CqlParser.RULE_kwSpaceSavingAll); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2855; - this.match(CqlParser.K_SPACE_SAVING_ALL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSpaceSavingSlowTriePrecision() { - let localctx = new KwSpaceSavingSlowTriePrecisionContext( - this, - this._ctx, - this.state, - ); - this.enterRule( - localctx, - 488, - CqlParser.RULE_kwSpaceSavingSlowTriePrecision, - ); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2857; - this.match(CqlParser.K_SPACE_SAVING_SLOW_TRIE_PRECISION); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSpaceSavingNoTextField() { - let localctx = new KwSpaceSavingNoTextFieldContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 490, CqlParser.RULE_kwSpaceSavingNoTextField); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2859; - this.match(CqlParser.K_SPACE_SAVING_NO_TEXT_FIELD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCopyField() { - let localctx = new KwCopyFieldContext(this, this._ctx, this.state); - this.enterRule(localctx, 492, CqlParser.RULE_kwCopyField); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2861; - this.match(CqlParser.K_COPY_FIELD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDocValues() { - let localctx = new KwDocValuesContext(this, this._ctx, this.state); - this.enterRule(localctx, 494, CqlParser.RULE_kwDocValues); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2863; - this.match(CqlParser.K_DOC_VALUES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwExcluded() { - let localctx = new KwExcludedContext(this, this._ctx, this.state); - this.enterRule(localctx, 496, CqlParser.RULE_kwExcluded); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2865; - this.match(CqlParser.K_EXCLUDED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIndexed() { - let localctx = new KwIndexedContext(this, this._ctx, this.state); - this.enterRule(localctx, 498, CqlParser.RULE_kwIndexed); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2867; - this.match(CqlParser.K_INDEXED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLowerCase() { - let localctx = new KwLowerCaseContext(this, this._ctx, this.state); - this.enterRule(localctx, 500, CqlParser.RULE_kwLowerCase); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2869; - this.match(CqlParser.K_LOWERCASE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwColumns() { - let localctx = new KwColumnsContext(this, this._ctx, this.state); - this.enterRule(localctx, 502, CqlParser.RULE_kwColumns); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2871; - this.match(CqlParser.K_COLUMNS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwProfiles() { - let localctx = new KwProfilesContext(this, this._ctx, this.state); - this.enterRule(localctx, 504, CqlParser.RULE_kwProfiles); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2873; - this.match(CqlParser.K_PROFILES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwConfig() { - let localctx = new KwConfigContext(this, this._ctx, this.state); - this.enterRule(localctx, 506, CqlParser.RULE_kwConfig); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2875; - this.match(CqlParser.K_CONFIG); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwAutoCommitTime() { - let localctx = new KwAutoCommitTimeContext(this, this._ctx, this.state); - this.enterRule(localctx, 508, CqlParser.RULE_kwAutoCommitTime); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2877; - this.match(CqlParser.K_AUTOCOMMIT_TIME); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDefaultQueryField() { - let localctx = new KwDefaultQueryFieldContext(this, this._ctx, this.state); - this.enterRule(localctx, 510, CqlParser.RULE_kwDefaultQueryField); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2879; - this.match(CqlParser.K_DEFAULT_QUERY_FIELD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDirectoryFactory() { - let localctx = new KwDirectoryFactoryContext(this, this._ctx, this.state); - this.enterRule(localctx, 512, CqlParser.RULE_kwDirectoryFactory); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2881; - this.match(CqlParser.K_DIRECTORY_FACTORY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFilterCacheLowWaterMark() { - let localctx = new KwFilterCacheLowWaterMarkContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 514, CqlParser.RULE_kwFilterCacheLowWaterMark); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2883; - this.match(CqlParser.K_FILTER_CACHE_LOW_WATERMARK); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwFilterCacheHighWaterMark() { - let localctx = new KwFilterCacheHighWaterMarkContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 516, CqlParser.RULE_kwFilterCacheHighWaterMark); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2885; - this.match(CqlParser.K_FILTER_CACHE_HIGH_WATERMARK); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwDirectoryFactoryClass() { - let localctx = new KwDirectoryFactoryClassContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 518, CqlParser.RULE_kwDirectoryFactoryClass); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2887; - this.match(CqlParser.K_DIRECTORY_FACTORY_CLASS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwMergeMaxThreadCount() { - let localctx = new KwMergeMaxThreadCountContext( - this, - this._ctx, - this.state, - ); - this.enterRule(localctx, 520, CqlParser.RULE_kwMergeMaxThreadCount); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2889; - this.match(CqlParser.K_MERGE_MAX_THREAD_COUNT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwMergeMaxMergeCount() { - let localctx = new KwMergeMaxMergeCountContext(this, this._ctx, this.state); - this.enterRule(localctx, 522, CqlParser.RULE_kwMergeMaxMergeCount); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2891; - this.match(CqlParser.K_MERGE_MAX_MERGE_COUNT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRamBufferSize() { - let localctx = new KwRamBufferSizeContext(this, this._ctx, this.state); - this.enterRule(localctx, 524, CqlParser.RULE_kwRamBufferSize); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2893; - this.match(CqlParser.K_RAM_BUFFER_SIZE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRealtime() { - let localctx = new KwRealtimeContext(this, this._ctx, this.state); - this.enterRule(localctx, 526, CqlParser.RULE_kwRealtime); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2895; - this.match(CqlParser.K_REALTIME); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRecovery() { - let localctx = new KwRecoveryContext(this, this._ctx, this.state); - this.enterRule(localctx, 528, CqlParser.RULE_kwRecovery); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2897; - this.match(CqlParser.K_RECOVERY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwReindex() { - let localctx = new KwReindexContext(this, this._ctx, this.state); - this.enterRule(localctx, 530, CqlParser.RULE_kwReindex); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2899; - this.match(CqlParser.K_REINDEX); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLenient() { - let localctx = new KwLenientContext(this, this._ctx, this.state); - this.enterRule(localctx, 532, CqlParser.RULE_kwLenient); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2901; - this.match(CqlParser.K_LENIENT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwStandard() { - let localctx = new KwStandardContext(this, this._ctx, this.state); - this.enterRule(localctx, 534, CqlParser.RULE_kwStandard); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2903; - this.match(CqlParser.K_STANDARD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwEncrypted() { - let localctx = new KwEncryptedContext(this, this._ctx, this.state); - this.enterRule(localctx, 536, CqlParser.RULE_kwEncrypted); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2905; - this.match(CqlParser.K_ENCRYPTED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwCaseSensitive() { - let localctx = new KwCaseSensitiveContext(this, this._ctx, this.state); - this.enterRule(localctx, 538, CqlParser.RULE_kwCaseSensitive); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2907; - this.match(CqlParser.K_CASE_SENITIVE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSimilarityFunction() { - let localctx = new KwSimilarityFunctionContext(this, this._ctx, this.state); - this.enterRule(localctx, 540, CqlParser.RULE_kwSimilarityFunction); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2909; - this.match(CqlParser.K_SIMILARITY_FUNCTION); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwInitcond() { - let localctx = new KwInitcondContext(this, this._ctx, this.state); - this.enterRule(localctx, 542, CqlParser.RULE_kwInitcond); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2911; - this.match(CqlParser.K_INITCOND); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwInput() { - let localctx = new KwInputContext(this, this._ctx, this.state); - this.enterRule(localctx, 544, CqlParser.RULE_kwInput); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2913; - this.match(CqlParser.K_INPUT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwInsert() { - let localctx = new KwInsertContext(this, this._ctx, this.state); - this.enterRule(localctx, 546, CqlParser.RULE_kwInsert); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2915; - this.match(CqlParser.K_INSERT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwInto() { - let localctx = new KwIntoContext(this, this._ctx, this.state); - this.enterRule(localctx, 548, CqlParser.RULE_kwInto); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2917; - this.match(CqlParser.K_INTO); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwIs() { - let localctx = new KwIsContext(this, this._ctx, this.state); - this.enterRule(localctx, 550, CqlParser.RULE_kwIs); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2919; - this.match(CqlParser.K_IS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwJson() { - let localctx = new KwJsonContext(this, this._ctx, this.state); - this.enterRule(localctx, 552, CqlParser.RULE_kwJson); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2921; - this.match(CqlParser.K_JSON); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwKey() { - let localctx = new KwKeyContext(this, this._ctx, this.state); - this.enterRule(localctx, 554, CqlParser.RULE_kwKey); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2923; - this.match(CqlParser.K_KEY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwKeys() { - let localctx = new KwKeysContext(this, this._ctx, this.state); - this.enterRule(localctx, 556, CqlParser.RULE_kwKeys); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2925; - this.match(CqlParser.K_KEYS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwKeyspace() { - let localctx = new KwKeyspaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 558, CqlParser.RULE_kwKeyspace); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2927; - this.match(CqlParser.K_KEYSPACE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwKeyspaces() { - let localctx = new KwKeyspacesContext(this, this._ctx, this.state); - this.enterRule(localctx, 560, CqlParser.RULE_kwKeyspaces); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2929; - this.match(CqlParser.K_KEYSPACES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLanguage() { - let localctx = new KwLanguageContext(this, this._ctx, this.state); - this.enterRule(localctx, 562, CqlParser.RULE_kwLanguage); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2931; - this.match(CqlParser.K_LANGUAGE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLimit() { - let localctx = new KwLimitContext(this, this._ctx, this.state); - this.enterRule(localctx, 564, CqlParser.RULE_kwLimit); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2933; - this.match(CqlParser.K_LIMIT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwList() { - let localctx = new KwListContext(this, this._ctx, this.state); - this.enterRule(localctx, 566, CqlParser.RULE_kwList); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2935; - this.match(CqlParser.K_LIST); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLogged() { - let localctx = new KwLoggedContext(this, this._ctx, this.state); - this.enterRule(localctx, 568, CqlParser.RULE_kwLogged); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2937; - this.match(CqlParser.K_LOGGED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLogin() { - let localctx = new KwLoginContext(this, this._ctx, this.state); - this.enterRule(localctx, 570, CqlParser.RULE_kwLogin); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2939; - this.match(CqlParser.K_LOGIN); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwMaterialized() { - let localctx = new KwMaterializedContext(this, this._ctx, this.state); - this.enterRule(localctx, 572, CqlParser.RULE_kwMaterialized); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2941; - this.match(CqlParser.K_MATERIALIZED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwModify() { - let localctx = new KwModifyContext(this, this._ctx, this.state); - this.enterRule(localctx, 574, CqlParser.RULE_kwModify); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2943; - this.match(CqlParser.K_MODIFY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNosuperuser() { - let localctx = new KwNosuperuserContext(this, this._ctx, this.state); - this.enterRule(localctx, 576, CqlParser.RULE_kwNosuperuser); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2945; - this.match(CqlParser.K_NOSUPERUSER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNorecursive() { - let localctx = new KwNorecursiveContext(this, this._ctx, this.state); - this.enterRule(localctx, 578, CqlParser.RULE_kwNorecursive); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2947; - this.match(CqlParser.K_NORECURSIVE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNot() { - let localctx = new KwNotContext(this, this._ctx, this.state); - this.enterRule(localctx, 580, CqlParser.RULE_kwNot); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2949; - this.match(CqlParser.K_NOT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwNull() { - let localctx = new KwNullContext(this, this._ctx, this.state); - this.enterRule(localctx, 582, CqlParser.RULE_kwNull); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2951; - this.match(CqlParser.K_NULL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwOf() { - let localctx = new KwOfContext(this, this._ctx, this.state); - this.enterRule(localctx, 584, CqlParser.RULE_kwOf); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2953; - this.match(CqlParser.K_OF); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwOn() { - let localctx = new KwOnContext(this, this._ctx, this.state); - this.enterRule(localctx, 586, CqlParser.RULE_kwOn); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2955; - this.match(CqlParser.K_ON); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwOptions() { - let localctx = new KwOptionsContext(this, this._ctx, this.state); - this.enterRule(localctx, 588, CqlParser.RULE_kwOptions); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2957; - this.match(CqlParser.K_OPTIONS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwOr() { - let localctx = new KwOrContext(this, this._ctx, this.state); - this.enterRule(localctx, 590, CqlParser.RULE_kwOr); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2959; - this.match(CqlParser.K_OR); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwOrder() { - let localctx = new KwOrderContext(this, this._ctx, this.state); - this.enterRule(localctx, 592, CqlParser.RULE_kwOrder); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2961; - this.match(CqlParser.K_ORDER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwPassword() { - let localctx = new KwPasswordContext(this, this._ctx, this.state); - this.enterRule(localctx, 594, CqlParser.RULE_kwPassword); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2963; - this.match(CqlParser.K_PASSWORD); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwPrimary() { - let localctx = new KwPrimaryContext(this, this._ctx, this.state); - this.enterRule(localctx, 596, CqlParser.RULE_kwPrimary); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2965; - this.match(CqlParser.K_PRIMARY); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRename() { - let localctx = new KwRenameContext(this, this._ctx, this.state); - this.enterRule(localctx, 598, CqlParser.RULE_kwRename); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2967; - this.match(CqlParser.K_RENAME); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwReplace() { - let localctx = new KwReplaceContext(this, this._ctx, this.state); - this.enterRule(localctx, 600, CqlParser.RULE_kwReplace); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2969; - this.match(CqlParser.K_REPLACE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwReplication() { - let localctx = new KwReplicationContext(this, this._ctx, this.state); - this.enterRule(localctx, 602, CqlParser.RULE_kwReplication); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2971; - this.match(CqlParser.K_REPLICATION); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwReturns() { - let localctx = new KwReturnsContext(this, this._ctx, this.state); - this.enterRule(localctx, 604, CqlParser.RULE_kwReturns); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2973; - this.match(CqlParser.K_RETURNS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRole() { - let localctx = new KwRoleContext(this, this._ctx, this.state); - this.enterRule(localctx, 606, CqlParser.RULE_kwRole); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2975; - this.match(CqlParser.K_ROLE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwInternal() { - let localctx = new KwInternalContext(this, this._ctx, this.state); - this.enterRule(localctx, 608, CqlParser.RULE_kwInternal); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2977; - this.match(CqlParser.K_INTERNAL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwLdap() { - let localctx = new KwLdapContext(this, this._ctx, this.state); - this.enterRule(localctx, 610, CqlParser.RULE_kwLdap); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2979; - this.match(CqlParser.K_LDAP); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwScheme() { - let localctx = new KwSchemeContext(this, this._ctx, this.state); - this.enterRule(localctx, 612, CqlParser.RULE_kwScheme); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2981; - this.match(CqlParser.K_SCHEME); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRoles() { - let localctx = new KwRolesContext(this, this._ctx, this.state); - this.enterRule(localctx, 614, CqlParser.RULE_kwRoles); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2983; - this.match(CqlParser.K_ROLES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSelect() { - let localctx = new KwSelectContext(this, this._ctx, this.state); - this.enterRule(localctx, 616, CqlParser.RULE_kwSelect); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2985; - this.match(CqlParser.K_SELECT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSet() { - let localctx = new KwSetContext(this, this._ctx, this.state); - this.enterRule(localctx, 618, CqlParser.RULE_kwSet); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2987; - this.match(CqlParser.K_SET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSfunc() { - let localctx = new KwSfuncContext(this, this._ctx, this.state); - this.enterRule(localctx, 620, CqlParser.RULE_kwSfunc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2989; - this.match(CqlParser.K_SFUNC); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwStorage() { - let localctx = new KwStorageContext(this, this._ctx, this.state); - this.enterRule(localctx, 622, CqlParser.RULE_kwStorage); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2991; - this.match(CqlParser.K_STORAGE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwStype() { - let localctx = new KwStypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 624, CqlParser.RULE_kwStype); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2993; - this.match(CqlParser.K_STYPE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwSuperuser() { - let localctx = new KwSuperuserContext(this, this._ctx, this.state); - this.enterRule(localctx, 626, CqlParser.RULE_kwSuperuser); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2995; - this.match(CqlParser.K_SUPERUSER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTable() { - let localctx = new KwTableContext(this, this._ctx, this.state); - this.enterRule(localctx, 628, CqlParser.RULE_kwTable); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2997; - this.match(CqlParser.K_TABLE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTimestamp() { - let localctx = new KwTimestampContext(this, this._ctx, this.state); - this.enterRule(localctx, 630, CqlParser.RULE_kwTimestamp); - try { - this.enterOuterAlt(localctx, 1); - this.state = 2999; - this.match(CqlParser.K_TIMESTAMP); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTo() { - let localctx = new KwToContext(this, this._ctx, this.state); - this.enterRule(localctx, 632, CqlParser.RULE_kwTo); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3001; - this.match(CqlParser.K_TO); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTrigger() { - let localctx = new KwTriggerContext(this, this._ctx, this.state); - this.enterRule(localctx, 634, CqlParser.RULE_kwTrigger); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3003; - this.match(CqlParser.K_TRIGGER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTruncate() { - let localctx = new KwTruncateContext(this, this._ctx, this.state); - this.enterRule(localctx, 636, CqlParser.RULE_kwTruncate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3005; - this.match(CqlParser.K_TRUNCATE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwTtl() { - let localctx = new KwTtlContext(this, this._ctx, this.state); - this.enterRule(localctx, 638, CqlParser.RULE_kwTtl); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3007; - this.match(CqlParser.K_TTL); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwType() { - let localctx = new KwTypeContext(this, this._ctx, this.state); - this.enterRule(localctx, 640, CqlParser.RULE_kwType); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3009; - this.match(CqlParser.K_TYPE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUnlogged() { - let localctx = new KwUnloggedContext(this, this._ctx, this.state); - this.enterRule(localctx, 642, CqlParser.RULE_kwUnlogged); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3011; - this.match(CqlParser.K_UNLOGGED); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUpdate() { - let localctx = new KwUpdateContext(this, this._ctx, this.state); - this.enterRule(localctx, 644, CqlParser.RULE_kwUpdate); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3013; - this.match(CqlParser.K_UPDATE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUse() { - let localctx = new KwUseContext(this, this._ctx, this.state); - this.enterRule(localctx, 646, CqlParser.RULE_kwUse); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3015; - this.match(CqlParser.K_USE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUser() { - let localctx = new KwUserContext(this, this._ctx, this.state); - this.enterRule(localctx, 648, CqlParser.RULE_kwUser); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3017; - this.match(CqlParser.K_USER); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUsers() { - let localctx = new KwUsersContext(this, this._ctx, this.state); - this.enterRule(localctx, 650, CqlParser.RULE_kwUsers); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3019; - this.match(CqlParser.K_USERS); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwUsing() { - let localctx = new KwUsingContext(this, this._ctx, this.state); - this.enterRule(localctx, 652, CqlParser.RULE_kwUsing); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3021; - this.match(CqlParser.K_USING); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwValues() { - let localctx = new KwValuesContext(this, this._ctx, this.state); - this.enterRule(localctx, 654, CqlParser.RULE_kwValues); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3023; - this.match(CqlParser.K_VALUES); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwView() { - let localctx = new KwViewContext(this, this._ctx, this.state); - this.enterRule(localctx, 656, CqlParser.RULE_kwView); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3025; - this.match(CqlParser.K_VIEW); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwWhere() { - let localctx = new KwWhereContext(this, this._ctx, this.state); - this.enterRule(localctx, 658, CqlParser.RULE_kwWhere); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3027; - this.match(CqlParser.K_WHERE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwWith() { - let localctx = new KwWithContext(this, this._ctx, this.state); - this.enterRule(localctx, 660, CqlParser.RULE_kwWith); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3029; - this.match(CqlParser.K_WITH); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - kwRevoke() { - let localctx = new KwRevokeContext(this, this._ctx, this.state); - this.enterRule(localctx, 662, CqlParser.RULE_kwRevoke); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3031; - this.match(CqlParser.K_REVOKE); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - eof() { - let localctx = new EofContext(this, this._ctx, this.state); - this.enterRule(localctx, 664, CqlParser.RULE_eof); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3033; - this.match(CqlParser.EOF); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketLr() { - let localctx = new SyntaxBracketLrContext(this, this._ctx, this.state); - this.enterRule(localctx, 666, CqlParser.RULE_syntaxBracketLr); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3035; - this.match(CqlParser.LR_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketRr() { - let localctx = new SyntaxBracketRrContext(this, this._ctx, this.state); - this.enterRule(localctx, 668, CqlParser.RULE_syntaxBracketRr); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3037; - this.match(CqlParser.RR_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketLc() { - let localctx = new SyntaxBracketLcContext(this, this._ctx, this.state); - this.enterRule(localctx, 670, CqlParser.RULE_syntaxBracketLc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3039; - this.match(CqlParser.LC_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketRc() { - let localctx = new SyntaxBracketRcContext(this, this._ctx, this.state); - this.enterRule(localctx, 672, CqlParser.RULE_syntaxBracketRc); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3041; - this.match(CqlParser.RC_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketLa() { - let localctx = new SyntaxBracketLaContext(this, this._ctx, this.state); - this.enterRule(localctx, 674, CqlParser.RULE_syntaxBracketLa); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3043; - this.match(CqlParser.OPERATOR_LT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketRa() { - let localctx = new SyntaxBracketRaContext(this, this._ctx, this.state); - this.enterRule(localctx, 676, CqlParser.RULE_syntaxBracketRa); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3045; - this.match(CqlParser.OPERATOR_GT); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketLs() { - let localctx = new SyntaxBracketLsContext(this, this._ctx, this.state); - this.enterRule(localctx, 678, CqlParser.RULE_syntaxBracketLs); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3047; - this.match(CqlParser.LS_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxBracketRs() { - let localctx = new SyntaxBracketRsContext(this, this._ctx, this.state); - this.enterRule(localctx, 680, CqlParser.RULE_syntaxBracketRs); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3049; - this.match(CqlParser.RS_BRACKET); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxComma() { - let localctx = new SyntaxCommaContext(this, this._ctx, this.state); - this.enterRule(localctx, 682, CqlParser.RULE_syntaxComma); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3051; - this.match(CqlParser.COMMA); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - syntaxColon() { - let localctx = new SyntaxColonContext(this, this._ctx, this.state); - this.enterRule(localctx, 684, CqlParser.RULE_syntaxColon); - try { - this.enterOuterAlt(localctx, 1); - this.state = 3053; - this.match(CqlParser.COLON); - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } - - id() { - let localctx = new IdContext(this, this._ctx, this.state); - this.enterRule(localctx, 686, CqlParser.RULE_id); - try { - this.state = 3198; - this._errHandler.sync(this); - switch (this._input.LA(1)) { - case CqlParser.OBJECT_NAME: - this.enterOuterAlt(localctx, 1); - this.state = 3055; - this.match(CqlParser.OBJECT_NAME); - break; - case CqlParser.K_ADD: - this.enterOuterAlt(localctx, 2); - this.state = 3056; - this.match(CqlParser.K_ADD); - this.state = 3057; - this.match(CqlParser.K_AGGREGATE); - break; - case CqlParser.K_ALL: - this.enterOuterAlt(localctx, 3); - this.state = 3058; - this.match(CqlParser.K_ALL); - break; - case CqlParser.K_ALLOW: - this.enterOuterAlt(localctx, 4); - this.state = 3059; - this.match(CqlParser.K_ALLOW); - break; - case CqlParser.K_ALTER: - this.enterOuterAlt(localctx, 5); - this.state = 3060; - this.match(CqlParser.K_ALTER); - break; - case CqlParser.K_AND: - this.enterOuterAlt(localctx, 6); - this.state = 3061; - this.match(CqlParser.K_AND); - break; - case CqlParser.K_ANY: - this.enterOuterAlt(localctx, 7); - this.state = 3062; - this.match(CqlParser.K_ANY); - break; - case CqlParser.K_APPLY: - this.enterOuterAlt(localctx, 8); - this.state = 3063; - this.match(CqlParser.K_APPLY); - break; - case CqlParser.K_AS: - this.enterOuterAlt(localctx, 9); - this.state = 3064; - this.match(CqlParser.K_AS); - break; - case CqlParser.K_ASC: - this.enterOuterAlt(localctx, 10); - this.state = 3065; - this.match(CqlParser.K_ASC); - break; - case CqlParser.K_AUTHORIZE: - this.enterOuterAlt(localctx, 11); - this.state = 3066; - this.match(CqlParser.K_AUTHORIZE); - break; - case CqlParser.K_BATCH: - this.enterOuterAlt(localctx, 12); - this.state = 3067; - this.match(CqlParser.K_BATCH); - break; - case CqlParser.K_BEGIN: - this.enterOuterAlt(localctx, 13); - this.state = 3068; - this.match(CqlParser.K_BEGIN); - break; - case CqlParser.K_BY: - this.enterOuterAlt(localctx, 14); - this.state = 3069; - this.match(CqlParser.K_BY); - break; - case CqlParser.K_CALLED: - this.enterOuterAlt(localctx, 15); - this.state = 3070; - this.match(CqlParser.K_CALLED); - break; - case CqlParser.K_CLUSTERING: - this.enterOuterAlt(localctx, 16); - this.state = 3071; - this.match(CqlParser.K_CLUSTERING); - break; - case CqlParser.K_COLUMNFAMILY: - this.enterOuterAlt(localctx, 17); - this.state = 3072; - this.match(CqlParser.K_COLUMNFAMILY); - break; - case CqlParser.K_COMPACT: - this.enterOuterAlt(localctx, 18); - this.state = 3073; - this.match(CqlParser.K_COMPACT); - break; - case CqlParser.K_CONSISTENCY: - this.enterOuterAlt(localctx, 19); - this.state = 3074; - this.match(CqlParser.K_CONSISTENCY); - break; - case CqlParser.K_CONTAINS: - this.enterOuterAlt(localctx, 20); - this.state = 3075; - this.match(CqlParser.K_CONTAINS); - break; - case CqlParser.K_CREATE: - this.enterOuterAlt(localctx, 21); - this.state = 3076; - this.match(CqlParser.K_CREATE); - break; - case CqlParser.K_CUSTOM: - this.enterOuterAlt(localctx, 22); - this.state = 3077; - this.match(CqlParser.K_CUSTOM); - break; - case CqlParser.K_DELETE: - this.enterOuterAlt(localctx, 23); - this.state = 3078; - this.match(CqlParser.K_DELETE); - break; - case CqlParser.K_DESC: - this.enterOuterAlt(localctx, 24); - this.state = 3079; - this.match(CqlParser.K_DESC); - break; - case CqlParser.K_DESCRIBE: - this.enterOuterAlt(localctx, 25); - this.state = 3080; - this.match(CqlParser.K_DESCRIBE); - break; - case CqlParser.K_DISTINCT: - this.enterOuterAlt(localctx, 26); - this.state = 3081; - this.match(CqlParser.K_DISTINCT); - break; - case CqlParser.K_DROP: - this.enterOuterAlt(localctx, 27); - this.state = 3082; - this.match(CqlParser.K_DROP); - break; - case CqlParser.K_DURABLE_WRITES: - this.enterOuterAlt(localctx, 28); - this.state = 3083; - this.match(CqlParser.K_DURABLE_WRITES); - break; - case CqlParser.K_EACH_QUORUM: - this.enterOuterAlt(localctx, 29); - this.state = 3084; - this.match(CqlParser.K_EACH_QUORUM); - break; - case CqlParser.K_ENTRIES: - this.enterOuterAlt(localctx, 30); - this.state = 3085; - this.match(CqlParser.K_ENTRIES); - break; - case CqlParser.K_EXECUTE: - this.enterOuterAlt(localctx, 31); - this.state = 3086; - this.match(CqlParser.K_EXECUTE); - break; - case CqlParser.K_EXISTS: - this.enterOuterAlt(localctx, 32); - this.state = 3087; - this.match(CqlParser.K_EXISTS); - break; - case CqlParser.K_FALSE: - this.enterOuterAlt(localctx, 33); - this.state = 3088; - this.match(CqlParser.K_FALSE); - break; - case CqlParser.K_FILTERING: - this.enterOuterAlt(localctx, 34); - this.state = 3089; - this.match(CqlParser.K_FILTERING); - break; - case CqlParser.K_FINALFUNC: - this.enterOuterAlt(localctx, 35); - this.state = 3090; - this.match(CqlParser.K_FINALFUNC); - break; - case CqlParser.K_FROM: - this.enterOuterAlt(localctx, 36); - this.state = 3091; - this.match(CqlParser.K_FROM); - break; - case CqlParser.K_FULL: - this.enterOuterAlt(localctx, 37); - this.state = 3092; - this.match(CqlParser.K_FULL); - break; - case CqlParser.K_FUNCTION: - this.enterOuterAlt(localctx, 38); - this.state = 3093; - this.match(CqlParser.K_FUNCTION); - break; - case CqlParser.K_FUNCTIONS: - this.enterOuterAlt(localctx, 39); - this.state = 3094; - this.match(CqlParser.K_FUNCTIONS); - break; - case CqlParser.K_GRANT: - this.enterOuterAlt(localctx, 40); - this.state = 3095; - this.match(CqlParser.K_GRANT); - break; - case CqlParser.K_IF: - this.enterOuterAlt(localctx, 41); - this.state = 3096; - this.match(CqlParser.K_IF); - break; - case CqlParser.K_IN: - this.enterOuterAlt(localctx, 42); - this.state = 3097; - this.match(CqlParser.K_IN); - break; - case CqlParser.K_INDEX: - this.enterOuterAlt(localctx, 43); - this.state = 3098; - this.match(CqlParser.K_INDEX); - break; - case CqlParser.K_INFINITY: - this.enterOuterAlt(localctx, 44); - this.state = 3099; - this.match(CqlParser.K_INFINITY); - break; - case CqlParser.K_INITCOND: - this.enterOuterAlt(localctx, 45); - this.state = 3100; - this.match(CqlParser.K_INITCOND); - break; - case CqlParser.K_INPUT: - this.enterOuterAlt(localctx, 46); - this.state = 3101; - this.match(CqlParser.K_INPUT); - break; - case CqlParser.K_INSERT: - this.enterOuterAlt(localctx, 47); - this.state = 3102; - this.match(CqlParser.K_INSERT); - break; - case CqlParser.K_INTO: - this.enterOuterAlt(localctx, 48); - this.state = 3103; - this.match(CqlParser.K_INTO); - break; - case CqlParser.K_IS: - this.enterOuterAlt(localctx, 49); - this.state = 3104; - this.match(CqlParser.K_IS); - break; - case CqlParser.K_JSON: - this.enterOuterAlt(localctx, 50); - this.state = 3105; - this.match(CqlParser.K_JSON); - break; - case CqlParser.K_KEY: - this.enterOuterAlt(localctx, 51); - this.state = 3106; - this.match(CqlParser.K_KEY); - break; - case CqlParser.K_KEYS: - this.enterOuterAlt(localctx, 52); - this.state = 3107; - this.match(CqlParser.K_KEYS); - break; - case CqlParser.K_KEYSPACE: - this.enterOuterAlt(localctx, 53); - this.state = 3108; - this.match(CqlParser.K_KEYSPACE); - break; - case CqlParser.K_KEYSPACES: - this.enterOuterAlt(localctx, 54); - this.state = 3109; - this.match(CqlParser.K_KEYSPACES); - break; - case CqlParser.K_LANGUAGE: - this.enterOuterAlt(localctx, 55); - this.state = 3110; - this.match(CqlParser.K_LANGUAGE); - break; - case CqlParser.K_LEVEL: - this.enterOuterAlt(localctx, 56); - this.state = 3111; - this.match(CqlParser.K_LEVEL); - break; - case CqlParser.K_LIMIT: - this.enterOuterAlt(localctx, 57); - this.state = 3112; - this.match(CqlParser.K_LIMIT); - break; - case CqlParser.K_LOCAL_ONE: - this.enterOuterAlt(localctx, 58); - this.state = 3113; - this.match(CqlParser.K_LOCAL_ONE); - break; - case CqlParser.K_LOCAL_QUORUM: - this.enterOuterAlt(localctx, 59); - this.state = 3114; - this.match(CqlParser.K_LOCAL_QUORUM); - break; - case CqlParser.K_LOGGED: - this.enterOuterAlt(localctx, 60); - this.state = 3115; - this.match(CqlParser.K_LOGGED); - break; - case CqlParser.K_LOGIN: - this.enterOuterAlt(localctx, 61); - this.state = 3116; - this.match(CqlParser.K_LOGIN); - break; - case CqlParser.K_MATERIALIZED: - this.enterOuterAlt(localctx, 62); - this.state = 3117; - this.match(CqlParser.K_MATERIALIZED); - break; - case CqlParser.K_MODIFY: - this.enterOuterAlt(localctx, 63); - this.state = 3118; - this.match(CqlParser.K_MODIFY); - break; - case CqlParser.K_NAN: - this.enterOuterAlt(localctx, 64); - this.state = 3119; - this.match(CqlParser.K_NAN); - break; - case CqlParser.K_NORECURSIVE: - this.enterOuterAlt(localctx, 65); - this.state = 3120; - this.match(CqlParser.K_NORECURSIVE); - break; - case CqlParser.K_NOSUPERUSER: - this.enterOuterAlt(localctx, 66); - this.state = 3121; - this.match(CqlParser.K_NOSUPERUSER); - break; - case CqlParser.K_NOT: - this.enterOuterAlt(localctx, 67); - this.state = 3122; - this.match(CqlParser.K_NOT); - break; - case CqlParser.K_NULL: - this.enterOuterAlt(localctx, 68); - this.state = 3123; - this.match(CqlParser.K_NULL); - break; - case CqlParser.K_OF: - this.enterOuterAlt(localctx, 69); - this.state = 3124; - this.match(CqlParser.K_OF); - break; - case CqlParser.K_ON: - this.enterOuterAlt(localctx, 70); - this.state = 3125; - this.match(CqlParser.K_ON); - break; - case CqlParser.K_ONE: - this.enterOuterAlt(localctx, 71); - this.state = 3126; - this.match(CqlParser.K_ONE); - break; - case CqlParser.K_OPTIONS: - this.enterOuterAlt(localctx, 72); - this.state = 3127; - this.match(CqlParser.K_OPTIONS); - break; - case CqlParser.K_OR: - this.enterOuterAlt(localctx, 73); - this.state = 3128; - this.match(CqlParser.K_OR); - break; - case CqlParser.K_ORDER: - this.enterOuterAlt(localctx, 74); - this.state = 3129; - this.match(CqlParser.K_ORDER); - break; - case CqlParser.K_PARTITION: - this.enterOuterAlt(localctx, 75); - this.state = 3130; - this.match(CqlParser.K_PARTITION); - break; - case CqlParser.K_PASSWORD: - this.enterOuterAlt(localctx, 76); - this.state = 3131; - this.match(CqlParser.K_PASSWORD); - break; - case CqlParser.K_PER: - this.enterOuterAlt(localctx, 77); - this.state = 3132; - this.match(CqlParser.K_PER); - break; - case CqlParser.K_PERMISSION: - this.enterOuterAlt(localctx, 78); - this.state = 3133; - this.match(CqlParser.K_PERMISSION); - break; - case CqlParser.K_PERMISSIONS: - this.enterOuterAlt(localctx, 79); - this.state = 3134; - this.match(CqlParser.K_PERMISSIONS); - break; - case CqlParser.K_PRIMARY: - this.enterOuterAlt(localctx, 80); - this.state = 3135; - this.match(CqlParser.K_PRIMARY); - break; - case CqlParser.K_QUORUM: - this.enterOuterAlt(localctx, 81); - this.state = 3136; - this.match(CqlParser.K_QUORUM); - break; - case CqlParser.K_RENAME: - this.enterOuterAlt(localctx, 82); - this.state = 3137; - this.match(CqlParser.K_RENAME); - break; - case CqlParser.K_REPLACE: - this.enterOuterAlt(localctx, 83); - this.state = 3138; - this.match(CqlParser.K_REPLACE); - break; - case CqlParser.K_REPLICATION: - this.enterOuterAlt(localctx, 84); - this.state = 3139; - this.match(CqlParser.K_REPLICATION); - break; - case CqlParser.K_RETURNS: - this.enterOuterAlt(localctx, 85); - this.state = 3140; - this.match(CqlParser.K_RETURNS); - break; - case CqlParser.K_REVOKE: - this.enterOuterAlt(localctx, 86); - this.state = 3141; - this.match(CqlParser.K_REVOKE); - break; - case CqlParser.K_ROLE: - this.enterOuterAlt(localctx, 87); - this.state = 3142; - this.match(CqlParser.K_ROLE); - break; - case CqlParser.K_ROLES: - this.enterOuterAlt(localctx, 88); - this.state = 3143; - this.match(CqlParser.K_ROLES); - break; - case CqlParser.K_SCHEMA: - this.enterOuterAlt(localctx, 89); - this.state = 3144; - this.match(CqlParser.K_SCHEMA); - break; - case CqlParser.K_SELECT: - this.enterOuterAlt(localctx, 90); - this.state = 3145; - this.match(CqlParser.K_SELECT); - break; - case CqlParser.K_SET: - this.enterOuterAlt(localctx, 91); - this.state = 3146; - this.match(CqlParser.K_SET); - break; - case CqlParser.K_SFUNC: - this.enterOuterAlt(localctx, 92); - this.state = 3147; - this.match(CqlParser.K_SFUNC); - break; - case CqlParser.K_STATIC: - this.enterOuterAlt(localctx, 93); - this.state = 3148; - this.match(CqlParser.K_STATIC); - break; - case CqlParser.K_STORAGE: - this.enterOuterAlt(localctx, 94); - this.state = 3149; - this.match(CqlParser.K_STORAGE); - break; - case CqlParser.K_STYPE: - this.enterOuterAlt(localctx, 95); - this.state = 3150; - this.match(CqlParser.K_STYPE); - break; - case CqlParser.K_SUPERUSER: - this.enterOuterAlt(localctx, 96); - this.state = 3151; - this.match(CqlParser.K_SUPERUSER); - break; - case CqlParser.K_TABLE: - this.enterOuterAlt(localctx, 97); - this.state = 3152; - this.match(CqlParser.K_TABLE); - break; - case CqlParser.K_THREE: - this.enterOuterAlt(localctx, 98); - this.state = 3153; - this.match(CqlParser.K_THREE); - break; - case CqlParser.K_TIMESTAMP: - this.enterOuterAlt(localctx, 99); - this.state = 3154; - this.match(CqlParser.K_TIMESTAMP); - break; - case CqlParser.K_TO: - this.enterOuterAlt(localctx, 100); - this.state = 3155; - this.match(CqlParser.K_TO); - break; - case CqlParser.K_TOKEN: - this.enterOuterAlt(localctx, 101); - this.state = 3156; - this.match(CqlParser.K_TOKEN); - break; - case CqlParser.K_TRIGGER: - this.enterOuterAlt(localctx, 102); - this.state = 3157; - this.match(CqlParser.K_TRIGGER); - break; - case CqlParser.K_TRUE: - this.enterOuterAlt(localctx, 103); - this.state = 3158; - this.match(CqlParser.K_TRUE); - break; - case CqlParser.K_TRUNCATE: - this.enterOuterAlt(localctx, 104); - this.state = 3159; - this.match(CqlParser.K_TRUNCATE); - break; - case CqlParser.K_TTL: - this.enterOuterAlt(localctx, 105); - this.state = 3160; - this.match(CqlParser.K_TTL); - break; - case CqlParser.K_TWO: - this.enterOuterAlt(localctx, 106); - this.state = 3161; - this.match(CqlParser.K_TWO); - break; - case CqlParser.K_TYPE: - this.enterOuterAlt(localctx, 107); - this.state = 3162; - this.match(CqlParser.K_TYPE); - break; - case CqlParser.K_UNLOGGED: - this.enterOuterAlt(localctx, 108); - this.state = 3163; - this.match(CqlParser.K_UNLOGGED); - break; - case CqlParser.K_UPDATE: - this.enterOuterAlt(localctx, 109); - this.state = 3164; - this.match(CqlParser.K_UPDATE); - break; - case CqlParser.K_USE: - this.enterOuterAlt(localctx, 110); - this.state = 3165; - this.match(CqlParser.K_USE); - break; - case CqlParser.K_USER: - this.enterOuterAlt(localctx, 111); - this.state = 3166; - this.match(CqlParser.K_USER); - break; - case CqlParser.K_USING: - this.enterOuterAlt(localctx, 112); - this.state = 3167; - this.match(CqlParser.K_USING); - break; - case CqlParser.K_UUID: - this.enterOuterAlt(localctx, 113); - this.state = 3168; - this.match(CqlParser.K_UUID); - break; - case CqlParser.K_VALUES: - this.enterOuterAlt(localctx, 114); - this.state = 3169; - this.match(CqlParser.K_VALUES); - break; - case CqlParser.K_VIEW: - this.enterOuterAlt(localctx, 115); - this.state = 3170; - this.match(CqlParser.K_VIEW); - break; - case CqlParser.K_WHERE: - this.enterOuterAlt(localctx, 116); - this.state = 3171; - this.match(CqlParser.K_WHERE); - break; - case CqlParser.K_WITH: - this.enterOuterAlt(localctx, 117); - this.state = 3172; - this.match(CqlParser.K_WITH); - break; - case CqlParser.K_WRITETIME: - this.enterOuterAlt(localctx, 118); - this.state = 3173; - this.match(CqlParser.K_WRITETIME); - break; - case CqlParser.K_ASCII: - this.enterOuterAlt(localctx, 119); - this.state = 3174; - this.match(CqlParser.K_ASCII); - break; - case CqlParser.K_BIGINT: - this.enterOuterAlt(localctx, 120); - this.state = 3175; - this.match(CqlParser.K_BIGINT); - break; - case CqlParser.K_BLOB: - this.enterOuterAlt(localctx, 121); - this.state = 3176; - this.match(CqlParser.K_BLOB); - break; - case CqlParser.K_BOOLEAN: - this.enterOuterAlt(localctx, 122); - this.state = 3177; - this.match(CqlParser.K_BOOLEAN); - break; - case CqlParser.K_COUNTER: - this.enterOuterAlt(localctx, 123); - this.state = 3178; - this.match(CqlParser.K_COUNTER); - break; - case CqlParser.K_DATE: - this.enterOuterAlt(localctx, 124); - this.state = 3179; - this.match(CqlParser.K_DATE); - break; - case CqlParser.K_DECIMAL: - this.enterOuterAlt(localctx, 125); - this.state = 3180; - this.match(CqlParser.K_DECIMAL); - break; - case CqlParser.K_DOUBLE: - this.enterOuterAlt(localctx, 126); - this.state = 3181; - this.match(CqlParser.K_DOUBLE); - break; - case CqlParser.K_FLOAT: - this.enterOuterAlt(localctx, 127); - this.state = 3182; - this.match(CqlParser.K_FLOAT); - break; - case CqlParser.K_FROZEN: - this.enterOuterAlt(localctx, 128); - this.state = 3183; - this.match(CqlParser.K_FROZEN); - break; - case CqlParser.K_INET: - this.enterOuterAlt(localctx, 129); - this.state = 3184; - this.match(CqlParser.K_INET); - break; - case CqlParser.K_INT: - this.enterOuterAlt(localctx, 130); - this.state = 3185; - this.match(CqlParser.K_INT); - break; - case CqlParser.K_LIST: - this.enterOuterAlt(localctx, 131); - this.state = 3186; - this.match(CqlParser.K_LIST); - break; - case CqlParser.K_MAP: - this.enterOuterAlt(localctx, 132); - this.state = 3187; - this.match(CqlParser.K_MAP); - break; - case CqlParser.K_SMALLINT: - this.enterOuterAlt(localctx, 133); - this.state = 3188; - this.match(CqlParser.K_SMALLINT); - break; - case CqlParser.K_TEXT: - this.enterOuterAlt(localctx, 134); - this.state = 3189; - this.match(CqlParser.K_TEXT); - break; - case CqlParser.K_TIMEUUID: - this.enterOuterAlt(localctx, 135); - this.state = 3190; - this.match(CqlParser.K_TIMEUUID); - break; - case CqlParser.K_TIME: - this.enterOuterAlt(localctx, 136); - this.state = 3191; - this.match(CqlParser.K_TIME); - break; - case CqlParser.K_TINYINT: - this.enterOuterAlt(localctx, 137); - this.state = 3192; - this.match(CqlParser.K_TINYINT); - break; - case CqlParser.K_TUPLE: - this.enterOuterAlt(localctx, 138); - this.state = 3193; - this.match(CqlParser.K_TUPLE); - break; - case CqlParser.K_VARCHAR: - this.enterOuterAlt(localctx, 139); - this.state = 3194; - this.match(CqlParser.K_VARCHAR); - break; - case CqlParser.K_VARINT: - this.enterOuterAlt(localctx, 140); - this.state = 3195; - this.match(CqlParser.K_VARINT); - break; - case CqlParser.K_USERS: - this.enterOuterAlt(localctx, 141); - this.state = 3196; - this.match(CqlParser.K_USERS); - break; - case CqlParser.K_VECTOR: - this.enterOuterAlt(localctx, 142); - this.state = 3197; - this.match(CqlParser.K_VECTOR); - break; - default: - throw new antlr4.error.NoViableAltException(this); - } - } catch (re) { - if (re instanceof antlr4.error.RecognitionException) { - localctx.exception = re; - this._errHandler.reportError(this, re); - this._errHandler.recover(this, re); - } else { - throw re; - } - } finally { - this.exitRule(); - } - return localctx; - } -} - -CqlParser.EOF = antlr4.Token.EOF; -CqlParser.LR_BRACKET = 1; -CqlParser.RR_BRACKET = 2; -CqlParser.LC_BRACKET = 3; -CqlParser.RC_BRACKET = 4; -CqlParser.LS_BRACKET = 5; -CqlParser.RS_BRACKET = 6; -CqlParser.COMMA = 7; -CqlParser.SEMI = 8; -CqlParser.COLON = 9; -CqlParser.SPACE = 10; -CqlParser.SPEC_MYSQL_COMMENT = 11; -CqlParser.COMMENT_INPUT = 12; -CqlParser.LINE_COMMENT = 13; -CqlParser.DOT = 14; -CqlParser.STAR = 15; -CqlParser.DIVIDE = 16; -CqlParser.MODULE = 17; -CqlParser.PLUS = 18; -CqlParser.MINUSMINUS = 19; -CqlParser.MINUS = 20; -CqlParser.DQUOTE = 21; -CqlParser.SQUOTE = 22; -CqlParser.K_ADD = 23; -CqlParser.K_AGGREGATE = 24; -CqlParser.K_ALL = 25; -CqlParser.K_ALLOW = 26; -CqlParser.K_ALTER = 27; -CqlParser.K_AND = 28; -CqlParser.K_ANY = 29; -CqlParser.K_APPLY = 30; -CqlParser.K_AS = 31; -CqlParser.K_ASC = 32; -CqlParser.K_AUTHORIZE = 33; -CqlParser.K_BATCH = 34; -CqlParser.K_BEGIN = 35; -CqlParser.K_BY = 36; -CqlParser.K_CALLED = 37; -CqlParser.K_CLUSTERING = 38; -CqlParser.K_COLUMNFAMILY = 39; -CqlParser.K_COMPACT = 40; -CqlParser.K_CONSISTENCY = 41; -CqlParser.K_CONTAINS = 42; -CqlParser.K_CREATE = 43; -CqlParser.K_CUSTOM = 44; -CqlParser.K_SEARCH = 45; -CqlParser.K_DELETE = 46; -CqlParser.K_DESC = 47; -CqlParser.K_DESCRIBE = 48; -CqlParser.K_DISTINCT = 49; -CqlParser.K_DROP = 50; -CqlParser.K_DURABLE_WRITES = 51; -CqlParser.K_EACH_QUORUM = 52; -CqlParser.K_ENTRIES = 53; -CqlParser.K_EXECUTE = 54; -CqlParser.K_EXISTS = 55; -CqlParser.K_FALSE = 56; -CqlParser.K_FILTERING = 57; -CqlParser.K_FINALFUNC = 58; -CqlParser.K_FROM = 59; -CqlParser.K_FULL = 60; -CqlParser.K_FUNCTION = 61; -CqlParser.K_FUNCTIONS = 62; -CqlParser.K_GRANT = 63; -CqlParser.K_IF = 64; -CqlParser.K_IN = 65; -CqlParser.K_INDEX = 66; -CqlParser.K_INFINITY = 67; -CqlParser.K_INITCOND = 68; -CqlParser.K_INPUT = 69; -CqlParser.K_INSERT = 70; -CqlParser.K_INTO = 71; -CqlParser.K_IS = 72; -CqlParser.K_JSON = 73; -CqlParser.K_KEY = 74; -CqlParser.K_KEYS = 75; -CqlParser.K_KEYSPACE = 76; -CqlParser.K_KEYSPACES = 77; -CqlParser.K_LANGUAGE = 78; -CqlParser.K_LEVEL = 79; -CqlParser.K_LIMIT = 80; -CqlParser.K_LOCAL_ONE = 81; -CqlParser.K_LOCAL_QUORUM = 82; -CqlParser.K_LOGGED = 83; -CqlParser.K_LOGIN = 84; -CqlParser.K_MATERIALIZED = 85; -CqlParser.K_MODIFY = 86; -CqlParser.K_NAN = 87; -CqlParser.K_NORECURSIVE = 88; -CqlParser.K_NOSUPERUSER = 89; -CqlParser.K_NOT = 90; -CqlParser.K_NULL = 91; -CqlParser.K_OF = 92; -CqlParser.K_ON = 93; -CqlParser.K_ONE = 94; -CqlParser.K_OPTIONS = 95; -CqlParser.K_OR = 96; -CqlParser.K_ORDER = 97; -CqlParser.K_PARTITION = 98; -CqlParser.K_PASSWORD = 99; -CqlParser.K_PER = 100; -CqlParser.K_PERMISSION = 101; -CqlParser.K_PERMISSIONS = 102; -CqlParser.K_PRIMARY = 103; -CqlParser.K_QUORUM = 104; -CqlParser.K_RENAME = 105; -CqlParser.K_REPLACE = 106; -CqlParser.K_REPLICATION = 107; -CqlParser.K_RETURNS = 108; -CqlParser.K_REVOKE = 109; -CqlParser.K_ROLE = 110; -CqlParser.K_ROLES = 111; -CqlParser.K_INTERNAL = 112; -CqlParser.K_LDAP = 113; -CqlParser.K_SCHEME = 114; -CqlParser.K_SCHEMA = 115; -CqlParser.K_SELECT = 116; -CqlParser.K_SET = 117; -CqlParser.K_SFUNC = 118; -CqlParser.K_STATIC = 119; -CqlParser.K_STORAGE = 120; -CqlParser.K_STYPE = 121; -CqlParser.K_SUPERUSER = 122; -CqlParser.K_TABLE = 123; -CqlParser.K_THREE = 124; -CqlParser.K_TIMESTAMP = 125; -CqlParser.K_TO = 126; -CqlParser.K_TOKEN = 127; -CqlParser.K_TRIGGER = 128; -CqlParser.K_TRUE = 129; -CqlParser.K_TRUNCATE = 130; -CqlParser.K_TTL = 131; -CqlParser.K_TWO = 132; -CqlParser.K_TYPE = 133; -CqlParser.K_UNLOGGED = 134; -CqlParser.K_UPDATE = 135; -CqlParser.K_USE = 136; -CqlParser.K_USER = 137; -CqlParser.K_USING = 138; -CqlParser.K_UUID = 139; -CqlParser.K_VALUES = 140; -CqlParser.K_VIEW = 141; -CqlParser.K_WHERE = 142; -CqlParser.K_WITH = 143; -CqlParser.K_WRITETIME = 144; -CqlParser.K_ASCII = 145; -CqlParser.K_CASE_SENITIVE = 146; -CqlParser.K_NORMALIZE = 147; -CqlParser.K_SIMILARITY_FUNCTION = 148; -CqlParser.K_ANALYZED = 149; -CqlParser.K_IS_LITERAL = 150; -CqlParser.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB = 151; -CqlParser.K_TOKENIZATION_ENABLE_STEMMING = 152; -CqlParser.K_TOKENIZATION_SKIP_STOP_WORDS = 153; -CqlParser.K_TOKENIZATION_LOCALE = 154; -CqlParser.K_TOKENIZATION_NORMALIZE_LOWERCASE = 155; -CqlParser.K_TOKENIZATION_NORMALIZE_UPPERCASE = 156; -CqlParser.K_NORMALIZE_LOWERCASE = 157; -CqlParser.K_NORMALIZE_UPPERCASE = 158; -CqlParser.K_MODE = 159; -CqlParser.K_ANALYZER_CLASS = 160; -CqlParser.K_STORAGE_ATTACHED_INDEX = 161; -CqlParser.K_SASI_INDEX = 162; -CqlParser.K_SOLR_INDEX = 163; -CqlParser.K_SPACE_SAVING_NO_JOIN = 164; -CqlParser.K_SPACE_SAVING_ALL = 165; -CqlParser.K_SPACE_SAVING_SLOW_TRIE_PRECISION = 166; -CqlParser.K_SPACE_SAVING_NO_TEXT_FIELD = 167; -CqlParser.K_DOC_VALUES = 168; -CqlParser.K_COPY_FIELD = 169; -CqlParser.K_EXCLUDED = 170; -CqlParser.K_INDEXED = 171; -CqlParser.K_LOWERCASE = 172; -CqlParser.K_COLUMNS = 173; -CqlParser.K_PROFILES = 174; -CqlParser.K_CONFIG = 175; -CqlParser.K_AUTOCOMMIT_TIME = 176; -CqlParser.K_DEFAULT_QUERY_FIELD = 177; -CqlParser.K_DIRECTORY_FACTORY = 178; -CqlParser.K_FILTER_CACHE_LOW_WATERMARK = 179; -CqlParser.K_FILTER_CACHE_HIGH_WATERMARK = 180; -CqlParser.K_DIRECTORY_FACTORY_CLASS = 181; -CqlParser.K_MERGE_MAX_THREAD_COUNT = 182; -CqlParser.K_MERGE_MAX_MERGE_COUNT = 183; -CqlParser.K_RAM_BUFFER_SIZE = 184; -CqlParser.K_REALTIME = 185; -CqlParser.K_RECOVERY = 186; -CqlParser.K_REINDEX = 187; -CqlParser.K_LENIENT = 188; -CqlParser.K_STANDARD = 189; -CqlParser.K_ENCRYPTED = 190; -CqlParser.K_BIGINT = 191; -CqlParser.K_BLOB = 192; -CqlParser.K_BOOLEAN = 193; -CqlParser.K_COUNTER = 194; -CqlParser.K_DATE = 195; -CqlParser.K_DECIMAL = 196; -CqlParser.K_DOUBLE = 197; -CqlParser.K_FLOAT = 198; -CqlParser.K_FROZEN = 199; -CqlParser.K_INET = 200; -CqlParser.K_INT = 201; -CqlParser.K_LIST = 202; -CqlParser.K_MAP = 203; -CqlParser.K_SMALLINT = 204; -CqlParser.K_TEXT = 205; -CqlParser.K_TIMEUUID = 206; -CqlParser.K_TIME = 207; -CqlParser.K_TINYINT = 208; -CqlParser.K_TUPLE = 209; -CqlParser.K_VARCHAR = 210; -CqlParser.K_VARINT = 211; -CqlParser.CODE_BLOCK = 212; -CqlParser.STRING_LITERAL = 213; -CqlParser.DECIMAL_LITERAL = 214; -CqlParser.FLOAT_LITERAL = 215; -CqlParser.HEXADECIMAL_LITERAL = 216; -CqlParser.REAL_LITERAL = 217; -CqlParser.OBJECT_NAME = 218; -CqlParser.UUID = 219; -CqlParser.OPERATOR_EQ = 220; -CqlParser.OPERATOR_LT = 221; -CqlParser.OPERATOR_GT = 222; -CqlParser.OPERATOR_LTE = 223; -CqlParser.OPERATOR_GTE = 224; -CqlParser.K_USERS = 225; -CqlParser.K_VECTOR = 226; - -CqlParser.RULE_root = 0; -CqlParser.RULE_cqls = 1; -CqlParser.RULE_statementSeparator = 2; -CqlParser.RULE_empty = 3; -CqlParser.RULE_cql = 4; -CqlParser.RULE_revoke = 5; -CqlParser.RULE_listUsers = 6; -CqlParser.RULE_listRoles = 7; -CqlParser.RULE_listPermissions = 8; -CqlParser.RULE_grant = 9; -CqlParser.RULE_priviledge = 10; -CqlParser.RULE_resource = 11; -CqlParser.RULE_createUser = 12; -CqlParser.RULE_createRole = 13; -CqlParser.RULE_createType = 14; -CqlParser.RULE_typeMemberColumnList = 15; -CqlParser.RULE_createTrigger = 16; -CqlParser.RULE_createMaterializedView = 17; -CqlParser.RULE_materializedViewWhere = 18; -CqlParser.RULE_columnNotNullList = 19; -CqlParser.RULE_columnNotNull = 20; -CqlParser.RULE_materializedViewOptions = 21; -CqlParser.RULE_createKeyspace = 22; -CqlParser.RULE_createFunction = 23; -CqlParser.RULE_codeBlock = 24; -CqlParser.RULE_paramList = 25; -CqlParser.RULE_returnMode = 26; -CqlParser.RULE_createAggregate = 27; -CqlParser.RULE_initCondDefinition = 28; -CqlParser.RULE_initCondHash = 29; -CqlParser.RULE_initCondHashItem = 30; -CqlParser.RULE_initCondListNested = 31; -CqlParser.RULE_initCondList = 32; -CqlParser.RULE_orReplace = 33; -CqlParser.RULE_alterUser = 34; -CqlParser.RULE_userPassword = 35; -CqlParser.RULE_userSuperUser = 36; -CqlParser.RULE_alterType = 37; -CqlParser.RULE_alterTypeOperation = 38; -CqlParser.RULE_alterTypeRename = 39; -CqlParser.RULE_alterTypeRenameList = 40; -CqlParser.RULE_alterTypeRenameItem = 41; -CqlParser.RULE_alterTypeAdd = 42; -CqlParser.RULE_alterTypeAlterType = 43; -CqlParser.RULE_alterTable = 44; -CqlParser.RULE_alterTableOperation = 45; -CqlParser.RULE_alterTableWith = 46; -CqlParser.RULE_alterTableRename = 47; -CqlParser.RULE_alterTableDropCompactStorage = 48; -CqlParser.RULE_alterTableDropColumns = 49; -CqlParser.RULE_alterTableDropColumnList = 50; -CqlParser.RULE_alterTableAdd = 51; -CqlParser.RULE_alterTableColumnDefinition = 52; -CqlParser.RULE_alterRole = 53; -CqlParser.RULE_roleWith = 54; -CqlParser.RULE_roleWithOptions = 55; -CqlParser.RULE_alterMaterializedView = 56; -CqlParser.RULE_dropUser = 57; -CqlParser.RULE_dropType = 58; -CqlParser.RULE_dropMaterializedView = 59; -CqlParser.RULE_dropAggregate = 60; -CqlParser.RULE_dropFunction = 61; -CqlParser.RULE_dropTrigger = 62; -CqlParser.RULE_dropRole = 63; -CqlParser.RULE_dropTable = 64; -CqlParser.RULE_dropKeyspace = 65; -CqlParser.RULE_dropIndex = 66; -CqlParser.RULE_createTable = 67; -CqlParser.RULE_withElement = 68; -CqlParser.RULE_clusteringOrderColumns = 69; -CqlParser.RULE_clusteringOrder = 70; -CqlParser.RULE_tableOptions = 71; -CqlParser.RULE_tableOptionItem = 72; -CqlParser.RULE_tableOptionName = 73; -CqlParser.RULE_tableOptionValue = 74; -CqlParser.RULE_optionHash = 75; -CqlParser.RULE_optionHashItem = 76; -CqlParser.RULE_optionHashKey = 77; -CqlParser.RULE_optionHashValue = 78; -CqlParser.RULE_columnDefinitionList = 79; -CqlParser.RULE_columnDefinition = 80; -CqlParser.RULE_primaryKeyColumn = 81; -CqlParser.RULE_primaryKeyElement = 82; -CqlParser.RULE_primaryKeyDefinition = 83; -CqlParser.RULE_singlePrimaryKey = 84; -CqlParser.RULE_compoundKey = 85; -CqlParser.RULE_compositeKey = 86; -CqlParser.RULE_partitionKeyList = 87; -CqlParser.RULE_clusteringKeyList = 88; -CqlParser.RULE_partitionKey = 89; -CqlParser.RULE_clusteringKey = 90; -CqlParser.RULE_applyBatch = 91; -CqlParser.RULE_beginBatch = 92; -CqlParser.RULE_batchType = 93; -CqlParser.RULE_alterKeyspace = 94; -CqlParser.RULE_replicationList = 95; -CqlParser.RULE_replicationListItem = 96; -CqlParser.RULE_durableWrites = 97; -CqlParser.RULE_use = 98; -CqlParser.RULE_truncate = 99; -CqlParser.RULE_createIndex = 100; -CqlParser.RULE_customIndexOption = 101; -CqlParser.RULE_createSearchIndex = 102; -CqlParser.RULE_searchIndexConfigs = 103; -CqlParser.RULE_directoryFactory = 104; -CqlParser.RULE_searchIndexOptions = 105; -CqlParser.RULE_searchIndexProfile = 106; -CqlParser.RULE_searchIndexProfiles = 107; -CqlParser.RULE_searchIndexColumnList = 108; -CqlParser.RULE_searchIndexColumn = 109; -CqlParser.RULE_indexName = 110; -CqlParser.RULE_indexColumnSpec = 111; -CqlParser.RULE_indexKeysSpec = 112; -CqlParser.RULE_indexEntriesSSpec = 113; -CqlParser.RULE_indexFullSpec = 114; -CqlParser.RULE_indexValuesSpec = 115; -CqlParser.RULE_deleteStatement = 116; -CqlParser.RULE_deleteColumnList = 117; -CqlParser.RULE_deleteColumnItem = 118; -CqlParser.RULE_update = 119; -CqlParser.RULE_ifSpec = 120; -CqlParser.RULE_ifConditionList = 121; -CqlParser.RULE_ifCondition = 122; -CqlParser.RULE_assignments = 123; -CqlParser.RULE_assignmentElement = 124; -CqlParser.RULE_assignmentSet = 125; -CqlParser.RULE_assignmentMap = 126; -CqlParser.RULE_assignmentMapExpression = 127; -CqlParser.RULE_assignmentList = 128; -CqlParser.RULE_assignmentTuple = 129; -CqlParser.RULE_insert = 130; -CqlParser.RULE_usingTtlTimestamp = 131; -CqlParser.RULE_timestamp = 132; -CqlParser.RULE_ttl = 133; -CqlParser.RULE_usingTimestampSpec = 134; -CqlParser.RULE_ifNotExist = 135; -CqlParser.RULE_ifExist = 136; -CqlParser.RULE_insertValuesSpec = 137; -CqlParser.RULE_insertColumnSpec = 138; -CqlParser.RULE_columnList = 139; -CqlParser.RULE_expressionList = 140; -CqlParser.RULE_expression = 141; -CqlParser.RULE_select = 142; -CqlParser.RULE_allowFilteringSpec = 143; -CqlParser.RULE_limitSpec = 144; -CqlParser.RULE_fromSpec = 145; -CqlParser.RULE_fromSpecElement = 146; -CqlParser.RULE_orderSpec = 147; -CqlParser.RULE_orderSpecElement = 148; -CqlParser.RULE_whereSpec = 149; -CqlParser.RULE_distinctSpec = 150; -CqlParser.RULE_selectElements = 151; -CqlParser.RULE_selectElement = 152; -CqlParser.RULE_relationElements = 153; -CqlParser.RULE_relationElement = 154; -CqlParser.RULE_relalationContains = 155; -CqlParser.RULE_relalationContainsKey = 156; -CqlParser.RULE_functionCall = 157; -CqlParser.RULE_functionArgs = 158; -CqlParser.RULE_constant = 159; -CqlParser.RULE_decimalLiteral = 160; -CqlParser.RULE_floatLiteral = 161; -CqlParser.RULE_stringLiteral = 162; -CqlParser.RULE_booleanLiteral = 163; -CqlParser.RULE_hexadecimalLiteral = 164; -CqlParser.RULE_keyspace = 165; -CqlParser.RULE_table = 166; -CqlParser.RULE_column = 167; -CqlParser.RULE_dataType = 168; -CqlParser.RULE_dataTypeName = 169; -CqlParser.RULE_dataTypeDefinition = 170; -CqlParser.RULE_orderDirection = 171; -CqlParser.RULE_role = 172; -CqlParser.RULE_trigger = 173; -CqlParser.RULE_triggerClass = 174; -CqlParser.RULE_materializedView = 175; -CqlParser.RULE_type = 176; -CqlParser.RULE_aggregate = 177; -CqlParser.RULE_functionStatement = 178; -CqlParser.RULE_language = 179; -CqlParser.RULE_user = 180; -CqlParser.RULE_password = 181; -CqlParser.RULE_hashKey = 182; -CqlParser.RULE_param = 183; -CqlParser.RULE_paramName = 184; -CqlParser.RULE_kwAdd = 185; -CqlParser.RULE_kwAggregate = 186; -CqlParser.RULE_kwAll = 187; -CqlParser.RULE_kwAllPermissions = 188; -CqlParser.RULE_kwAllow = 189; -CqlParser.RULE_kwAlter = 190; -CqlParser.RULE_kwAnd = 191; -CqlParser.RULE_kwApply = 192; -CqlParser.RULE_kwAs = 193; -CqlParser.RULE_kwAsc = 194; -CqlParser.RULE_kwAuthorize = 195; -CqlParser.RULE_kwBatch = 196; -CqlParser.RULE_kwBegin = 197; -CqlParser.RULE_kwBy = 198; -CqlParser.RULE_kwCalled = 199; -CqlParser.RULE_kwClustering = 200; -CqlParser.RULE_kwCompact = 201; -CqlParser.RULE_kwContains = 202; -CqlParser.RULE_kwCreate = 203; -CqlParser.RULE_kwDelete = 204; -CqlParser.RULE_kwDesc = 205; -CqlParser.RULE_kwDescibe = 206; -CqlParser.RULE_kwDistinct = 207; -CqlParser.RULE_kwDrop = 208; -CqlParser.RULE_kwDurableWrites = 209; -CqlParser.RULE_kwEntries = 210; -CqlParser.RULE_kwExecute = 211; -CqlParser.RULE_kwExists = 212; -CqlParser.RULE_kwFiltering = 213; -CqlParser.RULE_kwFinalfunc = 214; -CqlParser.RULE_kwFrom = 215; -CqlParser.RULE_kwFull = 216; -CqlParser.RULE_kwFunction = 217; -CqlParser.RULE_kwFunctions = 218; -CqlParser.RULE_kwGrant = 219; -CqlParser.RULE_kwIf = 220; -CqlParser.RULE_kwIn = 221; -CqlParser.RULE_kwIndex = 222; -CqlParser.RULE_kwCustom = 223; -CqlParser.RULE_kwSearch = 224; -CqlParser.RULE_kwAscii = 225; -CqlParser.RULE_kwNormalize = 226; -CqlParser.RULE_kwAnalyzed = 227; -CqlParser.RULE_kwIsLiteral = 228; -CqlParser.RULE_kwMaxCompactionFlushMemoryInMb = 229; -CqlParser.RULE_kwTokenizationEnableStemming = 230; -CqlParser.RULE_kwTokenizationSkipStopWords = 231; -CqlParser.RULE_kwTokenizationLocale = 232; -CqlParser.RULE_kwTokenizationNormalizeLowercase = 233; -CqlParser.RULE_kwTokenizationNormalizeUppercase = 234; -CqlParser.RULE_kwNormalizeLowercase = 235; -CqlParser.RULE_kwNormalizeUppercase = 236; -CqlParser.RULE_kwMode = 237; -CqlParser.RULE_kwAnalyzerClass = 238; -CqlParser.RULE_kwStorageAttachedIndex = 239; -CqlParser.RULE_kwSolrIndex = 240; -CqlParser.RULE_kwSASIIndex = 241; -CqlParser.RULE_kwSpaceSavingNoJoin = 242; -CqlParser.RULE_kwSpaceSavingAll = 243; -CqlParser.RULE_kwSpaceSavingSlowTriePrecision = 244; -CqlParser.RULE_kwSpaceSavingNoTextField = 245; -CqlParser.RULE_kwCopyField = 246; -CqlParser.RULE_kwDocValues = 247; -CqlParser.RULE_kwExcluded = 248; -CqlParser.RULE_kwIndexed = 249; -CqlParser.RULE_kwLowerCase = 250; -CqlParser.RULE_kwColumns = 251; -CqlParser.RULE_kwProfiles = 252; -CqlParser.RULE_kwConfig = 253; -CqlParser.RULE_kwAutoCommitTime = 254; -CqlParser.RULE_kwDefaultQueryField = 255; -CqlParser.RULE_kwDirectoryFactory = 256; -CqlParser.RULE_kwFilterCacheLowWaterMark = 257; -CqlParser.RULE_kwFilterCacheHighWaterMark = 258; -CqlParser.RULE_kwDirectoryFactoryClass = 259; -CqlParser.RULE_kwMergeMaxThreadCount = 260; -CqlParser.RULE_kwMergeMaxMergeCount = 261; -CqlParser.RULE_kwRamBufferSize = 262; -CqlParser.RULE_kwRealtime = 263; -CqlParser.RULE_kwRecovery = 264; -CqlParser.RULE_kwReindex = 265; -CqlParser.RULE_kwLenient = 266; -CqlParser.RULE_kwStandard = 267; -CqlParser.RULE_kwEncrypted = 268; -CqlParser.RULE_kwCaseSensitive = 269; -CqlParser.RULE_kwSimilarityFunction = 270; -CqlParser.RULE_kwInitcond = 271; -CqlParser.RULE_kwInput = 272; -CqlParser.RULE_kwInsert = 273; -CqlParser.RULE_kwInto = 274; -CqlParser.RULE_kwIs = 275; -CqlParser.RULE_kwJson = 276; -CqlParser.RULE_kwKey = 277; -CqlParser.RULE_kwKeys = 278; -CqlParser.RULE_kwKeyspace = 279; -CqlParser.RULE_kwKeyspaces = 280; -CqlParser.RULE_kwLanguage = 281; -CqlParser.RULE_kwLimit = 282; -CqlParser.RULE_kwList = 283; -CqlParser.RULE_kwLogged = 284; -CqlParser.RULE_kwLogin = 285; -CqlParser.RULE_kwMaterialized = 286; -CqlParser.RULE_kwModify = 287; -CqlParser.RULE_kwNosuperuser = 288; -CqlParser.RULE_kwNorecursive = 289; -CqlParser.RULE_kwNot = 290; -CqlParser.RULE_kwNull = 291; -CqlParser.RULE_kwOf = 292; -CqlParser.RULE_kwOn = 293; -CqlParser.RULE_kwOptions = 294; -CqlParser.RULE_kwOr = 295; -CqlParser.RULE_kwOrder = 296; -CqlParser.RULE_kwPassword = 297; -CqlParser.RULE_kwPrimary = 298; -CqlParser.RULE_kwRename = 299; -CqlParser.RULE_kwReplace = 300; -CqlParser.RULE_kwReplication = 301; -CqlParser.RULE_kwReturns = 302; -CqlParser.RULE_kwRole = 303; -CqlParser.RULE_kwInternal = 304; -CqlParser.RULE_kwLdap = 305; -CqlParser.RULE_kwScheme = 306; -CqlParser.RULE_kwRoles = 307; -CqlParser.RULE_kwSelect = 308; -CqlParser.RULE_kwSet = 309; -CqlParser.RULE_kwSfunc = 310; -CqlParser.RULE_kwStorage = 311; -CqlParser.RULE_kwStype = 312; -CqlParser.RULE_kwSuperuser = 313; -CqlParser.RULE_kwTable = 314; -CqlParser.RULE_kwTimestamp = 315; -CqlParser.RULE_kwTo = 316; -CqlParser.RULE_kwTrigger = 317; -CqlParser.RULE_kwTruncate = 318; -CqlParser.RULE_kwTtl = 319; -CqlParser.RULE_kwType = 320; -CqlParser.RULE_kwUnlogged = 321; -CqlParser.RULE_kwUpdate = 322; -CqlParser.RULE_kwUse = 323; -CqlParser.RULE_kwUser = 324; -CqlParser.RULE_kwUsers = 325; -CqlParser.RULE_kwUsing = 326; -CqlParser.RULE_kwValues = 327; -CqlParser.RULE_kwView = 328; -CqlParser.RULE_kwWhere = 329; -CqlParser.RULE_kwWith = 330; -CqlParser.RULE_kwRevoke = 331; -CqlParser.RULE_eof = 332; -CqlParser.RULE_syntaxBracketLr = 333; -CqlParser.RULE_syntaxBracketRr = 334; -CqlParser.RULE_syntaxBracketLc = 335; -CqlParser.RULE_syntaxBracketRc = 336; -CqlParser.RULE_syntaxBracketLa = 337; -CqlParser.RULE_syntaxBracketRa = 338; -CqlParser.RULE_syntaxBracketLs = 339; -CqlParser.RULE_syntaxBracketRs = 340; -CqlParser.RULE_syntaxComma = 341; -CqlParser.RULE_syntaxColon = 342; -CqlParser.RULE_id = 343; - -class RootContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_root; - } - - eof() { - return this.getTypedRuleContext(EofContext, 0); - } - - cqls() { - return this.getTypedRuleContext(CqlsContext, 0); - } - - MINUSMINUS() { - return this.getToken(CqlParser.MINUSMINUS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRoot(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CqlsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_cqls; - } - - cql = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(CqlContext); - } else { - return this.getTypedRuleContext(CqlContext, i); - } - }; - - empty = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(EmptyContext); - } else { - return this.getTypedRuleContext(EmptyContext, i); - } - }; - - statementSeparator = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(StatementSeparatorContext); - } else { - return this.getTypedRuleContext(StatementSeparatorContext, i); - } - }; - - MINUSMINUS = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.MINUSMINUS); - } else { - return this.getToken(CqlParser.MINUSMINUS, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCqls(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class StatementSeparatorContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_statementSeparator; - } - - SEMI() { - return this.getToken(CqlParser.SEMI, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitStatementSeparator(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class EmptyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_empty; - } - - statementSeparator() { - return this.getTypedRuleContext(StatementSeparatorContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitEmpty(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CqlContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_cql; - } - - alterKeyspace() { - return this.getTypedRuleContext(AlterKeyspaceContext, 0); - } - - alterMaterializedView() { - return this.getTypedRuleContext(AlterMaterializedViewContext, 0); - } - - alterRole() { - return this.getTypedRuleContext(AlterRoleContext, 0); - } - - alterTable() { - return this.getTypedRuleContext(AlterTableContext, 0); - } - - alterType() { - return this.getTypedRuleContext(AlterTypeContext, 0); - } - - alterUser() { - return this.getTypedRuleContext(AlterUserContext, 0); - } - - applyBatch() { - return this.getTypedRuleContext(ApplyBatchContext, 0); - } - - createAggregate() { - return this.getTypedRuleContext(CreateAggregateContext, 0); - } - - createFunction() { - return this.getTypedRuleContext(CreateFunctionContext, 0); - } - - createIndex() { - return this.getTypedRuleContext(CreateIndexContext, 0); - } - - createSearchIndex() { - return this.getTypedRuleContext(CreateSearchIndexContext, 0); - } - - createKeyspace() { - return this.getTypedRuleContext(CreateKeyspaceContext, 0); - } - - createMaterializedView() { - return this.getTypedRuleContext(CreateMaterializedViewContext, 0); - } - - createRole() { - return this.getTypedRuleContext(CreateRoleContext, 0); - } - - createTable() { - return this.getTypedRuleContext(CreateTableContext, 0); - } - - createTrigger() { - return this.getTypedRuleContext(CreateTriggerContext, 0); - } - - createType() { - return this.getTypedRuleContext(CreateTypeContext, 0); - } - - createUser() { - return this.getTypedRuleContext(CreateUserContext, 0); - } - - deleteStatement() { - return this.getTypedRuleContext(DeleteStatementContext, 0); - } - - dropAggregate() { - return this.getTypedRuleContext(DropAggregateContext, 0); - } - - dropFunction() { - return this.getTypedRuleContext(DropFunctionContext, 0); - } - - dropIndex() { - return this.getTypedRuleContext(DropIndexContext, 0); - } - - dropKeyspace() { - return this.getTypedRuleContext(DropKeyspaceContext, 0); - } - - dropMaterializedView() { - return this.getTypedRuleContext(DropMaterializedViewContext, 0); - } - - dropRole() { - return this.getTypedRuleContext(DropRoleContext, 0); - } - - dropTable() { - return this.getTypedRuleContext(DropTableContext, 0); - } - - dropTrigger() { - return this.getTypedRuleContext(DropTriggerContext, 0); - } - - dropType() { - return this.getTypedRuleContext(DropTypeContext, 0); - } - - dropUser() { - return this.getTypedRuleContext(DropUserContext, 0); - } - - grant() { - return this.getTypedRuleContext(GrantContext, 0); - } - - insert() { - return this.getTypedRuleContext(InsertContext, 0); - } - - listPermissions() { - return this.getTypedRuleContext(ListPermissionsContext, 0); - } - - listRoles() { - return this.getTypedRuleContext(ListRolesContext, 0); - } - - revoke() { - return this.getTypedRuleContext(RevokeContext, 0); - } - - select() { - return this.getTypedRuleContext(SelectContext, 0); - } - - truncate() { - return this.getTypedRuleContext(TruncateContext, 0); - } - - update() { - return this.getTypedRuleContext(UpdateContext, 0); - } - - use() { - return this.getTypedRuleContext(UseContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCql(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RevokeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_revoke; - } - - kwRevoke() { - return this.getTypedRuleContext(KwRevokeContext, 0); - } - - priviledge() { - return this.getTypedRuleContext(PriviledgeContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - resource() { - return this.getTypedRuleContext(ResourceContext, 0); - } - - kwFrom() { - return this.getTypedRuleContext(KwFromContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRevoke(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ListUsersContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_listUsers; - } - - kwList() { - return this.getTypedRuleContext(KwListContext, 0); - } - - kwUsers() { - return this.getTypedRuleContext(KwUsersContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitListUsers(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ListRolesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_listRoles; - } - - kwList() { - return this.getTypedRuleContext(KwListContext, 0); - } - - kwRoles() { - return this.getTypedRuleContext(KwRolesContext, 0); - } - - kwOf() { - return this.getTypedRuleContext(KwOfContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - kwNorecursive() { - return this.getTypedRuleContext(KwNorecursiveContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitListRoles(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ListPermissionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_listPermissions; - } - - kwList() { - return this.getTypedRuleContext(KwListContext, 0); - } - - priviledge() { - return this.getTypedRuleContext(PriviledgeContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - resource() { - return this.getTypedRuleContext(ResourceContext, 0); - } - - kwOf() { - return this.getTypedRuleContext(KwOfContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitListPermissions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class GrantContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_grant; - } - - kwGrant() { - return this.getTypedRuleContext(KwGrantContext, 0); - } - - priviledge() { - return this.getTypedRuleContext(PriviledgeContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - resource() { - return this.getTypedRuleContext(ResourceContext, 0); - } - - kwTo() { - return this.getTypedRuleContext(KwToContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitGrant(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PriviledgeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_priviledge; - } - - kwAll() { - return this.getTypedRuleContext(KwAllContext, 0); - } - - kwAllPermissions() { - return this.getTypedRuleContext(KwAllPermissionsContext, 0); - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwAuthorize() { - return this.getTypedRuleContext(KwAuthorizeContext, 0); - } - - kwDescibe() { - return this.getTypedRuleContext(KwDescibeContext, 0); - } - - kwExecute() { - return this.getTypedRuleContext(KwExecuteContext, 0); - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwModify() { - return this.getTypedRuleContext(KwModifyContext, 0); - } - - kwSelect() { - return this.getTypedRuleContext(KwSelectContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPriviledge(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ResourceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_resource; - } - - kwAll() { - return this.getTypedRuleContext(KwAllContext, 0); - } - - kwFunctions() { - return this.getTypedRuleContext(KwFunctionsContext, 0); - } - - kwIn() { - return this.getTypedRuleContext(KwInContext, 0); - } - - kwKeyspace() { - return this.getTypedRuleContext(KwKeyspaceContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - kwFunction() { - return this.getTypedRuleContext(KwFunctionContext, 0); - } - - functionStatement() { - return this.getTypedRuleContext(FunctionStatementContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - kwKeyspaces() { - return this.getTypedRuleContext(KwKeyspacesContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - kwTable() { - return this.getTypedRuleContext(KwTableContext, 0); - } - - kwRoles() { - return this.getTypedRuleContext(KwRolesContext, 0); - } - - kwRole() { - return this.getTypedRuleContext(KwRoleContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - kwScheme() { - return this.getTypedRuleContext(KwSchemeContext, 0); - } - - kwInternal() { - return this.getTypedRuleContext(KwInternalContext, 0); - } - - kwLdap() { - return this.getTypedRuleContext(KwLdapContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitResource(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateUserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createUser; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwUser() { - return this.getTypedRuleContext(KwUserContext, 0); - } - - user() { - return this.getTypedRuleContext(UserContext, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - kwPassword() { - return this.getTypedRuleContext(KwPasswordContext, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - kwSuperuser() { - return this.getTypedRuleContext(KwSuperuserContext, 0); - } - - kwNosuperuser() { - return this.getTypedRuleContext(KwNosuperuserContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateRoleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createRole; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwRole() { - return this.getTypedRuleContext(KwRoleContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - roleWith() { - return this.getTypedRuleContext(RoleWithContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateRole(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createType; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwType() { - return this.getTypedRuleContext(KwTypeContext, 0); - } - - type() { - return this.getTypedRuleContext(TypeContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - typeMemberColumnList() { - return this.getTypedRuleContext(TypeMemberColumnListContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TypeMemberColumnListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_typeMemberColumnList; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - dataType = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DataTypeContext); - } else { - return this.getTypedRuleContext(DataTypeContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTypeMemberColumnList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateTriggerContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createTrigger; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwTrigger() { - return this.getTypedRuleContext(KwTriggerContext, 0); - } - - trigger() { - return this.getTypedRuleContext(TriggerContext, 0); - } - - kwUsing() { - return this.getTypedRuleContext(KwUsingContext, 0); - } - - triggerClass() { - return this.getTypedRuleContext(TriggerClassContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateTrigger(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateMaterializedViewContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createMaterializedView; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwMaterialized() { - return this.getTypedRuleContext(KwMaterializedContext, 0); - } - - kwView() { - return this.getTypedRuleContext(KwViewContext, 0); - } - - materializedView() { - return this.getTypedRuleContext(MaterializedViewContext, 0); - } - - kwAs() { - return this.getTypedRuleContext(KwAsContext, 0); - } - - kwSelect() { - return this.getTypedRuleContext(KwSelectContext, 0); - } - - columnList() { - return this.getTypedRuleContext(ColumnListContext, 0); - } - - kwFrom() { - return this.getTypedRuleContext(KwFromContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - materializedViewWhere() { - return this.getTypedRuleContext(MaterializedViewWhereContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KeyspaceContext); - } else { - return this.getTypedRuleContext(KeyspaceContext, i); - } - }; - - DOT = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.DOT); - } else { - return this.getToken(CqlParser.DOT, i); - } - }; - - primaryKeyElement() { - return this.getTypedRuleContext(PrimaryKeyElementContext, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - materializedViewOptions() { - return this.getTypedRuleContext(MaterializedViewOptionsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateMaterializedView(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class MaterializedViewWhereContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_materializedViewWhere; - } - - kwWhere() { - return this.getTypedRuleContext(KwWhereContext, 0); - } - - columnNotNullList() { - return this.getTypedRuleContext(ColumnNotNullListContext, 0); - } - - kwAnd() { - return this.getTypedRuleContext(KwAndContext, 0); - } - - relationElements() { - return this.getTypedRuleContext(RelationElementsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitMaterializedViewWhere(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnNotNullListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_columnNotNullList; - } - - columnNotNull = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnNotNullContext); - } else { - return this.getTypedRuleContext(ColumnNotNullContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumnNotNullList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnNotNullContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_columnNotNull; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - kwIs() { - return this.getTypedRuleContext(KwIsContext, 0); - } - - kwNot() { - return this.getTypedRuleContext(KwNotContext, 0); - } - - kwNull() { - return this.getTypedRuleContext(KwNullContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumnNotNull(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class MaterializedViewOptionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_materializedViewOptions; - } - - tableOptions() { - return this.getTypedRuleContext(TableOptionsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitMaterializedViewOptions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateKeyspaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createKeyspace; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwKeyspace() { - return this.getTypedRuleContext(KwKeyspaceContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - kwReplication() { - return this.getTypedRuleContext(KwReplicationContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - replicationList() { - return this.getTypedRuleContext(ReplicationListContext, 0); - } - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - kwAnd() { - return this.getTypedRuleContext(KwAndContext, 0); - } - - durableWrites() { - return this.getTypedRuleContext(DurableWritesContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateKeyspace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateFunctionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createFunction; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwFunction() { - return this.getTypedRuleContext(KwFunctionContext, 0); - } - - functionStatement() { - return this.getTypedRuleContext(FunctionStatementContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - returnMode() { - return this.getTypedRuleContext(ReturnModeContext, 0); - } - - kwReturns() { - return this.getTypedRuleContext(KwReturnsContext, 0); - } - - dataType() { - return this.getTypedRuleContext(DataTypeContext, 0); - } - - kwLanguage() { - return this.getTypedRuleContext(KwLanguageContext, 0); - } - - language() { - return this.getTypedRuleContext(LanguageContext, 0); - } - - kwAs() { - return this.getTypedRuleContext(KwAsContext, 0); - } - - codeBlock() { - return this.getTypedRuleContext(CodeBlockContext, 0); - } - - orReplace() { - return this.getTypedRuleContext(OrReplaceContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - paramList() { - return this.getTypedRuleContext(ParamListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateFunction(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CodeBlockContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_codeBlock; - } - - CODE_BLOCK() { - return this.getToken(CqlParser.CODE_BLOCK, 0); - } - - STRING_LITERAL() { - return this.getToken(CqlParser.STRING_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCodeBlock(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ParamListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_paramList; - } - - param = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ParamContext); - } else { - return this.getTypedRuleContext(ParamContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitParamList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ReturnModeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_returnMode; - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - kwNull = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwNullContext); - } else { - return this.getTypedRuleContext(KwNullContext, i); - } - }; - - kwInput() { - return this.getTypedRuleContext(KwInputContext, 0); - } - - kwCalled() { - return this.getTypedRuleContext(KwCalledContext, 0); - } - - kwReturns() { - return this.getTypedRuleContext(KwReturnsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitReturnMode(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateAggregateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createAggregate; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwAggregate() { - return this.getTypedRuleContext(KwAggregateContext, 0); - } - - aggregate() { - return this.getTypedRuleContext(AggregateContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - dataType = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DataTypeContext); - } else { - return this.getTypedRuleContext(DataTypeContext, i); - } - }; - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - kwSfunc() { - return this.getTypedRuleContext(KwSfuncContext, 0); - } - - functionStatement = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(FunctionStatementContext); - } else { - return this.getTypedRuleContext(FunctionStatementContext, i); - } - }; - - kwStype() { - return this.getTypedRuleContext(KwStypeContext, 0); - } - - kwFinalfunc() { - return this.getTypedRuleContext(KwFinalfuncContext, 0); - } - - kwInitcond() { - return this.getTypedRuleContext(KwInitcondContext, 0); - } - - initCondDefinition() { - return this.getTypedRuleContext(InitCondDefinitionContext, 0); - } - - orReplace() { - return this.getTypedRuleContext(OrReplaceContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateAggregate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InitCondDefinitionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_initCondDefinition; - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - initCondList() { - return this.getTypedRuleContext(InitCondListContext, 0); - } - - initCondListNested() { - return this.getTypedRuleContext(InitCondListNestedContext, 0); - } - - initCondHash() { - return this.getTypedRuleContext(InitCondHashContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInitCondDefinition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InitCondHashContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_initCondHash; - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - initCondHashItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(InitCondHashItemContext); - } else { - return this.getTypedRuleContext(InitCondHashItemContext, i); - } - }; - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInitCondHash(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InitCondHashItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_initCondHashItem; - } - - hashKey() { - return this.getTypedRuleContext(HashKeyContext, 0); - } - - COLON() { - return this.getToken(CqlParser.COLON, 0); - } - - initCondDefinition() { - return this.getTypedRuleContext(InitCondDefinitionContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInitCondHashItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InitCondListNestedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_initCondListNested; - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - initCondList = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(InitCondListContext); - } else { - return this.getTypedRuleContext(InitCondListContext, i); - } - }; - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - constant = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ConstantContext); - } else { - return this.getTypedRuleContext(ConstantContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInitCondListNested(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InitCondListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_initCondList; - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - constant = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ConstantContext); - } else { - return this.getTypedRuleContext(ConstantContext, i); - } - }; - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInitCondList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OrReplaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_orReplace; - } - - kwOr() { - return this.getTypedRuleContext(KwOrContext, 0); - } - - kwReplace() { - return this.getTypedRuleContext(KwReplaceContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOrReplace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterUserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterUser; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwUser() { - return this.getTypedRuleContext(KwUserContext, 0); - } - - user() { - return this.getTypedRuleContext(UserContext, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - userPassword() { - return this.getTypedRuleContext(UserPasswordContext, 0); - } - - userSuperUser() { - return this.getTypedRuleContext(UserSuperUserContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UserPasswordContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_userPassword; - } - - kwPassword() { - return this.getTypedRuleContext(KwPasswordContext, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUserPassword(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UserSuperUserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_userSuperUser; - } - - kwSuperuser() { - return this.getTypedRuleContext(KwSuperuserContext, 0); - } - - kwNosuperuser() { - return this.getTypedRuleContext(KwNosuperuserContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUserSuperUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterType; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwType() { - return this.getTypedRuleContext(KwTypeContext, 0); - } - - type() { - return this.getTypedRuleContext(TypeContext, 0); - } - - alterTypeOperation() { - return this.getTypedRuleContext(AlterTypeOperationContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeOperationContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeOperation; - } - - alterTypeAlterType() { - return this.getTypedRuleContext(AlterTypeAlterTypeContext, 0); - } - - alterTypeAdd() { - return this.getTypedRuleContext(AlterTypeAddContext, 0); - } - - alterTypeRename() { - return this.getTypedRuleContext(AlterTypeRenameContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeOperation(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeRenameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeRename; - } - - kwRename() { - return this.getTypedRuleContext(KwRenameContext, 0); - } - - alterTypeRenameList() { - return this.getTypedRuleContext(AlterTypeRenameListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeRename(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeRenameListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeRenameList; - } - - alterTypeRenameItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(AlterTypeRenameItemContext); - } else { - return this.getTypedRuleContext(AlterTypeRenameItemContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeRenameList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeRenameItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeRenameItem; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - kwTo() { - return this.getTypedRuleContext(KwToContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeRenameItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeAddContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeAdd; - } - - kwAdd() { - return this.getTypedRuleContext(KwAddContext, 0); - } - - typeMemberColumnList() { - return this.getTypedRuleContext(TypeMemberColumnListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeAdd(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTypeAlterTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTypeAlterType; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - kwType() { - return this.getTypedRuleContext(KwTypeContext, 0); - } - - dataType() { - return this.getTypedRuleContext(DataTypeContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTypeAlterType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTable; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwTable() { - return this.getTypedRuleContext(KwTableContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - alterTableOperation() { - return this.getTypedRuleContext(AlterTableOperationContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTable(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableOperationContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableOperation; - } - - alterTableAdd() { - return this.getTypedRuleContext(AlterTableAddContext, 0); - } - - alterTableDropColumns() { - return this.getTypedRuleContext(AlterTableDropColumnsContext, 0); - } - - alterTableDropCompactStorage() { - return this.getTypedRuleContext(AlterTableDropCompactStorageContext, 0); - } - - alterTableRename() { - return this.getTypedRuleContext(AlterTableRenameContext, 0); - } - - alterTableWith() { - return this.getTypedRuleContext(AlterTableWithContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableOperation(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableWithContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableWith; - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - tableOptions() { - return this.getTypedRuleContext(TableOptionsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableWith(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableRenameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableRename; - } - - kwRename() { - return this.getTypedRuleContext(KwRenameContext, 0); - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - kwTo() { - return this.getTypedRuleContext(KwToContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableRename(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableDropCompactStorageContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableDropCompactStorage; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwCompact() { - return this.getTypedRuleContext(KwCompactContext, 0); - } - - kwStorage() { - return this.getTypedRuleContext(KwStorageContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableDropCompactStorage(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableDropColumnsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableDropColumns; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - alterTableDropColumnList() { - return this.getTypedRuleContext(AlterTableDropColumnListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableDropColumns(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableDropColumnListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableDropColumnList; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableDropColumnList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableAddContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableAdd; - } - - kwAdd() { - return this.getTypedRuleContext(KwAddContext, 0); - } - - alterTableColumnDefinition() { - return this.getTypedRuleContext(AlterTableColumnDefinitionContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableAdd(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterTableColumnDefinitionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterTableColumnDefinition; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - dataType = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DataTypeContext); - } else { - return this.getTypedRuleContext(DataTypeContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterTableColumnDefinition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterRoleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterRole; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwRole() { - return this.getTypedRuleContext(KwRoleContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - roleWith() { - return this.getTypedRuleContext(RoleWithContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterRole(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RoleWithContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_roleWith; - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - roleWithOptions = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(RoleWithOptionsContext); - } else { - return this.getTypedRuleContext(RoleWithOptionsContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRoleWith(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RoleWithOptionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_roleWithOptions; - } - - kwPassword() { - return this.getTypedRuleContext(KwPasswordContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - kwLogin() { - return this.getTypedRuleContext(KwLoginContext, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - kwSuperuser() { - return this.getTypedRuleContext(KwSuperuserContext, 0); - } - - kwOptions() { - return this.getTypedRuleContext(KwOptionsContext, 0); - } - - optionHash() { - return this.getTypedRuleContext(OptionHashContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRoleWithOptions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterMaterializedViewContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterMaterializedView; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwMaterialized() { - return this.getTypedRuleContext(KwMaterializedContext, 0); - } - - kwView() { - return this.getTypedRuleContext(KwViewContext, 0); - } - - materializedView() { - return this.getTypedRuleContext(MaterializedViewContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - tableOptions() { - return this.getTypedRuleContext(TableOptionsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterMaterializedView(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropUserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropUser; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwUser() { - return this.getTypedRuleContext(KwUserContext, 0); - } - - user() { - return this.getTypedRuleContext(UserContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropType; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwType() { - return this.getTypedRuleContext(KwTypeContext, 0); - } - - type() { - return this.getTypedRuleContext(TypeContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropMaterializedViewContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropMaterializedView; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwMaterialized() { - return this.getTypedRuleContext(KwMaterializedContext, 0); - } - - kwView() { - return this.getTypedRuleContext(KwViewContext, 0); - } - - materializedView() { - return this.getTypedRuleContext(MaterializedViewContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropMaterializedView(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropAggregateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropAggregate; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwAggregate() { - return this.getTypedRuleContext(KwAggregateContext, 0); - } - - aggregate() { - return this.getTypedRuleContext(AggregateContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropAggregate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropFunctionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropFunction; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwFunction() { - return this.getTypedRuleContext(KwFunctionContext, 0); - } - - functionStatement() { - return this.getTypedRuleContext(FunctionStatementContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropFunction(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropTriggerContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropTrigger; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwTrigger() { - return this.getTypedRuleContext(KwTriggerContext, 0); - } - - trigger() { - return this.getTypedRuleContext(TriggerContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropTrigger(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropRoleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropRole; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwRole() { - return this.getTypedRuleContext(KwRoleContext, 0); - } - - role() { - return this.getTypedRuleContext(RoleContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropRole(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropTableContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropTable; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwTable() { - return this.getTypedRuleContext(KwTableContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropTable(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropKeyspaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropKeyspace; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwKeyspace() { - return this.getTypedRuleContext(KwKeyspaceContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropKeyspace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DropIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dropIndex; - } - - kwDrop() { - return this.getTypedRuleContext(KwDropContext, 0); - } - - kwIndex() { - return this.getTypedRuleContext(KwIndexContext, 0); - } - - indexName() { - return this.getTypedRuleContext(IndexNameContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDropIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateTableContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createTable; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwTable() { - return this.getTypedRuleContext(KwTableContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - columnDefinitionList() { - return this.getTypedRuleContext(ColumnDefinitionListContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - withElement() { - return this.getTypedRuleContext(WithElementContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateTable(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class WithElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_withElement; - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - tableOptions() { - return this.getTypedRuleContext(TableOptionsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitWithElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ClusteringOrderColumnsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_clusteringOrderColumns; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - orderDirection = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(OrderDirectionContext); - } else { - return this.getTypedRuleContext(OrderDirectionContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitClusteringOrderColumns(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ClusteringOrderContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_clusteringOrder; - } - - kwClustering() { - return this.getTypedRuleContext(KwClusteringContext, 0); - } - - kwOrder() { - return this.getTypedRuleContext(KwOrderContext, 0); - } - - kwBy() { - return this.getTypedRuleContext(KwByContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - clusteringOrderColumns() { - return this.getTypedRuleContext(ClusteringOrderColumnsContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitClusteringOrder(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TableOptionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_tableOptions; - } - - tableOptionItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(TableOptionItemContext); - } else { - return this.getTypedRuleContext(TableOptionItemContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTableOptions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TableOptionItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_tableOptionItem; - } - - tableOptionName() { - return this.getTypedRuleContext(TableOptionNameContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - tableOptionValue() { - return this.getTypedRuleContext(TableOptionValueContext, 0); - } - - optionHash() { - return this.getTypedRuleContext(OptionHashContext, 0); - } - - clusteringOrder() { - return this.getTypedRuleContext(ClusteringOrderContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTableOptionItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TableOptionNameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_tableOptionName; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTableOptionName(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TableOptionValueContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_tableOptionValue; - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - floatLiteral() { - return this.getTypedRuleContext(FloatLiteralContext, 0); - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTableOptionValue(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OptionHashContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_optionHash; - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - optionHashItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(OptionHashItemContext); - } else { - return this.getTypedRuleContext(OptionHashItemContext, i); - } - }; - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOptionHash(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OptionHashItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_optionHashItem; - } - - optionHashKey() { - return this.getTypedRuleContext(OptionHashKeyContext, 0); - } - - COLON() { - return this.getToken(CqlParser.COLON, 0); - } - - optionHashValue() { - return this.getTypedRuleContext(OptionHashValueContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOptionHashItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OptionHashKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_optionHashKey; - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOptionHashKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OptionHashValueContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_optionHashValue; - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - floatLiteral() { - return this.getTypedRuleContext(FloatLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOptionHashValue(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnDefinitionListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_columnDefinitionList; - } - - columnDefinition = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnDefinitionContext); - } else { - return this.getTypedRuleContext(ColumnDefinitionContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - primaryKeyElement() { - return this.getTypedRuleContext(PrimaryKeyElementContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumnDefinitionList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnDefinitionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_columnDefinition; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - dataType() { - return this.getTypedRuleContext(DataTypeContext, 0); - } - - primaryKeyColumn() { - return this.getTypedRuleContext(PrimaryKeyColumnContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumnDefinition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PrimaryKeyColumnContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_primaryKeyColumn; - } - - kwPrimary() { - return this.getTypedRuleContext(KwPrimaryContext, 0); - } - - kwKey() { - return this.getTypedRuleContext(KwKeyContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPrimaryKeyColumn(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PrimaryKeyElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_primaryKeyElement; - } - - kwPrimary() { - return this.getTypedRuleContext(KwPrimaryContext, 0); - } - - kwKey() { - return this.getTypedRuleContext(KwKeyContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - primaryKeyDefinition() { - return this.getTypedRuleContext(PrimaryKeyDefinitionContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPrimaryKeyElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PrimaryKeyDefinitionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_primaryKeyDefinition; - } - - singlePrimaryKey() { - return this.getTypedRuleContext(SinglePrimaryKeyContext, 0); - } - - compoundKey() { - return this.getTypedRuleContext(CompoundKeyContext, 0); - } - - compositeKey() { - return this.getTypedRuleContext(CompositeKeyContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPrimaryKeyDefinition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SinglePrimaryKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_singlePrimaryKey; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSinglePrimaryKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CompoundKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_compoundKey; - } - - partitionKey() { - return this.getTypedRuleContext(PartitionKeyContext, 0); - } - - syntaxComma() { - return this.getTypedRuleContext(SyntaxCommaContext, 0); - } - - clusteringKeyList() { - return this.getTypedRuleContext(ClusteringKeyListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCompoundKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CompositeKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_compositeKey; - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - partitionKeyList() { - return this.getTypedRuleContext(PartitionKeyListContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - syntaxComma() { - return this.getTypedRuleContext(SyntaxCommaContext, 0); - } - - clusteringKeyList() { - return this.getTypedRuleContext(ClusteringKeyListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCompositeKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PartitionKeyListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_partitionKeyList; - } - - partitionKey = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(PartitionKeyContext); - } else { - return this.getTypedRuleContext(PartitionKeyContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPartitionKeyList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ClusteringKeyListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_clusteringKeyList; - } - - clusteringKey = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ClusteringKeyContext); - } else { - return this.getTypedRuleContext(ClusteringKeyContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitClusteringKeyList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PartitionKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_partitionKey; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPartitionKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ClusteringKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_clusteringKey; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitClusteringKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ApplyBatchContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_applyBatch; - } - - kwApply() { - return this.getTypedRuleContext(KwApplyContext, 0); - } - - kwBatch() { - return this.getTypedRuleContext(KwBatchContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitApplyBatch(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class BeginBatchContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_beginBatch; - } - - kwBegin() { - return this.getTypedRuleContext(KwBeginContext, 0); - } - - kwBatch() { - return this.getTypedRuleContext(KwBatchContext, 0); - } - - batchType() { - return this.getTypedRuleContext(BatchTypeContext, 0); - } - - usingTimestampSpec() { - return this.getTypedRuleContext(UsingTimestampSpecContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitBeginBatch(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class BatchTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_batchType; - } - - kwLogged() { - return this.getTypedRuleContext(KwLoggedContext, 0); - } - - kwUnlogged() { - return this.getTypedRuleContext(KwUnloggedContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitBatchType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AlterKeyspaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_alterKeyspace; - } - - kwAlter() { - return this.getTypedRuleContext(KwAlterContext, 0); - } - - kwKeyspace() { - return this.getTypedRuleContext(KwKeyspaceContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - kwReplication() { - return this.getTypedRuleContext(KwReplicationContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - replicationList() { - return this.getTypedRuleContext(ReplicationListContext, 0); - } - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - kwAnd() { - return this.getTypedRuleContext(KwAndContext, 0); - } - - durableWrites() { - return this.getTypedRuleContext(DurableWritesContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAlterKeyspace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ReplicationListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_replicationList; - } - - replicationListItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ReplicationListItemContext); - } else { - return this.getTypedRuleContext(ReplicationListItemContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitReplicationList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ReplicationListItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_replicationListItem; - } - - STRING_LITERAL = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.STRING_LITERAL); - } else { - return this.getToken(CqlParser.STRING_LITERAL, i); - } - }; - - COLON() { - return this.getToken(CqlParser.COLON, 0); - } - - DECIMAL_LITERAL() { - return this.getToken(CqlParser.DECIMAL_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitReplicationListItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DurableWritesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_durableWrites; - } - - kwDurableWrites() { - return this.getTypedRuleContext(KwDurableWritesContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDurableWrites(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_use; - } - - kwUse() { - return this.getTypedRuleContext(KwUseContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUse(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TruncateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_truncate; - } - - kwTruncate() { - return this.getTypedRuleContext(KwTruncateContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - kwTable() { - return this.getTypedRuleContext(KwTableContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTruncate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createIndex; - } - - copyFrom(ctx) { - super.copyFrom(ctx); - } -} - -class CustomIndexContext extends CreateIndexContext { - constructor(parser, ctx) { - super(parser); - super.copyFrom(ctx); - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwCustom() { - return this.getTypedRuleContext(KwCustomContext, 0); - } - - kwIndex() { - return this.getTypedRuleContext(KwIndexContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - indexColumnSpec() { - return this.getTypedRuleContext(IndexColumnSpecContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - kwUsing() { - return this.getTypedRuleContext(KwUsingContext, 0); - } - - kwStorageAttachedIndex() { - return this.getTypedRuleContext(KwStorageAttachedIndexContext, 0); - } - - kwSASIIndex() { - return this.getTypedRuleContext(KwSASIIndexContext, 0); - } - - kwSolrIndex() { - return this.getTypedRuleContext(KwSolrIndexContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - indexName() { - return this.getTypedRuleContext(IndexNameContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - kwWith() { - return this.getTypedRuleContext(KwWithContext, 0); - } - - kwOptions() { - return this.getTypedRuleContext(KwOptionsContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - LC_BRACKET() { - return this.getToken(CqlParser.LC_BRACKET, 0); - } - - RC_BRACKET() { - return this.getToken(CqlParser.RC_BRACKET, 0); - } - - customIndexOption = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(CustomIndexOptionContext); - } else { - return this.getTypedRuleContext(CustomIndexOptionContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCustomIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -CqlParser.CustomIndexContext = CustomIndexContext; - -class SecondaryIndexContext extends CreateIndexContext { - constructor(parser, ctx) { - super(parser); - super.copyFrom(ctx); - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwIndex() { - return this.getTypedRuleContext(KwIndexContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - indexColumnSpec() { - return this.getTypedRuleContext(IndexColumnSpecContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - indexName() { - return this.getTypedRuleContext(IndexNameContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSecondaryIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -CqlParser.SecondaryIndexContext = SecondaryIndexContext; - -class CustomIndexOptionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_customIndexOption; - this.caseSensitiveOption = null; // BooleanLiteralContext - this.normalizeOption = null; // BooleanLiteralContext - this.asciiOption = null; // BooleanLiteralContext - this.analyzedOption = null; // BooleanLiteralContext - this.isLiteralOption = null; // BooleanLiteralContext - this.tokenizationEnableStemmingOption = null; // BooleanLiteralContext - this.tokenizationNormalizeLowercaseOption = null; // BooleanLiteralContext - this.tokenizationNormalizeUppercaseOption = null; // BooleanLiteralContext - this.normalizeUppercaseOption = null; // BooleanLiteralContext - this.normalizeLowercaseOption = null; // BooleanLiteralContext - this.maxCompactionFlushMemoryInMbOption = null; // StringLiteralContext - this.modeOption = null; // StringLiteralContext - this.analyzerClassOption = null; // StringLiteralContext - this.tokenizationLocaleOption = null; // StringLiteralContext - this.tokenizationSkipStopWordsOption = null; // StringLiteralContext - this.similarityFunctionOption = null; // StringLiteralContext - } - - kwCaseSensitive() { - return this.getTypedRuleContext(KwCaseSensitiveContext, 0); - } - - COLON() { - return this.getToken(CqlParser.COLON, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - COMMA() { - return this.getToken(CqlParser.COMMA, 0); - } - - kwNormalize() { - return this.getTypedRuleContext(KwNormalizeContext, 0); - } - - kwAscii() { - return this.getTypedRuleContext(KwAsciiContext, 0); - } - - kwAnalyzed() { - return this.getTypedRuleContext(KwAnalyzedContext, 0); - } - - kwIsLiteral() { - return this.getTypedRuleContext(KwIsLiteralContext, 0); - } - - kwTokenizationEnableStemming() { - return this.getTypedRuleContext(KwTokenizationEnableStemmingContext, 0); - } - - kwTokenizationNormalizeLowercase() { - return this.getTypedRuleContext(KwTokenizationNormalizeLowercaseContext, 0); - } - - kwTokenizationNormalizeUppercase() { - return this.getTypedRuleContext(KwTokenizationNormalizeUppercaseContext, 0); - } - - kwNormalizeUppercase() { - return this.getTypedRuleContext(KwNormalizeUppercaseContext, 0); - } - - kwNormalizeLowercase() { - return this.getTypedRuleContext(KwNormalizeLowercaseContext, 0); - } - - kwMaxCompactionFlushMemoryInMb() { - return this.getTypedRuleContext(KwMaxCompactionFlushMemoryInMbContext, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - kwMode() { - return this.getTypedRuleContext(KwModeContext, 0); - } - - kwAnalyzerClass() { - return this.getTypedRuleContext(KwAnalyzerClassContext, 0); - } - - kwTokenizationLocale() { - return this.getTypedRuleContext(KwTokenizationLocaleContext, 0); - } - - kwTokenizationSkipStopWords() { - return this.getTypedRuleContext(KwTokenizationSkipStopWordsContext, 0); - } - - kwSimilarityFunction() { - return this.getTypedRuleContext(KwSimilarityFunctionContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCustomIndexOption(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class CreateSearchIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_createSearchIndex; - } - - kwCreate() { - return this.getTypedRuleContext(KwCreateContext, 0); - } - - kwSearch() { - return this.getTypedRuleContext(KwSearchContext, 0); - } - - kwIndex() { - return this.getTypedRuleContext(KwIndexContext, 0); - } - - kwOn() { - return this.getTypedRuleContext(KwOnContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - K_WITH() { - return this.getToken(CqlParser.K_WITH, 0); - } - - kwColumns() { - return this.getTypedRuleContext(KwColumnsContext, 0); - } - - searchIndexColumnList() { - return this.getTypedRuleContext(SearchIndexColumnListContext, 0); - } - - kwProfiles() { - return this.getTypedRuleContext(KwProfilesContext, 0); - } - - searchIndexProfiles() { - return this.getTypedRuleContext(SearchIndexProfilesContext, 0); - } - - searchIndexConfigs() { - return this.getTypedRuleContext(SearchIndexConfigsContext, 0); - } - - searchIndexOptions() { - return this.getTypedRuleContext(SearchIndexOptionsContext, 0); - } - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitCreateSearchIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexConfigsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexConfigs; - this.autoCommitTimeConfig = null; // DecimalLiteralContext - this.defaultQueryFieldConfig = null; // StringLiteralContext - this.directoryFactoryConfig = null; // DirectoryFactoryContext - this.filterCacheLowWaterMarkConfig = null; // DecimalLiteralContext - this.filterCacheHighWaterMarkConfig = null; // DecimalLiteralContext - this.directoryFactoryClassConfig = null; // StringLiteralContext - this.mergeMaxThreadCountConfig = null; // DecimalLiteralContext - this.mergeMaxMergeCountConfig = null; // DecimalLiteralContext - this.ramBufferSizeConfig = null; // DecimalLiteralContext - this.realtimeConfig = null; // BooleanLiteralContext - } - - kwConfig() { - return this.getTypedRuleContext(KwConfigContext, 0); - } - - LC_BRACKET() { - return this.getToken(CqlParser.LC_BRACKET, 0); - } - - RC_BRACKET() { - return this.getToken(CqlParser.RC_BRACKET, 0); - } - - kwAutoCommitTime() { - return this.getTypedRuleContext(KwAutoCommitTimeContext, 0); - } - - COLON = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.COLON); - } else { - return this.getToken(CqlParser.COLON, i); - } - }; - - kwDefaultQueryField() { - return this.getTypedRuleContext(KwDefaultQueryFieldContext, 0); - } - - kwDirectoryFactory() { - return this.getTypedRuleContext(KwDirectoryFactoryContext, 0); - } - - kwFilterCacheLowWaterMark() { - return this.getTypedRuleContext(KwFilterCacheLowWaterMarkContext, 0); - } - - kwFilterCacheHighWaterMark() { - return this.getTypedRuleContext(KwFilterCacheHighWaterMarkContext, 0); - } - - kwDirectoryFactoryClass() { - return this.getTypedRuleContext(KwDirectoryFactoryClassContext, 0); - } - - kwMergeMaxThreadCount() { - return this.getTypedRuleContext(KwMergeMaxThreadCountContext, 0); - } - - kwMergeMaxMergeCount() { - return this.getTypedRuleContext(KwMergeMaxMergeCountContext, 0); - } - - kwRamBufferSize() { - return this.getTypedRuleContext(KwRamBufferSizeContext, 0); - } - - kwRealtime() { - return this.getTypedRuleContext(KwRealtimeContext, 0); - } - - decimalLiteral = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DecimalLiteralContext); - } else { - return this.getTypedRuleContext(DecimalLiteralContext, i); - } - }; - - stringLiteral = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(StringLiteralContext); - } else { - return this.getTypedRuleContext(StringLiteralContext, i); - } - }; - - directoryFactory() { - return this.getTypedRuleContext(DirectoryFactoryContext, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexConfigs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DirectoryFactoryContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_directoryFactory; - } - - kwStandard() { - return this.getTypedRuleContext(KwStandardContext, 0); - } - - kwEncrypted() { - return this.getTypedRuleContext(KwEncryptedContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDirectoryFactory(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexOptionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexOptions; - this.recoveryOption = null; // BooleanLiteralContext - this.reindexOption = null; // BooleanLiteralContext - this.lenientOption = null; // BooleanLiteralContext - } - - kwOptions() { - return this.getTypedRuleContext(KwOptionsContext, 0); - } - - LC_BRACKET() { - return this.getToken(CqlParser.LC_BRACKET, 0); - } - - RC_BRACKET() { - return this.getToken(CqlParser.RC_BRACKET, 0); - } - - kwRecovery() { - return this.getTypedRuleContext(KwRecoveryContext, 0); - } - - COLON = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.COLON); - } else { - return this.getToken(CqlParser.COLON, i); - } - }; - - kwReindex() { - return this.getTypedRuleContext(KwReindexContext, 0); - } - - kwLenient() { - return this.getTypedRuleContext(KwLenientContext, 0); - } - - booleanLiteral = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(BooleanLiteralContext); - } else { - return this.getTypedRuleContext(BooleanLiteralContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexOptions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexProfileContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexProfile; - } - - kwSpaceSavingAll() { - return this.getTypedRuleContext(KwSpaceSavingAllContext, 0); - } - - kwSpaceSavingNoJoin() { - return this.getTypedRuleContext(KwSpaceSavingNoJoinContext, 0); - } - - kwSpaceSavingSlowTriePrecision() { - return this.getTypedRuleContext(KwSpaceSavingSlowTriePrecisionContext, 0); - } - - kwSpaceSavingNoTextField() { - return this.getTypedRuleContext(KwSpaceSavingNoTextFieldContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexProfile(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexProfilesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexProfiles; - } - - searchIndexProfile = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SearchIndexProfileContext); - } else { - return this.getTypedRuleContext(SearchIndexProfileContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexProfiles(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexColumnListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexColumnList; - } - - searchIndexColumn = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SearchIndexColumnContext); - } else { - return this.getTypedRuleContext(SearchIndexColumnContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexColumnList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SearchIndexColumnContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_searchIndexColumn; - this.copyFieldOption = null; // BooleanLiteralContext - this.docValuesOption = null; // BooleanLiteralContext - this.excludedOption = null; // BooleanLiteralContext - this.indexedOption = null; // BooleanLiteralContext - this.lowerCase = null; // BooleanLiteralContext - this.star = null; // Token - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - LC_BRACKET() { - return this.getToken(CqlParser.LC_BRACKET, 0); - } - - RC_BRACKET() { - return this.getToken(CqlParser.RC_BRACKET, 0); - } - - kwCopyField() { - return this.getTypedRuleContext(KwCopyFieldContext, 0); - } - - COLON = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.COLON); - } else { - return this.getToken(CqlParser.COLON, i); - } - }; - - kwDocValues() { - return this.getTypedRuleContext(KwDocValuesContext, 0); - } - - kwExcluded() { - return this.getTypedRuleContext(KwExcludedContext, 0); - } - - kwIndexed() { - return this.getTypedRuleContext(KwIndexedContext, 0); - } - - kwLowerCase() { - return this.getTypedRuleContext(KwLowerCaseContext, 0); - } - - booleanLiteral = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(BooleanLiteralContext); - } else { - return this.getTypedRuleContext(BooleanLiteralContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - STAR() { - return this.getToken(CqlParser.STAR, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSearchIndexColumn(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexNameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexName; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexName(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexColumnSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexColumnSpec; - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - indexKeysSpec() { - return this.getTypedRuleContext(IndexKeysSpecContext, 0); - } - - indexEntriesSSpec() { - return this.getTypedRuleContext(IndexEntriesSSpecContext, 0); - } - - indexFullSpec() { - return this.getTypedRuleContext(IndexFullSpecContext, 0); - } - - indexValuesSpec() { - return this.getTypedRuleContext(IndexValuesSpecContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexColumnSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexKeysSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexKeysSpec; - } - - kwKeys() { - return this.getTypedRuleContext(KwKeysContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexKeysSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexEntriesSSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexEntriesSSpec; - } - - kwEntries() { - return this.getTypedRuleContext(KwEntriesContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexEntriesSSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexFullSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexFullSpec; - } - - kwFull() { - return this.getTypedRuleContext(KwFullContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexFullSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IndexValuesSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_indexValuesSpec; - } - - kwValues() { - return this.getTypedRuleContext(KwValuesContext, 0); - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - column() { - return this.getTypedRuleContext(ColumnContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIndexValuesSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DeleteStatementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_deleteStatement; - } - - kwDelete() { - return this.getTypedRuleContext(KwDeleteContext, 0); - } - - fromSpec() { - return this.getTypedRuleContext(FromSpecContext, 0); - } - - whereSpec() { - return this.getTypedRuleContext(WhereSpecContext, 0); - } - - beginBatch() { - return this.getTypedRuleContext(BeginBatchContext, 0); - } - - deleteColumnList() { - return this.getTypedRuleContext(DeleteColumnListContext, 0); - } - - usingTimestampSpec() { - return this.getTypedRuleContext(UsingTimestampSpecContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - ifSpec() { - return this.getTypedRuleContext(IfSpecContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDeleteStatement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DeleteColumnListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_deleteColumnList; - } - - deleteColumnItem = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DeleteColumnItemContext); - } else { - return this.getTypedRuleContext(DeleteColumnItemContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDeleteColumnList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DeleteColumnItemContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_deleteColumnItem; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - LS_BRACKET() { - return this.getToken(CqlParser.LS_BRACKET, 0); - } - - RS_BRACKET() { - return this.getToken(CqlParser.RS_BRACKET, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDeleteColumnItem(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UpdateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_update; - } - - kwUpdate() { - return this.getTypedRuleContext(KwUpdateContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - kwSet() { - return this.getTypedRuleContext(KwSetContext, 0); - } - - assignments() { - return this.getTypedRuleContext(AssignmentsContext, 0); - } - - whereSpec() { - return this.getTypedRuleContext(WhereSpecContext, 0); - } - - beginBatch() { - return this.getTypedRuleContext(BeginBatchContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - usingTtlTimestamp() { - return this.getTypedRuleContext(UsingTtlTimestampContext, 0); - } - - ifExist() { - return this.getTypedRuleContext(IfExistContext, 0); - } - - ifSpec() { - return this.getTypedRuleContext(IfSpecContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUpdate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IfSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ifSpec; - } - - kwIf() { - return this.getTypedRuleContext(KwIfContext, 0); - } - - ifConditionList() { - return this.getTypedRuleContext(IfConditionListContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIfSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IfConditionListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ifConditionList; - } - - ifCondition = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IfConditionContext); - } else { - return this.getTypedRuleContext(IfConditionContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIfConditionList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IfConditionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ifCondition; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIfCondition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignments; - } - - assignmentElement = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(AssignmentElementContext); - } else { - return this.getTypedRuleContext(AssignmentElementContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignments(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentElement; - } - - id = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IdContext); - } else { - return this.getTypedRuleContext(IdContext, i); - } - }; - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - assignmentMap() { - return this.getTypedRuleContext(AssignmentMapContext, 0); - } - - assignmentSet() { - return this.getTypedRuleContext(AssignmentSetContext, 0); - } - - assignmentList() { - return this.getTypedRuleContext(AssignmentListContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - PLUS() { - return this.getToken(CqlParser.PLUS, 0); - } - - MINUS() { - return this.getToken(CqlParser.MINUS, 0); - } - - syntaxBracketLs() { - return this.getTypedRuleContext(SyntaxBracketLsContext, 0); - } - - syntaxBracketRs() { - return this.getTypedRuleContext(SyntaxBracketRsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentSetContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentSet; - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentSet(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentMapContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentMap; - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - constant = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ConstantContext); - } else { - return this.getTypedRuleContext(ConstantContext, i); - } - }; - - syntaxColon = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxColonContext); - } else { - return this.getTypedRuleContext(SyntaxColonContext, i); - } - }; - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentMap(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentMapExpressionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentMapExpression; - } - - syntaxBracketLc() { - return this.getTypedRuleContext(SyntaxBracketLcContext, 0); - } - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - syntaxBracketRc() { - return this.getTypedRuleContext(SyntaxBracketRcContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentMapExpression(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentList; - } - - syntaxBracketLs() { - return this.getTypedRuleContext(SyntaxBracketLsContext, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - syntaxBracketRs() { - return this.getTypedRuleContext(SyntaxBracketRsContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AssignmentTupleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_assignmentTuple; - } - - syntaxBracketLr() { - return this.getTypedRuleContext(SyntaxBracketLrContext, 0); - } - - syntaxBracketRr() { - return this.getTypedRuleContext(SyntaxBracketRrContext, 0); - } - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - assignmentTuple = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(AssignmentTupleContext); - } else { - return this.getTypedRuleContext(AssignmentTupleContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAssignmentTuple(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InsertContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_insert; - } - - kwInsert() { - return this.getTypedRuleContext(KwInsertContext, 0); - } - - kwInto() { - return this.getTypedRuleContext(KwIntoContext, 0); - } - - table() { - return this.getTypedRuleContext(TableContext, 0); - } - - insertValuesSpec() { - return this.getTypedRuleContext(InsertValuesSpecContext, 0); - } - - beginBatch() { - return this.getTypedRuleContext(BeginBatchContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - insertColumnSpec() { - return this.getTypedRuleContext(InsertColumnSpecContext, 0); - } - - ifNotExist() { - return this.getTypedRuleContext(IfNotExistContext, 0); - } - - usingTtlTimestamp() { - return this.getTypedRuleContext(UsingTtlTimestampContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInsert(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UsingTtlTimestampContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_usingTtlTimestamp; - } - - kwUsing() { - return this.getTypedRuleContext(KwUsingContext, 0); - } - - ttl() { - return this.getTypedRuleContext(TtlContext, 0); - } - - kwAnd() { - return this.getTypedRuleContext(KwAndContext, 0); - } - - timestamp() { - return this.getTypedRuleContext(TimestampContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUsingTtlTimestamp(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TimestampContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_timestamp; - } - - kwTimestamp() { - return this.getTypedRuleContext(KwTimestampContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTimestamp(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TtlContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ttl; - } - - kwTtl() { - return this.getTypedRuleContext(KwTtlContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTtl(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UsingTimestampSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_usingTimestampSpec; - } - - kwUsing() { - return this.getTypedRuleContext(KwUsingContext, 0); - } - - timestamp() { - return this.getTypedRuleContext(TimestampContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUsingTimestampSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IfNotExistContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ifNotExist; - } - - kwIf() { - return this.getTypedRuleContext(KwIfContext, 0); - } - - kwNot() { - return this.getTypedRuleContext(KwNotContext, 0); - } - - kwExists() { - return this.getTypedRuleContext(KwExistsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIfNotExist(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IfExistContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_ifExist; - } - - kwIf() { - return this.getTypedRuleContext(KwIfContext, 0); - } - - kwExists() { - return this.getTypedRuleContext(KwExistsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitIfExist(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InsertValuesSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_insertValuesSpec; - } - - kwValues() { - return this.getTypedRuleContext(KwValuesContext, 0); - } - - LR_BRACKET() { - return this.getToken(CqlParser.LR_BRACKET, 0); - } - - expressionList() { - return this.getTypedRuleContext(ExpressionListContext, 0); - } - - RR_BRACKET() { - return this.getToken(CqlParser.RR_BRACKET, 0); - } - - kwJson() { - return this.getTypedRuleContext(KwJsonContext, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInsertValuesSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class InsertColumnSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_insertColumnSpec; - } - - LR_BRACKET() { - return this.getToken(CqlParser.LR_BRACKET, 0); - } - - columnList() { - return this.getTypedRuleContext(ColumnListContext, 0); - } - - RR_BRACKET() { - return this.getToken(CqlParser.RR_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitInsertColumnSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_columnList; - } - - column = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ColumnContext); - } else { - return this.getTypedRuleContext(ColumnContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumnList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ExpressionListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_expressionList; - } - - expression = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ExpressionContext); - } else { - return this.getTypedRuleContext(ExpressionContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitExpressionList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ExpressionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_expression; - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - assignmentMap() { - return this.getTypedRuleContext(AssignmentMapContext, 0); - } - - assignmentSet() { - return this.getTypedRuleContext(AssignmentSetContext, 0); - } - - assignmentList() { - return this.getTypedRuleContext(AssignmentListContext, 0); - } - - assignmentTuple() { - return this.getTypedRuleContext(AssignmentTupleContext, 0); - } - - assignmentMapExpression() { - return this.getTypedRuleContext(AssignmentMapExpressionContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitExpression(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SelectContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_select; - } - - kwSelect() { - return this.getTypedRuleContext(KwSelectContext, 0); - } - - selectElements() { - return this.getTypedRuleContext(SelectElementsContext, 0); - } - - fromSpec() { - return this.getTypedRuleContext(FromSpecContext, 0); - } - - distinctSpec() { - return this.getTypedRuleContext(DistinctSpecContext, 0); - } - - kwJson() { - return this.getTypedRuleContext(KwJsonContext, 0); - } - - whereSpec() { - return this.getTypedRuleContext(WhereSpecContext, 0); - } - - orderSpec() { - return this.getTypedRuleContext(OrderSpecContext, 0); - } - - limitSpec() { - return this.getTypedRuleContext(LimitSpecContext, 0); - } - - allowFilteringSpec() { - return this.getTypedRuleContext(AllowFilteringSpecContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSelect(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AllowFilteringSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_allowFilteringSpec; - } - - kwAllow() { - return this.getTypedRuleContext(KwAllowContext, 0); - } - - kwFiltering() { - return this.getTypedRuleContext(KwFilteringContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAllowFilteringSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class LimitSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_limitSpec; - } - - kwLimit() { - return this.getTypedRuleContext(KwLimitContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitLimitSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FromSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_fromSpec; - } - - kwFrom() { - return this.getTypedRuleContext(KwFromContext, 0); - } - - fromSpecElement() { - return this.getTypedRuleContext(FromSpecElementContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFromSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FromSpecElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_fromSpecElement; - } - - id = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IdContext); - } else { - return this.getTypedRuleContext(IdContext, i); - } - }; - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFromSpecElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OrderSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_orderSpec; - } - - kwOrder() { - return this.getTypedRuleContext(KwOrderContext, 0); - } - - kwBy() { - return this.getTypedRuleContext(KwByContext, 0); - } - - orderSpecElement() { - return this.getTypedRuleContext(OrderSpecElementContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOrderSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OrderSpecElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_orderSpecElement; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - kwAsc() { - return this.getTypedRuleContext(KwAscContext, 0); - } - - kwDesc() { - return this.getTypedRuleContext(KwDescContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOrderSpecElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class WhereSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_whereSpec; - } - - kwWhere() { - return this.getTypedRuleContext(KwWhereContext, 0); - } - - relationElements() { - return this.getTypedRuleContext(RelationElementsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitWhereSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DistinctSpecContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_distinctSpec; - } - - kwDistinct() { - return this.getTypedRuleContext(KwDistinctContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDistinctSpec(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SelectElementsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_selectElements; - this.star = null; // Token - } - - selectElement = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SelectElementContext); - } else { - return this.getTypedRuleContext(SelectElementContext, i); - } - }; - - STAR() { - return this.getToken(CqlParser.STAR, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSelectElements(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SelectElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_selectElement; - } - - id = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IdContext); - } else { - return this.getTypedRuleContext(IdContext, i); - } - }; - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - STAR() { - return this.getToken(CqlParser.STAR, 0); - } - - kwAs() { - return this.getTypedRuleContext(KwAsContext, 0); - } - - functionCall() { - return this.getTypedRuleContext(FunctionCallContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSelectElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RelationElementsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_relationElements; - } - - relationElement = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(RelationElementContext); - } else { - return this.getTypedRuleContext(RelationElementContext, i); - } - }; - - kwAnd = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(KwAndContext); - } else { - return this.getTypedRuleContext(KwAndContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRelationElements(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RelationElementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_relationElement; - } - - id = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IdContext); - } else { - return this.getTypedRuleContext(IdContext, i); - } - }; - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - OPERATOR_EQ() { - return this.getToken(CqlParser.OPERATOR_EQ, 0); - } - - OPERATOR_LT() { - return this.getToken(CqlParser.OPERATOR_LT, 0); - } - - OPERATOR_GT() { - return this.getToken(CqlParser.OPERATOR_GT, 0); - } - - OPERATOR_LTE() { - return this.getToken(CqlParser.OPERATOR_LTE, 0); - } - - OPERATOR_GTE() { - return this.getToken(CqlParser.OPERATOR_GTE, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - functionCall = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(FunctionCallContext); - } else { - return this.getTypedRuleContext(FunctionCallContext, i); - } - }; - - kwIn() { - return this.getTypedRuleContext(KwInContext, 0); - } - - LR_BRACKET = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.LR_BRACKET); - } else { - return this.getToken(CqlParser.LR_BRACKET, i); - } - }; - - RR_BRACKET = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.RR_BRACKET); - } else { - return this.getToken(CqlParser.RR_BRACKET, i); - } - }; - - functionArgs() { - return this.getTypedRuleContext(FunctionArgsContext, 0); - } - - assignmentTuple = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(AssignmentTupleContext); - } else { - return this.getTypedRuleContext(AssignmentTupleContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - relalationContainsKey() { - return this.getTypedRuleContext(RelalationContainsKeyContext, 0); - } - - relalationContains() { - return this.getTypedRuleContext(RelalationContainsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRelationElement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RelalationContainsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_relalationContains; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - kwContains() { - return this.getTypedRuleContext(KwContainsContext, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRelalationContains(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RelalationContainsKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_relalationContainsKey; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - constant() { - return this.getTypedRuleContext(ConstantContext, 0); - } - - kwContains() { - return this.getTypedRuleContext(KwContainsContext, 0); - } - - kwKey() { - return this.getTypedRuleContext(KwKeyContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRelalationContainsKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FunctionCallContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_functionCall; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - LR_BRACKET() { - return this.getToken(CqlParser.LR_BRACKET, 0); - } - - STAR() { - return this.getToken(CqlParser.STAR, 0); - } - - RR_BRACKET() { - return this.getToken(CqlParser.RR_BRACKET, 0); - } - - functionArgs() { - return this.getTypedRuleContext(FunctionArgsContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFunctionCall(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FunctionArgsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_functionArgs; - } - - constant = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(ConstantContext); - } else { - return this.getTypedRuleContext(ConstantContext, i); - } - }; - - id = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(IdContext); - } else { - return this.getTypedRuleContext(IdContext, i); - } - }; - - functionCall = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(FunctionCallContext); - } else { - return this.getTypedRuleContext(FunctionCallContext, i); - } - }; - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFunctionArgs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ConstantContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_constant; - } - - UUID() { - return this.getToken(CqlParser.UUID, 0); - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - decimalLiteral() { - return this.getTypedRuleContext(DecimalLiteralContext, 0); - } - - floatLiteral() { - return this.getTypedRuleContext(FloatLiteralContext, 0); - } - - hexadecimalLiteral() { - return this.getTypedRuleContext(HexadecimalLiteralContext, 0); - } - - booleanLiteral() { - return this.getTypedRuleContext(BooleanLiteralContext, 0); - } - - codeBlock() { - return this.getTypedRuleContext(CodeBlockContext, 0); - } - - kwNull() { - return this.getTypedRuleContext(KwNullContext, 0); - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitConstant(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DecimalLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_decimalLiteral; - } - - DECIMAL_LITERAL() { - return this.getToken(CqlParser.DECIMAL_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDecimalLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FloatLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_floatLiteral; - } - - DECIMAL_LITERAL() { - return this.getToken(CqlParser.DECIMAL_LITERAL, 0); - } - - FLOAT_LITERAL() { - return this.getToken(CqlParser.FLOAT_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFloatLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class StringLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_stringLiteral; - } - - STRING_LITERAL() { - return this.getToken(CqlParser.STRING_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitStringLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class BooleanLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_booleanLiteral; - } - - K_TRUE() { - return this.getToken(CqlParser.K_TRUE, 0); - } - - K_FALSE() { - return this.getToken(CqlParser.K_FALSE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitBooleanLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class HexadecimalLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_hexadecimalLiteral; - } - - HEXADECIMAL_LITERAL() { - return this.getToken(CqlParser.HEXADECIMAL_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitHexadecimalLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KeyspaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_keyspace; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - DQUOTE = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.DQUOTE); - } else { - return this.getToken(CqlParser.DQUOTE, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKeyspace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TableContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_table; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - DQUOTE = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.DQUOTE); - } else { - return this.getToken(CqlParser.DQUOTE, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTable(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ColumnContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_column; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - DQUOTE = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTokens(CqlParser.DQUOTE); - } else { - return this.getToken(CqlParser.DQUOTE, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitColumn(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DataTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dataType; - } - - dataTypeName() { - return this.getTypedRuleContext(DataTypeNameContext, 0); - } - - dataTypeDefinition() { - return this.getTypedRuleContext(DataTypeDefinitionContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDataType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DataTypeNameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dataTypeName; - } - - type() { - return this.getTypedRuleContext(TypeContext, 0); - } - - keyspace() { - return this.getTypedRuleContext(KeyspaceContext, 0); - } - - DOT() { - return this.getToken(CqlParser.DOT, 0); - } - - STRING_LITERAL() { - return this.getToken(CqlParser.STRING_LITERAL, 0); - } - - K_TIMESTAMP() { - return this.getToken(CqlParser.K_TIMESTAMP, 0); - } - - K_SET() { - return this.getToken(CqlParser.K_SET, 0); - } - - K_ASCII() { - return this.getToken(CqlParser.K_ASCII, 0); - } - - K_BIGINT() { - return this.getToken(CqlParser.K_BIGINT, 0); - } - - K_BLOB() { - return this.getToken(CqlParser.K_BLOB, 0); - } - - K_BOOLEAN() { - return this.getToken(CqlParser.K_BOOLEAN, 0); - } - - K_COUNTER() { - return this.getToken(CqlParser.K_COUNTER, 0); - } - - K_DATE() { - return this.getToken(CqlParser.K_DATE, 0); - } - - K_DECIMAL() { - return this.getToken(CqlParser.K_DECIMAL, 0); - } - - K_DOUBLE() { - return this.getToken(CqlParser.K_DOUBLE, 0); - } - - K_FLOAT() { - return this.getToken(CqlParser.K_FLOAT, 0); - } - - K_FROZEN() { - return this.getToken(CqlParser.K_FROZEN, 0); - } - - K_INET() { - return this.getToken(CqlParser.K_INET, 0); - } - - K_INT() { - return this.getToken(CqlParser.K_INT, 0); - } - - K_LIST() { - return this.getToken(CqlParser.K_LIST, 0); - } - - K_MAP() { - return this.getToken(CqlParser.K_MAP, 0); - } - - K_SMALLINT() { - return this.getToken(CqlParser.K_SMALLINT, 0); - } - - K_TEXT() { - return this.getToken(CqlParser.K_TEXT, 0); - } - - K_TIME() { - return this.getToken(CqlParser.K_TIME, 0); - } - - K_TIMEUUID() { - return this.getToken(CqlParser.K_TIMEUUID, 0); - } - - K_TINYINT() { - return this.getToken(CqlParser.K_TINYINT, 0); - } - - K_TUPLE() { - return this.getToken(CqlParser.K_TUPLE, 0); - } - - K_VARCHAR() { - return this.getToken(CqlParser.K_VARCHAR, 0); - } - - K_VARINT() { - return this.getToken(CqlParser.K_VARINT, 0); - } - - K_UUID() { - return this.getToken(CqlParser.K_UUID, 0); - } - - K_VECTOR() { - return this.getToken(CqlParser.K_VECTOR, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDataTypeName(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class DataTypeDefinitionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_dataTypeDefinition; - } - - syntaxBracketLa() { - return this.getTypedRuleContext(SyntaxBracketLaContext, 0); - } - - dataType = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DataTypeContext); - } else { - return this.getTypedRuleContext(DataTypeContext, i); - } - }; - - syntaxBracketRa() { - return this.getTypedRuleContext(SyntaxBracketRaContext, 0); - } - - syntaxComma = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(SyntaxCommaContext); - } else { - return this.getTypedRuleContext(SyntaxCommaContext, i); - } - }; - - decimalLiteral = function (i) { - if (i === undefined) { - i = null; - } - if (i === null) { - return this.getTypedRuleContexts(DecimalLiteralContext); - } else { - return this.getTypedRuleContext(DecimalLiteralContext, i); - } - }; - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitDataTypeDefinition(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class OrderDirectionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_orderDirection; - } - - kwAsc() { - return this.getTypedRuleContext(KwAscContext, 0); - } - - kwDesc() { - return this.getTypedRuleContext(KwDescContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitOrderDirection(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class RoleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_role; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitRole(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TriggerContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_trigger; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTrigger(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TriggerClassContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_triggerClass; - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitTriggerClass(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class MaterializedViewContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_materializedView; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitMaterializedView(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class TypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_type; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class AggregateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_aggregate; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitAggregate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class FunctionStatementContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_functionStatement; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitFunctionStatement(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class LanguageContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_language; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitLanguage(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class UserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_user; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class PasswordContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_password; - } - - stringLiteral() { - return this.getTypedRuleContext(StringLiteralContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitPassword(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class HashKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_hashKey; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitHashKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ParamContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_param; - } - - paramName() { - return this.getTypedRuleContext(ParamNameContext, 0); - } - - dataType() { - return this.getTypedRuleContext(DataTypeContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitParam(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class ParamNameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_paramName; - } - - id() { - return this.getTypedRuleContext(IdContext, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitParamName(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAddContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAdd; - } - - K_ADD() { - return this.getToken(CqlParser.K_ADD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAdd(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAggregateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAggregate; - } - - K_AGGREGATE() { - return this.getToken(CqlParser.K_AGGREGATE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAggregate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAllContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAll; - } - - K_ALL() { - return this.getToken(CqlParser.K_ALL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAll(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAllPermissionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAllPermissions; - } - - K_ALL() { - return this.getToken(CqlParser.K_ALL, 0); - } - - K_PERMISSIONS() { - return this.getToken(CqlParser.K_PERMISSIONS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAllPermissions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAllowContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAllow; - } - - K_ALLOW() { - return this.getToken(CqlParser.K_ALLOW, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAllow(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAlterContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAlter; - } - - K_ALTER() { - return this.getToken(CqlParser.K_ALTER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAlter(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAndContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAnd; - } - - K_AND() { - return this.getToken(CqlParser.K_AND, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAnd(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwApplyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwApply; - } - - K_APPLY() { - return this.getToken(CqlParser.K_APPLY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwApply(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAs; - } - - K_AS() { - return this.getToken(CqlParser.K_AS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAscContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAsc; - } - - K_ASC() { - return this.getToken(CqlParser.K_ASC, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAsc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAuthorizeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAuthorize; - } - - K_AUTHORIZE() { - return this.getToken(CqlParser.K_AUTHORIZE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAuthorize(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwBatchContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwBatch; - } - - K_BATCH() { - return this.getToken(CqlParser.K_BATCH, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwBatch(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwBeginContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwBegin; - } - - K_BEGIN() { - return this.getToken(CqlParser.K_BEGIN, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwBegin(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwByContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwBy; - } - - K_BY() { - return this.getToken(CqlParser.K_BY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwBy(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCalledContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCalled; - } - - K_CALLED() { - return this.getToken(CqlParser.K_CALLED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCalled(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwClusteringContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwClustering; - } - - K_CLUSTERING() { - return this.getToken(CqlParser.K_CLUSTERING, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwClustering(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCompactContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCompact; - } - - K_COMPACT() { - return this.getToken(CqlParser.K_COMPACT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCompact(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwContainsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwContains; - } - - K_CONTAINS() { - return this.getToken(CqlParser.K_CONTAINS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwContains(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCreateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCreate; - } - - K_CREATE() { - return this.getToken(CqlParser.K_CREATE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCreate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDeleteContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDelete; - } - - K_DELETE() { - return this.getToken(CqlParser.K_DELETE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDelete(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDescContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDesc; - } - - K_DESC() { - return this.getToken(CqlParser.K_DESC, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDesc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDescibeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDescibe; - } - - K_DESCRIBE() { - return this.getToken(CqlParser.K_DESCRIBE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDescibe(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDistinctContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDistinct; - } - - K_DISTINCT() { - return this.getToken(CqlParser.K_DISTINCT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDistinct(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDropContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDrop; - } - - K_DROP() { - return this.getToken(CqlParser.K_DROP, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDrop(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDurableWritesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDurableWrites; - } - - K_DURABLE_WRITES() { - return this.getToken(CqlParser.K_DURABLE_WRITES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDurableWrites(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwEntriesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwEntries; - } - - K_ENTRIES() { - return this.getToken(CqlParser.K_ENTRIES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwEntries(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwExecuteContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwExecute; - } - - K_EXECUTE() { - return this.getToken(CqlParser.K_EXECUTE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwExecute(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwExistsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwExists; - } - - K_EXISTS() { - return this.getToken(CqlParser.K_EXISTS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwExists(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFilteringContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFiltering; - } - - K_FILTERING() { - return this.getToken(CqlParser.K_FILTERING, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFiltering(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFinalfuncContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFinalfunc; - } - - K_FINALFUNC() { - return this.getToken(CqlParser.K_FINALFUNC, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFinalfunc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFromContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFrom; - } - - K_FROM() { - return this.getToken(CqlParser.K_FROM, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFrom(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFullContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFull; - } - - K_FULL() { - return this.getToken(CqlParser.K_FULL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFull(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFunctionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFunction; - } - - K_FUNCTION() { - return this.getToken(CqlParser.K_FUNCTION, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFunction(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFunctionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFunctions; - } - - K_FUNCTIONS() { - return this.getToken(CqlParser.K_FUNCTIONS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFunctions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwGrantContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwGrant; - } - - K_GRANT() { - return this.getToken(CqlParser.K_GRANT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwGrant(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIfContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIf; - } - - K_IF() { - return this.getToken(CqlParser.K_IF, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIf(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwInContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIn; - } - - K_IN() { - return this.getToken(CqlParser.K_IN, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIn(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIndex; - } - - K_INDEX() { - return this.getToken(CqlParser.K_INDEX, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCustomContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCustom; - } - - K_CUSTOM() { - return this.getToken(CqlParser.K_CUSTOM, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCustom(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSearchContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSearch; - } - - K_SEARCH() { - return this.getToken(CqlParser.K_SEARCH, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSearch(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAsciiContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAscii; - } - - K_ASCII() { - return this.getToken(CqlParser.K_ASCII, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAscii(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNormalizeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNormalize; - } - - K_NORMALIZE() { - return this.getToken(CqlParser.K_NORMALIZE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNormalize(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAnalyzedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAnalyzed; - } - - K_ANALYZED() { - return this.getToken(CqlParser.K_ANALYZED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAnalyzed(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIsLiteralContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIsLiteral; - } - - K_IS_LITERAL() { - return this.getToken(CqlParser.K_IS_LITERAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIsLiteral(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwMaxCompactionFlushMemoryInMbContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwMaxCompactionFlushMemoryInMb; - } - - K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB() { - return this.getToken(CqlParser.K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwMaxCompactionFlushMemoryInMb(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTokenizationEnableStemmingContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTokenizationEnableStemming; - } - - K_TOKENIZATION_ENABLE_STEMMING() { - return this.getToken(CqlParser.K_TOKENIZATION_ENABLE_STEMMING, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTokenizationEnableStemming(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTokenizationSkipStopWordsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTokenizationSkipStopWords; - } - - K_TOKENIZATION_SKIP_STOP_WORDS() { - return this.getToken(CqlParser.K_TOKENIZATION_SKIP_STOP_WORDS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTokenizationSkipStopWords(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTokenizationLocaleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTokenizationLocale; - } - - K_TOKENIZATION_LOCALE() { - return this.getToken(CqlParser.K_TOKENIZATION_LOCALE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTokenizationLocale(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTokenizationNormalizeLowercaseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTokenizationNormalizeLowercase; - } - - K_TOKENIZATION_NORMALIZE_LOWERCASE() { - return this.getToken(CqlParser.K_TOKENIZATION_NORMALIZE_LOWERCASE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTokenizationNormalizeLowercase(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTokenizationNormalizeUppercaseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTokenizationNormalizeUppercase; - } - - K_TOKENIZATION_NORMALIZE_UPPERCASE() { - return this.getToken(CqlParser.K_TOKENIZATION_NORMALIZE_UPPERCASE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTokenizationNormalizeUppercase(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNormalizeLowercaseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNormalizeLowercase; - } - - K_NORMALIZE_LOWERCASE() { - return this.getToken(CqlParser.K_NORMALIZE_LOWERCASE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNormalizeLowercase(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNormalizeUppercaseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNormalizeUppercase; - } - - K_NORMALIZE_UPPERCASE() { - return this.getToken(CqlParser.K_NORMALIZE_UPPERCASE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNormalizeUppercase(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwModeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwMode; - } - - K_MODE() { - return this.getToken(CqlParser.K_MODE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwMode(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAnalyzerClassContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAnalyzerClass; - } - - K_ANALYZER_CLASS() { - return this.getToken(CqlParser.K_ANALYZER_CLASS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAnalyzerClass(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwStorageAttachedIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwStorageAttachedIndex; - } - - K_STORAGE_ATTACHED_INDEX() { - return this.getToken(CqlParser.K_STORAGE_ATTACHED_INDEX, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwStorageAttachedIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSolrIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSolrIndex; - } - - K_SOLR_INDEX() { - return this.getToken(CqlParser.K_SOLR_INDEX, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSolrIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSASIIndexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSASIIndex; - } - - K_SASI_INDEX() { - return this.getToken(CqlParser.K_SASI_INDEX, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSASIIndex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSpaceSavingNoJoinContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSpaceSavingNoJoin; - } - - K_SPACE_SAVING_NO_JOIN() { - return this.getToken(CqlParser.K_SPACE_SAVING_NO_JOIN, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSpaceSavingNoJoin(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSpaceSavingAllContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSpaceSavingAll; - } - - K_SPACE_SAVING_ALL() { - return this.getToken(CqlParser.K_SPACE_SAVING_ALL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSpaceSavingAll(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSpaceSavingSlowTriePrecisionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSpaceSavingSlowTriePrecision; - } - - K_SPACE_SAVING_SLOW_TRIE_PRECISION() { - return this.getToken(CqlParser.K_SPACE_SAVING_SLOW_TRIE_PRECISION, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSpaceSavingSlowTriePrecision(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSpaceSavingNoTextFieldContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSpaceSavingNoTextField; - } - - K_SPACE_SAVING_NO_TEXT_FIELD() { - return this.getToken(CqlParser.K_SPACE_SAVING_NO_TEXT_FIELD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSpaceSavingNoTextField(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCopyFieldContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCopyField; - } - - K_COPY_FIELD() { - return this.getToken(CqlParser.K_COPY_FIELD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCopyField(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDocValuesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDocValues; - } - - K_DOC_VALUES() { - return this.getToken(CqlParser.K_DOC_VALUES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDocValues(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwExcludedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwExcluded; - } - - K_EXCLUDED() { - return this.getToken(CqlParser.K_EXCLUDED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwExcluded(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIndexedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIndexed; - } - - K_INDEXED() { - return this.getToken(CqlParser.K_INDEXED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIndexed(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLowerCaseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLowerCase; - } - - K_LOWERCASE() { - return this.getToken(CqlParser.K_LOWERCASE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLowerCase(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwColumnsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwColumns; - } - - K_COLUMNS() { - return this.getToken(CqlParser.K_COLUMNS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwColumns(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwProfilesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwProfiles; - } - - K_PROFILES() { - return this.getToken(CqlParser.K_PROFILES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwProfiles(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwConfigContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwConfig; - } - - K_CONFIG() { - return this.getToken(CqlParser.K_CONFIG, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwConfig(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwAutoCommitTimeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwAutoCommitTime; - } - - K_AUTOCOMMIT_TIME() { - return this.getToken(CqlParser.K_AUTOCOMMIT_TIME, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwAutoCommitTime(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDefaultQueryFieldContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDefaultQueryField; - } - - K_DEFAULT_QUERY_FIELD() { - return this.getToken(CqlParser.K_DEFAULT_QUERY_FIELD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDefaultQueryField(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDirectoryFactoryContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDirectoryFactory; - } - - K_DIRECTORY_FACTORY() { - return this.getToken(CqlParser.K_DIRECTORY_FACTORY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDirectoryFactory(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFilterCacheLowWaterMarkContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFilterCacheLowWaterMark; - } - - K_FILTER_CACHE_LOW_WATERMARK() { - return this.getToken(CqlParser.K_FILTER_CACHE_LOW_WATERMARK, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFilterCacheLowWaterMark(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwFilterCacheHighWaterMarkContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwFilterCacheHighWaterMark; - } - - K_FILTER_CACHE_HIGH_WATERMARK() { - return this.getToken(CqlParser.K_FILTER_CACHE_HIGH_WATERMARK, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwFilterCacheHighWaterMark(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwDirectoryFactoryClassContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwDirectoryFactoryClass; - } - - K_DIRECTORY_FACTORY_CLASS() { - return this.getToken(CqlParser.K_DIRECTORY_FACTORY_CLASS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwDirectoryFactoryClass(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwMergeMaxThreadCountContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwMergeMaxThreadCount; - } - - K_MERGE_MAX_THREAD_COUNT() { - return this.getToken(CqlParser.K_MERGE_MAX_THREAD_COUNT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwMergeMaxThreadCount(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwMergeMaxMergeCountContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwMergeMaxMergeCount; - } - - K_MERGE_MAX_MERGE_COUNT() { - return this.getToken(CqlParser.K_MERGE_MAX_MERGE_COUNT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwMergeMaxMergeCount(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRamBufferSizeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRamBufferSize; - } - - K_RAM_BUFFER_SIZE() { - return this.getToken(CqlParser.K_RAM_BUFFER_SIZE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRamBufferSize(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRealtimeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRealtime; - } - - K_REALTIME() { - return this.getToken(CqlParser.K_REALTIME, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRealtime(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRecoveryContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRecovery; - } - - K_RECOVERY() { - return this.getToken(CqlParser.K_RECOVERY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRecovery(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwReindexContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwReindex; - } - - K_REINDEX() { - return this.getToken(CqlParser.K_REINDEX, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwReindex(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLenientContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLenient; - } - - K_LENIENT() { - return this.getToken(CqlParser.K_LENIENT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLenient(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwStandardContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwStandard; - } - - K_STANDARD() { - return this.getToken(CqlParser.K_STANDARD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwStandard(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwEncryptedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwEncrypted; - } - - K_ENCRYPTED() { - return this.getToken(CqlParser.K_ENCRYPTED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwEncrypted(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwCaseSensitiveContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwCaseSensitive; - } - - K_CASE_SENITIVE() { - return this.getToken(CqlParser.K_CASE_SENITIVE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwCaseSensitive(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSimilarityFunctionContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSimilarityFunction; - } - - K_SIMILARITY_FUNCTION() { - return this.getToken(CqlParser.K_SIMILARITY_FUNCTION, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSimilarityFunction(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwInitcondContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwInitcond; - } - - K_INITCOND() { - return this.getToken(CqlParser.K_INITCOND, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwInitcond(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwInputContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwInput; - } - - K_INPUT() { - return this.getToken(CqlParser.K_INPUT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwInput(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwInsertContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwInsert; - } - - K_INSERT() { - return this.getToken(CqlParser.K_INSERT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwInsert(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIntoContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwInto; - } - - K_INTO() { - return this.getToken(CqlParser.K_INTO, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwInto(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwIsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwIs; - } - - K_IS() { - return this.getToken(CqlParser.K_IS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwIs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwJsonContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwJson; - } - - K_JSON() { - return this.getToken(CqlParser.K_JSON, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwJson(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwKeyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwKey; - } - - K_KEY() { - return this.getToken(CqlParser.K_KEY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwKey(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwKeysContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwKeys; - } - - K_KEYS() { - return this.getToken(CqlParser.K_KEYS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwKeys(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwKeyspaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwKeyspace; - } - - K_KEYSPACE() { - return this.getToken(CqlParser.K_KEYSPACE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwKeyspace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwKeyspacesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwKeyspaces; - } - - K_KEYSPACES() { - return this.getToken(CqlParser.K_KEYSPACES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwKeyspaces(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLanguageContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLanguage; - } - - K_LANGUAGE() { - return this.getToken(CqlParser.K_LANGUAGE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLanguage(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLimitContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLimit; - } - - K_LIMIT() { - return this.getToken(CqlParser.K_LIMIT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLimit(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwListContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwList; - } - - K_LIST() { - return this.getToken(CqlParser.K_LIST, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwList(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLoggedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLogged; - } - - K_LOGGED() { - return this.getToken(CqlParser.K_LOGGED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLogged(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLoginContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLogin; - } - - K_LOGIN() { - return this.getToken(CqlParser.K_LOGIN, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLogin(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwMaterializedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwMaterialized; - } - - K_MATERIALIZED() { - return this.getToken(CqlParser.K_MATERIALIZED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwMaterialized(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwModifyContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwModify; - } - - K_MODIFY() { - return this.getToken(CqlParser.K_MODIFY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwModify(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNosuperuserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNosuperuser; - } - - K_NOSUPERUSER() { - return this.getToken(CqlParser.K_NOSUPERUSER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNosuperuser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNorecursiveContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNorecursive; - } - - K_NORECURSIVE() { - return this.getToken(CqlParser.K_NORECURSIVE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNorecursive(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNotContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNot; - } - - K_NOT() { - return this.getToken(CqlParser.K_NOT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNot(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwNullContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwNull; - } - - K_NULL() { - return this.getToken(CqlParser.K_NULL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwNull(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwOfContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwOf; - } - - K_OF() { - return this.getToken(CqlParser.K_OF, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwOf(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwOnContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwOn; - } - - K_ON() { - return this.getToken(CqlParser.K_ON, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwOn(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwOptionsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwOptions; - } - - K_OPTIONS() { - return this.getToken(CqlParser.K_OPTIONS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwOptions(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwOrContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwOr; - } - - K_OR() { - return this.getToken(CqlParser.K_OR, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwOr(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwOrderContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwOrder; - } - - K_ORDER() { - return this.getToken(CqlParser.K_ORDER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwOrder(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwPasswordContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwPassword; - } - - K_PASSWORD() { - return this.getToken(CqlParser.K_PASSWORD, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwPassword(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwPrimaryContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwPrimary; - } - - K_PRIMARY() { - return this.getToken(CqlParser.K_PRIMARY, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwPrimary(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRenameContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRename; - } - - K_RENAME() { - return this.getToken(CqlParser.K_RENAME, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRename(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwReplaceContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwReplace; - } - - K_REPLACE() { - return this.getToken(CqlParser.K_REPLACE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwReplace(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwReplicationContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwReplication; - } - - K_REPLICATION() { - return this.getToken(CqlParser.K_REPLICATION, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwReplication(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwReturnsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwReturns; - } - - K_RETURNS() { - return this.getToken(CqlParser.K_RETURNS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwReturns(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRoleContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRole; - } - - K_ROLE() { - return this.getToken(CqlParser.K_ROLE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRole(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwInternalContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwInternal; - } - - K_INTERNAL() { - return this.getToken(CqlParser.K_INTERNAL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwInternal(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwLdapContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwLdap; - } - - K_LDAP() { - return this.getToken(CqlParser.K_LDAP, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwLdap(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSchemeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwScheme; - } - - K_SCHEME() { - return this.getToken(CqlParser.K_SCHEME, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwScheme(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRolesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRoles; - } - - K_ROLES() { - return this.getToken(CqlParser.K_ROLES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRoles(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSelectContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSelect; - } - - K_SELECT() { - return this.getToken(CqlParser.K_SELECT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSelect(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSetContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSet; - } - - K_SET() { - return this.getToken(CqlParser.K_SET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSet(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSfuncContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSfunc; - } - - K_SFUNC() { - return this.getToken(CqlParser.K_SFUNC, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSfunc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwStorageContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwStorage; - } - - K_STORAGE() { - return this.getToken(CqlParser.K_STORAGE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwStorage(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwStypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwStype; - } - - K_STYPE() { - return this.getToken(CqlParser.K_STYPE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwStype(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwSuperuserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwSuperuser; - } - - K_SUPERUSER() { - return this.getToken(CqlParser.K_SUPERUSER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwSuperuser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTableContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTable; - } - - K_TABLE() { - return this.getToken(CqlParser.K_TABLE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTable(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTimestampContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTimestamp; - } - - K_TIMESTAMP() { - return this.getToken(CqlParser.K_TIMESTAMP, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTimestamp(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwToContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTo; - } - - K_TO() { - return this.getToken(CqlParser.K_TO, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTo(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTriggerContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTrigger; - } - - K_TRIGGER() { - return this.getToken(CqlParser.K_TRIGGER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTrigger(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTruncateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTruncate; - } - - K_TRUNCATE() { - return this.getToken(CqlParser.K_TRUNCATE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTruncate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTtlContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwTtl; - } - - K_TTL() { - return this.getToken(CqlParser.K_TTL, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwTtl(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwTypeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwType; - } - - K_TYPE() { - return this.getToken(CqlParser.K_TYPE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwType(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUnloggedContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUnlogged; - } - - K_UNLOGGED() { - return this.getToken(CqlParser.K_UNLOGGED, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUnlogged(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUpdateContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUpdate; - } - - K_UPDATE() { - return this.getToken(CqlParser.K_UPDATE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUpdate(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUseContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUse; - } - - K_USE() { - return this.getToken(CqlParser.K_USE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUse(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUserContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUser; - } - - K_USER() { - return this.getToken(CqlParser.K_USER, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUser(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUsersContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUsers; - } - - K_USERS() { - return this.getToken(CqlParser.K_USERS, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUsers(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwUsingContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwUsing; - } - - K_USING() { - return this.getToken(CqlParser.K_USING, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwUsing(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwValuesContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwValues; - } - - K_VALUES() { - return this.getToken(CqlParser.K_VALUES, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwValues(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwViewContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwView; - } - - K_VIEW() { - return this.getToken(CqlParser.K_VIEW, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwView(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwWhereContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwWhere; - } - - K_WHERE() { - return this.getToken(CqlParser.K_WHERE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwWhere(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwWithContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwWith; - } - - K_WITH() { - return this.getToken(CqlParser.K_WITH, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwWith(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class KwRevokeContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_kwRevoke; - } - - K_REVOKE() { - return this.getToken(CqlParser.K_REVOKE, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitKwRevoke(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class EofContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_eof; - } - - EOF() { - return this.getToken(CqlParser.EOF, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitEof(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketLrContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketLr; - } - - LR_BRACKET() { - return this.getToken(CqlParser.LR_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketLr(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketRrContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketRr; - } - - RR_BRACKET() { - return this.getToken(CqlParser.RR_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketRr(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketLcContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketLc; - } - - LC_BRACKET() { - return this.getToken(CqlParser.LC_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketLc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketRcContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketRc; - } - - RC_BRACKET() { - return this.getToken(CqlParser.RC_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketRc(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketLaContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketLa; - } - - OPERATOR_LT() { - return this.getToken(CqlParser.OPERATOR_LT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketLa(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketRaContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketRa; - } - - OPERATOR_GT() { - return this.getToken(CqlParser.OPERATOR_GT, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketRa(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketLsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketLs; - } - - LS_BRACKET() { - return this.getToken(CqlParser.LS_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketLs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxBracketRsContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxBracketRs; - } - - RS_BRACKET() { - return this.getToken(CqlParser.RS_BRACKET, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxBracketRs(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxCommaContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxComma; - } - - COMMA() { - return this.getToken(CqlParser.COMMA, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxComma(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class SyntaxColonContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_syntaxColon; - } - - COLON() { - return this.getToken(CqlParser.COLON, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitSyntaxColon(this); - } else { - return visitor.visitChildren(this); - } - } -} - -class IdContext extends antlr4.ParserRuleContext { - constructor(parser, parent, invokingState) { - if (parent === undefined) { - parent = null; - } - if (invokingState === undefined || invokingState === null) { - invokingState = -1; - } - super(parent, invokingState); - this.parser = parser; - this.ruleIndex = CqlParser.RULE_id; - } - - OBJECT_NAME() { - return this.getToken(CqlParser.OBJECT_NAME, 0); - } - - K_ADD() { - return this.getToken(CqlParser.K_ADD, 0); - } - - K_AGGREGATE() { - return this.getToken(CqlParser.K_AGGREGATE, 0); - } - - K_ALL() { - return this.getToken(CqlParser.K_ALL, 0); - } - - K_ALLOW() { - return this.getToken(CqlParser.K_ALLOW, 0); - } - - K_ALTER() { - return this.getToken(CqlParser.K_ALTER, 0); - } - - K_AND() { - return this.getToken(CqlParser.K_AND, 0); - } - - K_ANY() { - return this.getToken(CqlParser.K_ANY, 0); - } - - K_APPLY() { - return this.getToken(CqlParser.K_APPLY, 0); - } - - K_AS() { - return this.getToken(CqlParser.K_AS, 0); - } - - K_ASC() { - return this.getToken(CqlParser.K_ASC, 0); - } - - K_AUTHORIZE() { - return this.getToken(CqlParser.K_AUTHORIZE, 0); - } - - K_BATCH() { - return this.getToken(CqlParser.K_BATCH, 0); - } - - K_BEGIN() { - return this.getToken(CqlParser.K_BEGIN, 0); - } - - K_BY() { - return this.getToken(CqlParser.K_BY, 0); - } - - K_CALLED() { - return this.getToken(CqlParser.K_CALLED, 0); - } - - K_CLUSTERING() { - return this.getToken(CqlParser.K_CLUSTERING, 0); - } - - K_COLUMNFAMILY() { - return this.getToken(CqlParser.K_COLUMNFAMILY, 0); - } - - K_COMPACT() { - return this.getToken(CqlParser.K_COMPACT, 0); - } - - K_CONSISTENCY() { - return this.getToken(CqlParser.K_CONSISTENCY, 0); - } - - K_CONTAINS() { - return this.getToken(CqlParser.K_CONTAINS, 0); - } - - K_CREATE() { - return this.getToken(CqlParser.K_CREATE, 0); - } - - K_CUSTOM() { - return this.getToken(CqlParser.K_CUSTOM, 0); - } - - K_DELETE() { - return this.getToken(CqlParser.K_DELETE, 0); - } - - K_DESC() { - return this.getToken(CqlParser.K_DESC, 0); - } - - K_DESCRIBE() { - return this.getToken(CqlParser.K_DESCRIBE, 0); - } - - K_DISTINCT() { - return this.getToken(CqlParser.K_DISTINCT, 0); - } - - K_DROP() { - return this.getToken(CqlParser.K_DROP, 0); - } - - K_DURABLE_WRITES() { - return this.getToken(CqlParser.K_DURABLE_WRITES, 0); - } - - K_EACH_QUORUM() { - return this.getToken(CqlParser.K_EACH_QUORUM, 0); - } - - K_ENTRIES() { - return this.getToken(CqlParser.K_ENTRIES, 0); - } - - K_EXECUTE() { - return this.getToken(CqlParser.K_EXECUTE, 0); - } - - K_EXISTS() { - return this.getToken(CqlParser.K_EXISTS, 0); - } - - K_FALSE() { - return this.getToken(CqlParser.K_FALSE, 0); - } - - K_FILTERING() { - return this.getToken(CqlParser.K_FILTERING, 0); - } - - K_FINALFUNC() { - return this.getToken(CqlParser.K_FINALFUNC, 0); - } - - K_FROM() { - return this.getToken(CqlParser.K_FROM, 0); - } - - K_FULL() { - return this.getToken(CqlParser.K_FULL, 0); - } - - K_FUNCTION() { - return this.getToken(CqlParser.K_FUNCTION, 0); - } - - K_FUNCTIONS() { - return this.getToken(CqlParser.K_FUNCTIONS, 0); - } - - K_GRANT() { - return this.getToken(CqlParser.K_GRANT, 0); - } - - K_IF() { - return this.getToken(CqlParser.K_IF, 0); - } - - K_IN() { - return this.getToken(CqlParser.K_IN, 0); - } - - K_INDEX() { - return this.getToken(CqlParser.K_INDEX, 0); - } - - K_INFINITY() { - return this.getToken(CqlParser.K_INFINITY, 0); - } - - K_INITCOND() { - return this.getToken(CqlParser.K_INITCOND, 0); - } - - K_INPUT() { - return this.getToken(CqlParser.K_INPUT, 0); - } - - K_INSERT() { - return this.getToken(CqlParser.K_INSERT, 0); - } - - K_INTO() { - return this.getToken(CqlParser.K_INTO, 0); - } - - K_IS() { - return this.getToken(CqlParser.K_IS, 0); - } - - K_JSON() { - return this.getToken(CqlParser.K_JSON, 0); - } - - K_KEY() { - return this.getToken(CqlParser.K_KEY, 0); - } - - K_KEYS() { - return this.getToken(CqlParser.K_KEYS, 0); - } - - K_KEYSPACE() { - return this.getToken(CqlParser.K_KEYSPACE, 0); - } - - K_KEYSPACES() { - return this.getToken(CqlParser.K_KEYSPACES, 0); - } - - K_LANGUAGE() { - return this.getToken(CqlParser.K_LANGUAGE, 0); - } - - K_LEVEL() { - return this.getToken(CqlParser.K_LEVEL, 0); - } - - K_LIMIT() { - return this.getToken(CqlParser.K_LIMIT, 0); - } - - K_LOCAL_ONE() { - return this.getToken(CqlParser.K_LOCAL_ONE, 0); - } - - K_LOCAL_QUORUM() { - return this.getToken(CqlParser.K_LOCAL_QUORUM, 0); - } - - K_LOGGED() { - return this.getToken(CqlParser.K_LOGGED, 0); - } - - K_LOGIN() { - return this.getToken(CqlParser.K_LOGIN, 0); - } - - K_MATERIALIZED() { - return this.getToken(CqlParser.K_MATERIALIZED, 0); - } - - K_MODIFY() { - return this.getToken(CqlParser.K_MODIFY, 0); - } - - K_NAN() { - return this.getToken(CqlParser.K_NAN, 0); - } - - K_NORECURSIVE() { - return this.getToken(CqlParser.K_NORECURSIVE, 0); - } - - K_NOSUPERUSER() { - return this.getToken(CqlParser.K_NOSUPERUSER, 0); - } - - K_NOT() { - return this.getToken(CqlParser.K_NOT, 0); - } - - K_NULL() { - return this.getToken(CqlParser.K_NULL, 0); - } - - K_OF() { - return this.getToken(CqlParser.K_OF, 0); - } - - K_ON() { - return this.getToken(CqlParser.K_ON, 0); - } - - K_ONE() { - return this.getToken(CqlParser.K_ONE, 0); - } - - K_OPTIONS() { - return this.getToken(CqlParser.K_OPTIONS, 0); - } - - K_OR() { - return this.getToken(CqlParser.K_OR, 0); - } - - K_ORDER() { - return this.getToken(CqlParser.K_ORDER, 0); - } - - K_PARTITION() { - return this.getToken(CqlParser.K_PARTITION, 0); - } - - K_PASSWORD() { - return this.getToken(CqlParser.K_PASSWORD, 0); - } - - K_PER() { - return this.getToken(CqlParser.K_PER, 0); - } - - K_PERMISSION() { - return this.getToken(CqlParser.K_PERMISSION, 0); - } - - K_PERMISSIONS() { - return this.getToken(CqlParser.K_PERMISSIONS, 0); - } - - K_PRIMARY() { - return this.getToken(CqlParser.K_PRIMARY, 0); - } - - K_QUORUM() { - return this.getToken(CqlParser.K_QUORUM, 0); - } - - K_RENAME() { - return this.getToken(CqlParser.K_RENAME, 0); - } - - K_REPLACE() { - return this.getToken(CqlParser.K_REPLACE, 0); - } - - K_REPLICATION() { - return this.getToken(CqlParser.K_REPLICATION, 0); - } - - K_RETURNS() { - return this.getToken(CqlParser.K_RETURNS, 0); - } - - K_REVOKE() { - return this.getToken(CqlParser.K_REVOKE, 0); - } - - K_ROLE() { - return this.getToken(CqlParser.K_ROLE, 0); - } - - K_ROLES() { - return this.getToken(CqlParser.K_ROLES, 0); - } - - K_SCHEMA() { - return this.getToken(CqlParser.K_SCHEMA, 0); - } - - K_SELECT() { - return this.getToken(CqlParser.K_SELECT, 0); - } - - K_SET() { - return this.getToken(CqlParser.K_SET, 0); - } - - K_SFUNC() { - return this.getToken(CqlParser.K_SFUNC, 0); - } - - K_STATIC() { - return this.getToken(CqlParser.K_STATIC, 0); - } - - K_STORAGE() { - return this.getToken(CqlParser.K_STORAGE, 0); - } - - K_STYPE() { - return this.getToken(CqlParser.K_STYPE, 0); - } - - K_SUPERUSER() { - return this.getToken(CqlParser.K_SUPERUSER, 0); - } - - K_TABLE() { - return this.getToken(CqlParser.K_TABLE, 0); - } - - K_THREE() { - return this.getToken(CqlParser.K_THREE, 0); - } - - K_TIMESTAMP() { - return this.getToken(CqlParser.K_TIMESTAMP, 0); - } - - K_TO() { - return this.getToken(CqlParser.K_TO, 0); - } - - K_TOKEN() { - return this.getToken(CqlParser.K_TOKEN, 0); - } - - K_TRIGGER() { - return this.getToken(CqlParser.K_TRIGGER, 0); - } - - K_TRUE() { - return this.getToken(CqlParser.K_TRUE, 0); - } - - K_TRUNCATE() { - return this.getToken(CqlParser.K_TRUNCATE, 0); - } - - K_TTL() { - return this.getToken(CqlParser.K_TTL, 0); - } - - K_TWO() { - return this.getToken(CqlParser.K_TWO, 0); - } - - K_TYPE() { - return this.getToken(CqlParser.K_TYPE, 0); - } - - K_UNLOGGED() { - return this.getToken(CqlParser.K_UNLOGGED, 0); - } - - K_UPDATE() { - return this.getToken(CqlParser.K_UPDATE, 0); - } - - K_USE() { - return this.getToken(CqlParser.K_USE, 0); - } - - K_USER() { - return this.getToken(CqlParser.K_USER, 0); - } - - K_USING() { - return this.getToken(CqlParser.K_USING, 0); - } - - K_UUID() { - return this.getToken(CqlParser.K_UUID, 0); - } - - K_VALUES() { - return this.getToken(CqlParser.K_VALUES, 0); - } - - K_VIEW() { - return this.getToken(CqlParser.K_VIEW, 0); - } - - K_WHERE() { - return this.getToken(CqlParser.K_WHERE, 0); - } - - K_WITH() { - return this.getToken(CqlParser.K_WITH, 0); - } - - K_WRITETIME() { - return this.getToken(CqlParser.K_WRITETIME, 0); - } - - K_ASCII() { - return this.getToken(CqlParser.K_ASCII, 0); - } - - K_BIGINT() { - return this.getToken(CqlParser.K_BIGINT, 0); - } - - K_BLOB() { - return this.getToken(CqlParser.K_BLOB, 0); - } - - K_BOOLEAN() { - return this.getToken(CqlParser.K_BOOLEAN, 0); - } - - K_COUNTER() { - return this.getToken(CqlParser.K_COUNTER, 0); - } - - K_DATE() { - return this.getToken(CqlParser.K_DATE, 0); - } - - K_DECIMAL() { - return this.getToken(CqlParser.K_DECIMAL, 0); - } - - K_DOUBLE() { - return this.getToken(CqlParser.K_DOUBLE, 0); - } - - K_FLOAT() { - return this.getToken(CqlParser.K_FLOAT, 0); - } - - K_FROZEN() { - return this.getToken(CqlParser.K_FROZEN, 0); - } - - K_INET() { - return this.getToken(CqlParser.K_INET, 0); - } - - K_INT() { - return this.getToken(CqlParser.K_INT, 0); - } - - K_LIST() { - return this.getToken(CqlParser.K_LIST, 0); - } - - K_MAP() { - return this.getToken(CqlParser.K_MAP, 0); - } - - K_SMALLINT() { - return this.getToken(CqlParser.K_SMALLINT, 0); - } - - K_TEXT() { - return this.getToken(CqlParser.K_TEXT, 0); - } - - K_TIMEUUID() { - return this.getToken(CqlParser.K_TIMEUUID, 0); - } - - K_TIME() { - return this.getToken(CqlParser.K_TIME, 0); - } - - K_TINYINT() { - return this.getToken(CqlParser.K_TINYINT, 0); - } - - K_TUPLE() { - return this.getToken(CqlParser.K_TUPLE, 0); - } - - K_VARCHAR() { - return this.getToken(CqlParser.K_VARCHAR, 0); - } - - K_VARINT() { - return this.getToken(CqlParser.K_VARINT, 0); - } - - K_USERS() { - return this.getToken(CqlParser.K_USERS, 0); - } - - K_VECTOR() { - return this.getToken(CqlParser.K_VECTOR, 0); - } - - accept(visitor) { - if (visitor instanceof CqlParserVisitor) { - return visitor.visitId(this); - } else { - return visitor.visitChildren(this); - } - } -} - -CqlParser.RootContext = RootContext; -CqlParser.CqlsContext = CqlsContext; -CqlParser.StatementSeparatorContext = StatementSeparatorContext; -CqlParser.EmptyContext = EmptyContext; -CqlParser.CqlContext = CqlContext; -CqlParser.RevokeContext = RevokeContext; -CqlParser.ListUsersContext = ListUsersContext; -CqlParser.ListRolesContext = ListRolesContext; -CqlParser.ListPermissionsContext = ListPermissionsContext; -CqlParser.GrantContext = GrantContext; -CqlParser.PriviledgeContext = PriviledgeContext; -CqlParser.ResourceContext = ResourceContext; -CqlParser.CreateUserContext = CreateUserContext; -CqlParser.CreateRoleContext = CreateRoleContext; -CqlParser.CreateTypeContext = CreateTypeContext; -CqlParser.TypeMemberColumnListContext = TypeMemberColumnListContext; -CqlParser.CreateTriggerContext = CreateTriggerContext; -CqlParser.CreateMaterializedViewContext = CreateMaterializedViewContext; -CqlParser.MaterializedViewWhereContext = MaterializedViewWhereContext; -CqlParser.ColumnNotNullListContext = ColumnNotNullListContext; -CqlParser.ColumnNotNullContext = ColumnNotNullContext; -CqlParser.MaterializedViewOptionsContext = MaterializedViewOptionsContext; -CqlParser.CreateKeyspaceContext = CreateKeyspaceContext; -CqlParser.CreateFunctionContext = CreateFunctionContext; -CqlParser.CodeBlockContext = CodeBlockContext; -CqlParser.ParamListContext = ParamListContext; -CqlParser.ReturnModeContext = ReturnModeContext; -CqlParser.CreateAggregateContext = CreateAggregateContext; -CqlParser.InitCondDefinitionContext = InitCondDefinitionContext; -CqlParser.InitCondHashContext = InitCondHashContext; -CqlParser.InitCondHashItemContext = InitCondHashItemContext; -CqlParser.InitCondListNestedContext = InitCondListNestedContext; -CqlParser.InitCondListContext = InitCondListContext; -CqlParser.OrReplaceContext = OrReplaceContext; -CqlParser.AlterUserContext = AlterUserContext; -CqlParser.UserPasswordContext = UserPasswordContext; -CqlParser.UserSuperUserContext = UserSuperUserContext; -CqlParser.AlterTypeContext = AlterTypeContext; -CqlParser.AlterTypeOperationContext = AlterTypeOperationContext; -CqlParser.AlterTypeRenameContext = AlterTypeRenameContext; -CqlParser.AlterTypeRenameListContext = AlterTypeRenameListContext; -CqlParser.AlterTypeRenameItemContext = AlterTypeRenameItemContext; -CqlParser.AlterTypeAddContext = AlterTypeAddContext; -CqlParser.AlterTypeAlterTypeContext = AlterTypeAlterTypeContext; -CqlParser.AlterTableContext = AlterTableContext; -CqlParser.AlterTableOperationContext = AlterTableOperationContext; -CqlParser.AlterTableWithContext = AlterTableWithContext; -CqlParser.AlterTableRenameContext = AlterTableRenameContext; -CqlParser.AlterTableDropCompactStorageContext = - AlterTableDropCompactStorageContext; -CqlParser.AlterTableDropColumnsContext = AlterTableDropColumnsContext; -CqlParser.AlterTableDropColumnListContext = AlterTableDropColumnListContext; -CqlParser.AlterTableAddContext = AlterTableAddContext; -CqlParser.AlterTableColumnDefinitionContext = AlterTableColumnDefinitionContext; -CqlParser.AlterRoleContext = AlterRoleContext; -CqlParser.RoleWithContext = RoleWithContext; -CqlParser.RoleWithOptionsContext = RoleWithOptionsContext; -CqlParser.AlterMaterializedViewContext = AlterMaterializedViewContext; -CqlParser.DropUserContext = DropUserContext; -CqlParser.DropTypeContext = DropTypeContext; -CqlParser.DropMaterializedViewContext = DropMaterializedViewContext; -CqlParser.DropAggregateContext = DropAggregateContext; -CqlParser.DropFunctionContext = DropFunctionContext; -CqlParser.DropTriggerContext = DropTriggerContext; -CqlParser.DropRoleContext = DropRoleContext; -CqlParser.DropTableContext = DropTableContext; -CqlParser.DropKeyspaceContext = DropKeyspaceContext; -CqlParser.DropIndexContext = DropIndexContext; -CqlParser.CreateTableContext = CreateTableContext; -CqlParser.WithElementContext = WithElementContext; -CqlParser.ClusteringOrderColumnsContext = ClusteringOrderColumnsContext; -CqlParser.ClusteringOrderContext = ClusteringOrderContext; -CqlParser.TableOptionsContext = TableOptionsContext; -CqlParser.TableOptionItemContext = TableOptionItemContext; -CqlParser.TableOptionNameContext = TableOptionNameContext; -CqlParser.TableOptionValueContext = TableOptionValueContext; -CqlParser.OptionHashContext = OptionHashContext; -CqlParser.OptionHashItemContext = OptionHashItemContext; -CqlParser.OptionHashKeyContext = OptionHashKeyContext; -CqlParser.OptionHashValueContext = OptionHashValueContext; -CqlParser.ColumnDefinitionListContext = ColumnDefinitionListContext; -CqlParser.ColumnDefinitionContext = ColumnDefinitionContext; -CqlParser.PrimaryKeyColumnContext = PrimaryKeyColumnContext; -CqlParser.PrimaryKeyElementContext = PrimaryKeyElementContext; -CqlParser.PrimaryKeyDefinitionContext = PrimaryKeyDefinitionContext; -CqlParser.SinglePrimaryKeyContext = SinglePrimaryKeyContext; -CqlParser.CompoundKeyContext = CompoundKeyContext; -CqlParser.CompositeKeyContext = CompositeKeyContext; -CqlParser.PartitionKeyListContext = PartitionKeyListContext; -CqlParser.ClusteringKeyListContext = ClusteringKeyListContext; -CqlParser.PartitionKeyContext = PartitionKeyContext; -CqlParser.ClusteringKeyContext = ClusteringKeyContext; -CqlParser.ApplyBatchContext = ApplyBatchContext; -CqlParser.BeginBatchContext = BeginBatchContext; -CqlParser.BatchTypeContext = BatchTypeContext; -CqlParser.AlterKeyspaceContext = AlterKeyspaceContext; -CqlParser.ReplicationListContext = ReplicationListContext; -CqlParser.ReplicationListItemContext = ReplicationListItemContext; -CqlParser.DurableWritesContext = DurableWritesContext; -CqlParser.UseContext = UseContext; -CqlParser.TruncateContext = TruncateContext; -CqlParser.CreateIndexContext = CreateIndexContext; -CqlParser.CustomIndexOptionContext = CustomIndexOptionContext; -CqlParser.CreateSearchIndexContext = CreateSearchIndexContext; -CqlParser.SearchIndexConfigsContext = SearchIndexConfigsContext; -CqlParser.DirectoryFactoryContext = DirectoryFactoryContext; -CqlParser.SearchIndexOptionsContext = SearchIndexOptionsContext; -CqlParser.SearchIndexProfileContext = SearchIndexProfileContext; -CqlParser.SearchIndexProfilesContext = SearchIndexProfilesContext; -CqlParser.SearchIndexColumnListContext = SearchIndexColumnListContext; -CqlParser.SearchIndexColumnContext = SearchIndexColumnContext; -CqlParser.IndexNameContext = IndexNameContext; -CqlParser.IndexColumnSpecContext = IndexColumnSpecContext; -CqlParser.IndexKeysSpecContext = IndexKeysSpecContext; -CqlParser.IndexEntriesSSpecContext = IndexEntriesSSpecContext; -CqlParser.IndexFullSpecContext = IndexFullSpecContext; -CqlParser.IndexValuesSpecContext = IndexValuesSpecContext; -CqlParser.DeleteStatementContext = DeleteStatementContext; -CqlParser.DeleteColumnListContext = DeleteColumnListContext; -CqlParser.DeleteColumnItemContext = DeleteColumnItemContext; -CqlParser.UpdateContext = UpdateContext; -CqlParser.IfSpecContext = IfSpecContext; -CqlParser.IfConditionListContext = IfConditionListContext; -CqlParser.IfConditionContext = IfConditionContext; -CqlParser.AssignmentsContext = AssignmentsContext; -CqlParser.AssignmentElementContext = AssignmentElementContext; -CqlParser.AssignmentSetContext = AssignmentSetContext; -CqlParser.AssignmentMapContext = AssignmentMapContext; -CqlParser.AssignmentMapExpressionContext = AssignmentMapExpressionContext; -CqlParser.AssignmentListContext = AssignmentListContext; -CqlParser.AssignmentTupleContext = AssignmentTupleContext; -CqlParser.InsertContext = InsertContext; -CqlParser.UsingTtlTimestampContext = UsingTtlTimestampContext; -CqlParser.TimestampContext = TimestampContext; -CqlParser.TtlContext = TtlContext; -CqlParser.UsingTimestampSpecContext = UsingTimestampSpecContext; -CqlParser.IfNotExistContext = IfNotExistContext; -CqlParser.IfExistContext = IfExistContext; -CqlParser.InsertValuesSpecContext = InsertValuesSpecContext; -CqlParser.InsertColumnSpecContext = InsertColumnSpecContext; -CqlParser.ColumnListContext = ColumnListContext; -CqlParser.ExpressionListContext = ExpressionListContext; -CqlParser.ExpressionContext = ExpressionContext; -CqlParser.SelectContext = SelectContext; -CqlParser.AllowFilteringSpecContext = AllowFilteringSpecContext; -CqlParser.LimitSpecContext = LimitSpecContext; -CqlParser.FromSpecContext = FromSpecContext; -CqlParser.FromSpecElementContext = FromSpecElementContext; -CqlParser.OrderSpecContext = OrderSpecContext; -CqlParser.OrderSpecElementContext = OrderSpecElementContext; -CqlParser.WhereSpecContext = WhereSpecContext; -CqlParser.DistinctSpecContext = DistinctSpecContext; -CqlParser.SelectElementsContext = SelectElementsContext; -CqlParser.SelectElementContext = SelectElementContext; -CqlParser.RelationElementsContext = RelationElementsContext; -CqlParser.RelationElementContext = RelationElementContext; -CqlParser.RelalationContainsContext = RelalationContainsContext; -CqlParser.RelalationContainsKeyContext = RelalationContainsKeyContext; -CqlParser.FunctionCallContext = FunctionCallContext; -CqlParser.FunctionArgsContext = FunctionArgsContext; -CqlParser.ConstantContext = ConstantContext; -CqlParser.DecimalLiteralContext = DecimalLiteralContext; -CqlParser.FloatLiteralContext = FloatLiteralContext; -CqlParser.StringLiteralContext = StringLiteralContext; -CqlParser.BooleanLiteralContext = BooleanLiteralContext; -CqlParser.HexadecimalLiteralContext = HexadecimalLiteralContext; -CqlParser.KeyspaceContext = KeyspaceContext; -CqlParser.TableContext = TableContext; -CqlParser.ColumnContext = ColumnContext; -CqlParser.DataTypeContext = DataTypeContext; -CqlParser.DataTypeNameContext = DataTypeNameContext; -CqlParser.DataTypeDefinitionContext = DataTypeDefinitionContext; -CqlParser.OrderDirectionContext = OrderDirectionContext; -CqlParser.RoleContext = RoleContext; -CqlParser.TriggerContext = TriggerContext; -CqlParser.TriggerClassContext = TriggerClassContext; -CqlParser.MaterializedViewContext = MaterializedViewContext; -CqlParser.TypeContext = TypeContext; -CqlParser.AggregateContext = AggregateContext; -CqlParser.FunctionStatementContext = FunctionStatementContext; -CqlParser.LanguageContext = LanguageContext; -CqlParser.UserContext = UserContext; -CqlParser.PasswordContext = PasswordContext; -CqlParser.HashKeyContext = HashKeyContext; -CqlParser.ParamContext = ParamContext; -CqlParser.ParamNameContext = ParamNameContext; -CqlParser.KwAddContext = KwAddContext; -CqlParser.KwAggregateContext = KwAggregateContext; -CqlParser.KwAllContext = KwAllContext; -CqlParser.KwAllPermissionsContext = KwAllPermissionsContext; -CqlParser.KwAllowContext = KwAllowContext; -CqlParser.KwAlterContext = KwAlterContext; -CqlParser.KwAndContext = KwAndContext; -CqlParser.KwApplyContext = KwApplyContext; -CqlParser.KwAsContext = KwAsContext; -CqlParser.KwAscContext = KwAscContext; -CqlParser.KwAuthorizeContext = KwAuthorizeContext; -CqlParser.KwBatchContext = KwBatchContext; -CqlParser.KwBeginContext = KwBeginContext; -CqlParser.KwByContext = KwByContext; -CqlParser.KwCalledContext = KwCalledContext; -CqlParser.KwClusteringContext = KwClusteringContext; -CqlParser.KwCompactContext = KwCompactContext; -CqlParser.KwContainsContext = KwContainsContext; -CqlParser.KwCreateContext = KwCreateContext; -CqlParser.KwDeleteContext = KwDeleteContext; -CqlParser.KwDescContext = KwDescContext; -CqlParser.KwDescibeContext = KwDescibeContext; -CqlParser.KwDistinctContext = KwDistinctContext; -CqlParser.KwDropContext = KwDropContext; -CqlParser.KwDurableWritesContext = KwDurableWritesContext; -CqlParser.KwEntriesContext = KwEntriesContext; -CqlParser.KwExecuteContext = KwExecuteContext; -CqlParser.KwExistsContext = KwExistsContext; -CqlParser.KwFilteringContext = KwFilteringContext; -CqlParser.KwFinalfuncContext = KwFinalfuncContext; -CqlParser.KwFromContext = KwFromContext; -CqlParser.KwFullContext = KwFullContext; -CqlParser.KwFunctionContext = KwFunctionContext; -CqlParser.KwFunctionsContext = KwFunctionsContext; -CqlParser.KwGrantContext = KwGrantContext; -CqlParser.KwIfContext = KwIfContext; -CqlParser.KwInContext = KwInContext; -CqlParser.KwIndexContext = KwIndexContext; -CqlParser.KwCustomContext = KwCustomContext; -CqlParser.KwSearchContext = KwSearchContext; -CqlParser.KwAsciiContext = KwAsciiContext; -CqlParser.KwNormalizeContext = KwNormalizeContext; -CqlParser.KwAnalyzedContext = KwAnalyzedContext; -CqlParser.KwIsLiteralContext = KwIsLiteralContext; -CqlParser.KwMaxCompactionFlushMemoryInMbContext = - KwMaxCompactionFlushMemoryInMbContext; -CqlParser.KwTokenizationEnableStemmingContext = - KwTokenizationEnableStemmingContext; -CqlParser.KwTokenizationSkipStopWordsContext = - KwTokenizationSkipStopWordsContext; -CqlParser.KwTokenizationLocaleContext = KwTokenizationLocaleContext; -CqlParser.KwTokenizationNormalizeLowercaseContext = - KwTokenizationNormalizeLowercaseContext; -CqlParser.KwTokenizationNormalizeUppercaseContext = - KwTokenizationNormalizeUppercaseContext; -CqlParser.KwNormalizeLowercaseContext = KwNormalizeLowercaseContext; -CqlParser.KwNormalizeUppercaseContext = KwNormalizeUppercaseContext; -CqlParser.KwModeContext = KwModeContext; -CqlParser.KwAnalyzerClassContext = KwAnalyzerClassContext; -CqlParser.KwStorageAttachedIndexContext = KwStorageAttachedIndexContext; -CqlParser.KwSolrIndexContext = KwSolrIndexContext; -CqlParser.KwSASIIndexContext = KwSASIIndexContext; -CqlParser.KwSpaceSavingNoJoinContext = KwSpaceSavingNoJoinContext; -CqlParser.KwSpaceSavingAllContext = KwSpaceSavingAllContext; -CqlParser.KwSpaceSavingSlowTriePrecisionContext = - KwSpaceSavingSlowTriePrecisionContext; -CqlParser.KwSpaceSavingNoTextFieldContext = KwSpaceSavingNoTextFieldContext; -CqlParser.KwCopyFieldContext = KwCopyFieldContext; -CqlParser.KwDocValuesContext = KwDocValuesContext; -CqlParser.KwExcludedContext = KwExcludedContext; -CqlParser.KwIndexedContext = KwIndexedContext; -CqlParser.KwLowerCaseContext = KwLowerCaseContext; -CqlParser.KwColumnsContext = KwColumnsContext; -CqlParser.KwProfilesContext = KwProfilesContext; -CqlParser.KwConfigContext = KwConfigContext; -CqlParser.KwAutoCommitTimeContext = KwAutoCommitTimeContext; -CqlParser.KwDefaultQueryFieldContext = KwDefaultQueryFieldContext; -CqlParser.KwDirectoryFactoryContext = KwDirectoryFactoryContext; -CqlParser.KwFilterCacheLowWaterMarkContext = KwFilterCacheLowWaterMarkContext; -CqlParser.KwFilterCacheHighWaterMarkContext = KwFilterCacheHighWaterMarkContext; -CqlParser.KwDirectoryFactoryClassContext = KwDirectoryFactoryClassContext; -CqlParser.KwMergeMaxThreadCountContext = KwMergeMaxThreadCountContext; -CqlParser.KwMergeMaxMergeCountContext = KwMergeMaxMergeCountContext; -CqlParser.KwRamBufferSizeContext = KwRamBufferSizeContext; -CqlParser.KwRealtimeContext = KwRealtimeContext; -CqlParser.KwRecoveryContext = KwRecoveryContext; -CqlParser.KwReindexContext = KwReindexContext; -CqlParser.KwLenientContext = KwLenientContext; -CqlParser.KwStandardContext = KwStandardContext; -CqlParser.KwEncryptedContext = KwEncryptedContext; -CqlParser.KwCaseSensitiveContext = KwCaseSensitiveContext; -CqlParser.KwSimilarityFunctionContext = KwSimilarityFunctionContext; -CqlParser.KwInitcondContext = KwInitcondContext; -CqlParser.KwInputContext = KwInputContext; -CqlParser.KwInsertContext = KwInsertContext; -CqlParser.KwIntoContext = KwIntoContext; -CqlParser.KwIsContext = KwIsContext; -CqlParser.KwJsonContext = KwJsonContext; -CqlParser.KwKeyContext = KwKeyContext; -CqlParser.KwKeysContext = KwKeysContext; -CqlParser.KwKeyspaceContext = KwKeyspaceContext; -CqlParser.KwKeyspacesContext = KwKeyspacesContext; -CqlParser.KwLanguageContext = KwLanguageContext; -CqlParser.KwLimitContext = KwLimitContext; -CqlParser.KwListContext = KwListContext; -CqlParser.KwLoggedContext = KwLoggedContext; -CqlParser.KwLoginContext = KwLoginContext; -CqlParser.KwMaterializedContext = KwMaterializedContext; -CqlParser.KwModifyContext = KwModifyContext; -CqlParser.KwNosuperuserContext = KwNosuperuserContext; -CqlParser.KwNorecursiveContext = KwNorecursiveContext; -CqlParser.KwNotContext = KwNotContext; -CqlParser.KwNullContext = KwNullContext; -CqlParser.KwOfContext = KwOfContext; -CqlParser.KwOnContext = KwOnContext; -CqlParser.KwOptionsContext = KwOptionsContext; -CqlParser.KwOrContext = KwOrContext; -CqlParser.KwOrderContext = KwOrderContext; -CqlParser.KwPasswordContext = KwPasswordContext; -CqlParser.KwPrimaryContext = KwPrimaryContext; -CqlParser.KwRenameContext = KwRenameContext; -CqlParser.KwReplaceContext = KwReplaceContext; -CqlParser.KwReplicationContext = KwReplicationContext; -CqlParser.KwReturnsContext = KwReturnsContext; -CqlParser.KwRoleContext = KwRoleContext; -CqlParser.KwInternalContext = KwInternalContext; -CqlParser.KwLdapContext = KwLdapContext; -CqlParser.KwSchemeContext = KwSchemeContext; -CqlParser.KwRolesContext = KwRolesContext; -CqlParser.KwSelectContext = KwSelectContext; -CqlParser.KwSetContext = KwSetContext; -CqlParser.KwSfuncContext = KwSfuncContext; -CqlParser.KwStorageContext = KwStorageContext; -CqlParser.KwStypeContext = KwStypeContext; -CqlParser.KwSuperuserContext = KwSuperuserContext; -CqlParser.KwTableContext = KwTableContext; -CqlParser.KwTimestampContext = KwTimestampContext; -CqlParser.KwToContext = KwToContext; -CqlParser.KwTriggerContext = KwTriggerContext; -CqlParser.KwTruncateContext = KwTruncateContext; -CqlParser.KwTtlContext = KwTtlContext; -CqlParser.KwTypeContext = KwTypeContext; -CqlParser.KwUnloggedContext = KwUnloggedContext; -CqlParser.KwUpdateContext = KwUpdateContext; -CqlParser.KwUseContext = KwUseContext; -CqlParser.KwUserContext = KwUserContext; -CqlParser.KwUsersContext = KwUsersContext; -CqlParser.KwUsingContext = KwUsingContext; -CqlParser.KwValuesContext = KwValuesContext; -CqlParser.KwViewContext = KwViewContext; -CqlParser.KwWhereContext = KwWhereContext; -CqlParser.KwWithContext = KwWithContext; -CqlParser.KwRevokeContext = KwRevokeContext; -CqlParser.EofContext = EofContext; -CqlParser.SyntaxBracketLrContext = SyntaxBracketLrContext; -CqlParser.SyntaxBracketRrContext = SyntaxBracketRrContext; -CqlParser.SyntaxBracketLcContext = SyntaxBracketLcContext; -CqlParser.SyntaxBracketRcContext = SyntaxBracketRcContext; -CqlParser.SyntaxBracketLaContext = SyntaxBracketLaContext; -CqlParser.SyntaxBracketRaContext = SyntaxBracketRaContext; -CqlParser.SyntaxBracketLsContext = SyntaxBracketLsContext; -CqlParser.SyntaxBracketRsContext = SyntaxBracketRsContext; -CqlParser.SyntaxCommaContext = SyntaxCommaContext; -CqlParser.SyntaxColonContext = SyntaxColonContext; -CqlParser.IdContext = IdContext; - -exports.CqlParser = CqlParser; diff --git a/reverse_engineering/parser/CqlParser.tokens b/reverse_engineering/parser/CqlParser.tokens deleted file mode 100644 index 45c11a9f..00000000 --- a/reverse_engineering/parser/CqlParser.tokens +++ /dev/null @@ -1,244 +0,0 @@ -LR_BRACKET=1 -RR_BRACKET=2 -LC_BRACKET=3 -RC_BRACKET=4 -LS_BRACKET=5 -RS_BRACKET=6 -COMMA=7 -SEMI=8 -COLON=9 -SPACE=10 -SPEC_MYSQL_COMMENT=11 -COMMENT_INPUT=12 -LINE_COMMENT=13 -DOT=14 -STAR=15 -DIVIDE=16 -MODULE=17 -PLUS=18 -MINUSMINUS=19 -MINUS=20 -DQUOTE=21 -SQUOTE=22 -K_ADD=23 -K_AGGREGATE=24 -K_ALL=25 -K_ALLOW=26 -K_ALTER=27 -K_AND=28 -K_ANY=29 -K_APPLY=30 -K_AS=31 -K_ASC=32 -K_AUTHORIZE=33 -K_BATCH=34 -K_BEGIN=35 -K_BY=36 -K_CALLED=37 -K_CLUSTERING=38 -K_COLUMNFAMILY=39 -K_COMPACT=40 -K_CONSISTENCY=41 -K_CONTAINS=42 -K_CREATE=43 -K_CUSTOM=44 -K_SEARCH=45 -K_DELETE=46 -K_DESC=47 -K_DESCRIBE=48 -K_DISTINCT=49 -K_DROP=50 -K_DURABLE_WRITES=51 -K_EACH_QUORUM=52 -K_ENTRIES=53 -K_EXECUTE=54 -K_EXISTS=55 -K_FALSE=56 -K_FILTERING=57 -K_FINALFUNC=58 -K_FROM=59 -K_FULL=60 -K_FUNCTION=61 -K_FUNCTIONS=62 -K_GRANT=63 -K_IF=64 -K_IN=65 -K_INDEX=66 -K_INFINITY=67 -K_INITCOND=68 -K_INPUT=69 -K_INSERT=70 -K_INTO=71 -K_IS=72 -K_JSON=73 -K_KEY=74 -K_KEYS=75 -K_KEYSPACE=76 -K_KEYSPACES=77 -K_LANGUAGE=78 -K_LEVEL=79 -K_LIMIT=80 -K_LOCAL_ONE=81 -K_LOCAL_QUORUM=82 -K_LOGGED=83 -K_LOGIN=84 -K_MATERIALIZED=85 -K_MODIFY=86 -K_NAN=87 -K_NORECURSIVE=88 -K_NOSUPERUSER=89 -K_NOT=90 -K_NULL=91 -K_OF=92 -K_ON=93 -K_ONE=94 -K_OPTIONS=95 -K_OR=96 -K_ORDER=97 -K_PARTITION=98 -K_PASSWORD=99 -K_PER=100 -K_PERMISSION=101 -K_PERMISSIONS=102 -K_PRIMARY=103 -K_QUORUM=104 -K_RENAME=105 -K_REPLACE=106 -K_REPLICATION=107 -K_RETURNS=108 -K_REVOKE=109 -K_ROLE=110 -K_ROLES=111 -K_INTERNAL=112 -K_LDAP=113 -K_SCHEME=114 -K_SCHEMA=115 -K_SELECT=116 -K_SET=117 -K_SFUNC=118 -K_STATIC=119 -K_STORAGE=120 -K_STYPE=121 -K_SUPERUSER=122 -K_TABLE=123 -K_THREE=124 -K_TIMESTAMP=125 -K_TO=126 -K_TOKEN=127 -K_TRIGGER=128 -K_TRUE=129 -K_TRUNCATE=130 -K_TTL=131 -K_TWO=132 -K_TYPE=133 -K_UNLOGGED=134 -K_UPDATE=135 -K_USE=136 -K_USER=137 -K_USING=138 -K_UUID=139 -K_VALUES=140 -K_VIEW=141 -K_WHERE=142 -K_WITH=143 -K_WRITETIME=144 -K_ASCII=145 -K_CASE_SENITIVE=146 -K_NORMALIZE=147 -K_SIMILARITY_FUNCTION=148 -K_ANALYZED=149 -K_IS_LITERAL=150 -K_MAX_COMPACTION_FLUSH_MEMORY_IN_MB=151 -K_TOKENIZATION_ENABLE_STEMMING=152 -K_TOKENIZATION_SKIP_STOP_WORDS=153 -K_TOKENIZATION_LOCALE=154 -K_TOKENIZATION_NORMALIZE_LOWERCASE=155 -K_TOKENIZATION_NORMALIZE_UPPERCASE=156 -K_NORMALIZE_LOWERCASE=157 -K_NORMALIZE_UPPERCASE=158 -K_MODE=159 -K_ANALYZER_CLASS=160 -K_STORAGE_ATTACHED_INDEX=161 -K_SASI_INDEX=162 -K_SOLR_INDEX=163 -K_SPACE_SAVING_NO_JOIN=164 -K_SPACE_SAVING_ALL=165 -K_SPACE_SAVING_SLOW_TRIE_PRECISION=166 -K_SPACE_SAVING_NO_TEXT_FIELD=167 -K_DOC_VALUES=168 -K_COPY_FIELD=169 -K_EXCLUDED=170 -K_INDEXED=171 -K_LOWERCASE=172 -K_COLUMNS=173 -K_PROFILES=174 -K_CONFIG=175 -K_AUTOCOMMIT_TIME=176 -K_DEFAULT_QUERY_FIELD=177 -K_DIRECTORY_FACTORY=178 -K_FILTER_CACHE_LOW_WATERMARK=179 -K_FILTER_CACHE_HIGH_WATERMARK=180 -K_DIRECTORY_FACTORY_CLASS=181 -K_MERGE_MAX_THREAD_COUNT=182 -K_MERGE_MAX_MERGE_COUNT=183 -K_RAM_BUFFER_SIZE=184 -K_REALTIME=185 -K_RECOVERY=186 -K_REINDEX=187 -K_LENIENT=188 -K_STANDARD=189 -K_ENCRYPTED=190 -K_BIGINT=191 -K_BLOB=192 -K_BOOLEAN=193 -K_COUNTER=194 -K_DATE=195 -K_DECIMAL=196 -K_DOUBLE=197 -K_FLOAT=198 -K_FROZEN=199 -K_INET=200 -K_INT=201 -K_LIST=202 -K_MAP=203 -K_SMALLINT=204 -K_TEXT=205 -K_TIMEUUID=206 -K_TIME=207 -K_TINYINT=208 -K_TUPLE=209 -K_VARCHAR=210 -K_VARINT=211 -CODE_BLOCK=212 -STRING_LITERAL=213 -DECIMAL_LITERAL=214 -FLOAT_LITERAL=215 -HEXADECIMAL_LITERAL=216 -REAL_LITERAL=217 -OBJECT_NAME=218 -UUID=219 -OPERATOR_EQ=220 -OPERATOR_LT=221 -OPERATOR_GT=222 -OPERATOR_LTE=223 -OPERATOR_GTE=224 -K_USERS=225 -K_VECTOR=226 -'('=1 -')'=2 -'{'=3 -'}'=4 -'['=5 -']'=6 -','=7 -';'=8 -':'=9 -'.'=14 -'*'=15 -'/'=16 -'%'=17 -'+'=18 -'--'=19 -'-'=20 -'"'=21 -'\''=22 diff --git a/reverse_engineering/parser/CqlParserListener.js b/reverse_engineering/parser/CqlParserListener.js deleted file mode 100644 index 07613ed5..00000000 --- a/reverse_engineering/parser/CqlParserListener.js +++ /dev/null @@ -1,2072 +0,0 @@ -// Generated from grammars/CqlParser.g4 by ANTLR 4.9.2 -// jshint ignore: start -var antlr4 = require("antlr4/index"); - -// This class defines a complete listener for a parse tree produced by CqlParser. -class CqlParserListener extends antlr4.tree.ParseTreeListener { - // Enter a parse tree produced by CqlParser#root. - enterRoot(ctx) {} - - // Exit a parse tree produced by CqlParser#root. - exitRoot(ctx) {} - - // Enter a parse tree produced by CqlParser#cqls. - enterCqls(ctx) {} - - // Exit a parse tree produced by CqlParser#cqls. - exitCqls(ctx) {} - - // Enter a parse tree produced by CqlParser#statementSeparator. - enterStatementSeparator(ctx) {} - - // Exit a parse tree produced by CqlParser#statementSeparator. - exitStatementSeparator(ctx) {} - - // Enter a parse tree produced by CqlParser#empty. - enterEmpty(ctx) {} - - // Exit a parse tree produced by CqlParser#empty. - exitEmpty(ctx) {} - - // Enter a parse tree produced by CqlParser#cql. - enterCql(ctx) {} - - // Exit a parse tree produced by CqlParser#cql. - exitCql(ctx) {} - - // Enter a parse tree produced by CqlParser#revoke. - enterRevoke(ctx) {} - - // Exit a parse tree produced by CqlParser#revoke. - exitRevoke(ctx) {} - - // Enter a parse tree produced by CqlParser#listUsers. - enterListUsers(ctx) {} - - // Exit a parse tree produced by CqlParser#listUsers. - exitListUsers(ctx) {} - - // Enter a parse tree produced by CqlParser#listRoles. - enterListRoles(ctx) {} - - // Exit a parse tree produced by CqlParser#listRoles. - exitListRoles(ctx) {} - - // Enter a parse tree produced by CqlParser#listPermissions. - enterListPermissions(ctx) {} - - // Exit a parse tree produced by CqlParser#listPermissions. - exitListPermissions(ctx) {} - - // Enter a parse tree produced by CqlParser#grant. - enterGrant(ctx) {} - - // Exit a parse tree produced by CqlParser#grant. - exitGrant(ctx) {} - - // Enter a parse tree produced by CqlParser#priviledge. - enterPriviledge(ctx) {} - - // Exit a parse tree produced by CqlParser#priviledge. - exitPriviledge(ctx) {} - - // Enter a parse tree produced by CqlParser#resource. - enterResource(ctx) {} - - // Exit a parse tree produced by CqlParser#resource. - exitResource(ctx) {} - - // Enter a parse tree produced by CqlParser#createUser. - enterCreateUser(ctx) {} - - // Exit a parse tree produced by CqlParser#createUser. - exitCreateUser(ctx) {} - - // Enter a parse tree produced by CqlParser#createRole. - enterCreateRole(ctx) {} - - // Exit a parse tree produced by CqlParser#createRole. - exitCreateRole(ctx) {} - - // Enter a parse tree produced by CqlParser#createType. - enterCreateType(ctx) {} - - // Exit a parse tree produced by CqlParser#createType. - exitCreateType(ctx) {} - - // Enter a parse tree produced by CqlParser#typeMemberColumnList. - enterTypeMemberColumnList(ctx) {} - - // Exit a parse tree produced by CqlParser#typeMemberColumnList. - exitTypeMemberColumnList(ctx) {} - - // Enter a parse tree produced by CqlParser#createTrigger. - enterCreateTrigger(ctx) {} - - // Exit a parse tree produced by CqlParser#createTrigger. - exitCreateTrigger(ctx) {} - - // Enter a parse tree produced by CqlParser#createMaterializedView. - enterCreateMaterializedView(ctx) {} - - // Exit a parse tree produced by CqlParser#createMaterializedView. - exitCreateMaterializedView(ctx) {} - - // Enter a parse tree produced by CqlParser#materializedViewWhere. - enterMaterializedViewWhere(ctx) {} - - // Exit a parse tree produced by CqlParser#materializedViewWhere. - exitMaterializedViewWhere(ctx) {} - - // Enter a parse tree produced by CqlParser#columnNotNullList. - enterColumnNotNullList(ctx) {} - - // Exit a parse tree produced by CqlParser#columnNotNullList. - exitColumnNotNullList(ctx) {} - - // Enter a parse tree produced by CqlParser#columnNotNull. - enterColumnNotNull(ctx) {} - - // Exit a parse tree produced by CqlParser#columnNotNull. - exitColumnNotNull(ctx) {} - - // Enter a parse tree produced by CqlParser#materializedViewOptions. - enterMaterializedViewOptions(ctx) {} - - // Exit a parse tree produced by CqlParser#materializedViewOptions. - exitMaterializedViewOptions(ctx) {} - - // Enter a parse tree produced by CqlParser#createKeyspace. - enterCreateKeyspace(ctx) {} - - // Exit a parse tree produced by CqlParser#createKeyspace. - exitCreateKeyspace(ctx) {} - - // Enter a parse tree produced by CqlParser#createFunction. - enterCreateFunction(ctx) {} - - // Exit a parse tree produced by CqlParser#createFunction. - exitCreateFunction(ctx) {} - - // Enter a parse tree produced by CqlParser#codeBlock. - enterCodeBlock(ctx) {} - - // Exit a parse tree produced by CqlParser#codeBlock. - exitCodeBlock(ctx) {} - - // Enter a parse tree produced by CqlParser#paramList. - enterParamList(ctx) {} - - // Exit a parse tree produced by CqlParser#paramList. - exitParamList(ctx) {} - - // Enter a parse tree produced by CqlParser#returnMode. - enterReturnMode(ctx) {} - - // Exit a parse tree produced by CqlParser#returnMode. - exitReturnMode(ctx) {} - - // Enter a parse tree produced by CqlParser#createAggregate. - enterCreateAggregate(ctx) {} - - // Exit a parse tree produced by CqlParser#createAggregate. - exitCreateAggregate(ctx) {} - - // Enter a parse tree produced by CqlParser#initCondDefinition. - enterInitCondDefinition(ctx) {} - - // Exit a parse tree produced by CqlParser#initCondDefinition. - exitInitCondDefinition(ctx) {} - - // Enter a parse tree produced by CqlParser#initCondHash. - enterInitCondHash(ctx) {} - - // Exit a parse tree produced by CqlParser#initCondHash. - exitInitCondHash(ctx) {} - - // Enter a parse tree produced by CqlParser#initCondHashItem. - enterInitCondHashItem(ctx) {} - - // Exit a parse tree produced by CqlParser#initCondHashItem. - exitInitCondHashItem(ctx) {} - - // Enter a parse tree produced by CqlParser#initCondListNested. - enterInitCondListNested(ctx) {} - - // Exit a parse tree produced by CqlParser#initCondListNested. - exitInitCondListNested(ctx) {} - - // Enter a parse tree produced by CqlParser#initCondList. - enterInitCondList(ctx) {} - - // Exit a parse tree produced by CqlParser#initCondList. - exitInitCondList(ctx) {} - - // Enter a parse tree produced by CqlParser#orReplace. - enterOrReplace(ctx) {} - - // Exit a parse tree produced by CqlParser#orReplace. - exitOrReplace(ctx) {} - - // Enter a parse tree produced by CqlParser#alterUser. - enterAlterUser(ctx) {} - - // Exit a parse tree produced by CqlParser#alterUser. - exitAlterUser(ctx) {} - - // Enter a parse tree produced by CqlParser#userPassword. - enterUserPassword(ctx) {} - - // Exit a parse tree produced by CqlParser#userPassword. - exitUserPassword(ctx) {} - - // Enter a parse tree produced by CqlParser#userSuperUser. - enterUserSuperUser(ctx) {} - - // Exit a parse tree produced by CqlParser#userSuperUser. - exitUserSuperUser(ctx) {} - - // Enter a parse tree produced by CqlParser#alterType. - enterAlterType(ctx) {} - - // Exit a parse tree produced by CqlParser#alterType. - exitAlterType(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeOperation. - enterAlterTypeOperation(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeOperation. - exitAlterTypeOperation(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeRename. - enterAlterTypeRename(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeRename. - exitAlterTypeRename(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeRenameList. - enterAlterTypeRenameList(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeRenameList. - exitAlterTypeRenameList(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeRenameItem. - enterAlterTypeRenameItem(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeRenameItem. - exitAlterTypeRenameItem(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeAdd. - enterAlterTypeAdd(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeAdd. - exitAlterTypeAdd(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTypeAlterType. - enterAlterTypeAlterType(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTypeAlterType. - exitAlterTypeAlterType(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTable. - enterAlterTable(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTable. - exitAlterTable(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableOperation. - enterAlterTableOperation(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableOperation. - exitAlterTableOperation(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableWith. - enterAlterTableWith(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableWith. - exitAlterTableWith(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableRename. - enterAlterTableRename(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableRename. - exitAlterTableRename(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableDropCompactStorage. - enterAlterTableDropCompactStorage(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableDropCompactStorage. - exitAlterTableDropCompactStorage(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableDropColumns. - enterAlterTableDropColumns(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableDropColumns. - exitAlterTableDropColumns(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableDropColumnList. - enterAlterTableDropColumnList(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableDropColumnList. - exitAlterTableDropColumnList(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableAdd. - enterAlterTableAdd(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableAdd. - exitAlterTableAdd(ctx) {} - - // Enter a parse tree produced by CqlParser#alterTableColumnDefinition. - enterAlterTableColumnDefinition(ctx) {} - - // Exit a parse tree produced by CqlParser#alterTableColumnDefinition. - exitAlterTableColumnDefinition(ctx) {} - - // Enter a parse tree produced by CqlParser#alterRole. - enterAlterRole(ctx) {} - - // Exit a parse tree produced by CqlParser#alterRole. - exitAlterRole(ctx) {} - - // Enter a parse tree produced by CqlParser#roleWith. - enterRoleWith(ctx) {} - - // Exit a parse tree produced by CqlParser#roleWith. - exitRoleWith(ctx) {} - - // Enter a parse tree produced by CqlParser#roleWithOptions. - enterRoleWithOptions(ctx) {} - - // Exit a parse tree produced by CqlParser#roleWithOptions. - exitRoleWithOptions(ctx) {} - - // Enter a parse tree produced by CqlParser#alterMaterializedView. - enterAlterMaterializedView(ctx) {} - - // Exit a parse tree produced by CqlParser#alterMaterializedView. - exitAlterMaterializedView(ctx) {} - - // Enter a parse tree produced by CqlParser#dropUser. - enterDropUser(ctx) {} - - // Exit a parse tree produced by CqlParser#dropUser. - exitDropUser(ctx) {} - - // Enter a parse tree produced by CqlParser#dropType. - enterDropType(ctx) {} - - // Exit a parse tree produced by CqlParser#dropType. - exitDropType(ctx) {} - - // Enter a parse tree produced by CqlParser#dropMaterializedView. - enterDropMaterializedView(ctx) {} - - // Exit a parse tree produced by CqlParser#dropMaterializedView. - exitDropMaterializedView(ctx) {} - - // Enter a parse tree produced by CqlParser#dropAggregate. - enterDropAggregate(ctx) {} - - // Exit a parse tree produced by CqlParser#dropAggregate. - exitDropAggregate(ctx) {} - - // Enter a parse tree produced by CqlParser#dropFunction. - enterDropFunction(ctx) {} - - // Exit a parse tree produced by CqlParser#dropFunction. - exitDropFunction(ctx) {} - - // Enter a parse tree produced by CqlParser#dropTrigger. - enterDropTrigger(ctx) {} - - // Exit a parse tree produced by CqlParser#dropTrigger. - exitDropTrigger(ctx) {} - - // Enter a parse tree produced by CqlParser#dropRole. - enterDropRole(ctx) {} - - // Exit a parse tree produced by CqlParser#dropRole. - exitDropRole(ctx) {} - - // Enter a parse tree produced by CqlParser#dropTable. - enterDropTable(ctx) {} - - // Exit a parse tree produced by CqlParser#dropTable. - exitDropTable(ctx) {} - - // Enter a parse tree produced by CqlParser#dropKeyspace. - enterDropKeyspace(ctx) {} - - // Exit a parse tree produced by CqlParser#dropKeyspace. - exitDropKeyspace(ctx) {} - - // Enter a parse tree produced by CqlParser#dropIndex. - enterDropIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#dropIndex. - exitDropIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#createTable. - enterCreateTable(ctx) {} - - // Exit a parse tree produced by CqlParser#createTable. - exitCreateTable(ctx) {} - - // Enter a parse tree produced by CqlParser#withElement. - enterWithElement(ctx) {} - - // Exit a parse tree produced by CqlParser#withElement. - exitWithElement(ctx) {} - - // Enter a parse tree produced by CqlParser#clusteringOrderColumns. - enterClusteringOrderColumns(ctx) {} - - // Exit a parse tree produced by CqlParser#clusteringOrderColumns. - exitClusteringOrderColumns(ctx) {} - - // Enter a parse tree produced by CqlParser#clusteringOrder. - enterClusteringOrder(ctx) {} - - // Exit a parse tree produced by CqlParser#clusteringOrder. - exitClusteringOrder(ctx) {} - - // Enter a parse tree produced by CqlParser#tableOptions. - enterTableOptions(ctx) {} - - // Exit a parse tree produced by CqlParser#tableOptions. - exitTableOptions(ctx) {} - - // Enter a parse tree produced by CqlParser#tableOptionItem. - enterTableOptionItem(ctx) {} - - // Exit a parse tree produced by CqlParser#tableOptionItem. - exitTableOptionItem(ctx) {} - - // Enter a parse tree produced by CqlParser#tableOptionName. - enterTableOptionName(ctx) {} - - // Exit a parse tree produced by CqlParser#tableOptionName. - exitTableOptionName(ctx) {} - - // Enter a parse tree produced by CqlParser#tableOptionValue. - enterTableOptionValue(ctx) {} - - // Exit a parse tree produced by CqlParser#tableOptionValue. - exitTableOptionValue(ctx) {} - - // Enter a parse tree produced by CqlParser#optionHash. - enterOptionHash(ctx) {} - - // Exit a parse tree produced by CqlParser#optionHash. - exitOptionHash(ctx) {} - - // Enter a parse tree produced by CqlParser#optionHashItem. - enterOptionHashItem(ctx) {} - - // Exit a parse tree produced by CqlParser#optionHashItem. - exitOptionHashItem(ctx) {} - - // Enter a parse tree produced by CqlParser#optionHashKey. - enterOptionHashKey(ctx) {} - - // Exit a parse tree produced by CqlParser#optionHashKey. - exitOptionHashKey(ctx) {} - - // Enter a parse tree produced by CqlParser#optionHashValue. - enterOptionHashValue(ctx) {} - - // Exit a parse tree produced by CqlParser#optionHashValue. - exitOptionHashValue(ctx) {} - - // Enter a parse tree produced by CqlParser#columnDefinitionList. - enterColumnDefinitionList(ctx) {} - - // Exit a parse tree produced by CqlParser#columnDefinitionList. - exitColumnDefinitionList(ctx) {} - - // Enter a parse tree produced by CqlParser#columnDefinition. - enterColumnDefinition(ctx) {} - - // Exit a parse tree produced by CqlParser#columnDefinition. - exitColumnDefinition(ctx) {} - - // Enter a parse tree produced by CqlParser#primaryKeyColumn. - enterPrimaryKeyColumn(ctx) {} - - // Exit a parse tree produced by CqlParser#primaryKeyColumn. - exitPrimaryKeyColumn(ctx) {} - - // Enter a parse tree produced by CqlParser#primaryKeyElement. - enterPrimaryKeyElement(ctx) {} - - // Exit a parse tree produced by CqlParser#primaryKeyElement. - exitPrimaryKeyElement(ctx) {} - - // Enter a parse tree produced by CqlParser#primaryKeyDefinition. - enterPrimaryKeyDefinition(ctx) {} - - // Exit a parse tree produced by CqlParser#primaryKeyDefinition. - exitPrimaryKeyDefinition(ctx) {} - - // Enter a parse tree produced by CqlParser#singlePrimaryKey. - enterSinglePrimaryKey(ctx) {} - - // Exit a parse tree produced by CqlParser#singlePrimaryKey. - exitSinglePrimaryKey(ctx) {} - - // Enter a parse tree produced by CqlParser#compoundKey. - enterCompoundKey(ctx) {} - - // Exit a parse tree produced by CqlParser#compoundKey. - exitCompoundKey(ctx) {} - - // Enter a parse tree produced by CqlParser#compositeKey. - enterCompositeKey(ctx) {} - - // Exit a parse tree produced by CqlParser#compositeKey. - exitCompositeKey(ctx) {} - - // Enter a parse tree produced by CqlParser#partitionKeyList. - enterPartitionKeyList(ctx) {} - - // Exit a parse tree produced by CqlParser#partitionKeyList. - exitPartitionKeyList(ctx) {} - - // Enter a parse tree produced by CqlParser#clusteringKeyList. - enterClusteringKeyList(ctx) {} - - // Exit a parse tree produced by CqlParser#clusteringKeyList. - exitClusteringKeyList(ctx) {} - - // Enter a parse tree produced by CqlParser#partitionKey. - enterPartitionKey(ctx) {} - - // Exit a parse tree produced by CqlParser#partitionKey. - exitPartitionKey(ctx) {} - - // Enter a parse tree produced by CqlParser#clusteringKey. - enterClusteringKey(ctx) {} - - // Exit a parse tree produced by CqlParser#clusteringKey. - exitClusteringKey(ctx) {} - - // Enter a parse tree produced by CqlParser#applyBatch. - enterApplyBatch(ctx) {} - - // Exit a parse tree produced by CqlParser#applyBatch. - exitApplyBatch(ctx) {} - - // Enter a parse tree produced by CqlParser#beginBatch. - enterBeginBatch(ctx) {} - - // Exit a parse tree produced by CqlParser#beginBatch. - exitBeginBatch(ctx) {} - - // Enter a parse tree produced by CqlParser#batchType. - enterBatchType(ctx) {} - - // Exit a parse tree produced by CqlParser#batchType. - exitBatchType(ctx) {} - - // Enter a parse tree produced by CqlParser#alterKeyspace. - enterAlterKeyspace(ctx) {} - - // Exit a parse tree produced by CqlParser#alterKeyspace. - exitAlterKeyspace(ctx) {} - - // Enter a parse tree produced by CqlParser#replicationList. - enterReplicationList(ctx) {} - - // Exit a parse tree produced by CqlParser#replicationList. - exitReplicationList(ctx) {} - - // Enter a parse tree produced by CqlParser#replicationListItem. - enterReplicationListItem(ctx) {} - - // Exit a parse tree produced by CqlParser#replicationListItem. - exitReplicationListItem(ctx) {} - - // Enter a parse tree produced by CqlParser#durableWrites. - enterDurableWrites(ctx) {} - - // Exit a parse tree produced by CqlParser#durableWrites. - exitDurableWrites(ctx) {} - - // Enter a parse tree produced by CqlParser#use. - enterUse(ctx) {} - - // Exit a parse tree produced by CqlParser#use. - exitUse(ctx) {} - - // Enter a parse tree produced by CqlParser#truncate. - enterTruncate(ctx) {} - - // Exit a parse tree produced by CqlParser#truncate. - exitTruncate(ctx) {} - - // Enter a parse tree produced by CqlParser#secondaryIndex. - enterSecondaryIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#secondaryIndex. - exitSecondaryIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#customIndex. - enterCustomIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#customIndex. - exitCustomIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#customIndexOption. - enterCustomIndexOption(ctx) {} - - // Exit a parse tree produced by CqlParser#customIndexOption. - exitCustomIndexOption(ctx) {} - - // Enter a parse tree produced by CqlParser#createSearchIndex. - enterCreateSearchIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#createSearchIndex. - exitCreateSearchIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexConfigs. - enterSearchIndexConfigs(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexConfigs. - exitSearchIndexConfigs(ctx) {} - - // Enter a parse tree produced by CqlParser#directoryFactory. - enterDirectoryFactory(ctx) {} - - // Exit a parse tree produced by CqlParser#directoryFactory. - exitDirectoryFactory(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexOptions. - enterSearchIndexOptions(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexOptions. - exitSearchIndexOptions(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexProfile. - enterSearchIndexProfile(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexProfile. - exitSearchIndexProfile(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexProfiles. - enterSearchIndexProfiles(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexProfiles. - exitSearchIndexProfiles(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexColumnList. - enterSearchIndexColumnList(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexColumnList. - exitSearchIndexColumnList(ctx) {} - - // Enter a parse tree produced by CqlParser#searchIndexColumn. - enterSearchIndexColumn(ctx) {} - - // Exit a parse tree produced by CqlParser#searchIndexColumn. - exitSearchIndexColumn(ctx) {} - - // Enter a parse tree produced by CqlParser#indexName. - enterIndexName(ctx) {} - - // Exit a parse tree produced by CqlParser#indexName. - exitIndexName(ctx) {} - - // Enter a parse tree produced by CqlParser#indexColumnSpec. - enterIndexColumnSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#indexColumnSpec. - exitIndexColumnSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#indexKeysSpec. - enterIndexKeysSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#indexKeysSpec. - exitIndexKeysSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#indexEntriesSSpec. - enterIndexEntriesSSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#indexEntriesSSpec. - exitIndexEntriesSSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#indexFullSpec. - enterIndexFullSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#indexFullSpec. - exitIndexFullSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#indexValuesSpec. - enterIndexValuesSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#indexValuesSpec. - exitIndexValuesSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#deleteStatement. - enterDeleteStatement(ctx) {} - - // Exit a parse tree produced by CqlParser#deleteStatement. - exitDeleteStatement(ctx) {} - - // Enter a parse tree produced by CqlParser#deleteColumnList. - enterDeleteColumnList(ctx) {} - - // Exit a parse tree produced by CqlParser#deleteColumnList. - exitDeleteColumnList(ctx) {} - - // Enter a parse tree produced by CqlParser#deleteColumnItem. - enterDeleteColumnItem(ctx) {} - - // Exit a parse tree produced by CqlParser#deleteColumnItem. - exitDeleteColumnItem(ctx) {} - - // Enter a parse tree produced by CqlParser#update. - enterUpdate(ctx) {} - - // Exit a parse tree produced by CqlParser#update. - exitUpdate(ctx) {} - - // Enter a parse tree produced by CqlParser#ifSpec. - enterIfSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#ifSpec. - exitIfSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#ifConditionList. - enterIfConditionList(ctx) {} - - // Exit a parse tree produced by CqlParser#ifConditionList. - exitIfConditionList(ctx) {} - - // Enter a parse tree produced by CqlParser#ifCondition. - enterIfCondition(ctx) {} - - // Exit a parse tree produced by CqlParser#ifCondition. - exitIfCondition(ctx) {} - - // Enter a parse tree produced by CqlParser#assignments. - enterAssignments(ctx) {} - - // Exit a parse tree produced by CqlParser#assignments. - exitAssignments(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentElement. - enterAssignmentElement(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentElement. - exitAssignmentElement(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentSet. - enterAssignmentSet(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentSet. - exitAssignmentSet(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentMap. - enterAssignmentMap(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentMap. - exitAssignmentMap(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentMapExpression. - enterAssignmentMapExpression(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentMapExpression. - exitAssignmentMapExpression(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentList. - enterAssignmentList(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentList. - exitAssignmentList(ctx) {} - - // Enter a parse tree produced by CqlParser#assignmentTuple. - enterAssignmentTuple(ctx) {} - - // Exit a parse tree produced by CqlParser#assignmentTuple. - exitAssignmentTuple(ctx) {} - - // Enter a parse tree produced by CqlParser#insert. - enterInsert(ctx) {} - - // Exit a parse tree produced by CqlParser#insert. - exitInsert(ctx) {} - - // Enter a parse tree produced by CqlParser#usingTtlTimestamp. - enterUsingTtlTimestamp(ctx) {} - - // Exit a parse tree produced by CqlParser#usingTtlTimestamp. - exitUsingTtlTimestamp(ctx) {} - - // Enter a parse tree produced by CqlParser#timestamp. - enterTimestamp(ctx) {} - - // Exit a parse tree produced by CqlParser#timestamp. - exitTimestamp(ctx) {} - - // Enter a parse tree produced by CqlParser#ttl. - enterTtl(ctx) {} - - // Exit a parse tree produced by CqlParser#ttl. - exitTtl(ctx) {} - - // Enter a parse tree produced by CqlParser#usingTimestampSpec. - enterUsingTimestampSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#usingTimestampSpec. - exitUsingTimestampSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#ifNotExist. - enterIfNotExist(ctx) {} - - // Exit a parse tree produced by CqlParser#ifNotExist. - exitIfNotExist(ctx) {} - - // Enter a parse tree produced by CqlParser#ifExist. - enterIfExist(ctx) {} - - // Exit a parse tree produced by CqlParser#ifExist. - exitIfExist(ctx) {} - - // Enter a parse tree produced by CqlParser#insertValuesSpec. - enterInsertValuesSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#insertValuesSpec. - exitInsertValuesSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#insertColumnSpec. - enterInsertColumnSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#insertColumnSpec. - exitInsertColumnSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#columnList. - enterColumnList(ctx) {} - - // Exit a parse tree produced by CqlParser#columnList. - exitColumnList(ctx) {} - - // Enter a parse tree produced by CqlParser#expressionList. - enterExpressionList(ctx) {} - - // Exit a parse tree produced by CqlParser#expressionList. - exitExpressionList(ctx) {} - - // Enter a parse tree produced by CqlParser#expression. - enterExpression(ctx) {} - - // Exit a parse tree produced by CqlParser#expression. - exitExpression(ctx) {} - - // Enter a parse tree produced by CqlParser#select. - enterSelect(ctx) {} - - // Exit a parse tree produced by CqlParser#select. - exitSelect(ctx) {} - - // Enter a parse tree produced by CqlParser#allowFilteringSpec. - enterAllowFilteringSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#allowFilteringSpec. - exitAllowFilteringSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#limitSpec. - enterLimitSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#limitSpec. - exitLimitSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#fromSpec. - enterFromSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#fromSpec. - exitFromSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#fromSpecElement. - enterFromSpecElement(ctx) {} - - // Exit a parse tree produced by CqlParser#fromSpecElement. - exitFromSpecElement(ctx) {} - - // Enter a parse tree produced by CqlParser#orderSpec. - enterOrderSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#orderSpec. - exitOrderSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#orderSpecElement. - enterOrderSpecElement(ctx) {} - - // Exit a parse tree produced by CqlParser#orderSpecElement. - exitOrderSpecElement(ctx) {} - - // Enter a parse tree produced by CqlParser#whereSpec. - enterWhereSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#whereSpec. - exitWhereSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#distinctSpec. - enterDistinctSpec(ctx) {} - - // Exit a parse tree produced by CqlParser#distinctSpec. - exitDistinctSpec(ctx) {} - - // Enter a parse tree produced by CqlParser#selectElements. - enterSelectElements(ctx) {} - - // Exit a parse tree produced by CqlParser#selectElements. - exitSelectElements(ctx) {} - - // Enter a parse tree produced by CqlParser#selectElement. - enterSelectElement(ctx) {} - - // Exit a parse tree produced by CqlParser#selectElement. - exitSelectElement(ctx) {} - - // Enter a parse tree produced by CqlParser#relationElements. - enterRelationElements(ctx) {} - - // Exit a parse tree produced by CqlParser#relationElements. - exitRelationElements(ctx) {} - - // Enter a parse tree produced by CqlParser#relationElement. - enterRelationElement(ctx) {} - - // Exit a parse tree produced by CqlParser#relationElement. - exitRelationElement(ctx) {} - - // Enter a parse tree produced by CqlParser#relalationContains. - enterRelalationContains(ctx) {} - - // Exit a parse tree produced by CqlParser#relalationContains. - exitRelalationContains(ctx) {} - - // Enter a parse tree produced by CqlParser#relalationContainsKey. - enterRelalationContainsKey(ctx) {} - - // Exit a parse tree produced by CqlParser#relalationContainsKey. - exitRelalationContainsKey(ctx) {} - - // Enter a parse tree produced by CqlParser#functionCall. - enterFunctionCall(ctx) {} - - // Exit a parse tree produced by CqlParser#functionCall. - exitFunctionCall(ctx) {} - - // Enter a parse tree produced by CqlParser#functionArgs. - enterFunctionArgs(ctx) {} - - // Exit a parse tree produced by CqlParser#functionArgs. - exitFunctionArgs(ctx) {} - - // Enter a parse tree produced by CqlParser#constant. - enterConstant(ctx) {} - - // Exit a parse tree produced by CqlParser#constant. - exitConstant(ctx) {} - - // Enter a parse tree produced by CqlParser#decimalLiteral. - enterDecimalLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#decimalLiteral. - exitDecimalLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#floatLiteral. - enterFloatLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#floatLiteral. - exitFloatLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#stringLiteral. - enterStringLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#stringLiteral. - exitStringLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#booleanLiteral. - enterBooleanLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#booleanLiteral. - exitBooleanLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#hexadecimalLiteral. - enterHexadecimalLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#hexadecimalLiteral. - exitHexadecimalLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#keyspace. - enterKeyspace(ctx) {} - - // Exit a parse tree produced by CqlParser#keyspace. - exitKeyspace(ctx) {} - - // Enter a parse tree produced by CqlParser#table. - enterTable(ctx) {} - - // Exit a parse tree produced by CqlParser#table. - exitTable(ctx) {} - - // Enter a parse tree produced by CqlParser#column. - enterColumn(ctx) {} - - // Exit a parse tree produced by CqlParser#column. - exitColumn(ctx) {} - - // Enter a parse tree produced by CqlParser#dataType. - enterDataType(ctx) {} - - // Exit a parse tree produced by CqlParser#dataType. - exitDataType(ctx) {} - - // Enter a parse tree produced by CqlParser#dataTypeName. - enterDataTypeName(ctx) {} - - // Exit a parse tree produced by CqlParser#dataTypeName. - exitDataTypeName(ctx) {} - - // Enter a parse tree produced by CqlParser#dataTypeDefinition. - enterDataTypeDefinition(ctx) {} - - // Exit a parse tree produced by CqlParser#dataTypeDefinition. - exitDataTypeDefinition(ctx) {} - - // Enter a parse tree produced by CqlParser#orderDirection. - enterOrderDirection(ctx) {} - - // Exit a parse tree produced by CqlParser#orderDirection. - exitOrderDirection(ctx) {} - - // Enter a parse tree produced by CqlParser#role. - enterRole(ctx) {} - - // Exit a parse tree produced by CqlParser#role. - exitRole(ctx) {} - - // Enter a parse tree produced by CqlParser#trigger. - enterTrigger(ctx) {} - - // Exit a parse tree produced by CqlParser#trigger. - exitTrigger(ctx) {} - - // Enter a parse tree produced by CqlParser#triggerClass. - enterTriggerClass(ctx) {} - - // Exit a parse tree produced by CqlParser#triggerClass. - exitTriggerClass(ctx) {} - - // Enter a parse tree produced by CqlParser#materializedView. - enterMaterializedView(ctx) {} - - // Exit a parse tree produced by CqlParser#materializedView. - exitMaterializedView(ctx) {} - - // Enter a parse tree produced by CqlParser#type. - enterType(ctx) {} - - // Exit a parse tree produced by CqlParser#type. - exitType(ctx) {} - - // Enter a parse tree produced by CqlParser#aggregate. - enterAggregate(ctx) {} - - // Exit a parse tree produced by CqlParser#aggregate. - exitAggregate(ctx) {} - - // Enter a parse tree produced by CqlParser#functionStatement. - enterFunctionStatement(ctx) {} - - // Exit a parse tree produced by CqlParser#functionStatement. - exitFunctionStatement(ctx) {} - - // Enter a parse tree produced by CqlParser#language. - enterLanguage(ctx) {} - - // Exit a parse tree produced by CqlParser#language. - exitLanguage(ctx) {} - - // Enter a parse tree produced by CqlParser#user. - enterUser(ctx) {} - - // Exit a parse tree produced by CqlParser#user. - exitUser(ctx) {} - - // Enter a parse tree produced by CqlParser#password. - enterPassword(ctx) {} - - // Exit a parse tree produced by CqlParser#password. - exitPassword(ctx) {} - - // Enter a parse tree produced by CqlParser#hashKey. - enterHashKey(ctx) {} - - // Exit a parse tree produced by CqlParser#hashKey. - exitHashKey(ctx) {} - - // Enter a parse tree produced by CqlParser#param. - enterParam(ctx) {} - - // Exit a parse tree produced by CqlParser#param. - exitParam(ctx) {} - - // Enter a parse tree produced by CqlParser#paramName. - enterParamName(ctx) {} - - // Exit a parse tree produced by CqlParser#paramName. - exitParamName(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAdd. - enterKwAdd(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAdd. - exitKwAdd(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAggregate. - enterKwAggregate(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAggregate. - exitKwAggregate(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAll. - enterKwAll(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAll. - exitKwAll(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAllPermissions. - enterKwAllPermissions(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAllPermissions. - exitKwAllPermissions(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAllow. - enterKwAllow(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAllow. - exitKwAllow(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAlter. - enterKwAlter(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAlter. - exitKwAlter(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAnd. - enterKwAnd(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAnd. - exitKwAnd(ctx) {} - - // Enter a parse tree produced by CqlParser#kwApply. - enterKwApply(ctx) {} - - // Exit a parse tree produced by CqlParser#kwApply. - exitKwApply(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAs. - enterKwAs(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAs. - exitKwAs(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAsc. - enterKwAsc(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAsc. - exitKwAsc(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAuthorize. - enterKwAuthorize(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAuthorize. - exitKwAuthorize(ctx) {} - - // Enter a parse tree produced by CqlParser#kwBatch. - enterKwBatch(ctx) {} - - // Exit a parse tree produced by CqlParser#kwBatch. - exitKwBatch(ctx) {} - - // Enter a parse tree produced by CqlParser#kwBegin. - enterKwBegin(ctx) {} - - // Exit a parse tree produced by CqlParser#kwBegin. - exitKwBegin(ctx) {} - - // Enter a parse tree produced by CqlParser#kwBy. - enterKwBy(ctx) {} - - // Exit a parse tree produced by CqlParser#kwBy. - exitKwBy(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCalled. - enterKwCalled(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCalled. - exitKwCalled(ctx) {} - - // Enter a parse tree produced by CqlParser#kwClustering. - enterKwClustering(ctx) {} - - // Exit a parse tree produced by CqlParser#kwClustering. - exitKwClustering(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCompact. - enterKwCompact(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCompact. - exitKwCompact(ctx) {} - - // Enter a parse tree produced by CqlParser#kwContains. - enterKwContains(ctx) {} - - // Exit a parse tree produced by CqlParser#kwContains. - exitKwContains(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCreate. - enterKwCreate(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCreate. - exitKwCreate(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDelete. - enterKwDelete(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDelete. - exitKwDelete(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDesc. - enterKwDesc(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDesc. - exitKwDesc(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDescibe. - enterKwDescibe(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDescibe. - exitKwDescibe(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDistinct. - enterKwDistinct(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDistinct. - exitKwDistinct(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDrop. - enterKwDrop(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDrop. - exitKwDrop(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDurableWrites. - enterKwDurableWrites(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDurableWrites. - exitKwDurableWrites(ctx) {} - - // Enter a parse tree produced by CqlParser#kwEntries. - enterKwEntries(ctx) {} - - // Exit a parse tree produced by CqlParser#kwEntries. - exitKwEntries(ctx) {} - - // Enter a parse tree produced by CqlParser#kwExecute. - enterKwExecute(ctx) {} - - // Exit a parse tree produced by CqlParser#kwExecute. - exitKwExecute(ctx) {} - - // Enter a parse tree produced by CqlParser#kwExists. - enterKwExists(ctx) {} - - // Exit a parse tree produced by CqlParser#kwExists. - exitKwExists(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFiltering. - enterKwFiltering(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFiltering. - exitKwFiltering(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFinalfunc. - enterKwFinalfunc(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFinalfunc. - exitKwFinalfunc(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFrom. - enterKwFrom(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFrom. - exitKwFrom(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFull. - enterKwFull(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFull. - exitKwFull(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFunction. - enterKwFunction(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFunction. - exitKwFunction(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFunctions. - enterKwFunctions(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFunctions. - exitKwFunctions(ctx) {} - - // Enter a parse tree produced by CqlParser#kwGrant. - enterKwGrant(ctx) {} - - // Exit a parse tree produced by CqlParser#kwGrant. - exitKwGrant(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIf. - enterKwIf(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIf. - exitKwIf(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIn. - enterKwIn(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIn. - exitKwIn(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIndex. - enterKwIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIndex. - exitKwIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCustom. - enterKwCustom(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCustom. - exitKwCustom(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSearch. - enterKwSearch(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSearch. - exitKwSearch(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAscii. - enterKwAscii(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAscii. - exitKwAscii(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNormalize. - enterKwNormalize(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNormalize. - exitKwNormalize(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAnalyzed. - enterKwAnalyzed(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAnalyzed. - exitKwAnalyzed(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIsLiteral. - enterKwIsLiteral(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIsLiteral. - exitKwIsLiteral(ctx) {} - - // Enter a parse tree produced by CqlParser#kwMaxCompactionFlushMemoryInMb. - enterKwMaxCompactionFlushMemoryInMb(ctx) {} - - // Exit a parse tree produced by CqlParser#kwMaxCompactionFlushMemoryInMb. - exitKwMaxCompactionFlushMemoryInMb(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTokenizationEnableStemming. - enterKwTokenizationEnableStemming(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTokenizationEnableStemming. - exitKwTokenizationEnableStemming(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTokenizationSkipStopWords. - enterKwTokenizationSkipStopWords(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTokenizationSkipStopWords. - exitKwTokenizationSkipStopWords(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTokenizationLocale. - enterKwTokenizationLocale(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTokenizationLocale. - exitKwTokenizationLocale(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTokenizationNormalizeLowercase. - enterKwTokenizationNormalizeLowercase(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTokenizationNormalizeLowercase. - exitKwTokenizationNormalizeLowercase(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTokenizationNormalizeUppercase. - enterKwTokenizationNormalizeUppercase(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTokenizationNormalizeUppercase. - exitKwTokenizationNormalizeUppercase(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNormalizeLowercase. - enterKwNormalizeLowercase(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNormalizeLowercase. - exitKwNormalizeLowercase(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNormalizeUppercase. - enterKwNormalizeUppercase(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNormalizeUppercase. - exitKwNormalizeUppercase(ctx) {} - - // Enter a parse tree produced by CqlParser#kwMode. - enterKwMode(ctx) {} - - // Exit a parse tree produced by CqlParser#kwMode. - exitKwMode(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAnalyzerClass. - enterKwAnalyzerClass(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAnalyzerClass. - exitKwAnalyzerClass(ctx) {} - - // Enter a parse tree produced by CqlParser#kwStorageAttachedIndex. - enterKwStorageAttachedIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#kwStorageAttachedIndex. - exitKwStorageAttachedIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSolrIndex. - enterKwSolrIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSolrIndex. - exitKwSolrIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSASIIndex. - enterKwSASIIndex(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSASIIndex. - exitKwSASIIndex(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSpaceSavingNoJoin. - enterKwSpaceSavingNoJoin(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSpaceSavingNoJoin. - exitKwSpaceSavingNoJoin(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSpaceSavingAll. - enterKwSpaceSavingAll(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSpaceSavingAll. - exitKwSpaceSavingAll(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSpaceSavingSlowTriePrecision. - enterKwSpaceSavingSlowTriePrecision(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSpaceSavingSlowTriePrecision. - exitKwSpaceSavingSlowTriePrecision(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSpaceSavingNoTextField. - enterKwSpaceSavingNoTextField(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSpaceSavingNoTextField. - exitKwSpaceSavingNoTextField(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCopyField. - enterKwCopyField(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCopyField. - exitKwCopyField(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDocValues. - enterKwDocValues(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDocValues. - exitKwDocValues(ctx) {} - - // Enter a parse tree produced by CqlParser#kwExcluded. - enterKwExcluded(ctx) {} - - // Exit a parse tree produced by CqlParser#kwExcluded. - exitKwExcluded(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIndexed. - enterKwIndexed(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIndexed. - exitKwIndexed(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLowerCase. - enterKwLowerCase(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLowerCase. - exitKwLowerCase(ctx) {} - - // Enter a parse tree produced by CqlParser#kwColumns. - enterKwColumns(ctx) {} - - // Exit a parse tree produced by CqlParser#kwColumns. - exitKwColumns(ctx) {} - - // Enter a parse tree produced by CqlParser#kwProfiles. - enterKwProfiles(ctx) {} - - // Exit a parse tree produced by CqlParser#kwProfiles. - exitKwProfiles(ctx) {} - - // Enter a parse tree produced by CqlParser#kwConfig. - enterKwConfig(ctx) {} - - // Exit a parse tree produced by CqlParser#kwConfig. - exitKwConfig(ctx) {} - - // Enter a parse tree produced by CqlParser#kwAutoCommitTime. - enterKwAutoCommitTime(ctx) {} - - // Exit a parse tree produced by CqlParser#kwAutoCommitTime. - exitKwAutoCommitTime(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDefaultQueryField. - enterKwDefaultQueryField(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDefaultQueryField. - exitKwDefaultQueryField(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDirectoryFactory. - enterKwDirectoryFactory(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDirectoryFactory. - exitKwDirectoryFactory(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFilterCacheLowWaterMark. - enterKwFilterCacheLowWaterMark(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFilterCacheLowWaterMark. - exitKwFilterCacheLowWaterMark(ctx) {} - - // Enter a parse tree produced by CqlParser#kwFilterCacheHighWaterMark. - enterKwFilterCacheHighWaterMark(ctx) {} - - // Exit a parse tree produced by CqlParser#kwFilterCacheHighWaterMark. - exitKwFilterCacheHighWaterMark(ctx) {} - - // Enter a parse tree produced by CqlParser#kwDirectoryFactoryClass. - enterKwDirectoryFactoryClass(ctx) {} - - // Exit a parse tree produced by CqlParser#kwDirectoryFactoryClass. - exitKwDirectoryFactoryClass(ctx) {} - - // Enter a parse tree produced by CqlParser#kwMergeMaxThreadCount. - enterKwMergeMaxThreadCount(ctx) {} - - // Exit a parse tree produced by CqlParser#kwMergeMaxThreadCount. - exitKwMergeMaxThreadCount(ctx) {} - - // Enter a parse tree produced by CqlParser#kwMergeMaxMergeCount. - enterKwMergeMaxMergeCount(ctx) {} - - // Exit a parse tree produced by CqlParser#kwMergeMaxMergeCount. - exitKwMergeMaxMergeCount(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRamBufferSize. - enterKwRamBufferSize(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRamBufferSize. - exitKwRamBufferSize(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRealtime. - enterKwRealtime(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRealtime. - exitKwRealtime(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRecovery. - enterKwRecovery(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRecovery. - exitKwRecovery(ctx) {} - - // Enter a parse tree produced by CqlParser#kwReindex. - enterKwReindex(ctx) {} - - // Exit a parse tree produced by CqlParser#kwReindex. - exitKwReindex(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLenient. - enterKwLenient(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLenient. - exitKwLenient(ctx) {} - - // Enter a parse tree produced by CqlParser#kwStandard. - enterKwStandard(ctx) {} - - // Exit a parse tree produced by CqlParser#kwStandard. - exitKwStandard(ctx) {} - - // Enter a parse tree produced by CqlParser#kwEncrypted. - enterKwEncrypted(ctx) {} - - // Exit a parse tree produced by CqlParser#kwEncrypted. - exitKwEncrypted(ctx) {} - - // Enter a parse tree produced by CqlParser#kwCaseSensitive. - enterKwCaseSensitive(ctx) {} - - // Exit a parse tree produced by CqlParser#kwCaseSensitive. - exitKwCaseSensitive(ctx) {} - - // Enter a parse tree produced by CqlParser#kwInitcond. - enterKwInitcond(ctx) {} - - // Exit a parse tree produced by CqlParser#kwInitcond. - exitKwInitcond(ctx) {} - - // Enter a parse tree produced by CqlParser#kwInput. - enterKwInput(ctx) {} - - // Exit a parse tree produced by CqlParser#kwInput. - exitKwInput(ctx) {} - - // Enter a parse tree produced by CqlParser#kwInsert. - enterKwInsert(ctx) {} - - // Exit a parse tree produced by CqlParser#kwInsert. - exitKwInsert(ctx) {} - - // Enter a parse tree produced by CqlParser#kwInto. - enterKwInto(ctx) {} - - // Exit a parse tree produced by CqlParser#kwInto. - exitKwInto(ctx) {} - - // Enter a parse tree produced by CqlParser#kwIs. - enterKwIs(ctx) {} - - // Exit a parse tree produced by CqlParser#kwIs. - exitKwIs(ctx) {} - - // Enter a parse tree produced by CqlParser#kwJson. - enterKwJson(ctx) {} - - // Exit a parse tree produced by CqlParser#kwJson. - exitKwJson(ctx) {} - - // Enter a parse tree produced by CqlParser#kwKey. - enterKwKey(ctx) {} - - // Exit a parse tree produced by CqlParser#kwKey. - exitKwKey(ctx) {} - - // Enter a parse tree produced by CqlParser#kwKeys. - enterKwKeys(ctx) {} - - // Exit a parse tree produced by CqlParser#kwKeys. - exitKwKeys(ctx) {} - - // Enter a parse tree produced by CqlParser#kwKeyspace. - enterKwKeyspace(ctx) {} - - // Exit a parse tree produced by CqlParser#kwKeyspace. - exitKwKeyspace(ctx) {} - - // Enter a parse tree produced by CqlParser#kwKeyspaces. - enterKwKeyspaces(ctx) {} - - // Exit a parse tree produced by CqlParser#kwKeyspaces. - exitKwKeyspaces(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLanguage. - enterKwLanguage(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLanguage. - exitKwLanguage(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLimit. - enterKwLimit(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLimit. - exitKwLimit(ctx) {} - - // Enter a parse tree produced by CqlParser#kwList. - enterKwList(ctx) {} - - // Exit a parse tree produced by CqlParser#kwList. - exitKwList(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLogged. - enterKwLogged(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLogged. - exitKwLogged(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLogin. - enterKwLogin(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLogin. - exitKwLogin(ctx) {} - - // Enter a parse tree produced by CqlParser#kwMaterialized. - enterKwMaterialized(ctx) {} - - // Exit a parse tree produced by CqlParser#kwMaterialized. - exitKwMaterialized(ctx) {} - - // Enter a parse tree produced by CqlParser#kwModify. - enterKwModify(ctx) {} - - // Exit a parse tree produced by CqlParser#kwModify. - exitKwModify(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNosuperuser. - enterKwNosuperuser(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNosuperuser. - exitKwNosuperuser(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNorecursive. - enterKwNorecursive(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNorecursive. - exitKwNorecursive(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNot. - enterKwNot(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNot. - exitKwNot(ctx) {} - - // Enter a parse tree produced by CqlParser#kwNull. - enterKwNull(ctx) {} - - // Exit a parse tree produced by CqlParser#kwNull. - exitKwNull(ctx) {} - - // Enter a parse tree produced by CqlParser#kwOf. - enterKwOf(ctx) {} - - // Exit a parse tree produced by CqlParser#kwOf. - exitKwOf(ctx) {} - - // Enter a parse tree produced by CqlParser#kwOn. - enterKwOn(ctx) {} - - // Exit a parse tree produced by CqlParser#kwOn. - exitKwOn(ctx) {} - - // Enter a parse tree produced by CqlParser#kwOptions. - enterKwOptions(ctx) {} - - // Exit a parse tree produced by CqlParser#kwOptions. - exitKwOptions(ctx) {} - - // Enter a parse tree produced by CqlParser#kwOr. - enterKwOr(ctx) {} - - // Exit a parse tree produced by CqlParser#kwOr. - exitKwOr(ctx) {} - - // Enter a parse tree produced by CqlParser#kwOrder. - enterKwOrder(ctx) {} - - // Exit a parse tree produced by CqlParser#kwOrder. - exitKwOrder(ctx) {} - - // Enter a parse tree produced by CqlParser#kwPassword. - enterKwPassword(ctx) {} - - // Exit a parse tree produced by CqlParser#kwPassword. - exitKwPassword(ctx) {} - - // Enter a parse tree produced by CqlParser#kwPrimary. - enterKwPrimary(ctx) {} - - // Exit a parse tree produced by CqlParser#kwPrimary. - exitKwPrimary(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRename. - enterKwRename(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRename. - exitKwRename(ctx) {} - - // Enter a parse tree produced by CqlParser#kwReplace. - enterKwReplace(ctx) {} - - // Exit a parse tree produced by CqlParser#kwReplace. - exitKwReplace(ctx) {} - - // Enter a parse tree produced by CqlParser#kwReplication. - enterKwReplication(ctx) {} - - // Exit a parse tree produced by CqlParser#kwReplication. - exitKwReplication(ctx) {} - - // Enter a parse tree produced by CqlParser#kwReturns. - enterKwReturns(ctx) {} - - // Exit a parse tree produced by CqlParser#kwReturns. - exitKwReturns(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRole. - enterKwRole(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRole. - exitKwRole(ctx) {} - - // Enter a parse tree produced by CqlParser#kwInternal. - enterKwInternal(ctx) {} - - // Exit a parse tree produced by CqlParser#kwInternal. - exitKwInternal(ctx) {} - - // Enter a parse tree produced by CqlParser#kwLdap. - enterKwLdap(ctx) {} - - // Exit a parse tree produced by CqlParser#kwLdap. - exitKwLdap(ctx) {} - - // Enter a parse tree produced by CqlParser#kwScheme. - enterKwScheme(ctx) {} - - // Exit a parse tree produced by CqlParser#kwScheme. - exitKwScheme(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRoles. - enterKwRoles(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRoles. - exitKwRoles(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSelect. - enterKwSelect(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSelect. - exitKwSelect(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSet. - enterKwSet(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSet. - exitKwSet(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSfunc. - enterKwSfunc(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSfunc. - exitKwSfunc(ctx) {} - - // Enter a parse tree produced by CqlParser#kwStorage. - enterKwStorage(ctx) {} - - // Exit a parse tree produced by CqlParser#kwStorage. - exitKwStorage(ctx) {} - - // Enter a parse tree produced by CqlParser#kwStype. - enterKwStype(ctx) {} - - // Exit a parse tree produced by CqlParser#kwStype. - exitKwStype(ctx) {} - - // Enter a parse tree produced by CqlParser#kwSuperuser. - enterKwSuperuser(ctx) {} - - // Exit a parse tree produced by CqlParser#kwSuperuser. - exitKwSuperuser(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTable. - enterKwTable(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTable. - exitKwTable(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTimestamp. - enterKwTimestamp(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTimestamp. - exitKwTimestamp(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTo. - enterKwTo(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTo. - exitKwTo(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTrigger. - enterKwTrigger(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTrigger. - exitKwTrigger(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTruncate. - enterKwTruncate(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTruncate. - exitKwTruncate(ctx) {} - - // Enter a parse tree produced by CqlParser#kwTtl. - enterKwTtl(ctx) {} - - // Exit a parse tree produced by CqlParser#kwTtl. - exitKwTtl(ctx) {} - - // Enter a parse tree produced by CqlParser#kwType. - enterKwType(ctx) {} - - // Exit a parse tree produced by CqlParser#kwType. - exitKwType(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUnlogged. - enterKwUnlogged(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUnlogged. - exitKwUnlogged(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUpdate. - enterKwUpdate(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUpdate. - exitKwUpdate(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUse. - enterKwUse(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUse. - exitKwUse(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUser. - enterKwUser(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUser. - exitKwUser(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUsers. - enterKwUsers(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUsers. - exitKwUsers(ctx) {} - - // Enter a parse tree produced by CqlParser#kwUsing. - enterKwUsing(ctx) {} - - // Exit a parse tree produced by CqlParser#kwUsing. - exitKwUsing(ctx) {} - - // Enter a parse tree produced by CqlParser#kwValues. - enterKwValues(ctx) {} - - // Exit a parse tree produced by CqlParser#kwValues. - exitKwValues(ctx) {} - - // Enter a parse tree produced by CqlParser#kwView. - enterKwView(ctx) {} - - // Exit a parse tree produced by CqlParser#kwView. - exitKwView(ctx) {} - - // Enter a parse tree produced by CqlParser#kwWhere. - enterKwWhere(ctx) {} - - // Exit a parse tree produced by CqlParser#kwWhere. - exitKwWhere(ctx) {} - - // Enter a parse tree produced by CqlParser#kwWith. - enterKwWith(ctx) {} - - // Exit a parse tree produced by CqlParser#kwWith. - exitKwWith(ctx) {} - - // Enter a parse tree produced by CqlParser#kwRevoke. - enterKwRevoke(ctx) {} - - // Exit a parse tree produced by CqlParser#kwRevoke. - exitKwRevoke(ctx) {} - - // Enter a parse tree produced by CqlParser#eof. - enterEof(ctx) {} - - // Exit a parse tree produced by CqlParser#eof. - exitEof(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketLr. - enterSyntaxBracketLr(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketLr. - exitSyntaxBracketLr(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketRr. - enterSyntaxBracketRr(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketRr. - exitSyntaxBracketRr(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketLc. - enterSyntaxBracketLc(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketLc. - exitSyntaxBracketLc(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketRc. - enterSyntaxBracketRc(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketRc. - exitSyntaxBracketRc(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketLa. - enterSyntaxBracketLa(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketLa. - exitSyntaxBracketLa(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketRa. - enterSyntaxBracketRa(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketRa. - exitSyntaxBracketRa(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketLs. - enterSyntaxBracketLs(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketLs. - exitSyntaxBracketLs(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxBracketRs. - enterSyntaxBracketRs(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxBracketRs. - exitSyntaxBracketRs(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxComma. - enterSyntaxComma(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxComma. - exitSyntaxComma(ctx) {} - - // Enter a parse tree produced by CqlParser#syntaxColon. - enterSyntaxColon(ctx) {} - - // Exit a parse tree produced by CqlParser#syntaxColon. - exitSyntaxColon(ctx) {} - - // Enter a parse tree produced by CqlParser#id. - enterId(ctx) {} - - // Exit a parse tree produced by CqlParser#id. - exitId(ctx) {} -} - -exports.CqlParserListener = CqlParserListener; diff --git a/reverse_engineering/parser/CqlParserVisitor.js b/reverse_engineering/parser/CqlParserVisitor.js deleted file mode 100644 index e9ebd283..00000000 --- a/reverse_engineering/parser/CqlParserVisitor.js +++ /dev/null @@ -1,1734 +0,0 @@ -// Generated from grammars/CqlParser.g4 by ANTLR 4.9.2 -// jshint ignore: start -var antlr4 = require('antlr4/index'); - -// This class defines a complete generic visitor for a parse tree produced by CqlParser. - -class CqlParserVisitor extends antlr4.tree.ParseTreeVisitor { - // Visit a parse tree produced by CqlParser#root. - visitRoot(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#cqls. - visitCqls(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#statementSeparator. - visitStatementSeparator(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#empty. - visitEmpty(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#cql. - visitCql(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#revoke. - visitRevoke(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#listUsers. - visitListUsers(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#listRoles. - visitListRoles(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#listPermissions. - visitListPermissions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#grant. - visitGrant(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#priviledge. - visitPriviledge(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#resource. - visitResource(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createUser. - visitCreateUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createRole. - visitCreateRole(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createType. - visitCreateType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#typeMemberColumnList. - visitTypeMemberColumnList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createTrigger. - visitCreateTrigger(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createMaterializedView. - visitCreateMaterializedView(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#materializedViewWhere. - visitMaterializedViewWhere(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#columnNotNullList. - visitColumnNotNullList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#columnNotNull. - visitColumnNotNull(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#materializedViewOptions. - visitMaterializedViewOptions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createKeyspace. - visitCreateKeyspace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createFunction. - visitCreateFunction(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#codeBlock. - visitCodeBlock(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#paramList. - visitParamList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#returnMode. - visitReturnMode(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createAggregate. - visitCreateAggregate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#initCondDefinition. - visitInitCondDefinition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#initCondHash. - visitInitCondHash(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#initCondHashItem. - visitInitCondHashItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#initCondListNested. - visitInitCondListNested(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#initCondList. - visitInitCondList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#orReplace. - visitOrReplace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterUser. - visitAlterUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#userPassword. - visitUserPassword(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#userSuperUser. - visitUserSuperUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterType. - visitAlterType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeOperation. - visitAlterTypeOperation(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeRename. - visitAlterTypeRename(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeRenameList. - visitAlterTypeRenameList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeRenameItem. - visitAlterTypeRenameItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeAdd. - visitAlterTypeAdd(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTypeAlterType. - visitAlterTypeAlterType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTable. - visitAlterTable(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableOperation. - visitAlterTableOperation(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableWith. - visitAlterTableWith(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableRename. - visitAlterTableRename(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableDropCompactStorage. - visitAlterTableDropCompactStorage(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableDropColumns. - visitAlterTableDropColumns(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableDropColumnList. - visitAlterTableDropColumnList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableAdd. - visitAlterTableAdd(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterTableColumnDefinition. - visitAlterTableColumnDefinition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterRole. - visitAlterRole(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#roleWith. - visitRoleWith(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#roleWithOptions. - visitRoleWithOptions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterMaterializedView. - visitAlterMaterializedView(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropUser. - visitDropUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropType. - visitDropType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropMaterializedView. - visitDropMaterializedView(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropAggregate. - visitDropAggregate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropFunction. - visitDropFunction(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropTrigger. - visitDropTrigger(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropRole. - visitDropRole(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropTable. - visitDropTable(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropKeyspace. - visitDropKeyspace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dropIndex. - visitDropIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createTable. - visitCreateTable(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#withElement. - visitWithElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#clusteringOrderColumns. - visitClusteringOrderColumns(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#clusteringOrder. - visitClusteringOrder(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#tableOptions. - visitTableOptions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#tableOptionItem. - visitTableOptionItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#tableOptionName. - visitTableOptionName(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#tableOptionValue. - visitTableOptionValue(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#optionHash. - visitOptionHash(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#optionHashItem. - visitOptionHashItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#optionHashKey. - visitOptionHashKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#optionHashValue. - visitOptionHashValue(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#columnDefinitionList. - visitColumnDefinitionList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#columnDefinition. - visitColumnDefinition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#primaryKeyColumn. - visitPrimaryKeyColumn(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#primaryKeyElement. - visitPrimaryKeyElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#primaryKeyDefinition. - visitPrimaryKeyDefinition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#singlePrimaryKey. - visitSinglePrimaryKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#compoundKey. - visitCompoundKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#compositeKey. - visitCompositeKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#partitionKeyList. - visitPartitionKeyList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#clusteringKeyList. - visitClusteringKeyList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#partitionKey. - visitPartitionKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#clusteringKey. - visitClusteringKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#applyBatch. - visitApplyBatch(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#beginBatch. - visitBeginBatch(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#batchType. - visitBatchType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#alterKeyspace. - visitAlterKeyspace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#replicationList. - visitReplicationList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#replicationListItem. - visitReplicationListItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#durableWrites. - visitDurableWrites(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#use. - visitUse(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#truncate. - visitTruncate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#secondaryIndex. - visitSecondaryIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#customIndex. - visitCustomIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#customIndexOption. - visitCustomIndexOption(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#createSearchIndex. - visitCreateSearchIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexConfigs. - visitSearchIndexConfigs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#directoryFactory. - visitDirectoryFactory(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexOptions. - visitSearchIndexOptions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexProfile. - visitSearchIndexProfile(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexProfiles. - visitSearchIndexProfiles(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexColumnList. - visitSearchIndexColumnList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#searchIndexColumn. - visitSearchIndexColumn(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexName. - visitIndexName(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexColumnSpec. - visitIndexColumnSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexKeysSpec. - visitIndexKeysSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexEntriesSSpec. - visitIndexEntriesSSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexFullSpec. - visitIndexFullSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#indexValuesSpec. - visitIndexValuesSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#deleteStatement. - visitDeleteStatement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#deleteColumnList. - visitDeleteColumnList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#deleteColumnItem. - visitDeleteColumnItem(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#update. - visitUpdate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ifSpec. - visitIfSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ifConditionList. - visitIfConditionList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ifCondition. - visitIfCondition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignments. - visitAssignments(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentElement. - visitAssignmentElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentSet. - visitAssignmentSet(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentMap. - visitAssignmentMap(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentMapExpression. - visitAssignmentMapExpression(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentList. - visitAssignmentList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#assignmentTuple. - visitAssignmentTuple(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#insert. - visitInsert(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#usingTtlTimestamp. - visitUsingTtlTimestamp(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#timestamp. - visitTimestamp(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ttl. - visitTtl(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#usingTimestampSpec. - visitUsingTimestampSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ifNotExist. - visitIfNotExist(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#ifExist. - visitIfExist(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#insertValuesSpec. - visitInsertValuesSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#insertColumnSpec. - visitInsertColumnSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#columnList. - visitColumnList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#expressionList. - visitExpressionList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#expression. - visitExpression(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#select. - visitSelect(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#allowFilteringSpec. - visitAllowFilteringSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#limitSpec. - visitLimitSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#fromSpec. - visitFromSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#fromSpecElement. - visitFromSpecElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#orderSpec. - visitOrderSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#orderSpecElement. - visitOrderSpecElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#whereSpec. - visitWhereSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#distinctSpec. - visitDistinctSpec(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#selectElements. - visitSelectElements(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#selectElement. - visitSelectElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#relationElements. - visitRelationElements(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#relationElement. - visitRelationElement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#relalationContains. - visitRelalationContains(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#relalationContainsKey. - visitRelalationContainsKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#functionCall. - visitFunctionCall(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#functionArgs. - visitFunctionArgs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#constant. - visitConstant(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#decimalLiteral. - visitDecimalLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#floatLiteral. - visitFloatLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#stringLiteral. - visitStringLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#booleanLiteral. - visitBooleanLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#hexadecimalLiteral. - visitHexadecimalLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#keyspace. - visitKeyspace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#table. - visitTable(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#column. - visitColumn(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dataType. - visitDataType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dataTypeName. - visitDataTypeName(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#dataTypeDefinition. - visitDataTypeDefinition(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#orderDirection. - visitOrderDirection(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#role. - visitRole(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#trigger. - visitTrigger(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#triggerClass. - visitTriggerClass(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#materializedView. - visitMaterializedView(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#type. - visitType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#aggregate. - visitAggregate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#functionStatement. - visitFunctionStatement(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#language. - visitLanguage(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#user. - visitUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#password. - visitPassword(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#hashKey. - visitHashKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#param. - visitParam(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#paramName. - visitParamName(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAdd. - visitKwAdd(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAggregate. - visitKwAggregate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAll. - visitKwAll(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAllPermissions. - visitKwAllPermissions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAllow. - visitKwAllow(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAlter. - visitKwAlter(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAnd. - visitKwAnd(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwApply. - visitKwApply(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAs. - visitKwAs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAsc. - visitKwAsc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAuthorize. - visitKwAuthorize(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwBatch. - visitKwBatch(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwBegin. - visitKwBegin(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwBy. - visitKwBy(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCalled. - visitKwCalled(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwClustering. - visitKwClustering(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCompact. - visitKwCompact(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwContains. - visitKwContains(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCreate. - visitKwCreate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDelete. - visitKwDelete(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDesc. - visitKwDesc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDescibe. - visitKwDescibe(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDistinct. - visitKwDistinct(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDrop. - visitKwDrop(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDurableWrites. - visitKwDurableWrites(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwEntries. - visitKwEntries(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwExecute. - visitKwExecute(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwExists. - visitKwExists(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFiltering. - visitKwFiltering(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFinalfunc. - visitKwFinalfunc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFrom. - visitKwFrom(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFull. - visitKwFull(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFunction. - visitKwFunction(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFunctions. - visitKwFunctions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwGrant. - visitKwGrant(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIf. - visitKwIf(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIn. - visitKwIn(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIndex. - visitKwIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCustom. - visitKwCustom(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSearch. - visitKwSearch(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAscii. - visitKwAscii(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNormalize. - visitKwNormalize(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAnalyzed. - visitKwAnalyzed(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIsLiteral. - visitKwIsLiteral(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwMaxCompactionFlushMemoryInMb. - visitKwMaxCompactionFlushMemoryInMb(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTokenizationEnableStemming. - visitKwTokenizationEnableStemming(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTokenizationSkipStopWords. - visitKwTokenizationSkipStopWords(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTokenizationLocale. - visitKwTokenizationLocale(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTokenizationNormalizeLowercase. - visitKwTokenizationNormalizeLowercase(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTokenizationNormalizeUppercase. - visitKwTokenizationNormalizeUppercase(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNormalizeLowercase. - visitKwNormalizeLowercase(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNormalizeUppercase. - visitKwNormalizeUppercase(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwMode. - visitKwMode(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAnalyzerClass. - visitKwAnalyzerClass(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwStorageAttachedIndex. - visitKwStorageAttachedIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSolrIndex. - visitKwSolrIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSASIIndex. - visitKwSASIIndex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSpaceSavingNoJoin. - visitKwSpaceSavingNoJoin(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSpaceSavingAll. - visitKwSpaceSavingAll(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSpaceSavingSlowTriePrecision. - visitKwSpaceSavingSlowTriePrecision(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSpaceSavingNoTextField. - visitKwSpaceSavingNoTextField(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCopyField. - visitKwCopyField(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDocValues. - visitKwDocValues(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwExcluded. - visitKwExcluded(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIndexed. - visitKwIndexed(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLowerCase. - visitKwLowerCase(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwColumns. - visitKwColumns(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwProfiles. - visitKwProfiles(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwConfig. - visitKwConfig(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwAutoCommitTime. - visitKwAutoCommitTime(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDefaultQueryField. - visitKwDefaultQueryField(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDirectoryFactory. - visitKwDirectoryFactory(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFilterCacheLowWaterMark. - visitKwFilterCacheLowWaterMark(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwFilterCacheHighWaterMark. - visitKwFilterCacheHighWaterMark(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwDirectoryFactoryClass. - visitKwDirectoryFactoryClass(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwMergeMaxThreadCount. - visitKwMergeMaxThreadCount(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwMergeMaxMergeCount. - visitKwMergeMaxMergeCount(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRamBufferSize. - visitKwRamBufferSize(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRealtime. - visitKwRealtime(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRecovery. - visitKwRecovery(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwReindex. - visitKwReindex(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLenient. - visitKwLenient(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwStandard. - visitKwStandard(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwEncrypted. - visitKwEncrypted(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwCaseSensitive. - visitKwCaseSensitive(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSimilarityFunction. - visitKwSimilarityFunction(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwInitcond. - visitKwInitcond(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwInput. - visitKwInput(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwInsert. - visitKwInsert(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwInto. - visitKwInto(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwIs. - visitKwIs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwJson. - visitKwJson(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwKey. - visitKwKey(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwKeys. - visitKwKeys(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwKeyspace. - visitKwKeyspace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwKeyspaces. - visitKwKeyspaces(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLanguage. - visitKwLanguage(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLimit. - visitKwLimit(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwList. - visitKwList(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLogged. - visitKwLogged(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLogin. - visitKwLogin(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwMaterialized. - visitKwMaterialized(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwModify. - visitKwModify(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNosuperuser. - visitKwNosuperuser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNorecursive. - visitKwNorecursive(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNot. - visitKwNot(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwNull. - visitKwNull(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwOf. - visitKwOf(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwOn. - visitKwOn(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwOptions. - visitKwOptions(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwOr. - visitKwOr(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwOrder. - visitKwOrder(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwPassword. - visitKwPassword(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwPrimary. - visitKwPrimary(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRename. - visitKwRename(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwReplace. - visitKwReplace(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwReplication. - visitKwReplication(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwReturns. - visitKwReturns(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRole. - visitKwRole(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwInternal. - visitKwInternal(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwLdap. - visitKwLdap(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwScheme. - visitKwScheme(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRoles. - visitKwRoles(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSelect. - visitKwSelect(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSet. - visitKwSet(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSfunc. - visitKwSfunc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwStorage. - visitKwStorage(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwStype. - visitKwStype(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwSuperuser. - visitKwSuperuser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTable. - visitKwTable(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTimestamp. - visitKwTimestamp(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTo. - visitKwTo(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTrigger. - visitKwTrigger(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTruncate. - visitKwTruncate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwTtl. - visitKwTtl(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwType. - visitKwType(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUnlogged. - visitKwUnlogged(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUpdate. - visitKwUpdate(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUse. - visitKwUse(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUser. - visitKwUser(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUsers. - visitKwUsers(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwUsing. - visitKwUsing(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwValues. - visitKwValues(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwView. - visitKwView(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwWhere. - visitKwWhere(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwWith. - visitKwWith(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#kwRevoke. - visitKwRevoke(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#eof. - visitEof(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketLr. - visitSyntaxBracketLr(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketRr. - visitSyntaxBracketRr(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketLc. - visitSyntaxBracketLc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketRc. - visitSyntaxBracketRc(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketLa. - visitSyntaxBracketLa(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketRa. - visitSyntaxBracketRa(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketLs. - visitSyntaxBracketLs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxBracketRs. - visitSyntaxBracketRs(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxComma. - visitSyntaxComma(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#syntaxColon. - visitSyntaxColon(ctx) { - return this.visitChildren(ctx); - } - - // Visit a parse tree produced by CqlParser#id. - visitId(ctx) { - return this.visitChildren(ctx); - } -} - -exports.CqlParserVisitor = CqlParserVisitor; diff --git a/reverse_engineering/typesHelper.js b/reverse_engineering/typesHelper.js deleted file mode 100644 index 1dab0ba4..00000000 --- a/reverse_engineering/typesHelper.js +++ /dev/null @@ -1,281 +0,0 @@ -const types = require('cassandra-driver').types; -const defaultData = require('../properties_pane/defaultData.json'); -const abbrHash = { - numeric: 'num', - char: 'str', - timestamp: 'ts', - reference: 'udt' -}; -const defaultColumnName = defaultData.field.name; - -module.exports = (_) => { - const getColumnType = (column, udtHash, sample) => { - const fullCassandraType = types.getDataTypeNameByCode(column.type || column); - const cassandraType = fullCassandraType.split('<')[0]; - - if (udtHash && cassandraType === 'udt') { - udtHash.push({ - udt: column, - sample - }); - return getRef(column); - } - return getType(cassandraType, column, sample, udtHash); - }; - - const getRef = (column) => { - const name = _.get(column, 'type.info.name', - _.get(column, 'info.name', column.name) - ); - - return { type: 'reference', $ref: `#/definitions/${name}`, refName: name }; - }; - - const getType = (cassandraType, column, sample, udtHash) => { - let appType = getAppType(cassandraType); - - if (cassandraType === 'map') { - return handleMap(appType, column, sample, udtHash); - } else if (cassandraType === 'tuple') { - return handleTuple(appType, column, sample, udtHash); - } else if (cassandraType === 'set' || cassandraType === 'list') { - return handleList(appType, column, sample, udtHash); - } else if (cassandraType === 'custom' && isVector(column)) { - return handleVector(appType, column, sample, udtHash); - } else { - return appType; - } - }; - - const handleMap = (appType, column, sample, udtHash) => { - const keyData = (column.info || column.type.info)[0]; - const valueData = (column.info || column.type.info)[1]; - const handledKeyData = getColumnType(keyData); - const properties = getMapProperties({ valueData, sample, udtHash }); - const keySubtype = handledKeyData.mode - ? { keySubtype: handledKeyData.mode } - : {}; - const keyType = handledKeyData.type; - const valueType = getChildTypeByProperties(properties); - const subtype = getSubType(appType.type, valueType); - - return Object.assign({}, appType, keySubtype, { - keyType, - subtype, - properties - }); - }; - - const handleTuple = (appType, column, sample, udtHash) => { - sample = Array.isArray(sample) ? sample : []; - - const items = (column.info || column.type.info).map(item => { - const sampleItem = sample.find(sampleItem => isTypeEqual(sampleItem, item)); - const handledValueData = getColumnType(item, udtHash, sampleItem); - - return handledValueData; - }); - - return Object.assign({}, appType, { items }); - }; - - const handleList = (appType, column, sample, udtHash) => { - const valueData = (column.info || column.type.info); - const items = getItems(valueData, sample, udtHash); - const valueType = (items[0] || { type: 'text' }).type; - const subtype = getSubType(appType.type, valueType); - - return Object.assign({}, appType, { - items: _.uniqWith(items, _.isEqual), subtype - }); - }; - - const handleVector = (appType, column, sample, udtHash) => { - const valueData = (column.info || column.type.info); - const dimension = valueData.dimensions; - const allItems = getItems(valueData.subtype, sample, udtHash); - const items = _.uniqWith(allItems, _.isEqual); - const subtype = (items[0] || { mode: 'float' }).mode; - - return { - ...appType, - dimension, - subtype, - items, - }; - }; - - const getAppType = (type) => { - switch (type) { - case "int": - return { - type: "numeric", - mode: "integer" - }; - case "smallint": - case "tinyint": - case "bigint": - case "counter": - case "decimal": - case "double": - case "float": - case "varint": - return { - type: "numeric", - mode: type - }; - case "text": - case "varchar": - case "ascii": - case "inet": - return { - type: "char", - mode: type - }; - case "boolean": - return { - type: 'bool' - }; - case "timestamp": - case "timeuuid": - case "blob": - case "date": - case "time": - case "uuid": - return { type }; - case "tuple": - case "list": - case "set": - case "map": - return { type }; - default: - return { - type: 'char' - }; - } - } - - const getSubType = (type, subType) => { - return `${type}<${abbrHash[subType] || subType}>`; - } - - const getProperties = (valueData, sample, udtHash) => { - if (!sample || typeof sample !== 'object') { - return getDefaultProperties(valueData, udtHash); - } - - return Object.keys(sample).reduce((result, propertyName) => { - return Object.assign({}, result, { - [propertyName]: getColumnType(valueData, udtHash, sample[propertyName]) - }) - }, {}); - }; - - const getDefaultProperties = (valueData, udtHash) => { - const handledValueData = getColumnType(valueData, udtHash); - const name = handledValueData.refName || defaultColumnName; - - return { - [name]: _.omit(handledValueData, 'refName'), - }; - }; - - const getMapProperties = ({ valueData, sample, udtHash }) => { - const properties = getProperties(valueData, sample, udtHash); - const propertyPairs = Object.entries(properties); - const uniqueProperties = _.uniqWith( - propertyPairs, - ([, propertyA], [, propertyB]) => - propertyA.type === propertyB.type && - propertyA.$ref === propertyB.$ref && - propertyA.mode === propertyB.mode - ); - - return Object.fromEntries(uniqueProperties); - }; - - const getJsonType = (type) => { - switch (type) { - case "smallint": - case "tinyint": - case "int": - case "bigint": - case "counter": - case "decimal": - case "double": - case "float": - case "varint": - return 'number'; - case "text": - case "varchar": - case "ascii": - case "inet": - case "timestamp": - case "timeuuid": - case "blob": - case "date": - case "time": - case "uuid": - return 'string'; - case "boolean": - return 'boolean'; - case "tuple": - case "list": - case "set": - return 'array'; - case "map": - return 'object'; - default: - return 'string'; - } - }; - - const isTypeEqual = (value, valueData) => { - const fullCassandraType = types.getDataTypeNameByCode(valueData.type || valueData); - const cassandraType = fullCassandraType.split('<')[0]; - const jsonType = getJsonType(cassandraType); - - if (jsonType === 'array') { - return Array.isArray(value); - } else if (jsonType === 'array') { - return Object(value) === value; - } else { - return typeof value === jsonType; - } - }; - - const getItems = (valueData, sample, udtHash) => { - if (!Array.isArray(sample) || sample.length === 0) { - return getDefaultItems(valueData, udtHash); - } - - return sample.map(item => { - return getColumnType(valueData, udtHash, item); - }); - }; - - const getDefaultItems = (valueData, udtHash) => { - const handledValueData = getColumnType(valueData, udtHash); - - return [handledValueData]; - }; - - const getChildTypeByProperties = (properties) => { - const key = Object.keys(properties).pop(); - const type = (properties[key] || {}).type; - - if (type) { - return type; - } else { - return 'text'; - } - }; - - const isVector = (column) => { - const valueData = (column.info || column.type.info); - const dimension = valueData?.dimensions; - return !isNaN(+dimension); - }; - - return { getColumnType }; -}; diff --git a/snippets/geo-line.json b/snippets/geo-line.json index 89a6d9dc..620ca516 100644 --- a/snippets/geo-line.json +++ b/snippets/geo-line.json @@ -1,13 +1,18 @@ { "name": "geo-line", "parentType": "array", - "properties": [{ - "type": "set", - "subtype": "set", - "properties": [{ - "type": "numeric" - }, { - "type": "numeric" - }] - }] + "properties": [ + { + "type": "set", + "subtype": "set", + "properties": [ + { + "type": "numeric" + }, + { + "type": "numeric" + } + ] + } + ] } diff --git a/snippets/geo-point.json b/snippets/geo-point.json index 7fcc3846..ce2d3eea 100644 --- a/snippets/geo-point.json +++ b/snippets/geo-point.json @@ -1,9 +1,12 @@ { "name": "geo-point", "parentType": "array", - "properties": [{ - "type": "numeric" - }, { - "type": "numeric" - }] + "properties": [ + { + "type": "numeric" + }, + { + "type": "numeric" + } + ] } diff --git a/snippets/geo-polygon.json b/snippets/geo-polygon.json index d41094fe..144865e0 100644 --- a/snippets/geo-polygon.json +++ b/snippets/geo-polygon.json @@ -1,18 +1,25 @@ { "name": "geo-polygon", "parentType": "array", - "properties": [{ - "type": "list", - "subtype": "list", - "frozen": true, - "properties": [{ - "type": "set", - "subtype": "set", - "properties": [{ - "type": "numeric" - }, { - "type": "numeric" - }] - }] - }] + "properties": [ + { + "type": "list", + "subtype": "list", + "frozen": true, + "properties": [ + { + "type": "set", + "subtype": "set", + "properties": [ + { + "type": "numeric" + }, + { + "type": "numeric" + } + ] + } + ] + } + ] } diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 00000000..c5275b03 --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,31 @@ +{ + "compilerOptions": { + "baseUrl": ".", + "outDir": "./tscDist", + "allowJs": true, + "checkJs": false, + "target": "ES2016", + "lib": ["ESNext", "DOM"], + "sourceMap": true, + "jsx": "react-jsx", + "moduleResolution": "node", + "experimentalDecorators": true, + "noUnusedParameters": true, + "noUnusedLocals": true, + "noImplicitThis": true, + "noImplicitAny": false, + "alwaysStrict": true, + "skipLibCheck": true, + "module": "ESNext", + "strict": true, + "useUnknownInCatchVariables": true, + "allowSyntheticDefaultImports": true, + "isolatedModules": true, + "resolveJsonModule": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "typeRoots": ["./node_modules/@types", "./types"] + }, + "include": ["reverse_engineering", "forward_engineering"], + "exclude": ["**/node_modules/**", "release/**/*"] +} diff --git a/types/DateRangeType.json b/types/DateRangeType.json index d2e815a7..7bb104fa 100644 --- a/types/DateRangeType.json +++ b/types/DateRangeType.json @@ -14,9 +14,9 @@ "static": false, "default": "", "enum": [], - "sample":"", + "sample": "", "pattern": "", - "comments":"", + "comments": "", "format": "" } } diff --git a/types/DseExecutorStateType.json b/types/DseExecutorStateType.json index 5d4b80dd..3f55cf16 100644 --- a/types/DseExecutorStateType.json +++ b/types/DseExecutorStateType.json @@ -8,4 +8,4 @@ "defaultValues": { "primaryKey": false } -} \ No newline at end of file +} diff --git a/types/bool.json b/types/bool.json index b5cc9c7c..6d26b280 100644 --- a/types/bool.json +++ b/types/bool.json @@ -22,4 +22,4 @@ } } ] -} \ No newline at end of file +} diff --git a/types/char.json b/types/char.json index 525d184a..fb3e618a 100644 --- a/types/char.json +++ b/types/char.json @@ -27,33 +27,19 @@ "maxLength": "", "pattern": "", "enum": [], - "sample":"", - "comments":"", + "sample": "", + "comments": "", "mode": "text", "subtype": "string" }, "subtypes": { "object": { "parentType": "jsonObject", - "childValueType": [ - "jsonString", - "jsonNumber", - "jsonObject", - "jsonArray", - "jsonBoolean", - "jsonNull" - ] + "childValueType": ["jsonString", "jsonNumber", "jsonObject", "jsonArray", "jsonBoolean", "jsonNull"] }, "array": { "parentType": "jsonArray", - "childValueType": [ - "jsonString", - "jsonNumber", - "jsonObject", - "jsonArray", - "jsonBoolean", - "jsonNull" - ] + "childValueType": ["jsonString", "jsonNumber", "jsonObject", "jsonArray", "jsonBoolean", "jsonNull"] }, "string": { "parentType": "string" @@ -78,7 +64,7 @@ }, { "type": "blob" - } + } ] }, { @@ -95,4 +81,4 @@ } } ] -} \ No newline at end of file +} diff --git a/types/date.json b/types/date.json index fabecca9..1cf04916 100644 --- a/types/date.json +++ b/types/date.json @@ -5,14 +5,14 @@ "parentType": "string", "useSample": true, "hiddenOnEntity": "view", - "sample":"2014-12-03", + "sample": "2014-12-03", "defaultValues": { "primaryKey": false, "default": "", "enum": [], - "sample":"", - "comments":"", - "pattern":"", + "sample": "", + "comments": "", + "pattern": "", "format": "" }, "descriptor": { diff --git a/types/definitions.json b/types/definitions.json index 91ac4041..79671fb1 100644 --- a/types/definitions.json +++ b/types/definitions.json @@ -19,7 +19,7 @@ }, "subtypes": { "udts": { - "childValueType": [ "udt" ] + "childValueType": ["udt"] } } } diff --git a/types/duration.json b/types/duration.json index 537ae712..2bd8e888 100644 --- a/types/duration.json +++ b/types/duration.json @@ -10,9 +10,9 @@ "primaryKey": false, "default": "", "enum": [], - "sample":"", + "sample": "", "pattern": "", - "comments":"", + "comments": "", "format": "" }, "descriptor": { diff --git a/types/geospatial.json b/types/geospatial.json index fed74efc..c6c949de 100644 --- a/types/geospatial.json +++ b/types/geospatial.json @@ -8,7 +8,7 @@ "defaultValues": { "required": false, "primaryKey": false, - "comments":"", + "comments": "", "properties": [], "relationshipType": "", "parentRelationship": "", @@ -23,6 +23,5 @@ { "name": "LineStringType", "snippet": "geo-line" }, { "name": "PolygonType", "snippet": "geo-polygon" } ] - } } diff --git a/types/list.json b/types/list.json index 6332c1f7..c7f16543 100644 --- a/types/list.json +++ b/types/list.json @@ -46,4 +46,4 @@ "childValueType": "udt" } } -} \ No newline at end of file +} diff --git a/types/map.json b/types/map.json index efbb18b9..ea536b85 100644 --- a/types/map.json +++ b/types/map.json @@ -68,4 +68,4 @@ "childValueName": "2014-12-03" } } -} \ No newline at end of file +} diff --git a/types/object.json b/types/object.json index c7adef2c..04ace1e4 100644 --- a/types/object.json +++ b/types/object.json @@ -31,4 +31,4 @@ ] } } -} \ No newline at end of file +} diff --git a/types/set.json b/types/set.json index 8a2fa285..c87d86ce 100644 --- a/types/set.json +++ b/types/set.json @@ -46,4 +46,4 @@ "childValueType": "udt" } } -} \ No newline at end of file +} diff --git a/types/time.json b/types/time.json index 98570fc1..b2b8045e 100644 --- a/types/time.json +++ b/types/time.json @@ -5,21 +5,24 @@ "parentType": "string", "useSample": true, "hiddenOnEntity": "view", - "sample":"08:45:12.123123", + "sample": "08:45:12.123123", "defaultValues": { "primaryKey": false, "default": "", "minLength": "", "maxLength": "", "enum": [], - "sample":"", + "sample": "", "pattern": "", - "comments":"", + "comments": "", "format": "" }, - "descriptor": [{ - "format": "hh:mm:ss" - }, { - "format": "hh:mm:ss.nnn" - }] + "descriptor": [ + { + "format": "hh:mm:ss" + }, + { + "format": "hh:mm:ss.nnn" + } + ] } diff --git a/types/timestamp.json b/types/timestamp.json index e7e63b3f..fdd8f7e9 100644 --- a/types/timestamp.json +++ b/types/timestamp.json @@ -10,18 +10,22 @@ "primaryKey": false, "default": "", "enum": [], - "sample":"", - "comments":"", - "pattern":"", + "sample": "", + "comments": "", + "pattern": "", "format": "" }, - "descriptor": [{ - "format": "YYYY-MM-DD hh:mm:ss" - }, { - "format": "YYYY-MM-DD hh:mm:ss.nnn" - }, { - "format": "YYYY-MM-DD hh:mm:ss.nnnZ" - }], + "descriptor": [ + { + "format": "YYYY-MM-DD hh:mm:ss" + }, + { + "format": "YYYY-MM-DD hh:mm:ss.nnn" + }, + { + "format": "YYYY-MM-DD hh:mm:ss.nnnZ" + } + ], "compatibilityTypes": [ { "from": { @@ -32,4 +36,4 @@ } } ] -} \ No newline at end of file +} diff --git a/types/timeuuid.json b/types/timeuuid.json index eee585ca..0737a446 100644 --- a/types/timeuuid.json +++ b/types/timeuuid.json @@ -17,9 +17,9 @@ "minLength": "", "maxLength": "", "enum": [], - "sample":"", + "sample": "", "pattern": "", - "comments":"" + "comments": "" }, "compatibilityTypes": [ { @@ -36,4 +36,4 @@ ] } ] -} \ No newline at end of file +} diff --git a/types/tuple.json b/types/tuple.json index 1dfaaf2f..43af07b4 100644 --- a/types/tuple.json +++ b/types/tuple.json @@ -13,4 +13,4 @@ "maxItems": "", "uniqueItems": false } -} \ No newline at end of file +} diff --git a/types/udt.json b/types/udt.json index 52804b9f..eeaa0573 100644 --- a/types/udt.json +++ b/types/udt.json @@ -14,4 +14,4 @@ "frozen": true, "additionalProperties": false } -} \ No newline at end of file +} diff --git a/types/uuid.json b/types/uuid.json index cff834c0..383edd95 100644 --- a/types/uuid.json +++ b/types/uuid.json @@ -17,9 +17,9 @@ "minLength": "", "maxLength": "", "enum": [], - "sample":"", + "sample": "", "pattern": "", - "comments":"" + "comments": "" }, "compatibilityTypes": [ { @@ -31,4 +31,4 @@ } } ] -} \ No newline at end of file +} diff --git a/validation/validationRegularExpressions.json b/validation/validationRegularExpressions.json index cb8472f3..cff781ba 100644 --- a/validation/validationRegularExpressions.json +++ b/validation/validationRegularExpressions.json @@ -1,3 +1,3 @@ { "code": "^[a-z_0-9]*$" -} \ No newline at end of file +}